baseline-kit 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,22 +1,24 @@
1
- import { O as e, a as t, f as n, h as r, i, k as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f } from "./src-D0nL1BwZ.js";
2
- import * as p from "react";
3
- import { useCallback as m, useEffect as h, useLayoutEffect as g, useMemo as _, useState as v } from "react";
4
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
1
+ import { E as e, M as t, _ as n, a as r, c as i, g as a, h as o, i as s, j as c, l, n as u, o as d, r as f, s as p, t as m, u as h, v as g } from "./src-CPIpvN4R.js";
2
+ import * as _ from "react";
3
+ import { useCallback as v, useEffect as y, useLayoutEffect as b, useMemo as x, useState as S } from "react";
4
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
5
5
  //#region packages/react/src/components/Config/Config.tsx
6
- var S = "__baseline_kit_config_context__", C = globalThis, w = C[S] ?? (C[S] = p.createContext(a));
7
- w.displayName = "ConfigContext";
8
- var T = () => p.use(w);
9
- function E({ children: t, base: n, baseline: r, guide: i, spacer: a, box: o, padder: s }) {
10
- let c = T(), l = p.useMemo(() => e({
11
- parentConfig: c,
12
- base: n,
6
+ var E = "__baseline_kit_config_context__", D = globalThis, O = D[E] ?? (D[E] = _.createContext(t));
7
+ O.displayName = "ConfigContext";
8
+ var k = () => _.use(O);
9
+ function A({ children: e, base: t, domDiagnostics: n, baseline: r, guide: i, spacer: a, box: o, padder: s }) {
10
+ let l = k(), u = _.useMemo(() => c({
11
+ parentConfig: l,
12
+ base: t,
13
+ domDiagnostics: n,
13
14
  baseline: r,
14
15
  guide: i,
15
16
  spacer: a,
16
17
  box: o,
17
18
  padder: s
18
19
  }), [
19
- c,
20
+ l,
21
+ t,
20
22
  n,
21
23
  r,
22
24
  i,
@@ -24,14 +26,14 @@ function E({ children: t, base: n, baseline: r, guide: i, spacer: a, box: o, pad
24
26
  o,
25
27
  s
26
28
  ]);
27
- return /* @__PURE__ */ b(w, {
28
- value: l,
29
- children: t
29
+ return /* @__PURE__ */ w(O, {
30
+ value: u,
31
+ children: e
30
32
  });
31
33
  }
32
34
  //#endregion
33
35
  //#region packages/dom/src/timing.ts
34
- var D = (e) => {
36
+ var j = (e) => {
35
37
  let t = null, n = null;
36
38
  return [(...r) => {
37
39
  n = r, t !== null && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
@@ -43,7 +45,7 @@ var D = (e) => {
43
45
  };
44
46
  //#endregion
45
47
  //#region packages/dom/src/measure.ts
46
- function O(e, t) {
48
+ function M(e, t) {
47
49
  let n = {
48
50
  width: 0,
49
51
  height: 0
@@ -55,7 +57,7 @@ function O(e, t) {
55
57
  };
56
58
  (i.width !== n.width || i.height !== n.height) && (n = i, t(i));
57
59
  } catch {}
58
- }, [i, a] = D(r);
60
+ }, [i, a] = j(r);
59
61
  r();
60
62
  let o = new ResizeObserver(i);
61
63
  return o.observe(e), {
@@ -67,22 +69,22 @@ function O(e, t) {
67
69
  }
68
70
  //#endregion
69
71
  //#region packages/react/src/hooks/useMeasure.ts
70
- var k = {
72
+ var N = {
71
73
  width: 0,
72
74
  height: 0
73
75
  };
74
- function A(e) {
75
- let [t, n] = p.useState(k), r = p.useRef(null);
76
- p.useLayoutEffect(() => {
76
+ function P(e) {
77
+ let [t, n] = _.useState(N), r = _.useRef(null);
78
+ _.useLayoutEffect(() => {
77
79
  if (typeof window > "u" || !e.current) return;
78
- let t = O(e.current, (e) => {
80
+ let t = M(e.current, (e) => {
79
81
  n((t) => t.width === e.width && t.height === e.height ? t : e);
80
82
  });
81
83
  return r.current = t, () => {
82
84
  t.disconnect(), r.current = null;
83
85
  };
84
86
  }, [e]);
85
- let i = p.useCallback(() => {
87
+ let i = _.useCallback(() => {
86
88
  r.current?.refresh();
87
89
  }, []);
88
90
  return {
@@ -92,7 +94,7 @@ function A(e) {
92
94
  }
93
95
  //#endregion
94
96
  //#region packages/dom/src/virtual.ts
95
- function j(e, t, n) {
97
+ function F(e, t, n) {
96
98
  let { totalItems: r, itemHeight: i, buffer: a = 0 } = t;
97
99
  if (!Number.isFinite(i) || i <= 0) throw Error("createVirtualTracker requires itemHeight to be greater than 0");
98
100
  if (!Number.isFinite(r) || r < 0) throw Error("createVirtualTracker requires totalItems to be 0 or greater");
@@ -105,7 +107,7 @@ function j(e, t, n) {
105
107
  }, s = {
106
108
  start: 0,
107
109
  end: r
108
- }, [c, l] = D(() => {
110
+ }, [c, l] = j(() => {
109
111
  let e = o();
110
112
  (e.start !== s.start || e.end !== s.end) && (s = e, n(e));
111
113
  }), u = { passive: !0 };
@@ -120,20 +122,20 @@ function j(e, t, n) {
120
122
  }
121
123
  //#endregion
122
124
  //#region packages/react/src/hooks/useVirtual.ts
123
- function M({ totalLines: e, lineHeight: t, containerRef: n, buffer: r = 0 }) {
124
- let i = typeof r == "number" ? r : parseInt(r, 10) || 0, [a, o] = v({
125
+ function I({ totalLines: e, lineHeight: t, containerRef: n, buffer: r = 0 }) {
126
+ let i = typeof r == "number" ? r : parseInt(r, 10) || 0, [a, o] = S({
125
127
  start: 0,
126
128
  end: e
127
- }), s = m((e) => {
129
+ }), s = v((e) => {
128
130
  o((t) => t.start === e.start && t.end === e.end ? t : e);
129
131
  }, []);
130
- return g(() => {
132
+ return b(() => {
131
133
  if (!n.current) return;
132
134
  o((t) => t.start === 0 && t.end === e ? t : {
133
135
  start: 0,
134
136
  end: e
135
137
  });
136
- let r = j(n.current, {
138
+ let r = F(n.current, {
137
139
  totalItems: e,
138
140
  itemHeight: t,
139
141
  buffer: i
@@ -149,46 +151,46 @@ function M({ totalLines: e, lineHeight: t, containerRef: n, buffer: r = 0 }) {
149
151
  }
150
152
  //#endregion
151
153
  //#region packages/react/src/hooks/useBaseline.ts
152
- function N(e, { base: t = 8, snapping: n = "none", snapEdge: i = "bottom", spacing: a = {} } = {}) {
154
+ function L(e, { base: t = 8, snapping: r = "none", snapEdge: i = "bottom", spacing: a = {} } = {}) {
153
155
  if (t < 1) throw Error("Base must be >= 1 for baseline alignment.");
154
- let { height: s } = A(e), c = p.useRef(null);
155
- return p.useMemo(() => {
156
- let e = r({ padding: a }), l = s % t === 0;
157
- if (n === "none") return {
156
+ let { height: o } = P(e), s = _.useRef(null);
157
+ return _.useMemo(() => {
158
+ let e = g({ padding: a }), c = o % t === 0;
159
+ if (r === "none") return {
158
160
  padding: e,
159
- isAligned: l,
160
- height: s
161
+ isAligned: c,
162
+ height: o
161
163
  };
162
- if (c.current) return {
163
- padding: c.current,
164
- isAligned: l,
165
- height: s
164
+ if (s.current) return {
165
+ padding: s.current,
166
+ isAligned: c,
167
+ height: o
166
168
  };
167
- if (s === 0) return {
169
+ if (o === 0) return {
168
170
  padding: e,
169
- isAligned: l,
170
- height: s
171
+ isAligned: c,
172
+ height: o
171
173
  };
172
- let u = o(s, t, e, {
173
- mode: n,
174
+ let l = n(o, t, e, {
175
+ mode: r,
174
176
  snapEdge: i
175
177
  });
176
- return c.current = u, {
177
- padding: u,
178
- isAligned: l,
179
- height: s
178
+ return s.current = l, {
179
+ padding: l,
180
+ isAligned: c,
181
+ height: o
180
182
  };
181
183
  }, [
182
184
  t,
183
- n,
185
+ r,
184
186
  i,
185
187
  a,
186
- s
188
+ o
187
189
  ]);
188
190
  }
189
191
  //#endregion
190
192
  //#region packages/dom/src/viewport.ts
191
- function P() {
193
+ function ee() {
192
194
  return typeof window > "u" ? {} : {
193
195
  viewportWidth: window.innerWidth,
194
196
  viewportHeight: window.innerHeight
@@ -196,312 +198,402 @@ function P() {
196
198
  }
197
199
  //#endregion
198
200
  //#region packages/react/src/hooks/useGuide.ts
199
- function F(e, t) {
200
- let { width: n } = A(e);
201
- return p.useMemo(() => d(n, t, P()), [t, n]);
201
+ function te(e, t) {
202
+ let { width: n } = P(e);
203
+ return _.useMemo(() => h(n, t, ee()), [t, n]);
202
204
  }
203
205
  //#endregion
204
206
  //#region packages/react/src/hooks/useConfig.ts
205
- function I(e) {
206
- let t = T();
207
- return _(() => Object.assign({ base: t.base }, t[e]), [t, e]);
207
+ function R(e) {
208
+ let t = k();
209
+ return x(() => Object.assign({
210
+ base: t.base,
211
+ domDiagnostics: t.domDiagnostics
212
+ }, t[e]), [t, e]);
208
213
  }
209
214
  //#endregion
210
215
  //#region packages/react/src/hooks/useDebug.ts
211
- function L(e, t) {
212
- return _(() => l(e, t), [e, t]);
216
+ function z(e, t) {
217
+ return x(() => a(e, t), [e, t]);
213
218
  }
214
219
  //#endregion
215
220
  //#region packages/react/src/hooks/useIsClient.ts
216
- function R() {
217
- let [e, t] = v(!1);
218
- return h(() => {
221
+ function B() {
222
+ let [e, t] = S(!1);
223
+ return y(() => {
219
224
  t(!0);
220
225
  }, []), e;
221
226
  }
222
227
  //#endregion
223
228
  //#region packages/react/src/utils/ssr.tsx
224
- function z({ children: e, fallback: t = null }) {
225
- return R() ? /* @__PURE__ */ b(y, { children: e }) : /* @__PURE__ */ b(y, { children: t });
229
+ function ne({ children: e, fallback: t = null }) {
230
+ return B() ? /* @__PURE__ */ w(C, { children: e }) : /* @__PURE__ */ w(C, { children: t });
226
231
  }
227
232
  //#endregion
228
233
  //#region packages/react/src/utils/merge.ts
229
- function B(...e) {
234
+ function V(...e) {
230
235
  return Object.assign({}, ...e.filter(Boolean));
231
236
  }
232
- function V(...e) {
237
+ function H(...e) {
233
238
  return (t) => {
234
239
  e.forEach((e) => {
235
240
  e && (typeof e == "function" ? e(t) : Object.assign(e, { current: t }));
236
241
  });
237
242
  };
238
243
  }
239
- var H = {
244
+ //#endregion
245
+ //#region packages/react/src/utils/dom.ts
246
+ function U(e, t) {
247
+ return Object.fromEntries(Object.entries(e).filter(([e, n]) => t[e] !== n));
248
+ }
249
+ var re = /* @__PURE__ */ new Set([
250
+ "id",
251
+ "title",
252
+ "role",
253
+ "tabIndex",
254
+ "lang",
255
+ "dir",
256
+ "hidden"
257
+ ]);
258
+ function W(e) {
259
+ return Object.fromEntries(Object.entries(e).filter(([e]) => e.startsWith("data-") || e.startsWith("aria-") || re.has(e)));
260
+ }
261
+ var G = {
240
262
  bas: "bas_4Emvv",
263
+ line: "line_jXAw3",
264
+ flat: "flat_DwUeJ",
265
+ compact: "compact_CjR0G",
241
266
  v: "v_lNfeX",
242
267
  h: "h_PbNDU",
243
268
  row: "row_J1Wva",
244
269
  ssr: "ssr_PQAP-"
245
- }, U = p.memo(function({ className: e, debugging: t, style: r, variant: a, height: o, width: s, base: c, color: l, ...u }) {
246
- let d = I("baseline"), { isShown: f } = L(t, d.debugging), m = p.useRef(null), { width: h, height: g } = A(m), _ = c || d.base, v = p.useMemo(() => i({
247
- base: _,
248
- colors: d.colors,
249
- variant: a ?? d.variant,
250
- width: s,
251
- height: o,
252
- color: l,
253
- containerWidth: h,
254
- containerHeight: g,
255
- spacing: u,
256
- isVisible: f
270
+ }, ie = _.memo(function({ className: e, debugging: n, style: i, variant: a, height: s, width: c, base: l, color: u, ...f }) {
271
+ let p = R("baseline"), m = a ?? p.variant, { isShown: h } = z(n, p.debugging), g = _.useRef(null), { width: v, height: y } = P(g), b = l || p.base, x = _.useMemo(() => d({
272
+ base: b,
273
+ colors: p.colors,
274
+ variant: m,
275
+ width: c,
276
+ height: s,
277
+ color: u,
278
+ containerWidth: v,
279
+ containerHeight: y,
280
+ spacing: f,
281
+ isVisible: h
257
282
  }), [
258
- _,
259
- d.colors,
260
- d.variant,
261
- a,
283
+ b,
284
+ p.colors,
285
+ m,
286
+ c,
262
287
  s,
263
- o,
264
- l,
265
- h,
266
- g,
267
288
  u,
268
- f
269
- ]), { start: y, end: x } = M({
270
- totalLines: v.rowCount,
271
- lineHeight: _,
272
- containerRef: m,
289
+ v,
290
+ y,
291
+ f,
292
+ h
293
+ ]), S = r({
294
+ base: b,
295
+ contentHeight: x.contentHeight,
296
+ domDiagnostics: p.domDiagnostics,
297
+ className: e,
298
+ style: i
299
+ }), { start: C, end: T } = I({
300
+ totalLines: x.rowCount,
301
+ lineHeight: b,
302
+ containerRef: g,
273
303
  buffer: 160
274
- }), S = p.useMemo(() => B(v.containerStyle, r), [v.containerStyle, r]);
275
- return /* @__PURE__ */ b("div", {
276
- ref: m,
277
- "data-testid": "baseline",
304
+ }), E = _.useMemo(() => V(U({
305
+ ...x.containerStyle,
306
+ ...S ? { "--bkbl-b": `${b}px` } : {}
307
+ }, {
308
+ "--bkbl-w": "100%",
309
+ "--bkbl-h": "100%",
310
+ "--bkbl-b": "8px",
311
+ "--bkbl-cl": t.baseline.colors.line,
312
+ "--bkbl-cf": t.baseline.colors.flat,
313
+ "--bkbl-c": m === "line" ? "var(--bkbl-cl)" : "var(--bkbl-cf)"
314
+ }), i), [
315
+ x.containerStyle,
316
+ i,
317
+ m,
318
+ b,
319
+ S
320
+ ]);
321
+ return /* @__PURE__ */ w("div", {
322
+ ref: g,
323
+ "data-testid": p.domDiagnostics ? "baseline" : void 0,
278
324
  "aria-hidden": "true",
279
- className: n(...v.classTokens.map((e) => H[e]), e),
280
- style: S,
281
- ...u,
282
- children: f && Array.from({ length: x - y }, (e, t) => {
283
- let n = t + y;
284
- return /* @__PURE__ */ b("div", {
285
- className: H.row,
286
- "data-row-index": n,
287
- style: v.getRowStyle(n)
325
+ className: o(...x.classTokens.map((e) => G[e]), G[m], S && G.compact, e),
326
+ style: E,
327
+ ...W(f),
328
+ children: h && !S && Array.from({ length: T - C }, (e, t) => {
329
+ let n = t + C;
330
+ return /* @__PURE__ */ w("div", {
331
+ className: G.row,
332
+ "data-row-index": p.domDiagnostics ? n : void 0,
333
+ style: x.getRowStyle(n)
288
334
  }, n);
289
335
  })
290
336
  });
291
- }), W = p.memo(function({ className: e, debugging: t, style: r, variant: i, height: a, width: o, base: s, color: c, ssrMode: l = !1, ...u }) {
292
- let d = I("baseline"), f = i ?? d.variant, p = s ?? d.base, { isShown: m } = L(t, d.debugging);
293
- if (!m) return /* @__PURE__ */ b("div", {
294
- className: n(H.bas, H.h, e),
337
+ }), ae = _.memo(function({ className: t, debugging: n, style: r, variant: i, height: a, width: s, base: c, color: l, ssrMode: u = !1, ...d }) {
338
+ let f = R("baseline"), p = i ?? f.variant, m = c ?? f.base, { isShown: h } = z(n, f.debugging);
339
+ if (!h) return /* @__PURE__ */ w("div", {
340
+ className: o(G.bas, G.h, G[p], t),
295
341
  style: r,
296
- "data-testid": "baseline",
342
+ "data-testid": f.domDiagnostics ? "baseline" : void 0,
297
343
  "aria-hidden": "true",
298
- ...u
344
+ ...W(d)
299
345
  });
300
- let h = /* @__PURE__ */ b("div", {
301
- className: n(H.bas, H.h, H.ssr, e),
302
- style: {
303
- width: o ?? "100%",
304
- height: a ?? "100%",
305
- ...r
306
- },
307
- "data-testid": "baseline",
308
- "aria-hidden": "true"
346
+ let g = /* @__PURE__ */ w("div", {
347
+ className: o(G.bas, G.h, G.ssr, G[p], t),
348
+ style: V(U({
349
+ width: e(s ?? "100%"),
350
+ height: e(a ?? "100%")
351
+ }, {
352
+ width: "100%",
353
+ height: "100%"
354
+ }), r),
355
+ "data-testid": f.domDiagnostics ? "baseline" : void 0,
356
+ "aria-hidden": "true",
357
+ ...W(d)
309
358
  });
310
- return l ? h : /* @__PURE__ */ b(z, {
311
- fallback: h,
312
- children: /* @__PURE__ */ b(U, {
313
- className: e,
314
- debugging: t,
359
+ return u ? g : /* @__PURE__ */ w(ne, {
360
+ fallback: g,
361
+ children: /* @__PURE__ */ w(ie, {
362
+ className: t,
363
+ debugging: n,
315
364
  style: r,
316
- variant: f,
365
+ variant: p,
317
366
  height: a,
318
- width: o,
319
- base: p,
320
- color: c,
321
- ...u
367
+ width: s,
368
+ base: m,
369
+ color: l,
370
+ ...d
322
371
  })
323
372
  });
324
- }), G = {
373
+ }), K = {
325
374
  gde: "gde_4PKz3",
326
375
  v: "v_yAvN0",
327
376
  h: "h_XcWcy",
328
377
  line: "line_UaLjW",
329
378
  cols: "cols_ibtT4",
330
379
  col: "col_QPSDI",
380
+ pattern: "pattern_8ihi5",
381
+ auto: "auto_xzTBc",
382
+ fixed: "fixed_g2rOO",
383
+ compactFixed: "compactFixed_C3AMS",
331
384
  ssr: "ssr_4UN4k"
332
- }, ee = p.memo(function({ className: e, debugging: t, style: r, variant: i, align: a = "center", gap: o, height: s, width: c, columns: l, columnWidth: u, maxWidth: d, color: f, children: p, ssrMode: m = !1, ...h }) {
333
- let g = I("guide"), _ = i ?? g.variant, v = typeof o == "number" ? o : 0, { isShown: y } = L(t, g.debugging);
334
- if (!y) return /* @__PURE__ */ b("div", {
335
- className: n(G.gde, G.h, e),
385
+ }, oe = _.memo(function({ className: t, debugging: n, style: r, variant: i, align: a = "center", gap: s, height: c, width: l, columns: u, columnWidth: d, maxWidth: f, color: p, children: m, ssrMode: h = !1, ...g }) {
386
+ let _ = R("guide"), v = i ?? _.variant, y = typeof s == "number" ? s : 0, { isShown: b } = z(n, _.debugging);
387
+ if (!b) return /* @__PURE__ */ w("div", {
388
+ className: o(K.gde, K.h, K[v], t),
336
389
  style: r,
337
- "data-testid": "guide",
338
- "data-variant": _,
390
+ "data-testid": _.domDiagnostics ? "guide" : void 0,
391
+ "data-variant": _.domDiagnostics ? v : void 0,
339
392
  "aria-hidden": "true",
340
- ...h,
341
- children: p
393
+ ...g,
394
+ children: m
342
395
  });
343
- let x = /* @__PURE__ */ b("div", {
344
- className: n(G.gde, G.h, G.ssr, e),
345
- style: {
346
- width: c ?? "100%",
347
- height: s ?? "100%",
348
- maxWidth: d ?? "none",
349
- ...r
350
- },
351
- "data-testid": "guide",
352
- "data-variant": _,
396
+ let x = /* @__PURE__ */ w("div", {
397
+ className: o(K.gde, K.h, K.ssr, K[v], t),
398
+ style: V(U({
399
+ width: e(l ?? "100%"),
400
+ height: e(c ?? "100%"),
401
+ maxWidth: e(f ?? "none")
402
+ }, {
403
+ width: "100%",
404
+ height: "100%",
405
+ maxWidth: "none"
406
+ }), r),
407
+ "data-testid": _.domDiagnostics ? "guide" : void 0,
408
+ "data-variant": _.domDiagnostics ? v : void 0,
353
409
  "aria-hidden": "true",
354
- children: p
410
+ ...g,
411
+ children: m
355
412
  });
356
- return m ? x : /* @__PURE__ */ b(z, {
413
+ return h ? x : /* @__PURE__ */ w(ne, {
357
414
  fallback: x,
358
- children: /* @__PURE__ */ b(te, {
359
- className: e,
360
- debugging: t,
415
+ children: /* @__PURE__ */ w(se, {
416
+ className: t,
417
+ debugging: n,
361
418
  style: r,
362
- variant: _,
419
+ variant: v,
363
420
  align: a,
364
- gap: v,
365
- height: s,
366
- width: c,
367
- columns: l,
368
- columnWidth: u,
369
- maxWidth: d,
370
- color: f,
371
- ...h,
372
- children: p
421
+ gap: y,
422
+ height: c,
423
+ width: l,
424
+ columns: u,
425
+ columnWidth: d,
426
+ maxWidth: f,
427
+ color: p,
428
+ ...g,
429
+ children: m
373
430
  })
374
431
  });
375
- }), te = p.memo(function({ className: e, debugging: r, style: i, variant: a, align: o = "center", gap: s, height: l, width: u, columns: d, columnWidth: f, maxWidth: m, color: h, children: g, ..._ }) {
376
- let v = I("guide"), { isShown: y } = L(r, v.debugging), S = p.useRef(null);
377
- A(S);
378
- let C = a ?? v.variant, w = typeof s == "number" ? s : 0, { template: T, columnsCount: E, calculatedGap: D } = F(S, p.useMemo(() => t({
432
+ }), se = _.memo(function({ className: e, debugging: n, style: r, variant: a, align: s = "center", gap: c, height: u, width: d, columns: f, columnWidth: m, maxWidth: h, color: g, children: v, ...y }) {
433
+ let b = R("guide"), { isShown: x } = z(n, b.debugging), S = _.useRef(null);
434
+ P(S);
435
+ let C = a ?? b.variant, E = typeof c == "number" ? c : 0, { template: D, columnsCount: O, calculatedGap: k } = te(S, _.useMemo(() => i({
379
436
  variant: C,
380
- base: v.base,
381
- gap: w,
382
- columns: d,
383
- columnWidth: f
437
+ base: b.base,
438
+ gap: E,
439
+ columns: f,
440
+ columnWidth: m
384
441
  }), [
385
442
  C,
386
- v.base,
387
- w,
388
- d,
389
- f
390
- ])), O = p.useMemo(() => c({
391
- base: v.base,
392
- colors: v.colors,
443
+ b.base,
444
+ E,
445
+ f,
446
+ m
447
+ ])), A = p({
393
448
  variant: C,
394
- align: o || "center",
395
- width: u,
396
- height: l,
397
- columnWidth: f,
398
- maxWidth: m,
399
- color: h,
400
- template: T,
401
- columnsCount: E,
402
- calculatedGap: D,
403
- isVisible: y
449
+ columns: f,
450
+ columnWidth: m,
451
+ gap: E,
452
+ align: s,
453
+ domDiagnostics: b.domDiagnostics,
454
+ className: e,
455
+ style: r
456
+ }), j = _.useMemo(() => l({
457
+ base: b.base,
458
+ colors: b.colors,
459
+ variant: C,
460
+ align: s || "center",
461
+ width: d,
462
+ height: u,
463
+ columnWidth: m,
464
+ maxWidth: h,
465
+ color: g,
466
+ template: D,
467
+ columnsCount: O,
468
+ calculatedGap: k,
469
+ isVisible: x
404
470
  }), [
405
- v.base,
406
- v.colors,
471
+ b.base,
472
+ b.colors,
407
473
  C,
408
- o,
474
+ s,
475
+ d,
409
476
  u,
410
- l,
411
- f,
412
477
  m,
413
478
  h,
414
- T,
415
- E,
479
+ g,
416
480
  D,
417
- y
418
- ]), k = p.useMemo(() => B(O.containerStyle, i), [O.containerStyle, i]);
419
- return /* @__PURE__ */ x("div", {
481
+ O,
482
+ k,
483
+ x
484
+ ]), M = _.useMemo(() => V(U(j.containerStyle, {
485
+ "--bkgd-w": "100%",
486
+ "--bkgd-h": "100%",
487
+ "--bkgd-mw": "none",
488
+ "--bkgd-cw": "60px",
489
+ "--bkgd-n": "12",
490
+ "--bkgd-b": "0",
491
+ "--bkgd-cl": t.guide.colors.line,
492
+ "--bkgd-cp": t.guide.colors.pattern,
493
+ "--bkgd-ca": t.guide.colors.auto,
494
+ "--bkgd-cf": t.guide.colors.fixed,
495
+ "--bkgd-g": "0px",
496
+ "--bkgd-j": "center",
497
+ "--bkgd-t": "none",
498
+ "--bkgd-line-color": "var(--bkgd-cl)"
499
+ }), r), [j.containerStyle, r]);
500
+ return /* @__PURE__ */ T("div", {
420
501
  ref: S,
421
- "data-testid": "guide",
502
+ "data-testid": b.domDiagnostics ? "guide" : void 0,
422
503
  "aria-hidden": "true",
423
- className: n(...O.classTokens.map((e) => G[e]), e),
424
- "data-variant": a,
425
- style: k,
426
- ..._,
427
- children: [y && /* @__PURE__ */ b("div", {
428
- className: G.cols,
429
- "data-variant": a,
430
- children: !O.isLineVariant && Array.from({ length: O.columnsCount }, (e, t) => /* @__PURE__ */ b("div", {
431
- className: G.col,
432
- "data-column-index": t,
433
- "data-variant": a
504
+ className: o(...j.classTokens.map((e) => K[e]), !j.classTokens.includes(C) && K[C], e),
505
+ "data-variant": b.domDiagnostics ? C : void 0,
506
+ style: M,
507
+ ...y,
508
+ children: [x && /* @__PURE__ */ w("div", {
509
+ className: o(K.cols, K[C], A && K.compactFixed),
510
+ "data-variant": b.domDiagnostics ? C : void 0,
511
+ children: !j.isLineVariant && !A && Array.from({ length: j.columnsCount }, (e, t) => /* @__PURE__ */ w("div", {
512
+ className: o(K.col, K[C]),
513
+ "data-column-index": b.domDiagnostics ? t : void 0,
514
+ "data-variant": b.domDiagnostics ? C : void 0
434
515
  }, t))
435
- }), g]
516
+ }), v]
436
517
  });
437
- }), K = typeof window > "u";
438
- function ne(e, t) {
439
- if (K) return t;
518
+ }), q = typeof window > "u";
519
+ function ce(e, t) {
520
+ if (q) return t;
440
521
  try {
441
522
  return e();
442
523
  } catch {
443
524
  return t;
444
525
  }
445
526
  }
446
- function q(e, t, n) {
447
- return !e || K ? t : n;
527
+ function J(e, t, n) {
528
+ return !e || q ? t : n;
448
529
  }
449
- var J = {
530
+ var Y = {
450
531
  spr: "spr_syfhf",
451
532
  line: "line_nzGsp",
452
533
  flat: "flat_XJWHt",
453
534
  indicator: "indicator_inw1x"
454
- }, Y = p.memo(function({ height: e, width: t, indicatorNode: r, debugging: i, variant: a, base: o, color: c, className: l, style: u, children: d, ssrMode: f = !1, ...m }) {
455
- let h = p.useRef(null), g = I("spacer"), { isShown: _ } = L(i, g.debugging), v = a ?? g.variant, S = o ?? g.base, C = R(), w = p.useMemo(() => s({
456
- base: S,
535
+ }, X = _.memo(function({ height: e, width: n, indicatorNode: r, debugging: i, variant: a, base: s, color: c, className: l, style: d, children: f, ssrMode: p = !1, ...m }) {
536
+ let h = _.useRef(null), g = R("spacer"), { isShown: v } = z(i, g.debugging), y = a ?? g.variant, b = s ?? g.base, x = B(), S = _.useMemo(() => u({
537
+ base: b,
457
538
  colors: g.colors,
458
- width: t,
539
+ width: n,
459
540
  height: e,
460
541
  color: c,
461
- variant: v,
462
- isVisible: _
542
+ variant: y,
543
+ isVisible: v
463
544
  }), [
464
- S,
545
+ b,
465
546
  g.colors,
466
- t,
547
+ n,
467
548
  e,
468
549
  c,
469
- v,
470
- _
471
- ]), T = q(C && !f, !1, _ && r !== void 0), E = p.useMemo(() => {
472
- if (!T) return null;
473
- let e = w.normWidth, t = w.normHeight;
474
- return /* @__PURE__ */ x(y, { children: [t !== 0 && /* @__PURE__ */ b("span", {
475
- className: J.indicator,
550
+ y,
551
+ v
552
+ ]), E = J(x && !p, !1, v && r !== void 0), D = _.useMemo(() => {
553
+ if (!E) return null;
554
+ let e = S.normWidth, t = S.normHeight;
555
+ return /* @__PURE__ */ T(C, { children: [t !== 0 && /* @__PURE__ */ w("span", {
556
+ className: Y.indicator,
476
557
  "aria-hidden": "true",
477
558
  children: r(t, "height")
478
- }, "height"), e !== 0 && /* @__PURE__ */ b("span", {
479
- className: J.indicator,
559
+ }, "height"), e !== 0 && /* @__PURE__ */ w("span", {
560
+ className: Y.indicator,
480
561
  "aria-hidden": "true",
481
562
  children: r(e, "width")
482
563
  }, "width")] });
483
564
  }, [
484
- T,
565
+ E,
485
566
  r,
486
- w.normWidth,
487
- w.normHeight
488
- ]), D = p.useMemo(() => B(w.style, u), [w.style, u]);
489
- return /* @__PURE__ */ x("div", {
567
+ S.normWidth,
568
+ S.normHeight
569
+ ]), O = _.useMemo(() => V(U(S.style, {
570
+ "--bksp-w": "var(--bk-wf, 100%)",
571
+ "--bksp-h": "var(--bk-hf, auto)",
572
+ "--bksp-b": "8px",
573
+ "--bksp-cl": t.spacer.colors.line,
574
+ "--bksp-cf": t.spacer.colors.flat,
575
+ "--bksp-ct": t.spacer.colors.text
576
+ }), d), [S.style, d]);
577
+ return /* @__PURE__ */ T("div", {
490
578
  ref: h,
491
- "data-testid": "spacer",
492
- className: n(...w.classTokens.map((e) => J[e]), l),
493
- "data-variant": v,
494
- "data-height": typeof w.normHeight == "number" ? `${w.normHeight}px` : w.normHeight,
495
- style: D,
579
+ "data-testid": g.domDiagnostics ? "spacer" : void 0,
580
+ className: o(...S.classTokens.map((e) => Y[e]), l),
581
+ "data-variant": g.domDiagnostics ? y : void 0,
582
+ "data-height": g.domDiagnostics ? typeof S.normHeight == "number" ? `${S.normHeight}px` : S.normHeight : void 0,
583
+ style: O,
496
584
  ...m,
497
- children: [E, d]
585
+ children: [D, f]
498
586
  });
499
- }), X = {
587
+ }), Z = {
500
588
  pad: "pad_NizuS",
501
589
  content: "content_xFX0U",
590
+ topEdge: "topEdge_7hMCE",
591
+ leftEdge: "leftEdge_1Dc-j",
592
+ rightEdge: "rightEdge_P7r9Z",
593
+ bottomEdge: "bottomEdge_PfOep",
502
594
  v: "v_dowAz"
503
- }, re = (e, t, n) => {
504
- let r = e || "line", i = t || "none", a = (e, t) => /* @__PURE__ */ b(Y, {
595
+ }, le = (e, t, n) => {
596
+ let r = e || "line", i = t || "none", a = (e, t) => /* @__PURE__ */ w(X, {
505
597
  variant: r,
506
598
  debugging: t === 0 || e === 0 ? "none" : i,
507
599
  indicatorNode: n,
@@ -509,133 +601,172 @@ var J = {
509
601
  width: e === "100%" ? void 0 : e
510
602
  });
511
603
  return a.displayName = "PadderSpacer", a;
512
- }, Z = { gridColumn: "1 / -1" }, Q = { gridRow: "2 / 3" }, ie = {
513
- gridRow: "2 / 3",
514
- gridColumn: "2 / 3"
515
- }, $ = p.memo(p.forwardRef(function({ children: e, className: t, debugging: i, height: a, indicatorNode: o, style: s, width: c, ssrMode: l = !1, ...u }, d) {
516
- let m = I("padder"), { variant: h } = I("spacer"), g = p.useMemo(() => r(u), [u]), { isShown: _, isNone: v, debugging: S } = L(i, m.debugging), C = !v, w = R(), T = p.useRef(null), E = N(T, {
517
- base: m.base,
604
+ }, Q = _.memo(_.forwardRef(function({ children: e, className: n, debugging: r, height: i, indicatorNode: a, style: s, width: c, ssrMode: l = !1, preserveContentHost: u = !1, ...d }, f) {
605
+ let p = R("padder"), { variant: h } = R("spacer"), v = _.useMemo(() => g(d), [d]), { isShown: y, isNone: b, debugging: x } = z(r, p.debugging), S = !b, E = B(), D = _.useRef(null), O = L(D, {
606
+ base: p.base,
518
607
  snapping: "height",
519
- spacing: g
520
- }), D = { padding: {
521
- top: g.top || 0,
522
- right: g.right || 0,
523
- bottom: g.bottom || 0,
524
- left: g.left || 0
525
- } }, { padding: O } = q(w && !l, D, E), k = V(d, T), A = p.useMemo(() => f({
526
- base: m.base,
527
- color: m.color,
608
+ spacing: v
609
+ }), k = { padding: {
610
+ top: v.top || 0,
611
+ right: v.right || 0,
612
+ bottom: v.bottom || 0,
613
+ left: v.left || 0
614
+ } }, { padding: A } = J(E && !l, k, O), j = H(f, D), M = _.useMemo(() => m({
615
+ base: p.base,
616
+ color: p.color,
528
617
  width: c,
529
- height: a,
530
- padding: O,
531
- enableSpacers: C,
532
- isVisible: _
618
+ height: i,
619
+ padding: A,
620
+ enableSpacers: S,
621
+ isVisible: y
533
622
  }), [
534
- m.base,
535
- m.color,
623
+ p.base,
624
+ p.color,
536
625
  c,
537
- a,
538
- O,
539
- C,
540
- _
541
- ]), j = p.useMemo(() => B(A.containerStyle, s), [A.containerStyle, s]), M = p.useMemo(() => re(h, S, o), [
542
- h,
626
+ i,
627
+ A,
543
628
  S,
544
- o
629
+ y
630
+ ]), N = _.useMemo(() => V(U(M.containerStyle, {
631
+ "--bkpd-w": "fit-content",
632
+ "--bkpd-h": "fit-content",
633
+ "--bkpd-b": "8px",
634
+ "--bkpd-c": t.padder.color
635
+ }), s), [M.containerStyle, s]), P = _.useMemo(() => le(h, x, a), [
636
+ h,
637
+ x,
638
+ a
545
639
  ]);
546
- return C ? /* @__PURE__ */ x("div", {
547
- ref: k,
548
- "data-testid": "padder",
549
- className: n(...A.classTokens.map((e) => X[e]), t),
550
- style: j,
640
+ return S ? /* @__PURE__ */ T("div", {
641
+ ref: j,
642
+ "data-testid": p.domDiagnostics ? "padder" : void 0,
643
+ className: o(...M.classTokens.map((e) => Z[e]), n),
644
+ style: N,
645
+ ...W(d),
551
646
  children: [
552
- /* @__PURE__ */ x(y, { children: [O.top >= 0 && /* @__PURE__ */ b("div", {
553
- style: Z,
554
- children: M("100%", O.top)
555
- }), O.left >= 0 && /* @__PURE__ */ b("div", {
556
- style: Q,
557
- children: M(O.left, "100%")
647
+ /* @__PURE__ */ T(C, { children: [A.top > 0 && /* @__PURE__ */ w("div", {
648
+ className: Z.topEdge,
649
+ children: P("100%", A.top)
650
+ }), A.left > 0 && /* @__PURE__ */ w("div", {
651
+ className: Z.leftEdge,
652
+ children: P(A.left, "100%")
558
653
  })] }),
559
- /* @__PURE__ */ b("div", {
560
- "data-testid": "padder-content",
561
- className: X.content,
562
- style: ie,
654
+ /* @__PURE__ */ w("div", {
655
+ "data-testid": p.domDiagnostics ? "padder-content" : void 0,
656
+ className: Z.content,
563
657
  children: e
564
- }),
565
- /* @__PURE__ */ x(y, { children: [O.right >= 0 && /* @__PURE__ */ b("div", {
566
- style: Q,
567
- children: M(O.right, "100%")
568
- }), O.bottom >= 0 && /* @__PURE__ */ b("div", {
569
- style: Z,
570
- children: M("100%", O.bottom)
658
+ }, "content"),
659
+ /* @__PURE__ */ T(C, { children: [A.right > 0 && /* @__PURE__ */ w("div", {
660
+ className: Z.rightEdge,
661
+ children: P(A.right, "100%")
662
+ }), A.bottom > 0 && /* @__PURE__ */ w("div", {
663
+ className: Z.bottomEdge,
664
+ children: P("100%", A.bottom)
571
665
  })] })
572
666
  ]
573
- }) : /* @__PURE__ */ b("div", {
574
- ref: k,
575
- "data-testid": "padder",
576
- className: n(...A.classTokens.map((e) => X[e]), t),
577
- style: j,
578
- children: e
667
+ }) : /* @__PURE__ */ w("div", {
668
+ ref: j,
669
+ "data-testid": p.domDiagnostics ? "padder" : void 0,
670
+ className: o(...M.classTokens.map((e) => Z[e]), n),
671
+ style: N,
672
+ ...W(d),
673
+ children: u ? /* @__PURE__ */ w("div", {
674
+ "data-testid": p.domDiagnostics ? "padder-content" : void 0,
675
+ className: Z.content,
676
+ children: e
677
+ }, "content") : e
579
678
  });
580
- })), ae = {
679
+ })), ue = Q, de = Q, $ = {
581
680
  box: "box_sPqFs",
582
- v: "v_ZrZ5j"
583
- }, oe = p.memo(p.forwardRef(function({ children: e, snapping: t = "clamp", snapEdge: i = "bottom", debugging: a, className: o, colSpan: s, rowSpan: c, span: l, width: d, height: f, style: m, ssrMode: h = !1, ...g }, _) {
584
- let v = I("box"), { isShown: y, debugging: x } = L(a, v.debugging), S = R(), C = p.useRef(null), { top: w, bottom: T, left: D, right: O } = r(g), k = N(C, {
585
- base: v.base,
586
- snapping: t,
587
- snapEdge: i,
681
+ v: "v_ZrZ5j",
682
+ padderVisible: "padderVisible_zft5p",
683
+ separatePadder: "separatePadder_BmOqc"
684
+ }, fe = _.memo(_.forwardRef(function({ children: e, snapping: n = "clamp", snapEdge: r = "bottom", debugging: i, className: a, colSpan: c, rowSpan: l, span: u, width: d, height: p, style: m, ssrMode: h = !1, ...v }, y) {
685
+ let b = R("box"), x = R("padder"), { isShown: S, debugging: C } = z(i, b.debugging), T = B(), E = _.useRef(null), { top: D, bottom: O, left: k, right: j } = g(v), M = L(E, {
686
+ base: b.base,
687
+ snapping: n,
688
+ snapEdge: r,
588
689
  spacing: {
589
- top: w,
590
- bottom: T,
591
- left: D,
592
- right: O
690
+ top: D,
691
+ bottom: O,
692
+ left: k,
693
+ right: j
593
694
  }
594
- }), { padding: A } = q(S && !h, { padding: {
595
- top: w || 0,
596
- right: O || 0,
597
- bottom: T || 0,
598
- left: D || 0
599
- } }, k), j = p.useMemo(() => u({
600
- base: v.base,
601
- lineColor: v.colors.line,
695
+ }), { padding: N } = J(T && !h, { padding: {
696
+ top: D || 0,
697
+ right: j || 0,
698
+ bottom: O || 0,
699
+ left: k || 0
700
+ } }, M), P = _.useMemo(() => f({
701
+ base: b.base,
702
+ lineColor: b.colors.line,
602
703
  width: d,
603
- height: f,
604
- span: l,
605
- colSpan: s,
606
- rowSpan: c,
607
- isVisible: y
704
+ height: p,
705
+ span: u,
706
+ colSpan: c,
707
+ rowSpan: l,
708
+ isVisible: S
608
709
  }), [
609
- v.base,
610
- v.colors.line,
710
+ b.base,
711
+ b.colors.line,
611
712
  d,
612
- f,
613
- l,
614
- s,
713
+ p,
714
+ u,
615
715
  c,
616
- y
617
- ]), M = p.useMemo(() => B(j.boxStyle, m), [j.boxStyle, m]);
618
- return /* @__PURE__ */ b("div", {
619
- ref: V(_, C),
620
- "data-testid": "box",
621
- className: n(...j.classTokens.map((e) => ae[e]), o),
622
- style: B(M, j.gridSpanStyle),
623
- children: /* @__PURE__ */ b(E, {
716
+ l,
717
+ S
718
+ ]), F = s({
719
+ className: a,
720
+ style: m,
721
+ width: d
722
+ }), I = _.useMemo(() => V(U(P.boxStyle, {
723
+ "--bkbx-w": "fit-content",
724
+ "--bkbx-h": "fit-content",
725
+ "--bkbx-cl": t.box.colors.line
726
+ }), F ? void 0 : V(U({
727
+ ...N.top > 0 || N.bottom > 0 ? { gridTemplateRows: `${N.top}px 1fr ${N.bottom}px` } : {},
728
+ ...N.left > 0 || N.right > 0 ? { gridTemplateColumns: `${N.left}px 1fr ${N.right}px` } : {}
729
+ }, {
730
+ gridTemplateRows: "auto 1fr auto",
731
+ gridTemplateColumns: "auto 1fr auto"
732
+ }), S ? U({ "--bkpd-c": x.color }, { "--bkpd-c": t.padder.color }) : void 0), m), [
733
+ P.boxStyle,
734
+ F,
735
+ m,
736
+ x.color,
737
+ S,
738
+ N.top,
739
+ N.right,
740
+ N.bottom,
741
+ N.left
742
+ ]);
743
+ return /* @__PURE__ */ w("div", {
744
+ ref: H(y, E),
745
+ "data-testid": b.domDiagnostics ? "box" : void 0,
746
+ className: o(...P.classTokens.map((e) => $[e]), F && $.separatePadder, S && !F && $.padderVisible, a),
747
+ style: V(I, P.gridSpanStyle),
748
+ ...W(v),
749
+ children: /* @__PURE__ */ w(A, {
624
750
  base: 1,
625
751
  spacer: { variant: "flat" },
626
- children: /* @__PURE__ */ b($, {
627
- block: [A.top, A.bottom],
628
- inline: [A.left, A.right],
752
+ children: F ? /* @__PURE__ */ w(de, {
753
+ block: [N.top, N.bottom],
754
+ inline: [N.left, N.right],
629
755
  width: "fit-content",
630
- height: f,
631
- debugging: x,
756
+ height: p,
757
+ debugging: C,
758
+ preserveContentHost: !0,
632
759
  ssrMode: !0,
633
760
  children: e
761
+ }) : /* @__PURE__ */ w("div", {
762
+ "data-testid": b.domDiagnostics ? "padder-content" : void 0,
763
+ className: Z.content,
764
+ children: e
634
765
  })
635
766
  })
636
767
  });
637
768
  }));
638
769
  //#endregion
639
- export { W as Baseline, oe as Box, E as Config, ee as Guide, $ as Padder, Y as Spacer, K as isSSR, ne as safeClientValue };
770
+ export { ae as Baseline, fe as Box, A as Config, oe as Guide, ue as Padder, X as Spacer, q as isSSR, ce as safeClientValue };
640
771
 
641
772
  //# sourceMappingURL=index.mjs.map