idea-react 3.0.0-beta.0 → 3.0.0-beta.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 +11 -2
- package/ReadMe.md +62 -49
- package/dist/DatePickerPlugin-CpGuQRsi.js +1 -0
- package/dist/DatePickerPlugin-DB3nnslN.mjs +1 -0
- package/dist/index.d.mts +1116 -442
- package/dist/index.d.ts +1116 -442
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/rolldown-runtime-5iZMYShA.js +1 -0
- package/dist/style.css +69 -66
- package/package.json +1 -1
- package/source/Accordion.tsx +137 -0
- package/source/Alert.tsx +138 -0
- package/source/Avatar.tsx +7 -1
- package/source/Badge.tsx +2 -0
- package/source/Breadcrumb.tsx +36 -0
- package/source/Button.tsx +40 -5
- package/source/ButtonGroup.tsx +10 -1
- package/source/Card.tsx +65 -4
- package/source/Carousel/index.tsx +391 -0
- package/source/Carousel/model.ts +113 -0
- package/source/Carousel/scroll.ts +79 -0
- package/source/Collapse.tsx +178 -0
- package/source/Drawer.tsx +127 -30
- package/source/{CodeBlock.tsx → Extension/CodeBlock/index.tsx} +23 -5
- package/source/Extension/CodeBlock/style.module.css +3 -0
- package/source/{Dialog.tsx → Extension/Dialog.tsx} +10 -6
- package/source/{EditorHTML.tsx → Extension/EditorHTML.tsx} +1 -1
- package/source/{HorizontalMarquee → Extension/HorizontalMarquee}/index.module.less +1 -3
- package/source/{Icon.tsx → Extension/Icon.tsx} +1 -7
- package/source/{Loading.tsx → Extension/Loading.tsx} +8 -3
- package/source/{MonthCalendar.tsx → Extension/MonthCalendar.tsx} +3 -3
- package/source/{Nameplate.tsx → Extension/Nameplate.tsx} +1 -1
- package/source/Extension/OverlayBox.tsx +280 -0
- package/source/{PageNav.tsx → Extension/PageNav.tsx} +27 -9
- package/source/{ScrollNav → Extension/ScrollNav}/index.tsx +1 -1
- package/source/Extension/Select.tsx +127 -0
- package/source/{ShareBox.tsx → Extension/ShareBox.tsx} +1 -1
- package/source/{SpinnerButton.tsx → Extension/SpinnerButton.tsx} +2 -2
- package/source/{TableSpinner.tsx → Extension/TableSpinner.tsx} +1 -1
- package/source/{Timeline → Extension/Timeline}/index.tsx +1 -1
- package/source/{UserRank → Extension/UserRank}/index.tsx +4 -4
- package/source/Extension/index.ts +27 -0
- package/source/Form/Adorn.tsx +32 -11
- package/source/Form/Checkbox.tsx +11 -6
- package/source/Form/ChipInput.tsx +125 -0
- package/source/Form/Chips.tsx +42 -24
- package/source/Form/Combobox.tsx +337 -72
- package/source/Form/Control.tsx +50 -15
- package/source/Form/DatePicker.tsx +231 -40
- package/source/Form/DatePickerPlugin.ts +37 -0
- package/source/Form/Feedback.tsx +10 -4
- package/source/Form/FloatingLabel.tsx +24 -7
- package/source/Form/InputGroup.tsx +155 -5
- package/source/Form/OTP.tsx +138 -45
- package/source/Form/PasswordStrength.tsx +43 -17
- package/source/Form/Plugin.tsx +53 -0
- package/source/Form/Primitives.tsx +51 -9
- package/source/Form/Radio.tsx +20 -28
- package/source/Form/Range.tsx +103 -52
- package/source/Form/Switch.tsx +30 -7
- package/source/Form/index.ts +1 -0
- package/source/Grid.tsx +4 -0
- package/source/ListGroup.tsx +28 -15
- package/source/Menu.tsx +226 -17
- package/source/NativeDialog/index.tsx +109 -5
- package/source/Nav.tsx +18 -2
- package/source/NavOverflow/index.tsx +307 -0
- package/source/NavOverflow/model.ts +21 -0
- package/source/Navbar.tsx +18 -3
- package/source/Overlay.ts +163 -1
- package/source/Pagination.tsx +92 -0
- package/source/Placeholder.tsx +66 -0
- package/source/Popover.tsx +7 -2
- package/source/Progress/index.tsx +76 -0
- package/source/Progress/style.module.css +15 -0
- package/source/ScrollSpy/index.tsx +365 -0
- package/source/ScrollSpy/model.ts +17 -0
- package/source/Spinner.tsx +10 -0
- package/source/Stepper.tsx +85 -0
- package/source/Tab.tsx +248 -0
- package/source/Toast.tsx +46 -14
- package/source/ToggleButton.tsx +21 -7
- package/source/Toggler.tsx +108 -0
- package/source/Tooltip.tsx +6 -1
- package/source/index.ts +15 -27
- package/source/OverlayBox.tsx +0 -208
- package/source/Select.tsx +0 -95
- /package/source/{ClickBoundary.tsx → Extension/ClickBoundary.tsx} +0 -0
- /package/source/{Countdown.tsx → Extension/Countdown.tsx} +0 -0
- /package/source/{Editor.tsx → Extension/Editor.tsx} +0 -0
- /package/source/{HorizontalMarquee → Extension/HorizontalMarquee}/index.tsx +0 -0
- /package/source/{LiveTSX.tsx → Extension/LiveTSX.tsx} +0 -0
- /package/source/{ScrollNav → Extension/ScrollNav}/Scroller.tsx +0 -0
- /package/source/{ScrollNav → Extension/ScrollNav}/index.module.less +0 -0
- /package/source/{TextTruncate → Extension/TextTruncate}/Content.tsx +0 -0
- /package/source/{TextTruncate → Extension/TextTruncate}/index.tsx +0 -0
- /package/source/{Time.tsx → Extension/Time.tsx} +0 -0
- /package/source/{TimeDistance.tsx → Extension/TimeDistance.tsx} +0 -0
- /package/source/{Timeline → Extension/Timeline}/index.module.less +0 -0
- /package/source/{TypeEcho → Extension/TypeEcho}/Content.tsx +0 -0
- /package/source/{TypeEcho → Extension/TypeEcho}/index.tsx +0 -0
- /package/source/{UserRank → Extension/UserRank}/Address.tsx +0 -0
- /package/source/{UserRank → Extension/UserRank}/index.module.less +0 -0
- /package/source/{VerticalMarquee → Extension/VerticalMarquee}/index.module.less +0 -0
- /package/source/{VerticalMarquee → Extension/VerticalMarquee}/index.tsx +0 -0
- /package/source/{ZodiacBar.tsx → Extension/ZodiacBar.tsx} +0 -0
package/source/Form/Adorn.tsx
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, FC } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { Icon, IconProps } from '../Extension/Icon';
|
|
5
|
+
import { FormValidationProps } from './Primitives';
|
|
6
|
+
|
|
7
|
+
export type FormAdornmentProps = Omit<ComponentPropsWithRef<'label'>, 'htmlFor'> &
|
|
8
|
+
FormValidationProps & {
|
|
9
|
+
end?: boolean;
|
|
10
|
+
size?: 'sm' | 'lg';
|
|
11
|
+
htmlFor?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const FormAdornment: FC<FormAdornmentProps> = ({
|
|
15
|
+
className,
|
|
16
|
+
end,
|
|
17
|
+
size,
|
|
18
|
+
validation,
|
|
19
|
+
...props
|
|
20
|
+
}) => (
|
|
11
21
|
<label
|
|
12
22
|
{...props}
|
|
13
23
|
className={classNames(
|
|
14
24
|
'form-control form-adorn',
|
|
15
25
|
end && 'form-adorn-end',
|
|
16
|
-
size && `form-
|
|
26
|
+
size && `form-control-${size}`,
|
|
27
|
+
validation && `is-${validation}`,
|
|
17
28
|
className
|
|
18
29
|
)}
|
|
19
30
|
/>
|
|
@@ -29,10 +40,20 @@ export const FormAdornmentText: FC<FormAdornmentTextProps> = ({ className, ...pr
|
|
|
29
40
|
|
|
30
41
|
FormAdornmentText.displayName = 'FormAdornmentText';
|
|
31
42
|
|
|
32
|
-
export
|
|
43
|
+
export const FormAdornmentIcon: FC<IconProps> = ({ className, ...props }) => (
|
|
44
|
+
<Icon {...props} className={classNames('form-adorn-icon', className)} />
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
FormAdornmentIcon.displayName = 'FormAdornmentIcon';
|
|
33
48
|
|
|
34
|
-
export
|
|
35
|
-
|
|
49
|
+
export type FormGhostProps = ComponentPropsWithRef<'input'> & FormValidationProps;
|
|
50
|
+
|
|
51
|
+
export const FormGhost: FC<FormGhostProps> = ({ className, validation, ...props }) => (
|
|
52
|
+
<input
|
|
53
|
+
{...props}
|
|
54
|
+
aria-invalid={validation ? validation === 'invalid' : props['aria-invalid']}
|
|
55
|
+
className={classNames('form-ghost', validation && `is-${validation}`, className)}
|
|
56
|
+
/>
|
|
36
57
|
);
|
|
37
58
|
|
|
38
59
|
FormGhost.displayName = 'FormGhost';
|
package/source/Form/Checkbox.tsx
CHANGED
|
@@ -4,12 +4,14 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { Component, ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
5
5
|
|
|
6
6
|
import type { ComponentTheme } from '../Button';
|
|
7
|
+
import { FormValidationProps } from './Primitives';
|
|
7
8
|
|
|
8
|
-
export type CheckboxProps = Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'size'> &
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export type CheckboxProps = Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'size'> &
|
|
10
|
+
FormValidationProps & {
|
|
11
|
+
size?: 'sm' | 'lg';
|
|
12
|
+
theme?: ComponentTheme;
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
};
|
|
13
15
|
|
|
14
16
|
interface CheckboxComponentProps extends CheckboxProps {
|
|
15
17
|
forwardedRef?: Ref<HTMLInputElement>;
|
|
@@ -44,6 +46,7 @@ class CheckboxComponent extends Component<CheckboxComponentProps> {
|
|
|
44
46
|
className,
|
|
45
47
|
size,
|
|
46
48
|
theme,
|
|
49
|
+
validation,
|
|
47
50
|
indeterminate,
|
|
48
51
|
forwardedRef: _forwardedRef,
|
|
49
52
|
...props
|
|
@@ -54,11 +57,13 @@ class CheckboxComponent extends Component<CheckboxComponentProps> {
|
|
|
54
57
|
{...props}
|
|
55
58
|
ref={this.setInputRef}
|
|
56
59
|
type="checkbox"
|
|
57
|
-
aria-
|
|
60
|
+
aria-invalid={validation ? validation === 'invalid' : props['aria-invalid']}
|
|
61
|
+
aria-checked={indeterminate ? 'mixed' : props['aria-checked']}
|
|
58
62
|
className={classNames(
|
|
59
63
|
'check',
|
|
60
64
|
size && `check-${size}`,
|
|
61
65
|
theme && `theme-${theme}`,
|
|
66
|
+
validation && `is-${validation}`,
|
|
62
67
|
className
|
|
63
68
|
)}
|
|
64
69
|
/>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type Chips from 'bootstrap/js/src/chips.js';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react';
|
|
6
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
7
|
+
|
|
8
|
+
import { ComponentTheme } from '../Button';
|
|
9
|
+
import { Icon } from '../Extension/Icon';
|
|
10
|
+
import { FormPlugin } from './Plugin';
|
|
11
|
+
import { FormValidationProps } from './Primitives';
|
|
12
|
+
|
|
13
|
+
export type ChipInputProps = ComponentPropsWithoutRef<'div'> &
|
|
14
|
+
FormValidationProps & {
|
|
15
|
+
theme?: ComponentTheme;
|
|
16
|
+
separator?: string | null;
|
|
17
|
+
allowDuplicates?: boolean;
|
|
18
|
+
maxChips?: number | null;
|
|
19
|
+
createOnBlur?: boolean;
|
|
20
|
+
dismissible?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
onValuesChange?: (values: string[]) => unknown;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface ChipInputComponentProps extends ChipInputProps {
|
|
26
|
+
forwardedRef?: Ref<HTMLDivElement>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class ChipInputComponent extends FormPlugin<ChipInputComponentProps, Pick<Chips, 'dispose'>> {
|
|
30
|
+
protected configurationChanged = (previous: ChipInputComponentProps) =>
|
|
31
|
+
previous.separator !== this.props.separator ||
|
|
32
|
+
previous.allowDuplicates !== this.props.allowDuplicates ||
|
|
33
|
+
previous.maxChips !== this.props.maxChips ||
|
|
34
|
+
previous.createOnBlur !== this.props.createOnBlur ||
|
|
35
|
+
previous.dismissible !== this.props.dismissible ||
|
|
36
|
+
previous.placeholder !== this.props.placeholder;
|
|
37
|
+
|
|
38
|
+
protected load = async () => {
|
|
39
|
+
const [{ default: Plugin }, { default: EventHandler }] = await Promise.all([
|
|
40
|
+
import('bootstrap/js/src/chips.js'),
|
|
41
|
+
import('bootstrap/js/src/dom/event-handler.js')
|
|
42
|
+
]);
|
|
43
|
+
const {
|
|
44
|
+
separator = ',',
|
|
45
|
+
allowDuplicates = false,
|
|
46
|
+
maxChips = null,
|
|
47
|
+
createOnBlur = true,
|
|
48
|
+
dismissible = true,
|
|
49
|
+
placeholder = ''
|
|
50
|
+
} = this.props;
|
|
51
|
+
|
|
52
|
+
return (element: HTMLDivElement) => {
|
|
53
|
+
const instance = Plugin.getOrCreateInstance(element, {
|
|
54
|
+
separator,
|
|
55
|
+
allowDuplicates,
|
|
56
|
+
maxChips,
|
|
57
|
+
createOnBlur,
|
|
58
|
+
dismissible,
|
|
59
|
+
placeholder,
|
|
60
|
+
dismissIcon: renderToStaticMarkup(<Icon name="x-lg" aria-hidden="true" />)
|
|
61
|
+
});
|
|
62
|
+
element.addEventListener('change.bs.chips', this.handleValuesChange);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
dispose: () => {
|
|
66
|
+
element.removeEventListener('change.bs.chips', this.handleValuesChange);
|
|
67
|
+
EventHandler.off(element, '.bs.chips');
|
|
68
|
+
instance.dispose();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
private handleValuesChange = (event: Event) =>
|
|
75
|
+
this.props.onValuesChange?.((event as Event & { values: string[] }).values);
|
|
76
|
+
|
|
77
|
+
private setRef = (element: HTMLDivElement | null) => {
|
|
78
|
+
this.element.current = element;
|
|
79
|
+
const { forwardedRef } = this.props;
|
|
80
|
+
|
|
81
|
+
if (typeof forwardedRef === 'function') forwardedRef(element);
|
|
82
|
+
else if (forwardedRef) forwardedRef.current = element;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
const {
|
|
87
|
+
className,
|
|
88
|
+
theme,
|
|
89
|
+
separator,
|
|
90
|
+
allowDuplicates,
|
|
91
|
+
maxChips,
|
|
92
|
+
createOnBlur,
|
|
93
|
+
dismissible: _dismissible,
|
|
94
|
+
placeholder: _placeholder,
|
|
95
|
+
onValuesChange: _onValuesChange,
|
|
96
|
+
forwardedRef: _forwardedRef,
|
|
97
|
+
validation,
|
|
98
|
+
...props
|
|
99
|
+
} = this.props;
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
{...props}
|
|
104
|
+
ref={this.setRef}
|
|
105
|
+
className={classNames(
|
|
106
|
+
'chip-input',
|
|
107
|
+
theme && `theme-${theme}`,
|
|
108
|
+
validation && `is-${validation}`,
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
data-bs-chips=""
|
|
112
|
+
data-bs-separator={separator}
|
|
113
|
+
data-bs-allow-duplicates={allowDuplicates}
|
|
114
|
+
data-bs-max-chips={maxChips}
|
|
115
|
+
data-bs-create-on-blur={createOnBlur}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const ChipInput = forwardRef<HTMLDivElement, ChipInputProps>((props, forwardedRef) => (
|
|
122
|
+
<ChipInputComponent {...props} forwardedRef={forwardedRef} />
|
|
123
|
+
));
|
|
124
|
+
|
|
125
|
+
ChipInput.displayName = 'ChipInput';
|
package/source/Form/Chips.tsx
CHANGED
|
@@ -1,51 +1,69 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, FC } from 'react';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { ComponentTheme } from '../Button';
|
|
5
|
+
import { Icon, IconProps } from '../Extension/Icon';
|
|
5
6
|
|
|
6
7
|
export type ChipProps = ComponentPropsWithRef<'button'> & {
|
|
7
8
|
active?: boolean;
|
|
8
9
|
theme?: ComponentTheme;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export const Chip: FC<ChipProps> = ({ className, active,
|
|
12
|
+
export const Chip: FC<ChipProps> = ({ className, active, theme, ...props }) => (
|
|
12
13
|
<button
|
|
13
14
|
{...props}
|
|
14
15
|
className={classNames('chip', active && 'active', theme && `theme-${theme}`, className)}
|
|
15
16
|
type="button"
|
|
16
17
|
aria-pressed={active}
|
|
17
|
-
disabled={disabled}
|
|
18
18
|
/>
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
Chip.displayName = 'Chip';
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
allowDuplicates?: boolean;
|
|
27
|
-
maxChips?: number;
|
|
28
|
-
createOnBlur?: boolean;
|
|
29
|
-
};
|
|
23
|
+
export const ChipIcon: FC<IconProps> = ({ className, ...props }) => (
|
|
24
|
+
<Icon {...props} className={classNames('chip-icon', className)} />
|
|
25
|
+
);
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
ChipIcon.displayName = 'ChipIcon';
|
|
28
|
+
|
|
29
|
+
export const ChipImage: FC<ComponentPropsWithRef<'img'>> = ({ className, alt = '', ...props }) => (
|
|
30
|
+
<img {...props} alt={alt} className={classNames('chip-img', className)} />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
ChipImage.displayName = 'ChipImage';
|
|
34
|
+
|
|
35
|
+
export const ChipDismiss: FC<ComponentPropsWithRef<'button'>> = ({
|
|
32
36
|
className,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
allowDuplicates,
|
|
36
|
-
maxChips,
|
|
37
|
-
createOnBlur,
|
|
37
|
+
children,
|
|
38
|
+
'aria-label': label = 'Remove',
|
|
38
39
|
...props
|
|
39
40
|
}) => (
|
|
40
|
-
<
|
|
41
|
+
<button
|
|
42
|
+
{...props}
|
|
43
|
+
type="button"
|
|
44
|
+
aria-label={label}
|
|
45
|
+
className={classNames('chip-dismiss', className)}
|
|
46
|
+
>
|
|
47
|
+
{children ?? <Icon name="x-lg" aria-hidden="true" />}
|
|
48
|
+
</button>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
ChipDismiss.displayName = 'ChipDismiss';
|
|
52
|
+
|
|
53
|
+
export type ChipTokenProps = ComponentPropsWithRef<'span'> & Pick<ChipProps, 'active' | 'theme'>;
|
|
54
|
+
|
|
55
|
+
export const ChipToken: FC<ChipTokenProps> = ({ className, active, theme, ...props }) => (
|
|
56
|
+
<span
|
|
41
57
|
{...props}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
data-bs-separator={separator}
|
|
45
|
-
data-bs-allow-duplicates={allowDuplicates}
|
|
46
|
-
data-bs-max-chips={maxChips}
|
|
47
|
-
data-bs-create-on-blur={createOnBlur}
|
|
58
|
+
tabIndex={props.tabIndex ?? 0}
|
|
59
|
+
className={classNames('chip', active && 'active', theme && `theme-${theme}`, className)}
|
|
48
60
|
/>
|
|
49
61
|
);
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
ChipToken.displayName = 'ChipToken';
|
|
64
|
+
|
|
65
|
+
export const ChipInputLabel: FC<ComponentPropsWithRef<'label'>> = ({ className, ...props }) => (
|
|
66
|
+
<label {...props} className={classNames('chip-input-label', className)} />
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
ChipInputLabel.displayName = 'ChipInputLabel';
|