asma-ui-core 3.114.0 → 3.116.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 (24) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/chip/StyledChip.js +1 -0
  3. package/dist/components/inputs/field-styles.js +16 -16
  4. package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +15 -15
  5. package/dist/components/inputs/full-screen-picker/pickerCopy.js +4 -6
  6. package/dist/components/inputs/phone-field/CountryCodeOptions.js +31 -24
  7. package/dist/components/inputs/phone-field/CountryCodeSelect.js +2 -1
  8. package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +125 -123
  9. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +177 -172
  10. package/dist/components/inputs/textarea/StyledTextarea.module.js +8 -8
  11. package/dist/datetime/components/time-picker/StyledTimePicker.js +79 -78
  12. package/dist/hooks/useMediaQuery.hook.js +8 -7
  13. package/dist/src/components/inputs/field-styles.d.ts +5 -2
  14. package/dist/src/components/inputs/field-styles.test.d.ts +1 -0
  15. package/dist/src/components/inputs/full-screen-picker/FullScreenPicker.d.ts +2 -1
  16. package/dist/src/components/inputs/full-screen-picker/pickerCopy.d.ts +0 -1
  17. package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +3 -1
  18. package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +3 -1
  19. package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +2 -1
  20. package/dist/src/datetime/components/time-picker/StyledTimePicker.d.ts +2 -1
  21. package/dist/src/hooks/useMediaQuery.hook.d.ts +8 -0
  22. package/dist/tailwind.config.d.ts +3 -0
  23. package/package.json +1 -1
  24. package/src/styles/components-colors/inputVariables.css +3 -2
@@ -1,119 +1,120 @@
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({
1
+ import { cn as D } from "../../../helpers/cn.js";
2
+ import { isOverlayBackEnabled as q, useBackCloses as F } from "../../../hooks/useBackCloses.hook.js";
3
+ import { useIsMobileView as K } from "../../hooks/useWindowWidthSize.hook.js";
4
+ import { StyledDrawer as W } from "../../../components/navigation/drawer/StyledDrawer.js";
5
+ import { useBackNavigationClose as z } from "../../hooks/useBackNavigationClose.hook.js";
6
+ import { usePopupState as G } from "../../../hooks/usePopupState.js";
7
+ import { ClickAwayListener as J } from "../../../components/mui-compat/ClickAwayListener.js";
8
+ import { isBeforeMinTime as E } from "./helpers/minTime.js";
9
+ import { TimePickerPanel as Q } from "./components/TimePickerPanel.js";
10
+ import { TimePickerPopper as R } from "./TimePickerPopper.js";
11
+ import { getTimeFromValue as C } from "./helpers/getTimeFromValue.js";
12
+ import { timePickerWidthProps as H } from "./helpers/timePickerWidth.js";
13
+ import { TimePickerInput as U } from "./TimePickerInput.js";
14
+ import { useEffect as X, useState as P } from "react";
15
+ import { jsx as i, jsxs as L } from "react/jsx-runtime";
16
+ import { format as V, isBefore as Y, isValid as Z } from "date-fns";
17
+ var de = (r) => {
18
+ const { value: a, onSelect: n, notBeforeTime: v, minTime: c } = r, t = G({
19
19
  variant: "popper",
20
20
  popupId: "time-picker-popper"
21
- }), m = q();
22
- A({
21
+ }), m = K();
22
+ F({
23
23
  active: t.isOpen,
24
24
  requestClose: t.close
25
- }), K({
26
- open: m && t.isOpen && !M(),
25
+ }), z({
26
+ open: m && t.isOpen && !q(),
27
27
  onClose: t.close
28
28
  });
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());
29
+ const { isOpen: b, anchorEl: S, close: w } = t;
30
+ X(() => {
31
+ if (!b || m) return;
32
+ const e = (o) => {
33
+ S?.contains(document.activeElement) && (o.key === "Escape" ? (o.preventDefault(), o.stopPropagation(), w()) : o.key === "Tab" && w());
34
34
  };
35
35
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
36
36
  }, [
37
- P,
38
- x,
39
- h,
37
+ b,
38
+ S,
39
+ w,
40
40
  m
41
41
  ]);
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);
42
+ const T = a ? V(a, "HH:mm") : "", [k, u] = P(T), [x, s] = P(!1), [B, f] = P(!1), p = x ? k : T, d = (e) => !e || !v || !Z(v) || !Y(e, v), l = p.length === 5 ? C(p, a) : null, j = !B || p === "" || l !== null, I = !B || !l || d(l), g = (e) => {
43
+ if (e === "") return !0;
44
+ const o = C(e, a);
45
+ return o !== null && d(o);
46
+ }, M = (e) => {
47
+ const o = e.target.value;
48
+ if (s(!0), u(o), g(o) && f(!1), o.length !== 5) return;
49
+ const h = C(o, a);
50
+ if (!h) {
51
+ n(void 0);
46
52
  return;
47
53
  }
48
- const p = B(i, l);
49
- if (!p) {
50
- n(void 0), s(!1);
54
+ E(h, c) || (d(h) ? (n(h), s(!1), t.close()) : n(void 0));
55
+ }, O = (e) => {
56
+ if (e && E(e, c)) return;
57
+ const o = d(e);
58
+ if (f(!o), o) {
59
+ n(e), u(e ? V(e, "HH:mm") : ""), s(!1);
51
60
  return;
52
61
  }
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);
58
- return;
59
- }
60
- n(void 0), u(e ? V(e, "HH:mm") : ""), a(!0);
61
- }
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,
62
+ n(void 0), u(e ? V(e, "HH:mm") : ""), s(!0);
63
+ }, A = () => {
64
+ x && (l && E(l, c) ? s(!1) : k === "" ? n(void 0) : g(k) || f(!0));
65
+ }, N = () => {
66
+ n(void 0), u(""), s(!1), f(!1);
67
+ }, y = /* @__PURE__ */ i(U, {
68
+ ...r,
68
69
  popupState: t,
69
- localValue: v,
70
- isValidTime: L,
71
- isValidEndTime: N,
72
- handleChange: I,
73
- handleBlur: j
70
+ localValue: p,
71
+ isValidTime: j,
72
+ isValidEndTime: I,
73
+ handleChange: M,
74
+ handleBlur: A
74
75
  });
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),
78
- children: [/* @__PURE__ */ r("div", {
76
+ return r.disabled || r.readOnly ? y : m ? /* @__PURE__ */ L("div", {
77
+ className: D("relative h-auto", typeof r.width == "number" && "w-auto"),
78
+ ...H(r.width),
79
+ children: [/* @__PURE__ */ i("div", {
79
80
  className: "m-0 flex h-fit items-center justify-center p-0",
80
81
  children: y
81
- }), /* @__PURE__ */ r(F, {
82
+ }), /* @__PURE__ */ i(W, {
82
83
  anchor: "bottom",
83
84
  open: t.isOpen,
84
85
  onClose: t.close,
85
86
  anchorEl: t.anchorEl,
86
87
  registerBackClose: !1,
87
- children: /* @__PURE__ */ r("div", {
88
+ children: /* @__PURE__ */ i("div", {
88
89
  className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
89
- children: /* @__PURE__ */ r(G, {
90
- dataTest: o.dataTest,
91
- value: l,
90
+ children: /* @__PURE__ */ i(Q, {
91
+ dataTest: r.dataTest,
92
+ value: a,
92
93
  minTime: c,
93
- onSelect: T,
94
- handleClear: S,
94
+ onSelect: O,
95
+ handleClear: N,
95
96
  onConfirm: t.close
96
97
  })
97
98
  })
98
99
  })]
99
- }) : /* @__PURE__ */ r(z, {
100
+ }) : /* @__PURE__ */ i(J, {
100
101
  mouseEvent: "onMouseDown",
101
102
  onClickAway: t.close,
102
- children: /* @__PURE__ */ D("div", {
103
- className: g("relative h-auto", typeof o.width == "number" && "w-auto"),
104
- ...O(o.width),
105
- children: [/* @__PURE__ */ r("div", {
103
+ children: /* @__PURE__ */ L("div", {
104
+ className: D("relative h-auto", typeof r.width == "number" && "w-auto"),
105
+ ...H(r.width),
106
+ children: [/* @__PURE__ */ i("div", {
106
107
  className: "m-0 flex h-fit items-center justify-center p-0",
107
108
  children: y
108
- }), t.isOpen && /* @__PURE__ */ r(J, {
109
- ...o,
109
+ }), t.isOpen && /* @__PURE__ */ i(R, {
110
+ ...r,
110
111
  popupState: t,
111
- handleClear: S,
112
- onSelect: T
112
+ handleClear: N,
113
+ onSelect: O
113
114
  })]
114
115
  })
115
116
  });
116
117
  };
117
118
  export {
118
- fe as StyledTimePicker
119
+ de as StyledTimePicker
119
120
  };
@@ -1,12 +1,12 @@
1
1
  import { useSyncExternalStore as o } from "react";
2
- function r(t) {
2
+ function e(t) {
3
3
  function i() {
4
4
  return window.matchMedia(t).matches;
5
5
  }
6
- function a(e) {
6
+ function a(r) {
7
7
  const n = window.matchMedia(t);
8
- return n.addEventListener("change", e), () => {
9
- n.removeEventListener("change", e);
8
+ return n.addEventListener("change", r), () => {
9
+ n.removeEventListener("change", r);
10
10
  };
11
11
  }
12
12
  function u() {
@@ -16,9 +16,10 @@ function r(t) {
16
16
  return o(a, i, u);
17
17
  };
18
18
  }
19
- var h = r("(max-width: 743px)"), c = r("(max-height: 480px)"), d = r("(max-width: 743px), (max-height: 480px)");
19
+ var h = e("(max-width: 743px)"), s = e("(max-height: 480px)"), c = e("(max-height: 480px) and (min-width: 480px)"), m = e("(max-width: 743px), (max-height: 480px)");
20
20
  export {
21
- d as useFullScreenPickerMediaQuery,
21
+ m as useFullScreenPickerMediaQuery,
22
22
  h as useMobileMediaQuery,
23
- c as useShortViewportMediaQuery
23
+ c as usePickerOneRowHeaderMediaQuery,
24
+ s as useShortViewportMediaQuery
24
25
  };
@@ -46,9 +46,12 @@ interface FieldState {
46
46
  /** `variant="standard"`: same geometry as the outlined field, but the border is painted on focus only. */
47
47
  borderless?: boolean;
48
48
  }
49
- /** The border overlay (an absolutely-positioned sibling so width changes never reflow the input). */
49
+ /**
50
+ * The border overlay (an absolutely-positioned sibling so width changes never reflow the input).
51
+ * States: resting 1px delta-500 · focused 3px focus-ring · error 1px error-500 · error + focused 3px error-500.
52
+ */
50
53
  export declare const outlineClass: ({ focused, error, disabled, readOnly, borderless }: FieldState) => string;
51
- /** MUI-compatible fieldset outline used by text fields with floating labels. */
54
+ /** MUI-compatible fieldset outline used by text fields with floating labels. Same states as `outlineClass`. */
52
55
  export declare const notchedOutlineClass: ({ focused, error, disabled, readOnly, notched, }: FieldState & {
53
56
  notched?: boolean;
54
57
  }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -28,7 +28,8 @@ export interface FullScreenPickerProps {
28
28
  * search, optional selection/clear row; 1 px `border/separator` delta-200 under it) and one scrolling
29
29
  * **List**. Title = Mobile/Page title, SemiBold 20/28, `text-icon/title-label` delta-800, wraps.
30
30
  * Close = 40 × 40 Quaternary button with a 24 px ×. Search row = `pt-8 px-16`. On a short viewport
31
- * (`Variant2`, ≤ 480 px high) title, search (max 240 px) and close share the first row.
31
+ * (`Variant2`, ≤ 480 px high and ≥ 480 px wide — a phone in landscape, not an upright phone whose
32
+ * keyboard is up) title, search (max 240 px) and close share the first row.
32
33
  *
33
34
  * The shared shell for every full-screen picker in ui-core: `StyledSelectAutocomplete` and
34
35
  * `CountryCodeSelect` both render through it (ASMA-8468). Presentation only — the caller owns the
@@ -23,7 +23,6 @@ export interface PickerText {
23
23
  cleared: string;
24
24
  /** Announced after `clearAll`. */
25
25
  clearedAll: string;
26
- truncated: (shown: number, total: number) => string;
27
26
  }
28
27
  /** Default picker copy for `locale`, with any consumer overrides applied on top. */
29
28
  export declare const getPickerText: (locale: UiCoreLocale, overrides?: Partial<PickerText>) => PickerText;
@@ -20,9 +20,11 @@ export interface CountryCodeOptionsProps {
20
20
  onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
21
21
  /** Tabbing into the list: put the active-row marker on a row. */
22
22
  onFocus?: () => void;
23
+ /** The list is showing: each opening starts at the chosen country (LIST-10, AC 17). */
24
+ open?: boolean;
23
25
  }
24
26
  /**
25
27
  * The country listbox. Presentation only — filtering, the active row and the keyboard live in
26
28
  * [[useCountryPicker]], so the desktop trigger and the mobile sheet render the same list.
27
29
  */
28
- export declare const CountryCodeOptions: ({ dataTest, visible, selectedIso2, activeIndex, optionId, onSelect, listId, label, renderFlag, className, onKeyDown, onFocus, }: CountryCodeOptionsProps) => JSX.Element;
30
+ export declare const CountryCodeOptions: ({ dataTest, visible, selectedIso2, activeIndex, optionId, onSelect, listId, label, renderFlag, className, onKeyDown, onFocus, open, }: CountryCodeOptionsProps) => JSX.Element;
@@ -29,6 +29,7 @@ export interface AutocompleteRenderInputParams {
29
29
  ref: React.Ref<HTMLDivElement>;
30
30
  startAdornment?: ReactNode;
31
31
  endAdornment?: ReactNode;
32
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
32
33
  };
33
34
  };
34
35
  }
@@ -43,7 +44,8 @@ type AutocompleteValue<T, Multiple, DisableClearable, FreeSolo> = Multiple exten
43
44
  /**
44
45
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#20474-29075
45
46
  * Figma "Autocomplete". The trigger is the outlined **Input field** (shared `field-styles`: 40px,
46
- * border enabled delta-500/`#7a899e`, hover gama-300, focus gama-400 `#1ca1a1`, error error-500),
47
+ * border enabled delta-500/`#7a899e`, hover gama-300, focus 3px `color.focus.ring`, error error-500,
48
+ * error + focus 3px error-500),
47
49
  * so the field **State** (Enabled/Hovered/Focused/Error/Read-only) ← focus/open + `error`/`readOnly`/
48
50
  * `disabled`. **Filled** ← selected value(s): single fills the input text, multiple renders **Tag
49
51
  * chips** (`StyledChip`: h32, radius25, label 16/delta-700 — node 20475-29954). The dropdown is the
@@ -57,7 +57,8 @@ type StyledTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & T
57
57
  * Figma has no standalone "Text area" component — a multiline text control inherits the **Input
58
58
  * field** outlined styling (shared with `StyledInputField`/`field-styles`): radius 4, field text
59
59
  * **Body Base 16/lh24 delta-800**; border **enabled delta-500 #7a899e**, **hover gama-300 #60bdbd
60
- * (2px)**, **focus gama-400 #1ca1a1 (3px)**, **error error-500 #e10700**, **disabled delta-300**.
60
+ * (2px)**, **focus 3px `color.focus.ring`**, **error error-500 #e10700**, **error + focus 3px
61
+ * error-500**, **disabled delta-300**.
61
62
  * Title = **Body Base SemiBold 16 delta-800**; description/helper = **Helper 14/lh20 delta-600**.
62
63
  * State (Enabled/Hover/Focus/Error/Disabled) ← native + `error`/`disabled`; the `not_editable`/
63
64
  * `view_only` variants are the read-only presentations. Colours live in the textarea-only
@@ -2,7 +2,8 @@ import { StyledTimePickerProps } from './types';
2
2
  /**
3
3
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#15561-37391
4
4
  * Figma has no distinct time-picker-popover component — the trigger is the outlined **Input field**
5
- * (`field-styles`: 40px, border delta-500 / hover gama-300 / focus gama-400 / error error-500) with
5
+ * (`field-styles`: 40px, border delta-500 / hover gama-300 / focus 3px `color.focus.ring` / error
6
+ * error-500 / error + focus 3px error-500) with
6
7
  * a trailing **clock icon** (delta-700 like the select/search field icons; delta-300 when disabled).
7
8
  * The dropdown follows the **Menus** surface (delta-300 border + Menus shadow `0 2 4 rgba(34,33,51,
8
9
  * .15)`): scrollable hour/minute columns of 36px cells — hover delta-50, "now" gama-50 (like the
@@ -2,6 +2,14 @@ export declare function makeMediaQueryStore(mediaQuery: string): () => boolean;
2
2
  export declare const useMobileMediaQuery: () => boolean;
3
3
  /** A phone in landscape: too short for a sheet capped at 90vh to leave a usable body. */
4
4
  export declare const useShortViewportMediaQuery: () => boolean;
5
+ /**
6
+ * The full-screen picker's one-row header (ASMA-8468 REQ-007): a viewport that is short **and** wide
7
+ * — a phone in landscape. Short alone is not enough: on an upright phone the on-screen keyboard also
8
+ * brings the viewport under 480 px, and moving the focused search into the first row dropped the
9
+ * keyboard, which moved the search back. Upright phones are at most about 440 px wide (iPhone Pro
10
+ * Max); phones held sideways start at 568 px (iPhone SE).
11
+ */
12
+ export declare const usePickerOneRowHeaderMediaQuery: () => boolean;
5
13
  /**
6
14
  * ASMA-8468 REQ-001: a searchable select opens as a full-screen picker below 744 CSS px wide or at
7
15
  * most 480 CSS px high. The height half is the same boundary as {@link useShortViewportMediaQuery}
@@ -1,6 +1,9 @@
1
1
  declare const _default: {
2
2
  mode: string;
3
3
  important: true;
4
+ future: {
5
+ hoverOnlyWhenSupported: true;
6
+ };
4
7
  blocklist: string[];
5
8
  content: string[];
6
9
  theme: {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.114.0",
6
+ "version": "3.116.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",
@@ -63,8 +63,9 @@
63
63
  --input-error-disabled-cursor: default;
64
64
  --input-error-outline-width: 1px;
65
65
  --input-error-hover-outline-width: 1px;
66
- --input-error-active-outline-width: 1px;
67
- --input-error-focus-outline-width: 1px;
66
+ /* Error like the input field (ASMA-8561): 1px at rest and on hover, 3px on press and focus. */
67
+ --input-error-active-outline-width: 3px;
68
+ --input-error-focus-outline-width: 3px;
68
69
  --input-error-disabled-outline-width: 1px;
69
70
  /* input notEditable */
70
71
  --colors-input-notEditable-placeholder-color: var(--colors-delta-800);