musae 0.2.6 → 0.2.8
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/dist/components/avatar/avatar.js +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/breadcrumb/item.js +1 -1
- package/dist/components/button/button.js +13 -16
- package/dist/components/calendar/calendar.js +1 -1
- package/dist/components/calendar/hooks.js +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +203 -143
- package/dist/components/checkbox/group.d.ts +1 -1
- package/dist/components/checkbox/group.js +20 -19
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/types.d.ts +24 -1
- package/dist/components/clock/column.js +1 -1
- package/dist/components/collapse/collapse.js +1 -1
- package/dist/components/collapse/item.js +14 -8
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dialog/popup.js +2 -2
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +1 -1
- package/dist/components/drawer/popup.js +2 -2
- package/dist/components/empty/empty.js +1 -1
- package/dist/components/floating-action-button/floatable.d.ts +4 -0
- package/dist/components/floating-action-button/floatable.js +83 -0
- package/dist/components/floating-action-button/floating-action-button.d.ts +4 -0
- package/dist/components/floating-action-button/floating-action-button.js +26 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/types.d.ts +44 -0
- package/dist/components/form/field/error.d.ts +2 -2
- package/dist/components/form/field/error.js +36 -22
- package/dist/components/form/field/field.js +6 -21
- package/dist/components/form/field/layout.js +1 -1
- package/dist/components/grid/col.js +1 -1
- package/dist/components/grid/row.js +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/icon/icon.js +5 -3
- package/dist/components/icon/types.d.ts +6 -1
- package/dist/components/image/preview/operations.js +2 -2
- package/dist/components/image/preview/preview.js +1 -1
- package/dist/components/input/input.d.ts +6 -6
- package/dist/components/input/input.js +9 -15
- package/dist/components/layout/header.js +1 -1
- package/dist/components/layout/layout.js +1 -1
- package/dist/components/loading/loading.js +1 -1
- package/dist/components/menu/group.js +14 -8
- package/dist/components/menu/hooks.js +1 -1
- package/dist/components/menu/item.js +1 -1
- package/dist/components/notification/holder.js +2 -3
- package/dist/components/notification/notification.js +1 -1
- package/dist/components/otp-input/otp-input.js +1 -1
- package/dist/components/pagination/hooks.d.ts +4 -2
- package/dist/components/pagination/hooks.js +9 -4
- package/dist/components/pagination/item.js +6 -8
- package/dist/components/pagination/pagination.d.ts +1 -1
- package/dist/components/pagination/pagination.js +37 -9
- package/dist/components/pagination/types.d.ts +6 -0
- package/dist/components/picker/picker.js +2 -2
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/popper/dropdown.js +1 -1
- package/dist/components/popper/popper.js +1 -1
- package/dist/components/portal/portal.js +6 -2
- package/dist/components/portal/types.d.ts +6 -0
- package/dist/components/progress/circular.js +1 -1
- package/dist/components/progress/linear.js +1 -1
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/rate/rate.js +1 -1
- package/dist/components/rate/star.js +1 -1
- package/dist/components/ripple/ripple.js +1 -1
- package/dist/components/select/hooks.d.ts +2 -2
- package/dist/components/select/hooks.js +3 -3
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +4 -5
- package/dist/components/select/selector.d.ts +3 -6
- package/dist/components/select/selector.js +16 -10
- package/dist/components/select/types.d.ts +2 -2
- package/dist/components/space/space.js +1 -1
- package/dist/components/steps/item.d.ts +1 -1
- package/dist/components/steps/item.js +46 -31
- package/dist/components/steps/steps.d.ts +1 -1
- package/dist/components/steps/steps.js +6 -4
- package/dist/components/steps/types.d.ts +15 -0
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table/body.js +1 -1
- package/dist/components/table/header/cell.js +1 -1
- package/dist/components/table/header/header.js +1 -1
- package/dist/components/tabs/hooks.js +5 -5
- package/dist/components/tabs/navigation.js +1 -1
- package/dist/components/tabs/panels.js +1 -1
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/theme/tokens.stylex.d.ts +1 -0
- package/dist/components/time-picker/panel.js +1 -1
- package/dist/components/time-picker/time-picker.js +1 -1
- package/dist/components/timeline/item.js +30 -14
- package/dist/components/timeline/timeline.d.ts +1 -1
- package/dist/components/timeline/timeline.js +5 -3
- package/dist/components/timeline/types.d.ts +10 -0
- package/dist/components/tour/tour.js +3 -2
- package/dist/components/transfer/context.d.ts +6 -0
- package/dist/components/transfer/context.js +11 -0
- package/dist/components/transfer/hooks.d.ts +19 -0
- package/dist/components/transfer/hooks.js +49 -0
- package/dist/components/transfer/index.d.ts +2 -0
- package/dist/components/transfer/item.d.ts +4 -0
- package/dist/components/transfer/item.js +25 -0
- package/dist/components/transfer/list.d.ts +4 -0
- package/dist/components/transfer/list.js +122 -0
- package/dist/components/transfer/transfer.d.ts +4 -0
- package/dist/components/transfer/transfer.js +82 -0
- package/dist/components/transfer/types.d.ts +87 -0
- package/dist/components/tree/list.js +14 -7
- package/dist/components/tree/node.js +1 -1
- package/dist/components/waterfall/sequential.js +1 -1
- package/dist/components/waterfall/waterfall.js +1 -1
- package/dist/hooks/use-class-names.d.ts +17 -1
- package/dist/hooks/use-container.d.ts +11 -0
- package/dist/hooks/use-container.js +23 -0
- package/dist/hooks/use-expandable.d.ts +11 -0
- package/dist/hooks/use-expandable.js +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/stylex.css +20 -15
- package/dist/utils/class-name.d.ts +59 -10
- package/dist/utils/class-name.js +40 -6
- package/package.json +12 -5
- package/dist/hooks/use-expand-effect.d.ts +0 -12
- package/dist/hooks/use-expand-effect.js +0 -34
- /package/dist/node_modules/.pnpm/{@aiszlab_relax@1.2.56_react-dom@18.3.1_react@18.3.1 → @aiszlab_relax@1.2.59_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/@aiszlab/relax/dist/dom/contains.js +0 -0
- /package/dist/node_modules/.pnpm/{@stylexjs_stylex@0.7.4 → @stylexjs_stylex@0.7.5}/node_modules/@stylexjs/stylex/lib/es/stylex.js +0 -0
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
|
2
2
|
import { useInputEvents, useWrapperEvents } from './hooks.js';
|
|
3
3
|
import { useControlledState, useFocus } from '@aiszlab/relax';
|
|
4
4
|
import { ComponentToken, InputClassToken } from '../../utils/class-name.js';
|
|
5
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
5
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import { sizes } from '../theme/tokens.stylex.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -12,11 +12,9 @@ import { typography } from '../theme/theme.js';
|
|
|
12
12
|
|
|
13
13
|
const styles = {
|
|
14
14
|
wrapper: props => [{
|
|
15
|
-
display: "musae-
|
|
15
|
+
display: "musae-3nfvp2",
|
|
16
16
|
alignItems: "musae-6s0dn4",
|
|
17
17
|
cursor: "musae-1ed109x",
|
|
18
|
-
minHeight: "musae-1v3fk47",
|
|
19
|
-
minWidth: "musae-1fpxtso",
|
|
20
18
|
borderRadius: "musae-7bdoj",
|
|
21
19
|
borderStartStartRadius: null,
|
|
22
20
|
borderStartEndRadius: null,
|
|
@@ -26,6 +24,10 @@ const styles = {
|
|
|
26
24
|
borderTopRightRadius: null,
|
|
27
25
|
borderBottomLeftRadius: null,
|
|
28
26
|
borderBottomRightRadius: null,
|
|
27
|
+
verticalAlign: "musae-3ajldb",
|
|
28
|
+
minHeight: "musae-1v3fk47",
|
|
29
|
+
minWidth: "musae-1fpxtso",
|
|
30
|
+
maxWidth: "musae-kfv0gj",
|
|
29
31
|
boxShadow: "musae-igitpm",
|
|
30
32
|
margin: "musae-ieb5ut",
|
|
31
33
|
marginInline: null,
|
|
@@ -44,21 +46,13 @@ const styles = {
|
|
|
44
46
|
paddingLeft: null,
|
|
45
47
|
paddingEnd: null,
|
|
46
48
|
paddingRight: null,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
transitionDelay: null,
|
|
50
|
-
transitionDuration: null,
|
|
51
|
-
transitionProperty: null,
|
|
52
|
-
transitionTimingFunction: null,
|
|
49
|
+
transitionProperty: "musae-kdsq27",
|
|
50
|
+
transitionDuration: "musae-13dflua",
|
|
53
51
|
willChange: "musae-1o9dqaq",
|
|
54
52
|
$$css: true
|
|
55
53
|
}, {
|
|
56
54
|
"--boxShadow": `inset 0px 0px 0px ${sizes.smallest} ${props.outlineColor}` != null ? `inset 0px 0px 0px ${sizes.smallest} ${props.outlineColor}` : "initial"
|
|
57
55
|
}],
|
|
58
|
-
flexible: {
|
|
59
|
-
minWidth: null,
|
|
60
|
-
$$css: true
|
|
61
|
-
},
|
|
62
56
|
focused: props => [{
|
|
63
57
|
boxShadow: "musae-igitpm",
|
|
64
58
|
$$css: true
|
|
@@ -182,7 +176,7 @@ const Input = forwardRef(({
|
|
|
182
176
|
className: "musae-jbqb8w musae-ohadnq musae-2vzm80 musae-yumy05 musae-1vwksmh musae-98rzlu"
|
|
183
177
|
}
|
|
184
178
|
};
|
|
185
|
-
return React.createElement("
|
|
179
|
+
return React.createElement("span", {
|
|
186
180
|
ref: wrapperRef,
|
|
187
181
|
className: clsx(classNames[InputClassToken.Wrapper], {
|
|
188
182
|
[classNames[InputClassToken.Focused]]: isFocused,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useTheme } from '../theme/hooks.js';
|
|
3
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
3
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
import { ColorToken } from '../../utils/colors.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Grid } from '../grid/index.js';
|
|
3
3
|
import { useChildren, ChildToken } from './hooks.js';
|
|
4
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import { useTheme } from '../theme/hooks.js';
|
|
6
6
|
import { ColorToken } from '../../utils/colors.js';
|
|
7
7
|
import clsx from 'clsx';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
2
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, LoadingClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -5,9 +5,9 @@ import { ComponentToken, MenuClassToken } from '../../utils/class-name.js';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import Item from './item.js';
|
|
7
7
|
import { useMenuContext } from './hooks.js';
|
|
8
|
-
import { useRefs } from '@aiszlab/relax';
|
|
9
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
10
|
-
import {
|
|
8
|
+
import { useRefs, useUpdateEffect } from '@aiszlab/relax';
|
|
9
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
10
|
+
import { useExpandable } from '../../hooks/use-expandable.js';
|
|
11
11
|
import { useTheme } from '../theme/hooks.js';
|
|
12
12
|
import { ColorToken } from '../../utils/colors.js';
|
|
13
13
|
|
|
@@ -110,11 +110,17 @@ const Group = forwardRef(({
|
|
|
110
110
|
const groupRef = useRefs(ref, scope);
|
|
111
111
|
const theme = useTheme();
|
|
112
112
|
const isInline = mode === "inline";
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
const {
|
|
114
|
+
expand,
|
|
115
|
+
collapse
|
|
116
|
+
} = useExpandable();
|
|
117
|
+
useUpdateEffect(async () => {
|
|
118
|
+
if (expanded) {
|
|
119
|
+
await expand([scope, animate]);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
await collapse([scope, animate]);
|
|
123
|
+
}, [expanded]);
|
|
118
124
|
const styled = {
|
|
119
125
|
group: props(styles.group.default({
|
|
120
126
|
color: theme.colors[ColorToken.OnSurface]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useContext } from 'react';
|
|
2
2
|
import Context from './context.js';
|
|
3
3
|
import { useControlledState } from '@aiszlab/relax';
|
|
4
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import KeyboardArrowUp from '../icon/icons/hardware/keyboard-arrow-up.js';
|
|
6
6
|
|
|
7
7
|
const styles = {
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useRef } from 'react';
|
|
|
2
2
|
import { useMenuContext, useItemChildren } from './hooks.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, MenuClassToken } from '../../utils/class-name.js';
|
|
5
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
5
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import { sizes, spacing } from '../theme/tokens.stylex.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useState, useImperativeHandle } from 'react';
|
|
|
2
2
|
import Portal from '../portal/portal.js';
|
|
3
3
|
import { AnimatePresence } from 'framer-motion';
|
|
4
4
|
import Notification from './notification.js';
|
|
5
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
5
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import { useEvent } from '@aiszlab/relax';
|
|
7
7
|
|
|
8
8
|
const styles = {
|
|
@@ -114,8 +114,7 @@ const Holder = forwardRef((_, ref) => {
|
|
|
114
114
|
return React.createElement(Portal, {
|
|
115
115
|
destroyable: true,
|
|
116
116
|
open: notifications.size > 0,
|
|
117
|
-
key: placement
|
|
118
|
-
lockable: false
|
|
117
|
+
key: placement
|
|
119
118
|
}, React.createElement("div", {
|
|
120
119
|
className: styled.className,
|
|
121
120
|
style: styled.style
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
1
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
2
|
import React, { useEffect, createElement } from 'react';
|
|
3
3
|
import { usePresence, useAnimate } from 'framer-motion';
|
|
4
4
|
import { useTheme } from '../theme/hooks.js';
|
|
@@ -5,11 +5,11 @@ import { type PaginationItems } from "./types";
|
|
|
5
5
|
* @description
|
|
6
6
|
* use pagination
|
|
7
7
|
*/
|
|
8
|
-
export declare const usePagiantion: ({ total, siblings, boundaries,
|
|
8
|
+
export declare const usePagiantion: ({ total, siblings, boundaries, pageSize: _pageSize, }: {
|
|
9
9
|
total: number;
|
|
10
10
|
siblings: number;
|
|
11
11
|
boundaries: number;
|
|
12
|
-
pageSize
|
|
12
|
+
pageSize?: number;
|
|
13
13
|
}) => {
|
|
14
14
|
paginationItems: PaginationItems;
|
|
15
15
|
add: (step?: number) => void;
|
|
@@ -18,4 +18,6 @@ export declare const usePagiantion: ({ total, siblings, boundaries, ...props }:
|
|
|
18
18
|
page: number;
|
|
19
19
|
hasPrev: boolean;
|
|
20
20
|
hasNext: boolean;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
21
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCounter, range, clamp } from '@aiszlab/relax';
|
|
1
|
+
import { useControlledState, useCounter, range, clamp } from '@aiszlab/relax';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { PaginationItemType } from './types.js';
|
|
4
4
|
|
|
@@ -8,9 +8,9 @@ import { PaginationItemType } from './types.js';
|
|
|
8
8
|
* @description
|
|
9
9
|
* use pagination
|
|
10
10
|
*/
|
|
11
|
-
const usePagiantion = ({ total, siblings, boundaries,
|
|
12
|
-
const pageSize =
|
|
13
|
-
const pages = Math.ceil(total / pageSize);
|
|
11
|
+
const usePagiantion = ({ total, siblings, boundaries, pageSize: _pageSize, }) => {
|
|
12
|
+
const [pageSize, setPageSize] = useControlledState(_pageSize, { defaultState: 10 });
|
|
13
|
+
const pages = useMemo(() => Math.ceil(total / Math.max(1, pageSize)), [total, pageSize]);
|
|
14
14
|
const [page, { add, subtract, setCount }] = useCounter(1, {
|
|
15
15
|
min: 1,
|
|
16
16
|
max: pages,
|
|
@@ -40,6 +40,9 @@ const usePagiantion = ({ total, siblings, boundaries, ...props }) => {
|
|
|
40
40
|
const hasPrev = page > 1;
|
|
41
41
|
// whether next button is usable
|
|
42
42
|
const hasNext = page < pages;
|
|
43
|
+
const onPageSizeChange = (pageSize) => {
|
|
44
|
+
setPageSize(pageSize);
|
|
45
|
+
};
|
|
43
46
|
return {
|
|
44
47
|
paginationItems,
|
|
45
48
|
add,
|
|
@@ -48,6 +51,8 @@ const usePagiantion = ({ total, siblings, boundaries, ...props }) => {
|
|
|
48
51
|
page,
|
|
49
52
|
hasPrev,
|
|
50
53
|
hasNext,
|
|
54
|
+
pageSize,
|
|
55
|
+
onPageSizeChange,
|
|
51
56
|
};
|
|
52
57
|
};
|
|
53
58
|
|
|
@@ -37,10 +37,7 @@ const Item = ({
|
|
|
37
37
|
if (value === PaginationItemType.MorePrev || value === PaginationItemType.MoreNext) {
|
|
38
38
|
const styled = {
|
|
39
39
|
more: {
|
|
40
|
-
className: "musae-
|
|
41
|
-
},
|
|
42
|
-
hidden: {
|
|
43
|
-
className: "musae-1s85apg"
|
|
40
|
+
className: "musae-1aldg33 musae-1oew0n0"
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
43
|
const isNegative = value === PaginationItemType.MorePrev;
|
|
@@ -51,11 +48,12 @@ const Item = ({
|
|
|
51
48
|
className: styled.more.className,
|
|
52
49
|
style: styled.more.style,
|
|
53
50
|
onClick: () => {
|
|
54
|
-
isNegative ?
|
|
51
|
+
isNegative ? subtract(5) : add(5);
|
|
55
52
|
}
|
|
56
|
-
}, React.createElement(MoreHoriz,
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
}, React.createElement(MoreHoriz, {
|
|
54
|
+
role: "separator"
|
|
55
|
+
}), createElement(isNegative ? KeyboardDoubleArrowLeft : KeyboardDoubleArrowRight, {
|
|
56
|
+
role: "button"
|
|
59
57
|
}));
|
|
60
58
|
}
|
|
61
59
|
return React.createElement(Button, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PagiantionProps } from "./types";
|
|
3
|
-
declare const Pagination: ({ total, siblings, boundaries, pageSize }: PagiantionProps) => React.JSX.Element;
|
|
3
|
+
declare const Pagination: ({ total, siblings, boundaries, pageSize: _pageSize, pageSizes, }: PagiantionProps) => React.JSX.Element;
|
|
4
4
|
export default Pagination;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { usePagiantion } from './hooks.js';
|
|
3
3
|
import Item from './item.js';
|
|
4
|
+
import Select from '../select/select.js';
|
|
5
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
6
|
+
import { ComponentToken, PaginationClassToken } from '../../utils/class-name.js';
|
|
7
|
+
import clsx from 'clsx';
|
|
4
8
|
|
|
5
9
|
const Pagination = ({
|
|
6
10
|
total = 0,
|
|
7
11
|
siblings = 1,
|
|
8
12
|
boundaries = 1,
|
|
9
|
-
pageSize
|
|
13
|
+
pageSize: _pageSize,
|
|
14
|
+
pageSizes = [10, 20, 50, 100]
|
|
10
15
|
}) => {
|
|
11
16
|
const {
|
|
12
17
|
paginationItems,
|
|
@@ -15,21 +20,34 @@ const Pagination = ({
|
|
|
15
20
|
changePage,
|
|
16
21
|
page,
|
|
17
22
|
hasNext,
|
|
18
|
-
hasPrev
|
|
23
|
+
hasPrev,
|
|
24
|
+
pageSize,
|
|
25
|
+
onPageSizeChange
|
|
19
26
|
} = usePagiantion({
|
|
20
27
|
boundaries,
|
|
21
|
-
pageSize,
|
|
28
|
+
pageSize: _pageSize,
|
|
22
29
|
siblings,
|
|
23
30
|
total
|
|
24
31
|
});
|
|
25
32
|
const styled = {
|
|
26
|
-
|
|
33
|
+
pagination: {
|
|
34
|
+
className: "musae-78zum5 musae-1ef45qx"
|
|
35
|
+
},
|
|
36
|
+
sizer: {
|
|
37
|
+
className: "musae-78zum5 musae-6s0dn4"
|
|
38
|
+
}
|
|
27
39
|
};
|
|
40
|
+
const classNames = useClassNames(ComponentToken.Pagination);
|
|
41
|
+
const sizeOptions = useMemo(() => Array.from(new Set(pageSizes)).map(size => ({
|
|
42
|
+
value: size,
|
|
43
|
+
label: `${size} 条/页`
|
|
44
|
+
})), [pageSizes]);
|
|
28
45
|
return React.createElement("nav", {
|
|
29
|
-
"aria-label": "pagination navigation"
|
|
46
|
+
"aria-label": "pagination navigation",
|
|
47
|
+
className: classNames[PaginationClassToken.Pagination]
|
|
30
48
|
}, React.createElement("ul", {
|
|
31
|
-
className: styled.className,
|
|
32
|
-
style: styled.style
|
|
49
|
+
className: styled.pagination.className,
|
|
50
|
+
style: styled.pagination.style
|
|
33
51
|
}, paginationItems.map(item => React.createElement("li", {
|
|
34
52
|
key: item
|
|
35
53
|
}, React.createElement(Item, {
|
|
@@ -40,7 +58,17 @@ const Pagination = ({
|
|
|
40
58
|
checked: page === item,
|
|
41
59
|
hasNext: hasNext,
|
|
42
60
|
hasPrev: hasPrev
|
|
43
|
-
})))
|
|
61
|
+
}))), React.createElement("li", {
|
|
62
|
+
className: clsx(classNames[PaginationClassToken.SizeSelector], styled.sizer.className),
|
|
63
|
+
style: styled.sizer.style
|
|
64
|
+
}, React.createElement(Select, {
|
|
65
|
+
options: sizeOptions,
|
|
66
|
+
value: pageSize,
|
|
67
|
+
style: {
|
|
68
|
+
minWidth: 0
|
|
69
|
+
},
|
|
70
|
+
onChange: onPageSizeChange
|
|
71
|
+
}))));
|
|
44
72
|
};
|
|
45
73
|
var Pagination$1 = Pagination;
|
|
46
74
|
|
|
@@ -41,6 +41,12 @@ export type PagiantionProps = {
|
|
|
41
41
|
* @default 1
|
|
42
42
|
*/
|
|
43
43
|
boundaries?: number;
|
|
44
|
+
/**
|
|
45
|
+
* @description
|
|
46
|
+
* page sizes
|
|
47
|
+
* @default [10, 20, 50, 100]
|
|
48
|
+
*/
|
|
49
|
+
pageSizes?: number[];
|
|
44
50
|
};
|
|
45
51
|
export type PaginationItems = [PaginationItemType.Prev, ...(PaginationItemType | number)[], PaginationItemType.Next];
|
|
46
52
|
/**
|
|
@@ -4,7 +4,7 @@ import { useBoolean, chain, useFocus } from '@aiszlab/relax';
|
|
|
4
4
|
import { useEvents } from './hooks.js';
|
|
5
5
|
import { ComponentToken, PickerClassToken } from '../../utils/class-name.js';
|
|
6
6
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
7
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
7
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
8
8
|
import { useTheme } from '../theme/hooks.js';
|
|
9
9
|
import { ColorToken } from '../../utils/colors.js';
|
|
10
10
|
import clsx from 'clsx';
|
|
@@ -78,7 +78,7 @@ const Picker = forwardRef(({
|
|
|
78
78
|
isFocused,
|
|
79
79
|
isOpen
|
|
80
80
|
}
|
|
81
|
-
}, React.createElement("
|
|
81
|
+
}, React.createElement("span", {
|
|
82
82
|
className: clsx(classNames[PickerClassToken.Picker], {
|
|
83
83
|
[classNames[PickerClassToken.Focused]]: isFocused
|
|
84
84
|
}, className, styled.picker.className),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useBoolean, toArray, useRefs, useEvent, useHover, chain, useFocus } from '@aiszlab/relax';
|
|
2
2
|
import React, { useRef, useMemo, cloneElement } from 'react';
|
|
3
3
|
import Popper from '../popper/popper.js';
|
|
4
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import { typography } from '../theme/theme.js';
|
|
6
6
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
7
7
|
import { ComponentToken, PopoverClassToken } from '../../utils/class-name.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useMemo, useEffect } from 'react';
|
|
2
2
|
import { ComponentToken, PopperClassToken } from '../../utils/class-name.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { isFunction } from '@aiszlab/relax';
|
|
7
7
|
import { autoUpdate, computePosition, flip, offset, arrow } from '@floating-ui/dom';
|
|
@@ -3,7 +3,7 @@ import Portal from '../portal/portal.js';
|
|
|
3
3
|
import Dropdown from './dropdown.js';
|
|
4
4
|
|
|
5
5
|
const Popper = ({ destroyable, placement = "bottom-start", ...props }) => {
|
|
6
|
-
return (React.createElement(Portal, { open: props.open,
|
|
6
|
+
return (React.createElement(Portal, { open: props.open, destroyable: destroyable },
|
|
7
7
|
React.createElement(Dropdown, { ...props, placement: placement })));
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createPortal } from 'react-dom';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { useScrollLocker, isDomUsable } from '@aiszlab/relax';
|
|
4
|
+
import { useContainer } from '../../hooks/use-container.js';
|
|
4
5
|
|
|
5
|
-
const Portal = ({ children, open =
|
|
6
|
+
const Portal = ({ children, open = true, destroyable = false, lockable = false, container }) => {
|
|
6
7
|
const [shouldRender, setShouldRender] = useState(false);
|
|
8
|
+
const { container: _container } = useContainer({ container });
|
|
7
9
|
/// if render once, and is not destroyable
|
|
8
10
|
/// anyway render
|
|
9
11
|
useEffect(() => {
|
|
@@ -14,7 +16,9 @@ const Portal = ({ children, open = false, destroyable = false, lockable = true }
|
|
|
14
16
|
useScrollLocker(isDomUsable() && lockable && open);
|
|
15
17
|
if (!shouldRender)
|
|
16
18
|
return null;
|
|
17
|
-
|
|
19
|
+
if (!_container)
|
|
20
|
+
return null;
|
|
21
|
+
return createPortal(children, _container);
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
export { Portal as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Voidable } from "@aiszlab/relax/types";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* @description
|
|
@@ -24,4 +25,9 @@ export interface PortalProps {
|
|
|
24
25
|
* lockable
|
|
25
26
|
*/
|
|
26
27
|
lockable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* container
|
|
31
|
+
*/
|
|
32
|
+
container?: (() => Voidable<HTMLElement>) | HTMLElement | null;
|
|
27
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useTheme } from '../theme/hooks.js';
|
|
4
4
|
import { ColorToken } from '../../utils/colors.js';
|
|
5
5
|
import { sizes } from '../theme/tokens.stylex.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, ProgressClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -3,7 +3,7 @@ import Context from './context.js';
|
|
|
3
3
|
import { useControlledState } from '@aiszlab/relax';
|
|
4
4
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
5
5
|
import { ComponentToken, RadioClassToken } from '../../utils/class-name.js';
|
|
6
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
6
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
9
9
|
import { typography } from '../theme/theme.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, RateClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
2
|
import { useEvent, useHover } from '@aiszlab/relax';
|
|
3
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
3
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
6
6
|
import { ComponentToken, RateClassToken } from '../../utils/class-name.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
3
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
|
|
5
5
|
const styles = {
|
|
6
6
|
ripple: {
|
|
@@ -5,13 +5,13 @@ import type { Option } from "../../types/option";
|
|
|
5
5
|
* @description
|
|
6
6
|
* use value
|
|
7
7
|
*/
|
|
8
|
-
export declare const useValue: ({ mode, close, isComplex, ...props }: {
|
|
8
|
+
export declare const useValue: <T extends ValueOrValues = ValueOrValues>({ mode, close, isComplex, ...props }: {
|
|
9
9
|
value: ValueOrValues | undefined;
|
|
10
10
|
readableOptions: ReadableOptions;
|
|
11
11
|
mode: Mode | undefined;
|
|
12
12
|
close: () => void;
|
|
13
13
|
reset: () => void;
|
|
14
|
-
onChange:
|
|
14
|
+
onChange?: (value: T) => void;
|
|
15
15
|
isComplex: boolean;
|
|
16
16
|
}) => {
|
|
17
17
|
value: ValueOrValues | undefined;
|
|
@@ -33,7 +33,7 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
|
|
|
33
33
|
if (readableValues.has(key))
|
|
34
34
|
return;
|
|
35
35
|
if (isControlled) {
|
|
36
|
-
props.onChange?.(isComplex ? _value : key);
|
|
36
|
+
props.onChange?.((isComplex ? _value : key));
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
setValue(_value);
|
|
@@ -46,12 +46,12 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
|
|
|
46
46
|
const isRemoved = prev.has(key) && prev.delete(key);
|
|
47
47
|
const next = isRemoved ? prev : prev.set(key, _value.label);
|
|
48
48
|
if (isControlled) {
|
|
49
|
-
props.onChange?.(isComplex
|
|
49
|
+
props.onChange?.((isComplex
|
|
50
50
|
? Array.from(next.entries()).map(([value, label]) => ({
|
|
51
51
|
value,
|
|
52
52
|
label,
|
|
53
53
|
}))
|
|
54
|
-
: Array.from(next.keys()));
|
|
54
|
+
: Array.from(next.keys())));
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
setValue(Array.from(next.entries()).map(([value, label]) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { SelectProps } from "./types";
|
|
3
|
-
declare const Select: ({ mode, searchable, onSearch, className, style, options, onFilter, complex,
|
|
2
|
+
import type { SelectProps, ValueOrValues } from "./types";
|
|
3
|
+
declare const Select: <T extends ValueOrValues = ValueOrValues>({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Select;
|
|
@@ -16,13 +16,13 @@ const Select = ({
|
|
|
16
16
|
options = [],
|
|
17
17
|
onFilter,
|
|
18
18
|
complex = false,
|
|
19
|
-
|
|
19
|
+
value,
|
|
20
|
+
onChange: _onChange
|
|
20
21
|
}) => {
|
|
21
22
|
const ref = useRef(null);
|
|
22
23
|
const selectorRef = useRef(null);
|
|
23
24
|
const classNames = useContext(Context).classNames[ComponentToken.Select];
|
|
24
25
|
const close = useCallback(() => ref.current?.close(), []);
|
|
25
|
-
/// options
|
|
26
26
|
const {
|
|
27
27
|
menuItems,
|
|
28
28
|
readableOptions,
|
|
@@ -34,17 +34,16 @@ const Select = ({
|
|
|
34
34
|
onFilter,
|
|
35
35
|
onSearch
|
|
36
36
|
});
|
|
37
|
-
/// value
|
|
38
37
|
const {
|
|
39
38
|
readableValues,
|
|
40
39
|
onChange
|
|
41
40
|
} = useValue({
|
|
42
|
-
value
|
|
41
|
+
value,
|
|
43
42
|
readableOptions,
|
|
44
43
|
mode,
|
|
45
44
|
close,
|
|
46
45
|
reset,
|
|
47
|
-
onChange:
|
|
46
|
+
onChange: _onChange,
|
|
48
47
|
isComplex: complex
|
|
49
48
|
});
|
|
50
49
|
const click = () => {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { SelectorRef } from "./types";
|
|
3
|
-
declare const Selector:
|
|
4
|
-
value: Map<React.Key, string>;
|
|
5
|
-
searched: string;
|
|
6
|
-
} & React.RefAttributes<SelectorRef>>;
|
|
1
|
+
import { type ForwardRefExoticComponent, type PropsWithoutRef, type RefAttributes } from "react";
|
|
2
|
+
import type { SelectorProps, SelectorRef } from "./types";
|
|
3
|
+
declare const Selector: ForwardRefExoticComponent<PropsWithoutRef<SelectorProps> & RefAttributes<SelectorRef>>;
|
|
7
4
|
export default Selector;
|