infinity-forge 0.53.2 → 0.53.3
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
interface InputCheckboxProps {
|
|
2
3
|
name: string;
|
|
3
4
|
label?: string;
|
|
@@ -5,6 +6,10 @@ interface InputCheckboxProps {
|
|
|
5
6
|
label: string;
|
|
6
7
|
value: string;
|
|
7
8
|
}[];
|
|
9
|
+
OptionComponent?: (props: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}) => JSX.Element;
|
|
8
13
|
}
|
|
9
14
|
export declare function InputCheckbox(props: InputCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
export {};
|
|
@@ -35,21 +35,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.InputCheckbox = void 0;
|
|
38
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
38
|
var react_1 = require("react");
|
|
39
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
|
+
var react_2 = require("react");
|
|
40
41
|
var formik_1 = require("formik");
|
|
41
42
|
var input_control_1 = require("../input-control/index.js");
|
|
42
43
|
var S = __importStar(require("./styles.js"));
|
|
43
44
|
function InputCheckbox(props) {
|
|
44
45
|
var _a = (0, formik_1.useField)({ name: props.name }), field = _a[0], _ = _a[1], helpers = _a[2];
|
|
45
|
-
(0,
|
|
46
|
+
(0, react_2.useEffect)(function () {
|
|
46
47
|
if (field.value === undefined) {
|
|
47
48
|
helpers.setValue(['']);
|
|
48
49
|
}
|
|
49
50
|
}, [field.value]);
|
|
50
51
|
return ((0, jsx_runtime_1.jsx)(input_control_1.InputControl, __assign({}, props, { name: props.name, children: (0, jsx_runtime_1.jsx)(S.InputCheckbox, { children: (0, jsx_runtime_1.jsx)("div", { className: 'list-radios', children: props.options.map(function (option, index) {
|
|
51
52
|
var _a;
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)("label", { htmlFor: props.name + index, children: [(0, jsx_runtime_1.jsx)("input", __assign({ id: props.name + index }, field, { checked: (_a = field === null || field === void 0 ? void 0 : field.value) === null || _a === void 0 ? void 0 : _a.find(function (v) { return v === option.value; }), type: 'checkbox', value: option.value })), (0, jsx_runtime_1.jsx)("span", { dangerouslySetInnerHTML: { __html: option.label } })] }, option.value));
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("label", { htmlFor: props.name + index, children: [(0, jsx_runtime_1.jsx)("input", __assign({ id: props.name + index }, field, { checked: (_a = field === null || field === void 0 ? void 0 : field.value) === null || _a === void 0 ? void 0 : _a.find(function (v) { return v === option.value; }), type: 'checkbox', value: option.value, style: { display: props.OptionComponent ? "none" : "block" } })), props.OptionComponent ? (0, react_1.createElement)(props.OptionComponent, __assign({}, option, { key: option.value })) : (0, jsx_runtime_1.jsx)("span", { dangerouslySetInnerHTML: { __html: option.label } })] }, option.value));
|
|
53
54
|
}) }) }) })));
|
|
54
55
|
}
|
|
55
56
|
exports.InputCheckbox = InputCheckbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/components/form/checkbox/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/components/form/checkbox/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAwC;AACxC,iCAAiC;AAEjC,kDAA+C;AAE/C,0CAA6B;AAS7B,SAAgB,aAAa,CAAC,KAAyB;IAC/C,IAAA,KAAsB,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAnD,KAAK,QAAA,EAAE,CAAC,QAAA,EAAE,OAAO,QAAk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