@lets-events/react 11.4.1 → 11.5.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.
Files changed (59) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +20 -18
  3. package/CHANGELOG.md +6 -0
  4. package/dist/index.d.mts +10 -1
  5. package/dist/index.d.ts +10 -1
  6. package/dist/index.js +126 -0
  7. package/dist/index.mjs +125 -0
  8. package/package.json +3 -2
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +125 -125
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +16 -16
  14. package/src/components/Button/styledComponents.ts +287 -287
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +136 -136
  17. package/src/components/Calendar/styledComponents.ts +209 -209
  18. package/src/components/Card.tsx +48 -48
  19. package/src/components/CheckboxGroup.tsx +196 -196
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Drawer/index.tsx +48 -48
  22. package/src/components/Drawer/styledComponents.ts +46 -46
  23. package/src/components/Dropdown.tsx +167 -167
  24. package/src/components/Filter.tsx +164 -164
  25. package/src/components/Flex.tsx +118 -118
  26. package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
  27. package/src/components/FormFields/Form.tsx +25 -25
  28. package/src/components/FormFields/FormLabel.tsx +29 -29
  29. package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
  30. package/src/components/FormFields/PhoneFormField.tsx +130 -0
  31. package/src/components/FormFields/TextAreaFormField.tsx +46 -46
  32. package/src/components/FormFields/TextFormField.tsx +46 -46
  33. package/src/components/Grid.tsx +137 -137
  34. package/src/components/Icon.tsx +47 -47
  35. package/src/components/MenuDropdown/index.tsx +30 -30
  36. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  37. package/src/components/Modal.tsx +90 -90
  38. package/src/components/MultiSelect.tsx +218 -218
  39. package/src/components/RadioGroup.tsx +210 -210
  40. package/src/components/Section.tsx +33 -33
  41. package/src/components/Step.tsx +164 -164
  42. package/src/components/Switch.tsx +108 -108
  43. package/src/components/Text.tsx +38 -38
  44. package/src/components/TextField.tsx +315 -315
  45. package/src/components/TextareaField.tsx +128 -128
  46. package/src/components/TimePicker.tsx +298 -298
  47. package/src/components/Toast/components/ToastItem.tsx +41 -41
  48. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  49. package/src/components/Toast/hooks/useToast.ts +12 -12
  50. package/src/components/Toast/index.tsx +5 -5
  51. package/src/components/Toast/styles/index.ts +135 -135
  52. package/src/components/Toast/types/index.ts +46 -46
  53. package/src/components/Tooltip/index.tsx +66 -66
  54. package/src/components/Tooltip/styles.ts +77 -77
  55. package/src/hooks/useOnClickOutside.tsx +20 -20
  56. package/src/index.tsx +45 -44
  57. package/src/styles/index.ts +38 -38
  58. package/src/types/typographyValues.ts +178 -178
  59. package/tsconfig.json +3 -3
package/.eslintrc.json CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "@lets-events/eslint-config"
1
+ {
2
+ "extends": "@lets-events/eslint-config"
3
3
  }
@@ -1,18 +1,20 @@
1
-
2
- > @lets-events/react@11.4.1 build
3
- > tsup src/index.tsx --format esm,cjs --dts --external react
4
-
5
- CLI Building entry: src/index.tsx
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.4.0
8
- CLI Target: es6
9
- ESM Build start
10
- CJS Build start
11
- CJS dist\index.js 299.90 KB
12
- CJS ⚡️ Build success in 233ms
13
- ESM dist\index.mjs 289.83 KB
14
- ESM ⚡️ Build success in 235ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 4108ms
17
- DTS dist\index.d.mts 387.93 KB
18
- DTS dist\index.d.ts 387.93 KB
1
+
2
+
3
+ > @lets-events/react@11.5.0 build
4
+ > tsup src/index.tsx --format esm,cjs --dts --external react
5
+
6
+ CLI Building entry: src/index.tsx
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.4.0
9
+ CLI Target: es6
10
+ ESM Build start
11
+ CJS Build start
12
+ ESM dist/index.mjs 292.73 KB
13
+ ESM ⚡️ Build success in 384ms
14
+ CJS dist/index.js 303.01 KB
15
+ CJS ⚡️ Build success in 385ms
16
+ DTS Build start
17
+ DTS ⚡️ Build success in 6708ms
18
+ DTS dist/index.d.mts 388.30 KB
19
+ DTS dist/index.d.ts 388.30 KB
20
+ ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 11.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Phone Input added
8
+
3
9
  ## 11.4.1
4
10
 
5
11
  ### Patch Changes
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;
@@ -14906,4 +14907,12 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
14906
14907
  };
14907
14908
  declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
14908
14909
 
14909
- 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, 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 };
14910
+ type PhoneFormFieldProps = PhoneInputProps & {
14911
+ name: string;
14912
+ label?: string;
14913
+ required?: boolean;
14914
+ defaultCountry?: string;
14915
+ };
14916
+ declare const PhoneFormField: ({ name, label, required, defaultCountry, ...props }: PhoneFormFieldProps) => react_jsx_runtime.JSX.Element;
14917
+
14918
+ 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;
@@ -14906,4 +14907,12 @@ type MultiSelectFormFieldProps = MultiSelectProps & {
14906
14907
  };
14907
14908
  declare const MultiSelectFormField: ({ name, label, required, ...rest }: MultiSelectFormFieldProps) => react_jsx_runtime.JSX.Element;
14908
14909
 
14909
- 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, 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 };
14910
+ type PhoneFormFieldProps = PhoneInputProps & {
14911
+ name: string;
14912
+ label?: string;
14913
+ required?: boolean;
14914
+ defaultCountry?: string;
14915
+ };
14916
+ declare const PhoneFormField: ({ name, label, required, defaultCountry, ...props }: PhoneFormFieldProps) => react_jsx_runtime.JSX.Element;
14917
+
14918
+ 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,
@@ -9784,6 +9785,130 @@ var MultiSelectFormField = (_a) => {
9784
9785
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ErrorFormMessage, { message: errorMsg })
9785
9786
  ] });
9786
9787
  };
9788
+
9789
+ // src/components/FormFields/PhoneFormField.tsx
9790
+ var import_react_hook_form5 = require("react-hook-form");
9791
+ var import_react_international_phone = require("react-international-phone");
9792
+ var import_style = require("react-international-phone/style.css");
9793
+ var import_jsx_runtime36 = require("react/jsx-runtime");
9794
+ var PhoneFormInput = styled(import_react_international_phone.PhoneInput, {
9795
+ $$borderColor: "$colors$neutral300",
9796
+ boxSizing: "border-box",
9797
+ borderRadius: "$sm",
9798
+ display: "flex",
9799
+ flex: 1,
9800
+ fontFamily: "$default",
9801
+ color: "$dark500",
9802
+ img: {
9803
+ width: "$18",
9804
+ height: "$18",
9805
+ marginLeft: "$8"
9806
+ },
9807
+ ul: {
9808
+ border: "none"
9809
+ },
9810
+ input: {
9811
+ height: "$40 !important",
9812
+ flex: 1,
9813
+ borderColor: "$$borderColor !important",
9814
+ borderTopRightRadius: "$sm !important",
9815
+ borderBottomRightRadius: "$sm !important",
9816
+ fontSize: "inherit !important",
9817
+ "&:focus": {
9818
+ $$borderColor: "$colors$brand300"
9819
+ }
9820
+ },
9821
+ button: {
9822
+ height: "$40 !important",
9823
+ borderRight: "none",
9824
+ borderTopLeftRadius: "$sm !important",
9825
+ borderBottomLeftRadius: "$sm !important",
9826
+ borderColor: "$$borderColor !important",
9827
+ marginRight: "0 !important",
9828
+ "&:active": {
9829
+ $$borderColor: "$colors$brand300"
9830
+ },
9831
+ div: {
9832
+ padding: "auto $12",
9833
+ gap: " $8px"
9834
+ }
9835
+ },
9836
+ "&:has(input:disabled)": {
9837
+ backgroundColor: "$dark100",
9838
+ color: "$dark400",
9839
+ $$borderColor: "$colors$dark200",
9840
+ cursor: "not-allowed",
9841
+ img: {
9842
+ opacity: 0.6
9843
+ },
9844
+ button: {
9845
+ $$borderColor: "$colors$dark200"
9846
+ }
9847
+ },
9848
+ variants: {
9849
+ typography: typographyValues,
9850
+ color: {
9851
+ default: {
9852
+ $$borderColor: "$colors$neutral300"
9853
+ },
9854
+ error: {
9855
+ $$borderColor: "$colors$error600"
9856
+ }
9857
+ }
9858
+ },
9859
+ defaultVariants: {
9860
+ typography: "labelSmall",
9861
+ color: "default"
9862
+ }
9863
+ });
9864
+ var PhoneFormField = (_a) => {
9865
+ var _b = _a, {
9866
+ name,
9867
+ label,
9868
+ required,
9869
+ defaultCountry = "br"
9870
+ } = _b, props = __objRest(_b, [
9871
+ "name",
9872
+ "label",
9873
+ "required",
9874
+ "defaultCountry"
9875
+ ]);
9876
+ var _a2;
9877
+ const {
9878
+ register,
9879
+ formState: { errors },
9880
+ setValue,
9881
+ watch
9882
+ } = (0, import_react_hook_form5.useFormContext)();
9883
+ const haveError = !!errors[name];
9884
+ const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
9885
+ const handlePhoneChange = (phone) => {
9886
+ setValue(name, phone);
9887
+ };
9888
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex2, { direction: "column", children: [
9889
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
9890
+ FormLabel,
9891
+ {
9892
+ name,
9893
+ label,
9894
+ required,
9895
+ haveError
9896
+ }
9897
+ ),
9898
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
9899
+ PhoneFormInput,
9900
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, register(name, { required })), {
9901
+ defaultCountry,
9902
+ value: watch(name),
9903
+ color: haveError ? "error" : "default",
9904
+ onChange: handlePhoneChange
9905
+ }), props), {
9906
+ "aria-labelledby": `${name}-label`
9907
+ })
9908
+ ),
9909
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorFormMessage, { message: errorMsg })
9910
+ ] });
9911
+ };
9787
9912
  // Annotate the CommonJS export names for ESM import in node:
9788
9913
  0 && (module.exports = {
9789
9914
  Alert,
@@ -9830,6 +9955,7 @@ var MultiSelectFormField = (_a) => {
9830
9955
  Modal,
9831
9956
  MultiSelect,
9832
9957
  MultiSelectFormField,
9958
+ PhoneFormField,
9833
9959
  RadioGroup,
9834
9960
  RadioGroupStyled,
9835
9961
  RadioItem,
package/dist/index.mjs CHANGED
@@ -9696,6 +9696,130 @@ var MultiSelectFormField = (_a) => {
9696
9696
  /* @__PURE__ */ jsx35(ErrorFormMessage, { message: errorMsg })
9697
9697
  ] });
9698
9698
  };
9699
+
9700
+ // src/components/FormFields/PhoneFormField.tsx
9701
+ import { useFormContext as useFormContext4 } from "react-hook-form";
9702
+ import { PhoneInput } from "react-international-phone";
9703
+ import "react-international-phone/style.css";
9704
+ import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
9705
+ var PhoneFormInput = styled(PhoneInput, {
9706
+ $$borderColor: "$colors$neutral300",
9707
+ boxSizing: "border-box",
9708
+ borderRadius: "$sm",
9709
+ display: "flex",
9710
+ flex: 1,
9711
+ fontFamily: "$default",
9712
+ color: "$dark500",
9713
+ img: {
9714
+ width: "$18",
9715
+ height: "$18",
9716
+ marginLeft: "$8"
9717
+ },
9718
+ ul: {
9719
+ border: "none"
9720
+ },
9721
+ input: {
9722
+ height: "$40 !important",
9723
+ flex: 1,
9724
+ borderColor: "$$borderColor !important",
9725
+ borderTopRightRadius: "$sm !important",
9726
+ borderBottomRightRadius: "$sm !important",
9727
+ fontSize: "inherit !important",
9728
+ "&:focus": {
9729
+ $$borderColor: "$colors$brand300"
9730
+ }
9731
+ },
9732
+ button: {
9733
+ height: "$40 !important",
9734
+ borderRight: "none",
9735
+ borderTopLeftRadius: "$sm !important",
9736
+ borderBottomLeftRadius: "$sm !important",
9737
+ borderColor: "$$borderColor !important",
9738
+ marginRight: "0 !important",
9739
+ "&:active": {
9740
+ $$borderColor: "$colors$brand300"
9741
+ },
9742
+ div: {
9743
+ padding: "auto $12",
9744
+ gap: " $8px"
9745
+ }
9746
+ },
9747
+ "&:has(input:disabled)": {
9748
+ backgroundColor: "$dark100",
9749
+ color: "$dark400",
9750
+ $$borderColor: "$colors$dark200",
9751
+ cursor: "not-allowed",
9752
+ img: {
9753
+ opacity: 0.6
9754
+ },
9755
+ button: {
9756
+ $$borderColor: "$colors$dark200"
9757
+ }
9758
+ },
9759
+ variants: {
9760
+ typography: typographyValues,
9761
+ color: {
9762
+ default: {
9763
+ $$borderColor: "$colors$neutral300"
9764
+ },
9765
+ error: {
9766
+ $$borderColor: "$colors$error600"
9767
+ }
9768
+ }
9769
+ },
9770
+ defaultVariants: {
9771
+ typography: "labelSmall",
9772
+ color: "default"
9773
+ }
9774
+ });
9775
+ var PhoneFormField = (_a) => {
9776
+ var _b = _a, {
9777
+ name,
9778
+ label,
9779
+ required,
9780
+ defaultCountry = "br"
9781
+ } = _b, props = __objRest(_b, [
9782
+ "name",
9783
+ "label",
9784
+ "required",
9785
+ "defaultCountry"
9786
+ ]);
9787
+ var _a2;
9788
+ const {
9789
+ register,
9790
+ formState: { errors },
9791
+ setValue,
9792
+ watch
9793
+ } = useFormContext4();
9794
+ const haveError = !!errors[name];
9795
+ const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
9796
+ const handlePhoneChange = (phone) => {
9797
+ setValue(name, phone);
9798
+ };
9799
+ return /* @__PURE__ */ jsxs20(Flex2, { direction: "column", children: [
9800
+ /* @__PURE__ */ jsx36(
9801
+ FormLabel,
9802
+ {
9803
+ name,
9804
+ label,
9805
+ required,
9806
+ haveError
9807
+ }
9808
+ ),
9809
+ /* @__PURE__ */ jsx36(
9810
+ PhoneFormInput,
9811
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, register(name, { required })), {
9812
+ defaultCountry,
9813
+ value: watch(name),
9814
+ color: haveError ? "error" : "default",
9815
+ onChange: handlePhoneChange
9816
+ }), props), {
9817
+ "aria-labelledby": `${name}-label`
9818
+ })
9819
+ ),
9820
+ /* @__PURE__ */ jsx36(ErrorFormMessage, { message: errorMsg })
9821
+ ] });
9822
+ };
9699
9823
  export {
9700
9824
  Alert,
9701
9825
  AlertDialogCompleteStyled,
@@ -9741,6 +9865,7 @@ export {
9741
9865
  Modal,
9742
9866
  MultiSelect,
9743
9867
  MultiSelectFormField,
9868
+ PhoneFormField,
9744
9869
  RadioGroup,
9745
9870
  RadioGroupStyled,
9746
9871
  RadioItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "11.4.1",
3
+ "version": "11.5.0",
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
  }