idea-react 3.0.0-beta.5 → 3.0.0-rc.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/AGENTS.md +5 -3
- package/ReadMe.md +71 -65
- package/dist/index.d.mts +894 -929
- package/dist/index.d.ts +894 -929
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/style.css +2 -2
- package/package.json +3 -7
- package/source/{Accordion.tsx → Base/Accordion.tsx} +2 -2
- 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} +1 -1
- package/source/{Button.tsx → Base/Button.tsx} +1 -1
- 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 +2 -2
- package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
- package/source/{Collapse.tsx → Base/Collapse.tsx} +1 -1
- package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
- package/source/{ListGroup.tsx → Base/ListGroup.tsx} +2 -2
- package/source/{Menu.tsx → Base/Menu.tsx} +4 -4
- package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
- package/source/{Nav.tsx → Base/Nav.tsx} +2 -1
- package/source/{NavOverflow → Base/NavOverflow}/index.tsx +2 -2
- package/source/{Navbar.tsx → Base/Navbar.tsx} +1 -1
- 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 +31 -0
- package/source/Content/Images.tsx +29 -0
- package/source/{Table.tsx → Content/Tables.tsx} +2 -2
- package/source/Content/index.ts +2 -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 +1 -1
- 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 +2 -2
- 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 +5 -5
- 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} +4 -11
- package/source/Form/ChipInput.tsx +2 -2
- package/source/Form/Combobox.tsx +2 -2
- package/source/Form/Control.tsx +1 -1
- package/source/Form/DatePicker.tsx +2 -2
- 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 -1
- package/source/Form/Radio.tsx +2 -2
- 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} +1 -1
- package/source/Layout/index.ts +1 -0
- package/source/index.ts +4 -38
- 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.0",
|
|
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",
|
|
@@ -132,7 +128,7 @@
|
|
|
132
128
|
},
|
|
133
129
|
"scripts": {
|
|
134
130
|
"prepare": "husky",
|
|
135
|
-
"test": "lint-staged && tsc --noEmit -p test/tsconfig.json && node --import ./test/setup.mts --test --test-timeout=10000 \"test/**/*.test.tsx\"",
|
|
131
|
+
"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
132
|
"pack-docs": "rimraf docs/ && typedoc source/",
|
|
137
133
|
"start": "npm run pack-docs && web-server docs/ -p 8080 -o",
|
|
138
134
|
"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;
|
|
@@ -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 }) => (
|
|
@@ -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';
|
|
@@ -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';
|
|
@@ -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
|
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
|
@@ -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
|
|
|
@@ -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,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 NavProps extends ComponentPropsWithRef<'nav'> {
|
|
7
7
|
variant?: 'tabs' | 'pills' | 'underline';
|
|
@@ -57,6 +57,7 @@ export const NavLink = polymorphic<NavLinkProps>(
|
|
|
57
57
|
<Root
|
|
58
58
|
{...props}
|
|
59
59
|
href={disabled ? undefined : href}
|
|
60
|
+
disabled={Root === 'button' ? disabled : undefined}
|
|
60
61
|
tabIndex={disabled ? -1 : tabIndex}
|
|
61
62
|
aria-disabled={disabled || undefined}
|
|
62
63
|
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 {
|
|
@@ -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';
|
|
@@ -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;
|
|
@@ -5,7 +5,7 @@ import { observer } from 'mobx-react';
|
|
|
5
5
|
import { Component, ComponentPropsWithRef, createRef, ElementType, ReactNode } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
8
|
-
import { AsProps, PolymorphicClassProps } from '
|
|
8
|
+
import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
9
9
|
import { ScrollSpyModel } from './model';
|
|
10
10
|
|
|
11
11
|
export interface ScrollSpyProps extends Omit<
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { Icon, IconProps } from '../Extension/Icon';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
6
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { Icon, IconProps } from './Extension/Icon';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
export type SpinnerAnimation = 'border' | 'grow';
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import { Breakpoint } from '../Layout/Grid';
|
|
4
6
|
import { ComponentTheme } from './Button';
|
|
5
|
-
import { Breakpoint } from './Grid';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
export interface StepperProps extends ComponentPropsWithRef<'ol'> {
|
|
9
9
|
horizontal?: boolean | Breakpoint;
|
|
@@ -16,7 +16,9 @@ import {
|
|
|
16
16
|
ReactNode
|
|
17
17
|
} from 'react';
|
|
18
18
|
|
|
19
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from '
|
|
19
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
20
|
+
import { ListGroup, ListGroupItem } from './ListGroup';
|
|
21
|
+
import { Nav, NavLink, NavProps } from './Nav';
|
|
20
22
|
|
|
21
23
|
export interface TabProps extends ComponentPropsWithRef<'div'> {
|
|
22
24
|
eventKey: string;
|
|
@@ -31,7 +33,10 @@ export const Tab = polymorphic<TabProps>(
|
|
|
31
33
|
);
|
|
32
34
|
Tab.displayName = 'Tab';
|
|
33
35
|
|
|
34
|
-
export interface TabsProps
|
|
36
|
+
export interface TabsProps
|
|
37
|
+
extends
|
|
38
|
+
Omit<ComponentPropsWithRef<'div'>, 'onChange'>,
|
|
39
|
+
Pick<NavProps, 'vertical' | 'fill' | 'justified' | 'cardHeader' | 'navbar'> {
|
|
35
40
|
activeKey?: string;
|
|
36
41
|
defaultActiveKey?: string;
|
|
37
42
|
fade?: boolean;
|
|
@@ -85,6 +90,13 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
85
90
|
: (this.tabs.find(({ props }) => !props.disabled)?.props.eventKey ?? '');
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
get orientation() {
|
|
94
|
+
return (
|
|
95
|
+
this.componentProps.orientation ??
|
|
96
|
+
(this.componentProps.vertical ? 'vertical' : 'horizontal')
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
handleClick = (event: MouseEvent<HTMLDivElement>) => {
|
|
89
101
|
this.componentProps.onClick?.(event);
|
|
90
102
|
|
|
@@ -108,7 +120,7 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
108
120
|
const { tabs } = this;
|
|
109
121
|
if (!button || Number.isNaN(index)) return;
|
|
110
122
|
|
|
111
|
-
const horizontal = this.
|
|
123
|
+
const horizontal = this.orientation !== 'vertical';
|
|
112
124
|
const previous = horizontal ? event.key === 'ArrowLeft' : event.key === 'ArrowUp';
|
|
113
125
|
const next = horizontal ? event.key === 'ArrowRight' : event.key === 'ArrowDown';
|
|
114
126
|
const enabled = tabs
|
|
@@ -148,51 +160,47 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
148
160
|
panelId = (key: string) => `${this.componentProps.id}-panel-${encodeURIComponent(key)}`;
|
|
149
161
|
|
|
150
162
|
renderTabs = () => {
|
|
151
|
-
const {
|
|
163
|
+
const { variant = 'tabs', fill, justified, cardHeader, navbar } = this.componentProps;
|
|
164
|
+
const { orientation } = this;
|
|
152
165
|
const listGroup = variant === 'list-group';
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{tab.label}
|
|
192
|
-
</button>
|
|
193
|
-
);
|
|
194
|
-
})}
|
|
195
|
-
</div>
|
|
166
|
+
const tabListProps = {
|
|
167
|
+
role: 'tablist' as const,
|
|
168
|
+
'aria-label': this.componentProps['aria-label'] ?? 'Tabs',
|
|
169
|
+
'aria-orientation': orientation,
|
|
170
|
+
children: this.tabs.map(({ props: tab }, index) => {
|
|
171
|
+
const active = tab.eventKey === this.activeKey;
|
|
172
|
+
const triggerProps = {
|
|
173
|
+
id: this.tabId(tab.eventKey),
|
|
174
|
+
type: 'button' as const,
|
|
175
|
+
role: 'tab',
|
|
176
|
+
'data-tab-index': index,
|
|
177
|
+
'aria-controls': this.panelId(tab.eventKey),
|
|
178
|
+
'aria-selected': active,
|
|
179
|
+
'aria-disabled': tab.disabled || undefined,
|
|
180
|
+
tabIndex: active ? 0 : -1,
|
|
181
|
+
disabled: tab.disabled,
|
|
182
|
+
className: classNames({ active }, tab.disabled && 'disabled'),
|
|
183
|
+
children: tab.label
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return listGroup ? (
|
|
187
|
+
<ListGroupItem key={tab.eventKey} as="button" {...triggerProps} action />
|
|
188
|
+
) : (
|
|
189
|
+
<NavLink key={tab.eventKey} as="button" {...triggerProps} />
|
|
190
|
+
);
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
return listGroup ? (
|
|
195
|
+
<ListGroup as="div" {...tabListProps} />
|
|
196
|
+
) : (
|
|
197
|
+
<Nav
|
|
198
|
+
as="div"
|
|
199
|
+
{...tabListProps}
|
|
200
|
+
variant={variant}
|
|
201
|
+
vertical={orientation === 'vertical'}
|
|
202
|
+
{...{ fill, justified, cardHeader, navbar }}
|
|
203
|
+
/>
|
|
196
204
|
);
|
|
197
205
|
};
|
|
198
206
|
|
|
@@ -241,6 +249,11 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
241
249
|
orientation: _orientation,
|
|
242
250
|
children: _children,
|
|
243
251
|
variant: _variant,
|
|
252
|
+
vertical: _vertical,
|
|
253
|
+
fill: _fill,
|
|
254
|
+
justified: _justified,
|
|
255
|
+
cardHeader: _cardHeader,
|
|
256
|
+
navbar: _navbar,
|
|
244
257
|
...props
|
|
245
258
|
} = this.componentProps;
|
|
246
259
|
|
|
@@ -6,9 +6,9 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { ComponentPropsWithRef, FC, MouseEvent, ReactNode } from 'react';
|
|
7
7
|
import { Timestamp, uniqueID } from 'web-utility';
|
|
8
8
|
|
|
9
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
9
10
|
import type { ComponentTheme } from './Button';
|
|
10
11
|
import { CloseButton } from './CloseButton';
|
|
11
|
-
import { polymorphic } from './Polymorphic';
|
|
12
12
|
|
|
13
13
|
export type ToastPosition =
|
|
14
14
|
| 'top-start'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties, Ref } from 'react';
|
|
3
3
|
|
|
4
|
+
import { splitInputProps } from '../Form/inputProps';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
6
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { splitInputProps } from './Form/inputProps';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
type NativeInputProps = Omit<ComponentPropsWithRef<'input'>, 'ref' | 'type' | 'size'>;
|
|
9
9
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { ButtonHTMLAttributes, Component, ElementType, KeyboardEvent, MouseEvent } from 'react';
|
|
5
5
|
|
|
6
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
6
7
|
import { Button, ComponentTheme } from './Button';
|
|
7
|
-
import { AsProps, PolymorphicClassProps } from './Polymorphic';
|
|
8
8
|
|
|
9
9
|
export interface TogglerProps extends Omit<ButtonHTMLAttributes<HTMLElement>, 'value'> {
|
|
10
10
|
as?: 'button' | 'div' | 'span';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
OVERLAY_ARROW_POSITIONS,
|
|
5
|
+
OVERLAY_DIRECTIONS,
|
|
6
|
+
OverlayTriggerProps
|
|
7
|
+
} from '../Helper/Overlay';
|
|
8
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
9
|
|
|
6
10
|
export type TooltipProps = OverlayTriggerProps;
|
|
7
11
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
2
|
+
export * from './Alert';
|
|
3
|
+
export * from './Avatar';
|
|
4
|
+
export * from './Badge';
|
|
5
|
+
export * from './Breadcrumb';
|
|
6
|
+
export * from './Button';
|
|
7
|
+
export * from './ButtonGroup';
|
|
8
|
+
export * from './Card';
|
|
9
|
+
export * from './Carousel';
|
|
10
|
+
export * from './CloseButton';
|
|
11
|
+
export * from './Collapse';
|
|
12
|
+
export * from './Drawer';
|
|
13
|
+
export * from './ListGroup';
|
|
14
|
+
export * from './Menu';
|
|
15
|
+
export * from './NativeDialog';
|
|
16
|
+
export * from './Nav';
|
|
17
|
+
export * from './Navbar';
|
|
18
|
+
export * from './NavOverflow';
|
|
19
|
+
export * from './Pagination';
|
|
20
|
+
export * from './Placeholder';
|
|
21
|
+
export * from './Popover';
|
|
22
|
+
export * from './Progress';
|
|
23
|
+
export * from './ScrollSpy';
|
|
24
|
+
export * from './Spinner';
|
|
25
|
+
export * from './Stack';
|
|
26
|
+
export * from './Stepper';
|
|
27
|
+
export * from './Tab';
|
|
28
|
+
export * from './Toast';
|
|
29
|
+
export * from './ToggleButton';
|
|
30
|
+
export * from './Toggler';
|
|
31
|
+
export * from './Tooltip';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
|
|
6
|
+
export interface ImageProps extends ComponentPropsWithRef<'img'> {
|
|
7
|
+
fluid?: boolean;
|
|
8
|
+
thumbnail?: boolean;
|
|
9
|
+
rounded?: boolean;
|
|
10
|
+
roundedCircle?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Image = polymorphic<ImageProps>(
|
|
14
|
+
({ as: Root = 'img', fluid, thumbnail, rounded, roundedCircle, className, ...props }) => (
|
|
15
|
+
<Root
|
|
16
|
+
{...props}
|
|
17
|
+
className={classNames(
|
|
18
|
+
{
|
|
19
|
+
'img-fluid': fluid,
|
|
20
|
+
'img-thumbnail': thumbnail,
|
|
21
|
+
rounded,
|
|
22
|
+
'rounded-circle': roundedCircle
|
|
23
|
+
},
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
Image.displayName = 'Image';
|