formik-form-components 0.2.24 → 0.2.25

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/dist/index.mjs CHANGED
@@ -12,8 +12,8 @@ import Autocomplete3 from '@mui/material/Autocomplete';
12
12
  import Typography9 from '@mui/material/Typography';
13
13
  import { Icon } from '@iconify/react';
14
14
  import Select from '@mui/material/Select';
15
- import PhoneInputComponent from 'react-phone-input-2';
16
- import 'react-phone-input-2/lib/style.css';
15
+ import PhoneInput from 'react-phone-number-input';
16
+ import 'react-phone-number-input/style.css';
17
17
  import { useEditor, EditorContent } from '@tiptap/react';
18
18
  import StarterKit from '@tiptap/starter-kit';
19
19
  import Link from '@tiptap/extension-link';
@@ -1475,18 +1475,19 @@ var AppMultiSelector = forwardRef(
1475
1475
  );
1476
1476
  AppMultiSelector.displayName = "AppMultiSelector";
1477
1477
  var AppMultiSelector_default = AppMultiSelector;
1478
- var PhoneInput = PhoneInputComponent;
1479
1478
  var AppPhoneNoInput = ({
1480
1479
  name,
1481
1480
  label,
1482
1481
  required = false,
1483
- defaultCountry = "us",
1484
- placeholder,
1482
+ defaultCountry = "US",
1483
+ placeholder = "Enter phone number",
1485
1484
  sx,
1486
1485
  containerSx,
1487
1486
  labelSx,
1488
1487
  inputSx,
1489
- errorSx
1488
+ errorSx,
1489
+ international = true,
1490
+ withCountryCallingCode = true
1490
1491
  }) => {
1491
1492
  const { values, errors, touched, setFieldValue, setFieldTouched } = useFormikContext();
1492
1493
  const fieldError = useMemo(() => _19.get(errors, name), [errors, name]);
@@ -1525,32 +1526,39 @@ var AppPhoneNoInput = ({
1525
1526
  }
1526
1527
  ),
1527
1528
  /* @__PURE__ */ jsx(
1528
- PhoneInput,
1529
+ Box,
1529
1530
  {
1530
- country: defaultCountry,
1531
- specialLabel: "",
1532
- placeholder,
1533
- inputProps: {
1534
- name,
1535
- id: name,
1536
- required,
1537
- "aria-describedby": fieldError ? `${name}-error` : void 0,
1538
- "aria-invalid": !!fieldError,
1539
- "aria-required": required
1540
- },
1541
- inputStyle: {
1542
- width: "100%",
1543
- border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1544
- padding: "10px",
1545
- borderRadius: "4px",
1546
- ...inputSx
1547
- },
1548
- containerStyle: {
1549
- width: "100%"
1531
+ sx: {
1532
+ "& .PhoneInput": {
1533
+ width: "100%"
1534
+ },
1535
+ "& .PhoneInputInput": {
1536
+ width: "100%",
1537
+ border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1538
+ padding: "10px",
1539
+ borderRadius: "4px",
1540
+ fontFamily: "inherit",
1541
+ fontSize: "inherit",
1542
+ ...inputSx
1543
+ },
1544
+ "& .PhoneInputCountrySelect": {
1545
+ border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1546
+ borderRadius: "4px"
1547
+ }
1550
1548
  },
1551
- value: values[name],
1552
- onChange: (value) => setFieldValue(name, value),
1553
- onBlur: () => setFieldTouched(name, true)
1549
+ children: /* @__PURE__ */ jsx(
1550
+ PhoneInput,
1551
+ {
1552
+ international,
1553
+ withCountryCallingCode,
1554
+ defaultCountry,
1555
+ placeholder,
1556
+ value: values[name],
1557
+ onChange: (value) => setFieldValue(name, value || ""),
1558
+ onBlur: () => setFieldTouched(name, true),
1559
+ error: fieldError ? "Invalid phone number" : void 0
1560
+ }
1561
+ )
1554
1562
  }
1555
1563
  ),
1556
1564
  isTouched && fieldError && /* @__PURE__ */ jsx(