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
|
@@ -5,7 +5,7 @@ import { observer } from 'mobx-react';
|
|
|
5
5
|
import { Component, ComponentPropsWithRef, createRef, ElementType, ReactNode } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
8
|
-
import { AsProps, PolymorphicClassProps } from '
|
|
8
|
+
import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
9
9
|
import { ScrollSpyModel } from './model';
|
|
10
10
|
|
|
11
11
|
export interface ScrollSpyProps extends Omit<
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { Icon, IconProps } from '../Extension/Icon';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
6
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { Icon, IconProps } from './Extension/Icon';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
export type SpinnerAnimation = 'border' | 'grow';
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import { Breakpoint } from '../Layout/Grid';
|
|
4
6
|
import { ComponentTheme } from './Button';
|
|
5
|
-
import { Breakpoint } from './Grid';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
export interface StepperProps extends ComponentPropsWithRef<'ol'> {
|
|
9
9
|
horizontal?: boolean | Breakpoint;
|
|
@@ -16,7 +16,9 @@ import {
|
|
|
16
16
|
ReactNode
|
|
17
17
|
} from 'react';
|
|
18
18
|
|
|
19
|
-
import { AsProps, polymorphic, PolymorphicClassProps } from '
|
|
19
|
+
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
20
|
+
import { ListGroup, ListGroupItem } from './ListGroup';
|
|
21
|
+
import { Nav, NavLink, NavProps } from './Nav';
|
|
20
22
|
|
|
21
23
|
export interface TabProps extends ComponentPropsWithRef<'div'> {
|
|
22
24
|
eventKey: string;
|
|
@@ -31,7 +33,10 @@ export const Tab = polymorphic<TabProps>(
|
|
|
31
33
|
);
|
|
32
34
|
Tab.displayName = 'Tab';
|
|
33
35
|
|
|
34
|
-
export interface TabsProps
|
|
36
|
+
export interface TabsProps
|
|
37
|
+
extends
|
|
38
|
+
Omit<ComponentPropsWithRef<'div'>, 'onChange'>,
|
|
39
|
+
Pick<NavProps, 'vertical' | 'fill' | 'justified' | 'cardHeader' | 'navbar'> {
|
|
35
40
|
activeKey?: string;
|
|
36
41
|
defaultActiveKey?: string;
|
|
37
42
|
fade?: boolean;
|
|
@@ -85,6 +90,13 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
85
90
|
: (this.tabs.find(({ props }) => !props.disabled)?.props.eventKey ?? '');
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
get orientation() {
|
|
94
|
+
return (
|
|
95
|
+
this.componentProps.orientation ??
|
|
96
|
+
(this.componentProps.vertical ? 'vertical' : 'horizontal')
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
handleClick = (event: MouseEvent<HTMLDivElement>) => {
|
|
89
101
|
this.componentProps.onClick?.(event);
|
|
90
102
|
|
|
@@ -108,7 +120,7 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
108
120
|
const { tabs } = this;
|
|
109
121
|
if (!button || Number.isNaN(index)) return;
|
|
110
122
|
|
|
111
|
-
const horizontal = this.
|
|
123
|
+
const horizontal = this.orientation !== 'vertical';
|
|
112
124
|
const previous = horizontal ? event.key === 'ArrowLeft' : event.key === 'ArrowUp';
|
|
113
125
|
const next = horizontal ? event.key === 'ArrowRight' : event.key === 'ArrowDown';
|
|
114
126
|
const enabled = tabs
|
|
@@ -148,51 +160,47 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
148
160
|
panelId = (key: string) => `${this.componentProps.id}-panel-${encodeURIComponent(key)}`;
|
|
149
161
|
|
|
150
162
|
renderTabs = () => {
|
|
151
|
-
const {
|
|
163
|
+
const { variant = 'tabs', fill, justified, cardHeader, navbar } = this.componentProps;
|
|
164
|
+
const { orientation } = this;
|
|
152
165
|
const listGroup = variant === 'list-group';
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{tab.label}
|
|
192
|
-
</button>
|
|
193
|
-
);
|
|
194
|
-
})}
|
|
195
|
-
</div>
|
|
166
|
+
const tabListProps = {
|
|
167
|
+
role: 'tablist' as const,
|
|
168
|
+
'aria-label': this.componentProps['aria-label'] ?? 'Tabs',
|
|
169
|
+
'aria-orientation': orientation,
|
|
170
|
+
children: this.tabs.map(({ props: tab }, index) => {
|
|
171
|
+
const active = tab.eventKey === this.activeKey;
|
|
172
|
+
const triggerProps = {
|
|
173
|
+
id: this.tabId(tab.eventKey),
|
|
174
|
+
type: 'button' as const,
|
|
175
|
+
role: 'tab',
|
|
176
|
+
'data-tab-index': index,
|
|
177
|
+
'aria-controls': this.panelId(tab.eventKey),
|
|
178
|
+
'aria-selected': active,
|
|
179
|
+
'aria-disabled': tab.disabled || undefined,
|
|
180
|
+
tabIndex: active ? 0 : -1,
|
|
181
|
+
disabled: tab.disabled,
|
|
182
|
+
className: classNames({ active }, tab.disabled && 'disabled'),
|
|
183
|
+
children: tab.label
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return listGroup ? (
|
|
187
|
+
<ListGroupItem key={tab.eventKey} as="button" {...triggerProps} action />
|
|
188
|
+
) : (
|
|
189
|
+
<NavLink key={tab.eventKey} as="button" {...triggerProps} />
|
|
190
|
+
);
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
return listGroup ? (
|
|
195
|
+
<ListGroup as="div" {...tabListProps} />
|
|
196
|
+
) : (
|
|
197
|
+
<Nav
|
|
198
|
+
as="div"
|
|
199
|
+
{...tabListProps}
|
|
200
|
+
variant={variant}
|
|
201
|
+
vertical={orientation === 'vertical'}
|
|
202
|
+
{...{ fill, justified, cardHeader, navbar }}
|
|
203
|
+
/>
|
|
196
204
|
);
|
|
197
205
|
};
|
|
198
206
|
|
|
@@ -241,6 +249,11 @@ export class Tabs<T extends ElementType | undefined = 'div'> extends Component<
|
|
|
241
249
|
orientation: _orientation,
|
|
242
250
|
children: _children,
|
|
243
251
|
variant: _variant,
|
|
252
|
+
vertical: _vertical,
|
|
253
|
+
fill: _fill,
|
|
254
|
+
justified: _justified,
|
|
255
|
+
cardHeader: _cardHeader,
|
|
256
|
+
navbar: _navbar,
|
|
244
257
|
...props
|
|
245
258
|
} = this.componentProps;
|
|
246
259
|
|
|
@@ -6,9 +6,9 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { ComponentPropsWithRef, FC, MouseEvent, ReactNode } from 'react';
|
|
7
7
|
import { Timestamp, uniqueID } from 'web-utility';
|
|
8
8
|
|
|
9
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
9
10
|
import type { ComponentTheme } from './Button';
|
|
10
11
|
import { CloseButton } from './CloseButton';
|
|
11
|
-
import { polymorphic } from './Polymorphic';
|
|
12
12
|
|
|
13
13
|
export type ToastPosition =
|
|
14
14
|
| 'top-start'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef, CSSProperties, Ref } from 'react';
|
|
3
3
|
|
|
4
|
+
import { splitInputProps } from '../Form/inputProps';
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
6
|
import type { ComponentTheme } from './Button';
|
|
5
|
-
import { splitInputProps } from './Form/inputProps';
|
|
6
|
-
import { polymorphic } from './Polymorphic';
|
|
7
7
|
|
|
8
8
|
type NativeInputProps = Omit<ComponentPropsWithRef<'input'>, 'ref' | 'type' | 'size'>;
|
|
9
9
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { ButtonHTMLAttributes, Component, ElementType, KeyboardEvent, MouseEvent } from 'react';
|
|
5
5
|
|
|
6
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
6
7
|
import { Button, ComponentTheme } from './Button';
|
|
7
|
-
import { AsProps, PolymorphicClassProps } from './Polymorphic';
|
|
8
8
|
|
|
9
9
|
export interface TogglerProps extends Omit<ButtonHTMLAttributes<HTMLElement>, 'value'> {
|
|
10
10
|
as?: 'button' | 'div' | 'span';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
OVERLAY_ARROW_POSITIONS,
|
|
5
|
+
OVERLAY_DIRECTIONS,
|
|
6
|
+
OverlayTriggerProps
|
|
7
|
+
} from '../Helper/Overlay';
|
|
8
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
9
|
|
|
6
10
|
export type TooltipProps = OverlayTriggerProps;
|
|
7
11
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
2
|
+
export * from './Alert';
|
|
3
|
+
export * from './Avatar';
|
|
4
|
+
export * from './Badge';
|
|
5
|
+
export * from './Breadcrumb';
|
|
6
|
+
export * from './Button';
|
|
7
|
+
export * from './ButtonGroup';
|
|
8
|
+
export * from './Card';
|
|
9
|
+
export * from './Carousel';
|
|
10
|
+
export * from './CloseButton';
|
|
11
|
+
export * from './Collapse';
|
|
12
|
+
export * from './Drawer';
|
|
13
|
+
export * from './Fade';
|
|
14
|
+
export * from './ListGroup';
|
|
15
|
+
export * from './Menu';
|
|
16
|
+
export * from './NativeDialog';
|
|
17
|
+
export * from './Nav';
|
|
18
|
+
export * from './Navbar';
|
|
19
|
+
export * from './NavOverflow';
|
|
20
|
+
export * from './Pagination';
|
|
21
|
+
export * from './Placeholder';
|
|
22
|
+
export * from './Popover';
|
|
23
|
+
export * from './Progress';
|
|
24
|
+
export * from './ScrollSpy';
|
|
25
|
+
export * from './Spinner';
|
|
26
|
+
export * from './Stack';
|
|
27
|
+
export * from './Stepper';
|
|
28
|
+
export * from './Tab';
|
|
29
|
+
export * from './Toast';
|
|
30
|
+
export * from './ToggleButton';
|
|
31
|
+
export * from './Toggler';
|
|
32
|
+
export * from './Tooltip';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import { Image, ImageProps } from './Images';
|
|
6
|
+
|
|
7
|
+
export type FigureProps = ComponentPropsWithRef<'figure'>;
|
|
8
|
+
|
|
9
|
+
export const Figure = polymorphic<FigureProps>(({ as: Root = 'figure', className, ...props }) => (
|
|
10
|
+
<Root {...props} className={classNames('figure', className)} />
|
|
11
|
+
));
|
|
12
|
+
Figure.displayName = 'Figure';
|
|
13
|
+
|
|
14
|
+
export const FigureImage = polymorphic<ImageProps>(
|
|
15
|
+
({ as: Root = 'img', fluid = true, ...props }) => <Image as={Root} {...props} fluid={fluid} />
|
|
16
|
+
);
|
|
17
|
+
FigureImage.displayName = 'FigureImage';
|
|
18
|
+
|
|
19
|
+
export type FigureCaptionProps = ComponentPropsWithRef<'figcaption'>;
|
|
20
|
+
|
|
21
|
+
export const FigureCaption = polymorphic<FigureCaptionProps>(
|
|
22
|
+
({ as: Root = 'figcaption', className, ...props }) => (
|
|
23
|
+
<Root {...props} className={classNames('figure-caption', className)} />
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
FigureCaption.displayName = 'FigureCaption';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
|
|
6
|
+
export interface ImageProps extends ComponentPropsWithRef<'img'> {
|
|
7
|
+
fluid?: boolean;
|
|
8
|
+
thumbnail?: boolean;
|
|
9
|
+
rounded?: boolean;
|
|
10
|
+
roundedCircle?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Image = polymorphic<ImageProps>(
|
|
14
|
+
({ as: Root = 'img', fluid, thumbnail, rounded, roundedCircle, className, ...props }) => (
|
|
15
|
+
<Root
|
|
16
|
+
{...props}
|
|
17
|
+
className={classNames(
|
|
18
|
+
{
|
|
19
|
+
'img-fluid': fluid,
|
|
20
|
+
'img-thumbnail': thumbnail,
|
|
21
|
+
rounded,
|
|
22
|
+
'rounded-circle': roundedCircle
|
|
23
|
+
},
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
Image.displayName = 'Image';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import type { Breakpoint } from '../Layout/Grid';
|
|
6
6
|
|
|
7
7
|
export interface TableProps extends ComponentPropsWithRef<'table'> {
|
|
8
8
|
striped?: boolean;
|
|
@@ -13,7 +13,7 @@ import reactElementToJSXString from 'react-element-to-jsx-string';
|
|
|
13
13
|
import { createHighlighterCoreSync, ShikiTransformer } from 'shiki/core';
|
|
14
14
|
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
|
|
15
15
|
|
|
16
|
-
import { polymorphic } from '../Polymorphic';
|
|
16
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
17
17
|
|
|
18
18
|
const highlighter = createHighlighterCoreSync({
|
|
19
19
|
themes: [githubLight, githubDark],
|
|
@@ -6,7 +6,7 @@ import { ObservedComponent, reaction } from 'mobx-react-helper';
|
|
|
6
6
|
import { ElementType, HTMLAttributes } from 'react';
|
|
7
7
|
import { Second, TimeData } from 'web-utility';
|
|
8
8
|
|
|
9
|
-
import { AsProps, PolymorphicClassProps } from '../Polymorphic';
|
|
9
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
10
10
|
|
|
11
11
|
export interface TimeUnit {
|
|
12
12
|
scale: number;
|
|
@@ -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 type HorizontalMarqueeProps = HTMLAttributes<HTMLDivElement> &
|
|
@@ -1,18 +1,31 @@
|
|
|
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 IconProps = ComponentPropsWithRef<'span'> & {
|
|
7
7
|
name: string;
|
|
8
8
|
size?: number;
|
|
9
9
|
};
|
|
10
10
|
export const Icon = polymorphic<IconProps>(
|
|
11
|
-
({
|
|
11
|
+
({
|
|
12
|
+
as: Root = 'span',
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
name,
|
|
16
|
+
size,
|
|
17
|
+
'aria-hidden': ariaHidden,
|
|
18
|
+
'aria-label': ariaLabel,
|
|
19
|
+
'aria-labelledby': ariaLabelledBy,
|
|
20
|
+
...props
|
|
21
|
+
}) => (
|
|
12
22
|
<Root
|
|
23
|
+
{...props}
|
|
13
24
|
className={classNames(`bi-${name}`, className)}
|
|
14
25
|
style={{ fontSize: size && `${size}rem`, ...style }}
|
|
15
|
-
{
|
|
26
|
+
aria-hidden={ariaHidden ?? (ariaLabel || ariaLabelledBy ? undefined : true)}
|
|
27
|
+
aria-label={ariaLabel}
|
|
28
|
+
aria-labelledby={ariaLabelledBy}
|
|
16
29
|
/>
|
|
17
30
|
)
|
|
18
31
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Spinner } from '../Base/Spinner';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface LoadingProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
opacity?: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { marked } from 'marked';
|
|
3
|
+
import { ComponentPropsWithRef } from 'react';
|
|
4
|
+
|
|
5
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
6
|
+
|
|
7
|
+
export type MarkdownViewProps = Omit<
|
|
8
|
+
ComponentPropsWithRef<'article'>,
|
|
9
|
+
'children' | 'dangerouslySetInnerHTML'
|
|
10
|
+
> & {
|
|
11
|
+
children: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const MarkdownView = polymorphic<MarkdownViewProps>(
|
|
15
|
+
({ as: Root = 'article', className, children, ...props }) => (
|
|
16
|
+
<Root
|
|
17
|
+
{...props}
|
|
18
|
+
className={classNames('markdown-body', className)}
|
|
19
|
+
dangerouslySetInnerHTML={{ __html: marked(children, { async: false }) }}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
MarkdownView.displayName = 'MarkdownView';
|
|
@@ -7,10 +7,10 @@ import { ObservedComponent } from 'mobx-react-helper';
|
|
|
7
7
|
import { ElementType, HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
8
8
|
import { changeMonth, Day, formatDate, splitArray, TimeData } from 'web-utility';
|
|
9
9
|
|
|
10
|
-
import { Badge } from '../Badge';
|
|
11
|
-
import { Button, type ComponentTheme } from '../Button';
|
|
12
|
-
import { text2color } from '../color';
|
|
13
|
-
import { AsProps, PolymorphicClassProps } from '../Polymorphic';
|
|
10
|
+
import { Badge } from '../Base/Badge';
|
|
11
|
+
import { Button, type ComponentTheme } from '../Base/Button';
|
|
12
|
+
import { text2color } from '../Helper/color';
|
|
13
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
14
14
|
import { OverlayBox } from './OverlayBox';
|
|
15
15
|
|
|
16
16
|
export interface DateData {
|
|
@@ -19,10 +19,15 @@ import {
|
|
|
19
19
|
import { createPortal } from 'react-dom';
|
|
20
20
|
import { uniqueID } from 'web-utility';
|
|
21
21
|
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
|
|
22
|
+
import { Popover } from '../Base/Popover';
|
|
23
|
+
import { Tooltip } from '../Base/Tooltip';
|
|
24
|
+
import {
|
|
25
|
+
FloatingOptions,
|
|
26
|
+
FloatingPosition,
|
|
27
|
+
OverlayContainer,
|
|
28
|
+
OverlayPlacement
|
|
29
|
+
} from '../Helper/Overlay';
|
|
30
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
26
31
|
|
|
27
32
|
export type OverlayTrigger = 'click' | 'focus' | 'hover';
|
|
28
33
|
|
|
@@ -6,8 +6,8 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { Component, ElementType } from 'react';
|
|
7
7
|
import { scrollTo, uniqueID } from 'web-utility';
|
|
8
8
|
|
|
9
|
-
import { Nav, NavLink, NavProps } from '../Nav';
|
|
10
|
-
import { AsProps, PolymorphicClassProps } from '../Polymorphic';
|
|
9
|
+
import { Nav, NavLink, NavProps } from '../Base/Nav';
|
|
10
|
+
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
11
11
|
|
|
12
12
|
const HeadingSelector = Array.from({ length: 6 }, (_, index) => `h${index + 1}`).join(',');
|
|
13
13
|
|
|
@@ -4,7 +4,7 @@ import { action, computed, observable } from 'mobx';
|
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import { Component, createRef, ElementType, ReactNode, Ref } from 'react';
|
|
6
6
|
|
|
7
|
-
import { AsProps, PolymorphicClassProps } from '../../Polymorphic';
|
|
7
|
+
import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
9
|
import * as style from './index.module.less';
|
|
10
10
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
1
2
|
import { ElementType } from 'react';
|
|
2
3
|
|
|
3
|
-
import { Nav, NavProps } from '../../Nav';
|
|
4
|
-
import { polymorphic } from '../../Polymorphic';
|
|
4
|
+
import { Nav, NavProps } from '../../Base/Nav';
|
|
5
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
5
6
|
import { ScrollNavScroller } from './Scroller';
|
|
6
7
|
|
|
7
|
-
export type ScrollNavProps = NavProps;
|
|
8
|
+
export type ScrollNavProps = NavProps & { navClassName?: string };
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* A horizontal scrolling navigation bar based on Bootstrap's `nav-scroller` pattern.
|
|
@@ -16,6 +17,7 @@ export const ScrollNav = polymorphic<ScrollNavProps>(
|
|
|
16
17
|
({
|
|
17
18
|
as: RootAs,
|
|
18
19
|
className = '',
|
|
20
|
+
navClassName,
|
|
19
21
|
children,
|
|
20
22
|
ref,
|
|
21
23
|
variant,
|
|
@@ -35,7 +37,7 @@ export const ScrollNav = polymorphic<ScrollNavProps>(
|
|
|
35
37
|
<Nav
|
|
36
38
|
{...(RootAs ? {} : props)}
|
|
37
39
|
ref={RootAs ? undefined : ref}
|
|
38
|
-
className=
|
|
40
|
+
className={classNames('flex-nowrap', navClassName)}
|
|
39
41
|
{...{ variant, vertical, fill, justified, cardHeader, navbar }}
|
|
40
42
|
>
|
|
41
43
|
{children}
|
|
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { Component, createRef, HTMLAttributes, MouseEvent } from 'react';
|
|
7
7
|
import { blobOf } from 'web-utility';
|
|
8
8
|
|
|
9
|
-
import { Image } from '../
|
|
9
|
+
import { Image } from '../Content/Images';
|
|
10
10
|
import { Loading } from './Loading';
|
|
11
11
|
|
|
12
12
|
export async function elementToImage(element: HTMLElement, type?: string, quality?: number) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Button, ButtonProps } from '../Button';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Button, ButtonProps } from '../Base/Button';
|
|
2
|
+
import { Spinner, SpinnerProps } from '../Base/Spinner';
|
|
3
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
4
4
|
|
|
5
5
|
export type SpinnerButtonProps = ButtonProps &
|
|
6
6
|
Pick<SpinnerProps, 'animation'> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Spinner, SpinnerProps } from '../Base/Spinner';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface TableSpinnerProps
|
|
7
7
|
extends
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import { polymorphic } from '../../Polymorphic';
|
|
3
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
4
4
|
import { TextTruncateContent } from './Content';
|
|
5
5
|
|
|
6
6
|
export interface TextTruncateProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TimeHTMLAttributes } from 'react';
|
|
2
2
|
import { formatDate, TimeData } from 'web-utility';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface TimeProps extends Omit<TimeHTMLAttributes<HTMLTimeElement>, 'dateTime'> {
|
|
7
7
|
dateTime: TimeData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { diffTime, TimeData } from 'web-utility';
|
|
3
3
|
|
|
4
|
-
import { polymorphic } from '../Polymorphic';
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
5
|
|
|
6
6
|
export interface TimeDistanceProps extends HTMLAttributes<HTMLTimeElement> {
|
|
7
7
|
date: TimeData;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { TimeData } from 'web-utility';
|
|
3
3
|
|
|
4
|
-
import { Card, CardBody, CardText, CardTitle } from '../../Card';
|
|
5
|
-
import { polymorphic } from '../../Polymorphic';
|
|
4
|
+
import { Card, CardBody, CardText, CardTitle } from '../../Base/Card';
|
|
5
|
+
import { polymorphic } from '../../Helper/Polymorphic';
|
|
6
6
|
import { Nameplate, NameplateProps } from '../Nameplate';
|
|
7
7
|
import { Time } from '../Time';
|
|
8
8
|
import * as styles from './index.module.less';
|