@me1a/ui 2.2.3 → 2.2.5
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.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-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 +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/organisms/drawer/drawer.tsx"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/organisms/drawer/drawer.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","/**\n * Drawer is a slide-out panel component that appears from the bottom of the screen.\n * It's built on top of Vaul and provides a smooth, accessible drawer experience.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/organisms-drawer--docs\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Drawer>\n * <DrawerTrigger>\n * <Button>Open Drawer</Button>\n * </DrawerTrigger>\n * <DrawerContent>\n * <DrawerHeader>\n * <DrawerTitle>Title</DrawerTitle>\n * <DrawerDescription>Description</DrawerDescription>\n * </DrawerHeader>\n * <div>Content</div>\n * <DrawerFooter>\n * <Button>Save</Button>\n * </DrawerFooter>\n * </DrawerContent>\n * </Drawer>\n * ```\n */\nimport { cn } from \"@/utils\"\nimport * as React from \"react\"\nimport { Drawer as DrawerPrimitive } from \"vaul\"\n\nconst Drawer = ({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (\n <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />\n)\nDrawer.displayName = \"Drawer\"\n\n/**\n * The trigger element that opens the drawer.\n * Should be used with the `asChild` prop to wrap your own trigger element.\n */\nconst DrawerTrigger = DrawerPrimitive.Trigger\n\n/**\n * Portal component that renders the drawer content outside the DOM hierarchy.\n * This ensures proper stacking context and accessibility.\n */\nconst DrawerPortal = DrawerPrimitive.Portal\n\n/**\n * Close button component for the drawer.\n * Should be used with the `asChild` prop to wrap your own close button.\n */\nconst DrawerClose = DrawerPrimitive.Close\n\n/**\n * Overlay component that appears behind the drawer.\n * Provides a semi-transparent backdrop and handles click-outside behavior.\n */\nconst DrawerOverlay = React.forwardRef<\n React.ElementRef<typeof DrawerPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Overlay\n ref={ref}\n className={cn(\"fixed inset-0 z-50 bg-black/80\", className)}\n {...props}\n />\n))\nDrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName\n\n/**\n * The main content container for the drawer.\n * Includes the handle bar at the top and manages the slide-up animation.\n */\nconst DrawerContent = React.forwardRef<\n React.ElementRef<typeof DrawerPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DrawerPortal>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background\",\n className\n )}\n {...props}\n >\n <div className=\"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted\" />\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n))\nDrawerContent.displayName = \"DrawerContent\"\n\n/**\n * Header section of the drawer.\n * Typically contains the title and description.\n */\nconst DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"grid gap-1.5 p-4 text-center sm:text-left\", className)} {...props} />\n)\nDrawerHeader.displayName = \"DrawerHeader\"\n\n/**\n * Footer section of the drawer.\n * Typically contains action buttons.\n */\nconst DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)} {...props} />\n)\nDrawerFooter.displayName = \"DrawerFooter\"\n\n/**\n * Title component for the drawer.\n * Should be used within DrawerHeader.\n */\nconst DrawerTitle = React.forwardRef<\n React.ElementRef<typeof DrawerPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n))\nDrawerTitle.displayName = DrawerPrimitive.Title.displayName\n\n/**\n * Description component for the drawer.\n * Should be used within DrawerHeader.\n */\nconst DrawerDescription = React.forwardRef<\n React.ElementRef<typeof DrawerPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nDrawerDescription.displayName = DrawerPrimitive.Description.displayName\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription\n}\n"],"mappings":"aAAA,OAA0B,QAAAA,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CCsBA,UAAYC,MAAW,QACvB,OAAS,UAAUC,MAAuB,OAMxC,cAAAC,EAgDE,QAAAC,MAhDF,oBAJF,IAAMC,EAAS,CAAC,CACd,sBAAAC,EAAwB,GACxB,GAAGC,CACL,IACEJ,EAACD,EAAgB,KAAhB,CAAqB,sBAAuBI,EAAwB,GAAGC,EAAO,EAEjFF,EAAO,YAAc,SAMrB,IAAMG,EAAgBN,EAAgB,QAMhCO,EAAeP,EAAgB,OAM/BQ,EAAcR,EAAgB,MAM9BS,EAAsB,aAG1B,CAAC,CAAE,UAAAC,EA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","props","DrawerTrigger","DrawerPortal","DrawerClose","DrawerOverlay","className","ref","cn","DrawerContent","children","DrawerHeader","DrawerFooter","DrawerTitle","DrawerDescription"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as d from
|
|
1
|
+
"use client";import*as d from"react";import*as e from"@radix-ui/react-dropdown-menu";import{Check as v,ChevronRight as y,Circle as g}from"lucide-react";import{clsx as R}from"clsx";import{twMerge as b}from"tailwind-merge";function a(...o){return b(R(o))}import{jsx as r,jsxs as s}from"react/jsx-runtime";var h=e.Root,x=e.Trigger,C=e.Group,I=e.Portal,N=e.Sub,S=e.RadioGroup,m=d.forwardRef(({className:o,inset:t,children:n,...i},p)=>s(e.SubTrigger,{ref:p,className:a("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",o),...i,children:[n,r(y,{className:"ml-auto h-4 w-4"})]}));m.displayName=e.SubTrigger.displayName;var u=d.forwardRef(({className:o,...t},n)=>r(e.SubContent,{ref:n,className:a("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",o),...t}));u.displayName=e.SubContent.displayName;var c=d.forwardRef(({className:o,sideOffset:t=4,...n},i)=>r(e.Portal,{children:r(e.Content,{ref:i,sideOffset:t,className:a("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",o),...n})}));c.displayName=e.Content.displayName;var l=d.forwardRef(({className:o,inset:t,...n},i)=>r(e.Item,{ref:i,className:a("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",o),...n}));l.displayName=e.Item.displayName;var w=d.forwardRef(({className:o,children:t,checked:n,...i},p)=>s(e.CheckboxItem,{ref:p,className:a("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o),checked:n,...i,children:[r("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r(e.ItemIndicator,{children:r(v,{className:"h-4 w-4"})})}),t]}));w.displayName=e.CheckboxItem.displayName;var f=d.forwardRef(({className:o,children:t,...n},i)=>s(e.RadioItem,{ref:i,className:a("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o),...n,children:[r("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r(e.ItemIndicator,{children:r(g,{className:"h-2 w-2 fill-current"})})}),t]}));f.displayName=e.RadioItem.displayName;var M=d.forwardRef(({className:o,inset:t,...n},i)=>r(e.Label,{ref:i,className:a("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",o),...n}));M.displayName=e.Label.displayName;var D=d.forwardRef(({className:o,...t},n)=>r(e.Separator,{ref:n,className:a("-mx-1 my-1 h-px bg-muted",o),...t}));D.displayName=e.Separator.displayName;var P=({className:o,...t})=>r("span",{className:a("ml-auto text-xs tracking-widest opacity-60",o),...t});P.displayName="DropdownMenuShortcut";export{h as DropdownMenu,w as DropdownMenuCheckboxItem,c as DropdownMenuContent,C as DropdownMenuGroup,l as DropdownMenuItem,M as DropdownMenuLabel,I as DropdownMenuPortal,S as DropdownMenuRadioGroup,f as DropdownMenuRadioItem,D as DropdownMenuSeparator,P as DropdownMenuShortcut,N as DropdownMenuSub,u as DropdownMenuSubContent,m as DropdownMenuSubTrigger,x as DropdownMenuTrigger};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/organisms/dropdown-menu/dropdown-menu.tsx"],"names":["cn","inputs","twMerge","clsx","DropdownMenu","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","className","inset","children","props","ref","jsxs","jsx","ChevronRight","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","Circle","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuShortcut"],"mappings":"mOAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCmBMG,IAAAA,CAAAA,CAAqC,OAErCC,CAA4C,CAAA,CAAA,CAAA,OAAA,CAE5CC,EAA0C,CAE1CC,CAAAA,KAAAA,CAAAA,CAAAA,CAA2C,SAE3CC,CAAwC,CAAA,CAAA,CAAA,GAAA,CAExCC,EAA+C,CAE/CC,CAAAA,UAAAA,CAAAA,CAAAA,CAA+B,aAKnC,CAAC,CAAE,UAAAC,CAAW,CAAA,KAAA,CAAAC,EAAO,QAAAC,CAAAA,CAAAA,CAAU,GAAGC,CAAM,CAAA,CAAGC,IAC3CC,IAAuB,CAAA,CAAA,CAAA,UAAA,CAAtB,CACC,GAAKD,CAAAA,CAAAA,CACL,UAAWf,CACT,CAAA,sIAAA,CACAY,GAAS,MACTD,CAAAA,CACF,EACC,GAAGG,CAAAA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AA,mCAAA,CAAqCY,GAAS,MAAQD,CAAAA,CAAS,EAC5E,GAAGG,CAAAA,CACN,CACD,EACDc,CAAAA,CAAkB,YAAoC,CAAM,CAAA,KAAA,CAAA,WAAA,KAEtDC,CAA8B,CAAA,CAAA,CAAA,UAAA,CAGlC,CAAC,CAAE,SAAA,CAAAlB,EAAW,GAAGG,CAAM,EAAGC,CAC1BE,GAAAA,GAAAA,CAAuB,YAAtB,CACC,GAAA,CAAKF,EACL,SAAWf,CAAAA,CAAAA,CAAG,2BAA4BW,CAAS,CAAA,CAClD,GAAGG,CACN,CAAA,CACD,EACDe,CAAsB,CAAA,WAAA,CAAoC,YAAU,WAEpE,CAAA,IAAMC,EAAuB,CAAC,CAAE,UAAAnB,CAAW,CAAA,GAAGG,CAAM,CAC3CG,GAAAA,GAAAA,CAAC,QAAK,SAAWjB,CAAAA,CAAAA,CAAG,6CAA8CW,CAAS,CAAA,CAAI,GAAGG,CAAO,CAAA,EAElGgB,EAAqB,WAAc,CAAA,sBAAA","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 * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\n\n/**\n * DropdownMenu component for creating accessible dropdown menus.\n * Built on top of Radix UI's DropdownMenu primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/organisms-dropdown-menu--docs\n *\n * @example\n * ```tsx\n * <DropdownMenu>\n * <DropdownMenuTrigger>Open Menu</DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Item 1</DropdownMenuItem>\n * <DropdownMenuItem>Item 2</DropdownMenuItem>\n * <DropdownMenuItem>Item 3</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n * ```\n */\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/organisms/dropdown-menu/dropdown-menu.tsx","../../src/utils/cn.ts"],"sourcesContent":["import * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\n\n/**\n * DropdownMenu component for creating accessible dropdown menus.\n * Built on top of Radix UI's DropdownMenu primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/organisms-dropdown-menu--docs\n *\n * @example\n * ```tsx\n * <DropdownMenu>\n * <DropdownMenuTrigger>Open Menu</DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Item 1</DropdownMenuItem>\n * <DropdownMenuItem>Item 2</DropdownMenuItem>\n * <DropdownMenuItem>Item 3</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n * ```\n */\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup\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"],"mappings":"aAAA,UAAYA,MAAW,QACvB,UAAYC,MAA2B,gCACvC,OAAS,SAAAC,EAAO,gBAAAC,EAAc,UAAAC,MAAc,eCF5C,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDqCE,OAUE,OAAAC,EAVF,QAAAC,MAAA,oBAlBF,IAAMC,EAAqC,OAErCC,EAA4C,UAE5CC,EAA0C,QAE1CC,EAA2C,SAE3CC,EAAwC,MAExCC,EAA+C,aAE/CC,EAA+B,aAKnC,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAC3CZ,EAAuB,aAAtB,CACC,IAAKY,EACL,UAAWC,EACT,uIACAJ,GAAS,OACTD,CACF,EACC,GAAGG,EAEH,UAAAD,EACDX,EAACe,EAAA,CAAa,UAAU,kBAAkB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,UAAU,+DACd,SAAAA,EAAuB,gBAAtB,CACC,SAAAA,EAACwB,EAAA,CAAO,UAAU,uBAAuB,EAC3C,EACF,EACCb,GACH,CACD,EACDY,EAAsB,YAAoC,YAAU,YAEpE,IAAME,EAA0B,aAK9B,CAAC,CAAE,UAAAhB,EAAW,MAAAC,EAAO,GAAGE,CAAM,EAAGC,IACjCb,EAAuB,QAAtB,CACC,IAAKa,EACL,UAAWC,EAAG,oCAAqCJ,GAAS,OAAQD,CAAS,EAC5E,GAAGG,EACN,CACD,EACDa,EAAkB,YAAoC,QAAM,YAE5D,IAAMC,EAA8B,aAGlC,CAAC,CAAE,UAAAjB,EAAW,GAAGG,CAAM,EAAGC,IAC1Bb,EAAuB,YAAtB,CACC,IAAKa,EACL,UAAWC,EAAG,2BAA4BL,CAAS,EAClD,GAAGG,EACN,CACD,EACDc,EAAsB,YAAoC,YAAU,YAEpE,IAAMC,EAAuB,CAAC,CAAE,UAAAlB,EAAW,GAAGG,CAAM,IAC3CZ,EAAC,QAAK,UAAWc,EAAG,6CAA8CL,CAAS,EAAI,GAAGG,EAAO,EAElGe,EAAqB,YAAc","names":["React","DropdownMenuPrimitive","Check","ChevronRight","Circle","clsx","twMerge","cn","inputs","jsx","jsxs","DropdownMenu","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","className","inset","children","props","ref","cn","ChevronRight","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","Circle","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuShortcut"]}
|
package/dist/form/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as o from
|
|
1
|
+
"use client";import*as o from"react";import{Slot as T}from"@radix-ui/react-slot";import{Controller as g,FormProvider as M,useFormContext as h}from"react-hook-form";import{clsx as y}from"clsx";import{twMerge as L}from"tailwind-merge";function s(...e){return L(y(e))}import*as F from"react";import*as p from"@radix-ui/react-label";import{cva as V}from"class-variance-authority";import{jsx as v}from"react/jsx-runtime";var I=V("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=F.forwardRef(({className:e,...r},t)=>v(p.Root,{ref:t,className:s(I(),e),...r}));d.displayName=p.Root.displayName;import{jsx as l}from"react/jsx-runtime";var N=M,f=o.createContext({}),w=({...e})=>l(f.Provider,{value:{name:e.name},children:l(g,{...e})}),n=()=>{let e=o.useContext(f),r=o.useContext(u),{getFieldState:t,formState:a}=h(),m=t(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:i}=r;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...m}},u=o.createContext({}),R=o.forwardRef(({className:e,...r},t)=>{let a=o.useId();return l(u.Provider,{value:{id:a},children:l("div",{ref:t,className:s("space-y-2",e),...r})})});R.displayName="FormItem";var P=o.forwardRef(({className:e,...r},t)=>{let{error:a,formItemId:m}=n();return l(d,{ref:t,className:s(a&&"text-destructive",e),htmlFor:m,...r})});P.displayName="FormLabel";var x=o.forwardRef(({...e},r)=>{let{error:t,formItemId:a,formDescriptionId:m,formMessageId:i}=n();return l(T,{ref:r,id:a,"aria-describedby":t?`${m} ${i}`:`${m}`,"aria-invalid":!!t,...e})});x.displayName="FormControl";var C=o.forwardRef(({className:e,...r},t)=>{let{formDescriptionId:a}=n();return l("p",{ref:t,id:a,className:s("text-sm text-muted-foreground",e),...r})});C.displayName="FormDescription";var b=o.forwardRef(({className:e,children:r,...t},a)=>{let{error:m,formMessageId:i}=n(),c=m?String(m?.message??""):r;return c?l("p",{ref:a,id:i,className:s("text-sm font-medium text-destructive",e),...t,children:c}):null});b.displayName="FormMessage";export{N as Form,x as FormControl,C as FormDescription,w as FormField,R as FormItem,P as FormLabel,b as FormMessage,n as useFormField};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/form/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/rhf/form/form.tsx","../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx"],"sourcesContent":["\"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 { 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":"aAGA,UAAYA,MAAW,QAEvB,OAAS,QAAAC,MAAY,uBACrB,OACE,cAAAC,EACA,gBAAAC,EACA,kBAAAC,MAIK,kBCbP,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,YFWlC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EACDe,EAAU,YAAc,YAExB,IAAMI,EAAoB,aAGxB,CAAC,CAAE,GAAGnB,CAAM,EAAGa,IAAQ,CACvB,GAAM,CAAE,MAAAG,EAAO,WAAAC,EAAY,kBAAAG,EAAmB,cAAAC,CAAc,EAAInB,EAAa,EAE7E,OACEP,EAAC2B,EAAA,CACC,IAAKT,EACL,GAAII,EACJ,mBAAmBD,EAAiC,GAAGI,CAAiB,IAAIC,CAAa,GAA9D,GAAGD,CAAiB,GAC/C,eAAc,CAAC,CAACJ,EACf,GAAGhB,EACN,CAEJ,CAAC,EACDmB,EAAY,YAAc,cAE1B,IAAMI,EAAwB,aAG5B,CAAC,CAAE,UAAAX,EAAW,GAAGZ,CAAM,EAAGa,IAAQ,CAClC,GAAM,CAAE,kBAAAO,CAAkB,EAAIlB,EAAa,EAE3C,OACEP,EAAC,KACC,IAAKkB,EACL,GAAIO,EACJ,UAAWN,EAAG,gCAAiCF,CAAS,EACvD,GAAGZ,EACN,CAEJ,CAAC,EACDuB,EAAgB,YAAc,kBAE9B,IAAMC,EAAoB,aAGxB,CAAC,CAAE,UAAAZ,EAAW,SAAAa,EAAU,GAAGzB,CAAM,EAAGa,IAAQ,CAC5C,GAAM,CAAE,MAAAG,EAAO,cAAAK,CAAc,EAAInB,EAAa,EACxCwB,EAAOV,EAAQ,OAAOA,GAAO,SAAW,EAAE,EAAIS,EAEpD,OAAKC,EAKH/B,EAAC,KACC,IAAKkB,EACL,GAAIQ,EACJ,UAAWP,EAAG,uCAAwCF,CAAS,EAC9D,GAAGZ,EAEH,SAAA0B,EACH,EAXO,IAaX,CAAC,EACDF,EAAY,YAAc","names":["React","Slot","Controller","FormProvider","useFormContext","clsx","twMerge","cn","inputs","React","LabelPrimitive","cva","jsx","labelVariants","cva","Label","className","props","ref","cn","jsx","Form","FormProvider","FormFieldContext","FormField","props","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"]}
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as a from
|
|
1
|
+
import*as a from"react";var S=768;function y(){let[t,e]=a.useState(void 0);return a.useEffect(()=>{let o=window.matchMedia(`(max-width: ${S-1}px)`),s=()=>{e(window.innerWidth<S)};return o.addEventListener("change",s),e(window.innerWidth<S),()=>o.removeEventListener("change",s)},[]),!!t}import*as r from"react";var u=1,O=1e6;var p=0;function f(){return p=(p+1)%Number.MAX_SAFE_INTEGER,p.toString()}var A=new Map,d=t=>{if(A.has(t))return;let e=setTimeout(()=>{A.delete(t),n({type:"REMOVE_TOAST",toastId:t})},O);A.set(t,e)},E=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,u)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(o=>o.id===e.toast.id?{...o,...e.toast}:o)};case"DISMISS_TOAST":{let{toastId:o}=e;return o?d(o):t.toasts.forEach(s=>{d(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===o||o===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(o=>o.id!==e.toastId)}}},T=[],i={toasts:[]};function n(t){i=E(i,t),T.forEach(e=>{e(i)})}function m({...t}){let e=f(),o=c=>n({type:"UPDATE_TOAST",toast:{...c,id:e}}),s=()=>n({type:"DISMISS_TOAST",toastId:e});return n({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:c=>{c||s()}}}),{id:e,dismiss:s,update:o}}function I(){let[t,e]=r.useState(i);return r.useEffect(()=>(T.push(e),()=>{let o=T.indexOf(e);o>-1&&T.splice(o,1)}),[t]),{...t,toast:m,dismiss:o=>n({type:"DISMISS_TOAST",toastId:o})}}export{E as reducer,m as toast,y as useIsMobile,I as useToast};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/hooks/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-mobile.tsx","../../src/hooks/use-toast.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-mobile.tsx","../../src/hooks/use-toast.ts"],"sourcesContent":["\"use client\";\n\"use client\"\n\nimport * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener(\"change\", onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener(\"change\", onChange)\n }, [])\n\n return !!isMobile\n}\n","\"use client\";\n\"use client\"\n\n// Inspired by react-hot-toast library\nimport * as React from \"react\"\n\nimport type { ToastActionElement, ToastProps } from \"@/components/atoms/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\"\n} as const\n\nlet count = 0\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"]\n toast: ToasterToast\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"]\n toast: Partial<ToasterToast>\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId\n })\n }, TOAST_REMOVE_DELAY)\n\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)\n }\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t))\n }\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id)\n })\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false\n }\n : t\n )\n }\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: []\n }\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId)\n }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\n\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((listener) => {\n listener(memoryState)\n })\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id }\n })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss()\n }\n }\n })\n\n return {\n id: id,\n dismiss,\n update\n }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) {\n listeners.splice(index, 1)\n }\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId })\n }\n}\n\nexport { useToast, toast }\n"],"mappings":"AAGA,UAAYA,MAAW,QAEvB,IAAMC,EAAoB,IAEnB,SAASC,GAAc,CAC5B,GAAM,CAACC,EAAUC,CAAW,EAAU,WAA8B,MAAS,EAE7E,OAAM,YAAU,IAAM,CACpB,IAAMC,EAAM,OAAO,WAAW,eAAeJ,EAAoB,CAAC,KAAK,EACjEK,EAAW,IAAM,CACrBF,EAAY,OAAO,WAAaH,CAAiB,CACnD,EACA,OAAAI,EAAI,iBAAiB,SAAUC,CAAQ,EACvCF,EAAY,OAAO,WAAaH,CAAiB,EAC1C,IAAMI,EAAI,oBAAoB,SAAUC,CAAQ,CACzD,EAAG,CAAC,CAAC,EAEE,CAAC,CAACH,CACX,CCjBA,UAAYI,MAAW,QAIvB,IAAMC,EAAc,EACdC,EAAqB,IAgB3B,IAAIC,EAAQ,EAEZ,SAASC,GAAQ,CACf,OAAAD,GAASA,EAAQ,GAAK,OAAO,iBACtBA,EAAM,SAAS,CACxB,CA0BA,IAAME,EAAgB,IAAI,IAEpBC,EAAoBC,GAAoB,CAC5C,GAAIF,EAAc,IAAIE,CAAO,EAC3B,OAGF,IAAMC,EAAU,WAAW,IAAM,CAC/BH,EAAc,OAAOE,CAAO,EAC5BE,EAAS,CACP,KAAM,eACN,QAASF,CACX,CAAC,CACH,EAAGG,CAAkB,EAErBL,EAAc,IAAIE,EAASC,CAAO,CACp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G,CAAC,EAErE,OAAAZ,EAAS,CACP,KAAM,YACN,MAAO,CACL,GAAGW,EACH,GAAAC,EACA,KAAM,GACN,aAAeG,GAAS,CACjBA,GAAMD,EAAQ,CACrB,CACF,CACF,CAAC,EAEM,CACL,GAAIF,EACJ,QAAAE,EACA,OAAAD,CACF,CACF,CAEA,SAASG,GAAW,CAClB,GAAM,CAACb,EAAOc,CAAQ,EAAU,WAAgBR,CAAW,EAE3D,OAAM,YAAU,KACdD,EAAU,KAAKS,CAAQ,EAChB,IAAM,CACX,IAAMC,EAAQV,EAAU,QAAQS,CAAQ,EACpCC,EAAQ,IACVV,EAAU,OAAOU,EAAO,CAAC,CAE7B,GACC,CAACf,CAAK,CAAC,EAEH,CACL,GAAGA,EACH,MAAAI,EACA,QAAUT,GAAqBE,EAAS,CAAE,KAAM,gBAAiB,QAAAF,CAAQ,CAAC,CAC5E,CACF","names":["React","MOBILE_BREAKPOINT","useIsMobile","isMobile","setIsMobile","mql","onChange","React","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","TOAST_REMOVE_DELAY","reducer","state","action","TOAST_LIMIT","t","toast","listeners","memoryState","listener","props","id","update","dismiss","open","useToast","setState","index"]}
|