@xds/core 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/breadcrumb.d.ts +39 -0
  2. package/dist/breadcrumb.js +7 -0
  3. package/dist/checkbox.d.ts +16 -2
  4. package/dist/checkbox.js +3 -1
  5. package/dist/combobox.d.ts +59 -0
  6. package/dist/combobox.js +40 -0
  7. package/dist/index.d.ts +16 -7
  8. package/dist/index.js +15 -6
  9. package/dist/labels.d.ts +12 -5
  10. package/dist/labels.js +12 -5
  11. package/dist/link.d.ts +49 -0
  12. package/dist/link.js +12 -0
  13. package/dist/pagination.d.ts +51 -0
  14. package/dist/pagination.js +25 -0
  15. package/dist/popover.d.ts +33 -0
  16. package/dist/popover.js +8 -0
  17. package/dist/preview/components.d.ts +36 -0
  18. package/dist/preview/components.js +1 -0
  19. package/dist/preview/design.d.ts +22 -3
  20. package/dist/preview/design.js +65 -34
  21. package/dist/preview/fixtures.d.ts +0 -76
  22. package/dist/preview/fixtures.js +0 -126
  23. package/dist/preview/kit.d.ts +48 -32
  24. package/dist/preview/kit.js +3 -0
  25. package/dist/preview/page.d.ts +1 -1
  26. package/dist/preview/page.js +1 -0
  27. package/dist/preview/sections/accordion.d.ts +1 -0
  28. package/dist/preview/sections/accordion.js +40 -0
  29. package/dist/preview/sections/badges.d.ts +1 -0
  30. package/dist/preview/sections/badges.js +13 -0
  31. package/dist/preview/sections/banners.d.ts +1 -0
  32. package/dist/preview/sections/banners.js +13 -0
  33. package/dist/preview/sections/buttons.d.ts +2 -0
  34. package/dist/preview/sections/buttons.js +30 -0
  35. package/dist/preview/sections/card.d.ts +1 -0
  36. package/dist/preview/sections/card.js +33 -0
  37. package/dist/preview/sections/chips.d.ts +1 -0
  38. package/dist/preview/sections/chips.js +23 -0
  39. package/dist/preview/sections/controls.d.ts +1 -0
  40. package/dist/preview/sections/controls.js +143 -0
  41. package/dist/preview/sections/dialog.d.ts +1 -0
  42. package/dist/preview/sections/dialog.js +25 -0
  43. package/dist/preview/sections/empty-state.d.ts +1 -0
  44. package/dist/preview/sections/empty-state.js +13 -0
  45. package/dist/preview/sections/links.d.ts +1 -0
  46. package/dist/preview/sections/links.js +8 -0
  47. package/dist/preview/sections/list.d.ts +1 -0
  48. package/dist/preview/sections/list.js +119 -0
  49. package/dist/preview/sections/media.d.ts +1 -0
  50. package/dist/preview/sections/media.js +90 -0
  51. package/dist/preview/sections/menu.d.ts +1 -0
  52. package/dist/preview/sections/menu.js +46 -0
  53. package/dist/preview/sections/navigation.d.ts +1 -0
  54. package/dist/preview/sections/navigation.js +20 -0
  55. package/dist/preview/sections/selection.d.ts +1 -0
  56. package/dist/preview/sections/selection.js +33 -0
  57. package/dist/preview/sections/sidebar.d.ts +1 -0
  58. package/dist/preview/sections/sidebar.js +45 -0
  59. package/dist/preview/sections/skeleton.d.ts +1 -0
  60. package/dist/preview/sections/skeleton.js +5 -0
  61. package/dist/preview/sections/tabs.d.ts +1 -0
  62. package/dist/preview/sections/tabs.js +24 -0
  63. package/dist/preview/sections/text-fields.d.ts +1 -0
  64. package/dist/preview/sections/text-fields.js +75 -0
  65. package/dist/preview/sections/toast.d.ts +2 -0
  66. package/dist/preview/sections/toast.js +28 -0
  67. package/dist/preview/specimens.js +1 -1
  68. package/dist/progress-bar.d.ts +7 -4
  69. package/dist/progress-bar.js +2 -2
  70. package/dist/rows.d.ts +23 -0
  71. package/dist/rows.js +67 -0
  72. package/dist/segmented-control.d.ts +1 -1
  73. package/dist/segmented-control.js +1 -1
  74. package/dist/select.d.ts +22 -0
  75. package/dist/select.js +7 -0
  76. package/dist/switch.d.ts +1 -1
  77. package/dist/switch.js +2 -1
  78. package/dist/table.d.ts +62 -0
  79. package/dist/table.js +25 -0
  80. package/dist/theme-scope.d.ts +6 -4
  81. package/dist/theme-scope.js +21 -15
  82. package/dist/time-picker.d.ts +57 -0
  83. package/dist/time-picker.js +53 -0
  84. package/dist/toast-queue.d.ts +40 -0
  85. package/dist/toast-queue.js +17 -0
  86. package/dist/toast.d.ts +1 -1
  87. package/dist/toast.js +1 -1
  88. package/package.json +2 -2
  89. package/dist/preview/sections.d.ts +0 -20
  90. package/dist/preview/sections.js +0 -517
@@ -3,11 +3,13 @@ import type { AvatarStackBaseProps } from "../avatar-stack.ts";
3
3
  import type { AvatarBaseProps } from "../avatar.ts";
4
4
  import type { BadgeBaseProps } from "../badge.ts";
5
5
  import type { BannerBaseProps } from "../banner.ts";
6
+ import type { BreadcrumbBaseProps } from "../breadcrumb.ts";
6
7
  import type { ButtonBaseProps, IconButtonBaseProps } from "../button.ts";
7
8
  import type { CardBaseProps } from "../card.ts";
8
9
  import type { CheckboxBaseProps } from "../checkbox.ts";
9
10
  import type { ChipBarBaseProps } from "../chip-bar.ts";
10
11
  import type { ChipBaseProps } from "../chip.ts";
12
+ import type { ComboboxBaseProps } from "../combobox.ts";
11
13
  import type { CountBadgeBaseProps } from "../count-badge.ts";
12
14
  import type { DatePickerBaseProps, IsoDate } from "../date-picker.ts";
13
15
  import type { DateRange, DateRangePickerBaseProps } from "../date-range-picker.ts";
@@ -16,9 +18,12 @@ import type { DialogBaseProps } from "../dialog.ts";
16
18
  import type { EmptyStateBaseProps } from "../empty-state.ts";
17
19
  import type { IconBaseProps } from "../icon.ts";
18
20
  import type { ComponentLabels } from "../labels.ts";
21
+ import type { LinkBaseProps } from "../link.ts";
19
22
  import type { ListRowBaseProps } from "../list-row.ts";
20
23
  import type { MediaCardBaseProps } from "../media-card.ts";
21
24
  import type { MenuBaseProps } from "../menu.ts";
25
+ import type { PaginationBaseProps } from "../pagination.ts";
26
+ import type { PopoverBaseProps } from "../popover.ts";
22
27
  import type { ProgressBarBaseProps } from "../progress-bar.ts";
23
28
  import type { RadioGroupBaseProps } from "../radio-group.ts";
24
29
  import type { RootAttributes } from "../root.ts";
@@ -30,10 +35,13 @@ import type { SkeletonBaseProps } from "../skeleton.ts";
30
35
  import type { SliderBaseProps } from "../slider.ts";
31
36
  import type { SpinnerBaseProps } from "../spinner.ts";
32
37
  import type { SwitchBaseProps } from "../switch.ts";
38
+ import type { TableBaseProps, TableSort } from "../table.ts";
33
39
  import type { TabsBaseProps } from "../tabs.ts";
34
40
  import type { SearchFieldBaseProps, TextFieldBaseProps } from "../text-field.ts";
35
41
  import type { TextBaseProps } from "../text.ts";
36
42
  import type { ThumbnailBaseProps } from "../thumbnail.ts";
43
+ import type { IsoTime, TimePickerBaseProps } from "../time-picker.ts";
44
+ import type { QueuedToast, ToastQueueBaseProps } from "../toast-queue.ts";
37
45
  import type { ToastBaseProps } from "../toast.ts";
38
46
  import type { TooltipBaseProps } from "../tooltip.ts";
39
47
  /** A small action drawn as a link or a button, such as a banner's "Try again". */
@@ -64,6 +72,7 @@ interface Own<N> {
64
72
  onDismiss?: () => void;
65
73
  children: N;
66
74
  };
75
+ Breadcrumb: BreadcrumbBaseProps;
67
76
  Button: ButtonBaseProps & Focus & {
68
77
  onPress?: () => void;
69
78
  children?: N;
@@ -84,6 +93,9 @@ interface Own<N> {
84
93
  ChipBar: ChipBarBaseProps & {
85
94
  children: N;
86
95
  };
96
+ Combobox: ComboboxBaseProps & {
97
+ onChange?: (value: string) => void;
98
+ };
87
99
  CountBadge: CountBadgeBaseProps & {
88
100
  children?: N;
89
101
  };
@@ -108,6 +120,10 @@ interface Own<N> {
108
120
  IconButton: IconButtonBaseProps & Focus & {
109
121
  onPress?: () => void;
110
122
  };
123
+ Link: LinkBaseProps & Focus & {
124
+ onPress?: () => void;
125
+ children: N;
126
+ };
111
127
  ListRow: ListRowBaseProps & {
112
128
  leading?: N;
113
129
  trailing?: N;
@@ -121,6 +137,14 @@ interface Own<N> {
121
137
  Menu: MenuBaseProps & {
122
138
  trigger: N;
123
139
  };
140
+ Pagination: PaginationBaseProps & {
141
+ onChange?: (value: number) => void;
142
+ };
143
+ Popover: PopoverBaseProps & {
144
+ trigger: N;
145
+ onOpenChange?: (open: boolean) => void;
146
+ children?: N;
147
+ };
124
148
  ProgressBar: ProgressBarBaseProps;
125
149
  RadioGroup: RadioGroupBaseProps & {
126
150
  onChange?: (value: string) => void;
@@ -137,6 +161,7 @@ interface Own<N> {
137
161
  };
138
162
  Select: SelectBaseProps & {
139
163
  onChange?: (value: string) => void;
164
+ onValuesChange?: (values: string[]) => void;
140
165
  };
141
166
  Sidebar: SidebarBaseProps & {
142
167
  onChange: (value: string) => void;
@@ -151,6 +176,9 @@ interface Own<N> {
151
176
  Switch: SwitchBaseProps & Focus & {
152
177
  onChange?: (checked: boolean) => void;
153
178
  };
179
+ Table: TableBaseProps & {
180
+ onSortChange?: (sort: TableSort) => void;
181
+ };
154
182
  Tabs: TabsBaseProps<string> & {
155
183
  onChange?: (value: string) => void;
156
184
  };
@@ -165,9 +193,16 @@ interface Own<N> {
165
193
  trailing?: N;
166
194
  };
167
195
  Thumbnail: ThumbnailBaseProps;
196
+ TimePicker: TimePickerBaseProps & {
197
+ onChange?: (value: IsoTime) => void;
198
+ };
168
199
  Toast: ToastBaseProps & {
169
200
  onClose: () => void;
170
201
  };
202
+ ToastQueue: Omit<ToastQueueBaseProps, "toasts"> & {
203
+ toasts: readonly Omit<QueuedToast, "action">[];
204
+ onClose: (id: QueuedToast["id"]) => void;
205
+ };
171
206
  Tooltip: TooltipBaseProps & {
172
207
  children: N;
173
208
  };
@@ -223,6 +258,7 @@ export declare const NODE_PROPS: {
223
258
  readonly ListRow: readonly ["leading", "trailing"];
224
259
  readonly MediaCard: readonly ["leading", "action"];
225
260
  readonly Menu: readonly ["trigger"];
261
+ readonly Popover: readonly ["trigger"];
226
262
  readonly Sidebar: readonly ["header", "footer"];
227
263
  readonly TextField: readonly ["leading", "trailing"];
228
264
  };
@@ -5,6 +5,7 @@ export const NODE_PROPS = {
5
5
  ListRow: ["leading", "trailing"],
6
6
  MediaCard: ["leading", "action"],
7
7
  Menu: ["trigger"],
8
+ Popover: ["trigger"],
8
9
  Sidebar: ["header", "footer"],
9
10
  TextField: ["leading", "trailing"],
10
11
  };
@@ -1,10 +1,29 @@
1
1
  import { type DesignState } from "./kit.ts";
2
2
  import type { Child, Screen } from "./model.ts";
3
3
  import { type Overlay } from "./page.ts";
4
- import { accordion, badges, banners, buttons, card, chips, controls, dialog, emptyState, list, media, menu, selection, sidebar, skeleton, tabs, textFields, toast } from "./sections.ts";
5
- import { colorSpecimens, iconSpecimens, spaceSpecimens, typographySpecimens } from "./specimens.ts";
4
+ import { accordion } from "./sections/accordion.ts";
5
+ import { badges } from "./sections/badges.ts";
6
+ import { banners } from "./sections/banners.ts";
7
+ import { buttons } from "./sections/buttons.ts";
8
+ import { card } from "./sections/card.ts";
9
+ import { chips } from "./sections/chips.ts";
10
+ import { controls } from "./sections/controls.ts";
11
+ import { dialog } from "./sections/dialog.ts";
12
+ import { emptyState } from "./sections/empty-state.ts";
13
+ import { list } from "./sections/list.ts";
14
+ import { media } from "./sections/media.ts";
15
+ import { menu } from "./sections/menu.ts";
16
+ import { navigation } from "./sections/navigation.ts";
17
+ import { selection } from "./sections/selection.ts";
18
+ import { sidebar } from "./sections/sidebar.ts";
19
+ import { skeleton } from "./sections/skeleton.ts";
20
+ import { tabs } from "./sections/tabs.ts";
21
+ import { textFields } from "./sections/text-fields.ts";
22
+ import { toast } from "./sections/toast.ts";
23
+ import { colorSpecimens, iconSpecimens, spaceSpecimens } from "./specimens.ts";
6
24
  type Content = (open: Overlay | undefined) => readonly Child<DesignState>[];
7
- declare const sections: readonly [readonly ["Colors", typeof colorSpecimens], readonly ["Typography", typeof typographySpecimens], readonly ["Space, radius, size", typeof spaceSpecimens], readonly ["Icons", typeof iconSpecimens], readonly ["Buttons", typeof buttons], readonly ["Text fields", typeof textFields], readonly ["Selection", typeof selection], readonly ["Controls", typeof controls], readonly ["Chips", typeof chips], readonly ["Tabs", typeof tabs], readonly ["Badges", typeof badges], readonly ["Banners", typeof banners], readonly ["Card", typeof card], readonly ["Media", typeof media], readonly ["List", typeof list], readonly ["Sidebar", typeof sidebar], readonly ["Accordion", typeof accordion], readonly ["Menu", typeof menu], readonly ["Dialog", typeof dialog], readonly ["Toast", typeof toast], readonly ["Skeleton", typeof skeleton], readonly ["Empty state", typeof emptyState]];
25
+ declare const typography: () => import("./model.ts").PreviewNode<DesignState>[];
26
+ declare const sections: readonly [readonly ["Colors", typeof colorSpecimens], readonly ["Typography", typeof typography], readonly ["Space, radius, size", typeof spaceSpecimens], readonly ["Icons", typeof iconSpecimens], readonly ["Buttons", typeof buttons], readonly ["Text fields", typeof textFields], readonly ["Selection", typeof selection], readonly ["Controls", typeof controls], readonly ["Chips", typeof chips], readonly ["Tabs", typeof tabs], readonly ["Navigation", typeof navigation], readonly ["Badges", typeof badges], readonly ["Banners", typeof banners], readonly ["Card", typeof card], readonly ["Media", typeof media], readonly ["List", typeof list], readonly ["Sidebar", typeof sidebar], readonly ["Accordion", typeof accordion], readonly ["Menu", typeof menu], readonly ["Dialog", typeof dialog], readonly ["Toast", typeof toast], readonly ["Skeleton", typeof skeleton], readonly ["Empty state", typeof emptyState]];
8
27
  /** The title of a section, which `?open=` names in page.ts. */
9
28
  export type SectionTitle = (typeof sections)[number][0];
10
29
  /** The sections in order, by title. Each title is also the section's anchor: `#text-fields`. */
@@ -1,10 +1,30 @@
1
1
  import { el, screen, ui } from "./kit.js";
2
2
  import { anchor, openOnLoad, OVERLAYS, overlayParam, scrollToHash } from "./page.js";
3
- import { accordion, badges, banners, buttons, card, chips, controls, dialog, emptyState, list, media, menu, selection, sidebar, skeleton, tabs, textFields, toast, } from "./sections.js";
3
+ import { accordion } from "./sections/accordion.js";
4
+ import { badges } from "./sections/badges.js";
5
+ import { banners } from "./sections/banners.js";
6
+ import { buttons } from "./sections/buttons.js";
7
+ import { card } from "./sections/card.js";
8
+ import { chips } from "./sections/chips.js";
9
+ import { controls } from "./sections/controls.js";
10
+ import { dialog } from "./sections/dialog.js";
11
+ import { emptyState } from "./sections/empty-state.js";
12
+ import { links } from "./sections/links.js";
13
+ import { list } from "./sections/list.js";
14
+ import { media } from "./sections/media.js";
15
+ import { menu } from "./sections/menu.js";
16
+ import { navigation } from "./sections/navigation.js";
17
+ import { selection } from "./sections/selection.js";
18
+ import { sidebar } from "./sections/sidebar.js";
19
+ import { skeleton } from "./sections/skeleton.js";
20
+ import { tabs } from "./sections/tabs.js";
21
+ import { textFields } from "./sections/text-fields.js";
22
+ import { toast } from "./sections/toast.js";
4
23
  import { colorSpecimens, iconSpecimens, spaceSpecimens, typographySpecimens } from "./specimens.js";
24
+ const typography = () => [...typographySpecimens(), ...links()];
5
25
  const sections = [
6
26
  ["Colors", colorSpecimens],
7
- ["Typography", typographySpecimens],
27
+ ["Typography", typography],
8
28
  ["Space, radius, size", spaceSpecimens],
9
29
  ["Icons", iconSpecimens],
10
30
  ["Buttons", buttons],
@@ -13,6 +33,7 @@ const sections = [
13
33
  ["Controls", controls],
14
34
  ["Chips", chips],
15
35
  ["Tabs", tabs],
36
+ ["Navigation", navigation],
16
37
  ["Badges", badges],
17
38
  ["Banners", banners],
18
39
  ["Card", card],
@@ -33,47 +54,57 @@ export function designPreview(options = {}) {
33
54
  const first = SECTIONS.findIndex(([title]) => title === (open && OVERLAYS[open].section));
34
55
  const shown = SECTIONS.slice(Math.max(first, 0));
35
56
  const state = {
36
- theme: document.documentElement.dataset.theme,
37
- liked: true,
38
- saved: true,
39
- pinned: true,
40
- email: "",
41
- query: "",
42
- secret: "correct horse",
43
- revealed: false,
44
- notes: "Ship the weekly report on Monday.\nAsk Grace about the numbers for March.\nBook the room.\nSend the agenda.",
45
- bio: "Writes programs for machines that do not exist yet.",
46
- search: "",
47
- submitted: "",
48
- notifications: true,
49
57
  agreed: true,
50
- view: "week",
51
- delivery: "standard",
52
- shirt: undefined,
53
- plan: "team",
58
+ archived: 0,
59
+ asking: false,
60
+ bio: "Writes programs for machines that do not exist yet.",
61
+ chosen: "Nothing chosen yet.",
62
+ city: "lisbon",
63
+ confirming: open === "dialog",
64
+ copyName: "Weekly report, my copy",
54
65
  country: undefined,
55
- timeZone: undefined,
56
- volume: 60,
57
- fontSize: 16,
66
+ deleted: open === "toast",
67
+ delivery: "standard",
68
+ density: "comfortable",
69
+ dismissed: false,
58
70
  dueDate: "2026-03-10",
59
- startDate: undefined,
60
- stay: { start: "2026-03-10", end: "2026-03-14" },
61
- leave: undefined,
71
+ email: "",
72
+ fileSort: { column: "modified", direction: "descending" },
62
73
  filters: ["open", "review"],
74
+ fontSize: 16,
75
+ leave: undefined,
76
+ liked: true,
77
+ linked: "Nothing followed yet.",
78
+ meetingTime: undefined,
79
+ notes: "Ship the weekly report on Monday.\nAsk Grace about the numbers for March.\nBook the room.\nSend the agenda.",
80
+ notifications: true,
81
+ opened: "Nothing opened yet.",
63
82
  page: "overview",
64
- dismissed: false,
65
83
  picked: true,
66
- opened: "Nothing opened yet.",
84
+ pinned: true,
67
85
  place: "messages",
68
- question: ["seats"],
86
+ plan: "team",
69
87
  preferences: ["notifications", "language"],
70
- chosen: "Nothing chosen yet.",
71
- density: "comfortable",
72
- confirming: open === "dialog",
73
- asking: false,
74
- copyName: "Weekly report, my copy",
88
+ query: "",
89
+ question: ["seats"],
90
+ queued: [],
91
+ reminderDays: ["mon", "thu"],
92
+ reminderTime: "09:30",
93
+ results: 4,
94
+ revealed: false,
95
+ saved: true,
96
+ search: "",
97
+ secret: "correct horse",
98
+ sharing: false,
99
+ shirt: undefined,
100
+ startDate: undefined,
101
+ stay: { start: "2026-03-10", end: "2026-03-14" },
102
+ submitted: "",
103
+ theme: document.documentElement.dataset.theme,
104
+ timeZone: undefined,
75
105
  toast: open === "toast",
76
- deleted: open === "toast",
106
+ view: "week",
107
+ volume: 60,
77
108
  };
78
109
  const page = el("main", { class: "xds-preview mx-auto flex max-w-4xl flex-col gap-12 p-6" }, el("header", { class: "flex items-center justify-between" }, ui.Text({ variant: "display", as: "h1" }, "Xds design system"), el("div", { class: "flex items-center gap-3" }, ...links.map(({ label, href }) => el("a", { class: "text-xds-detail text-xds-text-accent underline", href }, label)), ui.Button({
79
110
  variant: "ghost",
@@ -1,80 +1,4 @@
1
- import type { IconName } from "@xds/tokens";
2
- import type { SidebarSection } from "../sidebar.ts";
3
1
  export declare const PORTRAIT: string;
4
2
  export declare const NIGHT: string;
5
3
  export declare const DAY: string;
6
4
  export declare const BROKEN = "data:image/png;base64,AAAA";
7
- export declare const PEOPLE: ({
8
- name: string;
9
- src: string;
10
- } | {
11
- src?: undefined;
12
- name: string;
13
- })[];
14
- export declare const VIEWS: {
15
- value: string;
16
- label: string;
17
- }[];
18
- export declare const DELIVERY: ({
19
- value: string;
20
- label: string;
21
- description: string;
22
- } | {
23
- description?: undefined;
24
- value: string;
25
- label: string;
26
- })[];
27
- export declare const SIZES_OF_SHIRT: {
28
- value: string;
29
- label: string;
30
- }[];
31
- export declare const PLANS: {
32
- value: string;
33
- label: string;
34
- description: string;
35
- }[];
36
- export declare const COUNTRIES: {
37
- value: string;
38
- label: string;
39
- }[];
40
- export declare const TIME_ZONES: {
41
- value: string;
42
- label: string;
43
- }[];
44
- export declare const CURRENCIES: {
45
- value: string;
46
- label: string;
47
- }[];
48
- export declare const FILTERS: readonly {
49
- value: string;
50
- label: string;
51
- icon: IconName;
52
- }[];
53
- export declare const PAGES: readonly {
54
- value: string;
55
- label: string;
56
- icon: IconName;
57
- }[];
58
- export declare const PLACES: readonly SidebarSection[];
59
- export declare const QUESTIONS: ({
60
- value: string;
61
- title: string;
62
- content: string;
63
- description?: undefined;
64
- } | {
65
- value: string;
66
- title: string;
67
- description: string;
68
- content: string;
69
- })[];
70
- export declare const PREFERENCES: ({
71
- value: string;
72
- title: string;
73
- description: string;
74
- content: string;
75
- } | {
76
- description?: undefined;
77
- value: string;
78
- title: string;
79
- content: string;
80
- })[];
@@ -3,129 +3,3 @@ export const PORTRAIT = picture(96, 96, '<rect width="96" height="96" fill="peac
3
3
  export const NIGHT = picture(320, 160, '<rect width="320" height="160" fill="midnightblue"/><circle cx="250" cy="44" r="18" fill="lemonchiffon"/><path d="M0 160 90 80l60 50 50-30 120 60z" fill="black"/>');
4
4
  export const DAY = picture(320, 160, '<rect width="320" height="160" fill="aliceblue"/><circle cx="70" cy="46" r="20" fill="khaki"/><path d="M0 160 110 90l60 40 60-50 90 80z" fill="lightsteelblue"/>');
5
5
  export const BROKEN = "data:image/png;base64,AAAA";
6
- export const PEOPLE = [
7
- { name: "Ada Lovelace", src: PORTRAIT },
8
- { name: "Grace Hopper" },
9
- { name: "Alan Turing" },
10
- { name: "Katherine Johnson" },
11
- { name: "Margaret Hamilton" },
12
- { name: "Linus Torvalds" },
13
- { name: "Barbara Liskov" },
14
- ];
15
- export const VIEWS = [
16
- { value: "day", label: "Day" },
17
- { value: "week", label: "Week" },
18
- { value: "month", label: "Month" },
19
- ];
20
- export const DELIVERY = [
21
- { value: "standard", label: "Standard", description: "Three to five working days. Free." },
22
- { value: "express", label: "Express", description: "The next working day. 9 euros." },
23
- { value: "pickup", label: "Pick up in a store" },
24
- ];
25
- export const SIZES_OF_SHIRT = [
26
- { value: "s", label: "Small" },
27
- { value: "m", label: "Medium" },
28
- { value: "l", label: "Large" },
29
- ];
30
- export const PLANS = [
31
- { value: "free", label: "Free", description: "Up to 3 projects" },
32
- { value: "team", label: "Team", description: "Up to 20 people" },
33
- { value: "business", label: "Business", description: "Single sign-on and audit logs" },
34
- { value: "enterprise", label: "Enterprise", description: "A contract of your own" },
35
- ];
36
- export const COUNTRIES = [
37
- "Argentina",
38
- "Australia",
39
- "Brazil",
40
- "Canada",
41
- "France",
42
- "Germany",
43
- "Japan",
44
- "Korea",
45
- "Mexico",
46
- "Spain",
47
- "United Kingdom",
48
- "United States",
49
- ].map((name) => ({ value: name.toLowerCase().replace(/ /g, "-"), label: name }));
50
- export const TIME_ZONES = [
51
- { value: "utc", label: "Coordinated Universal Time" },
52
- { value: "seoul", label: "Seoul" },
53
- { value: "berlin", label: "Berlin" },
54
- ];
55
- export const CURRENCIES = [{ value: "eur", label: "Euro" }];
56
- export const FILTERS = [
57
- { value: "open", label: "Open", icon: "flag" },
58
- { value: "mine", label: "Assigned to me", icon: "user" },
59
- { value: "mentions", label: "Mentions", icon: "message-square" },
60
- { value: "review", label: "Needs review", icon: "eye" },
61
- { value: "blocked", label: "Blocked", icon: "ban" },
62
- { value: "done", label: "Done this week", icon: "check-check" },
63
- { value: "archived", label: "Archived", icon: "history" },
64
- ];
65
- export const PAGES = [
66
- { value: "overview", label: "Overview", icon: "house" },
67
- { value: "activity", label: "Activity", icon: "bell" },
68
- { value: "members", label: "Members", icon: "users" },
69
- { value: "billing", label: "Billing", icon: "credit-card" },
70
- { value: "settings", label: "Settings", icon: "settings" },
71
- ];
72
- export const PLACES = [
73
- {
74
- items: [
75
- { value: "home", label: "Home", icon: "house" },
76
- { value: "messages", label: "Messages", icon: "message-square", count: 12 },
77
- { value: "activity", label: "Activity", icon: "bell", count: 3 },
78
- ],
79
- },
80
- {
81
- title: "Library",
82
- items: [
83
- { value: "saved", label: "Saved", icon: "bookmark", count: 128 },
84
- { value: "starred", label: "Starred", icon: "star" },
85
- { value: "liked", label: "Liked", icon: "heart" },
86
- ],
87
- },
88
- {
89
- title: "Workspace",
90
- items: [
91
- { value: "members", label: "Members", icon: "users" },
92
- { value: "settings", label: "Settings", icon: "settings" },
93
- ],
94
- },
95
- ];
96
- export const QUESTIONS = [
97
- {
98
- value: "cancel",
99
- title: "Can I cancel at any time?",
100
- content: "Yes. The plan stays active until the end of the period you paid for.",
101
- },
102
- {
103
- value: "seats",
104
- title: "How are seats counted?",
105
- description: "Guests are free",
106
- content: "Each person with an account in the workspace takes a seat. Guests do not.",
107
- },
108
- {
109
- value: "invoice",
110
- title: "Where do I find my invoices?",
111
- content: "Under Settings, then Billing. Each invoice can be downloaded as a PDF.",
112
- },
113
- ];
114
- export const PREFERENCES = [
115
- {
116
- value: "notifications",
117
- title: "Notifications",
118
- description: "Mentions, replies and reminders",
119
- content: "Choose what you hear about, and whether by email or in the app.",
120
- },
121
- {
122
- value: "privacy",
123
- title: "Privacy",
124
- content: "Choose who can see your profile and your activity.",
125
- },
126
- {
127
- value: "language",
128
- title: "Language and region",
129
- content: "The language of the app, and how dates and numbers are written.",
130
- },
131
- ];
@@ -1,52 +1,68 @@
1
1
  import type { DateRange } from "../date-range-picker.ts";
2
+ import type { TableSort } from "../table.ts";
3
+ import type { QueuedToast } from "../toast-queue.ts";
2
4
  import { type Child } from "./model.ts";
3
5
  /** Every value the design preview's controls hold, by slot. */
4
6
  export type DesignState = {
5
- theme: string | undefined;
6
- liked: boolean;
7
- saved: boolean;
8
- pinned: boolean;
9
- email: string;
10
- query: string;
11
- secret: string;
12
- revealed: boolean;
13
- notes: string;
14
- bio: string;
15
- search: string;
16
- submitted: string;
17
- notifications: boolean;
18
7
  agreed: boolean;
19
- view: string;
20
- delivery: string;
21
- shirt: string | undefined;
22
- plan: string;
8
+ archived: number;
9
+ asking: boolean;
10
+ bio: string;
11
+ chosen: string;
12
+ city: string | undefined;
13
+ confirming: boolean;
14
+ copyName: string;
23
15
  country: string | undefined;
24
- timeZone: string | undefined;
25
- volume: number;
26
- fontSize: number;
16
+ deleted: boolean;
17
+ delivery: string;
18
+ density: string;
19
+ dismissed: boolean;
27
20
  dueDate: string;
28
- startDate: string | undefined;
29
- stay: DateRange;
30
- leave: DateRange | undefined;
21
+ email: string;
22
+ fileSort: TableSort;
31
23
  filters: readonly string[];
24
+ fontSize: number;
25
+ leave: DateRange | undefined;
26
+ liked: boolean;
27
+ linked: string;
28
+ meetingTime: string | undefined;
29
+ notes: string;
30
+ notifications: boolean;
31
+ opened: string;
32
32
  page: string;
33
- dismissed: boolean;
34
33
  picked: boolean;
35
- opened: string;
34
+ pinned: boolean;
36
35
  place: string;
37
- question: readonly string[];
36
+ plan: string;
38
37
  preferences: readonly string[];
39
- chosen: string;
40
- density: string;
41
- confirming: boolean;
42
- asking: boolean;
43
- copyName: string;
38
+ query: string;
39
+ question: readonly string[];
40
+ queued: readonly Omit<QueuedToast, "action">[];
41
+ reminderDays: readonly string[];
42
+ reminderTime: string | undefined;
43
+ results: number;
44
+ revealed: boolean;
45
+ saved: boolean;
46
+ search: string;
47
+ secret: string;
48
+ sharing: boolean;
49
+ shirt: string | undefined;
50
+ startDate: string | undefined;
51
+ stay: DateRange;
52
+ submitted: string;
53
+ theme: string | undefined;
54
+ timeZone: string | undefined;
44
55
  toast: boolean;
45
- deleted: boolean;
56
+ view: string;
57
+ volume: number;
46
58
  };
47
59
  export declare const { ui, el, show, bind, screen }: import("./model.ts").Builder<DesignState>;
48
60
  /** The callback of a control that shows a value it does not take changes to. */
49
61
  export declare const keep: () => undefined;
62
+ /** The callback of a toggle, which flips its slot. */
63
+ export declare const toggle: (key: "liked" | "saved" | "pinned" | "revealed" | "picked") => (state: DesignState) => {
64
+ [x: string]: boolean;
65
+ };
50
66
  /** A labelled row of examples. */
51
67
  export declare const row: (label: string, ...children: Child<DesignState>[]) => import("./model.ts").PreviewNode<DesignState>;
52
68
  /** `backgroundBase` becomes `background-base`, as in the names of the CSS variables. */
@@ -1,5 +1,8 @@
1
1
  import { builder } from "./model.js";
2
2
  export const { ui, el, show, bind, screen } = builder();
3
3
  export const keep = () => undefined;
4
+ export const toggle = (key) => (state) => ({
5
+ [key]: !state[key],
6
+ });
4
7
  export const row = (label, ...children) => el("div", { class: "flex flex-wrap items-center gap-3" }, ui.Text({ variant: "detail", tone: "secondary", as: "span", class: "w-24 shrink-0" }, label), ...children);
5
8
  export const kebab = (name) => name.replace(/[A-Z0-9]+/g, (match) => `-${match.toLowerCase()}`);
@@ -1,6 +1,6 @@
1
1
  import type { SectionTitle } from "./design.ts";
2
2
  /** The overlays `?open=` can name. */
3
- export type Overlay = "menu" | "select" | "datepicker" | "daterange" | "tooltip" | "dialog" | "toast";
3
+ export type Overlay = "menu" | "popover" | "select" | "datepicker" | "daterange" | "tooltip" | "dialog" | "toast";
4
4
  /**
5
5
  * The overlays `?open=` shows as soon as the page loads, so that they can be captured without
6
6
  * a hand on the page. A menu, a select's list, a date picker's calendar and a tooltip open
@@ -1,5 +1,6 @@
1
1
  export const OVERLAYS = {
2
2
  menu: { section: "Menu", press: "click" },
3
+ popover: { section: "Menu", press: "click", control: '[class*="-popover__trigger"]' },
3
4
  select: { section: "Controls", press: "click" },
4
5
  datepicker: { section: "Controls", press: "click", control: '[class*="-date-picker__trigger"]' },
5
6
  daterange: {
@@ -0,0 +1 @@
1
+ export declare const accordion: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];