@k3-tech/react-kit 0.0.77 → 0.0.78

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.d.ts CHANGED
@@ -37,7 +37,7 @@ export * from './kit/layouts/admin/types';
37
37
  export * from './kit/providers/ThemeProvider';
38
38
  export * from './shadcn/hooks/use-mobile';
39
39
  export * from './shadcn/lib/utils';
40
- export { toast } from 'sonner';
40
+ export { toast } from './shadcn/lib/toast';
41
41
  export * from './shadcn/ui/accordion';
42
42
  export * from './shadcn/ui/alert-dialog';
43
43
  export * from './shadcn/ui/alert';
package/dist/index.js CHANGED
@@ -12406,10 +12406,24 @@ function flexClasses(options) {
12406
12406
  const justifyClass = justify === "start" ? "justify-start" : justify === "center" ? "justify-center" : justify === "between" ? "justify-between" : "justify-end";
12407
12407
  return cn$1("flex", `flex-${direction}`, wrap, gap, alignClass, justifyClass);
12408
12408
  }
12409
- function leafSpanClasses(leaf) {
12409
+ function leafSpanClasses(leaf, grid) {
12410
12410
  if (!leaf.span) return void 0;
12411
12411
  const parts = [];
12412
- if (leaf.span.base) parts.push(COL_SPAN.base[leaf.span.base]);
12412
+ const baseCols = (grid == null ? void 0 : grid.cols) ?? 1;
12413
+ if (leaf.span.base && leaf.span.base > baseCols) {
12414
+ parts.push("col-span-full");
12415
+ const breakpoints = [
12416
+ ["sm", grid == null ? void 0 : grid.smCols],
12417
+ ["md", grid == null ? void 0 : grid.mdCols],
12418
+ ["lg", grid == null ? void 0 : grid.lgCols],
12419
+ ["xl", grid == null ? void 0 : grid.xlCols]
12420
+ ];
12421
+ const wide = breakpoints.find(([key, cols]) => {
12422
+ var _a2, _b;
12423
+ return cols && cols >= (((_a2 = leaf.span) == null ? void 0 : _a2.base) ?? 0) && !((_b = leaf.span) == null ? void 0 : _b[key]);
12424
+ });
12425
+ if (wide) parts.push(COL_SPAN[wide[0]][leaf.span.base]);
12426
+ } else if (leaf.span.base) parts.push(COL_SPAN.base[leaf.span.base]);
12413
12427
  if (leaf.span.sm) parts.push(COL_SPAN.sm[leaf.span.sm]);
12414
12428
  if (leaf.span.md) parts.push(COL_SPAN.md[leaf.span.md]);
12415
12429
  if (leaf.span.lg) parts.push(COL_SPAN.lg[leaf.span.lg]);
@@ -12441,10 +12455,11 @@ function shallowEqualLeaf(a2, b2) {
12441
12455
  const SectionLeafRenderer = memo$1(
12442
12456
  function SectionLeafRenderer2({
12443
12457
  leaf,
12458
+ grid,
12444
12459
  renderLeaf
12445
12460
  }) {
12446
12461
  if (leaf.hidden) return null;
12447
- const span = leafSpanClasses(leaf);
12462
+ const span = leafSpanClasses(leaf, grid);
12448
12463
  if (renderLeaf) {
12449
12464
  return /* @__PURE__ */ jsx("div", { className: cn$1(span, leaf.className), children: renderLeaf(leaf) });
12450
12465
  }
@@ -12471,7 +12486,10 @@ const SectionLeafRenderer = memo$1(
12471
12486
  leaf.description ? /* @__PURE__ */ jsx("div", { className: cn$1("mt-1", labelBaseCls), children: leaf.description }) : null
12472
12487
  ] });
12473
12488
  },
12474
- (prev, next) => shallowEqualLeaf(prev.leaf, next.leaf) && prev.renderLeaf === next.renderLeaf
12489
+ (prev, next) => {
12490
+ var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j;
12491
+ return shallowEqualLeaf(prev.leaf, next.leaf) && ((_a2 = prev.grid) == null ? void 0 : _a2.cols) === ((_b = next.grid) == null ? void 0 : _b.cols) && ((_c = prev.grid) == null ? void 0 : _c.smCols) === ((_d = next.grid) == null ? void 0 : _d.smCols) && ((_e2 = prev.grid) == null ? void 0 : _e2.mdCols) === ((_f = next.grid) == null ? void 0 : _f.mdCols) && ((_g = prev.grid) == null ? void 0 : _g.lgCols) === ((_h = next.grid) == null ? void 0 : _h.lgCols) && ((_i = prev.grid) == null ? void 0 : _i.xlCols) === ((_j = next.grid) == null ? void 0 : _j.xlCols) && prev.renderLeaf === next.renderLeaf;
12492
+ }
12475
12493
  );
12476
12494
  function SectionNodeRenderer({
12477
12495
  node,
@@ -12542,6 +12560,7 @@ function SectionNodeRenderer({
12542
12560
  SectionLeafRenderer,
12543
12561
  {
12544
12562
  leaf: child,
12563
+ grid: layout === "grid" ? node.grid : void 0,
12545
12564
  renderLeaf
12546
12565
  },
12547
12566
  child.key
@@ -39559,14 +39578,14 @@ const conditions = {
39559
39578
  const transformers = {
39560
39579
  // Transform form data before submission
39561
39580
  cleanEmptyStrings: (data) => {
39562
- const clean = (obj) => {
39581
+ const clean2 = (obj) => {
39563
39582
  if (Array.isArray(obj)) {
39564
- return obj.map(clean).filter((item) => item !== null && item !== void 0);
39583
+ return obj.map(clean2).filter((item) => item !== null && item !== void 0);
39565
39584
  }
39566
39585
  if (obj && typeof obj === "object") {
39567
39586
  const cleaned = {};
39568
39587
  Object.keys(obj).forEach((key) => {
39569
- const value = clean(obj[key]);
39588
+ const value = clean2(obj[key]);
39570
39589
  if (value !== "" && value !== null && value !== void 0) {
39571
39590
  cleaned[key] = value;
39572
39591
  }
@@ -39575,7 +39594,7 @@ const transformers = {
39575
39594
  }
39576
39595
  return obj === "" ? void 0 : obj;
39577
39596
  };
39578
- return clean(data);
39597
+ return clean2(data);
39579
39598
  },
39580
39599
  // Convert string numbers to actual numbers
39581
39600
  parseNumbers: (data, numberFields) => {
@@ -48268,7 +48287,7 @@ const isHttpResponse = (data) => {
48268
48287
  const basicToast = toastFunction;
48269
48288
  const getHistory = () => ToastState.toasts;
48270
48289
  const getToasts = () => ToastState.getActiveToasts();
48271
- const toast = Object.assign(basicToast, {
48290
+ const toast$1 = Object.assign(basicToast, {
48272
48291
  success: ToastState.success,
48273
48292
  info: ToastState.info,
48274
48293
  warning: ToastState.warning,
@@ -48973,6 +48992,18 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
48973
48992
  }))
48974
48993
  );
48975
48994
  });
48995
+ const PREFIX = /^\s*\[(GraphQL|Network)\]\s*/;
48996
+ function clean(message2) {
48997
+ return typeof message2 === "string" ? message2.replace(PREFIX, "") : message2;
48998
+ }
48999
+ const toast = Object.assign(
49000
+ ((message2, data) => toast$1(clean(message2), data)),
49001
+ toast$1,
49002
+ {
49003
+ error: ((message2, data) => toast$1.error(clean(message2), data && { ...data, description: clean(data.description) })),
49004
+ warning: ((message2, data) => toast$1.warning(clean(message2), data && { ...data, description: clean(data.description) }))
49005
+ }
49006
+ );
48976
49007
  const EMPTY_PREVIEW = {
48977
49008
  columns: [],
48978
49009
  rows: [],
@@ -52504,7 +52535,7 @@ function PageHeader({
52504
52535
  "data-page-header": "",
52505
52536
  className: cn$1("flex flex-wrap items-start justify-between gap-x-6 gap-y-4", className),
52506
52537
  children: [
52507
- /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
52538
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 basis-64", children: [
52508
52539
  /* @__PURE__ */ jsxs("div", { className: "flex min-h-10 items-center gap-2", children: [
52509
52540
  onBack && /* @__PURE__ */ jsx(
52510
52541
  "button",
@@ -1646,6 +1646,10 @@
1646
1646
  flex-grow: 0;
1647
1647
  }
1648
1648
 
1649
+ .basis-64 {
1650
+ flex-basis: calc(var(--spacing) * 64);
1651
+ }
1652
+
1649
1653
  .basis-full {
1650
1654
  flex-basis: 100%;
1651
1655
  }
@@ -1661,6 +1661,10 @@
1661
1661
  flex-grow: 0;
1662
1662
  }
1663
1663
 
1664
+ .basis-64 {
1665
+ flex-basis: calc(var(--spacing) * 64);
1666
+ }
1667
+
1664
1668
  .basis-full {
1665
1669
  flex-basis: 100%;
1666
1670
  }
@@ -1646,6 +1646,10 @@
1646
1646
  flex-grow: 0;
1647
1647
  }
1648
1648
 
1649
+ .basis-64 {
1650
+ flex-basis: calc(var(--spacing) * 64);
1651
+ }
1652
+
1649
1653
  .basis-full {
1650
1654
  flex-basis: 100%;
1651
1655
  }
@@ -1646,6 +1646,10 @@
1646
1646
  flex-grow: 0;
1647
1647
  }
1648
1648
 
1649
+ .basis-64 {
1650
+ flex-basis: calc(var(--spacing) * 64);
1651
+ }
1652
+
1649
1653
  .basis-full {
1650
1654
  flex-basis: 100%;
1651
1655
  }
@@ -0,0 +1,6 @@
1
+ import { toast as sonnerToast } from 'sonner';
2
+ type Toast = typeof sonnerToast;
3
+ /** sonner `toast`, with the urql "[GraphQL]"/"[Network]" prefix removed from error and warning text. */
4
+ export declare const toast: Toast;
5
+ export {};
6
+ //# sourceMappingURL=toast.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k3-tech/react-kit",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",