@astryxdesign/cli 0.7.7 → 0.7.8-canary.36cde5e

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 (27) hide show
  1. package/api/gap-report/gap-report.mjs +9 -4
  2. package/api/integration/authoring-checks.mjs +31 -0
  3. package/api/integration/check/check.mjs +8 -3
  4. package/assets/codemods/transforms/next/index.mjs +11 -1
  5. package/assets/codemods/transforms/next/promote-tokenizer-presentation.mjs +174 -0
  6. package/assets/discover/official-packages.json +4 -8
  7. package/assets/templates/blocks/components/Hooks/useAnnounceHookUsage.doc.mjs +14 -0
  8. package/assets/templates/blocks/components/Hooks/useAnnounceHookUsage.tsx +90 -0
  9. package/assets/templates/blocks/components/Hooks/useFocusTrapHookUsage.doc.mjs +14 -0
  10. package/assets/templates/blocks/components/Hooks/useFocusTrapHookUsage.tsx +70 -0
  11. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -0
  12. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +1 -0
  13. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -0
  14. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -0
  15. package/assets/templates/blocks/components/createAnimator/AnimatorPlayingCardsVanilla.doc.mjs +14 -0
  16. package/assets/templates/blocks/components/createAnimator/AnimatorPlayingCardsVanilla.tsx +199 -0
  17. package/assets/templates/blocks/components/useAnimator/AnimatorPlayingCards.doc.mjs +21 -0
  18. package/assets/templates/blocks/components/useAnimator/AnimatorPlayingCards.tsx +210 -0
  19. package/assets/templates/pages/table-inbox/page.tsx +6 -0
  20. package/assets/templates/pages/work-item-detail/page.tsx +1 -0
  21. package/foundation/discovery/component-discovery.mjs +26 -6
  22. package/foundation/fs/listing-cache.d.mts +15 -0
  23. package/foundation/fs/listing-cache.mjs +50 -1
  24. package/foundation/fs/paths.mjs +50 -5
  25. package/foundation/integrations/public-imports.d.mts +24 -0
  26. package/foundation/integrations/public-imports.mjs +2 -2
  27. package/package.json +9 -9
@@ -345,6 +345,9 @@ function failedHandler(message) {
345
345
  * process.exitCode, stdout, and every continuation the handler creates. A
346
346
  * timeout aborts the supplied signal, gives the handler one short turn to
347
347
  * observe it, then terminates the isolate before the next handler starts.
348
+ * `timeoutMs` is the handler's own time and starts once its module has
349
+ * loaded. Starting the worker and loading the module have the default
350
+ * deadline.
348
351
  *
349
352
  * @param {Extract<HandlerEntry, {kind: 'handler'}>} entry
350
353
  * @param {GapReport} report cloned before this call
@@ -393,7 +396,8 @@ async function callHandler(entry, report, timeoutMs = HANDLER_TIMEOUT_MS) {
393
396
  .finally(() => resolve(outcome));
394
397
  };
395
398
 
396
- const beginTimeout = () => {
399
+ /** @param {number} deadlineMs */
400
+ const beginTimeout = deadlineMs => {
397
401
  if (timeout !== undefined) clearTimeout(timeout);
398
402
  timeout = setTimeout(() => {
399
403
  if (settled) return;
@@ -407,13 +411,13 @@ async function callHandler(entry, report, timeoutMs = HANDLER_TIMEOUT_MS) {
407
411
  () => finish(timeoutOutcome),
408
412
  HANDLER_ABORT_GRACE_MS,
409
413
  );
410
- }, timeoutMs);
414
+ }, deadlineMs);
411
415
  };
412
416
 
413
417
  worker.on('message', message => {
414
418
  if (settled || timedOut) return;
415
419
  if (message?.kind === 'ready') {
416
- beginTimeout();
420
+ beginTimeout(timeoutMs);
417
421
  return;
418
422
  }
419
423
  if (message?.kind === 'exit-code') {
@@ -458,7 +462,8 @@ async function callHandler(entry, report, timeoutMs = HANDLER_TIMEOUT_MS) {
458
462
  finish(failedHandler(`Handler called process.exit(${String(code)}).`));
459
463
  });
460
464
 
461
- beginTimeout();
465
+ // A short handler budget must not cover a slow start on a busy machine.
466
+ beginTimeout(Math.max(timeoutMs, HANDLER_TIMEOUT_MS));
462
467
  });
463
468
  }
464
469
 
@@ -27,6 +27,7 @@ import {
27
27
  packageReferenceProblems,
28
28
  } from '../docs/_adapter.mjs';
29
29
  import {findProjectCoreDir} from '../../foundation/fs/paths.mjs';
30
+ import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
30
31
  import {
31
32
  discoverIntegrationComponents,
32
33
  discoverOwnedComponents,
@@ -154,6 +155,16 @@ function addErrors(issues, errors, code) {
154
155
  * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationTemplateConflictResponse>}
155
156
  */
156
157
  export async function integrationTemplateConflicts(pkg, options = {}) {
158
+ // Read-only: one listing of each folder serves the whole check.
159
+ return withListingCache(() => templateConflicts(pkg, options));
160
+ }
161
+
162
+ /**
163
+ * @param {string | undefined} pkg
164
+ * @param {import('./authoring-checks.type.mjs').IntegrationAuthoringOptions} options
165
+ * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationTemplateConflictResponse>}
166
+ */
167
+ async function templateConflicts(pkg, options) {
157
168
  const {cwd = process.cwd()} = options;
158
169
  const resolved = await resolveIntegration(pkg, cwd);
159
170
  const validated = resolved.found;
@@ -291,6 +302,16 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
291
302
  * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationComponentConflictResponse>}
292
303
  */
293
304
  export async function integrationComponentConflicts(pkg, options = {}) {
305
+ // Read-only: one listing of each folder serves the whole check.
306
+ return withListingCache(() => componentConflicts(pkg, options));
307
+ }
308
+
309
+ /**
310
+ * @param {string | undefined} pkg
311
+ * @param {import('./authoring-checks.type.mjs').IntegrationAuthoringOptions} options
312
+ * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationComponentConflictResponse>}
313
+ */
314
+ async function componentConflicts(pkg, options) {
294
315
  const {cwd = process.cwd()} = options;
295
316
  const resolved = await resolveIntegration(pkg, cwd);
296
317
  const validated = resolved.found;
@@ -387,6 +408,16 @@ export async function integrationComponentConflicts(pkg, options = {}) {
387
408
  * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationDocConflictResponse>}
388
409
  */
389
410
  export async function integrationDocConflicts(pkg, options = {}) {
411
+ // Read-only: one listing of each folder serves the whole check.
412
+ return withListingCache(() => docConflicts(pkg, options));
413
+ }
414
+
415
+ /**
416
+ * @param {string | undefined} pkg
417
+ * @param {import('./authoring-checks.type.mjs').IntegrationAuthoringOptions} options
418
+ * @returns {Promise<import('./authoring-checks.type.mjs').IntegrationDocConflictResponse>}
419
+ */
420
+ async function docConflicts(pkg, options) {
390
421
  const {cwd = process.cwd()} = options;
391
422
  const resolved = await resolveIntegration(pkg, cwd);
392
423
  const validated = resolved.found;
@@ -36,6 +36,7 @@ import {
36
36
  summarizeIssues,
37
37
  validateIntegration,
38
38
  } from '../validate-integration.mjs';
39
+ import {withListingCache} from '../../../foundation/fs/listing-cache.mjs';
39
40
 
40
41
  /** @typedef {import('../integration-check.type.mjs').IntegrationCheckName} IntegrationCheckName */
41
42
  /** @typedef {import('../integration-check.type.mjs').IntegrationCheckReport} IntegrationCheckReport */
@@ -244,9 +245,13 @@ export async function integrationCheck(options = {}) {
244
245
  /** @type {IntegrationCheckResponse[]} */
245
246
  const responses = [];
246
247
  responses.push(await validateIntegration(undefined, {cwd}));
247
- responses.push(await integrationComponentConflicts(undefined, {cwd}));
248
- responses.push(await integrationTemplateConflicts(undefined, {cwd}));
249
- responses.push(await integrationDocConflicts(undefined, {cwd}));
248
+ // The three authoring checks only read, so they share one listing of each
249
+ // folder.
250
+ await withListingCache(async () => {
251
+ responses.push(await integrationComponentConflicts(undefined, {cwd}));
252
+ responses.push(await integrationTemplateConflicts(undefined, {cwd}));
253
+ responses.push(await integrationDocConflicts(undefined, {cwd}));
254
+ });
250
255
 
251
256
  const [validation] = responses;
252
257
  return {
@@ -7,4 +7,14 @@
7
7
  * this file into the resolved version folder.
8
8
  */
9
9
 
10
- export default [];
10
+ import promoteTokenizerPresentation, {
11
+ meta as promoteTokenizerPresentationMeta,
12
+ } from './promote-tokenizer-presentation.mjs';
13
+
14
+ export default [
15
+ {
16
+ name: 'promote-tokenizer-presentation',
17
+ transform: promoteTokenizerPresentation,
18
+ meta: promoteTokenizerPresentationMeta,
19
+ },
20
+ ];
@@ -0,0 +1,174 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Codemod: move Tokenizer's experimental presentation to the stable prop
5
+ *
6
+ * `experimental={{presentation: x}}` on a Tokenizer becomes
7
+ * `presentation={x}`, or `presentation="x"` for a string. Other keys stay in
8
+ * the `experimental` object, and an object left empty is removed. The
9
+ * deprecated spelling selects the same surface, so the result renders the
10
+ * same. Built on the shared `transformProp` helper, so it does not follow
11
+ * variables, helpers, wrappers, or types. Where it cannot prove the result it
12
+ * keeps the deprecated spelling, which still works, and leaves a TODO: an
13
+ * `experimental` value that is not an object literal, a spread or computed
14
+ * key in it, a Tokenizer that already passes `presentation`, and a spread of
15
+ * props after `experimental`, which could set `presentation` over the moved
16
+ * value. A spread before `experimental` is safe: the moved attribute takes
17
+ * `experimental`'s place, so it still wins over the spread, as the
18
+ * experimental value did, and before this release a spread's `presentation`
19
+ * did nothing. Each TODO is added once, so a second run changes
20
+ * nothing.
21
+ */
22
+
23
+ import {transformProp} from '../../transform-prop.mjs';
24
+
25
+ export const meta = {
26
+ title: "Move Tokenizer's experimental presentation to presentation",
27
+ description:
28
+ 'Rewrites `experimental={{presentation: x}}` on Tokenizer to the stable ' +
29
+ '`presentation={x}`. Keeps the deprecated spelling, which still works, ' +
30
+ 'with a TODO where the experimental value is not an object literal, ' +
31
+ 'where the Tokenizer already passes presentation, and where it spreads ' +
32
+ 'props after experimental.',
33
+ };
34
+
35
+ const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
36
+ const COMPONENT_PROPS = new Map([['Tokenizer', new Set(['experimental'])]]);
37
+
38
+ const TODO_COMMENT =
39
+ ' TODO(astryx upgrade): experimental.presentation is deprecated. Pass ' +
40
+ 'presentation instead; this one was left unchanged because the codemod ' +
41
+ 'could not prove the rewrite. ';
42
+
43
+ const TYPE_WRAPPERS = new Set([
44
+ 'TSAsExpression',
45
+ 'TSSatisfiesExpression',
46
+ 'TSTypeAssertion',
47
+ 'TSNonNullExpression',
48
+ 'TypeCastExpression',
49
+ 'ParenthesizedExpression',
50
+ ]);
51
+
52
+ /** @param {any} node */
53
+ function unwrap(node) {
54
+ let current = node;
55
+ while (current && TYPE_WRAPPERS.has(current.type)) {
56
+ current = current.expression;
57
+ }
58
+ return current;
59
+ }
60
+
61
+ /** The static key of an object entry, or null. @param {any} entry */
62
+ function keyName(entry) {
63
+ if (
64
+ (entry.type !== 'ObjectProperty' && entry.type !== 'Property') ||
65
+ entry.computed
66
+ ) {
67
+ return null;
68
+ }
69
+ const key = entry.key;
70
+ if (key.type === 'Identifier') {
71
+ return key.name;
72
+ }
73
+ if (
74
+ (key.type === 'StringLiteral' || key.type === 'Literal') &&
75
+ typeof key.value === 'string'
76
+ ) {
77
+ return key.value;
78
+ }
79
+ return null;
80
+ }
81
+
82
+ /** @param {any} j @param {any} node @param {string} text */
83
+ function addComment(j, node, text) {
84
+ node.comments ??= [];
85
+ if (node.comments.some((/** @type {any} */ c) => c.value === text)) {
86
+ return false;
87
+ }
88
+ node.comments.push(j.commentBlock(text, true, false));
89
+ return true;
90
+ }
91
+
92
+ /**
93
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
94
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
95
+ * @returns {string | null | undefined}
96
+ */
97
+ export default function transformer(file, api) {
98
+ const j = api.jscodeshift;
99
+ const root = j(file.source);
100
+ let hasChanges = false;
101
+
102
+ transformProp(
103
+ root,
104
+ j,
105
+ {
106
+ matchesImport: source => CORE_IMPORT_RE.test(source),
107
+ components: COMPONENT_PROPS,
108
+ },
109
+ propPath => {
110
+ const opening = propPath.parent?.node;
111
+ const attributes = opening?.attributes ?? [];
112
+ const prop = propPath.node;
113
+ const value =
114
+ prop.value?.type === 'JSXExpressionContainer'
115
+ ? unwrap(prop.value.expression)
116
+ : null;
117
+ const entries =
118
+ value?.type === 'ObjectExpression' ? value.properties : [];
119
+ const presentationEntries = entries.filter(
120
+ (/** @type {any} */ entry) => keyName(entry) === 'presentation',
121
+ );
122
+ const hasUnprovenEntry = entries.some(
123
+ (/** @type {any} */ entry) => keyName(entry) == null,
124
+ );
125
+ if (
126
+ value?.type === 'ObjectExpression' &&
127
+ presentationEntries.length === 0 &&
128
+ !hasUnprovenEntry
129
+ ) {
130
+ return;
131
+ }
132
+ const isProvable =
133
+ value?.type === 'ObjectExpression' &&
134
+ presentationEntries.length === 1 &&
135
+ !hasUnprovenEntry &&
136
+ !attributes.some(
137
+ (/** @type {any} */ a, /** @type {number} */ index) =>
138
+ (a.type === 'JSXSpreadAttribute' &&
139
+ index > attributes.indexOf(prop)) ||
140
+ (a.type === 'JSXAttribute' && a.name?.name === 'presentation'),
141
+ );
142
+ if (!isProvable) {
143
+ hasChanges = addComment(j, prop, TODO_COMMENT) || hasChanges;
144
+ return;
145
+ }
146
+
147
+ const entry = presentationEntries[0];
148
+ const entryValue = entry.value;
149
+ const literal = unwrap(entryValue);
150
+ const attributeValue =
151
+ (literal?.type === 'StringLiteral' || literal?.type === 'Literal') &&
152
+ typeof literal.value === 'string'
153
+ ? j.stringLiteral(literal.value)
154
+ : j.jsxExpressionContainer(entryValue);
155
+ const presentation = j.jsxAttribute(
156
+ j.jsxIdentifier('presentation'),
157
+ attributeValue,
158
+ );
159
+ value.properties = entries.filter((/** @type {any} */ e) => e !== entry);
160
+ const index = opening.attributes.indexOf(prop);
161
+ if (value.properties.length === 0) {
162
+ opening.attributes.splice(index, 1, presentation);
163
+ } else {
164
+ opening.attributes.splice(index + 1, 0, presentation);
165
+ }
166
+ hasChanges = true;
167
+ },
168
+ );
169
+
170
+ if (!hasChanges) return undefined;
171
+ // `auto` keeps every reprinted string's own quotes and writes the new
172
+ // attribute string in double quotes, as JSX attributes are written.
173
+ return root.toSource({quote: 'auto'});
174
+ }
@@ -140,14 +140,6 @@
140
140
  "kind": "component",
141
141
  "name": "LogStream"
142
142
  },
143
- {
144
- "kind": "component",
145
- "name": "MobilePowerSearch"
146
- },
147
- {
148
- "kind": "component",
149
- "name": "MobileTokenizer"
150
- },
151
143
  {
152
144
  "kind": "component",
153
145
  "name": "RadialChart"
@@ -160,6 +152,10 @@
160
152
  "kind": "component",
161
153
  "name": "Schedule"
162
154
  },
155
+ {
156
+ "kind": "component",
157
+ "name": "SelectableCardGroup"
158
+ },
163
159
  {
164
160
  "kind": "component",
165
161
  "name": "Stat"
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useAnnounce',
7
+ name: 'useAnnounce — Filter Result Count',
8
+ displayName: 'useAnnounce — Filter Result Count',
9
+ description:
10
+ 'A product filter that announces its result count with useAnnounce: once typing pauses for 500 ms, a screen reader hears "3 results" or "No results". The count has its own hasReplace instance, as the hook\'s docs advise for a changing value.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Card', 'TextInput', 'List', 'Text', 'Layout'],
14
+ };
@@ -0,0 +1,90 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useEffect, useRef, useState} from 'react';
6
+ import {Card} from '@astryxdesign/core/Card';
7
+ import {useAnnounce} from '@astryxdesign/core/hooks';
8
+ import {VStack} from '@astryxdesign/core/Layout';
9
+ import {List, ListItem} from '@astryxdesign/core/List';
10
+ import {Text} from '@astryxdesign/core/Text';
11
+ import {TextInput} from '@astryxdesign/core/TextInput';
12
+
13
+ const PRODUCTS = [
14
+ 'Desk lamp',
15
+ 'Desk organizer',
16
+ 'Standing desk',
17
+ 'Office chair',
18
+ 'Chair mat',
19
+ 'Monitor arm',
20
+ 'Monitor stand',
21
+ 'Keyboard tray',
22
+ ];
23
+
24
+ const ANNOUNCE_DELAY_MS = 500;
25
+
26
+ function filterProducts(query: string): string[] {
27
+ const needle = query.trim().toLowerCase();
28
+ return PRODUCTS.filter(product => product.toLowerCase().includes(needle));
29
+ }
30
+
31
+ export default function UseAnnounceHookUsage() {
32
+ const announce = useAnnounce({hasReplace: true});
33
+ const [query, setQuery] = useState('');
34
+ const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
35
+ const matches = filterProducts(query);
36
+ const count = matches.length;
37
+
38
+ const handleChange = (value: string) => {
39
+ setQuery(value);
40
+ if (timerRef.current != null) {
41
+ clearTimeout(timerRef.current);
42
+ timerRef.current = null;
43
+ }
44
+ if (value === '') {
45
+ return;
46
+ }
47
+ const nextCount = filterProducts(value).length;
48
+ timerRef.current = setTimeout(() => {
49
+ timerRef.current = null;
50
+ announce(
51
+ nextCount === 0
52
+ ? 'No results'
53
+ : `${nextCount} ${nextCount === 1 ? 'result' : 'results'}`,
54
+ );
55
+ }, ANNOUNCE_DELAY_MS);
56
+ };
57
+
58
+ // A count still pending at unmount would be spoken for a filter that is gone.
59
+ useEffect(() => {
60
+ return () => {
61
+ if (timerRef.current != null) {
62
+ clearTimeout(timerRef.current);
63
+ }
64
+ };
65
+ }, []);
66
+
67
+ return (
68
+ <Card width={360} padding={4}>
69
+ <VStack gap={3}>
70
+ <TextInput
71
+ label="Filter products"
72
+ value={query}
73
+ onChange={handleChange}
74
+ hasClear
75
+ />
76
+ {count === 0 ? (
77
+ <Text type="body" color="secondary">
78
+ No results
79
+ </Text>
80
+ ) : (
81
+ <List density="compact">
82
+ {matches.map(product => (
83
+ <ListItem key={product} label={product} />
84
+ ))}
85
+ </List>
86
+ )}
87
+ </VStack>
88
+ </Card>
89
+ );
90
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useFocusTrap',
7
+ name: 'useFocusTrap — Quick Edit Panel',
8
+ displayName: 'useFocusTrap — Quick Edit Panel',
9
+ description:
10
+ 'A custom quick-edit panel, not built on Dialog, that traps focus with useFocusTrap: focusFirst moves focus to its field on open, Tab and Shift+Tab stay inside it, Escape closes it through onEscape, and closing returns focus to the Quick edit button.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Card', 'Button', 'TextInput', 'Text', 'Layout'],
14
+ };
@@ -0,0 +1,70 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useEffect, useState} from 'react';
6
+ import {Button} from '@astryxdesign/core/Button';
7
+ import {Card} from '@astryxdesign/core/Card';
8
+ import {useFocusTrap} from '@astryxdesign/core/hooks';
9
+ import {HStack, VStack} from '@astryxdesign/core/Layout';
10
+ import {Text} from '@astryxdesign/core/Text';
11
+ import {TextInput} from '@astryxdesign/core/TextInput';
12
+
13
+ export default function UseFocusTrapHookUsage() {
14
+ const [isOpen, setIsOpen] = useState(false);
15
+ const [title, setTitle] = useState('Update onboarding guide');
16
+ const [draft, setDraft] = useState(title);
17
+ const close = () => setIsOpen(false);
18
+ const {containerRef, focusFirst} = useFocusTrap<HTMLDivElement>({
19
+ isActive: isOpen,
20
+ onEscape: close,
21
+ });
22
+
23
+ // Runs after commit, once the panel is mounted and useFocusTrap has recorded
24
+ // the opener, so closing the panel returns focus to it.
25
+ useEffect(() => {
26
+ if (isOpen) {
27
+ focusFirst();
28
+ }
29
+ }, [isOpen, focusFirst]);
30
+
31
+ return (
32
+ <HStack gap={4} vAlign="start">
33
+ <VStack gap={2}>
34
+ <Text type="body" weight="bold">
35
+ {title}
36
+ </Text>
37
+ <Button
38
+ label="Quick edit"
39
+ onClick={() => {
40
+ setDraft(title);
41
+ setIsOpen(true);
42
+ }}
43
+ />
44
+ </VStack>
45
+ {isOpen && (
46
+ <Card
47
+ ref={containerRef}
48
+ role="dialog"
49
+ aria-label="Quick edit"
50
+ width={280}
51
+ padding={4}>
52
+ <VStack gap={3}>
53
+ <TextInput label="Title" value={draft} onChange={setDraft} />
54
+ <HStack gap={2} hAlign="end">
55
+ <Button label="Cancel" variant="secondary" onClick={close} />
56
+ <Button
57
+ label="Save"
58
+ variant="primary"
59
+ onClick={() => {
60
+ setTitle(draft);
61
+ close();
62
+ }}
63
+ />
64
+ </HStack>
65
+ </VStack>
66
+ </Card>
67
+ )}
68
+ </HStack>
69
+ );
70
+ }
@@ -38,6 +38,7 @@ export default function TokenizerClear() {
38
38
  value={value}
39
39
  onChange={items => setValue(items)}
40
40
  hasClear
41
+ presentation="popover"
41
42
  />
42
43
  </Stack>
43
44
  </div>
@@ -59,6 +59,7 @@ export default function TokenizerCreatable() {
59
59
  hasCreate
60
60
  hasEntriesOnFocus
61
61
  placeholder="Search or type a new name..."
62
+ presentation="popover"
62
63
  />
63
64
  </Stack>
64
65
  </Stack>
@@ -40,6 +40,7 @@ export default function TokenizerEndContent() {
40
40
  value={value}
41
41
  onChange={items => setValue(items)}
42
42
  endContent={<Button label="Apply" variant="primary" size="sm" />}
43
+ presentation="popover"
43
44
  />
44
45
  </Stack>
45
46
  </div>
@@ -41,6 +41,7 @@ export default function TokenizerOverflow() {
41
41
  value={inlineValue}
42
42
  onChange={items => setInlineValue(items)}
43
43
  tokenOverflowBehavior="unfocusedInline"
44
+ presentation="popover"
44
45
  />
45
46
  </Stack>
46
47
  <Stack direction="vertical" gap={1}>
@@ -54,6 +55,7 @@ export default function TokenizerOverflow() {
54
55
  value={layerValue}
55
56
  onChange={items => setLayerValue(items)}
56
57
  tokenOverflowBehavior="unfocusedLayer"
58
+ presentation="popover"
57
59
  />
58
60
  </Stack>
59
61
  </Stack>
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'createAnimator',
7
+ name: 'createAnimator — Playing cards in plain JavaScript',
8
+ displayName: 'createAnimator — Playing cards in plain JavaScript',
9
+ description:
10
+ 'The playing card from the useAnimator example, built in plain JavaScript with createAnimator and pointer events: it follows a drag, springs back on a gentle release, flies off with momentum on a quick flick, and a button discards it from the keyboard. React only mounts it.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: [],
14
+ };