musae 0.2.5 → 0.2.7
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 +4 -2
- 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 +14 -16
- package/dist/components/calendar/calendar.js +1 -1
- package/dist/components/calendar/hooks.js +5 -5
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +205 -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 +31 -4
- package/dist/components/clock/column.js +1 -1
- package/dist/components/collapse/collapse.js +1 -1
- package/dist/components/collapse/item.js +15 -9
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dialog/popup.js +5 -5
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +1 -1
- package/dist/components/drawer/popup.js +17 -17
- 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/image.js +3 -2
- package/dist/components/image/preview/operations.js +5 -5
- 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 +2 -2
- package/dist/components/layout/layout.js +1 -1
- package/dist/components/loading/loading.js +2 -2
- package/dist/components/menu/group.js +29 -9
- package/dist/components/menu/hooks.js +1 -1
- package/dist/components/menu/item.js +1 -1
- package/dist/components/menu/menu.js +3 -1
- package/dist/components/notification/holder.js +14 -15
- package/dist/components/notification/notification.js +3 -3
- 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 +3 -3
- 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 +3 -3
- package/dist/components/ripple/ripple.js +1 -1
- package/dist/components/select/hooks.d.ts +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +5 -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 +3 -1
- package/dist/components/space/space.js +1 -1
- package/dist/components/steps/item.d.ts +1 -1
- package/dist/components/steps/item.js +77 -16
- 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.d.ts +1 -1
- package/dist/components/switch/switch.js +22 -22
- package/dist/components/table/body.js +1 -1
- package/dist/components/table/header/cell.js +3 -3
- package/dist/components/table/header/header.js +2 -2
- package/dist/components/tabs/hooks.d.ts +40 -0
- package/dist/components/tabs/hooks.js +98 -0
- package/dist/components/tabs/navigation.d.ts +4 -0
- package/dist/components/tabs/navigation.js +159 -0
- package/dist/components/tabs/panels.d.ts +4 -0
- package/dist/components/tabs/panels.js +78 -0
- package/dist/components/tabs/tab.d.ts +4 -0
- package/dist/components/tabs/tab.js +19 -0
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +24 -94
- package/dist/components/tabs/types.d.ts +50 -9
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/theme/hooks.js +3 -3
- 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.d.ts +1 -1
- package/dist/components/timeline/item.js +107 -119
- package/dist/components/timeline/timeline.d.ts +1 -1
- package/dist/components/timeline/timeline.js +8 -4
- package/dist/components/timeline/types.d.ts +16 -0
- package/dist/components/tour/tour.js +4 -3
- 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 +83 -0
- package/dist/components/tree/context.js +2 -0
- package/dist/components/tree/hooks.d.ts +13 -2
- package/dist/components/tree/hooks.js +19 -2
- package/dist/components/tree/list.js +16 -9
- package/dist/components/tree/node.d.ts +1 -1
- package/dist/components/tree/node.js +24 -14
- package/dist/components/tree/tree.d.ts +1 -1
- package/dist/components/tree/tree.js +13 -9
- package/dist/components/tree/types.d.ts +18 -23
- package/dist/components/waterfall/sequential.js +4 -1
- package/dist/components/waterfall/waterfall.js +6 -3
- package/dist/hooks/use-class-names.d.ts +27 -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 +61 -40
- package/dist/utils/class-name.d.ts +96 -16
- package/dist/utils/class-name.js +69 -13
- package/package.json +21 -11
- package/dist/components/tabs/item.d.ts +0 -4
- package/dist/components/tabs/item.js +0 -22
- 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.55_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.6.1 → @stylexjs_stylex@0.7.5}/node_modules/@stylexjs/stylex/lib/es/stylex.js +0 -0
|
@@ -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
|
+
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.
|
|
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.
|
|
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';
|
|
@@ -16,8 +16,8 @@ const styles = {
|
|
|
16
16
|
zIndex: "musae-1axsr4t",
|
|
17
17
|
position: "musae-10l6tqk",
|
|
18
18
|
backgroundColor: "musae-q1mx2j",
|
|
19
|
-
top: "musae-
|
|
20
|
-
insetInlineStart: "musae-
|
|
19
|
+
top: "musae-13vifvy",
|
|
20
|
+
insetInlineStart: "musae-1o0tod",
|
|
21
21
|
left: null,
|
|
22
22
|
right: null,
|
|
23
23
|
boxShadow: "musae-ezd0au",
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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';
|
|
@@ -36,10 +36,10 @@ const styles = {
|
|
|
36
36
|
position: "musae-10l6tqk",
|
|
37
37
|
width: "musae-1gn8jaj",
|
|
38
38
|
height: "musae-b27hse",
|
|
39
|
-
insetInlineStart: "musae-
|
|
39
|
+
insetInlineStart: "musae-1o0tod",
|
|
40
40
|
left: null,
|
|
41
41
|
right: null,
|
|
42
|
-
top: "musae-
|
|
42
|
+
top: "musae-13vifvy",
|
|
43
43
|
opacity: "musae-g01cxk",
|
|
44
44
|
userSelect: "musae-87ps6o",
|
|
45
45
|
overflow: "musae-b3r6kr",
|
|
@@ -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.
|
|
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: {
|
|
@@ -11,7 +11,7 @@ export declare const useValue: ({ mode, close, isComplex, ...props }: {
|
|
|
11
11
|
mode: Mode | undefined;
|
|
12
12
|
close: () => void;
|
|
13
13
|
reset: () => void;
|
|
14
|
-
onChange:
|
|
14
|
+
onChange?: (value: ValueOrValues) => void;
|
|
15
15
|
isComplex: boolean;
|
|
16
16
|
}) => {
|
|
17
17
|
value: ValueOrValues | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectProps } from "./types";
|
|
3
|
-
declare const Select: ({ mode, searchable, onSearch, className, style, options, onFilter, complex,
|
|
3
|
+
declare const Select: ({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps) => 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,17 @@ 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
|
-
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
onChange: _onChange,
|
|
48
48
|
isComplex: complex
|
|
49
49
|
});
|
|
50
50
|
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;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef, useRef, useContext, useImperativeHandle } from 'react';
|
|
2
2
|
import Tag from '../tag/tag.js';
|
|
3
3
|
import { styles as styles$1 } from '../input/input.js';
|
|
4
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import { Context } from '../picker/context.js';
|
|
6
6
|
import { useTheme } from '../theme/hooks.js';
|
|
7
7
|
import { ColorToken } from '../../utils/colors.js';
|
|
8
|
+
import { typography } from '../theme/theme.js';
|
|
8
9
|
|
|
9
10
|
const styles = {
|
|
10
11
|
input: props => [{
|
|
@@ -34,6 +35,11 @@ const Selector = forwardRef(({
|
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
});
|
|
38
|
+
const search = e => {
|
|
39
|
+
open?.();
|
|
40
|
+
// on user search input, trigger the search callback
|
|
41
|
+
onSearch(e.target.value);
|
|
42
|
+
};
|
|
37
43
|
/// multiple mode render
|
|
38
44
|
if (mode === "multiple") {
|
|
39
45
|
return [...Array.from(value.entries()).map(([key, label]) => {
|
|
@@ -45,17 +51,17 @@ const Selector = forwardRef(({
|
|
|
45
51
|
ref: inputRef
|
|
46
52
|
})];
|
|
47
53
|
}
|
|
48
|
-
const search = e => {
|
|
49
|
-
open?.();
|
|
50
|
-
// on user search input, trigger the search callback
|
|
51
|
-
onSearch(e.target.value);
|
|
52
|
-
};
|
|
53
54
|
const styled = _stylex.props(styles$1.input, styles.input({
|
|
54
|
-
color: isFocused && searchable
|
|
55
|
-
}));
|
|
56
|
-
|
|
55
|
+
color: isFocused && searchable && theme.colors[ColorToken.OnSurface] || void 0
|
|
56
|
+
}), typography.body.small);
|
|
57
|
+
// single mode render
|
|
58
|
+
if (!searchable) {
|
|
59
|
+
return React.createElement("span", {
|
|
60
|
+
className: styled.className,
|
|
61
|
+
style: styled.style
|
|
62
|
+
}, Array.from(value.values()).join(","));
|
|
63
|
+
}
|
|
57
64
|
return React.createElement("input", {
|
|
58
|
-
readOnly: !searchable,
|
|
59
65
|
ref: inputRef,
|
|
60
66
|
value: searched,
|
|
61
67
|
placeholder: Array.from(value.values()).join(","),
|
|
@@ -6,6 +6,7 @@ import type { RequiredIn } from "@aiszlab/relax/types";
|
|
|
6
6
|
export type Mode = "multiple";
|
|
7
7
|
export type Value = Key | Pick<Option, "value" | "label">;
|
|
8
8
|
export type ValueOrValues = Value[] | Value;
|
|
9
|
+
type ChangeHandler = ((value: string) => void) | ((value: number) => void) | ((value: bigint) => void) | ((values: Value[]) => void);
|
|
9
10
|
/**
|
|
10
11
|
* @author murukal
|
|
11
12
|
*
|
|
@@ -60,7 +61,7 @@ export type SelectProps = ComponentProps & {
|
|
|
60
61
|
* on value change, toggle
|
|
61
62
|
* @default void 0
|
|
62
63
|
*/
|
|
63
|
-
onChange?:
|
|
64
|
+
onChange?: ChangeHandler;
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
66
67
|
* @description
|
|
@@ -121,3 +122,4 @@ export type SelectionsProps = {
|
|
|
121
122
|
*/
|
|
122
123
|
selectedKeys: MenuProps["selectedKeys"];
|
|
123
124
|
};
|
|
125
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.
|
|
2
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useGutters } from '../../hooks/use-gutters.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { StepItemProps } from "./types";
|
|
3
|
-
declare const Item: ({ leading, title, description, value }: StepItemProps) => React.JSX.Element;
|
|
3
|
+
declare const Item: ({ leading, title, description, value, size }: StepItemProps) => React.JSX.Element;
|
|
4
4
|
export default Item;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.
|
|
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, StepsClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { sizes } from '../theme/tokens.stylex.js';
|
|
6
7
|
import { useTheme } from '../theme/hooks.js';
|
|
7
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
8
9
|
import { useEvent } from '@aiszlab/relax';
|
|
9
10
|
import { Context } from './context.js';
|
|
10
11
|
import { typography } from '../theme/theme.js';
|
|
12
|
+
import Done from '../icon/icons/action/done.js';
|
|
11
13
|
|
|
12
14
|
const styles = {
|
|
13
15
|
step: {
|
|
@@ -17,19 +19,13 @@ const styles = {
|
|
|
17
19
|
flexShrink: null,
|
|
18
20
|
flexBasis: null,
|
|
19
21
|
display: "musae-rvj5dj",
|
|
20
|
-
grid: "musae-1l2suiq",
|
|
21
|
-
gridTemplate: null,
|
|
22
|
-
gridTemplateAreas: null,
|
|
23
|
-
gridTemplateColumns: null,
|
|
24
|
-
gridTemplateRows: null,
|
|
25
|
-
gridAutoRows: null,
|
|
26
|
-
gridAutoColumns: null,
|
|
27
|
-
gridAutoFlow: null,
|
|
28
22
|
alignItems: "musae-6s0dn4",
|
|
29
23
|
columnGap: "musae-1om1yv4",
|
|
30
24
|
overflow: "musae-b3r6kr",
|
|
31
25
|
overflowX: null,
|
|
32
26
|
overflowY: null,
|
|
27
|
+
gridTemplateAreas: "musae-1tdxyq7",
|
|
28
|
+
gridTemplateColumns: "musae-1pmbctz",
|
|
33
29
|
$$css: true
|
|
34
30
|
},
|
|
35
31
|
clickable: {
|
|
@@ -48,23 +44,72 @@ const styles = {
|
|
|
48
44
|
gridColumnEnd: null,
|
|
49
45
|
$$css: true
|
|
50
46
|
},
|
|
51
|
-
|
|
47
|
+
tail: props => [{
|
|
52
48
|
position: "musae-1n2onr6",
|
|
53
49
|
"::after_content": "musae-1s928wv",
|
|
54
50
|
"::after_position": "musae-1j6awrg",
|
|
55
51
|
"::after_height": "musae-p59mhh",
|
|
56
52
|
"::after_width": "musae-etvar1",
|
|
57
53
|
"::after_backgroundColor": "musae-27d4w3",
|
|
58
|
-
"::after_marginTop": "musae-4ys0c4",
|
|
59
54
|
"::after_top": "musae-1srwf7z",
|
|
60
55
|
"::after_insetInlineStart": "musae-xsadbs",
|
|
61
56
|
"::after_left": null,
|
|
62
57
|
"::after_right": null,
|
|
58
|
+
"::after_marginTop": "musae-4ys0c4",
|
|
63
59
|
$$css: true
|
|
64
60
|
}, {
|
|
65
61
|
"--15iyedw": props.color != null ? props.color : "initial"
|
|
66
62
|
}]
|
|
67
63
|
},
|
|
64
|
+
sign: {
|
|
65
|
+
default: props => [{
|
|
66
|
+
display: "musae-78zum5",
|
|
67
|
+
justifyContent: "musae-l56j7k",
|
|
68
|
+
alignItems: "musae-6s0dn4",
|
|
69
|
+
borderRadius: "musae-iipnba",
|
|
70
|
+
borderStartStartRadius: null,
|
|
71
|
+
borderStartEndRadius: null,
|
|
72
|
+
borderEndStartRadius: null,
|
|
73
|
+
borderEndEndRadius: null,
|
|
74
|
+
borderTopLeftRadius: null,
|
|
75
|
+
borderTopRightRadius: null,
|
|
76
|
+
borderBottomLeftRadius: null,
|
|
77
|
+
borderBottomRightRadius: null,
|
|
78
|
+
overflow: "musae-b3r6kr",
|
|
79
|
+
overflowX: null,
|
|
80
|
+
overflowY: null,
|
|
81
|
+
width: "musae-17fnjtu",
|
|
82
|
+
height: "musae-1jwls1v",
|
|
83
|
+
$$css: true
|
|
84
|
+
}, {
|
|
85
|
+
"--width": (val => typeof val === "number" ? val + "px" : val != null ? val : "initial")(props.size ?? sizes.xsmall),
|
|
86
|
+
"--height": (val => typeof val === "number" ? val + "px" : val != null ? val : "initial")(props.size ?? sizes.xsmall)
|
|
87
|
+
}],
|
|
88
|
+
doing: props => [{
|
|
89
|
+
backgroundColor: "musae-q1mx2j",
|
|
90
|
+
color: "musae-19dipnz",
|
|
91
|
+
$$css: true
|
|
92
|
+
}, {
|
|
93
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
94
|
+
"--color": props.color != null ? props.color : "initial"
|
|
95
|
+
}],
|
|
96
|
+
done: props => [{
|
|
97
|
+
backgroundColor: "musae-q1mx2j",
|
|
98
|
+
color: "musae-19dipnz",
|
|
99
|
+
$$css: true
|
|
100
|
+
}, {
|
|
101
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
102
|
+
"--color": props.color != null ? props.color : "initial"
|
|
103
|
+
}],
|
|
104
|
+
todo: props => [{
|
|
105
|
+
backgroundColor: "musae-q1mx2j",
|
|
106
|
+
color: "musae-19dipnz",
|
|
107
|
+
$$css: true
|
|
108
|
+
}, {
|
|
109
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
110
|
+
"--color": props.color != null ? props.color : "initial"
|
|
111
|
+
}]
|
|
112
|
+
},
|
|
68
113
|
title: {
|
|
69
114
|
default: {
|
|
70
115
|
gridArea: "musae-nyuz70",
|
|
@@ -77,7 +122,7 @@ const styles = {
|
|
|
77
122
|
alignItems: "musae-6s0dn4",
|
|
78
123
|
$$css: true
|
|
79
124
|
},
|
|
80
|
-
|
|
125
|
+
tail: props => [{
|
|
81
126
|
position: "musae-1n2onr6",
|
|
82
127
|
"::after_content": "musae-1s928wv",
|
|
83
128
|
"::after_position": "musae-1j6awrg",
|
|
@@ -110,7 +155,8 @@ const Item = ({
|
|
|
110
155
|
leading,
|
|
111
156
|
title,
|
|
112
157
|
description,
|
|
113
|
-
value
|
|
158
|
+
value,
|
|
159
|
+
size
|
|
114
160
|
}) => {
|
|
115
161
|
const classNames = useClassNames(ComponentToken.Steps);
|
|
116
162
|
const theme = useTheme();
|
|
@@ -127,10 +173,22 @@ const Item = ({
|
|
|
127
173
|
const isMax = value === max;
|
|
128
174
|
const styled = {
|
|
129
175
|
step: _stylex.props(styles.step.default, isClickable && styles.step.clickable),
|
|
130
|
-
leading: _stylex.props(styles.leading.default, isVertical && !isMax && styles.leading.
|
|
176
|
+
leading: _stylex.props(styles.leading.default, isVertical && !isMax && styles.leading.tail({
|
|
131
177
|
color: theme.colors[ColorToken.Primary]
|
|
132
178
|
})),
|
|
133
|
-
|
|
179
|
+
sign: _stylex.props(styles.sign.default({
|
|
180
|
+
size
|
|
181
|
+
}), status === "doing" && styles.sign.doing({
|
|
182
|
+
backgroundColor: theme.colors[ColorToken.Primary],
|
|
183
|
+
color: theme.colors[ColorToken.OnPrimary]
|
|
184
|
+
}), status === "done" && styles.sign.done({
|
|
185
|
+
backgroundColor: theme.colors[ColorToken.PrimaryContainer],
|
|
186
|
+
color: theme.colors[ColorToken.OnPrimaryContainer]
|
|
187
|
+
}), status === "todo" && styles.sign.todo({
|
|
188
|
+
backgroundColor: theme.colors[ColorToken.Secondary],
|
|
189
|
+
color: theme.colors[ColorToken.OnSecondary]
|
|
190
|
+
})),
|
|
191
|
+
title: _stylex.props(typography.title.medium, styles.title.default, isHorizontal && !isMax && styles.title.tail({
|
|
134
192
|
color: theme.colors[ColorToken.Primary]
|
|
135
193
|
})),
|
|
136
194
|
description: _stylex.props(typography.body.medium, styles.description.default)
|
|
@@ -150,7 +208,10 @@ const Item = ({
|
|
|
150
208
|
}, React.createElement("div", {
|
|
151
209
|
className: clsx(classNames[StepsClassToken.Leading], styled.leading.className),
|
|
152
210
|
style: styled.leading.style
|
|
153
|
-
},
|
|
211
|
+
}, React.createElement("div", {
|
|
212
|
+
className: clsx(classNames[StepsClassToken.Sign], styled.sign.className),
|
|
213
|
+
style: styled.sign.style
|
|
214
|
+
}, leading ?? (status === "done" ? React.createElement(Done, null) : value))), React.createElement("div", {
|
|
154
215
|
className: clsx(classNames[StepsClassToken.Title], styled.title.className),
|
|
155
216
|
style: styled.title.style
|
|
156
217
|
}, title), React.createElement("div", {
|
|
@@ -8,5 +8,5 @@ import type { StepsProps } from "./types";
|
|
|
8
8
|
* 1. `Steps` only be controlled
|
|
9
9
|
* 2. render by `items` prop
|
|
10
10
|
*/
|
|
11
|
-
declare const Steps: ({ items, value, className, style, type, onChange }: StepsProps) => React.JSX.Element;
|
|
11
|
+
declare const Steps: ({ items, value, className, style, type, onChange, size }: StepsProps) => React.JSX.Element;
|
|
12
12
|
export default Steps;
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import Item from './item.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, StepsClassToken } from '../../utils/class-name.js';
|
|
5
|
-
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.
|
|
5
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { Context } from './context.js';
|
|
8
8
|
|
|
@@ -38,7 +38,8 @@ const Steps = ({
|
|
|
38
38
|
className,
|
|
39
39
|
style,
|
|
40
40
|
type = "horizontal",
|
|
41
|
-
onChange
|
|
41
|
+
onChange,
|
|
42
|
+
size
|
|
42
43
|
}) => {
|
|
43
44
|
const classNames = useClassNames(ComponentToken.Steps);
|
|
44
45
|
const styled = {
|
|
@@ -48,8 +49,9 @@ const Steps = ({
|
|
|
48
49
|
type,
|
|
49
50
|
onChange,
|
|
50
51
|
max: items.length - 1,
|
|
51
|
-
value
|
|
52
|
-
|
|
52
|
+
value,
|
|
53
|
+
size
|
|
54
|
+
}), [type, onChange, items.length, value, size]);
|
|
53
55
|
return React.createElement(Context.Provider, {
|
|
54
56
|
value: contextValue
|
|
55
57
|
}, React.createElement("ol", {
|
|
@@ -54,6 +54,11 @@ export type StepsProps = ComponentProps & {
|
|
|
54
54
|
* @default horizontal
|
|
55
55
|
*/
|
|
56
56
|
type?: Type;
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* size
|
|
60
|
+
*/
|
|
61
|
+
size?: number;
|
|
57
62
|
};
|
|
58
63
|
/**
|
|
59
64
|
* @description
|
|
@@ -65,6 +70,11 @@ export type StepItemProps = StepItem & {
|
|
|
65
70
|
* current item value
|
|
66
71
|
*/
|
|
67
72
|
value: number;
|
|
73
|
+
/**
|
|
74
|
+
* @description
|
|
75
|
+
* leading size
|
|
76
|
+
*/
|
|
77
|
+
size?: number;
|
|
68
78
|
};
|
|
69
79
|
/**
|
|
70
80
|
* @description
|
|
@@ -91,5 +101,10 @@ export type ContextValue = {
|
|
|
91
101
|
* value
|
|
92
102
|
*/
|
|
93
103
|
value: number;
|
|
104
|
+
/**
|
|
105
|
+
* @description
|
|
106
|
+
* size
|
|
107
|
+
*/
|
|
108
|
+
size?: number;
|
|
94
109
|
};
|
|
95
110
|
export {};
|