@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "11.1.1",
3
+ "version": "11.1.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -35,7 +35,7 @@ export const CountryCodeSelect = (props: CountryCodeSelectProps) => {
35
35
  <InfoSelect
36
36
  label={t(texts.countryCode)}
37
37
  isLabelSrOnly={true}
38
- items={callingCodes as any}
38
+ items={callingCodes}
39
39
  variant={props.variant}
40
40
  {...props}
41
41
  >
@@ -4,9 +4,10 @@ import {
4
4
  forwardRef,
5
5
  useControllableState,
6
6
  } from "@chakra-ui/react";
7
- import React, { Suspense } from "react";
8
- import { InfoSelect, Input, Item, createTexts, useTranslation } from "..";
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
- <Suspense
75
- fallback={
76
- <InfoSelect
77
- isLabelSrOnly
78
- label={t(texts.countryCodeLabel)}
79
- width="6.25rem"
80
- height="100%"
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
- <LazyCountryCodeSelect
89
- value={value.countryCode}
90
- onChange={(countryCode) =>
91
- onChange({
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 };