musae 0.1.40 → 0.1.42

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 (68) hide show
  1. package/dist/components/button/button.mjs +8 -8
  2. package/dist/components/calendar/calendar.d.ts +1 -1
  3. package/dist/components/calendar/calendar.mjs +9 -6
  4. package/dist/components/calendar/types.d.ts +3 -2
  5. package/dist/components/config/hooks.d.ts +9 -0
  6. package/dist/components/date-picker/date-picker.mjs +17 -14
  7. package/dist/components/dialog/dialog.mjs +12 -3
  8. package/dist/components/dialog/popup.d.ts +1 -1
  9. package/dist/components/dialog/popup.mjs +21 -14
  10. package/dist/components/dialog/types.d.ts +17 -7
  11. package/dist/components/drawer/drawer.mjs +12 -3
  12. package/dist/components/drawer/popup.d.ts +1 -1
  13. package/dist/components/drawer/popup.mjs +35 -23
  14. package/dist/components/drawer/types.d.ts +8 -3
  15. package/dist/components/icon/icon.mjs +1 -1
  16. package/dist/components/icon/icons/index.d.ts +2 -0
  17. package/dist/components/icon/icons/index.mjs +7 -2
  18. package/dist/components/icon/icons/toggle/index.d.ts +4 -0
  19. package/dist/components/icon/icons/toggle/index.mjs +3 -0
  20. package/dist/components/icon/icons/toggle/star-half.d.ts +3 -0
  21. package/dist/components/icon/icons/toggle/star-half.mjs +10 -0
  22. package/dist/components/icon/icons/toggle/star-outline.d.ts +3 -0
  23. package/dist/components/icon/icons/toggle/star-outline.mjs +10 -0
  24. package/dist/components/icon/icons/toggle/star.d.ts +3 -0
  25. package/dist/components/icon/icons/toggle/star.mjs +10 -0
  26. package/dist/components/input/input.d.ts +4 -5
  27. package/dist/components/input/input.mjs +14 -49
  28. package/dist/components/input/types.d.ts +4 -4
  29. package/dist/components/popper/dropdown.mjs +1 -1
  30. package/dist/components/rate/hooks.d.ts +20 -0
  31. package/dist/components/rate/hooks.mjs +45 -0
  32. package/dist/components/rate/index.d.ts +2 -0
  33. package/dist/components/rate/rate.d.ts +4 -0
  34. package/dist/components/rate/rate.mjs +64 -0
  35. package/dist/components/rate/star.d.ts +4 -0
  36. package/dist/components/rate/star.mjs +141 -0
  37. package/dist/components/rate/types.d.ts +69 -0
  38. package/dist/components/select/hooks.d.ts +7 -5
  39. package/dist/components/select/hooks.mjs +39 -33
  40. package/dist/components/select/select.d.ts +1 -1
  41. package/dist/components/select/select.mjs +4 -1
  42. package/dist/components/select/types.d.ts +7 -2
  43. package/dist/components/switch/switch.d.ts +1 -1
  44. package/dist/components/switch/switch.mjs +164 -42
  45. package/dist/components/switch/types.d.ts +17 -1
  46. package/dist/components/tabs/item.mjs +1 -1
  47. package/dist/components/theme/tokens.stylex.d.ts +12 -0
  48. package/dist/components/theme/tokens.stylex.mjs +2 -0
  49. package/dist/components/tour/index.d.ts +2 -0
  50. package/dist/components/tour/tour.d.ts +4 -0
  51. package/dist/components/tour/types.d.ts +42 -0
  52. package/dist/components/tree/list.d.ts +1 -1
  53. package/dist/components/tree/list.mjs +8 -3
  54. package/dist/components/tree/tree.mjs +1 -1
  55. package/dist/components/tree/types.d.ts +1 -1
  56. package/dist/hooks/use-dismissable.d.ts +2 -2
  57. package/dist/hooks/use-dismissable.mjs +5 -5
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.mjs +1 -0
  60. package/dist/stylex.css +32 -9
  61. package/dist/utils/class-name.d.ts +41 -9
  62. package/dist/utils/class-name.mjs +27 -13
  63. package/dist/utils/colors.d.ts +1 -0
  64. package/dist/utils/colors.mjs +2 -0
  65. package/dist/utils/layer.d.ts +1 -1
  66. package/dist/utils/layer.mjs +5 -1
  67. package/dist/utils/styles.mjs +1 -1
  68. package/package.json +2 -2
@@ -180,7 +180,7 @@ const styles = {
180
180
  }, {
181
181
  "--borderColor": props.color != null ? props.color : "initial",
182
182
  "--color": props.color != null ? props.color : "initial",
183
- "--1e2mv7m": layer(props.hoveredBackgroundColor, "thin") != null ? layer(props.hoveredBackgroundColor, "thin") : "initial"
183
+ "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
184
184
  }],
185
185
  text: props => [{
186
186
  color: "musae-19dipnz",
@@ -188,7 +188,7 @@ const styles = {
188
188
  $$css: true
189
189
  }, {
190
190
  "--color": props.color != null ? props.color : "initial",
191
- "--1e2mv7m": layer(props.hoveredBackgroundColor, "thin") != null ? layer(props.hoveredBackgroundColor, "thin") : "initial"
191
+ "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
192
192
  }],
193
193
  disabled: props => [{
194
194
  backgroundColor: "musae-q1mx2j",
@@ -198,7 +198,7 @@ const styles = {
198
198
  $$css: true
199
199
  }, {
200
200
  "--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
201
- "--color": layer(props.color, "thicker") != null ? layer(props.color, "thicker") : "initial"
201
+ "--color": props.color != null ? props.color : "initial"
202
202
  }],
203
203
  disabledOutline: props => [{
204
204
  borderColor: "musae-eqt46j",
@@ -212,7 +212,7 @@ const styles = {
212
212
  borderBottomColor: null,
213
213
  $$css: true
214
214
  }, {
215
- "--borderColor": layer(props.outlineColor, "thicker") != null ? layer(props.outlineColor, "thicker") : "initial"
215
+ "--borderColor": props.outlineColor != null ? props.outlineColor : "initial"
216
216
  }]
217
217
  };
218
218
  /**
@@ -256,19 +256,19 @@ const Button = forwardRef(({
256
256
  color: theme.colors[`on-${color}`]
257
257
  }), variant === "outlined" && styles.outlined({
258
258
  color: theme.colors[color],
259
- hoveredBackgroundColor: theme.colors[ColorToken.Primary]
259
+ hoveredBackgroundColor: layer(theme.colors[ColorToken.Primary], "thin")
260
260
  }), variant === "text" && styles.text({
261
261
  color: theme.colors[color],
262
- hoveredBackgroundColor: theme.colors[ColorToken.Primary]
262
+ hoveredBackgroundColor: layer(theme.colors[ColorToken.Primary], "thin")
263
263
  }),
264
264
  // shape
265
265
  styles[shape],
266
266
  // disabled
267
267
  disabled && styles.disabled({
268
268
  backgroundColor: variant === "filled" ? layer(theme.colors[ColorToken.OnSurface], "medium") : "transparent",
269
- color: theme.colors[ColorToken.OnSurface]
269
+ color: layer(theme.colors[ColorToken.OnSurface], "thicker")
270
270
  }), disabled && variant === "outlined" && styles.disabledOutline({
271
- outlineColor: theme.colors[ColorToken.OnSurface]
271
+ outlineColor: layer(theme.colors[ColorToken.OnSurface], "thicker")
272
272
  }))
273
273
  };
274
274
  return React.createElement("button", {
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { CalendarProps } from "./types";
3
- declare const Calendar: (props: CalendarProps) => React.JSX.Element;
3
+ declare const Calendar: ({ className, style, ...props }: CalendarProps) => React.JSX.Element;
4
4
  export default Calendar;
@@ -24,7 +24,11 @@ const styles = {
24
24
  $$css: true
25
25
  }
26
26
  };
27
- const Calendar = props$1 => {
27
+ const Calendar = ({
28
+ className,
29
+ style,
30
+ ...props$1
31
+ }) => {
28
32
  const {
29
33
  timespan,
30
34
  onClick
@@ -45,20 +49,21 @@ const Calendar = props$1 => {
45
49
  className: "musae-98rzlu musae-78zum5 musae-l56j7k"
46
50
  }
47
51
  };
48
- return React.createElement("div", null, React.createElement("header", {
52
+ return React.createElement("div", {
53
+ className: className,
54
+ style: style
55
+ }, React.createElement("header", {
49
56
  className: clsx(classNames[CalendarClassToken.Header], styled.header.className),
50
57
  style: styled.header.style
51
58
  }, React.createElement(Button, {
52
59
  variant: "text",
53
60
  prefix: React.createElement(KeyboardDoubleArrowLeft, null),
54
61
  onClick: toPrevYear,
55
- size: "small",
56
62
  shape: "circular"
57
63
  }), React.createElement(Button, {
58
64
  variant: "text",
59
65
  prefix: React.createElement(KeyboardArrowLeft, null),
60
66
  onClick: toPrevMonth,
61
- size: "small",
62
67
  shape: "circular"
63
68
  }), React.createElement("span", {
64
69
  className: clsx(classNames[CalendarClassToken.Heading], styled.heading.className),
@@ -67,13 +72,11 @@ const Calendar = props$1 => {
67
72
  variant: "text",
68
73
  prefix: React.createElement(KeyboardArrowRight, null),
69
74
  onClick: toNextMonth,
70
- size: "small",
71
75
  shape: "circular"
72
76
  }), React.createElement(Button, {
73
77
  variant: "text",
74
78
  prefix: React.createElement(KeyboardDoubleArrowRight, null),
75
79
  onClick: toNextYear,
76
- size: "small",
77
80
  shape: "circular"
78
81
  })), React.createElement("table", null, React.createElement("thead", null, React.createElement("tr", null, headCells)), React.createElement("tbody", null, dateCells)));
79
82
  };
@@ -1,10 +1,11 @@
1
1
  import type { Dayjs } from "dayjs";
2
2
  import type { Partialable } from "@aiszlab/relax/types";
3
+ import { ComponentProps } from "../../types/element";
3
4
  /**
4
5
  * @description
5
6
  * calendar props
6
7
  */
7
- export interface CalendarProps {
8
+ export type CalendarProps = ComponentProps & {
8
9
  /**
9
10
  * @description
10
11
  * value
@@ -20,4 +21,4 @@ export interface CalendarProps {
20
21
  * click date handler
21
22
  */
22
23
  onClick?: (value: Dayjs) => void;
23
- }
24
+ };
@@ -132,6 +132,15 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
132
132
  25: {
133
133
  0: string;
134
134
  1: string;
135
+ 2: string;
136
+ 3: string;
137
+ 4: string;
138
+ };
139
+ 26: {
140
+ 0: string;
141
+ 1: string;
142
+ 2: string;
143
+ 3: string;
135
144
  };
136
145
  }[T];
137
146
  /**
@@ -1,4 +1,4 @@
1
- import React, { useRef, useMemo } from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import Picker from '../picker/picker.mjs';
3
3
  import Calendar from '../calendar/calendar.mjs';
4
4
  import { useValue } from './hooks.mjs';
@@ -13,27 +13,30 @@ const DatePicker = props => {
13
13
  value
14
14
  } = useValue([props.value, props.onChange, ref]);
15
15
  const classNames = useClassNames(ComponentToken.DatePicker);
16
- /// picked date
17
- const picked = useMemo(() => {
18
- const styled = {
19
- className: "musae-1a2a7pz musae-h8yej3"
20
- };
21
- return React.createElement("input", {
22
- className: clsx(styled.className, classNames[DatePickerClassToken.Input]),
23
- style: styled.style,
24
- value: value?.format("YYYY-MM-DD") ?? "",
25
- readOnly: true
26
- });
27
- }, [value, classNames]);
16
+ const styled = {
17
+ trigger: {
18
+ className: "musae-1a2a7pz musae-wfgd1y"
19
+ },
20
+ calendar: {
21
+ className: "musae-8kignx"
22
+ }
23
+ };
28
24
  return React.createElement(Picker, {
29
25
  ref: ref,
30
26
  className: classNames[DatePickerClassToken.Picker],
31
27
  pickable: React.createElement(Calendar, {
28
+ className: styled.calendar.className,
29
+ style: styled.calendar.style,
32
30
  value: value,
33
31
  onClick: onChange
34
32
  }),
35
33
  popupWidth: false
36
- }, picked);
34
+ }, React.createElement("input", {
35
+ className: clsx(classNames[DatePickerClassToken.Input], styled.trigger.className),
36
+ style: styled.trigger.style,
37
+ value: value?.format("YYYY-MM-DD") ?? "",
38
+ readOnly: true
39
+ }));
37
40
  };
38
41
  var DatePicker$1 = DatePicker;
39
42
 
@@ -1,10 +1,19 @@
1
1
  import Portal from '../portal/portal.mjs';
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import Popup from './popup.mjs';
4
+ import { useBoolean } from '@aiszlab/relax';
4
5
 
5
6
  const Dialog = ({ open, ...props }) => {
6
- return (React.createElement(Portal, { open: open },
7
- React.createElement(Popup, { open: open, ...props })));
7
+ /// `Portal` should disappear after `Dialog` disappear completely
8
+ const [_isVisible, { turnOn, turnOff }] = useBoolean(false);
9
+ useEffect(() => {
10
+ if (open) {
11
+ turnOn();
12
+ }
13
+ // eslint-disable-next-line react-hooks/exhaustive-deps
14
+ }, [open]);
15
+ return (React.createElement(Portal, { open: open || _isVisible },
16
+ React.createElement(Popup, { open: open, onClosed: turnOff, ...props })));
8
17
  };
9
18
  var Dialog$1 = Dialog;
10
19
 
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { PopupProps } from "./types";
3
- declare const Popup: ({ onClose, open, dismissable, ...props }: PopupProps) => React.JSX.Element;
3
+ declare const Popup: ({ onClose, open, dismissable, onClosed, ...props }: PopupProps) => React.JSX.Element;
4
4
  export default Popup;
@@ -1,7 +1,7 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useRef, useEffect } from 'react';
2
2
  import { useFooter } from './hooks.mjs';
3
3
  import { useAnimate } from 'framer-motion';
4
- import { ComponentToken, withDot, DialogClassToken } from '../../utils/class-name.mjs';
4
+ import { ComponentToken, DialogClassToken } from '../../utils/class-name.mjs';
5
5
  import { useClassNames } from '../config/hooks.mjs';
6
6
  import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
7
7
  import { useTheme } from '../theme/hooks.mjs';
@@ -17,7 +17,7 @@ const styles = {
17
17
  paddingTop: "musae-522f2k",
18
18
  $$css: true
19
19
  },
20
- mask: props => [{
20
+ overlay: props => [{
21
21
  position: "musae-10l6tqk",
22
22
  top: "musae-13vifvy",
23
23
  left: "musae-u96u03",
@@ -89,16 +89,20 @@ const Popup = ({
89
89
  onClose,
90
90
  open,
91
91
  dismissable = true,
92
+ onClosed,
92
93
  ...props$1
93
94
  }) => {
94
95
  const classNames = useClassNames(ComponentToken.Dialog);
95
- const footer = useFooter([props$1.footer, props$1.onConfirm, onClose]);
96
96
  const [scope, animate] = useAnimate();
97
97
  const theme = useTheme();
98
+ const panelRef = useRef(null);
99
+ const overlayRef = useRef(null);
100
+ /// children render hooks
101
+ const footer = useFooter([props$1.footer, props$1.onConfirm, onClose]);
98
102
  const {
99
103
  closer,
100
104
  onKeyDown,
101
- onMaskClick
105
+ onOverlayClick
102
106
  } = useDismissable({
103
107
  dismissable,
104
108
  onClose
@@ -107,19 +111,20 @@ const Popup = ({
107
111
  (async () => {
108
112
  if (open) {
109
113
  scope.current.attributeStyleMap.set("display", "flex");
110
- Promise.all([animate(withDot(classNames[DialogClassToken.Panel]), {
114
+ await Promise.all([panelRef.current && animate(panelRef.current, {
111
115
  opacity: 1
112
- }), animate(withDot(classNames[DialogClassToken.Mask]), {
116
+ }), overlayRef.current && animate(overlayRef.current, {
113
117
  opacity: 0.8
114
118
  })]);
115
119
  return;
116
120
  }
117
- await Promise.all([animate(withDot(classNames[DialogClassToken.Panel]), {
121
+ await Promise.all([panelRef.current && animate(panelRef.current, {
118
122
  opacity: 0
119
- }), animate(withDot(classNames[DialogClassToken.Mask]), {
123
+ }), overlayRef.current && animate(overlayRef.current, {
120
124
  opacity: 0
121
125
  })]);
122
126
  scope.current.attributeStyleMap.set("display", "none");
127
+ onClosed?.();
123
128
  })();
124
129
  // eslint-disable-next-line react-hooks/exhaustive-deps
125
130
  }, [open]);
@@ -134,7 +139,7 @@ const Popup = ({
134
139
  popup: {
135
140
  className: "musae-ixxii4 musae-13vifvy musae-u96u03 musae-n9wirt musae-1dr59a3 musae-47corl musae-fo81ep musae-78zum5 musae-l56j7k musae-6s0dn4"
136
141
  },
137
- mask: props(styles.mask({
142
+ overlay: props(styles.overlay({
138
143
  backgroundColor: theme.colors[ColorToken.SurfaceDim]
139
144
  })),
140
145
  panel: props(styles.panel({
@@ -153,15 +158,17 @@ const Popup = ({
153
158
  tabIndex: -1,
154
159
  onKeyDown: onKeyDown
155
160
  }, React.createElement("div", {
156
- className: clsx(classNames[DialogClassToken.Mask], styled.mask.className),
157
- style: styled.mask.style,
158
- onClick: onMaskClick
161
+ className: clsx(classNames[DialogClassToken.Overlay], styled.overlay.className),
162
+ style: styled.overlay.style,
163
+ onClick: onOverlayClick,
164
+ ref: overlayRef
159
165
  }), React.createElement("div", {
160
166
  className: clsx(classNames[DialogClassToken.Panel], styled.panel.className),
161
167
  style: {
162
168
  ...styled.panel.style,
163
169
  ...props$1.styles?.panel
164
- }
170
+ },
171
+ ref: panelRef
165
172
  }, closer, !!props$1.title && React.createElement("div", {
166
173
  className: clsx(classNames[DialogClassToken.Header], styled.header.className),
167
174
  style: styled.header.style
@@ -27,12 +27,7 @@ export interface DialogProps {
27
27
  onConfirm?: VoidFunction;
28
28
  /**
29
29
  * @description
30
- * on close
31
- */
32
- onClose?: VoidFunction;
33
- /**
34
- * @description
35
- * Whether the modal can be closed by clicking on the mask or pressing the Esc key.
30
+ * Whether the dialog can be closed by clicking on the overlay or pressing the Esc key.
36
31
  */
37
32
  dismissable?: boolean | Dismissable[];
38
33
  /**
@@ -49,9 +44,24 @@ export interface DialogProps {
49
44
  panel?: CSSProperties;
50
45
  body?: CSSProperties;
51
46
  };
47
+ /**
48
+ * @description
49
+ * close `Dialog` handler
50
+ *
51
+ * @template
52
+ * in `Dialog`, close icon & cancel button will render default
53
+ * if user click these nodes, this callback will be toggled
54
+ */
55
+ onClose?: VoidFunction;
52
56
  }
53
57
  /**
54
58
  * @description
55
59
  * popup
56
60
  */
57
- export type PopupProps = DialogProps;
61
+ export type PopupProps = DialogProps & {
62
+ /**
63
+ * @description
64
+ * callback will be toggled after close animation end
65
+ */
66
+ onClosed?: () => void;
67
+ };
@@ -1,10 +1,19 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import Portal from '../portal/portal.mjs';
3
3
  import Popup from './popup.mjs';
4
+ import { useBoolean } from '@aiszlab/relax';
4
5
 
5
6
  const Drawer = ({ open, ...props }) => {
6
- return (React.createElement(Portal, { open: open },
7
- React.createElement(Popup, { open: open, ...props })));
7
+ /// `Portal` should disappear after `Dialog` disappear completely
8
+ const [_isVisible, { turnOn, turnOff }] = useBoolean(false);
9
+ useEffect(() => {
10
+ if (open) {
11
+ turnOn();
12
+ }
13
+ // eslint-disable-next-line react-hooks/exhaustive-deps
14
+ }, [open]);
15
+ return (React.createElement(Portal, { open: open || _isVisible },
16
+ React.createElement(Popup, { open: open, ...props, onClosed: turnOff })));
8
17
  };
9
18
  var Drawer$1 = Drawer;
10
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, dismissable, ...props }: PopupProps) => React.JSX.Element;
3
+ declare const Popup: ({ open, onClose, placement, dismissable, onClosed, ...props }: PopupProps) => React.JSX.Element;
4
4
  export default Popup;
@@ -1,7 +1,7 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useRef, useEffect } from 'react';
2
2
  import { useAnimate } from 'framer-motion';
3
3
  import { PLACEMENTS } from './hooks.mjs';
4
- import { ComponentToken, withDot, DrawerClassToken } from '../../utils/class-name.mjs';
4
+ import { ComponentToken, DrawerClassToken } from '../../utils/class-name.mjs';
5
5
  import { useClassNames } from '../config/hooks.mjs';
6
6
  import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
7
7
  import { useTheme } from '../theme/hooks.mjs';
@@ -14,24 +14,30 @@ import { contains } from '../../node_modules/@aiszlab/relax/dist/dom/contains.mj
14
14
  const styles = {
15
15
  popup: {
16
16
  position: "musae-ixxii4",
17
- top: "musae-13vifvy",
18
- left: "musae-u96u03",
17
+ inset: "musae-10a8y8t",
18
+ insetInline: null,
19
19
  insetInlineStart: null,
20
20
  insetInlineEnd: null,
21
- width: "musae-n9wirt",
22
- height: "musae-1dr59a3",
21
+ left: null,
22
+ right: null,
23
+ insetBlock: null,
24
+ top: null,
25
+ bottom: null,
23
26
  pointerEvents: "musae-47corl",
24
27
  zIndex: "musae-fo81ep",
25
28
  $$css: true
26
29
  },
27
- mask: props => [{
30
+ overlay: props => [{
28
31
  position: "musae-10l6tqk",
29
- top: "musae-13vifvy",
30
- left: "musae-u96u03",
32
+ inset: "musae-10a8y8t",
33
+ insetInline: null,
31
34
  insetInlineStart: null,
32
35
  insetInlineEnd: null,
33
- width: "musae-n9wirt",
34
- height: "musae-1dr59a3",
36
+ left: null,
37
+ right: null,
38
+ insetBlock: null,
39
+ top: null,
40
+ bottom: null,
35
41
  pointerEvents: "musae-67bb7w",
36
42
  zIndex: "musae-fo81ep",
37
43
  opacity: "musae-g01cxk",
@@ -60,7 +66,6 @@ const styles = {
60
66
  insetInlineEnd: null,
61
67
  top: "musae-13vifvy",
62
68
  bottom: "musae-1ey2m1c",
63
- transform: "musae-umwmo6",
64
69
  width: "musae-1l2rt3b",
65
70
  $$css: true
66
71
  },
@@ -125,16 +130,20 @@ const Popup = ({
125
130
  onClose,
126
131
  placement = "right",
127
132
  dismissable = true,
133
+ onClosed,
128
134
  ...props$1
129
135
  }) => {
130
136
  const [scope, animate] = useAnimate();
131
137
  const classNames = useClassNames(ComponentToken.Drawer);
132
138
  const _placement = PLACEMENTS[placement];
133
139
  const theme = useTheme();
140
+ const panelRef = useRef(null);
141
+ const overlayRef = useRef(null);
142
+ /// children render hooks
134
143
  const {
135
144
  closer,
136
145
  onKeyDown,
137
- onMaskClick
146
+ onOverlayClick
138
147
  } = useDismissable({
139
148
  dismissable,
140
149
  onClose
@@ -143,19 +152,20 @@ const Popup = ({
143
152
  (async () => {
144
153
  if (open) {
145
154
  scope.current.attributeStyleMap.set("display", "block");
146
- Promise.all([animate(withDot(classNames[DrawerClassToken.Panel]), {
155
+ await Promise.all([panelRef.current && animate(panelRef.current, {
147
156
  transform: _placement.at(1)
148
- }), animate(withDot(classNames[DrawerClassToken.Mask]), {
157
+ }), overlayRef.current && animate(overlayRef.current, {
149
158
  opacity: 0.8
150
159
  })]);
151
160
  return;
152
161
  }
153
- await Promise.all([animate(withDot(classNames[DrawerClassToken.Panel]), {
162
+ await Promise.all([panelRef.current && animate(panelRef.current, {
154
163
  transform: _placement.at(0)
155
- }), animate(withDot(classNames[DrawerClassToken.Mask]), {
164
+ }), overlayRef.current && animate(overlayRef.current, {
156
165
  opacity: 0
157
166
  })]);
158
167
  scope.current.attributeStyleMap.set("display", "none");
168
+ onClosed?.();
159
169
  })();
160
170
  // eslint-disable-next-line react-hooks/exhaustive-deps
161
171
  }, [open, ..._placement]);
@@ -168,9 +178,9 @@ const Popup = ({
168
178
  }, [open]);
169
179
  const styled = {
170
180
  popup: {
171
- className: "musae-ixxii4 musae-13vifvy musae-u96u03 musae-n9wirt musae-1dr59a3 musae-47corl musae-fo81ep"
181
+ className: "musae-ixxii4 musae-10a8y8t musae-47corl musae-fo81ep"
172
182
  },
173
- mask: props(styles.mask({
183
+ overlay: props(styles.overlay({
174
184
  backgroundColor: theme.colors[ColorToken.SurfaceDim]
175
185
  })),
176
186
  panel: props(styles.panel({
@@ -189,12 +199,14 @@ const Popup = ({
189
199
  style: styled.popup.style,
190
200
  onKeyDown: onKeyDown
191
201
  }, React.createElement("div", {
192
- className: clsx(classNames[DrawerClassToken.Mask], styled.mask.className),
193
- onClick: onMaskClick,
194
- style: styled.mask.style
202
+ className: clsx(classNames[DrawerClassToken.Overlay], styled.overlay.className),
203
+ onClick: onOverlayClick,
204
+ style: styled.overlay.style,
205
+ ref: overlayRef
195
206
  }), React.createElement("div", {
196
207
  className: clsx(classNames[DrawerClassToken.Panel], styled.panel.className),
197
- style: styled.panel.style
208
+ style: styled.panel.style,
209
+ ref: panelRef
198
210
  }, closer, React.createElement("div", {
199
211
  className: clsx(classNames[DrawerClassToken.Header], styled.header.className),
200
212
  style: styled.header.style
@@ -33,7 +33,7 @@ export interface DrawerProps {
33
33
  placement?: Placement;
34
34
  /**
35
35
  * @description
36
- * Whether the modal can be closed by clicking on the mask or pressing the Esc key.
36
+ * Whether the drawer can be closed by clicking on the overlay or pressing the Esc key.
37
37
  */
38
38
  dismissable?: boolean | Dismissable[];
39
39
  }
@@ -41,5 +41,10 @@ export interface DrawerProps {
41
41
  * @description
42
42
  * popup
43
43
  */
44
- export interface PopupProps extends DrawerProps {
45
- }
44
+ export type PopupProps = DrawerProps & {
45
+ /**
46
+ * @description
47
+ * callback will be toggled after close animation end
48
+ */
49
+ onClosed?: () => void;
50
+ };
@@ -8,7 +8,7 @@ import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
8
8
  const styles = {
9
9
  icon: props => [{
10
10
  display: "musae-3nfvp2",
11
- verticalAlign: "musae-1uuroth",
11
+ verticalAlign: "musae-xymvpz",
12
12
  color: "musae-19dipnz",
13
13
  $$css: true
14
14
  }, {
@@ -10,5 +10,7 @@ export * from "./navigation";
10
10
  export * as navigation from "./navigation";
11
11
  export * from "./image";
12
12
  export * as image from "./image";
13
+ export * from "./toggle";
14
+ export * as toggle from "./toggle";
13
15
  export * from "./mock";
14
16
  export * as mock from "./mock";
@@ -10,8 +10,10 @@ import * as index$4 from './navigation/index.mjs';
10
10
  export { index$4 as navigation };
11
11
  import * as index$5 from './image/index.mjs';
12
12
  export { index$5 as image };
13
- import * as index$6 from './mock/index.mjs';
14
- export { index$6 as mock };
13
+ import * as index$6 from './toggle/index.mjs';
14
+ export { index$6 as toggle };
15
+ import * as index$7 from './mock/index.mjs';
16
+ export { index$7 as mock };
15
17
  export { default as Visibility } from './action/visibility.mjs';
16
18
  export { default as VisibilityOff } from './action/visibility-off.mjs';
17
19
  export { default as CheckCircleOutline } from './action/check-circle-outline.mjs';
@@ -38,4 +40,7 @@ export { default as Bedtime } from './image/bedtime.mjs';
38
40
  export { default as RotateLeft } from './image/rotate-left.mjs';
39
41
  export { default as RotateRight } from './image/rotate-right.mjs';
40
42
  export { default as WbSunny } from './image/wb-sunny.mjs';
43
+ export { default as Star } from './toggle/star.mjs';
44
+ export { default as StarHalf } from './toggle/star-half.mjs';
45
+ export { default as StarOutline } from './toggle/star-outline.mjs';
41
46
  export { default as Github } from './mock/github.mjs';
@@ -0,0 +1,4 @@
1
+ import Star from "./star";
2
+ import StarHalf from "./star-half";
3
+ import StarOutline from "./star-outline";
4
+ export { Star, StarHalf, StarOutline };
@@ -0,0 +1,3 @@
1
+ export { default as Star } from './star.mjs';
2
+ export { default as StarHalf } from './star-half.mjs';
3
+ export { default as StarOutline } from './star-outline.mjs';
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const StarHalf: (props: Omit<import("../..").IconProps, "as">) => React.FunctionComponentElement<import("../..").IconProps>;
3
+ export default StarHalf;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { withIcon } from '../../hoc.mjs';
3
+
4
+ const StarHalf = 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: "M22 9.74L14.81 9.12L12 2.5L9.19 9.13L2 9.74L7.46 14.47L5.82 21.5L12 17.77L18.18 21.5L16.55 14.47L22 9.74ZM12 15.9V6.6L13.71 10.64L18.09 11.02L14.77 13.9L15.77 18.18L12 15.9Z", fill: "currentColor" })));
7
+ });
8
+ var StarHalf$1 = StarHalf;
9
+
10
+ export { StarHalf$1 as default };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const StarOutline: (props: Omit<import("../..").IconProps, "as">) => React.FunctionComponentElement<import("../..").IconProps>;
3
+ export default StarOutline;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { withIcon } from '../../hoc.mjs';
3
+
4
+ const StarOutline = 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: "M22 9.74L14.81 9.12L12 2.5L9.19 9.13L2 9.74L7.46 14.47L5.82 21.5L12 17.77L18.18 21.5L16.55 14.47L22 9.74ZM12 15.9L8.24 18.17L9.24 13.89L5.92 11.01L10.3 10.63L12 6.6L13.71 10.64L18.09 11.02L14.77 13.9L15.77 18.18L12 15.9Z", fill: "currentColor" })));
7
+ });
8
+ var StarOutline$1 = StarOutline;
9
+
10
+ export { StarOutline$1 as default };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Star: (props: Omit<import("../..").IconProps, "as">) => React.FunctionComponentElement<import("../..").IconProps>;
3
+ export default Star;