@leitware/composables 1.1.0 → 1.3.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/dist/presets/brutalist.css +0 -5
- package/dist/presets/default.css +2 -7
- package/dist/presets/signal-pop.css +0 -10
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/_internal/alert.tsx +2 -0
- package/src/_internal/badge.tsx +9 -2
- package/src/_internal/bubble.tsx +8 -0
- package/src/_internal/card.tsx +4 -4
- package/src/_internal/combobox.tsx +1 -1
- package/src/_internal/input-group.tsx +1 -1
- package/src/_internal/input.tsx +1 -1
- package/src/_internal/select.tsx +1 -1
- package/src/_internal/textarea.tsx +1 -1
- package/src/opinionated/badge.tsx +4 -0
- package/src/opinionated/token-config-panel/index.tsx +23 -0
- package/src/opinionated/token-config-panel/spacing-editor.tsx +156 -1
- package/src/opinionated/token-config-panel/types.ts +13 -0
- package/src/styles/presets/brutalist.css +0 -5
- package/src/styles/presets/default.css +2 -7
- package/src/styles/presets/signal-pop.css +0 -10
- package/src/styles/presets-data/brutalist.ts +0 -5
- package/src/styles/presets-data/default.ts +2 -7
- package/src/styles/presets-data/signal-pop.ts +0 -10
- package/src/styles/tokens/components.css +2 -7
package/package.json
CHANGED
package/src/_internal/alert.tsx
CHANGED
|
@@ -9,6 +9,8 @@ const alertVariants = cva(
|
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default: 'bg-card text-card-foreground',
|
|
12
|
+
secondary: 'bg-muted text-foreground',
|
|
13
|
+
outline: 'border-stroke bg-transparent text-foreground',
|
|
12
14
|
destructive:
|
|
13
15
|
'bg-surface-critical border-stroke-critical text-critical *:data-[slot=alert-description]:text-critical/90 *:[svg]:text-icon-critical',
|
|
14
16
|
warning:
|
package/src/_internal/badge.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const BADGE_LINK_HOVER =
|
|
|
8
8
|
'[a]:hover:ring-[length:var(--hover-ring-width)] [a]:hover:ring-[color:var(--hover-ring-color)]/30'
|
|
9
9
|
|
|
10
10
|
const badgeVariants = cva(
|
|
11
|
-
`${FOCUS_RING}
|
|
11
|
+
`${FOCUS_RING} gap-1 rounded-(--badge-radius) border border-transparent py-0.5 font-medium transition-[opacity,box-shadow] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none overflow-hidden group/badge`,
|
|
12
12
|
{
|
|
13
13
|
variants: {
|
|
14
14
|
variant: {
|
|
@@ -28,6 +28,11 @@ const badgeVariants = cva(
|
|
|
28
28
|
emphasis: 'bg-surface-emphasis text-emphasis border-stroke-emphasis',
|
|
29
29
|
link: 'text-primary underline-offset-4 hover:underline',
|
|
30
30
|
},
|
|
31
|
+
size: {
|
|
32
|
+
sm: 'h-4 px-1.5 text-2xs [&>svg]:size-2!',
|
|
33
|
+
default: 'h-5 px-2 text-2xs [&>svg]:size-2.5!',
|
|
34
|
+
lg: 'h-6 px-2.5 text-xs [&>svg]:size-3!',
|
|
35
|
+
},
|
|
31
36
|
// Declared after `variant` so the pill class wins when tailwind-merge
|
|
32
37
|
// resolves conflicts.
|
|
33
38
|
shape: {
|
|
@@ -37,6 +42,7 @@ const badgeVariants = cva(
|
|
|
37
42
|
},
|
|
38
43
|
defaultVariants: {
|
|
39
44
|
variant: 'default',
|
|
45
|
+
size: 'default',
|
|
40
46
|
shape: 'default',
|
|
41
47
|
},
|
|
42
48
|
},
|
|
@@ -45,6 +51,7 @@ const badgeVariants = cva(
|
|
|
45
51
|
function Badge({
|
|
46
52
|
className,
|
|
47
53
|
variant = 'default',
|
|
54
|
+
size = 'default',
|
|
48
55
|
shape = 'default',
|
|
49
56
|
render,
|
|
50
57
|
...props
|
|
@@ -53,7 +60,7 @@ function Badge({
|
|
|
53
60
|
defaultTagName: 'span',
|
|
54
61
|
props: mergeProps<'span'>(
|
|
55
62
|
{
|
|
56
|
-
className: cn(badgeVariants({ className, variant, shape })),
|
|
63
|
+
className: cn(badgeVariants({ className, variant, size, shape })),
|
|
57
64
|
},
|
|
58
65
|
props,
|
|
59
66
|
),
|
package/src/_internal/bubble.tsx
CHANGED
|
@@ -27,8 +27,16 @@ const bubbleVariants = cva(
|
|
|
27
27
|
outline: '*:data-[slot=bubble-content]:border-stroke *:data-[slot=bubble-content]:bg-page',
|
|
28
28
|
ghost:
|
|
29
29
|
'border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0',
|
|
30
|
+
destructive:
|
|
31
|
+
'*:data-[slot=bubble-content]:bg-surface-critical *:data-[slot=bubble-content]:text-critical *:data-[slot=bubble-content]:border-stroke-critical',
|
|
32
|
+
/** @deprecated Use `destructive` — kept for backwards compatibility. */
|
|
30
33
|
critical:
|
|
31
34
|
'*:data-[slot=bubble-content]:bg-surface-critical *:data-[slot=bubble-content]:text-critical *:data-[slot=bubble-content]:border-stroke-critical',
|
|
35
|
+
success:
|
|
36
|
+
'*:data-[slot=bubble-content]:bg-surface-success *:data-[slot=bubble-content]:text-success *:data-[slot=bubble-content]:border-stroke-success',
|
|
37
|
+
warning:
|
|
38
|
+
'*:data-[slot=bubble-content]:bg-surface-warning *:data-[slot=bubble-content]:text-warning *:data-[slot=bubble-content]:border-stroke-warning',
|
|
39
|
+
info: '*:data-[slot=bubble-content]:bg-surface-info *:data-[slot=bubble-content]:text-info *:data-[slot=bubble-content]:border-stroke-info',
|
|
32
40
|
},
|
|
33
41
|
},
|
|
34
42
|
defaultVariants: {
|
package/src/_internal/card.tsx
CHANGED
|
@@ -12,7 +12,7 @@ function Card({
|
|
|
12
12
|
data-slot="card"
|
|
13
13
|
data-size={size}
|
|
14
14
|
className={cn(
|
|
15
|
-
'border border-stroke bg-card text-card-foreground gap-4 overflow-hidden rounded-
|
|
15
|
+
'border border-stroke bg-card text-card-foreground gap-4 overflow-hidden rounded-(--card-radius) py-(--card-padding) text-xs/relaxed has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-(--card-radius) *:[img:last-child]:rounded-b-(--card-radius) group/card flex flex-col',
|
|
16
16
|
className,
|
|
17
17
|
)}
|
|
18
18
|
{...props}
|
|
@@ -25,7 +25,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
25
25
|
<div
|
|
26
26
|
data-slot="card-header"
|
|
27
27
|
className={cn(
|
|
28
|
-
'gap-1 rounded-t-
|
|
28
|
+
'gap-1 rounded-t-(--card-radius) px-(--card-padding) group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 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
29
|
className,
|
|
30
30
|
)}
|
|
31
31
|
{...props}
|
|
@@ -61,7 +61,7 @@ function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
61
61
|
return (
|
|
62
62
|
<div
|
|
63
63
|
data-slot="card-content"
|
|
64
|
-
className={cn('px-
|
|
64
|
+
className={cn('px-(--card-padding) group-data-[size=sm]/card:px-3', className)}
|
|
65
65
|
{...props}
|
|
66
66
|
/>
|
|
67
67
|
)
|
|
@@ -72,7 +72,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
72
72
|
<div
|
|
73
73
|
data-slot="card-footer"
|
|
74
74
|
className={cn(
|
|
75
|
-
'rounded-b-
|
|
75
|
+
'rounded-b-(--card-radius) px-(--card-padding) group-data-[size=sm]/card:px-3 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3 flex items-center',
|
|
76
76
|
className,
|
|
77
77
|
)}
|
|
78
78
|
{...props}
|
|
@@ -193,7 +193,7 @@ function ComboboxChips({
|
|
|
193
193
|
className={cn(
|
|
194
194
|
GROUP_FOCUS_RING,
|
|
195
195
|
HOVER_RING,
|
|
196
|
-
'bg-field/20 dark:bg-field/30 border-field flex min-h-
|
|
196
|
+
'bg-field/20 dark:bg-field/30 border-field flex min-h-(--input-height) flex-wrap items-center gap-1 rounded-(--input-radius) border bg-clip-padding px-2 py-0.5 text-xs/relaxed has-data-[slot=combobox-chip]:px-1',
|
|
197
197
|
className,
|
|
198
198
|
)}
|
|
199
199
|
{...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
|
-
'border-field bg-field/20 dark:bg-field/30 h-
|
|
16
|
+
'border-field bg-field/20 dark:bg-field/30 h-(--input-height) 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-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[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-0 items-center outline-none has-[>textarea]:h-auto',
|
|
17
17
|
className,
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
package/src/_internal/input.tsx
CHANGED
|
@@ -11,7 +11,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
|
11
11
|
className={cn(
|
|
12
12
|
FOCUS_RING,
|
|
13
13
|
HOVER_RING,
|
|
14
|
-
'bg-field/20 dark:bg-field/30 border-field h-
|
|
14
|
+
'bg-field/20 dark:bg-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',
|
|
15
15
|
className,
|
|
16
16
|
)}
|
|
17
17
|
{...props}
|
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-field/20 dark:bg-field/30 dark:hover:bg-field/50 gap-1.5 rounded-
|
|
43
|
+
"border-field data-[placeholder]:text-muted-foreground bg-field/20 dark:bg-field/30 dark:hover:bg-field/50 gap-1.5 rounded-(--input-radius) border px-2 py-1.5 text-xs/relaxed data-[size=default]:h-(--input-height) data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit 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}
|
|
@@ -9,7 +9,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
|
|
9
9
|
className={cn(
|
|
10
10
|
FOCUS_RING,
|
|
11
11
|
HOVER_RING,
|
|
12
|
-
'border-field bg-field/20 dark:bg-field/30 resize-none rounded-
|
|
12
|
+
'border-field bg-field/20 dark:bg-field/30 resize-none rounded-(--input-radius) border px-2 py-2 text-sm md:text-xs/relaxed placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
13
13
|
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
@@ -18,6 +18,8 @@ import { Badge as BadgePrimitive, type badgeVariants } from '../_internal/badge'
|
|
|
18
18
|
export interface BadgeProps extends Omit<useRender.ComponentProps<'span'>, 'size'> {
|
|
19
19
|
/** Visual style variant. @default 'default' */
|
|
20
20
|
variant?: VariantProps<typeof badgeVariants>['variant']
|
|
21
|
+
/** Size variant. @default 'default' */
|
|
22
|
+
size?: VariantProps<typeof badgeVariants>['size']
|
|
21
23
|
/** Corner shape. 'pill' forces full rounding regardless of theme. @default 'default' */
|
|
22
24
|
shape?: VariantProps<typeof badgeVariants>['shape']
|
|
23
25
|
className?: string
|
|
@@ -26,6 +28,7 @@ export interface BadgeProps extends Omit<useRender.ComponentProps<'span'>, 'size
|
|
|
26
28
|
|
|
27
29
|
function Badge({
|
|
28
30
|
variant = 'default',
|
|
31
|
+
size = 'default',
|
|
29
32
|
shape = 'default',
|
|
30
33
|
className,
|
|
31
34
|
children,
|
|
@@ -35,6 +38,7 @@ function Badge({
|
|
|
35
38
|
return (
|
|
36
39
|
<BadgePrimitive
|
|
37
40
|
variant={variant}
|
|
41
|
+
size={size}
|
|
38
42
|
shape={shape}
|
|
39
43
|
className={className}
|
|
40
44
|
render={render}
|
|
@@ -11,6 +11,9 @@ import { Typography } from '../../_internal/typography'
|
|
|
11
11
|
|
|
12
12
|
import { colorTokens, colorCategories, colorTokensByCategory, ColorTokenRow } from './color-editor'
|
|
13
13
|
import {
|
|
14
|
+
controlShapeTokens,
|
|
15
|
+
controlSizeTokens,
|
|
16
|
+
FactorSliderRow,
|
|
14
17
|
spacingTokens,
|
|
15
18
|
borderWidthTokens,
|
|
16
19
|
radiusTokens,
|
|
@@ -270,6 +273,26 @@ export function TokenConfigPanel({
|
|
|
270
273
|
</div>
|
|
271
274
|
<Separator className="my-3" />
|
|
272
275
|
|
|
276
|
+
<div className="mb-4">
|
|
277
|
+
<SectionHeader>Control Shape</SectionHeader>
|
|
278
|
+
<VStack gap={1}>
|
|
279
|
+
{controlShapeTokens.map((t) => (
|
|
280
|
+
<FactorSliderRow key={t.cssVar} token={t} onApply={applyOverride} />
|
|
281
|
+
))}
|
|
282
|
+
</VStack>
|
|
283
|
+
</div>
|
|
284
|
+
<Separator className="my-3" />
|
|
285
|
+
|
|
286
|
+
<div className="mb-4">
|
|
287
|
+
<SectionHeader>Control Size</SectionHeader>
|
|
288
|
+
<VStack gap={1}>
|
|
289
|
+
{controlSizeTokens.map((t) => (
|
|
290
|
+
<FactorSliderRow key={t.cssVar} token={t} onApply={applyOverride} />
|
|
291
|
+
))}
|
|
292
|
+
</VStack>
|
|
293
|
+
</div>
|
|
294
|
+
<Separator className="my-3" />
|
|
295
|
+
|
|
273
296
|
<div className="mb-4">
|
|
274
297
|
<SectionHeader>Font Size</SectionHeader>
|
|
275
298
|
<VStack gap={1}>
|
|
@@ -5,8 +5,9 @@ import { HStack } from '../../_internal/stack'
|
|
|
5
5
|
import { Typography } from '../../_internal/typography'
|
|
6
6
|
import { FormInput } from '../form-input'
|
|
7
7
|
import { FormSlider } from '../form-slider'
|
|
8
|
+
import { FormSwitch } from '../form-switch'
|
|
8
9
|
|
|
9
|
-
import type { DimensionToken, StringToken } from './types'
|
|
10
|
+
import type { DimensionToken, FactorToken, StringToken } from './types'
|
|
10
11
|
import { getResolvedDimension, parseNumericValue } from './helpers'
|
|
11
12
|
|
|
12
13
|
/* ------------------------------------------------------------------ */
|
|
@@ -49,6 +50,71 @@ export const radiusTokens: DimensionToken[] = [
|
|
|
49
50
|
},
|
|
50
51
|
]
|
|
51
52
|
|
|
53
|
+
/* Component dimensions are edited as multipliers of their base token so they
|
|
54
|
+
track --radius/--spacing by default; the override is written as a calc()
|
|
55
|
+
expression, never a detached absolute value (except the pill escape hatch). */
|
|
56
|
+
export const controlShapeTokens: FactorToken[] = [
|
|
57
|
+
{
|
|
58
|
+
cssVar: '--button-radius',
|
|
59
|
+
label: 'Button radius',
|
|
60
|
+
base: '--radius',
|
|
61
|
+
defaultFactor: 0.8,
|
|
62
|
+
min: 0,
|
|
63
|
+
max: 3,
|
|
64
|
+
step: 0.1,
|
|
65
|
+
allowPill: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
cssVar: '--badge-radius',
|
|
69
|
+
label: 'Badge radius',
|
|
70
|
+
base: '--radius',
|
|
71
|
+
defaultFactor: 2.6,
|
|
72
|
+
min: 0,
|
|
73
|
+
max: 3,
|
|
74
|
+
step: 0.1,
|
|
75
|
+
allowPill: true,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
cssVar: '--input-radius',
|
|
79
|
+
label: 'Input radius',
|
|
80
|
+
base: '--radius',
|
|
81
|
+
defaultFactor: 0.8,
|
|
82
|
+
min: 0,
|
|
83
|
+
max: 3,
|
|
84
|
+
step: 0.1,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
cssVar: '--card-radius',
|
|
88
|
+
label: 'Card radius',
|
|
89
|
+
base: '--radius',
|
|
90
|
+
defaultFactor: 1,
|
|
91
|
+
min: 0,
|
|
92
|
+
max: 3,
|
|
93
|
+
step: 0.1,
|
|
94
|
+
},
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
export const controlSizeTokens: FactorToken[] = [
|
|
98
|
+
{
|
|
99
|
+
cssVar: '--input-height',
|
|
100
|
+
label: 'Input height',
|
|
101
|
+
base: '--spacing',
|
|
102
|
+
defaultFactor: 7,
|
|
103
|
+
min: 5,
|
|
104
|
+
max: 14,
|
|
105
|
+
step: 0.5,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
cssVar: '--card-padding',
|
|
109
|
+
label: 'Card padding',
|
|
110
|
+
base: '--spacing',
|
|
111
|
+
defaultFactor: 4,
|
|
112
|
+
min: 2,
|
|
113
|
+
max: 10,
|
|
114
|
+
step: 0.5,
|
|
115
|
+
},
|
|
116
|
+
]
|
|
117
|
+
|
|
52
118
|
export const typographySizeTokens: DimensionToken[] = [
|
|
53
119
|
{
|
|
54
120
|
cssVar: '--font-size-base',
|
|
@@ -284,6 +350,95 @@ export function DimensionSliderRow({
|
|
|
284
350
|
)
|
|
285
351
|
}
|
|
286
352
|
|
|
353
|
+
/* ------------------------------------------------------------------ */
|
|
354
|
+
/* FactorSliderRow — edits calc(var(base) * factor) component tokens */
|
|
355
|
+
/* ------------------------------------------------------------------ */
|
|
356
|
+
|
|
357
|
+
export function FactorSliderRow({
|
|
358
|
+
token,
|
|
359
|
+
onApply,
|
|
360
|
+
}: {
|
|
361
|
+
token: FactorToken
|
|
362
|
+
onApply: (cssVar: string, value: string) => void
|
|
363
|
+
}) {
|
|
364
|
+
const [state, setState] = React.useState(() => {
|
|
365
|
+
const resolved = getResolvedDimension(token.cssVar)
|
|
366
|
+
if (token.allowPill && resolved.includes('9999')) {
|
|
367
|
+
return { factor: token.defaultFactor, pill: true }
|
|
368
|
+
}
|
|
369
|
+
const own = parseNumericValue(resolved)
|
|
370
|
+
const base = parseNumericValue(getResolvedDimension(token.base))
|
|
371
|
+
const factor = own > 0 && base > 0 ? Math.round((own / base) * 100) / 100 : token.defaultFactor
|
|
372
|
+
return { factor, pill: false }
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
function applyFactor(factor: number) {
|
|
376
|
+
setState({ factor, pill: false })
|
|
377
|
+
onApply(token.cssVar, `calc(var(${token.base}) * ${factor})`)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function handleChange(newVal: number | readonly number[]) {
|
|
381
|
+
applyFactor(Array.isArray(newVal) ? newVal[0] : newVal)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function handleInputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
385
|
+
const num = Number.parseFloat(e.target.value)
|
|
386
|
+
if (!Number.isNaN(num)) {
|
|
387
|
+
applyFactor(Math.min(token.max, Math.max(token.min, num)))
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function handlePillChange(pill: boolean) {
|
|
392
|
+
setState((previous) => ({ ...previous, pill }))
|
|
393
|
+
if (pill) {
|
|
394
|
+
onApply(token.cssVar, '9999px')
|
|
395
|
+
} else {
|
|
396
|
+
onApply(token.cssVar, `calc(var(${token.base}) * ${state.factor})`)
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return (
|
|
401
|
+
<HStack gap={3} align="end" className="py-1">
|
|
402
|
+
<div className="flex-1">
|
|
403
|
+
<FormSlider
|
|
404
|
+
label={`${token.label} (× ${token.base})`}
|
|
405
|
+
orientation="vertical"
|
|
406
|
+
value={[state.factor]}
|
|
407
|
+
onValueChange={handleChange}
|
|
408
|
+
min={token.min}
|
|
409
|
+
max={token.max}
|
|
410
|
+
step={token.step}
|
|
411
|
+
disabled={state.pill}
|
|
412
|
+
showValue
|
|
413
|
+
valueFormatter={(v) => {
|
|
414
|
+
if (state.pill) return 'pill'
|
|
415
|
+
const n = Array.isArray(v) ? v[0] : v
|
|
416
|
+
return `× ${n}`
|
|
417
|
+
}}
|
|
418
|
+
/>
|
|
419
|
+
</div>
|
|
420
|
+
<FormInput
|
|
421
|
+
className="w-20 shrink-0"
|
|
422
|
+
type="number"
|
|
423
|
+
value={state.factor}
|
|
424
|
+
onChange={handleInputChange}
|
|
425
|
+
step={token.step}
|
|
426
|
+
min={token.min}
|
|
427
|
+
max={token.max}
|
|
428
|
+
disabled={state.pill}
|
|
429
|
+
/>
|
|
430
|
+
{token.allowPill && (
|
|
431
|
+
<FormSwitch
|
|
432
|
+
className="shrink-0 pb-1"
|
|
433
|
+
label="Pill"
|
|
434
|
+
checked={state.pill}
|
|
435
|
+
onCheckedChange={handlePillChange}
|
|
436
|
+
/>
|
|
437
|
+
)}
|
|
438
|
+
</HStack>
|
|
439
|
+
)
|
|
440
|
+
}
|
|
441
|
+
|
|
287
442
|
/* ------------------------------------------------------------------ */
|
|
288
443
|
/* StringTokenRow */
|
|
289
444
|
/* ------------------------------------------------------------------ */
|
|
@@ -19,6 +19,19 @@ export interface DimensionToken {
|
|
|
19
19
|
unit: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface FactorToken {
|
|
23
|
+
cssVar: string
|
|
24
|
+
label: string
|
|
25
|
+
/** Base token the factor multiplies — the override is written as calc(var(base) * factor). */
|
|
26
|
+
base: '--radius' | '--spacing'
|
|
27
|
+
defaultFactor: number
|
|
28
|
+
min: number
|
|
29
|
+
max: number
|
|
30
|
+
step: number
|
|
31
|
+
/** Offers a "Pill" toggle that writes 9999px instead of a factor. */
|
|
32
|
+
allowPill?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
export interface StringToken {
|
|
23
36
|
cssVar: string
|
|
24
37
|
label: string
|
|
@@ -130,13 +130,8 @@
|
|
|
130
130
|
--font-heading: 'Space Grotesk Variable', 'Arial', sans-serif;
|
|
131
131
|
--font-brand: 'Space Grotesk Variable', 'Arial', sans-serif;
|
|
132
132
|
--button-radius: 0px;
|
|
133
|
-
--button-padding-x: calc(var(--spacing) * 5);
|
|
134
|
-
--button-padding-y: calc(var(--spacing) * 2);
|
|
135
133
|
--card-radius: 0px;
|
|
136
134
|
--card-padding: calc(var(--spacing) * 6);
|
|
137
|
-
--nav-height: calc(var(--spacing) * 14);
|
|
138
|
-
--section-padding-y: calc(var(--spacing) * 20);
|
|
139
|
-
--hero-padding-y: calc(var(--spacing) * 32);
|
|
140
135
|
--input-radius: 0px;
|
|
141
136
|
--input-height: calc(var(--spacing) * 10);
|
|
142
137
|
--badge-radius: 0px;
|
|
@@ -130,15 +130,10 @@
|
|
|
130
130
|
--font-heading: 'Inter Variable', sans-serif;
|
|
131
131
|
--font-brand: 'Bricolage Grotesque Variable', sans-serif;
|
|
132
132
|
--button-radius: var(--radius-md);
|
|
133
|
-
--button-padding-x: calc(var(--spacing) * 4);
|
|
134
|
-
--button-padding-y: calc(var(--spacing) * 2);
|
|
135
133
|
--card-radius: var(--radius-lg);
|
|
136
|
-
--card-padding: calc(var(--spacing) *
|
|
137
|
-
--nav-height: calc(var(--spacing) * 16);
|
|
138
|
-
--section-padding-y: calc(var(--spacing) * 24);
|
|
139
|
-
--hero-padding-y: calc(var(--spacing) * 40);
|
|
134
|
+
--card-padding: calc(var(--spacing) * 4);
|
|
140
135
|
--input-radius: var(--radius-md);
|
|
141
|
-
--input-height: calc(var(--spacing) *
|
|
136
|
+
--input-height: calc(var(--spacing) * 7);
|
|
142
137
|
--badge-radius: var(--radius-4xl);
|
|
143
138
|
--motion-duration-fast: 100ms;
|
|
144
139
|
--motion-duration-normal: 200ms;
|
|
@@ -130,13 +130,8 @@
|
|
|
130
130
|
--font-heading: 'Space Grotesk Variable', 'IBM Plex Sans', sans-serif;
|
|
131
131
|
--font-brand: 'JetBrains Mono Variable', 'IBM Plex Mono', monospace;
|
|
132
132
|
--button-radius: var(--radius-4xl);
|
|
133
|
-
--button-padding-x: calc(var(--spacing) * 6);
|
|
134
|
-
--button-padding-y: calc(var(--spacing) * 2.5);
|
|
135
133
|
--card-radius: var(--radius-2xl);
|
|
136
134
|
--card-padding: calc(var(--spacing) * 7);
|
|
137
|
-
--nav-height: calc(var(--spacing) * 16);
|
|
138
|
-
--section-padding-y: calc(var(--spacing) * 28);
|
|
139
|
-
--hero-padding-y: calc(var(--spacing) * 40);
|
|
140
135
|
--input-radius: var(--radius-xl);
|
|
141
136
|
--input-height: calc(var(--spacing) * 12);
|
|
142
137
|
--badge-radius: var(--radius-4xl);
|
|
@@ -315,13 +310,8 @@
|
|
|
315
310
|
--dropdown-offset: 8;
|
|
316
311
|
--overlay-offset: 8;
|
|
317
312
|
--button-radius: var(--radius-4xl);
|
|
318
|
-
--button-padding-x: calc(var(--spacing) * 6);
|
|
319
|
-
--button-padding-y: calc(var(--spacing) * 2.5);
|
|
320
313
|
--card-radius: var(--radius-2xl);
|
|
321
314
|
--card-padding: calc(var(--spacing) * 7);
|
|
322
|
-
--nav-height: calc(var(--spacing) * 16);
|
|
323
|
-
--section-padding-y: calc(var(--spacing) * 28);
|
|
324
|
-
--hero-padding-y: calc(var(--spacing) * 40);
|
|
325
315
|
--input-radius: var(--radius-xl);
|
|
326
316
|
--input-height: calc(var(--spacing) * 12);
|
|
327
317
|
--badge-radius: var(--radius-4xl);
|
|
@@ -148,13 +148,8 @@ export const brutalist: Record<string, string> = {
|
|
|
148
148
|
// ── Phase 1a: Component tokens ────────────────────────────────────────
|
|
149
149
|
// Zero radius everywhere — things are what they are
|
|
150
150
|
'--button-radius': '0px',
|
|
151
|
-
'--button-padding-x': 'calc(var(--spacing) * 5)',
|
|
152
|
-
'--button-padding-y': 'calc(var(--spacing) * 2)',
|
|
153
151
|
'--card-radius': '0px',
|
|
154
152
|
'--card-padding': 'calc(var(--spacing) * 6)',
|
|
155
|
-
'--nav-height': 'calc(var(--spacing) * 14)',
|
|
156
|
-
'--section-padding-y': 'calc(var(--spacing) * 20)',
|
|
157
|
-
'--hero-padding-y': 'calc(var(--spacing) * 32)',
|
|
158
153
|
'--input-radius': '0px',
|
|
159
154
|
'--input-height': 'calc(var(--spacing) * 10)',
|
|
160
155
|
'--badge-radius': '0px',
|
|
@@ -134,15 +134,10 @@ export const defaultPreset: Record<string, string> = {
|
|
|
134
134
|
|
|
135
135
|
// ── Phase 1a: Component tokens ────────────────────────────────────────
|
|
136
136
|
'--button-radius': 'var(--radius-md)',
|
|
137
|
-
'--button-padding-x': 'calc(var(--spacing) * 4)',
|
|
138
|
-
'--button-padding-y': 'calc(var(--spacing) * 2)',
|
|
139
137
|
'--card-radius': 'var(--radius-lg)',
|
|
140
|
-
'--card-padding': 'calc(var(--spacing) *
|
|
141
|
-
'--nav-height': 'calc(var(--spacing) * 16)',
|
|
142
|
-
'--section-padding-y': 'calc(var(--spacing) * 24)',
|
|
143
|
-
'--hero-padding-y': 'calc(var(--spacing) * 40)',
|
|
138
|
+
'--card-padding': 'calc(var(--spacing) * 4)',
|
|
144
139
|
'--input-radius': 'var(--radius-md)',
|
|
145
|
-
'--input-height': 'calc(var(--spacing) *
|
|
140
|
+
'--input-height': 'calc(var(--spacing) * 7)',
|
|
146
141
|
'--badge-radius': 'var(--radius-4xl)',
|
|
147
142
|
|
|
148
143
|
// ── Phase 1b: Motion tokens ────────────────────────────────────────────
|
|
@@ -138,13 +138,8 @@ export const signalPop: Record<string, string> = {
|
|
|
138
138
|
|
|
139
139
|
// Component tokens
|
|
140
140
|
'--button-radius': 'var(--radius-4xl)',
|
|
141
|
-
'--button-padding-x': 'calc(var(--spacing) * 6)',
|
|
142
|
-
'--button-padding-y': 'calc(var(--spacing) * 2.5)',
|
|
143
141
|
'--card-radius': 'var(--radius-2xl)',
|
|
144
142
|
'--card-padding': 'calc(var(--spacing) * 7)',
|
|
145
|
-
'--nav-height': 'calc(var(--spacing) * 16)',
|
|
146
|
-
'--section-padding-y': 'calc(var(--spacing) * 28)',
|
|
147
|
-
'--hero-padding-y': 'calc(var(--spacing) * 40)',
|
|
148
143
|
'--input-radius': 'var(--radius-xl)',
|
|
149
144
|
'--input-height': 'calc(var(--spacing) * 12)',
|
|
150
145
|
'--badge-radius': 'var(--radius-4xl)',
|
|
@@ -318,13 +313,8 @@ export const signalPopDark: Record<string, string> = {
|
|
|
318
313
|
|
|
319
314
|
// Component tokens
|
|
320
315
|
'--button-radius': 'var(--radius-4xl)',
|
|
321
|
-
'--button-padding-x': 'calc(var(--spacing) * 6)',
|
|
322
|
-
'--button-padding-y': 'calc(var(--spacing) * 2.5)',
|
|
323
316
|
'--card-radius': 'var(--radius-2xl)',
|
|
324
317
|
'--card-padding': 'calc(var(--spacing) * 7)',
|
|
325
|
-
'--nav-height': 'calc(var(--spacing) * 16)',
|
|
326
|
-
'--section-padding-y': 'calc(var(--spacing) * 28)',
|
|
327
|
-
'--hero-padding-y': 'calc(var(--spacing) * 40)',
|
|
328
318
|
'--input-radius': 'var(--radius-xl)',
|
|
329
319
|
'--input-height': 'calc(var(--spacing) * 12)',
|
|
330
320
|
'--badge-radius': 'var(--radius-4xl)',
|
|
@@ -25,15 +25,10 @@
|
|
|
25
25
|
|
|
26
26
|
/* ── Component dimensions ──────────────────────────────────────────── */
|
|
27
27
|
--button-radius: var(--radius-md);
|
|
28
|
-
--button-padding-x: calc(var(--spacing) * 4);
|
|
29
|
-
--button-padding-y: calc(var(--spacing) * 2);
|
|
30
28
|
--card-radius: var(--radius-lg);
|
|
31
|
-
--card-padding: calc(var(--spacing) *
|
|
32
|
-
--nav-height: calc(var(--spacing) * 16);
|
|
33
|
-
--section-padding-y: calc(var(--spacing) * 24);
|
|
34
|
-
--hero-padding-y: calc(var(--spacing) * 40);
|
|
29
|
+
--card-padding: calc(var(--spacing) * 4);
|
|
35
30
|
--input-radius: var(--radius-md);
|
|
36
|
-
--input-height: calc(var(--spacing) *
|
|
31
|
+
--input-height: calc(var(--spacing) * 7);
|
|
37
32
|
--badge-radius: var(--radius-4xl);
|
|
38
33
|
|
|
39
34
|
/* ── Motion ────────────────────────────────────────────────────────── */
|