@astryxdesign/cli 0.7.0-canary.2e0dbb5 → 0.7.0-canary.3045eda

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.
Files changed (43) hide show
  1. package/api/doctor/doctor.d.mts +30 -2
  2. package/api/doctor/doctor.doc.mjs +2 -1
  3. package/api/doctor/doctor.mjs +153 -3
  4. package/api/doctor/doctor.test.mjs +250 -4
  5. package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
  6. package/assets/codemods/transforms/next/__tests__/preserve-bottom-sheet-content-padding.test.mjs +178 -0
  7. package/assets/codemods/transforms/next/__tests__/rename-empty-search-results-text.test.mjs +202 -0
  8. package/assets/codemods/transforms/next/index.mjs +24 -0
  9. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  10. package/assets/codemods/transforms/next/preserve-bottom-sheet-content-padding.mjs +242 -0
  11. package/assets/codemods/transforms/next/rename-empty-search-results-text.mjs +254 -0
  12. package/assets/docs/spacing.doc.mjs +2 -2
  13. package/assets/docs/tree/tokens-spacing.doc.mjs +15 -15
  14. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +1 -1
  15. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +1 -1
  16. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +1 -1
  17. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +1 -1
  18. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  19. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  20. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  21. package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +1 -1
  22. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  23. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  24. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  25. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  26. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  27. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  28. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  29. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  30. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  31. package/assets/templates/pages/canvas-editor/page.tsx +1 -1
  32. package/assets/templates/pages/table-filter/page.tsx +11 -6
  33. package/assets/templates/pages/table-inbox/page.tsx +3 -1
  34. package/assets/templates/themes/butter/butterTheme.ts +12 -0
  35. package/assets/templates/themes/chocolate/chocolateTheme.ts +12 -0
  36. package/assets/templates/themes/matcha/matchaTheme.ts +14 -14
  37. package/assets/templates/themes/neutral/neutralTheme.ts +12 -0
  38. package/assets/templates/themes/stone/stoneTheme.ts +12 -0
  39. package/assets/templates/themes/y2k/y2kTheme.ts +10 -10
  40. package/assets/theme.template.ts +1 -1
  41. package/clients/cli/commands/doctor.doc.mjs +1 -1
  42. package/clients/cli/commands/doctor.test.mjs +33 -0
  43. package/package.json +9 -9
@@ -0,0 +1,242 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Codemod: preserve BottomSheet content geometry after it became a container
5
+ *
6
+ * BottomSheet now pads its content box like Dialog (theme `bottom-sheet`
7
+ * padding, else `--spacing-4`). Before, the content box had no padding, so
8
+ * callers supplied their own inset. This codemod keeps every existing sheet's
9
+ * geometry by adding `padding={0}` to imported BottomSheet elements that do not
10
+ * set `padding`.
11
+ *
12
+ * Sheets whose only child is a core `Section` or `Layout` are left alone: both
13
+ * escape the inset their container publishes, so they already render exactly
14
+ * as they did in the unpadded box.
15
+ *
16
+ * `padding={0}` goes before the first spread attribute, so a spread that
17
+ * carries `padding` still wins.
18
+ *
19
+ * `padding={0}` also zeroes the inset a nested `Layout` puts between its
20
+ * regions: a Layout's own `padding` restores only its outer edges, and the
21
+ * inner inset comes from the sheet's container chain. Such a sheet still gets
22
+ * `padding={0}`, plus a TODO comment on its statement (api.report is a stub;
23
+ * comments are the only warning channel).
24
+ */
25
+
26
+ export const meta = {
27
+ title: 'Preserve BottomSheet content padding',
28
+ description:
29
+ 'BottomSheet now pads its content like Dialog. Adds `padding={0}` to ' +
30
+ 'BottomSheet elements that do not set `padding`, keeping their previous ' +
31
+ 'unpadded content box. Sheets whose only child is a Section ' +
32
+ 'or Layout are left unchanged; they render identically. A sheet with a ' +
33
+ 'nested Layout anywhere in its content also gets a TODO comment, because ' +
34
+ "padding={0} removes the inset between that Layout's regions and the " +
35
+ "Layout's own padding restores only its outer edges. Remove " +
36
+ '`padding={0}` and your own inset to adopt the theme padding. An app ' +
37
+ 'whose theme already sets `bottom-sheet` padding on every edge is not ' +
38
+ 'affected by the new default; the transform cannot see the theme, so ' +
39
+ 'remove the added `padding={0}` there to keep the theme inset.',
40
+ };
41
+
42
+ const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
43
+
44
+ const TODO_COMMENT =
45
+ ' TODO(astryx upgrade): BottomSheet now pads its content like Dialog. ' +
46
+ 'padding={0} keeps the unpadded content box, but it also removes the inset ' +
47
+ "between a nested Layout's regions, which the Layout's own padding does " +
48
+ "not restore. Drop padding={0} and the sheet content's own inset, or give " +
49
+ 'the Layout its inset another way. ';
50
+
51
+ /**
52
+ * Local JSX names bound to core components, by imported name.
53
+ * @param {any} root
54
+ * @param {any} j
55
+ * @param {string} component
56
+ * @returns {{direct: Set<string>, namespaces: Set<string>}}
57
+ */
58
+ function findBindings(root, j, component) {
59
+ const direct = new Set();
60
+ const namespaces = new Set();
61
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ importPath) => {
62
+ const source = importPath.node.source.value;
63
+ if (
64
+ importPath.node.importKind === 'type' ||
65
+ typeof source !== 'string' ||
66
+ !CORE_IMPORT_RE.test(source)
67
+ ) {
68
+ return;
69
+ }
70
+ const subpath = source.split('/').at(-1);
71
+ for (const specifier of importPath.node.specifiers ?? []) {
72
+ if (specifier.importKind === 'type') continue;
73
+ if (specifier.type === 'ImportSpecifier') {
74
+ const imported = specifier.imported?.name ?? specifier.imported?.value;
75
+ if (imported === component) {
76
+ direct.add(specifier.local?.name ?? imported);
77
+ }
78
+ } else if (
79
+ specifier.type === 'ImportDefaultSpecifier' &&
80
+ subpath === component
81
+ ) {
82
+ direct.add(specifier.local.name);
83
+ } else if (specifier.type === 'ImportNamespaceSpecifier') {
84
+ namespaces.add(specifier.local.name);
85
+ }
86
+ }
87
+ });
88
+ return {direct, namespaces};
89
+ }
90
+
91
+ /**
92
+ * @param {any} name JSX element name node
93
+ * @param {{direct: Set<string>, namespaces: Set<string>}} bindings
94
+ * @param {string} component
95
+ */
96
+ function nameMatches(name, bindings, component) {
97
+ if (name?.type === 'JSXIdentifier') {
98
+ return bindings.direct.has(name.name);
99
+ }
100
+ return (
101
+ name?.type === 'JSXMemberExpression' &&
102
+ name.object?.type === 'JSXIdentifier' &&
103
+ bindings.namespaces.has(name.object.name) &&
104
+ name.property?.name === component
105
+ );
106
+ }
107
+
108
+ // A parameter or local declaration with the imported name shadows the module
109
+ // binding (same rule as transform-prop.mjs): only a tag whose root binding
110
+ // resolves to the Program scope is the imported component.
111
+ /** @param {any} elementPath @param {any} name */
112
+ function isModuleBinding(elementPath, name) {
113
+ const localName =
114
+ name?.type === 'JSXIdentifier'
115
+ ? name.name
116
+ : name?.type === 'JSXMemberExpression' &&
117
+ name.object?.type === 'JSXIdentifier'
118
+ ? name.object.name
119
+ : null;
120
+ if (localName == null) return false;
121
+ const scope = elementPath.scope?.lookup(localName);
122
+ return scope?.path?.node?.type === 'Program';
123
+ }
124
+
125
+ /**
126
+ * Children that render something: drops whitespace-only text and empty
127
+ * `{}` / `{/* comment *\/}` containers.
128
+ * @param {any[]} children
129
+ */
130
+ function meaningfulChildren(children) {
131
+ return children.filter((/** @type {any} */ child) => {
132
+ if (child.type === 'JSXText') {
133
+ return child.value.trim() !== '';
134
+ }
135
+ if (child.type === 'JSXExpressionContainer') {
136
+ return child.expression?.type !== 'JSXEmptyExpression';
137
+ }
138
+ return true;
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Attach the TODO to the nearest enclosing statement: a comment on a JSX node
144
+ * inside JSX children would print as text.
145
+ * @param {any} j
146
+ * @param {any} elementPath
147
+ */
148
+ function addTodo(j, elementPath) {
149
+ let path = elementPath;
150
+ while (path && !j.Statement.check(path.node)) {
151
+ path = path.parent;
152
+ }
153
+ if (!path) return;
154
+ const host = path.node;
155
+ host.comments = host.comments ?? [];
156
+ if (host.comments.some((/** @type {any} */ c) => c.value === TODO_COMMENT)) {
157
+ return;
158
+ }
159
+ host.comments.push(j.commentBlock(TODO_COMMENT, true, false));
160
+ }
161
+
162
+ /**
163
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
164
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
165
+ * @returns {string | null | undefined}
166
+ */
167
+ export default function transformer(file, api) {
168
+ if (!file.source.includes('BottomSheet')) return undefined;
169
+ const j = api.jscodeshift;
170
+ const root = j(file.source);
171
+ const sheets = findBindings(root, j, 'BottomSheet');
172
+ if (sheets.direct.size === 0 && sheets.namespaces.size === 0) {
173
+ return undefined;
174
+ }
175
+ const sections = findBindings(root, j, 'Section');
176
+ const layouts = findBindings(root, j, 'Layout');
177
+ let hasChanges = false;
178
+
179
+ root.find(j.JSXElement).forEach((/** @type {any} */ elementPath) => {
180
+ const opening = elementPath.node.openingElement;
181
+ if (!nameMatches(opening.name, sheets, 'BottomSheet')) return;
182
+ if (!isModuleBinding(elementPath, opening.name)) return;
183
+
184
+ const attributes = opening.attributes ?? [];
185
+ const setsPadding = attributes.some(
186
+ (/** @type {any} */ attribute) =>
187
+ attribute.type === 'JSXAttribute' && attribute.name?.name === 'padding',
188
+ );
189
+ if (setsPadding) return;
190
+
191
+ const children = meaningfulChildren(elementPath.node.children ?? []);
192
+ const hasChildrenAttribute = attributes.some(
193
+ (/** @type {any} */ attribute) =>
194
+ attribute.type === 'JSXAttribute' &&
195
+ attribute.name?.name === 'children',
196
+ );
197
+ if (
198
+ !hasChildrenAttribute &&
199
+ children.length === 1 &&
200
+ children[0].type === 'JSXElement' &&
201
+ (nameMatches(children[0].openingElement.name, sections, 'Section') ||
202
+ nameMatches(children[0].openingElement.name, layouts, 'Layout')) &&
203
+ isModuleBinding(
204
+ elementPath.get('children', 0),
205
+ children[0].openingElement.name,
206
+ )
207
+ ) {
208
+ return;
209
+ }
210
+
211
+ const padding = j.jsxAttribute(
212
+ j.jsxIdentifier('padding'),
213
+ j.jsxExpressionContainer(j.numericLiteral(0)),
214
+ );
215
+ const firstSpread = attributes.findIndex(
216
+ (/** @type {any} */ attribute) => attribute.type === 'JSXSpreadAttribute',
217
+ );
218
+ if (firstSpread === -1) {
219
+ attributes.push(padding);
220
+ } else {
221
+ attributes.splice(firstSpread, 0, padding);
222
+ }
223
+ opening.attributes = attributes;
224
+ hasChanges = true;
225
+
226
+ // Any nested core Layout loses the inset between its regions, with or
227
+ // without its own padding, so every one gets the TODO.
228
+ const hasNestedLayout =
229
+ j(elementPath)
230
+ .find(j.JSXOpeningElement)
231
+ .filter(
232
+ (/** @type {any} */ openingPath) =>
233
+ nameMatches(openingPath.node.name, layouts, 'Layout') &&
234
+ isModuleBinding(openingPath, openingPath.node.name),
235
+ ).length > 0;
236
+ if (hasNestedLayout) {
237
+ addTodo(j, elementPath);
238
+ }
239
+ });
240
+
241
+ return hasChanges ? root.toSource() : undefined;
242
+ }
@@ -0,0 +1,254 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Codemod: rename emptySearchResultsText to emptySearchText
5
+ *
6
+ * `emptySearchResultsText` was renamed to `emptySearchText` (`spec:AST-056`
7
+ * FR1) and the old name is removed in a minor release. The new prop takes a
8
+ * `ReactNode`, so every old `string` value stays valid and the rename never
9
+ * changes a value.
10
+ *
11
+ * A straight rename at the JSX boundary, through the shared `transformProp`
12
+ * helper: the prop on an imported `Tokenizer`, `Typeahead`, or `BaseTypeahead`
13
+ * element, and the key on `ChatComposerInput` trigger objects written inline
14
+ * in its `triggers` prop. Like every transform built on the helper it does
15
+ * not follow variables, helpers, spreads, wrappers, or types. Where it cannot
16
+ * attribute the value it leaves a TODO instead of choosing a winner: the new
17
+ * name already set, any spread onto one of these elements (whether or not the
18
+ * element writes the old name itself — a spread may carry either name or the
19
+ * triggers), a `triggers` value that is not an inline object or array, or a
20
+ * trigger object with a spread or computed key. A value forwarded through a
21
+ * spread is the one case the type checker cannot report after the removal,
22
+ * which is why every spread gets the TODO.
23
+ */
24
+
25
+ import {transformProp} from '../../transform-prop.mjs';
26
+
27
+ export const meta = {
28
+ title: 'Rename emptySearchResultsText to emptySearchText',
29
+ description:
30
+ 'Renames the removed `emptySearchResultsText` prop to `emptySearchText` ' +
31
+ 'on imported Tokenizer, Typeahead, and BaseTypeahead elements, and the ' +
32
+ "same key on trigger objects written inline in ChatComposerInput's " +
33
+ '`triggers`. Leaves a TODO where the new name is already set, on every ' +
34
+ 'spread onto these elements, where the triggers value is not written ' +
35
+ 'inline, and on a trigger object with a spread or computed key.',
36
+ };
37
+
38
+ const OLD_NAME = 'emptySearchResultsText';
39
+ const NEW_NAME = 'emptySearchText';
40
+ const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
41
+
42
+ const COMPONENTS = new Map([
43
+ ['Tokenizer', new Set([OLD_NAME])],
44
+ ['Typeahead', new Set([OLD_NAME])],
45
+ ['BaseTypeahead', new Set([OLD_NAME])],
46
+ ['ChatComposerInput', new Set(['triggers'])],
47
+ ]);
48
+
49
+ const BOTH_SET_COMMENT =
50
+ ' TODO(astryx upgrade): emptySearchResultsText was removed and ' +
51
+ 'emptySearchText is already set here; delete the old one if the new value ' +
52
+ 'is what you want. ';
53
+ const UNREADABLE_OBJECT_COMMENT =
54
+ ' TODO(astryx upgrade): emptySearchResultsText was removed. Rename it to ' +
55
+ 'emptySearchText by hand; this object has a spread or computed key. ';
56
+ const SPREAD_COMMENT =
57
+ ' TODO(astryx upgrade): emptySearchResultsText was removed. This element ' +
58
+ 'spreads props that may carry either name; rename to emptySearchText ' +
59
+ 'where the props are built and delete the old one. ';
60
+ const OPAQUE_TRIGGERS_COMMENT =
61
+ ' TODO(astryx upgrade): emptySearchResultsText was removed. These triggers ' +
62
+ 'are built elsewhere; rename the key to emptySearchText where they are ' +
63
+ 'built. ';
64
+
65
+ const TYPE_WRAPPERS = new Set([
66
+ 'TSAsExpression',
67
+ 'TSSatisfiesExpression',
68
+ 'TSTypeAssertion',
69
+ 'TSNonNullExpression',
70
+ 'TypeCastExpression',
71
+ 'ParenthesizedExpression',
72
+ ]);
73
+
74
+ /** @param {any} node */
75
+ function unwrap(node) {
76
+ let current = node;
77
+ while (current && TYPE_WRAPPERS.has(current.type)) {
78
+ current = current.expression;
79
+ }
80
+ return current;
81
+ }
82
+
83
+ /** @param {any} property */
84
+ function staticPropertyName(property) {
85
+ if (property.computed) return null;
86
+ const key = property.key;
87
+ if (key?.type === 'Identifier') return key.name;
88
+ if (key?.type === 'StringLiteral' || key?.type === 'Literal') {
89
+ return typeof key.value === 'string' ? key.value : null;
90
+ }
91
+ return null;
92
+ }
93
+
94
+ /**
95
+ * Attach a comment to a node once (re-running the codemod adds nothing).
96
+ * @param {any} j @param {any} node @param {string} text
97
+ */
98
+ function addComment(j, node, text) {
99
+ node.comments ??= [];
100
+ if (node.comments.some((/** @type {any} */ c) => c.value === text)) {
101
+ return false;
102
+ }
103
+ node.comments.push(j.commentBlock(text, true, false));
104
+ return true;
105
+ }
106
+
107
+ /**
108
+ * Rename the key on one trigger object literal.
109
+ * @param {any} j @param {any} object @returns {boolean}
110
+ */
111
+ function renameTriggerKey(j, object) {
112
+ const old = object.properties.find(
113
+ (/** @type {any} */ property) => staticPropertyName(property) === OLD_NAME,
114
+ );
115
+ const unreadable = object.properties.find(
116
+ (/** @type {any} */ property) =>
117
+ property.type === 'SpreadElement' ||
118
+ property.type === 'SpreadProperty' ||
119
+ property.computed,
120
+ );
121
+ // A spread or computed key may carry the removed key itself, so the
122
+ // object gets the TODO whether or not it writes the old name.
123
+ if (unreadable) {
124
+ return addComment(j, old ?? unreadable, UNREADABLE_OBJECT_COMMENT);
125
+ }
126
+ if (!old) return false;
127
+ const already = object.properties.some(
128
+ (/** @type {any} */ property) => staticPropertyName(property) === NEW_NAME,
129
+ );
130
+ if (already) return addComment(j, old, BOTH_SET_COMMENT);
131
+ old.key = j.identifier(NEW_NAME);
132
+ if (old.shorthand) old.shorthand = false;
133
+ return true;
134
+ }
135
+
136
+ /** @param {any} fileInfo @param {any} api */
137
+ export default function transform(fileInfo, api) {
138
+ const j = api.jscodeshift;
139
+ const root = j(fileInfo.source);
140
+ let changed = false;
141
+
142
+ transformProp(
143
+ root,
144
+ j,
145
+ {
146
+ matchesImport: source => CORE_IMPORT_RE.test(source),
147
+ components: COMPONENTS,
148
+ },
149
+ (propPath, {component}) => {
150
+ const prop = propPath.node;
151
+ const attributes = propPath.parent.node.attributes ?? [];
152
+ const hasSpread = attributes.some(
153
+ (/** @type {any} */ attribute) =>
154
+ attribute.type === 'JSXSpreadAttribute',
155
+ );
156
+ if (component === 'ChatComposerInput') {
157
+ // `triggers={[{...}, {...}]}` or `triggers={{...}}`: rename the key
158
+ // on each object written inline; a value built elsewhere, or an
159
+ // element whose spread may carry triggers, gets a TODO.
160
+ const value =
161
+ prop.value?.type === 'JSXExpressionContainer'
162
+ ? unwrap(prop.value.expression)
163
+ : null;
164
+ const items =
165
+ value?.type === 'ArrayExpression'
166
+ ? value.elements.map((/** @type {any} */ e) => unwrap(e))
167
+ : [value];
168
+ let opaque = hasSpread;
169
+ for (const item of items) {
170
+ if (item?.type === 'ObjectExpression') {
171
+ changed = renameTriggerKey(j, item) || changed;
172
+ } else {
173
+ opaque = true;
174
+ }
175
+ }
176
+ if (opaque) {
177
+ changed = addComment(j, prop, OPAQUE_TRIGGERS_COMMENT) || changed;
178
+ }
179
+ return;
180
+ }
181
+ if (hasSpread) {
182
+ changed = addComment(j, prop, SPREAD_COMMENT) || changed;
183
+ return;
184
+ }
185
+ const already = attributes.some(
186
+ (/** @type {any} */ attribute) =>
187
+ attribute.type === 'JSXAttribute' &&
188
+ attribute.name?.name === NEW_NAME,
189
+ );
190
+ if (already) {
191
+ changed = addComment(j, prop, BOTH_SET_COMMENT) || changed;
192
+ return;
193
+ }
194
+ prop.name.name = NEW_NAME;
195
+ changed = true;
196
+ },
197
+ );
198
+
199
+ // Every spread onto one of these elements that the prop pass did not reach
200
+ // (the element writes neither the old name nor, for ChatComposerInput,
201
+ // `triggers`): the spread may carry the removed key, so it gets the TODO.
202
+ for (const [component, props] of COMPONENTS) {
203
+ const sentinel = `__astryx_spread_${component}`;
204
+ root
205
+ .find(j.JSXOpeningElement)
206
+ .filter((/** @type {any} */ path) =>
207
+ (path.node.attributes ?? []).some(
208
+ (/** @type {any} */ attribute) =>
209
+ attribute.type === 'JSXSpreadAttribute',
210
+ ),
211
+ )
212
+ .forEach((/** @type {any} */ path) => {
213
+ const attributes = path.node.attributes ?? [];
214
+ const names = new Set(
215
+ attributes
216
+ .filter((/** @type {any} */ a) => a.type === 'JSXAttribute')
217
+ .map((/** @type {any} */ a) => a.name?.name),
218
+ );
219
+ if ([...props].some(name => names.has(name))) return;
220
+ // Let the shared helper decide whether this element is the imported
221
+ // component: give it a sentinel prop to find, then take it back.
222
+ const marker = j.jsxAttribute(j.jsxIdentifier(sentinel));
223
+ path.node.attributes = [...attributes, marker];
224
+ let matched = false;
225
+ transformProp(
226
+ root,
227
+ j,
228
+ {
229
+ matchesImport: source => CORE_IMPORT_RE.test(source),
230
+ components: new Map([[component, new Set([sentinel])]]),
231
+ },
232
+ propPath => {
233
+ if (propPath.node === marker) matched = true;
234
+ },
235
+ );
236
+ path.node.attributes = attributes;
237
+ if (!matched) return;
238
+ const spread = attributes.find(
239
+ (/** @type {any} */ attribute) =>
240
+ attribute.type === 'JSXSpreadAttribute',
241
+ );
242
+ changed =
243
+ addComment(
244
+ j,
245
+ spread,
246
+ component === 'ChatComposerInput'
247
+ ? OPAQUE_TRIGGERS_COMMENT
248
+ : SPREAD_COMMENT,
249
+ ) || changed;
250
+ });
251
+ }
252
+
253
+ return changed ? root.toSource({quote: 'single'}) : null;
254
+ }
@@ -18,7 +18,7 @@ export const docs = {
18
18
  content: [
19
19
  {
20
20
  type: 'prose',
21
- text: 'The design system uses a 4px base-unit spacing scale. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
21
+ text: 'The design system uses a 4px base-unit spacing scale, written in rem so gaps and padding grow with the reader\'s browser font size the way text does: each step is 0.25rem, which is 4px at the default 16px root. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
22
22
  },
23
23
  ],
24
24
  },
@@ -28,7 +28,7 @@ export const docs = {
28
28
  content: [
29
29
  {
30
30
  type: 'prose',
31
- text: 'Fifteen spacing tokens, from 0px to 48px.',
31
+ text: 'Fifteen spacing tokens, from 0 to 3rem (0px to 48px at the default 16px root).',
32
32
  },
33
33
  {
34
34
  type: 'token-ref',
@@ -35,63 +35,63 @@ export const docs = {
35
35
  "rows": [
36
36
  [
37
37
  "--spacing-0",
38
- "0px"
38
+ "0rem"
39
39
  ],
40
40
  [
41
41
  "--spacing-0-5",
42
- "2px"
42
+ "0.125rem"
43
43
  ],
44
44
  [
45
45
  "--spacing-1",
46
- "4px"
46
+ "0.25rem"
47
47
  ],
48
48
  [
49
49
  "--spacing-1-5",
50
- "6px"
50
+ "0.375rem"
51
51
  ],
52
52
  [
53
53
  "--spacing-2",
54
- "8px"
54
+ "0.5rem"
55
55
  ],
56
56
  [
57
57
  "--spacing-3",
58
- "12px"
58
+ "0.75rem"
59
59
  ],
60
60
  [
61
61
  "--spacing-4",
62
- "16px"
62
+ "1rem"
63
63
  ],
64
64
  [
65
65
  "--spacing-5",
66
- "20px"
66
+ "1.25rem"
67
67
  ],
68
68
  [
69
69
  "--spacing-6",
70
- "24px"
70
+ "1.5rem"
71
71
  ],
72
72
  [
73
73
  "--spacing-7",
74
- "28px"
74
+ "1.75rem"
75
75
  ],
76
76
  [
77
77
  "--spacing-8",
78
- "32px"
78
+ "2rem"
79
79
  ],
80
80
  [
81
81
  "--spacing-9",
82
- "36px"
82
+ "2.25rem"
83
83
  ],
84
84
  [
85
85
  "--spacing-10",
86
- "40px"
86
+ "2.5rem"
87
87
  ],
88
88
  [
89
89
  "--spacing-11",
90
- "44px"
90
+ "2.75rem"
91
91
  ],
92
92
  [
93
93
  "--spacing-12",
94
- "48px"
94
+ "3rem"
95
95
  ]
96
96
  ]
97
97
  }
@@ -34,7 +34,7 @@ export default function BottomSheetHeights() {
34
34
  onOpenChange={isOpen => !isOpen && setHeight(null)}
35
35
  label={`${height ?? 'Hug'} height`}
36
36
  height={height ?? 'hug'}>
37
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
37
+ <VStack gap={4}>
38
38
  <Heading level={3}>{height ?? 'Hug'} height</Heading>
39
39
  <Divider />
40
40
  <Text type="body">{descriptions[height ?? 'hug']}</Text>
@@ -51,7 +51,7 @@ export default function BottomSheetMobileKeyboard() {
51
51
  event.preventDefault();
52
52
  setIsOpen(false);
53
53
  }}>
54
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
54
+ <VStack gap={4}>
55
55
  <Heading level={3}>Edit profile</Heading>
56
56
  <Divider />
57
57
  <Text type="supporting" color="secondary">
@@ -33,7 +33,7 @@ export default function BottomSheetNoScrim() {
33
33
  label="Place details"
34
34
  height="hug"
35
35
  hasScrim={false}>
36
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
36
+ <VStack gap={4}>
37
37
  <Heading level={3}>Central Park</Heading>
38
38
  <Divider />
39
39
  <Text type="body">
@@ -122,7 +122,7 @@ export default function BottomSheetSnapPoints() {
122
122
  label="Directions to the Ferry Building"
123
123
  height="tall"
124
124
  snapPoints={SNAP_POINTS}>
125
- <VStack gap={4} padding={4}>
125
+ <VStack gap={4}>
126
126
  <VStack gap={1}>
127
127
  <Heading level={3}>Ferry Building</Heading>
128
128
  <HStack gap={2}>
@@ -47,7 +47,7 @@ export default function ComplexSelectorDeadlinePicker() {
47
47
  value={value}
48
48
  onChange={setValue}
49
49
  triggerLabel={formatDeadline(value)}
50
- style={{width: 320}}>
50
+ controlStyle={{width: 320}}>
51
51
  {(selectedValue, onChange, close) => {
52
52
  const set = (patch: Partial<Deadline>) =>
53
53
  onChange({...selectedValue, ...patch});
@@ -184,7 +184,7 @@ export default function ComplexSelectorShowcase() {
184
184
  value={value}
185
185
  onChange={setValue}
186
186
  triggerLabel={`${value.fruit} · ${value.ripeness}`}
187
- style={{width: 280}}>
187
+ controlStyle={{width: 280}}>
188
188
  {(selectedValue, onChange, close) => (
189
189
  <FruitRipenessGrid
190
190
  value={selectedValue}
@@ -175,7 +175,7 @@ export default function ComplexSelectorTreeSearch() {
175
175
  value={value}
176
176
  onChange={setValue}
177
177
  triggerLabel={value.path}
178
- style={{width: 360}}>
178
+ controlStyle={{width: 360}}>
179
179
  {(selectedValue, onChange, close) => (
180
180
  <DestinationSearch
181
181
  value={selectedValue}
@@ -68,7 +68,7 @@ function AdaptiveDialog({
68
68
  label={title}
69
69
  purpose={purpose}
70
70
  height={bottomSheetHeight}>
71
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
71
+ <VStack gap={4}>
72
72
  <Heading level={3}>{title}</Heading>
73
73
  {children}
74
74
  {footer}
@@ -29,7 +29,7 @@ export default function InternationalizationProviderShippedLocale() {
29
29
  <SegmentedControlItem value="fr-FR" label="FR" />
30
30
  </SegmentedControl>
31
31
  <Selector
32
- style={{width: 300}}
32
+ controlStyle={{width: 300}}
33
33
  label="Billing region"
34
34
  options={[
35
35
  {value: 'americas', label: 'Americas'},