@ensi-platform/admin-ui 0.8.4 → 0.9.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/{Component-CDgOJr89.js → Component-B73be-FU.js} +2 -2
- package/dist/{Component-CDgOJr89.js.map → Component-B73be-FU.js.map} +1 -1
- package/dist/{Component-D25FKJAT.js → Component-BRHoDRtF.js} +2 -2
- package/dist/{Component-D25FKJAT.js.map → Component-BRHoDRtF.js.map} +1 -1
- package/dist/action-popup/index.js +1 -1
- package/dist/arrangement-settings/index.js +1 -1
- package/dist/assets/Component5.css +1 -1
- package/dist/assets/Component9.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/bottom-sheet/index.js +1 -1
- package/dist/date-range-picker/Component.d.ts.map +1 -1
- package/dist/date-range-picker/index.js +207 -179
- package/dist/date-range-picker/index.js.map +1 -1
- package/dist/date-range-picker/utils.d.ts +24 -0
- package/dist/date-range-picker/utils.d.ts.map +1 -0
- package/dist/drawer/index.js +1 -1
- package/dist/grid-layout/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useOverlayExitComplete.d.ts +2 -1
- package/dist/hooks/useOverlayExitComplete.d.ts.map +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-select/index.js +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/time-field/Component.d.ts.map +1 -1
- package/dist/time-field/index.js +122 -107
- package/dist/time-field/index.js.map +1 -1
- package/dist/useOverlayExitComplete-Bra8dR0m.js +15 -0
- package/dist/useOverlayExitComplete-Bra8dR0m.js.map +1 -0
- package/package.json +1 -1
- package/src/date-range-picker/docs/Description.md +2 -0
- package/src/time-field/docs/Description.md +2 -0
- package/dist/useOverlayExitComplete-CwaErLze.js +0 -16
- package/dist/useOverlayExitComplete-CwaErLze.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CalendarDate, DateValue } from '@internationalized/date';
|
|
2
|
+
import { DateRange } from 'react-aria-components';
|
|
3
|
+
/** Incomplete segment input. RAC types both ends as `DateValue`, but a cleared segment is `null`. */
|
|
4
|
+
interface IEditableRange {
|
|
5
|
+
start: DateValue | null;
|
|
6
|
+
end: DateValue | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_RANGE_MIN_VALUE: CalendarDate;
|
|
9
|
+
export declare const DEFAULT_RANGE_MAX_VALUE: CalendarDate;
|
|
10
|
+
/** True when either endpoint is set. */
|
|
11
|
+
export declare const hasRangeValue: (value: IEditableRange | null | undefined) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Empty range is publishable (clear). A range is publishable only when both
|
|
14
|
+
* ends exist, end is not before start, and both ends sit inside bounds.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isPublishableRange: (value: IEditableRange | null | undefined, minValue: DateValue, maxValue: DateValue) => boolean;
|
|
17
|
+
/** Swap only a complete reversed range. Partial ranges stay partial. */
|
|
18
|
+
export declare const orderRange: (value: IEditableRange) => IEditableRange;
|
|
19
|
+
/** Compare endpoints. A missing end matches only another missing end. */
|
|
20
|
+
export declare const rangesEqual: (left: IEditableRange | null | undefined, right: IEditableRange | null | undefined) => boolean;
|
|
21
|
+
/** Value committed on blur, Enter, or calendar close. Invalid input falls back to the last publishable range. */
|
|
22
|
+
export declare const resolveCommittedRange: (raw: IEditableRange | null | undefined, lastValid: DateRange | null, minValue: DateValue, maxValue: DateValue) => DateRange | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,qGAAqG;AACrG,UAAU,cAAc;IACpB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,uBAAuB,cAA2C,CAAC;AAChF,eAAO,MAAM,uBAAuB,cAA6C,CAAC;AAElF,wCAAwC;AACxC,eAAO,MAAM,aAAa,GAAI,OAAO,cAAc,GAAG,IAAI,GAAG,SAAS,YAA+C,CAAC;AAatH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC3B,OAAO,cAAc,GAAG,IAAI,GAAG,SAAS,EACxC,UAAU,SAAS,EACnB,UAAU,SAAS,YAatB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,UAAU,GAAI,OAAO,cAAc,KAAG,cAMlD,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,WAAW,GAAI,MAAM,cAAc,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,cAAc,GAAG,IAAI,GAAG,SAAS,YAM5G,CAAC;AAEF,iHAAiH;AACjH,eAAO,MAAM,qBAAqB,GAC9B,KAAK,cAAc,GAAG,IAAI,GAAG,SAAS,EACtC,WAAW,SAAS,GAAG,IAAI,EAC3B,UAAU,SAAS,EACnB,UAAU,SAAS,KACpB,SAAS,GAAG,IAYd,CAAC"}
|
package/dist/drawer/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import g from "classnames";
|
|
3
3
|
import { s as _ } from "../index-h8z54aFR.js";
|
|
4
|
-
import '../assets/
|
|
4
|
+
import '../assets/index16.css';const G = (a) => typeof a == "number" ? `repeat(${a}, minmax(0, 1fr))` : a.map((e) => typeof e == "number" ? `${e}fr` : e).join(" "), d = (a) => a === "full" ? "1 / -1" : typeof a == "number" ? `span ${a}` : "auto", L = "aub_styles-module_root_d8095", $ = {
|
|
5
5
|
root: L
|
|
6
6
|
}, m = _(
|
|
7
7
|
({ ref: a, children: e, col: s, className: o, dataTestId: p, style: u, ...r }) => {
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Calls `onExitComplete` once after the overlay has been shown and then fully left
|
|
3
3
|
* (`open === false` and `isExiting === false`), including when exit animation is skipped
|
|
4
|
-
* or the overlay unmounts during exit.
|
|
4
|
+
* or the overlay unmounts during exit. The unmount call is deferred by a tick so the
|
|
5
|
+
* Strict Mode mount → cleanup → mount replay does not fire it.
|
|
5
6
|
*/
|
|
6
7
|
export declare const useOverlayExitComplete: (open: boolean, isExiting: boolean, onExitComplete?: () => void) => void;
|
|
7
8
|
//# sourceMappingURL=useOverlayExitComplete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverlayExitComplete.d.ts","sourceRoot":"","sources":["../../../src/hooks/useOverlayExitComplete.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"useOverlayExitComplete.d.ts","sourceRoot":"","sources":["../../../src/hooks/useOverlayExitComplete.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,OAAO,EAAE,WAAW,OAAO,EAAE,iBAAiB,MAAM,IAAI,SAmCpG,CAAC"}
|
package/dist/modal/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { C as E } from "../index-CdAE-ZaU.js";
|
|
|
8
8
|
import { cva as P } from "class-variance-authority";
|
|
9
9
|
import { F as f, u as T } from "../Component-BPN5FgKq.js";
|
|
10
10
|
import { u as q, g as w } from "../useFieldHook-Bt9nST7g.js";
|
|
11
|
-
import '../assets/
|
|
11
|
+
import '../assets/index17.css';const z = "aub_styles-module_root_42206", A = "aub_styles-module_block_e0d95", y = {
|
|
12
12
|
root: z,
|
|
13
13
|
block: A
|
|
14
14
|
}, G = P(y.root, {
|
package/dist/slider/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { cva as G } from "class-variance-authority";
|
|
|
7
7
|
import { typographyStyles as C } from "../typography/index.js";
|
|
8
8
|
import { F as v, u as J } from "../Component-BPN5FgKq.js";
|
|
9
9
|
import { u as K, g as Q } from "../useFieldHook-Bt9nST7g.js";
|
|
10
|
-
import '../assets/
|
|
10
|
+
import '../assets/index18.css';const U = "aub_styles-module_root_34a37", W = "aub_styles-module_block_87638", X = "aub_styles-module_readout_b6c80", Y = "aub_styles-module_value_52215", Z = "aub_styles-module_detail_aad13", ee = "aub_styles-module_track_47316", le = "aub_styles-module_rail_fad39", ae = "aub_styles-module_fill_7f0d9", re = "aub_styles-module_ticks_24abe", te = "aub_styles-module_tick_60d62", se = "aub_styles-module_thumb_edd9d", ie = "aub_styles-module_invalid_cb4ec", oe = "aub_styles-module_sm_d6a8a", de = "aub_styles-module_md_f78ab", ne = "aub_styles-module_lg_32e42", a = {
|
|
11
11
|
root: U,
|
|
12
12
|
block: W,
|
|
13
13
|
readout: X,
|
package/dist/textarea/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { cva as j } from "class-variance-authority";
|
|
|
9
9
|
import { typographyStyles as k } from "../typography/index.js";
|
|
10
10
|
import { F as g, u as z } from "../Component-BPN5FgKq.js";
|
|
11
11
|
import { u as L, g as M } from "../useFieldHook-Bt9nST7g.js";
|
|
12
|
-
import '../assets/
|
|
12
|
+
import '../assets/index19.css';const G = "aub_styles-module_root_6dcd6", U = "aub_styles-module_block_9fd7b", $ = "aub_styles-module_sm_8e3c9", q = "aub_styles-module_md_9f5d6", J = "aub_styles-module_lg_459d3", K = "aub_styles-module_fieldInput_f9bcf", Q = "aub_styles-module_clear_97555", W = "aub_styles-module_clearIcon_dd0fc", X = "aub_styles-module_primary_af5fb", o = {
|
|
13
13
|
root: G,
|
|
14
14
|
block: U,
|
|
15
15
|
sm: $,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/time-field/Component.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAM/C,eAAO,MAAM,SAAS,sOAmBf,eAAe;;
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/time-field/Component.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAM/C,eAAO,MAAM,SAAS,sOAmBf,eAAe;;CA2FrB,CAAC"}
|
package/dist/time-field/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { TimeField as
|
|
5
|
-
import { s as
|
|
6
|
-
import { C as
|
|
7
|
-
import { u as
|
|
8
|
-
import { cva as
|
|
9
|
-
import { typographyStyles as
|
|
10
|
-
import { F as
|
|
11
|
-
import { u as
|
|
12
|
-
import '../assets/index14.css';const
|
|
13
|
-
root:
|
|
14
|
-
block:
|
|
15
|
-
group:
|
|
16
|
-
sm:
|
|
17
|
-
md:
|
|
18
|
-
lg:
|
|
19
|
-
primary:
|
|
20
|
-
input:
|
|
21
|
-
segment:
|
|
22
|
-
clear:
|
|
23
|
-
icon:
|
|
24
|
-
},
|
|
1
|
+
import { jsx as r, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useRef as G } from "react";
|
|
3
|
+
import F from "classnames";
|
|
4
|
+
import { TimeField as M, Group as q, DateInput as w, DateSegment as x, Button as O } from "react-aria-components";
|
|
5
|
+
import { s as L } from "../index-h8z54aFR.js";
|
|
6
|
+
import { C as U } from "../Clear-DcxADxz6.js";
|
|
7
|
+
import { u as $ } from "../hooks-BlX5Y4Zt.js";
|
|
8
|
+
import { cva as J } from "class-variance-authority";
|
|
9
|
+
import { typographyStyles as k } from "../typography/index.js";
|
|
10
|
+
import { F as h, u as K } from "../Component-BPN5FgKq.js";
|
|
11
|
+
import { u as Q, g as W } from "../useFieldHook-Bt9nST7g.js";
|
|
12
|
+
import '../assets/index14.css';const X = "aub_styles-module_root_184e6", Y = "aub_styles-module_block_45f0f", Z = "aub_styles-module_group_9f460", ee = "aub_styles-module_sm_f51c2", le = "aub_styles-module_md_be9a9", re = "aub_styles-module_lg_8553c", oe = "aub_styles-module_primary_43afd", te = "aub_styles-module_input_f5120", se = "aub_styles-module_segment_b8349", ae = "aub_styles-module_clear_04e5c", ne = "aub_styles-module_icon_2d638", l = {
|
|
13
|
+
root: X,
|
|
14
|
+
block: Y,
|
|
15
|
+
group: Z,
|
|
16
|
+
sm: ee,
|
|
17
|
+
md: le,
|
|
18
|
+
lg: re,
|
|
19
|
+
primary: oe,
|
|
20
|
+
input: te,
|
|
21
|
+
segment: se,
|
|
22
|
+
clear: ae,
|
|
23
|
+
icon: ne
|
|
24
|
+
}, ie = J(l.group, {
|
|
25
25
|
variants: {
|
|
26
26
|
size: {
|
|
27
|
-
sm:
|
|
28
|
-
md:
|
|
29
|
-
lg:
|
|
27
|
+
sm: F(l.sm, k.bodyS),
|
|
28
|
+
md: F(l.md, k.bodyS),
|
|
29
|
+
lg: F(l.lg, k.bodyM)
|
|
30
30
|
},
|
|
31
31
|
variant: {
|
|
32
|
-
primary:
|
|
32
|
+
primary: l.primary
|
|
33
33
|
},
|
|
34
34
|
block: {
|
|
35
|
-
true:
|
|
35
|
+
true: l.block,
|
|
36
36
|
false: null
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -41,61 +41,76 @@ import '../assets/index14.css';const q = "aub_styles-module_root_184e6", J = "au
|
|
|
41
41
|
variant: "primary",
|
|
42
42
|
block: !0
|
|
43
43
|
}
|
|
44
|
-
}),
|
|
44
|
+
}), ue = (o) => o != null, P = L(
|
|
45
45
|
({
|
|
46
46
|
ref: o,
|
|
47
|
-
size:
|
|
48
|
-
variant:
|
|
49
|
-
block:
|
|
50
|
-
invalid:
|
|
47
|
+
size: n = "md",
|
|
48
|
+
variant: i = "primary",
|
|
49
|
+
block: u = !0,
|
|
50
|
+
invalid: t = !1,
|
|
51
51
|
disabled: s = !1,
|
|
52
52
|
clear: m = !1,
|
|
53
|
-
value:
|
|
53
|
+
value: c,
|
|
54
54
|
defaultValue: d,
|
|
55
|
-
onChange:
|
|
56
|
-
onBlur:
|
|
57
|
-
className:
|
|
58
|
-
dataTestId:
|
|
59
|
-
"aria-label":
|
|
60
|
-
"aria-labelledby":
|
|
61
|
-
"aria-describedby":
|
|
62
|
-
...
|
|
55
|
+
onChange: a,
|
|
56
|
+
onBlur: b,
|
|
57
|
+
className: T,
|
|
58
|
+
dataTestId: C,
|
|
59
|
+
"aria-label": v,
|
|
60
|
+
"aria-labelledby": f,
|
|
61
|
+
"aria-describedby": N,
|
|
62
|
+
...y
|
|
63
63
|
}) => {
|
|
64
|
-
const { clear:
|
|
65
|
-
|
|
64
|
+
const { clear: A } = $(), _ = c !== void 0, [E, S] = j(() => d ?? null), p = _ ? c : E, I = m && !s && ue(p), g = G(p ?? null), R = (e) => {
|
|
65
|
+
g.current = e, _ || S(e), a?.(e);
|
|
66
66
|
};
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
|
|
67
|
+
return /* @__PURE__ */ r(
|
|
68
|
+
M,
|
|
69
69
|
{
|
|
70
|
-
...
|
|
71
|
-
value:
|
|
72
|
-
onChange:
|
|
70
|
+
...y,
|
|
71
|
+
value: p,
|
|
72
|
+
onChange: (e) => {
|
|
73
|
+
_ || S(e), a?.(e);
|
|
74
|
+
},
|
|
73
75
|
isDisabled: s,
|
|
74
|
-
isInvalid:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
isInvalid: t,
|
|
77
|
+
onFocus: () => {
|
|
78
|
+
g.current = p ?? null;
|
|
79
|
+
},
|
|
80
|
+
onBlur: (e) => {
|
|
81
|
+
if (![...(e.currentTarget instanceof HTMLElement ? e.currentTarget : null)?.querySelectorAll('[role="spinbutton"]') ?? []].some((D) => {
|
|
82
|
+
const V = D.getAttribute("data-type");
|
|
83
|
+
return V !== "hour" && V !== "minute" && V !== "second" ? !1 : !/\d/.test(D.textContent ?? "");
|
|
84
|
+
})) {
|
|
85
|
+
g.current = p ?? null, b?.(e);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const B = g.current;
|
|
89
|
+
_ || S(B), a?.(B), b?.(e);
|
|
90
|
+
},
|
|
91
|
+
"aria-label": v,
|
|
92
|
+
"aria-labelledby": f,
|
|
93
|
+
"aria-describedby": N,
|
|
94
|
+
className: F(l.root, u && l.block, T),
|
|
95
|
+
"data-test-id": C,
|
|
96
|
+
children: /* @__PURE__ */ H(
|
|
97
|
+
q,
|
|
83
98
|
{
|
|
84
99
|
ref: o,
|
|
85
|
-
className:
|
|
86
|
-
"data-invalid":
|
|
100
|
+
className: ie({ size: n, variant: i, block: u }),
|
|
101
|
+
"data-invalid": t || void 0,
|
|
87
102
|
"data-disabled": s || void 0,
|
|
88
103
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
I ? /* @__PURE__ */
|
|
91
|
-
|
|
104
|
+
/* @__PURE__ */ r(w, { className: l.input, children: (e) => /* @__PURE__ */ r(x, { segment: e, className: l.segment }) }),
|
|
105
|
+
I ? /* @__PURE__ */ r(
|
|
106
|
+
O,
|
|
92
107
|
{
|
|
93
108
|
slot: null,
|
|
94
|
-
className:
|
|
95
|
-
"aria-label":
|
|
109
|
+
className: l.clear,
|
|
110
|
+
"aria-label": A,
|
|
96
111
|
excludeFromTabOrder: !0,
|
|
97
|
-
onPress: () =>
|
|
98
|
-
children: /* @__PURE__ */
|
|
112
|
+
onPress: () => R(null),
|
|
113
|
+
children: /* @__PURE__ */ r(U, { className: l.icon })
|
|
99
114
|
}
|
|
100
115
|
) : null
|
|
101
116
|
]
|
|
@@ -105,70 +120,70 @@ import '../assets/index14.css';const q = "aub_styles-module_root_184e6", J = "au
|
|
|
105
120
|
);
|
|
106
121
|
}
|
|
107
122
|
);
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const { controlProps: s, size: m, invalid:
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
|
|
123
|
+
P.displayName = "TimeField";
|
|
124
|
+
const z = L(({ ref: o, value: n, onChange: i, onBlur: u, ...t }) => {
|
|
125
|
+
const { controlProps: s, size: m, invalid: c, disabled: d } = K();
|
|
126
|
+
return /* @__PURE__ */ r(
|
|
127
|
+
P,
|
|
113
128
|
{
|
|
114
129
|
...s,
|
|
115
|
-
...
|
|
130
|
+
...t,
|
|
116
131
|
ref: o,
|
|
117
132
|
size: m,
|
|
118
|
-
invalid:
|
|
133
|
+
invalid: c,
|
|
119
134
|
disabled: d,
|
|
120
|
-
value:
|
|
121
|
-
onChange:
|
|
122
|
-
onBlur:
|
|
135
|
+
value: n,
|
|
136
|
+
onChange: i,
|
|
137
|
+
onBlur: u
|
|
123
138
|
}
|
|
124
139
|
);
|
|
125
140
|
});
|
|
126
|
-
|
|
127
|
-
const
|
|
141
|
+
z.displayName = "FormTimeFieldControl";
|
|
142
|
+
const ce = ({
|
|
128
143
|
name: o,
|
|
129
|
-
label:
|
|
130
|
-
hint:
|
|
131
|
-
size:
|
|
132
|
-
block:
|
|
144
|
+
label: n,
|
|
145
|
+
hint: i,
|
|
146
|
+
size: u = "md",
|
|
147
|
+
block: t = !0,
|
|
133
148
|
disabled: s,
|
|
134
149
|
className: m,
|
|
135
|
-
dataTestId:
|
|
150
|
+
dataTestId: c,
|
|
136
151
|
...d
|
|
137
152
|
}) => {
|
|
138
|
-
const { field:
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
|
|
153
|
+
const { field: a, fieldState: b, inputProps: T, onChange: C, onBlurHandler: v } = Q({ name: o }), f = W(b.error)?.message, N = s ?? T.disabled;
|
|
154
|
+
return /* @__PURE__ */ H(
|
|
155
|
+
h,
|
|
141
156
|
{
|
|
142
|
-
invalid: !!
|
|
143
|
-
disabled:
|
|
144
|
-
size:
|
|
145
|
-
block:
|
|
157
|
+
invalid: !!f,
|
|
158
|
+
disabled: N,
|
|
159
|
+
size: u,
|
|
160
|
+
block: t,
|
|
146
161
|
className: m,
|
|
147
|
-
dataTestId:
|
|
162
|
+
dataTestId: c,
|
|
148
163
|
children: [
|
|
149
|
-
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
|
|
164
|
+
n ? /* @__PURE__ */ r(h.Label, { children: n }) : null,
|
|
165
|
+
/* @__PURE__ */ r(
|
|
166
|
+
z,
|
|
152
167
|
{
|
|
153
168
|
...d,
|
|
154
|
-
block:
|
|
155
|
-
ref:
|
|
156
|
-
value:
|
|
157
|
-
onChange: (
|
|
158
|
-
|
|
169
|
+
block: t,
|
|
170
|
+
ref: a.ref,
|
|
171
|
+
value: a.value ?? null,
|
|
172
|
+
onChange: (y) => {
|
|
173
|
+
a.onChange(y), C(o, y);
|
|
159
174
|
},
|
|
160
|
-
onBlur: () =>
|
|
175
|
+
onBlur: () => v()
|
|
161
176
|
}
|
|
162
177
|
),
|
|
163
|
-
|
|
164
|
-
/* @__PURE__ */
|
|
178
|
+
i ? /* @__PURE__ */ r(h.Hint, { children: i }) : null,
|
|
179
|
+
/* @__PURE__ */ r(h.Error, { children: f })
|
|
165
180
|
]
|
|
166
181
|
}
|
|
167
182
|
);
|
|
168
183
|
};
|
|
169
|
-
|
|
184
|
+
ce.displayName = "FormTimeField";
|
|
170
185
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
ce as FormTimeField,
|
|
187
|
+
P as TimeField
|
|
173
188
|
};
|
|
174
189
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/time-field/theme.ts","../../src/time-field/Component.tsx","../../src/time-field/FormTimeField.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\nexport const timeFieldGroupVariants = cva(styles.group, {\n variants: {\n size: {\n sm: cn(styles.sm, typographyStyles.bodyS),\n md: cn(styles.md, typographyStyles.bodyS),\n lg: cn(styles.lg, typographyStyles.bodyM),\n },\n variant: {\n primary: styles.primary,\n },\n block: {\n true: styles.block,\n false: null,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n block: true,\n },\n});\n","import { useState } from 'react';\n\nimport cn from 'classnames';\nimport {\n Button as RacButton,\n DateInput,\n DateSegment,\n Group,\n TimeField as RacTimeField,\n type TimeValue,\n} from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Clear } from '@/icons';\nimport { useAuiLabels } from '@/provider';\n\nimport { timeFieldGroupVariants } from './theme';\nimport { type ITimeFieldProps } from './types';\n\nimport styles from './styles.module.css';\n\nconst hasTimeValue = (value: TimeValue | null | undefined) => value != null;\n\nexport const TimeField = supportRef(\n ({\n ref,\n size = 'md',\n variant = 'primary',\n block = true,\n invalid = false,\n disabled = false,\n clear = false,\n value,\n defaultValue,\n onChange,\n onBlur,\n className,\n dataTestId,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n ...props\n }: ITimeFieldProps) => {\n const { clear: clearLabel } = useAuiLabels();\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState<TimeValue | null>(() => defaultValue ?? null);\n const currentValue = isControlled ? value : uncontrolledValue;\n const showClear = clear && !disabled && hasTimeValue(currentValue);\n\n const setValue = (next: TimeValue | null) => {\n if (!isControlled) {\n setUncontrolledValue(next);\n }\n onChange?.(next);\n };\n\n return (\n <RacTimeField\n {...props}\n value={currentValue}\n onChange={setValue}\n isDisabled={disabled}\n isInvalid={invalid}\n onBlur={onBlur}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n className={cn(styles.root, block && styles.block, className)}\n data-test-id={dataTestId}\n >\n <Group\n ref={ref}\n className={timeFieldGroupVariants({ size, variant, block })}\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n >\n <DateInput className={styles.input}>\n {segment => <DateSegment segment={segment} className={styles.segment} />}\n </DateInput>\n {showClear ? (\n <RacButton\n slot={null}\n className={styles.clear}\n aria-label={clearLabel}\n excludeFromTabOrder\n onPress={() => setValue(null)}\n >\n <Clear className={styles.icon} />\n </RacButton>\n ) : null}\n </Group>\n </RacTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n","import { type Ref } from 'react';\n\nimport { type TimeValue } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Field, useField } from '@/field';\nimport { useFieldHook } from '@/form/hooks/useFieldHook';\nimport { getError } from '@/form/utils';\n\nimport { TimeField } from './Component';\nimport { type IFormTimeFieldProps, type ITimeFieldProps } from './types';\n\ntype TFormTimeFieldControlProps = Omit<ITimeFieldProps, 'size' | 'invalid' | 'disabled' | 'value' | 'onChange'> & {\n value: TimeValue | null;\n onChange: (value: TimeValue | null) => void;\n ref?: Ref<HTMLDivElement>;\n};\n\nconst FormTimeFieldControl = supportRef(({ ref, value, onChange, onBlur, ...props }: TFormTimeFieldControlProps) => {\n const { controlProps, size, invalid, disabled } = useField();\n\n return (\n <TimeField\n {...controlProps}\n {...props}\n ref={ref}\n size={size}\n invalid={invalid}\n disabled={disabled}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n />\n );\n});\n\nFormTimeFieldControl.displayName = 'FormTimeFieldControl';\n\nexport const FormTimeField = ({\n name,\n label,\n hint,\n size = 'md',\n block = true,\n disabled,\n className,\n dataTestId,\n ...inputProps\n}: IFormTimeFieldProps) => {\n const { field, fieldState, inputProps: rhfInputProps, onChange, onBlurHandler } = useFieldHook({ name });\n const error = getError(fieldState.error)?.message;\n const isDisabled = disabled ?? rhfInputProps.disabled;\n\n return (\n <Field\n invalid={Boolean(error)}\n disabled={isDisabled}\n size={size}\n block={block}\n className={className}\n dataTestId={dataTestId}\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <FormTimeFieldControl\n {...inputProps}\n block={block}\n ref={field.ref}\n value={field.value ?? null}\n onChange={next => {\n field.onChange(next);\n onChange(name, next as never);\n }}\n onBlur={() => onBlurHandler()}\n />\n {hint ? <Field.Hint>{hint}</Field.Hint> : null}\n <Field.Error>{error}</Field.Error>\n </Field>\n );\n};\n\nFormTimeField.displayName = 'FormTimeField';\n"],"names":["timeFieldGroupVariants","cva","styles","cn","typographyStyles","hasTimeValue","value","TimeField","supportRef","ref","size","variant","block","invalid","disabled","clear","defaultValue","onChange","onBlur","className","dataTestId","ariaLabel","ariaLabelledby","ariaDescribedby","props","clearLabel","useAuiLabels","isControlled","uncontrolledValue","setUncontrolledValue","useState","currentValue","showClear","setValue","next","jsx","RacTimeField","jsxs","Group","DateInput","segment","DateSegment","RacButton","Clear","FormTimeFieldControl","controlProps","useField","FormTimeField","name","label","hint","inputProps","field","fieldState","rhfInputProps","onBlurHandler","useFieldHook","error","getError","isDisabled","Field"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAOaA,KAAyBC,EAAIC,EAAO,OAAO;AAAA,EACpD,UAAU;AAAA,IACN,MAAM;AAAA,MACF,IAAIC,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,IAAA;AAAA,IAE5C,SAAS;AAAA,MACL,SAASF,EAAO;AAAA,IAAA;AAAA,IAEpB,OAAO;AAAA,MACH,MAAMA,EAAO;AAAA,MACb,OAAO;AAAA,IAAA;AAAA,EACX;AAAA,EAEJ,iBAAiB;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAEf,CAAC,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AC;AAAA,EACA,GAAG+B;AACP,MAA2B;AACvB,QAAM,EAAE,OAAAC,GAAO,YAAAC,GAAY,YAAYC,GAAe,UAAArC,GAAU,eAAAsC,MAAkBC,EAAa,EAAE,MAAAR,GAAM,GACjGS,IAAQC,EAASL,EAAW,KAAK,GAAG,SACpCM,IAAa7C,KAAYwC,EAAc;AAE7C,SACI,gBAAAjB;AAAA,IAACuB;AAAA,IAAA;AAAA,MACG,SAAS,EAAQH;AAAA,MACjB,UAAUE;AAAA,MACV,MAAAjD;AAAA,MACA,OAAAE;AAAA,MACA,WAAAO;AAAA,MACA,YAAAC;AAAA,MAEC,UAAA;AAAA,QAAA6B,IAAQ,gBAAAd,EAACyB,EAAM,OAAN,EAAa,aAAM,IAAiB;AAAA,QAC9C,gBAAAzB;AAAA,UAACS;AAAA,UAAA;AAAA,YACI,GAAGO;AAAA,YACJ,OAAAvC;AAAA,YACA,KAAKwC,EAAM;AAAA,YACX,OAAOA,EAAM,SAAS;AAAA,YACtB,UAAU,CAAAlB,MAAQ;AACd,cAAAkB,EAAM,SAASlB,CAAI,GACnBjB,EAAS+B,GAAMd,CAAa;AAAA,YAChC;AAAA,YACA,QAAQ,MAAMqB,EAAA;AAAA,UAAc;AAAA,QAAA;AAAA,QAE/BL,IAAO,gBAAAf,EAACyB,EAAM,MAAN,EAAY,aAAK,IAAgB;AAAA,QAC1C,gBAAAzB,EAACyB,EAAM,OAAN,EAAa,UAAAH,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhC;AAEAV,GAAc,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/time-field/theme.ts","../../src/time-field/Component.tsx","../../src/time-field/FormTimeField.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\nexport const timeFieldGroupVariants = cva(styles.group, {\n variants: {\n size: {\n sm: cn(styles.sm, typographyStyles.bodyS),\n md: cn(styles.md, typographyStyles.bodyS),\n lg: cn(styles.lg, typographyStyles.bodyM),\n },\n variant: {\n primary: styles.primary,\n },\n block: {\n true: styles.block,\n false: null,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n block: true,\n },\n});\n","import { useRef, useState } from 'react';\n\nimport cn from 'classnames';\nimport {\n Button as RacButton,\n DateInput,\n DateSegment,\n Group,\n TimeField as RacTimeField,\n type TimeValue,\n} from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Clear } from '@/icons';\nimport { useAuiLabels } from '@/provider';\n\nimport { timeFieldGroupVariants } from './theme';\nimport { type ITimeFieldProps } from './types';\n\nimport styles from './styles.module.css';\n\nconst hasTimeValue = (value: TimeValue | null | undefined) => value != null;\n\nexport const TimeField = supportRef(\n ({\n ref,\n size = 'md',\n variant = 'primary',\n block = true,\n invalid = false,\n disabled = false,\n clear = false,\n value,\n defaultValue,\n onChange,\n onBlur,\n className,\n dataTestId,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n ...props\n }: ITimeFieldProps) => {\n const { clear: clearLabel } = useAuiLabels();\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState<TimeValue | null>(() => defaultValue ?? null);\n const currentValue = isControlled ? value : uncontrolledValue;\n const showClear = clear && !disabled && hasTimeValue(currentValue);\n const committedRef = useRef<TimeValue | null>(currentValue ?? null);\n\n const setValue = (next: TimeValue | null) => {\n committedRef.current = next;\n if (!isControlled) {\n setUncontrolledValue(next);\n }\n onChange?.(next);\n };\n\n const handleChange = (next: TimeValue | null) => {\n if (!isControlled) {\n setUncontrolledValue(next);\n }\n onChange?.(next);\n };\n\n const handleFocus: NonNullable<ITimeFieldProps['onFocus']> = () => {\n committedRef.current = currentValue ?? null;\n };\n\n const handleBlur: NonNullable<ITimeFieldProps['onBlur']> = event => {\n const root = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;\n const incomplete = [...(root?.querySelectorAll('[role=\"spinbutton\"]') ?? [])].some(node => {\n const type = node.getAttribute('data-type');\n if (type !== 'hour' && type !== 'minute' && type !== 'second') {\n return false;\n }\n\n return !/\\d/.test(node.textContent ?? '');\n });\n\n if (!incomplete) {\n committedRef.current = currentValue ?? null;\n onBlur?.(event);\n return;\n }\n\n const restored = committedRef.current;\n if (!isControlled) {\n setUncontrolledValue(restored);\n }\n onChange?.(restored);\n onBlur?.(event);\n };\n\n return (\n <RacTimeField\n {...props}\n value={currentValue}\n onChange={handleChange}\n isDisabled={disabled}\n isInvalid={invalid}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n className={cn(styles.root, block && styles.block, className)}\n data-test-id={dataTestId}\n >\n <Group\n ref={ref}\n className={timeFieldGroupVariants({ size, variant, block })}\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n >\n <DateInput className={styles.input}>\n {segment => <DateSegment segment={segment} className={styles.segment} />}\n </DateInput>\n {showClear ? (\n <RacButton\n slot={null}\n className={styles.clear}\n aria-label={clearLabel}\n excludeFromTabOrder\n onPress={() => setValue(null)}\n >\n <Clear className={styles.icon} />\n </RacButton>\n ) : null}\n </Group>\n </RacTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n","import { type Ref } from 'react';\n\nimport { type TimeValue } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Field, useField } from '@/field';\nimport { useFieldHook } from '@/form/hooks/useFieldHook';\nimport { getError } from '@/form/utils';\n\nimport { TimeField } from './Component';\nimport { type IFormTimeFieldProps, type ITimeFieldProps } from './types';\n\ntype TFormTimeFieldControlProps = Omit<ITimeFieldProps, 'size' | 'invalid' | 'disabled' | 'value' | 'onChange'> & {\n value: TimeValue | null;\n onChange: (value: TimeValue | null) => void;\n ref?: Ref<HTMLDivElement>;\n};\n\nconst FormTimeFieldControl = supportRef(({ ref, value, onChange, onBlur, ...props }: TFormTimeFieldControlProps) => {\n const { controlProps, size, invalid, disabled } = useField();\n\n return (\n <TimeField\n {...controlProps}\n {...props}\n ref={ref}\n size={size}\n invalid={invalid}\n disabled={disabled}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n />\n );\n});\n\nFormTimeFieldControl.displayName = 'FormTimeFieldControl';\n\nexport const FormTimeField = ({\n name,\n label,\n hint,\n size = 'md',\n block = true,\n disabled,\n className,\n dataTestId,\n ...inputProps\n}: IFormTimeFieldProps) => {\n const { field, fieldState, inputProps: rhfInputProps, onChange, onBlurHandler } = useFieldHook({ name });\n const error = getError(fieldState.error)?.message;\n const isDisabled = disabled ?? rhfInputProps.disabled;\n\n return (\n <Field\n invalid={Boolean(error)}\n disabled={isDisabled}\n size={size}\n block={block}\n className={className}\n dataTestId={dataTestId}\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <FormTimeFieldControl\n {...inputProps}\n block={block}\n ref={field.ref}\n value={field.value ?? null}\n onChange={next => {\n field.onChange(next);\n onChange(name, next as never);\n }}\n onBlur={() => onBlurHandler()}\n />\n {hint ? <Field.Hint>{hint}</Field.Hint> : null}\n <Field.Error>{error}</Field.Error>\n </Field>\n );\n};\n\nFormTimeField.displayName = 'FormTimeField';\n"],"names":["timeFieldGroupVariants","cva","styles","cn","typographyStyles","hasTimeValue","value","TimeField","supportRef","ref","size","variant","block","invalid","disabled","clear","defaultValue","onChange","onBlur","className","dataTestId","ariaLabel","ariaLabelledby","ariaDescribedby","props","clearLabel","useAuiLabels","isControlled","uncontrolledValue","setUncontrolledValue","useState","currentValue","showClear","committedRef","useRef","setValue","next","jsx","RacTimeField","event","node","type","restored","jsxs","Group","DateInput","segment","DateSegment","RacButton","Clear","FormTimeFieldControl","controlProps","useField","FormTimeField","name","label","hint","inputProps","field","fieldState","rhfInputProps","onBlurHandler","useFieldHook","error","getError","isDisabled","Field"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAOa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B,QAAM,EAAE,OAAAC,GAAO,YAAAC,GAAY,YAAYC,GAAe,UAAA3C,GAAU,eAAA4C,MAAkBC,EAAa,EAAE,MAAAR,GAAM,GACjGS,IAAQC,EAASL,EAAW,KAAK,GAAG,SACpCM,IAAanD,KAAY8C,EAAc;AAE7C,SACI,gBAAAjB;AAAA,IAACuB;AAAA,IAAA;AAAA,MACG,SAAS,EAAQH;AAAA,MACjB,UAAUE;AAAA,MACV,MAAAvD;AAAA,MACA,OAAAE;AAAA,MACA,WAAAO;AAAA,MACA,YAAAC;AAAA,MAEC,UAAA;AAAA,QAAAmC,IAAQ,gBAAAlB,EAAC6B,EAAM,OAAN,EAAa,aAAM,IAAiB;AAAA,QAC9C,gBAAA7B;AAAA,UAACa;AAAA,UAAA;AAAA,YACI,GAAGO;AAAA,YACJ,OAAA7C;AAAA,YACA,KAAK8C,EAAM;AAAA,YACX,OAAOA,EAAM,SAAS;AAAA,YACtB,UAAU,CAAAtB,MAAQ;AACd,cAAAsB,EAAM,SAAStB,CAAI,GACnBnB,EAASqC,GAAMlB,CAAa;AAAA,YAChC;AAAA,YACA,QAAQ,MAAMyB,EAAA;AAAA,UAAc;AAAA,QAAA;AAAA,QAE/BL,IAAO,gBAAAnB,EAAC6B,EAAM,MAAN,EAAY,aAAK,IAAgB;AAAA,QAC1C,gBAAA7B,EAAC6B,EAAM,OAAN,EAAa,UAAAH,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhC;AAEAV,GAAc,cAAc;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useRef as c, useEffect as s } from "react";
|
|
2
|
+
const a = (r, t, n) => {
|
|
3
|
+
const e = c(!1), u = c(n), f = c(void 0);
|
|
4
|
+
u.current = n, (r || t) && (e.current = !0), s(() => {
|
|
5
|
+
!e.current || r || t || (e.current = !1, u.current?.());
|
|
6
|
+
}, [r, t]), s(() => (clearTimeout(f.current), () => {
|
|
7
|
+
f.current = setTimeout(() => {
|
|
8
|
+
e.current && (e.current = !1, u.current?.());
|
|
9
|
+
}, 0);
|
|
10
|
+
}), []);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
a as u
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useOverlayExitComplete-Bra8dR0m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOverlayExitComplete-Bra8dR0m.js","sources":["../src/hooks/useOverlayExitComplete.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n/**\n * Calls `onExitComplete` once after the overlay has been shown and then fully left\n * (`open === false` and `isExiting === false`), including when exit animation is skipped\n * or the overlay unmounts during exit. The unmount call is deferred by a tick so the\n * Strict Mode mount → cleanup → mount replay does not fire it.\n */\nexport const useOverlayExitComplete = (open: boolean, isExiting: boolean, onExitComplete?: () => void) => {\n const hadPresenceRef = useRef(false);\n const onExitCompleteRef = useRef(onExitComplete);\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n onExitCompleteRef.current = onExitComplete;\n\n if (open || isExiting) {\n hadPresenceRef.current = true;\n }\n\n useEffect(() => {\n if (!hadPresenceRef.current || open || isExiting) {\n return;\n }\n\n hadPresenceRef.current = false;\n onExitCompleteRef.current?.();\n }, [open, isExiting]);\n\n useEffect(() => {\n // Strict Mode replay: cancel the exit scheduled by the simulated unmount.\n clearTimeout(unmountTimerRef.current);\n\n return () => {\n // Defer so Strict Mode's mount → cleanup → mount does not remove a live overlay.\n unmountTimerRef.current = setTimeout(() => {\n if (!hadPresenceRef.current) {\n return;\n }\n\n hadPresenceRef.current = false;\n onExitCompleteRef.current?.();\n }, 0);\n };\n }, []);\n};\n"],"names":["useOverlayExitComplete","open","isExiting","onExitComplete","hadPresenceRef","useRef","onExitCompleteRef","unmountTimerRef","useEffect"],"mappings":";AAQO,MAAMA,IAAyB,CAACC,GAAeC,GAAoBC,MAAgC;AACtG,QAAMC,IAAiBC,EAAO,EAAK,GAC7BC,IAAoBD,EAAOF,CAAc,GACzCI,IAAkBF,EAAsC,MAAS;AACvE,EAAAC,EAAkB,UAAUH,IAExBF,KAAQC,OACRE,EAAe,UAAU,KAG7BI,EAAU,MAAM;AACZ,IAAI,CAACJ,EAAe,WAAWH,KAAQC,MAIvCE,EAAe,UAAU,IACzBE,EAAkB,UAAA;AAAA,EACtB,GAAG,CAACL,GAAMC,CAAS,CAAC,GAEpBM,EAAU,OAEN,aAAaD,EAAgB,OAAO,GAE7B,MAAM;AAET,IAAAA,EAAgB,UAAU,WAAW,MAAM;AACvC,MAAKH,EAAe,YAIpBA,EAAe,UAAU,IACzBE,EAAkB,UAAA;AAAA,IACtB,GAAG,CAAC;AAAA,EACR,IACD,CAAA,CAAE;AACT;"}
|
package/package.json
CHANGED
|
@@ -26,6 +26,8 @@ import { DateRangePicker, FormDateRangePicker } from '@ensi-platform/admin-ui/da
|
|
|
26
26
|
| `block` | `boolean` | `true` | full width |
|
|
27
27
|
| `dataTestId` | `string` | — | `data-test-id` for tests |
|
|
28
28
|
|
|
29
|
+
If the end date is before the start date, the dates swap on blur, Enter, or when the calendar closes. A partial range and a date outside `minValue` / `maxValue` roll back to the last valid range. A reversed range is not passed to `onChange`.
|
|
30
|
+
|
|
29
31
|
### FormDateRangePicker
|
|
30
32
|
|
|
31
33
|
| Prop | Values | Default | Description |
|
|
@@ -27,6 +27,8 @@ import { TimeField, FormTimeField } from '@ensi-platform/admin-ui/time-field';
|
|
|
27
27
|
| `block` | `boolean` | `true` | full width |
|
|
28
28
|
| `dataTestId` | `string` | — | `data-test-id` for tests |
|
|
29
29
|
|
|
30
|
+
If the hour or minutes are cleared to a placeholder, blur restores the time from when the field was focused. The clear button sets `null`.
|
|
31
|
+
|
|
30
32
|
### FormTimeField
|
|
31
33
|
|
|
32
34
|
| Prop | Values | Default | Description |
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useRef as f, useEffect as n } from "react";
|
|
2
|
-
const a = (r, t, c) => {
|
|
3
|
-
const e = f(!1), u = f(c);
|
|
4
|
-
u.current = c, (r || t) && (e.current = !0), n(() => {
|
|
5
|
-
!e.current || r || t || (e.current = !1, u.current?.());
|
|
6
|
-
}, [r, t]), n(
|
|
7
|
-
() => () => {
|
|
8
|
-
e.current && (e.current = !1, u.current?.());
|
|
9
|
-
},
|
|
10
|
-
[]
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
a as u
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=useOverlayExitComplete-CwaErLze.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOverlayExitComplete-CwaErLze.js","sources":["../src/hooks/useOverlayExitComplete.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n/**\n * Calls `onExitComplete` once after the overlay has been shown and then fully left\n * (`open === false` and `isExiting === false`), including when exit animation is skipped\n * or the overlay unmounts during exit.\n */\nexport const useOverlayExitComplete = (open: boolean, isExiting: boolean, onExitComplete?: () => void) => {\n const hadPresenceRef = useRef(false);\n const onExitCompleteRef = useRef(onExitComplete);\n onExitCompleteRef.current = onExitComplete;\n\n if (open || isExiting) {\n hadPresenceRef.current = true;\n }\n\n useEffect(() => {\n if (!hadPresenceRef.current || open || isExiting) {\n return;\n }\n\n hadPresenceRef.current = false;\n onExitCompleteRef.current?.();\n }, [open, isExiting]);\n\n useEffect(\n () => () => {\n if (!hadPresenceRef.current) {\n return;\n }\n\n hadPresenceRef.current = false;\n onExitCompleteRef.current?.();\n },\n []\n );\n};\n"],"names":["useOverlayExitComplete","open","isExiting","onExitComplete","hadPresenceRef","useRef","onExitCompleteRef","useEffect"],"mappings":";AAOO,MAAMA,IAAyB,CAACC,GAAeC,GAAoBC,MAAgC;AACtG,QAAMC,IAAiBC,EAAO,EAAK,GAC7BC,IAAoBD,EAAOF,CAAc;AAC/C,EAAAG,EAAkB,UAAUH,IAExBF,KAAQC,OACRE,EAAe,UAAU,KAG7BG,EAAU,MAAM;AACZ,IAAI,CAACH,EAAe,WAAWH,KAAQC,MAIvCE,EAAe,UAAU,IACzBE,EAAkB,UAAA;AAAA,EACtB,GAAG,CAACL,GAAMC,CAAS,CAAC,GAEpBK;AAAA,IACI,MAAM,MAAM;AACR,MAAKH,EAAe,YAIpBA,EAAe,UAAU,IACzBE,EAAkB,UAAA;AAAA,IACtB;AAAA,IACA,CAAA;AAAA,EAAC;AAET;"}
|