@xds/core 1.0.1 → 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.
- package/dist/banner.d.ts +4 -1
- package/dist/breadcrumb.d.ts +39 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/checkbox.d.ts +20 -3
- package/dist/checkbox.js +3 -1
- package/dist/combobox.d.ts +59 -0
- package/dist/combobox.js +40 -0
- package/dist/date-picker.d.ts +10 -4
- package/dist/date-picker.js +5 -4
- package/dist/date-range-picker.d.ts +10 -4
- package/dist/date-range-picker.js +9 -8
- package/dist/index.d.ts +17 -6
- package/dist/index.js +16 -5
- package/dist/labels.d.ts +34 -0
- package/dist/labels.js +26 -0
- package/dist/link.d.ts +49 -0
- package/dist/link.js +12 -0
- package/dist/pagination.d.ts +51 -0
- package/dist/pagination.js +25 -0
- package/dist/popover.d.ts +33 -0
- package/dist/popover.js +8 -0
- package/dist/preview/components.d.ts +71 -17
- package/dist/preview/components.js +1 -0
- package/dist/preview/design.d.ts +22 -3
- package/dist/preview/design.js +65 -34
- package/dist/preview/fixtures.d.ts +0 -76
- package/dist/preview/fixtures.js +0 -126
- package/dist/preview/kit.d.ts +48 -32
- package/dist/preview/kit.js +3 -0
- package/dist/preview/page.d.ts +1 -1
- package/dist/preview/page.js +1 -0
- package/dist/preview/sections/accordion.d.ts +1 -0
- package/dist/preview/sections/accordion.js +40 -0
- package/dist/preview/sections/badges.d.ts +1 -0
- package/dist/preview/sections/badges.js +13 -0
- package/dist/preview/sections/banners.d.ts +1 -0
- package/dist/preview/sections/banners.js +13 -0
- package/dist/preview/sections/buttons.d.ts +2 -0
- package/dist/preview/sections/buttons.js +30 -0
- package/dist/preview/sections/card.d.ts +1 -0
- package/dist/preview/sections/card.js +33 -0
- package/dist/preview/sections/chips.d.ts +1 -0
- package/dist/preview/sections/chips.js +23 -0
- package/dist/preview/sections/controls.d.ts +1 -0
- package/dist/preview/sections/controls.js +143 -0
- package/dist/preview/sections/dialog.d.ts +1 -0
- package/dist/preview/sections/dialog.js +25 -0
- package/dist/preview/sections/empty-state.d.ts +1 -0
- package/dist/preview/sections/empty-state.js +13 -0
- package/dist/preview/sections/links.d.ts +1 -0
- package/dist/preview/sections/links.js +8 -0
- package/dist/preview/sections/list.d.ts +1 -0
- package/dist/preview/sections/list.js +119 -0
- package/dist/preview/sections/media.d.ts +1 -0
- package/dist/preview/sections/media.js +90 -0
- package/dist/preview/sections/menu.d.ts +1 -0
- package/dist/preview/sections/menu.js +46 -0
- package/dist/preview/sections/navigation.d.ts +1 -0
- package/dist/preview/sections/navigation.js +20 -0
- package/dist/preview/sections/selection.d.ts +1 -0
- package/dist/preview/sections/selection.js +33 -0
- package/dist/preview/sections/sidebar.d.ts +1 -0
- package/dist/preview/sections/sidebar.js +45 -0
- package/dist/preview/sections/skeleton.d.ts +1 -0
- package/dist/preview/sections/skeleton.js +5 -0
- package/dist/preview/sections/tabs.d.ts +1 -0
- package/dist/preview/sections/tabs.js +24 -0
- package/dist/preview/sections/text-fields.d.ts +1 -0
- package/dist/preview/sections/text-fields.js +75 -0
- package/dist/preview/sections/toast.d.ts +2 -0
- package/dist/preview/sections/toast.js +28 -0
- package/dist/preview/specimens.js +1 -1
- package/dist/progress-bar.d.ts +7 -4
- package/dist/progress-bar.js +2 -2
- package/dist/radio-group.d.ts +7 -1
- package/dist/root.d.ts +25 -0
- package/dist/root.js +25 -0
- package/dist/rows.d.ts +23 -0
- package/dist/rows.js +67 -0
- package/dist/segmented-control.d.ts +5 -2
- package/dist/segmented-control.js +1 -1
- package/dist/select.d.ts +29 -1
- package/dist/select.js +7 -0
- package/dist/slider.d.ts +4 -1
- package/dist/switch.d.ts +5 -2
- package/dist/switch.js +2 -1
- package/dist/table.d.ts +62 -0
- package/dist/table.js +25 -0
- package/dist/tabs.d.ts +4 -2
- package/dist/text-field.d.ts +19 -3
- package/dist/theme-scope.d.ts +6 -4
- package/dist/theme-scope.js +21 -15
- package/dist/time-picker.d.ts +57 -0
- package/dist/time-picker.js +53 -0
- package/dist/toast-queue.d.ts +40 -0
- package/dist/toast-queue.js +17 -0
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/package.json +2 -2
- package/dist/preview/sections.d.ts +0 -20
- package/dist/preview/sections.js +0 -517
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Pagination's props in every framework, short of its change handler. */
|
|
2
|
+
export type PaginationBaseProps = {
|
|
3
|
+
/** How many pages there are. */
|
|
4
|
+
count: number;
|
|
5
|
+
/**
|
|
6
|
+
* The page shown, from 1. Given at all, even as `undefined`, the app keeps it and changes it
|
|
7
|
+
* in `onChange`; otherwise the pagination keeps its own, from `defaultValue`.
|
|
8
|
+
*/
|
|
9
|
+
value?: number;
|
|
10
|
+
/** The page shown first when the pagination keeps its own. Defaults to 1. */
|
|
11
|
+
defaultValue?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Names the pagination's navigation landmark for assistive technology: `pagination` from the
|
|
14
|
+
* closest `Labels`, "Pagination" in English, unless it is given.
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Names the step back a page: `previousPage` from the closest `Labels` unless it is given. */
|
|
18
|
+
previousLabel?: string;
|
|
19
|
+
/** Names the step on a page: `nextPage` from the closest `Labels` unless it is given. */
|
|
20
|
+
nextLabel?: string;
|
|
21
|
+
};
|
|
22
|
+
/** A page, by its number from 1, or a gap that stands for the pages left out. */
|
|
23
|
+
export type PaginationEntry = number | "gap";
|
|
24
|
+
/**
|
|
25
|
+
* The pages a Pagination shows between its steps: the first, the last, and the one shown, with
|
|
26
|
+
* a gap for each run of pages left out. Never more than five, so the row keeps its width from
|
|
27
|
+
* page to page and fits a phone held upright with the steps beside it. Near either end the
|
|
28
|
+
* three pages there are shown, so a gap never stands for a single page beside the one shown.
|
|
29
|
+
*/
|
|
30
|
+
export declare function paginationEntries(value: number, count: number): PaginationEntry[];
|
|
31
|
+
/** The page shown, kept between the first and the last: an app may give one past the end. */
|
|
32
|
+
export declare function clampPage(value: number, count: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* The classes of a Pagination's parts beside its root, `xds-pagination`, a `<nav>`: the row,
|
|
35
|
+
* a page, a gap, and the steps back and on.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PAGINATION_PARTS: {
|
|
38
|
+
readonly list: "xds-pagination__list";
|
|
39
|
+
readonly page: "xds-pagination__page";
|
|
40
|
+
readonly gap: "xds-pagination__gap";
|
|
41
|
+
readonly step: "xds-pagination__step";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The steps' chevrons, which point back and on, so they mirror in a right-to-left layout. `sm`
|
|
45
|
+
* is the icon of a small control.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PAGINATION_STEPS: {
|
|
48
|
+
readonly previous: "chevron-left";
|
|
49
|
+
readonly next: "chevron-right";
|
|
50
|
+
readonly size: "sm";
|
|
51
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function paginationEntries(value, count) {
|
|
2
|
+
const last = Math.max(0, Math.floor(count));
|
|
3
|
+
if (last <= 5)
|
|
4
|
+
return Array.from({ length: last }, (_, index) => index + 1);
|
|
5
|
+
const page = clampPage(value, last);
|
|
6
|
+
if (page <= 3)
|
|
7
|
+
return [1, 2, 3, "gap", last];
|
|
8
|
+
if (page >= last - 2)
|
|
9
|
+
return [1, "gap", last - 2, last - 1, last];
|
|
10
|
+
return [1, "gap", page, "gap", last];
|
|
11
|
+
}
|
|
12
|
+
export function clampPage(value, count) {
|
|
13
|
+
return Math.min(Math.max(1, Math.floor(value)), Math.max(1, Math.floor(count)));
|
|
14
|
+
}
|
|
15
|
+
export const PAGINATION_PARTS = {
|
|
16
|
+
list: "xds-pagination__list",
|
|
17
|
+
page: "xds-pagination__page",
|
|
18
|
+
gap: "xds-pagination__gap",
|
|
19
|
+
step: "xds-pagination__step",
|
|
20
|
+
};
|
|
21
|
+
export const PAGINATION_STEPS = {
|
|
22
|
+
previous: "chevron-left",
|
|
23
|
+
next: "chevron-right",
|
|
24
|
+
size: "sm",
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Popover's props in every framework, short of its trigger and its content. */
|
|
2
|
+
export type PopoverBaseProps = {
|
|
3
|
+
/** Names the popover, and stands at its top. */
|
|
4
|
+
title: string;
|
|
5
|
+
/**
|
|
6
|
+
* The side of the trigger it opens on, where it opens beside it: below unless there is no
|
|
7
|
+
* room. Where fingers are used it is a sheet across the bottom of the screen instead.
|
|
8
|
+
*/
|
|
9
|
+
placement?: "bottom" | "top";
|
|
10
|
+
/** Names its close button: `close` from the closest `Labels` unless it is given. */
|
|
11
|
+
closeLabel?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether it is open. Given at all, even as `undefined`, the app keeps it and changes it in
|
|
14
|
+
* `onOpenChange`; otherwise the popover keeps its own, from `defaultOpen`.
|
|
15
|
+
*/
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/** Whether it starts open when it keeps its own. */
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The classes of a Popover's parts: its trigger (added to the Button or IconButton that opens
|
|
22
|
+
* it), the positioner Zag places, the surface (the root part,
|
|
23
|
+
* `xds-popover`, which takes the app's class and attributes), its header, title, close button
|
|
24
|
+
* and body.
|
|
25
|
+
*/
|
|
26
|
+
export declare const POPOVER_PARTS: {
|
|
27
|
+
readonly trigger: "xds-popover__trigger";
|
|
28
|
+
readonly positioner: "xds-popover__positioner";
|
|
29
|
+
readonly header: "xds-popover__header";
|
|
30
|
+
readonly title: "xds-popover__title";
|
|
31
|
+
readonly close: "xds-popover__close";
|
|
32
|
+
readonly body: "xds-popover__body";
|
|
33
|
+
};
|
package/dist/popover.js
ADDED
|
@@ -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";
|
|
@@ -15,11 +17,16 @@ import type { ComponentDefaults } from "../defaults.ts";
|
|
|
15
17
|
import type { DialogBaseProps } from "../dialog.ts";
|
|
16
18
|
import type { EmptyStateBaseProps } from "../empty-state.ts";
|
|
17
19
|
import type { IconBaseProps } from "../icon.ts";
|
|
20
|
+
import type { ComponentLabels } from "../labels.ts";
|
|
21
|
+
import type { LinkBaseProps } from "../link.ts";
|
|
18
22
|
import type { ListRowBaseProps } from "../list-row.ts";
|
|
19
23
|
import type { MediaCardBaseProps } from "../media-card.ts";
|
|
20
24
|
import type { MenuBaseProps } from "../menu.ts";
|
|
25
|
+
import type { PaginationBaseProps } from "../pagination.ts";
|
|
26
|
+
import type { PopoverBaseProps } from "../popover.ts";
|
|
21
27
|
import type { ProgressBarBaseProps } from "../progress-bar.ts";
|
|
22
28
|
import type { RadioGroupBaseProps } from "../radio-group.ts";
|
|
29
|
+
import type { RootAttributes } from "../root.ts";
|
|
23
30
|
import type { SectionHeaderBaseProps } from "../section-header.ts";
|
|
24
31
|
import type { SegmentedControlBaseProps } from "../segmented-control.ts";
|
|
25
32
|
import type { SelectBaseProps } from "../select.ts";
|
|
@@ -28,10 +35,13 @@ import type { SkeletonBaseProps } from "../skeleton.ts";
|
|
|
28
35
|
import type { SliderBaseProps } from "../slider.ts";
|
|
29
36
|
import type { SpinnerBaseProps } from "../spinner.ts";
|
|
30
37
|
import type { SwitchBaseProps } from "../switch.ts";
|
|
38
|
+
import type { TableBaseProps, TableSort } from "../table.ts";
|
|
31
39
|
import type { TabsBaseProps } from "../tabs.ts";
|
|
32
40
|
import type { SearchFieldBaseProps, TextFieldBaseProps } from "../text-field.ts";
|
|
33
41
|
import type { TextBaseProps } from "../text.ts";
|
|
34
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";
|
|
35
45
|
import type { ToastBaseProps } from "../toast.ts";
|
|
36
46
|
import type { TooltipBaseProps } from "../tooltip.ts";
|
|
37
47
|
/** A small action drawn as a link or a button, such as a banner's "Try again". */
|
|
@@ -62,7 +72,8 @@ interface Own<N> {
|
|
|
62
72
|
onDismiss?: () => void;
|
|
63
73
|
children: N;
|
|
64
74
|
};
|
|
65
|
-
|
|
75
|
+
Breadcrumb: BreadcrumbBaseProps;
|
|
76
|
+
Button: ButtonBaseProps & Focus & {
|
|
66
77
|
onPress?: () => void;
|
|
67
78
|
children?: N;
|
|
68
79
|
};
|
|
@@ -73,8 +84,8 @@ interface Own<N> {
|
|
|
73
84
|
class?: string;
|
|
74
85
|
children?: N;
|
|
75
86
|
};
|
|
76
|
-
Checkbox: CheckboxBaseProps & {
|
|
77
|
-
onChange
|
|
87
|
+
Checkbox: CheckboxBaseProps & Focus & {
|
|
88
|
+
onChange?: (checked: boolean) => void;
|
|
78
89
|
};
|
|
79
90
|
Chip: ChipBaseProps & {
|
|
80
91
|
onPress?: () => void;
|
|
@@ -82,6 +93,9 @@ interface Own<N> {
|
|
|
82
93
|
ChipBar: ChipBarBaseProps & {
|
|
83
94
|
children: N;
|
|
84
95
|
};
|
|
96
|
+
Combobox: ComboboxBaseProps & {
|
|
97
|
+
onChange?: (value: string) => void;
|
|
98
|
+
};
|
|
85
99
|
CountBadge: CountBadgeBaseProps & {
|
|
86
100
|
children?: N;
|
|
87
101
|
};
|
|
@@ -103,8 +117,12 @@ interface Own<N> {
|
|
|
103
117
|
Icon: IconBaseProps & {
|
|
104
118
|
class?: string;
|
|
105
119
|
};
|
|
106
|
-
IconButton: IconButtonBaseProps & {
|
|
120
|
+
IconButton: IconButtonBaseProps & Focus & {
|
|
121
|
+
onPress?: () => void;
|
|
122
|
+
};
|
|
123
|
+
Link: LinkBaseProps & Focus & {
|
|
107
124
|
onPress?: () => void;
|
|
125
|
+
children: N;
|
|
108
126
|
};
|
|
109
127
|
ListRow: ListRowBaseProps & {
|
|
110
128
|
leading?: N;
|
|
@@ -119,22 +137,31 @@ interface Own<N> {
|
|
|
119
137
|
Menu: MenuBaseProps & {
|
|
120
138
|
trigger: N;
|
|
121
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
|
+
};
|
|
122
148
|
ProgressBar: ProgressBarBaseProps;
|
|
123
149
|
RadioGroup: RadioGroupBaseProps & {
|
|
124
|
-
onChange
|
|
150
|
+
onChange?: (value: string) => void;
|
|
125
151
|
};
|
|
126
|
-
SearchField: SearchFieldBaseProps & {
|
|
127
|
-
onChange
|
|
152
|
+
SearchField: SearchFieldBaseProps & Focus & {
|
|
153
|
+
onChange?: (value: string) => void;
|
|
128
154
|
onSubmit?: (value: string) => void;
|
|
129
155
|
};
|
|
130
156
|
SectionHeader: SectionHeaderBaseProps & {
|
|
131
157
|
action?: Action;
|
|
132
158
|
};
|
|
133
159
|
SegmentedControl: SegmentedControlBaseProps<string> & {
|
|
134
|
-
onChange
|
|
160
|
+
onChange?: (value: string) => void;
|
|
135
161
|
};
|
|
136
162
|
Select: SelectBaseProps & {
|
|
137
|
-
onChange
|
|
163
|
+
onChange?: (value: string) => void;
|
|
164
|
+
onValuesChange?: (values: string[]) => void;
|
|
138
165
|
};
|
|
139
166
|
Sidebar: SidebarBaseProps & {
|
|
140
167
|
onChange: (value: string) => void;
|
|
@@ -143,37 +170,58 @@ interface Own<N> {
|
|
|
143
170
|
};
|
|
144
171
|
Skeleton: SkeletonBaseProps;
|
|
145
172
|
Slider: SliderBaseProps & {
|
|
146
|
-
onChange
|
|
173
|
+
onChange?: (value: number) => void;
|
|
147
174
|
};
|
|
148
175
|
Spinner: SpinnerBaseProps;
|
|
149
|
-
Switch: SwitchBaseProps & {
|
|
150
|
-
onChange
|
|
176
|
+
Switch: SwitchBaseProps & Focus & {
|
|
177
|
+
onChange?: (checked: boolean) => void;
|
|
178
|
+
};
|
|
179
|
+
Table: TableBaseProps & {
|
|
180
|
+
onSortChange?: (sort: TableSort) => void;
|
|
151
181
|
};
|
|
152
182
|
Tabs: TabsBaseProps<string> & {
|
|
153
|
-
onChange
|
|
183
|
+
onChange?: (value: string) => void;
|
|
154
184
|
};
|
|
155
185
|
Text: TextBaseProps & {
|
|
156
186
|
as?: keyof HTMLElementTagNameMap;
|
|
157
187
|
class?: string;
|
|
158
188
|
children: N;
|
|
159
189
|
};
|
|
160
|
-
TextField: TextFieldBaseProps & {
|
|
161
|
-
onChange
|
|
190
|
+
TextField: TextFieldBaseProps & Focus & {
|
|
191
|
+
onChange?: (value: string) => void;
|
|
162
192
|
leading?: N;
|
|
163
193
|
trailing?: N;
|
|
164
194
|
};
|
|
165
195
|
Thumbnail: ThumbnailBaseProps;
|
|
196
|
+
TimePicker: TimePickerBaseProps & {
|
|
197
|
+
onChange?: (value: IsoTime) => void;
|
|
198
|
+
};
|
|
166
199
|
Toast: ToastBaseProps & {
|
|
167
200
|
onClose: () => void;
|
|
168
201
|
};
|
|
202
|
+
ToastQueue: Omit<ToastQueueBaseProps, "toasts"> & {
|
|
203
|
+
toasts: readonly Omit<QueuedToast, "action">[];
|
|
204
|
+
onClose: (id: QueuedToast["id"]) => void;
|
|
205
|
+
};
|
|
169
206
|
Tooltip: TooltipBaseProps & {
|
|
170
207
|
children: N;
|
|
171
208
|
};
|
|
172
209
|
}
|
|
173
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* When the element the component is focused through, its native button or input, takes and
|
|
212
|
+
* loses the focus. A library passes its framework's event; the data reads none.
|
|
213
|
+
*/
|
|
214
|
+
type Focus = {
|
|
215
|
+
onFocus?: () => void;
|
|
216
|
+
onBlur?: () => void;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* What an app puts on a component's root element, beside its root part: a class (React's
|
|
220
|
+
* `className`), an `id`, and `data-*` attributes.
|
|
221
|
+
*/
|
|
174
222
|
type Root = {
|
|
175
223
|
class?: string;
|
|
176
|
-
};
|
|
224
|
+
} & RootAttributes;
|
|
177
225
|
export type Components<N> = {
|
|
178
226
|
[K in keyof Own<N>]: Own<N>[K] & Root;
|
|
179
227
|
} & {
|
|
@@ -182,6 +230,11 @@ export type Components<N> = {
|
|
|
182
230
|
value: ComponentDefaults;
|
|
183
231
|
children: N;
|
|
184
232
|
};
|
|
233
|
+
/** The names the components inside give their own parts, in place of the English ones. */
|
|
234
|
+
Labels: {
|
|
235
|
+
value: Partial<ComponentLabels>;
|
|
236
|
+
children: N;
|
|
237
|
+
};
|
|
185
238
|
};
|
|
186
239
|
export type ComponentName = keyof Components<unknown>;
|
|
187
240
|
declare const NODE: unique symbol;
|
|
@@ -205,6 +258,7 @@ export declare const NODE_PROPS: {
|
|
|
205
258
|
readonly ListRow: readonly ["leading", "trailing"];
|
|
206
259
|
readonly MediaCard: readonly ["leading", "action"];
|
|
207
260
|
readonly Menu: readonly ["trigger"];
|
|
261
|
+
readonly Popover: readonly ["trigger"];
|
|
208
262
|
readonly Sidebar: readonly ["header", "footer"];
|
|
209
263
|
readonly TextField: readonly ["leading", "trailing"];
|
|
210
264
|
};
|
package/dist/preview/design.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
import {
|
|
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
|
|
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`. */
|
package/dist/preview/design.js
CHANGED
|
@@ -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
|
|
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",
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
deleted: open === "toast",
|
|
67
|
+
delivery: "standard",
|
|
68
|
+
density: "comfortable",
|
|
69
|
+
dismissed: false,
|
|
58
70
|
dueDate: "2026-03-10",
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
84
|
+
pinned: true,
|
|
67
85
|
place: "messages",
|
|
68
|
-
|
|
86
|
+
plan: "team",
|
|
69
87
|
preferences: ["notifications", "language"],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
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
|
-
})[];
|