@mgamadeus/ddd-admin-ui 0.1.0-rc.3 → 0.1.0-rc.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/.claude/skills/ddd-admin-ui-specialist/SKILL.md +9 -2
- package/CHANGELOG.md +28 -0
- package/README.md +32 -5
- package/STANDARDS.md +30 -4
- package/dist/components.css +8 -3
- package/dist/i18n-keys.json +1 -1
- package/dist/list/EntityListBody.d.ts +2 -2
- package/dist/list/EntityListBody.d.ts.map +1 -1
- package/dist/list/EntityListBody.js +2 -2
- package/dist/list/EntityListBody.js.map +1 -1
- package/dist/list/EntityListTable.d.ts +10 -3
- package/dist/list/EntityListTable.d.ts.map +1 -1
- package/dist/list/EntityListTable.js +5 -4
- package/dist/list/EntityListTable.js.map +1 -1
- package/dist/logic/index.d.ts +1 -1
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/pure/listSort.d.ts +11 -3
- package/dist/logic/pure/listSort.d.ts.map +1 -1
- package/dist/logic/pure/listSort.js +9 -5
- package/dist/logic/pure/listSort.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/segmented-control.d.ts +57 -0
- package/dist/primitives/segmented-control.d.ts.map +1 -0
- package/dist/primitives/segmented-control.js +206 -0
- package/dist/primitives/segmented-control.js.map +1 -0
- package/dist/primitives/segmentedControlNavigation.d.ts +31 -0
- package/dist/primitives/segmentedControlNavigation.d.ts.map +1 -0
- package/dist/primitives/segmentedControlNavigation.js +65 -0
- package/dist/primitives/segmentedControlNavigation.js.map +1 -0
- package/dist/scripts/build-i18n-manifest.mjs +9 -3
- package/dist/showcase/Showcase.d.ts +35 -0
- package/dist/showcase/Showcase.d.ts.map +1 -0
- package/dist/showcase/Showcase.js +47 -0
- package/dist/showcase/Showcase.js.map +1 -0
- package/dist/showcase/coverage.d.ts +11 -0
- package/dist/showcase/coverage.d.ts.map +1 -0
- package/dist/showcase/coverage.js +77 -0
- package/dist/showcase/coverage.js.map +1 -0
- package/dist/showcase/index.d.ts +6 -0
- package/dist/showcase/index.d.ts.map +1 -0
- package/dist/showcase/index.js +5 -0
- package/dist/showcase/index.js.map +1 -0
- package/dist/showcase/sections/FormShowcase.d.ts +3 -0
- package/dist/showcase/sections/FormShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/FormShowcase.js +26 -0
- package/dist/showcase/sections/FormShowcase.js.map +1 -0
- package/dist/showcase/sections/GlassShowcase.d.ts +3 -0
- package/dist/showcase/sections/GlassShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/GlassShowcase.js +19 -0
- package/dist/showcase/sections/GlassShowcase.js.map +1 -0
- package/dist/showcase/sections/ListShowcase.d.ts +13 -0
- package/dist/showcase/sections/ListShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/ListShowcase.js +67 -0
- package/dist/showcase/sections/ListShowcase.js.map +1 -0
- package/dist/showcase/sections/MediaShowcase.d.ts +3 -0
- package/dist/showcase/sections/MediaShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/MediaShowcase.js +28 -0
- package/dist/showcase/sections/MediaShowcase.js.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts +14 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.js +32 -0
- package/dist/showcase/sections/OptionalShowcase.js.map +1 -0
- package/dist/showcase/sections/PageShowcase.d.ts +3 -0
- package/dist/showcase/sections/PageShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PageShowcase.js +37 -0
- package/dist/showcase/sections/PageShowcase.js.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts +13 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.js +40 -0
- package/dist/showcase/sections/PrimitivesShowcase.js.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts +3 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.js +30 -0
- package/dist/showcase/sections/TranslationsShowcase.js.map +1 -0
- package/dist/tokens.json +17 -1
- package/package.json +6 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const DRAWN_BY = (block) => `drawn by ${block}`;
|
|
2
|
+
export const SHOWCASE_COVERAGE = {
|
|
3
|
+
primitives: {
|
|
4
|
+
shown: [
|
|
5
|
+
'Alert', 'AlertDescription', 'AlertTitle', 'Badge', 'Breadcrumb', 'BreadcrumbEllipsis', 'BreadcrumbItem', 'BreadcrumbLink',
|
|
6
|
+
'BreadcrumbList', 'BreadcrumbPage', 'BreadcrumbSeparator', 'Button', 'Card', 'CardAction', 'CardContent', 'CardDescription',
|
|
7
|
+
'CardFooter', 'CardHeader', 'CardTitle', 'Checkbox', 'Collapsible', 'CollapsibleContent', 'CollapsibleTrigger', 'Command',
|
|
8
|
+
'CommandDialog', 'CommandEmpty', 'CommandGroup', 'CommandInput', 'CommandItem', 'CommandList', 'CommandSeparator',
|
|
9
|
+
'CommandShortcut', 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription', 'DialogFooter', 'DialogHeader',
|
|
10
|
+
'DialogTitle', 'DialogTrigger', 'DropdownMenu', 'DropdownMenuCheckboxItem', 'DropdownMenuContent', 'DropdownMenuGroup',
|
|
11
|
+
'DropdownMenuItem', 'DropdownMenuLabel', 'DropdownMenuSeparator', 'DropdownMenuSub', 'DropdownMenuSubContent',
|
|
12
|
+
'DropdownMenuSubTrigger', 'DropdownMenuTrigger', 'Input', 'Label', 'Popover', 'PopoverAnchor', 'PopoverContent',
|
|
13
|
+
'PopoverDescription', 'PopoverHeader', 'PopoverTitle', 'PopoverTrigger', 'PortalContainerProvider', 'SegmentedControl',
|
|
14
|
+
'Select', 'SelectContent', 'SelectGroup', 'SelectItem', 'SelectLabel', 'SelectSeparator', 'SelectTrigger', 'SelectValue',
|
|
15
|
+
'Separator', 'Sheet', 'SheetClose', 'SheetContent', 'SheetDescription', 'SheetFooter', 'SheetHeader', 'SheetTitle',
|
|
16
|
+
'SheetTrigger', 'Skeleton', 'Switch', 'Table', 'TableBody', 'TableCaption', 'TableCell', 'TableFooter', 'TableHead',
|
|
17
|
+
'TableHeader', 'TableRow', 'Textarea', 'Tooltip', 'TooltipContent', 'TooltipTrigger',
|
|
18
|
+
],
|
|
19
|
+
notShown: {
|
|
20
|
+
DialogOverlay: DRAWN_BY('DialogContent'),
|
|
21
|
+
DialogPortal: DRAWN_BY('DialogContent'),
|
|
22
|
+
DropdownMenuPortal: DRAWN_BY('DropdownMenuContent'),
|
|
23
|
+
SelectScrollDownButton: DRAWN_BY('SelectContent'),
|
|
24
|
+
SelectScrollUpButton: DRAWN_BY('SelectContent'),
|
|
25
|
+
PortalContainerContext: 'a context (PortalContainerProvider is shown)',
|
|
26
|
+
TooltipProvider: 'mounted once by AdminUiProvider',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
list: {
|
|
30
|
+
shown: [
|
|
31
|
+
'BooleanCell', 'ChipToggleGroup', 'Combobox', 'DateCell', 'EmptyValue', 'EntityListBody', 'EntityListBulkBar',
|
|
32
|
+
'EntityListCard', 'EntityListEmpty', 'EntityListGrid', 'EntityListGridSkeleton', 'EntityListLoadMore', 'EntityListTable',
|
|
33
|
+
'EntityListToolbar', 'EntityListViewToggle', 'FilterDateRange', 'FilterField', 'FilterMultiSelect', 'FilterPanel',
|
|
34
|
+
'FilterSelect', 'FilterText', 'IdCell', 'ImageCell', 'MultiSelect', 'SearchField', 'StatusBadge', 'Tag',
|
|
35
|
+
],
|
|
36
|
+
notShown: { EntityListPage: 'deprecated re-export; shown under ./page' },
|
|
37
|
+
},
|
|
38
|
+
page: {
|
|
39
|
+
shown: [
|
|
40
|
+
'AddEntityButton', 'AnchorLink', 'CardGrid', 'DefinitionList', 'DetailHeader', 'EditableCard', 'EntityDetailShell',
|
|
41
|
+
'EntityListPage', 'EntityMetadata', 'EntityTabs', 'ExportButton', 'IconValue', 'IconValueRow', 'MoreActionsMenu',
|
|
42
|
+
'PageFrame', 'PageHeader', 'PageSections', 'PageToolbar', 'SectionHeader', 'StatusCallout', 'StatusCalloutAction',
|
|
43
|
+
],
|
|
44
|
+
notShown: {},
|
|
45
|
+
},
|
|
46
|
+
form: {
|
|
47
|
+
shown: [
|
|
48
|
+
'DrawerFooter', 'Form', 'FormActions', 'FormDrawer', 'FormErrors', 'FormField', 'FormFieldFrame', 'FormHeader',
|
|
49
|
+
'FormJumpBar', 'FormSection', 'FormSubmitButton', 'FormWrapper', 'VisibleWhen',
|
|
50
|
+
],
|
|
51
|
+
notShown: { UnsavedChangesContext: 'a context (used by FormDrawer)' },
|
|
52
|
+
},
|
|
53
|
+
translations: {
|
|
54
|
+
shown: [
|
|
55
|
+
'FormTranslatableInput', 'FormTranslatableMarkdown', 'TranslatableField', 'TranslatableInput', 'TranslatableMarkdown',
|
|
56
|
+
'TranslationControls',
|
|
57
|
+
],
|
|
58
|
+
notShown: {},
|
|
59
|
+
},
|
|
60
|
+
media: {
|
|
61
|
+
shown: ['FormMediaItemField', 'MediaItemField', 'MediaItemPickerDialog', 'MediaPreview'],
|
|
62
|
+
notShown: {},
|
|
63
|
+
},
|
|
64
|
+
glass: {
|
|
65
|
+
shown: ['ActionRow', 'CollapsibleCard', 'GlassGroup', 'GlassPill', 'QuickFilterPills'],
|
|
66
|
+
notShown: {},
|
|
67
|
+
},
|
|
68
|
+
provider: {
|
|
69
|
+
shown: [],
|
|
70
|
+
notShown: { AdminUiProvider: 'the host mounts it above the showcase' },
|
|
71
|
+
},
|
|
72
|
+
'notify-sonner': {
|
|
73
|
+
shown: [],
|
|
74
|
+
notShown: { Toaster: 'mounted once by the host; the section sends toasts through sonnerNotifications' },
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1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AAc,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,qBAAqB;SAClH;QACD,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,KAAK,EAAE;YACL,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY;YAC9G,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa;SAC/E;QACD,QAAQ,EAAE,EAAE,qBAAqB,EAAE,gCAAgC,EAAE;KACtE;IACD,YAAY,EAAE;QACZ,KAAK,EAAE;YACL,uBAAuB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB;YACrH,qBAAqB;SACtB;QACD,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,KAAK,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,cAAc,CAAC;QACxF,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,CAAC;QACtF,QAAQ,EAAE,EAAE;KACb;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE,eAAe,EAAE,uCAAuC,EAAE;KACvE;IACD,eAAe,EAAE;QACf,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE,OAAO,EAAE,gFAAgF,EAAE;KACxG;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Showcase } from './Showcase.js';
|
|
2
|
+
export type { ShowcaseProps, ShowcaseSection, ShowcaseTheme } from './Showcase.js';
|
|
3
|
+
export type { NotifySonnerLoader, NotifySonnerModule } from './sections/OptionalShowcase.js';
|
|
4
|
+
export { SHOWCASE_COVERAGE } from './coverage.js';
|
|
5
|
+
export type { ShowcaseEntryCoverage } from './coverage.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpF,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The showcase entry: one development page that draws every block of the package in the host's theme. Not for
|
|
2
|
+
// production screens; its texts are developer-facing English and stay out of the text manifest.
|
|
3
|
+
export { Showcase } from "./Showcase.js";
|
|
4
|
+
export { SHOWCASE_COVERAGE } from "./coverage.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,gGAAgG;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/FormShowcase.tsx"],"names":[],"mappings":"AAuFA,4BAA4B;AAC5B,eAAO,MAAM,YAAY,mCAyBxB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { DrawerFooter, Form, FORM_PANEL_SCROLL_MARGIN_CLASS, FormActions, FormDrawer, FormErrors, FormField, FormFieldFrame, FormHeader, FormJumpBar, FormSection, FormSubmitButton, FormWrapper, VisibleWhen, } from "../../form/index.js";
|
|
6
|
+
import { fieldEquals } from "../../logic/index.js";
|
|
7
|
+
import { Button, Input, Switch } from "../../primitives/index.js";
|
|
8
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
9
|
+
const SERVER_ERROR = {
|
|
10
|
+
message: 'Could not save',
|
|
11
|
+
validationErrors: [{ propertyName: 'email', path: 'email', errorMessage: 'is not a valid address' }],
|
|
12
|
+
};
|
|
13
|
+
const ShowcaseFormBody = ({ idPrefix, onClose }) => {
|
|
14
|
+
const form = useForm({ defaultValues: { name: 'Sample', email: 'not-an-address', hasNote: true, note: '' } });
|
|
15
|
+
const [error, setError] = useState(null);
|
|
16
|
+
return (_jsxs(Form, { form: form, onSubmit: () => setError(SERVER_ERROR), children: [_jsx(FormErrors, { error: error }), _jsx(FormJumpBar, { panels: [
|
|
17
|
+
{ id: `${idPrefix}-general`, label: 'General' },
|
|
18
|
+
{ id: `${idPrefix}-details`, label: 'Details' },
|
|
19
|
+
] }), _jsx("div", { id: `${idPrefix}-general`, className: FORM_PANEL_SCROLL_MARGIN_CLASS, children: _jsxs(FormSection, { title: "General", description: "The basics.", children: [_jsx(FormField, { name: "name", label: "Name", required: true, description: "Shown in lists.", children: ({ field, control, disabled }) => _jsx(Input, { ...control, ...field, disabled: disabled }) }), _jsx(FormField, { name: "email", label: "Email", children: ({ field, control }) => _jsx(Input, { ...control, ...field, type: "email" }) })] }) }), _jsx("div", { id: `${idPrefix}-details`, className: FORM_PANEL_SCROLL_MARGIN_CLASS, children: _jsxs(FormSection, { title: "Details", children: [_jsx(FormField, { name: "hasNote", label: "Add a note", children: ({ field, control }) => _jsx(Switch, { id: control.id, checked: field.value, onCheckedChange: field.onChange }) }), _jsx(VisibleWhen, { condition: fieldEquals('hasNote', true), children: _jsx(FormField, { name: "note", label: "Note", children: ({ field, control }) => _jsx(Input, { ...control, ...field }) }) }), _jsx(FormFieldFrame, { label: "Unbound field", description: "FormFieldFrame outside a form value.", children: control => _jsx(Input, { ...control, placeholder: "Free input" }) })] }) }), _jsx(FormActions, { sticky: false, secondary: _jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Cancel" }), primary: _jsx(FormSubmitButton, { children: "Save" }) })] }));
|
|
20
|
+
};
|
|
21
|
+
/** The `./form` section. */
|
|
22
|
+
export const FormShowcase = () => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
return (_jsxs(Samples, { children: [_jsx(Sample, { title: "FormWrapper, FormHeader, Form, FormJumpBar, FormSection, FormField, FormErrors, FormActions", children: _jsxs("div", { className: "w-full", children: [_jsx(FormHeader, { title: "Edit item", description: "A form page." }), _jsx(FormWrapper, { children: _jsx(ShowcaseFormBody, { idPrefix: "showcase-form-page" }) })] }) }), _jsxs(Sample, { title: "FormDrawer, DrawerFooter", children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(true), children: "Open form drawer" }), _jsxs(FormDrawer, { open: open, onClose: () => setOpen(false), title: "Edit item", metadata: { id: 42 }, children: [_jsx(ShowcaseFormBody, { idPrefix: "showcase-form-drawer", onClose: () => setOpen(false) }), _jsx(DrawerFooter, { children: _jsx("span", { className: "text-xs text-muted-foreground", children: "DrawerFooter content" }) })] })] })] }));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=FormShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/FormShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,IA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AAC,KAAK,CAAC,GAAI,EACnF,KAAC,YAAY,cACX,eAAM,SAAS,EAAC,+BAA+B,qCAA4B,GAC9D,IACJ,IACN,IACD,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/GlassShowcase.tsx"],"names":[],"mappings":"AAcA,6BAA6B;AAC7B,eAAO,MAAM,aAAa,mCAiCzB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Palette, Star } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { ActionRow, CollapsibleCard, GlassGroup, GlassPill, QuickFilterPills } from "../../glass/index.js";
|
|
6
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
7
|
+
const STATUS_OPTIONS = [
|
|
8
|
+
{ value: 'ACTIVE', label: 'Active', count: 12 },
|
|
9
|
+
{ value: 'PAUSED', label: 'Paused', count: 3 },
|
|
10
|
+
{ value: 'FAILED', label: 'Failed', count: 0 },
|
|
11
|
+
];
|
|
12
|
+
/** The `./glass` section. */
|
|
13
|
+
export const GlassShowcase = () => {
|
|
14
|
+
const [status, setStatus] = useState('');
|
|
15
|
+
const [statuses, setStatuses] = useState(['ACTIVE']);
|
|
16
|
+
const [pill, setPill] = useState(true);
|
|
17
|
+
return (_jsxs(Samples, { children: [_jsxs(Sample, { title: "GlassPill, QuickFilterPills", children: [_jsx(GlassPill, { icon: _jsx(Star, {}), count: 4, active: pill, "aria-pressed": pill, onClick: () => setPill(value => !value), children: "Featured" }), _jsx(GlassPill, { size: "sm", as: "span", children: "Static pill" }), _jsx(QuickFilterPills, { "aria-label": "Status quick filters", allLabel: "All statuses", options: STATUS_OPTIONS, value: status, onChange: setStatus }), _jsx(QuickFilterPills, { "aria-label": "Status quick filters (multi)", mode: "multi", options: STATUS_OPTIONS, value: statuses, onChange: setStatuses, size: "sm" })] }), _jsxs(Sample, { title: "CollapsibleCard", children: [_jsx(CollapsibleCard, { title: "Glass card", description: "Open by default", icon: _jsx(Palette, {}), defaultOpen: true, className: "w-full", children: _jsx("p", { className: "text-sm", children: "Content of a glass collapsible card." }) }), _jsx(CollapsibleCard, { title: "Solid card, compact", variant: "solid", density: "compact", className: "w-full", children: _jsx("p", { className: "text-sm", children: "Content of a solid collapsible card." }) })] }), _jsxs(Sample, { title: "GlassGroup, ActionRow", children: [_jsxs(GlassGroup, { title: "Running", count: 2, emptyText: "Nothing running", className: "w-full", children: [_jsx(ActionRow, { interactive: true, chevron: true, title: "Sample item 1", description: "Workspace North", tone: "success", toneLabel: "Active" }), _jsx(ActionRow, { interactive: true, chevron: true, title: "Sample item 2", description: "Workspace South", tone: "warning", toneLabel: "Paused" })] }), _jsx(GlassGroup, { title: "Empty group", count: 0, emptyText: "Nothing here", className: "w-full" })] })] }));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=GlassShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/GlassShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAA0B,CAAC;AAE3D,MAAM,cAAc,GAAG;IACrB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/C,EAAE,KAAK,EA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,EAAC,YAAY,EAAC,WAAW,EAAC,iBAAiB,EAAC,IAAI,EAAE,KAAC,OAAO,KAAG,EAAE,WAAW,QAAC,SAAS,EAAC,QAAQ,YACjH,YAAG,SAAS,EAAC,SAAS,qDAAyC,GAC/C,EAClB,KAAC,eAAe,IAAC,KAAK,EAAC,qBAAqB,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,YAC/F,YAAG,SAAS,EAAC,SAAS,qDAAyC,GAC/C,IACX,EACT,MAAC,MAAM,IAAC,KAAK,EAAC,uBAAuB,aACnC,MAAC,UAAU,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAC,iBAAiB,EAAC,SAAS,EAAC,QAAQ,aAClF,KAAC,SAAS,IAAC,WAAW,QAAC,OAAO,QAAC,KAAK,EAAC,eAAe,EAAC,WAAW,EAAC,iBAAiB,EAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,GAAG,EACvH,KAAC,SAAS,IAAC,WAAW,QAAC,OAAO,QAAC,KAAK,EAAC,eAAe,EAAC,WAAW,EAAC,iBAAiB,EAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,GAAG,IAC5G,EACb,KAAC,UAAU,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAC,cAAc,EAAC,SAAS,EAAC,QAAQ,GAAG,IACjF,IACD,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ShowcaseRow {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
status: 'ACTIVE' | 'PAUSED' | 'FAILED';
|
|
6
|
+
featured: boolean;
|
|
7
|
+
created: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SHOWCASE_STATUS: Readonly<Record<"ACTIVE" | "PAUSED" | "FAILED", import("../../list/StatusBadge.js").StatusDefinition>>;
|
|
10
|
+
export declare const SHOWCASE_ROWS: ShowcaseRow[];
|
|
11
|
+
/** The `./list` section. */
|
|
12
|
+
export declare const ListShowcase: () => import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=ListShowcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/ListShowcase.tsx"],"names":[],"mappings":"AAwCA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,yGAI1B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,WAAW,EAOpC,CAAC;AAiCJ,4BAA4B;AAC5B,eAAO,MAAM,YAAY,mCAyHxB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Archive, CheckCircle2, CircleX, Inbox, Star } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { BooleanCell, ChipToggleGroup, Combobox, DateCell, EmptyValue, EntityListBody, EntityListBulkBar, EntityListCard, EntityListEmpty, EntityListGrid, EntityListGridSkeleton, EntityListLoadMore, EntityListTable, EntityListToolbar, EntityListViewToggle, FilterDateRange, FilterField, FilterMultiSelect, FilterPanel, FilterSelect, FilterText, IdCell, ImageCell, MultiSelect, SearchField, StatusBadge, Tag, YES_NO_FILTER_OPTIONS, } from "../../list/index.js";
|
|
6
|
+
import { defineStatusMap, useRowSelection } from "../../logic/index.js";
|
|
7
|
+
import { Input } from "../../primitives/index.js";
|
|
8
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
9
|
+
export const SHOWCASE_STATUS = defineStatusMap({
|
|
10
|
+
ACTIVE: { label: 'Active', tone: 'success', icon: CheckCircle2 },
|
|
11
|
+
PAUSED: { label: 'Paused', tone: 'warning', icon: Archive, description: 'Paused by an owner' },
|
|
12
|
+
FAILED: { label: 'Failed', tone: 'danger', icon: CircleX },
|
|
13
|
+
});
|
|
14
|
+
export const SHOWCASE_ROWS = Array.from({ length: 6 }, (_, index) => ({
|
|
15
|
+
id: 101 + index,
|
|
16
|
+
name: `Sample item ${index + 1}`,
|
|
17
|
+
owner: index % 2 === 0 ? 'Alex Example' : '',
|
|
18
|
+
status: ['ACTIVE', 'PAUSED', 'FAILED'][index % 3],
|
|
19
|
+
featured: index % 2 === 1,
|
|
20
|
+
created: `2026-0${(index % 9) + 1}-1${index} 10:00:00`,
|
|
21
|
+
}));
|
|
22
|
+
const OPTIONS = [
|
|
23
|
+
{ value: 'alpha', label: 'Alpha' },
|
|
24
|
+
{ value: 'beta', label: 'Beta' },
|
|
25
|
+
{ value: 'gamma', label: 'Gamma' },
|
|
26
|
+
];
|
|
27
|
+
const COLUMNS = [
|
|
28
|
+
{ id: 'image', header: 'Image', cell: () => _jsx(ImageCell, { src: null, alt: "" }), className: 'w-16' },
|
|
29
|
+
{ id: 'id', header: 'ID', cell: row => _jsx(IdCell, { id: row.id, copyable: true }), className: 'w-24' },
|
|
30
|
+
{ id: 'name', header: 'Name', cell: row => _jsx("span", { className: "font-medium", children: row.name }) },
|
|
31
|
+
{ id: 'owner', header: 'Owner', cell: row => row.owner || _jsx(EmptyValue, {}) },
|
|
32
|
+
{ id: 'status', header: 'Status', cell: row => _jsx(StatusBadge, { value: row.status, map: SHOWCASE_STATUS }) },
|
|
33
|
+
{ id: 'featured', header: 'Featured', cell: row => _jsx(BooleanCell, { value: row.featured }) },
|
|
34
|
+
{ id: 'created', header: 'Created', cell: row => _jsx(DateCell, { value: row.created }) },
|
|
35
|
+
];
|
|
36
|
+
const SIZED_COLUMNS = [
|
|
37
|
+
{ id: 'id', header: 'ID', cell: row => row.id, width: '80px', pin: 'start', sortKey: 'id' },
|
|
38
|
+
{ id: 'name', header: 'Name', cell: row => row.name, width: '2fr', minWidth: 200, sortKey: 'name' },
|
|
39
|
+
{ id: 'owner', header: 'Owner', cell: row => row.owner || _jsx(EmptyValue, {}), width: '1fr', minWidth: 180 },
|
|
40
|
+
{ id: 'status', header: 'Status', cell: row => _jsx(StatusBadge, { value: row.status, map: SHOWCASE_STATUS }), width: '140px' },
|
|
41
|
+
{ id: 'created', header: 'Created', cell: row => _jsx(DateCell, { value: row.created }), width: '180px', sortKey: 'created', align: 'end' },
|
|
42
|
+
];
|
|
43
|
+
const renderCard = ({ item }) => (_jsxs("article", { className: "surface space-y-2 rounded-2xl p-4", children: [_jsx("p", { className: "font-bold", children: item.name }), _jsx(StatusBadge, { value: item.status, map: SHOWCASE_STATUS })] }));
|
|
44
|
+
/** The `./list` section. */
|
|
45
|
+
export const ListShowcase = () => {
|
|
46
|
+
const [query, setQuery] = useState('');
|
|
47
|
+
const [status, setStatus] = useState([]);
|
|
48
|
+
const [single, setSingle] = useState('');
|
|
49
|
+
const [text, setText] = useState('');
|
|
50
|
+
const [from, setFrom] = useState('');
|
|
51
|
+
const [to, setTo] = useState('');
|
|
52
|
+
const [displayMode, setDisplayMode] = useState('table');
|
|
53
|
+
const [sort, setSort] = useState({ key: 'name', direction: 'asc' });
|
|
54
|
+
const [chips, setChips] = useState(['alpha']);
|
|
55
|
+
const [combo, setCombo] = useState('beta');
|
|
56
|
+
const [multi, setMulti] = useState(['alpha', 'gamma']);
|
|
57
|
+
const selection = useRowSelection({ items: SHOWCASE_ROWS, getKey: row => row.id });
|
|
58
|
+
const activeFilterCount = status.length + (single ? 1 : 0) + (text ? 1 : 0);
|
|
59
|
+
const clear = () => {
|
|
60
|
+
setQuery('');
|
|
61
|
+
setStatus([]);
|
|
62
|
+
setSingle('');
|
|
63
|
+
setText('');
|
|
64
|
+
};
|
|
65
|
+
return (_jsxs("div", { className: "space-y-8", children: [_jsx(EntityListCard, { label: "Showcase list", toolbar: _jsx(EntityListToolbar, { search: { value: query, onChange: setQuery, placeholder: 'Search name or ID' }, filters: _jsxs(FilterPanel, { children: [_jsx(FilterText, { label: "Text", value: text, onChange: setText }), _jsx(FilterSelect, { label: "Flag", allLabel: "All", options: YES_NO_FILTER_OPTIONS, value: single, onChange: setSingle }), _jsx(FilterMultiSelect, { label: "Status", options: OPTIONS, value: status, onChange: setStatus }), _jsx(FilterDateRange, { label: "Created", from: from, to: to, onFromChange: setFrom, onToChange: setTo }), _jsx(FilterField, { label: "Custom field", htmlFor: "showcase-filter-field", children: _jsx(Input, { id: "showcase-filter-field", placeholder: "Any control" }) })] }), activeFilterCount: activeFilterCount, onClearFilters: clear, viewToggle: _jsx(EntityListViewToggle, { displayMode: displayMode, onDisplayModeChange: setDisplayMode }), bulkBar: _jsx(EntityListBulkBar, { selection: selection, actions: [{ id: 'archive', label: 'Archive', icon: _jsx(Archive, {}), onClick: () => selection.clear() }], onDelete: () => selection.clear() }) }), children: _jsx(EntityListBody, { displayMode: displayMode, columns: COLUMNS, items: SHOWCASE_ROWS, getRowKey: row => String(row.id), renderCard: renderCard, selection: selection, rowAction: () => null }) }), _jsx(Sample, { title: "EntityListTable with tracks, pins, sort and row index", children: _jsx(EntityListCard, { label: "Sized table", className: "w-full", children: _jsx(EntityListTable, { columns: SIZED_COLUMNS, items: SHOWCASE_ROWS, getRowKey: row => String(row.id), sort: sort, onSortChange: setSort, showRowIndex: true }) }) }), _jsxs(Samples, { children: [_jsxs(Sample, { title: "EntityListTable loading, empty, error", children: [_jsx(EntityListCard, { label: "Loading", className: "w-full", children: _jsx(EntityListTable, { columns: COLUMNS, items: [], getRowKey: row => String(row.id), isLoading: true, skeletonRows: 2 }) }), _jsx(EntityListCard, { label: "Empty", className: "w-full", children: _jsx(EntityListTable, { columns: COLUMNS, items: [], getRowKey: row => String(row.id), emptyMessage: "Nothing here yet" }) }), _jsx(EntityListCard, { label: "Error", className: "w-full", children: _jsx(EntityListTable, { columns: COLUMNS, items: [], getRowKey: row => String(row.id), error: "Could not load the list." }) })] }), _jsxs(Sample, { title: "EntityListGrid, skeleton, load more, empty", children: [_jsx(EntityListGrid, { items: SHOWCASE_ROWS.slice(0, 2), getRowKey: row => String(row.id), renderCard: renderCard, className: "w-full" }), _jsx("div", { className: "w-full", children: _jsx(EntityListGridSkeleton, { count: 2 }) }), _jsx(EntityListLoadMore, { hasMore: true, isFetchingMore: true, onLoadMore: () => { } }), _jsx(EntityListEmpty, { message: "No results", icon: _jsx(Inbox, {}), onClearSearch: () => { } }), _jsx(EntityListEmpty, { message: "Could not load", tone: "error" })] }), _jsxs(Sample, { title: "StatusBadge, Tag, cells", children: [_jsx(StatusBadge, { value: "ACTIVE", map: SHOWCASE_STATUS }), _jsx(StatusBadge, { value: "PAUSED", map: SHOWCASE_STATUS }), _jsx(StatusBadge, { value: "FAILED", map: SHOWCASE_STATUS }), _jsx(StatusBadge, { tone: "highlight", label: "Featured", icon: Star }), _jsx(StatusBadge, { value: null, map: SHOWCASE_STATUS }), _jsx(Tag, { children: "Default" }), _jsx(Tag, { tone: "primary", children: "Primary" }), _jsx(Tag, { tone: "brand", size: "sm", children: "Brand" }), _jsx(IdCell, { id: 4711, copyable: true }), _jsx(DateCell, { value: "2026-03-04", format: "date" }), _jsx(BooleanCell, { value: false, showFalse: true }), _jsx(EmptyValue, {})] }), _jsxs(Sample, { title: "Pickers", children: [_jsx(SearchField, { value: query, onChange: setQuery, placeholder: "SearchField", "aria-label": "SearchField" }), _jsx(ChipToggleGroup, { "aria-label": "Chips", options: OPTIONS, value: chips, onChange: setChips }), _jsx(Combobox, { "aria-label": "Combobox", options: OPTIONS, value: combo, onChange: setCombo, className: "w-56" }), _jsx(MultiSelect, { "aria-label": "MultiSelect", options: OPTIONS, value: multi, onChange: setMulti, className: "w-72" })] })] })] }));
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=ListShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/ListShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,GAAG,EACH,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAA6C,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAA0B,CAAC;AAW3D,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE;IAChE,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE;IAC9F,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAA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ceRoot":"","sources":["../../../src/showcase/sections/MediaShowcase.tsx"],"names":[],"mappings":"AAoCA,6BAA6B;AAC7B,eAAO,MAAM,aAAa,mCAuCzB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { Form } from "../../form/index.js";
|
|
6
|
+
import { FormMediaItemField, MediaItemField, MediaItemPickerDialog, MediaPreview } from "../../media/index.js";
|
|
7
|
+
import { Button } from "../../primitives/index.js";
|
|
8
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
9
|
+
/** A neutral placeholder image (inline SVG), so the showcase loads nothing from the network. */
|
|
10
|
+
const PLACEHOLDER = `data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="160" height="120" viewBox="0 0 160 120"><rect width="160" height="120" fill="#94a3b8"/><circle cx="52" cy="44" r="14" fill="#e2e8f0"/><path d="M0 120 L56 70 L92 100 L120 78 L160 110 V120 Z" fill="#e2e8f0"/></svg>')}`;
|
|
11
|
+
const TILES = Array.from({ length: 6 }, (_, index) => ({
|
|
12
|
+
id: String(index + 1),
|
|
13
|
+
previewUrl: PLACEHOLDER,
|
|
14
|
+
title: `image-${index + 1}.png`,
|
|
15
|
+
details: ['160 × 120', 'PNG'],
|
|
16
|
+
}));
|
|
17
|
+
const BoundMedia = () => {
|
|
18
|
+
const form = useForm({ defaultValues: { image: { id: '1', previewUrl: PLACEHOLDER } } });
|
|
19
|
+
return (_jsx(Form, { form: form, onSubmit: () => { }, className: "w-full", children: _jsx(FormMediaItemField, { name: "image", label: "Cover image (bound)", alt: "", onOpenPicker: () => { }, removable: true }) }));
|
|
20
|
+
};
|
|
21
|
+
/** The `./media` section. */
|
|
22
|
+
export const MediaShowcase = () => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const [selectedId, setSelectedId] = useState('2');
|
|
25
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
26
|
+
return (_jsxs(Samples, { children: [_jsx(Sample, { title: "MediaItemField, FormMediaItemField", children: _jsxs("div", { className: "w-full space-y-4", children: [_jsx(MediaItemField, { label: "Logo", previewUrl: previewUrl, alt: "", onOpenPicker: () => setPreviewUrl(PLACEHOLDER), onRemove: previewUrl ? () => setPreviewUrl(null) : undefined }), _jsx(BoundMedia, {})] }) }), _jsxs(Sample, { title: "MediaPreview, MediaItemPickerDialog", children: [_jsx(MediaPreview, { src: PLACEHOLDER, alt: "", className: "size-24" }), _jsx(MediaPreview, { src: null, alt: "", className: "size-24" }), _jsx(Button, { variant: "outline", onClick: () => setOpen(true), children: "Open media picker" }), _jsx(MediaItemPickerDialog, { open: open, onOpenChange: setOpen, title: "Choose an image", items: TILES, selectedId: selectedId, onSelect: tile => setSelectedId(tile.id), isLoading: false, isFetchingMore: false, hasMore: false, onLoadMore: () => { } })] })] }));
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=MediaShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/MediaShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAwB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAA0B,CAAC;AAE3D,gGAAgG;AAChG,MAAM,WAAW,GAAG,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MAAM,IAAC,KAAK,EAAC,oCAAoC,YAChD,eAAK,SAAS,EAAC,kBAAkB,aAC/B,KAAC,cAAc,IACb,KAAK,EAAC,MAAM,EACZ,UAAU,EAAE,UAAU,EACtB,GAAG,EAAC,EAAE,EACN,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,EAC9C,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,GAC5D,EACF,KAAC,UAAU,KAAG,IACV,GACC,EACT,MAAC,MAAM,IAAC,KAAK,EAAC,qCAAqC,aACjD,KAAC,YAAY,IAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAC,EAAE,EAAC,SAAS,EAAC,SAAS,GAAG,EAC7D,KAAC,YAAY,IAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,EAAE,EAAC,SAAS,EAAC,SAAS,GAAG,EACtD,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,kCAE7C,EACT,KAAC,qBAAqB,IACpB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,OAAO,EACrB,KAAK,EAAC,iBAAiB,EACvB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EACxC,SAAS,EAAE,KAAK,EAChB,cAAc,EAAE,KAAK,EACrB,OAAO,EAAE,KAAK,EACd,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC,GACpB,IACK,IACD,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NotificationAdapter } from '../../logic/index.js';
|
|
2
|
+
/** What the showcase needs of `./notify-sonner` (structural, so the showcase never names the `sonner` types). */
|
|
3
|
+
export interface NotifySonnerModule {
|
|
4
|
+
sonnerNotifications: NotificationAdapter;
|
|
5
|
+
}
|
|
6
|
+
/** Imports `./notify-sonner`; passed by a host that has the `sonner` peer. */
|
|
7
|
+
export type NotifySonnerLoader = () => Promise<NotifySonnerModule>;
|
|
8
|
+
/** The `./notify-sonner` section: loaded through the host's loader, skipped without it or when the import fails. */
|
|
9
|
+
export declare const NotifySonnerShowcase: ({ load }: {
|
|
10
|
+
load?: NotifySonnerLoader;
|
|
11
|
+
}) => import("react").JSX.Element;
|
|
12
|
+
/** The `./next` section: adapters (hooks) only; described, never imported, so the showcase runs without Next.js. */
|
|
13
|
+
export declare const NextShowcase: () => import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=OptionalShowcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/OptionalShowcase.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,iHAAiH;AACjH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;AA2CnE,oHAAoH;AACpH,eAAO,MAAM,oBAAoB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAAE,gCAO3E,CAAC;AAEF,oHAAoH;AACpH,eAAO,MAAM,YAAY,mCAYxB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Suspense, use } from 'react';
|
|
4
|
+
import { Button, Skeleton } from "../../primitives/index.js";
|
|
5
|
+
// One load per optional section for the page's lifetime: `use()` needs the same promise on every render, and a loader
|
|
6
|
+
// passed inline is a new function on every render.
|
|
7
|
+
const loads = new Map();
|
|
8
|
+
const loadOnce = (id, load) => {
|
|
9
|
+
let pending = loads.get(id);
|
|
10
|
+
if (!pending) {
|
|
11
|
+
pending = load().then(module => ({ status: 'ready', module }), (error) => ({ status: 'missing', reason: error instanceof Error ? error.message : String(error) }));
|
|
12
|
+
loads.set(id, pending);
|
|
13
|
+
}
|
|
14
|
+
return pending;
|
|
15
|
+
};
|
|
16
|
+
const Skipped = ({ peer, why }) => (_jsxs("p", { "data-showcase-skipped": peer, className: "rounded-xl border border-dashed px-4 py-3 text-sm text-muted-foreground", children: ["Skipped: ", why, " (optional peer ", _jsx("code", { children: peer }), ")."] }));
|
|
17
|
+
const NotifySonnerLoaded = ({ load }) => {
|
|
18
|
+
const loaded = use(loadOnce('notify-sonner', load));
|
|
19
|
+
if (loaded.status === 'missing')
|
|
20
|
+
return _jsx(Skipped, { peer: "sonner", why: "./notify-sonner could not be loaded" });
|
|
21
|
+
const { sonnerNotifications } = loaded.module;
|
|
22
|
+
return (_jsxs("div", { "data-showcase-loaded": "notify-sonner", className: "flex flex-wrap gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => sonnerNotifications.success('Saved', {}), children: "Success toast" }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => sonnerNotifications.error('Could not save', {}), children: "Error toast" }), _jsx("p", { className: "w-full text-xs text-muted-foreground", children: "Toasts appear in the host's Toaster (mounted once by the host)." })] }));
|
|
23
|
+
};
|
|
24
|
+
/** The `./notify-sonner` section: loaded through the host's loader, skipped without it or when the import fails. */
|
|
25
|
+
export const NotifySonnerShowcase = ({ load }) => {
|
|
26
|
+
if (!load)
|
|
27
|
+
return _jsx(Skipped, { peer: "sonner", why: "no loadNotifySonner passed" });
|
|
28
|
+
return (_jsx(Suspense, { fallback: _jsx(Skeleton, { className: "h-8 w-64" }), children: _jsx(NotifySonnerLoaded, { load: load }) }));
|
|
29
|
+
};
|
|
30
|
+
/** The `./next` section: adapters (hooks) only; described, never imported, so the showcase runs without Next.js. */
|
|
31
|
+
export const NextShowcase = () => (_jsxs("ul", { className: "list-disc space-y-1 pl-5 text-sm text-muted-foreground", children: [_jsxs("li", { children: [_jsx("code", { children: "useNextUrlStateAdapter" }), ", ", _jsx("code", { children: "useNextDrawerUrlAdapter" }), ": URL state for lists and drawers."] }), _jsxs("li", { children: [_jsx("code", { children: "useListViewParam" }), ": the grid / table view per list, remembered."] }), _jsxs("li", { children: [_jsx("code", { children: "queueSearchParamsWrite" }), ": the one URL writer."] })] }));
|
|
32
|
+
//# sourceMappingURL=OptionalShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/OptionalShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAY7D,sHAAsH;AACtH,mDAAmD;AACnD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE1D,MAAM,QAAQ,GAAG,CAAW,EAAU,EAAE,IAA4B,EAA4B,EAAE;IAChG,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAyC,CAAC;IACpE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,IAAI,EAAE,CAAC,IAAI,CACnB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAU,EAChD,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAU,CACrH,CAAC;QACF,KAA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AC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,4BAA4B,GAAG,CAAC;IAC7E,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,YACnD,KAAC,kBAAkB,IAAC,IAAI,EAAE,IAAI,GAAI,GACzB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,oHAAoH;AACpH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAChC,cAAI,SAAS,EAAC,wDAAwD,aACpE,yBACE,oDAAmC,QAAE,qDAAoC,0CACtE,EACL,yBACE,8CAA6B,qDAC1B,EACL,yBACE,oDAAmC,6BAChC,IACF,CACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/PageShowcase.tsx"],"names":[],"mappings":"AA4CA,4BAA4B;AAC5B,eAAO,MAAM,YAAY,mCAmIxB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Calendar, KeyRound, RefreshCw, Users } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { EntityListTable, StatusBadge } from "../../list/index.js";
|
|
6
|
+
import { AddEntityButton, AnchorLink, CardGrid, DefinitionList, DetailHeader, EditableCard, EntityDetailShell, EntityListPage, EntityMetadata, EntityTabs, ExportButton, IconValue, IconValueRow, MoreActionsMenu, PageFrame, PageHeader, PageSections, PageToolbar, SectionHeader, StatusCallout, StatusCalloutAction, } from "../../page/index.js";
|
|
7
|
+
import { Button, Card, CardContent } from "../../primitives/index.js";
|
|
8
|
+
import { SHOWCASE_ROWS, SHOWCASE_STATUS } from "./ListShowcase.js";
|
|
9
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
10
|
+
const CHANGE_HISTORY = { createdTime: '2026-01-10 08:30:00', modifiedTime: '2026-03-04 16:45:00' };
|
|
11
|
+
const TABS = [
|
|
12
|
+
{ id: 'overview', label: 'Overview', href: '#overview' },
|
|
13
|
+
{ id: 'members', label: 'Members', href: '#members', count: 12 },
|
|
14
|
+
{ id: 'settings', label: 'Settings', href: '#settings' },
|
|
15
|
+
];
|
|
16
|
+
const MORE_ACTIONS = [
|
|
17
|
+
{ id: 'recalculate', label: 'Recalculate totals', icon: _jsx(RefreshCw, {}), onSelect: () => { } },
|
|
18
|
+
{ id: 'reset', label: 'Reset everything', onSelect: () => { }, destructive: true, separatorBefore: true },
|
|
19
|
+
];
|
|
20
|
+
/** The `./page` section. */
|
|
21
|
+
export const PageShowcase = () => {
|
|
22
|
+
const [tab, setTab] = useState('people');
|
|
23
|
+
const [routeTab, setRouteTab] = useState('overview');
|
|
24
|
+
return (_jsxs("div", { className: "space-y-8", children: [_jsx(Sample, { title: "PageFrame + PageHeader + PageToolbar", children: _jsx("div", { className: "w-full overflow-hidden rounded-2xl border", children: _jsx(PageFrame, { title: "Projects", description: "Everything the team is working on.", minHeightClassName: "min-h-0", actions: _jsx(PageToolbar, { exportAction: _jsx(ExportButton, { onExport: () => { } }), moreActions: MORE_ACTIONS, primaryAction: _jsx(AddEntityButton, { entity: "Project", onClick: () => { } }), children: _jsx(Button, { variant: "outline", children: "Import" }) }), children: _jsx("p", { className: "text-sm text-muted-foreground", children: "Page content." }) }) }) }), _jsx(Sample, { title: "EntityListPage", children: _jsx("div", { className: "h-96 w-full overflow-hidden rounded-2xl border", children: _jsx(EntityListPage, { title: "Items", headerActions: _jsx(AddEntityButton, { label: "New item", onClick: () => { } }), children: _jsx(EntityListTable, { columns: [
|
|
25
|
+
{ id: 'name', header: 'Name', cell: row => row.name },
|
|
26
|
+
{ id: 'status', header: 'Status', cell: row => _jsx(StatusBadge, { value: row.status, map: SHOWCASE_STATUS }) },
|
|
27
|
+
], items: SHOWCASE_ROWS.slice(0, 3), getRowKey: row => String(row.id) }) }) }) }), _jsx(Sample, { title: "EntityDetailShell", children: _jsx("div", { className: "w-full overflow-hidden rounded-2xl border p-4", children: _jsx(EntityDetailShell, { title: "Sample project", fallbackTitle: "Project #42", description: "Workspace North", back: { href: '#projects', label: 'Back to projects' }, linkComponent: AnchorLink, metadata: { id: 42, changeHistory: CHANGE_HISTORY }, tabs: TABS, currentPath: "#overview", tabsLabel: "Project sections", actions: _jsx(PageToolbar, { moreActions: MORE_ACTIONS }), children: _jsx("p", { className: "text-sm text-muted-foreground", children: "Tab content." }) }) }) }), _jsxs(Samples, { children: [_jsxs(Sample, { title: "PageHeader, DetailHeader", children: [_jsx(PageHeader, { title: _jsxs(_Fragment, { children: ["Item ", _jsx("em", { children: "Types" })] }), description: "A two-tone title." }), _jsx(DetailHeader, { title: "Detail title", description: "Detail description" }), _jsx(DetailHeader, { title: "Nested detail", nested: true })] }), _jsxs(Sample, { title: "EntityMetadata", children: [_jsx(EntityMetadata, { id: 42, changeHistory: CHANGE_HISTORY }), _jsx(EntityMetadata, { id: 42, changeHistory: CHANGE_HISTORY, variant: "inline" }), _jsx(EntityMetadata, { id: 42, changeHistory: CHANGE_HISTORY, variant: "stacked" })] }), _jsxs(Sample, { title: "EntityTabs, SectionHeader", children: [_jsx(EntityTabs, { "aria-label": "Route tabs", tabs: TABS, activeId: routeTab, onSelect: setRouteTab }), _jsx(EntityTabs, { "aria-label": "Pill tabs", tabs: TABS, activeId: routeTab, onSelect: setRouteTab, variant: "pill" }), _jsx(SectionHeader, { title: "Members", description: "People working on this project", tabs: [
|
|
28
|
+
{ id: 'people', label: 'People' },
|
|
29
|
+
{ id: 'teams', label: 'Teams' },
|
|
30
|
+
], activeTab: tab, onTabSelect: setTab, actions: _jsx(ExportButton, { onExport: () => { } }) })] }), _jsxs(Sample, { title: "StatusCallout", children: [_jsx(StatusCallout, { tone: "info", title: "Information", description: "Something worth knowing." }), _jsx(StatusCallout, { tone: "warning", title: "Needs attention", description: "Two items wait for a review.", actions: _jsx(StatusCalloutAction, { children: "Review" }) }), _jsx(StatusCallout, { tone: "destructive", title: "Failed", size: "compact" }), _jsx(StatusCallout, { tone: "success", title: "Done", size: "compact" })] }), _jsx(Sample, { title: "DefinitionList", children: _jsx(Card, { className: "w-full", children: _jsx(CardContent, { children: _jsx(DefinitionList, { columns: 3, items: [
|
|
31
|
+
{ label: 'Access code', value: 'NORTH-42' },
|
|
32
|
+
{ label: 'Owner', value: null },
|
|
33
|
+
{ label: 'Status', value: _jsx(StatusBadge, { value: "ACTIVE", map: SHOWCASE_STATUS }), hint: 'Since March' },
|
|
34
|
+
{ label: 'Description', value: 'A longer description spanning the whole row.', wide: true },
|
|
35
|
+
] }) }) }) }), _jsx(Sample, { title: "PageSections, CardGrid, EditableCard, IconValue, MoreActionsMenu", children: _jsx(PageSections, { className: "w-full", children: _jsxs("section", { children: [_jsx(SectionHeader, { title: _jsxs(_Fragment, { children: ["General ", _jsx("em", { children: "settings" })] }) }), _jsxs(CardGrid, { children: [_jsx(EditableCard, { title: "Access", onEdit: () => { }, editLabel: "Edit access", children: _jsxs(IconValueRow, { children: [_jsx(IconValue, { icon: _jsx(KeyRound, {}), children: "NORTH-42" }), _jsx(IconValue, { icon: _jsx(Calendar, {}), children: "4 Mar 2026" }), _jsx(IconValue, { icon: _jsx(Users, {}), children: "12 members" })] }) }), _jsx(EditableCard, { title: "Danger zone", actions: _jsx(MoreActionsMenu, { items: MORE_ACTIONS }), children: _jsx("p", { className: "text-sm text-muted-foreground", children: "Rare actions live in the menu." }) })] })] }) }) })] })] }));
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=PageShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/PageShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,K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,SAAS,IAAC,IAAI,EAAE,KAAC,KAAK,KAAG,2BAAwB,IACrC,GACF,EACf,KAAC,YAAY,IAAC,KAAK,EAAC,aAAa,EAAC,OAAO,EAAE,KAAC,eAAe,IAAC,KAAK,EAAE,YAAY,GAAI,YACjF,YAAG,SAAS,EAAC,+BAA+B,+CAAmC,GAClE,IACN,IACH,GACG,GACR,IACD,IACN,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** A labelled sample inside a section. */
|
|
3
|
+
export declare const Sample: ({ title, children }: {
|
|
4
|
+
title: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
|
+
/** A grid of samples. */
|
|
8
|
+
export declare const Samples: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => import("react").JSX.Element;
|
|
11
|
+
/** The `./primitives` section. */
|
|
12
|
+
export declare const PrimitivesShowcase: () => import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=PrimitivesShowcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimitivesShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/PrimitivesShowcase.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAiGjD,0CAA0C;AAC1C,eAAO,MAAM,MAAM,GAAI,qBAAqB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,gCAKjF,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,OAAO,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,gCAAgE,CAAC;AAiE9H,kCAAkC;AAClC,eAAO,MAAM,kBAAkB,mCAyP9B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Bell, ChevronsUpDown, LayoutGrid, List, Map as MapIcon, Settings } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Alert, AlertDescription, AlertTitle, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Label, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Tooltip, TooltipContent, TooltipTrigger, } from "../../primitives/index.js";
|
|
6
|
+
/** A labelled sample inside a section. */
|
|
7
|
+
export const Sample = ({ title, children }) => (_jsxs("div", { className: "space-y-2", children: [_jsx("h3", { className: "text-xs font-bold tracking-[0.08em] text-muted-foreground uppercase", children: title }), _jsx("div", { className: "flex flex-wrap items-start gap-3", children: children })] }));
|
|
8
|
+
/** A grid of samples. */
|
|
9
|
+
export const Samples = ({ children }) => _jsx("div", { className: "grid gap-8 lg:grid-cols-2", children: children });
|
|
10
|
+
const SegmentedSamples = () => {
|
|
11
|
+
const [period, setPeriod] = useState('week');
|
|
12
|
+
const [view, setView] = useState('grid');
|
|
13
|
+
const [scope, setScope] = useState('mine');
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { "aria-label": "Period", value: period, onValueChange: setPeriod, options: [
|
|
15
|
+
{ value: 'day', label: 'Day' },
|
|
16
|
+
{ value: 'week', label: 'Week', badge: 3 },
|
|
17
|
+
{ value: 'month', label: 'Month', description: 'Calendar month' },
|
|
18
|
+
{ value: 'year', label: 'Year', disabled: true, disabledReason: 'Not enough data yet' },
|
|
19
|
+
] }), _jsx(SegmentedControl, { "aria-label": "View", iconOnly: true, height: 36, selection: "primary", value: view, onValueChange: setView, options: [
|
|
20
|
+
{ value: 'grid', label: 'Grid view', icon: _jsx(LayoutGrid, {}) },
|
|
21
|
+
{ value: 'table', label: 'Table view', icon: _jsx(List, {}) },
|
|
22
|
+
{ value: 'map', label: 'Map view', icon: _jsx(MapIcon, {}) },
|
|
23
|
+
] }), _jsx("div", { className: "w-full max-w-sm", children: _jsx(SegmentedControl, { "aria-label": "Scope", fullWidth: true, height: 40, activation: "manual", value: scope, onValueChange: setScope, options: [
|
|
24
|
+
{ value: 'mine', label: 'Mine' },
|
|
25
|
+
{ value: 'team', label: 'Team' },
|
|
26
|
+
{ value: 'all', label: 'All' },
|
|
27
|
+
] }) }), _jsx("div", { className: "rounded-2xl bg-brand p-3", children: _jsx(SegmentedControl, { "aria-label": "Scope on brand", tone: "onBrand", height: 48, value: scope, onValueChange: setScope, options: [
|
|
28
|
+
{ value: 'mine', label: 'Mine' },
|
|
29
|
+
{ value: 'team', label: 'Team' },
|
|
30
|
+
{ value: 'all', label: 'All' },
|
|
31
|
+
] }) })] }));
|
|
32
|
+
};
|
|
33
|
+
/** The `./primitives` section. */
|
|
34
|
+
export const PrimitivesShowcase = () => {
|
|
35
|
+
const [checked, setChecked] = useState(true);
|
|
36
|
+
const [notifications, setNotifications] = useState(true);
|
|
37
|
+
const [commandOpen, setCommandOpen] = useState(false);
|
|
38
|
+
return (_jsxs(Samples, { children: [_jsxs(Sample, { title: "Button", children: [_jsx(Button, { children: "Primary" }), _jsx(Button, { variant: "outline", children: "Outline" }), _jsx(Button, { variant: "ghost", children: "Ghost" }), _jsx(Button, { variant: "destructive", children: "Destructive" }), _jsx(Button, { variant: "link", children: "Link" }), _jsx(Button, { variant: "field", children: "Field" }), _jsx(Button, { size: "sm", rounded: "full", children: "Small pill" }), _jsx(Button, { size: "icon", variant: "outline", "aria-label": "Settings", children: _jsx(Settings, {}) }), _jsx(Button, { disabled: true, children: "Disabled" })] }), _jsx(Sample, { title: "SegmentedControl", children: _jsx(SegmentedSamples, {}) }), _jsxs(Sample, { title: "Badge", children: [_jsx(Badge, { children: "Default" }), _jsx(Badge, { variant: "secondary", children: "Secondary" }), _jsx(Badge, { variant: "outline", children: "Outline" }), _jsx(Badge, { variant: "destructive", children: "Destructive" })] }), _jsxs(Sample, { title: "Alert", children: [_jsxs(Alert, { children: [_jsx(Bell, {}), _jsx(AlertTitle, { children: "Heads up" }), _jsx(AlertDescription, { children: "Something worth knowing." })] }), _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertTitle, { children: "Failed" }), _jsx(AlertDescription, { children: "Something went wrong." })] })] }), _jsx(Sample, { title: "Card", children: _jsxs(Card, { className: "w-full max-w-sm", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Card title" }), _jsx(CardDescription, { children: "Card description" }), _jsx(CardAction, { children: _jsx(Button, { size: "sm", variant: "outline", children: "Action" }) })] }), _jsx(CardContent, { children: "Card content" }), _jsx(CardFooter, { children: "Card footer" })] }) }), _jsx(Sample, { title: "Fields", children: _jsxs("div", { className: "grid w-full max-w-sm gap-3", children: [_jsx(Label, { htmlFor: "showcase-input", children: "Label" }), _jsx(Input, { id: "showcase-input", placeholder: "Input" }), _jsx(Input, { "aria-label": "Invalid input", "aria-invalid": true, defaultValue: "Invalid" }), _jsx(Textarea, { "aria-label": "Textarea", placeholder: "Textarea" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: "showcase-checkbox", checked: checked, onCheckedChange: value => setChecked(value === true) }), _jsx(Label, { htmlFor: "showcase-checkbox", children: "Checkbox" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { id: "showcase-switch", checked: notifications, onCheckedChange: setNotifications }), _jsx(Label, { htmlFor: "showcase-switch", children: "Switch" })] }), _jsxs(Select, { defaultValue: "b", children: [_jsx(SelectTrigger, { "aria-label": "Select", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsxs(SelectGroup, { children: [_jsx(SelectLabel, { children: "Group" }), _jsx(SelectItem, { value: "a", children: "Alpha" }), _jsx(SelectItem, { value: "b", children: "Beta" })] }), _jsx(SelectSeparator, {}), _jsx(SelectItem, { value: "c", children: "Gamma" })] })] })] }) }), _jsxs(Sample, { title: "Overlays", children: [_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Dialog" }) }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Dialog title" }), _jsx(DialogDescription, { children: "Dialog description." })] }), _jsx(DialogFooter, { children: _jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Close" }) }) })] })] }), _jsxs(Sheet, { children: [_jsx(SheetTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Sheet" }) }), _jsxs(SheetContent, { children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: "Sheet title" }), _jsx(SheetDescription, { children: "Sheet description." })] }), _jsx(SheetFooter, { children: _jsx(SheetClose, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Close" }) }) })] })] }), _jsxs(Popover, { children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx("span", { className: "inline-flex", children: _jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Popover" }) }) }) }), _jsx(PopoverContent, { children: _jsxs(PopoverHeader, { children: [_jsx(PopoverTitle, { children: "Popover title" }), _jsx(PopoverDescription, { children: "Popover description." })] }) })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Menu label" }), _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuItem, { children: "Item" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "Checked item" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: "More" }), _jsx(DropdownMenuSubContent, { children: _jsx(DropdownMenuItem, { children: "Sub item" }) })] })] })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Tooltip" }) }), _jsx(TooltipContent, { children: "Tooltip text" })] }), _jsx(Button, { variant: "outline", onClick: () => setCommandOpen(true), children: "Command dialog" }), _jsxs(CommandDialog, { open: commandOpen, onOpenChange: setCommandOpen, children: [_jsx(CommandInput, { placeholder: "Search\u2026" }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "Nothing found." }), _jsx(CommandGroup, { heading: "Group", children: _jsx(CommandItem, { children: "Alpha" }) })] })] })] }), _jsx(Sample, { title: "Command", children: _jsxs(Command, { className: "w-full max-w-sm rounded-xl border", children: [_jsx(CommandInput, { placeholder: "Search\u2026" }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "Nothing found." }), _jsxs(CommandGroup, { heading: "Suggestions", children: [_jsxs(CommandItem, { children: ["Alpha ", _jsx(CommandShortcut, { children: "\u2318A" })] }), _jsx(CommandItem, { children: "Beta" })] }), _jsx(CommandSeparator, {}), _jsx(CommandGroup, { heading: "Other", children: _jsx(CommandItem, { children: "Gamma" }) })] })] }) }), _jsxs(Sample, { title: "Breadcrumb, separator, skeleton, collapsible", children: [_jsx(Breadcrumb, { children: _jsxs(BreadcrumbList, { children: [_jsx(BreadcrumbItem, { children: _jsx(BreadcrumbLink, { href: "#showcase", children: "Home" }) }), _jsx(BreadcrumbSeparator, {}), _jsx(BreadcrumbItem, { children: _jsx(BreadcrumbEllipsis, {}) }), _jsx(BreadcrumbSeparator, {}), _jsx(BreadcrumbItem, { children: _jsx(BreadcrumbPage, { children: "Current" }) })] }) }), _jsx(Separator, {}), _jsxs("div", { className: "flex w-full items-center gap-3", children: [_jsx(Skeleton, { className: "size-10 rounded-full" }), _jsx(Skeleton, { className: "h-4 flex-1" })] }), _jsxs(Collapsible, { className: "w-full", children: [_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", children: ["Collapsible ", _jsx(ChevronsUpDown, {})] }) }), _jsx(CollapsibleContent, { className: "pt-2 text-sm", children: "Hidden content." })] })] }), _jsx(Sample, { title: "Table", children: _jsxs(Table, { children: [_jsx(TableCaption, { children: "Table caption" }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Name" }), _jsx(TableHead, { className: "text-right", children: "Amount" })] }) }), _jsxs(TableBody, { children: [_jsxs(TableRow, { children: [_jsx(TableCell, { children: "Alpha" }), _jsx(TableCell, { className: "text-right", children: "12" })] }), _jsxs(TableRow, { "data-state": "selected", children: [_jsx(TableCell, { children: "Beta (selected)" }), _jsx(TableCell, { className: "text-right", children: "30" })] })] }), _jsx(TableFooter, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Total" }), _jsx(TableCell, { className: "text-right", children: "42" })] }) })] }) })] }));
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=PrimitivesShowcase.js.map
|