@mcurcio/patchbay 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/composites.css +1 -1
- package/dist/composites.js +399 -254
- package/dist/composites.js.map +1 -1
- package/dist/graph.css +1 -1
- package/dist/graph.js +593 -286
- package/dist/graph.js.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/primitives.css +1 -1
- package/dist/primitives.js +143 -126
- package/dist/primitives.js.map +1 -1
- package/dist/shell.css +1 -1
- package/dist/shell.js +96 -71
- package/dist/shell.js.map +1 -1
- package/dist/types/composites/banner/Banner.d.ts +2 -2
- package/dist/types/composites/change-list/ChangeList.d.ts +44 -0
- package/dist/types/composites/change-list/index.d.ts +2 -0
- package/dist/types/composites/diagnostic-list/DiagnosticList.d.ts +23 -0
- package/dist/types/composites/diagnostic-list/index.d.ts +2 -0
- package/dist/types/composites/index.d.ts +2 -0
- package/dist/types/composites/status-words/StatusWords.d.ts +1 -1
- package/dist/types/graph/add-at/useAddAt.d.ts +11 -5
- package/dist/types/graph/canvas-tools/CanvasTools.d.ts +7 -2
- package/dist/types/graph/connect-hints/connectTargets.d.ts +22 -0
- package/dist/types/graph/connect-hints/index.d.ts +3 -1
- package/dist/types/graph/connect-hints/useConnectHints.d.ts +9 -0
- package/dist/types/graph/connect-status/ConnectStatus.d.ts +30 -0
- package/dist/types/graph/connect-status/index.d.ts +2 -0
- package/dist/types/graph/context-at/index.d.ts +2 -0
- package/dist/types/graph/context-at/useContextAt.d.ts +43 -0
- package/dist/types/graph/empty-canvas-hint/EmptyCanvasHint.d.ts +33 -0
- package/dist/types/graph/empty-canvas-hint/index.d.ts +2 -0
- package/dist/types/graph/follow-fit/useFollowFit.d.ts +1 -0
- package/dist/types/graph/ghost-node/GhostNode.d.ts +32 -0
- package/dist/types/graph/ghost-node/index.d.ts +2 -0
- package/dist/types/graph/ghost-wire/GhostWire.d.ts +1 -1
- package/dist/types/graph/index.d.ts +4 -0
- package/dist/types/graph/meter/Meter.d.ts +8 -1
- package/dist/types/graph/meter/index.d.ts +1 -1
- package/dist/types/graph/wire/Wire.d.ts +4 -4
- package/dist/types/hooks/use-toasts/toastQueue.d.ts +1 -1
- package/dist/types/primitives/glyph/Glyph.d.ts +14 -0
- package/dist/types/primitives/glyph/index.d.ts +2 -0
- package/dist/types/primitives/icon-button/index.d.ts +1 -0
- package/dist/types/primitives/index.d.ts +1 -0
- package/dist/types/primitives/key-value/KeyValue.d.ts +3 -3
- package/dist/types/primitives/sheet/Sheet.d.ts +9 -3
- package/dist/types/primitives/spinner/Spinner.d.ts +1 -1
- package/dist/types/shell/app-shell/AppShell.d.ts +9 -1
- package/package.json +1 -1
- /package/dist/types/primitives/{dialog → icon-button}/CloseGlyph.d.ts +0 -0
package/dist/primitives.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./primitives.css";import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement as r, isValidElement as i, useCallback as a, useEffect as o, useId as s, useLayoutEffect as c, useRef as l } from "react";
|
|
3
|
-
import { createPortal as
|
|
2
|
+
import { cloneElement as r, isValidElement as i, useCallback as a, useEffect as o, useId as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { createPortal as d } from "react-dom";
|
|
4
4
|
// src/primitives/badge/Badge.tsx
|
|
5
|
-
function
|
|
5
|
+
function f({ tone: e, variant: n = "outlined", children: r, title: i, className: a }) {
|
|
6
6
|
return /* @__PURE__ */ t("span", {
|
|
7
7
|
className: a === void 0 ? "pb-badge" : `pb-badge ${a}`,
|
|
8
8
|
"data-tone": e,
|
|
@@ -12,13 +12,11 @@ function d({ tone: e, variant: n = "outlined", children: r, title: i, className:
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
// src/primitives/spinner/Spinner.tsx
|
|
15
|
-
function
|
|
16
|
-
let a = r === void 0 ? "pb-spinner" : `pb-spinner ${r}
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"aria-hidden": "true"
|
|
21
|
-
}) : /* @__PURE__ */ n("span", {
|
|
15
|
+
function p({ label: e, className: r, ...i }) {
|
|
16
|
+
let a = r === void 0 ? "pb-spinner" : `pb-spinner ${r}`, s = e !== void 0 && e !== "", [c, l] = u(!1);
|
|
17
|
+
return o(() => {
|
|
18
|
+
l(s);
|
|
19
|
+
}, [s]), s ? /* @__PURE__ */ n("span", {
|
|
22
20
|
...i,
|
|
23
21
|
className: `${a} pb-spinner-labelled`,
|
|
24
22
|
role: "status",
|
|
@@ -27,13 +25,17 @@ function f({ label: e, className: r, ...i }) {
|
|
|
27
25
|
"aria-hidden": "true"
|
|
28
26
|
}), /* @__PURE__ */ t("span", {
|
|
29
27
|
className: "pb-spinner-label",
|
|
30
|
-
children: e
|
|
28
|
+
children: c && e
|
|
31
29
|
})]
|
|
30
|
+
}) : /* @__PURE__ */ t("span", {
|
|
31
|
+
...i,
|
|
32
|
+
className: a,
|
|
33
|
+
"aria-hidden": "true"
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
// src/primitives/button/Button.tsx
|
|
35
|
-
function
|
|
36
|
-
function
|
|
37
|
+
function m({ tone: r = "neutral", size: i = "md", busy: a = !1, busyLabel: o, type: s = "button", className: c, children: l, onClick: u, ...d }) {
|
|
38
|
+
function f(e) {
|
|
37
39
|
a ? e.preventDefault() : u?.(e);
|
|
38
40
|
}
|
|
39
41
|
let m = o !== void 0 && o !== "", h = d["aria-label"] !== void 0, g = /* @__PURE__ */ t("button", {
|
|
@@ -45,7 +47,7 @@ function p({ tone: r = "neutral", size: i = "md", busy: a = !1, busyLabel: o, ty
|
|
|
45
47
|
"aria-busy": a || void 0,
|
|
46
48
|
"aria-disabled": a || d["aria-disabled"] || void 0,
|
|
47
49
|
"aria-label": a && m && h ? o : d["aria-label"],
|
|
48
|
-
onClick:
|
|
50
|
+
onClick: f,
|
|
49
51
|
children: m && !h ? /* @__PURE__ */ n("span", {
|
|
50
52
|
className: "pb-button-stack",
|
|
51
53
|
children: [/* @__PURE__ */ t("span", {
|
|
@@ -55,12 +57,12 @@ function p({ tone: r = "neutral", size: i = "md", busy: a = !1, busyLabel: o, ty
|
|
|
55
57
|
}), /* @__PURE__ */ n("span", {
|
|
56
58
|
className: "pb-button-content pb-button-busy",
|
|
57
59
|
"aria-hidden": !a || void 0,
|
|
58
|
-
children: [/* @__PURE__ */ t(
|
|
60
|
+
children: [/* @__PURE__ */ t(p, {}), o]
|
|
59
61
|
})]
|
|
60
62
|
}) : /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
|
|
61
63
|
className: "pb-button-content",
|
|
62
64
|
children: l
|
|
63
|
-
}), a && /* @__PURE__ */ t(
|
|
65
|
+
}), a && /* @__PURE__ */ t(p, { className: "pb-button-spinner" })] })
|
|
64
66
|
});
|
|
65
67
|
return m ? /* @__PURE__ */ n(e, { children: [g, /* @__PURE__ */ t("span", {
|
|
66
68
|
className: "pb-button-announce",
|
|
@@ -69,12 +71,12 @@ function p({ tone: r = "neutral", size: i = "md", busy: a = !1, busyLabel: o, ty
|
|
|
69
71
|
})] }) : g;
|
|
70
72
|
}
|
|
71
73
|
// src/primitives/checkbox/Checkbox.tsx
|
|
72
|
-
function
|
|
74
|
+
function h(e, t) {
|
|
73
75
|
typeof e == "function" ? e(t) : e != null && (e.current = t);
|
|
74
76
|
}
|
|
75
|
-
function
|
|
77
|
+
function g({ label: e, indeterminate: r = !1, className: i, ref: o, ...s }) {
|
|
76
78
|
let u = l(null), d = a((e) => {
|
|
77
|
-
u.current = e,
|
|
79
|
+
u.current = e, h(o, e);
|
|
78
80
|
}, [o]);
|
|
79
81
|
c(() => {
|
|
80
82
|
u.current !== null && (u.current.indeterminate = r);
|
|
@@ -94,10 +96,36 @@ function h({ label: e, indeterminate: r = !1, className: i, ref: o, ...s }) {
|
|
|
94
96
|
})]
|
|
95
97
|
});
|
|
96
98
|
}
|
|
99
|
+
// src/primitives/glyph/Glyph.tsx
|
|
100
|
+
var _ = 16, v = 12, y = 1.75;
|
|
101
|
+
function b({ children: e, className: n, ...r }) {
|
|
102
|
+
return /* @__PURE__ */ t("svg", {
|
|
103
|
+
fill: "none",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: y,
|
|
106
|
+
strokeLinecap: "round",
|
|
107
|
+
strokeLinejoin: "round",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
focusable: "false",
|
|
110
|
+
...r,
|
|
111
|
+
className: n === void 0 ? "pb-glyph" : `pb-glyph ${n}`,
|
|
112
|
+
viewBox: "0 0 16 16",
|
|
113
|
+
width: 16,
|
|
114
|
+
height: 16,
|
|
115
|
+
children: e
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// src/primitives/icon-button/CloseGlyph.tsx
|
|
119
|
+
function x() {
|
|
120
|
+
return /* @__PURE__ */ t(b, {
|
|
121
|
+
className: "pb-close-glyph",
|
|
122
|
+
children: /* @__PURE__ */ t("path", { d: "M3.5 3.5l9 9M12.5 3.5l-9 9" })
|
|
123
|
+
});
|
|
124
|
+
}
|
|
97
125
|
// src/primitives/icon-button/IconButton.tsx
|
|
98
|
-
function
|
|
126
|
+
function S({ label: e, title: n, className: r, children: i, ...a }) {
|
|
99
127
|
let o = a.busy === !0 && a.busyLabel !== void 0 && a.busyLabel !== "" ? a.busyLabel : e;
|
|
100
|
-
return /* @__PURE__ */ t(
|
|
128
|
+
return /* @__PURE__ */ t(m, {
|
|
101
129
|
...a,
|
|
102
130
|
className: r === void 0 ? "pb-icon-button" : `pb-icon-button ${r}`,
|
|
103
131
|
"aria-label": e,
|
|
@@ -109,33 +137,18 @@ function g({ label: e, title: n, className: r, children: i, ...a }) {
|
|
|
109
137
|
})
|
|
110
138
|
});
|
|
111
139
|
}
|
|
112
|
-
// src/primitives/dialog/CloseGlyph.tsx
|
|
113
|
-
function _() {
|
|
114
|
-
return /* @__PURE__ */ t("svg", {
|
|
115
|
-
viewBox: "0 0 16 16",
|
|
116
|
-
width: "12",
|
|
117
|
-
height: "12",
|
|
118
|
-
"aria-hidden": "true",
|
|
119
|
-
children: /* @__PURE__ */ t("path", {
|
|
120
|
-
d: "M3 3l10 10M13 3L3 13",
|
|
121
|
-
fill: "none",
|
|
122
|
-
stroke: "currentColor",
|
|
123
|
-
strokeWidth: "1.75"
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
140
|
// src/primitives/dialog/Dialog.tsx
|
|
128
|
-
var
|
|
129
|
-
function
|
|
130
|
-
return [...e.querySelectorAll(
|
|
141
|
+
var C = { close: "Close" }, w = "a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex='-1']),[contenteditable='true']";
|
|
142
|
+
function T(e) {
|
|
143
|
+
return [...e.querySelectorAll(w)].filter((e) => e.closest("[hidden], [inert]") === null && e.tabIndex >= 0);
|
|
131
144
|
}
|
|
132
|
-
function
|
|
145
|
+
function ee(e) {
|
|
133
146
|
let t = e.ownerDocument.querySelectorAll(".pb-dialog");
|
|
134
147
|
return t[t.length - 1] === e;
|
|
135
148
|
}
|
|
136
|
-
function
|
|
149
|
+
function E({ onClose: e, title: r, children: i, actions: a, labels: c, className: u }) {
|
|
137
150
|
let d = {
|
|
138
|
-
...
|
|
151
|
+
...C,
|
|
139
152
|
...c
|
|
140
153
|
}, f = l(null), p = l(null), m = s(), h = l(e);
|
|
141
154
|
return o(() => {
|
|
@@ -146,10 +159,10 @@ function S({ onClose: e, title: r, children: i, actions: a, labels: c, className
|
|
|
146
159
|
let t = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
147
160
|
if (!e.contains(document.activeElement)) {
|
|
148
161
|
let t = p.current;
|
|
149
|
-
(t === null ? void 0 :
|
|
162
|
+
(t === null ? void 0 : T(t)[0])?.focus(), e.contains(document.activeElement) || e.focus();
|
|
150
163
|
}
|
|
151
164
|
let n = (t) => {
|
|
152
|
-
|
|
165
|
+
ee(e) && (t.target instanceof Node && e.contains(t.target) || (T(e)[0] ?? e).focus());
|
|
153
166
|
};
|
|
154
167
|
return document.addEventListener("focusin", n), () => {
|
|
155
168
|
document.removeEventListener("focusin", n), t?.isConnected === !0 && t.focus();
|
|
@@ -168,12 +181,12 @@ function S({ onClose: e, title: r, children: i, actions: a, labels: c, className
|
|
|
168
181
|
tabIndex: -1,
|
|
169
182
|
onKeyDown: (e) => {
|
|
170
183
|
if (e.defaultPrevented) return;
|
|
171
|
-
if (e.key === "Escape") {
|
|
184
|
+
if (e.key === "Escape" && !e.nativeEvent.isComposing) {
|
|
172
185
|
e.preventDefault(), e.stopPropagation(), h.current();
|
|
173
186
|
return;
|
|
174
187
|
}
|
|
175
188
|
if (e.key !== "Tab" || f.current === null) return;
|
|
176
|
-
let t =
|
|
189
|
+
let t = T(f.current), n = t[0], r = t[t.length - 1];
|
|
177
190
|
if (n === void 0 || r === void 0) {
|
|
178
191
|
e.preventDefault();
|
|
179
192
|
return;
|
|
@@ -188,13 +201,13 @@ function S({ onClose: e, title: r, children: i, actions: a, labels: c, className
|
|
|
188
201
|
className: "pb-dialog-title",
|
|
189
202
|
id: m,
|
|
190
203
|
children: r
|
|
191
|
-
}), /* @__PURE__ */ t(
|
|
204
|
+
}), /* @__PURE__ */ t(S, {
|
|
192
205
|
className: "pb-dialog-close",
|
|
193
206
|
label: d.close,
|
|
194
207
|
onClick: () => {
|
|
195
208
|
h.current();
|
|
196
209
|
},
|
|
197
|
-
children: /* @__PURE__ */ t(
|
|
210
|
+
children: /* @__PURE__ */ t(x, {})
|
|
198
211
|
})]
|
|
199
212
|
}),
|
|
200
213
|
/* @__PURE__ */ t("div", {
|
|
@@ -211,15 +224,15 @@ function S({ onClose: e, title: r, children: i, actions: a, labels: c, className
|
|
|
211
224
|
})
|
|
212
225
|
});
|
|
213
226
|
}
|
|
214
|
-
function
|
|
215
|
-
return e ?
|
|
227
|
+
function D({ open: e, ...n }) {
|
|
228
|
+
return e ? d(/* @__PURE__ */ t(E, { ...n }), document.body) : null;
|
|
216
229
|
}
|
|
217
230
|
// src/primitives/field/Field.tsx
|
|
218
|
-
function
|
|
231
|
+
function O(e) {
|
|
219
232
|
return e != null && e !== !1 && e !== "";
|
|
220
233
|
}
|
|
221
|
-
function
|
|
222
|
-
let f = s(), p = u, m = i(p) ? p.props : void 0, h = m?.id ?? `${f}-control`, g =
|
|
234
|
+
function k({ label: e, error: a, hint: o, layout: c = "stacked", className: l, children: u, ...d }) {
|
|
235
|
+
let f = s(), p = u, m = i(p) ? p.props : void 0, h = m?.id ?? `${f}-control`, g = O(o) ? `${f}-hint` : void 0, _ = O(a) ? `${f}-error` : void 0, v = [
|
|
223
236
|
m?.["aria-describedby"],
|
|
224
237
|
g,
|
|
225
238
|
_
|
|
@@ -256,7 +269,7 @@ function T({ label: e, error: a, hint: o, layout: c = "stacked", className: l, c
|
|
|
256
269
|
});
|
|
257
270
|
}
|
|
258
271
|
// src/primitives/key-value/KeyValue.tsx
|
|
259
|
-
function
|
|
272
|
+
function A({ rows: e, label: r, className: i }) {
|
|
260
273
|
return /* @__PURE__ */ t("dl", {
|
|
261
274
|
className: i === void 0 ? "pb-key-value" : `pb-key-value ${i}`,
|
|
262
275
|
"aria-label": r,
|
|
@@ -266,20 +279,23 @@ function E({ rows: e, label: r, className: i }) {
|
|
|
266
279
|
children: [/* @__PURE__ */ t("dt", {
|
|
267
280
|
title: e.title,
|
|
268
281
|
children: e.key
|
|
269
|
-
}), /* @__PURE__ */
|
|
282
|
+
}), /* @__PURE__ */ n("dd", { children: [e.tone !== void 0 && /* @__PURE__ */ t("span", {
|
|
283
|
+
className: "pb-key-value-dot",
|
|
284
|
+
"aria-hidden": "true"
|
|
285
|
+
}), e.value] })]
|
|
270
286
|
}, r))
|
|
271
287
|
});
|
|
272
288
|
}
|
|
273
289
|
// src/primitives/panel/scroll-focus.ts
|
|
274
|
-
function
|
|
290
|
+
function j(e) {
|
|
275
291
|
return e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth;
|
|
276
292
|
}
|
|
277
|
-
function
|
|
293
|
+
function te(e) {
|
|
278
294
|
o(() => {
|
|
279
295
|
let t = e.current;
|
|
280
296
|
if (t === null) return;
|
|
281
297
|
let n = () => {
|
|
282
|
-
|
|
298
|
+
j(t) ? t.tabIndex = 0 : t.removeAttribute("tabindex");
|
|
283
299
|
};
|
|
284
300
|
n();
|
|
285
301
|
let r = typeof ResizeObserver == "function" ? new ResizeObserver(n) : null, i = () => {
|
|
@@ -302,9 +318,9 @@ function D(e) {
|
|
|
302
318
|
}, [e]);
|
|
303
319
|
}
|
|
304
320
|
// src/primitives/panel/Panel.tsx
|
|
305
|
-
function
|
|
321
|
+
function ne({ title: e, actions: r, level: i = 2, className: a, children: o, ...c }) {
|
|
306
322
|
let u = s(), d = l(null);
|
|
307
|
-
|
|
323
|
+
te(d);
|
|
308
324
|
let f = `h${String(i)}`, p = e !== void 0 || r !== void 0;
|
|
309
325
|
return /* @__PURE__ */ n("section", {
|
|
310
326
|
...c,
|
|
@@ -328,7 +344,7 @@ function O({ title: e, actions: r, level: i = 2, className: a, children: o, ...c
|
|
|
328
344
|
});
|
|
329
345
|
}
|
|
330
346
|
// src/primitives/pill/Pill.tsx
|
|
331
|
-
function
|
|
347
|
+
function re({ tone: e, label: r, pulse: i = !1, title: a, detail: o, className: s }) {
|
|
332
348
|
return /* @__PURE__ */ n("span", {
|
|
333
349
|
className: s === void 0 ? "pb-pill" : `pb-pill ${s}`,
|
|
334
350
|
"data-tone": e,
|
|
@@ -348,11 +364,11 @@ function k({ tone: e, label: r, pulse: i = !1, title: a, detail: o, className: s
|
|
|
348
364
|
});
|
|
349
365
|
}
|
|
350
366
|
// src/primitives/radio-group/RadioGroup.tsx
|
|
351
|
-
function
|
|
367
|
+
function M(e) {
|
|
352
368
|
return e != null && e !== !1 && e !== "";
|
|
353
369
|
}
|
|
354
|
-
function
|
|
355
|
-
let g = s(), _ = c ?? `${g}-name`, v =
|
|
370
|
+
function ie({ legend: e, legendHidden: r = !1, options: i, value: a, onChange: o, name: c, layout: l = "stacked", hint: u, error: d, className: f, "aria-describedby": p, "aria-invalid": m, ...h }) {
|
|
371
|
+
let g = s(), _ = c ?? `${g}-name`, v = M(u) ? `${g}-hint` : void 0, y = M(d) ? `${g}-error` : void 0, b = [
|
|
356
372
|
p,
|
|
357
373
|
v,
|
|
358
374
|
y
|
|
@@ -406,7 +422,7 @@ function j({ legend: e, legendHidden: r = !1, options: i, value: a, onChange: o,
|
|
|
406
422
|
});
|
|
407
423
|
}
|
|
408
424
|
// src/primitives/section-title/SectionTitle.tsx
|
|
409
|
-
function
|
|
425
|
+
function ae({ children: e, actions: r, level: i = 3, className: a }) {
|
|
410
426
|
let o = `h${i}`;
|
|
411
427
|
return /* @__PURE__ */ n("div", {
|
|
412
428
|
className: a === void 0 ? "pb-section-title" : `pb-section-title ${a}`,
|
|
@@ -430,50 +446,57 @@ function N({ font: e = "ui", className: n, children: r, ...i }) {
|
|
|
430
446
|
}
|
|
431
447
|
// src/primitives/sheet/Sheet.tsx
|
|
432
448
|
var P = { close: "Close" };
|
|
433
|
-
function F({ onClose: e, side: r = "
|
|
434
|
-
let
|
|
449
|
+
function F({ onClose: e, side: r = "end", title: i, label: a, actions: c, children: u, width: d, labels: f, className: p }) {
|
|
450
|
+
let m = {
|
|
435
451
|
...P,
|
|
436
|
-
...
|
|
437
|
-
},
|
|
452
|
+
...f
|
|
453
|
+
}, h = l(null), g = s(), _ = l(null);
|
|
438
454
|
o(() => {
|
|
439
|
-
let e =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
455
|
+
let e = h.current, t = (t) => {
|
|
456
|
+
let n = t.relatedTarget;
|
|
457
|
+
e !== null && n instanceof HTMLElement && !e.contains(n) && (_.current = n);
|
|
458
|
+
};
|
|
459
|
+
return e?.addEventListener("focusin", t), () => {
|
|
460
|
+
e?.removeEventListener("focusin", t);
|
|
461
|
+
let n = _.current, r = document.activeElement;
|
|
462
|
+
(r === null || r === document.body || (e?.contains(r) ?? !1)) && n?.isConnected === !0 && n.focus();
|
|
443
463
|
};
|
|
444
464
|
}, []);
|
|
445
|
-
let
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}, b = (t) => {
|
|
449
|
-
t.defaultPrevented || t.key !== "Escape" || (t.preventDefault(), t.stopPropagation(), e());
|
|
450
|
-
}, x = u === void 0 ? void 0 : { "--pb-sheet-width": `${u}px` };
|
|
465
|
+
let v = (t) => {
|
|
466
|
+
t.defaultPrevented || t.nativeEvent.isComposing || t.key !== "Escape" || (t.preventDefault(), t.stopPropagation(), e());
|
|
467
|
+
}, y = d === void 0 ? void 0 : { "--pb-sheet-width": `${d}px` };
|
|
451
468
|
return /* @__PURE__ */ n("section", {
|
|
452
|
-
ref:
|
|
453
|
-
className:
|
|
469
|
+
ref: h,
|
|
470
|
+
className: p === void 0 ? "pb-sheet" : `pb-sheet ${p}`,
|
|
454
471
|
"data-side": r,
|
|
455
472
|
role: "dialog",
|
|
456
|
-
"aria-labelledby": i === void 0 ? void 0 :
|
|
473
|
+
"aria-labelledby": i === void 0 ? void 0 : g,
|
|
457
474
|
"aria-label": i === void 0 ? a : void 0,
|
|
458
|
-
style:
|
|
459
|
-
|
|
460
|
-
onKeyDown: b,
|
|
475
|
+
style: y,
|
|
476
|
+
onKeyDown: v,
|
|
461
477
|
children: [/* @__PURE__ */ n("div", {
|
|
462
478
|
className: "pb-sheet-head",
|
|
463
|
-
children: [
|
|
464
|
-
className: "pb-sheet-title",
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
479
|
+
children: [
|
|
480
|
+
i === void 0 ? /* @__PURE__ */ t("span", { className: "pb-sheet-title" }) : /* @__PURE__ */ t("h2", {
|
|
481
|
+
className: "pb-sheet-title",
|
|
482
|
+
id: g,
|
|
483
|
+
children: i
|
|
484
|
+
}),
|
|
485
|
+
c !== void 0 && /* @__PURE__ */ t("div", {
|
|
486
|
+
className: "pb-sheet-actions",
|
|
487
|
+
children: c
|
|
488
|
+
}),
|
|
489
|
+
/* @__PURE__ */ t(S, {
|
|
490
|
+
className: "pb-sheet-close",
|
|
491
|
+
label: m.close,
|
|
492
|
+
onClick: e,
|
|
493
|
+
children: /* @__PURE__ */ t(x, {})
|
|
494
|
+
})
|
|
495
|
+
]
|
|
473
496
|
}), /* @__PURE__ */ t("div", {
|
|
474
497
|
className: "pb-sheet-body",
|
|
475
498
|
tabIndex: 0,
|
|
476
|
-
children:
|
|
499
|
+
children: u
|
|
477
500
|
})]
|
|
478
501
|
});
|
|
479
502
|
}
|
|
@@ -540,7 +563,7 @@ function W({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, ed
|
|
|
540
563
|
delete t.dataset.dragging, typeof t.hasPointerCapture == "function" && t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
|
|
541
564
|
}
|
|
542
565
|
function C(t) {
|
|
543
|
-
if (h?.(t), t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey) return;
|
|
566
|
+
if (h?.(t), t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey || t.nativeEvent.isComposing || t.key === "Process") return;
|
|
544
567
|
let r = H(n, t.key, B(e, s, U(t.currentTarget)), c, v);
|
|
545
568
|
r !== void 0 && (t.preventDefault(), r !== n && a(r));
|
|
546
569
|
}
|
|
@@ -592,36 +615,30 @@ function Y(e, t = K) {
|
|
|
592
615
|
let n = e === "system" ? ` (${t.systemHint})` : "";
|
|
593
616
|
return `${t.theme}: ${t[e]}${n}; ${t.clickFor} ${t[J(e)]}`;
|
|
594
617
|
}
|
|
595
|
-
function
|
|
618
|
+
function oe({ choice: e, onChoose: r, labels: i, className: a, ...o }) {
|
|
596
619
|
let s = {
|
|
597
620
|
...K,
|
|
598
621
|
...i
|
|
599
622
|
};
|
|
600
|
-
return /* @__PURE__ */ n(
|
|
623
|
+
return /* @__PURE__ */ n(m, {
|
|
601
624
|
...o,
|
|
602
|
-
|
|
625
|
+
tone: "neutral",
|
|
603
626
|
className: a === void 0 ? "pb-theme-switch" : `pb-theme-switch ${a}`,
|
|
604
627
|
title: Y(e, s),
|
|
605
628
|
"aria-label": `${s.theme}: ${s[e]}`,
|
|
606
629
|
onClick: () => {
|
|
607
630
|
r(J(e));
|
|
608
631
|
},
|
|
609
|
-
children: [/* @__PURE__ */ n(
|
|
632
|
+
children: [/* @__PURE__ */ n(b, {
|
|
610
633
|
className: "pb-theme-switch-icon",
|
|
611
|
-
viewBox: "0 0 16 16",
|
|
612
|
-
width: "14",
|
|
613
|
-
height: "14",
|
|
614
|
-
"aria-hidden": "true",
|
|
615
634
|
children: [/* @__PURE__ */ t("circle", {
|
|
616
635
|
cx: "8",
|
|
617
636
|
cy: "8",
|
|
618
|
-
r: "6
|
|
619
|
-
fill: "none",
|
|
620
|
-
stroke: "currentColor",
|
|
621
|
-
strokeWidth: "1.5"
|
|
637
|
+
r: "6"
|
|
622
638
|
}), /* @__PURE__ */ t("path", {
|
|
623
|
-
d: "M8
|
|
624
|
-
fill: "currentColor"
|
|
639
|
+
d: "M8 2a6 6 0 0 1 0 12z",
|
|
640
|
+
fill: "currentColor",
|
|
641
|
+
stroke: "none"
|
|
625
642
|
})]
|
|
626
643
|
}), /* @__PURE__ */ t("span", {
|
|
627
644
|
className: "pb-theme-switch-word",
|
|
@@ -630,16 +647,16 @@ function X({ choice: e, onChoose: r, labels: i, className: a, ...o }) {
|
|
|
630
647
|
});
|
|
631
648
|
}
|
|
632
649
|
// src/primitives/toolbar/roving.ts
|
|
633
|
-
var
|
|
634
|
-
function
|
|
635
|
-
return [...e.querySelectorAll(
|
|
650
|
+
var se = "button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [role=\"button\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"menuitem\"], [role=\"switch\"]";
|
|
651
|
+
function X(e) {
|
|
652
|
+
return [...e.querySelectorAll(se)].filter((t) => t.closest("[role=\"toolbar\"]") === e);
|
|
636
653
|
}
|
|
637
|
-
function
|
|
654
|
+
function Z(e, t) {
|
|
638
655
|
let n = t !== null && e.includes(t) ? t : e[0] ?? null;
|
|
639
656
|
for (let t of e) t.tabIndex = t === n ? 0 : -1;
|
|
640
657
|
return n;
|
|
641
658
|
}
|
|
642
|
-
function
|
|
659
|
+
function Q(e, t, n, r, i) {
|
|
643
660
|
if (t === 0) return;
|
|
644
661
|
if (n === "Home") return 0;
|
|
645
662
|
if (n === "End") return t - 1;
|
|
@@ -647,7 +664,7 @@ function ne(e, t, n, r, i) {
|
|
|
647
664
|
if (n === o) return (e + 1) % t;
|
|
648
665
|
if (n === a) return (e - 1 + t) % t;
|
|
649
666
|
}
|
|
650
|
-
function
|
|
667
|
+
function ce(e) {
|
|
651
668
|
return e instanceof HTMLTextAreaElement ? !0 : e instanceof HTMLInputElement ? ![
|
|
652
669
|
"button",
|
|
653
670
|
"checkbox",
|
|
@@ -667,7 +684,7 @@ function $({ label: e, orientation: n = "horizontal", className: r, ref: i, onKe
|
|
|
667
684
|
let e = d.current;
|
|
668
685
|
if (e === null) return;
|
|
669
686
|
let t = () => {
|
|
670
|
-
f.current =
|
|
687
|
+
f.current = Z(X(e), f.current);
|
|
671
688
|
};
|
|
672
689
|
t();
|
|
673
690
|
let n = new MutationObserver(t);
|
|
@@ -684,16 +701,16 @@ function $({ label: e, orientation: n = "horizontal", className: r, ref: i, onKe
|
|
|
684
701
|
s?.(e);
|
|
685
702
|
let t = d.current;
|
|
686
703
|
if (t === null) return;
|
|
687
|
-
let n =
|
|
688
|
-
e.target instanceof HTMLElement && n.includes(e.target) && (f.current =
|
|
704
|
+
let n = X(t);
|
|
705
|
+
e.target instanceof HTMLElement && n.includes(e.target) && (f.current = Z(n, e.target));
|
|
689
706
|
}
|
|
690
707
|
function m(e) {
|
|
691
708
|
a?.(e);
|
|
692
709
|
let t = d.current;
|
|
693
|
-
if (e.defaultPrevented || t === null || e.altKey || e.ctrlKey || e.metaKey ||
|
|
694
|
-
let r =
|
|
710
|
+
if (e.defaultPrevented || t === null || e.altKey || e.ctrlKey || e.metaKey || e.nativeEvent.isComposing || e.key === "Process" || ce(e.target)) return;
|
|
711
|
+
let r = X(t), i = r.indexOf(e.target);
|
|
695
712
|
if (i === -1) return;
|
|
696
|
-
let o = getComputedStyle(t).direction === "rtl", s =
|
|
713
|
+
let o = getComputedStyle(t).direction === "rtl", s = Q(i, r.length, e.key, n, o);
|
|
697
714
|
s !== void 0 && (e.preventDefault(), r[s]?.focus());
|
|
698
715
|
}
|
|
699
716
|
return /* @__PURE__ */ t("div", {
|
|
@@ -712,14 +729,14 @@ function $({ label: e, orientation: n = "horizontal", className: r, ref: i, onKe
|
|
|
712
729
|
});
|
|
713
730
|
}
|
|
714
731
|
// src/primitives/tool-group/ToolGroup.tsx
|
|
715
|
-
function
|
|
732
|
+
function le({ className: e, ...n }) {
|
|
716
733
|
return /* @__PURE__ */ t($, {
|
|
717
734
|
...n,
|
|
718
735
|
className: e === void 0 ? "pb-tool-group" : `pb-tool-group ${e}`
|
|
719
736
|
});
|
|
720
737
|
}
|
|
721
738
|
// src/primitives/warn-mark/WarnMark.tsx
|
|
722
|
-
function
|
|
739
|
+
function ue({ label: r, title: i, className: a }) {
|
|
723
740
|
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
|
|
724
741
|
className: a === void 0 ? "pb-warn-mark" : `pb-warn-mark ${a}`,
|
|
725
742
|
"aria-hidden": "true",
|
|
@@ -730,6 +747,6 @@ function ae({ label: r, title: i, className: a }) {
|
|
|
730
747
|
children: r
|
|
731
748
|
})] });
|
|
732
749
|
}
|
|
733
|
-
export {
|
|
750
|
+
export { f as Badge, m as Button, g as Checkbox, x as CloseGlyph, D as Dialog, k as Field, _ as GLYPH_BOX, v as GLYPH_DRAWN, y as GLYPH_STROKE, b as Glyph, S as IconButton, A as KeyValue, ne as Panel, re as Pill, ie as RadioGroup, ae as SectionTitle, N as Select, I as Sheet, p as Spinner, W as Splitter, G as TextInput, oe as ThemeSwitch, le as ToolGroup, $ as Toolbar, ue as WarnMark, C as defaultDialogLabels, P as defaultSheetLabels, K as defaultThemeSwitchLabels, Y as themeSwitchTitle };
|
|
734
751
|
|
|
735
752
|
//# sourceMappingURL=primitives.js.map
|