@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,39 @@
1
+ /**
2
+ * ContextMenu.variants.ts
3
+ *
4
+ * Reuses Menu variant classes for context menu surfaces and items.
5
+ */
6
+
7
+ import { cva } from "class-variance-authority"
8
+ import {
9
+ menuArrowVariants,
10
+ menuBackdropVariants,
11
+ menuGroupLabelVariants,
12
+ menuGroupVariants,
13
+ menuItemIndicatorVariants,
14
+ menuItemTextVariants,
15
+ menuItemVariants,
16
+ menuPopupVariants,
17
+ menuPositionerVariants,
18
+ menuSeparatorVariants,
19
+ menuSubmenuTriggerIconVariants,
20
+ menuTriggerVariants,
21
+ } from "../Menu/Menu.variants"
22
+
23
+ export const contextMenuBackdropVariants = menuBackdropVariants
24
+ export const contextMenuPositionerVariants = menuPositionerVariants
25
+ export const contextMenuPopupVariants = menuPopupVariants
26
+ export const contextMenuArrowVariants = menuArrowVariants
27
+ export const contextMenuItemVariants = menuItemVariants
28
+ export const contextMenuItemIndicatorVariants = menuItemIndicatorVariants
29
+ export const contextMenuItemTextVariants = menuItemTextVariants
30
+ export const contextMenuGroupVariants = menuGroupVariants
31
+ export const contextMenuGroupLabelVariants = menuGroupLabelVariants
32
+ export const contextMenuSeparatorVariants = menuSeparatorVariants
33
+ export const contextMenuSubmenuTriggerVariants = menuTriggerVariants
34
+ export const contextMenuSubmenuTriggerIconVariants =
35
+ menuSubmenuTriggerIconVariants
36
+
37
+ export const contextMenuTriggerVariants = cva(
38
+ "outline-none focus-visible:ring-(length:--lsys-menu-focus-ring-width) focus-visible:ring-(--lsys-menu-focus-ring-color)",
39
+ )
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Dialog.tsx
3
+ *
4
+ * Reference Dialog component implementation.
5
+ */
6
+
7
+ import { X } from "lucide-react"
8
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog"
9
+ import type {
10
+ DialogBackdropProps,
11
+ DialogCloseProps,
12
+ DialogDescriptionProps,
13
+ DialogPopupProps,
14
+ DialogPortalProps,
15
+ DialogProps,
16
+ DialogTitleProps,
17
+ DialogTriggerProps,
18
+ DialogViewportProps,
19
+ } from "./Dialog.types"
20
+ import {
21
+ dialogBackdropVariants,
22
+ dialogCloseVariants,
23
+ dialogDescriptionVariants,
24
+ dialogPopupVariants,
25
+ dialogTitleVariants,
26
+ dialogTriggerVariants,
27
+ dialogViewportVariants,
28
+ } from "./Dialog.variants"
29
+ import { mergeClassName } from "@/lib/utils"
30
+
31
+ const Dialog = <Payload = unknown,>(props: DialogProps<Payload>) => {
32
+ return <BaseDialog.Root {...props} />
33
+ }
34
+
35
+ Dialog.displayName = "Dialog"
36
+
37
+ const DialogTrigger = ({ ref, className, ...props }: DialogTriggerProps) => {
38
+ return (
39
+ <BaseDialog.Trigger
40
+ ref={ref}
41
+ className={mergeClassName(dialogTriggerVariants(), className)}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ DialogTrigger.displayName = "DialogTrigger"
48
+
49
+ const DialogPortal = (props: DialogPortalProps) => {
50
+ return <BaseDialog.Portal {...props} />
51
+ }
52
+
53
+ DialogPortal.displayName = "DialogPortal"
54
+
55
+ const DialogBackdrop = ({ ref, className, ...props }: DialogBackdropProps) => {
56
+ return (
57
+ <BaseDialog.Backdrop
58
+ ref={ref}
59
+ className={mergeClassName(dialogBackdropVariants(), className)}
60
+ {...props}
61
+ />
62
+ )
63
+ }
64
+
65
+ DialogBackdrop.displayName = "DialogBackdrop"
66
+
67
+ const DialogViewport = ({ ref, className, ...props }: DialogViewportProps) => {
68
+ return (
69
+ <BaseDialog.Viewport
70
+ ref={ref}
71
+ className={mergeClassName(dialogViewportVariants(), className)}
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ DialogViewport.displayName = "DialogViewport"
78
+
79
+ const DialogPopup = ({ ref, className, ...props }: DialogPopupProps) => {
80
+ return (
81
+ <BaseDialog.Popup
82
+ ref={ref}
83
+ className={mergeClassName(dialogPopupVariants(), className)}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ DialogPopup.displayName = "DialogPopup"
90
+
91
+ const DialogTitle = ({ ref, className, ...props }: DialogTitleProps) => {
92
+ return (
93
+ <BaseDialog.Title
94
+ ref={ref}
95
+ className={mergeClassName(dialogTitleVariants(), className)}
96
+ {...props}
97
+ />
98
+ )
99
+ }
100
+
101
+ DialogTitle.displayName = "DialogTitle"
102
+
103
+ const DialogDescription = ({
104
+ ref,
105
+ className,
106
+ ...props
107
+ }: DialogDescriptionProps) => {
108
+ return (
109
+ <BaseDialog.Description
110
+ ref={ref}
111
+ className={mergeClassName(dialogDescriptionVariants(), className)}
112
+ {...props}
113
+ />
114
+ )
115
+ }
116
+
117
+ DialogDescription.displayName = "DialogDescription"
118
+
119
+ const DialogClose = ({
120
+ ref,
121
+ className,
122
+ children,
123
+ ...props
124
+ }: DialogCloseProps) => {
125
+ return (
126
+ <BaseDialog.Close
127
+ ref={ref}
128
+ className={mergeClassName(dialogCloseVariants(), className)}
129
+ {...props}
130
+ >
131
+ {children ?? <X aria-hidden="true" size={16} />}
132
+ </BaseDialog.Close>
133
+ )
134
+ }
135
+
136
+ DialogClose.displayName = "DialogClose"
137
+
138
+ export {
139
+ Dialog,
140
+ DialogTrigger,
141
+ DialogPortal,
142
+ DialogBackdrop,
143
+ DialogViewport,
144
+ DialogPopup,
145
+ DialogTitle,
146
+ DialogDescription,
147
+ DialogClose,
148
+ }
@@ -0,0 +1,29 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Dialog.types.ts
4
+ *
5
+ * Public and internal types for Dialog component.
6
+ */
7
+
8
+ import type { Dialog as BaseDialog } from "@base-ui/react/dialog"
9
+
10
+ export type DialogProps<Payload = unknown> = BaseDialog.Root.Props<Payload>
11
+
12
+ export type DialogTriggerProps<Payload = unknown> =
13
+ BaseDialog.Trigger.Props<Payload> & {
14
+ ref?: Ref<HTMLButtonElement>
15
+ }
16
+
17
+ export type DialogPortalProps = BaseDialog.Portal.Props
18
+
19
+ export type DialogBackdropProps = BaseDialog.Backdrop.Props
20
+
21
+ export type DialogViewportProps = BaseDialog.Viewport.Props
22
+
23
+ export type DialogPopupProps = BaseDialog.Popup.Props
24
+
25
+ export type DialogTitleProps = BaseDialog.Title.Props
26
+
27
+ export type DialogDescriptionProps = BaseDialog.Description.Props
28
+
29
+ export type DialogCloseProps = BaseDialog.Close.Props
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Dialog.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 dialogTriggerVariants = cva(
11
+ [
12
+ "inline-flex h-(--lsys-dialog-trigger-height) items-center justify-center rounded-(--lsys-dialog-trigger-radius)",
13
+ "bg-(--lsys-dialog-trigger-background) px-(--lsys-dialog-trigger-padding-x) text-(--lsys-dialog-trigger-foreground)",
14
+ "text-(length:--lsys-dialog-trigger-font-size) font-(--lsys-dialog-trigger-font-weight) leading-(--lsys-dialog-trigger-font-line-height)",
15
+ "transition-colors duration-(--lsys-dialog-transition-duration) ease-(--lsys-dialog-transition-easing)",
16
+ "outline-none hover:bg-(--lsys-dialog-trigger-hover-background) focus-visible:ring-(length:--lsys-dialog-focus-ring-width) focus-visible:ring-(--lsys-dialog-focus-ring-color) focus-visible:ring-offset-(length:--lsys-dialog-focus-ring-offset) focus-visible:ring-offset-(--lsys-dialog-focus-ring-offset-color)",
17
+ disabledStateClasses,
18
+ ].join(" "),
19
+ )
20
+ export const dialogBackdropVariants = cva(
21
+ [
22
+ "fixed inset-0 z-(--lsys-dialog-backdrop-z-index) bg-(--lsys-dialog-backdrop-background) opacity-(--lsys-dialog-backdrop-opacity)",
23
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
24
+ "transition-opacity duration-(--lsys-dialog-transition-duration) ease-(--lsys-dialog-transition-easing)",
25
+ ].join(" "),
26
+ )
27
+
28
+ export const dialogViewportVariants = cva(
29
+ "fixed inset-0 z-(--lsys-dialog-viewport-z-index) grid place-items-center overflow-y-auto p-(--lsys-dialog-viewport-padding)",
30
+ )
31
+
32
+ export const dialogPopupVariants = cva(
33
+ [
34
+ "grid w-[min(calc(100vw-(var(--lsys-dialog-viewport-inset)*2)),var(--lsys-dialog-popup-max-width))] gap-(--lsys-dialog-popup-gap) rounded-(--lsys-dialog-popup-radius) border",
35
+ "border-(--lsys-dialog-popup-border-color) bg-(--lsys-dialog-popup-background) p-(--lsys-dialog-popup-padding) text-(--lsys-dialog-popup-foreground) shadow-(--lsys-dialog-popup-shadow)",
36
+ "outline-none data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
37
+ "transition-[opacity,transform] duration-(--lsys-dialog-transition-duration) ease-(--lsys-dialog-transition-easing)",
38
+ ].join(" "),
39
+ )
40
+
41
+ export const dialogTitleVariants = cva(
42
+ "pr-(--lsys-dialog-title-padding-end) text-(length:--lsys-dialog-title-font-size) font-(--lsys-dialog-title-font-weight) leading-(--lsys-dialog-title-font-line-height) text-(--lsys-dialog-title-foreground)",
43
+ )
44
+
45
+ export const dialogDescriptionVariants = cva(
46
+ "text-(length:--lsys-dialog-description-font-size) font-(--lsys-dialog-description-font-weight) leading-(--lsys-dialog-description-font-line-height) text-(--lsys-dialog-description-foreground)",
47
+ )
48
+
49
+ export const dialogCloseVariants = cva(
50
+ [
51
+ "absolute right-(--lsys-dialog-close-inset) top-(--lsys-dialog-close-inset) inline-flex size-(--lsys-dialog-close-size) items-center justify-center rounded-(--lsys-dialog-close-radius)",
52
+ "text-(--lsys-dialog-close-foreground) outline-none transition-colors duration-(--lsys-dialog-transition-duration) ease-(--lsys-dialog-transition-easing)",
53
+ "hover:bg-(--lsys-dialog-close-hover-background) focus-visible:ring-(length:--lsys-dialog-focus-ring-width) focus-visible:ring-(--lsys-dialog-focus-ring-color) focus-visible:ring-offset-(length:--lsys-dialog-focus-ring-offset) focus-visible:ring-offset-(--lsys-dialog-focus-ring-offset-color)",
54
+ disabledStateClasses,
55
+ ].join(" "),
56
+ )
@@ -0,0 +1,266 @@
1
+ /**
2
+ * Drawer.tsx
3
+ *
4
+ * Reference Drawer component implementation.
5
+ */
6
+
7
+ import { X } from "lucide-react"
8
+ import { Drawer as BaseDrawer } from "@base-ui/react/drawer"
9
+ import type {
10
+ DrawerBackdropProps,
11
+ DrawerCloseProps,
12
+ DrawerContentProps,
13
+ DrawerDescriptionProps,
14
+ DrawerHandleIndicatorProps,
15
+ DrawerIndentBackgroundProps,
16
+ DrawerIndentProps,
17
+ DrawerPopupProps,
18
+ DrawerPortalProps,
19
+ DrawerProps,
20
+ DrawerProviderProps,
21
+ DrawerSwipeAreaProps,
22
+ DrawerTitleProps,
23
+ DrawerTriggerProps,
24
+ DrawerViewportProps,
25
+ } from "./Drawer.types"
26
+ import {
27
+ drawerBackdropVariants,
28
+ drawerCloseVariants,
29
+ drawerCloseInlineVariants,
30
+ drawerContentVariants,
31
+ drawerDescriptionVariants,
32
+ drawerHandleVariants,
33
+ drawerIndentBackgroundVariants,
34
+ drawerIndentVariants,
35
+ drawerPopupVariants,
36
+ drawerSwipeAreaVariants,
37
+ drawerTitleVariants,
38
+ drawerTriggerVariants,
39
+ drawerViewportVariants,
40
+ } from "./Drawer.variants"
41
+ import { cn } from "@/lib/utils"
42
+ import { mergeClassName } from "@/lib/utils"
43
+
44
+ const Drawer = <Payload = unknown,>(props: DrawerProps<Payload>) => {
45
+ return <BaseDrawer.Root {...props} />
46
+ }
47
+
48
+ Drawer.displayName = "Drawer"
49
+
50
+ const DrawerProvider = (props: DrawerProviderProps) => {
51
+ return <BaseDrawer.Provider {...props} />
52
+ }
53
+
54
+ DrawerProvider.displayName = "DrawerProvider"
55
+
56
+ const DrawerTrigger = ({ ref, className, ...props }: DrawerTriggerProps) => {
57
+ return (
58
+ <BaseDrawer.Trigger
59
+ ref={ref}
60
+ className={mergeClassName(drawerTriggerVariants(), className)}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ DrawerTrigger.displayName = "DrawerTrigger"
67
+
68
+ const DrawerPortal = (props: DrawerPortalProps) => {
69
+ return <BaseDrawer.Portal {...props} />
70
+ }
71
+
72
+ DrawerPortal.displayName = "DrawerPortal"
73
+
74
+ const DrawerIndentBackground = ({
75
+ ref,
76
+ className,
77
+ ...props
78
+ }: DrawerIndentBackgroundProps) => {
79
+ return (
80
+ <BaseDrawer.IndentBackground
81
+ ref={ref}
82
+ className={mergeClassName(drawerIndentBackgroundVariants(), className)}
83
+ {...props}
84
+ />
85
+ )
86
+ }
87
+
88
+ DrawerIndentBackground.displayName = "DrawerIndentBackground"
89
+
90
+ const DrawerIndent = ({ ref, className, ...props }: DrawerIndentProps) => {
91
+ return (
92
+ <BaseDrawer.Indent
93
+ ref={ref}
94
+ className={mergeClassName(drawerIndentVariants(), className)}
95
+ {...props}
96
+ />
97
+ )
98
+ }
99
+
100
+ DrawerIndent.displayName = "DrawerIndent"
101
+
102
+ const DrawerBackdrop = ({ ref, className, ...props }: DrawerBackdropProps) => {
103
+ return (
104
+ <BaseDrawer.Backdrop
105
+ ref={ref}
106
+ className={mergeClassName(drawerBackdropVariants(), className)}
107
+ {...props}
108
+ />
109
+ )
110
+ }
111
+
112
+ DrawerBackdrop.displayName = "DrawerBackdrop"
113
+
114
+ const DrawerViewport = ({
115
+ ref,
116
+ side,
117
+ className,
118
+ ...props
119
+ }: DrawerViewportProps) => {
120
+ return (
121
+ <BaseDrawer.Viewport
122
+ ref={ref}
123
+ className={mergeClassName(drawerViewportVariants({ side }), className)}
124
+ {...props}
125
+ />
126
+ )
127
+ }
128
+
129
+ DrawerViewport.displayName = "DrawerViewport"
130
+
131
+ const DrawerPopup = ({
132
+ ref,
133
+ side,
134
+ size,
135
+ className,
136
+ ...props
137
+ }: DrawerPopupProps) => {
138
+ return (
139
+ <BaseDrawer.Popup
140
+ ref={ref}
141
+ className={mergeClassName(drawerPopupVariants({ side, size }), className)}
142
+ {...props}
143
+ />
144
+ )
145
+ }
146
+
147
+ DrawerPopup.displayName = "DrawerPopup"
148
+
149
+ const DrawerContent = ({ ref, className, ...props }: DrawerContentProps) => {
150
+ return (
151
+ <BaseDrawer.Content
152
+ ref={ref}
153
+ className={mergeClassName(drawerContentVariants(), className)}
154
+ {...props}
155
+ />
156
+ )
157
+ }
158
+
159
+ DrawerContent.displayName = "DrawerContent"
160
+
161
+ const DrawerHandleIndicator = ({
162
+ className,
163
+ ...props
164
+ }: DrawerHandleIndicatorProps) => {
165
+ return (
166
+ <div
167
+ aria-hidden="true"
168
+ className={cn(drawerHandleVariants(), className)}
169
+ {...props}
170
+ />
171
+ )
172
+ }
173
+
174
+ DrawerHandleIndicator.displayName = "DrawerHandleIndicator"
175
+
176
+ const DrawerSwipeArea = ({
177
+ ref,
178
+ side,
179
+ className,
180
+ ...props
181
+ }: DrawerSwipeAreaProps) => {
182
+ return (
183
+ <BaseDrawer.SwipeArea
184
+ ref={ref}
185
+ className={mergeClassName(drawerSwipeAreaVariants({ side }), className)}
186
+ {...props}
187
+ />
188
+ )
189
+ }
190
+
191
+ DrawerSwipeArea.displayName = "DrawerSwipeArea"
192
+
193
+ const DrawerTitle = ({ ref, className, ...props }: DrawerTitleProps) => {
194
+ return (
195
+ <BaseDrawer.Title
196
+ ref={ref}
197
+ className={mergeClassName(drawerTitleVariants(), className)}
198
+ {...props}
199
+ />
200
+ )
201
+ }
202
+
203
+ DrawerTitle.displayName = "DrawerTitle"
204
+
205
+ const DrawerDescription = ({
206
+ ref,
207
+ className,
208
+ ...props
209
+ }: DrawerDescriptionProps) => {
210
+ return (
211
+ <BaseDrawer.Description
212
+ ref={ref}
213
+ className={mergeClassName(drawerDescriptionVariants(), className)}
214
+ {...props}
215
+ />
216
+ )
217
+ }
218
+
219
+ DrawerDescription.displayName = "DrawerDescription"
220
+
221
+ const DrawerClose = ({
222
+ ref,
223
+ appearance = "icon",
224
+ className,
225
+ children,
226
+ ...props
227
+ }: DrawerCloseProps) => {
228
+ return (
229
+ <BaseDrawer.Close
230
+ ref={ref}
231
+ className={mergeClassName(
232
+ appearance === "inline"
233
+ ? drawerCloseInlineVariants()
234
+ : drawerCloseVariants(),
235
+ className,
236
+ )}
237
+ {...props}
238
+ >
239
+ {children ??
240
+ (appearance === "icon" ? <X aria-hidden="true" size={16} /> : null)}
241
+ </BaseDrawer.Close>
242
+ )
243
+ }
244
+
245
+ DrawerClose.displayName = "DrawerClose"
246
+
247
+ const createDrawerHandle = BaseDrawer.createHandle
248
+
249
+ export {
250
+ Drawer,
251
+ DrawerProvider,
252
+ DrawerIndentBackground,
253
+ DrawerIndent,
254
+ DrawerTrigger,
255
+ DrawerPortal,
256
+ DrawerBackdrop,
257
+ DrawerViewport,
258
+ DrawerPopup,
259
+ DrawerContent,
260
+ DrawerHandleIndicator,
261
+ DrawerSwipeArea,
262
+ DrawerTitle,
263
+ DrawerDescription,
264
+ DrawerClose,
265
+ createDrawerHandle,
266
+ }
@@ -0,0 +1,77 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Drawer.types.ts
4
+ *
5
+ * Public and internal types for Drawer component.
6
+ */
7
+
8
+ import type { HTMLAttributes } from "react"
9
+ import type { Drawer as BaseDrawer } from "@base-ui/react/drawer"
10
+
11
+ export type DrawerSide = "bottom" | "top" | "right" | "left"
12
+ export type DrawerSize = "sm" | "md" | "lg" | "full"
13
+
14
+ export type DrawerProps<Payload = unknown> = BaseDrawer.Root.Props<Payload>
15
+ export type DrawerProviderProps = BaseDrawer.Provider.Props
16
+ export type DrawerPortalProps = BaseDrawer.Portal.Props
17
+ export type DrawerHandle<Payload = unknown> = BaseDrawer.Handle<Payload>
18
+
19
+ export type DrawerTriggerProps<Payload = unknown> =
20
+ BaseDrawer.Trigger.Props<Payload> & {
21
+ ref?: Ref<HTMLButtonElement>
22
+ }
23
+
24
+ export type DrawerIndentBackgroundProps = BaseDrawer.IndentBackground.Props
25
+
26
+ export type DrawerIndentProps = BaseDrawer.Indent.Props
27
+
28
+ export type DrawerBackdropProps = BaseDrawer.Backdrop.Props
29
+
30
+ export interface DrawerViewportProps extends Omit<
31
+ BaseDrawer.Viewport.Props,
32
+ "className"
33
+ > {
34
+ side?: DrawerSide
35
+ className?: BaseDrawer.Viewport.Props["className"]
36
+ }
37
+
38
+ export interface DrawerPopupProps extends Omit<
39
+ BaseDrawer.Popup.Props,
40
+ "className" | "size"
41
+ > {
42
+ side?: DrawerSide
43
+ size?: DrawerSize
44
+ className?: BaseDrawer.Popup.Props["className"]
45
+ }
46
+
47
+ export interface DrawerContentProps extends Omit<
48
+ BaseDrawer.Content.Props,
49
+ "className"
50
+ > {
51
+ className?: BaseDrawer.Content.Props["className"]
52
+ }
53
+
54
+ export type DrawerHandleIndicatorProps = HTMLAttributes<HTMLDivElement>
55
+
56
+ export interface DrawerSwipeAreaProps extends Omit<
57
+ BaseDrawer.SwipeArea.Props,
58
+ "className"
59
+ > {
60
+ side?: DrawerSide
61
+ className?: BaseDrawer.SwipeArea.Props["className"]
62
+ }
63
+
64
+ export interface DrawerTitleProps extends Omit<
65
+ BaseDrawer.Title.Props,
66
+ "className"
67
+ > {
68
+ className?: BaseDrawer.Title.Props["className"]
69
+ }
70
+
71
+ export type DrawerDescriptionProps = BaseDrawer.Description.Props
72
+
73
+ export type DrawerCloseAppearance = "icon" | "inline"
74
+
75
+ export interface DrawerCloseProps extends BaseDrawer.Close.Props {
76
+ appearance?: DrawerCloseAppearance
77
+ }