baseline-kit 5.1.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-C3TICsw6.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,42 +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", spacing: i = {} } = {}) {
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: a } = A(e), s = p.useRef(null);
155
- return p.useMemo(() => {
156
- let e = r({ padding: i }), c = a % 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
161
  isAligned: c,
160
- height: a
162
+ height: o
161
163
  };
162
164
  if (s.current) return {
163
165
  padding: s.current,
164
166
  isAligned: c,
165
- height: a
167
+ height: o
166
168
  };
167
- if (a === 0) return {
169
+ if (o === 0) return {
168
170
  padding: e,
169
171
  isAligned: c,
170
- height: a
172
+ height: o
171
173
  };
172
- let l = o(a, t, e, n);
174
+ let l = n(o, t, e, {
175
+ mode: r,
176
+ snapEdge: i
177
+ });
173
178
  return s.current = l, {
174
179
  padding: l,
175
180
  isAligned: c,
176
- height: a
181
+ height: o
177
182
  };
178
183
  }, [
179
184
  t,
180
- n,
185
+ r,
181
186
  i,
182
- a
187
+ a,
188
+ o
183
189
  ]);
184
190
  }
185
191
  //#endregion
186
192
  //#region packages/dom/src/viewport.ts
187
- function P() {
193
+ function ee() {
188
194
  return typeof window > "u" ? {} : {
189
195
  viewportWidth: window.innerWidth,
190
196
  viewportHeight: window.innerHeight
@@ -192,312 +198,402 @@ function P() {
192
198
  }
193
199
  //#endregion
194
200
  //#region packages/react/src/hooks/useGuide.ts
195
- function F(e, t) {
196
- let { width: n } = A(e);
197
- 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]);
198
204
  }
199
205
  //#endregion
200
206
  //#region packages/react/src/hooks/useConfig.ts
201
- function I(e) {
202
- let t = T();
203
- 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]);
204
213
  }
205
214
  //#endregion
206
215
  //#region packages/react/src/hooks/useDebug.ts
207
- function L(e, t) {
208
- return _(() => l(e, t), [e, t]);
216
+ function z(e, t) {
217
+ return x(() => a(e, t), [e, t]);
209
218
  }
210
219
  //#endregion
211
220
  //#region packages/react/src/hooks/useIsClient.ts
212
- function R() {
213
- let [e, t] = v(!1);
214
- return h(() => {
221
+ function B() {
222
+ let [e, t] = S(!1);
223
+ return y(() => {
215
224
  t(!0);
216
225
  }, []), e;
217
226
  }
218
227
  //#endregion
219
228
  //#region packages/react/src/utils/ssr.tsx
220
- function z({ children: e, fallback: t = null }) {
221
- 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 });
222
231
  }
223
232
  //#endregion
224
233
  //#region packages/react/src/utils/merge.ts
225
- function B(...e) {
234
+ function V(...e) {
226
235
  return Object.assign({}, ...e.filter(Boolean));
227
236
  }
228
- function V(...e) {
237
+ function H(...e) {
229
238
  return (t) => {
230
239
  e.forEach((e) => {
231
240
  e && (typeof e == "function" ? e(t) : Object.assign(e, { current: t }));
232
241
  });
233
242
  };
234
243
  }
235
- 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 = {
236
262
  bas: "bas_4Emvv",
263
+ line: "line_jXAw3",
264
+ flat: "flat_DwUeJ",
265
+ compact: "compact_CjR0G",
237
266
  v: "v_lNfeX",
238
267
  h: "h_PbNDU",
239
268
  row: "row_J1Wva",
240
269
  ssr: "ssr_PQAP-"
241
- }, U = p.memo(function({ className: e, debugging: t, style: r, variant: a, height: o, width: s, base: c, color: l, ...u }) {
242
- 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({
243
- base: _,
244
- colors: d.colors,
245
- variant: a ?? d.variant,
246
- width: s,
247
- height: o,
248
- color: l,
249
- containerWidth: h,
250
- containerHeight: g,
251
- spacing: u,
252
- 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
253
282
  }), [
254
- _,
255
- d.colors,
256
- d.variant,
257
- a,
283
+ b,
284
+ p.colors,
285
+ m,
286
+ c,
258
287
  s,
259
- o,
260
- l,
261
- h,
262
- g,
263
288
  u,
264
- f
265
- ]), { start: y, end: x } = M({
266
- totalLines: v.rowCount,
267
- lineHeight: _,
268
- 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,
269
303
  buffer: 160
270
- }), S = p.useMemo(() => B(v.containerStyle, r), [v.containerStyle, r]);
271
- return /* @__PURE__ */ b("div", {
272
- ref: m,
273
- "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,
274
324
  "aria-hidden": "true",
275
- className: n(...v.classTokens.map((e) => H[e]), e),
276
- style: S,
277
- ...u,
278
- children: f && Array.from({ length: x - y }, (e, t) => {
279
- let n = t + y;
280
- return /* @__PURE__ */ b("div", {
281
- className: H.row,
282
- "data-row-index": n,
283
- 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)
284
334
  }, n);
285
335
  })
286
336
  });
287
- }), W = p.memo(function({ className: e, debugging: t, style: r, variant: i, height: a, width: o, base: s, color: c, ssrMode: l = !1, ...u }) {
288
- let d = I("baseline"), f = i ?? d.variant, p = s ?? d.base, { isShown: m } = L(t, d.debugging);
289
- if (!m) return /* @__PURE__ */ b("div", {
290
- 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),
291
341
  style: r,
292
- "data-testid": "baseline",
342
+ "data-testid": f.domDiagnostics ? "baseline" : void 0,
293
343
  "aria-hidden": "true",
294
- ...u
344
+ ...W(d)
295
345
  });
296
- let h = /* @__PURE__ */ b("div", {
297
- className: n(H.bas, H.h, H.ssr, e),
298
- style: {
299
- width: o ?? "100%",
300
- height: a ?? "100%",
301
- ...r
302
- },
303
- "data-testid": "baseline",
304
- "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)
305
358
  });
306
- return l ? h : /* @__PURE__ */ b(z, {
307
- fallback: h,
308
- children: /* @__PURE__ */ b(U, {
309
- className: e,
310
- debugging: t,
359
+ return u ? g : /* @__PURE__ */ w(ne, {
360
+ fallback: g,
361
+ children: /* @__PURE__ */ w(ie, {
362
+ className: t,
363
+ debugging: n,
311
364
  style: r,
312
- variant: f,
365
+ variant: p,
313
366
  height: a,
314
- width: o,
315
- base: p,
316
- color: c,
317
- ...u
367
+ width: s,
368
+ base: m,
369
+ color: l,
370
+ ...d
318
371
  })
319
372
  });
320
- }), G = {
373
+ }), K = {
321
374
  gde: "gde_4PKz3",
322
375
  v: "v_yAvN0",
323
376
  h: "h_XcWcy",
324
377
  line: "line_UaLjW",
325
378
  cols: "cols_ibtT4",
326
379
  col: "col_QPSDI",
380
+ pattern: "pattern_8ihi5",
381
+ auto: "auto_xzTBc",
382
+ fixed: "fixed_g2rOO",
383
+ compactFixed: "compactFixed_C3AMS",
327
384
  ssr: "ssr_4UN4k"
328
- }, 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 }) {
329
- let g = I("guide"), _ = i ?? g.variant, v = typeof o == "number" ? o : 0, { isShown: y } = L(t, g.debugging);
330
- if (!y) return /* @__PURE__ */ b("div", {
331
- 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),
332
389
  style: r,
333
- "data-testid": "guide",
334
- "data-variant": _,
390
+ "data-testid": _.domDiagnostics ? "guide" : void 0,
391
+ "data-variant": _.domDiagnostics ? v : void 0,
335
392
  "aria-hidden": "true",
336
- ...h,
337
- children: p
393
+ ...g,
394
+ children: m
338
395
  });
339
- let x = /* @__PURE__ */ b("div", {
340
- className: n(G.gde, G.h, G.ssr, e),
341
- style: {
342
- width: c ?? "100%",
343
- height: s ?? "100%",
344
- maxWidth: d ?? "none",
345
- ...r
346
- },
347
- "data-testid": "guide",
348
- "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,
349
409
  "aria-hidden": "true",
350
- children: p
410
+ ...g,
411
+ children: m
351
412
  });
352
- return m ? x : /* @__PURE__ */ b(z, {
413
+ return h ? x : /* @__PURE__ */ w(ne, {
353
414
  fallback: x,
354
- children: /* @__PURE__ */ b(te, {
355
- className: e,
356
- debugging: t,
415
+ children: /* @__PURE__ */ w(se, {
416
+ className: t,
417
+ debugging: n,
357
418
  style: r,
358
- variant: _,
419
+ variant: v,
359
420
  align: a,
360
- gap: v,
361
- height: s,
362
- width: c,
363
- columns: l,
364
- columnWidth: u,
365
- maxWidth: d,
366
- color: f,
367
- ...h,
368
- 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
369
430
  })
370
431
  });
371
- }), 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, ..._ }) {
372
- let v = I("guide"), { isShown: y } = L(r, v.debugging), S = p.useRef(null);
373
- A(S);
374
- 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({
375
436
  variant: C,
376
- base: v.base,
377
- gap: w,
378
- columns: d,
379
- columnWidth: f
437
+ base: b.base,
438
+ gap: E,
439
+ columns: f,
440
+ columnWidth: m
380
441
  }), [
381
442
  C,
382
- v.base,
383
- w,
384
- d,
385
- f
386
- ])), O = p.useMemo(() => c({
387
- base: v.base,
388
- colors: v.colors,
443
+ b.base,
444
+ E,
445
+ f,
446
+ m
447
+ ])), A = p({
389
448
  variant: C,
390
- align: o || "center",
391
- width: u,
392
- height: l,
393
- columnWidth: f,
394
- maxWidth: m,
395
- color: h,
396
- template: T,
397
- columnsCount: E,
398
- calculatedGap: D,
399
- 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
400
470
  }), [
401
- v.base,
402
- v.colors,
471
+ b.base,
472
+ b.colors,
403
473
  C,
404
- o,
474
+ s,
475
+ d,
405
476
  u,
406
- l,
407
- f,
408
477
  m,
409
478
  h,
410
- T,
411
- E,
479
+ g,
412
480
  D,
413
- y
414
- ]), k = p.useMemo(() => B(O.containerStyle, i), [O.containerStyle, i]);
415
- 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", {
416
501
  ref: S,
417
- "data-testid": "guide",
502
+ "data-testid": b.domDiagnostics ? "guide" : void 0,
418
503
  "aria-hidden": "true",
419
- className: n(...O.classTokens.map((e) => G[e]), e),
420
- "data-variant": a,
421
- style: k,
422
- ..._,
423
- children: [y && /* @__PURE__ */ b("div", {
424
- className: G.cols,
425
- "data-variant": a,
426
- children: !O.isLineVariant && Array.from({ length: O.columnsCount }, (e, t) => /* @__PURE__ */ b("div", {
427
- className: G.col,
428
- "data-column-index": t,
429
- "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
430
515
  }, t))
431
- }), g]
516
+ }), v]
432
517
  });
433
- }), K = typeof window > "u";
434
- function ne(e, t) {
435
- if (K) return t;
518
+ }), q = typeof window > "u";
519
+ function ce(e, t) {
520
+ if (q) return t;
436
521
  try {
437
522
  return e();
438
523
  } catch {
439
524
  return t;
440
525
  }
441
526
  }
442
- function q(e, t, n) {
443
- return !e || K ? t : n;
527
+ function J(e, t, n) {
528
+ return !e || q ? t : n;
444
529
  }
445
- var J = {
530
+ var Y = {
446
531
  spr: "spr_syfhf",
447
532
  line: "line_nzGsp",
448
533
  flat: "flat_XJWHt",
449
534
  indicator: "indicator_inw1x"
450
- }, 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 }) {
451
- 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({
452
- 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,
453
538
  colors: g.colors,
454
- width: t,
539
+ width: n,
455
540
  height: e,
456
541
  color: c,
457
- variant: v,
458
- isVisible: _
542
+ variant: y,
543
+ isVisible: v
459
544
  }), [
460
- S,
545
+ b,
461
546
  g.colors,
462
- t,
547
+ n,
463
548
  e,
464
549
  c,
465
- v,
466
- _
467
- ]), T = q(C && !f, !1, _ && r !== void 0), E = p.useMemo(() => {
468
- if (!T) return null;
469
- let e = w.normWidth, t = w.normHeight;
470
- return /* @__PURE__ */ x(y, { children: [t !== 0 && /* @__PURE__ */ b("span", {
471
- 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,
472
557
  "aria-hidden": "true",
473
558
  children: r(t, "height")
474
- }, "height"), e !== 0 && /* @__PURE__ */ b("span", {
475
- className: J.indicator,
559
+ }, "height"), e !== 0 && /* @__PURE__ */ w("span", {
560
+ className: Y.indicator,
476
561
  "aria-hidden": "true",
477
562
  children: r(e, "width")
478
563
  }, "width")] });
479
564
  }, [
480
- T,
565
+ E,
481
566
  r,
482
- w.normWidth,
483
- w.normHeight
484
- ]), D = p.useMemo(() => B(w.style, u), [w.style, u]);
485
- 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", {
486
578
  ref: h,
487
- "data-testid": "spacer",
488
- className: n(...w.classTokens.map((e) => J[e]), l),
489
- "data-variant": v,
490
- "data-height": typeof w.normHeight == "number" ? `${w.normHeight}px` : w.normHeight,
491
- 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,
492
584
  ...m,
493
- children: [E, d]
585
+ children: [D, f]
494
586
  });
495
- }), X = {
587
+ }), Z = {
496
588
  pad: "pad_NizuS",
497
589
  content: "content_xFX0U",
590
+ topEdge: "topEdge_7hMCE",
591
+ leftEdge: "leftEdge_1Dc-j",
592
+ rightEdge: "rightEdge_P7r9Z",
593
+ bottomEdge: "bottomEdge_PfOep",
498
594
  v: "v_dowAz"
499
- }, re = (e, t, n) => {
500
- 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, {
501
597
  variant: r,
502
598
  debugging: t === 0 || e === 0 ? "none" : i,
503
599
  indicatorNode: n,
@@ -505,132 +601,172 @@ var J = {
505
601
  width: e === "100%" ? void 0 : e
506
602
  });
507
603
  return a.displayName = "PadderSpacer", a;
508
- }, Z = { gridColumn: "1 / -1" }, Q = { gridRow: "2 / 3" }, ie = {
509
- gridRow: "2 / 3",
510
- gridColumn: "2 / 3"
511
- }, $ = p.memo(p.forwardRef(function({ children: e, className: t, debugging: i, height: a, indicatorNode: o, style: s, width: c, ssrMode: l = !1, ...u }, d) {
512
- 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, {
513
- 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,
514
607
  snapping: "height",
515
- spacing: g
516
- }), D = { padding: {
517
- top: g.top || 0,
518
- right: g.right || 0,
519
- bottom: g.bottom || 0,
520
- left: g.left || 0
521
- } }, { padding: O } = q(w && !l, D, E), k = V(d, T), A = p.useMemo(() => f({
522
- base: m.base,
523
- 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,
524
617
  width: c,
525
- height: a,
526
- padding: O,
527
- enableSpacers: C,
528
- isVisible: _
618
+ height: i,
619
+ padding: A,
620
+ enableSpacers: S,
621
+ isVisible: y
529
622
  }), [
530
- m.base,
531
- m.color,
623
+ p.base,
624
+ p.color,
532
625
  c,
533
- a,
534
- O,
535
- C,
536
- _
537
- ]), j = p.useMemo(() => B(A.containerStyle, s), [A.containerStyle, s]), M = p.useMemo(() => re(h, S, o), [
538
- h,
626
+ i,
627
+ A,
539
628
  S,
540
- 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
541
639
  ]);
542
- return C ? /* @__PURE__ */ x("div", {
543
- ref: k,
544
- "data-testid": "padder",
545
- className: n(...A.classTokens.map((e) => X[e]), t),
546
- 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),
547
646
  children: [
548
- /* @__PURE__ */ x(y, { children: [O.top >= 0 && /* @__PURE__ */ b("div", {
549
- style: Z,
550
- children: M("100%", O.top)
551
- }), O.left >= 0 && /* @__PURE__ */ b("div", {
552
- style: Q,
553
- 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%")
554
653
  })] }),
555
- /* @__PURE__ */ b("div", {
556
- "data-testid": "padder-content",
557
- className: X.content,
558
- style: ie,
654
+ /* @__PURE__ */ w("div", {
655
+ "data-testid": p.domDiagnostics ? "padder-content" : void 0,
656
+ className: Z.content,
559
657
  children: e
560
- }),
561
- /* @__PURE__ */ x(y, { children: [O.right >= 0 && /* @__PURE__ */ b("div", {
562
- style: Q,
563
- children: M(O.right, "100%")
564
- }), O.bottom >= 0 && /* @__PURE__ */ b("div", {
565
- style: Z,
566
- 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)
567
665
  })] })
568
666
  ]
569
- }) : /* @__PURE__ */ b("div", {
570
- ref: k,
571
- "data-testid": "padder",
572
- className: n(...A.classTokens.map((e) => X[e]), t),
573
- style: j,
574
- 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
575
678
  });
576
- })), ae = {
679
+ })), ue = Q, de = Q, $ = {
577
680
  box: "box_sPqFs",
578
- v: "v_ZrZ5j"
579
- }, oe = p.memo(p.forwardRef(function({ children: e, snapping: t = "clamp", debugging: i, className: a, colSpan: o, rowSpan: s, span: c, width: l, height: d, style: f, ssrMode: m = !1, ...h }, g) {
580
- let _ = I("box"), { isShown: v, debugging: y } = L(i, _.debugging), x = R(), S = p.useRef(null), { top: C, bottom: w, left: T, right: D } = r(h), O = N(S, {
581
- base: _.base,
582
- snapping: t,
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,
583
689
  spacing: {
584
- top: C,
585
- bottom: w,
586
- left: T,
587
- right: D
690
+ top: D,
691
+ bottom: O,
692
+ left: k,
693
+ right: j
588
694
  }
589
- }), { padding: k } = q(x && !m, { padding: {
590
- top: C || 0,
591
- right: D || 0,
592
- bottom: w || 0,
593
- left: T || 0
594
- } }, O), A = p.useMemo(() => u({
595
- base: _.base,
596
- lineColor: _.colors.line,
597
- width: l,
598
- height: d,
599
- span: c,
600
- colSpan: o,
601
- rowSpan: s,
602
- isVisible: v
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,
703
+ width: d,
704
+ height: p,
705
+ span: u,
706
+ colSpan: c,
707
+ rowSpan: l,
708
+ isVisible: S
603
709
  }), [
604
- _.base,
605
- _.colors.line,
606
- l,
710
+ b.base,
711
+ b.colors.line,
607
712
  d,
713
+ p,
714
+ u,
608
715
  c,
609
- o,
610
- s,
611
- v
612
- ]), j = p.useMemo(() => B(A.boxStyle, f), [A.boxStyle, f]);
613
- return /* @__PURE__ */ b("div", {
614
- ref: V(g, S),
615
- "data-testid": "box",
616
- className: n(...A.classTokens.map((e) => ae[e]), a),
617
- style: B(j, A.gridSpanStyle),
618
- 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, {
619
750
  base: 1,
620
751
  spacer: { variant: "flat" },
621
- children: /* @__PURE__ */ b($, {
622
- block: [k.top, k.bottom],
623
- inline: [k.left, k.right],
752
+ children: F ? /* @__PURE__ */ w(de, {
753
+ block: [N.top, N.bottom],
754
+ inline: [N.left, N.right],
624
755
  width: "fit-content",
625
- height: d,
626
- debugging: y,
756
+ height: p,
757
+ debugging: C,
758
+ preserveContentHost: !0,
627
759
  ssrMode: !0,
628
760
  children: e
761
+ }) : /* @__PURE__ */ w("div", {
762
+ "data-testid": b.domDiagnostics ? "padder-content" : void 0,
763
+ className: Z.content,
764
+ children: e
629
765
  })
630
766
  })
631
767
  });
632
768
  }));
633
769
  //#endregion
634
- 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 };
635
771
 
636
772
  //# sourceMappingURL=index.mjs.map