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