idea-react 3.0.0-rc.2 → 3.0.0-rc.4
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 +93 -5
- package/ReadMe.md +53 -34
- package/dist/index.d.mts +108 -43
- package/dist/index.d.ts +108 -43
- package/dist/index.js +13 -13
- package/dist/index.mjs +12 -12
- package/dist/style.css +1 -1
- package/package.json +10 -10
- package/source/Base/Carousel/index.tsx +98 -78
- package/source/Base/Carousel/model.ts +245 -65
- package/source/Base/Carousel/scroll.ts +174 -28
- package/source/Base/{NativeDialog → Dialog}/index.tsx +11 -11
- package/source/Base/Drawer.tsx +5 -5
- package/source/Base/index.ts +1 -1
- package/source/Content/Figure.tsx +1 -1
- package/source/Content/index.ts +1 -1
- package/source/Extension/Dialog.tsx +5 -5
- package/source/Extension/PageNav.tsx +8 -7
- package/source/Extension/ShareBox.tsx +1 -1
- package/source/Extension/UserRank/index.tsx +1 -1
- /package/source/Base/{NativeDialog → Dialog}/style.module.css +0 -0
- /package/source/Content/{Images.tsx → Image.tsx} +0 -0
package/source/Base/Drawer.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { Component, ComponentPropsWithRef, createRef, ElementType, ReactNode } f
|
|
|
8
8
|
import { AsProps, polymorphic, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
9
9
|
import { Breakpoint } from '../Layout/Grid';
|
|
10
10
|
import { CloseButton } from './CloseButton';
|
|
11
|
-
import {
|
|
11
|
+
import { Dialog, DialogProps } from './Dialog';
|
|
12
12
|
|
|
13
13
|
export type DrawerPlacement = 'start' | 'end' | 'top' | 'bottom';
|
|
14
14
|
|
|
@@ -41,7 +41,7 @@ export const DrawerFooter = polymorphic<ComponentPropsWithRef<'div'>>(
|
|
|
41
41
|
DrawerFooter.displayName = 'DrawerFooter';
|
|
42
42
|
|
|
43
43
|
export interface DrawerProps extends Omit<
|
|
44
|
-
|
|
44
|
+
DialogProps,
|
|
45
45
|
'dialog' | 'onClose' | 'title' | 'animation' | 'fullscreen'
|
|
46
46
|
> {
|
|
47
47
|
title?: ReactNode;
|
|
@@ -78,7 +78,7 @@ export class Drawer<T extends ElementType | undefined = 'dialog'> extends Compon
|
|
|
78
78
|
|
|
79
79
|
@observable accessor expanded = false;
|
|
80
80
|
|
|
81
|
-
dialog = createRef<
|
|
81
|
+
dialog = createRef<Dialog<ElementType>>();
|
|
82
82
|
media?: MediaQueryList;
|
|
83
83
|
dismissed = false;
|
|
84
84
|
|
|
@@ -146,7 +146,7 @@ export class Drawer<T extends ElementType | undefined = 'dialog'> extends Compon
|
|
|
146
146
|
} = this.componentProps;
|
|
147
147
|
|
|
148
148
|
return (
|
|
149
|
-
<
|
|
149
|
+
<Dialog
|
|
150
150
|
as={this.componentProps.as}
|
|
151
151
|
{...props}
|
|
152
152
|
ref={this.dialog}
|
|
@@ -176,7 +176,7 @@ export class Drawer<T extends ElementType | undefined = 'dialog'> extends Compon
|
|
|
176
176
|
</DrawerHeader>
|
|
177
177
|
<DrawerBody className={bodyClassName}>{children}</DrawerBody>
|
|
178
178
|
{footer && <DrawerFooter>{footer}</DrawerFooter>}
|
|
179
|
-
</
|
|
179
|
+
</Dialog>
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
}
|
package/source/Base/index.ts
CHANGED
|
@@ -9,11 +9,11 @@ export * from './Card';
|
|
|
9
9
|
export * from './Carousel';
|
|
10
10
|
export * from './CloseButton';
|
|
11
11
|
export * from './Collapse';
|
|
12
|
+
export * from './Dialog';
|
|
12
13
|
export * from './Drawer';
|
|
13
14
|
export * from './Fade';
|
|
14
15
|
export * from './ListGroup';
|
|
15
16
|
export * from './Menu';
|
|
16
|
-
export * from './NativeDialog';
|
|
17
17
|
export * from './Nav';
|
|
18
18
|
export * from './Navbar';
|
|
19
19
|
export * from './NavOverflow';
|
|
@@ -2,7 +2,7 @@ import classNames from 'classnames';
|
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
-
import { Image, ImageProps } from './
|
|
5
|
+
import { Image, ImageProps } from './Image';
|
|
6
6
|
|
|
7
7
|
export type FigureProps = ComponentPropsWithRef<'figure'>;
|
|
8
8
|
|
package/source/Content/index.ts
CHANGED
|
@@ -3,17 +3,17 @@ import { action, observable } from 'mobx';
|
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { FC } from 'react';
|
|
5
5
|
|
|
6
|
-
export class
|
|
6
|
+
export class DialogBoxClose extends Error {
|
|
7
7
|
constructor(message = 'Dialog closed') {
|
|
8
8
|
super(message);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface DialogBoxProps<T = unknown> {
|
|
13
13
|
defer?: Defer<T>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export class
|
|
16
|
+
export class DialogBox<I extends object = {}, O = unknown> {
|
|
17
17
|
@observable
|
|
18
18
|
accessor input = {} as I;
|
|
19
19
|
|
|
@@ -22,11 +22,11 @@ export class Dialog<I extends object = {}, O = unknown> {
|
|
|
22
22
|
|
|
23
23
|
Component: FC<I>;
|
|
24
24
|
|
|
25
|
-
constructor(Factory: FC<I &
|
|
25
|
+
constructor(Factory: FC<I & DialogBoxProps<O>>) {
|
|
26
26
|
this.Component = observer(props => (
|
|
27
27
|
<Factory {...props} {...this.input} defer={this.defer} />
|
|
28
28
|
));
|
|
29
|
-
this.Component.displayName = '
|
|
29
|
+
this.Component.displayName = 'DialogBoxComponent';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
@action
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { action, computed, observable } from 'mobx';
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
|
-
import { Component, ElementType } from 'react';
|
|
7
|
-
import {
|
|
6
|
+
import { Component, ElementType, MouseEvent } from 'react';
|
|
7
|
+
import { uniqueID } from 'web-utility';
|
|
8
8
|
|
|
9
9
|
import { Nav, NavLink, NavProps } from '../Base/Nav';
|
|
10
10
|
import { AsProps, PolymorphicClassProps } from '../Helper/Polymorphic';
|
|
@@ -104,13 +104,14 @@ export class PageNav<T extends ElementType | undefined = 'nav'> extends Componen
|
|
|
104
104
|
window.removeEventListener('resize', this.updateScrollY);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
handleItemClick = ({ currentTarget }: MouseEvent<HTMLAnchorElement>) => {
|
|
108
|
+
const id = currentTarget.hash.slice(1);
|
|
109
|
+
const meta = this.list.find(item => item.id === id);
|
|
109
110
|
|
|
110
|
-
this.componentProps.onItemClick?.(meta);
|
|
111
|
+
if (meta) this.componentProps.onItemClick?.(meta);
|
|
111
112
|
};
|
|
112
113
|
|
|
113
|
-
renderLink = ({ id, level, text
|
|
114
|
+
renderLink = ({ id, level, text }: HeadingMeta) => {
|
|
114
115
|
const { currentActiveId } = this,
|
|
115
116
|
{ depth = Infinity, minDepth = 1 } = this.componentProps;
|
|
116
117
|
|
|
@@ -126,7 +127,7 @@ export class PageNav<T extends ElementType | undefined = 'nav'> extends Componen
|
|
|
126
127
|
style={{ paddingInlineStart: `${level - minDepth + 0.75}rem` }}
|
|
127
128
|
href={`#${id}`}
|
|
128
129
|
aria-current={currentActiveId === id ? 'location' : undefined}
|
|
129
|
-
onClick={this.
|
|
130
|
+
onClick={this.handleItemClick}
|
|
130
131
|
>
|
|
131
132
|
{text}
|
|
132
133
|
</NavLink>
|
|
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
import { Component, createRef, HTMLAttributes, MouseEvent } from 'react';
|
|
7
7
|
import { blobOf } from 'web-utility';
|
|
8
8
|
|
|
9
|
-
import { Image } from '../Content/
|
|
9
|
+
import { Image } from '../Content/Image';
|
|
10
10
|
import { Loading } from './Loading';
|
|
11
11
|
|
|
12
12
|
export async function elementToImage(element: HTMLElement, type?: string, quality?: number) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Badge } from '../../Base/Badge';
|
|
4
|
-
import { Image } from '../../Content/
|
|
4
|
+
import { Image } from '../../Content/Image';
|
|
5
5
|
import { Table } from '../../Content/Tables';
|
|
6
6
|
import { polymorphic } from '../../Helper/Polymorphic';
|
|
7
7
|
import { Col, Container, Row } from '../../Layout/Grid';
|
|
File without changes
|
|
File without changes
|