@cronocode/react-box 3.0.18 → 3.0.20

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,18 +1,18 @@
1
- var le = Object.defineProperty;
2
- var ae = (u, e, t) => e in u ? le(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
- var a = (u, e, t) => ae(u, typeof e != "symbol" ? e + "" : e, t);
4
- import { jsx as r, jsxs as d, Fragment as ue } from "react/jsx-runtime";
5
- import m from "../box.mjs";
1
+ var ae = Object.defineProperty;
2
+ var ue = (u, e, t) => e in u ? ae(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
+ var a = (u, e, t) => ue(u, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as r, jsxs as c, Fragment as he } from "react/jsx-runtime";
5
+ import g from "../box.mjs";
6
6
  import j from "./grid.mjs";
7
- import he, { useMemo as E, useState as z, forwardRef as ce, useRef as de, useCallback as ge, useImperativeHandle as me } from "react";
8
- import { F as q, m as V, A as $, b as Y, D as pe, P as K, G as H, C as fe, S as Ce, d as we } from "../core.mjs";
7
+ import de, { useMemo as E, useState as z, forwardRef as ce, useRef as me, useCallback as ge, useImperativeHandle as pe } from "react";
8
+ import { F as q, m as D, A as $, b as Y, D as fe, P as K, G as H, C as Ce, S as we, d as ye } from "../core.mjs";
9
9
  import p from "./button.mjs";
10
- import S from "./checkbox.mjs";
10
+ import V from "./checkbox.mjs";
11
11
  import C from "./flex.mjs";
12
12
  import J from "./tooltip.mjs";
13
- import ye from "./baseSvg.mjs";
14
- import ve from "./textbox.mjs";
15
- const Re = "NO_PIN";
13
+ import ve from "./baseSvg.mjs";
14
+ import Re from "./textbox.mjs";
15
+ const be = "NO_PIN";
16
16
  class G {
17
17
  constructor(e, t, i) {
18
18
  a(this, "columns", []);
@@ -20,16 +20,16 @@ class G {
20
20
  a(this, "_inlineWidth");
21
21
  a(this, "resizeColumn", (e) => {
22
22
  this.grid.isResizeMode = !0;
23
- const t = e.pageX, { MIN_COLUMN_WIDTH_PX: i, update: o } = this.grid, s = this.leafs.sumBy((c) => c.inlineWidth) - this.leafs.length * i, n = this.leafs.toRecord((c) => [c.key, c.inlineWidth]), h = q.throttle((c) => {
24
- const w = (c.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
23
+ const t = e.pageX, { MIN_COLUMN_WIDTH_PX: i, update: o } = this.grid, s = this.leafs.sumBy((d) => d.inlineWidth) - this.leafs.length * i, n = this.leafs.toRecord((d) => [d.key, d.inlineWidth]), h = q.throttle((d) => {
24
+ const w = (d.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
25
25
  this.leafs.forEach((y) => {
26
- const k = n[y.key], L = s > 0 ? (k - i) / s * w : w / this.leafs.length, v = Math.round(k + L);
26
+ const k = n[y.key], x = s > 0 ? (k - i) / s * w : w / this.leafs.length, v = Math.round(k + x);
27
27
  y.setWidth(v < i ? i : v);
28
28
  }), this.grid.headerRows.clear(), this.grid.sizes.clear(), o();
29
- }, 20), l = new AbortController(), g = (c) => {
29
+ }, 20), l = new AbortController(), m = (d) => {
30
30
  l.abort(), this.grid.isResizeMode = !1, o();
31
31
  };
32
- window.addEventListener("mousemove", h, l), window.addEventListener("mouseup", g, l);
32
+ window.addEventListener("mousemove", h, l), window.addEventListener("mouseup", m, l);
33
33
  });
34
34
  a(this, "pinColumn", (e) => {
35
35
  this.isLeaf ? this._pin = e : this.columns.forEach((t) => t.pinColumn(e)), this.grid.pinColumn(this.uniqueKey, e);
@@ -153,7 +153,7 @@ class G {
153
153
  return this.isLeaf ? this.grid.columns.value.maxDeath - this.death : 1;
154
154
  }
155
155
  }
156
- class be {
156
+ class ke {
157
157
  constructor(e, t, i) {
158
158
  this.grid = e, this.row = t, this.column = i;
159
159
  }
@@ -171,7 +171,7 @@ class Q {
171
171
  return `${((e = this.parentRow) == null ? void 0 : e.rowKey) ?? ""}${this.groupColumn.key}${this.groupValue}`;
172
172
  }
173
173
  get cells() {
174
- return this.grid.columns.value.visibleLeafs.map((e) => new be(this.grid, this, e));
174
+ return this.grid.columns.value.visibleLeafs.map((e) => new ke(this.grid, this, e));
175
175
  }
176
176
  get expanded() {
177
177
  return this.grid.expandedGroupRow[this.rowKey];
@@ -198,7 +198,7 @@ class Q {
198
198
  this.grid.toggleGroupRow(this.rowKey);
199
199
  }
200
200
  }
201
- class ke {
201
+ class xe {
202
202
  constructor(e, t, i) {
203
203
  this.grid = e, this.row = t, this.column = i;
204
204
  }
@@ -215,7 +215,7 @@ class X {
215
215
  return this.getRowKey();
216
216
  }
217
217
  get cells() {
218
- return this.grid.columns.value.visibleLeafs.map((e) => new ke(this.grid, this, e));
218
+ return this.grid.columns.value.visibleLeafs.map((e) => new xe(this.grid, this, e));
219
219
  }
220
220
  get count() {
221
221
  return 1;
@@ -233,7 +233,7 @@ const P = "empty-cell", b = "row-number-cell", T = "row-selection-cell", f = "gr
233
233
  class Le {
234
234
  constructor(e, t) {
235
235
  a(this, "_sourceColumns", []);
236
- a(this, "columns", V(() => {
236
+ a(this, "columns", D(() => {
237
237
  const e = this._sourceColumns.map((l) => l.getPinnedColumn("LEFT")).filter((l) => !!l), t = this._sourceColumns.map((l) => l.getPinnedColumn()).filter((l) => !!l), i = this._sourceColumns.map((l) => l.getPinnedColumn("RIGHT")).filter((l) => !!l), o = [...e, ...t, ...i].flatMap((l) => l.flatColumns), s = o.filter((l) => l.isLeaf), n = o.filter((l) => l.isLeaf && l.isVisible), h = o.maxBy((l) => l.death) + 1;
238
238
  return {
239
239
  left: e,
@@ -245,20 +245,20 @@ class Le {
245
245
  maxDeath: h
246
246
  };
247
247
  }));
248
- a(this, "headerRows", V(() => this.columns.value.flat.groupBy((t) => t.death).sortBy((t) => t.key).map((t) => {
248
+ a(this, "headerRows", D(() => this.columns.value.flat.groupBy((t) => t.death).sortBy((t) => t.key).map((t) => {
249
249
  var o, s, n;
250
- const i = t.values.groupBy((h) => h.pin ?? Re).toRecord((h) => [h.key, h.values]);
250
+ const i = t.values.groupBy((h) => h.pin ?? be).toRecord((h) => [h.key, h.values]);
251
251
  return [
252
252
  ...((o = i.LEFT) == null ? void 0 : o.filter((h) => h.isVisible)) ?? [],
253
253
  ...((s = i.NO_PIN) == null ? void 0 : s.filter((h) => h.isVisible)) ?? [],
254
254
  ...((n = i.RIGHT) == null ? void 0 : n.filter((h) => h.isVisible)) ?? []
255
255
  ];
256
256
  })));
257
- a(this, "gridTemplateColumns", V(() => {
257
+ a(this, "gridTemplateColumns", D(() => {
258
258
  const { visibleLeafs: e } = this.columns.value, t = e.sumBy((n) => n.pin === "RIGHT" ? 1 : 0), i = e.length - t - 1, o = i > 0 ? `repeat(${i}, max-content)` : "", s = t > 0 ? `repeat(${t}, max-content)` : "";
259
259
  return `${o} auto ${s}`;
260
260
  }));
261
- a(this, "rows", V(() => {
261
+ a(this, "rows", D(() => {
262
262
  let e = this.props.data;
263
263
  if (this._sortColumn && (e = e.sortBy((t) => t[this._sortColumn], this._sortDirection)), this.groupColumns.length > 0) {
264
264
  const t = (i, o, s) => {
@@ -266,19 +266,19 @@ class Le {
266
266
  o = o.removeBy((l) => l === n);
267
267
  const h = this.columns.value.leafs.findOrThrow((l) => l.key === n);
268
268
  return this._sortColumn === f && (i = i.sortBy((l) => l[n], this._sortDirection)), i.groupBy((l) => l[n]).map((l) => {
269
- let g;
270
- o.length > 0 ? g = t(l.values, o, s + 1) : g = l.values.map((w, y) => new X(this, w, s + 1 + y));
271
- const c = new Q(this, h, g, s, l.key);
272
- return s += 1, c.expanded && (s += g.length), c;
269
+ let m;
270
+ o.length > 0 ? m = t(l.values, o, s + 1) : m = l.values.map((w, y) => new X(this, w, s + 1 + y));
271
+ const d = new Q(this, h, m, s, l.key);
272
+ return s += 1, d.expanded && (s += m.length), d;
273
273
  });
274
274
  };
275
275
  return t(e, this.groupColumns, 0);
276
276
  }
277
277
  return e.map((t, i) => new X(this, t, i));
278
278
  }));
279
- a(this, "flatRows", V(() => this.rows.value.flatMap((e) => e.flatRows)));
280
- a(this, "sizes", V(() => {
281
- console.log("sizes");
279
+ a(this, "flatRows", D(() => this.rows.value.flatMap((e) => e.flatRows)));
280
+ a(this, "sizes", D(() => {
281
+ console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid sizes memo");
282
282
  const e = this.columns.value.flat.reduce((o, s) => {
283
283
  const { inlineWidth: n } = s;
284
284
  return typeof n == "number" && (o[s.widthVarName] = `${s.inlineWidth}px`), s.pin === "LEFT" && (o[s.leftVarName] = `${s.left}px`), s.pin === "RIGHT" && (o[s.rightVarName] = `${s.right}px`), o;
@@ -360,33 +360,33 @@ function _e(u) {
360
360
  const e = E(() => new Le(u, () => i((s) => s + 1)), [u]), [t, i] = z(0);
361
361
  return E(() => Object.create(Object.getPrototypeOf(e), Object.getOwnPropertyDescriptors(e)), [e, t]);
362
362
  }
363
- function xe(u) {
364
- const { column: e } = u, { key: t, pin: i, left: o, right: s, isEdge: n, isLeaf: h, leafs: l, grid: g, header: c, gridRows: w, widthVarName: y, leftVarName: k, rightVarName: L, inlineWidth: v } = e, _ = t === P, x = t === f, R = t === b, W = t === T, I = i === "LEFT", D = i === "RIGHT", B = I || i === "RIGHT", M = I && o === 0, O = I && n, te = D && n, ie = D && s === 0, A = h && !_ && !R && !W, se = h ? 1 : l.length, oe = !R && !W, F = !R && !W, re = E(() => {
363
+ function Te(u) {
364
+ const { column: e } = u, { key: t, pin: i, left: o, right: s, isEdge: n, isLeaf: h, leafs: l, grid: m, header: d, gridRows: w, widthVarName: y, leftVarName: k, rightVarName: x, inlineWidth: v } = e, L = t === P, _ = t === f, R = t === b, W = t === T, I = i === "LEFT", B = i === "RIGHT", S = I || i === "RIGHT", M = I && o === 0, O = I && n, ie = B && n, se = B && s === 0, A = h && !L && !R && !W, oe = h ? 1 : l.length, re = !R && !W, F = !R && !W, ne = E(() => {
365
365
  if (R) return null;
366
- if (W) return /* @__PURE__ */ r(S, { m: 1 });
367
- if (x) {
368
- if (g.groupColumns.length === 1) {
369
- const U = g.columns.value.leafs.findOrThrow((ne) => ne.key === g.groupColumns[0]);
366
+ if (W) return /* @__PURE__ */ r(V, { m: 1 });
367
+ if (_) {
368
+ if (m.groupColumns.length === 1) {
369
+ const U = m.columns.value.leafs.findOrThrow((le) => le.key === m.groupColumns[0]);
370
370
  return U.header ?? U.key;
371
371
  }
372
372
  return "Group";
373
373
  }
374
- return c ?? t;
375
- }, [g.groupColumns]);
374
+ return d ?? t;
375
+ }, [m.groupColumns]);
376
376
  return /* @__PURE__ */ r(
377
377
  C,
378
378
  {
379
379
  component: "datagrid.header.cell",
380
- variant: { isRowNumber: R, isPinned: B, isFirstLeftPinned: M, isLastLeftPinned: O, isFirstRightPinned: te, isLastRightPinned: ie, isSortable: A },
380
+ variant: { isRowNumber: R, isPinned: S, isFirstLeftPinned: M, isLastLeftPinned: O, isFirstRightPinned: ie, isLastRightPinned: se, isSortable: A },
381
381
  gridRow: w,
382
- gridColumn: se,
382
+ gridColumn: oe,
383
383
  style: {
384
384
  width: `var(${y})`,
385
385
  left: I ? `var(${k})` : void 0,
386
- right: D ? `var(${L})` : void 0
386
+ right: B ? `var(${x})` : void 0
387
387
  },
388
- children: !_ && /* @__PURE__ */ d(ue, { children: [
389
- /* @__PURE__ */ r(C, { width: "fit", height: "fit", jc: e.align, props: { onClick: A ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ d(
388
+ children: !L && /* @__PURE__ */ c(he, { children: [
389
+ /* @__PURE__ */ r(C, { width: "fit", height: "fit", jc: e.align, props: { onClick: A ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ c(
390
390
  C,
391
391
  {
392
392
  overflow: "hidden",
@@ -395,22 +395,22 @@ function xe(u) {
395
395
  transition: "none",
396
396
  pl: e.align ? void 0 : 4,
397
397
  style: {
398
- left: i ? void 0 : `var(${g.leftEdgeVarName})`
398
+ left: i ? void 0 : `var(${m.leftEdgeVarName})`
399
399
  },
400
400
  children: [
401
- /* @__PURE__ */ r(m, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: re }),
402
- t === g.sortColumn && /* @__PURE__ */ r(m, { pl: (v ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ r($, { width: "16px", rotate: g.sortDirection === "ASC" ? 0 : 180, fill: "violet-950" }) }),
403
- F && /* @__PURE__ */ r(m, { minWidth: 10 })
401
+ /* @__PURE__ */ r(g, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: ne }),
402
+ t === m.sortColumn && /* @__PURE__ */ r(g, { pl: (v ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ r($, { width: "16px", rotate: m.sortDirection === "ASC" ? 0 : 180, fill: "violet-950" }) }),
403
+ F && /* @__PURE__ */ r(g, { minWidth: 10 })
404
404
  ]
405
405
  }
406
406
  ) }),
407
- oe && /* @__PURE__ */ r(Te, { column: e }),
408
- F && /* @__PURE__ */ r(Ge, { column: e })
407
+ re && /* @__PURE__ */ r(Ge, { column: e }),
408
+ F && /* @__PURE__ */ r(Ee, { column: e })
409
409
  ] })
410
410
  }
411
411
  );
412
412
  }
413
- function Te(u) {
413
+ function Ge(u) {
414
414
  const { column: e } = u;
415
415
  return /* @__PURE__ */ r(
416
416
  C,
@@ -422,22 +422,22 @@ function Te(u) {
422
422
  left: e.pin !== "RIGHT" ? void 0 : 0,
423
423
  py: 3,
424
424
  children: /* @__PURE__ */ r(
425
- m,
425
+ g,
426
426
  {
427
427
  cursor: "col-resize",
428
428
  px: 0.75,
429
429
  className: "resizer",
430
430
  height: "fit",
431
431
  props: { onMouseDown: e.resizeColumn, onTouchStart: e.resizeColumn },
432
- children: /* @__PURE__ */ r(m, { width: 0.5, height: "fit", bgColor: "gray-400", hoverGroup: { resizer: { bgColor: "gray-600" } } })
432
+ children: /* @__PURE__ */ r(g, { width: 0.5, height: "fit", bgColor: "gray-400", hoverGroup: { resizer: { bgColor: "gray-600" } } })
433
433
  }
434
434
  )
435
435
  }
436
436
  );
437
437
  }
438
- function Ge(u) {
439
- const { column: e } = u, [t, i, o] = Y({ hideOnScroll: !0, event: "mousedown" }), [s, n] = z({ top: 0, left: 0 }), h = E(() => s.left > window.innerWidth / 2, [s.left]), l = e.isLeaf && (e.grid.sortColumn !== e.key || e.grid.sortDirection === "DESC"), g = e.isLeaf && (e.grid.sortColumn !== e.key || e.grid.sortDirection === "ASC"), c = e.isLeaf && e.grid.sortColumn === e.key, w = e.pin !== "LEFT", y = e.pin !== "RIGHT", k = !!e.pin, L = e.isLeaf && e.key !== f, v = e.isLeaf && e.key === f, _ = l || g || c, x = w || y || k;
440
- return /* @__PURE__ */ r(C, { position: "absolute", right: e.pin === "RIGHT" ? 2.5 : 4, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ d(
438
+ function Ee(u) {
439
+ const { column: e } = u, [t, i, o] = Y({ hideOnScroll: !0, event: "mousedown" }), [s, n] = z({ top: 0, left: 0 }), h = E(() => s.left > window.innerWidth / 2, [s.left]), l = e.isLeaf && (e.grid.sortColumn !== e.key || e.grid.sortDirection === "DESC"), m = e.isLeaf && (e.grid.sortColumn !== e.key || e.grid.sortDirection === "ASC"), d = e.isLeaf && e.grid.sortColumn === e.key, w = e.pin !== "LEFT", y = e.pin !== "RIGHT", k = !!e.pin, x = e.isLeaf && e.key !== f, v = e.isLeaf && e.key === f, L = l || m || d, _ = w || y || k;
440
+ return /* @__PURE__ */ r(C, { position: "absolute", right: e.pin === "RIGHT" ? 2.5 : 4, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ c(
441
441
  p,
442
442
  {
443
443
  clean: !0,
@@ -455,8 +455,8 @@ function Ge(u) {
455
455
  bgColor: "gray-200",
456
456
  hover: { bgColor: "gray-300" },
457
457
  children: [
458
- /* @__PURE__ */ r(pe, { fill: "violet-950" }),
459
- t && /* @__PURE__ */ d(
458
+ /* @__PURE__ */ r(fe, { fill: "violet-950" }),
459
+ t && /* @__PURE__ */ c(
460
460
  J,
461
461
  {
462
462
  bgColor: "white",
@@ -474,7 +474,7 @@ function Ge(u) {
474
474
  ref: o,
475
475
  shadow: "medium-shadow",
476
476
  children: [
477
- l && /* @__PURE__ */ d(
477
+ l && /* @__PURE__ */ c(
478
478
  p,
479
479
  {
480
480
  clean: !0,
@@ -490,7 +490,7 @@ function Ge(u) {
490
490
  ]
491
491
  }
492
492
  ),
493
- g && /* @__PURE__ */ d(
493
+ m && /* @__PURE__ */ c(
494
494
  p,
495
495
  {
496
496
  clean: !0,
@@ -506,7 +506,7 @@ function Ge(u) {
506
506
  ]
507
507
  }
508
508
  ),
509
- c && /* @__PURE__ */ d(
509
+ d && /* @__PURE__ */ c(
510
510
  p,
511
511
  {
512
512
  clean: !0,
@@ -517,13 +517,13 @@ function Ge(u) {
517
517
  hover: { bgColor: "gray-200" },
518
518
  onClick: () => e.sortColumn(void 0),
519
519
  children: [
520
- /* @__PURE__ */ r(m, { width: 4 }),
520
+ /* @__PURE__ */ r(g, { width: 4 }),
521
521
  "Clear Sort"
522
522
  ]
523
523
  }
524
524
  ),
525
- _ && (x || L || v) && /* @__PURE__ */ r(m, { bb: 1, my: 2, borderColor: "gray-300" }),
526
- w && /* @__PURE__ */ d(
525
+ L && (_ || x || v) && /* @__PURE__ */ r(g, { bb: 1, my: 2, borderColor: "gray-300" }),
526
+ w && /* @__PURE__ */ c(
527
527
  p,
528
528
  {
529
529
  clean: !0,
@@ -539,7 +539,7 @@ function Ge(u) {
539
539
  ]
540
540
  }
541
541
  ),
542
- y && /* @__PURE__ */ d(
542
+ y && /* @__PURE__ */ c(
543
543
  p,
544
544
  {
545
545
  clean: !0,
@@ -555,7 +555,7 @@ function Ge(u) {
555
555
  ]
556
556
  }
557
557
  ),
558
- k && /* @__PURE__ */ d(
558
+ k && /* @__PURE__ */ c(
559
559
  p,
560
560
  {
561
561
  clean: !0,
@@ -566,13 +566,13 @@ function Ge(u) {
566
566
  hover: { bgColor: "gray-200" },
567
567
  onClick: () => e.pinColumn(),
568
568
  children: [
569
- /* @__PURE__ */ r(m, { width: 4 }),
569
+ /* @__PURE__ */ r(g, { width: 4 }),
570
570
  "Unpin"
571
571
  ]
572
572
  }
573
573
  ),
574
- _ && x && (L || v) && /* @__PURE__ */ r(m, { bb: 1, my: 2, borderColor: "gray-300" }),
575
- L && /* @__PURE__ */ d(
574
+ L && _ && (x || v) && /* @__PURE__ */ r(g, { bb: 1, my: 2, borderColor: "gray-300" }),
575
+ x && /* @__PURE__ */ c(
576
576
  p,
577
577
  {
578
578
  clean: !0,
@@ -584,17 +584,17 @@ function Ge(u) {
584
584
  hover: { bgColor: "gray-200" },
585
585
  onClick: e.toggleGrouping,
586
586
  children: [
587
- /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(H, { width: "1rem", fill: "violet-950" }) }),
588
- /* @__PURE__ */ d(m, { textWrap: "nowrap", children: [
587
+ /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(H, { width: "1rem", fill: "violet-950" }) }),
588
+ /* @__PURE__ */ c(g, { textWrap: "nowrap", children: [
589
589
  " Group by ",
590
590
  e.header ?? e.key
591
591
  ] })
592
592
  ]
593
593
  }
594
594
  ),
595
- v && /* @__PURE__ */ d(p, { clean: !0, display: "flex", gap: 2, p: 3, cursor: "pointer", hover: { bgColor: "gray-200" }, onClick: e.grid.unGroupAll, children: [
596
- /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(H, { width: "1rem", fill: "violet-950" }) }),
597
- /* @__PURE__ */ r(m, { textWrap: "nowrap", children: " Un-Group All" })
595
+ v && /* @__PURE__ */ c(p, { clean: !0, display: "flex", gap: 2, p: 3, cursor: "pointer", hover: { bgColor: "gray-200" }, onClick: e.grid.unGroupAll, children: [
596
+ /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(H, { width: "1rem", fill: "violet-950" }) }),
597
+ /* @__PURE__ */ r(g, { textWrap: "nowrap", children: " Un-Group All" })
598
598
  ] })
599
599
  ]
600
600
  }
@@ -604,29 +604,29 @@ function Ge(u) {
604
604
  ) });
605
605
  }
606
606
  function N(u) {
607
- const { children: e, column: t, style: i, ...o } = u, { key: s, pin: n, left: h, right: l, isEdge: g, align: c, widthVarName: w, leftVarName: y, rightVarName: k } = t, L = s === P, v = s === b, _ = s === T, x = n === "LEFT", R = n === "RIGHT", W = x || R, I = x && h === 0, D = x && g, B = R && g, M = R && l === 0, O = !_ && !L;
608
- return /* @__PURE__ */ d(
607
+ const { children: e, column: t, style: i, ...o } = u, { key: s, pin: n, left: h, right: l, isEdge: m, align: d, widthVarName: w, leftVarName: y, rightVarName: k } = t, x = s === P, v = s === b, L = s === T, _ = n === "LEFT", R = n === "RIGHT", W = _ || R, I = _ && h === 0, B = _ && m, S = R && m, M = R && l === 0, O = !L && !x;
608
+ return /* @__PURE__ */ c(
609
609
  C,
610
610
  {
611
611
  component: "datagrid.cell",
612
612
  props: { role: "cell" },
613
- variant: { isPinned: W, isFirstLeftPinned: I, isLastLeftPinned: D, isFirstRightPinned: B, isLastRightPinned: M, isRowNumber: v, isRowSelection: _ },
614
- jc: c,
613
+ variant: { isPinned: W, isFirstLeftPinned: I, isLastLeftPinned: B, isFirstRightPinned: S, isLastRightPinned: M, isRowNumber: v, isRowSelection: L },
614
+ jc: d,
615
615
  style: {
616
616
  width: `var(${w})`,
617
- left: x ? `var(${y})` : void 0,
617
+ left: _ ? `var(${y})` : void 0,
618
618
  right: R ? `var(${k})` : void 0,
619
619
  ...i
620
620
  },
621
621
  ...o,
622
622
  children: [
623
- O && /* @__PURE__ */ r(m, { px: 4, textOverflow: "ellipsis", overflow: "hidden", textWrap: "nowrap", children: e }),
624
- _ && e
623
+ O && /* @__PURE__ */ r(g, { px: 4, textOverflow: "ellipsis", overflow: "hidden", textWrap: "nowrap", children: e }),
624
+ L && e
625
625
  ]
626
626
  }
627
627
  );
628
628
  }
629
- function Ee(u) {
629
+ function Pe(u) {
630
630
  const { row: e } = u;
631
631
  return /* @__PURE__ */ r(C, { className: "grid-row", display: "contents", props: { role: "rowgroup" }, children: e.cells.map((t) => {
632
632
  const { key: i, pin: o, groupColumnWidthVarName: s } = t.column, n = o === "RIGHT";
@@ -647,45 +647,45 @@ function Ee(u) {
647
647
  i
648
648
  );
649
649
  if (i === T)
650
- return /* @__PURE__ */ r(N, { column: t.column, children: /* @__PURE__ */ r(S, { m: 1 }) }, i);
650
+ return /* @__PURE__ */ r(N, { column: t.column, children: /* @__PURE__ */ r(V, { m: 1 }) }, i);
651
651
  if (o !== e.groupingColumn.pin || i === P || i === b)
652
652
  return /* @__PURE__ */ r(N, { column: t.column, children: t.value }, i);
653
653
  }) });
654
654
  }
655
- function Pe(u) {
655
+ function We(u) {
656
656
  const { row: e } = u;
657
- return /* @__PURE__ */ r(C, { className: "grid-row", display: "contents", props: { role: "row" }, children: e.cells.map((t) => /* @__PURE__ */ r(N, { column: t.column, children: t.column.key === T ? /* @__PURE__ */ r(S, {}) : t.value }, t.column.key)) });
657
+ return /* @__PURE__ */ r(C, { className: "grid-row", display: "contents", props: { role: "row" }, children: e.cells.map((t) => /* @__PURE__ */ r(N, { column: t.column, children: t.column.key === T ? /* @__PURE__ */ r(V, {}) : t.value }, t.column.key)) });
658
658
  }
659
- function We(u) {
659
+ function Ie(u) {
660
660
  const { grid: e } = u, t = E(() => e.groupColumns.length === 0 ? null : e.groupColumns.map((i, o) => {
661
661
  const s = e.columns.value.leafs.findOrThrow((n) => n.key === i);
662
- return /* @__PURE__ */ d(he.Fragment, { children: [
662
+ return /* @__PURE__ */ c(de.Fragment, { children: [
663
663
  ">",
664
- /* @__PURE__ */ d(C, { component: "datagrid.columnGroups.item", children: [
664
+ /* @__PURE__ */ c(C, { component: "datagrid.columnGroups.item", children: [
665
665
  s.header ?? s.key,
666
- /* @__PURE__ */ r(p, { component: "datagrid.columnGroups.item.icon", onClick: () => e.toggleGrouping(s.key), children: /* @__PURE__ */ r(fe, { fill: "currentColor", width: "100%" }) })
666
+ /* @__PURE__ */ r(p, { component: "datagrid.columnGroups.item.icon", onClick: () => e.toggleGrouping(s.key), children: /* @__PURE__ */ r(Ce, { fill: "currentColor", width: "100%" }) })
667
667
  ] })
668
668
  ] }, i);
669
669
  }), [e.groupColumns]);
670
- return /* @__PURE__ */ d(C, { component: "datagrid.columnGroups", position: "relative", children: [
671
- /* @__PURE__ */ r(Ie, { grid: e }),
670
+ return /* @__PURE__ */ c(C, { component: "datagrid.columnGroups", position: "relative", children: [
671
+ /* @__PURE__ */ r(De, { grid: e }),
672
672
  t && /* @__PURE__ */ r(H, { width: "1rem", fill: "violet-950" }),
673
673
  t,
674
- /* @__PURE__ */ d(C, { position: "absolute", justifySelf: "flex-end", right: 2, top: 2, className: "parent", children: [
675
- /* @__PURE__ */ r(C, { position: "absolute", width: 8, height: 8, right: 0, jc: "center", children: /* @__PURE__ */ r(Ce, { fill: "violet-950", width: "1rem" }) }),
676
- /* @__PURE__ */ r(ve, { placeholder: "Search...", height: 8, width: 50, zIndex: 1, bgColor: "transparent" })
674
+ /* @__PURE__ */ c(C, { position: "absolute", justifySelf: "flex-end", right: 2, top: 2, className: "parent", children: [
675
+ /* @__PURE__ */ r(C, { position: "absolute", width: 8, height: 8, right: 0, jc: "center", children: /* @__PURE__ */ r(we, { fill: "violet-950", width: "1rem" }) }),
676
+ /* @__PURE__ */ r(Re, { placeholder: "Search...", height: 8, width: 50, zIndex: 1, bgColor: "transparent" })
677
677
  ] })
678
678
  ] });
679
679
  }
680
- function Ie(u) {
680
+ function De(u) {
681
681
  const { grid: e } = u, [t, i, o] = Y({ event: "mousedown" }), s = E(
682
682
  () => e.columns.value.leafs.filter(
683
683
  (n) => ![P, b, T, f].includes(n.key)
684
684
  ),
685
685
  [e.columns.value.leafs]
686
686
  );
687
- return /* @__PURE__ */ d(p, { clean: !0, cursor: "pointer", p: 1, hover: { bgColor: "gray-200", borderRadius: 1 }, onClick: () => i(!t), children: [
688
- /* @__PURE__ */ r(ye, { viewBox: "0 0 24 24", width: "20", fill: "currentColor", ...u, children: /* @__PURE__ */ r("path", { d: "M5 6h14M5 12h14M5 18h14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }),
687
+ return /* @__PURE__ */ c(p, { clean: !0, cursor: "pointer", p: 1, hover: { bgColor: "gray-200", borderRadius: 1 }, onClick: () => i(!t), children: [
688
+ /* @__PURE__ */ r(ve, { viewBox: "0 0 24 24", width: "20", fill: "currentColor", ...u, children: /* @__PURE__ */ r("path", { d: "M5 6h14M5 12h14M5 18h14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }),
689
689
  t && /* @__PURE__ */ r(
690
690
  J,
691
691
  {
@@ -703,7 +703,7 @@ function Ie(u) {
703
703
  ref: o,
704
704
  overflow: "auto",
705
705
  maxHeight: 100,
706
- children: s.map((n) => /* @__PURE__ */ d(
706
+ children: s.map((n) => /* @__PURE__ */ c(
707
707
  p,
708
708
  {
709
709
  clean: !0,
@@ -716,7 +716,7 @@ function Ie(u) {
716
716
  h.stopPropagation(), n.toggleVisibility();
717
717
  },
718
718
  children: [
719
- /* @__PURE__ */ r(S, { checked: n.isVisible, onChange: () => {
719
+ /* @__PURE__ */ r(V, { checked: n.isVisible, onChange: () => {
720
720
  }, focus: { outline: 0 } }),
721
721
  n.header ?? n.key
722
722
  ]
@@ -727,35 +727,36 @@ function Ie(u) {
727
727
  )
728
728
  ] });
729
729
  }
730
- function je(u) {
731
- const e = _e(u), { isResizeMode: t } = e, i = E(() => (console.log("render - headers"), e.headerRows.value.map((n) => n.map((h) => /* @__PURE__ */ r(xe, { column: h }, h.uniqueKey)))), [e.headerRows.value]), o = de(null), s = ge(
730
+ function Be(u) {
731
+ const e = _e(u), { isResizeMode: t } = e, i = E(() => (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render headers"), e.headerRows.value.map((n) => n.map((h) => /* @__PURE__ */ r(Te, { column: h }, h.uniqueKey)))), [e.headerRows.value]), o = me(null), s = ge(
732
732
  q.throttle((n) => {
733
733
  var h;
734
734
  (h = o.current) == null || h.setScrollTop(n.target.scrollTop);
735
735
  }, 100),
736
736
  [o.current]
737
737
  );
738
- return console.log("render - data grid"), /* @__PURE__ */ d(m, { component: "datagrid", style: e.sizes.value, props: { role: "presentation" }, children: [
739
- /* @__PURE__ */ r(We, { grid: e }),
740
- /* @__PURE__ */ d(m, { overflowX: "scroll", props: { onScroll: s }, children: [
738
+ return console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render"), /* @__PURE__ */ c(g, { component: "datagrid", style: e.sizes.value, props: { role: "presentation" }, children: [
739
+ /* @__PURE__ */ r(Ie, { grid: e }),
740
+ /* @__PURE__ */ c(g, { overflowX: "scroll", props: { onScroll: s }, children: [
741
741
  /* @__PURE__ */ r(j, { component: "datagrid.header", variant: { isResizeMode: t }, style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: i }),
742
- /* @__PURE__ */ r(Ne, { ref: o, grid: e })
742
+ /* @__PURE__ */ r(te, { ref: o, grid: e })
743
743
  ] }),
744
- /* @__PURE__ */ d(m, { p: 3, bgColor: "gray-200", bt: 1, borderColor: "gray-400", children: [
744
+ /* @__PURE__ */ c(g, { p: 3, bgColor: "gray-200", bt: 1, borderColor: "gray-400", children: [
745
745
  "Rows: ",
746
746
  u.data.length
747
747
  ] })
748
748
  ] });
749
749
  }
750
- const Z = 10, ee = 25, Ve = Z + ee * 2;
751
- function De(u, e) {
752
- const { grid: t } = u, i = we * t.ROW_HEIGHT, [o, s] = z(0), n = Math.max(0, Math.floor(o / i) - ee), h = E(() => (console.log("render - rows"), t.flatRows.value.take(Ve, n).map((c) => c instanceof Q ? /* @__PURE__ */ r(Ee, { row: c }, c.rowKey) : /* @__PURE__ */ r(Pe, { row: c }, c.rowKey))), [t.flatRows.value, n]);
753
- me(e, () => ({
750
+ Be.displayName = "DataGrid";
751
+ const Z = 10, ee = 25, Ne = Z + ee * 2;
752
+ function Ve(u, e) {
753
+ const { grid: t } = u, i = ye * t.ROW_HEIGHT, [o, s] = z(0), n = Math.max(0, Math.floor(o / i) - ee), h = E(() => (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), t.flatRows.value.take(Ne, n).map((d) => d instanceof Q ? /* @__PURE__ */ r(Pe, { row: d }, d.rowKey) : /* @__PURE__ */ r(We, { row: d }, d.rowKey))), [t.flatRows.value, n]);
754
+ pe(e, () => ({
754
755
  setScrollTop: s
755
756
  }));
756
757
  const l = t.flatRows.value.length;
757
- return /* @__PURE__ */ r(m, { height: t.ROW_HEIGHT * Z + 4, children: /* @__PURE__ */ r(
758
- m,
758
+ return /* @__PURE__ */ r(g, { height: t.ROW_HEIGHT * Z + 4, children: /* @__PURE__ */ r(
759
+ g,
759
760
  {
760
761
  style: {
761
762
  height: `${l * i}px`
@@ -763,7 +764,6 @@ function De(u, e) {
763
764
  children: /* @__PURE__ */ r(
764
765
  j,
765
766
  {
766
- props: { role: "presentation" },
767
767
  width: "max-content",
768
768
  minWidth: "fit",
769
769
  transition: "none",
@@ -777,7 +777,8 @@ function De(u, e) {
777
777
  }
778
778
  ) });
779
779
  }
780
- const Ne = ce(De);
780
+ const te = ce(Ve);
781
+ te.displayName = "Rows";
781
782
  export {
782
- je as default
783
+ Be as default
783
784
  };
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),r=require("react"),y=require("../box.cjs"),L=require("./textbox.cjs"),Q=require("./flex.cjs"),X=require("../core.cjs"),Z=require("./baseSvg.cjs"),K=require("./tooltip.cjs"),ee=require("./button.cjs");function te(p,m){const{name:i,defaultValue:g,value:w,multiple:u,isSearchable:x,searchPlaceholder:B,children:D,hideIcon:H,onChange:s,props:Y,...J}=p,[F,j]=r.useState(Array.isArray(g)?g:g?[g]:[]),c="value"in p?Array.isArray(w)?w:w?[w]:[]:F,[I,T]=r.useState(""),[a,V,b]=X.useVisibility(),N=r.useRef(null),_=r.useRef(null),[O,W]=r.useState(0),A=r.useMemo(()=>O>window.innerHeight/2,[O]),$=r.useMemo(()=>{var e;return A?((e=b.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[A,b]),l=r.useMemo(()=>(Array.isArray(D)?D:[D]).flatMap(e=>e),[D]),C=r.useMemo(()=>l.filter(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownItem"}),[l]),f=r.useMemo(()=>C.filter(e=>x&&I?U(e).toLowerCase().includes(I.toLowerCase()):!0),[x,I,l]),h=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownUnselect"}),[l]),P=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownSelectAll"}),[l]),k=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownEmptyItem"}),[l]),M=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownDisplay"}),[l]),z=r.useMemo(()=>{if(M)return typeof M.props.children=="function"?M.props.children(c,a):M.props.children;const e=f.filter(o=>c.includes(o.props.value));if(u&&e.length>1)return e.map(o=>U(o)).join(", ");const t=e.at(0);return(t==null?void 0:t.props.children)??(t==null?void 0:t.props.value)??(u?null:h==null?void 0:h.props.children)},[u,f,c,h,a]),R=r.useCallback((e,...t)=>{if(t.length===0)j([]),s==null||s(void 0,[]);else if(u&&t.length>1){const o=t.map(d=>d.props.value);j(o),s==null||s(void 0,o)}else if(t.length===1){const o=t[0];if(u){const d=c.filter(q=>q!==o.props.value);d.length===c.length&&d.push(o.props.value),j(d),s==null||s(o.props.value,d)}else j([o.props.value]),s==null||s(o.props.value,[o.props.value])}u?(e.stopPropagation(),setTimeout(()=>{var o;return(o=N.current)==null?void 0:o.focus()},0)):(V(!1),setTimeout(()=>{var o;return(o=b.current)==null?void 0:o.focus()},0))},[u,c,j]);r.useEffect(()=>{a?setTimeout(()=>{var e,t,o;(e=N.current)==null||e.focus(),(o=(t=_.current)==null?void 0:t.querySelector('[aria-selected="true"]'))==null||o.scrollIntoView({block:"nearest"})},0):T("")},[a]);const E=P&&u&&f.length>c.length,G=h&&f.length>0&&!E;return n.jsxs(y,{width:"fit-content",children:[c.map(e=>n.jsx(L,{ref:m,name:i,type:"hidden",value:JSON.stringify(e)??""},JSON.stringify(e))),n.jsxs(ee,{ref:b,type:"button",component:"dropdown",onClick:()=>V(e=>!e),props:{tabIndex:0,...Y},...J,children:[x&&n.jsx(L,{display:a&&x?"block":"none",clean:!0,flex1:!0,width:1,minHeight:5,placeholder:B,value:I,onChange:e=>T(e.target.value),ref:N,props:{onClick:e=>{a&&x&&e.stopPropagation()}}}),n.jsx(Q,{component:"dropdown.display",display:a&&x?"none":"flex",children:z??n.jsx(n.Fragment,{children:" "})}),!H&&n.jsx(y,{children:n.jsx(Z,{viewBox:"0 0 10 6",width:"0.6rem",rotate:a?180:0,children:n.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})})]}),a&&n.jsx(K,{ref:_,top:A?void 0:0,bottom:A?2:void 0,style:{transform:`translateY(-${$}px)`},onPositionChange:e=>W(e.top-window.scrollY),children:(f.length>0||k)&&n.jsxs(y,{component:"dropdown.items",children:[G&&n.jsx(y,{component:"dropdown.unselect",selected:c.length===0,...h.props,props:{...h.props.props,onClick:e=>R(e)}}),E&&n.jsx(y,{component:"dropdown.selectAll",...P.props,props:{...P.props.props,onClick:e=>R(e,...C)}}),f.map(e=>{const{value:t,onClick:o,...d}=e.props;return n.jsx(y,{component:"dropdown.item",variant:u?"multiple":void 0,selected:c.includes(t),...d,props:{...d.props,onClick:q=>{o==null||o(q),R(q,e)}}},t)}),f.length===0&&k&&n.jsx(y,{component:"dropdown.emptyItem",...k.props})]})})]})}function S(p){const m=i=>null;return m.displayName=p,m}const v=r.forwardRef(te);v.Item=S("DropdownItem");v.Unselect=S("DropdownUnselect");v.SelectAll=S("DropdownSelectAll");v.EmptyItem=S("DropdownEmptyItem");v.Display=S("DropdownDisplay");function U(p){var m;if(p==null)return"";if(typeof p=="object"){const i=(m=p.props)==null?void 0:m.children;return i==null?"":typeof i=="object"?(Array.isArray(i)?i:[i]).map(w=>U(w)).join(""):i.toString()}return p.toString()}module.exports=v;
1
+ "use strict";const n=require("react/jsx-runtime"),r=require("react"),y=require("../box.cjs"),L=require("./textbox.cjs"),Q=require("./flex.cjs"),X=require("../core.cjs"),Z=require("./baseSvg.cjs"),K=require("./tooltip.cjs"),ee=require("./button.cjs");function te(p,m){const{name:i,defaultValue:g,value:x,multiple:u,isSearchable:v,searchPlaceholder:B,children:D,hideIcon:H,onChange:s,props:Y,...J}=p,[F,j]=r.useState(Array.isArray(g)?g:g?[g]:[]),c="value"in p?Array.isArray(x)?x:x?[x]:[]:F,[I,T]=r.useState(""),[a,V,b]=X.useVisibility(),N=r.useRef(null),_=r.useRef(null),[O,W]=r.useState(0),A=r.useMemo(()=>O>window.innerHeight/2,[O]),$=r.useMemo(()=>{var e;return A?((e=b.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[A,b]),l=r.useMemo(()=>(Array.isArray(D)?D:[D]).flatMap(e=>e),[D]),C=r.useMemo(()=>l.filter(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownItem"}),[l]),f=r.useMemo(()=>C.filter(e=>v&&I?U(e).toLowerCase().includes(I.toLowerCase()):!0),[v,I,l]),h=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownUnselect"}),[l]),P=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownSelectAll"}),[l]),k=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownEmptyItem"}),[l]),M=r.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownDisplay"}),[l]),z=r.useMemo(()=>{if(M)return typeof M.props.children=="function"?M.props.children(c,a):M.props.children;const e=f.filter(o=>c.includes(o.props.value));if(u&&e.length>1)return e.map(o=>U(o)).join(", ");const t=e.at(0);return(t==null?void 0:t.props.children)??(t==null?void 0:t.props.value)??(u?null:h==null?void 0:h.props.children)},[u,f,c,h,a]),R=r.useCallback((e,...t)=>{if(t.length===0)j([]),s==null||s(void 0,[]);else if(u&&t.length>1){const o=t.map(d=>d.props.value);j(o),s==null||s(void 0,o)}else if(t.length===1){const o=t[0];if(u){const d=c.filter(q=>q!==o.props.value);d.length===c.length&&d.push(o.props.value),j(d),s==null||s(o.props.value,d)}else j([o.props.value]),s==null||s(o.props.value,[o.props.value])}u?(e.stopPropagation(),setTimeout(()=>{var o;return(o=N.current)==null?void 0:o.focus()},0)):(V(!1),setTimeout(()=>{var o;return(o=b.current)==null?void 0:o.focus()},0))},[u,c,j]);r.useEffect(()=>{a?setTimeout(()=>{var e,t,o;(e=N.current)==null||e.focus(),(o=(t=_.current)==null?void 0:t.querySelector('[aria-selected="true"]'))==null||o.scrollIntoView({block:"nearest"})},0):T("")},[a]);const E=P&&u&&f.length>c.length,G=h&&f.length>0&&!E;return n.jsxs(y.default,{width:"fit-content",children:[c.map(e=>n.jsx(L,{ref:m,name:i,type:"hidden",value:JSON.stringify(e)??""},JSON.stringify(e))),n.jsxs(ee,{ref:b,type:"button",component:"dropdown",onClick:()=>V(e=>!e),props:{tabIndex:0,...Y},...J,children:[v&&n.jsx(L,{display:a&&v?"block":"none",clean:!0,flex1:!0,width:1,minHeight:5,placeholder:B,value:I,onChange:e=>T(e.target.value),ref:N,props:{onClick:e=>{a&&v&&e.stopPropagation()}}}),n.jsx(Q,{component:"dropdown.display",display:a&&v?"none":"flex",children:z??n.jsx(n.Fragment,{children:" "})}),!H&&n.jsx(y.default,{children:n.jsx(Z,{viewBox:"0 0 10 6",width:"0.6rem",rotate:a?180:0,children:n.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})})]}),a&&n.jsx(K,{ref:_,top:A?void 0:0,bottom:A?2:void 0,style:{transform:`translateY(-${$}px)`},onPositionChange:e=>W(e.top-window.scrollY),children:(f.length>0||k)&&n.jsxs(y.default,{component:"dropdown.items",children:[G&&n.jsx(y.default,{component:"dropdown.unselect",selected:c.length===0,...h.props,props:{...h.props.props,onClick:e=>R(e)}}),E&&n.jsx(y.default,{component:"dropdown.selectAll",...P.props,props:{...P.props.props,onClick:e=>R(e,...C)}}),f.map(e=>{const{value:t,onClick:o,...d}=e.props;return n.jsx(y.default,{component:"dropdown.item",variant:u?"multiple":void 0,selected:c.includes(t),...d,props:{...d.props,onClick:q=>{o==null||o(q),R(q,e)}}},t)}),f.length===0&&k&&n.jsx(y.default,{component:"dropdown.emptyItem",...k.props})]})})]})}function S(p){const m=i=>null;return m.displayName=p,m}const w=r.forwardRef(te);w.Item=S("DropdownItem");w.Unselect=S("DropdownUnselect");w.SelectAll=S("DropdownSelectAll");w.EmptyItem=S("DropdownEmptyItem");w.Display=S("DropdownDisplay");w.displayName="Dropdown";function U(p){var m;if(p==null)return"";if(typeof p=="object"){const i=(m=p.props)==null?void 0:m.children;return i==null?"":typeof i=="object"?(Array.isArray(i)?i:[i]).map(x=>U(x)).join(""):i.toString()}return p.toString()}module.exports=w;
@@ -17,7 +17,7 @@ interface DropdownItemProps<TVal> extends BoxProps {
17
17
  interface DropdownDisplayProps<TVal> extends Omit<BoxProps, 'children'> {
18
18
  children: ((selectedValues: TVal[], isOpen: boolean) => React.ReactNode) | React.ReactNode;
19
19
  }
20
- interface DropdownType {
20
+ interface DropdownType extends React.FunctionComponent {
21
21
  <TVal>(props: Props<TVal> & RefAttributes<HTMLInputElement>): React.ReactNode;
22
22
  Item: <TVal>(props: DropdownItemProps<TVal>) => React.ReactNode;
23
23
  Unselect: (props: BoxProps) => React.ReactNode;
@@ -10,7 +10,7 @@ import pe from "./button.mjs";
10
10
  function ie(l, m) {
11
11
  const {
12
12
  name: p,
13
- defaultValue: g,
13
+ defaultValue: D,
14
14
  value: w,
15
15
  multiple: a,
16
16
  isSearchable: v,
@@ -20,7 +20,7 @@ function ie(l, m) {
20
20
  onChange: r,
21
21
  props: _,
22
22
  ...$
23
- } = l, [z, x] = O(Array.isArray(g) ? g : g ? [g] : []), i = "value" in l ? Array.isArray(w) ? w : w ? [w] : [] : z, [A, C] = O(""), [d, E, b] = ne(), T = J(null), L = J(null), [H, G] = O(0), N = c(() => H > window.innerHeight / 2, [H]), Q = c(() => {
23
+ } = l, [z, x] = O(Array.isArray(D) ? D : D ? [D] : []), i = "value" in l ? Array.isArray(w) ? w : w ? [w] : [] : z, [A, C] = O(""), [d, E, b] = ne(), T = J(null), L = J(null), [H, G] = O(0), N = c(() => H > window.innerHeight / 2, [H]), Q = c(() => {
24
24
  var e;
25
25
  return N ? ((e = b.current) == null ? void 0 : e.getBoundingClientRect().height) ?? 0 : 0;
26
26
  }, [N, b]), s = c(
@@ -168,16 +168,17 @@ function ie(l, m) {
168
168
  )
169
169
  ] });
170
170
  }
171
- function D(l) {
171
+ function I(l) {
172
172
  const m = (p) => null;
173
173
  return m.displayName = l, m;
174
174
  }
175
- const I = ee(ie);
176
- I.Item = D("DropdownItem");
177
- I.Unselect = D("DropdownUnselect");
178
- I.SelectAll = D("DropdownSelectAll");
179
- I.EmptyItem = D("DropdownEmptyItem");
180
- I.Display = D("DropdownDisplay");
175
+ const g = ee(ie);
176
+ g.Item = I("DropdownItem");
177
+ g.Unselect = I("DropdownUnselect");
178
+ g.SelectAll = I("DropdownSelectAll");
179
+ g.EmptyItem = I("DropdownEmptyItem");
180
+ g.Display = I("DropdownDisplay");
181
+ g.displayName = "Dropdown";
181
182
  function R(l) {
182
183
  var m;
183
184
  if (l == null) return "";
@@ -188,5 +189,5 @@ function R(l) {
188
189
  return l.toString();
189
190
  }
190
191
  export {
191
- I as default
192
+ g as default
192
193
  };