asma-ui-core 3.114.0 → 3.115.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/inputs/field-styles.js +16 -16
- package/dist/components/inputs/textarea/StyledTextarea.module.js +8 -8
- package/dist/datetime/components/time-picker/StyledTimePicker.js +79 -78
- package/dist/src/components/inputs/field-styles.d.ts +5 -2
- package/dist/src/components/inputs/field-styles.test.d.ts +1 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +2 -1
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +2 -1
- package/dist/src/datetime/components/time-picker/StyledTimePicker.d.ts +2 -1
- package/package.json +1 -1
- package/src/styles/components-colors/inputVariables.css +3 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
var
|
|
1
|
+
import { cn as t } from "../../helpers/cn.js";
|
|
2
|
+
var l = () => ({
|
|
3
3
|
boxSizing: "border-box",
|
|
4
4
|
height: 40,
|
|
5
5
|
minHeight: 40,
|
|
6
6
|
maxHeight: 40
|
|
7
|
-
}),
|
|
7
|
+
}), s = ({ paddingLeft: e = 14, paddingRight: r = 14 } = {}) => ({
|
|
8
8
|
boxSizing: "border-box",
|
|
9
9
|
margin: 0,
|
|
10
10
|
paddingTop: 0,
|
|
@@ -16,29 +16,29 @@ var d = () => ({
|
|
|
16
16
|
maxHeight: 40,
|
|
17
17
|
lineHeight: "24px",
|
|
18
18
|
fontSize: 16
|
|
19
|
-
}),
|
|
19
|
+
}), b = (e) => e ? {
|
|
20
20
|
top: 0,
|
|
21
21
|
transform: "translateY(-50%)"
|
|
22
22
|
} : {
|
|
23
23
|
top: "50%",
|
|
24
24
|
transform: "translateY(-50%)"
|
|
25
|
-
},
|
|
25
|
+
}, x = (e) => ({
|
|
26
26
|
width: "100%",
|
|
27
27
|
maxWidth: `var(--field-width-${e})`
|
|
28
|
-
}),
|
|
28
|
+
}), p = {
|
|
29
29
|
"--field-width-full": "100%",
|
|
30
30
|
"--form-column-width": "100%"
|
|
31
|
-
}, g = (e) => e <= 9 ? "xs" : e <= 15 ? "s" : e <= 27 ? "m" : "full",
|
|
31
|
+
}, g = (e) => e <= 9 ? "xs" : e <= 15 ? "s" : e <= 27 ? "m" : "full", h = ({ disabled: e } = {}) => t("block pb-1 text-base font-semibold", e ? "text-delta-300" : "text-delta-800"), n = "shadow-[inset_0_0_0_2px_var(--colors-error-500)]", u = ({ focused: e, error: r, disabled: o, readOnly: a, borderless: i }) => t("pointer-events-none absolute inset-0 rounded border border-solid transition-colors", i && !e ? "border-transparent" : o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), v = ({ focused: e, error: r, disabled: o, readOnly: a, notched: i = !0 }) => t("pointer-events-none absolute z-0 m-0 box-border min-w-0 overflow-hidden rounded border border-solid transition-colors", i ? "inset-x-0 bottom-0 top-[-5px] px-2 py-0" : "inset-0", o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), m = (e) => t("block h-[11px] overflow-hidden bg-white p-0 text-xs leading-[23px] text-transparent transition-[max-width] duration-150", e ? "max-w-full" : "max-w-[0.01px]"), f = ({ shrink: e, focused: r, error: o, disabled: a, readOnly: i }) => t("pointer-events-none absolute left-[14px] z-10 max-w-[calc(100%-1.75rem)] truncate transition-colors duration-150", a ? "text-delta-300" : i ? "text-delta-800" : o ? "text-error-500" : r ? "text-gama-500" : e ? "text-delta-800" : "text-delta-500", e ? "bg-white px-1 text-xs leading-[16px] tracking-[0.24px]" : "text-base leading-[23px] tracking-[0.00938em]");
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
h as fieldLabelAboveClass,
|
|
34
34
|
g as fieldWidthForMaxLength,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
x as fieldWidthStyle,
|
|
36
|
+
f as floatingLabelClass,
|
|
37
|
+
b as floatingLabelLayoutStyle,
|
|
38
|
+
p as fullScreenFieldWidthVars,
|
|
39
|
+
m as notchedLegendClass,
|
|
40
|
+
v as notchedOutlineClass,
|
|
41
41
|
u as outlineClass,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
s as singleLineInputLayoutStyle,
|
|
43
|
+
l as singleLineShellLayoutStyle
|
|
44
44
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
textarea:
|
|
3
|
-
active:
|
|
4
|
-
error:
|
|
5
|
-
label:
|
|
6
|
-
disabled:
|
|
7
|
-
description:
|
|
1
|
+
var e = "_textarea_1sre0_1", r = "_active_1sre0_1", a = "_error_1sre0_43", _ = "_label_1sre0_86", t = "_disabled_1sre0_94", s = "_description_1sre0_99", d = {
|
|
2
|
+
textarea: e,
|
|
3
|
+
active: r,
|
|
4
|
+
error: a,
|
|
5
|
+
label: _,
|
|
6
|
+
disabled: t,
|
|
7
|
+
description: s
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
d as default
|
|
11
11
|
};
|
|
@@ -1,119 +1,120 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { isOverlayBackEnabled as
|
|
3
|
-
import { useIsMobileView as
|
|
4
|
-
import { StyledDrawer as
|
|
5
|
-
import { useBackNavigationClose as
|
|
6
|
-
import { usePopupState as
|
|
7
|
-
import { ClickAwayListener as
|
|
8
|
-
import { isBeforeMinTime as
|
|
9
|
-
import { TimePickerPanel as
|
|
10
|
-
import { TimePickerPopper as
|
|
11
|
-
import { getTimeFromValue as
|
|
12
|
-
import { timePickerWidthProps as
|
|
13
|
-
import { TimePickerInput as
|
|
14
|
-
import { useEffect as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { format as V, isBefore as
|
|
17
|
-
var
|
|
18
|
-
const { value:
|
|
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 =
|
|
22
|
-
|
|
21
|
+
}), m = K();
|
|
22
|
+
F({
|
|
23
23
|
active: t.isOpen,
|
|
24
24
|
requestClose: t.close
|
|
25
|
-
}),
|
|
26
|
-
open: m && t.isOpen && !
|
|
25
|
+
}), z({
|
|
26
|
+
open: m && t.isOpen && !q(),
|
|
27
27
|
onClose: t.close
|
|
28
28
|
});
|
|
29
|
-
const { isOpen:
|
|
30
|
-
|
|
31
|
-
if (!
|
|
32
|
-
const e = (
|
|
33
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
b,
|
|
38
|
+
S,
|
|
39
|
+
w,
|
|
40
40
|
m
|
|
41
41
|
]);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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:
|
|
70
|
-
isValidTime:
|
|
71
|
-
isValidEndTime:
|
|
72
|
-
handleChange:
|
|
73
|
-
handleBlur:
|
|
70
|
+
localValue: p,
|
|
71
|
+
isValidTime: j,
|
|
72
|
+
isValidEndTime: I,
|
|
73
|
+
handleChange: M,
|
|
74
|
+
handleBlur: A
|
|
74
75
|
});
|
|
75
|
-
return
|
|
76
|
-
className:
|
|
77
|
-
...
|
|
78
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
90
|
-
dataTest:
|
|
91
|
-
value:
|
|
90
|
+
children: /* @__PURE__ */ i(Q, {
|
|
91
|
+
dataTest: r.dataTest,
|
|
92
|
+
value: a,
|
|
92
93
|
minTime: c,
|
|
93
|
-
onSelect:
|
|
94
|
-
handleClear:
|
|
94
|
+
onSelect: O,
|
|
95
|
+
handleClear: N,
|
|
95
96
|
onConfirm: t.close
|
|
96
97
|
})
|
|
97
98
|
})
|
|
98
99
|
})]
|
|
99
|
-
}) : /* @__PURE__ */
|
|
100
|
+
}) : /* @__PURE__ */ i(J, {
|
|
100
101
|
mouseEvent: "onMouseDown",
|
|
101
102
|
onClickAway: t.close,
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
-
className:
|
|
104
|
-
...
|
|
105
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
109
|
-
...
|
|
109
|
+
}), t.isOpen && /* @__PURE__ */ i(R, {
|
|
110
|
+
...r,
|
|
110
111
|
popupState: t,
|
|
111
|
-
handleClear:
|
|
112
|
-
onSelect:
|
|
112
|
+
handleClear: N,
|
|
113
|
+
onSelect: O
|
|
113
114
|
})]
|
|
114
115
|
})
|
|
115
116
|
});
|
|
116
117
|
};
|
|
117
118
|
export {
|
|
118
|
-
|
|
119
|
+
de as StyledTimePicker
|
|
119
120
|
};
|
|
@@ -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
|
-
/**
|
|
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 {};
|
|
@@ -43,7 +43,8 @@ type AutocompleteValue<T, Multiple, DisableClearable, FreeSolo> = Multiple exten
|
|
|
43
43
|
/**
|
|
44
44
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#20474-29075
|
|
45
45
|
* Figma "Autocomplete". The trigger is the outlined **Input field** (shared `field-styles`: 40px,
|
|
46
|
-
* border enabled delta-500/`#7a899e`, hover gama-300, focus
|
|
46
|
+
* border enabled delta-500/`#7a899e`, hover gama-300, focus 3px `color.focus.ring`, error error-500,
|
|
47
|
+
* error + focus 3px error-500),
|
|
47
48
|
* so the field **State** (Enabled/Hovered/Focused/Error/Read-only) ← focus/open + `error`/`readOnly`/
|
|
48
49
|
* `disabled`. **Filled** ← selected value(s): single fills the input text, multiple renders **Tag
|
|
49
50
|
* 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
|
|
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
|
|
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
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
67
|
-
--input-error-
|
|
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);
|