@me1a/ui 2.2.1 → 2.2.3
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.d.mts +94 -0
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/avatar/index.d.mts +34 -0
- package/dist/avatar/index.mjs +2 -0
- package/dist/avatar/index.mjs.map +1 -0
- package/dist/badge/index.d.mts +41 -0
- package/dist/badge/index.mjs +2 -0
- package/dist/badge/index.mjs.map +1 -0
- package/dist/box/index.d.mts +50 -0
- package/dist/box/index.mjs +2 -0
- package/dist/box/index.mjs.map +1 -0
- package/dist/breadcrumb/index.d.mts +35 -0
- package/dist/breadcrumb/index.mjs +2 -0
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/{tooltip-B4jzaurK.d.mts → button/index.d.mts} +3 -25
- package/dist/button/index.mjs +2 -0
- package/dist/button/index.mjs.map +1 -0
- package/dist/card/index.d.mts +127 -0
- package/dist/card/index.mjs +2 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +21 -0
- package/dist/checkbox/index.mjs +2 -0
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +26 -0
- package/dist/collapsible/index.mjs +2 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/command/index.d.mts +122 -0
- package/dist/command/index.mjs +2 -0
- package/dist/command/index.mjs.map +1 -0
- package/dist/container/index.d.mts +33 -0
- package/dist/container/index.mjs +2 -0
- package/dist/container/index.mjs.map +1 -0
- package/dist/dialog/index.d.mts +35 -0
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/drawer/index.d.mts +63 -0
- package/dist/drawer/index.mjs +2 -0
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/dropdown-menu/index.d.mts +335 -0
- package/dist/dropdown-menu/index.mjs +2 -0
- package/dist/dropdown-menu/index.mjs.map +1 -0
- package/dist/form/index.d.mts +96 -0
- package/dist/form/index.mjs +2 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/{hooks.d.mts → hooks/index.d.mts} +10 -4
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +2739 -30
- package/dist/index.mjs +47 -0
- package/dist/{index.esm.js.map → index.mjs.map} +1 -1
- package/dist/input/index.d.mts +12 -0
- package/dist/input/index.mjs +2 -0
- package/dist/input/index.mjs.map +1 -0
- package/dist/label/index.d.mts +18 -0
- package/dist/label/index.mjs +2 -0
- package/dist/label/index.mjs.map +1 -0
- package/dist/navigation-menu/index.d.mts +104 -0
- package/dist/navigation-menu/index.mjs +2 -0
- package/dist/navigation-menu/index.mjs.map +1 -0
- package/dist/page-loader/index.d.mts +29 -0
- package/dist/page-loader/index.mjs +2 -0
- package/dist/page-loader/index.mjs.map +1 -0
- package/dist/pagination/index.d.mts +105 -0
- package/dist/pagination/index.mjs +2 -0
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/popover/index.d.mts +30 -0
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/{checkbox-DxgDKaHx.d.mts → radio-group/index.d.mts} +5 -51
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/resizable/index.d.mts +53 -0
- package/dist/resizable/index.mjs +2 -0
- package/dist/resizable/index.mjs.map +1 -0
- package/dist/rhf-checkbox/index.d.mts +57 -0
- package/dist/rhf-checkbox/index.mjs +2 -0
- package/dist/rhf-checkbox/index.mjs.map +1 -0
- package/dist/rhf-multi-select/index.d.mts +84 -0
- package/dist/rhf-multi-select/index.mjs +2 -0
- package/dist/rhf-multi-select/index.mjs.map +1 -0
- package/dist/rhf-radio-button-group/index.d.mts +73 -0
- package/dist/rhf-radio-button-group/index.mjs +2 -0
- package/dist/rhf-radio-button-group/index.mjs.map +1 -0
- package/dist/rhf-radio-group/index.d.mts +103 -0
- package/dist/rhf-radio-group/index.mjs +2 -0
- package/dist/rhf-radio-group/index.mjs.map +1 -0
- package/dist/rhf-select/index.d.mts +80 -0
- package/dist/rhf-select/index.mjs +2 -0
- package/dist/rhf-select/index.mjs.map +1 -0
- package/dist/rhf-switch/index.d.mts +57 -0
- package/dist/rhf-switch/index.mjs +2 -0
- package/dist/rhf-switch/index.mjs.map +1 -0
- package/dist/rhf-textarea/index.d.mts +66 -0
- package/dist/rhf-textarea/index.mjs +2 -0
- package/dist/rhf-textarea/index.mjs.map +1 -0
- package/dist/separator/index.d.mts +13 -0
- package/dist/separator/index.mjs +2 -0
- package/dist/separator/index.mjs.map +1 -0
- package/dist/sheet/index.d.mts +42 -0
- package/dist/sheet/index.mjs +2 -0
- package/dist/sheet/index.mjs.map +1 -0
- package/dist/sidebar/index.d.mts +328 -0
- package/dist/sidebar/index.mjs +2 -0
- package/dist/sidebar/index.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +17 -0
- package/dist/skeleton/index.mjs +2 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/stack/index.d.mts +121 -0
- package/dist/stack/index.mjs +2 -0
- package/dist/stack/index.mjs.map +1 -0
- package/dist/switch/index.d.mts +21 -0
- package/dist/switch/index.mjs +2 -0
- package/dist/switch/index.mjs.map +1 -0
- package/dist/table/index.d.mts +53 -0
- package/dist/table/index.mjs +2 -0
- package/dist/table/index.mjs.map +1 -0
- package/dist/tabs/index.d.mts +97 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/text-field/index.d.mts +65 -0
- package/dist/text-field/index.mjs +2 -0
- package/dist/text-field/index.mjs.map +1 -0
- package/dist/textarea/index.d.mts +24 -0
- package/dist/textarea/index.mjs +2 -0
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/{toast-2xT7L1tJ.d.mts → toast/index.d.mts} +3 -3
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toaster/index.d.mts +26 -0
- package/dist/toaster/index.mjs +2 -0
- package/dist/toaster/index.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +25 -0
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/{index.cjs.js.map → types/index.mjs.map} +1 -1
- package/dist/typography/index.d.mts +24 -0
- package/dist/typography/index.mjs +2 -0
- package/dist/typography/index.mjs.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +199 -34
- package/dist/atoms.cjs.js +0 -2
- package/dist/atoms.cjs.js.map +0 -1
- package/dist/atoms.d.mts +0 -1051
- package/dist/atoms.d.ts +0 -1051
- package/dist/atoms.esm.js +0 -2
- package/dist/atoms.esm.js.map +0 -1
- package/dist/checkbox-DxgDKaHx.d.ts +0 -108
- package/dist/chunk-23T2PH5G.esm.js +0 -2
- package/dist/chunk-23T2PH5G.esm.js.map +0 -1
- package/dist/chunk-2QG3QTSW.cjs.js +0 -2
- package/dist/chunk-2QG3QTSW.cjs.js.map +0 -1
- package/dist/chunk-C26U3FL4.esm.js +0 -2
- package/dist/chunk-C26U3FL4.esm.js.map +0 -1
- package/dist/chunk-DTM5LZHM.cjs.js +0 -2
- package/dist/chunk-DTM5LZHM.cjs.js.map +0 -1
- package/dist/chunk-HW32JE75.cjs.js +0 -2
- package/dist/chunk-HW32JE75.cjs.js.map +0 -1
- package/dist/chunk-JIRS6MWF.cjs.js +0 -2
- package/dist/chunk-JIRS6MWF.cjs.js.map +0 -1
- package/dist/chunk-JKTYFZ5M.esm.js +0 -2
- package/dist/chunk-JKTYFZ5M.esm.js.map +0 -1
- package/dist/chunk-JUZG25DH.esm.js +0 -2
- package/dist/chunk-JUZG25DH.esm.js.map +0 -1
- package/dist/chunk-KOYJODOP.cjs.js +0 -2
- package/dist/chunk-KOYJODOP.cjs.js.map +0 -1
- package/dist/chunk-M4S5YZ56.esm.js +0 -2
- package/dist/chunk-M4S5YZ56.esm.js.map +0 -1
- package/dist/chunk-MOYOCJW6.esm.js +0 -2
- package/dist/chunk-MOYOCJW6.esm.js.map +0 -1
- package/dist/chunk-MVWMLXLL.cjs.js +0 -2
- package/dist/chunk-MVWMLXLL.cjs.js.map +0 -1
- package/dist/chunk-SL2ZUI4G.cjs.js +0 -2
- package/dist/chunk-SL2ZUI4G.cjs.js.map +0 -1
- package/dist/chunk-STRDPP3B.esm.js +0 -2
- package/dist/chunk-STRDPP3B.esm.js.map +0 -1
- package/dist/chunk-U4NMIMU7.esm.js +0 -2
- package/dist/chunk-U4NMIMU7.esm.js.map +0 -1
- package/dist/chunk-UK47BFA3.cjs.js +0 -2
- package/dist/chunk-UK47BFA3.cjs.js.map +0 -1
- package/dist/chunk-UTVXFZLD.esm.js +0 -2
- package/dist/chunk-UTVXFZLD.esm.js.map +0 -1
- package/dist/chunk-WJNYKJP6.cjs.js +0 -2
- package/dist/chunk-WJNYKJP6.cjs.js.map +0 -1
- package/dist/chunk-YEZB7AOJ.esm.js +0 -2
- package/dist/chunk-YEZB7AOJ.esm.js.map +0 -1
- package/dist/chunk-YGLYFSF6.cjs.js +0 -2
- package/dist/chunk-YGLYFSF6.cjs.js.map +0 -1
- package/dist/hooks.cjs.js +0 -2
- package/dist/hooks.cjs.js.map +0 -1
- package/dist/hooks.d.ts +0 -51
- package/dist/hooks.esm.js +0 -2
- package/dist/hooks.esm.js.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.d.ts +0 -30
- package/dist/index.esm.js +0 -2
- package/dist/molecules.cjs.js +0 -2
- package/dist/molecules.cjs.js.map +0 -1
- package/dist/molecules.d.mts +0 -201
- package/dist/molecules.d.ts +0 -201
- package/dist/molecules.esm.js +0 -2
- package/dist/molecules.esm.js.map +0 -1
- package/dist/organisms.cjs.js +0 -2
- package/dist/organisms.cjs.js.map +0 -1
- package/dist/organisms.d.mts +0 -673
- package/dist/organisms.d.ts +0 -673
- package/dist/organisms.esm.js +0 -2
- package/dist/organisms.esm.js.map +0 -1
- package/dist/rhf.cjs.js +0 -2
- package/dist/rhf.cjs.js.map +0 -1
- package/dist/rhf.d.mts +0 -408
- package/dist/rhf.d.ts +0 -408
- package/dist/rhf.esm.js +0 -2
- package/dist/rhf.esm.js.map +0 -1
- package/dist/toast-2xT7L1tJ.d.ts +0 -18
- package/dist/tooltip-B4jzaurK.d.ts +0 -104
- package/dist/types.cjs.js +0 -2
- package/dist/types.cjs.js.map +0 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.esm.js +0 -2
- package/dist/types.esm.js.map +0 -1
- package/dist/utils.cjs.js +0 -2
- package/dist/utils.cjs.js.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.esm.js +0 -2
- package/dist/utils.esm.js.map +0 -1
- /package/dist/{types.d.mts → types/index.d.mts} +0 -0
- /package/dist/{utils.d.mts → utils/index.d.mts} +0 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DropdownMenu component for creating accessible dropdown menus.
|
|
9
|
+
* Built on top of Radix UI's DropdownMenu primitive.
|
|
10
|
+
*
|
|
11
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/organisms-dropdown-menu--docs
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <DropdownMenu>
|
|
16
|
+
* <DropdownMenuTrigger>Open Menu</DropdownMenuTrigger>
|
|
17
|
+
* <DropdownMenuContent>
|
|
18
|
+
* <DropdownMenuItem>Item 1</DropdownMenuItem>
|
|
19
|
+
* <DropdownMenuItem>Item 2</DropdownMenuItem>
|
|
20
|
+
* <DropdownMenuItem>Item 3</DropdownMenuItem>
|
|
21
|
+
* </DropdownMenuContent>
|
|
22
|
+
* </DropdownMenu>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const DropdownMenu: React$1.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
26
|
+
declare const DropdownMenuTrigger: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
declare const DropdownMenuGroup: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
declare const DropdownMenuPortal: React$1.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
29
|
+
declare const DropdownMenuSub: React$1.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
30
|
+
declare const DropdownMenuRadioGroup: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const DropdownMenuSubTrigger: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
32
|
+
inset?: boolean;
|
|
33
|
+
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const DropdownMenuSubContent: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
declare const DropdownMenuContent: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
declare const DropdownMenuItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
37
|
+
inset?: boolean;
|
|
38
|
+
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
declare const DropdownMenuCheckboxItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
declare const DropdownMenuRadioItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
declare const DropdownMenuLabel: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
42
|
+
inset?: boolean;
|
|
43
|
+
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
declare const DropdownMenuSeparator: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
declare const DropdownMenuShortcut: {
|
|
46
|
+
({ className, ...props }: React$1.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
declare const dropdownMenuTriggerStyle: (props?: ({
|
|
51
|
+
variant?: "link" | "default" | "outline" | "ghost" | null | undefined;
|
|
52
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
53
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
54
|
+
|
|
55
|
+
type DropdownMenuTriggerVariants = VariantProps<typeof dropdownMenuTriggerStyle>;
|
|
56
|
+
interface DropdownMenuProps {
|
|
57
|
+
/**
|
|
58
|
+
* The content of the dropdown menu
|
|
59
|
+
*/
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* The open state of the dropdown menu
|
|
63
|
+
*/
|
|
64
|
+
open?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The default open state of the dropdown menu
|
|
67
|
+
*/
|
|
68
|
+
defaultOpen?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The controlled open state of the dropdown menu
|
|
71
|
+
*/
|
|
72
|
+
onOpenChange?: (open: boolean) => void;
|
|
73
|
+
/**
|
|
74
|
+
* The modal state of the dropdown menu
|
|
75
|
+
*/
|
|
76
|
+
modal?: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface DropdownMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, DropdownMenuTriggerVariants {
|
|
79
|
+
/**
|
|
80
|
+
* The content of the trigger
|
|
81
|
+
*/
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* The variant of the trigger
|
|
85
|
+
*/
|
|
86
|
+
variant?: DropdownMenuTriggerVariants["variant"];
|
|
87
|
+
/**
|
|
88
|
+
* The size of the trigger
|
|
89
|
+
*/
|
|
90
|
+
size?: DropdownMenuTriggerVariants["size"];
|
|
91
|
+
}
|
|
92
|
+
interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
93
|
+
/**
|
|
94
|
+
* The content of the dropdown menu
|
|
95
|
+
*/
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* The side offset of the dropdown menu
|
|
99
|
+
*/
|
|
100
|
+
sideOffset?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The align offset of the dropdown menu
|
|
103
|
+
*/
|
|
104
|
+
alignOffset?: number;
|
|
105
|
+
/**
|
|
106
|
+
* The side of the dropdown menu
|
|
107
|
+
*/
|
|
108
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
109
|
+
/**
|
|
110
|
+
* The alignment of the dropdown menu
|
|
111
|
+
*/
|
|
112
|
+
align?: "start" | "center" | "end";
|
|
113
|
+
/**
|
|
114
|
+
* The collision padding of the dropdown menu
|
|
115
|
+
*/
|
|
116
|
+
collisionPadding?: number;
|
|
117
|
+
/**
|
|
118
|
+
* The collision boundary of the dropdown menu
|
|
119
|
+
*/
|
|
120
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
121
|
+
/**
|
|
122
|
+
* The arrow padding of the dropdown menu
|
|
123
|
+
*/
|
|
124
|
+
arrowPadding?: number;
|
|
125
|
+
/**
|
|
126
|
+
* The sticky state of the dropdown menu
|
|
127
|
+
*/
|
|
128
|
+
sticky?: "partial" | "always";
|
|
129
|
+
/**
|
|
130
|
+
* The hide when detached state of the dropdown menu
|
|
131
|
+
*/
|
|
132
|
+
hideWhenDetached?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* The update position strategy of the dropdown menu
|
|
135
|
+
*/
|
|
136
|
+
updatePositionStrategy?: "optimized" | "always";
|
|
137
|
+
/**
|
|
138
|
+
* The force mount state of the dropdown menu
|
|
139
|
+
*/
|
|
140
|
+
forceMount?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* The container of the dropdown menu
|
|
143
|
+
*/
|
|
144
|
+
container?: HTMLElement;
|
|
145
|
+
}
|
|
146
|
+
interface DropdownMenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
147
|
+
/**
|
|
148
|
+
* The content of the dropdown menu item
|
|
149
|
+
*/
|
|
150
|
+
children: React.ReactNode;
|
|
151
|
+
/**
|
|
152
|
+
* The inset state of the dropdown menu item
|
|
153
|
+
*/
|
|
154
|
+
inset?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* The disabled state of the dropdown menu item
|
|
157
|
+
*/
|
|
158
|
+
disabled?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* The selected state of the dropdown menu item
|
|
161
|
+
*/
|
|
162
|
+
selected?: boolean;
|
|
163
|
+
}
|
|
164
|
+
interface DropdownMenuCheckboxItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
165
|
+
/**
|
|
166
|
+
* The content of the dropdown menu checkbox item
|
|
167
|
+
*/
|
|
168
|
+
children: React.ReactNode;
|
|
169
|
+
/**
|
|
170
|
+
* The checked state of the dropdown menu checkbox item
|
|
171
|
+
*/
|
|
172
|
+
checked?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* The disabled state of the dropdown menu checkbox item
|
|
175
|
+
*/
|
|
176
|
+
disabled?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The on checked change handler of the dropdown menu checkbox item
|
|
179
|
+
*/
|
|
180
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
181
|
+
}
|
|
182
|
+
interface DropdownMenuRadioItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
183
|
+
/**
|
|
184
|
+
* The content of the dropdown menu radio item
|
|
185
|
+
*/
|
|
186
|
+
children: React.ReactNode;
|
|
187
|
+
/**
|
|
188
|
+
* The value of the dropdown menu radio item
|
|
189
|
+
*/
|
|
190
|
+
value: string;
|
|
191
|
+
/**
|
|
192
|
+
* The disabled state of the dropdown menu radio item
|
|
193
|
+
*/
|
|
194
|
+
disabled?: boolean;
|
|
195
|
+
}
|
|
196
|
+
interface DropdownMenuLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
197
|
+
/**
|
|
198
|
+
* The content of the dropdown menu label
|
|
199
|
+
*/
|
|
200
|
+
children: React.ReactNode;
|
|
201
|
+
/**
|
|
202
|
+
* The inset state of the dropdown menu label
|
|
203
|
+
*/
|
|
204
|
+
inset?: boolean;
|
|
205
|
+
}
|
|
206
|
+
interface DropdownMenuSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
207
|
+
}
|
|
208
|
+
interface DropdownMenuShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
209
|
+
/**
|
|
210
|
+
* The content of the dropdown menu shortcut
|
|
211
|
+
*/
|
|
212
|
+
children: React.ReactNode;
|
|
213
|
+
}
|
|
214
|
+
interface DropdownMenuGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
215
|
+
/**
|
|
216
|
+
* The content of the dropdown menu group
|
|
217
|
+
*/
|
|
218
|
+
children: React.ReactNode;
|
|
219
|
+
}
|
|
220
|
+
interface DropdownMenuPortalProps {
|
|
221
|
+
/**
|
|
222
|
+
* The content of the dropdown menu portal
|
|
223
|
+
*/
|
|
224
|
+
children: React.ReactNode;
|
|
225
|
+
/**
|
|
226
|
+
* The container of the dropdown menu portal
|
|
227
|
+
*/
|
|
228
|
+
container?: HTMLElement;
|
|
229
|
+
}
|
|
230
|
+
interface DropdownMenuSubProps {
|
|
231
|
+
/**
|
|
232
|
+
* The content of the dropdown menu sub
|
|
233
|
+
*/
|
|
234
|
+
children: React.ReactNode;
|
|
235
|
+
/**
|
|
236
|
+
* The open state of the dropdown menu sub
|
|
237
|
+
*/
|
|
238
|
+
open?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* The default open state of the dropdown menu sub
|
|
241
|
+
*/
|
|
242
|
+
defaultOpen?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* The controlled open state of the dropdown menu sub
|
|
245
|
+
*/
|
|
246
|
+
onOpenChange?: (open: boolean) => void;
|
|
247
|
+
}
|
|
248
|
+
interface DropdownMenuSubContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
249
|
+
/**
|
|
250
|
+
* The content of the dropdown menu sub content
|
|
251
|
+
*/
|
|
252
|
+
children: React.ReactNode;
|
|
253
|
+
/**
|
|
254
|
+
* The side offset of the dropdown menu sub content
|
|
255
|
+
*/
|
|
256
|
+
sideOffset?: number;
|
|
257
|
+
/**
|
|
258
|
+
* The align offset of the dropdown menu sub content
|
|
259
|
+
*/
|
|
260
|
+
alignOffset?: number;
|
|
261
|
+
/**
|
|
262
|
+
* The side of the dropdown menu sub content
|
|
263
|
+
*/
|
|
264
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
265
|
+
/**
|
|
266
|
+
* The alignment of the dropdown menu sub content
|
|
267
|
+
*/
|
|
268
|
+
align?: "start" | "center" | "end";
|
|
269
|
+
/**
|
|
270
|
+
* The collision padding of the dropdown menu sub content
|
|
271
|
+
*/
|
|
272
|
+
collisionPadding?: number;
|
|
273
|
+
/**
|
|
274
|
+
* The collision boundary of the dropdown menu sub content
|
|
275
|
+
*/
|
|
276
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
277
|
+
/**
|
|
278
|
+
* The arrow padding of the dropdown menu sub content
|
|
279
|
+
*/
|
|
280
|
+
arrowPadding?: number;
|
|
281
|
+
/**
|
|
282
|
+
* The sticky state of the dropdown menu sub content
|
|
283
|
+
*/
|
|
284
|
+
sticky?: "partial" | "always";
|
|
285
|
+
/**
|
|
286
|
+
* The hide when detached state of the dropdown menu sub content
|
|
287
|
+
*/
|
|
288
|
+
hideWhenDetached?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* The update position strategy of the dropdown menu sub content
|
|
291
|
+
*/
|
|
292
|
+
updatePositionStrategy?: "optimized" | "always";
|
|
293
|
+
/**
|
|
294
|
+
* The force mount state of the dropdown menu sub content
|
|
295
|
+
*/
|
|
296
|
+
forceMount?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* The container of the dropdown menu sub content
|
|
299
|
+
*/
|
|
300
|
+
container?: HTMLElement;
|
|
301
|
+
}
|
|
302
|
+
interface DropdownMenuSubTriggerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
303
|
+
/**
|
|
304
|
+
* The content of the dropdown menu sub trigger
|
|
305
|
+
*/
|
|
306
|
+
children: React.ReactNode;
|
|
307
|
+
/**
|
|
308
|
+
* The inset state of the dropdown menu sub trigger
|
|
309
|
+
*/
|
|
310
|
+
inset?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* The disabled state of the dropdown menu sub trigger
|
|
313
|
+
*/
|
|
314
|
+
disabled?: boolean;
|
|
315
|
+
}
|
|
316
|
+
interface DropdownMenuRadioGroupProps {
|
|
317
|
+
/**
|
|
318
|
+
* The content of the dropdown menu radio group
|
|
319
|
+
*/
|
|
320
|
+
children: React.ReactNode;
|
|
321
|
+
/**
|
|
322
|
+
* The value of the dropdown menu radio group
|
|
323
|
+
*/
|
|
324
|
+
value?: string;
|
|
325
|
+
/**
|
|
326
|
+
* The default value of the dropdown menu radio group
|
|
327
|
+
*/
|
|
328
|
+
defaultValue?: string;
|
|
329
|
+
/**
|
|
330
|
+
* The controlled value of the dropdown menu radio group
|
|
331
|
+
*/
|
|
332
|
+
onValueChange?: (value: string) => void;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, type DropdownMenuPortalProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as d from'react';import*as e from'@radix-ui/react-dropdown-menu';import {ChevronRight,Check,Circle}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function a(...o){return twMerge(clsx(o))}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)=>jsxs(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,jsx(ChevronRight,{className:"ml-auto h-4 w-4"})]}));m.displayName=e.SubTrigger.displayName;var u=d.forwardRef(({className:o,...t},n)=>jsx(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)=>jsx(e.Portal,{children:jsx(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)=>jsx(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)=>jsxs(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:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(e.ItemIndicator,{children:jsx(Check,{className:"h-4 w-4"})})}),t]}));w.displayName=e.CheckboxItem.displayName;var f=d.forwardRef(({className:o,children:t,...n},i)=>jsxs(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:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(e.ItemIndicator,{children:jsx(Circle,{className:"h-2 w-2 fill-current"})})}),t]}));f.displayName=e.RadioItem.displayName;var M=d.forwardRef(({className:o,inset:t,...n},i)=>jsx(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)=>jsx(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})=>jsx("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};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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,CAEH,UAAAD,CACDI,CAAAA,GAAAA,CAACC,aAAA,CAAa,SAAA,CAAU,kBAAkB,CAC5C,CAAA,CAAA,CACD,EACDR,CAAuB,CAAA,WAAA,CAAoC,aAAW,WAEtE,CAAA,IAAMS,EAA+B,CAGnC,CAAA,UAAA,CAAA,CAAC,CAAE,SAAAR,CAAAA,CAAAA,CAAW,GAAGG,CAAM,CAAA,CAAGC,IAC1BE,GAAuB,CAAA,CAAA,CAAA,UAAA,CAAtB,CACC,GAAKF,CAAAA,CAAAA,CACL,UAAWf,CACT,CAAA,ubAAA,CACAW,CACF,CACC,CAAA,GAAGG,EACN,CACD,EACDK,EAAuB,WAAoC,CAAA,CAAA,CAAA,UAAA,CAAW,YAEh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AAAnB,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"]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as _radix_ui_react_slot from '@radix-ui/react-slot';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react_hook_form from 'react-hook-form';
|
|
5
|
+
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
8
|
+
|
|
9
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
10
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare const useFormField: () => {
|
|
12
|
+
invalid: boolean;
|
|
13
|
+
isDirty: boolean;
|
|
14
|
+
isTouched: boolean;
|
|
15
|
+
isValidating: boolean;
|
|
16
|
+
error?: react_hook_form.FieldError;
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
formItemId: string;
|
|
20
|
+
formDescriptionId: string;
|
|
21
|
+
formMessageId: string;
|
|
22
|
+
};
|
|
23
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
25
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<_radix_ui_react_slot.SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
26
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
27
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Props interface for the Form component.
|
|
31
|
+
* Extends react-hook-form's FormProvider props.
|
|
32
|
+
*/
|
|
33
|
+
interface FormProps<TFieldValues extends FieldValues = FieldValues> {
|
|
34
|
+
/**
|
|
35
|
+
* The form context value
|
|
36
|
+
*/
|
|
37
|
+
context: React.Context<TFieldValues>;
|
|
38
|
+
/**
|
|
39
|
+
* The form children
|
|
40
|
+
*/
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Props interface for the FormField component.
|
|
45
|
+
* Extends react-hook-form's Controller props.
|
|
46
|
+
*/
|
|
47
|
+
interface FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends ControllerProps<TFieldValues, TName> {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props interface for the FormItem component.
|
|
51
|
+
* Extends HTML div attributes.
|
|
52
|
+
*/
|
|
53
|
+
interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Props interface for the FormLabel component.
|
|
57
|
+
* Extends Radix UI Label props.
|
|
58
|
+
*/
|
|
59
|
+
interface FormLabelProps extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Props interface for the FormControl component.
|
|
63
|
+
* Extends Radix UI Slot props.
|
|
64
|
+
*/
|
|
65
|
+
interface FormControlProps extends React.ComponentPropsWithoutRef<typeof Slot> {
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Props interface for the FormDescription component.
|
|
69
|
+
* Extends HTML paragraph attributes.
|
|
70
|
+
*/
|
|
71
|
+
interface FormDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Props interface for the FormMessage component.
|
|
75
|
+
* Extends HTML paragraph attributes.
|
|
76
|
+
*/
|
|
77
|
+
interface FormMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
78
|
+
/**
|
|
79
|
+
* The message content
|
|
80
|
+
*/
|
|
81
|
+
children?: React.ReactNode;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Context value type for form field context
|
|
85
|
+
*/
|
|
86
|
+
type FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
87
|
+
name: TName;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Context value type for form item context
|
|
91
|
+
*/
|
|
92
|
+
type FormItemContextValue = {
|
|
93
|
+
id: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, type FormFieldContextValue, type FormFieldProps, FormItem, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, useFormField };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as o from'react';import {Slot}from'@radix-ui/react-slot';import {useFormContext,FormProvider,Controller}from'react-hook-form';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as p from'@radix-ui/react-label';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';function s(...e){return twMerge(clsx(e))}var I=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=o.forwardRef(({className:e,...r},t)=>jsx(p.Root,{ref:t,className:s(I(),e),...r}));d.displayName=p.Root.displayName;var N=FormProvider,f=o.createContext({}),w=({...e})=>jsx(f.Provider,{value:{name:e.name},children:jsx(Controller,{...e})}),n=()=>{let e=o.useContext(f),r=o.useContext(u),{getFieldState:t,formState:a}=useFormContext(),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 jsx(u.Provider,{value:{id:a},children:jsx("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 jsx(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 jsx(Slot,{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 jsx("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(),F=m?String(m?.message??""):r;return F?jsx("p",{ref:a,id:i,className:s("text-sm font-medium text-destructive",e),...t,children:F}):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};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx","../../src/components/rhf/form/form.tsx"],"names":["cn","inputs","twMerge","clsx","labelVariants","cva","Label","c","className","props","ref","jsx","Form","FormProvider","FormFieldContext","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body"],"mappings":"yTAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,QAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCCA,IAAMG,CAAAA,CAAgBC,GACpB,CAAA,4FACF,EAaMC,CAAc,CAAAC,CAAA,CAAA,UAAA,CAClB,CAAC,CAAE,SAAA,CAAAC,EAAW,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GACxBC,GAAgB,CAAA,CAAA,CAAA,IAAA,CAAf,CAAoB,GAAKD,CAAAA,CAAAA,CAAK,UAAWV,CAAGI,CAAAA,CAAAA,GAAiBI,CAAS,CAAA,CAAI,GAAGC,CAAAA,CAAO,CAEzF,CAAA,CACAH,EAAM,WAA6B,CAAA,CAAA,CAAA,IAAA,CAAK,YCTlCM,IAAAA,CAAAA,CAAOC,YASPC,CAAAA,CAAAA,CAAyB,CAAqC,CAAA,aAAA,CAAA,EAA2B,CAEzFC,CAAAA,CAAAA,CAAY,CAGhB,CACA,GAAGN,CACL,CAEIE,GAAAA,GAAAA,CAACG,CAAiB,CAAA,QAAA,CAAjB,CAA0B,KAAA,CAAO,CAAE,IAAML,CAAAA,CAAAA,CAAM,IAAK,CACnD,CAAA,QAAA,CAAAE,IAACK,UAAA,CAAA,CAAY,GAAGP,CAAAA,CAAO,CACzB,CAAA,CAAA,CAIEQ,EAAe,IAAM,CACzB,IAAMC,CAAqB,CAAA,CAAA,CAAA,UAAA,CAAWJ,CAAgB,CAChDK,CAAAA,CAAAA,CAAoB,CAAWC,CAAAA,UAAAA,CAAAA,CAAe,CAC9C,CAAA,CAAE,cAAAC,CAAe,CAAA,SAAA,CAAAC,CAAU,CAAIC,CAAAA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kB,CAAAA,CAAAA,CAAO,cAAAI,CAAc,CAAA,CAAIf,GAC3BoB,CAAAA,CAAAA,CAAOT,CAAQ,CAAA,MAAA,CAAOA,CAAO,EAAA,OAAA,EAAW,EAAE,CAAIQ,CAAAA,CAAAA,CAEpD,OAAKC,CAKH1B,CAAAA,GAAAA,CAAC,KACC,GAAKD,CAAAA,CAAAA,CACL,EAAIsB,CAAAA,CAAAA,CACJ,SAAWhC,CAAAA,CAAAA,CAAG,uCAAwCQ,CAAS,CAAA,CAC9D,GAAGC,CAAAA,CAEH,QAAA4B,CAAAA,CAAAA,CACH,EAXO,IAaX,CAAC,EACDF,CAAAA,CAAY,WAAc,CAAA,aAAA","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 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"]}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import 'class-variance-authority';
|
|
2
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
3
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
5
|
|
|
7
6
|
declare function useIsMobile(): boolean;
|
|
8
7
|
|
|
8
|
+
declare const Toast$1: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
10
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
|
|
11
|
+
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast$1>;
|
|
13
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
14
|
+
|
|
9
15
|
type ToasterToast = ToastProps & {
|
|
10
16
|
id: string;
|
|
11
17
|
title?: React.ReactNode;
|
|
@@ -0,0 +1,2 @@
|
|
|
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}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:false}: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:true,onOpenChange:c=>{c||s();}}}),{id:e,dismiss:s,update:o}}function I(){let[t,e]=a.useState(i);return a.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};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-mobile.tsx","../../src/hooks/use-toast.ts"],"names":["MOBILE_BREAKPOINT","useIsMobile","isMobile","setIsMobile","mql","onChange","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","props","id","update","dismiss","open","useToast","setState","r","index"],"mappings":"wBAEA,IAAMA,CAAAA,CAAoB,IAEnB,SAASC,CAAAA,EAAc,CAC5B,GAAM,CAACC,EAAUC,CAAW,CAAA,CAAU,WAA8B,MAAS,CAAA,CAE7E,OAAM,CAAU,CAAA,SAAA,CAAA,IAAM,CACpB,IAAMC,CAAM,CAAA,MAAA,CAAO,WAAW,CAAeJ,YAAAA,EAAAA,CAAAA,CAAoB,CAAC,CAAK,GAAA,CAAA,CAAA,CACjEK,EAAW,IAAM,CACrBF,CAAY,CAAA,MAAA,CAAO,UAAaH,CAAAA,CAAiB,EACnD,CACA,CAAA,OAAAI,EAAI,gBAAiB,CAAA,QAAA,CAAUC,CAAQ,CACvCF,CAAAA,CAAAA,CAAY,MAAO,CAAA,UAAA,CAAaH,CAAiB,CAAA,CA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AAA,CACN,KAAO,CAAA,CACL,GAAGS,CAAAA,CACH,GAAAC,CACA,CAAA,IAAA,CAAM,KACN,YAAeG,CAAAA,CAAAA,EAAS,CACjBA,CAAMD,EAAAA,CAAAA,GACb,CACF,CACF,CAAC,EAEM,CACL,EAAA,CAAIF,EACJ,OAAAE,CAAAA,CAAAA,CACA,OAAAD,CACF,CACF,CAEA,SAASG,CAAW,EAAA,CAClB,GAAM,CAACZ,CAAAA,CAAOa,CAAQ,CAAU,CAAAC,CAAA,CAAA,QAAA,CAAgBT,CAAW,CAE3D,CAAA,OAAMS,CAAU,CAAA,SAAA,CAAA,KACdV,CAAU,CAAA,IAAA,CAAKS,CAAQ,CAChB,CAAA,IAAM,CACX,IAAME,CAAAA,CAAQX,EAAU,OAAQS,CAAAA,CAAQ,CACpCE,CAAAA,CAAAA,CAAQ,EACVX,EAAAA,CAAAA,CAAU,OAAOW,CAAO,CAAA,CAAC,EAE7B,CACC,CAAA,CAAA,CAACf,CAAK,CAAC,CAAA,CAEH,CACL,GAAGA,CACH,CAAA,KAAA,CAAAG,EACA,OAAUP,CAAAA,CAAAA,EAAqBE,EAAS,CAAE,IAAA,CAAM,gBAAiB,OAAAF,CAAAA,CAAQ,CAAC,CAC5E,CACF","file":"index.mjs","sourcesContent":["import * 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\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"]}
|