asma-ui-core 3.109.0 → 3.110.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.
Files changed (55) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +17 -15
  3. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +26 -24
  4. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +61 -58
  5. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +74 -71
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -10
  7. package/dist/components/inputs/field-styles.js +16 -6
  8. package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
  9. package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
  10. package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
  11. package/dist/components/inputs/input-field/StyledInputField.js +235 -198
  12. package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
  13. package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
  14. package/dist/components/inputs/select/StyledSelect.js +110 -108
  15. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
  16. package/dist/components/inputs/slider/StyledSlider.js +2 -2
  17. package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
  18. package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
  19. package/dist/components/miscellaneous/StyledFormControl.js +29 -25
  20. package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
  21. package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
  22. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
  23. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
  24. package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
  25. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
  26. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
  27. package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
  28. package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
  29. package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
  30. package/dist/helpers/CharacterCounter.js +21 -0
  31. package/dist/index.js +219 -211
  32. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
  33. package/dist/src/components/inputs/dynamic-select/types.d.ts +3 -0
  34. package/dist/src/components/inputs/field-styles.d.ts +22 -0
  35. package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
  36. package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
  37. package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
  38. package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
  39. package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
  40. package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
  41. package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
  42. package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
  43. package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
  44. package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
  45. package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
  46. package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
  47. package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
  48. package/dist/src/helpers/CharacterCounter.d.ts +16 -0
  49. package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
  50. package/dist/src/index.d.ts +1 -0
  51. package/dist/tailwind.config.d.ts +14 -0
  52. package/package.json +1 -1
  53. package/src/styles/fieldWidthTokens.css +8 -0
  54. package/src/styles/index.css +1 -0
  55. package/tw-configs/twConfigs.json +14 -0
@@ -1,115 +1,119 @@
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({
1
+ import { cn as g } from "../../../helpers/cn.js";
2
+ import { isOverlayBackEnabled as M, useBackCloses as A } from "../../../hooks/useBackCloses.hook.js";
3
+ import { useIsMobileView as q } from "../../hooks/useWindowWidthSize.hook.js";
4
+ import { StyledDrawer as F } from "../../../components/navigation/drawer/StyledDrawer.js";
5
+ import { useBackNavigationClose as K } from "../../hooks/useBackNavigationClose.hook.js";
6
+ import { usePopupState as W } from "../../../hooks/usePopupState.js";
7
+ import { ClickAwayListener as z } from "../../../components/mui-compat/ClickAwayListener.js";
8
+ import { isBeforeMinTime as w } from "./helpers/minTime.js";
9
+ import { TimePickerPanel as G } from "./components/TimePickerPanel.js";
10
+ import { TimePickerPopper as J } from "./TimePickerPopper.js";
11
+ import { getTimeFromValue as B } from "./helpers/getTimeFromValue.js";
12
+ import { timePickerWidthProps as O } from "./helpers/timePickerWidth.js";
13
+ import { TimePickerInput as Q } from "./TimePickerInput.js";
14
+ import { useEffect as R, useState as E } from "react";
15
+ import { jsx as r, jsxs as D } from "react/jsx-runtime";
16
+ import { format as V, isBefore as U, isValid as X } from "date-fns";
17
+ var fe = (o) => {
18
+ const { value: l, onSelect: n, notBeforeTime: d, minTime: c } = o, t = W({
17
19
  variant: "popper",
18
20
  popupId: "time-picker-popper"
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
21
+ }), m = q();
22
+ A({
23
+ active: t.isOpen,
24
+ requestClose: t.close
25
+ }), K({
26
+ open: m && t.isOpen && !M(),
27
+ onClose: t.close
26
28
  });
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());
29
+ const { isOpen: P, anchorEl: x, close: h } = t;
30
+ R(() => {
31
+ if (!P || m) return;
32
+ const e = (i) => {
33
+ x?.contains(document.activeElement) && (i.key === "Escape" ? (i.preventDefault(), i.stopPropagation(), h()) : i.key === "Tab" && h());
32
34
  };
33
35
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
34
36
  }, [
37
+ P,
35
38
  x,
36
- C,
37
39
  h,
38
40
  m
39
41
  ]);
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);
42
+ const C = l ? V(l, "HH:mm") : "", [H, u] = E(C), [b, a] = E(!1), [L, s] = E(!0), v = b ? H : C, k = (e) => !e || !d || !X(d) || !U(e, d), f = v.length === 5 ? B(v, l) : null, N = f ? k(f) : !0, I = (e) => {
43
+ const i = e.target.value;
44
+ if (a(!0), u(i), i.length !== 5) {
45
+ s(!1);
44
46
  return;
45
47
  }
46
- const p = g(t, s);
48
+ const p = B(i, l);
47
49
  if (!p) {
48
- n(void 0), l(!1);
50
+ n(void 0), s(!1);
49
51
  return;
50
52
  }
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);
53
+ s(!0), !w(p, c) && (k(p) ? (n(p), a(!1), t.close()) : n(void 0));
54
+ }, T = (e) => {
55
+ if (!(e && w(e, c))) {
56
+ if (s(!0), k(e)) {
57
+ n(e), u(e ? V(e, "HH:mm") : ""), a(!1);
56
58
  return;
57
59
  }
58
- n(void 0), u(e ? w(e, "HH:mm") : ""), a(!0);
60
+ n(void 0), u(e ? V(e, "HH:mm") : ""), a(!0);
59
61
  }
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, {
65
- ...i,
66
- popupState: o,
62
+ }, j = () => {
63
+ b && f && w(f, c) && a(!1);
64
+ }, S = () => {
65
+ n(void 0), u(""), a(!1), s(!0);
66
+ }, y = /* @__PURE__ */ r(Q, {
67
+ ...o,
68
+ popupState: t,
67
69
  localValue: v,
68
- isValidTime: D,
69
- isValidEndTime: H,
70
- handleChange: L,
71
- handleBlur: N
70
+ isValidTime: L,
71
+ isValidEndTime: N,
72
+ handleChange: I,
73
+ handleBlur: j
72
74
  });
73
- return i.disabled || i.readOnly ? y : m ? /* @__PURE__ */ B("div", {
74
- className: "relative h-auto w-auto",
75
+ return o.disabled || o.readOnly ? y : m ? /* @__PURE__ */ D("div", {
76
+ className: g("relative h-auto", typeof o.width == "number" && "w-auto"),
77
+ ...O(o.width),
75
78
  children: [/* @__PURE__ */ r("div", {
76
79
  className: "m-0 flex h-fit items-center justify-center p-0",
77
80
  children: y
78
- }), /* @__PURE__ */ r(A, {
81
+ }), /* @__PURE__ */ r(F, {
79
82
  anchor: "bottom",
80
- open: o.isOpen,
81
- onClose: o.close,
82
- anchorEl: o.anchorEl,
83
+ open: t.isOpen,
84
+ onClose: t.close,
85
+ anchorEl: t.anchorEl,
83
86
  registerBackClose: !1,
84
87
  children: /* @__PURE__ */ r("div", {
85
88
  className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
86
- children: /* @__PURE__ */ r(z, {
87
- dataTest: i.dataTest,
88
- value: s,
89
+ children: /* @__PURE__ */ r(G, {
90
+ dataTest: o.dataTest,
91
+ value: l,
89
92
  minTime: c,
90
- onSelect: S,
91
- handleClear: b,
92
- onConfirm: o.close
93
+ onSelect: T,
94
+ handleClear: S,
95
+ onConfirm: t.close
93
96
  })
94
97
  })
95
98
  })]
96
- }) : /* @__PURE__ */ r(K, {
99
+ }) : /* @__PURE__ */ r(z, {
97
100
  mouseEvent: "onMouseDown",
98
- onClickAway: o.close,
99
- children: /* @__PURE__ */ B("div", {
100
- className: "relative h-auto w-auto",
101
+ onClickAway: t.close,
102
+ children: /* @__PURE__ */ D("div", {
103
+ className: g("relative h-auto", typeof o.width == "number" && "w-auto"),
104
+ ...O(o.width),
101
105
  children: [/* @__PURE__ */ r("div", {
102
106
  className: "m-0 flex h-fit items-center justify-center p-0",
103
107
  children: y
104
- }), o.isOpen && /* @__PURE__ */ r(G, {
105
- ...i,
106
- popupState: o,
107
- handleClear: b,
108
- onSelect: S
108
+ }), t.isOpen && /* @__PURE__ */ r(J, {
109
+ ...o,
110
+ popupState: t,
111
+ handleClear: S,
112
+ onSelect: T
109
113
  })]
110
114
  })
111
115
  });
112
116
  };
113
117
  export {
114
- le as StyledTimePicker
118
+ fe as StyledTimePicker
115
119
  };
@@ -1,61 +1,63 @@
1
- import { ClockOutlineIcon as P } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
1
+ import { ClockOutlineIcon as E } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
2
+ import { fieldLabelAboveClass as N } from "../../../components/inputs/field-styles.js";
2
3
  import { StyledInputField as y } from "../../../components/inputs/input-field/StyledInputField.js";
3
- import { getTitleLabelling as R } from "../../helpers/getTitleLabelling.js";
4
- import { useInputMask as v } from "../../../helpers/inputMask.js";
5
- import { HelperText as w, defaultTimePickerHelperMessages as A } from "./components/HelperText.js";
6
- import { useEffect as H, useId as M, useRef as V } from "react";
7
- import { jsx as l, jsxs as j } from "react/jsx-runtime";
8
- var q = (x) => {
9
- const { placeholder: f, disabled: e, inputClassName: h, dataTest: p, width: o, error: g, helperText: T, label: m, locale: k = "en", popupState: i, handleChange: C, handleBlur: I, isValidTime: d, isValidEndTime: c, localValue: b, title: a, readOnly: t, inputAriaProps: E } = x, N = v({
4
+ import { getTitleLabelling as A } from "../../helpers/getTitleLabelling.js";
5
+ import { useInputMask as R } from "../../../helpers/inputMask.js";
6
+ import { HelperText as w, defaultTimePickerHelperMessages as H } from "./components/HelperText.js";
7
+ import { timePickerWidthProps as M } from "./helpers/timePickerWidth.js";
8
+ import { useEffect as V, useId as W, useRef as j } from "react";
9
+ import { jsx as o, jsxs as z } from "react/jsx-runtime";
10
+ var K = (f) => {
11
+ const { placeholder: h, disabled: e, inputClassName: x, dataTest: m, width: t, error: g, helperText: k, label: p, locale: T = "en", popupState: i, handleChange: C, handleBlur: I, isValidTime: d, isValidEndTime: c, localValue: P, title: l, readOnly: a, inputAriaProps: b } = f, v = R({
10
12
  mask: "xx:xx",
11
13
  maskChar: "x",
12
14
  showMask: !1
13
- }), s = !d || !c || !!g, n = V(null), u = M();
14
- return H(() => {
15
+ }), s = !d || !c || !!g, n = j(null), u = W();
16
+ return V(() => {
15
17
  n.current && i.setAnchorEl(n.current);
16
- }, []), /* @__PURE__ */ j("div", {
17
- style: { height: t ? "40px" : "75px" },
18
- children: [a && /* @__PURE__ */ l("div", {
18
+ }, []), /* @__PURE__ */ z("div", {
19
+ ...M(t),
20
+ children: [l && /* @__PURE__ */ o("div", {
19
21
  id: u,
20
- className: "pb-1 font-roboto font-semibold text-delta-800",
21
- children: a
22
- }), /* @__PURE__ */ l(y, {
23
- inputRef: N,
22
+ className: N({ disabled: e }),
23
+ children: l
24
+ }), /* @__PURE__ */ o(y, {
25
+ inputRef: v,
24
26
  autoComplete: "off",
25
27
  type: "text",
26
- dataTest: p,
27
- "data-testid": p,
28
- placeholder: f,
28
+ dataTest: m,
29
+ "data-testid": m,
30
+ placeholder: h,
29
31
  size: "small",
30
32
  error: s,
31
- helperText: /* @__PURE__ */ l(w, {
33
+ helperText: /* @__PURE__ */ o(w, {
32
34
  isValidTime: d,
33
35
  isValidEndTime: c,
34
36
  error: s,
35
- localization: k,
36
- helperText: T,
37
- messages: A
37
+ localization: T,
38
+ helperText: k,
39
+ messages: H
38
40
  }),
39
41
  onChange: C,
40
42
  onBlur: I,
41
43
  slotProps: {
42
- htmlInput: R({
43
- title: a,
44
+ htmlInput: A({
45
+ title: l,
44
46
  titleId: u,
45
- label: m,
46
- inputAriaProps: E
47
+ label: p,
48
+ inputAriaProps: b
47
49
  }),
48
50
  input: {
49
51
  ref: n,
50
52
  onClick: (r) => {
51
- !e && !t && i.open(r);
53
+ !e && !a && i.open(r);
52
54
  },
53
- endAdornment: /* @__PURE__ */ l(P, {
55
+ endAdornment: /* @__PURE__ */ o(E, {
54
56
  width: 24,
55
57
  height: 24,
56
58
  className: e ? "text-delta-300" : "text-delta-700",
57
59
  onClick: (r) => {
58
- r.stopPropagation(), !e && !t && i.open(r);
60
+ r.stopPropagation(), !e && !a && i.open(r);
59
61
  }
60
62
  })
61
63
  },
@@ -64,19 +66,19 @@ var q = (x) => {
64
66
  hideErrorIcon: !0
65
67
  }
66
68
  },
67
- value: b,
68
- sx: {
69
- maxWidth: o ?? 130,
70
- width: o,
71
- minWidth: o
72
- },
69
+ value: P,
70
+ sx: typeof t == "number" ? {
71
+ maxWidth: t,
72
+ width: t,
73
+ minWidth: t
74
+ } : void 0,
73
75
  disabled: e,
74
- readOnly: t,
75
- className: h,
76
- label: m
76
+ readOnly: a,
77
+ className: x,
78
+ label: p
77
79
  })]
78
80
  });
79
81
  };
80
82
  export {
81
- q as TimePickerInput
83
+ K as TimePickerInput
82
84
  };
@@ -0,0 +1,12 @@
1
+ import { fieldWidthStyle as r } from "../../../../components/inputs/field-styles.js";
2
+ var o = (t) => {
3
+ if (typeof t == "number") return {};
4
+ const e = t ?? "xs";
5
+ return {
6
+ "data-field-width": e,
7
+ style: r(e)
8
+ };
9
+ };
10
+ export {
11
+ o as timePickerWidthProps
12
+ };
@@ -0,0 +1,21 @@
1
+ import { cn as c } from "./cn.js";
2
+ import { Fragment as i, jsx as n, jsxs as h } from "react/jsx-runtime";
3
+ var m = {
4
+ en: (r, a) => `${r} of ${a} characters`,
5
+ no: (r, a) => `${r} av ${a} tegn`
6
+ }, l = (r, a) => a - r <= Math.max(1, Math.min(10, Math.ceil(a * 0.2))), p = ({ id: r, length: a, limit: e, locale: o = "en", className: s }) => {
7
+ const t = m[o](a, e);
8
+ return /* @__PURE__ */ h(i, { children: [/* @__PURE__ */ n("span", {
9
+ id: r,
10
+ "aria-hidden": "true",
11
+ className: c("font-roboto text-sm leading-5 text-delta-600", s),
12
+ children: t
13
+ }), /* @__PURE__ */ n("span", {
14
+ "aria-live": "polite",
15
+ className: "sr-only",
16
+ children: l(a, e) ? t : ""
17
+ })] });
18
+ };
19
+ export {
20
+ p as CharacterCounter
21
+ };