@glimstone/solid 0.0.0-stage → 4.5.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/README.md +50 -2
- package/dist/AboutCard.d.ts +154 -0
- package/dist/Accordion.d.ts +15 -0
- package/dist/Accordion.js +45 -0
- package/dist/AngleSlider.d.ts +10 -0
- package/dist/AngleSlider.js +47 -0
- package/dist/Avatar.d.ts +11 -0
- package/dist/Avatar.js +50 -0
- package/dist/Badge-CC2mjBLM.js +116 -0
- package/dist/Badge.d.ts +52 -0
- package/dist/BusyRing.d.ts +13 -0
- package/dist/Button-DNSkNN0r.js +219 -0
- package/dist/Button.d.ts +56 -0
- package/dist/Card.d.ts +33 -0
- package/dist/Carousel.d.ts +18 -0
- package/dist/Carousel.js +88 -0
- package/dist/Checkbox.d.ts +14 -0
- package/dist/CoffeeDialog.d.ts +16 -0
- package/dist/Collapsible.d.ts +12 -0
- package/dist/Collapsible.js +27 -0
- package/dist/ColorPicker.d.ts +21 -0
- package/dist/Combobox.d.ts +16 -0
- package/dist/Combobox.js +64 -0
- package/dist/ConfirmDialog.d.ts +29 -0
- package/dist/ContextMenu.d.ts +27 -0
- package/dist/CopyField.d.ts +17 -0
- package/dist/CryptoDonateDialog.d.ts +35 -0
- package/dist/DatePicker.d.ts +17 -0
- package/dist/DatePicker.js +132 -0
- package/dist/DropdownListbox.d.ts +22 -0
- package/dist/EmptyState.d.ts +19 -0
- package/dist/FieldError.d.ts +8 -0
- package/dist/FieldRow.d.ts +20 -0
- package/dist/FieldRowGroup.d.ts +10 -0
- package/dist/FileUpload.d.ts +15 -0
- package/dist/FileUpload.js +68 -0
- package/dist/FloatingPanel.d.ts +14 -0
- package/dist/FloatingPanel.js +80 -0
- package/dist/Fortress.d.ts +101 -0
- package/dist/FortressAppCard.d.ts +39 -0
- package/dist/FortressPermissions.d.ts +23 -0
- package/dist/FortressStatusWindow.d.ts +25 -0
- package/dist/GlyphField.d.ts +16 -0
- package/dist/GlyphTile.d.ts +12 -0
- package/dist/HoverCard.d.ts +12 -0
- package/dist/HoverCard.js +55 -0
- package/dist/IconButton-Lzbq5Cst.js +42 -0
- package/dist/IconButton.d.ts +16 -0
- package/dist/IconTipButton-BojUYQWU.js +73 -0
- package/dist/IconTipButton.d.ts +20 -0
- package/dist/InfoBubble.d.ts +4 -0
- package/dist/InstanceCard.d.ts +25 -0
- package/dist/Kbd.d.ts +5 -0
- package/dist/Lift-CsM0IU9t.js +13 -0
- package/dist/Lift.d.ts +12 -0
- package/dist/ListRow.d.ts +16 -0
- package/dist/ListTable.d.ts +21 -0
- package/dist/Marquee.d.ts +16 -0
- package/dist/Marquee.js +59 -0
- package/dist/MenuBar.d.ts +17 -0
- package/dist/Meter.d.ts +18 -0
- package/dist/NumberField.d.ts +20 -0
- package/dist/Pagination.d.ts +14 -0
- package/dist/Pagination.js +77 -0
- package/dist/PasswordField.d.ts +17 -0
- package/dist/PathField.d.ts +28 -0
- package/dist/PaypalDialog.d.ts +51 -0
- package/dist/Pill.d.ts +12 -0
- package/dist/PinInput.d.ts +21 -0
- package/dist/PinInput.js +50 -0
- package/dist/Popover.d.ts +14 -0
- package/dist/ProgressBar.d.ts +14 -0
- package/dist/Rating.d.ts +15 -0
- package/dist/Rating.js +45 -0
- package/dist/ReadmeButton.d.ts +29 -0
- package/dist/RowMark.d.ts +5 -0
- package/dist/ScrollArea.d.ts +9 -0
- package/dist/ScrollArea.js +31 -0
- package/dist/Select.d.ts +48 -0
- package/dist/Select.js +548 -0
- package/dist/Selector.d.ts +76 -0
- package/dist/Sheet.d.ts +21 -0
- package/dist/SidebarRow.d.ts +28 -0
- package/dist/SignInCard.d.ts +40 -0
- package/dist/SignaturePad.d.ts +11 -0
- package/dist/SignaturePad.js +65 -0
- package/dist/SkeletonRow.d.ts +10 -0
- package/dist/Slider.d.ts +12 -0
- package/dist/Slider.js +34 -0
- package/dist/Splitter.d.ts +14 -0
- package/dist/Splitter.js +54 -0
- package/dist/Steps.d.ts +17 -0
- package/dist/Steps.js +112 -0
- package/dist/SubCard.d.ts +17 -0
- package/dist/Table.d.ts +14 -0
- package/dist/TagsInput.d.ts +15 -0
- package/dist/TagsInput.js +57 -0
- package/dist/TextField.d.ts +25 -0
- package/dist/Timer.d.ts +15 -0
- package/dist/Timer.js +98 -0
- package/dist/TipWrap.d.ts +12 -0
- package/dist/Toast.d.ts +27 -0
- package/dist/Toggle.d.ts +23 -0
- package/dist/Tour.d.ts +10 -0
- package/dist/Tour.js +83 -0
- package/dist/Tree.d.ts +20 -0
- package/dist/UnavailableNotice.d.ts +15 -0
- package/dist/Window.d.ts +30 -0
- package/dist/WindowBar.d.ts +25 -0
- package/dist/WindowFootRow.d.ts +25 -0
- package/dist/engines.d.ts +17 -0
- package/dist/fieldName-Bb6qW0oS.js +8 -0
- package/dist/fieldName.d.ts +5 -0
- package/dist/glyphs-xP5bYKa1.js +127 -0
- package/dist/glyphs.d.ts +36 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +5279 -0
- package/dist/portalHue-CLVEiNTo.js +14 -0
- package/dist/portalHue.d.ts +10 -0
- package/dist/style-ByE-hij7.js +8 -0
- package/dist/style.d.ts +7 -0
- package/dist/useConfirm.d.ts +26 -0
- package/dist/useDragArmed.d.ts +6 -0
- package/dist/usePaypalButtons.d.ts +17 -0
- package/dist/useTipBubble-BJIYZw03.js +65 -0
- package/dist/useTipBubble.d.ts +25 -0
- package/package.json +148 -4
package/dist/Select.js
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
import { r as e } from "./fieldName-Bb6qW0oS.js";
|
|
2
|
+
import { i as t, s as n } from "./glyphs-xP5bYKa1.js";
|
|
3
|
+
import { t as r } from "./Lift-CsM0IU9t.js";
|
|
4
|
+
import { t as i } from "./portalHue-CLVEiNTo.js";
|
|
5
|
+
import { t as a } from "./style-ByE-hij7.js";
|
|
6
|
+
import { n as o, t as s } from "./useTipBubble-BJIYZw03.js";
|
|
7
|
+
import { className as c, createComponent as l, effect as u, insert as d, memo as f, mergeProps as p, setAttribute as m, spread as h, template as g, use as _ } from "solid-js/web";
|
|
8
|
+
import { For as v, Show as y, createEffect as b, createMemo as x, createSignal as S, createUniqueId as C, mergeProps as w, on as T, onCleanup as E, onMount as D, splitProps as O } from "solid-js";
|
|
9
|
+
import { SELECT_POSITIONING as k, closeOnPageMove as A, defaultWidth as j, enableWheelStep as M, endOption as ee, faceLabels as N, flattenRuns as P, hasSubmenu as te, homeRow as ne, isSubmenu as F, pageDir as I, selectRootClass as L, selectRowParts as R, selectTriggerClass as z, shake as B, wheelValue as V } from "@glimstone/core";
|
|
10
|
+
import * as H from "@zag-js/menu";
|
|
11
|
+
import * as U from "@zag-js/select";
|
|
12
|
+
import { normalizeProps as W, useMachine as G } from "@zag-js/solid";
|
|
13
|
+
// src/Select.tsx
|
|
14
|
+
var K = /*#__PURE__*/ g("<button><span>"), q = /*#__PURE__*/ g("<div>"), re = /*#__PURE__*/ g("<div data-glim=Select><label></label><div></div><select>"), J = /*#__PURE__*/ g("<span>"), ie = /*#__PURE__*/ g("<div><span></span><span>"), ae = /*#__PURE__*/ g("<span aria-hidden=true class=glim-field-label>"), oe = /*#__PURE__*/ g("<div data-glim=Select><div>"), Y = /*#__PURE__*/ g("<div><span></span><span aria-hidden=true>"), se = /*#__PURE__*/ g("<span class=glim-select-glyph>"), ce = /*#__PURE__*/ g("<span class=glim-select-value>");
|
|
15
|
+
function le(t) {
|
|
16
|
+
let n = w({
|
|
17
|
+
size: "field",
|
|
18
|
+
rows: "list",
|
|
19
|
+
wrap: !1,
|
|
20
|
+
class: ""
|
|
21
|
+
}, t), [r, i] = O(n, [
|
|
22
|
+
"size",
|
|
23
|
+
"rows",
|
|
24
|
+
"label",
|
|
25
|
+
"hideLabel",
|
|
26
|
+
"width",
|
|
27
|
+
"wrap",
|
|
28
|
+
"class",
|
|
29
|
+
"options",
|
|
30
|
+
"groups"
|
|
31
|
+
]), a = e(() => r.label), o = () => r.label === void 0, s = () => r.groups ?? [{ entries: r.options ?? [] }], c = {
|
|
32
|
+
get label() {
|
|
33
|
+
return a() ?? "";
|
|
34
|
+
},
|
|
35
|
+
get hideLabel() {
|
|
36
|
+
return r.hideLabel || o();
|
|
37
|
+
},
|
|
38
|
+
get width() {
|
|
39
|
+
return r.width ?? (o() ? "steady" : j(r.size));
|
|
40
|
+
},
|
|
41
|
+
get rows() {
|
|
42
|
+
return r.rows;
|
|
43
|
+
},
|
|
44
|
+
get groups() {
|
|
45
|
+
return s();
|
|
46
|
+
},
|
|
47
|
+
get class() {
|
|
48
|
+
return `${z(r.size, r.wrap)} ${r.class}`.trim();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return l(y, {
|
|
52
|
+
get when() {
|
|
53
|
+
return te(s());
|
|
54
|
+
},
|
|
55
|
+
get fallback() {
|
|
56
|
+
return l(ue, p(i, c));
|
|
57
|
+
},
|
|
58
|
+
get children() {
|
|
59
|
+
return l(de, p(i, c));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function ue(e) {
|
|
64
|
+
let a = C(), s = x(() => P(e.groups)), m = G(U.machine, () => ({
|
|
65
|
+
id: a,
|
|
66
|
+
ids: {
|
|
67
|
+
trigger: e.id,
|
|
68
|
+
content: e.listId
|
|
69
|
+
},
|
|
70
|
+
dir: I(),
|
|
71
|
+
collection: U.collection({
|
|
72
|
+
items: s(),
|
|
73
|
+
itemToValue: (e) => e.value,
|
|
74
|
+
itemToString: (e) => e.label,
|
|
75
|
+
isItemDisabled: (e) => !!e.disabled
|
|
76
|
+
}),
|
|
77
|
+
value: e.value === null ? [] : [e.value],
|
|
78
|
+
disabled: e.disabled,
|
|
79
|
+
readOnly: e.busy,
|
|
80
|
+
onValueChange: (t) => {
|
|
81
|
+
let n = t.value[0];
|
|
82
|
+
n !== void 0 && n !== e.value && e.onChange(n);
|
|
83
|
+
},
|
|
84
|
+
positioning: k
|
|
85
|
+
})), g = x(() => U.connect(m, W)), S = $(e, s);
|
|
86
|
+
b(T(() => g().open, (e) => e && E(A(() => g().setOpen(!1)))));
|
|
87
|
+
let w = i(() => g().open, S.el), D = () => s().some((e) => e.glyph), O = () => R(e.rows, D()), j = (e) => {
|
|
88
|
+
let t = g().open ? void 0 : ee(s(), e.key);
|
|
89
|
+
if (t === void 0) return g().getTriggerProps().onKeyDown?.(e);
|
|
90
|
+
e.preventDefault(), g().setOpen(!0), g().setHighlightValue(t);
|
|
91
|
+
};
|
|
92
|
+
return (() => {
|
|
93
|
+
var i = re(), m = i.firstChild, b = m.nextSibling, x = b.nextSibling;
|
|
94
|
+
return h(i, p(() => g().getRootProps(), { get class() {
|
|
95
|
+
return L(e.width);
|
|
96
|
+
} }), !1, !0), h(m, p(() => g().getLabelProps(), { get class() {
|
|
97
|
+
return e.hideLabel ? "glim-sr-only" : "glim-field-label";
|
|
98
|
+
} }), !1, !0), d(m, () => e.label), h(b, p(() => g().getControlProps()), !1, !0), d(b, l(o, {
|
|
99
|
+
get on() {
|
|
100
|
+
return f(() => !!e.disabled)() && !!e.tip;
|
|
101
|
+
},
|
|
102
|
+
get show() {
|
|
103
|
+
return S.tip.show;
|
|
104
|
+
},
|
|
105
|
+
get hide() {
|
|
106
|
+
return S.tip.hide;
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
var t = K(), r = t.firstChild, i = S.attach;
|
|
110
|
+
return typeof i == "function" ? _(i, t) : S.attach = t, h(t, p(() => e.triggerAttrs, () => g().getTriggerProps(), { onKeyDown: j }, () => S.handlers, {
|
|
111
|
+
get "aria-describedby"() {
|
|
112
|
+
return S.tip.describedBy();
|
|
113
|
+
},
|
|
114
|
+
get "aria-busy"() {
|
|
115
|
+
return e.busy || void 0;
|
|
116
|
+
},
|
|
117
|
+
get class() {
|
|
118
|
+
return e.class;
|
|
119
|
+
}
|
|
120
|
+
}), !1, !0), d(t, l(Q, {
|
|
121
|
+
get all() {
|
|
122
|
+
return s();
|
|
123
|
+
},
|
|
124
|
+
get value() {
|
|
125
|
+
return e.value;
|
|
126
|
+
},
|
|
127
|
+
get placeholder() {
|
|
128
|
+
return e.placeholder;
|
|
129
|
+
},
|
|
130
|
+
get width() {
|
|
131
|
+
return e.width;
|
|
132
|
+
},
|
|
133
|
+
get glyphs() {
|
|
134
|
+
return D();
|
|
135
|
+
}
|
|
136
|
+
}), r), h(r, p(() => g().getIndicatorProps(), { class: "glim-select-indicator" }), !1, !0), d(r, l(n, {})), t;
|
|
137
|
+
}
|
|
138
|
+
})), d(i, () => S.tip.bubble, x), d(i, l(r, { get children() {
|
|
139
|
+
return l(X, {
|
|
140
|
+
get attrs() {
|
|
141
|
+
return g().getPositionerProps();
|
|
142
|
+
},
|
|
143
|
+
hue: w,
|
|
144
|
+
get children() {
|
|
145
|
+
var n = q();
|
|
146
|
+
return h(n, p(() => g().getContentProps(), { get class() {
|
|
147
|
+
return O().content;
|
|
148
|
+
} }), !1, !0), d(n, l(v, {
|
|
149
|
+
get each() {
|
|
150
|
+
return e.groups;
|
|
151
|
+
},
|
|
152
|
+
children: (e, n) => {
|
|
153
|
+
let r = () => `${a}-g${n()}`;
|
|
154
|
+
return l(y, {
|
|
155
|
+
get when() {
|
|
156
|
+
return e.entries.length > 0;
|
|
157
|
+
},
|
|
158
|
+
get children() {
|
|
159
|
+
var n = q();
|
|
160
|
+
return h(n, p(() => e.heading ? g().getItemGroupProps({ id: r() }) : {}, { class: "glim-select-group" }), !1, !0), d(n, l(y, {
|
|
161
|
+
get when() {
|
|
162
|
+
return e.heading;
|
|
163
|
+
},
|
|
164
|
+
get children() {
|
|
165
|
+
var t = q();
|
|
166
|
+
return h(t, p(() => g().getItemGroupLabelProps({ htmlFor: r() }), { get class() {
|
|
167
|
+
return O().heading;
|
|
168
|
+
} }), !1, !0), d(t, () => e.heading), t;
|
|
169
|
+
}
|
|
170
|
+
}), null), d(n, l(v, {
|
|
171
|
+
get each() {
|
|
172
|
+
return e.entries;
|
|
173
|
+
},
|
|
174
|
+
children: (e) => (() => {
|
|
175
|
+
var n = ie(), r = n.firstChild, i = r.nextSibling;
|
|
176
|
+
return h(n, p(() => g().getItemProps({ item: e }), { get class() {
|
|
177
|
+
return O().item;
|
|
178
|
+
} }), !1, !0), d(n, l(y, {
|
|
179
|
+
get when() {
|
|
180
|
+
return O().glyph;
|
|
181
|
+
},
|
|
182
|
+
get children() {
|
|
183
|
+
var t = J();
|
|
184
|
+
return d(t, () => e.glyph?.()), u(() => c(t, O().glyph)), t;
|
|
185
|
+
}
|
|
186
|
+
}), r), h(r, p(() => g().getItemTextProps({ item: e }), { get class() {
|
|
187
|
+
return O().label;
|
|
188
|
+
} }), !1, !0), d(r, () => e.label), h(i, p(() => g().getItemIndicatorProps({ item: e }), { get class() {
|
|
189
|
+
return O().check;
|
|
190
|
+
} }), !1, !0), d(i, l(t, {})), n;
|
|
191
|
+
})()
|
|
192
|
+
}), null), n;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
})), n;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
} }), x), h(x, p(() => g().getHiddenSelectProps()), !1, !1), i;
|
|
200
|
+
})();
|
|
201
|
+
}
|
|
202
|
+
function de(e) {
|
|
203
|
+
let t = C(), a = G(H.machine, () => ({
|
|
204
|
+
id: t,
|
|
205
|
+
ids: {
|
|
206
|
+
trigger: e.id,
|
|
207
|
+
content: e.listId
|
|
208
|
+
},
|
|
209
|
+
dir: I(),
|
|
210
|
+
"aria-label": e.label,
|
|
211
|
+
positioning: k
|
|
212
|
+
})), s = x(() => H.connect(a, W)), m = x(() => P(e.groups)), g = $(e, m), S = i(() => s().open, g.el), w = () => m().some((e) => e.glyph), D = () => R(e.rows, w()), O = (e, n) => `${t}-sub-${e}-${n}`;
|
|
213
|
+
b(T(() => s().open, (t) => {
|
|
214
|
+
if (!t) return;
|
|
215
|
+
E(A(() => s().setOpen(!1)));
|
|
216
|
+
let n = ne(e.groups, e.value, O);
|
|
217
|
+
if (n === null) return;
|
|
218
|
+
let r = 0, i = requestAnimationFrame(() => {
|
|
219
|
+
r = requestAnimationFrame(() => s().setHighlightedValue(n));
|
|
220
|
+
});
|
|
221
|
+
E(() => {
|
|
222
|
+
cancelAnimationFrame(i), cancelAnimationFrame(r);
|
|
223
|
+
});
|
|
224
|
+
}));
|
|
225
|
+
let j = () => N(m(), e.value, e.placeholder, e.width).text, M = (t) => (n) => {
|
|
226
|
+
e.busy ? n.preventDefault() : s().getTriggerProps()[t]?.(n);
|
|
227
|
+
};
|
|
228
|
+
return (() => {
|
|
229
|
+
var t = oe(), i = t.firstChild;
|
|
230
|
+
return d(t, l(y, {
|
|
231
|
+
get when() {
|
|
232
|
+
return !e.hideLabel;
|
|
233
|
+
},
|
|
234
|
+
get children() {
|
|
235
|
+
var t = ae();
|
|
236
|
+
return d(t, () => e.label), t;
|
|
237
|
+
}
|
|
238
|
+
}), i), d(i, l(o, {
|
|
239
|
+
get on() {
|
|
240
|
+
return f(() => !!e.disabled)() && !!e.tip;
|
|
241
|
+
},
|
|
242
|
+
get show() {
|
|
243
|
+
return g.tip.show;
|
|
244
|
+
},
|
|
245
|
+
get hide() {
|
|
246
|
+
return g.tip.hide;
|
|
247
|
+
},
|
|
248
|
+
get children() {
|
|
249
|
+
var t = K(), r = t.firstChild, i = g.attach;
|
|
250
|
+
return typeof i == "function" ? _(i, t) : g.attach = t, h(t, p(() => e.triggerAttrs, () => s().getTriggerProps(), () => g.handlers, {
|
|
251
|
+
get "aria-describedby"() {
|
|
252
|
+
return g.tip.describedBy();
|
|
253
|
+
},
|
|
254
|
+
get onPointerDown() {
|
|
255
|
+
return M("onPointerDown");
|
|
256
|
+
},
|
|
257
|
+
get onClick() {
|
|
258
|
+
return M("onClick");
|
|
259
|
+
},
|
|
260
|
+
get onKeyDown() {
|
|
261
|
+
return M("onKeyDown");
|
|
262
|
+
},
|
|
263
|
+
get disabled() {
|
|
264
|
+
return e.disabled;
|
|
265
|
+
},
|
|
266
|
+
get "data-disabled"() {
|
|
267
|
+
return e.disabled ? "" : void 0;
|
|
268
|
+
},
|
|
269
|
+
get "data-readonly"() {
|
|
270
|
+
return e.busy ? "" : void 0;
|
|
271
|
+
},
|
|
272
|
+
get "aria-busy"() {
|
|
273
|
+
return e.busy || void 0;
|
|
274
|
+
},
|
|
275
|
+
get "aria-label"() {
|
|
276
|
+
return `${e.label}: ${j()}`;
|
|
277
|
+
},
|
|
278
|
+
get class() {
|
|
279
|
+
return e.class;
|
|
280
|
+
}
|
|
281
|
+
}), !1, !0), d(t, l(Q, {
|
|
282
|
+
get all() {
|
|
283
|
+
return m();
|
|
284
|
+
},
|
|
285
|
+
get value() {
|
|
286
|
+
return e.value;
|
|
287
|
+
},
|
|
288
|
+
get placeholder() {
|
|
289
|
+
return e.placeholder;
|
|
290
|
+
},
|
|
291
|
+
get width() {
|
|
292
|
+
return e.width;
|
|
293
|
+
},
|
|
294
|
+
get glyphs() {
|
|
295
|
+
return w();
|
|
296
|
+
}
|
|
297
|
+
}), r), h(r, p(() => s().getIndicatorProps(), { class: "glim-select-indicator" }), !1, !0), d(r, l(n, {})), t;
|
|
298
|
+
}
|
|
299
|
+
})), d(t, () => g.tip.bubble, null), d(t, l(r, { get children() {
|
|
300
|
+
return l(X, {
|
|
301
|
+
get attrs() {
|
|
302
|
+
return s().getPositionerProps();
|
|
303
|
+
},
|
|
304
|
+
hue: S,
|
|
305
|
+
get children() {
|
|
306
|
+
var t = q();
|
|
307
|
+
return h(t, p(() => s().getContentProps(), { get class() {
|
|
308
|
+
return D().content;
|
|
309
|
+
} }), !1, !0), d(t, l(v, {
|
|
310
|
+
get each() {
|
|
311
|
+
return e.groups;
|
|
312
|
+
},
|
|
313
|
+
children: (t, n) => {
|
|
314
|
+
let r = () => `g${n()}`;
|
|
315
|
+
return l(y, {
|
|
316
|
+
get when() {
|
|
317
|
+
return t.entries.length > 0;
|
|
318
|
+
},
|
|
319
|
+
get children() {
|
|
320
|
+
var i = q();
|
|
321
|
+
return h(i, p(() => t.heading ? s().getItemGroupProps({ id: r() }) : {}, { class: "glim-select-group" }), !1, !0), d(i, l(y, {
|
|
322
|
+
get when() {
|
|
323
|
+
return t.heading;
|
|
324
|
+
},
|
|
325
|
+
get children() {
|
|
326
|
+
var e = q();
|
|
327
|
+
return h(e, p(() => s().getItemGroupLabelProps({ htmlFor: r() }), { get class() {
|
|
328
|
+
return D().heading;
|
|
329
|
+
} }), !1, !0), d(e, () => t.heading), e;
|
|
330
|
+
}
|
|
331
|
+
}), null), d(i, l(v, {
|
|
332
|
+
get each() {
|
|
333
|
+
return t.entries;
|
|
334
|
+
},
|
|
335
|
+
children: (t, r) => F(t) ? l(fe, {
|
|
336
|
+
parent: a,
|
|
337
|
+
get parentApi() {
|
|
338
|
+
return s();
|
|
339
|
+
},
|
|
340
|
+
get triggerId() {
|
|
341
|
+
return O(n(), r());
|
|
342
|
+
},
|
|
343
|
+
entry: t,
|
|
344
|
+
get value() {
|
|
345
|
+
return e.value;
|
|
346
|
+
},
|
|
347
|
+
get onChange() {
|
|
348
|
+
return e.onChange;
|
|
349
|
+
},
|
|
350
|
+
get parts() {
|
|
351
|
+
return D();
|
|
352
|
+
},
|
|
353
|
+
hue: S
|
|
354
|
+
}) : l(Z, {
|
|
355
|
+
get api() {
|
|
356
|
+
return s();
|
|
357
|
+
},
|
|
358
|
+
option: t,
|
|
359
|
+
get value() {
|
|
360
|
+
return e.value;
|
|
361
|
+
},
|
|
362
|
+
get onChange() {
|
|
363
|
+
return e.onChange;
|
|
364
|
+
},
|
|
365
|
+
get parts() {
|
|
366
|
+
return D();
|
|
367
|
+
}
|
|
368
|
+
})
|
|
369
|
+
}), null), i;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
})), t;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
} }), null), u(() => c(t, L(e.width))), t;
|
|
377
|
+
})();
|
|
378
|
+
}
|
|
379
|
+
function fe(e) {
|
|
380
|
+
let t = C(), i = G(H.machine, () => ({
|
|
381
|
+
id: t,
|
|
382
|
+
ids: { trigger: e.triggerId },
|
|
383
|
+
dir: I(),
|
|
384
|
+
"aria-label": e.entry.label
|
|
385
|
+
})), a = x(() => H.connect(i, W));
|
|
386
|
+
return D(() => {
|
|
387
|
+
e.parentApi.setChild(i), a().setParent(e.parent);
|
|
388
|
+
}), [(() => {
|
|
389
|
+
var t = Y(), r = t.firstChild, i = r.nextSibling;
|
|
390
|
+
return h(t, p(() => e.parentApi.getTriggerItemProps(a()), { get class() {
|
|
391
|
+
return e.parts.item;
|
|
392
|
+
} }), !1, !0), d(t, l(y, {
|
|
393
|
+
get when() {
|
|
394
|
+
return e.parts.glyph;
|
|
395
|
+
},
|
|
396
|
+
get children() {
|
|
397
|
+
var t = J();
|
|
398
|
+
return d(t, () => e.entry.glyph?.()), u(() => c(t, e.parts.glyph)), t;
|
|
399
|
+
}
|
|
400
|
+
}), r), d(r, () => e.entry.label), d(i, l(n, {})), u((t) => {
|
|
401
|
+
var n = e.parts.label, a = e.parts.caret;
|
|
402
|
+
return n !== t.e && c(r, t.e = n), a !== t.t && c(i, t.t = a), t;
|
|
403
|
+
}, {
|
|
404
|
+
e: void 0,
|
|
405
|
+
t: void 0
|
|
406
|
+
}), t;
|
|
407
|
+
})(), l(r, { get children() {
|
|
408
|
+
return l(X, {
|
|
409
|
+
get attrs() {
|
|
410
|
+
return a().getPositionerProps();
|
|
411
|
+
},
|
|
412
|
+
get hue() {
|
|
413
|
+
return e.hue;
|
|
414
|
+
},
|
|
415
|
+
get children() {
|
|
416
|
+
var t = q();
|
|
417
|
+
return h(t, p(() => a().getContentProps(), { get class() {
|
|
418
|
+
return e.parts.content;
|
|
419
|
+
} }), !1, !0), d(t, l(v, {
|
|
420
|
+
get each() {
|
|
421
|
+
return e.entry.options;
|
|
422
|
+
},
|
|
423
|
+
children: (t) => l(Z, {
|
|
424
|
+
get api() {
|
|
425
|
+
return a();
|
|
426
|
+
},
|
|
427
|
+
option: t,
|
|
428
|
+
get value() {
|
|
429
|
+
return e.value;
|
|
430
|
+
},
|
|
431
|
+
get onChange() {
|
|
432
|
+
return e.onChange;
|
|
433
|
+
},
|
|
434
|
+
get parts() {
|
|
435
|
+
return e.parts;
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
})), t;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
} })];
|
|
442
|
+
}
|
|
443
|
+
function X(e) {
|
|
444
|
+
return (() => {
|
|
445
|
+
var t = q();
|
|
446
|
+
return h(t, p(() => e.attrs, {
|
|
447
|
+
get style() {
|
|
448
|
+
return {
|
|
449
|
+
...e.attrs.style,
|
|
450
|
+
...a(e.hue.style())
|
|
451
|
+
};
|
|
452
|
+
},
|
|
453
|
+
get class() {
|
|
454
|
+
return `glim-select-positioner ${e.hue.className()}`.trim();
|
|
455
|
+
}
|
|
456
|
+
}), !1, !0), d(t, () => e.children), t;
|
|
457
|
+
})();
|
|
458
|
+
}
|
|
459
|
+
function Z(e) {
|
|
460
|
+
let n = () => e.option.value === e.value, r = () => ({
|
|
461
|
+
type: "radio",
|
|
462
|
+
value: e.option.value,
|
|
463
|
+
valueText: e.option.label,
|
|
464
|
+
checked: n(),
|
|
465
|
+
disabled: e.option.disabled,
|
|
466
|
+
onCheckedChange: () => {
|
|
467
|
+
n() || e.onChange(e.option.value);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
return (() => {
|
|
471
|
+
var i = Y(), a = i.firstChild, o = a.nextSibling;
|
|
472
|
+
return h(i, p(() => e.api.getOptionItemProps(r()), { get class() {
|
|
473
|
+
return e.parts.item;
|
|
474
|
+
} }), !1, !0), d(i, l(y, {
|
|
475
|
+
get when() {
|
|
476
|
+
return e.parts.glyph;
|
|
477
|
+
},
|
|
478
|
+
get children() {
|
|
479
|
+
var t = J();
|
|
480
|
+
return d(t, () => e.option.glyph?.()), u(() => c(t, e.parts.glyph)), t;
|
|
481
|
+
}
|
|
482
|
+
}), a), h(a, p(() => e.api.getItemTextProps(r()), { get class() {
|
|
483
|
+
return e.parts.label;
|
|
484
|
+
} }), !1, !0), d(a, () => e.option.label), d(o, l(t, {})), u((t) => {
|
|
485
|
+
var r = n() ? "checked" : "unchecked", i = e.parts.check;
|
|
486
|
+
return r !== t.e && m(o, "data-state", t.e = r), i !== t.t && c(o, t.t = i), t;
|
|
487
|
+
}, {
|
|
488
|
+
e: void 0,
|
|
489
|
+
t: void 0
|
|
490
|
+
}), i;
|
|
491
|
+
})();
|
|
492
|
+
}
|
|
493
|
+
function Q(e) {
|
|
494
|
+
let t = x(() => N(e.all, e.value, e.placeholder, e.width));
|
|
495
|
+
return [l(y, {
|
|
496
|
+
get when() {
|
|
497
|
+
return e.glyphs;
|
|
498
|
+
},
|
|
499
|
+
get children() {
|
|
500
|
+
var t = se();
|
|
501
|
+
return d(t, () => e.all.find((t) => t.value === e.value)?.glyph?.()), t;
|
|
502
|
+
}
|
|
503
|
+
}), (() => {
|
|
504
|
+
var e = ce();
|
|
505
|
+
return d(e, l(v, {
|
|
506
|
+
get each() {
|
|
507
|
+
return t().labels;
|
|
508
|
+
},
|
|
509
|
+
children: (e) => (() => {
|
|
510
|
+
var n = J();
|
|
511
|
+
return d(n, e), u((r) => {
|
|
512
|
+
var i = e !== t().text || void 0, a = e === t().text ? void 0 : "glim-select-ghost";
|
|
513
|
+
return i !== r.e && m(n, "aria-hidden", r.e = i), a !== r.t && c(n, r.t = a), r;
|
|
514
|
+
}, {
|
|
515
|
+
e: void 0,
|
|
516
|
+
t: void 0
|
|
517
|
+
}), n;
|
|
518
|
+
})()
|
|
519
|
+
})), e;
|
|
520
|
+
})()];
|
|
521
|
+
}
|
|
522
|
+
function $(e, t) {
|
|
523
|
+
let [n, r] = S(), i = s(() => e.tip, () => !!e.disabled);
|
|
524
|
+
return b(() => {
|
|
525
|
+
let r = n();
|
|
526
|
+
r && E(M(r, (n) => {
|
|
527
|
+
if (e.disabled || e.busy) return;
|
|
528
|
+
let r = V(t(), e.value, n);
|
|
529
|
+
r !== void 0 && e.onChange(r);
|
|
530
|
+
}));
|
|
531
|
+
}), b(T(() => e.shake ?? 0, (e) => {
|
|
532
|
+
let t = n();
|
|
533
|
+
t && e > 0 && E(B(t));
|
|
534
|
+
})), {
|
|
535
|
+
el: n,
|
|
536
|
+
tip: i,
|
|
537
|
+
attach: (t) => {
|
|
538
|
+
r(t), i.ref(t), typeof e.ref == "function" && e.ref(t);
|
|
539
|
+
},
|
|
540
|
+
handlers: {
|
|
541
|
+
onFocus: i.handlers.onFocus,
|
|
542
|
+
onBlur: i.handlers.onBlur,
|
|
543
|
+
onMouseEnter: i.handlers.onMouseEnter,
|
|
544
|
+
onMouseLeave: i.handlers.onMouseLeave
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
export { le as Select };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type SelectMode, type SelectorActivation, type SelectorOrientation, type SelectorSize, type SelectorVariant } from "@glimstone/core";
|
|
3
|
+
export type { SelectMode, SelectorActivation, SelectorOrientation, SelectorSize, SelectorVariant } from "@glimstone/core";
|
|
4
|
+
export { selectorTabId } from "@glimstone/core";
|
|
5
|
+
export interface SelectorItem<V extends string | number = string> {
|
|
6
|
+
/** Stable id, handed back by onChange as it stands here. */
|
|
7
|
+
id: V;
|
|
8
|
+
label: string;
|
|
9
|
+
/** Shown before the label; in a tab strip it is tinted with its tab's hue.
|
|
10
|
+
* A function that draws a fresh one, since a strip that turns into its
|
|
11
|
+
* dropdown shows it in the list and on the trigger at once. */
|
|
12
|
+
glyph?: () => JSX.Element;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Why the segment is in its state, such as "Pick a folder first" on a
|
|
15
|
+
* disabled one. It goes into the bubble, which a keyboard reaches. */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** The fuller version of a terse label, shown in the bubble. */
|
|
18
|
+
tip?: string;
|
|
19
|
+
/** Shows the glyph alone in every mode but text; the label stays the name. */
|
|
20
|
+
iconOnly?: boolean;
|
|
21
|
+
/** Tiles only: the page's own address, so a tile can open in a new tab. */
|
|
22
|
+
href?: string;
|
|
23
|
+
/** Tiles only: a page with nothing on it yet, dimmed rather than hidden. */
|
|
24
|
+
dim?: boolean;
|
|
25
|
+
/** Attributes for the item's own segment, such as a data hook. */
|
|
26
|
+
attrs?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
export interface SelectorProps<M extends SelectMode = "one", V extends string | number = string> {
|
|
29
|
+
items: SelectorItem<V>[];
|
|
30
|
+
/** The accessible name of the strip, such as "Sort" or "Settings pages". Inside a FieldRow the row gives it. */
|
|
31
|
+
label?: string;
|
|
32
|
+
/** `one` picks a value, `many` toggles any number of them. Default `one`. */
|
|
33
|
+
select?: M;
|
|
34
|
+
/** The chosen id, or the chosen ids for `many`. */
|
|
35
|
+
value: M extends "many" ? readonly V[] : V | null;
|
|
36
|
+
/** Called with the new id, or the new list for `many`. */
|
|
37
|
+
onChange: (next: M extends "many" ? V[] : V) => void;
|
|
38
|
+
/** Called on every press and every arrow key that chooses, before the choice changes, also one on the segment already chosen. */
|
|
39
|
+
onPress?: (id: V) => void;
|
|
40
|
+
/** `vertical` is the column of tiles beside a settings area's pages. */
|
|
41
|
+
orientation?: SelectorOrientation;
|
|
42
|
+
size?: SelectorSize;
|
|
43
|
+
variant?: SelectorVariant;
|
|
44
|
+
/** "manual" moves the focus with the arrows and chooses on Space, Enter or a
|
|
45
|
+
* click, as a radio group; for a strip that saves a setting. */
|
|
46
|
+
activation?: SelectorActivation;
|
|
47
|
+
/** Pin every segment to the widest one's measured width, at least the shared
|
|
48
|
+
* floor where the row has room; the page-level picker. Where the pinned
|
|
49
|
+
* widths do not fit the row, the segments share it by their labels. */
|
|
50
|
+
equalWidth?: boolean;
|
|
51
|
+
/** Hug the segments instead of spanning the box, for a strip that shares a
|
|
52
|
+
* toolbar row, as it does inside a FieldRow. */
|
|
53
|
+
inline?: boolean;
|
|
54
|
+
/** Share the row evenly without a pinned width, for page tabs. Every strip
|
|
55
|
+
* keeps to one row; once its labels do not fit together it shows glyphs
|
|
56
|
+
* alone where every segment has one, a strip of one turns into a dropdown
|
|
57
|
+
* otherwise, and a `many` strip cuts its labels short. */
|
|
58
|
+
fit?: boolean;
|
|
59
|
+
/** Has no effect: every strip keeps to one row. */
|
|
60
|
+
pairsOnPhone?: boolean;
|
|
61
|
+
/** The button height for every segment, for a strip beside a Button. */
|
|
62
|
+
buttonHeight?: boolean;
|
|
63
|
+
/** Take a colour under rainbow. Turn it off where the colour means nothing,
|
|
64
|
+
* such as a strip of one, not for looks. */
|
|
65
|
+
hue?: boolean;
|
|
66
|
+
/** Makes the strip a tab strip for colour: each segment keeps its own
|
|
67
|
+
* palette position, counting from here. */
|
|
68
|
+
hueOffset?: number;
|
|
69
|
+
/** Disables every item; an item's own `disabled` applies on top. */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** The id of the panel a tab strip switches. The chosen tab controls it, and
|
|
72
|
+
* the panel names itself with `aria-labelledby={selectorTabId(panelId, id)}`. */
|
|
73
|
+
panelId?: string;
|
|
74
|
+
class?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function Selector<M extends SelectMode = "one", V extends string | number = string>(props: SelectorProps<M, V>): JSX.Element;
|
package/dist/Sheet.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type WindowAction } from "./WindowFootRow.tsx";
|
|
3
|
+
export interface SheetProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** The notch's words, also the sheet's accessible name. */
|
|
6
|
+
title: string;
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
/** The foot's buttons, in reading order, as a Window's. */
|
|
9
|
+
actions?: WindowAction[];
|
|
10
|
+
/** A quiet line at the start of the foot. */
|
|
11
|
+
start?: JSX.Element;
|
|
12
|
+
/** The words of the way out the sheet adds. */
|
|
13
|
+
text: {
|
|
14
|
+
cancel: string;
|
|
15
|
+
close: string;
|
|
16
|
+
};
|
|
17
|
+
/** Called for every way out; the caller sets `open` back. */
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function Sheet(props: SheetProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type SidebarCount } from "@glimstone/core";
|
|
3
|
+
export type { SidebarCount } from "@glimstone/core";
|
|
4
|
+
export interface SidebarRowProps extends Omit<JSX.AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "class" | "style"> {
|
|
5
|
+
/** The destination's name: shown, or hidden but still the link's name. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The destination's glyph. Without one the row shows its name in every mode. */
|
|
8
|
+
glyph?: JSX.Element;
|
|
9
|
+
/** Without one the row is a button. */
|
|
10
|
+
href?: string;
|
|
11
|
+
/** This destination is showing; the row is filled and marked as the current page. */
|
|
12
|
+
active?: boolean;
|
|
13
|
+
/** The row's rainbow position: its rank among the rows the rail shows, so a
|
|
14
|
+
* hidden row leaves no gap. */
|
|
15
|
+
hueIndex?: number;
|
|
16
|
+
/** The figure on the row, such as items that need attention. Nothing shows at zero. */
|
|
17
|
+
count?: SidebarCount;
|
|
18
|
+
/** A tree's row at this level, stepped in with a smaller glyph and gap. */
|
|
19
|
+
depth?: number;
|
|
20
|
+
/** What stands in the row before the link, such as a tree's toggle. */
|
|
21
|
+
before?: JSX.Element;
|
|
22
|
+
/** What stands in the row after the link, such as a meter or a pin. The link's
|
|
23
|
+
* press still covers the rest of the row. */
|
|
24
|
+
after?: JSX.Element;
|
|
25
|
+
class?: string;
|
|
26
|
+
style?: JSX.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare function SidebarRow(props: SidebarRowProps): JSX.Element;
|