@astryxdesign/cli 0.7.6-canary.c3cdc8e → 0.7.6-canary.c5c1149

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.
@@ -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: 'useListFocus',
7
+ name: 'useListFocus — Recent Files',
8
+ displayName: 'useListFocus — Recent Files',
9
+ description:
10
+ 'A "Recent files" list of buttons with keyboard navigation from useListFocus: ArrowUp and ArrowDown move between rows, Home and End jump to the first and last row, focus wraps at the ends, and only one row is in the tab order.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Card', 'Button', 'Layout'],
14
+ };
@@ -0,0 +1,42 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {Button} from '@astryxdesign/core/Button';
6
+ import {Card} from '@astryxdesign/core/Card';
7
+ import {useListFocus} from '@astryxdesign/core/hooks';
8
+ import {VStack} from '@astryxdesign/core/Layout';
9
+
10
+ const RECENT_FILES = [
11
+ 'Q3 roadmap.pdf',
12
+ 'Budget 2026.xlsx',
13
+ 'Offsite notes.docx',
14
+ 'Launch checklist.md',
15
+ ];
16
+
17
+ export default function UseListFocusHookUsage() {
18
+ const {listRef, handleKeyDown, handleFocus} = useListFocus({
19
+ itemSelector: 'button',
20
+ orientation: 'vertical',
21
+ wrap: true,
22
+ hasHomeEnd: true,
23
+ hasRovingTabIndex: true,
24
+ });
25
+
26
+ return (
27
+ <Card width={320} padding={2}>
28
+ <VStack
29
+ ref={listRef}
30
+ role="toolbar"
31
+ aria-label="Recent files"
32
+ aria-orientation="vertical"
33
+ gap={1}
34
+ onKeyDown={handleKeyDown}
35
+ onFocus={handleFocus}>
36
+ {RECENT_FILES.map(name => (
37
+ <Button key={name} label={name} variant="ghost" />
38
+ ))}
39
+ </VStack>
40
+ </Card>
41
+ );
42
+ }
@@ -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: 'usePressFeedback',
7
+ name: 'usePressFeedback — Pressable Card',
8
+ displayName: 'usePressFeedback — Pressable Card',
9
+ description:
10
+ 'A Card made pressable with usePressFeedback: its marker and the interactionOverlayStyles backgroundImage overlay go straight on the Card, so a press darkens the card the way every Astryx pressable does; focusOutlineStyles.focusVisible gives it the shared Astryx focus ring for keyboard focus; and a click, Enter or Space flips it.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Card'],
14
+ };
@@ -0,0 +1,41 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {Card} from '@astryxdesign/core/Card';
7
+ import {usePressFeedback} from '@astryxdesign/core/hooks';
8
+ import {
9
+ focusOutlineStyles,
10
+ interactionOverlayStyles,
11
+ } from '@astryxdesign/core/utils';
12
+ import {PlayingCardContents} from '@astryx-docs/demo-content';
13
+
14
+ export default function UsePressFeedbackHookUsage() {
15
+ const pressable = usePressFeedback();
16
+ const [isFaceUp, setIsFaceUp] = useState(true);
17
+ const flip = () => setIsFaceUp(faceUp => !faceUp);
18
+
19
+ return (
20
+ <Card
21
+ {...pressable}
22
+ xstyle={[
23
+ interactionOverlayStyles.backgroundImage,
24
+ focusOutlineStyles.focusVisible,
25
+ ]}
26
+ width={160}
27
+ role="button"
28
+ tabIndex={0}
29
+ aria-label="Flip card"
30
+ aria-pressed={!isFaceUp}
31
+ onClick={flip}
32
+ onKeyDown={event => {
33
+ if (event.key === 'Enter' || event.key === ' ') {
34
+ event.preventDefault();
35
+ flip();
36
+ }
37
+ }}>
38
+ <PlayingCardContents rank="Q" suit="hearts" faceDown={!isFaceUp} />
39
+ </Card>
40
+ );
41
+ }
@@ -0,0 +1,22 @@
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: 'useTranslator',
7
+ name: 'useTranslator — Load More Footer',
8
+ displayName: 'useTranslator — Load More Footer',
9
+ description:
10
+ 'A "Load more" footer under a list that gets its button label and its "Showing 3 of 9" count from the function useTranslator returns, with app message keys supplied per locale through InternationalizationProvider, so switching the provider to French changes both strings.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: [
14
+ 'InternationalizationProvider',
15
+ 'Card',
16
+ 'SegmentedControl',
17
+ 'List',
18
+ 'Text',
19
+ 'Button',
20
+ 'Layout',
21
+ ],
22
+ };
@@ -0,0 +1,88 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {Button} from '@astryxdesign/core/Button';
7
+ import {Card} from '@astryxdesign/core/Card';
8
+ import {
9
+ InternationalizationProvider,
10
+ useTranslator,
11
+ type MessagesByLocale,
12
+ } from '@astryxdesign/core/i18n';
13
+ import {HStack, VStack} from '@astryxdesign/core/Layout';
14
+ import {List, ListItem} from '@astryxdesign/core/List';
15
+ import {
16
+ SegmentedControl,
17
+ SegmentedControlItem,
18
+ } from '@astryxdesign/core/SegmentedControl';
19
+ import {Text} from '@astryxdesign/core/Text';
20
+
21
+ type Locale = 'en' | 'fr';
22
+
23
+ const MESSAGES: MessagesByLocale = {
24
+ en: {
25
+ '@myapp.invoices.loadMore': {defaultMessage: 'Load more'},
26
+ '@myapp.invoices.showing': {
27
+ defaultMessage: 'Showing {shown, number} of {total, number}',
28
+ },
29
+ },
30
+ fr: {
31
+ '@myapp.invoices.loadMore': {defaultMessage: 'Charger plus'},
32
+ '@myapp.invoices.showing': {
33
+ defaultMessage: '{shown, number} sur {total, number} affichées',
34
+ },
35
+ },
36
+ };
37
+
38
+ const INVOICES = Array.from({length: 9}, (_, index) => `INV-${1001 + index}`);
39
+ const PAGE_SIZE = 3;
40
+
41
+ function InvoiceList() {
42
+ const translate = useTranslator();
43
+ const [shownCount, setShownCount] = useState(PAGE_SIZE);
44
+ const total = INVOICES.length;
45
+
46
+ return (
47
+ <VStack gap={3}>
48
+ <List density="compact" hasDividers>
49
+ {INVOICES.slice(0, shownCount).map(invoice => (
50
+ <ListItem key={invoice} label={invoice} />
51
+ ))}
52
+ </List>
53
+ <HStack gap={2} hAlign="between" vAlign="center">
54
+ <Text type="supporting">
55
+ {translate('@myapp.invoices.showing', {shown: shownCount, total})}
56
+ </Text>
57
+ <Button
58
+ label={translate('@myapp.invoices.loadMore')}
59
+ size="sm"
60
+ isDisabled={shownCount >= total}
61
+ onClick={() => setShownCount(count => count + PAGE_SIZE)}
62
+ />
63
+ </HStack>
64
+ </VStack>
65
+ );
66
+ }
67
+
68
+ export default function UseTranslatorHookUsage() {
69
+ const [locale, setLocale] = useState<Locale>('en');
70
+
71
+ return (
72
+ <InternationalizationProvider locale={locale} messages={MESSAGES}>
73
+ <Card width={360} padding={4}>
74
+ <VStack gap={3}>
75
+ <SegmentedControl
76
+ label="Language"
77
+ value={locale}
78
+ onChange={nextLocale => setLocale(nextLocale as Locale)}
79
+ size="sm">
80
+ <SegmentedControlItem value="en" label="English" />
81
+ <SegmentedControlItem value="fr" label="Français" />
82
+ </SegmentedControl>
83
+ <InvoiceList />
84
+ </VStack>
85
+ </Card>
86
+ </InternationalizationProvider>
87
+ );
88
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.6-canary.c3cdc8e",
3
+ "version": "0.7.6-canary.c5c1149",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -124,10 +124,10 @@
124
124
  "zod": "^4.4.3"
125
125
  },
126
126
  "peerDependencies": {
127
- "@astryxdesign/charts": "0.7.6-canary.c3cdc8e",
128
- "@astryxdesign/core": "0.7.6-canary.c3cdc8e",
129
- "@astryxdesign/lab": "0.7.6-canary.c3cdc8e",
130
- "@astryxdesign/theme-neutral": "0.7.6-canary.c3cdc8e"
127
+ "@astryxdesign/charts": "0.7.6-canary.c5c1149",
128
+ "@astryxdesign/core": "0.7.6-canary.c5c1149",
129
+ "@astryxdesign/lab": "0.7.6-canary.c5c1149",
130
+ "@astryxdesign/theme-neutral": "0.7.6-canary.c5c1149"
131
131
  },
132
132
  "peerDependenciesMeta": {
133
133
  "@astryxdesign/charts": {
@@ -144,10 +144,10 @@
144
144
  }
145
145
  },
146
146
  "devDependencies": {
147
- "@astryxdesign/charts": "0.7.6-canary.c3cdc8e",
148
- "@astryxdesign/core": "0.7.6-canary.c3cdc8e",
149
- "@astryxdesign/lab": "0.7.6-canary.c3cdc8e",
150
- "@astryxdesign/theme-neutral": "0.7.6-canary.c3cdc8e",
147
+ "@astryxdesign/charts": "0.7.6-canary.c5c1149",
148
+ "@astryxdesign/core": "0.7.6-canary.c5c1149",
149
+ "@astryxdesign/lab": "0.7.6-canary.c5c1149",
150
+ "@astryxdesign/theme-neutral": "0.7.6-canary.c5c1149",
151
151
  "@heroicons/react": "^2.2.0",
152
152
  "@stylexjs/stylex": "^0.19.0",
153
153
  "@types/babel__core": "^7.20.5",