musae 0.2.7 → 0.2.9
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/badge/badge.d.ts +4 -0
- package/dist/components/badge/badge.js +80 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/types.d.ts +18 -0
- package/dist/components/checkbox/group.js +1 -1
- package/dist/components/checkbox/types.d.ts +2 -0
- package/dist/components/dialog/dialog.d.ts +1 -1
- package/dist/components/dialog/dialog.js +2 -2
- package/dist/components/dialog/popup.d.ts +1 -1
- package/dist/components/dialog/popup.js +4 -4
- package/dist/components/dialog/types.d.ts +3 -3
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +2 -2
- package/dist/components/drawer/popup.d.ts +1 -1
- package/dist/components/drawer/popup.js +4 -4
- package/dist/components/drawer/types.d.ts +3 -3
- package/dist/components/image/preview/preview.js +1 -1
- package/dist/components/popconfirm/popconfirm.d.ts +4 -0
- package/dist/components/popconfirm/types.d.ts +9 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/popover.js +11 -7
- 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 +0 -1
- package/dist/components/select/types.d.ts +2 -4
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +37 -0
- package/dist/components/skeleton/types.d.ts +19 -0
- package/dist/components/theme/hooks.d.ts +2 -1
- package/dist/components/theme/hooks.js +12 -16
- package/dist/components/theme/types.d.ts +1 -1
- package/dist/components/transfer/types.d.ts +4 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/types.d.ts +12 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +4 -0
- package/dist/hooks/use-class-names.d.ts +11 -0
- package/dist/hooks/use-closable.d.ts +18 -0
- package/dist/hooks/{use-dismissable.js → use-closable.js} +20 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/stylex.css +6 -0
- package/dist/utils/class-name.d.ts +37 -1
- package/dist/utils/class-name.js +29 -1
- package/package.json +1 -2
- package/dist/hooks/use-dismissable.d.ts +0 -18
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
3
|
+
import { ComponentToken, BadgeClassToken } from '../../utils/class-name.js';
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { typography } from '../theme/theme.js';
|
|
7
|
+
import { useTheme } from '../theme/hooks.js';
|
|
8
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
9
|
+
import { isVoid } from '@aiszlab/relax';
|
|
10
|
+
|
|
11
|
+
const styles = {
|
|
12
|
+
badge: {
|
|
13
|
+
default: {
|
|
14
|
+
position: "musae-1n2onr6",
|
|
15
|
+
display: "musae-3nfvp2",
|
|
16
|
+
$$css: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
tail: {
|
|
20
|
+
default: props => [{
|
|
21
|
+
position: "musae-10l6tqk",
|
|
22
|
+
top: "musae-13vifvy",
|
|
23
|
+
right: "musae-3m8u43",
|
|
24
|
+
insetInlineStart: null,
|
|
25
|
+
insetInlineEnd: null,
|
|
26
|
+
transform: "musae-rycbv3",
|
|
27
|
+
borderRadius: "musae-iipnba",
|
|
28
|
+
borderStartStartRadius: null,
|
|
29
|
+
borderStartEndRadius: null,
|
|
30
|
+
borderEndStartRadius: null,
|
|
31
|
+
borderEndEndRadius: null,
|
|
32
|
+
borderTopLeftRadius: null,
|
|
33
|
+
borderTopRightRadius: null,
|
|
34
|
+
borderBottomLeftRadius: null,
|
|
35
|
+
borderBottomRightRadius: null,
|
|
36
|
+
minWidth: "musae-70jws7",
|
|
37
|
+
textAlign: "musae-2b8uid",
|
|
38
|
+
backgroundColor: "musae-q1mx2j",
|
|
39
|
+
color: "musae-19dipnz",
|
|
40
|
+
$$css: true
|
|
41
|
+
}, {
|
|
42
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
43
|
+
"--color": props.color != null ? props.color : "initial"
|
|
44
|
+
}],
|
|
45
|
+
dot: {
|
|
46
|
+
minWidth: null,
|
|
47
|
+
$$css: true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const Badge = ({
|
|
52
|
+
className,
|
|
53
|
+
style,
|
|
54
|
+
children,
|
|
55
|
+
content
|
|
56
|
+
}) => {
|
|
57
|
+
const classNames = useClassNames(ComponentToken.Badge);
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
const isDot = isVoid(content);
|
|
60
|
+
const styled = {
|
|
61
|
+
badge: _stylex.props(styles.badge.default),
|
|
62
|
+
tail: _stylex.props(styles.tail.default({
|
|
63
|
+
backgroundColor: theme.colors[ColorToken.Primary],
|
|
64
|
+
color: theme.colors[ColorToken.OnPrimary]
|
|
65
|
+
}), isDot && styles.tail.dot, typography.label.small)
|
|
66
|
+
};
|
|
67
|
+
return React.createElement("span", {
|
|
68
|
+
className: clsx(classNames[BadgeClassToken.Badge], className, styled.badge.className),
|
|
69
|
+
style: {
|
|
70
|
+
...styled.badge.style,
|
|
71
|
+
...style
|
|
72
|
+
}
|
|
73
|
+
}, children, React.createElement("span", {
|
|
74
|
+
className: clsx(classNames[BadgeClassToken.Tail], styled.tail.className),
|
|
75
|
+
style: styled.tail.style
|
|
76
|
+
}, content));
|
|
77
|
+
};
|
|
78
|
+
var Badge$1 = Badge;
|
|
79
|
+
|
|
80
|
+
export { Badge$1 as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ComponentProps } from "../../types/element";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* badge props
|
|
6
|
+
*/
|
|
7
|
+
export type BadgeProps = ComponentProps & {
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* children
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* content
|
|
16
|
+
*/
|
|
17
|
+
content?: ReactNode;
|
|
18
|
+
};
|
|
@@ -19,7 +19,7 @@ const Group = ({ value: controlledValue, children, onChange, disabled = false })
|
|
|
19
19
|
const _checkedKeys = Array.from(checkedKeys);
|
|
20
20
|
onChange?.(_checkedKeys);
|
|
21
21
|
setValue(_checkedKeys);
|
|
22
|
-
}, [setValue, value]);
|
|
22
|
+
}, [onChange, setValue, value]);
|
|
23
23
|
// context value
|
|
24
24
|
const contextValue = useMemo(() => {
|
|
25
25
|
return {
|
|
@@ -49,6 +49,7 @@ export interface CheckboxGroupProps {
|
|
|
49
49
|
/**
|
|
50
50
|
* @description
|
|
51
51
|
* change handler
|
|
52
|
+
* @default void 0
|
|
52
53
|
*/
|
|
53
54
|
onChange?: (value: Key[]) => void;
|
|
54
55
|
/**
|
|
@@ -92,6 +93,7 @@ export interface CheckboxProps extends ComponentProps {
|
|
|
92
93
|
/**
|
|
93
94
|
* @description
|
|
94
95
|
* disabled
|
|
96
|
+
* @default false
|
|
95
97
|
*/
|
|
96
98
|
disabled?: boolean;
|
|
97
99
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DialogProps } from "./types";
|
|
3
|
-
declare const Dialog: ({ open,
|
|
3
|
+
declare const Dialog: ({ open, closable, ...props }: DialogProps) => React.JSX.Element;
|
|
4
4
|
export default Dialog;
|
|
@@ -3,7 +3,7 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import Popup from './popup.js';
|
|
4
4
|
import { useBoolean } from '@aiszlab/relax';
|
|
5
5
|
|
|
6
|
-
const Dialog = ({ open,
|
|
6
|
+
const Dialog = ({ open, closable = true, ...props }) => {
|
|
7
7
|
/// `Portal` should disappear after `Dialog` disappear completely
|
|
8
8
|
const [_isVisible, { turnOn, turnOff }] = useBoolean(false);
|
|
9
9
|
useEffect(() => {
|
|
@@ -13,7 +13,7 @@ const Dialog = ({ open, dismissable = true, ...props }) => {
|
|
|
13
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
14
|
}, [open]);
|
|
15
15
|
return (React.createElement(Portal, { open: open || _isVisible, lockable: true },
|
|
16
|
-
React.createElement(Popup, { ...props,
|
|
16
|
+
React.createElement(Popup, { ...props, closable: true, open: open, onClosed: turnOff })));
|
|
17
17
|
};
|
|
18
18
|
var Dialog$1 = Dialog;
|
|
19
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PopupProps } from "./types";
|
|
3
|
-
declare const Popup: ({ onClose, open,
|
|
3
|
+
declare const Popup: ({ onClose, open, closable, onClosed, ...props }: PopupProps) => React.JSX.Element;
|
|
4
4
|
export default Popup;
|
|
@@ -8,7 +8,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
|
-
import {
|
|
11
|
+
import { useClosable } from '../../hooks/use-closable.js';
|
|
12
12
|
import { contains } from '../../node_modules/.pnpm/@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';
|
|
13
13
|
|
|
14
14
|
const styles = {
|
|
@@ -88,7 +88,7 @@ const styles = {
|
|
|
88
88
|
const Popup = ({
|
|
89
89
|
onClose,
|
|
90
90
|
open,
|
|
91
|
-
|
|
91
|
+
closable,
|
|
92
92
|
onClosed,
|
|
93
93
|
...props$1
|
|
94
94
|
}) => {
|
|
@@ -103,8 +103,8 @@ const Popup = ({
|
|
|
103
103
|
closer,
|
|
104
104
|
onKeyDown,
|
|
105
105
|
onOverlayClick
|
|
106
|
-
} =
|
|
107
|
-
|
|
106
|
+
} = useClosable({
|
|
107
|
+
closable,
|
|
108
108
|
onClose
|
|
109
109
|
});
|
|
110
110
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Closable } from "../../hooks/use-closable";
|
|
3
3
|
import { RequiredIn } from "@aiszlab/relax/types";
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
@@ -29,7 +29,7 @@ export interface DialogProps {
|
|
|
29
29
|
* Whether the dialog can be closed by clicking on the overlay or pressing the Esc key.
|
|
30
30
|
* @default true
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
closable?: boolean | Closable[];
|
|
33
33
|
/**
|
|
34
34
|
* @description
|
|
35
35
|
* title
|
|
@@ -67,7 +67,7 @@ export interface DialogProps {
|
|
|
67
67
|
* @description
|
|
68
68
|
* popup
|
|
69
69
|
*/
|
|
70
|
-
export type PopupProps = RequiredIn<DialogProps, "
|
|
70
|
+
export type PopupProps = RequiredIn<DialogProps, "closable"> & {
|
|
71
71
|
/**
|
|
72
72
|
* @description
|
|
73
73
|
* callback will be toggled after close animation end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DrawerProps } from "./types";
|
|
3
|
-
declare const Drawer: ({ open, size,
|
|
3
|
+
declare const Drawer: ({ open, size, closable, placement, ...props }: DrawerProps) => React.JSX.Element;
|
|
4
4
|
export default Drawer;
|
|
@@ -3,7 +3,7 @@ import Portal from '../portal/portal.js';
|
|
|
3
3
|
import Popup from './popup.js';
|
|
4
4
|
import { useBoolean } from '@aiszlab/relax';
|
|
5
5
|
|
|
6
|
-
const Drawer = ({ open, size = 400,
|
|
6
|
+
const Drawer = ({ open, size = 400, closable = true, placement = "right", ...props }) => {
|
|
7
7
|
/// `Portal` should disappear after `Dialog` disappear completely
|
|
8
8
|
const [_isVisible, { turnOn, turnOff }] = useBoolean(false);
|
|
9
9
|
useEffect(() => {
|
|
@@ -13,7 +13,7 @@ const Drawer = ({ open, size = 400, dismissable = true, placement = "right", ...
|
|
|
13
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
14
|
}, [open]);
|
|
15
15
|
return (React.createElement(Portal, { open: open || _isVisible, lockable: true },
|
|
16
|
-
React.createElement(Popup, { ...props, onClosed: turnOff, size: size, open: open,
|
|
16
|
+
React.createElement(Popup, { ...props, onClosed: turnOff, size: size, open: open, closable: closable, placement: placement })));
|
|
17
17
|
};
|
|
18
18
|
var Drawer$1 = Drawer;
|
|
19
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PopupProps } from "./types";
|
|
3
|
-
declare const Popup: ({ open, onClose, placement,
|
|
3
|
+
declare const Popup: ({ open, onClose, placement, closable, onClosed, size, ...props }: PopupProps) => React.JSX.Element;
|
|
4
4
|
export default Popup;
|
|
@@ -8,7 +8,7 @@ import { useTheme } from '../theme/hooks.js';
|
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import { typography } from '../theme/theme.js';
|
|
11
|
-
import {
|
|
11
|
+
import { useClosable } from '../../hooks/use-closable.js';
|
|
12
12
|
import { contains } from '../../node_modules/.pnpm/@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';
|
|
13
13
|
|
|
14
14
|
const styles = {
|
|
@@ -137,7 +137,7 @@ const Popup = ({
|
|
|
137
137
|
open,
|
|
138
138
|
onClose,
|
|
139
139
|
placement,
|
|
140
|
-
|
|
140
|
+
closable,
|
|
141
141
|
onClosed,
|
|
142
142
|
size,
|
|
143
143
|
...props$1
|
|
@@ -153,8 +153,8 @@ const Popup = ({
|
|
|
153
153
|
closer,
|
|
154
154
|
onKeyDown,
|
|
155
155
|
onOverlayClick
|
|
156
|
-
} =
|
|
157
|
-
|
|
156
|
+
} = useClosable({
|
|
157
|
+
closable,
|
|
158
158
|
onClose
|
|
159
159
|
});
|
|
160
160
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Closable } from "../../hooks/use-closable";
|
|
3
3
|
export type Placement = "right" | "left" | "top" | "bottom";
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
@@ -35,7 +35,7 @@ export interface DrawerProps {
|
|
|
35
35
|
* Whether the drawer can be closed by clicking on the overlay or pressing the Esc key.
|
|
36
36
|
* @default true
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
closable?: boolean | Closable[];
|
|
39
39
|
/**
|
|
40
40
|
* @description
|
|
41
41
|
* size
|
|
@@ -58,7 +58,7 @@ export interface DrawerProps {
|
|
|
58
58
|
*/
|
|
59
59
|
export type PopupProps = DrawerProps & {
|
|
60
60
|
size: number;
|
|
61
|
-
|
|
61
|
+
closable: boolean | Closable[];
|
|
62
62
|
placement: Placement;
|
|
63
63
|
/**
|
|
64
64
|
* @description
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DOMAttributes, RefAttributes } from "react";
|
|
2
|
+
import type { PopoverProps } from "../popover";
|
|
3
|
+
import { ComponentProps } from "../../types/element";
|
|
4
|
+
export type ChildProps<T> = Pick<DOMAttributes<T>, "onClick"> & RefAttributes<T>;
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* popconfirm props
|
|
8
|
+
*/
|
|
9
|
+
export type PopconfirmProps<P extends ChildProps<T>, T extends HTMLElement> = Pick<PopoverProps<P, T>, "children" | "placement" | "title" | "description"> & ComponentProps;
|
|
@@ -36,16 +36,16 @@ const Popover = ({
|
|
|
36
36
|
const triggerBy = useMemo(() => new Set(toArray(_triggerBy)), [_triggerBy]);
|
|
37
37
|
const classNames = useClassNames(ComponentToken.Popover);
|
|
38
38
|
const childRef = useRefs(_ref, _children.props.ref);
|
|
39
|
-
const
|
|
40
|
-
toggle();
|
|
39
|
+
const onClick = useEvent(e => {
|
|
41
40
|
e.stopPropagation();
|
|
41
|
+
toggle();
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const onContextMenu = useEvent(() => {
|
|
44
44
|
turnOn();
|
|
45
45
|
});
|
|
46
46
|
const [isHovered, hoverProps] = useHover({
|
|
47
|
-
onEnter:
|
|
48
|
-
onLeave:
|
|
47
|
+
onEnter: event => chain(_children.props.onMouseOver, _children.props.onMouseEnter, _children.props.onPointerEnter)(event),
|
|
48
|
+
onLeave: event => chain(_children.props.onMouseLeave, _children.props.onPointerLeave)(event)
|
|
49
49
|
});
|
|
50
50
|
const [isFocused, focusProps] = useFocus({
|
|
51
51
|
onFocus: _children.props.onFocus,
|
|
@@ -64,8 +64,12 @@ const Popover = ({
|
|
|
64
64
|
ref: childRef,
|
|
65
65
|
...hoverProps,
|
|
66
66
|
...focusProps,
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
...(triggerBy.has("click") && {
|
|
68
|
+
onClick
|
|
69
|
+
}),
|
|
70
|
+
...(triggerBy.has("contextMenu") && {
|
|
71
|
+
onContextMenu
|
|
72
|
+
})
|
|
69
73
|
});
|
|
70
74
|
const enterPopper = useEvent(e => {
|
|
71
75
|
hoverProps.onPointerEnter(e);
|
|
@@ -5,13 +5,13 @@ import type { Option } from "../../types/option";
|
|
|
5
5
|
* @description
|
|
6
6
|
* use value
|
|
7
7
|
*/
|
|
8
|
-
export declare const useValue: ({ mode, close, isComplex, ...props }: {
|
|
8
|
+
export declare const useValue: <T extends ValueOrValues = ValueOrValues>({ mode, close, isComplex, ...props }: {
|
|
9
9
|
value: ValueOrValues | undefined;
|
|
10
10
|
readableOptions: ReadableOptions;
|
|
11
11
|
mode: Mode | undefined;
|
|
12
12
|
close: () => void;
|
|
13
13
|
reset: () => void;
|
|
14
|
-
onChange?: (value:
|
|
14
|
+
onChange?: (value: T) => void;
|
|
15
15
|
isComplex: boolean;
|
|
16
16
|
}) => {
|
|
17
17
|
value: ValueOrValues | undefined;
|
|
@@ -33,7 +33,7 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
|
|
|
33
33
|
if (readableValues.has(key))
|
|
34
34
|
return;
|
|
35
35
|
if (isControlled) {
|
|
36
|
-
props.onChange?.(isComplex ? _value : key);
|
|
36
|
+
props.onChange?.((isComplex ? _value : key));
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
setValue(_value);
|
|
@@ -46,12 +46,12 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
|
|
|
46
46
|
const isRemoved = prev.has(key) && prev.delete(key);
|
|
47
47
|
const next = isRemoved ? prev : prev.set(key, _value.label);
|
|
48
48
|
if (isControlled) {
|
|
49
|
-
props.onChange?.(isComplex
|
|
49
|
+
props.onChange?.((isComplex
|
|
50
50
|
? Array.from(next.entries()).map(([value, label]) => ({
|
|
51
51
|
value,
|
|
52
52
|
label,
|
|
53
53
|
}))
|
|
54
|
-
: Array.from(next.keys()));
|
|
54
|
+
: Array.from(next.keys())));
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
setValue(Array.from(next.entries()).map(([value, label]) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { SelectProps } from "./types";
|
|
3
|
-
declare const Select: ({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps) => React.JSX.Element;
|
|
2
|
+
import type { SelectProps, ValueOrValues } from "./types";
|
|
3
|
+
declare const Select: <T extends ValueOrValues = ValueOrValues>({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Select;
|
|
@@ -6,14 +6,13 @@ 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);
|
|
10
9
|
/**
|
|
11
10
|
* @author murukal
|
|
12
11
|
*
|
|
13
12
|
* @description
|
|
14
13
|
* select props
|
|
15
14
|
*/
|
|
16
|
-
export type SelectProps = ComponentProps & {
|
|
15
|
+
export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & {
|
|
17
16
|
/**
|
|
18
17
|
* @description
|
|
19
18
|
* options
|
|
@@ -61,7 +60,7 @@ export type SelectProps = ComponentProps & {
|
|
|
61
60
|
* on value change, toggle
|
|
62
61
|
* @default void 0
|
|
63
62
|
*/
|
|
64
|
-
onChange?:
|
|
63
|
+
onChange?: (value: T) => void;
|
|
65
64
|
};
|
|
66
65
|
/**
|
|
67
66
|
* @description
|
|
@@ -122,4 +121,3 @@ export type SelectionsProps = {
|
|
|
122
121
|
*/
|
|
123
122
|
selectedKeys: MenuProps["selectedKeys"];
|
|
124
123
|
};
|
|
125
|
-
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
|
+
import { ComponentToken, SkeletonClassToken } from '../../utils/class-name.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const styles = {
|
|
8
|
+
skeleton: {
|
|
9
|
+
$$css: true
|
|
10
|
+
},
|
|
11
|
+
animation: {
|
|
12
|
+
animationName: "musae-9q1e4u",
|
|
13
|
+
animationDuration: "musae-mg6eyc",
|
|
14
|
+
animationTimingFunction: "musae-1debuo4",
|
|
15
|
+
animationIterationCount: "musae-a4qsjk",
|
|
16
|
+
$$css: true
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const Skeleton = ({
|
|
20
|
+
animation = false,
|
|
21
|
+
variant,
|
|
22
|
+
className,
|
|
23
|
+
style
|
|
24
|
+
}) => {
|
|
25
|
+
const classNames = useClassNames(ComponentToken.Skeleton);
|
|
26
|
+
const styled = _stylex.props(styles.skeleton, animation && styles.animation);
|
|
27
|
+
return React.createElement("div", {
|
|
28
|
+
className: clsx(classNames[SkeletonClassToken.Skeleton], className, styled.className),
|
|
29
|
+
style: {
|
|
30
|
+
...styled.style,
|
|
31
|
+
...style
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var Skeleton$1 = Skeleton;
|
|
36
|
+
|
|
37
|
+
export { Skeleton$1 as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentProps } from "../../types/element";
|
|
2
|
+
type Variant = "circular" | "rectangular" | "rounded";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* skeleton props
|
|
6
|
+
*/
|
|
7
|
+
export type SkeletonProps = ComponentProps & {
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* animation
|
|
11
|
+
*/
|
|
12
|
+
animation?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* variant
|
|
16
|
+
*/
|
|
17
|
+
variant?: Variant;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MouseEvent } from "react";
|
|
1
2
|
import type { Palette, ContextValue, Theme, Mode } from "./types";
|
|
2
3
|
export declare const PALETTE: Readonly<Palette>;
|
|
3
4
|
/**
|
|
@@ -27,6 +28,6 @@ export declare const useSwitchable: ({ theme }: {
|
|
|
27
28
|
theme: Theme;
|
|
28
29
|
}) => {
|
|
29
30
|
mode: Mode;
|
|
30
|
-
toggle: (event
|
|
31
|
+
toggle: (event?: MouseEvent) => void;
|
|
31
32
|
colors: Record<import("../../utils/colors").ColorToken, string>;
|
|
32
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useContext, useState, useRef, useMemo
|
|
1
|
+
import { createContext, useContext, useState, useRef, useMemo } from 'react';
|
|
2
2
|
import { toColors } from '../../utils/colors.js';
|
|
3
3
|
import { useEvent, useMounted, isFunction } from '@aiszlab/relax';
|
|
4
4
|
import { toClassList } from '../../utils/styles.js';
|
|
@@ -143,9 +143,6 @@ const useSwitchable = ({
|
|
|
143
143
|
className: "musae-ntwwlm musae-ktw8en musae-qotmtd"
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
const _toggle = useCallback(() => {
|
|
147
|
-
setMode(_mode => _mode === "light" ? "dark" : "light");
|
|
148
|
-
}, []);
|
|
149
146
|
const repaint = useEvent(_mode => {
|
|
150
147
|
const _isDark = _mode === "dark";
|
|
151
148
|
document.documentElement.classList.remove(...toClassList((_isDark ? styled.light : styled.dark).className));
|
|
@@ -159,25 +156,24 @@ const useSwitchable = ({
|
|
|
159
156
|
trigger.current = subscriber;
|
|
160
157
|
}).pipe(distinctUntilChanged()).subscribe(_mode => {
|
|
161
158
|
repaint(_mode);
|
|
159
|
+
setMode(_mode);
|
|
162
160
|
});
|
|
163
161
|
});
|
|
164
|
-
|
|
165
|
-
trigger.current?.next(mode);
|
|
166
|
-
}, [mode]);
|
|
167
|
-
/// dark, light mode switch
|
|
162
|
+
// dark, light mode switch
|
|
168
163
|
const toggle = useEvent(event => {
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
const modeSwitchTo = isDark ? "light" : "dark";
|
|
165
|
+
// dom not support animation
|
|
166
|
+
if (!isFunction(document.startViewTransition)) {
|
|
167
|
+
trigger.current?.next(modeSwitchTo);
|
|
171
168
|
return;
|
|
172
169
|
}
|
|
173
|
-
const x = event.clientX;
|
|
174
|
-
const y = event.clientY;
|
|
175
|
-
const radius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y));
|
|
176
170
|
const animation = document.startViewTransition(() => {
|
|
177
|
-
trigger.current?.next(
|
|
171
|
+
trigger.current?.next(modeSwitchTo);
|
|
178
172
|
});
|
|
179
173
|
animation.ready.then(() => {
|
|
180
|
-
|
|
174
|
+
const x = event?.clientX ?? 0;
|
|
175
|
+
const y = event?.clientY ?? 0;
|
|
176
|
+
const radius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y));
|
|
181
177
|
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${radius}px at ${x}px ${y}px)`];
|
|
182
178
|
document.documentElement.animate({
|
|
183
179
|
clipPath: isDark ? [...clipPath].reverse() : clipPath
|
|
@@ -191,7 +187,7 @@ const useSwitchable = ({
|
|
|
191
187
|
return {
|
|
192
188
|
mode,
|
|
193
189
|
toggle,
|
|
194
|
-
colors
|
|
190
|
+
colors
|
|
195
191
|
};
|
|
196
192
|
};
|
|
197
193
|
|
|
@@ -10,21 +10,25 @@ export type TransferProps = ComponentProps & {
|
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
12
12
|
* options
|
|
13
|
+
* @requires
|
|
13
14
|
*/
|
|
14
15
|
options: TransferOption[];
|
|
15
16
|
/**
|
|
16
17
|
* @description
|
|
17
18
|
* value
|
|
19
|
+
* @default void 0
|
|
18
20
|
*/
|
|
19
21
|
value?: Key[];
|
|
20
22
|
/**
|
|
21
23
|
* @description
|
|
22
24
|
* titles
|
|
25
|
+
* @default [null, null]
|
|
23
26
|
*/
|
|
24
27
|
titles?: [ReactNode, ReactNode];
|
|
25
28
|
/**
|
|
26
29
|
* @description
|
|
27
30
|
* disabled
|
|
31
|
+
* @default false
|
|
28
32
|
*/
|
|
29
33
|
disabled?: boolean;
|
|
30
34
|
};
|
|
@@ -233,4 +233,15 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
|
|
|
233
233
|
2: string;
|
|
234
234
|
4: string;
|
|
235
235
|
};
|
|
236
|
+
40: {
|
|
237
|
+
0: string;
|
|
238
|
+
1: string;
|
|
239
|
+
};
|
|
240
|
+
41: {
|
|
241
|
+
0: string;
|
|
242
|
+
1: string;
|
|
243
|
+
};
|
|
244
|
+
42: {
|
|
245
|
+
0: string;
|
|
246
|
+
};
|
|
236
247
|
}[T];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { KeyboardEvent } from "react";
|
|
2
|
+
export type Closable = "esc" | "overlay" | "close";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* for dialog, close means some events or some elements
|
|
6
|
+
* in musae, we use a hook to handle this
|
|
7
|
+
*
|
|
8
|
+
* by default, closable may be different type, like `false` | ['esc'] | undefined
|
|
9
|
+
* resolve these types, we convert to `Set<Closable>`
|
|
10
|
+
*/
|
|
11
|
+
export declare const useClosable: ({ onClose, closable }: {
|
|
12
|
+
onClose?: VoidFunction;
|
|
13
|
+
closable: boolean | Closable[];
|
|
14
|
+
}) => {
|
|
15
|
+
closer: React.JSX.Element | null;
|
|
16
|
+
onOverlayClick: () => void;
|
|
17
|
+
onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
18
|
+
};
|
|
@@ -6,22 +6,26 @@ import Close from '../components/icon/icons/navigation/close.js';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
* for dialog,
|
|
9
|
+
* for dialog, close means some events or some elements
|
|
10
10
|
* in musae, we use a hook to handle this
|
|
11
11
|
*
|
|
12
|
-
* by default,
|
|
13
|
-
* resolve these types, we convert to `Set<
|
|
12
|
+
* by default, closable may be different type, like `false` | ['esc'] | undefined
|
|
13
|
+
* resolve these types, we convert to `Set<Closable>`
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const useClosable = ({
|
|
16
|
+
onClose,
|
|
17
|
+
closable
|
|
18
|
+
}) => {
|
|
19
|
+
// convert closable to enum sets
|
|
20
|
+
const triggers = useMemo(() => {
|
|
21
|
+
if (isUndefined(closable) || closable === true) {
|
|
18
22
|
return new Set(["close", "esc", "overlay"]);
|
|
19
23
|
}
|
|
20
|
-
return new Set(
|
|
21
|
-
}, [
|
|
22
|
-
|
|
24
|
+
return new Set(closable || []);
|
|
25
|
+
}, [closable]);
|
|
26
|
+
// closer react element for dialog
|
|
23
27
|
const closer = useMemo(() => {
|
|
24
|
-
if (!
|
|
28
|
+
if (!triggers.has("close")) return null;
|
|
25
29
|
const styled = {
|
|
26
30
|
className: "musae-9c655z musae-6al1c1"
|
|
27
31
|
};
|
|
@@ -29,7 +33,7 @@ const useDismissable = props => {
|
|
|
29
33
|
shape: "circular",
|
|
30
34
|
variant: "text",
|
|
31
35
|
prefix: React.createElement(Close, null),
|
|
32
|
-
onClick:
|
|
36
|
+
onClick: onClose,
|
|
33
37
|
className: styled.className,
|
|
34
38
|
style: {
|
|
35
39
|
...styled.style,
|
|
@@ -37,16 +41,16 @@ const useDismissable = props => {
|
|
|
37
41
|
},
|
|
38
42
|
size: "small"
|
|
39
43
|
});
|
|
40
|
-
}, [
|
|
44
|
+
}, [triggers, onClose]);
|
|
41
45
|
/// overlay click callback
|
|
42
46
|
const onOverlayClick = useEvent(() => {
|
|
43
|
-
if (!
|
|
44
|
-
|
|
47
|
+
if (!triggers.has("overlay")) return;
|
|
48
|
+
onClose?.();
|
|
45
49
|
});
|
|
46
50
|
/// esc key press callback
|
|
47
51
|
const onKeyDown = useEvent(e => {
|
|
48
52
|
if (e.key !== Keyboard.Escape) return;
|
|
49
|
-
|
|
53
|
+
onClose?.();
|
|
50
54
|
});
|
|
51
55
|
return {
|
|
52
56
|
closer,
|
|
@@ -55,4 +59,4 @@ const useDismissable = props => {
|
|
|
55
59
|
};
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
export {
|
|
62
|
+
export { useClosable };
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export { Watermark } from "./components/watermark";
|
|
|
50
50
|
export { Collapse } from "./components/collapse";
|
|
51
51
|
export { FloatingActionButton } from "./components/floating-action-button";
|
|
52
52
|
export { Transfer } from "./components/transfer";
|
|
53
|
+
export { Badge } from "./components/badge";
|
|
54
|
+
export { Skeleton } from "./components/skeleton";
|
|
53
55
|
/**
|
|
54
56
|
* @description
|
|
55
57
|
* hooks
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,8 @@ export { default as Watermark } from './components/watermark/watermark.js';
|
|
|
47
47
|
export { default as Collapse } from './components/collapse/collapse.js';
|
|
48
48
|
export { default as FloatingActionButton } from './components/floating-action-button/floating-action-button.js';
|
|
49
49
|
export { default as Transfer } from './components/transfer/transfer.js';
|
|
50
|
+
export { default as Badge } from './components/badge/badge.js';
|
|
51
|
+
export { default as Skeleton } from './components/skeleton/skeleton.js';
|
|
50
52
|
export { useMessage } from './components/message/hooks.js';
|
|
51
53
|
export { useNotification } from './components/notification/hooks.js';
|
|
52
54
|
export { useTheme } from './components/theme/hooks.js';
|
package/dist/stylex.css
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:root{--musae-1vh8wei:1;--musae-11upij1:50;--musae-oqacdq:60;--musae-if0yew:990;--musae-9gpkaf:1080;--musae-80rspi:1080;--musae-ah5ngi:1080;--musae-ymrixl:1080;--musae-1tyqau6:1090;--musae-7fr0d6:1200;--musae-dlxqgz:9999;}
|
|
5
5
|
:root{--musae-1wblvyz:0px;--musae-dojqt2:1px;--musae-1h5s2h0:2px;--musae-qk2ac7:4px;--musae-h30iw9:6px;--musae-vk5id6:8px;--musae-1ncxh3n:12px;--musae-oohzsl:16px;--musae-1tzp6vk:24px;--musae-15cw4i4:32px;--musae-1n7xs5j:48px;--musae-68a8pz:auto;}
|
|
6
6
|
:root{--musae-gmufu8:none;--musae-15zostt:0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);--musae-1trg6py:0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);--musae-4poz8g:0px 1px 3px 0px rgba(0, 0, 0, 0.30), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);--musae-1vq77kn:0px 2px 3px 0px rgba(0, 0, 0, 0.30), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);--musae-1yt3x0a:0px 4px 4px 0px rgba(0, 0, 0, 0.30), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);}
|
|
7
|
+
@keyframes musae-1928g5l-B{from{background-position:100% 50%;}100%{background-position:0 50%;}}
|
|
7
8
|
@keyframes musae-r5zuwi-B{from{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-110;}12%{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-110;}20%{stroke-dasharray:20 200;stroke-width:30px;stroke-dashoffset:-115;}40%{stroke-dasharray:20 200;stroke-width:30px;stroke-dashoffset:-195;}48%{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-220;}62%{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-220;}70%{stroke-dasharray:20 200;stroke-width:30px;stroke-dashoffset:-225;}90%{stroke-dasharray:20 200;stroke-width:30px;stroke-dashoffset:-305;}98%{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-330;}to{stroke-dasharray:0 220;stroke-width:20px;stroke-dashoffset:-330;}}
|
|
8
9
|
@keyframes musae-f6d5zf-B{from{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:0;}8%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-5;}28%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-175;}36%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-220;}58%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-220;}66%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-225;}86%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-395;}94%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-440;}to{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-440;}}
|
|
9
10
|
@keyframes musae-60a50w-B{from{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:0;}8%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:0;}16%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-5;}36%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-175;}44%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-220;}50%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-220;}58%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-225;}78%{stroke-dasharray:40 400;stroke-width:30px;stroke-dashoffset:-395;}86%{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-440;}to{stroke-dasharray:0 440;stroke-width:20px;stroke-dashoffset:-440;}}
|
|
@@ -91,12 +92,15 @@
|
|
|
91
92
|
.musae-1bdtpbn:not(#\#):not(#\#):not(#\#){align-items:var(--alignItems,revert)}
|
|
92
93
|
.musae-amitd3:not(#\#):not(#\#):not(#\#){align-self:center}
|
|
93
94
|
.musae-qcrz7y:not(#\#):not(#\#):not(#\#){align-self:flex-start}
|
|
95
|
+
.musae-mg6eyc:not(#\#):not(#\#):not(#\#){animation-duration:1.5s}
|
|
94
96
|
.musae-1c74tu6:not(#\#):not(#\#):not(#\#){animation-duration:2s}
|
|
95
97
|
.musae-a4qsjk:not(#\#):not(#\#):not(#\#){animation-iteration-count:infinite}
|
|
98
|
+
.musae-9q1e4u:not(#\#):not(#\#):not(#\#){animation-name:musae-1928g5l-B}
|
|
96
99
|
.musae-17fodkt:not(#\#):not(#\#):not(#\#){animation-name:musae-60a50w-B}
|
|
97
100
|
.musae-wowzen:not(#\#):not(#\#):not(#\#){animation-name:musae-f6d5zf-B}
|
|
98
101
|
.musae-1rxx6we:not(#\#):not(#\#):not(#\#){animation-name:musae-r5zuwi-B}
|
|
99
102
|
.musae-1fnjvy4:not(#\#):not(#\#):not(#\#){animation-name:musae-rw80zm-B}
|
|
103
|
+
.musae-1debuo4:not(#\#):not(#\#):not(#\#){animation-timing-function:ease}
|
|
100
104
|
.musae-1esw782:not(#\#):not(#\#):not(#\#){animation-timing-function:linear}
|
|
101
105
|
.musae-1plog1:not(#\#):not(#\#):not(#\#){aspect-ratio:1}
|
|
102
106
|
.musae-1u5qhrl:not(#\#):not(#\#):not(#\#){background-color:#808080}
|
|
@@ -227,6 +231,7 @@ html[dir='rtl'] .musae-p4054r:not(#\#):not(#\#):not(#\#){text-align:left}
|
|
|
227
231
|
.musae-1158fpu:not(#\#):not(#\#):not(#\#){transform:rotate(45deg)}
|
|
228
232
|
.musae-1iffjtl:not(#\#):not(#\#):not(#\#){transform:rotate(90deg)}
|
|
229
233
|
.musae-11lhmoz:not(#\#):not(#\#):not(#\#){transform:translate(-50%,-50%)}
|
|
234
|
+
.musae-rycbv3:not(#\#):not(#\#):not(#\#){transform:translateX(50%) translateY(-50%)}
|
|
230
235
|
.musae-1v0jg1i:not(#\#):not(#\#):not(#\#){transform:var(--transform,revert)}
|
|
231
236
|
.musae-1g2r6go:not(#\#):not(#\#):not(#\#){transition-duration:.1s}
|
|
232
237
|
.musae-13dflua:not(#\#):not(#\#):not(#\#){transition-duration:.2s}
|
|
@@ -329,6 +334,7 @@ html[dir='rtl'] .musae-p4054r:not(#\#):not(#\#):not(#\#){text-align:left}
|
|
|
329
334
|
.musae-13to73x:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--minWidth,revert)}
|
|
330
335
|
.musae-1fpxtso:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-11uhodo)}
|
|
331
336
|
.musae-yumy05:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-1aj7t22)}
|
|
337
|
+
.musae-70jws7:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-1l9c3uf)}
|
|
332
338
|
.musae-h2iun8:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-1spnrok)}
|
|
333
339
|
.musae-ba7gwn:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-cftog7)}
|
|
334
340
|
.musae-1049mhy:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-laggmb)}
|
|
@@ -48,7 +48,10 @@ export declare enum ComponentToken {
|
|
|
48
48
|
Loading = 36,
|
|
49
49
|
Collapse = 37,
|
|
50
50
|
Waterfall = 38,
|
|
51
|
-
Transfer = 39
|
|
51
|
+
Transfer = 39,
|
|
52
|
+
Badge = 40,
|
|
53
|
+
Skeleton = 41,
|
|
54
|
+
VisuallyHidden = 42
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
57
|
* @description
|
|
@@ -285,6 +288,17 @@ export declare enum TransferClassToken {
|
|
|
285
288
|
Item = 5,
|
|
286
289
|
Operation = 6
|
|
287
290
|
}
|
|
291
|
+
export declare enum BadgeClassToken {
|
|
292
|
+
Badge = 0,
|
|
293
|
+
Tail = 1
|
|
294
|
+
}
|
|
295
|
+
export declare enum SkeletonClassToken {
|
|
296
|
+
Skeleton = 0,
|
|
297
|
+
Circular = 1
|
|
298
|
+
}
|
|
299
|
+
export declare enum VisuallyHiddenClassToken {
|
|
300
|
+
VisuallyHidden = 0
|
|
301
|
+
}
|
|
288
302
|
/**
|
|
289
303
|
* @description
|
|
290
304
|
* class name collection
|
|
@@ -522,6 +536,17 @@ export declare const CLASS_NAMES: {
|
|
|
522
536
|
2: string;
|
|
523
537
|
4: string;
|
|
524
538
|
};
|
|
539
|
+
40: {
|
|
540
|
+
0: string;
|
|
541
|
+
1: string;
|
|
542
|
+
};
|
|
543
|
+
41: {
|
|
544
|
+
0: string;
|
|
545
|
+
1: string;
|
|
546
|
+
};
|
|
547
|
+
42: {
|
|
548
|
+
0: string;
|
|
549
|
+
};
|
|
525
550
|
};
|
|
526
551
|
/**
|
|
527
552
|
* @description
|
|
@@ -762,4 +787,15 @@ export declare const DEFAULT_CLASS_NAMES: {
|
|
|
762
787
|
2: string;
|
|
763
788
|
4: string;
|
|
764
789
|
};
|
|
790
|
+
40: {
|
|
791
|
+
0: string;
|
|
792
|
+
1: string;
|
|
793
|
+
};
|
|
794
|
+
41: {
|
|
795
|
+
0: string;
|
|
796
|
+
1: string;
|
|
797
|
+
};
|
|
798
|
+
42: {
|
|
799
|
+
0: string;
|
|
800
|
+
};
|
|
765
801
|
};
|
package/dist/utils/class-name.js
CHANGED
|
@@ -58,6 +58,9 @@ var ComponentToken;
|
|
|
58
58
|
ComponentToken[ComponentToken["Collapse"] = 37] = "Collapse";
|
|
59
59
|
ComponentToken[ComponentToken["Waterfall"] = 38] = "Waterfall";
|
|
60
60
|
ComponentToken[ComponentToken["Transfer"] = 39] = "Transfer";
|
|
61
|
+
ComponentToken[ComponentToken["Badge"] = 40] = "Badge";
|
|
62
|
+
ComponentToken[ComponentToken["Skeleton"] = 41] = "Skeleton";
|
|
63
|
+
ComponentToken[ComponentToken["VisuallyHidden"] = 42] = "VisuallyHidden";
|
|
61
64
|
})(ComponentToken || (ComponentToken = {}));
|
|
62
65
|
/**
|
|
63
66
|
* @description
|
|
@@ -334,6 +337,20 @@ var TransferClassToken;
|
|
|
334
337
|
TransferClassToken[TransferClassToken["Item"] = 5] = "Item";
|
|
335
338
|
TransferClassToken[TransferClassToken["Operation"] = 6] = "Operation";
|
|
336
339
|
})(TransferClassToken || (TransferClassToken = {}));
|
|
340
|
+
var BadgeClassToken;
|
|
341
|
+
(function (BadgeClassToken) {
|
|
342
|
+
BadgeClassToken[BadgeClassToken["Badge"] = 0] = "Badge";
|
|
343
|
+
BadgeClassToken[BadgeClassToken["Tail"] = 1] = "Tail";
|
|
344
|
+
})(BadgeClassToken || (BadgeClassToken = {}));
|
|
345
|
+
var SkeletonClassToken;
|
|
346
|
+
(function (SkeletonClassToken) {
|
|
347
|
+
SkeletonClassToken[SkeletonClassToken["Skeleton"] = 0] = "Skeleton";
|
|
348
|
+
SkeletonClassToken[SkeletonClassToken["Circular"] = 1] = "Circular";
|
|
349
|
+
})(SkeletonClassToken || (SkeletonClassToken = {}));
|
|
350
|
+
var VisuallyHiddenClassToken;
|
|
351
|
+
(function (VisuallyHiddenClassToken) {
|
|
352
|
+
VisuallyHiddenClassToken[VisuallyHiddenClassToken["VisuallyHidden"] = 0] = "VisuallyHidden";
|
|
353
|
+
})(VisuallyHiddenClassToken || (VisuallyHiddenClassToken = {}));
|
|
337
354
|
/**
|
|
338
355
|
* @description
|
|
339
356
|
* class name collection
|
|
@@ -571,6 +588,17 @@ const CLASS_NAMES = {
|
|
|
571
588
|
[TransferClassToken.Header]: "transfer__list-header",
|
|
572
589
|
[TransferClassToken.Body]: "transfer__list-body",
|
|
573
590
|
},
|
|
591
|
+
[ComponentToken.Badge]: {
|
|
592
|
+
[BadgeClassToken.Badge]: "badge",
|
|
593
|
+
[BadgeClassToken.Tail]: "badge__tail",
|
|
594
|
+
},
|
|
595
|
+
[ComponentToken.Skeleton]: {
|
|
596
|
+
[SkeletonClassToken.Skeleton]: "skeleton",
|
|
597
|
+
[SkeletonClassToken.Circular]: "skeleton--circular",
|
|
598
|
+
},
|
|
599
|
+
[ComponentToken.VisuallyHidden]: {
|
|
600
|
+
[VisuallyHiddenClassToken.VisuallyHidden]: "visually-hidden",
|
|
601
|
+
},
|
|
574
602
|
};
|
|
575
603
|
/**
|
|
576
604
|
* @description
|
|
@@ -589,4 +617,4 @@ const addPrefix = (classNames, prefix) => {
|
|
|
589
617
|
*/
|
|
590
618
|
const DEFAULT_CLASS_NAMES = addPrefix(CLASS_NAMES, Token.Prefix);
|
|
591
619
|
|
|
592
|
-
export { AvatarClassToken, BreadcrumbClassToken, ButtonClassToken, CLASS_NAMES, CalendarClassToken, CascaderClassToken, CheckboxClassToken, ClockClassToken, CollapseClassToken, ComponentToken, DEFAULT_CLASS_NAMES, DatePickerClassToken, DateRangePickerClassToken, DialogClassToken, DividerClassToken, DrawerClassToken, EmptyClassToken, FormClassToken, GridClassToken, IconClassToken, InputClassToken, LoadingClassToken, MenuClassToken, NotificationClassToken, PaginationClassToken, PickerClassToken, PopoverClassToken, PopperClassToken, ProgressClassToken, RadioClassToken, RateClassToken, SelectClassToken, StepsClassToken, SwitchClassToken, TabsClassToken, TagClassToken, TimePickerClassToken, TimelineClassToken, TooltipClassToken, TourClassToken, TransferClassToken, TreeClassToken, WaterfallClassToken, addPrefix, withPrefix };
|
|
620
|
+
export { AvatarClassToken, BadgeClassToken, BreadcrumbClassToken, ButtonClassToken, CLASS_NAMES, CalendarClassToken, CascaderClassToken, CheckboxClassToken, ClockClassToken, CollapseClassToken, ComponentToken, DEFAULT_CLASS_NAMES, DatePickerClassToken, DateRangePickerClassToken, DialogClassToken, DividerClassToken, DrawerClassToken, EmptyClassToken, FormClassToken, GridClassToken, IconClassToken, InputClassToken, LoadingClassToken, MenuClassToken, NotificationClassToken, PaginationClassToken, PickerClassToken, PopoverClassToken, PopperClassToken, ProgressClassToken, RadioClassToken, RateClassToken, SelectClassToken, SkeletonClassToken, StepsClassToken, SwitchClassToken, TabsClassToken, TagClassToken, TimePickerClassToken, TimelineClassToken, TooltipClassToken, TourClassToken, TransferClassToken, TreeClassToken, VisuallyHiddenClassToken, WaterfallClassToken, addPrefix, withPrefix };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musae",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "musae-ui",
|
|
5
5
|
"author": "tutu@fantufantu.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"deepmerge": "^4.3.1",
|
|
38
38
|
"framer-motion": "^11.2.11",
|
|
39
39
|
"react-hook-form": "^7.47.0",
|
|
40
|
-
"rrweb": "2.0.0-alpha.4",
|
|
41
40
|
"rxjs": "^7.8.1"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { KeyboardEvent } from "react";
|
|
2
|
-
export type Dismissable = "esc" | "overlay" | "close";
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* for dialog, dismiss means some events or some elements
|
|
6
|
-
* in musae, we use a hook to handle this
|
|
7
|
-
*
|
|
8
|
-
* by default, dismissable may be different type, like `false` | ['esc'] | undefined
|
|
9
|
-
* resolve these types, we convert to `Set<Dismissable>`
|
|
10
|
-
*/
|
|
11
|
-
export declare const useDismissable: (props: {
|
|
12
|
-
onClose?: VoidFunction;
|
|
13
|
-
dismissable: boolean | Dismissable[];
|
|
14
|
-
}) => {
|
|
15
|
-
closer: React.JSX.Element | null;
|
|
16
|
-
onOverlayClick: () => void;
|
|
17
|
-
onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
18
|
-
};
|