@akinon/ui-checkbox 0.5.0 → 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.
- package/dist/cjs/index.d.ts +25 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/types.d.ts +165 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +25 -0
- package/dist/esm/types.d.ts +165 -0
- package/package.json +5 -5
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CheckboxGroupProps, CheckboxProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Checkbox component for Akinon UI.
|
|
5
|
+
*
|
|
6
|
+
* This component provides a versatile checkbox implementation, supporting both standalone usage
|
|
7
|
+
* and grouped configurations (via CheckboxGroup). It offers flexibility with various states,
|
|
8
|
+
* event handlers, and accessibility features.
|
|
9
|
+
*
|
|
10
|
+
* The Checkbox component adheres to the Akinon design system, ensuring consistent behavior
|
|
11
|
+
* and appearance. Custom styles are not permitted to maintain design integrity.
|
|
12
|
+
*
|
|
13
|
+
* For group usage, refer to the CheckboxGroup, which manages multiple checkboxes and their states.
|
|
14
|
+
*/
|
|
3
15
|
export declare const Checkbox: ({ children, ...restCheckboxProps }: CheckboxProps) => React.JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* CheckboxGroup component for Akinon UI.
|
|
18
|
+
*
|
|
19
|
+
* This component provides a way to manage multiple checkboxes as a group,
|
|
20
|
+
* allowing for easier handling of values, validation, and styling. It supports
|
|
21
|
+
* both controlled and uncontrolled states, as well as customization options for
|
|
22
|
+
* individual checkboxes.
|
|
23
|
+
*
|
|
24
|
+
* The CheckboxGroup component adheres to the Akinon design system, ensuring
|
|
25
|
+
* consistency and accessibility across all use cases. It simplifies scenarios
|
|
26
|
+
* where multiple related options need to be selected by maintaining a unified
|
|
27
|
+
* state for the group.
|
|
28
|
+
*/
|
|
4
29
|
export declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
|
|
5
30
|
export type * from './types';
|
|
6
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,QAAQ,uCAAwC,aAAa,sBAgCzE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAwB,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAE/E,mBAAmB,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,QAAQ,uCAAwC,aAAa,sBAgCzE,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,aAAa,EAAwB,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAE/E,mBAAmB,SAAS,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,6 +16,18 @@ const ui_theme_1 = require("@akinon/ui-theme");
|
|
|
16
16
|
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
17
17
|
const antd_1 = require("antd");
|
|
18
18
|
const React = require("react");
|
|
19
|
+
/**
|
|
20
|
+
* Checkbox component for Akinon UI.
|
|
21
|
+
*
|
|
22
|
+
* This component provides a versatile checkbox implementation, supporting both standalone usage
|
|
23
|
+
* and grouped configurations (via CheckboxGroup). It offers flexibility with various states,
|
|
24
|
+
* event handlers, and accessibility features.
|
|
25
|
+
*
|
|
26
|
+
* The Checkbox component adheres to the Akinon design system, ensuring consistent behavior
|
|
27
|
+
* and appearance. Custom styles are not permitted to maintain design integrity.
|
|
28
|
+
*
|
|
29
|
+
* For group usage, refer to the CheckboxGroup, which manages multiple checkboxes and their states.
|
|
30
|
+
*/
|
|
19
31
|
const Checkbox = (_a) => {
|
|
20
32
|
var { children } = _a, restCheckboxProps = __rest(_a, ["children"]);
|
|
21
33
|
const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
|
|
@@ -38,4 +50,17 @@ const Checkbox = (_a) => {
|
|
|
38
50
|
return useStyle(React.createElement(antd_1.Checkbox, Object.assign({}, restCheckboxProps), children));
|
|
39
51
|
};
|
|
40
52
|
exports.Checkbox = Checkbox;
|
|
53
|
+
/**
|
|
54
|
+
* CheckboxGroup component for Akinon UI.
|
|
55
|
+
*
|
|
56
|
+
* This component provides a way to manage multiple checkboxes as a group,
|
|
57
|
+
* allowing for easier handling of values, validation, and styling. It supports
|
|
58
|
+
* both controlled and uncontrolled states, as well as customization options for
|
|
59
|
+
* individual checkboxes.
|
|
60
|
+
*
|
|
61
|
+
* The CheckboxGroup component adheres to the Akinon design system, ensuring
|
|
62
|
+
* consistency and accessibility across all use cases. It simplifies scenarios
|
|
63
|
+
* where multiple related options need to be selected by maintaining a unified
|
|
64
|
+
* state for the group.
|
|
65
|
+
*/
|
|
41
66
|
exports.CheckboxGroup = antd_1.Checkbox.Group;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -3,27 +3,112 @@ import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-
|
|
|
3
3
|
export type CheckboxValueType = string | number | boolean;
|
|
4
4
|
|
|
5
5
|
export interface CheckboxProps {
|
|
6
|
+
/**
|
|
7
|
+
* Additional CSS class for the Checkbox.
|
|
8
|
+
*/
|
|
6
9
|
className?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Whether the checkbox is initially checked.
|
|
13
|
+
*/
|
|
7
14
|
defaultChecked?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The controlled checked state of the checkbox.
|
|
18
|
+
*/
|
|
8
19
|
checked?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether the checkbox is disabled.
|
|
23
|
+
*/
|
|
9
24
|
disabled?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A descriptive title for the checkbox, used for accessibility.
|
|
28
|
+
*/
|
|
10
29
|
title?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Event handler triggered when the checkbox value changes.
|
|
33
|
+
* @param e - The change event object.
|
|
34
|
+
*/
|
|
11
35
|
onChange?: (e: CheckboxChangeEvent) => void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Event handler triggered when the checkbox is clicked.
|
|
39
|
+
*/
|
|
12
40
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Event handler triggered when the mouse enters the checkbox.
|
|
44
|
+
*/
|
|
13
45
|
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Event handler triggered when the mouse leaves the checkbox.
|
|
49
|
+
*/
|
|
14
50
|
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Event handler triggered when a key is pressed while the checkbox is focused.
|
|
54
|
+
*/
|
|
15
55
|
onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Event handler triggered when a key is pressed down while the checkbox is focused.
|
|
59
|
+
*/
|
|
16
60
|
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The value associated with the checkbox.
|
|
64
|
+
*/
|
|
17
65
|
value?: CheckboxValueType;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The tab index of the checkbox.
|
|
69
|
+
*/
|
|
18
70
|
tabIndex?: number;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The name attribute for the checkbox.
|
|
74
|
+
*/
|
|
19
75
|
name?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The content displayed next to the checkbox.
|
|
79
|
+
*/
|
|
20
80
|
children?: React.ReactNode;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The unique identifier for the checkbox.
|
|
84
|
+
*/
|
|
21
85
|
id?: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether the checkbox should automatically gain focus on render.
|
|
89
|
+
*/
|
|
22
90
|
autoFocus?: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The input type of the checkbox. Defaults to 'checkbox'.
|
|
94
|
+
*/
|
|
23
95
|
type?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* If true, skips group handling when used inside a CheckboxGroup.
|
|
99
|
+
*/
|
|
24
100
|
skipGroup?: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Whether the checkbox is required for form submission.
|
|
104
|
+
*/
|
|
25
105
|
required?: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Whether the checkbox is in an indeterminate state (partially selected).
|
|
109
|
+
*/
|
|
26
110
|
indeterminate?: boolean;
|
|
111
|
+
|
|
27
112
|
/**
|
|
28
113
|
* Never use this prop. Akinon design system does not allow custom styles.
|
|
29
114
|
* @ignore
|
|
@@ -32,37 +117,117 @@ export interface CheckboxProps {
|
|
|
32
117
|
}
|
|
33
118
|
|
|
34
119
|
export interface CheckboxChangeEventTarget extends CheckboxProps {
|
|
120
|
+
/**
|
|
121
|
+
* Indicates whether the checkbox is checked.
|
|
122
|
+
*/
|
|
35
123
|
checked: boolean;
|
|
36
124
|
}
|
|
37
125
|
|
|
38
126
|
export interface CheckboxChangeEvent {
|
|
127
|
+
/**
|
|
128
|
+
* The target checkbox that triggered the event.
|
|
129
|
+
*/
|
|
39
130
|
target: CheckboxChangeEventTarget;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Stops event propagation.
|
|
134
|
+
*/
|
|
40
135
|
stopPropagation: () => void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Prevents the default behavior of the event.
|
|
139
|
+
*/
|
|
41
140
|
preventDefault: () => void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The native mouse event.
|
|
144
|
+
*/
|
|
42
145
|
nativeEvent: MouseEvent;
|
|
43
146
|
}
|
|
44
147
|
|
|
45
148
|
export interface CheckboxOptionType<
|
|
46
149
|
T extends CheckboxValueType = CheckboxValueType
|
|
47
150
|
> {
|
|
151
|
+
/**
|
|
152
|
+
* The label displayed next to the checkbox. Can be a string or a React node.
|
|
153
|
+
*/
|
|
48
154
|
label: React.ReactNode;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The value associated with the checkbox. Must match the generic type `T`.
|
|
158
|
+
*/
|
|
49
159
|
value: T;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether the checkbox option is disabled.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
50
165
|
disabled?: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A descriptive title for the checkbox option, used for accessibility.
|
|
169
|
+
*/
|
|
51
170
|
title?: string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The unique identifier for the checkbox option.
|
|
174
|
+
*/
|
|
52
175
|
id?: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Event handler triggered when the option's value changes.
|
|
179
|
+
* @param e - The change event object.
|
|
180
|
+
*/
|
|
53
181
|
onChange?: (e: CheckboxChangeEvent) => void;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Whether the checkbox option is required for form submission.
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
54
187
|
required?: boolean;
|
|
55
188
|
}
|
|
56
189
|
|
|
57
190
|
export interface CheckboxGroupProps<
|
|
58
191
|
T extends CheckboxValueType = CheckboxValueType
|
|
59
192
|
> {
|
|
193
|
+
/**
|
|
194
|
+
* Additional CSS class for the CheckboxGroup.
|
|
195
|
+
*/
|
|
60
196
|
className?: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The options for the checkbox group. Each option can be a string, number, or an object.
|
|
200
|
+
*/
|
|
61
201
|
options?: (CheckboxOptionType<T> | string | number)[];
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Whether the entire group is disabled.
|
|
205
|
+
*/
|
|
62
206
|
disabled?: boolean;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The name attribute for all checkboxes in the group.
|
|
210
|
+
*/
|
|
63
211
|
name?: string;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The default checked values of the group.
|
|
215
|
+
*/
|
|
64
216
|
defaultValue?: T[];
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The controlled checked values of the group.
|
|
220
|
+
*/
|
|
65
221
|
value?: T[];
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Event handler triggered when the group value changes.
|
|
225
|
+
* @param checkedValue - An array of checked values.
|
|
226
|
+
*/
|
|
66
227
|
onChange?: (checkedValue: T[]) => void;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The content displayed within the CheckboxGroup.
|
|
231
|
+
*/
|
|
67
232
|
children?: React.ReactNode;
|
|
68
233
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CheckboxGroupProps, CheckboxProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Checkbox component for Akinon UI.
|
|
5
|
+
*
|
|
6
|
+
* This component provides a versatile checkbox implementation, supporting both standalone usage
|
|
7
|
+
* and grouped configurations (via CheckboxGroup). It offers flexibility with various states,
|
|
8
|
+
* event handlers, and accessibility features.
|
|
9
|
+
*
|
|
10
|
+
* The Checkbox component adheres to the Akinon design system, ensuring consistent behavior
|
|
11
|
+
* and appearance. Custom styles are not permitted to maintain design integrity.
|
|
12
|
+
*
|
|
13
|
+
* For group usage, refer to the CheckboxGroup, which manages multiple checkboxes and their states.
|
|
14
|
+
*/
|
|
3
15
|
export declare const Checkbox: ({ children, ...restCheckboxProps }: CheckboxProps) => React.JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* CheckboxGroup component for Akinon UI.
|
|
18
|
+
*
|
|
19
|
+
* This component provides a way to manage multiple checkboxes as a group,
|
|
20
|
+
* allowing for easier handling of values, validation, and styling. It supports
|
|
21
|
+
* both controlled and uncontrolled states, as well as customization options for
|
|
22
|
+
* individual checkboxes.
|
|
23
|
+
*
|
|
24
|
+
* The CheckboxGroup component adheres to the Akinon design system, ensuring
|
|
25
|
+
* consistency and accessibility across all use cases. It simplifies scenarios
|
|
26
|
+
* where multiple related options need to be selected by maintaining a unified
|
|
27
|
+
* state for the group.
|
|
28
|
+
*/
|
|
4
29
|
export declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
|
|
5
30
|
export type * from './types';
|
|
6
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,QAAQ,uCAAwC,aAAa,sBAgCzE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAwB,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAE/E,mBAAmB,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,QAAQ,uCAAwC,aAAa,sBAgCzE,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,aAAa,EAAwB,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAE/E,mBAAmB,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -13,6 +13,18 @@ import { useToken } from '@akinon/ui-theme';
|
|
|
13
13
|
import { useStyleRegister } from '@ant-design/cssinjs';
|
|
14
14
|
import { Checkbox as AntCheckbox, ConfigProvider } from 'antd';
|
|
15
15
|
import * as React from 'react';
|
|
16
|
+
/**
|
|
17
|
+
* Checkbox component for Akinon UI.
|
|
18
|
+
*
|
|
19
|
+
* This component provides a versatile checkbox implementation, supporting both standalone usage
|
|
20
|
+
* and grouped configurations (via CheckboxGroup). It offers flexibility with various states,
|
|
21
|
+
* event handlers, and accessibility features.
|
|
22
|
+
*
|
|
23
|
+
* The Checkbox component adheres to the Akinon design system, ensuring consistent behavior
|
|
24
|
+
* and appearance. Custom styles are not permitted to maintain design integrity.
|
|
25
|
+
*
|
|
26
|
+
* For group usage, refer to the CheckboxGroup, which manages multiple checkboxes and their states.
|
|
27
|
+
*/
|
|
16
28
|
export const Checkbox = (_a) => {
|
|
17
29
|
var { children } = _a, restCheckboxProps = __rest(_a, ["children"]);
|
|
18
30
|
const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
|
|
@@ -34,4 +46,17 @@ export const Checkbox = (_a) => {
|
|
|
34
46
|
});
|
|
35
47
|
return useStyle(React.createElement(AntCheckbox, Object.assign({}, restCheckboxProps), children));
|
|
36
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* CheckboxGroup component for Akinon UI.
|
|
51
|
+
*
|
|
52
|
+
* This component provides a way to manage multiple checkboxes as a group,
|
|
53
|
+
* allowing for easier handling of values, validation, and styling. It supports
|
|
54
|
+
* both controlled and uncontrolled states, as well as customization options for
|
|
55
|
+
* individual checkboxes.
|
|
56
|
+
*
|
|
57
|
+
* The CheckboxGroup component adheres to the Akinon design system, ensuring
|
|
58
|
+
* consistency and accessibility across all use cases. It simplifies scenarios
|
|
59
|
+
* where multiple related options need to be selected by maintaining a unified
|
|
60
|
+
* state for the group.
|
|
61
|
+
*/
|
|
37
62
|
export const CheckboxGroup = AntCheckbox.Group;
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -3,27 +3,112 @@ import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-
|
|
|
3
3
|
export type CheckboxValueType = string | number | boolean;
|
|
4
4
|
|
|
5
5
|
export interface CheckboxProps {
|
|
6
|
+
/**
|
|
7
|
+
* Additional CSS class for the Checkbox.
|
|
8
|
+
*/
|
|
6
9
|
className?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Whether the checkbox is initially checked.
|
|
13
|
+
*/
|
|
7
14
|
defaultChecked?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The controlled checked state of the checkbox.
|
|
18
|
+
*/
|
|
8
19
|
checked?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether the checkbox is disabled.
|
|
23
|
+
*/
|
|
9
24
|
disabled?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A descriptive title for the checkbox, used for accessibility.
|
|
28
|
+
*/
|
|
10
29
|
title?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Event handler triggered when the checkbox value changes.
|
|
33
|
+
* @param e - The change event object.
|
|
34
|
+
*/
|
|
11
35
|
onChange?: (e: CheckboxChangeEvent) => void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Event handler triggered when the checkbox is clicked.
|
|
39
|
+
*/
|
|
12
40
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Event handler triggered when the mouse enters the checkbox.
|
|
44
|
+
*/
|
|
13
45
|
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Event handler triggered when the mouse leaves the checkbox.
|
|
49
|
+
*/
|
|
14
50
|
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Event handler triggered when a key is pressed while the checkbox is focused.
|
|
54
|
+
*/
|
|
15
55
|
onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Event handler triggered when a key is pressed down while the checkbox is focused.
|
|
59
|
+
*/
|
|
16
60
|
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The value associated with the checkbox.
|
|
64
|
+
*/
|
|
17
65
|
value?: CheckboxValueType;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The tab index of the checkbox.
|
|
69
|
+
*/
|
|
18
70
|
tabIndex?: number;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The name attribute for the checkbox.
|
|
74
|
+
*/
|
|
19
75
|
name?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The content displayed next to the checkbox.
|
|
79
|
+
*/
|
|
20
80
|
children?: React.ReactNode;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The unique identifier for the checkbox.
|
|
84
|
+
*/
|
|
21
85
|
id?: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether the checkbox should automatically gain focus on render.
|
|
89
|
+
*/
|
|
22
90
|
autoFocus?: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The input type of the checkbox. Defaults to 'checkbox'.
|
|
94
|
+
*/
|
|
23
95
|
type?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* If true, skips group handling when used inside a CheckboxGroup.
|
|
99
|
+
*/
|
|
24
100
|
skipGroup?: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Whether the checkbox is required for form submission.
|
|
104
|
+
*/
|
|
25
105
|
required?: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Whether the checkbox is in an indeterminate state (partially selected).
|
|
109
|
+
*/
|
|
26
110
|
indeterminate?: boolean;
|
|
111
|
+
|
|
27
112
|
/**
|
|
28
113
|
* Never use this prop. Akinon design system does not allow custom styles.
|
|
29
114
|
* @ignore
|
|
@@ -32,37 +117,117 @@ export interface CheckboxProps {
|
|
|
32
117
|
}
|
|
33
118
|
|
|
34
119
|
export interface CheckboxChangeEventTarget extends CheckboxProps {
|
|
120
|
+
/**
|
|
121
|
+
* Indicates whether the checkbox is checked.
|
|
122
|
+
*/
|
|
35
123
|
checked: boolean;
|
|
36
124
|
}
|
|
37
125
|
|
|
38
126
|
export interface CheckboxChangeEvent {
|
|
127
|
+
/**
|
|
128
|
+
* The target checkbox that triggered the event.
|
|
129
|
+
*/
|
|
39
130
|
target: CheckboxChangeEventTarget;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Stops event propagation.
|
|
134
|
+
*/
|
|
40
135
|
stopPropagation: () => void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Prevents the default behavior of the event.
|
|
139
|
+
*/
|
|
41
140
|
preventDefault: () => void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The native mouse event.
|
|
144
|
+
*/
|
|
42
145
|
nativeEvent: MouseEvent;
|
|
43
146
|
}
|
|
44
147
|
|
|
45
148
|
export interface CheckboxOptionType<
|
|
46
149
|
T extends CheckboxValueType = CheckboxValueType
|
|
47
150
|
> {
|
|
151
|
+
/**
|
|
152
|
+
* The label displayed next to the checkbox. Can be a string or a React node.
|
|
153
|
+
*/
|
|
48
154
|
label: React.ReactNode;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The value associated with the checkbox. Must match the generic type `T`.
|
|
158
|
+
*/
|
|
49
159
|
value: T;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether the checkbox option is disabled.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
50
165
|
disabled?: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A descriptive title for the checkbox option, used for accessibility.
|
|
169
|
+
*/
|
|
51
170
|
title?: string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The unique identifier for the checkbox option.
|
|
174
|
+
*/
|
|
52
175
|
id?: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Event handler triggered when the option's value changes.
|
|
179
|
+
* @param e - The change event object.
|
|
180
|
+
*/
|
|
53
181
|
onChange?: (e: CheckboxChangeEvent) => void;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Whether the checkbox option is required for form submission.
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
54
187
|
required?: boolean;
|
|
55
188
|
}
|
|
56
189
|
|
|
57
190
|
export interface CheckboxGroupProps<
|
|
58
191
|
T extends CheckboxValueType = CheckboxValueType
|
|
59
192
|
> {
|
|
193
|
+
/**
|
|
194
|
+
* Additional CSS class for the CheckboxGroup.
|
|
195
|
+
*/
|
|
60
196
|
className?: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The options for the checkbox group. Each option can be a string, number, or an object.
|
|
200
|
+
*/
|
|
61
201
|
options?: (CheckboxOptionType<T> | string | number)[];
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Whether the entire group is disabled.
|
|
205
|
+
*/
|
|
62
206
|
disabled?: boolean;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The name attribute for all checkboxes in the group.
|
|
210
|
+
*/
|
|
63
211
|
name?: string;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The default checked values of the group.
|
|
215
|
+
*/
|
|
64
216
|
defaultValue?: T[];
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The controlled checked values of the group.
|
|
220
|
+
*/
|
|
65
221
|
value?: T[];
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Event handler triggered when the group value changes.
|
|
225
|
+
* @param checkedValue - An array of checked values.
|
|
226
|
+
*/
|
|
66
227
|
onChange?: (checkedValue: T[]) => void;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The content displayed within the CheckboxGroup.
|
|
231
|
+
*/
|
|
67
232
|
children?: React.ReactNode;
|
|
68
233
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-checkbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"antd": "5.
|
|
13
|
-
"@akinon/ui-theme": "0.
|
|
12
|
+
"antd": "5.22.6",
|
|
13
|
+
"@akinon/ui-theme": "1.0.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
|
-
"typescript": "
|
|
20
|
-
"@akinon/typescript-config": "0.
|
|
19
|
+
"typescript": "*",
|
|
20
|
+
"@akinon/typescript-config": "1.0.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": ">=18",
|