@velocity-astro/cms-ui 0.1.0-beta.7 → 0.1.0-beta.9
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/component-registry.json +72 -5
- package/dist/components/BarChart/BarChart.d.ts +23 -0
- package/dist/components/BarChart/BarChart.d.ts.map +1 -0
- package/dist/components/BarChart/BarChart.js +19 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/BarChart/BarChart.variants.d.ts +29 -0
- package/dist/components/BarChart/BarChart.variants.d.ts.map +1 -0
- package/dist/components/BarChart/BarChart.variants.js +81 -0
- package/dist/components/BarChart/BarChart.variants.js.map +1 -0
- package/dist/components/BarChart/index.d.ts +2 -0
- package/dist/components/BarChart/index.d.ts.map +1 -0
- package/dist/components/BarChart/index.js +2 -0
- package/dist/components/BarChart/index.js.map +1 -0
- package/dist/components/Button/Button.d.ts +6 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +5 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.variants.d.ts +6 -1
- package/dist/components/Button/Button.variants.d.ts.map +1 -1
- package/dist/components/Button/Button.variants.js +13 -1
- package/dist/components/Button/Button.variants.js.map +1 -1
- package/dist/components/Card/Card.d.ts +3 -1
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +3 -3
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.variants.d.ts +4 -1
- package/dist/components/Card/Card.variants.d.ts.map +1 -1
- package/dist/components/Card/Card.variants.js +6 -1
- package/dist/components/Card/Card.variants.js.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +30 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.js +32 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.variants.d.ts +24 -0
- package/dist/components/ColorPicker/ColorPicker.variants.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.variants.js +42 -0
- package/dist/components/ColorPicker/ColorPicker.variants.js.map +1 -0
- package/dist/components/ColorPicker/index.d.ts +2 -0
- package/dist/components/ColorPicker/index.d.ts.map +1 -0
- package/dist/components/ColorPicker/index.js +2 -0
- package/dist/components/ColorPicker/index.js.map +1 -0
- package/dist/components/FileButton/FileButton.d.ts +3 -1
- package/dist/components/FileButton/FileButton.d.ts.map +1 -1
- package/dist/components/FileButton/FileButton.js +2 -2
- package/dist/components/FileButton/FileButton.js.map +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts.map +1 -1
- package/dist/components/Heading/Heading.js +2 -2
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/Heading/Heading.variants.d.ts +1 -0
- package/dist/components/Heading/Heading.variants.d.ts.map +1 -1
- package/dist/components/Heading/Heading.variants.js +2 -0
- package/dist/components/Heading/Heading.variants.js.map +1 -1
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts.map +1 -1
- package/dist/components/Logo/Logo.js +3 -3
- package/dist/components/Logo/Logo.js.map +1 -1
- package/dist/components/Logo/Logo.variants.d.ts +5 -2
- package/dist/components/Logo/Logo.variants.d.ts.map +1 -1
- package/dist/components/Logo/Logo.variants.js +10 -1
- package/dist/components/Logo/Logo.variants.js.map +1 -1
- package/dist/components/Meter/Meter.d.ts +13 -0
- package/dist/components/Meter/Meter.d.ts.map +1 -0
- package/dist/components/Meter/Meter.js +8 -0
- package/dist/components/Meter/Meter.js.map +1 -0
- package/dist/components/Meter/Meter.variants.d.ts +14 -0
- package/dist/components/Meter/Meter.variants.d.ts.map +1 -0
- package/dist/components/Meter/Meter.variants.js +39 -0
- package/dist/components/Meter/Meter.variants.js.map +1 -0
- package/dist/components/Meter/index.d.ts +2 -0
- package/dist/components/Meter/index.d.ts.map +1 -0
- package/dist/components/Meter/index.js +2 -0
- package/dist/components/Meter/index.js.map +1 -0
- package/dist/components/Segmented/Segmented.d.ts +6 -1
- package/dist/components/Segmented/Segmented.d.ts.map +1 -1
- package/dist/components/Segmented/Segmented.js +9 -3
- package/dist/components/Segmented/Segmented.js.map +1 -1
- package/dist/components/Segmented/Segmented.variants.d.ts +7 -1
- package/dist/components/Segmented/Segmented.variants.d.ts.map +1 -1
- package/dist/components/Segmented/Segmented.variants.js +11 -3
- package/dist/components/Segmented/Segmented.variants.js.map +1 -1
- package/dist/components/Table/Table.d.ts +8 -1
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.js +4 -4
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.variants.d.ts +6 -2
- package/dist/components/Table/Table.variants.d.ts.map +1 -1
- package/dist/components/Table/Table.variants.js +9 -4
- package/dist/components/Table/Table.variants.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/patterns/AppShell/AppShell.d.ts +31 -8
- package/dist/patterns/AppShell/AppShell.d.ts.map +1 -1
- package/dist/patterns/AppShell/AppShell.js +31 -7
- package/dist/patterns/AppShell/AppShell.js.map +1 -1
- package/dist/patterns/AppShell/AppShell.variants.d.ts +70 -32
- package/dist/patterns/AppShell/AppShell.variants.d.ts.map +1 -1
- package/dist/patterns/AppShell/AppShell.variants.js +116 -38
- package/dist/patterns/AppShell/AppShell.variants.js.map +1 -1
- package/dist/patterns/AppShell/index.d.ts +1 -1
- package/dist/patterns/AppShell/index.d.ts.map +1 -1
- package/dist/patterns/AppShell/index.js.map +1 -1
- package/dist/patterns/CommandPalette/CommandPalette.d.ts +36 -0
- package/dist/patterns/CommandPalette/CommandPalette.d.ts.map +1 -0
- package/dist/patterns/CommandPalette/CommandPalette.js +18 -0
- package/dist/patterns/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/patterns/CommandPalette/CommandPalette.variants.d.ts +18 -0
- package/dist/patterns/CommandPalette/CommandPalette.variants.d.ts.map +1 -0
- package/dist/patterns/CommandPalette/CommandPalette.variants.js +21 -0
- package/dist/patterns/CommandPalette/CommandPalette.variants.js.map +1 -0
- package/dist/patterns/CommandPalette/index.d.ts +2 -0
- package/dist/patterns/CommandPalette/index.d.ts.map +1 -0
- package/dist/patterns/CommandPalette/index.js +2 -0
- package/dist/patterns/CommandPalette/index.js.map +1 -0
- package/dist/patterns/Outline/Outline.d.ts +26 -0
- package/dist/patterns/Outline/Outline.d.ts.map +1 -0
- package/dist/patterns/Outline/Outline.js +21 -0
- package/dist/patterns/Outline/Outline.js.map +1 -0
- package/dist/patterns/Outline/Outline.variants.d.ts +11 -0
- package/dist/patterns/Outline/Outline.variants.d.ts.map +1 -0
- package/dist/patterns/Outline/Outline.variants.js +21 -0
- package/dist/patterns/Outline/Outline.variants.js.map +1 -0
- package/dist/patterns/Outline/index.d.ts +2 -0
- package/dist/patterns/Outline/index.d.ts.map +1 -0
- package/dist/patterns/Outline/index.js +2 -0
- package/dist/patterns/Outline/index.js.map +1 -0
- package/dist/patterns/PageHeader/PageHeader.d.ts +33 -4
- package/dist/patterns/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/patterns/PageHeader/PageHeader.js +31 -6
- package/dist/patterns/PageHeader/PageHeader.js.map +1 -1
- package/dist/patterns/PageHeader/PageHeader.variants.d.ts +23 -3
- package/dist/patterns/PageHeader/PageHeader.variants.d.ts.map +1 -1
- package/dist/patterns/PageHeader/PageHeader.variants.js +33 -3
- package/dist/patterns/PageHeader/PageHeader.variants.js.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.d.ts +9 -1
- package/dist/patterns/PagePreview/PagePreview.d.ts.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.js +6 -2
- package/dist/patterns/PagePreview/PagePreview.js.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.d.ts +16 -5
- package/dist/patterns/SaveBar/SaveBar.d.ts.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.js +21 -3
- package/dist/patterns/SaveBar/SaveBar.js.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.variants.d.ts +25 -7
- package/dist/patterns/SaveBar/SaveBar.variants.d.ts.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.variants.js +32 -10
- package/dist/patterns/SaveBar/SaveBar.variants.js.map +1 -1
- package/dist/patterns/SectionList/SectionList.d.ts.map +1 -1
- package/dist/patterns/SectionList/SectionList.js +2 -2
- package/dist/patterns/SectionList/SectionList.js.map +1 -1
- package/dist/patterns/SectionList/SectionList.variants.d.ts +4 -1
- package/dist/patterns/SectionList/SectionList.variants.d.ts.map +1 -1
- package/dist/patterns/SectionList/SectionList.variants.js +5 -2
- package/dist/patterns/SectionList/SectionList.variants.js.map +1 -1
- package/dist/patterns/SiteWindow/SiteWindow.d.ts +20 -0
- package/dist/patterns/SiteWindow/SiteWindow.d.ts.map +1 -0
- package/dist/patterns/SiteWindow/SiteWindow.js +8 -0
- package/dist/patterns/SiteWindow/SiteWindow.js.map +1 -0
- package/dist/patterns/SiteWindow/SiteWindow.variants.d.ts +24 -0
- package/dist/patterns/SiteWindow/SiteWindow.variants.d.ts.map +1 -0
- package/dist/patterns/SiteWindow/SiteWindow.variants.js +25 -0
- package/dist/patterns/SiteWindow/SiteWindow.variants.js.map +1 -0
- package/dist/patterns/SiteWindow/index.d.ts +2 -0
- package/dist/patterns/SiteWindow/index.d.ts.map +1 -0
- package/dist/patterns/SiteWindow/index.js +2 -0
- package/dist/patterns/SiteWindow/index.js.map +1 -0
- package/dist/patterns/Split/Split.variants.d.ts +2 -2
- package/dist/patterns/Split/Split.variants.d.ts.map +1 -1
- package/dist/patterns/Split/Split.variants.js +2 -2
- package/dist/patterns/Split/Split.variants.js.map +1 -1
- package/dist/patterns/Welcome/Welcome.d.ts +18 -0
- package/dist/patterns/Welcome/Welcome.d.ts.map +1 -0
- package/dist/patterns/Welcome/Welcome.js +14 -0
- package/dist/patterns/Welcome/Welcome.js.map +1 -0
- package/dist/patterns/Welcome/Welcome.variants.d.ts +12 -0
- package/dist/patterns/Welcome/Welcome.variants.d.ts.map +1 -0
- package/dist/patterns/Welcome/Welcome.variants.js +12 -0
- package/dist/patterns/Welcome/Welcome.variants.js.map +1 -0
- package/dist/patterns/Welcome/index.d.ts +2 -0
- package/dist/patterns/Welcome/index.d.ts.map +1 -0
- package/dist/patterns/Welcome/index.js +2 -0
- package/dist/patterns/Welcome/index.js.map +1 -0
- package/dist/patterns/Workbench/Workbench.d.ts +26 -5
- package/dist/patterns/Workbench/Workbench.d.ts.map +1 -1
- package/dist/patterns/Workbench/Workbench.js +53 -7
- package/dist/patterns/Workbench/Workbench.js.map +1 -1
- package/dist/patterns/Workbench/Workbench.variants.d.ts +36 -2
- package/dist/patterns/Workbench/Workbench.variants.d.ts.map +1 -1
- package/dist/patterns/Workbench/Workbench.variants.js +70 -8
- package/dist/patterns/Workbench/Workbench.variants.js.map +1 -1
- package/dist/patterns/Workbench/index.d.ts +1 -1
- package/dist/patterns/Workbench/index.d.ts.map +1 -1
- package/dist/patterns/Workbench/index.js.map +1 -1
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +4 -0
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/page-bar.d.ts +17 -0
- package/dist/patterns/page-bar.d.ts.map +1 -0
- package/dist/patterns/page-bar.js +22 -0
- package/dist/patterns/page-bar.js.map +1 -0
- package/package.json +1 -1
- package/src/styles.css +19 -0
- package/src/tokens/tokens.css +21 -1
|
@@ -1,68 +1,146 @@
|
|
|
1
1
|
import { cva } from 'class-variance-authority';
|
|
2
|
-
/** The page is one quiet surface: the sidebar is part of it, and the screen sits on it in a panel. */
|
|
3
2
|
/**
|
|
4
|
-
* From `md` up the
|
|
5
|
-
*
|
|
3
|
+
* From `md` up the window has three parts side by side: the rail of sections, dark in both themes;
|
|
4
|
+
* beside it, when the section being shown has places of its own, a column naming them; then the bar
|
|
5
|
+
* across the top and the screen under it. On a narrower window (a phone, a tablet held upright)
|
|
6
|
+
* the rail and the column are behind a button in the bar, so the screen has the width.
|
|
6
7
|
*/
|
|
7
|
-
export const appShellClass = 'flex h-dvh flex-col overflow-hidden bg-background
|
|
8
|
-
/** The bar across the top of a narrow window: the button that opens the navigation, and the site's name. */
|
|
9
|
-
export const appShellTopClass = 'flex shrink-0 items-center gap-2 px-2 py-1.5 md:hidden';
|
|
10
|
-
export const appShellTopBrandClass = 'flex min-w-0 items-center gap-2';
|
|
11
|
-
export const appShellMenuButtonClass = [
|
|
12
|
-
'flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-foreground transition-colors motion-fast',
|
|
13
|
-
'outline-none data-hovered:bg-background-tertiary data-pressed:bg-background-tertiary data-focus-visible:ring-2 data-focus-visible:ring-ring',
|
|
14
|
-
].join(' ');
|
|
15
|
-
/** The navigation of a narrow window: a panel that slides in from the edge the button is on. */
|
|
16
|
-
export const appShellDrawerOverlayClass = 'fixed inset-0 layer-overlay flex bg-scrim motion-scrim';
|
|
17
|
-
export const appShellDrawerClass = 'h-full w-72 max-w-full border-r border-border bg-background-secondary shadow-xl outline-none motion-sheet-start';
|
|
18
|
-
export const appShellDrawerContentClass = 'flex h-full flex-col px-3 py-5 outline-none';
|
|
19
|
-
/** The size of the icon on the button that opens the navigation, in pixels. */
|
|
20
|
-
export const appShellMenuIconSize = 20;
|
|
8
|
+
export const appShellClass = 'flex h-dvh flex-col overflow-hidden bg-background text-foreground md:flex-row';
|
|
21
9
|
export const appShellSkipClass = [
|
|
22
10
|
'sr-only layer-toast rounded-md bg-primary px-4 py-2 text-base font-medium text-primary-foreground',
|
|
23
11
|
'focus:not-sr-only focus:fixed focus:top-2 focus:left-2',
|
|
24
12
|
].join(' ');
|
|
25
|
-
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
export const
|
|
31
|
-
|
|
13
|
+
/* --- The rail --------------------------------------------------------------- */
|
|
14
|
+
export const appShellRailClass = 'hidden w-16 shrink-0 flex-col items-center gap-1 bg-rail px-2 py-3 md:flex';
|
|
15
|
+
export const appShellRailLogoClass = 'flex h-11 w-11 shrink-0 items-center justify-center pb-2';
|
|
16
|
+
export const appShellRailNavClass = 'flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto';
|
|
17
|
+
/** A group of sections. Each after the first is set off by a short rule; the group placed at the end sits at the bottom. */
|
|
18
|
+
export const appShellRailGroupVariants = cva('flex w-full flex-col items-center gap-1', {
|
|
19
|
+
variants: {
|
|
20
|
+
place: {
|
|
21
|
+
start: 'border-t border-rail-border pt-2 first:border-t-0 first:pt-0',
|
|
22
|
+
end: 'mt-auto pt-2',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { place: 'start' },
|
|
26
|
+
});
|
|
27
|
+
export const appShellRailListClass = 'flex flex-col items-center gap-1';
|
|
28
|
+
export const appShellRailLinkVariants = cva([
|
|
29
|
+
'relative flex h-11 w-11 items-center justify-center rounded-lg transition-colors motion-fast',
|
|
30
|
+
'outline-none data-focus-visible:ring-2 data-focus-visible:ring-rail-foreground',
|
|
31
|
+
], {
|
|
32
|
+
variants: {
|
|
33
|
+
isCurrent: {
|
|
34
|
+
true: 'bg-rail-current text-rail-foreground',
|
|
35
|
+
false: 'text-rail-muted data-hovered:bg-rail-hover data-hovered:text-rail-foreground',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: { isCurrent: false },
|
|
39
|
+
});
|
|
40
|
+
/** The words of a section's link: read out, and shown in a tooltip, since the rail shows only the icon. */
|
|
41
|
+
export const appShellRailLabelClass = 'sr-only';
|
|
42
|
+
/** A number on a section, such as what is new in it, at the corner of its icon. */
|
|
43
|
+
export const appShellRailBadgeClass = 'absolute top-1 right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-rail-foreground px-1 text-xs font-bold text-rail';
|
|
44
|
+
export const appShellRailIconSize = 20;
|
|
45
|
+
export const appShellRailAccountClass = [
|
|
46
|
+
'flex h-11 w-11 shrink-0 items-center justify-center rounded-lg transition-colors motion-fast',
|
|
47
|
+
'outline-none data-hovered:bg-rail-hover data-pressed:bg-rail-hover data-focus-visible:ring-2 data-focus-visible:ring-rail-foreground',
|
|
48
|
+
].join(' ');
|
|
49
|
+
export const appShellRailAvatarClass = 'flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-rail-current text-xs font-bold text-rail-foreground';
|
|
50
|
+
/* --- The column of a section's own places ------------------------------------ */
|
|
51
|
+
export const appShellSectionClass = 'hidden w-56 shrink-0 flex-col gap-5 overflow-y-auto border-r border-border bg-card px-3 py-5 md:flex';
|
|
52
|
+
/** The site's name and address, at the top of a section's column and of a narrow window's panel. */
|
|
53
|
+
export const appShellSiteClass = 'flex min-w-0 flex-col gap-0.5 px-2.5';
|
|
54
|
+
export const appShellSiteNameClass = 'truncate text-base font-bold text-foreground';
|
|
55
|
+
export const appShellSiteDetailClass = 'truncate text-xs text-foreground-subtle';
|
|
56
|
+
export const appShellGroupLabelClass = 'px-2.5 pb-1.5 text-xs font-semibold tracking-widest text-foreground-subtle uppercase';
|
|
32
57
|
export const appShellNavListClass = 'flex flex-col gap-0.5';
|
|
33
58
|
export const appShellNavLinkVariants = cva([
|
|
34
|
-
'flex min-h-9 items-center gap-2.5 rounded-
|
|
59
|
+
'flex min-h-9 items-center gap-2.5 rounded-lg px-2.5 text-base transition-colors motion-fast',
|
|
35
60
|
'outline-none data-focus-visible:ring-2 data-focus-visible:ring-ring',
|
|
36
61
|
], {
|
|
37
62
|
variants: {
|
|
38
63
|
isCurrent: {
|
|
39
|
-
true: 'bg-
|
|
40
|
-
false: 'font-medium text-foreground-
|
|
64
|
+
true: 'bg-background-tertiary font-semibold text-foreground',
|
|
65
|
+
false: 'font-medium text-foreground-muted data-hovered:bg-background-secondary data-hovered:text-foreground',
|
|
41
66
|
},
|
|
42
67
|
},
|
|
43
68
|
defaultVariants: { isCurrent: false },
|
|
44
69
|
});
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
70
|
+
export const appShellNavLabelClass = 'min-w-0 flex-1 truncate';
|
|
71
|
+
export const appShellNavCountClass = 'shrink-0 text-xs font-medium text-foreground-muted tabular-nums';
|
|
72
|
+
export const appShellNavIconSize = 16;
|
|
73
|
+
/* --- The bar across the top -------------------------------------------------- */
|
|
74
|
+
export const appShellColumnClass = 'flex min-h-0 min-w-0 flex-1 flex-col';
|
|
75
|
+
/**
|
|
76
|
+
* One bar on every screen, one row on every window: the menu (on a phone), the screen's header (its title,
|
|
77
|
+
* state and buttons, which fold into a menu on a phone) and the search at the end.
|
|
78
|
+
*/
|
|
79
|
+
export const appShellBarClass = 'flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-3 md:min-h-16 md:gap-3 md:px-6';
|
|
80
|
+
/** Where a screen's `PageHeader` or `SaveBar` is drawn. */
|
|
81
|
+
export const appShellBarSlotClass = 'flex min-w-0 flex-1 items-center';
|
|
82
|
+
/** The button that opens the search, at the end of the bar. Below `xl` it shows only its icon, and its words are read out. */
|
|
83
|
+
export const appShellSearchVariants = cva([
|
|
84
|
+
'flex h-10 min-w-0 shrink-0 items-center gap-2.5 rounded-lg border border-border bg-background px-3 text-base text-foreground-subtle transition-colors motion-fast',
|
|
85
|
+
'outline-none data-hovered:border-border-strong data-hovered:text-foreground-muted data-focus-visible:ring-2 data-focus-visible:ring-ring',
|
|
86
|
+
], {
|
|
87
|
+
variants: {
|
|
88
|
+
/**
|
|
89
|
+
* A screen that leads back (an entry) is for working, not looking: its search is an icon, and on a phone it
|
|
90
|
+
* has none, the way back in the menu's place.
|
|
91
|
+
*/
|
|
92
|
+
isScreenLeadingBack: { true: 'max-md:hidden', false: 'xl:w-52' },
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: { isScreenLeadingBack: false },
|
|
95
|
+
});
|
|
96
|
+
export const appShellSearchLabelVariants = cva('sr-only min-w-0 flex-1 truncate text-left', {
|
|
97
|
+
variants: { isScreenLeadingBack: { true: '', false: 'xl:not-sr-only xl:overflow-hidden xl:whitespace-nowrap' } },
|
|
98
|
+
defaultVariants: { isScreenLeadingBack: false },
|
|
99
|
+
});
|
|
100
|
+
export const appShellSearchShortcutVariants = cva('hidden shrink-0 rounded-sm border border-border px-1.5 font-mono text-xs text-foreground-subtle', {
|
|
101
|
+
variants: { isScreenLeadingBack: { true: '', false: 'xl:block' } },
|
|
102
|
+
defaultVariants: { isScreenLeadingBack: false },
|
|
103
|
+
});
|
|
104
|
+
export const appShellSearchIconSize = 16;
|
|
105
|
+
export const appShellMenuButtonVariants = cva([
|
|
106
|
+
'h-10 w-10 shrink-0 items-center justify-center rounded-md text-foreground transition-colors motion-fast md:hidden',
|
|
107
|
+
'outline-none data-hovered:bg-background-tertiary data-pressed:bg-background-tertiary data-focus-visible:ring-2 data-focus-visible:ring-ring',
|
|
108
|
+
], {
|
|
109
|
+
variants: {
|
|
110
|
+
/** The way back takes the menu's place on a screen that leads back, as on any phone. */
|
|
111
|
+
isScreenLeadingBack: { true: 'hidden', false: 'flex' },
|
|
112
|
+
},
|
|
113
|
+
defaultVariants: { isScreenLeadingBack: false },
|
|
114
|
+
});
|
|
115
|
+
export const appShellMenuIconSize = 20;
|
|
116
|
+
/* --- The panel of a narrow window -------------------------------------------- */
|
|
117
|
+
/** The navigation of a narrow window: a panel that slides in from the edge the button is on. */
|
|
118
|
+
export const appShellDrawerOverlayClass = 'fixed inset-0 layer-overlay flex bg-scrim motion-scrim';
|
|
119
|
+
export const appShellDrawerClass = 'h-full w-72 max-w-full border-r border-border bg-card shadow-xl outline-none motion-sheet-start';
|
|
120
|
+
export const appShellDrawerContentClass = 'flex h-full flex-col gap-4 overflow-y-auto px-3 py-5 outline-none';
|
|
121
|
+
export const appShellDrawerNavClass = 'flex flex-col gap-4';
|
|
122
|
+
/** A section's own places, under its link in the panel. */
|
|
123
|
+
export const appShellDrawerChildrenClass = 'flex flex-col gap-0.5 border-l border-border pl-3 ml-4.5';
|
|
124
|
+
export const appShellDrawerFooterClass = 'mt-auto border-t border-border pt-3';
|
|
125
|
+
export const appShellDrawerAccountClass = [
|
|
47
126
|
'flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-foreground-muted transition-colors motion-fast',
|
|
48
127
|
'outline-none data-hovered:bg-background-tertiary data-pressed:bg-background-tertiary data-focus-visible:ring-2 data-focus-visible:ring-ring',
|
|
49
128
|
].join(' ');
|
|
50
|
-
export const
|
|
129
|
+
export const appShellDrawerAvatarClass = 'flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-border bg-background-tertiary text-xs font-semibold text-foreground';
|
|
130
|
+
/* --- The account, as it is read ---------------------------------------------- */
|
|
51
131
|
export const appShellAccountTextClass = 'flex min-w-0 flex-1 flex-col';
|
|
52
132
|
export const appShellAccountNameClass = 'truncate text-sm font-semibold text-foreground';
|
|
53
133
|
export const appShellAccountDetailClass = 'truncate text-xs text-foreground-muted';
|
|
134
|
+
/** On the rail only the initials show: the words are for screen readers, and the tooltip. */
|
|
135
|
+
export const appShellHiddenClass = 'sr-only';
|
|
136
|
+
export const appShellAccountIconSize = 14;
|
|
137
|
+
/* --- The screen --------------------------------------------------------------- */
|
|
54
138
|
/**
|
|
55
|
-
* `relative`, so that anything placed out of the flow inside the
|
|
139
|
+
* `relative`, so that anything placed out of the flow inside the screen (a label only screen readers
|
|
56
140
|
* get) scrolls with it. Without it such an element is placed against the page and makes the page
|
|
57
141
|
* itself scroll far past the frame.
|
|
58
142
|
*/
|
|
59
|
-
export const appShellMainClass = 'relative min-h-0 min-w-0 flex-1 overflow-auto
|
|
143
|
+
export const appShellMainClass = 'relative min-h-0 min-w-0 flex-1 overflow-auto bg-background outline-none';
|
|
60
144
|
/** The id of the main area, which the skip link jumps to. */
|
|
61
145
|
export const appShellMainId = 'main';
|
|
62
|
-
/** The size of a navigation icon, in pixels. */
|
|
63
|
-
export const appShellNavIconSize = 16;
|
|
64
|
-
/** The size of the arrows on the account button, in pixels. */
|
|
65
|
-
export const appShellAccountIconSize = 14;
|
|
66
|
-
/** The word that says what the button is, for screen readers only: the name and detail follow it. */
|
|
67
|
-
export const appShellAccountLabelClass = 'sr-only';
|
|
68
146
|
//# sourceMappingURL=AppShell.variants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.variants.js","sourceRoot":"","sources":["../../../src/patterns/AppShell/AppShell.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"AppShell.variants.js","sourceRoot":"","sources":["../../../src/patterns/AppShell/AppShell.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,+EAA+E,CAAC;AAE7G,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,mGAAmG;IACnG,wDAAwD;CACzD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,kFAAkF;AAElF,MAAM,CAAC,MAAM,iBAAiB,GAAG,4EAA4E,CAAC;AAC9G,MAAM,CAAC,MAAM,qBAAqB,GAAG,0DAA0D,CAAC;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,wEAAwE,CAAC;AAC7G,4HAA4H;AAC5H,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC,yCAAyC,EAAE;IACtF,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,KAAK,EAAE,8DAA8D;YACrE,GAAG,EAAE,cAAc;SACpB;KACF;IACD,eAAe,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;CACpC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kCAAkC,CAAC;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CACzC;IACE,8FAA8F;IAC9F,gFAAgF;CACjF,EACD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AppShellNavGroup, type AppShellNavItem, type AppShellProps, type AppShellSearch } from './AppShell.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA8G,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
export interface CommandItem {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
/** What choosing it does or where it goes: "Listings", "New listing". */
|
|
5
|
+
readonly label: string;
|
|
6
|
+
/** A few words at the end of the row: what kind of thing it is. */
|
|
7
|
+
readonly detail?: string;
|
|
8
|
+
readonly icon?: LucideIcon;
|
|
9
|
+
/** Other words it is found by, which are not shown. */
|
|
10
|
+
readonly keywords?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CommandGroup {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/** The small heading over the group: "Go to", "Create". */
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly items: readonly CommandItem[];
|
|
17
|
+
}
|
|
18
|
+
export interface CommandPaletteProps {
|
|
19
|
+
readonly isOpen: boolean;
|
|
20
|
+
readonly onOpenChange: (isOpen: boolean) => void;
|
|
21
|
+
/** Names the window for screen readers: "Search and commands". */
|
|
22
|
+
readonly label: string;
|
|
23
|
+
/** What the box says before anything is typed, and what it is called. */
|
|
24
|
+
readonly placeholder: string;
|
|
25
|
+
/** Shown when nothing matches what was typed. */
|
|
26
|
+
readonly emptyText: string;
|
|
27
|
+
readonly groups: readonly CommandGroup[];
|
|
28
|
+
/** Called with the id of what was chosen. The window closes by itself. */
|
|
29
|
+
readonly onAction: (id: string) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A window to find anything by typing and go there: a box, and under it the matches in groups.
|
|
33
|
+
* The arrow keys move through them and Enter chooses one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function CommandPalette({ isOpen, onOpenChange, label, placeholder, emptyText, groups, onAction }: CommandPaletteProps): import("react").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=CommandPalette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/patterns/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAgCvD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAmD5H"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Search } from 'lucide-react';
|
|
3
|
+
import { Autocomplete, Dialog, Header, Input, Menu, MenuItem, MenuSection, Modal, ModalOverlay, SearchField, useFilter, } from 'react-aria-components';
|
|
4
|
+
import { commandPaletteClass, commandPaletteContentClass, commandPaletteEmptyClass, commandPaletteHeaderClass, commandPaletteInputClass, commandPaletteItemClass, commandPaletteItemDetailClass, commandPaletteItemIconClass, commandPaletteItemIconSize, commandPaletteItemLabelClass, commandPaletteListClass, commandPaletteOverlayClass, commandPaletteSearchClass, commandPaletteSearchIconSize, commandPaletteSectionClass, } from './CommandPalette.variants.js';
|
|
5
|
+
/**
|
|
6
|
+
* A window to find anything by typing and go there: a box, and under it the matches in groups.
|
|
7
|
+
* The arrow keys move through them and Enter chooses one.
|
|
8
|
+
*/
|
|
9
|
+
export function CommandPalette({ isOpen, onOpenChange, label, placeholder, emptyText, groups, onAction }) {
|
|
10
|
+
const { contains } = useFilter({ sensitivity: 'base' });
|
|
11
|
+
return (_jsx(ModalOverlay, { isOpen: isOpen, onOpenChange: onOpenChange, isDismissable: true, className: commandPaletteOverlayClass, children: _jsx(Modal, { className: commandPaletteClass, children: _jsx(Dialog, { "aria-label": label, className: commandPaletteContentClass, children: ({ close }) => (_jsxs(Autocomplete, { filter: contains, children: [_jsxs(SearchField, { "aria-label": placeholder, autoFocus: true, className: commandPaletteSearchClass, children: [_jsx(Search, { "aria-hidden": true, size: commandPaletteSearchIconSize }), _jsx(Input, { placeholder: placeholder, className: commandPaletteInputClass })] }), _jsx(Menu, { "aria-label": label, className: commandPaletteListClass, renderEmptyState: () => _jsx("div", { className: commandPaletteEmptyClass, children: emptyText }), onAction: (key) => {
|
|
12
|
+
close();
|
|
13
|
+
onAction(String(key));
|
|
14
|
+
}, children: groups
|
|
15
|
+
.filter((group) => group.items.length > 0)
|
|
16
|
+
.map((group) => (_jsxs(MenuSection, { id: group.id, className: commandPaletteSectionClass, children: [_jsx(Header, { className: commandPaletteHeaderClass, children: group.label }), group.items.map(({ id, label: words, detail, icon: Icon, keywords }) => (_jsxs(MenuItem, { id: id, className: commandPaletteItemClass, textValue: [words, detail, keywords].filter((part) => part !== undefined).join(' '), children: [Icon && (_jsx("span", { "aria-hidden": true, className: commandPaletteItemIconClass, children: _jsx(Icon, { size: commandPaletteItemIconSize }) })), _jsx("span", { className: commandPaletteItemLabelClass, children: words }), detail !== undefined && _jsx("span", { className: commandPaletteItemDetailClass, children: detail })] }, id)))] }, group.id))) })] })) }) }) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=CommandPalette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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AAM,KAAK,SAAS,IAAI,eAAM,SAAS,EAAE,6BAA6B,YAAG,MAAM,GAAQ,KAXnF,EAAE,CAYE,CACZ,CAAC,KAjBc,KAAK,CAAC,EAAE,CAkBZ,CACf,CAAC,GACC,IACM,CAChB,GACM,GACH,GACK,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Near the top of the window, where the eye already is, rather than in the middle. */
|
|
2
|
+
export declare const commandPaletteOverlayClass = "fixed inset-0 layer-overlay flex items-start justify-center bg-scrim px-4 pt-24 motion-scrim";
|
|
3
|
+
export declare const commandPaletteClass = "flex max-h-112 w-full max-w-xl flex-col overflow-hidden rounded-xl border border-border bg-background-elevated shadow-xl outline-none motion-pop";
|
|
4
|
+
/** The window scrolls as a whole, with the box held at its top, so what scrolls also holds what the keyboard reaches. */
|
|
5
|
+
export declare const commandPaletteContentClass = "flex min-h-0 flex-col overflow-y-auto outline-none";
|
|
6
|
+
export declare const commandPaletteSearchClass = "sticky top-0 layer-raised flex shrink-0 items-center gap-3 border-b border-border bg-background-elevated px-4 text-foreground-muted";
|
|
7
|
+
export declare const commandPaletteInputClass = "h-14 w-full min-w-0 bg-transparent text-lg text-foreground outline-none placeholder:text-foreground-subtle";
|
|
8
|
+
export declare const commandPaletteSearchIconSize = 18;
|
|
9
|
+
export declare const commandPaletteListClass = "p-2 outline-none";
|
|
10
|
+
export declare const commandPaletteSectionClass = "pb-1";
|
|
11
|
+
export declare const commandPaletteHeaderClass = "px-3 pt-2 pb-1 text-xs font-semibold tracking-widest text-foreground-subtle uppercase";
|
|
12
|
+
export declare const commandPaletteItemClass: string;
|
|
13
|
+
export declare const commandPaletteItemIconClass = "flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground-muted";
|
|
14
|
+
export declare const commandPaletteItemLabelClass = "min-w-0 flex-1 truncate font-medium";
|
|
15
|
+
export declare const commandPaletteItemDetailClass = "shrink-0 text-sm text-foreground-subtle";
|
|
16
|
+
export declare const commandPaletteItemIconSize = 16;
|
|
17
|
+
export declare const commandPaletteEmptyClass = "px-3 py-8 text-center text-base text-foreground-muted";
|
|
18
|
+
//# sourceMappingURL=CommandPalette.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPalette.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/CommandPalette/CommandPalette.variants.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,0BAA0B,iGAAiG,CAAC;AACzI,eAAO,MAAM,mBAAmB,qJACoH,CAAC;AACrJ,yHAAyH;AACzH,eAAO,MAAM,0BAA0B,uDAAuD,CAAC;AAE/F,eAAO,MAAM,yBAAyB,wIAAwI,CAAC;AAC/K,eAAO,MAAM,wBAAwB,+GAA+G,CAAC;AACrJ,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAC1D,eAAO,MAAM,0BAA0B,SAAS,CAAC;AACjD,eAAO,MAAM,yBAAyB,0FAA0F,CAAC;AACjI,eAAO,MAAM,uBAAuB,QAGzB,CAAC;AACZ,eAAO,MAAM,2BAA2B,0HACiF,CAAC;AAC1H,eAAO,MAAM,4BAA4B,wCAAwC,CAAC;AAClF,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AACvF,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,wBAAwB,0DAA0D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Near the top of the window, where the eye already is, rather than in the middle. */
|
|
2
|
+
export const commandPaletteOverlayClass = 'fixed inset-0 layer-overlay flex items-start justify-center bg-scrim px-4 pt-24 motion-scrim';
|
|
3
|
+
export const commandPaletteClass = 'flex max-h-112 w-full max-w-xl flex-col overflow-hidden rounded-xl border border-border bg-background-elevated shadow-xl outline-none motion-pop';
|
|
4
|
+
/** The window scrolls as a whole, with the box held at its top, so what scrolls also holds what the keyboard reaches. */
|
|
5
|
+
export const commandPaletteContentClass = 'flex min-h-0 flex-col overflow-y-auto outline-none';
|
|
6
|
+
export const commandPaletteSearchClass = 'sticky top-0 layer-raised flex shrink-0 items-center gap-3 border-b border-border bg-background-elevated px-4 text-foreground-muted';
|
|
7
|
+
export const commandPaletteInputClass = 'h-14 w-full min-w-0 bg-transparent text-lg text-foreground outline-none placeholder:text-foreground-subtle';
|
|
8
|
+
export const commandPaletteSearchIconSize = 18;
|
|
9
|
+
export const commandPaletteListClass = 'p-2 outline-none';
|
|
10
|
+
export const commandPaletteSectionClass = 'pb-1';
|
|
11
|
+
export const commandPaletteHeaderClass = 'px-3 pt-2 pb-1 text-xs font-semibold tracking-widest text-foreground-subtle uppercase';
|
|
12
|
+
export const commandPaletteItemClass = [
|
|
13
|
+
'flex cursor-default items-center gap-3 rounded-lg px-3 py-2 text-base text-foreground outline-none',
|
|
14
|
+
'data-focused:bg-background-tertiary data-hovered:bg-background-secondary',
|
|
15
|
+
].join(' ');
|
|
16
|
+
export const commandPaletteItemIconClass = 'flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground-muted';
|
|
17
|
+
export const commandPaletteItemLabelClass = 'min-w-0 flex-1 truncate font-medium';
|
|
18
|
+
export const commandPaletteItemDetailClass = 'shrink-0 text-sm text-foreground-subtle';
|
|
19
|
+
export const commandPaletteItemIconSize = 16;
|
|
20
|
+
export const commandPaletteEmptyClass = 'px-3 py-8 text-center text-base text-foreground-muted';
|
|
21
|
+
//# sourceMappingURL=CommandPalette.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPalette.variants.js","sourceRoot":"","sources":["../../../src/patterns/CommandPalette/CommandPalette.variants.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,8FAA8F,CAAC;AACzI,MAAM,CAAC,MAAM,mBAAmB,GAC9B,kJAAkJ,CAAC;AACrJ,yHAAyH;AACzH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oDAAoD,CAAC;AAE/F,MAAM,CAAC,MAAM,yBAAyB,GAAG,qIAAqI,CAAC;AAC/K,MAAM,CAAC,MAAM,wBAAwB,GAAG,4GAA4G,CAAC;AACrJ,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAC1D,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AACjD,MAAM,CAAC,MAAM,yBAAyB,GAAG,uFAAuF,CAAC;AACjI,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,oGAAoG;IACpG,0EAA0E;CAC3E,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,CAAC,MAAM,2BAA2B,GACtC,uHAAuH,CAAC;AAC1H,MAAM,CAAC,MAAM,4BAA4B,GAAG,qCAAqC,CAAC;AAClF,MAAM,CAAC,MAAM,6BAA6B,GAAG,yCAAyC,CAAC;AACvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,uDAAuD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/CommandPalette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/CommandPalette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
export interface OutlineItem {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
/** What it is called: "Page opening", "Text". */
|
|
5
|
+
readonly label: string;
|
|
6
|
+
/** How far inside other items it is: 0 at the top, at most 3. */
|
|
7
|
+
readonly depth?: 0 | 1 | 2 | 3;
|
|
8
|
+
readonly icon?: LucideIcon;
|
|
9
|
+
}
|
|
10
|
+
export interface OutlineProps {
|
|
11
|
+
/** Over the list, and its name for screen readers: "Sections". */
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly items: readonly OutlineItem[];
|
|
14
|
+
/** The one being looked at. */
|
|
15
|
+
readonly currentId?: string;
|
|
16
|
+
/** Called when one is chosen, with a press or with Enter. */
|
|
17
|
+
readonly onChoose: (id: string) => void;
|
|
18
|
+
/** Shown when there is nothing to list. */
|
|
19
|
+
readonly emptyText: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The parts of something long, by name, in order: the sections of a page. Choosing one goes to it.
|
|
23
|
+
* It is a way around, not a way to change: what is chosen is edited where it is.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Outline({ title, items, currentId, onChoose, emptyText }: OutlineProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=Outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../../src/patterns/Outline/Outline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAc/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,+BAA+B;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,YAAY,+BAmCrF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { ListBox, ListBoxItem } from 'react-aria-components';
|
|
4
|
+
import { outlineClass, outlineEmptyClass, outlineIconClass, outlineIconSize, outlineItemVariants, outlineLabelClass, outlineListClass, outlineTitleClass, } from './Outline.variants.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parts of something long, by name, in order: the sections of a page. Choosing one goes to it.
|
|
7
|
+
* It is a way around, not a way to change: what is chosen is edited where it is.
|
|
8
|
+
*/
|
|
9
|
+
export function Outline({ title, items, currentId, onChoose, emptyText }) {
|
|
10
|
+
const titleId = useId();
|
|
11
|
+
return (_jsxs("div", { className: outlineClass, children: [_jsx("div", { id: titleId, className: outlineTitleClass, children: title }), _jsx(ListBox, { "aria-labelledby": titleId, className: outlineListClass, items: items, selectionMode: "single", selectedKeys: currentId === undefined ? [] : [currentId], onSelectionChange: (keys) => {
|
|
12
|
+
if (keys === 'all')
|
|
13
|
+
return;
|
|
14
|
+
const [first] = [...keys];
|
|
15
|
+
// Pressing the one already chosen would let it go: it is chosen again instead, so it is gone to.
|
|
16
|
+
const chosen = first === undefined ? currentId : String(first);
|
|
17
|
+
if (chosen !== undefined)
|
|
18
|
+
onChoose(chosen);
|
|
19
|
+
}, renderEmptyState: () => _jsx("div", { className: outlineEmptyClass, children: emptyText }), children: ({ id, label, depth = 0, icon: Icon }) => (_jsxs(ListBoxItem, { id: id, textValue: label, className: outlineItemVariants({ depth }), children: [Icon && (_jsx("span", { "aria-hidden": true, className: outlineIconClass, children: _jsx(Icon, { size: outlineIconSize }) })), _jsx("span", { className: outlineLabelClass, children: label })] })) })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Outline.js","sourceRoot":"","sources":["../../../src/patterns/Outline/Outline.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAuB/B;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAgB;IACpF,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,OAAO,CACL,eAAK,SAAS,EAAE,YAAY,aAC1B,cAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,YAC3C,KAAK,GACF,EACN,KAAC,OAAO,uBACW,OAAO,EACxB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,KAAK,EACZ,aAAa,EAAC,QAAQ,EACtB,YAAY,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACxD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC1B,IAAI,IAAI,KAAK,KAAK;wBAAE,OAAO;oBAC3B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;oBAC1B,iGAAiG;oBACjG,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC/D,IAAI,MAAM,KAAK,SAAS;wBAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC7C,CAAC,EACD,gBAAgB,EAAE,GAAG,EAAE,CAAC,cAAK,SAAS,EAAE,iBAAiB,YAAG,SAAS,GAAO,YAE3E,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACzC,MAAC,WAAW,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAmB,CAAC,EAAE,KAAK,EAAE,CAAC,aAC7E,IAAI,IAAI,CACP,oCAAkB,SAAS,EAAE,gBAAgB,YAC3C,KAAC,IAAI,IAAC,IAAI,EAAE,eAAe,GAAI,GAC1B,CACR,EACD,eAAM,SAAS,EAAE,iBAAiB,YAAG,KAAK,GAAQ,IACtC,CACf,GACO,IACN,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const outlineClass = "flex min-h-0 flex-col gap-2";
|
|
2
|
+
export declare const outlineTitleClass = "px-2 text-xs font-semibold tracking-widest text-foreground-subtle uppercase";
|
|
3
|
+
export declare const outlineListClass = "flex flex-col gap-0.5 outline-none";
|
|
4
|
+
export declare const outlineItemVariants: (props?: ({
|
|
5
|
+
depth?: 0 | 1 | 2 | 3 | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const outlineIconClass = "flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground-muted";
|
|
8
|
+
export declare const outlineIconSize = 14;
|
|
9
|
+
export declare const outlineLabelClass = "min-w-0 flex-1 truncate";
|
|
10
|
+
export declare const outlineEmptyClass = "px-2 py-3 text-sm text-foreground-muted";
|
|
11
|
+
//# sourceMappingURL=Outline.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Outline.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/Outline/Outline.variants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,gCAAgC,CAAC;AAC1D,eAAO,MAAM,iBAAiB,gFAAgF,CAAC;AAC/G,eAAO,MAAM,gBAAgB,uCAAuC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;8EAc/B,CAAC;AACF,eAAO,MAAM,gBAAgB,0HAA0H,CAAC;AACxJ,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
export const outlineClass = 'flex min-h-0 flex-col gap-2';
|
|
3
|
+
export const outlineTitleClass = 'px-2 text-xs font-semibold tracking-widest text-foreground-subtle uppercase';
|
|
4
|
+
export const outlineListClass = 'flex flex-col gap-0.5 outline-none';
|
|
5
|
+
export const outlineItemVariants = cva([
|
|
6
|
+
'flex min-h-9 cursor-default items-center gap-2.5 rounded-lg px-2 text-base text-foreground-secondary transition-colors motion-fast outline-none',
|
|
7
|
+
'data-hovered:bg-background-secondary data-hovered:text-foreground',
|
|
8
|
+
'data-focus-visible:ring-2 data-focus-visible:ring-ring data-focus-visible:ring-inset',
|
|
9
|
+
'data-selected:bg-background-tertiary data-selected:font-semibold data-selected:text-foreground',
|
|
10
|
+
], {
|
|
11
|
+
variants: {
|
|
12
|
+
/** A section inside another is set in under it, a step for each level. */
|
|
13
|
+
depth: { 0: '', 1: 'pl-6', 2: 'pl-10', 3: 'pl-14' },
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: { depth: 0 },
|
|
16
|
+
});
|
|
17
|
+
export const outlineIconClass = 'flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground-muted';
|
|
18
|
+
export const outlineIconSize = 14;
|
|
19
|
+
export const outlineLabelClass = 'min-w-0 flex-1 truncate';
|
|
20
|
+
export const outlineEmptyClass = 'px-2 py-3 text-sm text-foreground-muted';
|
|
21
|
+
//# sourceMappingURL=Outline.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Outline.variants.js","sourceRoot":"","sources":["../../../src/patterns/Outline/Outline.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,6EAA6E,CAAC;AAC/G,MAAM,CAAC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC;IACE,iJAAiJ;IACjJ,mEAAmE;IACnE,sFAAsF;IACtF,gGAAgG;CACjG,EACD;IACE,QAAQ,EAAE;QACR,0EAA0E;QAC1E,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;KACpD;IACD,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;CAC9B,CACF,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,uHAAuH,CAAC;AACxJ,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/Outline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/Outline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuC,MAAM,cAAc,CAAC"}
|
|
@@ -1,12 +1,41 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
/** One of a screen's other buttons: a button from `md` up, an item of the screen's one menu on a phone. */
|
|
4
|
+
export interface PageAction {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly icon: LucideIcon;
|
|
8
|
+
readonly onPress: () => void;
|
|
9
|
+
/** How it looks as a button: `secondary` (the default), or `ghost` for what is pressed seldom, such as erasing. */
|
|
10
|
+
readonly variant?: 'secondary' | 'ghost';
|
|
11
|
+
/** `danger` for what cannot be undone: red in the menu. */
|
|
12
|
+
readonly tone?: 'default' | 'danger';
|
|
13
|
+
readonly isDisabled?: boolean;
|
|
14
|
+
/** Under way: the button shows a spinner. */
|
|
15
|
+
readonly isPending?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface PageHeaderSecondary {
|
|
18
|
+
/** Names the menu they fold into on a phone, such as "More actions". */
|
|
19
|
+
readonly moreLabel: string;
|
|
20
|
+
readonly actions: readonly PageAction[];
|
|
21
|
+
}
|
|
2
22
|
export interface PageHeaderProps {
|
|
3
23
|
/** The name of the screen. It becomes the page's only level 1 heading. */
|
|
4
24
|
readonly title: string;
|
|
5
|
-
/** One sentence on what the screen is for. */
|
|
25
|
+
/** One sentence on what the screen is for, or how much it holds. Left out on a phone, in the bar. */
|
|
6
26
|
readonly description?: string;
|
|
7
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The screen's main buttons, main action last, shown on every window. In the bar a phone has one row, so
|
|
29
|
+
* keep to one or two, and give a button `collapses` so it is its icon alone there.
|
|
30
|
+
*/
|
|
8
31
|
readonly actions?: ReactNode;
|
|
32
|
+
/** The screen's other buttons, before the main ones: buttons from `md` up, one menu on a phone. */
|
|
33
|
+
readonly secondary?: PageHeaderSecondary;
|
|
9
34
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The top of every screen: its title, what it is for, and its actions. Inside `AppShell` it is drawn in the
|
|
37
|
+
* shell's bar, so the screen's own area holds only its content; on a phone it is one row there: the title,
|
|
38
|
+
* cut to fit, the menu of other actions and the main ones.
|
|
39
|
+
*/
|
|
40
|
+
export declare function PageHeader({ title, description, actions, secondary }: PageHeaderProps): import("react").JSX.Element | null;
|
|
12
41
|
//# sourceMappingURL=PageHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../src/patterns/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../src/patterns/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBvC,2GAA2G;AAC3G,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,mHAAmH;IACnH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IACzC,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qGAAqG;IACrG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,mGAAmG;IACnG,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,eAAe,sCA+DrF"}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Ellipsis } from 'lucide-react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { Button } from '../../components/Button/index.js';
|
|
2
5
|
import { Heading } from '../../components/Heading/index.js';
|
|
3
|
-
import {
|
|
6
|
+
import { IconButton } from '../../components/IconButton/index.js';
|
|
7
|
+
import { Menu } from '../../components/Menu/index.js';
|
|
4
8
|
import { Text } from '../../components/Text/index.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
import { usePageBar } from '../page-bar.js';
|
|
10
|
+
import { pageHeaderActionsVariants, pageHeaderDescriptionVariants, pageHeaderMoreClass, pageHeaderSecondaryClass, pageHeaderTitleVariants, pageHeaderVariants, } from './PageHeader.variants.js';
|
|
11
|
+
/**
|
|
12
|
+
* The top of every screen: its title, what it is for, and its actions. Inside `AppShell` it is drawn in the
|
|
13
|
+
* shell's bar, so the screen's own area holds only its content; on a phone it is one row there: the title,
|
|
14
|
+
* cut to fit, the menu of other actions and the main ones.
|
|
15
|
+
*/
|
|
16
|
+
export function PageHeader({ title, description, actions, secondary }) {
|
|
17
|
+
const bar = usePageBar();
|
|
18
|
+
// The shell is still drawing its bar: the header comes once there is a place for it.
|
|
19
|
+
if (bar === null)
|
|
20
|
+
return null;
|
|
21
|
+
const place = bar === undefined ? 'page' : 'bar';
|
|
22
|
+
const inBar = place === 'bar';
|
|
23
|
+
// In the shell's bar, which is the page's header already, it is one part of it.
|
|
24
|
+
const Element = inBar ? 'div' : 'header';
|
|
25
|
+
const others = secondary !== undefined && secondary.actions.length > 0 ? secondary : undefined;
|
|
26
|
+
const header = (_jsxs(Element, { className: pageHeaderVariants({ place }), children: [_jsxs("div", { className: pageHeaderTitleVariants({ place }), children: [_jsx(Heading, { level: 1, ...(inBar && { size: 'lg', truncate: true }), children: title }), description !== undefined && (_jsx("div", { className: pageHeaderDescriptionVariants({ place }), children: _jsx(Text, { tone: inBar ? 'muted' : 'secondary', size: inBar ? 'sm' : 'base', truncate: inBar, children: description }) }))] }), (others !== undefined || actions !== undefined) && (_jsxs("div", { className: pageHeaderActionsVariants({ place }), children: [others !== undefined && (_jsxs(_Fragment, { children: [_jsx("div", { className: pageHeaderSecondaryClass, children: others.actions.map((action) => (_jsx(Button, { variant: action.variant ?? 'secondary', icon: action.icon, onPress: action.onPress, ...(action.isDisabled !== undefined && { isDisabled: action.isDisabled }), ...(action.isPending !== undefined && { isPending: action.isPending }), children: action.label }, action.id))) }), _jsx("div", { className: pageHeaderMoreClass, children: _jsx(Menu, { placement: "bottom end", trigger: _jsx(IconButton, { label: others.moreLabel, icon: Ellipsis }), actions: others.actions.map(({ id, label, icon, tone, isDisabled }) => ({
|
|
27
|
+
id,
|
|
28
|
+
label,
|
|
29
|
+
icon,
|
|
30
|
+
...(tone !== undefined && { tone }),
|
|
31
|
+
...(isDisabled !== undefined && { isDisabled }),
|
|
32
|
+
})), onAction: (id) => others.actions.find((action) => action.id === id)?.onPress() }) })] })), actions] }))] }));
|
|
33
|
+
return bar === undefined ? header : createPortal(header, bar);
|
|
9
34
|
}
|
|
10
35
|
//# sourceMappingURL=PageHeader.js.map
|