idea-react 3.0.0-alpha.0 → 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.
- package/AGENTS.md +31 -10
- package/ReadMe.md +42 -35
- package/dist/index.d.mts +301 -100
- package/dist/index.d.ts +301 -100
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/style.css +5 -5
- package/package.json +4 -7
- package/source/Avatar.tsx +65 -12
- package/source/Button.tsx +13 -4
- package/source/ButtonGroup.tsx +28 -0
- package/source/Card.tsx +26 -0
- package/source/ClickBoundary.tsx +6 -5
- package/source/CloseButton.tsx +23 -0
- package/source/CodeBlock.tsx +5 -3
- package/source/Countdown.tsx +2 -0
- package/source/Drawer.tsx +62 -0
- package/source/Editor.tsx +5 -8
- package/source/Grid.tsx +92 -0
- package/source/HorizontalMarquee/index.tsx +4 -10
- package/source/Image.tsx +15 -0
- package/source/ListGroup.tsx +103 -0
- package/source/LiveTSX.tsx +1 -1
- package/source/Loading.tsx +4 -3
- package/source/Menu.tsx +99 -1
- package/source/MonthCalendar.tsx +60 -22
- package/source/NativeDialog/index.tsx +37 -1
- package/source/Nav.tsx +52 -0
- package/source/Navbar.tsx +48 -1
- package/source/Overlay.ts +22 -0
- package/source/OverlayBox.tsx +200 -32
- package/source/PageNav.tsx +56 -32
- package/source/Popover.tsx +36 -0
- package/source/ScrollNav/Scroller.tsx +107 -0
- package/source/ScrollNav/index.tsx +12 -99
- package/source/Select.tsx +66 -55
- package/source/ShareBox.tsx +5 -11
- package/source/Spinner.tsx +30 -0
- package/source/SpinnerButton.tsx +8 -10
- package/source/Table.tsx +59 -0
- package/source/TableSpinner.tsx +7 -5
- package/source/{TextTruncate.tsx → TextTruncate/Content.tsx} +24 -20
- package/source/TextTruncate/index.tsx +25 -0
- package/source/Time.tsx +7 -33
- package/source/TimeDistance.tsx +1 -1
- package/source/Timeline/index.tsx +7 -7
- package/source/Toast.tsx +114 -29
- package/source/ToggleButton.tsx +47 -0
- package/source/Tooltip.tsx +32 -0
- package/source/TypeEcho/Content.tsx +58 -0
- package/source/TypeEcho/index.tsx +14 -0
- package/source/UserRank/index.module.less +9 -20
- package/source/UserRank/index.tsx +35 -32
- package/source/VerticalMarquee/index.module.less +0 -1
- package/source/VerticalMarquee/index.tsx +3 -5
- package/source/ZodiacBar.tsx +1 -1
- package/source/animate.ts +4 -2
- package/source/color.ts +3 -5
- package/source/index.ts +13 -0
- package/source/TypeEcho.tsx +0 -49
|
@@ -54,8 +54,7 @@
|
|
|
54
54
|
i {
|
|
55
55
|
box-shadow: 0 0 0.5rem 0 #ffd83a;
|
|
56
56
|
border: 0.1rem solid #ffd83a;
|
|
57
|
-
background-image: var(--logo-image),
|
|
58
|
-
linear-gradient(#ffd83a, #fdeba0);
|
|
57
|
+
background-image: var(--logo-image), linear-gradient(#ffd83a, #fdeba0);
|
|
59
58
|
background-position: center;
|
|
60
59
|
background-size: 1.5rem 1.5rem;
|
|
61
60
|
background-repeat: no-repeat;
|
|
@@ -65,14 +64,12 @@
|
|
|
65
64
|
&:first-child {
|
|
66
65
|
box-shadow: 0 0 0.5rem 0 #d8d8d8;
|
|
67
66
|
border-color: #d8d8d8;
|
|
68
|
-
background-image: var(--logo-image),
|
|
69
|
-
linear-gradient(#d8d8d8, #eeeeee);
|
|
67
|
+
background-image: var(--logo-image), linear-gradient(#d8d8d8, #eeeeee);
|
|
70
68
|
}
|
|
71
69
|
&:last-child {
|
|
72
70
|
box-shadow: 0 0 0.5rem 0 #fab36e;
|
|
73
71
|
border-color: #fab36e;
|
|
74
|
-
background-image: var(--logo-image),
|
|
75
|
-
linear-gradient(#fab36e, #fbe7d3);
|
|
72
|
+
background-image: var(--logo-image), linear-gradient(#fab36e, #fbe7d3);
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
}
|
|
@@ -98,12 +95,7 @@
|
|
|
98
95
|
left: 0;
|
|
99
96
|
z-index: 1;
|
|
100
97
|
margin: 0 auto;
|
|
101
|
-
background-image: linear-gradient(
|
|
102
|
-
to right,
|
|
103
|
-
#d8d8d8 10%,
|
|
104
|
-
#ffd83a 60%,
|
|
105
|
-
#fab36e 75%
|
|
106
|
-
);
|
|
98
|
+
background-image: linear-gradient(to right, #d8d8d8 10%, #ffd83a 60%, #fab36e 75%);
|
|
107
99
|
background-clip: text;
|
|
108
100
|
width: 10rem;
|
|
109
101
|
content: attr(data-text);
|
|
@@ -136,8 +128,7 @@
|
|
|
136
128
|
0px 1px 0px #969653,
|
|
137
129
|
0px 2px 5px rgba(240, 219, 100, 0.4);
|
|
138
130
|
i {
|
|
139
|
-
background-image: var(--logo-image),
|
|
140
|
-
linear-gradient(#ffd83a, #fdeba0);
|
|
131
|
+
background-image: var(--logo-image), linear-gradient(#ffd83a, #fdeba0);
|
|
141
132
|
background-position: center;
|
|
142
133
|
background-size: 2.5rem auto;
|
|
143
134
|
background-repeat: no-repeat;
|
|
@@ -157,11 +148,9 @@
|
|
|
157
148
|
.topUser {
|
|
158
149
|
border-bottom: 1.2rem solid #d8d8d8;
|
|
159
150
|
color: #d8d8d8;
|
|
160
|
-
text-shadow: 0px 1px 0px #d9cdcd 0px 2px 5px
|
|
161
|
-
rgba(133, 132, 130, 0.4);
|
|
151
|
+
text-shadow: 0px 1px 0px #d9cdcd 0px 2px 5px rgba(133, 132, 130, 0.4);
|
|
162
152
|
i {
|
|
163
|
-
background-image: var(--logo-image),
|
|
164
|
-
linear-gradient(#d8d8d8, #eeeeee);
|
|
153
|
+
background-image: var(--logo-image), linear-gradient(#d8d8d8, #eeeeee);
|
|
165
154
|
}
|
|
166
155
|
}
|
|
167
156
|
.image {
|
|
@@ -179,8 +168,7 @@
|
|
|
179
168
|
0px 1px 0px #aa8865,
|
|
180
169
|
0px 2px 5px rgba(167, 129, 67, 0.4);
|
|
181
170
|
i {
|
|
182
|
-
background-image: var(--logo-image),
|
|
183
|
-
linear-gradient(#fab36e, #fbe7d3);
|
|
171
|
+
background-image: var(--logo-image), linear-gradient(#fab36e, #fbe7d3);
|
|
184
172
|
}
|
|
185
173
|
}
|
|
186
174
|
.image {
|
|
@@ -215,6 +203,7 @@
|
|
|
215
203
|
cursor: default;
|
|
216
204
|
background-color: transparent;
|
|
217
205
|
.name {
|
|
206
|
+
max-width: 50%;
|
|
218
207
|
font-size: 0;
|
|
219
208
|
&:hover {
|
|
220
209
|
.image > img {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Badge, Col, Image, Row, RowProps, Table } from 'react-bootstrap';
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
3
2
|
|
|
3
|
+
import { Badge } from '../Badge';
|
|
4
|
+
import { Col, Container, Row } from '../Grid';
|
|
5
|
+
import { Image } from '../Image';
|
|
6
|
+
import { Table } from '../Table';
|
|
4
7
|
import { UserAddress, UserAddressProps } from './Address';
|
|
5
8
|
import * as style from './index.module.less';
|
|
6
9
|
|
|
@@ -11,44 +14,45 @@ export interface UserRank extends UserAddressProps {
|
|
|
11
14
|
score: number;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
export interface UserRankViewProps extends
|
|
17
|
+
export interface UserRankViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
15
18
|
title: string;
|
|
16
19
|
rank: UserRank[];
|
|
17
20
|
linkOf?: (user: UserRank) => string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export const UserRankView: FC<UserRankViewProps> = ({
|
|
24
|
+
className = '',
|
|
25
|
+
title,
|
|
26
|
+
rank = [],
|
|
27
|
+
linkOf,
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
const renderMedal = (user: UserRank) => (
|
|
31
|
+
<li key={user.id} className="col">
|
|
25
32
|
<div className={`shadow-lg overflow-hidden rounded-circle m-auto ${style.image}`}>
|
|
26
33
|
<Image src={user.avatar} alt={user.name} loading="lazy" fluid />
|
|
27
34
|
</div>
|
|
28
35
|
<div className={`position-relative overflow-hidden ${style.topUser}`}>
|
|
29
36
|
<div className="position-relative">
|
|
30
37
|
<i className="d-block overflow-hidden m-auto mb-1 rounded-circle" />
|
|
31
|
-
<a
|
|
32
|
-
className="d-block mb-0 stretched-link"
|
|
33
|
-
href={this.props.linkOf?.(user) || '#'}
|
|
34
|
-
>
|
|
38
|
+
<a className="d-block mb-0 stretched-link" href={linkOf?.(user) || '#'}>
|
|
35
39
|
{user.name}
|
|
36
40
|
</a>
|
|
37
41
|
<strong>{user.score}</strong>
|
|
38
42
|
</div>
|
|
39
43
|
<UserAddress {...user} />
|
|
40
44
|
</div>
|
|
41
|
-
</
|
|
45
|
+
</li>
|
|
42
46
|
);
|
|
43
47
|
|
|
44
|
-
renderRow = (user: UserRank, index: number, { length }: UserRank[]) => (
|
|
48
|
+
const renderRow = (user: UserRank, index: number, { length }: UserRank[]) => (
|
|
45
49
|
<tr key={user.id} className="position-relative">
|
|
46
50
|
<td className="align-middle">
|
|
47
51
|
<Badge className="fw-bold fst-italic">
|
|
48
52
|
{(index + 4 + '').padStart((length + '').length, '0')}
|
|
49
53
|
</Badge>
|
|
50
54
|
</td>
|
|
51
|
-
<td className={`position-relative
|
|
55
|
+
<td className={`position-relative text-truncate ${style.name}`}>
|
|
52
56
|
<div
|
|
53
57
|
className={`d-inline-block overflow-hidden align-middle rounded-circle ${style.image}`}
|
|
54
58
|
>
|
|
@@ -59,7 +63,7 @@ export class UserRankView extends PureComponent<UserRankViewProps> {
|
|
|
59
63
|
style={{
|
|
60
64
|
color: `rgb(248, ${(index + 2) * 15}, ${(index + 2) * 35})`
|
|
61
65
|
}}
|
|
62
|
-
href={
|
|
66
|
+
href={linkOf?.(user) || '#'}
|
|
63
67
|
>
|
|
64
68
|
{user.name}
|
|
65
69
|
</a>
|
|
@@ -71,12 +75,10 @@ export class UserRankView extends PureComponent<UserRankViewProps> {
|
|
|
71
75
|
</tr>
|
|
72
76
|
);
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<Row className={`${style.rankBox} ${className}`} {...props}>
|
|
79
|
-
<Col sm={12} xs={12} lg={7}>
|
|
78
|
+
return (
|
|
79
|
+
<Container className={className} {...props}>
|
|
80
|
+
<Row className={style.rankBox}>
|
|
81
|
+
<Col span={12} lg={7}>
|
|
80
82
|
<div className={`shadow rounded-3 ${style.title}`}>
|
|
81
83
|
<div className={style.medal}>
|
|
82
84
|
<i className="d-inline-block ms-1 overflow-hidden rounded-circle" />
|
|
@@ -90,19 +92,20 @@ export class UserRankView extends PureComponent<UserRankViewProps> {
|
|
|
90
92
|
{title}
|
|
91
93
|
</h3>
|
|
92
94
|
</div>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
className={`mt-2 g-0 align-items-end text-center ps-0 pt-2 list-unstyled ${style.topUsers}`}
|
|
95
|
+
<ul
|
|
96
|
+
className={`row mt-2 g-0 align-items-end text-center ps-0 pt-2 list-unstyled ${style.topUsers}`}
|
|
96
97
|
>
|
|
97
|
-
{rank.slice(0, 3).map(
|
|
98
|
-
</
|
|
98
|
+
{rank.slice(0, 3).map(renderMedal)}
|
|
99
|
+
</ul>
|
|
99
100
|
</Col>
|
|
100
|
-
<Col
|
|
101
|
+
<Col span={12} lg={5}>
|
|
101
102
|
<Table className={`my-3 pt-2 ${style.restUsers}`} responsive>
|
|
102
|
-
<tbody>{rank.slice(3, 10).map(
|
|
103
|
+
<tbody>{rank.slice(3, 10).map(renderRow)}</tbody>
|
|
103
104
|
</Table>
|
|
104
105
|
</Col>
|
|
105
106
|
</Row>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
107
|
+
</Container>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
UserRankView.displayName = 'UserRankView';
|
|
@@ -12,15 +12,13 @@ export const VerticalMarquee: FC<VerticalMarqueeProps> = ({
|
|
|
12
12
|
duration,
|
|
13
13
|
...props
|
|
14
14
|
}) => (
|
|
15
|
-
<div className={`overflow-hidden ${className}`} {...props}>
|
|
15
|
+
<div className={`overflow-hidden h-100 ${className}`} {...props}>
|
|
16
16
|
<div
|
|
17
|
-
className={`d-inline-block
|
|
17
|
+
className={`d-inline-block max-w-100 max-h-100 ${style.scrollWrap}`}
|
|
18
18
|
// @ts-expect-error remove after React 19 released
|
|
19
19
|
style={{ '--duration': duration }}
|
|
20
20
|
>
|
|
21
|
-
<div className={`d-inline-block ${style.scrollItem}`}>
|
|
22
|
-
{children}
|
|
23
|
-
</div>
|
|
21
|
+
<div className={`d-inline-block ${style.scrollItem}`}>{children}</div>
|
|
24
22
|
</div>
|
|
25
23
|
</div>
|
|
26
24
|
);
|
package/source/ZodiacBar.tsx
CHANGED
|
@@ -39,7 +39,7 @@ export const ZodiacBar: FC<ZodiacBarProps> = ({
|
|
|
39
39
|
return (
|
|
40
40
|
<li key={year} className={itemClassName}>
|
|
41
41
|
<a className="d-inline-block p-3 text-decoration-none text-center" href={link}>
|
|
42
|
-
<div className="fs-
|
|
42
|
+
<div className="fs-3xl">{zodiac}</div>
|
|
43
43
|
|
|
44
44
|
{title}
|
|
45
45
|
</a>
|
package/source/animate.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RefCallback } from 'react';
|
|
2
2
|
|
|
3
3
|
export function animate(name: string): RefCallback<Element> {
|
|
4
|
-
return element =>
|
|
5
|
-
element
|
|
4
|
+
return element => {
|
|
5
|
+
if (!element) return;
|
|
6
|
+
|
|
6
7
|
new IntersectionObserver(([{ isIntersecting, target }], observer) => {
|
|
7
8
|
if (!isIntersecting) return;
|
|
8
9
|
|
|
@@ -17,4 +18,5 @@ export function animate(name: string): RefCallback<Element> {
|
|
|
17
18
|
);
|
|
18
19
|
observer.disconnect();
|
|
19
20
|
}).observe(element);
|
|
21
|
+
};
|
|
20
22
|
}
|
package/source/color.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentTheme } from './Button';
|
|
2
2
|
|
|
3
|
-
export type VariantColor =
|
|
3
|
+
export type VariantColor = ComponentTheme;
|
|
4
4
|
|
|
5
5
|
export const VariantColors: VariantColor[] = [
|
|
6
6
|
'primary',
|
|
@@ -15,9 +15,7 @@ export const VariantColors: VariantColor[] = [
|
|
|
15
15
|
|
|
16
16
|
export function text2color(raw: string, excludeColors: VariantColor[] = []) {
|
|
17
17
|
const colors = excludeColors[0]
|
|
18
|
-
? VariantColors.filter(
|
|
19
|
-
color => !excludeColors.find(c => c === color)
|
|
20
|
-
)
|
|
18
|
+
? VariantColors.filter(color => !excludeColors.find(c => c === color))
|
|
21
19
|
: VariantColors,
|
|
22
20
|
sum = [...raw].reduce((sum, char) => sum + char.charCodeAt(0), 0);
|
|
23
21
|
|
package/source/index.ts
CHANGED
|
@@ -2,34 +2,47 @@ export * from './animate';
|
|
|
2
2
|
export * from './Avatar';
|
|
3
3
|
export * from './Badge';
|
|
4
4
|
export * from './Button';
|
|
5
|
+
export * from './ButtonGroup';
|
|
6
|
+
export * from './Card';
|
|
5
7
|
export * from './ClickBoundary';
|
|
8
|
+
export * from './CloseButton';
|
|
6
9
|
export * from './CodeBlock';
|
|
7
10
|
export * from './color';
|
|
8
11
|
export * from './Countdown';
|
|
9
12
|
export * from './Dialog';
|
|
13
|
+
export * from './Drawer';
|
|
10
14
|
export * from './Editor';
|
|
11
15
|
export * from './EditorHTML';
|
|
16
|
+
export * from './Grid';
|
|
12
17
|
export * from './HorizontalMarquee';
|
|
13
18
|
export * from './Icon';
|
|
19
|
+
export * from './Image';
|
|
20
|
+
export * from './ListGroup';
|
|
14
21
|
export * from './LiveTSX';
|
|
15
22
|
export * from './Loading';
|
|
16
23
|
export * from './Menu';
|
|
17
24
|
export * from './MonthCalendar';
|
|
18
25
|
export * from './Nameplate';
|
|
19
26
|
export * from './NativeDialog';
|
|
27
|
+
export * from './Nav';
|
|
20
28
|
export * from './Navbar';
|
|
21
29
|
export * from './OverlayBox';
|
|
22
30
|
export * from './PageNav';
|
|
31
|
+
export * from './Popover';
|
|
23
32
|
export * from './ScrollNav';
|
|
24
33
|
export * from './Select';
|
|
25
34
|
export * from './ShareBox';
|
|
35
|
+
export * from './Spinner';
|
|
26
36
|
export * from './SpinnerButton';
|
|
37
|
+
export * from './Table';
|
|
27
38
|
export * from './TableSpinner';
|
|
28
39
|
export * from './TextTruncate';
|
|
29
40
|
export * from './Time';
|
|
30
41
|
export * from './TimeDistance';
|
|
31
42
|
export * from './Timeline';
|
|
32
43
|
export * from './Toast';
|
|
44
|
+
export * from './ToggleButton';
|
|
45
|
+
export * from './Tooltip';
|
|
33
46
|
export * from './TypeEcho';
|
|
34
47
|
export * from './UserRank';
|
|
35
48
|
export * from './VerticalMarquee';
|
package/source/TypeEcho.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { observable } from 'mobx';
|
|
3
|
-
import { observer } from 'mobx-react';
|
|
4
|
-
import { Component, HTMLAttributes, RefCallback } from 'react';
|
|
5
|
-
import { sleep } from 'web-utility';
|
|
6
|
-
|
|
7
|
-
export interface TypeEchoProps extends HTMLAttributes<HTMLPreElement> {
|
|
8
|
-
text: string;
|
|
9
|
-
intervals?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@observer
|
|
13
|
-
export class TypeEcho extends Component<TypeEchoProps> {
|
|
14
|
-
static displayName = 'TypeEcho';
|
|
15
|
-
|
|
16
|
-
@observable
|
|
17
|
-
accessor echoed = '';
|
|
18
|
-
|
|
19
|
-
init: RefCallback<HTMLPreElement> = node =>
|
|
20
|
-
node &&
|
|
21
|
-
new IntersectionObserver(async ([{ isIntersecting }], observer) => {
|
|
22
|
-
if (!isIntersecting) return;
|
|
23
|
-
|
|
24
|
-
observer.disconnect();
|
|
25
|
-
|
|
26
|
-
const { text, intervals = 150 } = this.props;
|
|
27
|
-
|
|
28
|
-
for (const char of text) {
|
|
29
|
-
await sleep(intervals / 1000);
|
|
30
|
-
|
|
31
|
-
this.echoed += char;
|
|
32
|
-
}
|
|
33
|
-
}).observe(node);
|
|
34
|
-
|
|
35
|
-
render() {
|
|
36
|
-
const { className, text, ...props } = this.props,
|
|
37
|
-
{ echoed } = this;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<pre
|
|
41
|
-
{...props}
|
|
42
|
-
ref={this.init}
|
|
43
|
-
className={classNames('text-wrap', className)}
|
|
44
|
-
>
|
|
45
|
-
{echoed + (echoed === text ? '' : '_')}
|
|
46
|
-
</pre>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|