musae 0.2.2 → 0.2.3

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.
Files changed (49) hide show
  1. package/dist/components/checkbox/checkbox.js +3 -2
  2. package/dist/components/collapse/collapse.d.ts +4 -0
  3. package/dist/components/collapse/collapse.js +97 -0
  4. package/dist/components/collapse/context.d.ts +7 -0
  5. package/dist/components/collapse/context.js +12 -0
  6. package/dist/components/collapse/hooks.d.ts +12 -0
  7. package/dist/components/collapse/hooks.js +43 -0
  8. package/dist/components/collapse/index.d.ts +2 -0
  9. package/dist/components/collapse/item.d.ts +4 -0
  10. package/dist/components/collapse/item.js +144 -0
  11. package/dist/components/collapse/types.d.ts +87 -0
  12. package/dist/components/icon/icon.js +1 -1
  13. package/dist/components/icon/icons/index.js +1 -0
  14. package/dist/components/icon/icons/navigation/index.d.ts +2 -1
  15. package/dist/components/icon/icons/navigation/index.js +1 -0
  16. package/dist/components/icon/icons/navigation/unfold-more.d.ts +3 -0
  17. package/dist/components/icon/icons/navigation/unfold-more.js +10 -0
  18. package/dist/components/loading/loading.d.ts +1 -1
  19. package/dist/components/loading/loading.js +69 -4
  20. package/dist/components/loading/types.d.ts +13 -0
  21. package/dist/components/rate/star.js +11 -13
  22. package/dist/components/ripple/hooks.js +4 -1
  23. package/dist/components/table/body.js +35 -3
  24. package/dist/components/table/context.d.ts +6 -0
  25. package/dist/components/table/context.js +10 -2
  26. package/dist/components/table/header/cell.d.ts +3 -0
  27. package/dist/components/table/header/cell.js +129 -0
  28. package/dist/components/table/{header.d.ts → header/header.d.ts} +1 -1
  29. package/dist/components/table/{header.js → header/header.js} +37 -10
  30. package/dist/components/table/hooks.d.ts +8 -21
  31. package/dist/components/table/hooks.js +36 -58
  32. package/dist/components/table/table.d.ts +1 -1
  33. package/dist/components/table/table.js +12 -6
  34. package/dist/components/table/types.d.ts +72 -4
  35. package/dist/components/waterfall/hooks.d.ts +1 -2
  36. package/dist/components/waterfall/hooks.js +2 -8
  37. package/dist/components/waterfall/waterfall.js +9 -5
  38. package/dist/components/watermark/types.d.ts +1 -1
  39. package/dist/components/watermark/watermark.js +1 -1
  40. package/dist/hooks/use-class-names.d.ts +15 -0
  41. package/dist/hooks/use-expand-effect.d.ts +1 -1
  42. package/dist/hooks/use-expand-effect.js +12 -8
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.js +1 -0
  45. package/dist/stylex.css +17 -3
  46. package/dist/utils/class-name.d.ts +65 -3
  47. package/dist/utils/class-name.js +39 -5
  48. package/dist/utils/styles.d.ts +1 -1
  49. package/package.json +4 -4
@@ -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-1db1611",
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-78zum5 musae-6s0dn4 musae-1ypdohk"
167
+ className: "musae-3nfvp2 musae-6s0dn4 musae-1ypdohk"
167
168
  },
168
169
  trigger: props(styles.trigger({
169
170
  borderColor: theme.colors[ColorToken.Outline]
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { CollapseProps } from "./types";
3
+ declare const Collapse: ({ items, className, defaultActiveKey, activeKey, onChange, style, accordion, }: CollapseProps) => React.JSX.Element | null;
4
+ export default Collapse;
@@ -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/@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,7 @@
1
+ /// <reference types="react" />
2
+ import type { ContextValue } from "./types";
3
+ /**
4
+ * @description
5
+ * `Collapse` Context
6
+ */
7
+ export declare const Context: import("react").Context<ContextValue>;
@@ -0,0 +1,12 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * @description
5
+ * `Collapse` Context
6
+ */
7
+ const Context = createContext({
8
+ activeKeys: new Set(),
9
+ toggle: () => { },
10
+ });
11
+
12
+ export { Context };
@@ -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,2 @@
1
+ import Collapse from "./collapse";
2
+ export { Collapse };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { CollapseItemProps } from "./types";
3
+ declare const CollapseItem: ({ children, label, value }: CollapseItemProps) => React.JSX.Element;
4
+ export default CollapseItem;
@@ -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/@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 {};
@@ -31,7 +31,7 @@ const Icon = ({
31
31
  const classNames = useClassNames(ComponentToken.Icon);
32
32
  const asProps = useMemo(() => {
33
33
  return {
34
- size: size === "small" ? 12 : size === "large" ? 20 : size ?? 16
34
+ size: size === "small" ? 12 : size === "large" ? 20 : size === "medium" ? 16 : size ?? 16
35
35
  };
36
36
  }, [size]);
37
37
  const children = useMemo(() => {
@@ -36,6 +36,7 @@ export { default as Cancel } from './navigation/cancel.js';
36
36
  export { default as Close } from './navigation/close.js';
37
37
  export { default as MoreHoriz } from './navigation/more-horiz.js';
38
38
  export { default as Check } from './navigation/check.js';
39
+ export { default as UnfoldMore } from './navigation/unfold-more.js';
39
40
  export { default as Bedtime } from './image/bedtime.js';
40
41
  export { default as RotateLeft } from './image/rotate-left.js';
41
42
  export { default as RotateRight } from './image/rotate-right.js';
@@ -2,4 +2,5 @@ import Cancel from "./cancel";
2
2
  import MoreHoriz from "./more-horiz";
3
3
  import Close from "./close";
4
4
  import Check from "./check";
5
- export { Cancel, Close, MoreHoriz, Check };
5
+ import UnfoldMore from "./unfold-more";
6
+ export { Cancel, Close, MoreHoriz, Check, UnfoldMore };
@@ -2,3 +2,4 @@ export { default as Cancel } from './cancel.js';
2
2
  export { default as MoreHoriz } from './more-horiz.js';
3
3
  export { default as Close } from './close.js';
4
4
  export { default as Check } from './check.js';
5
+ export { default as UnfoldMore } from './unfold-more.js';
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const UnfoldMore: (props: Omit<import("../..").IconProps, "as">) => React.FunctionComponentElement<import("../..").IconProps>;
3
+ export default UnfoldMore;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { withIcon } from '../../hoc.js';
3
+
4
+ const UnfoldMore = withIcon(({ size }) => {
5
+ return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none" },
6
+ React.createElement("path", { d: "M12 5.83L15.17 9L16.58 7.59L12 3L7.41003 7.59L8.83003 9L12 5.83ZM12 18.17L8.83003 15L7.42003 16.41L12 21L16.59 16.41L15.17 15L12 18.17Z", fill: "currentColor" })));
7
+ });
8
+ var UnfoldMore$1 = UnfoldMore;
9
+
10
+ export { UnfoldMore$1 as default };
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { LoadingProps } from "./types";
3
- declare const Loading: ({ size }: LoadingProps) => React.JSX.Element;
3
+ declare const Loading: ({ size, overlay, children }: LoadingProps) => React.JSX.Element;
4
4
  export default Loading;
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
2
  import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
3
+ import { useClassNames } from '../../hooks/use-class-names.js';
4
+ import { ComponentToken, LoadingClassToken } from '../../utils/class-name.js';
5
+ import clsx from 'clsx';
6
+ import { useTheme } from '../theme/hooks.js';
7
+ import { ColorToken } from '../../utils/colors.js';
3
8
 
4
9
  const styles = {
5
10
  circle: {
@@ -44,11 +49,55 @@ const styles = {
44
49
  width: "musae-1ha45ep",
45
50
  height: "musae-b4kbli",
46
51
  $$css: true
52
+ },
53
+ loading: {
54
+ position: "musae-1n2onr6",
55
+ minWidth: "musae-h2iun8",
56
+ minHeight: "musae-oexrxm",
57
+ $$css: true
58
+ },
59
+ content: props => [{
60
+ opacity: "musae-byyjgo",
61
+ userSelect: "musae-87ps6o",
62
+ pointerEvents: "musae-47corl",
63
+ transitionProperty: "musae-19991ni",
64
+ transitionDuration: "musae-1d8287x",
65
+ zIndex: "musae-1ja2u2z",
66
+ "::after_content": "musae-1s928wv",
67
+ "::after_display": "musae-hkezso",
68
+ "::after_position": "musae-1j6awrg",
69
+ "::after_inset": "musae-1799ia1",
70
+ "::after_insetInline": null,
71
+ "::after_insetInlineStart": null,
72
+ "::after_insetInlineEnd": null,
73
+ "::after_left": null,
74
+ "::after_right": null,
75
+ "::after_insetBlock": null,
76
+ "::after_top": null,
77
+ "::after_bottom": null,
78
+ "::after_backgroundColor": "musae-27d4w3",
79
+ $$css: true
80
+ }, {
81
+ "--15iyedw": props.backgroundColor != null ? props.backgroundColor : "initial"
82
+ }],
83
+ spin: {
84
+ position: "musae-10l6tqk",
85
+ top: "musae-wa60dl",
86
+ insetInlineStart: "musae-budbmw",
87
+ left: null,
88
+ right: null,
89
+ transform: "musae-11lhmoz",
90
+ zIndex: "musae-1vjfegm",
91
+ $$css: true
47
92
  }
48
93
  };
49
94
  const Loading = ({
50
- size = "medium"
95
+ size = "medium",
96
+ overlay = true,
97
+ children
51
98
  }) => {
99
+ const classNames = useClassNames(ComponentToken.Loading);
100
+ const theme = useTheme();
52
101
  const circles = {
53
102
  top: {
54
103
  ...{
@@ -83,15 +132,31 @@ const Loading = ({
83
132
  r: "70"
84
133
  }
85
134
  };
86
- return React.createElement("svg", {
135
+ const styled = {
136
+ loading: {
137
+ className: "musae-1n2onr6 musae-h2iun8 musae-oexrxm"
138
+ },
139
+ spin: props(styles.spin, styles[size]),
140
+ content: props(overlay && styles.content({
141
+ backgroundColor: theme.colors[ColorToken.SurfaceDim]
142
+ }))
143
+ };
144
+ return React.createElement("div", {
145
+ className: clsx(classNames[LoadingClassToken.Loading], styled.loading.className),
146
+ style: styled.loading.style
147
+ }, React.createElement("svg", {
87
148
  viewBox: "0 0 240 240",
88
- ...props(styles[size])
149
+ className: clsx(classNames[LoadingClassToken.Spin], styled.spin.className),
150
+ style: styled.spin.style
89
151
  }, Array.from(Object.entries(circles)).map(([key, props]) => {
90
152
  return React.createElement("circle", {
91
153
  ...props,
92
154
  key: key
93
155
  });
94
- }));
156
+ })), React.createElement("div", {
157
+ className: (classNames[LoadingClassToken.Content], styled.content.className),
158
+ style: styled.content.style
159
+ }, children));
95
160
  };
96
161
  var Loading$1 = Loading;
97
162
 
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from "react";
1
2
  type Size = "small" | "medium" | "large";
2
3
  /**
3
4
  * @author murukal
@@ -12,5 +13,17 @@ export interface LoadingProps {
12
13
  * @default "medium"
13
14
  */
14
15
  size?: Size;
16
+ /**
17
+ * @description
18
+ * overlay shown
19
+ * @default true
20
+ */
21
+ overlay?: boolean;
22
+ /**
23
+ * @description
24
+ * children
25
+ * @default void 0
26
+ */
27
+ children?: ReactNode;
15
28
  }
16
29
  export {};