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
|
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { Component, ElementType, HTMLAttributes, Ref, RefCallback } from 'react';
|
|
7
7
|
import { sleep } from 'web-utility';
|
|
8
8
|
|
|
9
|
-
import { AsProps, PolymorphicClassProps } from '../../Polymorphic';
|
|
9
|
+
import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
10
10
|
|
|
11
11
|
export interface TypeEchoContentProps extends Omit<HTMLAttributes<HTMLPreElement>, 'children'> {
|
|
12
12
|
text: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
2
|
|
|
3
|
-
import { polymorphic } from '../../Polymorphic';
|
|
3
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
4
4
|
import { TypeEchoContent } from './Content';
|
|
5
5
|
|
|
6
6
|
export interface TypeEchoProps extends ComponentPropsWithRef<'pre'> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Badge } from '../../Badge';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { polymorphic } from '../../Polymorphic';
|
|
7
|
-
import {
|
|
3
|
+
import { Badge } from '../../Base/Badge';
|
|
4
|
+
import { Image } from '../../Content/Images';
|
|
5
|
+
import { Table } from '../../Content/Tables';
|
|
6
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
7
|
+
import { Col, Container, Row } from '../../Layout/Grid';
|
|
8
8
|
import { UserAddress, UserAddressProps } from './Address';
|
|
9
9
|
import * as style from './index.module.less';
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ export interface UserRankViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
export const UserRankView = polymorphic<UserRankViewProps>(
|
|
25
25
|
({ as: RootAs, className = '', title, rank = [], linkOf, ...props }) => {
|
|
26
26
|
const renderMedal = (user: UserRank) => (
|
|
27
|
-
<
|
|
27
|
+
<Col key={user.id} as="li">
|
|
28
28
|
<div className={`shadow-lg overflow-hidden rounded-circle m-auto ${style.image}`}>
|
|
29
29
|
<Image src={user.avatar} alt={user.name} loading="lazy" fluid />
|
|
30
30
|
</div>
|
|
@@ -38,7 +38,7 @@ export const UserRankView = polymorphic<UserRankViewProps>(
|
|
|
38
38
|
</div>
|
|
39
39
|
<UserAddress {...user} />
|
|
40
40
|
</div>
|
|
41
|
-
</
|
|
41
|
+
</Col>
|
|
42
42
|
);
|
|
43
43
|
const renderRow = (user: UserRank, index: number, { length }: UserRank[]) => (
|
|
44
44
|
<tr key={user.id} className="position-relative">
|
|
@@ -87,11 +87,12 @@ export const UserRankView = polymorphic<UserRankViewProps>(
|
|
|
87
87
|
{title}
|
|
88
88
|
</h3>
|
|
89
89
|
</div>
|
|
90
|
-
<
|
|
91
|
-
|
|
90
|
+
<Row
|
|
91
|
+
as="ul"
|
|
92
|
+
className={`mt-2 g-0 align-items-end text-center ps-0 pt-2 list-unstyled ${style.topUsers}`}
|
|
92
93
|
>
|
|
93
94
|
{rank.slice(0, 3).map(renderMedal)}
|
|
94
|
-
</
|
|
95
|
+
</Row>
|
|
95
96
|
</Col>
|
|
96
97
|
<Col xs={12} lg={5}>
|
|
97
98
|
<Table className={`my-3 pt-2 ${style.restUsers}`} responsive>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
import { polymorphic } from '../../Polymorphic';
|
|
3
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
4
4
|
import * as style from './index.module.less';
|
|
5
5
|
|
|
6
6
|
export interface VerticalMarqueeProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -2,18 +2,16 @@ export * from './ClickBoundary';
|
|
|
2
2
|
export * from './CodeBlock';
|
|
3
3
|
export * from './Countdown';
|
|
4
4
|
export * from './Dialog';
|
|
5
|
-
export * from './Editor';
|
|
6
|
-
export * from './EditorHTML';
|
|
7
5
|
export * from './HorizontalMarquee';
|
|
8
6
|
export * from './Icon';
|
|
9
7
|
export * from './LiveTSX';
|
|
10
8
|
export * from './Loading';
|
|
9
|
+
export * from './MarkdownView';
|
|
11
10
|
export * from './MonthCalendar';
|
|
12
11
|
export * from './Nameplate';
|
|
13
12
|
export * from './OverlayBox';
|
|
14
13
|
export * from './PageNav';
|
|
15
14
|
export * from './ScrollNav';
|
|
16
|
-
export * from './Select';
|
|
17
15
|
export * from './ShareBox';
|
|
18
16
|
export * from './SpinnerButton';
|
|
19
17
|
export * from './TableSpinner';
|
package/source/Form/Adorn.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import classNames from 'classnames';
|
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Icon, IconProps } from '../Extension/Icon';
|
|
5
|
-
import { polymorphic } from '../Polymorphic';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
6
6
|
import { FormValidationProps } from './Primitives';
|
|
7
7
|
|
|
8
8
|
export type FormAdornmentProps = Omit<ComponentPropsWithRef<'label'>, 'htmlFor'> &
|
package/source/Form/Checkbox.tsx
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Component, ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
5
5
|
|
|
6
|
-
import type { ComponentTheme } from '../Button';
|
|
7
|
-
import { AsProps, polymorphic } from '../Polymorphic';
|
|
6
|
+
import type { ComponentTheme } from '../Base/Button';
|
|
7
|
+
import { AsProps, polymorphic } from '../Helper/Polymorphic';
|
|
8
8
|
import { FormValidationProps } from './Primitives';
|
|
9
9
|
|
|
10
10
|
export type CheckboxProps = Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'size'> &
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { ComponentTheme } from '../Button';
|
|
4
|
+
import { ComponentTheme } from '../Base/Button';
|
|
5
5
|
import { Icon, IconProps } from '../Extension/Icon';
|
|
6
|
-
import { polymorphic } from '../Polymorphic';
|
|
6
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
7
7
|
|
|
8
8
|
export type ChipProps = ComponentPropsWithRef<'button'> & {
|
|
9
9
|
active?: boolean;
|
|
@@ -11,11 +11,11 @@ export type ChipProps = ComponentPropsWithRef<'button'> & {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const Chip = polymorphic<ChipProps>(
|
|
14
|
-
({ as: Root = 'button', className, active, theme, ...props }) => (
|
|
14
|
+
({ as: Root = 'button', className, active, theme, type = 'button', ...props }) => (
|
|
15
15
|
<Root
|
|
16
16
|
{...props}
|
|
17
17
|
className={classNames('chip', { active }, theme && `theme-${theme}`, className)}
|
|
18
|
-
type=
|
|
18
|
+
type={Root === 'button' ? type : undefined}
|
|
19
19
|
aria-pressed={active}
|
|
20
20
|
/>
|
|
21
21
|
)
|
|
@@ -44,7 +44,7 @@ export const ChipDismiss = polymorphic<ComponentPropsWithRef<'button'>>(
|
|
|
44
44
|
aria-label={label}
|
|
45
45
|
className={classNames('chip-dismiss', className)}
|
|
46
46
|
>
|
|
47
|
-
{children ?? <Icon name="x-lg"
|
|
47
|
+
{children ?? <Icon name="x-lg" />}
|
|
48
48
|
</Root>
|
|
49
49
|
)
|
|
50
50
|
);
|
|
@@ -62,10 +62,3 @@ export const ChipToken = polymorphic<ChipTokenProps>(
|
|
|
62
62
|
)
|
|
63
63
|
);
|
|
64
64
|
ChipToken.displayName = 'ChipToken';
|
|
65
|
-
|
|
66
|
-
export const ChipInputLabel = polymorphic<ComponentPropsWithRef<'label'>>(
|
|
67
|
-
({ as: Root = 'label', className, ...props }) => (
|
|
68
|
-
<Root {...props} className={classNames('chip-input-label', className)} />
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
ChipInputLabel.displayName = 'ChipInputLabel';
|
|
@@ -5,9 +5,9 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
6
6
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
7
7
|
|
|
8
|
-
import { ComponentTheme } from '../Button';
|
|
8
|
+
import { ComponentTheme } from '../Base/Button';
|
|
9
9
|
import { Icon } from '../Extension/Icon';
|
|
10
|
-
import { AsProps, polymorphic } from '../Polymorphic';
|
|
10
|
+
import { AsProps, polymorphic } from '../Helper/Polymorphic';
|
|
11
11
|
import { FormPlugin } from './Plugin';
|
|
12
12
|
import { FormValidationProps } from './Primitives';
|
|
13
13
|
|
|
@@ -58,7 +58,7 @@ class ChipInputComponent extends FormPlugin<ChipInputComponentProps, Pick<Chips,
|
|
|
58
58
|
createOnBlur,
|
|
59
59
|
dismissible,
|
|
60
60
|
placeholder,
|
|
61
|
-
dismissIcon: renderToStaticMarkup(<Icon name="x-lg"
|
|
61
|
+
dismissIcon: renderToStaticMarkup(<Icon name="x-lg" />)
|
|
62
62
|
});
|
|
63
63
|
element.addEventListener('change.bs.chips', this.handleValuesChange);
|
|
64
64
|
|
package/source/Form/Combobox.tsx
CHANGED
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
ReactNode
|
|
18
18
|
} from 'react';
|
|
19
19
|
|
|
20
|
+
import { Menu, MenuHeader, MenuItemContent, MenuItemDescription } from '../Base/Menu';
|
|
20
21
|
import { Icon } from '../Extension/Icon';
|
|
21
|
-
import {
|
|
22
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from '../Polymorphic';
|
|
22
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
23
23
|
import { FormValidationProps } from './Primitives';
|
|
24
24
|
|
|
25
25
|
export interface ComboboxOptionProps extends ComponentPropsWithRef<'button'> {
|
|
@@ -53,7 +53,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
53
53
|
data-label={optionText(children)}
|
|
54
54
|
data-option-hidden={props.hidden || undefined}
|
|
55
55
|
>
|
|
56
|
-
{icon && <Icon name={icon} className="menu-item-icon"
|
|
56
|
+
{icon && <Icon name={icon} className="menu-item-icon" />}
|
|
57
57
|
{description ? (
|
|
58
58
|
<MenuItemContent>
|
|
59
59
|
{children}
|
|
@@ -62,7 +62,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
62
62
|
) : (
|
|
63
63
|
children
|
|
64
64
|
)}
|
|
65
|
-
{checkedIcon && <Icon name="check-lg" className="menu-item-check"
|
|
65
|
+
{checkedIcon && <Icon name="check-lg" className="menu-item-check" />}
|
|
66
66
|
</Root>
|
|
67
67
|
)
|
|
68
68
|
);
|
|
@@ -335,11 +335,7 @@ export class Combobox<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
335
335
|
>
|
|
336
336
|
{hasSelection ? label : placeholder}
|
|
337
337
|
</span>
|
|
338
|
-
<Icon
|
|
339
|
-
name="chevron-down"
|
|
340
|
-
className="combobox-caret"
|
|
341
|
-
aria-hidden="true"
|
|
342
|
-
/>
|
|
338
|
+
<Icon name="chevron-down" className="combobox-caret" />
|
|
343
339
|
</>
|
|
344
340
|
}
|
|
345
341
|
toggleProps={{
|
package/source/Form/Control.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
import { FormValidationProps } from './Primitives';
|
|
6
6
|
|
|
7
7
|
const CONTROL_SIZES = {
|
|
@@ -4,9 +4,9 @@ import Datepicker, { type DatepickerConfig } from 'bootstrap/js/src/datepicker.j
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Button, ButtonProps } from '../Button';
|
|
7
|
+
import { Button, ButtonProps } from '../Base/Button';
|
|
8
8
|
import { Icon } from '../Extension/Icon';
|
|
9
|
-
import { AsProps, polymorphic, PolymorphicComponent } from '../Polymorphic';
|
|
9
|
+
import { AsProps, polymorphic, PolymorphicComponent } from '../Helper/Polymorphic';
|
|
10
10
|
import { FormPlugin } from './Plugin';
|
|
11
11
|
import { FormValidationProps } from './Primitives';
|
|
12
12
|
|
|
@@ -163,7 +163,7 @@ class DatePickerComponent extends FormPlugin<
|
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
165
|
<Button as={as} {...buttonProps} {...attributes} ref={this.setRef}>
|
|
166
|
-
{leadingIcon && <Icon name={leadingIcon}
|
|
166
|
+
{leadingIcon && <Icon name={leadingIcon} />}
|
|
167
167
|
<span data-bs-datepicker-display="">{children}</span>
|
|
168
168
|
</Button>
|
|
169
169
|
);
|
package/source/Form/Feedback.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export type FormTextProps = ComponentPropsWithRef<'small'> & {
|
|
7
7
|
block?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { Children, ComponentPropsWithRef, isValidElement, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
import { FormLabel } from './Primitives';
|
|
6
6
|
|
|
7
7
|
export type FormFloatingLabelProps = ComponentPropsWithRef<'div'> & {
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
ReactElement
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import { Button, ButtonProps } from '../Button';
|
|
16
|
-
import { Menu, MenuProps } from '../Menu';
|
|
17
|
-
import { polymorphic } from '../Polymorphic';
|
|
15
|
+
import { Button, ButtonProps } from '../Base/Button';
|
|
16
|
+
import { Menu, MenuProps } from '../Base/Menu';
|
|
17
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
18
18
|
|
|
19
19
|
export type InputGroupProps = ComponentPropsWithRef<'div'> & {
|
|
20
20
|
size?: 'sm' | 'lg';
|
package/source/Form/OTP.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import type OtpInput from 'bootstrap/js/src/otp-input.js';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
6
6
|
|
|
7
|
-
import { AsProps, polymorphic } from '../Polymorphic';
|
|
7
|
+
import { AsProps, polymorphic } from '../Helper/Polymorphic';
|
|
8
8
|
import { FormPlugin } from './Plugin';
|
|
9
9
|
import { FormValidationProps } from './Primitives';
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export type FormProps = ComponentPropsWithRef<'form'> & {
|
|
7
7
|
validated?: boolean;
|
|
@@ -14,14 +14,6 @@ export const Form = polymorphic<FormProps>(
|
|
|
14
14
|
);
|
|
15
15
|
Form.displayName = 'Form';
|
|
16
16
|
|
|
17
|
-
export type FormFieldsetProps = ComponentPropsWithRef<'fieldset'>;
|
|
18
|
-
|
|
19
|
-
export const FormFieldset = polymorphic<FormFieldsetProps>(
|
|
20
|
-
({ as: Root = 'fieldset', ...props }) => <Root {...props} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
FormFieldset.displayName = 'FormFieldset';
|
|
24
|
-
|
|
25
17
|
export type FormFieldProps = ComponentPropsWithRef<'div'> & {
|
|
26
18
|
card?: boolean;
|
|
27
19
|
};
|
|
@@ -78,6 +70,13 @@ export const FormLabel = polymorphic<FormLabelProps>(
|
|
|
78
70
|
);
|
|
79
71
|
FormLabel.displayName = 'FormLabel';
|
|
80
72
|
|
|
73
|
+
export const ChipInputLabel = polymorphic<ComponentPropsWithRef<'label'>>(
|
|
74
|
+
({ as: Root = 'label', className, ...props }) => (
|
|
75
|
+
<Root {...props} className={classNames('chip-input-label', className)} />
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
ChipInputLabel.displayName = 'ChipInputLabel';
|
|
79
|
+
|
|
81
80
|
export type FormLegendProps = ComponentPropsWithRef<'legend'> &
|
|
82
81
|
Pick<FormLabelProps, 'column' | 'controlSize'>;
|
|
83
82
|
|
package/source/Form/Radio.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import type { ComponentTheme } from '../Button';
|
|
5
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import type { ComponentTheme } from '../Base/Button';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
6
6
|
import { Checkbox, CheckboxProps } from './Checkbox';
|
|
7
7
|
import { FormValidationProps } from './Primitives';
|
|
8
8
|
|
|
@@ -33,14 +33,24 @@ Radio.displayName = 'Radio';
|
|
|
33
33
|
export type FormCheckProps = CheckboxProps &
|
|
34
34
|
Pick<ComponentPropsWithRef<'input'>, 'ref'> & {
|
|
35
35
|
type?: 'checkbox' | 'radio';
|
|
36
|
+
listGroup?: boolean;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const FormCheck = polymorphic<FormCheckProps>(
|
|
39
|
-
({ as: RootAs, type = 'checkbox', indeterminate, ...props }) =>
|
|
40
|
+
({ as: RootAs, type = 'checkbox', indeterminate, listGroup, className, ...props }) =>
|
|
40
41
|
type === 'checkbox' ? (
|
|
41
|
-
<Checkbox
|
|
42
|
+
<Checkbox
|
|
43
|
+
as={RootAs}
|
|
44
|
+
{...props}
|
|
45
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
46
|
+
indeterminate={indeterminate}
|
|
47
|
+
/>
|
|
42
48
|
) : (
|
|
43
|
-
<Radio
|
|
49
|
+
<Radio
|
|
50
|
+
as={RootAs}
|
|
51
|
+
{...props}
|
|
52
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
53
|
+
/>
|
|
44
54
|
)
|
|
45
55
|
);
|
|
46
56
|
FormCheck.displayName = 'FormCheck';
|
package/source/Form/Range.tsx
CHANGED
|
@@ -4,8 +4,8 @@ import type Range from 'bootstrap/js/src/range.js';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ComponentPropsWithoutRef, CSSProperties, forwardRef, Ref } from 'react';
|
|
6
6
|
|
|
7
|
-
import { ComponentTheme } from '../Button';
|
|
8
|
-
import { AsProps, polymorphic } from '../Polymorphic';
|
|
7
|
+
import { ComponentTheme } from '../Base/Button';
|
|
8
|
+
import { AsProps, polymorphic } from '../Helper/Polymorphic';
|
|
9
9
|
import { FormPlugin } from './Plugin';
|
|
10
10
|
import { FormValidationProps } from './Primitives';
|
|
11
11
|
|
package/source/Form/Switch.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties, PropsWithChildren, Ref } from 'react';
|
|
3
3
|
|
|
4
|
-
import type { ComponentTheme } from '../Button';
|
|
5
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import type { ComponentTheme } from '../Base/Button';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
6
6
|
import { splitInputProps } from './inputProps';
|
|
7
7
|
import { FormValidationProps } from './Primitives';
|
|
8
8
|
|
package/source/Form/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { action, observable } from 'mobx';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
-
import { Breakpoint } from '
|
|
4
|
+
import { Breakpoint } from '../Layout/Grid';
|
|
5
5
|
|
|
6
6
|
export type OverlayPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
7
7
|
export type FloatingPlacement = OverlayPlacement | `${OverlayPlacement}-${'start' | 'end'}`;
|
|
@@ -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 type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
7
7
|
export type ColSize = number | 'auto';
|
|
@@ -64,42 +64,52 @@ export const Row = polymorphic<RowProps>(
|
|
|
64
64
|
Row.displayName = 'Row';
|
|
65
65
|
|
|
66
66
|
export interface ColProps extends ComponentPropsWithRef<'div'> {
|
|
67
|
-
xs?:
|
|
68
|
-
sm?:
|
|
69
|
-
md?:
|
|
70
|
-
lg?:
|
|
71
|
-
xl?:
|
|
72
|
-
'2xl'?:
|
|
67
|
+
xs?: ColBreakpoint;
|
|
68
|
+
sm?: ColBreakpoint;
|
|
69
|
+
md?: ColBreakpoint;
|
|
70
|
+
lg?: ColBreakpoint;
|
|
71
|
+
xl?: ColBreakpoint;
|
|
72
|
+
'2xl'?: ColBreakpoint;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
export type ColOrder = number | 'first' | 'last';
|
|
76
|
+
|
|
77
|
+
export interface ColBreakpointOptions {
|
|
78
|
+
span?: BreakpointColSize;
|
|
79
|
+
offset?: number;
|
|
80
|
+
order?: ColOrder;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type ColBreakpoint = BreakpointColSize | ColBreakpointOptions;
|
|
84
|
+
|
|
75
85
|
export const Col = polymorphic<ColProps>(
|
|
76
86
|
({ as: Root = 'div', xs, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
|
|
77
|
-
const sizes: [Breakpoint,
|
|
87
|
+
const sizes: [Breakpoint | undefined, ColBreakpoint | undefined][] = [
|
|
88
|
+
[undefined, xs],
|
|
78
89
|
['sm', sm],
|
|
79
90
|
['md', md],
|
|
80
91
|
['lg', lg],
|
|
81
92
|
['xl', xl],
|
|
82
93
|
['2xl', xxl]
|
|
83
94
|
];
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Root
|
|
88
|
-
{...props}
|
|
89
|
-
className={classNames(
|
|
90
|
-
{
|
|
91
|
-
col: (xs === undefined && !sized) || xs === true,
|
|
92
|
-
[`col-${xs}`]: xs !== undefined && xs !== true
|
|
93
|
-
},
|
|
94
|
-
sizes.map(
|
|
95
|
-
([breakpoint, size]) =>
|
|
96
|
-
size !== undefined &&
|
|
97
|
-
(size === true ? `${breakpoint}:col` : `${breakpoint}:col-${size}`)
|
|
98
|
-
),
|
|
99
|
-
className
|
|
100
|
-
)}
|
|
101
|
-
/>
|
|
95
|
+
const hasSpan = sizes.some(([, options]) =>
|
|
96
|
+
typeof options === 'object' ? options.span !== undefined : options !== undefined
|
|
102
97
|
);
|
|
98
|
+
const classes = sizes.map(([breakpoint, options]) => {
|
|
99
|
+
if (options === undefined) return [];
|
|
100
|
+
|
|
101
|
+
const prefix = breakpoint ? `${breakpoint}:` : '';
|
|
102
|
+
const { span, offset, order } =
|
|
103
|
+
typeof options === 'object' ? options : { span: options };
|
|
104
|
+
|
|
105
|
+
return [
|
|
106
|
+
span !== undefined && `${prefix}col${span === true ? '' : `-${span}`}`,
|
|
107
|
+
offset !== undefined && `${prefix}offset-${offset}`,
|
|
108
|
+
order !== undefined && `${prefix}order-${order}`
|
|
109
|
+
];
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return <Root {...props} className={classNames(!hasSpan && 'col', classes, className)} />;
|
|
103
113
|
}
|
|
104
114
|
);
|
|
105
115
|
Col.displayName = 'Col';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
|
|
6
|
+
export type AspectRatio = 'auto' | '1x1' | '4x3' | '16x9' | '21x9';
|
|
7
|
+
export type CustomAspectRatio = `${number} / ${number}`;
|
|
8
|
+
|
|
9
|
+
export type RatioProps = ComponentPropsWithRef<'div'> & {
|
|
10
|
+
aspectRatio?: AspectRatio | CustomAspectRatio;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Ratio = polymorphic<RatioProps>(
|
|
14
|
+
({ as: Root = 'div', aspectRatio = '1x1', className, style, ...props }) => {
|
|
15
|
+
const preset = /^(auto|1x1|4x3|16x9|21x9)$/.test(aspectRatio);
|
|
16
|
+
const ratioStyle: CSSProperties & { '--bs-ratio'?: string } = preset
|
|
17
|
+
? (style ?? {})
|
|
18
|
+
: { ...style, '--bs-ratio': aspectRatio };
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Root
|
|
22
|
+
{...props}
|
|
23
|
+
className={classNames(`ratio-${preset ? aspectRatio : 'auto'}`, className)}
|
|
24
|
+
style={ratioStyle}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
Ratio.displayName = 'Ratio';
|
package/source/index.ts
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './animate';
|
|
4
|
-
export * from './Avatar';
|
|
5
|
-
export * from './Badge';
|
|
6
|
-
export * from './Breadcrumb';
|
|
7
|
-
export * from './Button';
|
|
8
|
-
export * from './ButtonGroup';
|
|
9
|
-
export * from './Card';
|
|
10
|
-
export * from './Carousel';
|
|
11
|
-
export * from './CloseButton';
|
|
12
|
-
export * from './Collapse';
|
|
13
|
-
export * from './color';
|
|
14
|
-
export * from './Drawer';
|
|
1
|
+
export * from './Base';
|
|
2
|
+
export * from './Content';
|
|
15
3
|
export * from './Extension';
|
|
16
4
|
export * from './Form';
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './ListGroup';
|
|
20
|
-
export * from './Menu';
|
|
21
|
-
export * from './NativeDialog';
|
|
22
|
-
export * from './Nav';
|
|
23
|
-
export * from './Navbar';
|
|
24
|
-
export * from './NavOverflow';
|
|
25
|
-
export * from './Overlay';
|
|
26
|
-
export * from './Pagination';
|
|
27
|
-
export * from './Placeholder';
|
|
28
|
-
export * from './Polymorphic';
|
|
29
|
-
export * from './Popover';
|
|
30
|
-
export * from './Progress';
|
|
31
|
-
export * from './ScrollSpy';
|
|
32
|
-
export * from './Spinner';
|
|
33
|
-
export * from './Stack';
|
|
34
|
-
export * from './Stepper';
|
|
35
|
-
export * from './Tab';
|
|
36
|
-
export * from './Table';
|
|
37
|
-
export * from './Toast';
|
|
38
|
-
export * from './ToggleButton';
|
|
39
|
-
export * from './Toggler';
|
|
40
|
-
export * from './Tooltip';
|
|
5
|
+
export * from './Helper';
|
|
6
|
+
export * from './Layout';
|
package/source/types.d.ts
CHANGED