@xds/solid 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/dom/Accordion.js +3 -2
- package/dist/dom/Avatar.js +17 -13
- package/dist/dom/AvatarStack.js +17 -13
- package/dist/dom/Badge.js +12 -10
- package/dist/dom/Banner.js +25 -15
- package/dist/dom/Breadcrumb.js +87 -0
- package/dist/dom/Button.js +10 -3
- package/dist/dom/Card.js +31 -26
- package/dist/dom/Checkbox.js +57 -26
- package/dist/dom/Chip.js +21 -17
- package/dist/dom/ChipBar.js +17 -13
- package/dist/dom/Combobox.js +295 -0
- package/dist/dom/CountBadge.js +28 -23
- package/dist/dom/DatePicker.js +13 -7
- package/dist/dom/DateRangePicker.js +16 -10
- package/dist/dom/Dialog.js +3 -2
- package/dist/dom/Divider.js +12 -10
- package/dist/dom/EmptyState.js +14 -11
- package/dist/dom/Icon.js +30 -19
- package/dist/dom/IconButton.js +10 -3
- package/dist/dom/Labels.js +26 -0
- package/dist/dom/Link.js +62 -0
- package/dist/dom/ListRow.js +34 -28
- package/dist/dom/MediaCard.js +32 -23
- package/dist/dom/Menu.js +18 -15
- package/dist/dom/Pagination.js +132 -0
- package/dist/dom/Popover.js +126 -0
- package/dist/dom/ProgressBar.js +27 -15
- package/dist/dom/RadioGroup.js +44 -23
- package/dist/dom/SearchField.js +58 -32
- package/dist/dom/SectionHeader.js +17 -10
- package/dist/dom/SegmentedControl.js +33 -19
- package/dist/dom/Select.js +91 -51
- package/dist/dom/Sidebar.js +17 -13
- package/dist/dom/Skeleton.js +15 -13
- package/dist/dom/Slider.js +15 -7
- package/dist/dom/Spinner.js +23 -17
- package/dist/dom/Switch.js +49 -24
- package/dist/dom/Table.js +150 -0
- package/dist/dom/Tabs.js +16 -6
- package/dist/dom/Text.js +6 -3
- package/dist/dom/TextField.js +37 -19
- package/dist/dom/Thumbnail.js +21 -14
- package/dist/dom/TimePicker.js +245 -0
- package/dist/dom/Toast.js +19 -20
- package/dist/dom/ToastQueue.js +59 -0
- package/dist/dom/Tooltip.js +10 -6
- package/dist/dom/base.js +16 -0
- package/dist/dom/controllable.js +44 -0
- package/dist/dom/index.js +10 -1
- package/dist/dom/modal-popover.js +2 -2
- package/dist/dom/presence.js +3 -2
- package/dist/dom/preview.js +20 -1
- package/dist/dom/root.js +16 -4
- package/dist/dom/rows.js +13 -0
- package/dist/dom/trigger.js +5 -3
- package/dist/source/Accordion.jsx +3 -2
- package/dist/source/Avatar.d.ts +1 -1
- package/dist/source/Avatar.jsx +2 -1
- package/dist/source/AvatarStack.d.ts +1 -1
- package/dist/source/AvatarStack.jsx +2 -1
- package/dist/source/Badge.d.ts +1 -1
- package/dist/source/Badge.jsx +2 -1
- package/dist/source/Banner.d.ts +1 -1
- package/dist/source/Banner.jsx +5 -2
- package/dist/source/Breadcrumb.d.ts +9 -0
- package/dist/source/Breadcrumb.jsx +26 -0
- package/dist/source/Button.d.ts +5 -1
- package/dist/source/Button.jsx +5 -2
- package/dist/source/Card.d.ts +1 -1
- package/dist/source/Card.jsx +3 -2
- package/dist/source/Checkbox.d.ts +10 -4
- package/dist/source/Checkbox.jsx +26 -8
- package/dist/source/Chip.d.ts +1 -1
- package/dist/source/Chip.jsx +2 -1
- package/dist/source/ChipBar.d.ts +1 -1
- package/dist/source/ChipBar.jsx +2 -1
- package/dist/source/Combobox.d.ts +16 -0
- package/dist/source/Combobox.jsx +137 -0
- package/dist/source/CountBadge.d.ts +1 -1
- package/dist/source/CountBadge.jsx +3 -2
- package/dist/source/DatePicker.jsx +13 -7
- package/dist/source/DateRangePicker.jsx +16 -10
- package/dist/source/Dialog.jsx +3 -2
- package/dist/source/Divider.d.ts +1 -1
- package/dist/source/Divider.jsx +2 -1
- package/dist/source/EmptyState.d.ts +1 -1
- package/dist/source/EmptyState.jsx +2 -1
- package/dist/source/Icon.d.ts +1 -1
- package/dist/source/Icon.jsx +2 -1
- package/dist/source/IconButton.d.ts +5 -1
- package/dist/source/IconButton.jsx +5 -2
- package/dist/source/Labels.d.ts +17 -0
- package/dist/source/Labels.jsx +11 -0
- package/dist/source/Link.d.ts +20 -0
- package/dist/source/Link.jsx +21 -0
- package/dist/source/ListRow.d.ts +1 -1
- package/dist/source/ListRow.jsx +3 -2
- package/dist/source/MediaCard.d.ts +1 -1
- package/dist/source/MediaCard.jsx +3 -2
- package/dist/source/Menu.d.ts +1 -1
- package/dist/source/Menu.jsx +11 -3
- package/dist/source/Pagination.d.ts +12 -0
- package/dist/source/Pagination.jsx +51 -0
- package/dist/source/Popover.d.ts +19 -0
- package/dist/source/Popover.jsx +65 -0
- package/dist/source/ProgressBar.d.ts +1 -1
- package/dist/source/ProgressBar.jsx +2 -1
- package/dist/source/RadioGroup.d.ts +5 -2
- package/dist/source/RadioGroup.jsx +18 -5
- package/dist/source/SearchField.d.ts +11 -3
- package/dist/source/SearchField.jsx +26 -12
- package/dist/source/SectionHeader.d.ts +1 -1
- package/dist/source/SectionHeader.jsx +2 -1
- package/dist/source/SegmentedControl.d.ts +4 -3
- package/dist/source/SegmentedControl.jsx +16 -5
- package/dist/source/Select.d.ts +10 -1
- package/dist/source/Select.jsx +46 -11
- package/dist/source/Sidebar.d.ts +1 -1
- package/dist/source/Sidebar.jsx +2 -1
- package/dist/source/Skeleton.jsx +2 -2
- package/dist/source/Slider.d.ts +2 -2
- package/dist/source/Slider.jsx +14 -6
- package/dist/source/Spinner.d.ts +1 -1
- package/dist/source/Spinner.jsx +2 -1
- package/dist/source/Switch.d.ts +10 -4
- package/dist/source/Switch.jsx +18 -6
- package/dist/source/Table.d.ts +17 -0
- package/dist/source/Table.jsx +46 -0
- package/dist/source/Tabs.d.ts +2 -2
- package/dist/source/Tabs.jsx +16 -5
- package/dist/source/Text.d.ts +1 -1
- package/dist/source/Text.jsx +2 -1
- package/dist/source/TextField.d.ts +12 -3
- package/dist/source/TextField.jsx +24 -9
- package/dist/source/Thumbnail.d.ts +1 -1
- package/dist/source/Thumbnail.jsx +2 -1
- package/dist/source/TimePicker.d.ts +19 -0
- package/dist/source/TimePicker.jsx +137 -0
- package/dist/source/Toast.d.ts +1 -1
- package/dist/source/Toast.jsx +2 -1
- package/dist/source/ToastQueue.d.ts +19 -0
- package/dist/source/ToastQueue.jsx +27 -0
- package/dist/source/Tooltip.jsx +4 -3
- package/dist/source/base.d.ts +15 -0
- package/dist/source/base.js +15 -0
- package/dist/source/controllable.d.ts +30 -0
- package/dist/source/controllable.js +30 -0
- package/dist/source/index.d.ts +10 -1
- package/dist/source/index.js +9 -0
- package/dist/source/modal-popover.js +2 -2
- package/dist/source/presence.js +3 -2
- package/dist/source/preview.d.ts +10 -2
- package/dist/source/preview.jsx +12 -2
- package/dist/source/root.d.ts +14 -4
- package/dist/source/root.js +7 -2
- package/dist/source/rows.d.ts +8 -0
- package/dist/source/rows.js +5 -0
- package/dist/source/trigger.d.ts +4 -2
- package/dist/source/trigger.js +2 -2
- package/eject/files/Accordion.tsx +138 -0
- package/eject/files/Avatar.tsx +48 -0
- package/eject/files/AvatarStack.tsx +51 -0
- package/eject/files/Badge.tsx +39 -0
- package/eject/files/Banner.tsx +80 -0
- package/eject/files/Breadcrumb.tsx +57 -0
- package/eject/files/Button.tsx +90 -0
- package/eject/files/Card.tsx +100 -0
- package/eject/files/Checkbox.tsx +100 -0
- package/eject/files/Chip.tsx +40 -0
- package/eject/files/ChipBar.tsx +34 -0
- package/eject/files/Combobox.tsx +200 -0
- package/eject/files/CountBadge.tsx +55 -0
- package/eject/files/DatePicker.tsx +225 -0
- package/eject/files/DateRangePicker.tsx +319 -0
- package/eject/files/Dialog.tsx +117 -0
- package/eject/files/Divider.tsx +21 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +37 -0
- package/eject/files/IconButton.tsx +76 -0
- package/eject/files/Link.tsx +61 -0
- package/eject/files/ListRow.tsx +94 -0
- package/eject/files/MediaCard.tsx +116 -0
- package/eject/files/Menu.tsx +190 -0
- package/eject/files/Pagination.tsx +109 -0
- package/eject/files/Popover.tsx +124 -0
- package/eject/files/ProgressBar.tsx +37 -0
- package/eject/files/RadioGroup.tsx +138 -0
- package/eject/files/SearchField.tsx +124 -0
- package/eject/files/SectionHeader.tsx +59 -0
- package/eject/files/SegmentedControl.tsx +79 -0
- package/eject/files/Select.tsx +290 -0
- package/eject/files/Sidebar.tsx +156 -0
- package/eject/files/Skeleton.tsx +33 -0
- package/eject/files/Slider.tsx +131 -0
- package/eject/files/Spinner.tsx +44 -0
- package/eject/files/Switch.tsx +88 -0
- package/eject/files/Table.tsx +98 -0
- package/eject/files/Tabs.tsx +87 -0
- package/eject/files/Text.tsx +38 -0
- package/eject/files/TextField.tsx +171 -0
- package/eject/files/Thumbnail.tsx +84 -0
- package/eject/files/TimePicker.tsx +237 -0
- package/eject/files/Toast.tsx +100 -0
- package/eject/files/ToastQueue.tsx +62 -0
- package/eject/files/Tooltip.tsx +135 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +71 -0
- package/eject/files/base.css +38 -0
- package/eject/files/breadcrumb.css +51 -0
- package/eject/files/breadcrumb.ts +42 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +52 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/combobox.css +269 -0
- package/eject/files/combobox.ts +85 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +375 -0
- package/eject/files/date-picker.ts +280 -0
- package/eject/files/date-range-picker.ts +338 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/link.css +64 -0
- package/eject/files/link.ts +63 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +192 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/overlay.css +40 -0
- package/eject/files/pagination.css +106 -0
- package/eject/files/pagination.ts +68 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/popover.css +101 -0
- package/eject/files/popover.ts +37 -0
- package/eject/files/progress-bar.ts +26 -0
- package/eject/files/radio-group.css +184 -0
- package/eject/files/radio-group.ts +30 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +33 -0
- package/eject/files/select.css +347 -0
- package/eject/files/select.ts +77 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +160 -0
- package/eject/files/slider.ts +80 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +45 -0
- package/eject/files/table.css +107 -0
- package/eject/files/table.ts +84 -0
- package/eject/files/tabs.css +120 -0
- package/eject/files/tabs.ts +37 -0
- package/eject/files/text-field.css +225 -0
- package/eject/files/text-field.ts +64 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/time-picker.ts +113 -0
- package/eject/files/toast-queue.ts +64 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +111 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +1027 -0
- package/package.json +12 -4
- package/styles.css +1066 -167
- package/tailwind.css +1295 -218
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { createControllable, resetWithForm } from "./controllable.js";
|
|
2
|
+
import { Icon } from "./Icon.js";
|
|
3
|
+
import { useLabels } from "./Labels.js";
|
|
4
|
+
import { Portal as Portal$1 } from "./portal.js";
|
|
5
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
6
|
+
import { createItemProps } from "./rows.js";
|
|
7
|
+
import { className, createComponent, effect, insert, memo, readShallow, ref, setAttribute, spread, template } from "@solidjs/web";
|
|
8
|
+
import { COMBOBOX_PARTS, classes, isControlled, matchOptions, readCssPx, selectOptionIds } from "@xds/core";
|
|
9
|
+
import { mergeProps as mergeProps$1, normalizeProps, useMachine } from "@zag-js/solid";
|
|
10
|
+
import { For, Show, createMemo, createSignal, createUniqueId } from "solid-js";
|
|
11
|
+
import { space } from "@xds/tokens";
|
|
12
|
+
import * as combobox from "@zag-js/combobox";
|
|
13
|
+
// packages/ui-solid/src/Combobox.tsx
|
|
14
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
15
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<input type=hidden>`);
|
|
16
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
17
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div><div>`);
|
|
18
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<div><label></label><div><input></div><div><span aria-live=polite></span></div><!><!>`);
|
|
19
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<div><span><span>`);
|
|
20
|
+
/**
|
|
21
|
+
* A field for choosing one option from a list by typing part of its name. As the person types,
|
|
22
|
+
* the options whose label holds what was typed open under it, those that start with it first,
|
|
23
|
+
* and the first is highlighted, so Enter chooses it. Choosing an option calls `onChange`, puts
|
|
24
|
+
* its label in the field and closes the list. Text that names no option goes back to the chosen
|
|
25
|
+
* option's label when the field is left. When nothing matches, the list says so.
|
|
26
|
+
*
|
|
27
|
+
* Without `value` it keeps its own choice, from `defaultValue`. Given `value`, even as
|
|
28
|
+
* `undefined`, it shows that.
|
|
29
|
+
*/
|
|
30
|
+
function Combobox(props) {
|
|
31
|
+
const id = createUniqueId();
|
|
32
|
+
const descriptionId = `${id}-description`;
|
|
33
|
+
const errorId = `${id}-error`;
|
|
34
|
+
const labels = useLabels();
|
|
35
|
+
const invalid = () => props.error !== void 0;
|
|
36
|
+
const controlled = () => isControlled(props, "value");
|
|
37
|
+
const value = createControllable({
|
|
38
|
+
controlled,
|
|
39
|
+
value: () => props.value,
|
|
40
|
+
defaultValue: () => props.defaultValue,
|
|
41
|
+
onChange: (next) => {
|
|
42
|
+
if (next !== void 0) props.onChange?.(next);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
let element;
|
|
46
|
+
resetWithForm(() => element, controlled, value.reset);
|
|
47
|
+
const [query, setQuery] = createSignal("");
|
|
48
|
+
const shown = createMemo(() => matchOptions(props.options, query()));
|
|
49
|
+
const collection = createMemo(() => combobox.collection({
|
|
50
|
+
items: shown(),
|
|
51
|
+
itemToValue: (option) => option.value,
|
|
52
|
+
itemToString: (option) => option.label
|
|
53
|
+
}));
|
|
54
|
+
const service = useMachine(combobox.machine, () => ({
|
|
55
|
+
id,
|
|
56
|
+
ids: { root: props.id },
|
|
57
|
+
collection: collection(),
|
|
58
|
+
value: value.value() === void 0 ? [] : [value.value()],
|
|
59
|
+
onValueChange: (details) => {
|
|
60
|
+
const next = details.value[0];
|
|
61
|
+
if (next !== void 0) value.set(next);
|
|
62
|
+
},
|
|
63
|
+
onInputValueChange: (details) => {
|
|
64
|
+
if (details.reason === "input-change") setQuery(details.inputValue);
|
|
65
|
+
},
|
|
66
|
+
onOpenChange: (details) => {
|
|
67
|
+
if (!details.open) setQuery("");
|
|
68
|
+
},
|
|
69
|
+
inputBehavior: "autohighlight",
|
|
70
|
+
selectionBehavior: "replace",
|
|
71
|
+
openOnClick: true,
|
|
72
|
+
disabled: props.disabled,
|
|
73
|
+
invalid: invalid(),
|
|
74
|
+
placeholder: props.placeholder,
|
|
75
|
+
positioning: {
|
|
76
|
+
placement: "bottom-start",
|
|
77
|
+
gutter: readCssPx(null, "--xds-space-1", space[1]),
|
|
78
|
+
sameWidth: true,
|
|
79
|
+
overflowPadding: readCssPx(null, "--xds-space-3", space[3])
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
const api = createMemo(() => combobox.connect(service, normalizeProps));
|
|
83
|
+
const input = mergeProps$1(() => api().getInputProps(), { onBlur: () => {
|
|
84
|
+
const chosen = props.options.find((option) => option.value === value.value())?.label ?? "";
|
|
85
|
+
const now = combobox.connect(service, normalizeProps);
|
|
86
|
+
if (now.inputValue !== chosen) now.setInputValue(chosen, "script");
|
|
87
|
+
} });
|
|
88
|
+
const root = withStyle(() => api().getRootProps(), () => props.style, rootAttributes(props));
|
|
89
|
+
var _el$ = _tmpl$5();
|
|
90
|
+
var _el$2 = _el$.firstChild;
|
|
91
|
+
var _el$3 = _el$2.nextSibling;
|
|
92
|
+
var _el$4 = _el$3.firstChild;
|
|
93
|
+
var _el$5 = _el$3.nextSibling;
|
|
94
|
+
var _el$7 = _el$5.firstChild;
|
|
95
|
+
var _el$9 = _el$5.nextSibling;
|
|
96
|
+
var _el$13 = _el$9.nextSibling;
|
|
97
|
+
spread(_el$, [root, { get "class"() {
|
|
98
|
+
return classes("xds-combobox", props.class);
|
|
99
|
+
} }], true);
|
|
100
|
+
ref(() => {
|
|
101
|
+
return (node) => element = node;
|
|
102
|
+
}, _el$);
|
|
103
|
+
spread(_el$2, [() => {
|
|
104
|
+
return api().getLabelProps();
|
|
105
|
+
}, { get "class"() {
|
|
106
|
+
return COMBOBOX_PARTS.label;
|
|
107
|
+
} }], true);
|
|
108
|
+
insert(_el$2, () => {
|
|
109
|
+
return props.label;
|
|
110
|
+
});
|
|
111
|
+
spread(_el$3, [() => {
|
|
112
|
+
return api().getControlProps();
|
|
113
|
+
}, { get "class"() {
|
|
114
|
+
return COMBOBOX_PARTS.control;
|
|
115
|
+
} }], true);
|
|
116
|
+
spread(_el$4, [input, {
|
|
117
|
+
get "aria-describedby"() {
|
|
118
|
+
return invalid() ? errorId : props.description ? descriptionId : void 0;
|
|
119
|
+
},
|
|
120
|
+
get "class"() {
|
|
121
|
+
return COMBOBOX_PARTS.input;
|
|
122
|
+
}
|
|
123
|
+
}], false);
|
|
124
|
+
insert(_el$3, createComponent(Icon, {
|
|
125
|
+
name: "chevrons-up-down",
|
|
126
|
+
size: "sm",
|
|
127
|
+
get "class"() {
|
|
128
|
+
return COMBOBOX_PARTS.icon;
|
|
129
|
+
}
|
|
130
|
+
}), null);
|
|
131
|
+
insert(_el$5, createComponent(Show, {
|
|
132
|
+
get when() {
|
|
133
|
+
return memo(() => {
|
|
134
|
+
return !invalid();
|
|
135
|
+
})() && props.description;
|
|
136
|
+
},
|
|
137
|
+
get children() {
|
|
138
|
+
var _el$6 = _tmpl$();
|
|
139
|
+
setAttribute(_el$6, "id", descriptionId);
|
|
140
|
+
insert(_el$6, () => {
|
|
141
|
+
return props.description;
|
|
142
|
+
});
|
|
143
|
+
effect(() => readShallow(COMBOBOX_PARTS.description), (_v$, _$p) => {
|
|
144
|
+
className(_el$6, _v$, _$p);
|
|
145
|
+
});
|
|
146
|
+
return _el$6;
|
|
147
|
+
}
|
|
148
|
+
}), _el$7);
|
|
149
|
+
setAttribute(_el$7, "id", errorId);
|
|
150
|
+
insert(_el$7, () => {
|
|
151
|
+
return props.error;
|
|
152
|
+
});
|
|
153
|
+
insert(_el$, createComponent(Show, {
|
|
154
|
+
get when() {
|
|
155
|
+
return props.name !== void 0;
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
var _el$8 = _tmpl$2();
|
|
159
|
+
effect(() => {
|
|
160
|
+
return {
|
|
161
|
+
e: props.name,
|
|
162
|
+
t: value.value() ?? ""
|
|
163
|
+
};
|
|
164
|
+
}, ({ e, t }, _p$) => {
|
|
165
|
+
e !== _p$?.e && setAttribute(_el$8, "name", e);
|
|
166
|
+
_el$8.value = t ?? "";
|
|
167
|
+
});
|
|
168
|
+
return _el$8;
|
|
169
|
+
}
|
|
170
|
+
}), _el$9);
|
|
171
|
+
insert(_el$, createComponent(Portal$1, { get children() {
|
|
172
|
+
var _el$10 = _tmpl$4();
|
|
173
|
+
var _el$11 = _el$10.firstChild;
|
|
174
|
+
spread(_el$10, [() => {
|
|
175
|
+
return api().getPositionerProps();
|
|
176
|
+
}, { get "class"() {
|
|
177
|
+
return COMBOBOX_PARTS.positioner;
|
|
178
|
+
} }], true);
|
|
179
|
+
spread(_el$11, [() => {
|
|
180
|
+
return api().getContentProps();
|
|
181
|
+
}, { get "class"() {
|
|
182
|
+
return COMBOBOX_PARTS.content;
|
|
183
|
+
} }], true);
|
|
184
|
+
insert(_el$11, createComponent(Show, {
|
|
185
|
+
get when() {
|
|
186
|
+
return shown().length > 0;
|
|
187
|
+
},
|
|
188
|
+
get fallback() {
|
|
189
|
+
var _el$14 = _tmpl$3();
|
|
190
|
+
spread(_el$14, [() => {
|
|
191
|
+
return api().getEmptyProps();
|
|
192
|
+
}, { get "class"() {
|
|
193
|
+
return COMBOBOX_PARTS.empty;
|
|
194
|
+
} }], true);
|
|
195
|
+
insert(_el$14, () => {
|
|
196
|
+
return props.emptyLabel ?? labels().noMatches;
|
|
197
|
+
});
|
|
198
|
+
return _el$14;
|
|
199
|
+
},
|
|
200
|
+
get children() {
|
|
201
|
+
var _el$12 = _tmpl$3();
|
|
202
|
+
spread(_el$12, [() => {
|
|
203
|
+
return api().getListProps();
|
|
204
|
+
}, { get "class"() {
|
|
205
|
+
return COMBOBOX_PARTS.list;
|
|
206
|
+
} }], true);
|
|
207
|
+
insert(_el$12, createComponent(For, {
|
|
208
|
+
get each() {
|
|
209
|
+
return shown();
|
|
210
|
+
},
|
|
211
|
+
children: (option, index) => {
|
|
212
|
+
const ids = () => selectOptionIds(id, index());
|
|
213
|
+
const itemProps = createItemProps(() => api().getItemProps({ item: option }));
|
|
214
|
+
const textProps = createItemProps(() => api().getItemTextProps({ item: option }));
|
|
215
|
+
const selected = createMemo(() => api().getItemState({ item: option }).selected);
|
|
216
|
+
var _el$15 = _tmpl$6();
|
|
217
|
+
var _el$16 = _el$15.firstChild;
|
|
218
|
+
var _el$17 = _el$16.firstChild;
|
|
219
|
+
spread(_el$15, [itemProps, {
|
|
220
|
+
get "aria-labelledby"() {
|
|
221
|
+
return ids().label;
|
|
222
|
+
},
|
|
223
|
+
get "aria-describedby"() {
|
|
224
|
+
return option.description ? ids().description : void 0;
|
|
225
|
+
},
|
|
226
|
+
get "class"() {
|
|
227
|
+
return COMBOBOX_PARTS.item;
|
|
228
|
+
}
|
|
229
|
+
}], true);
|
|
230
|
+
spread(_el$17, [textProps, {
|
|
231
|
+
get id() {
|
|
232
|
+
return ids().label;
|
|
233
|
+
},
|
|
234
|
+
get "class"() {
|
|
235
|
+
return COMBOBOX_PARTS.itemLabel;
|
|
236
|
+
}
|
|
237
|
+
}], true);
|
|
238
|
+
insert(_el$17, () => {
|
|
239
|
+
return option.label;
|
|
240
|
+
});
|
|
241
|
+
insert(_el$16, createComponent(Show, {
|
|
242
|
+
get when() {
|
|
243
|
+
return option.description;
|
|
244
|
+
},
|
|
245
|
+
get children() {
|
|
246
|
+
var _el$18 = _tmpl$();
|
|
247
|
+
insert(_el$18, () => {
|
|
248
|
+
return option.description;
|
|
249
|
+
});
|
|
250
|
+
effect(() => {
|
|
251
|
+
return {
|
|
252
|
+
e: ids().description,
|
|
253
|
+
t: readShallow(COMBOBOX_PARTS.itemDescription)
|
|
254
|
+
};
|
|
255
|
+
}, ({ e, t }, _p$) => {
|
|
256
|
+
e !== _p$?.e && setAttribute(_el$18, "id", e);
|
|
257
|
+
className(_el$18, t, _p$?.t);
|
|
258
|
+
});
|
|
259
|
+
return _el$18;
|
|
260
|
+
}
|
|
261
|
+
}), null);
|
|
262
|
+
insert(_el$15, createComponent(Show, {
|
|
263
|
+
get when() {
|
|
264
|
+
return selected();
|
|
265
|
+
},
|
|
266
|
+
get children() {
|
|
267
|
+
return createComponent(Icon, {
|
|
268
|
+
name: "check",
|
|
269
|
+
size: "sm"
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}), null);
|
|
273
|
+
effect(() => readShallow(COMBOBOX_PARTS.itemWords), (_v$, _$p) => {
|
|
274
|
+
className(_el$16, _v$, _$p);
|
|
275
|
+
});
|
|
276
|
+
return _el$15;
|
|
277
|
+
}
|
|
278
|
+
}));
|
|
279
|
+
return _el$12;
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
return _el$10;
|
|
283
|
+
} }), _el$13);
|
|
284
|
+
effect(() => {
|
|
285
|
+
return {
|
|
286
|
+
e: readShallow(COMBOBOX_PARTS.footer),
|
|
287
|
+
t: readShallow(COMBOBOX_PARTS.error)
|
|
288
|
+
};
|
|
289
|
+
}, ({ e, t }, _p$) => {
|
|
290
|
+
className(_el$5, e, _p$?.e);
|
|
291
|
+
className(_el$7, t, _p$?.t);
|
|
292
|
+
});
|
|
293
|
+
return _el$;
|
|
294
|
+
}
|
|
295
|
+
export { Combobox };
|
package/dist/dom/CountBadge.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rootAttributes } from "./root.js";
|
|
2
|
+
import { createComponent, insert, spread, template } from "@solidjs/web";
|
|
2
3
|
import { classes, countBadgeAnchorClass, countBadgeClass, countBadgeText, rootPart } from "@xds/core";
|
|
3
4
|
import { Show, children } from "solid-js";
|
|
4
5
|
// packages/ui-solid/src/CountBadge.tsx
|
|
@@ -17,22 +18,25 @@ function CountBadge(props) {
|
|
|
17
18
|
},
|
|
18
19
|
get children() {
|
|
19
20
|
var _el$ = _tmpl$();
|
|
21
|
+
spread(_el$, [() => {
|
|
22
|
+
return onChild ? {} : rootAttributes(props);
|
|
23
|
+
}, {
|
|
24
|
+
get role() {
|
|
25
|
+
return props.label ? "img" : void 0;
|
|
26
|
+
},
|
|
27
|
+
get "aria-label"() {
|
|
28
|
+
return props.label || void 0;
|
|
29
|
+
},
|
|
30
|
+
get "class"() {
|
|
31
|
+
return classes(!onChild && ROOT, countBadgeClass(onChild), !onChild && props.class);
|
|
32
|
+
},
|
|
33
|
+
get style() {
|
|
34
|
+
return onChild ? void 0 : props.style;
|
|
35
|
+
}
|
|
36
|
+
}], true);
|
|
20
37
|
insert(_el$, () => {
|
|
21
38
|
return countBadgeText(props.count, props.max);
|
|
22
39
|
});
|
|
23
|
-
effect(() => {
|
|
24
|
-
return {
|
|
25
|
-
e: props.label ? "img" : void 0,
|
|
26
|
-
t: props.label || void 0,
|
|
27
|
-
a: readShallow(classes(!onChild && ROOT, countBadgeClass(onChild), !onChild && props.class)),
|
|
28
|
-
o: readShallow(onChild ? void 0 : props.style)
|
|
29
|
-
};
|
|
30
|
-
}, ({ e, t, a, o }, _p$) => {
|
|
31
|
-
e !== _p$?.e && setAttribute(_el$, "role", e);
|
|
32
|
-
t !== _p$?.t && setAttribute(_el$, "aria-label", t);
|
|
33
|
-
className(_el$, a, _p$?.a);
|
|
34
|
-
style(_el$, o, _p$?.o);
|
|
35
|
-
});
|
|
36
40
|
return _el$;
|
|
37
41
|
}
|
|
38
42
|
});
|
|
@@ -47,19 +51,20 @@ function CountBadge(props) {
|
|
|
47
51
|
var _el$2 = _tmpl$2();
|
|
48
52
|
var _el$3 = _el$2.firstChild;
|
|
49
53
|
var _el$4 = _el$3.nextSibling;
|
|
54
|
+
spread(_el$2, [() => {
|
|
55
|
+
return rootAttributes(props);
|
|
56
|
+
}, {
|
|
57
|
+
get "class"() {
|
|
58
|
+
return classes(ROOT, countBadgeAnchorClass, props.class);
|
|
59
|
+
},
|
|
60
|
+
get style() {
|
|
61
|
+
return props.style;
|
|
62
|
+
}
|
|
63
|
+
}], true);
|
|
50
64
|
insert(_el$2, child, _el$3);
|
|
51
65
|
insert(_el$2, () => {
|
|
52
66
|
return badge(true);
|
|
53
67
|
}, _el$4);
|
|
54
|
-
effect(() => {
|
|
55
|
-
return {
|
|
56
|
-
e: readShallow(classes(ROOT, countBadgeAnchorClass, props.class)),
|
|
57
|
-
t: readShallow(props.style)
|
|
58
|
-
};
|
|
59
|
-
}, ({ e, t }, _p$) => {
|
|
60
|
-
className(_el$2, e, _p$?.e);
|
|
61
|
-
style(_el$2, t, _p$?.t);
|
|
62
|
-
});
|
|
63
68
|
return _el$2;
|
|
64
69
|
}
|
|
65
70
|
});
|
package/dist/dom/DatePicker.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Icon } from "./Icon.js";
|
|
2
|
+
import { useLabels } from "./Labels.js";
|
|
2
3
|
import { modalPopover } from "./modal-popover.js";
|
|
3
4
|
import { Portal as Portal$1 } from "./portal.js";
|
|
4
5
|
import { createPresence } from "./presence.js";
|
|
5
|
-
import { withStyle } from "./root.js";
|
|
6
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
6
7
|
import { createComponent, delegateEvents, effect, insert, memo, readShallow, ref, setAttribute, spread, style, template } from "@solidjs/web";
|
|
7
8
|
import { DATE_PICKER_NAV_CLASS, classes, datePickerContentAttrs, datePickerIds, datePickerLocale, datePickerMachineProps, datePickerTriggerAttrs, focusOpeningDay, formatDay, keepCalendarFocus, keepDayFocused, readCssPx, underlayLayerStyle } from "@xds/core";
|
|
8
9
|
import { normalizeProps, useMachine } from "@zag-js/solid";
|
|
@@ -35,14 +36,19 @@ function DatePicker(props) {
|
|
|
35
36
|
const id = createUniqueId();
|
|
36
37
|
const ids = datePickerIds(id);
|
|
37
38
|
const locale = () => datePickerLocale(props.locale);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const labels = useLabels();
|
|
40
|
+
const service = useMachine(datePicker.machine, () => ({
|
|
41
|
+
...datePickerMachineProps(props, {
|
|
42
|
+
id,
|
|
43
|
+
locale: locale(),
|
|
44
|
+
onChange: (value) => props.onChange(value),
|
|
45
|
+
gutter: readCssPx(null, "--xds-space-1", space[1]),
|
|
46
|
+
labels: labels()
|
|
47
|
+
}),
|
|
48
|
+
ids: { root: props.id }
|
|
43
49
|
}));
|
|
44
50
|
const api = createMemo(() => datePicker.connect(service, normalizeProps));
|
|
45
|
-
const root = withStyle(() => api().getRootProps(), () => props.style);
|
|
51
|
+
const root = withStyle(() => api().getRootProps(), () => props.style, rootAttributes(props));
|
|
46
52
|
let positioner;
|
|
47
53
|
let surface;
|
|
48
54
|
modalPopover(() => api().open, () => positioner);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Icon } from "./Icon.js";
|
|
2
|
+
import { useLabels } from "./Labels.js";
|
|
2
3
|
import { modalPopover } from "./modal-popover.js";
|
|
3
4
|
import { Portal as Portal$1 } from "./portal.js";
|
|
4
5
|
import { createPresence } from "./presence.js";
|
|
5
|
-
import { withStyle } from "./root.js";
|
|
6
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
6
7
|
import { createComponent, delegateEvents, effect, insert, memo, readShallow, ref, setAttribute, spread, style, template } from "@solidjs/web";
|
|
7
8
|
import { DATE_PICKER_NAV_CLASS, classes, datePickerContentAttrs, datePickerIds, datePickerLocale, datePickerTriggerAttrs, dateRangeMachineProps, endRangeChoiceOnClose, focusOpeningDay, formatRange, keepCalendarFocus, keepDayFocused, keepRangePreview, rangeDayClick, rangeGridKeyDown, rangeMonthViews, rangeMonths, rangeSummary, readCssPx, shownRange, underlayLayerStyle } from "@xds/core";
|
|
8
9
|
import { normalizeProps, useMachine } from "@zag-js/solid";
|
|
@@ -42,19 +43,24 @@ function DateRangePicker(props) {
|
|
|
42
43
|
const id = createUniqueId();
|
|
43
44
|
const ids = datePickerIds(id);
|
|
44
45
|
const locale = () => datePickerLocale(props.locale);
|
|
46
|
+
const labels = useLabels();
|
|
45
47
|
const [draft, setDraft] = createSignal(null);
|
|
46
48
|
const [months, setMonths] = createSignal(1);
|
|
47
49
|
const shown = createMemo(() => shownRange(props.value, draft()));
|
|
48
|
-
const service = useMachine(datePicker.machine, () =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const service = useMachine(datePicker.machine, () => ({
|
|
51
|
+
...dateRangeMachineProps(props, shown(), {
|
|
52
|
+
id,
|
|
53
|
+
locale: locale(),
|
|
54
|
+
months: months(),
|
|
55
|
+
onDraft: (next) => setDraft(() => next),
|
|
56
|
+
onChange: (value) => props.onChange(value),
|
|
57
|
+
gutter: readCssPx(null, "--xds-space-1", space[1]),
|
|
58
|
+
labels: labels()
|
|
59
|
+
}),
|
|
60
|
+
ids: { root: props.id }
|
|
55
61
|
}));
|
|
56
62
|
const api = createMemo(() => datePicker.connect(service, normalizeProps));
|
|
57
|
-
const root = withStyle(() => api().getRootProps(), () => props.style);
|
|
63
|
+
const root = withStyle(() => api().getRootProps(), () => props.style, rootAttributes(props));
|
|
58
64
|
let positioner;
|
|
59
65
|
let surface;
|
|
60
66
|
modalPopover(() => api().open, () => positioner);
|
|
@@ -69,7 +75,7 @@ function DateRangePicker(props) {
|
|
|
69
75
|
], ([isOpen]) => keepDayFocused(isOpen, surface));
|
|
70
76
|
createEffect(open, (isOpen) => endRangeChoiceOnClose(service, isOpen));
|
|
71
77
|
createEffect(focused, () => keepRangePreview(service, shown(), open()));
|
|
72
|
-
const summary = createMemo(() => rangeSummary(shown(), props, locale()));
|
|
78
|
+
const summary = createMemo(() => rangeSummary(shown(), props, locale(), labels()));
|
|
73
79
|
const views = createMemo(() => rangeMonthViews(api(), months()));
|
|
74
80
|
const invalid = () => props.error !== void 0;
|
|
75
81
|
var _el$ = _tmpl$5();
|
package/dist/dom/Dialog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Portal as Portal$1 } from "./portal.js";
|
|
2
2
|
import { createPresence } from "./presence.js";
|
|
3
|
-
import { withStyle } from "./root.js";
|
|
3
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
4
4
|
import { TriggerContext } from "./trigger.js";
|
|
5
5
|
import { createComponent, insert, ref, spread, template } from "@solidjs/web";
|
|
6
6
|
import { classes, leaveEscapeToFields } from "@xds/core";
|
|
@@ -29,6 +29,7 @@ function Dialog(props) {
|
|
|
29
29
|
let content;
|
|
30
30
|
const service = useMachine(dialog.machine, () => ({
|
|
31
31
|
id,
|
|
32
|
+
ids: { content: props.id },
|
|
32
33
|
open: props.open,
|
|
33
34
|
onOpenChange: (details) => {
|
|
34
35
|
if (!details.open) props.onClose();
|
|
@@ -39,7 +40,7 @@ function Dialog(props) {
|
|
|
39
40
|
initialFocusEl: () => content ?? null
|
|
40
41
|
}));
|
|
41
42
|
const api = createMemo(() => dialog.connect(service, normalizeProps));
|
|
42
|
-
const contentProps = withStyle(() => api().getContentProps(), () => props.style);
|
|
43
|
+
const contentProps = withStyle(() => api().getContentProps(), () => props.style, rootAttributes(props));
|
|
43
44
|
const present = createPresence(() => api().open, () => [backdrop, positioner]);
|
|
44
45
|
return createComponent(Show, {
|
|
45
46
|
get when() {
|
package/dist/dom/Divider.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rootAttributes } from "./root.js";
|
|
2
|
+
import { spread, template } from "@solidjs/web";
|
|
2
3
|
import { classes, dividerClass, rootPart } from "@xds/core";
|
|
3
4
|
// packages/ui-solid/src/Divider.tsx
|
|
4
5
|
var _tmpl$ = /* @__PURE__ */ template(`<hr>`);
|
|
@@ -6,15 +7,16 @@ var ROOT = rootPart("Divider");
|
|
|
6
7
|
/** A line between groups of content. Decorative lines use the low-contrast border color. */
|
|
7
8
|
function Divider(props) {
|
|
8
9
|
var _el$ = _tmpl$();
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
spread(_el$, [() => {
|
|
11
|
+
return rootAttributes(props);
|
|
12
|
+
}, {
|
|
13
|
+
get "class"() {
|
|
14
|
+
return classes(ROOT, dividerClass, props.class);
|
|
15
|
+
},
|
|
16
|
+
get style() {
|
|
17
|
+
return props.style;
|
|
18
|
+
}
|
|
19
|
+
}], false);
|
|
18
20
|
return _el$;
|
|
19
21
|
}
|
|
20
22
|
export { Divider };
|
package/dist/dom/EmptyState.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Icon } from "./Icon.js";
|
|
2
|
-
import {
|
|
2
|
+
import { rootAttributes } from "./root.js";
|
|
3
|
+
import { className, createComponent, effect, insert, readShallow, spread, template } from "@solidjs/web";
|
|
3
4
|
import { EMPTY_STATE_PARTS, classes, rootPart } from "@xds/core";
|
|
4
5
|
import { Show } from "solid-js";
|
|
5
6
|
// packages/ui-solid/src/EmptyState.tsx
|
|
@@ -16,6 +17,16 @@ function EmptyState(props) {
|
|
|
16
17
|
var _el$2 = _el$.firstChild;
|
|
17
18
|
var _el$3 = _el$2.nextSibling;
|
|
18
19
|
var _el$4 = _el$3.nextSibling;
|
|
20
|
+
spread(_el$, [() => {
|
|
21
|
+
return rootAttributes(props);
|
|
22
|
+
}, {
|
|
23
|
+
get "class"() {
|
|
24
|
+
return classes(ROOT, EMPTY_STATE_PARTS.root, props.class);
|
|
25
|
+
},
|
|
26
|
+
get style() {
|
|
27
|
+
return props.style;
|
|
28
|
+
}
|
|
29
|
+
}], true);
|
|
19
30
|
insert(_el$, createComponent(Icon, {
|
|
20
31
|
get name() {
|
|
21
32
|
return props.icon;
|
|
@@ -54,16 +65,8 @@ function EmptyState(props) {
|
|
|
54
65
|
return _el$6;
|
|
55
66
|
})()
|
|
56
67
|
}), _el$4);
|
|
57
|
-
effect(() => {
|
|
58
|
-
|
|
59
|
-
e: readShallow(classes(ROOT, EMPTY_STATE_PARTS.root, props.class)),
|
|
60
|
-
t: readShallow(props.style),
|
|
61
|
-
a: readShallow(EMPTY_STATE_PARTS.title)
|
|
62
|
-
};
|
|
63
|
-
}, ({ e, t, a }, _p$) => {
|
|
64
|
-
className(_el$, e, _p$?.e);
|
|
65
|
-
style(_el$, t, _p$?.t);
|
|
66
|
-
className(_el$2, a, _p$?.a);
|
|
68
|
+
effect(() => readShallow(EMPTY_STATE_PARTS.title), (_v$, _$p) => {
|
|
69
|
+
className(_el$2, _v$, _$p);
|
|
67
70
|
});
|
|
68
71
|
return _el$;
|
|
69
72
|
}
|
package/dist/dom/Icon.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useDefaults } from "./Defaults.js";
|
|
2
|
-
import {
|
|
2
|
+
import { rootAttributes } from "./root.js";
|
|
3
|
+
import { createComponent, insert, setAttribute, spread, template } from "@solidjs/web";
|
|
3
4
|
import { classes, iconClass, rootPart } from "@xds/core";
|
|
4
5
|
import { For } from "solid-js";
|
|
5
6
|
import { icons } from "@xds/tokens";
|
|
6
7
|
// packages/ui-solid/src/Icon.tsx
|
|
7
|
-
var _tmpl$ = /* @__PURE__ */ template(`<svg
|
|
8
|
+
var _tmpl$ = /* @__PURE__ */ template(`<svg>`);
|
|
8
9
|
var _tmpl$2 = /* @__PURE__ */ template(`<svg><path></svg>`, 2);
|
|
9
10
|
var ROOT = rootPart("Icon");
|
|
10
11
|
/**
|
|
@@ -14,6 +15,33 @@ var ROOT = rootPart("Icon");
|
|
|
14
15
|
function Icon(props) {
|
|
15
16
|
const defaults = useDefaults("Icon");
|
|
16
17
|
var _el$ = _tmpl$();
|
|
18
|
+
spread(_el$, [() => {
|
|
19
|
+
return rootAttributes(props);
|
|
20
|
+
}, {
|
|
21
|
+
viewBox: "0 0 24 24",
|
|
22
|
+
get fill() {
|
|
23
|
+
return props.filled ? "currentColor" : "none";
|
|
24
|
+
},
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
"stroke-width": "2",
|
|
27
|
+
"stroke-linecap": "round",
|
|
28
|
+
"stroke-linejoin": "round",
|
|
29
|
+
get "class"() {
|
|
30
|
+
return classes(ROOT, iconClass(props.size ?? defaults().size), props.class);
|
|
31
|
+
},
|
|
32
|
+
get style() {
|
|
33
|
+
return props.style;
|
|
34
|
+
},
|
|
35
|
+
get role() {
|
|
36
|
+
return props.label ? "img" : void 0;
|
|
37
|
+
},
|
|
38
|
+
get "aria-label"() {
|
|
39
|
+
return props.label || void 0;
|
|
40
|
+
},
|
|
41
|
+
get "aria-hidden"() {
|
|
42
|
+
return props.label ? void 0 : "true";
|
|
43
|
+
}
|
|
44
|
+
}], true);
|
|
17
45
|
insert(_el$, createComponent(For, {
|
|
18
46
|
get each() {
|
|
19
47
|
return icons[props.name];
|
|
@@ -24,23 +52,6 @@ function Icon(props) {
|
|
|
24
52
|
return _el$2;
|
|
25
53
|
})()
|
|
26
54
|
}));
|
|
27
|
-
effect(() => {
|
|
28
|
-
return {
|
|
29
|
-
e: props.filled ? "currentColor" : "none",
|
|
30
|
-
t: readShallow(classes(ROOT, iconClass(props.size ?? defaults().size), props.class)),
|
|
31
|
-
a: readShallow(props.style),
|
|
32
|
-
o: props.label ? "img" : void 0,
|
|
33
|
-
i: props.label || void 0,
|
|
34
|
-
n: props.label ? void 0 : "true"
|
|
35
|
-
};
|
|
36
|
-
}, ({ e, t, a, o, i, n }, _p$) => {
|
|
37
|
-
e !== _p$?.e && setAttribute(_el$, "fill", e);
|
|
38
|
-
className(_el$, t, _p$?.t);
|
|
39
|
-
style(_el$, a, _p$?.a);
|
|
40
|
-
o !== _p$?.o && setAttribute(_el$, "role", o);
|
|
41
|
-
i !== _p$?.i && setAttribute(_el$, "aria-label", i);
|
|
42
|
-
n !== _p$?.n && setAttribute(_el$, "aria-hidden", n);
|
|
43
|
-
});
|
|
44
55
|
return _el$;
|
|
45
56
|
}
|
|
46
57
|
export { Icon };
|
package/dist/dom/IconButton.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useDefaults } from "./Defaults.js";
|
|
2
2
|
import { Icon } from "./Icon.js";
|
|
3
|
+
import { rootAttributes } from "./root.js";
|
|
3
4
|
import { Spinner } from "./Spinner.js";
|
|
4
5
|
import { withTrigger } from "./trigger.js";
|
|
5
|
-
import { className, createComponent, effect, insert, readShallow, spread, template } from "@solidjs/web";
|
|
6
|
+
import { className, createComponent, effect, insert, readShallow, ref, spread, template } from "@solidjs/web";
|
|
6
7
|
import { ICON_BUTTON_BOX, buttonClass, classes, isHeld } from "@xds/core";
|
|
7
8
|
import { Show, createMemo } from "solid-js";
|
|
8
9
|
// packages/ui-solid/src/IconButton.tsx
|
|
@@ -33,10 +34,16 @@ function IconButton(props) {
|
|
|
33
34
|
"aria-label": props.label,
|
|
34
35
|
onClick: () => {
|
|
35
36
|
if (!props.loading) props.onPress?.();
|
|
36
|
-
}
|
|
37
|
-
|
|
37
|
+
},
|
|
38
|
+
onFocus: (event) => props.onFocus?.(event),
|
|
39
|
+
onBlur: (event) => props.onBlur?.(event)
|
|
40
|
+
})), () => props.loading === true, rootAttributes(props));
|
|
38
41
|
var _el$ = _tmpl$();
|
|
39
42
|
spread(_el$, attributes, true);
|
|
43
|
+
var _ref$ = props.ref;
|
|
44
|
+
typeof _ref$ === "function" || Array.isArray(_ref$) ? ref(() => {
|
|
45
|
+
return _ref$;
|
|
46
|
+
}, _el$) : props.ref = _el$;
|
|
40
47
|
insert(_el$, createComponent(Show, {
|
|
41
48
|
get when() {
|
|
42
49
|
return !props.loading;
|