@colisweb/rescript-toolkit 5.24.4 → 5.26.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colisweb/rescript-toolkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rescript clean",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"react-helmet": "6.1.0",
|
|
68
68
|
"react-icons": "5.3.0",
|
|
69
69
|
"react-intl": "6.8.1",
|
|
70
|
+
"react-phone-number-input": "^3.4.10",
|
|
70
71
|
"react-portal": "4.2.2",
|
|
71
72
|
"react-select": "5.8.1",
|
|
72
73
|
"react-table": "7.8.0",
|
|
@@ -714,4 +714,41 @@ module Make = (StateLenses: Config) => {
|
|
|
714
714
|
/>
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
+
|
|
718
|
+
module Phone = {
|
|
719
|
+
@react.component
|
|
720
|
+
let make = (
|
|
721
|
+
~field,
|
|
722
|
+
~international=true,
|
|
723
|
+
~defaultCountry="FR",
|
|
724
|
+
~label,
|
|
725
|
+
~isOptional=false,
|
|
726
|
+
~id,
|
|
727
|
+
) =>
|
|
728
|
+
<Field
|
|
729
|
+
field
|
|
730
|
+
render={({value, handleChange, validate, error}) => {
|
|
731
|
+
<>
|
|
732
|
+
<Toolkit__Ui_Label
|
|
733
|
+
htmlFor=id
|
|
734
|
+
optionalMessage={isOptional
|
|
735
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
736
|
+
: React.null}>
|
|
737
|
+
{label}
|
|
738
|
+
</Toolkit__Ui_Label>
|
|
739
|
+
<ReactPhoneNumberInput
|
|
740
|
+
international
|
|
741
|
+
value
|
|
742
|
+
countryCallingCodeEditable={false}
|
|
743
|
+
defaultCountry
|
|
744
|
+
onChange={handleChange}
|
|
745
|
+
onBlur={_ => validate()}
|
|
746
|
+
/>
|
|
747
|
+
{error->Option.mapWithDefault(React.null, error => {
|
|
748
|
+
<ErrorMessage error />
|
|
749
|
+
})}
|
|
750
|
+
</>
|
|
751
|
+
}}
|
|
752
|
+
/>
|
|
753
|
+
}
|
|
717
754
|
}
|
package/src/ui/styles.css
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap");
|
|
7
7
|
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap");
|
|
8
8
|
@import url("react-day-picker/dist/style.css");
|
|
9
|
+
@import url("react-phone-number-input/style.css");
|
|
9
10
|
|
|
10
11
|
@layer components {
|
|
11
12
|
.cw-tab-list {
|
|
@@ -259,4 +260,16 @@ input[type="number"] {
|
|
|
259
260
|
-moz-appearance: textfield;
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
.PhoneInput {
|
|
264
|
+
@apply bg-white border rounded;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.PhoneInputCountry {
|
|
268
|
+
@apply px-2 m-2 border-r;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.PhoneInputInput {
|
|
272
|
+
@apply rounded-r py-2;
|
|
273
|
+
}
|
|
274
|
+
|
|
262
275
|
/* purgecss end ignore */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@module("react-phone-number-input") @react.component
|
|
2
|
+
external make: (
|
|
3
|
+
~placeholder: string=?,
|
|
4
|
+
~value: string=?,
|
|
5
|
+
~countryCallingCodeEditable: bool=?,
|
|
6
|
+
~international: bool=?,
|
|
7
|
+
~defaultCountry: string=?,
|
|
8
|
+
~onChange: string => unit=?,
|
|
9
|
+
~onBlur: 'a => unit=?,
|
|
10
|
+
) => React.element = "default"
|
|
11
|
+
|
|
12
|
+
@module("react-phone-number-input")
|
|
13
|
+
external isPossiblePhoneNumber: string => bool = "isPossiblePhoneNumber"
|
|
14
|
+
|
|
15
|
+
type phoneNumber = {
|
|
16
|
+
country: string,
|
|
17
|
+
countryCallingCode: string,
|
|
18
|
+
number: string,
|
|
19
|
+
nationalNumber: string,
|
|
20
|
+
}
|
|
21
|
+
@module("react-phone-number-input")
|
|
22
|
+
external parsePhoneNumber: string => option<phoneNumber> = "parsePhoneNumber"
|