@coolms/ui-react 0.1.0-alpha.3 → 0.1.0-alpha.5

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/dist/index.js CHANGED
@@ -1,7 +1,15 @@
1
- import { jsx as e, jsxs as r, Fragment as b } from "react/jsx-runtime";
2
- import { useId as A, useState as M, useRef as x, useEffect as D, useLayoutEffect as F, useCallback as H } from "react";
3
- import { createPortal as Z } from "react-dom";
4
- function g(...l) {
1
+ import { jsx as e, jsxs as i, Fragment as g } from "react/jsx-runtime";
2
+ import { useId as E, useState as C, useRef as x, useEffect as D, useLayoutEffect as R, useCallback as V } from "react";
3
+ import { createPortal as F } from "react-dom";
4
+ function L(l, n) {
5
+ const a = { ...l };
6
+ for (const c of Object.keys(n ?? {})) {
7
+ const s = n == null ? void 0 : n[c];
8
+ s !== void 0 && (a[c] = s);
9
+ }
10
+ return a;
11
+ }
12
+ function v(...l) {
5
13
  return l.filter(Boolean).join(" ");
6
14
  }
7
15
  function k({ name: l }) {
@@ -23,34 +31,34 @@ function k({ name: l }) {
23
31
  return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
24
32
  }
25
33
  }
26
- function E({
34
+ function $({
27
35
  variant: l = "secondary",
28
36
  busy: n = !1,
29
37
  busyLabel: a,
30
38
  locked: c = !1,
31
39
  lockedReason: s,
32
40
  icon: m,
33
- disabled: t,
34
- className: u,
35
- children: h,
36
- type: o = "button",
37
- title: i,
41
+ disabled: r,
42
+ className: d,
43
+ children: u,
44
+ type: h = "button",
45
+ title: t,
38
46
  ...f
39
47
  }) {
40
- const d = !!t || n;
41
- return /* @__PURE__ */ r(
48
+ const o = !!r || n;
49
+ return /* @__PURE__ */ i(
42
50
  "button",
43
51
  {
44
52
  ...f,
45
- type: o,
46
- className: g("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", u),
47
- disabled: d,
53
+ type: h,
54
+ className: v("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", d),
55
+ disabled: o,
48
56
  "aria-busy": n || void 0,
49
- title: c ? s ?? i : i,
57
+ title: c ? s ?? t : t,
50
58
  children: [
51
59
  n ? /* @__PURE__ */ e(k, { name: "spinner" }) : c ? /* @__PURE__ */ e(k, { name: "lock" }) : m,
52
- /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : h }),
53
- c && s ? /* @__PURE__ */ r("span", { className: "cms-visually-hidden", children: [
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : u }),
61
+ c && s ? /* @__PURE__ */ i("span", { className: "cms-visually-hidden", children: [
54
62
  ", ",
55
63
  s
56
64
  ] }) : null
@@ -58,11 +66,11 @@ function E({
58
66
  }
59
67
  );
60
68
  }
61
- function I({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
62
- return /* @__PURE__ */ r("div", { className: g("cms-field", c != null && "is-invalid"), children: [
69
+ function K({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
70
+ return /* @__PURE__ */ i("div", { className: v("cms-field", c != null && "is-invalid"), children: [
63
71
  /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: l, children: n }),
64
72
  m,
65
- s != null ? /* @__PURE__ */ r("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
73
+ s != null ? /* @__PURE__ */ i("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
66
74
  /* @__PURE__ */ e(k, { name: "lock" }),
67
75
  " ",
68
76
  s
@@ -71,62 +79,62 @@ function I({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
71
79
  a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${l}-help`, children: a }) : null
72
80
  ] });
73
81
  }
74
- function B(l, n) {
82
+ function P(l, n) {
75
83
  const a = [n.error != null && `${l}-error`, n.pinned != null && `${l}-pinned`, n.help != null && `${l}-help`].filter(Boolean).join(" ");
76
84
  return a === "" ? void 0 : a;
77
85
  }
78
- function ne({ label: l, help: n, error: a, disabled: c, readOnly: s, pinned: m, value: t, onChange: u, placeholder: h, type: o = "text", name: i }) {
79
- const f = A();
80
- return /* @__PURE__ */ e(I, { id: f, label: l, help: n, error: a, pinned: m, children: /* @__PURE__ */ e(
86
+ function re({ label: l, help: n, error: a, disabled: c, readOnly: s, pinned: m, value: r, onChange: d, placeholder: u, type: h = "text", name: t }) {
87
+ const f = E();
88
+ return /* @__PURE__ */ e(K, { id: f, label: l, help: n, error: a, pinned: m, children: /* @__PURE__ */ e(
81
89
  "input",
82
90
  {
83
91
  id: f,
84
- name: i,
85
- type: o,
92
+ name: t,
93
+ type: h,
86
94
  className: "cms-input",
87
- value: t,
88
- placeholder: h,
95
+ value: r,
96
+ placeholder: u,
89
97
  disabled: c,
90
98
  readOnly: s || m != null,
91
99
  "aria-invalid": a != null || void 0,
92
- "aria-describedby": B(f, { help: n, error: a, pinned: m }),
93
- onChange: (d) => u == null ? void 0 : u(d.target.value)
100
+ "aria-describedby": P(f, { help: n, error: a, pinned: m }),
101
+ onChange: (o) => d == null ? void 0 : d(o.target.value)
94
102
  }
95
103
  ) });
96
104
  }
97
- function ae({ label: l, help: n, error: a, disabled: c, readOnly: s, value: m, options: t, onChange: u, emptyText: h = "Nothing to choose from yet.", name: o }) {
98
- const i = A(), f = t.length === 0;
99
- return /* @__PURE__ */ e(I, { id: i, label: l, help: f ? h : n, error: a, children: /* @__PURE__ */ e(
105
+ function ie({ label: l, help: n, error: a, disabled: c, readOnly: s, value: m, options: r, onChange: d, emptyText: u = "Nothing to choose from yet.", name: h }) {
106
+ const t = E(), f = r.length === 0;
107
+ return /* @__PURE__ */ e(K, { id: t, label: l, help: f ? u : n, error: a, children: /* @__PURE__ */ e(
100
108
  "select",
101
109
  {
102
- id: i,
103
- name: o,
110
+ id: t,
111
+ name: h,
104
112
  className: "cms-input cms-select",
105
113
  value: m,
106
114
  disabled: c || f,
107
115
  "aria-readonly": s || void 0,
108
116
  "aria-invalid": a != null || void 0,
109
- "aria-describedby": B(i, { help: f ? h : n, error: a }),
110
- onChange: (d) => {
111
- s || u == null || u(d.target.value);
117
+ "aria-describedby": P(t, { help: f ? u : n, error: a }),
118
+ onChange: (o) => {
119
+ s || d == null || d(o.target.value);
112
120
  },
113
- children: t.map((d) => /* @__PURE__ */ e("option", { value: d.value, disabled: s && d.value !== m, children: d.label }, d.value))
121
+ children: r.map((o) => /* @__PURE__ */ e("option", { value: o.value, disabled: s && o.value !== m, children: o.label }, o.value))
114
122
  }
115
123
  ) });
116
124
  }
117
- function se({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help: m }) {
118
- const t = A();
119
- return /* @__PURE__ */ r("div", { className: "cms-toggle-row", children: [
125
+ function oe({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help: m }) {
126
+ const r = E();
127
+ return /* @__PURE__ */ i("div", { className: "cms-toggle-row", children: [
120
128
  /* @__PURE__ */ e(
121
129
  "button",
122
130
  {
123
- id: t,
131
+ id: r,
124
132
  type: "button",
125
133
  role: "switch",
126
- className: g("cms-toggle", n && "is-on"),
134
+ className: v("cms-toggle", n && "is-on"),
127
135
  "aria-checked": n,
128
136
  "aria-readonly": s || void 0,
129
- "aria-describedby": m != null ? `${t}-help` : void 0,
137
+ "aria-describedby": m != null ? `${r}-help` : void 0,
130
138
  disabled: c,
131
139
  onClick: () => {
132
140
  s || a == null || a(!n);
@@ -134,72 +142,72 @@ function se({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help:
134
142
  children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
135
143
  }
136
144
  ),
137
- /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: t, children: l }),
138
- m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${t}-help`, children: m }) : null
145
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: r, children: l }),
146
+ m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${r}-help`, children: m }) : null
139
147
  ] });
140
148
  }
141
- const R = 150;
142
- function z({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: s, children: m, footer: t }) {
143
- const [u, h] = M(l), [o, i] = M(!1), f = x(null), d = x(null), v = A();
149
+ const j = 150;
150
+ function z({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: s, children: m, footer: r, closeLabel: d = "Close" }) {
151
+ const [u, h] = C(l), [t, f] = C(!1), o = x(null), p = x(null), b = E();
144
152
  if (D(() => {
145
153
  if (l) {
146
- d.current = document.activeElement, h(!0), i(!1);
154
+ p.current = document.activeElement, h(!0), f(!1);
147
155
  return;
148
156
  }
149
157
  if (!u) return;
150
- i(!0);
151
- const p = window.setTimeout(() => {
152
- var N, w;
153
- h(!1), i(!1), (w = (N = d.current) == null ? void 0 : N.focus) == null || w.call(N);
154
- }, R);
155
- return () => window.clearTimeout(p);
158
+ f(!0);
159
+ const _ = window.setTimeout(() => {
160
+ var M, w;
161
+ h(!1), f(!1), (w = (M = p.current) == null ? void 0 : M.focus) == null || w.call(M);
162
+ }, j);
163
+ return () => window.clearTimeout(_);
156
164
  }, [l, u]), D(() => {
157
- var p, N;
165
+ var _, M;
158
166
  if (l && u) {
159
167
  const w = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
160
- (N = ((p = f.current) == null ? void 0 : p.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? f.current) == null || N.focus();
168
+ (M = ((_ = o.current) == null ? void 0 : _.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? o.current) == null || M.focus();
161
169
  }
162
170
  }, [l, u]), !u) return null;
163
- const _ = () => {
171
+ const N = () => {
164
172
  c ? s == null || s() : a();
165
173
  };
166
- return Z(
167
- /* @__PURE__ */ e("div", { className: g("cms-modal-scrim", o && "is-closing"), onMouseDown: (p) => {
168
- p.target === p.currentTarget && _();
169
- }, children: /* @__PURE__ */ r(
174
+ return F(
175
+ /* @__PURE__ */ e("div", { className: v("cms-modal-scrim", t && "is-closing"), onMouseDown: (_) => {
176
+ _.target === _.currentTarget && N();
177
+ }, children: /* @__PURE__ */ i(
170
178
  "div",
171
179
  {
172
- ref: f,
173
- className: g("cms-modal", o && "is-closing", c && "is-dirty"),
180
+ ref: o,
181
+ className: v("cms-modal", t && "is-closing", c && "is-dirty"),
174
182
  role: "dialog",
175
183
  "aria-modal": "true",
176
- "aria-labelledby": v,
184
+ "aria-labelledby": b,
177
185
  tabIndex: -1,
178
- onKeyDown: (p) => {
179
- var N;
180
- if (p.key === "Escape")
181
- p.stopPropagation(), _();
182
- else if (p.key === "Tab") {
183
- const w = (N = f.current) == null ? void 0 : N.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
186
+ onKeyDown: (_) => {
187
+ var M;
188
+ if (_.key === "Escape")
189
+ _.stopPropagation(), N();
190
+ else if (_.key === "Tab") {
191
+ const w = (M = o.current) == null ? void 0 : M.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
184
192
  if (!w || w.length === 0) return;
185
- const L = w[0], T = w[w.length - 1];
186
- p.shiftKey && document.activeElement === L ? (p.preventDefault(), T.focus()) : !p.shiftKey && document.activeElement === T && (p.preventDefault(), L.focus());
193
+ const T = w[0], B = w[w.length - 1];
194
+ _.shiftKey && document.activeElement === T ? (_.preventDefault(), B.focus()) : !_.shiftKey && document.activeElement === B && (_.preventDefault(), T.focus());
187
195
  }
188
196
  },
189
197
  children: [
190
- /* @__PURE__ */ r("header", { className: "cms-modal__head", children: [
191
- /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: v, children: n }),
192
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": "Close", onClick: _, children: /* @__PURE__ */ e(k, { name: "close" }) })
198
+ /* @__PURE__ */ i("header", { className: "cms-modal__head", children: [
199
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: b, children: n }),
200
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d, onClick: N, children: /* @__PURE__ */ e(k, { name: "close" }) })
193
201
  ] }),
194
202
  /* @__PURE__ */ e("div", { className: "cms-modal__body", children: m }),
195
- t != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: t }) : null
203
+ r != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: r }) : null
196
204
  ]
197
205
  }
198
206
  ) }),
199
207
  document.body
200
208
  );
201
209
  }
202
- function ce({ open: l, title: n, message: a, kind: c = "default", confirmLabel: s, cancelLabel: m, onConfirm: t, onCancel: u }) {
210
+ function de({ open: l, title: n, message: a, kind: c = "default", confirmLabel: s, cancelLabel: m, closeLabel: r, onConfirm: d, onCancel: u }) {
203
211
  const h = c === "discard-changes";
204
212
  return /* @__PURE__ */ e(
205
213
  z,
@@ -207,11 +215,12 @@ function ce({ open: l, title: n, message: a, kind: c = "default", confirmLabel:
207
215
  open: l,
208
216
  title: n,
209
217
  onClose: u,
210
- footer: /* @__PURE__ */ r(b, { children: [
211
- /* @__PURE__ */ e(E, { onClick: u, children: m ?? (h ? "Keep editing" : "Cancel") }),
212
- /* @__PURE__ */ e(E, { variant: c === "default" ? "primary" : "danger", onClick: t, children: s ?? (h ? "Discard changes" : "Confirm") })
218
+ ...r === void 0 ? {} : { closeLabel: r },
219
+ footer: /* @__PURE__ */ i(g, { children: [
220
+ /* @__PURE__ */ e($, { onClick: u, children: m ?? (h ? "Keep editing" : "Cancel") }),
221
+ /* @__PURE__ */ e($, { variant: c === "default" ? "primary" : "danger", onClick: d, children: s ?? (h ? "Discard changes" : "Confirm") })
213
222
  ] }),
214
- children: c !== "default" ? /* @__PURE__ */ r("p", { className: "cms-confirm__warning", children: [
223
+ children: c !== "default" ? /* @__PURE__ */ i("p", { className: "cms-confirm__warning", children: [
215
224
  /* @__PURE__ */ e(k, { name: "warning" }),
216
225
  " ",
217
226
  a
@@ -219,40 +228,40 @@ function ce({ open: l, title: n, message: a, kind: c = "default", confirmLabel:
219
228
  }
220
229
  );
221
230
  }
222
- function te({ kind: l, message: n, action: a, onDismiss: c }) {
223
- return /* @__PURE__ */ r("div", { className: g("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
231
+ function me({ kind: l, message: n, action: a, onDismiss: c, dismissLabel: s = "Dismiss" }) {
232
+ return /* @__PURE__ */ i("div", { className: v("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
224
233
  /* @__PURE__ */ e(k, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
225
234
  /* @__PURE__ */ e("span", { className: "cms-toast__message", children: n }),
226
- a ? /* @__PURE__ */ e(E, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
227
- c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": "Dismiss", onClick: c, children: /* @__PURE__ */ e(k, { name: "close" }) }) : null
235
+ a ? /* @__PURE__ */ e($, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
236
+ c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: c, children: /* @__PURE__ */ e(k, { name: "close" }) }) : null
228
237
  ] });
229
238
  }
230
- function re({ children: l }) {
239
+ function ue({ children: l }) {
231
240
  return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: l });
232
241
  }
233
- function P({ what: l, layout: n = "inline" }) {
234
- return /* @__PURE__ */ r("div", { className: g("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
242
+ function U({ what: l, layout: n = "inline" }) {
243
+ return /* @__PURE__ */ i("div", { className: v("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
235
244
  /* @__PURE__ */ e(k, { name: "spinner" }),
236
245
  /* @__PURE__ */ e("span", { children: l })
237
246
  ] });
238
247
  }
239
- function V({ title: l, hint: n, action: a }) {
240
- return /* @__PURE__ */ r("div", { className: "cms-empty", children: [
248
+ function W({ title: l, hint: n, action: a }) {
249
+ return /* @__PURE__ */ i("div", { className: "cms-empty", children: [
241
250
  /* @__PURE__ */ e("p", { className: "cms-empty__title", children: l }),
242
251
  n != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: n }) : null,
243
252
  a != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: a }) : null
244
253
  ] });
245
254
  }
246
- function j({ message: l, onRetry: n }) {
247
- return /* @__PURE__ */ r("div", { className: "cms-error-banner", role: "alert", children: [
255
+ function q({ message: l, onRetry: n, retryLabel: a = "Try again" }) {
256
+ return /* @__PURE__ */ i("div", { className: "cms-error-banner", role: "alert", children: [
248
257
  /* @__PURE__ */ e(k, { name: "warning" }),
249
258
  /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: l }),
250
- n ? /* @__PURE__ */ e(E, { onClick: n, children: "Try again" }) : null
259
+ n ? /* @__PURE__ */ e($, { onClick: n, children: a }) : null
251
260
  ] });
252
261
  }
253
- function ie({ title: l, scope: n, actions: a, backLink: c }) {
254
- return /* @__PURE__ */ r("header", { className: "cms-page-header", children: [
255
- c ? /* @__PURE__ */ r(
262
+ function he({ title: l, scope: n, actions: a, backLink: c }) {
263
+ return /* @__PURE__ */ i("header", { className: "cms-page-header", children: [
264
+ c ? /* @__PURE__ */ i(
256
265
  "a",
257
266
  {
258
267
  className: "cms-page-header__back",
@@ -267,8 +276,8 @@ function ie({ title: l, scope: n, actions: a, backLink: c }) {
267
276
  ]
268
277
  }
269
278
  ) : null,
270
- /* @__PURE__ */ r("div", { className: "cms-page-header__row", children: [
271
- /* @__PURE__ */ r("div", { className: "cms-page-header__titles", children: [
279
+ /* @__PURE__ */ i("div", { className: "cms-page-header__row", children: [
280
+ /* @__PURE__ */ i("div", { className: "cms-page-header__titles", children: [
272
281
  /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
273
282
  n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
274
283
  ] }),
@@ -276,133 +285,133 @@ function ie({ title: l, scope: n, actions: a, backLink: c }) {
276
285
  ] })
277
286
  ] });
278
287
  }
279
- function oe({ tabs: l, active: n, onSelect: a, label: c }) {
280
- const s = x([]), m = (t, u) => {
288
+ function fe({ tabs: l, active: n, onSelect: a, label: c }) {
289
+ const s = x([]), m = (r, d) => {
281
290
  var f;
282
- const h = l.length - 1, o = t.key === "ArrowRight" ? u === h ? 0 : u + 1 : t.key === "ArrowLeft" ? u === 0 ? h : u - 1 : t.key === "Home" ? 0 : t.key === "End" ? h : null;
283
- if (o === null) return;
284
- t.preventDefault();
285
- const i = l[o];
286
- i && (a(i.id), (f = s.current[o]) == null || f.focus());
291
+ const u = l.length - 1, h = r.key === "ArrowRight" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" ? d === 0 ? u : d - 1 : r.key === "Home" ? 0 : r.key === "End" ? u : null;
292
+ if (h === null) return;
293
+ r.preventDefault();
294
+ const t = l[h];
295
+ t && (a(t.id), (f = s.current[h]) == null || f.focus());
287
296
  };
288
- return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((t, u) => {
289
- const h = t.id === n;
290
- return /* @__PURE__ */ r(
297
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((r, d) => {
298
+ const u = r.id === n;
299
+ return /* @__PURE__ */ i(
291
300
  "button",
292
301
  {
293
- ref: (o) => {
294
- s.current[u] = o;
302
+ ref: (h) => {
303
+ s.current[d] = h;
295
304
  },
296
305
  type: "button",
297
306
  role: "tab",
298
- className: g("cms-tab", h && "is-active"),
299
- "aria-selected": h,
300
- tabIndex: h ? 0 : -1,
301
- onClick: () => a(t.id),
302
- onKeyDown: (o) => m(o, u),
307
+ className: v("cms-tab", u && "is-active"),
308
+ "aria-selected": u,
309
+ tabIndex: u ? 0 : -1,
310
+ onClick: () => a(r.id),
311
+ onKeyDown: (h) => m(h, d),
303
312
  children: [
304
- t.label,
305
- t.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: t.count }) : null
313
+ r.label,
314
+ r.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: r.count }) : null
306
315
  ]
307
316
  },
308
- t.id
317
+ r.id
309
318
  );
310
319
  }) });
311
320
  }
312
- function q(l) {
321
+ function G(l) {
313
322
  var c;
314
323
  const n = l.trim().split(/\s+/).filter(Boolean);
315
324
  return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
316
325
  }
317
- function U(l) {
326
+ function X(l) {
318
327
  let n = 0;
319
328
  for (const a of l.trim().toLowerCase())
320
329
  n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
321
330
  return n % 6 + 1;
322
331
  }
323
- function $({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
324
- return /* @__PURE__ */ r(
332
+ function S({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
333
+ return /* @__PURE__ */ i(
325
334
  "span",
326
335
  {
327
- className: `cms-avatar cms-avatar--tint-${U(l)}`,
336
+ className: `cms-avatar cms-avatar--tint-${X(l)}`,
328
337
  style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
329
338
  role: "img",
330
339
  "aria-label": a ? `${l}, ${a}` : l,
331
340
  children: [
332
- n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: q(l) }),
333
- a ? /* @__PURE__ */ e("span", { className: g("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
341
+ n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: G(l) }),
342
+ a ? /* @__PURE__ */ e("span", { className: v("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
334
343
  ]
335
344
  }
336
345
  );
337
346
  }
338
- const K = {
339
- mail: /* @__PURE__ */ r(b, { children: [
347
+ const H = {
348
+ mail: /* @__PURE__ */ i(g, { children: [
340
349
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
341
350
  /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
342
351
  ] }),
343
352
  chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
344
353
  phone: /* @__PURE__ */ e("path", { d: "M5 3h3l2 5-2.5 1.5a11 11 0 0 0 7 7L16 14l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 5a2 2 0 0 1 2-2Z" }),
345
- calendar: /* @__PURE__ */ r(b, { children: [
354
+ calendar: /* @__PURE__ */ i(g, { children: [
346
355
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
347
356
  /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
348
357
  ] }),
349
- file: /* @__PURE__ */ r(b, { children: [
358
+ file: /* @__PURE__ */ i(g, { children: [
350
359
  /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
351
360
  /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
352
361
  ] }),
353
- image: /* @__PURE__ */ r(b, { children: [
362
+ image: /* @__PURE__ */ i(g, { children: [
354
363
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
355
364
  /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
356
365
  /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
357
366
  ] }),
358
- search: /* @__PURE__ */ r(b, { children: [
367
+ search: /* @__PURE__ */ i(g, { children: [
359
368
  /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
360
369
  /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
361
370
  ] }),
362
- bell: /* @__PURE__ */ r(b, { children: [
371
+ bell: /* @__PURE__ */ i(g, { children: [
363
372
  /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
364
373
  /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
365
374
  ] }),
366
- pencil: /* @__PURE__ */ r(b, { children: [
375
+ pencil: /* @__PURE__ */ i(g, { children: [
367
376
  /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
368
377
  /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
369
378
  ] }),
370
379
  star: /* @__PURE__ */ e("path", { d: "m12 3 2.8 5.8 6.2.9-4.5 4.4 1 6.2L12 17.4l-5.5 2.9 1-6.2L3 9.7l6.2-.9Z" }),
371
- send: /* @__PURE__ */ r(b, { children: [
380
+ send: /* @__PURE__ */ i(g, { children: [
372
381
  /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
373
382
  /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
374
383
  ] }),
375
- inbox: /* @__PURE__ */ r(b, { children: [
384
+ inbox: /* @__PURE__ */ i(g, { children: [
376
385
  /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
377
386
  /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
378
387
  ] }),
379
- archive: /* @__PURE__ */ r(b, { children: [
388
+ archive: /* @__PURE__ */ i(g, { children: [
380
389
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
381
390
  /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
382
391
  ] }),
383
- trash: /* @__PURE__ */ r(b, { children: [
392
+ trash: /* @__PURE__ */ i(g, { children: [
384
393
  /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
385
394
  /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
386
395
  ] }),
387
396
  paperclip: /* @__PURE__ */ e("path", { d: "m20 11-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7" }),
388
- mic: /* @__PURE__ */ r(b, { children: [
397
+ mic: /* @__PURE__ */ i(g, { children: [
389
398
  /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
390
399
  /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
391
400
  ] }),
392
- speaker: /* @__PURE__ */ r(b, { children: [
401
+ speaker: /* @__PURE__ */ i(g, { children: [
393
402
  /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
394
403
  /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
395
404
  ] }),
396
- "user-plus": /* @__PURE__ */ r(b, { children: [
405
+ "user-plus": /* @__PURE__ */ i(g, { children: [
397
406
  /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
398
407
  /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
399
408
  ] }),
400
409
  "phone-off": /* @__PURE__ */ e("path", { d: "M3 14c5-5 13-5 18 0l-2 3-4-1v-3a10 10 0 0 0-6 0v3l-4 1Z" }),
401
- video: /* @__PURE__ */ r(b, { children: [
410
+ video: /* @__PURE__ */ i(g, { children: [
402
411
  /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
403
412
  /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
404
413
  ] }),
405
- info: /* @__PURE__ */ r(b, { children: [
414
+ info: /* @__PURE__ */ i(g, { children: [
406
415
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
407
416
  /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
408
417
  ] }),
@@ -411,7 +420,7 @@ const K = {
411
420
  plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
412
421
  folder: /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
413
422
  check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
414
- server: /* @__PURE__ */ r(b, { children: [
423
+ server: /* @__PURE__ */ i(g, { children: [
415
424
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
416
425
  /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
417
426
  /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
@@ -434,55 +443,55 @@ function y({ name: l, size: n = 20, label: a }) {
434
443
  strokeLinejoin: "round",
435
444
  focusable: !1,
436
445
  ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
437
- children: K[l]
446
+ children: H[l]
438
447
  }
439
448
  );
440
449
  }
441
- const de = Object.keys(K);
442
- function W({ count: l, label: n, max: a = 99 }) {
443
- return l <= 0 ? null : /* @__PURE__ */ r("span", { className: "cms-badge", children: [
450
+ const pe = Object.keys(H);
451
+ function Y({ count: l, label: n, max: a = 99 }) {
452
+ return l <= 0 ? null : /* @__PURE__ */ i("span", { className: "cms-badge", children: [
444
453
  /* @__PURE__ */ e("span", { "aria-hidden": "true", children: l > a ? `${a}+` : l }),
445
454
  /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
446
455
  ] });
447
456
  }
448
- function me({ product: l, mark: n, rail: a, active: c, onNavigate: s, server: m, search: t, account: u, children: h }) {
449
- return /* @__PURE__ */ r("div", { className: "cms-shell", children: [
450
- /* @__PURE__ */ r("nav", { className: "cms-shell__rail", "aria-label": "Sections", children: [
457
+ function _e({ product: l, mark: n, rail: a, active: c, onNavigate: s, server: m, search: r, account: d, children: u, railLabel: h = "Sections" }) {
458
+ return /* @__PURE__ */ i("div", { className: "cms-shell", children: [
459
+ /* @__PURE__ */ i("nav", { className: "cms-shell__rail", "aria-label": h, children: [
451
460
  /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
452
- /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((o) => {
453
- const i = o.id === c;
454
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ r(
461
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((t) => {
462
+ const f = t.id === c;
463
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
455
464
  "a",
456
465
  {
457
- href: o.href,
458
- className: g("cms-shell__item", i && "is-active"),
459
- "aria-current": i ? "page" : void 0,
460
- title: o.label,
461
- onClick: (f) => {
462
- s && (f.preventDefault(), s(o.id));
466
+ href: t.href,
467
+ className: v("cms-shell__item", f && "is-active"),
468
+ "aria-current": f ? "page" : void 0,
469
+ title: t.label,
470
+ onClick: (o) => {
471
+ s && (o.preventDefault(), s(t.id));
463
472
  },
464
473
  children: [
465
- /* @__PURE__ */ r("span", { className: "cms-shell__icon", children: [
466
- /* @__PURE__ */ e(y, { name: o.icon, size: 22 }),
467
- o.badge ? /* @__PURE__ */ e(W, { count: o.badge.count, label: o.badge.label }) : null
474
+ /* @__PURE__ */ i("span", { className: "cms-shell__icon", children: [
475
+ /* @__PURE__ */ e(y, { name: t.icon, size: 22 }),
476
+ t.badge ? /* @__PURE__ */ e(Y, { count: t.badge.count, label: t.badge.label }) : null
468
477
  ] }),
469
- /* @__PURE__ */ e("span", { className: "cms-shell__label", children: o.label })
478
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: t.label })
470
479
  ]
471
480
  }
472
- ) }, o.id);
481
+ ) }, t.id);
473
482
  }) })
474
483
  ] }),
475
- /* @__PURE__ */ r("header", { className: "cms-shell__top", children: [
484
+ /* @__PURE__ */ i("header", { className: "cms-shell__top", children: [
476
485
  /* @__PURE__ */ e("span", { className: "cms-shell__product", children: l }),
477
486
  m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: m }) : null,
478
- t != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: t }) : null,
479
- u != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: u }) : null
487
+ r != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: r }) : null,
488
+ d != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: d }) : null
480
489
  ] }),
481
- /* @__PURE__ */ e("main", { className: "cms-shell__main", children: h })
490
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
482
491
  ] });
483
492
  }
484
- function ue({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
485
- return /* @__PURE__ */ r(
493
+ function be({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
494
+ return /* @__PURE__ */ i(
486
495
  "form",
487
496
  {
488
497
  role: "search",
@@ -507,68 +516,70 @@ function ue({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
507
516
  }
508
517
  );
509
518
  }
510
- function he({ options: l, value: n, onChange: a, label: c }) {
511
- const s = x([]), m = (t, u) => {
519
+ function ge({ options: l, value: n, onChange: a, label: c }) {
520
+ const s = x([]), m = (r, d) => {
512
521
  var f;
513
- const h = l.length - 1, o = t.key === "ArrowRight" || t.key === "ArrowDown" ? u === h ? 0 : u + 1 : t.key === "ArrowLeft" || t.key === "ArrowUp" ? u === 0 ? h : u - 1 : null;
514
- if (o === null) return;
515
- t.preventDefault();
516
- const i = l[o];
517
- i && (a(i.id), (f = s.current[o]) == null || f.focus());
522
+ const u = l.length - 1, h = r.key === "ArrowRight" || r.key === "ArrowDown" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" || r.key === "ArrowUp" ? d === 0 ? u : d - 1 : null;
523
+ if (h === null) return;
524
+ r.preventDefault();
525
+ const t = l[h];
526
+ t && (a(t.id), (f = s.current[h]) == null || f.focus());
518
527
  };
519
- return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((t, u) => {
520
- const h = t.id === n;
521
- return /* @__PURE__ */ r(
528
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((r, d) => {
529
+ const u = r.id === n;
530
+ return /* @__PURE__ */ i(
522
531
  "button",
523
532
  {
524
- ref: (o) => {
525
- s.current[u] = o;
533
+ ref: (h) => {
534
+ s.current[d] = h;
526
535
  },
527
536
  type: "button",
528
537
  role: "radio",
529
- "aria-checked": h,
530
- tabIndex: h ? 0 : -1,
531
- className: g("cms-chip", h && "is-on"),
532
- onClick: () => a(t.id),
533
- onKeyDown: (o) => m(o, u),
538
+ "aria-checked": u,
539
+ tabIndex: u ? 0 : -1,
540
+ className: v("cms-chip", u && "is-on"),
541
+ onClick: () => a(r.id),
542
+ onKeyDown: (h) => m(h, d),
534
543
  children: [
535
- h ? /* @__PURE__ */ e(y, { name: "check", size: 16 }) : null,
536
- t.label
544
+ u ? /* @__PURE__ */ e(y, { name: "check", size: 16 }) : null,
545
+ r.label
537
546
  ]
538
547
  },
539
- t.id
548
+ r.id
540
549
  );
541
550
  }) });
542
551
  }
543
- function fe({ panes: l, active: n, back: a }) {
552
+ function ve({ panes: l, active: n, back: a }) {
544
553
  const c = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
545
- return /* @__PURE__ */ e("div", { className: g("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((s, m) => /* @__PURE__ */ r("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": c - m, children: [
546
- m === c && a ? /* @__PURE__ */ r("a", { className: "cms-panes__back", href: a.href, children: [
554
+ return /* @__PURE__ */ e("div", { className: v("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((s, m) => /* @__PURE__ */ i("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": c - m, children: [
555
+ m === c && a ? /* @__PURE__ */ i("a", { className: "cms-panes__back", href: a.href, children: [
547
556
  /* @__PURE__ */ e(y, { name: "chevron-left", size: 18 }),
548
557
  a.label
549
558
  ] }) : null,
550
559
  s.content
551
560
  ] }, s.label)) });
552
561
  }
553
- function pe({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment: m, selected: t, onOpen: u }) {
554
- return /* @__PURE__ */ r(
562
+ const Q = { attachment: "Has an attachment", unread: "Unread" };
563
+ function Ne({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment: m, selected: r, onOpen: d, labels: u }) {
564
+ const h = L(Q, u);
565
+ return /* @__PURE__ */ i(
555
566
  "button",
556
567
  {
557
568
  type: "button",
558
- className: g("cms-mail-row", s && "is-unread", t && "is-selected"),
559
- "aria-current": t ? "true" : void 0,
560
- onClick: u,
569
+ className: v("cms-mail-row", s && "is-unread", r && "is-selected"),
570
+ "aria-current": r ? "true" : void 0,
571
+ onClick: d,
561
572
  children: [
562
- /* @__PURE__ */ e($, { name: l, size: 40 }),
563
- /* @__PURE__ */ r("span", { className: "cms-mail-row__body", children: [
564
- /* @__PURE__ */ r("span", { className: "cms-mail-row__line", children: [
573
+ /* @__PURE__ */ e(S, { name: l, size: 40 }),
574
+ /* @__PURE__ */ i("span", { className: "cms-mail-row__body", children: [
575
+ /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
565
576
  /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
566
- m ? /* @__PURE__ */ e(y, { name: "paperclip", size: 16, label: "Has an attachment" }) : null,
577
+ m ? /* @__PURE__ */ e(y, { name: "paperclip", size: 16, label: h.attachment }) : null,
567
578
  /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: c })
568
579
  ] }),
569
- /* @__PURE__ */ r("span", { className: "cms-mail-row__line", children: [
580
+ /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
570
581
  /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
571
- s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": "Unread" }) : null
582
+ s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": h.unread }) : null
572
583
  ] }),
573
584
  /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
574
585
  ] })
@@ -576,62 +587,86 @@ function pe({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment
576
587
  }
577
588
  );
578
589
  }
579
- function _e({ direction: l, children: n, time: a, read: c }) {
580
- return /* @__PURE__ */ r("div", { className: g("cms-bubble", `cms-bubble--${l}`), children: [
590
+ function ye({ direction: l, children: n, time: a, read: c, readLabel: s = "Read" }) {
591
+ return /* @__PURE__ */ i("div", { className: v("cms-bubble", `cms-bubble--${l}`), children: [
581
592
  /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
582
- /* @__PURE__ */ r("div", { className: "cms-bubble__meta", children: [
593
+ /* @__PURE__ */ i("div", { className: "cms-bubble__meta", children: [
583
594
  a,
584
- l === "out" && c ? /* @__PURE__ */ e(b, { children: " · Read" }) : null
595
+ l === "out" && c ? /* @__PURE__ */ i(g, { children: [
596
+ " · ",
597
+ s
598
+ ] }) : null
585
599
  ] })
586
600
  ] });
587
601
  }
588
- function be({ label: l, value: n, onChange: a, onSend: c, onAttach: s, placeholder: m, variant: t = "chat", sendLabel: u = "Send" }) {
589
- const h = A(), o = n.trim() === "", i = (d) => {
590
- d.preventDefault(), o || c();
591
- }, f = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": "Attach a file", onClick: s, children: /* @__PURE__ */ e(y, { name: "paperclip" }) }) : null;
592
- return /* @__PURE__ */ r("form", { className: g("cms-composer", `cms-composer--${t}`), onSubmit: i, children: [
593
- /* @__PURE__ */ e("label", { htmlFor: h, className: t === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
594
- t === "chat" ? f : null,
602
+ function we({ label: l, value: n, onChange: a, onSend: c, onAttach: s, placeholder: m, variant: r = "chat", sendLabel: d = "Send", attachLabel: u = "Attach a file" }) {
603
+ const h = E(), t = n.trim() === "", f = (p) => {
604
+ p.preventDefault(), t || c();
605
+ }, o = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": u, onClick: s, children: /* @__PURE__ */ e(y, { name: "paperclip" }) }) : null;
606
+ return /* @__PURE__ */ i("form", { className: v("cms-composer", `cms-composer--${r}`), onSubmit: f, children: [
607
+ /* @__PURE__ */ e("label", { htmlFor: h, className: r === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
608
+ r === "chat" ? o : null,
595
609
  /* @__PURE__ */ e(
596
610
  "textarea",
597
611
  {
598
612
  id: h,
599
613
  className: "cms-composer__input",
600
- rows: t === "reply" ? 3 : 1,
614
+ rows: r === "reply" ? 3 : 1,
601
615
  placeholder: m,
602
616
  value: n,
603
- onChange: (d) => a(d.target.value),
604
- onKeyDown: (d) => {
605
- t === "chat" && d.key === "Enter" && !d.shiftKey && (d.preventDefault(), o || c());
617
+ onChange: (p) => a(p.target.value),
618
+ onKeyDown: (p) => {
619
+ p.nativeEvent.isComposing || p.keyCode === 229 || r === "chat" && p.key === "Enter" && !p.shiftKey && (p.preventDefault(), t || c());
606
620
  }
607
621
  }
608
622
  ),
609
- t === "reply" ? f : null,
610
- t === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": u, disabled: o, children: /* @__PURE__ */ e(y, { name: "send" }) }) : /* @__PURE__ */ r("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: o, children: [
611
- u,
623
+ r === "reply" ? o : null,
624
+ r === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": d, disabled: t, children: /* @__PURE__ */ e(y, { name: "send" }) }) : /* @__PURE__ */ i("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: t, children: [
625
+ d,
612
626
  " ",
613
627
  /* @__PURE__ */ e(y, { name: "send", size: 18 })
614
628
  ] })
615
629
  ] });
616
630
  }
617
- function ve({ name: l, media: n, onAccept: a, onDecline: c }) {
618
- const s = n === "video" ? "Incoming video call" : "Incoming audio call";
619
- return /* @__PURE__ */ r("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": `${s} from ${l}`, children: [
620
- /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e($, { name: l, size: 112 }) }),
631
+ const Z = {
632
+ incomingAudio: "Incoming audio call",
633
+ incomingVideo: "Incoming video call",
634
+ incomingFrom: (l, n) => `${l} from ${n}`,
635
+ accept: "Accept",
636
+ decline: "Decline",
637
+ callWith: (l) => `Call with ${l}`,
638
+ callTime: (l) => `Call time ${l}`,
639
+ goodConnection: "Good connection",
640
+ poorConnection: "Poor connection",
641
+ you: "You",
642
+ speaking: "Speaking",
643
+ mute: "Mute",
644
+ unmute: "Unmute",
645
+ speaker: "Speaker",
646
+ addPerson: "Add person",
647
+ chat: "Chat",
648
+ hangUp: "Hang up",
649
+ onCallWith: (l) => `On a call with ${l}`,
650
+ returnToCall: "Return to call"
651
+ };
652
+ function ke({ name: l, media: n, onAccept: a, onDecline: c, labels: s }) {
653
+ const m = L(Z, s), r = n === "video" ? m.incomingVideo : m.incomingAudio;
654
+ return /* @__PURE__ */ i("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": m.incomingFrom(r, l), children: [
655
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(S, { name: l, size: 112 }) }),
621
656
  /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
622
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: s }),
623
- /* @__PURE__ */ r("div", { className: "cms-call-incoming__actions", children: [
624
- /* @__PURE__ */ e(C, { icon: "phone-off", label: "Decline", tone: "hang-up", onClick: c }),
625
- /* @__PURE__ */ e(C, { icon: "phone", label: "Accept", tone: "accept", onClick: a })
657
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: r }),
658
+ /* @__PURE__ */ i("div", { className: "cms-call-incoming__actions", children: [
659
+ /* @__PURE__ */ e(A, { icon: "phone-off", label: m.decline, tone: "hang-up", onClick: c }),
660
+ /* @__PURE__ */ e(A, { icon: "phone", label: m.accept, tone: "accept", onClick: a })
626
661
  ] })
627
662
  ] });
628
663
  }
629
- function C({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
630
- return /* @__PURE__ */ r(
664
+ function A({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
665
+ return /* @__PURE__ */ i(
631
666
  "button",
632
667
  {
633
668
  type: "button",
634
- className: g("cms-call-button", `cms-call-button--${c}`, s && "is-pressed"),
669
+ className: v("cms-call-button", `cms-call-button--${c}`, s && "is-pressed"),
635
670
  "aria-pressed": s,
636
671
  onClick: a,
637
672
  children: [
@@ -641,191 +676,202 @@ function C({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
641
676
  }
642
677
  );
643
678
  }
644
- function ge({ name: l, duration: n, connection: a, you: c, muted: s, speaker: m, onToggleMute: t, onToggleSpeaker: u, onAddPerson: h, onChat: o, onHangUp: i }) {
645
- return /* @__PURE__ */ r("section", { className: "cms-call-panel", "aria-label": `Call with ${l}`, children: [
646
- /* @__PURE__ */ r("div", { className: "cms-call-panel__head", children: [
647
- /* @__PURE__ */ e($, { name: l, size: 64 }),
648
- /* @__PURE__ */ r("div", { className: "cms-call-panel__who", children: [
679
+ function Me({ name: l, duration: n, connection: a, you: c, muted: s, speaker: m, onToggleMute: r, onToggleSpeaker: d, onAddPerson: u, onChat: h, onHangUp: t, labels: f }) {
680
+ const o = L(Z, f);
681
+ return /* @__PURE__ */ i("section", { className: "cms-call-panel", "aria-label": o.callWith(l), children: [
682
+ /* @__PURE__ */ i("div", { className: "cms-call-panel__head", children: [
683
+ /* @__PURE__ */ e(S, { name: l, size: 64 }),
684
+ /* @__PURE__ */ i("div", { className: "cms-call-panel__who", children: [
649
685
  /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: l }),
650
- /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": `Call time ${n}`, children: n })
686
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": o.callTime(n), children: n })
651
687
  ] }),
652
- /* @__PURE__ */ e("span", { className: g("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? "Good connection" : "Poor connection" })
688
+ /* @__PURE__ */ e("span", { className: v("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? o.goodConnection : o.poorConnection })
653
689
  ] }),
654
- /* @__PURE__ */ r("div", { className: "cms-call-panel__you", children: [
655
- /* @__PURE__ */ e($, { name: c.name, size: 36 }),
656
- /* @__PURE__ */ e("span", { children: "You" }),
657
- c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": "Speaking" }) : null
690
+ /* @__PURE__ */ i("div", { className: "cms-call-panel__you", children: [
691
+ /* @__PURE__ */ e(S, { name: c.name, size: 36 }),
692
+ /* @__PURE__ */ e("span", { children: o.you }),
693
+ c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": o.speaking }) : null
658
694
  ] }),
659
- /* @__PURE__ */ r("div", { className: "cms-call-panel__controls", children: [
660
- /* @__PURE__ */ e(C, { icon: "mic", label: s ? "Unmute" : "Mute", pressed: s, onClick: t }),
661
- /* @__PURE__ */ e(C, { icon: "speaker", label: "Speaker", pressed: m, onClick: u }),
662
- h ? /* @__PURE__ */ e(C, { icon: "user-plus", label: "Add person", onClick: h }) : null,
663
- o ? /* @__PURE__ */ e(C, { icon: "chat", label: "Chat", onClick: o }) : null,
664
- /* @__PURE__ */ e(C, { icon: "phone-off", label: "Hang up", tone: "hang-up", onClick: i })
695
+ /* @__PURE__ */ i("div", { className: "cms-call-panel__controls", children: [
696
+ /* @__PURE__ */ e(A, { icon: "mic", label: s ? o.unmute : o.mute, pressed: s, onClick: r }),
697
+ /* @__PURE__ */ e(A, { icon: "speaker", label: o.speaker, pressed: m, onClick: d }),
698
+ u ? /* @__PURE__ */ e(A, { icon: "user-plus", label: o.addPerson, onClick: u }) : null,
699
+ h ? /* @__PURE__ */ e(A, { icon: "chat", label: o.chat, onClick: h }) : null,
700
+ /* @__PURE__ */ e(A, { icon: "phone-off", label: o.hangUp, tone: "hang-up", onClick: t })
665
701
  ] })
666
702
  ] });
667
703
  }
668
- function Ne({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: s, onHangUp: m }) {
669
- return /* @__PURE__ */ r("section", { className: "cms-call-bar", "aria-label": `Call with ${l}`, children: [
704
+ function Ce({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: s, onHangUp: m, labels: r }) {
705
+ const d = L(Z, r);
706
+ return /* @__PURE__ */ i("section", { className: "cms-call-bar", "aria-label": d.callWith(l), children: [
670
707
  /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
671
- /* @__PURE__ */ r("span", { className: "cms-call-bar__name", children: [
672
- "On a call with ",
673
- l
674
- ] }),
708
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: d.onCallWith(l) }),
675
709
  /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
676
- /* @__PURE__ */ r("span", { className: "cms-call-bar__actions", children: [
677
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? "Unmute" : "Mute", "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(y, { name: "mic" }) }),
678
- /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: "Return to call" }),
679
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": "Hang up", onClick: m, children: /* @__PURE__ */ e(y, { name: "phone-off" }) })
710
+ /* @__PURE__ */ i("span", { className: "cms-call-bar__actions", children: [
711
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? d.unmute : d.mute, "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(y, { name: "mic" }) }),
712
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: d.returnToCall }),
713
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": d.hangUp, onClick: m, children: /* @__PURE__ */ e(y, { name: "phone-off" }) })
680
714
  ] })
681
715
  ] });
682
716
  }
683
- function ye({ mark: l, product: n, headline: a, lead: c, features: s = [], children: m }) {
684
- return /* @__PURE__ */ r("div", { className: "cms-signin", children: [
685
- /* @__PURE__ */ r("aside", { className: "cms-signin__brand", children: [
686
- /* @__PURE__ */ r("p", { className: "cms-signin__logo", children: [
717
+ function xe({ mark: l, product: n, headline: a, lead: c, features: s = [], children: m }) {
718
+ return /* @__PURE__ */ i("div", { className: "cms-signin", children: [
719
+ /* @__PURE__ */ i("aside", { className: "cms-signin__brand", children: [
720
+ /* @__PURE__ */ i("p", { className: "cms-signin__logo", children: [
687
721
  /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: l }),
688
722
  n
689
723
  ] }),
690
- /* @__PURE__ */ r("div", { className: "cms-signin__pitch", children: [
724
+ /* @__PURE__ */ i("div", { className: "cms-signin__pitch", children: [
691
725
  /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
692
726
  /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
693
- s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((t) => /* @__PURE__ */ r("li", { children: [
694
- /* @__PURE__ */ e(y, { name: t.icon, size: 18 }),
695
- t.label
696
- ] }, t.label)) }) : null
727
+ s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((r) => /* @__PURE__ */ i("li", { children: [
728
+ /* @__PURE__ */ e(y, { name: r.icon, size: 18 }),
729
+ r.label
730
+ ] }, r.label)) }) : null
697
731
  ] })
698
732
  ] }),
699
733
  /* @__PURE__ */ e("main", { className: "cms-signin__form", children: m })
700
734
  ] });
701
735
  }
702
- function we({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: s, busy: m }) {
703
- const t = A(), [u, h] = M(""), [o, i] = M(""), [f, d] = M(!1);
704
- return /* @__PURE__ */ r("form", { className: "cms-signin-form", onSubmit: (_) => {
705
- _.preventDefault(), n(u, o);
706
- }, "aria-describedby": s ? `${t}-error` : void 0, children: [
707
- /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: "Sign in" }),
708
- /* @__PURE__ */ r("p", { className: "cms-signin-form__server", children: [
736
+ const J = {
737
+ title: "Sign in",
738
+ identifier: "Email or username",
739
+ identifierPlaceholder: "name@example.com",
740
+ password: "Password",
741
+ show: "Show",
742
+ hide: "Hide",
743
+ forgot: "Forgot password?",
744
+ submit: "Sign in",
745
+ newHere: "New here?",
746
+ create: "Create an account"
747
+ };
748
+ function Ae({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: s, busy: m, labels: r }) {
749
+ const d = L(J, r), u = E(), [h, t] = C(""), [f, o] = C(""), [p, b] = C(!1);
750
+ return /* @__PURE__ */ i("form", { className: "cms-signin-form", onSubmit: (_) => {
751
+ _.preventDefault(), n(h, f);
752
+ }, "aria-describedby": s ? `${u}-error` : void 0, children: [
753
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: d.title }),
754
+ /* @__PURE__ */ i("p", { className: "cms-signin-form__server", children: [
709
755
  /* @__PURE__ */ e(y, { name: "server", size: 18 }),
710
756
  l
711
757
  ] }),
712
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${t}-identifier`, children: "Email or username" }),
758
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-identifier`, children: d.identifier }),
713
759
  /* @__PURE__ */ e(
714
760
  "input",
715
761
  {
716
- id: `${t}-identifier`,
717
- className: "cms-field",
762
+ id: `${u}-identifier`,
763
+ className: "cms-signin-form__input",
718
764
  type: "text",
719
765
  autoComplete: "username",
720
- placeholder: "name@example.com",
721
- value: u,
722
- onChange: (_) => h(_.target.value),
766
+ placeholder: d.identifierPlaceholder,
767
+ value: h,
768
+ onChange: (_) => t(_.target.value),
723
769
  required: !0
724
770
  }
725
771
  ),
726
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${t}-password`, children: "Password" }),
727
- /* @__PURE__ */ r("span", { className: "cms-signin-form__password", children: [
772
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-password`, children: d.password }),
773
+ /* @__PURE__ */ i("span", { className: "cms-signin-form__password", children: [
728
774
  /* @__PURE__ */ e(
729
775
  "input",
730
776
  {
731
- id: `${t}-password`,
732
- className: "cms-field",
733
- type: f ? "text" : "password",
777
+ id: `${u}-password`,
778
+ className: "cms-signin-form__input",
779
+ type: p ? "text" : "password",
734
780
  autoComplete: "current-password",
735
- value: o,
736
- onChange: (_) => i(_.target.value),
781
+ value: f,
782
+ onChange: (_) => o(_.target.value),
737
783
  required: !0
738
784
  }
739
785
  ),
740
- /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": f, onClick: () => d((_) => !_), children: f ? "Hide" : "Show" })
786
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": p, onClick: () => b((_) => !_), children: p ? d.hide : d.show })
741
787
  ] }),
742
- a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: "Forgot password?" }) : null,
743
- s ? /* @__PURE__ */ e("p", { id: `${t}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
744
- /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: "Sign in" }),
745
- c ? /* @__PURE__ */ r(b, { children: [
746
- /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: "New here?" }) }),
747
- /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: "Create an account" })
788
+ a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: d.forgot }) : null,
789
+ s ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
790
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: d.submit }),
791
+ c ? /* @__PURE__ */ i(g, { children: [
792
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: d.newHere }) }),
793
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: d.create })
748
794
  ] }) : null
749
795
  ] });
750
796
  }
751
- function ke({ label: l, rows: n, error: a, onRetry: c, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: t, selected: u, onOpen: h, onRowMenu: o }) {
752
- const i = x([]);
753
- if (a != null) return /* @__PURE__ */ e(j, { message: a, onRetry: c });
754
- if (n === null) return /* @__PURE__ */ e(P, { what: s, layout: "block" });
755
- if (n.length === 0) return /* @__PURE__ */ e(V, { title: m, hint: t });
756
- const f = (d, v, _) => {
757
- var p;
758
- if (d.key === "ArrowDown" || d.key === "ArrowUp")
759
- d.preventDefault(), (p = i.current[Math.min(n.length - 1, Math.max(0, v + (d.key === "ArrowDown" ? 1 : -1)))]) == null || p.focus();
760
- else if (d.key === "Enter")
761
- h == null || h(_);
762
- else if ((d.key === "ContextMenu" || d.shiftKey && d.key === "F10") && o) {
763
- d.preventDefault();
764
- const N = d.currentTarget.getBoundingClientRect();
765
- o(_, { x: N.left + 16, y: N.bottom });
797
+ function Ee({ label: l, rows: n, error: a, onRetry: c, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: r, selected: d, onOpen: u, onRowMenu: h }) {
798
+ const t = x([]);
799
+ if (a != null) return /* @__PURE__ */ e(q, { message: a, onRetry: c });
800
+ if (n === null) return /* @__PURE__ */ e(U, { what: s, layout: "block" });
801
+ if (n.length === 0) return /* @__PURE__ */ e(W, { title: m, hint: r });
802
+ const f = (o, p, b) => {
803
+ var N;
804
+ if (o.key === "ArrowDown" || o.key === "ArrowUp")
805
+ o.preventDefault(), (N = t.current[Math.min(n.length - 1, Math.max(0, p + (o.key === "ArrowDown" ? 1 : -1)))]) == null || N.focus();
806
+ else if (o.key === "Enter")
807
+ u == null || u(b);
808
+ else if ((o.key === "ContextMenu" || o.shiftKey && o.key === "F10") && h) {
809
+ o.preventDefault();
810
+ const _ = o.currentTarget.getBoundingClientRect();
811
+ h(b, { x: _.left + 16, y: _.bottom });
766
812
  }
767
813
  };
768
- return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((d, v) => {
769
- const _ = d.id === u;
770
- return /* @__PURE__ */ r(
814
+ return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((o, p) => {
815
+ const b = o.id === d;
816
+ return /* @__PURE__ */ i(
771
817
  "li",
772
818
  {
773
- ref: (p) => {
774
- i.current[v] = p;
819
+ ref: (N) => {
820
+ t.current[p] = N;
775
821
  },
776
822
  role: "option",
777
- "aria-selected": _,
778
- tabIndex: _ || u == null && v === 0 ? 0 : -1,
779
- className: g("cms-list__row", _ && "is-selected"),
780
- onClick: () => h == null ? void 0 : h(d.id),
781
- onKeyDown: (p) => f(p, v, d.id),
782
- onContextMenu: o ? (p) => {
783
- p.preventDefault(), o(d.id, { x: p.clientX, y: p.clientY });
823
+ "aria-selected": b,
824
+ tabIndex: b || d == null && p === 0 ? 0 : -1,
825
+ className: v("cms-list__row", b && "is-selected"),
826
+ onClick: () => u == null ? void 0 : u(o.id),
827
+ onKeyDown: (N) => f(N, p, o.id),
828
+ onContextMenu: h ? (N) => {
829
+ N.preventDefault(), h(o.id, { x: N.clientX, y: N.clientY });
784
830
  } : void 0,
785
831
  children: [
786
- d.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: d.lead }) : null,
787
- /* @__PURE__ */ r("span", { className: "cms-list__text", children: [
788
- /* @__PURE__ */ e("span", { className: "cms-list__primary", children: d.primary }),
789
- d.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: d.secondary }) : null
832
+ o.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: o.lead }) : null,
833
+ /* @__PURE__ */ i("span", { className: "cms-list__text", children: [
834
+ /* @__PURE__ */ e("span", { className: "cms-list__primary", children: o.primary }),
835
+ o.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: o.secondary }) : null
790
836
  ] }),
791
- d.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: d.meta }) : null
837
+ o.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: o.meta }) : null
792
838
  ]
793
839
  },
794
- d.id
840
+ o.id
795
841
  );
796
842
  }) });
797
843
  }
798
- function Me({ at: l, items: n, onClose: a, label: c = "Actions" }) {
799
- const s = x(null), m = x(null), [t, u] = M(l), h = n.filter((i) => i.offer.offered);
800
- if (F(() => {
844
+ function Le({ at: l, items: n, onClose: a, label: c = "Actions" }) {
845
+ const s = x(null), m = x(null), [r, d] = C(l), u = n.filter((t) => t.offer.offered);
846
+ if (R(() => {
801
847
  if (!l) return;
802
- const i = s.current, f = (i == null ? void 0 : i.offsetWidth) ?? 0, d = (i == null ? void 0 : i.offsetHeight) ?? 0;
803
- u({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - d)) });
848
+ const t = s.current, f = (t == null ? void 0 : t.offsetWidth) ?? 0, o = (t == null ? void 0 : t.offsetHeight) ?? 0;
849
+ d({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - o)) });
804
850
  }, [l]), D(() => {
805
- var f, d;
851
+ var f, o;
806
852
  if (!l) return;
807
- m.current = document.activeElement, (d = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || d.focus();
808
- const i = (v) => {
809
- var _;
810
- (_ = s.current) != null && _.contains(v.target) || a();
853
+ m.current = document.activeElement, (o = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || o.focus();
854
+ const t = (p) => {
855
+ var b;
856
+ (b = s.current) != null && b.contains(p.target) || a();
811
857
  };
812
- return document.addEventListener("mousedown", i), () => {
813
- var v, _;
814
- document.removeEventListener("mousedown", i), (_ = (v = m.current) == null ? void 0 : v.focus) == null || _.call(v);
858
+ return document.addEventListener("mousedown", t), () => {
859
+ var p, b;
860
+ document.removeEventListener("mousedown", t), (b = (p = m.current) == null ? void 0 : p.focus) == null || b.call(p);
815
861
  };
816
- }, [l, a]), !l || h.length === 0) return null;
817
- const o = (i) => {
818
- var v, _;
819
- const f = Array.from(((v = s.current) == null ? void 0 : v.querySelectorAll('[role="menuitem"]')) ?? []), d = f.indexOf(document.activeElement);
820
- if (i.key === "Escape" || i.key === "Tab")
821
- i.preventDefault(), a();
822
- else if (i.key === "ArrowDown" || i.key === "ArrowUp") {
823
- i.preventDefault();
824
- const p = i.key === "ArrowDown" ? 1 : -1;
825
- (_ = f[(d + p + f.length) % f.length]) == null || _.focus();
862
+ }, [l, a]), !l || u.length === 0) return null;
863
+ const h = (t) => {
864
+ var p, b;
865
+ const f = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []), o = f.indexOf(document.activeElement);
866
+ if (t.key === "Escape" || t.key === "Tab")
867
+ t.preventDefault(), a();
868
+ else if (t.key === "ArrowDown" || t.key === "ArrowUp") {
869
+ t.preventDefault();
870
+ const N = t.key === "ArrowDown" ? 1 : -1;
871
+ (b = f[(o + N + f.length) % f.length]) == null || b.focus();
826
872
  }
827
873
  };
828
- return Z(
874
+ return F(
829
875
  /* @__PURE__ */ e(
830
876
  "div",
831
877
  {
@@ -833,32 +879,32 @@ function Me({ at: l, items: n, onClose: a, label: c = "Actions" }) {
833
879
  className: "cms-menu",
834
880
  role: "menu",
835
881
  "aria-label": c,
836
- style: { left: (t ?? l).x, top: (t ?? l).y },
837
- onKeyDown: o,
838
- onContextMenu: (i) => i.preventDefault(),
839
- children: h.map((i) => {
840
- const f = i.offer.refusal !== void 0;
841
- return /* @__PURE__ */ r(
882
+ style: { left: (r ?? l).x, top: (r ?? l).y },
883
+ onKeyDown: h,
884
+ onContextMenu: (t) => t.preventDefault(),
885
+ children: u.map((t) => {
886
+ const f = t.offer.refusal !== void 0;
887
+ return /* @__PURE__ */ i(
842
888
  "div",
843
889
  {
844
890
  role: "menuitem",
845
891
  tabIndex: -1,
846
892
  "aria-disabled": f || void 0,
847
- title: f ? i.offer.refusal : void 0,
848
- className: g("cms-menu__item", i.danger && "is-danger", i.offer.locked && "is-locked", f && "is-refused"),
893
+ title: f ? t.offer.refusal : void 0,
894
+ className: v("cms-menu__item", t.danger && "is-danger", t.offer.locked && "is-locked", f && "is-refused"),
849
895
  onClick: () => {
850
- f || (a(), i.onSelect());
896
+ f || (a(), t.onSelect());
851
897
  },
852
- onKeyDown: (d) => {
853
- (d.key === "Enter" || d.key === " ") && !f && (d.preventDefault(), a(), i.onSelect());
898
+ onKeyDown: (o) => {
899
+ (o.key === "Enter" || o.key === " ") && !f && (o.preventDefault(), a(), t.onSelect());
854
900
  },
855
901
  children: [
856
- i.offer.locked ? /* @__PURE__ */ e(k, { name: "lock" }) : null,
857
- /* @__PURE__ */ e("span", { className: "cms-menu__label", children: i.label }),
858
- f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: i.offer.refusal }) : null
902
+ t.offer.locked ? /* @__PURE__ */ e(k, { name: "lock" }) : null,
903
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: t.label }),
904
+ f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: t.offer.refusal }) : null
859
905
  ]
860
906
  },
861
- i.id
907
+ t.id
862
908
  );
863
909
  })
864
910
  }
@@ -866,11 +912,11 @@ function Me({ at: l, items: n, onClose: a, label: c = "Actions" }) {
866
912
  document.body
867
913
  );
868
914
  }
869
- function G(l) {
915
+ function O(l) {
870
916
  return l === "allowed" || l === "elevate" || l === "denied";
871
917
  }
872
- function xe(l, n) {
873
- if (!G(l))
918
+ function De(l, n) {
919
+ if (!O(l))
874
920
  return n.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
875
921
  switch (l) {
876
922
  case "allowed":
@@ -881,108 +927,111 @@ function xe(l, n) {
881
927
  return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
882
928
  }
883
929
  }
884
- function X(l, n) {
930
+ function ee(l, n) {
885
931
  if (!l) return;
886
932
  if (typeof l.get == "function") return l.get(n) ?? void 0;
887
933
  const a = l, c = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
888
934
  return c === void 0 ? void 0 : a[c];
889
935
  }
890
- function Y(l) {
936
+ function le(l) {
891
937
  if (l && typeof l == "object") {
892
938
  const n = l;
893
939
  if (typeof n.detail == "string" && n.detail !== "") return n.detail;
894
940
  if (typeof n.title == "string" && n.title !== "") return n.title;
895
941
  }
896
942
  }
897
- function Ce(l, n, a, c) {
943
+ function $e(l, n, a, c) {
898
944
  if (l !== 403) return { kind: "none" };
899
- const s = Y(a);
900
- return X(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
901
- }
902
- const S = "coolms-kit:reread";
903
- function Ae() {
904
- window.dispatchEvent(new Event(S));
905
- }
906
- function De(l) {
907
- const [n, a] = M(void 0), [c, s] = M(void 0), [m, t] = M(!0), u = x(l);
908
- u.current = l;
909
- const h = x(0), o = H(() => {
910
- const i = ++h.current;
911
- t(!0), u.current().then(
945
+ const s = le(a);
946
+ return ee(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
947
+ }
948
+ const I = "coolms-kit:reread";
949
+ function Se() {
950
+ window.dispatchEvent(new Event(I));
951
+ }
952
+ function Te(l) {
953
+ const [n, a] = C(void 0), [c, s] = C(void 0), [m, r] = C(!0), d = x(l);
954
+ d.current = l;
955
+ const u = x(0), h = V(() => {
956
+ const t = ++u.current;
957
+ r(!0), d.current().then(
912
958
  (f) => {
913
- i === h.current && (a(f), s(void 0), t(!1));
959
+ t === u.current && (a(f), s(void 0), r(!1));
914
960
  },
915
961
  (f) => {
916
- i === h.current && (s(f), t(!1));
962
+ t === u.current && (s(f), r(!1));
917
963
  }
918
964
  );
919
965
  }, []);
920
966
  return D(() => {
921
- o();
922
- const i = () => o();
923
- return window.addEventListener("focus", i), window.addEventListener(S, i), () => {
924
- window.removeEventListener("focus", i), window.removeEventListener(S, i);
967
+ h();
968
+ const t = () => h();
969
+ return window.addEventListener("focus", t), window.addEventListener(I, t), () => {
970
+ window.removeEventListener("focus", t), window.removeEventListener(I, t);
925
971
  };
926
- }, [o]), { value: n, error: c, loading: m, reread: o };
972
+ }, [h]), { value: n, error: c, loading: m, reread: h };
927
973
  }
928
- function Ee(l) {
974
+ function Ie(l) {
929
975
  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 };
930
976
  }
931
- const Q = "/errors/client-update-required";
932
- function J(l, n) {
977
+ const ne = "/errors/client-update-required";
978
+ function ae(l, n) {
933
979
  const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), c = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
934
980
  for (let s = 0; s < Math.max(a.length, c.length); s++) {
935
- const m = a[s] ?? 0, t = c[s] ?? 0;
936
- if (m !== t) return m < t;
981
+ const m = a[s] ?? 0, r = c[s] ?? 0;
982
+ if (m !== r) return m < r;
937
983
  }
938
984
  return !1;
939
985
  }
940
- function $e(l) {
941
- return l.problemType !== void 0 && l.problemType.endsWith(Q) ? !0 : l.minimumVersion !== void 0 && J(l.version, l.minimumVersion);
986
+ function Ze(l) {
987
+ return l.problemType !== void 0 && l.problemType.endsWith(ne) ? !0 : l.minimumVersion !== void 0 && ae(l.version, l.minimumVersion);
942
988
  }
943
989
  export {
944
- me as AppShell,
945
- $ as Avatar,
946
- W as Badge,
947
- E as Button,
948
- Q as CLIENT_UPDATE_REQUIRED,
949
- Ne as CallBar,
950
- ge as CallPanel,
951
- _e as ChatBubble,
952
- be as Composer,
953
- ce as ConfirmDialog,
954
- Me as ContextMenu,
955
- V as EmptyState,
956
- j as ErrorBanner,
957
- he as FilterChips,
958
- de as ICON_NAMES,
990
+ _e as AppShell,
991
+ S as Avatar,
992
+ Y as Badge,
993
+ $ as Button,
994
+ Z as CALL_LABELS,
995
+ ne as CLIENT_UPDATE_REQUIRED,
996
+ Ce as CallBar,
997
+ Me as CallPanel,
998
+ ye as ChatBubble,
999
+ we as Composer,
1000
+ de as ConfirmDialog,
1001
+ Le as ContextMenu,
1002
+ W as EmptyState,
1003
+ q as ErrorBanner,
1004
+ ge as FilterChips,
1005
+ pe as ICON_NAMES,
959
1006
  y as Icon,
960
- ve as IncomingCall,
961
- ke as List,
962
- P as Loading,
963
- R as MODAL_CLOSE_MS,
964
- pe as MailRow,
1007
+ ke as IncomingCall,
1008
+ Ee as List,
1009
+ U as Loading,
1010
+ Q as MAIL_ROW_LABELS,
1011
+ j as MODAL_CLOSE_MS,
1012
+ Ne as MailRow,
965
1013
  z as Modal,
966
- ie as PageHeader,
967
- ue as SearchField,
968
- ae as Select,
969
- we as SignInForm,
970
- ye as SignInLayout,
971
- fe as SplitPanes,
972
- oe as TabStrip,
973
- ne as TextField,
974
- te as Toast,
975
- re as ToastRegion,
976
- se as Toggle,
977
- q as initialsOf,
978
- G as isCapability,
979
- $e as needsClientUpdate,
980
- xe as offerFor,
981
- Ee as readConflict,
982
- Ce as readRefusal,
983
- Y as refusalText,
984
- Ae as rereadAll,
985
- U as tintOf,
986
- De as useReread,
987
- J as versionBelow
1014
+ he as PageHeader,
1015
+ J as SIGN_IN_LABELS,
1016
+ be as SearchField,
1017
+ ie as Select,
1018
+ Ae as SignInForm,
1019
+ xe as SignInLayout,
1020
+ ve as SplitPanes,
1021
+ fe as TabStrip,
1022
+ re as TextField,
1023
+ me as Toast,
1024
+ ue as ToastRegion,
1025
+ oe as Toggle,
1026
+ G as initialsOf,
1027
+ O as isCapability,
1028
+ Ze as needsClientUpdate,
1029
+ De as offerFor,
1030
+ Ie as readConflict,
1031
+ $e as readRefusal,
1032
+ le as refusalText,
1033
+ Se as rereadAll,
1034
+ X as tintOf,
1035
+ Te as useReread,
1036
+ ae as versionBelow
988
1037
  };