idea-react 3.0.0-beta.5 → 3.0.0-rc.0

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 (104) hide show
  1. package/AGENTS.md +5 -3
  2. package/ReadMe.md +71 -65
  3. package/dist/index.d.mts +894 -929
  4. package/dist/index.d.ts +894 -929
  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 +3 -7
  9. package/source/{Accordion.tsx → Base/Accordion.tsx} +2 -2
  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} +1 -1
  14. package/source/{Button.tsx → Base/Button.tsx} +1 -1
  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 +2 -2
  18. package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
  19. package/source/{Collapse.tsx → Base/Collapse.tsx} +1 -1
  20. package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
  21. package/source/{ListGroup.tsx → Base/ListGroup.tsx} +2 -2
  22. package/source/{Menu.tsx → Base/Menu.tsx} +4 -4
  23. package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
  24. package/source/{Nav.tsx → Base/Nav.tsx} +2 -1
  25. package/source/{NavOverflow → Base/NavOverflow}/index.tsx +2 -2
  26. package/source/{Navbar.tsx → Base/Navbar.tsx} +1 -1
  27. package/source/{Pagination.tsx → Base/Pagination.tsx} +1 -1
  28. package/source/{Placeholder.tsx → Base/Placeholder.tsx} +1 -1
  29. package/source/{Popover.tsx → Base/Popover.tsx} +6 -2
  30. package/source/{Progress → Base/Progress}/index.tsx +1 -1
  31. package/source/{ScrollSpy → Base/ScrollSpy}/index.tsx +1 -1
  32. package/source/{Spinner.tsx → Base/Spinner.tsx} +2 -2
  33. package/source/{Stack.tsx → Base/Stack.tsx} +1 -1
  34. package/source/{Stepper.tsx → Base/Stepper.tsx} +2 -2
  35. package/source/{Tab.tsx → Base/Tab.tsx} +60 -47
  36. package/source/{Toast.tsx → Base/Toast.tsx} +1 -1
  37. package/source/{ToggleButton.tsx → Base/ToggleButton.tsx} +2 -2
  38. package/source/{Toggler.tsx → Base/Toggler.tsx} +1 -1
  39. package/source/{Tooltip.tsx → Base/Tooltip.tsx} +6 -2
  40. package/source/Base/index.ts +31 -0
  41. package/source/Content/Images.tsx +29 -0
  42. package/source/{Table.tsx → Content/Tables.tsx} +2 -2
  43. package/source/Content/index.ts +2 -0
  44. package/source/Extension/ClickBoundary.tsx +1 -1
  45. package/source/Extension/CodeBlock.tsx +1 -1
  46. package/source/Extension/Countdown.tsx +1 -1
  47. package/source/Extension/HorizontalMarquee/index.tsx +1 -1
  48. package/source/Extension/Icon.tsx +1 -1
  49. package/source/Extension/Loading.tsx +2 -2
  50. package/source/Extension/MarkdownView.tsx +23 -0
  51. package/source/Extension/MonthCalendar.tsx +4 -4
  52. package/source/Extension/Nameplate.tsx +1 -1
  53. package/source/Extension/OverlayBox.tsx +9 -4
  54. package/source/Extension/PageNav.tsx +2 -2
  55. package/source/Extension/ScrollNav/Scroller.tsx +1 -1
  56. package/source/Extension/ScrollNav/index.tsx +2 -2
  57. package/source/Extension/ShareBox.tsx +1 -1
  58. package/source/Extension/SpinnerButton.tsx +3 -3
  59. package/source/Extension/TableSpinner.tsx +2 -2
  60. package/source/Extension/TextTruncate/index.tsx +1 -1
  61. package/source/Extension/Time.tsx +1 -1
  62. package/source/Extension/TimeDistance.tsx +1 -1
  63. package/source/Extension/Timeline/index.tsx +2 -2
  64. package/source/Extension/TypeEcho/Content.tsx +1 -1
  65. package/source/Extension/TypeEcho/index.tsx +1 -1
  66. package/source/Extension/UserRank/Address.tsx +1 -1
  67. package/source/Extension/UserRank/index.tsx +5 -5
  68. package/source/Extension/VerticalMarquee/index.tsx +1 -1
  69. package/source/Extension/ZodiacBar.tsx +1 -1
  70. package/source/Extension/index.ts +1 -3
  71. package/source/Form/Adorn.tsx +1 -1
  72. package/source/Form/Checkbox.tsx +2 -2
  73. package/source/Form/{Chips.tsx → Chip.tsx} +4 -11
  74. package/source/Form/ChipInput.tsx +2 -2
  75. package/source/Form/Combobox.tsx +2 -2
  76. package/source/Form/Control.tsx +1 -1
  77. package/source/Form/DatePicker.tsx +2 -2
  78. package/source/Form/Feedback.tsx +1 -1
  79. package/source/Form/FloatingLabel.tsx +1 -1
  80. package/source/Form/InputGroup.tsx +3 -3
  81. package/source/Form/OTP.tsx +1 -1
  82. package/source/Form/Primitives.tsx +8 -1
  83. package/source/Form/Radio.tsx +2 -2
  84. package/source/Form/Range.tsx +2 -2
  85. package/source/Form/Switch.tsx +2 -2
  86. package/source/Form/index.ts +1 -1
  87. package/source/{Overlay.ts → Helper/Overlay.ts} +1 -1
  88. package/source/{color.ts → Helper/color.ts} +1 -1
  89. package/source/Helper/index.ts +4 -0
  90. package/source/{Grid.tsx → Layout/Grid.tsx} +1 -1
  91. package/source/Layout/index.ts +1 -0
  92. package/source/index.ts +4 -38
  93. package/source/Extension/Editor.tsx +0 -78
  94. package/source/Extension/EditorHTML.tsx +0 -20
  95. package/source/Extension/Select.tsx +0 -128
  96. package/source/Image.tsx +0 -19
  97. /package/source/{Carousel → Base/Carousel}/model.ts +0 -0
  98. /package/source/{Carousel → Base/Carousel}/scroll.ts +0 -0
  99. /package/source/{Carousel → Base/Carousel}/style.module.css +0 -0
  100. /package/source/{NativeDialog → Base/NativeDialog}/style.module.css +0 -0
  101. /package/source/{NavOverflow → Base/NavOverflow}/model.ts +0 -0
  102. /package/source/{ScrollSpy → Base/ScrollSpy}/model.ts +0 -0
  103. /package/source/{Polymorphic.ts → Helper/Polymorphic.ts} +0 -0
  104. /package/source/{animate.ts → Helper/animate.ts} +0 -0
package/dist/style.css CHANGED
@@ -1,7 +1,7 @@
1
- .SzYbbW_paused .carousel-indicators .active:after {
1
+ .HR-isq_paused .carousel-indicators .active:after {
2
2
  animation-play-state: paused;
3
3
  }
4
- .Ocw1GG_hiddenBackdrop {
4
+ .rDVV3q_hiddenBackdrop {
5
5
  --bs-dialog-backdrop-bg: transparent;
6
6
  --bs-dialog-backdrop-blur: 0;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-react",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-rc.0",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "author": "shiy2008@gmail.com",
6
6
  "description": "A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.",
@@ -28,20 +28,16 @@
28
28
  "require": "./dist/index.js"
29
29
  },
30
30
  "dependencies": {
31
- "@editorjs/editorjs": "^2.31.7",
32
- "@editorjs/paragraph": "^2.11.7",
33
- "@react-editor-js/core": "^2.1.0",
34
31
  "@shikijs/langs": "^4.6.0",
35
32
  "@shikijs/themes": "^4.6.0",
36
33
  "@swc/helpers": "^0.5.24",
37
34
  "bootstrap": "6.0.0-alpha.1",
38
35
  "classnames": "^2.5.1",
39
- "editorjs-html": "^4.0.5",
40
36
  "html2canvas": "^1.4.1",
41
37
  "iterable-observer": "^1.1.1",
42
38
  "lodash": "^4.18.1",
39
+ "marked": "^18.1.3",
43
40
  "mobx-react-helper": "^0.5.4",
44
- "react-editor-js": "^2.1.0",
45
41
  "react-live": "^5.0.1",
46
42
  "shiki": "^4.6.0",
47
43
  "vanilla-calendar-pro": "3.4.0",
@@ -132,7 +128,7 @@
132
128
  },
133
129
  "scripts": {
134
130
  "prepare": "husky",
135
- "test": "lint-staged && tsc --noEmit -p test/tsconfig.json && node --import ./test/setup.mts --test --test-timeout=10000 \"test/**/*.test.tsx\"",
131
+ "test": "lint-staged --max-arg-length 6000 && tsc --noEmit -p test/tsconfig.json && node --import ./test/setup.mts --test --test-timeout=10000 \"test/**/*.test.tsx\"",
136
132
  "pack-docs": "rimraf docs/ && typedoc source/",
137
133
  "start": "npm run pack-docs && web-server docs/ -p 8080 -o",
138
134
  "build": "npm run pack-docs && tsdown",
@@ -11,9 +11,9 @@ import {
11
11
  MouseEvent
12
12
  } from 'react';
13
13
 
14
+ import { Icon } from '../Extension/Icon';
15
+ import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
14
16
  import { Button, ButtonProps, ComponentTheme } from './Button';
15
- import { Icon } from './Extension/Icon';
16
- import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
17
17
 
18
18
  export interface AccordionProps extends ComponentPropsWithRef<'div'> {
19
19
  theme?: ComponentTheme;
@@ -13,9 +13,9 @@ import {
13
13
  TransitionEvent
14
14
  } from 'react';
15
15
 
16
+ import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
16
17
  import { ComponentTheme } from './Button';
17
18
  import { CloseButton } from './CloseButton';
18
- import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
19
19
 
20
20
  export interface AlertProps extends ComponentPropsWithoutRef<'div'> {
21
21
  theme?: ComponentTheme;
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef, CSSProperties, HTMLAttributes } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import type { ComponentTheme } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  export type AvatarSize = 'xs' | 'sm' | 'lg' | 'xl';
8
8
  export type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import type { ComponentTheme } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  interface BadgeStyleProps {
8
8
  variant?: 'solid' | 'subtle' | 'outline';
@@ -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 const Breadcrumb = polymorphic<ComponentPropsWithRef<'ol'>>(
7
7
  ({ as: Root = 'ol', className, ...props }) => (
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef, MouseEvent } from 'react';
3
3
 
4
- import { polymorphic } from './Polymorphic';
4
+ import { polymorphic } from '../Helper/Polymorphic';
5
5
 
6
6
  export type ComponentTheme =
7
7
  | 'primary'
@@ -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 interface ButtonGroupProps extends ComponentPropsWithRef<'div'> {
7
7
  vertical?: boolean;
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import { ComponentTheme } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  export interface CardProps extends ComponentPropsWithRef<'div'> {
8
8
  row?: boolean;
@@ -16,9 +16,9 @@ import {
16
16
  ReactNode
17
17
  } from 'react';
18
18
 
19
+ import { Icon } from '../../Extension/Icon';
20
+ import { polymorphic, PolymorphicClassProps } from '../../Helper/Polymorphic';
19
21
  import { Button } from '../Button';
20
- import { Icon } from '../Extension/Icon';
21
- import { polymorphic, PolymorphicClassProps } from '../Polymorphic';
22
22
  import { CarouselEnds, CarouselModel } from './model';
23
23
  import { CarouselScroll } from './scroll';
24
24
  import styles from './style.module.css';
@@ -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 interface CloseButtonProps extends ComponentPropsWithRef<'button'> {
7
7
  dismiss?: string;
@@ -12,8 +12,8 @@ import {
12
12
  MouseEvent
13
13
  } from 'react';
14
14
 
15
+ import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
15
16
  import { ButtonProps } from './Button';
16
- import { AsProps, PolymorphicClassProps } from './Polymorphic';
17
17
 
18
18
  const TOGGLE = 'idea-react:collapse-toggle';
19
19
  const CHANGE = 'idea-react:collapse-change';
@@ -5,10 +5,10 @@ import { action, observable } from 'mobx';
5
5
  import { observer } from 'mobx-react';
6
6
  import { Component, ComponentPropsWithRef, createRef, ElementType, ReactNode } from 'react';
7
7
 
8
+ import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
9
+ import { Breakpoint } from '../Layout/Grid';
8
10
  import { CloseButton } from './CloseButton';
9
- import { Breakpoint } from './Grid';
10
11
  import { NativeDialog, NativeDialogProps } from './NativeDialog';
11
- import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
12
12
 
13
13
  export type DrawerPlacement = 'start' | 'end' | 'top' | 'bottom';
14
14
 
@@ -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 type { Breakpoint } from '../Layout/Grid';
4
6
  import type { ComponentTheme } from './Button';
5
- import type { Breakpoint } from './Grid';
6
- import { polymorphic } from './Polymorphic';
7
7
 
8
8
  export type ListGroupHorizontal = boolean | Breakpoint;
9
9
 
@@ -14,11 +14,11 @@ import {
14
14
  ReactNode
15
15
  } from 'react';
16
16
 
17
+ import { Icon, IconProps } from '../Extension/Icon';
18
+ import { FloatingOptions, FloatingPosition } from '../Helper/Overlay';
19
+ import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
20
+ import { Breakpoint } from '../Layout/Grid';
17
21
  import { Button, ButtonProps } from './Button';
18
- import { Icon, IconProps } from './Extension/Icon';
19
- import { Breakpoint } from './Grid';
20
- import { FloatingOptions, FloatingPosition } from './Overlay';
21
- import { AsProps, polymorphic, PolymorphicClassProps } from './Polymorphic';
22
22
 
23
23
  export type MenuItemProps = ButtonProps & { active?: boolean; selected?: boolean };
24
24
 
@@ -12,8 +12,8 @@ import {
12
12
  SyntheticEvent
13
13
  } from 'react';
14
14
 
15
- import { Breakpoint } from '../Grid';
16
- import { AsProps, polymorphic, PolymorphicClassProps } from '../Polymorphic';
15
+ import { AsProps, polymorphic, PolymorphicClassProps } from '../../Helper/Polymorphic';
16
+ import { Breakpoint } from '../../Layout/Grid';
17
17
  import styles from './style.module.css';
18
18
 
19
19
  const transitionMilliseconds = (value: string) =>
@@ -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 interface NavProps extends ComponentPropsWithRef<'nav'> {
7
7
  variant?: 'tabs' | 'pills' | 'underline';
@@ -57,6 +57,7 @@ export const NavLink = polymorphic<NavLinkProps>(
57
57
  <Root
58
58
  {...props}
59
59
  href={disabled ? undefined : href}
60
+ disabled={Root === 'button' ? disabled : undefined}
60
61
  tabIndex={disabled ? -1 : tabIndex}
61
62
  aria-disabled={disabled || undefined}
62
63
  aria-current={active ? 'page' : props['aria-current']}
@@ -17,10 +17,10 @@ import {
17
17
  ReactNode
18
18
  } from 'react';
19
19
 
20
- import { Icon } from '../Extension/Icon';
20
+ import { Icon } from '../../Extension/Icon';
21
+ import { AsProps, PolymorphicClassProps } from '../../Helper/Polymorphic';
21
22
  import { Menu, MenuProps } from '../Menu';
22
23
  import { Nav, NavProps } from '../Nav';
23
- import { AsProps, PolymorphicClassProps } from '../Polymorphic';
24
24
  import { NavOverflowModel } from './model';
25
25
 
26
26
  interface OverflowChildProps {
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import { Button } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  export interface NavbarProps extends ComponentPropsWithRef<'nav'> {
8
8
  theme?: 'light' | 'dark';
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { cloneElement, ComponentPropsWithRef, isValidElement } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import { ComponentTheme } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  export interface PaginationProps extends ComponentPropsWithRef<'ul'> {
8
8
  theme?: ComponentTheme;
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef, CSSProperties } from 'react';
3
3
 
4
+ import { polymorphic } from '../Helper/Polymorphic';
4
5
  import { Button, ButtonProps, ComponentTheme } from './Button';
5
- import { polymorphic } from './Polymorphic';
6
6
 
7
7
  export interface PlaceholderProps extends ComponentPropsWithRef<'span'> {
8
8
  size?: 'xs' | 'sm' | 'lg';
@@ -1,8 +1,12 @@
1
1
  import classNames from 'classnames';
2
2
  import { ReactNode } from 'react';
3
3
 
4
- import { OVERLAY_ARROW_POSITIONS, OVERLAY_DIRECTIONS, OverlayTriggerProps } from './Overlay';
5
- import { polymorphic } from './Polymorphic';
4
+ import {
5
+ OVERLAY_ARROW_POSITIONS,
6
+ OVERLAY_DIRECTIONS,
7
+ OverlayTriggerProps
8
+ } from '../Helper/Overlay';
9
+ import { polymorphic } from '../Helper/Polymorphic';
6
10
 
7
11
  export interface PopoverProps extends Omit<OverlayTriggerProps, 'title'> {
8
12
  title?: ReactNode;
@@ -1,8 +1,8 @@
1
1
  import classNames from 'classnames';
2
2
  import { ComponentPropsWithRef, CSSProperties } from 'react';
3
3
 
4
+ import { polymorphic } from '../../Helper/Polymorphic';
4
5
  import { ComponentTheme } from '../Button';
5
- import { polymorphic } from '../Polymorphic';
6
6
 
7
7
  export interface ProgressProps extends ComponentPropsWithRef<'div'> {
8
8
  value: number;
@@ -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,31 @@
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 './ListGroup';
14
+ export * from './Menu';
15
+ export * from './NativeDialog';
16
+ export * from './Nav';
17
+ export * from './Navbar';
18
+ export * from './NavOverflow';
19
+ export * from './Pagination';
20
+ export * from './Placeholder';
21
+ export * from './Popover';
22
+ export * from './Progress';
23
+ export * from './ScrollSpy';
24
+ export * from './Spinner';
25
+ export * from './Stack';
26
+ export * from './Stepper';
27
+ export * from './Tab';
28
+ export * from './Toast';
29
+ export * from './ToggleButton';
30
+ export * from './Toggler';
31
+ export * from './Tooltip';
@@ -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';