idea-react 3.0.0-beta.0 → 3.0.0-beta.2

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 (130) hide show
  1. package/AGENTS.md +19 -2
  2. package/ReadMe.md +95 -54
  3. package/dist/DatePickerPlugin-CpGuQRsi.js +1 -0
  4. package/dist/DatePickerPlugin-DB3nnslN.mjs +1 -0
  5. package/dist/index.d.mts +1232 -474
  6. package/dist/index.d.ts +1232 -474
  7. package/dist/index.js +16 -16
  8. package/dist/index.mjs +15 -15
  9. package/dist/rolldown-runtime-5iZMYShA.js +1 -0
  10. package/dist/style.css +66 -66
  11. package/package.json +1 -1
  12. package/source/Accordion.tsx +161 -0
  13. package/source/Alert.tsx +153 -0
  14. package/source/Avatar.tsx +57 -46
  15. package/source/Badge.tsx +17 -15
  16. package/source/Breadcrumb.tsx +50 -0
  17. package/source/Button.tsx +69 -40
  18. package/source/ButtonGroup.tsx +23 -18
  19. package/source/Card.tsx +86 -17
  20. package/source/Carousel/index.tsx +392 -0
  21. package/source/Carousel/model.ts +113 -0
  22. package/source/Carousel/scroll.ts +79 -0
  23. package/source/CloseButton.tsx +20 -15
  24. package/source/Collapse.tsx +233 -0
  25. package/source/Drawer.tsx +158 -38
  26. package/source/{ClickBoundary.tsx → Extension/ClickBoundary.tsx} +24 -5
  27. package/source/Extension/CodeBlock.tsx +64 -0
  28. package/source/{Countdown.tsx → Extension/Countdown.tsx} +21 -9
  29. package/source/{Dialog.tsx → Extension/Dialog.tsx} +10 -6
  30. package/source/Extension/Editor.tsx +78 -0
  31. package/source/Extension/EditorHTML.tsx +20 -0
  32. package/source/{HorizontalMarquee → Extension/HorizontalMarquee}/index.module.less +1 -3
  33. package/source/Extension/HorizontalMarquee/index.tsx +85 -0
  34. package/source/Extension/Icon.tsx +19 -0
  35. package/source/Extension/Loading.tsx +30 -0
  36. package/source/{MonthCalendar.tsx → Extension/MonthCalendar.tsx} +29 -13
  37. package/source/{Nameplate.tsx → Extension/Nameplate.tsx} +1 -1
  38. package/source/Extension/OverlayBox.tsx +293 -0
  39. package/source/{PageNav.tsx → Extension/PageNav.tsx} +43 -16
  40. package/source/{ScrollNav → Extension/ScrollNav}/Scroller.tsx +21 -5
  41. package/source/Extension/ScrollNav/index.tsx +47 -0
  42. package/source/Extension/Select.tsx +128 -0
  43. package/source/{ShareBox.tsx → Extension/ShareBox.tsx} +1 -1
  44. package/source/Extension/SpinnerButton.tsx +30 -0
  45. package/source/Extension/TableSpinner.tsx +22 -0
  46. package/source/Extension/TextTruncate/index.tsx +29 -0
  47. package/source/Extension/Time.tsx +17 -0
  48. package/source/Extension/TimeDistance.tsx +45 -0
  49. package/source/Extension/Timeline/index.tsx +63 -0
  50. package/source/Extension/TypeEcho/Content.tsx +123 -0
  51. package/source/Extension/TypeEcho/index.tsx +22 -0
  52. package/source/Extension/UserRank/Address.tsx +22 -0
  53. package/source/Extension/UserRank/index.tsx +106 -0
  54. package/source/Extension/VerticalMarquee/index.tsx +23 -0
  55. package/source/Extension/ZodiacBar.tsx +59 -0
  56. package/source/Extension/index.ts +27 -0
  57. package/source/Form/Adorn.tsx +45 -26
  58. package/source/Form/Checkbox.tsx +20 -11
  59. package/source/Form/ChipInput.tsx +129 -0
  60. package/source/Form/Chips.tsx +57 -37
  61. package/source/Form/Combobox.tsx +362 -78
  62. package/source/Form/Control.tsx +72 -42
  63. package/source/Form/DatePicker.tsx +245 -45
  64. package/source/Form/DatePickerPlugin.ts +37 -0
  65. package/source/Form/Feedback.tsx +21 -16
  66. package/source/Form/FloatingLabel.tsx +21 -7
  67. package/source/Form/InputGroup.tsx +162 -11
  68. package/source/Form/OTP.tsx +156 -45
  69. package/source/Form/PasswordStrength.tsx +43 -17
  70. package/source/Form/Plugin.tsx +53 -0
  71. package/source/Form/Primitives.tsx +70 -20
  72. package/source/Form/Radio.tsx +35 -40
  73. package/source/Form/Range.tsx +125 -56
  74. package/source/Form/Switch.tsx +53 -27
  75. package/source/Form/index.ts +1 -0
  76. package/source/Grid.tsx +68 -56
  77. package/source/Image.tsx +10 -6
  78. package/source/ListGroup.tsx +59 -58
  79. package/source/Menu.tsx +317 -46
  80. package/source/NativeDialog/index.tsx +148 -22
  81. package/source/Nav.tsx +49 -33
  82. package/source/NavOverflow/index.tsx +323 -0
  83. package/source/NavOverflow/model.ts +21 -0
  84. package/source/Navbar.tsx +65 -45
  85. package/source/Overlay.ts +163 -1
  86. package/source/Pagination.tsx +86 -0
  87. package/source/Placeholder.tsx +70 -0
  88. package/source/Polymorphic.ts +57 -0
  89. package/source/Popover.tsx +34 -26
  90. package/source/Progress/index.tsx +81 -0
  91. package/source/Progress/style.module.css +15 -0
  92. package/source/ScrollSpy/index.tsx +380 -0
  93. package/source/ScrollSpy/model.ts +17 -0
  94. package/source/Spinner.tsx +31 -17
  95. package/source/Stack.tsx +25 -0
  96. package/source/Stepper.tsx +91 -0
  97. package/source/Tab.tsx +261 -0
  98. package/source/Table.tsx +53 -42
  99. package/source/Toast.tsx +93 -46
  100. package/source/ToggleButton.tsx +47 -30
  101. package/source/Toggler.tsx +117 -0
  102. package/source/Tooltip.tsx +31 -24
  103. package/source/index.ts +17 -27
  104. package/source/CodeBlock.tsx +0 -40
  105. package/source/Editor.tsx +0 -43
  106. package/source/EditorHTML.tsx +0 -16
  107. package/source/HorizontalMarquee/index.tsx +0 -61
  108. package/source/Icon.tsx +0 -24
  109. package/source/Loading.tsx +0 -22
  110. package/source/OverlayBox.tsx +0 -208
  111. package/source/ScrollNav/index.tsx +0 -22
  112. package/source/Select.tsx +0 -95
  113. package/source/SpinnerButton.tsx +0 -35
  114. package/source/TableSpinner.tsx +0 -26
  115. package/source/TextTruncate/index.tsx +0 -25
  116. package/source/Time.tsx +0 -15
  117. package/source/TimeDistance.tsx +0 -41
  118. package/source/Timeline/index.tsx +0 -60
  119. package/source/TypeEcho/Content.tsx +0 -58
  120. package/source/TypeEcho/index.tsx +0 -14
  121. package/source/UserRank/Address.tsx +0 -20
  122. package/source/UserRank/index.tsx +0 -111
  123. package/source/VerticalMarquee/index.tsx +0 -25
  124. package/source/ZodiacBar.tsx +0 -51
  125. /package/source/{LiveTSX.tsx → Extension/LiveTSX.tsx} +0 -0
  126. /package/source/{ScrollNav → Extension/ScrollNav}/index.module.less +0 -0
  127. /package/source/{TextTruncate → Extension/TextTruncate}/Content.tsx +0 -0
  128. /package/source/{Timeline → Extension/Timeline}/index.module.less +0 -0
  129. /package/source/{UserRank → Extension/UserRank}/index.module.less +0 -0
  130. /package/source/{VerticalMarquee → Extension/VerticalMarquee}/index.module.less +0 -0
@@ -1,22 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- import { Nav, NavProps } from '../Nav';
4
- import { ScrollNavScroller } from './Scroller';
5
-
6
- export type ScrollNavProps = NavProps;
7
-
8
- /**
9
- * A horizontal scrolling navigation bar based on Bootstrap's `nav-scroller` pattern.
10
- * Automatically shows scroll arrow buttons when nav items overflow the container width.
11
- *
12
- * @see {@link https://github.com/twbs/bootstrap/blob/main/site/src/assets/examples/offcanvas-navbar/index.astro#L50-L65}
13
- */
14
- export const ScrollNav: FC<ScrollNavProps> = ({ className = '', children, ...props }) => (
15
- <ScrollNavScroller className={className}>
16
- <Nav {...props} className="flex-nowrap">
17
- {children}
18
- </Nav>
19
- </ScrollNavScroller>
20
- );
21
-
22
- ScrollNav.displayName = 'ScrollNav';
package/source/Select.tsx DELETED
@@ -1,95 +0,0 @@
1
- 'use client';
2
-
3
- import classNames from 'classnames';
4
- import {
5
- ButtonHTMLAttributes,
6
- Children,
7
- FC,
8
- isValidElement,
9
- MouseEvent,
10
- ReactElement,
11
- ReactNode
12
- } from 'react';
13
-
14
- import { ButtonProps } from './Button';
15
- import { Menu } from './Menu';
16
-
17
- export interface OptionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
18
- value?: string;
19
- }
20
-
21
- export const Option: FC<OptionProps> = ({ value, className, children, ...props }) => (
22
- <button
23
- {...props}
24
- type="button"
25
- className={classNames('menu-item', className)}
26
- data-value={value}
27
- >
28
- {children}
29
- </button>
30
- );
31
-
32
- Option.displayName = 'Option';
33
-
34
- export type SelectProps = Pick<
35
- ButtonProps,
36
- 'className' | 'style' | 'size' | 'theme' | 'variant' | 'disabled' | 'children'
37
- > & {
38
- align?: 'start' | 'end';
39
- menuClassName?: string;
40
- value?: string;
41
- onChange?: (value: string) => void;
42
- valueRender?: (value: string) => ReactNode;
43
- };
44
-
45
- export const Select: FC<SelectProps> = ({
46
- align,
47
- className,
48
- menuClassName,
49
- children,
50
- theme = 'primary',
51
- variant = 'solid',
52
- size,
53
- disabled,
54
- style,
55
- value,
56
- onChange,
57
- valueRender
58
- }) => {
59
- const current = Children.toArray(children).find(
60
- node =>
61
- isValidElement<OptionProps>(node) && node.type === Option && node.props.value === value
62
- ) as ReactElement<OptionProps> | undefined;
63
-
64
- const handleSelect = ({ target }: MouseEvent<HTMLDivElement>) => {
65
- if (!(target instanceof Element)) return;
66
-
67
- const option = target.closest<HTMLButtonElement>('[data-value]');
68
- if (option) onChange?.(option.dataset.value || '');
69
- };
70
-
71
- return (
72
- <Menu
73
- align={align}
74
- className="w-100"
75
- menuClassName={menuClassName}
76
- label={valueRender?.(value ?? '') ?? current?.props.children}
77
- toggleProps={{
78
- className: classNames(
79
- 'w-100 d-flex justify-content-between align-items-center',
80
- className
81
- ),
82
- theme,
83
- variant,
84
- size,
85
- disabled,
86
- style
87
- }}
88
- onClick={handleSelect}
89
- >
90
- {children}
91
- </Menu>
92
- );
93
- };
94
-
95
- Select.displayName = 'Select';
@@ -1,35 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- import { Button, ButtonProps } from './Button';
4
- import { Spinner, SpinnerProps } from './Spinner';
5
-
6
- export type SpinnerButtonProps = ButtonProps &
7
- Pick<SpinnerProps, 'animation'> & {
8
- loading?: boolean;
9
- };
10
-
11
- export const SpinnerButton: FC<SpinnerButtonProps> = ({
12
- animation,
13
- loading,
14
- disabled,
15
- children,
16
- ...props
17
- }) => (
18
- <Button {...props} disabled={loading || disabled}>
19
- {loading && (
20
- <>
21
- <Spinner
22
- className={children ? 'me-2' : ''}
23
- size="sm"
24
- animation={animation}
25
- role="status"
26
- aria-hidden="true"
27
- />
28
- {!children && <span className="visually-hidden">Loading...</span>}
29
- </>
30
- )}
31
- {children}
32
- </Button>
33
- );
34
-
35
- SpinnerButton.displayName = 'SpinnerButton';
@@ -1,26 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
-
3
- import { Spinner, SpinnerProps } from './Spinner';
4
-
5
- export interface TableSpinnerProps
6
- extends
7
- HTMLAttributes<HTMLTableRowElement>,
8
- Pick<SpinnerProps, 'animation' | 'theme' | 'size'> {
9
- colSpan: number;
10
- }
11
-
12
- export const TableSpinner: FC<TableSpinnerProps> = ({
13
- animation = 'border',
14
- theme = 'primary',
15
- size,
16
- colSpan,
17
- ...props
18
- }) => (
19
- <tr {...props}>
20
- <td className="text-center p-4" colSpan={colSpan}>
21
- <Spinner {...{ animation, theme, size }} role="status" aria-label="Loading" />
22
- </td>
23
- </tr>
24
- );
25
-
26
- TableSpinner.displayName = 'TableSpinner';
@@ -1,25 +0,0 @@
1
- import { FC, HTMLAttributes, ReactNode } from 'react';
2
-
3
- import { TextTruncateContent } from './Content';
4
-
5
- export interface TextTruncateProps extends HTMLAttributes<HTMLDivElement> {
6
- rows?: number;
7
- expandText?: ReactNode;
8
- collapseText?: ReactNode;
9
- }
10
-
11
- export const TextTruncate: FC<TextTruncateProps> = ({
12
- rows = 3,
13
- expandText = '⏬',
14
- collapseText = '⏫',
15
- children,
16
- ...props
17
- }) => (
18
- <div {...props}>
19
- <TextTruncateContent rows={rows} expandText={expandText} collapseText={collapseText}>
20
- {children}
21
- </TextTruncateContent>
22
- </div>
23
- );
24
-
25
- TextTruncate.displayName = 'TextTruncate';
package/source/Time.tsx DELETED
@@ -1,15 +0,0 @@
1
- import { FC, TimeHTMLAttributes } from 'react';
2
- import { formatDate, TimeData } from 'web-utility';
3
-
4
- export interface TimeProps extends Omit<TimeHTMLAttributes<HTMLTimeElement>, 'dateTime'> {
5
- dateTime: TimeData;
6
- format?: string;
7
- }
8
-
9
- export const Time: FC<TimeProps> = ({ dateTime, format, ...props }) => (
10
- <time dateTime={new Date(dateTime).toJSON()} {...props}>
11
- {formatDate(dateTime, format)}
12
- </time>
13
- );
14
-
15
- Time.displayName = 'Time';
@@ -1,41 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
- import { diffTime, TimeData } from 'web-utility';
3
-
4
- export interface TimeDistanceProps extends HTMLAttributes<HTMLTimeElement> {
5
- date: TimeData;
6
- unitWords?: Record<string, string>;
7
- beforeWord?: string;
8
- afterWord?: string;
9
- }
10
-
11
- const UnitWords: Record<string, string> = {
12
- ms: 'millisecond(s)',
13
- s: 'second(s)',
14
- m: 'minute(s)',
15
- H: 'hour(s)',
16
- D: 'day(s)',
17
- W: 'week(s)',
18
- M: 'month(s)',
19
- Y: 'year(s)'
20
- };
21
-
22
- export const TimeDistance: FC<TimeDistanceProps> = ({
23
- date,
24
- unitWords = UnitWords,
25
- beforeWord = ' before',
26
- afterWord = ' after',
27
- ...props
28
- }) => {
29
- date = new Date(date);
30
-
31
- const { distance, unit } = diffTime(date);
32
-
33
- return (
34
- <time {...props} dateTime={date.toJSON()} title={date.toLocaleString()}>
35
- {Math.abs(distance)} {unitWords[unit]}
36
- {distance < 0 ? beforeWord : afterWord}
37
- </time>
38
- );
39
- };
40
-
41
- TimeDistance.displayName = 'TimeDistance';
@@ -1,60 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
- import { TimeData } from 'web-utility';
3
-
4
- import { Card, CardBody, CardText, CardTitle } from '../Card';
5
- import { Nameplate, NameplateProps } from '../Nameplate';
6
- import { Time } from '../Time';
7
- import * as styles from './index.module.less';
8
-
9
- export interface TimelineEvent {
10
- title: string;
11
- summary?: string;
12
- time: [TimeData, TimeData?];
13
-
14
- link?: string;
15
- people?: NameplateProps[];
16
- }
17
-
18
- export interface TimelineProps extends HTMLAttributes<HTMLOListElement> {
19
- events: TimelineEvent[];
20
- timeFormat?: string;
21
- }
22
-
23
- /**
24
- * @see {@link https://mdbootstrap.com/docs/standard/extended/timeline/#section-timeline-gradient-bg}
25
- */
26
- export const Timeline: FC<TimelineProps> = ({ className, events, timeFormat, ...props }) => (
27
- <ol className={`list-unstyled ${styles.timeline} ${className}`} {...props}>
28
- {events.map(({ title, summary, time, link, people }) => (
29
- <li
30
- key={title as string}
31
- className={`position-relative ${styles.timelineItem} ${styles.right}`}
32
- >
33
- <Card>
34
- <CardBody className="p-4 d-flex flex-column gap-3 align-items-center">
35
- <CardTitle className="h5 m-0">
36
- <a className="text-decoration-none stretched-link" href={link}>
37
- {title as string}
38
- </a>
39
- </CardTitle>
40
- <div className="small fg-3 d-flex gap-2">
41
- ⏲️
42
- <Time dateTime={time[0]} format={timeFormat} />
43
- {time[1] && '~'}
44
- {time[1] && <Time dateTime={time[1]} format={timeFormat} />}
45
- </div>
46
- <ul className="list-unstyled m-0 d-flex gap-2 flex-wrap justify-content-around">
47
- {people?.map(person => (
48
- <li key={person.name}>
49
- <Nameplate {...person} />
50
- </li>
51
- ))}
52
- </ul>
53
- <CardText className="m-0">{summary as string}</CardText>
54
- </CardBody>
55
- </Card>
56
- </li>
57
- ))}
58
- </ol>
59
- );
60
- Timeline.displayName = 'Timeline';
@@ -1,58 +0,0 @@
1
- 'use client';
2
-
3
- import classNames from 'classnames';
4
- import { action, observable } from 'mobx';
5
- import { observer } from 'mobx-react';
6
- import { Component, HTMLAttributes, RefCallback } from 'react';
7
- import { sleep } from 'web-utility';
8
-
9
- export interface TypeEchoContentProps extends Omit<HTMLAttributes<HTMLPreElement>, 'children'> {
10
- text: string;
11
- intervals?: number;
12
- }
13
-
14
- @observer
15
- export class TypeEchoContent extends Component<TypeEchoContentProps> {
16
- @observable
17
- accessor echoed = '';
18
-
19
- @observable
20
- accessor started = false;
21
-
22
- componentDidMount() {
23
- this.start();
24
- }
25
-
26
- start = action(() => (this.started = true));
27
-
28
- echo = action((char: string) => (this.echoed += char));
29
-
30
- init: RefCallback<HTMLPreElement> = node => {
31
- if (!node) return;
32
-
33
- new IntersectionObserver(async ([{ isIntersecting }], observer) => {
34
- if (!isIntersecting) return;
35
-
36
- observer.disconnect();
37
-
38
- const { text, intervals = 150 } = this.props;
39
-
40
- for (const char of text) {
41
- await sleep(intervals / 1000);
42
-
43
- this.echo(char);
44
- }
45
- }).observe(node);
46
- };
47
-
48
- render() {
49
- const { className, text, intervals: _intervals, ...props } = this.props;
50
- const { started, echoed } = this;
51
-
52
- return (
53
- <pre {...props} ref={this.init} className={classNames('text-wrap', className)}>
54
- {started ? echoed + (echoed === text ? '' : '_') : text}
55
- </pre>
56
- );
57
- }
58
- }
@@ -1,14 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
-
3
- import { TypeEchoContent } from './Content';
4
-
5
- export interface TypeEchoProps extends HTMLAttributes<HTMLPreElement> {
6
- text: string;
7
- intervals?: number;
8
- }
9
-
10
- export const TypeEcho: FC<TypeEchoProps> = ({ text, intervals, ...props }) => (
11
- <TypeEchoContent {...props} text={text} intervals={intervals} />
12
- );
13
-
14
- TypeEcho.displayName = 'TypeEcho';
@@ -1,20 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- import { Icon } from '../Icon';
4
-
5
- export type UserAddressProps = Partial<Record<'email' | 'website', string>>;
6
-
7
- export const UserAddress: FC<UserAddressProps> = ({ email, website }) => (
8
- <address className="mb-0 d-flex justify-content-around gap-2">
9
- {email && (
10
- <a rel="noreferrer" target="_blank" href={'mailto:' + email}>
11
- <Icon name="envelope" />
12
- </a>
13
- )}
14
- {website && (
15
- <a rel="noreferrer" target="_blank" href={website}>
16
- <Icon name="globe2" />
17
- </a>
18
- )}
19
- </address>
20
- );
@@ -1,111 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
-
3
- import { Badge } from '../Badge';
4
- import { Col, Container, Row } from '../Grid';
5
- import { Image } from '../Image';
6
- import { Table } from '../Table';
7
- import { UserAddress, UserAddressProps } from './Address';
8
- import * as style from './index.module.less';
9
-
10
- export interface UserRank extends UserAddressProps {
11
- id: number | string;
12
- name: string;
13
- avatar?: string;
14
- score: number;
15
- }
16
-
17
- export interface UserRankViewProps extends HTMLAttributes<HTMLDivElement> {
18
- title: string;
19
- rank: UserRank[];
20
- linkOf?: (user: UserRank) => string;
21
- }
22
-
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">
32
- <div className={`shadow-lg overflow-hidden rounded-circle m-auto ${style.image}`}>
33
- <Image src={user.avatar} alt={user.name} loading="lazy" fluid />
34
- </div>
35
- <div className={`position-relative overflow-hidden ${style.topUser}`}>
36
- <div className="position-relative">
37
- <i className="d-block overflow-hidden m-auto mb-1 rounded-circle" />
38
- <a className="d-block mb-0 stretched-link" href={linkOf?.(user) || '#'}>
39
- {user.name}
40
- </a>
41
- <strong>{user.score}</strong>
42
- </div>
43
- <UserAddress {...user} />
44
- </div>
45
- </li>
46
- );
47
-
48
- const renderRow = (user: UserRank, index: number, { length }: UserRank[]) => (
49
- <tr key={user.id} className="position-relative">
50
- <td className="align-middle">
51
- <Badge className="fw-bold fst-italic">
52
- {(index + 4 + '').padStart((length + '').length, '0')}
53
- </Badge>
54
- </td>
55
- <td className={`position-relative text-truncate ${style.name}`}>
56
- <div
57
- className={`d-inline-block overflow-hidden align-middle rounded-circle ${style.image}`}
58
- >
59
- <Image src={user.avatar} alt={user.name} loading="lazy" fluid />
60
- </div>
61
- <a
62
- className="ms-2 d-inline-block align-middle stretched-link"
63
- style={{
64
- color: `rgb(248, ${(index + 2) * 15}, ${(index + 2) * 35})`
65
- }}
66
- href={linkOf?.(user) || '#'}
67
- >
68
- {user.name}
69
- </a>
70
- </td>
71
- <td className="align-middle">{user.score}</td>
72
- <td className="align-middle">
73
- <UserAddress {...user} />
74
- </td>
75
- </tr>
76
- );
77
-
78
- return (
79
- <Container className={className} {...props}>
80
- <Row className={style.rankBox}>
81
- <Col span={12} lg={7}>
82
- <div className={`shadow rounded-3 ${style.title}`}>
83
- <div className={style.medal}>
84
- <i className="d-inline-block ms-1 overflow-hidden rounded-circle" />
85
- <i className="d-inline-block ms-1 overflow-hidden rounded-circle" />
86
- <i className="d-inline-block ms-1 overflow-hidden rounded-circle" />
87
- </div>
88
- <h3
89
- data-text={title}
90
- className="position-relative m-auto mb-0 fw-bold text-center"
91
- >
92
- {title}
93
- </h3>
94
- </div>
95
- <ul
96
- className={`row mt-2 g-0 align-items-end text-center ps-0 pt-2 list-unstyled ${style.topUsers}`}
97
- >
98
- {rank.slice(0, 3).map(renderMedal)}
99
- </ul>
100
- </Col>
101
- <Col span={12} lg={5}>
102
- <Table className={`my-3 pt-2 ${style.restUsers}`} responsive>
103
- <tbody>{rank.slice(3, 10).map(renderRow)}</tbody>
104
- </Table>
105
- </Col>
106
- </Row>
107
- </Container>
108
- );
109
- };
110
-
111
- UserRankView.displayName = 'UserRankView';
@@ -1,25 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
-
3
- import * as style from './index.module.less';
4
-
5
- export interface VerticalMarqueeProps extends HTMLAttributes<HTMLDivElement> {
6
- duration?: string;
7
- }
8
-
9
- export const VerticalMarquee: FC<VerticalMarqueeProps> = ({
10
- className = '',
11
- children,
12
- duration,
13
- ...props
14
- }) => (
15
- <div className={`overflow-hidden h-100 ${className}`} {...props}>
16
- <div
17
- className={`d-inline-block max-w-100 max-h-100 ${style.scrollWrap}`}
18
- // @ts-expect-error remove after React 19 released
19
- style={{ '--duration': duration }}
20
- >
21
- <div className={`d-inline-block ${style.scrollItem}`}>{children}</div>
22
- </div>
23
- </div>
24
- );
25
- VerticalMarquee.displayName = 'VerticalMarquee';
@@ -1,51 +0,0 @@
1
- import { FC, HTMLAttributes, ReactNode } from 'react';
2
-
3
- export const ZodiacSigns = ['🐵', '🐔', '🐶', '🐷', '🐭', '🐮', '🐯', '🐰', '🐲', '🐍', '🐴', '🐐'];
4
-
5
- export const zodiacOf = (year: number) => {
6
- // Historical year numbering has no year 0: 1 BCE is represented as year -1.
7
- const astronomicalYear = year < 0 ? year + 1 : year;
8
-
9
- return ZodiacSigns[((astronomicalYear % 12) + 12) % 12];
10
- };
11
-
12
- export interface ZodiacBarProps extends HTMLAttributes<HTMLOListElement> {
13
- itemClassName?: string;
14
- startYear: number;
15
- endYear?: number;
16
- itemOf?: (year: number, zodiac: string) => { link?: string; title?: ReactNode };
17
- }
18
-
19
- export const ZodiacBar: FC<ZodiacBarProps> = ({
20
- className = '',
21
- itemClassName = 'border rounded px-4 py-3 d-flex flex-column justify-content-center align-items-center',
22
- startYear,
23
- endYear = new Date().getFullYear(),
24
- itemOf,
25
- ...props
26
- }) => (
27
- <ol
28
- className={`list-unstyled m-0 d-flex flex-wrap justify-content-center gap-3 ${className}`}
29
- {...props}
30
- >
31
- {Array.from({ length: endYear - startYear + 1 }, (_, index) => {
32
- const year = endYear - index;
33
-
34
- if (year === 0) return null;
35
-
36
- const zodiac = zodiacOf(year);
37
- const { link = '#', title } = itemOf?.(year, zodiac) || {};
38
-
39
- return (
40
- <li key={year} className={itemClassName}>
41
- <a className="d-inline-block p-3 text-decoration-none text-center" href={link}>
42
- <div className="fs-3xl">{zodiac}</div>
43
-
44
- {title}
45
- </a>
46
- </li>
47
- );
48
- })}
49
- </ol>
50
- );
51
- ZodiacBar.displayName = 'ZodiacBar';
File without changes