tp-react-elements-dev 1.4.10 → 1.4.11
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 +19 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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) => {
|