@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,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
5
|
+
import type * as React from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Progress bar built on Radix `Progress.Root`. Pass `value` (0–100) to fill the
|
|
9
|
+
* indicator; omit it for an indeterminate state.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Progress value={66} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function Progress({
|
|
17
|
+
className,
|
|
18
|
+
value,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
21
|
+
return (
|
|
22
|
+
<ProgressPrimitive.Root
|
|
23
|
+
data-slot='progress'
|
|
24
|
+
className={cn(
|
|
25
|
+
'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<ProgressPrimitive.Indicator
|
|
31
|
+
data-slot='progress-indicator'
|
|
32
|
+
className='bg-primary h-full w-full flex-1 transition-all'
|
|
33
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
34
|
+
/>
|
|
35
|
+
</ProgressPrimitive.Root>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Progress };
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
4
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
5
5
|
import { CircleIcon } from 'lucide-react';
|
|
6
|
+
import type * as React from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Group of mutually exclusive radio options built on Radix `RadioGroup.Root`,
|
|
10
|
+
* laid out as a grid. Compose with {@link RadioGroupItem} for each option and
|
|
11
|
+
* manage selection via the underlying Radix `value`/`onValueChange` props.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <RadioGroup value={plan} onValueChange={setPlan}>
|
|
16
|
+
* <RadioGroupItem value="free" />
|
|
17
|
+
* <RadioGroupItem value="pro" />
|
|
18
|
+
* </RadioGroup>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
9
21
|
function RadioGroup({
|
|
10
22
|
className,
|
|
11
23
|
...props
|
|
@@ -19,6 +31,7 @@ function RadioGroup({
|
|
|
19
31
|
);
|
|
20
32
|
}
|
|
21
33
|
|
|
34
|
+
/** Single radio option (Radix `RadioGroup.Item`) showing a filled dot when selected. */
|
|
22
35
|
function RadioGroupItem({
|
|
23
36
|
className,
|
|
24
37
|
...props
|
|
@@ -27,7 +40,7 @@ function RadioGroupItem({
|
|
|
27
40
|
<RadioGroupPrimitive.Item
|
|
28
41
|
data-slot='radio-group-item'
|
|
29
42
|
className={cn(
|
|
30
|
-
'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30
|
|
43
|
+
'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
|
31
44
|
className
|
|
32
45
|
)}
|
|
33
46
|
{...props}
|
|
@@ -36,7 +49,7 @@ function RadioGroupItem({
|
|
|
36
49
|
data-slot='radio-group-indicator'
|
|
37
50
|
className='relative flex items-center justify-center'
|
|
38
51
|
>
|
|
39
|
-
<CircleIcon className='fill-primary absolute
|
|
52
|
+
<CircleIcon className='fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2' />
|
|
40
53
|
</RadioGroupPrimitive.Indicator>
|
|
41
54
|
</RadioGroupPrimitive.Item>
|
|
42
55
|
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const ResizableConfig: ComponentConfig = {
|
|
4
|
+
name: 'Resizable',
|
|
5
|
+
description:
|
|
6
|
+
'Accessible resizable panel groups and layouts with keyboard support.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['resizable', 'panel', 'layout', 'split'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-12 w-full items-stretch overflow-hidden rounded-md border border-gray-300 bg-gray-50"><div class="flex-1 bg-white"></div><div class="w-px bg-gray-400"></div><div class="flex-1 bg-white"></div></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default resizable panel group',
|
|
17
|
+
code: '<ResizablePanelGroup orientation="horizontal"><ResizablePanel /><ResizableHandle /><ResizablePanel /></ResizablePanelGroup>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'ResizablePanelGroup',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
dependencies: ['utils'],
|
|
26
|
+
packageDependencies: ['react-resizable-panels', 'lucide-react'],
|
|
27
|
+
files: ['components/primitives/resizable/index.tsx'],
|
|
28
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import { GripVerticalIcon } from 'lucide-react';
|
|
5
|
+
import type * as React from 'react';
|
|
6
|
+
import { Group, Panel, Separator } from 'react-resizable-panels';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resizable split-pane layout built on `react-resizable-panels`. Wrap
|
|
10
|
+
* {@link ResizablePanel} children in a {@link ResizablePanelGroup} and place a
|
|
11
|
+
* {@link ResizableHandle} between them to let users drag the divider.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <ResizablePanelGroup orientation="horizontal">
|
|
16
|
+
* <ResizablePanel defaultSize={50}>One</ResizablePanel>
|
|
17
|
+
* <ResizableHandle withHandle />
|
|
18
|
+
* <ResizablePanel defaultSize={50}>Two</ResizablePanel>
|
|
19
|
+
* </ResizablePanelGroup>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function ResizablePanelGroup({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof Group>) {
|
|
26
|
+
return (
|
|
27
|
+
<Group
|
|
28
|
+
data-slot='resizable-panel-group'
|
|
29
|
+
className={cn(
|
|
30
|
+
'flex h-full w-full aria-[orientation=vertical]:flex-col',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ResizablePanel({ ...props }: React.ComponentProps<typeof Panel>) {
|
|
39
|
+
return <Panel data-slot='resizable-panel' {...props} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ResizableHandle({
|
|
43
|
+
withHandle,
|
|
44
|
+
className,
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof Separator> & {
|
|
47
|
+
withHandle?: boolean;
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<Separator
|
|
51
|
+
data-slot='resizable-handle'
|
|
52
|
+
className={cn(
|
|
53
|
+
'bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden aria-[orientation=vertical]:h-px aria-[orientation=vertical]:w-full aria-[orientation=vertical]:after:left-0 aria-[orientation=vertical]:after:h-1 aria-[orientation=vertical]:after:w-full aria-[orientation=vertical]:after:translate-x-0 aria-[orientation=vertical]:after:-translate-y-1/2',
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{withHandle && (
|
|
59
|
+
<div className='bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border'>
|
|
60
|
+
<GripVerticalIcon className='size-2.5' />
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</Separator>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
5
|
-
|
|
6
3
|
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
5
|
+
import type * as React from 'react';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Scrollable region with custom cross-browser scrollbars, built on Radix
|
|
9
|
+
* `ScrollArea.Root`. Wraps children in a viewport and renders a {@link ScrollBar}
|
|
10
|
+
* (vertical by default) plus a corner.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ScrollArea className="h-72">
|
|
15
|
+
* {items.map((i) => <div key={i}>{i}</div>)}
|
|
16
|
+
* </ScrollArea>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
8
19
|
function ScrollArea({
|
|
9
20
|
className,
|
|
10
21
|
children,
|
|
@@ -18,7 +29,7 @@ function ScrollArea({
|
|
|
18
29
|
>
|
|
19
30
|
<ScrollAreaPrimitive.Viewport
|
|
20
31
|
data-slot='scroll-area-viewport'
|
|
21
|
-
className='focus-visible:ring-ring/50 size-full h-full rounded-[inherit]
|
|
32
|
+
className='focus-visible:ring-ring/50 size-full h-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1'
|
|
22
33
|
>
|
|
23
34
|
{children}
|
|
24
35
|
</ScrollAreaPrimitive.Viewport>
|
|
@@ -28,6 +39,7 @@ function ScrollArea({
|
|
|
28
39
|
);
|
|
29
40
|
}
|
|
30
41
|
|
|
42
|
+
/** Custom scrollbar for a {@link ScrollArea}; `orientation` may be `vertical` or `horizontal`. */
|
|
31
43
|
function ScrollBar({
|
|
32
44
|
className,
|
|
33
45
|
orientation = 'vertical',
|
|
@@ -38,7 +50,7 @@ function ScrollBar({
|
|
|
38
50
|
data-slot='scroll-area-scrollbar'
|
|
39
51
|
orientation={orientation}
|
|
40
52
|
className={cn(
|
|
41
|
-
'flex touch-none
|
|
53
|
+
'flex touch-none p-px transition-colors select-none',
|
|
42
54
|
orientation === 'vertical' &&
|
|
43
55
|
'h-full w-2.5 border-l border-l-transparent',
|
|
44
56
|
orientation === 'horizontal' &&
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
4
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
5
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
6
|
+
import type * as React from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Select (listbox) root built on Radix `Select.Root`. Compose with
|
|
10
|
+
* {@link SelectTrigger} + {@link SelectValue}, {@link SelectContent} and options
|
|
11
|
+
* ({@link SelectItem}, {@link SelectGroup}, {@link SelectLabel},
|
|
12
|
+
* {@link SelectSeparator}); scroll buttons are included automatically.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Select value={v} onValueChange={setV}>
|
|
17
|
+
* <SelectTrigger><SelectValue placeholder="Pick" /></SelectTrigger>
|
|
18
|
+
* <SelectContent>
|
|
19
|
+
* <SelectItem value="a">A</SelectItem>
|
|
20
|
+
* </SelectContent>
|
|
21
|
+
* </Select>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
9
24
|
function Select({
|
|
10
25
|
...props
|
|
11
26
|
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
@@ -24,6 +39,7 @@ function SelectValue({
|
|
|
24
39
|
return <SelectPrimitive.Value data-slot='select-value' {...props} />;
|
|
25
40
|
}
|
|
26
41
|
|
|
42
|
+
/** Trigger button that opens the select and shows the current {@link SelectValue}; `size` may be `sm` or `default`. */
|
|
27
43
|
function SelectTrigger({
|
|
28
44
|
className,
|
|
29
45
|
size = 'default',
|
|
@@ -37,7 +53,7 @@ function SelectTrigger({
|
|
|
37
53
|
data-slot='select-trigger'
|
|
38
54
|
data-size={size}
|
|
39
55
|
className={cn(
|
|
40
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50
|
|
56
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
41
57
|
className
|
|
42
58
|
)}
|
|
43
59
|
{...props}
|
|
@@ -50,6 +66,7 @@ function SelectTrigger({
|
|
|
50
66
|
);
|
|
51
67
|
}
|
|
52
68
|
|
|
69
|
+
/** Portalled, animated listbox panel holding the options; defaults to `position="popper"`. */
|
|
53
70
|
function SelectContent({
|
|
54
71
|
className,
|
|
55
72
|
children,
|
|
@@ -61,7 +78,7 @@ function SelectContent({
|
|
|
61
78
|
<SelectPrimitive.Content
|
|
62
79
|
data-slot='select-content'
|
|
63
80
|
className={cn(
|
|
64
|
-
'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 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin)
|
|
81
|
+
'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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
|
65
82
|
position === 'popper' &&
|
|
66
83
|
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
67
84
|
className
|
|
@@ -107,7 +124,7 @@ function SelectItem({
|
|
|
107
124
|
<SelectPrimitive.Item
|
|
108
125
|
data-slot='select-item'
|
|
109
126
|
className={cn(
|
|
110
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground
|
|
127
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
111
128
|
className
|
|
112
129
|
)}
|
|
113
130
|
{...props}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
5
|
-
|
|
6
3
|
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
5
|
+
import type * as React from 'react';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Thin dividing line built on Radix `Separator.Root`. `orientation` may be
|
|
9
|
+
* `horizontal` (default) or `vertical`; `decorative` (default `true`) hides it
|
|
10
|
+
* from assistive tech.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Separator />
|
|
15
|
+
* <Separator orientation="vertical" />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
8
18
|
function Separator({
|
|
9
19
|
className,
|
|
10
20
|
orientation = 'horizontal',
|
|
@@ -17,7 +27,7 @@ function Separator({
|
|
|
17
27
|
decorative={decorative}
|
|
18
28
|
orientation={orientation}
|
|
19
29
|
className={cn(
|
|
20
|
-
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=
|
|
30
|
+
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
|
21
31
|
className
|
|
22
32
|
)}
|
|
23
33
|
{...props}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
4
|
import * as SheetPrimitive 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
|
+
* Slide-in panel (drawer) built on the Radix Dialog primitive. Compose with
|
|
10
|
+
* {@link SheetTrigger}, {@link SheetContent}, {@link SheetHeader},
|
|
11
|
+
* {@link SheetTitle}, {@link SheetDescription} and {@link SheetFooter}.
|
|
12
|
+
* {@link SheetContent} slides from a chosen `side` and includes a close button.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Sheet>
|
|
17
|
+
* <SheetTrigger>Open</SheetTrigger>
|
|
18
|
+
* <SheetContent side="left">...</SheetContent>
|
|
19
|
+
* </Sheet>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
9
22
|
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
23
|
return <SheetPrimitive.Root data-slot='sheet' {...props} />;
|
|
11
24
|
}
|
|
@@ -44,6 +57,7 @@ function SheetOverlay({
|
|
|
44
57
|
);
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/** Portalled sheet panel that slides in from `side` (`top`/`right`/`bottom`/`left`, default `right`) over an overlay, with a built-in close button. */
|
|
47
61
|
function SheetContent({
|
|
48
62
|
className,
|
|
49
63
|
children,
|
|
@@ -72,7 +86,7 @@ function SheetContent({
|
|
|
72
86
|
{...props}
|
|
73
87
|
>
|
|
74
88
|
{children}
|
|
75
|
-
<SheetPrimitive.Close className='ring-offset-background focus:ring-ring data-[state=open]:bg-secondary
|
|
89
|
+
<SheetPrimitive.Close className='ring-offset-background focus:ring-ring data-[state=open]:bg-secondary 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'>
|
|
76
90
|
<XIcon className='size-4' />
|
|
77
91
|
<span className='sr-only'>Close</span>
|
|
78
92
|
</SheetPrimitive.Close>
|
|
@@ -129,11 +143,11 @@ function SheetDescription({
|
|
|
129
143
|
|
|
130
144
|
export {
|
|
131
145
|
Sheet,
|
|
132
|
-
SheetTrigger,
|
|
133
146
|
SheetClose,
|
|
134
147
|
SheetContent,
|
|
135
|
-
|
|
148
|
+
SheetDescription,
|
|
136
149
|
SheetFooter,
|
|
150
|
+
SheetHeader,
|
|
137
151
|
SheetTitle,
|
|
138
|
-
|
|
152
|
+
SheetTrigger,
|
|
139
153
|
};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { cn } from '@foundrykit/utils';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Placeholder block with a pulse animation for loading states. Size and shape it
|
|
5
|
+
* with `className`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Skeleton className="h-4 w-32" />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
3
12
|
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
4
13
|
return (
|
|
5
14
|
<div
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const SliderConfig: ComponentConfig = {
|
|
4
|
+
name: 'Slider',
|
|
5
|
+
description:
|
|
6
|
+
'An input where the user selects a value or range from within a given range.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['slider', 'input', 'form'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-12 w-full items-center px-3"><div class="relative h-1.5 w-full rounded-full bg-gray-200"><div class="absolute h-full w-1/2 rounded-full bg-gray-500"></div><div class="absolute left-1/2 top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border border-gray-500 bg-white"></div></div></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Single-thumb slider',
|
|
17
|
+
code: '<Slider defaultValue={[50]} max={100} step={1} />',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'Slider',
|
|
21
|
+
props: {
|
|
22
|
+
defaultValue: [50],
|
|
23
|
+
max: 100,
|
|
24
|
+
step: 1,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Range',
|
|
30
|
+
description: 'Multi-thumb range slider',
|
|
31
|
+
code: '<Slider defaultValue={[25, 75]} max={100} step={1} />',
|
|
32
|
+
preview: {
|
|
33
|
+
type: 'component',
|
|
34
|
+
component: 'Slider',
|
|
35
|
+
props: {
|
|
36
|
+
defaultValue: [25, 75],
|
|
37
|
+
max: 100,
|
|
38
|
+
step: 1,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
dependencies: ['utils'],
|
|
44
|
+
packageDependencies: ['@radix-ui/react-slider'],
|
|
45
|
+
files: ['components/primitives/slider/index.tsx'],
|
|
46
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Slider built on Radix `Slider.Root`. Supports single or multiple thumbs by
|
|
9
|
+
* passing an array to `value`/`defaultValue`. Works horizontally or vertically
|
|
10
|
+
* via the `orientation` prop.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Slider defaultValue={[50]} max={100} step={1} />
|
|
15
|
+
* <Slider defaultValue={[25, 75]} max={100} step={1} />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function Slider({
|
|
19
|
+
className,
|
|
20
|
+
defaultValue,
|
|
21
|
+
value,
|
|
22
|
+
min = 0,
|
|
23
|
+
max = 100,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
26
|
+
const _values = React.useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
Array.isArray(value)
|
|
29
|
+
? value
|
|
30
|
+
: Array.isArray(defaultValue)
|
|
31
|
+
? defaultValue
|
|
32
|
+
: [min, max],
|
|
33
|
+
[value, defaultValue, min, max]
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<SliderPrimitive.Root
|
|
38
|
+
data-slot='slider'
|
|
39
|
+
defaultValue={defaultValue}
|
|
40
|
+
value={value}
|
|
41
|
+
min={min}
|
|
42
|
+
max={max}
|
|
43
|
+
className={cn(
|
|
44
|
+
'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
<SliderPrimitive.Track
|
|
50
|
+
data-slot='slider-track'
|
|
51
|
+
className={cn(
|
|
52
|
+
'bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5'
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
<SliderPrimitive.Range
|
|
56
|
+
data-slot='slider-range'
|
|
57
|
+
className={cn(
|
|
58
|
+
'bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full'
|
|
59
|
+
)}
|
|
60
|
+
/>
|
|
61
|
+
</SliderPrimitive.Track>
|
|
62
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
63
|
+
<SliderPrimitive.Thumb
|
|
64
|
+
data-slot='slider-thumb'
|
|
65
|
+
key={index}
|
|
66
|
+
className='border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50'
|
|
67
|
+
/>
|
|
68
|
+
))}
|
|
69
|
+
</SliderPrimitive.Root>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { Slider };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const SonnerConfig: ComponentConfig = {
|
|
4
|
+
name: 'Sonner',
|
|
5
|
+
description: 'An opinionated toast component for notifications.',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['sonner', 'toast', 'notification', 'feedback'],
|
|
8
|
+
preview: {
|
|
9
|
+
type: 'static',
|
|
10
|
+
html: '<div class="flex h-12 w-64 items-center gap-3 rounded-md border border-gray-300 bg-white px-3 shadow-sm"><div class="h-3 w-3 rounded-full bg-gray-400"></div><span class="text-sm text-gray-600">Event has been created</span></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Default',
|
|
15
|
+
description: 'Default toaster',
|
|
16
|
+
code: '<Toaster />',
|
|
17
|
+
preview: {
|
|
18
|
+
type: 'component',
|
|
19
|
+
component: 'Toaster',
|
|
20
|
+
props: {},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
dependencies: ['utils'],
|
|
25
|
+
packageDependencies: ['sonner', 'next-themes'],
|
|
26
|
+
files: ['components/primitives/sonner/index.tsx'],
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useTheme } from 'next-themes';
|
|
4
|
+
import type * as React from 'react';
|
|
5
|
+
import { Toaster as Sonner, type ToasterProps, toast } from 'sonner';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Toast notifications powered by Sonner, automatically themed via
|
|
9
|
+
* `next-themes`. Render a single `Toaster` near the root of your app and
|
|
10
|
+
* trigger notifications imperatively with the re-exported {@link toast}.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Toaster />
|
|
15
|
+
* <button onClick={() => toast('Saved!')}>Save</button>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function Toaster({ ...props }: ToasterProps) {
|
|
19
|
+
const { theme = 'system' } = useTheme();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Sonner
|
|
23
|
+
theme={theme as ToasterProps['theme']}
|
|
24
|
+
className='toaster group'
|
|
25
|
+
style={
|
|
26
|
+
{
|
|
27
|
+
'--normal-bg': 'var(--popover)',
|
|
28
|
+
'--normal-text': 'var(--popover-foreground)',
|
|
29
|
+
'--normal-border': 'var(--border)',
|
|
30
|
+
} as React.CSSProperties
|
|
31
|
+
}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Toaster, toast };
|