@astryxdesign/cli 0.7.5-canary.04434e7 → 0.7.5-canary.05ead02
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 +1 -1
- package/api/template/tokenizer-showcase.test.mjs +47 -0
- package/api/theme/build/build.mjs +9 -4
- package/api/upgrade/_adapter.d.mts +47 -2
- package/api/upgrade/_adapter.mjs +58 -2
- package/api/upgrade/run/failure-receipt.test.mjs +57 -0
- package/api/upgrade/run/outcomes.test.mjs +646 -0
- package/api/upgrade/run/run.d.mts +36 -0
- package/api/upgrade/run/run.mjs +509 -45
- package/api/upgrade/upgrade.doc.mjs +2 -2
- package/api/upgrade/upgrade.type.d.mts +24 -0
- package/api/upgrade/upgrade.type.mjs +15 -3
- package/assets/codemods/__tests__/runner.unparseable.test.mjs +457 -0
- package/assets/codemods/integration-runner.mjs +7 -1
- package/assets/codemods/integration-runner.protection.test.mjs +53 -0
- package/assets/codemods/outcome.mjs +79 -0
- package/assets/codemods/outcome.test.mjs +40 -0
- package/assets/codemods/parse.mjs +94 -0
- package/assets/codemods/run-codemod.mjs +92 -2
- package/assets/codemods/runner.mjs +38 -5
- package/assets/codemods/transforms/next/__tests__/migrate-codeblock-tokenizer-to-language.test.mjs +130 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-codeblock-tokenizer-to-language.mjs +315 -0
- package/assets/codemods/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +216 -2
- package/assets/codemods/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +88 -6
- package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +4 -3
- package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +24 -4
- package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +44 -10
- package/assets/codemods/transforms/v0.7.0/validate-data-token-ownership.mjs +6 -3
- package/assets/docs/author-a-theme.doc.mjs +2 -1
- package/assets/docs/icons.doc.mjs +24 -1
- package/assets/docs/tree/template-styles.doc.mjs +1 -1
- package/assets/docs/tree/tokens-color.doc.mjs +145 -1
- package/assets/docs/tree/tokens.doc.mjs +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +6 -4
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +61 -55
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +6 -4
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +68 -37
- package/assets/templates/blocks/components/CodeBlock/CodeBlockBashCommand.doc.mjs +1 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockBashCommand.tsx +10 -2
- package/assets/templates/blocks/components/Thumbnail/ThumbnailDisabled.doc.mjs +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +13 -6
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +3 -3
- package/assets/templates/pages/library/page.tsx +1 -2
- package/assets/templates/pages/table-comparison/page.tsx +12 -3
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +3 -2
- package/assets/templates/themes/butter/butterTheme.ts +47 -44
- package/assets/templates/themes/chocolate/chocolateTheme.ts +15 -2
- package/assets/templates/themes/gothic/gothicTheme.ts +21 -16
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/matcha/matchaTheme.ts +15 -2
- package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +4 -4
- package/assets/templates/themes/neutral/neutralTheme.ts +24 -119
- package/assets/templates/themes/stone/stoneTheme.ts +46 -21
- package/assets/templates/themes/y2k/y2kTheme.ts +20 -16
- package/assets/theme.template.ts +9 -5
- package/authoring/codemod/type.ts +10 -0
- package/clients/cli/commands/build-theme.adaptations.test.mjs +110 -0
- package/clients/cli/commands/upgrade.doc.mjs +30 -2
- package/clients/cli/commands/upgrade.file-protection.test.mjs +146 -0
- package/clients/cli/commands/upgrade.outcomes.test.mjs +350 -0
- package/foundation/agent-docs/agent-docs.mjs +1 -0
- package/foundation/agent-docs/agent-docs.test.mjs +5 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +10 -9
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import path from 'node:path';
|
|
16
16
|
import postcss from 'postcss';
|
|
17
17
|
import selectorParser from 'postcss-selector-parser';
|
|
18
|
+
import {parseCss, processSelector} from '../../parse.mjs';
|
|
18
19
|
import {
|
|
19
20
|
V054_THEME_SELECTOR_DYNAMIC_AXES,
|
|
20
21
|
V054_THEME_SELECTOR_TARGETS,
|
|
@@ -555,7 +556,7 @@ function migrateSelectorTextWithContext(
|
|
|
555
556
|
) {
|
|
556
557
|
/** @type {TargetContext} */
|
|
557
558
|
let context = {guaranteed: [], possible: []};
|
|
558
|
-
const text =
|
|
559
|
+
const text = processSelector(selector, selectors => {
|
|
559
560
|
/** @type {TargetContext[]} */
|
|
560
561
|
const branchContexts = [];
|
|
561
562
|
selectors.each(selectorNode => {
|
|
@@ -593,7 +594,7 @@ function migrateSelectorTextWithContext(
|
|
|
593
594
|
});
|
|
594
595
|
});
|
|
595
596
|
context = combineSelectorListContexts(branchContexts);
|
|
596
|
-
})
|
|
597
|
+
});
|
|
597
598
|
return {text, context};
|
|
598
599
|
}
|
|
599
600
|
|
|
@@ -677,7 +678,7 @@ export function migrateAstryxThemeSelectors(source, from = 'styles.css', data) {
|
|
|
677
678
|
|
|
678
679
|
/** @param {string} source @param {string} from @returns {string} */
|
|
679
680
|
function migrateWithActiveTables(source, from) {
|
|
680
|
-
const root =
|
|
681
|
+
const root = parseCss(source, {from});
|
|
681
682
|
const existingComments = new Set();
|
|
682
683
|
root.walkComments(comment => {
|
|
683
684
|
existingComments.add(comment.text.trim());
|
|
@@ -5,6 +5,7 @@ import * as os from 'node:os';
|
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import {afterAll, describe, expect, it} from 'vitest';
|
|
7
7
|
import transform, {meta} from '../validate-data-token-ownership.mjs';
|
|
8
|
+
import {codemodOutcome} from '../../../outcome.mjs';
|
|
8
9
|
import {upgrade} from '../../../../../api/upgrade/upgrade.mjs';
|
|
9
10
|
|
|
10
11
|
const SLOW = 30_000;
|
|
@@ -76,10 +77,20 @@ describe('validate-data-token-ownership', () => {
|
|
|
76
77
|
expect(meta.fileExtensions).toEqual(['.css']);
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
it('
|
|
80
|
+
it('reports stale generated theme CSS with root data defaults as a regeneration', () => {
|
|
80
81
|
expect(() => transform({source: STALE_THEME, path: 'theme.css'})).toThrow(
|
|
81
82
|
/Rebuild it with `astryx theme build`/,
|
|
82
83
|
);
|
|
84
|
+
let thrown;
|
|
85
|
+
try {
|
|
86
|
+
transform({source: STALE_THEME, path: 'theme.css'});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
thrown = err;
|
|
89
|
+
}
|
|
90
|
+
expect(codemodOutcome(thrown)).toMatchObject({
|
|
91
|
+
kind: 'regenerate',
|
|
92
|
+
commands: ['astryx theme build'],
|
|
93
|
+
});
|
|
83
94
|
});
|
|
84
95
|
|
|
85
96
|
it('passes raw data-token uses with or without a fallback', () => {
|
|
@@ -136,11 +147,20 @@ describe('validate-data-token-ownership', () => {
|
|
|
136
147
|
);
|
|
137
148
|
|
|
138
149
|
it(
|
|
139
|
-
'
|
|
150
|
+
'leaves `astryx upgrade --apply` incomplete on stale generated theme CSS, naming the rebuild',
|
|
140
151
|
async () => {
|
|
141
152
|
const root = project({...PREBUILT, 'src/theme.css': STALE_THEME});
|
|
142
|
-
await
|
|
143
|
-
|
|
153
|
+
const res = await runUpgrade(root);
|
|
154
|
+
expect(res.data).toMatchObject({
|
|
155
|
+
complete: false,
|
|
156
|
+
errorCode: 'ERR_CODEMOD_PROTECTED',
|
|
157
|
+
errors: [],
|
|
158
|
+
regenerate: [
|
|
159
|
+
expect.objectContaining({
|
|
160
|
+
file: 'src/theme.css',
|
|
161
|
+
commands: ['astryx theme build'],
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
144
164
|
});
|
|
145
165
|
},
|
|
146
166
|
SLOW,
|
|
@@ -27,6 +27,12 @@ import {
|
|
|
27
27
|
importedComponents,
|
|
28
28
|
resolveImportedComponent,
|
|
29
29
|
} from '../../transform-prop.mjs';
|
|
30
|
+
import {
|
|
31
|
+
isCodemodParseError,
|
|
32
|
+
markParseError,
|
|
33
|
+
parseCss,
|
|
34
|
+
processSelector,
|
|
35
|
+
} from '../../parse.mjs';
|
|
30
36
|
import {migrateAstryxThemeSelectors} from '../v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs';
|
|
31
37
|
import {
|
|
32
38
|
V06_THEME_SELECTOR_DYNAMIC_AXES,
|
|
@@ -204,7 +210,7 @@ function ownerScope(owner) {
|
|
|
204
210
|
function unclassifiedBareClasses(selectorText) {
|
|
205
211
|
/** @type {Set<string>} */
|
|
206
212
|
const found = new Set();
|
|
207
|
-
|
|
213
|
+
processSelector(selectorText, selectors => {
|
|
208
214
|
selectors.walk((/** @type {any} */ node) => {
|
|
209
215
|
if (node.type !== 'selector') return;
|
|
210
216
|
/** @type {any[][]} */
|
|
@@ -232,19 +238,23 @@ function unclassifiedBareClasses(selectorText) {
|
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
240
|
});
|
|
235
|
-
})
|
|
241
|
+
});
|
|
236
242
|
return [...found].sort();
|
|
237
243
|
}
|
|
238
244
|
|
|
239
|
-
/** @param {string} selector */
|
|
245
|
+
/** @param {string | import('postcss').Rule} selector selector text, or the rule that holds it */
|
|
240
246
|
function finishSelectorText(selector) {
|
|
241
|
-
return
|
|
247
|
+
return processSelector(selector, selectors => {
|
|
242
248
|
selectors.each(finishSelectorMigration);
|
|
243
|
-
})
|
|
249
|
+
});
|
|
244
250
|
}
|
|
245
251
|
|
|
246
|
-
/**
|
|
247
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Migrate each parenthesized selector group of an `@scope` prelude.
|
|
254
|
+
* @param {string} params
|
|
255
|
+
* @param {(selector: string, start: number) => string} [finish] migrates one group; `start` is its offset in `params`
|
|
256
|
+
*/
|
|
257
|
+
function finishScopeParams(params, finish = finishSelectorText) {
|
|
248
258
|
let result = '';
|
|
249
259
|
let last = 0;
|
|
250
260
|
let depth = 0;
|
|
@@ -281,7 +291,7 @@ function finishScopeParams(params) {
|
|
|
281
291
|
if (char === ')' && depth > 0) {
|
|
282
292
|
depth--;
|
|
283
293
|
if (depth === 0 && groupStart >= 0) {
|
|
284
|
-
result +=
|
|
294
|
+
result += finish(params.slice(groupStart, index), groupStart);
|
|
285
295
|
result += ')';
|
|
286
296
|
last = index + 1;
|
|
287
297
|
groupStart = -1;
|
|
@@ -293,15 +303,39 @@ function finishScopeParams(params) {
|
|
|
293
303
|
|
|
294
304
|
/** @param {string} source @param {string} from */
|
|
295
305
|
function migrateCss(source, from) {
|
|
306
|
+
// Parse every selector of the stylesheet as written first, so one the
|
|
307
|
+
// selector parser rejects is reported at its line and column in the file,
|
|
308
|
+
// not in the migrated text below.
|
|
309
|
+
const original = parseCss(source, {from});
|
|
310
|
+
original.walkRules(rule => {
|
|
311
|
+
processSelector(rule, () => {});
|
|
312
|
+
});
|
|
313
|
+
original.walkAtRules('scope', atRule => {
|
|
314
|
+
const offset =
|
|
315
|
+
`@${atRule.name}`.length + (atRule.raws.afterName ?? '').length;
|
|
316
|
+
finishScopeParams(atRule.params, (selector, start) => {
|
|
317
|
+
try {
|
|
318
|
+
processSelector(selector, () => {});
|
|
319
|
+
} catch (err) {
|
|
320
|
+
if (!isCodemodParseError(err)) throw err;
|
|
321
|
+
throw markParseError(
|
|
322
|
+
atRule.error(/** @type {Error} */ (err).message, {
|
|
323
|
+
index: offset + start,
|
|
324
|
+
}),
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return selector;
|
|
328
|
+
});
|
|
329
|
+
});
|
|
296
330
|
const migrated = migrateAstryxThemeSelectors(source, from, SELECTOR_DATA);
|
|
297
|
-
const root =
|
|
331
|
+
const root = parseCss(migrated, {from});
|
|
298
332
|
/** @type {Set<string>} */
|
|
299
333
|
const existingComments = new Set();
|
|
300
334
|
root.walkComments(comment => {
|
|
301
335
|
existingComments.add(comment.text.trim());
|
|
302
336
|
});
|
|
303
337
|
root.walkRules(rule => {
|
|
304
|
-
rule.selector = finishSelectorText(rule
|
|
338
|
+
rule.selector = finishSelectorText(rule);
|
|
305
339
|
const tokens = unclassifiedBareClasses(rule.selector);
|
|
306
340
|
if (tokens.length === 0) return;
|
|
307
341
|
const list = tokens.map(token => `.${token}`).join(', ');
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* @file Reject stale generated theme CSS that still owns data-token defaults.
|
|
5
5
|
*
|
|
6
6
|
* @input Generated theme CSS
|
|
7
|
-
* @output No rewritten source;
|
|
8
|
-
*
|
|
7
|
+
* @output No rewritten source; a regeneration report (`RegenerationRequired`,
|
|
8
|
+
* with `astryx theme build`) for a generated theme stylesheet that still
|
|
9
|
+
* declares data-color defaults at `:root`
|
|
9
10
|
* @position Next-release upgrade validation for spec:AST-066 FR19
|
|
10
11
|
*
|
|
11
12
|
* Raw `var(--color-data-*)` uses are not checked: prebuilt
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import * as path from 'node:path';
|
|
19
|
+
import {RegenerationRequired} from '../../outcome.mjs';
|
|
18
20
|
|
|
19
21
|
export const meta = {
|
|
20
22
|
title: 'Validate data-token ownership',
|
|
@@ -36,8 +38,9 @@ export default function validateDataTokenOwnership(file) {
|
|
|
36
38
|
file.source.includes(GENERATED_THEME_HEADER) &&
|
|
37
39
|
ROOT_DATA_DECLARATION.test(file.source)
|
|
38
40
|
) {
|
|
39
|
-
throw new
|
|
41
|
+
throw new RegenerationRequired(
|
|
40
42
|
'This generated theme CSS still emits canonical data defaults at :root. Rebuild it with `astryx theme build`; defaults come from @astryxdesign/core/astryx.css in prebuilt mode, and in a source build from the @astryxdesign/build PostCSS integration or dataVars imports.',
|
|
43
|
+
{commands: ['astryx theme build']},
|
|
41
44
|
);
|
|
42
45
|
}
|
|
43
46
|
return undefined;
|
|
@@ -57,7 +57,8 @@ export const docs = {
|
|
|
57
57
|
['icons', 'Shallow-merged: child icons override matching names from the base.'],
|
|
58
58
|
['indicators', 'Shallow-merged: child indicators override matching names from the base.'],
|
|
59
59
|
['onDark, onLight', "Deep-merged per surface: the base's resolved surface first, then the child's overrides."],
|
|
60
|
-
['
|
|
60
|
+
['motion', "Field by field: the child's `fast`, `medium` and `ratio` regenerate the fast and medium duration tokens; `slow` and `easing` left unset keep the base theme's tokens, so an inherited slow band stays at the base's ratio."],
|
|
61
|
+
['typography, radius, color', 'Child config replaces base entirely (these are scale inputs, not additive).'],
|
|
61
62
|
['adaptations', 'Width-breakpoint overrides merge by fixed name. Inherited ordered rules keep their relative order; child rules append and re-resolve against the child root axes.'],
|
|
62
63
|
]},
|
|
63
64
|
{type: 'prose', text: "Inheritance is resolved when the theme is defined, so an extended theme is flat: `{@command theme build}` emits one self-contained stylesheet holding everything the child inherited, and the base theme's CSS does not need to be loaded next to it. A base that is not a theme (most often an import that missed) throws when `defineTheme` runs, rather than producing a theme that silently inherits nothing."},
|
|
@@ -101,11 +101,34 @@ export const brandTheme = defineTheme({
|
|
|
101
101
|
},
|
|
102
102
|
});`,
|
|
103
103
|
},
|
|
104
|
+
{
|
|
105
|
+
type: 'prose',
|
|
106
|
+
text: "An entry can also be a function of the request, so the theme maps Icon's size to its icon library's own props or artwork. `Icon` calls it with `{size, variant}`, where `size` is the size it renders at (`xsm`, `sm`, `md`, or `lg`: an explicit `size`, else the owning component's default, else `md`). Reads that return one node — `getIcon()`, `useIcon()`, `getIconRegistry()`, and the theme's `icons` field — call it with `{size: 'md'}`. The same entry shape works in `registerIcons()`.",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: 'code',
|
|
110
|
+
lang: 'tsx',
|
|
111
|
+
label: 'A size-aware icon entry',
|
|
112
|
+
code: `import {defineTheme} from '@astryxdesign/core/theme';
|
|
113
|
+
import {Info} from 'lucide-react';
|
|
114
|
+
|
|
115
|
+
export const brandTheme = defineTheme({
|
|
116
|
+
name: 'brand',
|
|
117
|
+
icons: {
|
|
118
|
+
// A heavier stroke keeps the small size legible.
|
|
119
|
+
info: ({size}) => <Info strokeWidth={size === 'sm' || size === 'xsm' ? 2.5 : 2} />,
|
|
120
|
+
},
|
|
121
|
+
});`,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: 'prose',
|
|
125
|
+
text: 'Keep the function pure and synchronous: it computes its result from the request only, with no hooks, DOM or SVG measurement, browser globals, network access, mutable module state, or side effects. Its result is final. Returning `null` draws no glyph instead of falling back to a registered or built-in icon, while a `null` or `undefined` node entry still falls back. A child theme that sets an entry for a key replaces the inherited entry for that key.',
|
|
126
|
+
},
|
|
104
127
|
],
|
|
105
128
|
},
|
|
106
129
|
{
|
|
107
130
|
title: 'Component and Library Icons',
|
|
108
|
-
|
|
131
|
+
category: 'foundations',
|
|
109
132
|
content: [
|
|
110
133
|
{
|
|
111
134
|
type: 'prose',
|
|
@@ -26,6 +26,55 @@ export const docs = {
|
|
|
26
26
|
"type": "prose",
|
|
27
27
|
"text": "Semantic colors for consistent theming. All colors use light-dark() for automatic mode switching."
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"type": "prose",
|
|
31
|
+
"text": "Status roles: pick the token by the surface. `<status>` is info, success, warning, or error."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "table",
|
|
35
|
+
"headers": [
|
|
36
|
+
"Status role",
|
|
37
|
+
"Use it for",
|
|
38
|
+
"Pairs with"
|
|
39
|
+
],
|
|
40
|
+
"rows": [
|
|
41
|
+
[
|
|
42
|
+
"--color-text-<status>",
|
|
43
|
+
"Status text on the page or a card (4.5:1 or more).",
|
|
44
|
+
"—"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"--color-icon-<status>",
|
|
48
|
+
"Status icons on the page or a card. Defaults to the text colour.",
|
|
49
|
+
"—"
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"--color-border-<status>",
|
|
53
|
+
"Status borders on the page or a card, such as an invalid field. Defaults to the text colour.",
|
|
54
|
+
"—"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"--color-<status>",
|
|
58
|
+
"Strong status fill, such as a Badge or StatusDot.",
|
|
59
|
+
"--color-on-<status>"
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"--color-on-<status>",
|
|
63
|
+
"Text and icons on the strong fill (4.5:1 or more).",
|
|
64
|
+
"--color-<status>"
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"--color-<status>-muted",
|
|
68
|
+
"Pale status fill, such as a Banner.",
|
|
69
|
+
"--color-on-<status>-muted"
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"--color-on-<status>-muted",
|
|
73
|
+
"Text and icons on the pale fill (4.5:1 or more).",
|
|
74
|
+
"--color-<status>-muted"
|
|
75
|
+
]
|
|
76
|
+
]
|
|
77
|
+
},
|
|
29
78
|
{
|
|
30
79
|
"type": "table",
|
|
31
80
|
"headers": [
|
|
@@ -154,6 +203,21 @@ export const docs = {
|
|
|
154
203
|
"#AA071E",
|
|
155
204
|
"#E3193B"
|
|
156
205
|
],
|
|
206
|
+
[
|
|
207
|
+
"--color-info",
|
|
208
|
+
"#0064E0",
|
|
209
|
+
"#0064E0"
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
"--color-info-muted",
|
|
213
|
+
"#0082FB33",
|
|
214
|
+
"#0082FB3F"
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
"--color-on-info",
|
|
218
|
+
"#FFFFFF",
|
|
219
|
+
"#FFFFFF"
|
|
220
|
+
],
|
|
157
221
|
[
|
|
158
222
|
"--color-success",
|
|
159
223
|
"#0D8626",
|
|
@@ -182,7 +246,7 @@ export const docs = {
|
|
|
182
246
|
[
|
|
183
247
|
"--color-on-error",
|
|
184
248
|
"#FFFFFF",
|
|
185
|
-
"#
|
|
249
|
+
"#0A1317"
|
|
186
250
|
],
|
|
187
251
|
[
|
|
188
252
|
"--color-warning",
|
|
@@ -199,6 +263,86 @@ export const docs = {
|
|
|
199
263
|
"#0A1317",
|
|
200
264
|
"#0A1317"
|
|
201
265
|
],
|
|
266
|
+
[
|
|
267
|
+
"--color-text-info",
|
|
268
|
+
"var(--color-text-blue)",
|
|
269
|
+
"var(--color-text-blue)"
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"--color-text-success",
|
|
273
|
+
"var(--color-text-green)",
|
|
274
|
+
"var(--color-text-green)"
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
"--color-text-warning",
|
|
278
|
+
"var(--color-text-yellow)",
|
|
279
|
+
"var(--color-text-yellow)"
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
"--color-text-error",
|
|
283
|
+
"var(--color-text-red)",
|
|
284
|
+
"var(--color-text-red)"
|
|
285
|
+
],
|
|
286
|
+
[
|
|
287
|
+
"--color-icon-info",
|
|
288
|
+
"var(--color-text-info)",
|
|
289
|
+
"var(--color-text-info)"
|
|
290
|
+
],
|
|
291
|
+
[
|
|
292
|
+
"--color-icon-success",
|
|
293
|
+
"var(--color-text-success)",
|
|
294
|
+
"var(--color-text-success)"
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
"--color-icon-warning",
|
|
298
|
+
"var(--color-text-warning)",
|
|
299
|
+
"var(--color-text-warning)"
|
|
300
|
+
],
|
|
301
|
+
[
|
|
302
|
+
"--color-icon-error",
|
|
303
|
+
"var(--color-text-error)",
|
|
304
|
+
"var(--color-text-error)"
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
"--color-border-info",
|
|
308
|
+
"var(--color-text-info)",
|
|
309
|
+
"var(--color-text-info)"
|
|
310
|
+
],
|
|
311
|
+
[
|
|
312
|
+
"--color-border-success",
|
|
313
|
+
"var(--color-text-success)",
|
|
314
|
+
"var(--color-text-success)"
|
|
315
|
+
],
|
|
316
|
+
[
|
|
317
|
+
"--color-border-warning",
|
|
318
|
+
"var(--color-text-warning)",
|
|
319
|
+
"var(--color-text-warning)"
|
|
320
|
+
],
|
|
321
|
+
[
|
|
322
|
+
"--color-border-error",
|
|
323
|
+
"var(--color-text-error)",
|
|
324
|
+
"var(--color-text-error)"
|
|
325
|
+
],
|
|
326
|
+
[
|
|
327
|
+
"--color-on-info-muted",
|
|
328
|
+
"var(--color-text-blue)",
|
|
329
|
+
"var(--color-text-blue)"
|
|
330
|
+
],
|
|
331
|
+
[
|
|
332
|
+
"--color-on-success-muted",
|
|
333
|
+
"var(--color-text-green)",
|
|
334
|
+
"var(--color-text-green)"
|
|
335
|
+
],
|
|
336
|
+
[
|
|
337
|
+
"--color-on-warning-muted",
|
|
338
|
+
"var(--color-text-yellow)",
|
|
339
|
+
"var(--color-text-yellow)"
|
|
340
|
+
],
|
|
341
|
+
[
|
|
342
|
+
"--color-on-error-muted",
|
|
343
|
+
"var(--color-text-red)",
|
|
344
|
+
"var(--color-text-red)"
|
|
345
|
+
],
|
|
202
346
|
[
|
|
203
347
|
"--color-border",
|
|
204
348
|
"#05365919",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// AUTO-GENERATED — do not edit manually.
|
|
4
4
|
// Run: node scripts/generate-token-docs.mjs
|
|
5
|
-
// Total:
|
|
5
|
+
// Total: 282 tokens across 15 categories.
|
|
6
6
|
|
|
7
7
|
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
8
8
|
export const docs = {
|
package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs
CHANGED
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'BottomSheetSwitcher',
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
alsoExampleFor: ['BottomSheet'],
|
|
8
|
+
// The published registry identity predates the rewrite; keep it.
|
|
9
|
+
registry: {slug: 'review-flow'},
|
|
10
|
+
name: 'Bottom Sheet — Review flow',
|
|
11
|
+
displayName: 'Bottom Sheet — Review flow',
|
|
9
12
|
description:
|
|
10
|
-
'A two-step form flow
|
|
13
|
+
'A two-step form flow of two standalone sheets driven by one state value: Continue replaces the review step with the confirmation in place, and Back returns.',
|
|
11
14
|
isReady: true,
|
|
12
15
|
isShowcase: false,
|
|
13
16
|
aspectRatio: 3 / 4,
|
|
14
17
|
componentsUsed: [
|
|
15
18
|
'BottomSheet',
|
|
16
|
-
'BottomSheetSwitcher',
|
|
17
19
|
'Button',
|
|
18
20
|
'Heading',
|
|
19
21
|
'Section',
|
|
@@ -3,73 +3,79 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useState} from 'react';
|
|
6
|
-
import {BottomSheet
|
|
6
|
+
import {BottomSheet} from '@astryxdesign/core/BottomSheet';
|
|
7
7
|
import {Button} from '@astryxdesign/core/Button';
|
|
8
8
|
import {Heading} from '@astryxdesign/core/Heading';
|
|
9
9
|
import {Section} from '@astryxdesign/core/Section';
|
|
10
10
|
import {HStack, VStack} from '@astryxdesign/core/Stack';
|
|
11
11
|
import {Text} from '@astryxdesign/core/Text';
|
|
12
12
|
|
|
13
|
+
type Step = 'review' | 'confirm' | null;
|
|
14
|
+
|
|
13
15
|
export default function BottomSheetSwitcherReviewFlow() {
|
|
14
|
-
|
|
16
|
+
// One state value names the open step; Continue and Back close one sheet
|
|
17
|
+
// and open the other in the same update, which replaces it in place.
|
|
18
|
+
const [step, setStep] = useState<Step>(null);
|
|
19
|
+
// Clear the step only if it is still the open one: a step that closes
|
|
20
|
+
// because the person moved on must not undo the move.
|
|
21
|
+
const close = (own: Step) => (isOpen: boolean) => {
|
|
22
|
+
if (!isOpen) {
|
|
23
|
+
setStep(current => (current === own ? null : current));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
15
26
|
|
|
16
27
|
return (
|
|
17
28
|
<>
|
|
18
|
-
<Button
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<VStack gap={1}>
|
|
33
|
-
<Heading level={3}>Review settings</Heading>
|
|
34
|
-
<Text type="supporting" color="secondary">
|
|
35
|
-
Daily summaries will be sent by email.
|
|
36
|
-
</Text>
|
|
37
|
-
</VStack>
|
|
38
|
-
<HStack gap={2} hAlign="end">
|
|
39
|
-
<Button
|
|
40
|
-
label="Cancel"
|
|
41
|
-
variant="secondary"
|
|
42
|
-
onClick={() => setActiveSheet(null)}
|
|
43
|
-
/>
|
|
44
|
-
<Button
|
|
45
|
-
label="Continue"
|
|
46
|
-
onClick={() => setActiveSheet('confirm')}
|
|
47
|
-
/>
|
|
48
|
-
</HStack>
|
|
29
|
+
<Button label="Review settings" onClick={() => setStep('review')} />
|
|
30
|
+
<BottomSheet
|
|
31
|
+
isOpen={step === 'review'}
|
|
32
|
+
onOpenChange={close('review')}
|
|
33
|
+
label="Review notification settings"
|
|
34
|
+
height="hug"
|
|
35
|
+
purpose="form">
|
|
36
|
+
<Section padding={4}>
|
|
37
|
+
<VStack gap={4}>
|
|
38
|
+
<VStack gap={1}>
|
|
39
|
+
<Heading level={3}>Review settings</Heading>
|
|
40
|
+
<Text type="supporting" color="secondary">
|
|
41
|
+
Daily summaries will be sent by email.
|
|
42
|
+
</Text>
|
|
49
43
|
</VStack>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
<HStack gap={2} hAlign="end">
|
|
45
|
+
<Button
|
|
46
|
+
label="Cancel"
|
|
47
|
+
variant="secondary"
|
|
48
|
+
onClick={() => setStep(null)}
|
|
49
|
+
/>
|
|
50
|
+
<Button label="Continue" onClick={() => setStep('confirm')} />
|
|
51
|
+
</HStack>
|
|
52
|
+
</VStack>
|
|
53
|
+
</Section>
|
|
54
|
+
</BottomSheet>
|
|
55
|
+
<BottomSheet
|
|
56
|
+
isOpen={step === 'confirm'}
|
|
57
|
+
onOpenChange={close('confirm')}
|
|
58
|
+
label="Confirm settings"
|
|
59
|
+
height="hug">
|
|
60
|
+
<Section padding={4}>
|
|
61
|
+
<VStack gap={4}>
|
|
62
|
+
<VStack gap={1}>
|
|
63
|
+
<Heading level={3}>Confirm settings</Heading>
|
|
64
|
+
<Text type="supporting" color="secondary">
|
|
65
|
+
Your notification settings are ready to save.
|
|
66
|
+
</Text>
|
|
69
67
|
</VStack>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
<HStack gap={2} hAlign="end">
|
|
69
|
+
<Button
|
|
70
|
+
label="Back"
|
|
71
|
+
variant="secondary"
|
|
72
|
+
onClick={() => setStep('review')}
|
|
73
|
+
/>
|
|
74
|
+
<Button label="Save" onClick={() => setStep(null)} />
|
|
75
|
+
</HStack>
|
|
76
|
+
</VStack>
|
|
77
|
+
</Section>
|
|
78
|
+
</BottomSheet>
|
|
73
79
|
</>
|
|
74
80
|
);
|
|
75
81
|
}
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'BottomSheetSwitcher',
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
alsoExampleFor: ['BottomSheet'],
|
|
8
|
+
// The published registry identity predates the rewrite; keep it.
|
|
9
|
+
registry: {slug: 'default'},
|
|
10
|
+
name: 'Bottom Sheet — Multi-step flow',
|
|
11
|
+
displayName: 'Bottom Sheet — Multi-step flow',
|
|
9
12
|
description:
|
|
10
|
-
'A three-step flow
|
|
13
|
+
'A three-step flow of standalone sheets of different heights, driven by one state value: moving on replaces the open step in place. This is the replacement for the deprecated BottomSheetSwitcher.',
|
|
11
14
|
isReady: true,
|
|
12
15
|
isShowcase: true,
|
|
13
16
|
aspectRatio: 3 / 4,
|
|
14
17
|
componentsUsed: [
|
|
15
18
|
'BottomSheet',
|
|
16
|
-
'BottomSheetSwitcher',
|
|
17
19
|
'Button',
|
|
18
20
|
'CheckboxInput',
|
|
19
21
|
'Divider',
|