@foundrykit/primitives 2.0.9 → 2.1.1

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.
Files changed (146) hide show
  1. package/dist/{chunk-HS46TIMU.js → chunk-2UG6OCGA.js} +1 -1
  2. package/dist/chunk-3NQR7JZR.js +128 -0
  3. package/dist/{chunk-XCPGTXEJ.js → chunk-5RFGKG4K.js} +1 -1
  4. package/dist/chunk-B5YCE3UP.js +57 -0
  5. package/dist/chunk-F2TEA6ER.js +138 -0
  6. package/dist/{chunk-46UI3AUE.js → chunk-SEDTBIZW.js} +3 -3
  7. package/dist/chunk-SIQHWNPH.js +45 -0
  8. package/dist/chunk-STRBREHN.js +17 -0
  9. package/dist/components/button/index.cjs +3 -3
  10. package/dist/components/button/index.js +1 -1
  11. package/dist/components/card/index.cjs +1 -1
  12. package/dist/components/card/index.js +1 -1
  13. package/dist/components/dialog/index.cjs +182 -0
  14. package/dist/components/dialog/index.d.cts +38 -0
  15. package/dist/components/dialog/index.d.ts +38 -0
  16. package/dist/components/dialog/index.js +25 -0
  17. package/dist/components/input/index.cjs +1 -1
  18. package/dist/components/input/index.js +1 -1
  19. package/dist/components/input-group/index.cjs +270 -0
  20. package/dist/components/input-group/index.d.cts +44 -0
  21. package/dist/components/input-group/index.d.ts +44 -0
  22. package/dist/components/input-group/index.js +153 -0
  23. package/dist/components/section/index.cjs +41 -0
  24. package/dist/components/section/index.d.cts +27 -0
  25. package/dist/components/section/index.d.ts +27 -0
  26. package/dist/components/section/index.js +6 -0
  27. package/dist/components/sheet/index.cjs +170 -0
  28. package/dist/components/sheet/index.d.cts +31 -0
  29. package/dist/components/sheet/index.d.ts +31 -0
  30. package/dist/components/sheet/index.js +21 -0
  31. package/dist/components/toggle/index.cjs +81 -0
  32. package/dist/components/toggle/index.d.cts +26 -0
  33. package/dist/components/toggle/index.d.ts +26 -0
  34. package/dist/components/toggle/index.js +9 -0
  35. package/dist/components/tooltip/index.cjs +95 -0
  36. package/dist/components/tooltip/index.d.cts +25 -0
  37. package/dist/components/tooltip/index.d.ts +25 -0
  38. package/dist/components/tooltip/index.js +13 -0
  39. package/dist/index.cjs +112 -96
  40. package/dist/index.d.cts +12 -105
  41. package/dist/index.d.ts +12 -105
  42. package/dist/index.js +104 -406
  43. package/package.json +206 -10
  44. package/CHANGELOG.md +0 -230
  45. package/postcss.config.mjs +0 -6
  46. package/registry.json +0 -64
  47. package/src/components/accordion/config.ts +0 -28
  48. package/src/components/accordion/index.tsx +0 -80
  49. package/src/components/alert/config.ts +0 -40
  50. package/src/components/alert/index.tsx +0 -80
  51. package/src/components/alert-dialog/config.ts +0 -28
  52. package/src/components/alert-dialog/index.tsx +0 -188
  53. package/src/components/aspect-ratio/config.ts +0 -27
  54. package/src/components/aspect-ratio/index.tsx +0 -24
  55. package/src/components/avatar/config.ts +0 -46
  56. package/src/components/avatar/index.tsx +0 -67
  57. package/src/components/badge/config.ts +0 -56
  58. package/src/components/badge/index.tsx +0 -56
  59. package/src/components/breadcrumb/config.ts +0 -121
  60. package/src/components/breadcrumb/index.tsx +0 -127
  61. package/src/components/button/config.ts +0 -97
  62. package/src/components/button/index.tsx +0 -86
  63. package/src/components/button-group/config.ts +0 -39
  64. package/src/components/button-group/index.tsx +0 -99
  65. package/src/components/card/config.ts +0 -89
  66. package/src/components/card/index.tsx +0 -90
  67. package/src/components/checkbox/config.ts +0 -46
  68. package/src/components/checkbox/index.tsx +0 -41
  69. package/src/components/collapsible/config.ts +0 -27
  70. package/src/components/collapsible/index.tsx +0 -47
  71. package/src/components/context-menu/config.ts +0 -28
  72. package/src/components/context-menu/index.tsx +0 -271
  73. package/src/components/dialog/config.ts +0 -582
  74. package/src/components/dialog/index.tsx +0 -162
  75. package/src/components/direction/config.ts +0 -28
  76. package/src/components/direction/index.tsx +0 -27
  77. package/src/components/drawer/config.ts +0 -28
  78. package/src/components/drawer/index.tsx +0 -153
  79. package/src/components/dropdown/config.ts +0 -262
  80. package/src/components/dropdown/index.tsx +0 -280
  81. package/src/components/empty/config.ts +0 -38
  82. package/src/components/empty/index.tsx +0 -127
  83. package/src/components/field/config.ts +0 -40
  84. package/src/components/field/index.tsx +0 -252
  85. package/src/components/hover-card/config.ts +0 -27
  86. package/src/components/hover-card/index.tsx +0 -56
  87. package/src/components/input/config.ts +0 -64
  88. package/src/components/input/index.tsx +0 -32
  89. package/src/components/input-group/config.ts +0 -209
  90. package/src/components/input-group/index.tsx +0 -177
  91. package/src/components/item/config.ts +0 -52
  92. package/src/components/item/index.tsx +0 -215
  93. package/src/components/kbd/config.ts +0 -38
  94. package/src/components/kbd/index.tsx +0 -40
  95. package/src/components/label/config.ts +0 -72
  96. package/src/components/label/index.tsx +0 -32
  97. package/src/components/menubar/config.ts +0 -28
  98. package/src/components/menubar/index.tsx +0 -295
  99. package/src/components/native-select/config.ts +0 -40
  100. package/src/components/native-select/index.tsx +0 -40
  101. package/src/components/navigation-menu/config.ts +0 -32
  102. package/src/components/navigation-menu/index.tsx +0 -188
  103. package/src/components/popover/config.ts +0 -222
  104. package/src/components/popover/index.tsx +0 -60
  105. package/src/components/progress/config.ts +0 -42
  106. package/src/components/progress/index.tsx +0 -39
  107. package/src/components/radio-group/config.ts +0 -303
  108. package/src/components/radio-group/index.tsx +0 -58
  109. package/src/components/resizable/config.ts +0 -28
  110. package/src/components/resizable/index.tsx +0 -67
  111. package/src/components/scroll-area/config.ts +0 -17
  112. package/src/components/scroll-area/index.tsx +0 -70
  113. package/src/components/select/config.ts +0 -277
  114. package/src/components/select/index.tsx +0 -202
  115. package/src/components/separator/config.ts +0 -63
  116. package/src/components/separator/index.tsx +0 -38
  117. package/src/components/sheet/config.ts +0 -16
  118. package/src/components/sheet/index.tsx +0 -153
  119. package/src/components/skeleton/config.ts +0 -77
  120. package/src/components/skeleton/index.tsx +0 -22
  121. package/src/components/slider/config.ts +0 -46
  122. package/src/components/slider/index.tsx +0 -76
  123. package/src/components/sonner/config.ts +0 -27
  124. package/src/components/sonner/index.tsx +0 -37
  125. package/src/components/spinner/config.ts +0 -40
  126. package/src/components/spinner/index.tsx +0 -30
  127. package/src/components/switch/config.ts +0 -171
  128. package/src/components/switch/index.tsx +0 -40
  129. package/src/components/table/config.ts +0 -38
  130. package/src/components/table/index.tsx +0 -135
  131. package/src/components/tabs/config.ts +0 -335
  132. package/src/components/tabs/index.tsx +0 -82
  133. package/src/components/textarea/config.ts +0 -117
  134. package/src/components/textarea/index.tsx +0 -26
  135. package/src/components/toggle/config.ts +0 -67
  136. package/src/components/toggle/index.tsx +0 -59
  137. package/src/components/toggle-group/config.ts +0 -46
  138. package/src/components/toggle-group/index.tsx +0 -106
  139. package/src/components/tooltip/config.ts +0 -16
  140. package/src/components/tooltip/index.tsx +0 -75
  141. package/src/components/typography/config.ts +0 -38
  142. package/src/components/typography/index.tsx +0 -172
  143. package/src/index.ts +0 -291
  144. package/tsconfig.json +0 -9
  145. package/tsconfig.lint.json +0 -8
  146. package/tsup.config.ts +0 -55
@@ -1,177 +0,0 @@
1
- 'use client';
2
-
3
- import { Button, Input, Textarea } from '@foundrykit/primitives';
4
- import { cn } from '@foundrykit/utils';
5
- import { cva, type VariantProps } from 'class-variance-authority';
6
- import type * as React from 'react';
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
- */
23
- function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
24
- return (
25
- <div
26
- data-slot='input-group'
27
- role='group'
28
- className={cn(
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',
30
- className
31
- )}
32
- {...props}
33
- />
34
- );
35
- }
36
-
37
- const inputGroupAddonVariants = cva(
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",
39
- {
40
- variants: {
41
- align: {
42
- 'inline-start':
43
- 'order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]',
44
- 'inline-end':
45
- 'order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]',
46
- 'block-start':
47
- 'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
48
- 'block-end':
49
- 'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
50
- },
51
- },
52
- defaultVariants: {
53
- align: 'inline-start',
54
- },
55
- }
56
- );
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
- */
63
- function InputGroupAddon({
64
- className,
65
- align = 'inline-start',
66
- ...props
67
- }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {
68
- return (
69
- <div
70
- role='group'
71
- data-slot='input-group-addon'
72
- data-align={align}
73
- className={cn(inputGroupAddonVariants({ align }), className)}
74
- onClick={e => {
75
- if ((e.target as HTMLElement).closest('button')) {
76
- return;
77
- }
78
- e.currentTarget.parentElement?.querySelector('input')?.focus();
79
- }}
80
- {...props}
81
- />
82
- );
83
- }
84
-
85
- const inputGroupButtonVariants = cva(
86
- 'flex items-center gap-2 text-sm shadow-none',
87
- {
88
- variants: {
89
- size: {
90
- xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
91
- sm: '',
92
- 'icon-xs':
93
- 'size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0',
94
- 'icon-sm': 'size-8 p-0 has-[>svg]:p-0',
95
- },
96
- },
97
- defaultVariants: {
98
- size: 'xs',
99
- },
100
- }
101
- );
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
- */
107
- function InputGroupButton({
108
- className,
109
- type = 'button',
110
- variant = 'ghost',
111
- size = 'xs',
112
- ...props
113
- }: Omit<React.ComponentProps<typeof Button>, 'size'> &
114
- VariantProps<typeof inputGroupButtonVariants>) {
115
- return (
116
- <Button
117
- type={type}
118
- data-size={size}
119
- variant={variant}
120
- className={cn(inputGroupButtonVariants({ size }), className)}
121
- {...props}
122
- />
123
- );
124
- }
125
-
126
- function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
127
- return (
128
- <span
129
- className={cn(
130
- "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
131
- className
132
- )}
133
- {...props}
134
- />
135
- );
136
- }
137
-
138
- function InputGroupInput({
139
- className,
140
- ...props
141
- }: React.ComponentProps<'input'>) {
142
- return (
143
- <Input
144
- data-slot='input-group-control'
145
- className={cn(
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',
147
- className
148
- )}
149
- {...props}
150
- />
151
- );
152
- }
153
-
154
- function InputGroupTextarea({
155
- className,
156
- ...props
157
- }: React.ComponentProps<'textarea'>) {
158
- return (
159
- <Textarea
160
- data-slot='input-group-control'
161
- className={cn(
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',
163
- className
164
- )}
165
- {...props}
166
- />
167
- );
168
- }
169
-
170
- export {
171
- InputGroup,
172
- InputGroupAddon,
173
- InputGroupButton,
174
- InputGroupInput,
175
- InputGroupText,
176
- InputGroupTextarea,
177
- };
@@ -1,52 +0,0 @@
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
- };
@@ -1,215 +0,0 @@
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
- };
@@ -1,38 +0,0 @@
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
- };
@@ -1,40 +0,0 @@
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,72 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const labelConfig: ComponentConfig = {
4
- name: 'Label',
5
- description: 'Accessible label component for form inputs',
6
- category: 'primitives',
7
- tags: ['form', 'accessibility'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="text-sm font-medium text-gray-700">Label</div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Basic label with default styling',
16
- code: '<Label htmlFor="email">Email</Label>',
17
- preview: {
18
- type: 'component',
19
- component: 'Label',
20
- props: { htmlFor: 'email', children: 'Email' },
21
- },
22
- },
23
- {
24
- name: 'With Input',
25
- description: 'Label associated with an input field',
26
- code: `<div class="grid w-full max-w-sm items-center gap-1.5">
27
- <Label htmlFor="email">Email</Label>
28
- <Input type="email" id="email" placeholder="Enter your email" />
29
- </div>`,
30
- preview: {
31
- type: 'component',
32
- component: 'Label',
33
- props: { htmlFor: 'email', children: 'Email' },
34
- },
35
- },
36
- {
37
- name: 'Required',
38
- description: 'Label for required field with asterisk',
39
- code: '<Label htmlFor="name">Name <span class="text-red-500">*</span></Label>',
40
- preview: {
41
- type: 'component',
42
- component: 'Label',
43
- props: {
44
- htmlFor: 'name',
45
- children: [
46
- 'Name ',
47
- {
48
- component: 'span',
49
- props: { className: 'text-red-500', children: '*' },
50
- },
51
- ],
52
- },
53
- },
54
- },
55
- {
56
- name: 'Disabled',
57
- description: 'Label for disabled input',
58
- code: '<Label htmlFor="disabled" className="text-muted-foreground">Disabled Field</Label>',
59
- preview: {
60
- type: 'component',
61
- component: 'Label',
62
- props: {
63
- htmlFor: 'disabled',
64
- className: 'text-muted-foreground',
65
- children: 'Disabled Field',
66
- },
67
- },
68
- },
69
- ],
70
- dependencies: ['utils'],
71
- files: ['components/primitives/label/index.tsx'],
72
- };
@@ -1,32 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as LabelPrimitive from '@radix-ui/react-label';
5
- import type * as React from 'react';
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
- */
16
- function Label({
17
- className,
18
- ...props
19
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
20
- return (
21
- <LabelPrimitive.Root
22
- data-slot='label'
23
- className={cn(
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',
25
- className
26
- )}
27
- {...props}
28
- />
29
- );
30
- }
31
-
32
- export { Label };
@@ -1,28 +0,0 @@
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
- };