musae 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/context.d.ts +0 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/breadcrumb/item.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/button-toggle/context.d.ts +0 -1
- package/dist/components/calendar/calendar.js +1 -1
- package/dist/components/calendar/hooks.js +1 -1
- package/dist/components/cascader/hooks.d.ts +1 -8
- package/dist/components/cascader/utils.d.ts +0 -1
- package/dist/components/checkbox/checkbox.js +4 -3
- package/dist/components/checkbox/context.d.ts +0 -1
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/clock/column.js +1 -1
- package/dist/components/collapse/collapse.d.ts +4 -0
- package/dist/components/collapse/collapse.js +97 -0
- package/dist/components/collapse/context.d.ts +6 -0
- package/dist/components/collapse/context.js +12 -0
- package/dist/components/collapse/hooks.d.ts +12 -0
- package/dist/components/collapse/hooks.js +43 -0
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/collapse/item.d.ts +4 -0
- package/dist/components/collapse/item.js +144 -0
- package/dist/components/collapse/types.d.ts +87 -0
- package/dist/components/config/context.d.ts +0 -1
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/date-picker/hooks.d.ts +1 -5
- package/dist/components/date-range-picker/hooks.d.ts +1 -5
- package/dist/components/dialog/hooks.d.ts +1 -5
- package/dist/components/dialog/popup.js +2 -2
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/popup.js +2 -2
- package/dist/components/empty/empty.js +1 -1
- package/dist/components/form/context.d.ts +0 -1
- package/dist/components/form/field/field.d.ts +1 -1
- package/dist/components/form/field/field.js +8 -7
- package/dist/components/form/field/layout.js +1 -1
- package/dist/components/grid/col.js +1 -1
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/grid/row.js +1 -1
- package/dist/components/icon/icon.js +2 -2
- package/dist/components/icon/icons/index.js +1 -0
- package/dist/components/icon/icons/navigation/index.d.ts +2 -1
- package/dist/components/icon/icons/navigation/index.js +1 -0
- package/dist/components/icon/icons/navigation/unfold-more.d.ts +3 -0
- package/dist/components/icon/icons/navigation/unfold-more.js +10 -0
- package/dist/components/image/index.d.ts +0 -1
- package/dist/components/image/preview/context.d.ts +0 -1
- package/dist/components/image/preview/operations.js +1 -1
- package/dist/components/image/preview/preview.js +1 -1
- package/dist/components/input/input.d.ts +20 -20
- package/dist/components/input/input.js +3 -11
- package/dist/components/layout/header.js +1 -1
- package/dist/components/layout/layout.js +1 -1
- package/dist/components/layout/main.d.ts +0 -1
- package/dist/components/loading/loading.d.ts +1 -1
- package/dist/components/loading/loading.js +70 -5
- package/dist/components/loading/types.d.ts +13 -0
- package/dist/components/menu/context.d.ts +0 -1
- package/dist/components/menu/group.d.ts +2 -2
- package/dist/components/menu/group.js +1 -1
- package/dist/components/menu/hooks.js +1 -1
- package/dist/components/menu/item.d.ts +1 -1
- package/dist/components/menu/item.js +1 -1
- package/dist/components/notification/holder.js +1 -1
- package/dist/components/notification/notification.js +1 -1
- package/dist/components/pagination/hooks.d.ts +2 -3
- package/dist/components/picker/context.d.ts +0 -1
- package/dist/components/picker/picker.js +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/popper/dropdown.js +1 -1
- package/dist/components/popper/hooks.d.ts +3 -3
- package/dist/components/progress/circular.js +1 -1
- package/dist/components/progress/hooks.d.ts +0 -1
- package/dist/components/progress/linear.js +1 -1
- package/dist/components/radio/context.d.ts +0 -1
- package/dist/components/radio/radio.js +22 -13
- package/dist/components/rate/rate.js +1 -1
- package/dist/components/rate/star.js +12 -14
- package/dist/components/ripple/hooks.js +4 -1
- package/dist/components/ripple/ripple.js +1 -1
- package/dist/components/select/selector.js +1 -1
- package/dist/components/select/utils.d.ts +0 -1
- package/dist/components/space/space.js +1 -1
- package/dist/components/steps/context.d.ts +0 -1
- package/dist/components/steps/item.js +1 -1
- package/dist/components/steps/steps.js +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table/body.js +36 -4
- package/dist/components/table/context.d.ts +6 -1
- package/dist/components/table/context.js +10 -2
- package/dist/components/table/header/cell.d.ts +3 -0
- package/dist/components/table/header/cell.js +129 -0
- package/dist/components/table/{header.d.ts → header/header.d.ts} +1 -1
- package/dist/components/table/{header.js → header/header.js} +37 -10
- package/dist/components/table/hooks.d.ts +8 -21
- package/dist/components/table/hooks.js +36 -58
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +12 -6
- package/dist/components/table/types.d.ts +72 -4
- package/dist/components/tabs/context.d.ts +0 -1
- package/dist/components/tabs/item.js +3 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/theme/hooks.d.ts +1 -2
- package/dist/components/time-picker/panel.js +1 -1
- package/dist/components/time-picker/time-picker.js +1 -1
- package/dist/components/timeline/context.d.ts +0 -1
- package/dist/components/timeline/item.js +1 -1
- package/dist/components/tour/tour.js +1 -1
- package/dist/components/tree/context.d.ts +0 -1
- package/dist/components/tree/hooks.d.ts +0 -1
- package/dist/components/tree/list.js +1 -1
- package/dist/components/tree/node.js +1 -1
- package/dist/components/upload/types.d.ts +8 -6
- package/dist/components/upload/upload.d.ts +1 -1
- package/dist/components/upload/upload.js +11 -4
- package/dist/components/upload/uploadeds.js +8 -3
- package/dist/components/waterfall/hooks.d.ts +1 -3
- package/dist/components/waterfall/hooks.js +2 -8
- package/dist/components/waterfall/sequential.js +1 -1
- package/dist/components/waterfall/waterfall.js +10 -6
- package/dist/components/watermark/types.d.ts +1 -1
- package/dist/components/watermark/watermark.js +1 -1
- package/dist/hooks/use-class-names.d.ts +15 -0
- package/dist/hooks/use-expand-effect.d.ts +1 -1
- package/dist/hooks/use-expand-effect.js +12 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/stylex.css +22 -7
- package/dist/utils/class-name.d.ts +42 -184
- package/dist/utils/class-name.js +39 -5
- package/dist/utils/styles.d.ts +1 -1
- package/package.json +15 -15
- /package/dist/node_modules/{@aiszlab → .pnpm/@aiszlab_relax@1.2.55_react-dom@18.3.1_react@18.3.1/node_modules/@aiszlab}/relax/dist/dom/contains.js +0 -0
- /package/dist/node_modules/{@stylexjs → .pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs}/stylex/lib/es/stylex.js +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useContext } from 'react';
|
|
2
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { Context } from './context.js';
|
|
4
4
|
import { useTheme } from '../theme/hooks.js';
|
|
5
5
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { typography } from '../theme/theme.js';
|
|
4
4
|
import { useTheme } from '../theme/hooks.js';
|
|
5
5
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/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 { useClassNames } from '../../hooks/use-class-names.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { ComponentToken, ButtonClassToken } from '../../utils/class-name.js';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import { useTheme } from '../theme/hooks.js';
|
|
6
6
|
import { useButton } from './hooks.js';
|
|
7
7
|
import Ripple from '../ripple/ripple.js';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { useValue, useFocusedAt, useDateCells, useHeadCells } from './hooks.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, CalendarClassToken } from '../../utils/class-name.js';
|
|
5
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import { typography } from '../theme/theme.js';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import Button from '../button/button.js';
|
|
@@ -5,7 +5,7 @@ import { ComponentToken, CalendarClassToken } from '../../utils/class-name.js';
|
|
|
5
5
|
import { toArray, useControlledState } from '@aiszlab/relax';
|
|
6
6
|
import { Timespan } from '../../utils/timespan.js';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
8
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
9
9
|
import { typography } from '../theme/theme.js';
|
|
10
10
|
import { useTheme } from '../theme/hooks.js';
|
|
11
11
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -6,14 +6,7 @@ import type { Option } from "../../types/option";
|
|
|
6
6
|
* @description
|
|
7
7
|
* cascader value
|
|
8
8
|
*/
|
|
9
|
-
export declare const useValue: ([valueInProps, readableOptions, readablePaths, mode, close, setAdditionalMenusItems]: [
|
|
10
|
-
CascaderProps["value"],
|
|
11
|
-
ReadableOptions,
|
|
12
|
-
ReadablePaths,
|
|
13
|
-
CascaderProps["mode"],
|
|
14
|
-
close: VoidFunction,
|
|
15
|
-
Dispatch<SetStateAction<MenuItem[][]>>
|
|
16
|
-
]) => {
|
|
9
|
+
export declare const useValue: ([valueInProps, readableOptions, readablePaths, mode, close, setAdditionalMenusItems]: [CascaderProps["value"], ReadableOptions, ReadablePaths, CascaderProps["mode"], close: VoidFunction, Dispatch<SetStateAction<MenuItem[][]>>]) => {
|
|
17
10
|
values: Map<number, Required<Pick<Option, "value" | "label">>[]>;
|
|
18
11
|
onChange: (id: number) => void;
|
|
19
12
|
};
|
|
@@ -4,7 +4,7 @@ import Context from './context.js';
|
|
|
4
4
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
5
5
|
import { ComponentToken, CheckboxClassToken } from '../../utils/class-name.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
7
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/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 { typography } from '../theme/theme.js';
|
|
@@ -24,6 +24,7 @@ const styles = {
|
|
|
24
24
|
cursor: "musae-mper1u",
|
|
25
25
|
width: "musae-r8isjd",
|
|
26
26
|
height: "musae-1gfonl1",
|
|
27
|
+
position: "musae-1n2onr6",
|
|
27
28
|
"::before_content": "musae-1cpjm7i",
|
|
28
29
|
"::before_visibility": "musae-11srvyv",
|
|
29
30
|
"::before_display": "musae-1fgarty",
|
|
@@ -94,7 +95,7 @@ const styles = {
|
|
|
94
95
|
"::after_display": "musae-hkezso",
|
|
95
96
|
"::after_width": "musae-11yodxc",
|
|
96
97
|
"::after_height": "musae-ec44on",
|
|
97
|
-
"::after_transform": "musae-
|
|
98
|
+
"::after_transform": "musae-q1m6zb",
|
|
98
99
|
"::after_borderWidth": "musae-15z8w9c",
|
|
99
100
|
"::after_borderInlineWidth": null,
|
|
100
101
|
"::after_borderInlineStartWidth": null,
|
|
@@ -163,7 +164,7 @@ const Checkbox = ({
|
|
|
163
164
|
}, [_setIsChecked, contextValue, value]);
|
|
164
165
|
const styled = {
|
|
165
166
|
checkbox: {
|
|
166
|
-
className: "musae-
|
|
167
|
+
className: "musae-3nfvp2 musae-6s0dn4 musae-1ypdohk"
|
|
167
168
|
},
|
|
168
169
|
trigger: props(styles.trigger({
|
|
169
170
|
borderColor: theme.colors[ColorToken.Outline]
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const Checkbox: (({ value, className, style, children, ...props }: import("./types").CheckboxProps) => import("react").JSX.Element) & {
|
|
3
2
|
Group: (props: import("./types").CheckboxGroupProps) => import("react").JSX.Element;
|
|
4
3
|
};
|
|
@@ -4,7 +4,7 @@ import Menu from '../menu/menu.js';
|
|
|
4
4
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
5
5
|
import { ComponentToken, ClockClassToken } from '../../utils/class-name.js';
|
|
6
6
|
import { isVoid } from '@aiszlab/relax';
|
|
7
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
7
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/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';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
3
|
+
import { ComponentToken, CollapseClassToken } from '../../utils/class-name.js';
|
|
4
|
+
import CollapseItem from './item.js';
|
|
5
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { useActiveKeys } from './hooks.js';
|
|
8
|
+
import { Context } from './context.js';
|
|
9
|
+
import { useTheme } from '../theme/hooks.js';
|
|
10
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
11
|
+
|
|
12
|
+
const styles = {
|
|
13
|
+
collapse: props => [{
|
|
14
|
+
borderWidth: "musae-1i8jmgv",
|
|
15
|
+
borderInlineWidth: null,
|
|
16
|
+
borderInlineStartWidth: null,
|
|
17
|
+
borderLeftWidth: null,
|
|
18
|
+
borderInlineEndWidth: null,
|
|
19
|
+
borderRightWidth: null,
|
|
20
|
+
borderBlockWidth: null,
|
|
21
|
+
borderTopWidth: null,
|
|
22
|
+
borderBottomWidth: null,
|
|
23
|
+
borderStyle: "musae-1y0btm7",
|
|
24
|
+
borderInlineStyle: null,
|
|
25
|
+
borderInlineStartStyle: null,
|
|
26
|
+
borderLeftStyle: null,
|
|
27
|
+
borderInlineEndStyle: null,
|
|
28
|
+
borderRightStyle: null,
|
|
29
|
+
borderBlockStyle: null,
|
|
30
|
+
borderTopStyle: null,
|
|
31
|
+
borderBottomStyle: null,
|
|
32
|
+
borderColor: "musae-eqt46j",
|
|
33
|
+
borderInlineColor: null,
|
|
34
|
+
borderInlineStartColor: null,
|
|
35
|
+
borderLeftColor: null,
|
|
36
|
+
borderInlineEndColor: null,
|
|
37
|
+
borderRightColor: null,
|
|
38
|
+
borderBlockColor: null,
|
|
39
|
+
borderTopColor: null,
|
|
40
|
+
borderBottomColor: null,
|
|
41
|
+
borderRadius: "musae-1h268bu",
|
|
42
|
+
borderStartStartRadius: null,
|
|
43
|
+
borderStartEndRadius: null,
|
|
44
|
+
borderEndStartRadius: null,
|
|
45
|
+
borderEndEndRadius: null,
|
|
46
|
+
borderTopLeftRadius: null,
|
|
47
|
+
borderTopRightRadius: null,
|
|
48
|
+
borderBottomLeftRadius: null,
|
|
49
|
+
borderBottomRightRadius: null,
|
|
50
|
+
$$css: true
|
|
51
|
+
}, {
|
|
52
|
+
"--borderColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
53
|
+
}]
|
|
54
|
+
};
|
|
55
|
+
const Collapse = ({
|
|
56
|
+
items,
|
|
57
|
+
className,
|
|
58
|
+
defaultActiveKey,
|
|
59
|
+
activeKey,
|
|
60
|
+
onChange,
|
|
61
|
+
style,
|
|
62
|
+
accordion = false
|
|
63
|
+
}) => {
|
|
64
|
+
const classNames = useClassNames(ComponentToken.Collapse);
|
|
65
|
+
const [activeKeys, toggle] = useActiveKeys({
|
|
66
|
+
defaultActiveKey,
|
|
67
|
+
activeKey,
|
|
68
|
+
onChange,
|
|
69
|
+
accordion
|
|
70
|
+
});
|
|
71
|
+
const theme = useTheme();
|
|
72
|
+
// no need to render when items is empty
|
|
73
|
+
if (items.length === 0) return null;
|
|
74
|
+
const styled = _stylex.props(styles.collapse({
|
|
75
|
+
outlineColor: theme.colors[ColorToken.OutlineVariant]
|
|
76
|
+
}));
|
|
77
|
+
return React.createElement(Context.Provider, {
|
|
78
|
+
value: {
|
|
79
|
+
activeKeys,
|
|
80
|
+
toggle
|
|
81
|
+
}
|
|
82
|
+
}, React.createElement("div", {
|
|
83
|
+
className: clsx(classNames[CollapseClassToken.Collapse], className, styled.className),
|
|
84
|
+
style: {
|
|
85
|
+
...styled.style,
|
|
86
|
+
...style
|
|
87
|
+
}
|
|
88
|
+
}, items.map(item => {
|
|
89
|
+
return React.createElement(CollapseItem, {
|
|
90
|
+
...item,
|
|
91
|
+
value: item.key
|
|
92
|
+
});
|
|
93
|
+
})));
|
|
94
|
+
};
|
|
95
|
+
var Collapse$1 = Collapse;
|
|
96
|
+
|
|
97
|
+
export { Collapse$1 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Key } from "react";
|
|
2
|
+
import type { Value } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* `Collapse` active key hook
|
|
6
|
+
*/
|
|
7
|
+
export declare const useActiveKeys: ({ defaultActiveKey, activeKey: _activeKey, onChange: _onChange, accordion, }: {
|
|
8
|
+
defaultActiveKey?: Value;
|
|
9
|
+
activeKey?: Value;
|
|
10
|
+
onChange?: (value: Key[]) => void;
|
|
11
|
+
accordion: boolean;
|
|
12
|
+
}) => [Set<Key>, (key: Key) => void];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useControlledState, exclude, toArray, useEvent } from '@aiszlab/relax';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* `Collapse` active key hook
|
|
7
|
+
*/
|
|
8
|
+
const useActiveKeys = ({ defaultActiveKey, activeKey: _activeKey, onChange: _onChange, accordion, }) => {
|
|
9
|
+
const [_activeKeys, _setActiveKeys] = useControlledState(_activeKey, { defaultState: defaultActiveKey });
|
|
10
|
+
const activeKeys = useMemo(() => {
|
|
11
|
+
const keys = exclude(toArray(_activeKeys), [void 0]);
|
|
12
|
+
if (accordion) {
|
|
13
|
+
return new Set(keys.slice(0, 1));
|
|
14
|
+
}
|
|
15
|
+
return new Set(keys);
|
|
16
|
+
}, [_activeKeys, accordion]);
|
|
17
|
+
const toggle = useEvent((key) => {
|
|
18
|
+
const expandedKeys = new Set(activeKeys);
|
|
19
|
+
const isExpanded = expandedKeys.has(key);
|
|
20
|
+
// `accordion` mode, just toggle `key`
|
|
21
|
+
// otherwise, normally toggle `key`
|
|
22
|
+
if (accordion) {
|
|
23
|
+
expandedKeys.clear();
|
|
24
|
+
if (!isExpanded) {
|
|
25
|
+
expandedKeys.add(key);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (isExpanded) {
|
|
30
|
+
expandedKeys.delete(key);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
expandedKeys.add(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const _expandedKeys = Array.from(expandedKeys);
|
|
37
|
+
_setActiveKeys(_expandedKeys);
|
|
38
|
+
_onChange?.(_expandedKeys);
|
|
39
|
+
});
|
|
40
|
+
return [activeKeys, toggle];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { useActiveKeys };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
3
|
+
import { ComponentToken, CollapseClassToken } from '../../utils/class-name.js';
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import { useEvent } from '@aiszlab/relax';
|
|
6
|
+
import { useAnimate } from 'framer-motion';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { Context } from './context.js';
|
|
9
|
+
import { useExpandEffect } from '../../hooks/use-expand-effect.js';
|
|
10
|
+
import { useTheme } from '../theme/hooks.js';
|
|
11
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
12
|
+
import KeyboardArrowRight from '../icon/icons/hardware/keyboard-arrow-right.js';
|
|
13
|
+
|
|
14
|
+
const styles = {
|
|
15
|
+
item: {
|
|
16
|
+
default: props => [{
|
|
17
|
+
borderBottomWidth: "musae-lntmim",
|
|
18
|
+
borderBottomStyle: "musae-1q0q8m5",
|
|
19
|
+
borderBottomColor: "musae-43481e",
|
|
20
|
+
":last-of-type_borderBottomWidth": "musae-zm6erk",
|
|
21
|
+
$$css: true
|
|
22
|
+
}, {
|
|
23
|
+
"--borderBottomColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
24
|
+
}]
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
default: {
|
|
28
|
+
paddingInline: "musae-1xkwav8",
|
|
29
|
+
paddingStart: null,
|
|
30
|
+
paddingLeft: null,
|
|
31
|
+
paddingEnd: null,
|
|
32
|
+
paddingRight: null,
|
|
33
|
+
paddingBlock: "musae-avjae4",
|
|
34
|
+
paddingTop: null,
|
|
35
|
+
paddingBottom: null,
|
|
36
|
+
display: "musae-78zum5",
|
|
37
|
+
flexDirection: "musae-1q0g3np",
|
|
38
|
+
alignItems: "musae-6s0dn4",
|
|
39
|
+
gap: "musae-vbka3v",
|
|
40
|
+
rowGap: null,
|
|
41
|
+
columnGap: null,
|
|
42
|
+
cursor: "musae-1ypdohk",
|
|
43
|
+
$$css: true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
panel: {
|
|
47
|
+
default: {
|
|
48
|
+
height: "musae-t7dq6l",
|
|
49
|
+
$$css: true
|
|
50
|
+
},
|
|
51
|
+
hidden: {
|
|
52
|
+
display: "musae-1s85apg",
|
|
53
|
+
$$css: true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
content: {
|
|
57
|
+
default: props => [{
|
|
58
|
+
borderTopWidth: "musae-1yeim8r",
|
|
59
|
+
borderTopStyle: "musae-13fuv20",
|
|
60
|
+
borderTopColor: "musae-is9nib",
|
|
61
|
+
padding: "musae-12ldsqu",
|
|
62
|
+
paddingInline: null,
|
|
63
|
+
paddingStart: null,
|
|
64
|
+
paddingLeft: null,
|
|
65
|
+
paddingEnd: null,
|
|
66
|
+
paddingRight: null,
|
|
67
|
+
paddingBlock: null,
|
|
68
|
+
paddingTop: null,
|
|
69
|
+
paddingBottom: null,
|
|
70
|
+
$$css: true
|
|
71
|
+
}, {
|
|
72
|
+
"--borderTopColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
73
|
+
}]
|
|
74
|
+
},
|
|
75
|
+
collapser: {
|
|
76
|
+
default: {
|
|
77
|
+
willChange: "musae-1so62im",
|
|
78
|
+
transitionProperty: "musae-11xpdln",
|
|
79
|
+
transitionDuration: "musae-13dflua",
|
|
80
|
+
$$css: true
|
|
81
|
+
},
|
|
82
|
+
expanded: {
|
|
83
|
+
transform: "musae-1iffjtl",
|
|
84
|
+
$$css: true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const CollapseItem = ({
|
|
89
|
+
children,
|
|
90
|
+
label,
|
|
91
|
+
value
|
|
92
|
+
}) => {
|
|
93
|
+
const classNames = useClassNames(ComponentToken.Collapse);
|
|
94
|
+
const {
|
|
95
|
+
activeKeys,
|
|
96
|
+
toggle
|
|
97
|
+
} = useContext(Context);
|
|
98
|
+
const isExpanded = activeKeys.has(value);
|
|
99
|
+
const [collapser, animate] = useAnimate();
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
useExpandEffect({
|
|
102
|
+
animate,
|
|
103
|
+
expanded: isExpanded,
|
|
104
|
+
target: collapser
|
|
105
|
+
});
|
|
106
|
+
const styled = {
|
|
107
|
+
item: _stylex.props(styles.item.default({
|
|
108
|
+
outlineColor: theme.colors[ColorToken.OutlineVariant]
|
|
109
|
+
})),
|
|
110
|
+
header: _stylex.props(styles.header.default),
|
|
111
|
+
panel: _stylex.props(styles.panel.default, !isExpanded && styles.panel.hidden),
|
|
112
|
+
content: _stylex.props(styles.content.default({
|
|
113
|
+
outlineColor: theme.colors[ColorToken.OutlineVariant]
|
|
114
|
+
})),
|
|
115
|
+
collapser: _stylex.props(styles.collapser.default, isExpanded && styles.collapser.expanded)
|
|
116
|
+
};
|
|
117
|
+
const onClick = useEvent(() => {
|
|
118
|
+
toggle(value);
|
|
119
|
+
});
|
|
120
|
+
return React.createElement("div", {
|
|
121
|
+
className: clsx(classNames[CollapseClassToken.Item], {
|
|
122
|
+
[classNames[CollapseClassToken.ItemActive]]: isExpanded
|
|
123
|
+
}, styled.item.className),
|
|
124
|
+
style: styled.item.style
|
|
125
|
+
}, React.createElement("div", {
|
|
126
|
+
className: clsx(classNames[CollapseClassToken.Header], styled.header.className),
|
|
127
|
+
style: styled.header.style,
|
|
128
|
+
onClick: onClick
|
|
129
|
+
}, React.createElement(KeyboardArrowRight, {
|
|
130
|
+
className: clsx(classNames[CollapseClassToken.Collapser], styled.collapser.className),
|
|
131
|
+
style: styled.collapser.style
|
|
132
|
+
}), label), React.createElement("div", {
|
|
133
|
+
ref: collapser,
|
|
134
|
+
className: clsx(classNames[CollapseClassToken.Panel], {
|
|
135
|
+
[classNames[CollapseClassToken.PanelActive]]: isExpanded
|
|
136
|
+
}, styled.panel.className),
|
|
137
|
+
style: styled.panel.style
|
|
138
|
+
}, React.createElement("div", {
|
|
139
|
+
className: clsx(classNames[CollapseClassToken.Content], styled.content.className),
|
|
140
|
+
style: styled.content.style
|
|
141
|
+
}, children)));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { CollapseItem as default };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Key, ReactNode } from "react";
|
|
2
|
+
import type { ComponentProps } from "../../types/element";
|
|
3
|
+
export type Value = Key | Key[];
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* `Collapse` item
|
|
7
|
+
*/
|
|
8
|
+
interface CollapseItem {
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* key
|
|
12
|
+
*/
|
|
13
|
+
key: Key;
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* label
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* @description
|
|
21
|
+
* children
|
|
22
|
+
*/
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @description
|
|
27
|
+
* `Collapse` props
|
|
28
|
+
*/
|
|
29
|
+
export interface CollapseProps extends ComponentProps {
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* default active key
|
|
33
|
+
* @default void 0
|
|
34
|
+
*/
|
|
35
|
+
defaultActiveKey?: Value;
|
|
36
|
+
/**
|
|
37
|
+
* @description
|
|
38
|
+
* active key
|
|
39
|
+
* @default void 0
|
|
40
|
+
*/
|
|
41
|
+
activeKey?: Value;
|
|
42
|
+
/**
|
|
43
|
+
* @description
|
|
44
|
+
* items
|
|
45
|
+
*/
|
|
46
|
+
items: CollapseItem[];
|
|
47
|
+
/**
|
|
48
|
+
* @description
|
|
49
|
+
* change handler
|
|
50
|
+
* @default void 0
|
|
51
|
+
*/
|
|
52
|
+
onChange?: (value: Key[]) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @description
|
|
55
|
+
* accordion mode
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
accordion?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @description
|
|
62
|
+
* `Collapse` item props
|
|
63
|
+
*/
|
|
64
|
+
export interface CollapseItemProps extends Omit<CollapseItem, "key"> {
|
|
65
|
+
/**
|
|
66
|
+
* @description
|
|
67
|
+
* value
|
|
68
|
+
*/
|
|
69
|
+
value: Key;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @description
|
|
73
|
+
* context value
|
|
74
|
+
*/
|
|
75
|
+
export interface ContextValue {
|
|
76
|
+
/**
|
|
77
|
+
* @description
|
|
78
|
+
* active keys
|
|
79
|
+
*/
|
|
80
|
+
activeKeys: Set<Key>;
|
|
81
|
+
/**
|
|
82
|
+
* @description
|
|
83
|
+
* key toggle
|
|
84
|
+
*/
|
|
85
|
+
toggle: (key: Key) => void;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import Calendar from '../calendar/calendar.js';
|
|
|
4
4
|
import { useValue } from './hooks.js';
|
|
5
5
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
6
6
|
import { ComponentToken, DatePickerClassToken } from '../../utils/class-name.js';
|
|
7
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
7
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { styles } from '../input/input.js';
|
|
10
10
|
|
|
@@ -5,11 +5,7 @@ import { PickerRef } from "../picker";
|
|
|
5
5
|
* @description
|
|
6
6
|
* value
|
|
7
7
|
*/
|
|
8
|
-
export declare const useValue: ([_value, _change, _ref]: [
|
|
9
|
-
DatePickerProps["value"],
|
|
10
|
-
DatePickerProps["onChange"],
|
|
11
|
-
RefObject<PickerRef>
|
|
12
|
-
]) => {
|
|
8
|
+
export declare const useValue: ([_value, _change, _ref]: [DatePickerProps["value"], DatePickerProps["onChange"], RefObject<PickerRef>]) => {
|
|
13
9
|
value: import("dayjs").Dayjs | undefined;
|
|
14
10
|
onChange: (value: import("dayjs").Dayjs) => void;
|
|
15
11
|
};
|
|
@@ -7,11 +7,7 @@ import { PickerRef } from "../picker";
|
|
|
7
7
|
* @description
|
|
8
8
|
* value
|
|
9
9
|
*/
|
|
10
|
-
export declare const useValue: ([_value, _change, ref]: [
|
|
11
|
-
DateRangePickerProps["value"],
|
|
12
|
-
DateRangePickerProps["onChange"],
|
|
13
|
-
RefObject<PickerRef>
|
|
14
|
-
]) => {
|
|
10
|
+
export declare const useValue: ([_value, _change, ref]: [DateRangePickerProps["value"], DateRangePickerProps["onChange"], RefObject<PickerRef>]) => {
|
|
15
11
|
value: [Partialable<Dayjs>, Partialable<Dayjs>];
|
|
16
12
|
onChange: (_value: Dayjs) => void;
|
|
17
13
|
};
|
|
@@ -4,8 +4,4 @@ import type { PopupProps } from "./types";
|
|
|
4
4
|
* @description
|
|
5
5
|
* footer
|
|
6
6
|
*/
|
|
7
|
-
export declare const useFooter: ([footer, onConfirm, onClose]: [
|
|
8
|
-
footer: PopupProps["footer"],
|
|
9
|
-
onConfirm: PopupProps["onConfirm"],
|
|
10
|
-
onClose: PopupProps["onClose"]
|
|
11
|
-
]) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
|
|
7
|
+
export declare const useFooter: ([footer, onConfirm, onClose]: [footer: PopupProps["footer"], onConfirm: PopupProps["onConfirm"], onClose: PopupProps["onClose"]]) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
|
|
@@ -3,13 +3,13 @@ import { useFooter } from './hooks.js';
|
|
|
3
3
|
import { useAnimate } from 'framer-motion';
|
|
4
4
|
import { ComponentToken, DialogClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
6
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/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';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { useDismissable } from '../../hooks/use-dismissable.js';
|
|
12
|
-
import { contains } from '../../node_modules/@aiszlab/relax/dist/dom/contains.js';
|
|
12
|
+
import { contains } from '../../node_modules/.pnpm/@aiszlab_relax@1.2.55_react-dom@18.3.1_react@18.3.1/node_modules/@aiszlab/relax/dist/dom/contains.js';
|
|
13
13
|
|
|
14
14
|
const styles = {
|
|
15
15
|
header: {
|