@leitware/composables 0.1.0

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 (209) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +387 -0
  3. package/dist/presets/brutalist.css +298 -0
  4. package/dist/presets/default.css +298 -0
  5. package/dist/presets/signal-pop.css +369 -0
  6. package/dist/styles.css +2 -0
  7. package/package.json +216 -0
  8. package/rules/composables.md +244 -0
  9. package/src/_internal/accordion.tsx +93 -0
  10. package/src/_internal/ai-elements/attachments.tsx +385 -0
  11. package/src/_internal/ai-elements/chain-of-thought.tsx +197 -0
  12. package/src/_internal/ai-elements/code-block.tsx +516 -0
  13. package/src/_internal/ai-elements/confirmation.tsx +150 -0
  14. package/src/_internal/ai-elements/conversation.tsx +148 -0
  15. package/src/_internal/ai-elements/inline-citation.tsx +248 -0
  16. package/src/_internal/ai-elements/message.tsx +292 -0
  17. package/src/_internal/ai-elements/plan.tsx +126 -0
  18. package/src/_internal/ai-elements/prompt-input.tsx +1285 -0
  19. package/src/_internal/ai-elements/reasoning.tsx +208 -0
  20. package/src/_internal/ai-elements/shimmer.tsx +72 -0
  21. package/src/_internal/ai-elements/sources.tsx +53 -0
  22. package/src/_internal/ai-elements/suggestion.tsx +48 -0
  23. package/src/_internal/ai-elements/task.tsx +64 -0
  24. package/src/_internal/ai-elements/tool.tsx +156 -0
  25. package/src/_internal/alert-dialog.tsx +159 -0
  26. package/src/_internal/alert.tsx +88 -0
  27. package/src/_internal/aspect-ratio.tsx +23 -0
  28. package/src/_internal/avatar.tsx +58 -0
  29. package/src/_internal/badge.tsx +60 -0
  30. package/src/_internal/breadcrumb.tsx +104 -0
  31. package/src/_internal/bubble.tsx +125 -0
  32. package/src/_internal/button-group.tsx +78 -0
  33. package/src/_internal/button.tsx +62 -0
  34. package/src/_internal/calendar.tsx +179 -0
  35. package/src/_internal/card.tsx +83 -0
  36. package/src/_internal/carousel.tsx +215 -0
  37. package/src/_internal/checkbox.tsx +26 -0
  38. package/src/_internal/code-block.tsx +53 -0
  39. package/src/_internal/collapsible.tsx +15 -0
  40. package/src/_internal/combobox.tsx +264 -0
  41. package/src/_internal/command.tsx +155 -0
  42. package/src/_internal/container.tsx +35 -0
  43. package/src/_internal/dialog.tsx +132 -0
  44. package/src/_internal/direction.tsx +12 -0
  45. package/src/_internal/divider.tsx +162 -0
  46. package/src/_internal/dropdown-menu.tsx +247 -0
  47. package/src/_internal/dropzone.tsx +481 -0
  48. package/src/_internal/empty.tsx +94 -0
  49. package/src/_internal/field.tsx +221 -0
  50. package/src/_internal/grid-overlay.tsx +48 -0
  51. package/src/_internal/grid.tsx +109 -0
  52. package/src/_internal/hover-card.tsx +47 -0
  53. package/src/_internal/icon.tsx +45 -0
  54. package/src/_internal/input-group.tsx +146 -0
  55. package/src/_internal/input.tsx +24 -0
  56. package/src/_internal/item.tsx +187 -0
  57. package/src/_internal/kbd.tsx +28 -0
  58. package/src/_internal/label.tsx +18 -0
  59. package/src/_internal/layout-bento.tsx +386 -0
  60. package/src/_internal/layout.tsx +174 -0
  61. package/src/_internal/marker.tsx +66 -0
  62. package/src/_internal/message.tsx +85 -0
  63. package/src/_internal/native-select.tsx +50 -0
  64. package/src/_internal/pagination.tsx +108 -0
  65. package/src/_internal/popover.tsx +83 -0
  66. package/src/_internal/progress.tsx +59 -0
  67. package/src/_internal/radio-group.tsx +36 -0
  68. package/src/_internal/resizable.tsx +44 -0
  69. package/src/_internal/scroll-area.tsx +48 -0
  70. package/src/_internal/select.tsx +187 -0
  71. package/src/_internal/separator.tsx +19 -0
  72. package/src/_internal/sheet.tsx +122 -0
  73. package/src/_internal/sidebar.tsx +687 -0
  74. package/src/_internal/skeleton.tsx +13 -0
  75. package/src/_internal/slider.tsx +60 -0
  76. package/src/_internal/sonner.tsx +51 -0
  77. package/src/_internal/spacer.tsx +42 -0
  78. package/src/_internal/spinner.tsx +16 -0
  79. package/src/_internal/stack.tsx +78 -0
  80. package/src/_internal/switch.tsx +31 -0
  81. package/src/_internal/table.tsx +84 -0
  82. package/src/_internal/tabs.tsx +74 -0
  83. package/src/_internal/textarea.tsx +19 -0
  84. package/src/_internal/toggle-group.tsx +99 -0
  85. package/src/_internal/toggle.tsx +42 -0
  86. package/src/_internal/tooltip.tsx +55 -0
  87. package/src/_internal/typography.tsx +129 -0
  88. package/src/hooks/use-mobile.ts +19 -0
  89. package/src/hooks/use-numeric-input.ts +119 -0
  90. package/src/index.ts +443 -0
  91. package/src/lib/numeric-input.ts +88 -0
  92. package/src/lib/utils.ts +39 -0
  93. package/src/opinionated/accordion.tsx +92 -0
  94. package/src/opinionated/ai/attachments.tsx +27 -0
  95. package/src/opinionated/ai/chain-of-thought.tsx +16 -0
  96. package/src/opinionated/ai/code-block.tsx +22 -0
  97. package/src/opinionated/ai/confirmation.tsx +16 -0
  98. package/src/opinionated/ai/conversation.tsx +13 -0
  99. package/src/opinionated/ai/index.ts +15 -0
  100. package/src/opinionated/ai/inline-citation.tsx +30 -0
  101. package/src/opinionated/ai/message.tsx +26 -0
  102. package/src/opinionated/ai/plan.tsx +18 -0
  103. package/src/opinionated/ai/prompt-input.tsx +29 -0
  104. package/src/opinionated/ai/reasoning.tsx +9 -0
  105. package/src/opinionated/ai/shimmer.tsx +4 -0
  106. package/src/opinionated/ai/sources.tsx +10 -0
  107. package/src/opinionated/ai/suggestion.tsx +6 -0
  108. package/src/opinionated/ai/task.tsx +12 -0
  109. package/src/opinionated/ai/tool.tsx +14 -0
  110. package/src/opinionated/alert-dialog.tsx +143 -0
  111. package/src/opinionated/alert.tsx +99 -0
  112. package/src/opinionated/aspect-ratio.tsx +12 -0
  113. package/src/opinionated/avatar.tsx +59 -0
  114. package/src/opinionated/badge.tsx +33 -0
  115. package/src/opinionated/breadcrumb.tsx +99 -0
  116. package/src/opinionated/bubble.tsx +9 -0
  117. package/src/opinionated/button.tsx +59 -0
  118. package/src/opinionated/calendar.tsx +20 -0
  119. package/src/opinionated/card.tsx +83 -0
  120. package/src/opinionated/carousel.tsx +99 -0
  121. package/src/opinionated/checkbox.tsx +11 -0
  122. package/src/opinionated/code-block.tsx +12 -0
  123. package/src/opinionated/collapsible.tsx +123 -0
  124. package/src/opinionated/combobox.tsx +123 -0
  125. package/src/opinionated/container.tsx +12 -0
  126. package/src/opinionated/dialog.tsx +124 -0
  127. package/src/opinionated/direction.tsx +6 -0
  128. package/src/opinionated/divider.tsx +13 -0
  129. package/src/opinionated/dropdown-menu.tsx +131 -0
  130. package/src/opinionated/dropzone.tsx +39 -0
  131. package/src/opinionated/empty.tsx +191 -0
  132. package/src/opinionated/field.tsx +26 -0
  133. package/src/opinionated/form-calendar-popover.tsx +138 -0
  134. package/src/opinionated/form-checkbox.tsx +107 -0
  135. package/src/opinionated/form-combobox.tsx +181 -0
  136. package/src/opinionated/form-date-of-birth.tsx +193 -0
  137. package/src/opinionated/form-dropzone.tsx +126 -0
  138. package/src/opinionated/form-input-group.tsx +184 -0
  139. package/src/opinionated/form-input.tsx +118 -0
  140. package/src/opinionated/form-multi-combobox.tsx +213 -0
  141. package/src/opinionated/form-multi-dropzone.tsx +141 -0
  142. package/src/opinionated/form-radiogroup.tsx +116 -0
  143. package/src/opinionated/form-select.tsx +176 -0
  144. package/src/opinionated/form-slider.tsx +100 -0
  145. package/src/opinionated/form-switch.tsx +117 -0
  146. package/src/opinionated/form-textarea.tsx +79 -0
  147. package/src/opinionated/grid-overlay.tsx +11 -0
  148. package/src/opinionated/grid.tsx +14 -0
  149. package/src/opinionated/hover-card.tsx +59 -0
  150. package/src/opinionated/icon.tsx +14 -0
  151. package/src/opinionated/input-group.tsx +20 -0
  152. package/src/opinionated/input.tsx +11 -0
  153. package/src/opinionated/item.tsx +182 -0
  154. package/src/opinionated/kbd.tsx +16 -0
  155. package/src/opinionated/label.tsx +11 -0
  156. package/src/opinionated/layout-bento.tsx +29 -0
  157. package/src/opinionated/layout.tsx +26 -0
  158. package/src/opinionated/list.tsx +94 -0
  159. package/src/opinionated/marker.tsx +7 -0
  160. package/src/opinionated/message.tsx +8 -0
  161. package/src/opinionated/native-select.tsx +51 -0
  162. package/src/opinionated/pagination.tsx +204 -0
  163. package/src/opinionated/popover.tsx +68 -0
  164. package/src/opinionated/progress.tsx +48 -0
  165. package/src/opinionated/radio-group.tsx +13 -0
  166. package/src/opinionated/resizable.tsx +2 -0
  167. package/src/opinionated/scroll-area.tsx +82 -0
  168. package/src/opinionated/select.tsx +101 -0
  169. package/src/opinionated/separator.tsx +11 -0
  170. package/src/opinionated/sheet.tsx +120 -0
  171. package/src/opinionated/sidebar.tsx +68 -0
  172. package/src/opinionated/skeleton.tsx +246 -0
  173. package/src/opinionated/slider.tsx +11 -0
  174. package/src/opinionated/sonner.tsx +15 -0
  175. package/src/opinionated/spacer.tsx +11 -0
  176. package/src/opinionated/stack.tsx +18 -0
  177. package/src/opinionated/switch.tsx +11 -0
  178. package/src/opinionated/table.tsx +11 -0
  179. package/src/opinionated/tabs.tsx +68 -0
  180. package/src/opinionated/textarea.tsx +11 -0
  181. package/src/opinionated/theme-injector.tsx +31 -0
  182. package/src/opinionated/toggle-group.tsx +63 -0
  183. package/src/opinionated/toggle.tsx +75 -0
  184. package/src/opinionated/token-config-panel/color-editor.tsx +85 -0
  185. package/src/opinionated/token-config-panel/helpers.ts +31 -0
  186. package/src/opinionated/token-config-panel/index.tsx +398 -0
  187. package/src/opinionated/token-config-panel/json-import-export.tsx +89 -0
  188. package/src/opinionated/token-config-panel/preset-manager.ts +31 -0
  189. package/src/opinionated/token-config-panel/presets-data.ts +23 -0
  190. package/src/opinionated/token-config-panel/spacing-editor.tsx +325 -0
  191. package/src/opinionated/token-config-panel/types.ts +39 -0
  192. package/src/opinionated/token-config-panel/typography-editor.tsx +145 -0
  193. package/src/opinionated/tooltip.tsx +62 -0
  194. package/src/opinionated/typography.tsx +7 -0
  195. package/src/scripts/lint-no-arbitrary.ts +155 -0
  196. package/src/styles/composable.css +68 -0
  197. package/src/styles/presets/brutalist.css +298 -0
  198. package/src/styles/presets/default.css +298 -0
  199. package/src/styles/presets/signal-pop.css +369 -0
  200. package/src/styles/presets-data/brutalist.ts +325 -0
  201. package/src/styles/presets-data/default.ts +315 -0
  202. package/src/styles/presets-data/index.ts +45 -0
  203. package/src/styles/presets-data/signal-pop.ts +393 -0
  204. package/src/styles/tokens/base.css +71 -0
  205. package/src/styles/tokens/components.css +150 -0
  206. package/src/styles/tokens/palette.css +795 -0
  207. package/src/styles/tokens/registry.ts +324 -0
  208. package/src/styles/tokens/semantic.css +266 -0
  209. package/src/styles/tokens/tailwind-theme.css +247 -0
@@ -0,0 +1,100 @@
1
+ import type { Slider as SliderPrimitiveBase } from '@base-ui/react/slider'
2
+ import type { VariantProps } from 'class-variance-authority'
3
+ import * as React from 'react'
4
+ import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../_internal/field'
5
+ import { Slider as SliderPrimitive } from '../_internal/slider'
6
+
7
+ export interface FormSliderProps extends Omit<
8
+ SliderPrimitiveBase.Root.Props,
9
+ 'children' | 'orientation'
10
+ > {
11
+ label?: string
12
+ description?: string
13
+ error?: string | string[] | Array<{ message?: string } | undefined>
14
+ showValue?: boolean
15
+ valueFormatter?: (value: number | number[] | readonly number[]) => string
16
+ orientation?: VariantProps<typeof Field>['orientation']
17
+ className?: string
18
+ required?: boolean
19
+ }
20
+
21
+ function FormSlider({
22
+ label,
23
+ description,
24
+ error,
25
+ showValue = false,
26
+ valueFormatter,
27
+ orientation = 'vertical',
28
+ className,
29
+ required = false,
30
+ value,
31
+ defaultValue,
32
+ min = 0,
33
+ max = 100,
34
+ step,
35
+ disabled,
36
+ ...sliderProps
37
+ }: FormSliderProps) {
38
+ const errorArray = React.useMemo(() => {
39
+ if (!error) return undefined
40
+ if (Array.isArray(error)) {
41
+ return error.map((e) => (typeof e === 'string' ? { message: e } : e))
42
+ }
43
+ return [{ message: error }]
44
+ }, [error])
45
+
46
+ const hasError = Boolean(error)
47
+ const generatedId = React.useId()
48
+ const sliderId = sliderProps.id || generatedId
49
+
50
+ // Format the current value for display
51
+ const formatValue = React.useCallback(
52
+ (val: number | number[] | readonly number[] | undefined) => {
53
+ if (val === undefined) return ''
54
+ if (valueFormatter) {
55
+ return valueFormatter(val)
56
+ }
57
+ if (Array.isArray(val)) {
58
+ return val.join(' - ')
59
+ }
60
+ return String(val)
61
+ },
62
+ [valueFormatter],
63
+ )
64
+
65
+ const currentValue = value ?? defaultValue
66
+ const displayValue = formatValue(currentValue)
67
+
68
+ return (
69
+ <Field orientation={orientation} className={className} data-invalid={hasError}>
70
+ {(label || showValue) && (
71
+ <FieldLabel htmlFor={sliderId}>
72
+ {label}
73
+ {required && <span className="text-danger">*</span>}
74
+ {showValue && displayValue && (
75
+ <span className="ml-auto text-muted-foreground font-normal">{displayValue}</span>
76
+ )}
77
+ </FieldLabel>
78
+ )}
79
+ <FieldContent>
80
+ <SliderPrimitive
81
+ id={sliderId}
82
+ value={value}
83
+ defaultValue={defaultValue}
84
+ min={min}
85
+ max={max}
86
+ step={step}
87
+ disabled={disabled}
88
+ aria-invalid={hasError}
89
+ aria-required={required}
90
+ aria-label={label || undefined}
91
+ {...sliderProps}
92
+ />
93
+ {description && <FieldDescription>{description}</FieldDescription>}
94
+ {hasError && <FieldError errors={errorArray} />}
95
+ </FieldContent>
96
+ </Field>
97
+ )
98
+ }
99
+
100
+ export { FormSlider }
@@ -0,0 +1,117 @@
1
+ import type { Switch as SwitchPrimitive } from '@base-ui/react/switch'
2
+ import type { VariantProps } from 'class-variance-authority'
3
+ import * as React from 'react'
4
+ import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../_internal/field'
5
+ import { Switch } from '../_internal/switch'
6
+
7
+ /**
8
+ * Props for the opinionated FormSwitch component.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <FormSwitch label="Email notifications" checked={enabled} onCheckedChange={setEnabled} />
13
+ * <FormSwitch
14
+ * label="Dark mode"
15
+ * description="Applies immediately across the app"
16
+ * checked={darkMode}
17
+ * onCheckedChange={setDarkMode}
18
+ * />
19
+ * ```
20
+ */
21
+ export interface FormSwitchProps extends Omit<
22
+ SwitchPrimitive.Root.Props,
23
+ 'checked' | 'onCheckedChange'
24
+ > {
25
+ /** Label text rendered beside the switch. */
26
+ label?: string
27
+ /** Helper text rendered below the label. */
28
+ description?: string
29
+ /** Error message(s). Accepts a string, array, or react-hook-form error array. */
30
+ error?: string | string[] | Array<{ message?: string } | undefined>
31
+ /** Controlled checked state. @default false */
32
+ checked?: boolean
33
+ /** Called when the user toggles the switch. */
34
+ onCheckedChange?: (checked: boolean) => void
35
+ /** Disables the switch. @default false */
36
+ disabled?: boolean
37
+ /** Marks the field as required. @default false */
38
+ required?: boolean
39
+ /** Label/switch layout direction. @default 'horizontal' */
40
+ orientation?: VariantProps<typeof Field>['orientation']
41
+ /** Switch size variant. @default 'default' */
42
+ size?: 'sm' | 'default'
43
+ className?: string
44
+ id?: string
45
+ name?: string
46
+ 'aria-label'?: string
47
+ 'aria-labelledby'?: string
48
+ }
49
+
50
+ function FormSwitch({
51
+ label,
52
+ description,
53
+ error,
54
+ checked = false,
55
+ onCheckedChange,
56
+ disabled = false,
57
+ required = false,
58
+ orientation = 'horizontal',
59
+ size = 'default',
60
+ className,
61
+ id,
62
+ name,
63
+ 'aria-label': ariaLabel,
64
+ 'aria-labelledby': ariaLabelledBy,
65
+ ...switchProps
66
+ }: FormSwitchProps) {
67
+ const errorArray = React.useMemo(() => {
68
+ if (!error) return undefined
69
+ if (Array.isArray(error)) {
70
+ return error.map((e) => (typeof e === 'string' ? { message: e } : e))
71
+ }
72
+ return [{ message: error }]
73
+ }, [error])
74
+
75
+ const hasError = Boolean(error)
76
+ const generatedId = React.useId()
77
+ const switchId = id || generatedId
78
+
79
+ const hasLabelOrDescription = Boolean(label || description)
80
+
81
+ return (
82
+ <Field orientation={orientation} className={className} data-invalid={hasError}>
83
+ <FieldContent
84
+ className={orientation === 'horizontal' ? 'flex-row items-center gap-2' : undefined}
85
+ >
86
+ {hasLabelOrDescription && (
87
+ <div className="flex flex-col gap-0.5 flex-1">
88
+ {label && (
89
+ <FieldLabel htmlFor={switchId}>
90
+ {label}
91
+ {required && <span className="text-danger">*</span>}
92
+ </FieldLabel>
93
+ )}
94
+ {description && <FieldDescription>{description}</FieldDescription>}
95
+ </div>
96
+ )}
97
+ <Switch
98
+ id={switchId}
99
+ name={name}
100
+ checked={checked}
101
+ onCheckedChange={onCheckedChange}
102
+ disabled={disabled}
103
+ required={required}
104
+ aria-invalid={hasError}
105
+ aria-required={required}
106
+ aria-label={ariaLabel}
107
+ aria-labelledby={ariaLabelledBy || (label ? switchId : undefined)}
108
+ size={size}
109
+ {...switchProps}
110
+ />
111
+ {hasError && <FieldError errors={errorArray} />}
112
+ </FieldContent>
113
+ </Field>
114
+ )
115
+ }
116
+
117
+ export { FormSwitch }
@@ -0,0 +1,79 @@
1
+ import type { VariantProps } from 'class-variance-authority'
2
+ import * as React from 'react'
3
+
4
+ import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../_internal/field'
5
+ import { Textarea } from '../_internal/textarea'
6
+
7
+ /**
8
+ * Props for the opinionated FormTextarea component.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <FormTextarea label="Message" placeholder="Write something..." rows={5} />
13
+ * <FormTextarea label="Bio" description="Max 300 characters" error={errors.bio?.message} />
14
+ * ```
15
+ */
16
+ export interface FormTextareaProps extends Omit<React.ComponentProps<'textarea'>, 'size'> {
17
+ /** Label text rendered above the textarea. */
18
+ label?: string
19
+ /** Helper text rendered below the textarea. */
20
+ description?: string
21
+ /** Error message(s). Accepts a string, array, or react-hook-form error array. */
22
+ error?: string | string[] | Array<{ message?: string } | undefined>
23
+ /** Disables the textarea. @default false */
24
+ disabled?: boolean
25
+ /** Marks the field as required. @default false */
26
+ required?: boolean
27
+ /** Label/textarea layout direction. @default 'vertical' */
28
+ orientation?: VariantProps<typeof Field>['orientation']
29
+ className?: string
30
+ }
31
+
32
+ function FormTextarea({
33
+ label,
34
+ description,
35
+ error,
36
+ disabled = false,
37
+ required = false,
38
+ orientation = 'vertical',
39
+ className,
40
+ id,
41
+ ...textareaProps
42
+ }: FormTextareaProps) {
43
+ const errorArray = React.useMemo(() => {
44
+ if (!error) return undefined
45
+ if (Array.isArray(error)) {
46
+ return error.map((e) => (typeof e === 'string' ? { message: e } : e))
47
+ }
48
+ return [{ message: error }]
49
+ }, [error])
50
+
51
+ const hasError = Boolean(error)
52
+ const generatedId = React.useId()
53
+ const textareaId = id || generatedId
54
+
55
+ return (
56
+ <Field orientation={orientation} className={className} data-invalid={hasError}>
57
+ {label && (
58
+ <FieldLabel htmlFor={textareaId}>
59
+ {label}
60
+ {required && <span className="text-danger">*</span>}
61
+ </FieldLabel>
62
+ )}
63
+ <FieldContent>
64
+ <Textarea
65
+ id={textareaId}
66
+ disabled={disabled}
67
+ required={required}
68
+ aria-invalid={hasError}
69
+ aria-required={required}
70
+ {...textareaProps}
71
+ />
72
+ {description && <FieldDescription>{description}</FieldDescription>}
73
+ {hasError && <FieldError errors={errorArray} />}
74
+ </FieldContent>
75
+ </Field>
76
+ )
77
+ }
78
+
79
+ export { FormTextarea }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Opinionated GridOverlay component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <GridOverlay />
8
+ * <GridOverlay color="rgba(0, 100, 255, 0.1)" />
9
+ * ```
10
+ */
11
+ export { GridOverlay, type GridOverlayProps } from '../_internal/grid-overlay'
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Opinionated Grid component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <Grid cols={3} gap="md">
8
+ * <div>Item 1</div>
9
+ * <div>Item 2</div>
10
+ * <div>Item 3</div>
11
+ * </Grid>
12
+ * ```
13
+ */
14
+ export { Grid, type GridProps, gridVariants } from '../_internal/grid'
@@ -0,0 +1,59 @@
1
+ import type { PreviewCard as HoverCardPrimitiveBase } from '@base-ui/react/preview-card'
2
+ import type * as React from 'react'
3
+
4
+ import {
5
+ HoverCardContent,
6
+ HoverCard as HoverCardPrimitive,
7
+ HoverCardTrigger,
8
+ } from '../_internal/hover-card'
9
+
10
+ export interface HoverCardProps extends Omit<HoverCardPrimitiveBase.Root.Props, 'children'> {
11
+ /** Element that triggers the hover card */
12
+ trigger: React.ReactNode
13
+ /** Content to display in the hover card */
14
+ children: React.ReactNode
15
+ /** Additional class names for the content */
16
+ className?: string
17
+ /** Alignment of the content relative to trigger */
18
+ align?: 'start' | 'center' | 'end'
19
+ /** Side to position the content */
20
+ side?: 'top' | 'right' | 'bottom' | 'left'
21
+ }
22
+
23
+ /**
24
+ * Opinionated HoverCard component for preview content on hover.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <HoverCard trigger={<a href="/user">@johndoe</a>}>
29
+ * <div className="flex gap-4">
30
+ * <Avatar src="/avatar.jpg" name="John Doe" />
31
+ * <div>
32
+ * <p className="font-medium">John Doe</p>
33
+ * <p className="text-muted-foreground text-sm">Software Engineer</p>
34
+ * </div>
35
+ * </div>
36
+ * </HoverCard>
37
+ * ```
38
+ */
39
+ function HoverCard({
40
+ trigger,
41
+ children,
42
+ className,
43
+ align = 'center',
44
+ side = 'bottom',
45
+ ...hoverCardProps
46
+ }: HoverCardProps) {
47
+ return (
48
+ <HoverCardPrimitive {...hoverCardProps}>
49
+ <HoverCardTrigger render={<>{trigger}</>} />
50
+ <HoverCardContent className={className} align={align} side={side}>
51
+ {children}
52
+ </HoverCardContent>
53
+ </HoverCardPrimitive>
54
+ )
55
+ }
56
+
57
+ // Re-export sub-components for advanced usage
58
+ export { HoverCardContent, HoverCardTrigger }
59
+ export { HoverCard }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Opinionated Icon component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * import { CheckIcon } from 'lucide-react'
8
+ *
9
+ * <Icon size="lg" color="primary">
10
+ * <CheckIcon />
11
+ * </Icon>
12
+ * ```
13
+ */
14
+ export { Icon, iconVariants } from '../_internal/icon'
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Opinionated InputGroup component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <InputGroup>
8
+ * <InputGroupAddon align="start">$</InputGroupAddon>
9
+ * <InputGroupInput placeholder="Amount" />
10
+ * <InputGroupButton>Submit</InputGroupButton>
11
+ * </InputGroup>
12
+ * ```
13
+ */
14
+ export {
15
+ InputGroup,
16
+ InputGroupAddon,
17
+ InputGroupButton,
18
+ InputGroupInput,
19
+ InputGroupTextarea,
20
+ } from '../_internal/input-group'
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Opinionated Input component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <Input placeholder="Enter your name" />
8
+ * <Input type="email" disabled />
9
+ * ```
10
+ */
11
+ export { Input } from '../_internal/input'
@@ -0,0 +1,182 @@
1
+ import type { VariantProps } from 'class-variance-authority'
2
+ import type * as React from 'react'
3
+ import {
4
+ ItemActions,
5
+ ItemContent,
6
+ ItemDescription,
7
+ ItemFooter,
8
+ ItemGroup,
9
+ ItemHeader,
10
+ ItemMedia,
11
+ Item as ItemPrimitive,
12
+ ItemSeparator,
13
+ ItemTitle,
14
+ type itemVariants,
15
+ } from '../_internal/item'
16
+ import { Typography } from './typography'
17
+
18
+ export type ItemVariants = typeof itemVariants
19
+
20
+ export interface ItemProps {
21
+ /**
22
+ * Title text for the item
23
+ */
24
+ title?: React.ReactNode
25
+ /**
26
+ * Description text for the item
27
+ */
28
+ description?: React.ReactNode
29
+ /**
30
+ * Icon or media content to display
31
+ */
32
+ icon?: React.ReactNode
33
+ /**
34
+ * Image URL or image element
35
+ */
36
+ image?: React.ReactNode
37
+ /**
38
+ * Actions (buttons, etc.) to display
39
+ */
40
+ actions?: React.ReactNode
41
+ /**
42
+ * Header content (overrides title/description if provided)
43
+ */
44
+ header?: React.ReactNode
45
+ /**
46
+ * Footer content
47
+ */
48
+ footer?: React.ReactNode
49
+ /**
50
+ * Additional content to display
51
+ */
52
+ children?: React.ReactNode
53
+ /**
54
+ * Visual style variant
55
+ * @default 'default'
56
+ */
57
+ variant?: VariantProps<typeof itemVariants>['variant']
58
+ /**
59
+ * Size variant
60
+ * @default 'default'
61
+ */
62
+ size?: VariantProps<typeof itemVariants>['size']
63
+ /**
64
+ * Additional className
65
+ */
66
+ className?: string
67
+ /**
68
+ * Click handler
69
+ */
70
+ onClick?: () => void
71
+ }
72
+
73
+ /**
74
+ * Opinionated Item component with sensible defaults and common patterns.
75
+ *
76
+ * @example
77
+ * ```tsx
78
+ * // Basic usage
79
+ * <Item title="Item Title" description="Item description" />
80
+ *
81
+ * // With icon
82
+ * <Item
83
+ * title="Settings"
84
+ * description="Manage your settings"
85
+ * icon={<SettingsIcon />}
86
+ * />
87
+ *
88
+ * // With image
89
+ * <Item
90
+ * title="Profile"
91
+ * description="View profile"
92
+ * image={<img src="avatar.jpg" alt="Avatar" />}
93
+ * />
94
+ *
95
+ * // With actions
96
+ * <Item
97
+ * title="Item"
98
+ * actions={<Button>Action</Button>}
99
+ * />
100
+ *
101
+ * // Clickable item
102
+ * <Item
103
+ * title="Click me"
104
+ * onClick={() => console.log('clicked')}
105
+ * />
106
+ * ```
107
+ */
108
+ function Item({
109
+ title,
110
+ description,
111
+ icon,
112
+ image,
113
+ actions,
114
+ header,
115
+ footer,
116
+ children,
117
+ variant = 'default',
118
+ size = 'default',
119
+ className,
120
+ onClick,
121
+ ...props
122
+ }: ItemProps & Omit<React.ComponentProps<typeof ItemPrimitive>, 'variant' | 'size' | 'children'>) {
123
+ const hasMedia = icon || image
124
+ const hasContent = title || description || children
125
+
126
+ return (
127
+ <ItemPrimitive variant={variant} size={size} className={className} onClick={onClick} {...props}>
128
+ {hasMedia && <ItemMedia variant={image ? 'image' : 'icon'}>{image || icon}</ItemMedia>}
129
+
130
+ {hasContent && (
131
+ <ItemContent>
132
+ {header ? (
133
+ header
134
+ ) : (
135
+ <>
136
+ {title && (
137
+ <ItemTitle>
138
+ {typeof title === 'string' ? (
139
+ <Typography variant="heading-100">{title}</Typography>
140
+ ) : (
141
+ title
142
+ )}
143
+ </ItemTitle>
144
+ )}
145
+ {description && (
146
+ <ItemDescription>
147
+ {typeof description === 'string' ? (
148
+ <Typography variant="body-100" className="text-muted-foreground">
149
+ {description}
150
+ </Typography>
151
+ ) : (
152
+ description
153
+ )}
154
+ </ItemDescription>
155
+ )}
156
+ </>
157
+ )}
158
+ {children}
159
+ </ItemContent>
160
+ )}
161
+
162
+ {actions && <ItemActions>{actions}</ItemActions>}
163
+
164
+ {footer && <ItemFooter>{footer}</ItemFooter>}
165
+ </ItemPrimitive>
166
+ )
167
+ }
168
+
169
+ // Export individual components for advanced usage
170
+ export {
171
+ ItemActions,
172
+ ItemContent,
173
+ ItemDescription,
174
+ ItemFooter,
175
+ ItemGroup,
176
+ ItemHeader,
177
+ ItemMedia,
178
+ ItemSeparator,
179
+ ItemTitle,
180
+ }
181
+
182
+ export { Item }
@@ -0,0 +1,16 @@
1
+ import type * as React from 'react'
2
+
3
+ import { Kbd as KbdPrimitive, KbdGroup as KbdGroupPrimitive } from '../_internal/kbd'
4
+
5
+ export interface KbdProps extends React.ComponentProps<'kbd'> {}
6
+ export interface KbdGroupProps extends React.ComponentProps<'span'> {}
7
+
8
+ function Kbd(props: KbdProps) {
9
+ return <KbdPrimitive {...props} />
10
+ }
11
+
12
+ function KbdGroup(props: KbdGroupProps) {
13
+ return <KbdGroupPrimitive {...props} />
14
+ }
15
+
16
+ export { Kbd, KbdGroup }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Opinionated Label component.
3
+ * Re-exports the primitive as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <Label htmlFor="email">Email address</Label>
8
+ * <Input id="email" type="email" />
9
+ * ```
10
+ */
11
+ export { Label } from '../_internal/label'
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Opinionated LayoutBento components.
3
+ * Re-exports the primitives as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <BentoGrid>
8
+ * <BentoCell colSpan={2}>Featured</BentoCell>
9
+ * <BentoCell>Small</BentoCell>
10
+ * <BentoCell>Small</BentoCell>
11
+ * </BentoGrid>
12
+ *
13
+ * <BentoSplit>
14
+ * <BentoLeader>Main content</BentoLeader>
15
+ * <BentoCell>Sidebar</BentoCell>
16
+ * </BentoSplit>
17
+ * ```
18
+ */
19
+ export {
20
+ BentoCell,
21
+ BentoGrid,
22
+ BentoLeader,
23
+ BentoQuad,
24
+ BentoSplit,
25
+ BentoTriple,
26
+ CellGrid,
27
+ CellRow,
28
+ StatCell,
29
+ } from '../_internal/layout-bento'
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Opinionated Layout components.
3
+ * Re-exports the primitives as the API is already clean.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <Section spacing="lg">
8
+ * <NewspaperGrid cols={3}>
9
+ * <NewspaperCell>Article 1</NewspaperCell>
10
+ * <NewspaperCell>Article 2</NewspaperCell>
11
+ * <NewspaperCell>Article 3</NewspaperCell>
12
+ * </NewspaperGrid>
13
+ * </Section>
14
+ *
15
+ * <FlexSpacer /> // Fills remaining space in flex container
16
+ * ```
17
+ */
18
+ export {
19
+ FlexSpacer,
20
+ NewspaperCell,
21
+ NewspaperGrid,
22
+ newspaperGridVariants,
23
+ Section,
24
+ sectionVariants,
25
+ } from '../_internal/layout'
26
+ export type { SectionProps, NewspaperGridProps, NewspaperCellProps } from '../_internal/layout'