@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,31 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Avatar.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Avatar component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Avatar as BaseAvatar } from "@base-ui/react/avatar"
|
|
9
|
+
|
|
10
|
+
export type AvatarSize = "sm" | "md" | "lg"
|
|
11
|
+
|
|
12
|
+
export type AvatarShape = "circle" | "square"
|
|
13
|
+
|
|
14
|
+
export interface AvatarProps extends Omit<
|
|
15
|
+
BaseAvatar.Root.Props,
|
|
16
|
+
"className" | "size"
|
|
17
|
+
> {
|
|
18
|
+
ref?: Ref<HTMLSpanElement>
|
|
19
|
+
size?: AvatarSize
|
|
20
|
+
shape?: AvatarShape
|
|
21
|
+
className?: BaseAvatar.Root.Props["className"]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface AvatarImageProps extends Omit<
|
|
25
|
+
BaseAvatar.Image.Props,
|
|
26
|
+
"className"
|
|
27
|
+
> {
|
|
28
|
+
className?: BaseAvatar.Image.Props["className"]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type AvatarFallbackProps = BaseAvatar.Fallback.Props
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar.variants.ts
|
|
3
|
+
*
|
|
4
|
+
* Defines visual variants using class composition.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
export const avatarVariants = cva(
|
|
10
|
+
[
|
|
11
|
+
"inline-flex shrink-0 items-center justify-center overflow-hidden border border-(--lsys-avatar-border-color)",
|
|
12
|
+
"bg-(--lsys-avatar-background) text-(--lsys-avatar-foreground)",
|
|
13
|
+
"font-(--lsys-avatar-font-weight) leading-(--lsys-avatar-font-line-height)",
|
|
14
|
+
].join(" "),
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "size-(--lsys-avatar-size-sm) text-(length:--lsys-avatar-font-size-sm)",
|
|
19
|
+
md: "size-(--lsys-avatar-size-md) text-(length:--lsys-avatar-font-size-md)",
|
|
20
|
+
lg: "size-(--lsys-avatar-size-lg) text-(length:--lsys-avatar-font-size-lg)",
|
|
21
|
+
},
|
|
22
|
+
shape: {
|
|
23
|
+
circle: "rounded-(--lsys-avatar-radius-circle)",
|
|
24
|
+
square: "rounded-(--lsys-avatar-radius-square)",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "md",
|
|
29
|
+
shape: "circle",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export const avatarImageVariants = cva(
|
|
35
|
+
"size-full object-cover transition-opacity duration-(--lsys-avatar-transition-duration) ease-(--lsys-avatar-transition-easing) data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
export const avatarFallbackVariants = cva(
|
|
39
|
+
"flex size-full items-center justify-center bg-(--lsys-avatar-fallback-background) text-(--lsys-avatar-fallback-foreground)",
|
|
40
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Badge.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Badge component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { BadgeProps } from "./Badge.types"
|
|
8
|
+
import { badgeVariants } from "./Badge.variants"
|
|
9
|
+
import { cn } from "@/lib/utils"
|
|
10
|
+
|
|
11
|
+
const Badge = ({
|
|
12
|
+
ref,
|
|
13
|
+
variant,
|
|
14
|
+
appearance,
|
|
15
|
+
size,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: BadgeProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<span
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(badgeVariants({ variant, appearance, size }), className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Badge.displayName = "Badge"
|
|
29
|
+
|
|
30
|
+
export { Badge }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Badge.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Badge component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { HTMLAttributes } from "react"
|
|
9
|
+
|
|
10
|
+
export type BadgeVariant =
|
|
11
|
+
| "neutral"
|
|
12
|
+
| "primary"
|
|
13
|
+
| "success"
|
|
14
|
+
| "warning"
|
|
15
|
+
| "danger"
|
|
16
|
+
|
|
17
|
+
export type BadgeAppearance = "solid" | "outline"
|
|
18
|
+
|
|
19
|
+
export type BadgeSize = "sm" | "md"
|
|
20
|
+
|
|
21
|
+
export interface BadgeProps extends Omit<
|
|
22
|
+
HTMLAttributes<HTMLSpanElement>,
|
|
23
|
+
"className"
|
|
24
|
+
> {
|
|
25
|
+
ref?: Ref<HTMLSpanElement>
|
|
26
|
+
variant?: BadgeVariant
|
|
27
|
+
appearance?: BadgeAppearance
|
|
28
|
+
size?: BadgeSize
|
|
29
|
+
className?: string
|
|
30
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Badge.variants.ts
|
|
3
|
+
*
|
|
4
|
+
* Defines Badge visual variants using class composition.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
const neutralSolid =
|
|
10
|
+
"border-(--lsys-badge-neutral-border-color) bg-(--lsys-badge-neutral-background) text-(--lsys-badge-neutral-foreground)"
|
|
11
|
+
|
|
12
|
+
const neutralOutline =
|
|
13
|
+
"border-(--lsys-badge-neutral-border-color) bg-(--lsys-badge-outline-background) text-(--lsys-badge-neutral-foreground)"
|
|
14
|
+
|
|
15
|
+
const primarySolid =
|
|
16
|
+
"border-(--lsys-badge-primary-border-color) bg-(--lsys-badge-primary-background) text-(--lsys-badge-primary-foreground)"
|
|
17
|
+
|
|
18
|
+
const primaryOutline =
|
|
19
|
+
"border-(--lsys-badge-primary-border-color) bg-(--lsys-badge-outline-background) text-(--lsys-badge-primary-border-color)"
|
|
20
|
+
|
|
21
|
+
const dangerSolid =
|
|
22
|
+
"border-(--lsys-badge-danger-border-color) bg-(--lsys-badge-danger-background) text-(--lsys-badge-danger-foreground)"
|
|
23
|
+
|
|
24
|
+
const dangerOutline =
|
|
25
|
+
"border-(--lsys-badge-danger-border-color) bg-(--lsys-badge-outline-background) text-(--lsys-badge-danger-border-color)"
|
|
26
|
+
|
|
27
|
+
const successSolid =
|
|
28
|
+
"border-(--lsys-color-feedback-success-foreground) bg-(--lsys-color-feedback-success-background) text-(--lsys-color-feedback-success-foreground)"
|
|
29
|
+
|
|
30
|
+
const successOutline =
|
|
31
|
+
"border-(--lsys-color-feedback-success-foreground) bg-(--lsys-badge-outline-background) text-(--lsys-color-feedback-success-foreground)"
|
|
32
|
+
|
|
33
|
+
const warningSolid =
|
|
34
|
+
"border-(--lsys-color-feedback-warning-foreground) bg-(--lsys-color-feedback-warning-background) text-(--lsys-color-feedback-warning-foreground)"
|
|
35
|
+
|
|
36
|
+
const warningOutline =
|
|
37
|
+
"border-(--lsys-color-feedback-warning-foreground) bg-(--lsys-badge-outline-background) text-(--lsys-color-feedback-warning-foreground)"
|
|
38
|
+
|
|
39
|
+
export const badgeVariants = cva(
|
|
40
|
+
[
|
|
41
|
+
"inline-flex items-center justify-center whitespace-nowrap border",
|
|
42
|
+
"rounded-(--lsys-badge-radius) font-(--lsys-badge-font-weight) leading-(--lsys-badge-font-line-height)",
|
|
43
|
+
"transition-colors duration-(--lsys-badge-transition-duration) ease-(--lsys-badge-transition-easing)",
|
|
44
|
+
].join(" "),
|
|
45
|
+
{
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
neutral: "",
|
|
49
|
+
primary: "",
|
|
50
|
+
success: "",
|
|
51
|
+
warning: "",
|
|
52
|
+
danger: "",
|
|
53
|
+
},
|
|
54
|
+
appearance: {
|
|
55
|
+
solid: "",
|
|
56
|
+
outline: "",
|
|
57
|
+
},
|
|
58
|
+
size: {
|
|
59
|
+
sm: "h-(--lsys-badge-height-sm) px-(--lsys-badge-padding-x-sm) text-(length:--lsys-badge-font-size-sm)",
|
|
60
|
+
md: "h-(--lsys-badge-height-md) px-(--lsys-badge-padding-x-md) text-(length:--lsys-badge-font-size-md)",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
compoundVariants: [
|
|
64
|
+
{ variant: "neutral", appearance: "solid", class: neutralSolid },
|
|
65
|
+
{ variant: "neutral", appearance: "outline", class: neutralOutline },
|
|
66
|
+
{ variant: "primary", appearance: "solid", class: primarySolid },
|
|
67
|
+
{ variant: "primary", appearance: "outline", class: primaryOutline },
|
|
68
|
+
{ variant: "success", appearance: "solid", class: successSolid },
|
|
69
|
+
{ variant: "success", appearance: "outline", class: successOutline },
|
|
70
|
+
{ variant: "warning", appearance: "solid", class: warningSolid },
|
|
71
|
+
{ variant: "warning", appearance: "outline", class: warningOutline },
|
|
72
|
+
{ variant: "danger", appearance: "solid", class: dangerSolid },
|
|
73
|
+
{ variant: "danger", appearance: "outline", class: dangerOutline },
|
|
74
|
+
],
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
variant: "neutral",
|
|
77
|
+
appearance: "solid",
|
|
78
|
+
size: "md",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Button component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Button as BaseButton } from "@base-ui/react/button"
|
|
8
|
+
import type { ButtonProps } from "./Button.types"
|
|
9
|
+
import { buttonVariants } from "./Button.variants"
|
|
10
|
+
import { mergeClassName } from "@/lib/utils"
|
|
11
|
+
|
|
12
|
+
const Button = ({
|
|
13
|
+
ref,
|
|
14
|
+
variant,
|
|
15
|
+
size,
|
|
16
|
+
className,
|
|
17
|
+
isLoading,
|
|
18
|
+
children,
|
|
19
|
+
disabled,
|
|
20
|
+
focusableWhenDisabled,
|
|
21
|
+
type,
|
|
22
|
+
...props
|
|
23
|
+
}: ButtonProps) => {
|
|
24
|
+
const isDisabled = isLoading || disabled
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<BaseButton
|
|
28
|
+
ref={ref}
|
|
29
|
+
type={type ?? "button"}
|
|
30
|
+
className={mergeClassName(buttonVariants({ variant, size }), className)}
|
|
31
|
+
disabled={Boolean(isDisabled)}
|
|
32
|
+
focusableWhenDisabled={isLoading ? true : Boolean(focusableWhenDisabled)}
|
|
33
|
+
aria-busy={isLoading ? true : undefined}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{isLoading ? (
|
|
37
|
+
<span className="inline-flex items-center gap-2">
|
|
38
|
+
<span
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
className="size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
41
|
+
/>
|
|
42
|
+
{children ?? "Loading"}
|
|
43
|
+
</span>
|
|
44
|
+
) : (
|
|
45
|
+
children
|
|
46
|
+
)}
|
|
47
|
+
</BaseButton>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Button.displayName = "Button"
|
|
52
|
+
|
|
53
|
+
export { Button }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Button.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Button component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Button as BaseButton } from "@base-ui/react/button"
|
|
9
|
+
|
|
10
|
+
export type ButtonVariant =
|
|
11
|
+
| "primary"
|
|
12
|
+
| "secondary"
|
|
13
|
+
| "ghost"
|
|
14
|
+
| "outline"
|
|
15
|
+
| "danger"
|
|
16
|
+
|
|
17
|
+
export type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl"
|
|
18
|
+
|
|
19
|
+
export interface ButtonProps extends Omit<BaseButton.Props, "className"> {
|
|
20
|
+
ref?: Ref<HTMLButtonElement>
|
|
21
|
+
variant?: ButtonVariant
|
|
22
|
+
size?: ButtonSize
|
|
23
|
+
isLoading?: boolean
|
|
24
|
+
className?: BaseButton.Props["className"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button.variants.ts
|
|
3
|
+
*
|
|
4
|
+
* Defines visual variants using class composition.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
import { busyStateClasses, disabledStateClasses } from "@/lib/utils"
|
|
9
|
+
|
|
10
|
+
export const buttonVariants = cva(
|
|
11
|
+
[
|
|
12
|
+
"inline-flex items-center justify-center whitespace-nowrap border border-transparent",
|
|
13
|
+
"rounded-(--lsys-button-radius) font-(family-name:--lsys-button-font-family) font-(--lsys-button-font-weight)",
|
|
14
|
+
"transition-colors duration-(--lsys-button-transition-duration) ease-(--lsys-button-transition-easing)",
|
|
15
|
+
"outline-none focus-visible:ring-(length:--lsys-button-focus-ring-width) focus-visible:ring-(--lsys-button-focus-ring-color) focus-visible:ring-offset-(length:--lsys-button-focus-ring-offset) focus-visible:ring-offset-(--lsys-button-focus-ring-offset-color)",
|
|
16
|
+
disabledStateClasses,
|
|
17
|
+
busyStateClasses,
|
|
18
|
+
"text-(length:--lsys-button-font-size-md)",
|
|
19
|
+
"leading-(--lsys-button-font-line-height)",
|
|
20
|
+
"tracking-(--lsys-button-font-letter-spacing)",
|
|
21
|
+
].join(" "),
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
variant: {
|
|
25
|
+
primary:
|
|
26
|
+
"border-(--lsys-button-primary-border-color) bg-(--lsys-button-primary-background) text-(--lsys-button-primary-foreground) hover:bg-(--lsys-button-primary-hover-background)",
|
|
27
|
+
secondary:
|
|
28
|
+
"border-(--lsys-button-secondary-border-color) bg-(--lsys-button-secondary-background) text-(--lsys-button-secondary-foreground) hover:bg-(--lsys-button-secondary-hover-background)",
|
|
29
|
+
ghost:
|
|
30
|
+
"border-transparent bg-transparent text-(--lsys-button-secondary-foreground) hover:bg-(--lsys-button-secondary-hover-background)",
|
|
31
|
+
outline:
|
|
32
|
+
"border-(--lsys-button-secondary-border-color) bg-transparent text-(--lsys-button-secondary-foreground) hover:bg-(--lsys-button-secondary-hover-background)",
|
|
33
|
+
danger:
|
|
34
|
+
"border-(--lsys-button-danger-border-color) bg-(--lsys-button-danger-background) text-(--lsys-button-danger-foreground) hover:bg-(--lsys-button-danger-hover-background)",
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
xs: [
|
|
38
|
+
"h-(--lsys-button-height-xs)",
|
|
39
|
+
"px-(--lsys-button-padding-x-xs)",
|
|
40
|
+
"text-(length:--lsys-button-font-size-xs)",
|
|
41
|
+
],
|
|
42
|
+
sm: [
|
|
43
|
+
"h-(--lsys-button-height-sm)",
|
|
44
|
+
"px-(--lsys-button-padding-x-sm)",
|
|
45
|
+
"text-(length:--lsys-button-font-size-sm)",
|
|
46
|
+
],
|
|
47
|
+
md: [
|
|
48
|
+
"h-(--lsys-button-height-md)",
|
|
49
|
+
"px-(--lsys-button-padding-x-md)",
|
|
50
|
+
"text-(length:--lsys-button-font-size-md)",
|
|
51
|
+
],
|
|
52
|
+
lg: [
|
|
53
|
+
"h-(--lsys-button-height-lg)",
|
|
54
|
+
"px-(--lsys-button-padding-x-lg)",
|
|
55
|
+
"text-(length:--lsys-button-font-size-lg)",
|
|
56
|
+
],
|
|
57
|
+
xl: [
|
|
58
|
+
"h-(--lsys-button-height-xl)",
|
|
59
|
+
"px-(--lsys-button-padding-x-xl)",
|
|
60
|
+
"text-(length:--lsys-button-font-size-xl)",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
variant: "primary",
|
|
66
|
+
size: "md",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Card component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
CardContentProps,
|
|
9
|
+
CardDescriptionProps,
|
|
10
|
+
CardFooterProps,
|
|
11
|
+
CardHeaderProps,
|
|
12
|
+
CardProps,
|
|
13
|
+
CardTitleProps,
|
|
14
|
+
} from "./Card.types"
|
|
15
|
+
import {
|
|
16
|
+
cardContentClassName,
|
|
17
|
+
cardDescriptionClassName,
|
|
18
|
+
cardFooterClassName,
|
|
19
|
+
cardHeaderClassName,
|
|
20
|
+
cardTitleClassName,
|
|
21
|
+
cardVariants,
|
|
22
|
+
} from "./Card.variants"
|
|
23
|
+
import { cn } from "@/lib/utils"
|
|
24
|
+
|
|
25
|
+
const Card = ({ ref, variant, className, ...props }: CardProps) => {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(cardVariants({ variant }), className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Card.displayName = "Card"
|
|
36
|
+
|
|
37
|
+
const CardHeader = ({ ref, className, ...props }: CardHeaderProps) => {
|
|
38
|
+
return (
|
|
39
|
+
<div ref={ref} className={cn(cardHeaderClassName, className)} {...props} />
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
CardHeader.displayName = "CardHeader"
|
|
44
|
+
|
|
45
|
+
const CardTitle = ({ ref, className, ...props }: CardTitleProps) => {
|
|
46
|
+
return (
|
|
47
|
+
<h3 ref={ref} className={cn(cardTitleClassName, className)} {...props} />
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
CardTitle.displayName = "CardTitle"
|
|
52
|
+
|
|
53
|
+
const CardDescription = ({
|
|
54
|
+
ref,
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}: CardDescriptionProps) => {
|
|
58
|
+
return (
|
|
59
|
+
<p
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn(cardDescriptionClassName, className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
CardDescription.displayName = "CardDescription"
|
|
68
|
+
|
|
69
|
+
const CardContent = ({ ref, className, ...props }: CardContentProps) => {
|
|
70
|
+
return (
|
|
71
|
+
<div ref={ref} className={cn(cardContentClassName, className)} {...props} />
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
CardContent.displayName = "CardContent"
|
|
76
|
+
|
|
77
|
+
const CardFooter = ({ ref, className, ...props }: CardFooterProps) => {
|
|
78
|
+
return (
|
|
79
|
+
<div ref={ref} className={cn(cardFooterClassName, className)} {...props} />
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
CardFooter.displayName = "CardFooter"
|
|
84
|
+
|
|
85
|
+
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Card.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Card component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { HTMLAttributes } from "react"
|
|
9
|
+
|
|
10
|
+
export type CardVariant =
|
|
11
|
+
| "surface"
|
|
12
|
+
| "muted"
|
|
13
|
+
| "default"
|
|
14
|
+
| "outlined"
|
|
15
|
+
| "elevated"
|
|
16
|
+
| "ghost"
|
|
17
|
+
|
|
18
|
+
export interface CardProps extends Omit<
|
|
19
|
+
HTMLAttributes<HTMLDivElement>,
|
|
20
|
+
"className"
|
|
21
|
+
> {
|
|
22
|
+
ref?: Ref<HTMLDivElement>
|
|
23
|
+
variant?: CardVariant
|
|
24
|
+
className?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CardSectionProps extends Omit<
|
|
28
|
+
HTMLAttributes<HTMLDivElement>,
|
|
29
|
+
"className"
|
|
30
|
+
> {
|
|
31
|
+
ref?: Ref<HTMLDivElement>
|
|
32
|
+
className?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type CardHeaderProps = CardSectionProps
|
|
36
|
+
|
|
37
|
+
export interface CardTitleProps extends Omit<
|
|
38
|
+
HTMLAttributes<HTMLHeadingElement>,
|
|
39
|
+
"className"
|
|
40
|
+
> {
|
|
41
|
+
ref?: Ref<HTMLHeadingElement>
|
|
42
|
+
className?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CardDescriptionProps extends Omit<
|
|
46
|
+
HTMLAttributes<HTMLParagraphElement>,
|
|
47
|
+
"className"
|
|
48
|
+
> {
|
|
49
|
+
ref?: Ref<HTMLParagraphElement>
|
|
50
|
+
className?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type CardContentProps = CardSectionProps
|
|
54
|
+
export type CardFooterProps = CardSectionProps
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card.variants.ts
|
|
3
|
+
*
|
|
4
|
+
* Defines Card visual slots using class composition.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
export const cardVariants = cva(
|
|
10
|
+
[
|
|
11
|
+
"rounded-(--lsys-card-radius) border border-(--lsys-card-border-color)",
|
|
12
|
+
"bg-(--lsys-card-background) text-(--lsys-card-foreground) transition-colors",
|
|
13
|
+
"duration-(--lsys-card-transition-duration) ease-(--lsys-card-transition-easing)",
|
|
14
|
+
].join(" "),
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
surface: "",
|
|
19
|
+
muted: "bg-(--lsys-card-muted-background)",
|
|
20
|
+
default: "",
|
|
21
|
+
outlined: "border-(--lsys-border-strong)",
|
|
22
|
+
elevated:
|
|
23
|
+
"border-transparent shadow-(--lsys-elevation-shadow-raised-box-shadow)",
|
|
24
|
+
ghost: "border-transparent bg-transparent shadow-none",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "surface",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
export const cardHeaderClassName =
|
|
34
|
+
"grid gap-(--lsys-card-gap-sm) p-(--lsys-card-padding) pb-(--lsys-card-header-padding-bottom)"
|
|
35
|
+
|
|
36
|
+
export const cardTitleClassName =
|
|
37
|
+
"text-(length:--lsys-card-title-font-size) font-(--lsys-card-title-font-weight) leading-(--lsys-card-title-font-line-height) tracking-(--lsys-card-title-font-letter-spacing) text-(--lsys-card-title-foreground)"
|
|
38
|
+
|
|
39
|
+
export const cardDescriptionClassName =
|
|
40
|
+
"text-(length:--lsys-card-description-font-size) leading-(--lsys-card-description-font-line-height) text-(--lsys-card-description-foreground)"
|
|
41
|
+
|
|
42
|
+
export const cardContentClassName =
|
|
43
|
+
"p-(--lsys-card-padding) pt-(--lsys-card-content-padding-top) text-(length:--lsys-card-content-font-size) leading-(--lsys-card-content-font-line-height)"
|
|
44
|
+
|
|
45
|
+
export const cardFooterClassName =
|
|
46
|
+
"flex items-center gap-(--lsys-card-gap-md) p-(--lsys-card-padding) pt-(--lsys-card-footer-padding-top)"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox.tsx
|
|
3
|
+
*
|
|
4
|
+
* Reference Checkbox component implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createContext, useContext } from "react"
|
|
8
|
+
import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox"
|
|
9
|
+
import type {
|
|
10
|
+
CheckboxIndicatorProps,
|
|
11
|
+
CheckboxProps,
|
|
12
|
+
CheckboxSize,
|
|
13
|
+
} from "./Checkbox.types"
|
|
14
|
+
import {
|
|
15
|
+
checkboxIndicatorVariants,
|
|
16
|
+
checkboxVariants,
|
|
17
|
+
} from "./Checkbox.variants"
|
|
18
|
+
import { mergeClassName } from "@/lib/utils"
|
|
19
|
+
|
|
20
|
+
interface CheckboxContextValue {
|
|
21
|
+
size: CheckboxSize
|
|
22
|
+
indeterminate?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CheckboxContext = createContext<CheckboxContextValue>({ size: "md" })
|
|
26
|
+
|
|
27
|
+
const useCheckboxContext = () => useContext(CheckboxContext)
|
|
28
|
+
|
|
29
|
+
const Checkbox = ({
|
|
30
|
+
ref,
|
|
31
|
+
size = "md",
|
|
32
|
+
className,
|
|
33
|
+
children,
|
|
34
|
+
indeterminate,
|
|
35
|
+
...props
|
|
36
|
+
}: CheckboxProps) => {
|
|
37
|
+
return (
|
|
38
|
+
<CheckboxContext.Provider value={{ size, indeterminate }}>
|
|
39
|
+
<BaseCheckbox.Root
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={mergeClassName(checkboxVariants({ size }), className)}
|
|
42
|
+
indeterminate={indeterminate}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</BaseCheckbox.Root>
|
|
47
|
+
</CheckboxContext.Provider>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Checkbox.displayName = "Checkbox"
|
|
52
|
+
|
|
53
|
+
const CheckboxIndicator = ({
|
|
54
|
+
className,
|
|
55
|
+
children,
|
|
56
|
+
...props
|
|
57
|
+
}: CheckboxIndicatorProps) => {
|
|
58
|
+
const { indeterminate } = useCheckboxContext()
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<BaseCheckbox.Indicator
|
|
62
|
+
className={mergeClassName(checkboxIndicatorVariants(), className)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
{children ?? (indeterminate ? "-" : "✓")}
|
|
66
|
+
</BaseCheckbox.Indicator>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
CheckboxIndicator.displayName = "CheckboxIndicator"
|
|
71
|
+
|
|
72
|
+
export { Checkbox, CheckboxIndicator }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Checkbox.types.ts
|
|
4
|
+
*
|
|
5
|
+
* Public and internal types for Checkbox component.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox"
|
|
9
|
+
|
|
10
|
+
export type CheckboxSize = "sm" | "md" | "lg"
|
|
11
|
+
|
|
12
|
+
export interface CheckboxProps extends Omit<
|
|
13
|
+
BaseCheckbox.Root.Props,
|
|
14
|
+
"className" | "children"
|
|
15
|
+
> {
|
|
16
|
+
ref?: Ref<HTMLElement>
|
|
17
|
+
size?: CheckboxSize
|
|
18
|
+
className?: BaseCheckbox.Root.Props["className"]
|
|
19
|
+
children?: BaseCheckbox.Root.Props["children"]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CheckboxIndicatorProps extends Omit<
|
|
23
|
+
BaseCheckbox.Indicator.Props,
|
|
24
|
+
"className" | "children"
|
|
25
|
+
> {
|
|
26
|
+
className?: BaseCheckbox.Indicator.Props["className"]
|
|
27
|
+
children?: BaseCheckbox.Indicator.Props["children"]
|
|
28
|
+
}
|