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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { useControlledState } from '@aiszlab/relax';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* options
|
|
7
|
+
*/
|
|
8
|
+
const useTransfer = (props) => {
|
|
9
|
+
const [value, setValue] = useControlledState(props.value);
|
|
10
|
+
const [transferKeys, setTransferKeys] = useState([]);
|
|
11
|
+
const [untransferKeys, setUntransferKeys] = useState([]);
|
|
12
|
+
const options = useMemo(() => {
|
|
13
|
+
return props.options.reduce((prev, item) => prev.set(item.value, item), new Map());
|
|
14
|
+
}, [props.options]);
|
|
15
|
+
const [transferred, untransferred] = useMemo(() => {
|
|
16
|
+
return (value ?? []).reduce(([transferred, untransferred], key) => {
|
|
17
|
+
if (untransferred.has(key)) {
|
|
18
|
+
transferred.set(key, untransferred.get(key));
|
|
19
|
+
untransferred.delete(key);
|
|
20
|
+
}
|
|
21
|
+
return [transferred, untransferred];
|
|
22
|
+
}, [new Map(), new Map(options)]);
|
|
23
|
+
}, [options, value]);
|
|
24
|
+
const transfer = useCallback(() => {
|
|
25
|
+
setValue((prev = []) => [...prev, ...transferKeys]);
|
|
26
|
+
setTransferKeys([]);
|
|
27
|
+
}, [transferKeys]);
|
|
28
|
+
const untransfer = useCallback(() => {
|
|
29
|
+
setValue((prev = []) => {
|
|
30
|
+
return Array.from(untransferKeys.reduce((checkedKeys, unchecked) => {
|
|
31
|
+
checkedKeys.delete(unchecked);
|
|
32
|
+
return checkedKeys;
|
|
33
|
+
}, new Set(prev)));
|
|
34
|
+
});
|
|
35
|
+
setUntransferKeys([]);
|
|
36
|
+
}, [untransferKeys]);
|
|
37
|
+
return {
|
|
38
|
+
transferred,
|
|
39
|
+
untransferred,
|
|
40
|
+
transfer,
|
|
41
|
+
untransfer,
|
|
42
|
+
transferKeys,
|
|
43
|
+
untransferKeys,
|
|
44
|
+
setTransferKeys,
|
|
45
|
+
setUntransferKeys,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { useTransfer };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Checkbox } from '../checkbox/index.js';
|
|
3
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
|
+
import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const Item = ({
|
|
8
|
+
value,
|
|
9
|
+
label
|
|
10
|
+
}) => {
|
|
11
|
+
const classNames = useClassNames(ComponentToken.Transfer);
|
|
12
|
+
const styled = {
|
|
13
|
+
item: {
|
|
14
|
+
className: "musae-78zum5 musae-6s0dn4 musae-gj1dgu musae-ovjknk musae-vbka3v"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return React.createElement("li", {
|
|
18
|
+
className: clsx(classNames[TransferClassToken.Item], styled.item.className),
|
|
19
|
+
style: styled.item.style
|
|
20
|
+
}, React.createElement(Checkbox, {
|
|
21
|
+
value: value
|
|
22
|
+
}), label);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { Item as default };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
|
+
import { useTheme } from '../theme/hooks.js';
|
|
4
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
5
|
+
import Item from './item.js';
|
|
6
|
+
import { Checkbox } from '../checkbox/index.js';
|
|
7
|
+
import { Context } from './context.js';
|
|
8
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
9
|
+
import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { typography } from '../theme/theme.js';
|
|
12
|
+
|
|
13
|
+
const styles = {
|
|
14
|
+
list: props => [{
|
|
15
|
+
width: "musae-fx4e2q",
|
|
16
|
+
height: "musae-1ajdkb8",
|
|
17
|
+
borderWidth: "musae-1i8jmgv",
|
|
18
|
+
borderInlineWidth: null,
|
|
19
|
+
borderInlineStartWidth: null,
|
|
20
|
+
borderLeftWidth: null,
|
|
21
|
+
borderInlineEndWidth: null,
|
|
22
|
+
borderRightWidth: null,
|
|
23
|
+
borderBlockWidth: null,
|
|
24
|
+
borderTopWidth: null,
|
|
25
|
+
borderBottomWidth: null,
|
|
26
|
+
borderColor: "musae-eqt46j",
|
|
27
|
+
borderInlineColor: null,
|
|
28
|
+
borderInlineStartColor: null,
|
|
29
|
+
borderLeftColor: null,
|
|
30
|
+
borderInlineEndColor: null,
|
|
31
|
+
borderRightColor: null,
|
|
32
|
+
borderBlockColor: null,
|
|
33
|
+
borderTopColor: null,
|
|
34
|
+
borderBottomColor: null,
|
|
35
|
+
borderStyle: "musae-1y0btm7",
|
|
36
|
+
borderInlineStyle: null,
|
|
37
|
+
borderInlineStartStyle: null,
|
|
38
|
+
borderLeftStyle: null,
|
|
39
|
+
borderInlineEndStyle: null,
|
|
40
|
+
borderRightStyle: null,
|
|
41
|
+
borderBlockStyle: null,
|
|
42
|
+
borderTopStyle: null,
|
|
43
|
+
borderBottomStyle: null,
|
|
44
|
+
borderRadius: "musae-1h268bu",
|
|
45
|
+
borderStartStartRadius: null,
|
|
46
|
+
borderStartEndRadius: null,
|
|
47
|
+
borderEndStartRadius: null,
|
|
48
|
+
borderEndEndRadius: null,
|
|
49
|
+
borderTopLeftRadius: null,
|
|
50
|
+
borderTopRightRadius: null,
|
|
51
|
+
borderBottomLeftRadius: null,
|
|
52
|
+
borderBottomRightRadius: null,
|
|
53
|
+
$$css: true
|
|
54
|
+
}, {
|
|
55
|
+
"--borderColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
56
|
+
}],
|
|
57
|
+
header: props => [{
|
|
58
|
+
display: "musae-78zum5",
|
|
59
|
+
alignItems: "musae-6s0dn4",
|
|
60
|
+
paddingBlock: "musae-mcngwa",
|
|
61
|
+
paddingTop: null,
|
|
62
|
+
paddingBottom: null,
|
|
63
|
+
paddingInline: "musae-gj1dgu",
|
|
64
|
+
paddingStart: null,
|
|
65
|
+
paddingLeft: null,
|
|
66
|
+
paddingEnd: null,
|
|
67
|
+
paddingRight: null,
|
|
68
|
+
borderBottomWidth: "musae-lntmim",
|
|
69
|
+
borderBottomColor: "musae-43481e",
|
|
70
|
+
borderBottomStyle: "musae-1q0q8m5",
|
|
71
|
+
$$css: true
|
|
72
|
+
}, {
|
|
73
|
+
"--borderBottomColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
74
|
+
}]
|
|
75
|
+
};
|
|
76
|
+
const List = ({
|
|
77
|
+
options,
|
|
78
|
+
title,
|
|
79
|
+
onChange,
|
|
80
|
+
value
|
|
81
|
+
}) => {
|
|
82
|
+
const theme = useTheme();
|
|
83
|
+
const {
|
|
84
|
+
disabled
|
|
85
|
+
} = useContext(Context);
|
|
86
|
+
const classNames = useClassNames(ComponentToken.Transfer);
|
|
87
|
+
const styled = {
|
|
88
|
+
list: _stylex.props(styles.list({
|
|
89
|
+
outlineColor: theme.colors[ColorToken.Outline]
|
|
90
|
+
})),
|
|
91
|
+
header: _stylex.props(styles.header({
|
|
92
|
+
outlineColor: theme.colors[ColorToken.Outline]
|
|
93
|
+
}), typography.body.medium),
|
|
94
|
+
title: {
|
|
95
|
+
className: "musae-b3r6kr musae-p4054r musae-1isitws"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return React.createElement("div", {
|
|
99
|
+
className: clsx(classNames[TransferClassToken.List], styled.list.className),
|
|
100
|
+
style: styled.list.style
|
|
101
|
+
}, React.createElement("div", {
|
|
102
|
+
className: clsx(classNames[TransferClassToken.Header], styled.header.className),
|
|
103
|
+
style: styled.header.style
|
|
104
|
+
}, React.createElement("span", null, options.length, "\u9879"), React.createElement("span", {
|
|
105
|
+
className: clsx(classNames[TransferClassToken.Title], styled.title.className),
|
|
106
|
+
style: styled.title.style
|
|
107
|
+
}, title)), React.createElement(Checkbox.Group, {
|
|
108
|
+
value: value,
|
|
109
|
+
onChange: onChange,
|
|
110
|
+
disabled: disabled
|
|
111
|
+
}, React.createElement("ul", {
|
|
112
|
+
className: classNames[TransferClassToken.Body]
|
|
113
|
+
}, options.map(option => {
|
|
114
|
+
return React.createElement(Item, {
|
|
115
|
+
key: option.value,
|
|
116
|
+
label: option.label,
|
|
117
|
+
value: option.value
|
|
118
|
+
});
|
|
119
|
+
}))));
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { List as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useTransfer } from './hooks.js';
|
|
3
|
+
import List from './list.js';
|
|
4
|
+
import Button from '../button/button.js';
|
|
5
|
+
import { Context } from './context.js';
|
|
6
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
7
|
+
import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import KeyboardArrowRight from '../icon/icons/hardware/keyboard-arrow-right.js';
|
|
10
|
+
import KeyboardArrowLeft from '../icon/icons/hardware/keyboard-arrow-left.js';
|
|
11
|
+
|
|
12
|
+
const Transfer = ({
|
|
13
|
+
options,
|
|
14
|
+
value,
|
|
15
|
+
titles = [null, null],
|
|
16
|
+
disabled = false,
|
|
17
|
+
className,
|
|
18
|
+
style
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
transferred,
|
|
22
|
+
untransferred,
|
|
23
|
+
transfer,
|
|
24
|
+
untransfer,
|
|
25
|
+
transferKeys,
|
|
26
|
+
untransferKeys,
|
|
27
|
+
setTransferKeys,
|
|
28
|
+
setUntransferKeys
|
|
29
|
+
} = useTransfer({
|
|
30
|
+
options,
|
|
31
|
+
value
|
|
32
|
+
});
|
|
33
|
+
const classNames = useClassNames(ComponentToken.Transfer);
|
|
34
|
+
const styled = {
|
|
35
|
+
transfer: {
|
|
36
|
+
className: "musae-78zum5 musae-1q0g3np musae-6s0dn4 musae-vbka3v"
|
|
37
|
+
},
|
|
38
|
+
operation: {
|
|
39
|
+
className: "musae-78zum5 musae-dt5ytf musae-vbka3v"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const contextValue = useMemo(() => {
|
|
43
|
+
return {
|
|
44
|
+
disabled
|
|
45
|
+
};
|
|
46
|
+
}, [disabled]);
|
|
47
|
+
return React.createElement(Context.Provider, {
|
|
48
|
+
value: contextValue
|
|
49
|
+
}, React.createElement("div", {
|
|
50
|
+
className: clsx(classNames[TransferClassToken.Transfer], className, styled.transfer.className),
|
|
51
|
+
style: {
|
|
52
|
+
...styled.transfer.style,
|
|
53
|
+
...style
|
|
54
|
+
}
|
|
55
|
+
}, React.createElement(List, {
|
|
56
|
+
options: Array.from(untransferred.values()),
|
|
57
|
+
title: titles[0],
|
|
58
|
+
value: transferKeys,
|
|
59
|
+
onChange: setTransferKeys
|
|
60
|
+
}), React.createElement("div", {
|
|
61
|
+
className: clsx(classNames[TransferClassToken.Operation], styled.operation.className),
|
|
62
|
+
style: styled.operation.style
|
|
63
|
+
}, React.createElement(Button, {
|
|
64
|
+
shape: "circular",
|
|
65
|
+
size: "small",
|
|
66
|
+
onClick: transfer,
|
|
67
|
+
disabled: disabled || transferKeys.length === 0
|
|
68
|
+
}, React.createElement(KeyboardArrowRight, null)), React.createElement(Button, {
|
|
69
|
+
shape: "circular",
|
|
70
|
+
size: "small",
|
|
71
|
+
onClick: untransfer,
|
|
72
|
+
disabled: disabled || untransferKeys.length === 0
|
|
73
|
+
}, React.createElement(KeyboardArrowLeft, null))), React.createElement(List, {
|
|
74
|
+
options: Array.from(transferred.values()),
|
|
75
|
+
title: titles[1],
|
|
76
|
+
value: untransferKeys,
|
|
77
|
+
onChange: setUntransferKeys
|
|
78
|
+
})));
|
|
79
|
+
};
|
|
80
|
+
var Transfer$1 = Transfer;
|
|
81
|
+
|
|
82
|
+
export { Transfer$1 as default };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Key, ReactNode } from "react";
|
|
2
|
+
import type { Option } from "../../types/option";
|
|
3
|
+
import { ComponentProps } from "../../types/element";
|
|
4
|
+
export type TransferOption = Omit<Option, "children">;
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* transfer props
|
|
8
|
+
*/
|
|
9
|
+
export type TransferProps = ComponentProps & {
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* options
|
|
13
|
+
* @requires
|
|
14
|
+
*/
|
|
15
|
+
options: TransferOption[];
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* value
|
|
19
|
+
* @default void 0
|
|
20
|
+
*/
|
|
21
|
+
value?: Key[];
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* titles
|
|
25
|
+
* @default [null, null]
|
|
26
|
+
*/
|
|
27
|
+
titles?: [ReactNode, ReactNode];
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* disabled
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* transfer list props
|
|
38
|
+
*/
|
|
39
|
+
export type TransferListProps = {
|
|
40
|
+
/**
|
|
41
|
+
* @description
|
|
42
|
+
* value
|
|
43
|
+
*/
|
|
44
|
+
value: Key[];
|
|
45
|
+
/**
|
|
46
|
+
* @description
|
|
47
|
+
* options
|
|
48
|
+
*/
|
|
49
|
+
options: TransferOption[];
|
|
50
|
+
/**
|
|
51
|
+
* @description
|
|
52
|
+
* title
|
|
53
|
+
*/
|
|
54
|
+
title?: ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* @description
|
|
57
|
+
* change handler
|
|
58
|
+
*/
|
|
59
|
+
onChange: (keys: Key[]) => void;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* transfer item props
|
|
64
|
+
*/
|
|
65
|
+
export type TransferItemProps = {
|
|
66
|
+
/**
|
|
67
|
+
* @description
|
|
68
|
+
* value
|
|
69
|
+
*/
|
|
70
|
+
value: Key;
|
|
71
|
+
/**
|
|
72
|
+
* @description
|
|
73
|
+
* label
|
|
74
|
+
*/
|
|
75
|
+
label: ReactNode;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* @description
|
|
79
|
+
* context value
|
|
80
|
+
*/
|
|
81
|
+
export type ContextValue = {
|
|
82
|
+
/**
|
|
83
|
+
* @description
|
|
84
|
+
* disabled
|
|
85
|
+
*/
|
|
86
|
+
disabled: boolean;
|
|
87
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
1
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import Node from './node.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
@@ -6,7 +6,8 @@ import { useAnimate } from 'framer-motion';
|
|
|
6
6
|
import Context from './context.js';
|
|
7
7
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
8
8
|
import { ComponentToken, TreeClassToken } from '../../utils/class-name.js';
|
|
9
|
-
import {
|
|
9
|
+
import { useExpandable } from '../../hooks/use-expandable.js';
|
|
10
|
+
import { useUpdateEffect } from '@aiszlab/relax';
|
|
10
11
|
|
|
11
12
|
const styles = {
|
|
12
13
|
list: {
|
|
@@ -33,11 +34,17 @@ const List = ({
|
|
|
33
34
|
onExpand
|
|
34
35
|
} = useContext(Context);
|
|
35
36
|
const classNames = useClassNames(ComponentToken.Tree);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const {
|
|
38
|
+
expand,
|
|
39
|
+
collapse
|
|
40
|
+
} = useExpandable();
|
|
41
|
+
useUpdateEffect(async () => {
|
|
42
|
+
if (expanded) {
|
|
43
|
+
await expand([scope, animate]);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
await collapse([scope, animate]);
|
|
47
|
+
}, [expanded]);
|
|
41
48
|
const styled = props(styles.list, !expanded && styles.hidden);
|
|
42
49
|
return React.createElement("ul", {
|
|
43
50
|
className: clsx({
|
|
@@ -3,7 +3,7 @@ import { useClassNames } from '../../hooks/use-class-names.js';
|
|
|
3
3
|
import { ComponentToken, TreeClassToken } from '../../utils/class-name.js';
|
|
4
4
|
import Context from './context.js';
|
|
5
5
|
import { Checkbox } from '../checkbox/index.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 clsx from 'clsx';
|
|
8
8
|
import { useTheme } from '../theme/hooks.js';
|
|
9
9
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } 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
|
|
|
4
4
|
const styles = {
|
|
5
5
|
column: props => [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.
|
|
1
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useRepaint } from './hooks.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
@@ -135,6 +135,7 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
|
|
|
135
135
|
};
|
|
136
136
|
24: {
|
|
137
137
|
0: string;
|
|
138
|
+
1: string;
|
|
138
139
|
};
|
|
139
140
|
25: {
|
|
140
141
|
0: string;
|
|
@@ -160,16 +161,22 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
|
|
|
160
161
|
28: {
|
|
161
162
|
0: string;
|
|
162
163
|
1: string;
|
|
163
|
-
5: string;
|
|
164
164
|
6: string;
|
|
165
165
|
7: string;
|
|
166
|
+
8: string;
|
|
166
167
|
2: string;
|
|
167
168
|
3: string;
|
|
168
169
|
4: string;
|
|
170
|
+
5: string;
|
|
169
171
|
};
|
|
170
172
|
29: {
|
|
171
173
|
0: string;
|
|
172
174
|
1: string;
|
|
175
|
+
2: string;
|
|
176
|
+
3: string;
|
|
177
|
+
4: string;
|
|
178
|
+
5: string;
|
|
179
|
+
6: string;
|
|
173
180
|
};
|
|
174
181
|
30: {
|
|
175
182
|
0: string;
|
|
@@ -217,4 +224,13 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
|
|
|
217
224
|
0: string;
|
|
218
225
|
1: string;
|
|
219
226
|
};
|
|
227
|
+
39: {
|
|
228
|
+
0: string;
|
|
229
|
+
6: string;
|
|
230
|
+
1: string;
|
|
231
|
+
3: string;
|
|
232
|
+
5: string;
|
|
233
|
+
2: string;
|
|
234
|
+
4: string;
|
|
235
|
+
};
|
|
220
236
|
}[T];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PortalProps } from "../components/portal/types";
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* container
|
|
5
|
+
*/
|
|
6
|
+
export declare const useContainer: ({ container }: {
|
|
7
|
+
container: PortalProps["container"];
|
|
8
|
+
}) => {
|
|
9
|
+
container: import("@aiszlab/relax/types").Voidable<HTMLElement>;
|
|
10
|
+
isDocumentBody: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isFunction, isDomUsable } from '@aiszlab/relax';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* container
|
|
7
|
+
*/
|
|
8
|
+
const useContainer = ({ container }) => {
|
|
9
|
+
const _container = useMemo(() => {
|
|
10
|
+
if (!isFunction(container))
|
|
11
|
+
return container ?? (isDomUsable() ? document.body : null);
|
|
12
|
+
return container();
|
|
13
|
+
}, [container]);
|
|
14
|
+
const isDocumentBody = useMemo(() => {
|
|
15
|
+
return isDomUsable() && _container === document.body;
|
|
16
|
+
}, [_container]);
|
|
17
|
+
return {
|
|
18
|
+
container: _container,
|
|
19
|
+
isDocumentBody,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useContainer };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useAnimate } from "framer-motion";
|
|
2
|
+
type UsedAnimate = ReturnType<typeof useAnimate<HTMLElement>>;
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* expand handler
|
|
6
|
+
*/
|
|
7
|
+
export declare const useExpandable: () => {
|
|
8
|
+
expand: ([element, animate]: UsedAnimate) => Promise<void>;
|
|
9
|
+
collapse: ([element, animate]: UsedAnimate) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEvent } from '@aiszlab/relax';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* expand handler
|
|
6
|
+
*/
|
|
7
|
+
const useExpandable = () => {
|
|
8
|
+
const expand = useEvent(async ([element, animate]) => {
|
|
9
|
+
// style play like display: none
|
|
10
|
+
element.current.style.height = "0";
|
|
11
|
+
element.current.style.overflow = "hidden";
|
|
12
|
+
element.current.style.display = "inherit";
|
|
13
|
+
await animate(element.current, {
|
|
14
|
+
height: "auto",
|
|
15
|
+
});
|
|
16
|
+
element.current.style.height = "";
|
|
17
|
+
element.current.style.overflow = "";
|
|
18
|
+
element.current.style.display = "";
|
|
19
|
+
});
|
|
20
|
+
const collapse = useEvent(async ([element, animate]) => {
|
|
21
|
+
element.current.style.overflow = "hidden";
|
|
22
|
+
element.current.style.height = "auto";
|
|
23
|
+
element.current.style.display = "inherit";
|
|
24
|
+
await animate(element.current, {
|
|
25
|
+
height: 0,
|
|
26
|
+
});
|
|
27
|
+
element.current.style.height = "";
|
|
28
|
+
element.current.style.overflow = "";
|
|
29
|
+
element.current.style.display = "none";
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
expand,
|
|
33
|
+
collapse,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { useExpandable };
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export { Progress } from "./components/progress";
|
|
|
48
48
|
export { Popover } from "./components/popover";
|
|
49
49
|
export { Watermark } from "./components/watermark";
|
|
50
50
|
export { Collapse } from "./components/collapse";
|
|
51
|
+
export { FloatingActionButton } from "./components/floating-action-button";
|
|
52
|
+
export { Transfer } from "./components/transfer";
|
|
51
53
|
/**
|
|
52
54
|
* @description
|
|
53
55
|
* hooks
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ export { default as Progress } from './components/progress/progress.js';
|
|
|
45
45
|
export { default as Popover } from './components/popover/popover.js';
|
|
46
46
|
export { default as Watermark } from './components/watermark/watermark.js';
|
|
47
47
|
export { default as Collapse } from './components/collapse/collapse.js';
|
|
48
|
+
export { default as FloatingActionButton } from './components/floating-action-button/floating-action-button.js';
|
|
49
|
+
export { default as Transfer } from './components/transfer/transfer.js';
|
|
48
50
|
export { useMessage } from './components/message/hooks.js';
|
|
49
51
|
export { useNotification } from './components/notification/hooks.js';
|
|
50
52
|
export { useTheme } from './components/theme/hooks.js';
|