@vygruppen/spor-react 11.3.5 → 11.3.7
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 +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/ServiceAlert.tsx +2 -2
- package/src/input/PhoneNumberInput.tsx +24 -7
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
|
-
"version": "11.3.
|
3
|
+
"version": "11.3.7",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -31,9 +31,9 @@
|
|
31
31
|
"react-aria": "^3.33.1",
|
32
32
|
"react-stately": "^3.31.1",
|
33
33
|
"react-swipeable": "^7.0.1",
|
34
|
-
"@vygruppen/spor-
|
34
|
+
"@vygruppen/spor-design-tokens": "3.10.0",
|
35
35
|
"@vygruppen/spor-loader": "0.5.0",
|
36
|
-
"@vygruppen/spor-
|
36
|
+
"@vygruppen/spor-icon-react": "3.13.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@react-types/datepicker": "^3.10.0",
|
@@ -11,9 +11,9 @@ import {
|
|
11
11
|
useMultiStyleConfig,
|
12
12
|
} from "@chakra-ui/react";
|
13
13
|
import React from "react";
|
14
|
+
import { createTexts, useTranslation } from "../i18n";
|
14
15
|
import { AlertIcon } from "./AlertIcon";
|
15
16
|
import { BaseAlert, BaseAlertProps } from "./BaseAlert";
|
16
|
-
import { createTexts, useTranslation } from "../i18n";
|
17
17
|
|
18
18
|
type ServiceAlertProps = BaseAlertProps & {
|
19
19
|
/** The title string */
|
@@ -91,7 +91,7 @@ export const ServiceAlert = ({
|
|
91
91
|
maxWidth={contentWidth}
|
92
92
|
>
|
93
93
|
<Flex as={headingLevel} alignItems="center">
|
94
|
-
<AlertIcon variant={variant} />
|
94
|
+
{notification === 1 && <AlertIcon variant={variant} />}
|
95
95
|
|
96
96
|
<Box
|
97
97
|
as="span"
|
@@ -5,18 +5,23 @@ import { AttachedInputs } from "./AttachedInputs";
|
|
5
5
|
import { CountryCodeSelect } from "./CountryCodeSelect";
|
6
6
|
import { As } from "@chakra-ui/system";
|
7
7
|
|
8
|
-
type CountryCodeAndPhoneNumber = {
|
8
|
+
export type CountryCodeAndPhoneNumber = {
|
9
9
|
countryCode: string;
|
10
10
|
nationalNumber: string;
|
11
11
|
};
|
12
|
-
type PhoneNumberInputProps = Omit<BoxProps, "onChange"> & {
|
12
|
+
export type PhoneNumberInputProps = Omit<BoxProps, "onChange"> & {
|
13
13
|
/** The label. Defaults to a localized version of "Phone number" */
|
14
14
|
label?: string;
|
15
15
|
/** The root name.
|
16
16
|
*
|
17
|
-
* Please note that when specifying the name, the rendered names will be `${name}-country-code` and `${name}-phone-number
|
17
|
+
* Please note that when specifying the name, the rendered names will be `${name}-country-code` and `${name}-phone-number` unless a name is provided for both countryCode and nationalNumber.
|
18
18
|
*/
|
19
|
-
name?:
|
19
|
+
name?:
|
20
|
+
| string
|
21
|
+
| {
|
22
|
+
countryCode: string;
|
23
|
+
nationalNumber: string;
|
24
|
+
};
|
20
25
|
/** Callback for when the country code or phone number changes */
|
21
26
|
onChange?: (change: CountryCodeAndPhoneNumber) => void;
|
22
27
|
/** The optional value of the country code and phone number */
|
@@ -31,7 +36,7 @@ type PhoneNumberInputProps = Omit<BoxProps, "onChange"> & {
|
|
31
36
|
* <PhoneNumberInput name="phone" />
|
32
37
|
* ```
|
33
38
|
*
|
34
|
-
* > Please note that when specifying the name, the rendered names will be `${name}-country-code` and `${name}-phone-number
|
39
|
+
* > Please note that when specifying the name, the rendered names will be `${name}-country-code` and `${name}-phone-number` unless a name is provided for both countryCode and nationalNumber.
|
35
40
|
*
|
36
41
|
* The field can be controlled as well:
|
37
42
|
* ```tsx
|
@@ -76,7 +81,13 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
|
|
76
81
|
nationalNumber: value.nationalNumber,
|
77
82
|
})
|
78
83
|
}
|
79
|
-
name={
|
84
|
+
name={
|
85
|
+
name
|
86
|
+
? typeof name !== "string" && name.countryCode
|
87
|
+
? name.countryCode
|
88
|
+
: `${name}-country-code`
|
89
|
+
: "country-code"
|
90
|
+
}
|
80
91
|
height="100%"
|
81
92
|
width="6.25rem"
|
82
93
|
variant={variant}
|
@@ -86,7 +97,13 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
|
|
86
97
|
type="tel"
|
87
98
|
label={label}
|
88
99
|
value={value.nationalNumber}
|
89
|
-
name={
|
100
|
+
name={
|
101
|
+
name
|
102
|
+
? typeof name !== "string" && name.nationalNumber
|
103
|
+
? name.nationalNumber
|
104
|
+
: `${name}-phone-number`
|
105
|
+
: "phone-number"
|
106
|
+
}
|
90
107
|
onChange={(e) => {
|
91
108
|
// Removes everything but numbers, spaces and dashes
|
92
109
|
const strippedValue = e.target.value.replace(/[^\d\s-]/g, "");
|