@tenorlab/react-dashboard 1.1.8 → 1.2.1

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,6 +1,7 @@
1
- export declare function WrapperColumnContent({ children }: {
1
+ type TProps = {
2
2
  children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- export declare function WrapperColumnContentListItem({ children }: {
5
- children: React.ReactNode;
6
- }): import("react/jsx-runtime").JSX.Element;
3
+ addCssClasses?: string;
4
+ };
5
+ export declare function WrapperColumnContent({ children, addCssClasses }: TProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function WrapperColumnContentListItem({ children, addCssClasses }: TProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -6,7 +6,7 @@ export type TWidgetMetaInfo = TWidgetMetaInfoBase<TFrameworkElementType | undefi
6
6
  export interface IDashboardGridProps extends IDashboardGridPropsBase {
7
7
  children?: ReactNode;
8
8
  }
9
- export interface IDashboardWidgetProps extends IDashboardWidgetPropsBase {
9
+ export interface IDashboardWidgetProps<TExtraProps = any> extends IDashboardWidgetPropsBase<TExtraProps> {
10
10
  children?: ReactNode;
11
11
  onRemoveClick?: (widgetKey: TDashboardWidgetKey, parentWidgetKey?: TDashboardWidgetKey) => void;
12
12
  onMoveClick?: (direction: -1 | 1, widgetKey: TDashboardWidgetKey, parentWidgetKey?: TDashboardWidgetKey) => void;
@@ -817,7 +817,7 @@ function nn({ className: e }) {
817
817
  }
818
818
  );
819
819
  }
820
- const Z = (e, ...n) => [
820
+ const G = (e, ...n) => [
821
821
  ...new Set(
822
822
  [e || "", ...n].join(" ").trim().replace(/\n+/gi, " ").replace(/\s+/gi, " ").split(" ")
823
823
  )
@@ -863,7 +863,7 @@ const Z = (e, ...n) => [
863
863
  onKeyDown: i,
864
864
  placeholder: s = ""
865
865
  }) => {
866
- const d = st(() => t === "small" ? "py-1.5 px-3 text-sm" : "py-2.5 px-4 text-base", [t]), b = Z("flex flex-col mb-4", n || ""), h = `${Z(`
866
+ const d = st(() => t === "small" ? "py-1.5 px-3 text-sm" : "py-2.5 px-4 text-base", [t]), b = G("flex flex-col mb-4", n || ""), h = `${G(`
867
867
  block w-full rounded-md px-3 py-1.5 text-base
868
868
  bg-formfield content-formfield
869
869
  outline-1 -outline-offset-1 outline-primary
@@ -914,7 +914,7 @@ function J(e) {
914
914
  S = S.length > 0 ? S : "";
915
915
  const c = Number((e.borderHover || 0) > 0 ? e.borderHover : 0), E = e.shadow || "sm", l = e.shadowHover || "md", f = (e.addCss || "").trim(), M = e.justifyCss || "justify-center";
916
916
  if (y)
917
- return Z(
917
+ return G(
918
918
  "flex flex-row items-center",
919
919
  v ? "text-disabled" : `text-${D} hover:brightness-110 cursor-pointer`,
920
920
  w || ""
@@ -944,14 +944,14 @@ function J(e) {
944
944
  };
945
945
  return /* @__PURE__ */ a("button", { type: "button", disabled: t, className: u(), style: m(), ...h, children: g });
946
946
  }
947
- const rn = (e) => e.direction === "row" ? Z("flex flex-row items-center gap-2", e.classNames || "") : Z("flex flex-col gap-2 w-full", e.classNames || "");
947
+ const rn = (e) => e.direction === "row" ? G("flex flex-row items-center gap-2", e.classNames || "") : G("flex flex-col gap-2 w-full", e.classNames || "");
948
948
  function on(e) {
949
949
  const { children: n, testId: t, classNames: r, direction: o, ...i } = e, s = rn(e);
950
950
  return /* @__PURE__ */ a("div", { "data-testid": t || "not-set", className: s, ...i, children: n });
951
951
  }
952
952
  const Gn = ce(
953
953
  (e, n) => {
954
- const { classNames: t, innerClass: r, ...o } = e, i = Z(t || "", "w-full"), s = Z(
954
+ const { classNames: t, innerClass: r, ...o } = e, i = G(t || "", "w-full"), s = G(
955
955
  `w-full flex overflow-hidden justify-between items-center gap-0
956
956
  rounded-md border`,
957
957
  r || ""
@@ -1138,10 +1138,10 @@ function ln() {
1138
1138
  function V(_) {
1139
1139
  return S(_) === o;
1140
1140
  }
1141
- function G(_) {
1141
+ function Z(_) {
1142
1142
  return S(_) === u;
1143
1143
  }
1144
- q.AsyncMode = c, q.ConcurrentMode = E, q.ContextConsumer = l, q.ContextProvider = f, q.Element = M, q.ForwardRef = $, q.Fragment = I, q.Lazy = T, q.Memo = z, q.Portal = X, q.Profiler = Q, q.StrictMode = K, q.Suspense = ee, q.isAsyncMode = de, q.isConcurrentMode = x, q.isContextConsumer = P, q.isContextProvider = A, q.isElement = k, q.isForwardRef = O, q.isFragment = L, q.isLazy = R, q.isMemo = j, q.isPortal = F, q.isProfiler = Y, q.isStrictMode = V, q.isSuspense = G, q.isValidElementType = C, q.typeOf = S;
1144
+ q.AsyncMode = c, q.ConcurrentMode = E, q.ContextConsumer = l, q.ContextProvider = f, q.Element = M, q.ForwardRef = $, q.Fragment = I, q.Lazy = T, q.Memo = z, q.Portal = X, q.Profiler = Q, q.StrictMode = K, q.Suspense = ee, q.isAsyncMode = de, q.isConcurrentMode = x, q.isContextConsumer = P, q.isContextProvider = A, q.isElement = k, q.isForwardRef = O, q.isFragment = L, q.isLazy = R, q.isMemo = j, q.isPortal = F, q.isProfiler = Y, q.isStrictMode = V, q.isSuspense = Z, q.isValidElementType = C, q.typeOf = S;
1145
1145
  })()), q;
1146
1146
  }
1147
1147
  var qe;
@@ -1309,8 +1309,8 @@ function un() {
1309
1309
  function v(x) {
1310
1310
  if (process.env.NODE_ENV !== "production")
1311
1311
  var P = {}, A = 0;
1312
- function k(L, R, j, F, Y, V, G) {
1313
- if (F = F || m, V = V || j, G !== t) {
1312
+ function k(L, R, j, F, Y, V, Z) {
1313
+ if (F = F || m, V = V || j, Z !== t) {
1314
1314
  if (b) {
1315
1315
  var _ = new Error(
1316
1316
  "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
@@ -1405,7 +1405,7 @@ function un() {
1405
1405
  for (var j = A[k], F = 0; F < x.length; F++)
1406
1406
  if (D(j, x[F]))
1407
1407
  return null;
1408
- var Y = JSON.stringify(x, function(G, _) {
1408
+ var Y = JSON.stringify(x, function(Z, _) {
1409
1409
  var te = ee(_);
1410
1410
  return te === "symbol" ? String(_) : _;
1411
1411
  });
@@ -1442,7 +1442,7 @@ function un() {
1442
1442
  }
1443
1443
  function k(O, L, R, j, F) {
1444
1444
  for (var Y = [], V = 0; V < x.length; V++) {
1445
- var G = x[V], _ = G(O, L, R, j, F, t);
1445
+ var Z = x[V], _ = Z(O, L, R, j, F, t);
1446
1446
  if (_ == null)
1447
1447
  return null;
1448
1448
  _.data && r(_.data, "expectedType") && Y.push(_.data.expectedType);
@@ -1472,9 +1472,9 @@ function un() {
1472
1472
  var V = x[Y];
1473
1473
  if (typeof V != "function")
1474
1474
  return I(O, L, R, Y, ee(V));
1475
- var G = V(j, Y, O, L, R + "." + Y, t);
1476
- if (G)
1477
- return G;
1475
+ var Z = V(j, Y, O, L, R + "." + Y, t);
1476
+ if (Z)
1477
+ return Z;
1478
1478
  }
1479
1479
  return null;
1480
1480
  }
@@ -1487,15 +1487,15 @@ function un() {
1487
1487
  return new p("Invalid " + L + " `" + R + "` of type `" + F + "` " + ("supplied to `" + O + "`, expected `object`."));
1488
1488
  var Y = n({}, A[k], x);
1489
1489
  for (var V in Y) {
1490
- var G = x[V];
1491
- if (r(x, V) && typeof G != "function")
1492
- return I(O, L, R, V, ee(G));
1493
- if (!G)
1490
+ var Z = x[V];
1491
+ if (r(x, V) && typeof Z != "function")
1492
+ return I(O, L, R, V, ee(Z));
1493
+ if (!Z)
1494
1494
  return new p(
1495
1495
  "Invalid " + L + " `" + R + "` key `" + V + "` supplied to `" + O + "`.\nBad object: " + JSON.stringify(A[k], null, " ") + `
1496
1496
  Valid keys: ` + JSON.stringify(Object.keys(x), null, " ")
1497
1497
  );
1498
- var _ = G(j, V, O, L, R + "." + V, t);
1498
+ var _ = Z(j, V, O, L, R + "." + V, t);
1499
1499
  if (_)
1500
1500
  return _;
1501
1501
  }
@@ -2618,11 +2618,15 @@ const vn = /* @__PURE__ */ an(bn), xn = ce((e, n) => {
2618
2618
  )
2619
2619
  );
2620
2620
  });
2621
- function tr({ children: e }) {
2621
+ function tr({ children: e, addCssClasses: n }) {
2622
+ const t = G(
2623
+ "w-full h-full flex-1 flex flex-col",
2624
+ (n || "gap-2 items-end justify-end content-end").trim()
2625
+ );
2622
2626
  return /* @__PURE__ */ a(
2623
2627
  "div",
2624
2628
  {
2625
- className: "w-full h-full flex-1 flex flex-col gap-2 items-end justify-end content-end",
2629
+ className: t,
2626
2630
  style: {
2627
2631
  minHeight: "140px"
2628
2632
  },
@@ -2630,8 +2634,12 @@ function tr({ children: e }) {
2630
2634
  }
2631
2635
  );
2632
2636
  }
2633
- function nr({ children: e }) {
2634
- return /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-end", children: e });
2637
+ function nr({ children: e, addCssClasses: n }) {
2638
+ const t = G(
2639
+ "w-full flex flex-col",
2640
+ (n || "items-end").trim()
2641
+ );
2642
+ return /* @__PURE__ */ a("div", { className: t, children: e });
2635
2643
  }
2636
2644
  const rr = (e) => {
2637
2645
  console.warn("showToast TODO", e);
@@ -2640,7 +2648,7 @@ const rr = (e) => {
2640
2648
  const r = e.responsiveGrid || !1, o = e.isEditing || !1, i = {
2641
2649
  "--bwj-dashboard-transform-scale": t,
2642
2650
  "--bwj-dashboard-add-cols": wn(t)
2643
- }, s = Z(
2651
+ }, s = G(
2644
2652
  "dashboard-main-grid w-full",
2645
2653
  o ? "editing" : "",
2646
2654
  r ? "responsive-grid" : "",
@@ -2655,7 +2663,7 @@ const rr = (e) => {
2655
2663
  e.onRemoveClick && e.widgetKey && e.onRemoveClick(e.widgetKey, e.parentWidgetKey);
2656
2664
  }, s = (b) => {
2657
2665
  e.onMoveClick && e.widgetKey && e.onMoveClick(b, e.widgetKey, e.parentWidgetKey);
2658
- }, d = Z(
2666
+ }, d = G(
2659
2667
  "widget-header",
2660
2668
  t ? "hidden" : "flex items-center justify-between border-b border-solid border-card-invert",
2661
2669
  t ? "border-opacity-0" : "border-opacity-20"
@@ -2861,7 +2869,7 @@ function ke(e) {
2861
2869
  ["large", "xlarge"].indexOf(e.size || "") > -1 && (g = `${e.size}-widget`);
2862
2870
  let h = "";
2863
2871
  t === "row" && !r ? h = "min-h-48" : t === "column" && !r && (h = "min-h-96");
2864
- let u = Z(
2872
+ let u = G(
2865
2873
  "dashboard-widget-container relative ",
2866
2874
  r ? "" : "has-no-children",
2867
2875
  o ? "editing" : "",
@@ -2973,7 +2981,7 @@ function We({
2973
2981
  alreadyAdded: n,
2974
2982
  addWidget: t
2975
2983
  }) {
2976
- const [r, o] = le(!1), i = e.icon || nn, s = e.displayName || "Unknown", d = e.description || "---", g = (e.noDuplicatedWidgets || !1) && n, h = Z(`
2984
+ const [r, o] = le(!1), i = e.icon || nn, s = e.displayName || "Unknown", d = e.description || "---", g = (e.noDuplicatedWidgets || !1) && n, h = G(`
2977
2985
  flex flex-row gap-2 p-2 rounded-md border text-sm bg-card content-card backdrop-opacity-100
2978
2986
  ${g ? "border-disabled fill-disabled text-disabled" : "cursor-pointer border-primary fill-danger hover:fill-primary content-primary hover:brightness-110"}
2979
2987
  `);
@@ -3003,7 +3011,7 @@ function Tn({
3003
3011
  item: e,
3004
3012
  onSettingItemChanged: n
3005
3013
  }) {
3006
- const t = e.displayName || "Unknown", r = e.description || "---", o = Z(`
3014
+ const t = e.displayName || "Unknown", r = e.description || "---", o = G(`
3007
3015
  flex flex-row gap-2 p-2 rounded-md border text-sm bg-card content-card backdrop-opacity-100
3008
3016
  `), i = (d) => {
3009
3017
  const b = d.key;
@@ -3067,7 +3075,7 @@ function lr({
3067
3075
  }, S = (T) => {
3068
3076
  const z = D.trim().toLowerCase();
3069
3077
  return z.length < 1 ? !0 : T.displayName.trim().toLowerCase().includes(z) || T.description.toLowerCase().includes(z);
3070
- }, c = (T) => Z(
3078
+ }, c = (T) => G(
3071
3079
  "px-4 py-2 font-medium cursor-pointer border-b-2 border-transparent hover:border-primary focus:outline-none",
3072
3080
  T === m ? "text-primary border-primary" : ""
3073
3081
  ), E = !!e;
@@ -3296,7 +3304,7 @@ export {
3296
3304
  ct as ensureZoomScaleIsWithinRange,
3297
3305
  ge as getDefaultWidgetMetaFromKey,
3298
3306
  Wn as getDefaultWidgetMetaFromMap,
3299
- Z as getDistinctCssClasses,
3307
+ G as getDistinctCssClasses,
3300
3308
  Ot as getMetaInfoFromFile,
3301
3309
  Pn as getNewZoomScaleWithinRange,
3302
3310
  $t as getWidgetMetaFromCatalog,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenorlab/react-dashboard",
3
- "version": "1.1.8",
3
+ "version": "1.2.1",
4
4
  "description": "Foundation components for creating user-configurable dashboards in React",
5
5
  "author": "Damiano Fusco",
6
6
  "type": "module",