@ssplib/react-components 0.0.104 → 0.0.105
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.
|
@@ -22,6 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
25
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
38
|
};
|
|
@@ -47,8 +58,9 @@ function getChildrenNames(children) {
|
|
|
47
58
|
});
|
|
48
59
|
return arr;
|
|
49
60
|
}
|
|
50
|
-
function RequiredCheckBoxGroup(
|
|
51
|
-
var
|
|
61
|
+
function RequiredCheckBoxGroup(_a) {
|
|
62
|
+
var _b;
|
|
63
|
+
var { customText = 'Selecione pelo menos 1 opção' } = _a, props = __rest(_a, ["customText"]);
|
|
52
64
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
53
65
|
return (react_1.default.createElement(material_1.Grid, { container: true, sx: { border: (0, lodash_get_1.default)(context.errors, props.name) ? '2px solid #a51c30' : '', padding: 1, borderRadius: 2 } },
|
|
54
66
|
react_1.default.createElement("input", Object.assign({ type: 'text' }, context.formRegister(props.name, {
|
|
@@ -61,12 +73,12 @@ function RequiredCheckBoxGroup(props) {
|
|
|
61
73
|
canContinue = true;
|
|
62
74
|
});
|
|
63
75
|
if (!canContinue)
|
|
64
|
-
return
|
|
76
|
+
return customText;
|
|
65
77
|
return true;
|
|
66
78
|
},
|
|
67
79
|
}), { hidden: true })),
|
|
68
80
|
props.children,
|
|
69
81
|
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
70
|
-
react_1.default.createElement(material_1.Typography, { sx: { color: '#a51c30', fontSize: 16, paddingLeft: 1 } }, (
|
|
82
|
+
react_1.default.createElement(material_1.Typography, { sx: { color: '#a51c30', fontSize: 16, paddingLeft: 1 } }, (_b = (0, lodash_get_1.default)(context.errors, props.name)) === null || _b === void 0 ? void 0 : _b.message))));
|
|
71
83
|
}
|
|
72
84
|
exports.default = RequiredCheckBoxGroup;
|