{"version":3,"file":"StatusLabel.cjs","sources":["../../../src/components/StatusLabel/StatusLabel.tsx"],"sourcesContent":["import {\n  type ComponentPropsWithoutRef,\n  type FC,\n  type PropsWithChildren,\n  memo,\n  useMemo,\n} from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { FaCircleExclamationIcon, FaTriangleExclamationIcon } from '../Icon'\n\nconst classNameGenerator = tv({\n  base: [\n    'smarthr-ui-StatusLabel',\n    'shr-border-shorthand shr-box-content shr-inline-flex shr-min-h-em shr-min-w-[3.5em] shr-items-center shr-justify-center shr-gap-0.25 shr-whitespace-nowrap shr-border-current shr-bg-white shr-px-0.5 shr-py-0.25 shr-text-sm shr-font-bold',\n    // ラベルが天地中央に揃わないため暫定対応\n    'shr-leading-[0]',\n  ],\n  variants: {\n    type: {\n      grey: ['shr-border-grey-20 shr-text-grey', 'contrast-more:shr-border-high-contrast'],\n      blue: 'shr-text-main',\n      /* SmartHR 基本色の Aqua04。StatusLabel 以外では使いません。\n       * https://smarthr.design/basics/colors/#h4-1 */\n      green: 'shr-text-green',\n      red: 'shr-text-danger',\n      warning: 'shr-border-warning-yellow shr-bg-warning-yellow shr-text-black',\n      error: 'shr-border-danger shr-bg-danger shr-text-white',\n    },\n    bold: {\n      true: 'shr-text-white',\n    },\n  },\n  compoundVariants: [\n    {\n      type: 'grey',\n      bold: true,\n      class: 'shr-border-grey-65 shr-bg-[theme(colors.grey.65)]',\n    },\n    {\n      type: 'blue',\n      bold: true,\n      class: 'shr-border-main shr-bg-main',\n    },\n    {\n      type: 'green',\n      bold: true,\n      /* SmartHR 基本色の Aqua04。StatusLabel 以外では使いません。\n       * https://smarthr.design/basics/colors/#h4-1 */\n      class: 'shr-border-green shr-bg-green',\n    },\n    {\n      type: 'red',\n      bold: true,\n      class: 'shr-border-danger shr-bg-danger',\n    },\n    {\n      type: 'warning',\n      bold: true,\n      class: 'shr-border-current shr-text-black',\n    },\n  ],\n})\n\ntype AbstractProps = PropsWithChildren<VariantProps<typeof classNameGenerator>>\ntype Props = AbstractProps & Omit<ComponentPropsWithoutRef<'span'>, keyof AbstractProps>\n\nexport const StatusLabel = memo<Props>(\n  ({ type = 'grey', bold = false, className, children, ...rest }) => {\n    const actualClassName = useMemo(\n      () =>\n        classNameGenerator({\n          className,\n          type,\n          bold,\n        }),\n      [type, bold, className],\n    )\n\n    return (\n      <span {...rest} className={actualClassName}>\n        <Icon type={type} bold={bold} />\n        {children}\n      </span>\n    )\n  },\n)\n\nconst Icon: FC<Pick<Props, 'type' | 'bold'>> = ({ type, bold }) => {\n  if (bold) {\n    switch (type) {\n      case 'warning':\n        return <FaTriangleExclamationIcon />\n      case 'error':\n        return <FaCircleExclamationIcon />\n    }\n  }\n\n  return null\n}\n"],"names":["tv","memo","useMemo","_jsxs","_jsx","FaTriangleExclamationIcon","FaCircleExclamationIcon"],"mappings":";;;;;;;;;AAWA,MAAM,kBAAkB,GAAGA,QAAE,CAAC;AAC5B,IAAA,IAAI,EAAE;QACJ,wBAAwB;QACxB,6OAA6O;;QAE7O,iBAAiB;AAClB,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,CAAC,kCAAkC,EAAE,wCAAwC,CAAC;AACpF,YAAA,IAAI,EAAE,eAAe;AACrB;AACgD;AAChD,YAAA,KAAK,EAAE,gBAAgB;AACvB,YAAA,GAAG,EAAE,iBAAiB;AACtB,YAAA,OAAO,EAAE,gEAAgE;AACzE,YAAA,KAAK,EAAE,gDAAgD;AACxD,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,gBAAgB;AACvB,SAAA;AACF,KAAA;AACD,IAAA,gBAAgB,EAAE;AAChB,QAAA;AACE,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,KAAK,EAAE,mDAAmD;AAC3D,SAAA;AACD,QAAA;AACE,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,IAAI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