asma-ui-core 3.106.0 → 3.107.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,82 @@
1
- import { ClockOutlineIcon as I } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
2
- import { StyledInputField as N } from "../../../components/inputs/input-field/StyledInputField.js";
3
- import { useInputMask as y } from "../../../helpers/inputMask.js";
4
- import { HelperText as P, defaultTimePickerHelperMessages as R } from "./components/HelperText.js";
5
- import { useEffect as v, useRef as w } from "react";
6
- import { jsx as o, jsxs as H } from "react/jsx-runtime";
7
- var O = (c) => {
8
- const { placeholder: x, disabled: e, inputClassName: u, dataTest: n, width: l, error: f, helperText: h, label: g, locale: k = "en", popupState: a, handleChange: T, handleBlur: C, isValidTime: p, isValidEndTime: m, localValue: b, title: d, readOnly: t } = c, E = y({
1
+ import { ClockOutlineIcon as P } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
2
+ 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({
9
10
  mask: "xx:xx",
10
11
  maskChar: "x",
11
12
  showMask: !1
12
- }), i = !p || !m || !!f, s = w(null);
13
- return v(() => {
14
- s.current && a.setAnchorEl(s.current);
15
- }, []), /* @__PURE__ */ H("div", {
13
+ }), s = !d || !c || !!g, n = V(null), u = M();
14
+ return H(() => {
15
+ n.current && i.setAnchorEl(n.current);
16
+ }, []), /* @__PURE__ */ j("div", {
16
17
  style: { height: t ? "40px" : "75px" },
17
- children: [d && /* @__PURE__ */ o("div", {
18
+ children: [a && /* @__PURE__ */ l("div", {
19
+ id: u,
18
20
  className: "pb-1 font-roboto font-semibold text-delta-800",
19
- children: d
20
- }), /* @__PURE__ */ o(N, {
21
- inputRef: E,
21
+ children: a
22
+ }), /* @__PURE__ */ l(y, {
23
+ inputRef: N,
22
24
  autoComplete: "off",
23
25
  type: "text",
24
- dataTest: n,
25
- "data-testid": n,
26
- placeholder: x,
26
+ dataTest: p,
27
+ "data-testid": p,
28
+ placeholder: f,
27
29
  size: "small",
28
- error: i,
29
- helperText: /* @__PURE__ */ o(P, {
30
- isValidTime: p,
31
- isValidEndTime: m,
32
- error: i,
30
+ error: s,
31
+ helperText: /* @__PURE__ */ l(w, {
32
+ isValidTime: d,
33
+ isValidEndTime: c,
34
+ error: s,
33
35
  localization: k,
34
- helperText: h,
35
- messages: R
36
+ helperText: T,
37
+ messages: A
36
38
  }),
37
- onChange: T,
38
- onBlur: C,
39
+ onChange: C,
40
+ onBlur: I,
39
41
  slotProps: {
42
+ htmlInput: R({
43
+ title: a,
44
+ titleId: u,
45
+ label: m,
46
+ inputAriaProps: E
47
+ }),
40
48
  input: {
41
- ref: s,
49
+ ref: n,
42
50
  onClick: (r) => {
43
- !e && !t && a.open(r);
51
+ !e && !t && i.open(r);
44
52
  },
45
- endAdornment: /* @__PURE__ */ o(I, {
53
+ endAdornment: /* @__PURE__ */ l(P, {
46
54
  width: 24,
47
55
  height: 24,
48
56
  className: e ? "text-delta-300" : "text-delta-700",
49
57
  onClick: (r) => {
50
- r.stopPropagation(), !e && !t && a.open(r);
58
+ r.stopPropagation(), !e && !t && i.open(r);
51
59
  }
52
60
  })
53
61
  },
54
62
  formHelperText: {
55
- className: i ? "ml-0 mr-[14px] mt-1 leading-[23.24px]" : "mx-[14px] mt-1 leading-[23.24px]",
63
+ className: s ? "ml-0 mr-[14px] mt-1 leading-[23.24px]" : "mx-[14px] mt-1 leading-[23.24px]",
56
64
  hideErrorIcon: !0
57
65
  }
58
66
  },
59
67
  value: b,
60
68
  sx: {
61
- maxWidth: l ?? 130,
62
- width: l,
63
- minWidth: l
69
+ maxWidth: o ?? 130,
70
+ width: o,
71
+ minWidth: o
64
72
  },
65
73
  disabled: e,
66
74
  readOnly: t,
67
- className: u,
68
- label: g
75
+ className: h,
76
+ label: m
69
77
  })]
70
78
  });
71
79
  };
72
80
  export {
73
- O as TimePickerInput
81
+ q as TimePickerInput
74
82
  };
@@ -0,0 +1,10 @@
1
+ var t = ({ title: e, titleId: l, label: b, inputAriaProps: a }) => {
2
+ const r = !!b || !!a?.["aria-label"] || !!a?.["aria-labelledby"];
3
+ return {
4
+ ...e && !r ? { "aria-labelledby": l } : {},
5
+ ...a
6
+ };
7
+ };
8
+ export {
9
+ t as getTitleLabelling
10
+ };
@@ -1,3 +1,4 @@
1
+ import { AriaAttributes } from 'react';
1
2
  import { DayPickerProps as ReactDayPickerProps, Matcher } from 'react-day-picker';
2
3
  export interface IBaseDatePickerInput {
3
4
  dataTest: string;
@@ -23,5 +24,6 @@ export interface IBaseDatePickerInput {
23
24
  hideDefaultHelperText?: boolean;
24
25
  required?: boolean;
25
26
  minDate?: Date;
27
+ inputAriaProps?: AriaAttributes;
26
28
  }
27
29
  export declare const BaseDatePickerInput: React.FC<IBaseDatePickerInput>;
@@ -1,3 +1,4 @@
1
+ import { AriaAttributes } from 'react';
1
2
  import { DayPicker, Matcher } from 'react-day-picker';
2
3
  export type CalendarProps = React.ComponentProps<typeof DayPicker>;
3
4
  type CommonDatePickerProps = {
@@ -25,6 +26,11 @@ export interface DatePickerSingleFieldProps {
25
26
  disallowPast?: boolean;
26
27
  disallowFuture?: boolean;
27
28
  hideDefaultHelperText?: boolean;
29
+ /**
30
+ * Extra ARIA attributes for the text input (e.g. `aria-label`, `aria-required`). Without them the
31
+ * input is named by `title`, which is otherwise plain text above the field.
32
+ */
33
+ inputAriaProps?: AriaAttributes;
28
34
  }
29
35
  export interface DatePickerRangeFieldProps {
30
36
  labelFrom?: string;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { AriaAttributes, ReactNode } from 'react';
2
2
  /**
3
3
  * @param notBeforeTime - Start time of the range. Selected time must be after this value.
4
4
  */
@@ -24,5 +24,10 @@ export interface StyledTimePickerProps {
24
24
  * Unlike `notBeforeTime`, it never shows an error.
25
25
  */
26
26
  minTime?: Date;
27
+ /**
28
+ * Extra ARIA attributes for the text input (e.g. `aria-label`, `aria-required`) — for a visible
29
+ * label rendered outside the picker. Without them the input is named by `title` or `label`.
30
+ */
31
+ inputAriaProps?: AriaAttributes;
27
32
  }
28
33
  export type IPopupStateType = JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { AriaAttributes } from 'react';
2
+ /**
3
+ * ARIA naming for a datetime input that shows its `title` as plain text above the field: points the
4
+ * input at the title unless a floating `label` or an explicit name in `inputAriaProps` already names it
5
+ * (`aria-labelledby` would otherwise override that name). `inputAriaProps` are spread last.
6
+ */
7
+ export declare const getTitleLabelling: ({ title, titleId, label, inputAriaProps, }: {
8
+ title?: string;
9
+ titleId: string;
10
+ label?: string;
11
+ inputAriaProps?: AriaAttributes;
12
+ }) => AriaAttributes;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.106.0",
6
+ "version": "3.107.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",