@mmb-digital/ds-lilly 0.3.8 → 0.3.9

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/ds-lilly.js CHANGED
@@ -104296,20 +104296,15 @@ var Checkbox2_assign = (undefined && undefined.__assign) || function () {
104296
104296
 
104297
104297
 
104298
104298
  var Checkbox2 = function (_a) {
104299
- var _b = _a.allowEventPropagation, allowEventPropagation = _b === void 0 ? false : _b, disabledTooltip = _a.disabledTooltip, error = _a.error, help = _a.help, isDisabled = _a.isDisabled, label = _a.label, labelTooltip = _a.labelTooltip, name = _a.name, onChange = _a.onChange, testId = _a.testId, theme = _a.theme, _c = _a.value, defaultState = _c === void 0 ? false : _c;
104300
- var _d = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(defaultState), isChecked = _d[0], setIsChecked = _d[1];
104299
+ var _b = _a.allowEventPropagation, allowEventPropagation = _b === void 0 ? false : _b, disabledTooltip = _a.disabledTooltip, error = _a.error, help = _a.help, isDisabled = _a.isDisabled, label = _a.label, labelTooltip = _a.labelTooltip, name = _a.name, onChange = _a.onChange, testId = _a.testId, theme = _a.theme, value = _a.value;
104301
104300
  var handleOnChange = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (event) {
104302
104301
  if (!isDisabled) {
104303
- onChange && onChange(!isChecked);
104304
- setIsChecked(!isChecked);
104302
+ onChange && onChange(!value);
104305
104303
  }
104306
104304
  if (!allowEventPropagation) {
104307
104305
  event.stopPropagation();
104308
104306
  }
104309
- }, [allowEventPropagation, isChecked, isDisabled, onChange]);
104310
- Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
104311
- setIsChecked(defaultState);
104312
- }, [defaultState]);
104307
+ }, [allowEventPropagation, value, isDisabled, onChange]);
104313
104308
  var handleOnKeyPress = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (event) {
104314
104309
  var key = event.key;
104315
104310
  if (key === KEYS.Space)
@@ -104324,17 +104319,14 @@ var Checkbox2 = function (_a) {
104324
104319
  name: name,
104325
104320
  theme: theme
104326
104321
  };
104327
- Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
104328
- setIsChecked(defaultState);
104329
- }, [defaultState]);
104330
104322
  return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(FormGroup2, Checkbox2_assign({}, formGroupProps),
104331
- external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("label", { "aria-checked": isChecked ? 'true' : 'false', className: classBinder_cx('f-checkbox2', {
104323
+ external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("label", { "aria-checked": value ? 'true' : 'false', className: classBinder_cx('f-checkbox2', {
104332
104324
  'f-checkbox2--disabled': isDisabled
104333
104325
  }, theme), "data-testid": testId, id: name, role: "checkbox", tabIndex: 0, onClick: handleOnChange, onKeyPress: handleOnKeyPress },
104334
104326
  external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "f-checkbox2__over" },
104335
104327
  external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: classBinder_cx('f-checkbox2__indicator', {
104336
- 'f-checkbox2__indicator--checked': isChecked
104337
- }) }, isChecked && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "tickFill" }))),
104328
+ 'f-checkbox2__indicator--checked': value
104329
+ }) }, value && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "tickFill" }))),
104338
104330
  external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "f-checkbox2__text" },
104339
104331
  label,
104340
104332
  labelTooltip && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Tooltip, { content: labelTooltip },
@@ -2,5 +2,5 @@ import { FormField2PropsType } from '../../../types';
2
2
  export declare type Checkbox2PropsType = Omit<FormField2PropsType, 'value'> & {
3
3
  value?: boolean;
4
4
  };
5
- export declare const Checkbox2: ({ allowEventPropagation, disabledTooltip, error, help, isDisabled, label, labelTooltip, name, onChange, testId, theme, value: defaultState }: Checkbox2PropsType) => JSX.Element;
5
+ export declare const Checkbox2: ({ allowEventPropagation, disabledTooltip, error, help, isDisabled, label, labelTooltip, name, onChange, testId, theme, value }: Checkbox2PropsType) => JSX.Element;
6
6
  //# sourceMappingURL=Checkbox2.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmb-digital/ds-lilly",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "MMB LILLY design system",
5
5
  "license": "UNLICENSED",
6
6
  "sideEffects": false,