idea-react 3.0.0-beta.4 → 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 +6 -3
  2. package/ReadMe.md +71 -65
  3. package/dist/index.d.mts +902 -930
  4. package/dist/index.d.ts +902 -930
  5. package/dist/index.js +16 -16
  6. package/dist/index.mjs +15 -15
  7. package/dist/style.css +4 -1
  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 +120 -59
  18. package/source/{Carousel → Base/Carousel}/model.ts +12 -8
  19. package/source/Base/Carousel/style.module.css +3 -0
  20. package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
  21. package/source/{Collapse.tsx → Base/Collapse.tsx} +1 -1
  22. package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
  23. package/source/{ListGroup.tsx → Base/ListGroup.tsx} +2 -2
  24. package/source/{Menu.tsx → Base/Menu.tsx} +4 -4
  25. package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
  26. package/source/{Nav.tsx → Base/Nav.tsx} +2 -1
  27. package/source/{NavOverflow → Base/NavOverflow}/index.tsx +2 -2
  28. package/source/{Navbar.tsx → Base/Navbar.tsx} +1 -1
  29. package/source/{Pagination.tsx → Base/Pagination.tsx} +1 -1
  30. package/source/{Placeholder.tsx → Base/Placeholder.tsx} +1 -1
  31. package/source/{Popover.tsx → Base/Popover.tsx} +6 -2
  32. package/source/{Progress → Base/Progress}/index.tsx +1 -1
  33. package/source/{ScrollSpy → Base/ScrollSpy}/index.tsx +1 -1
  34. package/source/{Spinner.tsx → Base/Spinner.tsx} +2 -2
  35. package/source/{Stack.tsx → Base/Stack.tsx} +1 -1
  36. package/source/{Stepper.tsx → Base/Stepper.tsx} +2 -2
  37. package/source/{Tab.tsx → Base/Tab.tsx} +60 -47
  38. package/source/{Toast.tsx → Base/Toast.tsx} +1 -1
  39. package/source/{ToggleButton.tsx → Base/ToggleButton.tsx} +2 -2
  40. package/source/{Toggler.tsx → Base/Toggler.tsx} +1 -1
  41. package/source/{Tooltip.tsx → Base/Tooltip.tsx} +6 -2
  42. package/source/Base/index.ts +31 -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 +2 -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 +1 -1
  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 +2 -2
  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 +5 -5
  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} +4 -11
  76. package/source/Form/ChipInput.tsx +2 -2
  77. package/source/Form/Combobox.tsx +2 -2
  78. package/source/Form/Control.tsx +1 -1
  79. package/source/Form/DatePicker.tsx +2 -2
  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 -1
  85. package/source/Form/Radio.tsx +2 -2
  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} +1 -1
  93. package/source/Layout/index.ts +1 -0
  94. package/source/index.ts +4 -38
  95. package/source/Extension/Editor.tsx +0 -78
  96. package/source/Extension/EditorHTML.tsx +0 -20
  97. package/source/Extension/Select.tsx +0 -128
  98. package/source/Image.tsx +0 -19
  99. /package/source/{Carousel → Base/Carousel}/scroll.ts +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,4 +1,7 @@
1
- .Ocw1GG_hiddenBackdrop {
1
+ .HR-isq_paused .carousel-indicators .active:after {
2
+ animation-play-state: paused;
3
+ }
4
+ .rDVV3q_hiddenBackdrop {
2
5
  --bs-dialog-backdrop-bg: transparent;
3
6
  --bs-dialog-backdrop-blur: 0;
4
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-react",
3
- "version": "3.0.0-beta.4",
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 && 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,10 +16,12 @@ import {
16
16
  ReactNode
17
17
  } from 'react';
18
18
 
19
- import { Icon } from '../Extension/Icon';
20
- import { polymorphic, PolymorphicClassProps } from '../Polymorphic';
19
+ import { Icon } from '../../Extension/Icon';
20
+ import { polymorphic, PolymorphicClassProps } from '../../Helper/Polymorphic';
21
+ import { Button } from '../Button';
21
22
  import { CarouselEnds, CarouselModel } from './model';
22
23
  import { CarouselScroll } from './scroll';
24
+ import styles from './style.module.css';
23
25
 
24
26
  export interface CarouselSlideProps extends ComponentPropsWithRef<'div'> {
25
27
  interval?: number;
@@ -41,14 +43,19 @@ export const CarouselSlide = polymorphic<CarouselSlideProps>(
41
43
  CarouselSlide.displayName = 'CarouselSlide';
42
44
 
43
45
  export interface CarouselProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange'> {
46
+ auto?: boolean;
44
47
  autoplay?: boolean;
45
48
  center?: boolean;
46
49
  controls?: boolean;
47
50
  controlsPlacement?: 'overlay' | 'top' | 'bottom';
51
+ controlsClassName?: string;
52
+ controlsStart?: ReactNode;
48
53
  dark?: boolean;
49
54
  ends?: CarouselEnds;
50
55
  fade?: boolean;
51
56
  indicators?: boolean;
57
+ indicatorPlacement?: 'start' | 'end' | 'between';
58
+ innerClassName?: string;
52
59
  interval?: number;
53
60
  items?: number;
54
61
  itemsGap?: string | number;
@@ -84,6 +91,18 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
84
91
 
85
92
  componentDidUpdate() {
86
93
  this.updateStore();
94
+
95
+ const focused = document.activeElement;
96
+ if (
97
+ focused instanceof HTMLButtonElement &&
98
+ focused.disabled &&
99
+ this.root.current?.contains(focused)
100
+ ) {
101
+ const action = focused.dataset.carouselAction === 'next' ? 'previous' : 'next';
102
+ this.root.current
103
+ .querySelector<HTMLButtonElement>(`[data-carousel-action="${action}"]`)
104
+ ?.focus();
105
+ }
87
106
  }
88
107
 
89
108
  componentWillUnmount() {
@@ -234,44 +253,33 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
234
253
  );
235
254
  };
236
255
 
237
- renderControls = () => {
256
+ renderControl = (direction: 'previous' | 'next') => {
238
257
  const { controls = true, ends = 'loop' } = this.props;
239
258
  if (!controls) return null;
240
259
 
241
- const atStart = this.store.activeIndex === 0;
242
- const atEnd = this.store.activeIndex === this.getSlides().length - 1;
243
- const buttonClass =
244
- this.props.controlsPlacement === 'overlay'
245
- ? 'carousel-control-prev'
246
- : 'btn btn-subtle theme-secondary';
260
+ const previous = direction === 'previous';
261
+ const atEnd = this.store.activeIndex === (previous ? 0 : this.getSlides().length - 1);
262
+ const overlay = (this.props.controlsPlacement ?? 'overlay') === 'overlay';
263
+ const label = previous ? 'Previous' : 'Next';
247
264
 
248
265
  return (
249
- <>
250
- <button
251
- type="button"
252
- className={buttonClass}
253
- data-carousel-action="previous"
254
- aria-label="Previous"
255
- disabled={ends === 'stop' && atStart}
256
- >
257
- <Icon name="chevron-left" aria-hidden="true" />
258
- <span className="visually-hidden">Previous</span>
259
- </button>
260
- <button
261
- type="button"
262
- className={
263
- this.props.controlsPlacement === 'overlay'
264
- ? 'carousel-control-next'
265
- : 'btn btn-subtle theme-secondary'
266
- }
267
- data-carousel-action="next"
268
- aria-label="Next"
269
- disabled={ends === 'stop' && atEnd}
270
- >
271
- <Icon name="chevron-right" aria-hidden="true" />
272
- <span className="visually-hidden">Next</span>
273
- </button>
274
- </>
266
+ <Button
267
+ type="button"
268
+ variant={overlay ? 'subtle' : undefined}
269
+ theme={overlay ? 'secondary' : undefined}
270
+ size="sm"
271
+ data-carousel-action={direction}
272
+ aria-label={label}
273
+ disabled={ends === 'stop' && atEnd}
274
+ icon
275
+ >
276
+ <Icon
277
+ name={previous ? 'chevron-left' : 'chevron-right'}
278
+ size={1}
279
+ aria-hidden="true"
280
+ />
281
+ <span className="visually-hidden">{label}</span>
282
+ </Button>
275
283
  );
276
284
  };
277
285
 
@@ -282,6 +290,7 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
282
290
  <button
283
291
  key={index}
284
292
  type="button"
293
+ data-bs-target={this.props.id ? `#${this.props.id}` : ''}
285
294
  data-carousel-action="slide"
286
295
  data-index={index}
287
296
  aria-label={`Slide ${index + 1}`}
@@ -294,15 +303,65 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
294
303
 
295
304
  renderPlayPause = () =>
296
305
  (this.props.playPause || this.props.autoplay) && (
297
- <button
306
+ <Button
298
307
  type="button"
299
- className="btn-icon btn-sm carousel-control-play-pause"
308
+ className={classNames('carousel-control-play-pause', {
309
+ paused: !this.store.playing
310
+ })}
311
+ size="sm"
300
312
  data-carousel-action="toggle"
301
313
  aria-label={this.store.playing ? 'Pause' : 'Play'}
314
+ icon
315
+ >
316
+ <Icon
317
+ name={this.store.playing ? 'pause-fill' : 'play-fill'}
318
+ size={1}
319
+ aria-hidden="true"
320
+ />
321
+ </Button>
322
+ );
323
+
324
+ renderControls = () => {
325
+ const {
326
+ controls = true,
327
+ controlsPlacement = 'overlay',
328
+ controlsClassName = 'd-flex justify-content-between align-items-center',
329
+ controlsStart,
330
+ indicators,
331
+ indicatorPlacement = 'start',
332
+ autoplay,
333
+ playPause
334
+ } = this.props;
335
+ if (!controls && !indicators && !autoplay && !playPause && !controlsStart) return null;
336
+
337
+ const split = indicatorPlacement === 'between';
338
+ const previous = this.renderControl('previous');
339
+ const next = this.renderControl('next');
340
+ const buttons = (
341
+ <>
342
+ {this.renderPlayPause()}
343
+ {previous}
344
+ {next}
345
+ </>
346
+ );
347
+
348
+ return (
349
+ <div
350
+ className={
351
+ controlsPlacement === 'overlay'
352
+ ? 'carousel-overlay-controls'
353
+ : controlsClassName
354
+ }
302
355
  >
303
- <Icon name={this.store.playing ? 'pause-fill' : 'play-fill'} aria-hidden="true" />
304
- </button>
356
+ {controlsStart}
357
+ {indicatorPlacement === 'start' && this.renderIndicators()}
358
+ {split ? previous : <div className="d-inline-flex gap-1">{buttons}</div>}
359
+ {indicatorPlacement !== 'start' && this.renderIndicators()}
360
+ {split && this.renderPlayPause()}
361
+ {split && next}
362
+ </div>
305
363
  );
364
+ };
306
365
 
307
366
  render() {
308
367
  const Root: ElementType = this.props.as ?? 'div';
@@ -310,17 +369,21 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
310
369
  const slides = this.getSlides();
311
370
  const {
312
371
  as: _as,
372
+ auto,
313
373
  autoplay: _autoplay,
314
374
  center,
315
375
  children: _children,
316
376
  className,
317
377
  controls: _controls,
318
378
  controlsPlacement = 'overlay',
379
+ controlsClassName: _controlsClassName,
380
+ controlsStart: _controlsStart,
319
381
  dark,
320
382
  ends: _ends,
321
- fade: _fade,
322
383
  fade,
323
384
  indicators: _indicators,
385
+ indicatorPlacement: _indicatorPlacement,
386
+ innerClassName,
324
387
  interval: _interval,
325
388
  items,
326
389
  itemsGap,
@@ -338,17 +401,11 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
338
401
  ...style,
339
402
  ...(items && { '--bs-carousel-items': items }),
340
403
  ...(itemsGap !== undefined && { '--bs-carousel-items-gap': itemsGap }),
341
- ...(itemsPeek !== undefined && { '--bs-carousel-items-peek': itemsPeek })
404
+ ...(itemsPeek !== undefined && { '--bs-carousel-items-peek': itemsPeek }),
405
+ ...(this.store.playing && {
406
+ '--bs-carousel-interval': `${this.getSlideInterval(this.store.activeIndex)}ms`
407
+ })
342
408
  } as CSSProperties;
343
- const outerControls = (
344
- <div className="d-flex justify-content-between align-items-center gap-2">
345
- {this.renderIndicators()}
346
- <div className="d-flex align-items-center gap-2">
347
- {this.renderPlayPause()}
348
- {this.renderControls()}
349
- </div>
350
- </div>
351
- );
352
409
 
353
410
  return (
354
411
  <Root
@@ -356,13 +413,22 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
356
413
  ref={this.root}
357
414
  className={classNames(
358
415
  'carousel',
359
- { 'carousel-fade': fade, 'carousel-dark': dark, 'carousel-center': center },
416
+ {
417
+ 'carousel-overlay': placement,
418
+ 'carousel-auto': auto,
419
+ 'carousel-fade': fade,
420
+ 'carousel-dark': dark,
421
+ 'carousel-center': center,
422
+ 'carousel-playing': this.store.playing,
423
+ [styles.paused]: this.store.playing && !this.store.cycling
424
+ },
360
425
  className
361
426
  )}
362
427
  style={styleWithItems}
363
428
  role="region"
364
429
  aria-label={this.props['aria-label'] ?? 'Carousel'}
365
430
  aria-roledescription="carousel"
431
+ {...(dark && { 'data-bs-theme': 'dark' })}
366
432
  onClick={this.handleClick}
367
433
  onKeyDown={this.handleKeyDown}
368
434
  onMouseEnter={this.handleMouseEnter}
@@ -370,22 +436,17 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
370
436
  onFocusCapture={this.handleFocusCapture}
371
437
  onBlurCapture={this.handleBlurCapture}
372
438
  >
373
- {controlsPlacement === 'top' && outerControls}
439
+ {controlsPlacement === 'top' && this.renderControls()}
374
440
  <div
375
441
  ref={this.track}
376
- className="carousel-inner"
442
+ className={classNames('carousel-inner', innerClassName)}
377
443
  tabIndex={0}
378
444
  aria-label={this.props['aria-label'] ?? 'Carousel slides'}
379
445
  onScroll={this.handleScroll}
380
446
  >
381
447
  {slides.map(this.renderSlide)}
382
448
  </div>
383
- {placement && this.renderControls()}
384
- {controlsPlacement === 'bottom' && outerControls}
385
- {placement &&
386
- (this.props.playPause || this.props.autoplay) &&
387
- this.renderPlayPause()}
388
- {placement && this.renderIndicators()}
449
+ {controlsPlacement !== 'top' && this.renderControls()}
389
450
  </Root>
390
451
  );
391
452
  }
@@ -1,4 +1,4 @@
1
- import { action, observable } from 'mobx';
1
+ import { action, computed, observable } from 'mobx';
2
2
 
3
3
  export type CarouselEnds = 'loop' | 'wrap' | 'stop';
4
4
 
@@ -9,9 +9,13 @@ export class CarouselModel {
9
9
 
10
10
  private timer?: ReturnType<typeof setTimeout>;
11
11
 
12
- private hovering = false;
12
+ @observable private accessor hovering = false;
13
+ @observable private accessor visible = true;
13
14
 
14
- private visible = true;
15
+ @computed
16
+ get cycling() {
17
+ return this.playing && !this.hovering && this.visible;
18
+ }
15
19
 
16
20
  onChange?: (index: number) => unknown;
17
21
 
@@ -78,15 +82,15 @@ export class CarouselModel {
78
82
  @action
79
83
  toggle = () => (this.playing ? this.pause() : this.play());
80
84
 
81
- setHovering = (hovering: boolean) => {
85
+ setHovering = action((hovering: boolean) => {
82
86
  this.hovering = hovering;
83
87
  this.schedule();
84
- };
88
+ });
85
89
 
86
- setVisible = (visible: boolean) => {
90
+ setVisible = action((visible: boolean) => {
87
91
  this.visible = visible;
88
92
  this.schedule();
89
- };
93
+ });
90
94
 
91
95
  update = (count: number, ends: CarouselEnds, interval: (index: number) => number) => {
92
96
  this.count = count;
@@ -101,7 +105,7 @@ export class CarouselModel {
101
105
 
102
106
  private schedule = () => {
103
107
  this.clearTimer();
104
- if (!this.playing || this.hovering || !this.visible || this.count < 2) return;
108
+ if (!this.cycling || this.count < 2) return;
105
109
 
106
110
  this.timer = setTimeout(this.next, Math.max(0, this.interval(this.activeIndex)));
107
111
  };
@@ -0,0 +1,3 @@
1
+ .paused :global(.carousel-indicators .active)::after {
2
+ animation-play-state: paused;
3
+ }
@@ -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;