formik-form-components 0.2.20 → 0.2.22
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.d.ts +2 -1
- package/dist/index.js +87 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -325,12 +325,13 @@ interface AppPhoneNoInputProps {
|
|
|
325
325
|
name: string;
|
|
326
326
|
label?: string;
|
|
327
327
|
required?: boolean;
|
|
328
|
+
defaultCountry?: string;
|
|
329
|
+
placeholder?: string;
|
|
328
330
|
sx?: SxProps<Theme>;
|
|
329
331
|
containerSx?: SxProps<Theme>;
|
|
330
332
|
labelSx?: SxProps<Theme>;
|
|
331
333
|
inputSx?: React__default.CSSProperties;
|
|
332
334
|
errorSx?: SxProps<Theme>;
|
|
333
|
-
[key: string]: unknown;
|
|
334
335
|
}
|
|
335
336
|
declare const AppPhoneNoInput: React__default.FC<AppPhoneNoInputProps>;
|
|
336
337
|
|
package/dist/index.js
CHANGED
|
@@ -1506,79 +1506,99 @@ var AppMultiSelector_default = AppMultiSelector;
|
|
|
1506
1506
|
var AppPhoneNoInput = ({
|
|
1507
1507
|
name,
|
|
1508
1508
|
label,
|
|
1509
|
-
required,
|
|
1509
|
+
required = false,
|
|
1510
|
+
defaultCountry = "us",
|
|
1511
|
+
placeholder,
|
|
1510
1512
|
sx,
|
|
1511
1513
|
containerSx,
|
|
1512
1514
|
labelSx,
|
|
1513
1515
|
inputSx,
|
|
1514
|
-
errorSx
|
|
1515
|
-
...otherProps
|
|
1516
|
+
errorSx
|
|
1516
1517
|
}) => {
|
|
1517
|
-
const { values, errors, touched, setFieldValue,
|
|
1518
|
-
const fieldError = _19__default.default.get(errors, name);
|
|
1519
|
-
const isTouched = _19__default.default.get(touched, name);
|
|
1520
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
{
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
component: "span",
|
|
1535
|
-
sx: {
|
|
1536
|
-
color: "error.main",
|
|
1537
|
-
ml: 0.3
|
|
1518
|
+
const { values, errors, touched, setFieldValue, setFieldTouched } = formik.useFormikContext();
|
|
1519
|
+
const fieldError = react.useMemo(() => _19__default.default.get(errors, name), [errors, name]);
|
|
1520
|
+
const isTouched = react.useMemo(() => _19__default.default.get(touched, name), [touched, name]);
|
|
1521
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1522
|
+
material.Box,
|
|
1523
|
+
{
|
|
1524
|
+
sx: [{ mb: 2 }, containerSx, sx],
|
|
1525
|
+
"data-testid": `phone-input-${name}`,
|
|
1526
|
+
children: [
|
|
1527
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1528
|
+
material.Typography,
|
|
1529
|
+
{
|
|
1530
|
+
variant: "subtitle2",
|
|
1531
|
+
sx: [
|
|
1532
|
+
{
|
|
1533
|
+
mb: 0.5,
|
|
1534
|
+
color: isTouched && fieldError ? "error.main" : "text.primary"
|
|
1538
1535
|
},
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1536
|
+
labelSx
|
|
1537
|
+
],
|
|
1538
|
+
children: [
|
|
1539
|
+
label,
|
|
1540
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1541
|
+
material.Typography,
|
|
1542
|
+
{
|
|
1543
|
+
component: "span",
|
|
1544
|
+
sx: {
|
|
1545
|
+
color: "error.main",
|
|
1546
|
+
ml: 0.3
|
|
1547
|
+
},
|
|
1548
|
+
children: "*"
|
|
1549
|
+
}
|
|
1550
|
+
)
|
|
1551
|
+
]
|
|
1552
|
+
}
|
|
1553
|
+
),
|
|
1554
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1555
|
+
PhoneInput__default.default,
|
|
1556
|
+
{
|
|
1557
|
+
country: defaultCountry,
|
|
1558
|
+
specialLabel: "",
|
|
1559
|
+
placeholder,
|
|
1560
|
+
inputProps: {
|
|
1561
|
+
name,
|
|
1562
|
+
id: name,
|
|
1563
|
+
required,
|
|
1564
|
+
"aria-describedby": fieldError ? `${name}-error` : void 0,
|
|
1565
|
+
"aria-invalid": !!fieldError,
|
|
1566
|
+
"aria-required": required
|
|
1567
|
+
},
|
|
1568
|
+
inputStyle: {
|
|
1569
|
+
width: "100%",
|
|
1570
|
+
border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
|
|
1571
|
+
padding: "10px",
|
|
1572
|
+
borderRadius: "4px",
|
|
1573
|
+
...inputSx
|
|
1574
|
+
},
|
|
1575
|
+
containerStyle: {
|
|
1576
|
+
width: "100%"
|
|
1577
|
+
},
|
|
1578
|
+
value: values[name],
|
|
1579
|
+
onChange: (value) => setFieldValue(name, value),
|
|
1580
|
+
onBlur: () => setFieldTouched(name, true)
|
|
1581
|
+
}
|
|
1582
|
+
),
|
|
1583
|
+
isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1584
|
+
material.Typography,
|
|
1585
|
+
{
|
|
1586
|
+
variant: "caption",
|
|
1587
|
+
id: `${name}-error`,
|
|
1588
|
+
sx: [
|
|
1589
|
+
{
|
|
1590
|
+
mt: 0.5,
|
|
1591
|
+
display: "block",
|
|
1592
|
+
color: "error.main"
|
|
1593
|
+
},
|
|
1594
|
+
errorSx
|
|
1595
|
+
],
|
|
1596
|
+
children: String(fieldError)
|
|
1597
|
+
}
|
|
1598
|
+
)
|
|
1599
|
+
]
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1582
1602
|
};
|
|
1583
1603
|
var AppPhoneNoInput_default = AppPhoneNoInput;
|
|
1584
1604
|
var AppRadioGroup = react.forwardRef(({
|