@coolms/ui-react 0.1.0-alpha.8 → 0.1.0-alpha.9
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 +7 -0
- package/dist/components/Workspace.d.ts +11 -1
- package/dist/index.js +252 -251
- package/package.json +1 -1
- package/src/kit.css +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@coolms/ui-react` are listed here. Versions follow [semantic versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## 0.1.0-alpha.9 (2026-11-09)
|
|
6
|
+
|
|
7
|
+
A quick reply that carries its own controls and decides when it may be sent.
|
|
8
|
+
|
|
9
|
+
- `Composer` takes `leading`, a quick reply's own controls at the start of its last row before Send, and `canSend`,
|
|
10
|
+
which decides whether Send sends in place of the text being non-empty.
|
|
11
|
+
|
|
5
12
|
## 0.1.0-alpha.8 (2026-11-09)
|
|
6
13
|
|
|
7
14
|
Choosing files a person already has, and a file viewer that keeps to the screen.
|
|
@@ -137,9 +137,19 @@ export interface ComposerProps {
|
|
|
137
137
|
readonly sendLabel?: string;
|
|
138
138
|
/** The attach button's name, in the app's language ("Attach a file"). */
|
|
139
139
|
readonly attachLabel?: string;
|
|
140
|
+
/**
|
|
141
|
+
* A quick reply's own controls, at the start of its last row, before Send (an attach menu). A chat composer does not
|
|
142
|
+
* draw them. With `onAttach` as well, a reply draws both: these first, then the attach button.
|
|
143
|
+
*/
|
|
144
|
+
readonly leading?: ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* Whether Send sends: by default, when the text is not empty. Given, it decides instead, as for a reply that may go
|
|
147
|
+
* with files and no text, or may not go over its mailbox's limit.
|
|
148
|
+
*/
|
|
149
|
+
readonly canSend?: boolean;
|
|
140
150
|
}
|
|
141
151
|
/**
|
|
142
152
|
* Writing a message: the text, attaching a file, sending. Enter sends a chat message; Shift+Enter starts a new line.
|
|
143
153
|
* Enter while an input method is composing (Chinese, Japanese, Korean...) belongs to the composition and never sends.
|
|
144
154
|
*/
|
|
145
|
-
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel }: ComposerProps): ReactNode;
|
|
155
|
+
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel, leading, canSend }: ComposerProps): ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import { useId as V, useState as D, useRef as T, useEffect as z, useCallback as
|
|
|
3
3
|
import { createPortal as le } from "react-dom";
|
|
4
4
|
function Y(l, n) {
|
|
5
5
|
const a = { ...l };
|
|
6
|
-
for (const
|
|
7
|
-
const t = n == null ? void 0 : n[
|
|
8
|
-
t !== void 0 && (a[
|
|
6
|
+
for (const c of Object.keys(n ?? {})) {
|
|
7
|
+
const t = n == null ? void 0 : n[c];
|
|
8
|
+
t !== void 0 && (a[c] = t);
|
|
9
9
|
}
|
|
10
10
|
return a;
|
|
11
11
|
}
|
|
@@ -35,14 +35,14 @@ function Z({
|
|
|
35
35
|
variant: l = "secondary",
|
|
36
36
|
busy: n = !1,
|
|
37
37
|
busyLabel: a,
|
|
38
|
-
locked:
|
|
38
|
+
locked: c = !1,
|
|
39
39
|
lockedReason: t,
|
|
40
40
|
icon: h,
|
|
41
41
|
disabled: d,
|
|
42
42
|
className: r,
|
|
43
43
|
children: u,
|
|
44
44
|
type: o = "button",
|
|
45
|
-
title:
|
|
45
|
+
title: i,
|
|
46
46
|
...p
|
|
47
47
|
}) {
|
|
48
48
|
const m = !!d || n;
|
|
@@ -51,14 +51,14 @@ function Z({
|
|
|
51
51
|
{
|
|
52
52
|
...p,
|
|
53
53
|
type: o,
|
|
54
|
-
className: k("cms-button", `cms-button--${l}`, n && "is-busy",
|
|
54
|
+
className: k("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", r),
|
|
55
55
|
disabled: m,
|
|
56
56
|
"aria-busy": n || void 0,
|
|
57
|
-
title:
|
|
57
|
+
title: c ? t ?? i : i,
|
|
58
58
|
children: [
|
|
59
|
-
n ? /* @__PURE__ */ e($, { name: "spinner" }) :
|
|
59
|
+
n ? /* @__PURE__ */ e($, { name: "spinner" }) : c ? /* @__PURE__ */ e($, { name: "lock" }) : h,
|
|
60
60
|
/* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : u }),
|
|
61
|
-
|
|
61
|
+
c && t ? /* @__PURE__ */ s("span", { className: "cms-visually-hidden", children: [
|
|
62
62
|
", ",
|
|
63
63
|
t
|
|
64
64
|
] }) : null
|
|
@@ -66,8 +66,8 @@ function Z({
|
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function ue({ id: l, label: n, help: a, error:
|
|
70
|
-
return /* @__PURE__ */ s("div", { className: k("cms-field",
|
|
69
|
+
function ue({ id: l, label: n, help: a, error: c, pinned: t, children: h }) {
|
|
70
|
+
return /* @__PURE__ */ s("div", { className: k("cms-field", c != null && "is-invalid"), children: [
|
|
71
71
|
/* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: l, children: n }),
|
|
72
72
|
h,
|
|
73
73
|
t != null ? /* @__PURE__ */ s("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
|
|
@@ -75,7 +75,7 @@ function ue({ id: l, label: n, help: a, error: i, pinned: t, children: h }) {
|
|
|
75
75
|
" ",
|
|
76
76
|
t
|
|
77
77
|
] }) : null,
|
|
78
|
-
|
|
78
|
+
c != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: c }) : null,
|
|
79
79
|
a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${l}-help`, children: a }) : null
|
|
80
80
|
] });
|
|
81
81
|
}
|
|
@@ -83,18 +83,18 @@ function he(l, n) {
|
|
|
83
83
|
const a = [n.error != null && `${l}-error`, n.pinned != null && `${l}-pinned`, n.help != null && `${l}-help`].filter(Boolean).join(" ");
|
|
84
84
|
return a === "" ? void 0 : a;
|
|
85
85
|
}
|
|
86
|
-
function Xe({ label: l, help: n, error: a, disabled:
|
|
86
|
+
function Xe({ label: l, help: n, error: a, disabled: c, readOnly: t, pinned: h, value: d, onChange: r, placeholder: u, type: o = "text", name: i }) {
|
|
87
87
|
const p = V();
|
|
88
88
|
return /* @__PURE__ */ e(ue, { id: p, label: l, help: n, error: a, pinned: h, children: /* @__PURE__ */ e(
|
|
89
89
|
"input",
|
|
90
90
|
{
|
|
91
91
|
id: p,
|
|
92
|
-
name:
|
|
92
|
+
name: i,
|
|
93
93
|
type: o,
|
|
94
94
|
className: "cms-input",
|
|
95
95
|
value: d,
|
|
96
96
|
placeholder: u,
|
|
97
|
-
disabled:
|
|
97
|
+
disabled: c,
|
|
98
98
|
readOnly: t || h != null,
|
|
99
99
|
"aria-invalid": a != null || void 0,
|
|
100
100
|
"aria-describedby": he(p, { help: n, error: a, pinned: h }),
|
|
@@ -102,19 +102,19 @@ function Xe({ label: l, help: n, error: a, disabled: i, readOnly: t, pinned: h,
|
|
|
102
102
|
}
|
|
103
103
|
) });
|
|
104
104
|
}
|
|
105
|
-
function Ye({ label: l, help: n, error: a, disabled:
|
|
106
|
-
const
|
|
107
|
-
return /* @__PURE__ */ e(ue, { id:
|
|
105
|
+
function Ye({ label: l, help: n, error: a, disabled: c, readOnly: t, value: h, options: d, onChange: r, emptyText: u = "Nothing to choose from yet.", name: o }) {
|
|
106
|
+
const i = V(), p = d.length === 0;
|
|
107
|
+
return /* @__PURE__ */ e(ue, { id: i, label: l, help: p ? u : n, error: a, children: /* @__PURE__ */ e(
|
|
108
108
|
"select",
|
|
109
109
|
{
|
|
110
|
-
id:
|
|
110
|
+
id: i,
|
|
111
111
|
name: o,
|
|
112
112
|
className: "cms-input cms-select",
|
|
113
113
|
value: h,
|
|
114
|
-
disabled:
|
|
114
|
+
disabled: c || p,
|
|
115
115
|
"aria-readonly": t || void 0,
|
|
116
116
|
"aria-invalid": a != null || void 0,
|
|
117
|
-
"aria-describedby": he(
|
|
117
|
+
"aria-describedby": he(i, { help: p ? u : n, error: a }),
|
|
118
118
|
onChange: (m) => {
|
|
119
119
|
t || r == null || r(m.target.value);
|
|
120
120
|
},
|
|
@@ -122,7 +122,7 @@ function Ye({ label: l, help: n, error: a, disabled: i, readOnly: t, value: h, o
|
|
|
122
122
|
}
|
|
123
123
|
) });
|
|
124
124
|
}
|
|
125
|
-
function Ge({ label: l, checked: n, onChange: a, disabled:
|
|
125
|
+
function Ge({ label: l, checked: n, onChange: a, disabled: c, readOnly: t, help: h }) {
|
|
126
126
|
const d = V();
|
|
127
127
|
return /* @__PURE__ */ s("div", { className: "cms-toggle-row", children: [
|
|
128
128
|
/* @__PURE__ */ e(
|
|
@@ -135,7 +135,7 @@ function Ge({ label: l, checked: n, onChange: a, disabled: i, readOnly: t, help:
|
|
|
135
135
|
"aria-checked": n,
|
|
136
136
|
"aria-readonly": t || void 0,
|
|
137
137
|
"aria-describedby": h != null ? `${d}-help` : void 0,
|
|
138
|
-
disabled:
|
|
138
|
+
disabled: c,
|
|
139
139
|
onClick: () => {
|
|
140
140
|
t || a == null || a(!n);
|
|
141
141
|
},
|
|
@@ -147,29 +147,29 @@ function Ge({ label: l, checked: n, onChange: a, disabled: i, readOnly: t, help:
|
|
|
147
147
|
] });
|
|
148
148
|
}
|
|
149
149
|
const ye = 150;
|
|
150
|
-
function fe({ open: l, title: n, onClose: a, dirty:
|
|
151
|
-
const [
|
|
150
|
+
function fe({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: t, children: h, footer: d, closeLabel: r = "Close", initialFocus: u, className: o }) {
|
|
151
|
+
const [i, p] = D(l), [m, N] = D(!1), v = T(null), g = T(null), A = V();
|
|
152
152
|
if (z(() => {
|
|
153
153
|
if (l) {
|
|
154
|
-
g.current = document.activeElement, p(!0),
|
|
154
|
+
g.current = document.activeElement, p(!0), N(!1);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
if (!
|
|
158
|
-
|
|
157
|
+
if (!i) return;
|
|
158
|
+
N(!0);
|
|
159
159
|
const y = window.setTimeout(() => {
|
|
160
160
|
var C, x;
|
|
161
|
-
p(!1),
|
|
161
|
+
p(!1), N(!1), (x = (C = g.current) == null ? void 0 : C.focus) == null || x.call(C);
|
|
162
162
|
}, ye);
|
|
163
163
|
return () => window.clearTimeout(y);
|
|
164
|
-
}, [l,
|
|
164
|
+
}, [l, i]), z(() => {
|
|
165
165
|
var y, C;
|
|
166
|
-
if (l &&
|
|
166
|
+
if (l && i) {
|
|
167
167
|
const x = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
|
|
168
|
-
(C = (u == null ? void 0 : u.current) ?? ((y =
|
|
168
|
+
(C = (u == null ? void 0 : u.current) ?? ((y = v.current) == null ? void 0 : y.querySelector(`.cms-modal__body :is(${x}), .cms-modal__foot :is(${x})`)) ?? v.current) == null || C.focus();
|
|
169
169
|
}
|
|
170
|
-
}, [l,
|
|
170
|
+
}, [l, i, u]), !i) return null;
|
|
171
171
|
const H = () => {
|
|
172
|
-
|
|
172
|
+
c ? t == null || t() : a();
|
|
173
173
|
};
|
|
174
174
|
return le(
|
|
175
175
|
/* @__PURE__ */ e("div", { className: k("cms-modal-scrim", m && "is-closing"), onMouseDown: (y) => {
|
|
@@ -177,8 +177,8 @@ function fe({ open: l, title: n, onClose: a, dirty: i = !1, onDirtyClose: t, chi
|
|
|
177
177
|
}, children: /* @__PURE__ */ s(
|
|
178
178
|
"div",
|
|
179
179
|
{
|
|
180
|
-
ref:
|
|
181
|
-
className: k("cms-modal", o, m && "is-closing",
|
|
180
|
+
ref: v,
|
|
181
|
+
className: k("cms-modal", o, m && "is-closing", c && "is-dirty"),
|
|
182
182
|
role: "dialog",
|
|
183
183
|
"aria-modal": "true",
|
|
184
184
|
"aria-labelledby": A,
|
|
@@ -188,7 +188,7 @@ function fe({ open: l, title: n, onClose: a, dirty: i = !1, onDirtyClose: t, chi
|
|
|
188
188
|
if (y.key === "Escape")
|
|
189
189
|
y.stopPropagation(), H();
|
|
190
190
|
else if (y.key === "Tab") {
|
|
191
|
-
const x = (C =
|
|
191
|
+
const x = (C = v.current) == null ? void 0 : C.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
|
|
192
192
|
if (!x || x.length === 0) return;
|
|
193
193
|
const K = x[0], R = x[x.length - 1];
|
|
194
194
|
y.shiftKey && document.activeElement === K ? (y.preventDefault(), R.focus()) : !y.shiftKey && document.activeElement === R && (y.preventDefault(), K.focus());
|
|
@@ -207,8 +207,8 @@ function fe({ open: l, title: n, onClose: a, dirty: i = !1, onDirtyClose: t, chi
|
|
|
207
207
|
document.body
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
|
-
function Oe({ open: l, title: n, message: a, kind:
|
|
211
|
-
const o =
|
|
210
|
+
function Oe({ open: l, title: n, message: a, kind: c = "default", confirmLabel: t, cancelLabel: h, closeLabel: d, onConfirm: r, onCancel: u }) {
|
|
211
|
+
const o = c === "discard-changes";
|
|
212
212
|
return /* @__PURE__ */ e(
|
|
213
213
|
fe,
|
|
214
214
|
{
|
|
@@ -218,9 +218,9 @@ function Oe({ open: l, title: n, message: a, kind: i = "default", confirmLabel:
|
|
|
218
218
|
...d === void 0 ? {} : { closeLabel: d },
|
|
219
219
|
footer: /* @__PURE__ */ s(w, { children: [
|
|
220
220
|
/* @__PURE__ */ e(Z, { onClick: u, children: h ?? (o ? "Keep editing" : "Cancel") }),
|
|
221
|
-
/* @__PURE__ */ e(Z, { variant:
|
|
221
|
+
/* @__PURE__ */ e(Z, { variant: c === "default" ? "primary" : "danger", onClick: r, children: t ?? (o ? "Discard changes" : "Confirm") })
|
|
222
222
|
] }),
|
|
223
|
-
children:
|
|
223
|
+
children: c !== "default" ? /* @__PURE__ */ s("p", { className: "cms-confirm__warning", children: [
|
|
224
224
|
/* @__PURE__ */ e($, { name: "warning" }),
|
|
225
225
|
" ",
|
|
226
226
|
a
|
|
@@ -228,12 +228,12 @@ function Oe({ open: l, title: n, message: a, kind: i = "default", confirmLabel:
|
|
|
228
228
|
}
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
|
-
function Qe({ kind: l, message: n, action: a, onDismiss:
|
|
231
|
+
function Qe({ kind: l, message: n, action: a, onDismiss: c, dismissLabel: t = "Dismiss" }) {
|
|
232
232
|
return /* @__PURE__ */ s("div", { className: k("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
|
|
233
233
|
/* @__PURE__ */ e($, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
|
|
234
234
|
/* @__PURE__ */ e("span", { className: "cms-toast__message", children: n }),
|
|
235
235
|
a ? /* @__PURE__ */ e(Z, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
|
|
236
|
-
|
|
236
|
+
c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": t, onClick: c, children: /* @__PURE__ */ e($, { name: "close" }) }) : null
|
|
237
237
|
] });
|
|
238
238
|
}
|
|
239
239
|
function Je({ children: l }) {
|
|
@@ -271,7 +271,7 @@ function Me() {
|
|
|
271
271
|
/* @__PURE__ */ e("circle", { className: "cms-state__arc", cx: "12", cy: "12", r: "10", fill: "none", pathLength: "100", strokeDasharray: "28 72" })
|
|
272
272
|
] });
|
|
273
273
|
}
|
|
274
|
-
function X({ kind: l, title: n, description: a, action:
|
|
274
|
+
function X({ kind: l, title: n, description: a, action: c, placement: t = "block" }) {
|
|
275
275
|
const [h, d] = D(l !== "loading");
|
|
276
276
|
return z(() => {
|
|
277
277
|
if (l !== "loading") {
|
|
@@ -295,7 +295,7 @@ function X({ kind: l, title: n, description: a, action: i, placement: t = "block
|
|
|
295
295
|
/* @__PURE__ */ e("span", { className: "cms-state__title", children: n }),
|
|
296
296
|
a !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-state__description", children: a }) : null
|
|
297
297
|
] }),
|
|
298
|
-
|
|
298
|
+
c !== void 0 && l !== "denied" ? /* @__PURE__ */ e(Z, { className: "cms-state__action", onClick: c.onAction, children: c.label }) : null
|
|
299
299
|
]
|
|
300
300
|
}
|
|
301
301
|
);
|
|
@@ -430,23 +430,23 @@ function Le(l) {
|
|
|
430
430
|
return l.getClientRects().length > 0;
|
|
431
431
|
}
|
|
432
432
|
function ll(l) {
|
|
433
|
-
const { name: n, badge: a, closeLabel:
|
|
433
|
+
const { name: n, badge: a, closeLabel: c, onClose: t, actions: h = [], moreLabel: d = "More", edit: r, editing: u, siblings: o, bar: i, thumbnails: p, strip: m, onZoom: N, children: v } = l, g = T(null), A = T(null), H = V(), [y, C] = D(!1), x = T(null);
|
|
434
434
|
z(() => {
|
|
435
435
|
var P;
|
|
436
|
-
const
|
|
436
|
+
const b = document.activeElement, S = document.body.style.overflow;
|
|
437
437
|
return document.body.style.overflow = "hidden", (P = A.current) == null || P.focus(), () => {
|
|
438
438
|
var B;
|
|
439
|
-
document.body.style.overflow = S, (B =
|
|
439
|
+
document.body.style.overflow = S, (B = b == null ? void 0 : b.focus) == null || B.call(b);
|
|
440
440
|
};
|
|
441
441
|
}, []);
|
|
442
442
|
const K = () => {
|
|
443
443
|
u != null && u.dirty ? u.onDirtyClose() : t();
|
|
444
|
-
}, R = (
|
|
445
|
-
const S =
|
|
446
|
-
x.current = S === void 0 || u !== void 0 || Se(
|
|
447
|
-
}, q = (
|
|
444
|
+
}, R = (b) => {
|
|
445
|
+
const S = b.touches.length === 1 ? b.touches[0] : void 0;
|
|
446
|
+
x.current = S === void 0 || u !== void 0 || Se(b.target) ? null : { x: S.clientX, y: S.clientY };
|
|
447
|
+
}, q = (b) => {
|
|
448
448
|
var E, W;
|
|
449
|
-
const S = x.current, P =
|
|
449
|
+
const S = x.current, P = b.changedTouches[0];
|
|
450
450
|
if (x.current = null, S === null || P === void 0) return;
|
|
451
451
|
const B = P.clientX - S.x;
|
|
452
452
|
Math.abs(B) < Ee || Math.abs(B) < Math.abs(P.clientY - S.y) || (B > 0 ? (E = o == null ? void 0 : o.onPrevious) == null || E.call(o) : (W = o == null ? void 0 : o.onNext) == null || W.call(o));
|
|
@@ -461,22 +461,22 @@ function ll(l) {
|
|
|
461
461
|
"aria-modal": "true",
|
|
462
462
|
"aria-labelledby": H,
|
|
463
463
|
tabIndex: -1,
|
|
464
|
-
onKeyDown: (
|
|
464
|
+
onKeyDown: (b) => {
|
|
465
465
|
var S, P, B;
|
|
466
|
-
if (
|
|
466
|
+
if (b.key === "Escape") {
|
|
467
467
|
if (u !== void 0) return;
|
|
468
|
-
|
|
469
|
-
} else if (
|
|
468
|
+
b.stopPropagation(), y ? C(!1) : t();
|
|
469
|
+
} else if (b.key === "Tab") {
|
|
470
470
|
const E = Array.from(((S = g.current) == null ? void 0 : S.querySelectorAll(Ae)) ?? []).filter(Le);
|
|
471
471
|
if (E.length === 0) return;
|
|
472
472
|
const W = E[0], F = E[E.length - 1];
|
|
473
|
-
|
|
474
|
-
} else u === void 0 && !De(
|
|
473
|
+
b.shiftKey && document.activeElement === W ? (b.preventDefault(), F.focus()) : !b.shiftKey && document.activeElement === F && (b.preventDefault(), W.focus());
|
|
474
|
+
} else u === void 0 && !De(b.target) && !b.ctrlKey && !b.metaKey && !b.altKey && (b.key === "ArrowLeft" ? (P = o == null ? void 0 : o.onPrevious) == null || P.call(o) : b.key === "ArrowRight" ? (B = o == null ? void 0 : o.onNext) == null || B.call(o) : b.key === "+" || b.key === "=" ? N == null || N("in") : b.key === "-" ? N == null || N("out") : b.key === "0" && (N == null || N("reset")));
|
|
475
475
|
},
|
|
476
476
|
children: [
|
|
477
477
|
o !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${n}, ${o.position}` }) : null,
|
|
478
478
|
/* @__PURE__ */ s("header", { className: "cms-viewer__top", children: [
|
|
479
|
-
/* @__PURE__ */ e("button", { ref: A, type: "button", className: "cms-viewer__icon", "aria-label":
|
|
479
|
+
/* @__PURE__ */ e("button", { ref: A, type: "button", className: "cms-viewer__icon", "aria-label": c, onClick: K, children: /* @__PURE__ */ e($, { name: "close" }) }),
|
|
480
480
|
/* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: a }),
|
|
481
481
|
/* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: H, title: n, children: n }),
|
|
482
482
|
o !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: o.position }) : null,
|
|
@@ -485,30 +485,30 @@ function ll(l) {
|
|
|
485
485
|
/* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: u.status }),
|
|
486
486
|
/* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: u.onDone, children: u.doneLabel })
|
|
487
487
|
] }) : /* @__PURE__ */ s(w, { children: [
|
|
488
|
-
/* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: h.map((
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
] },
|
|
488
|
+
/* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: h.map((b) => /* @__PURE__ */ s("button", { type: "button", className: "cms-viewer__button", onClick: b.onSelect, children: [
|
|
489
|
+
b.icon,
|
|
490
|
+
b.label
|
|
491
|
+
] }, b.label)) }),
|
|
492
492
|
r !== void 0 ? /* @__PURE__ */ s("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": r.label, onClick: r.onEdit, children: [
|
|
493
493
|
r.icon,
|
|
494
494
|
/* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: r.label })
|
|
495
495
|
] }) : null,
|
|
496
496
|
h.length > 0 ? /* @__PURE__ */ s("span", { className: "cms-viewer__more", children: [
|
|
497
|
-
/* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": d, "aria-expanded": y, onClick: () => C((
|
|
498
|
-
y ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: h.map((
|
|
497
|
+
/* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": d, "aria-expanded": y, onClick: () => C((b) => !b), children: /* @__PURE__ */ e(L, { name: "more" }) }),
|
|
498
|
+
y ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: h.map((b) => /* @__PURE__ */ s(
|
|
499
499
|
"button",
|
|
500
500
|
{
|
|
501
501
|
type: "button",
|
|
502
502
|
className: "cms-viewer__button",
|
|
503
503
|
onClick: () => {
|
|
504
|
-
C(!1),
|
|
504
|
+
C(!1), b.onSelect();
|
|
505
505
|
},
|
|
506
506
|
children: [
|
|
507
|
-
|
|
508
|
-
|
|
507
|
+
b.icon,
|
|
508
|
+
b.label
|
|
509
509
|
]
|
|
510
510
|
},
|
|
511
|
-
|
|
511
|
+
b.label
|
|
512
512
|
)) }) : null
|
|
513
513
|
] }) : null
|
|
514
514
|
] })
|
|
@@ -516,14 +516,14 @@ function ll(l) {
|
|
|
516
516
|
/* @__PURE__ */ s("div", { className: "cms-viewer__body", children: [
|
|
517
517
|
p != null && u === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: p }) : null,
|
|
518
518
|
/* @__PURE__ */ s("div", { className: "cms-viewer__content", onTouchStart: R, onTouchEnd: q, children: [
|
|
519
|
-
|
|
519
|
+
v,
|
|
520
520
|
u === void 0 && (o != null && o.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": o.previousLabel, onClick: o.onPrevious, children: /* @__PURE__ */ e($, { name: "back" }) }) : null,
|
|
521
521
|
u === void 0 && (o != null && o.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": o.nextLabel, onClick: o.onNext, children: /* @__PURE__ */ e($, { name: "back" }) }) : null,
|
|
522
|
-
u === void 0 && o !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(o.total, 7) }, (
|
|
522
|
+
u === void 0 && o !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(o.total, 7) }, (b, S) => /* @__PURE__ */ e("i", { className: S === Math.min(o.index, 6) ? "is-current" : void 0 }, S)) }) : null
|
|
523
523
|
] })
|
|
524
524
|
] }),
|
|
525
525
|
u === void 0 && m != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: m }) : null,
|
|
526
|
-
|
|
526
|
+
i != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: i }) : null
|
|
527
527
|
]
|
|
528
528
|
}
|
|
529
529
|
),
|
|
@@ -539,51 +539,51 @@ const Q = (l, n) => `${l}
|
|
|
539
539
|
${n}`, Te = (l, n) => l === "" ? n : `${l}/${n}`, Pe = 48;
|
|
540
540
|
function nl(l) {
|
|
541
541
|
var oe, de;
|
|
542
|
-
const { open: n, spaces: a, list:
|
|
542
|
+
const { open: n, spaces: a, list: c, disabledReason: t, budget: h, formatSize: d, labels: r, onConfirm: u, onCancel: o } = l, [i, p] = D(((oe = a[0]) == null ? void 0 : oe.id) ?? ""), [m, N] = D(""), [v, g] = D({ status: "loading" }), [A, H] = D(0), [y, C] = D(/* @__PURE__ */ new Map()), [x, K] = D(0), [R, q] = D(!1), b = T(null), S = V();
|
|
543
543
|
z(() => {
|
|
544
544
|
var f;
|
|
545
|
-
n && (p(((f = a[0]) == null ? void 0 : f.id) ?? ""),
|
|
545
|
+
n && (p(((f = a[0]) == null ? void 0 : f.id) ?? ""), N(""), C(/* @__PURE__ */ new Map()), q(!1));
|
|
546
546
|
}, [n]), z(() => {
|
|
547
|
-
if (!n ||
|
|
547
|
+
if (!n || i === "") return;
|
|
548
548
|
let f = !0;
|
|
549
|
-
return g({ status: "loading" }), K(0), i
|
|
550
|
-
(
|
|
551
|
-
(
|
|
549
|
+
return g({ status: "loading" }), K(0), c(i, m).then(
|
|
550
|
+
(_) => f && g({ status: "ready", entries: _.entries, next: _.next ?? null, paging: !1 }),
|
|
551
|
+
(_) => f && g({ status: _ instanceof $e ? "denied" : "error" })
|
|
552
552
|
), () => {
|
|
553
553
|
f = !1;
|
|
554
554
|
};
|
|
555
|
-
}, [n,
|
|
555
|
+
}, [n, i, m, c, A]);
|
|
556
556
|
const P = J(() => {
|
|
557
|
-
if (
|
|
558
|
-
const f =
|
|
559
|
-
g({ ...
|
|
560
|
-
(M) => g({ status: "ready", entries: [...
|
|
561
|
-
() => g({ status: "ready", entries:
|
|
557
|
+
if (v.status !== "ready" || v.next === null || v.paging) return;
|
|
558
|
+
const f = v.next, _ = v.entries;
|
|
559
|
+
g({ ...v, paging: !0 }), c(i, m, f).then(
|
|
560
|
+
(M) => g({ status: "ready", entries: [..._, ...M.entries], next: M.next ?? null, paging: !1 }),
|
|
561
|
+
() => g({ status: "ready", entries: _, next: f, paging: !1 })
|
|
562
562
|
);
|
|
563
|
-
}, [
|
|
564
|
-
var
|
|
565
|
-
return ((
|
|
566
|
-
}, [h]), E = Ne(() => [...y.values()], [y]), W = E.reduce((f,
|
|
563
|
+
}, [v, c, i, m]), B = J((f) => {
|
|
564
|
+
var _;
|
|
565
|
+
return ((_ = h == null ? void 0 : h.cost) == null ? void 0 : _.call(h, f)) ?? f.size ?? 0;
|
|
566
|
+
}, [h]), E = Ne(() => [...y.values()], [y]), W = E.reduce((f, _) => f + (_.size ?? 0), 0), F = h === void 0 ? null : h.limitBytes - h.usedBytes - E.reduce((f, _) => f + B(_), 0), O = F !== null && F < 0, ae = (f) => {
|
|
567
567
|
if (f.kind !== "file") return null;
|
|
568
|
-
const
|
|
569
|
-
return
|
|
568
|
+
const _ = t == null ? void 0 : t(f);
|
|
569
|
+
return _ || (F !== null && !y.has(Q(i, f.id)) && B(f) > F ? r.overBudget : null);
|
|
570
570
|
}, se = (f) => {
|
|
571
|
-
const
|
|
572
|
-
!y.has(
|
|
571
|
+
const _ = Q(i, f.id);
|
|
572
|
+
!y.has(_) && ae(f) !== null || C((M) => {
|
|
573
573
|
const I = new Map(M);
|
|
574
|
-
return I.has(
|
|
574
|
+
return I.has(_) ? I.delete(_) : I.set(_, { ...f, space: i, path: m }), I;
|
|
575
575
|
});
|
|
576
|
-
}, te = (f) =>
|
|
577
|
-
const M = new Map(
|
|
576
|
+
}, te = (f) => N(Te(m, f.name)), ce = () => N(m.includes("/") ? m.slice(0, m.lastIndexOf("/")) : ""), _e = (f) => C((_) => {
|
|
577
|
+
const M = new Map(_);
|
|
578
578
|
return M.delete(f), M;
|
|
579
|
-
}), j =
|
|
580
|
-
const
|
|
579
|
+
}), j = v.status === "ready" ? v.entries : [], be = (f) => {
|
|
580
|
+
const _ = j[x];
|
|
581
581
|
if (f.key === "ArrowDown" || f.key === "ArrowUp" || f.key === "Home" || f.key === "End") {
|
|
582
582
|
f.preventDefault();
|
|
583
583
|
const M = j.length - 1, I = f.key === "Home" ? 0 : f.key === "End" ? M : Math.min(M, Math.max(0, x + (f.key === "ArrowDown" ? 1 : -1)));
|
|
584
584
|
K(I), I >= M - 1 && P();
|
|
585
|
-
} else f.key === "Enter" && (
|
|
586
|
-
}, ie = m === "" ? [] : m.split("/"), ve = ((de = a.find((f) => f.id ===
|
|
585
|
+
} else f.key === "Enter" && (_ == null ? void 0 : _.kind) === "folder" ? (f.preventDefault(), te(_)) : f.key === " " && (_ == null ? void 0 : _.kind) === "file" ? (f.preventDefault(), se(_)) : f.key === "Backspace" && m !== "" && (f.preventDefault(), ce());
|
|
586
|
+
}, ie = m === "" ? [] : m.split("/"), ve = ((de = a.find((f) => f.id === i)) == null ? void 0 : de.name) ?? "", re = (f) => `${S}-entry-${String(f)}`;
|
|
587
587
|
return /* @__PURE__ */ s(
|
|
588
588
|
fe,
|
|
589
589
|
{
|
|
@@ -591,7 +591,7 @@ function nl(l) {
|
|
|
591
591
|
title: r.title,
|
|
592
592
|
onClose: o,
|
|
593
593
|
closeLabel: r.close,
|
|
594
|
-
initialFocus:
|
|
594
|
+
initialFocus: b,
|
|
595
595
|
className: "cms-file-picker",
|
|
596
596
|
footer: /* @__PURE__ */ s("div", { className: "cms-file-picker__foot", children: [
|
|
597
597
|
/* @__PURE__ */ s("div", { className: "cms-file-picker__summary", "aria-live": "polite", children: [
|
|
@@ -607,64 +607,64 @@ function nl(l) {
|
|
|
607
607
|
/* @__PURE__ */ s("div", { className: "cms-file-picker__top", children: [
|
|
608
608
|
a.length > 1 ? /* @__PURE__ */ s("label", { className: "cms-file-picker__space", children: [
|
|
609
609
|
/* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: r.space }),
|
|
610
|
-
/* @__PURE__ */ e("select", { className: "cms-input cms-select", value:
|
|
611
|
-
p(f.target.value),
|
|
610
|
+
/* @__PURE__ */ e("select", { className: "cms-input cms-select", value: i, onChange: (f) => {
|
|
611
|
+
p(f.target.value), N("");
|
|
612
612
|
}, children: a.map((f) => /* @__PURE__ */ e("option", { value: f.id, children: f.name }, f.id)) })
|
|
613
613
|
] }) : null,
|
|
614
614
|
/* @__PURE__ */ s("nav", { className: "cms-file-picker__path", "aria-label": r.path, children: [
|
|
615
615
|
/* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": r.up, disabled: m === "", onClick: ce, children: /* @__PURE__ */ e(L, { name: "chevron-left" }) }),
|
|
616
616
|
/* @__PURE__ */ s("ol", { children: [
|
|
617
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": m === "" ? "location" : void 0, onClick: () =>
|
|
618
|
-
ie.map((f,
|
|
619
|
-
const M = ie.slice(0,
|
|
620
|
-
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": M === m ? "location" : void 0, onClick: () =>
|
|
617
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": m === "" ? "location" : void 0, onClick: () => N(""), children: ve }) }),
|
|
618
|
+
ie.map((f, _) => {
|
|
619
|
+
const M = ie.slice(0, _ + 1).join("/");
|
|
620
|
+
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": M === m ? "location" : void 0, onClick: () => N(M), children: f }) }, M);
|
|
621
621
|
})
|
|
622
622
|
] })
|
|
623
623
|
] }),
|
|
624
624
|
E.length > 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__chip", "aria-expanded": R, onClick: () => q((f) => !f), children: r.selected(E.length) }) : null
|
|
625
625
|
] }),
|
|
626
626
|
R && E.length > 0 ? /* @__PURE__ */ s("div", { className: "cms-file-picker__chosen", children: [
|
|
627
|
-
/* @__PURE__ */ e("ul", { children: [...y.entries()].map(([f,
|
|
628
|
-
/* @__PURE__ */ e("span", { className: "cms-file-picker__name", children:
|
|
629
|
-
/* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": r.remove(
|
|
627
|
+
/* @__PURE__ */ e("ul", { children: [...y.entries()].map(([f, _]) => /* @__PURE__ */ s("li", { children: [
|
|
628
|
+
/* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: _.name }),
|
|
629
|
+
/* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": r.remove(_.name), onClick: () => _e(f), children: /* @__PURE__ */ e($, { name: "close" }) })
|
|
630
630
|
] }, f)) }),
|
|
631
631
|
/* @__PURE__ */ e(Z, { variant: "secondary", onClick: () => {
|
|
632
632
|
C(/* @__PURE__ */ new Map()), q(!1);
|
|
633
633
|
}, children: r.clear })
|
|
634
634
|
] }) : null,
|
|
635
635
|
/* @__PURE__ */ s("div", { className: "cms-file-picker__list", onScroll: (f) => {
|
|
636
|
-
const
|
|
637
|
-
|
|
636
|
+
const _ = f.currentTarget;
|
|
637
|
+
_.scrollTop + _.clientHeight >= _.scrollHeight - Pe && P();
|
|
638
638
|
}, children: [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
639
|
+
v.status === "loading" ? /* @__PURE__ */ e(X, { kind: "loading", title: r.loading, placement: "block" }) : null,
|
|
640
|
+
v.status === "error" ? /* @__PURE__ */ e(X, { kind: "error", title: r.error, placement: "block", action: { label: r.retry, onAction: () => H((f) => f + 1) } }) : null,
|
|
641
|
+
v.status === "denied" ? /* @__PURE__ */ e(X, { kind: "denied", title: r.denied, placement: "block" }) : null,
|
|
642
|
+
v.status === "ready" && j.length === 0 ? /* @__PURE__ */ e(X, { kind: "empty", title: r.empty, placement: "block" }) : null,
|
|
643
643
|
/* @__PURE__ */ s(
|
|
644
644
|
"div",
|
|
645
645
|
{
|
|
646
|
-
ref:
|
|
646
|
+
ref: b,
|
|
647
647
|
role: "listbox",
|
|
648
648
|
"aria-multiselectable": "true",
|
|
649
649
|
"aria-label": r.files,
|
|
650
650
|
"aria-activedescendant": j.length > 0 ? re(x) : void 0,
|
|
651
651
|
tabIndex: 0,
|
|
652
652
|
className: "cms-file-picker__entries",
|
|
653
|
-
hidden:
|
|
653
|
+
hidden: v.status !== "ready" || j.length === 0,
|
|
654
654
|
onKeyDown: be,
|
|
655
655
|
children: [
|
|
656
|
-
j.map((f,
|
|
657
|
-
const M = f.kind === "file" && y.has(Q(
|
|
656
|
+
j.map((f, _) => {
|
|
657
|
+
const M = f.kind === "file" && y.has(Q(i, f.id)), I = ae(f);
|
|
658
658
|
return /* @__PURE__ */ s(
|
|
659
659
|
"div",
|
|
660
660
|
{
|
|
661
|
-
id: re(
|
|
661
|
+
id: re(_),
|
|
662
662
|
role: "option",
|
|
663
663
|
"aria-selected": f.kind === "file" ? M : void 0,
|
|
664
664
|
"aria-disabled": I !== null || void 0,
|
|
665
|
-
className: k("cms-file-picker__entry",
|
|
665
|
+
className: k("cms-file-picker__entry", _ === x && "is-active", M && "is-ticked", I !== null && "is-disabled"),
|
|
666
666
|
onClick: () => {
|
|
667
|
-
K(
|
|
667
|
+
K(_), f.kind === "folder" ? te(f) : se(f);
|
|
668
668
|
},
|
|
669
669
|
children: [
|
|
670
670
|
/* @__PURE__ */ e("span", { className: "cms-file-picker__tick", "aria-hidden": "true", children: M ? /* @__PURE__ */ e(L, { name: "check" }) : null }),
|
|
@@ -679,7 +679,7 @@ function nl(l) {
|
|
|
679
679
|
f.id
|
|
680
680
|
);
|
|
681
681
|
}),
|
|
682
|
-
|
|
682
|
+
v.status === "ready" && v.paging ? /* @__PURE__ */ e("div", { className: "cms-file-picker__paging", children: /* @__PURE__ */ e(X, { kind: "loading", title: r.loading, placement: "inline" }) }) : null
|
|
683
683
|
]
|
|
684
684
|
}
|
|
685
685
|
)
|
|
@@ -688,20 +688,20 @@ function nl(l) {
|
|
|
688
688
|
}
|
|
689
689
|
);
|
|
690
690
|
}
|
|
691
|
-
function al({ title: l, scope: n, actions: a, backLink:
|
|
691
|
+
function al({ title: l, scope: n, actions: a, backLink: c }) {
|
|
692
692
|
return /* @__PURE__ */ s("header", { className: "cms-page-header", children: [
|
|
693
|
-
|
|
693
|
+
c ? /* @__PURE__ */ s(
|
|
694
694
|
"a",
|
|
695
695
|
{
|
|
696
696
|
className: "cms-page-header__back",
|
|
697
|
-
href:
|
|
697
|
+
href: c.href ?? "#",
|
|
698
698
|
onClick: (t) => {
|
|
699
|
-
|
|
699
|
+
c.onBack && (t.preventDefault(), c.onBack());
|
|
700
700
|
},
|
|
701
701
|
children: [
|
|
702
702
|
/* @__PURE__ */ e($, { name: "back" }),
|
|
703
703
|
" ",
|
|
704
|
-
|
|
704
|
+
c.label
|
|
705
705
|
]
|
|
706
706
|
}
|
|
707
707
|
) : null,
|
|
@@ -714,16 +714,16 @@ function al({ title: l, scope: n, actions: a, backLink: i }) {
|
|
|
714
714
|
] })
|
|
715
715
|
] });
|
|
716
716
|
}
|
|
717
|
-
function sl({ tabs: l, active: n, onSelect: a, label:
|
|
717
|
+
function sl({ tabs: l, active: n, onSelect: a, label: c }) {
|
|
718
718
|
const t = T([]), h = (d, r) => {
|
|
719
719
|
var p;
|
|
720
720
|
const u = l.length - 1, o = d.key === "ArrowRight" ? r === u ? 0 : r + 1 : d.key === "ArrowLeft" ? r === 0 ? u : r - 1 : d.key === "Home" ? 0 : d.key === "End" ? u : null;
|
|
721
721
|
if (o === null) return;
|
|
722
722
|
d.preventDefault();
|
|
723
|
-
const
|
|
724
|
-
|
|
723
|
+
const i = l[o];
|
|
724
|
+
i && (a(i.id), (p = t.current[o]) == null || p.focus());
|
|
725
725
|
};
|
|
726
|
-
return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label":
|
|
726
|
+
return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((d, r) => {
|
|
727
727
|
const u = d.id === n;
|
|
728
728
|
return /* @__PURE__ */ s(
|
|
729
729
|
"button",
|
|
@@ -748,9 +748,9 @@ function sl({ tabs: l, active: n, onSelect: a, label: i }) {
|
|
|
748
748
|
}) });
|
|
749
749
|
}
|
|
750
750
|
function Be(l) {
|
|
751
|
-
var
|
|
751
|
+
var c;
|
|
752
752
|
const n = l.trim().split(/\s+/).filter(Boolean);
|
|
753
|
-
return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(
|
|
753
|
+
return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
|
|
754
754
|
}
|
|
755
755
|
function Ie(l) {
|
|
756
756
|
let n = 0;
|
|
@@ -758,12 +758,12 @@ function Ie(l) {
|
|
|
758
758
|
n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
|
|
759
759
|
return n % 6 + 1;
|
|
760
760
|
}
|
|
761
|
-
function G({ name: l, pictureUrl: n, presence: a, size:
|
|
761
|
+
function G({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
|
|
762
762
|
return /* @__PURE__ */ s(
|
|
763
763
|
"span",
|
|
764
764
|
{
|
|
765
765
|
className: `cms-avatar cms-avatar--tint-${Ie(l)}`,
|
|
766
|
-
style: { width:
|
|
766
|
+
style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
|
|
767
767
|
role: "img",
|
|
768
768
|
"aria-label": a ? `${l}, ${a}` : l,
|
|
769
769
|
children: [
|
|
@@ -779,31 +779,31 @@ function Ke({ count: l, label: n, max: a = 99 }) {
|
|
|
779
779
|
/* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
|
|
780
780
|
] });
|
|
781
781
|
}
|
|
782
|
-
function tl({ product: l, mark: n, rail: a, active:
|
|
782
|
+
function tl({ product: l, mark: n, rail: a, active: c, onNavigate: t, server: h, search: d, account: r, children: u, railLabel: o = "Sections" }) {
|
|
783
783
|
return /* @__PURE__ */ s("div", { className: "cms-shell", children: [
|
|
784
784
|
/* @__PURE__ */ s("nav", { className: "cms-shell__rail", "aria-label": o, children: [
|
|
785
785
|
/* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
|
|
786
|
-
/* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((
|
|
787
|
-
const p =
|
|
786
|
+
/* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((i) => {
|
|
787
|
+
const p = i.id === c;
|
|
788
788
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
|
|
789
789
|
"a",
|
|
790
790
|
{
|
|
791
|
-
href:
|
|
791
|
+
href: i.href,
|
|
792
792
|
className: k("cms-shell__item", p && "is-active"),
|
|
793
793
|
"aria-current": p ? "page" : void 0,
|
|
794
|
-
title:
|
|
794
|
+
title: i.label,
|
|
795
795
|
onClick: (m) => {
|
|
796
|
-
t && (m.preventDefault(), t(
|
|
796
|
+
t && (m.preventDefault(), t(i.id));
|
|
797
797
|
},
|
|
798
798
|
children: [
|
|
799
799
|
/* @__PURE__ */ s("span", { className: "cms-shell__icon", children: [
|
|
800
|
-
/* @__PURE__ */ e(L, { name:
|
|
801
|
-
|
|
800
|
+
/* @__PURE__ */ e(L, { name: i.icon, size: 22 }),
|
|
801
|
+
i.badge ? /* @__PURE__ */ e(Ke, { count: i.badge.count, label: i.badge.label }) : null
|
|
802
802
|
] }),
|
|
803
|
-
/* @__PURE__ */ e("span", { className: "cms-shell__label", children:
|
|
803
|
+
/* @__PURE__ */ e("span", { className: "cms-shell__label", children: i.label })
|
|
804
804
|
]
|
|
805
805
|
}
|
|
806
|
-
) },
|
|
806
|
+
) }, i.id);
|
|
807
807
|
}) })
|
|
808
808
|
] }),
|
|
809
809
|
/* @__PURE__ */ s("header", { className: "cms-shell__top", children: [
|
|
@@ -815,7 +815,7 @@ function tl({ product: l, mark: n, rail: a, active: i, onNavigate: t, server: h,
|
|
|
815
815
|
/* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
|
|
816
816
|
] });
|
|
817
817
|
}
|
|
818
|
-
function cl({ label: l, placeholder: n, value: a, onChange:
|
|
818
|
+
function cl({ label: l, placeholder: n, value: a, onChange: c, onSearch: t }) {
|
|
819
819
|
return /* @__PURE__ */ s(
|
|
820
820
|
"form",
|
|
821
821
|
{
|
|
@@ -834,23 +834,23 @@ function cl({ label: l, placeholder: n, value: a, onChange: i, onSearch: t }) {
|
|
|
834
834
|
"aria-label": l,
|
|
835
835
|
placeholder: n,
|
|
836
836
|
value: a,
|
|
837
|
-
onChange: (h) =>
|
|
837
|
+
onChange: (h) => c(h.target.value)
|
|
838
838
|
}
|
|
839
839
|
)
|
|
840
840
|
]
|
|
841
841
|
}
|
|
842
842
|
);
|
|
843
843
|
}
|
|
844
|
-
function il({ options: l, value: n, onChange: a, label:
|
|
844
|
+
function il({ options: l, value: n, onChange: a, label: c }) {
|
|
845
845
|
const t = T([]), h = (d, r) => {
|
|
846
846
|
var p;
|
|
847
847
|
const u = l.length - 1, o = d.key === "ArrowRight" || d.key === "ArrowDown" ? r === u ? 0 : r + 1 : d.key === "ArrowLeft" || d.key === "ArrowUp" ? r === 0 ? u : r - 1 : null;
|
|
848
848
|
if (o === null) return;
|
|
849
849
|
d.preventDefault();
|
|
850
|
-
const
|
|
851
|
-
|
|
850
|
+
const i = l[o];
|
|
851
|
+
i && (a(i.id), (p = t.current[o]) == null || p.focus());
|
|
852
852
|
};
|
|
853
|
-
return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label":
|
|
853
|
+
return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((d, r) => {
|
|
854
854
|
const u = d.id === n;
|
|
855
855
|
return /* @__PURE__ */ s(
|
|
856
856
|
"button",
|
|
@@ -875,9 +875,9 @@ function il({ options: l, value: n, onChange: a, label: i }) {
|
|
|
875
875
|
}) });
|
|
876
876
|
}
|
|
877
877
|
function rl({ panes: l, active: n, back: a }) {
|
|
878
|
-
const
|
|
879
|
-
return /* @__PURE__ */ e("div", { className: k("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active":
|
|
880
|
-
h ===
|
|
878
|
+
const c = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
|
|
879
|
+
return /* @__PURE__ */ e("div", { className: k("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((t, h) => /* @__PURE__ */ s("section", { className: "cms-panes__pane", "aria-label": t.label, "data-offset": c - h, children: [
|
|
880
|
+
h === c && a ? /* @__PURE__ */ s("a", { className: "cms-panes__back", href: a.href, children: [
|
|
881
881
|
/* @__PURE__ */ e(L, { name: "chevron-left", size: 18 }),
|
|
882
882
|
a.label
|
|
883
883
|
] }) : null,
|
|
@@ -885,7 +885,7 @@ function rl({ panes: l, active: n, back: a }) {
|
|
|
885
885
|
] }, t.label)) });
|
|
886
886
|
}
|
|
887
887
|
const Fe = { attachment: "Has an attachment", unread: "Unread" };
|
|
888
|
-
function ol({ from: l, subject: n, preview: a, time:
|
|
888
|
+
function ol({ from: l, subject: n, preview: a, time: c, unread: t, hasAttachment: h, selected: d, onOpen: r, labels: u }) {
|
|
889
889
|
const o = Y(Fe, u);
|
|
890
890
|
return /* @__PURE__ */ s(
|
|
891
891
|
"button",
|
|
@@ -900,7 +900,7 @@ function ol({ from: l, subject: n, preview: a, time: i, unread: t, hasAttachment
|
|
|
900
900
|
/* @__PURE__ */ s("span", { className: "cms-mail-row__line", children: [
|
|
901
901
|
/* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
|
|
902
902
|
h ? /* @__PURE__ */ e(L, { name: "paperclip", size: 16, label: o.attachment }) : null,
|
|
903
|
-
/* @__PURE__ */ e("span", { className: "cms-mail-row__time", children:
|
|
903
|
+
/* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: c })
|
|
904
904
|
] }),
|
|
905
905
|
/* @__PURE__ */ s("span", { className: "cms-mail-row__line", children: [
|
|
906
906
|
/* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
|
|
@@ -912,41 +912,42 @@ function ol({ from: l, subject: n, preview: a, time: i, unread: t, hasAttachment
|
|
|
912
912
|
}
|
|
913
913
|
);
|
|
914
914
|
}
|
|
915
|
-
function dl({ direction: l, children: n, time: a, read:
|
|
915
|
+
function dl({ direction: l, children: n, time: a, read: c, readLabel: t = "Read" }) {
|
|
916
916
|
return /* @__PURE__ */ s("div", { className: k("cms-bubble", `cms-bubble--${l}`), children: [
|
|
917
917
|
/* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
|
|
918
918
|
/* @__PURE__ */ s("div", { className: "cms-bubble__meta", children: [
|
|
919
919
|
a,
|
|
920
|
-
l === "out" &&
|
|
920
|
+
l === "out" && c ? /* @__PURE__ */ s(w, { children: [
|
|
921
921
|
" · ",
|
|
922
922
|
t
|
|
923
923
|
] }) : null
|
|
924
924
|
] })
|
|
925
925
|
] });
|
|
926
926
|
}
|
|
927
|
-
function ml({ label: l, value: n, onChange: a, onSend:
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
},
|
|
931
|
-
return /* @__PURE__ */ s("form", { className: k("cms-composer", `cms-composer--${d}`), onSubmit:
|
|
932
|
-
/* @__PURE__ */ e("label", { htmlFor:
|
|
933
|
-
d === "chat" ?
|
|
927
|
+
function ml({ label: l, value: n, onChange: a, onSend: c, onAttach: t, placeholder: h, variant: d = "chat", sendLabel: r = "Send", attachLabel: u = "Attach a file", leading: o, canSend: i }) {
|
|
928
|
+
const p = V(), m = i ?? n.trim() !== "", N = (g) => {
|
|
929
|
+
g.preventDefault(), m && c();
|
|
930
|
+
}, v = t ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": u, onClick: t, children: /* @__PURE__ */ e(L, { name: "paperclip" }) }) : null;
|
|
931
|
+
return /* @__PURE__ */ s("form", { className: k("cms-composer", `cms-composer--${d}`), onSubmit: N, children: [
|
|
932
|
+
/* @__PURE__ */ e("label", { htmlFor: p, className: d === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
|
|
933
|
+
d === "chat" ? v : null,
|
|
934
934
|
/* @__PURE__ */ e(
|
|
935
935
|
"textarea",
|
|
936
936
|
{
|
|
937
|
-
id:
|
|
937
|
+
id: p,
|
|
938
938
|
className: "cms-composer__input",
|
|
939
939
|
rows: d === "reply" ? 3 : 1,
|
|
940
940
|
placeholder: h,
|
|
941
941
|
value: n,
|
|
942
|
-
onChange: (
|
|
943
|
-
onKeyDown: (
|
|
944
|
-
|
|
942
|
+
onChange: (g) => a(g.target.value),
|
|
943
|
+
onKeyDown: (g) => {
|
|
944
|
+
g.nativeEvent.isComposing || g.keyCode === 229 || d === "chat" && g.key === "Enter" && !g.shiftKey && (g.preventDefault(), m && c());
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
),
|
|
948
|
-
d === "reply" ?
|
|
949
|
-
d === "
|
|
948
|
+
d === "reply" && o !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: o }) : null,
|
|
949
|
+
d === "reply" ? v : null,
|
|
950
|
+
d === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": r, disabled: !m, children: /* @__PURE__ */ e(L, { name: "send" }) }) : /* @__PURE__ */ s("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !m, children: [
|
|
950
951
|
r,
|
|
951
952
|
" ",
|
|
952
953
|
/* @__PURE__ */ e(L, { name: "send", size: 18 })
|
|
@@ -974,24 +975,24 @@ const ne = {
|
|
|
974
975
|
onCallWith: (l) => `On a call with ${l}`,
|
|
975
976
|
returnToCall: "Return to call"
|
|
976
977
|
};
|
|
977
|
-
function ul({ name: l, media: n, onAccept: a, onDecline:
|
|
978
|
+
function ul({ name: l, media: n, onAccept: a, onDecline: c, labels: t }) {
|
|
978
979
|
const h = Y(ne, t), d = n === "video" ? h.incomingVideo : h.incomingAudio;
|
|
979
980
|
return /* @__PURE__ */ s("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": h.incomingFrom(d, l), children: [
|
|
980
981
|
/* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(G, { name: l, size: 112 }) }),
|
|
981
982
|
/* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
|
|
982
983
|
/* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: d }),
|
|
983
984
|
/* @__PURE__ */ s("div", { className: "cms-call-incoming__actions", children: [
|
|
984
|
-
/* @__PURE__ */ e(U, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick:
|
|
985
|
+
/* @__PURE__ */ e(U, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick: c }),
|
|
985
986
|
/* @__PURE__ */ e(U, { icon: "phone", label: h.accept, tone: "accept", onClick: a })
|
|
986
987
|
] })
|
|
987
988
|
] });
|
|
988
989
|
}
|
|
989
|
-
function U({ icon: l, label: n, onClick: a, tone:
|
|
990
|
+
function U({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: t }) {
|
|
990
991
|
return /* @__PURE__ */ s(
|
|
991
992
|
"button",
|
|
992
993
|
{
|
|
993
994
|
type: "button",
|
|
994
|
-
className: k("cms-call-button", `cms-call-button--${
|
|
995
|
+
className: k("cms-call-button", `cms-call-button--${c}`, t && "is-pressed"),
|
|
995
996
|
"aria-pressed": t,
|
|
996
997
|
onClick: a,
|
|
997
998
|
children: [
|
|
@@ -1001,7 +1002,7 @@ function U({ icon: l, label: n, onClick: a, tone: i = "plain", pressed: t }) {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
);
|
|
1003
1004
|
}
|
|
1004
|
-
function hl({ name: l, duration: n, connection: a, you:
|
|
1005
|
+
function hl({ name: l, duration: n, connection: a, you: c, muted: t, speaker: h, onToggleMute: d, onToggleSpeaker: r, onAddPerson: u, onChat: o, onHangUp: i, labels: p }) {
|
|
1005
1006
|
const m = Y(ne, p);
|
|
1006
1007
|
return /* @__PURE__ */ s("section", { className: "cms-call-panel", "aria-label": m.callWith(l), children: [
|
|
1007
1008
|
/* @__PURE__ */ s("div", { className: "cms-call-panel__head", children: [
|
|
@@ -1013,33 +1014,33 @@ function hl({ name: l, duration: n, connection: a, you: i, muted: t, speaker: h,
|
|
|
1013
1014
|
/* @__PURE__ */ e("span", { className: k("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? m.goodConnection : m.poorConnection })
|
|
1014
1015
|
] }),
|
|
1015
1016
|
/* @__PURE__ */ s("div", { className: "cms-call-panel__you", children: [
|
|
1016
|
-
/* @__PURE__ */ e(G, { name:
|
|
1017
|
+
/* @__PURE__ */ e(G, { name: c.name, size: 36 }),
|
|
1017
1018
|
/* @__PURE__ */ e("span", { children: m.you }),
|
|
1018
|
-
|
|
1019
|
+
c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": m.speaking }) : null
|
|
1019
1020
|
] }),
|
|
1020
1021
|
/* @__PURE__ */ s("div", { className: "cms-call-panel__controls", children: [
|
|
1021
1022
|
/* @__PURE__ */ e(U, { icon: "mic", label: t ? m.unmute : m.mute, pressed: t, onClick: d }),
|
|
1022
1023
|
/* @__PURE__ */ e(U, { icon: "speaker", label: m.speaker, pressed: h, onClick: r }),
|
|
1023
1024
|
u ? /* @__PURE__ */ e(U, { icon: "user-plus", label: m.addPerson, onClick: u }) : null,
|
|
1024
1025
|
o ? /* @__PURE__ */ e(U, { icon: "chat", label: m.chat, onClick: o }) : null,
|
|
1025
|
-
/* @__PURE__ */ e(U, { icon: "phone-off", label: m.hangUp, tone: "hang-up", onClick:
|
|
1026
|
+
/* @__PURE__ */ e(U, { icon: "phone-off", label: m.hangUp, tone: "hang-up", onClick: i })
|
|
1026
1027
|
] })
|
|
1027
1028
|
] });
|
|
1028
1029
|
}
|
|
1029
|
-
function fl({ name: l, duration: n, muted: a, onToggleMute:
|
|
1030
|
+
function fl({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: t, onHangUp: h, labels: d }) {
|
|
1030
1031
|
const r = Y(ne, d);
|
|
1031
1032
|
return /* @__PURE__ */ s("section", { className: "cms-call-bar", "aria-label": r.callWith(l), children: [
|
|
1032
1033
|
/* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
|
|
1033
1034
|
/* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: r.onCallWith(l) }),
|
|
1034
1035
|
/* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
|
|
1035
1036
|
/* @__PURE__ */ s("span", { className: "cms-call-bar__actions", children: [
|
|
1036
|
-
/* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? r.unmute : r.mute, "aria-pressed": a, onClick:
|
|
1037
|
+
/* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? r.unmute : r.mute, "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(L, { name: "mic" }) }),
|
|
1037
1038
|
/* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: t, children: r.returnToCall }),
|
|
1038
1039
|
/* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": r.hangUp, onClick: h, children: /* @__PURE__ */ e(L, { name: "phone-off" }) })
|
|
1039
1040
|
] })
|
|
1040
1041
|
] });
|
|
1041
1042
|
}
|
|
1042
|
-
function pl({ mark: l, product: n, headline: a, lead:
|
|
1043
|
+
function pl({ mark: l, product: n, headline: a, lead: c, features: t = [], children: h }) {
|
|
1043
1044
|
return /* @__PURE__ */ s("div", { className: "cms-signin", children: [
|
|
1044
1045
|
/* @__PURE__ */ s("aside", { className: "cms-signin__brand", children: [
|
|
1045
1046
|
/* @__PURE__ */ s("p", { className: "cms-signin__logo", children: [
|
|
@@ -1048,7 +1049,7 @@ function pl({ mark: l, product: n, headline: a, lead: i, features: t = [], child
|
|
|
1048
1049
|
] }),
|
|
1049
1050
|
/* @__PURE__ */ s("div", { className: "cms-signin__pitch", children: [
|
|
1050
1051
|
/* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
|
|
1051
|
-
/* @__PURE__ */ e("p", { className: "cms-signin__lead", children:
|
|
1052
|
+
/* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
|
|
1052
1053
|
t.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: t.map((d) => /* @__PURE__ */ s("li", { children: [
|
|
1053
1054
|
/* @__PURE__ */ e(L, { name: d.icon, size: 18 }),
|
|
1054
1055
|
d.label
|
|
@@ -1070,8 +1071,8 @@ const He = {
|
|
|
1070
1071
|
newHere: "New here?",
|
|
1071
1072
|
create: "Create an account"
|
|
1072
1073
|
};
|
|
1073
|
-
function _l({ server: l, onSubmit: n, forgotHref: a, createHref:
|
|
1074
|
-
const r = Y(He, d), u = V(), [o,
|
|
1074
|
+
function _l({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: t, busy: h, labels: d }) {
|
|
1075
|
+
const r = Y(He, d), u = V(), [o, i] = D(""), [p, m] = D(""), [N, v] = D(!1);
|
|
1075
1076
|
return /* @__PURE__ */ s("form", { className: "cms-signin-form", onSubmit: (A) => {
|
|
1076
1077
|
A.preventDefault(), n(o, p);
|
|
1077
1078
|
}, "aria-describedby": t ? `${u}-error` : void 0, children: [
|
|
@@ -1090,7 +1091,7 @@ function _l({ server: l, onSubmit: n, forgotHref: a, createHref: i, error: t, bu
|
|
|
1090
1091
|
autoComplete: "username",
|
|
1091
1092
|
placeholder: r.identifierPlaceholder,
|
|
1092
1093
|
value: o,
|
|
1093
|
-
onChange: (A) =>
|
|
1094
|
+
onChange: (A) => i(A.target.value),
|
|
1094
1095
|
required: !0
|
|
1095
1096
|
}
|
|
1096
1097
|
),
|
|
@@ -1101,55 +1102,55 @@ function _l({ server: l, onSubmit: n, forgotHref: a, createHref: i, error: t, bu
|
|
|
1101
1102
|
{
|
|
1102
1103
|
id: `${u}-password`,
|
|
1103
1104
|
className: "cms-signin-form__input",
|
|
1104
|
-
type:
|
|
1105
|
+
type: N ? "text" : "password",
|
|
1105
1106
|
autoComplete: "current-password",
|
|
1106
1107
|
value: p,
|
|
1107
1108
|
onChange: (A) => m(A.target.value),
|
|
1108
1109
|
required: !0
|
|
1109
1110
|
}
|
|
1110
1111
|
),
|
|
1111
|
-
/* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed":
|
|
1112
|
+
/* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": N, onClick: () => v((A) => !A), children: N ? r.hide : r.show })
|
|
1112
1113
|
] }),
|
|
1113
1114
|
a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: r.forgot }) : null,
|
|
1114
1115
|
t ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: t }) : null,
|
|
1115
1116
|
/* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: h, "aria-busy": h || void 0, children: r.submit }),
|
|
1116
|
-
|
|
1117
|
+
c ? /* @__PURE__ */ s(w, { children: [
|
|
1117
1118
|
/* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: r.newHere }) }),
|
|
1118
|
-
/* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href:
|
|
1119
|
+
/* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: r.create })
|
|
1119
1120
|
] }) : null
|
|
1120
1121
|
] });
|
|
1121
1122
|
}
|
|
1122
|
-
function bl({ label: l, rows: n, error: a, onRetry:
|
|
1123
|
-
const
|
|
1124
|
-
if (a != null) return /* @__PURE__ */ e(xe, { message: a, onRetry:
|
|
1123
|
+
function bl({ label: l, rows: n, error: a, onRetry: c, loadingText: t = "Loading", emptyTitle: h = "Nothing here yet", emptyHint: d, selected: r, onOpen: u, onRowMenu: o }) {
|
|
1124
|
+
const i = T([]);
|
|
1125
|
+
if (a != null) return /* @__PURE__ */ e(xe, { message: a, onRetry: c });
|
|
1125
1126
|
if (n === null) return /* @__PURE__ */ e(we, { what: t, layout: "block" });
|
|
1126
1127
|
if (n.length === 0) return /* @__PURE__ */ e(ke, { title: h, hint: d });
|
|
1127
|
-
const p = (m,
|
|
1128
|
+
const p = (m, N, v) => {
|
|
1128
1129
|
var g;
|
|
1129
1130
|
if (m.key === "ArrowDown" || m.key === "ArrowUp")
|
|
1130
|
-
m.preventDefault(), (g =
|
|
1131
|
+
m.preventDefault(), (g = i.current[Math.min(n.length - 1, Math.max(0, N + (m.key === "ArrowDown" ? 1 : -1)))]) == null || g.focus();
|
|
1131
1132
|
else if (m.key === "Enter")
|
|
1132
|
-
u == null || u(
|
|
1133
|
+
u == null || u(v);
|
|
1133
1134
|
else if ((m.key === "ContextMenu" || m.shiftKey && m.key === "F10") && o) {
|
|
1134
1135
|
m.preventDefault();
|
|
1135
1136
|
const A = m.currentTarget.getBoundingClientRect();
|
|
1136
|
-
o(
|
|
1137
|
+
o(v, { x: A.left + 16, y: A.bottom });
|
|
1137
1138
|
}
|
|
1138
1139
|
};
|
|
1139
|
-
return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((m,
|
|
1140
|
-
const
|
|
1140
|
+
return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((m, N) => {
|
|
1141
|
+
const v = m.id === r;
|
|
1141
1142
|
return /* @__PURE__ */ s(
|
|
1142
1143
|
"li",
|
|
1143
1144
|
{
|
|
1144
1145
|
ref: (g) => {
|
|
1145
|
-
|
|
1146
|
+
i.current[N] = g;
|
|
1146
1147
|
},
|
|
1147
1148
|
role: "option",
|
|
1148
|
-
"aria-selected":
|
|
1149
|
-
tabIndex:
|
|
1150
|
-
className: k("cms-list__row",
|
|
1149
|
+
"aria-selected": v,
|
|
1150
|
+
tabIndex: v || r == null && N === 0 ? 0 : -1,
|
|
1151
|
+
className: k("cms-list__row", v && "is-selected"),
|
|
1151
1152
|
onClick: () => u == null ? void 0 : u(m.id),
|
|
1152
|
-
onKeyDown: (g) => p(g,
|
|
1153
|
+
onKeyDown: (g) => p(g, N, m.id),
|
|
1153
1154
|
onContextMenu: o ? (g) => {
|
|
1154
1155
|
g.preventDefault(), o(m.id, { x: g.clientX, y: g.clientY });
|
|
1155
1156
|
} : void 0,
|
|
@@ -1166,34 +1167,34 @@ function bl({ label: l, rows: n, error: a, onRetry: i, loadingText: t = "Loading
|
|
|
1166
1167
|
);
|
|
1167
1168
|
}) });
|
|
1168
1169
|
}
|
|
1169
|
-
function vl({ at: l, items: n, onClose: a, label:
|
|
1170
|
-
const t = T(null), h = T(null), [d, r] = D(l), u = n.filter((
|
|
1170
|
+
function vl({ at: l, items: n, onClose: a, label: c = "Actions" }) {
|
|
1171
|
+
const t = T(null), h = T(null), [d, r] = D(l), u = n.filter((i) => i.offer.offered);
|
|
1171
1172
|
if (ge(() => {
|
|
1172
1173
|
if (!l) return;
|
|
1173
|
-
const
|
|
1174
|
+
const i = t.current, p = (i == null ? void 0 : i.offsetWidth) ?? 0, m = (i == null ? void 0 : i.offsetHeight) ?? 0;
|
|
1174
1175
|
r({ x: Math.max(0, Math.min(l.x, window.innerWidth - p)), y: Math.max(0, Math.min(l.y, window.innerHeight - m)) });
|
|
1175
1176
|
}, [l]), z(() => {
|
|
1176
1177
|
var p, m;
|
|
1177
1178
|
if (!l) return;
|
|
1178
1179
|
h.current = document.activeElement, (m = (p = t.current) == null ? void 0 : p.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || m.focus();
|
|
1179
|
-
const
|
|
1180
|
-
var
|
|
1181
|
-
(
|
|
1180
|
+
const i = (N) => {
|
|
1181
|
+
var v;
|
|
1182
|
+
(v = t.current) != null && v.contains(N.target) || a();
|
|
1182
1183
|
};
|
|
1183
|
-
return document.addEventListener("mousedown",
|
|
1184
|
-
var
|
|
1185
|
-
document.removeEventListener("mousedown",
|
|
1184
|
+
return document.addEventListener("mousedown", i), () => {
|
|
1185
|
+
var N, v;
|
|
1186
|
+
document.removeEventListener("mousedown", i), (v = (N = h.current) == null ? void 0 : N.focus) == null || v.call(N);
|
|
1186
1187
|
};
|
|
1187
1188
|
}, [l, a]), !l || u.length === 0) return null;
|
|
1188
|
-
const o = (
|
|
1189
|
-
var
|
|
1190
|
-
const p = Array.from(((
|
|
1191
|
-
if (
|
|
1192
|
-
|
|
1193
|
-
else if (
|
|
1194
|
-
|
|
1195
|
-
const g =
|
|
1196
|
-
(
|
|
1189
|
+
const o = (i) => {
|
|
1190
|
+
var N, v;
|
|
1191
|
+
const p = Array.from(((N = t.current) == null ? void 0 : N.querySelectorAll('[role="menuitem"]')) ?? []), m = p.indexOf(document.activeElement);
|
|
1192
|
+
if (i.key === "Escape" || i.key === "Tab")
|
|
1193
|
+
i.preventDefault(), a();
|
|
1194
|
+
else if (i.key === "ArrowDown" || i.key === "ArrowUp") {
|
|
1195
|
+
i.preventDefault();
|
|
1196
|
+
const g = i.key === "ArrowDown" ? 1 : -1;
|
|
1197
|
+
(v = p[(m + g + p.length) % p.length]) == null || v.focus();
|
|
1197
1198
|
}
|
|
1198
1199
|
};
|
|
1199
1200
|
return le(
|
|
@@ -1203,33 +1204,33 @@ function vl({ at: l, items: n, onClose: a, label: i = "Actions" }) {
|
|
|
1203
1204
|
ref: t,
|
|
1204
1205
|
className: "cms-menu",
|
|
1205
1206
|
role: "menu",
|
|
1206
|
-
"aria-label":
|
|
1207
|
+
"aria-label": c,
|
|
1207
1208
|
style: { left: (d ?? l).x, top: (d ?? l).y },
|
|
1208
1209
|
onKeyDown: o,
|
|
1209
|
-
onContextMenu: (
|
|
1210
|
-
children: u.map((
|
|
1211
|
-
const p =
|
|
1210
|
+
onContextMenu: (i) => i.preventDefault(),
|
|
1211
|
+
children: u.map((i) => {
|
|
1212
|
+
const p = i.offer.refusal !== void 0;
|
|
1212
1213
|
return /* @__PURE__ */ s(
|
|
1213
1214
|
"div",
|
|
1214
1215
|
{
|
|
1215
1216
|
role: "menuitem",
|
|
1216
1217
|
tabIndex: -1,
|
|
1217
1218
|
"aria-disabled": p || void 0,
|
|
1218
|
-
title: p ?
|
|
1219
|
-
className: k("cms-menu__item",
|
|
1219
|
+
title: p ? i.offer.refusal : void 0,
|
|
1220
|
+
className: k("cms-menu__item", i.danger && "is-danger", i.offer.locked && "is-locked", p && "is-refused"),
|
|
1220
1221
|
onClick: () => {
|
|
1221
|
-
p || (a(),
|
|
1222
|
+
p || (a(), i.onSelect());
|
|
1222
1223
|
},
|
|
1223
1224
|
onKeyDown: (m) => {
|
|
1224
|
-
(m.key === "Enter" || m.key === " ") && !p && (m.preventDefault(), a(),
|
|
1225
|
+
(m.key === "Enter" || m.key === " ") && !p && (m.preventDefault(), a(), i.onSelect());
|
|
1225
1226
|
},
|
|
1226
1227
|
children: [
|
|
1227
|
-
|
|
1228
|
-
/* @__PURE__ */ e("span", { className: "cms-menu__label", children:
|
|
1229
|
-
p ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children:
|
|
1228
|
+
i.offer.locked ? /* @__PURE__ */ e($, { name: "lock" }) : null,
|
|
1229
|
+
/* @__PURE__ */ e("span", { className: "cms-menu__label", children: i.label }),
|
|
1230
|
+
p ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: i.offer.refusal }) : null
|
|
1230
1231
|
]
|
|
1231
1232
|
},
|
|
1232
|
-
|
|
1233
|
+
i.id
|
|
1233
1234
|
);
|
|
1234
1235
|
})
|
|
1235
1236
|
}
|
|
@@ -1255,8 +1256,8 @@ function Nl(l, n) {
|
|
|
1255
1256
|
function ze(l, n) {
|
|
1256
1257
|
if (!l) return;
|
|
1257
1258
|
if (typeof l.get == "function") return l.get(n) ?? void 0;
|
|
1258
|
-
const a = l,
|
|
1259
|
-
return
|
|
1259
|
+
const a = l, c = Object.keys(a).find((t) => t.toLowerCase() === n.toLowerCase());
|
|
1260
|
+
return c === void 0 ? void 0 : a[c];
|
|
1260
1261
|
}
|
|
1261
1262
|
function Ve(l) {
|
|
1262
1263
|
if (l && typeof l == "object") {
|
|
@@ -1265,45 +1266,45 @@ function Ve(l) {
|
|
|
1265
1266
|
if (typeof n.title == "string" && n.title !== "") return n.title;
|
|
1266
1267
|
}
|
|
1267
1268
|
}
|
|
1268
|
-
function gl(l, n, a,
|
|
1269
|
+
function gl(l, n, a, c) {
|
|
1269
1270
|
if (l !== 403) return { kind: "none" };
|
|
1270
1271
|
const t = Ve(a);
|
|
1271
|
-
return ze(n, "X-Elevation-Required") !== void 0 ?
|
|
1272
|
+
return ze(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: t ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: t ?? "The server refused this." };
|
|
1272
1273
|
}
|
|
1273
1274
|
const ee = "coolms-kit:reread";
|
|
1274
1275
|
function yl() {
|
|
1275
1276
|
window.dispatchEvent(new Event(ee));
|
|
1276
1277
|
}
|
|
1277
1278
|
function wl(l) {
|
|
1278
|
-
const [n, a] = D(void 0), [
|
|
1279
|
+
const [n, a] = D(void 0), [c, t] = D(void 0), [h, d] = D(!0), r = T(l);
|
|
1279
1280
|
r.current = l;
|
|
1280
1281
|
const u = T(0), o = J(() => {
|
|
1281
|
-
const
|
|
1282
|
+
const i = ++u.current;
|
|
1282
1283
|
d(!0), r.current().then(
|
|
1283
1284
|
(p) => {
|
|
1284
|
-
|
|
1285
|
+
i === u.current && (a(p), t(void 0), d(!1));
|
|
1285
1286
|
},
|
|
1286
1287
|
(p) => {
|
|
1287
|
-
|
|
1288
|
+
i === u.current && (t(p), d(!1));
|
|
1288
1289
|
}
|
|
1289
1290
|
);
|
|
1290
1291
|
}, []);
|
|
1291
1292
|
return z(() => {
|
|
1292
1293
|
o();
|
|
1293
|
-
const
|
|
1294
|
-
return window.addEventListener("focus",
|
|
1295
|
-
window.removeEventListener("focus",
|
|
1294
|
+
const i = () => o();
|
|
1295
|
+
return window.addEventListener("focus", i), window.addEventListener(ee, i), () => {
|
|
1296
|
+
window.removeEventListener("focus", i), window.removeEventListener(ee, i);
|
|
1296
1297
|
};
|
|
1297
|
-
}, [o]), { value: n, error:
|
|
1298
|
+
}, [o]), { value: n, error: c, loading: h, reread: o };
|
|
1298
1299
|
}
|
|
1299
1300
|
function kl(l) {
|
|
1300
1301
|
return l === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
|
|
1301
1302
|
}
|
|
1302
1303
|
const Re = "/errors/client-update-required";
|
|
1303
1304
|
function We(l, n) {
|
|
1304
|
-
const a = l.split(".").map((t) => Number.parseInt(t, 10) || 0),
|
|
1305
|
-
for (let t = 0; t < Math.max(a.length,
|
|
1306
|
-
const h = a[t] ?? 0, d =
|
|
1305
|
+
const a = l.split(".").map((t) => Number.parseInt(t, 10) || 0), c = n.split(".").map((t) => Number.parseInt(t, 10) || 0);
|
|
1306
|
+
for (let t = 0; t < Math.max(a.length, c.length); t++) {
|
|
1307
|
+
const h = a[t] ?? 0, d = c[t] ?? 0;
|
|
1307
1308
|
if (h !== d) return h < d;
|
|
1308
1309
|
}
|
|
1309
1310
|
return !1;
|
package/package.json
CHANGED
package/src/kit.css
CHANGED
|
@@ -434,6 +434,7 @@
|
|
|
434
434
|
.cms-composer--reply .cms-composer__title { flex-basis: 100%; color: var(--cms-text-muted); font-size: var(--cms-font-size-meta); }
|
|
435
435
|
.cms-composer--reply .cms-composer__input { flex-basis: 100%; padding: var(--cms-space-2) var(--cms-space-3); border-color: transparent; }
|
|
436
436
|
.cms-composer--reply .cms-composer__send { margin-left: auto; }
|
|
437
|
+
.cms-composer--reply .cms-composer__leading { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cms-space-2); min-width: 0; }
|
|
437
438
|
.cms-composer__input:focus { outline: 2px solid var(--cms-focus-ring); outline-offset: 1px; }
|
|
438
439
|
.cms-composer__send-round { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cms-accent); color: var(--cms-accent-fg); cursor: pointer; }
|
|
439
440
|
.cms-composer__send-round:disabled, .cms-composer__send:disabled { opacity: 0.55; cursor: not-allowed; }
|