@leitware/composables 2.0.0 → 3.1.0
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/README.md +16 -0
- package/dist/presets/brutalist.css +16 -17
- package/dist/presets/default.css +11 -13
- package/dist/presets/editorial-grid.css +12 -13
- package/dist/presets/kumo.css +14 -20
- package/dist/presets/signal-pop.css +14 -26
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +20 -0
- package/package.json +13 -12
- package/rules/composables.md +24 -21
- package/skills/use-composables/references/public-api.md +2 -2
- package/skills/use-composables/references/semantic-utilities.md +5 -0
- package/src/_internal/accordion.tsx +10 -10
- package/src/_internal/ai-elements/reasoning.tsx +2 -0
- package/src/_internal/alert-dialog.tsx +3 -3
- package/src/_internal/alert.tsx +9 -7
- package/src/_internal/avatar.tsx +25 -14
- package/src/_internal/badge.tsx +2 -1
- package/src/_internal/bubble.tsx +2 -2
- package/src/_internal/button.tsx +16 -8
- package/src/_internal/calendar.tsx +3 -3
- package/src/_internal/card.tsx +53 -17
- package/src/_internal/checkbox.tsx +2 -2
- package/src/_internal/combobox.tsx +2 -2
- package/src/_internal/dialog.tsx +29 -9
- package/src/_internal/divider.tsx +14 -16
- package/src/_internal/dropdown-menu.tsx +4 -4
- package/src/_internal/empty.tsx +6 -3
- package/src/_internal/field.tsx +11 -7
- package/src/_internal/hover-card.tsx +1 -1
- package/src/_internal/input-group.tsx +17 -12
- package/src/_internal/input.tsx +33 -4
- package/src/_internal/item.tsx +2 -2
- package/src/_internal/label.tsx +1 -1
- package/src/_internal/message.tsx +1 -1
- package/src/_internal/native-select.tsx +1 -1
- package/src/_internal/popover.tsx +9 -3
- package/src/_internal/progress.tsx +37 -7
- package/src/_internal/radio-group.tsx +39 -4
- package/src/_internal/select.tsx +2 -2
- package/src/_internal/separator.tsx +1 -1
- package/src/_internal/sheet.tsx +9 -3
- package/src/_internal/sidebar.tsx +0 -35
- package/src/_internal/skeleton.tsx +26 -3
- package/src/_internal/slider.tsx +9 -7
- package/src/_internal/sonner.tsx +4 -4
- package/src/_internal/spinner.tsx +43 -3
- package/src/_internal/switch.tsx +2 -2
- package/src/_internal/table.tsx +20 -5
- package/src/_internal/tabs.tsx +4 -1
- package/src/_internal/textarea.tsx +1 -1
- package/src/_internal/toggle.tsx +1 -1
- package/src/_internal/tooltip.tsx +53 -8
- package/src/_internal/typography.tsx +4 -2
- package/src/index.ts +25 -1
- package/src/lib/utils.ts +2 -2
- package/src/opinionated/alert.tsx +8 -10
- package/src/opinionated/avatar.tsx +2 -2
- package/src/opinionated/button.tsx +13 -3
- package/src/opinionated/command.tsx +23 -0
- package/src/opinionated/data-grid.tsx +125 -0
- package/src/opinionated/dialog.tsx +10 -1
- package/src/opinionated/form-calendar-popover.tsx +5 -10
- package/src/opinionated/form-checkbox.tsx +2 -2
- package/src/opinionated/form-date-of-birth.tsx +12 -8
- package/src/opinionated/form-input-group.tsx +1 -1
- package/src/opinionated/form-radiogroup.tsx +24 -7
- package/src/opinionated/form-switch.tsx +7 -6
- package/src/opinionated/progress.tsx +7 -2
- package/src/opinionated/select.tsx +4 -1
- package/src/opinionated/sidebar.tsx +0 -1
- package/src/opinionated/skeleton.tsx +3 -13
- package/src/opinionated/spinner.tsx +2 -0
- package/src/opinionated/token-config-panel/spacing-editor.tsx +21 -3
- package/src/opinionated/tooltip.tsx +20 -2
- package/src/styles/presets/brutalist.css +16 -17
- package/src/styles/presets/default.css +11 -13
- package/src/styles/presets/editorial-grid.css +12 -13
- package/src/styles/presets/kumo.css +14 -20
- package/src/styles/presets/signal-pop.css +14 -26
- package/src/styles/presets-data/brutalist.ts +16 -19
- package/src/styles/presets-data/default.ts +11 -15
- package/src/styles/presets-data/editorial-grid.ts +12 -6
- package/src/styles/presets-data/kumo.ts +12 -6
- package/src/styles/presets-data/signal-pop.ts +14 -30
- package/src/styles/tokens/components.css +64 -20
- package/src/styles/tokens/registry.ts +33 -0
- package/src/styles/tokens/semantic-utilities.css +20 -0
- package/src/styles/tokens/semantic.css +10 -0
- package/src/styles/tokens/tailwind-color-adapter.css +3 -0
- package/src/styles/tokens/tailwind-public-utilities.css +20 -0
|
@@ -13,7 +13,7 @@ function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
13
13
|
className={cn(
|
|
14
14
|
GROUP_FOCUS_RING,
|
|
15
15
|
HOVER_RING,
|
|
16
|
-
'
|
|
16
|
+
'data-[disabled=true]:opacity-disabled border-field bg-surface-input h-(--control-size-md) rounded-(--input-radius) border overflow-hidden bg-clip-padding has-data-[align=block-end]:rounded-(--input-radius) has-data-[align=block-start]:rounded-(--input-radius) has-[textarea]:rounded-(--input-radius) has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-2 has-[>[data-align=inline-start]]:[&>input]:pl-2 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-(--control-min-width) items-center outline-none has-[>textarea]:h-auto',
|
|
17
17
|
className,
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
|
@@ -22,12 +22,14 @@ function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const inputGroupAddonVariants = cva(
|
|
25
|
-
"text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-
|
|
25
|
+
"text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-(length:--control-font-size) leading-relaxed font-medium **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-2xs [&>svg:not([class*='size-'])]:size-[1.5em] flex cursor-text items-center justify-center select-none",
|
|
26
26
|
{
|
|
27
27
|
variants: {
|
|
28
28
|
align: {
|
|
29
|
-
'inline-start':
|
|
30
|
-
|
|
29
|
+
'inline-start':
|
|
30
|
+
'pl-3 has-[>button]:pl-(--input-group-inset) has-[>kbd]:pl-(--input-group-inset) order-first',
|
|
31
|
+
'inline-end':
|
|
32
|
+
'pr-3 has-[>button]:pr-(--input-group-inset) has-[>kbd]:pr-(--input-group-inset) order-last',
|
|
31
33
|
'block-start':
|
|
32
34
|
'px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start',
|
|
33
35
|
'block-end':
|
|
@@ -63,14 +65,17 @@ function InputGroupAddon({
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
const inputGroupButtonVariants = cva(
|
|
66
|
-
|
|
68
|
+
// Sized by --input-group-button-size so buttons always sit inside the group,
|
|
69
|
+
// never at full control size or the standalone button's min-width.
|
|
70
|
+
'min-w-0 gap-1 rounded-md text-xs/relaxed shadow-none hover:border-transparent hover:ring-0 focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:bg-(--bg-surface-hover) flex items-center',
|
|
67
71
|
{
|
|
68
72
|
variants: {
|
|
69
73
|
size: {
|
|
70
|
-
xs: "h-
|
|
71
|
-
sm: '',
|
|
72
|
-
'icon-xs':
|
|
73
|
-
|
|
74
|
+
xs: "h-(--input-group-button-size) px-(--input-group-inset) [&>svg:not([class*='size-'])]:size-[1.25em]",
|
|
75
|
+
sm: "h-(--input-group-button-size) px-3 [&>svg:not([class*='size-'])]:size-[1.25em]",
|
|
76
|
+
'icon-xs':
|
|
77
|
+
'size-[calc(var(--input-group-button-size)_-_var(--spacing))] p-0 has-[>svg]:p-0',
|
|
78
|
+
'icon-sm': 'size-(--input-group-button-size) p-0 has-[>svg]:p-0',
|
|
74
79
|
},
|
|
75
80
|
},
|
|
76
81
|
defaultVariants: {
|
|
@@ -104,7 +109,7 @@ function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
|
|
104
109
|
return (
|
|
105
110
|
<span
|
|
106
111
|
className={cn(
|
|
107
|
-
"text-muted-foreground gap-2 text-
|
|
112
|
+
"text-muted-foreground gap-2 text-(length:--control-font-size) leading-relaxed [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
108
113
|
className,
|
|
109
114
|
)}
|
|
110
115
|
{...props}
|
|
@@ -117,7 +122,7 @@ function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>)
|
|
|
117
122
|
<Input
|
|
118
123
|
data-slot="input-group-control"
|
|
119
124
|
className={cn(
|
|
120
|
-
'rounded-none border-0 bg-transparent shadow-none ring-0 hover:border-transparent hover:ring-0 focus-visible:border-transparent focus-visible:ring-0 aria-invalid:border-transparent aria-invalid:ring-0 dark:bg-transparent flex-1',
|
|
125
|
+
'min-w-0 disabled:opacity-100 rounded-none border-0 bg-transparent shadow-none ring-0 hover:border-transparent hover:ring-0 focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-offset-0 aria-invalid:border-transparent aria-invalid:ring-0 dark:bg-transparent flex-1',
|
|
121
126
|
className,
|
|
122
127
|
)}
|
|
123
128
|
{...props}
|
|
@@ -130,7 +135,7 @@ function InputGroupTextarea({ className, ...props }: React.ComponentProps<'texta
|
|
|
130
135
|
<Textarea
|
|
131
136
|
data-slot="input-group-control"
|
|
132
137
|
className={cn(
|
|
133
|
-
'rounded-none border-0 bg-transparent py-2 shadow-none ring-0 hover:border-transparent hover:ring-0 focus-visible:border-transparent focus-visible:ring-0 aria-invalid:border-transparent aria-invalid:ring-0 dark:bg-transparent flex-1 resize-none',
|
|
138
|
+
'rounded-none border-0 bg-transparent py-2 shadow-none ring-0 hover:border-transparent hover:ring-0 focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-offset-0 aria-invalid:border-transparent aria-invalid:ring-0 dark:bg-transparent flex-1 resize-none',
|
|
134
139
|
className,
|
|
135
140
|
)}
|
|
136
141
|
{...props}
|
package/src/_internal/input.tsx
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { Input as InputPrimitive } from '@base-ui/react/input'
|
|
2
|
+
import { cva } from 'class-variance-authority'
|
|
2
3
|
import type * as React from 'react'
|
|
3
4
|
|
|
4
5
|
import { cn, FOCUS_RING, HOVER_RING } from '../lib/utils'
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* The field surface shared by every text-like control: border, fill, radius,
|
|
9
|
+
* height, text size and focus/hover rings. Use it for anything that should
|
|
10
|
+
* read as a field, e.g. a button that opens a picker.
|
|
11
|
+
*/
|
|
12
|
+
const fieldControlVariants = cva(
|
|
13
|
+
cn(
|
|
14
|
+
FOCUS_RING,
|
|
15
|
+
HOVER_RING,
|
|
16
|
+
'bg-surface-input border-field h-(--control-size-md) rounded-(--input-radius) border text-(length:--control-font-size) max-md:text-[length:max(var(--control-font-size),var(--text-sm))] leading-relaxed w-full min-w-(--control-min-width) outline-none disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
17
|
+
),
|
|
18
|
+
)
|
|
19
|
+
|
|
6
20
|
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
7
21
|
return (
|
|
8
22
|
<InputPrimitive
|
|
9
23
|
type={type}
|
|
10
24
|
data-slot="input"
|
|
11
25
|
className={cn(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'bg-surface-field/20 dark:bg-surface-field/30 border-field h-(--input-height) rounded-(--input-radius) border px-2 py-0.5 text-sm file:h-6 file:text-xs/relaxed file:font-medium md:text-xs/relaxed file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
26
|
+
fieldControlVariants(),
|
|
27
|
+
'px-2 py-0.5 file:h-6 file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none',
|
|
15
28
|
className,
|
|
16
29
|
)}
|
|
17
30
|
{...props}
|
|
@@ -22,4 +35,20 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
|
22
35
|
)
|
|
23
36
|
}
|
|
24
37
|
|
|
25
|
-
|
|
38
|
+
/** A button styled as a field, for controls that open a picker (dates, menus). */
|
|
39
|
+
function FieldTrigger({ className, type = 'button', ...props }: React.ComponentProps<'button'>) {
|
|
40
|
+
return (
|
|
41
|
+
<button
|
|
42
|
+
type={type}
|
|
43
|
+
data-slot="field-trigger"
|
|
44
|
+
className={cn(
|
|
45
|
+
fieldControlVariants(),
|
|
46
|
+
'flex cursor-pointer items-center justify-between gap-2 px-3 text-left data-[placeholder]:text-muted-foreground',
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { FieldTrigger, Input, fieldControlVariants }
|
package/src/_internal/item.tsx
CHANGED
|
@@ -126,7 +126,7 @@ function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
126
126
|
<div
|
|
127
127
|
data-slot="item-title"
|
|
128
128
|
className={cn(
|
|
129
|
-
'gap-2 text-
|
|
129
|
+
'gap-2 text-(length:--body-font-size) leading-snug font-medium underline-offset-4 line-clamp-1 flex w-fit items-center',
|
|
130
130
|
className,
|
|
131
131
|
)}
|
|
132
132
|
{...props}
|
|
@@ -139,7 +139,7 @@ function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
|
139
139
|
<p
|
|
140
140
|
data-slot="item-description"
|
|
141
141
|
className={cn(
|
|
142
|
-
'text-muted-foreground text-left text-
|
|
142
|
+
'text-muted-foreground text-left text-(length:--body-font-size) leading-relaxed [&>a:hover]:text-primary line-clamp-2 font-normal [&>a]:underline [&>a]:underline-offset-4',
|
|
143
143
|
className,
|
|
144
144
|
)}
|
|
145
145
|
{...props}
|
package/src/_internal/label.tsx
CHANGED
|
@@ -7,7 +7,7 @@ function Label({ className, ...props }: React.ComponentProps<'label'>) {
|
|
|
7
7
|
<label
|
|
8
8
|
data-slot="label"
|
|
9
9
|
className={cn(
|
|
10
|
-
'gap-2 text-
|
|
10
|
+
'gap-2 text-(length:--label-font-size) text-(color:--label-color) [text-transform:var(--label-text-transform)] group-data-[invalid=true]/field:text-critical group-data-[orientation=horizontal]/field:text-(length:--body-font-size) group-data-[orientation=horizontal]/field:text-foreground group-data-[orientation=horizontal]/field:normal-case leading-none font-medium group-data-[disabled=true]:opacity-disabled peer-disabled:opacity-disabled flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed',
|
|
11
11
|
className,
|
|
12
12
|
)}
|
|
13
13
|
{...props}
|
|
@@ -22,7 +22,7 @@ function Message({
|
|
|
22
22
|
data-slot="message"
|
|
23
23
|
data-align={align}
|
|
24
24
|
className={cn(
|
|
25
|
-
'group/message relative flex w-full min-w-0 gap-2 text-
|
|
25
|
+
'group/message relative flex w-full min-w-0 gap-2 text-(length:--body-font-size) leading-relaxed data-[align=end]:flex-row-reverse',
|
|
26
26
|
className,
|
|
27
27
|
)}
|
|
28
28
|
{...props}
|
|
@@ -27,7 +27,7 @@ function NativeSelect({
|
|
|
27
27
|
className={cn(
|
|
28
28
|
FOCUS_RING,
|
|
29
29
|
HOVER_RING,
|
|
30
|
-
'border-field bg-
|
|
30
|
+
'border-field bg-surface-input h-(--control-size-md) w-full min-w-(--control-min-width) appearance-none rounded-(--input-radius) border px-3 py-0 pr-9 text-(length:--control-font-size) leading-relaxed shadow-xs outline-none motion-colors disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-(--control-size-sm)',
|
|
31
31
|
className,
|
|
32
32
|
)}
|
|
33
33
|
{...props}
|
|
@@ -40,7 +40,7 @@ function PopoverContent({
|
|
|
40
40
|
<PopoverPrimitive.Popup
|
|
41
41
|
data-slot="popover-content"
|
|
42
42
|
className={cn(
|
|
43
|
-
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-4 rounded-lg p-2.5 text-
|
|
43
|
+
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-4 rounded-lg p-2.5 text-(length:--body-font-size) leading-(--body-line-height) shadow-md ring-[length:var(--border-width)] duration-fast z-popover w-72 origin-(--transform-origin) outline-hidden',
|
|
44
44
|
className,
|
|
45
45
|
)}
|
|
46
46
|
{...props}
|
|
@@ -54,7 +54,10 @@ function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
54
54
|
return (
|
|
55
55
|
<div
|
|
56
56
|
data-slot="popover-header"
|
|
57
|
-
className={cn(
|
|
57
|
+
className={cn(
|
|
58
|
+
'flex flex-col gap-1 text-(length:--body-font-size) leading-(--body-line-height)',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
58
61
|
{...props}
|
|
59
62
|
/>
|
|
60
63
|
)
|
|
@@ -64,7 +67,10 @@ function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
|
|
|
64
67
|
return (
|
|
65
68
|
<PopoverPrimitive.Title
|
|
66
69
|
data-slot="popover-title"
|
|
67
|
-
className={cn(
|
|
70
|
+
className={cn(
|
|
71
|
+
'text-(length:--title-font-size) leading-(--title-line-height) font-medium',
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
68
74
|
{...props}
|
|
69
75
|
/>
|
|
70
76
|
)
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { Progress as ProgressPrimitive } from '@base-ui/react/progress'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
3
|
|
|
3
4
|
import { cn } from '../lib/utils'
|
|
4
5
|
|
|
6
|
+
const progressIndicatorVariants = cva(
|
|
7
|
+
'h-full rounded-full transition-[width] duration-normal ease-out',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-primary',
|
|
12
|
+
success: 'bg-fill-success',
|
|
13
|
+
warning: 'bg-fill-warning',
|
|
14
|
+
destructive: 'bg-fill-critical',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: 'default',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
)
|
|
22
|
+
|
|
5
23
|
function Progress({ className, value, ...props }: ProgressPrimitive.Root.Props) {
|
|
6
24
|
return (
|
|
7
25
|
<ProgressPrimitive.Root
|
|
@@ -17,20 +35,25 @@ function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
|
|
|
17
35
|
return (
|
|
18
36
|
<ProgressPrimitive.Track
|
|
19
37
|
data-slot="progress-track"
|
|
20
|
-
className={cn(
|
|
38
|
+
className={cn(
|
|
39
|
+
'relative h-2 w-full overflow-hidden rounded-full bg-muted has-data-[variant=success]:bg-surface-success has-data-[variant=warning]:bg-surface-warning has-data-[variant=destructive]:bg-surface-critical',
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
21
42
|
{...props}
|
|
22
43
|
/>
|
|
23
44
|
)
|
|
24
45
|
}
|
|
25
46
|
|
|
26
|
-
function ProgressIndicator({
|
|
47
|
+
function ProgressIndicator({
|
|
48
|
+
className,
|
|
49
|
+
variant,
|
|
50
|
+
...props
|
|
51
|
+
}: ProgressPrimitive.Indicator.Props & VariantProps<typeof progressIndicatorVariants>) {
|
|
27
52
|
return (
|
|
28
53
|
<ProgressPrimitive.Indicator
|
|
29
54
|
data-slot="progress-indicator"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
className,
|
|
33
|
-
)}
|
|
55
|
+
data-variant={variant ?? 'default'}
|
|
56
|
+
className={cn(progressIndicatorVariants({ variant, className }))}
|
|
34
57
|
{...props}
|
|
35
58
|
/>
|
|
36
59
|
)
|
|
@@ -56,4 +79,11 @@ function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
|
|
|
56
79
|
)
|
|
57
80
|
}
|
|
58
81
|
|
|
59
|
-
export {
|
|
82
|
+
export {
|
|
83
|
+
Progress,
|
|
84
|
+
ProgressTrack,
|
|
85
|
+
ProgressIndicator,
|
|
86
|
+
progressIndicatorVariants,
|
|
87
|
+
ProgressLabel,
|
|
88
|
+
ProgressValue,
|
|
89
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Radio as RadioPrimitive } from '@base-ui/react/radio'
|
|
2
2
|
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import type * as React from 'react'
|
|
5
|
+
|
|
6
|
+
import { Label } from './label'
|
|
3
7
|
import { cn, FOCUS_RING, HOVER_RING } from '../lib/utils'
|
|
4
8
|
|
|
5
9
|
function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {
|
|
@@ -19,19 +23,50 @@ function RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {
|
|
|
19
23
|
className={cn(
|
|
20
24
|
FOCUS_RING,
|
|
21
25
|
HOVER_RING,
|
|
22
|
-
'border-
|
|
26
|
+
'border-(color:--choice-border-color) not-data-checked:hover:bg-(--bg-surface-hover) dark:bg-surface-field/30 data-checked:bg-selected data-checked:text-selected-foreground dark:data-checked:bg-selected data-checked:border-selected flex size-(--choice-size) rounded-full transition-shadow group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
23
27
|
className,
|
|
24
28
|
)}
|
|
25
29
|
{...props}
|
|
26
30
|
>
|
|
27
31
|
<RadioPrimitive.Indicator
|
|
28
32
|
data-slot="radio-group-indicator"
|
|
29
|
-
className="flex size-
|
|
33
|
+
className="flex size-full items-center justify-center"
|
|
30
34
|
>
|
|
31
|
-
<div className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-
|
|
35
|
+
<div className="absolute top-1/2 left-1/2 size-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-current group-aria-invalid/radio-group-item:bg-fill-critical" />
|
|
32
36
|
</RadioPrimitive.Indicator>
|
|
33
37
|
</RadioPrimitive.Root>
|
|
34
38
|
)
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
const radioGroupOptionVariants = cva(
|
|
42
|
+
'flex cursor-pointer items-center gap-2 text-(length:--body-font-size) text-foreground normal-case font-normal leading-snug',
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
default: '',
|
|
47
|
+
// Selectable tile: the whole card is the hit area and the checked
|
|
48
|
+
// tile takes the selected colour as its border.
|
|
49
|
+
card: 'bg-accent hover:bg-secondary rounded-(--input-radius) border border-transparent p-3 has-data-checked:border-selected has-disabled:cursor-not-allowed has-disabled:opacity-disabled motion-colors',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: { variant: 'default' },
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
/** A clickable row (or card) wrapping one RadioGroupItem and its label. */
|
|
57
|
+
function RadioGroupOption({
|
|
58
|
+
className,
|
|
59
|
+
variant = 'default',
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof Label> & VariantProps<typeof radioGroupOptionVariants>) {
|
|
62
|
+
return (
|
|
63
|
+
<Label
|
|
64
|
+
data-slot="radio-group-option"
|
|
65
|
+
data-variant={variant}
|
|
66
|
+
className={cn(radioGroupOptionVariants({ variant }), className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { RadioGroup, RadioGroupItem, RadioGroupOption, radioGroupOptionVariants }
|
package/src/_internal/select.tsx
CHANGED
|
@@ -40,7 +40,7 @@ function SelectTrigger({
|
|
|
40
40
|
className={cn(
|
|
41
41
|
FOCUS_RING,
|
|
42
42
|
HOVER_RING,
|
|
43
|
-
"border-field data-[placeholder]:text-muted-foreground bg-surface-
|
|
43
|
+
"border-field data-[placeholder]:text-muted-foreground bg-surface-input gap-1.5 rounded-(--input-radius) border px-2 py-1.5 text-(length:--control-font-size) leading-relaxed data-[size=default]:h-(--control-size-md) data-[size=sm]:h-(--control-size-sm) *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit min-w-(--control-min-width) items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-disabled *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
44
44
|
className,
|
|
45
45
|
)}
|
|
46
46
|
{...props}
|
|
@@ -109,7 +109,7 @@ function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Prop
|
|
|
109
109
|
<SelectPrimitive.Item
|
|
110
110
|
data-slot="select-item"
|
|
111
111
|
className={cn(
|
|
112
|
-
"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-
|
|
112
|
+
"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-(length:--control-font-size) leading-relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
113
113
|
className,
|
|
114
114
|
)}
|
|
115
115
|
{...props}
|
|
@@ -8,7 +8,7 @@ function Separator({ className, orientation = 'horizontal', ...props }: Separato
|
|
|
8
8
|
data-slot="separator"
|
|
9
9
|
orientation={orientation}
|
|
10
10
|
className={cn(
|
|
11
|
-
'bg-stroke shrink-0 data-[orientation=horizontal]:h-
|
|
11
|
+
'bg-stroke shrink-0 data-[orientation=horizontal]:h-(--rule-width) data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-(--rule-width) data-[orientation=vertical]:self-stretch',
|
|
12
12
|
className,
|
|
13
13
|
)}
|
|
14
14
|
{...props}
|
package/src/_internal/sheet.tsx
CHANGED
|
@@ -50,7 +50,7 @@ function SheetContent({
|
|
|
50
50
|
data-slot="sheet-content"
|
|
51
51
|
data-side={side}
|
|
52
52
|
className={cn(
|
|
53
|
-
'bg-page data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-modal flex flex-col bg-clip-padding text-
|
|
53
|
+
'bg-page data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-modal flex flex-col bg-clip-padding text-(length:--body-font-size) leading-relaxed shadow-lg transition-[opacity,transform,box-shadow] duration-normal ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm',
|
|
54
54
|
className,
|
|
55
55
|
)}
|
|
56
56
|
{...props}
|
|
@@ -94,7 +94,10 @@ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
|
|
|
94
94
|
return (
|
|
95
95
|
<SheetPrimitive.Title
|
|
96
96
|
data-slot="sheet-title"
|
|
97
|
-
className={cn(
|
|
97
|
+
className={cn(
|
|
98
|
+
'text-foreground text-(length:--heading-font-size) leading-(--heading-line-height) font-medium',
|
|
99
|
+
className,
|
|
100
|
+
)}
|
|
98
101
|
{...props}
|
|
99
102
|
/>
|
|
100
103
|
)
|
|
@@ -104,7 +107,10 @@ function SheetDescription({ className, ...props }: SheetPrimitive.Description.Pr
|
|
|
104
107
|
return (
|
|
105
108
|
<SheetPrimitive.Description
|
|
106
109
|
data-slot="sheet-description"
|
|
107
|
-
className={cn(
|
|
110
|
+
className={cn(
|
|
111
|
+
'text-muted-foreground text-(length:--body-font-size) leading-relaxed',
|
|
112
|
+
className,
|
|
113
|
+
)}
|
|
108
114
|
{...props}
|
|
109
115
|
/>
|
|
110
116
|
)
|
|
@@ -9,7 +9,6 @@ import { Button } from './button'
|
|
|
9
9
|
import { Input } from './input'
|
|
10
10
|
import { Separator } from './separator'
|
|
11
11
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from './sheet'
|
|
12
|
-
import { Skeleton } from './skeleton'
|
|
13
12
|
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'
|
|
14
13
|
import { useIsMobile } from '../hooks/use-mobile'
|
|
15
14
|
import { cn, FOCUS_RING } from '../lib/utils'
|
|
@@ -569,39 +568,6 @@ function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>)
|
|
|
569
568
|
)
|
|
570
569
|
}
|
|
571
570
|
|
|
572
|
-
function SidebarMenuSkeleton({
|
|
573
|
-
className,
|
|
574
|
-
showIcon = false,
|
|
575
|
-
...props
|
|
576
|
-
}: React.ComponentProps<'div'> & {
|
|
577
|
-
showIcon?: boolean
|
|
578
|
-
}) {
|
|
579
|
-
// Random width between 50 to 90%.
|
|
580
|
-
const [width] = React.useState(() => {
|
|
581
|
-
return `${Math.floor(Math.random() * 40) + 50}%`
|
|
582
|
-
})
|
|
583
|
-
|
|
584
|
-
return (
|
|
585
|
-
<div
|
|
586
|
-
data-slot="sidebar-menu-skeleton"
|
|
587
|
-
data-sidebar="menu-skeleton"
|
|
588
|
-
className={cn('h-8 gap-2 rounded-md px-2 flex items-center', className)}
|
|
589
|
-
{...props}
|
|
590
|
-
>
|
|
591
|
-
{showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
|
|
592
|
-
<Skeleton
|
|
593
|
-
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
594
|
-
data-sidebar="menu-skeleton-text"
|
|
595
|
-
style={
|
|
596
|
-
{
|
|
597
|
-
'--skeleton-width': width,
|
|
598
|
-
} as React.CSSProperties
|
|
599
|
-
}
|
|
600
|
-
/>
|
|
601
|
-
</div>
|
|
602
|
-
)
|
|
603
|
-
}
|
|
604
|
-
|
|
605
571
|
function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
606
572
|
return (
|
|
607
573
|
<ul
|
|
@@ -675,7 +641,6 @@ export {
|
|
|
675
641
|
SidebarMenuBadge,
|
|
676
642
|
SidebarMenuButton,
|
|
677
643
|
SidebarMenuItem,
|
|
678
|
-
SidebarMenuSkeleton,
|
|
679
644
|
SidebarMenuSub,
|
|
680
645
|
SidebarMenuSubButton,
|
|
681
646
|
SidebarMenuSubItem,
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
1
3
|
import { cn } from '../lib/utils'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
const skeletonVariants = cva('bg-muted animate-pulse', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
rectangle: 'rounded-md',
|
|
9
|
+
circle: 'rounded-full',
|
|
10
|
+
text: 'rounded',
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
sm: 'h-4',
|
|
14
|
+
md: 'h-6',
|
|
15
|
+
lg: 'h-8',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: { variant: 'rectangle' },
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
function Skeleton({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
size,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof skeletonVariants>) {
|
|
4
27
|
return (
|
|
5
28
|
<div
|
|
6
29
|
data-slot="skeleton"
|
|
7
|
-
className={cn(
|
|
30
|
+
className={cn(skeletonVariants({ variant, size }), className)}
|
|
8
31
|
{...props}
|
|
9
32
|
/>
|
|
10
33
|
)
|
|
11
34
|
}
|
|
12
35
|
|
|
13
|
-
export { Skeleton }
|
|
36
|
+
export { Skeleton, skeletonVariants }
|
package/src/_internal/slider.tsx
CHANGED
|
@@ -11,14 +11,16 @@ function Slider({
|
|
|
11
11
|
max = 100,
|
|
12
12
|
...props
|
|
13
13
|
}: SliderPrimitive.Root.Props) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// One thumb per value; a single number (or no value) is a single thumb.
|
|
15
|
+
const _values = React.useMemo(() => {
|
|
16
|
+
const current = value ?? defaultValue
|
|
17
|
+
if (Array.isArray(current)) return current
|
|
18
|
+
return typeof current === 'number' ? [current] : [min, max]
|
|
19
|
+
}, [value, defaultValue, min, max])
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<SliderPrimitive.Root
|
|
21
|
-
className="data-horizontal:w-full data-vertical:h-full"
|
|
23
|
+
className="data-horizontal:w-full data-horizontal:min-w-(--control-min-width) data-vertical:h-full"
|
|
22
24
|
data-slot="slider"
|
|
23
25
|
defaultValue={defaultValue}
|
|
24
26
|
value={value}
|
|
@@ -35,7 +37,7 @@ function Slider({
|
|
|
35
37
|
>
|
|
36
38
|
<SliderPrimitive.Track
|
|
37
39
|
data-slot="slider-track"
|
|
38
|
-
className="bg-muted rounded-full data-horizontal:h-
|
|
40
|
+
className="bg-muted rounded-full data-horizontal:h-(--slider-size) data-horizontal:w-full data-vertical:h-full data-vertical:w-(--slider-size) relative overflow-hidden select-none"
|
|
39
41
|
>
|
|
40
42
|
<SliderPrimitive.Indicator
|
|
41
43
|
data-slot="slider-range"
|
|
@@ -47,7 +49,7 @@ function Slider({
|
|
|
47
49
|
data-slot="slider-thumb"
|
|
48
50
|
key={index}
|
|
49
51
|
className={cn(
|
|
50
|
-
'border-
|
|
52
|
+
'border-(color:--slider-thumb-border) bg-(--slider-thumb-color) size-(--slider-size) rounded-full border hover:ring-4 hover:ring-focus/30 active:ring-4 active:ring-focus/50 block shrink-0 select-none disabled:pointer-events-none disabled:opacity-disabled',
|
|
51
53
|
'has-[:focus-visible]:border-[var(--focus-ring-color)] has-[:focus-visible]:ring-[color:var(--focus-ring-color)]/30 has-[:focus-visible]:ring-[length:var(--focus-ring-width)]',
|
|
52
54
|
)}
|
|
53
55
|
/>
|
package/src/_internal/sonner.tsx
CHANGED
|
@@ -25,15 +25,15 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
25
25
|
unstyled: true,
|
|
26
26
|
classNames: {
|
|
27
27
|
toast:
|
|
28
|
-
'flex items-center gap-2 rounded-lg border bg-popover p-3 text-
|
|
29
|
-
title: 'text-
|
|
28
|
+
'flex items-center gap-2 rounded-lg border bg-popover p-3 text-(length:--body-font-size) leading-(--body-line-height) font-medium text-popover-foreground shadow-md w-[var(--width)]',
|
|
29
|
+
title: 'text-(length:--body-font-size) font-medium leading-relaxed',
|
|
30
30
|
description: 'text-2xs font-normal leading-relaxed text-muted-foreground',
|
|
31
31
|
content: 'flex flex-col gap-0.5',
|
|
32
32
|
icon: 'flex size-4 shrink-0 items-center justify-center',
|
|
33
33
|
actionButton:
|
|
34
|
-
'ml-auto h-6 shrink-0 cursor-pointer rounded-md bg-primary px-2.5 text-
|
|
34
|
+
'ml-auto h-6 shrink-0 cursor-pointer rounded-md bg-primary px-2.5 text-(length:--body-font-size) leading-(--body-line-height) font-medium text-primary-foreground',
|
|
35
35
|
cancelButton:
|
|
36
|
-
'ml-auto h-6 shrink-0 cursor-pointer rounded-md bg-muted px-2.5 text-
|
|
36
|
+
'ml-auto h-6 shrink-0 cursor-pointer rounded-md bg-muted px-2.5 text-(length:--body-font-size) leading-(--body-line-height) font-medium text-muted-foreground',
|
|
37
37
|
success:
|
|
38
38
|
'bg-surface-success border-stroke-success text-success [&_[data-icon]>svg]:text-icon-success [&_[data-title]]:text-success [&_[data-description]]:text-success/90',
|
|
39
39
|
error:
|
|
@@ -1,16 +1,56 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
1
2
|
import { Loader2Icon } from 'lucide-react'
|
|
2
3
|
|
|
3
4
|
import { cn } from '../lib/utils'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const spinnerVariants = cva('shrink-0', {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'size-4 animate-spin',
|
|
10
|
+
// Three bouncing dots in currentColor.
|
|
11
|
+
dots: 'h-4 w-auto text-primary',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { variant: 'default' },
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
function Spinner({
|
|
18
|
+
className,
|
|
19
|
+
variant = 'default',
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<'svg'> & VariantProps<typeof spinnerVariants>) {
|
|
22
|
+
if (variant === 'dots') {
|
|
23
|
+
return (
|
|
24
|
+
<svg
|
|
25
|
+
role="status"
|
|
26
|
+
aria-label="Loading"
|
|
27
|
+
viewBox="0 0 60 32"
|
|
28
|
+
fill="currentColor"
|
|
29
|
+
className={cn(spinnerVariants({ variant }), className)}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{[8, 30, 52].map((cx, index) => (
|
|
33
|
+
<circle
|
|
34
|
+
key={cx}
|
|
35
|
+
cx={cx}
|
|
36
|
+
cy={20}
|
|
37
|
+
r={7}
|
|
38
|
+
className="motion-safe:animate-bounce [transform-box:fill-box]"
|
|
39
|
+
style={{ animationDelay: `${index * 150}ms` }}
|
|
40
|
+
/>
|
|
41
|
+
))}
|
|
42
|
+
</svg>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
6
46
|
return (
|
|
7
47
|
<Loader2Icon
|
|
8
48
|
role="status"
|
|
9
49
|
aria-label="Loading"
|
|
10
|
-
className={cn(
|
|
50
|
+
className={cn(spinnerVariants({ variant }), className)}
|
|
11
51
|
{...props}
|
|
12
52
|
/>
|
|
13
53
|
)
|
|
14
54
|
}
|
|
15
55
|
|
|
16
|
-
export { Spinner }
|
|
56
|
+
export { Spinner, spinnerVariants }
|