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.
Files changed (108) hide show
  1. package/AGENTS.md +15 -16
  2. package/ReadMe.md +71 -65
  3. package/dist/index.d.mts +966 -965
  4. package/dist/index.d.ts +966 -965
  5. package/dist/index.js +16 -16
  6. package/dist/index.mjs +15 -15
  7. package/dist/style.css +2 -2
  8. package/package.json +4 -14
  9. package/source/{Accordion.tsx → Base/Accordion.tsx} +3 -3
  10. package/source/{Alert.tsx → Base/Alert.tsx} +1 -1
  11. package/source/{Avatar.tsx → Base/Avatar.tsx} +1 -1
  12. package/source/{Badge.tsx → Base/Badge.tsx} +1 -1
  13. package/source/{Breadcrumb.tsx → Base/Breadcrumb.tsx} +16 -4
  14. package/source/{Button.tsx → Base/Button.tsx} +6 -2
  15. package/source/{ButtonGroup.tsx → Base/ButtonGroup.tsx} +1 -1
  16. package/source/{Card.tsx → Base/Card.tsx} +1 -1
  17. package/source/{Carousel → Base/Carousel}/index.tsx +4 -14
  18. package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
  19. package/source/{Collapse.tsx → Base/Collapse.tsx} +18 -3
  20. package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
  21. package/source/Base/Fade.tsx +15 -0
  22. package/source/{ListGroup.tsx → Base/ListGroup.tsx} +14 -4
  23. package/source/{Menu.tsx → Base/Menu.tsx} +5 -11
  24. package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
  25. package/source/{Nav.tsx → Base/Nav.tsx} +5 -2
  26. package/source/{NavOverflow → Base/NavOverflow}/index.tsx +3 -3
  27. package/source/{Navbar.tsx → Base/Navbar.tsx} +20 -14
  28. package/source/{Pagination.tsx → Base/Pagination.tsx} +1 -1
  29. package/source/{Placeholder.tsx → Base/Placeholder.tsx} +1 -1
  30. package/source/{Popover.tsx → Base/Popover.tsx} +6 -2
  31. package/source/{Progress → Base/Progress}/index.tsx +1 -1
  32. package/source/{ScrollSpy → Base/ScrollSpy}/index.tsx +1 -1
  33. package/source/{Spinner.tsx → Base/Spinner.tsx} +2 -2
  34. package/source/{Stack.tsx → Base/Stack.tsx} +1 -1
  35. package/source/{Stepper.tsx → Base/Stepper.tsx} +2 -2
  36. package/source/{Tab.tsx → Base/Tab.tsx} +60 -47
  37. package/source/{Toast.tsx → Base/Toast.tsx} +1 -1
  38. package/source/{ToggleButton.tsx → Base/ToggleButton.tsx} +2 -2
  39. package/source/{Toggler.tsx → Base/Toggler.tsx} +1 -1
  40. package/source/{Tooltip.tsx → Base/Tooltip.tsx} +6 -2
  41. package/source/Base/index.ts +32 -0
  42. package/source/Content/Figure.tsx +26 -0
  43. package/source/Content/Images.tsx +29 -0
  44. package/source/{Table.tsx → Content/Tables.tsx} +2 -2
  45. package/source/Content/index.ts +3 -0
  46. package/source/Extension/ClickBoundary.tsx +1 -1
  47. package/source/Extension/CodeBlock.tsx +1 -1
  48. package/source/Extension/Countdown.tsx +1 -1
  49. package/source/Extension/HorizontalMarquee/index.tsx +1 -1
  50. package/source/Extension/Icon.tsx +16 -3
  51. package/source/Extension/Loading.tsx +2 -2
  52. package/source/Extension/MarkdownView.tsx +23 -0
  53. package/source/Extension/MonthCalendar.tsx +4 -4
  54. package/source/Extension/Nameplate.tsx +1 -1
  55. package/source/Extension/OverlayBox.tsx +9 -4
  56. package/source/Extension/PageNav.tsx +2 -2
  57. package/source/Extension/ScrollNav/Scroller.tsx +1 -1
  58. package/source/Extension/ScrollNav/index.tsx +6 -4
  59. package/source/Extension/ShareBox.tsx +1 -1
  60. package/source/Extension/SpinnerButton.tsx +3 -3
  61. package/source/Extension/TableSpinner.tsx +2 -2
  62. package/source/Extension/TextTruncate/index.tsx +1 -1
  63. package/source/Extension/Time.tsx +1 -1
  64. package/source/Extension/TimeDistance.tsx +1 -1
  65. package/source/Extension/Timeline/index.tsx +2 -2
  66. package/source/Extension/TypeEcho/Content.tsx +1 -1
  67. package/source/Extension/TypeEcho/index.tsx +1 -1
  68. package/source/Extension/UserRank/Address.tsx +1 -1
  69. package/source/Extension/UserRank/index.tsx +11 -10
  70. package/source/Extension/VerticalMarquee/index.tsx +1 -1
  71. package/source/Extension/ZodiacBar.tsx +1 -1
  72. package/source/Extension/index.ts +1 -3
  73. package/source/Form/Adorn.tsx +1 -1
  74. package/source/Form/Checkbox.tsx +2 -2
  75. package/source/Form/{Chips.tsx → Chip.tsx} +5 -12
  76. package/source/Form/ChipInput.tsx +3 -3
  77. package/source/Form/Combobox.tsx +5 -9
  78. package/source/Form/Control.tsx +1 -1
  79. package/source/Form/DatePicker.tsx +3 -3
  80. package/source/Form/Feedback.tsx +1 -1
  81. package/source/Form/FloatingLabel.tsx +1 -1
  82. package/source/Form/InputGroup.tsx +3 -3
  83. package/source/Form/OTP.tsx +1 -1
  84. package/source/Form/Primitives.tsx +8 -9
  85. package/source/Form/Radio.tsx +15 -5
  86. package/source/Form/Range.tsx +2 -2
  87. package/source/Form/Switch.tsx +2 -2
  88. package/source/Form/index.ts +1 -1
  89. package/source/{Overlay.ts → Helper/Overlay.ts} +1 -1
  90. package/source/{color.ts → Helper/color.ts} +1 -1
  91. package/source/Helper/index.ts +4 -0
  92. package/source/{Grid.tsx → Layout/Grid.tsx} +36 -26
  93. package/source/Layout/Ratio.tsx +29 -0
  94. package/source/Layout/index.ts +2 -0
  95. package/source/index.ts +4 -38
  96. package/source/types.d.ts +4 -0
  97. package/source/Extension/Editor.tsx +0 -78
  98. package/source/Extension/EditorHTML.tsx +0 -20
  99. package/source/Extension/Select.tsx +0 -128
  100. package/source/Image.tsx +0 -19
  101. /package/source/{Carousel → Base/Carousel}/model.ts +0 -0
  102. /package/source/{Carousel → Base/Carousel}/scroll.ts +0 -0
  103. /package/source/{Carousel → Base/Carousel}/style.module.css +0 -0
  104. /package/source/{NativeDialog → Base/NativeDialog}/style.module.css +0 -0
  105. /package/source/{NavOverflow → Base/NavOverflow}/model.ts +0 -0
  106. /package/source/{ScrollSpy → Base/ScrollSpy}/model.ts +0 -0
  107. /package/source/{Polymorphic.ts → Helper/Polymorphic.ts} +0 -0
  108. /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 '../Polymorphic';
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,7 +1,7 @@
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 StackDirection = 'horizontal' | 'vertical';
7
7
 
@@ -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 './Polymorphic';
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 extends Omit<ComponentPropsWithRef<'div'>, 'onChange'> {
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.componentProps.orientation !== 'vertical';
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 { orientation = 'horizontal', variant = 'tabs' } = this.componentProps;
163
+ const { variant = 'tabs', fill, justified, cardHeader, navbar } = this.componentProps;
164
+ const { orientation } = this;
152
165
  const listGroup = variant === 'list-group';
153
-
154
- return (
155
- <div
156
- className={classNames(
157
- listGroup ? 'list-group' : 'nav',
158
- !listGroup && `nav-${variant}`,
159
- orientation === 'vertical' &&
160
- (listGroup
161
- ? 'flex-column'
162
- : variant === 'pills'
163
- ? 'nav-pills-vertical'
164
- : 'flex-column')
165
- )}
166
- role="tablist"
167
- aria-label={this.componentProps['aria-label'] ?? 'Tabs'}
168
- aria-orientation={orientation}
169
- >
170
- {this.tabs.map(({ props: tab }, index) => {
171
- const active = tab.eventKey === this.activeKey;
172
-
173
- return (
174
- <button
175
- key={tab.eventKey}
176
- id={this.tabId(tab.eventKey)}
177
- type="button"
178
- role="tab"
179
- data-tab-index={index}
180
- aria-controls={this.panelId(tab.eventKey)}
181
- aria-selected={active}
182
- aria-disabled={tab.disabled || undefined}
183
- tabIndex={active ? 0 : -1}
184
- disabled={tab.disabled}
185
- className={classNames(
186
- listGroup ? 'list-group-item list-group-item-action' : 'nav-link',
187
- { active },
188
- tab.disabled && 'disabled'
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 { OVERLAY_ARROW_POSITIONS, OVERLAY_DIRECTIONS, OverlayTriggerProps } from './Overlay';
4
- import { polymorphic } from './Polymorphic';
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 type { Breakpoint } from './Grid';
5
- import { polymorphic } from './Polymorphic';
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;
@@ -0,0 +1,3 @@
1
+ export * from './Figure';
2
+ export * from './Images';
3
+ export * from './Tables';
@@ -9,7 +9,7 @@ import {
9
9
  PureComponent
10
10
  } from 'react';
11
11
 
12
- import { AsProps, PolymorphicClassProps } from '../Polymorphic';
12
+ import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
13
13
 
14
14
  export type ClickBoundaryProps = PropsWithChildren<
15
15
  {
@@ -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
- ({ as: Root = 'span', className, style, name, size, ...props }) => (
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
- {...props}
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 { polymorphic } from '../Polymorphic';
4
- import { Spinner } from '../Spinner';
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 {
@@ -1,6 +1,6 @@
1
1
  import { FC, PropsWithoutRef } from 'react';
2
2
 
3
- import { Avatar } from '../Avatar';
3
+ import { Avatar } from '../Base/Avatar';
4
4
 
5
5
  export type NameplateProps = PropsWithoutRef<{ avatar: string; name: string }>;
6
6
 
@@ -19,10 +19,15 @@ import {
19
19
  import { createPortal } from 'react-dom';
20
20
  import { uniqueID } from 'web-utility';
21
21
 
22
- import { FloatingOptions, FloatingPosition, OverlayContainer, OverlayPlacement } from '../Overlay';
23
- import { AsProps, PolymorphicClassProps } from '../Polymorphic';
24
- import { Popover } from '../Popover';
25
- import { Tooltip } from '../Tooltip';
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="flex-nowrap"
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 '../Image';
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 { polymorphic } from '../Polymorphic';
3
- import { Spinner, SpinnerProps } from '../Spinner';
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 { polymorphic } from '../Polymorphic';
4
- import { Spinner, SpinnerProps } from '../Spinner';
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';