@foundrykit/primitives 2.0.5 → 2.0.7
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/.turbo/turbo-build.log +235 -73
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +39 -136
- package/dist/chunk-25N35Z5M.js +42 -0
- package/dist/chunk-2JOT4DV4.js +66 -0
- package/dist/chunk-2PXD7LAX.js +172 -0
- package/dist/{chunk-VSXKLSEP.js → chunk-3BAO7TAS.js} +2 -2
- package/dist/chunk-3MEIDBWZ.js +225 -0
- package/dist/{chunk-A3U73FA7.js → chunk-3UKWAM5M.js} +2 -2
- package/dist/chunk-44I6VK3H.js +105 -0
- package/dist/chunk-46UI3AUE.js +62 -0
- package/dist/{chunk-AADRFFPH.js → chunk-5OSYIETI.js} +4 -4
- package/dist/chunk-67UXTT4O.js +116 -0
- package/dist/{chunk-J57CV3VT.js → chunk-6DRII3XC.js} +2 -2
- package/dist/chunk-727ACUWN.js +82 -0
- package/dist/chunk-76APYFRN.js +29 -0
- package/dist/chunk-AJAAMJYH.js +12 -0
- package/dist/chunk-BIFBYERK.js +69 -0
- package/dist/{chunk-PHMEWMFS.js → chunk-D4X2ZO5T.js} +7 -7
- package/dist/{chunk-UZIMC7AQ.js → chunk-DFGLEAZI.js} +2 -2
- package/dist/chunk-DKBMAFIR.js +65 -0
- package/dist/{chunk-U2EIVYWP.js → chunk-DXZ4GUQO.js} +2 -2
- package/dist/chunk-ED6T7ZZN.js +130 -0
- package/dist/{chunk-J4CRGO2P.js → chunk-EDKSYP4L.js} +2 -2
- package/dist/chunk-EEAK2RWF.js +23 -0
- package/dist/{chunk-FYCANIVJ.js → chunk-FF5D53KL.js} +2 -2
- package/dist/chunk-FIRYLO5W.js +253 -0
- package/dist/chunk-GPEL656S.js +84 -0
- package/dist/chunk-JKKCRFYB.js +36 -0
- package/dist/chunk-JTSIBZS4.js +194 -0
- package/dist/{chunk-QL4XJD7Y.js → chunk-MCXSVXO4.js} +2 -2
- package/dist/chunk-MMZJQ7RW.js +33 -0
- package/dist/{chunk-4GPFVBO2.js → chunk-MYIUX3DT.js} +3 -3
- package/dist/chunk-PAO3DSEF.js +48 -0
- package/dist/chunk-PLLG76QJ.js +32 -0
- package/dist/chunk-R3IEOV2B.js +155 -0
- package/dist/{chunk-KZMSLRLW.js → chunk-RDQF3IQE.js} +2 -2
- package/dist/{chunk-XQAJQKO7.js → chunk-SUEPE6OX.js} +3 -3
- package/dist/chunk-TA23RNS4.js +162 -0
- package/dist/chunk-TRXU4SOJ.js +224 -0
- package/dist/chunk-VA4MKQN7.js +40 -0
- package/dist/chunk-VPBVKBZ7.js +25 -0
- package/dist/{chunk-I44GXEPN.js → chunk-XVIHRZGJ.js} +1 -1
- package/dist/chunk-YT2ZIMZI.js +16 -0
- package/dist/components/accordion/index.cjs +104 -0
- package/dist/components/accordion/index.d.cts +25 -0
- package/dist/components/accordion/index.d.ts +25 -0
- package/dist/components/accordion/index.js +13 -0
- package/dist/components/alert/index.cjs +96 -0
- package/dist/components/alert/index.d.cts +28 -0
- package/dist/components/alert/index.d.ts +28 -0
- package/dist/components/alert/index.js +12 -0
- package/dist/components/alert-dialog/index.cjs +200 -0
- package/dist/components/alert-dialog/index.d.cts +42 -0
- package/dist/components/alert-dialog/index.d.ts +42 -0
- package/dist/components/alert-dialog/index.js +27 -0
- package/dist/components/aspect-ratio/index.cjs +47 -0
- package/dist/components/aspect-ratio/index.d.cts +19 -0
- package/dist/components/aspect-ratio/index.d.ts +19 -0
- package/dist/components/aspect-ratio/index.js +7 -0
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.d.cts +16 -1
- package/dist/components/avatar/index.d.ts +16 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/index.cjs +5 -5
- package/dist/components/badge/index.d.cts +13 -2
- package/dist/components/badge/index.d.ts +13 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/breadcrumb/index.cjs +2 -2
- package/dist/components/breadcrumb/index.d.cts +19 -0
- package/dist/components/breadcrumb/index.d.ts +19 -0
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/button/index.cjs +18 -8
- package/dist/components/button/index.d.cts +15 -2
- package/dist/components/button/index.d.ts +15 -2
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/index.cjs +142 -0
- package/dist/components/button-group/index.d.cts +33 -0
- package/dist/components/button-group/index.d.ts +33 -0
- package/dist/components/button-group/index.js +13 -0
- package/dist/components/card/index.cjs +2 -2
- package/dist/components/card/index.d.cts +16 -0
- package/dist/components/card/index.d.ts +16 -0
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.cjs +2 -2
- package/dist/components/checkbox/index.d.cts +11 -1
- package/dist/components/checkbox/index.d.ts +11 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/collapsible/index.cjs +73 -0
- package/dist/components/collapsible/index.d.cts +22 -0
- package/dist/components/collapsible/index.d.ts +22 -0
- package/dist/components/collapsible/index.js +11 -0
- package/dist/components/context-menu/index.cjs +274 -0
- package/dist/components/context-menu/index.d.cts +48 -0
- package/dist/components/context-menu/index.d.ts +48 -0
- package/dist/components/context-menu/index.js +35 -0
- package/dist/components/direction/index.cjs +39 -0
- package/dist/components/direction/index.d.cts +20 -0
- package/dist/components/direction/index.d.ts +20 -0
- package/dist/components/direction/index.js +9 -0
- package/dist/components/drawer/index.cjs +164 -0
- package/dist/components/drawer/index.d.cts +35 -0
- package/dist/components/drawer/index.d.ts +35 -0
- package/dist/components/drawer/index.js +25 -0
- package/dist/components/dropdown/index.cjs +7 -7
- package/dist/components/dropdown/index.d.cts +25 -1
- package/dist/components/dropdown/index.d.ts +25 -1
- package/dist/components/dropdown/index.js +1 -1
- package/dist/components/empty/index.cjs +135 -0
- package/dist/components/empty/index.d.cts +38 -0
- package/dist/components/empty/index.d.ts +38 -0
- package/dist/components/empty/index.js +18 -0
- package/dist/components/field/index.cjs +269 -0
- package/dist/components/field/index.d.cts +42 -0
- package/dist/components/field/index.d.ts +42 -0
- package/dist/components/field/index.js +27 -0
- package/dist/components/hover-card/index.cjs +77 -0
- package/dist/components/hover-card/index.d.cts +22 -0
- package/dist/components/hover-card/index.d.ts +22 -0
- package/dist/components/hover-card/index.js +11 -0
- package/dist/components/input/index.cjs +2 -2
- package/dist/components/input/index.d.cts +11 -2
- package/dist/components/input/index.d.ts +11 -2
- package/dist/components/input/index.js +1 -1
- package/dist/components/item/index.cjs +262 -0
- package/dist/components/item/index.d.cts +47 -0
- package/dist/components/item/index.d.ts +47 -0
- package/dist/components/item/index.js +29 -0
- package/dist/components/kbd/index.cjs +57 -0
- package/dist/components/kbd/index.d.cts +19 -0
- package/dist/components/kbd/index.d.ts +19 -0
- package/dist/components/kbd/index.js +8 -0
- package/dist/components/label/index.cjs +2 -2
- package/dist/components/label/index.d.cts +10 -1
- package/dist/components/label/index.d.ts +10 -1
- package/dist/components/label/index.js +1 -1
- package/dist/components/menubar/index.cjs +303 -0
- package/dist/components/menubar/index.d.cts +49 -0
- package/dist/components/menubar/index.d.ts +49 -0
- package/dist/components/menubar/index.js +37 -0
- package/dist/components/native-select/index.cjs +53 -0
- package/dist/components/native-select/index.d.cts +19 -0
- package/dist/components/native-select/index.d.ts +19 -0
- package/dist/components/native-select/index.js +6 -0
- package/dist/components/navigation-menu/index.cjs +215 -0
- package/dist/components/navigation-menu/index.d.cts +37 -0
- package/dist/components/navigation-menu/index.d.ts +37 -0
- package/dist/components/navigation-menu/index.js +23 -0
- package/dist/components/popover/index.cjs +2 -2
- package/dist/components/popover/index.d.cts +14 -1
- package/dist/components/popover/index.d.ts +14 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/progress/index.cjs +68 -0
- package/dist/components/progress/index.d.cts +16 -0
- package/dist/components/progress/index.d.ts +16 -0
- package/dist/components/progress/index.js +7 -0
- package/dist/components/radio-group/index.cjs +3 -3
- package/dist/components/radio-group/index.d.cts +15 -1
- package/dist/components/radio-group/index.d.ts +15 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/resizable/index.cjs +75 -0
- package/dist/components/resizable/index.d.cts +25 -0
- package/dist/components/resizable/index.d.ts +25 -0
- package/dist/components/resizable/index.js +11 -0
- package/dist/components/scroll-area/index.cjs +3 -3
- package/dist/components/scroll-area/index.d.cts +14 -1
- package/dist/components/scroll-area/index.d.ts +14 -1
- package/dist/components/scroll-area/index.js +1 -1
- package/dist/components/select/index.cjs +4 -4
- package/dist/components/select/index.d.cts +19 -1
- package/dist/components/select/index.d.ts +19 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/separator/index.cjs +2 -2
- package/dist/components/separator/index.d.cts +12 -1
- package/dist/components/separator/index.d.ts +12 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/skeleton/index.d.cts +9 -0
- package/dist/components/skeleton/index.d.ts +9 -0
- package/dist/components/slider/index.cjs +100 -0
- package/dist/components/slider/index.d.cts +18 -0
- package/dist/components/slider/index.d.ts +18 -0
- package/dist/components/slider/index.js +7 -0
- package/dist/components/sonner/index.cjs +51 -0
- package/dist/components/sonner/index.d.cts +18 -0
- package/dist/components/sonner/index.d.ts +18 -0
- package/dist/components/sonner/index.js +9 -0
- package/dist/components/spinner/index.cjs +47 -0
- package/dist/components/spinner/index.d.cts +17 -0
- package/dist/components/spinner/index.d.ts +17 -0
- package/dist/components/spinner/index.js +6 -0
- package/dist/components/switch/index.cjs +2 -2
- package/dist/components/switch/index.d.cts +11 -1
- package/dist/components/switch/index.d.ts +11 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/table/index.cjs +147 -0
- package/dist/components/table/index.d.cts +35 -0
- package/dist/components/table/index.d.ts +35 -0
- package/dist/components/table/index.js +20 -0
- package/dist/components/tabs/index.cjs +2 -2
- package/dist/components/tabs/index.d.cts +18 -1
- package/dist/components/tabs/index.d.ts +18 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.d.cts +9 -0
- package/dist/components/textarea/index.d.ts +9 -0
- package/dist/components/textarea/index.js +1 -1
- package/dist/components/toggle-group/index.cjs +120 -0
- package/dist/components/toggle-group/index.d.cts +27 -0
- package/dist/components/toggle-group/index.d.ts +27 -0
- package/dist/components/toggle-group/index.js +9 -0
- package/dist/components/typography/index.cjs +197 -0
- package/dist/components/typography/index.d.cts +28 -0
- package/dist/components/typography/index.d.ts +28 -0
- package/dist/components/typography/index.js +28 -0
- package/dist/index.cjs +3272 -781
- package/dist/index.d.cts +128 -24
- package/dist/index.d.ts +128 -24
- package/dist/index.js +486 -145
- package/package.json +25 -8
- package/postcss.config.mjs +1 -1
- package/registry.json +18 -5
- package/src/components/accordion/config.ts +28 -0
- package/src/components/accordion/index.tsx +80 -0
- package/src/components/alert/config.ts +40 -0
- package/src/components/alert/index.tsx +80 -0
- package/src/components/alert-dialog/config.ts +28 -0
- package/src/components/alert-dialog/index.tsx +188 -0
- package/src/components/aspect-ratio/config.ts +27 -0
- package/src/components/aspect-ratio/index.tsx +24 -0
- package/src/components/avatar/config.ts +1 -1
- package/src/components/avatar/index.tsx +18 -4
- package/src/components/badge/config.ts +1 -1
- package/src/components/badge/index.tsx +17 -7
- package/src/components/breadcrumb/config.ts +1 -1
- package/src/components/breadcrumb/index.tsx +24 -6
- package/src/components/button/config.ts +21 -1
- package/src/components/button/index.tsx +33 -9
- package/src/components/button-group/config.ts +39 -0
- package/src/components/button-group/index.tsx +99 -0
- package/src/components/card/config.ts +1 -1
- package/src/components/card/index.tsx +21 -6
- package/src/components/checkbox/config.ts +1 -1
- package/src/components/checkbox/index.tsx +13 -4
- package/src/components/collapsible/config.ts +27 -0
- package/src/components/collapsible/index.tsx +47 -0
- package/src/components/context-menu/config.ts +28 -0
- package/src/components/context-menu/index.tsx +271 -0
- package/src/components/dialog/config.ts +1 -1
- package/src/components/dialog/index.tsx +25 -6
- package/src/components/direction/config.ts +28 -0
- package/src/components/direction/index.tsx +27 -0
- package/src/components/drawer/config.ts +28 -0
- package/src/components/drawer/index.tsx +153 -0
- package/src/components/dropdown/config.ts +1 -1
- package/src/components/dropdown/index.tsx +37 -14
- package/src/components/empty/config.ts +38 -0
- package/src/components/empty/index.tsx +127 -0
- package/src/components/field/config.ts +40 -0
- package/src/components/field/index.tsx +252 -0
- package/src/components/hover-card/config.ts +27 -0
- package/src/components/hover-card/index.tsx +56 -0
- package/src/components/input/config.ts +1 -1
- package/src/components/input/index.tsx +13 -5
- package/src/components/input-group/index.tsx +33 -12
- package/src/components/item/config.ts +52 -0
- package/src/components/item/index.tsx +215 -0
- package/src/components/kbd/config.ts +38 -0
- package/src/components/kbd/index.tsx +40 -0
- package/src/components/label/config.ts +1 -1
- package/src/components/label/index.tsx +12 -4
- package/src/components/menubar/config.ts +28 -0
- package/src/components/menubar/index.tsx +295 -0
- package/src/components/native-select/config.ts +40 -0
- package/src/components/native-select/index.tsx +40 -0
- package/src/components/navigation-menu/config.ts +32 -0
- package/src/components/navigation-menu/index.tsx +188 -0
- package/src/components/popover/config.ts +1 -1
- package/src/components/popover/index.tsx +17 -5
- package/src/components/progress/config.ts +42 -0
- package/src/components/progress/index.tsx +39 -0
- package/src/components/radio-group/config.ts +1 -1
- package/src/components/radio-group/index.tsx +18 -5
- package/src/components/resizable/config.ts +28 -0
- package/src/components/resizable/index.tsx +67 -0
- package/src/components/scroll-area/index.tsx +17 -5
- package/src/components/select/config.ts +1 -1
- package/src/components/select/index.tsx +23 -6
- package/src/components/separator/config.ts +1 -1
- package/src/components/separator/index.tsx +14 -4
- package/src/components/sheet/index.tsx +21 -7
- package/src/components/skeleton/config.ts +1 -1
- package/src/components/skeleton/index.tsx +9 -0
- package/src/components/slider/config.ts +46 -0
- package/src/components/slider/index.tsx +73 -0
- package/src/components/sonner/config.ts +27 -0
- package/src/components/sonner/index.tsx +37 -0
- package/src/components/spinner/config.ts +40 -0
- package/src/components/spinner/index.tsx +30 -0
- package/src/components/switch/config.ts +1 -1
- package/src/components/switch/index.tsx +13 -4
- package/src/components/table/config.ts +38 -0
- package/src/components/table/index.tsx +135 -0
- package/src/components/tabs/config.ts +1 -1
- package/src/components/tabs/index.tsx +21 -5
- package/src/components/textarea/config.ts +1 -1
- package/src/components/textarea/index.tsx +11 -3
- package/src/components/toggle/index.tsx +20 -8
- package/src/components/toggle-group/config.ts +46 -0
- package/src/components/toggle-group/index.tsx +106 -0
- package/src/components/tooltip/index.tsx +19 -5
- package/src/components/typography/config.ts +38 -0
- package/src/components/typography/index.tsx +172 -0
- package/src/index.ts +239 -53
- package/tsup.config.ts +25 -0
- package/dist/chunk-FUWID6MC.js +0 -42
- package/dist/chunk-YTUI6MCB.js +0 -52
- package/eslint.config.js +0 -4
- package/dist/{chunk-VVNIYCKH.js → chunk-3TZXV53R.js} +1 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
6
|
+
import type * as React from 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Context menu root built on Radix `ContextMenu.Root`, displaying a menu on
|
|
10
|
+
* right-click. Compose with {@link ContextMenuTrigger},
|
|
11
|
+
* {@link ContextMenuContent} and items such as {@link ContextMenuItem},
|
|
12
|
+
* {@link ContextMenuCheckboxItem}, {@link ContextMenuRadioItem},
|
|
13
|
+
* {@link ContextMenuLabel}, {@link ContextMenuSeparator},
|
|
14
|
+
* {@link ContextMenuShortcut} and submenus ({@link ContextMenuSub},
|
|
15
|
+
* {@link ContextMenuSubTrigger}, {@link ContextMenuSubContent}).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ContextMenu>
|
|
20
|
+
* <ContextMenuTrigger>Right click</ContextMenuTrigger>
|
|
21
|
+
* <ContextMenuContent>
|
|
22
|
+
* <ContextMenuItem>Back</ContextMenuItem>
|
|
23
|
+
* <ContextMenuItem>Reload</ContextMenuItem>
|
|
24
|
+
* </ContextMenuContent>
|
|
25
|
+
* </ContextMenu>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function ContextMenu({
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
|
|
31
|
+
return <ContextMenuPrimitive.Root data-slot='context-menu' {...props} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function ContextMenuTrigger({
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
|
|
37
|
+
return (
|
|
38
|
+
<ContextMenuPrimitive.Trigger data-slot='context-menu-trigger' {...props} />
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ContextMenuGroup({
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
|
|
45
|
+
return (
|
|
46
|
+
<ContextMenuPrimitive.Group data-slot='context-menu-group' {...props} />
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function ContextMenuPortal({
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
|
|
53
|
+
return (
|
|
54
|
+
<ContextMenuPrimitive.Portal data-slot='context-menu-portal' {...props} />
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ContextMenuSub({
|
|
59
|
+
...props
|
|
60
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
|
|
61
|
+
return <ContextMenuPrimitive.Sub data-slot='context-menu-sub' {...props} />;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function ContextMenuRadioGroup({
|
|
65
|
+
...props
|
|
66
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
|
|
67
|
+
return (
|
|
68
|
+
<ContextMenuPrimitive.RadioGroup
|
|
69
|
+
data-slot='context-menu-radio-group'
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ContextMenuSubTrigger({
|
|
76
|
+
className,
|
|
77
|
+
inset,
|
|
78
|
+
children,
|
|
79
|
+
...props
|
|
80
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
81
|
+
inset?: boolean;
|
|
82
|
+
}) {
|
|
83
|
+
return (
|
|
84
|
+
<ContextMenuPrimitive.SubTrigger
|
|
85
|
+
data-slot='context-menu-sub-trigger'
|
|
86
|
+
data-inset={inset}
|
|
87
|
+
className={cn(
|
|
88
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
89
|
+
className
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
{children}
|
|
94
|
+
<ChevronRightIcon className='ml-auto size-4' />
|
|
95
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function ContextMenuSubContent({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
|
103
|
+
return (
|
|
104
|
+
<ContextMenuPrimitive.SubContent
|
|
105
|
+
data-slot='context-menu-sub-content'
|
|
106
|
+
className={cn(
|
|
107
|
+
'bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
|
|
108
|
+
className
|
|
109
|
+
)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function ContextMenuContent({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
|
119
|
+
return (
|
|
120
|
+
<ContextMenuPrimitive.Portal>
|
|
121
|
+
<ContextMenuPrimitive.Content
|
|
122
|
+
data-slot='context-menu-content'
|
|
123
|
+
className={cn(
|
|
124
|
+
'bg-popover text-popover-foreground 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 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
</ContextMenuPrimitive.Portal>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function ContextMenuItem({
|
|
134
|
+
className,
|
|
135
|
+
inset,
|
|
136
|
+
variant = 'default',
|
|
137
|
+
...props
|
|
138
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
139
|
+
inset?: boolean;
|
|
140
|
+
variant?: 'default' | 'destructive';
|
|
141
|
+
}) {
|
|
142
|
+
return (
|
|
143
|
+
<ContextMenuPrimitive.Item
|
|
144
|
+
data-slot='context-menu-item'
|
|
145
|
+
data-inset={inset}
|
|
146
|
+
data-variant={variant}
|
|
147
|
+
className={cn(
|
|
148
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
149
|
+
className
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ContextMenuCheckboxItem({
|
|
157
|
+
className,
|
|
158
|
+
children,
|
|
159
|
+
checked,
|
|
160
|
+
...props
|
|
161
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
|
162
|
+
return (
|
|
163
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
164
|
+
data-slot='context-menu-checkbox-item'
|
|
165
|
+
className={cn(
|
|
166
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
checked={checked}
|
|
170
|
+
{...props}
|
|
171
|
+
>
|
|
172
|
+
<span className='pointer-events-none absolute left-2 flex size-3.5 items-center justify-center'>
|
|
173
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
174
|
+
<CheckIcon className='size-4' />
|
|
175
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
176
|
+
</span>
|
|
177
|
+
{children}
|
|
178
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function ContextMenuRadioItem({
|
|
183
|
+
className,
|
|
184
|
+
children,
|
|
185
|
+
...props
|
|
186
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
|
187
|
+
return (
|
|
188
|
+
<ContextMenuPrimitive.RadioItem
|
|
189
|
+
data-slot='context-menu-radio-item'
|
|
190
|
+
className={cn(
|
|
191
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
192
|
+
className
|
|
193
|
+
)}
|
|
194
|
+
{...props}
|
|
195
|
+
>
|
|
196
|
+
<span className='pointer-events-none absolute left-2 flex size-3.5 items-center justify-center'>
|
|
197
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
198
|
+
<CircleIcon className='size-2 fill-current' />
|
|
199
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
200
|
+
</span>
|
|
201
|
+
{children}
|
|
202
|
+
</ContextMenuPrimitive.RadioItem>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function ContextMenuLabel({
|
|
207
|
+
className,
|
|
208
|
+
inset,
|
|
209
|
+
...props
|
|
210
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
211
|
+
inset?: boolean;
|
|
212
|
+
}) {
|
|
213
|
+
return (
|
|
214
|
+
<ContextMenuPrimitive.Label
|
|
215
|
+
data-slot='context-menu-label'
|
|
216
|
+
data-inset={inset}
|
|
217
|
+
className={cn(
|
|
218
|
+
'text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8',
|
|
219
|
+
className
|
|
220
|
+
)}
|
|
221
|
+
{...props}
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function ContextMenuSeparator({
|
|
227
|
+
className,
|
|
228
|
+
...props
|
|
229
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
|
230
|
+
return (
|
|
231
|
+
<ContextMenuPrimitive.Separator
|
|
232
|
+
data-slot='context-menu-separator'
|
|
233
|
+
className={cn('bg-border -mx-1 my-1 h-px', className)}
|
|
234
|
+
{...props}
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function ContextMenuShortcut({
|
|
240
|
+
className,
|
|
241
|
+
...props
|
|
242
|
+
}: React.ComponentProps<'span'>) {
|
|
243
|
+
return (
|
|
244
|
+
<span
|
|
245
|
+
data-slot='context-menu-shortcut'
|
|
246
|
+
className={cn(
|
|
247
|
+
'text-muted-foreground ml-auto text-xs tracking-widest',
|
|
248
|
+
className
|
|
249
|
+
)}
|
|
250
|
+
{...props}
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
ContextMenu,
|
|
257
|
+
ContextMenuCheckboxItem,
|
|
258
|
+
ContextMenuContent,
|
|
259
|
+
ContextMenuGroup,
|
|
260
|
+
ContextMenuItem,
|
|
261
|
+
ContextMenuLabel,
|
|
262
|
+
ContextMenuPortal,
|
|
263
|
+
ContextMenuRadioGroup,
|
|
264
|
+
ContextMenuRadioItem,
|
|
265
|
+
ContextMenuSeparator,
|
|
266
|
+
ContextMenuShortcut,
|
|
267
|
+
ContextMenuSub,
|
|
268
|
+
ContextMenuSubContent,
|
|
269
|
+
ContextMenuSubTrigger,
|
|
270
|
+
ContextMenuTrigger,
|
|
271
|
+
};
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
4
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
5
|
import { XIcon } from 'lucide-react';
|
|
6
|
+
import type * as React from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Modal dialog root built on Radix `Dialog.Root`. Compose with
|
|
10
|
+
* {@link DialogTrigger}, {@link DialogContent} (which renders the overlay and an
|
|
11
|
+
* optional close button), {@link DialogHeader}, {@link DialogTitle},
|
|
12
|
+
* {@link DialogDescription} and {@link DialogFooter}.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Dialog>
|
|
17
|
+
* <DialogTrigger>Open</DialogTrigger>
|
|
18
|
+
* <DialogContent>
|
|
19
|
+
* <DialogHeader><DialogTitle>Title</DialogTitle></DialogHeader>
|
|
20
|
+
* </DialogContent>
|
|
21
|
+
* </Dialog>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
9
24
|
function Dialog({
|
|
10
25
|
...props
|
|
11
26
|
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
@@ -46,6 +61,10 @@ function DialogOverlay({
|
|
|
46
61
|
);
|
|
47
62
|
}
|
|
48
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Centered, animated dialog panel rendered in a portal over a dark overlay.
|
|
66
|
+
* Set `showCloseButton={false}` to hide the built-in top-right close button.
|
|
67
|
+
*/
|
|
49
68
|
function DialogContent({
|
|
50
69
|
className,
|
|
51
70
|
children,
|
|
@@ -60,7 +79,7 @@ function DialogContent({
|
|
|
60
79
|
<DialogPrimitive.Content
|
|
61
80
|
data-slot='dialog-content'
|
|
62
81
|
className={cn(
|
|
63
|
-
'bg-background 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 fixed
|
|
82
|
+
'bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
64
83
|
className
|
|
65
84
|
)}
|
|
66
85
|
{...props}
|
|
@@ -69,7 +88,7 @@ function DialogContent({
|
|
|
69
88
|
{showCloseButton && (
|
|
70
89
|
<DialogPrimitive.Close
|
|
71
90
|
data-slot='dialog-close'
|
|
72
|
-
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground
|
|
91
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
73
92
|
>
|
|
74
93
|
<XIcon />
|
|
75
94
|
<span className='sr-only'>Close</span>
|
|
@@ -110,7 +129,7 @@ function DialogTitle({
|
|
|
110
129
|
return (
|
|
111
130
|
<DialogPrimitive.Title
|
|
112
131
|
data-slot='dialog-title'
|
|
113
|
-
className={cn('text-lg font-semibold
|
|
132
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
114
133
|
{...props}
|
|
115
134
|
/>
|
|
116
135
|
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const DirectionConfig: ComponentConfig = {
|
|
4
|
+
name: 'Direction',
|
|
5
|
+
description:
|
|
6
|
+
'Provides reading direction context (LTR/RTL) to descendant components.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['direction', 'rtl', 'ltr', 'provider', 'i18n'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-12 w-full items-center justify-end rounded-md border border-gray-300 bg-gray-100 px-3"><span class="text-sm text-gray-600">rtl</span></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default direction provider',
|
|
17
|
+
code: '<DirectionProvider dir="rtl"><App /></DirectionProvider>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'DirectionProvider',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
dependencies: ['utils'],
|
|
26
|
+
packageDependencies: ['@radix-ui/react-direction'],
|
|
27
|
+
files: ['components/primitives/direction/index.tsx'],
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DirectionProvider as DirectionProviderPrimitive,
|
|
5
|
+
useDirection,
|
|
6
|
+
} from '@radix-ui/react-direction';
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Provides reading direction (`ltr`/`rtl`) to all descendant Radix
|
|
11
|
+
* primitives via context. Wrap your app (or a subtree) to control layout
|
|
12
|
+
* direction; read the current value with the re-exported {@link useDirection}.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <DirectionProvider dir="rtl">
|
|
17
|
+
* <App />
|
|
18
|
+
* </DirectionProvider>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function DirectionProvider({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DirectionProviderPrimitive>) {
|
|
24
|
+
return <DirectionProviderPrimitive {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { DirectionProvider, useDirection };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const DrawerConfig: ComponentConfig = {
|
|
4
|
+
name: 'Drawer',
|
|
5
|
+
description:
|
|
6
|
+
'A touch-friendly panel that slides in from the edge of the screen.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['drawer', 'dialog', 'overlay', 'sheet'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-24 w-full flex-col justify-end rounded-md border border-gray-300 bg-gray-50"><div class="mx-auto mb-2 h-1.5 w-12 rounded-full bg-gray-400"></div><div class="h-12 rounded-t-md bg-white p-3"><div class="h-2 w-24 rounded bg-gray-300"></div></div></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default drawer',
|
|
17
|
+
code: '<Drawer><DrawerTrigger>Open</DrawerTrigger><DrawerContent>...</DrawerContent></Drawer>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'Drawer',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
dependencies: ['utils'],
|
|
26
|
+
packageDependencies: ['vaul'],
|
|
27
|
+
files: ['components/primitives/drawer/index.tsx'],
|
|
28
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import type * as React from 'react';
|
|
5
|
+
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Drawer built on `vaul` for touch-friendly, swipe-dismissable panels that
|
|
9
|
+
* slide in from any edge. Compose with {@link DrawerTrigger},
|
|
10
|
+
* {@link DrawerContent}, {@link DrawerHeader}, {@link DrawerTitle},
|
|
11
|
+
* {@link DrawerDescription} and {@link DrawerFooter}.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Drawer>
|
|
16
|
+
* <DrawerTrigger>Open</DrawerTrigger>
|
|
17
|
+
* <DrawerContent>
|
|
18
|
+
* <DrawerHeader>
|
|
19
|
+
* <DrawerTitle>Are you sure?</DrawerTitle>
|
|
20
|
+
* <DrawerDescription>This cannot be undone.</DrawerDescription>
|
|
21
|
+
* </DrawerHeader>
|
|
22
|
+
* </DrawerContent>
|
|
23
|
+
* </Drawer>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function Drawer({
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
29
|
+
return <DrawerPrimitive.Root data-slot='drawer' {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function DrawerTrigger({
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
35
|
+
return <DrawerPrimitive.Trigger data-slot='drawer-trigger' {...props} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DrawerPortal({
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
41
|
+
return <DrawerPrimitive.Portal data-slot='drawer-portal' {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function DrawerClose({
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
47
|
+
return <DrawerPrimitive.Close data-slot='drawer-close' {...props} />;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function DrawerOverlay({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
54
|
+
return (
|
|
55
|
+
<DrawerPrimitive.Overlay
|
|
56
|
+
data-slot='drawer-overlay'
|
|
57
|
+
className={cn(
|
|
58
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function DrawerContent({
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
71
|
+
return (
|
|
72
|
+
<DrawerPortal>
|
|
73
|
+
<DrawerOverlay />
|
|
74
|
+
<DrawerPrimitive.Content
|
|
75
|
+
data-slot='drawer-content'
|
|
76
|
+
className={cn(
|
|
77
|
+
'group/drawer-content bg-background fixed z-50 flex h-auto flex-col',
|
|
78
|
+
'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b',
|
|
79
|
+
'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t',
|
|
80
|
+
'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',
|
|
81
|
+
'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
>
|
|
86
|
+
<div className='bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block' />
|
|
87
|
+
{children}
|
|
88
|
+
</DrawerPrimitive.Content>
|
|
89
|
+
</DrawerPortal>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
data-slot='drawer-header'
|
|
97
|
+
className={cn(
|
|
98
|
+
'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left',
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
107
|
+
return (
|
|
108
|
+
<div
|
|
109
|
+
data-slot='drawer-footer'
|
|
110
|
+
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function DrawerTitle({
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
119
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
120
|
+
return (
|
|
121
|
+
<DrawerPrimitive.Title
|
|
122
|
+
data-slot='drawer-title'
|
|
123
|
+
className={cn('text-foreground font-semibold', className)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function DrawerDescription({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
133
|
+
return (
|
|
134
|
+
<DrawerPrimitive.Description
|
|
135
|
+
data-slot='drawer-description'
|
|
136
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
Drawer,
|
|
144
|
+
DrawerClose,
|
|
145
|
+
DrawerContent,
|
|
146
|
+
DrawerDescription,
|
|
147
|
+
DrawerFooter,
|
|
148
|
+
DrawerHeader,
|
|
149
|
+
DrawerOverlay,
|
|
150
|
+
DrawerPortal,
|
|
151
|
+
DrawerTitle,
|
|
152
|
+
DrawerTrigger,
|
|
153
|
+
};
|