idea-react 1.0.0-rc.31 → 2.0.0-rc.10
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/ReadMe.md +208 -178
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +121 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +85 -61
- package/source/CodeBlock.tsx +20 -13
- package/source/Dialog.tsx +41 -36
- package/source/Editor.tsx +46 -51
- package/source/EditorHTML.tsx +21 -23
- package/source/HorizontalMarquee/index.module.less +52 -0
- package/source/HorizontalMarquee/index.tsx +67 -0
- package/source/Icon.tsx +1 -1
- package/source/Loading.tsx +21 -13
- package/source/MonthCalendar.tsx +6 -11
- package/source/PageNav.tsx +102 -107
- package/source/Select.tsx +84 -89
- package/source/ShareBox.tsx +99 -0
- package/source/TableSpinner.tsx +24 -14
- package/source/Time.tsx +14 -0
- package/source/TimeDistance.tsx +41 -46
- package/source/Timeline/index.module.less +53 -0
- package/source/Timeline/index.tsx +70 -0
- package/source/TypeEcho.tsx +49 -43
- package/source/UserRank/Address.tsx +20 -0
- package/source/UserRank/index.module.less +227 -0
- package/source/UserRank/index.tsx +122 -0
- package/source/VerticalMarquee/index.module.less +43 -0
- package/source/VerticalMarquee/index.tsx +27 -0
- package/source/index.ts +25 -19
- package/tsconfig.build.json +11 -11
- package/tsconfig.json +6 -4
- package/.vscode/extensions.json +0 -17
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.10",
|
|
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.",
|
|
@@ -22,86 +22,110 @@
|
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"main": "dist/index.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@editorjs/editorjs": "^2.
|
|
26
|
-
"@editorjs/paragraph": "^2.11.
|
|
25
|
+
"@editorjs/editorjs": "^2.30.8",
|
|
26
|
+
"@editorjs/paragraph": "^2.11.7",
|
|
27
27
|
"@react-editor-js/core": "^2.1.0",
|
|
28
|
-
"@swc/helpers": "^0.5.
|
|
29
|
-
"classnames": "^2.
|
|
30
|
-
"editorjs-html": "^
|
|
31
|
-
"
|
|
28
|
+
"@swc/helpers": "^0.5.15",
|
|
29
|
+
"classnames": "^2.5.1",
|
|
30
|
+
"editorjs-html": "^4.0.5",
|
|
31
|
+
"html2canvas": "^1.4.1",
|
|
32
|
+
"iterable-observer": "^1.1.0",
|
|
32
33
|
"lodash": "^4.17.21",
|
|
33
|
-
"mobx": "
|
|
34
|
-
"mobx-react": "
|
|
35
|
-
"mobx-react-helper": "^0.
|
|
36
|
-
"prismjs": "^1.
|
|
37
|
-
"react-bootstrap": "^2.9
|
|
34
|
+
"mobx": "^6.13.7",
|
|
35
|
+
"mobx-react": "^9.2.0",
|
|
36
|
+
"mobx-react-helper": "^0.3.1",
|
|
37
|
+
"prismjs": "^1.30.0",
|
|
38
|
+
"react-bootstrap": "^2.10.9",
|
|
38
39
|
"react-editor-js": "^2.1.0",
|
|
39
40
|
"react-element-to-jsx-string": "^15.0.0",
|
|
40
|
-
"web-utility": "^4.
|
|
41
|
+
"web-utility": "^4.4.3"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"react": ">=16",
|
|
44
45
|
"react-dom": ">=16"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@babel/plugin-proposal-
|
|
48
|
-
"@babel/
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
48
|
+
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
49
|
+
"@babel/preset-typescript": "^7.27.0",
|
|
50
|
+
"@eslint/compat": "^1.2.8",
|
|
51
|
+
"@eslint/js": "^9.24.0",
|
|
52
|
+
"@mdx-js/react": "^3.1.0",
|
|
53
|
+
"@microsoft/api-extractor": "^7.52.3",
|
|
54
|
+
"@parcel/config-default": "~2.14.4",
|
|
55
|
+
"@parcel/config-storybook": "^0.0.2",
|
|
56
|
+
"@parcel/packager-ts": "~2.14.4",
|
|
57
|
+
"@parcel/transformer-less": "~2.14.4",
|
|
58
|
+
"@parcel/transformer-mdx": "~2.13.3",
|
|
59
|
+
"@parcel/transformer-typescript-tsc": "~2.14.4",
|
|
60
|
+
"@parcel/transformer-typescript-types": "~2.14.4",
|
|
61
|
+
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
|
|
62
|
+
"@storybook/addon-console": "^3.0.0",
|
|
63
|
+
"@storybook/addon-docs": "^8.6.12",
|
|
64
|
+
"@storybook/addon-essentials": "^8.6.12",
|
|
65
|
+
"@storybook/addon-interactions": "^8.6.12",
|
|
66
|
+
"@storybook/addon-links": "^8.6.12",
|
|
67
|
+
"@storybook/addon-storysource": "^8.6.12",
|
|
68
|
+
"@storybook/blocks": "^8.6.12",
|
|
69
|
+
"@storybook/react": "^8.6.12",
|
|
70
|
+
"@storybook/test": "^8.6.12",
|
|
71
|
+
"@types/lodash": "^4.17.16",
|
|
72
|
+
"@types/node": "^22.14.0",
|
|
73
|
+
"@types/prismjs": "^1.26.5",
|
|
74
|
+
"@types/react": "^19.1.0",
|
|
75
|
+
"@types/react-dom": "^19.1.2",
|
|
76
|
+
"buffer": "^6.0.3",
|
|
77
|
+
"eslint": "^9.24.0",
|
|
78
|
+
"eslint-config-prettier": "^10.1.2",
|
|
79
|
+
"eslint-plugin-react": "^7.37.5",
|
|
80
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
81
|
+
"globals": "^16.0.0",
|
|
82
|
+
"husky": "^9.1.7",
|
|
83
|
+
"jiti": "^2.4.2",
|
|
74
84
|
"koapache": "^2.2.2",
|
|
75
|
-
"less": "^4.
|
|
76
|
-
"lint-staged": "^15.
|
|
77
|
-
"parcel": "~2.
|
|
78
|
-
"postcss
|
|
79
|
-
"prettier": "^3.
|
|
85
|
+
"less": "^4.3.0",
|
|
86
|
+
"lint-staged": "^15.5.0",
|
|
87
|
+
"parcel": "~2.14.4",
|
|
88
|
+
"postcss": "^8.5.3",
|
|
89
|
+
"prettier": "^3.5.3",
|
|
90
|
+
"prettier-plugin-css-order": "^2.1.2",
|
|
80
91
|
"process": "^0.11.10",
|
|
81
92
|
"prop-types": "15.8.1",
|
|
82
|
-
"react": "^
|
|
83
|
-
"react-dom": "^
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
93
|
+
"react": "^19.1.0",
|
|
94
|
+
"react-dom": "^19.1.0",
|
|
95
|
+
"remark-gfm": "^4.0.1",
|
|
96
|
+
"rimraf": "^6.0.1",
|
|
97
|
+
"storybook": "^8.6.12",
|
|
98
|
+
"storybook-react-parcel": "^0.0.1",
|
|
99
|
+
"typedoc": "^0.28.2",
|
|
100
|
+
"typedoc-plugin-mdn-links": "^5.0.1",
|
|
101
|
+
"typescript": "~5.8.3",
|
|
102
|
+
"typescript-eslint": "^8.29.1"
|
|
90
103
|
},
|
|
91
104
|
"pnpm": {
|
|
92
|
-
"
|
|
93
|
-
"@
|
|
94
|
-
|
|
105
|
+
"onlyBuiltDependencies": [
|
|
106
|
+
"@parcel/watcher",
|
|
107
|
+
"@swc/core",
|
|
108
|
+
"esbuild",
|
|
109
|
+
"lmdb",
|
|
110
|
+
"msgpackr-extract"
|
|
111
|
+
]
|
|
95
112
|
},
|
|
96
113
|
"prettier": {
|
|
97
114
|
"singleQuote": true,
|
|
98
115
|
"trailingComma": "none",
|
|
99
116
|
"arrowParens": "avoid",
|
|
100
|
-
"tabWidth": 4
|
|
117
|
+
"tabWidth": 4,
|
|
118
|
+
"plugins": [
|
|
119
|
+
"prettier-plugin-css-order",
|
|
120
|
+
"@softonus/prettier-plugin-duplicate-remover"
|
|
121
|
+
]
|
|
101
122
|
},
|
|
102
123
|
"lint-staged": {
|
|
103
|
-
"*.{md,less,json,yml,ts,tsx}": "prettier --write",
|
|
104
|
-
"*.{js,
|
|
124
|
+
"*.{md,less,json,yml,js,mjs,ts,tsx}": "prettier --write",
|
|
125
|
+
"*.{js,ts,tsx}": "eslint --fix"
|
|
126
|
+
},
|
|
127
|
+
"@parcel/resolver-default": {
|
|
128
|
+
"packageExports": true
|
|
105
129
|
},
|
|
106
130
|
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
|
|
107
131
|
"targets": {
|
|
@@ -110,12 +134,12 @@
|
|
|
110
134
|
}
|
|
111
135
|
},
|
|
112
136
|
"scripts": {
|
|
113
|
-
"prepare": "husky
|
|
137
|
+
"prepare": "husky",
|
|
114
138
|
"test": "lint-staged",
|
|
115
139
|
"api-extractor": "tsc --project tsconfig.build.json --outDir dist/dts && api-extractor run && rimraf dist/dts",
|
|
116
140
|
"pack-preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel build --public-url=. --dist-dir=../docs/preview/",
|
|
117
141
|
"pack-docs": "rimraf docs/ && typedoc source/",
|
|
118
|
-
"pack-dist": "rimraf .parcel-cache/ dist/ && parcel build",
|
|
142
|
+
"pack-dist": "rimraf .parcel-cache/ dist/ && parcel build && sed -i 's/^require(\"\\.\\/index\\.css\");//' dist/index.js && rimraf dist/index.js.map",
|
|
119
143
|
"start": "npm run pack-docs && npm run pack-preview && web-server docs/ -p 8080 -o",
|
|
120
144
|
"build": "npm run pack-docs && npm run pack-preview && npm run pack-dist && npm run api-extractor",
|
|
121
145
|
"prepublishOnly": "npm test && npm run build",
|
package/source/CodeBlock.tsx
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { highlight, languages } from 'prismjs';
|
|
2
|
-
import {
|
|
2
|
+
import { FC, HTMLAttributes, isValidElement } from 'react';
|
|
3
3
|
import reactElementToJSXString from 'react-element-to-jsx-string';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface CodeBlockProps extends HTMLAttributes<HTMLPreElement> {
|
|
6
|
+
language: string;
|
|
7
|
+
}
|
|
6
8
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export const CodeBlock: FC<CodeBlockProps> = ({
|
|
10
|
+
className = '',
|
|
11
|
+
language,
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const sourceCode =
|
|
16
|
+
typeof children === 'string'
|
|
17
|
+
? children
|
|
18
|
+
: reactElementToJSXString(
|
|
19
|
+
isValidElement(children) ? children : <>{children}</>
|
|
20
|
+
);
|
|
21
|
+
const __html = highlight(sourceCode, languages[language], language);
|
|
15
22
|
|
|
16
23
|
return (
|
|
17
|
-
<pre>
|
|
24
|
+
<pre className={`language-${language} ${className}`} {...props}>
|
|
18
25
|
<code
|
|
19
|
-
className={`language-${language}`}
|
|
20
26
|
dangerouslySetInnerHTML={{ __html }}
|
|
27
|
+
className={`language-${language}`}
|
|
21
28
|
/>
|
|
22
29
|
</pre>
|
|
23
30
|
);
|
|
24
|
-
}
|
|
31
|
+
};
|
package/source/Dialog.tsx
CHANGED
|
@@ -1,36 +1,41 @@
|
|
|
1
|
-
import { Defer } from 'iterable-observer';
|
|
2
|
-
import
|
|
3
|
-
import { observer } from 'mobx-react';
|
|
4
|
-
import { FC } from 'react';
|
|
5
|
-
|
|
6
|
-
export class DialogClose extends Error {
|
|
7
|
-
constructor(message = 'Dialog closed') {
|
|
8
|
-
super(message);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface DialogProps<T = any> {
|
|
13
|
-
defer?: Defer<T>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class Dialog<
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.Component
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import { Defer } from 'iterable-observer';
|
|
2
|
+
import { observable } from 'mobx';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export class DialogClose extends Error {
|
|
7
|
+
constructor(message = 'Dialog closed') {
|
|
8
|
+
super(message);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DialogProps<T = any> {
|
|
13
|
+
defer?: Defer<T>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Dialog<I extends object = {}, O = any> {
|
|
17
|
+
@observable
|
|
18
|
+
accessor input = {} as I;
|
|
19
|
+
|
|
20
|
+
@observable
|
|
21
|
+
accessor defer: Defer<O> | undefined;
|
|
22
|
+
|
|
23
|
+
Component: FC<I>;
|
|
24
|
+
|
|
25
|
+
constructor(Factory: FC<I & DialogProps<O>>) {
|
|
26
|
+
this.Component = observer(props => (
|
|
27
|
+
<Factory {...props} {...this.input} defer={this.defer} />
|
|
28
|
+
));
|
|
29
|
+
this.Component.displayName = 'DialogComponent';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
open(input?: I) {
|
|
33
|
+
if (input) this.input = input;
|
|
34
|
+
|
|
35
|
+
this.defer = new Defer();
|
|
36
|
+
|
|
37
|
+
this.defer.promise.finally(() => (this.defer = undefined));
|
|
38
|
+
|
|
39
|
+
return this.defer.promise;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/source/Editor.tsx
CHANGED
|
@@ -1,51 +1,46 @@
|
|
|
1
|
-
import { EditorCore, WrapperProps } from '@react-editor-js/core';
|
|
2
|
-
import
|
|
3
|
-
import { observer } from 'mobx-react';
|
|
4
|
-
import { InputHTMLAttributes, PropsWithoutRef
|
|
5
|
-
import { createReactEditorJS } from 'react-editor-js';
|
|
6
|
-
|
|
7
|
-
const ReactEditorJS = createReactEditorJS();
|
|
8
|
-
|
|
9
|
-
export type EditorProps = PropsWithoutRef<
|
|
10
|
-
WrapperProps &
|
|
11
|
-
Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'required'>
|
|
12
|
-
>;
|
|
13
|
-
|
|
14
|
-
@observer
|
|
15
|
-
export class Editor extends
|
|
16
|
-
static displayName = 'Editor';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
import { EditorCore, WrapperProps } from '@react-editor-js/core';
|
|
2
|
+
import { observable } from 'mobx';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { Component, InputHTMLAttributes, PropsWithoutRef } from 'react';
|
|
5
|
+
import { createReactEditorJS } from 'react-editor-js';
|
|
6
|
+
|
|
7
|
+
const ReactEditorJS = createReactEditorJS();
|
|
8
|
+
|
|
9
|
+
export type EditorProps = PropsWithoutRef<
|
|
10
|
+
WrapperProps &
|
|
11
|
+
Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'required'>
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
@observer
|
|
15
|
+
export class Editor extends Component<EditorProps> {
|
|
16
|
+
static displayName = 'Editor';
|
|
17
|
+
|
|
18
|
+
private core?: EditorCore;
|
|
19
|
+
|
|
20
|
+
@observable
|
|
21
|
+
accessor innerValue = this.props.defaultValue;
|
|
22
|
+
|
|
23
|
+
save = async () => this.core && (this.innerValue = await this.core.save());
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
const { name, required, children, ...editorProps } = this.props,
|
|
27
|
+
{ innerValue } = this;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="form-control" tabIndex={-1} onBlur={this.save}>
|
|
31
|
+
<input
|
|
32
|
+
hidden
|
|
33
|
+
{...{ name, required }}
|
|
34
|
+
value={JSON.stringify(innerValue)}
|
|
35
|
+
/>
|
|
36
|
+
<ReactEditorJS
|
|
37
|
+
{...editorProps}
|
|
38
|
+
onInitialize={core => {
|
|
39
|
+
this.core = core;
|
|
40
|
+
editorProps.onInitialize?.(core);
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
package/source/EditorHTML.tsx
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { OutputData } from '@editorjs/editorjs';
|
|
2
|
-
import createParser from 'editorjs-html';
|
|
3
|
-
import { FC, PropsWithoutRef } from 'react';
|
|
4
|
-
|
|
5
|
-
export const parser = createParser({
|
|
6
|
-
link: ({ data: { link } }: Record<string, any>) =>
|
|
7
|
-
`<a href="${link}">${link}</a>`
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export type EditorHTMLProps = PropsWithoutRef<{
|
|
11
|
-
className?: string;
|
|
12
|
-
data: OutputData;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export const EditorHTML: FC<EditorHTMLProps> = ({ className, data }) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
EditorHTML.displayName = 'EditorHTML';
|
|
1
|
+
import { OutputData } from '@editorjs/editorjs';
|
|
2
|
+
import createParser from 'editorjs-html';
|
|
3
|
+
import { FC, PropsWithoutRef } from 'react';
|
|
4
|
+
|
|
5
|
+
export const parser = createParser({
|
|
6
|
+
link: ({ data: { link } }: Record<string, any>) =>
|
|
7
|
+
`<a href="${link}">${link}</a>`
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type EditorHTMLProps = PropsWithoutRef<{
|
|
11
|
+
className?: string;
|
|
12
|
+
data: OutputData;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export const EditorHTML: FC<EditorHTMLProps> = ({ className, data }) => (
|
|
16
|
+
<article
|
|
17
|
+
dangerouslySetInnerHTML={{ __html: parser.parse(data) }}
|
|
18
|
+
className={className}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
EditorHTML.displayName = 'EditorHTML';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@keyframes scrollItem {
|
|
2
|
+
0%,
|
|
3
|
+
10% {
|
|
4
|
+
transform: translateX(0);
|
|
5
|
+
}
|
|
6
|
+
90%,
|
|
7
|
+
100% {
|
|
8
|
+
transform: translateX(-100%);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
@keyframes scrollWrap {
|
|
12
|
+
0%,
|
|
13
|
+
10% {
|
|
14
|
+
transform: translateX(0);
|
|
15
|
+
}
|
|
16
|
+
90%,
|
|
17
|
+
100% {
|
|
18
|
+
transform: translateX(100%);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.scrollWrap {
|
|
23
|
+
animation: scrollWrap linear 4s alternate infinite;
|
|
24
|
+
.scrollItem {
|
|
25
|
+
animation: scrollItem linear 4s alternate infinite;
|
|
26
|
+
}
|
|
27
|
+
&:hover {
|
|
28
|
+
animation-play-state: paused;
|
|
29
|
+
.scrollItem {
|
|
30
|
+
animation-play-state: paused;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.scrollHeightWrap {
|
|
36
|
+
--scroll-height: 20px;
|
|
37
|
+
height: var(--scroll-height);
|
|
38
|
+
.scrollContainer {
|
|
39
|
+
transform: translateY(
|
|
40
|
+
calc(calc(-100% + var(--scroll-height) + var(--scroll-height)) * 2)
|
|
41
|
+
);
|
|
42
|
+
max-height: calc(var(--scroll-height) * 3);
|
|
43
|
+
.unScrollItem {
|
|
44
|
+
max-height: calc(var(--scroll-height) * 2);
|
|
45
|
+
line-height: var(--scroll-height);
|
|
46
|
+
}
|
|
47
|
+
.scrollItem {
|
|
48
|
+
height: var(--scroll-height);
|
|
49
|
+
line-height: var(--scroll-height);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as style from './index.module.less';
|
|
4
|
+
|
|
5
|
+
export type HorizontalMarqueeProps = HTMLAttributes<HTMLDivElement> &
|
|
6
|
+
Partial<Record<'maxWidth' | 'duration' | 'height', string>>;
|
|
7
|
+
|
|
8
|
+
export const HorizontalMarquee: FC<HorizontalMarqueeProps> = ({
|
|
9
|
+
className = '',
|
|
10
|
+
children,
|
|
11
|
+
maxWidth = '100%',
|
|
12
|
+
duration,
|
|
13
|
+
height,
|
|
14
|
+
...props
|
|
15
|
+
}) => (
|
|
16
|
+
<div className={`overflow-hidden mw-100 ${className}`} {...props}>
|
|
17
|
+
<div
|
|
18
|
+
className={`d-inline-block align-top text-nowrap ${style.scrollWrap}`}
|
|
19
|
+
style={{
|
|
20
|
+
maxWidth,
|
|
21
|
+
animationDuration: duration,
|
|
22
|
+
height,
|
|
23
|
+
lineHeight: height
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
className={`d-inline-block ${style.scrollItem}`}
|
|
28
|
+
style={{ animationDuration: duration }}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const HorizontalMarqueeBox: FC<HorizontalMarqueeProps> = ({
|
|
37
|
+
children,
|
|
38
|
+
maxWidth,
|
|
39
|
+
duration,
|
|
40
|
+
height
|
|
41
|
+
}) =>
|
|
42
|
+
height ? (
|
|
43
|
+
<div
|
|
44
|
+
className={`overflow-hidden ${style.scrollHeightWrap}`}
|
|
45
|
+
// @ts-expect-error remove after React 19 released
|
|
46
|
+
style={{ maxWidth: maxWidth, '--scroll-height': height }}
|
|
47
|
+
>
|
|
48
|
+
<div
|
|
49
|
+
className={`d-inline-block overflow-hidden mw-100 ${style.scrollContainer}`}
|
|
50
|
+
>
|
|
51
|
+
<div
|
|
52
|
+
className={`d-block overflow-hidden text-wrap text-break ${style.unScrollItem}`}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</div>
|
|
56
|
+
<HorizontalMarquee duration={duration}>
|
|
57
|
+
{children}
|
|
58
|
+
</HorizontalMarquee>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
) : (
|
|
62
|
+
<HorizontalMarquee {...{ maxWidth, duration, height }}>
|
|
63
|
+
{children}
|
|
64
|
+
</HorizontalMarquee>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
HorizontalMarquee.displayName = 'HorizontalMarquee';
|
package/source/Icon.tsx
CHANGED
package/source/Loading.tsx
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
import { Spinner } from 'react-bootstrap';
|
|
3
|
-
|
|
4
|
-
export type LoadingProps =
|
|
5
|
-
|
|
6
|
-
export const Loading: FC<LoadingProps> = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { Spinner } from 'react-bootstrap';
|
|
3
|
+
|
|
4
|
+
export type LoadingProps = HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
|
|
6
|
+
export const Loading: FC<LoadingProps> = ({
|
|
7
|
+
className = '',
|
|
8
|
+
children = 'Loading...',
|
|
9
|
+
...props
|
|
10
|
+
}) => (
|
|
11
|
+
<div
|
|
12
|
+
className={`fixed-top h-100 w-100 d-flex justify-content-center align-items-center opacity-25 bg-black ${className}`}
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
<Spinner animation="border" variant="success" />
|
|
16
|
+
|
|
17
|
+
<span className="ml-3 text-white">{children}</span>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
Loading.displayName = 'Loading';
|