@leitware/composables 1.7.0 → 1.7.1
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 +6 -0
- package/dist/presets/brutalist.css +1 -1
- package/dist/presets/editorial-grid.css +1 -1
- package/dist/presets/kumo.css +8 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/_internal/button.tsx +1 -1
- package/src/_internal/flow.tsx +2 -2
- package/src/_internal/tabs.tsx +34 -14
- package/src/opinionated/tabs.tsx +2 -2
- package/src/styles/presets/brutalist.css +1 -1
- package/src/styles/presets/editorial-grid.css +1 -1
- package/src/styles/presets/kumo.css +8 -2
- package/src/styles/presets-data/brutalist.ts +1 -1
- package/src/styles/presets-data/editorial-grid.ts +1 -1
- package/src/styles/presets-data/kumo.ts +4 -1
- package/src/styles/tokens/components.css +10 -0
package/package.json
CHANGED
package/src/_internal/button.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { cn, FOCUS_RING, FOCUS_RING_DESTRUCTIVE, HOVER_RING } from '../lib/utils
|
|
|
7
7
|
// border (no bg-clip-padding) so filled and outlined buttons read as the same
|
|
8
8
|
// size regardless of --border-width-base.
|
|
9
9
|
const buttonVariants = cva(
|
|
10
|
-
`${FOCUS_RING} ${HOVER_RING} rounded-(--button-radius) border border-transparent text-xs/relaxed font-medium [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-[opacity,box-shadow,transform] active:scale
|
|
10
|
+
`${FOCUS_RING} ${HOVER_RING} rounded-(--button-radius) border border-transparent text-xs/relaxed font-medium [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-[opacity,box-shadow,transform] duration-(--motion-duration-interaction) ease-(--motion-ease-standard) active:[transform:scale(var(--active-scale,0.98))] disabled:pointer-events-none disabled:opacity-disabled [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none`,
|
|
11
11
|
{
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
package/src/_internal/flow.tsx
CHANGED
|
@@ -207,7 +207,7 @@ export const FlowRoot = forwardRef<HTMLDivElement, FlowRootProps>(function FlowR
|
|
|
207
207
|
className={cn(
|
|
208
208
|
'max-w-full outline-none',
|
|
209
209
|
canvas &&
|
|
210
|
-
'overflow-auto rounded-(--flow-canvas-radius) border border-stroke bg-muted bg-[image:var(--flow-canvas-background-image)] [background-size:var(--flow-canvas-background-size)_var(--flow-canvas-background-size)]',
|
|
210
|
+
'overflow-auto rounded-(--flow-canvas-radius) border-(length:--flow-border-width) border-stroke bg-muted bg-[image:var(--flow-canvas-background-image)] [background-size:var(--flow-canvas-background-size)_var(--flow-canvas-background-size)]',
|
|
211
211
|
canvas && FOCUS_RING,
|
|
212
212
|
panning && 'cursor-grabbing select-none',
|
|
213
213
|
className,
|
|
@@ -310,7 +310,7 @@ export const FlowNode = forwardRef<HTMLDivElement, FlowNodeProps>(function FlowN
|
|
|
310
310
|
'data-flow-node': nodeId,
|
|
311
311
|
'aria-disabled': disabled || undefined,
|
|
312
312
|
className: cn(
|
|
313
|
-
'relative min-w-0 rounded-(--flow-node-radius) border border-stroke-secondary bg-surface-default px-3 py-2 text-sm text-default shadow-(--flow-node-shadow)',
|
|
313
|
+
'relative min-w-0 rounded-(--flow-node-radius) border-(length:--flow-border-width) border-stroke-secondary bg-surface-default px-3 py-2 text-sm text-default shadow-(--flow-node-shadow)',
|
|
314
314
|
disabled && 'opacity-disabled',
|
|
315
315
|
className,
|
|
316
316
|
),
|
package/src/_internal/tabs.tsx
CHANGED
|
@@ -8,39 +8,61 @@ function Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive
|
|
|
8
8
|
<TabsPrimitive.Root
|
|
9
9
|
data-slot="tabs"
|
|
10
10
|
data-orientation={orientation}
|
|
11
|
-
|
|
11
|
+
orientation={orientation}
|
|
12
|
+
className={cn(
|
|
13
|
+
'group/tabs flex min-w-0 gap-2 data-[orientation=horizontal]:flex-col',
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
12
16
|
{...props}
|
|
13
17
|
/>
|
|
14
18
|
)
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
const segmentedList =
|
|
22
|
+
'rounded-(--tabs-list-radius) bg-muted p-(--tabs-list-padding) shadow-(--tabs-list-shadow)'
|
|
23
|
+
const lineList =
|
|
24
|
+
'gap-1 border-b border-stroke bg-transparent pb-1 group-data-[orientation=vertical]/tabs:border-b-0 group-data-[orientation=vertical]/tabs:border-e group-data-[orientation=vertical]/tabs:pe-1'
|
|
17
25
|
const tabsListVariants = cva(
|
|
18
|
-
'
|
|
26
|
+
'relative isolate inline-flex w-fit max-w-full shrink-0 items-stretch overflow-x-auto group/tabs-list group-data-[orientation=vertical]/tabs:flex-col',
|
|
19
27
|
{
|
|
20
28
|
variants: {
|
|
21
29
|
variant: {
|
|
22
|
-
default:
|
|
23
|
-
|
|
30
|
+
default: segmentedList,
|
|
31
|
+
segmented: segmentedList,
|
|
32
|
+
line: lineList,
|
|
33
|
+
underline: lineList,
|
|
24
34
|
},
|
|
25
35
|
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
variant: 'default',
|
|
28
|
-
},
|
|
36
|
+
defaultVariants: { variant: 'segmented' },
|
|
29
37
|
},
|
|
30
38
|
)
|
|
31
39
|
|
|
32
40
|
function TabsList({
|
|
33
41
|
className,
|
|
34
|
-
variant = '
|
|
42
|
+
variant = 'segmented',
|
|
43
|
+
children,
|
|
35
44
|
...props
|
|
36
45
|
}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
|
|
46
|
+
const segmented = variant === 'default' || variant === 'segmented'
|
|
37
47
|
return (
|
|
38
48
|
<TabsPrimitive.List
|
|
39
49
|
data-slot="tabs-list"
|
|
40
50
|
data-variant={variant}
|
|
51
|
+
data-treatment={segmented ? 'segmented' : 'underline'}
|
|
41
52
|
className={cn(tabsListVariants({ variant }), className)}
|
|
42
53
|
{...props}
|
|
43
|
-
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
<TabsPrimitive.Indicator
|
|
57
|
+
data-slot="tabs-indicator"
|
|
58
|
+
className={cn(
|
|
59
|
+
'pointer-events-none absolute left-0 top-0 z-0 w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top) transition-[translate,width,height] duration-(--motion-duration-disclosure) ease-(--motion-ease-standard) motion-reduce:transition-none',
|
|
60
|
+
segmented
|
|
61
|
+
? 'h-(--active-tab-height) rounded-(--tabs-tab-radius) border-(length:--tabs-indicator-border-width) border-stroke-secondary bg-surface-default shadow-(--tabs-indicator-shadow)'
|
|
62
|
+
: 'h-0.5 bg-fill-primary [translate:var(--active-tab-left)_0] top-auto bottom-0 group-data-[orientation=vertical]/tabs:top-0 group-data-[orientation=vertical]/tabs:bottom-auto group-data-[orientation=vertical]/tabs:left-auto group-data-[orientation=vertical]/tabs:end-0 group-data-[orientation=vertical]/tabs:w-0.5 group-data-[orientation=vertical]/tabs:h-(--active-tab-height) group-data-[orientation=vertical]/tabs:[translate:0_var(--active-tab-top)]',
|
|
63
|
+
)}
|
|
64
|
+
/>
|
|
65
|
+
</TabsPrimitive.List>
|
|
44
66
|
)
|
|
45
67
|
}
|
|
46
68
|
|
|
@@ -50,10 +72,8 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
|
50
72
|
data-slot="tabs-trigger"
|
|
51
73
|
className={cn(
|
|
52
74
|
FOCUS_RING,
|
|
53
|
-
"
|
|
54
|
-
'group-data-[
|
|
55
|
-
'data-active:bg-page dark:data-active:text-foreground dark:data-active:border-field dark:data-active:bg-surface-field/30 data-active:text-foreground',
|
|
56
|
-
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
|
|
75
|
+
"relative z-10 inline-flex h-(--tabs-tab-height) shrink-0 items-center justify-center gap-1.5 rounded-(--tabs-tab-radius) bg-transparent px-2.5 text-sm font-normal whitespace-nowrap text-default outline-none transition-colors duration-(--motion-duration-color) data-active:font-medium disabled:pointer-events-none disabled:opacity-disabled data-disabled:pointer-events-none data-disabled:opacity-disabled group-data-[orientation=vertical]/tabs:justify-start [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
76
|
+
'group-data-[treatment=underline]/tabs-list:hover:bg-surface-hover',
|
|
57
77
|
className,
|
|
58
78
|
)}
|
|
59
79
|
{...props}
|
|
@@ -65,7 +85,7 @@ function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
|
|
|
65
85
|
return (
|
|
66
86
|
<TabsPrimitive.Panel
|
|
67
87
|
data-slot="tabs-content"
|
|
68
|
-
className={cn('text-xs/relaxed
|
|
88
|
+
className={cn('flex-1 text-xs/relaxed outline-none', className)}
|
|
69
89
|
{...props}
|
|
70
90
|
/>
|
|
71
91
|
)
|
package/src/opinionated/tabs.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export type TabsProps = Omit<TabsPrimitiveBase.Root.Props, 'children'> & {
|
|
|
50
50
|
onValueChange: (value: string) => void
|
|
51
51
|
/** Accessible label for the tab list (for screen readers). */
|
|
52
52
|
ariaLabel?: string
|
|
53
|
-
/** Visual style of the tab list. @default '
|
|
53
|
+
/** Visual style of the tab list. @default 'segmented' */
|
|
54
54
|
variant?: TabsVariant
|
|
55
55
|
className?: string
|
|
56
56
|
}
|
|
@@ -60,7 +60,7 @@ export const Tabs = ({
|
|
|
60
60
|
value,
|
|
61
61
|
onValueChange,
|
|
62
62
|
ariaLabel,
|
|
63
|
-
variant = '
|
|
63
|
+
variant = 'segmented',
|
|
64
64
|
className,
|
|
65
65
|
...tabsProps
|
|
66
66
|
}: TabsProps) => {
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
--transition-slow: var(--motion-duration-slow) var(--motion-ease-linear);
|
|
154
154
|
--hover-transform: none;
|
|
155
155
|
--hover-shadow: none;
|
|
156
|
-
--active-scale:
|
|
156
|
+
--active-scale: 0.98;
|
|
157
157
|
--heading-font-weight: 700;
|
|
158
158
|
--heading-letter-spacing: var(--tracking-tight);
|
|
159
159
|
--body-letter-spacing: var(--tracking-normal);
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
--transition-slow: var(--motion-duration-slow) var(--motion-ease-decelerate);
|
|
154
154
|
--hover-transform: none;
|
|
155
155
|
--hover-shadow: none;
|
|
156
|
-
--active-scale:
|
|
156
|
+
--active-scale: 0.98;
|
|
157
157
|
--heading-font-weight: 700;
|
|
158
158
|
--heading-letter-spacing: var(--tracking-tight);
|
|
159
159
|
--body-letter-spacing: var(--tracking-normal);
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
--transition-slow: var(--motion-duration-slow) var(--motion-ease-decelerate);
|
|
154
154
|
--hover-transform: none;
|
|
155
155
|
--hover-shadow: none;
|
|
156
|
-
--active-scale:
|
|
156
|
+
--active-scale: 0.98;
|
|
157
157
|
--heading-font-weight: 600;
|
|
158
158
|
--heading-letter-spacing: var(--tracking-tight);
|
|
159
159
|
--body-letter-spacing: var(--tracking-normal);
|
|
@@ -184,6 +184,9 @@
|
|
|
184
184
|
--button-brand-text-shadow: 0 1px 1px #00000059, 0 0 1px #00000040;
|
|
185
185
|
--layer-card-radius: var(--radius-lg);
|
|
186
186
|
--layer-card-shadow: 0 1px 2px #0000000d;
|
|
187
|
+
--tabs-tab-height: calc(var(--spacing) * 8);
|
|
188
|
+
--tabs-list-shadow: 0 0 0 1px var(--border-secondary);
|
|
189
|
+
--tabs-indicator-shadow: 0 1px 2px #0000000d;
|
|
187
190
|
--flow-node-shadow: 0 1px 2px #0000000d;
|
|
188
191
|
--flow-canvas-background-image: radial-gradient(var(--border-disabled) 1px, transparent 1px);
|
|
189
192
|
--button-secondary-border: var(--border-secondary);
|
|
@@ -501,6 +504,9 @@
|
|
|
501
504
|
--card-radius: var(--radius-xl);
|
|
502
505
|
--layer-card-radius: var(--radius-lg);
|
|
503
506
|
--layer-card-shadow: 0 1px 2px #0000000d;
|
|
507
|
+
--tabs-tab-height: calc(var(--spacing) * 8);
|
|
508
|
+
--tabs-list-shadow: 0 0 0 1px var(--border-secondary);
|
|
509
|
+
--tabs-indicator-shadow: 0 1px 2px #0000000d;
|
|
504
510
|
--flow-node-shadow: 0 1px 2px #0000000d;
|
|
505
511
|
--flow-canvas-background-image: radial-gradient(var(--border-disabled) 1px, transparent 1px);
|
|
506
512
|
--input-radius: var(--radius-lg);
|
|
@@ -526,7 +532,7 @@
|
|
|
526
532
|
--hover-ring-color: var(--border-secondary);
|
|
527
533
|
--hover-transform: none;
|
|
528
534
|
--hover-shadow: none;
|
|
529
|
-
--active-scale:
|
|
535
|
+
--active-scale: 0.98;
|
|
530
536
|
--heading-font-weight: 600;
|
|
531
537
|
--hero-font-weight: 600;
|
|
532
538
|
--section-title-font-weight: 600;
|
|
@@ -173,7 +173,7 @@ export const brutalist: Record<string, string> = {
|
|
|
173
173
|
'--transition-slow': 'var(--motion-duration-slow) var(--motion-ease-linear)',
|
|
174
174
|
'--hover-transform': 'none',
|
|
175
175
|
'--hover-shadow': 'none',
|
|
176
|
-
'--active-scale': '
|
|
176
|
+
'--active-scale': '0.98',
|
|
177
177
|
|
|
178
178
|
// ── Phase 1c: Typography - heavy, structural ──────────────────────────
|
|
179
179
|
'--heading-font-weight': '700',
|
|
@@ -137,7 +137,7 @@ export const editorialGrid: Record<string, string> = {
|
|
|
137
137
|
'--badge-radius': 'var(--radius)',
|
|
138
138
|
'--hover-shadow': 'none',
|
|
139
139
|
'--hover-transform': 'none',
|
|
140
|
-
'--active-scale': '
|
|
140
|
+
'--active-scale': '0.98',
|
|
141
141
|
'--motion-duration-fast': '100ms',
|
|
142
142
|
'--motion-duration-normal': '150ms',
|
|
143
143
|
'--motion-duration-slow': '200ms',
|
|
@@ -90,6 +90,9 @@ const shape: Record<string, string> = {
|
|
|
90
90
|
'--card-radius': 'var(--radius-xl)',
|
|
91
91
|
'--layer-card-radius': 'var(--radius-lg)',
|
|
92
92
|
'--layer-card-shadow': '0 1px 2px #0000000D',
|
|
93
|
+
'--tabs-tab-height': 'calc(var(--spacing) * 8)',
|
|
94
|
+
'--tabs-list-shadow': '0 0 0 1px var(--border-secondary)',
|
|
95
|
+
'--tabs-indicator-shadow': '0 1px 2px #0000000D',
|
|
93
96
|
'--flow-node-shadow': '0 1px 2px #0000000D',
|
|
94
97
|
'--flow-canvas-background-image': 'radial-gradient(var(--border-disabled) 1px, transparent 1px)',
|
|
95
98
|
'--input-radius': 'var(--radius-lg)',
|
|
@@ -115,7 +118,7 @@ const shape: Record<string, string> = {
|
|
|
115
118
|
'--hover-ring-color': 'var(--border-secondary)',
|
|
116
119
|
'--hover-transform': 'none',
|
|
117
120
|
'--hover-shadow': 'none',
|
|
118
|
-
'--active-scale': '
|
|
121
|
+
'--active-scale': '0.98',
|
|
119
122
|
'--heading-font-weight': '600',
|
|
120
123
|
'--hero-font-weight': '600',
|
|
121
124
|
'--section-title-font-weight': '600',
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
--clipboard-text-height: var(--input-height);
|
|
112
112
|
--clipboard-text-height-sm: calc(var(--spacing) * 6.5);
|
|
113
113
|
--clipboard-text-height-lg: calc(var(--spacing) * 10);
|
|
114
|
+
--flow-border-width: max(1px, var(--border-width-base));
|
|
114
115
|
--flow-gap: calc(var(--spacing) * 10);
|
|
115
116
|
--flow-branch-gap: calc(var(--spacing) * 4);
|
|
116
117
|
--flow-node-radius: var(--radius-md);
|
|
@@ -128,6 +129,15 @@
|
|
|
128
129
|
--badge-radius: var(--radius-4xl);
|
|
129
130
|
--grid-overlay-color: color-mix(in srgb, var(--text-default) 6%, transparent);
|
|
130
131
|
|
|
132
|
+
/* Segmented tabs and the animated selection indicator. */
|
|
133
|
+
--tabs-list-radius: var(--radius-lg);
|
|
134
|
+
--tabs-tab-radius: var(--radius-md);
|
|
135
|
+
--tabs-list-padding: calc(var(--spacing) * 0.5);
|
|
136
|
+
--tabs-tab-height: calc(var(--spacing) * 8);
|
|
137
|
+
--tabs-list-shadow: none;
|
|
138
|
+
--tabs-indicator-border-width: var(--border-width-base);
|
|
139
|
+
--tabs-indicator-shadow: var(--shadow-sm);
|
|
140
|
+
|
|
131
141
|
/* ── Motion ────────────────────────────────────────────────────────── */
|
|
132
142
|
--motion-duration-fast: 100ms;
|
|
133
143
|
--motion-duration-normal: 200ms;
|