@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,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
|
+
}
|