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/Range.tsx
CHANGED
|
@@ -1,65 +1,116 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type Range from 'bootstrap/js/src/range.js';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
+
import { ComponentPropsWithoutRef, CSSProperties, forwardRef, Ref } from 'react';
|
|
5
6
|
|
|
6
|
-
import
|
|
7
|
+
import { ComponentTheme } from '../Button';
|
|
8
|
+
import { FormPlugin } from './Plugin';
|
|
9
|
+
import { FormValidationProps } from './Primitives';
|
|
7
10
|
|
|
8
|
-
export type FormRangeProps = Omit<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export type FormRangeProps = Omit<ComponentPropsWithoutRef<'input'>, 'type'> &
|
|
12
|
+
FormValidationProps & {
|
|
13
|
+
bubble?: boolean;
|
|
14
|
+
theme?: ComponentTheme;
|
|
15
|
+
formatter?: (value: number) => string;
|
|
16
|
+
wrapperClassName?: string;
|
|
17
|
+
onValueChange?: (value: number) => unknown;
|
|
18
|
+
};
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
max = 100,
|
|
17
|
-
value,
|
|
18
|
-
defaultValue,
|
|
19
|
-
bubble,
|
|
20
|
-
theme,
|
|
21
|
-
onInput,
|
|
22
|
-
style,
|
|
23
|
-
...props
|
|
24
|
-
}) => {
|
|
25
|
-
const currentValue = Number(value ?? defaultValue ?? min);
|
|
26
|
-
const fill =
|
|
27
|
-
Number(max) <= Number(min)
|
|
28
|
-
? 0
|
|
29
|
-
: Math.max(0, Math.min(1, (currentValue - Number(min)) / (Number(max) - Number(min))));
|
|
20
|
+
interface FormRangeComponentProps extends FormRangeProps {
|
|
21
|
+
forwardedRef?: Ref<HTMLInputElement>;
|
|
22
|
+
}
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
class FormRangeComponent extends FormPlugin<FormRangeComponentProps, Range> {
|
|
25
|
+
protected configurationChanged = (previous: FormRangeComponentProps) =>
|
|
26
|
+
previous.bubble !== this.props.bubble ||
|
|
27
|
+
previous.formatter !== this.props.formatter ||
|
|
28
|
+
previous.list !== this.props.list ||
|
|
29
|
+
previous.min !== this.props.min ||
|
|
30
|
+
previous.max !== this.props.max;
|
|
38
31
|
|
|
39
|
-
|
|
32
|
+
protected load = async () => {
|
|
33
|
+
const { default: Plugin } = await import('bootstrap/js/src/range.js');
|
|
34
|
+
const { bubble = false, formatter = null } = this.props;
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
return (element: HTMLDivElement) => {
|
|
37
|
+
element.addEventListener('changed.bs.range', this.handleValueChange);
|
|
38
|
+
|
|
39
|
+
return Plugin.getOrCreateInstance(element, { bubble, formatter });
|
|
40
|
+
};
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
43
|
+
protected updatePlugin = () => this.instance?.update();
|
|
44
|
+
|
|
45
|
+
protected dispose() {
|
|
46
|
+
this.element.current?.removeEventListener('changed.bs.range', this.handleValueChange);
|
|
47
|
+
super.dispose();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private handleValueChange = (event: Event) =>
|
|
51
|
+
this.props.onValueChange?.((event as Event & { value: number }).value);
|
|
52
|
+
|
|
53
|
+
render() {
|
|
54
|
+
const {
|
|
55
|
+
className,
|
|
56
|
+
wrapperClassName,
|
|
57
|
+
min = 0,
|
|
58
|
+
max = 100,
|
|
59
|
+
value,
|
|
60
|
+
defaultValue,
|
|
61
|
+
bubble,
|
|
62
|
+
theme,
|
|
63
|
+
formatter: _formatter,
|
|
64
|
+
onValueChange: _onValueChange,
|
|
65
|
+
forwardedRef,
|
|
66
|
+
validation,
|
|
67
|
+
style,
|
|
68
|
+
...props
|
|
69
|
+
} = this.props;
|
|
70
|
+
const currentValue = Number(value ?? defaultValue ?? (Number(min) + Number(max)) / 2);
|
|
71
|
+
const fill =
|
|
72
|
+
Number(max) <= Number(min)
|
|
73
|
+
? 0
|
|
74
|
+
: Math.max(
|
|
75
|
+
0,
|
|
76
|
+
Math.min(1, (currentValue - Number(min)) / (Number(max) - Number(min)))
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
ref={this.element}
|
|
82
|
+
className={classNames(
|
|
83
|
+
'form-range',
|
|
84
|
+
theme && `theme-${theme}`,
|
|
85
|
+
validation && `is-${validation}`,
|
|
86
|
+
wrapperClassName
|
|
87
|
+
)}
|
|
88
|
+
data-bs-bubble={bubble || undefined}
|
|
89
|
+
style={{ '--bs-range-fill': fill } as CSSProperties}
|
|
90
|
+
>
|
|
91
|
+
<input
|
|
92
|
+
{...props}
|
|
93
|
+
ref={forwardedRef}
|
|
94
|
+
type="range"
|
|
95
|
+
min={min}
|
|
96
|
+
max={max}
|
|
97
|
+
value={value}
|
|
98
|
+
defaultValue={defaultValue}
|
|
99
|
+
aria-invalid={validation ? validation === 'invalid' : props['aria-invalid']}
|
|
100
|
+
className={classNames(
|
|
101
|
+
'form-range-input',
|
|
102
|
+
validation && `is-${validation}`,
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
style={style}
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const FormRange = forwardRef<HTMLInputElement, FormRangeProps>((props, forwardedRef) => (
|
|
113
|
+
<FormRangeComponent {...props} forwardedRef={forwardedRef} />
|
|
114
|
+
));
|
|
64
115
|
|
|
65
116
|
FormRange.displayName = 'FormRange';
|
package/source/Form/Switch.tsx
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ComponentPropsWithRef, FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, CSSProperties, FC, PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ComponentTheme } from '../Button';
|
|
5
|
+
import { FormValidationProps } from './Primitives';
|
|
5
6
|
|
|
6
7
|
export type FormSwitchProps = Omit<ComponentPropsWithRef<'label'>, 'children'> &
|
|
7
|
-
PropsWithChildren<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
PropsWithChildren<
|
|
9
|
+
FormValidationProps & {
|
|
10
|
+
inputProps?: Omit<ComponentPropsWithRef<'input'>, 'type'>;
|
|
11
|
+
size?: 'sm' | 'lg';
|
|
12
|
+
theme?: ComponentTheme;
|
|
13
|
+
width?: string;
|
|
14
|
+
indicatorWidth?: string;
|
|
15
|
+
}
|
|
16
|
+
>;
|
|
12
17
|
|
|
13
18
|
export const FormSwitch: FC<FormSwitchProps> = ({
|
|
14
19
|
className,
|
|
15
20
|
inputProps,
|
|
16
21
|
size,
|
|
17
22
|
theme,
|
|
23
|
+
validation,
|
|
24
|
+
width,
|
|
25
|
+
indicatorWidth,
|
|
26
|
+
style,
|
|
18
27
|
children,
|
|
19
28
|
...props
|
|
20
29
|
}) => (
|
|
@@ -24,10 +33,24 @@ export const FormSwitch: FC<FormSwitchProps> = ({
|
|
|
24
33
|
'switch',
|
|
25
34
|
size && `switch-${size}`,
|
|
26
35
|
theme && `theme-${theme}`,
|
|
36
|
+
validation && `is-${validation}`,
|
|
27
37
|
className
|
|
28
38
|
)}
|
|
39
|
+
style={
|
|
40
|
+
{
|
|
41
|
+
'--bs-switch-width': width,
|
|
42
|
+
'--bs-switch-indicator-width': indicatorWidth,
|
|
43
|
+
...style
|
|
44
|
+
} as CSSProperties
|
|
45
|
+
}
|
|
29
46
|
>
|
|
30
|
-
<input
|
|
47
|
+
<input
|
|
48
|
+
role="switch"
|
|
49
|
+
{...inputProps}
|
|
50
|
+
type="checkbox"
|
|
51
|
+
aria-invalid={validation ? validation === 'invalid' : inputProps?.['aria-invalid']}
|
|
52
|
+
className={classNames(validation && `is-${validation}`, inputProps?.className)}
|
|
53
|
+
/>
|
|
31
54
|
{children}
|
|
32
55
|
</label>
|
|
33
56
|
);
|
package/source/Form/index.ts
CHANGED
package/source/Grid.tsx
CHANGED
package/source/ListGroup.tsx
CHANGED
|
@@ -6,32 +6,45 @@ import type { Breakpoint } from './Grid';
|
|
|
6
6
|
|
|
7
7
|
export type ListGroupHorizontal = boolean | Breakpoint;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
interface ListGroupStyleProps {
|
|
10
10
|
flush?: boolean;
|
|
11
11
|
numbered?: boolean;
|
|
12
12
|
horizontal?: ListGroupHorizontal;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export type ListGroupProps = ListGroupStyleProps &
|
|
16
|
+
(
|
|
17
|
+
| (ComponentPropsWithRef<'ul'> & { as?: 'ul' })
|
|
18
|
+
| (ComponentPropsWithRef<'ol'> & { as: 'ol' })
|
|
19
|
+
| (ComponentPropsWithRef<'div'> & { as: 'div' })
|
|
20
|
+
);
|
|
21
|
+
|
|
15
22
|
export const ListGroup: FC<ListGroupProps> = ({
|
|
16
23
|
flush,
|
|
17
24
|
numbered,
|
|
18
25
|
horizontal,
|
|
19
26
|
className,
|
|
20
27
|
...props
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
28
|
+
}) => {
|
|
29
|
+
const classes = classNames(
|
|
30
|
+
'list-group',
|
|
31
|
+
{ 'list-group-flush': flush, 'list-group-numbered': numbered },
|
|
32
|
+
horizontal &&
|
|
33
|
+
(horizontal === true ? 'list-group-horizontal' : `${horizontal}:list-group-horizontal`),
|
|
34
|
+
className
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (props.as === 'ol') {
|
|
38
|
+
const { as: _as, ...attributes } = props;
|
|
39
|
+
return <ol {...attributes} className={classes} />;
|
|
40
|
+
}
|
|
41
|
+
if (props.as === 'div') {
|
|
42
|
+
const { as: _as, ...attributes } = props;
|
|
43
|
+
return <div {...attributes} className={classes} />;
|
|
44
|
+
}
|
|
45
|
+
const { as: _as, ...attributes } = props;
|
|
46
|
+
return <ul {...attributes} className={classes} />;
|
|
47
|
+
};
|
|
35
48
|
|
|
36
49
|
interface ListGroupItemStyleProps {
|
|
37
50
|
theme?: ComponentTheme;
|