@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
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { n as e, t } from "./useTipBubble-BJIYZw03.js";
|
|
2
|
+
import { t as n } from "./style-ByE-hij7.js";
|
|
3
|
+
import { S as r, a as i } from "./glyphs-xP5bYKa1.js";
|
|
4
|
+
import { Dynamic as a, className as o, createComponent as s, effect as c, insert as l, memo as u, mergeProps as d, setAttribute as f, style as p, template as m } from "solid-js/web";
|
|
5
|
+
import { Show as h, createMemo as g, createRenderEffect as _, createSignal as v, mergeProps as y, onCleanup as b, splitProps as x } from "solid-js";
|
|
6
|
+
import { DEFAULT_DENSITY as S, DEFAULT_MOTION as C, DEFAULT_SHAPE as w, applyAccent as T, applyDensity as E, applyMotion as D, applyRainbow as O, applyShape as k, busyRingView as A, buttonView as j, getLabelMode as M, hueVars as N, mediaMatches as P, narrowerThan as F, rainbowState as I, subscribeLabelMode as L, subscribeMedia as R, subscribeRainbow as z, takePageHue as B } from "@glimstone/core";
|
|
7
|
+
// src/engines.ts
|
|
8
|
+
function V(e) {
|
|
9
|
+
let [t, n] = v(M(e));
|
|
10
|
+
return b(L(() => n(M(e)))), t;
|
|
11
|
+
}
|
|
12
|
+
function H() {
|
|
13
|
+
let [e, t] = v(I());
|
|
14
|
+
return b(z(() => t(I()))), [e, O];
|
|
15
|
+
}
|
|
16
|
+
function U(e) {
|
|
17
|
+
return () => {
|
|
18
|
+
let t = e();
|
|
19
|
+
return t === void 0 ? void 0 : N(t);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function W(e, t) {
|
|
23
|
+
let [n, r] = v(t()), i = new MutationObserver(() => r(() => t()));
|
|
24
|
+
return i.observe(document.documentElement, {
|
|
25
|
+
attributes: !0,
|
|
26
|
+
attributeFilter: [e]
|
|
27
|
+
}), b(() => i.disconnect()), n;
|
|
28
|
+
}
|
|
29
|
+
function G() {
|
|
30
|
+
return [W("data-shape", () => document.documentElement.getAttribute("data-shape") ?? w), k];
|
|
31
|
+
}
|
|
32
|
+
function K() {
|
|
33
|
+
return [W("data-motion", () => document.documentElement.getAttribute("data-motion") ?? C), D];
|
|
34
|
+
}
|
|
35
|
+
function q() {
|
|
36
|
+
return [W("data-density", () => document.documentElement.getAttribute("data-density") ?? S), E];
|
|
37
|
+
}
|
|
38
|
+
function J() {
|
|
39
|
+
return [W("style", () => document.documentElement.style.getPropertyValue("--accent")), (e) => T(e || void 0)];
|
|
40
|
+
}
|
|
41
|
+
// src/BusyRing.tsx
|
|
42
|
+
var Y = /*#__PURE__*/ m("<span class=glim-sr-only>"), X = /*#__PURE__*/ m("<span data-glim=BusyRing><span class=glim-busy-ring-arc><span class=glim-busy-ring-tail></span></span><span class=\"glim-busy-ring-arc glim-busy-ring-arc--inner\"><span class=glim-busy-ring-tail>");
|
|
43
|
+
function Z(e) {
|
|
44
|
+
let t = () => A({
|
|
45
|
+
size: e.size,
|
|
46
|
+
delay: e.delay
|
|
47
|
+
});
|
|
48
|
+
return (() => {
|
|
49
|
+
var r = X();
|
|
50
|
+
return r.firstChild.nextSibling, l(r, s(h, {
|
|
51
|
+
get when() {
|
|
52
|
+
return e.label;
|
|
53
|
+
},
|
|
54
|
+
get children() {
|
|
55
|
+
var t = Y();
|
|
56
|
+
return l(t, () => e.label), t;
|
|
57
|
+
}
|
|
58
|
+
}), null), c((i) => {
|
|
59
|
+
var a = e.label ? "status" : void 0, s = !e.label || void 0, c = e.class ? `${t().className} ${e.class}` : t().className, l = n(t().style);
|
|
60
|
+
return a !== i.e && f(r, "role", i.e = a), s !== i.t && f(r, "aria-hidden", i.t = s), c !== i.a && o(r, i.a = c), i.o = p(r, l, i.o), i;
|
|
61
|
+
}, {
|
|
62
|
+
e: void 0,
|
|
63
|
+
t: void 0,
|
|
64
|
+
a: void 0,
|
|
65
|
+
o: void 0
|
|
66
|
+
}), r;
|
|
67
|
+
})();
|
|
68
|
+
}
|
|
69
|
+
// src/Button.tsx
|
|
70
|
+
var Q = /*#__PURE__*/ m("<span class=glim-btn-glyph>"), $ = /*#__PURE__*/ m("<span>");
|
|
71
|
+
function ee(f) {
|
|
72
|
+
let p = y({
|
|
73
|
+
tone: "neutral",
|
|
74
|
+
variant: "default",
|
|
75
|
+
disabled: !1,
|
|
76
|
+
type: "button",
|
|
77
|
+
class: "",
|
|
78
|
+
busy: !1,
|
|
79
|
+
autofocus: !1,
|
|
80
|
+
keepLabel: !1,
|
|
81
|
+
compact: !1
|
|
82
|
+
}, f), [m, S] = x(p, [
|
|
83
|
+
"label",
|
|
84
|
+
"labelKey",
|
|
85
|
+
"glyph",
|
|
86
|
+
"onClick",
|
|
87
|
+
"tone",
|
|
88
|
+
"variant",
|
|
89
|
+
"disabled",
|
|
90
|
+
"type",
|
|
91
|
+
"class",
|
|
92
|
+
"title",
|
|
93
|
+
"hueIndex",
|
|
94
|
+
"busy",
|
|
95
|
+
"autofocus",
|
|
96
|
+
"stage",
|
|
97
|
+
"keepLabel",
|
|
98
|
+
"compact",
|
|
99
|
+
"compactBelow",
|
|
100
|
+
"size",
|
|
101
|
+
"href",
|
|
102
|
+
"before",
|
|
103
|
+
"after",
|
|
104
|
+
"ref"
|
|
105
|
+
]), C = V("buttons"), [w, T] = v(!1);
|
|
106
|
+
_(() => {
|
|
107
|
+
let e = m.compactBelow;
|
|
108
|
+
if (e === void 0) return T(!1);
|
|
109
|
+
let t = F(e);
|
|
110
|
+
T(P(t)), b(R(t, () => T(P(t))));
|
|
111
|
+
});
|
|
112
|
+
let E = g(() => m.glyph ?? (m.labelKey ? r(m.labelKey) : void 0) ?? (m.variant === "chip" ? s(i, {}) : void 0)), D = g(() => j({
|
|
113
|
+
mode: C(),
|
|
114
|
+
label: m.label,
|
|
115
|
+
hasGlyph: !!E() || m.busy,
|
|
116
|
+
tone: m.tone,
|
|
117
|
+
variant: m.variant,
|
|
118
|
+
disabled: m.disabled,
|
|
119
|
+
keepLabel: m.keepLabel,
|
|
120
|
+
compact: m.compact || w(),
|
|
121
|
+
size: m.size,
|
|
122
|
+
title: m.title,
|
|
123
|
+
hueIndex: m.hueIndex,
|
|
124
|
+
stage: m.stage
|
|
125
|
+
})), O = t(() => D().tip, () => m.disabled), k = () => !!m.href && !m.disabled, A = (e) => {
|
|
126
|
+
O.ref(e), typeof m.ref == "function" && m.ref(e);
|
|
127
|
+
};
|
|
128
|
+
return [s(e, {
|
|
129
|
+
get on() {
|
|
130
|
+
return u(() => !!m.disabled)() && !!D().tip;
|
|
131
|
+
},
|
|
132
|
+
get show() {
|
|
133
|
+
return O.show;
|
|
134
|
+
},
|
|
135
|
+
get hide() {
|
|
136
|
+
return O.hide;
|
|
137
|
+
},
|
|
138
|
+
get children() {
|
|
139
|
+
return s(a, d({
|
|
140
|
+
get component() {
|
|
141
|
+
return k() ? "a" : "button";
|
|
142
|
+
},
|
|
143
|
+
"data-glim": "Button"
|
|
144
|
+
}, S, {
|
|
145
|
+
get href() {
|
|
146
|
+
return u(() => !!k())() ? m.href : void 0;
|
|
147
|
+
},
|
|
148
|
+
get type() {
|
|
149
|
+
return u(() => !!k())() ? void 0 : m.type;
|
|
150
|
+
},
|
|
151
|
+
get disabled() {
|
|
152
|
+
return u(() => !!k())() ? void 0 : m.disabled;
|
|
153
|
+
},
|
|
154
|
+
get autofocus() {
|
|
155
|
+
return u(() => !!k())() ? void 0 : m.autofocus;
|
|
156
|
+
},
|
|
157
|
+
ref: A,
|
|
158
|
+
onClick: () => m.onClick?.(),
|
|
159
|
+
get "aria-busy"() {
|
|
160
|
+
return m.busy || void 0;
|
|
161
|
+
},
|
|
162
|
+
get "aria-describedby"() {
|
|
163
|
+
return O.describedBy();
|
|
164
|
+
},
|
|
165
|
+
onMouseEnter: (e) => {
|
|
166
|
+
D().pageHue && B(e.currentTarget), O.show();
|
|
167
|
+
},
|
|
168
|
+
get onMouseLeave() {
|
|
169
|
+
return O.hide;
|
|
170
|
+
},
|
|
171
|
+
onFocus: (e) => {
|
|
172
|
+
D().pageHue && B(e.currentTarget), O.handlers.onFocus();
|
|
173
|
+
},
|
|
174
|
+
get onBlur() {
|
|
175
|
+
return O.hide;
|
|
176
|
+
},
|
|
177
|
+
get style() {
|
|
178
|
+
return n(D().style);
|
|
179
|
+
},
|
|
180
|
+
get class() {
|
|
181
|
+
return `${D().className} ${m.class}`.trim();
|
|
182
|
+
},
|
|
183
|
+
get children() {
|
|
184
|
+
return [
|
|
185
|
+
u(() => m.before),
|
|
186
|
+
s(h, {
|
|
187
|
+
get when() {
|
|
188
|
+
return D().showGlyph;
|
|
189
|
+
},
|
|
190
|
+
get children() {
|
|
191
|
+
var e = Q();
|
|
192
|
+
return l(e, s(h, {
|
|
193
|
+
get when() {
|
|
194
|
+
return m.busy;
|
|
195
|
+
},
|
|
196
|
+
get fallback() {
|
|
197
|
+
return E();
|
|
198
|
+
},
|
|
199
|
+
get children() {
|
|
200
|
+
return s(Z, {
|
|
201
|
+
size: "small",
|
|
202
|
+
delay: 0
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
})), e;
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
(() => {
|
|
209
|
+
var e = $();
|
|
210
|
+
return l(e, () => m.label), c(() => o(e, D().labelClass)), e;
|
|
211
|
+
})(),
|
|
212
|
+
u(() => m.after)
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
}), u(() => O.bubble)];
|
|
218
|
+
}
|
|
219
|
+
export { U as a, H as c, q as i, G as l, Z as n, V as o, J as r, K as s, ee as t };
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type ButtonSize, type ButtonTone, type ButtonVariant, type WidthStage } from "@glimstone/core";
|
|
3
|
+
export type { ButtonSize, ButtonTone, ButtonVariant } from "@glimstone/core";
|
|
4
|
+
export interface ButtonProps extends Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "class" | "disabled" | "onClick" | "title" | "type" | "autofocus" | "ref"> {
|
|
5
|
+
/** The button's words, present in every mode: visible, or hidden but
|
|
6
|
+
* announced and shown as the tooltip. Keep it stable, since a label that
|
|
7
|
+
* changes while the button works would resize it; put changing state in
|
|
8
|
+
* `title`. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** The translation key behind `label`, or `null` when the label is data such
|
|
11
|
+
* as a path. It picks the glyph by meaning (glyphFor), so the same verb
|
|
12
|
+
* wears the same symbol everywhere; an explicit `glyph` wins. */
|
|
13
|
+
labelKey: string | null;
|
|
14
|
+
/** Optional icon, overriding whatever `labelKey` would have chosen. Without
|
|
15
|
+
* either, glyph mode shows this button's text instead of an empty box. */
|
|
16
|
+
glyph?: JSX.Element;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
tone?: ButtonTone;
|
|
19
|
+
/** "chip" inside a pill, "icon" for a row action; see ButtonVariant. */
|
|
20
|
+
variant?: ButtonVariant;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Makes it a link with the button's look. A disabled one stays a disabled button. */
|
|
23
|
+
href?: string;
|
|
24
|
+
/** What stands before the glyph, such as a count. */
|
|
25
|
+
before?: JSX.Element;
|
|
26
|
+
/** What stands after the words, such as a key cap. */
|
|
27
|
+
after?: JSX.Element;
|
|
28
|
+
type?: "button" | "submit";
|
|
29
|
+
/** Extra explanation, and the place for anything that changes: the running
|
|
30
|
+
* state, or why the button is unavailable. It shows in the hover and focus
|
|
31
|
+
* bubble, joined with the label where the label is hidden, and still
|
|
32
|
+
* reaches a disabled button. */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** This button's own rainbow position, for a colour different from its card's. */
|
|
35
|
+
hueIndex?: number;
|
|
36
|
+
/** Receives the underlying <button>, so a dialog can move focus to it. */
|
|
37
|
+
ref?: HTMLButtonElement | ((el: HTMLButtonElement) => void);
|
|
38
|
+
/** Shows the busy ring in place of the glyph, at once. Separate from `disabled`, since a
|
|
39
|
+
* caller may want one without the other. */
|
|
40
|
+
busy?: boolean;
|
|
41
|
+
/** For a dialog that opens with focus on one of its buttons. */
|
|
42
|
+
autofocus?: boolean;
|
|
43
|
+
/** Forces a width stage, for two buttons in different components that should
|
|
44
|
+
* match: pass `groupStage([labelA, labelB])` to both. */
|
|
45
|
+
stage?: WidthStage;
|
|
46
|
+
/** Its glyph alone in a square in every label mode, where the words have no
|
|
47
|
+
* room. The label stays the name and the bubble. */
|
|
48
|
+
compact?: boolean;
|
|
49
|
+
/** Turns compact while the window is narrower than this many pixels. */
|
|
50
|
+
compactBelow?: number;
|
|
51
|
+
size?: ButtonSize;
|
|
52
|
+
/** Keeps the label visible in every mode, for a label that is content rather than a verb. */
|
|
53
|
+
keepLabel?: boolean;
|
|
54
|
+
class?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function Button(props: ButtonProps): JSX.Element;
|
package/dist/Card.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
/**
|
|
3
|
+
* The surface everything else sits on, and the one place a section heading is
|
|
4
|
+
* drawn.
|
|
5
|
+
*
|
|
6
|
+
* The `<h2>` holds a filled badge that straddles the card's top edge, so the box
|
|
7
|
+
* is `relative` for the notch to resolve against this card. The `hint` bubble
|
|
8
|
+
* rides inside the badge because the badge is out of normal flow. With a
|
|
9
|
+
* `hueIndex` the card sets `--accent` once for everything inside it, so no button
|
|
10
|
+
* has to derive the hue itself. A nested card drops its surface and side padding
|
|
11
|
+
* but keeps its top padding, which the heading notch pokes into.
|
|
12
|
+
*
|
|
13
|
+
* A card with neither `title` nor `hint` draws no heading.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Card(props: {
|
|
16
|
+
/** The section name. Omit it where a control inside already carries the same
|
|
17
|
+
* name; the badge still renders to keep the card's hue notch. */
|
|
18
|
+
title?: string;
|
|
19
|
+
/** Takes the title's place in the notch with markup, such as an unsaved dot. */
|
|
20
|
+
drawn?: JSX.Element;
|
|
21
|
+
/** One line saying what this whole card does, drawn as an "(i)" beside the
|
|
22
|
+
* title. */
|
|
23
|
+
hint?: string;
|
|
24
|
+
children: JSX.Element;
|
|
25
|
+
/** This card's position in the rainbow, counted across the cards visible on
|
|
26
|
+
* the active tab. Omit it for a tab's only card. */
|
|
27
|
+
hueIndex?: number;
|
|
28
|
+
/** This card sits inside another card that already provides the surface and
|
|
29
|
+
* the padding. */
|
|
30
|
+
nested?: boolean;
|
|
31
|
+
/** Data attributes for the box, so a component built on the card can name itself. */
|
|
32
|
+
[data: `data-${string}`]: string | undefined;
|
|
33
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type CarouselText } from "@glimstone/core";
|
|
3
|
+
export type { CarouselText } from "@glimstone/core";
|
|
4
|
+
export interface CarouselProps<T> {
|
|
5
|
+
/** The carousel's accessible name. */
|
|
6
|
+
label: string;
|
|
7
|
+
items: readonly T[];
|
|
8
|
+
/** The page in force, counted from 0. Left out, it keeps its own. */
|
|
9
|
+
page?: number;
|
|
10
|
+
onPageChange?: (page: number) => void;
|
|
11
|
+
slidesPerPage?: number;
|
|
12
|
+
/** Goes from the last page on to the first. */
|
|
13
|
+
loop?: boolean;
|
|
14
|
+
/** Draws a slide. */
|
|
15
|
+
slide: (item: T, index: number) => JSX.Element;
|
|
16
|
+
text?: Partial<CarouselText>;
|
|
17
|
+
}
|
|
18
|
+
export declare function Carousel<T>(raw: CarouselProps<T>): JSX.Element;
|
package/dist/Carousel.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { t as e } from "./Button-DNSkNN0r.js";
|
|
2
|
+
import { d as t, t as n } from "./glyphs-xP5bYKa1.js";
|
|
3
|
+
import { createComponent as r, insert as i, mergeProps as a, spread as o, template as s } from "solid-js/web";
|
|
4
|
+
import { Index as c, createMemo as l, createSignal as u, createUniqueId as d, mergeProps as f } from "solid-js";
|
|
5
|
+
import { CAROUSEL_TEXT as p, pageDir as m, stillMotion as h } from "@glimstone/core";
|
|
6
|
+
import { normalizeProps as g, useMachine as _ } from "@zag-js/solid";
|
|
7
|
+
import * as v from "@zag-js/carousel";
|
|
8
|
+
// src/Carousel.tsx
|
|
9
|
+
var y = /*#__PURE__*/ s("<section data-glim=Carousel><div></div><div><div>"), b = /*#__PURE__*/ s("<div>"), x = /*#__PURE__*/ s("<button>");
|
|
10
|
+
function S(s) {
|
|
11
|
+
let S = f({
|
|
12
|
+
slidesPerPage: 1,
|
|
13
|
+
loop: !1
|
|
14
|
+
}, s), C = () => ({
|
|
15
|
+
...p,
|
|
16
|
+
...S.text
|
|
17
|
+
}), w = d(), [T, E] = u(0), D = _(v.machine, () => ({
|
|
18
|
+
id: w,
|
|
19
|
+
dir: m(),
|
|
20
|
+
slideCount: S.items.length,
|
|
21
|
+
slidesPerPage: S.slidesPerPage,
|
|
22
|
+
loop: S.loop,
|
|
23
|
+
page: S.page ?? T(),
|
|
24
|
+
spacing: "var(--space-6)",
|
|
25
|
+
onPageChange: (e) => {
|
|
26
|
+
E(e.page), S.onPageChange?.(e.page);
|
|
27
|
+
},
|
|
28
|
+
translations: {
|
|
29
|
+
item: (e, t) => C().slide(e + 1, t),
|
|
30
|
+
indicator: (e) => C().goTo(e + 1)
|
|
31
|
+
}
|
|
32
|
+
})), O = l(() => v.connect(D, g));
|
|
33
|
+
return (() => {
|
|
34
|
+
var s = y(), l = s.firstChild, u = l.nextSibling, d = u.firstChild;
|
|
35
|
+
return o(s, a(() => O().getRootProps(), {
|
|
36
|
+
get "aria-label"() {
|
|
37
|
+
return S.label;
|
|
38
|
+
},
|
|
39
|
+
class: "glim-carousel"
|
|
40
|
+
}), !1, !0), o(l, a(() => O().getItemGroupProps(), { class: "glim-carousel-slides" }), !1, !0), i(l, r(c, {
|
|
41
|
+
get each() {
|
|
42
|
+
return S.items;
|
|
43
|
+
},
|
|
44
|
+
children: (e, t) => (() => {
|
|
45
|
+
var n = b();
|
|
46
|
+
return o(n, a(() => O().getItemProps({ index: t }), { class: "glim-carousel-slide" }), !1, !0), i(n, () => S.slide(e(), t)), n;
|
|
47
|
+
})()
|
|
48
|
+
})), o(u, a(() => O().getControlProps(), { class: "glim-carousel-control" }), !1, !0), i(u, r(e, {
|
|
49
|
+
get label() {
|
|
50
|
+
return C().previous;
|
|
51
|
+
},
|
|
52
|
+
labelKey: null,
|
|
53
|
+
get glyph() {
|
|
54
|
+
return r(n, {});
|
|
55
|
+
},
|
|
56
|
+
variant: "icon",
|
|
57
|
+
get disabled() {
|
|
58
|
+
return !O().canScrollPrev;
|
|
59
|
+
},
|
|
60
|
+
onClick: () => O().scrollPrev(h())
|
|
61
|
+
}), d), o(d, a(() => O().getIndicatorGroupProps(), { class: "glim-carousel-dots" }), !1, !0), i(d, r(c, {
|
|
62
|
+
get each() {
|
|
63
|
+
return O().pageSnapPoints;
|
|
64
|
+
},
|
|
65
|
+
children: (e, t) => (() => {
|
|
66
|
+
var e = x();
|
|
67
|
+
return o(e, a(() => O().getIndicatorProps({ index: t }), {
|
|
68
|
+
onClick: () => O().scrollTo(t, h()),
|
|
69
|
+
class: "glim-carousel-dot"
|
|
70
|
+
}), !1, !1), e;
|
|
71
|
+
})()
|
|
72
|
+
})), i(u, r(e, {
|
|
73
|
+
get label() {
|
|
74
|
+
return C().next;
|
|
75
|
+
},
|
|
76
|
+
labelKey: null,
|
|
77
|
+
get glyph() {
|
|
78
|
+
return r(t, {});
|
|
79
|
+
},
|
|
80
|
+
variant: "icon",
|
|
81
|
+
get disabled() {
|
|
82
|
+
return !O().canScrollNext;
|
|
83
|
+
},
|
|
84
|
+
onClick: () => O().scrollNext(h())
|
|
85
|
+
}), null), s;
|
|
86
|
+
})();
|
|
87
|
+
}
|
|
88
|
+
export { S as Carousel };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CheckboxProps {
|
|
2
|
+
checked: boolean;
|
|
3
|
+
/** Called with the flipped value when the box is activated. */
|
|
4
|
+
onChange: (next: boolean) => void;
|
|
5
|
+
/** Always the accessible name; shown beside the box unless hideLabel. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** For a grid whose row and column headings already say it, such as permissions. */
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
/** The box alone, without the frame and its hover ground, for a row or a cell of a dense list. Hides the label. */
|
|
10
|
+
slim?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function Checkbox(props: CheckboxProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CoffeeDialogProps {
|
|
2
|
+
/** `https://buymeacoffee.com/widget/page/<handle>` with its query. */
|
|
3
|
+
widgetUrl: string;
|
|
4
|
+
text: {
|
|
5
|
+
title: string;
|
|
6
|
+
/** The app's appeal, the same in every giving window. */
|
|
7
|
+
appeal: string;
|
|
8
|
+
/** One sentence: the payment happens at BMAC, and no account is needed. */
|
|
9
|
+
intro: string;
|
|
10
|
+
closeLabel: string;
|
|
11
|
+
};
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
/** The window's own card, for the app's Escape handling and focus trap. */
|
|
14
|
+
ref?: HTMLDivElement | ((el: HTMLDivElement) => void);
|
|
15
|
+
}
|
|
16
|
+
export declare function CoffeeDialog(props: CoffeeDialogProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export interface CollapsibleProps {
|
|
3
|
+
/** The words on the row that opens it, which are also its accessible name. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Whether it is open. Left out, it keeps its own state from `defaultOpen`. */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
children: JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export declare function Collapsible(raw: CollapsibleProps): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { s as e } from "./glyphs-xP5bYKa1.js";
|
|
2
|
+
import { createComponent as t, insert as n, mergeProps as r, spread as i, template as a } from "solid-js/web";
|
|
3
|
+
import { createMemo as o, createSignal as s, createUniqueId as c, mergeProps as l } from "solid-js";
|
|
4
|
+
import { pageDir as u } from "@glimstone/core";
|
|
5
|
+
import { normalizeProps as d, useMachine as f } from "@zag-js/solid";
|
|
6
|
+
import * as p from "@zag-js/collapsible";
|
|
7
|
+
// src/Collapsible.tsx
|
|
8
|
+
var m = /*#__PURE__*/ a("<div data-glim=Collapsible><button><span class=glim-disclosure-label></span><span></span></button><div><div class=glim-disclosure-body>");
|
|
9
|
+
function h(a) {
|
|
10
|
+
let h = l({
|
|
11
|
+
defaultOpen: !1,
|
|
12
|
+
disabled: !1
|
|
13
|
+
}, a), g = c(), [_, v] = s(h.defaultOpen), y = f(p.machine, () => ({
|
|
14
|
+
id: g,
|
|
15
|
+
dir: u(),
|
|
16
|
+
open: h.open ?? _(),
|
|
17
|
+
disabled: h.disabled,
|
|
18
|
+
onOpenChange: (e) => {
|
|
19
|
+
v(e.open), h.onOpenChange?.(e.open);
|
|
20
|
+
}
|
|
21
|
+
})), b = o(() => p.connect(y, d));
|
|
22
|
+
return (() => {
|
|
23
|
+
var a = m(), o = a.firstChild, s = o.firstChild, c = s.nextSibling, l = o.nextSibling, u = l.firstChild;
|
|
24
|
+
return i(a, r(() => b().getRootProps(), { class: "glim-collapsible" }), !1, !0), i(o, r(() => b().getTriggerProps(), { class: "glim-disclosure-trigger" }), !1, !0), n(s, () => h.label), i(c, r(() => b().getIndicatorProps(), { class: "glim-disclosure-indicator" }), !1, !0), n(c, t(e, {})), i(l, r(() => b().getContentProps(), { class: "glim-disclosure-content" }), !1, !0), n(u, () => h.children), a;
|
|
25
|
+
})();
|
|
26
|
+
}
|
|
27
|
+
export { h as Collapsible };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ColorName, type ColorPickerPanelText } from "@glimstone/core";
|
|
2
|
+
export type { ColorName, ColorPickerPanelText } from "@glimstone/core";
|
|
3
|
+
export interface ColorPickerProps {
|
|
4
|
+
/** The colour the picker starts from, as `#rrggbb`. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Apply or Enter, with the colour and the name it proposes. */
|
|
7
|
+
onApply: (hex: string, name: string | null) => void;
|
|
8
|
+
/** Every step of a drag, a key or a valid hex, for a live preview. */
|
|
9
|
+
onInput?: (hex: string) => void;
|
|
10
|
+
/** The control that opened the picker. With it the picker floats beside it
|
|
11
|
+
* and closes on Escape, on a click beside it and after Apply. */
|
|
12
|
+
anchor?: HTMLElement | null;
|
|
13
|
+
/** Called when a floating picker closes, however it closes. */
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/** The names a colour is matched against, nearest in OKLab. `false` shows none. */
|
|
16
|
+
names?: readonly ColorName[] | false;
|
|
17
|
+
/** The words, read when the picker opens. */
|
|
18
|
+
text?: Partial<ColorPickerPanelText>;
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function ColorPicker(props: ColorPickerProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SelectOption } from "./Select.tsx";
|
|
2
|
+
export interface ComboboxProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
hideLabel?: boolean;
|
|
5
|
+
options: SelectOption[];
|
|
6
|
+
/** The chosen value, or "" while nothing is chosen. */
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** The line the list shows when nothing matches. */
|
|
11
|
+
empty: string;
|
|
12
|
+
/** Accessible name of the button that opens the full list. */
|
|
13
|
+
toggleLabel: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function Combobox(props: ComboboxProps): import("solid-js").JSX.Element;
|
package/dist/Combobox.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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 { createComponent as i, effect as a, insert as o, mergeProps as s, setAttribute as c, spread as l, template as u } from "solid-js/web";
|
|
5
|
+
import { For as d, Show as f, createMemo as p, createSignal as m, createUniqueId as h } from "solid-js";
|
|
6
|
+
import { normalizeProps as g, useMachine as _ } from "@zag-js/solid";
|
|
7
|
+
import * as v from "@zag-js/combobox";
|
|
8
|
+
// src/Combobox.tsx
|
|
9
|
+
var y = /*#__PURE__*/ u("<li class=glim-select-empty>"), b = /*#__PURE__*/ u("<div><ul>"), x = /*#__PURE__*/ u("<div data-glim=Combobox><label></label><div><input><button><span class=glim-select-indicator>"), S = /*#__PURE__*/ u("<li><span></span><span>");
|
|
10
|
+
function C(u) {
|
|
11
|
+
let C = e(() => u.label), w = h(), [T, E] = m(u.options), D = _(v.machine, () => ({
|
|
12
|
+
id: w,
|
|
13
|
+
collection: v.collection({
|
|
14
|
+
items: T(),
|
|
15
|
+
itemToValue: (e) => e.value,
|
|
16
|
+
itemToString: (e) => e.label,
|
|
17
|
+
isItemDisabled: (e) => !!e.disabled
|
|
18
|
+
}),
|
|
19
|
+
value: u.value ? [u.value] : [],
|
|
20
|
+
placeholder: u.placeholder,
|
|
21
|
+
disabled: u.disabled,
|
|
22
|
+
positioning: {
|
|
23
|
+
sameWidth: !0,
|
|
24
|
+
gutter: 6
|
|
25
|
+
},
|
|
26
|
+
onOpenChange: ({ open: e }) => !e && E(u.options),
|
|
27
|
+
onInputValueChange: ({ inputValue: e }) => {
|
|
28
|
+
let t = e.toLocaleLowerCase();
|
|
29
|
+
E(u.options.filter((e) => e.label.toLocaleLowerCase().includes(t)));
|
|
30
|
+
},
|
|
31
|
+
onValueChange: (e) => u.onChange(e.value[0] ?? "")
|
|
32
|
+
})), O = p(() => v.connect(D, g));
|
|
33
|
+
return (() => {
|
|
34
|
+
var e = x(), p = e.firstChild, m = p.nextSibling, h = m.firstChild, g = h.nextSibling, _ = g.firstChild;
|
|
35
|
+
return l(e, s(() => O().getRootProps(), { class: "glim-combobox" }), !1, !0), l(p, s(() => O().getLabelProps(), { get class() {
|
|
36
|
+
return u.hideLabel || u.label === void 0 ? "glim-sr-only" : "glim-field-label";
|
|
37
|
+
} }), !1, !0), o(p, C), l(m, s(() => O().getControlProps(), { class: "glim-combobox-control" }), !1, !0), l(h, s(() => O().getInputProps(), { class: "glim-combobox-input" }), !1, !1), l(g, s(() => O().getTriggerProps(), {
|
|
38
|
+
get "aria-label"() {
|
|
39
|
+
return u.toggleLabel;
|
|
40
|
+
},
|
|
41
|
+
class: "glim-combobox-toggle"
|
|
42
|
+
}), !1, !0), o(_, i(n, {})), o(e, i(r, { get children() {
|
|
43
|
+
var e = b(), n = e.firstChild;
|
|
44
|
+
return l(e, s(() => O().getPositionerProps(), { class: "glim-select-positioner" }), !1, !0), l(n, s(() => O().getContentProps(), { class: "glim-select-content" }), !1, !0), o(n, i(f, {
|
|
45
|
+
get when() {
|
|
46
|
+
return T().length === 0;
|
|
47
|
+
},
|
|
48
|
+
get children() {
|
|
49
|
+
var e = y();
|
|
50
|
+
return o(e, () => u.empty), e;
|
|
51
|
+
}
|
|
52
|
+
}), null), o(n, i(d, {
|
|
53
|
+
get each() {
|
|
54
|
+
return T();
|
|
55
|
+
},
|
|
56
|
+
children: (e) => (() => {
|
|
57
|
+
var n = S(), r = n.firstChild, a = r.nextSibling;
|
|
58
|
+
return l(n, s(() => O().getItemProps({ item: e }), { class: "glim-select-item" }), !1, !0), l(r, s(() => O().getItemTextProps({ item: e })), !1, !0), o(r, () => e.label), l(a, s(() => O().getItemIndicatorProps({ item: e }), { class: "glim-select-check" }), !1, !0), o(a, i(t, {})), n;
|
|
59
|
+
})()
|
|
60
|
+
}), null), e;
|
|
61
|
+
} }), null), a(() => c(_, "data-state", O().open ? "open" : "closed")), e;
|
|
62
|
+
})();
|
|
63
|
+
}
|
|
64
|
+
export { C as Combobox };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export interface ConfirmDialogProps {
|
|
3
|
+
/** A generic title such as "Confirm"; the call site's own text is `message`. */
|
|
4
|
+
title: string;
|
|
5
|
+
/** The question or explanation, also the dialog's accessible description. */
|
|
6
|
+
message: string;
|
|
7
|
+
confirmLabel: string;
|
|
8
|
+
/** Translation key behind `confirmLabel`, so the confirm button can pick
|
|
9
|
+
* a glyph. Optional: a caller passing a composed or data label has none. */
|
|
10
|
+
confirmLabelKey?: string;
|
|
11
|
+
cancelLabel: string;
|
|
12
|
+
/** A control the confirming action needs an answer to, such as "also remove
|
|
13
|
+
* X?", shown under the message so the question is asked in one window.
|
|
14
|
+
* Keep it to a switch or two. */
|
|
15
|
+
extra?: JSX.Element;
|
|
16
|
+
/** Glyph for the confirm button. The action changes per call site, so no
|
|
17
|
+
* fixed key can name it; without one the button beside a glyphed Cancel
|
|
18
|
+
* looks unfinished. */
|
|
19
|
+
confirmGlyph?: JSX.Element;
|
|
20
|
+
/** Accessible name for the header close button, separate from cancelLabel so
|
|
21
|
+
* the two controls are not announced alike. Leave it out and the button is
|
|
22
|
+
* not drawn, since a corner close beside Cancel reads as a second choice. */
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
onConfirm: () => void;
|
|
25
|
+
onCancel: () => void;
|
|
26
|
+
/** The dialog card's root DOM node, for useConfirm's focus trap. */
|
|
27
|
+
ref?: HTMLDivElement | ((el: HTMLDivElement) => void);
|
|
28
|
+
}
|
|
29
|
+
export declare function ConfirmDialog(props: ConfirmDialogProps): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type MenuEntry as CoreMenuEntry, type MenuHead as CoreMenuHead, type MenuItem as CoreMenuItem } from "@glimstone/core";
|
|
3
|
+
export type MenuEntry = CoreMenuEntry<JSX.Element>;
|
|
4
|
+
export type MenuItem = CoreMenuItem<JSX.Element>;
|
|
5
|
+
export type MenuHead = CoreMenuHead<JSX.Element>;
|
|
6
|
+
export interface ContextMenuProps {
|
|
7
|
+
/** The point the menu hangs from, in viewport pixels, such as the pointer's. */
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
items: MenuEntry[];
|
|
11
|
+
/** Stand the menu on the point instead, for a menu opened from a bar at the bottom. */
|
|
12
|
+
above?: boolean;
|
|
13
|
+
/** The menu's accessible name. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** The menu element's id, for a caller or a script that looks for it. */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** The control that opened the menu. A click on it is not a click outside,
|
|
18
|
+
* and focus goes back to it; without one, focus goes back to wherever it was. */
|
|
19
|
+
opener?: HTMLElement | null;
|
|
20
|
+
/** Called on every way out: a choice, Escape, Tab or a click outside. */
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
/** Left or right on a row without a submenu, for a bar that steps to the next menu. */
|
|
23
|
+
onStep?: (direction: 1 | -1) => void;
|
|
24
|
+
/** Opens with the focus on the last row, as ArrowUp on a menu bar's word asks. */
|
|
25
|
+
fromEnd?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function ContextMenu(props: ContextMenuProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FieldWidth } from "@glimstone/core";
|
|
2
|
+
export interface CopyFieldProps {
|
|
3
|
+
value: string;
|
|
4
|
+
/** The field's accessible name, such as "Token". Inside a FieldRow the row gives it. */
|
|
5
|
+
label?: string;
|
|
6
|
+
width?: FieldWidth;
|
|
7
|
+
/** The button's words, before and for a moment after it copied. */
|
|
8
|
+
text?: {
|
|
9
|
+
copy: string;
|
|
10
|
+
copied: string;
|
|
11
|
+
};
|
|
12
|
+
/** Called after every press, with whether the value reached the clipboard. */
|
|
13
|
+
onCopy?: (done: boolean) => void;
|
|
14
|
+
/** Classes for the row, which carries the width. */
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function CopyField(props: CopyFieldProps): import("solid-js").JSX.Element;
|