@hortiview/shared-components 2.22.0 → 2.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/assets/BaseView.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/components/BaseView/BaseView.js +37 -37
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.d.ts +14 -2
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +5233 -5223
- package/dist/components/FormComponents/FormDatePicker/FormDatePickerService.d.ts +40 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePickerService.js +9 -0
- package/dist/components/Modal/Modal.js +104 -104
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a local date-only value into the persisted UTC representation.
|
|
3
|
+
*
|
|
4
|
+
* Reads the local year/month/day from the provided Date and returns a new Date at
|
|
5
|
+
* 00:00:00.000 UTC for that same calendar day.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* - User selects "2025-03-15" in their local timezone
|
|
9
|
+
* - Stored value becomes 2025-03-15T00:00:00.000Z
|
|
10
|
+
*
|
|
11
|
+
* This helper is intended for date-only values, not datetime values.
|
|
12
|
+
*/
|
|
13
|
+
export declare const convertToUtcFromLocalDate: (date: Date | number) => Date;
|
|
14
|
+
/**
|
|
15
|
+
* Converts the persisted UTC date-only value into a local Date for display in the picker.
|
|
16
|
+
*
|
|
17
|
+
* Reads the UTC year/month/day from the stored value and creates a new local Date with the
|
|
18
|
+
* same visible calendar date.
|
|
19
|
+
*
|
|
20
|
+
* Example:
|
|
21
|
+
* - Stored value is 2025-03-15T00:00:00.000Z
|
|
22
|
+
* - Picker receives a local Date representing "2025-03-15"
|
|
23
|
+
*
|
|
24
|
+
* This helper is intended for date-only values, not datetime values.
|
|
25
|
+
*/
|
|
26
|
+
export declare const convertToLocalDateFromUtc: (date: Date | number) => Date;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the corresponding date in a newly selected month or year.
|
|
29
|
+
*
|
|
30
|
+
* Rules:
|
|
31
|
+
* - Preserve the original day-of-month when possible.
|
|
32
|
+
* - If the target month does not contain that day, clamp to the last valid day
|
|
33
|
+
* of the target month.
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
* - 2025-01-15 -> February => 2025-02-15
|
|
37
|
+
* - 2025-01-31 -> February => 2025-02-28
|
|
38
|
+
* - 2025-02-28 -> March => 2025-03-28
|
|
39
|
+
*/
|
|
40
|
+
export declare const getSameDayInNextOrPreviousMonth: (currentUtcDate: Date, newMonthOrYearUtcDate: Date) => Date;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const g = (t) => t instanceof Date ? new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate())) : new Date(Date.UTC(t)), c = (t) => t instanceof Date ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : new Date(t), T = (t, e) => {
|
|
2
|
+
const o = t.getUTCDate(), n = e.getUTCFullYear(), a = e.getUTCMonth(), r = new Date(Date.UTC(n, a + 1, 0)).getUTCDate(), D = Math.min(o, r);
|
|
3
|
+
return new Date(Date.UTC(n, a, D));
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
c as convertToLocalDateFromUtc,
|
|
7
|
+
g as convertToUtcFromLocalDate,
|
|
8
|
+
T as getSameDayInNextOrPreviousMonth
|
|
9
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as g,
|
|
2
|
-
import { G as
|
|
1
|
+
import { jsx as g, Fragment as Rt, jsxs as wt } from "react/jsx-runtime";
|
|
2
|
+
import { G as U } from "../../index.es-Z0aF-7Cn.js";
|
|
3
3
|
import { I as $t } from "../../index.es-CkB4776y.js";
|
|
4
|
-
import { _ as Qt, a as Xt, c as
|
|
4
|
+
import { _ as Qt, a as Xt, c as G, P as s } from "../../index-Df2FYN-K.js";
|
|
5
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
|
|
6
|
+
import m, { forwardRef as Zt, useRef as Mt, useImperativeHandle as te, useState as Pt, useEffect as v, useCallback as Z, useMemo as nt, Fragment as ee } from "react";
|
|
7
7
|
import { w as Ht, r as ne, c as D, a as oe } from "../../index.es-C6I3L4U4.js";
|
|
8
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
|
-
import { M as
|
|
10
|
+
import { M as le, c as se, m as ce } from "../../component-DYpB_4EP.js";
|
|
11
11
|
import { A as de } from "../../animationframe-CqXArbwZ.js";
|
|
12
12
|
import { P as ue } from "../../index.es-DgncYOqO.js";
|
|
13
13
|
import { b as me } from "../../index.es-DUrjyxNI.js";
|
|
@@ -23,10 +23,10 @@ function _e(o) {
|
|
|
23
23
|
function Ce(o) {
|
|
24
24
|
return o ? o.scrollTop === 0 : !1;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ve(o) {
|
|
27
27
|
return o ? Math.ceil(o.scrollHeight - o.scrollTop) === o.clientHeight : !1;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ee(o) {
|
|
30
30
|
var e = /* @__PURE__ */ new Set();
|
|
31
31
|
return [].forEach.call(o, function(t) {
|
|
32
32
|
return e.add(t.offsetTop);
|
|
@@ -75,7 +75,7 @@ var tt = "mdc-dom-focus-sentinel", Se = (
|
|
|
75
75
|
}, o;
|
|
76
76
|
})()
|
|
77
77
|
);
|
|
78
|
-
var
|
|
78
|
+
var l = {
|
|
79
79
|
CLOSING: "mdc-dialog--closing",
|
|
80
80
|
OPEN: "mdc-dialog--open",
|
|
81
81
|
OPENING: "mdc-dialog--opening",
|
|
@@ -132,10 +132,10 @@ var s = {
|
|
|
132
132
|
DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
|
|
133
133
|
DIALOG_ANIMATION_OPEN_TIME_MS: 150
|
|
134
134
|
};
|
|
135
|
-
var
|
|
135
|
+
var K;
|
|
136
136
|
(function(o) {
|
|
137
137
|
o.POLL_SCROLL_POS = "poll_scroll_position", o.POLL_LAYOUT_CHANGE = "poll_layout_change";
|
|
138
|
-
})(
|
|
138
|
+
})(K || (K = {}));
|
|
139
139
|
var Gt = (
|
|
140
140
|
/** @class */
|
|
141
141
|
(function(o) {
|
|
@@ -152,7 +152,7 @@ var Gt = (
|
|
|
152
152
|
}
|
|
153
153
|
return Object.defineProperty(e, "cssClasses", {
|
|
154
154
|
get: function() {
|
|
155
|
-
return
|
|
155
|
+
return l;
|
|
156
156
|
},
|
|
157
157
|
enumerable: !1,
|
|
158
158
|
configurable: !0
|
|
@@ -232,30 +232,30 @@ var Gt = (
|
|
|
232
232
|
enumerable: !1,
|
|
233
233
|
configurable: !0
|
|
234
234
|
}), e.prototype.init = function() {
|
|
235
|
-
this.adapter.hasClass(
|
|
235
|
+
this.adapter.hasClass(l.STACKED) && this.setAutoStackButtons(!1), this.isFullscreen = this.adapter.hasClass(l.FULLSCREEN);
|
|
236
236
|
}, e.prototype.destroy = function() {
|
|
237
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);
|
|
238
238
|
}, e.prototype.open = function(t) {
|
|
239
239
|
var n = this;
|
|
240
|
-
this.dialogOpen = !0, this.adapter.notifyOpening(), this.adapter.addClass(
|
|
241
|
-
n.adapter.addClass(
|
|
240
|
+
this.dialogOpen = !0, this.adapter.notifyOpening(), this.adapter.addClass(l.OPENING), this.isFullscreen && this.adapter.registerContentEventHandler("scroll", this.contentScrollHandler), t && t.isAboveFullscreenDialog && this.adapter.addClass(l.SCRIM_HIDDEN), this.adapter.registerWindowEventHandler("resize", this.windowResizeHandler), this.adapter.registerWindowEventHandler("orientationchange", this.windowOrientationChangeHandler), this.runNextAnimationFrame(function() {
|
|
241
|
+
n.adapter.addClass(l.OPEN), n.adapter.addBodyClass(l.SCROLL_LOCK), n.layout(), n.animationTimer = setTimeout(function() {
|
|
242
242
|
n.handleAnimationTimerEnd(), n.adapter.trapFocus(n.adapter.getInitialFocusEl()), n.adapter.notifyOpened();
|
|
243
243
|
}, et.DIALOG_ANIMATION_OPEN_TIME_MS);
|
|
244
244
|
});
|
|
245
245
|
}, e.prototype.close = function(t) {
|
|
246
246
|
var n = this;
|
|
247
|
-
t === void 0 && (t = ""), this.dialogOpen && (this.dialogOpen = !1, this.adapter.notifyClosing(t), this.adapter.addClass(
|
|
247
|
+
t === void 0 && (t = ""), this.dialogOpen && (this.dialogOpen = !1, this.adapter.notifyClosing(t), this.adapter.addClass(l.CLOSING), this.adapter.removeClass(l.OPEN), this.adapter.removeBodyClass(l.SCROLL_LOCK), this.isFullscreen && this.adapter.deregisterContentEventHandler("scroll", this.contentScrollHandler), this.adapter.deregisterWindowEventHandler("resize", this.windowResizeHandler), this.adapter.deregisterWindowEventHandler("orientationchange", this.windowOrientationChangeHandler), cancelAnimationFrame(this.animationFrame), this.animationFrame = 0, clearTimeout(this.animationTimer), this.animationTimer = setTimeout(function() {
|
|
248
248
|
n.adapter.releaseFocus(), n.handleAnimationTimerEnd(), n.adapter.notifyClosed(t);
|
|
249
249
|
}, et.DIALOG_ANIMATION_CLOSE_TIME_MS));
|
|
250
250
|
}, e.prototype.showSurfaceScrim = function() {
|
|
251
251
|
var t = this;
|
|
252
|
-
this.adapter.addClass(
|
|
253
|
-
t.adapter.addClass(
|
|
252
|
+
this.adapter.addClass(l.SURFACE_SCRIM_SHOWING), this.runNextAnimationFrame(function() {
|
|
253
|
+
t.adapter.addClass(l.SURFACE_SCRIM_SHOWN);
|
|
254
254
|
});
|
|
255
255
|
}, e.prototype.hideSurfaceScrim = function() {
|
|
256
|
-
this.adapter.removeClass(
|
|
256
|
+
this.adapter.removeClass(l.SURFACE_SCRIM_SHOWN), this.adapter.addClass(l.SURFACE_SCRIM_HIDING);
|
|
257
257
|
}, e.prototype.handleSurfaceScrimTransitionEnd = function() {
|
|
258
|
-
this.adapter.removeClass(
|
|
258
|
+
this.adapter.removeClass(l.SURFACE_SCRIM_HIDING), this.adapter.removeClass(l.SURFACE_SCRIM_SHOWING);
|
|
259
259
|
}, e.prototype.isOpen = function() {
|
|
260
260
|
return this.dialogOpen;
|
|
261
261
|
}, e.prototype.getEscapeKeyAction = function() {
|
|
@@ -276,7 +276,7 @@ var Gt = (
|
|
|
276
276
|
this.suppressDefaultPressSelector = t;
|
|
277
277
|
}, e.prototype.layout = function() {
|
|
278
278
|
var t = this;
|
|
279
|
-
this.animFrame.request(
|
|
279
|
+
this.animFrame.request(K.POLL_LAYOUT_CHANGE, function() {
|
|
280
280
|
t.layoutInternal();
|
|
281
281
|
});
|
|
282
282
|
}, e.prototype.handleClick = function(t) {
|
|
@@ -301,28 +301,28 @@ var Gt = (
|
|
|
301
301
|
n && this.escapeKeyAction !== "" && this.close(this.escapeKeyAction);
|
|
302
302
|
}, e.prototype.handleScrollEvent = function() {
|
|
303
303
|
var t = this;
|
|
304
|
-
this.animFrame.request(
|
|
304
|
+
this.animFrame.request(K.POLL_SCROLL_POS, function() {
|
|
305
305
|
t.toggleScrollDividerHeader(), t.toggleScrollDividerFooter();
|
|
306
306
|
});
|
|
307
307
|
}, e.prototype.layoutInternal = function() {
|
|
308
308
|
this.autoStackButtons && this.detectStackedButtons(), this.toggleScrollableClasses();
|
|
309
309
|
}, e.prototype.handleAnimationTimerEnd = function() {
|
|
310
|
-
this.animationTimer = 0, this.adapter.removeClass(
|
|
310
|
+
this.animationTimer = 0, this.adapter.removeClass(l.OPENING), this.adapter.removeClass(l.CLOSING);
|
|
311
311
|
}, e.prototype.runNextAnimationFrame = function(t) {
|
|
312
312
|
var n = this;
|
|
313
313
|
cancelAnimationFrame(this.animationFrame), this.animationFrame = requestAnimationFrame(function() {
|
|
314
314
|
n.animationFrame = 0, clearTimeout(n.animationTimer), n.animationTimer = setTimeout(t, 0);
|
|
315
315
|
});
|
|
316
316
|
}, e.prototype.detectStackedButtons = function() {
|
|
317
|
-
this.adapter.removeClass(
|
|
317
|
+
this.adapter.removeClass(l.STACKED);
|
|
318
318
|
var t = this.adapter.areButtonsStacked();
|
|
319
|
-
t && this.adapter.addClass(
|
|
319
|
+
t && this.adapter.addClass(l.STACKED), t !== this.areButtonsStacked && (this.adapter.reverseButtons(), this.areButtonsStacked = t);
|
|
320
320
|
}, e.prototype.toggleScrollableClasses = function() {
|
|
321
|
-
this.adapter.removeClass(
|
|
321
|
+
this.adapter.removeClass(l.SCROLLABLE), this.adapter.isContentScrollable() && (this.adapter.addClass(l.SCROLLABLE), this.isFullscreen && (this.toggleScrollDividerHeader(), this.toggleScrollDividerFooter()));
|
|
322
322
|
}, e.prototype.toggleScrollDividerHeader = function() {
|
|
323
|
-
this.adapter.isScrollableContentAtTop() ? this.adapter.hasClass(
|
|
323
|
+
this.adapter.isScrollableContentAtTop() ? this.adapter.hasClass(l.SCROLL_DIVIDER_HEADER) && this.adapter.removeClass(l.SCROLL_DIVIDER_HEADER) : this.adapter.addClass(l.SCROLL_DIVIDER_HEADER);
|
|
324
324
|
}, e.prototype.toggleScrollDividerFooter = function() {
|
|
325
|
-
this.adapter.isScrollableContentAtBottom() ? this.adapter.hasClass(
|
|
325
|
+
this.adapter.isScrollableContentAtBottom() ? this.adapter.hasClass(l.SCROLL_DIVIDER_FOOTER) && this.adapter.removeClass(l.SCROLL_DIVIDER_FOOTER) : this.adapter.addClass(l.SCROLL_DIVIDER_FOOTER);
|
|
326
326
|
}, e;
|
|
327
327
|
})(ae)
|
|
328
328
|
);
|
|
@@ -380,7 +380,7 @@ var f = Gt.strings, ye = (
|
|
|
380
380
|
try {
|
|
381
381
|
for (var u = ie(this.buttons), h = u.next(); !h.done; h = u.next()) {
|
|
382
382
|
var O = h.value;
|
|
383
|
-
this.buttonRipples.push(new
|
|
383
|
+
this.buttonRipples.push(new le(O));
|
|
384
384
|
}
|
|
385
385
|
} catch (_) {
|
|
386
386
|
n = { error: _ };
|
|
@@ -417,7 +417,7 @@ var f = Gt.strings, ye = (
|
|
|
417
417
|
return t.root.classList.add(i);
|
|
418
418
|
},
|
|
419
419
|
areButtonsStacked: function() {
|
|
420
|
-
return
|
|
420
|
+
return Ee(t.buttons);
|
|
421
421
|
},
|
|
422
422
|
clickDefaultButton: function() {
|
|
423
423
|
t.defaultButton && t.defaultButton.click();
|
|
@@ -428,7 +428,7 @@ var f = Gt.strings, ye = (
|
|
|
428
428
|
getActionFromEvent: function(i) {
|
|
429
429
|
if (!i.target)
|
|
430
430
|
return "";
|
|
431
|
-
var a =
|
|
431
|
+
var a = se(i.target, "[" + f.ACTION_ATTRIBUTE + "]");
|
|
432
432
|
return a && a.getAttribute(f.ACTION_ATTRIBUTE);
|
|
433
433
|
},
|
|
434
434
|
getInitialFocusEl: function() {
|
|
@@ -479,7 +479,7 @@ var f = Gt.strings, ye = (
|
|
|
479
479
|
return Ce(t.content);
|
|
480
480
|
},
|
|
481
481
|
isScrollableContentAtBottom: function() {
|
|
482
|
-
return
|
|
482
|
+
return ve(t.content);
|
|
483
483
|
},
|
|
484
484
|
registerWindowEventHandler: function(i, a) {
|
|
485
485
|
window.addEventListener(i, a);
|
|
@@ -499,163 +499,163 @@ var f = Gt.strings, ye = (
|
|
|
499
499
|
*
|
|
500
500
|
* Defaults to **null**.
|
|
501
501
|
*/
|
|
502
|
-
actionButton:
|
|
502
|
+
actionButton: s.node,
|
|
503
503
|
/**
|
|
504
504
|
* Button for any navigating to the previous page in a Directional modal.
|
|
505
505
|
*
|
|
506
506
|
* Defaults to **null**.
|
|
507
507
|
*/
|
|
508
|
-
backButton:
|
|
508
|
+
backButton: s.node,
|
|
509
509
|
/**
|
|
510
510
|
* The custom modal label badge to be rendered.
|
|
511
511
|
*
|
|
512
512
|
* Defaults to **undefined**.
|
|
513
513
|
*/
|
|
514
|
-
badge:
|
|
514
|
+
badge: s.node,
|
|
515
515
|
/**
|
|
516
516
|
* Accepts any valid markup. Optionally, `content` may be used instead. If `content` and `children` are both set, `content` will take priority.
|
|
517
517
|
*
|
|
518
518
|
* Defaults to **null**.
|
|
519
519
|
*/
|
|
520
|
-
children:
|
|
520
|
+
children: s.node,
|
|
521
521
|
/**
|
|
522
522
|
* Primary content of the dialog. Accepts any valid markup. Optionally, `children` may be used instead. If content and `children` are both set, content will take priority.
|
|
523
523
|
*
|
|
524
524
|
* Defaults to **null**.
|
|
525
525
|
*/
|
|
526
|
-
content:
|
|
526
|
+
content: s.node,
|
|
527
527
|
/**
|
|
528
528
|
* Button that is the default action, triggered by pressing the Enter key.
|
|
529
529
|
*
|
|
530
530
|
* Defaults to **'primary'**.
|
|
531
531
|
*/
|
|
532
|
-
defaultButton:
|
|
532
|
+
defaultButton: s.oneOf(["close", "primary", "action", "footerSupplemental"]),
|
|
533
533
|
/**
|
|
534
534
|
* Button to cancel or close the modal.
|
|
535
535
|
*
|
|
536
536
|
* Defaults to **null**.
|
|
537
537
|
*/
|
|
538
|
-
dismissiveButton:
|
|
538
|
+
dismissiveButton: s.node,
|
|
539
539
|
/**
|
|
540
540
|
* Button to be displayed in left corner of the modal footer. Should be a text button.
|
|
541
541
|
*
|
|
542
542
|
* Defaults to **null**.
|
|
543
543
|
*/
|
|
544
|
-
footerSupplemental:
|
|
544
|
+
footerSupplemental: s.node,
|
|
545
545
|
/**
|
|
546
546
|
* Content to be displayed in right corner of the modal header. Should be a text button or a group of up to 3 icon buttons.
|
|
547
547
|
*
|
|
548
548
|
* Defaults to **null**.
|
|
549
549
|
*/
|
|
550
|
-
headerActions:
|
|
550
|
+
headerActions: s.node,
|
|
551
551
|
/**
|
|
552
552
|
* If true, the close icon in the upper left corner will not be rendered.
|
|
553
553
|
*
|
|
554
554
|
* Defaults to **false**.
|
|
555
555
|
*/
|
|
556
|
-
hideCloseIcon:
|
|
556
|
+
hideCloseIcon: s.bool,
|
|
557
557
|
/**
|
|
558
558
|
* A slot for StepperIndicator.
|
|
559
559
|
*
|
|
560
560
|
* Defaults to **null**.
|
|
561
561
|
*/
|
|
562
|
-
indicator:
|
|
562
|
+
indicator: s.node,
|
|
563
563
|
/**
|
|
564
564
|
* Button to initially focus on after the dialog has opened. If left null, the initial focus will be on the first focusable element in the modal. As an alternative you can add the prop `data-mdc-dialog-initial-focus='true'` to any element within the modal to make that element the initial focus. If it is a directional modal, the initial focus will be on the nextButton.
|
|
565
565
|
*
|
|
566
566
|
* Defaults to **null**.
|
|
567
567
|
*/
|
|
568
|
-
initialFocus:
|
|
568
|
+
initialFocus: s.oneOf(["null", "primary", "action", "footerSupplemental"]),
|
|
569
569
|
/**
|
|
570
570
|
* If true, the buttons in the footer will be full width and stacked on mobile.
|
|
571
571
|
*
|
|
572
572
|
* Defaults to **false**.
|
|
573
573
|
*/
|
|
574
|
-
mobileStackedButtons:
|
|
574
|
+
mobileStackedButtons: s.bool,
|
|
575
575
|
/**
|
|
576
576
|
* String to determine the size of the modal.
|
|
577
577
|
*
|
|
578
578
|
* Defaults to **'max'**.
|
|
579
579
|
*/
|
|
580
|
-
modalSize:
|
|
580
|
+
modalSize: s.oneOf(["fullscreen", "max", "xlarge", "large", "medium", "small", "dialog"]),
|
|
581
581
|
/**
|
|
582
582
|
* Button for navigating to the next page in a Directional modal or closing on the last page.
|
|
583
583
|
*
|
|
584
584
|
* Defaults to **null**.
|
|
585
585
|
*/
|
|
586
|
-
nextButton:
|
|
586
|
+
nextButton: s.node,
|
|
587
587
|
/**
|
|
588
588
|
* Set to true if the modal will not have any actions. Should be used sparingly and the modal should be closed programmatically. For example, can be used to stop the user from interacting or navigating away while a payment is processing.
|
|
589
589
|
*
|
|
590
590
|
* Defaults to **null**.
|
|
591
591
|
*/
|
|
592
|
-
noActions:
|
|
592
|
+
noActions: s.bool,
|
|
593
593
|
/**
|
|
594
594
|
* Fired when the Dialog begins its closing animation. Where event.detail.action is the action which closed the dialog (close or accept).
|
|
595
595
|
*
|
|
596
596
|
* Defaults to **null**.
|
|
597
597
|
*/
|
|
598
|
-
onClose:
|
|
598
|
+
onClose: s.func,
|
|
599
599
|
/**
|
|
600
600
|
* Fired when the Dialog finishes its closing animation. Where event.detail.action is the action which closed the dialog (close or accept).
|
|
601
601
|
*
|
|
602
602
|
* Defaults to **null**.
|
|
603
603
|
*/
|
|
604
|
-
onClosed:
|
|
604
|
+
onClosed: s.func,
|
|
605
605
|
/**
|
|
606
606
|
* Fired when the Dialog begins its opening animation.
|
|
607
607
|
*
|
|
608
608
|
* Defaults to **null**.
|
|
609
609
|
*/
|
|
610
|
-
onOpen:
|
|
610
|
+
onOpen: s.func,
|
|
611
611
|
/**
|
|
612
612
|
* Fired when the Dialog finishes its opening animation.
|
|
613
613
|
*
|
|
614
614
|
* Defaults to **null**.
|
|
615
615
|
*/
|
|
616
|
-
onOpened:
|
|
616
|
+
onOpened: s.func,
|
|
617
617
|
/**
|
|
618
618
|
* If true, the Modal will be visible on screen.
|
|
619
619
|
*
|
|
620
620
|
* Defaults to **false**.
|
|
621
621
|
*/
|
|
622
|
-
open:
|
|
622
|
+
open: s.bool,
|
|
623
623
|
/**
|
|
624
624
|
* Prevents the user from closing the dialog by hitting escape or clicking the scrim. Use caution when using this as the modal should always have a way for the user to close it.
|
|
625
625
|
*
|
|
626
626
|
* Defaults to **false**.
|
|
627
627
|
*/
|
|
628
|
-
preventClose:
|
|
628
|
+
preventClose: s.bool,
|
|
629
629
|
/**
|
|
630
630
|
* Prevents the default behavior which adds an event listener for the Enter key to the Primary button. Any onEnter/submission behavior will need to be added by the developer (including closing the Modal).
|
|
631
631
|
*
|
|
632
632
|
* Defaults to **false**.
|
|
633
633
|
*/
|
|
634
|
-
preventPrimaryAccept:
|
|
634
|
+
preventPrimaryAccept: s.bool,
|
|
635
635
|
/**
|
|
636
636
|
* Button for the primary action of the modal.
|
|
637
637
|
*
|
|
638
638
|
* Defaults to **null**.
|
|
639
639
|
*/
|
|
640
|
-
primaryButton:
|
|
640
|
+
primaryButton: s.node,
|
|
641
641
|
/**
|
|
642
642
|
* DOM selector to provide a target to return focus. Accepts any valid _query_ (see mdn docs for Element.querySelector). If omitted focus will return to the last focused element upon closing.
|
|
643
643
|
*
|
|
644
644
|
* Defaults to **null**.
|
|
645
645
|
*/
|
|
646
|
-
returnFocusSelector:
|
|
646
|
+
returnFocusSelector: s.string,
|
|
647
647
|
/**
|
|
648
648
|
* If true, wrapping will be disabled and a scrollable area will be created.
|
|
649
649
|
*
|
|
650
650
|
* Defaults to **false**.
|
|
651
651
|
*/
|
|
652
|
-
scrollable:
|
|
652
|
+
scrollable: s.bool,
|
|
653
653
|
/**
|
|
654
654
|
* String for the modal title.
|
|
655
655
|
*
|
|
656
656
|
* Defaults to **null**.
|
|
657
657
|
*/
|
|
658
|
-
title:
|
|
658
|
+
title: s.string
|
|
659
659
|
}, Ae = {
|
|
660
660
|
actionButton: null,
|
|
661
661
|
backButton: null,
|
|
@@ -685,58 +685,58 @@ var f = Gt.strings, ye = (
|
|
|
685
685
|
scrollable: !1,
|
|
686
686
|
title: null
|
|
687
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,
|
|
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, W = T === void 0 ? r.className : T, E = o.content, L = E === void 0 ? r.content : E, it = o.defaultButton, b = it === void 0 ? r.defaultButton : it, at = o.dismissiveButton, R = at === void 0 ? r.dismissiveButton : at, rt = o.footerSupplemental, w = rt === void 0 ? r.footerSupplemental : rt, lt = o.headerActions, st = lt === void 0 ? r.headerActions : lt, ct = o.hideCloseIcon, V = ct === void 0 ? r.hideCloseIcon : ct, dt = o.indicator, Kt = dt === void 0 ? r.indicator : dt, ut = o.initialFocus, I = ut === void 0 ? r.initialFocus : ut, mt = o.mobileStackedButtons, z = 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, j = gt === void 0 ? r.onClose : gt, _t = o.onClosed, q = _t === void 0 ? r.onClosed : _t, Ct = o.onOpen, k = Ct === void 0 ? r.onOpen : Ct, vt = o.onOpened, M = vt === void 0 ? r.onOpened : vt, Et = o.open, St = Et === void 0 ? r.open : Et, yt = o.preventClose, Y = yt === void 0 ? r.preventClose : yt, Ot = o.preventPrimaryAccept, At = Ot === void 0 ? r.preventPrimaryAccept : Ot, Tt = o.primaryButton, d = Tt === void 0 ? r.primaryButton : Tt, bt = o.returnFocusSelector, J = 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();
|
|
689
689
|
te(e, function() {
|
|
690
690
|
return P.current;
|
|
691
691
|
}, []);
|
|
692
|
-
var Vt = Pt(), Ft = kt(Vt, 2),
|
|
692
|
+
var Vt = Pt(), Ft = kt(Vt, 2), Q = Ft[0], zt = Ft[1], jt = Pt(function() {
|
|
693
693
|
return N || _;
|
|
694
|
-
}), Lt = kt(jt, 2),
|
|
695
|
-
|
|
694
|
+
}), Lt = kt(jt, 2), X = Lt[0], qt = Lt[1];
|
|
695
|
+
v(function() {
|
|
696
696
|
qt(N || _);
|
|
697
697
|
}, [N, _]);
|
|
698
698
|
var H = Z(function() {
|
|
699
699
|
Ht() && zt(window.innerWidth <= 600);
|
|
700
700
|
}, []);
|
|
701
|
-
|
|
701
|
+
v(function() {
|
|
702
702
|
return Ht() ? (H(), window.addEventListener("resize", H), function() {
|
|
703
703
|
window.removeEventListener("resize", H);
|
|
704
704
|
}) : function() {
|
|
705
705
|
};
|
|
706
|
-
}, [H]),
|
|
706
|
+
}, [H]), v(function() {
|
|
707
707
|
return c.current = ye.attachTo(P.current), function() {
|
|
708
708
|
c.current.destroy();
|
|
709
709
|
};
|
|
710
|
-
}, [c, P]),
|
|
711
|
-
c.current.foundation.setAutoStackButtons(
|
|
712
|
-
}, [
|
|
710
|
+
}, [c, P]), v(function() {
|
|
711
|
+
c.current.foundation.setAutoStackButtons(z);
|
|
712
|
+
}, [z]), v(function() {
|
|
713
713
|
B && (c.current.foundation.adapter.trapFocus = function() {
|
|
714
714
|
});
|
|
715
|
-
}, [B]),
|
|
716
|
-
c.current.scrimClickAction =
|
|
717
|
-
}, [
|
|
715
|
+
}, [B]), v(function() {
|
|
716
|
+
c.current.scrimClickAction = Y ? "" : "close", c.current.escapeKeyAction = Y ? "" : "close";
|
|
717
|
+
}, [Y]);
|
|
718
718
|
var x = Z(function(p) {
|
|
719
|
-
|
|
720
|
-
}, [
|
|
721
|
-
|
|
722
|
-
}, [
|
|
723
|
-
|
|
719
|
+
j && j(p);
|
|
720
|
+
}, [j]), $ = Z(function(p) {
|
|
721
|
+
J && ne(J), q && q(p);
|
|
722
|
+
}, [J, q]);
|
|
723
|
+
v(function() {
|
|
724
724
|
return c.current.unlisten("MDCDialog: opening", k), c.current.listen("MDCDialog: opening", k), function() {
|
|
725
725
|
c.current.unlisten("MDCDialog: opening", k);
|
|
726
726
|
};
|
|
727
|
-
}, [c, k]),
|
|
727
|
+
}, [c, k]), v(function() {
|
|
728
728
|
return c.current.unlisten("MDCDialog:opened", M), c.current.listen("MDCDialog:opened", M), function() {
|
|
729
729
|
c.current.unlisten("MDCDialog:opened", M);
|
|
730
730
|
};
|
|
731
|
-
}, [c, M]),
|
|
731
|
+
}, [c, M]), v(function() {
|
|
732
732
|
return c.current.unlisten("MDCDialog:closing", x), c.current.listen("MDCDialog:closing", x), function() {
|
|
733
733
|
c.current.unlisten("MDCDialog:closing", x);
|
|
734
734
|
};
|
|
735
|
-
}, [c, x]),
|
|
735
|
+
}, [c, x]), v(function() {
|
|
736
736
|
return c.current.unlisten("MDCDialog:closed", $), c.current.listen("MDCDialog:closed", $), function() {
|
|
737
737
|
c.current.unlisten("MDCDialog:closed", $);
|
|
738
738
|
};
|
|
739
|
-
}, [c, $]),
|
|
739
|
+
}, [c, $]), v(function() {
|
|
740
740
|
St ? c.current.open() : c.current.close();
|
|
741
741
|
}, [c, St]);
|
|
742
742
|
var Yt = nt(function() {
|
|
@@ -761,21 +761,21 @@ var f = Gt.strings, ye = (
|
|
|
761
761
|
}, [At, b, I, d?.props.elevation, d?.props.variant]);
|
|
762
762
|
return /* @__PURE__ */ m.createElement("aside", Xt({
|
|
763
763
|
ref: P,
|
|
764
|
-
className:
|
|
764
|
+
className: G("lmnt", "lmnt-modal", "mdc-dialog", Nt && "lmnt-modal--scrollable mdc-dialog--scrollable", W),
|
|
765
765
|
role: "alertdialog"
|
|
766
766
|
}, Wt), /* @__PURE__ */ m.createElement("div", {
|
|
767
|
-
className:
|
|
767
|
+
className: G("lmnt-modal__container", "mdc-dialog__container", C === "fullscreen" && "mdc-dialog--fullscreen", C === "max" && "lmnt-modal__max", C === "xlarge" && "lmnt-modal__xl", C === "large" && "lmnt-modal__lg", C === "medium" && "lmnt-modal__md", C === "small" && "lmnt-modal__sm", (C === "mobile" || Q) && "lmnt-modal__mobile", C === "dialog" && "lmnt-modal__dialog", B && "lmnt-modal-no-actions")
|
|
768
768
|
}, /* @__PURE__ */ m.createElement("div", {
|
|
769
769
|
className: "lmnt-modal__surface mdc-dialog__surface"
|
|
770
770
|
}, /* @__PURE__ */ m.createElement("header", {
|
|
771
|
-
className:
|
|
772
|
-
}, !
|
|
771
|
+
className: G("lmnt-modal__title", "mdc-dialog__title", (C === "dialog" || V) && "lmnt-modal_title-hide-close-icon", a && "lmnt-modal_title-actionsIcons", Nt && "lmnt-modal__title-scrollable", (V || C === "dialog" || B) && "lmnt-modal--no-close-icon")
|
|
772
|
+
}, !V && C !== "dialog" && !B && /* @__PURE__ */ m.createElement($t, {
|
|
773
773
|
className: "mdc-icon-button material-icons mdc-dialog__close",
|
|
774
774
|
"data-mdc-dialog-action": "close",
|
|
775
775
|
icon: "clear"
|
|
776
|
-
}), Dt && /* @__PURE__ */ m.createElement("div", null, Dt),
|
|
776
|
+
}), Dt && /* @__PURE__ */ m.createElement("div", null, Dt), st && /* @__PURE__ */ m.createElement("div", {
|
|
777
777
|
className: "lmnt-dialog__title-actions"
|
|
778
|
-
},
|
|
778
|
+
}, st), h && /* @__PURE__ */ m.createElement("div", {
|
|
779
779
|
className: "lmnt-badge--modal",
|
|
780
780
|
style: {
|
|
781
781
|
marginLeft: "0"
|
|
@@ -783,19 +783,19 @@ var f = Gt.strings, ye = (
|
|
|
783
783
|
}, h)), (L || F) && /* @__PURE__ */ m.createElement("section", {
|
|
784
784
|
className: "lmnt-modal__content mdc-dialog__content"
|
|
785
785
|
}, L || F), Kt, (n || _ || R || N || d || w) && /* @__PURE__ */ m.createElement("footer", {
|
|
786
|
-
className:
|
|
787
|
-
}, !
|
|
786
|
+
className: G("lmnt-modal__actions", "mdc-dialog__actions", Q && "lmnt-dialog__actions__mobile", w && "lmnt-modal__actions--supplemental-btn", Q && z && "lmnt-modal_actions-mobile-stacked")
|
|
787
|
+
}, !X && w && /* @__PURE__ */ m.createElement("div", {
|
|
788
788
|
className: "lmnt-dialog__actions__supplemental"
|
|
789
789
|
}, D(w, function() {
|
|
790
790
|
var p = {};
|
|
791
791
|
return b === "footerSupplemental" && (p["data-mdc-dialog-button-default"] = !0), I === "footerSupplemental" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
792
|
-
})), !
|
|
792
|
+
})), !X && (n || R || d) && /* @__PURE__ */ m.createElement("div", {
|
|
793
793
|
className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
|
|
794
794
|
}, R && D(R, {
|
|
795
795
|
variant: "text",
|
|
796
796
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
797
797
|
"data-mdc-dialog-action": "close"
|
|
798
|
-
}), n && !d && D(n, Yt), d && D(d, Jt)),
|
|
798
|
+
}), n && !d && D(n, Yt), d && D(d, Jt)), X && /* @__PURE__ */ m.createElement("div", {
|
|
799
799
|
className: "lmnt-modal_actions_button lmnt-dialog__actions__directional"
|
|
800
800
|
}, /* @__PURE__ */ m.createElement("div", null, oe(_, "lmnt-modal__button")), /* @__PURE__ */ m.createElement("div", null, D(N, {
|
|
801
801
|
className: "lmnt-modal__button",
|
|
@@ -806,7 +806,7 @@ var f = Gt.strings, ye = (
|
|
|
806
806
|
});
|
|
807
807
|
ot.displayName = "Modal";
|
|
808
808
|
ot.propTypes = Oe;
|
|
809
|
-
const be = "
|
|
809
|
+
const be = "_modal_lk11w_1", Ie = "_gap_lk11w_14", Ne = "_title_lk11w_19", Be = "_titleWithoutCloseIcon_lk11w_32", De = "_closeButton_lk11w_36", Fe = "_errorBanner_lk11w_48", y = {
|
|
810
810
|
modal: be,
|
|
811
811
|
gap: Ie,
|
|
812
812
|
title: Ne,
|
|
@@ -827,11 +827,11 @@ const be = "_modal_1yn30_1", Ie = "_gap_1yn30_14", Ne = "_title_1yn30_18", Be =
|
|
|
827
827
|
errorBannerProps: { hasError: S, ...F } = { hasError: !1 },
|
|
828
828
|
...T
|
|
829
829
|
}) => {
|
|
830
|
-
const
|
|
831
|
-
const
|
|
830
|
+
const W = nt(() => {
|
|
831
|
+
const E = {
|
|
832
832
|
id: "base",
|
|
833
|
-
action: /* @__PURE__ */
|
|
834
|
-
|
|
833
|
+
action: /* @__PURE__ */ wt(
|
|
834
|
+
U,
|
|
835
835
|
{
|
|
836
836
|
primaryAlign: "center",
|
|
837
837
|
secondaryAlign: "center",
|
|
@@ -846,7 +846,7 @@ const be = "_modal_1yn30_1", Ie = "_gap_1yn30_14", Ne = "_title_1yn30_18", Be =
|
|
|
846
846
|
className: y.closeButton
|
|
847
847
|
}
|
|
848
848
|
),
|
|
849
|
-
u ? /* @__PURE__ */ g(ue, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ g(pe, { icon: u }) }) : /* @__PURE__ */ g(
|
|
849
|
+
u ? /* @__PURE__ */ g(ue, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ g(pe, { icon: u }) }) : /* @__PURE__ */ g(Rt, {}),
|
|
850
850
|
/* @__PURE__ */ g(
|
|
851
851
|
me,
|
|
852
852
|
{
|
|
@@ -860,13 +860,13 @@ const be = "_modal_1yn30_1", Ie = "_gap_1yn30_14", Ne = "_title_1yn30_18", Be =
|
|
|
860
860
|
"base-group"
|
|
861
861
|
)
|
|
862
862
|
};
|
|
863
|
-
if (!t) return [
|
|
864
|
-
if (!Array.isArray(t)) return [
|
|
863
|
+
if (!t) return [E];
|
|
864
|
+
if (!Array.isArray(t)) return [E, { id: "action", action: t }];
|
|
865
865
|
const L = {
|
|
866
866
|
id: "action-group",
|
|
867
|
-
action: /* @__PURE__ */ g(
|
|
867
|
+
action: /* @__PURE__ */ g(U, { className: y.gap, children: t }, "action-group")
|
|
868
868
|
};
|
|
869
|
-
return [
|
|
869
|
+
return [E, L];
|
|
870
870
|
}, [t, i, a, u, o, e]);
|
|
871
871
|
return /* @__PURE__ */ g(
|
|
872
872
|
ot,
|
|
@@ -876,12 +876,12 @@ const be = "_modal_1yn30_1", Ie = "_gap_1yn30_14", Ne = "_title_1yn30_18", Be =
|
|
|
876
876
|
className: `${y.modal} ${y.title} ${T.className ?? ""}`,
|
|
877
877
|
hideCloseIcon: !0,
|
|
878
878
|
actionButton: n,
|
|
879
|
-
headerActions: /* @__PURE__ */
|
|
879
|
+
headerActions: /* @__PURE__ */ wt(U, { fullWidth: !0, gap: "none", direction: "vertical", children: [
|
|
880
|
+
/* @__PURE__ */ g(U, { fullWidth: !0, primaryAlign: "space-between", secondaryAlign: "center", children: W.map((E) => /* @__PURE__ */ g(ee, { children: E.action }, E.id)) }),
|
|
881
|
+
S && /* @__PURE__ */ g("div", { className: y.errorBanner, children: /* @__PURE__ */ g(fe, { ...F, isOpen: S }) })
|
|
882
|
+
] }, "header-group"),
|
|
880
883
|
preventClose: !0,
|
|
881
|
-
children: h ? /* @__PURE__ */ Rt
|
|
882
|
-
S && /* @__PURE__ */ g("div", { className: y.errorBanner, children: /* @__PURE__ */ g(fe, { ...F, isOpen: S }) }),
|
|
883
|
-
_
|
|
884
|
-
] }) : /* @__PURE__ */ g(he, { ...O })
|
|
884
|
+
children: h ? /* @__PURE__ */ g(Rt, { children: _ }) : /* @__PURE__ */ g(he, { ...O })
|
|
885
885
|
}
|
|
886
886
|
);
|
|
887
887
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.23.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|