asma-ui-core 3.108.3 → 3.109.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/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +18 -18
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +52 -51
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +66 -65
- package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -12
- package/dist/components/inputs/dynamic-select/components/DynamicSelectTitle.js +9 -0
- package/dist/components/inputs/select/StyledSelect.js +56 -50
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
- package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
- package/dist/components/utils/popover/PopoverSheet.js +95 -85
- package/dist/components/utils/popover/StyledPopover.js +81 -71
- package/dist/datetime/components/date-picker/StyledDatePicker.js +36 -27
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
- package/dist/datetime/components/time-picker/StyledTimePicker.js +75 -64
- package/dist/datetime/hooks/useBackNavigationClose.hook.js +19 -0
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectTitle.d.ts +14 -0
- package/dist/src/components/inputs/dynamic-select/types.d.ts +8 -2
- package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
- package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
- package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,104 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { isOverlayBackEnabled as I, useBackCloses as j } from "../../../hooks/useBackCloses.hook.js";
|
|
2
|
+
import { useIsMobileView as M } from "../../hooks/useWindowWidthSize.hook.js";
|
|
3
|
+
import { StyledDrawer as A } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
4
|
+
import { useBackNavigationClose as q } from "../../hooks/useBackNavigationClose.hook.js";
|
|
5
|
+
import { usePopupState as F } from "../../../hooks/usePopupState.js";
|
|
6
|
+
import { ClickAwayListener as K } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
7
|
+
import { isBeforeMinTime as E } from "./helpers/minTime.js";
|
|
8
|
+
import { TimePickerPanel as z } from "./components/TimePickerPanel.js";
|
|
9
|
+
import { TimePickerPopper as G } from "./TimePickerPopper.js";
|
|
10
|
+
import { getTimeFromValue as g } from "./helpers/getTimeFromValue.js";
|
|
11
|
+
import { TimePickerInput as J } from "./TimePickerInput.js";
|
|
12
|
+
import { useEffect as Q, useState as V } from "react";
|
|
13
|
+
import { jsx as r, jsxs as B } from "react/jsx-runtime";
|
|
14
|
+
import { format as w, isBefore as R, isValid as U } from "date-fns";
|
|
15
|
+
var le = (i) => {
|
|
16
|
+
const { value: s, onSelect: n, notBeforeTime: d, minTime: c } = i, o = F({
|
|
15
17
|
variant: "popper",
|
|
16
18
|
popupId: "time-picker-popper"
|
|
17
|
-
}),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}), m = M();
|
|
20
|
+
j({
|
|
21
|
+
active: o.isOpen,
|
|
22
|
+
requestClose: o.close
|
|
23
|
+
}), q({
|
|
24
|
+
open: m && o.isOpen && !I(),
|
|
25
|
+
onClose: o.close
|
|
26
|
+
});
|
|
27
|
+
const { isOpen: x, anchorEl: C, close: h } = o;
|
|
28
|
+
Q(() => {
|
|
29
|
+
if (!x || m) return;
|
|
30
|
+
const e = (t) => {
|
|
31
|
+
C?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), h()) : t.key === "Tab" && h());
|
|
22
32
|
};
|
|
23
33
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
24
34
|
}, [
|
|
25
35
|
x,
|
|
26
|
-
|
|
36
|
+
C,
|
|
27
37
|
h,
|
|
28
|
-
|
|
38
|
+
m
|
|
29
39
|
]);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
if (a(!0),
|
|
33
|
-
|
|
40
|
+
const P = s ? w(s, "HH:mm") : "", [O, u] = V(P), [T, a] = V(!1), [D, l] = V(!0), v = T ? O : P, k = (e) => !e || !d || !U(d) || !R(e, d), f = v.length === 5 ? g(v, s) : null, H = f ? k(f) : !0, L = (e) => {
|
|
41
|
+
const t = e.target.value;
|
|
42
|
+
if (a(!0), u(t), t.length !== 5) {
|
|
43
|
+
l(!1);
|
|
34
44
|
return;
|
|
35
45
|
}
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
n(void 0),
|
|
46
|
+
const p = g(t, s);
|
|
47
|
+
if (!p) {
|
|
48
|
+
n(void 0), l(!1);
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
if (!(e &&
|
|
44
|
-
if (
|
|
45
|
-
n(e),
|
|
51
|
+
l(!0), !E(p, c) && (k(p) ? (n(p), a(!1), o.close()) : n(void 0));
|
|
52
|
+
}, S = (e) => {
|
|
53
|
+
if (!(e && E(e, c))) {
|
|
54
|
+
if (l(!0), k(e)) {
|
|
55
|
+
n(e), u(e ? w(e, "HH:mm") : ""), a(!1);
|
|
46
56
|
return;
|
|
47
57
|
}
|
|
48
|
-
n(void 0),
|
|
58
|
+
n(void 0), u(e ? w(e, "HH:mm") : ""), a(!0);
|
|
49
59
|
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
n(void 0),
|
|
54
|
-
},
|
|
60
|
+
}, N = () => {
|
|
61
|
+
T && f && E(f, c) && a(!1);
|
|
62
|
+
}, b = () => {
|
|
63
|
+
n(void 0), u(""), a(!1), l(!0);
|
|
64
|
+
}, y = /* @__PURE__ */ r(J, {
|
|
55
65
|
...i,
|
|
56
|
-
popupState:
|
|
66
|
+
popupState: o,
|
|
57
67
|
localValue: v,
|
|
58
|
-
isValidTime:
|
|
59
|
-
isValidEndTime:
|
|
60
|
-
handleChange:
|
|
61
|
-
handleBlur:
|
|
68
|
+
isValidTime: D,
|
|
69
|
+
isValidEndTime: H,
|
|
70
|
+
handleChange: L,
|
|
71
|
+
handleBlur: N
|
|
62
72
|
});
|
|
63
|
-
return i.disabled || i.readOnly ?
|
|
73
|
+
return i.disabled || i.readOnly ? y : m ? /* @__PURE__ */ B("div", {
|
|
64
74
|
className: "relative h-auto w-auto",
|
|
65
75
|
children: [/* @__PURE__ */ r("div", {
|
|
66
76
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
67
|
-
children:
|
|
68
|
-
}), /* @__PURE__ */ r(
|
|
77
|
+
children: y
|
|
78
|
+
}), /* @__PURE__ */ r(A, {
|
|
69
79
|
anchor: "bottom",
|
|
70
|
-
open:
|
|
71
|
-
onClose:
|
|
72
|
-
anchorEl:
|
|
80
|
+
open: o.isOpen,
|
|
81
|
+
onClose: o.close,
|
|
82
|
+
anchorEl: o.anchorEl,
|
|
83
|
+
registerBackClose: !1,
|
|
73
84
|
children: /* @__PURE__ */ r("div", {
|
|
74
85
|
className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
|
|
75
|
-
children: /* @__PURE__ */ r(
|
|
86
|
+
children: /* @__PURE__ */ r(z, {
|
|
76
87
|
dataTest: i.dataTest,
|
|
77
|
-
value:
|
|
88
|
+
value: s,
|
|
78
89
|
minTime: c,
|
|
79
|
-
onSelect:
|
|
80
|
-
handleClear:
|
|
81
|
-
onConfirm:
|
|
90
|
+
onSelect: S,
|
|
91
|
+
handleClear: b,
|
|
92
|
+
onConfirm: o.close
|
|
82
93
|
})
|
|
83
94
|
})
|
|
84
95
|
})]
|
|
85
|
-
}) : /* @__PURE__ */ r(
|
|
96
|
+
}) : /* @__PURE__ */ r(K, {
|
|
86
97
|
mouseEvent: "onMouseDown",
|
|
87
|
-
onClickAway:
|
|
88
|
-
children: /* @__PURE__ */
|
|
98
|
+
onClickAway: o.close,
|
|
99
|
+
children: /* @__PURE__ */ B("div", {
|
|
89
100
|
className: "relative h-auto w-auto",
|
|
90
101
|
children: [/* @__PURE__ */ r("div", {
|
|
91
102
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
92
|
-
children:
|
|
93
|
-
}),
|
|
103
|
+
children: y
|
|
104
|
+
}), o.isOpen && /* @__PURE__ */ r(G, {
|
|
94
105
|
...i,
|
|
95
|
-
popupState:
|
|
96
|
-
handleClear:
|
|
97
|
-
onSelect:
|
|
106
|
+
popupState: o,
|
|
107
|
+
handleClear: b,
|
|
108
|
+
onSelect: S
|
|
98
109
|
})]
|
|
99
110
|
})
|
|
100
111
|
});
|
|
101
112
|
};
|
|
102
113
|
export {
|
|
103
|
-
|
|
114
|
+
le as StyledTimePicker
|
|
104
115
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect as i, useRef as c } from "react";
|
|
2
|
+
var n = "__asmaPickerBack", u = ({ open: r, onClose: e }) => {
|
|
3
|
+
const o = c(e);
|
|
4
|
+
i(() => {
|
|
5
|
+
o.current = e;
|
|
6
|
+
}, [e]), i(() => {
|
|
7
|
+
if (!r) return;
|
|
8
|
+
const t = window.rawWindow ?? window, s = crypto.randomUUID(), a = () => o.current();
|
|
9
|
+
return t.history.pushState({
|
|
10
|
+
...t.history.state,
|
|
11
|
+
[n]: s
|
|
12
|
+
}, "", t.location.href), t.addEventListener("popstate", a), () => {
|
|
13
|
+
t.removeEventListener("popstate", a), t.history.state?.[n] === s && t.history.back();
|
|
14
|
+
};
|
|
15
|
+
}, [r]);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
u as useBackNavigationClose
|
|
19
|
+
};
|
package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamicSelectOption, StyledDynamicSelectProps } from '../types';
|
|
2
|
-
type DynamicSelectReadOnlyValueProps<TOption extends DynamicSelectOption> = Pick<StyledDynamicSelectProps<TOption>, 'dataTest' | 'options' | 'title' | 'valueKey' | 'labelKey' | 'renderLabel'> & {
|
|
2
|
+
type DynamicSelectReadOnlyValueProps<TOption extends DynamicSelectOption> = Pick<StyledDynamicSelectProps<TOption>, 'dataTest' | 'options' | 'title' | 'titleSize' | 'valueKey' | 'labelKey' | 'renderLabel'> & {
|
|
3
3
|
value: TOption | null;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
@@ -11,5 +11,5 @@ type DynamicSelectReadOnlyValueProps<TOption extends DynamicSelectOption> = Pick
|
|
|
11
11
|
* buttons, and read-only draws neither. No value → `-`, the same placeholder the chip variant shows.
|
|
12
12
|
* Multiple selects never reach this component.
|
|
13
13
|
*/
|
|
14
|
-
export declare const DynamicSelectReadOnlyValue: <TOption extends DynamicSelectOption>({ dataTest, options, value, title, valueKey, labelKey, renderLabel, }: DynamicSelectReadOnlyValueProps<TOption>) => JSX.Element;
|
|
14
|
+
export declare const DynamicSelectReadOnlyValue: <TOption extends DynamicSelectOption>({ dataTest, options, value, title, titleSize, valueKey, labelKey, renderLabel, }: DynamicSelectReadOnlyValueProps<TOption>) => JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DynamicSelectOption, StyledDynamicSelectProps } from '../types';
|
|
2
|
+
type DynamicSelectTitleProps = Pick<StyledDynamicSelectProps<DynamicSelectOption>, 'title' | 'titleSize'> & {
|
|
3
|
+
id?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The title above every dynamic select variant — chips, autocomplete and the read-only value — so all
|
|
7
|
+
* three read the same and a consumer never stacks its own form label (with its input-title bottom
|
|
8
|
+
* padding) on top of the select.
|
|
9
|
+
*
|
|
10
|
+
* `base` = Body Base SemiBold 16/24; `lg` = Section title SemiBold 18/28 — both `text-icon/title-label`
|
|
11
|
+
* (delta-800), the `StyledFormLabel` sizes of the same names.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DynamicSelectTitle: ({ title, titleSize, id }: DynamicSelectTitleProps) => JSX.Element | null;
|
|
14
|
+
export {};
|
|
@@ -34,8 +34,14 @@ interface DynamicSelectCommonProps<TOption extends DynamicSelectOption> {
|
|
|
34
34
|
readOnly?: boolean;
|
|
35
35
|
/** Prevents the built-in clear button from appearing even when a value is set. Applies to autocomplete only. */
|
|
36
36
|
disableClearable?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @figmaProp Title (text-icon/title-label delta-800) above the control. A node, so a title can carry
|
|
39
|
+
* an icon or a required marker. Prefer it over a separate form label stacked on the select: the
|
|
40
|
+
* select owns the title-to-control gap, which is tighter in read-only (title over plain text).
|
|
41
|
+
*/
|
|
42
|
+
title?: React.ReactNode;
|
|
43
|
+
/** @figmaProp none — title typography: `'base'` Body Base SemiBold 16/24 (default), `'lg'` Section title 18/28. */
|
|
44
|
+
titleSize?: 'base' | 'lg';
|
|
39
45
|
/** @figmaProp none — app size (chips/buttons). Defaults to `'medium'`. */
|
|
40
46
|
size?: 'small' | 'medium';
|
|
41
47
|
/**
|
|
@@ -22,6 +22,8 @@ export interface DrawerProps {
|
|
|
22
22
|
};
|
|
23
23
|
/** Trigger element — when inside a modal `<dialog>`, portal into it so the sheet is interactive. */
|
|
24
24
|
anchorEl?: Element | null;
|
|
25
|
+
/** Set `false` when a wrapper already owns the Back-close registration. */
|
|
26
|
+
registerBackClose?: boolean;
|
|
25
27
|
children?: ReactNode;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
import { PopoverSlot } from '../popover/PopoverSheet';
|
|
3
3
|
export type BottomSheetCloseReason = 'closeButton' | 'scrim' | 'escape' | 'drag' | 'viewResults' | 'action';
|
|
4
4
|
/** @figmaNode 9Q7C7JYPgnUSsrX1L8v40t#5354-169163 (Ad-Voca-concept · "_bottom sheet") */
|
|
@@ -41,6 +41,10 @@ export interface StyledBottomSheetProps {
|
|
|
41
41
|
closeLabel?: string;
|
|
42
42
|
/** @figmaProp none — style escape hatch, applied to the sheet container */
|
|
43
43
|
className?: string;
|
|
44
|
+
/** Set `false` when a wrapper already owns the Back-close registration. */
|
|
45
|
+
registerBackClose?: boolean;
|
|
46
|
+
/** Logical owner supplied by a wrapper that must keep one identity across responsive variants. */
|
|
47
|
+
ownerRef?: RefObject<Element | null>;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* ASMA Design System **Bottom Sheet** (ASMA-8184) — the mobile (0–743px) form of the Action popover:
|
|
@@ -56,4 +60,4 @@ export interface StyledBottomSheetProps {
|
|
|
56
60
|
* Focus moves to the sheet on open (so the title is announced first) and back to the trigger on
|
|
57
61
|
* close. `PopoverSheet` with `variant='action'` renders this automatically below 744px.
|
|
58
62
|
*/
|
|
59
|
-
export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, className, }: StyledBottomSheetProps) => JSX.Element | null;
|
|
63
|
+
export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, className, registerBackClose, ownerRef, }: StyledBottomSheetProps) => JSX.Element | null;
|
|
@@ -35,6 +35,8 @@ export interface StyledPopoverProps {
|
|
|
35
35
|
* dialog in the same tick it opens.
|
|
36
36
|
*/
|
|
37
37
|
keepMounted?: boolean;
|
|
38
|
+
/** Set `false` when a wrapper already owns the Back-close registration. */
|
|
39
|
+
registerBackClose?: boolean;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* @figmaNode none — no standalone Figma component
|
|
@@ -51,4 +53,4 @@ export interface StyledPopoverProps {
|
|
|
51
53
|
* mapping to MUI's `onClose(event, reason)`. `anchorOrigin`/`transformOrigin`/`slotProps.paper`
|
|
52
54
|
* preserved (DEC-003). TASK-302.
|
|
53
55
|
*/
|
|
54
|
-
export declare const StyledPopover: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, slotProps, onClick, children, keepMounted, tabIntoContent, }: StyledPopoverProps) => JSX.Element | null;
|
|
56
|
+
export declare const StyledPopover: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, slotProps, onClick, children, keepMounted, tabIntoContent, registerBackClose, }: StyledPopoverProps) => JSX.Element | null;
|