@lets-events/react 11.4.1 → 11.5.1
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 +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +129 -2
- package/dist/index.mjs +128 -2
- package/package.json +3 -2
- package/src/components/FormFields/PhoneFormField.tsx +130 -0
- package/src/components/FormFields/TextAreaFormField.tsx +4 -1
- package/src/index.tsx +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @lets-events/react@11.
|
|
2
|
+
> @lets-events/react@11.5.1 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[32m292.77 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 228ms
|
|
13
|
+
[32mCJS[39m [1mdist\index.js [22m[32m303.05 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 228ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist\index.d.mts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist\index.d.ts [22m[
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4041ms
|
|
17
|
+
[32mDTS[39m [1mdist\index.d.mts [22m[32m388.35 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist\index.d.ts [22m[32m388.35 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -14,6 +14,7 @@ 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';
|
|
17
18
|
|
|
18
19
|
interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
|
|
19
20
|
name: IconName;
|
|
@@ -14882,8 +14883,9 @@ type TextAreaFormFieldProps = {
|
|
|
14882
14883
|
label?: string;
|
|
14883
14884
|
required?: boolean;
|
|
14884
14885
|
placeholder?: string;
|
|
14886
|
+
fieldProps?: TextareaFieldProps;
|
|
14885
14887
|
};
|
|
14886
|
-
declare const TextAreaFormField: ({ name, label, required, placeholder, }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14888
|
+
declare const TextAreaFormField: ({ name, label, required, placeholder, fieldProps, }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14887
14889
|
|
|
14888
14890
|
type TextFormFieldProps = {
|
|
14889
14891
|
name: string;
|
|
@@ -14906,4 +14908,12 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
|
|
|
14906
14908
|
};
|
|
14907
14909
|
declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14908
14910
|
|
|
14909
|
-
|
|
14911
|
+
type PhoneFormFieldProps = PhoneInputProps & {
|
|
14912
|
+
name: string;
|
|
14913
|
+
label?: string;
|
|
14914
|
+
required?: boolean;
|
|
14915
|
+
defaultCountry?: string;
|
|
14916
|
+
};
|
|
14917
|
+
declare const PhoneFormField: ({ name, label, required, defaultCountry, ...props }: PhoneFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14918
|
+
|
|
14919
|
+
export { Alert, AlertDialogCompleteStyled, AlertDialogDescriptionStyled, AlertDialogRowStyled, AlertDialogSimpleStyled, AlertDialogSubtitleStyled, AlertDialogTitleStyled, AlertDialoghrStyled, type AlertProps, Avatar, type AvatarProps, AvatarStyled, Badge, type BadgeProps, BadgeStyled, Box, Button, ButtonGroup, type ButtonGroupProps, ButtonGroupStyled, ButtonItem, type ButtonItemProps, ButtonItemStyled, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, CardStyled, CheckboxGroup, type CheckboxGroupProps, CheckboxGroupStyled, CheckboxItem, type CheckboxItemProps, Container, type ContainerProps, ContainerStyled, Drawer, type DrawerProps, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ErrorFormMessage, type ErrorFormMessageProps, Filter, FilterItem, type FilterItemProps, type FilterProps, Flex, type FlexProps, FlexStyled, Form, FormLabel, type FormLabelProps, type FormProps, Grid, type GridProps, GridStyled, Icon, InputStyled, MenuDropdown, type MenuDropdownProps, Modal, type ModalProps, MultiSelect, MultiSelectFormField, type MultiSelectFormFieldProps, type MultiSelectProps, PhoneFormField, type PhoneFormFieldProps, RadioGroup, type RadioGroupProps, RadioGroupStyled, RadioItem, type RadioItemProps, Section, type SectionProps, SectionStyled, Step, StepContent, StepList, type StepProps, StepStyled, StepTrigger, StepWrapper, Switch, type SwitchProps, SwitchStyled, Text, TextAreaFormField, type TextAreaFormFieldProps, TextField, type TextFieldProps, TextFieldSlot, type TextFieldSlotProps, TextFieldSlotStyled, TextFieldStyled, TextFormField, type TextFormFieldProps, type TextProps, TextStyle, TextareaField, type TextareaFieldProps, TextareaFieldStyle, TimePicker, TimePickerButtonStyled, TimePickerDropdownStyled, TimePickerFooterStyled, type TimePickerProps, TimePickerStyled, TimerPickerContentStyled, type Toast, type ToastComponentProps, type ToastConfig, type ToastContextType, ToastItem, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastType, type ToasterShowOptions, Tooltip, TooltipContent, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, maskFormat, maskUnformat, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ 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';
|
|
17
18
|
|
|
18
19
|
interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
|
|
19
20
|
name: IconName;
|
|
@@ -14882,8 +14883,9 @@ type TextAreaFormFieldProps = {
|
|
|
14882
14883
|
label?: string;
|
|
14883
14884
|
required?: boolean;
|
|
14884
14885
|
placeholder?: string;
|
|
14886
|
+
fieldProps?: TextareaFieldProps;
|
|
14885
14887
|
};
|
|
14886
|
-
declare const TextAreaFormField: ({ name, label, required, placeholder, }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14888
|
+
declare const TextAreaFormField: ({ name, label, required, placeholder, fieldProps, }: TextAreaFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14887
14889
|
|
|
14888
14890
|
type TextFormFieldProps = {
|
|
14889
14891
|
name: string;
|
|
@@ -14906,4 +14908,12 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
|
|
|
14906
14908
|
};
|
|
14907
14909
|
declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14908
14910
|
|
|
14909
|
-
|
|
14911
|
+
type PhoneFormFieldProps = PhoneInputProps & {
|
|
14912
|
+
name: string;
|
|
14913
|
+
label?: string;
|
|
14914
|
+
required?: boolean;
|
|
14915
|
+
defaultCountry?: string;
|
|
14916
|
+
};
|
|
14917
|
+
declare const PhoneFormField: ({ name, label, required, defaultCountry, ...props }: PhoneFormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
14918
|
+
|
|
14919
|
+
export { Alert, AlertDialogCompleteStyled, AlertDialogDescriptionStyled, AlertDialogRowStyled, AlertDialogSimpleStyled, AlertDialogSubtitleStyled, AlertDialogTitleStyled, AlertDialoghrStyled, type AlertProps, Avatar, type AvatarProps, AvatarStyled, Badge, type BadgeProps, BadgeStyled, Box, Button, ButtonGroup, type ButtonGroupProps, ButtonGroupStyled, ButtonItem, type ButtonItemProps, ButtonItemStyled, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, CardStyled, CheckboxGroup, type CheckboxGroupProps, CheckboxGroupStyled, CheckboxItem, type CheckboxItemProps, Container, type ContainerProps, ContainerStyled, Drawer, type DrawerProps, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ErrorFormMessage, type ErrorFormMessageProps, Filter, FilterItem, type FilterItemProps, type FilterProps, Flex, type FlexProps, FlexStyled, Form, FormLabel, type FormLabelProps, type FormProps, Grid, type GridProps, GridStyled, Icon, InputStyled, MenuDropdown, type MenuDropdownProps, Modal, type ModalProps, MultiSelect, MultiSelectFormField, type MultiSelectFormFieldProps, type MultiSelectProps, PhoneFormField, type PhoneFormFieldProps, RadioGroup, type RadioGroupProps, RadioGroupStyled, RadioItem, type RadioItemProps, Section, type SectionProps, SectionStyled, Step, StepContent, StepList, type StepProps, StepStyled, StepTrigger, StepWrapper, Switch, type SwitchProps, SwitchStyled, Text, TextAreaFormField, type TextAreaFormFieldProps, TextField, type TextFieldProps, TextFieldSlot, type TextFieldSlotProps, TextFieldSlotStyled, TextFieldStyled, TextFormField, type TextFormFieldProps, type TextProps, TextStyle, TextareaField, type TextareaFieldProps, TextareaFieldStyle, TimePicker, TimePickerButtonStyled, TimePickerDropdownStyled, TimePickerFooterStyled, type TimePickerProps, TimePickerStyled, TimerPickerContentStyled, type Toast, type ToastComponentProps, type ToastConfig, type ToastContextType, ToastItem, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastType, type ToasterShowOptions, Tooltip, TooltipContent, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, maskFormat, maskUnformat, useToast };
|
package/dist/index.js
CHANGED
|
@@ -1055,6 +1055,7 @@ __export(index_exports, {
|
|
|
1055
1055
|
Modal: () => Modal,
|
|
1056
1056
|
MultiSelect: () => MultiSelect,
|
|
1057
1057
|
MultiSelectFormField: () => MultiSelectFormField,
|
|
1058
|
+
PhoneFormField: () => PhoneFormField,
|
|
1058
1059
|
RadioGroup: () => RadioGroup,
|
|
1059
1060
|
RadioGroupStyled: () => RadioGroupStyled,
|
|
1060
1061
|
RadioItem: () => RadioItem,
|
|
@@ -9653,7 +9654,8 @@ var TextAreaFormField = ({
|
|
|
9653
9654
|
name,
|
|
9654
9655
|
label,
|
|
9655
9656
|
required,
|
|
9656
|
-
placeholder
|
|
9657
|
+
placeholder,
|
|
9658
|
+
fieldProps
|
|
9657
9659
|
}) => {
|
|
9658
9660
|
var _a;
|
|
9659
9661
|
const {
|
|
@@ -9674,7 +9676,7 @@ var TextAreaFormField = ({
|
|
|
9674
9676
|
),
|
|
9675
9677
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9676
9678
|
TextareaField,
|
|
9677
|
-
__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9679
|
+
__spreadProps(__spreadValues(__spreadValues({}, fieldProps), register(name, { required })), {
|
|
9678
9680
|
placeholder,
|
|
9679
9681
|
color: haveError ? "error" : "default",
|
|
9680
9682
|
"aria-labelledby": `${name}-label`
|
|
@@ -9784,6 +9786,130 @@ var MultiSelectFormField = (_a) => {
|
|
|
9784
9786
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ErrorFormMessage, { message: errorMsg })
|
|
9785
9787
|
] });
|
|
9786
9788
|
};
|
|
9789
|
+
|
|
9790
|
+
// src/components/FormFields/PhoneFormField.tsx
|
|
9791
|
+
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
|
+
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
|
+
var PhoneFormField = (_a) => {
|
|
9866
|
+
var _b = _a, {
|
|
9867
|
+
name,
|
|
9868
|
+
label,
|
|
9869
|
+
required,
|
|
9870
|
+
defaultCountry = "br"
|
|
9871
|
+
} = _b, props = __objRest(_b, [
|
|
9872
|
+
"name",
|
|
9873
|
+
"label",
|
|
9874
|
+
"required",
|
|
9875
|
+
"defaultCountry"
|
|
9876
|
+
]);
|
|
9877
|
+
var _a2;
|
|
9878
|
+
const {
|
|
9879
|
+
register,
|
|
9880
|
+
formState: { errors },
|
|
9881
|
+
setValue,
|
|
9882
|
+
watch
|
|
9883
|
+
} = (0, import_react_hook_form5.useFormContext)();
|
|
9884
|
+
const haveError = !!errors[name];
|
|
9885
|
+
const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
|
|
9886
|
+
const handlePhoneChange = (phone) => {
|
|
9887
|
+
setValue(name, phone);
|
|
9888
|
+
};
|
|
9889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex2, { direction: "column", children: [
|
|
9890
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9891
|
+
FormLabel,
|
|
9892
|
+
{
|
|
9893
|
+
name,
|
|
9894
|
+
label,
|
|
9895
|
+
required,
|
|
9896
|
+
haveError
|
|
9897
|
+
}
|
|
9898
|
+
),
|
|
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
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorFormMessage, { message: errorMsg })
|
|
9911
|
+
] });
|
|
9912
|
+
};
|
|
9787
9913
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9788
9914
|
0 && (module.exports = {
|
|
9789
9915
|
Alert,
|
|
@@ -9830,6 +9956,7 @@ var MultiSelectFormField = (_a) => {
|
|
|
9830
9956
|
Modal,
|
|
9831
9957
|
MultiSelect,
|
|
9832
9958
|
MultiSelectFormField,
|
|
9959
|
+
PhoneFormField,
|
|
9833
9960
|
RadioGroup,
|
|
9834
9961
|
RadioGroupStyled,
|
|
9835
9962
|
RadioItem,
|
package/dist/index.mjs
CHANGED
|
@@ -9562,7 +9562,8 @@ var TextAreaFormField = ({
|
|
|
9562
9562
|
name,
|
|
9563
9563
|
label,
|
|
9564
9564
|
required,
|
|
9565
|
-
placeholder
|
|
9565
|
+
placeholder,
|
|
9566
|
+
fieldProps
|
|
9566
9567
|
}) => {
|
|
9567
9568
|
var _a;
|
|
9568
9569
|
const {
|
|
@@ -9583,7 +9584,7 @@ var TextAreaFormField = ({
|
|
|
9583
9584
|
),
|
|
9584
9585
|
/* @__PURE__ */ jsx32(
|
|
9585
9586
|
TextareaField,
|
|
9586
|
-
__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9587
|
+
__spreadProps(__spreadValues(__spreadValues({}, fieldProps), register(name, { required })), {
|
|
9587
9588
|
placeholder,
|
|
9588
9589
|
color: haveError ? "error" : "default",
|
|
9589
9590
|
"aria-labelledby": `${name}-label`
|
|
@@ -9696,6 +9697,130 @@ var MultiSelectFormField = (_a) => {
|
|
|
9696
9697
|
/* @__PURE__ */ jsx35(ErrorFormMessage, { message: errorMsg })
|
|
9697
9698
|
] });
|
|
9698
9699
|
};
|
|
9700
|
+
|
|
9701
|
+
// src/components/FormFields/PhoneFormField.tsx
|
|
9702
|
+
import { useFormContext as useFormContext4 } from "react-hook-form";
|
|
9703
|
+
import { PhoneInput } from "react-international-phone";
|
|
9704
|
+
import "react-international-phone/style.css";
|
|
9705
|
+
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
|
+
var PhoneFormField = (_a) => {
|
|
9777
|
+
var _b = _a, {
|
|
9778
|
+
name,
|
|
9779
|
+
label,
|
|
9780
|
+
required,
|
|
9781
|
+
defaultCountry = "br"
|
|
9782
|
+
} = _b, props = __objRest(_b, [
|
|
9783
|
+
"name",
|
|
9784
|
+
"label",
|
|
9785
|
+
"required",
|
|
9786
|
+
"defaultCountry"
|
|
9787
|
+
]);
|
|
9788
|
+
var _a2;
|
|
9789
|
+
const {
|
|
9790
|
+
register,
|
|
9791
|
+
formState: { errors },
|
|
9792
|
+
setValue,
|
|
9793
|
+
watch
|
|
9794
|
+
} = useFormContext4();
|
|
9795
|
+
const haveError = !!errors[name];
|
|
9796
|
+
const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
|
|
9797
|
+
const handlePhoneChange = (phone) => {
|
|
9798
|
+
setValue(name, phone);
|
|
9799
|
+
};
|
|
9800
|
+
return /* @__PURE__ */ jsxs20(Flex2, { direction: "column", children: [
|
|
9801
|
+
/* @__PURE__ */ jsx36(
|
|
9802
|
+
FormLabel,
|
|
9803
|
+
{
|
|
9804
|
+
name,
|
|
9805
|
+
label,
|
|
9806
|
+
required,
|
|
9807
|
+
haveError
|
|
9808
|
+
}
|
|
9809
|
+
),
|
|
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
|
+
/* @__PURE__ */ jsx36(ErrorFormMessage, { message: errorMsg })
|
|
9822
|
+
] });
|
|
9823
|
+
};
|
|
9699
9824
|
export {
|
|
9700
9825
|
Alert,
|
|
9701
9826
|
AlertDialogCompleteStyled,
|
|
@@ -9741,6 +9866,7 @@ export {
|
|
|
9741
9866
|
Modal,
|
|
9742
9867
|
MultiSelect,
|
|
9743
9868
|
MultiSelectFormField,
|
|
9869
|
+
PhoneFormField,
|
|
9744
9870
|
RadioGroup,
|
|
9745
9871
|
RadioGroupStyled,
|
|
9746
9872
|
RadioItem,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lets-events/react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -40,6 +40,7 @@
|
|
|
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"
|
|
43
|
+
"react-hook-form": "^7.57.0",
|
|
44
|
+
"react-international-phone": "^4.5.0"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
|
|
10
|
+
export type PhoneFormFieldProps = PhoneInputProps & {
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
89
|
+
export const PhoneFormField = ({
|
|
90
|
+
name,
|
|
91
|
+
label,
|
|
92
|
+
required,
|
|
93
|
+
defaultCountry = 'br',
|
|
94
|
+
...props
|
|
95
|
+
}: PhoneFormFieldProps) => {
|
|
96
|
+
const {
|
|
97
|
+
register,
|
|
98
|
+
formState: { errors },
|
|
99
|
+
setValue,
|
|
100
|
+
watch,
|
|
101
|
+
} = useFormContext()
|
|
102
|
+
|
|
103
|
+
const haveError = !!errors[name]
|
|
104
|
+
const errorMsg = errors[name]?.message
|
|
105
|
+
|
|
106
|
+
const handlePhoneChange = (phone: string) => {
|
|
107
|
+
setValue(name, phone)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Flex direction={'column'}>
|
|
112
|
+
<FormLabel
|
|
113
|
+
name={name}
|
|
114
|
+
label={label}
|
|
115
|
+
required={required}
|
|
116
|
+
haveError={haveError}
|
|
117
|
+
/>
|
|
118
|
+
<PhoneFormInput
|
|
119
|
+
{...register(name, { required })}
|
|
120
|
+
defaultCountry={defaultCountry}
|
|
121
|
+
value={watch(name)}
|
|
122
|
+
color={haveError ? 'error' : 'default'}
|
|
123
|
+
onChange={handlePhoneChange}
|
|
124
|
+
{...props}
|
|
125
|
+
aria-labelledby={`${name}-label`}
|
|
126
|
+
/>
|
|
127
|
+
<ErrorFormMessage message={errorMsg} />
|
|
128
|
+
</Flex>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
@@ -2,13 +2,14 @@ import { useFormContext } from "react-hook-form";
|
|
|
2
2
|
import { Flex } from "../Flex";
|
|
3
3
|
import { FormLabel } from "./FormLabel";
|
|
4
4
|
import { ErrorFormMessage } from "./ErrorFormMessage";
|
|
5
|
-
import { TextareaField } from "../TextareaField";
|
|
5
|
+
import { TextareaField, TextareaFieldProps } from "../TextareaField";
|
|
6
6
|
|
|
7
7
|
export type TextAreaFormFieldProps = {
|
|
8
8
|
name: string;
|
|
9
9
|
label?: string;
|
|
10
10
|
required?: boolean;
|
|
11
11
|
placeholder?: string;
|
|
12
|
+
fieldProps?: TextareaFieldProps;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export const TextAreaFormField = ({
|
|
@@ -16,6 +17,7 @@ export const TextAreaFormField = ({
|
|
|
16
17
|
label,
|
|
17
18
|
required,
|
|
18
19
|
placeholder,
|
|
20
|
+
fieldProps,
|
|
19
21
|
}: TextAreaFormFieldProps) => {
|
|
20
22
|
const {
|
|
21
23
|
register,
|
|
@@ -35,6 +37,7 @@ export const TextAreaFormField = ({
|
|
|
35
37
|
haveError={haveError}
|
|
36
38
|
/>
|
|
37
39
|
<TextareaField
|
|
40
|
+
{...fieldProps}
|
|
38
41
|
{...register(name, { required })}
|
|
39
42
|
placeholder={placeholder}
|
|
40
43
|
color={haveError ? "error" : "default"}
|
package/src/index.tsx
CHANGED
|
@@ -42,3 +42,4 @@ export * from "./components/FormFields/TextAreaFormField";
|
|
|
42
42
|
export * from "./components/FormFields/TextFormField";
|
|
43
43
|
export * from "./components/FormFields/Form";
|
|
44
44
|
export * from "./components/FormFields/MultiSelectFormField";
|
|
45
|
+
export * from "./components/FormFields/PhoneFormField";
|