@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
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
1
|
import { cn } from '@foundrykit/utils';
|
|
2
|
+
import * as React from 'react';
|
|
4
3
|
|
|
5
|
-
export
|
|
6
|
-
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
4
|
+
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
7
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Styled text input wrapping the native `<input>`; forwards its ref and accepts
|
|
8
|
+
* all standard input attributes (including `type`). Includes focus-ring and
|
|
9
|
+
* disabled styling.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Input type="email" placeholder="you@example.com" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
8
16
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
9
17
|
({ className, type, ...props }, ref) => {
|
|
10
18
|
return (
|
|
11
19
|
<input
|
|
12
20
|
type={type}
|
|
13
21
|
className={cn(
|
|
14
|
-
'border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:
|
|
22
|
+
'border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
15
23
|
className
|
|
16
24
|
)}
|
|
17
25
|
ref={ref}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
-
|
|
3
|
+
import { Button, Input, Textarea } from '@foundrykit/primitives';
|
|
6
4
|
import { cn } from '@foundrykit/utils';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { Textarea } from '@foundrykit/primitives';
|
|
5
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
6
|
+
import type * as React from 'react';
|
|
10
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Container that groups a control with addons in a single bordered field,
|
|
10
|
+
* managing shared focus/invalid/disabled styling. Compose with
|
|
11
|
+
* {@link InputGroupInput} or {@link InputGroupTextarea} as the control and
|
|
12
|
+
* {@link InputGroupAddon} (holding {@link InputGroupText} or
|
|
13
|
+
* {@link InputGroupButton}) for leading/trailing content.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <InputGroup>
|
|
18
|
+
* <InputGroupAddon><SearchIcon /></InputGroupAddon>
|
|
19
|
+
* <InputGroupInput placeholder="Search" />
|
|
20
|
+
* </InputGroup>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
11
23
|
function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
12
24
|
return (
|
|
13
25
|
<div
|
|
14
26
|
data-slot='input-group'
|
|
15
27
|
role='group'
|
|
16
28
|
className={cn(
|
|
17
|
-
'group/input-group border-input
|
|
29
|
+
'group/input-group border-input has-disabled:bg-input/50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-8 w-full min-w-0 items-center rounded-lg border transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:opacity-50 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
|
|
18
30
|
className
|
|
19
31
|
)}
|
|
20
32
|
{...props}
|
|
@@ -23,7 +35,7 @@ function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
const inputGroupAddonVariants = cva(
|
|
26
|
-
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium
|
|
38
|
+
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
27
39
|
{
|
|
28
40
|
variants: {
|
|
29
41
|
align: {
|
|
@@ -43,6 +55,11 @@ const inputGroupAddonVariants = cva(
|
|
|
43
55
|
}
|
|
44
56
|
);
|
|
45
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Slot for icons, text or buttons alongside the control. The `align` variant
|
|
60
|
+
* (`inline-start`/`inline-end`/`block-start`/`block-end`) positions it; clicking
|
|
61
|
+
* empty addon space focuses the group's input.
|
|
62
|
+
*/
|
|
46
63
|
function InputGroupAddon({
|
|
47
64
|
className,
|
|
48
65
|
align = 'inline-start',
|
|
@@ -83,6 +100,10 @@ const inputGroupButtonVariants = cva(
|
|
|
83
100
|
}
|
|
84
101
|
);
|
|
85
102
|
|
|
103
|
+
/**
|
|
104
|
+
* {@link Button} preset for use inside an addon: defaults to `type="button"`,
|
|
105
|
+
* `variant="ghost"` and a compact `size` (`xs`, `sm`, `icon-xs`, `icon-sm`).
|
|
106
|
+
*/
|
|
86
107
|
function InputGroupButton({
|
|
87
108
|
className,
|
|
88
109
|
type = 'button',
|
|
@@ -106,7 +127,7 @@ function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
|
|
106
127
|
return (
|
|
107
128
|
<span
|
|
108
129
|
className={cn(
|
|
109
|
-
"text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4
|
|
130
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
110
131
|
className
|
|
111
132
|
)}
|
|
112
133
|
{...props}
|
|
@@ -122,7 +143,7 @@ function InputGroupInput({
|
|
|
122
143
|
<Input
|
|
123
144
|
data-slot='input-group-control'
|
|
124
145
|
className={cn(
|
|
125
|
-
'
|
|
146
|
+
'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
|
|
126
147
|
className
|
|
127
148
|
)}
|
|
128
149
|
{...props}
|
|
@@ -138,7 +159,7 @@ function InputGroupTextarea({
|
|
|
138
159
|
<Textarea
|
|
139
160
|
data-slot='input-group-control'
|
|
140
161
|
className={cn(
|
|
141
|
-
'
|
|
162
|
+
'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
|
|
142
163
|
className
|
|
143
164
|
)}
|
|
144
165
|
{...props}
|
|
@@ -150,7 +171,7 @@ export {
|
|
|
150
171
|
InputGroup,
|
|
151
172
|
InputGroupAddon,
|
|
152
173
|
InputGroupButton,
|
|
153
|
-
InputGroupText,
|
|
154
174
|
InputGroupInput,
|
|
175
|
+
InputGroupText,
|
|
155
176
|
InputGroupTextarea,
|
|
156
177
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const ItemConfig: ComponentConfig = {
|
|
4
|
+
name: 'Item',
|
|
5
|
+
description:
|
|
6
|
+
'A flexible row for lists of content with media, text and actions.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['item', 'list', 'layout'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-12 w-full items-center gap-3 rounded-md border border-gray-300 bg-gray-100 px-3"><div class="h-6 w-6 rounded bg-gray-300"></div><div class="flex flex-col gap-1"><div class="h-2 w-20 rounded bg-gray-400"></div><div class="h-2 w-28 rounded bg-gray-300"></div></div></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default item',
|
|
17
|
+
code: '<Item><ItemContent><ItemTitle>Title</ItemTitle></ItemContent></Item>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'Item',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Outline',
|
|
26
|
+
description: 'Item with an outline border',
|
|
27
|
+
code: '<Item variant="outline">...</Item>',
|
|
28
|
+
preview: {
|
|
29
|
+
type: 'component',
|
|
30
|
+
component: 'Item',
|
|
31
|
+
props: {
|
|
32
|
+
variant: 'outline',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Muted',
|
|
38
|
+
description: 'Item with a muted background',
|
|
39
|
+
code: '<Item variant="muted">...</Item>',
|
|
40
|
+
preview: {
|
|
41
|
+
type: 'component',
|
|
42
|
+
component: 'Item',
|
|
43
|
+
props: {
|
|
44
|
+
variant: 'muted',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
dependencies: ['utils', 'separator'],
|
|
50
|
+
packageDependencies: ['@radix-ui/react-slot', 'class-variance-authority'],
|
|
51
|
+
files: ['components/primitives/item/index.tsx'],
|
|
52
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { cn } from '@foundrykit/utils';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import type * as React from 'react';
|
|
5
|
+
import { Separator } from '../separator/index.js';
|
|
6
|
+
|
|
7
|
+
function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
role='list'
|
|
11
|
+
data-slot='item-group'
|
|
12
|
+
className={cn('group/item-group flex flex-col', className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function ItemSeparator({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
22
|
+
return (
|
|
23
|
+
<Separator
|
|
24
|
+
data-slot='item-separator'
|
|
25
|
+
orientation='horizontal'
|
|
26
|
+
className={cn('my-0', className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const itemVariants = cva(
|
|
33
|
+
'group/item focus-visible:border-ring focus-visible:ring-ring/50 [a]:hover:bg-accent/50 flex flex-wrap items-center rounded-md border border-transparent text-sm transition-colors duration-100 outline-none focus-visible:ring-[3px] [a]:transition-colors',
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
variant: {
|
|
37
|
+
default: 'bg-transparent',
|
|
38
|
+
outline: 'border-border',
|
|
39
|
+
muted: 'bg-muted/50',
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
default: 'gap-4 p-4',
|
|
43
|
+
sm: 'gap-2.5 px-4 py-3',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
variant: 'default',
|
|
48
|
+
size: 'default',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Flexible row for lists of content: a leading {@link ItemMedia}, a stacked
|
|
55
|
+
* {@link ItemContent} (with {@link ItemTitle}/{@link ItemDescription}) and
|
|
56
|
+
* trailing {@link ItemActions}. Styled via {@link itemVariants} with `variant`
|
|
57
|
+
* (default, outline, muted) and `size`; set `asChild` to render as a link.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <Item variant="outline">
|
|
62
|
+
* <ItemMedia variant="icon"><StarIcon /></ItemMedia>
|
|
63
|
+
* <ItemContent>
|
|
64
|
+
* <ItemTitle>Favorites</ItemTitle>
|
|
65
|
+
* <ItemDescription>Your starred items</ItemDescription>
|
|
66
|
+
* </ItemContent>
|
|
67
|
+
* <ItemActions><ChevronRightIcon /></ItemActions>
|
|
68
|
+
* </Item>
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function Item({
|
|
72
|
+
className,
|
|
73
|
+
variant,
|
|
74
|
+
size,
|
|
75
|
+
asChild = false,
|
|
76
|
+
...props
|
|
77
|
+
}: React.ComponentProps<'div'> &
|
|
78
|
+
VariantProps<typeof itemVariants> & {
|
|
79
|
+
asChild?: boolean;
|
|
80
|
+
}) {
|
|
81
|
+
const Comp = asChild ? Slot : 'div';
|
|
82
|
+
return (
|
|
83
|
+
<Comp
|
|
84
|
+
data-slot='item'
|
|
85
|
+
data-variant={variant}
|
|
86
|
+
data-size={size}
|
|
87
|
+
className={cn(itemVariants({ variant, size, className }))}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const itemMediaVariants = cva(
|
|
94
|
+
'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none',
|
|
95
|
+
{
|
|
96
|
+
variants: {
|
|
97
|
+
variant: {
|
|
98
|
+
default: 'bg-transparent',
|
|
99
|
+
icon: "bg-muted size-8 rounded-sm border [&_svg:not([class*='size-'])]:size-4",
|
|
100
|
+
image:
|
|
101
|
+
'size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
defaultVariants: {
|
|
105
|
+
variant: 'default',
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
/** Leading media slot for icons (`variant="icon"`), images (`variant="image"`) or arbitrary content. */
|
|
111
|
+
function ItemMedia({
|
|
112
|
+
className,
|
|
113
|
+
variant,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof itemMediaVariants>) {
|
|
116
|
+
return (
|
|
117
|
+
<div
|
|
118
|
+
data-slot='item-media'
|
|
119
|
+
data-variant={variant}
|
|
120
|
+
className={cn(itemMediaVariants({ variant, className }))}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function ItemContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
data-slot='item-content'
|
|
130
|
+
className={cn(
|
|
131
|
+
'flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none',
|
|
132
|
+
className
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
140
|
+
return (
|
|
141
|
+
<div
|
|
142
|
+
data-slot='item-title'
|
|
143
|
+
className={cn(
|
|
144
|
+
'flex w-fit items-center gap-2 text-sm leading-snug font-medium',
|
|
145
|
+
className
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
153
|
+
return (
|
|
154
|
+
<p
|
|
155
|
+
data-slot='item-description'
|
|
156
|
+
className={cn(
|
|
157
|
+
'text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance',
|
|
158
|
+
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
|
|
159
|
+
className
|
|
160
|
+
)}
|
|
161
|
+
{...props}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function ItemActions({ className, ...props }: React.ComponentProps<'div'>) {
|
|
167
|
+
return (
|
|
168
|
+
<div
|
|
169
|
+
data-slot='item-actions'
|
|
170
|
+
className={cn('flex items-center gap-2', className)}
|
|
171
|
+
{...props}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function ItemHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
177
|
+
return (
|
|
178
|
+
<div
|
|
179
|
+
data-slot='item-header'
|
|
180
|
+
className={cn(
|
|
181
|
+
'flex basis-full items-center justify-between gap-2',
|
|
182
|
+
className
|
|
183
|
+
)}
|
|
184
|
+
{...props}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function ItemFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
190
|
+
return (
|
|
191
|
+
<div
|
|
192
|
+
data-slot='item-footer'
|
|
193
|
+
className={cn(
|
|
194
|
+
'flex basis-full items-center justify-between gap-2',
|
|
195
|
+
className
|
|
196
|
+
)}
|
|
197
|
+
{...props}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export {
|
|
203
|
+
Item,
|
|
204
|
+
ItemActions,
|
|
205
|
+
ItemContent,
|
|
206
|
+
ItemDescription,
|
|
207
|
+
ItemFooter,
|
|
208
|
+
ItemGroup,
|
|
209
|
+
ItemHeader,
|
|
210
|
+
ItemMedia,
|
|
211
|
+
ItemSeparator,
|
|
212
|
+
ItemTitle,
|
|
213
|
+
itemMediaVariants,
|
|
214
|
+
itemVariants,
|
|
215
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const KbdConfig: ComponentConfig = {
|
|
4
|
+
name: 'Kbd',
|
|
5
|
+
description:
|
|
6
|
+
'Displays keyboard keys and shortcuts, groupable into full key combinations.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['kbd', 'keyboard', 'shortcut'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-12 w-full items-center justify-center gap-1 rounded-md border border-gray-300 bg-gray-100"><span class="inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-gray-300 px-1 text-xs text-gray-600">⌘</span><span class="inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-gray-300 px-1 text-xs text-gray-600">K</span></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default keyboard key',
|
|
17
|
+
code: '<Kbd>⌘</Kbd>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'Kbd',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Group',
|
|
26
|
+
description: 'A group of keys forming a shortcut',
|
|
27
|
+
code: '<KbdGroup><Kbd>⌘</Kbd><Kbd>K</Kbd></KbdGroup>',
|
|
28
|
+
preview: {
|
|
29
|
+
type: 'component',
|
|
30
|
+
component: 'Kbd',
|
|
31
|
+
props: {},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
dependencies: ['utils'],
|
|
36
|
+
packageDependencies: [],
|
|
37
|
+
files: ['components/primitives/kbd/index.tsx'],
|
|
38
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from '@foundrykit/utils';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Renders a keyboard key or shortcut token. Group several keys together with
|
|
6
|
+
* {@link KbdGroup} to display a full key combination.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <KbdGroup>
|
|
11
|
+
* <Kbd>⌘</Kbd>
|
|
12
|
+
* <Kbd>K</Kbd>
|
|
13
|
+
* </KbdGroup>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function Kbd({ className, ...props }: React.ComponentProps<'kbd'>) {
|
|
17
|
+
return (
|
|
18
|
+
<kbd
|
|
19
|
+
data-slot='kbd'
|
|
20
|
+
className={cn(
|
|
21
|
+
"bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none [&_svg:not([class*='size-'])]:size-3",
|
|
22
|
+
'[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function KbdGroup({ className, ...props }: React.ComponentProps<'kbd'>) {
|
|
31
|
+
return (
|
|
32
|
+
<kbd
|
|
33
|
+
data-slot='kbd-group'
|
|
34
|
+
className={cn('inline-flex items-center gap-1', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Kbd, KbdGroup };
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
-
|
|
6
3
|
import { cn } from '@foundrykit/utils';
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
import type * as React from 'react';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Form label built on Radix `Label.Root`. Associate it with a control via
|
|
9
|
+
* `htmlFor`; automatically dims when a peer or group is disabled.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Label htmlFor="email">Email</Label>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
8
16
|
function Label({
|
|
9
17
|
className,
|
|
10
18
|
...props
|
|
@@ -13,7 +21,7 @@ function Label({
|
|
|
13
21
|
<LabelPrimitive.Root
|
|
14
22
|
data-slot='label'
|
|
15
23
|
className={cn(
|
|
16
|
-
'flex
|
|
24
|
+
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
17
25
|
className
|
|
18
26
|
)}
|
|
19
27
|
{...props}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const MenubarConfig: ComponentConfig = {
|
|
4
|
+
name: 'Menubar',
|
|
5
|
+
description:
|
|
6
|
+
'A horizontal menu bar with a set of dropdown menus, commonly used for application-level navigation.',
|
|
7
|
+
category: 'primitives',
|
|
8
|
+
tags: ['menubar', 'menu', 'navigation'],
|
|
9
|
+
preview: {
|
|
10
|
+
type: 'static',
|
|
11
|
+
html: '<div class="flex h-9 w-full items-center gap-1 rounded-md border border-gray-300 bg-gray-100 px-1"><span class="rounded-sm px-2 py-1 text-sm text-gray-600">File</span><span class="rounded-sm px-2 py-1 text-sm text-gray-600">Edit</span><span class="rounded-sm px-2 py-1 text-sm text-gray-600">View</span></div>',
|
|
12
|
+
},
|
|
13
|
+
variants: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Default',
|
|
16
|
+
description: 'Default menubar',
|
|
17
|
+
code: '<Menubar><MenubarMenu><MenubarTrigger>File</MenubarTrigger></MenubarMenu></Menubar>',
|
|
18
|
+
preview: {
|
|
19
|
+
type: 'component',
|
|
20
|
+
component: 'Menubar',
|
|
21
|
+
props: {},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
dependencies: ['utils'],
|
|
26
|
+
packageDependencies: ['@radix-ui/react-menubar', 'lucide-react'],
|
|
27
|
+
files: ['components/primitives/menubar/index.tsx'],
|
|
28
|
+
};
|