@leitware/composables 1.7.1 → 3.0.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 -28
- 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 +7 -8
- package/rules/composables.md +17 -17
- package/skills/use-composables/references/public-api.md +2 -7
- package/skills/use-composables/references/semantic-utilities.md +5 -0
- package/src/_internal/accordion.tsx +10 -10
- 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 +2 -3
- 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/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
- package/src/opinionated/blocks/content.tsx +0 -247
- package/src/opinionated/blocks/features.tsx +0 -242
- package/src/opinionated/blocks/heroes.tsx +0 -711
- package/src/opinionated/blocks/index.ts +0 -4
- package/src/opinionated/blocks/shared.tsx +0 -185
|
@@ -22,7 +22,7 @@ function Calendar({
|
|
|
22
22
|
<DayPicker
|
|
23
23
|
showOutsideDays={showOutsideDays}
|
|
24
24
|
className={cn(
|
|
25
|
-
'p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] bg-page rounded-lg border shadow-sm group/calendar [[data-slot=card-content]_&]:bg-transparent [[data-slot=card-content]_&]:border-0 [[data-slot=card-content]_&]:shadow-none [[data-slot=popover-content]_&]:bg-transparent [[data-slot=popover-content]_&]:border-0 [[data-slot=popover-content]_&]:shadow-none
|
|
25
|
+
'p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] bg-page rounded-lg border shadow-sm group/calendar [[data-slot=card-content]_&]:bg-transparent [[data-slot=card-content]_&]:border-0 [[data-slot=card-content]_&]:shadow-none [[data-slot=popover-content]_&]:bg-transparent [[data-slot=popover-content]_&]:border-0 [[data-slot=popover-content]_&]:shadow-none',
|
|
26
26
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
27
27
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
28
28
|
className,
|
|
@@ -80,7 +80,7 @@ function Calendar({
|
|
|
80
80
|
week_number_header: cn('select-none w-(--cell-size)', defaultClassNames.week_number_header),
|
|
81
81
|
week_number: cn('text-xs select-none text-muted-foreground', defaultClassNames.week_number),
|
|
82
82
|
day: cn(
|
|
83
|
-
'relative w-full rounded-(--cell-radius) h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none',
|
|
83
|
+
'relative flex w-full items-center justify-center rounded-(--cell-radius) h-full p-0 text-center text-(length:--body-font-size) leading-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none',
|
|
84
84
|
props.showWeekNumber
|
|
85
85
|
? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'
|
|
86
86
|
: '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)',
|
|
@@ -167,7 +167,7 @@ function CalendarDayButton({
|
|
|
167
167
|
data-range-end={modifiers.range_end}
|
|
168
168
|
data-range-middle={modifiers.range_middle}
|
|
169
169
|
className={cn(
|
|
170
|
-
'data-[selected-single=true]:bg-
|
|
170
|
+
'data-[selected-single=true]:bg-selected data-[selected-single=true]:text-selected-foreground data-[selected-single=true]:hover:bg-selected/90 data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-selected data-[range-start=true]:text-selected-foreground data-[range-end=true]:bg-selected data-[range-end=true]:text-selected-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[color:var(--focus-ring-color)]/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square h-auto w-full flex-col gap-1 rounded-(--cell-radius) border-0 text-(length:--body-font-size) leading-none font-normal transition-colors group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[length:var(--focus-ring-width)] data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-[0.75em] [&>span]:opacity-70',
|
|
171
171
|
defaultClassNames.day,
|
|
172
172
|
className,
|
|
173
173
|
)}
|
package/src/_internal/card.tsx
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
1
2
|
import type * as React from 'react'
|
|
2
3
|
|
|
3
4
|
import { cn } from '../lib/utils'
|
|
4
5
|
|
|
6
|
+
// Every card gap and inset reads the card-scoped --card-space, derived from
|
|
7
|
+
// the --card-padding token: sm sits one spacing step tighter. Presets tune a
|
|
8
|
+
// single token and every size stays on the spacing scale.
|
|
9
|
+
const cardVariants = cva(
|
|
10
|
+
'border-(length:--card-border-width) border-stroke text-card-foreground gap-(--card-space) overflow-hidden rounded-(--card-radius) py-(--card-space) text-(length:--body-font-size) leading-relaxed has-[>img:first-child]:pt-0 *:[img:first-child]:rounded-t-(--card-radius) *:[img:last-child]:rounded-b-(--card-radius) group/card flex flex-col',
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
default: '[--card-space:var(--card-padding)]',
|
|
15
|
+
sm: '[--card-space:calc(var(--card-padding)_-_var(--spacing))]',
|
|
16
|
+
},
|
|
17
|
+
variant: {
|
|
18
|
+
default: 'bg-card',
|
|
19
|
+
// On the popover surface (white in light themes).
|
|
20
|
+
raised: 'bg-popover',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { size: 'default', variant: 'default' },
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
|
|
5
27
|
function Card({
|
|
6
28
|
className,
|
|
7
29
|
size = 'default',
|
|
30
|
+
variant = 'default',
|
|
8
31
|
...props
|
|
9
|
-
}: React.ComponentProps<'div'> &
|
|
32
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof cardVariants>) {
|
|
10
33
|
return (
|
|
11
34
|
<div
|
|
12
35
|
data-slot="card"
|
|
13
36
|
data-size={size}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
37
|
+
data-variant={variant}
|
|
38
|
+
className={cn(cardVariants({ size, variant }), className)}
|
|
18
39
|
{...props}
|
|
19
40
|
/>
|
|
20
41
|
)
|
|
@@ -25,7 +46,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
25
46
|
<div
|
|
26
47
|
data-slot="card-header"
|
|
27
48
|
className={cn(
|
|
28
|
-
'gap-1 rounded-t-(--card-radius) px-(--card-
|
|
49
|
+
'gap-1 rounded-t-(--card-radius) px-(--card-space) [.border-b]:pb-(--card-space) group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',
|
|
29
50
|
className,
|
|
30
51
|
)}
|
|
31
52
|
{...props}
|
|
@@ -34,14 +55,26 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
34
55
|
}
|
|
35
56
|
|
|
36
57
|
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
37
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
data-slot="card-title"
|
|
61
|
+
className={cn(
|
|
62
|
+
'text-(length:--title-font-size) leading-(--title-line-height) font-medium',
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
38
68
|
}
|
|
39
69
|
|
|
40
70
|
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
41
71
|
return (
|
|
42
72
|
<div
|
|
43
73
|
data-slot="card-description"
|
|
44
|
-
className={cn(
|
|
74
|
+
className={cn(
|
|
75
|
+
'text-muted-foreground text-(length:--body-font-size) leading-relaxed',
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
45
78
|
{...props}
|
|
46
79
|
/>
|
|
47
80
|
)
|
|
@@ -58,13 +91,7 @@ function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
58
91
|
}
|
|
59
92
|
|
|
60
93
|
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
data-slot="card-content"
|
|
64
|
-
className={cn('px-(--card-padding) group-data-[size=sm]/card:px-3', className)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
)
|
|
94
|
+
return <div data-slot="card-content" className={cn('px-(--card-space)', className)} {...props} />
|
|
68
95
|
}
|
|
69
96
|
|
|
70
97
|
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
@@ -72,7 +99,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
72
99
|
<div
|
|
73
100
|
data-slot="card-footer"
|
|
74
101
|
className={cn(
|
|
75
|
-
'rounded-b-(--card-radius) px-(--card-
|
|
102
|
+
'rounded-b-(--card-radius) px-(--card-space) [.border-t]:pt-(--card-space) flex items-center',
|
|
76
103
|
className,
|
|
77
104
|
)}
|
|
78
105
|
{...props}
|
|
@@ -80,4 +107,13 @@ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
80
107
|
)
|
|
81
108
|
}
|
|
82
109
|
|
|
83
|
-
export {
|
|
110
|
+
export {
|
|
111
|
+
cardVariants,
|
|
112
|
+
Card,
|
|
113
|
+
CardHeader,
|
|
114
|
+
CardFooter,
|
|
115
|
+
CardTitle,
|
|
116
|
+
CardAction,
|
|
117
|
+
CardDescription,
|
|
118
|
+
CardContent,
|
|
119
|
+
}
|
|
@@ -9,14 +9,14 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
|
9
9
|
className={cn(
|
|
10
10
|
FOCUS_RING,
|
|
11
11
|
HOVER_RING,
|
|
12
|
-
'border-
|
|
12
|
+
'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 aria-invalid:aria-checked:border-selected flex size-(--choice-size) items-center justify-center rounded-(--checkbox-radius) border transition-shadow group-has-disabled/field:opacity-disabled peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
13
13
|
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
>
|
|
17
17
|
<CheckboxPrimitive.Indicator
|
|
18
18
|
data-slot="checkbox-indicator"
|
|
19
|
-
className="[&>svg]:size-3
|
|
19
|
+
className="size-full [&>svg]:size-full [&>svg]:stroke-[3] grid place-content-center text-current transition-none"
|
|
20
20
|
>
|
|
21
21
|
<CheckIcon />
|
|
22
22
|
</CheckboxPrimitive.Indicator>
|
|
@@ -124,7 +124,7 @@ function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.
|
|
|
124
124
|
<ComboboxPrimitive.Item
|
|
125
125
|
data-slot="combobox-item"
|
|
126
126
|
className={cn(
|
|
127
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-
|
|
127
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**: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 relative flex w-full cursor-default items-center outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
128
128
|
FOCUS_RING,
|
|
129
129
|
className,
|
|
130
130
|
)}
|
|
@@ -193,7 +193,7 @@ function ComboboxChips({
|
|
|
193
193
|
className={cn(
|
|
194
194
|
GROUP_FOCUS_RING,
|
|
195
195
|
HOVER_RING,
|
|
196
|
-
'bg-surface-
|
|
196
|
+
'bg-surface-input border-field flex min-h-(--control-size-md) flex-wrap items-center gap-1 rounded-(--input-radius) border bg-clip-padding px-2 py-0.5 text-(length:--control-font-size) leading-relaxed has-data-[slot=combobox-chip]:px-1',
|
|
197
197
|
className,
|
|
198
198
|
)}
|
|
199
199
|
{...props}
|
package/src/_internal/dialog.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
3
|
import { XIcon } from 'lucide-react'
|
|
3
4
|
import type * as React from 'react'
|
|
4
5
|
import { Button } from './button'
|
|
@@ -33,23 +34,38 @@ function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props)
|
|
|
33
34
|
)
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
const dialogContentVariants = cva(
|
|
38
|
+
'bg-page 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 ring-foreground/10 grid max-w-[calc(100%-2rem)] max-h-[calc(100dvh-var(--spacing)*8)] overflow-y-auto gap-4 rounded-(--dialog-radius) p-4 text-(length:--body-font-size) leading-relaxed ring-(length:--dialog-border-width) duration-fast sm:w-auto sm:max-w-(--dialog-max-width) fixed top-1/2 left-1/2 z-modal w-full -translate-x-1/2 -translate-y-1/2 outline-none',
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
placement: {
|
|
42
|
+
center: '',
|
|
43
|
+
// Docks to the bottom of the viewport below `sm`, like a drawer.
|
|
44
|
+
responsive:
|
|
45
|
+
'max-sm:top-auto max-sm:bottom-0 max-sm:max-w-full max-sm:max-h-[90dvh] max-sm:translate-y-0 max-sm:rounded-b-none max-sm:data-open:slide-in-from-bottom max-sm:data-closed:slide-out-to-bottom max-sm:data-open:zoom-in-100 max-sm:data-closed:zoom-out-100',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: { placement: 'center' },
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
|
|
36
52
|
function DialogContent({
|
|
37
53
|
className,
|
|
38
54
|
children,
|
|
39
55
|
showCloseButton = true,
|
|
56
|
+
placement,
|
|
40
57
|
...props
|
|
41
|
-
}: DialogPrimitive.Popup.Props &
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
}: DialogPrimitive.Popup.Props &
|
|
59
|
+
VariantProps<typeof dialogContentVariants> & {
|
|
60
|
+
showCloseButton?: boolean
|
|
61
|
+
}) {
|
|
44
62
|
return (
|
|
45
63
|
<DialogPortal>
|
|
46
64
|
<DialogOverlay />
|
|
47
65
|
<DialogPrimitive.Popup
|
|
48
66
|
data-slot="dialog-content"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className,
|
|
52
|
-
)}
|
|
67
|
+
data-placement={placement ?? 'center'}
|
|
68
|
+
className={cn(dialogContentVariants({ placement }), className)}
|
|
53
69
|
{...props}
|
|
54
70
|
>
|
|
55
71
|
{children}
|
|
@@ -99,7 +115,10 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
|
99
115
|
return (
|
|
100
116
|
<DialogPrimitive.Title
|
|
101
117
|
data-slot="dialog-title"
|
|
102
|
-
className={cn(
|
|
118
|
+
className={cn(
|
|
119
|
+
'text-(length:--heading-font-size) leading-(--heading-line-height) font-medium',
|
|
120
|
+
className,
|
|
121
|
+
)}
|
|
103
122
|
{...props}
|
|
104
123
|
/>
|
|
105
124
|
)
|
|
@@ -110,7 +129,7 @@ function DialogDescription({ className, ...props }: DialogPrimitive.Description.
|
|
|
110
129
|
<DialogPrimitive.Description
|
|
111
130
|
data-slot="dialog-description"
|
|
112
131
|
className={cn(
|
|
113
|
-
'text-muted-foreground *:[a]:hover:text-foreground text-
|
|
132
|
+
'text-muted-foreground *:[a]:hover:text-foreground text-(length:--body-font-size) leading-relaxed *:[a]:underline *:[a]:underline-offset-3',
|
|
114
133
|
className,
|
|
115
134
|
)}
|
|
116
135
|
{...props}
|
|
@@ -119,6 +138,7 @@ function DialogDescription({ className, ...props }: DialogPrimitive.Description.
|
|
|
119
138
|
}
|
|
120
139
|
|
|
121
140
|
export {
|
|
141
|
+
dialogContentVariants,
|
|
122
142
|
Dialog,
|
|
123
143
|
DialogClose,
|
|
124
144
|
DialogContent,
|
|
@@ -23,32 +23,32 @@ const dividerVariants = cva('shrink-0', {
|
|
|
23
23
|
{
|
|
24
24
|
variant: 'solid',
|
|
25
25
|
orientation: 'horizontal',
|
|
26
|
-
class: 'h-[var(--
|
|
26
|
+
class: 'h-[var(--rule-width)] bg-[var(--divider-color,var(--border-default))]',
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
variant: 'solid',
|
|
30
30
|
orientation: 'vertical',
|
|
31
|
-
class: 'w-[var(--
|
|
31
|
+
class: 'w-[var(--rule-width)] bg-[var(--divider-color,var(--border-default))]',
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
variant: 'dots',
|
|
35
35
|
orientation: 'horizontal',
|
|
36
|
-
class: 'h-[var(--
|
|
36
|
+
class: 'h-[var(--rule-width)]',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
variant: 'dots',
|
|
40
40
|
orientation: 'vertical',
|
|
41
|
-
class: 'w-[var(--
|
|
41
|
+
class: 'w-[var(--rule-width)]',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
variant: 'pills',
|
|
45
45
|
orientation: 'horizontal',
|
|
46
|
-
class: 'h-[var(--
|
|
46
|
+
class: 'h-[var(--rule-width)]',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
variant: 'pills',
|
|
50
50
|
orientation: 'vertical',
|
|
51
|
-
class: 'w-[var(--
|
|
51
|
+
class: 'w-[var(--rule-width)]',
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
54
|
defaultVariants: {
|
|
@@ -65,7 +65,7 @@ interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
65
65
|
orientation?: 'horizontal' | 'vertical'
|
|
66
66
|
/** Vertical alignment of the divider within its line. @default "center" */
|
|
67
67
|
align?: 'start' | 'center' | 'end'
|
|
68
|
-
/** Width multiplier for pills. Controls pill width as calc(var(--
|
|
68
|
+
/** Width multiplier for pills. Controls pill width as calc(var(--rule-width) * n). @default 4 */
|
|
69
69
|
pillsMultiplier?: number
|
|
70
70
|
/** CSS color value for dots/pills patterns. Sets --divider-color. @default "var(--border-default)" */
|
|
71
71
|
color?: string
|
|
@@ -82,37 +82,35 @@ function getPatternStyle(
|
|
|
82
82
|
return orientation === 'horizontal'
|
|
83
83
|
? {
|
|
84
84
|
backgroundImage:
|
|
85
|
-
'radial-gradient(circle, var(--divider-color, var(--border-default)) calc(var(--
|
|
86
|
-
backgroundSize:
|
|
87
|
-
'calc(var(--border-width-base) + var(--spacing) * 1) var(--border-width-base)',
|
|
85
|
+
'radial-gradient(circle, var(--divider-color, var(--border-default)) calc(var(--rule-width) / 2), transparent 0)',
|
|
86
|
+
backgroundSize: 'calc(var(--rule-width) + var(--spacing) * 1) var(--rule-width)',
|
|
88
87
|
backgroundRepeat: 'repeat-x',
|
|
89
88
|
backgroundPosition: 'left center',
|
|
90
89
|
}
|
|
91
90
|
: {
|
|
92
91
|
backgroundImage:
|
|
93
|
-
'radial-gradient(circle, var(--divider-color, var(--border-default)) calc(var(--
|
|
94
|
-
backgroundSize:
|
|
95
|
-
'var(--border-width-base) calc(var(--border-width-base) + var(--spacing) * 1)',
|
|
92
|
+
'radial-gradient(circle, var(--divider-color, var(--border-default)) calc(var(--rule-width) / 2), transparent 0)',
|
|
93
|
+
backgroundSize: 'var(--rule-width) calc(var(--rule-width) + var(--spacing) * 1)',
|
|
96
94
|
backgroundRepeat: 'repeat-y',
|
|
97
95
|
backgroundPosition: 'center top',
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
// pills
|
|
102
|
-
const pillLen = `calc(var(--
|
|
100
|
+
const pillLen = `calc(var(--rule-width) * ${pillsMultiplier})`
|
|
103
101
|
const unit = `calc(${pillLen} + var(--spacing) * 1)`
|
|
104
102
|
|
|
105
103
|
return orientation === 'horizontal'
|
|
106
104
|
? {
|
|
107
105
|
backgroundImage: `repeating-linear-gradient(to right, var(--divider-color, var(--border-default)) 0, var(--divider-color, var(--border-default)) ${pillLen}, transparent ${pillLen}, transparent ${unit})`,
|
|
108
|
-
backgroundSize: `${unit} var(--
|
|
106
|
+
backgroundSize: `${unit} var(--rule-width)`,
|
|
109
107
|
backgroundRepeat: 'repeat-x',
|
|
110
108
|
backgroundPosition: 'left center',
|
|
111
109
|
borderRadius: 'var(--radius)',
|
|
112
110
|
}
|
|
113
111
|
: {
|
|
114
112
|
backgroundImage: `repeating-linear-gradient(to bottom, var(--divider-color, var(--border-default)) 0, var(--divider-color, var(--border-default)) ${pillLen}, transparent ${pillLen}, transparent ${unit})`,
|
|
115
|
-
backgroundSize: `var(--
|
|
113
|
+
backgroundSize: `var(--rule-width) ${unit}`,
|
|
116
114
|
backgroundRepeat: 'repeat-y',
|
|
117
115
|
backgroundPosition: 'center top',
|
|
118
116
|
borderRadius: 'var(--radius)',
|
|
@@ -85,7 +85,7 @@ function DropdownMenuItem({
|
|
|
85
85
|
data-inset={inset}
|
|
86
86
|
data-variant={variant}
|
|
87
87
|
className={cn(
|
|
88
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-critical data-[variant=destructive]:focus:bg-surface-critical data-[variant=destructive]:focus:text-critical data-[variant=destructive]:*:[svg]:text-icon-critical not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-
|
|
88
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-critical data-[variant=destructive]:focus:bg-surface-critical data-[variant=destructive]:focus:text-critical data-[variant=destructive]:*:[svg]:text-icon-critical 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 group/dropdown-menu-item relative flex cursor-default items-center outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-disabled data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
89
89
|
FOCUS_RING,
|
|
90
90
|
className,
|
|
91
91
|
)}
|
|
@@ -111,7 +111,7 @@ function DropdownMenuSubTrigger({
|
|
|
111
111
|
data-slot="dropdown-menu-sub-trigger"
|
|
112
112
|
data-inset={inset}
|
|
113
113
|
className={cn(
|
|
114
|
-
"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs [&_svg:not([class*='size-'])]:size-3.5 flex cursor-default items-center outline-none select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
114
|
+
"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open: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-(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-3.5 flex cursor-default items-center outline-none select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
115
115
|
FOCUS_RING,
|
|
116
116
|
className,
|
|
117
117
|
)}
|
|
@@ -157,7 +157,7 @@ function DropdownMenuCheckboxItem({
|
|
|
157
157
|
<MenuPrimitive.CheckboxItem
|
|
158
158
|
data-slot="dropdown-menu-checkbox-item"
|
|
159
159
|
className={cn(
|
|
160
|
-
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
160
|
+
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-(length:--control-font-size) leading-(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
161
161
|
FOCUS_RING,
|
|
162
162
|
className,
|
|
163
163
|
)}
|
|
@@ -186,7 +186,7 @@ function DropdownMenuRadioItem({ className, children, ...props }: MenuPrimitive.
|
|
|
186
186
|
<MenuPrimitive.RadioItem
|
|
187
187
|
data-slot="dropdown-menu-radio-item"
|
|
188
188
|
className={cn(
|
|
189
|
-
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
189
|
+
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-(length:--control-font-size) leading-(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
190
190
|
FOCUS_RING,
|
|
191
191
|
className,
|
|
192
192
|
)}
|
package/src/_internal/empty.tsx
CHANGED
|
@@ -59,7 +59,10 @@ function EmptyTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
59
59
|
return (
|
|
60
60
|
<div
|
|
61
61
|
data-slot="empty-title"
|
|
62
|
-
className={cn(
|
|
62
|
+
className={cn(
|
|
63
|
+
'text-(length:--title-font-size) leading-(--title-line-height) font-medium tracking-tight',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
63
66
|
{...props}
|
|
64
67
|
/>
|
|
65
68
|
)
|
|
@@ -70,7 +73,7 @@ function EmptyDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
|
70
73
|
<div
|
|
71
74
|
data-slot="empty-description"
|
|
72
75
|
className={cn(
|
|
73
|
-
'text-
|
|
76
|
+
'text-(length:--body-font-size) leading-relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
|
|
74
77
|
className,
|
|
75
78
|
)}
|
|
76
79
|
{...props}
|
|
@@ -83,7 +86,7 @@ function EmptyContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
83
86
|
<div
|
|
84
87
|
data-slot="empty-content"
|
|
85
88
|
className={cn(
|
|
86
|
-
'gap-2 text-
|
|
89
|
+
'gap-2 text-(length:--body-font-size) leading-relaxed flex w-full max-w-sm min-w-0 flex-col items-center text-balance',
|
|
87
90
|
className,
|
|
88
91
|
)}
|
|
89
92
|
{...props}
|
package/src/_internal/field.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
import { CircleAlertIcon } from 'lucide-react'
|
|
2
3
|
import { useMemo } from 'react'
|
|
3
4
|
import { Label } from './label'
|
|
4
5
|
import { Separator } from './separator'
|
|
@@ -27,7 +28,7 @@ function FieldLegend({
|
|
|
27
28
|
data-slot="field-legend"
|
|
28
29
|
data-variant={variant}
|
|
29
30
|
className={cn(
|
|
30
|
-
'mb-2 font-medium data-[variant=label]:text-
|
|
31
|
+
'mb-2 font-medium data-[variant=label]:text-(length:--label-font-size) data-[variant=label]:leading-relaxed data-[variant=label]:text-(color:--label-color) data-[variant=label]:[text-transform:var(--label-text-transform)] data-[variant=legend]:text-(length:--heading-font-size) data-[variant=legend]:leading-(--heading-line-height)',
|
|
31
32
|
className,
|
|
32
33
|
)}
|
|
33
34
|
{...props}
|
|
@@ -83,7 +84,7 @@ function FieldContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
83
84
|
return (
|
|
84
85
|
<div
|
|
85
86
|
data-slot="field-content"
|
|
86
|
-
className={cn('gap-
|
|
87
|
+
className={cn('gap-1.5 group/field-content flex flex-1 flex-col leading-snug', className)}
|
|
87
88
|
{...props}
|
|
88
89
|
/>
|
|
89
90
|
)
|
|
@@ -108,7 +109,7 @@ function FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
108
109
|
<div
|
|
109
110
|
data-slot="field-label"
|
|
110
111
|
className={cn(
|
|
111
|
-
'gap-2 text-
|
|
112
|
+
'gap-2 text-(length:--label-font-size) text-(color:--label-color) [text-transform:var(--label-text-transform)] group-data-[invalid=true]/field:text-critical font-medium group-data-[disabled=true]/field:opacity-disabled flex w-fit items-center leading-snug',
|
|
112
113
|
className,
|
|
113
114
|
)}
|
|
114
115
|
{...props}
|
|
@@ -121,8 +122,7 @@ function FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
|
121
122
|
<p
|
|
122
123
|
data-slot="field-description"
|
|
123
124
|
className={cn(
|
|
124
|
-
'text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',
|
|
125
|
-
'last:mt-0 nth-last-2:-mt-1',
|
|
125
|
+
'text-muted-foreground group-data-[invalid=true]/field:text-critical text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',
|
|
126
126
|
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
|
|
127
127
|
className,
|
|
128
128
|
)}
|
|
@@ -199,10 +199,14 @@ function FieldError({
|
|
|
199
199
|
<div
|
|
200
200
|
role="alert"
|
|
201
201
|
data-slot="field-error"
|
|
202
|
-
className={cn(
|
|
202
|
+
className={cn(
|
|
203
|
+
'text-critical text-xs/relaxed font-normal break-all flex items-start gap-1 [&>svg]:size-[1.25em] [&>svg]:shrink-0 [&>svg]:mt-[0.125em]',
|
|
204
|
+
className,
|
|
205
|
+
)}
|
|
203
206
|
{...props}
|
|
204
207
|
>
|
|
205
|
-
|
|
208
|
+
<CircleAlertIcon aria-hidden="true" />
|
|
209
|
+
<div className="min-w-0">{content}</div>
|
|
206
210
|
</div>
|
|
207
211
|
)
|
|
208
212
|
}
|
|
@@ -32,7 +32,7 @@ function HoverCardContent({
|
|
|
32
32
|
<HoverCardPrimitive.Popup
|
|
33
33
|
data-slot="hover-card-content"
|
|
34
34
|
className={cn(
|
|
35
|
-
'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 rounded-lg p-4 text-
|
|
35
|
+
'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 rounded-lg p-4 text-(length:--body-font-size) leading-(--body-line-height) shadow-md ring-[length:var(--border-width)] duration-fast z-popover w-80 origin-(--transform-origin) outline-hidden',
|
|
36
36
|
className,
|
|
37
37
|
)}
|
|
38
38
|
{...props}
|
|
@@ -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 }
|