@stackone/malachite 2.42.1 → 2.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
1
  import { jsxs as U, jsx as h } from "react/jsx-runtime";
2
- import C, { useRef as T, useState as M, useLayoutEffect as v, useCallback as x } from "react";
3
- import ae from "./CustomIcons/ArrowLeftIcon.js";
4
- import ce from "./CustomIcons/ForwardArrowIcon.js";
5
- import se from "./CustomIcons/PlusIcon.js";
2
+ import C, { useRef as T, useState as q, useLayoutEffect as v, useCallback as x } from "react";
3
+ import se from "./CustomIcons/ArrowLeftIcon.js";
4
+ import ie from "./CustomIcons/ForwardArrowIcon.js";
5
+ import le from "./CustomIcons/PlusIcon.js";
6
6
  import { CONTENT_INSET as Dt } from "./PageLayout/constants.js";
7
- import { STRIP_RULE_PX as ie, CARD_FLARE_TIP_PX as st, CARD_WIDTH_PX as le, FLARE_CLASS as de, CARD_FLARE_PX as K } from "./SelectableCard.js";
8
- import { revealTargetFor as Ot, pageTargetFor as ue, EDGE_EPSILON_PX as at, isCardInView as fe } from "./cardStripGeometry.js";
9
- import { CardStripSlotContext as vt, PINNED_SLOT as pe, SCROLLED_SLOT as he } from "./cardStripSlot.js";
10
- import { FOCUS_RING as me } from "./focusRing.js";
7
+ import { STRIP_RULE_PX as de, CARD_FLARE_TIP_PX as st, CARD_WIDTH_PX as ue, FLARE_CLASS as fe, CARD_FLARE_PX as K } from "./SelectableCard.js";
8
+ import { revealTargetFor as Ot, pageTargetFor as pe, EDGE_EPSILON_PX as at, isCardInView as he } from "./cardStripGeometry.js";
9
+ import { CardStripSlotContext as vt, PINNED_SLOT as me, SCROLLED_SLOT as be } from "./cardStripSlot.js";
10
+ import { FOCUS_RING as Re } from "./focusRing.js";
11
11
  import { useAdoptedStyleSheet as wt } from "./useAdoptedStyleSheet.js";
12
- const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"]), G = '[role="radio"]', ge = "data-card-strip-scroller", Re = "data-card-strip-trough", j = "malachite-card-strip", g = "malachite-card-strip-scroller", zt = "malachite-card-strip-fade", R = "malachite-card-strip-add-tile", it = "data-card-strip-add-slot", Yt = "[data-selectable-card-actions]", _e = 'a[href], area[href], button, input, select, textarea, iframe, [contenteditable="true"], [tabindex]', B = "data-card-strip-prev-tabindex", Ae = 80, Ct = 11, H = 12, Vt = "var(--malachite-shadow-default)", Se = "var(--malachite-card-strip-arrow-background, var(--malachite-card-background, #ffffff))", xe = "var(--malachite-card-strip-arrow-border, #e8e8e8)", lt = "var(--malachite-card-strip-background, #f1f1f1)", It = "var(--malachite-radius-xxl, 14px)", Le = `${It} ${It} 0 0`, Pt = "var(--malachite-radius-xxxl, 16px)", Ee = `${Pt} ${Pt} 0 0`, w = 4, Te = H + w, Mt = H, kt = Ae + (Mt - w), ut = le, $e = 2 * (H + w) + ut, ye = "var(--malachite-card-strip-divider, #dddddd)", Nt = "var(--malachite-card-strip-fade, transparent)", De = "var(--malachite-selectable-card-hover-background, #e8e8e8)", Oe = "var(--malachite-card-strip-arrow-border, #e8e8e8)", Ft = "var(--malachite-selectable-card-hover-rule, #bbbbbb)", Ut = "0px 1px 0px 0px rgba(0, 0, 0, 0.4)", ve = "var(--malachite-card-background, #ffffff)", we = "var(--malachite-text-primary, #0a0a0a)", Ce = "var(--malachite-card-strip-add-primary-background, var(--malachite-text-primary, #0a0a0a))", Ie = "var(--malachite-card-strip-add-primary-foreground, var(--malachite-card-background, #ffffff))", Pe = "0px 1px 0px 0px rgba(10, 10, 10, 0.7)", ft = ie, Bt = 16, q = 9999, ke = 4, Ne = `
12
+ const ge = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"]), G = '[role="radio"]', _e = "data-card-strip-scroller", Ae = "data-card-strip-trough", j = "malachite-card-strip", R = "malachite-card-strip-scroller", zt = "malachite-card-strip-fade", g = "malachite-card-strip-add-tile", it = "data-card-strip-add-slot", Yt = "[data-selectable-card-actions]", Vt = "[data-selectable-card-link]", Se = 'a[href], area[href], button, input, select, textarea, iframe, [contenteditable="true"], [tabindex]', B = "data-card-strip-prev-tabindex", xe = 80, Ct = 11, H = 12, qt = "var(--malachite-shadow-default)", Le = "var(--malachite-card-strip-arrow-background, var(--malachite-card-background, #ffffff))", Ee = "var(--malachite-card-strip-arrow-border, #e8e8e8)", lt = "var(--malachite-card-strip-background, #f1f1f1)", It = "var(--malachite-radius-xxl, 14px)", Te = `${It} ${It} 0 0`, Pt = "var(--malachite-radius-xxxl, 16px)", $e = `${Pt} ${Pt} 0 0`, w = 4, ye = H + w, Mt = H, kt = xe + (Mt - w), ut = ue, De = 2 * (H + w) + ut, Oe = "var(--malachite-card-strip-divider, #dddddd)", Nt = "var(--malachite-card-strip-fade, transparent)", ve = "var(--malachite-selectable-card-hover-background, #e8e8e8)", we = "var(--malachite-card-strip-arrow-border, #e8e8e8)", Ft = "var(--malachite-selectable-card-hover-rule, #bbbbbb)", Ut = "0px 1px 0px 0px rgba(0, 0, 0, 0.4)", Ce = "var(--malachite-card-background, #ffffff)", Ie = "var(--malachite-text-primary, #0a0a0a)", Pe = "var(--malachite-card-strip-add-primary-background, var(--malachite-text-primary, #0a0a0a))", ke = "var(--malachite-card-strip-add-primary-foreground, var(--malachite-card-background, #ffffff))", Ne = "0px 1px 0px 0px rgba(10, 10, 10, 0.7)", ft = de, Bt = 16, M = 9999, Fe = 4, Ue = `
13
13
  .${j} {
14
- clip-path: inset(-${q}px -${q}px 0);
14
+ clip-path: inset(-${M}px -${M}px 0);
15
15
  }
16
16
  .${j}:has(:focus-visible) {
17
- clip-path: inset(-${q}px -${q}px -${ke}px);
17
+ clip-path: inset(-${M}px -${M}px -${Fe}px);
18
18
  }
19
- .${g} {
19
+ .${R} {
20
20
  display: flex;
21
21
  flex-wrap: nowrap;
22
22
  overflow-x: auto;
@@ -36,151 +36,158 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
36
36
  .${j}:has(:focus-visible) .${zt} {
37
37
  display: none;
38
38
  }
39
- .${g}::-webkit-scrollbar {
39
+ .${R}::-webkit-scrollbar {
40
40
  display: none;
41
41
  }
42
42
  /* No bottom edge: the strip's rule is the baseline for the add tile as much as for a card. */
43
- .${R} > * {
43
+ .${g} > * {
44
44
  background: ${lt};
45
- border-radius: ${Le};
45
+ border-radius: ${Te};
46
46
  }
47
- .${R}:hover:not(:has(button:disabled)) > * {
48
- background: ${De};
47
+ .${g}:hover:not(:has(button:disabled)) > * {
48
+ background: ${ve};
49
49
  }
50
- .${R} button:active:not(:disabled) {
50
+ .${g} button:active:not(:disabled) {
51
51
  opacity: 0.8;
52
52
  }
53
- .${R}:has(button:active) > * {
53
+ .${g}:has(button:active) > * {
54
54
  background: ${lt};
55
55
  }
56
- .${R}[data-emphasis='secondary'] button {
57
- border-color: ${Oe};
58
- box-shadow: ${Vt};
56
+ .${g}[data-emphasis='secondary'] button {
57
+ border-color: ${we};
58
+ box-shadow: ${qt};
59
59
  }
60
- .${R}[data-emphasis='secondary']:hover:not(:has(button:disabled)) button {
60
+ .${g}[data-emphasis='secondary']:hover:not(:has(button:disabled)) button {
61
61
  border-color: ${Ft};
62
62
  box-shadow: ${Ut};
63
63
  }
64
- .${R}[data-emphasis='secondary'] button:active:not(:disabled) {
64
+ .${g}[data-emphasis='secondary'] button:active:not(:disabled) {
65
65
  border-color: ${Ft};
66
66
  box-shadow: ${Ut};
67
67
  }
68
- .${R}[data-emphasis='primary'] button {
68
+ .${g}[data-emphasis='primary'] button {
69
69
  border-color: transparent;
70
- box-shadow: ${Pe};
70
+ box-shadow: ${Ne};
71
71
  }
72
- .${g} > * {
72
+ .${R} > * {
73
73
  flex: 0 0 auto;
74
74
  min-width: 0;
75
75
  }
76
- .${g} > * + * {
77
- border-left: 1px solid ${ye};
76
+ .${R} > * + * {
77
+ border-left: 1px solid ${Oe};
78
78
  }
79
- .${g}[data-snap='true'] {
79
+ .${R}[data-snap='true'] {
80
80
  scroll-snap-type: x proximity;
81
81
  }
82
- .${g}[data-snap='true'] > * {
82
+ .${R}[data-snap='true'] > * {
83
83
  scroll-snap-align: start;
84
84
  }
85
85
  @media (prefers-reduced-motion: reduce) {
86
- .${g} {
86
+ .${R} {
87
87
  scroll-behavior: auto;
88
88
  }
89
- .${g}[data-snap='true'] {
89
+ .${R}[data-snap='true'] {
90
90
  scroll-snap-type: none;
91
91
  }
92
- .${g}[data-snap='true'] > * {
92
+ .${R}[data-snap='true'] > * {
93
93
  scroll-snap-align: none;
94
94
  }
95
- }`, Fe = "malachite-card-strip-style", Ue = "malachite-card-strip-add-slot", Be = `
96
- .${g} > [${it}] {
95
+ }`, Be = "malachite-card-strip-style", Ge = "malachite-card-strip-add-slot", He = `
96
+ .${R} > [${it}] {
97
97
  display: flex;
98
98
  border-left: none;
99
99
  }
100
- [${it}] > .${R} {
100
+ [${it}] > .${g} {
101
101
  height: 100% !important;
102
102
  padding: 0 !important;
103
103
  }
104
- `, Gt = () => typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-reduced-motion: reduce)").matches, S = (e) => e.dataset.value ?? e.getAttribute("value"), ct = (e) => e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true", Ge = (e) => {
104
+ `, Gt = () => typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-reduced-motion: reduce)").matches, S = (e) => e.dataset.value ?? e.getAttribute("value"), ct = (e) => e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true", Kt = (e) => {
105
105
  const a = e.parentElement;
106
- return !a || a.querySelectorAll(G).length !== 1 ? null : a.querySelector(Yt);
107
- }, He = (e, a) => {
108
- const l = e.closest(G);
109
- if (l)
110
- return l;
111
- if (e.closest(Yt))
106
+ return a && a.querySelectorAll(G).length === 1 ? a : null;
107
+ }, Xe = (e) => {
108
+ var a;
109
+ return ((a = Kt(e)) == null ? void 0 : a.querySelector(Yt)) ?? null;
110
+ }, We = (e, a) => {
111
+ const s = e.closest(G);
112
+ if (s)
113
+ return s;
114
+ if (e.closest(Yt) || e.closest(Vt))
112
115
  return null;
113
- let u = e;
114
- for (; u && a.contains(u); ) {
115
- const f = u.querySelectorAll(G);
116
- if (f.length === 1 && f[0].parentElement === u)
116
+ let d = e;
117
+ for (; d && a.contains(d); ) {
118
+ const f = d.querySelectorAll(G);
119
+ if (f.length === 1 && f[0].parentElement === d)
117
120
  return f[0];
118
- u = u.parentElement;
121
+ d = d.parentElement;
119
122
  }
120
123
  return null;
121
- }, Xe = (e) => {
122
- const a = Ge(e);
123
- return a ? Array.from(a.querySelectorAll(_e)) : [];
124
- }, We = (e) => {
125
- e.hasAttribute(B) || e.setAttribute(B, e.getAttribute("tabindex") ?? ""), e.setAttribute("tabindex", "-1");
126
124
  }, ze = (e) => {
125
+ var d;
126
+ const a = Xe(e), s = (d = Kt(e)) == null ? void 0 : d.querySelector(Vt);
127
+ return [
128
+ ...a ? Array.from(a.querySelectorAll(Se)) : [],
129
+ ...s ? [s] : []
130
+ ];
131
+ }, Ye = (e) => {
132
+ e.hasAttribute(B) || e.setAttribute(B, e.getAttribute("tabindex") ?? ""), e.setAttribute("tabindex", "-1");
133
+ }, Ve = (e) => {
127
134
  if (!e.hasAttribute(B))
128
135
  return;
129
136
  const a = e.getAttribute(B);
130
137
  e.removeAttribute(B), a ? e.setAttribute("tabindex", a) : e.removeAttribute("tabindex");
131
- }, Ye = {
138
+ }, qe = {
132
139
  profile: "var(--malachite-selectable-card-selected-border, #047b43)",
133
140
  library: "var(--malachite-selectable-card-library-selected-border, #bbbbbb)",
134
141
  editing: "var(--malachite-selectable-card-pending-foreground, #96580a)"
135
- }, Ve = {
142
+ }, Me = {
136
143
  backgroundRepeat: "no-repeat",
137
144
  backgroundPosition: "left bottom",
138
145
  backgroundSize: `100% ${ft}px`
139
- }, Ht = 0.5, Xt = K - st, Me = (e) => {
140
- const a = e.querySelector(`:scope > .${de}`);
146
+ }, Ht = 0.5, Xt = K - st, Ke = (e) => {
147
+ const a = e.querySelector(`:scope > .${fe}`);
141
148
  if (!a)
142
149
  return null;
143
- const { left: l, right: u } = a.getBoundingClientRect();
144
- return { left: l + Xt, right: u - Xt };
145
- }, qe = (e, a, l, u) => {
150
+ const { left: s, right: d } = a.getBoundingClientRect();
151
+ return { left: s + Xt, right: d - Xt };
152
+ }, je = (e, a, s, d) => {
146
153
  if (!e)
147
154
  return;
148
- const f = Ye[u], $ = e.getBoundingClientRect(), I = $.left, _ = l && (a != null && a.contains(l)) ? a.getBoundingClientRect() : $, L = l == null ? void 0 : l.getBoundingClientRect(), m = l ? Me(l) : null, J = (m == null ? void 0 : m.left) ?? (L ? L.left - st : 0), Q = (m == null ? void 0 : m.right) ?? (L ? L.right + st : 0), P = L ? Math.max(J, _.left) + Ht - I : 0, b = L ? Math.min(Q, _.right) - Ht - I : 0;
155
+ const f = qe[d], $ = e.getBoundingClientRect(), I = $.left, _ = s && (a != null && a.contains(s)) ? a.getBoundingClientRect() : $, L = s == null ? void 0 : s.getBoundingClientRect(), m = s ? Ke(s) : null, J = (m == null ? void 0 : m.left) ?? (L ? L.left - st : 0), Q = (m == null ? void 0 : m.right) ?? (L ? L.right + st : 0), P = L ? Math.max(J, _.left) + Ht - I : 0, b = L ? Math.min(Q, _.right) - Ht - I : 0;
149
156
  e.style.backgroundImage = b > P ? `linear-gradient(to right, ${f} 0 ${P}px, transparent ${P}px ${b}px, ${f} ${b}px 100%)` : `linear-gradient(to right, ${f} 0 100%)`;
150
- }, Ke = {
157
+ }, Je = {
151
158
  marginInline: `calc(${Dt} * -1)`,
152
159
  paddingInline: Dt
153
160
  }, pt = {
154
161
  background: lt,
155
- borderRadius: Ee,
162
+ borderRadius: $e,
156
163
  paddingTop: `${w}px`,
157
164
  paddingInline: `${w}px`,
158
165
  marginBottom: `${ft}px`
159
- }, je = {
166
+ }, Qe = {
160
167
  ...pt,
161
168
  marginInline: `${H}px`
162
- }, Je = pt, Qe = pt, Ze = {
169
+ }, Ze = pt, tr = pt, er = {
163
170
  marginInlineStart: `${H}px`
164
- }, tr = {
171
+ }, rr = {
165
172
  primary: {
166
- backgroundColor: Ce,
167
- color: Ie
173
+ backgroundColor: Pe,
174
+ color: ke
168
175
  },
169
- secondary: { backgroundColor: ve, color: we }
170
- }, qt = ({
176
+ secondary: { backgroundColor: Ce, color: Ie }
177
+ }, jt = ({
171
178
  label: e,
172
179
  icon: a,
173
- onClick: l,
174
- disabled: u = !1,
180
+ onClick: s,
181
+ disabled: d = !1,
175
182
  emphasis: f = "secondary",
176
183
  className: $ = ""
177
184
  }) => /* @__PURE__ */ h(
178
185
  "div",
179
186
  {
180
- className: R,
187
+ className: g,
181
188
  "data-emphasis": f,
182
189
  style: {
183
- ...Je,
190
+ ...Ze,
184
191
  width: `${ut}px`,
185
192
  height: `calc(100% - ${ft}px)`
186
193
  },
@@ -188,18 +195,18 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
188
195
  "button",
189
196
  {
190
197
  type: "button",
191
- onClick: l,
192
- disabled: u,
193
- style: tr[f],
194
- className: `${me} inline-flex items-center justify-center gap-1.5 h-[var(--malachite-control-height-medium,32px)] w-[108px] px-2.5 rounded-xl border border-solid text-[length:var(--malachite-font-size-small,13px)] font-medium whitespace-nowrap ${u ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${$}`,
198
+ onClick: s,
199
+ disabled: d,
200
+ style: rr[f],
201
+ className: `${Re} inline-flex items-center justify-center gap-1.5 h-[var(--malachite-control-height-medium,32px)] w-[108px] px-2.5 rounded-xl border border-solid text-[length:var(--malachite-font-size-small,13px)] font-medium whitespace-nowrap ${d ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${$}`,
195
202
  children: [
196
- /* @__PURE__ */ h("span", { className: "inline-flex h-[13px] w-[13px] shrink-0 items-center justify-center", children: a ?? /* @__PURE__ */ h(se, { size: 13 }) }),
203
+ /* @__PURE__ */ h("span", { className: "inline-flex h-[13px] w-[13px] shrink-0 items-center justify-center", children: a ?? /* @__PURE__ */ h(le, { size: 13 }) }),
197
204
  e
198
205
  ]
199
206
  }
200
207
  ) })
201
208
  }
202
- ), dt = (e) => C.isValidElement(e) && e.type === qt, er = (e) => C.isValidElement(e) && e.type === C.Fragment && C.Children.toArray(e.props.children).some(dt), Wt = ({ side: e, onClick: a }) => /* @__PURE__ */ h(
209
+ ), dt = (e) => C.isValidElement(e) && e.type === jt, nr = (e) => C.isValidElement(e) && e.type === C.Fragment && C.Children.toArray(e.props.children).some(dt), Wt = ({ side: e, onClick: a }) => /* @__PURE__ */ h(
203
210
  "button",
204
211
  {
205
212
  type: "button",
@@ -209,18 +216,18 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
209
216
  onClick: a,
210
217
  className: "absolute top-1/2 -translate-y-1/2 z-10 inline-flex items-center justify-center w-5 h-5 rounded-lg cursor-pointer text-[var(--malachite-text-secondary)]",
211
218
  style: {
212
- [e]: `-${Te}px`,
213
- background: Se,
214
- border: `1px solid ${xe}`,
215
- boxShadow: Vt
219
+ [e]: `-${ye}px`,
220
+ background: Le,
221
+ border: `1px solid ${Ee}`,
222
+ boxShadow: qt
216
223
  },
217
- children: e === "left" ? /* @__PURE__ */ h(ae, { size: Ct }) : /* @__PURE__ */ h(ce, { size: Ct })
224
+ children: e === "left" ? /* @__PURE__ */ h(se, { size: Ct }) : /* @__PURE__ */ h(ie, { size: Ct })
218
225
  }
219
- ), rr = ({
226
+ ), or = ({
220
227
  value: e,
221
228
  tone: a,
222
- onChange: l,
223
- children: u,
229
+ onChange: s,
230
+ children: d,
224
231
  leading: f,
225
232
  arrows: $ = !0,
226
233
  fadeEdges: I = !0,
@@ -232,93 +239,93 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
232
239
  className: P = "",
233
240
  style: b
234
241
  }) => {
235
- const y = T(null), ht = T(null), k = T(null), mt = T(!1), [X, Kt] = M({ canScrollLeft: !1, canScrollRight: !1 }), [jt, bt] = M(!1), W = T(null), gt = T(!1);
236
- wt(y, Ne, Fe), wt(y, Be, Ue);
237
- const Z = C.Children.toArray(u), tt = Z.filter((t) => !dt(t)), Jt = tt.some(er), D = tt.length > 0, z = Z.filter(dt).map(
242
+ const y = T(null), ht = T(null), k = T(null), mt = T(!1), [X, Jt] = q({ canScrollLeft: !1, canScrollRight: !1 }), [Qt, bt] = q(!1), W = T(null), Rt = T(!1);
243
+ wt(y, Ue, Be), wt(y, He, Ge);
244
+ const Z = C.Children.toArray(d), tt = Z.filter((t) => !dt(t)), Zt = tt.some(nr), D = tt.length > 0, z = Z.filter(dt).map(
238
245
  (t) => t.props.emphasis === void 0 ? C.cloneElement(t, { emphasis: D ? "secondary" : "primary" }) : t
239
- ), Rt = Z.length, et = z.length;
246
+ ), gt = Z.length, et = z.length;
240
247
  v(() => {
241
248
  const t = y.current;
242
249
  if (!t || !D || et === 0) {
243
250
  bt(!1);
244
251
  return;
245
252
  }
246
- const r = ht.current, { paddingLeft: o, paddingRight: s } = getComputedStyle(t), i = (parseFloat(o) || 0) + (parseFloat(s) || 0);
247
- let d = t.clientWidth - i, p = (r == null ? void 0 : r.offsetWidth) ?? 0;
253
+ const r = ht.current, { paddingLeft: o, paddingRight: i } = getComputedStyle(t), l = (parseFloat(o) || 0) + (parseFloat(i) || 0);
254
+ let u = t.clientWidth - l, p = (r == null ? void 0 : r.offsetWidth) ?? 0;
248
255
  const n = () => {
249
- const O = p + et * ut + $e;
250
- bt(d > 0 && d < O);
256
+ const O = p + et * ut + De;
257
+ bt(u > 0 && u < O);
251
258
  };
252
259
  n();
253
260
  const c = typeof ResizeObserver < "u" ? new ResizeObserver((O) => {
254
261
  var E, yt;
255
262
  for (const V of O ?? [])
256
- V.target === t ? d = V.contentRect.width : p = ((yt = (E = V.borderBoxSize) == null ? void 0 : E[0]) == null ? void 0 : yt.inlineSize) ?? V.contentRect.width + 2 * w;
263
+ V.target === t ? u = V.contentRect.width : p = ((yt = (E = V.borderBoxSize) == null ? void 0 : E[0]) == null ? void 0 : yt.inlineSize) ?? V.contentRect.width + 2 * w;
257
264
  n();
258
265
  }) : null;
259
266
  return c == null || c.observe(t), r && (c == null || c.observe(r)), () => c == null ? void 0 : c.disconnect();
260
267
  }, [D, et, !!f]);
261
- const rt = jt && D, _t = x((t) => {
268
+ const rt = Qt && D, _t = x((t) => {
262
269
  var o;
263
270
  const r = t.type === "focus" ? t.target : t.relatedTarget;
264
- gt.current = !!(r instanceof Node && ((o = W.current) != null && o.contains(r)));
271
+ Rt.current = !!(r instanceof Node && ((o = W.current) != null && o.contains(r)));
265
272
  }, []);
266
273
  v(() => {
267
274
  var o;
268
275
  const t = W.current, r = t ? t.getRootNode().activeElement : null;
269
- gt.current && t && !(r && t.contains(r)) && ((o = t.querySelector("button")) == null || o.focus({ preventScroll: !0 }));
276
+ Rt.current && t && !(r && t.contains(r)) && ((o = t.querySelector("button")) == null || o.focus({ preventScroll: !0 }));
270
277
  }, [rt]);
271
278
  const A = x(() => {
272
279
  const t = y.current;
273
280
  return t ? Array.from(t.querySelectorAll(G)) : [];
274
- }, []), nt = T(null), [At, Qt] = M(0);
281
+ }, []), nt = T(null), [At, te] = q(0);
275
282
  v(() => {
276
283
  const t = JSON.stringify(A().map(S));
277
- nt.current !== null && nt.current !== t && Qt((r) => r + 1), nt.current = t;
284
+ nt.current !== null && nt.current !== t && te((r) => r + 1), nt.current = t;
278
285
  });
279
286
  const ot = x(
280
287
  () => A().filter((t) => S(t) !== null),
281
288
  [A]
282
289
  ), St = T(/* @__PURE__ */ new Set()), N = x((t, r) => {
283
290
  St.current.has(t) || (St.current.add(t), console.warn(r));
284
- }, []), [Zt, te] = M("profile");
291
+ }, []), [ee, re] = q("profile");
285
292
  v(() => {
286
293
  var r, o;
287
- const t = (o = (r = A().find((s) => S(s) === e)) == null ? void 0 : r.parentElement) == null ? void 0 : o.getAttribute("data-variant");
288
- (t === "profile" || t === "library" || t === "editing") && te(t);
294
+ const t = (o = (r = A().find((i) => S(i) === e)) == null ? void 0 : r.parentElement) == null ? void 0 : o.getAttribute("data-variant");
295
+ (t === "profile" || t === "library" || t === "editing") && re(t);
289
296
  }, [A, e]), v(() => {
290
- const t = A(), r = ot(), s = r.find((n) => S(n) === e) ?? r.find((n) => !ct(n)) ?? null;
297
+ const t = A(), r = ot(), i = r.find((n) => S(n) === e) ?? r.find((n) => !ct(n)) ?? null;
291
298
  if (t.forEach((n) => {
292
- const c = n === s, O = c ? 0 : -1;
299
+ const c = n === i, O = c ? 0 : -1;
293
300
  n.tabIndex !== O && (n.tabIndex = O);
294
- for (const E of Xe(n))
295
- c ? ze(E) : We(E);
301
+ for (const E of ze(n))
302
+ c ? Ve(E) : Ye(E);
296
303
  }), process.env.NODE_ENV === "production")
297
304
  return;
298
305
  r.length !== t.length && N(
299
306
  "missing-value",
300
307
  'CardStrip: a child with role="radio" has no `data-value`. It cannot be selected or reached by arrow keys, so it is excluded from the radio set. Give every card a `data-value`.'
301
308
  );
302
- const i = /* @__PURE__ */ new Set();
309
+ const l = /* @__PURE__ */ new Set();
303
310
  for (const n of r) {
304
311
  const c = S(n);
305
- c !== null && (i.has(c) && N(
312
+ c !== null && (l.has(c) && N(
306
313
  `duplicate:${c}`,
307
314
  `CardStrip: two cards share the data-value "${c}". Both will read as checked and only the first is selectable — data-value must be unique.`
308
- ), i.add(c));
315
+ ), l.add(c));
309
316
  }
310
- const d = e !== "";
311
- t.length > 0 && d && !i.has(e) && N(
317
+ const u = e !== "";
318
+ t.length > 0 && u && !l.has(e) && N(
312
319
  `unmatched:${e}`,
313
320
  `CardStrip: value "${e}" matches no card's data-value, so the group reports no selection.`
314
321
  );
315
322
  const p = t.filter(
316
323
  (n) => n.getAttribute("aria-checked") === "true"
317
324
  ).length;
318
- t.length > 0 && d && p !== 1 && N(
325
+ t.length > 0 && u && p !== 1 && N(
319
326
  `checked:${p}`,
320
327
  `CardStrip: ${p} cards are aria-checked, but a radiogroup has exactly one. Drive each card's checked state from the strip's \`value\`.`
321
- ), Jt && N(
328
+ ), Zt && N(
322
329
  "wrapped-add-tile",
323
330
  "CardStrip: a CardStrip.AddTile inside a fragment is treated as a card and scrolls with them. The add tile must be a direct child of CardStrip."
324
331
  );
@@ -335,28 +342,28 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
335
342
  return;
336
343
  const o = mt.current;
337
344
  mt.current = !0;
338
- const s = Ot(t, r, _);
339
- s !== null && t.scrollTo({
340
- left: s,
345
+ const i = Ot(t, r, _);
346
+ i !== null && t.scrollTo({
347
+ left: i,
341
348
  behavior: o && !Gt() ? "smooth" : "instant"
342
349
  });
343
- }, [F, m, _, Rt, At]);
344
- const xt = a ?? Zt, Lt = (b == null ? void 0 : b.background) !== void 0 || (b == null ? void 0 : b.backgroundImage) !== void 0, Y = x(() => {
350
+ }, [F, m, _, gt, At]);
351
+ const xt = a ?? ee, Lt = (b == null ? void 0 : b.background) !== void 0 || (b == null ? void 0 : b.backgroundImage) !== void 0, Y = x(() => {
345
352
  var p;
346
353
  const t = k.current;
347
- if (Lt || qe(
354
+ if (Lt || je(
348
355
  y.current,
349
356
  t,
350
357
  (p = A().find((n) => S(n) === e)) == null ? void 0 : p.parentElement,
351
358
  xt
352
359
  ), !t)
353
360
  return;
354
- const { scrollWidth: r, clientWidth: o, scrollLeft: s } = t, i = r > o + at, d = {
355
- canScrollLeft: i && s > at,
356
- canScrollRight: i && s + o < r - at
361
+ const { scrollWidth: r, clientWidth: o, scrollLeft: i } = t, l = r > o + at, u = {
362
+ canScrollLeft: l && i > at,
363
+ canScrollRight: l && i + o < r - at
357
364
  };
358
- Kt(
359
- (n) => n.canScrollLeft === d.canScrollLeft && n.canScrollRight === d.canScrollRight ? n : d
365
+ Jt(
366
+ (n) => n.canScrollLeft === u.canScrollLeft && n.canScrollRight === u.canScrollRight ? n : u
360
367
  );
361
368
  }, [Lt, A, xt, e]);
362
369
  v(() => {
@@ -366,40 +373,40 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
366
373
  return;
367
374
  const r = () => {
368
375
  const c = F();
369
- return c !== null && fe(t, c);
376
+ return c !== null && he(t, c);
370
377
  };
371
378
  let o = r();
372
- const s = () => {
379
+ const i = () => {
373
380
  Y(), o = r();
374
381
  };
375
- t.addEventListener("scroll", s, { passive: !0 });
376
- let i = 0;
377
- const d = () => {
382
+ t.addEventListener("scroll", i, { passive: !0 });
383
+ let l = 0;
384
+ const u = () => {
378
385
  const c = F(), E = m && o && typeof t.scrollTo == "function" && c ? Ot(t, c, _) : null;
379
386
  E !== null && t.scrollTo({ left: E, behavior: "instant" }), o = r();
380
387
  }, p = () => {
381
388
  if (Y(), typeof requestAnimationFrame != "function") {
382
- d();
389
+ u();
383
390
  return;
384
391
  }
385
- cancelAnimationFrame(i), i = requestAnimationFrame(d);
392
+ cancelAnimationFrame(l), l = requestAnimationFrame(u);
386
393
  }, n = typeof ResizeObserver < "u" ? new ResizeObserver(p) : null;
387
394
  return n == null || n.observe(t), () => {
388
- t.removeEventListener("scroll", s), n == null || n.disconnect(), typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i);
395
+ t.removeEventListener("scroll", i), n == null || n.disconnect(), typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l);
389
396
  };
390
- }, [Y, F, m, _, Rt, At]);
397
+ }, [Y, F, m, _, gt, At]);
391
398
  const Et = x(
392
399
  (t) => {
393
400
  const r = k.current;
394
401
  !r || typeof r.scrollBy != "function" || r.scrollBy({
395
- left: ue(r, t, _) - r.scrollLeft,
402
+ left: pe(r, t, _) - r.scrollLeft,
396
403
  behavior: Gt() ? "auto" : "smooth"
397
404
  });
398
405
  },
399
406
  [_]
400
- ), ee = x(
407
+ ), ne = x(
401
408
  (t) => {
402
- if (!be.has(t.key))
409
+ if (!ge.has(t.key))
403
410
  return;
404
411
  const r = t.target;
405
412
  if (!(r instanceof Element) || !r.closest(G))
@@ -408,48 +415,48 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
408
415
  if (o.length === 0)
409
416
  return;
410
417
  t.preventDefault();
411
- const s = o.findIndex((n) => S(n) === e);
412
- let i;
418
+ const i = o.findIndex((n) => S(n) === e);
419
+ let l;
413
420
  if (t.key === "Home")
414
- i = 0;
421
+ l = 0;
415
422
  else if (t.key === "End")
416
- i = o.length - 1;
423
+ l = o.length - 1;
417
424
  else {
418
425
  const n = t.key === "ArrowLeft" || t.key === "ArrowUp" ? -1 : 1;
419
- i = ((s === -1 ? 0 : s) + n + o.length) % o.length;
426
+ l = ((i === -1 ? 0 : i) + n + o.length) % o.length;
420
427
  }
421
- const d = o[i], p = S(d);
422
- p !== null && p !== e && l(p), d.focus();
428
+ const u = o[l], p = S(u);
429
+ p !== null && p !== e && s(p), u.focus();
423
430
  },
424
- [ot, l, e]
425
- ), re = x(
431
+ [ot, s, e]
432
+ ), oe = x(
426
433
  (t) => {
427
434
  const r = t.target;
428
- if (!(r instanceof Element) || r.closest(`.${R}`))
435
+ if (!(r instanceof Element) || r.closest(`.${g}`))
429
436
  return;
430
437
  const o = y.current;
431
438
  if (!o)
432
439
  return;
433
- const s = He(r, o);
434
- if (!s || ct(s))
440
+ const i = We(r, o);
441
+ if (!i || ct(i))
435
442
  return;
436
- const i = S(s);
437
- i !== null && i !== e && l(i);
443
+ const l = S(i);
444
+ l !== null && l !== e && s(l);
438
445
  },
439
- [l, e]
440
- ), ne = $ && X.canScrollLeft, oe = $ && X.canScrollRight, Tt = I && X.canScrollLeft, $t = I && X.canScrollRight;
446
+ [s, e]
447
+ ), ae = $ && X.canScrollLeft, ce = $ && X.canScrollRight, Tt = I && X.canScrollLeft, $t = I && X.canScrollRight;
441
448
  return /* @__PURE__ */ U(
442
449
  "div",
443
450
  {
444
451
  ref: y,
445
- onKeyDown: ee,
452
+ onKeyDown: ne,
446
453
  onFocus: _t,
447
454
  onBlur: _t,
448
- onClick: re,
455
+ onClick: oe,
449
456
  className: `${j} flex items-stretch ${P}`,
450
457
  style: {
451
- ...Ve,
452
- ...L ? Ke : null,
458
+ ...Me,
459
+ ...L ? Je : null,
453
460
  ...b
454
461
  },
455
462
  children: [
@@ -461,30 +468,30 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
461
468
  "aria-labelledby": Q,
462
469
  className: D ? "flex items-stretch min-w-0" : "flex items-stretch",
463
470
  children: [
464
- f ? /* @__PURE__ */ h(vt.Provider, { value: pe, children: /* @__PURE__ */ h("div", { ref: ht, className: "shrink-0", style: Qe, children: f }) }) : null,
471
+ f ? /* @__PURE__ */ h(vt.Provider, { value: me, children: /* @__PURE__ */ h("div", { ref: ht, className: "shrink-0", style: tr, children: f }) }) : null,
465
472
  D ? /* @__PURE__ */ U(
466
473
  "div",
467
474
  {
468
- [Re]: "",
475
+ [Ae]: "",
469
476
  className: "relative min-w-0 shrink basis-auto",
470
- style: je,
477
+ style: Qe,
471
478
  children: [
472
479
  /* @__PURE__ */ U(
473
480
  "div",
474
481
  {
475
482
  ref: k,
476
483
  tabIndex: -1,
477
- [ge]: "",
484
+ [_e]: "",
478
485
  "data-snap": _ ? "true" : "false",
479
- className: g,
486
+ className: R,
480
487
  children: [
481
- /* @__PURE__ */ h(vt.Provider, { value: he, children: tt }),
488
+ /* @__PURE__ */ h(vt.Provider, { value: be, children: tt }),
482
489
  rt ? /* @__PURE__ */ h("div", { ref: W, [it]: "", children: z }) : null
483
490
  ]
484
491
  }
485
492
  ),
486
- ne ? /* @__PURE__ */ h(Wt, { side: "left", onClick: () => Et(-1) }) : null,
487
- oe ? /* @__PURE__ */ h(Wt, { side: "right", onClick: () => Et(1) }) : null,
493
+ ae ? /* @__PURE__ */ h(Wt, { side: "left", onClick: () => Et(-1) }) : null,
494
+ ce ? /* @__PURE__ */ h(Wt, { side: "right", onClick: () => Et(1) }) : null,
488
495
  Tt || $t ? /* @__PURE__ */ h(
489
496
  "div",
490
497
  {
@@ -508,7 +515,7 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
508
515
  {
509
516
  ref: W,
510
517
  className: "shrink-0",
511
- style: !D && f ? Ze : void 0,
518
+ style: !D && f ? er : void 0,
512
519
  children: z
513
520
  }
514
521
  ) : null
@@ -516,9 +523,9 @@ const be = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "Arrow
516
523
  }
517
524
  );
518
525
  };
519
- rr.AddTile = qt;
526
+ or.AddTile = jt;
520
527
  export {
521
- rr as CardStrip,
522
- rr as default
528
+ or as CardStrip,
529
+ or as default
523
530
  };
524
531
  //# sourceMappingURL=CardStrip.js.map