se-design 1.0.87-dev.2 → 1.0.88-dev
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/assets/style.css +1 -1
- package/dist/components/Icon/index.d.ts +0 -5
- package/dist/components/InputWithTags/index.d.ts +1 -3
- package/dist/components/SidebarOverlay/index.d.ts +41 -0
- package/dist/components/Tooltip/index.d.ts +1 -5
- package/dist/index112.js +1 -1
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +2 -2
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +1 -1
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +2 -2
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +1 -1
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +1 -1
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +2 -2
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +1 -1
- package/dist/index119.js.map +1 -1
- package/dist/index120.js +2 -2
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +1 -1
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +1 -1
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +1 -1
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +1 -1
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -2
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +1 -1
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +2 -2
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -2
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +1 -1
- package/dist/index129.js.map +1 -1
- package/dist/index130.js +2 -2
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -2
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +1 -1
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +1 -1
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +1 -1
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +2 -2
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +2 -2
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +2 -2
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +1 -1
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +1 -1
- package/dist/index139.js.map +1 -1
- package/dist/index140.js +1 -1
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +1 -1
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +1 -1
- package/dist/index142.js.map +1 -1
- package/dist/index143.js +1 -1
- package/dist/index143.js.map +1 -1
- package/dist/index144.js +1 -1
- package/dist/index144.js.map +1 -1
- package/dist/index145.js +1 -1
- package/dist/index145.js.map +1 -1
- package/dist/index146.js +2 -2
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +2 -2
- package/dist/index147.js.map +1 -1
- package/dist/index148.js +1 -1
- package/dist/index148.js.map +1 -1
- package/dist/index149.js +1 -1
- package/dist/index149.js.map +1 -1
- package/dist/index150.js +1 -1
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +1 -1
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +1 -1
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +1 -1
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +1 -1
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -2
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +1 -1
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +2 -2
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +2 -2
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +2 -2
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +107 -111
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +2 -2
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +1 -1
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +1 -1
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +1 -1
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +1 -1
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +1 -1
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +1 -1
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +1 -1
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +1 -1
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +1 -1
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +1 -1
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +1 -1
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +1 -1
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +1 -1
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +1 -1
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +1 -1
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +1 -1
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +1 -1
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +1 -1
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +1 -1
- package/dist/index179.js.map +1 -1
- package/dist/index180.js +1 -1
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +1 -1
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +1 -1
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +1 -1
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +1 -1
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +2 -2
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +2 -2
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +1 -1
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +1 -1
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +2 -2
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +2 -2
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +1 -1
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +1 -1
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +1 -1
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +1 -1
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +1 -1
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +1 -1
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +1 -1
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +1 -1
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +1 -1
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +2 -2
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +2 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +149 -2
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +9 -149
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +5 -8
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +4 -5
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +1 -1
- package/dist/index208.js +3 -3
- package/dist/index208.js.map +1 -1
- package/dist/{index225.js → index224.js} +1 -1
- package/dist/{index225.js.map → index224.js.map} +1 -1
- package/dist/index23.js +16 -16
- package/dist/index23.js.map +1 -1
- package/dist/{index233.js → index232.js} +1 -1
- package/dist/{index233.js.map → index232.js.map} +1 -1
- package/dist/{index236.js → index235.js} +1 -1
- package/dist/{index236.js.map → index235.js.map} +1 -1
- package/dist/index244.js +173 -0
- package/dist/index244.js.map +1 -0
- package/dist/index245.js +3 -169
- package/dist/index245.js.map +1 -1
- package/dist/index247.js +22 -0
- package/dist/index247.js.map +1 -0
- package/dist/index248.js +9 -18
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +9 -9
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +1 -2
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +4 -9
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +170 -5
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +11 -170
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +6 -11
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +5 -5
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +37 -5
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -38
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +8 -2
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +326 -7
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +47 -324
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +2 -50
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +76 -2
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +82 -65
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +48 -89
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +7 -51
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +4 -7
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +51 -4
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +2 -52
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +2 -2
- package/dist/index28.js +149 -88
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +1 -1
- package/dist/index30.js +1 -1
- package/dist/index32.js +10 -11
- package/dist/index33.js +1 -1
- package/dist/index35.js +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.js +36 -55
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +162 -163
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +51 -55
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +61 -66
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +1 -1
- package/dist/index42.js +7 -8
- package/dist/index43.js +1 -2
- package/dist/index45.js +38 -39
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +51 -52
- package/dist/index46.js.map +1 -1
- package/dist/index49.js +1 -1
- package/dist/index51.js +1 -1
- package/dist/index52.js +1 -1
- package/dist/index53.js +1 -1
- package/dist/index55.js +16 -17
- package/dist/index57.js +1 -1
- package/dist/index6.js +299 -305
- package/dist/index6.js.map +1 -1
- package/dist/index61.js +1 -1
- package/dist/index63.js +1 -1
- package/dist/index65.js +2 -3
- package/dist/index7.js +8 -9
- package/dist/index79.js +1 -1
- package/dist/index81.js +7 -9
- package/dist/index81.js.map +1 -1
- package/dist/index9.js +20 -20
- package/dist/index9.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/icons/cloud-check.svg +0 -4
- package/dist/index223.js +0 -8
- package/dist/index223.js.map +0 -1
- package/dist/index246.js +0 -7
- package/dist/index246.js.map +0 -1
- package/dist/index269.js +0 -5
- package/dist/index269.js.map +0 -1
package/dist/index42.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e, { useState as g, useRef as p } from "react";
|
|
2
2
|
import { Icon as c } from "./index6.js";
|
|
3
|
-
import { ProgressBar as
|
|
3
|
+
import { ProgressBar as x } from "./index41.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
const r = {
|
|
6
6
|
gettingStartedWidgetCtn: "border border-[var(--color-gray-200)] rounded-[12px] w-[385px] p-4",
|
|
@@ -14,7 +14,7 @@ const r = {
|
|
|
14
14
|
}) => {
|
|
15
15
|
const [n, l] = g(!1), o = p(null), i = () => {
|
|
16
16
|
l(!n);
|
|
17
|
-
},
|
|
17
|
+
}, m = (t) => t ? "var(--color-green-500)" : "var(--color-gray-200)";
|
|
18
18
|
return /* @__PURE__ */ e.createElement("div", {
|
|
19
19
|
className: `${r.gettingStartedWidgetCtn} ${s} getting-started-widget-ctn`
|
|
20
20
|
}, /* @__PURE__ */ e.createElement("div", {
|
|
@@ -27,7 +27,7 @@ const r = {
|
|
|
27
27
|
onClick: i
|
|
28
28
|
})), /* @__PURE__ */ e.createElement("div", {
|
|
29
29
|
className: "mt-[12px]"
|
|
30
|
-
}, /* @__PURE__ */ e.createElement(
|
|
30
|
+
}, /* @__PURE__ */ e.createElement(x, {
|
|
31
31
|
totalTasks: a.length,
|
|
32
32
|
completedTasks: a.filter((t) => t.isComplete).length,
|
|
33
33
|
progressBarCtnClassName: "get-started-progress-bar-ctn"
|
|
@@ -37,19 +37,18 @@ const r = {
|
|
|
37
37
|
style: {
|
|
38
38
|
maxHeight: n ? `${o.current?.scrollHeight}px` : "0px"
|
|
39
39
|
}
|
|
40
|
-
}, a.map((t,
|
|
41
|
-
key:
|
|
40
|
+
}, a.map((t, d) => /* @__PURE__ */ e.createElement("div", {
|
|
41
|
+
key: d,
|
|
42
42
|
className: r.actionItemCtn
|
|
43
43
|
}, /* @__PURE__ */ e.createElement(c, {
|
|
44
44
|
name: "checked-circle",
|
|
45
|
-
stroke:
|
|
45
|
+
stroke: m(t.isComplete)
|
|
46
46
|
}), /* @__PURE__ */ e.createElement("span", {
|
|
47
47
|
className: t.isComplete ? "text-[var(--color-gray-500)]" : "text-[var(--color-gray-900)] cursor-pointer",
|
|
48
48
|
onClick: t?.handleActionItemClick
|
|
49
49
|
}, t.label)))));
|
|
50
50
|
};
|
|
51
51
|
export {
|
|
52
|
-
E as GetStartedWidget
|
|
53
|
-
E as default
|
|
52
|
+
E as GetStartedWidget
|
|
54
53
|
};
|
|
55
54
|
//# sourceMappingURL=index42.js.map
|
package/dist/index43.js
CHANGED
package/dist/index45.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e, { useState as k, useRef as S, useCallback as P, useEffect as
|
|
1
|
+
import e, { useState as k, useRef as S, useCallback as P, useEffect as Z } from "react";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { Icon as x } from "./index6.js";
|
|
4
|
-
import { useStableId as
|
|
4
|
+
import { useStableId as L } from "./index205.js";
|
|
5
5
|
import { getA11yNameAttributes as ee } from "./index81.js";
|
|
6
6
|
import "./index72.js";
|
|
7
7
|
import { useCombobox as te } from "./index68.js";
|
|
@@ -19,66 +19,65 @@ const ce = /* @__PURE__ */ e.memo(({
|
|
|
19
19
|
onChange: i,
|
|
20
20
|
disabled: t = !1,
|
|
21
21
|
maxLength: a,
|
|
22
|
-
tag:
|
|
22
|
+
tag: B = "input",
|
|
23
23
|
error: l = !1,
|
|
24
|
-
errorMessage:
|
|
24
|
+
errorMessage: F,
|
|
25
25
|
label: p,
|
|
26
|
-
placeholder:
|
|
26
|
+
placeholder: R,
|
|
27
27
|
suggestions: c = [],
|
|
28
|
-
onSelect:
|
|
28
|
+
onSelect: $,
|
|
29
29
|
renderOption: d,
|
|
30
|
-
optionClassName:
|
|
31
|
-
automationId:
|
|
32
|
-
ariaLabel:
|
|
30
|
+
optionClassName: j,
|
|
31
|
+
automationId: A = "",
|
|
32
|
+
ariaLabel: b,
|
|
33
33
|
ariaLabelledBy: O,
|
|
34
34
|
ariaDescribedBy: V,
|
|
35
35
|
..._
|
|
36
36
|
}) => {
|
|
37
|
-
const [s,
|
|
38
|
-
g(!1),
|
|
39
|
-
}, [
|
|
37
|
+
const [s, v] = k([...c]), [E, g] = k(!1), H = S(null), N = S(null), f = L(void 0, "autocomplete"), z = `${f}-input`, D = `${f}-listbox`, y = `${f}-label`, C = `${f}-error`, w = P((r) => {
|
|
38
|
+
g(!1), $?.(r);
|
|
39
|
+
}, [$]), {
|
|
40
40
|
containerProps: K,
|
|
41
41
|
inputProps: M,
|
|
42
42
|
listboxProps: q,
|
|
43
43
|
getOptionProps: G,
|
|
44
44
|
highlightedIndex: J,
|
|
45
45
|
setHighlightedIndex: h,
|
|
46
|
-
isKeyboardFocused:
|
|
46
|
+
isKeyboardFocused: Q
|
|
47
47
|
} = te({
|
|
48
48
|
items: s,
|
|
49
|
-
isOpen:
|
|
49
|
+
isOpen: E,
|
|
50
50
|
onOpenChange: g,
|
|
51
51
|
onSelect: w,
|
|
52
52
|
listboxId: D
|
|
53
|
-
}),
|
|
53
|
+
}), T = P((r) => {
|
|
54
54
|
const n = r.target.value;
|
|
55
55
|
if (h(-1), i(n), !d)
|
|
56
56
|
if (n === "")
|
|
57
|
-
|
|
57
|
+
v([...c]);
|
|
58
58
|
else {
|
|
59
59
|
const I = c?.filter((m) => typeof m == "object" && m?.label?.toLowerCase().includes(n?.toLowerCase() ?? ""));
|
|
60
|
-
|
|
60
|
+
v([...I]);
|
|
61
61
|
}
|
|
62
62
|
}, [i, c, d, h]);
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
Z(() => {
|
|
64
|
+
v([...c]);
|
|
65
65
|
}, [c]);
|
|
66
|
-
const
|
|
66
|
+
const U = () => {
|
|
67
67
|
g(!0);
|
|
68
|
-
}, U = () => {
|
|
69
|
-
s.length > 0 && g(!0);
|
|
70
68
|
}, W = () => {
|
|
69
|
+
s.length > 0 && g(!0);
|
|
70
|
+
}, X = () => {
|
|
71
71
|
i(""), h(-1), N.current?.focus();
|
|
72
|
-
},
|
|
73
|
-
ariaLabelledBy: O,
|
|
74
|
-
|
|
75
|
-
ariaLabel: $,
|
|
72
|
+
}, Y = ee({
|
|
73
|
+
ariaLabelledBy: p && !b ? y : O,
|
|
74
|
+
ariaLabel: b,
|
|
76
75
|
ariaDescribedBy: l ? C : V
|
|
77
76
|
});
|
|
78
77
|
return /* @__PURE__ */ e.createElement("div", u({
|
|
79
78
|
className: "main-container-autocomplete-se-design",
|
|
80
79
|
ref: H,
|
|
81
|
-
"data-automation-id":
|
|
80
|
+
"data-automation-id": A
|
|
82
81
|
}, K), p && /* @__PURE__ */ e.createElement("span", {
|
|
83
82
|
id: y,
|
|
84
83
|
className: `label-container ${t ? "label-container-disabled" : ""}`
|
|
@@ -89,36 +88,36 @@ const ce = /* @__PURE__ */ e.memo(({
|
|
|
89
88
|
style: {
|
|
90
89
|
pointerEvents: t ? "none" : "auto"
|
|
91
90
|
}
|
|
92
|
-
}, /* @__PURE__ */ e.createElement(
|
|
91
|
+
}, /* @__PURE__ */ e.createElement(B, {
|
|
93
92
|
ref: N,
|
|
94
93
|
id: z,
|
|
95
94
|
value: o,
|
|
96
|
-
onChange:
|
|
97
|
-
onClick:
|
|
98
|
-
onFocus:
|
|
95
|
+
onChange: T,
|
|
96
|
+
onClick: U,
|
|
97
|
+
onFocus: W,
|
|
99
98
|
...M,
|
|
100
99
|
disabled: t,
|
|
101
100
|
className: `${l ? "input-container-error" : "input-container-default"} ${t ? "input-container-disabled" : ""} ${s.length > 0 || o ? "with-icon" : ""} ${s.length > 0 && o ? "with-icons" : ""}`,
|
|
102
101
|
maxLength: a,
|
|
103
|
-
placeholder:
|
|
102
|
+
placeholder: R,
|
|
104
103
|
"aria-invalid": l || void 0,
|
|
105
|
-
...
|
|
104
|
+
...Y,
|
|
106
105
|
..._
|
|
107
106
|
}), o && /* @__PURE__ */ e.createElement(x, {
|
|
108
107
|
name: "close",
|
|
109
108
|
className: "input-icon-close",
|
|
110
109
|
size: 15,
|
|
111
|
-
onClick:
|
|
110
|
+
onClick: X,
|
|
112
111
|
stroke: t ? "var(--color-gray-600)" : "",
|
|
113
112
|
ariaLabel: "Clear input"
|
|
114
113
|
}), s.length > 0 && /* @__PURE__ */ e.createElement(x, {
|
|
115
114
|
name: "chevron",
|
|
116
|
-
rotation:
|
|
115
|
+
rotation: E ? "180" : "0",
|
|
117
116
|
className: "input-icon-chevron",
|
|
118
117
|
stroke: t ? "var(--color-gray-600)" : "",
|
|
119
118
|
"aria-hidden": "true"
|
|
120
|
-
})),
|
|
121
|
-
"aria-label": p ||
|
|
119
|
+
})), E && s.length > 0 && /* @__PURE__ */ e.createElement("div", u({}, q, {
|
|
120
|
+
"aria-label": p || b || "Suggestions",
|
|
122
121
|
className: "suggestions-list",
|
|
123
122
|
"data-automation-id": "autocomplete-suggestions-list"
|
|
124
123
|
}), s.map((r, n) => {
|
|
@@ -126,7 +125,7 @@ const ce = /* @__PURE__ */ e.memo(({
|
|
|
126
125
|
return /* @__PURE__ */ e.createElement("div", u({
|
|
127
126
|
key: n
|
|
128
127
|
}, I, {
|
|
129
|
-
className: `${
|
|
128
|
+
className: `${j || "suggestion-item"} ${m ? `suggestion-item-highlighted${Q ? " suggestion-item-keyboard-highlight" : ""}` : ""}`,
|
|
130
129
|
onClick: () => w(r),
|
|
131
130
|
onMouseEnter: () => h(n),
|
|
132
131
|
"data-automation-id": `autocomplete-suggestion-item-${n}`
|
|
@@ -140,7 +139,7 @@ const ce = /* @__PURE__ */ e.memo(({
|
|
|
140
139
|
id: C,
|
|
141
140
|
className: "error-message",
|
|
142
141
|
role: "alert"
|
|
143
|
-
},
|
|
142
|
+
}, F), a && /* @__PURE__ */ e.createElement("div", {
|
|
144
143
|
className: "max-word"
|
|
145
144
|
}, o.length, "/", a)));
|
|
146
145
|
});
|
package/dist/index45.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index45.js","sources":["../src/components/AutoCompleteInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useCallback, useState } from 'react';\nimport './style.scss';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface AutoCompleteInputProps {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n /** Called when the user types in the input. Not called on suggestion selection. */\n onChange: (value: string) => void;\n tag?: string;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n /**\n * Suggestion items. Default rendering expects { label, value } shape.\n * When renderOption is provided, any shape is accepted.\n */\n suggestions?: any[];\n /**\n * Called when a suggestion is selected (click or Enter key).\n * Receives the full item object from the suggestions array.\n */\n onSelect?: (item: any) => void;\n /**\n * Render custom content for each suggestion option. The component handles the option wrapper\n * (ARIA props, highlight, click, keyboard navigation). You only provide the inner content.\n */\n renderOption?: (suggestion: any, context: { isHighlighted: boolean; index: number }) => React.ReactNode;\n /**\n * Custom CSS class for option elements. Replaces the default 'suggestion-item' class.\n * Useful with renderOption to apply custom styling to option wrappers.\n */\n optionClassName?: string;\n automationId?: string;\n /**\n * Accessible label for the input. Used when no visible label is provided.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this input. Takes precedence over ariaLabel.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description.\n */\n ariaDescribedBy?: string;\n}\n\nexport const AutoCompleteInput: React.FC<AutoCompleteInputProps> = React.memo(\n ({\n value,\n onChange,\n disabled = false,\n maxLength,\n tag = 'input',\n error = false,\n errorMessage,\n label,\n placeholder,\n suggestions = [],\n onSelect,\n renderOption,\n optionClassName,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...props\n }) => {\n const [filteredSuggestions, setFilteredSuggestions] = useState<any[]>([...suggestions]);\n const [isSuggestionBoxVisible, setSuggestionBoxVisible] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Generate stable unique IDs per instance so label, input, listbox, and error never share IDs (HTML/ARIA require unique ids).\n const instanceId = useStableId(undefined, 'autocomplete');\n const inputId = `${instanceId}-input`;\n const listboxId = `${instanceId}-listbox`;\n const labelId = `${instanceId}-label`;\n const errorId = `${instanceId}-error`;\n\n const handleSelectSuggestion = useCallback(\n (item: any) => {\n setSuggestionBoxVisible(false);\n onSelect?.(item);\n },\n [onSelect]\n );\n\n // Use the comprehensive useCombobox hook\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n isKeyboardFocused\n } = useCombobox<any>({\n items: filteredSuggestions,\n isOpen: isSuggestionBoxVisible,\n onOpenChange: setSuggestionBoxVisible,\n onSelect: handleSelectSuggestion,\n listboxId\n });\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setHighlightedIndex(-1); // Reset highlight on input change\n onChange(inputValue);\n\n // Internal filtering for default rendering (when no renderOption, component manages filtering)\n if (!renderOption) {\n if (inputValue === '') {\n setFilteredSuggestions([...suggestions]);\n } else {\n const filtered = suggestions?.filter(\n (suggestion) =>\n typeof suggestion === 'object' &&\n suggestion?.label?.toLowerCase().includes(inputValue?.toLowerCase() ?? '')\n );\n setFilteredSuggestions([...filtered]);\n }\n }\n },\n [onChange, suggestions, renderOption, setHighlightedIndex]\n );\n\n useEffect(() => {\n setFilteredSuggestions([...suggestions]);\n }, [suggestions]);\n\n const handleInputClick = () => {\n setSuggestionBoxVisible(true);\n };\n\n const handleInputFocus = () => {\n if (filteredSuggestions.length > 0) {\n setSuggestionBoxVisible(true);\n }\n };\n\n const handleClearInput = () => {\n onChange('');\n setHighlightedIndex(-1);\n inputRef.current?.focus();\n };\n\n // Build ARIA name attributes: when ariaLabel is provided use it (e.g. \"Signer 1 name\"); otherwise use visible label or ariaLabelledBy\n const a11yNameProps = getA11yNameAttributes({\n ariaLabelledBy,\n internalLabelId: label ? labelId : undefined,\n ariaLabel,\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n return (\n <div \n className=\"main-container-autocomplete-se-design\" \n ref={containerRef} \n data-automation-id={automationId}\n {...containerProps}\n >\n {label && (\n <span\n id={labelId}\n className={`label-container ${disabled ? 'label-container-disabled' : ''}`}\n >\n {label}\n </span>\n )}\n <div className=\"input-container-wrapper\">\n <div className=\"input-wrapper\" style={{ pointerEvents: disabled ? 'none' : 'auto' }}>\n {React.createElement(tag, {\n ref: inputRef,\n id: inputId,\n value: value,\n onChange: handleInputChange,\n onClick: handleInputClick,\n onFocus: handleInputFocus,\n ...comboboxInputProps,\n disabled,\n className: `${error ? 'input-container-error' : 'input-container-default'} ${disabled ? 'input-container-disabled' : ''} ${filteredSuggestions.length > 0 || value ? 'with-icon' : ''} ${filteredSuggestions.length > 0 && value ? 'with-icons' : ''}`,\n maxLength,\n placeholder,\n 'aria-invalid': error || undefined,\n ...a11yNameProps,\n ...props\n })}\n {value && (\n <Icon\n name=\"close\"\n className=\"input-icon-close\"\n size={15}\n onClick={handleClearInput}\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n ariaLabel=\"Clear input\"\n />\n )}\n {filteredSuggestions.length > 0 && (\n <Icon\n name=\"chevron\"\n rotation={isSuggestionBoxVisible ? '180' : '0'}\n className=\"input-icon-chevron\"\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n aria-hidden=\"true\"\n />\n )}\n </div>\n {isSuggestionBoxVisible && filteredSuggestions.length > 0 && (\n <div\n {...listboxProps}\n aria-label={label || ariaLabel || 'Suggestions'}\n className=\"suggestions-list\"\n data-automation-id=\"autocomplete-suggestions-list\"\n >\n {filteredSuggestions.map((suggestion, index) => {\n const optionProps = getOptionProps(index, false);\n const isHighlighted = highlightedIndex === index;\n return (\n <div\n key={index}\n {...optionProps}\n className={`${optionClassName || 'suggestion-item'} ${isHighlighted ? `suggestion-item-highlighted${isKeyboardFocused ? ' suggestion-item-keyboard-highlight' : ''}` : ''}`}\n onClick={() => handleSelectSuggestion(suggestion)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`autocomplete-suggestion-item-${index}`}\n >\n {renderOption\n ? renderOption(suggestion, { isHighlighted, index })\n : suggestion.label}\n </div>\n );\n })}\n </div>\n )}\n </div>\n {(error || maxLength) && (\n <div className={`${error ? 'error-and-max-word' : 'max-word-container'} ${disabled ? 'disabled' : ''}`}>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {maxLength && (\n <div className=\"max-word\">\n {value.length}/{maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n"],"names":["AutoCompleteInput","React","memo","value","onChange","disabled","maxLength","tag","error","errorMessage","label","placeholder","suggestions","onSelect","renderOption","optionClassName","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","props","filteredSuggestions","setFilteredSuggestions","useState","isSuggestionBoxVisible","setSuggestionBoxVisible","containerRef","useRef","inputRef","instanceId","useStableId","undefined","inputId","listboxId","labelId","errorId","handleSelectSuggestion","useCallback","item","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","isKeyboardFocused","useCombobox","items","isOpen","onOpenChange","handleInputChange","e","inputValue","target","filtered","filter","suggestion","toLowerCase","includes","useEffect","handleInputClick","handleInputFocus","length","handleClearInput","current","focus","a11yNameProps","getA11yNameAttributes","internalLabelId","createElement","_extends","className","ref","id","style","pointerEvents","onClick","onFocus","Icon","name","size","stroke","rotation","map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
+
{"version":3,"file":"index45.js","sources":["../src/components/AutoCompleteInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useCallback, useState } from 'react';\nimport './style.scss';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface AutoCompleteInputProps {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n /** Called when the user types in the input. Not called on suggestion selection. */\n onChange: (value: string) => void;\n tag?: string;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n /**\n * Suggestion items. Default rendering expects { label, value } shape.\n * When renderOption is provided, any shape is accepted.\n */\n suggestions?: any[];\n /**\n * Called when a suggestion is selected (click or Enter key).\n * Receives the full item object from the suggestions array.\n */\n onSelect?: (item: any) => void;\n /**\n * Render custom content for each suggestion option. The component handles the option wrapper\n * (ARIA props, highlight, click, keyboard navigation). You only provide the inner content.\n */\n renderOption?: (suggestion: any, context: { isHighlighted: boolean; index: number }) => React.ReactNode;\n /**\n * Custom CSS class for option elements. Replaces the default 'suggestion-item' class.\n * Useful with renderOption to apply custom styling to option wrappers.\n */\n optionClassName?: string;\n automationId?: string;\n /**\n * Accessible label for the input. Used when no visible label is provided.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this input. Takes precedence over ariaLabel.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description.\n */\n ariaDescribedBy?: string;\n}\n\nexport const AutoCompleteInput: React.FC<AutoCompleteInputProps> = React.memo(\n ({\n value,\n onChange,\n disabled = false,\n maxLength,\n tag = 'input',\n error = false,\n errorMessage,\n label,\n placeholder,\n suggestions = [],\n onSelect,\n renderOption,\n optionClassName,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...props\n }) => {\n const [filteredSuggestions, setFilteredSuggestions] = useState<any[]>([...suggestions]);\n const [isSuggestionBoxVisible, setSuggestionBoxVisible] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Generate stable unique IDs per instance so label, input, listbox, and error never share IDs (HTML/ARIA require unique ids).\n const instanceId = useStableId(undefined, 'autocomplete');\n const inputId = `${instanceId}-input`;\n const listboxId = `${instanceId}-listbox`;\n const labelId = `${instanceId}-label`;\n const errorId = `${instanceId}-error`;\n\n const handleSelectSuggestion = useCallback(\n (item: any) => {\n setSuggestionBoxVisible(false);\n onSelect?.(item);\n },\n [onSelect]\n );\n\n // Use the comprehensive useCombobox hook\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n isKeyboardFocused\n } = useCombobox<any>({\n items: filteredSuggestions,\n isOpen: isSuggestionBoxVisible,\n onOpenChange: setSuggestionBoxVisible,\n onSelect: handleSelectSuggestion,\n listboxId\n });\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setHighlightedIndex(-1); // Reset highlight on input change\n onChange(inputValue);\n\n // Internal filtering for default rendering (when no renderOption, component manages filtering)\n if (!renderOption) {\n if (inputValue === '') {\n setFilteredSuggestions([...suggestions]);\n } else {\n const filtered = suggestions?.filter(\n (suggestion) =>\n typeof suggestion === 'object' &&\n suggestion?.label?.toLowerCase().includes(inputValue?.toLowerCase() ?? '')\n );\n setFilteredSuggestions([...filtered]);\n }\n }\n },\n [onChange, suggestions, renderOption, setHighlightedIndex]\n );\n\n useEffect(() => {\n setFilteredSuggestions([...suggestions]);\n }, [suggestions]);\n\n const handleInputClick = () => {\n setSuggestionBoxVisible(true);\n };\n\n const handleInputFocus = () => {\n if (filteredSuggestions.length > 0) {\n setSuggestionBoxVisible(true);\n }\n };\n\n const handleClearInput = () => {\n onChange('');\n setHighlightedIndex(-1);\n inputRef.current?.focus();\n };\n\n // Build ARIA name attributes: when ariaLabel is provided use it (e.g. \"Signer 1 name\"); otherwise use visible label or ariaLabelledBy\n const a11yNameProps = getA11yNameAttributes({\n ariaLabelledBy: label && !ariaLabel ? labelId : ariaLabelledBy,\n ariaLabel,\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n return (\n <div \n className=\"main-container-autocomplete-se-design\" \n ref={containerRef} \n data-automation-id={automationId}\n {...containerProps}\n >\n {label && (\n <span\n id={labelId}\n className={`label-container ${disabled ? 'label-container-disabled' : ''}`}\n >\n {label}\n </span>\n )}\n <div className=\"input-container-wrapper\">\n <div className=\"input-wrapper\" style={{ pointerEvents: disabled ? 'none' : 'auto' }}>\n {React.createElement(tag, {\n ref: inputRef,\n id: inputId,\n value: value,\n onChange: handleInputChange,\n onClick: handleInputClick,\n onFocus: handleInputFocus,\n ...comboboxInputProps,\n disabled,\n className: `${error ? 'input-container-error' : 'input-container-default'} ${disabled ? 'input-container-disabled' : ''} ${filteredSuggestions.length > 0 || value ? 'with-icon' : ''} ${filteredSuggestions.length > 0 && value ? 'with-icons' : ''}`,\n maxLength,\n placeholder,\n 'aria-invalid': error || undefined,\n ...a11yNameProps,\n ...props\n })}\n {value && (\n <Icon\n name=\"close\"\n className=\"input-icon-close\"\n size={15}\n onClick={handleClearInput}\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n ariaLabel=\"Clear input\"\n />\n )}\n {filteredSuggestions.length > 0 && (\n <Icon\n name=\"chevron\"\n rotation={isSuggestionBoxVisible ? '180' : '0'}\n className=\"input-icon-chevron\"\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n aria-hidden=\"true\"\n />\n )}\n </div>\n {isSuggestionBoxVisible && filteredSuggestions.length > 0 && (\n <div\n {...listboxProps}\n aria-label={label || ariaLabel || 'Suggestions'}\n className=\"suggestions-list\"\n data-automation-id=\"autocomplete-suggestions-list\"\n >\n {filteredSuggestions.map((suggestion, index) => {\n const optionProps = getOptionProps(index, false);\n const isHighlighted = highlightedIndex === index;\n return (\n <div\n key={index}\n {...optionProps}\n className={`${optionClassName || 'suggestion-item'} ${isHighlighted ? `suggestion-item-highlighted${isKeyboardFocused ? ' suggestion-item-keyboard-highlight' : ''}` : ''}`}\n onClick={() => handleSelectSuggestion(suggestion)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`autocomplete-suggestion-item-${index}`}\n >\n {renderOption\n ? renderOption(suggestion, { isHighlighted, index })\n : suggestion.label}\n </div>\n );\n })}\n </div>\n )}\n </div>\n {(error || maxLength) && (\n <div className={`${error ? 'error-and-max-word' : 'max-word-container'} ${disabled ? 'disabled' : ''}`}>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {maxLength && (\n <div className=\"max-word\">\n {value.length}/{maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n"],"names":["AutoCompleteInput","React","memo","value","onChange","disabled","maxLength","tag","error","errorMessage","label","placeholder","suggestions","onSelect","renderOption","optionClassName","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","props","filteredSuggestions","setFilteredSuggestions","useState","isSuggestionBoxVisible","setSuggestionBoxVisible","containerRef","useRef","inputRef","instanceId","useStableId","undefined","inputId","listboxId","labelId","errorId","handleSelectSuggestion","useCallback","item","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","isKeyboardFocused","useCombobox","items","isOpen","onOpenChange","handleInputChange","e","inputValue","target","filtered","filter","suggestion","toLowerCase","includes","useEffect","handleInputClick","handleInputFocus","length","handleClearInput","current","focus","a11yNameProps","getA11yNameAttributes","createElement","_extends","className","ref","id","style","pointerEvents","onClick","onFocus","Icon","name","size","stroke","rotation","map","index","optionProps","isHighlighted","key","onMouseEnter","role"],"mappings":";;;;;;;;;;;;;;;;AAoDO,MAAMA,KAAsDC,gBAAAA,EAAMC,KACvE,CAAC;AAAA,EACCC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,WAAAA;AAAAA,EACAC,KAAAA,IAAM;AAAA,EACNC,OAA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AY2B,MAAU;AAC9C,UAAMC,IAAc1C,EAAeyC,GAAO,EAAK,GACzCE,IAAgB1C,MAAqBwC;AAC3C,WACEnF,gBAAAA,EAAAoE,cAAA,OAAAC,EAAA;AAAA,MACEiB,KAAKH;AAAAA,IAAAA,GACDC,GAAW;AAAA,MACfd,WAAW,GAAGxD,KAAmB,iBAAiB,IAAIuE,IAAgB,8BAA8BxC,IAAoB,wCAAwC,EAAE,KAAK,EAAE;AAAA,MACzK8B,SAASA,MAAMxC,EAAuBqB,CAAU;AAAA,MAChD+B,cAAcA,MAAM3C,EAAoBuC,CAAK;AAAA,MAC7C,sBAAoB,gCAAgCA,CAAK;AAAA,IAAA,CAAG,GAE3DtE,IACGA,EAAa2C,GAAY;AAAA,MAAE6B,eAAAA;AAAAA,MAAeF,OAAAA;AAAAA,IAAAA,CAAO,IACjD3B,EAAW/C,KACZ;AAAA,EAET,CAAC,CACE,CAEJ,IACHF,KAASF,MACTL,gBAAAA,EAAAoE,cAAA,OAAA;AAAA,IAAKE,WAAW,GAAG/D,IAAQ,uBAAuB,oBAAoB,IAAIH,IAAW,aAAa,EAAE;AAAA,EAAA,GACjGG,KACCP,gBAAAA,EAAAoE,cAAA,OAAA;AAAA,IAAKI,IAAItC;AAAAA,IAASoC,WAAU;AAAA,IAAgBkB,MAAK;AAAA,EAAA,GAC9ChF,CACE,GAENH,KACCL,gBAAAA,EAAAoE,cAAA,OAAA;AAAA,IAAKE,WAAU;AAAA,EAAA,GACZpE,EAAM4D,QAAO,KAAEzD,CACb,CAEJ,CAEJ;AAET,CACF;"}
|
package/dist/index46.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import t, { useState as h, useRef as f, useCallback as g, useEffect as
|
|
1
|
+
import t, { useState as h, useRef as f, useCallback as g, useEffect as _ } from "react";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import C from "./
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { useStableId as
|
|
6
|
-
import { getA11yNameAttributes as
|
|
3
|
+
import C from "./index232.js";
|
|
4
|
+
import { Icon as M } from "./index6.js";
|
|
5
|
+
import { useStableId as v } from "./index205.js";
|
|
6
|
+
import { getA11yNameAttributes as T } from "./index81.js";
|
|
7
7
|
import "./index72.js";
|
|
8
8
|
import { useCombobox as le } from "./index68.js";
|
|
9
9
|
function c() {
|
|
@@ -15,7 +15,7 @@ function c() {
|
|
|
15
15
|
return i;
|
|
16
16
|
}, c.apply(null, arguments);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const ve = ({
|
|
19
19
|
onCountrycodeChange: i,
|
|
20
20
|
onNumberChange: l,
|
|
21
21
|
error: r,
|
|
@@ -23,86 +23,85 @@ const ye = ({
|
|
|
23
23
|
value: d,
|
|
24
24
|
label: s,
|
|
25
25
|
automationId: p = "",
|
|
26
|
-
ariaLabel:
|
|
27
|
-
ariaLabelledBy:
|
|
26
|
+
ariaLabel: P,
|
|
27
|
+
ariaLabelledBy: x,
|
|
28
28
|
ariaDescribedBy: z,
|
|
29
|
-
phoneNumberAriaLabel:
|
|
29
|
+
phoneNumberAriaLabel: $,
|
|
30
30
|
countryCodeAriaLabel: G,
|
|
31
31
|
disabled: a = !1
|
|
32
32
|
}) => {
|
|
33
|
-
const [
|
|
34
|
-
y(!1),
|
|
33
|
+
const [E, k] = h(d?.countryCode || C[0].dial_code), [n, y] = h(!1), [w, B] = h(C), [Q, R] = h(""), [U, F] = h(""), W = f(null), O = f(null), K = f(null), m = f(!1), N = v(p, "phone-label"), V = v(p, "phone-listbox"), X = v(p, "phone-input"), j = v(p, "phone-error"), b = C.find((e) => e.dial_code === E), q = g(() => {
|
|
34
|
+
y(!1), R(""), B(C);
|
|
35
35
|
}, []), I = g((e) => {
|
|
36
|
-
e && (
|
|
37
|
-
}, [i,
|
|
36
|
+
e && (k(e), i(e)), q();
|
|
37
|
+
}, [i, q]), Y = g((e) => {
|
|
38
38
|
m.current = !0, I(e.dial_code);
|
|
39
39
|
}, [I]), {
|
|
40
|
-
containerProps:
|
|
40
|
+
containerProps: H,
|
|
41
41
|
inputProps: Z,
|
|
42
42
|
listboxProps: ee,
|
|
43
43
|
getOptionProps: te,
|
|
44
44
|
highlightedIndex: ne,
|
|
45
|
-
setHighlightedIndex:
|
|
45
|
+
setHighlightedIndex: J
|
|
46
46
|
} = le({
|
|
47
47
|
items: w,
|
|
48
48
|
isOpen: n,
|
|
49
49
|
onOpenChange: y,
|
|
50
50
|
onSelect: Y,
|
|
51
|
-
listboxId:
|
|
51
|
+
listboxId: V
|
|
52
52
|
}), oe = (e) => {
|
|
53
53
|
const o = e.target.value;
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
R(o), J(-1);
|
|
55
|
+
const S = C.filter((A) => A.name.toLowerCase().includes(o.toLowerCase()) || A.dial_code.toLowerCase().includes(o.toLowerCase()) || A.code.toLowerCase().includes(o.toLowerCase()));
|
|
56
|
+
B(S);
|
|
57
57
|
}, D = f(n);
|
|
58
|
-
|
|
58
|
+
_(() => {
|
|
59
59
|
let e = null;
|
|
60
60
|
return D.current && !n && m.current && (e = requestAnimationFrame(() => {
|
|
61
|
-
|
|
61
|
+
O.current?.focus();
|
|
62
62
|
})), D.current && !n && (m.current = !1), D.current = n, () => {
|
|
63
63
|
e !== null && cancelAnimationFrame(e);
|
|
64
64
|
};
|
|
65
|
-
}, [n]),
|
|
66
|
-
d && (
|
|
67
|
-
}, [d]),
|
|
65
|
+
}, [n]), _(() => {
|
|
66
|
+
d && (k(d.countryCode), F(d.number));
|
|
67
|
+
}, [d]), _(() => {
|
|
68
68
|
let e = null;
|
|
69
69
|
return n && (e = requestAnimationFrame(() => {
|
|
70
|
-
|
|
70
|
+
K.current?.focus();
|
|
71
71
|
})), () => {
|
|
72
72
|
e !== null && cancelAnimationFrame(e);
|
|
73
73
|
};
|
|
74
74
|
}, [n]);
|
|
75
75
|
const re = (e) => {
|
|
76
76
|
const o = e.replace(/\D/g, "");
|
|
77
|
-
|
|
78
|
-
},
|
|
77
|
+
F(o), l(o);
|
|
78
|
+
}, L = g(() => {
|
|
79
79
|
a || y((e) => !e);
|
|
80
80
|
}, [a]), ae = g((e) => {
|
|
81
81
|
if (!a)
|
|
82
82
|
switch (e.key) {
|
|
83
83
|
case "Enter":
|
|
84
84
|
case " ":
|
|
85
|
-
e.preventDefault(),
|
|
85
|
+
e.preventDefault(), L();
|
|
86
86
|
break;
|
|
87
87
|
case "ArrowDown":
|
|
88
88
|
e.preventDefault(), n || y(!0);
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
|
-
}, [a, n,
|
|
92
|
-
ariaLabelledBy:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}), ie = G || `Select country code. Current: ${E?.name} ${E?.dial_code}`;
|
|
91
|
+
}, [a, n, L]), ce = T({
|
|
92
|
+
ariaLabelledBy: x || (!P && s ? N : void 0),
|
|
93
|
+
ariaLabel: x ? void 0 : P || (s ? void 0 : "Phone number")
|
|
94
|
+
}), se = T({
|
|
95
|
+
ariaLabelledBy: !$ && s ? N : void 0,
|
|
96
|
+
ariaLabel: $ || (s ? void 0 : "Phone number"),
|
|
97
|
+
ariaDescribedBy: r ? j : z
|
|
98
|
+
}), ie = G || `Select country code. Current: ${b?.name} ${b?.dial_code}`;
|
|
100
99
|
return /* @__PURE__ */ t.createElement("div", c({
|
|
101
100
|
className: "phone-input-container-se-design-main-container",
|
|
102
101
|
"data-automation-id": p
|
|
103
|
-
},
|
|
102
|
+
}, H, {
|
|
104
103
|
onKeyDownCapture: (e) => {
|
|
105
|
-
e.key === "Escape" && n && (m.current = !0),
|
|
104
|
+
e.key === "Escape" && n && (m.current = !0), H.onKeyDownCapture(e);
|
|
106
105
|
}
|
|
107
106
|
}), s && /* @__PURE__ */ t.createElement("div", {
|
|
108
107
|
id: N,
|
|
@@ -115,23 +114,23 @@ const ye = ({
|
|
|
115
114
|
}), /* @__PURE__ */ t.createElement("div", {
|
|
116
115
|
className: "phone-input-container-se-design"
|
|
117
116
|
}, /* @__PURE__ */ t.createElement("button", {
|
|
118
|
-
ref:
|
|
117
|
+
ref: O,
|
|
119
118
|
type: "button",
|
|
120
119
|
className: `phone-input-container-se-design-country-code focus-outline rounded ${a ? "cursor-not-allowed opacity-60" : ""}`,
|
|
121
|
-
onClick:
|
|
120
|
+
onClick: L,
|
|
122
121
|
onKeyDown: ae,
|
|
123
122
|
"aria-haspopup": "listbox",
|
|
124
123
|
"aria-expanded": n,
|
|
125
|
-
"aria-controls": n ?
|
|
124
|
+
"aria-controls": n ? V : void 0,
|
|
126
125
|
"aria-label": ie,
|
|
127
126
|
disabled: a,
|
|
128
127
|
"data-automation-id": "country-code-selector"
|
|
129
128
|
}, /* @__PURE__ */ t.createElement("img", {
|
|
130
|
-
src: `https://flagcdn.com/${
|
|
129
|
+
src: `https://flagcdn.com/${b?.code.toLowerCase()}.svg`,
|
|
131
130
|
alt: "",
|
|
132
131
|
"aria-hidden": "true",
|
|
133
132
|
width: "16"
|
|
134
|
-
}), /* @__PURE__ */ t.createElement("span", null,
|
|
133
|
+
}), /* @__PURE__ */ t.createElement("span", null, b?.dial_code), /* @__PURE__ */ t.createElement(M, {
|
|
135
134
|
name: "chevron",
|
|
136
135
|
className: n ? "rotate-180" : "",
|
|
137
136
|
"aria-hidden": "true"
|
|
@@ -156,12 +155,12 @@ const ye = ({
|
|
|
156
155
|
"data-automation-id": "country-code-list"
|
|
157
156
|
}), /* @__PURE__ */ t.createElement("div", {
|
|
158
157
|
className: "search-input-wrapper"
|
|
159
|
-
}, /* @__PURE__ */ t.createElement(
|
|
158
|
+
}, /* @__PURE__ */ t.createElement(M, {
|
|
160
159
|
name: "search",
|
|
161
160
|
className: "search-icon",
|
|
162
161
|
"aria-hidden": "true"
|
|
163
162
|
}), /* @__PURE__ */ t.createElement("input", c({
|
|
164
|
-
ref:
|
|
163
|
+
ref: K
|
|
165
164
|
}, Z, {
|
|
166
165
|
type: "text",
|
|
167
166
|
placeholder: "Search countries",
|
|
@@ -171,15 +170,15 @@ const ye = ({
|
|
|
171
170
|
"aria-label": "Search countries",
|
|
172
171
|
"data-automation-id": "country-code-search-input"
|
|
173
172
|
}))), w.length > 0 ? w.map((e, o) => {
|
|
174
|
-
const
|
|
173
|
+
const S = te(o, e.dial_code === E);
|
|
175
174
|
return /* @__PURE__ */ t.createElement("div", c({
|
|
176
175
|
key: e.code
|
|
177
|
-
},
|
|
178
|
-
className: `phone-input-container-se-design-country-code-list-item ${ne === o ? "highlighted" : ""} ${e.dial_code ===
|
|
176
|
+
}, S, {
|
|
177
|
+
className: `phone-input-container-se-design-country-code-list-item ${ne === o ? "highlighted" : ""} ${e.dial_code === E ? "selected" : ""}`,
|
|
179
178
|
onClick: () => {
|
|
180
179
|
m.current = !0, I(e.dial_code);
|
|
181
180
|
},
|
|
182
|
-
onMouseEnter: () =>
|
|
181
|
+
onMouseEnter: () => J(o)
|
|
183
182
|
}), /* @__PURE__ */ t.createElement("img", {
|
|
184
183
|
src: `https://flagcdn.com/${e.code.toLowerCase()}.svg`,
|
|
185
184
|
alt: "",
|
|
@@ -190,12 +189,12 @@ const ye = ({
|
|
|
190
189
|
className: "phone-input-container-se-design-country-code-list-item-no-results",
|
|
191
190
|
role: "status"
|
|
192
191
|
}, "No results found"))), r && /* @__PURE__ */ t.createElement("div", {
|
|
193
|
-
id:
|
|
192
|
+
id: j,
|
|
194
193
|
className: "error-message",
|
|
195
194
|
role: "alert"
|
|
196
195
|
}, u));
|
|
197
196
|
};
|
|
198
197
|
export {
|
|
199
|
-
|
|
198
|
+
ve as PhoneInput
|
|
200
199
|
};
|
|
201
200
|
//# sourceMappingURL=index46.js.map
|
package/dist/index46.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index46.js","sources":["../src/components/PhoneInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport './style.scss';\nimport countriesInfoJson from './countriesInfo.json';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface PhoneInputProps {\n onCountrycodeChange: (countryCode: string) => void;\n onNumberChange: (number: string) => void;\n error?: boolean;\n errorMessage?: string;\n value?: {\n countryCode: string;\n number: string;\n };\n label?: string;\n automationId?: string;\n /**\n * Accessible label for the entire phone input group (role=\"group\").\n * Provides context for screen readers (e.g., \"Two-step verification phone number for signer 1\").\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label the group (highest precedence over ariaLabel).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description for the phone number input.\n */\n ariaDescribedBy?: string;\n /**\n * Override aria-label for the phone number input specifically.\n * Defaults to the visible label text or 'Phone number'.\n */\n phoneNumberAriaLabel?: string;\n /**\n * Override aria-label for the country code combobox button.\n * Defaults to \"Select country code. Current: {name} {dial_code}\".\n */\n countryCodeAriaLabel?: string;\n /**\n * Whether the input is disabled\n */\n disabled?: boolean;\n}\n\nexport const PhoneInput: React.FC<PhoneInputProps> = ({\n onCountrycodeChange,\n onNumberChange,\n error,\n errorMessage,\n value,\n label,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n phoneNumberAriaLabel,\n countryCodeAriaLabel,\n disabled = false\n}) => {\n const [countryCode, setCountryCode] = useState(value?.countryCode || countriesInfoJson[0].dial_code);\n const [displaySelectCountryCode, setDisplaySelectCountryCode] = useState(false);\n const [countriesInfo, setCountriesInfo] = useState(countriesInfoJson);\n const [searchValue, setSearchValue] = useState('');\n const [enteredNumber, setEnteredNumber] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n const countryButtonRef = useRef<HTMLButtonElement>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const restoreFocusToButtonRef = useRef(false);\n\n // Generate stable IDs for ARIA relationships\n const labelId = useStableId(automationId, 'phone-label');\n const listboxId = useStableId(automationId, 'phone-listbox');\n const phoneInputId = useStableId(automationId, 'phone-input');\n const errorId = useStableId(automationId, 'phone-error');\n\n const countryInfo = countriesInfoJson.find((country) => country.dial_code === countryCode);\n\n // Close dropdown and reset state\n const closeDropdown = useCallback(() => {\n setDisplaySelectCountryCode(false);\n setSearchValue('');\n setCountriesInfo(countriesInfoJson);\n }, []);\n\n const handleCountryCodeSelect = useCallback(\n (country: string) => {\n if (country) {\n setCountryCode(country);\n onCountrycodeChange(country);\n }\n closeDropdown();\n // Focus return is handled by useEffect that watches displaySelectCountryCode\n },\n [onCountrycodeChange, closeDropdown]\n );\n\n const handleSelectFromDropdown = useCallback(\n (country: typeof countriesInfoJson[0]) => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n },\n [handleCountryCodeSelect]\n );\n\n // Use comprehensive useCombobox hook for country search\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex\n } = useCombobox({\n items: countriesInfo,\n isOpen: displaySelectCountryCode,\n onOpenChange: setDisplaySelectCountryCode,\n onSelect: handleSelectFromDropdown,\n listboxId\n });\n\n const handleCountryCodeSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const searchVal = event.target.value;\n setSearchValue(searchVal);\n setHighlightedIndex(-1);\n const filteredCountries = countriesInfoJson.filter(\n (country) =>\n country.name.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.dial_code.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.code.toLowerCase().includes(searchVal.toLowerCase())\n );\n setCountriesInfo(filteredCountries);\n };\n\n // Return focus to button when dropdown closes\n const prevDisplaySelectCountryCodeRef = useRef(displaySelectCountryCode);\n useEffect(() => {\n let rafId: number | null = null;\n // If dropdown was open and is now closed, return focus to button\n // ONLY when the close was triggered from within the component (Escape/selection),\n // not when the user moved focus outside (focus-out dismissal).\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode && restoreFocusToButtonRef.current) {\n rafId = requestAnimationFrame(() => {\n countryButtonRef.current?.focus();\n });\n }\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode) {\n restoreFocusToButtonRef.current = false;\n }\n prevDisplaySelectCountryCodeRef.current = displaySelectCountryCode;\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n useEffect(() => {\n if (value) {\n setCountryCode(value.countryCode);\n setEnteredNumber(value.number);\n }\n }, [value]);\n\n // Focus search input when dropdown opens\n useEffect(() => {\n let rafId: number | null = null;\n if (displaySelectCountryCode) {\n rafId = requestAnimationFrame(() => {\n searchInputRef.current?.focus();\n });\n }\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n const handleEnteredNumberChange = (val: string) => {\n const numericValue = val.replace(/\\D/g, ''); // Remove non-numeric characters\n setEnteredNumber(numericValue);\n onNumberChange(numericValue);\n };\n\n const toggleDropdown = useCallback(() => {\n if (disabled) return;\n setDisplaySelectCountryCode((prev) => !prev);\n }, [disabled]);\n\n const handleCountryButtonKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n toggleDropdown();\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (!displaySelectCountryCode) {\n setDisplaySelectCountryCode(true);\n }\n break;\n // Escape is handled by useDismissOnEscape hook\n }\n },\n [disabled, displaySelectCountryCode, toggleDropdown]\n );\n\n // Group label (role=\"group\"): combines the visible label with any external ariaLabelledBy\n // (handled inside getA11yNameAttributes); ariaLabel overrides the visible label; falls back to 'Phone number'.\n const groupA11yProps = getA11yNameAttributes({\n ariaLabelledBy,\n internalLabelId: label ? labelId : undefined,\n ariaLabel: ariaLabel || (!label ? 'Phone number' : undefined)\n });\n\n // Phone number input: caller override > visible label > fallback 'Phone number'\n const phoneInputA11yProps = getA11yNameAttributes({\n ariaLabelledBy: !phoneNumberAriaLabel && label ? labelId : undefined,\n ariaLabel: phoneNumberAriaLabel || (!label ? 'Phone number' : undefined),\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n // Country code button label: caller override > default dynamic label\n const computedCountryCodeAriaLabel = countryCodeAriaLabel ||\n `Select country code. Current: ${countryInfo?.name} ${countryInfo?.dial_code}`;\n\n return (\n <div \n className=\"phone-input-container-se-design-main-container\" \n data-automation-id={automationId}\n {...containerProps}\n onKeyDownCapture={(e) => {\n if (e.key === 'Escape' && displaySelectCountryCode) {\n restoreFocusToButtonRef.current = true;\n }\n containerProps.onKeyDownCapture(e);\n }}\n >\n {label && (\n <div id={labelId} className=\"label-container\">\n {label}\n </div>\n )}\n <div\n role=\"group\"\n {...groupA11yProps}\n className={`phone-input-container-se-design-main ${error ? 'error' : ''}`}\n ref={containerRef}\n >\n <div className=\"phone-input-container-se-design\">\n <button\n ref={countryButtonRef}\n type=\"button\"\n className={`phone-input-container-se-design-country-code focus-outline rounded ${disabled ? 'cursor-not-allowed opacity-60' : ''}`}\n onClick={toggleDropdown}\n onKeyDown={handleCountryButtonKeyDown}\n aria-haspopup=\"listbox\"\n aria-expanded={displaySelectCountryCode}\n aria-controls={displaySelectCountryCode ? listboxId : undefined}\n aria-label={computedCountryCodeAriaLabel}\n disabled={disabled}\n data-automation-id=\"country-code-selector\"\n >\n <img\n src={`https://flagcdn.com/${countryInfo?.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{countryInfo?.dial_code}</span>\n <Icon\n name=\"chevron\"\n className={!displaySelectCountryCode ? '' : 'rotate-180'}\n aria-hidden=\"true\"\n />\n </button>\n <span className=\"divider\" aria-hidden=\"true\" />\n <input\n id={phoneInputId}\n type=\"tel\"\n placeholder=\"Enter phone number\"\n className={`phone-input-container-se-design-phone-number-input ${disabled ? 'disabled' : ''}`}\n onChange={(event) => handleEnteredNumberChange(event.target.value)}\n value={enteredNumber}\n pattern=\"[0-9]*\"\n disabled={disabled}\n aria-invalid={error || undefined}\n {...phoneInputA11yProps}\n data-automation-id=\"phone-number-input-field\"\n />\n </div>\n\n {displaySelectCountryCode && (\n <div\n {...listboxProps}\n className=\"phone-input-container-se-design-country-code-list\"\n aria-label=\"Select country\"\n data-automation-id=\"country-code-list\"\n >\n <div className=\"search-input-wrapper\">\n <Icon name=\"search\" className=\"search-icon\" aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n {...comboboxInputProps}\n type=\"text\"\n placeholder=\"Search countries\"\n className=\"phone-input-container-se-design-country-code-list-item-input\"\n onChange={handleCountryCodeSearch}\n value={searchValue}\n aria-label=\"Search countries\"\n data-automation-id=\"country-code-search-input\"\n />\n </div>\n {countriesInfo.length > 0 ? (\n countriesInfo.map((country, index) => {\n const optionProps = getOptionProps(index, country.dial_code === countryCode);\n return (\n <div\n key={country.code}\n {...optionProps}\n className={`phone-input-container-se-design-country-code-list-item ${\n highlightedIndex === index ? 'highlighted' : ''\n } ${country.dial_code === countryCode ? 'selected' : ''}`}\n onClick={() => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n <img\n src={`https://flagcdn.com/${country.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{country.name}</span>\n <span>({country.dial_code})</span>\n </div>\n );\n })\n ) : (\n <div className=\"phone-input-container-se-design-country-code-list-item-no-results\" role=\"status\">\n No results found\n </div>\n )}\n </div>\n )}\n </div>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n </div>\n );\n};\n"],"names":["PhoneInput","onCountrycodeChange","onNumberChange","error","errorMessage","value","label","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","phoneNumberAriaLabel","countryCodeAriaLabel","disabled","countryCode","setCountryCode","useState","countriesInfoJson","dial_code","displaySelectCountryCode","setDisplaySelectCountryCode","countriesInfo","setCountriesInfo","searchValue","setSearchValue","enteredNumber","setEnteredNumber","containerRef","useRef","countryButtonRef","searchInputRef","restoreFocusToButtonRef","labelId","useStableId","listboxId","phoneInputId","errorId","countryInfo","find","country","closeDropdown","useCallback","handleCountryCodeSelect","handleSelectFromDropdown","current","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","useCombobox","items","isOpen","onOpenChange","onSelect","handleCountryCodeSearch","event","searchVal","target","filteredCountries","filter","name","toLowerCase","includes","code","prevDisplaySelectCountryCodeRef","useEffect","rafId","requestAnimationFrame","focus","cancelAnimationFrame","number","handleEnteredNumberChange","val","numericValue","replace","toggleDropdown","prev","handleCountryButtonKeyDown","e","key","preventDefault","groupA11yProps","getA11yNameAttributes","internalLabelId","undefined","phoneInputA11yProps","computedCountryCodeAriaLabel","React","createElement","_extends","className","onKeyDownCapture","id","role","ref","type","onClick","onKeyDown","src","alt","width","Icon","placeholder","onChange","pattern","length","map","index","optionProps","onMouseEnter"],"mappings":";;;;;;;;;;;;;;;;;AA+CO,MAAMA,KAAwCA,CAAC;AAAA,EACpDC,qBAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,UAAAA,IAAW;AACb,MAAM;AACJ,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASX,GAAOS,eAAeG,EAAkB,CAAC,EAAEC,SAAS,GAC7F,CAACC,GAA0BC,CAA2B,IAAIJ,EAAS,EAAK,GACxE,CAACK,GAAeC,CAAgB,IAAIN,EAASC,CAAiB,GAC9D,CAACM,GAAaC,CAAc,IAAIR,EAAS,EAAE,GAC3C,CAACS,GAAeC,CAAgB,IAAIV,EAAS,EA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,KAAKF,aAAa;AAAA,MACtDsC,KAAI;AAAA,MACJ,eAAY;AAAA,MACZC,OAAM;AAAA,IAAA,CACP,GACDb,gBAAAA,EAAAC,cAAA,QAAA,MAAOpD,EAAQwB,IAAW,GAC1B2B,gBAAAA,EAAAC,cAAA,QAAA,MAAM,KAAEpD,EAAQrB,WAAU,GAAO,CAC9B;AAAA,EAET,CAAC,IAEDwE,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKE,WAAU;AAAA,IAAoEG,MAAK;AAAA,EAAA,GAAS,kBAE5F,CAEJ,CAEJ,GACJ7F,KACCuF,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKI,IAAI3D;AAAAA,IAASyD,WAAU;AAAA,IAAgBG,MAAK;AAAA,EAAA,GAC9C5F,CACE,CAEJ;AAET;"}
|
|
1
|
+
{"version":3,"file":"index46.js","sources":["../src/components/PhoneInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport './style.scss';\nimport countriesInfoJson from './countriesInfo.json';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface PhoneInputProps {\n onCountrycodeChange: (countryCode: string) => void;\n onNumberChange: (number: string) => void;\n error?: boolean;\n errorMessage?: string;\n value?: {\n countryCode: string;\n number: string;\n };\n label?: string;\n automationId?: string;\n /**\n * Accessible label for the entire phone input group (role=\"group\").\n * Provides context for screen readers (e.g., \"Two-step verification phone number for signer 1\").\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label the group (highest precedence over ariaLabel).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description for the phone number input.\n */\n ariaDescribedBy?: string;\n /**\n * Override aria-label for the phone number input specifically.\n * Defaults to the visible label text or 'Phone number'.\n */\n phoneNumberAriaLabel?: string;\n /**\n * Override aria-label for the country code combobox button.\n * Defaults to \"Select country code. Current: {name} {dial_code}\".\n */\n countryCodeAriaLabel?: string;\n /**\n * Whether the input is disabled\n */\n disabled?: boolean;\n}\n\nexport const PhoneInput: React.FC<PhoneInputProps> = ({\n onCountrycodeChange,\n onNumberChange,\n error,\n errorMessage,\n value,\n label,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n phoneNumberAriaLabel,\n countryCodeAriaLabel,\n disabled = false\n}) => {\n const [countryCode, setCountryCode] = useState(value?.countryCode || countriesInfoJson[0].dial_code);\n const [displaySelectCountryCode, setDisplaySelectCountryCode] = useState(false);\n const [countriesInfo, setCountriesInfo] = useState(countriesInfoJson);\n const [searchValue, setSearchValue] = useState('');\n const [enteredNumber, setEnteredNumber] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n const countryButtonRef = useRef<HTMLButtonElement>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const restoreFocusToButtonRef = useRef(false);\n\n // Generate stable IDs for ARIA relationships\n const labelId = useStableId(automationId, 'phone-label');\n const listboxId = useStableId(automationId, 'phone-listbox');\n const phoneInputId = useStableId(automationId, 'phone-input');\n const errorId = useStableId(automationId, 'phone-error');\n\n const countryInfo = countriesInfoJson.find((country) => country.dial_code === countryCode);\n\n // Close dropdown and reset state\n const closeDropdown = useCallback(() => {\n setDisplaySelectCountryCode(false);\n setSearchValue('');\n setCountriesInfo(countriesInfoJson);\n }, []);\n\n const handleCountryCodeSelect = useCallback(\n (country: string) => {\n if (country) {\n setCountryCode(country);\n onCountrycodeChange(country);\n }\n closeDropdown();\n // Focus return is handled by useEffect that watches displaySelectCountryCode\n },\n [onCountrycodeChange, closeDropdown]\n );\n\n const handleSelectFromDropdown = useCallback(\n (country: typeof countriesInfoJson[0]) => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n },\n [handleCountryCodeSelect]\n );\n\n // Use comprehensive useCombobox hook for country search\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex\n } = useCombobox({\n items: countriesInfo,\n isOpen: displaySelectCountryCode,\n onOpenChange: setDisplaySelectCountryCode,\n onSelect: handleSelectFromDropdown,\n listboxId\n });\n\n const handleCountryCodeSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const searchVal = event.target.value;\n setSearchValue(searchVal);\n setHighlightedIndex(-1);\n const filteredCountries = countriesInfoJson.filter(\n (country) =>\n country.name.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.dial_code.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.code.toLowerCase().includes(searchVal.toLowerCase())\n );\n setCountriesInfo(filteredCountries);\n };\n\n // Return focus to button when dropdown closes\n const prevDisplaySelectCountryCodeRef = useRef(displaySelectCountryCode);\n useEffect(() => {\n let rafId: number | null = null;\n // If dropdown was open and is now closed, return focus to button\n // ONLY when the close was triggered from within the component (Escape/selection),\n // not when the user moved focus outside (focus-out dismissal).\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode && restoreFocusToButtonRef.current) {\n rafId = requestAnimationFrame(() => {\n countryButtonRef.current?.focus();\n });\n }\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode) {\n restoreFocusToButtonRef.current = false;\n }\n prevDisplaySelectCountryCodeRef.current = displaySelectCountryCode;\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n useEffect(() => {\n if (value) {\n setCountryCode(value.countryCode);\n setEnteredNumber(value.number);\n }\n }, [value]);\n\n // Focus search input when dropdown opens\n useEffect(() => {\n let rafId: number | null = null;\n if (displaySelectCountryCode) {\n rafId = requestAnimationFrame(() => {\n searchInputRef.current?.focus();\n });\n }\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n const handleEnteredNumberChange = (val: string) => {\n const numericValue = val.replace(/\\D/g, ''); // Remove non-numeric characters\n setEnteredNumber(numericValue);\n onNumberChange(numericValue);\n };\n\n const toggleDropdown = useCallback(() => {\n if (disabled) return;\n setDisplaySelectCountryCode((prev) => !prev);\n }, [disabled]);\n\n const handleCountryButtonKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n toggleDropdown();\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (!displaySelectCountryCode) {\n setDisplaySelectCountryCode(true);\n }\n break;\n // Escape is handled by useDismissOnEscape hook\n }\n },\n [disabled, displaySelectCountryCode, toggleDropdown]\n );\n\n // Group label (role=\"group\"): ariaLabelledBy > ariaLabel > visible label > fallback\n const groupAriaLabelledBy = ariaLabelledBy || (!ariaLabel && label ? labelId : undefined);\n const groupAriaLabel = !ariaLabelledBy ? (ariaLabel || (!label ? 'Phone number' : undefined)) : undefined;\n const groupA11yProps = getA11yNameAttributes({ ariaLabelledBy: groupAriaLabelledBy, ariaLabel: groupAriaLabel });\n\n // Phone number input: caller override > visible label > fallback 'Phone number'\n const phoneInputA11yProps = getA11yNameAttributes({\n ariaLabelledBy: !phoneNumberAriaLabel && label ? labelId : undefined,\n ariaLabel: phoneNumberAriaLabel || (!label ? 'Phone number' : undefined),\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n // Country code button label: caller override > default dynamic label\n const computedCountryCodeAriaLabel = countryCodeAriaLabel ||\n `Select country code. Current: ${countryInfo?.name} ${countryInfo?.dial_code}`;\n\n return (\n <div \n className=\"phone-input-container-se-design-main-container\" \n data-automation-id={automationId}\n {...containerProps}\n onKeyDownCapture={(e) => {\n if (e.key === 'Escape' && displaySelectCountryCode) {\n restoreFocusToButtonRef.current = true;\n }\n containerProps.onKeyDownCapture(e);\n }}\n >\n {label && (\n <div id={labelId} className=\"label-container\">\n {label}\n </div>\n )}\n <div\n role=\"group\"\n {...groupA11yProps}\n className={`phone-input-container-se-design-main ${error ? 'error' : ''}`}\n ref={containerRef}\n >\n <div className=\"phone-input-container-se-design\">\n <button\n ref={countryButtonRef}\n type=\"button\"\n className={`phone-input-container-se-design-country-code focus-outline rounded ${disabled ? 'cursor-not-allowed opacity-60' : ''}`}\n onClick={toggleDropdown}\n onKeyDown={handleCountryButtonKeyDown}\n aria-haspopup=\"listbox\"\n aria-expanded={displaySelectCountryCode}\n aria-controls={displaySelectCountryCode ? listboxId : undefined}\n aria-label={computedCountryCodeAriaLabel}\n disabled={disabled}\n data-automation-id=\"country-code-selector\"\n >\n <img\n src={`https://flagcdn.com/${countryInfo?.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{countryInfo?.dial_code}</span>\n <Icon\n name=\"chevron\"\n className={!displaySelectCountryCode ? '' : 'rotate-180'}\n aria-hidden=\"true\"\n />\n </button>\n <span className=\"divider\" aria-hidden=\"true\" />\n <input\n id={phoneInputId}\n type=\"tel\"\n placeholder=\"Enter phone number\"\n className={`phone-input-container-se-design-phone-number-input ${disabled ? 'disabled' : ''}`}\n onChange={(event) => handleEnteredNumberChange(event.target.value)}\n value={enteredNumber}\n pattern=\"[0-9]*\"\n disabled={disabled}\n aria-invalid={error || undefined}\n {...phoneInputA11yProps}\n data-automation-id=\"phone-number-input-field\"\n />\n </div>\n\n {displaySelectCountryCode && (\n <div\n {...listboxProps}\n className=\"phone-input-container-se-design-country-code-list\"\n aria-label=\"Select country\"\n data-automation-id=\"country-code-list\"\n >\n <div className=\"search-input-wrapper\">\n <Icon name=\"search\" className=\"search-icon\" aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n {...comboboxInputProps}\n type=\"text\"\n placeholder=\"Search countries\"\n className=\"phone-input-container-se-design-country-code-list-item-input\"\n onChange={handleCountryCodeSearch}\n value={searchValue}\n aria-label=\"Search countries\"\n data-automation-id=\"country-code-search-input\"\n />\n </div>\n {countriesInfo.length > 0 ? (\n countriesInfo.map((country, index) => {\n const optionProps = getOptionProps(index, country.dial_code === countryCode);\n return (\n <div\n key={country.code}\n {...optionProps}\n className={`phone-input-container-se-design-country-code-list-item ${\n highlightedIndex === index ? 'highlighted' : ''\n } ${country.dial_code === countryCode ? 'selected' : ''}`}\n onClick={() => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n <img\n src={`https://flagcdn.com/${country.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{country.name}</span>\n <span>({country.dial_code})</span>\n </div>\n );\n })\n ) : (\n <div className=\"phone-input-container-se-design-country-code-list-item-no-results\" role=\"status\">\n No results found\n </div>\n )}\n </div>\n )}\n </div>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n </div>\n );\n};\n"],"names":["PhoneInput","onCountrycodeChange","onNumberChange","error","errorMessage","value","label","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","phoneNumberAriaLabel","countryCodeAriaLabel","disabled","countryCode","setCountryCode","useState","countriesInfoJson","dial_code","displaySelectCountryCode","setDisplaySelectCountryCode","countriesInfo","setCountriesInfo","searchValue","setSearchValue","enteredNumber","setEnteredNumber","containerRef","useRef","countryButtonRef","searchInputRef","restoreFocusToButtonRef","labelId","useStableId","listboxId","phoneInputId","errorId","countryInfo","find","country","closeDropdown","useCallback","handleCountryCodeSelect","handleSelectFromDropdown","current","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","useCombobox","items","isOpen","onOpenChange","onSelect","handleCountryCodeSearch","event","searchVal","target","filteredCountries","filter","name","toLowerCase","includes","code","prevDisplaySelectCountryCodeRef","useEffect","rafId","requestAnimationFrame","focus","cancelAnimationFrame","number","handleEnteredNumberChange","val","numericValue","replace","toggleDropdown","prev","handleCountryButtonKeyDown","e","key","preventDefault","groupA11yProps","getA11yNameAttributes","undefined","groupAriaLabel","phoneInputA11yProps","computedCountryCodeAriaLabel","React","createElement","_extends","className","onKeyDownCapture","id","role","ref","type","onClick","onKeyDown","src","alt","width","Icon","placeholder","onChange","pattern","length","map","index","optionProps","onMouseEnter"],"mappings":";;;;;;;;;;;;;;;;;AA+CO,MAAMA,KAAwCA,CAAC;AAAA,EACpDC,qBAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,UAAAA,IAAW;AACb,MAAM;AACJ,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASX,GAAOS,eAAeG,EAAkB,CAAC,EAAEC,SAAS,GAC7F,CAACC,GAA0BC,CAA2B,IAAIJ,EAAS,EAAK,GACxE,CAACK,GAAeC,CAAgB,IAAIN,EAASC,CAAiB,GAC9D,CAACM,GAAaC,CAAc,IAAIR,EAAS,EAAE,GAC3C,CAACS,GAAeC,CAAgB,IAAIV,EAAS,EAAE,GAC/CW,IAAeC,EAAuB,IAAI,GAC1CC,IAAmBD,EAA0B,IAAI,GACjDE,IAAiBF,EAAyB,IAAI,GAC9CG,IAA0BH,EAAO,EAAK,GAGtCI,IAAUC,EAAY1B,GAAc,aAAa,GACjD2B,IAAYD,EAAY1B,GAAc,eAAe,GACrD4B,IAAeF,EAAY1B,GAAc,aAAa,GACtD6B,IAAUH,EAAY1B,GAAc,aAAa,GAEjD8B,IAAcpB,EAAkBqB,KAAMC,CAAAA,MAAYA,EAAQrB,cAAcJ,CAAW,GAGnF0B,IAAgBC,EAAY,MAAM;AACtCrB,IAAAA,EAA4B,EAAK,GACjCI,EAAe,EAAE,GACjBF,EAAiBL,CAAiB;AAAA,EACpC,GAAG,CAAA,CAAE,GAECyB,IAA0BD,EAC9B,CAACF,MAAoB;AACnB,IAAIA,MACFxB,EAAewB,CAAO,GACtBtC,E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