mcr-design-systems 1.0.85 → 1.0.91
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/Icon/generated/MarkerPin02Icon.d.ts +38 -0
- package/dist/components/Icon/generated/MarkerPin02Icon.js +54 -0
- package/dist/components/Icon/generated/MarkerPin02SolidIcon.d.ts +38 -0
- package/dist/components/Icon/generated/MarkerPin02SolidIcon.js +54 -0
- package/dist/components/Icon/helper/index.d.ts +1 -1
- package/dist/components/Icon/helper/mapicon.js +3 -1
- package/dist/components/PIN/index.js +71 -70
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +101 -96
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MarkerPin02IconProps {
|
|
3
|
+
/**
|
|
4
|
+
* Icon size in pixels
|
|
5
|
+
* @default 24
|
|
6
|
+
*/
|
|
7
|
+
size?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Icon color - CSS color value
|
|
10
|
+
* @default 'currentColor'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Additional CSS class names
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom styles
|
|
19
|
+
*/
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/**
|
|
22
|
+
* Click handler
|
|
23
|
+
*/
|
|
24
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* ARIA label for accessibility
|
|
27
|
+
*/
|
|
28
|
+
'aria-label'?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Title attribute for tooltip
|
|
31
|
+
*/
|
|
32
|
+
title?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* MarkerPin02 icon component
|
|
36
|
+
*/
|
|
37
|
+
export declare const MarkerPin02Icon: React.FC<MarkerPin02IconProps>;
|
|
38
|
+
export default MarkerPin02Icon;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import f from "react";
|
|
3
|
+
const m = ({
|
|
4
|
+
size: i = 24,
|
|
5
|
+
color: n = "currentColor",
|
|
6
|
+
className: r,
|
|
7
|
+
style: o,
|
|
8
|
+
onClick: C,
|
|
9
|
+
"aria-label": g,
|
|
10
|
+
title: a
|
|
11
|
+
}) => {
|
|
12
|
+
const c = f.useMemo(() => {
|
|
13
|
+
const t = new DOMParser().parseFromString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
14
|
+
<path d="M19 10C19 6.13401 15.866 3 12 3C8.13401 3 5 6.13401 5 10C5 12.2992 6.25649 14.0524 7.97168 15.8389C8.39733 16.2822 8.8392 16.7168 9.29102 17.1611C9.7388 17.6015 10.1964 18.0518 10.6318 18.5107C11.1128 19.0176 11.5806 19.5514 12 20.1182C12.4194 19.5514 12.8872 19.0176 13.3682 18.5107C13.8036 18.0518 14.2612 17.6015 14.709 17.1611C15.1608 16.7168 15.6027 16.2822 16.0283 15.8389C17.7435 14.0524 19 12.2992 19 10ZM14 9.5C14 8.39543 13.1046 7.5 12 7.5C10.8954 7.5 10 8.39543 10 9.5C10 10.6046 10.8954 11.5 12 11.5C13.1046 11.5 14 10.6046 14 9.5ZM21 10C21 13.1191 19.2564 15.3657 17.4717 17.2246C17.0223 17.6926 16.558 18.1476 16.1113 18.5869C15.6608 19.0301 15.2275 19.4575 14.8193 19.8877C13.9987 20.7526 13.3285 21.5793 12.8945 22.4473C12.7251 22.786 12.3788 23 12 23C11.6212 23 11.2749 22.786 11.1055 22.4473C10.6715 21.5793 10.0013 20.7526 9.18066 19.8877C8.77247 19.4575 8.33923 19.0301 7.88867 18.5869C7.44205 18.1476 6.97767 17.6926 6.52832 17.2246C4.74356 15.3657 3 13.1191 3 10C3 5.02944 7.02944 1 12 1C16.9706 1 21 5.02944 21 10ZM16 9.5C16 11.7091 14.2091 13.5 12 13.5C9.79086 13.5 8 11.7091 8 9.5C8 7.29086 9.79086 5.5 12 5.5C14.2091 5.5 16 7.29086 16 9.5Z" fill="black"/>
|
|
15
|
+
</svg>
|
|
16
|
+
`, "image/svg+xml").querySelector("svg");
|
|
17
|
+
if (!t) return "";
|
|
18
|
+
if (t.setAttribute("width", i.toString()), t.setAttribute("height", i.toString()), t.querySelectorAll(
|
|
19
|
+
"path, circle, rect, polygon, polyline, line, ellipse"
|
|
20
|
+
).forEach((e) => {
|
|
21
|
+
const s = e.getAttribute("fill"), l = e.getAttribute("stroke");
|
|
22
|
+
s && s !== "none" && e.setAttribute("fill", n), l && l !== "none" && e.setAttribute("stroke", n);
|
|
23
|
+
}), r) {
|
|
24
|
+
const e = t.getAttribute("class") || "";
|
|
25
|
+
t.setAttribute(
|
|
26
|
+
"class",
|
|
27
|
+
`${e} ${r}`.trim()
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return new XMLSerializer().serializeToString(t);
|
|
31
|
+
}, [i, n, r]);
|
|
32
|
+
return /* @__PURE__ */ u(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: r,
|
|
36
|
+
style: {
|
|
37
|
+
display: "inline-flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
lineHeight: 0,
|
|
42
|
+
...o
|
|
43
|
+
},
|
|
44
|
+
onClick: C,
|
|
45
|
+
"aria-label": g || "marker-pin-02 icon",
|
|
46
|
+
title: a,
|
|
47
|
+
dangerouslySetInnerHTML: { __html: c }
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
m as MarkerPin02Icon,
|
|
53
|
+
m as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MarkerPin02SolidIconProps {
|
|
3
|
+
/**
|
|
4
|
+
* Icon size in pixels
|
|
5
|
+
* @default 24
|
|
6
|
+
*/
|
|
7
|
+
size?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Icon color - CSS color value
|
|
10
|
+
* @default 'currentColor'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Additional CSS class names
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom styles
|
|
19
|
+
*/
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/**
|
|
22
|
+
* Click handler
|
|
23
|
+
*/
|
|
24
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* ARIA label for accessibility
|
|
27
|
+
*/
|
|
28
|
+
'aria-label'?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Title attribute for tooltip
|
|
31
|
+
*/
|
|
32
|
+
title?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* MarkerPin02Solid icon component
|
|
36
|
+
*/
|
|
37
|
+
export declare const MarkerPin02SolidIcon: React.FC<MarkerPin02SolidIconProps>;
|
|
38
|
+
export default MarkerPin02SolidIcon;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import f from "react";
|
|
3
|
+
const A = ({
|
|
4
|
+
size: i = 24,
|
|
5
|
+
color: n = "currentColor",
|
|
6
|
+
className: r,
|
|
7
|
+
style: o,
|
|
8
|
+
onClick: g,
|
|
9
|
+
"aria-label": a,
|
|
10
|
+
title: c
|
|
11
|
+
}) => {
|
|
12
|
+
const u = f.useMemo(() => {
|
|
13
|
+
const t = new DOMParser().parseFromString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
14
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 10C3 5.02944 7.02944 1 12 1C16.9706 1 21 5.02944 21 10C21 13.1191 19.2561 15.3655 17.4713 17.2244C17.0407 17.673 16.5965 18.1098 16.1671 18.5321L16.1114 18.5869C15.6608 19.0301 15.2274 19.4575 14.8192 19.8878C13.9985 20.7526 13.3284 21.5792 12.8944 22.4472C12.725 22.786 12.3788 23 12 23C11.6212 23 11.275 22.786 11.1056 22.4472C10.6716 21.5792 10.0015 20.7526 9.18085 19.8878C8.77261 19.4575 8.33924 19.0301 7.88863 18.5869L7.8328 18.532C7.40342 18.1097 6.9593 17.673 6.52865 17.2244C4.74387 15.3655 3 13.1191 3 10ZM15 9.5C15 11.1569 13.6569 12.5 12 12.5C10.3431 12.5 9 11.1569 9 9.5C9 7.84315 10.3431 6.5 12 6.5C13.6569 6.5 15 7.84315 15 9.5Z" fill="black"/>
|
|
15
|
+
</svg>
|
|
16
|
+
`, "image/svg+xml").querySelector("svg");
|
|
17
|
+
if (!t) return "";
|
|
18
|
+
if (t.setAttribute("width", i.toString()), t.setAttribute("height", i.toString()), t.querySelectorAll(
|
|
19
|
+
"path, circle, rect, polygon, polyline, line, ellipse"
|
|
20
|
+
).forEach((e) => {
|
|
21
|
+
const l = e.getAttribute("fill"), s = e.getAttribute("stroke");
|
|
22
|
+
l && l !== "none" && e.setAttribute("fill", n), s && s !== "none" && e.setAttribute("stroke", n);
|
|
23
|
+
}), r) {
|
|
24
|
+
const e = t.getAttribute("class") || "";
|
|
25
|
+
t.setAttribute(
|
|
26
|
+
"class",
|
|
27
|
+
`${e} ${r}`.trim()
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return new XMLSerializer().serializeToString(t);
|
|
31
|
+
}, [i, n, r]);
|
|
32
|
+
return /* @__PURE__ */ C(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: r,
|
|
36
|
+
style: {
|
|
37
|
+
display: "inline-flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
lineHeight: 0,
|
|
42
|
+
...o
|
|
43
|
+
},
|
|
44
|
+
onClick: g,
|
|
45
|
+
"aria-label": a || "marker-pin-02 icon",
|
|
46
|
+
title: c,
|
|
47
|
+
dangerouslySetInnerHTML: { __html: u }
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
A as MarkerPin02SolidIcon,
|
|
53
|
+
A as default
|
|
54
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type IconName = 'activity' | 'activity-heart' | 'alarm-clock' | 'alarm-clock-check' | 'alert-circle' | 'alert-octagon' | 'alert-triangle' | 'align-left' | 'align-right' | 'bank-note-03' | 'bell-01' | 'calendar' | 'camera-01' | 'check' | 'check-circle' | 'chevron-down' | 'chevron-left' | 'chevron-left-double' | 'chevron-right' | 'chevron-right-double' | 'chevron-up' | 'circle' | 'credit-card-02' | 'dots-vertical' | 'download-01' | 'edit-02' | 'eye' | 'eye-off' | 'file-06' | 'filter-funnel-01' | 'folder-shield' | 'headphones-02' | 'heart' | 'help-circle' | 'image-03' | 'info-circle' | 'link-external-01' | 'loading-01' | 'log-out-01' | 'message-question-square' | 'minus' | 'plus' | 'refresh-cw-01' | 'search-lg' | 'search-md' | 'shield-tick' | 'trash-01' | 'user-01' | 'user-03' | 'x-circle' | 'x-close';
|
|
1
|
+
export type IconName = 'activity' | 'activity-heart' | 'alarm-clock' | 'alarm-clock-check' | 'alert-circle' | 'alert-octagon' | 'alert-triangle' | 'align-left' | 'align-right' | 'bank-note-03' | 'bell-01' | 'calendar' | 'camera-01' | 'check' | 'check-circle' | 'chevron-down' | 'chevron-left' | 'chevron-left-double' | 'chevron-right' | 'chevron-right-double' | 'chevron-up' | 'circle' | 'credit-card-02' | 'dots-vertical' | 'download-01' | 'edit-02' | 'eye' | 'eye-off' | 'file-06' | 'filter-funnel-01' | 'folder-shield' | 'headphones-02' | 'heart' | 'help-circle' | 'image-03' | 'info-circle' | 'link-external-01' | 'loading-01' | 'log-out-01' | 'marker-pin-02' | 'message-question-square' | 'minus' | 'plus' | 'refresh-cw-01' | 'search-lg' | 'search-md' | 'shield-tick' | 'trash-01' | 'user-01' | 'user-03' | 'x-circle' | 'x-close';
|
|
@@ -100,7 +100,9 @@ const i = {
|
|
|
100
100
|
"edit-02-solid": () => import("../generated/Edit02SolidIcon.js"),
|
|
101
101
|
"trash-01-solid": () => import("../generated/Trash01SolidIcon.js"),
|
|
102
102
|
"image-03": () => import("../generated/Image03Icon.js"),
|
|
103
|
-
"image-03-solid": () => import("../generated/Image03SolidIcon.js")
|
|
103
|
+
"image-03-solid": () => import("../generated/Image03SolidIcon.js"),
|
|
104
|
+
"marker-pin-02": () => import("../generated/MarkerPin02Icon.js"),
|
|
105
|
+
"marker-pin-02-solid": () => import("../generated/MarkerPin02SolidIcon.js")
|
|
104
106
|
};
|
|
105
107
|
export {
|
|
106
108
|
i as MAP_ICON
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as z, jsx as
|
|
2
|
-
import { forwardRef as E, useState as
|
|
1
|
+
import { jsxs as z, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as E, useState as P, useRef as S, useEffect as A, useCallback as I } from "react";
|
|
3
3
|
import { pinInputVariants as $, pinVariants as G } from "./variants.js";
|
|
4
4
|
import { Typography as J } from "../Typography/index.js";
|
|
5
5
|
import Q from "../TextField/HelperText.js";
|
|
@@ -8,83 +8,84 @@ import { dataTestId as U } from "../../shared/utils/dataTestId.js";
|
|
|
8
8
|
const W = E(
|
|
9
9
|
({
|
|
10
10
|
length: r = 4,
|
|
11
|
-
mask:
|
|
12
|
-
error:
|
|
13
|
-
loading:
|
|
14
|
-
disabled:
|
|
15
|
-
onChange:
|
|
11
|
+
mask: b = !1,
|
|
12
|
+
error: B,
|
|
13
|
+
loading: V = !1,
|
|
14
|
+
disabled: w = !1,
|
|
15
|
+
onChange: n,
|
|
16
16
|
onComplete: X,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18
|
+
value: v = "",
|
|
19
|
+
autoFocus: T = !0,
|
|
20
|
+
className: D,
|
|
20
21
|
label: j,
|
|
21
|
-
helperText:
|
|
22
|
-
size:
|
|
23
|
-
showValidationError:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const [a, f] =
|
|
27
|
-
Array.from({ length: r }, (s, t) =>
|
|
28
|
-
), [m,
|
|
29
|
-
|
|
30
|
-
const s = Array.from({ length: r }, (t, e) =>
|
|
31
|
-
f(s), s.join("").length === r &&
|
|
32
|
-
}, [
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
const
|
|
22
|
+
helperText: F,
|
|
23
|
+
size: h = "medium",
|
|
24
|
+
showValidationError: u = !0,
|
|
25
|
+
...C
|
|
26
|
+
}, K) => {
|
|
27
|
+
const [a, f] = P(
|
|
28
|
+
Array.from({ length: r }, (s, t) => v[t] || "")
|
|
29
|
+
), [m, R] = P(!1), [N, l] = P(""), o = S([]);
|
|
30
|
+
A(() => {
|
|
31
|
+
const s = Array.from({ length: r }, (t, e) => v[e] || "");
|
|
32
|
+
f(s), s.join("").length === r && l("");
|
|
33
|
+
}, [v, r]), A(() => {
|
|
34
|
+
T && !w && o.current[0] && o.current[0].focus();
|
|
35
|
+
}, [T, w]);
|
|
36
|
+
const _ = I(
|
|
36
37
|
(s, t) => {
|
|
37
|
-
const e = t.replace(/\D/g, "").slice(-1),
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
const e = t.replace(/\D/g, "").slice(-1), c = [...a];
|
|
39
|
+
c[s] = e, f(c);
|
|
40
|
+
const i = c.join("");
|
|
41
|
+
n?.(i), N && l(""), e && s < r - 1 && o.current[s + 1]?.focus();
|
|
41
42
|
},
|
|
42
|
-
[a, r,
|
|
43
|
-
),
|
|
43
|
+
[a, r, n, N]
|
|
44
|
+
), q = I(
|
|
44
45
|
(s, t) => {
|
|
45
46
|
if (t.key === "Backspace") {
|
|
46
47
|
if (!a[s] && s > 0) {
|
|
47
48
|
const e = [...a];
|
|
48
|
-
e[s - 1] = "", f(e), o.current[s - 1]?.focus(),
|
|
49
|
-
const
|
|
50
|
-
(
|
|
49
|
+
e[s - 1] = "", f(e), o.current[s - 1]?.focus(), n?.(e.join(""));
|
|
50
|
+
const i = [...e].filter(
|
|
51
|
+
(p) => p.trim() !== ""
|
|
51
52
|
).length;
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
l(
|
|
54
|
+
i === 0 && m && u ? "Please enter an OTP. This is a required field." : ""
|
|
54
55
|
);
|
|
55
56
|
} else if (a[s]) {
|
|
56
57
|
const e = [...a];
|
|
57
|
-
e[s] = "", f(e),
|
|
58
|
-
const
|
|
59
|
-
(
|
|
58
|
+
e[s] = "", f(e), n?.(e.join(""));
|
|
59
|
+
const i = [...e].filter(
|
|
60
|
+
(p) => p.trim() !== ""
|
|
60
61
|
).length;
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
l(
|
|
63
|
+
i === 0 && m && u ? "Please enter an OTP. This is a required field." : ""
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
} else t.key === "ArrowLeft" && s > 0 ? o.current[s - 1]?.focus() : t.key === "ArrowRight" && s < r - 1 ? o.current[s + 1]?.focus() : t.key === "v" && (t.metaKey || t.ctrlKey) && (t.preventDefault(), navigator.clipboard.readText().then((e) => {
|
|
66
|
-
const
|
|
67
|
-
f(
|
|
68
|
-
const
|
|
69
|
-
o.current[
|
|
67
|
+
const c = e.replace(/\D/g, "").slice(0, r), i = Array.from({ length: r }, (Y, M) => c[M] || "");
|
|
68
|
+
f(i), n?.(i.join(""));
|
|
69
|
+
const p = Math.min(c.length, r - 1);
|
|
70
|
+
o.current[p]?.focus();
|
|
70
71
|
}));
|
|
71
72
|
},
|
|
72
|
-
[a, r,
|
|
73
|
-
),
|
|
74
|
-
o.current[s]?.select(),
|
|
75
|
-
}, []),
|
|
73
|
+
[a, r, n, m, u]
|
|
74
|
+
), O = I((s) => {
|
|
75
|
+
o.current[s]?.select(), R(!0);
|
|
76
|
+
}, []), g = I(() => {
|
|
76
77
|
setTimeout(() => {
|
|
77
78
|
!o.current.some(
|
|
78
79
|
(t) => t === document.activeElement
|
|
79
|
-
) && m &&
|
|
80
|
+
) && m && u && (a.filter(
|
|
80
81
|
(e) => e.trim() !== ""
|
|
81
|
-
).length < r ?
|
|
82
|
+
).length < r ? l(
|
|
82
83
|
"Please enter an OTP. This is a required field."
|
|
83
|
-
) :
|
|
84
|
+
) : l(""));
|
|
84
85
|
}, 10);
|
|
85
|
-
}, [m, a,
|
|
86
|
-
return /* @__PURE__ */ z("div", { ref:
|
|
87
|
-
j && /* @__PURE__ */
|
|
86
|
+
}, [m, a, u, r]), { "data-testid": H } = U("PIN"), d = B || N, L = d ? "error" : w ? "disabled" : V ? "loading" : "default";
|
|
87
|
+
return /* @__PURE__ */ z("div", { ref: K, className: k(G({ className: D })), ...C, children: [
|
|
88
|
+
j && /* @__PURE__ */ y(
|
|
88
89
|
J,
|
|
89
90
|
{
|
|
90
91
|
variants: "label",
|
|
@@ -94,42 +95,42 @@ const W = E(
|
|
|
94
95
|
children: j
|
|
95
96
|
}
|
|
96
97
|
),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ y("div", { className: "flex gap-xs justify-center", "data-testid": H, children: Array.from({ length: r }).map((s, t) => /* @__PURE__ */ y(
|
|
98
99
|
"input",
|
|
99
100
|
{
|
|
100
101
|
ref: (e) => {
|
|
101
102
|
o.current[t] = e;
|
|
102
103
|
},
|
|
103
|
-
type:
|
|
104
|
+
type: b ? "password" : "text",
|
|
104
105
|
inputMode: "numeric",
|
|
105
106
|
pattern: "[0-9]*",
|
|
106
107
|
maxLength: 1,
|
|
107
108
|
value: a[t],
|
|
108
|
-
disabled:
|
|
109
|
+
disabled: w || V,
|
|
109
110
|
className: k(
|
|
110
111
|
$({
|
|
111
|
-
size:
|
|
112
|
-
state:
|
|
112
|
+
size: h,
|
|
113
|
+
state: L
|
|
113
114
|
})
|
|
114
115
|
),
|
|
115
|
-
onChange: (e) =>
|
|
116
|
-
onKeyDown: (e) =>
|
|
117
|
-
onFocus: () =>
|
|
118
|
-
onBlur:
|
|
116
|
+
onChange: (e) => _(t, e.target.value),
|
|
117
|
+
onKeyDown: (e) => q(t, e),
|
|
118
|
+
onFocus: () => O(t),
|
|
119
|
+
onBlur: g,
|
|
119
120
|
"aria-label": `PIN digit ${t + 1}`,
|
|
120
121
|
autoComplete: "off"
|
|
121
122
|
},
|
|
122
123
|
t
|
|
123
124
|
)) }),
|
|
124
|
-
(
|
|
125
|
+
(F || d) && /* @__PURE__ */ y("div", { className: "w-full break-words overflow-wrap-anywhere leading-relaxed", children: /* @__PURE__ */ y(
|
|
125
126
|
Q,
|
|
126
127
|
{
|
|
127
|
-
text:
|
|
128
|
-
error: !!
|
|
129
|
-
haveIcon: !
|
|
130
|
-
className: "justify-start"
|
|
128
|
+
text: d || F,
|
|
129
|
+
error: !!d,
|
|
130
|
+
haveIcon: !d,
|
|
131
|
+
className: "justify-start whitespace-normal text-wrap"
|
|
131
132
|
}
|
|
132
|
-
)
|
|
133
|
+
) })
|
|
133
134
|
] });
|
|
134
135
|
}
|
|
135
136
|
);
|
|
@@ -126,6 +126,7 @@ export interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
126
126
|
error?: boolean;
|
|
127
127
|
haveIcon?: boolean;
|
|
128
128
|
iconsCustom?: React.ReactNode;
|
|
129
|
+
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
|
129
130
|
}
|
|
130
131
|
declare const _default: React.NamedExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
131
132
|
export default _default;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { jsxs as h, jsx as t, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as h, jsx as t, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as we, useState as I, useRef as Se, useEffect as We, useCallback as R, useMemo as V, memo as Re } from "react";
|
|
3
3
|
import { cn as d } from "../../shared/utils/cn.js";
|
|
4
|
-
import { dataTestId as
|
|
5
|
-
import { Typography as
|
|
4
|
+
import { dataTestId as Me } from "../../shared/utils/dataTestId.js";
|
|
5
|
+
import { Typography as O } from "../Typography/index.js";
|
|
6
6
|
import x from "../Icon/Icon.js";
|
|
7
|
-
import { Dropdown as
|
|
8
|
-
import { selectVariants as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
7
|
+
import { Dropdown as ee } from "../Dropdown/index.js";
|
|
8
|
+
import { selectVariants as $e } from "./helper/variants.js";
|
|
9
|
+
import te from "../Chip/index.js";
|
|
10
|
+
import ke from "../TextField/HelperText.js";
|
|
11
|
+
const re = we(
|
|
12
12
|
({
|
|
13
|
-
items:
|
|
13
|
+
items: w = [],
|
|
14
14
|
value: r,
|
|
15
15
|
onChange: N,
|
|
16
|
-
placeholder:
|
|
16
|
+
placeholder: A = "Select an option...",
|
|
17
17
|
disabled: s = !1,
|
|
18
18
|
readOnly: n = !1,
|
|
19
|
-
loading:
|
|
20
|
-
showCheckmark:
|
|
19
|
+
loading: P = !1,
|
|
20
|
+
showCheckmark: B = !1,
|
|
21
21
|
emptyText: D = "No options available",
|
|
22
22
|
state: M,
|
|
23
23
|
label: q,
|
|
24
|
-
helpText:
|
|
25
|
-
required:
|
|
24
|
+
helpText: se,
|
|
25
|
+
required: ne = !1,
|
|
26
26
|
leadingIcon: o,
|
|
27
27
|
trailingIcon: p,
|
|
28
28
|
mode: i = "single",
|
|
29
29
|
maxDisplayChips: $ = 3,
|
|
30
|
-
moreItemsText:
|
|
31
|
-
trigger:
|
|
30
|
+
moreItemsText: ae = "+{count}",
|
|
31
|
+
trigger: ce,
|
|
32
32
|
side: z = "bottom",
|
|
33
33
|
align: G = "start",
|
|
34
34
|
sideOffset: J = 4,
|
|
@@ -38,16 +38,17 @@ const ee = be(
|
|
|
38
38
|
size: c = "md",
|
|
39
39
|
variant: k = "default",
|
|
40
40
|
fullWidth: T = !1,
|
|
41
|
-
className:
|
|
42
|
-
iconsSize:
|
|
41
|
+
className: oe,
|
|
42
|
+
iconsSize: ie,
|
|
43
43
|
"data-testid": u,
|
|
44
44
|
width: C,
|
|
45
|
-
error:
|
|
46
|
-
haveIcon:
|
|
47
|
-
iconsCustom:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
error: le,
|
|
46
|
+
haveIcon: me,
|
|
47
|
+
iconsCustom: pe,
|
|
48
|
+
onBlur: U,
|
|
49
|
+
...fe
|
|
50
|
+
}, ue) => {
|
|
51
|
+
const [f, S] = I(!1), [j, he] = I(0), E = Se(null), l = $e({
|
|
51
52
|
size: c,
|
|
52
53
|
variant: k,
|
|
53
54
|
fullWidth: T,
|
|
@@ -55,33 +56,33 @@ const ee = be(
|
|
|
55
56
|
disabled: s,
|
|
56
57
|
readOnly: n
|
|
57
58
|
});
|
|
58
|
-
|
|
59
|
+
We(() => {
|
|
59
60
|
if (E.current) {
|
|
60
61
|
const e = new ResizeObserver((a) => {
|
|
61
62
|
for (const m of a)
|
|
62
|
-
|
|
63
|
+
he(m.contentRect.width);
|
|
63
64
|
});
|
|
64
65
|
return e.observe(E.current), () => e.disconnect();
|
|
65
66
|
}
|
|
66
67
|
}, []);
|
|
67
|
-
const
|
|
68
|
+
const X = R(() => {
|
|
68
69
|
if (j === 0) return $;
|
|
69
|
-
const e = c === "sm" ? 100 : c === "lg" ? 140 : 120, a = 4, m = 32,
|
|
70
|
-
|
|
70
|
+
const e = c === "sm" ? 100 : c === "lg" ? 140 : 120, a = 4, m = 32, y = 32, b = o ? 24 : 0, be = m + y + b + 16, Ae = j - be, ye = Math.floor(
|
|
71
|
+
Ae / (e + a)
|
|
71
72
|
);
|
|
72
|
-
return Math.max(1, Math.min(
|
|
73
|
-
}, [j, $, c, o]),
|
|
73
|
+
return Math.max(1, Math.min(ye, $));
|
|
74
|
+
}, [j, $, c, o]), Y = R(
|
|
74
75
|
(e) => {
|
|
75
76
|
if (!(s || n))
|
|
76
77
|
if (i === "single")
|
|
77
78
|
N?.(e);
|
|
78
79
|
else {
|
|
79
|
-
const a = Array.isArray(r) ? r : [], m = a.includes(e) ? a.filter((
|
|
80
|
+
const a = Array.isArray(r) ? r : [], m = a.includes(e) ? a.filter((y) => y !== e) : [...a, e];
|
|
80
81
|
N?.(m);
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
84
|
[i, r, N, s, n]
|
|
84
|
-
),
|
|
85
|
+
), de = R(
|
|
85
86
|
(e) => {
|
|
86
87
|
if (i === "multiple" && Array.isArray(r) && !s && !n) {
|
|
87
88
|
const a = r.filter((m) => m !== e);
|
|
@@ -89,33 +90,33 @@ const ee = be(
|
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
92
|
[i, r, N, s, n]
|
|
92
|
-
),
|
|
93
|
+
), Ne = R(() => {
|
|
93
94
|
i === "multiple" && Array.isArray(r) && r.length > 0 && !s && !n && N?.([]);
|
|
94
|
-
}, [i, r, N, s, n]), g =
|
|
95
|
+
}, [i, r, N, s, n]), g = V(() => {
|
|
95
96
|
if (!r) return [];
|
|
96
97
|
const e = [], a = Array.isArray(r) ? r : [r];
|
|
97
|
-
return ((
|
|
98
|
-
|
|
99
|
-
"items" in
|
|
100
|
-
a.includes(
|
|
101
|
-
}) : a.includes(
|
|
98
|
+
return ((y) => {
|
|
99
|
+
y.forEach((b) => {
|
|
100
|
+
"items" in b ? b.items.forEach((F) => {
|
|
101
|
+
a.includes(F.value) && e.push(F);
|
|
102
|
+
}) : a.includes(b.value) && e.push(b);
|
|
102
103
|
});
|
|
103
|
-
})(
|
|
104
|
-
}, [r,
|
|
104
|
+
})(w), e;
|
|
105
|
+
}, [r, w]), ge = V(() => {
|
|
105
106
|
if (i === "single") {
|
|
106
107
|
const e = g[0];
|
|
107
|
-
return e ? e.label :
|
|
108
|
+
return e ? e.label : A;
|
|
108
109
|
}
|
|
109
110
|
return "";
|
|
110
|
-
}, [i, g,
|
|
111
|
+
}, [i, g, A]), W = V(() => {
|
|
111
112
|
if (i !== "multiple" || !Array.isArray(r)) return [];
|
|
112
|
-
const e =
|
|
113
|
+
const e = X(), a = g.slice(0, e), m = g.length - e;
|
|
113
114
|
return {
|
|
114
115
|
displayItems: a,
|
|
115
116
|
remainingCount: m,
|
|
116
117
|
hasMore: m > 0
|
|
117
118
|
};
|
|
118
|
-
}, [i, r, g,
|
|
119
|
+
}, [i, r, g, X]), ve = C ? { width: typeof C == "number" ? `${C}px` : C } : {}, xe = d(l.container(), oe), v = (e) => {
|
|
119
120
|
switch (e) {
|
|
120
121
|
case "sm":
|
|
121
122
|
return 16;
|
|
@@ -126,7 +127,7 @@ const ee = be(
|
|
|
126
127
|
default:
|
|
127
128
|
return 16;
|
|
128
129
|
}
|
|
129
|
-
},
|
|
130
|
+
}, Z = (e) => {
|
|
130
131
|
switch (e) {
|
|
131
132
|
case "sm":
|
|
132
133
|
return "small";
|
|
@@ -137,7 +138,11 @@ const ee = be(
|
|
|
137
138
|
default:
|
|
138
139
|
return "medium";
|
|
139
140
|
}
|
|
140
|
-
},
|
|
141
|
+
}, _ = (e) => {
|
|
142
|
+
S(e), !e && U && U(
|
|
143
|
+
new FocusEvent("blur")
|
|
144
|
+
);
|
|
145
|
+
}, Ce = () => /* @__PURE__ */ h(
|
|
141
146
|
"div",
|
|
142
147
|
{
|
|
143
148
|
className: l.trigger(),
|
|
@@ -158,7 +163,7 @@ const ee = be(
|
|
|
158
163
|
"flex-1 truncate text-left",
|
|
159
164
|
g.length > 0 ? "text-fg-neutral-main" : l.placeholder()
|
|
160
165
|
),
|
|
161
|
-
children:
|
|
166
|
+
children: ge
|
|
162
167
|
}
|
|
163
168
|
),
|
|
164
169
|
p ? /* @__PURE__ */ t("span", { className: l.trailingIcon(), children: p.node || p.name && /* @__PURE__ */ t(
|
|
@@ -182,17 +187,17 @@ const ee = be(
|
|
|
182
187
|
return /* @__PURE__ */ h(
|
|
183
188
|
"div",
|
|
184
189
|
{
|
|
185
|
-
ref:
|
|
186
|
-
className:
|
|
187
|
-
style:
|
|
188
|
-
...
|
|
189
|
-
...
|
|
190
|
+
ref: ue,
|
|
191
|
+
className: xe,
|
|
192
|
+
style: ve,
|
|
193
|
+
...Me(u || "select"),
|
|
194
|
+
...fe,
|
|
190
195
|
children: [
|
|
191
196
|
q && /* @__PURE__ */ h("div", { className: "mb-1 flex items-center gap-[2px]", children: [
|
|
192
|
-
/* @__PURE__ */ t(
|
|
193
|
-
|
|
197
|
+
/* @__PURE__ */ t(O, { variants: "action", size: "sm", color: "fg-neutral-subtle", children: q }),
|
|
198
|
+
ne && /* @__PURE__ */ t(O, { variants: "action", size: "sm", color: "fg-accent-error", children: "*" })
|
|
194
199
|
] }),
|
|
195
|
-
/* @__PURE__ */ t("div", { className: "relative", children: i === "multiple" ? /* @__PURE__ */ h(
|
|
200
|
+
/* @__PURE__ */ t("div", { className: "relative", children: i === "multiple" ? /* @__PURE__ */ h(H, { children: [
|
|
196
201
|
/* @__PURE__ */ h(
|
|
197
202
|
"div",
|
|
198
203
|
{
|
|
@@ -217,20 +222,20 @@ const ee = be(
|
|
|
217
222
|
!s && !n && "cursor-pointer"
|
|
218
223
|
),
|
|
219
224
|
onClick: (e) => {
|
|
220
|
-
s || n || e.target.closest('[data-testid*="chip"]') ||
|
|
225
|
+
s || n || e.target.closest('[data-testid*="chip"]') || S(!f);
|
|
221
226
|
},
|
|
222
227
|
children: [
|
|
223
|
-
Array.isArray(
|
|
224
|
-
|
|
228
|
+
Array.isArray(W) ? null : /* @__PURE__ */ h(H, { children: [
|
|
229
|
+
W.displayItems.map((e) => /* @__PURE__ */ t(
|
|
225
230
|
"div",
|
|
226
231
|
{
|
|
227
232
|
onClick: (a) => a.stopPropagation(),
|
|
228
233
|
className: "flex-shrink-0",
|
|
229
234
|
children: /* @__PURE__ */ t(
|
|
230
|
-
|
|
235
|
+
te,
|
|
231
236
|
{
|
|
232
|
-
size:
|
|
233
|
-
onRemove: !s && !n ? () =>
|
|
237
|
+
size: Z(c),
|
|
238
|
+
onRemove: !s && !n ? () => de(e.value) : void 0,
|
|
234
239
|
className: "bg-bg-surface-level-3",
|
|
235
240
|
variant: "neutral",
|
|
236
241
|
trailingIcon: !s && !n ? {
|
|
@@ -244,21 +249,21 @@ const ee = be(
|
|
|
244
249
|
},
|
|
245
250
|
e.value
|
|
246
251
|
)),
|
|
247
|
-
|
|
252
|
+
W.hasMore && /* @__PURE__ */ t(
|
|
248
253
|
"div",
|
|
249
254
|
{
|
|
250
255
|
onClick: (e) => e.stopPropagation(),
|
|
251
256
|
className: "flex-shrink-0",
|
|
252
257
|
children: /* @__PURE__ */ t(
|
|
253
|
-
|
|
258
|
+
te,
|
|
254
259
|
{
|
|
255
|
-
size:
|
|
260
|
+
size: Z(c),
|
|
256
261
|
variant: "neutral",
|
|
257
262
|
className: "self-center bg-bg-surface-level-3",
|
|
258
263
|
dataTestIdName: `${u || "select"}-chip-more`,
|
|
259
|
-
children:
|
|
264
|
+
children: ae.replace(
|
|
260
265
|
"{count}",
|
|
261
|
-
|
|
266
|
+
W.remainingCount.toString()
|
|
262
267
|
)
|
|
263
268
|
}
|
|
264
269
|
)
|
|
@@ -272,7 +277,7 @@ const ee = be(
|
|
|
272
277
|
l.placeholder(),
|
|
273
278
|
!s && !n && "cursor-pointer"
|
|
274
279
|
),
|
|
275
|
-
children:
|
|
280
|
+
children: A
|
|
276
281
|
}
|
|
277
282
|
)
|
|
278
283
|
]
|
|
@@ -283,7 +288,7 @@ const ee = be(
|
|
|
283
288
|
"button",
|
|
284
289
|
{
|
|
285
290
|
type: "button",
|
|
286
|
-
onClick:
|
|
291
|
+
onClick: Ne,
|
|
287
292
|
className: d(
|
|
288
293
|
"flex items-center justify-center p-1 rounded-sm transition-colors",
|
|
289
294
|
!s && !n && "cursor-pointer hover:bg-bg-neutral-subtle",
|
|
@@ -308,7 +313,7 @@ const ee = be(
|
|
|
308
313
|
{
|
|
309
314
|
type: "button",
|
|
310
315
|
onClick: () => {
|
|
311
|
-
!s && !n &&
|
|
316
|
+
!s && !n && S(!f);
|
|
312
317
|
},
|
|
313
318
|
className: d(
|
|
314
319
|
"flex items-center justify-center p-1",
|
|
@@ -339,19 +344,19 @@ const ee = be(
|
|
|
339
344
|
}
|
|
340
345
|
),
|
|
341
346
|
/* @__PURE__ */ t(
|
|
342
|
-
|
|
347
|
+
ee,
|
|
343
348
|
{
|
|
344
|
-
items:
|
|
349
|
+
items: w,
|
|
345
350
|
value: r,
|
|
346
|
-
onValueChange:
|
|
347
|
-
placeholder:
|
|
351
|
+
onValueChange: Y,
|
|
352
|
+
placeholder: A,
|
|
348
353
|
disabled: s,
|
|
349
|
-
loading:
|
|
350
|
-
showCheckmark:
|
|
354
|
+
loading: P,
|
|
355
|
+
showCheckmark: B,
|
|
351
356
|
emptyText: D,
|
|
352
357
|
state: M,
|
|
353
358
|
open: f,
|
|
354
|
-
onOpenChange:
|
|
359
|
+
onOpenChange: _,
|
|
355
360
|
side: z,
|
|
356
361
|
align: G,
|
|
357
362
|
sideOffset: J,
|
|
@@ -369,21 +374,21 @@ const ee = be(
|
|
|
369
374
|
] }) : (
|
|
370
375
|
/* Single mode - use Dropdown normally */
|
|
371
376
|
/* @__PURE__ */ t(
|
|
372
|
-
|
|
377
|
+
ee,
|
|
373
378
|
{
|
|
374
|
-
items:
|
|
379
|
+
items: w,
|
|
375
380
|
value: r,
|
|
376
381
|
onValueChange: (e) => {
|
|
377
|
-
|
|
382
|
+
Y(e), S(!1);
|
|
378
383
|
},
|
|
379
|
-
placeholder:
|
|
384
|
+
placeholder: A,
|
|
380
385
|
disabled: s,
|
|
381
|
-
loading:
|
|
382
|
-
showCheckmark:
|
|
386
|
+
loading: P,
|
|
387
|
+
showCheckmark: B,
|
|
383
388
|
emptyText: D,
|
|
384
389
|
state: M,
|
|
385
390
|
open: f,
|
|
386
|
-
onOpenChange:
|
|
391
|
+
onOpenChange: _,
|
|
387
392
|
side: z,
|
|
388
393
|
align: G,
|
|
389
394
|
sideOffset: J,
|
|
@@ -395,19 +400,19 @@ const ee = be(
|
|
|
395
400
|
fullWidth: T,
|
|
396
401
|
width: C,
|
|
397
402
|
"data-testid": u ? `${u}-dropdown` : void 0,
|
|
398
|
-
children:
|
|
403
|
+
children: ce || Ce()
|
|
399
404
|
}
|
|
400
405
|
)
|
|
401
406
|
) }),
|
|
402
407
|
/* @__PURE__ */ t(
|
|
403
|
-
|
|
408
|
+
ke,
|
|
404
409
|
{
|
|
405
410
|
className: "mt-1",
|
|
406
|
-
text:
|
|
407
|
-
error:
|
|
408
|
-
haveIcon:
|
|
409
|
-
iconsSize:
|
|
410
|
-
iconsCustom:
|
|
411
|
+
text: se,
|
|
412
|
+
error: le,
|
|
413
|
+
haveIcon: me,
|
|
414
|
+
iconsSize: ie,
|
|
415
|
+
iconsCustom: pe
|
|
411
416
|
}
|
|
412
417
|
)
|
|
413
418
|
]
|
|
@@ -415,8 +420,8 @@ const ee = be(
|
|
|
415
420
|
);
|
|
416
421
|
}
|
|
417
422
|
);
|
|
418
|
-
|
|
419
|
-
const
|
|
423
|
+
re.displayName = "Select";
|
|
424
|
+
const Ge = Re(re);
|
|
420
425
|
export {
|
|
421
|
-
|
|
426
|
+
Ge as default
|
|
422
427
|
};
|