@tcn/ui 0.12.5 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aside.css +1 -0
- package/dist/body.css +1 -1
- package/dist/inputs/color_input/color_input.js +18 -18
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/control/control.d.ts +10 -0
- package/dist/inputs/control/control.d.ts.map +1 -0
- package/dist/inputs/control/control.js +17 -0
- package/dist/inputs/control/control.js.map +1 -0
- package/dist/inputs/control_set/control_set.d.ts +5 -0
- package/dist/inputs/control_set/control_set.d.ts.map +1 -0
- package/dist/inputs/control_set/control_set.js +20 -0
- package/dist/inputs/{input_group/input_group.js.map → control_set/control_set.js.map} +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +20 -20
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/index.d.ts +2 -1
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/index.js +27 -24
- package/dist/inputs/index.js.map +1 -1
- package/dist/inputs/input/input.js +6 -6
- package/dist/inputs/input/input.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js +15 -15
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +2 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +45 -43
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +21 -21
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -1
- package/dist/inputs/phone_number_input/sip_input.d.ts +2 -1
- package/dist/inputs/phone_number_input/sip_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/sip_input.js +51 -49
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -1
- package/dist/inputs/select/select.js +6 -6
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/textarea/textarea.js +8 -8
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +20 -20
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/body/body.d.ts +17 -0
- package/dist/layouts/body/body.d.ts.map +1 -1
- package/dist/layouts/body/body.js +11 -12
- package/dist/layouts/body/body.js.map +1 -1
- package/dist/layouts/index.d.ts +1 -2
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +38 -40
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/scaffold/scaffold.js +1 -1
- package/dist/layouts/scaffold/scaffold.js.map +1 -1
- package/dist/layouts/section/section.d.ts.map +1 -1
- package/dist/layouts/section/section.js +14 -13
- package/dist/layouts/section/section.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts +2 -2
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +67 -59
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/slide/slide.d.ts +9 -0
- package/dist/overlay/slide/slide.d.ts.map +1 -0
- package/dist/overlay/slide/slide.js +29 -0
- package/dist/overlay/slide/slide.js.map +1 -0
- package/dist/page.css +1 -1
- package/dist/slide.css +1 -0
- package/dist/surfaces/aside/aside.d.ts +5 -0
- package/dist/surfaces/aside/aside.d.ts.map +1 -0
- package/dist/surfaces/aside/aside.js +19 -0
- package/dist/surfaces/aside/aside.js.map +1 -0
- package/dist/surfaces/drawers/drawer.d.ts +5 -0
- package/dist/surfaces/drawers/drawer.d.ts.map +1 -0
- package/dist/surfaces/drawers/drawer.js +31 -0
- package/dist/surfaces/drawers/drawer.js.map +1 -0
- package/dist/surfaces/index.d.ts +3 -6
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +20 -26
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts +1 -1
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +22 -14
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/page/page.d.ts +5 -0
- package/dist/surfaces/page/page.d.ts.map +1 -0
- package/dist/surfaces/page/page.js +19 -0
- package/dist/surfaces/page/page.js.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.js +23 -16
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/window/window.d.ts +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +27 -19
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/stylesheets/reset.css +1 -1
- package/dist/themes/stylesheets/reset.js +2 -2
- package/dist/themes/stylesheets/reset.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +134 -44
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -1
- package/package.json +2 -2
- package/src/inputs/color_input/color_input.tsx +3 -3
- package/src/inputs/control/control.stories.tsx +158 -0
- package/src/inputs/control/control.tsx +32 -0
- package/src/inputs/control/control_stories.module.css +7 -0
- package/src/inputs/control_set/control_set.stories.tsx +46 -0
- package/src/inputs/{input_group/input_group.tsx → control_set/control_set.tsx} +5 -5
- package/src/inputs/date_picker/date_picker_input.stories.tsx +1 -1
- package/src/inputs/date_picker/date_picker_input.tsx +1 -1
- package/src/inputs/index.ts +2 -1
- package/src/inputs/input/input.tsx +1 -1
- package/src/inputs/phone_number_input/phone_number_country_select_adapter.tsx +1 -1
- package/src/inputs/phone_number_input/phone_number_input.tsx +4 -1
- package/src/inputs/phone_number_input/phone_number_input_adapter.tsx +2 -2
- package/src/inputs/phone_number_input/sip_input.tsx +7 -4
- package/src/inputs/select/select.tsx +1 -1
- package/src/inputs/textarea/textarea.stories.tsx +1 -1
- package/src/inputs/textarea/textarea.tsx +1 -1
- package/src/inputs/unit_input/unit_input.tsx +3 -3
- package/src/layouts/__stories__/composed_stories.module.css +1 -7
- package/src/layouts/__stories__/rail.stories.tsx +20 -13
- package/src/layouts/__stories__/scaffold.stories.tsx +34 -22
- package/src/layouts/__stories__/utils.tsx +10 -7
- package/src/layouts/body/body.module.css +0 -8
- package/src/layouts/body/body.tsx +19 -3
- package/src/layouts/index.ts +1 -2
- package/src/layouts/scaffold/scaffold.tsx +1 -1
- package/src/layouts/section/section.tsx +2 -1
- package/src/overlay/frame/frame.tsx +13 -16
- package/src/overlay/slide/slide.module.css +30 -0
- package/src/overlay/slide/slide.stories.tsx +61 -0
- package/src/overlay/slide/slide.tsx +51 -0
- package/src/surfaces/aside/aside.module.css +5 -0
- package/src/surfaces/aside/aside.stories.tsx +75 -0
- package/src/surfaces/aside/aside.tsx +22 -0
- package/src/surfaces/card/card.stories.tsx +8 -5
- package/src/surfaces/card/card_stories.module.css +4 -2
- package/src/surfaces/drawers/drawer.stories.tsx +144 -0
- package/src/surfaces/drawers/drawer.tsx +30 -0
- package/src/surfaces/index.ts +3 -6
- package/src/surfaces/modal/__stories__/modal.stories.tsx +21 -4
- package/src/surfaces/modal/modal.tsx +5 -1
- package/src/surfaces/page/page.module.css +0 -6
- package/src/surfaces/page/page.stories.tsx +71 -0
- package/src/surfaces/page/page.tsx +22 -0
- package/src/surfaces/panel/__stories__/panel.stories.tsx +66 -60
- package/src/surfaces/pop_confirm/pop_confirm.stories.tsx +43 -31
- package/src/surfaces/pop_confirm/pop_confirm.tsx +5 -1
- package/src/surfaces/tooltip/__stories__/tooltip.stories.tsx +31 -0
- package/src/surfaces/window/window.stories.tsx +15 -4
- package/src/surfaces/window/window.tsx +5 -1
- package/src/themes/stylesheets/reset.css +2 -2
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_card.tsx +16 -15
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +6 -4
- package/src/themes/themes/ergo/ergo_theme.css +134 -44
- package/src/utils/dnd/hooks/use_drag_container.ts +0 -7
- package/dist/body.module-BbFZ7KNP.js +0 -5
- package/dist/body.module-BbFZ7KNP.js.map +0 -1
- package/dist/drawer_bottom.css +0 -1
- package/dist/drawer_end.css +0 -1
- package/dist/drawer_start.css +0 -1
- package/dist/drawer_top.css +0 -1
- package/dist/inputs/input_group/input_group.d.ts +0 -5
- package/dist/inputs/input_group/input_group.d.ts.map +0 -1
- package/dist/inputs/input_group/input_group.js +0 -20
- package/dist/layouts/body/h_body.d.ts +0 -6
- package/dist/layouts/body/h_body.d.ts.map +0 -1
- package/dist/layouts/body/h_body.js +0 -27
- package/dist/layouts/body/h_body.js.map +0 -1
- package/dist/layouts/body/v_body.d.ts +0 -6
- package/dist/layouts/body/v_body.d.ts.map +0 -1
- package/dist/layouts/body/v_body.js +0 -27
- package/dist/layouts/body/v_body.js.map +0 -1
- package/dist/page.module-DXhph-u6.js +0 -5
- package/dist/page.module-DXhph-u6.js.map +0 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.d.ts +0 -7
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.d.ts.map +0 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js +0 -22
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js.map +0 -1
- package/dist/surfaces/drawers/drawer_end/drawer_end.d.ts +0 -7
- package/dist/surfaces/drawers/drawer_end/drawer_end.d.ts.map +0 -1
- package/dist/surfaces/drawers/drawer_end/drawer_end.js +0 -20
- package/dist/surfaces/drawers/drawer_end/drawer_end.js.map +0 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.d.ts +0 -7
- package/dist/surfaces/drawers/drawer_start/drawer_start.d.ts.map +0 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.js +0 -22
- package/dist/surfaces/drawers/drawer_start/drawer_start.js.map +0 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.d.ts +0 -7
- package/dist/surfaces/drawers/drawer_top/drawer_top.d.ts.map +0 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.js +0 -20
- package/dist/surfaces/drawers/drawer_top/drawer_top.js.map +0 -1
- package/dist/surfaces/page/h_page.d.ts +0 -6
- package/dist/surfaces/page/h_page.d.ts.map +0 -1
- package/dist/surfaces/page/h_page.js +0 -22
- package/dist/surfaces/page/h_page.js.map +0 -1
- package/dist/surfaces/page/v_page.d.ts +0 -6
- package/dist/surfaces/page/v_page.d.ts.map +0 -1
- package/dist/surfaces/page/v_page.js +0 -21
- package/dist/surfaces/page/v_page.js.map +0 -1
- package/src/layouts/body/h_body.module.css +0 -7
- package/src/layouts/body/h_body.tsx +0 -28
- package/src/layouts/body/v_body.module.css +0 -7
- package/src/layouts/body/v_body.tsx +0 -28
- package/src/surfaces/drawers/__stories__/drawers.stories.tsx +0 -26
- package/src/surfaces/drawers/drawer_bottom/drawer_bottom.module.css +0 -5
- package/src/surfaces/drawers/drawer_bottom/drawer_bottom.tsx +0 -23
- package/src/surfaces/drawers/drawer_end/drawer_end.module.css +0 -5
- package/src/surfaces/drawers/drawer_end/drawer_end.tsx +0 -24
- package/src/surfaces/drawers/drawer_start/drawer_start.module.css +0 -5
- package/src/surfaces/drawers/drawer_start/drawer_start.tsx +0 -23
- package/src/surfaces/drawers/drawer_top/drawer_top.module.css +0 -5
- package/src/surfaces/drawers/drawer_top/drawer_top.tsx +0 -24
- package/src/surfaces/page/h_page.tsx +0 -23
- package/src/surfaces/page/v_page.tsx +0 -22
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import b from "react";
|
|
3
|
-
import { Select as
|
|
3
|
+
import { Select as I } from "../select/select.js";
|
|
4
4
|
import { Option as d } from "../options/option.js";
|
|
5
|
-
import
|
|
6
|
-
import { countriesPhoneInformation as
|
|
5
|
+
import P from "clsx";
|
|
6
|
+
import { countriesPhoneInformation as g } from "./countries_phone_information.js";
|
|
7
7
|
import { usePhoneContext as v } from "./phone_number_context.js";
|
|
8
|
-
const n = /* @__PURE__ */ new Map(),
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const n = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
9
|
+
g.forEach((r) => {
|
|
10
|
+
f.set(r.code, r), n.has(r.prefix) ? n.get(r.prefix)?.push(r) : n.set(r.prefix, [r]);
|
|
11
11
|
});
|
|
12
12
|
function F(r) {
|
|
13
13
|
for (let t = 5; t > 1; t--) {
|
|
@@ -18,7 +18,7 @@ function F(r) {
|
|
|
18
18
|
return i;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return f.get("US");
|
|
22
22
|
}
|
|
23
23
|
function U({
|
|
24
24
|
value: r,
|
|
@@ -29,21 +29,21 @@ function U({
|
|
|
29
29
|
"aria-label": l
|
|
30
30
|
}) {
|
|
31
31
|
const {
|
|
32
|
-
setValue:
|
|
33
|
-
sipAddress:
|
|
32
|
+
setValue: u,
|
|
33
|
+
sipAddress: p,
|
|
34
34
|
allowSip: h,
|
|
35
35
|
value: x,
|
|
36
36
|
setFocusNumberInput: c
|
|
37
37
|
} = v(), S = b.useCallback(
|
|
38
38
|
(e) => {
|
|
39
39
|
if (e === "SIP") {
|
|
40
|
-
|
|
40
|
+
u(`sip:${p}`), c(!0);
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
t(e === "ZZ" ? void 0 : e);
|
|
44
44
|
},
|
|
45
|
-
[t,
|
|
46
|
-
), m = s.filter((e) => !e.divider).map((e) =>
|
|
45
|
+
[t, p, u, c]
|
|
46
|
+
), m = s.filter((e) => !e.divider).map((e) => f.get(e.value || "ZZ")).filter((e) => e != null).sort((e, Z) => e.code === "US" ? -1 : Number(e.prefix) - Number(Z.prefix)).map((e) => /* @__PURE__ */ a(
|
|
47
47
|
d,
|
|
48
48
|
{
|
|
49
49
|
value: e?.code || "ZZ",
|
|
@@ -56,13 +56,13 @@ function U({
|
|
|
56
56
|
return (h || x?.startsWith("sip:")) && m.unshift(
|
|
57
57
|
/* @__PURE__ */ a(d, { value: "SIP", label: "sip:", keywords: ["sip"], children: "SIP" }, "SIP")
|
|
58
58
|
), /* @__PURE__ */ a(
|
|
59
|
-
|
|
59
|
+
I,
|
|
60
60
|
{
|
|
61
61
|
value: r || "ZZ",
|
|
62
62
|
onChange: S,
|
|
63
63
|
disabled: o,
|
|
64
64
|
"aria-label": l ?? "Country",
|
|
65
|
-
className:
|
|
65
|
+
className: P(i, "tcn-control-set-item"),
|
|
66
66
|
width: "auto",
|
|
67
67
|
children: m
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ function U({
|
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
72
72
|
U as PhoneNumberCountrySelectAdapter,
|
|
73
|
-
|
|
73
|
+
f as countryCodeMap,
|
|
74
74
|
n as countryPrefixMap,
|
|
75
75
|
F as getCountryFromValue
|
|
76
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_country_select_adapter.js","sources":["../../../src/inputs/phone_number_input/phone_number_country_select_adapter.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '../select/select.js';\nimport { Option } from '../options/option.js';\nimport clsx from 'clsx';\nimport {\n countriesPhoneInformation,\n CountryPhoneInformation,\n} from './countries_phone_information.js';\nimport { usePhoneContext } from './phone_number_context.js';\n\nexport const countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nexport const countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nexport function getCountryFromValue(value: string) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(c => c.code === 'US');\n\n if (countryInformation != null) {\n return countryInformation;\n }\n }\n }\n\n return countryCodeMap.get('US');\n}\n\nexport interface CountryOption {\n value?: string;\n label?: string;\n divider?: boolean;\n}\n\nexport interface CountrySelectProps {\n value?: string;\n onChange: (value?: string) => void;\n options: CountryOption[];\n disabled?: boolean;\n className?: string;\n 'aria-label'?: string;\n}\n\nexport function PhoneNumberCountrySelectAdapter({\n value,\n onChange,\n options,\n disabled,\n className,\n 'aria-label': ariaLabel,\n}: CountrySelectProps) {\n const {\n setValue,\n sipAddress,\n allowSip,\n value: phoneValue,\n setFocusNumberInput,\n } = usePhoneContext();\n\n const handleChange = React.useCallback(\n (newValue: string) => {\n if (newValue === 'SIP') {\n setValue(`sip:${sipAddress}`);\n setFocusNumberInput(true);\n return;\n }\n\n onChange(newValue === 'ZZ' ? undefined : newValue);\n },\n [onChange, sipAddress, setValue, setFocusNumberInput]\n );\n\n const items = options\n .filter(opt => !opt.divider)\n .map(opt => countryCodeMap.get(opt.value || 'ZZ'))\n .filter(country => country != null)\n .sort((a, b) => {\n if (a.code === 'US') {\n return -1;\n }\n return Number(a.prefix) - Number(b.prefix);\n })\n .map(country => {\n return (\n <Option\n key={country?.code || 'ZZ'}\n value={country?.code || 'ZZ'}\n label={country.prefix || ''}\n keywords={country.keywords}\n >\n {`${country.prefix} (${country.code}) ${country.unicodeFlag}`}\n </Option>\n );\n });\n\n if (allowSip || phoneValue?.startsWith('sip:')) {\n items.unshift(\n <Option key=\"SIP\" value=\"SIP\" label=\"sip:\" keywords={['sip']}>\n SIP\n </Option>\n );\n }\n\n return (\n <Select\n value={value || 'ZZ'}\n onChange={handleChange}\n disabled={disabled}\n aria-label={ariaLabel ?? 'Country'}\n className={clsx(className, 'tcn-
|
|
1
|
+
{"version":3,"file":"phone_number_country_select_adapter.js","sources":["../../../src/inputs/phone_number_input/phone_number_country_select_adapter.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '../select/select.js';\nimport { Option } from '../options/option.js';\nimport clsx from 'clsx';\nimport {\n countriesPhoneInformation,\n CountryPhoneInformation,\n} from './countries_phone_information.js';\nimport { usePhoneContext } from './phone_number_context.js';\n\nexport const countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nexport const countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nexport function getCountryFromValue(value: string) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(c => c.code === 'US');\n\n if (countryInformation != null) {\n return countryInformation;\n }\n }\n }\n\n return countryCodeMap.get('US');\n}\n\nexport interface CountryOption {\n value?: string;\n label?: string;\n divider?: boolean;\n}\n\nexport interface CountrySelectProps {\n value?: string;\n onChange: (value?: string) => void;\n options: CountryOption[];\n disabled?: boolean;\n className?: string;\n 'aria-label'?: string;\n}\n\nexport function PhoneNumberCountrySelectAdapter({\n value,\n onChange,\n options,\n disabled,\n className,\n 'aria-label': ariaLabel,\n}: CountrySelectProps) {\n const {\n setValue,\n sipAddress,\n allowSip,\n value: phoneValue,\n setFocusNumberInput,\n } = usePhoneContext();\n\n const handleChange = React.useCallback(\n (newValue: string) => {\n if (newValue === 'SIP') {\n setValue(`sip:${sipAddress}`);\n setFocusNumberInput(true);\n return;\n }\n\n onChange(newValue === 'ZZ' ? undefined : newValue);\n },\n [onChange, sipAddress, setValue, setFocusNumberInput]\n );\n\n const items = options\n .filter(opt => !opt.divider)\n .map(opt => countryCodeMap.get(opt.value || 'ZZ'))\n .filter(country => country != null)\n .sort((a, b) => {\n if (a.code === 'US') {\n return -1;\n }\n return Number(a.prefix) - Number(b.prefix);\n })\n .map(country => {\n return (\n <Option\n key={country?.code || 'ZZ'}\n value={country?.code || 'ZZ'}\n label={country.prefix || ''}\n keywords={country.keywords}\n >\n {`${country.prefix} (${country.code}) ${country.unicodeFlag}`}\n </Option>\n );\n });\n\n if (allowSip || phoneValue?.startsWith('sip:')) {\n items.unshift(\n <Option key=\"SIP\" value=\"SIP\" label=\"sip:\" keywords={['sip']}>\n SIP\n </Option>\n );\n }\n\n return (\n <Select\n value={value || 'ZZ'}\n onChange={handleChange}\n disabled={disabled}\n aria-label={ariaLabel ?? 'Country'}\n className={clsx(className, 'tcn-control-set-item')}\n width=\"auto\"\n >\n {items}\n </Select>\n );\n}\n"],"names":["countryPrefixMap","countryCodeMap","countriesPhoneInformation","i","getCountryFromValue","value","x","prefix","countriesInformation","countryInformation","c","PhoneNumberCountrySelectAdapter","onChange","options","disabled","className","ariaLabel","setValue","sipAddress","allowSip","phoneValue","setFocusNumberInput","usePhoneContext","handleChange","React","newValue","items","opt","country","a","b","jsx","Option","Select","clsx"],"mappings":";;;;;;;AAUO,MAAMA,wBAA+D,IAAA,GAC/DC,wBAA2D,IAAA;AACxEC,EAA0B,QAAQ,CAAAC,MAAK;AACrC,EAAAF,EAAe,IAAIE,EAAE,MAAMA,CAAC,GACxBH,EAAiB,IAAIG,EAAE,MAAM,IAC/BH,EAAiB,IAAIG,EAAE,MAAM,GAAG,KAAKA,CAAC,IAEtCH,EAAiB,IAAIG,EAAE,QAAQ,CAACA,CAAC,CAAC;AAEtC,CAAC;AAEM,SAASC,EAAoBC,GAAe;AACjD,WAASC,IAAI,GAAGA,IAAI,GAAGA,KAAK;AAC1B,UAAMC,IAASF,EAAM,MAAM,GAAGC,CAAC,GACzBE,IAAuBR,EAAiB,IAAIO,CAAM;AAExD,QAAIC,KAAwB,MAAM;AAChC,YAAMC,IAAqBD,EAAqB,KAAK,CAAAE,MAAKA,EAAE,SAAS,IAAI;AAEzE,UAAID,KAAsB;AACxB,eAAOA;AAAA,IAEX;AAAA,EACF;AAEA,SAAOR,EAAe,IAAI,IAAI;AAChC;AAiBO,SAASU,EAAgC;AAAA,EAC9C,OAAAN;AAAA,EACA,UAAAO;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAcC;AAChB,GAAuB;AACrB,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAOC;AAAA,IACP,qBAAAC;AAAA,EAAA,IACEC,EAAA,GAEEC,IAAeC,EAAM;AAAA,IACzB,CAACC,MAAqB;AACpB,UAAIA,MAAa,OAAO;AACtB,QAAAR,EAAS,OAAOC,CAAU,EAAE,GAC5BG,EAAoB,EAAI;AACxB;AAAA,MACF;AAEA,MAAAT,EAASa,MAAa,OAAO,SAAYA,CAAQ;AAAA,IACnD;AAAA,IACA,CAACb,GAAUM,GAAYD,GAAUI,CAAmB;AAAA,EAAA,GAGhDK,IAAQb,EACX,OAAO,CAAAc,MAAO,CAACA,EAAI,OAAO,EAC1B,IAAI,CAAAA,MAAO1B,EAAe,IAAI0B,EAAI,SAAS,IAAI,CAAC,EAChD,OAAO,CAAAC,MAAWA,KAAW,IAAI,EACjC,KAAK,CAACC,GAAGC,MACJD,EAAE,SAAS,OACN,KAEF,OAAOA,EAAE,MAAM,IAAI,OAAOC,EAAE,MAAM,CAC1C,EACA,IAAI,CAAAF,MAED,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,OAAOJ,GAAS,QAAQ;AAAA,MACxB,OAAOA,EAAQ,UAAU;AAAA,MACzB,UAAUA,EAAQ;AAAA,MAEjB,UAAA,GAAGA,EAAQ,MAAM,KAAKA,EAAQ,IAAI,KAAKA,EAAQ,WAAW;AAAA,IAAA;AAAA,IALtDA,GAAS,QAAQ;AAAA,EAAA,CAQ3B;AAEH,UAAIT,KAAYC,GAAY,WAAW,MAAM,MAC3CM,EAAM;AAAA,IACJ,gBAAAK,EAACC,GAAA,EAAiB,OAAM,OAAM,OAAM,QAAO,UAAU,CAAC,KAAK,GAAG,UAAA,MAAA,GAAlD,KAEZ;AAAA,EAAA,GAKF,gBAAAD;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAO5B,KAAS;AAAA,MAChB,UAAUkB;AAAA,MACV,UAAAT;AAAA,MACA,cAAYE,KAAa;AAAA,MACzB,WAAWkB,EAAKnB,GAAW,sBAAsB;AAAA,MACjD,OAAM;AAAA,MAEL,UAAAW;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -5,6 +5,7 @@ import { OptionProps } from '../options/option.js';
|
|
|
5
5
|
export interface PhoneNumberInputProps extends Omit<HStackProps, 'onChange' | 'children'> {
|
|
6
6
|
value?: string;
|
|
7
7
|
allowSip?: boolean;
|
|
8
|
+
sipAutoComplete?: string;
|
|
8
9
|
onChange: (value?: string) => void;
|
|
9
10
|
defaultCountry?: string;
|
|
10
11
|
allowedCountryCodes?: string[];
|
|
@@ -21,5 +22,5 @@ export interface PhoneNumberInputProps extends Omit<HStackProps, 'onChange' | 'c
|
|
|
21
22
|
ariaPhoneBookButtonLabel?: string;
|
|
22
23
|
children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];
|
|
23
24
|
}
|
|
24
|
-
export declare function PhoneNumberInput({ value, allowSip, onChange, defaultCountry, allowedCountryCodes: countries, disabled, name, 'aria-label': ariaLabel, autoFocus, placeholder, onCountryChange, limitMaxLength, ariaSelectLabel, ariaPhoneBookButtonLabel, children, ...props }: PhoneNumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function PhoneNumberInput({ value, allowSip, onChange, defaultCountry, allowedCountryCodes: countries, disabled, name, 'aria-label': ariaLabel, autoFocus, placeholder, onCountryChange, limitMaxLength, ariaSelectLabel, ariaPhoneBookButtonLabel, sipAutoComplete, children, ...props }: PhoneNumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
//# sourceMappingURL=phone_number_input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,sBAAsB,CAAC;AAMhE,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;CAChF;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAU,EACV,QAAe,EACf,QAAQ,EACR,cAAqB,EACrB,mBAAmB,EAAE,SAAS,EAC9B,QAAQ,EACR,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,sBAAsB,CAAC;AAMhE,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;CAChF;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAU,EACV,QAAe,EACf,QAAQ,EACR,cAAqB,EACrB,mBAAmB,EAAE,SAAS,EAC9B,QAAQ,EACR,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA6GvB"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import e, { useLayoutEffect as x } from "react";
|
|
3
|
-
import
|
|
3
|
+
import B from "react-phone-number-input";
|
|
4
4
|
import "react-phone-number-input/style.css";
|
|
5
|
-
import { HStack as
|
|
5
|
+
import { HStack as H } from "../../stacks/h_stack.js";
|
|
6
6
|
import { PhoneBookProvider as _ } from "./phone_number_context.js";
|
|
7
|
-
import { PhoneNumberCountrySelectAdapter as
|
|
8
|
-
import { Option as
|
|
9
|
-
import { PhoneNumberInputAdapter as
|
|
10
|
-
import { clsx as
|
|
11
|
-
import { SipInput as
|
|
12
|
-
import { defaultCountries as
|
|
13
|
-
import '../../phone_number_input.css';const
|
|
14
|
-
function
|
|
7
|
+
import { PhoneNumberCountrySelectAdapter as L } from "./phone_number_country_select_adapter.js";
|
|
8
|
+
import { Option as R } from "../options/option.js";
|
|
9
|
+
import { PhoneNumberInputAdapter as U } from "./phone_number_input_adapter.js";
|
|
10
|
+
import { clsx as W } from "clsx";
|
|
11
|
+
import { SipInput as q } from "./sip_input.js";
|
|
12
|
+
import { defaultCountries as z } from "./countries_phone_information.js";
|
|
13
|
+
import '../../phone_number_input.css';const D = "_phone-number-input_5c4483d", F = { "phone-number-input": D };
|
|
14
|
+
function et({
|
|
15
15
|
value: t = "",
|
|
16
16
|
allowSip: m = !0,
|
|
17
17
|
onChange: n,
|
|
18
18
|
defaultCountry: k = "US",
|
|
19
|
-
allowedCountryCodes:
|
|
20
|
-
disabled:
|
|
19
|
+
allowedCountryCodes: s,
|
|
20
|
+
disabled: p,
|
|
21
21
|
name: i,
|
|
22
22
|
"aria-label": f,
|
|
23
23
|
autoFocus: c,
|
|
@@ -26,21 +26,22 @@ function tt({
|
|
|
26
26
|
limitMaxLength: V,
|
|
27
27
|
ariaSelectLabel: l,
|
|
28
28
|
ariaPhoneBookButtonLabel: d,
|
|
29
|
+
sipAutoComplete: E,
|
|
29
30
|
children: h,
|
|
30
|
-
...
|
|
31
|
+
...M
|
|
31
32
|
}) {
|
|
32
|
-
const [
|
|
33
|
-
|
|
34
|
-
), [I,
|
|
33
|
+
const [u, b] = e.useState(!1), o = t?.toLocaleLowerCase().startsWith("sip:") || !1, [y, j] = e.useState(o ? "" : t), [N, C] = e.useState(
|
|
34
|
+
o ? t?.substring(4).trim() : ""
|
|
35
|
+
), [I, w] = e.useState(
|
|
35
36
|
k
|
|
36
37
|
);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
}, [
|
|
38
|
+
s = s || z, x(() => {
|
|
39
|
+
o && C(t?.substring(4).trim() || "");
|
|
40
|
+
}, [o, t]), x(() => {
|
|
41
|
+
u && b(!1);
|
|
42
|
+
}, [u]);
|
|
42
43
|
const S = e.useMemo(() => e.Children.toArray(h).filter(
|
|
43
|
-
(P) => e.isValidElement(P) && P.type ===
|
|
44
|
+
(P) => e.isValidElement(P) && P.type === R
|
|
44
45
|
), [h]), A = e.useMemo(() => ({
|
|
45
46
|
value: t,
|
|
46
47
|
allowSip: m,
|
|
@@ -48,13 +49,13 @@ function tt({
|
|
|
48
49
|
setValue: n,
|
|
49
50
|
ariaPhoneBookButtonLabel: d,
|
|
50
51
|
ariaSelectLabel: l,
|
|
51
|
-
disabled:
|
|
52
|
-
setCountry:
|
|
52
|
+
disabled: p,
|
|
53
|
+
setCountry: w,
|
|
53
54
|
sipAddress: N,
|
|
54
55
|
setSipAddress: C,
|
|
55
56
|
cachedNumber: y,
|
|
56
|
-
setCachedNumber:
|
|
57
|
-
focusNumberInput:
|
|
57
|
+
setCachedNumber: j,
|
|
58
|
+
focusNumberInput: u,
|
|
58
59
|
setFocusNumberInput: b
|
|
59
60
|
}), [
|
|
60
61
|
t,
|
|
@@ -63,43 +64,44 @@ function tt({
|
|
|
63
64
|
n,
|
|
64
65
|
d,
|
|
65
66
|
l,
|
|
66
|
-
|
|
67
|
+
p,
|
|
67
68
|
N,
|
|
68
69
|
y,
|
|
69
|
-
|
|
70
|
+
u
|
|
70
71
|
]);
|
|
71
|
-
return
|
|
72
|
-
|
|
72
|
+
return o ? /* @__PURE__ */ r(_, { value: A, children: /* @__PURE__ */ r(
|
|
73
|
+
q,
|
|
73
74
|
{
|
|
74
75
|
onChange: n,
|
|
75
|
-
disabled:
|
|
76
|
+
disabled: p,
|
|
76
77
|
name: i,
|
|
77
78
|
"aria-label": f,
|
|
78
79
|
autoFocus: c,
|
|
79
80
|
placeholder: a,
|
|
80
|
-
countries:
|
|
81
|
+
countries: s,
|
|
82
|
+
sipAutoComplete: E
|
|
81
83
|
}
|
|
82
|
-
) }) : /* @__PURE__ */
|
|
83
|
-
|
|
84
|
+
) }) : /* @__PURE__ */ r(_, { value: A, children: /* @__PURE__ */ r(H, { ...M, children: /* @__PURE__ */ r(
|
|
85
|
+
B,
|
|
84
86
|
{
|
|
85
87
|
value: t,
|
|
86
88
|
onChange: n,
|
|
87
89
|
defaultCountry: I,
|
|
88
90
|
country: I,
|
|
89
|
-
countries:
|
|
90
|
-
countrySelectComponent:
|
|
91
|
-
inputComponent:
|
|
92
|
-
disabled:
|
|
91
|
+
countries: s,
|
|
92
|
+
countrySelectComponent: L,
|
|
93
|
+
inputComponent: U,
|
|
94
|
+
disabled: p,
|
|
93
95
|
name: i,
|
|
94
96
|
"aria-label": f,
|
|
95
97
|
autoFocus: c,
|
|
96
98
|
placeholder: a,
|
|
97
99
|
onCountryChange: O,
|
|
98
100
|
limitMaxLength: V,
|
|
99
|
-
className:
|
|
100
|
-
|
|
101
|
+
className: W(
|
|
102
|
+
F["phone-number-input"],
|
|
101
103
|
"tcn-phone-number-input",
|
|
102
|
-
"tcn-
|
|
104
|
+
"tcn-control-set"
|
|
103
105
|
),
|
|
104
106
|
displayInitialValueAsLocalNumber: !0,
|
|
105
107
|
addInternationalOption: !1
|
|
@@ -107,6 +109,6 @@ function tt({
|
|
|
107
109
|
) }) });
|
|
108
110
|
}
|
|
109
111
|
export {
|
|
110
|
-
|
|
112
|
+
et as PhoneNumberInput
|
|
111
113
|
};
|
|
112
114
|
//# sourceMappingURL=phone_number_input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import React, { useLayoutEffect } from 'react';\nimport PhoneInput from 'react-phone-number-input';\nimport 'react-phone-number-input/style.css';\nimport type { CountryCode } from 'libphonenumber-js';\nimport { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport styles from './phone_number_input.module.css';\nimport { PhoneBookProvider, type PhoneContext } from './phone_number_context.js';\nimport { PhoneNumberCountrySelectAdapter } from './phone_number_country_select_adapter.js';\nimport { type OptionProps, Option } from '../options/option.js';\nimport { PhoneNumberInputAdapter } from './phone_number_input_adapter.js';\nimport { clsx } from 'clsx';\nimport { SipInput } from './sip_input.js';\nimport { defaultCountries } from './countries_phone_information.js';\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n allowSip?: boolean;\n onChange: (value?: string) => void;\n defaultCountry?: string;\n allowedCountryCodes?: string[];\n disabled?: boolean;\n name?: string;\n 'aria-label'?: string;\n autoFocus?: boolean;\n placeholder?: string;\n className?: string;\n width?: string;\n onCountryChange?: (country: CountryCode) => void;\n limitMaxLength?: boolean;\n ariaSelectLabel?: string;\n ariaPhoneBookButtonLabel?: string;\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport function PhoneNumberInput({\n value = '',\n allowSip = true,\n onChange,\n defaultCountry = 'US',\n allowedCountryCodes: countries,\n disabled,\n name,\n 'aria-label': ariaLabel,\n autoFocus,\n placeholder,\n onCountryChange,\n limitMaxLength,\n ariaSelectLabel,\n ariaPhoneBookButtonLabel,\n children,\n ...props\n}: PhoneNumberInputProps) {\n const [focusNumberInput, setFocusNumberInput] = React.useState<boolean>(false);\n const isSip = value?.toLocaleLowerCase().startsWith('sip:') || false;\n const [cachedNumber, setCachedNumber] = React.useState<string>(isSip ? '' : value);\n const [sipAddress, setSipAddress] = React.useState<string>(\n isSip ? value?.substring(4).trim() : ''\n );\n const [country, setCountry] = React.useState<CountryCode | undefined>(\n defaultCountry as CountryCode\n );\n\n countries = countries || defaultCountries;\n\n useLayoutEffect(() => {\n if (isSip) {\n setSipAddress(value?.substring(4).trim() || '');\n }\n }, [isSip, value]);\n\n useLayoutEffect(() => {\n if (focusNumberInput) {\n setFocusNumberInput(false);\n }\n }, [focusNumberInput]);\n\n // Extract valid Option components from children\n const phoneBookOptions = React.useMemo(() => {\n return React.Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n React.isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const phoneContext = React.useMemo<PhoneContext>(() => {\n return {\n value,\n allowSip,\n phoneBook: phoneBookOptions,\n setValue: onChange,\n ariaPhoneBookButtonLabel,\n ariaSelectLabel,\n disabled,\n setCountry,\n sipAddress,\n setSipAddress,\n cachedNumber,\n setCachedNumber,\n focusNumberInput,\n setFocusNumberInput,\n };\n }, [\n value,\n allowSip,\n phoneBookOptions,\n onChange,\n ariaPhoneBookButtonLabel,\n ariaSelectLabel,\n disabled,\n sipAddress,\n cachedNumber,\n focusNumberInput,\n ]);\n\n if (isSip) {\n return (\n <PhoneBookProvider value={phoneContext}>\n <SipInput\n onChange={onChange}\n disabled={disabled}\n name={name}\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n placeholder={placeholder}\n countries={countries as CountryCode[]}\n />\n </PhoneBookProvider>\n );\n }\n\n return (\n <PhoneBookProvider value={phoneContext}>\n <HStack {...props}>\n <PhoneInput\n value={value}\n onChange={onChange}\n defaultCountry={country}\n country={country}\n countries={countries as CountryCode[]}\n countrySelectComponent={PhoneNumberCountrySelectAdapter}\n inputComponent={PhoneNumberInputAdapter}\n disabled={disabled}\n name={name}\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n placeholder={placeholder}\n onCountryChange={onCountryChange}\n limitMaxLength={limitMaxLength}\n className={clsx(\n styles['phone-number-input'],\n 'tcn-phone-number-input',\n 'tcn-
|
|
1
|
+
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import React, { useLayoutEffect } from 'react';\nimport PhoneInput from 'react-phone-number-input';\nimport 'react-phone-number-input/style.css';\nimport type { CountryCode } from 'libphonenumber-js';\nimport { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport styles from './phone_number_input.module.css';\nimport { PhoneBookProvider, type PhoneContext } from './phone_number_context.js';\nimport { PhoneNumberCountrySelectAdapter } from './phone_number_country_select_adapter.js';\nimport { type OptionProps, Option } from '../options/option.js';\nimport { PhoneNumberInputAdapter } from './phone_number_input_adapter.js';\nimport { clsx } from 'clsx';\nimport { SipInput } from './sip_input.js';\nimport { defaultCountries } from './countries_phone_information.js';\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n allowSip?: boolean;\n sipAutoComplete?: string;\n onChange: (value?: string) => void;\n defaultCountry?: string;\n allowedCountryCodes?: string[];\n disabled?: boolean;\n name?: string;\n 'aria-label'?: string;\n autoFocus?: boolean;\n placeholder?: string;\n className?: string;\n width?: string;\n onCountryChange?: (country: CountryCode) => void;\n limitMaxLength?: boolean;\n ariaSelectLabel?: string;\n ariaPhoneBookButtonLabel?: string;\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport function PhoneNumberInput({\n value = '',\n allowSip = true,\n onChange,\n defaultCountry = 'US',\n allowedCountryCodes: countries,\n disabled,\n name,\n 'aria-label': ariaLabel,\n autoFocus,\n placeholder,\n onCountryChange,\n limitMaxLength,\n ariaSelectLabel,\n ariaPhoneBookButtonLabel,\n sipAutoComplete,\n children,\n ...props\n}: PhoneNumberInputProps) {\n const [focusNumberInput, setFocusNumberInput] = React.useState<boolean>(false);\n const isSip = value?.toLocaleLowerCase().startsWith('sip:') || false;\n const [cachedNumber, setCachedNumber] = React.useState<string>(isSip ? '' : value);\n const [sipAddress, setSipAddress] = React.useState<string>(\n isSip ? value?.substring(4).trim() : ''\n );\n const [country, setCountry] = React.useState<CountryCode | undefined>(\n defaultCountry as CountryCode\n );\n\n countries = countries || defaultCountries;\n\n useLayoutEffect(() => {\n if (isSip) {\n setSipAddress(value?.substring(4).trim() || '');\n }\n }, [isSip, value]);\n\n useLayoutEffect(() => {\n if (focusNumberInput) {\n setFocusNumberInput(false);\n }\n }, [focusNumberInput]);\n\n // Extract valid Option components from children\n const phoneBookOptions = React.useMemo(() => {\n return React.Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n React.isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const phoneContext = React.useMemo<PhoneContext>(() => {\n return {\n value,\n allowSip,\n phoneBook: phoneBookOptions,\n setValue: onChange,\n ariaPhoneBookButtonLabel,\n ariaSelectLabel,\n disabled,\n setCountry,\n sipAddress,\n setSipAddress,\n cachedNumber,\n setCachedNumber,\n focusNumberInput,\n setFocusNumberInput,\n };\n }, [\n value,\n allowSip,\n phoneBookOptions,\n onChange,\n ariaPhoneBookButtonLabel,\n ariaSelectLabel,\n disabled,\n sipAddress,\n cachedNumber,\n focusNumberInput,\n ]);\n\n if (isSip) {\n return (\n <PhoneBookProvider value={phoneContext}>\n <SipInput\n onChange={onChange}\n disabled={disabled}\n name={name}\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n placeholder={placeholder}\n countries={countries as CountryCode[]}\n sipAutoComplete={sipAutoComplete}\n />\n </PhoneBookProvider>\n );\n }\n\n return (\n <PhoneBookProvider value={phoneContext}>\n <HStack {...props}>\n <PhoneInput\n value={value}\n onChange={onChange}\n defaultCountry={country}\n country={country}\n countries={countries as CountryCode[]}\n countrySelectComponent={PhoneNumberCountrySelectAdapter}\n inputComponent={PhoneNumberInputAdapter}\n disabled={disabled}\n name={name}\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n placeholder={placeholder}\n onCountryChange={onCountryChange}\n limitMaxLength={limitMaxLength}\n className={clsx(\n styles['phone-number-input'],\n 'tcn-phone-number-input',\n 'tcn-control-set'\n )}\n displayInitialValueAsLocalNumber\n addInternationalOption={false}\n />\n </HStack>\n </PhoneBookProvider>\n );\n}\n"],"names":["PhoneNumberInput","value","allowSip","onChange","defaultCountry","countries","disabled","name","ariaLabel","autoFocus","placeholder","onCountryChange","limitMaxLength","ariaSelectLabel","ariaPhoneBookButtonLabel","sipAutoComplete","children","props","focusNumberInput","setFocusNumberInput","React","isSip","cachedNumber","setCachedNumber","sipAddress","setSipAddress","country","setCountry","defaultCountries","useLayoutEffect","phoneBookOptions","child","Option","phoneContext","jsx","PhoneBookProvider","SipInput","HStack","PhoneInput","PhoneNumberCountrySelectAdapter","PhoneNumberInputAdapter","clsx","styles"],"mappings":";;;;;;;;;;;;;AAoCO,SAASA,GAAiB;AAAA,EAC/B,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,qBAAqBC;AAAA,EACrB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAA0B;AACxB,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAM,SAAkB,EAAK,GACvEC,IAAQpB,GAAO,kBAAA,EAAoB,WAAW,MAAM,KAAK,IACzD,CAACqB,GAAcC,CAAe,IAAIH,EAAM,SAAiBC,IAAQ,KAAKpB,CAAK,GAC3E,CAACuB,GAAYC,CAAa,IAAIL,EAAM;AAAA,IACxCC,IAAQpB,GAAO,UAAU,CAAC,EAAE,SAAS;AAAA,EAAA,GAEjC,CAACyB,GAASC,CAAU,IAAIP,EAAM;AAAA,IAClChB;AAAA,EAAA;AAGF,EAAAC,IAAYA,KAAauB,GAEzBC,EAAgB,MAAM;AACpB,IAAIR,KACFI,EAAcxB,GAAO,UAAU,CAAC,EAAE,KAAA,KAAU,EAAE;AAAA,EAElD,GAAG,CAACoB,GAAOpB,CAAK,CAAC,GAEjB4B,EAAgB,MAAM;AACpB,IAAIX,KACFC,EAAoB,EAAK;AAAA,EAE7B,GAAG,CAACD,CAAgB,CAAC;AAGrB,QAAMY,IAAmBV,EAAM,QAAQ,MAC9BA,EAAM,SAAS,QAAQJ,CAAQ,EAAE;AAAA,IACtC,CAACe,MACCX,EAAM,eAAeW,CAAK,KAAKA,EAAM,SAASC;AAAA,EAAA,GAEjD,CAAChB,CAAQ,CAAC,GAEPiB,IAAeb,EAAM,QAAsB,OACxC;AAAA,IACL,OAAAnB;AAAA,IACA,UAAAC;AAAA,IACA,WAAW4B;AAAA,IACX,UAAU3B;AAAA,IACV,0BAAAW;AAAA,IACA,iBAAAD;AAAA,IACA,UAAAP;AAAA,IACA,YAAAqB;AAAA,IACA,YAAAH;AAAA,IACA,eAAAC;AAAA,IACA,cAAAH;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAL;AAAA,IACA,qBAAAC;AAAA,EAAA,IAED;AAAA,IACDlB;AAAA,IACAC;AAAA,IACA4B;AAAA,IACA3B;AAAA,IACAW;AAAA,IACAD;AAAA,IACAP;AAAA,IACAkB;AAAA,IACAF;AAAA,IACAJ;AAAA,EAAA,CACD;AAED,SAAIG,IAEA,gBAAAa,EAACC,GAAA,EAAkB,OAAOF,GACxB,UAAA,gBAAAC;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,UAAAjC;AAAA,MACA,UAAAG;AAAA,MACA,MAAAC;AAAA,MACA,cAAYC;AAAA,MACZ,WAAAC;AAAA,MACA,aAAAC;AAAA,MACA,WAAAL;AAAA,MACA,iBAAAU;AAAA,IAAA;AAAA,EAAA,GAEJ,sBAKDoB,GAAA,EAAkB,OAAOF,GACxB,UAAA,gBAAAC,EAACG,GAAA,EAAQ,GAAGpB,GACV,UAAA,gBAAAiB;AAAA,IAACI;AAAA,IAAA;AAAA,MACC,OAAArC;AAAA,MACA,UAAAE;AAAA,MACA,gBAAgBuB;AAAA,MAChB,SAAAA;AAAA,MACA,WAAArB;AAAA,MACA,wBAAwBkC;AAAA,MACxB,gBAAgBC;AAAA,MAChB,UAAAlC;AAAA,MACA,MAAAC;AAAA,MACA,cAAYC;AAAA,MACZ,WAAAC;AAAA,MACA,aAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,WAAW6B;AAAA,QACTC,EAAO,oBAAoB;AAAA,QAC3B;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,kCAAgC;AAAA,MAChC,wBAAwB;AAAA,IAAA;AAAA,EAAA,GAE5B,EAAA,CACF;AAEJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as S, Fragment as A, jsx as
|
|
1
|
+
import { jsxs as S, Fragment as A, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { NotebookIcon as C } from "@tcn/icons/notebook_icon.js";
|
|
3
3
|
import f from "clsx";
|
|
4
4
|
import { forwardRef as F, useState as R, useRef as y, useCallback as z, useLayoutEffect as E } from "react";
|
|
@@ -12,72 +12,72 @@ import { usePhoneContext as j } from "./phone_number_context.js";
|
|
|
12
12
|
import { getCountryFromValue as T } from "./phone_number_country_select_adapter.js";
|
|
13
13
|
import { Input as V } from "../input/input.js";
|
|
14
14
|
import { useForkRef as q } from "../../utils/hooks/use_fork_ref.js";
|
|
15
|
-
const to = F(function({ onChange:
|
|
15
|
+
const to = F(function({ onChange: n, value: t = "", className: a, ...h }, g) {
|
|
16
16
|
t = t.toString();
|
|
17
17
|
const [s, r] = R(
|
|
18
18
|
null
|
|
19
|
-
),
|
|
19
|
+
), c = s != null, u = y(null), d = q(g, u), {
|
|
20
20
|
phoneBook: l,
|
|
21
21
|
setValue: k,
|
|
22
22
|
ariaPhoneBookButtonLabel: b,
|
|
23
23
|
disabled: B,
|
|
24
24
|
setFocusNumberInput: P,
|
|
25
|
-
focusNumberInput:
|
|
25
|
+
focusNumberInput: m
|
|
26
26
|
} = j(), x = l.length > 0;
|
|
27
27
|
function I(o) {
|
|
28
|
-
r(
|
|
28
|
+
r(c ? null : o.currentTarget);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function p() {
|
|
31
31
|
r(null);
|
|
32
32
|
}
|
|
33
33
|
function N(o) {
|
|
34
|
-
|
|
34
|
+
p(), P(!0), k(o);
|
|
35
35
|
}
|
|
36
36
|
const O = z(
|
|
37
37
|
(o, i) => {
|
|
38
|
-
if (!
|
|
39
|
-
|
|
38
|
+
if (!n) return;
|
|
39
|
+
n(i ?? {
|
|
40
40
|
target: { value: o },
|
|
41
41
|
currentTarget: { value: o }
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
|
-
[
|
|
44
|
+
[n]
|
|
45
45
|
);
|
|
46
46
|
if (t.startsWith("+")) {
|
|
47
47
|
const i = T(t)?.prefix?.length || 0;
|
|
48
48
|
t = t.substring(i);
|
|
49
49
|
}
|
|
50
50
|
return E(() => {
|
|
51
|
-
const o =
|
|
52
|
-
o == null || !
|
|
51
|
+
const o = u?.current;
|
|
52
|
+
o == null || !m || requestAnimationFrame(() => {
|
|
53
53
|
o.value.length > 0 ? o.select() : o.focus();
|
|
54
54
|
});
|
|
55
|
-
}, [
|
|
56
|
-
/* @__PURE__ */
|
|
55
|
+
}, [m]), /* @__PURE__ */ S(A, { children: [
|
|
56
|
+
/* @__PURE__ */ e(
|
|
57
57
|
V,
|
|
58
58
|
{
|
|
59
59
|
ref: d,
|
|
60
60
|
value: t,
|
|
61
61
|
...h,
|
|
62
|
-
className: f(a, "tcn-
|
|
62
|
+
className: f(a, "tcn-control-set-item"),
|
|
63
63
|
onChange: O
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
x && /* @__PURE__ */
|
|
66
|
+
x && /* @__PURE__ */ e(
|
|
67
67
|
L,
|
|
68
68
|
{
|
|
69
69
|
disabled: B,
|
|
70
|
-
className: f("tcn-
|
|
70
|
+
className: f("tcn-control-set-item", "tcn-phone-number-phone-book"),
|
|
71
71
|
"aria-label": b,
|
|
72
72
|
onClick: I,
|
|
73
73
|
size: "md",
|
|
74
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ e(C, { size: "md" })
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ e(
|
|
78
78
|
w,
|
|
79
79
|
{
|
|
80
|
-
open:
|
|
80
|
+
open: c,
|
|
81
81
|
anchorElement: s,
|
|
82
82
|
horizontalAnchor: "end",
|
|
83
83
|
horizontalOrigin: "end",
|
|
@@ -85,7 +85,7 @@ const to = F(function({ onChange: e, value: t = "", className: a, ...h }, g) {
|
|
|
85
85
|
verticalOrigin: "top",
|
|
86
86
|
width: "300px",
|
|
87
87
|
onOptionSelect: N,
|
|
88
|
-
onClose:
|
|
88
|
+
onClose: p,
|
|
89
89
|
noSuggestionMessage: "No phone numbers found",
|
|
90
90
|
children: l
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input_adapter.js","sources":["../../../src/inputs/phone_number_input/phone_number_input_adapter.tsx"],"sourcesContent":["import { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport clsx from 'clsx';\nimport { forwardRef, useState, useCallback, useLayoutEffect, useRef } from 'react';\nimport { Button } from '../../actions/index.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { usePhoneContext } from './phone_number_context.js';\nimport { getCountryFromValue } from './phone_number_country_select_adapter.js';\nimport { Input } from '../input/input.js';\nimport { useForkRef } from '../../utils/hooks/use_fork_ref.js';\n\n/**\n * Bridges `@tcn/ui/inputs` Input (onChange: (value, event?) => void)\n * with react-phone-number-input's expectation (onChange: (event) => void).\n */\nexport const PhoneNumberInputAdapter = forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(function InputAdapter({ onChange, value = '', className, ...rest }, ref) {\n value = value.toString();\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const forkedRef = useForkRef(ref, internalInputRef);\n\n const {\n phoneBook: phoneBookOptions,\n setValue,\n ariaPhoneBookButtonLabel,\n disabled,\n setFocusNumberInput,\n focusNumberInput,\n } = usePhoneContext();\n\n const showPhoneBook = phoneBookOptions.length > 0;\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n closePhoneBook();\n setFocusNumberInput(true);\n setValue(value);\n }\n\n const handleChange = useCallback(\n (value: string, event?: React.ChangeEvent<HTMLInputElement>) => {\n if (!onChange) return;\n const e =\n event ??\n ({\n target: { value },\n currentTarget: { value },\n } as React.ChangeEvent<HTMLInputElement>);\n onChange(e);\n },\n [onChange]\n );\n\n if (value.startsWith('+')) {\n const country = getCountryFromValue(value);\n const prefixLength = country?.prefix?.length || 0;\n value = value.substring(prefixLength);\n }\n\n useLayoutEffect(() => {\n const input = internalInputRef?.current;\n\n if (input == null || !focusNumberInput) {\n return;\n }\n\n requestAnimationFrame(() => {\n if (input.value.length > 0) {\n input.select();\n } else {\n input.focus();\n }\n });\n }, [focusNumberInput]);\n\n return (\n <>\n <Input\n ref={forkedRef}\n value={value}\n {...(rest as any)}\n className={clsx(className, 'tcn-
|
|
1
|
+
{"version":3,"file":"phone_number_input_adapter.js","sources":["../../../src/inputs/phone_number_input/phone_number_input_adapter.tsx"],"sourcesContent":["import { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport clsx from 'clsx';\nimport { forwardRef, useState, useCallback, useLayoutEffect, useRef } from 'react';\nimport { Button } from '../../actions/index.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { usePhoneContext } from './phone_number_context.js';\nimport { getCountryFromValue } from './phone_number_country_select_adapter.js';\nimport { Input } from '../input/input.js';\nimport { useForkRef } from '../../utils/hooks/use_fork_ref.js';\n\n/**\n * Bridges `@tcn/ui/inputs` Input (onChange: (value, event?) => void)\n * with react-phone-number-input's expectation (onChange: (event) => void).\n */\nexport const PhoneNumberInputAdapter = forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(function InputAdapter({ onChange, value = '', className, ...rest }, ref) {\n value = value.toString();\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const forkedRef = useForkRef(ref, internalInputRef);\n\n const {\n phoneBook: phoneBookOptions,\n setValue,\n ariaPhoneBookButtonLabel,\n disabled,\n setFocusNumberInput,\n focusNumberInput,\n } = usePhoneContext();\n\n const showPhoneBook = phoneBookOptions.length > 0;\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n closePhoneBook();\n setFocusNumberInput(true);\n setValue(value);\n }\n\n const handleChange = useCallback(\n (value: string, event?: React.ChangeEvent<HTMLInputElement>) => {\n if (!onChange) return;\n const e =\n event ??\n ({\n target: { value },\n currentTarget: { value },\n } as React.ChangeEvent<HTMLInputElement>);\n onChange(e);\n },\n [onChange]\n );\n\n if (value.startsWith('+')) {\n const country = getCountryFromValue(value);\n const prefixLength = country?.prefix?.length || 0;\n value = value.substring(prefixLength);\n }\n\n useLayoutEffect(() => {\n const input = internalInputRef?.current;\n\n if (input == null || !focusNumberInput) {\n return;\n }\n\n requestAnimationFrame(() => {\n if (input.value.length > 0) {\n input.select();\n } else {\n input.focus();\n }\n });\n }, [focusNumberInput]);\n\n return (\n <>\n <Input\n ref={forkedRef}\n value={value}\n {...(rest as any)}\n className={clsx(className, 'tcn-control-set-item')}\n onChange={handleChange}\n />\n {showPhoneBook && (\n <Button\n disabled={disabled}\n className={clsx('tcn-control-set-item', 'tcn-phone-number-phone-book')}\n aria-label={ariaPhoneBookButtonLabel}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </Button>\n )}\n <SuggestionList\n open={isPhoneBookOpen}\n anchorElement={phoneBookElement}\n horizontalAnchor=\"end\"\n horizontalOrigin=\"end\"\n verticalAnchor=\"top\"\n verticalOrigin=\"top\"\n width=\"300px\"\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n </>\n );\n});\n"],"names":["PhoneNumberInputAdapter","forwardRef","onChange","value","className","rest","ref","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","internalInputRef","useRef","forkedRef","useForkRef","phoneBookOptions","setValue","ariaPhoneBookButtonLabel","disabled","setFocusNumberInput","focusNumberInput","usePhoneContext","showPhoneBook","togglePhoneBook","e","closePhoneBook","handlePhoneBookOptionSelect","handleChange","useCallback","event","prefixLength","getCountryFromValue","useLayoutEffect","input","jsxs","Fragment","jsx","Input","clsx","Button","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;AAcO,MAAMA,KAA0BC,EAGrC,SAAsB,EAAE,UAAAC,GAAU,OAAAC,IAAQ,IAAI,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AACzE,EAAAH,IAAQA,EAAM,SAAA;AACd,QAAM,CAACI,GAAkBC,CAAmB,IAAIC;AAAA,IAC9C;AAAA,EAAA,GAEIC,IAAkBH,KAAoB,MACtCI,IAAmBC,EAAgC,IAAI,GACvDC,IAAYC,EAAWR,GAAKK,CAAgB,GAE5C;AAAA,IACJ,WAAWI;AAAA,IACX,UAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,UAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACEC,EAAA,GAEEC,IAAgBP,EAAiB,SAAS;AAEhD,WAASQ,EAAgBC,GAAwC;AAC/D,IACEhB,EADEE,IACkB,OAEAc,EAAE,aAFE;AAAA,EAI5B;AAEA,WAASC,IAAiB;AACxB,IAAAjB,EAAoB,IAAI;AAAA,EAC1B;AAEA,WAASkB,EAA4BvB,GAAe;AAClD,IAAAsB,EAAA,GACAN,EAAoB,EAAI,GACxBH,EAASb,CAAK;AAAA,EAChB;AAEA,QAAMwB,IAAeC;AAAA,IACnB,CAACzB,GAAe0B,MAAgD;AAC9D,UAAI,CAAC3B,EAAU;AAOf,MAAAA,EALE2B,KACC;AAAA,QACC,QAAQ,EAAE,OAAA1B,EAAAA;AAAAA,QACV,eAAe,EAAE,OAAAA,EAAAA;AAAAA,MAAM,CAEjB;AAAA,IACZ;AAAA,IACA,CAACD,CAAQ;AAAA,EAAA;AAGX,MAAIC,EAAM,WAAW,GAAG,GAAG;AAEzB,UAAM2B,IADUC,EAAoB5B,CAAK,GACX,QAAQ,UAAU;AAChD,IAAAA,IAAQA,EAAM,UAAU2B,CAAY;AAAA,EACtC;AAEA,SAAAE,EAAgB,MAAM;AACpB,UAAMC,IAAQtB,GAAkB;AAEhC,IAAIsB,KAAS,QAAQ,CAACb,KAItB,sBAAsB,MAAM;AAC1B,MAAIa,EAAM,MAAM,SAAS,IACvBA,EAAM,OAAA,IAENA,EAAM,MAAA;AAAA,IAEV,CAAC;AAAA,EACH,GAAG,CAACb,CAAgB,CAAC,GAGnB,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKxB;AAAA,QACL,OAAAV;AAAA,QACC,GAAIE;AAAA,QACL,WAAWiC,EAAKlC,GAAW,sBAAsB;AAAA,QACjD,UAAUuB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEXL,KACC,gBAAAc;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,UAAArB;AAAA,QACA,WAAWoB,EAAK,wBAAwB,6BAA6B;AAAA,QACrE,cAAYrB;AAAA,QACZ,SAASM;AAAA,QACT,MAAK;AAAA,QAEL,UAAA,gBAAAa,EAACI,GAAA,EAAa,MAAK,KAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,IAG5B,gBAAAJ;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,MAAM/B;AAAA,QACN,eAAeH;AAAA,QACf,kBAAiB;AAAA,QACjB,kBAAiB;AAAA,QACjB,gBAAe;AAAA,QACf,gBAAe;AAAA,QACf,OAAM;AAAA,QACN,gBAAgBmB;AAAA,QAChB,SAASD;AAAA,QACT,qBAAoB;AAAA,QAEnB,UAAAV;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,CAAC;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CountryCode } from 'libphonenumber-js';
|
|
2
2
|
export interface SipInputProps {
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
|
+
sipAutoComplete?: string;
|
|
4
5
|
countries?: CountryCode[];
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
name?: string;
|
|
@@ -8,5 +9,5 @@ export interface SipInputProps {
|
|
|
8
9
|
autoFocus?: boolean;
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function SipInput({ disabled, countries, name, 'aria-label': ariaLabel, autoFocus, placeholder, }: SipInputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function SipInput({ disabled, countries, name, 'aria-label': ariaLabel, autoFocus, placeholder, sipAutoComplete, }: SipInputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=sip_input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sip_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/sip_input.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,WAAW,
|
|
1
|
+
{"version":3,"file":"sip_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/sip_input.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,WAAW,EACX,eAAsB,GACvB,EAAE,aAAa,2CAyHf"}
|