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.
- package/AGENTS.md +12 -3
- package/ReadMe.md +34 -6
- package/dist/index.d.mts +313 -230
- package/dist/index.d.ts +313 -230
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/style.css +0 -3
- package/package.json +13 -13
- package/source/Accordion.tsx +61 -37
- package/source/Alert.tsx +30 -15
- package/source/Avatar.tsx +55 -50
- package/source/Badge.tsx +16 -16
- package/source/Breadcrumb.tsx +36 -22
- package/source/Button.tsx +63 -69
- package/source/ButtonGroup.tsx +21 -25
- package/source/Card.tsx +67 -59
- package/source/Carousel/index.tsx +22 -21
- package/source/CloseButton.tsx +20 -15
- package/source/Collapse.tsx +74 -19
- package/source/Drawer.tsx +40 -17
- package/source/Extension/ClickBoundary.tsx +24 -5
- package/source/Extension/CodeBlock.tsx +64 -0
- package/source/Extension/Countdown.tsx +21 -9
- package/source/Extension/Editor.tsx +53 -18
- package/source/Extension/EditorHTML.tsx +7 -3
- package/source/Extension/HorizontalMarquee/index.tsx +69 -45
- package/source/Extension/Icon.tsx +15 -14
- package/source/Extension/Loading.tsx +20 -17
- package/source/Extension/MonthCalendar.tsx +26 -10
- package/source/Extension/OverlayBox.tsx +28 -15
- package/source/Extension/PageNav.tsx +16 -7
- package/source/Extension/ScrollNav/Scroller.tsx +21 -5
- package/source/Extension/ScrollNav/index.tsx +32 -7
- package/source/Extension/Select.tsx +12 -11
- package/source/Extension/SpinnerButton.tsx +19 -24
- package/source/Extension/TableSpinner.tsx +10 -14
- package/source/Extension/TextTruncate/index.tsx +17 -13
- package/source/Extension/Time.tsx +7 -5
- package/source/Extension/TimeDistance.tsx +22 -18
- package/source/Extension/Timeline/index.tsx +37 -34
- package/source/Extension/TypeEcho/Content.tsx +79 -14
- package/source/Extension/TypeEcho/index.tsx +13 -5
- package/source/Extension/UserRank/Address.tsx +17 -15
- package/source/Extension/UserRank/index.tsx +79 -84
- package/source/Extension/VerticalMarquee/index.tsx +14 -16
- package/source/Extension/ZodiacBar.tsx +40 -32
- package/source/Form/Adorn.tsx +30 -32
- package/source/Form/Checkbox.tsx +9 -5
- package/source/Form/ChipInput.tsx +9 -5
- package/source/Form/Chips.tsx +41 -39
- package/source/Form/Combobox.tsx +80 -61
- package/source/Form/Control.tsx +53 -58
- package/source/Form/DatePicker.tsx +74 -65
- package/source/Form/Feedback.tsx +18 -19
- package/source/Form/FloatingLabel.tsx +16 -19
- package/source/Form/InputGroup.tsx +27 -26
- package/source/Form/OTP.tsx +30 -12
- package/source/Form/Primitives.tsx +47 -39
- package/source/Form/Radio.tsx +25 -22
- package/source/Form/Range.tsx +30 -12
- package/source/Form/Switch.tsx +73 -48
- package/source/Form/inputProps.ts +184 -0
- package/source/Grid.tsx +67 -59
- package/source/Image.tsx +10 -6
- package/source/ListGroup.tsx +57 -69
- package/source/Menu.tsx +128 -66
- package/source/NativeDialog/index.tsx +51 -29
- package/source/Nav.tsx +46 -46
- package/source/NavOverflow/index.tsx +26 -10
- package/source/Navbar.tsx +60 -55
- package/source/Pagination.tsx +63 -69
- package/source/Placeholder.tsx +47 -43
- package/source/Polymorphic.ts +57 -0
- package/source/Popover.tsx +34 -31
- package/source/Progress/index.tsx +59 -54
- package/source/ScrollSpy/index.tsx +48 -33
- package/source/Spinner.tsx +27 -23
- package/source/Stack.tsx +25 -0
- package/source/Stepper.tsx +46 -40
- package/source/Tab.tsx +40 -27
- package/source/Table.tsx +53 -42
- package/source/Toast.tsx +62 -47
- package/source/ToggleButton.tsx +65 -54
- package/source/Toggler.tsx +17 -8
- package/source/Tooltip.tsx +31 -29
- package/source/index.ts +2 -0
- package/tsconfig.json +2 -2
- package/source/Extension/CodeBlock/index.tsx +0 -58
- package/source/Extension/CodeBlock/style.module.css +0 -3
package/source/Tooltip.tsx
CHANGED
|
@@ -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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
};
|