@xds/react 0.0.0-stage → 0.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 (190) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/Accordion.d.ts +20 -0
  4. package/dist/Accordion.js +197 -0
  5. package/dist/Avatar.d.ts +9 -0
  6. package/dist/Avatar.js +69 -0
  7. package/dist/AvatarStack.d.ts +8 -0
  8. package/dist/AvatarStack.js +105 -0
  9. package/dist/Badge.d.ts +13 -0
  10. package/dist/Badge.js +66 -0
  11. package/dist/Banner.d.ts +23 -0
  12. package/dist/Banner.js +166 -0
  13. package/dist/Button.d.ts +14 -0
  14. package/dist/Button.js +159 -0
  15. package/dist/Card.d.ts +18 -0
  16. package/dist/Card.js +173 -0
  17. package/dist/Checkbox.d.ts +10 -0
  18. package/dist/Checkbox.js +140 -0
  19. package/dist/Chip.d.ts +12 -0
  20. package/dist/Chip.js +74 -0
  21. package/dist/ChipBar.d.ts +12 -0
  22. package/dist/ChipBar.js +38 -0
  23. package/dist/CountBadge.d.ts +12 -0
  24. package/dist/CountBadge.js +64 -0
  25. package/dist/DatePicker.d.ts +20 -0
  26. package/dist/DatePicker.js +429 -0
  27. package/dist/DateRangePicker.d.ts +24 -0
  28. package/dist/DateRangePicker.js +370 -0
  29. package/dist/Defaults.d.ts +17 -0
  30. package/dist/Defaults.js +48 -0
  31. package/dist/Dialog.d.ts +20 -0
  32. package/dist/Dialog.js +137 -0
  33. package/dist/Divider.d.ts +4 -0
  34. package/dist/Divider.js +31 -0
  35. package/dist/EmptyState.d.ts +12 -0
  36. package/dist/EmptyState.js +86 -0
  37. package/dist/Icon.d.ts +9 -0
  38. package/dist/Icon.js +79 -0
  39. package/dist/IconButton.d.ts +12 -0
  40. package/dist/IconButton.js +119 -0
  41. package/dist/ListRow.d.ts +21 -0
  42. package/dist/ListRow.js +185 -0
  43. package/dist/MediaCard.d.ts +20 -0
  44. package/dist/MediaCard.js +279 -0
  45. package/dist/Menu.d.ts +18 -0
  46. package/dist/Menu.js +244 -0
  47. package/dist/ProgressBar.d.ts +8 -0
  48. package/dist/ProgressBar.js +65 -0
  49. package/dist/RadioGroup.d.ts +15 -0
  50. package/dist/RadioGroup.js +176 -0
  51. package/dist/SearchField.d.ts +15 -0
  52. package/dist/SearchField.js +152 -0
  53. package/dist/SectionHeader.d.ts +14 -0
  54. package/dist/SectionHeader.js +124 -0
  55. package/dist/SegmentedControl.d.ts +12 -0
  56. package/dist/SegmentedControl.js +106 -0
  57. package/dist/Select.d.ts +18 -0
  58. package/dist/Select.js +318 -0
  59. package/dist/Sidebar.d.ts +21 -0
  60. package/dist/Sidebar.js +220 -0
  61. package/dist/Skeleton.d.ts +11 -0
  62. package/dist/Skeleton.js +64 -0
  63. package/dist/Slider.d.ts +13 -0
  64. package/dist/Slider.js +151 -0
  65. package/dist/Spinner.d.ts +9 -0
  66. package/dist/Spinner.js +97 -0
  67. package/dist/Switch.d.ts +13 -0
  68. package/dist/Switch.js +116 -0
  69. package/dist/Tabs.d.ts +14 -0
  70. package/dist/Tabs.js +137 -0
  71. package/dist/Text.d.ts +10 -0
  72. package/dist/Text.js +46 -0
  73. package/dist/TextField.d.ts +22 -0
  74. package/dist/TextField.js +213 -0
  75. package/dist/Thumbnail.d.ts +9 -0
  76. package/dist/Thumbnail.js +152 -0
  77. package/dist/Toast.d.ts +14 -0
  78. package/dist/Toast.js +121 -0
  79. package/dist/Tooltip.d.ts +26 -0
  80. package/dist/Tooltip.js +166 -0
  81. package/dist/base.d.ts +11 -0
  82. package/dist/base.js +10 -0
  83. package/dist/index.d.ts +39 -0
  84. package/dist/index.js +39 -0
  85. package/dist/modal-popover.d.ts +7 -0
  86. package/dist/modal-popover.js +37 -0
  87. package/dist/picture.d.ts +13 -0
  88. package/dist/picture.js +76 -0
  89. package/dist/portal.d.ts +9 -0
  90. package/dist/portal.js +27 -0
  91. package/dist/presence.d.ts +6 -0
  92. package/dist/presence.js +34 -0
  93. package/dist/preview.d.ts +17 -0
  94. package/dist/preview.js +126 -0
  95. package/dist/root.d.ts +12 -0
  96. package/dist/root.js +1 -0
  97. package/dist/trigger.d.ts +24 -0
  98. package/dist/trigger.js +47 -0
  99. package/eject/files/Accordion.tsx +157 -0
  100. package/eject/files/Avatar.tsx +41 -0
  101. package/eject/files/AvatarStack.tsx +47 -0
  102. package/eject/files/Badge.tsx +33 -0
  103. package/eject/files/Banner.tsx +70 -0
  104. package/eject/files/Button.tsx +88 -0
  105. package/eject/files/Card.tsx +85 -0
  106. package/eject/files/Checkbox.tsx +59 -0
  107. package/eject/files/Chip.tsx +43 -0
  108. package/eject/files/ChipBar.tsx +31 -0
  109. package/eject/files/CountBadge.tsx +50 -0
  110. package/eject/files/DatePicker.tsx +192 -0
  111. package/eject/files/DateRangePicker.tsx +271 -0
  112. package/eject/files/Dialog.tsx +108 -0
  113. package/eject/files/Divider.tsx +13 -0
  114. package/eject/files/EmptyState.tsx +39 -0
  115. package/eject/files/Icon.tsx +38 -0
  116. package/eject/files/IconButton.tsx +62 -0
  117. package/eject/files/ListRow.tsx +86 -0
  118. package/eject/files/MediaCard.tsx +111 -0
  119. package/eject/files/Menu.tsx +168 -0
  120. package/eject/files/ProgressBar.tsx +34 -0
  121. package/eject/files/RadioGroup.tsx +112 -0
  122. package/eject/files/SearchField.tsx +88 -0
  123. package/eject/files/SectionHeader.tsx +56 -0
  124. package/eject/files/SegmentedControl.tsx +57 -0
  125. package/eject/files/Select.tsx +228 -0
  126. package/eject/files/Sidebar.tsx +149 -0
  127. package/eject/files/Skeleton.tsx +28 -0
  128. package/eject/files/Slider.tsx +109 -0
  129. package/eject/files/Spinner.tsx +36 -0
  130. package/eject/files/Switch.tsx +53 -0
  131. package/eject/files/Tabs.tsx +71 -0
  132. package/eject/files/Text.tsx +31 -0
  133. package/eject/files/TextField.tsx +122 -0
  134. package/eject/files/Thumbnail.tsx +66 -0
  135. package/eject/files/Toast.tsx +88 -0
  136. package/eject/files/Tooltip.tsx +120 -0
  137. package/eject/files/accordion.css +89 -0
  138. package/eject/files/accordion.ts +67 -0
  139. package/eject/files/avatar-stack.ts +57 -0
  140. package/eject/files/avatar.ts +42 -0
  141. package/eject/files/badge.ts +30 -0
  142. package/eject/files/banner.ts +68 -0
  143. package/eject/files/base.css +38 -0
  144. package/eject/files/button.css +241 -0
  145. package/eject/files/button.ts +106 -0
  146. package/eject/files/card.ts +58 -0
  147. package/eject/files/checkbox.ts +32 -0
  148. package/eject/files/chip-bar.ts +16 -0
  149. package/eject/files/chip.ts +35 -0
  150. package/eject/files/count-badge.ts +32 -0
  151. package/eject/files/date-picker.css +352 -0
  152. package/eject/files/date-picker.ts +250 -0
  153. package/eject/files/date-range-picker.ts +323 -0
  154. package/eject/files/dialog.css +139 -0
  155. package/eject/files/dialog.ts +15 -0
  156. package/eject/files/divider.ts +5 -0
  157. package/eject/files/empty-state.ts +22 -0
  158. package/eject/files/icon.ts +36 -0
  159. package/eject/files/list-row.ts +66 -0
  160. package/eject/files/media-card.ts +66 -0
  161. package/eject/files/menu.css +176 -0
  162. package/eject/files/menu.ts +84 -0
  163. package/eject/files/parts.ts +17 -0
  164. package/eject/files/progress-bar.ts +23 -0
  165. package/eject/files/radio-group.css +160 -0
  166. package/eject/files/radio-group.ts +24 -0
  167. package/eject/files/section-header.ts +32 -0
  168. package/eject/files/segmented-control.ts +30 -0
  169. package/eject/files/select.css +285 -0
  170. package/eject/files/select.ts +36 -0
  171. package/eject/files/sidebar.ts +75 -0
  172. package/eject/files/skeleton.ts +51 -0
  173. package/eject/files/slider.css +136 -0
  174. package/eject/files/slider.ts +65 -0
  175. package/eject/files/spinner.ts +22 -0
  176. package/eject/files/switch.ts +34 -0
  177. package/eject/files/tabs.css +112 -0
  178. package/eject/files/tabs.ts +35 -0
  179. package/eject/files/text-field.css +229 -0
  180. package/eject/files/text-field.ts +48 -0
  181. package/eject/files/text.ts +38 -0
  182. package/eject/files/thumbnail.ts +51 -0
  183. package/eject/files/toast.ts +31 -0
  184. package/eject/files/tooltip.css +104 -0
  185. package/eject/files/tooltip.ts +21 -0
  186. package/eject/manifest.json +814 -0
  187. package/package.json +66 -4
  188. package/page.css +20 -0
  189. package/styles.css +3252 -0
  190. package/tailwind.css +2665 -0
package/dist/Select.js ADDED
@@ -0,0 +1,318 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { space } from "@xds/tokens";
3
+ import { classes, keepListKeys, selectOptionIds } from "@xds/core";
4
+ import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
5
+ import * as select from "@zag-js/select";
6
+ import { useId, useMemo, useRef } from "react";
7
+ import { Icon } from "./Icon.js";
8
+ import { useModalPopover } from "./modal-popover.js";
9
+ import { Portal } from "./portal.js";
10
+ import { usePresence } from "./presence.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ export function Select(t0) {
13
+ const $ = _c(33);
14
+ const {
15
+ label,
16
+ options,
17
+ value,
18
+ onChange,
19
+ placeholder,
20
+ description,
21
+ error,
22
+ name,
23
+ disabled: t1,
24
+ className,
25
+ style
26
+ } = t0;
27
+ const disabled = t1 === undefined ? false : t1;
28
+ const id = useId();
29
+ const valueId = `${id}-value`;
30
+ const descriptionId = `${id}-description`;
31
+ const errorId = `${id}-error`;
32
+ const invalid = error !== undefined;
33
+ let t2;
34
+ if ($[0] !== options) {
35
+ t2 = select.collection({
36
+ items: [...options],
37
+ itemToValue: _temp,
38
+ itemToString: _temp2
39
+ });
40
+ $[0] = options;
41
+ $[1] = t2;
42
+ } else {
43
+ t2 = $[1];
44
+ }
45
+ const collection = t2;
46
+ let t3;
47
+ if ($[2] !== value) {
48
+ t3 = value === undefined ? [] : [value];
49
+ $[2] = value;
50
+ $[3] = t3;
51
+ } else {
52
+ t3 = $[3];
53
+ }
54
+ let t4;
55
+ if ($[4] !== onChange) {
56
+ t4 = details => {
57
+ const next = details.value[0];
58
+ if (next !== undefined) {
59
+ onChange(next);
60
+ }
61
+ };
62
+ $[4] = onChange;
63
+ $[5] = t4;
64
+ } else {
65
+ t4 = $[5];
66
+ }
67
+ let t5;
68
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
69
+ t5 = {
70
+ placement: "bottom-start",
71
+ gutter: space[1],
72
+ sameWidth: true,
73
+ overflowPadding: space[3]
74
+ };
75
+ $[6] = t5;
76
+ } else {
77
+ t5 = $[6];
78
+ }
79
+ let t6;
80
+ if ($[7] !== collection || $[8] !== disabled || $[9] !== id || $[10] !== invalid || $[11] !== name || $[12] !== t3 || $[13] !== t4) {
81
+ t6 = {
82
+ id,
83
+ collection,
84
+ value: t3,
85
+ onValueChange: t4,
86
+ disabled,
87
+ invalid,
88
+ name,
89
+ positioning: t5
90
+ };
91
+ $[7] = collection;
92
+ $[8] = disabled;
93
+ $[9] = id;
94
+ $[10] = invalid;
95
+ $[11] = name;
96
+ $[12] = t3;
97
+ $[13] = t4;
98
+ $[14] = t6;
99
+ } else {
100
+ t6 = $[14];
101
+ }
102
+ const service = useMachine(select.machine, t6);
103
+ const api = select.connect(service, normalizeProps);
104
+ let t7;
105
+ if ($[15] !== service) {
106
+ t7 = () => select.connect(service, normalizeProps);
107
+ $[15] = service;
108
+ $[16] = t7;
109
+ } else {
110
+ t7 = $[16];
111
+ }
112
+ const current = t7;
113
+ const {
114
+ htmlFor: _for,
115
+ ...labelProps
116
+ } = api.getLabelProps();
117
+ const {
118
+ role: _role,
119
+ "aria-invalid": _invalid,
120
+ "aria-required": _required,
121
+ onKeyDown: _onTriggerKeyDown,
122
+ ...triggerProps
123
+ } = api.getTriggerProps();
124
+ const positioner = useRef(null);
125
+ const surface = useRef(null);
126
+ const {
127
+ onKeyDown: _onContentKeyDown,
128
+ ...contentProps
129
+ } = api.getContentProps();
130
+ const content = {
131
+ ...contentProps,
132
+ onKeyDown: event => {
133
+ keepListKeys(event, surface.current, ".xds-select__item:not([data-disabled])", row => api.setHighlightedValue(row));
134
+ current().getContentProps().onKeyDown?.(event);
135
+ }
136
+ };
137
+ let t8;
138
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
139
+ t8 = () => positioner.current;
140
+ $[17] = t8;
141
+ } else {
142
+ t8 = $[17];
143
+ }
144
+ useModalPopover(api.open, t8);
145
+ const present = usePresence(api.open, () => [surface.current]);
146
+ const t9 = mergeProps(api.getRootProps(), {
147
+ className: classes("xds-select", className),
148
+ style
149
+ });
150
+ let t10;
151
+ if ($[18] !== current) {
152
+ t10 = event_0 => {
153
+ const now = current();
154
+ if (!now.open && (event_0.key === "Home" || event_0.key === "End")) {
155
+ return;
156
+ }
157
+ now.getTriggerProps().onKeyDown?.(event_0);
158
+ };
159
+ $[18] = current;
160
+ $[19] = t10;
161
+ } else {
162
+ t10 = $[19];
163
+ }
164
+ let t11;
165
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
166
+ t11 = /*#__PURE__*/_jsx(Icon, {
167
+ name: "chevrons-up-down",
168
+ size: "sm",
169
+ className: "text-xds-field-placeholder"
170
+ });
171
+ $[20] = t11;
172
+ } else {
173
+ t11 = $[20];
174
+ }
175
+ let t12;
176
+ if ($[21] !== description || $[22] !== descriptionId || $[23] !== error || $[24] !== errorId || $[25] !== invalid) {
177
+ t12 = (invalid || description) && /*#__PURE__*/_jsx("div", {
178
+ className: "xds-select__footer",
179
+ children: invalid ? /*#__PURE__*/_jsx("span", {
180
+ id: errorId,
181
+ className: "xds-select__error",
182
+ children: error
183
+ }) : /*#__PURE__*/_jsx("span", {
184
+ id: descriptionId,
185
+ className: "xds-select__description",
186
+ children: description
187
+ })
188
+ });
189
+ $[21] = description;
190
+ $[22] = descriptionId;
191
+ $[23] = error;
192
+ $[24] = errorId;
193
+ $[25] = invalid;
194
+ $[26] = t12;
195
+ } else {
196
+ t12 = $[26];
197
+ }
198
+ const t13 = api.getHiddenSelectProps();
199
+ let t14;
200
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
201
+ t14 = /*#__PURE__*/_jsx("option", {
202
+ value: ""
203
+ });
204
+ $[27] = t14;
205
+ } else {
206
+ t14 = $[27];
207
+ }
208
+ let t15;
209
+ if ($[28] !== options) {
210
+ t15 = options.map(_temp3);
211
+ $[28] = options;
212
+ $[29] = t15;
213
+ } else {
214
+ t15 = $[29];
215
+ }
216
+ const t16 = api.getPositionerProps();
217
+ const t17 = api.getListProps();
218
+ const t18 = "xds-select__list";
219
+ const t19 = collection.items.map((option_2, index) => {
220
+ const ids = selectOptionIds(id, index);
221
+ return /*#__PURE__*/_jsxs("div", {
222
+ ...api.getItemProps({
223
+ item: option_2
224
+ }),
225
+ "aria-labelledby": ids.label,
226
+ "aria-describedby": option_2.description ? ids.description : undefined,
227
+ className: "xds-select__item",
228
+ children: [/*#__PURE__*/_jsxs("span", {
229
+ className: "xds-select__item-words",
230
+ children: [/*#__PURE__*/_jsx("span", {
231
+ ...api.getItemTextProps({
232
+ item: option_2
233
+ }),
234
+ id: ids.label,
235
+ className: "xds-select__item-label",
236
+ children: option_2.label
237
+ }), option_2.description && /*#__PURE__*/_jsx("span", {
238
+ id: ids.description,
239
+ className: "xds-select__item-description",
240
+ children: option_2.description
241
+ })]
242
+ }), api.getItemState({
243
+ item: option_2
244
+ }).selected && /*#__PURE__*/_jsx(Icon, {
245
+ name: "check",
246
+ size: "sm"
247
+ })]
248
+ }, option_2.value);
249
+ });
250
+ let t20;
251
+ if ($[30] !== t17 || $[31] !== t19) {
252
+ t20 = /*#__PURE__*/_jsx("div", {
253
+ ...t17,
254
+ className: t18,
255
+ children: t19
256
+ });
257
+ $[30] = t17;
258
+ $[31] = t19;
259
+ $[32] = t20;
260
+ } else {
261
+ t20 = $[32];
262
+ }
263
+ return /*#__PURE__*/_jsxs("div", {
264
+ ...t9,
265
+ children: [/*#__PURE__*/_jsx("span", {
266
+ ...labelProps,
267
+ className: "xds-select__label",
268
+ children: label
269
+ }), /*#__PURE__*/_jsxs("button", {
270
+ ...triggerProps,
271
+ "aria-labelledby": `${valueId} ${labelProps.id}`,
272
+ "aria-describedby": invalid ? errorId : description ? descriptionId : undefined,
273
+ onKeyDown: t10,
274
+ type: "button",
275
+ className: "xds-select__trigger",
276
+ children: [/*#__PURE__*/_jsx("span", {
277
+ ...api.getValueTextProps(),
278
+ id: valueId,
279
+ className: "xds-select__value",
280
+ children: api.valueAsString || placeholder
281
+ }), t11]
282
+ }), t12, /*#__PURE__*/_jsxs("select", {
283
+ ...t13,
284
+ children: [t14, t15]
285
+ }), /*#__PURE__*/_jsxs(Portal, {
286
+ children: [api.open && /*#__PURE__*/_jsx("div", {
287
+ className: "xds-select__underlay",
288
+ onMouseDown: _temp4
289
+ }), /*#__PURE__*/_jsx("div", {
290
+ ...t16,
291
+ ref: positioner,
292
+ className: "xds-select__positioner",
293
+ children: /*#__PURE__*/_jsx("div", {
294
+ ...content,
295
+ ref: surface,
296
+ hidden: !present,
297
+ className: "xds-select__content",
298
+ children: t20
299
+ })
300
+ })]
301
+ })]
302
+ });
303
+ }
304
+ function _temp4(event_1) {
305
+ return event_1.preventDefault();
306
+ }
307
+ function _temp3(option_1) {
308
+ return /*#__PURE__*/_jsx("option", {
309
+ value: option_1.value,
310
+ children: option_1.label
311
+ }, option_1.value);
312
+ }
313
+ function _temp2(option_0) {
314
+ return option_0.label;
315
+ }
316
+ function _temp(option) {
317
+ return option.value;
318
+ }
@@ -0,0 +1,21 @@
1
+ import { type SidebarBaseProps } from "@xds/core";
2
+ import { type ReactNode } from "react";
3
+ import type { RootProps } from "./root.ts";
4
+ export type { SidebarItem, SidebarSection } from "@xds/core";
5
+ export type SidebarProps<Value extends string = string> = SidebarBaseProps<Value> & RootProps & {
6
+ onChange: (value: Value) => void;
7
+ /** At the top, such as the app's name. It has to fit the rail itself while collapsed. */
8
+ header?: ReactNode;
9
+ /** At the bottom, such as an account row. It has to fit the rail itself while collapsed. */
10
+ footer?: ReactNode;
11
+ };
12
+ /**
13
+ * The top-level places of an app used with a pointer: the counterpart of TabBar on touch. Each
14
+ * row is a compact list row; the current one is selected, its title heavier and its icon
15
+ * filled, so the place does not depend on the tint alone.
16
+ *
17
+ * It is navigation named by `label`, and the current row says it is the current page.
18
+ * Collapsed, the rows keep their names, and show them in a Tooltip under a pointer and on
19
+ * keyboard focus.
20
+ */
21
+ export declare function Sidebar<Value extends string = string>({ sections, value, onChange, label, collapsed, header, footer, className, style, }: SidebarProps<Value>): import("react").JSX.Element;
@@ -0,0 +1,220 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart, SIDEBAR_PARTS, sidebarClass, sidebarCount, sidebarIconClass, sidebarRailButtonClass, sidebarSectionClass, sidebarTitleClass } from "@xds/core";
3
+ import { useId } from "react";
4
+ import { Icon } from "./Icon.js";
5
+ import { PlaceRow } from "./ListRow.js";
6
+ import { TooltipBeside } from "./Tooltip.js";
7
+ import { useTrigger } from "./trigger.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function Sidebar(t0) {
10
+ const $ = _c(27);
11
+ const {
12
+ sections,
13
+ value,
14
+ onChange,
15
+ label,
16
+ collapsed: t1,
17
+ header,
18
+ footer,
19
+ className,
20
+ style
21
+ } = t0;
22
+ const collapsed = t1 === undefined ? false : t1;
23
+ const id = useId();
24
+ let t2;
25
+ if ($[0] !== className || $[1] !== collapsed) {
26
+ t2 = classes(rootPart("Sidebar"), sidebarClass(collapsed), className);
27
+ $[0] = className;
28
+ $[1] = collapsed;
29
+ $[2] = t2;
30
+ } else {
31
+ t2 = $[2];
32
+ }
33
+ let t3;
34
+ if ($[3] !== header) {
35
+ t3 = header != null && /*#__PURE__*/_jsx("div", {
36
+ className: SIDEBAR_PARTS.edge,
37
+ children: header
38
+ });
39
+ $[3] = header;
40
+ $[4] = t3;
41
+ } else {
42
+ t3 = $[4];
43
+ }
44
+ let t4;
45
+ if ($[5] !== collapsed || $[6] !== id || $[7] !== onChange || $[8] !== sections || $[9] !== value) {
46
+ let t5;
47
+ if ($[11] !== collapsed || $[12] !== id || $[13] !== onChange || $[14] !== value) {
48
+ t5 = (section, index) => {
49
+ const title = `${id}-${index}`;
50
+ return /*#__PURE__*/_jsxs("div", {
51
+ className: sidebarSectionClass(index, collapsed),
52
+ children: [section.title && /*#__PURE__*/_jsx("p", {
53
+ id: title,
54
+ className: sidebarTitleClass(collapsed),
55
+ children: section.title
56
+ }), collapsed && index > 0 && /*#__PURE__*/_jsx("div", {
57
+ "aria-hidden": "true",
58
+ className: SIDEBAR_PARTS.rule
59
+ }), /*#__PURE__*/_jsx("ul", {
60
+ ...(section.title ? {
61
+ "aria-labelledby": title
62
+ } : {}),
63
+ className: SIDEBAR_PARTS.list,
64
+ children: section.items.map(item => {
65
+ const selected = item.value === value;
66
+ const count = sidebarCount(item.count);
67
+ return /*#__PURE__*/_jsx("li", {
68
+ className: SIDEBAR_PARTS.item,
69
+ children: collapsed ? /*#__PURE__*/_jsx(TooltipBeside, {
70
+ label: item.label,
71
+ children: /*#__PURE__*/_jsx(RailButton, {
72
+ label: item.label,
73
+ icon: item.icon,
74
+ selected: selected,
75
+ onPress: () => onChange(item.value)
76
+ })
77
+ }) : /*#__PURE__*/_jsx(PlaceRow, {
78
+ compact: true,
79
+ current: "page",
80
+ selected: selected,
81
+ onPress: () => onChange(item.value),
82
+ title: item.label,
83
+ leading: /*#__PURE__*/_jsx(Icon, {
84
+ name: item.icon,
85
+ size: "md",
86
+ filled: selected,
87
+ className: sidebarIconClass(selected)
88
+ }),
89
+ trailing: count !== undefined && /*#__PURE__*/_jsx("span", {
90
+ className: SIDEBAR_PARTS.count,
91
+ children: count
92
+ })
93
+ })
94
+ }, item.value);
95
+ })
96
+ })]
97
+ }, index);
98
+ };
99
+ $[11] = collapsed;
100
+ $[12] = id;
101
+ $[13] = onChange;
102
+ $[14] = value;
103
+ $[15] = t5;
104
+ } else {
105
+ t5 = $[15];
106
+ }
107
+ t4 = sections.map(t5);
108
+ $[5] = collapsed;
109
+ $[6] = id;
110
+ $[7] = onChange;
111
+ $[8] = sections;
112
+ $[9] = value;
113
+ $[10] = t4;
114
+ } else {
115
+ t4 = $[10];
116
+ }
117
+ let t5;
118
+ if ($[16] !== t4) {
119
+ t5 = /*#__PURE__*/_jsx("div", {
120
+ className: SIDEBAR_PARTS.places,
121
+ children: t4
122
+ });
123
+ $[16] = t4;
124
+ $[17] = t5;
125
+ } else {
126
+ t5 = $[17];
127
+ }
128
+ let t6;
129
+ if ($[18] !== footer) {
130
+ t6 = footer != null && /*#__PURE__*/_jsx("div", {
131
+ className: SIDEBAR_PARTS.edge,
132
+ children: footer
133
+ });
134
+ $[18] = footer;
135
+ $[19] = t6;
136
+ } else {
137
+ t6 = $[19];
138
+ }
139
+ let t7;
140
+ if ($[20] !== label || $[21] !== style || $[22] !== t2 || $[23] !== t3 || $[24] !== t5 || $[25] !== t6) {
141
+ t7 = /*#__PURE__*/_jsxs("nav", {
142
+ "aria-label": label,
143
+ className: t2,
144
+ style: style,
145
+ children: [t3, t5, t6]
146
+ });
147
+ $[20] = label;
148
+ $[21] = style;
149
+ $[22] = t2;
150
+ $[23] = t3;
151
+ $[24] = t5;
152
+ $[25] = t6;
153
+ $[26] = t7;
154
+ } else {
155
+ t7 = $[26];
156
+ }
157
+ return t7;
158
+ }
159
+ function RailButton(t0) {
160
+ const $ = _c(13);
161
+ const {
162
+ label,
163
+ icon,
164
+ selected,
165
+ onPress
166
+ } = t0;
167
+ let t1;
168
+ if ($[0] !== selected) {
169
+ t1 = sidebarRailButtonClass(selected);
170
+ $[0] = selected;
171
+ $[1] = t1;
172
+ } else {
173
+ t1 = $[1];
174
+ }
175
+ const t2 = selected ? "page" : undefined;
176
+ let t3;
177
+ if ($[2] !== label || $[3] !== onPress || $[4] !== t1 || $[5] !== t2) {
178
+ t3 = {
179
+ className: t1,
180
+ "aria-label": label,
181
+ "aria-current": t2,
182
+ onClick: onPress
183
+ };
184
+ $[2] = label;
185
+ $[3] = onPress;
186
+ $[4] = t1;
187
+ $[5] = t2;
188
+ $[6] = t3;
189
+ } else {
190
+ t3 = $[6];
191
+ }
192
+ const attributes = useTrigger(t3);
193
+ let t4;
194
+ if ($[7] !== icon || $[8] !== selected) {
195
+ t4 = /*#__PURE__*/_jsx(Icon, {
196
+ name: icon,
197
+ size: "md",
198
+ filled: selected
199
+ });
200
+ $[7] = icon;
201
+ $[8] = selected;
202
+ $[9] = t4;
203
+ } else {
204
+ t4 = $[9];
205
+ }
206
+ let t5;
207
+ if ($[10] !== attributes || $[11] !== t4) {
208
+ t5 = /*#__PURE__*/_jsx("button", {
209
+ ...attributes,
210
+ type: "button",
211
+ children: t4
212
+ });
213
+ $[10] = attributes;
214
+ $[11] = t4;
215
+ $[12] = t5;
216
+ } else {
217
+ t5 = $[12];
218
+ }
219
+ return t5;
220
+ }
@@ -0,0 +1,11 @@
1
+ import { type SkeletonBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type SkeletonProps = SkeletonBaseProps & RootProps;
4
+ /**
5
+ * Holds the place of content that is loading, in the shape the content will have. It pulses,
6
+ * and stands still for people who ask for less motion.
7
+ *
8
+ * It is hidden from assistive technology: the screen that shows skeletons says that it is
9
+ * loading, once, instead of every placeholder saying so.
10
+ */
11
+ export declare function Skeleton(props: SkeletonProps): import("react").JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart, skeletonClass, skeletonSize } from "@xds/core";
3
+ import { useDefaults } from "./Defaults.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export function Skeleton(props) {
6
+ const $ = _c(13);
7
+ const defaults = useDefaults("Skeleton");
8
+ const {
9
+ width,
10
+ height,
11
+ className,
12
+ style
13
+ } = props;
14
+ const shape = props.shape ?? defaults.shape;
15
+ let t0;
16
+ if ($[0] !== className || $[1] !== shape) {
17
+ t0 = classes(rootPart("Skeleton"), skeletonClass(shape), className);
18
+ $[0] = className;
19
+ $[1] = shape;
20
+ $[2] = t0;
21
+ } else {
22
+ t0 = $[2];
23
+ }
24
+ let t1;
25
+ if ($[3] !== height || $[4] !== shape || $[5] !== width) {
26
+ t1 = skeletonSize({
27
+ shape,
28
+ width,
29
+ height
30
+ });
31
+ $[3] = height;
32
+ $[4] = shape;
33
+ $[5] = width;
34
+ $[6] = t1;
35
+ } else {
36
+ t1 = $[6];
37
+ }
38
+ let t2;
39
+ if ($[7] !== style || $[8] !== t1) {
40
+ t2 = {
41
+ ...t1,
42
+ ...style
43
+ };
44
+ $[7] = style;
45
+ $[8] = t1;
46
+ $[9] = t2;
47
+ } else {
48
+ t2 = $[9];
49
+ }
50
+ let t3;
51
+ if ($[10] !== t0 || $[11] !== t2) {
52
+ t3 = /*#__PURE__*/_jsx("span", {
53
+ "aria-hidden": "true",
54
+ className: t0,
55
+ style: t2
56
+ });
57
+ $[10] = t0;
58
+ $[11] = t2;
59
+ $[12] = t3;
60
+ } else {
61
+ t3 = $[12];
62
+ }
63
+ return t3;
64
+ }
@@ -0,0 +1,13 @@
1
+ import { type SliderBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type SliderProps = SliderBaseProps & RootProps & {
4
+ onChange: (value: number) => void;
5
+ };
6
+ /**
7
+ * Picks a number in a range by dragging the thumb, or by pressing the track where it should
8
+ * go. The values snap to `step`.
9
+ *
10
+ * It is a slider named by its label with its value, minimum and maximum, and each arrow key
11
+ * moves it one step.
12
+ */
13
+ export declare function Slider({ label, value, onChange, min, max, step, disabled, showValue, className, style, }: SliderProps): import("react").JSX.Element;