idea-react 3.0.0-beta.1 → 3.0.0-beta.3
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/AGENTS.md +12 -3
- package/ReadMe.md +34 -6
- package/dist/index.d.mts +313 -230
- package/dist/index.d.ts +313 -230
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/style.css +0 -3
- package/package.json +13 -13
- package/source/Accordion.tsx +61 -37
- package/source/Alert.tsx +30 -15
- package/source/Avatar.tsx +55 -50
- package/source/Badge.tsx +16 -16
- package/source/Breadcrumb.tsx +36 -22
- package/source/Button.tsx +63 -69
- package/source/ButtonGroup.tsx +21 -25
- package/source/Card.tsx +67 -59
- package/source/Carousel/index.tsx +22 -21
- package/source/CloseButton.tsx +20 -15
- package/source/Collapse.tsx +74 -19
- package/source/Drawer.tsx +40 -17
- package/source/Extension/ClickBoundary.tsx +24 -5
- package/source/Extension/CodeBlock.tsx +64 -0
- package/source/Extension/Countdown.tsx +21 -9
- package/source/Extension/Editor.tsx +53 -18
- package/source/Extension/EditorHTML.tsx +7 -3
- package/source/Extension/HorizontalMarquee/index.tsx +69 -45
- package/source/Extension/Icon.tsx +15 -14
- package/source/Extension/Loading.tsx +20 -17
- package/source/Extension/MonthCalendar.tsx +26 -10
- package/source/Extension/OverlayBox.tsx +28 -15
- package/source/Extension/PageNav.tsx +16 -7
- package/source/Extension/ScrollNav/Scroller.tsx +21 -5
- package/source/Extension/ScrollNav/index.tsx +32 -7
- package/source/Extension/Select.tsx +12 -11
- package/source/Extension/SpinnerButton.tsx +19 -24
- package/source/Extension/TableSpinner.tsx +10 -14
- package/source/Extension/TextTruncate/index.tsx +17 -13
- package/source/Extension/Time.tsx +7 -5
- package/source/Extension/TimeDistance.tsx +22 -18
- package/source/Extension/Timeline/index.tsx +37 -34
- package/source/Extension/TypeEcho/Content.tsx +79 -14
- package/source/Extension/TypeEcho/index.tsx +13 -5
- package/source/Extension/UserRank/Address.tsx +17 -15
- package/source/Extension/UserRank/index.tsx +79 -84
- package/source/Extension/VerticalMarquee/index.tsx +14 -16
- package/source/Extension/ZodiacBar.tsx +40 -32
- package/source/Form/Adorn.tsx +30 -32
- package/source/Form/Checkbox.tsx +9 -5
- package/source/Form/ChipInput.tsx +9 -5
- package/source/Form/Chips.tsx +41 -39
- package/source/Form/Combobox.tsx +80 -61
- package/source/Form/Control.tsx +53 -58
- package/source/Form/DatePicker.tsx +74 -65
- package/source/Form/Feedback.tsx +18 -19
- package/source/Form/FloatingLabel.tsx +16 -19
- package/source/Form/InputGroup.tsx +27 -26
- package/source/Form/OTP.tsx +30 -12
- package/source/Form/Primitives.tsx +47 -39
- package/source/Form/Radio.tsx +25 -22
- package/source/Form/Range.tsx +30 -12
- package/source/Form/Switch.tsx +73 -48
- package/source/Form/inputProps.ts +184 -0
- package/source/Grid.tsx +67 -59
- package/source/Image.tsx +10 -6
- package/source/ListGroup.tsx +57 -69
- package/source/Menu.tsx +128 -66
- package/source/NativeDialog/index.tsx +51 -29
- package/source/Nav.tsx +46 -46
- package/source/NavOverflow/index.tsx +26 -10
- package/source/Navbar.tsx +60 -55
- package/source/Pagination.tsx +63 -69
- package/source/Placeholder.tsx +47 -43
- package/source/Polymorphic.ts +57 -0
- package/source/Popover.tsx +34 -31
- package/source/Progress/index.tsx +59 -54
- package/source/ScrollSpy/index.tsx +48 -33
- package/source/Spinner.tsx +27 -23
- package/source/Stack.tsx +25 -0
- package/source/Stepper.tsx +46 -40
- package/source/Tab.tsx +40 -27
- package/source/Table.tsx +53 -42
- package/source/Toast.tsx +62 -47
- package/source/ToggleButton.tsx +65 -54
- package/source/Toggler.tsx +17 -8
- package/source/Tooltip.tsx +31 -29
- package/source/index.ts +2 -0
- package/tsconfig.json +2 -2
- package/source/Extension/CodeBlock/index.tsx +0 -58
- package/source/Extension/CodeBlock/style.module.css +0 -3
|
@@ -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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ComponentPropsWithRef
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from './Polymorphic';
|
|
3
5
|
|
|
4
6
|
export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
5
7
|
export type ColSize = number | 'auto';
|
|
@@ -10,15 +12,18 @@ export interface ContainerProps extends ComponentPropsWithRef<'div'> {
|
|
|
10
12
|
breakpoint?: Breakpoint;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const Container
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
export const Container = polymorphic<ContainerProps>(
|
|
16
|
+
({ as: Root = 'div', fluid, breakpoint, className, ...props }) => (
|
|
17
|
+
<Root
|
|
18
|
+
{...props}
|
|
19
|
+
className={classNames(
|
|
20
|
+
breakpoint ? `${breakpoint}:container` : fluid ? 'container-fluid' : 'container',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
21
25
|
);
|
|
26
|
+
Container.displayName = 'Container';
|
|
22
27
|
|
|
23
28
|
export type RowCols = number | 'auto';
|
|
24
29
|
|
|
@@ -31,29 +36,33 @@ export interface RowProps extends ComponentPropsWithRef<'div'> {
|
|
|
31
36
|
'2xl'?: RowCols;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
export const Row
|
|
35
|
-
|
|
36
|
-
[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
export const Row = polymorphic<RowProps>(
|
|
40
|
+
({ as: Root = 'div', cols, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
|
|
41
|
+
const sizes: [Breakpoint, RowCols | undefined][] = [
|
|
42
|
+
['sm', sm],
|
|
43
|
+
['md', md],
|
|
44
|
+
['lg', lg],
|
|
45
|
+
['xl', xl],
|
|
46
|
+
['2xl', xxl]
|
|
47
|
+
];
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
return (
|
|
50
|
+
<Root
|
|
51
|
+
{...props}
|
|
52
|
+
className={classNames(
|
|
53
|
+
'row',
|
|
54
|
+
cols !== undefined && `row-cols-${cols}`,
|
|
55
|
+
sizes.map(
|
|
56
|
+
([breakpoint, size]) =>
|
|
57
|
+
size !== undefined && `${breakpoint}:row-cols-${size}`
|
|
58
|
+
),
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
Row.displayName = 'Row';
|
|
57
66
|
|
|
58
67
|
export interface ColProps extends ComponentPropsWithRef<'div'> {
|
|
59
68
|
span?: ColSize;
|
|
@@ -64,33 +73,32 @@ export interface ColProps extends ComponentPropsWithRef<'div'> {
|
|
|
64
73
|
'2xl'?: BreakpointColSize;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
export const Col
|
|
68
|
-
|
|
69
|
-
[
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
export const Col = polymorphic<ColProps>(
|
|
77
|
+
({ as: Root = 'div', span, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
|
|
78
|
+
const sizes: [Breakpoint, BreakpointColSize | undefined][] = [
|
|
79
|
+
['sm', sm],
|
|
80
|
+
['md', md],
|
|
81
|
+
['lg', lg],
|
|
82
|
+
['xl', xl],
|
|
83
|
+
['2xl', xxl]
|
|
84
|
+
];
|
|
85
|
+
const sized = sizes.some(([, size]) => size !== undefined);
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
Container.displayName = 'Container';
|
|
95
|
-
Row.displayName = 'Row';
|
|
87
|
+
return (
|
|
88
|
+
<Root
|
|
89
|
+
{...props}
|
|
90
|
+
className={classNames(
|
|
91
|
+
!span && !sized && 'col',
|
|
92
|
+
span !== undefined && `col-${span}`,
|
|
93
|
+
sizes.map(
|
|
94
|
+
([breakpoint, size]) =>
|
|
95
|
+
size !== undefined &&
|
|
96
|
+
(size === true ? `${breakpoint}:col` : `${breakpoint}:col-${size}`)
|
|
97
|
+
),
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
96
104
|
Col.displayName = 'Col';
|
package/source/Image.tsx
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ComponentPropsWithRef
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from './Polymorphic';
|
|
3
5
|
|
|
4
6
|
export interface ImageProps extends ComponentPropsWithRef<'img'> {
|
|
5
7
|
fluid?: boolean;
|
|
6
8
|
thumbnail?: boolean;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export const Image
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const Image = polymorphic<ImageProps>(
|
|
12
|
+
({ as: Root = 'img', fluid, thumbnail, className, ...props }) => (
|
|
13
|
+
<Root
|
|
14
|
+
{...props}
|
|
15
|
+
className={classNames({ 'img-fluid': fluid, 'img-thumbnail': thumbnail }, className)}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
14
18
|
);
|
|
15
19
|
Image.displayName = 'Image';
|
package/source/ListGroup.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ComponentPropsWithRef
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ComponentTheme } from './Button';
|
|
5
5
|
import type { Breakpoint } from './Grid';
|
|
6
|
+
import { polymorphic } from './Polymorphic';
|
|
6
7
|
|
|
7
8
|
export type ListGroupHorizontal = boolean | Breakpoint;
|
|
8
9
|
|
|
@@ -19,32 +20,22 @@ export type ListGroupProps = ListGroupStyleProps &
|
|
|
19
20
|
| (ComponentPropsWithRef<'div'> & { as: 'div' })
|
|
20
21
|
);
|
|
21
22
|
|
|
22
|
-
export const ListGroup
|
|
23
|
-
flush,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(horizontal === true ? 'list-group-horizontal' : `${horizontal}:list-group-horizontal`),
|
|
34
|
-
className
|
|
35
|
-
);
|
|
23
|
+
export const ListGroup = polymorphic<ListGroupStyleProps & ComponentPropsWithRef<'ul'>>(
|
|
24
|
+
({ as: Root = 'ul', flush, numbered, horizontal, className, ...props }) => {
|
|
25
|
+
const classes = classNames(
|
|
26
|
+
'list-group',
|
|
27
|
+
{ 'list-group-flush': flush, 'list-group-numbered': numbered },
|
|
28
|
+
horizontal &&
|
|
29
|
+
(horizontal === true
|
|
30
|
+
? 'list-group-horizontal'
|
|
31
|
+
: `${horizontal}:list-group-horizontal`),
|
|
32
|
+
className
|
|
33
|
+
);
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
const { as: _as, ...attributes } = props;
|
|
39
|
-
return <ol {...attributes} className={classes} />;
|
|
40
|
-
}
|
|
41
|
-
if (props.as === 'div') {
|
|
42
|
-
const { as: _as, ...attributes } = props;
|
|
43
|
-
return <div {...attributes} className={classes} />;
|
|
35
|
+
return <Root {...props} className={classes} />;
|
|
44
36
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
37
|
+
);
|
|
38
|
+
ListGroup.displayName = 'ListGroup';
|
|
48
39
|
|
|
49
40
|
interface ListGroupItemStyleProps {
|
|
50
41
|
theme?: ComponentTheme;
|
|
@@ -67,50 +58,47 @@ const isLink = (props: ListGroupItemElementAttributes): props is ListGroupItemLi
|
|
|
67
58
|
const isButton = (props: ListGroupItemElementAttributes): props is ListGroupItemButtonAttributes =>
|
|
68
59
|
typeof props.type === 'string';
|
|
69
60
|
|
|
70
|
-
export const ListGroupItem
|
|
71
|
-
theme,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
className,
|
|
76
|
-
...props
|
|
77
|
-
}) => {
|
|
78
|
-
const classes = classNames(
|
|
79
|
-
'list-group-item',
|
|
80
|
-
theme && `theme-${theme}`,
|
|
81
|
-
action && 'list-group-item-action',
|
|
82
|
-
{ active, disabled },
|
|
83
|
-
disabled && 'pe-none',
|
|
84
|
-
className
|
|
85
|
-
);
|
|
61
|
+
export const ListGroupItem = polymorphic<ListGroupItemProps>(
|
|
62
|
+
({ as: RootAs, theme, action, active, disabled, className, ...props }) => {
|
|
63
|
+
const Root = RootAs ?? 'a';
|
|
64
|
+
const Root1 = RootAs ?? 'button';
|
|
65
|
+
const Root2 = RootAs ?? 'li';
|
|
86
66
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
onClick={disabled ? undefined : props.onClick}
|
|
96
|
-
/>
|
|
97
|
-
) : isButton(props) ? (
|
|
98
|
-
<button
|
|
99
|
-
{...props}
|
|
100
|
-
type={props.type || 'button'}
|
|
101
|
-
className={classes}
|
|
102
|
-
aria-current={active ? 'true' : undefined}
|
|
103
|
-
disabled={disabled}
|
|
104
|
-
/>
|
|
105
|
-
) : (
|
|
106
|
-
<li
|
|
107
|
-
{...(props as ListGroupItemAttributes)}
|
|
108
|
-
className={classes}
|
|
109
|
-
aria-current={active ? 'true' : undefined}
|
|
110
|
-
aria-disabled={disabled || undefined}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
67
|
+
const classes = classNames(
|
|
68
|
+
'list-group-item',
|
|
69
|
+
theme && `theme-${theme}`,
|
|
70
|
+
action && 'list-group-item-action',
|
|
71
|
+
{ active, disabled },
|
|
72
|
+
disabled && 'pe-none',
|
|
73
|
+
className
|
|
74
|
+
);
|
|
114
75
|
|
|
115
|
-
|
|
76
|
+
return isLink(props) ? (
|
|
77
|
+
<Root
|
|
78
|
+
{...props}
|
|
79
|
+
className={classes}
|
|
80
|
+
href={disabled ? undefined : props.href}
|
|
81
|
+
aria-current={active ? 'true' : undefined}
|
|
82
|
+
aria-disabled={disabled || undefined}
|
|
83
|
+
tabIndex={disabled ? -1 : props.tabIndex}
|
|
84
|
+
onClick={disabled ? undefined : props.onClick}
|
|
85
|
+
/>
|
|
86
|
+
) : isButton(props) ? (
|
|
87
|
+
<Root1
|
|
88
|
+
{...props}
|
|
89
|
+
type={props.type || 'button'}
|
|
90
|
+
className={classes}
|
|
91
|
+
aria-current={active ? 'true' : undefined}
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
/>
|
|
94
|
+
) : (
|
|
95
|
+
<Root2
|
|
96
|
+
{...(props as ListGroupItemAttributes)}
|
|
97
|
+
className={classes}
|
|
98
|
+
aria-current={active ? 'true' : undefined}
|
|
99
|
+
aria-disabled={disabled || undefined}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
116
104
|
ListGroupItem.displayName = 'ListGroupItem';
|