luan-ui 0.4.0 → 0.5.0
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/components/avatar/avatar.js.map +1 -1
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/form-helper/form-helper.js +1 -1
- package/dist/components/form-helper/form-helper.js.map +1 -1
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/input/input.js +1 -2
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/slider/slider.js +2 -2
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/slot/slot.js.map +1 -1
- package/dist/components/text-area/text-area.d.ts +7 -0
- package/dist/components/text-area/text-area.js +30 -0
- package/dist/components/text-area/text-area.js.map +1 -0
- package/dist/components/toast/toast.js +2 -2
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/index.d.ts +23 -21
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/utilities/get-variants/get-variants.d.ts +13 -55
- package/dist/utilities/get-variants/get-variants.js +2 -78
- package/dist/utilities/get-variants/get-variants.js.map +1 -1
- package/dist/utilities/pagination/get-truncated-elements.js.map +1 -1
- package/dist/utilities/responsive/responsive.d.ts +3 -6
- package/dist/utilities/responsive/responsive.js.map +1 -1
- package/package.json +19 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"/","sources":["components/avatar/avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"/","sources":["components/avat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/cn\";\nimport { Avatar as AvatarPrimitive } from \"radix-ui\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { forwardRef } from \"react\";\n\nconst Avatar = forwardRef<\n\tComponentRef<typeof AvatarPrimitive.Root>,\n\tComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n\t<AvatarPrimitive.Root\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full border-2 border-white\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\n\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = forwardRef<\n\tComponentRef<typeof AvatarPrimitive.Image>,\n\tComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n\t<AvatarPrimitive.Image\n\t\tref={ref}\n\t\tclassName={cn(\"absolute h-full w-full object-cover\", className)}\n\t\t{...props}\n\t/>\n));\n\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = forwardRef<\n\tComponentRef<typeof AvatarPrimitive.Fallback>,\n\tComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n\t<AvatarPrimitive.Fallback\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-full w-full items-center justify-center rounded-full border border-white bg-gray-700 text-white\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\n\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarFallback, AvatarImage };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"/","sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C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EH,MAAM,WAAW,GAAG;IACnB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;CACN,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAIjC,CACC,EACC,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,IAAI,GAAG,QAAQ,EACf,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC7C,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,iBAAiB,CAAC,IAAI,IACtB,SAAS,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACxD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,cAC3B,KAAC,IAAI,IAAC,OAAO,QAAC,IAAI,EAAE,QAAQ,YAC3B,KAAC,SAAS,KAAG,GACP,GACsB,GACN,CACzB,CAAC;AACH,CAAC,CACD,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport { CheckIcon } from \"@radix-ui/react-icons\";\nimport { getVariants } from \"@utilities/get-variants/get-variants\";\nimport {\n\tmapResponsiveValue,\n\ttype ResponsiveValue,\n} from \"@utilities/responsive/responsive\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\nexport type CheckboxProps = ComponentPropsWithoutRef<\n\ttypeof CheckboxPrimitive.Root\n> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:h-4 sm:w-4\",\n\t\tmedium: \"sm:h-5 sm:w-5\",\n\t\tlarge: \"sm:h-6 sm:w-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:h-4 md:w-4\",\n\t\tmedium: \"md:h-5 md:w-5\",\n\t\tlarge: \"md:h-6 md:w-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:h-4 lg:w-4\",\n\t\tmedium: \"lg:h-5 lg:w-5\",\n\t\tlarge: \"lg:h-6 lg:w-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:h-4 xl:w-4\",\n\t\tmedium: \"xl:h-5 xl:w-5\",\n\t\tlarge: \"xl:h-6 xl:w-6\",\n\t},\n};\nconst checkboxStyles = getVariants({\n\tbase: \"peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[state=checked]:bg-gray-700 data-[state=checked]:text-gray-100\",\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: \"cursor-not-allowed bg-gray-400 opacity-50\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"h-4 w-4\",\n\t\t\tmedium: \"h-5 w-5\",\n\t\t\tlarge: \"h-6 w-6\",\n\t\t},\n\t},\n});\n\nconst iconSizeMap = {\n\tsmall: \"small\",\n\tmedium: \"medium\",\n\tlarge: \"medium\",\n} as const;\n\n/**\n * A checkbox component built on top of Radix UI's checkbox primitive.\n *\n * @example\n * ```tsx\n * <Checkbox id=\"checkbox\" onCheckedChange={(checked) => console.log(checked)} />\n * ```\n */\nexport const Checkbox = forwardRef<\n\tComponentRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t\tsize = \"medium\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst iconSize = mapResponsiveValue(size, (size) => iconSizeMap[size]);\n\t\tconst { disabled, required } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t});\n\t\treturn (\n\t\t\t<CheckboxPrimitive.Root\n\t\t\t\tclassName={checkboxStyles({ disabled, size, className })}\n\t\t\t\tref={ref}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<CheckboxPrimitive.Indicator>\n\t\t\t\t\t<Icon asChild size={iconSize}>\n\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t</Icon>\n\t\t\t\t</CheckboxPrimitive.Indicator>\n\t\t\t</CheckboxPrimitive.Root>\n\t\t);\n\t},\n);\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "@radix-ui/react-icons";
|
|
3
|
-
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
4
3
|
import { cn } from "../../utilities/cn/cn";
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { forwardRef, } from "react";
|
|
6
6
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
7
7
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sourceRoot":"/","sources":["components/dropdown-menu/dropdown-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAg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AAC;AACH,qBAAqB,CAAC,WAAW,GAAG,qBAAqB,CAAC,SAAS,CAAC,WAAW,CAAC;AAEhF,MAAM,oBAAoB,GAAG,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EAC+B,EAAE,EAAE;IAC3C,OAAO,CACN,eACC,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,KAClE,KAAK,GACR,CACF,CAAC;AACH,CAAC,CAAC;AACF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACtB,CAAC","sourcesContent":["import { CheckIcon, ChevronRightIcon, CircleIcon } from \"@radix-ui/react-icons\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\n\nimport { cn } from \"@utilities/cn/cn\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubTrigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[state=open]:bg-gray-200 data-[state=open]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<ChevronRightIcon className=\"ml-auto\" />\n\t</DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n\tDropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubContent\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border border-gray-200 bg-gray-50 p-1 text-gray-700 shadow-lg data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuSubContent.displayName =\n\tDropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Portal>\n\t\t<DropdownMenuPrimitive.Content\n\t\t\tref={ref}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={cn(\n\t\t\t\t\"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-gray-200 bg-gray-50 p-1 text-gray-700 shadow-md\",\n\t\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t</DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n\t<DropdownMenuPrimitive.CheckboxItem\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\tchecked={checked}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<CheckIcon className=\"h-4 w-4\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n\tDropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.RadioItem\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<CircleIcon className=\"h-2 w-2 fill-current\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"px-2 py-1.5 font-semibold text-sm\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Separator>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"-mx-1 my-1 h-px bg-gray-200\", className)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n\tclassName,\n\t...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuRadioItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuGroup,\n\tDropdownMenuPortal,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuRadioGroup,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"/","sources":["components/dropdown-menu/dropdown-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,YAAY,I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AS,EACT,GAAG,KAAK,EAC+B,EAAE,EAAE;IAC3C,OAAO,CACN,eACC,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,KAClE,KAAK,GACR,CACF,CAAC;AACH,CAAC,CAAC;AACF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACtB,CAAC","sourcesContent":["import { CheckIcon, ChevronRightIcon, CircleIcon } from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubTrigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[state=open]:bg-gray-200 data-[state=open]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<ChevronRightIcon className=\"ml-auto\" />\n\t</DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n\tDropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubContent\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border border-gray-200 bg-gray-50 p-1 text-gray-700 shadow-lg data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuSubContent.displayName =\n\tDropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Portal>\n\t\t<DropdownMenuPrimitive.Content\n\t\t\tref={ref}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={cn(\n\t\t\t\t\"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-gray-200 bg-gray-50 p-1 text-gray-700 shadow-md\",\n\t\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t</DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n\t<DropdownMenuPrimitive.CheckboxItem\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-700 data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\tchecked={checked}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<CheckIcon className=\"h-4 w-4\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n\tDropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.RadioItem\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus-visible:bg-gray-200 focus-visible:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<CircleIcon className=\"h-2 w-2 fill-current\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"px-2 py-1.5 font-semibold text-sm\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = forwardRef<\n\tComponentRef<typeof DropdownMenuPrimitive.Separator>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"-mx-1 my-1 h-px bg-gray-200\", className)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n\tclassName,\n\t...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuRadioItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuGroup,\n\tDropdownMenuPortal,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuRadioGroup,\n};\n"]}
|
|
@@ -37,6 +37,6 @@ export const FormHelper = forwardRef(({ className, children, error: initialError
|
|
|
37
37
|
error: initialError,
|
|
38
38
|
disabled: initialDisabled,
|
|
39
39
|
});
|
|
40
|
-
return (_jsx("div", { ref: ref, className: formHelperStyles({ error, disabled, className }), ...props, children: children }));
|
|
40
|
+
return (_jsx("div", { ref: ref, className: formHelperStyles({ error, disabled, className }), role: error ? "alert" : "status", ...props, children: children }));
|
|
41
41
|
});
|
|
42
42
|
//# sourceMappingURL=form-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-helper.js","sourceRoot":"/","sources":["components/form-helper/form-helper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAOlE,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACpC,IAAI,EAAE,uBAAuB;IAC7B,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,cAAc;SACpB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,eAAe;SACrB;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,eAAe;SAC1B;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CACnC,CACC,EACC,SAAS,EACT,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC1C,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,OAAO,CACN,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"form-helper.js","sourceRoot":"/","sources":["components/form-helper/form-helper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAOlE,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACpC,IAAI,EAAE,uBAAuB;IAC7B,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,cAAc;SACpB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,eAAe;SACrB;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,eAAe;SAC1B;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CACnC,CACC,EACC,SAAS,EACT,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC1C,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,OAAO,CACN,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAC3D,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,KAC5B,KAAK,YAER,QAAQ,GACJ,CACN,CAAC;AACH,CAAC,CACD,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { getVariants } from \"@utilities/get-variants/get-variants\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nexport type FormHelperProps = ComponentPropsWithoutRef<\"div\"> & {\n\terror?: boolean;\n\tdisabled?: boolean;\n};\n\nconst formHelperStyles = getVariants({\n\tbase: \"text-gray-500 text-sm\",\n\tvariants: {\n\t\terror: {\n\t\t\ttrue: \"text-red-600\",\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: \"text-gray-300\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\terror: true,\n\t\t\tdisabled: true,\n\t\t\tclassName: \"text-gray-300\",\n\t\t},\n\t],\n});\n\n/**\n * A component that displays a helper text for a form field. Should be used as a child of a FormField component and will inherit the form field's error and disabled state.\n *\n * @example\n * ```tsx\n * <FormField>\n * <Label>Email</Label>\n * <Input />\n * <FormHelper>This is a helper text</FormHelper>\n * </FormField>\n * ```\n */\nexport const FormHelper = forwardRef<HTMLDivElement, FormHelperProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tchildren,\n\t\t\terror: initialError,\n\t\t\tdisabled: initialDisabled,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst { error, disabled } = useFormContext({\n\t\t\terror: initialError,\n\t\t\tdisabled: initialDisabled,\n\t\t});\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={formHelperStyles({ error, disabled, className })}\n\t\t\t\trole={error ? \"alert\" : \"status\"}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t},\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"/","sources":["components/icon/icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"/","sources":["components/icon/icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAOnC,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;CACD,CAAC;AAEF,MAAM,UAAU,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,2BAA2B;IACjC,QAAQ,EAAE;QACT,IAAI,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,SAAS;SAChB;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpC,OAAO,CACN,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,KAAM,KAAK,GAAI,CACzE,CAAC;AACH,CAAC,CACD,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport { getVariants } from \"@utilities/get-variants/get-variants\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { forwardRef } from \"react\";\n\nexport type IconProps = React.SVGProps<SVGSVGElement> & {\n\tasChild?: boolean;\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:h-4 sm:w-4\",\n\t\tmedium: \"sm:h-6 sm:w-6\",\n\t\tlarge: \"sm:h-8 sm:w-8\",\n\t},\n\tmd: {\n\t\tsmall: \"md:h-4 md:w-4\",\n\t\tmedium: \"md:h-6 md:w-6\",\n\t\tlarge: \"md:h-8 md:w-8\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:h-4 lg:w-4\",\n\t\tmedium: \"lg:h-6 lg:w-6\",\n\t\tlarge: \"lg:h-8 lg:w-8\",\n\t},\n\txl: {\n\t\tsmall: \"xl:h-4 xl:w-4\",\n\t\tmedium: \"xl:h-6 xl:w-6\",\n\t\tlarge: \"xl:h-8 xl:w-8\",\n\t},\n};\n\nconst iconStyles = getVariants({\n\tbase: \"fill-current text-current\",\n\tvariants: {\n\t\tsize: {\n\t\t\tsmall: \"h-4 w-4\",\n\t\t\tmedium: \"h-6 w-6\",\n\t\t\tlarge: \"h-8 w-8\",\n\t\t},\n\t},\n});\n\n/**\n * A flexible icon component that serves as a wrapper for SVG icons.\n * Must be used with asChild={true} to render the actual icon component.\n *\n * @example\n * // Correct usage\n * <Icon asChild size=\"medium\">\n * <HomeIcon />\n * </Icon>\n *\n * @example\n * // With different sizes\n * <Icon asChild size=\"small\">\n * <UserIcon />\n * </Icon>\n *\n * @example\n * // With custom className\n * <Icon asChild className=\"text-blue-500\">\n * <SettingsIcon />\n * </Icon>\n *\n * @param {boolean} [props.asChild] - Should always be true when using this component\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the icon\n * @param {string} [props.className] - Additional CSS classes to apply\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(\n\t({ className, size = \"medium\", asChild, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"svg\";\n\t\treturn (\n\t\t\t<Comp ref={ref} className={iconStyles({ size, className })} {...props} />\n\t\t);\n\t},\n);\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFormContext } from "../form-field/form-field-context";
|
|
3
|
-
import { cn } from "../../utilities/cn/cn";
|
|
4
3
|
import { getVariants } from "../../utilities/get-variants/get-variants";
|
|
5
4
|
import { forwardRef } from "react";
|
|
6
5
|
const inputStyles = getVariants({
|
|
@@ -35,7 +34,7 @@ const Input = forwardRef(({ className, disabled: initialDisabled, required: init
|
|
|
35
34
|
required: initialRequired,
|
|
36
35
|
error: initialError,
|
|
37
36
|
});
|
|
38
|
-
return (_jsx("input", { className: inputStyles({ disabled, error, className }), disabled: disabled, required: required, ...props, ref: ref }));
|
|
37
|
+
return (_jsx("input", { className: inputStyles({ disabled, error, className }), disabled: disabled, required: required, "aria-invalid": error, ...props, ref: ref }));
|
|
39
38
|
});
|
|
40
39
|
Input.displayName = "Input";
|
|
41
40
|
export { Input };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"/","sources":["components/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"/","sources":["components/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMnC,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,oIAAoI;IAC1I,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,gBAAgB;SACtB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,iDAAiD;SACvD;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EACR,iEAAiE;SAClE;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,UAAU,CACvB,CACC,EACC,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC;QACpD,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,YAAY;KACnB,CAAC,CAAC;IACH,OAAO,CACN,gBACC,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EACtD,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,kBACJ,KAAK,KACf,KAAK,EACT,GAAG,EAAE,GAAG,GACP,CACF,CAAC;AACH,CAAC,CACD,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { getVariants } from \"@utilities/get-variants/get-variants\";\nimport { forwardRef } from \"react\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n\terror?: boolean;\n};\n\nconst inputStyles = getVariants({\n\tbase: \"rounded-sm border border-gray-400 px-3 py-2 text-sm placeholder:text-gray-400 focus-visible:outline focus-visible:outline-gray-800\",\n\tvariants: {\n\t\terror: {\n\t\t\ttrue: \"border-red-600\",\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: \"disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\terror: true,\n\t\t\tdisabled: true,\n\t\t\tclassName:\n\t\t\t\t\"border-gray-400 disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t},\n\t],\n});\n\n/**\n * A basic input component with styling.\n *\n * @example\n * ```tsx\n * <Input placeholder=\"Enter your email\" id=\"email\" />\n * ```\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t\terror: initialError,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst { disabled, required, error } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t\terror: initialError,\n\t\t});\n\t\treturn (\n\t\t\t<input\n\t\t\t\tclassName={inputStyles({ disabled, error, className })}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\taria-invalid={error}\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t/>\n\t\t);\n\t},\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"/","sources":["components/pagination/pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAEN,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACR,MAAM,OAAO,CAAC;AAef,MAAM,iBAAiB,GAAG,aAAa,CACtC,SAAS,CACT,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KA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,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAC/C,QAAQ,EAAE,CAAC,eAAe,EAC1B,SAAS,EAAE,EAAE,CACZ,+FAA+F,EAC/F,SAAS,CACT,KACG,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AAEH;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,UAAU,CAG/B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAC5D,oBAAoB,EAAE,CAAC;IACxB,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CACZ,+FAA+F,EAC/F,SAAS,CACT,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,WAAW,EACtB,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KACxD,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { mergeRefs } from \"@utilities/merge-refs/merge-refs\";\nimport { getTruncatedElements } from \"@utilities/pagination/get-truncated-elements\";\nimport { handleKeyboardNavigation } from \"@utilities/pagination/keyboard-navigation\";\nimport clsx from \"clsx\";\nimport {\n\ttype PropsWithChildren,\n\tcreateContext,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\n/**\n * Pagination Context\n */\n\ntype PaginationContextValue = {\n\tpage: number;\n\ttotalPages: number;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n\tsetPage: (page: number) => void;\n\tregisterRef: (index: number, element: HTMLButtonElement | null) => void;\n};\n\nconst PaginationContext = createContext<PaginationContextValue | undefined>(\n\tundefined,\n);\n\nconst usePaginationContext = () => {\n\tconst context = useContext(PaginationContext);\n\tif (!context) {\n\t\tthrow new Error(\"Pagination components must be used within a Pagination\");\n\t}\n\treturn context;\n};\n\n/**\n * Pagination\n */\n\nexport type PaginationProps = {\n\tchildren?: React.ReactNode;\n\tpage: number;\n\ttotalPages: number;\n\tonPageChange: (page: number) => void;\n\tasChild?: boolean;\n} & React.HTMLAttributes<HTMLElement>;\n\n/**\n * Pagination component that provides navigation controls for a set of pages.\n *\n * @param {number} props.page - The current active page number\n * @param {number} props.totalPages - The total number of pages\n * @param {(page: number) => void} props.onPageChange - Callback function called when page changes\n * @param {boolean} [props.asChild] - Whether to render the root element as a child component\n * @param {React.ReactNode} [props.children] - The content to render within the pagination component\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * ```tsx\n * <Pagination page={1} totalPages={10} onPageChange={(page) => console.log(page)}>\n * <PaginationPrev>Previous</PaginationPrev>\n * <PaginationItem index={1}>1</PaginationItem>\n * <PaginationItem index={2}>2</PaginationItem>\n * <PaginationNext>Next</PaginationNext>\n * </Pagination>\n * ```\n */\nconst Pagination = forwardRef<HTMLElement, PaginationProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tpage: initialPage,\n\t\t\ttotalPages: initialTotalPages,\n\t\t\tonPageChange,\n\t\t\tclassName,\n\t\t\tasChild,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [page, setPage] = useState(initialPage);\n\t\tconst [totalPages, setTotalPages] = useState(initialTotalPages);\n\t\tconst [hasNextPage, setHasNextPage] = useState(page < totalPages);\n\t\tconst [hasPreviousPage, setHasPreviousPage] = useState(page > 1);\n\n\t\tconst refs = useRef(new Map<number, HTMLButtonElement>());\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(e: KeyboardEvent) =>\n\t\t\t\thandleKeyboardNavigation(e, { current: refs.current }, totalPages),\n\t\t\t[totalPages],\n\t\t);\n\n\t\tconst registerRefWrapper = useCallback(\n\t\t\t(index: number, element: HTMLButtonElement | null) => {\n\t\t\t\tif (element) {\n\t\t\t\t\trefs.current.set(index, element);\n\t\t\t\t} else {\n\t\t\t\t\trefs.current.delete(index);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t\treturn () => {\n\t\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\t};\n\t\t}, [handleKeyDown]);\n\n\t\tuseEffect(() => {\n\t\t\tsetHasNextPage(page < totalPages);\n\t\t\tsetHasPreviousPage(page > 1);\n\t\t}, [page, totalPages]);\n\n\t\tuseEffect(() => {\n\t\t\tsetPage(initialPage);\n\t\t\tsetTotalPages(initialTotalPages);\n\t\t}, [initialPage, initialTotalPages]);\n\n\t\tuseEffect(() => {\n\t\t\tif (onPageChange) {\n\t\t\t\tonPageChange(page);\n\t\t\t}\n\t\t}, [page, onPageChange]);\n\n\t\tconst memoContextValue = useMemo(\n\t\t\t() => ({\n\t\t\t\tpage,\n\t\t\t\tsetPage,\n\t\t\t\ttotalPages,\n\t\t\t\thasNextPage,\n\t\t\t\thasPreviousPage,\n\t\t\t\tregisterRef: registerRefWrapper,\n\t\t\t}),\n\t\t\t[page, totalPages, hasNextPage, hasPreviousPage, registerRefWrapper],\n\t\t);\n\n\t\tconst Component = asChild ? Slot : \"nav\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\taria-label=\"Pagination\"\n\t\t\t\tclassName={clsx(\"flex items-center gap-1\", className)}\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<PaginationContext.Provider value={memoContextValue}>\n\t\t\t\t\t{getTruncatedElements({ page, children })}\n\t\t\t\t</PaginationContext.Provider>\n\t\t\t</Component>\n\t\t);\n\t},\n);\n\n/**\n * Pagination Item\n */\n\nexport type PaginationItemProps = {\n\tchildren?: React.ReactNode;\n\tindex?: number;\n} & React.HTMLAttributes<HTMLButtonElement>;\n\n/**\n * Individual page item within the Pagination component.\n *\n * @example\n * ```tsx\n * <PaginationItem index={1}>1</PaginationItem>\n */\nconst PaginationItem = forwardRef<HTMLButtonElement, PaginationItemProps>(\n\t({ index, children, className, ...props }, ref) => {\n\t\tconst { registerRef, page, setPage } = usePaginationContext();\n\n\t\tconst isActive = page === index;\n\t\tconst handleClick = () => {\n\t\t\tif (index !== undefined) {\n\t\t\t\tsetPage(index);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={handleClick}\n\t\t\t\tref={mergeRefs(ref, (el) => registerRef(index ?? 0, el))}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"bg-gray-700 text-white hover:bg-gray-800\": isActive,\n\t\t\t\t\t},\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\taria-current={isActive ? \"page\" : undefined}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children ?? index}\n\t\t\t</button>\n\t\t);\n\t},\n);\n\n/**\n * Pagination Prev\n */\n\n/**\n * Previous page button component for the Pagination.\n * Automatically disabled when on the first page.\n *\n * @example\n * ```tsx\n * <PaginationPrev>Previous</PaginationPrev>\n * ```\n */\nconst PaginationPrev = forwardRef<\n\tHTMLButtonElement,\n\tPropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>\n>(({ children, className, ...props }, ref) => {\n\tconst { registerRef, page, setPage, hasPreviousPage } =\n\t\tusePaginationContext();\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={() => setPage(page - 1)}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(0, el))}\n\t\t\tdisabled={!hasPreviousPage}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n});\n\n/**\n * Pagination Next\n */\n\n/**\n * Next page button component for the Pagination.\n * Automatically disabled when on the last page.\n *\n * @example\n * ```tsx\n * <PaginationNext>Next</PaginationNext>\n * ```\n */\nconst PaginationNext = forwardRef<\n\tHTMLButtonElement,\n\tPropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>\n>(({ children, className, ...props }, ref) => {\n\tconst { page, setPage, hasNextPage, registerRef, totalPages } =\n\t\tusePaginationContext();\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={() => setPage(page + 1)}\n\t\t\tdisabled={!hasNextPage}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(totalPages + 1, el))}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n});\n\nexport { Pagination, PaginationItem, PaginationPrev, PaginationNext };\n"]}
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"/","sources":["components/pagination/pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,E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AAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CACZ,+FAA+F,EAC/F,SAAS,CACT,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,WAAW,EACtB,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KACxD,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { mergeRefs } from \"@utilities/merge-refs/merge-refs\";\nimport { getTruncatedElements } from \"@utilities/pagination/get-truncated-elements\";\nimport { handleKeyboardNavigation } from \"@utilities/pagination/keyboard-navigation\";\nimport clsx from \"clsx\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\ttype PropsWithChildren,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\n/**\n * Pagination Context\n */\n\ntype PaginationContextValue = {\n\tpage: number;\n\ttotalPages: number;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n\tsetPage: (page: number) => void;\n\tregisterRef: (index: number, element: HTMLButtonElement | null) => void;\n};\n\nconst PaginationContext = createContext<PaginationContextValue | undefined>(\n\tundefined,\n);\n\nconst usePaginationContext = () => {\n\tconst context = useContext(PaginationContext);\n\tif (!context) {\n\t\tthrow new Error(\"Pagination components must be used within a Pagination\");\n\t}\n\treturn context;\n};\n\n/**\n * Pagination\n */\n\nexport type PaginationProps = {\n\tchildren?: React.ReactNode;\n\tpage: number;\n\ttotalPages: number;\n\tonPageChange: (page: number) => void;\n\tasChild?: boolean;\n} & React.HTMLAttributes<HTMLElement>;\n\n/**\n * Pagination component that provides navigation controls for a set of pages.\n *\n * @param {number} props.page - The current active page number\n * @param {number} props.totalPages - The total number of pages\n * @param {(page: number) => void} props.onPageChange - Callback function called when page changes\n * @param {boolean} [props.asChild] - Whether to render the root element as a child component\n * @param {React.ReactNode} [props.children] - The content to render within the pagination component\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * ```tsx\n * <Pagination page={1} totalPages={10} onPageChange={(page) => console.log(page)}>\n * <PaginationPrev>Previous</PaginationPrev>\n * <PaginationItem index={1}>1</PaginationItem>\n * <PaginationItem index={2}>2</PaginationItem>\n * <PaginationNext>Next</PaginationNext>\n * </Pagination>\n * ```\n */\nconst Pagination = forwardRef<HTMLElement, PaginationProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tpage: initialPage,\n\t\t\ttotalPages: initialTotalPages,\n\t\t\tonPageChange,\n\t\t\tclassName,\n\t\t\tasChild,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [page, setPage] = useState(initialPage);\n\t\tconst [totalPages, setTotalPages] = useState(initialTotalPages);\n\t\tconst [hasNextPage, setHasNextPage] = useState(page < totalPages);\n\t\tconst [hasPreviousPage, setHasPreviousPage] = useState(page > 1);\n\n\t\tconst refs = useRef(new Map<number, HTMLButtonElement>());\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(e: KeyboardEvent) =>\n\t\t\t\thandleKeyboardNavigation(e, { current: refs.current }, totalPages),\n\t\t\t[totalPages],\n\t\t);\n\n\t\tconst registerRefWrapper = useCallback(\n\t\t\t(index: number, element: HTMLButtonElement | null) => {\n\t\t\t\tif (element) {\n\t\t\t\t\trefs.current.set(index, element);\n\t\t\t\t} else {\n\t\t\t\t\trefs.current.delete(index);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t\treturn () => {\n\t\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\t};\n\t\t}, [handleKeyDown]);\n\n\t\tuseEffect(() => {\n\t\t\tsetHasNextPage(page < totalPages);\n\t\t\tsetHasPreviousPage(page > 1);\n\t\t}, [page, totalPages]);\n\n\t\tuseEffect(() => {\n\t\t\tsetPage(initialPage);\n\t\t\tsetTotalPages(initialTotalPages);\n\t\t}, [initialPage, initialTotalPages]);\n\n\t\tuseEffect(() => {\n\t\t\tif (onPageChange) {\n\t\t\t\tonPageChange(page);\n\t\t\t}\n\t\t}, [page, onPageChange]);\n\n\t\tconst memoContextValue = useMemo(\n\t\t\t() => ({\n\t\t\t\tpage,\n\t\t\t\tsetPage,\n\t\t\t\ttotalPages,\n\t\t\t\thasNextPage,\n\t\t\t\thasPreviousPage,\n\t\t\t\tregisterRef: registerRefWrapper,\n\t\t\t}),\n\t\t\t[page, totalPages, hasNextPage, hasPreviousPage, registerRefWrapper],\n\t\t);\n\n\t\tconst Component = asChild ? Slot : \"nav\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\taria-label=\"Pagination\"\n\t\t\t\tclassName={clsx(\"flex items-center gap-1\", className)}\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<PaginationContext.Provider value={memoContextValue}>\n\t\t\t\t\t{getTruncatedElements({ page, children })}\n\t\t\t\t</PaginationContext.Provider>\n\t\t\t</Component>\n\t\t);\n\t},\n);\n\n/**\n * Pagination Item\n */\n\nexport type PaginationItemProps = {\n\tchildren?: React.ReactNode;\n\tindex?: number;\n} & React.HTMLAttributes<HTMLButtonElement>;\n\n/**\n * Individual page item within the Pagination component.\n *\n * @example\n * ```tsx\n * <PaginationItem index={1}>1</PaginationItem>\n */\nconst PaginationItem = forwardRef<HTMLButtonElement, PaginationItemProps>(\n\t({ index, children, className, ...props }, ref) => {\n\t\tconst { registerRef, page, setPage } = usePaginationContext();\n\n\t\tconst isActive = page === index;\n\t\tconst handleClick = () => {\n\t\t\tif (index !== undefined) {\n\t\t\t\tsetPage(index);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={handleClick}\n\t\t\t\tref={mergeRefs(ref, (el) => registerRef(index ?? 0, el))}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"bg-gray-700 text-white hover:bg-gray-800\": isActive,\n\t\t\t\t\t},\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\taria-current={isActive ? \"page\" : undefined}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children ?? index}\n\t\t\t</button>\n\t\t);\n\t},\n);\n\n/**\n * Pagination Prev\n */\n\n/**\n * Previous page button component for the Pagination.\n * Automatically disabled when on the first page.\n *\n * @example\n * ```tsx\n * <PaginationPrev>Previous</PaginationPrev>\n * ```\n */\nconst PaginationPrev = forwardRef<\n\tHTMLButtonElement,\n\tPropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>\n>(({ children, className, ...props }, ref) => {\n\tconst { registerRef, page, setPage, hasPreviousPage } =\n\t\tusePaginationContext();\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={() => setPage(page - 1)}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(0, el))}\n\t\t\tdisabled={!hasPreviousPage}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n});\n\n/**\n * Pagination Next\n */\n\n/**\n * Next page button component for the Pagination.\n * Automatically disabled when on the last page.\n *\n * @example\n * ```tsx\n * <PaginationNext>Next</PaginationNext>\n * ```\n */\nconst PaginationNext = forwardRef<\n\tHTMLButtonElement,\n\tPropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>\n>(({ children, className, ...props }, ref) => {\n\tconst { page, setPage, hasNextPage, registerRef, totalPages } =\n\t\tusePaginationContext();\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={() => setPage(page + 1)}\n\t\t\tdisabled={!hasNextPage}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(totalPages + 1, el))}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n});\n\nexport { Pagination, PaginationItem, PaginationPrev, PaginationNext };\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
2
|
import { useFormContext } from "../form-field/form-field-context";
|
|
4
3
|
import { Icon } from "../icon/icon";
|
|
5
4
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon, } from "@radix-ui/react-icons";
|
|
6
5
|
import { cn } from "../../utilities/cn/cn";
|
|
6
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
7
7
|
import { forwardRef, } from "react";
|
|
8
8
|
/**
|
|
9
9
|
* Select
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"/","sources":["components/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACN,SAAS,EACT,eAAe,EACf,aAAa,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EA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ACnC,KAAC,eAAe,CAAC,SAAS,IACzB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,KAC7C,KAAK,GACR,CACF,CAAC,CAAC;AACH,eAAe,CAAC,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC;AAEpE,OAAO,EACN,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACtB,CAAC","sourcesContent":["import { Select as SelectPrimitive } from \"radix-ui\";\n\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport {\n\tCheckIcon,\n\tChevronDownIcon,\n\tChevronUpIcon,\n} from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\n/**\n * Select\n */\n\nconst Select = ({\n\tdisabled: initialDisabled,\n\trequired: initialRequired,\n\t...props\n}: ComponentPropsWithoutRef<typeof SelectPrimitive.Root>) => {\n\tconst { disabled, required } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t<SelectPrimitive.Root disabled={disabled} required={required} {...props} />\n\t);\n};\n\n/**\n * SelectGroup\n */\n\nconst SelectGroup = SelectPrimitive.Group;\n\n/**\n * SelectValue\n */\n\nconst SelectValue = SelectPrimitive.Value;\n\n/**\n * SelectTrigger\n */\n\nconst SelectTrigger = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Trigger>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-400 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-gray-500 [&>span]:line-clamp-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<SelectPrimitive.Icon asChild>\n\t\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t\t<ChevronDownIcon />\n\t\t\t</Icon>\n\t\t</SelectPrimitive.Icon>\n\t</SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\n/**\n * SelectScrollUpButton\n */\n\nconst SelectScrollUpButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollUpButton\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t<ChevronUpIcon />\n\t\t</Icon>\n\t</SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\n/**\n * SelectScrollDownButton\n */\n\nconst SelectScrollDownButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollDownButton\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t<ChevronDownIcon />\n\t\t</Icon>\n\t</SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n\tSelectPrimitive.ScrollDownButton.displayName;\n\n/**\n * SelectContent\n */\n\nconst SelectContent = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n\t<SelectPrimitive.Portal>\n\t\t<SelectPrimitive.Content\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border border-gray-400 bg-white text-gray-700 shadow-md data-[state=closed]:animate-fade-out data-[state=closed]:animate-out data-[state=open]:animate-fade-in data-[state=open]:animate-in\",\n\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\"data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tposition={position}\n\t\t\t{...props}\n\t\t>\n\t\t\t<SelectScrollUpButton />\n\t\t\t<SelectPrimitive.Viewport\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"p-1\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</SelectPrimitive.Viewport>\n\t\t\t<SelectScrollDownButton />\n\t\t</SelectPrimitive.Content>\n\t</SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\n/**\n * SelectLabel\n */\n\nconst SelectLabel = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cn(\"px-2 py-1.5 font-semibold text-sm\", className)}\n\t\t{...props}\n\t/>\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\n/**\n * SelectItem\n */\n\nconst SelectItem = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus-visible:bg-gray-700 focus-visible:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<SelectPrimitive.ItemIndicator>\n\t\t\t\t<Icon asChild size=\"small\">\n\t\t\t\t\t<CheckIcon />\n\t\t\t\t</Icon>\n\t\t\t</SelectPrimitive.ItemIndicator>\n\t\t</span>\n\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t</SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\n/**\n * SelectSeparator\n */\n\nconst SelectSeparator = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Separator>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"my-2 h-px bg-gray-200\", className)}\n\t\t{...props}\n\t/>\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n\tSelect,\n\tSelectGroup,\n\tSelectValue,\n\tSelectTrigger,\n\tSelectContent,\n\tSelectLabel,\n\tSelectItem,\n\tSelectS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AAC,aAAa,cAC7B,KAAC,IAAI,IAAC,OAAO,QAAC,IAAI,EAAC,OAAO,YACzB,KAAC,SAAS,KAAG,GACP,GACwB,GAC1B,EACP,KAAC,eAAe,CAAC,QAAQ,cAAE,QAAQ,GAA4B,IACzC,CACvB,CAAC,CAAC;AACH,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC;AAE1D;;GAEG;AAEH,MAAM,eAAe,GAAG,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,eAAe,CAAC,SAAS,IACzB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,KAC7C,KAAK,GACR,CACF,CAAC,CAAC;AACH,eAAe,CAAC,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC;AAEpE,OAAO,EACN,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACtB,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport {\n\tCheckIcon,\n\tChevronDownIcon,\n\tChevronUpIcon,\n} from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { Select as SelectPrimitive } from \"radix-ui\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\n/**\n * Select\n */\n\nconst Select = ({\n\tdisabled: initialDisabled,\n\trequired: initialRequired,\n\t...props\n}: ComponentPropsWithoutRef<typeof SelectPrimitive.Root>) => {\n\tconst { disabled, required } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t<SelectPrimitive.Root disabled={disabled} required={required} {...props} />\n\t);\n};\n\n/**\n * SelectGroup\n */\n\nconst SelectGroup = SelectPrimitive.Group;\n\n/**\n * SelectValue\n */\n\nconst SelectValue = SelectPrimitive.Value;\n\n/**\n * SelectTrigger\n */\n\nconst SelectTrigger = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Trigger>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-400 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-gray-500 [&>span]:line-clamp-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<SelectPrimitive.Icon asChild>\n\t\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t\t<ChevronDownIcon />\n\t\t\t</Icon>\n\t\t</SelectPrimitive.Icon>\n\t</SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\n/**\n * SelectScrollUpButton\n */\n\nconst SelectScrollUpButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollUpButton\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t<ChevronUpIcon />\n\t\t</Icon>\n\t</SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\n/**\n * SelectScrollDownButton\n */\n\nconst SelectScrollDownButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollDownButton\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<Icon asChild size=\"small\" className=\"opacity-50\">\n\t\t\t<ChevronDownIcon />\n\t\t</Icon>\n\t</SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n\tSelectPrimitive.ScrollDownButton.displayName;\n\n/**\n * SelectContent\n */\n\nconst SelectContent = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n\t<SelectPrimitive.Portal>\n\t\t<SelectPrimitive.Content\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border border-gray-400 bg-white text-gray-700 shadow-md data-[state=closed]:animate-fade-out data-[state=closed]:animate-out data-[state=open]:animate-fade-in data-[state=open]:animate-in\",\n\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\"data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tposition={position}\n\t\t\t{...props}\n\t\t>\n\t\t\t<SelectScrollUpButton />\n\t\t\t<SelectPrimitive.Viewport\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"p-1\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</SelectPrimitive.Viewport>\n\t\t\t<SelectScrollDownButton />\n\t\t</SelectPrimitive.Content>\n\t</SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\n/**\n * SelectLabel\n */\n\nconst SelectLabel = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cn(\"px-2 py-1.5 font-semibold text-sm\", className)}\n\t\t{...props}\n\t/>\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\n/**\n * SelectItem\n */\n\nconst SelectItem = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus-visible:bg-gray-700 focus-visible:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<SelectPrimitive.ItemIndicator>\n\t\t\t\t<Icon asChild size=\"small\">\n\t\t\t\t\t<CheckIcon />\n\t\t\t\t</Icon>\n\t\t\t</SelectPrimitive.ItemIndicator>\n\t\t</span>\n\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t</SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\n/**\n * SelectSeparator\n */\n\nconst SelectSeparator = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Separator>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"my-2 h-px bg-gray-200\", className)}\n\t\t{...props}\n\t/>\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n\tSelect,\n\tSelectGroup,\n\tSelectValue,\n\tSelectTrigger,\n\tSelectContent,\n\tSelectLabel,\n\tSelectItem,\n\tSelectSeparator,\n\tSelectScrollUpButton,\n\tSelectScrollDownButton,\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Slider as RadixSlider } from "radix-ui";
|
|
3
|
-
import { forwardRef, useState, } from "react";
|
|
4
2
|
import { useFormContext } from "../form-field/form-field-context";
|
|
5
3
|
import { Tooltip, TooltipContent, TooltipTrigger, } from "../tooltip/tooltip";
|
|
6
4
|
import { cn } from "../../utilities/cn/cn";
|
|
5
|
+
import { Slider as RadixSlider } from "radix-ui";
|
|
6
|
+
import { forwardRef, useState, } from "react";
|
|
7
7
|
/**
|
|
8
8
|
* A customizable slider component built on top of Radix UI's slider primitive.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","sourceRoot":"/","sources":["components/slider/slider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"slider.js","sourceRoot":"/","sources":["components/slider/slider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EACN,OAAO,EACP,cAAc,EACd,cAAc,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACt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G,GAAK,EACZ,sBAAI,GAAG,GAAK,IACP,CACN,IACC,CACH,CAAC;AACH,CAAC,CACD,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipTrigger,\n} from \"@components/tooltip/tooltip\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { Slider as RadixSlider } from \"radix-ui\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n\tuseState,\n} from \"react\";\n\nexport type SliderProps = ComponentPropsWithoutRef<typeof RadixSlider.Root> & {\n\t/**\n\t * Whether to show the minimum and maximum values below the slider\n\t * @default true\n\t */\n\tshowMinMax?: boolean;\n};\n\n/**\n * A customizable slider component built on top of Radix UI's slider primitive.\n *\n * @example\n * ```tsx\n * <Slider\n * min={0}\n * max={100}\n * defaultValue={[50]}\n * showMinMax={true}\n * />\n * ```\n *\n * @param {Object} props - The props for the Slider component\n * @param {number[]} [props.defaultValue] - The initial value of the slider\n * @param {number} [props.min=0] - The minimum value of the slider\n * @param {number} [props.max=100] - The maximum value of the slider\n * @param {boolean} [props.showMinMax=true] - Whether to show min/max values below the slider\n * @param {string} [props.className] - Additional CSS classes to apply to the slider\n * @param {React.Ref<ComponentRef<typeof RadixSlider.Root>>} ref - Forwarded ref for the slider root element\n * @returns {JSX.Element} A slider component with optional tooltips and min/max display\n */\nconst Slider = forwardRef<ComponentRef<typeof RadixSlider.Root>, SliderProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tshowMinMax = true,\n\t\t\tdisabled: initialDisabled,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [value, setValue] = useState<number[]>(defaultValue ?? []);\n\t\tconst { disabled } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t});\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RadixSlider.Root\n\t\t\t\t\tref={ref}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonValueChange={setValue}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"relative flex w-full touch-none select-none items-center\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<RadixSlider.Track className=\"relative h-1.5 w-full grow overflow-hidden rounded-full bg-gray-700/20 data-[disabled]:opacity-50\">\n\t\t\t\t\t\t<RadixSlider.Range className=\"absolute h-full bg-gray-700\" />\n\t\t\t\t\t</RadixSlider.Track>\n\t\t\t\t\t{value.map((thumbValue, index) => (\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: <only index is available>\n\t\t\t\t\t\t<Tooltip key={index} delayDuration={0}>\n\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t<RadixSlider.Thumb className=\"block h-4 w-4 rounded-full border border-gray-700 bg-white shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-700 data-[disabled]:pointer-events-none\" />\n\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t<TooltipContent>\n\t\t\t\t\t\t\t\t<p>{thumbValue}</p>\n\t\t\t\t\t\t\t</TooltipContent>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t))}\n\t\t\t\t</RadixSlider.Root>\n\t\t\t\t{showMinMax && (\n\t\t\t\t\t<div className=\"mt-2 flex w-full flex-row justify-between\">\n\t\t\t\t\t\t<p>{min}</p>\n\t\t\t\t\t\t<p>{max}</p>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t},\n);\nSlider.displayName = RadixSlider.Root.displayName;\n\nexport { Slider };\n"]}
|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E;oBAChD,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;oBACxB,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;gBACxB,CAAC,CAAC;YACH,CAAC;YACD,0DAA0D;iBACrD,IAAI,aAAa,EAAE,CAAC;gBACxB,aAAa,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC;YACzC,CAAC;QACF,CAAC;QACD,iCAAiC;aAC5B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YAC/B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;QACnE,CAAC;aAAM,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;YACrC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC;iBACvD,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,aAAa,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport type { ComponentRef } from \"react\";\nimport * as React from \"react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps {\n\tchildren?: React.ReactNode;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"/","sources":["components/slot/slot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE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,OAAO,EAAE,CAAC;YAC/B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;QACnE,CAAC;aAAM,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;YACrC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC;iBACvD,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,aAAa,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport type { ComponentRef } from \"react\";\nimport * as React from \"react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps {\n\tchildren?: React.ReactNode;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the ref>\ntype AnyRef = ComponentRef<any>;\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the ref>\ntype AnyRefAttributes = React.RefAttributes<any>;\n\nconst Slot = React.forwardRef<AnyRef, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\tif (isSlottable(children)) {\n\t\tconst slottable = children;\n\n\t\treturn (\n\t\t\t<SlotClone {...slotProps} ref={forwardedRef}>\n\t\t\t\t{React.isValidElement<React.PropsWithChildren<unknown>>(\n\t\t\t\t\tslottable.props.child,\n\t\t\t\t)\n\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\tslottable.props.child,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tslottable.props.children(slottable.props.child.props.children),\n\t\t\t\t\t\t)\n\t\t\t\t\t: null}\n\t\t\t</SlotClone>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotClone {...slotProps} ref={forwardedRef}>\n\t\t\t{children}\n\t\t</SlotClone>\n\t);\n});\n\nSlot.displayName = \"Slot\";\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n\tchildren: React.ReactNode;\n}\n\nconst SlotClone = React.forwardRef<AnyRef, SlotCloneProps>(\n\t(props, forwardedRef) => {\n\t\tconst { children, ...slotProps } = props;\n\n\t\tif (React.isValidElement<AnyRefAttributes>(children)) {\n\t\t\treturn React.cloneElement(children, {\n\t\t\t\t...mergeProps(slotProps, children.props),\n\t\t\t\tref: forwardedRef\n\t\t\t\t\t? composeRefs(forwardedRef, (children as AnyRefAttributes).ref)\n\t\t\t\t\t: (children as AnyRefAttributes).ref,\n\t\t\t});\n\t\t}\n\n\t\treturn React.Children.count(children) > 1\n\t\t\t? React.Children.only(null)\n\t\t\t: null;\n\t},\n);\n\nSlotClone.displayName = \"SlotClone\";\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\ntype SlottableProps = {\n\tchild: React.ReactNode;\n\tchildren: (child: React.ReactNode) => React.JSX.Element;\n};\n\nconst Slottable = ({ child, children }: SlottableProps) => {\n\treturn children(child);\n};\n\n/* ---------------------------------------------------------------------------------------------- */\n\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the props>\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n\tchild: React.ReactNode,\n): child is React.ReactElement<SlottableProps> {\n\treturn React.isValidElement(child) && child.type === Slottable;\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n\t// all child props should override\n\tconst overrideProps = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\tconst isHandler = /^on[A-Z]/.test(propName);\n\t\tif (isHandler) {\n\t\t\t// if the handler exists on both, we compose them\n\t\t\tif (slotPropValue && childPropValue) {\n\t\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\t\tchildPropValue(...args);\n\t\t\t\t\tslotPropValue(...args);\n\t\t\t\t};\n\t\t\t}\n\t\t\t// but if it exists only on the slot, we use only this one\n\t\t\telse if (slotPropValue) {\n\t\t\t\toverrideProps[propName] = slotPropValue;\n\t\t\t}\n\t\t}\n\t\t// if it's `style`, we merge them\n\t\telse if (propName === \"style\") {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t} else if (propName === \"className\") {\n\t\t\toverrideProps[propName] = [slotPropValue, childPropValue]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \");\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\nconst Root = Slot;\n\nexport { Root, Slot, Slottable };\nexport type { SlotProps };\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
export type TextareaProps = ComponentPropsWithoutRef<"textarea"> & {
|
|
3
|
+
error?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & {
|
|
6
|
+
error?: boolean;
|
|
7
|
+
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getVariants } from "../../utilities/get-variants/get-variants";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const textAreaStyles = getVariants({
|
|
5
|
+
base: "w-full rounded-md border border-gray-300 p-2 focus-visible:outline focus-visible:outline-gray-800",
|
|
6
|
+
variants: {
|
|
7
|
+
error: {
|
|
8
|
+
true: "border-red-600",
|
|
9
|
+
},
|
|
10
|
+
disabled: {
|
|
11
|
+
true: "disabled:cursor-not-allowed disabled:opacity-50",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
compoundVariants: [
|
|
15
|
+
{
|
|
16
|
+
error: true,
|
|
17
|
+
disabled: true,
|
|
18
|
+
className: "border-gray-400 disabled:cursor-not-allowed disabled:opacity-50",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
export const Textarea = forwardRef(({ className, error, disabled, ...props }, ref) => {
|
|
23
|
+
return (_jsx("textarea", { ref: ref, className: textAreaStyles({
|
|
24
|
+
className,
|
|
25
|
+
error,
|
|
26
|
+
disabled,
|
|
27
|
+
}), disabled: disabled, ...props }));
|
|
28
|
+
});
|
|
29
|
+
Textarea.displayName = "Textarea";
|
|
30
|
+
//# sourceMappingURL=text-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-area.js","sourceRoot":"/","sources":["components/text-area/text-area.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAMlE,MAAM,cAAc,GAAG,WAAW,CAAC;IAClC,IAAI,EAAE,mGAAmG;IACzG,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,gBAAgB;SACtB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,iDAAiD;SACvD;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EACR,iEAAiE;SAClE;KACD;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CACjC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACjD,OAAO,CACN,mBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,CAAC;YACzB,SAAS;YACT,KAAK;YACL,QAAQ;SACR,CAAC,EACF,QAAQ,EAAE,QAAQ,KACd,KAAK,GACR,CACF,CAAC;AACH,CAAC,CACD,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { getVariants } from \"@utilities/get-variants/get-variants\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nexport type TextareaProps = ComponentPropsWithoutRef<\"textarea\"> & {\n\terror?: boolean;\n};\n\nconst textAreaStyles = getVariants({\n\tbase: \"w-full rounded-md border border-gray-300 p-2 focus-visible:outline focus-visible:outline-gray-800\",\n\tvariants: {\n\t\terror: {\n\t\t\ttrue: \"border-red-600\",\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: \"disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\terror: true,\n\t\t\tdisabled: true,\n\t\t\tclassName:\n\t\t\t\t\"border-gray-400 disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t},\n\t],\n});\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\t({ className, error, disabled, ...props }, ref) => {\n\t\treturn (\n\t\t\t<textarea\n\t\t\t\tref={ref}\n\t\t\t\tclassName={textAreaStyles({\n\t\t\t\t\tclassName,\n\t\t\t\t\terror,\n\t\t\t\t\tdisabled,\n\t\t\t\t})}\n\t\t\t\tdisabled={disabled}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nTextarea.displayName = \"Textarea\";\n"]}
|
|
@@ -15,8 +15,8 @@ import { Button } from "../button/button";
|
|
|
15
15
|
const toast = (toast) => {
|
|
16
16
|
const { title, description, button, ...toastOptions } = toast;
|
|
17
17
|
return sonnerToast.custom((id) => (_jsx(Toast, { id: id, title: title, description: description, button: {
|
|
18
|
-
label:
|
|
19
|
-
onClick:
|
|
18
|
+
label: button.label,
|
|
19
|
+
onClick: button.onClick,
|
|
20
20
|
}, ...toastOptions })));
|
|
21
21
|
};
|
|
22
22
|
const Toaster = SonnerToaster;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sourceRoot":"/","sources":["components/toast/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EACN,OAAO,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"/","sources":["components/toast/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EACN,OAAO,IAAI,aAAa,EACxB,KAAK,IAAI,WAAW,GAEpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAY1C;;;;;;;;;GASG;AACH,MAAM,KAAK,GAAG,CAAC,KAA6B,EAAE,EAAE;IAC/C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAC9D,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CACjC,KAAC,KAAK,IACL,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;YACP,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;SACvB,KACG,YAAY,GACf,CACF,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC;AAE9B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAEhC,mDAAmD;AACnD,MAAM,KAAK,GAAG,UAAU,CACvB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3C,OAAO,CACN,eACC,SAAS,EAAC,kGAAkG,EAC5G,GAAG,EAAE,GAAG,aAER,cAAK,SAAS,EAAC,0BAA0B,YACxC,eAAK,SAAS,EAAC,cAAc,aAC5B,YAAG,SAAS,EAAC,mCAAmC,YAAE,KAAK,GAAK,EAC5D,YAAG,SAAS,EAAC,uBAAuB,YAAE,WAAW,GAAK,IACjD,GACD,EACN,cAAK,SAAS,EAAC,yCAAyC,YACvD,KAAC,MAAM,IACN,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE;wBACb,MAAM,CAAC,OAAO,EAAE,CAAC;wBACjB,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBACzB,CAAC,YAEA,MAAM,CAAC,KAAK,GACL,GACJ,IACD,CACN,CAAC;AACH,CAAC,CACD,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { forwardRef } from \"react\";\nimport {\n\tToaster as SonnerToaster,\n\ttoast as sonnerToast,\n\ttype ToasterProps,\n} from \"sonner\";\nimport { Button } from \"../button/button\";\n\nexport type ToastProps = {\n\tid: string | number;\n\ttitle: string;\n\tdescription: string;\n\tbutton: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n} & ToasterProps;\n\n/**\n * Creates a custom toast notification using the sonner toast library\n * @param toast - The toast configuration object without an ID\n * @param toast.title - The title text to display in the toast\n * @param toast.description - The description text to display in the toast\n * @param toast.button - Configuration for the toast's action button\n * @param toast.button.label - The text label for the action button\n * @param toast.button.onClick - Click handler function for the action button\n * @returns A unique identifier for the created toast\n */\nconst toast = (toast: Omit<ToastProps, \"id\">) => {\n\tconst { title, description, button, ...toastOptions } = toast;\n\treturn sonnerToast.custom((id) => (\n\t\t<Toast\n\t\t\tid={id}\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tbutton={{\n\t\t\t\tlabel: button.label,\n\t\t\t\tonClick: button.onClick,\n\t\t\t}}\n\t\t\t{...toastOptions}\n\t\t/>\n\t));\n};\n\nconst Toaster = SonnerToaster;\n\nToaster.displayName = \"Toaster\";\n\n/** A fully custom toast built on top of sonner. */\nconst Toast = forwardRef<HTMLDivElement, ToastProps>(\n\t({ title, description, button, id }, ref) => {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName=\"flex w-full items-center gap-4 rounded-lg bg-white p-4 shadow-lg ring-1 ring-black/5 md:max-w-96\"\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<div className=\"flex flex-1 items-center\">\n\t\t\t\t\t<div className=\"w-full gap-1\">\n\t\t\t\t\t\t<p className=\"font-medium text-gray-900 text-sm\">{title}</p>\n\t\t\t\t\t\t<p className=\"text-gray-500 text-sm\">{description}</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"shrink-0 rounded-md font-medium text-sm\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tbutton.onClick();\n\t\t\t\t\t\t\tsonnerToast.dismiss(id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{button.label}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t},\n);\n\nToast.displayName = \"Toast\";\n\nexport { toast, Toast, Toaster };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "./components/accordion/accordion";
|
|
2
1
|
export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, } from "./components/accordion/accordion";
|
|
3
|
-
export {
|
|
2
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "./components/accordion/accordion";
|
|
4
3
|
export type { AlertDescriptionProps, AlertProps, AlertTitleProps, } from "./components/alert/alert";
|
|
4
|
+
export { Alert, AlertDescription, AlertTitle } from "./components/alert/alert";
|
|
5
5
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogTitle, AlertDialogTrigger, } from "./components/alert-dialog/alert-dialog";
|
|
6
6
|
export { Avatar, AvatarFallback, AvatarImage } from "./components/avatar/avatar";
|
|
7
|
-
export { AvatarGroup } from "./components/avatar/avatar-group";
|
|
8
7
|
export type { AvatarGroupProps } from "./components/avatar/avatar-group";
|
|
9
|
-
export {
|
|
8
|
+
export { AvatarGroup } from "./components/avatar/avatar-group";
|
|
10
9
|
export type { BadgeProps } from "./components/badge/badge";
|
|
11
|
-
export {
|
|
10
|
+
export { Badge } from "./components/badge/badge";
|
|
12
11
|
export type { ButtonProps } from "./components/button/button";
|
|
13
|
-
export {
|
|
12
|
+
export { Button } from "./components/button/button";
|
|
14
13
|
export type { CardContentProps, CardFooterProps, CardHeaderProps, CardProps, } from "./components/card/card";
|
|
15
|
-
export {
|
|
14
|
+
export { Card, CardContent, CardFooter, CardHeader, } from "./components/card/card";
|
|
16
15
|
export type { CheckboxProps } from "./components/checkbox/checkbox";
|
|
16
|
+
export { Checkbox } from "./components/checkbox/checkbox";
|
|
17
17
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./components/dialog/dialog";
|
|
18
18
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "./components/drawer/drawer";
|
|
19
|
-
export { DropdownMenu,
|
|
20
|
-
export { getVariants } from "./utilities/get-variants/get-variants";
|
|
21
|
-
export type { ResponsiveValue } from "./utilities/responsive/responsive";
|
|
22
|
-
export { Label } from "./components/label/label";
|
|
23
|
-
export type { LabelProps } from "./components/label/label";
|
|
24
|
-
export { Input } from "./components/input/input";
|
|
19
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./components/dropdown-menu/dropdown-menu";
|
|
25
20
|
export type { InputProps } from "./components/input/input";
|
|
26
|
-
export {
|
|
21
|
+
export { Input } from "./components/input/input";
|
|
22
|
+
export type { LabelProps } from "./components/label/label";
|
|
23
|
+
export { Label } from "./components/label/label";
|
|
27
24
|
export type { PaginationItemProps, PaginationProps, } from "./components/pagination/pagination";
|
|
28
|
-
export {
|
|
25
|
+
export { Pagination, PaginationItem, PaginationNext, PaginationPrev, } from "./components/pagination/pagination";
|
|
29
26
|
export type { PopoverContentProps, PopoverProps, } from "./components/popover/popover";
|
|
30
|
-
export {
|
|
27
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, } from "./components/popover/popover";
|
|
31
28
|
export type { ProgressProps } from "./components/progress/progress";
|
|
29
|
+
export { Progress } from "./components/progress/progress";
|
|
32
30
|
export { RadioGroup, RadioGroupItem, } from "./components/radio-group/radio-group";
|
|
33
31
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from "./components/select/select";
|
|
34
32
|
export { Skeleton } from "./components/skeleton/skeleton";
|
|
35
|
-
export { Slider } from "./components/slider/slider";
|
|
36
33
|
export type { SliderProps } from "./components/slider/slider";
|
|
37
|
-
export {
|
|
34
|
+
export { Slider } from "./components/slider/slider";
|
|
38
35
|
export type { SwitchProps } from "./components/switch/switch";
|
|
36
|
+
export { Switch } from "./components/switch/switch";
|
|
37
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "./components/table/table";
|
|
39
38
|
export { Tabs, TabsContent, TabsList, TabsTrigger, } from "./components/tabs/tabs";
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
39
|
+
export type { TextareaProps } from "./components/text-area/text-area";
|
|
40
|
+
export { Textarea } from "./components/text-area/text-area";
|
|
42
41
|
export type { ToastProps } from "./components/toast/toast";
|
|
43
|
-
export {
|
|
42
|
+
export { Toast, Toaster, toast, } from "./components/toast/toast";
|
|
44
43
|
export type { TooltipProps } from "./components/tooltip/tooltip";
|
|
44
|
+
export { Tooltip, TooltipContent, TooltipTrigger, } from "./components/tooltip/tooltip";
|
|
45
|
+
export { getVariants } from "./utilities/get-variants/get-variants";
|
|
46
|
+
export type { ResponsiveValue } from "./utilities/responsive/responsive";
|
package/dist/index.js
CHANGED
|
@@ -9,10 +9,9 @@ export { Card, CardContent, CardFooter, CardHeader, } from "./components/card/ca
|
|
|
9
9
|
export { Checkbox } from "./components/checkbox/checkbox";
|
|
10
10
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./components/dialog/dialog";
|
|
11
11
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "./components/drawer/drawer";
|
|
12
|
-
export { DropdownMenu,
|
|
13
|
-
export { getVariants } from "./utilities/get-variants/get-variants";
|
|
14
|
-
export { Label } from "./components/label/label";
|
|
12
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./components/dropdown-menu/dropdown-menu";
|
|
15
13
|
export { Input } from "./components/input/input";
|
|
14
|
+
export { Label } from "./components/label/label";
|
|
16
15
|
export { Pagination, PaginationItem, PaginationNext, PaginationPrev, } from "./components/pagination/pagination";
|
|
17
16
|
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, } from "./components/popover/popover";
|
|
18
17
|
export { Progress } from "./components/progress/progress";
|
|
@@ -21,8 +20,10 @@ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScro
|
|
|
21
20
|
export { Skeleton } from "./components/skeleton/skeleton";
|
|
22
21
|
export { Slider } from "./components/slider/slider";
|
|
23
22
|
export { Switch } from "./components/switch/switch";
|
|
23
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "./components/table/table";
|
|
24
24
|
export { Tabs, TabsContent, TabsList, TabsTrigger, } from "./components/tabs/tabs";
|
|
25
|
-
export {
|
|
25
|
+
export { Textarea } from "./components/text-area/text-area";
|
|
26
26
|
export { Toast, Toaster, toast, } from "./components/toast/toast";
|
|
27
27
|
export { Tooltip, TooltipContent, TooltipTrigger, } from "./components/tooltip/tooltip";
|
|
28
|
+
export { getVariants } from "./utilities/get-variants/get-variants";
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEhF,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ACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,WAAW,GACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EACN,KAAK,EACL,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,GACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EACN,KAAK,EACL,OAAO,EACP,KAAK,GACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,OAAO,EACP,cAAc,EACd,cAAc,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC","sourcesContent":["export type {\n\tAccordionContentProps,\n\tAccordionItemProps,\n\tAccordionProps,\n\tAccordionTriggerProps,\n} from \"@components/accordion/accordion\";\nexport {\n\tAccordion,\n\tAccordionContent,\n\tAccordionItem,\n\tAccordionTrigger,\n} from \"@components/accordion/accordion\";\nexport type {\n\tAlertDescriptionProps,\n\tAlertProps,\n\tAlertTitleProps,\n} from \"@components/alert/alert\";\nexport { Alert, AlertDescription, AlertTitle } from \"@components/alert/alert\";\nexport {\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogOverlay,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n} from \"@components/alert-dialog/alert-dialog\";\nexport { Avatar, AvatarFallback, AvatarImage } from \"@components/avatar/avatar\";\nexport type { AvatarGroupProps } from \"@components/avatar/avatar-group\";\nexport { AvatarGroup } from \"@components/avatar/avatar-group\";\nexport type { BadgeProps } from \"@components/badge/badge\";\nexport { Badge } from \"@components/badge/badge\";\nexport type { ButtonProps } from \"@components/button/button\";\nexport { Button } from \"@components/button/button\";\nexport type {\n\tCardContentProps,\n\tCardFooterProps,\n\tCardHeaderProps,\n\tCardProps,\n} from \"@components/card/card\";\nexport {\n\tCard,\n\tCardContent,\n\tCardFooter,\n\tCardHeader,\n} from \"@components/card/card\";\nexport type { CheckboxProps } from \"@components/checkbox/checkbox\";\nexport { Checkbox } from \"@components/checkbox/checkbox\";\nexport {\n\tDialog,\n\tDialogClose,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogTitle,\n\tDialogTrigger,\n} from \"@components/dialog/dialog\";\nexport {\n\tDrawer,\n\tDrawerClose,\n\tDrawerContent,\n\tDrawerDescription,\n\tDrawerFooter,\n\tDrawerHeader,\n\tDrawerTitle,\n\tDrawerTrigger,\n} from \"@components/drawer/drawer\";\nexport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n} from \"@components/dropdown-menu/dropdown-menu\";\nexport type { InputProps } from \"@components/input/input\";\nexport { Input } from \"@components/input/input\";\nexport type { LabelProps } from \"@components/label/label\";\nexport { Label } from \"@components/label/label\";\nexport type {\n\tPaginationItemProps,\n\tPaginationProps,\n} from \"@components/pagination/pagination\";\nexport {\n\tPagination,\n\tPaginationItem,\n\tPaginationNext,\n\tPaginationPrev,\n} from \"@components/pagination/pagination\";\nexport type {\n\tPopoverContentProps,\n\tPopoverProps,\n} from \"@components/popover/popover\";\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverPortal,\n\tPopoverTrigger,\n} from \"@components/popover/popover\";\nexport type { ProgressProps } from \"@components/progress/progress\";\nexport { Progress } from \"@components/progress/progress\";\nexport {\n\tRadioGroup,\n\tRadioGroupItem,\n} from \"@components/radio-group/radio-group\";\nexport {\n\tSelect,\n\tSelectContent,\n\tSelectGroup,\n\tSelectItem,\n\tSelectLabel,\n\tSelectScrollDownButton,\n\tSelectScrollUpButton,\n\tSelectSeparator,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@components/select/select\";\nexport { Skeleton } from \"@components/skeleton/skeleton\";\nexport type { SliderProps } from \"@components/slider/slider\";\nexport { Slider } from \"@components/slider/slider\";\nexport type { SwitchProps } from \"@components/switch/switch\";\nexport { Switch } from \"@components/switch/switch\";\nexport {\n\tTable,\n\tTableBody,\n\tTableCaption,\n\tTableCell,\n\tTableFooter,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n} from \"@components/table/table\";\nexport {\n\tTabs,\n\tTabsContent,\n\tTabsList,\n\tTabsTrigger,\n} from \"@components/tabs/tabs\";\nexport type { TextareaProps } from \"@components/text-area/text-area\";\nexport { Textarea } from \"@components/text-area/text-area\";\nexport type { ToastProps } from \"@components/toast/toast\";\nexport {\n\tToast,\n\tToaster,\n\ttoast,\n} from \"@components/toast/toast\";\nexport type { TooltipProps } from \"@components/tooltip/tooltip\";\nexport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipTrigger,\n} from \"@components/tooltip/tooltip\";\nexport { getVariants } from \"@utilities/get-variants/get-variants\";\nexport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\n"]}
|
|
@@ -1,56 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type VariantPropValue<T> = T extends BooleanVariant ? ResponsiveValue<boolean> | undefined : T extends Record<string, unknown> ? ResponsiveValue<keyof T> : never;
|
|
7
|
-
type VariantProps<T extends VariantConfig> = {
|
|
8
|
-
[K in keyof T]: VariantPropValue<T[K]>;
|
|
9
|
-
} & {
|
|
10
|
-
className?: string;
|
|
11
|
-
};
|
|
12
|
-
type ResponsiveClassesConfig<T extends VariantConfig> = {
|
|
1
|
+
export declare const getVariants: <T extends {
|
|
2
|
+
[x: string]: {
|
|
3
|
+
[x: string]: string;
|
|
4
|
+
};
|
|
5
|
+
}>(config: {
|
|
13
6
|
base: string;
|
|
14
|
-
variants?: T;
|
|
15
|
-
compoundVariants?: Partial<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @param config - Configuration object for variants
|
|
23
|
-
* @param config.base - Base classes that are always applied
|
|
24
|
-
* @param config.variants - Object containing variant definitions where each key is a variant name
|
|
25
|
-
* and value is either a string of class names, an object mapping variant values to class names,
|
|
26
|
-
* or an object with true/false keys for boolean variants
|
|
27
|
-
* @param config.compoundVariants - Optional array of compound variants that apply additional classes
|
|
28
|
-
* when multiple variants have specific values
|
|
29
|
-
*
|
|
30
|
-
* @returns A function that accepts variant props and returns classes with twMerge
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* const getButtonVariants = getVariants({
|
|
34
|
-
* base: "px-4 py-2 rounded",
|
|
35
|
-
* variants: {
|
|
36
|
-
* intent: {
|
|
37
|
-
* primary: "bg-blue-500 text-white",
|
|
38
|
-
* secondary: "bg-gray-200 text-gray-800"
|
|
39
|
-
* },
|
|
40
|
-
* size: {
|
|
41
|
-
* sm: "text-sm",
|
|
42
|
-
* lg: "text-lg"
|
|
43
|
-
* },
|
|
44
|
-
* disabled: {
|
|
45
|
-
* true: "opacity-50 cursor-not-allowed"
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
|
-
* });
|
|
49
|
-
*
|
|
50
|
-
* // Usage:
|
|
51
|
-
* getButtonVariants({ intent: "primary", size: "lg", disabled: true })
|
|
52
|
-
* // Or with responsive values:
|
|
53
|
-
* getButtonVariants({ intent: { initial: "primary", md: "secondary" } })
|
|
54
|
-
*/
|
|
55
|
-
export declare const getVariants: <T extends VariantConfig>({ base, variants, compoundVariants, }: ResponsiveClassesConfig<T>) => ({ className, ...props }: VariantProps<T>) => string;
|
|
56
|
-
export {};
|
|
7
|
+
variants?: T | undefined;
|
|
8
|
+
compoundVariants?: Partial<{ [K in keyof T]: T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", string>> ? import("responsive-class-variants").ResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? import("responsive-class-variants").ResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never; } & {
|
|
9
|
+
className?: string;
|
|
10
|
+
}>[] | undefined;
|
|
11
|
+
onComplete?: (classes: string) => string;
|
|
12
|
+
}) => ({ className, ...props }: { [K in keyof T]: T[K] extends infer T_2 ? T_2 extends T[K] ? T_2 extends Partial<Record<"true" | "false", string>> ? import("responsive-class-variants").ResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_2 extends Record<string, unknown> ? import("responsive-class-variants").ResponsiveValue<keyof T_2, "sm" | "md" | "lg" | "xl"> : never : never : never; } & {
|
|
13
|
+
className?: string;
|
|
14
|
+
}) => string;
|
|
@@ -1,80 +1,4 @@
|
|
|
1
1
|
import { cn } from "../cn/cn";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @template T - Type extending VariantConfig (Record of variant names to their possible values and corresponding classes)
|
|
6
|
-
*
|
|
7
|
-
* @param config - Configuration object for variants
|
|
8
|
-
* @param config.base - Base classes that are always applied
|
|
9
|
-
* @param config.variants - Object containing variant definitions where each key is a variant name
|
|
10
|
-
* and value is either a string of class names, an object mapping variant values to class names,
|
|
11
|
-
* or an object with true/false keys for boolean variants
|
|
12
|
-
* @param config.compoundVariants - Optional array of compound variants that apply additional classes
|
|
13
|
-
* when multiple variants have specific values
|
|
14
|
-
*
|
|
15
|
-
* @returns A function that accepts variant props and returns classes with twMerge
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* const getButtonVariants = getVariants({
|
|
19
|
-
* base: "px-4 py-2 rounded",
|
|
20
|
-
* variants: {
|
|
21
|
-
* intent: {
|
|
22
|
-
* primary: "bg-blue-500 text-white",
|
|
23
|
-
* secondary: "bg-gray-200 text-gray-800"
|
|
24
|
-
* },
|
|
25
|
-
* size: {
|
|
26
|
-
* sm: "text-sm",
|
|
27
|
-
* lg: "text-lg"
|
|
28
|
-
* },
|
|
29
|
-
* disabled: {
|
|
30
|
-
* true: "opacity-50 cursor-not-allowed"
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // Usage:
|
|
36
|
-
* getButtonVariants({ intent: "primary", size: "lg", disabled: true })
|
|
37
|
-
* // Or with responsive values:
|
|
38
|
-
* getButtonVariants({ intent: { initial: "primary", md: "secondary" } })
|
|
39
|
-
*/
|
|
40
|
-
export const getVariants = ({ base, variants, compoundVariants, }) => ({ className, ...props }) => {
|
|
41
|
-
const responsiveClasses = Object.entries(props)
|
|
42
|
-
.map(([key, propValue]) => {
|
|
43
|
-
const variant = variants?.[key];
|
|
44
|
-
const value = typeof propValue === "boolean" ? String(propValue) : propValue;
|
|
45
|
-
// Handle undefined values
|
|
46
|
-
if (!value)
|
|
47
|
-
return undefined;
|
|
48
|
-
const variantValue = variant?.[value];
|
|
49
|
-
// Handle string values
|
|
50
|
-
if (typeof variantValue === "string") {
|
|
51
|
-
return variantValue;
|
|
52
|
-
}
|
|
53
|
-
// Handle responsive values
|
|
54
|
-
return Object.entries(value)
|
|
55
|
-
.map(([breakpoint, value]) => {
|
|
56
|
-
// If the breakpoint is initial, return the variant value without breakpoint prefix
|
|
57
|
-
if (breakpoint === "initial") {
|
|
58
|
-
return variants?.[key]?.[value];
|
|
59
|
-
}
|
|
60
|
-
// Otherwise, return the variant value with the breakpoint prefix
|
|
61
|
-
return variants?.[key]?.[value]
|
|
62
|
-
?.split(" ")
|
|
63
|
-
.map((className) => `${breakpoint}:${className}`)
|
|
64
|
-
.join(" ");
|
|
65
|
-
})
|
|
66
|
-
.join(" ");
|
|
67
|
-
})
|
|
68
|
-
.filter(Boolean)
|
|
69
|
-
.join(" ");
|
|
70
|
-
const compoundClasses = compoundVariants
|
|
71
|
-
?.map(({ className, ...compound }) => {
|
|
72
|
-
if (Object.entries(compound).every(([key, value]) => props[key] === String(value) || props[key] === value)) {
|
|
73
|
-
return className;
|
|
74
|
-
}
|
|
75
|
-
return undefined;
|
|
76
|
-
})
|
|
77
|
-
.filter(Boolean);
|
|
78
|
-
return cn(base, responsiveClasses, compoundClasses, className);
|
|
79
|
-
};
|
|
2
|
+
import { createRcv } from "responsive-class-variants";
|
|
3
|
+
export const getVariants = createRcv(["sm", "md", "lg", "xl"], (classes) => cn(classes));
|
|
80
4
|
//# sourceMappingURL=get-variants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-variants.js","sourceRoot":"/","sources":["utilities/get-variants/get-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-variants.js","sourceRoot":"/","sources":["utilities/get-variants/get-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAC1E,EAAE,CAAC,OAAO,CAAC,CACX,CAAC","sourcesContent":["import { cn } from \"@utilities/cn/cn\";\nimport { createRcv } from \"responsive-class-variants\";\n\nexport const getVariants = createRcv([\"sm\", \"md\", \"lg\", \"xl\"], (classes) =>\n\tcn(classes),\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-truncated-elements.js","sourceRoot":"/","sources":["utilities/pagination/get-truncated-elements.tsx"],"names":[],"mappings":";AAAA,OAAO,EACN,cAAc,GAEd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,QAAQ,
|
|
1
|
+
{"version":3,"file":"get-truncated-elements.js","sourceRoot":"/","sources":["utilities/pagination/get-truncated-elements.tsx"],"names":[],"mappings":";AAAA,OAAO,EACN,cAAc,GAEd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,QAAQ,EACR,cAAc,GAGd,MAAM,OAAO,CAAC;AAOf,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACpC,IAAI,EACJ,QAAQ,GACkB,EAAE,EAAE;IAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CACtC,CAAC,EAAE,EAA2C,EAAE,CAC/C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,cAAc,CACjD,CAAC;IAEF,IAAI,eAAe,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YACtC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBAChE,MAAM,UAAU,GACf,QAAQ;qBACN,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;qBACf,MAAM,CACN,CAAC,EAAE,EAA2C,EAAE,CAC/C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,cAAc,CACjD,CAAC,MAAM,GAAG,CAAC,CAAC;gBACf,MAAM,YAAY,GAAG,OAA4C,CAAC;gBAClE,OAAO,CAC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C,MAAM,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QACvC,IACC,CAAC,cAAc,CAAC,OAAO,CAAC;YACxB,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAC3D,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;QACD,YAAY,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC","sourcesContent":["import {\n\tPaginationItem,\n\ttype PaginationItemProps,\n} from \"@components/pagination/pagination\";\nimport {\n\tChildren,\n\tisValidElement,\n\ttype ReactElement,\n\ttype ReactNode,\n} from \"react\";\n\ntype TruncatedElementsOptions = {\n\tpage: number;\n\tchildren: ReactNode;\n};\n\nexport const getTruncatedElements = ({\n\tpage,\n\tchildren,\n}: TruncatedElementsOptions) => {\n\tconst elements = Children.toArray(children);\n\tconst paginationItems = elements.filter(\n\t\t(el): el is ReactElement<PaginationItemProps> =>\n\t\t\tisValidElement(el) && el.type === PaginationItem,\n\t);\n\n\tif (paginationItems.length <= 7) {\n\t\treturn elements.map((element, index) => {\n\t\t\tif (isValidElement(element) && element.type === PaginationItem) {\n\t\t\t\tconst pageNumber =\n\t\t\t\t\telements\n\t\t\t\t\t\t.slice(0, index)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(el): el is ReactElement<PaginationItemProps> =>\n\t\t\t\t\t\t\t\tisValidElement(el) && el.type === PaginationItem,\n\t\t\t\t\t\t).length + 1;\n\t\t\t\tconst elementProps = element as ReactElement<PaginationItemProps>;\n\t\t\t\treturn (\n\t\t\t\t\t<PaginationItem\n\t\t\t\t\t\tkey={`pagination-item-${pageNumber}`}\n\t\t\t\t\t\tindex={pageNumber}\n\t\t\t\t\t>\n\t\t\t\t\t\t{elementProps.props.children}\n\t\t\t\t\t</PaginationItem>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn element;\n\t\t});\n\t}\n\n\tconst result: ReactNode[] = [];\n\tlet currentIndex = 0;\n\n\t// Add non-PaginationItem elements at the start\n\twhile (currentIndex < elements.length) {\n\t\tconst element = elements[currentIndex];\n\t\tif (\n\t\t\t!isValidElement(element) ||\n\t\t\t(isValidElement(element) && element.type !== PaginationItem)\n\t\t) {\n\t\t\tresult.push(element);\n\t\t\tcurrentIndex++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Always show first 4 pages when in that range\n\tif (page <= 4) {\n\t\t// Show first 4 pages\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst item = paginationItems[i];\n\t\t\tif (item) {\n\t\t\t\tresult.push(\n\t\t\t\t\t<PaginationItem key={`pagination-item-${i + 1}`} index={i + 1}>\n\t\t\t\t\t\t{item.props.children}\n\t\t\t\t\t</PaginationItem>,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (paginationItems.length > 4) {\n\t\t\tresult.push(\n\t\t\t\t<span\n\t\t\t\t\tkey=\"end-ellipsis\"\n\t\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center text-gray-500\"\n\t\t\t\t>\n\t\t\t\t\t...\n\t\t\t\t</span>,\n\t\t\t);\n\t\t\t// Show last page\n\t\t\tconst lastItem = paginationItems[paginationItems.length - 1];\n\t\t\tif (lastItem) {\n\t\t\t\tresult.push(\n\t\t\t\t\t<PaginationItem\n\t\t\t\t\t\tkey={`pagination-item-${paginationItems.length}`}\n\t\t\t\t\t\tindex={paginationItems.length}\n\t\t\t\t\t>\n\t\t\t\t\t\t{lastItem.props.children}\n\t\t\t\t\t</PaginationItem>,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\t// Always show last 4 pages when in that range\n\telse if (page > paginationItems.length - 4) {\n\t\t// Show first page\n\t\tconst firstItem = paginationItems[0];\n\t\tif (firstItem) {\n\t\t\tresult.push(\n\t\t\t\t<PaginationItem key=\"pagination-item-1\" index={1}>\n\t\t\t\t\t{firstItem.props.children}\n\t\t\t\t</PaginationItem>,\n\t\t\t);\n\t\t}\n\t\tresult.push(\n\t\t\t<span\n\t\t\t\tkey=\"start-ellipsis\"\n\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center text-gray-500\"\n\t\t\t>\n\t\t\t\t...\n\t\t\t</span>,\n\t\t);\n\t\t// Show last 4 pages\n\t\tfor (let i = paginationItems.length - 4; i < paginationItems.length; i++) {\n\t\t\tconst item = paginationItems[i];\n\t\t\tif (item) {\n\t\t\t\tresult.push(\n\t\t\t\t\t<PaginationItem key={`pagination-item-${i + 1}`} index={i + 1}>\n\t\t\t\t\t\t{item.props.children}\n\t\t\t\t\t</PaginationItem>,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\t// Show truncated view for middle pages\n\telse {\n\t\t// Show first page\n\t\tconst firstItem = paginationItems[0];\n\t\tif (firstItem) {\n\t\t\tresult.push(\n\t\t\t\t<PaginationItem key=\"pagination-item-1\" index={1}>\n\t\t\t\t\t{firstItem.props.children}\n\t\t\t\t</PaginationItem>,\n\t\t\t);\n\t\t}\n\n\t\tresult.push(\n\t\t\t<span\n\t\t\t\tkey=\"start-ellipsis\"\n\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center text-gray-500\"\n\t\t\t>\n\t\t\t\t...\n\t\t\t</span>,\n\t\t);\n\n\t\t// Show 5 pages with current page in middle\n\t\tfor (let i = page - 2; i <= page + 2; i++) {\n\t\t\tif (i > 1 && i < paginationItems.length) {\n\t\t\t\tconst item = paginationItems[i - 1];\n\t\t\t\tif (item) {\n\t\t\t\t\tresult.push(\n\t\t\t\t\t\t<PaginationItem key={`pagination-item-${i}`} index={i}>\n\t\t\t\t\t\t\t{item.props.children}\n\t\t\t\t\t\t</PaginationItem>,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tresult.push(\n\t\t\t<span\n\t\t\t\tkey=\"end-ellipsis\"\n\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center text-gray-500\"\n\t\t\t>\n\t\t\t\t...\n\t\t\t</span>,\n\t\t);\n\n\t\tconst lastItem = paginationItems[paginationItems.length - 1];\n\t\tif (lastItem) {\n\t\t\tresult.push(\n\t\t\t\t<PaginationItem\n\t\t\t\t\tkey={`pagination-item-${paginationItems.length}`}\n\t\t\t\t\tindex={paginationItems.length}\n\t\t\t\t>\n\t\t\t\t\t{lastItem.props.children}\n\t\t\t\t</PaginationItem>,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Add remaining non-PaginationItem elements\n\twhile (currentIndex < elements.length) {\n\t\tconst element = elements[currentIndex];\n\t\tif (\n\t\t\t!isValidElement(element) ||\n\t\t\t(isValidElement(element) && element.type !== PaginationItem)\n\t\t) {\n\t\t\tresult.push(element);\n\t\t}\n\t\tcurrentIndex++;\n\t}\n\n\treturn result;\n};\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import type { BreakpointsMap as RcvBreakpointsMap, ResponsiveValue as RcvResponsiveValue } from "responsive-class-variants";
|
|
1
2
|
export type Breakpoints = "sm" | "md" | "lg" | "xl";
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
} & Partial<{
|
|
5
|
-
[breakpoint in Breakpoints]: V;
|
|
6
|
-
}>;
|
|
7
|
-
export type ResponsiveValue<T> = T | BreakpointsMap<T>;
|
|
3
|
+
export type ResponsiveValue<T> = RcvResponsiveValue<T, Breakpoints>;
|
|
4
|
+
export type BreakpointsMap<V> = RcvBreakpointsMap<V, Breakpoints>;
|
|
8
5
|
/**
|
|
9
6
|
* Maps a ResponsiveValue to a new ResponsiveValue using the provided mapper function. Singular values are passed through as is.
|
|
10
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsive.js","sourceRoot":"/","sources":["utilities/responsive/responsive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"responsive.js","sourceRoot":"/","sources":["utilities/responsive/responsive.ts"],"names":[],"mappings":"AAWA,MAAM,eAAe,GAAG,CAAI,KAAyB,EAAc,EAAE,CACpE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAE1B,MAAM,gBAAgB,GAAG,CACxB,KAAyB,EACI,EAAE,CAC/B,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,KAAyB,EACzB,MAAuB,EACF,EAAE,CACvB,eAAe,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IACf,CAAC,CAAE,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAClD,UAAU;QACV,MAAM,CAAC,KAAK,CAAC;KACb,CAAC,CACoB,CAAC","sourcesContent":["import type {\n\tBreakpointsMap as RcvBreakpointsMap,\n\tResponsiveValue as RcvResponsiveValue,\n} from \"responsive-class-variants\";\n\nexport type Breakpoints = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport type ResponsiveValue<T> = RcvResponsiveValue<T, Breakpoints>;\n\nexport type BreakpointsMap<V> = RcvBreakpointsMap<V, Breakpoints>;\n\nconst isSingularValue = <A>(value: ResponsiveValue<A>): value is A =>\n\t!isBreakpointsMap(value);\n\nconst isBreakpointsMap = <A>(\n\tvalue: ResponsiveValue<A>,\n): value is BreakpointsMap<A> =>\n\ttypeof value === \"object\" && value != null && !Array.isArray(value);\n\n/**\n * Maps a ResponsiveValue to a new ResponsiveValue using the provided mapper function. Singular values are passed through as is.\n *\n * @template V The type of the original value\n * @template T The type of the mapped value\n * @param {ResponsiveValue<V>} value - The original ResponsiveValue to be mapped\n * @param {function(V): T} mapper - A function that maps a ResponsiveValue to a new ResponsiveValue\n * @returns {ResponsiveValue<T>} A new ResponsiveValue with the mapped values\n *\n *\n * @example\n * const sizes = {\n * initial: 'md',\n * sm: 'lg',\n * }\n *\n * const output = mapResponsiveValue(sizes, size => {\n *\tswitch (size) {\n *\t\tcase 'initial':\n *\t\treturn 'sm';\n *\t\tcase 'sm':\n *\t\t\treturn 'md';\n *\t\t}\n *\t});\n *\n * // console.log(output)\n * {\n *\tinitial: 'sm',\n *\tsm: 'md',\n * }\n */\nexport const mapResponsiveValue = <V, T>(\n\tvalue: ResponsiveValue<V>,\n\tmapper: (value: V) => T,\n): ResponsiveValue<T> =>\n\tisSingularValue(value)\n\t\t? mapper(value)\n\t\t: (Object.fromEntries(\n\t\t\t\tObject.entries(value).map(([breakpoint, value]) => [\n\t\t\t\t\tbreakpoint,\n\t\t\t\t\tmapper(value),\n\t\t\t\t]),\n\t\t\t) as BreakpointsMap<T>);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luan-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A UI library for React",
|
|
5
5
|
"author": "benebene84 <benedikt.sperl@gmail.com> (https://github.com/benebene84)",
|
|
6
6
|
"main": "/dist/index.js",
|
|
@@ -33,32 +33,30 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/benebene84/luan-ui#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@biomejs/biome": "
|
|
36
|
+
"@biomejs/biome": "2.0.0",
|
|
37
37
|
"@chromatic-com/storybook": "^4.0.0",
|
|
38
|
-
"@storybook/addon-docs": "^9.0.
|
|
39
|
-
"@storybook/addon-onboarding": "^9.0.
|
|
40
|
-
"@storybook/
|
|
41
|
-
"@
|
|
42
|
-
"@tailwindcss/
|
|
38
|
+
"@storybook/addon-docs": "^9.0.12",
|
|
39
|
+
"@storybook/addon-onboarding": "^9.0.10",
|
|
40
|
+
"@storybook/react-vite": "^9.0.12",
|
|
41
|
+
"@tailwindcss/postcss": "^4.1.10",
|
|
42
|
+
"@tailwindcss/vite": "^4.1.10",
|
|
43
43
|
"@testing-library/dom": "^10.4.0",
|
|
44
44
|
"@testing-library/jest-dom": "^6.6.3",
|
|
45
45
|
"@testing-library/react": "^16.3.0",
|
|
46
46
|
"@testing-library/user-event": "^14.6.1",
|
|
47
|
-
"@types/node": "^
|
|
48
|
-
"@types/react": "^19.1.
|
|
49
|
-
"@types/react-dom": "^19.1.
|
|
50
|
-
"@vitejs/plugin-react": "^4.5.
|
|
51
|
-
"css-loader": "^7.1.2",
|
|
47
|
+
"@types/node": "^24.0.3",
|
|
48
|
+
"@types/react": "^19.1.8",
|
|
49
|
+
"@types/react-dom": "^19.1.6",
|
|
50
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
52
51
|
"jsdom": "^26.1.0",
|
|
53
|
-
"lefthook": "^1.11.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"style-loader": "^4.0.0",
|
|
58
|
-
"tailwindcss": "^4.1.7",
|
|
52
|
+
"lefthook": "^1.11.14",
|
|
53
|
+
"responsive-class-variants": "^1.0.1",
|
|
54
|
+
"storybook": "^9.0.12",
|
|
55
|
+
"tailwindcss": "^4.1.10",
|
|
59
56
|
"tsc-alias": "^1.8.16",
|
|
60
57
|
"typescript": "^5.8.3",
|
|
61
|
-
"
|
|
58
|
+
"vite": "^6.3.5",
|
|
59
|
+
"vitest": "^3.2.4"
|
|
62
60
|
},
|
|
63
61
|
"peerDependencies": {
|
|
64
62
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -69,8 +67,8 @@
|
|
|
69
67
|
"@radix-ui/react-icons": "^1.3.2",
|
|
70
68
|
"clsx": "^2.1.1",
|
|
71
69
|
"radix-ui": "^1.4.2",
|
|
72
|
-
"sonner": "^2.0.
|
|
73
|
-
"tailwind-merge": "^3.3.
|
|
70
|
+
"sonner": "^2.0.5",
|
|
71
|
+
"tailwind-merge": "^3.3.1"
|
|
74
72
|
},
|
|
75
73
|
"packageManager": "pnpm@9.14.2"
|
|
76
74
|
}
|