lizaui 9.0.2 → 9.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/index.cjs.js +1 -1
- package/dist/button/index.es.js +1 -1
- package/dist/calendar/index.cjs.js +64 -800
- package/dist/calendar/index.cjs.js.map +1 -1
- package/dist/calendar/index.es.js +29 -765
- package/dist/calendar/index.es.js.map +1 -1
- package/dist/checkbox/index.cjs.js +1 -1
- package/dist/checkbox/index.es.js +1 -1
- package/dist/chip/index.cjs.js +9 -9
- package/dist/chip/index.cjs.js.map +1 -1
- package/dist/chip/index.es.js +2 -2
- package/dist/chunks/{button-MKhaqe0K.js → button-B0fpJrMg.js} +3 -3
- package/dist/chunks/{button-MKhaqe0K.js.map → button-B0fpJrMg.js.map} +1 -1
- package/dist/chunks/{button-BKebd9mx.js → button-d5z8H59K.js} +13 -13
- package/dist/chunks/{button-BKebd9mx.js.map → button-d5z8H59K.js.map} +1 -1
- package/dist/chunks/{checkbox-DpLEjjb9.js → checkbox-C1Sssumg.js} +3 -3
- package/dist/chunks/{checkbox-DpLEjjb9.js.map → checkbox-C1Sssumg.js.map} +1 -1
- package/dist/chunks/{checkbox-BoxBfskJ.js → checkbox-ovjcc7jF.js} +15 -15
- package/dist/chunks/{checkbox-BoxBfskJ.js.map → checkbox-ovjcc7jF.js.map} +1 -1
- package/dist/chunks/{index-BHpUy2Ix.js → index-CEKmKomA.js} +2 -2
- package/dist/chunks/{index-BHpUy2Ix.js.map → index-CEKmKomA.js.map} +1 -1
- package/dist/chunks/{index-CATvGmak.js → index-C_sOsPRt.js} +5 -5
- package/dist/chunks/{index-CATvGmak.js.map → index-C_sOsPRt.js.map} +1 -1
- package/dist/chunks/{index-CNDtGisb.js → index-DaMyCNJ8.js} +2 -2
- package/dist/chunks/{index-CNDtGisb.js.map → index-DaMyCNJ8.js.map} +1 -1
- package/dist/chunks/{label-error-DkVGsF5w.js → label-error-BTCuInp7.js} +2 -2
- package/dist/chunks/{label-error-DkVGsF5w.js.map → label-error-BTCuInp7.js.map} +1 -1
- package/dist/chunks/label-error-C8lIsfXu.js +9 -0
- package/dist/chunks/{label-error-2QXnvbxJ.js.map → label-error-C8lIsfXu.js.map} +1 -1
- package/dist/chunks/{ripple-CTAKSntE.js → ripple-Bm6QamOy.js} +4 -4
- package/dist/chunks/{ripple-CTAKSntE.js.map → ripple-Bm6QamOy.js.map} +1 -1
- package/dist/chunks/{scroll-area-CNEU8oOo.js → scroll-area-C0NhSIO2.js} +31 -31
- package/dist/chunks/{scroll-area-CNEU8oOo.js.map → scroll-area-C0NhSIO2.js.map} +1 -1
- package/dist/chunks/{scroll-area-3h3tgoqp.js → scroll-area-JgKF61tc.js} +3 -3
- package/dist/chunks/{scroll-area-3h3tgoqp.js.map → scroll-area-JgKF61tc.js.map} +1 -1
- package/dist/chunks/{select-BW-plZA9.js → select-DGnc8VJi.js} +73 -73
- package/dist/chunks/{select-BW-plZA9.js.map → select-DGnc8VJi.js.map} +1 -1
- package/dist/chunks/{select-wGmz50gN.js → select-Dpyj5dUk.js} +3 -3
- package/dist/chunks/{select-wGmz50gN.js.map → select-Dpyj5dUk.js.map} +1 -1
- package/dist/chunks/{styled-components.browser.esm-DbYXI9h_.js → styled-components.browser.esm-CPR7VH_x.js} +3 -3
- package/dist/chunks/{styled-components.browser.esm-DbYXI9h_.js.map → styled-components.browser.esm-CPR7VH_x.js.map} +1 -1
- package/dist/chunks/{textarea-CPHr2RpC.js → textarea-D2_KC-J4.js} +98 -98
- package/dist/chunks/{textarea-CPHr2RpC.js.map → textarea-D2_KC-J4.js.map} +1 -1
- package/dist/chunks/{textarea-CXQO1MMF.js → textarea-_HQpXiCX.js} +8 -8
- package/dist/chunks/{textarea-CXQO1MMF.js.map → textarea-_HQpXiCX.js.map} +1 -1
- package/dist/chunks/{tooltip-05Mv2hjx.js → tooltip-GGFk8ALK.js} +15 -15
- package/dist/chunks/{tooltip-05Mv2hjx.js.map → tooltip-GGFk8ALK.js.map} +1 -1
- package/dist/chunks/{tooltip-D3J0_sJU.js → tooltip-JwIbppjO.js} +3 -3
- package/dist/chunks/{tooltip-D3J0_sJU.js.map → tooltip-JwIbppjO.js.map} +1 -1
- package/dist/chunks/tv-B0li4IsO.js +41 -0
- package/dist/chunks/tv-B0li4IsO.js.map +1 -0
- package/dist/chunks/tv-CGbWb8zP.js +40 -0
- package/dist/chunks/tv-CGbWb8zP.js.map +1 -0
- package/dist/chunks/utils-H80jjgLf.js +9 -0
- package/dist/chunks/{utils-BnY7EXd5.js.map → utils-H80jjgLf.js.map} +1 -1
- package/dist/chunks/utils-ij3i9zTT.js +8 -0
- package/dist/chunks/{utils-nIKS3WsJ.js.map → utils-ij3i9zTT.js.map} +1 -1
- package/dist/components/calendar/date-picker/date-picker.d.ts +1 -1
- package/dist/components/calendar/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/calendar/date-picker/date-picker.style.d.ts +1 -0
- package/dist/components/calendar/date-picker/date-picker.style.d.ts.map +1 -1
- package/dist/components/calendar/date-picker/interface/date-picker.interface.d.ts +1 -0
- package/dist/components/calendar/date-picker/interface/date-picker.interface.d.ts.map +1 -1
- package/dist/divider/index.cjs.js +4 -4
- package/dist/divider/index.es.js +1 -1
- package/dist/modal/index.cjs.js +17 -17
- package/dist/modal/index.es.js +3 -3
- package/dist/pagination/index.cjs.js +29 -29
- package/dist/pagination/index.cjs.js.map +1 -1
- package/dist/pagination/index.es.js +5 -5
- package/dist/phone-input/index.cjs.js +32 -31
- package/dist/phone-input/index.cjs.js.map +1 -1
- package/dist/phone-input/index.es.js +7 -6
- package/dist/phone-input/index.es.js.map +1 -1
- package/dist/ripple/index.cjs.js +1 -1
- package/dist/select-input/index.cjs.js +39 -39
- package/dist/select-input/index.cjs.js.map +1 -1
- package/dist/select-input/index.es.js +5 -5
- package/dist/table/index.cjs.js +44 -44
- package/dist/table/index.cjs.js.map +1 -1
- package/dist/table/index.es.js +5 -5
- package/dist/time-input/index.cjs.js +53 -53
- package/dist/time-input/index.cjs.js.map +1 -1
- package/dist/time-input/index.es.js +5 -5
- package/dist/tooltip/index.cjs.js +1 -1
- package/dist/tooltip/index.es.js +1 -1
- package/dist/ui/index.cjs.js +324 -324
- package/dist/ui/index.es.js +10 -10
- package/package.json +8 -2
- package/dist/chunks/bundle-mjs-BWLS65yY.js +0 -3003
- package/dist/chunks/bundle-mjs-BWLS65yY.js.map +0 -1
- package/dist/chunks/bundle-mjs-DB1IOBLD.js +0 -3004
- package/dist/chunks/bundle-mjs-DB1IOBLD.js.map +0 -1
- package/dist/chunks/clsx-CBkIpawf.js +0 -16
- package/dist/chunks/clsx-CBkIpawf.js.map +0 -1
- package/dist/chunks/clsx-DgYk2OaC.js +0 -17
- package/dist/chunks/clsx-DgYk2OaC.js.map +0 -1
- package/dist/chunks/label-error-2QXnvbxJ.js +0 -9
- package/dist/chunks/tv-C-wpiWwh.js +0 -274
- package/dist/chunks/tv-C-wpiWwh.js.map +0 -1
- package/dist/chunks/tv-C4gJMNo3.js +0 -275
- package/dist/chunks/tv-C4gJMNo3.js.map +0 -1
- package/dist/chunks/utils-BnY7EXd5.js +0 -9
- package/dist/chunks/utils-nIKS3WsJ.js +0 -8
- package/dist/chunks/v4-BQ42ZlDJ.js +0 -39
- package/dist/chunks/v4-BQ42ZlDJ.js.map +0 -1
- package/dist/chunks/v4-C3omdoBX.js +0 -40
- package/dist/chunks/v4-C3omdoBX.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-DpLEjjb9.js","sources":["../../src/theme/color/checkbox.ts","../../src/components/checkbox/use-checkbox.ts","../../src/components/checkbox/checkbox-icon.tsx","../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { tv } from \"@/lib/tv\";\nimport type { VariantProps } from \"tailwind-variants\";\nimport { groupDataFocusVisibleClasses, hiddenInputClasses } from \"../classes\";\n\n/**\n * Checkbox wrapper **Tailwind Variants** component\n *\n * const {base, wrapper, icon, label} = checkbox({...})\n *\n * @example\n * <label className={base())}>\n * // hidden input\n * <span className={wrapper()} aria-hidden=\"true\" data-selected={selected}>\n * <svg className={icon()}>\n * // check icon\n * </svg>\n * </span>\n * <span className={label()}>Label</span>\n * </label>\n */\nconst checkbox = tv({\n\tslots: {\n\t\tbase: \"group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none\",\n\t\twrapper: [\n\t\t\t\"relative\",\n\t\t\t\"inline-flex\",\n\t\t\t\"items-center\",\n\t\t\t\"justify-center\",\n\t\t\t\"flex-shrink-0\",\n\t\t\t\"overflow-hidden\",\n\t\t\t// before\n\t\t\t\"before:content-['']\",\n\t\t\t\"before:absolute\",\n\t\t\t\"before:inset-0\",\n\t\t\t\"before:border-solid\",\n\t\t\t\"before:border-2\",\n\t\t\t\"before:box-border\",\n\t\t\t\"before:border-default\",\n\t\t\t// after\n\t\t\t\"after:content-['']\",\n\t\t\t\"after:absolute\",\n\t\t\t\"after:inset-0\",\n\t\t\t\"after:scale-50\",\n\t\t\t\"after:opacity-0\",\n\t\t\t\"after:origin-center\",\n\t\t\t\"group-data-[selected=true]:after:scale-100\",\n\t\t\t\"group-data-[selected=true]:after:opacity-100\",\n\t\t\t// hover\n\t\t\t\"group-data-[hover=true]:before:bg-default-100\",\n\t\t\t// focus ring\n\t\t\t...groupDataFocusVisibleClasses,\n\t\t],\n\t\thiddenInput: hiddenInputClasses,\n\t\ticon: \"z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none\",\n\t\tlabel: \"relative text-foreground select-none\",\n\t},\n\tvariants: {\n\t\tcolor: {\n\t\t\tdefault: {\n\t\t\t\twrapper: \"after:bg-default after:text-default-foreground text-default-foreground\",\n\t\t\t},\n\t\t\tprimary: {\n\t\t\t\twrapper: \"after:bg-primary after:text-primary-foreground text-primary-foreground\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\twrapper: \"after:bg-secondary after:text-secondary-foreground text-secondary-foreground\",\n\t\t\t},\n\t\t\tsuccess: {\n\t\t\t\twrapper: \"after:bg-success after:text-success-foreground text-success-foreground\",\n\t\t\t},\n\t\t\twarning: {\n\t\t\t\twrapper: \"after:bg-warning after:text-warning-foreground text-warning-foreground\",\n\t\t\t},\n\t\t\tdanger: {\n\t\t\t\twrapper: \"after:bg-danger after:text-danger-foreground text-danger-foreground\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-4 h-4 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-small\",\n\t\t\t\ticon: \"w-3 h-2\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-5 h-5 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-medium\",\n\t\t\t\ticon: \"w-4 h-3\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-6 h-6 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-large\",\n\t\t\t\ticon: \"w-5 h-4\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: {\n\t\t\t\twrapper: \"rounded-none before:rounded-none after:rounded-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tfull: {\n\t\t\t\twrapper: \"rounded-full before:rounded-full after:rounded-full\",\n\t\t\t},\n\t\t},\n\t\tlineThrough: {\n\t\t\ttrue: {\n\t\t\t\tlabel: [\n\t\t\t\t\t\"inline-flex\",\n\t\t\t\t\t\"items-center\",\n\t\t\t\t\t\"justify-center\",\n\t\t\t\t\t\"before:content-['']\",\n\t\t\t\t\t\"before:absolute\",\n\t\t\t\t\t\"before:bg-foreground\",\n\t\t\t\t\t\"before:w-0\",\n\t\t\t\t\t\"before:h-0.5\",\n\t\t\t\t\t\"group-data-[selected=true]:opacity-60\",\n\t\t\t\t\t\"group-data-[selected=true]:before:w-full\",\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\tbase: \"opacity-80 pointer-events-none\",\n\t\t\t},\n\t\t},\n\t\tisInvalid: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"before:border-danger\",\n\t\t\t\tlabel: \"text-danger\",\n\t\t\t},\n\t\t},\n\t\tdisableAnimation: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"transition-none\",\n\t\t\t\ticon: \"transition-none\",\n\t\t\t\tlabel: \"transition-none\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"before:transition-colors\",\n\t\t\t\t\t\"group-data-[pressed=true]:scale-95\",\n\t\t\t\t\t\"transition-transform\",\n\t\t\t\t\t\"after:transition-transform-opacity\",\n\t\t\t\t\t\"after:!ease-linear\",\n\t\t\t\t\t\"after:!duration-200\",\n\t\t\t\t\t\"motion-reduce:transition-none\",\n\t\t\t\t],\n\t\t\t\ticon: \"transition-opacity motion-reduce:transition-none\",\n\t\t\t\tlabel: \"transition-colors-opacity before:transition-width motion-reduce:transition-none\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolor: \"primary\",\n\t\tsize: \"md\",\n\t\tdisabled: false,\n\t\tlineThrough: false,\n\t},\n});\n\nexport type CheckboxVariantProps = VariantProps<typeof checkbox>;\nexport type CheckboxSlots = keyof ReturnType<typeof checkbox>;\n\nexport { checkbox };\n","import { useCallback, useId, useMemo, useRef, type ChangeEvent } from \"react\";\r\n\r\nimport { checkbox, type CheckboxSlots, type CheckboxVariantProps } from \"@/theme/color/checkbox\";\r\nimport type { SlotsToClasses } from \"@/types\";\r\nimport { dataAttr, mergeRefs } from \"@/functions\";\r\nimport clsx from \"clsx\";\r\n\r\nexport interface UseCheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof CheckboxVariantProps>, CheckboxVariantProps {\r\n\tclassNames?: SlotsToClasses<CheckboxSlots>;\r\n\tclassName?: string;\r\n\ticon?: React.ReactNode | ((props: CheckboxIconProps) => React.ReactNode);\r\n\tchildren?: React.ReactNode;\r\n\tisIndeterminate?: boolean;\r\n\tref?: React.Ref<HTMLInputElement>;\r\n\terror?: string;\r\n\ttouched?: boolean;\r\n\trequired?: boolean;\r\n}\r\n\r\nexport interface CheckboxIconProps {\r\n\tid?: string;\r\n\tisSelected: boolean;\r\n\tisIndeterminate?: boolean;\r\n\tdisableAnimation?: boolean;\r\n\tclassName?: string;\r\n}\r\n\r\nexport function useCheckbox(props: UseCheckboxProps) {\r\n\tconst {\r\n\t\tid,\r\n\t\tclassNames,\r\n\t\tclassName,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tdefaultChecked,\r\n\t\tchecked,\r\n\t\terror,\r\n\t\ttouched,\r\n\t\tonChange,\r\n\t\tisIndeterminate = false,\r\n\t} = props;\r\n\r\n\tconst internalRef = useRef<HTMLInputElement>(null);\r\n\tconst inputId = useId();\r\n\tconst resolvedId = id || inputId;\r\n\r\n\tconst [isSelected] = useMemo(() => {\r\n\t\treturn [typeof checked === \"boolean\" ? checked : defaultChecked || false, () => {}];\r\n\t}, [checked, defaultChecked]);\r\n\r\n\tconst handleChange = useCallback(\r\n\t\t(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\tif (readOnly || disabled) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tonChange?.(e);\r\n\t\t},\r\n\t\t[onChange, readOnly, disabled],\r\n\t);\r\n\r\n\tconst slots = useMemo(\r\n\t\t() =>\r\n\t\t\tcheckbox({\r\n\t\t\t\tcolor: props.color,\r\n\t\t\t\tsize: props.size,\r\n\t\t\t\tradius: props.radius,\r\n\t\t\t\tlineThrough: props.lineThrough,\r\n\t\t\t\tdisabled: disabled,\r\n\t\t\t\tisInvalid: !!error && touched,\r\n\t\t\t\tdisableAnimation: props.disableAnimation,\r\n\t\t\t}),\r\n\t\t[props, disabled, error, touched],\r\n\t);\r\n\r\n\tconst getBaseProps = () => ({\r\n\t\t\"className\": slots.base({ class: clsx(classNames?.base, className) }),\r\n\t\t\"data-disabled\": dataAttr(disabled),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getWrapperProps = () => ({\r\n\t\t\"aria-hidden\": true,\r\n\t\t\"className\": slots.wrapper({ class: classNames?.wrapper }),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getInputProps = () => ({\r\n\t\tref: mergeRefs(internalRef, props.ref),\r\n\t\ttype: \"checkbox\",\r\n\t\tid: resolvedId,\r\n\t\tdefaultChecked: checked === undefined ? defaultChecked : undefined,\r\n\t\tchecked: checked !== undefined ? checked : undefined,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tonChange: handleChange,\r\n\t\tclassName: slots.hiddenInput({ class: classNames?.hiddenInput }),\r\n\t});\r\n\r\n\tconst getLabelProps = () => ({\r\n\t\thtmlFor: resolvedId,\r\n\t\tclassName: slots.label({ class: classNames?.label }),\r\n\t});\r\n\r\n\tconst getIconProps = (): CheckboxIconProps => ({\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tdisableAnimation: props.disableAnimation,\r\n\t\tclassName: slots.icon({ class: classNames?.icon }),\r\n\t});\r\n\r\n\tconst Component = \"label\";\r\n\r\n\treturn {\r\n\t\tComponent,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetLabelProps,\r\n\t\tgetIconProps,\r\n\t};\r\n}\r\n\r\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>;\r\n","import type { UseCheckboxReturn } from \"./use-checkbox\";\n\ntype CheckboxIconProps = Partial<ReturnType<UseCheckboxReturn[\"getIconProps\"]>>;\n\nfunction CheckIcon(props: CheckboxIconProps) {\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\trole=\"presentation\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeDasharray={22}\n\t\t\tstrokeDashoffset={isSelected ? 44 : 66}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tstrokeWidth={2}\n\t\t\tstyle={\n\t\t\t\t!disableAnimation && isSelected\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttransition: \"stroke-dashoffset 250ms linear 0.2s\",\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\tviewBox=\"0 0 17 18\"\n\t\t\t{...otherProps}\n\t\t>\n\t\t\t<polyline points=\"1 9 7 14 15 4\" />\n\t\t</svg>\n\t);\n}\n\nfunction IndeterminateIcon(props: CheckboxIconProps) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg stroke=\"currentColor\" strokeWidth={3} viewBox=\"0 0 24 24\" {...otherProps}>\n\t\t\t<line x1=\"21\" x2=\"3\" y1=\"12\" y2=\"12\" />\n\t\t</svg>\n\t);\n}\n\n/**\n * CheckboxIcon is used to visually indicate the checked or indeterminate\n * state of a checkbox.\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n\tconst { isIndeterminate, ...otherProps } = props;\n\tconst BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;\n\n\treturn <BaseIcon {...otherProps} />;\n}\n","// checkbox.tsx\r\nimport { forwardRef } from \"react\";\r\nimport { cloneElement, type ReactElement } from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\n\r\nimport { useCheckbox, type UseCheckboxProps } from \"./use-checkbox\";\r\nimport { CheckboxIcon } from \"./checkbox-icon\";\r\n\r\nexport interface CheckboxProps extends UseCheckboxProps {\r\n\tasChild?: boolean;\r\n}\r\n\r\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\r\n\tconst { asChild = false, ...restProps } = props;\r\n\tconst {\r\n\t\tComponent,\r\n\t\tchildren,\r\n\t\ticon = <CheckboxIcon />,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetIconProps,\r\n\t\tgetLabelProps,\r\n\t} = useCheckbox({ ...restProps, ref });\r\n\r\n\tconst clonedIcon = typeof icon === \"function\" ? icon(getIconProps()) : cloneElement(icon as ReactElement, getIconProps());\r\n\r\n\tconst Wrapper = asChild ? Slot : Component;\r\n\r\n\treturn (\r\n\t\t<Wrapper {...getBaseProps()}>\r\n\t\t\t<input {...getInputProps()} ref={ref} />\r\n\t\t\t<span {...getWrapperProps()}>{clonedIcon}</span>\r\n\t\t\t{children && <span {...getLabelProps()}>{children}</span>}\r\n\t\t</Wrapper>\r\n\t);\r\n});\r\n\r\nCheckbox.displayName = \"Custom.Checkbox\";\r\n\r\nexport default Checkbox;\r\n"],"names":[],"mappings":";;;;;;;;AAoBA,MAAM,WAAW,GAAG;AAAA,EACnB,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA,GAAG;AAAA,IAAA;AAAA,IAEJ,aAAa;AAAA,IACb,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACT,OAAO;AAAA,MACN,SAAS;AAAA,QACR,SAAS;AAAA,MAAA;AAAA,MAEV,SAAS;AAAA,QACR,SAAS;AAAA,MAAA;AAAA,MAEV,WAAW;AAAA,QACV,SAAS;AAAA,MAAA;AAAA,MAEV,SAAS;AAAA,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AEjC,SACC,qBAAC,SAAA,EAAS,GAAG,aAAA,GACZ,UAAA;AAAA,IAAA,oBAAC,SAAA,EAAO,GAAG,cAAA,GAAiB,IAAA,CAAU;AAAA,IACtC,oBAAC,QAAA,EAAM,GAAG,gBAAA,GAAoB,UAAA,YAAW;AAAA,IACxC,YAAY,oBAAC,QAAA,EAAM,GAAG,cAAA,GAAkB,SAAA,CAAS;AAAA,EAAA,GACnD;AAEF,CAAC;AAED,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"checkbox-C1Sssumg.js","sources":["../../src/theme/color/checkbox.ts","../../src/components/checkbox/use-checkbox.ts","../../src/components/checkbox/checkbox-icon.tsx","../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { tv } from \"@/lib/tv\";\nimport type { VariantProps } from \"tailwind-variants\";\nimport { groupDataFocusVisibleClasses, hiddenInputClasses } from \"../classes\";\n\n/**\n * Checkbox wrapper **Tailwind Variants** component\n *\n * const {base, wrapper, icon, label} = checkbox({...})\n *\n * @example\n * <label className={base())}>\n * // hidden input\n * <span className={wrapper()} aria-hidden=\"true\" data-selected={selected}>\n * <svg className={icon()}>\n * // check icon\n * </svg>\n * </span>\n * <span className={label()}>Label</span>\n * </label>\n */\nconst checkbox = tv({\n\tslots: {\n\t\tbase: \"group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none\",\n\t\twrapper: [\n\t\t\t\"relative\",\n\t\t\t\"inline-flex\",\n\t\t\t\"items-center\",\n\t\t\t\"justify-center\",\n\t\t\t\"flex-shrink-0\",\n\t\t\t\"overflow-hidden\",\n\t\t\t// before\n\t\t\t\"before:content-['']\",\n\t\t\t\"before:absolute\",\n\t\t\t\"before:inset-0\",\n\t\t\t\"before:border-solid\",\n\t\t\t\"before:border-2\",\n\t\t\t\"before:box-border\",\n\t\t\t\"before:border-default\",\n\t\t\t// after\n\t\t\t\"after:content-['']\",\n\t\t\t\"after:absolute\",\n\t\t\t\"after:inset-0\",\n\t\t\t\"after:scale-50\",\n\t\t\t\"after:opacity-0\",\n\t\t\t\"after:origin-center\",\n\t\t\t\"group-data-[selected=true]:after:scale-100\",\n\t\t\t\"group-data-[selected=true]:after:opacity-100\",\n\t\t\t// hover\n\t\t\t\"group-data-[hover=true]:before:bg-default-100\",\n\t\t\t// focus ring\n\t\t\t...groupDataFocusVisibleClasses,\n\t\t],\n\t\thiddenInput: hiddenInputClasses,\n\t\ticon: \"z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none\",\n\t\tlabel: \"relative text-foreground select-none\",\n\t},\n\tvariants: {\n\t\tcolor: {\n\t\t\tdefault: {\n\t\t\t\twrapper: \"after:bg-default after:text-default-foreground text-default-foreground\",\n\t\t\t},\n\t\t\tprimary: {\n\t\t\t\twrapper: \"after:bg-primary after:text-primary-foreground text-primary-foreground\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\twrapper: \"after:bg-secondary after:text-secondary-foreground text-secondary-foreground\",\n\t\t\t},\n\t\t\tsuccess: {\n\t\t\t\twrapper: \"after:bg-success after:text-success-foreground text-success-foreground\",\n\t\t\t},\n\t\t\twarning: {\n\t\t\t\twrapper: \"after:bg-warning after:text-warning-foreground text-warning-foreground\",\n\t\t\t},\n\t\t\tdanger: {\n\t\t\t\twrapper: \"after:bg-danger after:text-danger-foreground text-danger-foreground\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-4 h-4 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-small\",\n\t\t\t\ticon: \"w-3 h-2\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-5 h-5 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-medium\",\n\t\t\t\ticon: \"w-4 h-3\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-6 h-6 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-large\",\n\t\t\t\ticon: \"w-5 h-4\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: {\n\t\t\t\twrapper: \"rounded-none before:rounded-none after:rounded-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tfull: {\n\t\t\t\twrapper: \"rounded-full before:rounded-full after:rounded-full\",\n\t\t\t},\n\t\t},\n\t\tlineThrough: {\n\t\t\ttrue: {\n\t\t\t\tlabel: [\n\t\t\t\t\t\"inline-flex\",\n\t\t\t\t\t\"items-center\",\n\t\t\t\t\t\"justify-center\",\n\t\t\t\t\t\"before:content-['']\",\n\t\t\t\t\t\"before:absolute\",\n\t\t\t\t\t\"before:bg-foreground\",\n\t\t\t\t\t\"before:w-0\",\n\t\t\t\t\t\"before:h-0.5\",\n\t\t\t\t\t\"group-data-[selected=true]:opacity-60\",\n\t\t\t\t\t\"group-data-[selected=true]:before:w-full\",\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\tbase: \"opacity-80 pointer-events-none\",\n\t\t\t},\n\t\t},\n\t\tisInvalid: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"before:border-danger\",\n\t\t\t\tlabel: \"text-danger\",\n\t\t\t},\n\t\t},\n\t\tdisableAnimation: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"transition-none\",\n\t\t\t\ticon: \"transition-none\",\n\t\t\t\tlabel: \"transition-none\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"before:transition-colors\",\n\t\t\t\t\t\"group-data-[pressed=true]:scale-95\",\n\t\t\t\t\t\"transition-transform\",\n\t\t\t\t\t\"after:transition-transform-opacity\",\n\t\t\t\t\t\"after:!ease-linear\",\n\t\t\t\t\t\"after:!duration-200\",\n\t\t\t\t\t\"motion-reduce:transition-none\",\n\t\t\t\t],\n\t\t\t\ticon: \"transition-opacity motion-reduce:transition-none\",\n\t\t\t\tlabel: \"transition-colors-opacity before:transition-width motion-reduce:transition-none\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolor: \"primary\",\n\t\tsize: \"md\",\n\t\tdisabled: false,\n\t\tlineThrough: false,\n\t},\n});\n\nexport type CheckboxVariantProps = VariantProps<typeof checkbox>;\nexport type CheckboxSlots = keyof ReturnType<typeof checkbox>;\n\nexport { checkbox };\n","import { useCallback, useId, useMemo, useRef, type ChangeEvent } from \"react\";\r\n\r\nimport { checkbox, type CheckboxSlots, type CheckboxVariantProps } from \"@/theme/color/checkbox\";\r\nimport type { SlotsToClasses } from \"@/types\";\r\nimport { dataAttr, mergeRefs } from \"@/functions\";\r\nimport clsx from \"clsx\";\r\n\r\nexport interface UseCheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof CheckboxVariantProps>, CheckboxVariantProps {\r\n\tclassNames?: SlotsToClasses<CheckboxSlots>;\r\n\tclassName?: string;\r\n\ticon?: React.ReactNode | ((props: CheckboxIconProps) => React.ReactNode);\r\n\tchildren?: React.ReactNode;\r\n\tisIndeterminate?: boolean;\r\n\tref?: React.Ref<HTMLInputElement>;\r\n\terror?: string;\r\n\ttouched?: boolean;\r\n\trequired?: boolean;\r\n}\r\n\r\nexport interface CheckboxIconProps {\r\n\tid?: string;\r\n\tisSelected: boolean;\r\n\tisIndeterminate?: boolean;\r\n\tdisableAnimation?: boolean;\r\n\tclassName?: string;\r\n}\r\n\r\nexport function useCheckbox(props: UseCheckboxProps) {\r\n\tconst {\r\n\t\tid,\r\n\t\tclassNames,\r\n\t\tclassName,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tdefaultChecked,\r\n\t\tchecked,\r\n\t\terror,\r\n\t\ttouched,\r\n\t\tonChange,\r\n\t\tisIndeterminate = false,\r\n\t} = props;\r\n\r\n\tconst internalRef = useRef<HTMLInputElement>(null);\r\n\tconst inputId = useId();\r\n\tconst resolvedId = id || inputId;\r\n\r\n\tconst [isSelected] = useMemo(() => {\r\n\t\treturn [typeof checked === \"boolean\" ? checked : defaultChecked || false, () => {}];\r\n\t}, [checked, defaultChecked]);\r\n\r\n\tconst handleChange = useCallback(\r\n\t\t(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\tif (readOnly || disabled) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tonChange?.(e);\r\n\t\t},\r\n\t\t[onChange, readOnly, disabled],\r\n\t);\r\n\r\n\tconst slots = useMemo(\r\n\t\t() =>\r\n\t\t\tcheckbox({\r\n\t\t\t\tcolor: props.color,\r\n\t\t\t\tsize: props.size,\r\n\t\t\t\tradius: props.radius,\r\n\t\t\t\tlineThrough: props.lineThrough,\r\n\t\t\t\tdisabled: disabled,\r\n\t\t\t\tisInvalid: !!error && touched,\r\n\t\t\t\tdisableAnimation: props.disableAnimation,\r\n\t\t\t}),\r\n\t\t[props, disabled, error, touched],\r\n\t);\r\n\r\n\tconst getBaseProps = () => ({\r\n\t\t\"className\": slots.base({ class: clsx(classNames?.base, className) }),\r\n\t\t\"data-disabled\": dataAttr(disabled),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getWrapperProps = () => ({\r\n\t\t\"aria-hidden\": true,\r\n\t\t\"className\": slots.wrapper({ class: classNames?.wrapper }),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getInputProps = () => ({\r\n\t\tref: mergeRefs(internalRef, props.ref),\r\n\t\ttype: \"checkbox\",\r\n\t\tid: resolvedId,\r\n\t\tdefaultChecked: checked === undefined ? defaultChecked : undefined,\r\n\t\tchecked: checked !== undefined ? checked : undefined,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tonChange: handleChange,\r\n\t\tclassName: slots.hiddenInput({ class: classNames?.hiddenInput }),\r\n\t});\r\n\r\n\tconst getLabelProps = () => ({\r\n\t\thtmlFor: resolvedId,\r\n\t\tclassName: slots.label({ class: classNames?.label }),\r\n\t});\r\n\r\n\tconst getIconProps = (): CheckboxIconProps => ({\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tdisableAnimation: props.disableAnimation,\r\n\t\tclassName: slots.icon({ class: classNames?.icon }),\r\n\t});\r\n\r\n\tconst Component = \"label\";\r\n\r\n\treturn {\r\n\t\tComponent,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetLabelProps,\r\n\t\tgetIconProps,\r\n\t};\r\n}\r\n\r\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>;\r\n","import type { UseCheckboxReturn } from \"./use-checkbox\";\n\ntype CheckboxIconProps = Partial<ReturnType<UseCheckboxReturn[\"getIconProps\"]>>;\n\nfunction CheckIcon(props: CheckboxIconProps) {\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\trole=\"presentation\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeDasharray={22}\n\t\t\tstrokeDashoffset={isSelected ? 44 : 66}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tstrokeWidth={2}\n\t\t\tstyle={\n\t\t\t\t!disableAnimation && isSelected\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttransition: \"stroke-dashoffset 250ms linear 0.2s\",\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\tviewBox=\"0 0 17 18\"\n\t\t\t{...otherProps}\n\t\t>\n\t\t\t<polyline points=\"1 9 7 14 15 4\" />\n\t\t</svg>\n\t);\n}\n\nfunction IndeterminateIcon(props: CheckboxIconProps) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg stroke=\"currentColor\" strokeWidth={3} viewBox=\"0 0 24 24\" {...otherProps}>\n\t\t\t<line x1=\"21\" x2=\"3\" y1=\"12\" y2=\"12\" />\n\t\t</svg>\n\t);\n}\n\n/**\n * CheckboxIcon is used to visually indicate the checked or indeterminate\n * state of a checkbox.\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n\tconst { isIndeterminate, ...otherProps } = props;\n\tconst BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;\n\n\treturn <BaseIcon {...otherProps} />;\n}\n","// checkbox.tsx\r\nimport { forwardRef } from \"react\";\r\nimport { cloneElement, type ReactElement } from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\n\r\nimport { useCheckbox, type UseCheckboxProps } from \"./use-checkbox\";\r\nimport { CheckboxIcon } from \"./checkbox-icon\";\r\n\r\nexport interface CheckboxProps extends UseCheckboxProps {\r\n\tasChild?: boolean;\r\n}\r\n\r\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\r\n\tconst { asChild = false, ...restProps } = props;\r\n\tconst {\r\n\t\tComponent,\r\n\t\tchildren,\r\n\t\ticon = <CheckboxIcon />,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetIconProps,\r\n\t\tgetLabelProps,\r\n\t} = useCheckbox({ ...restProps, ref });\r\n\r\n\tconst clonedIcon = typeof icon === \"function\" ? icon(getIconProps()) : cloneElement(icon as ReactElement, getIconProps());\r\n\r\n\tconst Wrapper = asChild ? Slot : Component;\r\n\r\n\treturn (\r\n\t\t<Wrapper {...getBaseProps()}>\r\n\t\t\t<input {...getInputProps()} ref={ref} />\r\n\t\t\t<span {...getWrapperProps()}>{clonedIcon}</span>\r\n\t\t\t{children && <span {...getLabelProps()}>{children}</span>}\r\n\t\t</Wrapper>\r\n\t);\r\n});\r\n\r\nCheckbox.displayName = \"Custom.Checkbox\";\r\n\r\nexport default Checkbox;\r\n"],"names":[],"mappings":";;;;;;;;AAoBA,MAAM,WAAW,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8BAAC,QAAA,EAAK,IAAG,MAAK,IAAG,KAAI,IAAG,MAAK,IAAG,MAAK,EAAA,CACtC;AAEF;AAMO,SAAS,aAAa,OAA0B;AACtD,QAAM,EAAE,iBAAiB,GAAG,WAAA,IAAe;AAC3C,QAAM,WAAW,kBAAkB,oBAAoB;AAEvD,SAAO,oBAAC,UAAA,EAAU,GAAG,WAAA,CAAY;AAClC;ACzCA,MAAM,WAAW,WAA4C,CAAC,OAAO,QAAQ;AAC5E,QAAM,EAAE,UAAU,OAAO,GAAG,cAAc;AAC1C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,2BAAQ,cAAA,EAAa;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG,YAAY,EAAE,GAAG,WAAW,KAAK;AAErC,QAAM,aAAa,OAAO,SAAS,aAAa,KAAK,aAAA,CAAc,IAAI,aAAa,MAAsB,cAAc;AAExH,QAAM,UAAU,UAAU,OAAO;AAEjC,SACC,qBAAC,SAAA,EAAS,GAAG,aAAA,GACZ,UAAA;AAAA,IAAA,oBAAC,SAAA,EAAO,GAAG,cAAA,GAAiB,IAAA,CAAU;AAAA,IACtC,oBAAC,QAAA,EAAM,GAAG,gBAAA,GAAoB,UAAA,YAAW;AAAA,IACxC,YAAY,oBAAC,QAAA,EAAM,GAAG,cAAA,GAAkB,SAAA,CAAS;AAAA,EAAA,GACnD;AAEF,CAAC;AAED,SAAS,cAAc;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const index = require("./index-
|
|
5
|
-
const tv = require("./tv-
|
|
4
|
+
const index = require("./index-C_sOsPRt.js");
|
|
5
|
+
const tv = require("./tv-CGbWb8zP.js");
|
|
6
6
|
const classes = require("./classes-ClWJw1OF.js");
|
|
7
7
|
const assertion = require("./assertion-C4-_LOAB.js");
|
|
8
8
|
const refs = require("./refs-DtJq1_uX.js");
|
|
9
|
-
const clsx = require("
|
|
9
|
+
const clsx = require("clsx");
|
|
10
10
|
const checkbox = tv.tv({
|
|
11
11
|
slots: {
|
|
12
12
|
base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
|
|
@@ -227,7 +227,7 @@ function useCheckbox(props) {
|
|
|
227
227
|
[props, disabled, error, touched]
|
|
228
228
|
);
|
|
229
229
|
const getBaseProps = () => ({
|
|
230
|
-
"className": slots.base({ class: clsx
|
|
230
|
+
"className": slots.base({ class: clsx(classNames?.base, className) }),
|
|
231
231
|
"data-disabled": assertion.dataAttr(disabled),
|
|
232
232
|
"data-selected": assertion.dataAttr(isSelected || isIndeterminate)
|
|
233
233
|
});
|
|
@@ -274,7 +274,7 @@ function useCheckbox(props) {
|
|
|
274
274
|
}
|
|
275
275
|
function CheckIcon(props) {
|
|
276
276
|
const { isSelected, disableAnimation, ...otherProps } = props;
|
|
277
|
-
return /* @__PURE__ */
|
|
277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
278
278
|
"svg",
|
|
279
279
|
{
|
|
280
280
|
"aria-hidden": "true",
|
|
@@ -291,25 +291,25 @@ function CheckIcon(props) {
|
|
|
291
291
|
} : {},
|
|
292
292
|
viewBox: "0 0 17 18",
|
|
293
293
|
...otherProps,
|
|
294
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "1 9 7 14 15 4" })
|
|
295
295
|
}
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
function IndeterminateIcon(props) {
|
|
299
299
|
const { isSelected, disableAnimation, ...otherProps } = props;
|
|
300
|
-
return /* @__PURE__ */
|
|
300
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { stroke: "currentColor", strokeWidth: 3, viewBox: "0 0 24 24", ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", x2: "3", y1: "12", y2: "12" }) });
|
|
301
301
|
}
|
|
302
302
|
function CheckboxIcon(props) {
|
|
303
303
|
const { isIndeterminate, ...otherProps } = props;
|
|
304
304
|
const BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;
|
|
305
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseIcon, { ...otherProps });
|
|
306
306
|
}
|
|
307
307
|
const Checkbox = React.forwardRef((props, ref) => {
|
|
308
308
|
const { asChild = false, ...restProps } = props;
|
|
309
309
|
const {
|
|
310
310
|
Component,
|
|
311
311
|
children,
|
|
312
|
-
icon = /* @__PURE__ */
|
|
312
|
+
icon = /* @__PURE__ */ jsxRuntime.jsx(CheckboxIcon, {}),
|
|
313
313
|
getBaseProps,
|
|
314
314
|
getWrapperProps,
|
|
315
315
|
getInputProps,
|
|
@@ -318,13 +318,13 @@ const Checkbox = React.forwardRef((props, ref) => {
|
|
|
318
318
|
} = useCheckbox({ ...restProps, ref });
|
|
319
319
|
const clonedIcon = typeof icon === "function" ? icon(getIconProps()) : React.cloneElement(icon, getIconProps());
|
|
320
320
|
const Wrapper = asChild ? index.Slot : Component;
|
|
321
|
-
return /* @__PURE__ */
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
children && /* @__PURE__ */
|
|
321
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, { ...getBaseProps(), children: [
|
|
322
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps(), ref }),
|
|
323
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { ...getWrapperProps(), children: clonedIcon }),
|
|
324
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("span", { ...getLabelProps(), children })
|
|
325
325
|
] });
|
|
326
326
|
});
|
|
327
327
|
Checkbox.displayName = "Custom.Checkbox";
|
|
328
328
|
exports.Checkbox = Checkbox;
|
|
329
329
|
exports.CheckboxIcon = CheckboxIcon;
|
|
330
|
-
//# sourceMappingURL=checkbox-
|
|
330
|
+
//# sourceMappingURL=checkbox-ovjcc7jF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-BoxBfskJ.js","sources":["../../src/theme/color/checkbox.ts","../../src/components/checkbox/use-checkbox.ts","../../src/components/checkbox/checkbox-icon.tsx","../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { tv } from \"@/lib/tv\";\nimport type { VariantProps } from \"tailwind-variants\";\nimport { groupDataFocusVisibleClasses, hiddenInputClasses } from \"../classes\";\n\n/**\n * Checkbox wrapper **Tailwind Variants** component\n *\n * const {base, wrapper, icon, label} = checkbox({...})\n *\n * @example\n * <label className={base())}>\n * // hidden input\n * <span className={wrapper()} aria-hidden=\"true\" data-selected={selected}>\n * <svg className={icon()}>\n * // check icon\n * </svg>\n * </span>\n * <span className={label()}>Label</span>\n * </label>\n */\nconst checkbox = tv({\n\tslots: {\n\t\tbase: \"group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none\",\n\t\twrapper: [\n\t\t\t\"relative\",\n\t\t\t\"inline-flex\",\n\t\t\t\"items-center\",\n\t\t\t\"justify-center\",\n\t\t\t\"flex-shrink-0\",\n\t\t\t\"overflow-hidden\",\n\t\t\t// before\n\t\t\t\"before:content-['']\",\n\t\t\t\"before:absolute\",\n\t\t\t\"before:inset-0\",\n\t\t\t\"before:border-solid\",\n\t\t\t\"before:border-2\",\n\t\t\t\"before:box-border\",\n\t\t\t\"before:border-default\",\n\t\t\t// after\n\t\t\t\"after:content-['']\",\n\t\t\t\"after:absolute\",\n\t\t\t\"after:inset-0\",\n\t\t\t\"after:scale-50\",\n\t\t\t\"after:opacity-0\",\n\t\t\t\"after:origin-center\",\n\t\t\t\"group-data-[selected=true]:after:scale-100\",\n\t\t\t\"group-data-[selected=true]:after:opacity-100\",\n\t\t\t// hover\n\t\t\t\"group-data-[hover=true]:before:bg-default-100\",\n\t\t\t// focus ring\n\t\t\t...groupDataFocusVisibleClasses,\n\t\t],\n\t\thiddenInput: hiddenInputClasses,\n\t\ticon: \"z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none\",\n\t\tlabel: \"relative text-foreground select-none\",\n\t},\n\tvariants: {\n\t\tcolor: {\n\t\t\tdefault: {\n\t\t\t\twrapper: \"after:bg-default after:text-default-foreground text-default-foreground\",\n\t\t\t},\n\t\t\tprimary: {\n\t\t\t\twrapper: \"after:bg-primary after:text-primary-foreground text-primary-foreground\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\twrapper: \"after:bg-secondary after:text-secondary-foreground text-secondary-foreground\",\n\t\t\t},\n\t\t\tsuccess: {\n\t\t\t\twrapper: \"after:bg-success after:text-success-foreground text-success-foreground\",\n\t\t\t},\n\t\t\twarning: {\n\t\t\t\twrapper: \"after:bg-warning after:text-warning-foreground text-warning-foreground\",\n\t\t\t},\n\t\t\tdanger: {\n\t\t\t\twrapper: \"after:bg-danger after:text-danger-foreground text-danger-foreground\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-4 h-4 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-small\",\n\t\t\t\ticon: \"w-3 h-2\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-5 h-5 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-medium\",\n\t\t\t\ticon: \"w-4 h-3\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-6 h-6 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-large\",\n\t\t\t\ticon: \"w-5 h-4\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: {\n\t\t\t\twrapper: \"rounded-none before:rounded-none after:rounded-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tfull: {\n\t\t\t\twrapper: \"rounded-full before:rounded-full after:rounded-full\",\n\t\t\t},\n\t\t},\n\t\tlineThrough: {\n\t\t\ttrue: {\n\t\t\t\tlabel: [\n\t\t\t\t\t\"inline-flex\",\n\t\t\t\t\t\"items-center\",\n\t\t\t\t\t\"justify-center\",\n\t\t\t\t\t\"before:content-['']\",\n\t\t\t\t\t\"before:absolute\",\n\t\t\t\t\t\"before:bg-foreground\",\n\t\t\t\t\t\"before:w-0\",\n\t\t\t\t\t\"before:h-0.5\",\n\t\t\t\t\t\"group-data-[selected=true]:opacity-60\",\n\t\t\t\t\t\"group-data-[selected=true]:before:w-full\",\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\tbase: \"opacity-80 pointer-events-none\",\n\t\t\t},\n\t\t},\n\t\tisInvalid: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"before:border-danger\",\n\t\t\t\tlabel: \"text-danger\",\n\t\t\t},\n\t\t},\n\t\tdisableAnimation: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"transition-none\",\n\t\t\t\ticon: \"transition-none\",\n\t\t\t\tlabel: \"transition-none\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"before:transition-colors\",\n\t\t\t\t\t\"group-data-[pressed=true]:scale-95\",\n\t\t\t\t\t\"transition-transform\",\n\t\t\t\t\t\"after:transition-transform-opacity\",\n\t\t\t\t\t\"after:!ease-linear\",\n\t\t\t\t\t\"after:!duration-200\",\n\t\t\t\t\t\"motion-reduce:transition-none\",\n\t\t\t\t],\n\t\t\t\ticon: \"transition-opacity motion-reduce:transition-none\",\n\t\t\t\tlabel: \"transition-colors-opacity before:transition-width motion-reduce:transition-none\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolor: \"primary\",\n\t\tsize: \"md\",\n\t\tdisabled: false,\n\t\tlineThrough: false,\n\t},\n});\n\nexport type CheckboxVariantProps = VariantProps<typeof checkbox>;\nexport type CheckboxSlots = keyof ReturnType<typeof checkbox>;\n\nexport { checkbox };\n","import { useCallback, useId, useMemo, useRef, type ChangeEvent } from \"react\";\r\n\r\nimport { checkbox, type CheckboxSlots, type CheckboxVariantProps } from \"@/theme/color/checkbox\";\r\nimport type { SlotsToClasses } from \"@/types\";\r\nimport { dataAttr, mergeRefs } from \"@/functions\";\r\nimport clsx from \"clsx\";\r\n\r\nexport interface UseCheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof CheckboxVariantProps>, CheckboxVariantProps {\r\n\tclassNames?: SlotsToClasses<CheckboxSlots>;\r\n\tclassName?: string;\r\n\ticon?: React.ReactNode | ((props: CheckboxIconProps) => React.ReactNode);\r\n\tchildren?: React.ReactNode;\r\n\tisIndeterminate?: boolean;\r\n\tref?: React.Ref<HTMLInputElement>;\r\n\terror?: string;\r\n\ttouched?: boolean;\r\n\trequired?: boolean;\r\n}\r\n\r\nexport interface CheckboxIconProps {\r\n\tid?: string;\r\n\tisSelected: boolean;\r\n\tisIndeterminate?: boolean;\r\n\tdisableAnimation?: boolean;\r\n\tclassName?: string;\r\n}\r\n\r\nexport function useCheckbox(props: UseCheckboxProps) {\r\n\tconst {\r\n\t\tid,\r\n\t\tclassNames,\r\n\t\tclassName,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tdefaultChecked,\r\n\t\tchecked,\r\n\t\terror,\r\n\t\ttouched,\r\n\t\tonChange,\r\n\t\tisIndeterminate = false,\r\n\t} = props;\r\n\r\n\tconst internalRef = useRef<HTMLInputElement>(null);\r\n\tconst inputId = useId();\r\n\tconst resolvedId = id || inputId;\r\n\r\n\tconst [isSelected] = useMemo(() => {\r\n\t\treturn [typeof checked === \"boolean\" ? checked : defaultChecked || false, () => {}];\r\n\t}, [checked, defaultChecked]);\r\n\r\n\tconst handleChange = useCallback(\r\n\t\t(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\tif (readOnly || disabled) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tonChange?.(e);\r\n\t\t},\r\n\t\t[onChange, readOnly, disabled],\r\n\t);\r\n\r\n\tconst slots = useMemo(\r\n\t\t() =>\r\n\t\t\tcheckbox({\r\n\t\t\t\tcolor: props.color,\r\n\t\t\t\tsize: props.size,\r\n\t\t\t\tradius: props.radius,\r\n\t\t\t\tlineThrough: props.lineThrough,\r\n\t\t\t\tdisabled: disabled,\r\n\t\t\t\tisInvalid: !!error && touched,\r\n\t\t\t\tdisableAnimation: props.disableAnimation,\r\n\t\t\t}),\r\n\t\t[props, disabled, error, touched],\r\n\t);\r\n\r\n\tconst getBaseProps = () => ({\r\n\t\t\"className\": slots.base({ class: clsx(classNames?.base, className) }),\r\n\t\t\"data-disabled\": dataAttr(disabled),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getWrapperProps = () => ({\r\n\t\t\"aria-hidden\": true,\r\n\t\t\"className\": slots.wrapper({ class: classNames?.wrapper }),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getInputProps = () => ({\r\n\t\tref: mergeRefs(internalRef, props.ref),\r\n\t\ttype: \"checkbox\",\r\n\t\tid: resolvedId,\r\n\t\tdefaultChecked: checked === undefined ? defaultChecked : undefined,\r\n\t\tchecked: checked !== undefined ? checked : undefined,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tonChange: handleChange,\r\n\t\tclassName: slots.hiddenInput({ class: classNames?.hiddenInput }),\r\n\t});\r\n\r\n\tconst getLabelProps = () => ({\r\n\t\thtmlFor: resolvedId,\r\n\t\tclassName: slots.label({ class: classNames?.label }),\r\n\t});\r\n\r\n\tconst getIconProps = (): CheckboxIconProps => ({\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tdisableAnimation: props.disableAnimation,\r\n\t\tclassName: slots.icon({ class: classNames?.icon }),\r\n\t});\r\n\r\n\tconst Component = \"label\";\r\n\r\n\treturn {\r\n\t\tComponent,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetLabelProps,\r\n\t\tgetIconProps,\r\n\t};\r\n}\r\n\r\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>;\r\n","import type { UseCheckboxReturn } from \"./use-checkbox\";\n\ntype CheckboxIconProps = Partial<ReturnType<UseCheckboxReturn[\"getIconProps\"]>>;\n\nfunction CheckIcon(props: CheckboxIconProps) {\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\trole=\"presentation\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeDasharray={22}\n\t\t\tstrokeDashoffset={isSelected ? 44 : 66}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tstrokeWidth={2}\n\t\t\tstyle={\n\t\t\t\t!disableAnimation && isSelected\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttransition: \"stroke-dashoffset 250ms linear 0.2s\",\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\tviewBox=\"0 0 17 18\"\n\t\t\t{...otherProps}\n\t\t>\n\t\t\t<polyline points=\"1 9 7 14 15 4\" />\n\t\t</svg>\n\t);\n}\n\nfunction IndeterminateIcon(props: CheckboxIconProps) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg stroke=\"currentColor\" strokeWidth={3} viewBox=\"0 0 24 24\" {...otherProps}>\n\t\t\t<line x1=\"21\" x2=\"3\" y1=\"12\" y2=\"12\" />\n\t\t</svg>\n\t);\n}\n\n/**\n * CheckboxIcon is used to visually indicate the checked or indeterminate\n * state of a checkbox.\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n\tconst { isIndeterminate, ...otherProps } = props;\n\tconst BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;\n\n\treturn <BaseIcon {...otherProps} />;\n}\n","// checkbox.tsx\r\nimport { forwardRef } from \"react\";\r\nimport { cloneElement, type ReactElement } from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\n\r\nimport { useCheckbox, type UseCheckboxProps } from \"./use-checkbox\";\r\nimport { CheckboxIcon } from \"./checkbox-icon\";\r\n\r\nexport interface CheckboxProps extends UseCheckboxProps {\r\n\tasChild?: boolean;\r\n}\r\n\r\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\r\n\tconst { asChild = false, ...restProps } = props;\r\n\tconst {\r\n\t\tComponent,\r\n\t\tchildren,\r\n\t\ticon = <CheckboxIcon />,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetIconProps,\r\n\t\tgetLabelProps,\r\n\t} = useCheckbox({ ...restProps, ref });\r\n\r\n\tconst clonedIcon = typeof icon === \"function\" ? icon(getIconProps()) : cloneElement(icon as ReactElement, getIconProps());\r\n\r\n\tconst Wrapper = asChild ? Slot : Component;\r\n\r\n\treturn (\r\n\t\t<Wrapper {...getBaseProps()}>\r\n\t\t\t<input {...getInputProps()} ref={ref} />\r\n\t\t\t<span {...getWrapperProps()}>{clonedIcon}</span>\r\n\t\t\t{children && <span {...getLabelProps()}>{children}</span>}\r\n\t\t</Wrapper>\r\n\t);\r\n});\r\n\r\nCheckbox.displayName = \"Custom.Checkbox\";\r\n\r\nexport default Checkbox;\r\n"],"names":["tv","groupDataFocusVisibleClasses","hiddenInputClasses","useRef","useId","useMemo","useCallback","clsx","dataAttr","mergeRefs","jsx","forwardRef","cloneElement","Slot","jsxs"],"mappings":";;;;;;;;;AAoBA,MAAM,WAAWA,GAAAA,GAAG;AAAA,EACnB,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAA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I,QAAO,gBAAe,aAAa,GAAG,SAAQ,aAAa,GAAG,YAClE,yCAAC,QAAA,EAAK,IAAG,MAAK,IAAG,KAAI,IAAG,MAAK,IAAG,MAAK,EAAA,CACtC;AAEF;AAMO,SAAS,aAAa,OAA0B;AACtD,QAAM,EAAE,iBAAiB,GAAG,WAAA,IAAe;AAC3C,QAAM,WAAW,kBAAkB,oBAAoB;AAEvD,SAAOA,+BAAC,UAAA,EAAU,GAAG,WAAA,CAAY;AAClC;ACzCA,MAAM,WAAWC,MAAAA,WAA4C,CAAC,OAAO,QAAQ;AAC5E,QAAM,EAAE,UAAU,OAAO,GAAG,cAAc;AAC1C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,sCAAQ,cAAA,EAAa;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG,YAAY,EAAE,GAAG,WAAW,KAAK;AAErC,QAAM,aAAa,OAAO,SAAS,aAAa,KAAK,aAAA,CAAc,IAAIC,MAAAA,aAAa,MAAsB,cAAc;AAExH,QAAM,UAAU,UAAUC,MAAAA,OAAO;AAEjC,SACCC,2BAAAA,KAAC,SAAA,EAAS,GAAG,aAAA,GACZ,UAAA;AAAA,IAAAJ,2BAAAA,IAAC,SAAA,EAAO,GAAG,cAAA,GAAiB,IAAA,CAAU;AAAA,IACtCA,2BAAAA,IAAC,QAAA,EAAM,GAAG,gBAAA,GAAoB,UAAA,YAAW;AAAA,IACxC,YAAYA,2BAAAA,IAAC,QAAA,EAAM,GAAG,cAAA,GAAkB,SAAA,CAAS;AAAA,EAAA,GACnD;AAEF,CAAC;AAED,SAAS,cAAc;;;"}
|
|
1
|
+
{"version":3,"file":"checkbox-ovjcc7jF.js","sources":["../../src/theme/color/checkbox.ts","../../src/components/checkbox/use-checkbox.ts","../../src/components/checkbox/checkbox-icon.tsx","../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { tv } from \"@/lib/tv\";\nimport type { VariantProps } from \"tailwind-variants\";\nimport { groupDataFocusVisibleClasses, hiddenInputClasses } from \"../classes\";\n\n/**\n * Checkbox wrapper **Tailwind Variants** component\n *\n * const {base, wrapper, icon, label} = checkbox({...})\n *\n * @example\n * <label className={base())}>\n * // hidden input\n * <span className={wrapper()} aria-hidden=\"true\" data-selected={selected}>\n * <svg className={icon()}>\n * // check icon\n * </svg>\n * </span>\n * <span className={label()}>Label</span>\n * </label>\n */\nconst checkbox = tv({\n\tslots: {\n\t\tbase: \"group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none\",\n\t\twrapper: [\n\t\t\t\"relative\",\n\t\t\t\"inline-flex\",\n\t\t\t\"items-center\",\n\t\t\t\"justify-center\",\n\t\t\t\"flex-shrink-0\",\n\t\t\t\"overflow-hidden\",\n\t\t\t// before\n\t\t\t\"before:content-['']\",\n\t\t\t\"before:absolute\",\n\t\t\t\"before:inset-0\",\n\t\t\t\"before:border-solid\",\n\t\t\t\"before:border-2\",\n\t\t\t\"before:box-border\",\n\t\t\t\"before:border-default\",\n\t\t\t// after\n\t\t\t\"after:content-['']\",\n\t\t\t\"after:absolute\",\n\t\t\t\"after:inset-0\",\n\t\t\t\"after:scale-50\",\n\t\t\t\"after:opacity-0\",\n\t\t\t\"after:origin-center\",\n\t\t\t\"group-data-[selected=true]:after:scale-100\",\n\t\t\t\"group-data-[selected=true]:after:opacity-100\",\n\t\t\t// hover\n\t\t\t\"group-data-[hover=true]:before:bg-default-100\",\n\t\t\t// focus ring\n\t\t\t...groupDataFocusVisibleClasses,\n\t\t],\n\t\thiddenInput: hiddenInputClasses,\n\t\ticon: \"z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none\",\n\t\tlabel: \"relative text-foreground select-none\",\n\t},\n\tvariants: {\n\t\tcolor: {\n\t\t\tdefault: {\n\t\t\t\twrapper: \"after:bg-default after:text-default-foreground text-default-foreground\",\n\t\t\t},\n\t\t\tprimary: {\n\t\t\t\twrapper: \"after:bg-primary after:text-primary-foreground text-primary-foreground\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\twrapper: \"after:bg-secondary after:text-secondary-foreground text-secondary-foreground\",\n\t\t\t},\n\t\t\tsuccess: {\n\t\t\t\twrapper: \"after:bg-success after:text-success-foreground text-success-foreground\",\n\t\t\t},\n\t\t\twarning: {\n\t\t\t\twrapper: \"after:bg-warning after:text-warning-foreground text-warning-foreground\",\n\t\t\t},\n\t\t\tdanger: {\n\t\t\t\twrapper: \"after:bg-danger after:text-danger-foreground text-danger-foreground\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-4 h-4 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-small\",\n\t\t\t\ticon: \"w-3 h-2\",\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-5 h-5 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-medium\",\n\t\t\t\ticon: \"w-4 h-3\",\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"w-6 h-6 me-2\",\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t\tlabel: \"text-large\",\n\t\t\t\ticon: \"w-5 h-4\",\n\t\t\t},\n\t\t},\n\t\tradius: {\n\t\t\tnone: {\n\t\t\t\twrapper: \"rounded-none before:rounded-none after:rounded-none\",\n\t\t\t},\n\t\t\tsm: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.5)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tmd: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.6)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tlg: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"before:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t\t\"after:rounded-[calc(theme(borderRadius.medium)*0.7)]\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tfull: {\n\t\t\t\twrapper: \"rounded-full before:rounded-full after:rounded-full\",\n\t\t\t},\n\t\t},\n\t\tlineThrough: {\n\t\t\ttrue: {\n\t\t\t\tlabel: [\n\t\t\t\t\t\"inline-flex\",\n\t\t\t\t\t\"items-center\",\n\t\t\t\t\t\"justify-center\",\n\t\t\t\t\t\"before:content-['']\",\n\t\t\t\t\t\"before:absolute\",\n\t\t\t\t\t\"before:bg-foreground\",\n\t\t\t\t\t\"before:w-0\",\n\t\t\t\t\t\"before:h-0.5\",\n\t\t\t\t\t\"group-data-[selected=true]:opacity-60\",\n\t\t\t\t\t\"group-data-[selected=true]:before:w-full\",\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\tbase: \"opacity-80 pointer-events-none\",\n\t\t\t},\n\t\t},\n\t\tisInvalid: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"before:border-danger\",\n\t\t\t\tlabel: \"text-danger\",\n\t\t\t},\n\t\t},\n\t\tdisableAnimation: {\n\t\t\ttrue: {\n\t\t\t\twrapper: \"transition-none\",\n\t\t\t\ticon: \"transition-none\",\n\t\t\t\tlabel: \"transition-none\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\twrapper: [\n\t\t\t\t\t\"before:transition-colors\",\n\t\t\t\t\t\"group-data-[pressed=true]:scale-95\",\n\t\t\t\t\t\"transition-transform\",\n\t\t\t\t\t\"after:transition-transform-opacity\",\n\t\t\t\t\t\"after:!ease-linear\",\n\t\t\t\t\t\"after:!duration-200\",\n\t\t\t\t\t\"motion-reduce:transition-none\",\n\t\t\t\t],\n\t\t\t\ticon: \"transition-opacity motion-reduce:transition-none\",\n\t\t\t\tlabel: \"transition-colors-opacity before:transition-width motion-reduce:transition-none\",\n\t\t\t},\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolor: \"primary\",\n\t\tsize: \"md\",\n\t\tdisabled: false,\n\t\tlineThrough: false,\n\t},\n});\n\nexport type CheckboxVariantProps = VariantProps<typeof checkbox>;\nexport type CheckboxSlots = keyof ReturnType<typeof checkbox>;\n\nexport { checkbox };\n","import { useCallback, useId, useMemo, useRef, type ChangeEvent } from \"react\";\r\n\r\nimport { checkbox, type CheckboxSlots, type CheckboxVariantProps } from \"@/theme/color/checkbox\";\r\nimport type { SlotsToClasses } from \"@/types\";\r\nimport { dataAttr, mergeRefs } from \"@/functions\";\r\nimport clsx from \"clsx\";\r\n\r\nexport interface UseCheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof CheckboxVariantProps>, CheckboxVariantProps {\r\n\tclassNames?: SlotsToClasses<CheckboxSlots>;\r\n\tclassName?: string;\r\n\ticon?: React.ReactNode | ((props: CheckboxIconProps) => React.ReactNode);\r\n\tchildren?: React.ReactNode;\r\n\tisIndeterminate?: boolean;\r\n\tref?: React.Ref<HTMLInputElement>;\r\n\terror?: string;\r\n\ttouched?: boolean;\r\n\trequired?: boolean;\r\n}\r\n\r\nexport interface CheckboxIconProps {\r\n\tid?: string;\r\n\tisSelected: boolean;\r\n\tisIndeterminate?: boolean;\r\n\tdisableAnimation?: boolean;\r\n\tclassName?: string;\r\n}\r\n\r\nexport function useCheckbox(props: UseCheckboxProps) {\r\n\tconst {\r\n\t\tid,\r\n\t\tclassNames,\r\n\t\tclassName,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tdefaultChecked,\r\n\t\tchecked,\r\n\t\terror,\r\n\t\ttouched,\r\n\t\tonChange,\r\n\t\tisIndeterminate = false,\r\n\t} = props;\r\n\r\n\tconst internalRef = useRef<HTMLInputElement>(null);\r\n\tconst inputId = useId();\r\n\tconst resolvedId = id || inputId;\r\n\r\n\tconst [isSelected] = useMemo(() => {\r\n\t\treturn [typeof checked === \"boolean\" ? checked : defaultChecked || false, () => {}];\r\n\t}, [checked, defaultChecked]);\r\n\r\n\tconst handleChange = useCallback(\r\n\t\t(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\tif (readOnly || disabled) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tonChange?.(e);\r\n\t\t},\r\n\t\t[onChange, readOnly, disabled],\r\n\t);\r\n\r\n\tconst slots = useMemo(\r\n\t\t() =>\r\n\t\t\tcheckbox({\r\n\t\t\t\tcolor: props.color,\r\n\t\t\t\tsize: props.size,\r\n\t\t\t\tradius: props.radius,\r\n\t\t\t\tlineThrough: props.lineThrough,\r\n\t\t\t\tdisabled: disabled,\r\n\t\t\t\tisInvalid: !!error && touched,\r\n\t\t\t\tdisableAnimation: props.disableAnimation,\r\n\t\t\t}),\r\n\t\t[props, disabled, error, touched],\r\n\t);\r\n\r\n\tconst getBaseProps = () => ({\r\n\t\t\"className\": slots.base({ class: clsx(classNames?.base, className) }),\r\n\t\t\"data-disabled\": dataAttr(disabled),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getWrapperProps = () => ({\r\n\t\t\"aria-hidden\": true,\r\n\t\t\"className\": slots.wrapper({ class: classNames?.wrapper }),\r\n\t\t\"data-selected\": dataAttr(isSelected || isIndeterminate),\r\n\t});\r\n\r\n\tconst getInputProps = () => ({\r\n\t\tref: mergeRefs(internalRef, props.ref),\r\n\t\ttype: \"checkbox\",\r\n\t\tid: resolvedId,\r\n\t\tdefaultChecked: checked === undefined ? defaultChecked : undefined,\r\n\t\tchecked: checked !== undefined ? checked : undefined,\r\n\t\tdisabled,\r\n\t\trequired,\r\n\t\treadOnly,\r\n\t\tonChange: handleChange,\r\n\t\tclassName: slots.hiddenInput({ class: classNames?.hiddenInput }),\r\n\t});\r\n\r\n\tconst getLabelProps = () => ({\r\n\t\thtmlFor: resolvedId,\r\n\t\tclassName: slots.label({ class: classNames?.label }),\r\n\t});\r\n\r\n\tconst getIconProps = (): CheckboxIconProps => ({\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tdisableAnimation: props.disableAnimation,\r\n\t\tclassName: slots.icon({ class: classNames?.icon }),\r\n\t});\r\n\r\n\tconst Component = \"label\";\r\n\r\n\treturn {\r\n\t\tComponent,\r\n\t\ticon,\r\n\t\tchildren,\r\n\t\tisSelected,\r\n\t\tisIndeterminate,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetLabelProps,\r\n\t\tgetIconProps,\r\n\t};\r\n}\r\n\r\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>;\r\n","import type { UseCheckboxReturn } from \"./use-checkbox\";\n\ntype CheckboxIconProps = Partial<ReturnType<UseCheckboxReturn[\"getIconProps\"]>>;\n\nfunction CheckIcon(props: CheckboxIconProps) {\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\trole=\"presentation\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeDasharray={22}\n\t\t\tstrokeDashoffset={isSelected ? 44 : 66}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tstrokeWidth={2}\n\t\t\tstyle={\n\t\t\t\t!disableAnimation && isSelected\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttransition: \"stroke-dashoffset 250ms linear 0.2s\",\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\tviewBox=\"0 0 17 18\"\n\t\t\t{...otherProps}\n\t\t>\n\t\t\t<polyline points=\"1 9 7 14 15 4\" />\n\t\t</svg>\n\t);\n}\n\nfunction IndeterminateIcon(props: CheckboxIconProps) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { isSelected, disableAnimation, ...otherProps } = props;\n\n\treturn (\n\t\t<svg stroke=\"currentColor\" strokeWidth={3} viewBox=\"0 0 24 24\" {...otherProps}>\n\t\t\t<line x1=\"21\" x2=\"3\" y1=\"12\" y2=\"12\" />\n\t\t</svg>\n\t);\n}\n\n/**\n * CheckboxIcon is used to visually indicate the checked or indeterminate\n * state of a checkbox.\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n\tconst { isIndeterminate, ...otherProps } = props;\n\tconst BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;\n\n\treturn <BaseIcon {...otherProps} />;\n}\n","// checkbox.tsx\r\nimport { forwardRef } from \"react\";\r\nimport { cloneElement, type ReactElement } from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\n\r\nimport { useCheckbox, type UseCheckboxProps } from \"./use-checkbox\";\r\nimport { CheckboxIcon } from \"./checkbox-icon\";\r\n\r\nexport interface CheckboxProps extends UseCheckboxProps {\r\n\tasChild?: boolean;\r\n}\r\n\r\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\r\n\tconst { asChild = false, ...restProps } = props;\r\n\tconst {\r\n\t\tComponent,\r\n\t\tchildren,\r\n\t\ticon = <CheckboxIcon />,\r\n\t\tgetBaseProps,\r\n\t\tgetWrapperProps,\r\n\t\tgetInputProps,\r\n\t\tgetIconProps,\r\n\t\tgetLabelProps,\r\n\t} = useCheckbox({ ...restProps, ref });\r\n\r\n\tconst clonedIcon = typeof icon === \"function\" ? icon(getIconProps()) : cloneElement(icon as ReactElement, getIconProps());\r\n\r\n\tconst Wrapper = asChild ? Slot : Component;\r\n\r\n\treturn (\r\n\t\t<Wrapper {...getBaseProps()}>\r\n\t\t\t<input {...getInputProps()} ref={ref} />\r\n\t\t\t<span {...getWrapperProps()}>{clonedIcon}</span>\r\n\t\t\t{children && <span {...getLabelProps()}>{children}</span>}\r\n\t\t</Wrapper>\r\n\t);\r\n});\r\n\r\nCheckbox.displayName = \"Custom.Checkbox\";\r\n\r\nexport default Checkbox;\r\n"],"names":["tv","groupDataFocusVisibleClasses","hiddenInputClasses","useRef","useId","useMemo","useCallback","dataAttr","mergeRefs","jsx","forwardRef","cloneElement","Slot","jsxs"],"mappings":";;;;;;;;;AAoBA,MAAM,WAAWA,GAAAA,GAAG;AAAA,EACnB,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA,GAAGC,QAAAA;AAAAA,IAAA;AAAA,IAEJ,aAAaC,QAAA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AAA,WAA4C,CAAC,OAAO,QAAQ;AAC5E,QAAM,EAAE,UAAU,OAAO,GAAG,cAAc;AAC1C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,sCAAQ,cAAA,EAAa;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG,YAAY,EAAE,GAAG,WAAW,KAAK;AAErC,QAAM,aAAa,OAAO,SAAS,aAAa,KAAK,aAAA,CAAc,IAAIC,MAAAA,aAAa,MAAsB,cAAc;AAExH,QAAM,UAAU,UAAUC,MAAAA,OAAO;AAEjC,SACCC,2BAAAA,KAAC,SAAA,EAAS,GAAG,aAAA,GACZ,UAAA;AAAA,IAAAJ,2BAAAA,IAAC,SAAA,EAAO,GAAG,cAAA,GAAiB,IAAA,CAAU;AAAA,IACtCA,2BAAAA,IAAC,QAAA,EAAM,GAAG,gBAAA,GAAoB,UAAA,YAAW;AAAA,IACxC,YAAYA,2BAAAA,IAAC,QAAA,EAAM,GAAG,cAAA,GAAkB,SAAA,CAAS;AAAA,EAAA,GACnD;AAEF,CAAC;AAED,SAAS,cAAc;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
3
3
|
const cx = clsx;
|
|
4
4
|
const cva = (base, config) => (props) => {
|
|
@@ -42,4 +42,4 @@ const cva = (base, config) => (props) => {
|
|
|
42
42
|
export {
|
|
43
43
|
cva as c
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=index-
|
|
45
|
+
//# sourceMappingURL=index-CEKmKomA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CEKmKomA.js","sources":["../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"],"sourcesContent":["/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],"names":["param"],"mappings":";AAeA,MAAM,gBAAgB,CAAC,UAAQ,OAAO,UAAU,YAAY,GAAG,KAAK,KAAK,UAAU,IAAI,MAAM;AACtF,MAAM,KAAK;AACN,MAAC,MAAM,CAAC,MAAM,WAAS,CAAC,UAAQ;AACpC,MAAI;AACJ,OAAK,WAAW,QAAQ,WAAW,SAAS,SAAS,OAAO,aAAa,KAAM,QAAO,GAAG,MAAM,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AACvN,QAAM,EAAE,UAAU,gBAAe,IAAK;AACtC,QAAM,uBAAuB,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,YAAU;AAC9D,UAAM,cAAc,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO;AAC/E,UAAM,qBAAqB,oBAAoB,QAAQ,oBAAoB,SAAS,SAAS,gBAAgB,OAAO;AACpH,QAAI,gBAAgB,KAAM,QAAO;AACjC,UAAM,aAAa,cAAc,WAAW,KAAK,cAAc,kBAAkB;AACjF,WAAO,SAAS,OAAO,EAAE,UAAU;AAAA,EACvC,CAAC;AACD,QAAM,wBAAwB,SAAS,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,KAAK,UAAQ;AAC9E,QAAI,CAAC,KAAK,KAAK,IAAI;AACnB,QAAI,UAAU,QAAW;AACrB,aAAO;AAAA,IACX;AACA,QAAI,GAAG,IAAI;AACX,WAAO;AAAA,EACX,GAAG,CAAA,CAAE;AACL,QAAM,+BAA+B,WAAW,QAAQ,WAAW,SAAS,UAAU,2BAA2B,OAAO,sBAAsB,QAAQ,6BAA6B,SAAS,SAAS,yBAAyB,OAAO,CAAC,KAAK,UAAQ;AAC/O,QAAI,EAAE,OAAO,SAAS,WAAW,aAAa,GAAG,uBAAsB,IAAK;AAC5E,WAAO,OAAO,QAAQ,sBAAsB,EAAE,MAAM,CAACA,WAAQ;AACzD,UAAI,CAAC,KAAK,KAAK,IAAIA;AACnB,aAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;AAAA,QACzC,GAAG;AAAA,QACH,GAAG;AAAA,MACvB,EAAkB,GAAG,CAAC,IAAK;AAAA,QACP,GAAG;AAAA,QACH,GAAG;AAAA,MACvB,EAAmB,GAAG,MAAM;AAAA,IAChB,CAAC,IAAI;AAAA,MACD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IAChB,IAAgB;AAAA,EACR,GAAG,CAAA,CAAE;AACL,SAAO,GAAG,MAAM,sBAAsB,8BAA8B,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AAChM;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const React = require("react");
|
|
3
|
-
const
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
function _interopNamespaceDefault(e) {
|
|
5
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
6
|
if (e) {
|
|
@@ -69,9 +69,9 @@ function createSlot(ownerName) {
|
|
|
69
69
|
return child;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
73
73
|
}
|
|
74
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
75
75
|
});
|
|
76
76
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
77
77
|
return Slot2;
|
|
@@ -98,7 +98,7 @@ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
|
98
98
|
// @__NO_SIDE_EFFECTS__
|
|
99
99
|
function createSlottable(ownerName) {
|
|
100
100
|
const Slottable2 = ({ children }) => {
|
|
101
|
-
return /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
102
102
|
};
|
|
103
103
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
104
104
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
@@ -149,4 +149,4 @@ exports.composeRefs = composeRefs;
|
|
|
149
149
|
exports.createSlot = createSlot;
|
|
150
150
|
exports.createSlottable = createSlottable;
|
|
151
151
|
exports.useComposedRefs = useComposedRefs;
|
|
152
|
-
//# sourceMappingURL=index-
|
|
152
|
+
//# sourceMappingURL=index-C_sOsPRt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-C_sOsPRt.js","sources":["../../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.2_@types+react@19.1.13_react@19.1.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@19.1.13_react@19.1.1/node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// packages/react/compose-refs/src/compose-refs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React","jsx","Fragment2"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,SAAS,OAAO,KAAK,OAAO;AAC1B,MAAI,OAAO,QAAQ,YAAY;AAC7B,WAAO,IAAI,KAAK;AAAA,EAClB,WAAW,QAAQ,QAAQ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QAAM,gBAAgB,EAAE,GAAG,WAAU;AACrC,aAAW,YAAY,YAAY;AACjC,UAAM,gBAAgB,UAAU,QAAQ;AACxC,UAAM,iBAAiB,WAAW,QAAQ;AAC1C,UAAM,YAAY,WAAW,KAAK,QAAQ;AAC1C,QAAI,WAAW;AACb,UAAI,iBAAiB,gBAAgB;AACnC,sBAAc,QAAQ,IAAI,IAAI,SAAS;AACrC,gBAAM,SAAS,eAAe,GAAG,IAAI;AACrC,wBAAc,GAAG,IAAI;AACrB,iBAAO;AAAA,QACT;AAAA,MACF,WAAW,eAAe;AACxB,sBAAc,QAAQ,IAAI;AAAA,MAC5B;AAAA,IACF,WAAW,aAAa,SAAS;AAC/B,oBAAc,QAAQ,IAAI,EAAE,GAAG,eAAe,GAAG,eAAc;AAAA,IACjE,WAAW,aAAa,aAAa;AACnC,oBAAc,QAAQ,IAAI,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AACA,SAAO,EAAE,GAAG,WAAW,GAAG,cAAa;AACzC;AACA,SAAS,cAAc,SAAS;AAC9B,MAAI,SAAS,OAAO,yBAAyB,QAAQ,OAAO,KAAK,GAAG;AACpE,MAAI,UAAU,UAAU,oBAAoB,UAAU,OAAO;AAC7D,MAAI,SAAS;AACX,WAAO,QAAQ;AAAA,EACjB;AACA,WAAS,OAAO,yBAAyB,SAAS,KAAK,GAAG;AAC1D,YAAU,UAAU,oBAAoB,UAAU,OAAO;AACzD,MAAI,SAAS;AACX,WAAO,QAAQ,MAAM;AAAA,EACvB;AACA,SAAO,QAAQ,MAAM,OAAO,QAAQ;AACtC;;;;;;","x_google_ignoreList":[0,1]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const clsx = require("
|
|
2
|
+
const clsx = require("clsx");
|
|
3
3
|
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
4
4
|
const cx = clsx.clsx;
|
|
5
5
|
const cva = (base, config) => (props) => {
|
|
@@ -41,4 +41,4 @@ const cva = (base, config) => (props) => {
|
|
|
41
41
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
42
42
|
};
|
|
43
43
|
exports.cva = cva;
|
|
44
|
-
//# sourceMappingURL=index-
|
|
44
|
+
//# sourceMappingURL=index-DaMyCNJ8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DaMyCNJ8.js","sources":["../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"],"sourcesContent":["/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],"names":["clsx","param"],"mappings":";;AAeA,MAAM,gBAAgB,CAAC,UAAQ,OAAO,UAAU,YAAY,GAAG,KAAK,KAAK,UAAU,IAAI,MAAM;AACtF,MAAM,KAAKA,KAAAA;AACN,MAAC,MAAM,CAAC,MAAM,WAAS,CAAC,UAAQ;AACpC,MAAI;AACJ,OAAK,WAAW,QAAQ,WAAW,SAAS,SAAS,OAAO,aAAa,KAAM,QAAO,GAAG,MAAM,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AACvN,QAAM,EAAE,UAAU,gBAAe,IAAK;AACtC,QAAM,uBAAuB,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,YAAU;AAC9D,UAAM,cAAc,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO;AAC/E,UAAM,qBAAqB,oBAAoB,QAAQ,oBAAoB,SAAS,SAAS,gBAAgB,OAAO;AACpH,QAAI,gBAAgB,KAAM,QAAO;AACjC,UAAM,aAAa,cAAc,WAAW,KAAK,cAAc,kBAAkB;AACjF,WAAO,SAAS,OAAO,EAAE,UAAU;AAAA,EACvC,CAAC;AACD,QAAM,wBAAwB,SAAS,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,KAAK,UAAQ;AAC9E,QAAI,CAAC,KAAK,KAAK,IAAI;AACnB,QAAI,UAAU,QAAW;AACrB,aAAO;AAAA,IACX;AACA,QAAI,GAAG,IAAI;AACX,WAAO;AAAA,EACX,GAAG,CAAA,CAAE;AACL,QAAM,+BAA+B,WAAW,QAAQ,WAAW,SAAS,UAAU,2BAA2B,OAAO,sBAAsB,QAAQ,6BAA6B,SAAS,SAAS,yBAAyB,OAAO,CAAC,KAAK,UAAQ;AAC/O,QAAI,EAAE,OAAO,SAAS,WAAW,aAAa,GAAG,uBAAsB,IAAK;AAC5E,WAAO,OAAO,QAAQ,sBAAsB,EAAE,MAAM,CAACC,WAAQ;AACzD,UAAI,CAAC,KAAK,KAAK,IAAIA;AACnB,aAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;AAAA,QACzC,GAAG;AAAA,QACH,GAAG;AAAA,MACvB,EAAkB,GAAG,CAAC,IAAK;AAAA,QACP,GAAG;AAAA,QACH,GAAG;AAAA,MACvB,EAAmB,GAAG,MAAM;AAAA,IAChB,CAAC,IAAI;AAAA,MACD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IAChB,IAAgB;AAAA,EACR,GAAG,CAAA,CAAE;AACL,SAAO,GAAG,MAAM,sBAAsB,8BAA8B,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AAChM;;","x_google_ignoreList":[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
3
|
const LabelError = ({ text, className }) => {
|
|
4
4
|
const classLabel = twMerge("text-danger font-normal text-xs mt-1 leading-none", className);
|
|
5
5
|
return /* @__PURE__ */ jsx("span", { className: classLabel, children: text });
|
|
@@ -7,4 +7,4 @@ const LabelError = ({ text, className }) => {
|
|
|
7
7
|
export {
|
|
8
8
|
LabelError as L
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=label-error-
|
|
10
|
+
//# sourceMappingURL=label-error-BTCuInp7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-error-
|
|
1
|
+
{"version":3,"file":"label-error-BTCuInp7.js","sources":["../../src/components/ui/label-error.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nexport type LabelErrorType = {\n\t/**\n\t * @description\n\t * Propiedad para colocar el texto.\n\t * @type\n\t * Puede recibir **string**\n\t */\n\ttext: string;\n\t/**\n\t * @description\n\t * Propiedad para brindar clases personalizadas al componente, este se situa en el container del label.\n\t */\n\tclassName?: string;\n};\n\nexport const LabelError = ({ text, className }: LabelErrorType) => {\n\tconst classLabel = twMerge(\"text-danger font-normal text-xs mt-1 leading-none\", className);\n\n\treturn <span className={classLabel}>{text}</span>;\n};\n"],"names":[],"mappings":";;AAgBO,MAAM,aAAa,CAAC,EAAE,MAAM,gBAAgC;AAClE,QAAM,aAAa,QAAQ,qDAAqD,SAAS;AAEzF,SAAO,oBAAC,QAAA,EAAK,WAAW,YAAa,UAAA,MAAK;AAC3C;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const tailwindMerge = require("tailwind-merge");
|
|
4
|
+
const LabelError = ({ text, className }) => {
|
|
5
|
+
const classLabel = tailwindMerge.twMerge("text-danger font-normal text-xs mt-1 leading-none", className);
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: classLabel, children: text });
|
|
7
|
+
};
|
|
8
|
+
exports.LabelError = LabelError;
|
|
9
|
+
//# sourceMappingURL=label-error-C8lIsfXu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-error-
|
|
1
|
+
{"version":3,"file":"label-error-C8lIsfXu.js","sources":["../../src/components/ui/label-error.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nexport type LabelErrorType = {\n\t/**\n\t * @description\n\t * Propiedad para colocar el texto.\n\t * @type\n\t * Puede recibir **string**\n\t */\n\ttext: string;\n\t/**\n\t * @description\n\t * Propiedad para brindar clases personalizadas al componente, este se situa en el container del label.\n\t */\n\tclassName?: string;\n};\n\nexport const LabelError = ({ text, className }: LabelErrorType) => {\n\tconst classLabel = twMerge(\"text-danger font-normal text-xs mt-1 leading-none\", className);\n\n\treturn <span className={classLabel}>{text}</span>;\n};\n"],"names":["twMerge","jsx"],"mappings":";;;AAgBO,MAAM,aAAa,CAAC,EAAE,MAAM,gBAAgC;AAClE,QAAM,aAAaA,cAAAA,QAAQ,qDAAqD,SAAS;AAEzF,SAAOC,2BAAAA,IAAC,QAAA,EAAK,WAAW,YAAa,UAAA,MAAK;AAC3C;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
require("./assertion-C4-_LOAB.js");
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const framerMotion = require("framer-motion");
|
|
6
6
|
function clamp(value, min, max) {
|
|
7
7
|
return Math.min(Math.max(value, min), max);
|
|
@@ -31,9 +31,9 @@ function useRipple(props = {}) {
|
|
|
31
31
|
}
|
|
32
32
|
const Ripple = (props) => {
|
|
33
33
|
const { ripples = [], motionProps, color = "currentColor", style, onClear } = props;
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: ripples.map((ripple) => {
|
|
35
35
|
const duration = clamp(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.LazyMotion, { features: framerMotion.domAnimation, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
37
|
framerMotion.m.span,
|
|
38
38
|
{
|
|
39
39
|
animate: { transform: "scale(2)", opacity: 0 },
|
|
@@ -67,4 +67,4 @@ const Ripple = (props) => {
|
|
|
67
67
|
Ripple.displayName = "LizaUI.Ripple";
|
|
68
68
|
exports.Ripple = Ripple;
|
|
69
69
|
exports.useRipple = useRipple;
|
|
70
|
-
//# sourceMappingURL=ripple-
|
|
70
|
+
//# sourceMappingURL=ripple-Bm6QamOy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple-
|
|
1
|
+
{"version":3,"file":"ripple-Bm6QamOy.js","sources":["../../src/functions/numbers.ts","../../src/components/ripple/use-ripple.ts","../../src/components/ripple/ripple.tsx"],"sourcesContent":["/**\n * Clamps a value between a minimum and maximum range.\n *\n * @param value - The value to be clamped.\n * @param min - The minimum value of the range.\n * @param max - The maximum value of the range.\n * @returns The clamped value.\n */\nexport function clamp(value: number, min: number, max: number) {\n\treturn Math.min(Math.max(value, min), max);\n}\n\n/**\n * Generates a unique identifier using a specified prefix and a random number.\n *\n * @param prefix - The prefix to prepend to the unique identifier.\n * @returns A string that combines the prefix and a random number.\n *\n * @example\n * getUniqueID('btn'); // returns 'btn-123456'\n */\nexport function getUniqueID(prefix: string) {\n\treturn `${prefix}-${Math.floor(Math.random() * 1000000)}`;\n}\n","import { getUniqueID } from \"@/functions\";\nimport React, { useCallback, useState } from \"react\";\n\nexport type RippleType = {\n\tkey: React.Key;\n\tx: number;\n\ty: number;\n\tsize: number;\n};\n\nexport function useRipple(props: any = {}) {\n\tconst [ripples, setRipples] = useState<RippleType[]>([]);\n\n\tconst onPress = useCallback((event: any) => {\n\t\tconst trigger = event.target;\n\n\t\tconst size = Math.max(trigger.clientWidth, trigger.clientHeight);\n\n\t\tsetRipples((prevRipples) => [\n\t\t\t...prevRipples,\n\t\t\t{\n\t\t\t\tkey: getUniqueID(prevRipples.length.toString()),\n\t\t\t\tsize,\n\t\t\t\tx: event.x - size / 2,\n\t\t\t\ty: event.y - size / 2,\n\t\t\t},\n\t\t]);\n\t}, []);\n\n\tconst onClear = useCallback((key: React.Key) => {\n\t\tsetRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));\n\t}, []);\n\n\treturn { ripples, onClear, onPress, ...props };\n}\n\nexport type UseRippleReturn = ReturnType<typeof useRipple>;\n","import type { RippleType } from \"./use-ripple\";\nimport type { FC } from \"react\";\nimport type { HTMLMotionProps } from \"framer-motion\";\nimport { domAnimation } from \"framer-motion\";\n\nimport { AnimatePresence, m, LazyMotion } from \"framer-motion\";\nimport { clamp } from \"@/functions\";\n\n\nexport type As<Props = any> = React.ElementType<Props>;\nexport type PropsOf<T extends As> = React.ComponentPropsWithoutRef<T> & {\n as?: As;\n};\nexport type HTMLProps<T extends As = \"div\", OmitKeys extends keyof any = never> = Omit<\n PropsOf<T>,\n \"ref\" | \"color\" | \"slot\" | \"size\" | \"defaultChecked\" | \"defaultValue\" | OmitKeys\n> & {\n as?: As;\n};\nexport interface RippleProps extends HTMLProps<\"span\"> {\n\tripples: RippleType[];\n\tcolor?: string;\n\tmotionProps?: HTMLMotionProps<\"span\">;\n\tstyle?: React.CSSProperties;\n\tonClear: (key: React.Key) => void;\n}\n\n\nconst Ripple: FC<RippleProps> = (props) => {\n const {ripples = [], motionProps, color = \"currentColor\", style, onClear} = props;\n\n return (\n <>\n {ripples.map((ripple) => {\n const duration = clamp(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);\n\n return (\n <LazyMotion key={ripple.key} features={domAnimation}>\n <AnimatePresence mode=\"popLayout\">\n <m.span\n animate={{transform: \"scale(2)\", opacity: 0}}\n className=\"ripple-item-span\"\n exit={{opacity: 0}}\n initial={{transform: \"scale(0)\", opacity: 0.35}}\n style={{\n position: \"absolute\",\n backgroundColor: color,\n borderRadius: \"100%\",\n transformOrigin: \"center\",\n pointerEvents: \"none\",\n overflow: \"hidden\",\n inset: 0,\n zIndex: 0,\n top: ripple.y,\n left: ripple.x,\n width: `${ripple.size}px`,\n height: `${ripple.size}px`,\n ...style,\n }}\n transition={{duration}}\n onAnimationComplete={() => {\n onClear(ripple.key);\n }}\n {...motionProps}\n />\n </AnimatePresence>\n </LazyMotion>\n );\n })}\n </>\n );\n};\nRipple.displayName = \"LizaUI.Ripple\";\n\nexport default Ripple;\n"],"names":["useState","useCallback","jsx","Fragment","LazyMotion","domAnimation","AnimatePresence","m"],"mappings":";;;;;AAQO,SAAS,MAAM,OAAe,KAAa,KAAa;AAC9D,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC1C;AAWO,SAAS,YAAY,QAAgB;AAC3C,SAAO,GAAG,MAAM,IAAI,KAAK,MAAM,KAAK,OAAA,IAAW,GAAO,CAAC;AACxD;ACbO,SAAS,UAAU,QAAa,IAAI;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAIA,MAAAA,SAAuB,CAAA,CAAE;AAEvD,QAAM,UAAUC,kBAAY,CAAC,UAAe;AAC3C,UAAM,UAAU,MAAM;AAEtB,UAAM,OAAO,KAAK,IAAI,QAAQ,aAAa,QAAQ,YAAY;AAE/D,eAAW,CAAC,gBAAgB;AAAA,MAC3B,GAAG;AAAA,MACH;AAAA,QACC,KAAK,YAAY,YAAY,OAAO,UAAU;AAAA,QAC9C;AAAA,QACA,GAAG,MAAM,IAAI,OAAO;AAAA,QACpB,GAAG,MAAM,IAAI,OAAO;AAAA,MAAA;AAAA,IACrB,CACA;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAM,UAAUA,kBAAY,CAAC,QAAmB;AAC/C,eAAW,CAAC,cAAc,UAAU,OAAO,CAAC,WAAW,OAAO,QAAQ,GAAG,CAAC;AAAA,EAC3E,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,S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