@me1a/ui 2.2.4 → 2.2.6
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/accordion/index.mjs +1 -1
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/avatar/index.mjs +1 -1
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/badge/index.mjs +1 -1
- package/dist/badge/index.mjs.map +1 -1
- package/dist/box/index.mjs +1 -1
- package/dist/box/index.mjs.map +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/breadcrumb/index.mjs.map +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/button/index.mjs.map +1 -1
- package/dist/card/index.mjs +1 -1
- package/dist/card/index.mjs.map +1 -1
- package/dist/checkbox/index.mjs +1 -1
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/collapsible/index.mjs +1 -1
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/command/index.mjs +1 -1
- package/dist/command/index.mjs.map +1 -1
- package/dist/container/index.mjs +1 -1
- package/dist/container/index.mjs.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/drawer/index.mjs +1 -1
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown-menu/index.mjs +1 -1
- package/dist/dropdown-menu/index.mjs.map +1 -1
- package/dist/form/index.mjs +1 -1
- package/dist/form/index.mjs.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/input/index.mjs.map +1 -1
- package/dist/label/index.mjs +1 -1
- package/dist/label/index.mjs.map +1 -1
- package/dist/navigation-menu/index.mjs +1 -1
- package/dist/navigation-menu/index.mjs.map +1 -1
- package/dist/page-loader/index.mjs +1 -1
- package/dist/page-loader/index.mjs.map +1 -1
- package/dist/pagination/index.mjs +1 -1
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/popover/index.mjs.map +1 -1
- package/dist/radio-group/index.mjs +1 -1
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/resizable/index.mjs +1 -1
- package/dist/resizable/index.mjs.map +1 -1
- package/dist/rhf-checkbox/index.mjs +1 -1
- package/dist/rhf-checkbox/index.mjs.map +1 -1
- package/dist/rhf-multi-select/index.mjs +1 -1
- package/dist/rhf-multi-select/index.mjs.map +1 -1
- package/dist/rhf-radio-button-group/index.mjs +1 -1
- package/dist/rhf-radio-button-group/index.mjs.map +1 -1
- package/dist/rhf-radio-group/index.mjs +1 -1
- package/dist/rhf-radio-group/index.mjs.map +1 -1
- package/dist/rhf-select/index.mjs +1 -1
- package/dist/rhf-select/index.mjs.map +1 -1
- package/dist/rhf-switch/index.mjs +1 -1
- package/dist/rhf-switch/index.mjs.map +1 -1
- package/dist/rhf-text-field/index.d.mts +55 -0
- package/dist/rhf-text-field/index.mjs +2 -0
- package/dist/rhf-text-field/index.mjs.map +1 -0
- package/dist/rhf-textarea/index.mjs +1 -1
- package/dist/rhf-textarea/index.mjs.map +1 -1
- package/dist/separator/index.mjs +1 -1
- package/dist/separator/index.mjs.map +1 -1
- package/dist/sheet/index.mjs +1 -1
- package/dist/sheet/index.mjs.map +1 -1
- package/dist/sidebar/index.mjs +1 -1
- package/dist/sidebar/index.mjs.map +1 -1
- package/dist/skeleton/index.mjs +1 -1
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/stack/index.mjs +1 -1
- package/dist/stack/index.mjs.map +1 -1
- package/dist/switch/index.mjs +1 -1
- package/dist/switch/index.mjs.map +1 -1
- package/dist/table/index.mjs +1 -1
- package/dist/table/index.mjs.map +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/text-field/index.mjs +1 -1
- package/dist/text-field/index.mjs.map +1 -1
- package/dist/textarea/index.mjs +1 -1
- package/dist/textarea/index.mjs.map +1 -1
- package/dist/toast/index.mjs +1 -1
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toaster/index.mjs +1 -1
- package/dist/toaster/index.mjs.map +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/types/index.mjs +0 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/typography/index.mjs +1 -1
- package/dist/typography/index.mjs.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/input/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as r from
|
|
1
|
+
import*as r from"react";import{clsx as s}from"clsx";import{twMerge as l}from"tailwind-merge";function t(...e){return l(s(e))}import{jsx as p}from"react/jsx-runtime";var a=r.forwardRef(({className:e,type:o,...n},i)=>p("input",{type:o,className:t("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:i,...n}));a.displayName="Input";export{a as Input};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/input/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/input/input.tsx","../../src/utils/cn.ts"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@/utils/cn\"\n\n/**\n * Input component for creating accessible input fields.\n * Built on top of shadcn/ui's Input component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-input--docs\n *\n */\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"AAAA,UAAYA,MAAW,QCAvB,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDSM,cAAAC,MAAA,oBAHN,IAAMC,EAAc,aAClB,CAAC,CAAE,UAAAC,EAAW,KAAAC,EAAM,GAAGC,CAAM,EAAGC,IAE5BL,EAAC,SACC,KAAMG,EACN,UAAWG,EACT,0WACAJ,CACF,EACA,IAAKG,EACJ,GAAGD,EACN,CAGN,EACAH,EAAM,YAAc","names":["React","clsx","twMerge","cn","inputs","jsx","Input","className","type","props","ref","cn"]}
|
package/dist/label/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as a from
|
|
1
|
+
import*as a from"react";import*as t from"@radix-ui/react-label";import{cva as s}from"class-variance-authority";import{clsx as l}from"clsx";import{twMerge as m}from"tailwind-merge";function o(...e){return m(l(e))}import{jsx as f}from"react/jsx-runtime";var n=s("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),r=a.forwardRef(({className:e,...i},p)=>f(t.Root,{ref:p,className:o(n(),e),...i}));r.displayName=t.Root.displayName;export{r as Label};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/label/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/label/label.tsx","../../src/utils/cn.ts"],"sourcesContent":["import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAAoB,wBAChC,OAAS,OAAAC,MAA8B,2BCFvC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDkBI,cAAAC,MAAA,oBAjBJ,IAAMC,EAAgBC,EACpB,4FACF,EAaMC,EAAc,aAClB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACxBN,EAAgB,OAAf,CAAoB,IAAKM,EAAK,UAAWC,EAAGN,EAAc,EAAGG,CAAS,EAAI,GAAGC,EAAO,CAEzF,EACAF,EAAM,YAA6B,OAAK","names":["React","LabelPrimitive","cva","clsx","twMerge","cn","inputs","jsx","labelVariants","cva","Label","className","props","ref","cn"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as r from
|
|
1
|
+
import*as r from"react";import*as e from"@radix-ui/react-navigation-menu";import{ChevronDown as y}from"lucide-react";import{clsx as c}from"clsx";import{twMerge as M}from"tailwind-merge";function o(...t){return M(c(t))}import{cva as P}from"class-variance-authority";var v=P("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",{variants:{variant:{default:"text-foreground",ghost:"hover:bg-transparent hover:underline",link:"text-primary underline-offset-4 hover:underline",mobile:"w-full justify-between border-b border-border py-4 text-base font-medium"}},defaultVariants:{variant:"default"}});import{jsx as n,jsxs as l}from"react/jsx-runtime";var u=r.forwardRef(({className:t,children:i,...a},s)=>l(e.Root,{ref:s,className:o("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...a,children:[i,n(m,{})]}));u.displayName=e.Root.displayName;var g=r.forwardRef(({className:t,...i},a)=>n(e.List,{ref:a,className:o("group flex flex-1 list-none items-center justify-center space-x-1",t),...i}));g.displayName=e.List.displayName;var w=e.Item,d=r.forwardRef(({className:t,children:i,variant:a,...s},N)=>l(e.Trigger,{ref:N,className:o(v({variant:a}),t),...s,children:[i," ",n(y,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));d.displayName=e.Trigger.displayName;var p=r.forwardRef(({className:t,...i},a)=>n(e.Content,{ref:a,className:o("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto",t),...i}));p.displayName=e.Content.displayName;var R=e.Link,m=r.forwardRef(({className:t,...i},a)=>n("div",{className:o("absolute left-0 top-full flex justify-center"),children:n(e.Viewport,{className:o("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",t),ref:a,...i})}));m.displayName=e.Viewport.displayName;var f=r.forwardRef(({className:t,...i},a)=>n(e.Indicator,{ref:a,className:o("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",t),...i,children:n("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));f.displayName=e.Indicator.displayName;export{u as NavigationMenu,p as NavigationMenuContent,f as NavigationMenuIndicator,w as NavigationMenuItem,R as NavigationMenuLink,g as NavigationMenuList,d as NavigationMenuTrigger,m as NavigationMenuViewport};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/molecules/navigation-menu/navigation-menu.variants.ts","../../src/components/molecules/navigation-menu/navigation-menu.tsx"],"names":["cn","inputs","twMerge","clsx","navigationMenuTriggerStyle","cva","NavigationMenu","className","children","props","ref","jsxs","jsx","NavigationMenuViewport","NavigationMenuList","NavigationMenuItem","NavigationMenuTrigger","variant","ChevronDown","NavigationMenuContent","NavigationMenuLink","NavigationMenuIndicator"],"mappings":"kQAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCHO,IAAMG,CAA6BC,CAAAA,GAAAA,CACxC,2VACA,CAAA,CACE,QAAU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AA,CAAGC,CAC1BE,GAAAA,GAAAA,CAAyB,CAAxB,CAAA,SAAA,CAAA,CACC,IAAKF,CACL,CAAA,SAAA,CAAWV,CACT,CAAA,8LAAA,CACAO,CACF,CAAA,CACC,GAAGE,CAAAA,CAEJ,SAAAG,GAAC,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,wEAAA,CAAyE,CAC1F,CAAA,CACD,EACDS,CAAAA,CAAwB,YAAsC,CAAU,CAAA,SAAA,CAAA,WAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { cva } from \"class-variance-authority\"\n\nexport const navigationMenuTriggerStyle = cva(\n \"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50\",\n {\n variants: {\n variant: {\n default: \"text-foreground\",\n ghost: \"hover:bg-transparent hover:underline\",\n link: \"text-primary underline-offset-4 hover:underline\",\n mobile: \"w-full justify-between border-b border-border py-4 text-base font-medium\"\n }\n },\n defaultVariants: {\n variant: \"default\"\n }\n }\n)\n","import * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { ChevronDown } from \"lucide-react\"\nimport { cn } from \"@/utils/index\"\nimport { navigationMenuTriggerStyle } from \"./navigation-menu.variants\"\nimport type {\n NavigationMenuProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuContentProps,\n NavigationMenuLinkProps,\n NavigationMenuViewportProps,\n NavigationMenuIndicatorProps\n} from \"./navigation-menu.types\"\n\n/**\n * NavigationMenu component for creating accessible navigation menus with dropdowns.\n * Built on top of Radix UI's NavigationMenu primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-navigation-menu--docs\n *\n * @example\n * ```\n * <NavigationMenu>\n * <NavigationMenuList>\n * <NavigationMenuItem>\n * <NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>\n * <NavigationMenuContent>\n * <ul className=\"grid gap-3 p-4 md:w-[400px] lg:w-[500px]\">\n * <li className=\"row-span-3\">\n * <NavigationMenuLink asChild>\n * <a className=\"flex h-full w-full select-none flex-col justify-end rounded-md bg-gradient-to-b from-muted/50 to-muted p-6 no-underline outline-none focus:shadow-md\">\n * <div className=\"mb-2 mt-4 text-lg font-medium\">shadcn/ui</div>\n * <p className=\"text-sm leading-tight text-muted-foreground\">\n * Beautifully designed components built with Radix UI and Tailwind CSS.\n * </p>\n * </a>\n * </NavigationMenuLink>\n * </li>\n * </ul>\n * </NavigationMenuContent>\n * </NavigationMenuItem>\n * </NavigationMenuList>\n * </NavigationMenu>\n * ```\n */\nconst NavigationMenu = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Root>,\n NavigationMenuProps\n>(({ className, children, ...props }, ref) => (\n <NavigationMenuPrimitive.Root\n ref={ref}\n className={cn(\"relative z-10 flex max-w-max flex-1 items-center justify-center\", className)}\n {...props}\n >\n {children}\n <NavigationMenuViewport />\n </NavigationMenuPrimitive.Root>\n))\nNavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName\n\nconst NavigationMenuList = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.List>,\n NavigationMenuListProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.List\n ref={ref}\n className={cn(\"group flex flex-1 list-none items-center justify-center space-x-1\", className)}\n {...props}\n />\n))\nNavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName\n\nconst NavigationMenuItem = NavigationMenuPrimitive.Item\n\nconst NavigationMenuTrigger = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n NavigationMenuTriggerProps\n>(({ className, children, variant, ...props }, ref) => (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n className={cn(navigationMenuTriggerStyle({ variant }), className)}\n {...props}\n >\n {children}{\" \"}\n <ChevronDown\n className=\"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180\"\n aria-hidden=\"true\"\n />\n </NavigationMenuPrimitive.Trigger>\n))\nNavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName\n\nconst NavigationMenuContent = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Content>,\n NavigationMenuContentProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto\",\n className\n )}\n {...props}\n />\n))\nNavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName\n\nconst NavigationMenuLink = NavigationMenuPrimitive.Link\n\nconst NavigationMenuViewport = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n NavigationMenuViewportProps\n>(({ className, ...props }, ref) => (\n <div className={cn(\"absolute left-0 top-full flex justify-center\")}>\n <NavigationMenuPrimitive.Viewport\n className={cn(\n \"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]\",\n className\n )}\n ref={ref}\n {...props}\n />\n </div>\n))\nNavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName\n\nconst NavigationMenuIndicator = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n NavigationMenuIndicatorProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Indicator\n ref={ref}\n className={cn(\n \"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in\",\n className\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n))\nNavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName\n\nexport {\n NavigationMenu,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuContent,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuViewport\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/molecules/navigation-menu/navigation-menu.tsx","../../src/utils/cn.ts","../../src/components/molecules/navigation-menu/navigation-menu.variants.ts"],"sourcesContent":["import * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { ChevronDown } from \"lucide-react\"\nimport { cn } from \"@/utils/index\"\nimport { navigationMenuTriggerStyle } from \"./navigation-menu.variants\"\nimport type {\n NavigationMenuProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuContentProps,\n NavigationMenuLinkProps,\n NavigationMenuViewportProps,\n NavigationMenuIndicatorProps\n} from \"./navigation-menu.types\"\n\n/**\n * NavigationMenu component for creating accessible navigation menus with dropdowns.\n * Built on top of Radix UI's NavigationMenu primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-navigation-menu--docs\n *\n * @example\n * ```\n * <NavigationMenu>\n * <NavigationMenuList>\n * <NavigationMenuItem>\n * <NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>\n * <NavigationMenuContent>\n * <ul className=\"grid gap-3 p-4 md:w-[400px] lg:w-[500px]\">\n * <li className=\"row-span-3\">\n * <NavigationMenuLink asChild>\n * <a className=\"flex h-full w-full select-none flex-col justify-end rounded-md bg-gradient-to-b from-muted/50 to-muted p-6 no-underline outline-none focus:shadow-md\">\n * <div className=\"mb-2 mt-4 text-lg font-medium\">shadcn/ui</div>\n * <p className=\"text-sm leading-tight text-muted-foreground\">\n * Beautifully designed components built with Radix UI and Tailwind CSS.\n * </p>\n * </a>\n * </NavigationMenuLink>\n * </li>\n * </ul>\n * </NavigationMenuContent>\n * </NavigationMenuItem>\n * </NavigationMenuList>\n * </NavigationMenu>\n * ```\n */\nconst NavigationMenu = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Root>,\n NavigationMenuProps\n>(({ className, children, ...props }, ref) => (\n <NavigationMenuPrimitive.Root\n ref={ref}\n className={cn(\"relative z-10 flex max-w-max flex-1 items-center justify-center\", className)}\n {...props}\n >\n {children}\n <NavigationMenuViewport />\n </NavigationMenuPrimitive.Root>\n))\nNavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName\n\nconst NavigationMenuList = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.List>,\n NavigationMenuListProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.List\n ref={ref}\n className={cn(\"group flex flex-1 list-none items-center justify-center space-x-1\", className)}\n {...props}\n />\n))\nNavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName\n\nconst NavigationMenuItem = NavigationMenuPrimitive.Item\n\nconst NavigationMenuTrigger = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n NavigationMenuTriggerProps\n>(({ className, children, variant, ...props }, ref) => (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n className={cn(navigationMenuTriggerStyle({ variant }), className)}\n {...props}\n >\n {children}{\" \"}\n <ChevronDown\n className=\"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180\"\n aria-hidden=\"true\"\n />\n </NavigationMenuPrimitive.Trigger>\n))\nNavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName\n\nconst NavigationMenuContent = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Content>,\n NavigationMenuContentProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto\",\n className\n )}\n {...props}\n />\n))\nNavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName\n\nconst NavigationMenuLink = NavigationMenuPrimitive.Link\n\nconst NavigationMenuViewport = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n NavigationMenuViewportProps\n>(({ className, ...props }, ref) => (\n <div className={cn(\"absolute left-0 top-full flex justify-center\")}>\n <NavigationMenuPrimitive.Viewport\n className={cn(\n \"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]\",\n className\n )}\n ref={ref}\n {...props}\n />\n </div>\n))\nNavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName\n\nconst NavigationMenuIndicator = React.forwardRef<\n React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n NavigationMenuIndicatorProps\n>(({ className, ...props }, ref) => (\n <NavigationMenuPrimitive.Indicator\n ref={ref}\n className={cn(\n \"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in\",\n className\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n))\nNavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName\n\nexport {\n NavigationMenu,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuContent,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuViewport\n}\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { cva } from \"class-variance-authority\"\n\nexport const navigationMenuTriggerStyle = cva(\n \"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50\",\n {\n variants: {\n variant: {\n default: \"text-foreground\",\n ghost: \"hover:bg-transparent hover:underline\",\n link: \"text-primary underline-offset-4 hover:underline\",\n mobile: \"w-full justify-between border-b border-border py-4 text-base font-medium\"\n }\n },\n defaultVariants: {\n variant: \"default\"\n }\n }\n)\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAA6B,kCACzC,OAAS,eAAAC,MAAmB,eCF5B,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CCLA,OAAS,OAAAC,MAAW,2BAEb,IAAMC,EAA6BD,EACxC,4VACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,kBACT,MAAO,uCACP,KAAM,kDACN,OAAQ,0EACV,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CACF,EFkCE,OAME,OAAAE,EANF,QAAAC,MAAA,oBAJF,I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,EAAgC,aAGpC,CAAC,CAAE,UAAAd,EAAW,GAAGE,CAAM,EAAGC,IAC1BN,EAAyB,YAAxB,CACC,IAAKM,EACL,UAAWC,EACT,+LACAJ,CACF,EACC,GAAGE,EAEJ,SAAAL,EAAC,OAAI,UAAU,yEAAyE,EAC1F,CACD,EACDiB,EAAwB,YAAsC,YAAU","names":["React","NavigationMenuPrimitive","ChevronDown","clsx","twMerge","cn","inputs","cva","navigationMenuTriggerStyle","jsx","jsxs","NavigationMenu","className","children","props","ref","cn","NavigationMenuViewport","NavigationMenuList","NavigationMenuItem","NavigationMenuTrigger","variant","navigationMenuTriggerStyle","ChevronDown","NavigationMenuContent","NavigationMenuLink","NavigationMenuIndicator"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{clsx as l}from"clsx";import{twMerge as n}from"tailwind-merge";function e(...r){return n(l(r))}import{Loader2 as m}from"lucide-react";import{jsx as a,jsxs as d}from"react/jsx-runtime";function b({className:r,size:o="default",text:t,color:s="primary"}){let c={sm:"h-4 w-4",default:"h-8 w-8",lg:"h-12 w-12"},i={primary:"text-primary",secondary:"text-secondary",accent:"text-accent",muted:"text-muted-foreground",destructive:"text-destructive"}[s]||`text-[${s}]`;return d("div",{className:e("fixed inset-0 z-50 flex min-h-screen flex-col items-center justify-center bg-background/80 backdrop-blur-sm",r),role:"alert","aria-live":"assertive",children:[a(m,{className:e("animate-spin",i,c[o]),"aria-hidden":"true"}),t&&a("p",{className:"mt-4 text-sm text-muted-foreground","aria-label":t,children:t})]})}export{b as PageLoader};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/page-loader/page-loader.tsx"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/page-loader/page-loader.tsx"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { cn } from \"@/utils\"\nimport { Loader2 } from \"lucide-react\"\n\nexport type PageLoaderProps = {\n /**\n * Optional className to extend the component's styles\n */\n className?: string\n /**\n * Optional size of the loader (default: \"default\")\n */\n size?: \"sm\" | \"default\" | \"lg\"\n /**\n * Optional text to display below the loader\n */\n text?: string\n /**\n * Optional color of the loader (default: \"primary\")\n */\n color?: \"primary\" | \"secondary\" | \"accent\" | \"muted\" | \"destructive\" | string\n}\n\n/**\n * PageLoader component for displaying a loading indicator.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-page-loader--docs\n *\n */\n\nexport function PageLoader({\n className,\n size = \"default\",\n text,\n color = \"primary\"\n}: PageLoaderProps) {\n const sizeClasses = {\n sm: \"h-4 w-4\",\n default: \"h-8 w-8\",\n lg: \"h-12 w-12\"\n }\n\n const colorClasses = {\n primary: \"text-primary\",\n secondary: \"text-secondary\",\n accent: \"text-accent\",\n muted: \"text-muted-foreground\",\n destructive: \"text-destructive\"\n }\n\n const loaderColor = colorClasses[color as keyof typeof colorClasses] || `text-[${color}]`\n\n return (\n <div\n className={cn(\n \"fixed inset-0 z-50 flex min-h-screen flex-col items-center justify-center bg-background/80 backdrop-blur-sm\",\n className\n )}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n <Loader2 className={cn(\"animate-spin\", loaderColor, sizeClasses[size])} aria-hidden=\"true\" />\n {text && (\n <p className=\"mt-4 text-sm text-muted-foreground\" aria-label={text}>\n {text}\n </p>\n )}\n </div>\n )\n}\n"],"mappings":"AAAA,OAA0B,QAAAA,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CCJA,OAAS,WAAAC,MAAe,eAmDpB,OAQE,OAAAC,EARF,QAAAC,MAAA,oBAvBG,SAASC,EAAW,CACzB,UAAAC,EACA,KAAAC,EAAO,UACP,KAAAC,EACA,MAAAC,EAAQ,SACV,EAAoB,CAClB,IAAMC,EAAc,CAClB,GAAI,UACJ,QAAS,UACT,GAAI,WACN,EAUMC,EARe,CACnB,QAAS,eACT,UAAW,iBACX,OAAQ,cACR,MAAO,wBACP,YAAa,kBACf,EAEiCF,CAAkC,GAAK,SAASA,CAAK,IAEtF,OACEL,EAAC,OACC,UAAWQ,EACT,8GACAN,CACF,EACA,KAAK,QACL,YAAU,YAEV,UAAAH,EAACD,EAAA,CAAQ,UAAWU,EAAG,eAAgBD,EAAaD,EAAYH,CAAI,CAAC,EAAG,cAAY,OAAO,EAC1FC,GACCL,EAAC,KAAE,UAAU,qCAAqC,aAAYK,EAC3D,SAAAA,EACH,GAEJ,CAEJ","names":["clsx","twMerge","cn","inputs","Loader2","jsx","jsxs","PageLoader","className","size","text","color","sizeClasses","loaderColor","cn"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as g from
|
|
1
|
+
import*as g from"react";import{ChevronLeft as j,ChevronRight as A,MoreHorizontal as S}from"lucide-react";import{clsx as H}from"clsx";import{twMerge as V}from"tailwind-merge";function n(...a){return V(H(a))}import*as N from"react";import{Slot as D}from"@radix-ui/react-slot";import{cva as T}from"class-variance-authority";import{Loader2 as K}from"lucide-react";import{jsx as d,jsxs as I}from"react/jsx-runtime";var u=T("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),G=N.forwardRef(({className:a,variant:e,size:o,asChild:s=!1,startIcon:r,endIcon:b,loading:l=!1,disabled:B,children:p,type:y="button","aria-label":M,...m},v)=>{let h=s?D:"button",i=B||l,x=M||(typeof p=="string"?p:void 0),z=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),!i&&m.onClick&&m.onClick(c))};return s?d(h,{className:n(u({variant:e,size:o,className:a})),ref:v,disabled:i,type:y,"aria-label":x,"aria-disabled":i,...m,children:p}):I(h,{className:n(u({variant:e,size:o,className:a})),ref:v,disabled:i,type:y,"aria-label":x,"aria-disabled":i,onKeyDown:z,...m,children:[l&&d(K,{className:"mr-2 h-4 w-4 animate-spin",role:"status","aria-label":"Loading","aria-hidden":"true"}),!l&&r&&d("span",{className:"mr-2","aria-hidden":"true",children:r}),p,!l&&b&&d("span",{className:"ml-2","aria-hidden":"true",children:b})]})});G.displayName="Button";import{jsx as t,jsxs as P}from"react/jsx-runtime";var w=({className:a,...e})=>t("nav",{role:"navigation","aria-label":"pagination",className:n("mx-auto flex w-full justify-center",a),...e});w.displayName="Pagination";var L=g.forwardRef(({className:a,...e},o)=>t("ul",{ref:o,className:n("flex flex-row items-center gap-1",a),...e}));L.displayName="PaginationContent";var k=g.forwardRef(({className:a,...e},o)=>t("li",{ref:o,className:n("",a),...e}));k.displayName="PaginationItem";var f=({className:a,isActive:e,size:o="icon",children:s,...r})=>t("a",{"aria-current":e?"page":void 0,className:n(u({variant:e?"outline":"ghost",size:o}),a),...r,children:s});f.displayName="PaginationLink";var C=({className:a,...e})=>P(f,{"aria-label":"Go to previous page",size:"default",className:n("gap-1 pl-2.5",a),...e,children:[t(j,{className:"h-4 w-4"}),t("span",{children:"Previous"})]});C.displayName="PaginationPrevious";var R=({className:a,...e})=>P(f,{"aria-label":"Go to next page",size:"default",className:n("gap-1 pr-2.5",a),...e,children:[t("span",{children:"Next"}),t(A,{className:"h-4 w-4"})]});R.displayName="PaginationNext";var E=({className:a,...e})=>P("span",{"aria-hidden":!0,className:n("flex h-9 w-9 items-center justify-center",a),...e,children:[t(S,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"More pages"})]});E.displayName="PaginationEllipsis";export{w as Pagination,L as PaginationContent,E as PaginationEllipsis,k as PaginationItem,f as PaginationLink,R as PaginationNext,C as PaginationPrevious};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/button/button.tsx","../../src/components/atoms/pagination/pagination.tsx"],"names":["cn","inputs","twMerge","clsx","buttonVariants","cva","Button","N","className","variant","size","asChild","startIcon","endIcon","loading","disabled","children","type","ariaLabel","props","ref","Comp","Slot","isDisabled","buttonAriaLabel","handleKeyDown","event","jsx","jsxs","Loader2","Pagination","PaginationContent","PaginationItem","PaginationLink","isActive","PaginationPrevious","ChevronLeft","PaginationNext","ChevronRight","PaginationEllipsis","MoreHorizontal"],"mappings":"4RAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCYA,IAAMG,CAAiBC,CAAAA,GAAAA,CACrB,wRACA,CAAA,CACE,QAAU,CAAA,CACR,OAAS,CAAA,CACP,OAAS,CAAA,+DAAA,CACT,WAAa,CAAA,8EAAA,CACb,OACE,CAAA,0FAAA,CACF,SAAW,CAAA,wEAAA,CACX,KAAO,CAAA,8CAAA,CACP,IAAM,CAAA,iDACR,CACA,CAAA,IAAA,CAAM,CACJ,OAAA,CAAS,eACT,CAAA,EAAA,CAAI,6BACJ,CAAA,EAAA,CAAI,sBACJ,CAAA,IAAA,CAAM,SACR,CACF,CACA,CAAA,eAAA,CAAiB,CACf,OAAA,CAAS,SACT,CAAA,IAAA,CAAM,SACR,C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A,CAAA,YAAA,CAAU,CACtC,CAAA,CAAA,EAEFY,EAAmB,WAAc,CAAA,oBAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { Loader2 } from \"lucide-react\"\nimport { ButtonProps } from \"./button.types\"\n\n/**\n * Button variant styles using class-variance-authority.\n * Defines the visual styles for different button variants and sizes.\n * Follows WCAG 2.1 Level AA guidelines for accessibility.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"lg\">Click me</Button>\n * ```\n */\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n } as const,\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\"\n } as const\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\n/**\n * A versatile button component that supports multiple variants, sizes, and can be rendered as a child component.\n * Built on top of Radix UI's Slot primitive for maximum flexibility.\n * Implements proper accessibility features and follows WCAG 2.1 Level AA guidelines.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-button--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Destructive button with small size\n * <Button variant=\"destructive\" size=\"sm\">Delete</Button>\n *\n * // As a link\n * <Button variant=\"link\" asChild>\n * <a href=\"/about\">About</a>\n * </Button>\n *\n * // With icons\n * <Button startIcon={<Icon />}>With Start Icon</Button>\n * <Button endIcon={<Icon />}>With End Icon</Button>\n *\n * // Loading state\n * <Button loading>Loading</Button>\n * ```\n *\n * @param {ButtonProps} props - The component props\n * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref\n * @returns {JSX.Element} A button element\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n startIcon,\n endIcon,\n loading = false,\n disabled,\n children,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n const buttonAriaLabel = ariaLabel || (typeof children === \"string\" ? children : undefined)\n\n // Handle keyboard interaction\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault()\n if (!isDisabled && props.onClick) {\n props.onClick(event as unknown as React.MouseEvent<HTMLButtonElement>)\n }\n }\n }\n\n if (asChild) {\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n {...props}\n >\n {children}\n </Comp>\n )\n }\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {loading && (\n <Loader2\n className=\"mr-2 h-4 w-4 animate-spin\"\n role=\"status\"\n aria-label=\"Loading\"\n aria-hidden=\"true\"\n />\n )}\n {!loading && startIcon && (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children}\n {!loading && endIcon && (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\nimport { ButtonProps, buttonVariants } from \"@/components/atoms/button\"\n\n/**\n * Pagination component that provides navigation controls for paginated content.\n * Built on top of shadcn/ui's button component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-pagination--docs\n *\n * @example\n * ```tsx\n * <Pagination>\n * <PaginationContent>\n * <PaginationItem>\n * <PaginationPrevious href=\"#\" />\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationLink href=\"#\" isActive>1</PaginationLink>\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationEllipsis />\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationNext href=\"#\" />\n * </PaginationItem>\n * </PaginationContent>\n * </Pagination>\n * ```\n */\nconst Pagination = ({ className, ...props }: React.ComponentProps<\"nav\">) => (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n)\nPagination.displayName = \"Pagination\"\n\nconst PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<\"ul\">>(\n ({ className, ...props }, ref) => (\n <ul ref={ref} className={cn(\"flex flex-row items-center gap-1\", className)} {...props} />\n )\n)\nPaginationContent.displayName = \"PaginationContent\"\n\nconst PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<\"li\">>(\n ({ className, ...props }, ref) => <li ref={ref} className={cn(\"\", className)} {...props} />\n)\nPaginationItem.displayName = \"PaginationItem\"\n\ntype PaginationLinkProps = {\n isActive?: boolean\n} & Pick<ButtonProps, \"size\"> &\n React.ComponentProps<\"a\">\n\nconst PaginationLink = ({\n className,\n isActive,\n size = \"icon\",\n children,\n ...props\n}: PaginationLinkProps) => (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size\n }),\n className\n )}\n {...props}\n >\n {children}\n </a>\n)\nPaginationLink.displayName = \"PaginationLink\"\n\nconst PaginationPrevious = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"gap-1 pl-2.5\", className)}\n {...props}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n <span>Previous</span>\n </PaginationLink>\n)\nPaginationPrevious.displayName = \"PaginationPrevious\"\n\nconst PaginationNext = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"gap-1 pr-2.5\", className)}\n {...props}\n >\n <span>Next</span>\n <ChevronRight className=\"h-4 w-4\" />\n </PaginationLink>\n)\nPaginationNext.displayName = \"PaginationNext\"\n\nconst PaginationEllipsis = ({ className, ...props }: React.ComponentProps<\"span\">) => (\n <span\n aria-hidden\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"h-4 w-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n)\nPaginationEllipsis.displayName = \"PaginationEllipsis\"\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/pagination/pagination.tsx","../../src/utils/cn.ts","../../src/components/atoms/button/button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\nimport { ButtonProps, buttonVariants } from \"@/components/atoms/button\"\n\n/**\n * Pagination component that provides navigation controls for paginated content.\n * Built on top of shadcn/ui's button component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-pagination--docs\n *\n * @example\n * ```tsx\n * <Pagination>\n * <PaginationContent>\n * <PaginationItem>\n * <PaginationPrevious href=\"#\" />\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationLink href=\"#\" isActive>1</PaginationLink>\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationEllipsis />\n * </PaginationItem>\n * <PaginationItem>\n * <PaginationNext href=\"#\" />\n * </PaginationItem>\n * </PaginationContent>\n * </Pagination>\n * ```\n */\nconst Pagination = ({ className, ...props }: React.ComponentProps<\"nav\">) => (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n)\nPagination.displayName = \"Pagination\"\n\nconst PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<\"ul\">>(\n ({ className, ...props }, ref) => (\n <ul ref={ref} className={cn(\"flex flex-row items-center gap-1\", className)} {...props} />\n )\n)\nPaginationContent.displayName = \"PaginationContent\"\n\nconst PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<\"li\">>(\n ({ className, ...props }, ref) => <li ref={ref} className={cn(\"\", className)} {...props} />\n)\nPaginationItem.displayName = \"PaginationItem\"\n\ntype PaginationLinkProps = {\n isActive?: boolean\n} & Pick<ButtonProps, \"size\"> &\n React.ComponentProps<\"a\">\n\nconst PaginationLink = ({\n className,\n isActive,\n size = \"icon\",\n children,\n ...props\n}: PaginationLinkProps) => (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size\n }),\n className\n )}\n {...props}\n >\n {children}\n </a>\n)\nPaginationLink.displayName = \"PaginationLink\"\n\nconst PaginationPrevious = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"gap-1 pl-2.5\", className)}\n {...props}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n <span>Previous</span>\n </PaginationLink>\n)\nPaginationPrevious.displayName = \"PaginationPrevious\"\n\nconst PaginationNext = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"gap-1 pr-2.5\", className)}\n {...props}\n >\n <span>Next</span>\n <ChevronRight className=\"h-4 w-4\" />\n </PaginationLink>\n)\nPaginationNext.displayName = \"PaginationNext\"\n\nconst PaginationEllipsis = ({ className, ...props }: React.ComponentProps<\"span\">) => (\n <span\n aria-hidden\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"h-4 w-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n)\nPaginationEllipsis.displayName = \"PaginationEllipsis\"\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis\n}\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { Loader2 } from \"lucide-react\"\nimport { ButtonProps } from \"./button.types\"\n\n/**\n * Button variant styles using class-variance-authority.\n * Defines the visual styles for different button variants and sizes.\n * Follows WCAG 2.1 Level AA guidelines for accessibility.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"lg\">Click me</Button>\n * ```\n */\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n } as const,\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\"\n } as const\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\n/**\n * A versatile button component that supports multiple variants, sizes, and can be rendered as a child component.\n * Built on top of Radix UI's Slot primitive for maximum flexibility.\n * Implements proper accessibility features and follows WCAG 2.1 Level AA guidelines.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-button--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Destructive button with small size\n * <Button variant=\"destructive\" size=\"sm\">Delete</Button>\n *\n * // As a link\n * <Button variant=\"link\" asChild>\n * <a href=\"/about\">About</a>\n * </Button>\n *\n * // With icons\n * <Button startIcon={<Icon />}>With Start Icon</Button>\n * <Button endIcon={<Icon />}>With End Icon</Button>\n *\n * // Loading state\n * <Button loading>Loading</Button>\n * ```\n *\n * @param {ButtonProps} props - The component props\n * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref\n * @returns {JSX.Element} A button element\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n startIcon,\n endIcon,\n loading = false,\n disabled,\n children,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n const buttonAriaLabel = ariaLabel || (typeof children === \"string\" ? children : undefined)\n\n // Handle keyboard interaction\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault()\n if (!isDisabled && props.onClick) {\n props.onClick(event as unknown as React.MouseEvent<HTMLButtonElement>)\n }\n }\n }\n\n if (asChild) {\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n {...props}\n >\n {children}\n </Comp>\n )\n }\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {loading && (\n <Loader2\n className=\"mr-2 h-4 w-4 animate-spin\"\n role=\"status\"\n aria-label=\"Loading\"\n aria-hidden=\"true\"\n />\n )}\n {!loading && startIcon && (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children}\n {!loading && endIcon && (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,OAAS,eAAAC,EAAa,gBAAAC,EAAc,kBAAAC,MAAsB,eCD1D,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CCLA,UAAYC,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAAW,2BAEpB,OAAS,WAAAC,MAAe,eA2GhB,cAAAC,EAeF,QAAAC,MAfE,oBA9FR,IAAMC,EAAiBC,EACrB,yRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,gEACT,YAAa,+EACb,QACE,2FACF,UAAW,yEACX,MAAO,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AAWJ,EAAG,eAAgBF,CAAS,EACtC,GAAGC,EAEJ,UAAAJ,EAAC,QAAK,gBAAI,EACVA,EAACiB,EAAA,CAAa,UAAU,UAAU,GACpC,EAEFD,EAAe,YAAc,iBAE7B,IAAME,EAAqB,CAAC,CAAE,UAAAf,EAAW,GAAGC,CAAM,IAChDH,EAAC,QACC,cAAW,GACX,UAAWI,EAAG,2CAA4CF,CAAS,EAClE,GAAGC,EAEJ,UAAAJ,EAACmB,EAAA,CAAe,UAAU,UAAU,EACpCnB,EAAC,QAAK,UAAU,UAAU,sBAAU,GACtC,EAEFkB,EAAmB,YAAc","names":["React","ChevronLeft","ChevronRight","MoreHorizontal","clsx","twMerge","cn","inputs","React","Slot","cva","Loader2","jsx","jsxs","buttonVariants","cva","Button","className","variant","size","asChild","startIcon","endIcon","loading","disabled","children","type","ariaLabel","props","ref","Comp","Slot","isDisabled","buttonAriaLabel","handleKeyDown","event","cn","jsx","jsxs","Pagination","className","props","cn","PaginationContent","ref","PaginationItem","PaginationLink","isActive","size","children","buttonVariants","PaginationPrevious","ChevronLeft","PaginationNext","ChevronRight","PaginationEllipsis","MoreHorizontal"]}
|
package/dist/popover/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as i from
|
|
1
|
+
import*as i from"react";import*as o from"@radix-ui/react-popover";import{clsx as s}from"clsx";import{twMerge as d}from"tailwind-merge";function t(...e){return d(s(e))}import{jsx as r}from"react/jsx-runtime";var C=o.Root,R=o.Trigger,x=o.Anchor,f=i.forwardRef(({className:e,align:a="center",sideOffset:n=4,...p},m)=>r(o.Portal,{children:r(o.Content,{ref:m,align:a,sideOffset:n,className:t("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 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-popover-content-transform-origin]",e),...p})}));f.displayName=o.Content.displayName;export{C as Popover,x as PopoverAnchor,f as PopoverContent,R as PopoverTrigger};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/popover/popover.tsx","../../src/utils/cn.ts"],"sourcesContent":["import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\n\nimport { cn } from \"@/utils/index\"\n\n/**\n * Popover component that displays content in a floating panel.\n * Built on top of Radix UI's Popover primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-popover--docs\n *\n * @example\n * ```tsx\n * <Popover>\n * <PopoverTrigger>Open Popover</PopoverTrigger>\n * <PopoverContent>\n * <p>Popover content goes here</p>\n * </PopoverContent>\n * </Popover>\n * ```\n */\nconst Popover = PopoverPrimitive.Root\n\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 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-popover-content-transform-origin]\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAAsB,0BCDlC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CD2BI,cAAAC,MAAA,oBAXJ,IAAMC,EAA2B,OAE3BC,EAAkC,UAElCC,EAAiC,SAEjCC,EAAuB,aAG3B,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAQ,SAAU,WAAAC,EAAa,EAAG,GAAGC,CAAM,EAAGC,IAC5DT,EAAkB,SAAjB,CACC,SAAAA,EAAkB,UAAjB,CACC,IAAKS,EACL,MAAOH,EACP,WAAYC,EACZ,UAAWG,EACT,+dACAL,CACF,EACC,GAAGG,EACN,EACF,CACD,EACDJ,EAAe,YAA+B,UAAQ","names":["React","PopoverPrimitive","clsx","twMerge","cn","inputs","jsx","Popover","PopoverTrigger","PopoverAnchor","PopoverContent","className","align","sideOffset","props","ref","cn"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as m from
|
|
1
|
+
import*as m from"react";import*as i from"@radix-ui/react-radio-group";import{Circle as v}from"lucide-react";import{clsx as c}from"clsx";import{twMerge as u}from"tailwind-merge";function r(...e){return u(c(e))}import*as l from"react";import*as s from"@radix-ui/react-label";import{cva as b}from"class-variance-authority";import{jsx as P}from"react/jsx-runtime";var y=b("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=l.forwardRef(({className:e,...o},t)=>P(s.Root,{ref:t,className:r(y(),e),...o}));p.displayName=s.Root.displayName;import{jsx as a}from"react/jsx-runtime";var d=m.forwardRef(({className:e,...o},t)=>a(i.Root,{className:r("grid gap-3",e),...o,ref:t}));d.displayName=i.Root.displayName;var n=m.forwardRef(({className:e,...o},t)=>a(i.Item,{ref:t,className:r("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...o,children:a(i.Indicator,{className:"flex items-center justify-center",children:a(v,{className:"h-3.5 w-3.5 fill-primary"})})}));n.displayName=i.Item.displayName;var R=m.forwardRef(({className:e,...o},t)=>a("div",{ref:t,className:r("flex items-center gap-2",e),...o}));R.displayName="RadioItemContainer";var f=m.forwardRef(({className:e,...o},t)=>a(p,{ref:t,className:r("text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...o}));f.displayName="RadioItemLabel";export{d as RadioGroup,n as RadioGroupItem,R as RadioItemContainer,f as RadioItemLabel};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/radio-group/radio-group.tsx","../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\nimport { Label } from \"@/components/atoms/label\"\n\n/**\n * RadioGroup component that allows users to select a single option from a list.\n * Built on top of Radix UI's RadioGroup primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-3\", className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\n/**\n * RadioGroupItem component that represents a single option in a RadioGroup.\n * Built on top of Radix UI's RadioGroupItem primitive.\n *\n * @example\n * ```tsx\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * ```\n */\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-3.5 w-3.5 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\n/**\n * RadioItemContainer component that provides a container for radio group items with proper spacing and layout.\n *\n * @example\n * ```tsx\n * <RadioItemContainer>\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioItemContainer>\n * ```\n */\nconst RadioItemContainer = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props} />\n }\n)\nRadioItemContainer.displayName = \"RadioItemContainer\"\n\n/**\n * RadioItemLabel component that provides a label for individual radio items.\n * Built on top of the Label component.\n *\n * @example\n * ```tsx\n * <RadioItemLabel>Select an option</RadioItemLabel>\n * ```\n */\nconst RadioItemLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n return (\n <Label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n})\nRadioItemLabel.displayName = \"RadioItemLabel\"\n\nexport { RadioGroup, RadioGroupItem, RadioItemContainer, RadioItemLabel }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,UAAYC,MAAyB,8BACrC,OAAS,UAAAC,MAAc,eCFvB,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CCLA,UAAYC,MAAW,QACvB,UAAYC,MAAoB,wBAChC,OAAS,OAAAC,MAA8B,2BAqBnC,cAAAC,MAAA,oBAjBJ,IAAMC,EAAgBC,EACpB,4FACF,EAaMC,EAAc,aAClB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACxBN,EAAgB,OAAf,CAAoB,IAAKM,EAAK,UAAWC,EAAGN,EAAc,EAAGG,CAAS,EAAI,GAAGC,EAAO,CAEzF,EACAF,EAAM,YAA6B,OAAK,YFD/B,cAAAK,MAAA,oBAJT,IAAMC,EAAmB,aAGvB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACnBJ,EAAqB,OAApB,CAAyB,UAAWK,EAAG,aAAcH,CAAS,EAAI,GAAGC,EAAO,IAAKC,EAAK,CAC/F,EACDH,EAAW,YAAkC,OAAK,YAWlD,IAAMK,EAAuB,aAG3B,CAAC,CAAE,UAAAJ,EAAW,GAAGC,CAAM,EAAGC,IAExBJ,EAAqB,OAApB,CACC,IAAKI,EACL,UAAWC,EACT,+LACAH,CACF,EACC,GAAGC,EAEJ,SAAAH,EAAqB,YAApB,CAA8B,UAAU,mCACvC,SAAAA,EAACO,EAAA,CAAO,UAAU,2BAA2B,EAC/C,EACF,CAEH,EACDD,EAAe,YAAkC,OAAK,YAatD,IAAME,EAA2B,aAC/B,CAAC,CAAE,UAAAN,EAAW,GAAGC,CAAM,EAAGC,IACjBJ,EAAC,OAAI,IAAKI,EAAK,UAAWC,EAAG,0BAA2BH,CAAS,EAAI,GAAGC,EAAO,CAE1F,EACAK,EAAmB,YAAc,qBAWjC,IAAMC,EAAuB,aAG3B,CAAC,CAAE,UAAAP,EAAW,GAAGC,CAAM,EAAGC,IAExBJ,EAACU,EAAA,CACC,IAAKN,EACL,UAAWC,EACT,4GACAH,CACF,EACC,GAAGC,EACN,CAEH,EACDM,EAAe,YAAc","names":["React","RadioGroupPrimitive","Circle","clsx","twMerge","cn","inputs","React","LabelPrimitive","cva","jsx","labelVariants","cva","Label","className","props","ref","cn","jsx","RadioGroup","className","props","ref","cn","RadioGroupItem","Circle","RadioItemContainer","RadioItemLabel","Label"]}
|
package/dist/resizable/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use client";import{GripVertical as s}from"lucide-react";import*as e from"react-resizable-panels";import{clsx as o}from"clsx";import{twMerge as n}from"tailwind-merge";function i(...a){return n(o(a))}import{jsx as r}from"react/jsx-runtime";var p=({className:a,...t})=>r(e.PanelGroup,{className:i("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",a),...t}),c=e.Panel,f=({withHandle:a,className:t,...l})=>r(e.PanelResizeHandle,{className:i("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...l,children:a&&r("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:r(s,{className:"h-2.5 w-2.5"})})});export{f as ResizableHandle,c as ResizablePanel,p as ResizablePanelGroup};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/resizable/resizable.tsx","../../src/utils/cn.ts"],"sourcesContent":["\"use client\";\n\"use client\"\n\nimport { GripVertical } from \"lucide-react\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\nimport { cn } from \"@/utils/index\"\nimport { ComponentProps } from \"react\"\n\n/**\n * Resizable component that provides resizable panel functionality.\n * Built on top of react-resizable-panels.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-resizable--docs\n *\n * @example\n * ```tsx\n * <ResizablePanelGroup>\n * <ResizablePanel defaultSize={20}>\n * <div>Left Panel</div>\n * </ResizablePanel>\n * <ResizableHandle withHandle />\n * <ResizablePanel defaultSize={80}>\n * <div>Right Panel</div>\n * </ResizablePanel>\n * </ResizablePanelGroup>\n * ```\n */\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\", className)}\n {...props}\n />\n)\n\nconst ResizablePanel = ResizablePrimitive.Panel\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <GripVertical className=\"h-2.5 w-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n)\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"aAGA,OAAS,gBAAAA,MAAoB,eAC7B,UAAYC,MAAwB,yBCJpC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CD0BE,cAAAC,MAAA,oBAJF,IAAMC,EAAsB,CAAC,CAC3B,UAAAC,EACA,GAAGC,CACL,IACEH,EAAoB,aAAnB,CACC,UAAWI,EAAG,oEAAqEF,CAAS,EAC3F,GAAGC,EACN,EAGIE,EAAoC,QAEpCC,EAAkB,CAAC,CACvB,WAAAC,EACA,UAAAL,EACA,GAAGC,CACL,IAGEH,EAAoB,oBAAnB,CACC,UAAWI,EACT,0oBACAF,CACF,EACC,GAAGC,EAEH,SAAAI,GACCP,EAAC,OAAI,UAAU,4EACb,SAAAA,EAACQ,EAAA,CAAa,UAAU,cAAc,EACxC,EAEJ","names":["GripVertical","ResizablePrimitive","clsx","twMerge","cn","inputs","jsx","ResizablePanelGroup","className","props","cn","ResizablePanel","ResizableHandle","withHandle","GripVertical"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use client";import{useFormContext as B}from"react-hook-form";import*as L from"react";import*as d from"@radix-ui/react-checkbox";import{Check as S}from"lucide-react";import{clsx as D}from"clsx";import{twMerge as E}from"tailwind-merge";function s(...e){return E(D(e))}import{jsx as y}from"react/jsx-runtime";var f=L.forwardRef(({className:e,...o},t)=>y(d.Root,{ref:t,className:s("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...o,children:y(d.Indicator,{className:s("flex items-center justify-center text-current"),"aria-hidden":"true",children:y(S,{className:"h-4 w-4"})})}));f.displayName=d.Root.displayName;import*as r from"react";import{Slot as O}from"@radix-ui/react-slot";import{Controller as q,FormProvider as de,useFormContext as z}from"react-hook-form";import*as N from"react";import*as h from"@radix-ui/react-label";import{cva as $}from"class-variance-authority";import{jsx as W}from"react/jsx-runtime";var A=$("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),u=N.forwardRef(({className:e,...o},t)=>W(h.Root,{ref:t,className:s(A(),e),...o}));u.displayName=h.Root.displayName;import{jsx as l}from"react/jsx-runtime";var I=r.createContext({}),v=({...e})=>l(I.Provider,{value:{name:e.name},children:l(q,{...e})}),c=()=>{let e=r.useContext(I),o=r.useContext(T),{getFieldState:t,formState:a}=z(),i=t(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:m}=o;return{id:m,name:e.name,formItemId:`${m}-form-item`,formDescriptionId:`${m}-form-item-description`,formMessageId:`${m}-form-item-message`,...i}},T=r.createContext({}),x=r.forwardRef(({className:e,...o},t)=>{let a=r.useId();return l(T.Provider,{value:{id:a},children:l("div",{ref:t,className:s("space-y-2",e),...o})})});x.displayName="FormItem";var b=r.forwardRef(({className:e,...o},t)=>{let{error:a,formItemId:i}=c();return l(u,{ref:t,className:s(a&&"text-destructive",e),htmlFor:i,...o})});b.displayName="FormLabel";var C=r.forwardRef(({...e},o)=>{let{error:t,formItemId:a,formDescriptionId:i,formMessageId:m}=c();return l(O,{ref:o,id:a,"aria-describedby":t?`${i} ${m}`:`${i}`,"aria-invalid":!!t,...e})});C.displayName="FormControl";var P=r.forwardRef(({className:e,...o},t)=>{let{formDescriptionId:a}=c();return l("p",{ref:t,id:a,className:s("text-sm text-muted-foreground",e),...o})});P.displayName="FormDescription";var R=r.forwardRef(({className:e,children:o,...t},a)=>{let{error:i,formMessageId:m}=c(),p=i?String(i?.message??""):o;return p?l("p",{ref:a,id:m,className:s("text-sm font-medium text-destructive",e),...t,children:p}):null});R.displayName="FormMessage";import{jsx as n,jsxs as V}from"react/jsx-runtime";function ye({name:e,label:o,description:t,className:a,warningText:i,required:m,disabled:p,readOnly:G,"aria-label":k,"aria-describedby":M,...w}){let{control:H}=B();return n(v,{name:e,control:H,render:({field:g,fieldState:{error:F}})=>V(x,{className:"flex flex-row items-start space-x-3 space-y-0",children:[n(C,{children:n(f,{checked:g.value,onCheckedChange:g.onChange,disabled:p,"aria-label":k,"aria-describedby":M,"aria-invalid":!!F,"aria-required":m,...w})}),V("div",{className:"space-y-1 leading-none",children:[o&&V(b,{children:[o,m&&n("span",{className:"text-destructive ml-1",children:"*"})]}),t&&n(P,{children:t}),F&&n(R,{children:F.message}),!F&&i&&n("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:i})]})]})})}export{ye as RHFCheckbox};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/checkbox/checkbox.tsx","../../src/components/atoms/label/label.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-checkbox/rhf-checkbox.tsx"],"names":["cn","inputs","twMerge","clsx","Checkbox","L","className","props","ref","jsx","Check","labelVariants","cva","Label","N","FormFieldContext","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","RHFCheckbox","name","label","description","warningText","required","disabled","readOnly","ariaLabel","ariaDescribedby","other","control","field","jsxs"],"mappings":"6XAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAAA,CAAiBC,CACrB,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GACxBC,GAAmB,CAAA,CAAA,CAAA,IAAA,CAAlB,CACC,GAAKD,CAAAA,CAAAA,CACL,SAAWR,CAAAA,CAAAA,CACT,qQACAM,CACF,CAAA,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S+C,CAAM,CAAA,KAAA,CACf,eAAiBA,CAAAA,CAAAA,CAAM,SACvB,QAAUN,CAAAA,CAAAA,CACV,YAAYE,CAAAA,CAAAA,CACZ,mBAAkBC,CAClB,CAAA,cAAA,CAAc,CAAC,CAACnB,EAChB,eAAee,CAAAA,CAAAA,CACd,GAAGK,CAAAA,CACN,EACF,CACAG,CAAAA,IAAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,yBACZ,QAAAX,CAAAA,CAAAA,CAAAA,EACCW,IAACxB,CAAAA,CAAAA,CAAA,CACE,QAAAa,CAAAA,CAAAA,CAAAA,CACAG,CAAYnC,EAAAA,GAAAA,CAAC,MAAK,CAAA,CAAA,SAAA,CAAU,uBAAwB,CAAA,QAAA,CAAA,GAAA,CAAC,GACxD,CAEDiC,CAAAA,CAAAA,EAAejC,GAAC0B,CAAAA,CAAAA,CAAA,CAAiB,QAAAO,CAAAA,CAAAA,CAAY,CAC7Cb,CAAAA,CAAAA,EAASpB,IAAC2B,CAAA,CAAA,CAAa,QAAAP,CAAAA,CAAAA,CAAM,QAAQ,CACrC,CAAA,CAACA,CAASc,EAAAA,CAAAA,EACTlC,IAAC,GAAE,CAAA,CAAA,SAAA,CAAU,8CAA+C,CAAA,IAAA,CAAK,QAC9D,QAAAkC,CAAAA,CAAAA,CACH,CAEJ,CAAA,CAAA,CAAA,CAAA,CACF,EAEJ,CAEJ","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","/**\n * Checkbox component built on top of Radix UI's Checkbox primitive.\n * Provides a customizable checkbox input with proper accessibility and keyboard navigation.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-checkbox--docs\n *\n * @example\n * ```tsx\n * <Checkbox id=\"terms\" name=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms and conditions</label>\n * ```\n */\nimport * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { Check } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\nimport type { CheckboxProps } from \"./checkbox.types\"\n\nconst Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(\n ({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className={cn(\"flex items-center justify-center text-current\")}\n aria-hidden=\"true\"\n >\n <Check className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n)\nCheckbox.displayName = CheckboxPrimitive.Root.displayName\n\nexport { Checkbox }\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Checkbox } from \"@/components/atoms/checkbox\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFCheckboxProps } from \"./rhf-checkbox.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A checkbox component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfcheckbox--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFCheckbox name=\"terms\" label=\"Accept terms and conditions\" />\n * </Form>\n * ```\n */\nexport function RHFCheckbox<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n ...other\n}: RHFCheckboxProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"flex flex-row items-start space-x-3 space-y-0\">\n <FormControl>\n <Checkbox\n checked={field.value}\n onCheckedChange={field.onChange}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </div>\n </FormItem>\n )}\n />\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/rhf/rhf-checkbox/rhf-checkbox.tsx","../../src/components/atoms/checkbox/checkbox.tsx","../../src/utils/cn.ts","../../src/components/rhf/form/form.tsx","../../src/components/atoms/label/label.tsx"],"sourcesContent":["\"use client\";\n\"use client\"\n\nimport * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Checkbox } from \"@/components/atoms/checkbox\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFCheckboxProps } from \"./rhf-checkbox.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A checkbox component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfcheckbox--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFCheckbox name=\"terms\" label=\"Accept terms and conditions\" />\n * </Form>\n * ```\n */\nexport function RHFCheckbox<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n ...other\n}: RHFCheckboxProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"flex flex-row items-start space-x-3 space-y-0\">\n <FormControl>\n <Checkbox\n checked={field.value}\n onCheckedChange={field.onChange}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </div>\n </FormItem>\n )}\n />\n )\n}\n","/**\n * Checkbox component built on top of Radix UI's Checkbox primitive.\n * Provides a customizable checkbox input with proper accessibility and keyboard navigation.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-checkbox--docs\n *\n * @example\n * ```tsx\n * <Checkbox id=\"terms\" name=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms and conditions</label>\n * ```\n */\nimport * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { Check } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\nimport type { CheckboxProps } from \"./checkbox.types\"\n\nconst Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(\n ({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className={cn(\"flex items-center justify-center text-current\")}\n aria-hidden=\"true\"\n >\n <Check className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n)\nCheckbox.displayName = CheckboxPrimitive.Root.displayName\n\nexport { Checkbox }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\";\n\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"mappings":"aAIA,OAAS,kBAAAA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,EACZ,mBAAkBC,EAClB,eAAc,CAAC,CAACM,EAChB,gBAAeV,EACd,GAAGK,EACN,EACF,EACAZ,EAAC,OAAI,UAAU,yBACZ,UAAAG,GACCH,EAACqB,EAAA,CACE,UAAAlB,EACAI,GAAYR,EAAC,QAAK,UAAU,wBAAwB,aAAC,GACxD,EAEDK,GAAeL,EAACuB,EAAA,CAAiB,SAAAlB,EAAY,EAC7Ca,GAASlB,EAACwB,EAAA,CAAa,SAAAN,EAAM,QAAQ,EACrC,CAACA,GAASX,GACTP,EAAC,KAAE,UAAU,+CAA+C,KAAK,QAC9D,SAAAO,EACH,GAEJ,GACF,EAEJ,CAEJ","names":["useFormContext","React","CheckboxPrimitive","Check","clsx","twMerge","cn","inputs","jsx","Checkbox","className","props","ref","cn","Check","React","Slot","Controller","FormProvider","useFormContext","React","LabelPrimitive","cva","jsx","labelVariants","cva","Label","className","props","ref","cn","jsx","FormFieldContext","FormField","props","jsx","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","jsx","jsxs","RHFCheckbox","name","label","description","className","warningText","required","disabled","readOnly","ariaLabel","ariaDescribedby","other","control","useFormContext","FormField","field","error","FormItem","FormControl","Checkbox","FormLabel","FormDescription","FormMessage"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {useFormContext,Controller}from'react-hook-form';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as l from'react';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {Loader2,Search,X as X$1,ChevronDown,Check}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import {Command}from'cmdk';import {Popover,PopoverTrigger,PopoverContent}from'@radix-ui/react-popover';import*as W from'@radix-ui/react-label';function a(...e){return twMerge(clsx(e))}var j=cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),z=l.forwardRef(({className:e,variant:t,size:o,asChild:m=false,startIcon:s,endIcon:i,loading:c=false,disabled:I,children:f,type:N="button","aria-label":y,...x},P)=>{let F=m?Slot:"button",p=I||c,u=y||(typeof f=="string"?f:void 0),T=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),!p&&x.onClick&&x.onClick(w));};return m?jsx(F,{className:a(j({variant:t,size:o,className:e})),ref:P,disabled:p,type:N,"aria-label":u,"aria-disabled":p,...x,children:f}):jsxs(F,{className:a(j({variant:t,size:o,className:e})),ref:P,disabled:p,type:N,"aria-label":u,"aria-disabled":p,onKeyDown:T,...x,children:[c&&jsx(Loader2,{className:"mr-2 h-4 w-4 animate-spin",role:"status","aria-label":"Loading","aria-hidden":"true"}),!c&&s&&jsx("span",{className:"mr-2","aria-hidden":"true",children:s}),f,!c&&i&&jsx("span",{className:"ml-2","aria-hidden":"true",children:i})]})});z.displayName="Button";var M=l.forwardRef(({className:e,...t},o)=>jsx(Command,{ref:o,className:a("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));M.displayName=Command.displayName;var E=l.forwardRef(({className:e,...t},o)=>jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[jsx(Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),jsx(Command.Input,{ref:o,className:a("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));E.displayName=Command.Input.displayName;var _=l.forwardRef(({className:e,...t},o)=>jsx(Command.List,{ref:o,className:a("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));_.displayName=Command.List.displayName;var D=l.forwardRef((e,t)=>jsx(Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));D.displayName=Command.Empty.displayName;var L=l.forwardRef(({className:e,...t},o)=>jsx(Command.Group,{ref:o,className:a("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));L.displayName=Command.Group.displayName;var H=l.forwardRef(({className:e,...t},o)=>jsx(Command.Separator,{ref:o,className:a("-mx-1 h-px bg-border",e),...t}));H.displayName=Command.Separator.displayName;var S=l.forwardRef(({className:e,...t},o)=>jsx(Command.Item,{ref:o,className:a("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));S.displayName=Command.Item.displayName;var xe=cva("",{variants:{variant:{h1:"scroll-m-5 text-4xl font-extrabold tracking-tight lg:text-5xl",h2:"scroll-m-5 text-3xl font-semibold tracking-tight",h3:"scroll-m-5 text-2xl font-semibold tracking-tight",h4:"scroll-m-5 text-xl font-semibold tracking-tight",h5:"scroll-m-5 text-lg font-semibold tracking-tight",h6:"scroll-m-5 text-base font-semibold tracking-tight",p:"leading-7 [&:not(:first-child)]:mt-6",blockquote:"mt-6 border-l-2 border-slate-300 pl-6 italic",list:"my-6 ml-6 list-disc [&>li]:mt-2",lead:"text-xl text-muted-foreground",large:"text-lg font-semibold",small:"text-sm font-medium leading-none",muted:"text-sm text-muted-foreground"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"p",align:"left"}}),G=l.forwardRef(({className:e,variant:t,align:o,as:m="p",...s},i)=>jsx(m,{className:a(xe({variant:t,align:o,className:e})),ref:i,...s}));G.displayName="Typography";function ee({options:e,value:t,onChange:o,placeholder:m="Select options",disabled:s,required:i,error:c,className:I,fullWidth:f,searchable:N,id:y,maxSelections:x,showSelectAll:P,renderCommandList:F}){let[p,u]=l.useState(false),T=e.filter(r=>t.includes(r.id)),w=r=>{if(t.includes(r))o(t.filter(b=>b!==r));else {if(x&&t.length>=x)return;o([...t,r]);}},me=()=>{let r=e.filter(b=>!b.disabled);t.length===r.length?o([]):o(r.map(b=>b.id));},se=(r,b)=>{b.stopPropagation(),o(t.filter(ne=>ne!==r));};return jsx("div",{className:a(f&&"w-full"),children:jsxs(Popover,{open:p,onOpenChange:u,children:[jsx(PopoverTrigger,{asChild:true,children:jsxs(z,{variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":y?`${y}-content`:void 0,"aria-label":m,"aria-required":i,"aria-invalid":!!c,disabled:s,id:y,className:a("w-[13rem] justify-between min-h-[2.5rem] h-auto",!t.length&&"text-muted-foreground",f&&"w-full",c&&"border-destructive focus-visible:ring-destructive",I),children:[jsx("div",{className:"flex flex-wrap gap-1",children:T.length>0?T.map(r=>jsxs("div",{className:"flex items-center gap-1 bg-secondary text-secondary-foreground px-2 py-0.5 rounded-md text-sm",children:[jsx("span",{children:r.label}),jsx("span",{onClick:b=>se(r.id,b),className:"hover:bg-secondary-foreground/20 rounded-sm",children:jsx(X$1,{className:"h-3 w-3"})})]},r.id)):jsx("span",{children:m})}),jsx(ChevronDown,{className:a("opacity-50",p&&"rotate-180")})]})}),jsx(PopoverContent,{id:y?`${y}-content`:void 0,className:a("w-[13rem] p-0 rounded-md border bg-popover text-popover-foreground shadow-md",f&&"w-full"),align:"start",children:jsxs(M,{children:[N&&jsx(E,{placeholder:"Search...",className:"h-9",disabled:s}),jsxs(_,{className:"max-h-[12rem] overflow-y-auto",children:[jsx(D,{children:"No items found."}),jsxs(L,{children:[P&&jsxs(S,{onSelect:me,className:"flex items-center gap-2 cursor-pointer my-1",children:[jsx("div",{className:"flex h-4 w-4 items-center justify-center rounded border border-primary",children:t.length===e.filter(r=>!r.disabled).length&&jsx(Check,{className:"h-3 w-3"})}),jsx(G,{variant:"small",children:"Select All"})]}),jsx(H,{})]}),F?F(e):jsx(L,{children:e.map(r=>jsxs(S,{value:r.id,onSelect:()=>w(r.id),disabled:r.disabled,className:a("flex items-center justify-between cursor-pointer my-1",r.disabled&&"opacity-50 cursor-not-allowed",r.className),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-4 w-4 items-center justify-center rounded border border-primary",children:t.includes(r.id)&&jsx(Check,{className:"h-3 w-3"})}),jsxs("div",{className:"flex items-center gap-1",children:[r.startIcon&&r.startIcon,jsx(G,{variant:"small",children:r.label})]})]}),r.endIcon&&jsx("div",{className:"ml-2",children:r.endIcon})]},r.id))})]})]})})]})})}var Pe=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),A=l.forwardRef(({className:e,...t},o)=>jsx(W.Root,{ref:o,className:a(Pe(),e),...t}));A.displayName=W.Root.displayName;var oe=l.createContext({}),X=({...e})=>jsx(oe.Provider,{value:{name:e.name},children:jsx(Controller,{...e})}),k=()=>{let e=l.useContext(oe),t=l.useContext(re),{getFieldState:o,formState:m}=useFormContext(),s=o(e.name,m);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:i}=t;return {id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},re=l.createContext({}),B=l.forwardRef(({className:e,...t},o)=>{let m=l.useId();return jsx(re.Provider,{value:{id:m},children:jsx("div",{ref:o,className:a("space-y-2",e),...t})})});B.displayName="FormItem";var $=l.forwardRef(({className:e,...t},o)=>{let{error:m,formItemId:s}=k();return jsx(A,{ref:o,className:a(m&&"text-destructive",e),htmlFor:s,...t})});$.displayName="FormLabel";var O=l.forwardRef(({...e},t)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=k();return jsx(Slot,{ref:t,id:m,"aria-describedby":o?`${s} ${i}`:`${s}`,"aria-invalid":!!o,...e})});O.displayName="FormControl";var q=l.forwardRef(({className:e,...t},o)=>{let{formDescriptionId:m}=k();return jsx("p",{ref:o,id:m,className:a("text-sm text-muted-foreground",e),...t})});q.displayName="FormDescription";var K=l.forwardRef(({className:e,children:t,...o},m)=>{let{error:s,formMessageId:i}=k(),c=s?String(s?.message??""):t;return c?jsx("p",{ref:m,id:i,className:a("text-sm font-medium text-destructive",e),...o,children:c}):null});K.displayName="FormMessage";function St({name:e,label:t,description:o,className:m,warningText:s,required:i,disabled:c,readOnly:I,placeholder:f,"aria-label":N,"aria-describedby":y,options:x,...P}){let{control:F}=useFormContext();return jsx(X,{name:e,control:F,render:({field:p,fieldState:{error:u}})=>jsxs(B,{children:[t&&jsxs($,{children:[t,i&&jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsx(O,{children:jsx(ee,{...p,options:x,value:p.value||[],onChange:p.onChange,className:a(u&&"border-destructive focus-visible:ring-destructive",m),disabled:c||I,required:i,placeholder:f,"aria-label":N,"aria-describedby":y,"aria-invalid":!!u,"aria-required":i,...P})}),o&&jsx(q,{children:o}),u&&jsx(K,{children:u.message}),!u&&s&&jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:s})]})})}export{St as RHFMultiSelect};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
"use client";import{useFormContext as ke}from"react-hook-form";import{clsx as ie}from"clsx";import{twMerge as le}from"tailwind-merge";function a(...e){return le(ie(e))}import*as J from"react";import{Slot as de}from"@radix-ui/react-slot";import{cva as pe}from"class-variance-authority";import{Loader2 as ce}from"lucide-react";import{jsx as V,jsxs as ue}from"react/jsx-runtime";var j=pe("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),z=J.forwardRef(({className:e,variant:t,size:o,asChild:m=!1,startIcon:s,endIcon:i,loading:c=!1,disabled:I,children:u,type:N="button","aria-label":y,...x},P)=>{let F=m?de:"button",p=I||c,f=y||(typeof u=="string"?u:void 0),T=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),!p&&x.onClick&&x.onClick(w))};return m?V(F,{className:a(j({variant:t,size:o,className:e})),ref:P,disabled:p,type:N,"aria-label":f,"aria-disabled":p,...x,children:u}):ue(F,{className:a(j({variant:t,size:o,className:e})),ref:P,disabled:p,type:N,"aria-label":f,"aria-disabled":p,onKeyDown:T,...x,children:[c&&V(ce,{className:"mr-2 h-4 w-4 animate-spin",role:"status","aria-label":"Loading","aria-hidden":"true"}),!c&&s&&V("span",{className:"mr-2","aria-hidden":"true",children:s}),u,!c&&i&&V("span",{className:"ml-2","aria-hidden":"true",children:i})]})});z.displayName="Button";import*as C from"react";import{Command as l}from"cmdk";import{Search as fe}from"lucide-react";import{jsx as h,jsxs as ge}from"react/jsx-runtime";var M=C.forwardRef(({className:e,...t},o)=>h(l,{ref:o,className:a("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));M.displayName=l.displayName;var E=C.forwardRef(({className:e,...t},o)=>ge("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[h(fe,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),h(l.Input,{ref:o,className:a("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));E.displayName=l.Input.displayName;var _=C.forwardRef(({className:e,...t},o)=>h(l.List,{ref:o,className:a("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));_.displayName=l.List.displayName;var D=C.forwardRef((e,t)=>h(l.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));D.displayName=l.Empty.displayName;var L=C.forwardRef(({className:e,...t},o)=>h(l.Group,{ref:o,className:a("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));L.displayName=l.Group.displayName;var H=C.forwardRef(({className:e,...t},o)=>h(l.Separator,{ref:o,className:a("-mx-1 h-px bg-border",e),...t}));H.displayName=l.Separator.displayName;var S=C.forwardRef(({className:e,...t},o)=>h(l.Item,{ref:o,className:a("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));S.displayName=l.Item.displayName;var Q=({className:e,...t})=>h("span",{className:a("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Q.displayName="CommandShortcut";import*as U from"react";import{cva as ye}from"class-variance-authority";import{jsx as be}from"react/jsx-runtime";var xe=ye("",{variants:{variant:{h1:"scroll-m-5 text-4xl font-extrabold tracking-tight lg:text-5xl",h2:"scroll-m-5 text-3xl font-semibold tracking-tight",h3:"scroll-m-5 text-2xl font-semibold tracking-tight",h4:"scroll-m-5 text-xl font-semibold tracking-tight",h5:"scroll-m-5 text-lg font-semibold tracking-tight",h6:"scroll-m-5 text-base font-semibold tracking-tight",p:"leading-7 [&:not(:first-child)]:mt-6",blockquote:"mt-6 border-l-2 border-slate-300 pl-6 italic",list:"my-6 ml-6 list-disc [&>li]:mt-2",lead:"text-xl text-muted-foreground",large:"text-lg font-semibold",small:"text-sm font-medium leading-none",muted:"text-sm text-muted-foreground"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"p",align:"left"}}),G=U.forwardRef(({className:e,variant:t,align:o,as:m="p",...s},i)=>be(m,{className:a(xe({variant:t,align:o,className:e})),ref:i,...s}));G.displayName="Typography";import*as Z from"react";import{Check as Y,ChevronDown as he,X as Ce}from"lucide-react";import{Popover as ve,PopoverContent as Fe,PopoverTrigger as Re}from"@radix-ui/react-popover";import{jsx as n,jsxs as g}from"react/jsx-runtime";function ee({options:e,value:t,onChange:o,placeholder:m="Select options",disabled:s,required:i,error:c,className:I,fullWidth:u,searchable:N,id:y,maxSelections:x,showSelectAll:P,renderCommandList:F}){let[p,f]=Z.useState(!1),T=e.filter(r=>t.includes(r.id)),w=r=>{if(t.includes(r))o(t.filter(b=>b!==r));else{if(x&&t.length>=x)return;o([...t,r])}},me=()=>{let r=e.filter(b=>!b.disabled);t.length===r.length?o([]):o(r.map(b=>b.id))},se=(r,b)=>{b.stopPropagation(),o(t.filter(ne=>ne!==r))};return n("div",{className:a(u&&"w-full"),children:g(ve,{open:p,onOpenChange:f,children:[n(Re,{asChild:!0,children:g(z,{variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":y?`${y}-content`:void 0,"aria-label":m,"aria-required":i,"aria-invalid":!!c,disabled:s,id:y,className:a("w-[13rem] justify-between min-h-[2.5rem] h-auto",!t.length&&"text-muted-foreground",u&&"w-full",c&&"border-destructive focus-visible:ring-destructive",I),children:[n("div",{className:"flex flex-wrap gap-1",children:T.length>0?T.map(r=>g("div",{className:"flex items-center gap-1 bg-secondary text-secondary-foreground px-2 py-0.5 rounded-md text-sm",children:[n("span",{children:r.label}),n("span",{onClick:b=>se(r.id,b),className:"hover:bg-secondary-foreground/20 rounded-sm",children:n(Ce,{className:"h-3 w-3"})})]},r.id)):n("span",{children:m})}),n(he,{className:a("opacity-50",p&&"rotate-180")})]})}),n(Fe,{id:y?`${y}-content`:void 0,className:a("w-[13rem] p-0 rounded-md border bg-popover text-popover-foreground shadow-md",u&&"w-full"),align:"start",children:g(M,{children:[N&&n(E,{placeholder:"Search...",className:"h-9",disabled:s}),g(_,{className:"max-h-[12rem] overflow-y-auto",children:[n(D,{children:"No items found."}),g(L,{children:[P&&g(S,{onSelect:me,className:"flex items-center gap-2 cursor-pointer my-1",children:[n("div",{className:"flex h-4 w-4 items-center justify-center rounded border border-primary",children:t.length===e.filter(r=>!r.disabled).length&&n(Y,{className:"h-3 w-3"})}),n(G,{variant:"small",children:"Select All"})]}),n(H,{})]}),F?F(e):n(L,{children:e.map(r=>g(S,{value:r.id,onSelect:()=>w(r.id),disabled:r.disabled,className:a("flex items-center justify-between cursor-pointer my-1",r.disabled&&"opacity-50 cursor-not-allowed",r.className),children:[g("div",{className:"flex items-center gap-2",children:[n("div",{className:"flex h-4 w-4 items-center justify-center rounded border border-primary",children:t.includes(r.id)&&n(Y,{className:"h-3 w-3"})}),g("div",{className:"flex items-center gap-1",children:[r.startIcon&&r.startIcon,n(G,{variant:"small",children:r.label})]})]}),r.endIcon&&n("div",{className:"ml-2",children:r.endIcon})]},r.id))})]})]})})]})})}import*as d from"react";import{Slot as Ie}from"@radix-ui/react-slot";import{Controller as Le,FormProvider as xt,useFormContext as Se}from"react-hook-form";import*as te from"react";import*as W from"@radix-ui/react-label";import{cva as Ne}from"class-variance-authority";import{jsx as we}from"react/jsx-runtime";var Pe=Ne("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),A=te.forwardRef(({className:e,...t},o)=>we(W.Root,{ref:o,className:a(Pe(),e),...t}));A.displayName=W.Root.displayName;import{jsx as v}from"react/jsx-runtime";var oe=d.createContext({}),X=({...e})=>v(oe.Provider,{value:{name:e.name},children:v(Le,{...e})}),k=()=>{let e=d.useContext(oe),t=d.useContext(re),{getFieldState:o,formState:m}=Se(),s=o(e.name,m);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},re=d.createContext({}),B=d.forwardRef(({className:e,...t},o)=>{let m=d.useId();return v(re.Provider,{value:{id:m},children:v("div",{ref:o,className:a("space-y-2",e),...t})})});B.displayName="FormItem";var $=d.forwardRef(({className:e,...t},o)=>{let{error:m,formItemId:s}=k();return v(A,{ref:o,className:a(m&&"text-destructive",e),htmlFor:s,...t})});$.displayName="FormLabel";var O=d.forwardRef(({...e},t)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=k();return v(Ie,{ref:t,id:m,"aria-describedby":o?`${s} ${i}`:`${s}`,"aria-invalid":!!o,...e})});O.displayName="FormControl";var q=d.forwardRef(({className:e,...t},o)=>{let{formDescriptionId:m}=k();return v("p",{ref:o,id:m,className:a("text-sm text-muted-foreground",e),...t})});q.displayName="FormDescription";var K=d.forwardRef(({className:e,children:t,...o},m)=>{let{error:s,formMessageId:i}=k(),c=s?String(s?.message??""):t;return c?v("p",{ref:m,id:i,className:a("text-sm font-medium text-destructive",e),...o,children:c}):null});K.displayName="FormMessage";import{jsx as R,jsxs as ae}from"react/jsx-runtime";function St({name:e,label:t,description:o,className:m,warningText:s,required:i,disabled:c,readOnly:I,placeholder:u,"aria-label":N,"aria-describedby":y,options:x,...P}){let{control:F}=ke();return R(X,{name:e,control:F,render:({field:p,fieldState:{error:f}})=>ae(B,{children:[t&&ae($,{children:[t,i&&R("span",{className:"text-destructive ml-1",children:"*"})]}),R(O,{children:R(ee,{...p,options:x,value:p.value||[],onChange:p.onChange,className:a(f&&"border-destructive focus-visible:ring-destructive",m),disabled:c||I,required:i,placeholder:u,"aria-label":N,"aria-describedby":y,"aria-invalid":!!f,"aria-required":i,...P})}),o&&R(q,{children:o}),f&&R(K,{children:f.message}),!f&&s&&R("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:s})]})})}export{St as RHFMultiSelect};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|