idea-react 3.0.0-alpha.1 → 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 +86 -46
- package/dist/DatePickerPlugin-CpGuQRsi.js +1 -0
- package/dist/DatePickerPlugin-DB3nnslN.mjs +1 -0
- package/dist/index.d.mts +1069 -245
- package/dist/index.d.ts +1069 -245
- 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 +4 -2
- 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 +73 -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 +59 -0
- package/source/Form/Checkbox.tsx +78 -0
- package/source/Form/ChipInput.tsx +125 -0
- package/source/Form/Chips.tsx +69 -0
- package/source/Form/Combobox.tsx +374 -0
- package/source/Form/Control.tsx +94 -0
- package/source/Form/DatePicker.tsx +280 -0
- package/source/Form/DatePickerPlugin.ts +37 -0
- package/source/Form/Feedback.tsx +35 -0
- package/source/Form/FloatingLabel.tsx +32 -0
- package/source/Form/InputGroup.tsx +173 -0
- package/source/Form/OTP.tsx +141 -0
- package/source/Form/PasswordStrength.tsx +183 -0
- package/source/Form/Plugin.tsx +53 -0
- package/source/Form/Primitives.tsx +88 -0
- package/source/Form/Radio.tsx +43 -0
- package/source/Form/Range.tsx +116 -0
- package/source/Form/Switch.tsx +58 -0
- package/source/Form/index.ts +16 -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 +31 -6
- 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 +65 -27
- package/source/ToggleButton.tsx +21 -7
- package/source/Toggler.tsx +108 -0
- package/source/Tooltip.tsx +6 -1
- package/source/index.ts +16 -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/Alert.tsx
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { action, observable } from 'mobx';
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
6
|
+
import {
|
|
7
|
+
Component,
|
|
8
|
+
ComponentPropsWithoutRef,
|
|
9
|
+
ComponentPropsWithRef,
|
|
10
|
+
createRef,
|
|
11
|
+
FC,
|
|
12
|
+
MouseEvent,
|
|
13
|
+
TransitionEvent
|
|
14
|
+
} from 'react';
|
|
15
|
+
|
|
16
|
+
import { ComponentTheme } from './Button';
|
|
17
|
+
import { CloseButton } from './CloseButton';
|
|
18
|
+
|
|
19
|
+
export interface AlertProps extends ComponentPropsWithoutRef<'div'> {
|
|
20
|
+
theme?: ComponentTheme;
|
|
21
|
+
dismissible?: boolean;
|
|
22
|
+
instant?: boolean;
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
onClose?: () => unknown;
|
|
25
|
+
onClosed?: () => unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@observer
|
|
29
|
+
export class Alert extends Component<AlertProps> {
|
|
30
|
+
static displayName = 'Alert';
|
|
31
|
+
|
|
32
|
+
@observable accessor hiding = false;
|
|
33
|
+
@observable accessor closed = false;
|
|
34
|
+
|
|
35
|
+
root = createRef<HTMLDivElement>();
|
|
36
|
+
timer?: ReturnType<typeof setTimeout>;
|
|
37
|
+
notified = false;
|
|
38
|
+
|
|
39
|
+
componentDidUpdate() {
|
|
40
|
+
if (this.closed && !this.notified) {
|
|
41
|
+
this.notified = true;
|
|
42
|
+
this.props.onClosed?.();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
componentWillUnmount() {
|
|
47
|
+
clearTimeout(this.timer);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
finishClose = action(() => {
|
|
51
|
+
if (this.closed) return;
|
|
52
|
+
|
|
53
|
+
clearTimeout(this.timer);
|
|
54
|
+
this.closed = true;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
close = action(() => {
|
|
58
|
+
if (this.hiding || this.closed) return;
|
|
59
|
+
|
|
60
|
+
this.props.onClose?.();
|
|
61
|
+
|
|
62
|
+
if (this.props.instant) return this.finishClose();
|
|
63
|
+
|
|
64
|
+
this.hiding = true;
|
|
65
|
+
|
|
66
|
+
const style = getComputedStyle(this.root.current!);
|
|
67
|
+
const durations = style.transitionDuration.split(',').map(Alert.milliseconds);
|
|
68
|
+
const delays = style.transitionDelay.split(',').map(Alert.milliseconds);
|
|
69
|
+
const timeout = Math.max(
|
|
70
|
+
0,
|
|
71
|
+
...durations.map((duration, index) => duration + (delays[index % delays.length] || 0))
|
|
72
|
+
);
|
|
73
|
+
this.timer = setTimeout(this.finishClose, timeout);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
static milliseconds = (value: string) =>
|
|
77
|
+
(parseFloat(value) || 0) * (value.trim().endsWith('ms') ? 1 : 1000);
|
|
78
|
+
|
|
79
|
+
handleClose = (event: MouseEvent<HTMLButtonElement>) => {
|
|
80
|
+
if (!event.defaultPrevented) this.close();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
handleTransitionEnd = (event: TransitionEvent<HTMLDivElement>) => {
|
|
84
|
+
this.props.onTransitionEnd?.(event);
|
|
85
|
+
|
|
86
|
+
if (event.target === event.currentTarget && this.hiding) this.finishClose();
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
render() {
|
|
90
|
+
const {
|
|
91
|
+
theme,
|
|
92
|
+
dismissible,
|
|
93
|
+
instant,
|
|
94
|
+
closeLabel = 'Close',
|
|
95
|
+
onClose: _onClose,
|
|
96
|
+
onClosed: _onClosed,
|
|
97
|
+
className,
|
|
98
|
+
children,
|
|
99
|
+
...props
|
|
100
|
+
} = this.props;
|
|
101
|
+
|
|
102
|
+
return this.closed ? null : (
|
|
103
|
+
<div
|
|
104
|
+
{...props}
|
|
105
|
+
ref={this.root}
|
|
106
|
+
role={props.role ?? 'alert'}
|
|
107
|
+
className={classNames(
|
|
108
|
+
'alert',
|
|
109
|
+
theme && `theme-${theme}`,
|
|
110
|
+
{ 'alert-instant': instant, hiding: this.hiding },
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
onTransitionEnd={this.handleTransitionEnd}
|
|
114
|
+
>
|
|
115
|
+
{children}
|
|
116
|
+
|
|
117
|
+
{dismissible && (
|
|
118
|
+
<CloseButton
|
|
119
|
+
className="ms-auto"
|
|
120
|
+
aria-label={closeLabel}
|
|
121
|
+
onClick={this.handleClose}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const AlertLink: FC<ComponentPropsWithRef<'a'>> = ({ className, ...props }) => (
|
|
130
|
+
<a {...props} className={classNames('alert-link', className)} />
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
export const AlertHeading: FC<ComponentPropsWithRef<'h4'>> = ({ className, ...props }) => (
|
|
134
|
+
<h4 {...props} className={classNames('alert-heading', className)} />
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
AlertLink.displayName = 'AlertLink';
|
|
138
|
+
AlertHeading.displayName = 'AlertHeading';
|
package/source/Avatar.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { CSSProperties, FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, CSSProperties, FC, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ComponentTheme } from './Button';
|
|
5
5
|
|
|
@@ -66,6 +66,12 @@ export interface AvatarStackProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
66
66
|
size?: AvatarSize;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export const AvatarImage: FC<ComponentPropsWithRef<'img'>> = ({ className, ...props }) => (
|
|
70
|
+
<img {...props} className={classNames('avatar-img', className)} />
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
AvatarImage.displayName = 'AvatarImage';
|
|
74
|
+
|
|
69
75
|
export const AvatarStack: FC<AvatarStackProps> = ({ className, size, children, ...props }) => (
|
|
70
76
|
<div
|
|
71
77
|
className={classNames('avatar-stack', size && `avatar-stack-${size}`, className)}
|
package/source/Badge.tsx
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef, FC } from 'react';
|
|
3
|
+
|
|
4
|
+
export const Breadcrumb: FC<ComponentPropsWithRef<'ol'>> = ({ className, ...props }) => (
|
|
5
|
+
<ol {...props} className={classNames('breadcrumb', className)} />
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export const BreadcrumbItem: FC<ComponentPropsWithRef<'li'>> = props => (
|
|
9
|
+
<li {...props} className={classNames('breadcrumb-item', props.className)} />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export interface BreadcrumbLinkProps extends ComponentPropsWithRef<'a'> {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const BreadcrumbLink: FC<BreadcrumbLinkProps> = ({
|
|
17
|
+
active,
|
|
18
|
+
className,
|
|
19
|
+
'aria-current': current = active ? 'page' : undefined,
|
|
20
|
+
...props
|
|
21
|
+
}) => (
|
|
22
|
+
<a
|
|
23
|
+
{...props}
|
|
24
|
+
className={classNames('breadcrumb-link', { active }, className)}
|
|
25
|
+
aria-current={current}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const BreadcrumbDivider: FC<ComponentPropsWithRef<'li'>> = ({ className, ...props }) => (
|
|
30
|
+
<li {...props} className={classNames('breadcrumb-divider', className)} aria-hidden="true" />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
34
|
+
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
35
|
+
BreadcrumbLink.displayName = 'BreadcrumbLink';
|
|
36
|
+
BreadcrumbDivider.displayName = 'BreadcrumbDivider';
|
package/source/Button.tsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
1
|
import classNames from 'classnames';
|
|
4
2
|
import { ComponentPropsWithRef, FC, MouseEvent } from 'react';
|
|
5
3
|
|
|
@@ -16,12 +14,13 @@ export type ComponentTheme =
|
|
|
16
14
|
| 'inverse';
|
|
17
15
|
|
|
18
16
|
interface ButtonStyleProps {
|
|
19
|
-
variant?: 'solid' | 'outline' | 'subtle' | 'text' | 'link';
|
|
17
|
+
variant?: 'solid' | 'outline' | 'subtle' | 'text' | 'link' | false;
|
|
20
18
|
theme?: ComponentTheme;
|
|
21
19
|
size?: 'xs' | 'sm' | 'lg';
|
|
22
20
|
icon?: boolean;
|
|
23
21
|
styled?: boolean;
|
|
24
22
|
disabled?: boolean;
|
|
23
|
+
active?: boolean;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
type ButtonLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
|
|
@@ -41,15 +40,16 @@ export const Button: FC<ButtonProps> = ({
|
|
|
41
40
|
icon,
|
|
42
41
|
styled,
|
|
43
42
|
disabled,
|
|
43
|
+
active,
|
|
44
44
|
className,
|
|
45
45
|
...props
|
|
46
46
|
}) => {
|
|
47
47
|
const attributes: ButtonElementAttributes = props;
|
|
48
48
|
const classes = classNames(
|
|
49
|
-
variant ? `btn-${variant}` : icon ? undefined : 'btn',
|
|
49
|
+
variant === false ? undefined : variant ? `btn-${variant}` : icon ? undefined : 'btn',
|
|
50
50
|
theme && `theme-${theme}`,
|
|
51
51
|
size && `btn-${size}`,
|
|
52
|
-
{ 'btn-icon': icon, 'btn-styled': styled, disabled },
|
|
52
|
+
{ 'btn-icon': icon, 'btn-styled': styled, disabled, active },
|
|
53
53
|
className
|
|
54
54
|
);
|
|
55
55
|
|
|
@@ -59,6 +59,11 @@ export const Button: FC<ButtonProps> = ({
|
|
|
59
59
|
className={classes}
|
|
60
60
|
href={disabled ? undefined : attributes.href}
|
|
61
61
|
aria-disabled={disabled || undefined}
|
|
62
|
+
aria-pressed={
|
|
63
|
+
attributes.role === 'button'
|
|
64
|
+
? (active ?? attributes['aria-pressed'])
|
|
65
|
+
: attributes['aria-pressed']
|
|
66
|
+
}
|
|
62
67
|
tabIndex={disabled ? -1 : attributes.tabIndex}
|
|
63
68
|
onClick={disabled ? preventNavigation : attributes.onClick}
|
|
64
69
|
/>
|
|
@@ -68,6 +73,36 @@ export const Button: FC<ButtonProps> = ({
|
|
|
68
73
|
type={attributes.type || 'button'}
|
|
69
74
|
className={classes}
|
|
70
75
|
disabled={disabled}
|
|
76
|
+
aria-pressed={active ?? attributes['aria-pressed']}
|
|
71
77
|
/>
|
|
72
78
|
);
|
|
73
79
|
};
|
|
80
|
+
|
|
81
|
+
export type ButtonInputProps = Omit<ComponentPropsWithRef<'input'>, 'size'> & ButtonStyleProps;
|
|
82
|
+
|
|
83
|
+
export const ButtonInput: FC<ButtonInputProps> = ({
|
|
84
|
+
variant,
|
|
85
|
+
theme,
|
|
86
|
+
size,
|
|
87
|
+
icon,
|
|
88
|
+
styled,
|
|
89
|
+
active,
|
|
90
|
+
className,
|
|
91
|
+
type = 'button',
|
|
92
|
+
...props
|
|
93
|
+
}) => (
|
|
94
|
+
<input
|
|
95
|
+
{...props}
|
|
96
|
+
type={type}
|
|
97
|
+
className={classNames(
|
|
98
|
+
variant === false ? undefined : variant ? `btn-${variant}` : 'btn',
|
|
99
|
+
theme && `theme-${theme}`,
|
|
100
|
+
size && `btn-${size}`,
|
|
101
|
+
{ 'btn-icon': icon, 'btn-styled': styled, active },
|
|
102
|
+
className
|
|
103
|
+
)}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
Button.displayName = 'Button';
|
|
108
|
+
ButtonInput.displayName = 'ButtonInput';
|
package/source/ButtonGroup.tsx
CHANGED
|
@@ -3,10 +3,14 @@ import { ComponentPropsWithRef, FC } from 'react';
|
|
|
3
3
|
|
|
4
4
|
export interface ButtonGroupProps extends ComponentPropsWithRef<'div'> {
|
|
5
5
|
vertical?: boolean;
|
|
6
|
+
size?: 'xs' | 'sm' | 'lg';
|
|
7
|
+
divider?: boolean;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export const ButtonGroup: FC<ButtonGroupProps> = ({
|
|
9
11
|
vertical,
|
|
12
|
+
size,
|
|
13
|
+
divider,
|
|
10
14
|
role = 'group',
|
|
11
15
|
className,
|
|
12
16
|
...props
|
|
@@ -14,7 +18,12 @@ export const ButtonGroup: FC<ButtonGroupProps> = ({
|
|
|
14
18
|
<div
|
|
15
19
|
role={role}
|
|
16
20
|
{...props}
|
|
17
|
-
className={classNames(
|
|
21
|
+
className={classNames(
|
|
22
|
+
vertical ? 'btn-group-vertical' : 'btn-group',
|
|
23
|
+
size && `btn-group-${size}`,
|
|
24
|
+
divider && 'btn-group-divider',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
18
27
|
/>
|
|
19
28
|
);
|
|
20
29
|
ButtonGroup.displayName = 'ButtonGroup';
|
package/source/Card.tsx
CHANGED
|
@@ -1,8 +1,62 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, FC } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { ComponentTheme } from './Button';
|
|
5
|
+
|
|
6
|
+
export interface CardProps extends ComponentPropsWithRef<'div'> {
|
|
7
|
+
row?: boolean;
|
|
8
|
+
body?: boolean;
|
|
9
|
+
theme?: ComponentTheme;
|
|
10
|
+
subtle?: boolean;
|
|
11
|
+
translucent?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Card: FC<CardProps> = ({
|
|
15
|
+
row,
|
|
16
|
+
body,
|
|
17
|
+
theme,
|
|
18
|
+
subtle,
|
|
19
|
+
translucent,
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}) => (
|
|
23
|
+
<div
|
|
24
|
+
{...props}
|
|
25
|
+
className={classNames(
|
|
26
|
+
'card',
|
|
27
|
+
{
|
|
28
|
+
'card-row': row,
|
|
29
|
+
'card-body': body,
|
|
30
|
+
'card-subtle': subtle,
|
|
31
|
+
'card-translucent': translucent
|
|
32
|
+
},
|
|
33
|
+
theme && `theme-${theme}`,
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export interface CardImageProps extends ComponentPropsWithRef<'img'> {
|
|
40
|
+
placement?: 'top' | 'bottom' | 'start' | 'end';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const CardImage: FC<CardImageProps> = ({ placement, className, ...props }) => (
|
|
44
|
+
<img
|
|
45
|
+
{...props}
|
|
46
|
+
className={classNames(placement ? `card-img-${placement}` : 'card-img', className)}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const CardSubtitle: FC<ComponentPropsWithRef<'p'>> = ({ className, ...props }) => (
|
|
51
|
+
<p {...props} className={classNames('card-subtitle', className)} />
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const CardGroup: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
|
|
55
|
+
<div {...props} className={classNames('card-group', className)} />
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export const CardImageOverlay: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
|
|
59
|
+
<div {...props} className={classNames('card-img-overlay', className)} />
|
|
6
60
|
);
|
|
7
61
|
|
|
8
62
|
export const CardHeader: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
|
|
@@ -17,10 +71,25 @@ export const CardFooter: FC<ComponentPropsWithRef<'div'>> = ({ className, ...pro
|
|
|
17
71
|
<div {...props} className={classNames('card-footer', className)} />
|
|
18
72
|
);
|
|
19
73
|
|
|
20
|
-
export
|
|
21
|
-
|
|
74
|
+
export interface CardTitleProps extends ComponentPropsWithRef<'h4'> {
|
|
75
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const CardTitle: FC<CardTitleProps> = ({ as: Tag = 'h4', className, ...props }) => (
|
|
79
|
+
<Tag {...props} className={classNames('card-title', className)} />
|
|
22
80
|
);
|
|
23
81
|
|
|
24
82
|
export const CardText: FC<ComponentPropsWithRef<'p'>> = ({ className, ...props }) => (
|
|
25
83
|
<p {...props} className={classNames('card-text', className)} />
|
|
26
84
|
);
|
|
85
|
+
|
|
86
|
+
Card.displayName = 'Card';
|
|
87
|
+
CardImage.displayName = 'CardImage';
|
|
88
|
+
CardSubtitle.displayName = 'CardSubtitle';
|
|
89
|
+
CardGroup.displayName = 'CardGroup';
|
|
90
|
+
CardImageOverlay.displayName = 'CardImageOverlay';
|
|
91
|
+
CardHeader.displayName = 'CardHeader';
|
|
92
|
+
CardBody.displayName = 'CardBody';
|
|
93
|
+
CardFooter.displayName = 'CardFooter';
|
|
94
|
+
CardTitle.displayName = 'CardTitle';
|
|
95
|
+
CardText.displayName = 'CardText';
|