idea-react 3.0.0-beta.1 → 3.0.0-beta.3

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 (89) hide show
  1. package/AGENTS.md +12 -3
  2. package/ReadMe.md +34 -6
  3. package/dist/index.d.mts +313 -230
  4. package/dist/index.d.ts +313 -230
  5. package/dist/index.js +16 -16
  6. package/dist/index.mjs +15 -15
  7. package/dist/style.css +0 -3
  8. package/package.json +13 -13
  9. package/source/Accordion.tsx +61 -37
  10. package/source/Alert.tsx +30 -15
  11. package/source/Avatar.tsx +55 -50
  12. package/source/Badge.tsx +16 -16
  13. package/source/Breadcrumb.tsx +36 -22
  14. package/source/Button.tsx +63 -69
  15. package/source/ButtonGroup.tsx +21 -25
  16. package/source/Card.tsx +67 -59
  17. package/source/Carousel/index.tsx +22 -21
  18. package/source/CloseButton.tsx +20 -15
  19. package/source/Collapse.tsx +74 -19
  20. package/source/Drawer.tsx +40 -17
  21. package/source/Extension/ClickBoundary.tsx +24 -5
  22. package/source/Extension/CodeBlock.tsx +64 -0
  23. package/source/Extension/Countdown.tsx +21 -9
  24. package/source/Extension/Editor.tsx +53 -18
  25. package/source/Extension/EditorHTML.tsx +7 -3
  26. package/source/Extension/HorizontalMarquee/index.tsx +69 -45
  27. package/source/Extension/Icon.tsx +15 -14
  28. package/source/Extension/Loading.tsx +20 -17
  29. package/source/Extension/MonthCalendar.tsx +26 -10
  30. package/source/Extension/OverlayBox.tsx +28 -15
  31. package/source/Extension/PageNav.tsx +16 -7
  32. package/source/Extension/ScrollNav/Scroller.tsx +21 -5
  33. package/source/Extension/ScrollNav/index.tsx +32 -7
  34. package/source/Extension/Select.tsx +12 -11
  35. package/source/Extension/SpinnerButton.tsx +19 -24
  36. package/source/Extension/TableSpinner.tsx +10 -14
  37. package/source/Extension/TextTruncate/index.tsx +17 -13
  38. package/source/Extension/Time.tsx +7 -5
  39. package/source/Extension/TimeDistance.tsx +22 -18
  40. package/source/Extension/Timeline/index.tsx +37 -34
  41. package/source/Extension/TypeEcho/Content.tsx +79 -14
  42. package/source/Extension/TypeEcho/index.tsx +13 -5
  43. package/source/Extension/UserRank/Address.tsx +17 -15
  44. package/source/Extension/UserRank/index.tsx +79 -84
  45. package/source/Extension/VerticalMarquee/index.tsx +14 -16
  46. package/source/Extension/ZodiacBar.tsx +40 -32
  47. package/source/Form/Adorn.tsx +30 -32
  48. package/source/Form/Checkbox.tsx +9 -5
  49. package/source/Form/ChipInput.tsx +9 -5
  50. package/source/Form/Chips.tsx +41 -39
  51. package/source/Form/Combobox.tsx +80 -61
  52. package/source/Form/Control.tsx +53 -58
  53. package/source/Form/DatePicker.tsx +74 -65
  54. package/source/Form/Feedback.tsx +18 -19
  55. package/source/Form/FloatingLabel.tsx +16 -19
  56. package/source/Form/InputGroup.tsx +27 -26
  57. package/source/Form/OTP.tsx +30 -12
  58. package/source/Form/Primitives.tsx +47 -39
  59. package/source/Form/Radio.tsx +25 -22
  60. package/source/Form/Range.tsx +30 -12
  61. package/source/Form/Switch.tsx +73 -48
  62. package/source/Form/inputProps.ts +184 -0
  63. package/source/Grid.tsx +67 -59
  64. package/source/Image.tsx +10 -6
  65. package/source/ListGroup.tsx +57 -69
  66. package/source/Menu.tsx +128 -66
  67. package/source/NativeDialog/index.tsx +51 -29
  68. package/source/Nav.tsx +46 -46
  69. package/source/NavOverflow/index.tsx +26 -10
  70. package/source/Navbar.tsx +60 -55
  71. package/source/Pagination.tsx +63 -69
  72. package/source/Placeholder.tsx +47 -43
  73. package/source/Polymorphic.ts +57 -0
  74. package/source/Popover.tsx +34 -31
  75. package/source/Progress/index.tsx +59 -54
  76. package/source/ScrollSpy/index.tsx +48 -33
  77. package/source/Spinner.tsx +27 -23
  78. package/source/Stack.tsx +25 -0
  79. package/source/Stepper.tsx +46 -40
  80. package/source/Tab.tsx +40 -27
  81. package/source/Table.tsx +53 -42
  82. package/source/Toast.tsx +62 -47
  83. package/source/ToggleButton.tsx +65 -54
  84. package/source/Toggler.tsx +17 -8
  85. package/source/Tooltip.tsx +31 -29
  86. package/source/index.ts +2 -0
  87. package/tsconfig.json +2 -2
  88. package/source/Extension/CodeBlock/index.tsx +0 -58
  89. package/source/Extension/CodeBlock/style.module.css +0 -3
@@ -1,37 +1,39 @@
1
1
  import classNames from 'classnames';
2
- import { FC } from 'react';
3
2
 
4
3
  import { OVERLAY_ARROW_POSITIONS, OVERLAY_DIRECTIONS, OverlayTriggerProps } from './Overlay';
4
+ import { polymorphic } from './Polymorphic';
5
5
 
6
6
  export type TooltipProps = OverlayTriggerProps;
7
7
 
8
- export const Tooltip: FC<TooltipProps> = ({
9
- placement = 'top',
10
- show = true,
11
- role = 'tooltip',
12
- className,
13
- children,
14
- arrowStyle,
15
- ...props
16
- }) => (
17
- <div
18
- {...props}
19
- className={classNames(
20
- 'tooltip',
21
- { show },
22
- `bs-tooltip-${OVERLAY_DIRECTIONS[placement]}`,
23
- className
24
- )}
25
- role={role}
26
- hidden={!show}
27
- data-bs-placement={placement}
28
- >
29
- <div
30
- style={arrowStyle}
31
- className={classNames('tooltip-arrow', OVERLAY_ARROW_POSITIONS[placement])}
32
- />
33
- <div className="tooltip-inner">{children}</div>
34
- </div>
8
+ export const Tooltip = polymorphic<TooltipProps>(
9
+ ({
10
+ as: Root = 'div',
11
+ placement = 'top',
12
+ show = true,
13
+ role = 'tooltip',
14
+ className,
15
+ children,
16
+ arrowStyle,
17
+ ...props
18
+ }) => (
19
+ <Root
20
+ {...props}
21
+ className={classNames(
22
+ 'tooltip',
23
+ { show },
24
+ `bs-tooltip-${OVERLAY_DIRECTIONS[placement]}`,
25
+ className
26
+ )}
27
+ role={role}
28
+ hidden={!show}
29
+ data-bs-placement={placement}
30
+ >
31
+ <div
32
+ style={arrowStyle}
33
+ className={classNames('tooltip-arrow', OVERLAY_ARROW_POSITIONS[placement])}
34
+ />
35
+ <div className="tooltip-inner">{children}</div>
36
+ </Root>
37
+ )
35
38
  );
36
-
37
39
  Tooltip.displayName = 'Tooltip';
package/source/index.ts CHANGED
@@ -25,10 +25,12 @@ export * from './NavOverflow';
25
25
  export * from './Overlay';
26
26
  export * from './Pagination';
27
27
  export * from './Placeholder';
28
+ export * from './Polymorphic';
28
29
  export * from './Popover';
29
30
  export * from './Progress';
30
31
  export * from './ScrollSpy';
31
32
  export * from './Spinner';
33
+ export * from './Stack';
32
34
  export * from './Stepper';
33
35
  export * from './Tab';
34
36
  export * from './Table';
package/tsconfig.json CHANGED
@@ -4,11 +4,11 @@
4
4
  "module": "ES2020",
5
5
  "moduleResolution": "bundler",
6
6
  "esModuleInterop": true,
7
- "downlevelIteration": true,
8
7
  "useDefineForClassFields": true,
9
8
  "jsx": "react-jsx",
10
9
  "skipLibCheck": true,
11
- "lib": ["ES2024", "DOM", "DOM.Iterable"]
10
+ "lib": ["ES2024", "DOM", "DOM.Iterable"],
11
+ "types": ["node"]
12
12
  },
13
13
  "include": ["*.ts", "source/**/*"],
14
14
  "typedocOptions": {
@@ -1,58 +0,0 @@
1
- import js from '@shikijs/langs/javascript';
2
- import jsx from '@shikijs/langs/jsx';
3
- import tsx from '@shikijs/langs/tsx';
4
- import ts from '@shikijs/langs/typescript';
5
- import githubDark from '@shikijs/themes/github-dark';
6
- import githubLight from '@shikijs/themes/github-light';
7
- import { FC, HTMLAttributes, isValidElement, ReactNode } from 'react';
8
- import reactElementToJSXString from 'react-element-to-jsx-string';
9
- import { createHighlighterCoreSync } from 'shiki/core';
10
- import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
11
-
12
- import styles from './style.module.css';
13
-
14
- const highlighter = createHighlighterCoreSync({
15
- themes: [githubLight, githubDark],
16
- langs: [js, jsx, ts, tsx],
17
- engine: createJavaScriptRegexEngine()
18
- });
19
-
20
- export interface CodeBlockProps extends HTMLAttributes<HTMLPreElement> {
21
- language: string;
22
- header?: ReactNode;
23
- }
24
-
25
- export const CodeBlock: FC<CodeBlockProps> = ({
26
- className = '',
27
- language,
28
- header,
29
- children,
30
- ...props
31
- }) => {
32
- const sourceCode =
33
- typeof children === 'string'
34
- ? children
35
- : reactElementToJSXString(isValidElement(children) ? children : <>{children}</>);
36
-
37
- const __html = highlighter.codeToHtml(sourceCode, {
38
- lang: language,
39
- themes: { light: 'github-light', dark: 'github-dark' },
40
- defaultColor: false,
41
- structure: 'inline'
42
- });
43
-
44
- const code = (
45
- <pre className={`m-0 shiki language-${language} ${styles.code} ${className}`} {...props}>
46
- <code dangerouslySetInnerHTML={{ __html }} className={`language-${language}`} />
47
- </pre>
48
- );
49
-
50
- return header ? (
51
- <figure className="m-0 border rounded overflow-hidden">
52
- <figcaption className="px-3 py-2 bg-body-tertiary border-bottom">{header}</figcaption>
53
- {code}
54
- </figure>
55
- ) : (
56
- code
57
- );
58
- };
@@ -1,3 +0,0 @@
1
- .code :global(span[style]) {
2
- color: light-dark(var(--shiki-light), var(--shiki-dark));
3
- }