idea-react 2.3.5 → 3.0.0-alpha.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 (64) hide show
  1. package/AGENTS.md +253 -0
  2. package/ReadMe.md +81 -67
  3. package/dist/index.d.mts +419 -203
  4. package/dist/index.d.ts +419 -203
  5. package/dist/index.js +18 -18
  6. package/dist/index.mjs +17 -17
  7. package/dist/style.css +5 -1
  8. package/package.json +36 -35
  9. package/source/Avatar.tsx +65 -12
  10. package/source/Badge.tsx +34 -0
  11. package/source/Button.tsx +73 -0
  12. package/source/ButtonGroup.tsx +28 -0
  13. package/source/Card.tsx +26 -0
  14. package/source/ClickBoundary.tsx +6 -5
  15. package/source/CloseButton.tsx +23 -0
  16. package/source/CodeBlock.tsx +5 -3
  17. package/source/Countdown.tsx +2 -0
  18. package/source/Drawer.tsx +62 -0
  19. package/source/Editor.tsx +5 -8
  20. package/source/Grid.tsx +92 -0
  21. package/source/HorizontalMarquee/index.tsx +4 -10
  22. package/source/Image.tsx +15 -0
  23. package/source/ListGroup.tsx +103 -0
  24. package/source/LiveTSX.tsx +1 -1
  25. package/source/Loading.tsx +4 -3
  26. package/source/Menu.tsx +282 -0
  27. package/source/MonthCalendar.tsx +60 -22
  28. package/source/NativeDialog/index.tsx +139 -0
  29. package/source/NativeDialog/style.module.css +4 -0
  30. package/source/Nav.tsx +52 -0
  31. package/source/Navbar.tsx +64 -0
  32. package/source/Overlay.ts +22 -0
  33. package/source/OverlayBox.tsx +200 -32
  34. package/source/PageNav.tsx +56 -32
  35. package/source/Popover.tsx +36 -0
  36. package/source/ScrollNav/Scroller.tsx +107 -0
  37. package/source/ScrollNav/index.tsx +12 -99
  38. package/source/Select.tsx +66 -55
  39. package/source/ShareBox.tsx +5 -11
  40. package/source/Spinner.tsx +30 -0
  41. package/source/SpinnerButton.tsx +8 -10
  42. package/source/Table.tsx +59 -0
  43. package/source/TableSpinner.tsx +7 -5
  44. package/source/{TextTruncate.tsx → TextTruncate/Content.tsx} +24 -20
  45. package/source/TextTruncate/index.tsx +25 -0
  46. package/source/Time.tsx +7 -33
  47. package/source/TimeDistance.tsx +1 -1
  48. package/source/Timeline/index.tsx +7 -7
  49. package/source/Toast.tsx +114 -29
  50. package/source/ToggleButton.tsx +47 -0
  51. package/source/Tooltip.tsx +32 -0
  52. package/source/TypeEcho/Content.tsx +58 -0
  53. package/source/TypeEcho/index.tsx +14 -0
  54. package/source/UserRank/index.module.less +9 -20
  55. package/source/UserRank/index.tsx +35 -32
  56. package/source/VerticalMarquee/index.module.less +0 -1
  57. package/source/VerticalMarquee/index.tsx +3 -5
  58. package/source/ZodiacBar.tsx +1 -1
  59. package/source/animate.ts +4 -2
  60. package/source/color.ts +3 -5
  61. package/source/index.ts +18 -0
  62. package/source/types.d.ts +4 -0
  63. package/tsconfig.json +6 -2
  64. package/source/TypeEcho.tsx +0 -49
@@ -0,0 +1,73 @@
1
+ 'use client';
2
+
3
+ import classNames from 'classnames';
4
+ import { ComponentPropsWithRef, FC, MouseEvent } from 'react';
5
+
6
+ export type ComponentTheme =
7
+ | 'primary'
8
+ | 'accent'
9
+ | 'secondary'
10
+ | 'success'
11
+ | 'danger'
12
+ | 'warning'
13
+ | 'info'
14
+ | 'dark'
15
+ | 'light'
16
+ | 'inverse';
17
+
18
+ interface ButtonStyleProps {
19
+ variant?: 'solid' | 'outline' | 'subtle' | 'text' | 'link';
20
+ theme?: ComponentTheme;
21
+ size?: 'xs' | 'sm' | 'lg';
22
+ icon?: boolean;
23
+ styled?: boolean;
24
+ disabled?: boolean;
25
+ }
26
+
27
+ type ButtonLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
28
+ type ButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
29
+ type ButtonElementAttributes = ButtonAttributes | ButtonLinkAttributes;
30
+ export type ButtonProps = ButtonStyleProps & ButtonElementAttributes;
31
+
32
+ const isButtonLink = (props: ButtonElementAttributes): props is ButtonLinkAttributes =>
33
+ typeof props.href === 'string';
34
+
35
+ const preventNavigation = (event: MouseEvent<HTMLAnchorElement>) => event.preventDefault();
36
+
37
+ export const Button: FC<ButtonProps> = ({
38
+ variant,
39
+ theme,
40
+ size,
41
+ icon,
42
+ styled,
43
+ disabled,
44
+ className,
45
+ ...props
46
+ }) => {
47
+ const attributes: ButtonElementAttributes = props;
48
+ const classes = classNames(
49
+ variant ? `btn-${variant}` : icon ? undefined : 'btn',
50
+ theme && `theme-${theme}`,
51
+ size && `btn-${size}`,
52
+ { 'btn-icon': icon, 'btn-styled': styled, disabled },
53
+ className
54
+ );
55
+
56
+ return isButtonLink(attributes) ? (
57
+ <a
58
+ {...attributes}
59
+ className={classes}
60
+ href={disabled ? undefined : attributes.href}
61
+ aria-disabled={disabled || undefined}
62
+ tabIndex={disabled ? -1 : attributes.tabIndex}
63
+ onClick={disabled ? preventNavigation : attributes.onClick}
64
+ />
65
+ ) : (
66
+ <button
67
+ {...attributes}
68
+ type={attributes.type || 'button'}
69
+ className={classes}
70
+ disabled={disabled}
71
+ />
72
+ );
73
+ };
@@ -0,0 +1,28 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ export interface ButtonGroupProps extends ComponentPropsWithRef<'div'> {
5
+ vertical?: boolean;
6
+ }
7
+
8
+ export const ButtonGroup: FC<ButtonGroupProps> = ({
9
+ vertical,
10
+ role = 'group',
11
+ className,
12
+ ...props
13
+ }) => (
14
+ <div
15
+ role={role}
16
+ {...props}
17
+ className={classNames(vertical ? 'btn-group-vertical' : 'btn-group', className)}
18
+ />
19
+ );
20
+ ButtonGroup.displayName = 'ButtonGroup';
21
+
22
+ export const ButtonToolbar: FC<ComponentPropsWithRef<'div'>> = ({
23
+ className,
24
+ role = 'toolbar',
25
+ ...props
26
+ }) => <div role={role} {...props} className={classNames('btn-toolbar', className)} />;
27
+
28
+ ButtonToolbar.displayName = 'ButtonToolbar';
@@ -0,0 +1,26 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ export const Card: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
5
+ <div {...props} className={classNames('card', className)} />
6
+ );
7
+
8
+ export const CardHeader: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
9
+ <div {...props} className={classNames('card-header', className)} />
10
+ );
11
+
12
+ export const CardBody: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
13
+ <div {...props} className={classNames('card-body', className)} />
14
+ );
15
+
16
+ export const CardFooter: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
17
+ <div {...props} className={classNames('card-footer', className)} />
18
+ );
19
+
20
+ export const CardTitle: FC<ComponentPropsWithRef<'h3'>> = ({ className, ...props }) => (
21
+ <h3 {...props} className={classNames('card-title', className)} />
22
+ );
23
+
24
+ export const CardText: FC<ComponentPropsWithRef<'p'>> = ({ className, ...props }) => (
25
+ <p {...props} className={classNames('card-text', className)} />
26
+ );
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import {
2
4
  createRef,
3
5
  DetailedHTMLProps,
@@ -8,8 +10,8 @@ import {
8
10
 
9
11
  export type ClickBoundaryProps = PropsWithChildren<
10
12
  {
11
- onInnerClick?: (event: MouseEvent) => any;
12
- onOuterClick?: (event: MouseEvent) => any;
13
+ onInnerClick?: (event: MouseEvent) => unknown;
14
+ onOuterClick?: (event: MouseEvent) => unknown;
13
15
  } & DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
14
16
  >;
15
17
 
@@ -19,8 +21,7 @@ export class ClickBoundary extends PureComponent<ClickBoundaryProps> {
19
21
  switchClick = (event: MouseEvent) => {
20
22
  const { onInnerClick, onOuterClick } = this.props;
21
23
 
22
- if (this.root.current?.contains(event.target as Node))
23
- onInnerClick?.(event);
24
+ if (this.root.current?.contains(event.target as Node)) onInnerClick?.(event);
24
25
  else onOuterClick?.(event);
25
26
  };
26
27
 
@@ -33,7 +34,7 @@ export class ClickBoundary extends PureComponent<ClickBoundaryProps> {
33
34
  }
34
35
 
35
36
  render() {
36
- const { children, onInnerClick, onOuterClick, ...props } = this.props;
37
+ const { children, onInnerClick: _, onOuterClick: __, ...props } = this.props;
37
38
 
38
39
  return (
39
40
  <div ref={this.root} {...props}>
@@ -0,0 +1,23 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ export interface CloseButtonProps extends ComponentPropsWithRef<'button'> {
5
+ dismiss?: string;
6
+ }
7
+
8
+ export const CloseButton: FC<CloseButtonProps> = ({
9
+ dismiss,
10
+ className,
11
+ type = 'button',
12
+ 'aria-label': ariaLabel = 'Close',
13
+ ...props
14
+ }) => (
15
+ <button
16
+ {...props}
17
+ type={type}
18
+ className={classNames('btn-close', className)}
19
+ data-bs-dismiss={dismiss}
20
+ aria-label={ariaLabel}
21
+ />
22
+ );
23
+ CloseButton.displayName = 'CloseButton';
@@ -2,6 +2,7 @@ import js from '@shikijs/langs/javascript';
2
2
  import jsx from '@shikijs/langs/jsx';
3
3
  import tsx from '@shikijs/langs/tsx';
4
4
  import ts from '@shikijs/langs/typescript';
5
+ import githubDark from '@shikijs/themes/github-dark';
5
6
  import githubLight from '@shikijs/themes/github-light';
6
7
  import { FC, HTMLAttributes, isValidElement } from 'react';
7
8
  import reactElementToJSXString from 'react-element-to-jsx-string';
@@ -9,7 +10,7 @@ import { createHighlighterCoreSync } from 'shiki/core';
9
10
  import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
10
11
 
11
12
  const highlighter = createHighlighterCoreSync({
12
- themes: [githubLight],
13
+ themes: [githubLight, githubDark],
13
14
  langs: [js, jsx, ts, tsx],
14
15
  engine: createJavaScriptRegexEngine()
15
16
  });
@@ -26,12 +27,13 @@ export const CodeBlock: FC<CodeBlockProps> = ({ className = '', language, childr
26
27
 
27
28
  const __html = highlighter.codeToHtml(sourceCode, {
28
29
  lang: language,
29
- theme: 'github-light',
30
+ themes: { light: 'github-light', dark: 'github-dark' },
31
+ defaultColor: 'light',
30
32
  structure: 'inline'
31
33
  });
32
34
 
33
35
  return (
34
- <pre className={`m-0 language-${language} ${className}`} {...props}>
36
+ <pre className={`m-0 shiki language-${language} ${className}`} {...props}>
35
37
  <code dangerouslySetInnerHTML={{ __html }} className={`language-${language}`} />
36
38
  </pre>
37
39
  );
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { computed, observable } from 'mobx';
2
4
  import { observer } from 'mobx-react';
3
5
  import { ObservedComponent, reaction } from 'mobx-react-helper';
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+
3
+ import classNames from 'classnames';
4
+ import { ComponentPropsWithRef, FC, ReactNode } from 'react';
5
+
6
+ import { CloseButton } from './CloseButton';
7
+ import { NativeDialog, NativeDialogProps } from './NativeDialog';
8
+
9
+ export type DrawerPlacement = 'start' | 'end' | 'top' | 'bottom';
10
+
11
+ export const DrawerHeader: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
12
+ <div {...props} className={classNames('drawer-header', className)} />
13
+ );
14
+
15
+ export const DrawerTitle: FC<ComponentPropsWithRef<'h5'>> = ({ className, ...props }) => (
16
+ <h5 {...props} className={classNames('drawer-title', className)} />
17
+ );
18
+
19
+ export const DrawerBody: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
20
+ <div {...props} className={classNames('drawer-body', className)} />
21
+ );
22
+
23
+ export const DrawerFooter: FC<ComponentPropsWithRef<'div'>> = ({ className, ...props }) => (
24
+ <div {...props} className={classNames('drawer-footer', className)} />
25
+ );
26
+
27
+ export interface DrawerProps extends Omit<NativeDialogProps, 'dialog' | 'onClose' | 'title'> {
28
+ title?: ReactNode;
29
+ placement?: DrawerPlacement;
30
+ footer?: ReactNode;
31
+ bodyClassName?: string;
32
+ onDismiss?: () => void;
33
+ }
34
+
35
+ export const Drawer: FC<DrawerProps> = ({
36
+ title,
37
+ placement = 'end',
38
+ footer,
39
+ bodyClassName,
40
+ onDismiss,
41
+ className,
42
+ children,
43
+ ...props
44
+ }) => (
45
+ <NativeDialog
46
+ {...props}
47
+ dialog={false}
48
+ tabIndex={-1}
49
+ aria-label={typeof title === 'string' ? title : props['aria-label']}
50
+ className={classNames('drawer', `drawer-${placement}`, className)}
51
+ onClose={onDismiss}
52
+ >
53
+ <DrawerHeader>
54
+ <DrawerTitle>{title}</DrawerTitle>
55
+ <CloseButton onClick={onDismiss} />
56
+ </DrawerHeader>
57
+ <DrawerBody className={bodyClassName}>{children}</DrawerBody>
58
+ {footer && <DrawerFooter>{footer}</DrawerFooter>}
59
+ </NativeDialog>
60
+ );
61
+
62
+ Drawer.displayName = 'Drawer';
package/source/Editor.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { EditorCore, WrapperProps } from '@react-editor-js/core';
2
4
  import { observable } from 'mobx';
3
5
  import { observer } from 'mobx-react';
@@ -7,8 +9,7 @@ import { createReactEditorJS } from 'react-editor-js';
7
9
  const ReactEditorJS = createReactEditorJS();
8
10
 
9
11
  export type EditorProps = PropsWithoutRef<
10
- WrapperProps &
11
- Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'required'>
12
+ WrapperProps & Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'required'>
12
13
  >;
13
14
 
14
15
  @observer
@@ -23,16 +24,12 @@ export class Editor extends Component<EditorProps> {
23
24
  save = async () => this.core && (this.innerValue = await this.core.save());
24
25
 
25
26
  render() {
26
- const { name, required, children, ...editorProps } = this.props,
27
+ const { name, required, children: _children, ...editorProps } = this.props,
27
28
  { innerValue } = this;
28
29
 
29
30
  return (
30
31
  <div className="form-control" tabIndex={-1} onBlur={this.save}>
31
- <input
32
- hidden
33
- {...{ name, required }}
34
- value={JSON.stringify(innerValue)}
35
- />
32
+ <input hidden {...{ name, required }} value={JSON.stringify(innerValue)} />
36
33
  <ReactEditorJS
37
34
  {...editorProps}
38
35
  onInitialize={core => {
@@ -0,0 +1,92 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
5
+ export type ColSize = number | 'auto';
6
+ export type BreakpointColSize = ColSize | true;
7
+
8
+ export interface ContainerProps extends ComponentPropsWithRef<'div'> {
9
+ fluid?: boolean;
10
+ breakpoint?: Breakpoint;
11
+ }
12
+
13
+ export const Container: FC<ContainerProps> = ({ fluid, breakpoint, className, ...props }) => (
14
+ <div
15
+ {...props}
16
+ className={classNames(
17
+ breakpoint ? `${breakpoint}:container` : fluid ? 'container-fluid' : 'container',
18
+ className
19
+ )}
20
+ />
21
+ );
22
+
23
+ export type RowCols = number | 'auto';
24
+
25
+ export interface RowProps extends ComponentPropsWithRef<'div'> {
26
+ cols?: RowCols;
27
+ sm?: RowCols;
28
+ md?: RowCols;
29
+ lg?: RowCols;
30
+ xl?: RowCols;
31
+ '2xl'?: RowCols;
32
+ }
33
+
34
+ export const Row: FC<RowProps> = ({ cols, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
35
+ const sizes: [Breakpoint, RowCols | undefined][] = [
36
+ ['sm', sm],
37
+ ['md', md],
38
+ ['lg', lg],
39
+ ['xl', xl],
40
+ ['2xl', xxl]
41
+ ];
42
+
43
+ return (
44
+ <div
45
+ {...props}
46
+ className={classNames(
47
+ 'row',
48
+ cols !== undefined && `row-cols-${cols}`,
49
+ sizes.map(
50
+ ([breakpoint, size]) => size !== undefined && `${breakpoint}:row-cols-${size}`
51
+ ),
52
+ className
53
+ )}
54
+ />
55
+ );
56
+ };
57
+
58
+ export interface ColProps extends ComponentPropsWithRef<'div'> {
59
+ span?: ColSize;
60
+ sm?: BreakpointColSize;
61
+ md?: BreakpointColSize;
62
+ lg?: BreakpointColSize;
63
+ xl?: BreakpointColSize;
64
+ '2xl'?: BreakpointColSize;
65
+ }
66
+
67
+ export const Col: FC<ColProps> = ({ span, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
68
+ const sizes: [Breakpoint, BreakpointColSize | undefined][] = [
69
+ ['sm', sm],
70
+ ['md', md],
71
+ ['lg', lg],
72
+ ['xl', xl],
73
+ ['2xl', xxl]
74
+ ];
75
+ const sized = sizes.some(([, size]) => size !== undefined);
76
+
77
+ return (
78
+ <div
79
+ {...props}
80
+ className={classNames(
81
+ !span && !sized && 'col',
82
+ span !== undefined && `col-${span}`,
83
+ sizes.map(
84
+ ([breakpoint, size]) =>
85
+ size !== undefined &&
86
+ (size === true ? `${breakpoint}:col` : `${breakpoint}:col-${size}`)
87
+ ),
88
+ className
89
+ )}
90
+ />
91
+ );
92
+ };
@@ -13,7 +13,7 @@ export const HorizontalMarquee: FC<HorizontalMarqueeProps> = ({
13
13
  height,
14
14
  ...props
15
15
  }) => (
16
- <div className={`overflow-hidden mw-100 ${className}`} {...props}>
16
+ <div className={`overflow-hidden max-w-100 ${className}`} {...props}>
17
17
  <div
18
18
  className={`d-inline-block align-top text-nowrap ${style.scrollWrap}`}
19
19
  style={{
@@ -45,23 +45,17 @@ export const HorizontalMarqueeBox: FC<HorizontalMarqueeProps> = ({
45
45
  // @ts-expect-error remove after React 19 released
46
46
  style={{ maxWidth: maxWidth, '--scroll-height': height }}
47
47
  >
48
- <div
49
- className={`d-inline-block overflow-hidden mw-100 ${style.scrollContainer}`}
50
- >
48
+ <div className={`d-inline-block overflow-hidden max-w-100 ${style.scrollContainer}`}>
51
49
  <div
52
50
  className={`d-block overflow-hidden text-wrap text-break ${style.unScrollItem}`}
53
51
  >
54
52
  {children}
55
53
  </div>
56
- <HorizontalMarquee duration={duration}>
57
- {children}
58
- </HorizontalMarquee>
54
+ <HorizontalMarquee duration={duration}>{children}</HorizontalMarquee>
59
55
  </div>
60
56
  </div>
61
57
  ) : (
62
- <HorizontalMarquee {...{ maxWidth, duration, height }}>
63
- {children}
64
- </HorizontalMarquee>
58
+ <HorizontalMarquee {...{ maxWidth, duration, height }}>{children}</HorizontalMarquee>
65
59
  );
66
60
 
67
61
  HorizontalMarquee.displayName = 'HorizontalMarquee';
@@ -0,0 +1,15 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ export interface ImageProps extends ComponentPropsWithRef<'img'> {
5
+ fluid?: boolean;
6
+ thumbnail?: boolean;
7
+ }
8
+
9
+ export const Image: FC<ImageProps> = ({ fluid, thumbnail, className, ...props }) => (
10
+ <img
11
+ {...props}
12
+ className={classNames({ 'img-fluid': fluid, 'img-thumbnail': thumbnail }, className)}
13
+ />
14
+ );
15
+ Image.displayName = 'Image';
@@ -0,0 +1,103 @@
1
+ import classNames from 'classnames';
2
+ import { ComponentPropsWithRef, FC } from 'react';
3
+
4
+ import type { ComponentTheme } from './Button';
5
+ import type { Breakpoint } from './Grid';
6
+
7
+ export type ListGroupHorizontal = boolean | Breakpoint;
8
+
9
+ export interface ListGroupProps extends ComponentPropsWithRef<'ul'> {
10
+ flush?: boolean;
11
+ numbered?: boolean;
12
+ horizontal?: ListGroupHorizontal;
13
+ }
14
+
15
+ export const ListGroup: FC<ListGroupProps> = ({
16
+ flush,
17
+ numbered,
18
+ horizontal,
19
+ className,
20
+ ...props
21
+ }) => (
22
+ <ul
23
+ {...props}
24
+ className={classNames(
25
+ 'list-group',
26
+ { 'list-group-flush': flush, 'list-group-numbered': numbered },
27
+ horizontal &&
28
+ (horizontal === true
29
+ ? 'list-group-horizontal'
30
+ : `${horizontal}:list-group-horizontal`),
31
+ className
32
+ )}
33
+ />
34
+ );
35
+
36
+ interface ListGroupItemStyleProps {
37
+ theme?: ComponentTheme;
38
+ action?: boolean;
39
+ active?: boolean;
40
+ disabled?: boolean;
41
+ }
42
+
43
+ type ListGroupItemLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
44
+ type ListGroupItemButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
45
+ type ListGroupItemAttributes = ComponentPropsWithRef<'li'> & { href?: never; type?: never };
46
+ type ListGroupItemElementAttributes =
47
+ ListGroupItemLinkAttributes | ListGroupItemButtonAttributes | ListGroupItemAttributes;
48
+
49
+ export type ListGroupItemProps = ListGroupItemStyleProps & ListGroupItemElementAttributes;
50
+
51
+ const isLink = (props: ListGroupItemElementAttributes): props is ListGroupItemLinkAttributes =>
52
+ typeof props.href === 'string';
53
+
54
+ const isButton = (props: ListGroupItemElementAttributes): props is ListGroupItemButtonAttributes =>
55
+ typeof props.type === 'string';
56
+
57
+ export const ListGroupItem: FC<ListGroupItemProps> = ({
58
+ theme,
59
+ action,
60
+ active,
61
+ disabled,
62
+ className,
63
+ ...props
64
+ }) => {
65
+ const classes = classNames(
66
+ 'list-group-item',
67
+ theme && `theme-${theme}`,
68
+ action && 'list-group-item-action',
69
+ { active, disabled },
70
+ disabled && 'pe-none',
71
+ className
72
+ );
73
+
74
+ return isLink(props) ? (
75
+ <a
76
+ {...props}
77
+ className={classes}
78
+ href={disabled ? undefined : props.href}
79
+ aria-current={active ? 'true' : undefined}
80
+ aria-disabled={disabled || undefined}
81
+ tabIndex={disabled ? -1 : props.tabIndex}
82
+ onClick={disabled ? undefined : props.onClick}
83
+ />
84
+ ) : isButton(props) ? (
85
+ <button
86
+ {...props}
87
+ type={props.type || 'button'}
88
+ className={classes}
89
+ aria-current={active ? 'true' : undefined}
90
+ disabled={disabled}
91
+ />
92
+ ) : (
93
+ <li
94
+ {...(props as ListGroupItemAttributes)}
95
+ className={classes}
96
+ aria-current={active ? 'true' : undefined}
97
+ aria-disabled={disabled || undefined}
98
+ />
99
+ );
100
+ };
101
+
102
+ ListGroup.displayName = 'ListGroup';
103
+ ListGroupItem.displayName = 'ListGroupItem';
@@ -12,7 +12,7 @@ export const LiveTSX: FC<LiveTSXProps> = ({ scope, children }) => {
12
12
  <LiveProvider code={code} scope={scope} language="tsx">
13
13
  <LivePreview className="mb-3" />
14
14
  <LiveEditor />
15
- <LiveError className="text-danger small p-2" />
15
+ <LiveError className="fg-danger small p-2" />
16
16
  </LiveProvider>
17
17
  );
18
18
  };
@@ -1,5 +1,6 @@
1
1
  import { FC, HTMLAttributes } from 'react';
2
- import { Spinner } from 'react-bootstrap';
2
+
3
+ import { Spinner } from './Spinner';
3
4
 
4
5
  export type LoadingProps = HTMLAttributes<HTMLDivElement>;
5
6
 
@@ -12,9 +13,9 @@ export const Loading: FC<LoadingProps> = ({
12
13
  className={`fixed-top h-100 w-100 d-flex justify-content-center align-items-center opacity-25 bg-black ${className}`}
13
14
  {...props}
14
15
  >
15
- <Spinner animation="border" variant="success" />
16
+ <Spinner theme="success" />
16
17
 
17
- <span className="ml-3 text-white">{children}</span>
18
+ <span className="ms-3 fg-white">{children}</span>
18
19
  </div>
19
20
  );
20
21