musae 0.1.0 → 0.1.2
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/avatar/{Avatar.js → avatar.js} +2 -3
- package/dist/avatar/fallback.d.ts +3 -0
- package/dist/avatar/image.d.ts +6 -0
- package/dist/avatar/image.js +10 -0
- package/dist/avatar/index.d.ts +2 -4
- package/dist/button/button.d.ts +2 -2
- package/dist/button/types.d.ts +11 -0
- package/dist/checkbox/checkbox.d.ts +4 -0
- package/dist/checkbox/checkbox.js +25 -0
- package/dist/checkbox/context.d.ts +4 -0
- package/dist/checkbox/context.js +5 -0
- package/dist/checkbox/group.d.ts +4 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/types.d.ts +30 -0
- package/dist/checkbox/wrapper.d.ts +6 -0
- package/dist/checkbox/wrapper.js +49 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -4
- package/dist/input/hooks.d.ts +1 -1
- package/dist/input/hooks.js +3 -5
- package/dist/input/input.js +1 -1
- package/dist/input/types.d.ts +44 -0
- package/dist/loading/circle.d.ts +7 -0
- package/dist/loading/circle.js +14 -0
- package/dist/loading/index.d.ts +1 -1
- package/dist/loading/{Loading.d.ts → loading.d.ts} +0 -1
- package/{styles/loading.css → dist/loading/loading.js} +65 -83
- package/dist/loading/types.d.ts +9 -0
- package/dist/loading/wrapper.d.ts +6 -0
- package/dist/loading/wrapper.js +10 -0
- package/dist/menu-item/menu-item.d.ts +1 -1
- package/dist/menu-item/menu-item.js +1 -7
- package/dist/menu-item/types.d.ts +11 -0
- package/dist/message/message.d.ts +2 -2
- package/dist/message/types.d.ts +30 -0
- package/dist/popper/popper.d.ts +2 -2
- package/dist/popper/types.d.ts +17 -0
- package/dist/radio/context.d.ts +4 -0
- package/dist/radio/context.js +5 -0
- package/dist/radio/group.d.ts +4 -0
- package/dist/radio/group.js +20 -0
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/radio.d.ts +4 -0
- package/dist/radio/radio.js +17 -0
- package/dist/radio/types.d.ts +30 -0
- package/dist/radio/wrapper.d.ts +6 -0
- package/dist/radio/wrapper.js +34 -0
- package/dist/select/hooks.d.ts +8 -0
- package/dist/select/select.d.ts +2 -1
- package/dist/select/select.js +1 -1
- package/dist/select/types.d.ts +13 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/switch.d.ts +4 -0
- package/dist/switch/switch.js +13 -0
- package/dist/switch/types.d.ts +10 -0
- package/dist/switch/wrapper.d.ts +6 -0
- package/dist/switch/wrapper.js +37 -0
- package/dist/theme/theme-provider.d.ts +2 -2
- package/dist/theme/types.d.ts +36 -0
- package/package.json +2 -2
- package/dist/avatar/AvatarFallback.d.ts +0 -3
- package/dist/avatar/AvatarFallback.js +0 -7
- package/dist/avatar/AvatarImage.d.ts +0 -3
- package/dist/avatar/AvatarImage.js +0 -10
- package/dist/loading/Loading.js +0 -13
- package/dist/node_modules/tslib/tslib.es6.js +0 -10
- /package/dist/avatar/{Avatar.d.ts → avatar.d.ts} +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useImageLoader } from '@aiszlab/relax';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import Image from './image.js';
|
|
5
5
|
|
|
6
6
|
const Avatar = (props) => {
|
|
7
7
|
const status = useImageLoader({
|
|
8
8
|
src: props.src,
|
|
9
9
|
});
|
|
10
|
-
console.log("status=====", status);
|
|
11
10
|
const child = useMemo(() => {
|
|
12
11
|
// if (status === "none") {
|
|
13
12
|
// return props.alt;
|
|
14
13
|
// }
|
|
15
|
-
return React.createElement(
|
|
14
|
+
return React.createElement(Image, { src: props.src });
|
|
16
15
|
}, [props.alt, status, props.src]);
|
|
17
16
|
return React.createElement("div", { className: clsx("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full") }, child);
|
|
18
17
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Image: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
6
|
+
export default Image;
|
package/dist/avatar/index.d.ts
CHANGED
package/dist/button/button.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Props } from "./types";
|
|
2
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
3
|
/**
|
|
4
4
|
* @author murukal
|
|
5
5
|
*
|
|
6
6
|
* @description
|
|
7
7
|
* button
|
|
8
8
|
*/
|
|
9
|
-
declare const Button:
|
|
9
|
+
declare const Button: ({ children, onClick }: Props) => React.JSX.Element;
|
|
10
10
|
export default Button;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useContext, useMemo, useCallback } from 'react';
|
|
2
|
+
import Wrapper from './wrapper.js';
|
|
3
|
+
import { useControlledState } from '@aiszlab/relax';
|
|
4
|
+
import Context from './context.js';
|
|
5
|
+
|
|
6
|
+
const Checkbox = (props) => {
|
|
7
|
+
const contextValue = useContext(Context);
|
|
8
|
+
const controlledIsChecked = useMemo(() => {
|
|
9
|
+
if (props.isChecked !== void 0) {
|
|
10
|
+
return props.isChecked;
|
|
11
|
+
}
|
|
12
|
+
if ((contextValue === null || contextValue === void 0 ? void 0 : contextValue.value) === void 0) {
|
|
13
|
+
return void 0;
|
|
14
|
+
}
|
|
15
|
+
return contextValue.value === props.value;
|
|
16
|
+
}, [props.isChecked, props.value, contextValue === null || contextValue === void 0 ? void 0 : contextValue.value]);
|
|
17
|
+
const [isChecked, setIsChecked] = useControlledState(controlledIsChecked);
|
|
18
|
+
/// change handler
|
|
19
|
+
const change = useCallback((event) => {
|
|
20
|
+
setIsChecked(event.target.checked);
|
|
21
|
+
}, [setIsChecked]);
|
|
22
|
+
return React.createElement(Wrapper, { type: "checkbox", checked: !!isChecked, "aria-checked": !!isChecked, onChange: change });
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { Checkbox as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @author murukal
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* context value
|
|
7
|
+
*/
|
|
8
|
+
export interface ContextValue {
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @author murukal
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* group render props
|
|
17
|
+
*/
|
|
18
|
+
export interface GroupRenderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @author murukal
|
|
23
|
+
*
|
|
24
|
+
* @description
|
|
25
|
+
* checkbox render props
|
|
26
|
+
*/
|
|
27
|
+
export interface CheckboxRenderProps {
|
|
28
|
+
isChecked?: boolean;
|
|
29
|
+
value?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
6
|
+
export default Wrapper;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { useTheme } from '../theme/hooks.js';
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled.input(() => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return {
|
|
8
|
+
margin: 0,
|
|
9
|
+
visibility: "hidden",
|
|
10
|
+
width: "1rem",
|
|
11
|
+
height: "1rem",
|
|
12
|
+
"::before": {
|
|
13
|
+
content: "''",
|
|
14
|
+
visibility: "visible",
|
|
15
|
+
display: "block",
|
|
16
|
+
boxSizing: "border-box",
|
|
17
|
+
width: "1rem",
|
|
18
|
+
height: "1rem",
|
|
19
|
+
borderRadius: "0.2rem",
|
|
20
|
+
borderWidth: "0.1rem",
|
|
21
|
+
borderStyle: "solid",
|
|
22
|
+
borderColor: "gray",
|
|
23
|
+
transition: "all 200ms",
|
|
24
|
+
},
|
|
25
|
+
"&[aria-checked=true]": {
|
|
26
|
+
"::before": {
|
|
27
|
+
backgroundColor: (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
28
|
+
borderColor: (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.primary,
|
|
29
|
+
},
|
|
30
|
+
"::after": {
|
|
31
|
+
content: "''",
|
|
32
|
+
visibility: "visible",
|
|
33
|
+
boxSizing: "border-box",
|
|
34
|
+
position: "absolute",
|
|
35
|
+
display: "block",
|
|
36
|
+
width: "0.2rem",
|
|
37
|
+
height: "0.5rem",
|
|
38
|
+
borderWidth: "0.1rem",
|
|
39
|
+
borderStyle: "solid",
|
|
40
|
+
borderColor: "white",
|
|
41
|
+
borderTop: 0,
|
|
42
|
+
borderLeft: 0,
|
|
43
|
+
transform: "translate(200%, -150%) rotate(45deg)",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export { Wrapper as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* @description
|
|
3
3
|
* components
|
|
4
4
|
*/
|
|
5
|
-
export { Avatar
|
|
5
|
+
export { Avatar } from "./avatar";
|
|
6
6
|
export { Menu, type Props as MenuProps } from "./menu";
|
|
7
7
|
export { Loading } from "./loading";
|
|
8
8
|
export { Input } from "./input";
|
|
9
9
|
export { Select } from "./select";
|
|
10
10
|
export { Button } from "./button";
|
|
11
|
+
export { Switch } from "./switch";
|
|
12
|
+
export { Radio, RadioGroup } from "./radio";
|
|
13
|
+
export { Checkbox } from "./checkbox";
|
|
11
14
|
/**
|
|
12
15
|
* @description
|
|
13
16
|
* hooks
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { default as Avatar } from './avatar/
|
|
2
|
-
export { default as AvatarImage } from './avatar/AvatarImage.js';
|
|
3
|
-
export { default as AvatarFallback } from './avatar/AvatarFallback.js';
|
|
1
|
+
export { default as Avatar } from './avatar/avatar.js';
|
|
4
2
|
export { default as Menu } from './menu/menu.js';
|
|
5
|
-
export { default as Loading } from './loading/
|
|
3
|
+
export { default as Loading } from './loading/loading.js';
|
|
6
4
|
export { default as Input } from './input/input.js';
|
|
7
5
|
export { default as Select } from './select/select.js';
|
|
8
6
|
export { default as Button } from './button/button.js';
|
|
7
|
+
export { default as Switch } from './switch/switch.js';
|
|
8
|
+
export { default as Radio } from './radio/radio.js';
|
|
9
|
+
export { default as RadioGroup } from './radio/group.js';
|
|
10
|
+
export { default as Checkbox } from './checkbox/checkbox.js';
|
|
9
11
|
export { useMessage } from './message/hooks.js';
|
package/dist/input/hooks.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { Variant } from "./types";
|
|
|
2
2
|
/**
|
|
3
3
|
* @description class name for input
|
|
4
4
|
*/
|
|
5
|
-
export declare const useStyles: ([variant, isFocused]: [variant: Variant, isFocused: boolean]) => {
|
|
5
|
+
export declare const useStyles: ([variant, isFocused, className]: [variant: Variant, isFocused: boolean, className?: string | undefined]) => {
|
|
6
6
|
wrapperClassName: string;
|
|
7
7
|
};
|
package/dist/input/hooks.js
CHANGED
|
@@ -4,13 +4,11 @@ import clsx from 'clsx';
|
|
|
4
4
|
/**
|
|
5
5
|
* @description class name for input
|
|
6
6
|
*/
|
|
7
|
-
const useStyles = ([variant, isFocused]) => {
|
|
7
|
+
const useStyles = ([variant, isFocused, className]) => {
|
|
8
8
|
/// wrapper
|
|
9
9
|
const wrapperClassName = useMemo(() => {
|
|
10
|
-
return clsx(
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
}, []);
|
|
10
|
+
return clsx(["musae-input-wrapper", className]);
|
|
11
|
+
}, [className]);
|
|
14
12
|
return {
|
|
15
13
|
wrapperClassName,
|
|
16
14
|
};
|
package/dist/input/input.js
CHANGED
|
@@ -29,7 +29,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
29
29
|
/// variant
|
|
30
30
|
const variant = useMemo(() => props.variant || "outlined", [props.variant]);
|
|
31
31
|
/// style
|
|
32
|
-
const { wrapperClassName } = useStyles([variant, isFocused]);
|
|
32
|
+
const { wrapperClassName } = useStyles([variant, isFocused, props.className]);
|
|
33
33
|
/// used input props
|
|
34
34
|
const inputProps = useMemo(() => {
|
|
35
35
|
return {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @description Variant
|
|
4
|
+
*/
|
|
5
|
+
export type Variant = "outlined" | "filled" | "standard";
|
|
6
|
+
/**
|
|
7
|
+
* @description component props
|
|
8
|
+
*/
|
|
9
|
+
export interface Props {
|
|
10
|
+
label?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
variant?: Variant;
|
|
13
|
+
prefix?: ReactNode;
|
|
14
|
+
suffix?: ReactNode;
|
|
15
|
+
type: "password" | "text";
|
|
16
|
+
value?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
onChange?: VoidFunction;
|
|
19
|
+
onFocus?: UsedInputProps["onFocus"];
|
|
20
|
+
onBlur?: UsedInputProps["onBlur"];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description label props
|
|
24
|
+
*/
|
|
25
|
+
export interface LabelProps {
|
|
26
|
+
isFocused: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @description used input props
|
|
30
|
+
*/
|
|
31
|
+
export type UsedInputProps = Pick<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "onFocus" | "onBlur" | "type" | "ref" | "className">;
|
|
32
|
+
/**
|
|
33
|
+
* @description input ref
|
|
34
|
+
*/
|
|
35
|
+
export interface InputRef {
|
|
36
|
+
input: HTMLInputElement | null;
|
|
37
|
+
wrapper: HTMLFieldSetElement | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @description wrapper props
|
|
41
|
+
*/
|
|
42
|
+
export interface WrapperProps {
|
|
43
|
+
isFocused: boolean;
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CircleRenderProps } from "./types";
|
|
3
|
+
declare const Circle: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any> | undefined;
|
|
6
|
+
} & CircleRenderProps, import("react").SVGProps<SVGCircleElement>, {}>;
|
|
7
|
+
export default Circle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
|
|
3
|
+
const Circle = styled.circle((props) => {
|
|
4
|
+
return {
|
|
5
|
+
animationName: props.animationName,
|
|
6
|
+
animationDuration: "2s",
|
|
7
|
+
animationTimingFunction: "linear",
|
|
8
|
+
animationIterationCount: "infinite",
|
|
9
|
+
fill: "none",
|
|
10
|
+
strokeLinecap: "round",
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { Circle as default };
|
package/dist/loading/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Loading from "./
|
|
1
|
+
import Loading from "./loading";
|
|
2
2
|
export { Loading };
|
|
@@ -1,33 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { keyframes } from '@emotion/react';
|
|
3
|
+
import Circle from './circle.js';
|
|
4
|
+
import Wrapper from './wrapper.js';
|
|
5
|
+
|
|
6
|
+
const left = keyframes `
|
|
7
|
+
from {
|
|
8
|
+
stroke-dasharray: 0 440;
|
|
9
|
+
stroke-width: 20;
|
|
10
|
+
stroke-dashoffset: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
8% {
|
|
14
|
+
stroke-dasharray: 40 400;
|
|
15
|
+
stroke-width: 30;
|
|
16
|
+
stroke-dashoffset: -5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
28% {
|
|
20
|
+
stroke-dasharray: 40 400;
|
|
21
|
+
stroke-width: 30;
|
|
22
|
+
stroke-dashoffset: -175;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
36%,
|
|
26
|
+
58% {
|
|
27
|
+
stroke-dasharray: 0 440;
|
|
28
|
+
stroke-width: 20;
|
|
29
|
+
stroke-dashoffset: -220;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
66% {
|
|
33
|
+
stroke-dasharray: 40 400;
|
|
34
|
+
stroke-width: 30;
|
|
35
|
+
stroke-dashoffset: -225;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
86% {
|
|
39
|
+
stroke-dasharray: 40 400;
|
|
40
|
+
stroke-width: 30;
|
|
41
|
+
stroke-dashoffset: -395;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
94%,
|
|
45
|
+
to {
|
|
46
|
+
stroke-dasharray: 0 440;
|
|
47
|
+
stroke-width: 20;
|
|
48
|
+
stroke-dashoffset: -440;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
const large = keyframes `
|
|
31
52
|
from,
|
|
32
53
|
4% {
|
|
33
54
|
stroke-dasharray: 0 660;
|
|
@@ -72,9 +93,8 @@
|
|
|
72
93
|
stroke-width: 20;
|
|
73
94
|
stroke-dashoffset: -990;
|
|
74
95
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@keyframes loadingCircleB {
|
|
96
|
+
`;
|
|
97
|
+
const small = keyframes `
|
|
78
98
|
from,
|
|
79
99
|
12% {
|
|
80
100
|
stroke-dasharray: 0 220;
|
|
@@ -119,55 +139,8 @@
|
|
|
119
139
|
stroke-width: 20;
|
|
120
140
|
stroke-dashoffset: -330;
|
|
121
141
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
@keyframes loadingCircleC {
|
|
125
|
-
from {
|
|
126
|
-
stroke-dasharray: 0 440;
|
|
127
|
-
stroke-width: 20;
|
|
128
|
-
stroke-dashoffset: 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
8% {
|
|
132
|
-
stroke-dasharray: 40 400;
|
|
133
|
-
stroke-width: 30;
|
|
134
|
-
stroke-dashoffset: -5;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
28% {
|
|
138
|
-
stroke-dasharray: 40 400;
|
|
139
|
-
stroke-width: 30;
|
|
140
|
-
stroke-dashoffset: -175;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
36%,
|
|
144
|
-
58% {
|
|
145
|
-
stroke-dasharray: 0 440;
|
|
146
|
-
stroke-width: 20;
|
|
147
|
-
stroke-dashoffset: -220;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
66% {
|
|
151
|
-
stroke-dasharray: 40 400;
|
|
152
|
-
stroke-width: 30;
|
|
153
|
-
stroke-dashoffset: -225;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
86% {
|
|
157
|
-
stroke-dasharray: 40 400;
|
|
158
|
-
stroke-width: 30;
|
|
159
|
-
stroke-dashoffset: -395;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
94%,
|
|
163
|
-
to {
|
|
164
|
-
stroke-dasharray: 0 440;
|
|
165
|
-
stroke-width: 20;
|
|
166
|
-
stroke-dashoffset: -440;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
@keyframes loadingCircleD {
|
|
142
|
+
`;
|
|
143
|
+
const right = keyframes `
|
|
171
144
|
from,
|
|
172
145
|
8% {
|
|
173
146
|
stroke-dasharray: 0 440;
|
|
@@ -212,4 +185,13 @@
|
|
|
212
185
|
stroke-width: 20;
|
|
213
186
|
stroke-dashoffset: -440;
|
|
214
187
|
}
|
|
215
|
-
|
|
188
|
+
`;
|
|
189
|
+
const Loading = () => {
|
|
190
|
+
return (React.createElement(Wrapper, { width: "240", height: "240", viewBox: "0 0 240 240" },
|
|
191
|
+
React.createElement(Circle, { animationName: large, cx: "120", cy: "120", r: "105", stroke: "#f42f25" }),
|
|
192
|
+
React.createElement(Circle, { animationName: small, cx: "120", cy: "120", r: "35", stroke: "#f49725" }),
|
|
193
|
+
React.createElement(Circle, { animationName: left, cx: "85", cy: "120", r: "70", stroke: "#255ff4" }),
|
|
194
|
+
React.createElement(Circle, { animationName: right, cx: "155", cy: "120", r: "70", stroke: "#f42582" })));
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export { Loading as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").SVGProps<SVGSVGElement>, {}>;
|
|
6
|
+
export default Wrapper;
|
|
@@ -2,13 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
4
|
const MenuItem = (props) => {
|
|
5
|
-
return
|
|
6
|
-
"flex justify-start items-center",
|
|
7
|
-
"h-12 py-6 box-border",
|
|
8
|
-
"whitespace-nowrap",
|
|
9
|
-
"hover:bg-cyan-500",
|
|
10
|
-
props.className,
|
|
11
|
-
]) }, props.children));
|
|
5
|
+
return React.createElement("li", { className: clsx([props.className]) }, props.children);
|
|
12
6
|
};
|
|
13
7
|
|
|
14
8
|
export { MenuItem as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author murukal
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* messager
|
|
6
|
+
*/
|
|
7
|
+
export interface Messager {
|
|
8
|
+
error: UnderlyingSinkCloseCallback;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @author murukal
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* props for message
|
|
15
|
+
*/
|
|
16
|
+
export interface Props {
|
|
17
|
+
id: string;
|
|
18
|
+
type: "error" | "success" | "warning";
|
|
19
|
+
duration: number;
|
|
20
|
+
onHidden?: (key: string) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @author murukal
|
|
24
|
+
*
|
|
25
|
+
* @description
|
|
26
|
+
* message ref
|
|
27
|
+
*/
|
|
28
|
+
export interface MessageRef {
|
|
29
|
+
add: (props: Props) => void;
|
|
30
|
+
}
|
package/dist/popper/popper.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @author murukal
|
|
4
|
+
* @description popper props
|
|
5
|
+
*/
|
|
6
|
+
export interface Props {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
isVisible: boolean;
|
|
9
|
+
trigger?: Element | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @author murukal
|
|
13
|
+
* @description wrapper props
|
|
14
|
+
*/
|
|
15
|
+
export interface WrapperProps {
|
|
16
|
+
isVisible: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import Context from './context.js';
|
|
3
|
+
import { useControlledState } from '@aiszlab/relax';
|
|
4
|
+
|
|
5
|
+
const Group = (props) => {
|
|
6
|
+
/// controlled value
|
|
7
|
+
const [selectedValue, setSelectedValue] = useControlledState(props.value);
|
|
8
|
+
/// value change handler
|
|
9
|
+
const change = useCallback((value) => {
|
|
10
|
+
setSelectedValue(value);
|
|
11
|
+
}, [setSelectedValue]);
|
|
12
|
+
/// context value
|
|
13
|
+
const contextValue = useMemo(() => ({
|
|
14
|
+
value: selectedValue,
|
|
15
|
+
onChange: change,
|
|
16
|
+
}), [selectedValue, change]);
|
|
17
|
+
return React.createElement(Context.Provider, { value: contextValue }, props.children);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Group as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useContext, useMemo, useCallback } from 'react';
|
|
2
|
+
import Wrapper from './wrapper.js';
|
|
3
|
+
import Context from './context.js';
|
|
4
|
+
|
|
5
|
+
const Radio = ({ value }) => {
|
|
6
|
+
const contextValue = useContext(Context);
|
|
7
|
+
const isChecked = useMemo(() => (contextValue === null || contextValue === void 0 ? void 0 : contextValue.value) === value, [value, contextValue === null || contextValue === void 0 ? void 0 : contextValue.value]);
|
|
8
|
+
/// change handler for radio
|
|
9
|
+
const change = useCallback(() => {
|
|
10
|
+
if (isChecked)
|
|
11
|
+
return;
|
|
12
|
+
contextValue === null || contextValue === void 0 ? void 0 : contextValue.onChange(value);
|
|
13
|
+
}, [contextValue === null || contextValue === void 0 ? void 0 : contextValue.onChange, value, isChecked]);
|
|
14
|
+
return React.createElement(Wrapper, { type: "radio", "aria-checked": isChecked, checked: isChecked, onChange: change });
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Radio as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @author murukal
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* context value
|
|
7
|
+
*/
|
|
8
|
+
export interface ContextValue {
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @author murukal
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* group render props
|
|
17
|
+
*/
|
|
18
|
+
export interface GroupRenderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
value?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @author murukal
|
|
24
|
+
*
|
|
25
|
+
* @description
|
|
26
|
+
* radio render props
|
|
27
|
+
*/
|
|
28
|
+
export interface RadioRenderProps {
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
6
|
+
export default Wrapper;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { useTheme } from '../theme/hooks.js';
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled.input(() => {
|
|
5
|
+
var _a;
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return {
|
|
8
|
+
visibility: "hidden",
|
|
9
|
+
margin: 0,
|
|
10
|
+
height: "1rem",
|
|
11
|
+
width: "1rem",
|
|
12
|
+
"::after": {
|
|
13
|
+
content: "''",
|
|
14
|
+
visibility: "visible",
|
|
15
|
+
display: "block",
|
|
16
|
+
height: "1rem",
|
|
17
|
+
width: "1rem",
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
borderWidth: "0.1rem",
|
|
20
|
+
borderStyle: "solid",
|
|
21
|
+
borderColor: "gray",
|
|
22
|
+
borderRadius: 999,
|
|
23
|
+
transition: "all 200ms",
|
|
24
|
+
},
|
|
25
|
+
"&[aria-checked=true]": {
|
|
26
|
+
"::after": {
|
|
27
|
+
borderWidth: "0.3rem",
|
|
28
|
+
borderColor: (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export { Wrapper as default };
|
package/dist/select/select.d.ts
CHANGED
package/dist/select/select.js
CHANGED
|
@@ -3,7 +3,7 @@ import Popper from '../popper/popper.js';
|
|
|
3
3
|
import { useBoolean } from '@aiszlab/relax';
|
|
4
4
|
import Input from '../input/input.js';
|
|
5
5
|
|
|
6
|
-
const Select = () => {
|
|
6
|
+
const Select = (props) => {
|
|
7
7
|
var _a;
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
const { isOn: isVisible, turnOn: open, turnOff: close } = useBoolean();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import Wrapper from './wrapper.js';
|
|
3
|
+
import { useControlledState } from '@aiszlab/relax';
|
|
4
|
+
|
|
5
|
+
const Switch = ({ value }) => {
|
|
6
|
+
const [isSelected, setIsSelected] = useControlledState(value);
|
|
7
|
+
const toggle = useCallback(() => {
|
|
8
|
+
setIsSelected((isSelected) => !isSelected);
|
|
9
|
+
}, [setIsSelected]);
|
|
10
|
+
return React.createElement(Wrapper, { "aria-selected": isSelected, onClick: toggle });
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { Switch as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export default Wrapper;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { useTheme } from '../theme/hooks.js';
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled.div(() => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return {
|
|
8
|
+
width: "1.8rem",
|
|
9
|
+
height: "1rem",
|
|
10
|
+
borderRadius: "1rem",
|
|
11
|
+
borderWidth: 2,
|
|
12
|
+
borderStyle: "solid",
|
|
13
|
+
borderColor: "gray",
|
|
14
|
+
backgroundColor: "transparent",
|
|
15
|
+
transition: "all .2s",
|
|
16
|
+
"::before": {
|
|
17
|
+
content: "''",
|
|
18
|
+
display: "block",
|
|
19
|
+
margin: "0.1rem",
|
|
20
|
+
height: "0.8rem",
|
|
21
|
+
width: "0.8rem",
|
|
22
|
+
borderRadius: 999,
|
|
23
|
+
backgroundColor: "black",
|
|
24
|
+
transition: "all .2s",
|
|
25
|
+
},
|
|
26
|
+
"&[aria-selected=true]": {
|
|
27
|
+
borderColor: (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
28
|
+
backgroundColor: (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.primary,
|
|
29
|
+
"::before": {
|
|
30
|
+
translate: "100%",
|
|
31
|
+
backgroundColor: "white",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { Wrapper as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import type { Props } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* @author murukal
|
|
@@ -7,5 +7,5 @@ import type { Props } from "./types";
|
|
|
7
7
|
* theme provider
|
|
8
8
|
* if user provider theme, we will merge it with presets theme
|
|
9
9
|
*/
|
|
10
|
-
declare const ThemeProvider:
|
|
10
|
+
declare const ThemeProvider: (props: Props) => React.JSX.Element;
|
|
11
11
|
export default ThemeProvider;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from "react";
|
|
2
|
+
type Typography = Pick<CSSProperties, "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing">;
|
|
3
|
+
type Elevation = Pick<CSSProperties, "boxShadow">;
|
|
4
|
+
/**
|
|
5
|
+
* @author murukal
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* declaration for theme
|
|
9
|
+
*/
|
|
10
|
+
export interface Theme {
|
|
11
|
+
colors?: {
|
|
12
|
+
primary?: string;
|
|
13
|
+
};
|
|
14
|
+
typography?: {
|
|
15
|
+
body?: {
|
|
16
|
+
small?: Typography;
|
|
17
|
+
large?: Typography;
|
|
18
|
+
};
|
|
19
|
+
label?: {
|
|
20
|
+
small?: Typography;
|
|
21
|
+
large?: Typography;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
elevations?: [Elevation, Elevation, Elevation, Elevation, Elevation, Elevation];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @author murukal
|
|
28
|
+
*
|
|
29
|
+
* @description
|
|
30
|
+
* theme provider
|
|
31
|
+
*/
|
|
32
|
+
export interface Props {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
theme: Theme;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musae",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "musae-ui",
|
|
5
5
|
"author": "tutu@fantufantu.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"pub": "npm run clean:build && npm run build && npm publish"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aiszlab/relax": "^1.0.
|
|
16
|
+
"@aiszlab/relax": "^1.0.14",
|
|
17
17
|
"@emotion/react": "^11.11.1",
|
|
18
18
|
"@emotion/styled": "^11.11.0",
|
|
19
19
|
"@popperjs/core": "^2.11.8",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { __rest } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
const AvatarImage = (_a) => {
|
|
6
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
7
|
-
return (React.createElement("img", Object.assign({ className: clsx("w-full h-full text-center object-cover text-transparent indent-96", className) }, props)));
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { AvatarImage as default };
|
package/dist/loading/Loading.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../../styles/loading.css';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
const Loading = () => {
|
|
6
|
-
return (React.createElement("svg", { className: "musae-loading", width: "240", height: "240", viewBox: "0 0 240 240" },
|
|
7
|
-
React.createElement("circle", { className: clsx(["runner", "circle-a"]), cx: "120", cy: "120", r: "105", fill: "none", stroke: "#000", strokeWidth: "20", strokeDasharray: "0 660", strokeDashoffset: "-330", strokeLinecap: "round" }),
|
|
8
|
-
React.createElement("circle", { className: clsx(["runner", "circle-b"]), cx: "120", cy: "120", r: "35", fill: "none", stroke: "#000", strokeWidth: "20", strokeDasharray: "0 220", strokeDashoffset: "-110", strokeLinecap: "round" }),
|
|
9
|
-
React.createElement("circle", { className: clsx(["runner", "circle-c"]), cx: "85", cy: "120", r: "70", fill: "none", stroke: "#000", strokeWidth: "20", strokeDasharray: "0 440", strokeLinecap: "round" }),
|
|
10
|
-
React.createElement("circle", { className: clsx(["runner", "circle-d"]), cx: "155", cy: "120", r: "70", fill: "none", stroke: "#000", strokeWidth: "20", strokeDashoffset: "0 440", strokeLinecap: "round" })));
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { Loading as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function __rest(s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { __rest };
|
|
File without changes
|