@hortiview/shared-components 2.2.0 → 2.4.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 +24 -0
- package/README.md +11 -0
- package/dist/AlertBanner-75jjene1.js +26 -0
- package/dist/OfflineView-BW19N4Cu.js +48 -0
- package/dist/assets/AlertBanner.css +1 -1
- package/dist/assets/ContextMenu.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/assets/OfflineView.css +1 -0
- package/dist/components/AlertBanner/AlertBanner.d.ts +1 -2
- package/dist/components/AlertBanner/AlertBanner.js +6 -22
- package/dist/components/AlertBanner/AlertBanner.test.js +1 -1
- package/dist/components/AlertBanner/LinkBanner.d.ts +21 -0
- package/dist/components/AlertBanner/LinkBanner.js +37 -0
- package/dist/components/AlertBanner/LinkBanner.test.d.ts +1 -0
- package/dist/components/AlertBanner/LinkBanner.test.js +17 -0
- package/dist/components/BaseView/BaseView.d.ts +10 -1
- package/dist/components/BaseView/BaseView.js +42 -39
- package/dist/components/BaseView/BaseView.test.js +51 -34
- package/dist/components/ContextMenu/ContextMenu.d.ts +12 -1
- package/dist/components/ContextMenu/ContextMenu.js +40 -36
- package/dist/components/ContextMenu/ContextMenu.test.js +42 -19
- package/dist/components/DeleteModal/DeleteModal.d.ts +13 -1
- package/dist/components/DeleteModal/DeleteModal.js +52 -48
- package/dist/components/DeleteModal/DeleteModal.test.js +35 -11
- package/dist/components/GenericTable/GenericTable.d.ts +3 -1
- package/dist/components/GenericTable/GenericTable.js +1225 -1216
- package/dist/components/GenericTable/GenericTable.test.js +36 -6
- package/dist/components/Modal/Modal.d.ts +6 -1
- package/dist/components/Modal/Modal.js +126 -120
- package/dist/components/ModulePadding/ModulePadding.js +1 -1
- package/dist/components/OfflineView/OfflineView.d.ts +68 -0
- package/dist/components/OfflineView/OfflineView.js +9 -0
- package/dist/components/OfflineView/OfflineView.test.d.ts +1 -0
- package/dist/components/OfflineView/OfflineView.test.js +24 -0
- package/dist/components/Stepper/Stepper.d.ts +4 -3
- package/dist/components/Stepper/Stepper.js +33 -21
- package/dist/components/Stepper/Stepper.test.js +40 -64
- package/dist/components/Stepper/components/StepperButton.d.ts +8 -2
- package/dist/components/Stepper/components/StepperButton.js +54 -38
- package/dist/components/Stepper/stepperTypes.d.ts +31 -1
- package/dist/main.d.ts +6 -4
- package/dist/main.js +101 -97
- package/dist/types/GenericTable.d.ts +9 -0
- package/package.json +1 -1
|
@@ -55,18 +55,18 @@ h("GenericTable Test", () => {
|
|
|
55
55
|
] })), t(e.getByText("primText")).toBeInTheDocument(), e.getByText("primText").click(), t(d).toHaveBeenCalledWith(1);
|
|
56
56
|
}), i("render GenericTable with custom order", () => {
|
|
57
57
|
o(/* @__PURE__ */ a(s, { data: [{ id: 1, name: "test", age: 20 }], order: ["name", "age"] }));
|
|
58
|
-
const d = e.getByText("id"),
|
|
59
|
-
t(
|
|
58
|
+
const d = e.getByText("id"), l = e.getByText("name"), c = e.getByText("age");
|
|
59
|
+
t(l).toBeInTheDocument(), t(c).toBeInTheDocument(), t(d).toBeInTheDocument(), t(l.compareDocumentPosition(c)).toBe(4), t(c.compareDocumentPosition(d)).toBe(4);
|
|
60
60
|
}), i("render GenericTable with custom columnWidth in pixel", () => {
|
|
61
61
|
o(
|
|
62
62
|
/* @__PURE__ */ a(s, { data: [{ id: 1, name: "test", age: 20 }], customColumnWidth: { id: 200, name: 200, age: 200 } })
|
|
63
63
|
);
|
|
64
|
-
const
|
|
65
|
-
t(
|
|
64
|
+
const l = e.getAllByRole("cell")[0].getAttribute("width");
|
|
65
|
+
t(l).toBe("200");
|
|
66
66
|
}), i("render GenericTable with custom columnWidth in percent", () => {
|
|
67
67
|
o(/* @__PURE__ */ a(s, { data: [{ id: 1, name: "test" }], customColumnWidth: { id: "50%", name: "50%" } }));
|
|
68
|
-
const
|
|
69
|
-
t(
|
|
68
|
+
const l = e.getAllByRole("cell")[0].getAttribute("width");
|
|
69
|
+
t(l).toBe("50%");
|
|
70
70
|
}), i("render GenericTable with title", () => {
|
|
71
71
|
o(/* @__PURE__ */ a(s, { data: [{ id: 1, name: "test" }], title: "test-title" })), t(e.getByText("test-title")).toBeInTheDocument();
|
|
72
72
|
}), i("render GenericTable with title and table actions", () => {
|
|
@@ -81,5 +81,35 @@ h("GenericTable Test", () => {
|
|
|
81
81
|
isTablet: !1,
|
|
82
82
|
isDesktopNavbar: !1
|
|
83
83
|
}), o(/* @__PURE__ */ a(s, { data: [{ id: 1, name: "test", age: 20 }], title: "test-title", cardTitleColumn: "name" })), t(e.getAllByTestId("card-title")).toHaveLength(1), t(e.getAllByTestId("card-body")).toHaveLength(1), t(e.getAllByTestId("row")).toHaveLength(2);
|
|
84
|
+
}), i("render GenericTable with OfflineView", () => {
|
|
85
|
+
o(
|
|
86
|
+
/* @__PURE__ */ a(
|
|
87
|
+
s,
|
|
88
|
+
{
|
|
89
|
+
data: [{ id: 1, name: "test" }],
|
|
90
|
+
noContentText: "noContent",
|
|
91
|
+
isOnline: !1,
|
|
92
|
+
offlineViewProps: { "data-testid": "offline-test" }
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
), t(e.getByTestId("offline-test")).toBeInTheDocument();
|
|
96
|
+
}), i("shows OfflineView on mobile when offline", () => {
|
|
97
|
+
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
98
|
+
isDesktop: !1,
|
|
99
|
+
isMobile: !0,
|
|
100
|
+
isTablet: !1,
|
|
101
|
+
isDesktopNavbar: !1
|
|
102
|
+
}), o(
|
|
103
|
+
/* @__PURE__ */ a(
|
|
104
|
+
s,
|
|
105
|
+
{
|
|
106
|
+
data: [{ id: 1, name: "test", age: 20 }],
|
|
107
|
+
title: "test-title",
|
|
108
|
+
cardTitleColumn: "name",
|
|
109
|
+
isOnline: !1,
|
|
110
|
+
offlineViewProps: { "data-testid": "offline-test" }
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
), t(e.getByTestId("offline-test")).toBeInTheDocument();
|
|
84
114
|
});
|
|
85
115
|
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ModalProps as ElementModalProps } from '@element-public/react-modal';
|
|
2
2
|
import { AvailableCustomIcons } from '../../enums/AvailableCustomIcons';
|
|
3
|
+
import { OfflineViewProps } from '../OfflineView/OfflineView';
|
|
3
4
|
|
|
4
5
|
type ModalProps = ElementModalProps & React.HTMLProps<HTMLElement> & React.DOMAttributes<HTMLElement> & {
|
|
5
6
|
leadingIcon?: keyof typeof AvailableCustomIcons | string;
|
|
7
|
+
isOnline?: boolean;
|
|
8
|
+
offlineViewProps?: Partial<OfflineViewProps>;
|
|
6
9
|
};
|
|
7
10
|
/**
|
|
8
11
|
* A custom modal providing a custom header and close button.
|
|
@@ -13,7 +16,9 @@ type ModalProps = ElementModalProps & React.HTMLProps<HTMLElement> & React.DOMAt
|
|
|
13
16
|
* @param hideCloseIcon - If true, the close icon will be hidden. @default true.
|
|
14
17
|
* @param leadingIcon - Iconify icon string (material icons and custom icons)
|
|
15
18
|
* @param - Other element props to pass to the modal.
|
|
19
|
+
* @param isOnline - Whether the user is online; shows OfflineView when false.
|
|
20
|
+
* @param offlineViewProps - Props forwarded to OfflineView when offline.
|
|
16
21
|
* @returns
|
|
17
22
|
*/
|
|
18
|
-
export declare const Modal: ({ onClose, title, headerActions, hideCloseIcon, leadingIcon, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Modal: ({ onClose, title, headerActions, hideCloseIcon, leadingIcon, isOnline, offlineViewProps, children, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
24
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as ft, jsx as
|
|
2
|
-
import { G as
|
|
1
|
+
import { jsxs as ft, jsx as C, Fragment as pt } from "react/jsx-runtime";
|
|
2
|
+
import { G as z } from "../../index.es-DntoATwO.js";
|
|
3
3
|
import { I as it } from "../../index.es-0lQcz8m1.js";
|
|
4
4
|
import { _ as ht, c as B, P as s } from "../../identity-DLWZln-X.js";
|
|
5
|
-
import d, { forwardRef as gt, useRef as et, useImperativeHandle as
|
|
6
|
-
import { i as
|
|
5
|
+
import d, { forwardRef as gt, useRef as et, useImperativeHandle as _t, useState as nt, useEffect as _, useCallback as j, useMemo as Y } from "react";
|
|
6
|
+
import { i as Et, c as b, a as Ct } from "../../index.es-da0cf7oE.js";
|
|
7
7
|
import { b as at, c as ot, d as St } from "../../tslib.es6-BDCynO9F.js";
|
|
8
8
|
import { M as vt, a as yt } from "../../component-neHBNHRu.js";
|
|
9
9
|
import { M as Ot, c as Tt, m as At } from "../../component-DsB0poTj.js";
|
|
@@ -11,6 +11,7 @@ import { A as bt } from "../../animationframe-EMBh6XeO.js";
|
|
|
11
11
|
import { P as Dt } from "../../index.es-D-CKRzIB.js";
|
|
12
12
|
import { b as It } from "../../index.es-D54RuMc_.js";
|
|
13
13
|
import { Iconify as Nt } from "../Iconify/Iconify.js";
|
|
14
|
+
import { O as Lt } from "../../OfflineView-BW19N4Cu.js";
|
|
14
15
|
import '../../assets/Modal.css';/**
|
|
15
16
|
* @license
|
|
16
17
|
* Copyright 2016 Google Inc.
|
|
@@ -33,19 +34,19 @@ import '../../assets/Modal.css';/**
|
|
|
33
34
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
34
35
|
* THE SOFTWARE.
|
|
35
36
|
*/
|
|
36
|
-
function
|
|
37
|
+
function Ft(i, e, t) {
|
|
37
38
|
return e(i, { initialFocusEl: t });
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function Rt(i) {
|
|
40
41
|
return i ? i.scrollHeight > i.offsetHeight : !1;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function Bt(i) {
|
|
43
44
|
return i ? i.scrollTop === 0 : !1;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function wt(i) {
|
|
46
47
|
return i ? Math.ceil(i.scrollHeight - i.scrollTop) === i.clientHeight : !1;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function Mt(i) {
|
|
49
50
|
var e = /* @__PURE__ */ new Set();
|
|
50
51
|
return [].forEach.call(i, function(t) {
|
|
51
52
|
return e.add(t.offsetTop);
|
|
@@ -73,7 +74,7 @@ function wt(i) {
|
|
|
73
74
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
74
75
|
* THE SOFTWARE.
|
|
75
76
|
*/
|
|
76
|
-
var
|
|
77
|
+
var q = "mdc-dom-focus-sentinel", kt = (
|
|
77
78
|
/** @class */
|
|
78
79
|
function() {
|
|
79
80
|
function i(e, t) {
|
|
@@ -85,7 +86,7 @@ var j = "mdc-dom-focus-sentinel", Mt = (
|
|
|
85
86
|
throw new Error("FocusTrap: Element must have at least one focusable child.");
|
|
86
87
|
this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.wrapTabFocus(this.root), this.options.skipInitialFocus || this.focusInitialElement(e, this.options.initialFocusEl);
|
|
87
88
|
}, i.prototype.releaseFocus = function() {
|
|
88
|
-
[].slice.call(this.root.querySelectorAll("." +
|
|
89
|
+
[].slice.call(this.root.querySelectorAll("." + q)).forEach(function(e) {
|
|
89
90
|
e.parentElement.removeChild(e);
|
|
90
91
|
}), !this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus && this.elFocusedBeforeTrapFocus.focus();
|
|
91
92
|
}, i.prototype.wrapTabFocus = function(e) {
|
|
@@ -103,7 +104,7 @@ var j = "mdc-dom-focus-sentinel", Mt = (
|
|
|
103
104
|
}, i.prototype.getFocusableElements = function(e) {
|
|
104
105
|
var t = [].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button"));
|
|
105
106
|
return t.filter(function(n) {
|
|
106
|
-
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(
|
|
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
108
|
if (a) {
|
|
108
109
|
var p = getComputedStyle(n);
|
|
109
110
|
f = p.display === "none" || p.visibility === "hidden";
|
|
@@ -112,7 +113,7 @@ var j = "mdc-dom-focus-sentinel", Mt = (
|
|
|
112
113
|
});
|
|
113
114
|
}, i.prototype.createSentinel = function() {
|
|
114
115
|
var e = document.createElement("div");
|
|
115
|
-
return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(
|
|
116
|
+
return e.setAttribute("tabindex", "0"), e.setAttribute("aria-hidden", "true"), e.classList.add(q), e;
|
|
116
117
|
}, i;
|
|
117
118
|
}()
|
|
118
119
|
);
|
|
@@ -171,7 +172,7 @@ var r = {
|
|
|
171
172
|
// to prevent interactions with the content behind this scrim, and to capture
|
|
172
173
|
// scrim clicks.
|
|
173
174
|
SCRIM_HIDDEN: "mdc-dialog__scrim--hidden"
|
|
174
|
-
},
|
|
175
|
+
}, v = {
|
|
175
176
|
ACTION_ATTRIBUTE: "data-mdc-dialog-action",
|
|
176
177
|
BUTTON_DEFAULT_ATTRIBUTE: "data-mdc-dialog-button-default",
|
|
177
178
|
BUTTON_SELECTOR: ".mdc-dialog__button",
|
|
@@ -191,7 +192,7 @@ var r = {
|
|
|
191
192
|
".mdc-menu .mdc-deprecated-list-item"
|
|
192
193
|
].join(", "),
|
|
193
194
|
SURFACE_SELECTOR: ".mdc-dialog__surface"
|
|
194
|
-
},
|
|
195
|
+
}, $ = {
|
|
195
196
|
DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
|
|
196
197
|
DIALOG_ANIMATION_OPEN_TIME_MS: 150
|
|
197
198
|
};
|
|
@@ -217,17 +218,17 @@ var r = {
|
|
|
217
218
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
218
219
|
* THE SOFTWARE.
|
|
219
220
|
*/
|
|
220
|
-
var
|
|
221
|
+
var M;
|
|
221
222
|
(function(i) {
|
|
222
223
|
i.POLL_SCROLL_POS = "poll_scroll_position", i.POLL_LAYOUT_CHANGE = "poll_layout_change";
|
|
223
|
-
})(
|
|
224
|
+
})(M || (M = {}));
|
|
224
225
|
var rt = (
|
|
225
226
|
/** @class */
|
|
226
227
|
function(i) {
|
|
227
228
|
at(e, i);
|
|
228
229
|
function e(t) {
|
|
229
230
|
var n = i.call(this, ot(ot({}, e.defaultAdapter), t)) || this;
|
|
230
|
-
return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction =
|
|
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 bt(), n.contentScrollHandler = function() {
|
|
231
232
|
n.handleScrollEvent();
|
|
232
233
|
}, n.windowResizeHandler = function() {
|
|
233
234
|
n.layout();
|
|
@@ -243,13 +244,13 @@ var rt = (
|
|
|
243
244
|
configurable: !0
|
|
244
245
|
}), Object.defineProperty(e, "strings", {
|
|
245
246
|
get: function() {
|
|
246
|
-
return
|
|
247
|
+
return v;
|
|
247
248
|
},
|
|
248
249
|
enumerable: !1,
|
|
249
250
|
configurable: !0
|
|
250
251
|
}), Object.defineProperty(e, "numbers", {
|
|
251
252
|
get: function() {
|
|
252
|
-
return
|
|
253
|
+
return $;
|
|
253
254
|
},
|
|
254
255
|
enumerable: !1,
|
|
255
256
|
configurable: !0
|
|
@@ -319,19 +320,19 @@ var rt = (
|
|
|
319
320
|
}), e.prototype.init = function() {
|
|
320
321
|
this.adapter.hasClass(r.STACKED) && this.setAutoStackButtons(!1), this.isFullscreen = this.adapter.hasClass(r.FULLSCREEN);
|
|
321
322
|
}, e.prototype.destroy = function() {
|
|
322
|
-
this.dialogOpen && this.close(
|
|
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
324
|
}, e.prototype.open = function(t) {
|
|
324
325
|
var n = this;
|
|
325
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() {
|
|
326
327
|
n.adapter.addClass(r.OPEN), n.adapter.addBodyClass(r.SCROLL_LOCK), n.layout(), n.animationTimer = setTimeout(function() {
|
|
327
328
|
n.handleAnimationTimerEnd(), n.adapter.trapFocus(n.adapter.getInitialFocusEl()), n.adapter.notifyOpened();
|
|
328
|
-
},
|
|
329
|
+
}, $.DIALOG_ANIMATION_OPEN_TIME_MS);
|
|
329
330
|
});
|
|
330
331
|
}, e.prototype.close = function(t) {
|
|
331
332
|
var n = this;
|
|
332
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() {
|
|
333
334
|
n.adapter.releaseFocus(), n.handleAnimationTimerEnd(), n.adapter.notifyClosed(t);
|
|
334
|
-
},
|
|
335
|
+
}, $.DIALOG_ANIMATION_CLOSE_TIME_MS));
|
|
335
336
|
}, e.prototype.showSurfaceScrim = function() {
|
|
336
337
|
var t = this;
|
|
337
338
|
this.adapter.addClass(r.SURFACE_SCRIM_SHOWING), this.runNextAnimationFrame(function() {
|
|
@@ -361,11 +362,11 @@ var rt = (
|
|
|
361
362
|
this.suppressDefaultPressSelector = t;
|
|
362
363
|
}, e.prototype.layout = function() {
|
|
363
364
|
var t = this;
|
|
364
|
-
this.animFrame.request(
|
|
365
|
+
this.animFrame.request(M.POLL_LAYOUT_CHANGE, function() {
|
|
365
366
|
t.layoutInternal();
|
|
366
367
|
});
|
|
367
368
|
}, e.prototype.handleClick = function(t) {
|
|
368
|
-
var n = this.adapter.eventTargetMatches(t.target,
|
|
369
|
+
var n = this.adapter.eventTargetMatches(t.target, v.SCRIM_SELECTOR);
|
|
369
370
|
if (n && this.scrimClickAction !== "")
|
|
370
371
|
this.close(this.scrimClickAction);
|
|
371
372
|
else {
|
|
@@ -386,7 +387,7 @@ var rt = (
|
|
|
386
387
|
n && this.escapeKeyAction !== "" && this.close(this.escapeKeyAction);
|
|
387
388
|
}, e.prototype.handleScrollEvent = function() {
|
|
388
389
|
var t = this;
|
|
389
|
-
this.animFrame.request(
|
|
390
|
+
this.animFrame.request(M.POLL_SCROLL_POS, function() {
|
|
390
391
|
t.toggleScrollDividerHeader(), t.toggleScrollDividerFooter();
|
|
391
392
|
});
|
|
392
393
|
}, e.prototype.layoutInternal = function() {
|
|
@@ -433,7 +434,7 @@ var rt = (
|
|
|
433
434
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
434
435
|
* THE SOFTWARE.
|
|
435
436
|
*/
|
|
436
|
-
var u = rt.strings,
|
|
437
|
+
var u = rt.strings, Ht = (
|
|
437
438
|
/** @class */
|
|
438
439
|
function(i) {
|
|
439
440
|
at(e, i);
|
|
@@ -477,8 +478,8 @@ var u = rt.strings, kt = (
|
|
|
477
478
|
return new e(t);
|
|
478
479
|
}, e.prototype.initialize = function(t) {
|
|
479
480
|
var n, o;
|
|
480
|
-
t === void 0 && (t = function(
|
|
481
|
-
return new
|
|
481
|
+
t === void 0 && (t = function(h, E) {
|
|
482
|
+
return new kt(h, E);
|
|
482
483
|
});
|
|
483
484
|
var a = this.root.querySelector(u.CONTAINER_SELECTOR);
|
|
484
485
|
if (!a)
|
|
@@ -486,11 +487,11 @@ var u = rt.strings, kt = (
|
|
|
486
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 = [];
|
|
487
488
|
try {
|
|
488
489
|
for (var f = St(this.buttons), p = f.next(); !p.done; p = f.next()) {
|
|
489
|
-
var
|
|
490
|
-
this.buttonRipples.push(new Ot(
|
|
490
|
+
var S = p.value;
|
|
491
|
+
this.buttonRipples.push(new Ot(S));
|
|
491
492
|
}
|
|
492
|
-
} catch (
|
|
493
|
-
n = { error:
|
|
493
|
+
} catch (h) {
|
|
494
|
+
n = { error: h };
|
|
494
495
|
} finally {
|
|
495
496
|
try {
|
|
496
497
|
p && !p.done && (o = f.return) && o.call(f);
|
|
@@ -500,7 +501,7 @@ var u = rt.strings, kt = (
|
|
|
500
501
|
}
|
|
501
502
|
}, e.prototype.initialSyncWithDOM = function() {
|
|
502
503
|
var t = this;
|
|
503
|
-
this.focusTrap =
|
|
504
|
+
this.focusTrap = Ft(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() {
|
|
504
505
|
document.addEventListener("keydown", t.handleDocumentKeydown);
|
|
505
506
|
}, this.handleClosing = function() {
|
|
506
507
|
document.removeEventListener("keydown", t.handleDocumentKeydown);
|
|
@@ -524,7 +525,7 @@ var u = rt.strings, kt = (
|
|
|
524
525
|
return t.root.classList.add(o);
|
|
525
526
|
},
|
|
526
527
|
areButtonsStacked: function() {
|
|
527
|
-
return
|
|
528
|
+
return Mt(t.buttons);
|
|
528
529
|
},
|
|
529
530
|
clickDefaultButton: function() {
|
|
530
531
|
t.defaultButton && t.defaultButton.click();
|
|
@@ -545,7 +546,7 @@ var u = rt.strings, kt = (
|
|
|
545
546
|
return t.root.classList.contains(o);
|
|
546
547
|
},
|
|
547
548
|
isContentScrollable: function() {
|
|
548
|
-
return
|
|
549
|
+
return Rt(t.content);
|
|
549
550
|
},
|
|
550
551
|
notifyClosed: function(o) {
|
|
551
552
|
return t.emit(u.CLOSED_EVENT, o ? { action: o } : {});
|
|
@@ -583,10 +584,10 @@ var u = rt.strings, kt = (
|
|
|
583
584
|
t.content instanceof HTMLElement && t.content.removeEventListener(o, a);
|
|
584
585
|
},
|
|
585
586
|
isScrollableContentAtTop: function() {
|
|
586
|
-
return
|
|
587
|
+
return Bt(t.content);
|
|
587
588
|
},
|
|
588
589
|
isScrollableContentAtBottom: function() {
|
|
589
|
-
return
|
|
590
|
+
return wt(t.content);
|
|
590
591
|
},
|
|
591
592
|
registerWindowEventHandler: function(o, a) {
|
|
592
593
|
window.addEventListener(o, a);
|
|
@@ -601,7 +602,7 @@ var u = rt.strings, kt = (
|
|
|
601
602
|
}, e;
|
|
602
603
|
}(yt)
|
|
603
604
|
);
|
|
604
|
-
const
|
|
605
|
+
const Pt = {
|
|
605
606
|
/**
|
|
606
607
|
* 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.
|
|
607
608
|
*
|
|
@@ -764,7 +765,7 @@ const Ht = {
|
|
|
764
765
|
* Defaults to **null**.
|
|
765
766
|
*/
|
|
766
767
|
title: s.string
|
|
767
|
-
},
|
|
768
|
+
}, Ut = {
|
|
768
769
|
actionButton: null,
|
|
769
770
|
backButton: null,
|
|
770
771
|
badge: void 0,
|
|
@@ -788,7 +789,7 @@ const Ht = {
|
|
|
788
789
|
returnFocusSelector: null,
|
|
789
790
|
scrollable: !1,
|
|
790
791
|
title: null
|
|
791
|
-
},
|
|
792
|
+
}, k = /* @__PURE__ */ gt((i, e) => {
|
|
792
793
|
const {
|
|
793
794
|
actionButton: t,
|
|
794
795
|
actionIcons: n,
|
|
@@ -796,65 +797,65 @@ const Ht = {
|
|
|
796
797
|
backButton: a,
|
|
797
798
|
children: f,
|
|
798
799
|
className: p,
|
|
799
|
-
content:
|
|
800
|
-
defaultButton:
|
|
801
|
-
dismissiveButton:
|
|
802
|
-
footerSupplemental:
|
|
800
|
+
content: S,
|
|
801
|
+
defaultButton: h,
|
|
802
|
+
dismissiveButton: E,
|
|
803
|
+
footerSupplemental: y,
|
|
803
804
|
headerActions: J,
|
|
804
|
-
hideCloseIcon:
|
|
805
|
+
hideCloseIcon: H,
|
|
805
806
|
indicator: st,
|
|
806
|
-
initialFocus:
|
|
807
|
-
mobileStackedButtons:
|
|
808
|
-
modalSize:
|
|
809
|
-
nextButton:
|
|
810
|
-
noActions:
|
|
811
|
-
onClose:
|
|
812
|
-
onClosed:
|
|
807
|
+
initialFocus: O,
|
|
808
|
+
mobileStackedButtons: P,
|
|
809
|
+
modalSize: g,
|
|
810
|
+
nextButton: T,
|
|
811
|
+
noActions: A,
|
|
812
|
+
onClose: U,
|
|
813
|
+
onClosed: x,
|
|
813
814
|
onOpen: D,
|
|
814
815
|
onOpened: I,
|
|
815
816
|
open: Q,
|
|
816
|
-
preventClose:
|
|
817
|
+
preventClose: G,
|
|
817
818
|
preventPrimaryAccept: X,
|
|
818
819
|
primaryButton: c,
|
|
819
|
-
returnFocusSelector:
|
|
820
|
+
returnFocusSelector: K,
|
|
820
821
|
scrollable: Z,
|
|
821
822
|
title: tt,
|
|
822
823
|
...lt
|
|
823
824
|
} = i, N = et(), l = et();
|
|
824
|
-
|
|
825
|
-
const [
|
|
826
|
-
|
|
827
|
-
dt(
|
|
828
|
-
}, [
|
|
829
|
-
const L =
|
|
825
|
+
_t(e, () => N.current, []);
|
|
826
|
+
const [W, ct] = nt(), [V, dt] = nt(() => T || a);
|
|
827
|
+
_(() => {
|
|
828
|
+
dt(T || a);
|
|
829
|
+
}, [T, a]);
|
|
830
|
+
const L = j(() => {
|
|
830
831
|
ct(window.innerWidth <= 600);
|
|
831
832
|
}, []);
|
|
832
|
-
|
|
833
|
+
_(() => (L(), window.addEventListener("resize", L), () => {
|
|
833
834
|
window.removeEventListener("resize", L);
|
|
834
|
-
}), [L]),
|
|
835
|
+
}), [L]), _(() => (l.current = Ht.attachTo(N.current), () => {
|
|
835
836
|
l.current.destroy();
|
|
836
|
-
}), [l, N]),
|
|
837
|
-
l.current.foundation.setAutoStackButtons(
|
|
838
|
-
}, [
|
|
839
|
-
|
|
837
|
+
}), [l, N]), _(() => {
|
|
838
|
+
l.current.foundation.setAutoStackButtons(P);
|
|
839
|
+
}, [P]), _(() => {
|
|
840
|
+
A && (l.current.foundation.adapter.trapFocus = () => {
|
|
840
841
|
});
|
|
841
|
-
}, [
|
|
842
|
-
l.current.scrimClickAction =
|
|
843
|
-
}, [
|
|
844
|
-
const F =
|
|
845
|
-
|
|
846
|
-
}, [
|
|
847
|
-
|
|
848
|
-
}, [
|
|
849
|
-
|
|
842
|
+
}, [A]), _(() => {
|
|
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 && Et(K), x && x(m);
|
|
849
|
+
}, [K, x]);
|
|
850
|
+
_(() => (l.current.unlisten("MDCDialog: opening", D), l.current.listen("MDCDialog: opening", D), () => {
|
|
850
851
|
l.current.unlisten("MDCDialog: opening", D);
|
|
851
|
-
}), [l, D]),
|
|
852
|
+
}), [l, D]), _(() => (l.current.unlisten("MDCDialog:opened", I), l.current.listen("MDCDialog:opened", I), () => {
|
|
852
853
|
l.current.unlisten("MDCDialog:opened", I);
|
|
853
|
-
}), [l, I]),
|
|
854
|
+
}), [l, I]), _(() => (l.current.unlisten("MDCDialog:closing", F), l.current.listen("MDCDialog:closing", F), () => {
|
|
854
855
|
l.current.unlisten("MDCDialog:closing", F);
|
|
855
|
-
}), [l, F]),
|
|
856
|
+
}), [l, F]), _(() => (l.current.unlisten("MDCDialog:closed", R), l.current.listen("MDCDialog:closed", R), () => {
|
|
856
857
|
l.current.unlisten("MDCDialog:closed", R);
|
|
857
|
-
}), [l, R]),
|
|
858
|
+
}), [l, R]), _(() => {
|
|
858
859
|
Q ? l.current.open() : l.current.close();
|
|
859
860
|
}, [l, Q]);
|
|
860
861
|
const ut = Y(() => () => {
|
|
@@ -863,27 +864,27 @@ const Ht = {
|
|
|
863
864
|
elevation: t?.props.elevation !== "default" ? t?.props.elevation : "flat",
|
|
864
865
|
variant: t?.props.variant || "filled"
|
|
865
866
|
};
|
|
866
|
-
return
|
|
867
|
-
}, [t?.props.elevation, t?.props.variant,
|
|
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 = Y(() => () => {
|
|
868
869
|
const m = {
|
|
869
870
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
870
871
|
"data-mdc-dialog-action": X ? "" : "accept",
|
|
871
872
|
elevation: c?.props.elevation !== "default" ? c?.props.elevation : "flat",
|
|
872
873
|
variant: c?.props.variant || "filled"
|
|
873
874
|
};
|
|
874
|
-
return
|
|
875
|
-
}, [X,
|
|
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]);
|
|
876
877
|
return /* @__PURE__ */ d.createElement("aside", ht({
|
|
877
878
|
ref: N,
|
|
878
879
|
className: B("lmnt", "lmnt-modal", "mdc-dialog", Z && "lmnt-modal--scrollable mdc-dialog--scrollable", p),
|
|
879
880
|
role: "alertdialog"
|
|
880
881
|
}, lt), /* @__PURE__ */ d.createElement("div", {
|
|
881
|
-
className: B("lmnt-modal__container", "mdc-dialog__container",
|
|
882
|
+
className: B("lmnt-modal__container", "mdc-dialog__container", g === "fullscreen" && "mdc-dialog--fullscreen", g === "max" && "lmnt-modal__max", g === "xlarge" && "lmnt-modal__xl", g === "large" && "lmnt-modal__lg", g === "medium" && "lmnt-modal__md", g === "small" && "lmnt-modal__sm", (g === "mobile" || W) && "lmnt-modal__mobile", g === "dialog" && "lmnt-modal__dialog", A && "lmnt-modal-no-actions")
|
|
882
883
|
}, /* @__PURE__ */ d.createElement("div", {
|
|
883
884
|
className: "lmnt-modal__surface mdc-dialog__surface"
|
|
884
885
|
}, /* @__PURE__ */ d.createElement("header", {
|
|
885
|
-
className: B("lmnt-modal__title", "mdc-dialog__title", (
|
|
886
|
-
}, !
|
|
886
|
+
className: B("lmnt-modal__title", "mdc-dialog__title", (g === "dialog" || H) && "lmnt-modal_title-hide-close-icon", n && "lmnt-modal_title-actionsIcons", Z && "lmnt-modal__title-scrollable", (H || g === "dialog" || A) && "lmnt-modal--no-close-icon")
|
|
887
|
+
}, !H && g !== "dialog" && !A && /* @__PURE__ */ d.createElement(it, {
|
|
887
888
|
className: "mdc-icon-button material-icons mdc-dialog__close",
|
|
888
889
|
"data-mdc-dialog-action": "close",
|
|
889
890
|
icon: "clear"
|
|
@@ -894,72 +895,77 @@ const Ht = {
|
|
|
894
895
|
style: {
|
|
895
896
|
marginLeft: "0"
|
|
896
897
|
}
|
|
897
|
-
}, o)), (
|
|
898
|
+
}, o)), (S || f) && /* @__PURE__ */ d.createElement("section", {
|
|
898
899
|
className: "lmnt-modal__content mdc-dialog__content"
|
|
899
|
-
},
|
|
900
|
-
className: B("lmnt-modal__actions", "mdc-dialog__actions",
|
|
901
|
-
}, !
|
|
900
|
+
}, S || f), st, (t || a || E || 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", {
|
|
902
903
|
className: "lmnt-dialog__actions__supplemental"
|
|
903
|
-
},
|
|
904
|
+
}, b(y, () => {
|
|
904
905
|
const m = {};
|
|
905
|
-
return
|
|
906
|
-
})), !
|
|
906
|
+
return h === "footerSupplemental" && (m["data-mdc-dialog-button-default"] = !0), O === "footerSupplemental" && (m["data-mdc-dialog-initial-focus"] = !0), m;
|
|
907
|
+
})), !V && (t || E || c) && /* @__PURE__ */ d.createElement("div", {
|
|
907
908
|
className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
|
|
908
|
-
},
|
|
909
|
+
}, E && b(E, {
|
|
909
910
|
variant: "text",
|
|
910
911
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
911
912
|
"data-mdc-dialog-action": "close"
|
|
912
|
-
}), t && !c &&
|
|
913
|
+
}), t && !c && b(t, ut), c && b(c, mt)), V && /* @__PURE__ */ d.createElement("div", {
|
|
913
914
|
className: "lmnt-modal_actions_button lmnt-dialog__actions__directional"
|
|
914
|
-
}, /* @__PURE__ */ d.createElement("div", null, Ct(a, "lmnt-modal__button")), /* @__PURE__ */ d.createElement("div", null,
|
|
915
|
+
}, /* @__PURE__ */ d.createElement("div", null, Ct(a, "lmnt-modal__button")), /* @__PURE__ */ d.createElement("div", null, b(T, {
|
|
915
916
|
className: "lmnt-modal__button",
|
|
916
917
|
"data-mdc-dialog-initial-focus": !0
|
|
917
918
|
})))))), /* @__PURE__ */ d.createElement("div", {
|
|
918
919
|
className: "mdc-dialog__scrim"
|
|
919
920
|
}));
|
|
920
921
|
});
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
const
|
|
925
|
-
modal:
|
|
926
|
-
title:
|
|
927
|
-
titleWithoutCloseIcon:
|
|
928
|
-
|
|
922
|
+
k.displayName = "Modal";
|
|
923
|
+
k.propTypes = Pt;
|
|
924
|
+
k.defaultProps = Ut;
|
|
925
|
+
const xt = "_modal_fr8bw_1", Gt = "_title_fr8bw_6", Kt = "_titleWithoutCloseIcon_fr8bw_18", Wt = "_closeButton_fr8bw_22", w = {
|
|
926
|
+
modal: xt,
|
|
927
|
+
title: Gt,
|
|
928
|
+
titleWithoutCloseIcon: Kt,
|
|
929
|
+
closeButton: Wt
|
|
930
|
+
}, ie = ({
|
|
929
931
|
onClose: i,
|
|
930
932
|
title: e,
|
|
931
933
|
headerActions: t,
|
|
932
934
|
hideCloseIcon: n,
|
|
933
935
|
leadingIcon: o,
|
|
934
|
-
|
|
936
|
+
isOnline: a = !0,
|
|
937
|
+
offlineViewProps: f,
|
|
938
|
+
children: p,
|
|
939
|
+
...S
|
|
935
940
|
}) => {
|
|
936
|
-
const
|
|
937
|
-
const
|
|
938
|
-
!n && /* @__PURE__ */
|
|
939
|
-
o ? /* @__PURE__ */
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
+
const h = Y(() => {
|
|
942
|
+
const E = /* @__PURE__ */ ft(z, { primaryAlign: "center", secondaryAlign: "center", children: [
|
|
943
|
+
!n && /* @__PURE__ */ C(it, { icon: "close", onClick: () => i?.(), type: "button", className: w.closeButton }),
|
|
944
|
+
o ? /* @__PURE__ */ C(Dt, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ C(Nt, { icon: o }) }) : /* @__PURE__ */ C(pt, {}),
|
|
945
|
+
/* @__PURE__ */ C(
|
|
941
946
|
It,
|
|
942
947
|
{
|
|
943
948
|
level: 6,
|
|
944
|
-
className: n && !o ?
|
|
949
|
+
className: n && !o ? w.titleWithoutCloseIcon : "",
|
|
945
950
|
children: e
|
|
946
951
|
}
|
|
947
952
|
)
|
|
948
953
|
] }, "base-group");
|
|
949
|
-
return t ? Array.isArray(t) ? [
|
|
954
|
+
return t ? Array.isArray(t) ? [E, /* @__PURE__ */ C(z, { children: t }, "action-group")] : [E, t] : E;
|
|
950
955
|
}, [t, n, o, i, e]);
|
|
951
|
-
return /* @__PURE__ */
|
|
952
|
-
|
|
956
|
+
return /* @__PURE__ */ C(
|
|
957
|
+
k,
|
|
953
958
|
{
|
|
954
|
-
...
|
|
959
|
+
...S,
|
|
955
960
|
"data-testid": "modal",
|
|
956
|
-
className: `${
|
|
961
|
+
className: `${w.modal} ${w.title} ${S.className ?? ""}`,
|
|
957
962
|
hideCloseIcon: !0,
|
|
958
|
-
headerActions: /* @__PURE__ */
|
|
959
|
-
preventClose: !0
|
|
963
|
+
headerActions: /* @__PURE__ */ C(z, { primaryAlign: "space-between", secondaryAlign: "center", children: h }, "header-group"),
|
|
964
|
+
preventClose: !0,
|
|
965
|
+
children: a ? p : /* @__PURE__ */ C(Lt, { ...f })
|
|
960
966
|
}
|
|
961
967
|
);
|
|
962
968
|
};
|
|
963
969
|
export {
|
|
964
|
-
|
|
970
|
+
ie as Modal
|
|
965
971
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { P as r } from "../../index.es-D-CKRzIB.js";
|
|
3
|
-
import "react";
|
|
4
3
|
import "../../isEmpty-B4GG2s-V.js";
|
|
4
|
+
import "react";
|
|
5
5
|
import { u as d } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
6
6
|
import "../../react-tooltip.min-DSY6KDqS.js";
|
|
7
7
|
import "../../orderBy-Bd48bw88.js";
|