@av-pi-studio/ui-library 0.0.0-stage → 0.0.115
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/CHANGELOG.md +24 -0
- package/README.md +137 -2
- package/dist/brand/config.d.ts +125 -0
- package/dist/brand/index.d.ts +3 -0
- package/dist/brand/index.js +6 -0
- package/dist/brand/theme-injection.d.ts +9 -0
- package/dist/breakpoints.d.ts +34 -0
- package/dist/breakpoints.js +32 -0
- package/dist/chunks/theme-injection-BHAAhBYz.js +103 -0
- package/dist/chunks/token-guard-B85Ysv3w.js +813 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1049 -0
- package/dist/kv-store.d.ts +3 -0
- package/dist/primitives/Announcer.d.ts +13 -0
- package/dist/primitives/Avatar.d.ts +15 -0
- package/dist/primitives/Button.d.ts +18 -0
- package/dist/primitives/Checkbox.d.ts +11 -0
- package/dist/primitives/Dialog.d.ts +58 -0
- package/dist/primitives/Divider.d.ts +10 -0
- package/dist/primitives/EmptyState.d.ts +11 -0
- package/dist/primitives/Icon.d.ts +20 -0
- package/dist/primitives/IconButton.d.ts +25 -0
- package/dist/primitives/Menu.d.ts +50 -0
- package/dist/primitives/Panel.d.ts +9 -0
- package/dist/primitives/Popover.d.ts +25 -0
- package/dist/primitives/ResizeHandle.d.ts +20 -0
- package/dist/primitives/ScreenTitle.d.ts +15 -0
- package/dist/primitives/ScrollArea.d.ts +11 -0
- package/dist/primitives/Select.d.ts +25 -0
- package/dist/primitives/Shortcut.d.ts +15 -0
- package/dist/primitives/Spinner.d.ts +14 -0
- package/dist/primitives/StatusBadge.d.ts +13 -0
- package/dist/primitives/StatusDot.d.ts +17 -0
- package/dist/primitives/Surface.d.ts +13 -0
- package/dist/primitives/Switch.d.ts +14 -0
- package/dist/primitives/TextInput.d.ts +14 -0
- package/dist/primitives/ToastViewport.d.ts +17 -0
- package/dist/primitives/helpers.d.ts +47 -0
- package/dist/primitives/index.d.ts +24 -0
- package/dist/primitives/useHover.d.ts +16 -0
- package/dist/reset.css +43 -0
- package/dist/stores/announcer-store.d.ts +37 -0
- package/dist/stores/toast-store.d.ts +37 -0
- package/dist/styles.css +1 -0
- package/dist/theme/ThemeBoundary.d.ts +38 -0
- package/dist/theme/appearance-store.d.ts +37 -0
- package/dist/theme/color-utils.d.ts +13 -0
- package/dist/theme/colors.d.ts +111 -0
- package/dist/theme/css-bridge.d.ts +21 -0
- package/dist/theme/dev-warnings.d.ts +23 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.js +39 -0
- package/dist/theme/palette.d.ts +19 -0
- package/dist/theme/theme.d.ts +47 -0
- package/dist/theme/token-guard.d.ts +20 -0
- package/dist/theme/tokens.d.ts +105 -0
- package/dist/theme/variants.d.ts +12 -0
- package/dist/ui/avatar.d.ts +11 -0
- package/dist/ui/button.d.ts +34 -0
- package/dist/ui/combobox.d.ts +55 -0
- package/dist/ui/index.d.ts +10 -0
- package/dist/ui/index.js +406 -0
- package/dist/ui/option-groups.d.ts +36 -0
- package/dist/ui/screen-header.d.ts +23 -0
- package/dist/ui/shortcut.d.ts +13 -0
- package/dist/ui/status-badge.d.ts +15 -0
- package/dist/ui/status-dot.d.ts +20 -0
- package/dist/ui/toast.d.ts +60 -0
- package/package.json +68 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1049 @@
|
|
|
1
|
+
import { r as me } from "./chunks/token-guard-B85Ysv3w.js";
|
|
2
|
+
import { D as To, a as xo, b as Eo, c as Co, T as No, d as Io, e as wo, f as Ao, g as Do, h as ko, i as Ro, j as Oo, k as Mo, l as Bo, m as Lo, n as Ho, o as $o, p as Po, q as Fo, s as Wo, t as Uo, u as Vo, v as Go, w as Xo, x as zo, y as Yo, z as Zo } from "./chunks/token-guard-B85Ysv3w.js";
|
|
3
|
+
import { B as jo, c as Qo, d as Ko, h as Jo, i as er, a as tr, l as nr, b as or, r as rr, e as sr } from "./chunks/theme-injection-BHAAhBYz.js";
|
|
4
|
+
import { jsx as i, jsxs as v, Fragment as _e } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as y, useSyncExternalStore as he, useEffect as R, useContext as ne, createContext as oe, forwardRef as M, useState as Y, useCallback as D, useId as fe } from "react";
|
|
6
|
+
import { resolveButtonState as re, BUTTON_ICON_SIZE as se, BUTTON_MIN_HEIGHT as G, BUTTON_FONT_SIZE as ie, BUTTON_PADDING_H as $, statusDotColor as ae, STATUS_DOT_SIZE as q, statusBadgeTokens as be, avatarInitial as ve, avatarColor as ge, formatChord as ye, formatCombo as Se, initialComboboxState as Te, comboboxReducer as xe, remainingMs as Ee, errorToast as Ce, copiedToast as Ne, buildToastEntry as Ie, toastTokens as we } from "./ui/index.js";
|
|
7
|
+
import { DEFAULT_TOAST_DURATION_MS as ar, EscStack as cr, alertIconInfo as lr, attachmentPillRemoveVisible as ur, buttonIconColorToken as dr, filterOptions as pr, ghostHoverIconToken as mr, groupOptions as _r, headerPadding as hr, withCustomValueOption as fr } from "./ui/index.js";
|
|
8
|
+
import { COMPACT_FORM_FACTOR_WIDTH as vr, FOOTER_HEIGHT as gr, HEADER_INNER_HEIGHT as yr, HEADER_INNER_HEIGHT_MOBILE as Sr, HEADER_TOP_PADDING_MOBILE as Tr, MAX_CONTENT_WIDTH as xr, WINDOW_CHROME as Er, WORKSPACE_SECONDARY_HEADER_HEIGHT as Cr, breakpoints as Nr, getBreakpoint as Ir, isCompactFormFactor as wr } from "./breakpoints.js";
|
|
9
|
+
import { create as ce } from "zustand";
|
|
10
|
+
import { createPortal as Ae } from "react-dom";
|
|
11
|
+
import { Loader2 as De, Check as ke, X } from "lucide-react";
|
|
12
|
+
import { clsx as m } from "clsx";
|
|
13
|
+
import * as g from "@radix-ui/react-dialog";
|
|
14
|
+
import * as I from "@radix-ui/react-dropdown-menu";
|
|
15
|
+
import * as N from "@radix-ui/react-popover";
|
|
16
|
+
const Re = "--piui-stylesheet", Oe = '[ui-library] styles.css is not loaded, so components render unstyled. Add `import "@av-pi-studio/ui-library/styles.css"` to your app entry.', Me = "[ui-library] More than one ThemeBoundary is mounted. Only one per document is supported: each writes the same CSS variables on <html>, so the last write wins.";
|
|
17
|
+
function Be(e) {
|
|
18
|
+
let t = !1, r = !1, n = 0;
|
|
19
|
+
return {
|
|
20
|
+
checkStylesheet(o) {
|
|
21
|
+
t || o(Re).trim() === "" && (t = !0, e(Oe));
|
|
22
|
+
},
|
|
23
|
+
registerBoundary() {
|
|
24
|
+
n += 1, n > 1 && !r && (r = !0, e(Me));
|
|
25
|
+
let o = !0;
|
|
26
|
+
return () => {
|
|
27
|
+
o && (o = !1, n -= 1);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const j = /* @__PURE__ */ Be(
|
|
33
|
+
(e) => console.warn(e)
|
|
34
|
+
), Le = {
|
|
35
|
+
get(e) {
|
|
36
|
+
try {
|
|
37
|
+
return globalThis.localStorage?.getItem(e) ?? null;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
set(e, t) {
|
|
43
|
+
try {
|
|
44
|
+
globalThis.localStorage?.setItem(e, t);
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, le = oe(null), ue = oe(null);
|
|
49
|
+
function kn({
|
|
50
|
+
store: e = Le,
|
|
51
|
+
storageKey: t,
|
|
52
|
+
brandConfig: r,
|
|
53
|
+
children: n
|
|
54
|
+
}) {
|
|
55
|
+
const o = y(null);
|
|
56
|
+
o.current || (o.current = me(e, r, { storageKey: t }), o.current.apply());
|
|
57
|
+
const s = o.current, c = he(s.subscribe, s.getState);
|
|
58
|
+
return R(() => s.listen(), [s]), R(() => {
|
|
59
|
+
if (process.env.NODE_ENV !== "production")
|
|
60
|
+
return j.checkStylesheet(
|
|
61
|
+
(l) => getComputedStyle(document.documentElement).getPropertyValue(l)
|
|
62
|
+
), j.registerBoundary();
|
|
63
|
+
}, []), /* @__PURE__ */ i(ue.Provider, { value: s, children: /* @__PURE__ */ i(le.Provider, { value: c, children: n }) });
|
|
64
|
+
}
|
|
65
|
+
function He() {
|
|
66
|
+
const e = ne(le);
|
|
67
|
+
if (!e)
|
|
68
|
+
throw new Error("useAppearance must be used within a ThemeBoundary");
|
|
69
|
+
return e;
|
|
70
|
+
}
|
|
71
|
+
function Rn() {
|
|
72
|
+
return He().resolvedTheme;
|
|
73
|
+
}
|
|
74
|
+
function On() {
|
|
75
|
+
const e = ne(ue);
|
|
76
|
+
if (!e)
|
|
77
|
+
throw new Error("useAppearanceControls must be used within a ThemeBoundary");
|
|
78
|
+
return e;
|
|
79
|
+
}
|
|
80
|
+
const $e = "piui-Button_btn_Gurhr", Pe = "piui-Button_secondary_RrsWU", Fe = "piui-Button_outline_u49OM", We = "piui-Button_ghost_4QL_5", Ue = "piui-Button_destructive_BMEqt", Ve = "piui-Button_iconOnly_7pcHE", Ge = "piui-Button_loadingSpinner_4QsZM", Xe = "piui-Button_piSpin_jrY7S", B = {
|
|
81
|
+
btn: $e,
|
|
82
|
+
default: "piui-Button_default_6Na6E",
|
|
83
|
+
secondary: Pe,
|
|
84
|
+
outline: Fe,
|
|
85
|
+
ghost: We,
|
|
86
|
+
destructive: Ue,
|
|
87
|
+
iconOnly: Ve,
|
|
88
|
+
loadingSpinner: Ge,
|
|
89
|
+
piSpin: Xe
|
|
90
|
+
};
|
|
91
|
+
function Mn({
|
|
92
|
+
variant: e = "default",
|
|
93
|
+
size: t = "md",
|
|
94
|
+
loading: r = !1,
|
|
95
|
+
disabled: n = !1,
|
|
96
|
+
leftIcon: o,
|
|
97
|
+
trailing: s,
|
|
98
|
+
iconOnly: c = !1,
|
|
99
|
+
children: l,
|
|
100
|
+
style: u,
|
|
101
|
+
className: p,
|
|
102
|
+
ref: b,
|
|
103
|
+
...a
|
|
104
|
+
}) {
|
|
105
|
+
const { opacity: d } = re({
|
|
106
|
+
pressed: !1,
|
|
107
|
+
disabled: n ?? !1,
|
|
108
|
+
loading: r
|
|
109
|
+
}), _ = n || r, x = se[t];
|
|
110
|
+
return /* @__PURE__ */ v(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
ref: b,
|
|
114
|
+
className: m(B.btn, B[e], c && B.iconOnly, p),
|
|
115
|
+
disabled: _,
|
|
116
|
+
"aria-busy": r || void 0,
|
|
117
|
+
style: {
|
|
118
|
+
minHeight: G[t],
|
|
119
|
+
paddingLeft: c ? void 0 : $[t],
|
|
120
|
+
paddingRight: c ? void 0 : $[t],
|
|
121
|
+
fontSize: ie[t],
|
|
122
|
+
opacity: d,
|
|
123
|
+
...c ? { width: G[t] } : {},
|
|
124
|
+
...u
|
|
125
|
+
},
|
|
126
|
+
...a,
|
|
127
|
+
children: [
|
|
128
|
+
r ? /* @__PURE__ */ i(De, { className: B.loadingSpinner, size: x, "aria-hidden": !0 }) : o ? /* @__PURE__ */ i("span", { "aria-hidden": !0, style: { display: "flex", alignItems: "center", flexShrink: 0 }, children: o }) : null,
|
|
129
|
+
l,
|
|
130
|
+
s && !r && /* @__PURE__ */ i("span", { "aria-hidden": !0, style: { display: "flex", alignItems: "center", flexShrink: 0 }, children: s })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
const ze = "piui-IconButton_iconBtn_1pjCh", Ye = "piui-IconButton_xs_XuhGZ", Ze = "piui-IconButton_sm_K4UxD", Q = {
|
|
136
|
+
iconBtn: ze,
|
|
137
|
+
xs: Ye,
|
|
138
|
+
sm: Ze
|
|
139
|
+
};
|
|
140
|
+
function K({
|
|
141
|
+
size: e = "xs",
|
|
142
|
+
hoverBase: t,
|
|
143
|
+
className: r,
|
|
144
|
+
style: n,
|
|
145
|
+
type: o = "button",
|
|
146
|
+
...s
|
|
147
|
+
}) {
|
|
148
|
+
return /* @__PURE__ */ i(
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
type: o,
|
|
152
|
+
className: m(Q.iconBtn, Q[e], r),
|
|
153
|
+
style: t ? { "--icon-btn-hover-base": t, ...n } : n,
|
|
154
|
+
...s
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
const qe = {
|
|
159
|
+
xs: 12,
|
|
160
|
+
sm: 14,
|
|
161
|
+
md: 16,
|
|
162
|
+
lg: 20
|
|
163
|
+
};
|
|
164
|
+
function je({
|
|
165
|
+
icon: e,
|
|
166
|
+
size: t = "md",
|
|
167
|
+
color: r = "currentColor",
|
|
168
|
+
className: n,
|
|
169
|
+
...o
|
|
170
|
+
}) {
|
|
171
|
+
const s = typeof t == "number" ? t : qe[t];
|
|
172
|
+
return /* @__PURE__ */ i(
|
|
173
|
+
e,
|
|
174
|
+
{
|
|
175
|
+
size: s,
|
|
176
|
+
color: r,
|
|
177
|
+
className: n,
|
|
178
|
+
"aria-hidden": o["aria-hidden"],
|
|
179
|
+
"aria-label": o["aria-label"]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const Qe = "piui-StatusDot_dot_FazEE", Ke = "piui-StatusDot_spinner_6EanG", Je = "piui-StatusDot_pulse_6SVAx", F = {
|
|
184
|
+
dot: Qe,
|
|
185
|
+
spinner: Ke,
|
|
186
|
+
pulse: Je
|
|
187
|
+
}, et = {
|
|
188
|
+
accent: "var(--pi-color-accent)",
|
|
189
|
+
statusSuccess: "var(--pi-color-statusSuccess)",
|
|
190
|
+
statusDanger: "var(--pi-color-statusDanger)",
|
|
191
|
+
statusWarning: "var(--pi-color-statusWarning)",
|
|
192
|
+
foregroundMuted: "var(--pi-color-foregroundMuted)"
|
|
193
|
+
};
|
|
194
|
+
function Bn({ className: e, pulse: t, "aria-label": r, ...n }) {
|
|
195
|
+
const o = ae(n);
|
|
196
|
+
if (!o) return null;
|
|
197
|
+
const s = n.status === "running" && !n.requiresAttention, c = s ? "var(--pi-color-accentBright, #a2b4d7)" : (
|
|
198
|
+
// against the dark surface at the small size this ring renders at.
|
|
199
|
+
et[o] ?? "currentColor"
|
|
200
|
+
);
|
|
201
|
+
return /* @__PURE__ */ i(
|
|
202
|
+
"span",
|
|
203
|
+
{
|
|
204
|
+
className: `${s ? F.spinner : F.dot}${t && !s ? ` ${F.pulse}` : ""}${e ? ` ${e}` : ""}`,
|
|
205
|
+
style: s ? { borderTopColor: c, borderRightColor: c } : {
|
|
206
|
+
width: `var(--status-dot-size, ${q}px)`,
|
|
207
|
+
height: `var(--status-dot-size, ${q}px)`,
|
|
208
|
+
backgroundColor: c
|
|
209
|
+
},
|
|
210
|
+
role: r ? "img" : "presentation",
|
|
211
|
+
"aria-label": r
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
const tt = "piui-StatusBadge_badge_dpv2y", nt = {
|
|
216
|
+
badge: tt
|
|
217
|
+
};
|
|
218
|
+
function Ln({ label: e, variant: t, className: r }) {
|
|
219
|
+
const { token: n } = be(t), o = `var(--pi-color-${n})`;
|
|
220
|
+
return /* @__PURE__ */ i(
|
|
221
|
+
"span",
|
|
222
|
+
{
|
|
223
|
+
className: `${nt.badge}${r ? ` ${r}` : ""}`,
|
|
224
|
+
style: {
|
|
225
|
+
backgroundColor: `color-mix(in srgb, ${o} 18%, transparent)`,
|
|
226
|
+
borderColor: `color-mix(in srgb, ${o} 45%, transparent)`,
|
|
227
|
+
color: o
|
|
228
|
+
},
|
|
229
|
+
children: e
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const ot = "piui-Avatar_avatar_tU-uh", rt = "piui-Avatar_avatarImg_Hvsfw", st = "piui-Avatar_avatarFallback_D9Coh", W = {
|
|
234
|
+
avatar: ot,
|
|
235
|
+
avatarImg: rt,
|
|
236
|
+
avatarFallback: st
|
|
237
|
+
};
|
|
238
|
+
function Hn({ projectKey: e, src: t, size: r = 32, className: n }) {
|
|
239
|
+
const o = ve(e), s = ge(e), c = Math.round(r * 0.4);
|
|
240
|
+
return /* @__PURE__ */ i(
|
|
241
|
+
"span",
|
|
242
|
+
{
|
|
243
|
+
className: `${W.avatar}${n ? ` ${n}` : ""}`,
|
|
244
|
+
style: { width: r, height: r, backgroundColor: t ? void 0 : s },
|
|
245
|
+
"aria-label": e,
|
|
246
|
+
role: "img",
|
|
247
|
+
children: t ? /* @__PURE__ */ i("img", { src: t, alt: e, className: W.avatarImg }) : /* @__PURE__ */ i("span", { className: W.avatarFallback, style: { fontSize: c }, "aria-hidden": !0, children: o })
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
const it = "piui-Shortcut_row_wIVo8", at = "piui-Shortcut_chip_7oXln", J = {
|
|
252
|
+
row: it,
|
|
253
|
+
chip: at
|
|
254
|
+
};
|
|
255
|
+
function $n({ combo: e, chord: t, os: r = "macos", className: n }) {
|
|
256
|
+
const o = t ? ye(t, r) : e ? Se(e, r) : "";
|
|
257
|
+
if (!o) return null;
|
|
258
|
+
const s = o.split(" ").filter(Boolean);
|
|
259
|
+
return /* @__PURE__ */ i(
|
|
260
|
+
"span",
|
|
261
|
+
{
|
|
262
|
+
className: `${J.row}${n ? ` ${n}` : ""}`,
|
|
263
|
+
"aria-label": o,
|
|
264
|
+
role: "presentation",
|
|
265
|
+
children: s.map((c, l) => /* @__PURE__ */ i("kbd", { className: J.chip, children: c }, l))
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
const ct = "piui-Spinner_spinner_i0Eo6", lt = {
|
|
270
|
+
spinner: ct
|
|
271
|
+
}, ut = { xs: 12, sm: 16, md: 20, lg: 24 }, dt = { xs: 1, sm: 2, md: 2, lg: 3 };
|
|
272
|
+
function Pn({
|
|
273
|
+
size: e = "md",
|
|
274
|
+
color: t = "currentColor",
|
|
275
|
+
className: r,
|
|
276
|
+
"aria-label": n = "Loading"
|
|
277
|
+
}) {
|
|
278
|
+
const o = typeof e == "number" ? e : ut[e], s = typeof e == "number" ? 2 : dt[e];
|
|
279
|
+
return /* @__PURE__ */ i(
|
|
280
|
+
"span",
|
|
281
|
+
{
|
|
282
|
+
className: `${lt.spinner}${r ? ` ${r}` : ""}`,
|
|
283
|
+
role: "status",
|
|
284
|
+
"aria-label": n,
|
|
285
|
+
style: {
|
|
286
|
+
width: o,
|
|
287
|
+
height: o,
|
|
288
|
+
borderWidth: s,
|
|
289
|
+
color: t
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
const pt = "piui-Divider_divider_kxikv", mt = "piui-Divider_horizontal_xrBl1", _t = "piui-Divider_vertical_X1mlS", U = {
|
|
295
|
+
divider: pt,
|
|
296
|
+
horizontal: mt,
|
|
297
|
+
vertical: _t
|
|
298
|
+
};
|
|
299
|
+
function Fn({ orientation: e = "horizontal", className: t }) {
|
|
300
|
+
return /* @__PURE__ */ i(
|
|
301
|
+
"hr",
|
|
302
|
+
{
|
|
303
|
+
className: `${U.divider} ${e === "vertical" ? U.vertical : U.horizontal}${t ? ` ${t}` : ""}`,
|
|
304
|
+
"aria-orientation": e,
|
|
305
|
+
role: "separator"
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
const ht = "piui-Switch_track_aPbaj", ft = "piui-Switch_checked_0nldb", bt = "piui-Switch_disabled_eqcyL", vt = "piui-Switch_thumb_LMs9-", L = {
|
|
310
|
+
track: ht,
|
|
311
|
+
checked: ft,
|
|
312
|
+
disabled: bt,
|
|
313
|
+
thumb: vt
|
|
314
|
+
};
|
|
315
|
+
function Wn({
|
|
316
|
+
checked: e,
|
|
317
|
+
onCheckedChange: t,
|
|
318
|
+
disabled: r = !1,
|
|
319
|
+
id: n,
|
|
320
|
+
"aria-label": o,
|
|
321
|
+
className: s
|
|
322
|
+
}) {
|
|
323
|
+
return /* @__PURE__ */ i(
|
|
324
|
+
"button",
|
|
325
|
+
{
|
|
326
|
+
id: n,
|
|
327
|
+
role: "switch",
|
|
328
|
+
"aria-checked": e,
|
|
329
|
+
"aria-label": o,
|
|
330
|
+
disabled: r,
|
|
331
|
+
className: m(
|
|
332
|
+
L.track,
|
|
333
|
+
e && L.checked,
|
|
334
|
+
r && L.disabled,
|
|
335
|
+
s
|
|
336
|
+
),
|
|
337
|
+
onClick: () => !r && t(!e),
|
|
338
|
+
type: "button",
|
|
339
|
+
children: /* @__PURE__ */ i("span", { className: L.thumb })
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
const gt = "piui-Surface_surface_LiS4_", yt = "piui-Surface_el0_2XZ1U", St = "piui-Surface_el1_rbrNL", Tt = "piui-Surface_el2_E0qPY", xt = "piui-Surface_el3_8AFvC", Et = "piui-Surface_noBorder_DFpH9", S = {
|
|
344
|
+
surface: gt,
|
|
345
|
+
el0: yt,
|
|
346
|
+
el1: St,
|
|
347
|
+
el2: Tt,
|
|
348
|
+
el3: xt,
|
|
349
|
+
noBorder: Et
|
|
350
|
+
};
|
|
351
|
+
function Ct(e, t, r) {
|
|
352
|
+
return e || t || r;
|
|
353
|
+
}
|
|
354
|
+
function Un(e) {
|
|
355
|
+
const { disabled: t, loading: r } = e, n = t || r;
|
|
356
|
+
return {
|
|
357
|
+
disabled: n,
|
|
358
|
+
"aria-disabled": n || void 0,
|
|
359
|
+
"aria-busy": r || void 0,
|
|
360
|
+
tabIndex: n ? -1 : 0
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function Vn(e) {
|
|
364
|
+
const { size: t, variant: r, pressed: n, disabled: o, loading: s } = e, { opacity: c } = re({ pressed: n, disabled: o, loading: s });
|
|
365
|
+
return {
|
|
366
|
+
minHeight: G[t],
|
|
367
|
+
paddingLeft: $[t],
|
|
368
|
+
paddingRight: $[t],
|
|
369
|
+
fontSize: ie[t],
|
|
370
|
+
opacity: c
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function Gn(e) {
|
|
374
|
+
return se[e];
|
|
375
|
+
}
|
|
376
|
+
function Xn(e) {
|
|
377
|
+
return `var(--pi-color-surface${e})`;
|
|
378
|
+
}
|
|
379
|
+
function zn(e) {
|
|
380
|
+
return ae(e) !== null;
|
|
381
|
+
}
|
|
382
|
+
const Nt = {
|
|
383
|
+
0: S.el0,
|
|
384
|
+
1: S.el1,
|
|
385
|
+
2: S.el2,
|
|
386
|
+
3: S.el3,
|
|
387
|
+
4: S.el3
|
|
388
|
+
// 4 uses surface3 (no surface4 token defined in CSS vars)
|
|
389
|
+
};
|
|
390
|
+
function Yn({
|
|
391
|
+
elevation: e = 1,
|
|
392
|
+
noBorder: t = !1,
|
|
393
|
+
className: r,
|
|
394
|
+
children: n,
|
|
395
|
+
...o
|
|
396
|
+
}) {
|
|
397
|
+
return /* @__PURE__ */ i(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
className: m(
|
|
401
|
+
S.surface,
|
|
402
|
+
Nt[e],
|
|
403
|
+
t && S.noBorder,
|
|
404
|
+
r
|
|
405
|
+
),
|
|
406
|
+
...o,
|
|
407
|
+
children: n
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
const It = "piui-Panel_panel_TgAA7", wt = {
|
|
412
|
+
panel: It
|
|
413
|
+
};
|
|
414
|
+
function Zn({ className: e, ...t }) {
|
|
415
|
+
return /* @__PURE__ */ i("div", { className: m(wt.panel, e), ...t });
|
|
416
|
+
}
|
|
417
|
+
const At = "piui-EmptyState_emptyState__PSfF", Dt = {
|
|
418
|
+
emptyState: At
|
|
419
|
+
};
|
|
420
|
+
function qn({ className: e, ...t }) {
|
|
421
|
+
return /* @__PURE__ */ i("div", { className: m(Dt.emptyState, e), ...t });
|
|
422
|
+
}
|
|
423
|
+
const kt = "piui-TextInput_input_CP24i", Rt = "piui-TextInput_textarea_qA5om", z = {
|
|
424
|
+
input: kt,
|
|
425
|
+
textarea: Rt
|
|
426
|
+
}, jn = M(function({ className: t, ...r }, n) {
|
|
427
|
+
return /* @__PURE__ */ i("input", { ref: n, className: m(z.input, t), ...r });
|
|
428
|
+
}), Qn = M(function({ className: t, ...r }, n) {
|
|
429
|
+
return /* @__PURE__ */ i("textarea", { ref: n, className: m(z.input, z.textarea, t), ...r });
|
|
430
|
+
}), Ot = "piui-ScrollArea_scrollArea_OyLlW", Mt = "piui-ScrollArea_x_UYHZv", Bt = "piui-ScrollArea_y_T2Ik1", V = {
|
|
431
|
+
scrollArea: Ot,
|
|
432
|
+
x: Mt,
|
|
433
|
+
y: Bt
|
|
434
|
+
};
|
|
435
|
+
function Kn({ axis: e = "both", className: t, children: r, ...n }) {
|
|
436
|
+
return /* @__PURE__ */ i(
|
|
437
|
+
"div",
|
|
438
|
+
{
|
|
439
|
+
className: m(
|
|
440
|
+
V.scrollArea,
|
|
441
|
+
e === "x" && V.x,
|
|
442
|
+
e === "y" && V.y,
|
|
443
|
+
t
|
|
444
|
+
),
|
|
445
|
+
...n,
|
|
446
|
+
children: r
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
const Lt = "piui-Checkbox_wrapper_fHQQB", Ht = "piui-Checkbox_box_vmxOG", $t = "piui-Checkbox_checkmark_wpvgs", Pt = "piui-Checkbox_nativeInput_c7VIf", H = {
|
|
451
|
+
wrapper: Lt,
|
|
452
|
+
box: Ht,
|
|
453
|
+
checkmark: $t,
|
|
454
|
+
nativeInput: Pt
|
|
455
|
+
}, Jn = M(function({ label: t, checked: r = !1, disabled: n, className: o, onChange: s, ...c }, l) {
|
|
456
|
+
return /* @__PURE__ */ v("label", { className: H.wrapper, "data-disabled": n || void 0, children: [
|
|
457
|
+
/* @__PURE__ */ i(
|
|
458
|
+
"input",
|
|
459
|
+
{
|
|
460
|
+
ref: l,
|
|
461
|
+
type: "checkbox",
|
|
462
|
+
className: H.nativeInput,
|
|
463
|
+
checked: r,
|
|
464
|
+
disabled: n,
|
|
465
|
+
onChange: s,
|
|
466
|
+
...c
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
/* @__PURE__ */ i("span", { className: H.box, "data-checked": r, "aria-hidden": !0, children: r && /* @__PURE__ */ i(ke, { size: 12, className: H.checkmark }) }),
|
|
470
|
+
t && /* @__PURE__ */ i("span", { children: t })
|
|
471
|
+
] });
|
|
472
|
+
}), Ft = "piui-Select_select_UcnXJ", Wt = "piui-Select_comboboxWrapper_3-YEh", Ut = "piui-Select_comboboxInput_7_5QP", Vt = "piui-Select_comboboxList_pC6Rv", Gt = "piui-Select_comboboxOption_Up6ZY", Xt = "piui-Select_comboboxOptionHighlighted_kRH77", C = {
|
|
473
|
+
select: Ft,
|
|
474
|
+
comboboxWrapper: Wt,
|
|
475
|
+
comboboxInput: Ut,
|
|
476
|
+
comboboxList: Vt,
|
|
477
|
+
comboboxOption: Gt,
|
|
478
|
+
comboboxOptionHighlighted: Xt
|
|
479
|
+
}, eo = M(function({ options: t, placeholder: r, className: n, ...o }, s) {
|
|
480
|
+
return /* @__PURE__ */ v("select", { ref: s, className: m(C.select, n), ...o, children: [
|
|
481
|
+
r && /* @__PURE__ */ i("option", { value: "", disabled: !0, children: r }),
|
|
482
|
+
t.map((c) => /* @__PURE__ */ i("option", { value: c.value, children: c.label }, c.value))
|
|
483
|
+
] });
|
|
484
|
+
});
|
|
485
|
+
function to({
|
|
486
|
+
options: e,
|
|
487
|
+
value: t,
|
|
488
|
+
onSelect: r,
|
|
489
|
+
placeholder: n = "Search…",
|
|
490
|
+
className: o
|
|
491
|
+
}) {
|
|
492
|
+
const [s, c] = Y(() => Te(e)), l = y(null);
|
|
493
|
+
function u(a) {
|
|
494
|
+
c((d) => xe(d, a));
|
|
495
|
+
}
|
|
496
|
+
function p(a) {
|
|
497
|
+
r?.(a.value), u({ type: "CLOSE" });
|
|
498
|
+
}
|
|
499
|
+
const b = y(null);
|
|
500
|
+
return R(() => {
|
|
501
|
+
function a(d) {
|
|
502
|
+
b.current && !b.current.contains(d.target) && u({ type: "CLOSE" });
|
|
503
|
+
}
|
|
504
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
505
|
+
}, []), /* @__PURE__ */ v("div", { ref: b, className: m(C.comboboxWrapper, o), children: [
|
|
506
|
+
/* @__PURE__ */ i(
|
|
507
|
+
"input",
|
|
508
|
+
{
|
|
509
|
+
ref: l,
|
|
510
|
+
className: C.comboboxInput,
|
|
511
|
+
value: s.query,
|
|
512
|
+
placeholder: n,
|
|
513
|
+
onChange: (a) => u({ type: "SET_QUERY", query: a.target.value }),
|
|
514
|
+
onFocus: () => u({ type: "OPEN" }),
|
|
515
|
+
onKeyDown: (a) => {
|
|
516
|
+
if (a.key === "ArrowDown")
|
|
517
|
+
a.preventDefault(), u({ type: "ARROW_DOWN" });
|
|
518
|
+
else if (a.key === "ArrowUp")
|
|
519
|
+
a.preventDefault(), u({ type: "ARROW_UP" });
|
|
520
|
+
else if (a.key === "Enter" && s.isOpen) {
|
|
521
|
+
a.preventDefault();
|
|
522
|
+
const d = s.filtered[s.highlightedIndex];
|
|
523
|
+
d && p(d);
|
|
524
|
+
} else a.key === "Escape" && u({ type: "CLOSE" });
|
|
525
|
+
},
|
|
526
|
+
role: "combobox",
|
|
527
|
+
"aria-expanded": s.isOpen,
|
|
528
|
+
"aria-autocomplete": "list"
|
|
529
|
+
}
|
|
530
|
+
),
|
|
531
|
+
s.isOpen && s.filtered.length > 0 && /* @__PURE__ */ i("div", { className: C.comboboxList, role: "listbox", children: s.filtered.map((a, d) => /* @__PURE__ */ i(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
className: m(
|
|
535
|
+
C.comboboxOption,
|
|
536
|
+
d === s.highlightedIndex && C.comboboxOptionHighlighted
|
|
537
|
+
),
|
|
538
|
+
role: "option",
|
|
539
|
+
"aria-selected": d === s.highlightedIndex,
|
|
540
|
+
onMouseDown: (_) => {
|
|
541
|
+
_.preventDefault(), p(a);
|
|
542
|
+
},
|
|
543
|
+
children: a.label
|
|
544
|
+
},
|
|
545
|
+
a.value
|
|
546
|
+
)) })
|
|
547
|
+
] });
|
|
548
|
+
}
|
|
549
|
+
const zt = "piui-Dialog_overlay_URgjn", Yt = "piui-Dialog_contentWrapper_8Fiwj", Zt = "piui-Dialog_dialog_Ip92p", qt = "piui-Dialog_header_kRqVC", jt = "piui-Dialog_title_RjMb_", Qt = "piui-Dialog_body_ZZ4NM", Kt = "piui-Dialog_footer_hfN9E", Jt = "piui-Dialog_bare_4a9gB", en = "piui-Dialog_bareBody_Ix_qq", tn = "piui-Dialog_bareCloseBtn_Ml68W", nn = "piui-Dialog_visuallyHidden_VsPG9", f = {
|
|
550
|
+
overlay: zt,
|
|
551
|
+
contentWrapper: Yt,
|
|
552
|
+
dialog: Zt,
|
|
553
|
+
header: qt,
|
|
554
|
+
title: jt,
|
|
555
|
+
body: Qt,
|
|
556
|
+
footer: Kt,
|
|
557
|
+
bare: Jt,
|
|
558
|
+
bareBody: en,
|
|
559
|
+
bareCloseBtn: tn,
|
|
560
|
+
visuallyHidden: nn
|
|
561
|
+
}, no = g.Close;
|
|
562
|
+
function oo({
|
|
563
|
+
open: e,
|
|
564
|
+
onOpenChange: t,
|
|
565
|
+
title: r,
|
|
566
|
+
children: n,
|
|
567
|
+
footer: o,
|
|
568
|
+
width: s,
|
|
569
|
+
className: c,
|
|
570
|
+
bare: l = !1,
|
|
571
|
+
onInteractOutside: u,
|
|
572
|
+
onEscapeKeyDown: p,
|
|
573
|
+
onCloseAutoFocus: b,
|
|
574
|
+
onOpenAutoFocus: a
|
|
575
|
+
}) {
|
|
576
|
+
return /* @__PURE__ */ i(g.Root, { open: e, onOpenChange: t, children: /* @__PURE__ */ v(g.Portal, { children: [
|
|
577
|
+
/* @__PURE__ */ i(g.Overlay, { className: f.overlay }),
|
|
578
|
+
/* @__PURE__ */ i("div", { className: f.contentWrapper, children: /* @__PURE__ */ v(
|
|
579
|
+
g.Content,
|
|
580
|
+
{
|
|
581
|
+
className: m(f.dialog, l && f.bare, c),
|
|
582
|
+
style: s !== void 0 ? { width: s } : void 0,
|
|
583
|
+
onInteractOutside: u,
|
|
584
|
+
onEscapeKeyDown: p,
|
|
585
|
+
onCloseAutoFocus: b,
|
|
586
|
+
onOpenAutoFocus: a,
|
|
587
|
+
children: [
|
|
588
|
+
l ? /* @__PURE__ */ i(g.Title, { className: f.visuallyHidden, children: r }) : /* @__PURE__ */ v("div", { className: f.header, children: [
|
|
589
|
+
/* @__PURE__ */ i(g.Title, { className: f.title, children: r }),
|
|
590
|
+
/* @__PURE__ */ i(g.Close, { asChild: !0, children: /* @__PURE__ */ i(K, { size: "sm", "aria-label": "Close", children: /* @__PURE__ */ i(X, { size: 16 }) }) })
|
|
591
|
+
] }),
|
|
592
|
+
/* @__PURE__ */ i("div", { className: m(f.body, l && f.bareBody), children: n }),
|
|
593
|
+
l && /* @__PURE__ */ i(g.Close, { asChild: !0, children: /* @__PURE__ */ i(
|
|
594
|
+
K,
|
|
595
|
+
{
|
|
596
|
+
size: "sm",
|
|
597
|
+
"aria-label": "Close",
|
|
598
|
+
className: f.bareCloseBtn,
|
|
599
|
+
style: {
|
|
600
|
+
background: "var(--pi-color-surface1)",
|
|
601
|
+
border: "1px solid var(--pi-color-border)",
|
|
602
|
+
borderRadius: "50%"
|
|
603
|
+
},
|
|
604
|
+
children: /* @__PURE__ */ i(X, { size: 16 })
|
|
605
|
+
}
|
|
606
|
+
) }),
|
|
607
|
+
o && /* @__PURE__ */ i("div", { className: f.footer, children: o })
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
) })
|
|
611
|
+
] }) });
|
|
612
|
+
}
|
|
613
|
+
const on = "piui-ResizeHandle_handle_BuoJL", rn = {
|
|
614
|
+
handle: on
|
|
615
|
+
};
|
|
616
|
+
function ro({ side: e, onResize: t, className: r }) {
|
|
617
|
+
const n = y(0), o = y(null), s = D(
|
|
618
|
+
(u) => {
|
|
619
|
+
const p = u.clientX - n.current;
|
|
620
|
+
n.current = u.clientX, t(e === "left" ? p : -p);
|
|
621
|
+
},
|
|
622
|
+
[t, e]
|
|
623
|
+
), c = D(
|
|
624
|
+
(u) => {
|
|
625
|
+
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", c), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
626
|
+
const p = o.current;
|
|
627
|
+
p?.hasPointerCapture(u.pointerId) && p.releasePointerCapture(u.pointerId);
|
|
628
|
+
},
|
|
629
|
+
[s]
|
|
630
|
+
);
|
|
631
|
+
function l(u) {
|
|
632
|
+
u.preventDefault(), n.current = u.clientX, u.currentTarget.setPointerCapture(u.pointerId), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", s), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", c);
|
|
633
|
+
}
|
|
634
|
+
return /* @__PURE__ */ i(
|
|
635
|
+
"div",
|
|
636
|
+
{
|
|
637
|
+
ref: o,
|
|
638
|
+
className: m(rn.handle, r),
|
|
639
|
+
onPointerDown: l,
|
|
640
|
+
role: "separator",
|
|
641
|
+
"aria-orientation": "vertical"
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
const sn = "piui-Menu_trigger_YtxLF", an = "piui-Menu_content_8knxX", cn = "piui-Menu_item_zEpmQ", ln = "piui-Menu_danger_5l7uC", un = "piui-Menu_groupLabel_QPkyV", dn = "piui-Menu_sep_Lb8Po", w = {
|
|
646
|
+
trigger: sn,
|
|
647
|
+
content: an,
|
|
648
|
+
item: cn,
|
|
649
|
+
danger: ln,
|
|
650
|
+
groupLabel: un,
|
|
651
|
+
sep: dn
|
|
652
|
+
}, so = M(
|
|
653
|
+
function({ x: t, y: r }, n) {
|
|
654
|
+
return /* @__PURE__ */ i(
|
|
655
|
+
"button",
|
|
656
|
+
{
|
|
657
|
+
ref: n,
|
|
658
|
+
type: "button",
|
|
659
|
+
className: w.trigger,
|
|
660
|
+
style: { left: t, top: r },
|
|
661
|
+
"aria-hidden": !0,
|
|
662
|
+
tabIndex: -1
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
);
|
|
667
|
+
function io({
|
|
668
|
+
className: e,
|
|
669
|
+
minWidth: t,
|
|
670
|
+
style: r,
|
|
671
|
+
sideOffset: n = 2,
|
|
672
|
+
...o
|
|
673
|
+
}) {
|
|
674
|
+
const s = t === void 0 ? r : { minWidth: t, ...r };
|
|
675
|
+
return /* @__PURE__ */ i(I.Portal, { children: /* @__PURE__ */ i(
|
|
676
|
+
I.Content,
|
|
677
|
+
{
|
|
678
|
+
className: m(w.content, e),
|
|
679
|
+
align: "start",
|
|
680
|
+
sideOffset: n,
|
|
681
|
+
style: s,
|
|
682
|
+
...o
|
|
683
|
+
}
|
|
684
|
+
) });
|
|
685
|
+
}
|
|
686
|
+
function ao({ label: e, className: t, children: r, ...n }) {
|
|
687
|
+
const o = fe();
|
|
688
|
+
return /* @__PURE__ */ v(
|
|
689
|
+
I.Group,
|
|
690
|
+
{
|
|
691
|
+
className: t,
|
|
692
|
+
"aria-labelledby": e === void 0 ? void 0 : o,
|
|
693
|
+
...n,
|
|
694
|
+
children: [
|
|
695
|
+
e !== void 0 && /* @__PURE__ */ i(I.Label, { id: o, className: w.groupLabel, children: e }),
|
|
696
|
+
r
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
function co({ className: e, danger: t, ...r }) {
|
|
702
|
+
return /* @__PURE__ */ i(
|
|
703
|
+
I.Item,
|
|
704
|
+
{
|
|
705
|
+
className: m(w.item, t && w.danger, e),
|
|
706
|
+
...r
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
function lo(e) {
|
|
711
|
+
return /* @__PURE__ */ i(I.Separator, { className: w.sep, ...e });
|
|
712
|
+
}
|
|
713
|
+
const pn = "piui-Popover_content_zAtsY", mn = {
|
|
714
|
+
content: pn
|
|
715
|
+
}, uo = {
|
|
716
|
+
Root: N.Root,
|
|
717
|
+
Trigger: N.Trigger,
|
|
718
|
+
Anchor: N.Anchor,
|
|
719
|
+
Close: N.Close
|
|
720
|
+
};
|
|
721
|
+
function po({
|
|
722
|
+
className: e,
|
|
723
|
+
width: t,
|
|
724
|
+
style: r,
|
|
725
|
+
side: n = "top",
|
|
726
|
+
align: o = "start",
|
|
727
|
+
sideOffset: s = 6,
|
|
728
|
+
collisionPadding: c = 8,
|
|
729
|
+
...l
|
|
730
|
+
}) {
|
|
731
|
+
return /* @__PURE__ */ i(N.Portal, { children: /* @__PURE__ */ i(
|
|
732
|
+
N.Content,
|
|
733
|
+
{
|
|
734
|
+
className: m(mn.content, e),
|
|
735
|
+
side: n,
|
|
736
|
+
align: o,
|
|
737
|
+
sideOffset: s,
|
|
738
|
+
collisionPadding: c,
|
|
739
|
+
style: t === void 0 ? r : { width: t, ...r },
|
|
740
|
+
...l
|
|
741
|
+
}
|
|
742
|
+
) });
|
|
743
|
+
}
|
|
744
|
+
function mo() {
|
|
745
|
+
const [e, t] = Y(!1), r = D(() => t(!0), []), n = D(() => t(!1), []), o = D(
|
|
746
|
+
(s = !1) => Ct(e, !1, s),
|
|
747
|
+
[e]
|
|
748
|
+
);
|
|
749
|
+
return {
|
|
750
|
+
isHovered: e,
|
|
751
|
+
hoverProps: { onPointerEnter: r, onPointerLeave: n },
|
|
752
|
+
isVisible: o
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
const O = ce()(() => ({
|
|
756
|
+
message: "",
|
|
757
|
+
politeness: "polite"
|
|
758
|
+
})), _n = 4e3;
|
|
759
|
+
let k = null;
|
|
760
|
+
function Z() {
|
|
761
|
+
k !== null && (clearTimeout(k), k = null);
|
|
762
|
+
}
|
|
763
|
+
function _o(e, t = "polite") {
|
|
764
|
+
Z(), O.setState({ message: e, politeness: t });
|
|
765
|
+
}
|
|
766
|
+
function ho() {
|
|
767
|
+
Z(), k = setTimeout(() => {
|
|
768
|
+
k = null, O.setState({ message: "" });
|
|
769
|
+
}, _n);
|
|
770
|
+
}
|
|
771
|
+
function fo() {
|
|
772
|
+
Z(), O.setState({ message: "", politeness: "polite" });
|
|
773
|
+
}
|
|
774
|
+
const hn = "piui-Announcer_visuallyHidden_L1DnS", ee = {
|
|
775
|
+
visuallyHidden: hn
|
|
776
|
+
};
|
|
777
|
+
function bo() {
|
|
778
|
+
const e = O((r) => r.message), t = O((r) => r.politeness);
|
|
779
|
+
return /* @__PURE__ */ v(_e, { children: [
|
|
780
|
+
/* @__PURE__ */ i("span", { className: ee.visuallyHidden, role: "status", "aria-live": "polite", children: t === "polite" ? e : "" }),
|
|
781
|
+
/* @__PURE__ */ i("span", { className: ee.visuallyHidden, role: "alert", children: t === "assertive" ? e : "" })
|
|
782
|
+
] });
|
|
783
|
+
}
|
|
784
|
+
const P = 3;
|
|
785
|
+
let de = 0;
|
|
786
|
+
const T = /* @__PURE__ */ new Map();
|
|
787
|
+
function te(e) {
|
|
788
|
+
const t = T.get(e);
|
|
789
|
+
t !== void 0 && (clearTimeout(t), T.delete(e));
|
|
790
|
+
}
|
|
791
|
+
const A = ce((e, t) => {
|
|
792
|
+
function r(n) {
|
|
793
|
+
const o = t().toasts.findIndex((l) => l.id === n);
|
|
794
|
+
if (o === -1 || o >= P || T.has(n)) return;
|
|
795
|
+
const s = t().toasts[o];
|
|
796
|
+
if (s.durationMs === null || s.paused) return;
|
|
797
|
+
const c = { ...s, shownAt: Date.now() };
|
|
798
|
+
e((l) => ({ toasts: l.toasts.map((u) => u.id === n ? c : u) })), T.set(
|
|
799
|
+
n,
|
|
800
|
+
setTimeout(() => t().dismiss(n), c.durationMs)
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
return {
|
|
804
|
+
toasts: [],
|
|
805
|
+
show(n, o = {}) {
|
|
806
|
+
const s = `toast-${++de}`;
|
|
807
|
+
return e((c) => ({ toasts: [...c.toasts, Ie(s, n, o)] })), r(s), s;
|
|
808
|
+
},
|
|
809
|
+
copied(n) {
|
|
810
|
+
const { content: o, opts: s } = Ne(n);
|
|
811
|
+
return t().show(o, s);
|
|
812
|
+
},
|
|
813
|
+
error(n) {
|
|
814
|
+
const { content: o, opts: s } = Ce(n);
|
|
815
|
+
return t().show(o, s);
|
|
816
|
+
},
|
|
817
|
+
dismiss(n) {
|
|
818
|
+
te(n), e((o) => ({ toasts: o.toasts.filter((s) => s.id !== n) }));
|
|
819
|
+
for (const o of t().toasts.slice(0, P))
|
|
820
|
+
r(o.id);
|
|
821
|
+
},
|
|
822
|
+
dismissTop() {
|
|
823
|
+
const n = t().toasts[0];
|
|
824
|
+
n && t().dismiss(n.id);
|
|
825
|
+
},
|
|
826
|
+
pause(n) {
|
|
827
|
+
const o = t().toasts.find((c) => c.id === n);
|
|
828
|
+
if (!o || o.durationMs === null || o.paused) return;
|
|
829
|
+
const s = Ee(o, null, Date.now()) ?? o.durationMs;
|
|
830
|
+
te(n), e((c) => ({
|
|
831
|
+
toasts: c.toasts.map(
|
|
832
|
+
(l) => l.id === n ? { ...l, paused: !0, pausedRemaining: s } : l
|
|
833
|
+
)
|
|
834
|
+
}));
|
|
835
|
+
},
|
|
836
|
+
resume(n) {
|
|
837
|
+
const o = t().toasts.find((u) => u.id === n);
|
|
838
|
+
if (!o || !o.paused) return;
|
|
839
|
+
const s = o.pausedRemaining ?? o.durationMs ?? 0, c = Date.now() - ((o.durationMs ?? 0) - s), l = { ...o, paused: !1, pausedRemaining: void 0, shownAt: c };
|
|
840
|
+
e((u) => ({ toasts: u.toasts.map((p) => p.id === n ? l : p) })), T.set(
|
|
841
|
+
n,
|
|
842
|
+
setTimeout(() => t().dismiss(n), s)
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
});
|
|
847
|
+
function vo() {
|
|
848
|
+
for (const e of T.values()) clearTimeout(e);
|
|
849
|
+
T.clear(), de = 0, A.setState({ toasts: [] });
|
|
850
|
+
}
|
|
851
|
+
const fn = "piui-ToastViewport_viewport_Yx5mS", bn = "piui-ToastViewport_toast_Tzr1T", vn = "piui-ToastViewport_exiting_J8_Ab", gn = "piui-ToastViewport_content_GCPPy", yn = "piui-ToastViewport_close_KWFx7", E = {
|
|
852
|
+
viewport: fn,
|
|
853
|
+
toast: bn,
|
|
854
|
+
exiting: vn,
|
|
855
|
+
content: gn,
|
|
856
|
+
close: yn
|
|
857
|
+
}, Sn = 180;
|
|
858
|
+
function Tn() {
|
|
859
|
+
return typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
860
|
+
}
|
|
861
|
+
function go() {
|
|
862
|
+
const e = A((a) => a.toasts), t = e.slice(0, P), r = A((a) => a.dismiss), n = A((a) => a.pause), o = A((a) => a.resume), s = y(/* @__PURE__ */ new Map());
|
|
863
|
+
for (const a of t) s.current.set(a.id, a);
|
|
864
|
+
const c = y([]), [l, u] = Y([]), p = y(/* @__PURE__ */ new Set());
|
|
865
|
+
R(() => {
|
|
866
|
+
const a = p.current;
|
|
867
|
+
return () => {
|
|
868
|
+
for (const d of a) window.clearTimeout(d);
|
|
869
|
+
};
|
|
870
|
+
}, []), R(() => {
|
|
871
|
+
const a = e.slice(0, P).map((h) => h.id), d = new Set(a), _ = c.current.filter((h) => !d.has(h));
|
|
872
|
+
if (c.current = a, _.length === 0) return;
|
|
873
|
+
if (Tn()) {
|
|
874
|
+
for (const h of _) s.current.delete(h);
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
u((h) => [...h, ..._]);
|
|
878
|
+
const x = window.setTimeout(() => {
|
|
879
|
+
p.current.delete(x), u((h) => h.filter((pe) => !_.includes(pe)));
|
|
880
|
+
for (const h of _) s.current.delete(h);
|
|
881
|
+
}, Sn);
|
|
882
|
+
p.current.add(x);
|
|
883
|
+
}, [e]);
|
|
884
|
+
const b = [
|
|
885
|
+
...t,
|
|
886
|
+
...l.filter((a) => !t.some((d) => d.id === a)).map((a) => s.current.get(a)).filter((a) => a !== void 0)
|
|
887
|
+
];
|
|
888
|
+
return b.length === 0 ? null : Ae(
|
|
889
|
+
/* @__PURE__ */ i("div", { className: E.viewport, role: "status", "aria-live": "polite", children: b.map((a) => {
|
|
890
|
+
const { token: d } = we(a.variant), _ = l.includes(a.id) && !t.some((x) => x.id === a.id);
|
|
891
|
+
return /* @__PURE__ */ v(
|
|
892
|
+
"div",
|
|
893
|
+
{
|
|
894
|
+
className: _ ? `${E.toast} ${E.exiting}` : E.toast,
|
|
895
|
+
style: d ? { "--toast-rail": `var(--pi-color-${d})` } : void 0,
|
|
896
|
+
onMouseEnter: () => n(a.id),
|
|
897
|
+
onMouseLeave: () => o(a.id),
|
|
898
|
+
children: [
|
|
899
|
+
/* @__PURE__ */ i("span", { className: E.content, children: a.content }),
|
|
900
|
+
/* @__PURE__ */ i(
|
|
901
|
+
"button",
|
|
902
|
+
{
|
|
903
|
+
type: "button",
|
|
904
|
+
className: E.close,
|
|
905
|
+
"aria-label": "Dismiss",
|
|
906
|
+
onClick: () => r(a.id),
|
|
907
|
+
children: /* @__PURE__ */ i(je, { icon: X, size: "xs", "aria-hidden": !0 })
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
a.id
|
|
913
|
+
);
|
|
914
|
+
}) }),
|
|
915
|
+
document.body
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
export {
|
|
919
|
+
_n as ANNOUNCE_CLEAR_DELAY_MS,
|
|
920
|
+
bo as Announcer,
|
|
921
|
+
Hn as Avatar,
|
|
922
|
+
ie as BUTTON_FONT_SIZE,
|
|
923
|
+
se as BUTTON_ICON_SIZE,
|
|
924
|
+
G as BUTTON_MIN_HEIGHT,
|
|
925
|
+
$ as BUTTON_PADDING_H,
|
|
926
|
+
jo as BrandConfigSchema,
|
|
927
|
+
Mn as Button,
|
|
928
|
+
vr as COMPACT_FORM_FACTOR_WIDTH,
|
|
929
|
+
Jn as Checkbox,
|
|
930
|
+
to as Combobox,
|
|
931
|
+
To as DEFAULT_APPEARANCE_STORAGE_KEY,
|
|
932
|
+
xo as DEFAULT_MONO_FONT,
|
|
933
|
+
Eo as DEFAULT_THEME_NAME,
|
|
934
|
+
ar as DEFAULT_TOAST_DURATION_MS,
|
|
935
|
+
Co as DEFAULT_UI_FONT,
|
|
936
|
+
oo as Dialog,
|
|
937
|
+
no as DialogClose,
|
|
938
|
+
Fn as Divider,
|
|
939
|
+
qn as EmptyState,
|
|
940
|
+
cr as EscStack,
|
|
941
|
+
gr as FOOTER_HEIGHT,
|
|
942
|
+
yr as HEADER_INNER_HEIGHT,
|
|
943
|
+
Sr as HEADER_INNER_HEIGHT_MOBILE,
|
|
944
|
+
Tr as HEADER_TOP_PADDING_MOBILE,
|
|
945
|
+
qe as ICON_SIZE_PX,
|
|
946
|
+
je as Icon,
|
|
947
|
+
K as IconButton,
|
|
948
|
+
xr as MAX_CONTENT_WIDTH,
|
|
949
|
+
P as MAX_VISIBLE_TOASTS,
|
|
950
|
+
io as MenuContent,
|
|
951
|
+
so as MenuCursorTrigger,
|
|
952
|
+
ao as MenuGroup,
|
|
953
|
+
co as MenuItem,
|
|
954
|
+
lo as MenuSeparator,
|
|
955
|
+
Zn as Panel,
|
|
956
|
+
uo as Popover,
|
|
957
|
+
po as PopoverContent,
|
|
958
|
+
ro as ResizeHandle,
|
|
959
|
+
q as STATUS_DOT_SIZE,
|
|
960
|
+
Kn as ScrollArea,
|
|
961
|
+
eo as Select,
|
|
962
|
+
$n as ShortcutHint,
|
|
963
|
+
Pn as Spinner,
|
|
964
|
+
Ln as StatusBadge,
|
|
965
|
+
Bn as StatusDot,
|
|
966
|
+
Yn as Surface,
|
|
967
|
+
Wn as Switch,
|
|
968
|
+
No as TERMINAL_FONT_STACK,
|
|
969
|
+
Io as THEME_NAMES,
|
|
970
|
+
wo as THEME_SWATCHES,
|
|
971
|
+
Ao as THEME_VARIANTS,
|
|
972
|
+
Qn as TextArea,
|
|
973
|
+
jn as TextInput,
|
|
974
|
+
kn as ThemeBoundary,
|
|
975
|
+
go as ToastViewport,
|
|
976
|
+
Er as WINDOW_CHROME,
|
|
977
|
+
Cr as WORKSPACE_SECONDARY_HEADER_HEIGHT,
|
|
978
|
+
lr as alertIconInfo,
|
|
979
|
+
Do as applyAppearance,
|
|
980
|
+
ko as applyThemeToDOM,
|
|
981
|
+
Ro as applyVarsToRoot,
|
|
982
|
+
ur as attachmentPillRemoveVisible,
|
|
983
|
+
ge as avatarColor,
|
|
984
|
+
ve as avatarInitial,
|
|
985
|
+
Oo as baseFontSize,
|
|
986
|
+
Mo as baseLineHeight,
|
|
987
|
+
Bo as borderRadius,
|
|
988
|
+
Lo as borderWidth,
|
|
989
|
+
Nr as breakpoints,
|
|
990
|
+
Ho as buildDarkColors,
|
|
991
|
+
$o as buildLightColors,
|
|
992
|
+
Po as buildShadows,
|
|
993
|
+
Ie as buildToastEntry,
|
|
994
|
+
Un as buttonAriaAttrs,
|
|
995
|
+
dr as buttonIconColorToken,
|
|
996
|
+
Gn as buttonIconPx,
|
|
997
|
+
Vn as buttonInlineStyle,
|
|
998
|
+
ho as clearWhenIdle,
|
|
999
|
+
xe as comboboxReducer,
|
|
1000
|
+
Qo as contrastForeground,
|
|
1001
|
+
Ne as copiedToast,
|
|
1002
|
+
Fo as countTokenUsage,
|
|
1003
|
+
me as createAppearanceController,
|
|
1004
|
+
Ko as darken,
|
|
1005
|
+
Ce as errorToast,
|
|
1006
|
+
pr as filterOptions,
|
|
1007
|
+
Wo as findTokenProblems,
|
|
1008
|
+
Uo as flattenThemeToVars,
|
|
1009
|
+
Vo as fontWeight,
|
|
1010
|
+
ye as formatChord,
|
|
1011
|
+
Se as formatCombo,
|
|
1012
|
+
Ir as getBreakpoint,
|
|
1013
|
+
Go as getTheme,
|
|
1014
|
+
mr as ghostHoverIconToken,
|
|
1015
|
+
_r as groupOptions,
|
|
1016
|
+
hr as headerPadding,
|
|
1017
|
+
Jo as hexToRgb,
|
|
1018
|
+
Ct as hoverVisible,
|
|
1019
|
+
Xo as iconSize,
|
|
1020
|
+
Te as initialComboboxState,
|
|
1021
|
+
er as injectBrandAccent,
|
|
1022
|
+
wr as isCompactFormFactor,
|
|
1023
|
+
tr as isHexColor,
|
|
1024
|
+
nr as lighten,
|
|
1025
|
+
Le as localStorageKvStore,
|
|
1026
|
+
zo as opacity,
|
|
1027
|
+
Yo as palette,
|
|
1028
|
+
or as relativeLuminance,
|
|
1029
|
+
Ee as remainingMs,
|
|
1030
|
+
fo as resetAnnouncerStoreForTests,
|
|
1031
|
+
vo as resetToastStoreForTests,
|
|
1032
|
+
rr as resolveAccentColors,
|
|
1033
|
+
re as resolveButtonState,
|
|
1034
|
+
sr as rgbToHex,
|
|
1035
|
+
Zo as spacing,
|
|
1036
|
+
_o as speak,
|
|
1037
|
+
be as statusBadgeTokens,
|
|
1038
|
+
ae as statusDotColor,
|
|
1039
|
+
zn as statusDotVisible,
|
|
1040
|
+
Xn as surfaceBgVar,
|
|
1041
|
+
we as toastTokens,
|
|
1042
|
+
O as useAnnouncerStore,
|
|
1043
|
+
He as useAppearance,
|
|
1044
|
+
On as useAppearanceControls,
|
|
1045
|
+
mo as useHover,
|
|
1046
|
+
Rn as useResolvedTheme,
|
|
1047
|
+
A as useToastStore,
|
|
1048
|
+
fr as withCustomValueOption
|
|
1049
|
+
};
|