@hortiview/shared-components 2.6.1 → 2.8.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,8 +1,8 @@
1
1
  import { jsxs as ft, jsx as C, Fragment as pt } from "react/jsx-runtime";
2
- import { G as z } from "../../index.es-CbBdaRO2.js";
2
+ import { G as j } from "../../index.es-CbBdaRO2.js";
3
3
  import { I as it } from "../../index.es-Kg9soDed.js";
4
4
  import { _ as ht, c as B, P as s } from "../../_setToString-Do1lSQTZ.js";
5
- import d, { forwardRef as gt, useRef as et, useImperativeHandle as _t, useState as nt, useEffect as E, useCallback as j, useMemo as Y, Fragment as Et } from "react";
5
+ import d, { forwardRef as gt, useRef as et, useImperativeHandle as _t, useState as nt, useEffect as E, useCallback as q, useMemo as J, Fragment as Et } from "react";
6
6
  import { i as Ct, c as b, a as St } from "../../index.es-DlzwTKbh.js";
7
7
  import { b as at, c as ot, d as vt } from "../../tslib.es6-BDCynO9F.js";
8
8
  import { M as yt, a as Ot } from "../../component-neHBNHRu.js";
@@ -74,7 +74,7 @@ function kt(i) {
74
74
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
75
75
  * THE SOFTWARE.
76
76
  */
77
- var q = "mdc-dom-focus-sentinel", Ht = (
77
+ var $ = "mdc-dom-focus-sentinel", Ht = (
78
78
  /** @class */
79
79
  function() {
80
80
  function i(e, t) {
@@ -86,7 +86,7 @@ var q = "mdc-dom-focus-sentinel", Ht = (
86
86
  throw new Error("FocusTrap: Element must have at least one focusable child.");
87
87
  this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.wrapTabFocus(this.root), this.options.skipInitialFocus || this.focusInitialElement(e, this.options.initialFocusEl);
88
88
  }, i.prototype.releaseFocus = function() {
89
- [].slice.call(this.root.querySelectorAll("." + q)).forEach(function(e) {
89
+ [].slice.call(this.root.querySelectorAll("." + $)).forEach(function(e) {
90
90
  e.parentElement.removeChild(e);
91
91
  }), !this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus && this.elFocusedBeforeTrapFocus.focus();
92
92
  }, i.prototype.wrapTabFocus = function(e) {
@@ -104,16 +104,16 @@ var q = "mdc-dom-focus-sentinel", Ht = (
104
104
  }, i.prototype.getFocusableElements = function(e) {
105
105
  var t = [].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button"));
106
106
  return t.filter(function(n) {
107
- var o = 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(q) && !o, f = !1;
107
+ var o = 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($) && !o, f = !1;
108
108
  if (a) {
109
- var h = getComputedStyle(n);
110
- f = h.display === "none" || h.visibility === "hidden";
109
+ var p = getComputedStyle(n);
110
+ f = p.display === "none" || p.visibility === "hidden";
111
111
  }
112
112
  return a && !f;
113
113
  });
114
114
  }, i.prototype.createSentinel = function() {
115
115
  var e = document.createElement("div");
116
- return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(q), e;
116
+ return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add($), e;
117
117
  }, i;
118
118
  }()
119
119
  );
@@ -172,7 +172,7 @@ var r = {
172
172
  // to prevent interactions with the content behind this scrim, and to capture
173
173
  // scrim clicks.
174
174
  SCRIM_HIDDEN: "mdc-dialog__scrim--hidden"
175
- }, v = {
175
+ }, y = {
176
176
  ACTION_ATTRIBUTE: "data-mdc-dialog-action",
177
177
  BUTTON_DEFAULT_ATTRIBUTE: "data-mdc-dialog-button-default",
178
178
  BUTTON_SELECTOR: ".mdc-dialog__button",
@@ -192,7 +192,7 @@ var r = {
192
192
  ".mdc-menu .mdc-deprecated-list-item"
193
193
  ].join(", "),
194
194
  SURFACE_SELECTOR: ".mdc-dialog__surface"
195
- }, $ = {
195
+ }, Y = {
196
196
  DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
197
197
  DIALOG_ANIMATION_OPEN_TIME_MS: 150
198
198
  };
@@ -228,7 +228,7 @@ var rt = (
228
228
  at(e, i);
229
229
  function e(t) {
230
230
  var n = i.call(this, ot(ot({}, e.defaultAdapter), t)) || this;
231
- return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = v.CLOSE_ACTION, n.scrimClickAction = v.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = v.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new Dt(), n.contentScrollHandler = function() {
231
+ return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = y.CLOSE_ACTION, n.scrimClickAction = y.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = y.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new Dt(), n.contentScrollHandler = function() {
232
232
  n.handleScrollEvent();
233
233
  }, n.windowResizeHandler = function() {
234
234
  n.layout();
@@ -244,13 +244,13 @@ var rt = (
244
244
  configurable: !0
245
245
  }), Object.defineProperty(e, "strings", {
246
246
  get: function() {
247
- return v;
247
+ return y;
248
248
  },
249
249
  enumerable: !1,
250
250
  configurable: !0
251
251
  }), Object.defineProperty(e, "numbers", {
252
252
  get: function() {
253
- return $;
253
+ return Y;
254
254
  },
255
255
  enumerable: !1,
256
256
  configurable: !0
@@ -320,19 +320,19 @@ var rt = (
320
320
  }), e.prototype.init = function() {
321
321
  this.adapter.hasClass(r.STACKED) && this.setAutoStackButtons(!1), this.isFullscreen = this.adapter.hasClass(r.FULLSCREEN);
322
322
  }, e.prototype.destroy = function() {
323
- this.dialogOpen && this.close(v.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);
323
+ this.dialogOpen && this.close(y.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);
324
324
  }, e.prototype.open = function(t) {
325
325
  var n = this;
326
326
  this.dialogOpen = !0, this.adapter.notifyOpening(), this.adapter.addClass(r.OPENING), this.isFullscreen && this.adapter.registerContentEventHandler("scroll", this.contentScrollHandler), t && t.isAboveFullscreenDialog && this.adapter.addClass(r.SCRIM_HIDDEN), this.adapter.registerWindowEventHandler("resize", this.windowResizeHandler), this.adapter.registerWindowEventHandler("orientationchange", this.windowOrientationChangeHandler), this.runNextAnimationFrame(function() {
327
327
  n.adapter.addClass(r.OPEN), n.adapter.addBodyClass(r.SCROLL_LOCK), n.layout(), n.animationTimer = setTimeout(function() {
328
328
  n.handleAnimationTimerEnd(), n.adapter.trapFocus(n.adapter.getInitialFocusEl()), n.adapter.notifyOpened();
329
- }, $.DIALOG_ANIMATION_OPEN_TIME_MS);
329
+ }, Y.DIALOG_ANIMATION_OPEN_TIME_MS);
330
330
  });
331
331
  }, e.prototype.close = function(t) {
332
332
  var n = this;
333
333
  t === void 0 && (t = ""), this.dialogOpen && (this.dialogOpen = !1, this.adapter.notifyClosing(t), this.adapter.addClass(r.CLOSING), this.adapter.removeClass(r.OPEN), this.adapter.removeBodyClass(r.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() {
334
334
  n.adapter.releaseFocus(), n.handleAnimationTimerEnd(), n.adapter.notifyClosed(t);
335
- }, $.DIALOG_ANIMATION_CLOSE_TIME_MS));
335
+ }, Y.DIALOG_ANIMATION_CLOSE_TIME_MS));
336
336
  }, e.prototype.showSurfaceScrim = function() {
337
337
  var t = this;
338
338
  this.adapter.addClass(r.SURFACE_SCRIM_SHOWING), this.runNextAnimationFrame(function() {
@@ -366,7 +366,7 @@ var rt = (
366
366
  t.layoutInternal();
367
367
  });
368
368
  }, e.prototype.handleClick = function(t) {
369
- var n = this.adapter.eventTargetMatches(t.target, v.SCRIM_SELECTOR);
369
+ var n = this.adapter.eventTargetMatches(t.target, y.SCRIM_SELECTOR);
370
370
  if (n && this.scrimClickAction !== "")
371
371
  this.close(this.scrimClickAction);
372
372
  else {
@@ -478,23 +478,23 @@ var u = rt.strings, Pt = (
478
478
  return new e(t);
479
479
  }, e.prototype.initialize = function(t) {
480
480
  var n, o;
481
- t === void 0 && (t = function(g, p) {
482
- return new Ht(g, p);
481
+ t === void 0 && (t = function(h, S) {
482
+ return new Ht(h, S);
483
483
  });
484
484
  var a = this.root.querySelector(u.CONTAINER_SELECTOR);
485
485
  if (!a)
486
486
  throw new Error("Dialog component requires a " + u.CONTAINER_SELECTOR + " container element");
487
487
  this.container = a, this.content = this.root.querySelector(u.CONTENT_SELECTOR), this.buttons = [].slice.call(this.root.querySelectorAll(u.BUTTON_SELECTOR)), this.defaultButton = this.root.querySelector("[" + u.BUTTON_DEFAULT_ATTRIBUTE + "]"), this.focusTrapFactory = t, this.buttonRipples = [];
488
488
  try {
489
- for (var f = vt(this.buttons), h = f.next(); !h.done; h = f.next()) {
490
- var S = h.value;
491
- this.buttonRipples.push(new Tt(S));
489
+ for (var f = vt(this.buttons), p = f.next(); !p.done; p = f.next()) {
490
+ var v = p.value;
491
+ this.buttonRipples.push(new Tt(v));
492
492
  }
493
- } catch (g) {
494
- n = { error: g };
493
+ } catch (h) {
494
+ n = { error: h };
495
495
  } finally {
496
496
  try {
497
- h && !h.done && (o = f.return) && o.call(f);
497
+ p && !p.done && (o = f.return) && o.call(f);
498
498
  } finally {
499
499
  if (n) throw n.error;
500
500
  }
@@ -796,38 +796,38 @@ const Ut = {
796
796
  badge: o,
797
797
  backButton: a,
798
798
  children: f,
799
- className: h,
800
- content: S,
801
- defaultButton: g,
802
- dismissiveButton: p,
803
- footerSupplemental: y,
804
- headerActions: J,
805
- hideCloseIcon: H,
799
+ className: p,
800
+ content: v,
801
+ defaultButton: h,
802
+ dismissiveButton: S,
803
+ footerSupplemental: g,
804
+ headerActions: H,
805
+ hideCloseIcon: P,
806
806
  indicator: st,
807
807
  initialFocus: O,
808
- mobileStackedButtons: P,
808
+ mobileStackedButtons: U,
809
809
  modalSize: _,
810
810
  nextButton: T,
811
811
  noActions: A,
812
- onClose: U,
813
- onClosed: x,
812
+ onClose: x,
813
+ onClosed: G,
814
814
  onOpen: D,
815
815
  onOpened: I,
816
816
  open: Q,
817
- preventClose: G,
817
+ preventClose: K,
818
818
  preventPrimaryAccept: X,
819
819
  primaryButton: c,
820
- returnFocusSelector: K,
820
+ returnFocusSelector: W,
821
821
  scrollable: Z,
822
822
  title: tt,
823
823
  ...lt
824
824
  } = i, N = et(), l = et();
825
825
  _t(e, () => N.current, []);
826
- const [W, ct] = nt(), [V, dt] = nt(() => T || a);
826
+ const [V, ct] = nt(), [z, dt] = nt(() => T || a);
827
827
  E(() => {
828
828
  dt(T || a);
829
829
  }, [T, a]);
830
- const L = j(() => {
830
+ const L = q(() => {
831
831
  ct(window.innerWidth <= 600);
832
832
  }, []);
833
833
  E(() => (L(), window.addEventListener("resize", L), () => {
@@ -835,18 +835,18 @@ const Ut = {
835
835
  }), [L]), E(() => (l.current = Pt.attachTo(N.current), () => {
836
836
  l.current.destroy();
837
837
  }), [l, N]), E(() => {
838
- l.current.foundation.setAutoStackButtons(P);
839
- }, [P]), E(() => {
838
+ l.current.foundation.setAutoStackButtons(U);
839
+ }, [U]), E(() => {
840
840
  A && (l.current.foundation.adapter.trapFocus = () => {
841
841
  });
842
842
  }, [A]), E(() => {
843
- l.current.scrimClickAction = G ? "" : "close", l.current.escapeKeyAction = G ? "" : "close";
844
- }, [G]);
845
- const F = j((m) => {
846
- U && U(m);
847
- }, [U]), R = j((m) => {
848
- K && Ct(K), x && x(m);
849
- }, [K, x]);
843
+ l.current.scrimClickAction = K ? "" : "close", l.current.escapeKeyAction = K ? "" : "close";
844
+ }, [K]);
845
+ const F = q((m) => {
846
+ x && x(m);
847
+ }, [x]), R = q((m) => {
848
+ W && Ct(W), G && G(m);
849
+ }, [W, G]);
850
850
  E(() => (l.current.unlisten("MDCDialog: opening", D), l.current.listen("MDCDialog: opening", D), () => {
851
851
  l.current.unlisten("MDCDialog: opening", D);
852
852
  }), [l, D]), E(() => (l.current.unlisten("MDCDialog:opened", I), l.current.listen("MDCDialog:opened", I), () => {
@@ -858,59 +858,59 @@ const Ut = {
858
858
  }), [l, R]), E(() => {
859
859
  Q ? l.current.open() : l.current.close();
860
860
  }, [l, Q]);
861
- const ut = Y(() => () => {
861
+ const ut = J(() => () => {
862
862
  const m = {
863
863
  className: "lmnt-modal__button mdc-dialog__button",
864
864
  elevation: t?.props.elevation !== "default" ? t?.props.elevation : "flat",
865
865
  variant: t?.props.variant || "filled"
866
866
  };
867
- return g === "action" && (m["data-mdc-dialog-button-default"] = !0), O === "action" && (m["data-mdc-dialog-initial-focus"] = !0), m;
868
- }, [t?.props.elevation, t?.props.variant, g, O]), mt = Y(() => () => {
867
+ return h === "action" && (m["data-mdc-dialog-button-default"] = !0), O === "action" && (m["data-mdc-dialog-initial-focus"] = !0), m;
868
+ }, [t?.props.elevation, t?.props.variant, h, O]), mt = J(() => () => {
869
869
  const m = {
870
870
  className: "lmnt-modal__button mdc-dialog__button",
871
871
  "data-mdc-dialog-action": X ? "" : "accept",
872
872
  elevation: c?.props.elevation !== "default" ? c?.props.elevation : "flat",
873
873
  variant: c?.props.variant || "filled"
874
874
  };
875
- return g === "primary" && (m["data-mdc-dialog-button-default"] = !0), O === "primary" && (m["data-mdc-dialog-initial-focus"] = !0), m;
876
- }, [X, g, O, c?.props.elevation, c?.props.variant]);
875
+ return h === "primary" && (m["data-mdc-dialog-button-default"] = !0), O === "primary" && (m["data-mdc-dialog-initial-focus"] = !0), m;
876
+ }, [X, h, O, c?.props.elevation, c?.props.variant]);
877
877
  return /* @__PURE__ */ d.createElement("aside", ht({
878
878
  ref: N,
879
- className: B("lmnt", "lmnt-modal", "mdc-dialog", Z && "lmnt-modal--scrollable mdc-dialog--scrollable", h),
879
+ className: B("lmnt", "lmnt-modal", "mdc-dialog", Z && "lmnt-modal--scrollable mdc-dialog--scrollable", p),
880
880
  role: "alertdialog"
881
881
  }, lt), /* @__PURE__ */ d.createElement("div", {
882
- className: B("lmnt-modal__container", "mdc-dialog__container", _ === "fullscreen" && "mdc-dialog--fullscreen", _ === "max" && "lmnt-modal__max", _ === "xlarge" && "lmnt-modal__xl", _ === "large" && "lmnt-modal__lg", _ === "medium" && "lmnt-modal__md", _ === "small" && "lmnt-modal__sm", (_ === "mobile" || W) && "lmnt-modal__mobile", _ === "dialog" && "lmnt-modal__dialog", A && "lmnt-modal-no-actions")
882
+ className: B("lmnt-modal__container", "mdc-dialog__container", _ === "fullscreen" && "mdc-dialog--fullscreen", _ === "max" && "lmnt-modal__max", _ === "xlarge" && "lmnt-modal__xl", _ === "large" && "lmnt-modal__lg", _ === "medium" && "lmnt-modal__md", _ === "small" && "lmnt-modal__sm", (_ === "mobile" || V) && "lmnt-modal__mobile", _ === "dialog" && "lmnt-modal__dialog", A && "lmnt-modal-no-actions")
883
883
  }, /* @__PURE__ */ d.createElement("div", {
884
884
  className: "lmnt-modal__surface mdc-dialog__surface"
885
885
  }, /* @__PURE__ */ d.createElement("header", {
886
- className: B("lmnt-modal__title", "mdc-dialog__title", (_ === "dialog" || H) && "lmnt-modal_title-hide-close-icon", n && "lmnt-modal_title-actionsIcons", Z && "lmnt-modal__title-scrollable", (H || _ === "dialog" || A) && "lmnt-modal--no-close-icon")
887
- }, !H && _ !== "dialog" && !A && /* @__PURE__ */ d.createElement(it, {
886
+ className: B("lmnt-modal__title", "mdc-dialog__title", (_ === "dialog" || P) && "lmnt-modal_title-hide-close-icon", n && "lmnt-modal_title-actionsIcons", Z && "lmnt-modal__title-scrollable", (P || _ === "dialog" || A) && "lmnt-modal--no-close-icon")
887
+ }, !P && _ !== "dialog" && !A && /* @__PURE__ */ d.createElement(it, {
888
888
  className: "mdc-icon-button material-icons mdc-dialog__close",
889
889
  "data-mdc-dialog-action": "close",
890
890
  icon: "clear"
891
- }), tt && /* @__PURE__ */ d.createElement("div", null, tt), J && /* @__PURE__ */ d.createElement("div", {
891
+ }), tt && /* @__PURE__ */ d.createElement("div", null, tt), H && /* @__PURE__ */ d.createElement("div", {
892
892
  className: "lmnt-dialog__title-actions"
893
- }, J), o && /* @__PURE__ */ d.createElement("div", {
893
+ }, H), o && /* @__PURE__ */ d.createElement("div", {
894
894
  className: "lmnt-badge--modal",
895
895
  style: {
896
896
  marginLeft: "0"
897
897
  }
898
- }, o)), (S || f) && /* @__PURE__ */ d.createElement("section", {
898
+ }, o)), (v || f) && /* @__PURE__ */ d.createElement("section", {
899
899
  className: "lmnt-modal__content mdc-dialog__content"
900
- }, S || f), st, (t || a || p || T || c || y) && /* @__PURE__ */ d.createElement("footer", {
901
- className: B("lmnt-modal__actions", "mdc-dialog__actions", W && "lmnt-dialog__actions__mobile", y && "lmnt-modal__actions--supplemental-btn", W && P && "lmnt-modal_actions-mobile-stacked")
902
- }, !V && y && /* @__PURE__ */ d.createElement("div", {
900
+ }, v || f), st, (t || a || S || T || c || g) && /* @__PURE__ */ d.createElement("footer", {
901
+ className: B("lmnt-modal__actions", "mdc-dialog__actions", V && "lmnt-dialog__actions__mobile", g && "lmnt-modal__actions--supplemental-btn", V && U && "lmnt-modal_actions-mobile-stacked")
902
+ }, !z && g && /* @__PURE__ */ d.createElement("div", {
903
903
  className: "lmnt-dialog__actions__supplemental"
904
- }, b(y, () => {
904
+ }, b(g, () => {
905
905
  const m = {};
906
- return g === "footerSupplemental" && (m["data-mdc-dialog-button-default"] = !0), O === "footerSupplemental" && (m["data-mdc-dialog-initial-focus"] = !0), m;
907
- })), !V && (t || p || c) && /* @__PURE__ */ d.createElement("div", {
906
+ return h === "footerSupplemental" && (m["data-mdc-dialog-button-default"] = !0), O === "footerSupplemental" && (m["data-mdc-dialog-initial-focus"] = !0), m;
907
+ })), !z && (t || S || c) && /* @__PURE__ */ d.createElement("div", {
908
908
  className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
909
- }, p && b(p, {
909
+ }, S && b(S, {
910
910
  variant: "text",
911
911
  className: "lmnt-modal__button mdc-dialog__button",
912
912
  "data-mdc-dialog-action": "close"
913
- }), t && !c && b(t, ut), c && b(c, mt)), V && /* @__PURE__ */ d.createElement("div", {
913
+ }), t && !c && b(t, ut), c && b(c, mt)), z && /* @__PURE__ */ d.createElement("div", {
914
914
  className: "lmnt-modal_actions_button lmnt-dialog__actions__directional"
915
915
  }, /* @__PURE__ */ d.createElement("div", null, St(a, "lmnt-modal__button")), /* @__PURE__ */ d.createElement("div", null, b(T, {
916
916
  className: "lmnt-modal__button",
@@ -931,18 +931,19 @@ const Gt = "_modal_fr8bw_1", Kt = "_title_fr8bw_6", Wt = "_titleWithoutCloseIcon
931
931
  onClose: i,
932
932
  title: e,
933
933
  headerActions: t,
934
- hideCloseIcon: n,
935
- leadingIcon: o,
936
- isOnline: a = !0,
937
- offlineViewProps: f,
938
- children: h,
939
- ...S
934
+ actionButton: n,
935
+ hideCloseIcon: o,
936
+ leadingIcon: a,
937
+ isOnline: f = !0,
938
+ offlineViewProps: p,
939
+ children: v,
940
+ ...h
940
941
  }) => {
941
- const g = Y(() => {
942
- const p = {
942
+ const S = J(() => {
943
+ const g = {
943
944
  id: "base",
944
- action: /* @__PURE__ */ ft(z, { primaryAlign: "center", secondaryAlign: "center", children: [
945
- !n && /* @__PURE__ */ C(
945
+ action: /* @__PURE__ */ ft(j, { primaryAlign: "center", secondaryAlign: "center", children: [
946
+ !o && /* @__PURE__ */ C(
946
947
  it,
947
948
  {
948
949
  icon: "close",
@@ -951,29 +952,30 @@ const Gt = "_modal_fr8bw_1", Kt = "_title_fr8bw_6", Wt = "_titleWithoutCloseIcon
951
952
  className: w.closeButton
952
953
  }
953
954
  ),
954
- o ? /* @__PURE__ */ C(It, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ C(Lt, { icon: o }) }) : /* @__PURE__ */ C(pt, {}),
955
+ a ? /* @__PURE__ */ C(It, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ C(Lt, { icon: a }) }) : /* @__PURE__ */ C(pt, {}),
955
956
  /* @__PURE__ */ C(
956
957
  Nt,
957
958
  {
958
959
  level: 6,
959
- className: n && !o ? w.titleWithoutCloseIcon : "",
960
+ className: o && !a ? w.titleWithoutCloseIcon : "",
960
961
  children: e
961
962
  }
962
963
  )
963
964
  ] }, "base-group")
964
965
  };
965
- return t ? Array.isArray(t) ? [p, { id: "action-group", action: /* @__PURE__ */ C(z, { children: t }, "action-group") }] : [p, { id: "action", action: t }] : [p];
966
- }, [t, n, o, i, e]);
966
+ return t ? Array.isArray(t) ? [g, { id: "action-group", action: /* @__PURE__ */ C(j, { children: t }, "action-group") }] : [g, { id: "action", action: t }] : [g];
967
+ }, [t, o, a, i, e]);
967
968
  return /* @__PURE__ */ C(
968
969
  k,
969
970
  {
970
- ...S,
971
+ ...h,
971
972
  "data-testid": "modal",
972
- className: `${w.modal} ${w.title} ${S.className ?? ""}`,
973
+ className: `${w.modal} ${w.title} ${h.className ?? ""}`,
973
974
  hideCloseIcon: !0,
974
- headerActions: /* @__PURE__ */ C(z, { primaryAlign: "space-between", secondaryAlign: "center", children: g.map((p) => /* @__PURE__ */ C(Et, { children: p.action }, p.id)) }, "header-group"),
975
+ actionButton: n,
976
+ headerActions: /* @__PURE__ */ C(j, { primaryAlign: "space-between", secondaryAlign: "center", children: S.map((g) => /* @__PURE__ */ C(Et, { children: g.action }, g.id)) }, "header-group"),
975
977
  preventClose: !0,
976
- children: a ? h : /* @__PURE__ */ C(Ft, { ...f })
978
+ children: f ? v : /* @__PURE__ */ C(Ft, { ...p })
977
979
  }
978
980
  );
979
981
  };
@@ -11,7 +11,8 @@ import "../../get-B8c-T4F8.js";
11
11
  import "../../omit-1Eom1PmQ.js";
12
12
  import "../../isArray-Dub1wGJM.js";
13
13
  import "../../isString-BW9UHONv.js";
14
- const x = ({ children: o }) => {
14
+ import "../../types/Time.js";
15
+ const j = ({ children: o }) => {
15
16
  const { isDesktop: t } = m();
16
17
  return /* @__PURE__ */ i(
17
18
  r,
@@ -24,5 +25,5 @@ const x = ({ children: o }) => {
24
25
  );
25
26
  };
26
27
  export {
27
- x as ModulePadding
28
+ j as ModulePadding
28
29
  };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A form component that prevents accidental submission when pressing Enter in input fields.
3
+ * It handles the 'keydown' event and intercepts the Enter key press.
4
+ * If the focused element is a button, submit button or text area, it allows the default behavior.
5
+ * Otherwise, it prevents the default action to avoid unintended submissions.
6
+ *
7
+ * @param children - The form children elements.
8
+ * @param props - Additional form props.
9
+ * @returns JSX.Element
10
+ */
11
+ export declare const SafeForm: ({ children, ...props }: JSX.IntrinsicElements["form"]) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const a = ({ children: t, ...r }) => /* @__PURE__ */ e("form", { onKeyDown: n, ...r, children: t }), n = async (t) => {
3
+ if (t.key !== "Enter") return;
4
+ const r = t.target;
5
+ r?.type !== "submit" && r?.type !== "button" && r?.type !== "textarea" && (t.preventDefault(), t.stopPropagation());
6
+ };
7
+ export {
8
+ a as SafeForm
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,91 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { a as u, s as i, f as r } from "../../react.esm-CX1WJ2Pp.js";
3
+ import { u as y } from "../../index-I7uTh4Tr.js";
4
+ import { SafeForm as p } from "./SafeForm.js";
5
+ import { d as b, t as c, g as s, v as l } from "../../vi.CjhMlMwf-CKxPQtd6.js";
6
+ b("SafeForm", () => {
7
+ c("renders form with children", () => {
8
+ u(
9
+ /* @__PURE__ */ a(p, { children: [
10
+ /* @__PURE__ */ t("input", { "data-testid": "test-input", type: "text" }),
11
+ /* @__PURE__ */ t("button", { "data-testid": "submit-button", type: "submit", children: "Submit" })
12
+ ] })
13
+ ), s(i.getByTestId("test-input")).toBeInTheDocument(), s(i.getByTestId("submit-button")).toBeInTheDocument();
14
+ }), c("prevents Enter key default behavior on text inputs", async () => {
15
+ const e = y.setup();
16
+ u(
17
+ /* @__PURE__ */ a(p, { children: [
18
+ /* @__PURE__ */ t("input", { "data-testid": "text-input", type: "text" }),
19
+ /* @__PURE__ */ t("button", { "data-testid": "submit-button", type: "submit", children: "Submit" })
20
+ ] })
21
+ );
22
+ const n = i.getByTestId("text-input");
23
+ await e.click(n);
24
+ const o = r.keyDown(n, { key: "Enter" });
25
+ s(o).toBe(!1);
26
+ }), c("allows Enter key press on submit button (does not prevent default)", async () => {
27
+ u(
28
+ /* @__PURE__ */ a(p, { children: [
29
+ /* @__PURE__ */ t("input", { type: "text" }),
30
+ /* @__PURE__ */ t("button", { "data-testid": "submit-button", type: "submit", children: "Submit" })
31
+ ] })
32
+ );
33
+ const e = i.getByTestId("submit-button");
34
+ e.focus();
35
+ const n = r.keyDown(e, { key: "Enter" });
36
+ s(n).toBe(!0);
37
+ }), c("allows Enter key press on regular button (does not prevent default)", async () => {
38
+ const e = l.fn();
39
+ u(
40
+ /* @__PURE__ */ a(p, { children: [
41
+ /* @__PURE__ */ t("input", { type: "text" }),
42
+ /* @__PURE__ */ t("button", { "data-testid": "cancel-button", type: "button", onClick: e, children: "Cancel" })
43
+ ] })
44
+ );
45
+ const n = i.getByTestId("cancel-button");
46
+ n.focus();
47
+ const o = r.keyDown(n, { key: "Enter" });
48
+ s(o).toBe(!0);
49
+ }), c("allows Enter key press on textarea (does not prevent default)", async () => {
50
+ u(
51
+ /* @__PURE__ */ a(p, { children: [
52
+ /* @__PURE__ */ t("input", { type: "text" }),
53
+ /* @__PURE__ */ t("textarea", { "data-testid": "textarea" }),
54
+ /* @__PURE__ */ t("button", { type: "submit", children: "Submit" })
55
+ ] })
56
+ );
57
+ const e = i.getByTestId("textarea");
58
+ e.focus();
59
+ const n = r.keyDown(e, { key: "Enter" });
60
+ s(n).toBe(!0);
61
+ }), c("does not interfere with other key presses", async () => {
62
+ const e = y.setup();
63
+ u(
64
+ /* @__PURE__ */ a(p, { children: [
65
+ /* @__PURE__ */ t("input", { "data-testid": "text-input", type: "text" }),
66
+ /* @__PURE__ */ t("button", { type: "submit", children: "Submit" })
67
+ ] })
68
+ );
69
+ const n = i.getByTestId("text-input");
70
+ await e.click(n), await e.keyboard("a"), await e.keyboard("{Tab}"), await e.keyboard("{Escape}"), s(n).toHaveValue("a");
71
+ const o = r.keyDown(n, { key: "Tab" }), d = r.keyDown(n, { key: "Escape" });
72
+ s(o).toBe(!0), s(d).toBe(!0);
73
+ }), c("prevents Enter key on various input types", async () => {
74
+ u(
75
+ /* @__PURE__ */ a(p, { children: [
76
+ /* @__PURE__ */ t("input", { "data-testid": "input1", type: "text" }),
77
+ /* @__PURE__ */ t("input", { "data-testid": "input2", type: "email" }),
78
+ /* @__PURE__ */ t("input", { "data-testid": "input3", type: "password" }),
79
+ /* @__PURE__ */ t("input", { "data-testid": "input4", type: "number" }),
80
+ /* @__PURE__ */ t("button", { type: "submit", children: "Submit" })
81
+ ] })
82
+ );
83
+ const e = ["input1", "input2", "input3", "input4"];
84
+ for (const n of e) {
85
+ const o = i.getByTestId(n);
86
+ o.focus();
87
+ const d = r.keyDown(o, { key: "Enter" });
88
+ s(d).toBe(!1);
89
+ }
90
+ });
91
+ });
@@ -1,36 +1,37 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import { I as i } from "../../index.es-Kg9soDed.js";
3
3
  import { T as l } from "../../index.es-CUuzYysw.js";
4
4
  import '../../assets/SearchBar.css';const u = "_searchbar_gnvwc_1", b = {
5
5
  searchbar: u
6
- }, p = ({
7
- className: o = "",
6
+ }, f = ({
7
+ className: r = "",
8
8
  dense: n = !1,
9
- searchTerm: a,
10
- setSearchTerm: t,
11
- placeholder: s,
12
- fullWidth: e = !0
13
- }) => /* @__PURE__ */ r(
9
+ searchTerm: t,
10
+ setSearchTerm: a,
11
+ placeholder: e,
12
+ fullWidth: s = !0
13
+ }) => /* @__PURE__ */ o(
14
14
  l,
15
15
  {
16
16
  "data-testid": "search-bar-input",
17
- className: `${o ?? ""} ${b.searchbar}`,
17
+ className: `${r ?? ""} ${b.searchbar}`,
18
18
  dense: n,
19
19
  variant: "outlined",
20
- placeholder: s,
21
- value: a,
22
- onChange: (c) => t(c.target.value),
23
- fullWidth: e,
24
- trailingIcon: /* @__PURE__ */ r(
20
+ placeholder: e,
21
+ value: t,
22
+ onChange: (c) => a(c.target.value),
23
+ fullWidth: s,
24
+ trailingIcon: /* @__PURE__ */ o(
25
25
  i,
26
26
  {
27
27
  "data-testid": "search-bar-icon-button",
28
- icon: a ? "close" : "search",
29
- onClick: () => a ? t("") : void 0
28
+ icon: t ? "close" : "search",
29
+ onClick: () => t ? a("") : void 0,
30
+ type: "button"
30
31
  }
31
32
  )
32
33
  }
33
34
  );
34
35
  export {
35
- p as SearchBar
36
+ f as SearchBar
36
37
  };
package/dist/main.d.ts CHANGED
@@ -39,10 +39,11 @@ export { FormSelect } from './components/FormComponents/FormSelect/FormSelect';
39
39
  export { FormSlider } from './components/FormComponents/FormSlider/FormSlider';
40
40
  export { FormText } from './components/FormComponents/FormText/FormText';
41
41
  export { FormToggle } from './components/FormComponents/FormToggle/FormToggle';
42
+ export { SafeForm } from './components/SafeForm/SafeForm';
42
43
  export { AvailableCustomIcons } from './enums/AvailableCustomIcons';
43
44
  export { ThemeColor } from './enums/ThemeColor';
44
45
  export { useBreakpoints } from './hooks/useBreakpoints';
45
- export { capitalizeFirstLetters, getNumberAsLocaleString, trimLeadingAndTrailingSpaces, } from './services/UtilService';
46
+ export { capitalizeFirstLetters, getFormattedDateTime, getNumberAsLocaleString, trimLeadingAndTrailingSpaces, } from './services/UtilService';
46
47
  export type { ActionProps } from './components/ContextMenu/ContextMenu';
47
48
  export type { FormSelectOption, FormSelectProps, } from './components/FormComponents/FormSelect/FormSelect';
48
49
  export type { FormTextProps } from './components/FormComponents/FormText/FormText';
@@ -54,5 +55,6 @@ export type { FilterData, FilterOption, FilterSelection } from './types/Filter';
54
55
  export type { CellTemplate, CellTemplateProps, TableLayoutProps } from './types/GenericTable';
55
56
  export type { HashTab } from './types/HashTab';
56
57
  export type { BaseListElement, ListElement } from './types/ListElement';
58
+ export { DATE_FORMAT, DATE_TIME_FORMAT, TIME_FORMAT } from './types/Time';
57
59
  export { AVAILABLE_COUNTRY_KEYS, AVAILABLE_LOCALES, ENGLISH_LANGUAGE_ID, GERMAN_LANGUAGE_ID, LANGUAGE_CODES_MAPPER, LANGUAGE_ID_MAPPER, SPANISH_LANGUAGE_ID, TURKISH_LANGUAGE_ID, } from './types/Languages';
58
60
  export type { AVAILABLE_LANGUAGE_CODES, LANGUAGE_COUNTRY_CODES } from './types/Languages';