@yarcl/react 0.1.0 → 0.2.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 +14 -2
- package/{src/apply.ts → dist/apply.d.ts} +4 -23
- package/dist/apply.js +37 -0
- package/dist/classes.d.ts +13 -0
- package/dist/classes.js +22 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +58 -0
- package/dist/color.js +49 -32
- package/dist/components/Accordion.d.ts +96 -0
- package/dist/components/Accordion.js +148 -0
- package/dist/components/Alert.d.ts +60 -0
- package/dist/components/Alert.js +61 -0
- package/dist/components/Avatar.d.ts +100 -0
- package/dist/components/Avatar.js +89 -0
- package/dist/components/Badge.d.ts +44 -0
- package/dist/components/Badge.js +43 -0
- package/dist/components/Breadcrumb.d.ts +77 -0
- package/dist/components/Breadcrumb.js +126 -0
- package/dist/components/Button.d.ts +18 -0
- package/dist/components/Button.js +33 -0
- package/dist/components/ButtonGroup.d.ts +29 -0
- package/dist/components/ButtonGroup.js +37 -0
- package/dist/components/Card.d.ts +36 -0
- package/dist/components/Card.js +26 -0
- package/dist/components/Checkbox.d.ts +28 -0
- package/dist/components/Checkbox.js +38 -0
- package/dist/components/Combobox.d.ts +75 -0
- package/dist/components/Combobox.js +362 -0
- package/dist/components/CommandPalette.d.ts +92 -0
- package/dist/components/CommandPalette.js +293 -0
- package/dist/components/DatePicker.d.ts +157 -0
- package/dist/components/DatePicker.js +230 -0
- package/dist/components/Dialog.d.ts +25 -0
- package/dist/components/Dialog.js +29 -0
- package/dist/components/Divider.d.ts +23 -0
- package/dist/components/Divider.js +25 -0
- package/dist/components/Drawer.d.ts +21 -0
- package/dist/components/Drawer.js +25 -0
- package/dist/components/EmptyState.d.ts +51 -0
- package/dist/components/EmptyState.js +47 -0
- package/dist/components/Field.d.ts +27 -0
- package/dist/components/Field.js +59 -0
- package/dist/components/Heading.d.ts +26 -0
- package/dist/components/Heading.js +25 -0
- package/dist/components/HoverCard.d.ts +47 -0
- package/dist/components/HoverCard.js +53 -0
- package/dist/components/IconButton.d.ts +19 -0
- package/dist/components/IconButton.js +32 -0
- package/dist/components/Inline.d.ts +21 -0
- package/dist/components/Inline.js +24 -0
- package/dist/components/Input.d.ts +19 -0
- package/dist/components/Input.js +25 -0
- package/dist/components/Label.d.ts +46 -0
- package/dist/components/Label.js +33 -0
- package/dist/components/Link.d.ts +27 -0
- package/dist/components/Link.js +26 -0
- package/dist/components/Menu.d.ts +73 -0
- package/dist/components/Menu.js +143 -0
- package/dist/components/Modal.d.ts +45 -0
- package/dist/components/Modal.js +110 -0
- package/dist/components/NumberInput.d.ts +49 -0
- package/dist/components/NumberInput.js +130 -0
- package/dist/components/Pagination.d.ts +86 -0
- package/dist/components/Pagination.js +119 -0
- package/dist/components/Popover.d.ts +72 -0
- package/dist/components/Popover.js +87 -0
- package/dist/components/Progress.d.ts +60 -0
- package/dist/components/Progress.js +59 -0
- package/dist/components/Radio.d.ts +32 -0
- package/dist/components/Radio.js +47 -0
- package/dist/components/RadioGroup.d.ts +57 -0
- package/dist/components/RadioGroup.js +68 -0
- package/dist/components/Select.d.ts +47 -0
- package/dist/components/Select.js +138 -0
- package/dist/components/Skeleton.d.ts +46 -0
- package/dist/components/Skeleton.js +40 -0
- package/dist/components/Slider.d.ts +126 -0
- package/dist/components/Slider.js +166 -0
- package/dist/components/Spinner.d.ts +23 -0
- package/dist/components/Spinner.js +23 -0
- package/dist/components/Stack.d.ts +35 -0
- package/dist/components/Stack.js +24 -0
- package/dist/components/Switch.d.ts +27 -0
- package/dist/components/Switch.js +33 -0
- package/dist/components/Table.d.ts +71 -0
- package/dist/components/Table.js +61 -0
- package/dist/components/Tabs.d.ts +66 -0
- package/dist/components/Tabs.js +109 -0
- package/dist/components/Text.d.ts +32 -0
- package/dist/components/Text.js +28 -0
- package/dist/components/Textarea.d.ts +15 -0
- package/dist/components/Textarea.js +24 -0
- package/dist/components/Toast.d.ts +90 -0
- package/dist/components/Toast.js +156 -0
- package/dist/components/ToggleGroup.d.ts +79 -0
- package/dist/components/ToggleGroup.js +101 -0
- package/dist/components/Tooltip.d.ts +46 -0
- package/dist/components/Tooltip.js +62 -0
- package/dist/components/VisuallyHidden.d.ts +18 -0
- package/dist/components/VisuallyHidden.js +22 -0
- package/dist/contrast.d.ts +32 -0
- package/dist/css.d.ts +2 -2
- package/dist/css.js +193 -157
- package/dist/define.d.ts +40 -15
- package/dist/define.js +30 -27
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2 -0
- package/dist/esbuild.cjs +5 -0
- package/dist/esbuild.d.ts +4 -0
- package/dist/esbuild.js +6 -0
- package/dist/field-context.d.ts +16 -0
- package/dist/field-context.js +17 -0
- package/dist/floating.d.ts +12 -0
- package/dist/floating.js +52 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +12 -0
- package/{src/index.ts → dist/index.d.ts} +11 -33
- package/dist/index.js +50 -0
- package/dist/init.d.ts +18 -0
- package/dist/init.js +224 -0
- package/dist/plugin.d.ts +10 -26
- package/dist/plugin.js +152 -78
- package/dist/reference/DemoYarcl.d.ts +12 -0
- package/dist/reference/DemoYarcl.js +312 -0
- package/dist/reference/DesignReference.d.ts +24 -0
- package/dist/reference/DesignReference.js +403 -0
- package/dist/reference/index.js +2 -0
- package/dist/rollup.cjs +5 -0
- package/dist/rollup.d.ts +4 -0
- package/dist/rollup.js +6 -0
- package/dist/rspack.cjs +5 -0
- package/dist/rspack.d.ts +4 -0
- package/dist/rspack.js +6 -0
- package/dist/runtime.d.ts +13 -0
- package/dist/runtime.js +30 -0
- package/dist/setup.d.ts +6 -0
- package/dist/setup.js +33 -0
- package/{src → dist}/styles.css +224 -106
- package/dist/themes/bloom.d.ts +295 -0
- package/dist/themes/bloom.js +202 -0
- package/dist/themes/brutalist.d.ts +277 -0
- package/dist/themes/brutalist.js +199 -0
- package/dist/themes/compact.d.ts +274 -0
- package/dist/themes/compact.js +200 -0
- package/dist/themes/contract.d.ts +23 -0
- package/dist/themes/editorial.d.ts +277 -0
- package/dist/themes/editorial.js +183 -0
- package/dist/themes/index.d.ts +1425 -0
- package/dist/themes/index.js +45 -0
- package/{src/types.ts → dist/types.d.ts} +40 -37
- package/dist/vite.cjs +5 -0
- package/dist/vite.d.ts +4 -0
- package/dist/vite.js +6 -0
- package/dist/webpack.cjs +5 -0
- package/dist/webpack.d.ts +4 -0
- package/dist/webpack.js +6 -0
- package/dist/yarcl.config.d.ts +276 -0
- package/dist/yarcl.config.js +273 -0
- package/package.json +69 -17
- package/src/classes.ts +0 -23
- package/src/color.ts +0 -48
- package/src/components/Accordion.tsx +0 -274
- package/src/components/Alert.tsx +0 -85
- package/src/components/Badge.tsx +0 -79
- package/src/components/Breadcrumb.tsx +0 -239
- package/src/components/Button.tsx +0 -58
- package/src/components/ButtonGroup.tsx +0 -61
- package/src/components/Card.tsx +0 -50
- package/src/components/Checkbox.tsx +0 -49
- package/src/components/Combobox.tsx +0 -522
- package/src/components/CommandPalette.tsx +0 -452
- package/src/components/DatePicker.tsx +0 -432
- package/src/components/Dialog.tsx +0 -39
- package/src/components/Divider.tsx +0 -34
- package/src/components/Drawer.tsx +0 -31
- package/src/components/Field.tsx +0 -61
- package/src/components/Heading.tsx +0 -40
- package/src/components/HoverCard.tsx +0 -108
- package/src/components/IconButton.tsx +0 -59
- package/src/components/Inline.tsx +0 -42
- package/src/components/Input.tsx +0 -28
- package/src/components/Label.tsx +0 -58
- package/src/components/Link.tsx +0 -41
- package/src/components/Menu.tsx +0 -207
- package/src/components/Modal.tsx +0 -164
- package/src/components/NumberInput.tsx +0 -208
- package/src/components/Pagination.tsx +0 -227
- package/src/components/Popover.tsx +0 -140
- package/src/components/Progress.tsx +0 -122
- package/src/components/Radio.tsx +0 -59
- package/src/components/RadioGroup.tsx +0 -114
- package/src/components/Select.tsx +0 -197
- package/src/components/Skeleton.tsx +0 -95
- package/src/components/Slider.tsx +0 -315
- package/src/components/Spinner.tsx +0 -38
- package/src/components/Stack.tsx +0 -57
- package/src/components/Switch.tsx +0 -42
- package/src/components/Table.tsx +0 -99
- package/src/components/Tabs.tsx +0 -159
- package/src/components/Text.tsx +0 -67
- package/src/components/Textarea.tsx +0 -26
- package/src/components/Toast.tsx +0 -190
- package/src/components/ToggleGroup.tsx +0 -227
- package/src/components/Tooltip.tsx +0 -78
- package/src/contrast.ts +0 -82
- package/src/css.ts +0 -228
- package/src/define.check.ts +0 -259
- package/src/define.ts +0 -379
- package/src/field-context.ts +0 -31
- package/src/floating.tsx +0 -61
- package/src/hooks.ts +0 -19
- package/src/plugin.ts +0 -94
- package/src/reference/DesignReference.tsx +0 -374
- package/src/runtime.ts +0 -38
- package/src/themes/bloom.ts +0 -72
- package/src/themes/brutalist.ts +0 -63
- package/src/themes/compact.ts +0 -63
- package/src/themes/contract.ts +0 -24
- package/src/themes/editorial.ts +0 -55
- package/src/themes/index.ts +0 -47
- package/src/yarcl.config.ts +0 -104
- /package/{src/reference/index.ts → dist/reference/index.d.ts} +0 -0
- /package/{src → dist}/reference/reference.css +0 -0
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { contrast, parseHex, readableOn } from '../color';
|
|
3
|
-
import type { ColorPair, ColorToken, YarclShape } from '../define';
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Card,
|
|
7
|
-
Heading,
|
|
8
|
-
IconButton,
|
|
9
|
-
Inline,
|
|
10
|
-
Input,
|
|
11
|
-
Stack,
|
|
12
|
-
Table,
|
|
13
|
-
Text,
|
|
14
|
-
type Color,
|
|
15
|
-
type Density,
|
|
16
|
-
type Radius,
|
|
17
|
-
type Shadow,
|
|
18
|
-
type Size,
|
|
19
|
-
type Spacing,
|
|
20
|
-
type TextStyle,
|
|
21
|
-
type Variant,
|
|
22
|
-
} from '../index';
|
|
23
|
-
import { useConfig } from '../runtime';
|
|
24
|
-
import './reference.css';
|
|
25
|
-
|
|
26
|
-
const keys = <T extends string>(group: object) => Object.keys(group) as T[];
|
|
27
|
-
|
|
28
|
-
function ratio(background: string, token: ColorToken, mode: keyof ColorPair): string {
|
|
29
|
-
const bg = parseHex(background);
|
|
30
|
-
if (!bg) return 'n/a';
|
|
31
|
-
const onValue = typeof token.on === 'string' ? token.on : token.on?.[mode];
|
|
32
|
-
const fg = parseHex(onValue ?? readableOn(bg));
|
|
33
|
-
return fg ? `${contrast(bg, fg).toFixed(1)}:1` : 'n/a';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Section({ title, description, children }: { title: string; description?: ReactNode; children: ReactNode }) {
|
|
37
|
-
return (
|
|
38
|
-
<Stack as="section" className="yarcl-ref-section">
|
|
39
|
-
<Heading level={2}>{title}</Heading>
|
|
40
|
-
{description != null && (
|
|
41
|
-
<Text as="p" muted>
|
|
42
|
-
{description}
|
|
43
|
-
</Text>
|
|
44
|
-
)}
|
|
45
|
-
{children}
|
|
46
|
-
</Stack>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function Code({ children }: { children: ReactNode }) {
|
|
51
|
-
return <code className="yarcl-ref-code">{children}</code>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function KeyValues({ caption, rows }: { caption: string; rows: [string, ReactNode][] }) {
|
|
55
|
-
const config = useConfig();
|
|
56
|
-
return (
|
|
57
|
-
<Table caption={caption} density={config.defaults.density}>
|
|
58
|
-
<Table.Body>
|
|
59
|
-
{rows.map(([key, value]) => (
|
|
60
|
-
<Table.Row key={key}>
|
|
61
|
-
<Table.HeaderCell scope="row">{key}</Table.HeaderCell>
|
|
62
|
-
<Table.Cell>{value}</Table.Cell>
|
|
63
|
-
</Table.Row>
|
|
64
|
-
))}
|
|
65
|
-
</Table.Body>
|
|
66
|
-
</Table>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const pair = (value: ColorPair) => (
|
|
71
|
-
<>
|
|
72
|
-
<Code>{value.light}</Code> / <Code>{value.dark}</Code>
|
|
73
|
-
</>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
/** Props for {@link DesignReference}. */
|
|
77
|
-
export interface DesignReferenceProps {
|
|
78
|
-
/**
|
|
79
|
-
* Page heading.
|
|
80
|
-
* @default 'Design reference'
|
|
81
|
-
*/
|
|
82
|
-
title?: ReactNode;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* A living reference of the active design system, rendered from the consumer's config:
|
|
87
|
-
* colors with contrast ratios, the size scale with live controls, radii, variants, spacing,
|
|
88
|
-
* shadows, fonts, text styles, heading levels, density, other tokens and defaults.
|
|
89
|
-
* Import from `@yarcl/react/reference`.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```tsx
|
|
93
|
-
* import { DesignReference } from '@yarcl/react/reference';
|
|
94
|
-
*
|
|
95
|
-
* <DesignReference title="Acme design system" />
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
export function DesignReference({ title = 'Design reference' }: DesignReferenceProps) {
|
|
99
|
-
const config = useConfig();
|
|
100
|
-
const shape = config as unknown as YarclShape;
|
|
101
|
-
const colors = keys<Color>(config.colors);
|
|
102
|
-
const variants = keys<Variant>(config.variants);
|
|
103
|
-
const { typography } = shape;
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<Stack gap={config.defaults.padding} className="yarcl-ref">
|
|
107
|
-
<Heading level={1}>{title}</Heading>
|
|
108
|
-
|
|
109
|
-
<Section title="Colors" description="Semantic colors for the color prop. Ratios are foreground on background, light / dark.">
|
|
110
|
-
<div className="yarcl-ref-grid">
|
|
111
|
-
{colors.map((key) => {
|
|
112
|
-
const token = shape.colors[key];
|
|
113
|
-
return (
|
|
114
|
-
<Card key={key} padding={config.defaults.gap} className="yarcl-ref-color">
|
|
115
|
-
<div className={`yarcl-ref-swatch yarcl-color-${key}`}>Aa</div>
|
|
116
|
-
<Stack gap={config.defaults.gap}>
|
|
117
|
-
<Text textStyle={config.defaults.labelStyle}>{key}</Text>
|
|
118
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
119
|
-
{pair(token)}
|
|
120
|
-
</Text>
|
|
121
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
122
|
-
{ratio(token.light, token, 'light')} / {ratio(token.dark, token, 'dark')}
|
|
123
|
-
</Text>
|
|
124
|
-
</Stack>
|
|
125
|
-
</Card>
|
|
126
|
-
);
|
|
127
|
-
})}
|
|
128
|
-
</div>
|
|
129
|
-
</Section>
|
|
130
|
-
|
|
131
|
-
<Section title="Neutrals" description="Backgrounds, text and borders.">
|
|
132
|
-
<div className="yarcl-ref-grid">
|
|
133
|
-
{Object.entries(shape.neutrals).map(([key, value]) => (
|
|
134
|
-
<Card key={key} padding={config.defaults.gap} className="yarcl-ref-color">
|
|
135
|
-
<div className="yarcl-ref-swatch yarcl-ref-neutral" style={{ background: `var(--yarcl-neutral-${key})` }} />
|
|
136
|
-
<Text textStyle={config.defaults.labelStyle}>{key}</Text>
|
|
137
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
138
|
-
{pair(value)}
|
|
139
|
-
</Text>
|
|
140
|
-
</Card>
|
|
141
|
-
))}
|
|
142
|
-
</div>
|
|
143
|
-
</Section>
|
|
144
|
-
|
|
145
|
-
<Section title="Sizes" description="One scale shared by every control, so controls of the same size line up.">
|
|
146
|
-
<Table caption="Control sizes" density={config.defaults.density}>
|
|
147
|
-
<Table.Head>
|
|
148
|
-
<Table.Row>
|
|
149
|
-
<Table.HeaderCell>Size</Table.HeaderCell>
|
|
150
|
-
<Table.HeaderCell>Height</Table.HeaderCell>
|
|
151
|
-
<Table.HeaderCell>Padding X</Table.HeaderCell>
|
|
152
|
-
<Table.HeaderCell>Font</Table.HeaderCell>
|
|
153
|
-
<Table.HeaderCell>Icon</Table.HeaderCell>
|
|
154
|
-
<Table.HeaderCell>Preview</Table.HeaderCell>
|
|
155
|
-
</Table.Row>
|
|
156
|
-
</Table.Head>
|
|
157
|
-
<Table.Body>
|
|
158
|
-
{keys<Size>(config.sizes).map((key) => {
|
|
159
|
-
const size = shape.sizes[key];
|
|
160
|
-
return (
|
|
161
|
-
<Table.Row key={key}>
|
|
162
|
-
<Table.HeaderCell scope="row">{key}</Table.HeaderCell>
|
|
163
|
-
<Table.Cell>
|
|
164
|
-
<Code>{size.height}</Code>
|
|
165
|
-
</Table.Cell>
|
|
166
|
-
<Table.Cell>
|
|
167
|
-
<Code>{size.paddingX}</Code>
|
|
168
|
-
</Table.Cell>
|
|
169
|
-
<Table.Cell>
|
|
170
|
-
<Code>{size.fontSize}</Code>
|
|
171
|
-
</Table.Cell>
|
|
172
|
-
<Table.Cell>
|
|
173
|
-
<Code>{size.iconSize}</Code>
|
|
174
|
-
</Table.Cell>
|
|
175
|
-
<Table.Cell>
|
|
176
|
-
<Inline gap={config.defaults.gap} wrap={false}>
|
|
177
|
-
<Input size={key} placeholder="Input" aria-label={`Input ${key}`} className="yarcl-ref-input" />
|
|
178
|
-
<Button size={key}>Button</Button>
|
|
179
|
-
<IconButton size={key} aria-label="Add">
|
|
180
|
-
+
|
|
181
|
-
</IconButton>
|
|
182
|
-
</Inline>
|
|
183
|
-
</Table.Cell>
|
|
184
|
-
</Table.Row>
|
|
185
|
-
);
|
|
186
|
-
})}
|
|
187
|
-
</Table.Body>
|
|
188
|
-
</Table>
|
|
189
|
-
</Section>
|
|
190
|
-
|
|
191
|
-
<Section
|
|
192
|
-
title="Radii"
|
|
193
|
-
description={
|
|
194
|
-
shape.defaults.radius === 'size'
|
|
195
|
-
? 'Controls use the radius named like their size; other keys are exceptions.'
|
|
196
|
-
: `Default radius: ${shape.defaults.radius}.`
|
|
197
|
-
}
|
|
198
|
-
>
|
|
199
|
-
<Inline>
|
|
200
|
-
{keys<Radius>(config.radii).map((key) => (
|
|
201
|
-
<Stack key={key} gap={config.defaults.gap} align="center">
|
|
202
|
-
<div className={`yarcl-ref-radius yarcl-radius-${key}`} />
|
|
203
|
-
<Text textStyle={config.defaults.labelStyle}>{key}</Text>
|
|
204
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
205
|
-
<Code>{shape.radii[key]}</Code>
|
|
206
|
-
</Text>
|
|
207
|
-
</Stack>
|
|
208
|
-
))}
|
|
209
|
-
</Inline>
|
|
210
|
-
</Section>
|
|
211
|
-
|
|
212
|
-
<Section title="Variants" description="Recipes applied on top of any color.">
|
|
213
|
-
{variants.map((key) => {
|
|
214
|
-
const recipe = shape.variants[key];
|
|
215
|
-
return (
|
|
216
|
-
<Inline key={key}>
|
|
217
|
-
<Text textStyle={config.defaults.labelStyle} className="yarcl-ref-label">
|
|
218
|
-
{key}
|
|
219
|
-
</Text>
|
|
220
|
-
{colors.map((color) => (
|
|
221
|
-
<Button key={color} variant={key} color={color} size={config.defaults.size}>
|
|
222
|
-
{color}
|
|
223
|
-
</Button>
|
|
224
|
-
))}
|
|
225
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
226
|
-
background <Code>{recipe.background}</Code>, border <Code>{recipe.border}</Code>, text <Code>{recipe.text}</Code>
|
|
227
|
-
</Text>
|
|
228
|
-
</Inline>
|
|
229
|
-
);
|
|
230
|
-
})}
|
|
231
|
-
</Section>
|
|
232
|
-
|
|
233
|
-
<Section title="Spacing">
|
|
234
|
-
{keys<Spacing>(config.spacing).map((key) => (
|
|
235
|
-
<Inline key={key}>
|
|
236
|
-
<Text textStyle={config.defaults.labelStyle} className="yarcl-ref-label">
|
|
237
|
-
{key}
|
|
238
|
-
</Text>
|
|
239
|
-
<div className="yarcl-ref-space" style={{ width: `var(--yarcl-space-${key})` }} />
|
|
240
|
-
<Code>{shape.spacing[key]}</Code>
|
|
241
|
-
</Inline>
|
|
242
|
-
))}
|
|
243
|
-
</Section>
|
|
244
|
-
|
|
245
|
-
<Section title="Shadows">
|
|
246
|
-
<Inline gap={config.defaults.padding}>
|
|
247
|
-
{keys<Shadow>(config.shadows).map((key) => (
|
|
248
|
-
<Card key={key} shadow={key} className="yarcl-ref-shadow">
|
|
249
|
-
<Text textStyle={config.defaults.labelStyle}>{key}</Text>
|
|
250
|
-
</Card>
|
|
251
|
-
))}
|
|
252
|
-
</Inline>
|
|
253
|
-
</Section>
|
|
254
|
-
|
|
255
|
-
<Section title="Typography">
|
|
256
|
-
{(typography.fontFaces?.length ?? 0) > 0 && (
|
|
257
|
-
<Table caption="Font files" density={config.defaults.density}>
|
|
258
|
-
<Table.Head>
|
|
259
|
-
<Table.Row>
|
|
260
|
-
<Table.HeaderCell>Family</Table.HeaderCell>
|
|
261
|
-
<Table.HeaderCell>Source</Table.HeaderCell>
|
|
262
|
-
<Table.HeaderCell>Weight</Table.HeaderCell>
|
|
263
|
-
<Table.HeaderCell>Style</Table.HeaderCell>
|
|
264
|
-
</Table.Row>
|
|
265
|
-
</Table.Head>
|
|
266
|
-
<Table.Body>
|
|
267
|
-
{typography.fontFaces!.map((face, i) => (
|
|
268
|
-
<Table.Row key={i}>
|
|
269
|
-
<Table.Cell>{face.family}</Table.Cell>
|
|
270
|
-
<Table.Cell>
|
|
271
|
-
<Code>{[face.src].flat().join(', ')}</Code>
|
|
272
|
-
</Table.Cell>
|
|
273
|
-
<Table.Cell>{face.weight ?? 'n/a'}</Table.Cell>
|
|
274
|
-
<Table.Cell>{face.style ?? 'normal'}</Table.Cell>
|
|
275
|
-
</Table.Row>
|
|
276
|
-
))}
|
|
277
|
-
</Table.Body>
|
|
278
|
-
</Table>
|
|
279
|
-
)}
|
|
280
|
-
<KeyValues
|
|
281
|
-
caption="Families"
|
|
282
|
-
rows={Object.entries(typography.families).map(([key, stack]) => [
|
|
283
|
-
key,
|
|
284
|
-
<span style={{ fontFamily: `var(--yarcl-font-${key})` }}>
|
|
285
|
-
The quick brown fox <Code>{stack}</Code>
|
|
286
|
-
</span>,
|
|
287
|
-
])}
|
|
288
|
-
/>
|
|
289
|
-
<Table caption="Text styles" density={config.defaults.density}>
|
|
290
|
-
<Table.Body>
|
|
291
|
-
{keys<TextStyle>(config.typography.styles).map((key) => {
|
|
292
|
-
const style = typography.styles[key];
|
|
293
|
-
return (
|
|
294
|
-
<Table.Row key={key}>
|
|
295
|
-
<Table.HeaderCell scope="row">{key}</Table.HeaderCell>
|
|
296
|
-
<Table.Cell>
|
|
297
|
-
<Text textStyle={key}>The quick brown fox</Text>
|
|
298
|
-
</Table.Cell>
|
|
299
|
-
<Table.Cell>
|
|
300
|
-
<Text textStyle={config.defaults.helperStyle} muted>
|
|
301
|
-
{style.family} · {style.size} · {style.weight} · {style.lineHeight}
|
|
302
|
-
{style.letterSpacing ? ` · ${style.letterSpacing}` : ''}
|
|
303
|
-
</Text>
|
|
304
|
-
</Table.Cell>
|
|
305
|
-
</Table.Row>
|
|
306
|
-
);
|
|
307
|
-
})}
|
|
308
|
-
</Table.Body>
|
|
309
|
-
</Table>
|
|
310
|
-
<KeyValues
|
|
311
|
-
caption="Heading levels"
|
|
312
|
-
rows={(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const).map((level) => [
|
|
313
|
-
level,
|
|
314
|
-
<Text textStyle={config.typography.headings[level]}>
|
|
315
|
-
{typography.headings[level]}
|
|
316
|
-
</Text>,
|
|
317
|
-
])}
|
|
318
|
-
/>
|
|
319
|
-
</Section>
|
|
320
|
-
|
|
321
|
-
<Section title="Modal sizes" description="Widths of dialogs and drawers.">
|
|
322
|
-
<KeyValues
|
|
323
|
-
caption="Modal sizes"
|
|
324
|
-
rows={Object.entries(shape.modalSizes).map(([key, value]): [string, ReactNode] => [key, <Code>{value}</Code>])}
|
|
325
|
-
/>
|
|
326
|
-
</Section>
|
|
327
|
-
|
|
328
|
-
<Section title="Density">
|
|
329
|
-
<KeyValues
|
|
330
|
-
caption="Table density"
|
|
331
|
-
rows={keys<Density>(config.density).map((key) => {
|
|
332
|
-
const density = shape.density[key];
|
|
333
|
-
return [key, <Code>{`${density.paddingY} ${density.paddingX} · ${density.fontSize}`}</Code>];
|
|
334
|
-
})}
|
|
335
|
-
/>
|
|
336
|
-
</Section>
|
|
337
|
-
|
|
338
|
-
<Section title="Other tokens">
|
|
339
|
-
<KeyValues
|
|
340
|
-
caption="Layers, motion, borders and focus"
|
|
341
|
-
rows={[
|
|
342
|
-
...Object.entries(shape.zIndex).map(([k, v]): [string, ReactNode] => [`zIndex.${k}`, <Code>{v}</Code>]),
|
|
343
|
-
...Object.entries(shape.motion).map(([k, v]): [string, ReactNode] => [`motion.${k}`, <Code>{v}</Code>]),
|
|
344
|
-
...Object.entries(shape.borders).map(([k, v]): [string, ReactNode] => [`borders.${k}`, <Code>{v}</Code>]),
|
|
345
|
-
['focusRing', <Code>{`${shape.focusRing.width} · offset ${shape.focusRing.offset} · ${shape.focusRing.color}`}</Code>],
|
|
346
|
-
]}
|
|
347
|
-
/>
|
|
348
|
-
</Section>
|
|
349
|
-
|
|
350
|
-
<Section
|
|
351
|
-
title="Defaults"
|
|
352
|
-
description="Values used when a component prop is omitted: the prop, then an enclosing group, then component defaults, then global defaults."
|
|
353
|
-
>
|
|
354
|
-
{Object.keys(shape.components ?? {}).length > 0 && (
|
|
355
|
-
<KeyValues
|
|
356
|
-
caption="Component defaults"
|
|
357
|
-
rows={Object.entries(shape.components ?? {}).map(([name, values]): [string, ReactNode] => [
|
|
358
|
-
name,
|
|
359
|
-
<Code>
|
|
360
|
-
{Object.entries(values ?? {})
|
|
361
|
-
.map(([prop, value]) => `${prop}: ${value}`)
|
|
362
|
-
.join(' · ')}
|
|
363
|
-
</Code>,
|
|
364
|
-
])}
|
|
365
|
-
/>
|
|
366
|
-
)}
|
|
367
|
-
<KeyValues
|
|
368
|
-
caption="Global defaults"
|
|
369
|
-
rows={Object.entries(shape.defaults).map(([key, value]): [string, ReactNode] => [key, <Code>{value}</Code>])}
|
|
370
|
-
/>
|
|
371
|
-
</Section>
|
|
372
|
-
</Stack>
|
|
373
|
-
);
|
|
374
|
-
}
|
package/src/runtime.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import buildConfig from '@yarcl/config';
|
|
2
|
-
import { useSyncExternalStore } from 'react';
|
|
3
|
-
import type { ComponentName, YarclShape } from './define';
|
|
4
|
-
import type { ComponentDefaults } from './types';
|
|
5
|
-
|
|
6
|
-
type Config = typeof buildConfig;
|
|
7
|
-
|
|
8
|
-
let active: Config = buildConfig;
|
|
9
|
-
const listeners = new Set<() => void>();
|
|
10
|
-
|
|
11
|
-
function subscribe(listener: () => void) {
|
|
12
|
-
listeners.add(listener);
|
|
13
|
-
return () => {
|
|
14
|
-
listeners.delete(listener);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function activeConfig(): Config {
|
|
19
|
-
return active;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function setActiveConfig(next: YarclShape | null) {
|
|
23
|
-
active = (next ?? buildConfig) as Config;
|
|
24
|
-
listeners.forEach((listener) => listener());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The config components currently read their defaults from: the build-time config, or the
|
|
29
|
-
* theme passed to `applyTheme`. Re-renders the caller when the theme changes.
|
|
30
|
-
*/
|
|
31
|
-
export function useConfig(): Config {
|
|
32
|
-
return useSyncExternalStore(subscribe, activeConfig, () => buildConfig);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function useDefaults(component: ComponentName): ComponentDefaults {
|
|
36
|
-
const config = useConfig();
|
|
37
|
-
return ((config as unknown as YarclShape).components?.[component] ?? {}) as ComponentDefaults;
|
|
38
|
-
}
|
package/src/themes/bloom.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '../define';
|
|
2
|
-
import defaults from '../yarcl.config';
|
|
3
|
-
import type { ThemeContract } from './contract';
|
|
4
|
-
|
|
5
|
-
const glow = (geometry: string, alpha: number) =>
|
|
6
|
-
`${geometry} light-dark(rgb(91 33 182 / ${alpha}), rgb(0 0 0 / ${Math.min(alpha * 5, 0.7)}))`;
|
|
7
|
-
|
|
8
|
-
/** Friendly and airy: violet on lavender, pill-shaped controls, rounded cards, large targets, soft tinted shadows. */
|
|
9
|
-
export const bloom = defineConfig({
|
|
10
|
-
...defaults,
|
|
11
|
-
colors: {
|
|
12
|
-
primary: { light: '#7c3aed', dark: '#c4b5fd' },
|
|
13
|
-
neutral: { light: '#6b6485', dark: '#b5aecf' },
|
|
14
|
-
success: { light: '#0f8a5f', dark: '#5eead4' },
|
|
15
|
-
warning: { light: '#c2410c', dark: '#fdba74' },
|
|
16
|
-
danger: { light: '#e11d48', dark: '#fb7185' },
|
|
17
|
-
info: { light: '#0369a1', dark: '#7dd3fc' },
|
|
18
|
-
},
|
|
19
|
-
neutrals: {
|
|
20
|
-
bg: { light: '#f7f4ff', dark: '#14111f' },
|
|
21
|
-
surface: { light: '#ffffff', dark: '#1f1a30' },
|
|
22
|
-
text: { light: '#2a2540', dark: '#efeafc' },
|
|
23
|
-
muted: { light: '#6b6485', dark: '#aaa3c4' },
|
|
24
|
-
border: { light: '#e6dff7', dark: '#342c4d' },
|
|
25
|
-
},
|
|
26
|
-
sizes: {
|
|
27
|
-
xs: { height: '2rem', paddingX: '0.875rem', fontSize: '0.8125rem', iconSize: '0.875rem' },
|
|
28
|
-
sm: { height: '2.25rem', paddingX: '1rem', fontSize: '0.875rem', iconSize: '1rem' },
|
|
29
|
-
md: { height: '2.75rem', paddingX: '1.25rem', fontSize: '0.9375rem', iconSize: '1.125rem' },
|
|
30
|
-
lg: { height: '3.25rem', paddingX: '1.625rem', fontSize: '1.0625rem', iconSize: '1.25rem' },
|
|
31
|
-
xl: { height: '3.75rem', paddingX: '2rem', fontSize: '1.1875rem', iconSize: '1.5rem' },
|
|
32
|
-
},
|
|
33
|
-
radii: { square: '0', sm: '0.75rem', md: '1rem', lg: '1.5rem', xl: '2rem', rounded: '9999px' },
|
|
34
|
-
spacing: { xs: '0.375rem', sm: '0.75rem', md: '1.25rem', lg: '1.75rem', xl: '2.5rem' },
|
|
35
|
-
shadows: {
|
|
36
|
-
sm: glow('0 2px 8px', 0.08),
|
|
37
|
-
md: glow('0 10px 30px', 0.14),
|
|
38
|
-
lg: glow('0 20px 60px', 0.2),
|
|
39
|
-
},
|
|
40
|
-
density: {
|
|
41
|
-
compact: { paddingX: '0.75rem', paddingY: '0.5rem', fontSize: '0.875rem' },
|
|
42
|
-
comfortable: { paddingX: '1.25rem', paddingY: '0.875rem', fontSize: '0.9375rem' },
|
|
43
|
-
},
|
|
44
|
-
typography: {
|
|
45
|
-
families: {
|
|
46
|
-
sans: 'Nunito, "SF Pro Rounded", ui-rounded, "Varela Round", system-ui, sans-serif',
|
|
47
|
-
mono: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
|
|
48
|
-
},
|
|
49
|
-
styles: {
|
|
50
|
-
display: { family: 'sans', size: '2.5rem', weight: 800, lineHeight: 1.1, letterSpacing: '-0.02em' },
|
|
51
|
-
heading: { family: 'sans', size: '1.625rem', weight: 800, lineHeight: 1.2 },
|
|
52
|
-
subheading: { family: 'sans', size: '1.1875rem', weight: 700, lineHeight: 1.35 },
|
|
53
|
-
body: { family: 'sans', size: '1rem', weight: 500, lineHeight: 1.55 },
|
|
54
|
-
caption: { family: 'sans', size: '0.8125rem', weight: 500, lineHeight: 1.45 },
|
|
55
|
-
code: { family: 'mono', size: '0.875rem', weight: 400, lineHeight: 1.5 },
|
|
56
|
-
label: { family: 'sans', size: '0.9375rem', weight: 700, lineHeight: 1.4 },
|
|
57
|
-
},
|
|
58
|
-
headings: { h1: 'display', h2: 'heading', h3: 'heading', h4: 'subheading', h5: 'subheading', h6: 'label' },
|
|
59
|
-
},
|
|
60
|
-
focusRing: { width: '3px', offset: '3px', color: 'primary' },
|
|
61
|
-
components: {
|
|
62
|
-
...defaults.components,
|
|
63
|
-
Button: { radius: 'rounded' },
|
|
64
|
-
IconButton: { radius: 'rounded' },
|
|
65
|
-
ToggleGroup: { radius: 'rounded' },
|
|
66
|
-
Badge: { radius: 'rounded' },
|
|
67
|
-
Input: { radius: 'rounded' },
|
|
68
|
-
Select: { radius: 'rounded' },
|
|
69
|
-
Combobox: { radius: 'rounded' },
|
|
70
|
-
},
|
|
71
|
-
defaults: { ...defaults.defaults, radius: 'lg', padding: 'lg', gap: 'md' },
|
|
72
|
-
}) satisfies ThemeContract;
|
package/src/themes/brutalist.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '../define';
|
|
2
|
-
import defaults from '../yarcl.config';
|
|
3
|
-
import type { ThemeContract } from './contract';
|
|
4
|
-
|
|
5
|
-
const ink = 'light-dark(#000000, #ffffff)';
|
|
6
|
-
|
|
7
|
-
/** Loud and flat: red on black and white, square corners, thick borders, hard offset shadows, monospace type. */
|
|
8
|
-
export const brutalist = defineConfig({
|
|
9
|
-
...defaults,
|
|
10
|
-
colors: {
|
|
11
|
-
primary: { light: '#ff3d2e', dark: '#ff5a4d' },
|
|
12
|
-
neutral: { light: '#1a1a1a', dark: '#f5f5f5' },
|
|
13
|
-
success: { light: '#00b862', dark: '#3dfc9a' },
|
|
14
|
-
warning: { light: '#ff8a00', dark: '#ffb14a' },
|
|
15
|
-
danger: { light: '#c2005a', dark: '#ff5ca1' },
|
|
16
|
-
info: { light: '#2f6bff', dark: '#7aa2ff' },
|
|
17
|
-
},
|
|
18
|
-
neutrals: {
|
|
19
|
-
bg: { light: '#fffdf2', dark: '#0f0f0f' },
|
|
20
|
-
surface: { light: '#ffffff', dark: '#1a1a1a' },
|
|
21
|
-
text: { light: '#000000', dark: '#ffffff' },
|
|
22
|
-
muted: { light: '#3d3d3d', dark: '#cfcfcf' },
|
|
23
|
-
border: { light: '#000000', dark: '#ffffff' },
|
|
24
|
-
},
|
|
25
|
-
sizes: {
|
|
26
|
-
xs: { height: '1.75rem', paddingX: '0.625rem', fontSize: '0.75rem', iconSize: '0.75rem' },
|
|
27
|
-
sm: { height: '2rem', paddingX: '0.75rem', fontSize: '0.8125rem', iconSize: '0.875rem' },
|
|
28
|
-
md: { height: '2.5rem', paddingX: '1rem', fontSize: '0.875rem', iconSize: '1rem' },
|
|
29
|
-
lg: { height: '3rem', paddingX: '1.25rem', fontSize: '1rem', iconSize: '1.25rem' },
|
|
30
|
-
xl: { height: '3.5rem', paddingX: '1.5rem', fontSize: '1.125rem', iconSize: '1.5rem' },
|
|
31
|
-
},
|
|
32
|
-
radii: { square: '0', sm: '0', md: '0', lg: '0', xl: '0', rounded: '9999px' },
|
|
33
|
-
variants: {
|
|
34
|
-
solid: { background: 'fill', border: 'neutral', text: 'on' },
|
|
35
|
-
soft: { background: 'tint', border: 'neutral', text: 'neutral' },
|
|
36
|
-
outline: { background: 'none', border: 'neutral', text: 'neutral' },
|
|
37
|
-
ghost: { background: 'none', border: 'none', text: 'neutral' },
|
|
38
|
-
},
|
|
39
|
-
shadows: {
|
|
40
|
-
sm: `3px 3px 0 0 ${ink}`,
|
|
41
|
-
md: `5px 5px 0 0 ${ink}`,
|
|
42
|
-
lg: `8px 8px 0 0 ${ink}`,
|
|
43
|
-
},
|
|
44
|
-
borders: { width: '2px' },
|
|
45
|
-
typography: {
|
|
46
|
-
families: {
|
|
47
|
-
sans: '"JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace',
|
|
48
|
-
mono: '"JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace',
|
|
49
|
-
},
|
|
50
|
-
styles: {
|
|
51
|
-
display: { family: 'sans', size: '2.5rem', weight: 800, lineHeight: 1, letterSpacing: '-0.04em' },
|
|
52
|
-
heading: { family: 'sans', size: '1.5rem', weight: 800, lineHeight: 1.15, letterSpacing: '-0.02em' },
|
|
53
|
-
subheading: { family: 'sans', size: '1.125rem', weight: 700, lineHeight: 1.3 },
|
|
54
|
-
body: { family: 'sans', size: '0.875rem', weight: 400, lineHeight: 1.55 },
|
|
55
|
-
caption: { family: 'sans', size: '0.75rem', weight: 400, lineHeight: 1.45 },
|
|
56
|
-
code: { family: 'mono', size: '0.8125rem', weight: 400, lineHeight: 1.5 },
|
|
57
|
-
label: { family: 'sans', size: '0.8125rem', weight: 700, lineHeight: 1.4, letterSpacing: '0.04em' },
|
|
58
|
-
},
|
|
59
|
-
headings: { h1: 'display', h2: 'heading', h3: 'heading', h4: 'subheading', h5: 'subheading', h6: 'label' },
|
|
60
|
-
},
|
|
61
|
-
focusRing: { width: '3px', offset: '3px', color: 'neutral', style: 'dashed' },
|
|
62
|
-
defaults: { ...defaults.defaults, radius: 'md', padding: 'lg', floatingShadow: 'md' },
|
|
63
|
-
}) satisfies ThemeContract;
|
package/src/themes/compact.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '../define';
|
|
2
|
-
import defaults from '../yarcl.config';
|
|
3
|
-
import type { ThemeContract } from './contract';
|
|
4
|
-
|
|
5
|
-
/** Dense and businesslike: teal on cool gray, small 28px controls, tight spacing, 13px text, compact tables, nearly flat. */
|
|
6
|
-
export const compact = defineConfig({
|
|
7
|
-
...defaults,
|
|
8
|
-
colors: {
|
|
9
|
-
primary: { light: '#0f766e', dark: '#2dd4bf' },
|
|
10
|
-
neutral: { light: '#52606d', dark: '#9aa5b1' },
|
|
11
|
-
success: { light: '#15803d', dark: '#4ade80' },
|
|
12
|
-
warning: { light: '#a16207', dark: '#facc15' },
|
|
13
|
-
danger: { light: '#b91c1c', dark: '#f87171' },
|
|
14
|
-
info: { light: '#1d4ed8', dark: '#60a5fa' },
|
|
15
|
-
},
|
|
16
|
-
neutrals: {
|
|
17
|
-
bg: { light: '#eef1f4', dark: '#0b0f14' },
|
|
18
|
-
surface: { light: '#ffffff', dark: '#141a21' },
|
|
19
|
-
text: { light: '#1f2933', dark: '#e4e7eb' },
|
|
20
|
-
muted: { light: '#52606d', dark: '#9aa5b1' },
|
|
21
|
-
border: { light: '#cbd2d9', dark: '#2a333d' },
|
|
22
|
-
},
|
|
23
|
-
sizes: {
|
|
24
|
-
xs: { height: '1.25rem', paddingX: '0.375rem', fontSize: '0.6875rem', iconSize: '0.75rem' },
|
|
25
|
-
sm: { height: '1.5rem', paddingX: '0.5rem', fontSize: '0.75rem', iconSize: '0.75rem' },
|
|
26
|
-
md: { height: '1.75rem', paddingX: '0.625rem', fontSize: '0.8125rem', iconSize: '0.875rem' },
|
|
27
|
-
lg: { height: '2.25rem', paddingX: '0.875rem', fontSize: '0.875rem', iconSize: '1rem' },
|
|
28
|
-
xl: { height: '2.75rem', paddingX: '1rem', fontSize: '1rem', iconSize: '1.125rem' },
|
|
29
|
-
},
|
|
30
|
-
radii: { square: '0', sm: '2px', md: '3px', lg: '4px', xl: '6px', rounded: '9999px' },
|
|
31
|
-
variants: {
|
|
32
|
-
...defaults.variants,
|
|
33
|
-
outline: { background: 'none', border: 'neutral', text: 'neutral' },
|
|
34
|
-
},
|
|
35
|
-
spacing: { xs: '0.125rem', sm: '0.25rem', md: '0.5rem', lg: '0.75rem', xl: '1rem' },
|
|
36
|
-
shadows: {
|
|
37
|
-
sm: '0 1px 0 light-dark(rgb(15 23 42 / 0.05), rgb(0 0 0 / 0.4))',
|
|
38
|
-
md: '0 2px 8px light-dark(rgb(15 23 42 / 0.14), rgb(0 0 0 / 0.55))',
|
|
39
|
-
lg: '0 8px 24px light-dark(rgb(15 23 42 / 0.18), rgb(0 0 0 / 0.6))',
|
|
40
|
-
},
|
|
41
|
-
density: {
|
|
42
|
-
compact: { paddingX: '0.5rem', paddingY: '0.25rem', fontSize: '0.75rem' },
|
|
43
|
-
comfortable: { paddingX: '0.625rem', paddingY: '0.375rem', fontSize: '0.8125rem' },
|
|
44
|
-
},
|
|
45
|
-
typography: {
|
|
46
|
-
families: {
|
|
47
|
-
sans: '"IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif',
|
|
48
|
-
mono: '"IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace',
|
|
49
|
-
},
|
|
50
|
-
styles: {
|
|
51
|
-
display: { family: 'sans', size: '1.5rem', weight: 600, lineHeight: 1.25 },
|
|
52
|
-
heading: { family: 'sans', size: '1.125rem', weight: 600, lineHeight: 1.3 },
|
|
53
|
-
subheading: { family: 'sans', size: '0.9375rem', weight: 600, lineHeight: 1.35 },
|
|
54
|
-
body: { family: 'sans', size: '0.8125rem', weight: 400, lineHeight: 1.45 },
|
|
55
|
-
caption: { family: 'sans', size: '0.75rem', weight: 400, lineHeight: 1.4 },
|
|
56
|
-
code: { family: 'mono', size: '0.75rem', weight: 400, lineHeight: 1.45 },
|
|
57
|
-
label: { family: 'sans', size: '0.75rem', weight: 600, lineHeight: 1.35, letterSpacing: '0.02em' },
|
|
58
|
-
},
|
|
59
|
-
headings: { h1: 'display', h2: 'heading', h3: 'heading', h4: 'subheading', h5: 'subheading', h6: 'label' },
|
|
60
|
-
},
|
|
61
|
-
focusRing: { width: '2px', offset: '1px', color: 'info' },
|
|
62
|
-
defaults: { ...defaults.defaults, radius: 'sm', padding: 'lg', gap: 'md', density: 'compact' },
|
|
63
|
-
}) satisfies ThemeContract;
|
package/src/themes/contract.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ColorToken, DensityToken, SizeToken, TextStyleToken, VariantToken } from '../define';
|
|
2
|
-
import type defaults from '../yarcl.config';
|
|
3
|
-
|
|
4
|
-
type Defaults = typeof defaults;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The keys every bundled theme defines: the same keys as the library defaults.
|
|
8
|
-
* Apps written against these keys work with any theme that satisfies the contract.
|
|
9
|
-
* Values are free; extra keys are allowed.
|
|
10
|
-
*/
|
|
11
|
-
export interface ThemeContract {
|
|
12
|
-
colors: Record<keyof Defaults['colors'], ColorToken>;
|
|
13
|
-
sizes: Record<keyof Defaults['sizes'], SizeToken>;
|
|
14
|
-
radii: Record<keyof Defaults['radii'], string>;
|
|
15
|
-
variants: Record<keyof Defaults['variants'], VariantToken>;
|
|
16
|
-
spacing: Record<keyof Defaults['spacing'], string>;
|
|
17
|
-
shadows: Record<keyof Defaults['shadows'], string>;
|
|
18
|
-
density: Record<keyof Defaults['density'], DensityToken>;
|
|
19
|
-
modalSizes: Record<keyof Defaults['modalSizes'], string>;
|
|
20
|
-
typography: {
|
|
21
|
-
families: Record<keyof Defaults['typography']['families'], string>;
|
|
22
|
-
styles: Record<keyof Defaults['typography']['styles'], TextStyleToken>;
|
|
23
|
-
};
|
|
24
|
-
}
|