idea-react 3.0.0-beta.5 → 3.0.0-rc.1
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 +15 -16
- package/ReadMe.md +71 -65
- package/dist/index.d.mts +966 -965
- package/dist/index.d.ts +966 -965
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/style.css +2 -2
- package/package.json +4 -14
- package/source/{Accordion.tsx → Base/Accordion.tsx} +3 -3
- package/source/{Alert.tsx → Base/Alert.tsx} +1 -1
- package/source/{Avatar.tsx → Base/Avatar.tsx} +1 -1
- package/source/{Badge.tsx → Base/Badge.tsx} +1 -1
- package/source/{Breadcrumb.tsx → Base/Breadcrumb.tsx} +16 -4
- package/source/{Button.tsx → Base/Button.tsx} +6 -2
- package/source/{ButtonGroup.tsx → Base/ButtonGroup.tsx} +1 -1
- package/source/{Card.tsx → Base/Card.tsx} +1 -1
- package/source/{Carousel → Base/Carousel}/index.tsx +4 -14
- package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
- package/source/{Collapse.tsx → Base/Collapse.tsx} +18 -3
- package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
- package/source/Base/Fade.tsx +15 -0
- package/source/{ListGroup.tsx → Base/ListGroup.tsx} +14 -4
- package/source/{Menu.tsx → Base/Menu.tsx} +5 -11
- package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
- package/source/{Nav.tsx → Base/Nav.tsx} +5 -2
- package/source/{NavOverflow → Base/NavOverflow}/index.tsx +3 -3
- package/source/{Navbar.tsx → Base/Navbar.tsx} +20 -14
- package/source/{Pagination.tsx → Base/Pagination.tsx} +1 -1
- package/source/{Placeholder.tsx → Base/Placeholder.tsx} +1 -1
- package/source/{Popover.tsx → Base/Popover.tsx} +6 -2
- package/source/{Progress → Base/Progress}/index.tsx +1 -1
- package/source/{ScrollSpy → Base/ScrollSpy}/index.tsx +1 -1
- package/source/{Spinner.tsx → Base/Spinner.tsx} +2 -2
- package/source/{Stack.tsx → Base/Stack.tsx} +1 -1
- package/source/{Stepper.tsx → Base/Stepper.tsx} +2 -2
- package/source/{Tab.tsx → Base/Tab.tsx} +60 -47
- package/source/{Toast.tsx → Base/Toast.tsx} +1 -1
- package/source/{ToggleButton.tsx → Base/ToggleButton.tsx} +2 -2
- package/source/{Toggler.tsx → Base/Toggler.tsx} +1 -1
- package/source/{Tooltip.tsx → Base/Tooltip.tsx} +6 -2
- package/source/Base/index.ts +32 -0
- package/source/Content/Figure.tsx +26 -0
- package/source/Content/Images.tsx +29 -0
- package/source/{Table.tsx → Content/Tables.tsx} +2 -2
- package/source/Content/index.ts +3 -0
- package/source/Extension/ClickBoundary.tsx +1 -1
- package/source/Extension/CodeBlock.tsx +1 -1
- package/source/Extension/Countdown.tsx +1 -1
- package/source/Extension/HorizontalMarquee/index.tsx +1 -1
- package/source/Extension/Icon.tsx +16 -3
- package/source/Extension/Loading.tsx +2 -2
- package/source/Extension/MarkdownView.tsx +23 -0
- package/source/Extension/MonthCalendar.tsx +4 -4
- package/source/Extension/Nameplate.tsx +1 -1
- package/source/Extension/OverlayBox.tsx +9 -4
- package/source/Extension/PageNav.tsx +2 -2
- package/source/Extension/ScrollNav/Scroller.tsx +1 -1
- package/source/Extension/ScrollNav/index.tsx +6 -4
- package/source/Extension/ShareBox.tsx +1 -1
- package/source/Extension/SpinnerButton.tsx +3 -3
- package/source/Extension/TableSpinner.tsx +2 -2
- package/source/Extension/TextTruncate/index.tsx +1 -1
- package/source/Extension/Time.tsx +1 -1
- package/source/Extension/TimeDistance.tsx +1 -1
- package/source/Extension/Timeline/index.tsx +2 -2
- package/source/Extension/TypeEcho/Content.tsx +1 -1
- package/source/Extension/TypeEcho/index.tsx +1 -1
- package/source/Extension/UserRank/Address.tsx +1 -1
- package/source/Extension/UserRank/index.tsx +11 -10
- package/source/Extension/VerticalMarquee/index.tsx +1 -1
- package/source/Extension/ZodiacBar.tsx +1 -1
- package/source/Extension/index.ts +1 -3
- package/source/Form/Adorn.tsx +1 -1
- package/source/Form/Checkbox.tsx +2 -2
- package/source/Form/{Chips.tsx → Chip.tsx} +5 -12
- package/source/Form/ChipInput.tsx +3 -3
- package/source/Form/Combobox.tsx +5 -9
- package/source/Form/Control.tsx +1 -1
- package/source/Form/DatePicker.tsx +3 -3
- package/source/Form/Feedback.tsx +1 -1
- package/source/Form/FloatingLabel.tsx +1 -1
- package/source/Form/InputGroup.tsx +3 -3
- package/source/Form/OTP.tsx +1 -1
- package/source/Form/Primitives.tsx +8 -9
- package/source/Form/Radio.tsx +15 -5
- package/source/Form/Range.tsx +2 -2
- package/source/Form/Switch.tsx +2 -2
- package/source/Form/index.ts +1 -1
- package/source/{Overlay.ts → Helper/Overlay.ts} +1 -1
- package/source/{color.ts → Helper/color.ts} +1 -1
- package/source/Helper/index.ts +4 -0
- package/source/{Grid.tsx → Layout/Grid.tsx} +36 -26
- package/source/Layout/Ratio.tsx +29 -0
- package/source/Layout/index.ts +2 -0
- package/source/index.ts +4 -38
- package/source/types.d.ts +4 -0
- package/source/Extension/Editor.tsx +0 -78
- package/source/Extension/EditorHTML.tsx +0 -20
- package/source/Extension/Select.tsx +0 -128
- package/source/Image.tsx +0 -19
- /package/source/{Carousel → Base/Carousel}/model.ts +0 -0
- /package/source/{Carousel → Base/Carousel}/scroll.ts +0 -0
- /package/source/{Carousel → Base/Carousel}/style.module.css +0 -0
- /package/source/{NativeDialog → Base/NativeDialog}/style.module.css +0 -0
- /package/source/{NavOverflow → Base/NavOverflow}/model.ts +0 -0
- /package/source/{ScrollSpy → Base/ScrollSpy}/model.ts +0 -0
- /package/source/{Polymorphic.ts → Helper/Polymorphic.ts} +0 -0
- /package/source/{animate.ts → Helper/animate.ts} +0 -0
package/dist/style.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.
|
|
1
|
+
.HR-isq_paused .carousel-indicators .active:after {
|
|
2
2
|
animation-play-state: paused;
|
|
3
3
|
}
|
|
4
|
-
.
|
|
4
|
+
.rDVV3q_hiddenBackdrop {
|
|
5
5
|
--bs-dialog-backdrop-bg: transparent;
|
|
6
6
|
--bs-dialog-backdrop-blur: 0;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-react",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
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.",
|
|
@@ -28,20 +28,16 @@
|
|
|
28
28
|
"require": "./dist/index.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@editorjs/editorjs": "^2.31.7",
|
|
32
|
-
"@editorjs/paragraph": "^2.11.7",
|
|
33
|
-
"@react-editor-js/core": "^2.1.0",
|
|
34
31
|
"@shikijs/langs": "^4.6.0",
|
|
35
32
|
"@shikijs/themes": "^4.6.0",
|
|
36
33
|
"@swc/helpers": "^0.5.24",
|
|
37
34
|
"bootstrap": "6.0.0-alpha.1",
|
|
38
35
|
"classnames": "^2.5.1",
|
|
39
|
-
"editorjs-html": "^4.0.5",
|
|
40
36
|
"html2canvas": "^1.4.1",
|
|
41
37
|
"iterable-observer": "^1.1.1",
|
|
42
38
|
"lodash": "^4.18.1",
|
|
39
|
+
"marked": "^18.1.3",
|
|
43
40
|
"mobx-react-helper": "^0.5.4",
|
|
44
|
-
"react-editor-js": "^2.1.0",
|
|
45
41
|
"react-live": "^5.0.1",
|
|
46
42
|
"shiki": "^4.6.0",
|
|
47
43
|
"vanilla-calendar-pro": "3.4.0",
|
|
@@ -55,8 +51,6 @@
|
|
|
55
51
|
"react-element-to-jsx-string": ">=15"
|
|
56
52
|
},
|
|
57
53
|
"devDependencies": {
|
|
58
|
-
"@cspell/eslint-plugin": "^10.4.1",
|
|
59
|
-
"@eslint/js": "^10.0.1",
|
|
60
54
|
"@parcel/config-default": "~2.16.4",
|
|
61
55
|
"@parcel/packager-ts": "~2.16.4",
|
|
62
56
|
"@parcel/transformer-less": "2.16.4",
|
|
@@ -73,10 +67,7 @@
|
|
|
73
67
|
"@types/react-dom": "^19.3.0",
|
|
74
68
|
"buffer": "^6.0.3",
|
|
75
69
|
"eslint": "^10.14.0",
|
|
76
|
-
"eslint-
|
|
77
|
-
"eslint-plugin-react": "^7.37.5",
|
|
78
|
-
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
79
|
-
"globals": "^17.14.0",
|
|
70
|
+
"eslint-idea2app-next-js": "^0.1.1",
|
|
80
71
|
"happy-dom": "^21.0.4",
|
|
81
72
|
"husky": "^9.1.7",
|
|
82
73
|
"jiti": "^2.7.0",
|
|
@@ -99,7 +90,6 @@
|
|
|
99
90
|
"typedoc": "^0.28.20",
|
|
100
91
|
"typedoc-plugin-mdn-links": "^5.1.1",
|
|
101
92
|
"typescript": "~6.0.3",
|
|
102
|
-
"typescript-eslint": "^8.72.1",
|
|
103
93
|
"unplugin-swc": "^2.0.0",
|
|
104
94
|
"unrun": "^0.3.1"
|
|
105
95
|
},
|
|
@@ -132,7 +122,7 @@
|
|
|
132
122
|
},
|
|
133
123
|
"scripts": {
|
|
134
124
|
"prepare": "husky",
|
|
135
|
-
"test": "lint-staged && tsc --noEmit -p test/tsconfig.json && node --import ./test/setup.mts --test --test-timeout=10000 \"test/**/*.test.tsx\"",
|
|
125
|
+
"test": "lint-staged --max-arg-length 6000 && tsc --noEmit -p test/tsconfig.json && node --import ./test/setup.mts --test --test-timeout=10000 \"test/**/*.test.tsx\"",
|
|
136
126
|
"pack-docs": "rimraf docs/ && typedoc source/",
|
|
137
127
|
"start": "npm run pack-docs && web-server docs/ -p 8080 -o",
|
|
138
128
|
"build": "npm run pack-docs && tsdown",
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
MouseEvent
|
|
12
12
|
} from 'react';
|
|
13
13
|
|
|
14
|
+
import { Icon } from '../Extension/Icon';
|
|
15
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
14
16
|
import { Button, ButtonProps, ComponentTheme } from './Button';
|
|
15
|
-
import { Icon } from './Extension/Icon';
|
|
16
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
|
|
17
17
|
|
|
18
18
|
export interface AccordionProps extends ComponentPropsWithRef<'div'> {
|
|
19
19
|
theme?: ComponentTheme;
|
|
@@ -53,7 +53,7 @@ export const AccordionHeader = polymorphic<AccordionHeaderProps>(
|
|
|
53
53
|
({ as: Root = 'summary', icon = 'chevron-down', className, children, ...props }) => (
|
|
54
54
|
<Root {...props} className={classNames('accordion-header', className)}>
|
|
55
55
|
{children}
|
|
56
|
-
{icon && <Icon name={icon} className="accordion-icon"
|
|
56
|
+
{icon && <Icon name={icon} className="accordion-icon" />}
|
|
57
57
|
</Root>
|
|
58
58
|
)
|
|
59
59
|
);
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
TransitionEvent
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
16
17
|
import { ComponentTheme } from './Button';
|
|
17
18
|
import { CloseButton } from './CloseButton';
|
|
18
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
|
|
19
19
|
|
|
20
20
|
export interface AlertProps extends ComponentPropsWithoutRef<'div'> {
|
|
21
21
|
theme?: ComponentTheme;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
export type AvatarSize = 'xs' | 'sm' | 'lg' | 'xl';
|
|
8
8
|
export type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
interface BadgeStyleProps {
|
|
8
8
|
variant?: 'solid' | 'subtle' | 'outline';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export const Breadcrumb = polymorphic<ComponentPropsWithRef<'ol'>>(
|
|
7
7
|
({ as: Root = 'ol', className, ...props }) => (
|
|
@@ -10,9 +10,21 @@ export const Breadcrumb = polymorphic<ComponentPropsWithRef<'ol'>>(
|
|
|
10
10
|
);
|
|
11
11
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export type BreadcrumbItemProps = ComponentPropsWithRef<'li'> & { active?: boolean };
|
|
14
|
+
|
|
15
|
+
export const BreadcrumbItem = polymorphic<BreadcrumbItemProps>(
|
|
16
|
+
({
|
|
17
|
+
as: Root = 'li',
|
|
18
|
+
active,
|
|
19
|
+
className,
|
|
20
|
+
'aria-current': current = active ? 'page' : undefined,
|
|
21
|
+
...props
|
|
22
|
+
}) => (
|
|
23
|
+
<Root
|
|
24
|
+
{...props}
|
|
25
|
+
className={classNames('breadcrumb-item', { active }, className)}
|
|
26
|
+
aria-current={current}
|
|
27
|
+
/>
|
|
16
28
|
)
|
|
17
29
|
);
|
|
18
30
|
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, MouseEvent } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export type ComponentTheme =
|
|
7
7
|
| 'primary'
|
|
@@ -26,7 +26,9 @@ interface ButtonStyleProps {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
type ButtonLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
|
|
29
|
+
|
|
29
30
|
type ButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
|
|
31
|
+
|
|
30
32
|
type ButtonElementAttributes = ButtonAttributes | ButtonLinkAttributes;
|
|
31
33
|
|
|
32
34
|
export type ButtonProps = ButtonStyleProps & ButtonElementAttributes;
|
|
@@ -42,6 +44,7 @@ export const Button = polymorphic<ButtonProps>(
|
|
|
42
44
|
const link = isButtonLink(attributes);
|
|
43
45
|
const Root = RootAs ?? (link ? 'a' : 'button');
|
|
44
46
|
const nativeButton = Root === 'button';
|
|
47
|
+
const role = attributes.role ?? 'button';
|
|
45
48
|
const onClick =
|
|
46
49
|
!nativeButton && disabled
|
|
47
50
|
? typeof Root === 'string'
|
|
@@ -60,12 +63,13 @@ export const Button = polymorphic<ButtonProps>(
|
|
|
60
63
|
<Root
|
|
61
64
|
{...attributes}
|
|
62
65
|
className={classes}
|
|
66
|
+
role={role}
|
|
63
67
|
type={nativeButton ? attributes.type || 'button' : attributes.type}
|
|
64
68
|
href={disabled ? undefined : attributes.href}
|
|
65
69
|
disabled={nativeButton || typeof Root !== 'string' ? disabled : undefined}
|
|
66
70
|
aria-disabled={(!nativeButton && disabled) || undefined}
|
|
67
71
|
aria-pressed={
|
|
68
|
-
!link ||
|
|
72
|
+
!link || role === 'button'
|
|
69
73
|
? (active ?? attributes['aria-pressed'])
|
|
70
74
|
: attributes['aria-pressed']
|
|
71
75
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface ButtonGroupProps extends ComponentPropsWithRef<'div'> {
|
|
7
7
|
vertical?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import { ComponentTheme } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
export interface CardProps extends ComponentPropsWithRef<'div'> {
|
|
8
8
|
row?: boolean;
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
ReactNode
|
|
17
17
|
} from 'react';
|
|
18
18
|
|
|
19
|
+
import { Icon } from '../../Extension/Icon';
|
|
20
|
+
import { polymorphic, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
19
21
|
import { Button } from '../Button';
|
|
20
|
-
import { Icon } from '../Extension/Icon';
|
|
21
|
-
import { polymorphic, PolymorphicClassProps } from '../Polymorphic';
|
|
22
22
|
import { CarouselEnds, CarouselModel } from './model';
|
|
23
23
|
import { CarouselScroll } from './scroll';
|
|
24
24
|
import styles from './style.module.css';
|
|
@@ -264,7 +264,6 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
264
264
|
|
|
265
265
|
return (
|
|
266
266
|
<Button
|
|
267
|
-
type="button"
|
|
268
267
|
variant={overlay ? 'subtle' : undefined}
|
|
269
268
|
theme={overlay ? 'secondary' : undefined}
|
|
270
269
|
size="sm"
|
|
@@ -273,11 +272,7 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
273
272
|
disabled={ends === 'stop' && atEnd}
|
|
274
273
|
icon
|
|
275
274
|
>
|
|
276
|
-
<Icon
|
|
277
|
-
name={previous ? 'chevron-left' : 'chevron-right'}
|
|
278
|
-
size={1}
|
|
279
|
-
aria-hidden="true"
|
|
280
|
-
/>
|
|
275
|
+
<Icon name={previous ? 'chevron-left' : 'chevron-right'} size={1} />
|
|
281
276
|
<span className="visually-hidden">{label}</span>
|
|
282
277
|
</Button>
|
|
283
278
|
);
|
|
@@ -304,7 +299,6 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
304
299
|
renderPlayPause = () =>
|
|
305
300
|
(this.props.playPause || this.props.autoplay) && (
|
|
306
301
|
<Button
|
|
307
|
-
type="button"
|
|
308
302
|
className={classNames('carousel-control-play-pause', {
|
|
309
303
|
paused: !this.store.playing
|
|
310
304
|
})}
|
|
@@ -313,11 +307,7 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
313
307
|
aria-label={this.store.playing ? 'Pause' : 'Play'}
|
|
314
308
|
icon
|
|
315
309
|
>
|
|
316
|
-
<Icon
|
|
317
|
-
name={this.store.playing ? 'pause-fill' : 'play-fill'}
|
|
318
|
-
size={1}
|
|
319
|
-
aria-hidden="true"
|
|
320
|
-
/>
|
|
310
|
+
<Icon name={this.store.playing ? 'pause-fill' : 'play-fill'} size={1} />
|
|
321
311
|
</Button>
|
|
322
312
|
);
|
|
323
313
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface CloseButtonProps extends ComponentPropsWithRef<'button'> {
|
|
7
7
|
dismiss?: string;
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
MouseEvent
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
15
16
|
import { ButtonProps } from './Button';
|
|
16
|
-
import { AsProps, PolymorphicClassProps } from './Polymorphic';
|
|
17
17
|
|
|
18
18
|
const TOGGLE = 'idea-react:collapse-toggle';
|
|
19
19
|
const CHANGE = 'idea-react:collapse-change';
|
|
@@ -134,6 +134,7 @@ export interface CollapseToggleProps
|
|
|
134
134
|
target: string;
|
|
135
135
|
href?: string;
|
|
136
136
|
type?: 'button' | 'submit' | 'reset';
|
|
137
|
+
navbarToggler?: boolean;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
@observer
|
|
@@ -201,16 +202,28 @@ export class CollapseToggle<T extends ElementType | undefined = 'button'> extend
|
|
|
201
202
|
disabled,
|
|
202
203
|
icon,
|
|
203
204
|
styled,
|
|
205
|
+
navbarToggler,
|
|
204
206
|
className,
|
|
207
|
+
children,
|
|
205
208
|
...props
|
|
206
209
|
} = this.componentProps;
|
|
207
210
|
const Root: ElementType = RootAs ?? (href ? 'a' : 'button');
|
|
208
211
|
const nativeButton = Root === 'button';
|
|
212
|
+
const content = navbarToggler ? (
|
|
213
|
+
<span className="navbar-toggler-icon" aria-hidden="true" />
|
|
214
|
+
) : (
|
|
215
|
+
children
|
|
216
|
+
);
|
|
209
217
|
const rootClassName = classNames(
|
|
210
218
|
variant === false ? undefined : variant ? `btn-${variant}` : icon ? undefined : 'btn',
|
|
211
219
|
theme && `theme-${theme}`,
|
|
212
220
|
size && `btn-${size}`,
|
|
213
|
-
{
|
|
221
|
+
{
|
|
222
|
+
'btn-icon': icon || navbarToggler,
|
|
223
|
+
'btn-styled': styled,
|
|
224
|
+
disabled,
|
|
225
|
+
'navbar-toggler': navbarToggler
|
|
226
|
+
},
|
|
214
227
|
className
|
|
215
228
|
);
|
|
216
229
|
|
|
@@ -227,7 +240,9 @@ export class CollapseToggle<T extends ElementType | undefined = 'button'> extend
|
|
|
227
240
|
aria-controls={this.controls || undefined}
|
|
228
241
|
aria-expanded={this.expanded}
|
|
229
242
|
onClick={this.handleClick}
|
|
230
|
-
|
|
243
|
+
>
|
|
244
|
+
{content}
|
|
245
|
+
</Root>
|
|
231
246
|
);
|
|
232
247
|
}
|
|
233
248
|
}
|
|
@@ -5,10 +5,10 @@ import { action, observable } from 'mobx';
|
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
6
|
import { Component, ComponentPropsWithRef, createRef, ElementType, ReactNode } from 'react';
|
|
7
7
|
|
|
8
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
9
|
+
import { Breakpoint } from '../Layout/Grid';
|
|
8
10
|
import { CloseButton } from './CloseButton';
|
|
9
|
-
import { Breakpoint } from './Grid';
|
|
10
11
|
import { NativeDialog, NativeDialogProps } from './NativeDialog';
|
|
11
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
|
|
12
12
|
|
|
13
13
|
export type DrawerPlacement = 'start' | 'end' | 'top' | 'bottom';
|
|
14
14
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { cloneElement, FC, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface FadeProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
in?: boolean;
|
|
7
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
8
|
+
children: ReactElement<{ className?: string }>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Fade: FC<FadeProps> = ({ children, in: show = false, className = '' }) =>
|
|
12
|
+
cloneElement(children, {
|
|
13
|
+
className: classNames('fade', className, children.props.className, show && 'show')
|
|
14
|
+
});
|
|
15
|
+
Fade.displayName = 'Fade';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import type { Breakpoint } from '../Layout/Grid';
|
|
4
6
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import type { Breakpoint } from './Grid';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
export type ListGroupHorizontal = boolean | Breakpoint;
|
|
9
9
|
|
|
10
10
|
interface ListGroupStyleProps {
|
|
11
|
+
radio?: boolean;
|
|
12
|
+
checkable?: boolean;
|
|
11
13
|
flush?: boolean;
|
|
12
14
|
numbered?: boolean;
|
|
13
15
|
horizontal?: ListGroupHorizontal;
|
|
@@ -21,10 +23,15 @@ export type ListGroupProps = ListGroupStyleProps &
|
|
|
21
23
|
);
|
|
22
24
|
|
|
23
25
|
export const ListGroup = polymorphic<ListGroupStyleProps & ComponentPropsWithRef<'ul'>>(
|
|
24
|
-
({ as: Root = 'ul', flush, numbered, horizontal, className, ...props }) => {
|
|
26
|
+
({ as: Root = 'ul', flush, numbered, horizontal, checkable, radio, className, ...props }) => {
|
|
25
27
|
const classes = classNames(
|
|
26
28
|
'list-group',
|
|
27
|
-
{
|
|
29
|
+
{
|
|
30
|
+
'list-group-checkable': checkable,
|
|
31
|
+
'list-group-radio': radio,
|
|
32
|
+
'list-group-flush': flush,
|
|
33
|
+
'list-group-numbered': numbered
|
|
34
|
+
},
|
|
28
35
|
horizontal &&
|
|
29
36
|
(horizontal === true
|
|
30
37
|
? 'list-group-horizontal'
|
|
@@ -45,8 +52,11 @@ interface ListGroupItemStyleProps {
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
type ListGroupItemLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
|
|
55
|
+
|
|
48
56
|
type ListGroupItemButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
|
|
57
|
+
|
|
49
58
|
type ListGroupItemAttributes = ComponentPropsWithRef<'li'> & { href?: never; type?: never };
|
|
59
|
+
|
|
50
60
|
type ListGroupItemElementAttributes =
|
|
51
61
|
ListGroupItemLinkAttributes | ListGroupItemButtonAttributes | ListGroupItemAttributes;
|
|
52
62
|
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
ReactNode
|
|
15
15
|
} from 'react';
|
|
16
16
|
|
|
17
|
+
import { Icon, IconProps } from '../Extension/Icon';
|
|
18
|
+
import { FloatingOptions, FloatingPosition } from '../Helper/Overlay';
|
|
19
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
20
|
+
import { Breakpoint } from '../Layout/Grid';
|
|
17
21
|
import { Button, ButtonProps } from './Button';
|
|
18
|
-
import { Icon, IconProps } from './Extension/Icon';
|
|
19
|
-
import { Breakpoint } from './Grid';
|
|
20
|
-
import { FloatingOptions, FloatingPosition } from './Overlay';
|
|
21
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
|
|
22
22
|
|
|
23
23
|
export type MenuItemProps = ButtonProps & { active?: boolean; selected?: boolean };
|
|
24
24
|
|
|
@@ -60,12 +60,7 @@ export const MenuPanel = polymorphic<MenuPanelProps>(
|
|
|
60
60
|
MenuPanel.displayName = 'MenuPanel';
|
|
61
61
|
|
|
62
62
|
export const MenuItemIcon = polymorphic<IconProps>(({ as: RootAs, className, ...props }) => (
|
|
63
|
-
<Icon
|
|
64
|
-
as={RootAs}
|
|
65
|
-
aria-hidden="true"
|
|
66
|
-
{...props}
|
|
67
|
-
className={classNames('menu-item-icon', className)}
|
|
68
|
-
/>
|
|
63
|
+
<Icon as={RootAs} {...props} className={classNames('menu-item-icon', className)} />
|
|
69
64
|
));
|
|
70
65
|
MenuItemIcon.displayName = 'MenuItemIcon';
|
|
71
66
|
|
|
@@ -73,7 +68,6 @@ export const MenuItemCheck = polymorphic<Omit<IconProps, 'name'>>(
|
|
|
73
68
|
({ as: RootAs, className, ...props }) => (
|
|
74
69
|
<Icon
|
|
75
70
|
as={RootAs}
|
|
76
|
-
aria-hidden="true"
|
|
77
71
|
{...props}
|
|
78
72
|
name="check"
|
|
79
73
|
className={classNames('menu-item-check', className)}
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
SyntheticEvent
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
16
|
+
import { Breakpoint } from '../../Layout/Grid';
|
|
17
17
|
import styles from './style.module.css';
|
|
18
18
|
|
|
19
19
|
const transitionMilliseconds = (value: string) =>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface NavProps extends ComponentPropsWithRef<'nav'> {
|
|
7
7
|
variant?: 'tabs' | 'pills' | 'underline';
|
|
8
8
|
vertical?: boolean;
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
justified?: boolean;
|
|
11
|
+
flush?: boolean;
|
|
11
12
|
cardHeader?: boolean;
|
|
12
13
|
navbar?: boolean;
|
|
13
14
|
}
|
|
@@ -19,6 +20,7 @@ export const Nav = polymorphic<NavProps>(
|
|
|
19
20
|
vertical,
|
|
20
21
|
fill,
|
|
21
22
|
justified,
|
|
23
|
+
flush,
|
|
22
24
|
cardHeader,
|
|
23
25
|
navbar,
|
|
24
26
|
className,
|
|
@@ -32,7 +34,7 @@ export const Nav = polymorphic<NavProps>(
|
|
|
32
34
|
variant && `nav-${variant}`,
|
|
33
35
|
cardHeader && variant === 'tabs' && 'card-header-tabs',
|
|
34
36
|
vertical && (variant === 'pills' ? 'nav-pills-vertical' : 'flex-column'),
|
|
35
|
-
{ 'nav-fill': fill, 'nav-justified': justified },
|
|
37
|
+
{ 'nav-fill': fill, 'nav-justified': justified, 'nav-flush': flush },
|
|
36
38
|
className
|
|
37
39
|
)}
|
|
38
40
|
/>
|
|
@@ -57,6 +59,7 @@ export const NavLink = polymorphic<NavLinkProps>(
|
|
|
57
59
|
<Root
|
|
58
60
|
{...props}
|
|
59
61
|
href={disabled ? undefined : href}
|
|
62
|
+
disabled={Root === 'button' ? disabled : undefined}
|
|
60
63
|
tabIndex={disabled ? -1 : tabIndex}
|
|
61
64
|
aria-disabled={disabled || undefined}
|
|
62
65
|
aria-current={active ? 'page' : props['aria-current']}
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
ReactNode
|
|
18
18
|
} from 'react';
|
|
19
19
|
|
|
20
|
-
import { Icon } from '
|
|
20
|
+
import { Icon } from '../../Extension/Icon';
|
|
21
|
+
import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
21
22
|
import { Menu, MenuProps } from '../Menu';
|
|
22
23
|
import { Nav, NavProps } from '../Nav';
|
|
23
|
-
import { AsProps, PolymorphicClassProps } from '../Polymorphic';
|
|
24
24
|
import { NavOverflowModel } from './model';
|
|
25
25
|
|
|
26
26
|
interface OverflowChildProps {
|
|
@@ -255,7 +255,7 @@ export class NavOverflow<T extends ElementType | undefined = 'div'> extends Comp
|
|
|
255
255
|
: vertical === 'left'
|
|
256
256
|
? ['end-100', horizontal === 'end' ? 'bottom-0' : 'top-0']
|
|
257
257
|
: ['start-100', horizontal === 'end' ? 'bottom-0' : 'top-0'];
|
|
258
|
-
const icon = moreIcon ?? <Icon name="three-dots"
|
|
258
|
+
const icon = moreIcon ?? <Icon name="three-dots" />;
|
|
259
259
|
const text = moreText === false ? null : moreText;
|
|
260
260
|
|
|
261
261
|
return (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import { Button } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
export interface NavbarProps extends ComponentPropsWithRef<'nav'> {
|
|
8
8
|
theme?: 'light' | 'dark';
|
|
@@ -68,6 +68,8 @@ export interface NavbarTogglerProps extends Omit<
|
|
|
68
68
|
'children' | 'type'
|
|
69
69
|
> {
|
|
70
70
|
expanded?: boolean;
|
|
71
|
+
commandfor?: string;
|
|
72
|
+
command?: string;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export const NavbarToggler = polymorphic<NavbarTogglerProps>(
|
|
@@ -77,18 +79,22 @@ export const NavbarToggler = polymorphic<NavbarTogglerProps>(
|
|
|
77
79
|
className,
|
|
78
80
|
'aria-label': ariaLabel = 'Toggle navigation',
|
|
79
81
|
...props
|
|
80
|
-
}) =>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
}) => {
|
|
83
|
+
const icon = <span className="navbar-toggler-icon" aria-hidden="true" />;
|
|
84
|
+
const togglerClassName = classNames('navbar-toggler', className);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Button
|
|
88
|
+
as={RootAs}
|
|
89
|
+
{...props}
|
|
90
|
+
className={togglerClassName}
|
|
91
|
+
aria-label={ariaLabel}
|
|
92
|
+
aria-expanded={expanded}
|
|
93
|
+
icon
|
|
94
|
+
>
|
|
95
|
+
{icon}
|
|
96
|
+
</Button>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
93
99
|
);
|
|
94
100
|
NavbarToggler.displayName = 'NavbarToggler';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { cloneElement, ComponentPropsWithRef, isValidElement } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import { ComponentTheme } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
export interface PaginationProps extends ComponentPropsWithRef<'ul'> {
|
|
8
8
|
theme?: ComponentTheme;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
5
|
import { Button, ButtonProps, ComponentTheme } from './Button';
|
|
5
|
-
import { polymorphic } from './Polymorphic';
|
|
6
6
|
|
|
7
7
|
export interface PlaceholderProps extends ComponentPropsWithRef<'span'> {
|
|
8
8
|
size?: 'xs' | 'sm' | 'lg';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
OVERLAY_ARROW_POSITIONS,
|
|
6
|
+
OVERLAY_DIRECTIONS,
|
|
7
|
+
OverlayTriggerProps
|
|
8
|
+
} from '../Helper/Overlay';
|
|
9
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
6
10
|
|
|
7
11
|
export interface PopoverProps extends Omit<OverlayTriggerProps, 'title'> {
|
|
8
12
|
title?: ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
4
5
|
import { ComponentTheme } from '../Button';
|
|
5
|
-
import { polymorphic } from '../Polymorphic';
|
|
6
6
|
|
|
7
7
|
export interface ProgressProps extends ComponentPropsWithRef<'div'> {
|
|
8
8
|
value: number;
|