@xenosystem/elements-react 0.0.10 → 0.0.12

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 (89) hide show
  1. package/dist/containers/Avatar.d.ts +8 -1
  2. package/dist/containers/Avatar.js +3 -3
  3. package/dist/containers/BulkActionBar.d.ts +20 -0
  4. package/dist/containers/BulkActionBar.js +8 -0
  5. package/dist/containers/DataTable.d.ts +50 -6
  6. package/dist/containers/DataTable.js +185 -11
  7. package/dist/containers/Table.d.ts +2 -2
  8. package/dist/containers/Table.js +4 -3
  9. package/dist/content/Kbd.d.ts +16 -0
  10. package/dist/content/Kbd.js +8 -0
  11. package/dist/forms/FormField.d.ts +32 -0
  12. package/dist/forms/FormField.js +26 -0
  13. package/dist/forms/NumberInput.d.ts +27 -0
  14. package/dist/forms/NumberInput.js +69 -0
  15. package/dist/forms/Select.d.ts +84 -0
  16. package/dist/forms/Select.js +243 -0
  17. package/dist/forms/Slider.d.ts +38 -0
  18. package/dist/forms/Slider.js +31 -0
  19. package/dist/index.d.ts +20 -1
  20. package/dist/index.js +20 -1
  21. package/dist/nav/Breadcrumb.d.ts +22 -0
  22. package/dist/nav/Breadcrumb.js +10 -0
  23. package/dist/nav/Pagination.d.ts +22 -0
  24. package/dist/nav/Pagination.js +35 -0
  25. package/dist/overlays/CommandPalette.d.ts +43 -0
  26. package/dist/overlays/CommandPalette.js +96 -0
  27. package/dist/overlays/Drawer.d.ts +30 -0
  28. package/dist/overlays/Drawer.js +41 -0
  29. package/dist/overlays/Popover.d.ts +27 -12
  30. package/dist/overlays/Popover.js +104 -7
  31. package/dist/overlays/ShortcutsSheet.d.ts +21 -0
  32. package/dist/overlays/ShortcutsSheet.js +7 -0
  33. package/dist/overlays/Tooltip.d.ts +21 -10
  34. package/dist/overlays/Tooltip.js +93 -9
  35. package/dist/shortcuts.d.ts +45 -0
  36. package/dist/shortcuts.js +164 -0
  37. package/dist/status/Banner.d.ts +23 -0
  38. package/dist/status/Banner.js +8 -0
  39. package/dist/status/EmptyState.d.ts +20 -0
  40. package/dist/status/EmptyState.js +9 -0
  41. package/dist/status/Skeleton.d.ts +36 -0
  42. package/dist/status/Skeleton.js +31 -0
  43. package/dist/status/Toast.d.ts +28 -0
  44. package/dist/status/Toast.js +11 -0
  45. package/dist/uiTree.d.ts +53 -0
  46. package/dist/uiTree.js +197 -0
  47. package/dist/useDialog.d.ts +3 -1
  48. package/dist/useDialog.js +37 -1
  49. package/dist/useMenu.js +31 -1
  50. package/dist/useToastQueue.d.ts +29 -0
  51. package/dist/useToastQueue.js +73 -0
  52. package/package.json +9 -3
  53. package/src/chrome-separated.css +133 -72
  54. package/src/chrome-unified.css +48 -16
  55. package/src/containers/Badges.css +52 -28
  56. package/src/containers/avatar.css +7 -2
  57. package/src/containers/bulk-action-bar.css +45 -0
  58. package/src/containers/card.css +14 -13
  59. package/src/containers/chip.css +1 -1
  60. package/src/containers/panel.css +16 -53
  61. package/src/containers/table.css +107 -1
  62. package/src/content/kbd.css +33 -0
  63. package/src/content/model-picker.css +2 -1
  64. package/src/controls.css +25 -11
  65. package/src/fonts.css +8 -2
  66. package/src/forced-colors.css +41 -0
  67. package/src/forms/form-field.css +78 -0
  68. package/src/forms/number-input.css +86 -0
  69. package/src/forms/select.css +210 -0
  70. package/src/forms/slider.css +145 -0
  71. package/src/layout-platform.css +495 -0
  72. package/src/mcp-app-platform.css +1019 -0
  73. package/src/nav/breadcrumb.css +84 -0
  74. package/src/nav/pagination.css +61 -0
  75. package/src/overlays/command-palette.css +157 -0
  76. package/src/overlays/drawer.css +79 -0
  77. package/src/overlays/menu.css +25 -16
  78. package/src/overlays/modal.css +9 -27
  79. package/src/overlays/onboarding.css +1305 -0
  80. package/src/overlays/segmented-control.css +6 -3
  81. package/src/overlays/shortcuts-sheet.css +55 -0
  82. package/src/overlays/tooltip.css +22 -4
  83. package/src/size.css +40 -0
  84. package/src/status/banner.css +83 -0
  85. package/src/status/empty-state.css +56 -0
  86. package/src/status/skeleton.css +70 -0
  87. package/src/status/toast.css +95 -0
  88. package/src/xeno-elements.css +71 -44
  89. package/src/xeno-theme.css +75 -31
@@ -0,0 +1,84 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import { type ControlSizeToken } from '../controls/util.js';
3
+ export interface SelectOption {
4
+ readonly value: string;
5
+ readonly label: string;
6
+ readonly description?: string;
7
+ readonly disabled?: boolean;
8
+ readonly group?: string;
9
+ }
10
+ export interface SelectProps {
11
+ /** Ordered list of selectable options. */
12
+ readonly options: readonly SelectOption[];
13
+ /** Controlled selected option value. */
14
+ readonly value?: string;
15
+ /** Initial value when uncontrolled. */
16
+ readonly defaultValue?: string;
17
+ /** Called when the user selects an option. */
18
+ readonly onChange?: (value: string) => void;
19
+ /** Placeholder when no option is selected. */
20
+ readonly placeholder?: string;
21
+ /** Accessible label for the trigger button. */
22
+ readonly label?: string;
23
+ /** HTML id for `<FormField>` label association. */
24
+ readonly id?: string;
25
+ /** ARIA describedby id(s) from `<FormField>`. */
26
+ readonly 'aria-describedby'?: string;
27
+ /** Validation invalid marker. */
28
+ readonly 'aria-invalid'?: boolean;
29
+ /** Disables interaction. */
30
+ readonly disabled?: boolean;
31
+ /** Renders a zero-CLS skeleton bone matching the trigger footprint when true. */
32
+ readonly loading?: boolean;
33
+ /** Size token (`sm` | `md` | `lg`). Defaults to `'md'`. */
34
+ readonly size?: ControlSizeToken;
35
+ /** Extra CSS class on the root wrapper. */
36
+ readonly className?: string;
37
+ /** Portal the dropdown to `document.body`. Defaults to `true`. */
38
+ readonly portal?: boolean;
39
+ }
40
+ /**
41
+ * `<Select>` — accessible single-select dropdown with portaled collision-aware listbox,
42
+ * full WAI-ARIA 1.2 keyboard navigation (`ArrowDown`/`ArrowUp`/`Home`/`End`/`Enter`/`Space`/`Escape`),
43
+ * typeahead jump, and zero-CLS `loading` mode.
44
+ */
45
+ export declare function Select({ options, value: controlledValue, defaultValue, onChange, placeholder, label, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, disabled, loading, size, className, portal, }: SelectProps): ReactElement;
46
+ export interface ComboboxProps {
47
+ /** Selectable options. */
48
+ readonly options: readonly SelectOption[];
49
+ /** Selected value (single mode) or array of values (when `multiple` is true). */
50
+ readonly value?: string | readonly string[];
51
+ /** Uncontrolled initial value(s). */
52
+ readonly defaultValue?: string | readonly string[];
53
+ /** Called with the updated string (single) or `string[]` (multiple). */
54
+ readonly onChange?: (value: string | string[]) => void;
55
+ /** Enables multi-select chips with Backspace removal. Defaults to `false`. */
56
+ readonly multiple?: boolean;
57
+ /** Search input placeholder. */
58
+ readonly placeholder?: string;
59
+ /** Accessible label for the combobox input. */
60
+ readonly label?: string;
61
+ /** HTML id for `<FormField>` association. */
62
+ readonly id?: string;
63
+ /** ARIA describedby id(s). */
64
+ readonly 'aria-describedby'?: string;
65
+ /** Validation invalid marker. */
66
+ readonly 'aria-invalid'?: boolean;
67
+ /** Empty-filter message. */
68
+ readonly emptyMessage?: ReactNode;
69
+ /** Disables interaction. */
70
+ readonly disabled?: boolean;
71
+ /** Renders a zero-CLS skeleton bone when true. */
72
+ readonly loading?: boolean;
73
+ /** Size token (`sm` | `md` | `lg`). Defaults to `'md'`. */
74
+ readonly size?: ControlSizeToken;
75
+ /** Extra CSS class. */
76
+ readonly className?: string;
77
+ /** Portal the dropdown to `document.body`. Defaults to `true`. */
78
+ readonly portal?: boolean;
79
+ }
80
+ /**
81
+ * `<Combobox>` — WAI-ARIA 1.2 searchable single/multi-select combobox with live filtering,
82
+ * `aria-activedescendant`, portaled listbox, removable selection chips, and zero-CLS `loading`.
83
+ */
84
+ export declare function Combobox({ options, value: controlledValue, defaultValue, onChange, multiple, placeholder, label, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, emptyMessage, disabled, loading, size, className, portal, }: ComboboxProps): ReactElement;
@@ -0,0 +1,243 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId, useMemo, useRef, useState } from 'react';
3
+ import { cx, sizeAttr } from '../controls/util.js';
4
+ import { Popover } from '../overlays/Popover.js';
5
+ import { Skeleton } from '../status/Skeleton.js';
6
+ /**
7
+ * `<Select>` — accessible single-select dropdown with portaled collision-aware listbox,
8
+ * full WAI-ARIA 1.2 keyboard navigation (`ArrowDown`/`ArrowUp`/`Home`/`End`/`Enter`/`Space`/`Escape`),
9
+ * typeahead jump, and zero-CLS `loading` mode.
10
+ */
11
+ export function Select({ options, value: controlledValue, defaultValue, onChange, placeholder = 'Select an option…', label, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, disabled = false, loading = false, size = 'md', className, portal = true, }) {
12
+ const autoId = useId();
13
+ const triggerId = id ?? `xeno-select-${autoId}`;
14
+ const listboxId = `${triggerId}-listbox`;
15
+ const [uncontrolled, setUncontrolled] = useState(defaultValue ?? '');
16
+ const [open, setOpen] = useState(false);
17
+ const [activeIndex, setActiveIndex] = useState(0);
18
+ const triggerRef = useRef(null);
19
+ const current = controlledValue ?? uncontrolled;
20
+ const selected = useMemo(() => options.find((o) => o.value === current), [options, current]);
21
+ const enabledIndices = useMemo(() => options.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0), [options]);
22
+ const openMenu = () => {
23
+ if (disabled || loading)
24
+ return;
25
+ const curIdx = options.findIndex((o) => o.value === current && !o.disabled);
26
+ setActiveIndex(curIdx >= 0 ? curIdx : (enabledIndices[0] ?? 0));
27
+ setOpen(true);
28
+ };
29
+ const commit = (opt) => {
30
+ if (opt.disabled)
31
+ return;
32
+ if (controlledValue === undefined)
33
+ setUncontrolled(opt.value);
34
+ onChange?.(opt.value);
35
+ setOpen(false);
36
+ triggerRef.current?.focus();
37
+ };
38
+ const move = (dir) => {
39
+ if (enabledIndices.length === 0)
40
+ return;
41
+ const pos = enabledIndices.indexOf(activeIndex);
42
+ const nextPos = pos < 0 ? 0 : (pos + dir + enabledIndices.length) % enabledIndices.length;
43
+ setActiveIndex(enabledIndices[nextPos]);
44
+ };
45
+ const onTriggerKeyDown = (e) => {
46
+ if (disabled || loading)
47
+ return;
48
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === ' ') {
49
+ e.preventDefault();
50
+ if (!open) {
51
+ openMenu();
52
+ }
53
+ else if (e.key === 'ArrowDown') {
54
+ move(1);
55
+ }
56
+ else if (e.key === 'ArrowUp') {
57
+ move(-1);
58
+ }
59
+ else {
60
+ const opt = options[activeIndex];
61
+ if (opt)
62
+ commit(opt);
63
+ }
64
+ }
65
+ else if (e.key === 'Home' && open && enabledIndices.length > 0) {
66
+ e.preventDefault();
67
+ setActiveIndex(enabledIndices[0]);
68
+ }
69
+ else if (e.key === 'End' && open && enabledIndices.length > 0) {
70
+ e.preventDefault();
71
+ setActiveIndex(enabledIndices[enabledIndices.length - 1]);
72
+ }
73
+ else if (e.key === 'Escape' && open) {
74
+ e.preventDefault();
75
+ setOpen(false);
76
+ }
77
+ else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
78
+ const ch = e.key.toLowerCase();
79
+ const hit = options.findIndex((o) => !o.disabled && o.label.toLowerCase().startsWith(ch));
80
+ if (hit >= 0) {
81
+ setActiveIndex(hit);
82
+ if (!open)
83
+ commit(options[hit]);
84
+ }
85
+ }
86
+ };
87
+ const activeOptionId = open && options[activeIndex] ? `${listboxId}-opt-${activeIndex}` : undefined;
88
+ return (_jsx(Popover, { open: open, onOpenChange: setOpen, portal: portal, className: cx('xeno-select', className), trigger: _jsxs("button", { ref: triggerRef, id: triggerId, type: "button", role: "combobox", "aria-expanded": open, "aria-controls": listboxId, "aria-haspopup": "listbox", "aria-activedescendant": activeOptionId, "aria-label": label, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid || undefined, "aria-busy": loading || undefined, disabled: disabled || loading, className: "xeno-select-trigger", "data-open": open ? 'true' : undefined, "data-placeholder": !selected ? 'true' : undefined, ...sizeAttr(size), onClick: () => (open ? setOpen(false) : openMenu()), onKeyDown: onTriggerKeyDown, children: [_jsx("span", { className: "xeno-select-value", children: loading ? (_jsx(Skeleton, { width: "68%", height: 12 })) : (selected?.label ?? placeholder) }), _jsx("svg", { className: "xeno-select-caret", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: _jsx("path", { d: "M3 4.5l3 3 3-3" }) })] }), panelProps: {
89
+ role: 'listbox',
90
+ id: listboxId,
91
+ 'aria-label': label ?? 'Options',
92
+ className: 'xeno-select-list',
93
+ }, children: options.length === 0 ? (_jsx("div", { className: "xeno-select-empty", children: "No options" })) : (options.map((opt, idx) => {
94
+ const isSelected = opt.value === current;
95
+ const isActive = idx === activeIndex;
96
+ return (_jsxs("div", { id: `${listboxId}-opt-${idx}`, role: "option", "aria-selected": isSelected, "aria-disabled": opt.disabled || undefined, className: "xeno-select-option", "data-selected": isSelected ? 'true' : undefined, "data-active": isActive ? 'true' : undefined, "data-disabled": opt.disabled ? 'true' : undefined, onMouseEnter: () => {
97
+ if (!opt.disabled)
98
+ setActiveIndex(idx);
99
+ }, onMouseDown: (e) => {
100
+ e.preventDefault();
101
+ commit(opt);
102
+ }, children: [_jsxs("span", { className: "xeno-select-opt-text", children: [_jsx("span", { className: "xeno-select-opt-label", children: opt.label }), opt.description ? (_jsx("span", { className: "xeno-select-opt-desc", children: opt.description })) : null] }), isSelected ? (_jsx("svg", { className: "xeno-select-check", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: _jsx("path", { d: "M2.5 6.5l2.2 2.2 4.8-5.2" }) })) : null] }, opt.value));
103
+ })) }));
104
+ }
105
+ function toArray(v) {
106
+ if (v === undefined)
107
+ return [];
108
+ if (typeof v === 'string')
109
+ return v ? [v] : [];
110
+ return Array.from(v);
111
+ }
112
+ /**
113
+ * `<Combobox>` — WAI-ARIA 1.2 searchable single/multi-select combobox with live filtering,
114
+ * `aria-activedescendant`, portaled listbox, removable selection chips, and zero-CLS `loading`.
115
+ */
116
+ export function Combobox({ options, value: controlledValue, defaultValue, onChange, multiple = false, placeholder = 'Search or select…', label = 'Combobox', id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, emptyMessage = 'No matching options', disabled = false, loading = false, size = 'md', className, portal = true, }) {
117
+ const autoId = useId();
118
+ const inputId = id ?? `xeno-combobox-${autoId}`;
119
+ const listboxId = `${inputId}-listbox`;
120
+ const [uncontrolled, setUncontrolled] = useState(() => toArray(defaultValue));
121
+ const selectedValues = controlledValue !== undefined ? toArray(controlledValue) : uncontrolled;
122
+ const singleSelected = !multiple
123
+ ? options.find((o) => o.value === selectedValues[0])
124
+ : undefined;
125
+ const [open, setOpen] = useState(false);
126
+ const [query, setQuery] = useState(() => (!multiple && singleSelected ? singleSelected.label : ''));
127
+ const [activeIndex, setActiveIndex] = useState(0);
128
+ const inputRef = useRef(null);
129
+ const filtered = useMemo(() => {
130
+ const q = query.trim().toLowerCase();
131
+ if (!q)
132
+ return options;
133
+ return options.filter((o) => o.label.toLowerCase().includes(q) ||
134
+ (o.description?.toLowerCase().includes(q) ?? false) ||
135
+ o.value.toLowerCase().includes(q));
136
+ }, [options, query]);
137
+ const emit = (next) => {
138
+ if (controlledValue === undefined)
139
+ setUncontrolled(next);
140
+ onChange?.(multiple ? next : (next[0] ?? ''));
141
+ };
142
+ const selectOption = (opt) => {
143
+ if (opt.disabled)
144
+ return;
145
+ if (multiple) {
146
+ const exists = selectedValues.includes(opt.value);
147
+ const next = exists
148
+ ? selectedValues.filter((v) => v !== opt.value)
149
+ : [...selectedValues, opt.value];
150
+ emit(next);
151
+ setQuery('');
152
+ inputRef.current?.focus();
153
+ }
154
+ else {
155
+ emit([opt.value]);
156
+ setQuery(opt.label);
157
+ setOpen(false);
158
+ }
159
+ };
160
+ const removeValue = (val) => {
161
+ emit(selectedValues.filter((v) => v !== val));
162
+ inputRef.current?.focus();
163
+ };
164
+ const enabledFilteredIndices = useMemo(() => filtered.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0), [filtered]);
165
+ const move = (dir) => {
166
+ if (enabledFilteredIndices.length === 0)
167
+ return;
168
+ const pos = enabledFilteredIndices.indexOf(activeIndex);
169
+ const nextPos = pos < 0 ? 0 : (pos + dir + enabledFilteredIndices.length) % enabledFilteredIndices.length;
170
+ setActiveIndex(enabledFilteredIndices[nextPos]);
171
+ };
172
+ const onKeyDown = (e) => {
173
+ if (disabled || loading)
174
+ return;
175
+ if (e.key === 'ArrowDown') {
176
+ e.preventDefault();
177
+ if (!open) {
178
+ setOpen(true);
179
+ setActiveIndex(enabledFilteredIndices[0] ?? 0);
180
+ }
181
+ else {
182
+ move(1);
183
+ }
184
+ }
185
+ else if (e.key === 'ArrowUp') {
186
+ e.preventDefault();
187
+ if (!open) {
188
+ setOpen(true);
189
+ setActiveIndex(enabledFilteredIndices[enabledFilteredIndices.length - 1] ?? 0);
190
+ }
191
+ else {
192
+ move(-1);
193
+ }
194
+ }
195
+ else if (e.key === 'Enter' && open) {
196
+ e.preventDefault();
197
+ const opt = filtered[activeIndex];
198
+ if (opt)
199
+ selectOption(opt);
200
+ }
201
+ else if (e.key === 'Escape' && open) {
202
+ e.preventDefault();
203
+ setOpen(false);
204
+ }
205
+ else if (e.key === 'Backspace' && multiple && query === '' && selectedValues.length > 0) {
206
+ removeValue(selectedValues[selectedValues.length - 1]);
207
+ }
208
+ };
209
+ const activeOptId = open && filtered[activeIndex] ? `${listboxId}-opt-${activeIndex}` : undefined;
210
+ return (_jsx(Popover, { open: open, onOpenChange: setOpen, portal: portal, className: cx('xeno-combobox', className), trigger: _jsx("div", { className: "xeno-combobox-box", "data-open": open ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, ...sizeAttr(size), onClick: () => {
211
+ if (!disabled && !loading) {
212
+ inputRef.current?.focus();
213
+ setOpen(true);
214
+ }
215
+ }, children: loading ? (_jsx(Skeleton, { width: "72%", height: 12 })) : (_jsxs(_Fragment, { children: [multiple && selectedValues.length > 0 ? (_jsx("div", { className: "xeno-combobox-chips", children: selectedValues.map((val) => {
216
+ const opt = options.find((o) => o.value === val);
217
+ return (_jsxs("span", { className: "xeno-combobox-chip", children: [_jsx("span", { children: opt?.label ?? val }), _jsx("button", { type: "button", className: "xeno-combobox-chip-x", "aria-label": `Remove ${opt?.label ?? val}`, disabled: disabled, onClick: (e) => {
218
+ e.stopPropagation();
219
+ removeValue(val);
220
+ }, children: "\u00D7" })] }, val));
221
+ }) })) : null, _jsx("input", { ref: inputRef, id: inputId, type: "text", role: "combobox", "aria-autocomplete": "list", "aria-expanded": open, "aria-controls": listboxId, "aria-activedescendant": activeOptId, "aria-label": label, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid || undefined, className: "xeno-combobox-input", value: query, placeholder: multiple && selectedValues.length > 0 ? '' : placeholder, disabled: disabled, onFocus: () => setOpen(true), onChange: (e) => {
222
+ setQuery(e.target.value);
223
+ setActiveIndex(0);
224
+ if (!open)
225
+ setOpen(true);
226
+ }, onKeyDown: onKeyDown })] })) }), panelProps: {
227
+ role: 'listbox',
228
+ id: listboxId,
229
+ 'aria-label': label,
230
+ 'aria-multiselectable': multiple || undefined,
231
+ className: 'xeno-select-list',
232
+ }, children: filtered.length === 0 ? (_jsx("div", { className: "xeno-select-empty", children: emptyMessage })) : (filtered.map((opt, idx) => {
233
+ const isSelected = selectedValues.includes(opt.value);
234
+ const isActive = idx === activeIndex;
235
+ return (_jsxs("div", { id: `${listboxId}-opt-${idx}`, role: "option", "aria-selected": isSelected, "aria-disabled": opt.disabled || undefined, className: "xeno-select-option", "data-selected": isSelected ? 'true' : undefined, "data-active": isActive ? 'true' : undefined, "data-disabled": opt.disabled ? 'true' : undefined, onMouseEnter: () => {
236
+ if (!opt.disabled)
237
+ setActiveIndex(idx);
238
+ }, onMouseDown: (e) => {
239
+ e.preventDefault();
240
+ selectOption(opt);
241
+ }, children: [_jsxs("span", { className: "xeno-select-opt-text", children: [_jsx("span", { className: "xeno-select-opt-label", children: opt.label }), opt.description ? (_jsx("span", { className: "xeno-select-opt-desc", children: opt.description })) : null] }), isSelected ? (_jsx("svg", { className: "xeno-select-check", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: _jsx("path", { d: "M2.5 6.5l2.2 2.2 4.8-5.2" }) })) : null] }, opt.value));
242
+ })) }));
243
+ }
@@ -0,0 +1,38 @@
1
+ import type { HTMLAttributes, ReactElement } from 'react';
2
+ export interface SliderMark {
3
+ readonly value: number;
4
+ readonly label?: string;
5
+ }
6
+ export interface SliderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
7
+ /** Controlled numeric value. */
8
+ readonly value?: number;
9
+ /** Initial value when uncontrolled. */
10
+ readonly defaultValue?: number;
11
+ /** Minimum value. Defaults to `0`. */
12
+ readonly min?: number;
13
+ /** Maximum value. Defaults to `100`. */
14
+ readonly max?: number;
15
+ /** Step increment. Defaults to `1`. */
16
+ readonly step?: number;
17
+ /** Called whenever the value changes. */
18
+ readonly onChange?: (value: number) => void;
19
+ /** Accessible label (rendered visibly when `showLabel` is true). */
20
+ readonly label?: string;
21
+ /** Show the label above the track. Defaults to `false`. */
22
+ readonly showLabel?: boolean;
23
+ /** Show tabular formatted readout beside the label/track. Defaults to `false`. */
24
+ readonly showValue?: boolean;
25
+ /** Custom readout formatter (e.g. `(v) => `${v}%``). */
26
+ readonly formatValue?: (value: number) => string;
27
+ /** Optional discrete tick marks rendered along the track. */
28
+ readonly marks?: readonly SliderMark[];
29
+ /** Disables interaction. */
30
+ readonly disabled?: boolean;
31
+ /** Input id for external `<label>` / `<FormField>` association. */
32
+ readonly id?: string;
33
+ }
34
+ /**
35
+ * `<Slider>` — accessible Rung-1 continuous or stepped range control with tabular value readout,
36
+ * discrete tick marks, RTL logical direction support, and native keyboard step/Home/End/PageUp/PageDown.
37
+ */
38
+ export declare function Slider({ value: controlledValue, defaultValue, min, max, step, onChange, label, showLabel, showValue, formatValue, marks, disabled, id, className, ...rest }: SliderProps): ReactElement;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useState } from 'react';
3
+ import { cx } from '../controls/util.js';
4
+ function clamp(v, min, max) {
5
+ return Math.min(max, Math.max(min, v));
6
+ }
7
+ /**
8
+ * `<Slider>` — accessible Rung-1 continuous or stepped range control with tabular value readout,
9
+ * discrete tick marks, RTL logical direction support, and native keyboard step/Home/End/PageUp/PageDown.
10
+ */
11
+ export function Slider({ value: controlledValue, defaultValue, min = 0, max = 100, step = 1, onChange, label, showLabel = false, showValue = false, formatValue = (v) => String(v), marks, disabled = false, id, className, ...rest }) {
12
+ const autoId = useId();
13
+ const inputId = id ?? `xeno-slider-${autoId}`;
14
+ const [uncontrolled, setUncontrolled] = useState(() => clamp(defaultValue ?? min, min, max));
15
+ const current = clamp(controlledValue ?? uncontrolled, min, max);
16
+ const pct = max > min ? ((current - min) / (max - min)) * 100 : 0;
17
+ const handleChange = (e) => {
18
+ const next = clamp(Number(e.target.value), min, max);
19
+ if (controlledValue === undefined)
20
+ setUncontrolled(next);
21
+ onChange?.(next);
22
+ };
23
+ return (_jsxs("div", { className: cx('xeno-slider', className), "data-disabled": disabled ? 'true' : undefined, ...rest, children: [(showLabel && label) || showValue ? (_jsxs("div", { className: "xeno-slider-head", children: [showLabel && label ? (_jsx("label", { className: "xeno-slider-label", htmlFor: inputId, children: label })) : _jsx("span", {}), showValue ? (_jsx("span", { className: "xeno-slider-value", children: formatValue(current) })) : null] })) : null, _jsxs("div", { className: "xeno-slider-track-wrap", children: [_jsx("div", { className: "xeno-slider-track", "aria-hidden": "true", children: _jsx("div", { className: "xeno-slider-fill", style: { width: `${pct}%` } }) }), _jsx("input", { id: inputId, type: "range", className: "xeno-slider-input", min: min, max: max, step: step, value: current, disabled: disabled, "aria-label": !showLabel ? label : undefined, "aria-valuetext": formatValue(current), onChange: handleChange })] }), marks && marks.length > 0 ? (_jsx("div", { className: "xeno-slider-marks", children: marks.map((mark) => {
24
+ const mPct = max > min ? ((clamp(mark.value, min, max) - min) / (max - min)) * 100 : 0;
25
+ return (_jsx("button", { type: "button", className: "xeno-slider-mark", "data-active": current === mark.value ? 'true' : undefined, style: { insetInlineStart: `${mPct}%` }, disabled: disabled, onClick: () => {
26
+ if (controlledValue === undefined)
27
+ setUncontrolled(mark.value);
28
+ onChange?.(mark.value);
29
+ }, children: mark.label ?? formatValue(mark.value) }, mark.value));
30
+ }) })) : null] }));
31
+ }
package/dist/index.d.ts CHANGED
@@ -43,11 +43,13 @@ export { Avatar, type AvatarProps } from './containers/Avatar.js';
43
43
  export { AvatarStack, type AvatarStackProps, type AvatarStackItem } from './containers/Avatar.js';
44
44
  export { ListRow, type ListRowProps } from './containers/ListRow.js';
45
45
  export { Table, type TableProps, THead, type THeadProps, TBody, type TBodyProps, Tr, type TrProps, Th, type ThProps, Td, type TdProps, type ColumnAlign, } from './containers/Table.js';
46
- export { DataTable, type DataTableProps, type DataTableColumn } from './containers/DataTable.js';
46
+ export { DataTable, type DataTableProps, type DataTableColumn, type DataTableSort, type DataTableSortDirection, } from './containers/DataTable.js';
47
+ export { BulkActionBar, type BulkActionBarProps } from './containers/BulkActionBar.js';
47
48
  export { Popover, type PopoverProps } from './overlays/Popover.js';
48
49
  export { Menu, type MenuProps } from './overlays/Menu.js';
49
50
  export { MenuItem, type MenuItemProps, type MenuItemVariant } from './overlays/MenuItem.js';
50
51
  export { Modal, Sheet, type ModalProps, type SheetProps, type ModalVariant } from './overlays/Modal.js';
52
+ export { Drawer, type DrawerProps, type DrawerSide } from './overlays/Drawer.js';
51
53
  export { Tabs, type TabsProps, type TabItem } from './overlays/Tabs.js';
52
54
  export { SegmentedControl, type SegmentedControlProps, type SegmentedOption } from './overlays/SegmentedControl.js';
53
55
  export { PillFilter, type PillFilterProps, type PillOption } from './overlays/PillFilter.js';
@@ -56,20 +58,37 @@ export { PickerField, type PickerFieldProps } from './overlays/PickerField.js';
56
58
  export { Reveal, type RevealProps } from './overlays/Reveal.js';
57
59
  export { DatePicker, type DatePickerProps, TimePicker, type TimePickerProps } from './overlays/DateTimePicker.js';
58
60
  export type { DateParts, MonthParts, TimeValue, Meridiem } from './overlays/DateTimePicker.js';
61
+ export { CommandPalette, type CommandPaletteProps, type CommandPaletteItem, } from './overlays/CommandPalette.js';
62
+ export { ShortcutsSheet, type ShortcutsSheetProps, type ShortcutSection, type ShortcutEntry, } from './overlays/ShortcutsSheet.js';
59
63
  export { Checkbox, type CheckboxProps, type CheckboxState } from './forms/Checkbox.js';
60
64
  export { RadioGroup, type RadioGroupProps, RadioRow, type RadioRowProps, type RadioOption } from './forms/RadioGroup.js';
65
+ export { FormField, type FormFieldProps, type FormFieldControlProps } from './forms/FormField.js';
66
+ export { Select, Combobox, type SelectProps, type ComboboxProps, type SelectOption } from './forms/Select.js';
67
+ export { Slider, type SliderProps, type SliderMark } from './forms/Slider.js';
68
+ export { NumberInput, type NumberInputProps } from './forms/NumberInput.js';
61
69
  export { CodeBlock, type CodeBlockProps, type CodeBlockOutput, type CodeBlockOutputStatus, } from './content/CodeBlock.js';
62
70
  export { SourceCard, type SourceCardProps } from './content/SourceCard.js';
63
71
  export { SourcesDisclosure, type SourcesDisclosureProps, type SourceRef } from './content/SourcesDisclosure.js';
64
72
  export { ModelPicker, type ModelPickerProps, type ModelOption, type ModelPickerLayout } from './content/ModelPicker.js';
65
73
  export { InlineCode, type InlineCodeProps } from './content/InlineCode.js';
74
+ export { Kbd, type KbdProps } from './content/Kbd.js';
66
75
  export { Callout, type CalloutProps, type CalloutTone } from './content/Callout.js';
67
76
  export { Collapsible, type CollapsibleProps } from './content/Collapsible.js';
68
77
  export { Caret, type CaretProps } from './content/Caret.js';
69
78
  export { Sidebar, type SidebarProps, type SidebarItem, type SidebarSection } from './nav/Sidebar.js';
79
+ export { Breadcrumb, type BreadcrumbProps, type BreadcrumbItem } from './nav/Breadcrumb.js';
80
+ export { Pagination, type PaginationProps } from './nav/Pagination.js';
70
81
  export { ResizablePanel, type ResizablePanelProps, type ResizablePanelSide } from './layout/ResizablePanel.js';
71
82
  export { ThinkingCube, type ThinkingCubeProps, type ThinkingCubeState } from './status/ThinkingCube.js';
72
83
  export { Spinner, type SpinnerProps } from './status/Spinner.js';
73
84
  export { ProgressBar, type ProgressBarProps } from './status/ProgressBar.js';
74
85
  export { StepTimeline, type StepTimelineProps, type Step, type StepStatus } from './status/StepTimeline.js';
75
86
  export { StatusIndicator, type StatusIndicatorProps, type StatusIndicatorTone } from './status/StatusIndicator.js';
87
+ export { Banner, type BannerProps, type BannerTone } from './status/Banner.js';
88
+ export { Toast, ToastStack, type ToastProps, type ToastStackProps, type ToastTone } from './status/Toast.js';
89
+ export { Skeleton, SkeletonContainer, type SkeletonProps, type SkeletonContainerProps } from './status/Skeleton.js';
90
+ export { EmptyState, type EmptyStateProps } from './status/EmptyState.js';
91
+ export { computeTooltipPosition, type TooltipPosition } from './overlays/Tooltip.js';
92
+ export { useShortcutRegistry, formatShortcutKeys, detectShortcutCollisions, toShortcutSections, toCommandItems, type ShortcutBinding, type ShortcutCollision, type UseShortcutRegistryResult, } from './shortcuts.js';
93
+ export { useToastQueue, type QueuedToast, type PushToastInput, type UseToastQueueResult, } from './useToastQueue.js';
94
+ export { snapshotXenoUiTree, installXenoUiTree, type XenoUiRect, type XenoUiNode, type XenoUiTreeSnapshot, type XenoUiBridge, } from './uiTree.js';
package/dist/index.js CHANGED
@@ -44,12 +44,14 @@ export { Avatar } from './containers/Avatar.js';
44
44
  export { AvatarStack } from './containers/Avatar.js';
45
45
  export { ListRow } from './containers/ListRow.js';
46
46
  export { Table, THead, TBody, Tr, Th, Td, } from './containers/Table.js';
47
- export { DataTable } from './containers/DataTable.js';
47
+ export { DataTable, } from './containers/DataTable.js';
48
+ export { BulkActionBar } from './containers/BulkActionBar.js';
48
49
  // ── Overlays ────────────────────────────────────────────────────────────────────────────────────
49
50
  export { Popover } from './overlays/Popover.js';
50
51
  export { Menu } from './overlays/Menu.js';
51
52
  export { MenuItem } from './overlays/MenuItem.js';
52
53
  export { Modal, Sheet } from './overlays/Modal.js';
54
+ export { Drawer } from './overlays/Drawer.js';
53
55
  export { Tabs } from './overlays/Tabs.js';
54
56
  export { SegmentedControl } from './overlays/SegmentedControl.js';
55
57
  export { PillFilter } from './overlays/PillFilter.js';
@@ -57,20 +59,29 @@ export { Tooltip } from './overlays/Tooltip.js';
57
59
  export { PickerField } from './overlays/PickerField.js';
58
60
  export { Reveal } from './overlays/Reveal.js';
59
61
  export { DatePicker, TimePicker } from './overlays/DateTimePicker.js';
62
+ export { CommandPalette, } from './overlays/CommandPalette.js';
63
+ export { ShortcutsSheet, } from './overlays/ShortcutsSheet.js';
60
64
  // ── Forms ───────────────────────────────────────────────────────────────────────────────────────
61
65
  export { Checkbox } from './forms/Checkbox.js';
62
66
  export { RadioGroup, RadioRow } from './forms/RadioGroup.js';
67
+ export { FormField } from './forms/FormField.js';
68
+ export { Select, Combobox } from './forms/Select.js';
69
+ export { Slider } from './forms/Slider.js';
70
+ export { NumberInput } from './forms/NumberInput.js';
63
71
  // ── Content ─────────────────────────────────────────────────────────────────────────────────────
64
72
  export { CodeBlock, } from './content/CodeBlock.js';
65
73
  export { SourceCard } from './content/SourceCard.js';
66
74
  export { SourcesDisclosure } from './content/SourcesDisclosure.js';
67
75
  export { ModelPicker } from './content/ModelPicker.js';
68
76
  export { InlineCode } from './content/InlineCode.js';
77
+ export { Kbd } from './content/Kbd.js';
69
78
  export { Callout } from './content/Callout.js';
70
79
  export { Collapsible } from './content/Collapsible.js';
71
80
  export { Caret } from './content/Caret.js';
72
81
  // ── Nav ─────────────────────────────────────────────────────────────────────────────────────────
73
82
  export { Sidebar } from './nav/Sidebar.js';
83
+ export { Breadcrumb } from './nav/Breadcrumb.js';
84
+ export { Pagination } from './nav/Pagination.js';
74
85
  // ── Layout ──────────────────────────────────────────────────────────────────────────────────────
75
86
  export { ResizablePanel } from './layout/ResizablePanel.js';
76
87
  // ── Status ──────────────────────────────────────────────────────────────────────────────────────
@@ -79,3 +90,11 @@ export { Spinner } from './status/Spinner.js';
79
90
  export { ProgressBar } from './status/ProgressBar.js';
80
91
  export { StepTimeline } from './status/StepTimeline.js';
81
92
  export { StatusIndicator } from './status/StatusIndicator.js';
93
+ export { Banner } from './status/Banner.js';
94
+ export { Toast, ToastStack } from './status/Toast.js';
95
+ export { Skeleton, SkeletonContainer } from './status/Skeleton.js';
96
+ export { EmptyState } from './status/EmptyState.js';
97
+ export { computeTooltipPosition } from './overlays/Tooltip.js';
98
+ export { useShortcutRegistry, formatShortcutKeys, detectShortcutCollisions, toShortcutSections, toCommandItems, } from './shortcuts.js';
99
+ export { useToastQueue, } from './useToastQueue.js';
100
+ export { snapshotXenoUiTree, installXenoUiTree, } from './uiTree.js';
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes, ReactElement, ReactNode } from 'react';
2
+ /**
3
+ * `<Breadcrumb>` — header scope trail measured from Corpus (`Corpus / xeno-corporation ORG`) and
4
+ * Creator (`All networks / KNOW Media / Documentary`).
5
+ *
6
+ * Each item can be interactive (`onClick` / `href`) or static (`current` marks `aria-current="page"`),
7
+ * and may carry a compact mono `tag` (e.g. `ORG`, channel count).
8
+ */
9
+ export interface BreadcrumbItem {
10
+ readonly id: string;
11
+ readonly label: ReactNode;
12
+ readonly tag?: ReactNode;
13
+ readonly href?: string;
14
+ readonly onClick?: () => void;
15
+ readonly current?: boolean;
16
+ }
17
+ export interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
18
+ readonly items: readonly BreadcrumbItem[];
19
+ /** Separator character between items. Default `'/'`. */
20
+ readonly separator?: ReactNode;
21
+ }
22
+ export declare function Breadcrumb({ items, separator, className, 'aria-label': ariaLabel, ...rest }: BreadcrumbProps): ReactElement;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '../controls/util.js';
3
+ export function Breadcrumb({ items, separator = '/', className, 'aria-label': ariaLabel = 'Breadcrumb', ...rest }) {
4
+ return (_jsx("nav", { className: cx('xeno-breadcrumb', className), "aria-label": ariaLabel, ...rest, children: _jsx("ol", { className: "xeno-breadcrumb-list", children: items.map((item, idx) => {
5
+ const isLast = idx === items.length - 1;
6
+ const isCurrent = item.current ?? isLast;
7
+ const inner = (_jsxs(_Fragment, { children: [_jsx("span", { className: "xeno-breadcrumb-label", children: item.label }), item.tag !== undefined ? _jsx("span", { className: "xeno-breadcrumb-tag", children: item.tag }) : null] }));
8
+ return (_jsxs("li", { className: "xeno-breadcrumb-item", children: [idx > 0 ? (_jsx("span", { className: "xeno-breadcrumb-sep", "aria-hidden": "true", children: separator })) : null, item.href ? (_jsx("a", { href: item.href, className: "xeno-breadcrumb-link", "aria-current": isCurrent ? 'page' : undefined, onClick: item.onClick, children: inner })) : item.onClick ? (_jsx("button", { type: "button", className: "xeno-breadcrumb-btn", "aria-current": isCurrent ? 'page' : undefined, onClick: item.onClick, children: inner })) : (_jsx("span", { className: "xeno-breadcrumb-text", "aria-current": isCurrent ? 'page' : undefined, children: inner }))] }, item.id));
9
+ }) }) }));
10
+ }
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes, ReactElement } from 'react';
2
+ export interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
3
+ /** 1-based current page number. */
4
+ readonly page: number;
5
+ /** Total number of pages (>= 1). */
6
+ readonly totalPages: number;
7
+ /** Called with the next 1-based page number. */
8
+ readonly onPageChange: (page: number) => void;
9
+ /** Number of sibling pages on each side of the current page. Defaults to `1`. */
10
+ readonly siblingCount?: number;
11
+ /** Optional total item count to display a tabular range summary. */
12
+ readonly totalItems?: number;
13
+ /** Page size used with `totalItems` for summary text. */
14
+ readonly pageSize?: number;
15
+ /** Accessible `<nav>` landmark label. */
16
+ readonly label?: string;
17
+ }
18
+ /**
19
+ * `<Pagination>` — accessible 1-based page navigator with `aria-current="page"`,
20
+ * logical start/end direction controls, ellipsis condensation, and tabular-nums readout.
21
+ */
22
+ export declare function Pagination({ page, totalPages, onPageChange, siblingCount, totalItems, pageSize, label, className, ...rest }: PaginationProps): ReactElement;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '../controls/util.js';
3
+ function buildRange(page, total, siblings) {
4
+ if (total <= 5 + siblings * 2) {
5
+ return Array.from({ length: total }, (_, i) => i + 1);
6
+ }
7
+ const left = Math.max(2, page - siblings);
8
+ const right = Math.min(total - 1, page + siblings);
9
+ const out = [1];
10
+ if (left > 2)
11
+ out.push('ellipsis');
12
+ for (let p = left; p <= right; p++)
13
+ out.push(p);
14
+ if (right < total - 1)
15
+ out.push('ellipsis');
16
+ out.push(total);
17
+ return out;
18
+ }
19
+ /**
20
+ * `<Pagination>` — accessible 1-based page navigator with `aria-current="page"`,
21
+ * logical start/end direction controls, ellipsis condensation, and tabular-nums readout.
22
+ */
23
+ export function Pagination({ page, totalPages, onPageChange, siblingCount = 1, totalItems, pageSize, label = 'Pagination', className, ...rest }) {
24
+ const safeTotal = Math.max(1, Math.floor(totalPages));
25
+ const safePage = Math.max(1, Math.min(safeTotal, Math.floor(page)));
26
+ const items = buildRange(safePage, safeTotal, siblingCount);
27
+ const summary = totalItems !== undefined && pageSize !== undefined && pageSize > 0
28
+ ? (() => {
29
+ const start = totalItems === 0 ? 0 : (safePage - 1) * pageSize + 1;
30
+ const end = Math.min(totalItems, safePage * pageSize);
31
+ return `${start}–${end} of ${totalItems}`;
32
+ })()
33
+ : null;
34
+ return (_jsxs("nav", { className: cx('xeno-pagination', className), "aria-label": label, ...rest, children: [summary ? _jsx("span", { className: "xeno-pagination-summary", children: summary }) : null, _jsxs("div", { className: "xeno-pagination-pages", children: [_jsx("button", { type: "button", className: "xeno-pagination-btn", "aria-label": "Previous page", disabled: safePage <= 1, onClick: () => onPageChange(safePage - 1), children: "Prev" }), items.map((item, idx) => item === 'ellipsis' ? (_jsx("span", { className: "xeno-pagination-ellipsis", "aria-hidden": "true", children: "\u2026" }, `e-${idx}`)) : (_jsx("button", { type: "button", className: "xeno-pagination-btn", "aria-label": `Page ${item}`, "aria-current": item === safePage ? 'page' : undefined, "data-active": item === safePage ? 'true' : undefined, onClick: () => onPageChange(item), children: item }, item))), _jsx("button", { type: "button", className: "xeno-pagination-btn", "aria-label": "Next page", disabled: safePage >= safeTotal, onClick: () => onPageChange(safePage + 1), children: "Next" })] })] }));
35
+ }