@vygruppen/spor-react 11.1.1 → 11.1.2
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/.turbo/turbo-build.log +6 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.js +11942 -13874
- package/dist/index.mjs +14981 -1
- package/package.json +1 -1
- package/src/input/CountryCodeSelect.tsx +1 -1
- package/src/input/PhoneNumberInput.tsx +15 -31
- package/dist/CountryCodeSelect-V422HKUV.mjs +0 -41
- package/dist/chunk-QFSW3GTE.mjs +0 -14962
package/package.json
CHANGED
@@ -4,9 +4,10 @@ import {
|
|
4
4
|
forwardRef,
|
5
5
|
useControllableState,
|
6
6
|
} from "@chakra-ui/react";
|
7
|
-
import React
|
8
|
-
import {
|
7
|
+
import React from "react";
|
8
|
+
import { Input, createTexts, useTranslation } from "..";
|
9
9
|
import { AttachedInputs } from "./AttachedInputs";
|
10
|
+
import { CountryCodeSelect } from "./CountryCodeSelect";
|
10
11
|
|
11
12
|
type CountryCodeAndPhoneNumber = {
|
12
13
|
countryCode: string;
|
@@ -71,34 +72,19 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
|
|
71
72
|
});
|
72
73
|
return (
|
73
74
|
<AttachedInputs {...boxProps}>
|
74
|
-
<
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
value="+47"
|
82
|
-
variant={variant}
|
83
|
-
>
|
84
|
-
<Item key="+47">+47</Item>
|
85
|
-
</InfoSelect>
|
75
|
+
<CountryCodeSelect
|
76
|
+
value={value.countryCode}
|
77
|
+
onChange={(countryCode) =>
|
78
|
+
onChange({
|
79
|
+
countryCode: countryCode as string,
|
80
|
+
nationalNumber: value.nationalNumber,
|
81
|
+
})
|
86
82
|
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
countryCode: countryCode as string,
|
93
|
-
nationalNumber: value.nationalNumber,
|
94
|
-
})
|
95
|
-
}
|
96
|
-
name={name ? `${name}-country-code` : "country-code"}
|
97
|
-
height="100%"
|
98
|
-
width="6.25rem"
|
99
|
-
variant={variant}
|
100
|
-
/>
|
101
|
-
</Suspense>
|
83
|
+
name={name ? `${name}-country-code` : "country-code"}
|
84
|
+
height="100%"
|
85
|
+
width="6.25rem"
|
86
|
+
variant={variant}
|
87
|
+
/>
|
102
88
|
<Input
|
103
89
|
ref={ref}
|
104
90
|
type="tel"
|
@@ -142,5 +128,3 @@ const texts = createTexts({
|
|
142
128
|
sv: "Landskod",
|
143
129
|
},
|
144
130
|
});
|
145
|
-
|
146
|
-
const LazyCountryCodeSelect = React.lazy(() => import("./CountryCodeSelect"));
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { createTexts, useTranslation, InfoSelect, Item } from './chunk-QFSW3GTE.mjs';
|
2
|
-
import React from 'react';
|
3
|
-
import { getSupportedCallingCodes } from 'awesome-phonenumber';
|
4
|
-
|
5
|
-
var prioritizedCountryCodes = [
|
6
|
-
{ key: "+47", value: "+47" },
|
7
|
-
{ key: "+46", value: "+46" },
|
8
|
-
{ key: "+45", value: "+45" }
|
9
|
-
];
|
10
|
-
var sortedCallingCodes = getSupportedCallingCodes().sort((a, b) => Number(a) - Number(b)).map((code) => ({
|
11
|
-
key: `+${code}`,
|
12
|
-
value: `+${code}`
|
13
|
-
})).filter(
|
14
|
-
(code) => !prioritizedCountryCodes.some((pCode) => pCode.key === code.key)
|
15
|
-
);
|
16
|
-
var callingCodes = [...prioritizedCountryCodes, ...sortedCallingCodes];
|
17
|
-
var CountryCodeSelect = (props) => {
|
18
|
-
const { t } = useTranslation();
|
19
|
-
return /* @__PURE__ */ React.createElement(
|
20
|
-
InfoSelect,
|
21
|
-
{
|
22
|
-
label: t(texts.countryCode),
|
23
|
-
isLabelSrOnly: true,
|
24
|
-
items: callingCodes,
|
25
|
-
variant: props.variant,
|
26
|
-
...props
|
27
|
-
},
|
28
|
-
(item) => /* @__PURE__ */ React.createElement(Item, { key: item.key }, item.key)
|
29
|
-
);
|
30
|
-
};
|
31
|
-
var CountryCodeSelect_default = CountryCodeSelect;
|
32
|
-
var texts = createTexts({
|
33
|
-
countryCode: {
|
34
|
-
nb: "Landkode",
|
35
|
-
nn: "Landskode",
|
36
|
-
en: "Country code",
|
37
|
-
sv: "Landskod"
|
38
|
-
}
|
39
|
-
});
|
40
|
-
|
41
|
-
export { CountryCodeSelect, CountryCodeSelect_default as default };
|