@dalexto/lexsys-registry 0.0.2

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 (206) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/index.d.ts +25 -0
  4. package/dist/index.js +2164 -0
  5. package/dist/install-layer.d.ts +4 -0
  6. package/dist/items/accordion.d.ts +7 -0
  7. package/dist/items/alert-dialog.d.ts +7 -0
  8. package/dist/items/alert.d.ts +7 -0
  9. package/dist/items/auth-form.d.ts +7 -0
  10. package/dist/items/autocomplete.d.ts +7 -0
  11. package/dist/items/avatar.d.ts +7 -0
  12. package/dist/items/badge.d.ts +7 -0
  13. package/dist/items/button.d.ts +7 -0
  14. package/dist/items/card.d.ts +7 -0
  15. package/dist/items/checkbox-group.d.ts +7 -0
  16. package/dist/items/checkbox.d.ts +7 -0
  17. package/dist/items/collapsible.d.ts +7 -0
  18. package/dist/items/combobox.d.ts +7 -0
  19. package/dist/items/command-palette.d.ts +7 -0
  20. package/dist/items/context-menu.d.ts +7 -0
  21. package/dist/items/dashboard-shell.d.ts +7 -0
  22. package/dist/items/dialog.d.ts +7 -0
  23. package/dist/items/drawer.d.ts +7 -0
  24. package/dist/items/field.d.ts +7 -0
  25. package/dist/items/fieldset.d.ts +7 -0
  26. package/dist/items/form-field.d.ts +7 -0
  27. package/dist/items/form.d.ts +7 -0
  28. package/dist/items/index.d.ts +49 -0
  29. package/dist/items/input.d.ts +7 -0
  30. package/dist/items/menu.d.ts +7 -0
  31. package/dist/items/menubar.d.ts +7 -0
  32. package/dist/items/meter.d.ts +7 -0
  33. package/dist/items/navigation-menu.d.ts +7 -0
  34. package/dist/items/number-field.d.ts +7 -0
  35. package/dist/items/otp-field.d.ts +7 -0
  36. package/dist/items/popover.d.ts +7 -0
  37. package/dist/items/preview-card.d.ts +7 -0
  38. package/dist/items/progress.d.ts +7 -0
  39. package/dist/items/radio-group.d.ts +7 -0
  40. package/dist/items/scroll-area.d.ts +7 -0
  41. package/dist/items/select.d.ts +7 -0
  42. package/dist/items/separator.d.ts +7 -0
  43. package/dist/items/settings-panel.d.ts +7 -0
  44. package/dist/items/sidebar.d.ts +7 -0
  45. package/dist/items/slider.d.ts +7 -0
  46. package/dist/items/switch.d.ts +7 -0
  47. package/dist/items/tabs.d.ts +7 -0
  48. package/dist/items/textarea.d.ts +7 -0
  49. package/dist/items/toast.d.ts +7 -0
  50. package/dist/items/toggle-group.d.ts +7 -0
  51. package/dist/items/toggle.d.ts +7 -0
  52. package/dist/items/toolbar.d.ts +7 -0
  53. package/dist/items/tooltip.d.ts +7 -0
  54. package/dist/registry.types.d.ts +40 -0
  55. package/dist/styles/theme.d.ts +2 -0
  56. package/dist/utilities/cn.d.ts +2 -0
  57. package/dist/validate-registry-composition.d.ts +2 -0
  58. package/dist/validate-registry-item.d.ts +2 -0
  59. package/dist/validate-registry-template-imports.d.ts +4 -0
  60. package/dist/validate-registry.d.ts +9 -0
  61. package/package.json +52 -0
  62. package/templates/blocks/AuthForm/AuthForm.tsx +109 -0
  63. package/templates/blocks/AuthForm/AuthForm.types.ts +34 -0
  64. package/templates/blocks/AuthForm/AuthForm.variants.ts +11 -0
  65. package/templates/blocks/CommandPalette/CommandPalette.tsx +245 -0
  66. package/templates/blocks/CommandPalette/CommandPalette.types.ts +73 -0
  67. package/templates/blocks/CommandPalette/CommandPalette.variants.ts +26 -0
  68. package/templates/blocks/FormField/FormField.tsx +83 -0
  69. package/templates/blocks/FormField/FormField.types.ts +26 -0
  70. package/templates/blocks/FormField/FormField.variants.ts +9 -0
  71. package/templates/blocks/SettingsPanel/SettingsPanel.tsx +104 -0
  72. package/templates/blocks/SettingsPanel/SettingsPanel.types.ts +31 -0
  73. package/templates/blocks/SettingsPanel/SettingsPanel.variants.ts +9 -0
  74. package/templates/blocks/Sidebar/Sidebar.tsx +414 -0
  75. package/templates/blocks/Sidebar/Sidebar.types.ts +99 -0
  76. package/templates/blocks/Sidebar/Sidebar.variants.ts +84 -0
  77. package/templates/primitives/Accordion/Accordion.tsx +102 -0
  78. package/templates/primitives/Accordion/Accordion.types.ts +20 -0
  79. package/templates/primitives/Accordion/Accordion.variants.ts +32 -0
  80. package/templates/primitives/Alert/Alert.tsx +62 -0
  81. package/templates/primitives/Alert/Alert.types.ts +35 -0
  82. package/templates/primitives/Alert/Alert.variants.ts +41 -0
  83. package/templates/primitives/AlertDialog/AlertDialog.tsx +168 -0
  84. package/templates/primitives/AlertDialog/AlertDialog.types.ts +30 -0
  85. package/templates/primitives/AlertDialog/AlertDialog.variants.ts +57 -0
  86. package/templates/primitives/Autocomplete/Autocomplete.tsx +394 -0
  87. package/templates/primitives/Autocomplete/Autocomplete.types.ts +82 -0
  88. package/templates/primitives/Autocomplete/Autocomplete.variants.ts +154 -0
  89. package/templates/primitives/Avatar/Avatar.tsx +56 -0
  90. package/templates/primitives/Avatar/Avatar.types.ts +31 -0
  91. package/templates/primitives/Avatar/Avatar.variants.ts +40 -0
  92. package/templates/primitives/Badge/Badge.tsx +30 -0
  93. package/templates/primitives/Badge/Badge.types.ts +30 -0
  94. package/templates/primitives/Badge/Badge.variants.ts +81 -0
  95. package/templates/primitives/Button/Button.tsx +53 -0
  96. package/templates/primitives/Button/Button.types.ts +25 -0
  97. package/templates/primitives/Button/Button.variants.ts +69 -0
  98. package/templates/primitives/Card/Card.tsx +85 -0
  99. package/templates/primitives/Card/Card.types.ts +54 -0
  100. package/templates/primitives/Card/Card.variants.ts +46 -0
  101. package/templates/primitives/Checkbox/Checkbox.tsx +72 -0
  102. package/templates/primitives/Checkbox/Checkbox.types.ts +28 -0
  103. package/templates/primitives/Checkbox/Checkbox.variants.ts +39 -0
  104. package/templates/primitives/CheckboxGroup/CheckboxGroup.tsx +32 -0
  105. package/templates/primitives/CheckboxGroup/CheckboxGroup.types.ts +17 -0
  106. package/templates/primitives/CheckboxGroup/CheckboxGroup.variants.ts +25 -0
  107. package/templates/primitives/Collapsible/Collapsible.tsx +74 -0
  108. package/templates/primitives/Collapsible/Collapsible.types.ts +28 -0
  109. package/templates/primitives/Collapsible/Collapsible.variants.ts +44 -0
  110. package/templates/primitives/Combobox/Combobox.tsx +450 -0
  111. package/templates/primitives/Combobox/Combobox.types.ts +99 -0
  112. package/templates/primitives/Combobox/Combobox.variants.ts +180 -0
  113. package/templates/primitives/ContextMenu/ContextMenu.tsx +375 -0
  114. package/templates/primitives/ContextMenu/ContextMenu.types.ts +57 -0
  115. package/templates/primitives/ContextMenu/ContextMenu.variants.ts +39 -0
  116. package/templates/primitives/Dialog/Dialog.tsx +148 -0
  117. package/templates/primitives/Dialog/Dialog.types.ts +29 -0
  118. package/templates/primitives/Dialog/Dialog.variants.ts +56 -0
  119. package/templates/primitives/Drawer/Drawer.tsx +266 -0
  120. package/templates/primitives/Drawer/Drawer.types.ts +77 -0
  121. package/templates/primitives/Drawer/Drawer.variants.ts +175 -0
  122. package/templates/primitives/Field/Field.tsx +132 -0
  123. package/templates/primitives/Field/Field.types.ts +43 -0
  124. package/templates/primitives/Field/Field.variants.ts +77 -0
  125. package/templates/primitives/Fieldset/Fieldset.tsx +36 -0
  126. package/templates/primitives/Fieldset/Fieldset.types.ts +26 -0
  127. package/templates/primitives/Fieldset/Fieldset.variants.ts +37 -0
  128. package/templates/primitives/Form/Form.tsx +24 -0
  129. package/templates/primitives/Form/Form.types.ts +13 -0
  130. package/templates/primitives/Form/Form.variants.ts +11 -0
  131. package/templates/primitives/Input/Input.tsx +36 -0
  132. package/templates/primitives/Input/Input.types.ts +27 -0
  133. package/templates/primitives/Input/Input.variants.ts +41 -0
  134. package/templates/primitives/Menu/Menu.tsx +352 -0
  135. package/templates/primitives/Menu/Menu.types.ts +56 -0
  136. package/templates/primitives/Menu/Menu.variants.ts +73 -0
  137. package/templates/primitives/Menubar/Menubar.tsx +25 -0
  138. package/templates/primitives/Menubar/Menubar.types.ts +12 -0
  139. package/templates/primitives/Menubar/Menubar.variants.ts +22 -0
  140. package/templates/primitives/Meter/Meter.tsx +123 -0
  141. package/templates/primitives/Meter/Meter.types.ts +45 -0
  142. package/templates/primitives/Meter/Meter.variants.ts +47 -0
  143. package/templates/primitives/NavigationMenu/NavigationMenu.tsx +256 -0
  144. package/templates/primitives/NavigationMenu/NavigationMenu.types.ts +58 -0
  145. package/templates/primitives/NavigationMenu/NavigationMenu.variants.ts +40 -0
  146. package/templates/primitives/NumberField/NumberField.tsx +168 -0
  147. package/templates/primitives/NumberField/NumberField.types.ts +51 -0
  148. package/templates/primitives/NumberField/NumberField.variants.ts +92 -0
  149. package/templates/primitives/OtpField/OtpField.tsx +65 -0
  150. package/templates/primitives/OtpField/OtpField.types.ts +29 -0
  151. package/templates/primitives/OtpField/OtpField.variants.ts +45 -0
  152. package/templates/primitives/Popover/Popover.tsx +193 -0
  153. package/templates/primitives/Popover/Popover.types.ts +35 -0
  154. package/templates/primitives/Popover/Popover.variants.ts +68 -0
  155. package/templates/primitives/PreviewCard/PreviewCard.tsx +153 -0
  156. package/templates/primitives/PreviewCard/PreviewCard.types.ts +42 -0
  157. package/templates/primitives/PreviewCard/PreviewCard.variants.ts +24 -0
  158. package/templates/primitives/Progress/Progress.tsx +95 -0
  159. package/templates/primitives/Progress/Progress.types.ts +39 -0
  160. package/templates/primitives/Progress/Progress.variants.ts +39 -0
  161. package/templates/primitives/RadioGroup/RadioGroup.tsx +66 -0
  162. package/templates/primitives/RadioGroup/RadioGroup.types.ts +34 -0
  163. package/templates/primitives/RadioGroup/RadioGroup.variants.ts +59 -0
  164. package/templates/primitives/ScrollArea/ScrollArea.tsx +135 -0
  165. package/templates/primitives/ScrollArea/ScrollArea.types.ts +34 -0
  166. package/templates/primitives/ScrollArea/ScrollArea.variants.ts +38 -0
  167. package/templates/primitives/Select/Select.tsx +319 -0
  168. package/templates/primitives/Select/Select.types.ts +74 -0
  169. package/templates/primitives/Select/Select.variants.ts +94 -0
  170. package/templates/primitives/Separator/Separator.tsx +30 -0
  171. package/templates/primitives/Separator/Separator.types.ts +13 -0
  172. package/templates/primitives/Separator/Separator.variants.ts +19 -0
  173. package/templates/primitives/Slider/Slider.tsx +124 -0
  174. package/templates/primitives/Slider/Slider.types.ts +51 -0
  175. package/templates/primitives/Slider/Slider.variants.ts +38 -0
  176. package/templates/primitives/Switch/Switch.tsx +61 -0
  177. package/templates/primitives/Switch/Switch.types.ts +29 -0
  178. package/templates/primitives/Switch/Switch.variants.ts +48 -0
  179. package/templates/primitives/Tabs/Tabs.tsx +70 -0
  180. package/templates/primitives/Tabs/Tabs.types.ts +23 -0
  181. package/templates/primitives/Tabs/Tabs.variants.ts +29 -0
  182. package/templates/primitives/Textarea/Textarea.tsx +42 -0
  183. package/templates/primitives/Textarea/Textarea.types.ts +31 -0
  184. package/templates/primitives/Textarea/Textarea.variants.ts +46 -0
  185. package/templates/primitives/Toast/Toast.tsx +195 -0
  186. package/templates/primitives/Toast/Toast.types.ts +52 -0
  187. package/templates/primitives/Toast/Toast.variants.ts +88 -0
  188. package/templates/primitives/Toggle/Toggle.tsx +24 -0
  189. package/templates/primitives/Toggle/Toggle.types.ts +19 -0
  190. package/templates/primitives/Toggle/Toggle.variants.ts +32 -0
  191. package/templates/primitives/ToggleGroup/ToggleGroup.tsx +34 -0
  192. package/templates/primitives/ToggleGroup/ToggleGroup.types.ts +19 -0
  193. package/templates/primitives/ToggleGroup/ToggleGroup.variants.ts +32 -0
  194. package/templates/primitives/Toolbar/Toolbar.tsx +118 -0
  195. package/templates/primitives/Toolbar/Toolbar.types.ts +32 -0
  196. package/templates/primitives/Toolbar/Toolbar.variants.ts +84 -0
  197. package/templates/primitives/Tooltip/Tooltip.tsx +98 -0
  198. package/templates/primitives/Tooltip/Tooltip.types.ts +22 -0
  199. package/templates/primitives/Tooltip/Tooltip.variants.ts +24 -0
  200. package/templates/shared/utils/cn.ts +46 -0
  201. package/templates/styles/theme.css +311 -0
  202. package/templates/styles/tokens.css +1445 -0
  203. package/templates/templates/DashboardShell/DashboardShell.tsx +124 -0
  204. package/templates/templates/DashboardShell/DashboardShell.types.ts +37 -0
  205. package/templates/templates/DashboardShell/DashboardShell.variants.ts +25 -0
  206. package/templates/tsconfig.json +5 -0
@@ -0,0 +1,51 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Slider.types.ts
4
+ *
5
+ * Public and internal types for Slider component.
6
+ */
7
+
8
+ import type { Slider as BaseSlider } from "@base-ui/react/slider"
9
+
10
+ export interface SliderProps extends Omit<
11
+ BaseSlider.Root.Props,
12
+ "className" | "children"
13
+ > {
14
+ ref?: Ref<HTMLDivElement>
15
+ className?: BaseSlider.Root.Props["className"]
16
+ children?: BaseSlider.Root.Props["children"]
17
+ }
18
+
19
+ export interface SliderControlProps extends Omit<
20
+ BaseSlider.Control.Props,
21
+ "className" | "children"
22
+ > {
23
+ className?: BaseSlider.Control.Props["className"]
24
+ children?: BaseSlider.Control.Props["children"]
25
+ }
26
+
27
+ export interface SliderTrackProps extends Omit<
28
+ BaseSlider.Track.Props,
29
+ "className" | "children"
30
+ > {
31
+ className?: BaseSlider.Track.Props["className"]
32
+ children?: BaseSlider.Track.Props["children"]
33
+ }
34
+
35
+ export interface SliderIndicatorProps extends Omit<
36
+ BaseSlider.Indicator.Props,
37
+ "className"
38
+ > {
39
+ className?: BaseSlider.Indicator.Props["className"]
40
+ }
41
+
42
+ export interface SliderThumbProps extends Omit<
43
+ BaseSlider.Thumb.Props,
44
+ "className"
45
+ > {
46
+ className?: BaseSlider.Thumb.Props["className"]
47
+ }
48
+
49
+ export type SliderLabelProps = BaseSlider.Label.Props
50
+
51
+ export type SliderValueProps = BaseSlider.Value.Props
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Slider.variants.ts
3
+ *
4
+ * Defines visual variants using class composition.
5
+ */
6
+
7
+ import { cva } from "class-variance-authority"
8
+
9
+ export const sliderVariants = cva("grid gap-(--lsys-slider-gap)")
10
+
11
+ export const sliderControlVariants = cva(
12
+ "relative flex touch-none items-center py-(--lsys-slider-control-padding-y) data-[disabled]:opacity-(--lsys-opacity-disabled)",
13
+ )
14
+
15
+ export const sliderTrackVariants = cva(
16
+ "relative h-(--lsys-slider-track-height) w-full overflow-hidden rounded-(--lsys-slider-track-radius) bg-(--lsys-slider-track-background)",
17
+ )
18
+
19
+ export const sliderIndicatorVariants = cva(
20
+ "h-full bg-(--lsys-slider-indicator-background)",
21
+ )
22
+
23
+ export const sliderThumbVariants = cva(
24
+ [
25
+ "block size-(--lsys-slider-thumb-size) rounded-(--lsys-slider-thumb-radius) border border-(--lsys-slider-thumb-border-color) bg-(--lsys-slider-thumb-background) shadow-sm",
26
+ "outline-none transition-colors duration-(--lsys-slider-transition-duration) ease-(--lsys-slider-transition-easing)",
27
+ "focus-visible:ring-(length:--lsys-slider-focus-ring-width) focus-visible:ring-(--lsys-slider-focus-ring-color) focus-visible:ring-offset-(length:--lsys-slider-focus-ring-offset) focus-visible:ring-offset-(--lsys-slider-focus-ring-offset-color)",
28
+ "data-[disabled]:cursor-not-allowed",
29
+ ].join(" "),
30
+ )
31
+
32
+ export const sliderLabelVariants = cva(
33
+ "font-(--lsys-meter-label-font-weight) text-(length:--lsys-meter-label-font-size) leading-(--lsys-meter-label-font-line-height) text-(--lsys-meter-label-foreground)",
34
+ )
35
+
36
+ export const sliderValueVariants = cva(
37
+ "font-(--lsys-meter-value-font-weight) text-(--lsys-meter-value-foreground)",
38
+ )
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Switch.tsx
3
+ *
4
+ * Reference Switch component implementation.
5
+ */
6
+
7
+ import { createContext, useContext } from "react"
8
+ import { Switch as BaseSwitch } from "@base-ui/react/switch"
9
+ import type { SwitchProps, SwitchSize, SwitchThumbProps } from "./Switch.types"
10
+ import { switchThumbVariants, switchVariants } from "./Switch.variants"
11
+ import { mergeClassName } from "@/lib/utils"
12
+
13
+ interface SwitchContextValue {
14
+ size: SwitchSize
15
+ }
16
+
17
+ const SwitchContext = createContext<SwitchContextValue>({ size: "md" })
18
+
19
+ const useSwitchContext = () => useContext(SwitchContext)
20
+
21
+ const Switch = ({
22
+ ref,
23
+ size = "md",
24
+ className,
25
+ children,
26
+ ...props
27
+ }: SwitchProps) => {
28
+ return (
29
+ <SwitchContext.Provider value={{ size }}>
30
+ <BaseSwitch.Root
31
+ ref={ref}
32
+ className={mergeClassName(switchVariants({ size }), className)}
33
+ {...props}
34
+ >
35
+ {children}
36
+ </BaseSwitch.Root>
37
+ </SwitchContext.Provider>
38
+ )
39
+ }
40
+
41
+ Switch.displayName = "Switch"
42
+
43
+ const SwitchThumb = ({ ref, size, className, ...props }: SwitchThumbProps) => {
44
+ const context = useSwitchContext()
45
+ const resolvedSize = size ?? context.size
46
+
47
+ return (
48
+ <BaseSwitch.Thumb
49
+ ref={ref}
50
+ className={mergeClassName(
51
+ switchThumbVariants({ size: resolvedSize }),
52
+ className,
53
+ )}
54
+ {...props}
55
+ />
56
+ )
57
+ }
58
+
59
+ SwitchThumb.displayName = "SwitchThumb"
60
+
61
+ export { Switch, SwitchThumb }
@@ -0,0 +1,29 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Switch.types.ts
4
+ *
5
+ * Public and internal types for Switch component.
6
+ */
7
+
8
+ import type { Switch as BaseSwitch } from "@base-ui/react/switch"
9
+
10
+ export type SwitchSize = "sm" | "md" | "lg"
11
+
12
+ export interface SwitchProps extends Omit<
13
+ BaseSwitch.Root.Props,
14
+ "className" | "children"
15
+ > {
16
+ ref?: Ref<HTMLElement>
17
+ size?: SwitchSize
18
+ className?: BaseSwitch.Root.Props["className"]
19
+ children?: BaseSwitch.Root.Props["children"]
20
+ }
21
+
22
+ export interface SwitchThumbProps extends Omit<
23
+ BaseSwitch.Thumb.Props,
24
+ "className"
25
+ > {
26
+ ref?: Ref<HTMLElement>
27
+ size?: SwitchSize
28
+ className?: BaseSwitch.Thumb.Props["className"]
29
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Switch.variants.ts
3
+ *
4
+ * Defines visual variants using class composition.
5
+ */
6
+
7
+ import { cva } from "class-variance-authority"
8
+
9
+ export const switchVariants = cva(
10
+ [
11
+ "inline-flex shrink-0 cursor-pointer items-center rounded-(--lsys-switch-radius) border border-transparent bg-(--lsys-switch-background) p-(--lsys-switch-padding)",
12
+ "transition-colors duration-(--lsys-switch-transition-duration) ease-(--lsys-switch-transition-easing)",
13
+ "outline-none data-[checked]:bg-(--lsys-switch-checked-background)",
14
+ "data-[focused]:ring-(length:--lsys-switch-focus-ring-width) data-[focused]:ring-(--lsys-switch-focus-ring-color) data-[focused]:ring-offset-(length:--lsys-switch-focus-ring-offset) data-[focused]:ring-offset-(--lsys-switch-focus-ring-offset-color)",
15
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--lsys-opacity-disabled)",
16
+ ].join(" "),
17
+ {
18
+ variants: {
19
+ size: {
20
+ sm: "h-(--lsys-switch-height-sm) w-(--lsys-switch-width-sm)",
21
+ md: "h-(--lsys-switch-height-md) w-(--lsys-switch-width-md)",
22
+ lg: "h-(--lsys-switch-height-lg) w-(--lsys-switch-width-lg)",
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ size: "md",
27
+ },
28
+ },
29
+ )
30
+
31
+ export const switchThumbVariants = cva(
32
+ [
33
+ "block rounded-(--lsys-switch-thumb-radius) bg-(--lsys-switch-thumb-background) shadow-sm ring-0",
34
+ "transition-transform duration-(--lsys-switch-transition-duration) ease-(--lsys-switch-transition-easing)",
35
+ ].join(" "),
36
+ {
37
+ variants: {
38
+ size: {
39
+ sm: "size-(--lsys-switch-thumb-size-sm) data-[checked]:translate-x-(--lsys-switch-thumb-translate-sm)",
40
+ md: "size-(--lsys-switch-thumb-size-md) data-[checked]:translate-x-(--lsys-switch-thumb-translate-md)",
41
+ lg: "size-(--lsys-switch-thumb-size-lg) data-[checked]:translate-x-(--lsys-switch-thumb-translate-lg)",
42
+ },
43
+ },
44
+ defaultVariants: {
45
+ size: "md",
46
+ },
47
+ },
48
+ )
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Tabs.tsx
3
+ *
4
+ * Reference Tabs component implementation.
5
+ */
6
+
7
+ import { Tabs as BaseTabs } from "@base-ui/react/tabs"
8
+ import type {
9
+ TabsListProps,
10
+ TabsPanelProps,
11
+ TabsProps,
12
+ TabsTabProps,
13
+ } from "./Tabs.types"
14
+ import {
15
+ tabsListVariants,
16
+ tabsPanelVariants,
17
+ tabsRootVariants,
18
+ tabsTabVariants,
19
+ } from "./Tabs.variants"
20
+ import { mergeClassName } from "@/lib/utils"
21
+
22
+ const Tabs = ({ ref, className, ...props }: TabsProps) => {
23
+ return (
24
+ <BaseTabs.Root
25
+ ref={ref}
26
+ className={mergeClassName(tabsRootVariants(), className)}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ Tabs.displayName = "Tabs"
33
+
34
+ const TabsList = ({ ref, className, ...props }: TabsListProps) => {
35
+ return (
36
+ <BaseTabs.List
37
+ ref={ref}
38
+ className={mergeClassName(tabsListVariants(), className)}
39
+ {...props}
40
+ />
41
+ )
42
+ }
43
+
44
+ TabsList.displayName = "TabsList"
45
+
46
+ const TabsTab = ({ ref, className, ...props }: TabsTabProps) => {
47
+ return (
48
+ <BaseTabs.Tab
49
+ ref={ref}
50
+ className={mergeClassName(tabsTabVariants(), className)}
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ TabsTab.displayName = "TabsTab"
57
+
58
+ const TabsPanel = ({ ref, className, ...props }: TabsPanelProps) => {
59
+ return (
60
+ <BaseTabs.Panel
61
+ ref={ref}
62
+ className={mergeClassName(tabsPanelVariants(), className)}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ TabsPanel.displayName = "TabsPanel"
69
+
70
+ export { Tabs, TabsList, TabsTab, TabsPanel }
@@ -0,0 +1,23 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Tabs.types.ts
4
+ *
5
+ * Public and internal types for Tabs component.
6
+ */
7
+
8
+ import type { Tabs as BaseTabs } from "@base-ui/react/tabs"
9
+
10
+ export interface TabsProps extends Omit<BaseTabs.Root.Props, "className"> {
11
+ ref?: Ref<HTMLDivElement>
12
+ className?: BaseTabs.Root.Props["className"]
13
+ }
14
+
15
+ export interface TabsListProps extends Omit<BaseTabs.List.Props, "className"> {
16
+ className?: BaseTabs.List.Props["className"]
17
+ }
18
+
19
+ export interface TabsTabProps extends Omit<BaseTabs.Tab.Props, "className"> {
20
+ className?: BaseTabs.Tab.Props["className"]
21
+ }
22
+
23
+ export type TabsPanelProps = BaseTabs.Panel.Props
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Tabs.variants.ts
3
+ *
4
+ * Defines visual variants using class composition.
5
+ */
6
+
7
+ import { cva } from "class-variance-authority"
8
+ import { disabledStateClasses } from "@/lib/utils"
9
+
10
+ export const tabsRootVariants = cva("grid gap-(--lsys-tabs-gap)")
11
+
12
+ export const tabsListVariants = cva(
13
+ "inline-flex w-fit items-center rounded-(--lsys-tabs-list-radius) bg-(--lsys-tabs-list-background) p-(--lsys-tabs-list-padding)",
14
+ )
15
+
16
+ export const tabsTabVariants = cva(
17
+ [
18
+ "inline-flex items-center justify-center rounded-(--lsys-tabs-tab-radius) px-(--lsys-tabs-tab-padding-x) py-(--lsys-tabs-tab-padding-y)",
19
+ "text-(length:--lsys-tabs-tab-font-size) font-(--lsys-tabs-tab-font-weight) leading-(--lsys-tabs-tab-font-line-height) text-(--lsys-tabs-tab-foreground)",
20
+ "transition-colors duration-(--lsys-tabs-transition-duration) ease-(--lsys-tabs-transition-easing)",
21
+ "outline-none data-[active]:bg-(--lsys-tabs-tab-active-background) data-[active]:text-(--lsys-tabs-tab-active-foreground) data-[active]:shadow-sm",
22
+ "focus-visible:ring-(length:--lsys-tabs-focus-ring-width) focus-visible:ring-(--lsys-tabs-focus-ring-color)",
23
+ disabledStateClasses,
24
+ ].join(" "),
25
+ )
26
+
27
+ export const tabsPanelVariants = cva(
28
+ "text-(length:--lsys-tabs-panel-font-size) leading-(--lsys-tabs-panel-font-line-height) text-(--lsys-tabs-panel-foreground) outline-none focus-visible:ring-(length:--lsys-tabs-focus-ring-width) focus-visible:ring-(--lsys-tabs-focus-ring-color)",
29
+ )
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Textarea.tsx
3
+ *
4
+ * Reference Textarea component implementation.
5
+ */
6
+
7
+ import { Field as BaseField } from "@base-ui/react/field"
8
+ import type { TextareaProps } from "./Textarea.types"
9
+ import { textareaVariants } from "./Textarea.variants"
10
+ import { mergeClassName } from "@/lib/utils"
11
+
12
+ const Textarea = ({
13
+ ref,
14
+ variant,
15
+ size,
16
+ resize,
17
+ rows,
18
+ className,
19
+ isInvalid,
20
+ ...props
21
+ }: TextareaProps) => {
22
+ const baseTextareaProps: Omit<
23
+ TextareaProps,
24
+ "className" | "isInvalid" | "resize" | "rows" | "size" | "variant"
25
+ > = isInvalid ? { ...props, "aria-invalid": true } : props
26
+
27
+ return (
28
+ <BaseField.Control
29
+ ref={ref}
30
+ className={mergeClassName(
31
+ textareaVariants({ variant, size, resize }),
32
+ className,
33
+ )}
34
+ render={<textarea rows={rows} />}
35
+ {...baseTextareaProps}
36
+ />
37
+ )
38
+ }
39
+
40
+ Textarea.displayName = "Textarea"
41
+
42
+ export { Textarea }
@@ -0,0 +1,31 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Textarea.types.ts
4
+ *
5
+ * Public and internal types for Textarea component.
6
+ */
7
+
8
+ import type { Field as BaseField } from "@base-ui/react/field"
9
+
10
+ type TextareaAriaInvalid = boolean | "true" | "false" | "grammar" | "spelling"
11
+ type TextareaClassName = BaseField.Control.Props["className"]
12
+
13
+ export type TextareaVariant = "default" | "ghost"
14
+
15
+ export type TextareaSize = "sm" | "md" | "lg"
16
+
17
+ export type TextareaResize = "none" | "vertical" | "both"
18
+
19
+ export interface TextareaProps extends Omit<
20
+ BaseField.Control.Props,
21
+ "aria-invalid" | "className" | "ref" | "render" | "size" | "type"
22
+ > {
23
+ ref?: Ref<HTMLTextAreaElement>
24
+ variant?: TextareaVariant
25
+ size?: TextareaSize
26
+ resize?: TextareaResize
27
+ rows?: number
28
+ isInvalid?: boolean
29
+ "aria-invalid"?: TextareaAriaInvalid
30
+ className?: TextareaClassName
31
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Textarea.variants.ts
3
+ *
4
+ * Defines visual variants using class composition.
5
+ */
6
+
7
+ import { cva } from "class-variance-authority"
8
+ import { disabledStateClasses } from "@/lib/utils"
9
+
10
+ export const textareaVariants = cva(
11
+ [
12
+ "flex w-full min-w-0 border bg-(--lsys-textarea-background) text-(--lsys-textarea-foreground)",
13
+ "rounded-(--lsys-textarea-radius) border-(--lsys-textarea-border-color)",
14
+ "font-(family-name:--lsys-textarea-font-family) font-(--lsys-textarea-font-weight) leading-(--lsys-textarea-font-line-height) tracking-(--lsys-textarea-font-letter-spacing)",
15
+ "placeholder:text-(--lsys-textarea-placeholder-color)",
16
+ "transition-colors duration-(--lsys-textarea-transition-duration) ease-(--lsys-textarea-transition-easing)",
17
+ "outline-none focus-visible:border-(--lsys-textarea-focus-border-color) focus-visible:ring-(length:--lsys-textarea-focus-ring-width) focus-visible:ring-(--lsys-textarea-focus-ring-color) focus-visible:ring-offset-(length:--lsys-textarea-focus-ring-offset) focus-visible:ring-offset-(--lsys-textarea-focus-ring-offset-color)",
18
+ "disabled:cursor-not-allowed",
19
+ disabledStateClasses,
20
+ "aria-invalid:border-(--lsys-textarea-invalid-border-color) aria-invalid:ring-(--lsys-textarea-invalid-ring-color) data-[invalid]:border-(--lsys-textarea-invalid-border-color) data-[invalid]:ring-(--lsys-textarea-invalid-ring-color)",
21
+ ].join(" "),
22
+ {
23
+ variants: {
24
+ variant: {
25
+ default: "",
26
+ ghost:
27
+ "border-transparent bg-transparent focus-visible:bg-(--lsys-textarea-background)",
28
+ },
29
+ size: {
30
+ sm: "min-h-(--lsys-textarea-min-height-sm) px-(--lsys-textarea-padding-x-sm) py-(--lsys-textarea-padding-y-sm) text-(length:--lsys-textarea-font-size-sm)",
31
+ md: "min-h-(--lsys-textarea-min-height-md) px-(--lsys-textarea-padding-x-md) py-(--lsys-textarea-padding-y-md) text-(length:--lsys-textarea-font-size-md)",
32
+ lg: "min-h-(--lsys-textarea-min-height-lg) px-(--lsys-textarea-padding-x-lg) py-(--lsys-textarea-padding-y-lg) text-(length:--lsys-textarea-font-size-lg)",
33
+ },
34
+ resize: {
35
+ none: "resize-none",
36
+ vertical: "resize-y",
37
+ both: "resize",
38
+ },
39
+ },
40
+ defaultVariants: {
41
+ variant: "default",
42
+ size: "md",
43
+ resize: "vertical",
44
+ },
45
+ },
46
+ )
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Toast.tsx
3
+ *
4
+ * Reference Toast component implementation.
5
+ */
6
+
7
+ import { X } from "lucide-react"
8
+ import { Toast as BaseToast } from "@base-ui/react/toast"
9
+ import type {
10
+ ToastActionProps,
11
+ ToastArrowProps,
12
+ ToastCloseProps,
13
+ ToastContentProps,
14
+ ToastDescriptionProps,
15
+ ToastPortalProps,
16
+ ToastPositionerProps,
17
+ ToastProps,
18
+ ToastProviderProps,
19
+ ToastTitleProps,
20
+ ToastViewportProps,
21
+ } from "./Toast.types"
22
+ import {
23
+ toastActionVariants,
24
+ toastArrowVariants,
25
+ toastCloseVariants,
26
+ toastContentVariants,
27
+ toastDescriptionVariants,
28
+ toastPositionerVariants,
29
+ toastTitleVariants,
30
+ toastVariants,
31
+ toastViewportVariants,
32
+ } from "./Toast.variants"
33
+ import { mergeClassName } from "@/lib/utils"
34
+
35
+ const ToastProvider = (props: ToastProviderProps) => {
36
+ return <BaseToast.Provider {...props} />
37
+ }
38
+
39
+ ToastProvider.displayName = "ToastProvider"
40
+
41
+ const ToastPortal = ({ ref, ...props }: ToastPortalProps) => {
42
+ return <BaseToast.Portal ref={ref} {...props} />
43
+ }
44
+
45
+ ToastPortal.displayName = "ToastPortal"
46
+
47
+ const ToastViewport = ({
48
+ ref,
49
+ placement,
50
+ className,
51
+ ...props
52
+ }: ToastViewportProps) => {
53
+ return (
54
+ <BaseToast.Viewport
55
+ ref={ref}
56
+ className={mergeClassName(
57
+ toastViewportVariants({ placement }),
58
+ className,
59
+ )}
60
+ {...props}
61
+ />
62
+ )
63
+ }
64
+
65
+ ToastViewport.displayName = "ToastViewport"
66
+
67
+ const Toast = ({ ref, className, ...props }: ToastProps) => {
68
+ return (
69
+ <BaseToast.Root
70
+ ref={ref}
71
+ className={mergeClassName(toastVariants(), className)}
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ Toast.displayName = "Toast"
78
+
79
+ const ToastPositioner = ({
80
+ ref,
81
+ className,
82
+ ...props
83
+ }: ToastPositionerProps) => {
84
+ return (
85
+ <BaseToast.Positioner
86
+ ref={ref}
87
+ className={mergeClassName(toastPositionerVariants(), className)}
88
+ {...props}
89
+ />
90
+ )
91
+ }
92
+
93
+ ToastPositioner.displayName = "ToastPositioner"
94
+
95
+ const ToastContent = ({ ref, className, ...props }: ToastContentProps) => {
96
+ return (
97
+ <BaseToast.Content
98
+ ref={ref}
99
+ className={mergeClassName(toastContentVariants(), className)}
100
+ {...props}
101
+ />
102
+ )
103
+ }
104
+
105
+ ToastContent.displayName = "ToastContent"
106
+
107
+ const ToastArrow = ({ ref, className, ...props }: ToastArrowProps) => {
108
+ return (
109
+ <BaseToast.Arrow
110
+ ref={ref}
111
+ className={mergeClassName(toastArrowVariants(), className)}
112
+ {...props}
113
+ />
114
+ )
115
+ }
116
+
117
+ ToastArrow.displayName = "ToastArrow"
118
+
119
+ const ToastTitle = ({ ref, className, ...props }: ToastTitleProps) => {
120
+ return (
121
+ <BaseToast.Title
122
+ ref={ref}
123
+ className={mergeClassName(toastTitleVariants(), className)}
124
+ {...props}
125
+ />
126
+ )
127
+ }
128
+
129
+ ToastTitle.displayName = "ToastTitle"
130
+
131
+ const ToastDescription = ({
132
+ ref,
133
+ className,
134
+ ...props
135
+ }: ToastDescriptionProps) => {
136
+ return (
137
+ <BaseToast.Description
138
+ ref={ref}
139
+ className={mergeClassName(toastDescriptionVariants(), className)}
140
+ {...props}
141
+ />
142
+ )
143
+ }
144
+
145
+ ToastDescription.displayName = "ToastDescription"
146
+
147
+ const ToastAction = ({ ref, className, ...props }: ToastActionProps) => {
148
+ return (
149
+ <BaseToast.Action
150
+ ref={ref}
151
+ className={mergeClassName(toastActionVariants(), className)}
152
+ {...props}
153
+ />
154
+ )
155
+ }
156
+
157
+ ToastAction.displayName = "ToastAction"
158
+
159
+ const ToastClose = ({
160
+ ref,
161
+ className,
162
+ children,
163
+ ...props
164
+ }: ToastCloseProps) => {
165
+ return (
166
+ <BaseToast.Close
167
+ ref={ref}
168
+ className={mergeClassName(toastCloseVariants(), className)}
169
+ {...props}
170
+ >
171
+ {children ?? <X aria-hidden="true" size={16} />}
172
+ </BaseToast.Close>
173
+ )
174
+ }
175
+
176
+ ToastClose.displayName = "ToastClose"
177
+
178
+ const useToastManager = BaseToast.useToastManager
179
+ const createToastManager = BaseToast.createToastManager
180
+
181
+ export {
182
+ ToastProvider,
183
+ ToastPortal,
184
+ ToastViewport,
185
+ Toast,
186
+ ToastPositioner,
187
+ ToastContent,
188
+ ToastArrow,
189
+ ToastTitle,
190
+ ToastDescription,
191
+ ToastAction,
192
+ ToastClose,
193
+ useToastManager,
194
+ createToastManager,
195
+ }