@synerise/ds-checkbox-tristate 0.3.7 → 1.0.0

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.
@@ -3,5 +3,5 @@ import { CheckboxTristateProps } from './CheckboxTristate.types';
3
3
  export * from './CheckboxTristate.types';
4
4
  export declare function nextCheckedValues(checked: boolean | undefined, indeterminate: boolean): [boolean, boolean];
5
5
  export declare function checkedValue(checked: boolean, indeterminate: boolean): boolean | undefined;
6
- declare const CheckboxTristate: React.FC<CheckboxTristateProps>;
6
+ declare const CheckboxTristate: (props: CheckboxTristateProps) => React.JSX.Element;
7
7
  export default CheckboxTristate;
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["checked", "defaultChecked", "onChange"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import React from 'react';
4
+ import React, { useEffect, useState } from 'react';
5
5
  import Checkbox from '@synerise/ds-checkbox';
6
6
  export * from './CheckboxTristate.types';
7
7
  export function nextCheckedValues(checked, indeterminate) {
@@ -23,13 +23,13 @@ var CheckboxTristate = function CheckboxTristate(props) {
23
23
  restProps = _objectWithoutPropertiesLoose(props, _excluded);
24
24
  var initialChecked = 'checked' in props ? checked : defaultChecked;
25
25
  var isControlled = ('checked' in props);
26
- var _React$useState = React.useState(initialChecked),
27
- currentChecked = _React$useState[0],
28
- setChecked = _React$useState[1];
29
- var _React$useState2 = React.useState(initialChecked === undefined),
30
- indeterminate = _React$useState2[0],
31
- setIndeterminate = _React$useState2[1];
32
- React.useEffect(function () {
26
+ var _useState = useState(initialChecked),
27
+ currentChecked = _useState[0],
28
+ setChecked = _useState[1];
29
+ var _useState2 = useState(initialChecked === undefined),
30
+ indeterminate = _useState2[0],
31
+ setIndeterminate = _useState2[1];
32
+ useEffect(function () {
33
33
  if (isControlled && (checked !== currentChecked || checked === false && currentChecked === false)) {
34
34
  if (checked === undefined) {
35
35
  setIndeterminate(true);
@@ -1,12 +1,13 @@
1
- import { AbstractCheckboxProps } from 'antd/lib/checkbox/Checkbox';
2
- export interface CheckboxTristateChangeEventTarget extends CheckboxTristateProps {
1
+ import type { AbstractCheckboxProps } from 'antd/lib/checkbox/Checkbox';
2
+ import type { BaseCheckboxProps } from '@synerise/ds-checkbox';
3
+ export type CheckboxTristateProps = AbstractCheckboxProps<CheckboxTristateChangeEvent> & BaseCheckboxProps;
4
+ export type CheckboxTristateChangeEventTarget = CheckboxTristateProps & {
3
5
  checked: boolean | undefined;
4
6
  onChange?: (e: CheckboxTristateChangeEvent) => void;
5
- }
6
- export interface CheckboxTristateChangeEvent {
7
+ };
8
+ export type CheckboxTristateChangeEvent = {
7
9
  target: CheckboxTristateChangeEventTarget;
8
10
  stopPropagation: () => void;
9
11
  preventDefault: () => void;
10
12
  nativeEvent: MouseEvent;
11
- }
12
- export type CheckboxTristateProps = AbstractCheckboxProps<CheckboxTristateChangeEvent>;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-checkbox-tristate",
3
- "version": "0.3.7",
3
+ "version": "1.0.0",
4
4
  "description": "Checkbox Tristate UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -38,13 +38,13 @@
38
38
  ],
39
39
  "types": "dist/index.d.ts",
40
40
  "dependencies": {
41
- "@synerise/ds-checkbox": "^0.13.7",
42
- "@synerise/ds-utils": "^0.32.3"
41
+ "@synerise/ds-checkbox": "^1.0.0",
42
+ "@synerise/ds-utils": "^1.0.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@synerise/ds-core": "*",
46
46
  "antd": "4.24.16",
47
47
  "react": ">=16.9.0 <= 18.3.1"
48
48
  },
49
- "gitHead": "a176b46dab123cd503247ae57022f8e808772d68"
49
+ "gitHead": "e4c3690238a44b584b9ea41e4aa52b1eec42174b"
50
50
  }