@lets-events/react 11.5.2 → 11.5.4
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 +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +15 -93
- package/dist/index.mjs +15 -93
- package/package.json +2 -3
- package/src/components/FormFields/PhoneFormField.tsx +95 -95
- package/src/components/FormFields/TextAreaFormField.tsx +3 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @lets-events/react@11.5.
|
|
2
|
+
> @lets-events/react@11.5.4 build
|
|
3
3
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m290.94 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 223ms
|
|
13
|
+
[32mCJS[39m [1mdist\index.js [22m[32m301.13 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 223ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist\index.d.mts [22m[32m388.
|
|
18
|
-
[32mDTS[39m [1mdist\index.d.ts [22m[32m388.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3952ms
|
|
17
|
+
[32mDTS[39m [1mdist\index.d.mts [22m[32m388.25 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist\index.d.ts [22m[32m388.25 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -14,7 +14,6 @@ import { MaskOptions, format, unformat } from '@react-input/mask';
|
|
|
14
14
|
import { Dialog } from 'radix-ui';
|
|
15
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
16
16
|
import { FieldError, Merge, FieldErrorsImpl, UseFormProps, SubmitHandler, FieldValues } from 'react-hook-form';
|
|
17
|
-
import { PhoneInputProps } from 'react-international-phone';
|
|
18
17
|
|
|
19
18
|
interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
|
|
20
19
|
name: IconName;
|
|
@@ -14878,14 +14877,13 @@ type FormLabelProps = {
|
|
|
14878
14877
|
};
|
|
14879
14878
|
declare const FormLabel: ({ name, label, haveError, required, }: FormLabelProps) => react_jsx_runtime.JSX.Element | null;
|
|
14880
14879
|
|
|
14881
|
-
type TextAreaFormFieldProps = {
|
|
14880
|
+
type TextAreaFormFieldProps = TextareaFieldProps & {
|
|
14882
14881
|
name: string;
|
|
14883
14882
|
label?: string;
|
|
14884
14883
|
required?: boolean;
|
|
14885
14884
|
placeholder?: string;
|
|
14886
|
-
fieldProps?: TextareaFieldProps;
|
|
14887
14885
|
};
|
|
14888
|
-
declare const TextAreaFormField: ({ name, label, required, placeholder,
|
|
14886
|
+
declare const TextAreaFormField: ({ name, label, required, placeholder, ...props }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14889
14887
|
|
|
14890
14888
|
type TextFormFieldProps = {
|
|
14891
14889
|
name: string;
|
|
@@ -14908,7 +14906,7 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
|
|
|
14908
14906
|
};
|
|
14909
14907
|
declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14910
14908
|
|
|
14911
|
-
type PhoneFormFieldProps =
|
|
14909
|
+
type PhoneFormFieldProps = {
|
|
14912
14910
|
name: string;
|
|
14913
14911
|
label?: string;
|
|
14914
14912
|
required?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { MaskOptions, format, unformat } from '@react-input/mask';
|
|
|
14
14
|
import { Dialog } from 'radix-ui';
|
|
15
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
16
16
|
import { FieldError, Merge, FieldErrorsImpl, UseFormProps, SubmitHandler, FieldValues } from 'react-hook-form';
|
|
17
|
-
import { PhoneInputProps } from 'react-international-phone';
|
|
18
17
|
|
|
19
18
|
interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
|
|
20
19
|
name: IconName;
|
|
@@ -14878,14 +14877,13 @@ type FormLabelProps = {
|
|
|
14878
14877
|
};
|
|
14879
14878
|
declare const FormLabel: ({ name, label, haveError, required, }: FormLabelProps) => react_jsx_runtime.JSX.Element | null;
|
|
14880
14879
|
|
|
14881
|
-
type TextAreaFormFieldProps = {
|
|
14880
|
+
type TextAreaFormFieldProps = TextareaFieldProps & {
|
|
14882
14881
|
name: string;
|
|
14883
14882
|
label?: string;
|
|
14884
14883
|
required?: boolean;
|
|
14885
14884
|
placeholder?: string;
|
|
14886
|
-
fieldProps?: TextareaFieldProps;
|
|
14887
14885
|
};
|
|
14888
|
-
declare const TextAreaFormField: ({ name, label, required, placeholder,
|
|
14886
|
+
declare const TextAreaFormField: ({ name, label, required, placeholder, ...props }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14889
14887
|
|
|
14890
14888
|
type TextFormFieldProps = {
|
|
14891
14889
|
name: string;
|
|
@@ -14908,7 +14906,7 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
|
|
|
14908
14906
|
};
|
|
14909
14907
|
declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14910
14908
|
|
|
14911
|
-
type PhoneFormFieldProps =
|
|
14909
|
+
type PhoneFormFieldProps = {
|
|
14912
14910
|
name: string;
|
|
14913
14911
|
label?: string;
|
|
14914
14912
|
required?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -9650,20 +9650,25 @@ var FormLabel = ({
|
|
|
9650
9650
|
// src/components/FormFields/TextAreaFormField.tsx
|
|
9651
9651
|
var import_react_hook_form = require("react-hook-form");
|
|
9652
9652
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
9653
|
-
var TextAreaFormField = ({
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
}
|
|
9660
|
-
|
|
9653
|
+
var TextAreaFormField = (_a) => {
|
|
9654
|
+
var _b = _a, {
|
|
9655
|
+
name,
|
|
9656
|
+
label,
|
|
9657
|
+
required,
|
|
9658
|
+
placeholder
|
|
9659
|
+
} = _b, props = __objRest(_b, [
|
|
9660
|
+
"name",
|
|
9661
|
+
"label",
|
|
9662
|
+
"required",
|
|
9663
|
+
"placeholder"
|
|
9664
|
+
]);
|
|
9665
|
+
var _a2;
|
|
9661
9666
|
const {
|
|
9662
9667
|
register,
|
|
9663
9668
|
formState: { errors }
|
|
9664
9669
|
} = (0, import_react_hook_form.useFormContext)();
|
|
9665
9670
|
const haveError = !!errors[name];
|
|
9666
|
-
const errorMsg = (
|
|
9671
|
+
const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
|
|
9667
9672
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex2, { direction: "column", children: [
|
|
9668
9673
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9669
9674
|
FormLabel,
|
|
@@ -9676,7 +9681,7 @@ var TextAreaFormField = ({
|
|
|
9676
9681
|
),
|
|
9677
9682
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9678
9683
|
TextareaField,
|
|
9679
|
-
__spreadProps(__spreadValues(__spreadValues({},
|
|
9684
|
+
__spreadProps(__spreadValues(__spreadValues({}, props), register(name, { required })), {
|
|
9680
9685
|
placeholder,
|
|
9681
9686
|
color: haveError ? "error" : "default",
|
|
9682
9687
|
"aria-labelledby": `${name}-label`
|
|
@@ -9789,79 +9794,7 @@ var MultiSelectFormField = (_a) => {
|
|
|
9789
9794
|
|
|
9790
9795
|
// src/components/FormFields/PhoneFormField.tsx
|
|
9791
9796
|
var import_react_hook_form5 = require("react-hook-form");
|
|
9792
|
-
var import_react_international_phone = require("react-international-phone");
|
|
9793
|
-
var import_style = require("react-international-phone/style.css");
|
|
9794
9797
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9795
|
-
var PhoneFormInput = styled(import_react_international_phone.PhoneInput, {
|
|
9796
|
-
$$borderColor: "$colors$neutral300",
|
|
9797
|
-
boxSizing: "border-box",
|
|
9798
|
-
borderRadius: "$sm",
|
|
9799
|
-
display: "flex",
|
|
9800
|
-
flex: 1,
|
|
9801
|
-
fontFamily: "$default",
|
|
9802
|
-
color: "$dark500",
|
|
9803
|
-
img: {
|
|
9804
|
-
width: "$18",
|
|
9805
|
-
height: "$18",
|
|
9806
|
-
marginLeft: "$8"
|
|
9807
|
-
},
|
|
9808
|
-
ul: {
|
|
9809
|
-
border: "none"
|
|
9810
|
-
},
|
|
9811
|
-
input: {
|
|
9812
|
-
height: "$40 !important",
|
|
9813
|
-
flex: 1,
|
|
9814
|
-
borderColor: "$$borderColor !important",
|
|
9815
|
-
borderTopRightRadius: "$sm !important",
|
|
9816
|
-
borderBottomRightRadius: "$sm !important",
|
|
9817
|
-
fontSize: "inherit !important",
|
|
9818
|
-
"&:focus": {
|
|
9819
|
-
$$borderColor: "$colors$brand300"
|
|
9820
|
-
}
|
|
9821
|
-
},
|
|
9822
|
-
button: {
|
|
9823
|
-
height: "$40 !important",
|
|
9824
|
-
borderRight: "none",
|
|
9825
|
-
borderTopLeftRadius: "$sm !important",
|
|
9826
|
-
borderBottomLeftRadius: "$sm !important",
|
|
9827
|
-
borderColor: "$$borderColor !important",
|
|
9828
|
-
marginRight: "0 !important",
|
|
9829
|
-
"&:active": {
|
|
9830
|
-
$$borderColor: "$colors$brand300"
|
|
9831
|
-
},
|
|
9832
|
-
div: {
|
|
9833
|
-
padding: "auto $12",
|
|
9834
|
-
gap: " $8px"
|
|
9835
|
-
}
|
|
9836
|
-
},
|
|
9837
|
-
"&:has(input:disabled)": {
|
|
9838
|
-
backgroundColor: "$dark100",
|
|
9839
|
-
color: "$dark400",
|
|
9840
|
-
$$borderColor: "$colors$dark200",
|
|
9841
|
-
cursor: "not-allowed",
|
|
9842
|
-
img: {
|
|
9843
|
-
opacity: 0.6
|
|
9844
|
-
},
|
|
9845
|
-
button: {
|
|
9846
|
-
$$borderColor: "$colors$dark200"
|
|
9847
|
-
}
|
|
9848
|
-
},
|
|
9849
|
-
variants: {
|
|
9850
|
-
typography: typographyValues,
|
|
9851
|
-
color: {
|
|
9852
|
-
default: {
|
|
9853
|
-
$$borderColor: "$colors$neutral300"
|
|
9854
|
-
},
|
|
9855
|
-
error: {
|
|
9856
|
-
$$borderColor: "$colors$error600"
|
|
9857
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
},
|
|
9860
|
-
defaultVariants: {
|
|
9861
|
-
typography: "labelSmall",
|
|
9862
|
-
color: "default"
|
|
9863
|
-
}
|
|
9864
|
-
});
|
|
9865
9798
|
var PhoneFormField = (_a) => {
|
|
9866
9799
|
var _b = _a, {
|
|
9867
9800
|
name,
|
|
@@ -9896,17 +9829,6 @@ var PhoneFormField = (_a) => {
|
|
|
9896
9829
|
haveError
|
|
9897
9830
|
}
|
|
9898
9831
|
),
|
|
9899
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9900
|
-
PhoneFormInput,
|
|
9901
|
-
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9902
|
-
defaultCountry,
|
|
9903
|
-
value: watch(name),
|
|
9904
|
-
color: haveError ? "error" : "default",
|
|
9905
|
-
onChange: handlePhoneChange
|
|
9906
|
-
}), props), {
|
|
9907
|
-
"aria-labelledby": `${name}-label`
|
|
9908
|
-
})
|
|
9909
|
-
),
|
|
9910
9832
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorFormMessage, { message: errorMsg })
|
|
9911
9833
|
] });
|
|
9912
9834
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -9558,20 +9558,25 @@ var FormLabel = ({
|
|
|
9558
9558
|
// src/components/FormFields/TextAreaFormField.tsx
|
|
9559
9559
|
import { useFormContext } from "react-hook-form";
|
|
9560
9560
|
import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
9561
|
-
var TextAreaFormField = ({
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
}
|
|
9568
|
-
|
|
9561
|
+
var TextAreaFormField = (_a) => {
|
|
9562
|
+
var _b = _a, {
|
|
9563
|
+
name,
|
|
9564
|
+
label,
|
|
9565
|
+
required,
|
|
9566
|
+
placeholder
|
|
9567
|
+
} = _b, props = __objRest(_b, [
|
|
9568
|
+
"name",
|
|
9569
|
+
"label",
|
|
9570
|
+
"required",
|
|
9571
|
+
"placeholder"
|
|
9572
|
+
]);
|
|
9573
|
+
var _a2;
|
|
9569
9574
|
const {
|
|
9570
9575
|
register,
|
|
9571
9576
|
formState: { errors }
|
|
9572
9577
|
} = useFormContext();
|
|
9573
9578
|
const haveError = !!errors[name];
|
|
9574
|
-
const errorMsg = (
|
|
9579
|
+
const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
|
|
9575
9580
|
return /* @__PURE__ */ jsxs17(Flex2, { direction: "column", children: [
|
|
9576
9581
|
/* @__PURE__ */ jsx32(
|
|
9577
9582
|
FormLabel,
|
|
@@ -9584,7 +9589,7 @@ var TextAreaFormField = ({
|
|
|
9584
9589
|
),
|
|
9585
9590
|
/* @__PURE__ */ jsx32(
|
|
9586
9591
|
TextareaField,
|
|
9587
|
-
__spreadProps(__spreadValues(__spreadValues({},
|
|
9592
|
+
__spreadProps(__spreadValues(__spreadValues({}, props), register(name, { required })), {
|
|
9588
9593
|
placeholder,
|
|
9589
9594
|
color: haveError ? "error" : "default",
|
|
9590
9595
|
"aria-labelledby": `${name}-label`
|
|
@@ -9700,79 +9705,7 @@ var MultiSelectFormField = (_a) => {
|
|
|
9700
9705
|
|
|
9701
9706
|
// src/components/FormFields/PhoneFormField.tsx
|
|
9702
9707
|
import { useFormContext as useFormContext4 } from "react-hook-form";
|
|
9703
|
-
import { PhoneInput } from "react-international-phone";
|
|
9704
|
-
import "react-international-phone/style.css";
|
|
9705
9708
|
import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
9706
|
-
var PhoneFormInput = styled(PhoneInput, {
|
|
9707
|
-
$$borderColor: "$colors$neutral300",
|
|
9708
|
-
boxSizing: "border-box",
|
|
9709
|
-
borderRadius: "$sm",
|
|
9710
|
-
display: "flex",
|
|
9711
|
-
flex: 1,
|
|
9712
|
-
fontFamily: "$default",
|
|
9713
|
-
color: "$dark500",
|
|
9714
|
-
img: {
|
|
9715
|
-
width: "$18",
|
|
9716
|
-
height: "$18",
|
|
9717
|
-
marginLeft: "$8"
|
|
9718
|
-
},
|
|
9719
|
-
ul: {
|
|
9720
|
-
border: "none"
|
|
9721
|
-
},
|
|
9722
|
-
input: {
|
|
9723
|
-
height: "$40 !important",
|
|
9724
|
-
flex: 1,
|
|
9725
|
-
borderColor: "$$borderColor !important",
|
|
9726
|
-
borderTopRightRadius: "$sm !important",
|
|
9727
|
-
borderBottomRightRadius: "$sm !important",
|
|
9728
|
-
fontSize: "inherit !important",
|
|
9729
|
-
"&:focus": {
|
|
9730
|
-
$$borderColor: "$colors$brand300"
|
|
9731
|
-
}
|
|
9732
|
-
},
|
|
9733
|
-
button: {
|
|
9734
|
-
height: "$40 !important",
|
|
9735
|
-
borderRight: "none",
|
|
9736
|
-
borderTopLeftRadius: "$sm !important",
|
|
9737
|
-
borderBottomLeftRadius: "$sm !important",
|
|
9738
|
-
borderColor: "$$borderColor !important",
|
|
9739
|
-
marginRight: "0 !important",
|
|
9740
|
-
"&:active": {
|
|
9741
|
-
$$borderColor: "$colors$brand300"
|
|
9742
|
-
},
|
|
9743
|
-
div: {
|
|
9744
|
-
padding: "auto $12",
|
|
9745
|
-
gap: " $8px"
|
|
9746
|
-
}
|
|
9747
|
-
},
|
|
9748
|
-
"&:has(input:disabled)": {
|
|
9749
|
-
backgroundColor: "$dark100",
|
|
9750
|
-
color: "$dark400",
|
|
9751
|
-
$$borderColor: "$colors$dark200",
|
|
9752
|
-
cursor: "not-allowed",
|
|
9753
|
-
img: {
|
|
9754
|
-
opacity: 0.6
|
|
9755
|
-
},
|
|
9756
|
-
button: {
|
|
9757
|
-
$$borderColor: "$colors$dark200"
|
|
9758
|
-
}
|
|
9759
|
-
},
|
|
9760
|
-
variants: {
|
|
9761
|
-
typography: typographyValues,
|
|
9762
|
-
color: {
|
|
9763
|
-
default: {
|
|
9764
|
-
$$borderColor: "$colors$neutral300"
|
|
9765
|
-
},
|
|
9766
|
-
error: {
|
|
9767
|
-
$$borderColor: "$colors$error600"
|
|
9768
|
-
}
|
|
9769
|
-
}
|
|
9770
|
-
},
|
|
9771
|
-
defaultVariants: {
|
|
9772
|
-
typography: "labelSmall",
|
|
9773
|
-
color: "default"
|
|
9774
|
-
}
|
|
9775
|
-
});
|
|
9776
9709
|
var PhoneFormField = (_a) => {
|
|
9777
9710
|
var _b = _a, {
|
|
9778
9711
|
name,
|
|
@@ -9807,17 +9740,6 @@ var PhoneFormField = (_a) => {
|
|
|
9807
9740
|
haveError
|
|
9808
9741
|
}
|
|
9809
9742
|
),
|
|
9810
|
-
/* @__PURE__ */ jsx36(
|
|
9811
|
-
PhoneFormInput,
|
|
9812
|
-
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9813
|
-
defaultCountry,
|
|
9814
|
-
value: watch(name),
|
|
9815
|
-
color: haveError ? "error" : "default",
|
|
9816
|
-
onChange: handlePhoneChange
|
|
9817
|
-
}), props), {
|
|
9818
|
-
"aria-labelledby": `${name}-label`
|
|
9819
|
-
})
|
|
9820
|
-
),
|
|
9821
9743
|
/* @__PURE__ */ jsx36(ErrorFormMessage, { message: errorMsg })
|
|
9822
9744
|
] });
|
|
9823
9745
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lets-events/react",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"npm": "^11.4.2",
|
|
41
41
|
"radix-ui": "^1.4.2",
|
|
42
42
|
"react-day-picker": "^9.6.7",
|
|
43
|
-
"react-hook-form": "^7.57.0"
|
|
44
|
-
"react-international-phone": "^4.5.0"
|
|
43
|
+
"react-hook-form": "^7.57.0"
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { useFormContext } from
|
|
2
|
-
import { Flex } from
|
|
3
|
-
import { FormLabel } from
|
|
4
|
-
import { ErrorFormMessage } from
|
|
5
|
-
import { PhoneInput, PhoneInputProps } from 'react-international-phone'
|
|
6
|
-
import { styled } from
|
|
7
|
-
import { typographyValues } from
|
|
8
|
-
import 'react-international-phone/style.css'
|
|
1
|
+
import { useFormContext } from "react-hook-form";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
import { FormLabel } from "./FormLabel";
|
|
4
|
+
import { ErrorFormMessage } from "./ErrorFormMessage";
|
|
5
|
+
// import { PhoneInput, PhoneInputProps } from 'react-international-phone'
|
|
6
|
+
import { styled } from "../../styles";
|
|
7
|
+
import { typographyValues } from "../../types/typographyValues";
|
|
8
|
+
// import 'react-international-phone/style.css'
|
|
9
9
|
|
|
10
|
-
export type PhoneFormFieldProps =
|
|
11
|
-
name: string
|
|
12
|
-
label?: string
|
|
13
|
-
required?: boolean
|
|
14
|
-
defaultCountry?: string
|
|
15
|
-
}
|
|
16
|
-
const PhoneFormInput = styled(PhoneInput, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
export type PhoneFormFieldProps = {
|
|
11
|
+
name: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
defaultCountry?: string;
|
|
15
|
+
};
|
|
16
|
+
// const PhoneFormInput = styled(PhoneInput, {
|
|
17
|
+
// $$borderColor: '$colors$neutral300',
|
|
18
|
+
// boxSizing: 'border-box',
|
|
19
|
+
// borderRadius: '$sm',
|
|
20
|
+
// display: 'flex',
|
|
21
|
+
// flex: 1,
|
|
22
|
+
// fontFamily: '$default',
|
|
23
|
+
// color: '$dark500',
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
// img: {
|
|
26
|
+
// width: '$18',
|
|
27
|
+
// height: '$18',
|
|
28
|
+
// marginLeft: '$8',
|
|
29
|
+
// },
|
|
30
|
+
// ul: {
|
|
31
|
+
// border: 'none',
|
|
32
|
+
// },
|
|
33
|
+
// input: {
|
|
34
|
+
// height: '$40 !important',
|
|
35
|
+
// flex: 1,
|
|
36
|
+
// borderColor: '$$borderColor !important',
|
|
37
|
+
// borderTopRightRadius: '$sm !important',
|
|
38
|
+
// borderBottomRightRadius: '$sm !important',
|
|
39
|
+
// fontSize: 'inherit !important',
|
|
40
|
+
// '&:focus': {
|
|
41
|
+
// $$borderColor: '$colors$brand300',
|
|
42
|
+
// },
|
|
43
|
+
// },
|
|
44
|
+
// button: {
|
|
45
|
+
// height: '$40 !important',
|
|
46
|
+
// borderRight: 'none',
|
|
47
|
+
// borderTopLeftRadius: '$sm !important',
|
|
48
|
+
// borderBottomLeftRadius: '$sm !important',
|
|
49
|
+
// borderColor: '$$borderColor !important',
|
|
50
|
+
// marginRight: '0 !important',
|
|
51
|
+
// '&:active': {
|
|
52
|
+
// $$borderColor: '$colors$brand300',
|
|
53
|
+
// },
|
|
54
|
+
// div: {
|
|
55
|
+
// padding: 'auto $12',
|
|
56
|
+
// gap: ' $8px',
|
|
57
|
+
// },
|
|
58
|
+
// },
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
60
|
+
// '&:has(input:disabled)': {
|
|
61
|
+
// backgroundColor: '$dark100',
|
|
62
|
+
// color: '$dark400',
|
|
63
|
+
// $$borderColor: '$colors$dark200',
|
|
64
|
+
// cursor: 'not-allowed',
|
|
65
|
+
// img: {
|
|
66
|
+
// opacity: 0.6,
|
|
67
|
+
// },
|
|
68
|
+
// button: {
|
|
69
|
+
// $$borderColor: '$colors$dark200',
|
|
70
|
+
// },
|
|
71
|
+
// },
|
|
72
|
+
// variants: {
|
|
73
|
+
// typography: typographyValues,
|
|
74
|
+
// color: {
|
|
75
|
+
// default: {
|
|
76
|
+
// $$borderColor: '$colors$neutral300',
|
|
77
|
+
// },
|
|
78
|
+
// error: {
|
|
79
|
+
// $$borderColor: '$colors$error600',
|
|
80
|
+
// },
|
|
81
|
+
// },
|
|
82
|
+
// },
|
|
83
|
+
// defaultVariants: {
|
|
84
|
+
// typography: 'labelSmall',
|
|
85
|
+
// color: 'default',
|
|
86
|
+
// },
|
|
87
|
+
// })
|
|
88
88
|
|
|
89
89
|
export const PhoneFormField = ({
|
|
90
90
|
name,
|
|
91
91
|
label,
|
|
92
92
|
required,
|
|
93
|
-
defaultCountry =
|
|
93
|
+
defaultCountry = "br",
|
|
94
94
|
...props
|
|
95
95
|
}: PhoneFormFieldProps) => {
|
|
96
96
|
const {
|
|
@@ -98,24 +98,24 @@ export const PhoneFormField = ({
|
|
|
98
98
|
formState: { errors },
|
|
99
99
|
setValue,
|
|
100
100
|
watch,
|
|
101
|
-
} = useFormContext()
|
|
101
|
+
} = useFormContext();
|
|
102
102
|
|
|
103
|
-
const haveError = !!errors[name]
|
|
104
|
-
const errorMsg = errors[name]?.message
|
|
103
|
+
const haveError = !!errors[name];
|
|
104
|
+
const errorMsg = errors[name]?.message;
|
|
105
105
|
|
|
106
106
|
const handlePhoneChange = (phone: string) => {
|
|
107
|
-
setValue(name, phone)
|
|
108
|
-
}
|
|
107
|
+
setValue(name, phone);
|
|
108
|
+
};
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
|
-
<Flex direction={
|
|
111
|
+
<Flex direction={"column"}>
|
|
112
112
|
<FormLabel
|
|
113
113
|
name={name}
|
|
114
114
|
label={label}
|
|
115
115
|
required={required}
|
|
116
116
|
haveError={haveError}
|
|
117
117
|
/>
|
|
118
|
-
<PhoneFormInput
|
|
118
|
+
{/* <PhoneFormInput
|
|
119
119
|
{...register(name, { required })}
|
|
120
120
|
defaultCountry={defaultCountry}
|
|
121
121
|
value={watch(name)}
|
|
@@ -123,8 +123,8 @@ export const PhoneFormField = ({
|
|
|
123
123
|
onChange={handlePhoneChange}
|
|
124
124
|
{...props}
|
|
125
125
|
aria-labelledby={`${name}-label`}
|
|
126
|
-
/>
|
|
126
|
+
/> */}
|
|
127
127
|
<ErrorFormMessage message={errorMsg} />
|
|
128
128
|
</Flex>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
129
|
+
);
|
|
130
|
+
};
|
|
@@ -4,12 +4,11 @@ import { FormLabel } from "./FormLabel";
|
|
|
4
4
|
import { ErrorFormMessage } from "./ErrorFormMessage";
|
|
5
5
|
import { TextareaField, TextareaFieldProps } from "../TextareaField";
|
|
6
6
|
|
|
7
|
-
export type TextAreaFormFieldProps = {
|
|
7
|
+
export type TextAreaFormFieldProps = TextareaFieldProps & {
|
|
8
8
|
name: string;
|
|
9
9
|
label?: string;
|
|
10
10
|
required?: boolean;
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
fieldProps?: TextareaFieldProps;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export const TextAreaFormField = ({
|
|
@@ -17,7 +16,7 @@ export const TextAreaFormField = ({
|
|
|
17
16
|
label,
|
|
18
17
|
required,
|
|
19
18
|
placeholder,
|
|
20
|
-
|
|
19
|
+
...props
|
|
21
20
|
}: TextAreaFormFieldProps) => {
|
|
22
21
|
const {
|
|
23
22
|
register,
|
|
@@ -37,7 +36,7 @@ export const TextAreaFormField = ({
|
|
|
37
36
|
haveError={haveError}
|
|
38
37
|
/>
|
|
39
38
|
<TextareaField
|
|
40
|
-
{...
|
|
39
|
+
{...props}
|
|
41
40
|
{...register(name, { required })}
|
|
42
41
|
placeholder={placeholder}
|
|
43
42
|
color={haveError ? "error" : "default"}
|