musae 0.4.0 → 0.4.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.
@@ -262,18 +262,18 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
262
262
  color: theme$1.colors["on-".concat(color$1)]
263
263
  }), variant === "outlined" && styles.outlined({
264
264
  color: theme$1.colors[color$1],
265
- hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, true)
265
+ hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, "style")
266
266
  }), variant === "text" && styles.text({
267
267
  color: theme$1.colors[color$1],
268
- hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, true)
268
+ hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, "style")
269
269
  }),
270
270
  // shape
271
271
  styles[shape],
272
272
  // disabled
273
273
  disabled && styles.disabled({
274
- backgroundColor: variant === "filled" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.medium, true) : "transparent",
275
- color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true),
276
- outlineColor: variant === "outlined" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true) : null
274
+ backgroundColor: variant === "filled" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.medium, "style") : "transparent",
275
+ color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style"),
276
+ outlineColor: variant === "outlined" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style") : null
277
277
  }))
278
278
  };
279
279
  return /*#__PURE__*/React.createElement("button", _objectSpread({
@@ -260,18 +260,18 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
260
260
  color: theme.colors["on-".concat(color)]
261
261
  }), variant === "outlined" && styles.outlined({
262
262
  color: theme.colors[color],
263
- hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, true)
263
+ hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, "style")
264
264
  }), variant === "text" && styles.text({
265
265
  color: theme.colors[color],
266
- hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, true)
266
+ hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, "style")
267
267
  }),
268
268
  // shape
269
269
  styles[shape],
270
270
  // disabled
271
271
  disabled && styles.disabled({
272
- backgroundColor: variant === "filled" ? hexToRgba(theme.colors["on-surface"], OPACITY.medium, true) : "transparent",
273
- color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true),
274
- outlineColor: variant === "outlined" ? hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true) : null
272
+ backgroundColor: variant === "filled" ? hexToRgba(theme.colors["on-surface"], OPACITY.medium, "style") : "transparent",
273
+ color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style"),
274
+ outlineColor: variant === "outlined" ? hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style") : null
275
275
  }))
276
276
  };
277
277
  return /*#__PURE__*/React.createElement("button", _objectSpread({
@@ -50,7 +50,7 @@ var Floatable = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
50
50
  listeners = _useDraggable.listeners,
51
51
  setNodeRef = _useDraggable.setNodeRef,
52
52
  transform = _useDraggable.transform;
53
- var floatableRef = relax.useRefs(_ref, setNodeRef);
53
+ var floatableRef = relax.useComposedRef(_ref, setNodeRef);
54
54
  var _useContainer = useContainer.useContainer({
55
55
  container: container
56
56
  }),
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
- import { useIdentity, useRefs, clsx } from '@aiszlab/relax';
3
+ import { useIdentity, useComposedRef, clsx } from '@aiszlab/relax';
4
4
  import { useDraggable, useDndMonitor } from '@dnd-kit/core';
5
5
  import React, { forwardRef, useRef, useState, useImperativeHandle } from 'react';
6
6
  import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.8.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
@@ -48,7 +48,7 @@ var Floatable = /*#__PURE__*/forwardRef(function (_ref2, ref) {
48
48
  listeners = _useDraggable.listeners,
49
49
  setNodeRef = _useDraggable.setNodeRef,
50
50
  transform = _useDraggable.transform;
51
- var floatableRef = useRefs(_ref, setNodeRef);
51
+ var floatableRef = useComposedRef(_ref, setNodeRef);
52
52
  var _useContainer = useContainer({
53
53
  container: container
54
54
  }),
@@ -197,9 +197,9 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
197
197
  }), invalid && styles.invalid({
198
198
  outlineColor: theme$1.colors.error
199
199
  }), disabled && styles.disabled({
200
- backgroundColor: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thin, true),
201
- color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true),
202
- outlineColor: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true)
200
+ backgroundColor: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thin, "style"),
201
+ color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style"),
202
+ outlineColor: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style")
203
203
  })),
204
204
  input: {
205
205
  className: "musaex-15bjb6t musaex-j8pfrn musaex-1628nlo musaex-jbqb8w musaex-3hncxx musaex-1n0e6fi musaex-mbc7o0 musaex-98rzlu"
@@ -195,9 +195,9 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
195
195
  }), invalid && styles.invalid({
196
196
  outlineColor: theme.colors.error
197
197
  }), disabled && styles.disabled({
198
- backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.thin, true),
199
- color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true),
200
- outlineColor: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true)
198
+ backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.thin, "style"),
199
+ color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style"),
200
+ outlineColor: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style")
201
201
  })),
202
202
  input: {
203
203
  className: "musaex-15bjb6t musaex-j8pfrn musaex-1628nlo musaex-jbqb8w musaex-3hncxx musaex-1n0e6fi musaex-mbc7o0 musaex-98rzlu"
@@ -34,18 +34,28 @@ var Layout = function Layout(_ref) {
34
34
  mainProps = _useChildren.mainProps;
35
35
  var sider = children.get(hooks$1.ChildToken.Sider);
36
36
  var hasSider = !!sider;
37
- var styled = stylex.default.props(styles.layout({
38
- backgroundColor: theme.colors["surface-container-lowest"],
39
- color: theme.colors["on-surface"]
40
- }));
37
+ var styled = {
38
+ layout: stylex.default.props(styles.layout({
39
+ backgroundColor: theme.colors["surface-container-lowest"],
40
+ color: theme.colors["on-surface"]
41
+ })),
42
+ main: {
43
+ className: "musaex-mnehq9"
44
+ }
45
+ };
41
46
  return /*#__PURE__*/React.createElement("div", {
42
- className: relax.clsx(className, styled.className),
43
- style: _objectSpread(_objectSpread({}, styled.style), style)
44
- }, children.get(hooks$1.ChildToken.Header), hasSider ? (/*#__PURE__*/React.createElement(index.Grid.Row, {
45
- as: "main"
47
+ className: relax.clsx(className, styled.layout.className),
48
+ style: _objectSpread(_objectSpread({}, styled.layout.style), style)
49
+ }, children.get(hooks$1.ChildToken.Header), hasSider && (/*#__PURE__*/React.createElement(index.Grid.Row, {
50
+ as: "main",
51
+ className: styled.main.className,
52
+ style: styled.main.style
46
53
  }, sider, /*#__PURE__*/React.createElement(index.Grid.Col, _objectSpread(_objectSpread({}, mainProps), {}, {
47
54
  span: 19
48
- }), children.get(hooks$1.ChildToken.Main), children.get(hooks$1.ChildToken.Footer)))) : (/*#__PURE__*/React.createElement("main", _objectSpread({}, mainProps), children.get(hooks$1.ChildToken.Main), children.get(hooks$1.ChildToken.Footer))));
55
+ }), children.get(hooks$1.ChildToken.Main), children.get(hooks$1.ChildToken.Footer)))), !hasSider && (/*#__PURE__*/React.createElement("main", _objectSpread(_objectSpread({}, mainProps), {}, {
56
+ className: relax.clsx(mainProps.className, styled.main.className),
57
+ style: _objectSpread(_objectSpread({}, styled.main.style), mainProps.style)
58
+ }), children.get(hooks$1.ChildToken.Main), children.get(hooks$1.ChildToken.Footer))));
49
59
  };
50
60
 
51
61
  exports.default = Layout;
@@ -32,18 +32,28 @@ var Layout = function Layout(_ref) {
32
32
  mainProps = _useChildren.mainProps;
33
33
  var sider = children.get(ChildToken.Sider);
34
34
  var hasSider = !!sider;
35
- var styled = _stylex.props(styles.layout({
36
- backgroundColor: theme.colors["surface-container-lowest"],
37
- color: theme.colors["on-surface"]
38
- }));
35
+ var styled = {
36
+ layout: _stylex.props(styles.layout({
37
+ backgroundColor: theme.colors["surface-container-lowest"],
38
+ color: theme.colors["on-surface"]
39
+ })),
40
+ main: {
41
+ className: "musaex-mnehq9"
42
+ }
43
+ };
39
44
  return /*#__PURE__*/React.createElement("div", {
40
- className: clsx(className, styled.className),
41
- style: _objectSpread(_objectSpread({}, styled.style), style)
42
- }, children.get(ChildToken.Header), hasSider ? (/*#__PURE__*/React.createElement(Grid.Row, {
43
- as: "main"
45
+ className: clsx(className, styled.layout.className),
46
+ style: _objectSpread(_objectSpread({}, styled.layout.style), style)
47
+ }, children.get(ChildToken.Header), hasSider && (/*#__PURE__*/React.createElement(Grid.Row, {
48
+ as: "main",
49
+ className: styled.main.className,
50
+ style: styled.main.style
44
51
  }, sider, /*#__PURE__*/React.createElement(Grid.Col, _objectSpread(_objectSpread({}, mainProps), {}, {
45
52
  span: 19
46
- }), children.get(ChildToken.Main), children.get(ChildToken.Footer)))) : (/*#__PURE__*/React.createElement("main", _objectSpread({}, mainProps), children.get(ChildToken.Main), children.get(ChildToken.Footer))));
53
+ }), children.get(ChildToken.Main), children.get(ChildToken.Footer)))), !hasSider && (/*#__PURE__*/React.createElement("main", _objectSpread(_objectSpread({}, mainProps), {}, {
54
+ className: clsx(mainProps.className, styled.main.className),
55
+ style: _objectSpread(_objectSpread({}, styled.main.style), mainProps.style)
56
+ }), children.get(ChildToken.Main), children.get(ChildToken.Footer))));
47
57
  };
48
58
 
49
59
  export { Layout as default };
@@ -117,7 +117,7 @@ var Group = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
117
117
  var _useMenuContext = hooks.useMenuContext(),
118
118
  collect = _useMenuContext.collect,
119
119
  expandedKeys = _useMenuContext.expandedKeys;
120
- var groupRef = relax.useRefs(ref, scope);
120
+ var groupRef = relax.useComposedRef(ref, scope);
121
121
  var theme = hooks$1.useTheme();
122
122
  var isInline = mode === "inline";
123
123
  var _useExpandable = useExpandable.useExpandable(),
@@ -10,7 +10,7 @@ import { useClassNames } from '../../hooks/use-class-names.mjs';
10
10
  import { MenuClassToken } from '../../utils/class-name.mjs';
11
11
  import Item from './item.mjs';
12
12
  import { useMenuContext } from './hooks.mjs';
13
- import { useRefs, useUpdateEffect, clsx } from '@aiszlab/relax';
13
+ import { useComposedRef, useUpdateEffect, clsx } from '@aiszlab/relax';
14
14
  import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.8.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
15
15
  import { useExpandable } from '../../hooks/use-expandable.mjs';
16
16
  import { useTheme } from '../theme/hooks.mjs';
@@ -115,7 +115,7 @@ var Group = /*#__PURE__*/forwardRef(function (_ref2, ref) {
115
115
  var _useMenuContext = useMenuContext(),
116
116
  collect = _useMenuContext.collect,
117
117
  expandedKeys = _useMenuContext.expandedKeys;
118
- var groupRef = useRefs(ref, scope);
118
+ var groupRef = useComposedRef(ref, scope);
119
119
  var theme = useTheme();
120
120
  var isInline = mode === "inline";
121
121
  var _useExpandable = useExpandable(),
@@ -192,7 +192,7 @@ var Notification = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
192
192
  animate = _useAnimate2[1];
193
193
  var _placement = PLACEMENTS[axis];
194
194
  var classNames = useClassNames.useClassNames("notification");
195
- var notificationRef = relax.useRefs(scope, ref);
195
+ var notificationRef = relax.useComposedRef(scope, ref);
196
196
  // after duration, `Notification` will auto destroy
197
197
  relax.useTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
198
198
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -5,7 +5,7 @@ import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.8.0/node_module
5
5
  import React, { forwardRef, useEffect, createElement } from 'react';
6
6
  import { usePresence, useAnimate } from 'framer-motion';
7
7
  import { useTheme } from '../theme/hooks.mjs';
8
- import { useRefs, useTimeout, clsx } from '@aiszlab/relax';
8
+ import { useComposedRef, useTimeout, clsx } from '@aiszlab/relax';
9
9
  import { useClassNames } from '../../hooks/use-class-names.mjs';
10
10
  import { NotificationClassToken } from '../../utils/class-name.mjs';
11
11
  import { Button } from '../button/button.mjs';
@@ -190,7 +190,7 @@ var Notification = /*#__PURE__*/forwardRef(function (_ref, ref) {
190
190
  animate = _useAnimate2[1];
191
191
  var _placement = PLACEMENTS[axis];
192
192
  var classNames = useClassNames("notification");
193
- var notificationRef = useRefs(scope, ref);
193
+ var notificationRef = useComposedRef(scope, ref);
194
194
  // after duration, `Notification` will auto destroy
195
195
  useTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
196
196
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -117,7 +117,8 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
117
117
  }),
118
118
  floatableRef = _useFloating.floatableRef,
119
119
  arrowRef = _useFloating.arrowRef,
120
- _disappear = _useFloating.disappear;
120
+ _disappear = _useFloating.disappear,
121
+ composedRef = _useFloating.composedRef;
121
122
  React.useImperativeHandle(ref, function () {
122
123
  return {
123
124
  disappear: function disappear() {
@@ -141,7 +142,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
141
142
  className: styled.portal.className,
142
143
  style: styled.portal.style
143
144
  }, /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
144
- ref: floatableRef
145
+ ref: composedRef
145
146
  }, props), {}, {
146
147
  className: relax.clsx(classNames[className.PopperClassToken.Dropdown], className$1, styled.dropdown.className),
147
148
  style: _objectSpread(_objectSpread({}, styled.dropdown.style), style)
@@ -115,7 +115,8 @@ var Dropdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
115
115
  }),
116
116
  floatableRef = _useFloating.floatableRef,
117
117
  arrowRef = _useFloating.arrowRef,
118
- _disappear = _useFloating.disappear;
118
+ _disappear = _useFloating.disappear,
119
+ composedRef = _useFloating.composedRef;
119
120
  useImperativeHandle(ref, function () {
120
121
  return {
121
122
  disappear: function disappear() {
@@ -139,7 +140,7 @@ var Dropdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
139
140
  className: styled.portal.className,
140
141
  style: styled.portal.style
141
142
  }, /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
142
- ref: floatableRef
143
+ ref: composedRef
143
144
  }, props), {}, {
144
145
  className: clsx(classNames[PopperClassToken.Dropdown], className, styled.dropdown.className),
145
146
  style: _objectSpread(_objectSpread({}, styled.dropdown.style), style)
@@ -42,9 +42,11 @@ var useFloating = function useFloating(_ref2) {
42
42
  disappearable = _ref2.disappearable;
43
43
  var _useAnimate = framerMotion.useAnimate(),
44
44
  _useAnimate2 = _slicedToArray(_useAnimate, 2),
45
- floatableRef = _useAnimate2[0],
45
+ _scope = _useAnimate2[0],
46
46
  animate = _useAnimate2[1];
47
+ var floatableRef = React.useRef(null);
47
48
  var arrowRef = React.useRef(null);
49
+ var composedRef = relax.useComposedRef(_scope, floatableRef);
48
50
  var _useContainer = useContainer.useContainer({
49
51
  container: _trigger,
50
52
  useBody: false
@@ -56,6 +58,7 @@ var useFloating = function useFloating(_ref2) {
56
58
  // first remove `display: none` style
57
59
  // then animate
58
60
  var appear = relax.useEvent(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
61
+ var _floatable;
59
62
  return _regeneratorRuntime().wrap(function _callee$(_context) {
60
63
  while (1) switch (_context.prev = _context.next) {
61
64
  case 0:
@@ -65,18 +68,25 @@ var useFloating = function useFloating(_ref2) {
65
68
  }
66
69
  return _context.abrupt("return");
67
70
  case 2:
71
+ _floatable = floatableRef.current;
72
+ if (_floatable) {
73
+ _context.next = 5;
74
+ break;
75
+ }
76
+ return _context.abrupt("return");
77
+ case 5:
68
78
  _isOpen.current = true;
69
- floatableRef.current.style.display = "unset";
70
- _context.next = 6;
71
- return animate(floatableRef.current, {
79
+ _floatable.style.display = "unset";
80
+ _context.next = 9;
81
+ return animate(_scope.current, {
72
82
  opacity: 1
73
83
  }, {
74
84
  duration: 0.2
75
85
  });
76
- case 6:
77
- _context.next = 8;
86
+ case 9:
87
+ _context.next = 11;
78
88
  return onEntered === null || onEntered === void 0 ? void 0 : onEntered();
79
- case 8:
89
+ case 11:
80
90
  case "end":
81
91
  return _context.stop();
82
92
  }
@@ -87,6 +97,7 @@ var useFloating = function useFloating(_ref2) {
87
97
  // when using force disappear, it will be forced to disappear
88
98
  var disappear = relax.useEvent(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
89
99
  var force,
100
+ _floatable,
90
101
  _args2 = arguments;
91
102
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
92
103
  while (1) switch (_context2.prev = _context2.next) {
@@ -104,21 +115,26 @@ var useFloating = function useFloating(_ref2) {
104
115
  }
105
116
  return _context2.abrupt("return");
106
117
  case 5:
118
+ _floatable = floatableRef.current;
119
+ if (_floatable) {
120
+ _context2.next = 8;
121
+ break;
122
+ }
123
+ return _context2.abrupt("return");
124
+ case 8:
107
125
  _isOpen.current = false;
108
- _context2.next = 8;
109
- return Promise.all([onExit === null || onExit === void 0 ? void 0 : onExit(), animate(floatableRef.current, {
126
+ _context2.next = 11;
127
+ return Promise.all([onExit === null || onExit === void 0 ? void 0 : onExit(), animate(_scope.current, {
110
128
  opacity: 0
111
129
  }, {
112
130
  duration: 0.2
113
131
  }).then(function () {
114
- // Popper is unmounted
115
- if (!floatableRef.current) return;
116
- floatableRef.current.style.display = "none";
132
+ _floatable.style.display = "none";
117
133
  })]);
118
- case 8:
119
- _context2.next = 10;
134
+ case 11:
135
+ _context2.next = 13;
120
136
  return onExited === null || onExited === void 0 ? void 0 : onExited();
121
- case 10:
137
+ case 13:
122
138
  case "end":
123
139
  return _context2.stop();
124
140
  }
@@ -132,8 +148,10 @@ var useFloating = function useFloating(_ref2) {
132
148
  // position listener
133
149
  var position = relax.useEvent(function () {
134
150
  if (!trigger) return;
135
- var cleanup = dom.autoUpdate(trigger, floatableRef.current, function () {
136
- dom.computePosition(trigger, floatableRef.current, {
151
+ var _floatable = floatableRef.current;
152
+ if (!_floatable) return;
153
+ var cleanup = dom.autoUpdate(trigger, _floatable, function () {
154
+ dom.computePosition(trigger, _floatable, {
137
155
  placement: placement,
138
156
  middleware: [dom.flip(), dom.shift(), dom.offset(offsets), arrowable && !!arrowRef.current && dom.arrow({
139
157
  element: arrowRef.current,
@@ -148,7 +166,7 @@ var useFloating = function useFloating(_ref2) {
148
166
  _placement$split2 = _slicedToArray(_placement$split, 1),
149
167
  side = _placement$split2[0];
150
168
  // set float element styles
151
- floatableRef.current.style.translate = "".concat(x, "px ").concat(y, "px");
169
+ _floatable.style.translate = "".concat(x, "px ").concat(y, "px");
152
170
  // set arrow styles
153
171
  if (middlewareData.arrow && !!arrowRef.current) {
154
172
  var _middlewareData$arrow, _middlewareData$arrow2;
@@ -179,6 +197,7 @@ var useFloating = function useFloating(_ref2) {
179
197
  }, [disappear, open, position]);
180
198
  return {
181
199
  floatableRef: floatableRef,
200
+ composedRef: composedRef,
182
201
  arrowRef: arrowRef,
183
202
  disappear: disappear
184
203
  };
@@ -26,7 +26,8 @@ export declare const useFloating: ({ open, trigger: _trigger, placement, arrowab
26
26
  onExited?: () => Promise<void> | void;
27
27
  disappearable: boolean;
28
28
  }) => {
29
- floatableRef: import("framer-motion").AnimationScope<HTMLDivElement>;
29
+ floatableRef: import("react").RefObject<HTMLDivElement>;
30
+ composedRef: (reference: HTMLDivElement) => void;
30
31
  arrowRef: import("react").RefObject<HTMLDivElement>;
31
32
  disappear: (force?: boolean) => Promise<void>;
32
33
  };
@@ -3,7 +3,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import { useRef, useEffect, useMemo } from 'react';
5
5
  import { useAnimate } from 'framer-motion';
6
- import { useEvent } from '@aiszlab/relax';
6
+ import { useComposedRef, useEvent } from '@aiszlab/relax';
7
7
  import { useContainer } from '../../hooks/use-container.mjs';
8
8
  import { autoUpdate, computePosition, flip, shift, offset, arrow } from '@floating-ui/dom';
9
9
 
@@ -42,9 +42,11 @@ var useFloating = function useFloating(_ref2) {
42
42
  disappearable = _ref2.disappearable;
43
43
  var _useAnimate = useAnimate(),
44
44
  _useAnimate2 = _slicedToArray(_useAnimate, 2),
45
- floatableRef = _useAnimate2[0],
45
+ _scope = _useAnimate2[0],
46
46
  animate = _useAnimate2[1];
47
+ var floatableRef = useRef(null);
47
48
  var arrowRef = useRef(null);
49
+ var composedRef = useComposedRef(_scope, floatableRef);
48
50
  var _useContainer = useContainer({
49
51
  container: _trigger,
50
52
  useBody: false
@@ -56,6 +58,7 @@ var useFloating = function useFloating(_ref2) {
56
58
  // first remove `display: none` style
57
59
  // then animate
58
60
  var appear = useEvent(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
61
+ var _floatable;
59
62
  return _regeneratorRuntime().wrap(function _callee$(_context) {
60
63
  while (1) switch (_context.prev = _context.next) {
61
64
  case 0:
@@ -65,18 +68,25 @@ var useFloating = function useFloating(_ref2) {
65
68
  }
66
69
  return _context.abrupt("return");
67
70
  case 2:
71
+ _floatable = floatableRef.current;
72
+ if (_floatable) {
73
+ _context.next = 5;
74
+ break;
75
+ }
76
+ return _context.abrupt("return");
77
+ case 5:
68
78
  _isOpen.current = true;
69
- floatableRef.current.style.display = "unset";
70
- _context.next = 6;
71
- return animate(floatableRef.current, {
79
+ _floatable.style.display = "unset";
80
+ _context.next = 9;
81
+ return animate(_scope.current, {
72
82
  opacity: 1
73
83
  }, {
74
84
  duration: 0.2
75
85
  });
76
- case 6:
77
- _context.next = 8;
86
+ case 9:
87
+ _context.next = 11;
78
88
  return onEntered === null || onEntered === void 0 ? void 0 : onEntered();
79
- case 8:
89
+ case 11:
80
90
  case "end":
81
91
  return _context.stop();
82
92
  }
@@ -87,6 +97,7 @@ var useFloating = function useFloating(_ref2) {
87
97
  // when using force disappear, it will be forced to disappear
88
98
  var disappear = useEvent(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
89
99
  var force,
100
+ _floatable,
90
101
  _args2 = arguments;
91
102
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
92
103
  while (1) switch (_context2.prev = _context2.next) {
@@ -104,21 +115,26 @@ var useFloating = function useFloating(_ref2) {
104
115
  }
105
116
  return _context2.abrupt("return");
106
117
  case 5:
118
+ _floatable = floatableRef.current;
119
+ if (_floatable) {
120
+ _context2.next = 8;
121
+ break;
122
+ }
123
+ return _context2.abrupt("return");
124
+ case 8:
107
125
  _isOpen.current = false;
108
- _context2.next = 8;
109
- return Promise.all([onExit === null || onExit === void 0 ? void 0 : onExit(), animate(floatableRef.current, {
126
+ _context2.next = 11;
127
+ return Promise.all([onExit === null || onExit === void 0 ? void 0 : onExit(), animate(_scope.current, {
110
128
  opacity: 0
111
129
  }, {
112
130
  duration: 0.2
113
131
  }).then(function () {
114
- // Popper is unmounted
115
- if (!floatableRef.current) return;
116
- floatableRef.current.style.display = "none";
132
+ _floatable.style.display = "none";
117
133
  })]);
118
- case 8:
119
- _context2.next = 10;
134
+ case 11:
135
+ _context2.next = 13;
120
136
  return onExited === null || onExited === void 0 ? void 0 : onExited();
121
- case 10:
137
+ case 13:
122
138
  case "end":
123
139
  return _context2.stop();
124
140
  }
@@ -132,8 +148,10 @@ var useFloating = function useFloating(_ref2) {
132
148
  // position listener
133
149
  var position = useEvent(function () {
134
150
  if (!trigger) return;
135
- var cleanup = autoUpdate(trigger, floatableRef.current, function () {
136
- computePosition(trigger, floatableRef.current, {
151
+ var _floatable = floatableRef.current;
152
+ if (!_floatable) return;
153
+ var cleanup = autoUpdate(trigger, _floatable, function () {
154
+ computePosition(trigger, _floatable, {
137
155
  placement: placement,
138
156
  middleware: [flip(), shift(), offset(offsets), arrowable && !!arrowRef.current && arrow({
139
157
  element: arrowRef.current,
@@ -148,7 +166,7 @@ var useFloating = function useFloating(_ref2) {
148
166
  _placement$split2 = _slicedToArray(_placement$split, 1),
149
167
  side = _placement$split2[0];
150
168
  // set float element styles
151
- floatableRef.current.style.translate = "".concat(x, "px ").concat(y, "px");
169
+ _floatable.style.translate = "".concat(x, "px ").concat(y, "px");
152
170
  // set arrow styles
153
171
  if (middlewareData.arrow && !!arrowRef.current) {
154
172
  var _middlewareData$arrow, _middlewareData$arrow2;
@@ -179,6 +197,7 @@ var useFloating = function useFloating(_ref2) {
179
197
  }, [disappear, open, position]);
180
198
  return {
181
199
  floatableRef: floatableRef,
200
+ composedRef: composedRef,
182
201
  arrowRef: arrowRef,
183
202
  disappear: disappear
184
203
  };
@@ -44,8 +44,8 @@ var Skeleton = function Skeleton(_ref) {
44
44
  var classNames = useClassNames.useClassNames("skeleton");
45
45
  var theme = hooks.useTheme();
46
46
  var styled = stylex.default.props(styles.variables({
47
- shadow: color.hexToRgba(theme.colors.shadow, tokens_stylex.OPACITY.thin, true),
48
- lighterShadow: color.hexToRgba(theme.colors.shadow, tokens_stylex.OPACITY.thick, true)
47
+ shadow: color.hexToRgba(theme.colors.shadow, tokens_stylex.OPACITY.thin, "style"),
48
+ lighterShadow: color.hexToRgba(theme.colors.shadow, tokens_stylex.OPACITY.thick, "style")
49
49
  }), styles.skeleton, animation && styles.animation);
50
50
  return /*#__PURE__*/React.createElement("div", {
51
51
  className: relax.clsx(classNames[className.SkeletonClassToken.Skeleton], className$1, styled.className),
@@ -42,8 +42,8 @@ var Skeleton = function Skeleton(_ref) {
42
42
  var classNames = useClassNames("skeleton");
43
43
  var theme = useTheme();
44
44
  var styled = _stylex.props(styles.variables({
45
- shadow: hexToRgba(theme.colors.shadow, OPACITY.thin, true),
46
- lighterShadow: hexToRgba(theme.colors.shadow, OPACITY.thick, true)
45
+ shadow: hexToRgba(theme.colors.shadow, OPACITY.thin, "style"),
46
+ lighterShadow: hexToRgba(theme.colors.shadow, OPACITY.thick, "style")
47
47
  }), styles.skeleton, animation && styles.animation);
48
48
  return /*#__PURE__*/React.createElement("div", {
49
49
  className: clsx(classNames[SkeletonClassToken.Skeleton], className, styled.className),
@@ -198,6 +198,7 @@ var styles = {
198
198
  display: "musaex-78zum5",
199
199
  flexDirection: "musaex-1q0g3np",
200
200
  alignItems: "musaex-6s0dn4",
201
+ justifyContent: "musaex-l56j7k",
201
202
  color: "musaex-1heor9g",
202
203
  transitionProperty: "musaex-1ve1rmq",
203
204
  transitionDuration: "musaex-13dflua",
@@ -266,28 +267,28 @@ var Switch = function Switch(_ref) {
266
267
  backgroundColor: theme.colors["surface-container-highest"],
267
268
  color: theme.colors["on-surface-variant"]
268
269
  }, disabled && {
269
- borderColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.medium, true),
270
- backgroundColor: color.hexToRgba(theme.colors["surface-variant"], tokens_stylex.OPACITY.medium, true),
271
- color: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, true)
270
+ borderColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.medium, "style"),
271
+ backgroundColor: color.hexToRgba(theme.colors["surface-variant"], tokens_stylex.OPACITY.medium, "style"),
272
+ color: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style")
272
273
  })), isChecked && styles["switch"].checked(_objectSpread({
273
274
  backgroundColor: theme.colors.primary,
274
275
  color: theme.colors["on-primary"]
275
276
  }, disabled && {
276
- backgroundColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.medium, true),
277
+ backgroundColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.medium, "style"),
277
278
  color: theme.colors.surface
278
279
  })), disabled && styles["switch"].disabled),
279
280
  slider: stylex.default.props(styles.slider.normal(_objectSpread({
280
281
  backgroundColor: theme.colors["on-surface-variant"],
281
282
  color: theme.colors["surface-container-highest"]
282
283
  }, disabled && {
283
- backgroundColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, true),
284
+ backgroundColor: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style"),
284
285
  color: theme.colors["surface-container-highest"]
285
286
  })), icon && styles.slider.icon, disabled && styles.slider.disabled, isChecked && styles.slider.checked(_objectSpread({
286
287
  backgroundColor: theme.colors["on-primary"],
287
288
  color: theme.colors["on-primary-container"]
288
289
  }, disabled && {
289
290
  backgroundColor: theme.colors.surface,
290
- color: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, true)
291
+ color: color.hexToRgba(theme.colors["on-surface"], tokens_stylex.OPACITY.thicker, "style")
291
292
  }))),
292
293
  supporting: stylex.default.props(styles.supporting["default"], isChecked && styles.supporting.checked),
293
294
  leading: stylex.default.props(styles.supporting.child, styles.leading["default"], isChecked && styles.leading.checked),
@@ -196,6 +196,7 @@ var styles = {
196
196
  display: "musaex-78zum5",
197
197
  flexDirection: "musaex-1q0g3np",
198
198
  alignItems: "musaex-6s0dn4",
199
+ justifyContent: "musaex-l56j7k",
199
200
  color: "musaex-1heor9g",
200
201
  transitionProperty: "musaex-1ve1rmq",
201
202
  transitionDuration: "musaex-13dflua",
@@ -264,28 +265,28 @@ var Switch = function Switch(_ref) {
264
265
  backgroundColor: theme.colors["surface-container-highest"],
265
266
  color: theme.colors["on-surface-variant"]
266
267
  }, disabled && {
267
- borderColor: hexToRgba(theme.colors["on-surface"], OPACITY.medium, true),
268
- backgroundColor: hexToRgba(theme.colors["surface-variant"], OPACITY.medium, true),
269
- color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true)
268
+ borderColor: hexToRgba(theme.colors["on-surface"], OPACITY.medium, "style"),
269
+ backgroundColor: hexToRgba(theme.colors["surface-variant"], OPACITY.medium, "style"),
270
+ color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style")
270
271
  })), isChecked && styles["switch"].checked(_objectSpread({
271
272
  backgroundColor: theme.colors.primary,
272
273
  color: theme.colors["on-primary"]
273
274
  }, disabled && {
274
- backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.medium, true),
275
+ backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.medium, "style"),
275
276
  color: theme.colors.surface
276
277
  })), disabled && styles["switch"].disabled),
277
278
  slider: _stylex.props(styles.slider.normal(_objectSpread({
278
279
  backgroundColor: theme.colors["on-surface-variant"],
279
280
  color: theme.colors["surface-container-highest"]
280
281
  }, disabled && {
281
- backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true),
282
+ backgroundColor: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style"),
282
283
  color: theme.colors["surface-container-highest"]
283
284
  })), icon && styles.slider.icon, disabled && styles.slider.disabled, isChecked && styles.slider.checked(_objectSpread({
284
285
  backgroundColor: theme.colors["on-primary"],
285
286
  color: theme.colors["on-primary-container"]
286
287
  }, disabled && {
287
288
  backgroundColor: theme.colors.surface,
288
- color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true)
289
+ color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, "style")
289
290
  }))),
290
291
  supporting: _stylex.props(styles.supporting["default"], isChecked && styles.supporting.checked),
291
292
  leading: _stylex.props(styles.supporting.child, styles.leading["default"], isChecked && styles.leading.checked),
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- require("musae/styles")
1
+ require("musae/styles.css")
2
2
  var index = require('./components/avatar/index.cjs');
3
3
  var index$1 = require('./components/radio/index.cjs');
4
4
  var index$2 = require('./components/checkbox/index.cjs');
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import "musae/styles";
1
+ import "musae/styles.css";
2
2
  export { Avatar } from './components/avatar/index.mjs';
3
3
  export { Radio } from './components/radio/index.mjs';
4
4
  export { Checkbox } from './components/checkbox/index.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "import": "./dist/index.mjs",
25
25
  "default": "./dist/index.mjs"
26
26
  },
27
- "./styles": "./dist/styles.css",
27
+ "./styles.css": "./dist/styles.css",
28
28
  "./locales": {
29
29
  "types": "./dist/locale/locales/index.d.ts",
30
30
  "require": "./dist/locale/locales/index.cjs",
@@ -53,8 +53,8 @@
53
53
  "pnpm": ">=9"
54
54
  },
55
55
  "dependencies": {
56
- "@aiszlab/fuzzy": "^1.4.7",
57
- "@aiszlab/relax": "^1.4.7",
56
+ "@aiszlab/fuzzy": "^1.5.1",
57
+ "@aiszlab/relax": "^1.5.1",
58
58
  "@babel/runtime": "^7.25.7",
59
59
  "@dnd-kit/core": "^6.1.0",
60
60
  "@dnd-kit/modifiers": "^7.0.0",
@@ -93,7 +93,7 @@
93
93
  "@testing-library/react": "^16.0.1",
94
94
  "@testing-library/user-event": "^14.5.2",
95
95
  "@types/jest": "^29.5.13",
96
- "@types/node": "^22.7.7",
96
+ "@types/node": "^22.7.8",
97
97
  "@types/react": "^18.3.11",
98
98
  "@types/react-dom": "^18.3.1",
99
99
  "babel-jest": "^29.7.0",