@hortiview/shared-components 2.29.0 → 2.30.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.
@@ -1,11 +1,11 @@
1
- import { jsx as g, Fragment as wt, jsxs as kt } from "react/jsx-runtime";
2
- import { G as U } from "../../index.es-BE1XL1dD.js";
3
- import { I as Ut } from "../../index.es-BwhRJBEH.js";
4
- import { _ as Zt, a as te, c as G, P as l } from "../../index-_-9ybP20.js";
1
+ import { jsx as h, Fragment as Z, jsxs as kt } from "react/jsx-runtime";
2
+ import { G } from "../../index.es-BE1XL1dD.js";
3
+ import { I as $t } from "../../index.es-BwhRJBEH.js";
4
+ import { _ as Zt, a as te, c as F, P as l } from "../../index-_-9ybP20.js";
5
5
  import { _ as Mt } from "../../slicedToArray-C2Ed3239.js";
6
- import m, { forwardRef as ee, useRef as Pt, useImperativeHandle as ne, useState as Ht, useEffect as v, useCallback as Z, useMemo as nt, Fragment as oe } from "react";
6
+ import m, { forwardRef as ee, useRef as Pt, useImperativeHandle as ne, useState as Ht, useEffect as v, useCallback as tt, useMemo as ot, Fragment as oe } from "react";
7
7
  import { w as xt, j as ie, c as D, a as ae } from "../../index.es-DRC-9PLs.js";
8
- import { b as Gt, c as $t, d as re } from "../../tslib.es6-BDCynO9F.js";
8
+ import { b as Gt, c as Ut, d as re } from "../../tslib.es6-BDCynO9F.js";
9
9
  import { M as le, a as se } from "../../component-By6nyiBU.js";
10
10
  import { M as ce, c as ue, m as de } from "../../component-9vrShqiY.js";
11
11
  import { A as me } from "../../animationframe-CqXArbwZ.js";
@@ -32,7 +32,7 @@ function ye(o) {
32
32
  return e.add(t.offsetTop);
33
33
  }), e.size > 1;
34
34
  }
35
- var tt = "mdc-dom-focus-sentinel", Oe = (
35
+ var et = "mdc-dom-focus-sentinel", Oe = (
36
36
  /** @class */
37
37
  (function() {
38
38
  function o(e, t) {
@@ -44,7 +44,7 @@ var tt = "mdc-dom-focus-sentinel", Oe = (
44
44
  throw new Error("FocusTrap: Element must have at least one focusable child.");
45
45
  this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.wrapTabFocus(this.root), this.options.skipInitialFocus || this.focusInitialElement(e, this.options.initialFocusEl);
46
46
  }, o.prototype.releaseFocus = function() {
47
- [].slice.call(this.root.querySelectorAll("." + tt)).forEach(function(e) {
47
+ [].slice.call(this.root.querySelectorAll("." + et)).forEach(function(e) {
48
48
  e.parentElement.removeChild(e);
49
49
  }), !this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus && this.elFocusedBeforeTrapFocus.focus();
50
50
  }, o.prototype.wrapTabFocus = function(e) {
@@ -62,16 +62,16 @@ var tt = "mdc-dom-focus-sentinel", Oe = (
62
62
  }, o.prototype.getFocusableElements = function(e) {
63
63
  var t = [].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button"));
64
64
  return t.filter(function(n) {
65
- var i = n.getAttribute("aria-disabled") === "true" || n.getAttribute("disabled") != null || n.getAttribute("hidden") != null || n.getAttribute("aria-hidden") === "true", a = n.tabIndex >= 0 && n.getBoundingClientRect().width > 0 && !n.classList.contains(tt) && !i, d = !1;
65
+ var i = n.getAttribute("aria-disabled") === "true" || n.getAttribute("disabled") != null || n.getAttribute("hidden") != null || n.getAttribute("aria-hidden") === "true", a = n.tabIndex >= 0 && n.getBoundingClientRect().width > 0 && !n.classList.contains(et) && !i, d = !1;
66
66
  if (a) {
67
- var h = getComputedStyle(n);
68
- d = h.display === "none" || h.visibility === "hidden";
67
+ var g = getComputedStyle(n);
68
+ d = g.display === "none" || g.visibility === "hidden";
69
69
  }
70
70
  return a && !d;
71
71
  });
72
72
  }, o.prototype.createSentinel = function() {
73
73
  var e = document.createElement("div");
74
- return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(tt), e;
74
+ return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(et), e;
75
75
  }, o;
76
76
  })()
77
77
  );
@@ -108,7 +108,7 @@ var s = {
108
108
  // to prevent interactions with the content behind this scrim, and to capture
109
109
  // scrim clicks.
110
110
  SCRIM_HIDDEN: "mdc-dialog__scrim--hidden"
111
- }, A = {
111
+ }, T = {
112
112
  ACTION_ATTRIBUTE: "data-mdc-dialog-action",
113
113
  BUTTON_DEFAULT_ATTRIBUTE: "data-mdc-dialog-button-default",
114
114
  BUTTON_SELECTOR: ".mdc-dialog__button",
@@ -128,7 +128,7 @@ var s = {
128
128
  ".mdc-menu .mdc-deprecated-list-item"
129
129
  ].join(", "),
130
130
  SURFACE_SELECTOR: ".mdc-dialog__surface"
131
- }, et = {
131
+ }, nt = {
132
132
  DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
133
133
  DIALOG_ANIMATION_OPEN_TIME_MS: 150
134
134
  };
@@ -141,8 +141,8 @@ var Kt = (
141
141
  (function(o) {
142
142
  Gt(e, o);
143
143
  function e(t) {
144
- var n = o.call(this, $t($t({}, e.defaultAdapter), t)) || this;
145
- return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = A.CLOSE_ACTION, n.scrimClickAction = A.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = A.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new me(), n.contentScrollHandler = function() {
144
+ var n = o.call(this, Ut(Ut({}, e.defaultAdapter), t)) || this;
145
+ return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = T.CLOSE_ACTION, n.scrimClickAction = T.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = T.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new me(), n.contentScrollHandler = function() {
146
146
  n.handleScrollEvent();
147
147
  }, n.windowResizeHandler = function() {
148
148
  n.layout();
@@ -158,13 +158,13 @@ var Kt = (
158
158
  configurable: !0
159
159
  }), Object.defineProperty(e, "strings", {
160
160
  get: function() {
161
- return A;
161
+ return T;
162
162
  },
163
163
  enumerable: !1,
164
164
  configurable: !0
165
165
  }), Object.defineProperty(e, "numbers", {
166
166
  get: function() {
167
- return et;
167
+ return nt;
168
168
  },
169
169
  enumerable: !1,
170
170
  configurable: !0
@@ -234,19 +234,19 @@ var Kt = (
234
234
  }), e.prototype.init = function() {
235
235
  this.adapter.hasClass(s.STACKED) && this.setAutoStackButtons(!1), this.isFullscreen = this.adapter.hasClass(s.FULLSCREEN);
236
236
  }, e.prototype.destroy = function() {
237
- this.dialogOpen && this.close(A.DESTROY_ACTION), this.animationTimer && (clearTimeout(this.animationTimer), this.handleAnimationTimerEnd()), this.isFullscreen && this.adapter.deregisterContentEventHandler("scroll", this.contentScrollHandler), this.animFrame.cancelAll(), this.adapter.deregisterWindowEventHandler("resize", this.windowResizeHandler), this.adapter.deregisterWindowEventHandler("orientationchange", this.windowOrientationChangeHandler);
237
+ this.dialogOpen && this.close(T.DESTROY_ACTION), this.animationTimer && (clearTimeout(this.animationTimer), this.handleAnimationTimerEnd()), this.isFullscreen && this.adapter.deregisterContentEventHandler("scroll", this.contentScrollHandler), this.animFrame.cancelAll(), this.adapter.deregisterWindowEventHandler("resize", this.windowResizeHandler), this.adapter.deregisterWindowEventHandler("orientationchange", this.windowOrientationChangeHandler);
238
238
  }, e.prototype.open = function(t) {
239
239
  var n = this;
240
240
  this.dialogOpen = !0, this.adapter.notifyOpening(), this.adapter.addClass(s.OPENING), this.isFullscreen && this.adapter.registerContentEventHandler("scroll", this.contentScrollHandler), t && t.isAboveFullscreenDialog && this.adapter.addClass(s.SCRIM_HIDDEN), this.adapter.registerWindowEventHandler("resize", this.windowResizeHandler), this.adapter.registerWindowEventHandler("orientationchange", this.windowOrientationChangeHandler), this.runNextAnimationFrame(function() {
241
241
  n.adapter.addClass(s.OPEN), n.adapter.addBodyClass(s.SCROLL_LOCK), n.layout(), n.animationTimer = setTimeout(function() {
242
242
  n.handleAnimationTimerEnd(), n.adapter.trapFocus(n.adapter.getInitialFocusEl()), n.adapter.notifyOpened();
243
- }, et.DIALOG_ANIMATION_OPEN_TIME_MS);
243
+ }, nt.DIALOG_ANIMATION_OPEN_TIME_MS);
244
244
  });
245
245
  }, e.prototype.close = function(t) {
246
246
  var n = this;
247
247
  t === void 0 && (t = ""), this.dialogOpen && (this.dialogOpen = !1, this.adapter.notifyClosing(t), this.adapter.addClass(s.CLOSING), this.adapter.removeClass(s.OPEN), this.adapter.removeBodyClass(s.SCROLL_LOCK), this.isFullscreen && this.adapter.deregisterContentEventHandler("scroll", this.contentScrollHandler), this.adapter.deregisterWindowEventHandler("resize", this.windowResizeHandler), this.adapter.deregisterWindowEventHandler("orientationchange", this.windowOrientationChangeHandler), cancelAnimationFrame(this.animationFrame), this.animationFrame = 0, clearTimeout(this.animationTimer), this.animationTimer = setTimeout(function() {
248
248
  n.adapter.releaseFocus(), n.handleAnimationTimerEnd(), n.adapter.notifyClosed(t);
249
- }, et.DIALOG_ANIMATION_CLOSE_TIME_MS));
249
+ }, nt.DIALOG_ANIMATION_CLOSE_TIME_MS));
250
250
  }, e.prototype.showSurfaceScrim = function() {
251
251
  var t = this;
252
252
  this.adapter.addClass(s.SURFACE_SCRIM_SHOWING), this.runNextAnimationFrame(function() {
@@ -280,7 +280,7 @@ var Kt = (
280
280
  t.layoutInternal();
281
281
  });
282
282
  }, e.prototype.handleClick = function(t) {
283
- var n = this.adapter.eventTargetMatches(t.target, A.SCRIM_SELECTOR);
283
+ var n = this.adapter.eventTargetMatches(t.target, T.SCRIM_SELECTOR);
284
284
  if (n && this.scrimClickAction !== "")
285
285
  this.close(this.scrimClickAction);
286
286
  else {
@@ -370,23 +370,23 @@ var f = Kt.strings, Ae = (
370
370
  return new e(t);
371
371
  }, e.prototype.initialize = function(t) {
372
372
  var n, i;
373
- t === void 0 && (t = function(_, S) {
374
- return new Oe(_, S);
373
+ t === void 0 && (t = function(_, y) {
374
+ return new Oe(_, y);
375
375
  });
376
376
  var a = this.root.querySelector(f.CONTAINER_SELECTOR);
377
377
  if (!a)
378
378
  throw new Error("Dialog component requires a " + f.CONTAINER_SELECTOR + " container element");
379
379
  this.container = a, this.content = this.root.querySelector(f.CONTENT_SELECTOR), this.buttons = [].slice.call(this.root.querySelectorAll(f.BUTTON_SELECTOR)), this.defaultButton = this.root.querySelector("[" + f.BUTTON_DEFAULT_ATTRIBUTE + "]"), this.focusTrapFactory = t, this.buttonRipples = [];
380
380
  try {
381
- for (var d = re(this.buttons), h = d.next(); !h.done; h = d.next()) {
382
- var O = h.value;
381
+ for (var d = re(this.buttons), g = d.next(); !g.done; g = d.next()) {
382
+ var O = g.value;
383
383
  this.buttonRipples.push(new ce(O));
384
384
  }
385
385
  } catch (_) {
386
386
  n = { error: _ };
387
387
  } finally {
388
388
  try {
389
- h && !h.done && (i = d.return) && i.call(d);
389
+ g && !g.done && (i = d.return) && i.call(d);
390
390
  } finally {
391
391
  if (n) throw n.error;
392
392
  }
@@ -691,30 +691,30 @@ var f = Kt.strings, Ae = (
691
691
  returnFocusSelector: null,
692
692
  scrollable: !1,
693
693
  title: null
694
- }, Ie = ["actionButton", "actionIcons", "badge", "backButton", "children", "className", "content", "defaultButton", "dismissiveButton", "footerSupplemental", "headerActions", "hideCloseIcon", "indicator", "initialFocus", "mobileStackedButtons", "modalSize", "nextButton", "noActions", "onClose", "onClosed", "onOpen", "onOpened", "open", "preventClose", "preventPrimaryAccept", "primaryButton", "returnFocusSelector", "scrollable", "title", "iconSource"], r = be, ot = /* @__PURE__ */ ee(function(o, e) {
695
- var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i, d = o.badge, h = d === void 0 ? r.badge : d, O = o.backButton, _ = O === void 0 ? r.backButton : O, S = o.children, F = S === void 0 ? r.children : S, T = o.className, W = T === void 0 ? r.className : T, E = o.content, L = E === void 0 ? r.content : E, it = o.defaultButton, b = it === void 0 ? r.defaultButton : it, at = o.dismissiveButton, R = at === void 0 ? r.dismissiveButton : at, rt = o.footerSupplemental, w = rt === void 0 ? r.footerSupplemental : rt, lt = o.headerActions, st = lt === void 0 ? r.headerActions : lt, ct = o.hideCloseIcon, V = ct === void 0 ? r.hideCloseIcon : ct, ut = o.indicator, Wt = ut === void 0 ? r.indicator : ut, dt = o.initialFocus, I = dt === void 0 ? r.initialFocus : dt, mt = o.mobileStackedButtons, z = mt === void 0 ? r.mobileStackedButtons : mt, ft = o.modalSize, C = ft === void 0 ? r.modalSize : ft, pt = o.nextButton, B = pt === void 0 ? r.nextButton : pt, ht = o.noActions, N = ht === void 0 ? r.noActions : ht, gt = o.onClose, j = gt === void 0 ? r.onClose : gt, _t = o.onClosed, q = _t === void 0 ? r.onClosed : _t, Ct = o.onOpen, k = Ct === void 0 ? r.onOpen : Ct, vt = o.onOpened, M = vt === void 0 ? r.onOpened : vt, Et = o.open, St = Et === void 0 ? r.open : Et, yt = o.preventClose, Y = yt === void 0 ? r.preventClose : yt, Ot = o.preventPrimaryAccept, At = Ot === void 0 ? r.preventPrimaryAccept : Ot, Tt = o.primaryButton, u = Tt === void 0 ? r.primaryButton : Tt, bt = o.returnFocusSelector, J = bt === void 0 ? r.returnFocusSelector : bt, It = o.scrollable, Bt = It === void 0 ? r.scrollable : It, Nt = o.title, Dt = Nt === void 0 ? r.title : Nt, Ft = o.iconSource, Vt = Ft === void 0 ? r.iconSource : Ft, zt = Zt(o, Ie), P = Pt(), c = Pt();
694
+ }, Ie = ["actionButton", "actionIcons", "badge", "backButton", "children", "className", "content", "defaultButton", "dismissiveButton", "footerSupplemental", "headerActions", "hideCloseIcon", "indicator", "initialFocus", "mobileStackedButtons", "modalSize", "nextButton", "noActions", "onClose", "onClosed", "onOpen", "onOpened", "open", "preventClose", "preventPrimaryAccept", "primaryButton", "returnFocusSelector", "scrollable", "title", "iconSource"], r = be, it = /* @__PURE__ */ ee(function(o, e) {
695
+ var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i, d = o.badge, g = d === void 0 ? r.badge : d, O = o.backButton, _ = O === void 0 ? r.backButton : O, y = o.children, L = y === void 0 ? r.children : y, A = o.className, W = A === void 0 ? r.className : A, E = o.content, R = E === void 0 ? r.content : E, at = o.defaultButton, b = at === void 0 ? r.defaultButton : at, rt = o.dismissiveButton, w = rt === void 0 ? r.dismissiveButton : rt, lt = o.footerSupplemental, k = lt === void 0 ? r.footerSupplemental : lt, st = o.headerActions, ct = st === void 0 ? r.headerActions : st, ut = o.hideCloseIcon, V = ut === void 0 ? r.hideCloseIcon : ut, dt = o.indicator, Wt = dt === void 0 ? r.indicator : dt, mt = o.initialFocus, I = mt === void 0 ? r.initialFocus : mt, ft = o.mobileStackedButtons, z = ft === void 0 ? r.mobileStackedButtons : ft, pt = o.modalSize, C = pt === void 0 ? r.modalSize : pt, ht = o.nextButton, B = ht === void 0 ? r.nextButton : ht, gt = o.noActions, N = gt === void 0 ? r.noActions : gt, _t = o.onClose, j = _t === void 0 ? r.onClose : _t, Ct = o.onClosed, q = Ct === void 0 ? r.onClosed : Ct, vt = o.onOpen, M = vt === void 0 ? r.onOpen : vt, Et = o.onOpened, P = Et === void 0 ? r.onOpened : Et, St = o.open, yt = St === void 0 ? r.open : St, Ot = o.preventClose, Y = Ot === void 0 ? r.preventClose : Ot, At = o.preventPrimaryAccept, Tt = At === void 0 ? r.preventPrimaryAccept : At, bt = o.primaryButton, u = bt === void 0 ? r.primaryButton : bt, It = o.returnFocusSelector, J = It === void 0 ? r.returnFocusSelector : It, Bt = o.scrollable, Nt = Bt === void 0 ? r.scrollable : Bt, Dt = o.title, Ft = Dt === void 0 ? r.title : Dt, Lt = o.iconSource, Vt = Lt === void 0 ? r.iconSource : Lt, zt = Zt(o, Ie), H = Pt(), c = Pt();
696
696
  ne(e, function() {
697
- return P.current;
697
+ return H.current;
698
698
  }, []);
699
- var jt = Ht(), Lt = Mt(jt, 2), Q = Lt[0], qt = Lt[1], Yt = Ht(function() {
699
+ var jt = Ht(), Rt = Mt(jt, 2), Q = Rt[0], qt = Rt[1], Yt = Ht(function() {
700
700
  return B || _;
701
- }), Rt = Mt(Yt, 2), X = Rt[0], Jt = Rt[1];
701
+ }), wt = Mt(Yt, 2), X = wt[0], Jt = wt[1];
702
702
  v(function() {
703
703
  Jt(B || _);
704
704
  }, [B, _]);
705
- var H = Z(function() {
705
+ var x = tt(function() {
706
706
  xt() && qt(window.innerWidth <= 600);
707
707
  }, []);
708
708
  v(function() {
709
- return xt() ? (H(), window.addEventListener("resize", H), function() {
710
- window.removeEventListener("resize", H);
709
+ return xt() ? (x(), window.addEventListener("resize", x), function() {
710
+ window.removeEventListener("resize", x);
711
711
  }) : function() {
712
712
  };
713
- }, [H]), v(function() {
714
- return c.current = Ae.attachTo(P.current), function() {
713
+ }, [x]), v(function() {
714
+ return c.current = Ae.attachTo(H.current), function() {
715
715
  c.current.destroy();
716
716
  };
717
- }, [c, P]), v(function() {
717
+ }, [c, H]), v(function() {
718
718
  c.current.foundation.setAutoStackButtons(z);
719
719
  }, [z]), v(function() {
720
720
  N && (c.current.foundation.adapter.trapFocus = function() {
@@ -722,31 +722,31 @@ var f = Kt.strings, Ae = (
722
722
  }, [N]), v(function() {
723
723
  c.current.scrimClickAction = Y ? "" : "close", c.current.escapeKeyAction = Y ? "" : "close";
724
724
  }, [Y]);
725
- var x = Z(function(p) {
725
+ var U = tt(function(p) {
726
726
  j && j(p);
727
- }, [j]), $ = Z(function(p) {
727
+ }, [j]), $ = tt(function(p) {
728
728
  J && ie(J), q && q(p);
729
729
  }, [J, q]);
730
730
  v(function() {
731
- return c.current.unlisten("MDCDialog: opening", k), c.current.listen("MDCDialog: opening", k), function() {
732
- c.current.unlisten("MDCDialog: opening", k);
733
- };
734
- }, [c, k]), v(function() {
735
- return c.current.unlisten("MDCDialog:opened", M), c.current.listen("MDCDialog:opened", M), function() {
736
- c.current.unlisten("MDCDialog:opened", M);
731
+ return c.current.unlisten("MDCDialog: opening", M), c.current.listen("MDCDialog: opening", M), function() {
732
+ c.current.unlisten("MDCDialog: opening", M);
737
733
  };
738
734
  }, [c, M]), v(function() {
739
- return c.current.unlisten("MDCDialog:closing", x), c.current.listen("MDCDialog:closing", x), function() {
740
- c.current.unlisten("MDCDialog:closing", x);
735
+ return c.current.unlisten("MDCDialog:opened", P), c.current.listen("MDCDialog:opened", P), function() {
736
+ c.current.unlisten("MDCDialog:opened", P);
737
+ };
738
+ }, [c, P]), v(function() {
739
+ return c.current.unlisten("MDCDialog:closing", U), c.current.listen("MDCDialog:closing", U), function() {
740
+ c.current.unlisten("MDCDialog:closing", U);
741
741
  };
742
- }, [c, x]), v(function() {
742
+ }, [c, U]), v(function() {
743
743
  return c.current.unlisten("MDCDialog:closed", $), c.current.listen("MDCDialog:closed", $), function() {
744
744
  c.current.unlisten("MDCDialog:closed", $);
745
745
  };
746
746
  }, [c, $]), v(function() {
747
- St ? c.current.open() : c.current.close();
748
- }, [c, St]);
749
- var Qt = nt(function() {
747
+ yt ? c.current.open() : c.current.close();
748
+ }, [c, yt]);
749
+ var Qt = ot(function() {
750
750
  return function() {
751
751
  var p = {
752
752
  className: "lmnt-modal__button mdc-dialog__button",
@@ -755,51 +755,51 @@ var f = Kt.strings, Ae = (
755
755
  };
756
756
  return b === "action" && (p["data-mdc-dialog-button-default"] = !0), I === "action" && (p["data-mdc-dialog-initial-focus"] = !0), p;
757
757
  };
758
- }, [n?.props.elevation, n?.props.variant, b, I]), Xt = nt(function() {
758
+ }, [n?.props.elevation, n?.props.variant, b, I]), Xt = ot(function() {
759
759
  return function() {
760
760
  var p = {
761
761
  className: "lmnt-modal__button mdc-dialog__button",
762
- "data-mdc-dialog-action": At ? "" : "accept",
762
+ "data-mdc-dialog-action": Tt ? "" : "accept",
763
763
  elevation: u?.props.elevation !== "default" ? u?.props.elevation : "flat",
764
764
  variant: u?.props.variant || "filled"
765
765
  };
766
766
  return b === "primary" && (p["data-mdc-dialog-button-default"] = !0), I === "primary" && (p["data-mdc-dialog-initial-focus"] = !0), p;
767
767
  };
768
- }, [At, b, I, u?.props.elevation, u?.props.variant]);
768
+ }, [Tt, b, I, u?.props.elevation, u?.props.variant]);
769
769
  return /* @__PURE__ */ m.createElement("aside", te({
770
- ref: P,
771
- className: G("lmnt", "lmnt-modal", "mdc-dialog", Bt && "lmnt-modal--scrollable mdc-dialog--scrollable", W),
770
+ ref: H,
771
+ className: F("lmnt", "lmnt-modal", "mdc-dialog", Nt && "lmnt-modal--scrollable mdc-dialog--scrollable", W),
772
772
  role: "alertdialog"
773
773
  }, zt), /* @__PURE__ */ m.createElement("div", {
774
- className: G("lmnt-modal__container", "mdc-dialog__container", C === "fullscreen" && "mdc-dialog--fullscreen", C === "max" && "lmnt-modal__max", C === "xlarge" && "lmnt-modal__xl", C === "large" && "lmnt-modal__lg", C === "medium" && "lmnt-modal__md", C === "small" && "lmnt-modal__sm", (C === "mobile" || Q) && "lmnt-modal__mobile", C === "dialog" && "lmnt-modal__dialog", N && "lmnt-modal-no-actions")
774
+ className: F("lmnt-modal__container", "mdc-dialog__container", C === "fullscreen" && "mdc-dialog--fullscreen", C === "max" && "lmnt-modal__max", C === "xlarge" && "lmnt-modal__xl", C === "large" && "lmnt-modal__lg", C === "medium" && "lmnt-modal__md", C === "small" && "lmnt-modal__sm", (C === "mobile" || Q) && "lmnt-modal__mobile", C === "dialog" && "lmnt-modal__dialog", N && "lmnt-modal-no-actions")
775
775
  }, /* @__PURE__ */ m.createElement("div", {
776
776
  className: "lmnt-modal__surface mdc-dialog__surface"
777
777
  }, /* @__PURE__ */ m.createElement("header", {
778
- className: G("lmnt-modal__title", "mdc-dialog__title", (C === "dialog" || V) && "lmnt-modal_title-hide-close-icon", a && "lmnt-modal_title-actionsIcons", Bt && "lmnt-modal__title-scrollable", (V || C === "dialog" || N) && "lmnt-modal--no-close-icon")
779
- }, !V && C !== "dialog" && !N && /* @__PURE__ */ m.createElement(Ut, {
778
+ className: F("lmnt-modal__title", "mdc-dialog__title", (C === "dialog" || V) && "lmnt-modal_title-hide-close-icon", a && "lmnt-modal_title-actionsIcons", Nt && "lmnt-modal__title-scrollable", (V || C === "dialog" || N) && "lmnt-modal--no-close-icon")
779
+ }, !V && C !== "dialog" && !N && /* @__PURE__ */ m.createElement($t, {
780
780
  className: "mdc-icon-button material-icons mdc-dialog__close",
781
781
  "data-mdc-dialog-action": "close",
782
782
  icon: "clear",
783
783
  iconSource: Vt
784
- }), Dt && /* @__PURE__ */ m.createElement("div", null, Dt), st && /* @__PURE__ */ m.createElement("div", {
784
+ }), Ft && /* @__PURE__ */ m.createElement("div", null, Ft), ct && /* @__PURE__ */ m.createElement("div", {
785
785
  className: "lmnt-dialog__title-actions"
786
- }, st), h && /* @__PURE__ */ m.createElement("div", {
786
+ }, ct), g && /* @__PURE__ */ m.createElement("div", {
787
787
  className: "lmnt-badge--modal",
788
788
  style: {
789
789
  marginLeft: "0"
790
790
  }
791
- }, h)), (L || F) && /* @__PURE__ */ m.createElement("section", {
791
+ }, g)), (R || L) && /* @__PURE__ */ m.createElement("section", {
792
792
  className: "lmnt-modal__content mdc-dialog__content"
793
- }, L || F), Wt, (n || _ || R || B || u || w) && /* @__PURE__ */ m.createElement("footer", {
794
- className: G("lmnt-modal__actions", "mdc-dialog__actions", Q && "lmnt-dialog__actions__mobile", w && "lmnt-modal__actions--supplemental-btn", Q && z && "lmnt-modal_actions-mobile-stacked")
795
- }, !X && w && /* @__PURE__ */ m.createElement("div", {
793
+ }, R || L), Wt, (n || _ || w || B || u || k) && /* @__PURE__ */ m.createElement("footer", {
794
+ className: F("lmnt-modal__actions", "mdc-dialog__actions", Q && "lmnt-dialog__actions__mobile", k && "lmnt-modal__actions--supplemental-btn", Q && z && "lmnt-modal_actions-mobile-stacked")
795
+ }, !X && k && /* @__PURE__ */ m.createElement("div", {
796
796
  className: "lmnt-dialog__actions__supplemental"
797
- }, D(w, function() {
797
+ }, D(k, function() {
798
798
  var p = {};
799
799
  return b === "footerSupplemental" && (p["data-mdc-dialog-button-default"] = !0), I === "footerSupplemental" && (p["data-mdc-dialog-initial-focus"] = !0), p;
800
- })), !X && (n || R || u) && /* @__PURE__ */ m.createElement("div", {
800
+ })), !X && (n || w || u) && /* @__PURE__ */ m.createElement("div", {
801
801
  className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
802
- }, R && D(R, {
802
+ }, w && D(w, {
803
803
  variant: "text",
804
804
  className: "lmnt-modal__button mdc-dialog__button",
805
805
  "data-mdc-dialog-action": "close"
@@ -812,16 +812,17 @@ var f = Kt.strings, Ae = (
812
812
  className: "mdc-dialog__scrim"
813
813
  }));
814
814
  });
815
- ot.displayName = "Modal";
816
- ot.propTypes = Te;
817
- const Be = "_modal_1l955_1", Ne = "_gap_1l955_18", De = "_title_1l955_23", Fe = "_titleWithoutCloseIcon_1l955_36", Le = "_closeButton_1l955_40", Re = "_errorBanner_1l955_52", y = {
815
+ it.displayName = "Modal";
816
+ it.propTypes = Te;
817
+ const Be = "_modal_3lh36_1", Ne = "_gap_3lh36_18", De = "_title_3lh36_23", Fe = "_titleWithoutCloseIcon_3lh36_36", Le = "_closeButton_3lh36_40", Re = "_errorBanner_3lh36_52", we = "_footerLayoutFixes_3lh36_66", S = {
818
818
  modal: Be,
819
819
  gap: Ne,
820
820
  title: De,
821
821
  titleWithoutCloseIcon: Fe,
822
822
  closeButton: Le,
823
- errorBanner: Re
824
- }, Je = ({
823
+ errorBanner: Re,
824
+ footerLayoutFixes: we
825
+ }, Qe = ({
825
826
  onClose: o,
826
827
  title: e,
827
828
  headerActions: t,
@@ -829,37 +830,37 @@ const Be = "_modal_1l955_1", Ne = "_gap_1l955_18", De = "_title_1l955_23", Fe =
829
830
  hideCloseIcon: i,
830
831
  closeIcon: a = "close",
831
832
  leadingIcon: d,
832
- isOnline: h = !0,
833
+ isOnline: g = !0,
833
834
  offlineViewProps: O,
834
835
  children: _,
835
- errorBannerProps: { hasError: S, ...F } = { hasError: !1 },
836
- ...T
836
+ errorBannerProps: { hasError: y, ...L } = { hasError: !1 },
837
+ ...A
837
838
  }) => {
838
- const W = nt(() => {
839
+ const W = ot(() => {
839
840
  const E = {
840
841
  id: "base",
841
842
  action: /* @__PURE__ */ kt(
842
- U,
843
+ G,
843
844
  {
844
845
  primaryAlign: "center",
845
846
  secondaryAlign: "center",
846
- className: y.gap,
847
+ className: S.gap,
847
848
  children: [
848
- !i && /* @__PURE__ */ g(
849
- Ut,
849
+ !i && /* @__PURE__ */ h(
850
+ $t,
850
851
  {
851
852
  icon: a,
852
853
  onClick: () => o?.(),
853
854
  type: "button",
854
- className: y.closeButton
855
+ className: S.closeButton
855
856
  }
856
857
  ),
857
- d ? /* @__PURE__ */ g(fe, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ g(he, { icon: d }) }) : /* @__PURE__ */ g(wt, {}),
858
- /* @__PURE__ */ g(
858
+ d ? /* @__PURE__ */ h(fe, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ h(he, { icon: d }) }) : /* @__PURE__ */ h(Z, {}),
859
+ /* @__PURE__ */ h(
859
860
  pe,
860
861
  {
861
862
  level: 6,
862
- className: i && !d ? y.titleWithoutCloseIcon : "",
863
+ className: i && !d ? S.titleWithoutCloseIcon : "",
863
864
  children: e
864
865
  }
865
866
  )
@@ -870,29 +871,30 @@ const Be = "_modal_1l955_1", Ne = "_gap_1l955_18", De = "_title_1l955_23", Fe =
870
871
  };
871
872
  if (!t) return [E];
872
873
  if (!Array.isArray(t)) return [E, { id: "action", action: t }];
873
- const L = {
874
+ const R = {
874
875
  id: "action-group",
875
- action: /* @__PURE__ */ g(U, { className: y.gap, children: t }, "action-group")
876
+ action: /* @__PURE__ */ h(G, { className: S.gap, children: t }, "action-group")
876
877
  };
877
- return [E, L];
878
+ return [E, R];
878
879
  }, [t, i, a, d, o, e]);
879
- return /* @__PURE__ */ g(
880
- ot,
880
+ return /* @__PURE__ */ h(
881
+ it,
881
882
  {
882
- ...T,
883
+ ...A,
883
884
  "data-testid": "modal",
884
- className: `${y.modal} ${y.title} ${T.className ?? ""}`,
885
+ className: F(S.modal, S.title, S.footerLayoutFixes, A.className),
885
886
  hideCloseIcon: !0,
887
+ footerSupplemental: A.footerSupplemental ?? /* @__PURE__ */ h(Z, {}),
886
888
  actionButton: n,
887
- headerActions: /* @__PURE__ */ kt(U, { fullWidth: !0, gap: "none", direction: "vertical", children: [
888
- /* @__PURE__ */ g(U, { fullWidth: !0, primaryAlign: "space-between", secondaryAlign: "center", children: W.map((E) => /* @__PURE__ */ g(oe, { children: E.action }, E.id)) }),
889
- S && /* @__PURE__ */ g("div", { className: y.errorBanner, children: /* @__PURE__ */ g(_e, { ...F, isOpen: S }) })
889
+ headerActions: /* @__PURE__ */ kt(G, { fullWidth: !0, gap: "none", direction: "vertical", children: [
890
+ /* @__PURE__ */ h(G, { fullWidth: !0, primaryAlign: "space-between", secondaryAlign: "center", children: W.map((E) => /* @__PURE__ */ h(oe, { children: E.action }, E.id)) }),
891
+ y && /* @__PURE__ */ h("div", { className: S.errorBanner, children: /* @__PURE__ */ h(_e, { ...L, isOpen: y }) })
890
892
  ] }, "header-group"),
891
893
  preventClose: !0,
892
- children: h ? /* @__PURE__ */ g(wt, { children: _ }) : /* @__PURE__ */ g(ge, { ...O })
894
+ children: g ? /* @__PURE__ */ h(Z, { children: _ }) : /* @__PURE__ */ h(ge, { ...O })
893
895
  }
894
896
  );
895
897
  };
896
898
  export {
897
- Je as Modal
899
+ Qe as Modal
898
900
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortiview/shared-components",
3
- "version": "2.29.0",
3
+ "version": "2.30.0",
4
4
  "description": "This is a shared component library. It should be used in the HortiView platform and its modules.",
5
5
  "license": "GPL-3.0",
6
6
  "type": "module",
@@ -107,6 +107,8 @@ export type TableLayoutProps<T> = {
107
107
  /**
108
108
  * the elevation level of the table, used to set the shadow of the table
109
109
  * @default 1
110
+ *
111
+ * @deprecated Wrap the table in an <Elevation> component to use elevations shadows
110
112
  */
111
113
  tableElevationLevel?: number;
112
114
  /**
@@ -122,6 +124,36 @@ export type TableLayoutProps<T> = {
122
124
  * Props forwarded to <OfflineView /> when offline.
123
125
  */
124
126
  offlineViewProps?: Partial<OfflineViewProps>;
127
+ /**
128
+ * Specify which columns should be resizable by the user.
129
+ * @default false
130
+ */
131
+ resizableColumns?: (keyof T)[];
132
+ /**
133
+ * Enables sticky (pinned) first and/or last columns via CSS, using the Element column-level `fixed` flag.
134
+ * @default undefined (both off)
135
+ * @example stickyColumns={{ first: true, last: true }}
136
+ */
137
+ stickyColumns?: {
138
+ first?: boolean;
139
+ last?: boolean;
140
+ };
141
+ /**
142
+ * Determines the max-height of the table. Enables scrolling for the tables content if there isnt enough space.
143
+ * @default undefined
144
+ */
145
+ tableMaxHeight?: number;
146
+ /**
147
+ * Renders the table with no visible borders.
148
+ * @default false
149
+ */
150
+ noBorder?: boolean;
151
+ /**
152
+ * Indicates whether the option to select the number of rows per page should be disabled in a paginated table.
153
+ *
154
+ * @remarks Used for example when theres issues with overflowing due to the dropdown
155
+ */
156
+ disableRowsPerPageSelection?: boolean;
125
157
  };
126
158
  /**
127
159
  * Props for the CellTemplate component {@link CellTemplate}
@@ -177,18 +209,138 @@ export type CellTemplate<T> = {
177
209
  * ```
178
210
  */
179
211
  export type GenericColumn<T> = {
180
- id: keyof T;
181
- header: string;
212
+ /**
213
+ * Column content alignment.
214
+ */
215
+ align?: 'left' | 'right' | 'center';
216
+ /**
217
+ * the field name as defined in the data.
218
+ */
182
219
  accessor: keyof T;
183
- cellTemplate?: (props: CellTemplateProps<T>) => JSX.Element;
220
+ /**
221
+ * whether this column's value should be used as the title of the card in the card view.
222
+ */
223
+ asCardTitle?: boolean;
224
+ /**
225
+ * whether this column's value should be used as the subtitle of the card in the card view.
226
+ */
227
+ asCardSubtitle?: boolean;
228
+ /**
229
+ * Experimental. Assign a background color to a column. Ex: `rgba(0,0,0,0.3)`
230
+ * @deprecated in favor of cellProps
231
+ */
232
+ backgroundColor?: string;
233
+ /**
234
+ * Pass custom props directly to each TableCell within the column.
235
+ */
184
236
  cellProps?: {
185
237
  id?: string;
186
238
  width?: string | number;
187
239
  };
188
- asCardTitle?: boolean;
189
- asCardSubtitle?: boolean;
240
+ /**
241
+ * A function that can format the displayed value of a cell.
242
+ * @example
243
+ * ```jsx
244
+ * cellTemplate: (props: CellTemplateProps<GenericElement>) => {
245
+ * const {name} = props.row.original;
246
+ * return <LabelBadge label={name} />
247
+ * }
248
+ * ```
249
+ */
250
+ cellTemplate?: (props: CellTemplateProps<T>) => JSX.Element;
251
+ /**
252
+ * Used for grouping columns. See grouped columns in the react-table README.
253
+ */
254
+ columns?: GenericColumn<T>[];
255
+ /**
256
+ * Default sorting for a column on page load.
257
+ * Note: `id` is required for default sorting to work.
258
+ */
259
+ defaultSort?: 'asc' | 'desc';
260
+ /**
261
+ * If multiple columns are marked as `defaultSort`, this will set the order in which they will be applied.
262
+ */
263
+ defaultSortOrder?: number;
264
+ /**
265
+ * Prevents column from being resized.
266
+ */
267
+ disableResizing?: boolean;
268
+ /**
269
+ * Disable sorting for this column (when column sorting is enabled with the Table `sorting` prop).
270
+ */
271
+ disableSortBy?: boolean;
272
+ /**
273
+ * Add extra props, if needed.
274
+ * @example displayConfig: { country: 'en-US', currency: 'USD' }
275
+ */
276
+ displayConfig?: Record<string, unknown>;
277
+ /**
278
+ * A function that can format the displayed value.
279
+ * @deprecated see cellTemplate
280
+ */
281
+ displayTemplate?: (accessorValue: unknown, row: T, cellId: string) => unknown;
282
+ /**
283
+ * The display format to use.
284
+ */
285
+ displayType?: 'text' | 'date' | 'time' | 'datetime' | 'number' | 'currency' | 'expander' | 'checkbox' | 'switch' | 'custom';
286
+ /**
287
+ * Additional configuration for controls, if needed.
288
+ * @example editConfig: { options: [{ text: 'A', value: 'a' }] }
289
+ */
290
+ editConfig?: Record<string, unknown>;
291
+ /**
292
+ * Pin the column to the leading or trailing edge of the table.
293
+ * Note: Currently only supports one trailing column.
294
+ */
295
+ fixed?: 'leading' | 'trailing';
296
+ /**
297
+ * The column header content.
298
+ */
299
+ header: string;
300
+ /**
301
+ * Pass custom props directly to the TableHeaderCell for this column.
302
+ */
190
303
  headerCellProps?: {
191
304
  id?: string;
192
305
  width?: string | number;
193
306
  };
307
+ /**
308
+ * A function that can control the header rendering.
309
+ */
310
+ headerTemplate?: (value: unknown, rowData: T) => unknown;
311
+ /**
312
+ * A custom identifier for the column.
313
+ * Note: this is required to enable `defaultSort`.
314
+ */
315
+ id: keyof T;
316
+ /**
317
+ * Overrides the internal sorting direction state.
318
+ */
319
+ isSortedDesc?: boolean;
320
+ /**
321
+ * A custom click handler.
322
+ */
323
+ onClick?: (event: unknown, column: GenericColumn<T>) => void;
324
+ /**
325
+ * The initial sort direction for this column will be descending instead of ascending.
326
+ */
327
+ sortDescFirst?: boolean;
328
+ /**
329
+ * When using custom/controlled sorting `accessor` is not available to use, so we need a custom field
330
+ * to pass to a custom click handler to let us know what to sort on.
331
+ */
332
+ sortField?: string;
333
+ /**
334
+ * The actual sort direction will be inverted, but the UI will still display normally.
335
+ */
336
+ sortInverted?: boolean;
337
+ /**
338
+ * Override the default sort method.
339
+ */
340
+ sortType?: 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric' | ((rowA: T, rowB: T, columnId: string, desc: boolean) => number);
341
+ /**
342
+ * Specify a fixed width for the column. Specified in pixels - must be an integer.
343
+ * @example width: 150
344
+ */
345
+ width?: number;
194
346
  };
@@ -1 +0,0 @@
1
- ._topBar_wc5ga_1 [class*=lmnt-table__top-bar__title]{display:none}._filterBar_wc5ga_5{padding:1rem;width:inherit!important}._start_wc5ga_10{padding-top:0;padding-bottom:0}._emptyTable_wc5ga_15{height:16rem}[class*=mnt-pagination][class*=mdc-data-table__pagination]{border-top:1px solid var(--lmnt-theme-on-secondary-stroke)}._elevation_wc5ga_23{border-radius:.4rem;width:100%}._table_wc5ga_28,._table_wc5ga_28 [class*=mdc-data-table__table-container]{border-radius:.4rem}._table_wc5ga_28 *[id=actions]{width:44px;padding:0 2px;position:sticky;right:0;background-color:var(--lmnt-theme-background)}._table_wc5ga_28 tr:hover td[id=actions]{background-color:var(--table-bg-color-hover)}._noBorder_wc5ga_48{border:none}._fullWidth_wc5ga_52{width:100%}