@akinon/ui-checkbox 0.4.0 → 0.5.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.
@@ -0,0 +1,68 @@
1
+ import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-theme';
2
+
3
+ export type CheckboxValueType = string | number | boolean;
4
+
5
+ export interface CheckboxProps {
6
+ className?: string;
7
+ defaultChecked?: boolean;
8
+ checked?: boolean;
9
+ disabled?: boolean;
10
+ title?: string;
11
+ onChange?: (e: CheckboxChangeEvent) => void;
12
+ onClick?: React.MouseEventHandler<HTMLElement>;
13
+ onMouseEnter?: React.MouseEventHandler<HTMLElement>;
14
+ onMouseLeave?: React.MouseEventHandler<HTMLElement>;
15
+ onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
16
+ onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
17
+ value?: CheckboxValueType;
18
+ tabIndex?: number;
19
+ name?: string;
20
+ children?: React.ReactNode;
21
+ id?: string;
22
+ autoFocus?: boolean;
23
+ type?: string;
24
+ skipGroup?: boolean;
25
+ required?: boolean;
26
+ indeterminate?: boolean;
27
+ /**
28
+ * Never use this prop. Akinon design system does not allow custom styles.
29
+ * @ignore
30
+ */
31
+ style?: DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE;
32
+ }
33
+
34
+ export interface CheckboxChangeEventTarget extends CheckboxProps {
35
+ checked: boolean;
36
+ }
37
+
38
+ export interface CheckboxChangeEvent {
39
+ target: CheckboxChangeEventTarget;
40
+ stopPropagation: () => void;
41
+ preventDefault: () => void;
42
+ nativeEvent: MouseEvent;
43
+ }
44
+
45
+ export interface CheckboxOptionType<
46
+ T extends CheckboxValueType = CheckboxValueType
47
+ > {
48
+ label: React.ReactNode;
49
+ value: T;
50
+ disabled?: boolean;
51
+ title?: string;
52
+ id?: string;
53
+ onChange?: (e: CheckboxChangeEvent) => void;
54
+ required?: boolean;
55
+ }
56
+
57
+ export interface CheckboxGroupProps<
58
+ T extends CheckboxValueType = CheckboxValueType
59
+ > {
60
+ className?: string;
61
+ options?: (CheckboxOptionType<T> | string | number)[];
62
+ disabled?: boolean;
63
+ name?: string;
64
+ defaultValue?: T[];
65
+ value?: T[];
66
+ onChange?: (checkedValue: T[]) => void;
67
+ children?: React.ReactNode;
68
+ }
@@ -0,0 +1,68 @@
1
+ import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-theme';
2
+
3
+ export type CheckboxValueType = string | number | boolean;
4
+
5
+ export interface CheckboxProps {
6
+ className?: string;
7
+ defaultChecked?: boolean;
8
+ checked?: boolean;
9
+ disabled?: boolean;
10
+ title?: string;
11
+ onChange?: (e: CheckboxChangeEvent) => void;
12
+ onClick?: React.MouseEventHandler<HTMLElement>;
13
+ onMouseEnter?: React.MouseEventHandler<HTMLElement>;
14
+ onMouseLeave?: React.MouseEventHandler<HTMLElement>;
15
+ onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
16
+ onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
17
+ value?: CheckboxValueType;
18
+ tabIndex?: number;
19
+ name?: string;
20
+ children?: React.ReactNode;
21
+ id?: string;
22
+ autoFocus?: boolean;
23
+ type?: string;
24
+ skipGroup?: boolean;
25
+ required?: boolean;
26
+ indeterminate?: boolean;
27
+ /**
28
+ * Never use this prop. Akinon design system does not allow custom styles.
29
+ * @ignore
30
+ */
31
+ style?: DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE;
32
+ }
33
+
34
+ export interface CheckboxChangeEventTarget extends CheckboxProps {
35
+ checked: boolean;
36
+ }
37
+
38
+ export interface CheckboxChangeEvent {
39
+ target: CheckboxChangeEventTarget;
40
+ stopPropagation: () => void;
41
+ preventDefault: () => void;
42
+ nativeEvent: MouseEvent;
43
+ }
44
+
45
+ export interface CheckboxOptionType<
46
+ T extends CheckboxValueType = CheckboxValueType
47
+ > {
48
+ label: React.ReactNode;
49
+ value: T;
50
+ disabled?: boolean;
51
+ title?: string;
52
+ id?: string;
53
+ onChange?: (e: CheckboxChangeEvent) => void;
54
+ required?: boolean;
55
+ }
56
+
57
+ export interface CheckboxGroupProps<
58
+ T extends CheckboxValueType = CheckboxValueType
59
+ > {
60
+ className?: string;
61
+ options?: (CheckboxOptionType<T> | string | number)[];
62
+ disabled?: boolean;
63
+ name?: string;
64
+ defaultValue?: T[];
65
+ value?: T[];
66
+ onChange?: (checkedValue: T[]) => void;
67
+ children?: React.ReactNode;
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-checkbox",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "antd": "5.17.0",
13
- "@akinon/ui-theme": "0.6.0"
13
+ "@akinon/ui-theme": "0.7.0"
14
14
  },
15
15
  "devDependencies": {
16
16
  "clean-package": "2.2.0",
17
17
  "copyfiles": "^2.4.1",
18
18
  "rimraf": "^5.0.5",
19
19
  "typescript": "^5.2.2",
20
- "@akinon/typescript-config": "0.3.0"
20
+ "@akinon/typescript-config": "0.4.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18",
@@ -37,7 +37,7 @@
37
37
  "build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
38
38
  "build:esm": "tsc --outDir dist/esm",
39
39
  "build:commonjs": "tsc --module commonjs --outDir dist/cjs",
40
- "copy:files": "copyfiles -u 1 src/**/*.css dist/esm && copyfiles -u 1 src/**/*.css dist/cjs",
40
+ "copy:files": "copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/esm && copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/cjs",
41
41
  "clean": "rimraf dist/",
42
42
  "typecheck": "tsc --noEmit"
43
43
  }