@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,99 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * Combobox.types.ts
4
+ *
5
+ * Public and internal types for Combobox component.
6
+ */
7
+
8
+ import type { Combobox as BaseCombobox } from "@base-ui/react/combobox"
9
+
10
+ export type ComboboxSize = "sm" | "md" | "lg"
11
+
12
+ export type ComboboxProps<
13
+ Value = string,
14
+ Multiple extends boolean | undefined = false,
15
+ > = BaseCombobox.Root.Props<Value, Multiple>
16
+
17
+ export type ComboboxLabelProps = BaseCombobox.Label.Props & {
18
+ ref?: Ref<HTMLDivElement>
19
+ }
20
+
21
+ export interface ComboboxTriggerProps extends Omit<
22
+ BaseCombobox.Trigger.Props,
23
+ "className" | "size"
24
+ > {
25
+ ref?: Ref<HTMLButtonElement>
26
+ size?: ComboboxSize
27
+ className?: BaseCombobox.Trigger.Props["className"]
28
+ }
29
+
30
+ export interface ComboboxInputGroupProps extends Omit<
31
+ BaseCombobox.InputGroup.Props,
32
+ "className" | "size"
33
+ > {
34
+ ref?: Ref<HTMLDivElement>
35
+ size?: ComboboxSize
36
+ className?: BaseCombobox.InputGroup.Props["className"]
37
+ }
38
+
39
+ export interface ComboboxInputProps extends Omit<
40
+ BaseCombobox.Input.Props,
41
+ "className" | "size"
42
+ > {
43
+ ref?: Ref<HTMLInputElement>
44
+ size?: ComboboxSize
45
+ className?: BaseCombobox.Input.Props["className"]
46
+ }
47
+
48
+ export type ComboboxValueProps = BaseCombobox.Value.Props
49
+
50
+ export type ComboboxIconProps = BaseCombobox.Icon.Props
51
+
52
+ export type ComboboxPortalProps = BaseCombobox.Portal.Props
53
+
54
+ export type ComboboxBackdropProps = BaseCombobox.Backdrop.Props
55
+
56
+ export type ComboboxPositionerProps = BaseCombobox.Positioner.Props
57
+
58
+ export type ComboboxPopupProps = BaseCombobox.Popup.Props
59
+
60
+ export type ComboboxListProps = BaseCombobox.List.Props
61
+
62
+ export interface ComboboxItemProps extends Omit<
63
+ BaseCombobox.Item.Props,
64
+ "className" | "ref"
65
+ > {
66
+ ref?: Ref<HTMLDivElement>
67
+ className?: BaseCombobox.Item.Props["className"]
68
+ }
69
+
70
+ export interface ComboboxItemIndicatorProps extends Omit<
71
+ BaseCombobox.ItemIndicator.Props,
72
+ "className"
73
+ > {
74
+ className?: BaseCombobox.ItemIndicator.Props["className"]
75
+ }
76
+
77
+ export type ComboboxArrowProps = BaseCombobox.Arrow.Props
78
+
79
+ export type ComboboxGroupProps = BaseCombobox.Group.Props
80
+
81
+ export type ComboboxGroupLabelProps = BaseCombobox.GroupLabel.Props
82
+
83
+ export type ComboboxEmptyProps = BaseCombobox.Empty.Props
84
+
85
+ export type ComboboxClearProps = BaseCombobox.Clear.Props
86
+
87
+ export type ComboboxStatusProps = BaseCombobox.Status.Props
88
+
89
+ export type ComboboxChipsProps = BaseCombobox.Chips.Props
90
+
91
+ export type ComboboxChipProps = BaseCombobox.Chip.Props
92
+
93
+ export type ComboboxChipRemoveProps = BaseCombobox.ChipRemove.Props
94
+
95
+ export type ComboboxRowProps = BaseCombobox.Row.Props
96
+
97
+ export type ComboboxCollectionProps = BaseCombobox.Collection.Props
98
+
99
+ export type ComboboxSeparatorProps = BaseCombobox.Separator.Props
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Combobox.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 comboboxLabelVariants = cva(
11
+ "text-(length:--lsys-select-label-font-size) font-(--lsys-select-label-font-weight) leading-(--lsys-select-label-font-line-height) text-(--lsys-select-label-foreground)",
12
+ )
13
+
14
+ export const comboboxTriggerVariants = cva(
15
+ [
16
+ "inline-flex w-full min-w-0 items-center justify-between gap-(--lsys-select-trigger-gap) rounded-(--lsys-select-radius) border",
17
+ "border-(--lsys-select-border-color) bg-(--lsys-select-background) text-(--lsys-select-foreground)",
18
+ "font-(family-name:--lsys-select-font-family) font-(--lsys-select-font-weight) leading-(--lsys-select-font-line-height) tracking-(--lsys-select-font-letter-spacing)",
19
+ "transition-colors duration-(--lsys-select-transition-duration) ease-(--lsys-select-transition-easing)",
20
+ "outline-none data-[focused]:border-(--lsys-select-focus-border-color) data-[focused]:ring-(length:--lsys-select-focus-ring-width) data-[focused]:ring-(--lsys-select-focus-ring-color) data-[focused]:ring-offset-(length:--lsys-select-focus-ring-offset) data-[focused]:ring-offset-(--lsys-select-focus-ring-offset-color)",
21
+ "data-[invalid]:border-(--lsys-select-invalid-border-color) data-[invalid]:ring-(length:--lsys-select-invalid-ring-width) data-[invalid]:ring-(--lsys-select-invalid-ring-color)",
22
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--lsys-opacity-disabled)",
23
+ ].join(" "),
24
+ {
25
+ variants: {
26
+ size: {
27
+ sm: "h-(--lsys-select-height-sm) px-(--lsys-select-padding-x-sm) text-(length:--lsys-select-font-size-sm)",
28
+ md: "h-(--lsys-select-height-md) px-(--lsys-select-padding-x-md) text-(length:--lsys-select-font-size-md)",
29
+ lg: "h-(--lsys-select-height-lg) px-(--lsys-select-padding-x-lg) text-(length:--lsys-select-font-size-lg)",
30
+ },
31
+ },
32
+ defaultVariants: {
33
+ size: "md",
34
+ },
35
+ },
36
+ )
37
+
38
+ export const comboboxInputGroupVariants = cva(
39
+ [
40
+ "inline-flex w-full min-w-0 flex-wrap items-center gap-(--lsys-select-trigger-gap) rounded-(--lsys-select-radius) border",
41
+ "border-(--lsys-select-border-color) bg-(--lsys-select-background) text-(--lsys-select-foreground)",
42
+ "font-(family-name:--lsys-select-font-family) font-(--lsys-select-font-weight) leading-(--lsys-select-font-line-height) tracking-(--lsys-select-font-letter-spacing)",
43
+ "transition-colors duration-(--lsys-select-transition-duration) ease-(--lsys-select-transition-easing)",
44
+ "outline-none data-[focused]:border-(--lsys-select-focus-border-color) data-[focused]:ring-(length:--lsys-select-focus-ring-width) data-[focused]:ring-(--lsys-select-focus-ring-color) data-[focused]:ring-offset-(length:--lsys-select-focus-ring-offset) data-[focused]:ring-offset-(--lsys-select-focus-ring-offset-color)",
45
+ "data-[invalid]:border-(--lsys-select-invalid-border-color) data-[invalid]:ring-(length:--lsys-select-invalid-ring-width) data-[invalid]:ring-(--lsys-select-invalid-ring-color)",
46
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--lsys-opacity-disabled)",
47
+ ].join(" "),
48
+ {
49
+ variants: {
50
+ size: {
51
+ sm: "min-h-(--lsys-select-height-sm) px-(--lsys-select-padding-x-sm) text-(length:--lsys-select-font-size-sm)",
52
+ md: "min-h-(--lsys-select-height-md) px-(--lsys-select-padding-x-md) text-(length:--lsys-select-font-size-md)",
53
+ lg: "min-h-(--lsys-select-height-lg) px-(--lsys-select-padding-x-lg) text-(length:--lsys-select-font-size-lg)",
54
+ },
55
+ },
56
+ defaultVariants: {
57
+ size: "md",
58
+ },
59
+ },
60
+ )
61
+
62
+ export const comboboxInputVariants = cva(
63
+ [
64
+ "min-w-[4rem] flex-1 border-0 bg-transparent text-(--lsys-select-foreground) outline-none",
65
+ "font-(family-name:--lsys-select-font-family) font-(--lsys-select-font-weight) leading-(--lsys-select-font-line-height) tracking-(--lsys-select-font-letter-spacing)",
66
+ "placeholder:text-(--lsys-select-placeholder-color)",
67
+ "disabled:cursor-not-allowed",
68
+ disabledStateClasses,
69
+ ].join(" "),
70
+ {
71
+ variants: {
72
+ size: {
73
+ sm: "py-(--lsys-select-padding-x-sm) text-(length:--lsys-select-font-size-sm)",
74
+ md: "py-(--lsys-select-padding-x-md) text-(length:--lsys-select-font-size-md)",
75
+ lg: "py-(--lsys-select-padding-x-lg) text-(length:--lsys-select-font-size-lg)",
76
+ },
77
+ },
78
+ defaultVariants: {
79
+ size: "md",
80
+ },
81
+ },
82
+ )
83
+
84
+ export const comboboxValueVariants = cva(
85
+ "min-w-0 flex-1 truncate text-left data-[placeholder]:text-(--lsys-select-placeholder-color)",
86
+ )
87
+
88
+ export const comboboxIconVariants = cva(
89
+ "inline-flex size-(--lsys-select-icon-size) shrink-0 items-center justify-center text-(--lsys-select-icon-foreground) transition-transform duration-(--lsys-select-transition-duration) ease-(--lsys-select-transition-easing) data-[open]:rotate-180",
90
+ )
91
+
92
+ export const comboboxClearVariants = cva(
93
+ [
94
+ "inline-flex size-(--lsys-select-icon-size) shrink-0 items-center justify-center rounded-(--lsys-select-item-radius) text-(--lsys-select-icon-foreground)",
95
+ "transition-colors duration-(--lsys-select-transition-duration) ease-(--lsys-select-transition-easing)",
96
+ "hover:bg-(--lsys-select-item-highlight-background) hover:text-(--lsys-select-item-highlight-foreground)",
97
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-(--lsys-opacity-disabled)",
98
+ ].join(" "),
99
+ )
100
+
101
+ export const comboboxBackdropVariants = cva(
102
+ "fixed inset-0 z-(--lsys-select-backdrop-z-index) bg-(--lsys-select-backdrop-background) opacity-(--lsys-select-backdrop-opacity) data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
103
+ )
104
+
105
+ export const comboboxPositionerVariants = cva(
106
+ "z-(--lsys-select-positioner-z-index)",
107
+ )
108
+
109
+ export const comboboxPopupVariants = cva(
110
+ [
111
+ "min-w-[var(--anchor-width)] overflow-hidden rounded-(--lsys-select-radius) border",
112
+ "border-(--lsys-select-popup-border-color) bg-(--lsys-select-popup-background) text-(--lsys-select-popup-foreground) shadow-(--lsys-select-popup-shadow)",
113
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
114
+ "origin-[var(--transform-origin)] transition-[opacity,transform] duration-(--lsys-select-transition-duration) ease-(--lsys-select-transition-easing)",
115
+ ].join(" "),
116
+ )
117
+
118
+ export const comboboxListVariants = cva(
119
+ "grid max-h-(--lsys-select-popup-max-height) gap-(--lsys-select-list-gap) overflow-y-auto p-(--lsys-select-list-padding)",
120
+ )
121
+
122
+ export const comboboxItemVariants = cva(
123
+ [
124
+ "relative flex min-w-0 cursor-default select-none items-center gap-(--lsys-select-item-gap) rounded-(--lsys-select-item-radius) px-(--lsys-select-item-padding-x) py-(--lsys-select-item-padding-y)",
125
+ "text-(length:--lsys-select-item-font-size) font-(--lsys-select-item-font-weight) leading-(--lsys-select-item-font-line-height) text-(--lsys-select-item-foreground) outline-none",
126
+ "data-[highlighted]:bg-(--lsys-select-item-highlight-background) data-[highlighted]:text-(--lsys-select-item-highlight-foreground)",
127
+ "data-[selected]:bg-(--lsys-select-item-selected-background) data-[selected]:text-(--lsys-select-item-selected-foreground)",
128
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-(--lsys-opacity-disabled)",
129
+ ].join(" "),
130
+ )
131
+
132
+ export const comboboxItemIndicatorVariants = cva(
133
+ "inline-flex size-(--lsys-select-item-indicator-size) shrink-0 items-center justify-center text-current",
134
+ )
135
+
136
+ export const comboboxArrowVariants = cva(
137
+ "size-(--lsys-select-arrow-size) rotate-45 border border-(--lsys-select-popup-border-color) bg-(--lsys-select-popup-background)",
138
+ )
139
+
140
+ export const comboboxGroupVariants = cva("grid gap-(--lsys-select-group-gap)")
141
+
142
+ export const comboboxGroupLabelVariants = cva(
143
+ "px-(--lsys-select-item-padding-x) py-(--lsys-select-group-label-padding-y) text-(length:--lsys-select-group-label-font-size) font-(--lsys-select-group-label-font-weight) leading-(--lsys-select-group-label-font-line-height) text-(--lsys-select-group-label-foreground)",
144
+ )
145
+
146
+ export const comboboxEmptyVariants = cva(
147
+ "px-(--lsys-select-item-padding-x) py-(--lsys-select-item-padding-y) text-(length:--lsys-select-item-font-size) text-(--lsys-select-placeholder-color)",
148
+ )
149
+
150
+ export const comboboxStatusVariants = cva(
151
+ "px-(--lsys-select-item-padding-x) py-(--lsys-select-item-padding-y) text-(length:--lsys-select-item-font-size) text-(--lsys-select-placeholder-color)",
152
+ )
153
+
154
+ export const comboboxChipsVariants = cva(
155
+ "flex min-w-0 flex-1 flex-wrap items-center gap-(--lsys-select-item-gap)",
156
+ )
157
+
158
+ export const comboboxChipVariants = cva(
159
+ [
160
+ "inline-flex max-w-full items-center gap-(--lsys-select-item-gap) rounded-(--lsys-select-item-radius) border border-(--lsys-select-border-color)",
161
+ "bg-(--lsys-select-item-selected-background) px-(--lsys-select-item-padding-x) py-(--lsys-select-item-padding-y)",
162
+ "text-(length:--lsys-select-item-font-size) font-(--lsys-select-item-font-weight) text-(--lsys-select-item-selected-foreground)",
163
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-(--lsys-opacity-disabled)",
164
+ ].join(" "),
165
+ )
166
+
167
+ export const comboboxChipRemoveVariants = cva(
168
+ [
169
+ "inline-flex size-(--lsys-select-item-indicator-size) shrink-0 items-center justify-center rounded-(--lsys-select-item-radius) text-current",
170
+ "hover:bg-(--lsys-select-item-highlight-background) hover:text-(--lsys-select-item-highlight-foreground)",
171
+ ].join(" "),
172
+ )
173
+
174
+ export const comboboxRowVariants = cva("flex min-w-0 items-center")
175
+
176
+ export const comboboxCollectionVariants = cva("contents")
177
+
178
+ export const comboboxSeparatorVariants = cva(
179
+ "mx-(--lsys-select-item-padding-x) my-(--lsys-select-group-label-padding-y) h-(--lsys-separator-thickness) bg-(--lsys-separator-color)",
180
+ )
@@ -0,0 +1,375 @@
1
+ /**
2
+ * ContextMenu.tsx
3
+ *
4
+ * Reference ContextMenu component implementation.
5
+ */
6
+
7
+ import { Check, ChevronRight } from "lucide-react"
8
+ import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu"
9
+ import type {
10
+ ContextMenuArrowProps,
11
+ ContextMenuBackdropProps,
12
+ ContextMenuCheckboxItemIndicatorProps,
13
+ ContextMenuCheckboxItemProps,
14
+ ContextMenuGroupLabelProps,
15
+ ContextMenuGroupProps,
16
+ ContextMenuItemProps,
17
+ ContextMenuLinkItemProps,
18
+ ContextMenuPopupProps,
19
+ ContextMenuPortalProps,
20
+ ContextMenuPositionerProps,
21
+ ContextMenuProps,
22
+ ContextMenuRadioGroupProps,
23
+ ContextMenuRadioItemIndicatorProps,
24
+ ContextMenuRadioItemProps,
25
+ ContextMenuSeparatorProps,
26
+ ContextMenuSubmenuRootProps,
27
+ ContextMenuSubmenuTriggerProps,
28
+ ContextMenuTriggerProps,
29
+ } from "./ContextMenu.types"
30
+ import {
31
+ contextMenuArrowVariants,
32
+ contextMenuBackdropVariants,
33
+ contextMenuGroupLabelVariants,
34
+ contextMenuGroupVariants,
35
+ contextMenuItemIndicatorVariants,
36
+ contextMenuItemTextVariants,
37
+ contextMenuItemVariants,
38
+ contextMenuPopupVariants,
39
+ contextMenuPositionerVariants,
40
+ contextMenuSeparatorVariants,
41
+ contextMenuSubmenuTriggerIconVariants,
42
+ contextMenuSubmenuTriggerVariants,
43
+ contextMenuTriggerVariants,
44
+ } from "./ContextMenu.variants"
45
+ import { mergeClassName } from "@/lib/utils"
46
+ import { overlayPositionerSideOffset } from "@/lib/utils"
47
+
48
+ const horizontalContextMenuSides = new Set<
49
+ NonNullable<ContextMenuPositionerProps["side"]>
50
+ >(["left", "right", "inline-start", "inline-end"])
51
+
52
+ const popupCollisionAvoidance = {
53
+ fallbackAxisSide: "end",
54
+ } as const
55
+
56
+ const ContextMenu = (props: ContextMenuProps) => {
57
+ return <BaseContextMenu.Root {...props} />
58
+ }
59
+
60
+ ContextMenu.displayName = "ContextMenu"
61
+
62
+ const ContextMenuTrigger = ({
63
+ ref,
64
+ className,
65
+ ...props
66
+ }: ContextMenuTriggerProps) => {
67
+ return (
68
+ <BaseContextMenu.Trigger
69
+ ref={ref}
70
+ className={mergeClassName(contextMenuTriggerVariants(), className)}
71
+ {...props}
72
+ />
73
+ )
74
+ }
75
+
76
+ ContextMenuTrigger.displayName = "ContextMenuTrigger"
77
+
78
+ const ContextMenuPortal = (props: ContextMenuPortalProps) => {
79
+ return <BaseContextMenu.Portal {...props} />
80
+ }
81
+
82
+ ContextMenuPortal.displayName = "ContextMenuPortal"
83
+
84
+ const ContextMenuBackdrop = ({
85
+ ref,
86
+ className,
87
+ ...props
88
+ }: ContextMenuBackdropProps) => {
89
+ return (
90
+ <BaseContextMenu.Backdrop
91
+ ref={ref}
92
+ className={mergeClassName(contextMenuBackdropVariants(), className)}
93
+ {...props}
94
+ />
95
+ )
96
+ }
97
+
98
+ ContextMenuBackdrop.displayName = "ContextMenuBackdrop"
99
+
100
+ const ContextMenuPositioner = ({
101
+ ref,
102
+ className,
103
+ sideOffset = overlayPositionerSideOffset,
104
+ side,
105
+ collisionAvoidance,
106
+ ...props
107
+ }: ContextMenuPositionerProps) => {
108
+ const resolvedCollisionAvoidance =
109
+ collisionAvoidance ??
110
+ (side && horizontalContextMenuSides.has(side)
111
+ ? popupCollisionAvoidance
112
+ : undefined)
113
+
114
+ return (
115
+ <BaseContextMenu.Positioner
116
+ ref={ref}
117
+ sideOffset={sideOffset}
118
+ side={side}
119
+ collisionAvoidance={resolvedCollisionAvoidance}
120
+ className={mergeClassName(contextMenuPositionerVariants(), className)}
121
+ {...props}
122
+ />
123
+ )
124
+ }
125
+
126
+ ContextMenuPositioner.displayName = "ContextMenuPositioner"
127
+
128
+ const ContextMenuPopup = ({
129
+ ref,
130
+ className,
131
+ ...props
132
+ }: ContextMenuPopupProps) => {
133
+ return (
134
+ <BaseContextMenu.Popup
135
+ ref={ref}
136
+ className={mergeClassName(contextMenuPopupVariants(), className)}
137
+ {...props}
138
+ />
139
+ )
140
+ }
141
+
142
+ ContextMenuPopup.displayName = "ContextMenuPopup"
143
+
144
+ const ContextMenuArrow = ({
145
+ ref,
146
+ className,
147
+ ...props
148
+ }: ContextMenuArrowProps) => {
149
+ return (
150
+ <BaseContextMenu.Arrow
151
+ ref={ref}
152
+ className={mergeClassName(contextMenuArrowVariants(), className)}
153
+ {...props}
154
+ />
155
+ )
156
+ }
157
+
158
+ ContextMenuArrow.displayName = "ContextMenuArrow"
159
+
160
+ const ContextMenuItem = ({
161
+ ref,
162
+ className,
163
+ ...props
164
+ }: ContextMenuItemProps) => {
165
+ return (
166
+ <BaseContextMenu.Item
167
+ ref={ref}
168
+ className={mergeClassName(contextMenuItemVariants(), className)}
169
+ {...props}
170
+ />
171
+ )
172
+ }
173
+
174
+ ContextMenuItem.displayName = "ContextMenuItem"
175
+
176
+ const ContextMenuLinkItem = ({
177
+ ref,
178
+ className,
179
+ ...props
180
+ }: ContextMenuLinkItemProps) => {
181
+ return (
182
+ <BaseContextMenu.LinkItem
183
+ ref={ref}
184
+ className={mergeClassName(contextMenuItemVariants(), className)}
185
+ {...props}
186
+ />
187
+ )
188
+ }
189
+
190
+ ContextMenuLinkItem.displayName = "ContextMenuLinkItem"
191
+
192
+ const ContextMenuCheckboxItem = ({
193
+ ref,
194
+ className,
195
+ ...props
196
+ }: ContextMenuCheckboxItemProps) => {
197
+ return (
198
+ <BaseContextMenu.CheckboxItem
199
+ ref={ref}
200
+ className={mergeClassName(contextMenuItemVariants(), className)}
201
+ {...props}
202
+ />
203
+ )
204
+ }
205
+
206
+ ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem"
207
+
208
+ const ContextMenuCheckboxItemIndicator = ({
209
+ ref,
210
+ className,
211
+ children,
212
+ ...props
213
+ }: ContextMenuCheckboxItemIndicatorProps) => {
214
+ return (
215
+ <BaseContextMenu.CheckboxItemIndicator
216
+ ref={ref}
217
+ className={mergeClassName(contextMenuItemIndicatorVariants(), className)}
218
+ {...props}
219
+ >
220
+ {children ?? <Check aria-hidden="true" size={14} />}
221
+ </BaseContextMenu.CheckboxItemIndicator>
222
+ )
223
+ }
224
+
225
+ ContextMenuCheckboxItemIndicator.displayName =
226
+ "ContextMenuCheckboxItemIndicator"
227
+
228
+ const ContextMenuRadioGroup = ({
229
+ ref,
230
+ className,
231
+ ...props
232
+ }: ContextMenuRadioGroupProps) => {
233
+ return (
234
+ <BaseContextMenu.RadioGroup
235
+ ref={ref}
236
+ className={mergeClassName(contextMenuGroupVariants(), className)}
237
+ {...props}
238
+ />
239
+ )
240
+ }
241
+
242
+ ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup"
243
+
244
+ const ContextMenuRadioItem = ({
245
+ ref,
246
+ className,
247
+ ...props
248
+ }: ContextMenuRadioItemProps) => {
249
+ return (
250
+ <BaseContextMenu.RadioItem
251
+ ref={ref}
252
+ className={mergeClassName(contextMenuItemVariants(), className)}
253
+ {...props}
254
+ />
255
+ )
256
+ }
257
+
258
+ ContextMenuRadioItem.displayName = "ContextMenuRadioItem"
259
+
260
+ const ContextMenuRadioItemIndicator = ({
261
+ ref,
262
+ className,
263
+ children,
264
+ ...props
265
+ }: ContextMenuRadioItemIndicatorProps) => {
266
+ return (
267
+ <BaseContextMenu.RadioItemIndicator
268
+ ref={ref}
269
+ className={mergeClassName(contextMenuItemIndicatorVariants(), className)}
270
+ {...props}
271
+ >
272
+ {children ?? <Check aria-hidden="true" size={14} />}
273
+ </BaseContextMenu.RadioItemIndicator>
274
+ )
275
+ }
276
+
277
+ ContextMenuRadioItemIndicator.displayName = "ContextMenuRadioItemIndicator"
278
+
279
+ const ContextMenuGroup = ({
280
+ ref,
281
+ className,
282
+ ...props
283
+ }: ContextMenuGroupProps) => {
284
+ return (
285
+ <BaseContextMenu.Group
286
+ ref={ref}
287
+ className={mergeClassName(contextMenuGroupVariants(), className)}
288
+ {...props}
289
+ />
290
+ )
291
+ }
292
+
293
+ ContextMenuGroup.displayName = "ContextMenuGroup"
294
+
295
+ const ContextMenuGroupLabel = ({
296
+ ref,
297
+ className,
298
+ ...props
299
+ }: ContextMenuGroupLabelProps) => {
300
+ return (
301
+ <BaseContextMenu.GroupLabel
302
+ ref={ref}
303
+ className={mergeClassName(contextMenuGroupLabelVariants(), className)}
304
+ {...props}
305
+ />
306
+ )
307
+ }
308
+
309
+ ContextMenuGroupLabel.displayName = "ContextMenuGroupLabel"
310
+
311
+ const ContextMenuSeparator = ({
312
+ ref,
313
+ className,
314
+ ...props
315
+ }: ContextMenuSeparatorProps) => {
316
+ return (
317
+ <BaseContextMenu.Separator
318
+ ref={ref}
319
+ className={mergeClassName(contextMenuSeparatorVariants(), className)}
320
+ {...props}
321
+ />
322
+ )
323
+ }
324
+
325
+ ContextMenuSeparator.displayName = "ContextMenuSeparator"
326
+
327
+ const ContextMenuSubmenuRoot = (props: ContextMenuSubmenuRootProps) => {
328
+ return <BaseContextMenu.SubmenuRoot {...props} />
329
+ }
330
+
331
+ ContextMenuSubmenuRoot.displayName = "ContextMenuSubmenuRoot"
332
+
333
+ const ContextMenuSubmenuTrigger = ({
334
+ ref,
335
+ className,
336
+ children,
337
+ ...props
338
+ }: ContextMenuSubmenuTriggerProps) => {
339
+ return (
340
+ <BaseContextMenu.SubmenuTrigger
341
+ ref={ref}
342
+ className={mergeClassName(contextMenuSubmenuTriggerVariants(), className)}
343
+ {...props}
344
+ >
345
+ <span className={contextMenuItemTextVariants()}>{children}</span>
346
+ <span className={contextMenuSubmenuTriggerIconVariants()}>
347
+ <ChevronRight aria-hidden="true" size={14} />
348
+ </span>
349
+ </BaseContextMenu.SubmenuTrigger>
350
+ )
351
+ }
352
+
353
+ ContextMenuSubmenuTrigger.displayName = "ContextMenuSubmenuTrigger"
354
+
355
+ export {
356
+ ContextMenu,
357
+ ContextMenuTrigger,
358
+ ContextMenuPortal,
359
+ ContextMenuBackdrop,
360
+ ContextMenuPositioner,
361
+ ContextMenuPopup,
362
+ ContextMenuArrow,
363
+ ContextMenuGroup,
364
+ ContextMenuGroupLabel,
365
+ ContextMenuItem,
366
+ ContextMenuLinkItem,
367
+ ContextMenuCheckboxItem,
368
+ ContextMenuCheckboxItemIndicator,
369
+ ContextMenuRadioGroup,
370
+ ContextMenuRadioItem,
371
+ ContextMenuRadioItemIndicator,
372
+ ContextMenuSeparator,
373
+ ContextMenuSubmenuRoot,
374
+ ContextMenuSubmenuTrigger,
375
+ }
@@ -0,0 +1,57 @@
1
+ import type { Ref } from "react"
2
+ /**
3
+ * ContextMenu.types.ts
4
+ *
5
+ * Public and internal types for ContextMenu component.
6
+ */
7
+
8
+ import type { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu"
9
+ import type { Menu as BaseMenu } from "@base-ui/react/menu"
10
+
11
+ export type ContextMenuProps = BaseContextMenu.Root.Props
12
+
13
+ export type ContextMenuTriggerProps = BaseContextMenu.Trigger.Props & {
14
+ ref?: Ref<HTMLDivElement>
15
+ }
16
+
17
+ export type ContextMenuPortalProps = BaseContextMenu.Portal.Props
18
+
19
+ export type ContextMenuBackdropProps = BaseContextMenu.Backdrop.Props
20
+
21
+ export type ContextMenuPositionerProps = BaseContextMenu.Positioner.Props
22
+
23
+ export type ContextMenuPopupProps = BaseContextMenu.Popup.Props
24
+
25
+ export type ContextMenuArrowProps = BaseContextMenu.Arrow.Props
26
+
27
+ export type ContextMenuGroupProps = BaseContextMenu.Group.Props
28
+
29
+ export type ContextMenuGroupLabelProps = BaseContextMenu.GroupLabel.Props
30
+
31
+ export interface ContextMenuItemProps extends Omit<
32
+ BaseContextMenu.Item.Props,
33
+ "className"
34
+ > {
35
+ className?: BaseContextMenu.Item.Props["className"]
36
+ }
37
+
38
+ export type ContextMenuLinkItemProps = BaseContextMenu.LinkItem.Props
39
+
40
+ export type ContextMenuCheckboxItemProps = BaseContextMenu.CheckboxItem.Props
41
+
42
+ export type ContextMenuCheckboxItemIndicatorProps =
43
+ BaseContextMenu.CheckboxItemIndicator.Props
44
+
45
+ export type ContextMenuRadioGroupProps = BaseContextMenu.RadioGroup.Props
46
+
47
+ export type ContextMenuRadioItemProps = BaseContextMenu.RadioItem.Props
48
+
49
+ export type ContextMenuRadioItemIndicatorProps =
50
+ BaseContextMenu.RadioItemIndicator.Props
51
+
52
+ export type ContextMenuSubmenuRootProps = BaseContextMenu.SubmenuRoot.Props
53
+
54
+ export type ContextMenuSubmenuTriggerProps =
55
+ BaseContextMenu.SubmenuTrigger.Props
56
+
57
+ export type ContextMenuSeparatorProps = BaseMenu.Separator.Props