idea-react 3.0.0-beta.2 → 3.0.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-react",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.4",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "author": "shiy2008@gmail.com",
6
6
  "description": "A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.",
@@ -31,9 +31,9 @@
31
31
  "@editorjs/editorjs": "^2.31.7",
32
32
  "@editorjs/paragraph": "^2.11.7",
33
33
  "@react-editor-js/core": "^2.1.0",
34
- "@shikijs/langs": "^4.5.0",
35
- "@shikijs/themes": "^4.5.0",
36
- "@swc/helpers": "^0.5.23",
34
+ "@shikijs/langs": "^4.6.0",
35
+ "@shikijs/themes": "^4.6.0",
36
+ "@swc/helpers": "^0.5.24",
37
37
  "bootstrap": "6.0.0-alpha.1",
38
38
  "classnames": "^2.5.1",
39
39
  "editorjs-html": "^4.0.5",
@@ -43,7 +43,7 @@
43
43
  "mobx-react-helper": "^0.5.4",
44
44
  "react-editor-js": "^2.1.0",
45
45
  "react-live": "^5.0.1",
46
- "shiki": "^4.5.0",
46
+ "shiki": "^4.6.0",
47
47
  "vanilla-calendar-pro": "3.4.0",
48
48
  "web-utility": "^4.8.1"
49
49
  },
@@ -55,7 +55,7 @@
55
55
  "react-element-to-jsx-string": ">=15"
56
56
  },
57
57
  "devDependencies": {
58
- "@cspell/eslint-plugin": "^10.4.0",
58
+ "@cspell/eslint-plugin": "^10.4.1",
59
59
  "@eslint/js": "^10.0.1",
60
60
  "@parcel/config-default": "~2.16.4",
61
61
  "@parcel/packager-ts": "~2.16.4",
@@ -63,10 +63,10 @@
63
63
  "@parcel/transformer-typescript-tsc": "~2.16.4",
64
64
  "@parcel/transformer-typescript-types": "~2.16.4",
65
65
  "@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
66
- "@swc/core": "^1.16.20",
66
+ "@swc/core": "^1.16.22",
67
67
  "@testing-library/dom": "^10.4.2",
68
68
  "@testing-library/react": "^16.3.3",
69
- "@tsdown/css": "^0.23.4",
69
+ "@tsdown/css": "^0.23.7",
70
70
  "@types/lodash": "^4.17.27",
71
71
  "@types/node": "^26.6.6",
72
72
  "@types/react": "^19.3.0",
@@ -76,14 +76,14 @@
76
76
  "eslint-config-prettier": "^10.1.8",
77
77
  "eslint-plugin-react": "^7.37.5",
78
78
  "eslint-plugin-simple-import-sort": "^14.0.0",
79
- "globals": "^17.13.0",
79
+ "globals": "^17.14.0",
80
80
  "happy-dom": "^21.0.4",
81
81
  "husky": "^9.1.7",
82
82
  "jiti": "^2.7.0",
83
83
  "koapache": "^3.0.0",
84
84
  "less": "^4.9.1",
85
85
  "lint-staged": "^17.6.0",
86
- "mobx": "^7.1.3",
86
+ "mobx": "^7.1.5",
87
87
  "mobx-react": "^10.0.3",
88
88
  "parcel": "~2.16.4",
89
89
  "postcss": "^8.5.32",
@@ -94,11 +94,11 @@
94
94
  "react": "^19.3.1",
95
95
  "react-dom": "^19.3.1",
96
96
  "react-element-to-jsx-string": "^18.0.0",
97
- "rimraf": "^6.1.3",
98
- "tsdown": "^0.23.4",
97
+ "rimraf": "^6.1.4",
98
+ "tsdown": "^0.23.7",
99
99
  "typedoc": "^0.28.20",
100
100
  "typedoc-plugin-mdn-links": "^5.1.1",
101
- "typescript": "~5.9.3",
101
+ "typescript": "~6.0.3",
102
102
  "typescript-eslint": "^8.72.1",
103
103
  "unplugin-swc": "^2.0.0",
104
104
  "unrun": "^0.3.1"
package/source/Button.tsx CHANGED
@@ -42,6 +42,12 @@ export const Button = polymorphic<ButtonProps>(
42
42
  const link = isButtonLink(attributes);
43
43
  const Root = RootAs ?? (link ? 'a' : 'button');
44
44
  const nativeButton = Root === 'button';
45
+ const onClick =
46
+ !nativeButton && disabled
47
+ ? typeof Root === 'string'
48
+ ? undefined
49
+ : preventNavigation
50
+ : attributes.onClick;
45
51
  const classes = classNames(
46
52
  variant === false ? undefined : variant ? `btn-${variant}` : icon ? undefined : 'btn',
47
53
  theme && `theme-${theme}`,
@@ -64,7 +70,7 @@ export const Button = polymorphic<ButtonProps>(
64
70
  : attributes['aria-pressed']
65
71
  }
66
72
  tabIndex={!nativeButton && disabled ? -1 : attributes.tabIndex}
67
- onClick={!nativeButton && disabled ? preventNavigation : attributes.onClick}
73
+ onClick={onClick}
68
74
  />
69
75
  );
70
76
  }
@@ -73,7 +73,7 @@ export const UserRankView = polymorphic<UserRankViewProps>(
73
73
  return (
74
74
  <Container as={RootAs} className={className} {...props}>
75
75
  <Row className={style.rankBox}>
76
- <Col span={12} lg={7}>
76
+ <Col xs={12} lg={7}>
77
77
  <div className={`shadow rounded-3 ${style.title}`}>
78
78
  <div className={style.medal}>
79
79
  <i className="d-inline-block ms-1 overflow-hidden rounded-circle" />
@@ -93,7 +93,7 @@ export const UserRankView = polymorphic<UserRankViewProps>(
93
93
  {rank.slice(0, 3).map(renderMedal)}
94
94
  </ul>
95
95
  </Col>
96
- <Col span={12} lg={5}>
96
+ <Col xs={12} lg={5}>
97
97
  <Table className={`my-3 pt-2 ${style.restUsers}`} responsive>
98
98
  <tbody>{rank.slice(3, 10).map(renderRow)}</tbody>
99
99
  </Table>
@@ -1,61 +1,83 @@
1
1
  import classNames from 'classnames';
2
- import { ComponentPropsWithRef, CSSProperties, PropsWithChildren } from 'react';
2
+ import { ComponentPropsWithRef, CSSProperties, PropsWithChildren, Ref } from 'react';
3
3
 
4
4
  import type { ComponentTheme } from '../Button';
5
5
  import { polymorphic } from '../Polymorphic';
6
+ import { splitInputProps } from './inputProps';
6
7
  import { FormValidationProps } from './Primitives';
7
8
 
8
- export type FormSwitchProps = Omit<ComponentPropsWithRef<'label'>, 'children'> &
9
+ type NativeInputProps = Omit<ComponentPropsWithRef<'input'>, 'ref' | 'type' | 'size'>;
10
+
11
+ export type FormSwitchProps = Omit<
12
+ ComponentPropsWithRef<'label'>,
13
+ keyof NativeInputProps | 'children'
14
+ > &
9
15
  PropsWithChildren<
10
- FormValidationProps & {
11
- inputProps?: Omit<ComponentPropsWithRef<'input'>, 'type'>;
12
- size?: 'sm' | 'lg';
13
- theme?: ComponentTheme;
14
- width?: string;
15
- indicatorWidth?: string;
16
- }
16
+ NativeInputProps &
17
+ FormValidationProps & {
18
+ size?: 'sm' | 'lg';
19
+ theme?: ComponentTheme;
20
+ indicatorWidth?: string;
21
+ inputRef?: Ref<HTMLInputElement>;
22
+ inputId?: string;
23
+ inputClassName?: string;
24
+ inputStyle?: CSSProperties;
25
+ }
17
26
  >;
18
27
 
19
28
  export const FormSwitch = polymorphic<FormSwitchProps>(
20
29
  ({
21
30
  as: Root = 'label',
31
+ id,
22
32
  className,
23
- inputProps,
24
33
  size,
25
34
  theme,
26
35
  validation,
27
36
  width,
28
37
  indicatorWidth,
38
+ inputRef,
39
+ inputId,
40
+ inputClassName,
41
+ inputStyle,
29
42
  style,
30
43
  children,
31
44
  ...props
32
- }) => (
33
- <Root
34
- {...props}
35
- className={classNames(
36
- 'switch',
37
- size && `switch-${size}`,
38
- theme && `theme-${theme}`,
39
- validation && `is-${validation}`,
40
- className
41
- )}
42
- style={
43
- {
44
- '--bs-switch-width': width,
45
- '--bs-switch-indicator-width': indicatorWidth,
46
- ...style
47
- } as CSSProperties
48
- }
49
- >
50
- <input
51
- role="switch"
52
- {...inputProps}
53
- type="checkbox"
54
- aria-invalid={validation ? validation === 'invalid' : inputProps?.['aria-invalid']}
55
- className={classNames(validation && `is-${validation}`, inputProps?.className)}
56
- />
57
- {children}
58
- </Root>
59
- )
45
+ }) => {
46
+ const { inputProps, rootProps } = splitInputProps(props);
47
+ const { 'aria-invalid': ariaInvalid } = inputProps;
48
+
49
+ return (
50
+ <Root
51
+ id={id}
52
+ {...rootProps}
53
+ className={classNames(
54
+ 'switch',
55
+ size && `switch-${size}`,
56
+ theme && `theme-${theme}`,
57
+ validation && `is-${validation}`,
58
+ className
59
+ )}
60
+ style={
61
+ {
62
+ '--bs-switch-width': width,
63
+ '--bs-switch-indicator-width': indicatorWidth,
64
+ ...style
65
+ } as CSSProperties
66
+ }
67
+ >
68
+ <input
69
+ {...inputProps}
70
+ ref={inputRef}
71
+ id={inputId}
72
+ role="switch"
73
+ type="checkbox"
74
+ className={classNames(validation && `is-${validation}`, inputClassName)}
75
+ style={inputStyle}
76
+ aria-invalid={validation ? validation === 'invalid' : ariaInvalid}
77
+ />
78
+ {children}
79
+ </Root>
80
+ );
81
+ }
60
82
  );
61
83
  FormSwitch.displayName = 'FormSwitch';
@@ -0,0 +1,184 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+
3
+ type InputProps = Partial<ComponentPropsWithRef<'input'>> & Record<string, unknown>;
4
+
5
+ const inputPropNames = new Set(
6
+ [
7
+ 'accessKey',
8
+ 'accept',
9
+ 'alt',
10
+ 'autoCapitalize',
11
+ 'autoComplete',
12
+ 'autoFocus',
13
+ 'capture',
14
+ 'checked',
15
+ 'contentEditable',
16
+ 'contextMenu',
17
+ 'defaultChecked',
18
+ 'defaultValue',
19
+ 'dir',
20
+ 'dirName',
21
+ 'disabled',
22
+ 'draggable',
23
+ 'enterKeyHint',
24
+ 'form',
25
+ 'formAction',
26
+ 'formEncType',
27
+ 'formMethod',
28
+ 'formNoValidate',
29
+ 'formTarget',
30
+ 'hidden',
31
+ 'height',
32
+ 'id',
33
+ // cspell:ignore inlist
34
+ 'inlist',
35
+ 'inputMode',
36
+ 'is',
37
+ 'itemID',
38
+ 'itemProp',
39
+ 'itemRef',
40
+ 'itemScope',
41
+ 'itemType',
42
+ 'lang',
43
+ 'list',
44
+ 'max',
45
+ 'maxLength',
46
+ 'min',
47
+ 'minLength',
48
+ 'multiple',
49
+ 'name',
50
+ 'nonce',
51
+ 'pattern',
52
+ 'part',
53
+ 'popover',
54
+ 'popoverTarget',
55
+ 'popoverTargetAction',
56
+ 'placeholder',
57
+ 'about',
58
+ 'content',
59
+ 'datatype',
60
+ 'prefix',
61
+ 'property',
62
+ 'radioGroup',
63
+ 'readOnly',
64
+ 'rel',
65
+ 'resource',
66
+ 'results',
67
+ 'rev',
68
+ 'role',
69
+ 'required',
70
+ 'slot',
71
+ 'spellCheck',
72
+ 'src',
73
+ 'step',
74
+ 'tabIndex',
75
+ 'title',
76
+ 'typeof',
77
+ 'translate',
78
+ 'value',
79
+ 'vocab',
80
+ 'width',
81
+ 'autoCorrect',
82
+ 'autoSave',
83
+ 'color',
84
+ 'security',
85
+ 'unselectable',
86
+ 'exportparts',
87
+ 'inert',
88
+ 'onAnimationEnd',
89
+ 'onAnimationIteration',
90
+ 'onAnimationStart',
91
+ 'onAbort',
92
+ 'onAuxClick',
93
+ 'onBeforeInput',
94
+ 'onBeforeToggle',
95
+ 'onBlur',
96
+ 'onCanPlay',
97
+ 'onCanPlayThrough',
98
+ 'onChange',
99
+ 'onClick',
100
+ 'onCompositionEnd',
101
+ 'onCompositionStart',
102
+ 'onCompositionUpdate',
103
+ 'onContextMenu',
104
+ 'onCopy',
105
+ 'onCut',
106
+ 'onDoubleClick',
107
+ 'onDrag',
108
+ 'onDragEnd',
109
+ 'onDragEnter',
110
+ 'onDragExit',
111
+ 'onDragLeave',
112
+ 'onDragOver',
113
+ 'onDragStart',
114
+ 'onDrop',
115
+ 'onDurationChange',
116
+ 'onEmptied',
117
+ 'onEncrypted',
118
+ 'onEnded',
119
+ 'onError',
120
+ 'onFocus',
121
+ 'onGotPointerCapture',
122
+ 'onInput',
123
+ 'onInvalid',
124
+ 'onKeyDown',
125
+ 'onKeyPress',
126
+ 'onKeyUp',
127
+ 'onLoad',
128
+ 'onLoadedData',
129
+ 'onLoadedMetadata',
130
+ 'onLoadStart',
131
+ 'onLostPointerCapture',
132
+ 'onMouseDown',
133
+ 'onMouseEnter',
134
+ 'onMouseLeave',
135
+ 'onMouseMove',
136
+ 'onMouseOut',
137
+ 'onMouseOver',
138
+ 'onMouseUp',
139
+ 'onPaste',
140
+ 'onPause',
141
+ 'onPlay',
142
+ 'onPlaying',
143
+ 'onPointerCancel',
144
+ 'onPointerDown',
145
+ 'onPointerEnter',
146
+ 'onPointerLeave',
147
+ 'onPointerMove',
148
+ 'onPointerOut',
149
+ 'onPointerOver',
150
+ 'onPointerUp',
151
+ 'onProgress',
152
+ 'onRateChange',
153
+ 'onScroll',
154
+ 'onSeeked',
155
+ 'onSeeking',
156
+ 'onSelect',
157
+ 'onScrollEnd',
158
+ 'onStalled',
159
+ 'onSuspend',
160
+ 'onTimeUpdate',
161
+ 'onToggle',
162
+ 'onTransitionCancel',
163
+ 'onTransitionEnd',
164
+ 'onTransitionRun',
165
+ 'onTransitionStart',
166
+ 'onTouchCancel',
167
+ 'onTouchEnd',
168
+ 'onTouchMove',
169
+ 'onTouchStart',
170
+ 'onVolumeChange',
171
+ 'onWaiting',
172
+ 'onWheel'
173
+ ].flatMap(name => [name, `${name}Capture`])
174
+ );
175
+
176
+ export function splitInputProps(props: Record<string, unknown>) {
177
+ const inputProps: InputProps = {};
178
+ const rootProps: Record<string, unknown> = {};
179
+
180
+ for (const [name, value] of Object.entries(props))
181
+ (inputPropNames.has(name) || name.startsWith('aria-') ? inputProps : rootProps)[name] =
182
+ value;
183
+ return { inputProps, rootProps };
184
+ }
package/source/Grid.tsx CHANGED
@@ -8,16 +8,15 @@ export type ColSize = number | 'auto';
8
8
  export type BreakpointColSize = ColSize | true;
9
9
 
10
10
  export interface ContainerProps extends ComponentPropsWithRef<'div'> {
11
- fluid?: boolean;
12
- breakpoint?: Breakpoint;
11
+ fluid?: boolean | Breakpoint;
13
12
  }
14
13
 
15
14
  export const Container = polymorphic<ContainerProps>(
16
- ({ as: Root = 'div', fluid, breakpoint, className, ...props }) => (
15
+ ({ as: Root = 'div', fluid, className, ...props }) => (
17
16
  <Root
18
17
  {...props}
19
18
  className={classNames(
20
- breakpoint ? `${breakpoint}:container` : fluid ? 'container-fluid' : 'container',
19
+ fluid === true ? 'container-fluid' : fluid ? `${fluid}:container` : 'container',
21
20
  className
22
21
  )}
23
22
  />
@@ -28,7 +27,7 @@ Container.displayName = 'Container';
28
27
  export type RowCols = number | 'auto';
29
28
 
30
29
  export interface RowProps extends ComponentPropsWithRef<'div'> {
31
- cols?: RowCols;
30
+ xs?: RowCols;
32
31
  sm?: RowCols;
33
32
  md?: RowCols;
34
33
  lg?: RowCols;
@@ -37,7 +36,7 @@ export interface RowProps extends ComponentPropsWithRef<'div'> {
37
36
  }
38
37
 
39
38
  export const Row = polymorphic<RowProps>(
40
- ({ as: Root = 'div', cols, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
39
+ ({ as: Root = 'div', xs, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
41
40
  const sizes: [Breakpoint, RowCols | undefined][] = [
42
41
  ['sm', sm],
43
42
  ['md', md],
@@ -51,7 +50,7 @@ export const Row = polymorphic<RowProps>(
51
50
  {...props}
52
51
  className={classNames(
53
52
  'row',
54
- cols !== undefined && `row-cols-${cols}`,
53
+ xs !== undefined && `row-cols-${xs}`,
55
54
  sizes.map(
56
55
  ([breakpoint, size]) =>
57
56
  size !== undefined && `${breakpoint}:row-cols-${size}`
@@ -65,7 +64,7 @@ export const Row = polymorphic<RowProps>(
65
64
  Row.displayName = 'Row';
66
65
 
67
66
  export interface ColProps extends ComponentPropsWithRef<'div'> {
68
- span?: ColSize;
67
+ xs?: BreakpointColSize;
69
68
  sm?: BreakpointColSize;
70
69
  md?: BreakpointColSize;
71
70
  lg?: BreakpointColSize;
@@ -74,7 +73,7 @@ export interface ColProps extends ComponentPropsWithRef<'div'> {
74
73
  }
75
74
 
76
75
  export const Col = polymorphic<ColProps>(
77
- ({ as: Root = 'div', span, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
76
+ ({ as: Root = 'div', xs, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
78
77
  const sizes: [Breakpoint, BreakpointColSize | undefined][] = [
79
78
  ['sm', sm],
80
79
  ['md', md],
@@ -88,8 +87,10 @@ export const Col = polymorphic<ColProps>(
88
87
  <Root
89
88
  {...props}
90
89
  className={classNames(
91
- !span && !sized && 'col',
92
- span !== undefined && `col-${span}`,
90
+ {
91
+ col: (xs === undefined && !sized) || xs === true,
92
+ [`col-${xs}`]: xs !== undefined && xs !== true
93
+ },
93
94
  sizes.map(
94
95
  ([breakpoint, size]) =>
95
96
  size !== undefined &&
@@ -1,5 +1,3 @@
1
- import './style.module.css';
2
-
3
1
  import classNames from 'classnames';
4
2
  import { ComponentPropsWithRef, CSSProperties } from 'react';
5
3
 
@@ -36,7 +34,9 @@ export const Progress = polymorphic<ProgressProps>(
36
34
 
37
35
  const current = Math.min(max, Math.max(min, value));
38
36
  const width = `${((current - min) / (max - min)) * 100}%`;
37
+ // Stacks set the offset to zero and fill each segment's inner bar.
39
38
  const progressStyle: CSSProperties & { '--_progress-width': string } = {
39
+ width: 'min(100%, calc(var(--_progress-width) + var(--_progress-stack-offset, 100%)))',
40
40
  ...style,
41
41
  '--_progress-width': width
42
42
  };
@@ -63,7 +63,7 @@ export const Progress = polymorphic<ProgressProps>(
63
63
  },
64
64
  barClass
65
65
  )}
66
- style={barStyle}
66
+ style={{ width: `var(--_progress-bar-width, ${width})`, ...barStyle }}
67
67
  >
68
68
  {children}
69
69
  </div>
@@ -74,8 +74,18 @@ export const Progress = polymorphic<ProgressProps>(
74
74
  Progress.displayName = 'Progress';
75
75
 
76
76
  export const ProgressStack = polymorphic<ComponentPropsWithRef<'div'>>(
77
- ({ as: Root = 'div', className, ...props }) => (
78
- <Root {...props} className={classNames('progress-stacked', className)} />
77
+ ({ as: Root = 'div', className, style, ...props }) => (
78
+ <Root
79
+ {...props}
80
+ className={classNames('progress-stacked', className)}
81
+ style={
82
+ {
83
+ '--_progress-stack-offset': '0%',
84
+ '--_progress-bar-width': '100%',
85
+ ...style
86
+ } as CSSProperties
87
+ }
88
+ />
79
89
  )
80
90
  );
81
91
  ProgressStack.displayName = 'ProgressStack';
@@ -1,32 +1,32 @@
1
1
  import classNames from 'classnames';
2
- import { ComponentPropsWithRef } from 'react';
2
+ import { ComponentPropsWithRef, CSSProperties, Ref } from 'react';
3
3
 
4
4
  import type { ComponentTheme } from './Button';
5
+ import { splitInputProps } from './Form/inputProps';
5
6
  import { polymorphic } from './Polymorphic';
6
7
 
7
- export interface ToggleButtonProps extends Omit<ComponentPropsWithRef<'label'>, 'onChange'> {
8
- type?: 'checkbox' | 'radio';
9
- variant?: 'solid' | 'outline' | 'subtle' | 'text';
10
- theme?: ComponentTheme;
11
- name?: string;
12
- value?: string;
13
- checked?: boolean;
14
- defaultChecked?: boolean;
15
- disabled?: boolean;
16
- required?: boolean;
17
- size?: 'xs' | 'sm' | 'lg';
18
- inputProps?: Omit<
19
- ComponentPropsWithRef<'input'>,
20
- 'type' | 'name' | 'value' | 'checked' | 'defaultChecked' | 'disabled' | 'required'
21
- >;
22
- onChange?: ComponentPropsWithRef<'input'>['onChange'];
23
- }
8
+ type NativeInputProps = Omit<ComponentPropsWithRef<'input'>, 'ref' | 'type' | 'size'>;
9
+
10
+ export type ToggleButtonProps = Omit<
11
+ ComponentPropsWithRef<'label'>,
12
+ keyof NativeInputProps | 'onChange'
13
+ > &
14
+ NativeInputProps & {
15
+ type?: 'checkbox' | 'radio';
16
+ variant?: 'solid' | 'outline' | 'subtle' | 'text';
17
+ theme?: ComponentTheme;
18
+ size?: 'xs' | 'sm' | 'lg';
19
+ inputRef?: Ref<HTMLInputElement>;
20
+ inputClassName?: string;
21
+ inputStyle?: CSSProperties;
22
+ };
24
23
 
25
24
  export const ToggleButton = polymorphic<ToggleButtonProps>(
26
25
  ({
27
26
  as: Root = 'label',
28
27
  type = 'checkbox',
29
28
  variant = 'solid',
29
+ className,
30
30
  theme,
31
31
  name,
32
32
  value,
@@ -35,30 +35,38 @@ export const ToggleButton = polymorphic<ToggleButtonProps>(
35
35
  disabled,
36
36
  required,
37
37
  size,
38
- inputProps,
39
- onChange,
40
- className,
38
+ inputRef,
39
+ inputClassName,
40
+ inputStyle,
41
41
  children,
42
+ onChange,
42
43
  ...props
43
- }) => (
44
- <Root
45
- {...props}
46
- className={classNames(
47
- 'btn-check',
48
- `btn-${variant}`,
49
- theme && `theme-${theme}`,
50
- size && `btn-${size}`,
51
- className
52
- )}
53
- >
54
- <input
55
- {...inputProps}
56
- {...{ type, name, value, checked, defaultChecked, disabled, required }}
57
- autoComplete="off"
58
- onChange={onChange}
59
- />
60
- {children}
61
- </Root>
62
- )
44
+ }) => {
45
+ const { inputProps, rootProps } = splitInputProps(props);
46
+
47
+ return (
48
+ <Root
49
+ {...rootProps}
50
+ className={classNames(
51
+ 'btn-check',
52
+ `btn-${variant}`,
53
+ theme && `theme-${theme}`,
54
+ size && `btn-${size}`,
55
+ className
56
+ )}
57
+ >
58
+ <input
59
+ {...inputProps}
60
+ ref={inputRef}
61
+ className={inputClassName}
62
+ style={inputStyle}
63
+ {...{ type, name, value, checked, defaultChecked, disabled, required }}
64
+ autoComplete={inputProps.autoComplete ?? 'off'}
65
+ onChange={onChange}
66
+ />
67
+ {children}
68
+ </Root>
69
+ );
70
+ }
63
71
  );
64
72
  ToggleButton.displayName = 'ToggleButton';