tp-react-elements-dev 1.4.10 → 1.4.13
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.esm.js +29 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52102,7 +52102,7 @@ const PasswordField = ({ props }) => {
|
|
|
52102
52102
|
const handleTogglePasswordVisibility = () => {
|
|
52103
52103
|
setShowPassword((prevShowPassword) => !prevShowPassword);
|
|
52104
52104
|
};
|
|
52105
|
-
return (jsxRuntimeExports.jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [" ", jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ sx: { position: "relative" } }, { children: [" ", jsxRuntimeExports.jsx(TextField, Object.assign({ size: "small", type: showPassword ? "text" : "password" }, field, { label: `${props.item.label}${props.item.required ? ' *' : ''}`, sx: {
|
|
52105
|
+
return (jsxRuntimeExports.jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [" ", jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ sx: { position: "relative" } }, { children: [" ", jsxRuntimeExports.jsx(TextField, Object.assign({ size: "small", type: showPassword ? "text" : "password", placeholder: props.item.placeholder || "" }, field, { label: `${props.item.label}${props.item.required ? ' *' : ''}`, sx: {
|
|
52106
52106
|
width: "100%",
|
|
52107
52107
|
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
52108
52108
|
top: "-8px",
|
|
@@ -52268,14 +52268,25 @@ const SingleSelectNonAutoComplete = ({ props }) => {
|
|
|
52268
52268
|
};
|
|
52269
52269
|
|
|
52270
52270
|
const FormActiveSwitch = ({ props }) => {
|
|
52271
|
-
const
|
|
52272
|
-
const
|
|
52273
|
-
|
|
52274
|
-
};
|
|
52271
|
+
const { getValues, setValue, item } = props;
|
|
52272
|
+
const [active, setActive] = React$1.useState(true);
|
|
52273
|
+
const data = getValues(item.name);
|
|
52275
52274
|
React$1.useEffect(() => {
|
|
52276
|
-
|
|
52277
|
-
|
|
52278
|
-
|
|
52275
|
+
if (data === undefined || data === null) {
|
|
52276
|
+
setActive(false);
|
|
52277
|
+
}
|
|
52278
|
+
else {
|
|
52279
|
+
setActive(data);
|
|
52280
|
+
}
|
|
52281
|
+
}, [data]);
|
|
52282
|
+
const handleSwitchChange = React$1.useCallback(() => {
|
|
52283
|
+
setActive(prevActive => {
|
|
52284
|
+
// const newValue = !prevActive ? "A" : "I";
|
|
52285
|
+
setValue(item.name, !prevActive);
|
|
52286
|
+
return !prevActive;
|
|
52287
|
+
});
|
|
52288
|
+
}, [setValue, item.name]);
|
|
52289
|
+
return (jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsxs("div", Object.assign({ className: "m-form__input" }, { children: [item.label && (jsxRuntimeExports.jsx("span", Object.assign({ style: { fontSize: "12px", fontWeight: 400, paddingRight: 10 } }, { children: item.label }))), jsxRuntimeExports.jsxs("span", Object.assign({ className: "switch prestashop-switch fixed-width-lg" }, { children: [jsxRuntimeExports.jsx("input", { checked: active, id: `${item.name}_on`, name: item.name, type: "radio", value: "Active", onChange: handleSwitchChange }), jsxRuntimeExports.jsx("label", Object.assign({ htmlFor: `${item.name}_on`, style: { fontFamily: "Roboto-Reg", textTransform: "none" } }, { children: item.label1 ? item.label1 : "Active" })), jsxRuntimeExports.jsx("input", { checked: !active, id: `${item.name}_off`, name: item.name, type: "radio", value: "In Active", onChange: handleSwitchChange }), jsxRuntimeExports.jsx("label", Object.assign({ htmlFor: `${item.name}_off`, style: { fontFamily: "Roboto-Reg", textTransform: "none" } }, { children: item.label2 ? item.label2 : "In Active" })), jsxRuntimeExports.jsx("a", { className: "slide-button btn" })] }))] })) }));
|
|
52279
52290
|
};
|
|
52280
52291
|
|
|
52281
52292
|
const renderLabel = (label, isRequired, alignRight) => {
|
|
@@ -52302,7 +52313,7 @@ const RenderForm = (props) => {
|
|
|
52302
52313
|
var _a, _b;
|
|
52303
52314
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { fullWidth: true,
|
|
52304
52315
|
// error={props.errors}
|
|
52305
|
-
label: `${props.item.label}${props.item.required ? ' *' : ''}`, InputProps: {
|
|
52316
|
+
label: `${props.item.label}${props.item.required ? ' *' : ''}`, placeholder: props.item.placeholder || "", InputProps: {
|
|
52306
52317
|
style: {
|
|
52307
52318
|
fontFamily: "Roboto-Reg",
|
|
52308
52319
|
border: "none",
|
|
@@ -55133,6 +55144,14 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55133
55144
|
.required(field.errorMessage);
|
|
55134
55145
|
}
|
|
55135
55146
|
break;
|
|
55147
|
+
case "password":
|
|
55148
|
+
initialValues[field.name] = "";
|
|
55149
|
+
if (field.required && field.errorMessage) {
|
|
55150
|
+
validationShape[field.name] = create$6()
|
|
55151
|
+
.typeError(field.errorMessage)
|
|
55152
|
+
.required(field.errorMessage);
|
|
55153
|
+
}
|
|
55154
|
+
break;
|
|
55136
55155
|
case "email":
|
|
55137
55156
|
initialValues[field.name] = "";
|
|
55138
55157
|
if (field.required && field.errorMessage) {
|
|
@@ -55212,15 +55231,6 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55212
55231
|
});
|
|
55213
55232
|
}
|
|
55214
55233
|
break;
|
|
55215
|
-
case "password":
|
|
55216
|
-
initialValues[field.name] = "";
|
|
55217
|
-
if (field.required && field.errorMessage) {
|
|
55218
|
-
validationShape[field.name] = create$5()
|
|
55219
|
-
.nullable()
|
|
55220
|
-
.typeError(`Please enter ${field.label}`)
|
|
55221
|
-
.required(field.errorMessage);
|
|
55222
|
-
}
|
|
55223
|
-
break;
|
|
55224
55234
|
case "select":
|
|
55225
55235
|
initialValues[field.name] = "";
|
|
55226
55236
|
if (field.required && field.errorMessage) {
|