@ssplib/react-components 0.0.163 → 0.0.164

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,5 +1,5 @@
1
1
  import React from 'react';
2
- export default function CheckBox({ name, title, defaultValue, xs, sm, md, onChange, onClick, }: {
2
+ export default function CheckBox({ name, title, defaultValue, xs, sm, md, onChange, }: {
3
3
  name: string;
4
4
  title: string | JSX.Element;
5
5
  defaultValue?: boolean;
@@ -7,5 +7,4 @@ export default function CheckBox({ name, title, defaultValue, xs, sm, md, onChan
7
7
  xs?: number;
8
8
  sm?: number;
9
9
  md?: number;
10
- onClick?: (e: React.SyntheticEvent<Element, Event>) => void;
11
10
  }): JSX.Element;
@@ -7,8 +7,11 @@ const material_1 = require("@mui/material");
7
7
  const react_1 = require("react");
8
8
  const form_1 = require("../../../context/form");
9
9
  const react_2 = __importDefault(require("react"));
10
- function CheckBox({ name, title, defaultValue = false, xs = 12, sm, md, onChange, onClick, }) {
10
+ function CheckBox({ name, title, defaultValue = false, xs = 12, sm, md, onChange, }) {
11
11
  const context = (0, react_1.useContext)(form_1.FormContext);
12
+ const onClick = (0, react_1.useCallback)((e) => {
13
+ context === null || context === void 0 ? void 0 : context.formSetValue(name, !(context === null || context === void 0 ? void 0 : context.formGetValues(name)));
14
+ }, [context, name]);
12
15
  return (react_2.default.createElement(material_1.Grid, Object.assign({ item: true }, { xs, sm, md }),
13
16
  react_2.default.createElement(material_1.FormControlLabel, Object.assign({ control: react_2.default.createElement(material_1.Checkbox, { size: 'small', defaultChecked: defaultValue }), label: title }, context === null || context === void 0 ? void 0 : context.formRegister(name), { onChange: onChange, onClick: onClick }))));
14
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.163",
3
+ "version": "0.0.164",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",