@lardexx/react 1.0.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/LICENSE +23 -0
- package/README.md +286 -0
- package/dist/icons-BbGGUHyX.cjs +2 -0
- package/dist/icons-BbGGUHyX.cjs.map +1 -0
- package/dist/icons-DQRCVyKi.js +126 -0
- package/dist/icons-DQRCVyKi.js.map +1 -0
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.js +13620 -0
- package/dist/icons.js.map +1 -0
- package/dist/oneui-react.cjs +2 -0
- package/dist/oneui-react.cjs.map +1 -0
- package/dist/oneui-react.css +2 -0
- package/dist/oneui-react.js +1402 -0
- package/dist/oneui-react.js.map +1 -0
- package/dist/types/components/AppInfo.d.ts +35 -0
- package/dist/types/components/AppInfo.d.ts.map +1 -0
- package/dist/types/components/BottomNav.d.ts +25 -0
- package/dist/types/components/BottomNav.d.ts.map +1 -0
- package/dist/types/components/Button.d.ts +16 -0
- package/dist/types/components/Button.d.ts.map +1 -0
- package/dist/types/components/ColorPickerPreference.d.ts +19 -0
- package/dist/types/components/ColorPickerPreference.d.ts.map +1 -0
- package/dist/types/components/DescriptionPreference.d.ts +18 -0
- package/dist/types/components/DescriptionPreference.d.ts.map +1 -0
- package/dist/types/components/Dialog.d.ts +38 -0
- package/dist/types/components/Dialog.d.ts.map +1 -0
- package/dist/types/components/Drawer.d.ts +24 -0
- package/dist/types/components/Drawer.d.ts.map +1 -0
- package/dist/types/components/GridMenuDialog.d.ts +27 -0
- package/dist/types/components/GridMenuDialog.d.ts.map +1 -0
- package/dist/types/components/HorizontalRadioPreference.d.ts +26 -0
- package/dist/types/components/HorizontalRadioPreference.d.ts.map +1 -0
- package/dist/types/components/Page.d.ts +66 -0
- package/dist/types/components/Page.d.ts.map +1 -0
- package/dist/types/components/Preference.d.ts +23 -0
- package/dist/types/components/Preference.d.ts.map +1 -0
- package/dist/types/components/PreferenceGroup.d.ts +20 -0
- package/dist/types/components/PreferenceGroup.d.ts.map +1 -0
- package/dist/types/components/ProgressBar.d.ts +35 -0
- package/dist/types/components/ProgressBar.d.ts.map +1 -0
- package/dist/types/components/ProgressDialog.d.ts +23 -0
- package/dist/types/components/ProgressDialog.d.ts.map +1 -0
- package/dist/types/components/RelatedCard.d.ts +22 -0
- package/dist/types/components/RelatedCard.d.ts.map +1 -0
- package/dist/types/components/RoundBox.d.ts +31 -0
- package/dist/types/components/RoundBox.d.ts.map +1 -0
- package/dist/types/components/Separator.d.ts +13 -0
- package/dist/types/components/Separator.d.ts.map +1 -0
- package/dist/types/components/Slider.d.ts +39 -0
- package/dist/types/components/Slider.d.ts.map +1 -0
- package/dist/types/components/SliderPreference.d.ts +22 -0
- package/dist/types/components/SliderPreference.d.ts.map +1 -0
- package/dist/types/components/Splash.d.ts +21 -0
- package/dist/types/components/Splash.d.ts.map +1 -0
- package/dist/types/components/Switch.d.ts +15 -0
- package/dist/types/components/Switch.d.ts.map +1 -0
- package/dist/types/components/SwitchBar.d.ts +38 -0
- package/dist/types/components/SwitchBar.d.ts.map +1 -0
- package/dist/types/components/SwitchPreference.d.ts +9 -0
- package/dist/types/components/SwitchPreference.d.ts.map +1 -0
- package/dist/types/components/Tabs.d.ts +31 -0
- package/dist/types/components/Tabs.d.ts.map +1 -0
- package/dist/types/components/TipPopup.d.ts +27 -0
- package/dist/types/components/TipPopup.d.ts.map +1 -0
- package/dist/types/components/TipsCard.d.ts +25 -0
- package/dist/types/components/TipsCard.d.ts.map +1 -0
- package/dist/types/components/Toast.d.ts +28 -0
- package/dist/types/components/Toast.d.ts.map +1 -0
- package/dist/types/icons.d.ts +47 -0
- package/dist/types/icons.d.ts.map +1 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/oneui-icons/OneIcon.d.ts +26 -0
- package/dist/types/oneui-icons/OneIcon.d.ts.map +1 -0
- package/dist/types/oneui-icons/generated.d.ts +2670 -0
- package/dist/types/oneui-icons/generated.d.ts.map +1 -0
- package/dist/types/oneui-icons/index.d.ts +18 -0
- package/dist/types/oneui-icons/index.d.ts.map +1 -0
- package/dist/types/strings.d.ts +44 -0
- package/dist/types/strings.d.ts.map +1 -0
- package/dist/types/theme.d.ts +47 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,1402 @@
|
|
|
1
|
+
import "./oneui-react.css";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, l as i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./icons-DQRCVyKi.js";
|
|
3
|
+
import { createContext as p, forwardRef as m, useCallback as h, useContext as g, useEffect as _, useId as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S, useSyncExternalStore as C } from "react";
|
|
4
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as D } from "react-dom";
|
|
6
|
+
import { createRoot as O } from "react-dom/client";
|
|
7
|
+
//#region src/strings.ts
|
|
8
|
+
var k = {
|
|
9
|
+
relatedDescription: "Looking for something else?",
|
|
10
|
+
newBadge: "N",
|
|
11
|
+
navigationDrawer: "Navigation drawer",
|
|
12
|
+
actionModeAll: "All",
|
|
13
|
+
actionModeSelected: (e) => `${e} selected`,
|
|
14
|
+
actionModeSelectItems: "Select items",
|
|
15
|
+
appInfo: "App info",
|
|
16
|
+
versionInfo: (e) => `Version ${e}`,
|
|
17
|
+
update: "Update",
|
|
18
|
+
retry: "Retry",
|
|
19
|
+
newVersionIsAvailable: "A new version is available.",
|
|
20
|
+
latestVersion: "The latest version is already installed.",
|
|
21
|
+
timeStart: "Start",
|
|
22
|
+
timeEnd: "End",
|
|
23
|
+
add: "Add",
|
|
24
|
+
apply: "Apply",
|
|
25
|
+
yes: "Yes",
|
|
26
|
+
cancel: "Cancel",
|
|
27
|
+
continue: "Continue",
|
|
28
|
+
disable: "Disable",
|
|
29
|
+
done: "Done",
|
|
30
|
+
edit: "Edit",
|
|
31
|
+
close: "Close",
|
|
32
|
+
tipHint: "Double tap this button to learn more."
|
|
33
|
+
};
|
|
34
|
+
function A(e) {
|
|
35
|
+
return e ? {
|
|
36
|
+
...k,
|
|
37
|
+
...e
|
|
38
|
+
} : k;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/theme.tsx
|
|
42
|
+
var j = p(null);
|
|
43
|
+
function M(e) {
|
|
44
|
+
return e === "system" ? typeof window > "u" || !window.matchMedia ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : e;
|
|
45
|
+
}
|
|
46
|
+
function N({ theme: e = "system", onThemeChange: t, strings: n, accent: r, radius: i, scope: a = "document", className: o, style: s, children: c }) {
|
|
47
|
+
let l = e, u = (e) => t?.(e);
|
|
48
|
+
_(() => {
|
|
49
|
+
if (l !== "system" || typeof window > "u" || !window.matchMedia) return;
|
|
50
|
+
let e = window.matchMedia("(prefers-color-scheme: dark)"), n = () => t?.("system");
|
|
51
|
+
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
52
|
+
}, [l, t]);
|
|
53
|
+
let d = M(l);
|
|
54
|
+
_(() => {
|
|
55
|
+
if (a !== "document" || typeof document > "u") return;
|
|
56
|
+
let e = document.documentElement;
|
|
57
|
+
return e.setAttribute("data-oneui-theme", d), () => {
|
|
58
|
+
e.getAttribute("data-oneui-theme") === d && e.removeAttribute("data-oneui-theme");
|
|
59
|
+
};
|
|
60
|
+
}, [d, a]);
|
|
61
|
+
let f = b(() => {
|
|
62
|
+
if (!r) return i === void 0 ? void 0 : {};
|
|
63
|
+
let e = typeof r == "string" ? r : r.primary;
|
|
64
|
+
return {
|
|
65
|
+
"--oui-primary": e,
|
|
66
|
+
"--oui-primary-dark": typeof r == "string" ? `color-mix(in srgb, ${e}, #000 20%)` : r.dark ?? e
|
|
67
|
+
};
|
|
68
|
+
}, [r]), p = i === void 0 ? s : {
|
|
69
|
+
"--oui-radius-page": `${i}px`,
|
|
70
|
+
...s
|
|
71
|
+
}, m = f ? {
|
|
72
|
+
...f,
|
|
73
|
+
...p
|
|
74
|
+
} : p, h = b(() => ({
|
|
75
|
+
theme: d,
|
|
76
|
+
preference: l,
|
|
77
|
+
setTheme: u,
|
|
78
|
+
strings: A(n)
|
|
79
|
+
}), [
|
|
80
|
+
d,
|
|
81
|
+
l,
|
|
82
|
+
n
|
|
83
|
+
]);
|
|
84
|
+
return /* @__PURE__ */ T(j.Provider, {
|
|
85
|
+
value: h,
|
|
86
|
+
children: /* @__PURE__ */ T("div", {
|
|
87
|
+
className: o,
|
|
88
|
+
"data-oneui-theme": a === "element" ? d : void 0,
|
|
89
|
+
"data-oneui-root": "",
|
|
90
|
+
style: m,
|
|
91
|
+
children: c
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function P() {
|
|
96
|
+
return g(j) || {
|
|
97
|
+
theme: M("system"),
|
|
98
|
+
preference: "system",
|
|
99
|
+
setTheme: () => {},
|
|
100
|
+
strings: A(void 0)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function F() {
|
|
104
|
+
let { theme: e, preference: t, setTheme: n } = P();
|
|
105
|
+
return {
|
|
106
|
+
theme: e,
|
|
107
|
+
preference: t,
|
|
108
|
+
setTheme: n
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function I() {
|
|
112
|
+
return P().strings;
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/utils.ts
|
|
116
|
+
function L(...e) {
|
|
117
|
+
return e.filter(Boolean).join(" ");
|
|
118
|
+
}
|
|
119
|
+
function R(e, t, n) {
|
|
120
|
+
return Math.min(n, Math.max(t, e));
|
|
121
|
+
}
|
|
122
|
+
function z(e, t, n) {
|
|
123
|
+
let r = e !== void 0, [i, a] = S(t), o = r ? e : i, s = x(n);
|
|
124
|
+
return s.current = n, [o, h((e) => {
|
|
125
|
+
r || a(e), s.current?.(e);
|
|
126
|
+
}, [r])];
|
|
127
|
+
}
|
|
128
|
+
function B(e, t) {
|
|
129
|
+
let n = x(t);
|
|
130
|
+
n.current = t, _(() => {
|
|
131
|
+
if (!e || typeof window > "u") return;
|
|
132
|
+
let t = (e) => {
|
|
133
|
+
e.key === "Escape" && n.current();
|
|
134
|
+
};
|
|
135
|
+
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
136
|
+
}, [e]);
|
|
137
|
+
}
|
|
138
|
+
function V(e) {
|
|
139
|
+
if (!e) return null;
|
|
140
|
+
if (typeof e == "function") return e();
|
|
141
|
+
if (typeof HTMLElement < "u" && e instanceof HTMLElement) return e.getBoundingClientRect();
|
|
142
|
+
if (typeof DOMRect < "u" && e instanceof DOMRect) return e;
|
|
143
|
+
let t = e.current;
|
|
144
|
+
return t ? t.getBoundingClientRect() : null;
|
|
145
|
+
}
|
|
146
|
+
var H = typeof window < "u" && typeof document < "u", U = 0, W = 1, G = 2, K = 4, ee = 8, te = 15, ne = 3, re = 12;
|
|
147
|
+
function ie(e) {
|
|
148
|
+
if (typeof e == "number") return e;
|
|
149
|
+
switch (e) {
|
|
150
|
+
case "all": return 15;
|
|
151
|
+
case "none": return 0;
|
|
152
|
+
case "top": return 3;
|
|
153
|
+
case "bottom": return 12;
|
|
154
|
+
case "topLeft": return 1;
|
|
155
|
+
case "topRight": return 2;
|
|
156
|
+
case "bottomLeft": return 4;
|
|
157
|
+
case "bottomRight": return 8;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function ae({ roundedCorners: e = 15, radius: t, color: n, as: r = "div", className: i, style: a, children: o, ...s }) {
|
|
161
|
+
let c = ie(e), l = t == null ? "var(--oui-radius-xl)" : `${t}px`, u = c & 1 ? l : "0", d = c & 2 ? l : "0", f = c & 4 ? l : "0", p = c & 8 ? l : "0";
|
|
162
|
+
return /* @__PURE__ */ T(r, {
|
|
163
|
+
className: L("oui-round", i),
|
|
164
|
+
style: {
|
|
165
|
+
borderRadius: `${u} ${d} ${p} ${f}`,
|
|
166
|
+
...n == null ? null : { background: n },
|
|
167
|
+
...a
|
|
168
|
+
},
|
|
169
|
+
...s,
|
|
170
|
+
children: o
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/components/Button.tsx
|
|
175
|
+
function oe({ variant: e = "colored", fullWidth: t = !1, className: n, children: r, type: i = "button", ...a }) {
|
|
176
|
+
return /* @__PURE__ */ T("button", {
|
|
177
|
+
type: i,
|
|
178
|
+
className: L("oui-btn", `oui-btn--${e}`, t && "oui-btn--full", "oui-press", n),
|
|
179
|
+
...a,
|
|
180
|
+
children: /* @__PURE__ */ T("span", {
|
|
181
|
+
className: "oui-btn__label",
|
|
182
|
+
children: r
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/components/Switch.tsx
|
|
188
|
+
var q = m(function({ checked: e, defaultChecked: t = !1, onChange: n, label: r, className: i, disabled: a, type: o = "button", ...s }, c) {
|
|
189
|
+
let [l, u] = z(e, t, n);
|
|
190
|
+
return /* @__PURE__ */ T("button", {
|
|
191
|
+
ref: c,
|
|
192
|
+
type: o,
|
|
193
|
+
role: "switch",
|
|
194
|
+
"aria-checked": l,
|
|
195
|
+
"aria-label": r,
|
|
196
|
+
disabled: a,
|
|
197
|
+
className: L("oui-switch", i),
|
|
198
|
+
onClick: () => u(!l),
|
|
199
|
+
...s,
|
|
200
|
+
children: /* @__PURE__ */ T("span", {
|
|
201
|
+
className: "oui-switch__track",
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
children: /* @__PURE__ */ T("span", { className: "oui-switch__thumb" })
|
|
204
|
+
})
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/components/SwitchBar.tsx
|
|
209
|
+
function se({ checked: e, defaultChecked: t, onChange: n, label: r, loading: i = !1, wrapContent: a = !0, className: o, contentClassName: s, children: c }) {
|
|
210
|
+
let l = /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("div", {
|
|
211
|
+
className: L("oui-switchbar", o),
|
|
212
|
+
"data-on": e,
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ T("span", {
|
|
215
|
+
className: "oui-switchbar__label",
|
|
216
|
+
children: r
|
|
217
|
+
}),
|
|
218
|
+
i ? /* @__PURE__ */ T("span", {
|
|
219
|
+
className: "oui-switchbar__spinner",
|
|
220
|
+
"aria-hidden": "true"
|
|
221
|
+
}) : null,
|
|
222
|
+
/* @__PURE__ */ T(q, {
|
|
223
|
+
checked: e,
|
|
224
|
+
defaultChecked: t,
|
|
225
|
+
onChange: n,
|
|
226
|
+
label: r
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}), a ? /* @__PURE__ */ T(ae, {
|
|
230
|
+
roundedCorners: 3,
|
|
231
|
+
className: L("oui-switchbar__content", s),
|
|
232
|
+
children: c
|
|
233
|
+
}) : c] });
|
|
234
|
+
return /* @__PURE__ */ T("div", {
|
|
235
|
+
className: "oui-switchbar-layout",
|
|
236
|
+
children: l
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function ce({ label: e, onClick: t, className: n }) {
|
|
240
|
+
return /* @__PURE__ */ T("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
className: L("oui-switchbar__action", "oui-press", n),
|
|
243
|
+
onClick: t,
|
|
244
|
+
children: e
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/components/Separator.tsx
|
|
249
|
+
function le({ children: e, className: t, ...n }) {
|
|
250
|
+
let r = e != null && e !== "";
|
|
251
|
+
return /* @__PURE__ */ T("div", {
|
|
252
|
+
role: r ? void 0 : "separator",
|
|
253
|
+
className: L("oui-separator", r ? "oui-separator--label" : "oui-separator--line", t),
|
|
254
|
+
...n,
|
|
255
|
+
children: r ? /* @__PURE__ */ T("span", {
|
|
256
|
+
className: "oui-separator__text",
|
|
257
|
+
children: e
|
|
258
|
+
}) : null
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/components/Toast.tsx
|
|
263
|
+
var ue = 0, J = [], de = /* @__PURE__ */ new Set(), fe = null, Y = null;
|
|
264
|
+
function pe() {
|
|
265
|
+
for (let e of de) e();
|
|
266
|
+
}
|
|
267
|
+
function me(e) {
|
|
268
|
+
return de.add(e), () => de.delete(e);
|
|
269
|
+
}
|
|
270
|
+
function he() {
|
|
271
|
+
return J;
|
|
272
|
+
}
|
|
273
|
+
function ge() {
|
|
274
|
+
H && (!Y || !document.body.contains(Y)) && (Y = document.createElement("div"), Y.className = "oui-toast-host", document.body.appendChild(Y), fe = O(Y), fe.render(/* @__PURE__ */ T(be, {})));
|
|
275
|
+
}
|
|
276
|
+
function _e(e, t = {}) {
|
|
277
|
+
if (!H) return -1;
|
|
278
|
+
let n = ++ue, r = t.position ?? "bottom";
|
|
279
|
+
ge(), J = [...J, {
|
|
280
|
+
id: n,
|
|
281
|
+
message: e,
|
|
282
|
+
position: r
|
|
283
|
+
}], pe();
|
|
284
|
+
let i = t.duration ?? 2200;
|
|
285
|
+
return i > 0 && window.setTimeout(() => ve(n), i), n;
|
|
286
|
+
}
|
|
287
|
+
function ve(e) {
|
|
288
|
+
J = J.filter((t) => t.id !== e), pe();
|
|
289
|
+
}
|
|
290
|
+
function ye() {
|
|
291
|
+
J = [], pe();
|
|
292
|
+
}
|
|
293
|
+
function be() {
|
|
294
|
+
let e = C(me, he, he);
|
|
295
|
+
return /* @__PURE__ */ T(w, { children: [
|
|
296
|
+
"bottom",
|
|
297
|
+
"top",
|
|
298
|
+
"center"
|
|
299
|
+
].map((t) => {
|
|
300
|
+
let n = e.filter((e) => e.position === t);
|
|
301
|
+
return n.length === 0 ? null : /* @__PURE__ */ T("div", {
|
|
302
|
+
className: L("oui-toast-viewport", `oui-toast-viewport--${t}`),
|
|
303
|
+
"aria-live": "polite",
|
|
304
|
+
children: n.map((e) => /* @__PURE__ */ T("div", {
|
|
305
|
+
className: "oui-toast",
|
|
306
|
+
role: "status",
|
|
307
|
+
children: /* @__PURE__ */ T("span", {
|
|
308
|
+
className: "oui-toast__text",
|
|
309
|
+
children: e.message
|
|
310
|
+
})
|
|
311
|
+
}, e.id))
|
|
312
|
+
}, t);
|
|
313
|
+
}) });
|
|
314
|
+
}
|
|
315
|
+
function xe({ open: e, onClose: t, duration: n = 2200, position: r = "bottom", children: i }) {
|
|
316
|
+
let [a, o] = S(e);
|
|
317
|
+
return _(() => o(e), [e]), _(() => {
|
|
318
|
+
if (!e || n <= 0) return;
|
|
319
|
+
let r = window.setTimeout(() => {
|
|
320
|
+
o(!1), t?.();
|
|
321
|
+
}, n);
|
|
322
|
+
return () => window.clearTimeout(r);
|
|
323
|
+
}, [
|
|
324
|
+
e,
|
|
325
|
+
n,
|
|
326
|
+
t
|
|
327
|
+
]), !a || !H ? null : D(/* @__PURE__ */ T("div", {
|
|
328
|
+
className: L("oui-toast-viewport", `oui-toast-viewport--${r}`),
|
|
329
|
+
"aria-live": "polite",
|
|
330
|
+
children: /* @__PURE__ */ T("div", {
|
|
331
|
+
className: "oui-toast",
|
|
332
|
+
role: "status",
|
|
333
|
+
children: /* @__PURE__ */ T("span", {
|
|
334
|
+
className: "oui-toast__text",
|
|
335
|
+
children: i
|
|
336
|
+
})
|
|
337
|
+
})
|
|
338
|
+
}), document.body);
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/components/Page.tsx
|
|
342
|
+
function Se({ title: e, expandedTitle: t, subtitle: n, expandedSubtitle: r, onNavClick: a, navIcon: o, navLabel: u, navBadge: d, navAsBack: f = !1, actions: p, expandable: m = !0, expanded: g = !0, onExpandedChange: v, searchMode: y = !1, searchQuery: b = "", searchPlaceholder: C = "Search", onSearchQueryChange: D, onSearchClose: O, searchTrailing: k, actionMode: A = null, headerBackground: j, footer: M, className: N, style: P, children: F }) {
|
|
343
|
+
let z = I(), B = x(null), V = x(null), H = x(null), [U, W] = S(+!g), G = h(() => {
|
|
344
|
+
let e = V.current;
|
|
345
|
+
return Math.max(e?.offsetHeight ?? 0, 1);
|
|
346
|
+
}, []), K = h(() => {
|
|
347
|
+
if (!m) return;
|
|
348
|
+
let e = B.current;
|
|
349
|
+
if (!e) return;
|
|
350
|
+
let t = R(e.scrollTop / G(), 0, 1);
|
|
351
|
+
W(t), v?.(t < .5);
|
|
352
|
+
}, [
|
|
353
|
+
m,
|
|
354
|
+
G,
|
|
355
|
+
v
|
|
356
|
+
]);
|
|
357
|
+
_(() => {
|
|
358
|
+
let e = B.current;
|
|
359
|
+
if (!e) return;
|
|
360
|
+
let t = g || !m ? 0 : G();
|
|
361
|
+
Math.abs(e.scrollTop - t) > 1 && (e.scrollTop = t, W(g || !m ? 0 : 1));
|
|
362
|
+
}, []);
|
|
363
|
+
let ee = x(g);
|
|
364
|
+
_(() => {
|
|
365
|
+
if (ee.current === g) return;
|
|
366
|
+
ee.current = g;
|
|
367
|
+
let e = B.current;
|
|
368
|
+
if (!e || !m) return;
|
|
369
|
+
let t = g ? 0 : G();
|
|
370
|
+
e.scrollTo({
|
|
371
|
+
top: t,
|
|
372
|
+
behavior: "smooth"
|
|
373
|
+
});
|
|
374
|
+
}, [g, m]), _(() => {
|
|
375
|
+
y && H.current?.focus();
|
|
376
|
+
}, [y]);
|
|
377
|
+
let te = R((U - .55) / .35, 0, 1), ne = U > .6 || !m || y || !!A, re = t ?? e, ie = r ?? n, ae = m && !y && !A, oe = a || o ? /* @__PURE__ */ E("button", {
|
|
378
|
+
type: "button",
|
|
379
|
+
className: "oui-page__nav oui-press",
|
|
380
|
+
"aria-label": u ?? z.navigationDrawer,
|
|
381
|
+
onClick: a,
|
|
382
|
+
children: [o ?? T(f ? l : i, {}), d != null && d !== 0 && d !== "" ? /* @__PURE__ */ T("span", {
|
|
383
|
+
className: "oui-page__nav-badge",
|
|
384
|
+
children: typeof d == "number" && d > 99 ? "99+" : d
|
|
385
|
+
}) : null]
|
|
386
|
+
}) : /* @__PURE__ */ T("span", {
|
|
387
|
+
className: "oui-page__nav-spacer",
|
|
388
|
+
"aria-hidden": "true"
|
|
389
|
+
}), q;
|
|
390
|
+
return q = A ? /* @__PURE__ */ E("div", {
|
|
391
|
+
className: "oui-page__action-mode",
|
|
392
|
+
role: "toolbar",
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ T("button", {
|
|
395
|
+
type: "button",
|
|
396
|
+
className: "oui-page__nav oui-press",
|
|
397
|
+
"aria-label": z.close,
|
|
398
|
+
onClick: A.onClose,
|
|
399
|
+
children: /* @__PURE__ */ T(s, {})
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ T("span", {
|
|
402
|
+
className: "oui-page__action-count",
|
|
403
|
+
children: A.count > 0 ? z.actionModeSelected(A.count) : z.actionModeSelectItems
|
|
404
|
+
}),
|
|
405
|
+
/* @__PURE__ */ T("span", { className: "oui-page__toolbar-spacer" }),
|
|
406
|
+
A.showAll !== !1 && A.onToggleAll ? /* @__PURE__ */ E("label", {
|
|
407
|
+
className: "oui-page__action-all",
|
|
408
|
+
children: [/* @__PURE__ */ T("input", {
|
|
409
|
+
type: "checkbox",
|
|
410
|
+
checked: !!A.allChecked,
|
|
411
|
+
onChange: (e) => A.onToggleAll?.(e.target.checked)
|
|
412
|
+
}), z.actionModeAll]
|
|
413
|
+
}) : null,
|
|
414
|
+
A.actions
|
|
415
|
+
]
|
|
416
|
+
}) : y ? /* @__PURE__ */ E("div", {
|
|
417
|
+
className: "oui-page__search",
|
|
418
|
+
role: "search",
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ T("button", {
|
|
421
|
+
type: "button",
|
|
422
|
+
className: "oui-page__nav oui-press",
|
|
423
|
+
"aria-label": z.close,
|
|
424
|
+
onClick: O,
|
|
425
|
+
children: /* @__PURE__ */ T(l, {})
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ T("input", {
|
|
428
|
+
ref: H,
|
|
429
|
+
className: "oui-page__search-input",
|
|
430
|
+
type: "search",
|
|
431
|
+
value: b,
|
|
432
|
+
placeholder: C,
|
|
433
|
+
"aria-label": C,
|
|
434
|
+
onChange: (e) => D?.(e.target.value)
|
|
435
|
+
}),
|
|
436
|
+
k ?? /* @__PURE__ */ T("span", {
|
|
437
|
+
className: "oui-page__search-icon",
|
|
438
|
+
"aria-hidden": "true",
|
|
439
|
+
children: /* @__PURE__ */ T(c, { size: 20 })
|
|
440
|
+
})
|
|
441
|
+
]
|
|
442
|
+
}) : /* @__PURE__ */ E(w, { children: [
|
|
443
|
+
oe,
|
|
444
|
+
/* @__PURE__ */ T("span", {
|
|
445
|
+
className: "oui-page__collapsed-title",
|
|
446
|
+
style: { opacity: m ? te : 1 },
|
|
447
|
+
"aria-hidden": m ? te < .5 : !1,
|
|
448
|
+
children: e
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ T("span", { className: "oui-page__toolbar-spacer" }),
|
|
451
|
+
p ? /* @__PURE__ */ T("div", {
|
|
452
|
+
className: "oui-page__actions",
|
|
453
|
+
children: p
|
|
454
|
+
}) : null
|
|
455
|
+
] }), /* @__PURE__ */ E("div", {
|
|
456
|
+
className: L("oui-page", N),
|
|
457
|
+
"data-collapsed": ne || void 0,
|
|
458
|
+
style: j ? { "--oui-header-bg": j } : void 0,
|
|
459
|
+
children: [/* @__PURE__ */ E("div", {
|
|
460
|
+
ref: B,
|
|
461
|
+
className: "oui-page__scroll",
|
|
462
|
+
onScroll: K,
|
|
463
|
+
children: [
|
|
464
|
+
/* @__PURE__ */ T("div", {
|
|
465
|
+
className: "oui-page__toolbar",
|
|
466
|
+
role: "toolbar",
|
|
467
|
+
"aria-label": e,
|
|
468
|
+
children: q
|
|
469
|
+
}),
|
|
470
|
+
ae ? /* @__PURE__ */ E("div", {
|
|
471
|
+
ref: V,
|
|
472
|
+
className: "oui-page__title-block",
|
|
473
|
+
children: [/* @__PURE__ */ T("h1", {
|
|
474
|
+
className: "oui-page__expanded-title",
|
|
475
|
+
children: re
|
|
476
|
+
}), ie ? /* @__PURE__ */ T("p", {
|
|
477
|
+
className: "oui-page__expanded-subtitle",
|
|
478
|
+
children: ie
|
|
479
|
+
}) : null]
|
|
480
|
+
}) : null,
|
|
481
|
+
/* @__PURE__ */ T("main", {
|
|
482
|
+
className: "oui-page__surface",
|
|
483
|
+
style: P,
|
|
484
|
+
children: F
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
}), M ? /* @__PURE__ */ T("div", {
|
|
488
|
+
className: "oui-page__footer",
|
|
489
|
+
children: M
|
|
490
|
+
}) : null]
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/components/BottomNav.tsx
|
|
495
|
+
function Ce({ items: e, value: t, onChange: n, variant: r = "fixed", className: i, "aria-label": a }) {
|
|
496
|
+
return /* @__PURE__ */ T("nav", {
|
|
497
|
+
className: L("oui-bottom-nav", `oui-bottom-nav--${r}`, i),
|
|
498
|
+
"aria-label": a,
|
|
499
|
+
children: e.map((e) => {
|
|
500
|
+
let r = e.key === t;
|
|
501
|
+
return /* @__PURE__ */ E("button", {
|
|
502
|
+
type: "button",
|
|
503
|
+
className: L("oui-bottom-nav__item", r && "is-active"),
|
|
504
|
+
"aria-current": r ? "page" : void 0,
|
|
505
|
+
disabled: e.disabled,
|
|
506
|
+
onClick: () => n?.(e.key),
|
|
507
|
+
children: [/* @__PURE__ */ E("span", {
|
|
508
|
+
className: "oui-bottom-nav__icon",
|
|
509
|
+
"aria-hidden": "true",
|
|
510
|
+
children: [e.icon, e.badge != null && e.badge !== 0 && e.badge !== "" ? /* @__PURE__ */ T("span", {
|
|
511
|
+
className: "oui-bottom-nav__badge",
|
|
512
|
+
children: typeof e.badge == "number" && e.badge > 9 ? "9+" : e.badge
|
|
513
|
+
}) : null]
|
|
514
|
+
}), /* @__PURE__ */ T("span", {
|
|
515
|
+
className: "oui-bottom-nav__label",
|
|
516
|
+
children: e.label
|
|
517
|
+
})]
|
|
518
|
+
}, e.key);
|
|
519
|
+
})
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/components/Drawer.tsx
|
|
524
|
+
function we({ open: e, onClose: t, children: n, header: r, width: i = 320, dimColor: a, disableScrim: o = !1, className: s, "aria-label": c }) {
|
|
525
|
+
let l = I(), u = x(null), d = x(e);
|
|
526
|
+
return B(e, () => t?.()), _(() => {
|
|
527
|
+
e && !d.current && u.current?.focus(), d.current = e;
|
|
528
|
+
}, [e]), H ? D(/* @__PURE__ */ E("div", {
|
|
529
|
+
className: L("oui-drawer-root", e && "is-open"),
|
|
530
|
+
"aria-hidden": !e,
|
|
531
|
+
children: [/* @__PURE__ */ T("div", {
|
|
532
|
+
className: "oui-drawer__scrim",
|
|
533
|
+
style: a ? { background: a } : void 0,
|
|
534
|
+
onClick: o ? void 0 : t,
|
|
535
|
+
"aria-hidden": "true"
|
|
536
|
+
}), /* @__PURE__ */ E("div", {
|
|
537
|
+
ref: u,
|
|
538
|
+
className: L("oui-drawer", s),
|
|
539
|
+
style: { width: `min(${i}px, 86vw)` },
|
|
540
|
+
role: "dialog",
|
|
541
|
+
"aria-modal": "true",
|
|
542
|
+
"aria-label": c ?? l.navigationDrawer,
|
|
543
|
+
tabIndex: -1,
|
|
544
|
+
children: [r ? /* @__PURE__ */ T("div", {
|
|
545
|
+
className: "oui-drawer__header",
|
|
546
|
+
children: r
|
|
547
|
+
}) : null, /* @__PURE__ */ T("div", {
|
|
548
|
+
className: "oui-drawer__content",
|
|
549
|
+
children: n
|
|
550
|
+
})]
|
|
551
|
+
})]
|
|
552
|
+
}), document.body) : null;
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/components/Splash.tsx
|
|
556
|
+
function Te({ image: e, title: t, animated: n = !1, loop: r = !1, className: i, style: a }) {
|
|
557
|
+
return /* @__PURE__ */ E("div", {
|
|
558
|
+
className: L("oui-splash", i),
|
|
559
|
+
style: a,
|
|
560
|
+
role: "presentation",
|
|
561
|
+
children: [e ? /* @__PURE__ */ T("div", {
|
|
562
|
+
className: L("oui-splash__image", n && "oui-splash__image--animated", n && r && "is-looping"),
|
|
563
|
+
children: e
|
|
564
|
+
}) : null, t ? /* @__PURE__ */ T("p", {
|
|
565
|
+
className: "oui-splash__title",
|
|
566
|
+
children: t
|
|
567
|
+
}) : null]
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/components/ProgressBar.tsx
|
|
572
|
+
function X({ size: e = 40, strokeWidth: t = 3.5, value: n, message: r, className: i, "aria-label": a }) {
|
|
573
|
+
let o = (e - t) / 2, s = 2 * Math.PI * o, c = typeof n == "number", l = c ? Math.min(100, Math.max(0, n)) : 0;
|
|
574
|
+
return /* @__PURE__ */ E("div", {
|
|
575
|
+
className: L("oui-progress-circle", !c && "is-indeterminate", i),
|
|
576
|
+
style: {
|
|
577
|
+
width: e,
|
|
578
|
+
height: e
|
|
579
|
+
},
|
|
580
|
+
role: "progressbar",
|
|
581
|
+
"aria-valuemin": c ? 0 : void 0,
|
|
582
|
+
"aria-valuemax": c ? 100 : void 0,
|
|
583
|
+
"aria-valuenow": c ? Math.round(l) : void 0,
|
|
584
|
+
"aria-label": a ?? (c ? "Progress" : "Loading"),
|
|
585
|
+
children: [/* @__PURE__ */ E("svg", {
|
|
586
|
+
width: e,
|
|
587
|
+
height: e,
|
|
588
|
+
viewBox: `0 0 ${e} ${e}`,
|
|
589
|
+
"aria-hidden": "true",
|
|
590
|
+
children: [/* @__PURE__ */ T("circle", {
|
|
591
|
+
className: "oui-progress-circle__track",
|
|
592
|
+
cx: e / 2,
|
|
593
|
+
cy: e / 2,
|
|
594
|
+
r: o,
|
|
595
|
+
fill: "none",
|
|
596
|
+
strokeWidth: t
|
|
597
|
+
}), /* @__PURE__ */ T("circle", {
|
|
598
|
+
className: "oui-progress-circle__bar",
|
|
599
|
+
cx: e / 2,
|
|
600
|
+
cy: e / 2,
|
|
601
|
+
r: o,
|
|
602
|
+
fill: "none",
|
|
603
|
+
strokeWidth: t,
|
|
604
|
+
strokeLinecap: "round",
|
|
605
|
+
strokeDasharray: c ? `${l / 100 * s} ${s}` : void 0,
|
|
606
|
+
strokeDashoffset: c ? s * .25 : void 0,
|
|
607
|
+
transform: `rotate(-90 ${e / 2} ${e / 2})`
|
|
608
|
+
})]
|
|
609
|
+
}), r ? /* @__PURE__ */ T("span", {
|
|
610
|
+
className: "oui-progress-circle__message",
|
|
611
|
+
children: r
|
|
612
|
+
}) : null]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function Ee({ value: e, numberText: t, showPercent: n = !1, className: r, "aria-label": i }) {
|
|
616
|
+
let a = typeof e == "number", o = a ? Math.min(100, Math.max(0, e)) : 0, s = Math.round(o);
|
|
617
|
+
return /* @__PURE__ */ E("div", {
|
|
618
|
+
className: L("oui-progress-linear-wrap", r),
|
|
619
|
+
children: [/* @__PURE__ */ T("div", {
|
|
620
|
+
className: L("oui-progress-linear", !a && "is-indeterminate"),
|
|
621
|
+
role: "progressbar",
|
|
622
|
+
"aria-valuemin": a ? 0 : void 0,
|
|
623
|
+
"aria-valuemax": a ? 100 : void 0,
|
|
624
|
+
"aria-valuenow": a ? s : void 0,
|
|
625
|
+
"aria-label": i ?? "Loading",
|
|
626
|
+
children: /* @__PURE__ */ T("div", {
|
|
627
|
+
className: "oui-progress-linear__bar",
|
|
628
|
+
style: { width: `${o}%` }
|
|
629
|
+
})
|
|
630
|
+
}), t || n ? /* @__PURE__ */ E("div", {
|
|
631
|
+
className: "oui-progress-linear__footer",
|
|
632
|
+
children: [/* @__PURE__ */ T("span", {
|
|
633
|
+
className: "oui-progress-linear__number",
|
|
634
|
+
children: t
|
|
635
|
+
}), /* @__PURE__ */ T("span", {
|
|
636
|
+
className: "oui-progress-linear__percent",
|
|
637
|
+
children: n ? `${s}%` : ""
|
|
638
|
+
})]
|
|
639
|
+
}) : null]
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
function De({ variant: e = "circular", ...t }) {
|
|
643
|
+
return e === "circular" ? /* @__PURE__ */ T(X, { ...t }) : /* @__PURE__ */ T(Ee, { value: t.value });
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/components/AppInfo.tsx
|
|
647
|
+
function Oe({ name: e, version: t, versionText: n, icon: r, notice: i, loading: a = !1, actions: o, children: s, className: c, style: l }) {
|
|
648
|
+
let u = I(), d = n ?? (t ? u.versionInfo(t) : null);
|
|
649
|
+
return /* @__PURE__ */ T("div", {
|
|
650
|
+
className: L("oui-app-info", c),
|
|
651
|
+
style: l,
|
|
652
|
+
children: /* @__PURE__ */ E("div", {
|
|
653
|
+
className: "oui-app-info__upper",
|
|
654
|
+
children: [
|
|
655
|
+
r ? /* @__PURE__ */ T("div", {
|
|
656
|
+
className: "oui-app-info__icon",
|
|
657
|
+
children: r
|
|
658
|
+
}) : null,
|
|
659
|
+
/* @__PURE__ */ T("h1", {
|
|
660
|
+
className: "oui-app-info__name",
|
|
661
|
+
children: e
|
|
662
|
+
}),
|
|
663
|
+
d ? /* @__PURE__ */ T("p", {
|
|
664
|
+
className: "oui-app-info__version",
|
|
665
|
+
children: d
|
|
666
|
+
}) : null,
|
|
667
|
+
a ? /* @__PURE__ */ T("div", {
|
|
668
|
+
className: "oui-app-info__progress",
|
|
669
|
+
children: /* @__PURE__ */ T(X, { size: 40 })
|
|
670
|
+
}) : null,
|
|
671
|
+
i ? /* @__PURE__ */ T("p", {
|
|
672
|
+
className: "oui-app-info__notice",
|
|
673
|
+
children: i
|
|
674
|
+
}) : null,
|
|
675
|
+
o && o.length > 0 ? /* @__PURE__ */ T("div", {
|
|
676
|
+
className: "oui-app-info__actions",
|
|
677
|
+
children: o.map((e, t) => /* @__PURE__ */ T(oe, {
|
|
678
|
+
variant: e.variant === "primary" ? "colored" : "outline",
|
|
679
|
+
className: L("oui-app-info__button", e.variant !== "primary" && "oui-app-info__button--default"),
|
|
680
|
+
onClick: e.onClick,
|
|
681
|
+
disabled: e.disabled,
|
|
682
|
+
children: e.label
|
|
683
|
+
}, t))
|
|
684
|
+
}) : null,
|
|
685
|
+
s ? /* @__PURE__ */ T("div", {
|
|
686
|
+
className: "oui-app-info__children",
|
|
687
|
+
children: s
|
|
688
|
+
}) : null
|
|
689
|
+
]
|
|
690
|
+
})
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/components/Tabs.tsx
|
|
695
|
+
function ke({ items: e, value: t, onChange: n, variant: r = "underline", inset: i = 24, className: a, "aria-label": o }) {
|
|
696
|
+
let s = x(null);
|
|
697
|
+
return /* @__PURE__ */ T("div", {
|
|
698
|
+
ref: s,
|
|
699
|
+
role: "tablist",
|
|
700
|
+
"aria-label": o,
|
|
701
|
+
className: L("oui-tabs", `oui-tabs--${r}`, a),
|
|
702
|
+
style: { paddingInline: i },
|
|
703
|
+
onKeyDown: (r) => {
|
|
704
|
+
if (r.key !== "ArrowLeft" && r.key !== "ArrowRight") return;
|
|
705
|
+
let i = e.filter((e) => !e.disabled), a = i.findIndex((e) => e.key === t);
|
|
706
|
+
if (a < 0) return;
|
|
707
|
+
r.preventDefault();
|
|
708
|
+
let o = r.key === "ArrowRight" ? i[(a + 1) % i.length] : i[(a - 1 + i.length) % i.length];
|
|
709
|
+
n?.(o.key);
|
|
710
|
+
let c = s.current?.querySelector(`[data-key="${CSS.escape(o.key)}"]`);
|
|
711
|
+
c?.focus(), c?.scrollIntoView({
|
|
712
|
+
block: "nearest",
|
|
713
|
+
inline: "nearest"
|
|
714
|
+
});
|
|
715
|
+
},
|
|
716
|
+
children: e.map((e) => {
|
|
717
|
+
let i = e.key === t;
|
|
718
|
+
return /* @__PURE__ */ E("button", {
|
|
719
|
+
"data-key": e.key,
|
|
720
|
+
type: "button",
|
|
721
|
+
role: "tab",
|
|
722
|
+
"aria-selected": i,
|
|
723
|
+
disabled: e.disabled,
|
|
724
|
+
className: L("oui-tabs__tab", i && "is-active"),
|
|
725
|
+
onClick: () => n?.(e.key),
|
|
726
|
+
children: [
|
|
727
|
+
e.icon ? /* @__PURE__ */ T("span", {
|
|
728
|
+
className: "oui-tabs__icon",
|
|
729
|
+
children: e.icon
|
|
730
|
+
}) : null,
|
|
731
|
+
/* @__PURE__ */ T("span", {
|
|
732
|
+
className: "oui-tabs__label",
|
|
733
|
+
children: e.label
|
|
734
|
+
}),
|
|
735
|
+
e.badge != null && e.badge !== "" ? /* @__PURE__ */ T("span", {
|
|
736
|
+
className: "oui-tabs__badge",
|
|
737
|
+
children: e.badge
|
|
738
|
+
}) : null,
|
|
739
|
+
r === "underline" ? /* @__PURE__ */ T("span", {
|
|
740
|
+
className: "oui-tabs__indicator",
|
|
741
|
+
"aria-hidden": "true"
|
|
742
|
+
}) : null
|
|
743
|
+
]
|
|
744
|
+
}, e.key);
|
|
745
|
+
})
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/components/Slider.tsx
|
|
750
|
+
function Z(e, t, n) {
|
|
751
|
+
return n <= t ? 0 : (e - t) / (n - t) * 100;
|
|
752
|
+
}
|
|
753
|
+
function Ae(e, t, n, r) {
|
|
754
|
+
return R(r <= 0 ? e : t + Math.round((e - t) / r) * r, t, n);
|
|
755
|
+
}
|
|
756
|
+
function je({ value: e, onChange: t, onCommit: n, min: i = 0, max: a = 100, step: o = 1, disabled: s = !1, ticks: c = !1, stepper: l = !1, showValue: u = !1, units: f = "", formatValue: p, label: m, className: g, style: _ }) {
|
|
757
|
+
let v = x(null), [y, b] = S(null), C = Array.isArray(e), w = C ? e[0] : e, D = C ? e[1] : e, O = h((e) => p ? p(e) : `${Math.round(e * 100) / 100}${f}`, [p, f]), k = h((e) => {
|
|
758
|
+
let t = v.current;
|
|
759
|
+
if (!t) return i;
|
|
760
|
+
let n = t.getBoundingClientRect();
|
|
761
|
+
return Ae(i + (n.width > 0 ? (e - n.left) / n.width : 0) * (a - i), i, a, o);
|
|
762
|
+
}, [
|
|
763
|
+
i,
|
|
764
|
+
a,
|
|
765
|
+
o
|
|
766
|
+
]), A = h((e, n) => {
|
|
767
|
+
if (!C) {
|
|
768
|
+
t?.(e);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
let [r, i] = [w, D];
|
|
772
|
+
n === 0 ? r = Math.min(e, i) : i = Math.max(e, r), t?.([r, i]);
|
|
773
|
+
}, [
|
|
774
|
+
C,
|
|
775
|
+
w,
|
|
776
|
+
D,
|
|
777
|
+
t
|
|
778
|
+
]), j = (e) => {
|
|
779
|
+
if (s || !v.current) return;
|
|
780
|
+
e.preventDefault(), v.current.focus?.();
|
|
781
|
+
let t = k(e.clientX), n = C && Math.abs(t - D) < Math.abs(t - w) ? 1 : 0;
|
|
782
|
+
b(n), A(t, n), e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
783
|
+
}, M = (e) => {
|
|
784
|
+
s || y === null || A(k(e.clientX), y);
|
|
785
|
+
}, N = (t) => {
|
|
786
|
+
y !== null && (b(null), t.currentTarget.releasePointerCapture?.(t.pointerId), n?.(e));
|
|
787
|
+
}, P = (t) => {
|
|
788
|
+
if (s) return;
|
|
789
|
+
let r = o * 10, c = null, l = +!!C, u = C ? D : e;
|
|
790
|
+
switch (t.key) {
|
|
791
|
+
case "ArrowRight":
|
|
792
|
+
case "ArrowUp":
|
|
793
|
+
c = R(u + o, i, a);
|
|
794
|
+
break;
|
|
795
|
+
case "ArrowLeft":
|
|
796
|
+
case "ArrowDown":
|
|
797
|
+
c = R(u - o, i, a);
|
|
798
|
+
break;
|
|
799
|
+
case "PageUp":
|
|
800
|
+
c = R(u + r, i, a);
|
|
801
|
+
break;
|
|
802
|
+
case "PageDown":
|
|
803
|
+
c = R(u - r, i, a);
|
|
804
|
+
break;
|
|
805
|
+
case "Home":
|
|
806
|
+
c = i, C && (l = 1);
|
|
807
|
+
break;
|
|
808
|
+
case "End":
|
|
809
|
+
c = a;
|
|
810
|
+
break;
|
|
811
|
+
default: return;
|
|
812
|
+
}
|
|
813
|
+
t.preventDefault(), A(c, l), n?.(e);
|
|
814
|
+
}, F = c && o > 0 ? Math.round((a - i) / o) : 0, I = F > 0 && F <= 40, z = Z(w, i, a), B = Z(D, i, a), V = C ? z : 0, H = C ? B : Z(e, i, a), U = (e) => {
|
|
815
|
+
let t = Z(e === 0 ? w : D, i, a);
|
|
816
|
+
return /* @__PURE__ */ T("span", {
|
|
817
|
+
className: L("oui-slider__thumb", y === e && "is-dragging"),
|
|
818
|
+
style: { left: `${t}%` },
|
|
819
|
+
"aria-hidden": "true"
|
|
820
|
+
}, e);
|
|
821
|
+
}, W = C ? D : e, G = /* @__PURE__ */ E("div", {
|
|
822
|
+
ref: v,
|
|
823
|
+
className: L("oui-slider", s && "is-disabled", C && "is-range"),
|
|
824
|
+
style: {
|
|
825
|
+
"--oui-slider-fill-start": `${V}%`,
|
|
826
|
+
"--oui-slider-fill-end": `${H}%`
|
|
827
|
+
},
|
|
828
|
+
role: "slider",
|
|
829
|
+
tabIndex: s ? -1 : 0,
|
|
830
|
+
"aria-label": m,
|
|
831
|
+
"aria-valuemin": i,
|
|
832
|
+
"aria-valuemax": a,
|
|
833
|
+
"aria-valuenow": W,
|
|
834
|
+
"aria-valuetext": O(W),
|
|
835
|
+
"aria-disabled": s || void 0,
|
|
836
|
+
"aria-orientation": "horizontal",
|
|
837
|
+
onPointerDown: j,
|
|
838
|
+
onPointerMove: M,
|
|
839
|
+
onPointerUp: N,
|
|
840
|
+
onPointerCancel: N,
|
|
841
|
+
onKeyDown: P,
|
|
842
|
+
children: [
|
|
843
|
+
/* @__PURE__ */ E("div", {
|
|
844
|
+
className: "oui-slider__rail",
|
|
845
|
+
"aria-hidden": "true",
|
|
846
|
+
children: [/* @__PURE__ */ T("div", { className: "oui-slider__fill" }), I ? /* @__PURE__ */ T("div", {
|
|
847
|
+
className: "oui-slider__ticks",
|
|
848
|
+
children: Array.from({ length: F + 1 }, (e, t) => /* @__PURE__ */ T("span", {
|
|
849
|
+
className: "oui-slider__tick",
|
|
850
|
+
style: { left: `${t / F * 100}%` }
|
|
851
|
+
}, t))
|
|
852
|
+
}) : null]
|
|
853
|
+
}),
|
|
854
|
+
U(0),
|
|
855
|
+
C ? U(1) : null,
|
|
856
|
+
/* @__PURE__ */ T("input", {
|
|
857
|
+
className: "oui-slider__hidden-input",
|
|
858
|
+
type: "hidden",
|
|
859
|
+
name: m,
|
|
860
|
+
value: W,
|
|
861
|
+
readOnly: !0
|
|
862
|
+
})
|
|
863
|
+
]
|
|
864
|
+
}), K = u ? /* @__PURE__ */ T("div", {
|
|
865
|
+
className: "oui-slider__value",
|
|
866
|
+
children: O(W)
|
|
867
|
+
}) : null;
|
|
868
|
+
return l ? /* @__PURE__ */ E("div", {
|
|
869
|
+
className: L("oui-slider-wrap", "oui-slider-wrap--stepper", g),
|
|
870
|
+
style: _,
|
|
871
|
+
children: [
|
|
872
|
+
/* @__PURE__ */ T("button", {
|
|
873
|
+
type: "button",
|
|
874
|
+
className: "oui-slider__stepper oui-slider__stepper--minus oui-press",
|
|
875
|
+
"aria-label": "Decrease",
|
|
876
|
+
disabled: s || W <= i,
|
|
877
|
+
onClick: () => {
|
|
878
|
+
A(R(W - o, i, a), +!!C), n?.(e);
|
|
879
|
+
},
|
|
880
|
+
children: /* @__PURE__ */ T(r, {})
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ T("div", {
|
|
883
|
+
className: "oui-slider-wrap__track",
|
|
884
|
+
children: G
|
|
885
|
+
}),
|
|
886
|
+
/* @__PURE__ */ T("button", {
|
|
887
|
+
type: "button",
|
|
888
|
+
className: "oui-slider__stepper oui-slider__stepper--plus oui-press",
|
|
889
|
+
"aria-label": "Increase",
|
|
890
|
+
disabled: s || W >= a,
|
|
891
|
+
onClick: () => {
|
|
892
|
+
A(R(W + o, i, a), +!!C), n?.(e);
|
|
893
|
+
},
|
|
894
|
+
children: /* @__PURE__ */ T(d, {})
|
|
895
|
+
}),
|
|
896
|
+
K ? /* @__PURE__ */ T("div", {
|
|
897
|
+
className: "oui-slider-wrap__readout",
|
|
898
|
+
children: K
|
|
899
|
+
}) : null
|
|
900
|
+
]
|
|
901
|
+
}) : /* @__PURE__ */ E("div", {
|
|
902
|
+
className: L("oui-slider-wrap", g),
|
|
903
|
+
style: _,
|
|
904
|
+
children: [G, K]
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/components/Dialog.tsx
|
|
909
|
+
function Q({ open: e, onClose: t, title: n, children: r, actions: i, disableDismiss: a = !1, maxWidth: o = 360, className: s, "aria-label": c }) {
|
|
910
|
+
let l = v();
|
|
911
|
+
return B(e && !a, () => t?.()), !e || !H ? null : D(/* @__PURE__ */ E("div", {
|
|
912
|
+
className: "oui-dialog-root",
|
|
913
|
+
children: [/* @__PURE__ */ T("div", {
|
|
914
|
+
className: "oui-dialog__scrim",
|
|
915
|
+
onClick: a ? void 0 : t,
|
|
916
|
+
"aria-hidden": "true"
|
|
917
|
+
}), /* @__PURE__ */ E("div", {
|
|
918
|
+
className: L("oui-dialog", s),
|
|
919
|
+
role: "alertdialog",
|
|
920
|
+
"aria-modal": "true",
|
|
921
|
+
"aria-label": c ?? (n ? void 0 : "Dialog"),
|
|
922
|
+
"aria-labelledby": n ? l : void 0,
|
|
923
|
+
style: { maxWidth: o },
|
|
924
|
+
children: [
|
|
925
|
+
n ? /* @__PURE__ */ T("h2", {
|
|
926
|
+
className: "oui-dialog__title",
|
|
927
|
+
id: l,
|
|
928
|
+
children: n
|
|
929
|
+
}) : null,
|
|
930
|
+
r == null ? null : /* @__PURE__ */ T("div", {
|
|
931
|
+
className: "oui-dialog__body",
|
|
932
|
+
children: r
|
|
933
|
+
}),
|
|
934
|
+
i ? /* @__PURE__ */ T("div", {
|
|
935
|
+
className: "oui-dialog__actions",
|
|
936
|
+
children: i
|
|
937
|
+
}) : null
|
|
938
|
+
]
|
|
939
|
+
})]
|
|
940
|
+
}), document.body);
|
|
941
|
+
}
|
|
942
|
+
function Me({ children: e, onClick: t, disabled: n, emphasis: r, className: i, autoFocus: a }) {
|
|
943
|
+
return /* @__PURE__ */ T("button", {
|
|
944
|
+
type: "button",
|
|
945
|
+
className: L("oui-dialog__button", r && "is-emphasis", i),
|
|
946
|
+
onClick: t,
|
|
947
|
+
disabled: n,
|
|
948
|
+
autoFocus: a,
|
|
949
|
+
children: e
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
//#endregion
|
|
953
|
+
//#region src/components/ProgressDialog.tsx
|
|
954
|
+
function Ne({ open: e, onClose: t, variant: n = "circle", message: r, value: i, numberText: a, percentText: o, disableDismiss: s = !0, className: c, maxWidth: l, "aria-label": u }) {
|
|
955
|
+
let d = null;
|
|
956
|
+
return d = n === "circle" ? /* @__PURE__ */ T("div", {
|
|
957
|
+
className: "oui-progress-dialog__circle",
|
|
958
|
+
children: /* @__PURE__ */ T(X, {
|
|
959
|
+
size: 56,
|
|
960
|
+
strokeWidth: 4,
|
|
961
|
+
value: i,
|
|
962
|
+
message: o ?? (typeof i == "number" ? `${Math.round(i)}%` : void 0),
|
|
963
|
+
"aria-label": typeof r == "string" ? r : "Loading"
|
|
964
|
+
})
|
|
965
|
+
}) : n === "spinner" ? /* @__PURE__ */ E("div", {
|
|
966
|
+
className: "oui-progress-dialog__spinner",
|
|
967
|
+
children: [/* @__PURE__ */ T(X, {
|
|
968
|
+
size: 40,
|
|
969
|
+
"aria-label": "Loading"
|
|
970
|
+
}), r == null ? null : /* @__PURE__ */ T("div", {
|
|
971
|
+
className: "oui-progress-dialog__message",
|
|
972
|
+
children: r
|
|
973
|
+
})]
|
|
974
|
+
}) : /* @__PURE__ */ E("div", {
|
|
975
|
+
className: "oui-progress-dialog__horizontal",
|
|
976
|
+
children: [
|
|
977
|
+
r == null ? null : /* @__PURE__ */ T("div", {
|
|
978
|
+
className: "oui-progress-dialog__message",
|
|
979
|
+
children: r
|
|
980
|
+
}),
|
|
981
|
+
/* @__PURE__ */ T("div", {
|
|
982
|
+
className: "oui-progress-dialog__bar-space",
|
|
983
|
+
children: /* @__PURE__ */ T(Ee, { value: i })
|
|
984
|
+
}),
|
|
985
|
+
/* @__PURE__ */ E("div", {
|
|
986
|
+
className: "oui-progress-dialog__footer",
|
|
987
|
+
children: [/* @__PURE__ */ T("span", { children: a }), /* @__PURE__ */ T("span", { children: typeof i == "number" ? `${Math.round(i)}%` : "" })]
|
|
988
|
+
})
|
|
989
|
+
]
|
|
990
|
+
}), /* @__PURE__ */ T(Q, {
|
|
991
|
+
open: e,
|
|
992
|
+
onClose: t,
|
|
993
|
+
disableDismiss: s,
|
|
994
|
+
maxWidth: l ?? (n === "circle" ? 300 : 360),
|
|
995
|
+
className: L("oui-progress-dialog", `oui-progress-dialog--${n}`, c),
|
|
996
|
+
"aria-label": u ?? (typeof r == "string" ? r : "Loading"),
|
|
997
|
+
children: d
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
//#endregion
|
|
1001
|
+
//#region src/components/GridMenuDialog.tsx
|
|
1002
|
+
function Pe({ open: e, onClose: t, items: n, columns: r = 4, title: i, disableDismiss: a = !1, maxWidth: o, className: s, "aria-label": c }) {
|
|
1003
|
+
return /* @__PURE__ */ T(Q, {
|
|
1004
|
+
open: e,
|
|
1005
|
+
onClose: t,
|
|
1006
|
+
title: i,
|
|
1007
|
+
disableDismiss: a,
|
|
1008
|
+
maxWidth: o ?? 400,
|
|
1009
|
+
className: L("oui-grid-menu", s),
|
|
1010
|
+
"aria-label": c ?? (typeof i == "string" ? i : "Menu"),
|
|
1011
|
+
children: /* @__PURE__ */ T("div", {
|
|
1012
|
+
className: "oui-grid-menu__grid",
|
|
1013
|
+
style: { "--oui-grid-columns": r },
|
|
1014
|
+
role: "menu",
|
|
1015
|
+
children: n.map((e) => /* @__PURE__ */ E("button", {
|
|
1016
|
+
type: "button",
|
|
1017
|
+
role: "menuitem",
|
|
1018
|
+
className: "oui-grid-menu__item oui-press",
|
|
1019
|
+
disabled: e.disabled,
|
|
1020
|
+
onClick: () => {
|
|
1021
|
+
e.onClick?.(), t?.();
|
|
1022
|
+
},
|
|
1023
|
+
children: [/* @__PURE__ */ E("span", {
|
|
1024
|
+
className: "oui-grid-menu__icon",
|
|
1025
|
+
"aria-hidden": "true",
|
|
1026
|
+
children: [e.icon, e.badge != null && e.badge !== "" ? /* @__PURE__ */ T("span", {
|
|
1027
|
+
className: "oui-grid-menu__badge",
|
|
1028
|
+
children: e.badge
|
|
1029
|
+
}) : null]
|
|
1030
|
+
}), /* @__PURE__ */ T("span", {
|
|
1031
|
+
className: "oui-grid-menu__label",
|
|
1032
|
+
children: e.label
|
|
1033
|
+
})]
|
|
1034
|
+
}, e.key))
|
|
1035
|
+
})
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
//#endregion
|
|
1039
|
+
//#region src/components/RelatedCard.tsx
|
|
1040
|
+
function Fe({ title: e, links: t, onLinkClick: n, className: r }) {
|
|
1041
|
+
let i = I();
|
|
1042
|
+
return /* @__PURE__ */ E("section", {
|
|
1043
|
+
className: L("oui-related-card", r),
|
|
1044
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
1045
|
+
className: "oui-related-card__title",
|
|
1046
|
+
children: e ?? i.relatedDescription
|
|
1047
|
+
}), /* @__PURE__ */ T("div", {
|
|
1048
|
+
className: "oui-related-card__links",
|
|
1049
|
+
children: t.map((e, t) => {
|
|
1050
|
+
let r = /* @__PURE__ */ T("span", {
|
|
1051
|
+
className: "oui-related-card__label",
|
|
1052
|
+
children: e.label
|
|
1053
|
+
}), i = () => {
|
|
1054
|
+
n?.(e, t), e.onClick?.();
|
|
1055
|
+
};
|
|
1056
|
+
return e.href ? /* @__PURE__ */ T("a", {
|
|
1057
|
+
className: "oui-related-card__link oui-press",
|
|
1058
|
+
href: e.href,
|
|
1059
|
+
onClick: i,
|
|
1060
|
+
children: r
|
|
1061
|
+
}, e.key ?? `${e.label}-${t}`) : /* @__PURE__ */ T("button", {
|
|
1062
|
+
type: "button",
|
|
1063
|
+
className: "oui-related-card__link oui-press",
|
|
1064
|
+
onClick: i,
|
|
1065
|
+
children: r
|
|
1066
|
+
}, e.key ?? `${e.label}-${t}`);
|
|
1067
|
+
})
|
|
1068
|
+
})]
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
//#endregion
|
|
1072
|
+
//#region src/components/TipPopup.tsx
|
|
1073
|
+
function Ie({ open: e, anchor: t, onClose: n, children: r, action: i, placement: a = "top", disableDismiss: o = !1, className: s }) {
|
|
1074
|
+
let c = x(null), [l, u] = S(null);
|
|
1075
|
+
B(e && !o, () => n?.());
|
|
1076
|
+
let d = h(() => {
|
|
1077
|
+
let e = V(t), n = c.current;
|
|
1078
|
+
if (!e || !n) return;
|
|
1079
|
+
let r = n.getBoundingClientRect(), i = a, o = i === "top" ? e.top - r.height - 14 : e.bottom + 14;
|
|
1080
|
+
i === "top" && e.top < r.height + 28 ? (i = "bottom", o = e.bottom + 14) : i === "bottom" && e.bottom + r.height + 28 > window.innerHeight && (i = "top", o = e.top - r.height - 14);
|
|
1081
|
+
let s = e.left + e.width / 2, l = R(s - r.width / 2, 10, window.innerWidth - r.width - 10), d = R(s - l, 14, r.width - 14);
|
|
1082
|
+
u({
|
|
1083
|
+
top: o,
|
|
1084
|
+
left: l,
|
|
1085
|
+
arrowX: d,
|
|
1086
|
+
place: i
|
|
1087
|
+
});
|
|
1088
|
+
}, [t, a]);
|
|
1089
|
+
return y(() => {
|
|
1090
|
+
if (!e) {
|
|
1091
|
+
u(null);
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
d();
|
|
1095
|
+
}, [e, d]), _(() => {
|
|
1096
|
+
if (!e) return;
|
|
1097
|
+
let t = () => d();
|
|
1098
|
+
return window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
|
|
1099
|
+
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
|
|
1100
|
+
};
|
|
1101
|
+
}, [e, d]), _(() => {
|
|
1102
|
+
if (!e || o || !H) return;
|
|
1103
|
+
let t = (e) => {
|
|
1104
|
+
let t = c.current;
|
|
1105
|
+
t && !t.contains(e.target) && n?.();
|
|
1106
|
+
};
|
|
1107
|
+
return document.addEventListener("pointerdown", t), () => document.removeEventListener("pointerdown", t);
|
|
1108
|
+
}, [
|
|
1109
|
+
e,
|
|
1110
|
+
o,
|
|
1111
|
+
n
|
|
1112
|
+
]), !e || !H ? null : D(/* @__PURE__ */ E("div", {
|
|
1113
|
+
ref: c,
|
|
1114
|
+
className: L("oui-tip", s, l ? `oui-tip--${l.place}` : void 0),
|
|
1115
|
+
role: "tooltip",
|
|
1116
|
+
style: l ? {
|
|
1117
|
+
top: l.top,
|
|
1118
|
+
left: l.left,
|
|
1119
|
+
"--oui-tip-arrow-x": `${l.arrowX}px`
|
|
1120
|
+
} : {
|
|
1121
|
+
top: -9999,
|
|
1122
|
+
left: -9999,
|
|
1123
|
+
visibility: "hidden"
|
|
1124
|
+
},
|
|
1125
|
+
children: [
|
|
1126
|
+
/* @__PURE__ */ T("div", {
|
|
1127
|
+
className: "oui-tip__message",
|
|
1128
|
+
children: r
|
|
1129
|
+
}),
|
|
1130
|
+
i ? /* @__PURE__ */ T("button", {
|
|
1131
|
+
type: "button",
|
|
1132
|
+
className: "oui-tip__action oui-press",
|
|
1133
|
+
onClick: () => {
|
|
1134
|
+
i.onClick?.(), n?.();
|
|
1135
|
+
},
|
|
1136
|
+
children: i.label
|
|
1137
|
+
}) : null,
|
|
1138
|
+
/* @__PURE__ */ T("span", {
|
|
1139
|
+
className: "oui-tip__arrow",
|
|
1140
|
+
"aria-hidden": "true"
|
|
1141
|
+
})
|
|
1142
|
+
]
|
|
1143
|
+
}), document.body);
|
|
1144
|
+
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region src/components/PreferenceGroup.tsx
|
|
1147
|
+
function Le({ title: e, variant: t = "flat", className: n, children: r }) {
|
|
1148
|
+
return /* @__PURE__ */ E("div", {
|
|
1149
|
+
className: L("oui-pref-group", t === "card" && "oui-pref-group--card", n),
|
|
1150
|
+
children: [e != null && e !== "" ? /* @__PURE__ */ T("div", {
|
|
1151
|
+
className: "oui-pref-group__subheader",
|
|
1152
|
+
role: "presentation",
|
|
1153
|
+
children: e
|
|
1154
|
+
}) : null, /* @__PURE__ */ T("div", {
|
|
1155
|
+
className: "oui-pref-group__items",
|
|
1156
|
+
children: r
|
|
1157
|
+
})]
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region src/components/Preference.tsx
|
|
1162
|
+
function $({ icon: e, title: t, summary: n, end: r, onClick: i, disabled: a = !1, selected: o = !1, className: s, children: c }) {
|
|
1163
|
+
let l = !!i && !a;
|
|
1164
|
+
return /* @__PURE__ */ E("div", {
|
|
1165
|
+
className: L("oui-pref", l && "oui-pref--interactive oui-press", a && "is-disabled", o && "is-selected", e ? "has-icon" : "no-icon", s),
|
|
1166
|
+
role: l ? "button" : void 0,
|
|
1167
|
+
tabIndex: l ? 0 : void 0,
|
|
1168
|
+
"aria-disabled": a || void 0,
|
|
1169
|
+
onClick: l ? (e) => {
|
|
1170
|
+
i?.(e);
|
|
1171
|
+
} : void 0,
|
|
1172
|
+
onKeyDown: l ? (e) => {
|
|
1173
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), i?.(e));
|
|
1174
|
+
} : void 0,
|
|
1175
|
+
children: [
|
|
1176
|
+
e == null ? null : /* @__PURE__ */ T("div", {
|
|
1177
|
+
className: "oui-pref__icon",
|
|
1178
|
+
children: e
|
|
1179
|
+
}),
|
|
1180
|
+
/* @__PURE__ */ E("div", {
|
|
1181
|
+
className: "oui-pref__text",
|
|
1182
|
+
children: [
|
|
1183
|
+
/* @__PURE__ */ T("div", {
|
|
1184
|
+
className: "oui-pref__title",
|
|
1185
|
+
children: t
|
|
1186
|
+
}),
|
|
1187
|
+
n != null && n !== "" ? /* @__PURE__ */ T("div", {
|
|
1188
|
+
className: "oui-pref__summary",
|
|
1189
|
+
children: n
|
|
1190
|
+
}) : null,
|
|
1191
|
+
c
|
|
1192
|
+
]
|
|
1193
|
+
}),
|
|
1194
|
+
r == null ? null : /* @__PURE__ */ T("div", {
|
|
1195
|
+
className: "oui-pref__end",
|
|
1196
|
+
children: r
|
|
1197
|
+
})
|
|
1198
|
+
]
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/components/SwitchPreference.tsx
|
|
1203
|
+
function Re({ checked: e, defaultChecked: t, onChange: n, disabled: r, title: i, ...a }) {
|
|
1204
|
+
return /* @__PURE__ */ T($, {
|
|
1205
|
+
...a,
|
|
1206
|
+
title: i,
|
|
1207
|
+
disabled: r,
|
|
1208
|
+
onClick: r ? void 0 : () => n?.(!e),
|
|
1209
|
+
className: ["oui-pref-switch", a.className].filter(Boolean).join(" "),
|
|
1210
|
+
end: /* @__PURE__ */ T(q, {
|
|
1211
|
+
checked: e,
|
|
1212
|
+
defaultChecked: t,
|
|
1213
|
+
onChange: n,
|
|
1214
|
+
disabled: r,
|
|
1215
|
+
label: typeof i == "string" ? i : void 0,
|
|
1216
|
+
onClick: (e) => e.stopPropagation()
|
|
1217
|
+
})
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
//#endregion
|
|
1221
|
+
//#region src/components/SliderPreference.tsx
|
|
1222
|
+
function ze({ value: e, onChange: t, min: n, max: r, step: i, showValue: a = !0, units: o, formatValue: s, stepper: c = !1, ticks: l = !1, title: u, summary: d, disabled: f, className: p, ...m }) {
|
|
1223
|
+
return /* @__PURE__ */ T($, {
|
|
1224
|
+
...m,
|
|
1225
|
+
className: ["oui-pref-slider", p].filter(Boolean).join(" "),
|
|
1226
|
+
title: u,
|
|
1227
|
+
summary: d,
|
|
1228
|
+
disabled: f,
|
|
1229
|
+
children: /* @__PURE__ */ T("div", {
|
|
1230
|
+
className: "oui-pref-slider__controls",
|
|
1231
|
+
children: /* @__PURE__ */ T(je, {
|
|
1232
|
+
value: e,
|
|
1233
|
+
onChange: t,
|
|
1234
|
+
min: n,
|
|
1235
|
+
max: r,
|
|
1236
|
+
step: i,
|
|
1237
|
+
disabled: f,
|
|
1238
|
+
ticks: l,
|
|
1239
|
+
stepper: c,
|
|
1240
|
+
showValue: a,
|
|
1241
|
+
units: o,
|
|
1242
|
+
formatValue: s,
|
|
1243
|
+
label: typeof u == "string" ? u : void 0
|
|
1244
|
+
})
|
|
1245
|
+
})
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/components/DescriptionPreference.tsx
|
|
1250
|
+
function Be({ children: e, variant: t = "body", className: n }) {
|
|
1251
|
+
return /* @__PURE__ */ T("div", {
|
|
1252
|
+
className: L("oui-pref-description", t === "subheader" && "oui-pref-description--subheader", n),
|
|
1253
|
+
children: e
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region src/components/HorizontalRadioPreference.tsx
|
|
1258
|
+
function Ve({ options: e, value: t, onChange: n, withImages: r = !1, label: i, className: a }) {
|
|
1259
|
+
return /* @__PURE__ */ T("div", {
|
|
1260
|
+
className: L("oui-hradio", r && "oui-hradio--image", a),
|
|
1261
|
+
role: "radiogroup",
|
|
1262
|
+
"aria-label": i,
|
|
1263
|
+
children: e.map((e) => {
|
|
1264
|
+
let r = e.value === t;
|
|
1265
|
+
return /* @__PURE__ */ E("button", {
|
|
1266
|
+
type: "button",
|
|
1267
|
+
role: "radio",
|
|
1268
|
+
"aria-checked": r,
|
|
1269
|
+
disabled: e.disabled,
|
|
1270
|
+
className: L("oui-hradio__item", r && "is-selected"),
|
|
1271
|
+
onClick: () => n?.(e.value),
|
|
1272
|
+
children: [
|
|
1273
|
+
e.image ? /* @__PURE__ */ T("span", {
|
|
1274
|
+
className: "oui-hradio__image",
|
|
1275
|
+
"aria-hidden": "true",
|
|
1276
|
+
children: e.image
|
|
1277
|
+
}) : null,
|
|
1278
|
+
/* @__PURE__ */ T("span", {
|
|
1279
|
+
className: "oui-hradio__title",
|
|
1280
|
+
children: e.label
|
|
1281
|
+
}),
|
|
1282
|
+
e.subtitle ? /* @__PURE__ */ T("span", {
|
|
1283
|
+
className: "oui-hradio__subtitle",
|
|
1284
|
+
children: e.subtitle
|
|
1285
|
+
}) : null,
|
|
1286
|
+
/* @__PURE__ */ T("span", {
|
|
1287
|
+
className: "oui-hradio__radio",
|
|
1288
|
+
"aria-hidden": "true"
|
|
1289
|
+
})
|
|
1290
|
+
]
|
|
1291
|
+
}, e.value);
|
|
1292
|
+
})
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/components/TipsCard.tsx
|
|
1297
|
+
function He({ title: e, summary: t, children: n, actions: r, onClose: i, className: a }) {
|
|
1298
|
+
return /* @__PURE__ */ E("div", {
|
|
1299
|
+
className: L("oui-tips", a),
|
|
1300
|
+
children: [
|
|
1301
|
+
e == null ? null : /* @__PURE__ */ E("div", {
|
|
1302
|
+
className: "oui-tips__header",
|
|
1303
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
1304
|
+
className: "oui-tips__title",
|
|
1305
|
+
children: e
|
|
1306
|
+
}), i ? /* @__PURE__ */ T("button", {
|
|
1307
|
+
type: "button",
|
|
1308
|
+
className: "oui-tips__close",
|
|
1309
|
+
"aria-label": "Close",
|
|
1310
|
+
onClick: i,
|
|
1311
|
+
children: /* @__PURE__ */ T(s, {})
|
|
1312
|
+
}) : null]
|
|
1313
|
+
}),
|
|
1314
|
+
t == null ? null : /* @__PURE__ */ T("p", {
|
|
1315
|
+
className: "oui-tips__summary",
|
|
1316
|
+
children: t
|
|
1317
|
+
}),
|
|
1318
|
+
n ? /* @__PURE__ */ T("div", {
|
|
1319
|
+
className: "oui-tips__children",
|
|
1320
|
+
children: n
|
|
1321
|
+
}) : null,
|
|
1322
|
+
r && r.length > 0 ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("div", { className: "oui-tips__spacer" }), /* @__PURE__ */ T("div", {
|
|
1323
|
+
className: "oui-tips__actions",
|
|
1324
|
+
children: r.map((e) => /* @__PURE__ */ T("button", {
|
|
1325
|
+
type: "button",
|
|
1326
|
+
className: "oui-tips__button",
|
|
1327
|
+
onClick: e.onClick,
|
|
1328
|
+
children: e.label
|
|
1329
|
+
}, e.label))
|
|
1330
|
+
})] }) : /* @__PURE__ */ T("div", { className: "oui-tips__spacer" })
|
|
1331
|
+
]
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/components/ColorPickerPreference.tsx
|
|
1336
|
+
var Ue = [
|
|
1337
|
+
"#000000",
|
|
1338
|
+
"#3a3a3a",
|
|
1339
|
+
"#666666",
|
|
1340
|
+
"#9e9e9e",
|
|
1341
|
+
"#cfcfcf",
|
|
1342
|
+
"#ffffff",
|
|
1343
|
+
"#db332a",
|
|
1344
|
+
"#ef5e16",
|
|
1345
|
+
"#f4b400",
|
|
1346
|
+
"#14a866",
|
|
1347
|
+
"#0381fe",
|
|
1348
|
+
"#3e91ff",
|
|
1349
|
+
"#7e57c2",
|
|
1350
|
+
"#d81b60",
|
|
1351
|
+
"#8d6e63",
|
|
1352
|
+
"#607d8b"
|
|
1353
|
+
];
|
|
1354
|
+
function We({ value: e, onChange: t, swatches: n = Ue, showAlpha: r = !1, alpha: i = 1, onAlphaChange: a, title: o, summary: s, disabled: c, className: l, ...u }) {
|
|
1355
|
+
let d = (e) => [
|
|
1356
|
+
"#ffffff",
|
|
1357
|
+
"#cfcfcf",
|
|
1358
|
+
"#f4b400"
|
|
1359
|
+
].includes(e.toLowerCase());
|
|
1360
|
+
return /* @__PURE__ */ T($, {
|
|
1361
|
+
...u,
|
|
1362
|
+
className: L("oui-color-picker-pref", l),
|
|
1363
|
+
title: o,
|
|
1364
|
+
summary: s,
|
|
1365
|
+
disabled: c,
|
|
1366
|
+
children: /* @__PURE__ */ E("div", {
|
|
1367
|
+
className: "oui-color-picker",
|
|
1368
|
+
children: [/* @__PURE__ */ T("div", {
|
|
1369
|
+
className: "oui-color-picker__grid",
|
|
1370
|
+
role: "radiogroup",
|
|
1371
|
+
children: n.map((n) => /* @__PURE__ */ T("button", {
|
|
1372
|
+
type: "button",
|
|
1373
|
+
role: "radio",
|
|
1374
|
+
"aria-checked": n === e,
|
|
1375
|
+
"aria-label": n,
|
|
1376
|
+
disabled: c,
|
|
1377
|
+
className: L("oui-color-picker__swatch", n === e && "is-selected", d(n) && "is-light"),
|
|
1378
|
+
style: { "--swatch": n },
|
|
1379
|
+
onClick: () => t?.(n)
|
|
1380
|
+
}, n))
|
|
1381
|
+
}), r ? /* @__PURE__ */ E("div", {
|
|
1382
|
+
className: "oui-color-picker__alpha",
|
|
1383
|
+
children: [/* @__PURE__ */ T("input", {
|
|
1384
|
+
type: "range",
|
|
1385
|
+
min: 0,
|
|
1386
|
+
max: 100,
|
|
1387
|
+
value: Math.round(i * 100),
|
|
1388
|
+
disabled: c,
|
|
1389
|
+
"aria-label": "Alpha",
|
|
1390
|
+
onChange: (e) => a?.(Number(e.target.value) / 100)
|
|
1391
|
+
}), /* @__PURE__ */ E("span", {
|
|
1392
|
+
className: "oui-color-picker__alpha-value",
|
|
1393
|
+
children: [Math.round(i * 100), "%"]
|
|
1394
|
+
})]
|
|
1395
|
+
}) : null]
|
|
1396
|
+
})
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
//#endregion
|
|
1400
|
+
export { Oe as AppInfo, Ce as BottomNav, oe as Button, X as CircularProgress, We as ColorPickerPreference, Be as DescriptionPreference, Q as Dialog, Me as DialogButton, we as Drawer, Pe as GridMenuDialog, Ve as HorizontalRadioPreference, d as IconAdd, o as IconAppInfo, l as IconBack, e as IconCheck, s as IconClose, u as IconFolder, t as IconHome, i as IconMenu, f as IconMore, n as IconPerson, r as IconRemove, c as IconSearch, a as IconSettings, Ee as LinearProgress, N as OneUIProvider, Se as Page, $ as Preference, Le as PreferenceGroup, De as ProgressBar, Ne as ProgressDialog, te as ROUND_ALL, re as ROUND_BOTTOM, K as ROUND_BOTTOM_LEFT, ee as ROUND_BOTTOM_RIGHT, U as ROUND_NONE, ne as ROUND_TOP, W as ROUND_TOP_LEFT, G as ROUND_TOP_RIGHT, Fe as RelatedCard, ae as RoundBox, le as Separator, je as Slider, ze as SliderPreference, Te as Splash, q as Switch, se as SwitchBar, ce as SwitchBarAction, Re as SwitchPreference, ke as Tabs, Ie as TipPopup, He as TipsCard, xe as Toast, R as clamp, ye as clearToasts, L as cx, k as defaultStrings, ve as dismissToast, A as mergeStrings, _e as toast, P as useOneUI, I as useStrings, F as useTheme };
|
|
1401
|
+
|
|
1402
|
+
//# sourceMappingURL=oneui-react.js.map
|