@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.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +2164 -0
- package/dist/install-layer.d.ts +4 -0
- package/dist/items/accordion.d.ts +7 -0
- package/dist/items/alert-dialog.d.ts +7 -0
- package/dist/items/alert.d.ts +7 -0
- package/dist/items/auth-form.d.ts +7 -0
- package/dist/items/autocomplete.d.ts +7 -0
- package/dist/items/avatar.d.ts +7 -0
- package/dist/items/badge.d.ts +7 -0
- package/dist/items/button.d.ts +7 -0
- package/dist/items/card.d.ts +7 -0
- package/dist/items/checkbox-group.d.ts +7 -0
- package/dist/items/checkbox.d.ts +7 -0
- package/dist/items/collapsible.d.ts +7 -0
- package/dist/items/combobox.d.ts +7 -0
- package/dist/items/command-palette.d.ts +7 -0
- package/dist/items/context-menu.d.ts +7 -0
- package/dist/items/dashboard-shell.d.ts +7 -0
- package/dist/items/dialog.d.ts +7 -0
- package/dist/items/drawer.d.ts +7 -0
- package/dist/items/field.d.ts +7 -0
- package/dist/items/fieldset.d.ts +7 -0
- package/dist/items/form-field.d.ts +7 -0
- package/dist/items/form.d.ts +7 -0
- package/dist/items/index.d.ts +49 -0
- package/dist/items/input.d.ts +7 -0
- package/dist/items/menu.d.ts +7 -0
- package/dist/items/menubar.d.ts +7 -0
- package/dist/items/meter.d.ts +7 -0
- package/dist/items/navigation-menu.d.ts +7 -0
- package/dist/items/number-field.d.ts +7 -0
- package/dist/items/otp-field.d.ts +7 -0
- package/dist/items/popover.d.ts +7 -0
- package/dist/items/preview-card.d.ts +7 -0
- package/dist/items/progress.d.ts +7 -0
- package/dist/items/radio-group.d.ts +7 -0
- package/dist/items/scroll-area.d.ts +7 -0
- package/dist/items/select.d.ts +7 -0
- package/dist/items/separator.d.ts +7 -0
- package/dist/items/settings-panel.d.ts +7 -0
- package/dist/items/sidebar.d.ts +7 -0
- package/dist/items/slider.d.ts +7 -0
- package/dist/items/switch.d.ts +7 -0
- package/dist/items/tabs.d.ts +7 -0
- package/dist/items/textarea.d.ts +7 -0
- package/dist/items/toast.d.ts +7 -0
- package/dist/items/toggle-group.d.ts +7 -0
- package/dist/items/toggle.d.ts +7 -0
- package/dist/items/toolbar.d.ts +7 -0
- package/dist/items/tooltip.d.ts +7 -0
- package/dist/registry.types.d.ts +40 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/utilities/cn.d.ts +2 -0
- package/dist/validate-registry-composition.d.ts +2 -0
- package/dist/validate-registry-item.d.ts +2 -0
- package/dist/validate-registry-template-imports.d.ts +4 -0
- package/dist/validate-registry.d.ts +9 -0
- package/package.json +52 -0
- package/templates/blocks/AuthForm/AuthForm.tsx +109 -0
- package/templates/blocks/AuthForm/AuthForm.types.ts +34 -0
- package/templates/blocks/AuthForm/AuthForm.variants.ts +11 -0
- package/templates/blocks/CommandPalette/CommandPalette.tsx +245 -0
- package/templates/blocks/CommandPalette/CommandPalette.types.ts +73 -0
- package/templates/blocks/CommandPalette/CommandPalette.variants.ts +26 -0
- package/templates/blocks/FormField/FormField.tsx +83 -0
- package/templates/blocks/FormField/FormField.types.ts +26 -0
- package/templates/blocks/FormField/FormField.variants.ts +9 -0
- package/templates/blocks/SettingsPanel/SettingsPanel.tsx +104 -0
- package/templates/blocks/SettingsPanel/SettingsPanel.types.ts +31 -0
- package/templates/blocks/SettingsPanel/SettingsPanel.variants.ts +9 -0
- package/templates/blocks/Sidebar/Sidebar.tsx +414 -0
- package/templates/blocks/Sidebar/Sidebar.types.ts +99 -0
- package/templates/blocks/Sidebar/Sidebar.variants.ts +84 -0
- package/templates/primitives/Accordion/Accordion.tsx +102 -0
- package/templates/primitives/Accordion/Accordion.types.ts +20 -0
- package/templates/primitives/Accordion/Accordion.variants.ts +32 -0
- package/templates/primitives/Alert/Alert.tsx +62 -0
- package/templates/primitives/Alert/Alert.types.ts +35 -0
- package/templates/primitives/Alert/Alert.variants.ts +41 -0
- package/templates/primitives/AlertDialog/AlertDialog.tsx +168 -0
- package/templates/primitives/AlertDialog/AlertDialog.types.ts +30 -0
- package/templates/primitives/AlertDialog/AlertDialog.variants.ts +57 -0
- package/templates/primitives/Autocomplete/Autocomplete.tsx +394 -0
- package/templates/primitives/Autocomplete/Autocomplete.types.ts +82 -0
- package/templates/primitives/Autocomplete/Autocomplete.variants.ts +154 -0
- package/templates/primitives/Avatar/Avatar.tsx +56 -0
- package/templates/primitives/Avatar/Avatar.types.ts +31 -0
- package/templates/primitives/Avatar/Avatar.variants.ts +40 -0
- package/templates/primitives/Badge/Badge.tsx +30 -0
- package/templates/primitives/Badge/Badge.types.ts +30 -0
- package/templates/primitives/Badge/Badge.variants.ts +81 -0
- package/templates/primitives/Button/Button.tsx +53 -0
- package/templates/primitives/Button/Button.types.ts +25 -0
- package/templates/primitives/Button/Button.variants.ts +69 -0
- package/templates/primitives/Card/Card.tsx +85 -0
- package/templates/primitives/Card/Card.types.ts +54 -0
- package/templates/primitives/Card/Card.variants.ts +46 -0
- package/templates/primitives/Checkbox/Checkbox.tsx +72 -0
- package/templates/primitives/Checkbox/Checkbox.types.ts +28 -0
- package/templates/primitives/Checkbox/Checkbox.variants.ts +39 -0
- package/templates/primitives/CheckboxGroup/CheckboxGroup.tsx +32 -0
- package/templates/primitives/CheckboxGroup/CheckboxGroup.types.ts +17 -0
- package/templates/primitives/CheckboxGroup/CheckboxGroup.variants.ts +25 -0
- package/templates/primitives/Collapsible/Collapsible.tsx +74 -0
- package/templates/primitives/Collapsible/Collapsible.types.ts +28 -0
- package/templates/primitives/Collapsible/Collapsible.variants.ts +44 -0
- package/templates/primitives/Combobox/Combobox.tsx +450 -0
- package/templates/primitives/Combobox/Combobox.types.ts +99 -0
- package/templates/primitives/Combobox/Combobox.variants.ts +180 -0
- package/templates/primitives/ContextMenu/ContextMenu.tsx +375 -0
- package/templates/primitives/ContextMenu/ContextMenu.types.ts +57 -0
- package/templates/primitives/ContextMenu/ContextMenu.variants.ts +39 -0
- package/templates/primitives/Dialog/Dialog.tsx +148 -0
- package/templates/primitives/Dialog/Dialog.types.ts +29 -0
- package/templates/primitives/Dialog/Dialog.variants.ts +56 -0
- package/templates/primitives/Drawer/Drawer.tsx +266 -0
- package/templates/primitives/Drawer/Drawer.types.ts +77 -0
- package/templates/primitives/Drawer/Drawer.variants.ts +175 -0
- package/templates/primitives/Field/Field.tsx +132 -0
- package/templates/primitives/Field/Field.types.ts +43 -0
- package/templates/primitives/Field/Field.variants.ts +77 -0
- package/templates/primitives/Fieldset/Fieldset.tsx +36 -0
- package/templates/primitives/Fieldset/Fieldset.types.ts +26 -0
- package/templates/primitives/Fieldset/Fieldset.variants.ts +37 -0
- package/templates/primitives/Form/Form.tsx +24 -0
- package/templates/primitives/Form/Form.types.ts +13 -0
- package/templates/primitives/Form/Form.variants.ts +11 -0
- package/templates/primitives/Input/Input.tsx +36 -0
- package/templates/primitives/Input/Input.types.ts +27 -0
- package/templates/primitives/Input/Input.variants.ts +41 -0
- package/templates/primitives/Menu/Menu.tsx +352 -0
- package/templates/primitives/Menu/Menu.types.ts +56 -0
- package/templates/primitives/Menu/Menu.variants.ts +73 -0
- package/templates/primitives/Menubar/Menubar.tsx +25 -0
- package/templates/primitives/Menubar/Menubar.types.ts +12 -0
- package/templates/primitives/Menubar/Menubar.variants.ts +22 -0
- package/templates/primitives/Meter/Meter.tsx +123 -0
- package/templates/primitives/Meter/Meter.types.ts +45 -0
- package/templates/primitives/Meter/Meter.variants.ts +47 -0
- package/templates/primitives/NavigationMenu/NavigationMenu.tsx +256 -0
- package/templates/primitives/NavigationMenu/NavigationMenu.types.ts +58 -0
- package/templates/primitives/NavigationMenu/NavigationMenu.variants.ts +40 -0
- package/templates/primitives/NumberField/NumberField.tsx +168 -0
- package/templates/primitives/NumberField/NumberField.types.ts +51 -0
- package/templates/primitives/NumberField/NumberField.variants.ts +92 -0
- package/templates/primitives/OtpField/OtpField.tsx +65 -0
- package/templates/primitives/OtpField/OtpField.types.ts +29 -0
- package/templates/primitives/OtpField/OtpField.variants.ts +45 -0
- package/templates/primitives/Popover/Popover.tsx +193 -0
- package/templates/primitives/Popover/Popover.types.ts +35 -0
- package/templates/primitives/Popover/Popover.variants.ts +68 -0
- package/templates/primitives/PreviewCard/PreviewCard.tsx +153 -0
- package/templates/primitives/PreviewCard/PreviewCard.types.ts +42 -0
- package/templates/primitives/PreviewCard/PreviewCard.variants.ts +24 -0
- package/templates/primitives/Progress/Progress.tsx +95 -0
- package/templates/primitives/Progress/Progress.types.ts +39 -0
- package/templates/primitives/Progress/Progress.variants.ts +39 -0
- package/templates/primitives/RadioGroup/RadioGroup.tsx +66 -0
- package/templates/primitives/RadioGroup/RadioGroup.types.ts +34 -0
- package/templates/primitives/RadioGroup/RadioGroup.variants.ts +59 -0
- package/templates/primitives/ScrollArea/ScrollArea.tsx +135 -0
- package/templates/primitives/ScrollArea/ScrollArea.types.ts +34 -0
- package/templates/primitives/ScrollArea/ScrollArea.variants.ts +38 -0
- package/templates/primitives/Select/Select.tsx +319 -0
- package/templates/primitives/Select/Select.types.ts +74 -0
- package/templates/primitives/Select/Select.variants.ts +94 -0
- package/templates/primitives/Separator/Separator.tsx +30 -0
- package/templates/primitives/Separator/Separator.types.ts +13 -0
- package/templates/primitives/Separator/Separator.variants.ts +19 -0
- package/templates/primitives/Slider/Slider.tsx +124 -0
- package/templates/primitives/Slider/Slider.types.ts +51 -0
- package/templates/primitives/Slider/Slider.variants.ts +38 -0
- package/templates/primitives/Switch/Switch.tsx +61 -0
- package/templates/primitives/Switch/Switch.types.ts +29 -0
- package/templates/primitives/Switch/Switch.variants.ts +48 -0
- package/templates/primitives/Tabs/Tabs.tsx +70 -0
- package/templates/primitives/Tabs/Tabs.types.ts +23 -0
- package/templates/primitives/Tabs/Tabs.variants.ts +29 -0
- package/templates/primitives/Textarea/Textarea.tsx +42 -0
- package/templates/primitives/Textarea/Textarea.types.ts +31 -0
- package/templates/primitives/Textarea/Textarea.variants.ts +46 -0
- package/templates/primitives/Toast/Toast.tsx +195 -0
- package/templates/primitives/Toast/Toast.types.ts +52 -0
- package/templates/primitives/Toast/Toast.variants.ts +88 -0
- package/templates/primitives/Toggle/Toggle.tsx +24 -0
- package/templates/primitives/Toggle/Toggle.types.ts +19 -0
- package/templates/primitives/Toggle/Toggle.variants.ts +32 -0
- package/templates/primitives/ToggleGroup/ToggleGroup.tsx +34 -0
- package/templates/primitives/ToggleGroup/ToggleGroup.types.ts +19 -0
- package/templates/primitives/ToggleGroup/ToggleGroup.variants.ts +32 -0
- package/templates/primitives/Toolbar/Toolbar.tsx +118 -0
- package/templates/primitives/Toolbar/Toolbar.types.ts +32 -0
- package/templates/primitives/Toolbar/Toolbar.variants.ts +84 -0
- package/templates/primitives/Tooltip/Tooltip.tsx +98 -0
- package/templates/primitives/Tooltip/Tooltip.types.ts +22 -0
- package/templates/primitives/Tooltip/Tooltip.variants.ts +24 -0
- package/templates/shared/utils/cn.ts +46 -0
- package/templates/styles/theme.css +311 -0
- package/templates/styles/tokens.css +1445 -0
- package/templates/templates/DashboardShell/DashboardShell.tsx +124 -0
- package/templates/templates/DashboardShell/DashboardShell.types.ts +37 -0
- package/templates/templates/DashboardShell/DashboardShell.variants.ts +25 -0
- package/templates/tsconfig.json +5 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawer.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 drawerTriggerVariants = cva(
|
|
11
|
+
[
|
|
12
|
+
"inline-flex h-(--lsys-drawer-trigger-height) items-center justify-center rounded-(--lsys-drawer-trigger-radius)",
|
|
13
|
+
"bg-(--lsys-drawer-trigger-background) px-(--lsys-drawer-trigger-padding-x) text-(--lsys-drawer-trigger-foreground)",
|
|
14
|
+
"text-(length:--lsys-drawer-trigger-font-size) font-(--lsys-drawer-trigger-font-weight) leading-(--lsys-drawer-trigger-font-line-height)",
|
|
15
|
+
"transition-colors duration-(--lsys-drawer-transition-duration) ease-(--lsys-drawer-transition-easing)",
|
|
16
|
+
"outline-none hover:bg-(--lsys-drawer-trigger-hover-background) focus-visible:ring-(length:--lsys-drawer-focus-ring-width) focus-visible:ring-(--lsys-drawer-focus-ring-color) focus-visible:ring-offset-(length:--lsys-drawer-focus-ring-offset) focus-visible:ring-offset-(--lsys-drawer-focus-ring-offset-color)",
|
|
17
|
+
disabledStateClasses,
|
|
18
|
+
].join(" "),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const drawerIndentBackgroundVariants = cva(
|
|
22
|
+
"fixed inset-0 z-(--lsys-drawer-indent-z-index) bg-(--lsys-drawer-indent-background) opacity-0 transition-opacity duration-(--lsys-drawer-transition-duration) ease-(--lsys-drawer-transition-easing) data-[active]:opacity-100",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
export const drawerIndentVariants = cva(
|
|
26
|
+
"min-h-(--lsys-drawer-viewport-max-height) origin-top overflow-hidden transition-[border-radius,transform] duration-(--lsys-drawer-transition-duration) ease-(--lsys-drawer-transition-easing) data-[active]:scale-(--lsys-drawer-indent-scale) data-[active]:rounded-(--lsys-drawer-indent-radius)",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export const drawerBackdropVariants = cva(
|
|
30
|
+
[
|
|
31
|
+
"fixed inset-0 z-(--lsys-drawer-backdrop-z-index) bg-(--lsys-drawer-backdrop-background) opacity-(--lsys-drawer-backdrop-opacity)",
|
|
32
|
+
"transition-opacity duration-(--lsys-drawer-transition-duration) ease-(--lsys-drawer-transition-easing)",
|
|
33
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
34
|
+
].join(" "),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
export const drawerViewportVariants = cva(
|
|
38
|
+
"fixed inset-0 z-(--lsys-drawer-viewport-z-index) flex overflow-hidden p-(--lsys-drawer-viewport-padding)",
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
side: {
|
|
42
|
+
bottom: "items-end justify-center",
|
|
43
|
+
top: "items-start justify-center",
|
|
44
|
+
right: "items-stretch justify-end",
|
|
45
|
+
left: "items-stretch justify-start",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
side: "bottom",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
export const drawerPopupVariants = cva(
|
|
55
|
+
[
|
|
56
|
+
"relative flex bg-(--lsys-drawer-popup-background) text-(--lsys-drawer-popup-foreground) shadow-(--lsys-drawer-popup-shadow) outline-none",
|
|
57
|
+
"border border-(--lsys-drawer-popup-border-color) transition-[opacity,transform] duration-[calc(var(--lsys-drawer-transition-duration)*var(--drawer-swipe-strength,1))] ease-(--lsys-drawer-transition-easing)",
|
|
58
|
+
"data-[swiping]:transition-none",
|
|
59
|
+
].join(" "),
|
|
60
|
+
{
|
|
61
|
+
variants: {
|
|
62
|
+
side: {
|
|
63
|
+
bottom:
|
|
64
|
+
"max-h-[calc(var(--lsys-drawer-viewport-max-height)-(var(--lsys-drawer-viewport-padding)*2))] w-[min(calc(100vw-(var(--lsys-drawer-viewport-inset)*2)),var(--lsys-drawer-popup-max-width))] translate-y-[calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] rounded-t-(--lsys-drawer-popup-radius) data-[ending-style]:translate-y-full data-[starting-style]:translate-y-full",
|
|
65
|
+
top: "max-h-[calc(var(--lsys-drawer-viewport-max-height)-(var(--lsys-drawer-viewport-padding)*2))] w-[min(calc(100vw-(var(--lsys-drawer-viewport-inset)*2)),var(--lsys-drawer-popup-max-width))] translate-y-[var(--drawer-swipe-movement-y,0px)] rounded-b-(--lsys-drawer-popup-radius) data-[ending-style]:-translate-y-full data-[starting-style]:-translate-y-full",
|
|
66
|
+
right:
|
|
67
|
+
"h-full max-w-[calc(100vw-(var(--lsys-drawer-viewport-inset)*2))] translate-x-[var(--drawer-swipe-movement-x,0px)] rounded-l-(--lsys-drawer-popup-radius) data-[ending-style]:translate-x-full data-[starting-style]:translate-x-full",
|
|
68
|
+
left: "h-full max-w-[calc(100vw-(var(--lsys-drawer-viewport-inset)*2))] translate-x-[var(--drawer-swipe-movement-x,0px)] rounded-r-(--lsys-drawer-popup-radius) data-[ending-style]:-translate-x-full data-[starting-style]:-translate-x-full",
|
|
69
|
+
},
|
|
70
|
+
size: {
|
|
71
|
+
sm: "",
|
|
72
|
+
md: "",
|
|
73
|
+
lg: "",
|
|
74
|
+
full: "",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
compoundVariants: [
|
|
78
|
+
{
|
|
79
|
+
side: ["bottom", "top"],
|
|
80
|
+
size: "sm",
|
|
81
|
+
class: "min-h-(--lsys-drawer-popup-height-sm)",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
side: ["bottom", "top"],
|
|
85
|
+
size: "md",
|
|
86
|
+
class: "min-h-(--lsys-drawer-popup-height-md)",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
side: ["bottom", "top"],
|
|
90
|
+
size: "lg",
|
|
91
|
+
class: "min-h-(--lsys-drawer-popup-height-lg)",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
side: ["bottom", "top"],
|
|
95
|
+
size: "full",
|
|
96
|
+
class:
|
|
97
|
+
"min-h-[calc(var(--lsys-drawer-viewport-max-height)-(var(--lsys-drawer-viewport-padding)*2))]",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
side: ["left", "right"],
|
|
101
|
+
size: "sm",
|
|
102
|
+
class: "w-(--lsys-drawer-popup-width-sm)",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
side: ["left", "right"],
|
|
106
|
+
size: "md",
|
|
107
|
+
class: "w-(--lsys-drawer-popup-width-md)",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
side: ["left", "right"],
|
|
111
|
+
size: "lg",
|
|
112
|
+
class: "w-(--lsys-drawer-popup-width-lg)",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
side: ["left", "right"],
|
|
116
|
+
size: "full",
|
|
117
|
+
class: "w-[calc(100vw-(var(--lsys-drawer-viewport-inset)*2))]",
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
defaultVariants: {
|
|
121
|
+
side: "bottom",
|
|
122
|
+
size: "md",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
export const drawerContentVariants = cva(
|
|
128
|
+
"grid flex-1 content-start gap-(--lsys-drawer-content-gap) overflow-auto p-(--lsys-drawer-content-padding)",
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
export const drawerHandleVariants = cva(
|
|
132
|
+
"mx-auto mt-(--lsys-drawer-handle-margin-top) h-(--lsys-drawer-handle-height) w-(--lsys-drawer-handle-width) shrink-0 rounded-(--lsys-drawer-handle-radius) bg-(--lsys-drawer-handle-background)",
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
export const drawerSwipeAreaVariants = cva(
|
|
136
|
+
"fixed z-(--lsys-drawer-handle-z-index) data-[disabled]:pointer-events-none data-[disabled]:opacity-0",
|
|
137
|
+
{
|
|
138
|
+
variants: {
|
|
139
|
+
side: {
|
|
140
|
+
bottom: "inset-x-0 bottom-0 h-(--lsys-drawer-swipe-area-size)",
|
|
141
|
+
top: "inset-x-0 top-0 h-(--lsys-drawer-swipe-area-size)",
|
|
142
|
+
right: "inset-y-0 right-0 w-(--lsys-drawer-swipe-area-size)",
|
|
143
|
+
left: "inset-y-0 left-0 w-(--lsys-drawer-swipe-area-size)",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
defaultVariants: {
|
|
147
|
+
side: "bottom",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
export const drawerTitleVariants = cva(
|
|
153
|
+
"pr-(--lsys-drawer-title-padding-end) text-(length:--lsys-drawer-title-font-size) font-(--lsys-drawer-title-font-weight) leading-(--lsys-drawer-title-font-line-height) text-(--lsys-drawer-title-foreground)",
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
export const drawerDescriptionVariants = cva(
|
|
157
|
+
"text-(length:--lsys-drawer-description-font-size) font-(--lsys-drawer-description-font-weight) leading-(--lsys-drawer-description-font-line-height) text-(--lsys-drawer-description-foreground)",
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
export const drawerCloseVariants = cva(
|
|
161
|
+
[
|
|
162
|
+
"absolute right-(--lsys-drawer-close-inset) top-(--lsys-drawer-close-inset) inline-flex size-(--lsys-drawer-close-size) items-center justify-center rounded-(--lsys-drawer-close-radius)",
|
|
163
|
+
"text-(--lsys-drawer-close-foreground) outline-none transition-colors duration-(--lsys-drawer-transition-duration) ease-(--lsys-drawer-transition-easing)",
|
|
164
|
+
"hover:bg-(--lsys-drawer-close-hover-background) focus-visible:ring-(length:--lsys-drawer-focus-ring-width) focus-visible:ring-(--lsys-drawer-focus-ring-color) focus-visible:ring-offset-(length:--lsys-drawer-focus-ring-offset) focus-visible:ring-offset-(--lsys-drawer-focus-ring-offset-color)",
|
|
165
|
+
disabledStateClasses,
|
|
166
|
+
].join(" "),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
export const drawerCloseInlineVariants = cva(
|
|
170
|
+
[
|
|
171
|
+
"relative inline-flex w-auto items-center outline-none",
|
|
172
|
+
"focus-visible:ring-(length:--lsys-drawer-focus-ring-width) focus-visible:ring-(--lsys-drawer-focus-ring-color) focus-visible:ring-offset-(length:--lsys-drawer-focus-ring-offset) focus-visible:ring-offset-(--lsys-drawer-focus-ring-offset-color)",
|
|
173
|
+
disabledStateClasses,
|
|
174
|
+
].join(" "),
|
|
175
|
+
)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Field component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Field as BaseField } from "@base-ui/react/field"
|
|
8
|
+
import type {
|
|
9
|
+
FieldControlProps,
|
|
10
|
+
FieldDescriptionProps,
|
|
11
|
+
FieldErrorProps,
|
|
12
|
+
FieldItemProps,
|
|
13
|
+
FieldLabelProps,
|
|
14
|
+
FieldProps,
|
|
15
|
+
FieldValidityProps,
|
|
16
|
+
} from "./Field.types"
|
|
17
|
+
import {
|
|
18
|
+
fieldControlVariants,
|
|
19
|
+
fieldDescriptionVariants,
|
|
20
|
+
fieldErrorVariants,
|
|
21
|
+
fieldItemVariants,
|
|
22
|
+
fieldLabelVariants,
|
|
23
|
+
fieldVariants,
|
|
24
|
+
} from "./Field.variants"
|
|
25
|
+
import { mergeClassName } from "@/lib/utils"
|
|
26
|
+
|
|
27
|
+
const Field = ({ ref, className, ...props }: FieldProps) => {
|
|
28
|
+
return (
|
|
29
|
+
<BaseField.Root
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={mergeClassName(fieldVariants(), className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Field.displayName = "Field"
|
|
38
|
+
|
|
39
|
+
const FieldLabel = ({ ref, className, ...props }: FieldLabelProps) => {
|
|
40
|
+
return (
|
|
41
|
+
<BaseField.Label
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={mergeClassName(fieldLabelVariants(), className)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
FieldLabel.displayName = "FieldLabel"
|
|
50
|
+
|
|
51
|
+
const FieldControl = ({
|
|
52
|
+
ref,
|
|
53
|
+
variant,
|
|
54
|
+
size,
|
|
55
|
+
className,
|
|
56
|
+
isInvalid,
|
|
57
|
+
...props
|
|
58
|
+
}: FieldControlProps) => {
|
|
59
|
+
const baseControlProps: Omit<
|
|
60
|
+
FieldControlProps,
|
|
61
|
+
"className" | "isInvalid" | "size" | "variant"
|
|
62
|
+
> = isInvalid ? { ...props, "aria-invalid": true } : props
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<BaseField.Control
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={mergeClassName(
|
|
68
|
+
fieldControlVariants({ variant, size }),
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
{...baseControlProps}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
FieldControl.displayName = "FieldControl"
|
|
77
|
+
|
|
78
|
+
const FieldDescription = ({
|
|
79
|
+
ref,
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: FieldDescriptionProps) => {
|
|
83
|
+
return (
|
|
84
|
+
<BaseField.Description
|
|
85
|
+
ref={ref}
|
|
86
|
+
className={mergeClassName(fieldDescriptionVariants(), className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
FieldDescription.displayName = "FieldDescription"
|
|
93
|
+
|
|
94
|
+
const FieldItem = ({ ref, className, ...props }: FieldItemProps) => {
|
|
95
|
+
return (
|
|
96
|
+
<BaseField.Item
|
|
97
|
+
ref={ref}
|
|
98
|
+
className={mergeClassName(fieldItemVariants(), className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
FieldItem.displayName = "FieldItem"
|
|
105
|
+
|
|
106
|
+
const FieldError = ({ ref, className, ...props }: FieldErrorProps) => {
|
|
107
|
+
return (
|
|
108
|
+
<BaseField.Error
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={mergeClassName(fieldErrorVariants(), className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
FieldError.displayName = "FieldError"
|
|
117
|
+
|
|
118
|
+
const FieldValidity = (props: FieldValidityProps) => {
|
|
119
|
+
return <BaseField.Validity {...props} />
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
FieldValidity.displayName = "FieldValidity"
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
Field,
|
|
126
|
+
FieldLabel,
|
|
127
|
+
FieldControl,
|
|
128
|
+
FieldDescription,
|
|
129
|
+
FieldItem,
|
|
130
|
+
FieldError,
|
|
131
|
+
FieldValidity,
|
|
132
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Field.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Field component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Field as BaseField } from "@base-ui/react/field"
|
|
9
|
+
|
|
10
|
+
export interface FieldProps extends Omit<BaseField.Root.Props, "className"> {
|
|
11
|
+
ref?: Ref<HTMLDivElement>
|
|
12
|
+
className?: BaseField.Root.Props["className"]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type FieldLabelProps = BaseField.Label.Props
|
|
16
|
+
|
|
17
|
+
export type FieldControlVariant = "default" | "ghost"
|
|
18
|
+
|
|
19
|
+
export type FieldControlSize = "sm" | "md" | "lg"
|
|
20
|
+
|
|
21
|
+
export interface FieldControlProps extends Omit<
|
|
22
|
+
BaseField.Control.Props,
|
|
23
|
+
"aria-invalid" | "className" | "size"
|
|
24
|
+
> {
|
|
25
|
+
variant?: FieldControlVariant
|
|
26
|
+
size?: FieldControlSize
|
|
27
|
+
isInvalid?: boolean
|
|
28
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling"
|
|
29
|
+
className?: BaseField.Control.Props["className"]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FieldDescriptionProps extends Omit<
|
|
33
|
+
BaseField.Description.Props,
|
|
34
|
+
"className"
|
|
35
|
+
> {
|
|
36
|
+
className?: BaseField.Description.Props["className"]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type FieldItemProps = BaseField.Item.Props
|
|
40
|
+
|
|
41
|
+
export type FieldErrorProps = BaseField.Error.Props
|
|
42
|
+
|
|
43
|
+
export type FieldValidityProps = BaseField.Validity.Props
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field.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 fieldVariants = cva(
|
|
11
|
+
[
|
|
12
|
+
"grid gap-(--lsys-field-gap) text-(--lsys-field-foreground)",
|
|
13
|
+
"data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
14
|
+
].join(" "),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export const fieldLabelVariants = cva(
|
|
18
|
+
[
|
|
19
|
+
"w-fit text-(length:--lsys-field-label-font-size) font-(--lsys-field-label-font-weight) leading-(--lsys-field-label-font-line-height) tracking-(--lsys-field-label-font-letter-spacing)",
|
|
20
|
+
"text-(--lsys-field-label-foreground) data-[invalid]:text-(--lsys-field-label-invalid-foreground) data-[disabled]:cursor-not-allowed",
|
|
21
|
+
].join(" "),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export const fieldControlVariants = cva(
|
|
25
|
+
[
|
|
26
|
+
"flex w-full min-w-0 border bg-(--lsys-field-control-background) text-(--lsys-field-control-foreground)",
|
|
27
|
+
"rounded-(--lsys-field-control-radius) border-(--lsys-field-control-border-color)",
|
|
28
|
+
"font-(family-name:--lsys-field-control-font-family) font-(--lsys-field-control-font-weight) leading-(--lsys-field-control-font-line-height) tracking-(--lsys-field-control-font-letter-spacing)",
|
|
29
|
+
"placeholder:text-(--lsys-field-control-placeholder-color)",
|
|
30
|
+
"transition-colors duration-(--lsys-field-transition-duration) ease-(--lsys-field-transition-easing)",
|
|
31
|
+
"outline-none focus-visible:border-(--lsys-field-control-focus-border-color) focus-visible:ring-(length:--lsys-field-control-focus-ring-width) focus-visible:ring-(--lsys-field-control-focus-ring-color) focus-visible:ring-offset-(length:--lsys-field-control-focus-ring-offset) focus-visible:ring-offset-(--lsys-field-control-focus-ring-offset-color)",
|
|
32
|
+
"data-[invalid]:border-(--lsys-field-control-invalid-border-color) data-[invalid]:ring-(--lsys-field-control-invalid-ring-color) aria-invalid:border-(--lsys-field-control-invalid-border-color) aria-invalid:ring-(--lsys-field-control-invalid-ring-color)",
|
|
33
|
+
"disabled:cursor-not-allowed",
|
|
34
|
+
disabledStateClasses,
|
|
35
|
+
].join(" "),
|
|
36
|
+
{
|
|
37
|
+
variants: {
|
|
38
|
+
variant: {
|
|
39
|
+
default: "",
|
|
40
|
+
ghost:
|
|
41
|
+
"border-transparent bg-transparent focus-visible:bg-(--lsys-field-control-background)",
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
sm: "h-(--lsys-field-control-height-sm) px-(--lsys-field-control-padding-x-sm) text-(length:--lsys-field-control-font-size-sm)",
|
|
45
|
+
md: "h-(--lsys-field-control-height-md) px-(--lsys-field-control-padding-x-md) text-(length:--lsys-field-control-font-size-md)",
|
|
46
|
+
lg: "h-(--lsys-field-control-height-lg) px-(--lsys-field-control-padding-x-lg) text-(length:--lsys-field-control-font-size-lg)",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: "default",
|
|
51
|
+
size: "md",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
export const fieldDescriptionVariants = cva(
|
|
57
|
+
[
|
|
58
|
+
"m-0 text-(length:--lsys-field-description-font-size) font-(--lsys-field-description-font-weight) leading-(--lsys-field-description-font-line-height) tracking-(--lsys-field-description-font-letter-spacing)",
|
|
59
|
+
"text-(--lsys-field-description-foreground) data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
60
|
+
].join(" "),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
export const fieldItemVariants = cva(
|
|
64
|
+
[
|
|
65
|
+
"grid gap-(--lsys-field-item-gap)",
|
|
66
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
67
|
+
].join(" "),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
export const fieldErrorVariants = cva(
|
|
71
|
+
[
|
|
72
|
+
"m-0 text-(length:--lsys-field-error-font-size) font-(--lsys-field-error-font-weight) leading-(--lsys-field-error-font-line-height) tracking-(--lsys-field-error-font-letter-spacing)",
|
|
73
|
+
"text-(--lsys-field-error-foreground) data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
74
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
75
|
+
"transition-opacity duration-(--lsys-field-transition-duration) ease-(--lsys-field-transition-easing)",
|
|
76
|
+
].join(" "),
|
|
77
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fieldset.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Fieldset component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset"
|
|
8
|
+
import type { FieldsetLegendProps, FieldsetProps } from "./Fieldset.types"
|
|
9
|
+
import { fieldsetLegendVariants, fieldsetVariants } from "./Fieldset.variants"
|
|
10
|
+
import { mergeClassName } from "@/lib/utils"
|
|
11
|
+
|
|
12
|
+
const Fieldset = ({ ref, variant, className, ...props }: FieldsetProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<BaseFieldset.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={mergeClassName(fieldsetVariants({ variant }), className)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Fieldset.displayName = "Fieldset"
|
|
23
|
+
|
|
24
|
+
const FieldsetLegend = ({ ref, className, ...props }: FieldsetLegendProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<BaseFieldset.Legend
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={mergeClassName(fieldsetLegendVariants(), className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
FieldsetLegend.displayName = "FieldsetLegend"
|
|
35
|
+
|
|
36
|
+
export { Fieldset, FieldsetLegend }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Fieldset.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Fieldset component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Fieldset as BaseFieldset } from "@base-ui/react/fieldset"
|
|
9
|
+
|
|
10
|
+
export type FieldsetVariant = "surface" | "plain"
|
|
11
|
+
|
|
12
|
+
export interface FieldsetProps extends Omit<
|
|
13
|
+
BaseFieldset.Root.Props,
|
|
14
|
+
"className"
|
|
15
|
+
> {
|
|
16
|
+
ref?: Ref<HTMLFieldSetElement>
|
|
17
|
+
variant?: FieldsetVariant
|
|
18
|
+
className?: BaseFieldset.Root.Props["className"]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FieldsetLegendProps extends Omit<
|
|
22
|
+
BaseFieldset.Legend.Props,
|
|
23
|
+
"className"
|
|
24
|
+
> {
|
|
25
|
+
className?: BaseFieldset.Legend.Props["className"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fieldset.variants.ts
|
|
3
|
+
*
|
|
4
|
+
* Defines visual variants using class composition.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
export const fieldsetVariants = cva(
|
|
10
|
+
[
|
|
11
|
+
"m-0 grid min-w-0 gap-(--lsys-fieldset-gap) rounded-(--lsys-fieldset-radius)",
|
|
12
|
+
"border border-(--lsys-fieldset-border-color) p-(--lsys-fieldset-padding)",
|
|
13
|
+
"bg-(--lsys-fieldset-background) text-(--lsys-fieldset-foreground)",
|
|
14
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
15
|
+
].join(" "),
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
surface: "",
|
|
20
|
+
plain:
|
|
21
|
+
"border-transparent bg-transparent p-0 shadow-none data-[disabled]:opacity-(--lsys-opacity-disabled)",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "surface",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export const fieldsetLegendVariants = cva(
|
|
31
|
+
[
|
|
32
|
+
"mb-(--lsys-fieldset-legend-margin-bottom) text-(length:--lsys-fieldset-legend-font-size)",
|
|
33
|
+
"font-(--lsys-fieldset-legend-font-weight) leading-(--lsys-fieldset-legend-font-line-height)",
|
|
34
|
+
"tracking-(--lsys-fieldset-legend-font-letter-spacing) text-(--lsys-fieldset-legend-foreground)",
|
|
35
|
+
"data-[disabled]:cursor-not-allowed",
|
|
36
|
+
].join(" "),
|
|
37
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Form component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Form as BaseForm } from "@base-ui/react/form"
|
|
8
|
+
import type { FormProps } from "./Form.types"
|
|
9
|
+
import { formVariants } from "./Form.variants"
|
|
10
|
+
import { mergeClassName } from "@/lib/utils"
|
|
11
|
+
|
|
12
|
+
const Form = ({ ref, className, ...props }: FormProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<BaseForm
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={mergeClassName(formVariants(), className)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Form.displayName = "Form"
|
|
23
|
+
|
|
24
|
+
export { Form }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Form.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Form component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Form as BaseForm } from "@base-ui/react/form"
|
|
9
|
+
|
|
10
|
+
export interface FormProps extends Omit<BaseForm.Props, "className"> {
|
|
11
|
+
ref?: Ref<HTMLFormElement>
|
|
12
|
+
className?: BaseForm.Props["className"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Input component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Input as BaseInput } from "@base-ui/react/input"
|
|
8
|
+
import type { InputProps } from "./Input.types"
|
|
9
|
+
import { inputVariants } from "./Input.variants"
|
|
10
|
+
import { mergeClassName } from "@/lib/utils"
|
|
11
|
+
|
|
12
|
+
const Input = ({
|
|
13
|
+
ref,
|
|
14
|
+
variant,
|
|
15
|
+
size,
|
|
16
|
+
className,
|
|
17
|
+
isInvalid,
|
|
18
|
+
...props
|
|
19
|
+
}: InputProps) => {
|
|
20
|
+
const baseInputProps: Omit<
|
|
21
|
+
InputProps,
|
|
22
|
+
"className" | "isInvalid" | "size" | "variant"
|
|
23
|
+
> = isInvalid ? { ...props, "aria-invalid": true } : props
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<BaseInput
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={mergeClassName(inputVariants({ variant, size }), className)}
|
|
29
|
+
{...baseInputProps}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Input.displayName = "Input"
|
|
35
|
+
|
|
36
|
+
export { Input }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Input.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Input component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Input as BaseInput } from "@base-ui/react/input"
|
|
9
|
+
|
|
10
|
+
type InputAriaInvalid = boolean | "true" | "false" | "grammar" | "spelling"
|
|
11
|
+
type InputClassName = BaseInput.Props["className"]
|
|
12
|
+
|
|
13
|
+
export type InputVariant = "default" | "ghost"
|
|
14
|
+
|
|
15
|
+
export type InputSize = "sm" | "md" | "lg"
|
|
16
|
+
|
|
17
|
+
export interface InputProps extends Omit<
|
|
18
|
+
BaseInput.Props,
|
|
19
|
+
"aria-invalid" | "className" | "size"
|
|
20
|
+
> {
|
|
21
|
+
ref?: Ref<HTMLInputElement>
|
|
22
|
+
variant?: InputVariant
|
|
23
|
+
size?: InputSize
|
|
24
|
+
isInvalid?: boolean
|
|
25
|
+
"aria-invalid"?: InputAriaInvalid
|
|
26
|
+
className?: InputClassName
|
|
27
|
+
}
|