asma-ui-core 3.58.2 → 3.58.4
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/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +22 -22
- package/dist/components/inputs/input-field/StyledInputField.js +77 -77
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +5 -0
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +29 -29
- package/package.json +1 -1
|
@@ -8,44 +8,44 @@ import { StyledTooltip as j } from "../../../data-display/tooltip/StyledTooltip.
|
|
|
8
8
|
import { StyledInputField as le } from "../../input-field/StyledInputField.js";
|
|
9
9
|
import { StyledSelectAutocomplete as ae } from "../../select-autocomplete/StyledSelectAutocomplete.js";
|
|
10
10
|
import { DynamicInteractiveChipGroup as re } from "./DynamicInteractiveChipGroup.js";
|
|
11
|
-
import { createElement as B, forwardRef as oe, useCallback as
|
|
11
|
+
import { createElement as B, forwardRef as oe, useCallback as b, useState as ne } from "react";
|
|
12
12
|
import { Fragment as L, jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
13
13
|
var ye = oe((S, q) => {
|
|
14
|
-
const [E, k] = ne(!1), { options:
|
|
15
|
-
const t =
|
|
14
|
+
const [E, k] = ne(!1), { options: f, dataTest: g, value: x, readOnly: u, multiple: o, required: F, onChange: y, size: z, title: C, noOptionsText: K, placeholder: _, disabled: I, helperText: H, disableHelperText: R, error: G, valueKey: A = "value", labelKey: W = "label", renderLabel: i, getOptionTooltip: N, startAdornment: J, autocompleteProps: n, loading: m, maxTags: M, onFocus: Q, onBlur: U } = S, v = f.length < 11, s = (e) => typeof e == "object" ? e?.[W]?.toString() ?? "" : e?.toString() ?? "", p = b((e) => typeof e == "object" ? e?.[A] : e, [A]), P = b((e, t) => p(e) === p(t), [p]), w = (e) => {
|
|
15
|
+
const t = p(e);
|
|
16
16
|
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" : s(e);
|
|
17
|
-
}, V =
|
|
17
|
+
}, V = b((e) => {
|
|
18
18
|
k(!0), n?.onOpen?.(e);
|
|
19
|
-
}, [n]), X =
|
|
19
|
+
}, [n]), X = b((e, t) => {
|
|
20
20
|
k(!1), n?.onClose?.(e, t);
|
|
21
21
|
}, [n]);
|
|
22
22
|
if (o && u) return /* @__PURE__ */ l(re, { ...S });
|
|
23
|
-
const O =
|
|
23
|
+
const O = C ? `${g}-title` : void 0;
|
|
24
24
|
return /* @__PURE__ */ T("div", {
|
|
25
25
|
className: "flex w-full flex-col gap-y-1",
|
|
26
|
-
children: [
|
|
26
|
+
children: [C && /* @__PURE__ */ l("span", {
|
|
27
27
|
id: O,
|
|
28
28
|
className: "text-base font-semibold text-delta-800",
|
|
29
|
-
children:
|
|
29
|
+
children: C
|
|
30
30
|
}), /* @__PURE__ */ l(ae, {
|
|
31
31
|
open: E,
|
|
32
32
|
onOpen: V,
|
|
33
33
|
onClose: X,
|
|
34
34
|
disableCloseOnSelect: o,
|
|
35
|
-
dataTest:
|
|
35
|
+
dataTest: g,
|
|
36
36
|
disabled: !!I || !!m,
|
|
37
37
|
noOptionsText: K,
|
|
38
38
|
loading: m,
|
|
39
39
|
readOnly: u,
|
|
40
|
-
value:
|
|
40
|
+
value: x,
|
|
41
41
|
size: z,
|
|
42
42
|
disableClearable: F,
|
|
43
|
-
options:
|
|
43
|
+
options: f,
|
|
44
44
|
fullWidth: !0,
|
|
45
45
|
classes: { listbox: "max-h-[300px]" },
|
|
46
46
|
getOptionLabel: n?.getOptionLabel ?? s,
|
|
47
47
|
onChange: (e, t) => {
|
|
48
|
-
|
|
48
|
+
y(t);
|
|
49
49
|
},
|
|
50
50
|
filterSelectedOptions: !1,
|
|
51
51
|
isOptionEqualToValue: n?.isOptionEqualToValue ?? P,
|
|
@@ -53,7 +53,7 @@ var ye = oe((S, q) => {
|
|
|
53
53
|
multiple: o,
|
|
54
54
|
renderValue: o ? (e) => {
|
|
55
55
|
if (!Array.isArray(e)) return null;
|
|
56
|
-
const t = e, c = M ??
|
|
56
|
+
const t = e, c = M ?? f.length, a = t.slice(0, c), d = t.length - c;
|
|
57
57
|
return [...a.map((r) => /* @__PURE__ */ l($, {
|
|
58
58
|
dataTest: `${w(r)}-chip`,
|
|
59
59
|
readOnly: u,
|
|
@@ -65,7 +65,7 @@ var ye = oe((S, q) => {
|
|
|
65
65
|
},
|
|
66
66
|
disabled: !!I || !!m,
|
|
67
67
|
onDelete: () => {
|
|
68
|
-
Array.isArray(
|
|
68
|
+
Array.isArray(x) && y(x.filter((h) => !P(h, r)));
|
|
69
69
|
}
|
|
70
70
|
}, w(r))), d > 0 ? /* @__PURE__ */ l($, {
|
|
71
71
|
dataTest: "remaining-count-tag-chip",
|
|
@@ -84,11 +84,11 @@ var ye = oe((S, q) => {
|
|
|
84
84
|
renderOption: (e, t, c) => {
|
|
85
85
|
const a = typeof t == "object" ? !!t?.disabled : !1, d = N ? N(t) : null;
|
|
86
86
|
if (o) {
|
|
87
|
-
const
|
|
87
|
+
const h = c.selected;
|
|
88
88
|
return /* @__PURE__ */ B("li", {
|
|
89
89
|
...e,
|
|
90
90
|
role: "option",
|
|
91
|
-
"aria-selected":
|
|
91
|
+
"aria-selected": h,
|
|
92
92
|
key: e.id,
|
|
93
93
|
onClick: a ? void 0 : e.onClick,
|
|
94
94
|
className: D("flex min-h-10 cursor-pointer items-center gap-x-1 bg-white px-2 text-base aria-selected:bg-gama-50 hover:bg-gama-50", a && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
@@ -102,7 +102,7 @@ var ye = oe((S, q) => {
|
|
|
102
102
|
size: "small",
|
|
103
103
|
decorative: !0,
|
|
104
104
|
className: "min-w-[36px]",
|
|
105
|
-
checked:
|
|
105
|
+
checked: h
|
|
106
106
|
}), i ? i(t) : /* @__PURE__ */ l("span", {
|
|
107
107
|
className: "h-fit text-base text-delta-700",
|
|
108
108
|
children: s(t)
|
|
@@ -135,7 +135,7 @@ var ye = oe((S, q) => {
|
|
|
135
135
|
}));
|
|
136
136
|
},
|
|
137
137
|
renderInput: (e) => /* @__PURE__ */ l(le, {
|
|
138
|
-
dataTest: `${
|
|
138
|
+
dataTest: `${g}-input-field`,
|
|
139
139
|
...e,
|
|
140
140
|
inputRef: q,
|
|
141
141
|
error: G,
|
|
@@ -146,19 +146,19 @@ var ye = oe((S, q) => {
|
|
|
146
146
|
readOnly: u,
|
|
147
147
|
onFocus: Q,
|
|
148
148
|
onBlur: U,
|
|
149
|
-
onKeyDown:
|
|
150
|
-
autoComplete:
|
|
149
|
+
onKeyDown: v ? (t) => t.preventDefault() : void 0,
|
|
150
|
+
autoComplete: "off",
|
|
151
151
|
slotProps: {
|
|
152
152
|
...e.slotProps,
|
|
153
153
|
input: {
|
|
154
154
|
...e.slotProps?.input ?? {},
|
|
155
155
|
startAdornment: J ?? e.slotProps?.input?.startAdornment,
|
|
156
|
-
style:
|
|
156
|
+
style: v ? { caretColor: "transparent" } : {}
|
|
157
157
|
},
|
|
158
158
|
htmlInput: {
|
|
159
159
|
...e.slotProps?.htmlInput ?? {},
|
|
160
160
|
...O ? { "aria-labelledby": O } : {},
|
|
161
|
-
style:
|
|
161
|
+
style: v ? { caretColor: "transparent" } : {}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}),
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as s } from "../../../helpers/cn.js";
|
|
2
2
|
import { resolveSx as E } from "../../../helpers/sx.js";
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { ErrorOutlineIcon as
|
|
5
|
-
import { floatingLabelClass as
|
|
3
|
+
import { CloseIcon as Ke } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { ErrorOutlineIcon as Ue } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
5
|
+
import { floatingLabelClass as Ve, floatingLabelLayoutStyle as We, notchedLegendClass as Ye, notchedOutlineClass as J, singleLineInputLayoutStyle as Ge, singleLineShellLayoutStyle as Je } from "../field-styles.js";
|
|
6
6
|
import y from "./StyledInputField.module.js";
|
|
7
|
-
import { Children as
|
|
8
|
-
import { jsx as i, jsxs as
|
|
7
|
+
import { Children as Qe, useCallback as Xe, useId as Ze, useLayoutEffect as Q, useRef as X, useState as k } from "react";
|
|
8
|
+
import { jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
import { useMergeRefs as Z } from "@floating-ui/react";
|
|
10
|
-
var
|
|
11
|
-
const fe =
|
|
10
|
+
var St = ({ dataTest: p, label: l, value: u, defaultValue: S, onChange: q, onBlur: O, onFocus: ee, error: o, helperText: L, disabled: d, readOnly: n, required: H, allowClear: te, onClear: ne, type: ie = "text", placeholder: oe, name: ae, id: le, autoComplete: se, autoFocus: de, multiline: r, rows: A, minRows: v, maxRows: C, size: re = "medium", fullWidth: ce, className: me, style: he, sx: pe, inputRef: ue, slotProps: t, InputProps: D, onKeyDown: T, onClick: ge, variant: qe }) => {
|
|
11
|
+
const fe = Ze(), _ = le ?? fe, P = `${_}-helper-text`, $ = X(null), j = X(null), [xe, be] = k(void 0), [I, z] = k(!1), [ye, K] = k(S != null && S !== ""), R = u !== void 0, U = R ? u !== "" && u != null : ye, Se = !!d || !!n, w = t?.input?.startAdornment ?? D?.startAdornment, g = Qe.count(w) > 0, c = g && Array.isArray(w), f = t?.input?.endAdornment ?? D?.endAdornment, M = !!(te && U && !Se), { ref: Le, ...a } = t?.htmlInput ?? {}, ve = ue ?? Le, { className: Ie, style: B, ref: Ne } = t?.input ?? {}, He = Z([Ne]), Ae = t?.input?.onMouseDown, Ce = se ?? a.autoComplete, _e = ae ?? a.name, N = I || U || g, Re = (e) => {
|
|
12
12
|
n || (R || K(e.target.value !== ""), q?.(e));
|
|
13
|
-
},
|
|
14
|
-
!
|
|
15
|
-
},
|
|
16
|
-
!
|
|
13
|
+
}, we = (e) => {
|
|
14
|
+
!d && !n && z(!0), ee?.(e);
|
|
15
|
+
}, Me = (e) => {
|
|
16
|
+
!d && !n && z(!1), O?.(e);
|
|
17
17
|
};
|
|
18
18
|
Q(() => {
|
|
19
19
|
const e = $.current;
|
|
20
|
-
if (!
|
|
20
|
+
if (!r || A != null || !e) return;
|
|
21
21
|
e.style.height = "auto";
|
|
22
|
-
const
|
|
23
|
-
e.style.height = `${Math.min(
|
|
22
|
+
const m = getComputedStyle(e), b = Number.parseFloat(m.lineHeight) || 24, G = Number.parseFloat(m.paddingTop) + Number.parseFloat(m.paddingBottom), je = v ? v * b + G : 0, ze = C ? C * b + G : Number.POSITIVE_INFINITY;
|
|
23
|
+
e.style.height = `${Math.min(ze, Math.max(je, e.scrollHeight))}px`;
|
|
24
24
|
}, [
|
|
25
25
|
S,
|
|
26
26
|
C,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
v,
|
|
28
|
+
r,
|
|
29
29
|
A,
|
|
30
30
|
u
|
|
31
31
|
]);
|
|
32
|
-
const V = Z([
|
|
32
|
+
const V = Z([ve, Xe((e) => {
|
|
33
33
|
$.current = e instanceof HTMLTextAreaElement ? e : null;
|
|
34
|
-
}, [])]), { style: F, ...
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
} :
|
|
34
|
+
}, [])]), { style: F, ...Be } = a, x = !r && !c, { height: Oe, minHeight: et, maxHeight: tt, paddingTop: nt, paddingBottom: it, ...Fe } = B ?? {}, Ee = x ? {
|
|
35
|
+
...Fe,
|
|
36
|
+
...Je()
|
|
37
|
+
} : c ? {
|
|
38
38
|
boxSizing: "border-box",
|
|
39
39
|
minHeight: 40,
|
|
40
40
|
...B
|
|
41
|
-
} : B, { height:
|
|
42
|
-
...
|
|
43
|
-
...
|
|
41
|
+
} : B, { height: ot, minHeight: at, maxHeight: lt, paddingTop: st, paddingBottom: dt, paddingLeft: rt, paddingRight: ke, ...De } = F ?? {}, Te = x ? {
|
|
42
|
+
...De,
|
|
43
|
+
...Ge({
|
|
44
44
|
paddingLeft: g ? 40 : 14,
|
|
45
|
-
paddingRight:
|
|
45
|
+
paddingRight: ke ?? xe ?? (M || f ? 40 : 14)
|
|
46
46
|
})
|
|
47
47
|
} : F;
|
|
48
48
|
Q(() => {
|
|
49
49
|
if (!x) return;
|
|
50
|
-
const e = j.current,
|
|
51
|
-
be((b) => b ===
|
|
50
|
+
const e = j.current, m = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
|
|
51
|
+
be((b) => b === m ? b : m);
|
|
52
52
|
});
|
|
53
|
-
const
|
|
54
|
-
...
|
|
55
|
-
style: x ?
|
|
56
|
-
id:
|
|
57
|
-
name:
|
|
58
|
-
placeholder:
|
|
59
|
-
disabled:
|
|
53
|
+
const Pe = N || !l, W = {
|
|
54
|
+
...Be,
|
|
55
|
+
style: x ? Te : F,
|
|
56
|
+
id: a.id ?? _,
|
|
57
|
+
name: _e,
|
|
58
|
+
placeholder: Pe ? oe : void 0,
|
|
59
|
+
disabled: d,
|
|
60
60
|
readOnly: n,
|
|
61
|
-
required:
|
|
62
|
-
autoComplete:
|
|
61
|
+
required: H,
|
|
62
|
+
autoComplete: Ce,
|
|
63
63
|
autoFocus: de,
|
|
64
64
|
value: u,
|
|
65
65
|
defaultValue: S,
|
|
66
66
|
"aria-invalid": o ? !0 : void 0,
|
|
67
|
-
"aria-label":
|
|
68
|
-
"aria-describedby": !n && (L != null || o) ? P :
|
|
69
|
-
onChange:
|
|
70
|
-
onFocus:
|
|
71
|
-
onBlur:
|
|
72
|
-
onKeyDown:
|
|
73
|
-
T?.(e), e.defaultPrevented ||
|
|
67
|
+
"aria-label": a["aria-label"] ?? (a["aria-labelledby"] ? void 0 : typeof l == "string" && l !== "" ? l : void 0),
|
|
68
|
+
"aria-describedby": !n && (L != null || o) ? P : a["aria-describedby"],
|
|
69
|
+
onChange: Re,
|
|
70
|
+
onFocus: we,
|
|
71
|
+
onBlur: Me,
|
|
72
|
+
onKeyDown: a.onKeyDown || T ? (e) => {
|
|
73
|
+
T?.(e), e.defaultPrevented || a.onKeyDown?.(e);
|
|
74
74
|
} : void 0
|
|
75
|
-
}, Y =
|
|
75
|
+
}, Y = s(y.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", c ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : r ? "w-full resize-none overflow-hidden p-0 pl-0 pr-0 leading-[23px]" : s("w-full", y["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", Ie), $e = !r && !c ? {
|
|
76
76
|
"data-start-adornment": g ? "true" : void 0,
|
|
77
77
|
"data-end-adornment": M || f ? "true" : void 0
|
|
78
78
|
} : {};
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
className:
|
|
79
|
+
return /* @__PURE__ */ h("div", {
|
|
80
|
+
className: s("group relative inline-flex flex-col", me),
|
|
81
81
|
onClick: ge,
|
|
82
82
|
style: {
|
|
83
83
|
width: ce ? "100%" : 235,
|
|
84
84
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
85
85
|
letterSpacing: "0.00938em",
|
|
86
86
|
...E(pe),
|
|
87
|
-
...
|
|
87
|
+
...he
|
|
88
88
|
},
|
|
89
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ h("div", {
|
|
90
90
|
className: "relative overflow-visible",
|
|
91
|
-
children: [/* @__PURE__ */
|
|
92
|
-
className:
|
|
93
|
-
ref:
|
|
91
|
+
children: [/* @__PURE__ */ h("div", {
|
|
92
|
+
className: s("relative flex", x && y.InputShell, r && "box-border items-center px-[14px] py-[16.5px]", c && s(y.AdornmentList, f && y["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
|
|
93
|
+
ref: He,
|
|
94
94
|
onMouseDown: Ae,
|
|
95
|
-
style:
|
|
96
|
-
"data-testid":
|
|
95
|
+
style: Ee,
|
|
96
|
+
"data-testid": c ? `${p}-adornment-list` : `${p}-shell`,
|
|
97
97
|
children: [
|
|
98
98
|
g && /* @__PURE__ */ i("span", {
|
|
99
|
-
className:
|
|
99
|
+
className: s("items-center text-delta-500", c ? "contents" : "absolute left-3 flex"),
|
|
100
100
|
children: w
|
|
101
101
|
}),
|
|
102
|
-
|
|
102
|
+
r ? /* @__PURE__ */ i("textarea", {
|
|
103
103
|
...W,
|
|
104
104
|
ref: V,
|
|
105
105
|
"data-testid": p,
|
|
106
|
-
rows: A ??
|
|
106
|
+
rows: A ?? v ?? 2,
|
|
107
107
|
className: Y
|
|
108
108
|
}) : /* @__PURE__ */ i("input", {
|
|
109
109
|
...W,
|
|
110
|
-
|
|
110
|
+
...$e,
|
|
111
111
|
ref: V,
|
|
112
112
|
"data-testid": p,
|
|
113
113
|
type: ie,
|
|
@@ -121,7 +121,7 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
|
|
|
121
121
|
onClick: (e) => {
|
|
122
122
|
e.stopPropagation(), e.preventDefault(), R || K(!1), ne?.();
|
|
123
123
|
},
|
|
124
|
-
children: /* @__PURE__ */ i(
|
|
124
|
+
children: /* @__PURE__ */ i(Ke, {
|
|
125
125
|
width: 18,
|
|
126
126
|
height: 18
|
|
127
127
|
})
|
|
@@ -130,55 +130,55 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
|
|
|
130
130
|
className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
|
|
131
131
|
children: f
|
|
132
132
|
}),
|
|
133
|
-
|
|
133
|
+
l ? /* @__PURE__ */ i("fieldset", {
|
|
134
134
|
"aria-hidden": !0,
|
|
135
135
|
className: J({
|
|
136
|
-
focused:
|
|
136
|
+
focused: I,
|
|
137
137
|
error: o,
|
|
138
|
-
disabled:
|
|
138
|
+
disabled: d,
|
|
139
139
|
readOnly: n,
|
|
140
140
|
notched: !0
|
|
141
141
|
}),
|
|
142
142
|
children: /* @__PURE__ */ i("legend", {
|
|
143
|
-
className:
|
|
144
|
-
children: /* @__PURE__ */
|
|
143
|
+
className: Ye(N),
|
|
144
|
+
children: /* @__PURE__ */ h("span", {
|
|
145
145
|
className: "inline-block px-[5px]",
|
|
146
|
-
children: [
|
|
146
|
+
children: [l, H && " *"]
|
|
147
147
|
})
|
|
148
148
|
})
|
|
149
149
|
}) : /* @__PURE__ */ i("div", {
|
|
150
150
|
"aria-hidden": !0,
|
|
151
151
|
className: J({
|
|
152
|
-
focused:
|
|
152
|
+
focused: I,
|
|
153
153
|
error: o,
|
|
154
|
-
disabled:
|
|
154
|
+
disabled: d,
|
|
155
155
|
readOnly: n,
|
|
156
156
|
notched: !1
|
|
157
157
|
})
|
|
158
158
|
})
|
|
159
159
|
]
|
|
160
|
-
}),
|
|
160
|
+
}), l && /* @__PURE__ */ h("label", {
|
|
161
161
|
htmlFor: _,
|
|
162
|
-
className:
|
|
162
|
+
className: s(Ve({
|
|
163
163
|
shrink: N,
|
|
164
|
-
focused:
|
|
164
|
+
focused: I,
|
|
165
165
|
error: o,
|
|
166
|
-
disabled:
|
|
166
|
+
disabled: d,
|
|
167
167
|
readOnly: n,
|
|
168
168
|
size: re
|
|
169
169
|
}), t?.inputLabel?.className),
|
|
170
170
|
style: {
|
|
171
171
|
...E(t?.inputLabel?.sx),
|
|
172
172
|
...t?.inputLabel?.style,
|
|
173
|
-
...
|
|
173
|
+
...We(N)
|
|
174
174
|
},
|
|
175
|
-
children: [
|
|
175
|
+
children: [l, H && " *"]
|
|
176
176
|
})]
|
|
177
|
-
}), !n && (L != null || o) && /* @__PURE__ */
|
|
177
|
+
}), !n && (L != null || o) && /* @__PURE__ */ h("div", {
|
|
178
178
|
id: P,
|
|
179
|
-
className:
|
|
179
|
+
className: s(!t?.formHelperText && "mr-[14px] box-border min-h-[24px] pt-1", o && !t?.formHelperText?.hideErrorIcon && "flex items-start gap-1 text-error-500", !o && "text-delta-600", t?.formHelperText?.className),
|
|
180
180
|
style: E(t?.formHelperText?.sx),
|
|
181
|
-
children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(
|
|
181
|
+
children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(Ue, {
|
|
182
182
|
width: 20,
|
|
183
183
|
height: 20,
|
|
184
184
|
className: "min-w-5 shrink-0"
|
|
@@ -190,5 +190,5 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
|
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
export {
|
|
193
|
-
|
|
193
|
+
St as StyledInputField
|
|
194
194
|
};
|
|
@@ -46,6 +46,11 @@ export interface StyledInputFieldProps {
|
|
|
46
46
|
placeholder?: string;
|
|
47
47
|
name?: string;
|
|
48
48
|
id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Standard HTML `autocomplete`. Left unset the browser decides, which is what a plain text field
|
|
51
|
+
* wants; a component that owns its own suggestion list (a combobox) must pass `'off'` so the
|
|
52
|
+
* browser's dropdown doesn't cover it. Also readable from `slotProps.htmlInput.autoComplete`.
|
|
53
|
+
*/
|
|
49
54
|
autoComplete?: string;
|
|
50
55
|
autoFocus?: boolean;
|
|
51
56
|
multiline?: boolean;
|
|
@@ -4,28 +4,28 @@ import { isCustomAction as O } from "../../../../types.js";
|
|
|
4
4
|
import { StyledTooltip as g } from "../../../../shared-components/tooltip/index.js";
|
|
5
5
|
import { useToggleMenuVisibility as j } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
6
6
|
import { StyledButton as k } from "../../../../shared-components/button/StyledButton.js";
|
|
7
|
-
import { DotsVerticalIcon as
|
|
8
|
-
import { StyledMenuItem as
|
|
9
|
-
import { CircleWarningOutlineIcon as
|
|
10
|
-
import w, { useEffect as
|
|
7
|
+
import { DotsVerticalIcon as F } from "../../../../shared-components/DotsVerticalIcon.js";
|
|
8
|
+
import { StyledMenuItem as I } from "../../../../shared-components/StyledMenuItem.js";
|
|
9
|
+
import { CircleWarningOutlineIcon as R } from "../../../../shared-components/CircleWarningOutlineIcon.js";
|
|
10
|
+
import w, { useEffect as V, useMemo as z, useState as D } from "react";
|
|
11
11
|
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
12
12
|
function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
13
|
-
const { anchorEl: x, open:
|
|
14
|
-
if (
|
|
15
|
-
if (!
|
|
16
|
-
const e = window.setTimeout(() =>
|
|
13
|
+
const { anchorEl: x, open: a, handleClose: i, handleOpen: P } = j(), l = v(o.row), n = C?.(o.row) ?? { state: "enabled" }, p = o.table.options.meta?.locale, y = p === "no" ? "Ingen handlinger tilgjengelig" : "No actions available", N = p === "no" ? "Radhandlinger" : "Row actions", T = z(() => l.every((e) => "component" in e ? !1 : e.hide), [l]), u = l.length > 0 && !T, m = n.state === "enabled" && !u, M = n.state !== "hidden" && (u || m || n.state === "disabled"), [c, s] = D(!1);
|
|
14
|
+
if (V(() => {
|
|
15
|
+
if (!c) return;
|
|
16
|
+
const e = window.setTimeout(() => s(!1), 1600);
|
|
17
17
|
return () => window.clearTimeout(e);
|
|
18
|
-
}, [
|
|
19
|
-
const
|
|
18
|
+
}, [c]), !M) return /* @__PURE__ */ t("div", { className: "flex w-[40px] items-center justify-center" });
|
|
19
|
+
const d = n.state === "disabled", f = /* @__PURE__ */ t(k, {
|
|
20
20
|
dataTest: "row-actions-button",
|
|
21
21
|
"aria-label": N,
|
|
22
22
|
"aria-haspopup": "true",
|
|
23
|
-
"aria-expanded":
|
|
23
|
+
"aria-expanded": a,
|
|
24
24
|
variant: "text",
|
|
25
25
|
size: "small",
|
|
26
|
-
disabled:
|
|
26
|
+
disabled: d,
|
|
27
27
|
onClick: (e) => {
|
|
28
|
-
e.stopPropagation(), e.preventDefault(), !
|
|
28
|
+
e.stopPropagation(), e.preventDefault(), !d && (a ? (i(), o.row.onChangeFocused(!1)) : (P(e), o.row.onChangeFocused(!0)));
|
|
29
29
|
},
|
|
30
30
|
onMouseDown: (e) => {
|
|
31
31
|
e.stopPropagation(), e.preventDefault();
|
|
@@ -33,8 +33,8 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
33
33
|
onMouseUp: (e) => {
|
|
34
34
|
e.stopPropagation(), e.preventDefault();
|
|
35
35
|
},
|
|
36
|
-
children: /* @__PURE__ */ t(
|
|
37
|
-
className:
|
|
36
|
+
children: /* @__PURE__ */ t(F, {
|
|
37
|
+
className: d ? "text-delta-300" : "text-delta-700",
|
|
38
38
|
width: 20,
|
|
39
39
|
height: 20
|
|
40
40
|
})
|
|
@@ -47,13 +47,13 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
47
47
|
title: n.tooltipTitle,
|
|
48
48
|
arrow: !0,
|
|
49
49
|
placement: n.tooltipPlacement ?? "top",
|
|
50
|
-
open:
|
|
51
|
-
onOpen: () =>
|
|
52
|
-
onClose: () =>
|
|
50
|
+
open: c,
|
|
51
|
+
onOpen: () => s(!0),
|
|
52
|
+
onClose: () => s(!1),
|
|
53
53
|
children: /* @__PURE__ */ t("span", {
|
|
54
54
|
className: "cursor-not-allowed",
|
|
55
55
|
onTouchStart: (e) => {
|
|
56
|
-
e.stopPropagation(), e.preventDefault(),
|
|
56
|
+
e.stopPropagation(), e.preventDefault(), s(!0);
|
|
57
57
|
},
|
|
58
58
|
onClick: (e) => {
|
|
59
59
|
e.stopPropagation(), e.preventDefault();
|
|
@@ -61,40 +61,40 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
61
61
|
children: f
|
|
62
62
|
})
|
|
63
63
|
}) : f, n.state === "enabled" && /* @__PURE__ */ t(S, {
|
|
64
|
-
open:
|
|
64
|
+
open: a,
|
|
65
65
|
anchorEl: x,
|
|
66
66
|
onClose: () => {
|
|
67
|
-
|
|
67
|
+
i(), o.row.onChangeFocused(!1);
|
|
68
68
|
},
|
|
69
69
|
onClick: () => {
|
|
70
|
-
|
|
70
|
+
i(), o.row.onChangeFocused(!1);
|
|
71
71
|
},
|
|
72
72
|
anchorOrigin: {
|
|
73
|
-
horizontal: "
|
|
73
|
+
horizontal: "right",
|
|
74
74
|
vertical: "bottom"
|
|
75
75
|
},
|
|
76
76
|
transformOrigin: {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
horizontal: "right",
|
|
78
|
+
vertical: "top"
|
|
79
79
|
},
|
|
80
80
|
children: m ? /* @__PURE__ */ b("div", {
|
|
81
81
|
className: "flex items-center gap-2 p-3 text-base text-delta-700",
|
|
82
|
-
children: [/* @__PURE__ */ t(
|
|
82
|
+
children: [/* @__PURE__ */ t(R, {
|
|
83
83
|
width: 20,
|
|
84
84
|
height: 20
|
|
85
85
|
}), /* @__PURE__ */ t("span", { children: y })]
|
|
86
86
|
}) : /* @__PURE__ */ t(A, {
|
|
87
87
|
disablePadding: !0,
|
|
88
|
-
children:
|
|
88
|
+
children: l.map((e, h) => {
|
|
89
89
|
if (O(e)) {
|
|
90
|
-
const r = e.component(o.row,
|
|
90
|
+
const r = e.component(o.row, i);
|
|
91
91
|
return w.isValidElement(r) ? /* @__PURE__ */ t(w.Fragment, { children: r }, h) : null;
|
|
92
92
|
}
|
|
93
93
|
return e.hide ? null : /* @__PURE__ */ t(g, {
|
|
94
94
|
title: e?.tooltipTitle,
|
|
95
95
|
arrow: !0,
|
|
96
96
|
placement: e?.tooltipPlacement ?? "left",
|
|
97
|
-
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
97
|
+
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(I, {
|
|
98
98
|
className: e.className,
|
|
99
99
|
disabled: e.disabled,
|
|
100
100
|
onClick: () => {
|