x-ui-design 0.4.2 → 0.4.4

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,13 +1,9 @@
1
- import { KeyboardEventHandler, MouseEvent, MouseEventHandler, ReactNode } from 'react';
2
- import { DefaultProps, TargetProps } from '.';
1
+ import { ReactNode } from 'react';
2
+ import { DefaultProps } from '.';
3
3
  export type SwitchProps = DefaultProps & {
4
4
  disabled?: boolean;
5
- onChange?: (e: MouseEvent<HTMLInputElement> & TargetProps) => void;
6
- onClick?: MouseEventHandler<HTMLElement>;
7
- onMouseEnter?: MouseEventHandler<HTMLElement>;
8
- onMouseLeave?: MouseEventHandler<HTMLElement>;
9
- onKeyPress?: KeyboardEventHandler<HTMLElement>;
10
- onKeyDown?: KeyboardEventHandler<HTMLElement>;
5
+ onChange?: (value: boolean) => void;
6
+ onClick?: (value: boolean) => void;
11
7
  value?: boolean;
12
8
  tabIndex?: number;
13
9
  name?: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, ReactNode, MouseEvent, MouseEventHandler, KeyboardEventHandler } from 'react';
2
+ import { CSSProperties, ReactNode } from 'react';
3
3
  import * as __types_select from '@/types/select';
4
4
  export { CustomTagProps, DisplayValueType, OptionProps, OptionType, SelectProps, TagProps } from '@/types/select';
5
5
  import * as __types_radio from '@/types/radio';
@@ -23,18 +23,12 @@ export { FormContext } from '@/components/Form/Form';
23
23
  export { clsx, createArray, parseValue } from '@/helpers';
24
24
  export { flattenChildren } from '@/helpers/flatten';
25
25
 
26
- type RuleType = any;
27
26
  interface DefaultProps {
28
27
  prefixCls?: string;
29
28
  className?: string;
30
29
  style?: CSSProperties;
31
30
  noStyle?: boolean;
32
31
  }
33
- type TargetProps = {
34
- target: {
35
- value: RuleType;
36
- };
37
- };
38
32
 
39
33
  declare type widthUnit = number | string;
40
34
  interface SkeletonElementProps {
@@ -92,12 +86,8 @@ type EmptyContentProps = DefaultProps & {
92
86
 
93
87
  type SwitchProps = DefaultProps & {
94
88
  disabled?: boolean;
95
- onChange?: (e: MouseEvent<HTMLInputElement> & TargetProps) => void;
96
- onClick?: MouseEventHandler<HTMLElement>;
97
- onMouseEnter?: MouseEventHandler<HTMLElement>;
98
- onMouseLeave?: MouseEventHandler<HTMLElement>;
99
- onKeyPress?: KeyboardEventHandler<HTMLElement>;
100
- onKeyDown?: KeyboardEventHandler<HTMLElement>;
89
+ onChange?: (value: boolean) => void;
90
+ onClick?: (value: boolean) => void;
101
91
  value?: boolean;
102
92
  tabIndex?: number;
103
93
  name?: string;
package/dist/index.esm.js CHANGED
@@ -1464,8 +1464,8 @@ const Switch = ({
1464
1464
  }
1465
1465
  setInternalChecked(!internalChecked);
1466
1466
  e.target.value = !internalChecked;
1467
- onClick?.(e);
1468
- onChange?.(e);
1467
+ onClick?.(e.target.value);
1468
+ onChange?.(e.target.value);
1469
1469
  };
1470
1470
  useEffect(() => {
1471
1471
  if (checked !== undefined) {