@hortiview/shared-components 2.21.0 → 2.22.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.
- package/CHANGELOG.md +17 -0
- package/README.md +26 -0
- package/dist/assets/ErrorBanner.css +1 -0
- package/dist/assets/Modal.css +1 -1
- package/dist/components/ErrorBanner/ErrorBanner.d.ts +25 -0
- package/dist/components/ErrorBanner/ErrorBanner.js +70 -0
- package/dist/components/Iconify/Iconify.js +18 -17
- package/dist/components/Modal/Modal.d.ts +7 -1
- package/dist/components/Modal/Modal.js +162 -156
- package/dist/enums/AvailableCustomIcons.d.ts +21 -20
- package/dist/enums/AvailableCustomIcons.js +1 -1
- package/dist/hooks/useContainerWidth.d.ts +15 -0
- package/dist/hooks/useContainerWidth.js +17 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.js +109 -105
- package/package.json +1 -1
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { G as
|
|
3
|
-
import { I as
|
|
4
|
-
import { _ as Qt, a as Xt, c as
|
|
5
|
-
import { _ as
|
|
6
|
-
import m, { forwardRef as Zt, useRef as
|
|
7
|
-
import { w as
|
|
8
|
-
import { b as
|
|
1
|
+
import { jsx as g, jsxs as Rt, Fragment as wt } from "react/jsx-runtime";
|
|
2
|
+
import { G as X } from "../../index.es-Z0aF-7Cn.js";
|
|
3
|
+
import { I as $t } from "../../index.es-CkB4776y.js";
|
|
4
|
+
import { _ as Qt, a as Xt, c as U, P as l } from "../../index-Df2FYN-K.js";
|
|
5
|
+
import { _ as kt } from "../../slicedToArray-DC6VAZtW.js";
|
|
6
|
+
import m, { forwardRef as Zt, useRef as Mt, useImperativeHandle as te, useState as Pt, useEffect as E, useCallback as Z, useMemo as nt, Fragment as ee } from "react";
|
|
7
|
+
import { w as Ht, r as ne, c as D, a as oe } from "../../index.es-C6I3L4U4.js";
|
|
8
|
+
import { b as Ut, c as xt, d as ie } from "../../tslib.es6-BDCynO9F.js";
|
|
9
9
|
import { M as ae, a as re } from "../../component-By6nyiBU.js";
|
|
10
10
|
import { M as se, c as le, m as ce } from "../../component-DYpB_4EP.js";
|
|
11
|
-
import { A as
|
|
12
|
-
import { P as
|
|
11
|
+
import { A as de } from "../../animationframe-CqXArbwZ.js";
|
|
12
|
+
import { P as ue } from "../../index.es-DgncYOqO.js";
|
|
13
13
|
import { b as me } from "../../index.es-DUrjyxNI.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
14
|
+
import { ErrorBanner as fe } from "../ErrorBanner/ErrorBanner.js";
|
|
15
|
+
import { Iconify as pe } from "../Iconify/Iconify.js";
|
|
16
|
+
import { OfflineView as he } from "../OfflineView/OfflineView.js";
|
|
17
|
+
import '../../assets/Modal.css';function ge(o, e, t) {
|
|
17
18
|
return e(o, { initialFocusEl: t });
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function _e(o) {
|
|
20
21
|
return o ? o.scrollHeight > o.offsetHeight : !1;
|
|
21
22
|
}
|
|
22
23
|
function Ce(o) {
|
|
23
24
|
return o ? o.scrollTop === 0 : !1;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function Ee(o) {
|
|
26
27
|
return o ? Math.ceil(o.scrollHeight - o.scrollTop) === o.clientHeight : !1;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function ve(o) {
|
|
29
30
|
var e = /* @__PURE__ */ new Set();
|
|
30
31
|
return [].forEach.call(o, function(t) {
|
|
31
32
|
return e.add(t.offsetTop);
|
|
32
33
|
}), e.size > 1;
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
+
var tt = "mdc-dom-focus-sentinel", Se = (
|
|
35
36
|
/** @class */
|
|
36
37
|
(function() {
|
|
37
38
|
function o(e, t) {
|
|
@@ -43,7 +44,7 @@ var X = "mdc-dom-focus-sentinel", ve = (
|
|
|
43
44
|
throw new Error("FocusTrap: Element must have at least one focusable child.");
|
|
44
45
|
this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.wrapTabFocus(this.root), this.options.skipInitialFocus || this.focusInitialElement(e, this.options.initialFocusEl);
|
|
45
46
|
}, o.prototype.releaseFocus = function() {
|
|
46
|
-
[].slice.call(this.root.querySelectorAll("." +
|
|
47
|
+
[].slice.call(this.root.querySelectorAll("." + tt)).forEach(function(e) {
|
|
47
48
|
e.parentElement.removeChild(e);
|
|
48
49
|
}), !this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus && this.elFocusedBeforeTrapFocus.focus();
|
|
49
50
|
}, o.prototype.wrapTabFocus = function(e) {
|
|
@@ -61,16 +62,16 @@ var X = "mdc-dom-focus-sentinel", ve = (
|
|
|
61
62
|
}, o.prototype.getFocusableElements = function(e) {
|
|
62
63
|
var t = [].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button"));
|
|
63
64
|
return t.filter(function(n) {
|
|
64
|
-
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(
|
|
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, u = !1;
|
|
65
66
|
if (a) {
|
|
66
67
|
var h = getComputedStyle(n);
|
|
67
|
-
|
|
68
|
+
u = h.display === "none" || h.visibility === "hidden";
|
|
68
69
|
}
|
|
69
|
-
return a && !
|
|
70
|
+
return a && !u;
|
|
70
71
|
});
|
|
71
72
|
}, o.prototype.createSentinel = function() {
|
|
72
73
|
var e = document.createElement("div");
|
|
73
|
-
return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(
|
|
74
|
+
return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(tt), e;
|
|
74
75
|
}, o;
|
|
75
76
|
})()
|
|
76
77
|
);
|
|
@@ -107,7 +108,7 @@ var s = {
|
|
|
107
108
|
// to prevent interactions with the content behind this scrim, and to capture
|
|
108
109
|
// scrim clicks.
|
|
109
110
|
SCRIM_HIDDEN: "mdc-dialog__scrim--hidden"
|
|
110
|
-
},
|
|
111
|
+
}, A = {
|
|
111
112
|
ACTION_ATTRIBUTE: "data-mdc-dialog-action",
|
|
112
113
|
BUTTON_DEFAULT_ATTRIBUTE: "data-mdc-dialog-button-default",
|
|
113
114
|
BUTTON_SELECTOR: ".mdc-dialog__button",
|
|
@@ -127,21 +128,21 @@ var s = {
|
|
|
127
128
|
".mdc-menu .mdc-deprecated-list-item"
|
|
128
129
|
].join(", "),
|
|
129
130
|
SURFACE_SELECTOR: ".mdc-dialog__surface"
|
|
130
|
-
},
|
|
131
|
+
}, et = {
|
|
131
132
|
DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
|
|
132
133
|
DIALOG_ANIMATION_OPEN_TIME_MS: 150
|
|
133
134
|
};
|
|
134
|
-
var
|
|
135
|
+
var G;
|
|
135
136
|
(function(o) {
|
|
136
137
|
o.POLL_SCROLL_POS = "poll_scroll_position", o.POLL_LAYOUT_CHANGE = "poll_layout_change";
|
|
137
|
-
})(
|
|
138
|
-
var
|
|
138
|
+
})(G || (G = {}));
|
|
139
|
+
var Gt = (
|
|
139
140
|
/** @class */
|
|
140
141
|
(function(o) {
|
|
141
|
-
|
|
142
|
+
Ut(e, o);
|
|
142
143
|
function e(t) {
|
|
143
|
-
var n = o.call(this,
|
|
144
|
-
return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction =
|
|
144
|
+
var n = o.call(this, xt(xt({}, 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 de(), n.contentScrollHandler = function() {
|
|
145
146
|
n.handleScrollEvent();
|
|
146
147
|
}, n.windowResizeHandler = function() {
|
|
147
148
|
n.layout();
|
|
@@ -157,13 +158,13 @@ var $t = (
|
|
|
157
158
|
configurable: !0
|
|
158
159
|
}), Object.defineProperty(e, "strings", {
|
|
159
160
|
get: function() {
|
|
160
|
-
return
|
|
161
|
+
return A;
|
|
161
162
|
},
|
|
162
163
|
enumerable: !1,
|
|
163
164
|
configurable: !0
|
|
164
165
|
}), Object.defineProperty(e, "numbers", {
|
|
165
166
|
get: function() {
|
|
166
|
-
return
|
|
167
|
+
return et;
|
|
167
168
|
},
|
|
168
169
|
enumerable: !1,
|
|
169
170
|
configurable: !0
|
|
@@ -233,19 +234,19 @@ var $t = (
|
|
|
233
234
|
}), e.prototype.init = function() {
|
|
234
235
|
this.adapter.hasClass(s.STACKED) && this.setAutoStackButtons(!1), this.isFullscreen = this.adapter.hasClass(s.FULLSCREEN);
|
|
235
236
|
}, e.prototype.destroy = function() {
|
|
236
|
-
this.dialogOpen && this.close(
|
|
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
238
|
}, e.prototype.open = function(t) {
|
|
238
239
|
var n = this;
|
|
239
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() {
|
|
240
241
|
n.adapter.addClass(s.OPEN), n.adapter.addBodyClass(s.SCROLL_LOCK), n.layout(), n.animationTimer = setTimeout(function() {
|
|
241
242
|
n.handleAnimationTimerEnd(), n.adapter.trapFocus(n.adapter.getInitialFocusEl()), n.adapter.notifyOpened();
|
|
242
|
-
},
|
|
243
|
+
}, et.DIALOG_ANIMATION_OPEN_TIME_MS);
|
|
243
244
|
});
|
|
244
245
|
}, e.prototype.close = function(t) {
|
|
245
246
|
var n = this;
|
|
246
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() {
|
|
247
248
|
n.adapter.releaseFocus(), n.handleAnimationTimerEnd(), n.adapter.notifyClosed(t);
|
|
248
|
-
},
|
|
249
|
+
}, et.DIALOG_ANIMATION_CLOSE_TIME_MS));
|
|
249
250
|
}, e.prototype.showSurfaceScrim = function() {
|
|
250
251
|
var t = this;
|
|
251
252
|
this.adapter.addClass(s.SURFACE_SCRIM_SHOWING), this.runNextAnimationFrame(function() {
|
|
@@ -275,11 +276,11 @@ var $t = (
|
|
|
275
276
|
this.suppressDefaultPressSelector = t;
|
|
276
277
|
}, e.prototype.layout = function() {
|
|
277
278
|
var t = this;
|
|
278
|
-
this.animFrame.request(
|
|
279
|
+
this.animFrame.request(G.POLL_LAYOUT_CHANGE, function() {
|
|
279
280
|
t.layoutInternal();
|
|
280
281
|
});
|
|
281
282
|
}, e.prototype.handleClick = function(t) {
|
|
282
|
-
var n = this.adapter.eventTargetMatches(t.target,
|
|
283
|
+
var n = this.adapter.eventTargetMatches(t.target, A.SCRIM_SELECTOR);
|
|
283
284
|
if (n && this.scrimClickAction !== "")
|
|
284
285
|
this.close(this.scrimClickAction);
|
|
285
286
|
else {
|
|
@@ -291,8 +292,8 @@ var $t = (
|
|
|
291
292
|
if (n) {
|
|
292
293
|
var i = this.adapter.getActionFromEvent(t);
|
|
293
294
|
if (!i) {
|
|
294
|
-
var a = t.composedPath ? t.composedPath()[0] : t.target,
|
|
295
|
-
n &&
|
|
295
|
+
var a = t.composedPath ? t.composedPath()[0] : t.target, u = this.suppressDefaultPressSelector ? !this.adapter.eventTargetMatches(a, this.suppressDefaultPressSelector) : !0;
|
|
296
|
+
n && u && this.adapter.clickDefaultButton();
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
}, e.prototype.handleDocumentKeydown = function(t) {
|
|
@@ -300,7 +301,7 @@ var $t = (
|
|
|
300
301
|
n && this.escapeKeyAction !== "" && this.close(this.escapeKeyAction);
|
|
301
302
|
}, e.prototype.handleScrollEvent = function() {
|
|
302
303
|
var t = this;
|
|
303
|
-
this.animFrame.request(
|
|
304
|
+
this.animFrame.request(G.POLL_SCROLL_POS, function() {
|
|
304
305
|
t.toggleScrollDividerHeader(), t.toggleScrollDividerFooter();
|
|
305
306
|
});
|
|
306
307
|
}, e.prototype.layoutInternal = function() {
|
|
@@ -325,10 +326,10 @@ var $t = (
|
|
|
325
326
|
}, e;
|
|
326
327
|
})(ae)
|
|
327
328
|
);
|
|
328
|
-
var f =
|
|
329
|
+
var f = Gt.strings, ye = (
|
|
329
330
|
/** @class */
|
|
330
331
|
(function(o) {
|
|
331
|
-
|
|
332
|
+
Ut(e, o);
|
|
332
333
|
function e() {
|
|
333
334
|
return o !== null && o.apply(this, arguments) || this;
|
|
334
335
|
}
|
|
@@ -369,30 +370,30 @@ var f = $t.strings, Se = (
|
|
|
369
370
|
return new e(t);
|
|
370
371
|
}, e.prototype.initialize = function(t) {
|
|
371
372
|
var n, i;
|
|
372
|
-
t === void 0 && (t = function(
|
|
373
|
-
return new
|
|
373
|
+
t === void 0 && (t = function(_, S) {
|
|
374
|
+
return new Se(_, S);
|
|
374
375
|
});
|
|
375
376
|
var a = this.root.querySelector(f.CONTAINER_SELECTOR);
|
|
376
377
|
if (!a)
|
|
377
378
|
throw new Error("Dialog component requires a " + f.CONTAINER_SELECTOR + " container element");
|
|
378
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 = [];
|
|
379
380
|
try {
|
|
380
|
-
for (var
|
|
381
|
-
var
|
|
382
|
-
this.buttonRipples.push(new se(
|
|
381
|
+
for (var u = ie(this.buttons), h = u.next(); !h.done; h = u.next()) {
|
|
382
|
+
var O = h.value;
|
|
383
|
+
this.buttonRipples.push(new se(O));
|
|
383
384
|
}
|
|
384
|
-
} catch (
|
|
385
|
-
n = { error:
|
|
385
|
+
} catch (_) {
|
|
386
|
+
n = { error: _ };
|
|
386
387
|
} finally {
|
|
387
388
|
try {
|
|
388
|
-
h && !h.done && (i =
|
|
389
|
+
h && !h.done && (i = u.return) && i.call(u);
|
|
389
390
|
} finally {
|
|
390
391
|
if (n) throw n.error;
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
}, e.prototype.initialSyncWithDOM = function() {
|
|
394
395
|
var t = this;
|
|
395
|
-
this.focusTrap =
|
|
396
|
+
this.focusTrap = ge(this.container, this.focusTrapFactory, this.getInitialFocusEl() || void 0), this.handleClick = this.foundation.handleClick.bind(this.foundation), this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation), this.handleDocumentKeydown = this.foundation.handleDocumentKeydown.bind(this.foundation), this.handleOpening = function() {
|
|
396
397
|
document.addEventListener("keydown", t.handleDocumentKeydown);
|
|
397
398
|
}, this.handleClosing = function() {
|
|
398
399
|
document.removeEventListener("keydown", t.handleDocumentKeydown);
|
|
@@ -416,7 +417,7 @@ var f = $t.strings, Se = (
|
|
|
416
417
|
return t.root.classList.add(i);
|
|
417
418
|
},
|
|
418
419
|
areButtonsStacked: function() {
|
|
419
|
-
return
|
|
420
|
+
return ve(t.buttons);
|
|
420
421
|
},
|
|
421
422
|
clickDefaultButton: function() {
|
|
422
423
|
t.defaultButton && t.defaultButton.click();
|
|
@@ -437,7 +438,7 @@ var f = $t.strings, Se = (
|
|
|
437
438
|
return t.root.classList.contains(i);
|
|
438
439
|
},
|
|
439
440
|
isContentScrollable: function() {
|
|
440
|
-
return
|
|
441
|
+
return _e(t.content);
|
|
441
442
|
},
|
|
442
443
|
notifyClosed: function(i) {
|
|
443
444
|
return t.emit(f.CLOSED_EVENT, i ? { action: i } : {});
|
|
@@ -478,7 +479,7 @@ var f = $t.strings, Se = (
|
|
|
478
479
|
return Ce(t.content);
|
|
479
480
|
},
|
|
480
481
|
isScrollableContentAtBottom: function() {
|
|
481
|
-
return
|
|
482
|
+
return Ee(t.content);
|
|
482
483
|
},
|
|
483
484
|
registerWindowEventHandler: function(i, a) {
|
|
484
485
|
window.addEventListener(i, a);
|
|
@@ -487,12 +488,12 @@ var f = $t.strings, Se = (
|
|
|
487
488
|
window.removeEventListener(i, a);
|
|
488
489
|
}
|
|
489
490
|
};
|
|
490
|
-
return new
|
|
491
|
+
return new Gt(n);
|
|
491
492
|
}, e.prototype.getInitialFocusEl = function() {
|
|
492
493
|
return this.root.querySelector("[" + f.INITIAL_FOCUS_ATTRIBUTE + "]");
|
|
493
494
|
}, e;
|
|
494
495
|
})(re)
|
|
495
|
-
),
|
|
496
|
+
), Oe = {
|
|
496
497
|
/**
|
|
497
498
|
* An action button that will not automatically trigger a dismiss or accept. It is meant to be used only in certain circumstances where more control of the modal is required such as validating forms. If primaryButton is sent with actionButton, actionButton will be ignored.
|
|
498
499
|
*
|
|
@@ -655,7 +656,7 @@ var f = $t.strings, Se = (
|
|
|
655
656
|
* Defaults to **null**.
|
|
656
657
|
*/
|
|
657
658
|
title: l.string
|
|
658
|
-
},
|
|
659
|
+
}, Ae = {
|
|
659
660
|
actionButton: null,
|
|
660
661
|
backButton: null,
|
|
661
662
|
badge: void 0,
|
|
@@ -683,172 +684,174 @@ var f = $t.strings, Se = (
|
|
|
683
684
|
returnFocusSelector: null,
|
|
684
685
|
scrollable: !1,
|
|
685
686
|
title: null
|
|
686
|
-
},
|
|
687
|
-
var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i,
|
|
687
|
+
}, Te = ["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"], r = Ae, ot = /* @__PURE__ */ Zt(function(o, e) {
|
|
688
|
+
var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i, u = o.badge, h = u === void 0 ? r.badge : u, O = o.backButton, _ = O === void 0 ? r.backButton : O, S = o.children, F = S === void 0 ? r.children : S, T = o.className, K = T === void 0 ? r.className : T, v = o.content, L = v === void 0 ? r.content : v, 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, st = o.headerActions, lt = st === void 0 ? r.headerActions : st, ct = o.hideCloseIcon, W = ct === void 0 ? r.hideCloseIcon : ct, dt = o.indicator, Kt = dt === void 0 ? r.indicator : dt, ut = o.initialFocus, I = ut === void 0 ? r.initialFocus : ut, mt = o.mobileStackedButtons, V = mt === void 0 ? r.mobileStackedButtons : mt, ft = o.modalSize, C = ft === void 0 ? r.modalSize : ft, pt = o.nextButton, N = pt === void 0 ? r.nextButton : pt, ht = o.noActions, B = ht === void 0 ? r.noActions : ht, gt = o.onClose, z = gt === void 0 ? r.onClose : gt, _t = o.onClosed, j = _t === void 0 ? r.onClosed : _t, Ct = o.onOpen, k = Ct === void 0 ? r.onOpen : Ct, Et = o.onOpened, M = Et === void 0 ? r.onOpened : Et, vt = o.open, St = vt === void 0 ? r.open : vt, yt = o.preventClose, q = yt === void 0 ? r.preventClose : yt, Ot = o.preventPrimaryAccept, At = Ot === void 0 ? r.preventPrimaryAccept : Ot, Tt = o.primaryButton, d = Tt === void 0 ? r.primaryButton : Tt, bt = o.returnFocusSelector, Y = bt === void 0 ? r.returnFocusSelector : bt, It = o.scrollable, Nt = It === void 0 ? r.scrollable : It, Bt = o.title, Dt = Bt === void 0 ? r.title : Bt, Wt = Qt(o, Te), P = Mt(), c = Mt();
|
|
688
689
|
te(e, function() {
|
|
689
|
-
return
|
|
690
|
+
return P.current;
|
|
690
691
|
}, []);
|
|
691
|
-
var
|
|
692
|
-
return
|
|
693
|
-
}), Lt =
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}, [
|
|
697
|
-
var
|
|
698
|
-
|
|
692
|
+
var Vt = Pt(), Ft = kt(Vt, 2), J = Ft[0], zt = Ft[1], jt = Pt(function() {
|
|
693
|
+
return N || _;
|
|
694
|
+
}), Lt = kt(jt, 2), Q = Lt[0], qt = Lt[1];
|
|
695
|
+
E(function() {
|
|
696
|
+
qt(N || _);
|
|
697
|
+
}, [N, _]);
|
|
698
|
+
var H = Z(function() {
|
|
699
|
+
Ht() && zt(window.innerWidth <= 600);
|
|
699
700
|
}, []);
|
|
700
|
-
|
|
701
|
-
return
|
|
702
|
-
window.removeEventListener("resize",
|
|
701
|
+
E(function() {
|
|
702
|
+
return Ht() ? (H(), window.addEventListener("resize", H), function() {
|
|
703
|
+
window.removeEventListener("resize", H);
|
|
703
704
|
}) : function() {
|
|
704
705
|
};
|
|
705
|
-
}, [
|
|
706
|
-
return c.current =
|
|
706
|
+
}, [H]), E(function() {
|
|
707
|
+
return c.current = ye.attachTo(P.current), function() {
|
|
707
708
|
c.current.destroy();
|
|
708
709
|
};
|
|
709
|
-
}, [c,
|
|
710
|
-
c.current.foundation.setAutoStackButtons(
|
|
711
|
-
}, [
|
|
712
|
-
|
|
710
|
+
}, [c, P]), E(function() {
|
|
711
|
+
c.current.foundation.setAutoStackButtons(V);
|
|
712
|
+
}, [V]), E(function() {
|
|
713
|
+
B && (c.current.foundation.adapter.trapFocus = function() {
|
|
713
714
|
});
|
|
714
|
-
}, [
|
|
715
|
-
c.current.scrimClickAction =
|
|
716
|
-
}, [
|
|
717
|
-
var
|
|
718
|
-
|
|
719
|
-
}, [
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
|
|
723
|
-
return c.current.unlisten("MDCDialog: opening",
|
|
724
|
-
c.current.unlisten("MDCDialog: opening",
|
|
715
|
+
}, [B]), E(function() {
|
|
716
|
+
c.current.scrimClickAction = q ? "" : "close", c.current.escapeKeyAction = q ? "" : "close";
|
|
717
|
+
}, [q]);
|
|
718
|
+
var x = Z(function(p) {
|
|
719
|
+
z && z(p);
|
|
720
|
+
}, [z]), $ = Z(function(p) {
|
|
721
|
+
Y && ne(Y), j && j(p);
|
|
722
|
+
}, [Y, j]);
|
|
723
|
+
E(function() {
|
|
724
|
+
return c.current.unlisten("MDCDialog: opening", k), c.current.listen("MDCDialog: opening", k), function() {
|
|
725
|
+
c.current.unlisten("MDCDialog: opening", k);
|
|
725
726
|
};
|
|
726
|
-
}, [c,
|
|
727
|
-
return c.current.unlisten("MDCDialog:opened",
|
|
728
|
-
c.current.unlisten("MDCDialog:opened",
|
|
727
|
+
}, [c, k]), E(function() {
|
|
728
|
+
return c.current.unlisten("MDCDialog:opened", M), c.current.listen("MDCDialog:opened", M), function() {
|
|
729
|
+
c.current.unlisten("MDCDialog:opened", M);
|
|
729
730
|
};
|
|
730
|
-
}, [c,
|
|
731
|
-
return c.current.unlisten("MDCDialog:closing",
|
|
732
|
-
c.current.unlisten("MDCDialog:closing",
|
|
731
|
+
}, [c, M]), E(function() {
|
|
732
|
+
return c.current.unlisten("MDCDialog:closing", x), c.current.listen("MDCDialog:closing", x), function() {
|
|
733
|
+
c.current.unlisten("MDCDialog:closing", x);
|
|
733
734
|
};
|
|
734
|
-
}, [c,
|
|
735
|
-
return c.current.unlisten("MDCDialog:closed",
|
|
736
|
-
c.current.unlisten("MDCDialog:closed",
|
|
735
|
+
}, [c, x]), E(function() {
|
|
736
|
+
return c.current.unlisten("MDCDialog:closed", $), c.current.listen("MDCDialog:closed", $), function() {
|
|
737
|
+
c.current.unlisten("MDCDialog:closed", $);
|
|
737
738
|
};
|
|
738
|
-
}, [c,
|
|
739
|
+
}, [c, $]), E(function() {
|
|
739
740
|
St ? c.current.open() : c.current.close();
|
|
740
741
|
}, [c, St]);
|
|
741
|
-
var
|
|
742
|
+
var Yt = nt(function() {
|
|
742
743
|
return function() {
|
|
743
744
|
var p = {
|
|
744
745
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
745
746
|
elevation: n?.props.elevation !== "default" ? n?.props.elevation : "flat",
|
|
746
747
|
variant: n?.props.variant || "filled"
|
|
747
748
|
};
|
|
748
|
-
return
|
|
749
|
+
return b === "action" && (p["data-mdc-dialog-button-default"] = !0), I === "action" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
749
750
|
};
|
|
750
|
-
}, [n?.props.elevation, n?.props.variant,
|
|
751
|
+
}, [n?.props.elevation, n?.props.variant, b, I]), Jt = nt(function() {
|
|
751
752
|
return function() {
|
|
752
753
|
var p = {
|
|
753
754
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
754
755
|
"data-mdc-dialog-action": At ? "" : "accept",
|
|
755
|
-
elevation:
|
|
756
|
-
variant:
|
|
756
|
+
elevation: d?.props.elevation !== "default" ? d?.props.elevation : "flat",
|
|
757
|
+
variant: d?.props.variant || "filled"
|
|
757
758
|
};
|
|
758
|
-
return
|
|
759
|
+
return b === "primary" && (p["data-mdc-dialog-button-default"] = !0), I === "primary" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
759
760
|
};
|
|
760
|
-
}, [At,
|
|
761
|
+
}, [At, b, I, d?.props.elevation, d?.props.variant]);
|
|
761
762
|
return /* @__PURE__ */ m.createElement("aside", Xt({
|
|
762
|
-
ref:
|
|
763
|
-
className:
|
|
763
|
+
ref: P,
|
|
764
|
+
className: U("lmnt", "lmnt-modal", "mdc-dialog", Nt && "lmnt-modal--scrollable mdc-dialog--scrollable", K),
|
|
764
765
|
role: "alertdialog"
|
|
765
|
-
},
|
|
766
|
-
className:
|
|
766
|
+
}, Wt), /* @__PURE__ */ m.createElement("div", {
|
|
767
|
+
className: U("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" || J) && "lmnt-modal__mobile", C === "dialog" && "lmnt-modal__dialog", B && "lmnt-modal-no-actions")
|
|
767
768
|
}, /* @__PURE__ */ m.createElement("div", {
|
|
768
769
|
className: "lmnt-modal__surface mdc-dialog__surface"
|
|
769
770
|
}, /* @__PURE__ */ m.createElement("header", {
|
|
770
|
-
className:
|
|
771
|
-
}, !
|
|
771
|
+
className: U("lmnt-modal__title", "mdc-dialog__title", (C === "dialog" || W) && "lmnt-modal_title-hide-close-icon", a && "lmnt-modal_title-actionsIcons", Nt && "lmnt-modal__title-scrollable", (W || C === "dialog" || B) && "lmnt-modal--no-close-icon")
|
|
772
|
+
}, !W && C !== "dialog" && !B && /* @__PURE__ */ m.createElement($t, {
|
|
772
773
|
className: "mdc-icon-button material-icons mdc-dialog__close",
|
|
773
774
|
"data-mdc-dialog-action": "close",
|
|
774
775
|
icon: "clear"
|
|
775
|
-
}),
|
|
776
|
+
}), Dt && /* @__PURE__ */ m.createElement("div", null, Dt), lt && /* @__PURE__ */ m.createElement("div", {
|
|
776
777
|
className: "lmnt-dialog__title-actions"
|
|
777
778
|
}, lt), h && /* @__PURE__ */ m.createElement("div", {
|
|
778
779
|
className: "lmnt-badge--modal",
|
|
779
780
|
style: {
|
|
780
781
|
marginLeft: "0"
|
|
781
782
|
}
|
|
782
|
-
}, h)), (
|
|
783
|
+
}, h)), (L || F) && /* @__PURE__ */ m.createElement("section", {
|
|
783
784
|
className: "lmnt-modal__content mdc-dialog__content"
|
|
784
|
-
},
|
|
785
|
-
className:
|
|
786
|
-
}, !
|
|
785
|
+
}, L || F), Kt, (n || _ || R || N || d || w) && /* @__PURE__ */ m.createElement("footer", {
|
|
786
|
+
className: U("lmnt-modal__actions", "mdc-dialog__actions", J && "lmnt-dialog__actions__mobile", w && "lmnt-modal__actions--supplemental-btn", J && V && "lmnt-modal_actions-mobile-stacked")
|
|
787
|
+
}, !Q && w && /* @__PURE__ */ m.createElement("div", {
|
|
787
788
|
className: "lmnt-dialog__actions__supplemental"
|
|
788
|
-
}, D(
|
|
789
|
+
}, D(w, function() {
|
|
789
790
|
var p = {};
|
|
790
|
-
return
|
|
791
|
-
})), !
|
|
791
|
+
return b === "footerSupplemental" && (p["data-mdc-dialog-button-default"] = !0), I === "footerSupplemental" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
792
|
+
})), !Q && (n || R || d) && /* @__PURE__ */ m.createElement("div", {
|
|
792
793
|
className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
|
|
793
|
-
},
|
|
794
|
+
}, R && D(R, {
|
|
794
795
|
variant: "text",
|
|
795
796
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
796
797
|
"data-mdc-dialog-action": "close"
|
|
797
|
-
}), n && !
|
|
798
|
+
}), n && !d && D(n, Yt), d && D(d, Jt)), Q && /* @__PURE__ */ m.createElement("div", {
|
|
798
799
|
className: "lmnt-modal_actions_button lmnt-dialog__actions__directional"
|
|
799
|
-
}, /* @__PURE__ */ m.createElement("div", null, oe(
|
|
800
|
+
}, /* @__PURE__ */ m.createElement("div", null, oe(_, "lmnt-modal__button")), /* @__PURE__ */ m.createElement("div", null, D(N, {
|
|
800
801
|
className: "lmnt-modal__button",
|
|
801
802
|
"data-mdc-dialog-initial-focus": !0
|
|
802
803
|
})))))), /* @__PURE__ */ m.createElement("div", {
|
|
803
804
|
className: "mdc-dialog__scrim"
|
|
804
805
|
}));
|
|
805
806
|
});
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
modal:
|
|
810
|
-
gap:
|
|
811
|
-
title:
|
|
812
|
-
titleWithoutCloseIcon:
|
|
813
|
-
closeButton: De
|
|
814
|
-
|
|
807
|
+
ot.displayName = "Modal";
|
|
808
|
+
ot.propTypes = Oe;
|
|
809
|
+
const be = "_modal_1yn30_1", Ie = "_gap_1yn30_14", Ne = "_title_1yn30_18", Be = "_titleWithoutCloseIcon_1yn30_31", De = "_closeButton_1yn30_35", Fe = "_errorBanner_1yn30_47", y = {
|
|
810
|
+
modal: be,
|
|
811
|
+
gap: Ie,
|
|
812
|
+
title: Ne,
|
|
813
|
+
titleWithoutCloseIcon: Be,
|
|
814
|
+
closeButton: De,
|
|
815
|
+
errorBanner: Fe
|
|
816
|
+
}, qe = ({
|
|
815
817
|
onClose: o,
|
|
816
818
|
title: e,
|
|
817
819
|
headerActions: t,
|
|
818
820
|
actionButton: n,
|
|
819
821
|
hideCloseIcon: i,
|
|
820
822
|
closeIcon: a = "close",
|
|
821
|
-
leadingIcon:
|
|
823
|
+
leadingIcon: u,
|
|
822
824
|
isOnline: h = !0,
|
|
823
|
-
offlineViewProps:
|
|
824
|
-
children:
|
|
825
|
-
...
|
|
825
|
+
offlineViewProps: O,
|
|
826
|
+
children: _,
|
|
827
|
+
errorBannerProps: { hasError: S, ...F } = { hasError: !1 },
|
|
828
|
+
...T
|
|
826
829
|
}) => {
|
|
827
|
-
const
|
|
830
|
+
const K = nt(() => {
|
|
828
831
|
const v = {
|
|
829
832
|
id: "base",
|
|
830
|
-
action: /* @__PURE__ */
|
|
831
|
-
|
|
833
|
+
action: /* @__PURE__ */ Rt(
|
|
834
|
+
X,
|
|
832
835
|
{
|
|
833
836
|
primaryAlign: "center",
|
|
834
837
|
secondaryAlign: "center",
|
|
835
|
-
className:
|
|
838
|
+
className: y.gap,
|
|
836
839
|
children: [
|
|
837
|
-
!i && /* @__PURE__ */
|
|
838
|
-
|
|
840
|
+
!i && /* @__PURE__ */ g(
|
|
841
|
+
$t,
|
|
839
842
|
{
|
|
840
843
|
icon: a,
|
|
841
844
|
onClick: () => o?.(),
|
|
842
845
|
type: "button",
|
|
843
|
-
className:
|
|
846
|
+
className: y.closeButton
|
|
844
847
|
}
|
|
845
848
|
),
|
|
846
|
-
|
|
847
|
-
/* @__PURE__ */
|
|
849
|
+
u ? /* @__PURE__ */ g(ue, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ g(pe, { icon: u }) }) : /* @__PURE__ */ g(wt, {}),
|
|
850
|
+
/* @__PURE__ */ g(
|
|
848
851
|
me,
|
|
849
852
|
{
|
|
850
853
|
level: 6,
|
|
851
|
-
className: i && !
|
|
854
|
+
className: i && !u ? y.titleWithoutCloseIcon : "",
|
|
852
855
|
children: e
|
|
853
856
|
}
|
|
854
857
|
)
|
|
@@ -859,26 +862,29 @@ const Te = "_modal_mu9y6_1", be = "_gap_mu9y6_14", Ie = "_title_mu9y6_18", Ne =
|
|
|
859
862
|
};
|
|
860
863
|
if (!t) return [v];
|
|
861
864
|
if (!Array.isArray(t)) return [v, { id: "action", action: t }];
|
|
862
|
-
const
|
|
865
|
+
const L = {
|
|
863
866
|
id: "action-group",
|
|
864
|
-
action: /* @__PURE__ */
|
|
867
|
+
action: /* @__PURE__ */ g(X, { className: y.gap, children: t }, "action-group")
|
|
865
868
|
};
|
|
866
|
-
return [v,
|
|
867
|
-
}, [t, i, a,
|
|
868
|
-
return /* @__PURE__ */
|
|
869
|
-
|
|
869
|
+
return [v, L];
|
|
870
|
+
}, [t, i, a, u, o, e]);
|
|
871
|
+
return /* @__PURE__ */ g(
|
|
872
|
+
ot,
|
|
870
873
|
{
|
|
871
|
-
...
|
|
874
|
+
...T,
|
|
872
875
|
"data-testid": "modal",
|
|
873
|
-
className: `${
|
|
876
|
+
className: `${y.modal} ${y.title} ${T.className ?? ""}`,
|
|
874
877
|
hideCloseIcon: !0,
|
|
875
878
|
actionButton: n,
|
|
876
|
-
headerActions: /* @__PURE__ */
|
|
879
|
+
headerActions: /* @__PURE__ */ g(X, { primaryAlign: "space-between", secondaryAlign: "center", children: K.map((v) => /* @__PURE__ */ g(ee, { children: v.action }, v.id)) }, "header-group"),
|
|
877
880
|
preventClose: !0,
|
|
878
|
-
children: h ?
|
|
881
|
+
children: h ? /* @__PURE__ */ Rt(wt, { children: [
|
|
882
|
+
S && /* @__PURE__ */ g("div", { className: y.errorBanner, children: /* @__PURE__ */ g(fe, { ...F, isOpen: S }) }),
|
|
883
|
+
_
|
|
884
|
+
] }) : /* @__PURE__ */ g(he, { ...O })
|
|
879
885
|
}
|
|
880
886
|
);
|
|
881
887
|
};
|
|
882
888
|
export {
|
|
883
|
-
|
|
889
|
+
qe as Modal
|
|
884
890
|
};
|