@astryxdesign/cli 0.1.4-canary.ff77e1c → 0.1.4
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/CHANGELOG.md +1 -2
- package/docs/getting-started.doc.mjs +0 -4
- package/docs/migration.doc.mjs +0 -134
- package/docs/styling.doc.mjs +0 -53
- package/docs/working-with-ai.doc.mjs +1 -1
- package/package.json +10 -15
- package/src/api/component.mjs +1 -2
- package/src/api/doctor.mjs +2 -13
- package/src/api/template.mjs +3 -14
- package/src/codemods/__tests__/registry.test.mjs +0 -1
- package/src/codemods/__tests__/runner.test.mjs +0 -38
- package/src/codemods/registry.mjs +0 -1
- package/src/codemods/runner.mjs +0 -2
- package/src/commands/agent-docs.mjs +6 -9
- package/src/commands/agent-docs.test.mjs +0 -33
- package/src/commands/build-theme.mjs +14 -112
- package/src/commands/component-resolution.test.mjs +4 -4
- package/src/commands/doctor.test.mjs +0 -34
- package/src/commands/init.mjs +1 -1
- package/src/commands/swizzle.mjs +0 -34
- package/src/commands/swizzle.routing.test.mjs +0 -67
- package/src/lib/component-discovery.mjs +4 -8
- package/templates/blocks/components/AspectRatio/AspectRatioCircleImage.tsx +6 -1
- package/templates/blocks/components/AspectRatio/AspectRatioImageGallery.tsx +7 -2
- package/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx +5 -2
- package/templates/blocks/components/AspectRatio/AspectRatioSquareImage.tsx +6 -1
- package/templates/blocks/components/AspectRatio/AspectRatioWidescreen.tsx +6 -1
- package/templates/blocks/components/Collapsible/CollapsibleWithoutCard.tsx +23 -25
- package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupShowcase.tsx +48 -27
- package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +54 -31
- package/templates/pages/classic-gallery/page.tsx +1 -1
- package/templates/pages/dashboard/page.tsx +1 -1
- package/templates/pages/documentation/page.tsx +1 -1
- package/templates/pages/kanban-board/page.tsx +13 -37
- package/templates/pages/mixed-gallery/page.tsx +1 -1
- package/templates/pages/payment-form/page.tsx +6 -2
- package/templates/pages/product-detail/page.tsx +11 -3
- package/templates/pages/product-gallery/page.tsx +1 -1
- package/templates/pages/settings/page.tsx +1 -1
- package/templates/pages/side-gallery/page.tsx +1 -1
- package/templates/pages/table-page/page.tsx +1 -1
- package/templates/pages/table-page-chart/page.tsx +14 -4
- package/templates/pages/table-page-heatmap-status/page.tsx +1 -1
- package/templates/pages/table-page-shoe-store-heatmap/page.tsx +19 -5
- package/src/codemods/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -93
- package/src/codemods/transforms/v0.1.5/index.mjs +0 -19
- package/src/codemods/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +0 -140
- package/src/commands/build-theme.color-scheme.test.mjs +0 -153
- package/src/commands/build-theme.variants.test.mjs +0 -193
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +0 -14
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +0 -58
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.doc.mjs +0 -14
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +0 -24
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.doc.mjs +0 -13
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.tsx +0 -33
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.doc.mjs +0 -15
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.tsx +0 -39
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.doc.mjs +0 -15
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.tsx +0 -39
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.doc.mjs +0 -15
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +0 -27
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.doc.mjs +0 -15
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +0 -38
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +0 -14
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +0 -44
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +0 -15
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +0 -107
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.doc.mjs +0 -15
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.tsx +0 -47
- package/templates/pages/incident-console/page.tsx +0 -580
- package/templates/pages/incident-console/template.doc.mjs +0 -12
- package/templates/pages/messaging-shell/page.tsx +0 -676
- package/templates/pages/messaging-shell/template.doc.mjs +0 -12
|
@@ -3,45 +3,66 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useMemo} from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CommandPalette,
|
|
8
|
+
CommandPaletteList,
|
|
9
|
+
CommandPaletteGroup,
|
|
10
|
+
CommandPaletteItem,
|
|
11
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
7
12
|
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
13
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
14
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
8
15
|
|
|
9
16
|
export default function CommandPaletteGroupShowcase() {
|
|
10
17
|
const source = useMemo(
|
|
11
18
|
() =>
|
|
12
19
|
createStaticSource([
|
|
13
|
-
{
|
|
14
|
-
id: 'index',
|
|
15
|
-
label: 'index.tsx',
|
|
16
|
-
auxiliaryData: {group: 'Recent Files'},
|
|
17
|
-
},
|
|
20
|
+
{id: 'index', label: 'index.tsx', auxiliaryData: {group: 'Recent Files'}},
|
|
18
21
|
{id: 'app', label: 'App.tsx', auxiliaryData: {group: 'Recent Files'}},
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
auxiliaryData: {group: 'Commands'},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: 'terminal',
|
|
26
|
-
label: 'Toggle Terminal',
|
|
27
|
-
auxiliaryData: {group: 'Commands'},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'theme',
|
|
31
|
-
label: 'Color Theme',
|
|
32
|
-
auxiliaryData: {group: 'Preferences'},
|
|
33
|
-
},
|
|
22
|
+
{id: 'settings', label: 'Open Settings', auxiliaryData: {group: 'Commands'}},
|
|
23
|
+
{id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {group: 'Commands'}},
|
|
24
|
+
{id: 'theme', label: 'Color Theme', auxiliaryData: {group: 'Preferences'}},
|
|
34
25
|
{id: 'font', label: 'Font Size', auxiliaryData: {group: 'Preferences'}},
|
|
35
26
|
]),
|
|
36
27
|
[],
|
|
37
28
|
);
|
|
38
29
|
|
|
39
30
|
return (
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
<Stack direction="vertical" gap={4}>
|
|
32
|
+
<Stack direction="vertical" gap={1}>
|
|
33
|
+
<Text type="supporting" color="secondary">
|
|
34
|
+
Data-driven grouping (auxiliaryData.group)
|
|
35
|
+
</Text>
|
|
36
|
+
<CommandPalette
|
|
37
|
+
isOpen
|
|
38
|
+
isInline
|
|
39
|
+
onOpenChange={() => {}}
|
|
40
|
+
searchSource={source}
|
|
41
|
+
/>
|
|
42
|
+
</Stack>
|
|
43
|
+
<Stack direction="vertical" gap={1}>
|
|
44
|
+
<Text type="supporting" color="secondary">
|
|
45
|
+
Composed form (CommandPaletteGroup + CommandPaletteItem)
|
|
46
|
+
</Text>
|
|
47
|
+
<CommandPaletteList>
|
|
48
|
+
<CommandPaletteGroup heading="Navigation">
|
|
49
|
+
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
50
|
+
Home
|
|
51
|
+
</CommandPaletteItem>
|
|
52
|
+
<CommandPaletteItem value="dashboard" onSelect={() => {}}>
|
|
53
|
+
Dashboard
|
|
54
|
+
</CommandPaletteItem>
|
|
55
|
+
</CommandPaletteGroup>
|
|
56
|
+
<CommandPaletteGroup heading="Actions">
|
|
57
|
+
<CommandPaletteItem value="new-file" onSelect={() => {}}>
|
|
58
|
+
New File
|
|
59
|
+
</CommandPaletteItem>
|
|
60
|
+
<CommandPaletteItem value="save" onSelect={() => {}}>
|
|
61
|
+
Save All
|
|
62
|
+
</CommandPaletteItem>
|
|
63
|
+
</CommandPaletteGroup>
|
|
64
|
+
</CommandPaletteList>
|
|
65
|
+
</Stack>
|
|
66
|
+
</Stack>
|
|
46
67
|
);
|
|
47
68
|
}
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useMemo, type CSSProperties} from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CommandPalette,
|
|
8
|
+
CommandPaletteList,
|
|
9
|
+
CommandPaletteItem,
|
|
10
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
7
11
|
import {Text} from '@astryxdesign/core/Text';
|
|
8
12
|
import {Kbd} from '@astryxdesign/core/Kbd';
|
|
13
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
9
14
|
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
15
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
10
16
|
import type {SearchableItem} from '@astryxdesign/core/Typeahead';
|
|
11
17
|
|
|
12
18
|
const itemLabel: CSSProperties = {
|
|
@@ -17,21 +23,9 @@ type CommandItem = SearchableItem<{shortcut?: string}>;
|
|
|
17
23
|
|
|
18
24
|
const commands: CommandItem[] = [
|
|
19
25
|
{id: 'save', label: 'Save File', auxiliaryData: {shortcut: 'mod+s'}},
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
auxiliaryData: {shortcut: 'mod+shift+f'},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: 'palette',
|
|
27
|
-
label: 'Command Palette',
|
|
28
|
-
auxiliaryData: {shortcut: 'mod+shift+p'},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 'terminal',
|
|
32
|
-
label: 'Toggle Terminal',
|
|
33
|
-
auxiliaryData: {shortcut: 'ctrl+`'},
|
|
34
|
-
},
|
|
26
|
+
{id: 'find', label: 'Find in Files', auxiliaryData: {shortcut: 'mod+shift+f'}},
|
|
27
|
+
{id: 'palette', label: 'Command Palette', auxiliaryData: {shortcut: 'mod+shift+p'}},
|
|
28
|
+
{id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {shortcut: 'ctrl+`'}},
|
|
35
29
|
{id: 'sidebar', label: 'Toggle Sidebar', auxiliaryData: {shortcut: 'mod+b'}},
|
|
36
30
|
];
|
|
37
31
|
|
|
@@ -39,21 +33,50 @@ export default function CommandPaletteItemShowcase() {
|
|
|
39
33
|
const source = useMemo(() => createStaticSource(commands), []);
|
|
40
34
|
|
|
41
35
|
return (
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{item
|
|
53
|
-
|
|
36
|
+
<Stack direction="vertical" gap={4}>
|
|
37
|
+
<Stack direction="vertical" gap={1}>
|
|
38
|
+
<Text type="supporting" color="secondary">
|
|
39
|
+
Custom renderItem with keyboard shortcuts
|
|
40
|
+
</Text>
|
|
41
|
+
<CommandPalette
|
|
42
|
+
isOpen
|
|
43
|
+
isInline
|
|
44
|
+
onOpenChange={() => {}}
|
|
45
|
+
searchSource={source}
|
|
46
|
+
renderItem={(item: CommandItem) => (
|
|
47
|
+
<>
|
|
48
|
+
<Text type="body" style={itemLabel}>
|
|
49
|
+
{item.label}
|
|
50
|
+
</Text>
|
|
51
|
+
{item.auxiliaryData?.shortcut && (
|
|
52
|
+
<Kbd keys={item.auxiliaryData.shortcut} />
|
|
53
|
+
)}
|
|
54
|
+
</>
|
|
54
55
|
)}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
/>
|
|
57
|
+
</Stack>
|
|
58
|
+
<Stack direction="vertical" gap={1}>
|
|
59
|
+
<Text type="supporting" color="secondary">
|
|
60
|
+
Composed items with icons and states
|
|
61
|
+
</Text>
|
|
62
|
+
<CommandPaletteList>
|
|
63
|
+
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
64
|
+
<Icon icon="externalLink" size="sm" />
|
|
65
|
+
<Text type="body" style={itemLabel}>Home</Text>
|
|
66
|
+
</CommandPaletteItem>
|
|
67
|
+
<CommandPaletteItem value="search" isHighlighted onSelect={() => {}}>
|
|
68
|
+
<Icon icon="search" size="sm" />
|
|
69
|
+
<Text type="body" style={itemLabel}>Search (highlighted)</Text>
|
|
70
|
+
</CommandPaletteItem>
|
|
71
|
+
<CommandPaletteItem value="selected" isSelected onSelect={() => {}}>
|
|
72
|
+
<Icon icon="check" size="sm" />
|
|
73
|
+
<Text type="body" style={itemLabel}>Selected item</Text>
|
|
74
|
+
</CommandPaletteItem>
|
|
75
|
+
<CommandPaletteItem value="disabled" isDisabled>
|
|
76
|
+
<Text type="body" style={itemLabel}>Disabled item</Text>
|
|
77
|
+
</CommandPaletteItem>
|
|
78
|
+
</CommandPaletteList>
|
|
79
|
+
</Stack>
|
|
80
|
+
</Stack>
|
|
58
81
|
);
|
|
59
82
|
}
|
|
@@ -439,11 +439,8 @@ export default function KanbanBoardTemplate() {
|
|
|
439
439
|
let cb = columnRefCbs.current.get(id);
|
|
440
440
|
if (!cb) {
|
|
441
441
|
cb = el => {
|
|
442
|
-
if (el) {
|
|
443
|
-
|
|
444
|
-
} else {
|
|
445
|
-
columnEls.current.delete(id);
|
|
446
|
-
}
|
|
442
|
+
if (el) {columnEls.current.set(id, el);}
|
|
443
|
+
else {columnEls.current.delete(id);}
|
|
447
444
|
};
|
|
448
445
|
columnRefCbs.current.set(id, cb);
|
|
449
446
|
}
|
|
@@ -454,11 +451,8 @@ export default function KanbanBoardTemplate() {
|
|
|
454
451
|
let cb = cardRefCbs.current.get(id);
|
|
455
452
|
if (!cb) {
|
|
456
453
|
cb = el => {
|
|
457
|
-
if (el) {
|
|
458
|
-
|
|
459
|
-
} else {
|
|
460
|
-
cardEls.current.delete(id);
|
|
461
|
-
}
|
|
454
|
+
if (el) {cardEls.current.set(id, el);}
|
|
455
|
+
else {cardEls.current.delete(id);}
|
|
462
456
|
};
|
|
463
457
|
cardRefCbs.current.set(id, cb);
|
|
464
458
|
}
|
|
@@ -493,9 +487,7 @@ export default function KanbanBoardTemplate() {
|
|
|
493
487
|
): DropTarget | null => {
|
|
494
488
|
for (const [colId, el] of Array.from(columnEls.current.entries())) {
|
|
495
489
|
const r = el.getBoundingClientRect();
|
|
496
|
-
if (px < r.left || px > r.right || py < r.top || py > r.bottom) {
|
|
497
|
-
continue;
|
|
498
|
-
}
|
|
490
|
+
if (px < r.left || px > r.right || py < r.top || py > r.bottom) {continue;}
|
|
499
491
|
|
|
500
492
|
const ids = itemsByColumn[colId]
|
|
501
493
|
.filter(it => it.id !== draggedId)
|
|
@@ -504,9 +496,7 @@ export default function KanbanBoardTemplate() {
|
|
|
504
496
|
let index = ids.length;
|
|
505
497
|
for (let i = 0; i < ids.length; i++) {
|
|
506
498
|
const cardEl = cardEls.current.get(ids[i]);
|
|
507
|
-
if (!cardEl) {
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
499
|
+
if (!cardEl) {continue;}
|
|
510
500
|
const cr = cardEl.getBoundingClientRect();
|
|
511
501
|
if (py < cr.top + cr.height / 2) {
|
|
512
502
|
index = i;
|
|
@@ -523,27 +513,21 @@ export default function KanbanBoardTemplate() {
|
|
|
523
513
|
const commitDrag = (id: string, target: DropTarget) => {
|
|
524
514
|
setItems(prev => {
|
|
525
515
|
const moved = prev.find(it => it.id === id);
|
|
526
|
-
if (!moved) {
|
|
527
|
-
return prev;
|
|
528
|
-
}
|
|
516
|
+
if (!moved) {return prev;}
|
|
529
517
|
|
|
530
518
|
const rest = prev.filter(it => it.id !== id);
|
|
531
519
|
const updated: WorkItem = {...moved, column: target.column};
|
|
532
520
|
const colItems = rest.filter(it => it.column === target.column);
|
|
533
521
|
const anchor = colItems[target.index];
|
|
534
522
|
|
|
535
|
-
if (!anchor) {
|
|
536
|
-
return [...rest, updated];
|
|
537
|
-
}
|
|
523
|
+
if (!anchor) {return [...rest, updated];}
|
|
538
524
|
const at = rest.indexOf(anchor);
|
|
539
525
|
return [...rest.slice(0, at), updated, ...rest.slice(at)];
|
|
540
526
|
});
|
|
541
527
|
};
|
|
542
528
|
|
|
543
529
|
const onCardPointerDown = (e: ReactPointerEvent, id: string) => {
|
|
544
|
-
if (e.button !== 0) {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
530
|
+
if (e.button !== 0) {return;}
|
|
547
531
|
// Let the card's own controls (the actions menu) handle the press.
|
|
548
532
|
if (
|
|
549
533
|
(e.target as HTMLElement).closest(
|
|
@@ -554,9 +538,7 @@ export default function KanbanBoardTemplate() {
|
|
|
554
538
|
}
|
|
555
539
|
|
|
556
540
|
const el = cardEls.current.get(id);
|
|
557
|
-
if (!el) {
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
541
|
+
if (!el) {return;}
|
|
560
542
|
|
|
561
543
|
const rect = el.getBoundingClientRect();
|
|
562
544
|
const startX = e.clientX;
|
|
@@ -592,9 +574,7 @@ export default function KanbanBoardTemplate() {
|
|
|
592
574
|
|
|
593
575
|
const onUp = () => {
|
|
594
576
|
teardownRef.current?.();
|
|
595
|
-
if (started && target) {
|
|
596
|
-
commitDrag(id, target);
|
|
597
|
-
}
|
|
577
|
+
if (started && target) {commitDrag(id, target);}
|
|
598
578
|
setDrag(null);
|
|
599
579
|
};
|
|
600
580
|
|
|
@@ -614,9 +594,7 @@ export default function KanbanBoardTemplate() {
|
|
|
614
594
|
|
|
615
595
|
// Suppress selection while dragging and detach listeners on unmount.
|
|
616
596
|
useEffect(() => {
|
|
617
|
-
if (!isDragging) {
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
597
|
+
if (!isDragging) {return;}
|
|
620
598
|
const previous = document.body.style.userSelect;
|
|
621
599
|
document.body.style.userSelect = 'none';
|
|
622
600
|
return () => {
|
|
@@ -634,9 +612,7 @@ export default function KanbanBoardTemplate() {
|
|
|
634
612
|
const ghostTarget =
|
|
635
613
|
drag && drag.target && drag.target.column === colId ? drag : null;
|
|
636
614
|
|
|
637
|
-
if (visible.length === 0 && !ghostTarget) {
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
615
|
+
if (visible.length === 0 && !ghostTarget) {return null;}
|
|
640
616
|
|
|
641
617
|
const nodes: ReactNode[] = visible.map(it => (
|
|
642
618
|
<BoardCard
|
|
@@ -153,6 +153,10 @@ const fmt = (n: number) => `$${n.toFixed(2)}`;
|
|
|
153
153
|
// :root by `@astryxdesign/core/astryx.css`). No StyleX compiler required.
|
|
154
154
|
|
|
155
155
|
const fullWidth: CSSProperties = {width: '100%'};
|
|
156
|
+
// LayoutContent clips overflow by default, which traps position:sticky
|
|
157
|
+
// children (the sticky order summary). With height="auto" the page scrolls
|
|
158
|
+
// at the window, so let overflow be visible here so sticky can pin.
|
|
159
|
+
const visibleOverflow: CSSProperties = {overflow: 'visible'};
|
|
156
160
|
// Form column flex-basis so the two checkout columns share width evenly.
|
|
157
161
|
const formColBasis: CSSProperties = {flexBasis: 0};
|
|
158
162
|
// Space the Order Summary content below its collapsible trigger title.
|
|
@@ -262,9 +266,9 @@ export default function PaymentFormPage() {
|
|
|
262
266
|
|
|
263
267
|
return (
|
|
264
268
|
<Layout
|
|
265
|
-
height="
|
|
269
|
+
height="auto"
|
|
266
270
|
content={
|
|
267
|
-
<LayoutContent padding={0}>
|
|
271
|
+
<LayoutContent padding={0} style={visibleOverflow}>
|
|
268
272
|
<Center axis="horizontal">
|
|
269
273
|
<Section
|
|
270
274
|
variant="transparent"
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useState} from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
VStack,
|
|
8
|
+
HStack,
|
|
9
|
+
Layout,
|
|
10
|
+
LayoutContent,
|
|
11
|
+
} from '@astryxdesign/core/Layout';
|
|
7
12
|
import {Center} from '@astryxdesign/core/Center';
|
|
8
13
|
import {Grid} from '@astryxdesign/core/Grid';
|
|
9
14
|
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
@@ -198,7 +203,10 @@ function ProductInfo() {
|
|
|
198
203
|
<VStack gap={2}>
|
|
199
204
|
<Text type="label">Finish</Text>
|
|
200
205
|
<VStack hAlign="start">
|
|
201
|
-
<SegmentedControl
|
|
206
|
+
<SegmentedControl
|
|
207
|
+
value={finish}
|
|
208
|
+
onChange={setFinish}
|
|
209
|
+
label="Finish">
|
|
202
210
|
{FINISHES.map(f => (
|
|
203
211
|
<SegmentedControlItem
|
|
204
212
|
key={f.value}
|
|
@@ -278,7 +286,7 @@ export default function ProductDetailTemplate() {
|
|
|
278
286
|
|
|
279
287
|
return (
|
|
280
288
|
<Layout
|
|
281
|
-
height="
|
|
289
|
+
height="auto"
|
|
282
290
|
contentWidth={1200}
|
|
283
291
|
content={
|
|
284
292
|
<LayoutContent padding={6}>
|
|
@@ -19,7 +19,13 @@ import {Link} from '@astryxdesign/core/Link';
|
|
|
19
19
|
import {Thumbnail} from '@astryxdesign/core/Thumbnail';
|
|
20
20
|
import {Table, proportional, pixel} from '@astryxdesign/core/Table';
|
|
21
21
|
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
ChartV2 as Chart,
|
|
24
|
+
ChartGrid,
|
|
25
|
+
ChartAxis,
|
|
26
|
+
area,
|
|
27
|
+
line,
|
|
28
|
+
} from '@astryxdesign/lab';
|
|
23
29
|
import {
|
|
24
30
|
FunnelIcon,
|
|
25
31
|
ArrowDownTrayIcon,
|
|
@@ -475,13 +481,17 @@ const columns: TableColumn<OrderRow>[] = [
|
|
|
475
481
|
key: 'amount',
|
|
476
482
|
header: 'Amount',
|
|
477
483
|
width: pixel(90),
|
|
478
|
-
renderCell: (item: OrderRow) =>
|
|
484
|
+
renderCell: (item: OrderRow) => (
|
|
485
|
+
<Text type="body">${item.amount}</Text>
|
|
486
|
+
),
|
|
479
487
|
},
|
|
480
488
|
{
|
|
481
489
|
key: 'customer',
|
|
482
490
|
header: 'Customer',
|
|
483
491
|
width: proportional(2),
|
|
484
|
-
renderCell: (item: OrderRow) =>
|
|
492
|
+
renderCell: (item: OrderRow) => (
|
|
493
|
+
<Text type="body">{item.customer}</Text>
|
|
494
|
+
),
|
|
485
495
|
},
|
|
486
496
|
{
|
|
487
497
|
key: 'email',
|
|
@@ -513,7 +523,7 @@ const columns: TableColumn<OrderRow>[] = [
|
|
|
513
523
|
export default function TablePageChartTemplate() {
|
|
514
524
|
return (
|
|
515
525
|
<Layout
|
|
516
|
-
height="
|
|
526
|
+
height="auto"
|
|
517
527
|
header={
|
|
518
528
|
<LayoutHeader hasDivider>
|
|
519
529
|
<HStack gap={2} vAlign="center">
|
|
@@ -19,7 +19,13 @@ import {Link} from '@astryxdesign/core/Link';
|
|
|
19
19
|
import {Thumbnail} from '@astryxdesign/core/Thumbnail';
|
|
20
20
|
import {Table, proportional, pixel} from '@astryxdesign/core/Table';
|
|
21
21
|
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
ChartV2 as Chart,
|
|
24
|
+
ChartGrid,
|
|
25
|
+
ChartAxis,
|
|
26
|
+
area,
|
|
27
|
+
line,
|
|
28
|
+
} from '@astryxdesign/lab';
|
|
23
29
|
import {
|
|
24
30
|
FunnelIcon,
|
|
25
31
|
ArrowDownTrayIcon,
|
|
@@ -29,7 +35,11 @@ import {
|
|
|
29
35
|
// ============= DATA =============
|
|
30
36
|
|
|
31
37
|
type ProductCategory =
|
|
32
|
-
|
|
38
|
+
| 'Running'
|
|
39
|
+
| 'Lifestyle'
|
|
40
|
+
| 'Basketball'
|
|
41
|
+
| 'Training'
|
|
42
|
+
| 'Skateboarding';
|
|
33
43
|
|
|
34
44
|
function shoeSvg(bg: string, accent: string) {
|
|
35
45
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" rx="12" fill="${bg}"/><g transform="translate(22.5, 22.5) scale(2.29)" fill="none" stroke="${accent}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m15 10.42 4.8-5.07"/><path d="M19 18h3"/><path d="M9.5 22 21.414 9.415A2 2 0 0 0 21.2 6.4l-5.61-4.208A1 1 0 0 0 14 3v2a2 2 0 0 1-1.394 1.906L8.677 8.053A1 1 0 0 0 8 9c-.155 6.393-2.082 9-4 9a2 2 0 0 0 0 4h14"/></g></svg>`;
|
|
@@ -829,13 +839,17 @@ const columns: TableColumn<OrderRow>[] = [
|
|
|
829
839
|
key: 'amount',
|
|
830
840
|
header: 'Amount',
|
|
831
841
|
width: pixel(90),
|
|
832
|
-
renderCell: (item: OrderRow) =>
|
|
842
|
+
renderCell: (item: OrderRow) => (
|
|
843
|
+
<Text type="body">${item.amount}</Text>
|
|
844
|
+
),
|
|
833
845
|
},
|
|
834
846
|
{
|
|
835
847
|
key: 'customer',
|
|
836
848
|
header: 'Customer',
|
|
837
849
|
width: proportional(2),
|
|
838
|
-
renderCell: (item: OrderRow) =>
|
|
850
|
+
renderCell: (item: OrderRow) => (
|
|
851
|
+
<Text type="body">{item.customer}</Text>
|
|
852
|
+
),
|
|
839
853
|
},
|
|
840
854
|
{
|
|
841
855
|
key: 'email',
|
|
@@ -867,7 +881,7 @@ const columns: TableColumn<OrderRow>[] = [
|
|
|
867
881
|
export default function TablePageShoeStoreHeatmapTemplate() {
|
|
868
882
|
return (
|
|
869
883
|
<Layout
|
|
870
|
-
height="
|
|
884
|
+
height="auto"
|
|
871
885
|
header={
|
|
872
886
|
<LayoutHeader hasDivider>
|
|
873
887
|
<HStack gap={2} vAlign="center">
|
package/src/codemods/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, it, expect} from 'vitest';
|
|
4
|
-
|
|
5
|
-
async function applyTransform(source) {
|
|
6
|
-
const {default: transform} =
|
|
7
|
-
await import('../rename-switch-label-spacing-default-to-hug.mjs');
|
|
8
|
-
const jscodeshift = (await import('jscodeshift')).default;
|
|
9
|
-
const j = jscodeshift.withParser('tsx');
|
|
10
|
-
const api = {jscodeshift: j, stats: () => {}, report: () => {}};
|
|
11
|
-
const file = {source, path: 'test.tsx'};
|
|
12
|
-
const result = transform(file, api);
|
|
13
|
-
return result ?? source;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe('rename-switch-label-spacing-default-to-hug', () => {
|
|
17
|
-
it('renames Switch labelSpacing="default" to labelSpacing="hug"', async () => {
|
|
18
|
-
const input = `<Switch label="Notify" value={on} labelSpacing="default" />`;
|
|
19
|
-
const output = await applyTransform(input);
|
|
20
|
-
expect(output).toContain("'hug'");
|
|
21
|
-
expect(output).not.toContain('default');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("renames expression-container labelSpacing={'default'}", async () => {
|
|
25
|
-
const input = `<Switch label="Notify" value={on} labelSpacing={'default'} />`;
|
|
26
|
-
const output = await applyTransform(input);
|
|
27
|
-
expect(output).toContain("'hug'");
|
|
28
|
-
expect(output).not.toContain("'default'");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('renames default inside a ternary labelSpacing expression', async () => {
|
|
32
|
-
const input = `<Switch label="Notify" value={on} labelSpacing={isRow ? 'spread' : 'default'} />`;
|
|
33
|
-
const output = await applyTransform(input);
|
|
34
|
-
expect(output).toContain("'hug'");
|
|
35
|
-
expect(output).toContain("'spread'");
|
|
36
|
-
expect(output).not.toContain("'default'");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('does not change labelSpacing="spread"', async () => {
|
|
40
|
-
const input = `<Switch label="Notify" value={on} labelSpacing="spread" />`;
|
|
41
|
-
const output = await applyTransform(input);
|
|
42
|
-
expect(output).toBe(input);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('does not touch labelSpacing="default" on non-Switch components', async () => {
|
|
46
|
-
const input = `<LegacyToggle labelSpacing="default" />`;
|
|
47
|
-
const output = await applyTransform(input);
|
|
48
|
-
expect(output).toBe(input);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('does not touch other props with a "default" value on Switch', async () => {
|
|
52
|
-
const input = `<Switch label="Notify" value={on} data-variant="default" />`;
|
|
53
|
-
const output = await applyTransform(input);
|
|
54
|
-
expect(output).toBe(input);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('does not touch unrelated "default" string literals', async () => {
|
|
58
|
-
const input = `const theme = {mode: 'default', label: 'Default Mode'};`;
|
|
59
|
-
const output = await applyTransform(input);
|
|
60
|
-
expect(output).toBe(input);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('renames object labelSpacing prop in files importing Switch', async () => {
|
|
64
|
-
const input = `import {Switch} from '@astryxdesign/core/Switch';
|
|
65
|
-
const cfg = {labelSpacing: 'default'};`;
|
|
66
|
-
const output = await applyTransform(input);
|
|
67
|
-
expect(output).toContain("labelSpacing: 'hug'");
|
|
68
|
-
expect(output).not.toContain("'default'");
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("renames labelSpacing: 'default' as const in files importing Switch", async () => {
|
|
72
|
-
const input = `import {Switch} from '@astryxdesign/core/Switch';
|
|
73
|
-
const ROWS = [{labelSpacing: 'default' as const, label: 'Adjacent'}];`;
|
|
74
|
-
const output = await applyTransform(input);
|
|
75
|
-
expect(output).toContain("'hug' as const");
|
|
76
|
-
expect(output).not.toContain("'default'");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('does not rename object labelSpacing prop when Switch is not imported', async () => {
|
|
80
|
-
const input = `const cfg = {labelSpacing: 'default'};`;
|
|
81
|
-
const output = await applyTransform(input);
|
|
82
|
-
expect(output).toBe(input);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('renames Storybook argTypes options in files importing Switch', async () => {
|
|
86
|
-
const input = `import {Switch} from '@astryxdesign/core/Switch';
|
|
87
|
-
const meta = {argTypes: {labelSpacing: {control: 'select', options: ['default', 'spread']}}};`;
|
|
88
|
-
const output = await applyTransform(input);
|
|
89
|
-
expect(output).toContain("'hug'");
|
|
90
|
-
expect(output).toContain("'spread'");
|
|
91
|
-
expect(output).not.toContain("'default'");
|
|
92
|
-
});
|
|
93
|
-
});
|