musae 1.0.0 → 1.0.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.
Files changed (70) hide show
  1. package/dist/components/bench/hooks.cjs +1 -1
  2. package/dist/components/bench/hooks.mjs +1 -1
  3. package/dist/components/button/button.cjs +2 -3
  4. package/dist/components/button/button.d.ts +2 -3
  5. package/dist/components/button/button.mjs +2 -3
  6. package/dist/components/checkbox/checkbox.cjs +24 -20
  7. package/dist/components/checkbox/checkbox.d.ts +1 -1
  8. package/dist/components/checkbox/checkbox.mjs +25 -21
  9. package/dist/components/checkbox/context.cjs +1 -1
  10. package/dist/components/checkbox/context.d.ts +1 -1
  11. package/dist/components/checkbox/context.mjs +1 -1
  12. package/dist/components/checkbox/index.d.ts +1 -1
  13. package/dist/components/clock/clock.cjs +1 -6
  14. package/dist/components/clock/clock.mjs +1 -6
  15. package/dist/components/clock/column.cjs +23 -11
  16. package/dist/components/clock/column.d.ts +2 -2
  17. package/dist/components/clock/column.mjs +24 -12
  18. package/dist/components/collapse/item.cjs +4 -9
  19. package/dist/components/collapse/item.mjs +4 -9
  20. package/dist/components/dialog/popup.cjs +48 -45
  21. package/dist/components/dialog/popup.mjs +48 -45
  22. package/dist/components/divider/divider.cjs +1 -0
  23. package/dist/components/divider/divider.mjs +1 -0
  24. package/dist/components/drawer/popup.cjs +48 -44
  25. package/dist/components/drawer/popup.mjs +48 -44
  26. package/dist/components/form/field/error.cjs +42 -23
  27. package/dist/components/form/field/error.mjs +42 -23
  28. package/dist/components/form/field/field.cjs +2 -2
  29. package/dist/components/form/field/field.mjs +1 -1
  30. package/dist/components/menu/group.cjs +41 -76
  31. package/dist/components/menu/group.mjs +41 -76
  32. package/dist/components/menu/hooks.d.ts +1 -1
  33. package/dist/components/menu/item.cjs +22 -5
  34. package/dist/components/menu/item.mjs +22 -5
  35. package/dist/components/menu/menu.cjs +4 -2
  36. package/dist/components/menu/menu.mjs +4 -2
  37. package/dist/components/notification/holder.cjs +2 -2
  38. package/dist/components/notification/holder.mjs +1 -1
  39. package/dist/components/notification/notification.cjs +57 -33
  40. package/dist/components/notification/notification.mjs +58 -34
  41. package/dist/components/popper/dropdown.cjs +2 -3
  42. package/dist/components/popper/dropdown.mjs +2 -3
  43. package/dist/components/popper/hooks.cjs +17 -23
  44. package/dist/components/popper/hooks.d.ts +0 -1
  45. package/dist/components/popper/hooks.mjs +18 -24
  46. package/dist/components/progress/circular.cjs +16 -21
  47. package/dist/components/progress/circular.mjs +16 -21
  48. package/dist/components/ripple/ripple.cjs +3 -3
  49. package/dist/components/ripple/ripple.mjs +1 -1
  50. package/dist/components/tabs/navigation.cjs +6 -8
  51. package/dist/components/tabs/navigation.mjs +6 -8
  52. package/dist/components/theme/theme.cjs +11 -0
  53. package/dist/components/theme/theme.d.ts +9 -0
  54. package/dist/components/theme/theme.mjs +11 -1
  55. package/dist/components/theme/tokens.stylex.cjs +0 -1
  56. package/dist/components/theme/tokens.stylex.mjs +0 -1
  57. package/dist/components/transfer/item.cjs +3 -2
  58. package/dist/components/transfer/item.mjs +3 -2
  59. package/dist/components/transfer/list.cjs +17 -8
  60. package/dist/components/transfer/list.mjs +18 -9
  61. package/dist/components/transfer/transfer.cjs +5 -4
  62. package/dist/components/transfer/transfer.mjs +5 -4
  63. package/dist/components/tree/list.cjs +4 -9
  64. package/dist/components/tree/list.mjs +4 -9
  65. package/dist/hooks/use-expandable.cjs +64 -59
  66. package/dist/hooks/use-expandable.d.ts +4 -6
  67. package/dist/hooks/use-expandable.mjs +64 -59
  68. package/dist/styles.css +36 -48
  69. package/dist/types/menu.d.ts +2 -1
  70. package/package.json +28 -27
@@ -110,7 +110,7 @@ var useMenuKeys = function useMenuKeys(_ref4) {
110
110
  expandedKeys = _useState2[0],
111
111
  setExpandedKeys = _useState2[1];
112
112
  var onExpandedKeysChange = React.useCallback(function (expandingKeys) {
113
- setExpandedKeys(expandingKeys);
113
+ return setExpandedKeys(expandingKeys);
114
114
  }, [setExpandedKeys]);
115
115
  return {
116
116
  selectedKeys: selectedKeys,
@@ -108,7 +108,7 @@ var useMenuKeys = function useMenuKeys(_ref4) {
108
108
  expandedKeys = _useState2[0],
109
109
  setExpandedKeys = _useState2[1];
110
110
  var onExpandedKeysChange = useCallback(function (expandingKeys) {
111
- setExpandedKeys(expandingKeys);
111
+ return setExpandedKeys(expandingKeys);
112
112
  }, [setExpandedKeys]);
113
113
  return {
114
114
  selectedKeys: selectedKeys,
@@ -201,9 +201,8 @@ var styles = {
201
201
  /**
202
202
  * @author murukal
203
203
  *
204
- * @description
205
- * button
206
- * 1. diff from normal html button, this button is default type `button`, not `submit`
204
+ * @description button
205
+ * diff from normal html button, this button is default type `button`, not `submit`
207
206
  */
208
207
  var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
209
208
  var children = _ref.children,
@@ -3,9 +3,8 @@ import React from "react";
3
3
  /**
4
4
  * @author murukal
5
5
  *
6
- * @description
7
- * button
8
- * 1. diff from normal html button, this button is default type `button`, not `submit`
6
+ * @description button
7
+ * diff from normal html button, this button is default type `button`, not `submit`
9
8
  */
10
9
  export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
10
  export default Button;
@@ -197,9 +197,8 @@ var styles = {
197
197
  /**
198
198
  * @author murukal
199
199
  *
200
- * @description
201
- * button
202
- * 1. diff from normal html button, this button is default type `button`, not `submit`
200
+ * @description button
201
+ * diff from normal html button, this button is default type `button`, not `submit`
203
202
  */
204
203
  var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
205
204
  var children = _ref.children,
@@ -19,6 +19,7 @@ var ripple = require('../ripple/ripple.cjs');
19
19
  var hooks$1 = require('../ripple/hooks.cjs');
20
20
  var color = require('@aiszlab/fuzzy/color');
21
21
  var tokens_stylex = require('../theme/tokens.stylex.cjs');
22
+ var dom = require('@aiszlab/relax/dom');
22
23
 
23
24
  var Checkbox = function Checkbox(_ref) {
24
25
  var _contextValue$isDisab;
@@ -28,7 +29,7 @@ var Checkbox = function Checkbox(_ref) {
28
29
  children = _ref.children,
29
30
  onChange = _ref.onChange,
30
31
  _ref$disabled = _ref.disabled,
31
- _disabled = _ref$disabled === void 0 ? false : _ref$disabled,
32
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
32
33
  checked = _ref.checked,
33
34
  _ref$indeterminate = _ref.indeterminate,
34
35
  indeterminate = _ref$indeterminate === void 0 ? false : _ref$indeterminate,
@@ -41,7 +42,7 @@ var Checkbox = function Checkbox(_ref) {
41
42
  var contextValue = React.useContext(context.default);
42
43
  var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
43
44
  var theme$1 = hooks.useTheme();
44
- var isDisabled = (_contextValue$isDisab = contextValue === null || contextValue === void 0 ? void 0 : contextValue.isDisabled) !== null && _contextValue$isDisab !== void 0 ? _contextValue$isDisab : _disabled;
45
+ var isDisabled = (_contextValue$isDisab = contextValue === null || contextValue === void 0 ? void 0 : contextValue.isDisabled) !== null && _contextValue$isDisab !== void 0 ? _contextValue$isDisab : disabled;
45
46
  var _useRipple = hooks$1.useRipple({
46
47
  isDisabled: !ripple$1 || isDisabled
47
48
  }),
@@ -58,7 +59,7 @@ var Checkbox = function Checkbox(_ref) {
58
59
  // if there is context value, use context value
59
60
  // else use controlled state
60
61
  var isChecked = React.useMemo(function () {
61
- if (!contextValue || !value) return _isChecked;
62
+ if (!contextValue || relax.isUndefined(value)) return _isChecked;
62
63
  return contextValue.value.has(value);
63
64
  }, [_isChecked, contextValue, value]);
64
65
  // change handler
@@ -67,22 +68,15 @@ var Checkbox = function Checkbox(_ref) {
67
68
  var change = relax.useEvent(function (event) {
68
69
  if (isDisabled) return;
69
70
  var checked = event.target.checked;
70
- !!value && (contextValue === null || contextValue === void 0 ? void 0 : contextValue.change(value, checked));
71
+ if (!relax.isUndefined(value)) {
72
+ contextValue === null || contextValue === void 0 || contextValue.change(value, checked);
73
+ }
71
74
  _setIsChecked(checked);
72
75
  onChange === null || onChange === void 0 || onChange(event);
73
76
  });
74
- var styled = {
75
- checkbox: stylex.default.props(styles.default.checkbox["default"], styles.default.checkbox.medium, isDisabled && styles.default.checkbox.disabled),
76
- layer: stylex.default.props(styles.default.layer["default"]["default"], ripple$1 && [styles.default.layer.rippleable["default"], (isChecked || indeterminate) && styles.default.layer.rippleable.checked, invalid && styles.default.layer.rippleable.invalid, isDisabled && styles.default.layer.rippleable.disabled]),
77
- inputer: stylex.default.props(styles.default.inputer["default"]["default"], isDisabled && styles.default.inputer["default"].disabled, (isChecked || indeterminate) && [styles.default.inputer.checked["default"], isDisabled && styles.default.inputer.checked.disabled], invalid && [styles.default.inputer.invalid["default"], (isChecked || indeterminate) && styles.default.inputer.invalid.checked, isDisabled && styles.default.inputer.invalid.disabled]),
78
- input: stylex.default.props(styles.default.input["default"]),
79
- check: stylex.default.props(styles.default.check["default"]),
80
- label: stylex.default.props(styles.default.label["default"], invalid && styles.default.label.invalid, theme.typography.label.small)
81
- };
82
- return /*#__PURE__*/React.createElement("label", {
83
- className: className.stringify(classNames.check, className$1, styled.checkbox.className),
84
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.checkbox.style), style), {}, {
85
- // @ts-expect-error style vars
77
+ // style vars
78
+ var styleVars = React.useMemo(function () {
79
+ return {
86
80
  "--color-primary": theme$1.colors.primary,
87
81
  "--color-primary-opacity-08": color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin).toString(),
88
82
  "--color-primary-opacity-12": color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.medium).toString(),
@@ -98,7 +92,19 @@ var Checkbox = function Checkbox(_ref) {
98
92
  "--color-error-opacity-12": color.hexToRgba(theme$1.colors.error, tokens_stylex.OPACITY.medium).toString(),
99
93
  "--color-error-opacity-20": color.hexToRgba(theme$1.colors.error, tokens_stylex.OPACITY.thicker).toString(),
100
94
  "--color-on-error": theme$1.colors["on-error"]
101
- }),
95
+ };
96
+ }, [theme$1]);
97
+ var styled = {
98
+ checkbox: stylex.default.props(styles.default.checkbox["default"], styles.default.checkbox.medium, isDisabled && styles.default.checkbox.disabled),
99
+ layer: stylex.default.props(styles.default.layer["default"]["default"], ripple$1 && [styles.default.layer.rippleable["default"], (isChecked || indeterminate) && styles.default.layer.rippleable.checked, invalid && styles.default.layer.rippleable.invalid, isDisabled && styles.default.layer.rippleable.disabled]),
100
+ inputer: stylex.default.props(styles.default.inputer["default"]["default"], isDisabled && styles.default.inputer["default"].disabled, (isChecked || indeterminate) && [styles.default.inputer.checked["default"], isDisabled && styles.default.inputer.checked.disabled], invalid && [styles.default.inputer.invalid["default"], (isChecked || indeterminate) && styles.default.inputer.invalid.checked, isDisabled && styles.default.inputer.invalid.disabled]),
101
+ input: stylex.default.props(styles.default.input["default"]),
102
+ check: stylex.default.props(styles.default.check["default"]),
103
+ label: stylex.default.props(theme.typography.label.small, styles.default.label["default"], invalid && styles.default.label.invalid)
104
+ };
105
+ return /*#__PURE__*/React.createElement("label", {
106
+ className: className.stringify(classNames.checkbox, className$1, styled.checkbox.className),
107
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.checkbox.style), style), styleVars),
102
108
  "aria-checked": isChecked,
103
109
  "aria-disabled": isDisabled
104
110
  }, /*#__PURE__*/React.createElement("span", {
@@ -117,9 +123,7 @@ var Checkbox = function Checkbox(_ref) {
117
123
  onChange: change,
118
124
  "aria-checked": isChecked,
119
125
  "aria-disabled": isDisabled,
120
- onClick: function onClick(e) {
121
- return e.stopPropagation();
122
- }
126
+ onClick: dom.stopPropagation
123
127
  }), isChecked && /*#__PURE__*/React.createElement(check.default, {
124
128
  className: styled.check.className,
125
129
  style: styled.check.style
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { CheckboxProps } from "../../types/checkbox";
3
3
  import styles from "./styles";
4
- declare const Checkbox: ({ value, className, style, children, onChange, disabled: _disabled, checked, indeterminate, ripple, invalid, defaultChecked, }: CheckboxProps) => React.JSX.Element;
4
+ declare const Checkbox: ({ value, className, style, children, onChange, disabled, checked, indeterminate, ripple, invalid, defaultChecked, }: CheckboxProps) => React.JSX.Element;
5
5
  export default Checkbox;
6
6
  export { styles };
@@ -1,7 +1,7 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import React, { useContext, useMemo } from 'react';
4
- import { useControlledState, useEvent } from '@aiszlab/relax';
4
+ import { useControlledState, isUndefined, useEvent } from '@aiszlab/relax';
5
5
  import Context, { CLASS_NAMES } from './context.mjs';
6
6
  import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.10.1/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
7
7
  import { useTheme } from '../theme/hooks.mjs';
@@ -15,6 +15,7 @@ import Ripple from '../ripple/ripple.mjs';
15
15
  import { useRipple } from '../ripple/hooks.mjs';
16
16
  import { hexToRgba } from '@aiszlab/fuzzy/color';
17
17
  import { OPACITY } from '../theme/tokens.stylex.mjs';
18
+ import { stopPropagation } from '@aiszlab/relax/dom';
18
19
 
19
20
  var Checkbox = function Checkbox(_ref) {
20
21
  var _contextValue$isDisab;
@@ -24,7 +25,7 @@ var Checkbox = function Checkbox(_ref) {
24
25
  children = _ref.children,
25
26
  onChange = _ref.onChange,
26
27
  _ref$disabled = _ref.disabled,
27
- _disabled = _ref$disabled === void 0 ? false : _ref$disabled,
28
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
28
29
  checked = _ref.checked,
29
30
  _ref$indeterminate = _ref.indeterminate,
30
31
  indeterminate = _ref$indeterminate === void 0 ? false : _ref$indeterminate,
@@ -37,7 +38,7 @@ var Checkbox = function Checkbox(_ref) {
37
38
  var contextValue = useContext(Context);
38
39
  var classNames = useClassNames(CLASS_NAMES);
39
40
  var theme = useTheme();
40
- var isDisabled = (_contextValue$isDisab = contextValue === null || contextValue === void 0 ? void 0 : contextValue.isDisabled) !== null && _contextValue$isDisab !== void 0 ? _contextValue$isDisab : _disabled;
41
+ var isDisabled = (_contextValue$isDisab = contextValue === null || contextValue === void 0 ? void 0 : contextValue.isDisabled) !== null && _contextValue$isDisab !== void 0 ? _contextValue$isDisab : disabled;
41
42
  var _useRipple = useRipple({
42
43
  isDisabled: !ripple || isDisabled
43
44
  }),
@@ -54,7 +55,7 @@ var Checkbox = function Checkbox(_ref) {
54
55
  // if there is context value, use context value
55
56
  // else use controlled state
56
57
  var isChecked = useMemo(function () {
57
- if (!contextValue || !value) return _isChecked;
58
+ if (!contextValue || isUndefined(value)) return _isChecked;
58
59
  return contextValue.value.has(value);
59
60
  }, [_isChecked, contextValue, value]);
60
61
  // change handler
@@ -63,22 +64,15 @@ var Checkbox = function Checkbox(_ref) {
63
64
  var change = useEvent(function (event) {
64
65
  if (isDisabled) return;
65
66
  var checked = event.target.checked;
66
- !!value && (contextValue === null || contextValue === void 0 ? void 0 : contextValue.change(value, checked));
67
+ if (!isUndefined(value)) {
68
+ contextValue === null || contextValue === void 0 || contextValue.change(value, checked);
69
+ }
67
70
  _setIsChecked(checked);
68
71
  onChange === null || onChange === void 0 || onChange(event);
69
72
  });
70
- var styled = {
71
- checkbox: _stylex.props(styles.checkbox["default"], styles.checkbox.medium, isDisabled && styles.checkbox.disabled),
72
- layer: _stylex.props(styles.layer["default"]["default"], ripple && [styles.layer.rippleable["default"], (isChecked || indeterminate) && styles.layer.rippleable.checked, invalid && styles.layer.rippleable.invalid, isDisabled && styles.layer.rippleable.disabled]),
73
- inputer: _stylex.props(styles.inputer["default"]["default"], isDisabled && styles.inputer["default"].disabled, (isChecked || indeterminate) && [styles.inputer.checked["default"], isDisabled && styles.inputer.checked.disabled], invalid && [styles.inputer.invalid["default"], (isChecked || indeterminate) && styles.inputer.invalid.checked, isDisabled && styles.inputer.invalid.disabled]),
74
- input: _stylex.props(styles.input["default"]),
75
- check: _stylex.props(styles.check["default"]),
76
- label: _stylex.props(styles.label["default"], invalid && styles.label.invalid, typography.label.small)
77
- };
78
- return /*#__PURE__*/React.createElement("label", {
79
- className: stringify(classNames.check, className, styled.checkbox.className),
80
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.checkbox.style), style), {}, {
81
- // @ts-expect-error style vars
73
+ // style vars
74
+ var styleVars = useMemo(function () {
75
+ return {
82
76
  "--color-primary": theme.colors.primary,
83
77
  "--color-primary-opacity-08": hexToRgba(theme.colors.primary, OPACITY.thin).toString(),
84
78
  "--color-primary-opacity-12": hexToRgba(theme.colors.primary, OPACITY.medium).toString(),
@@ -94,7 +88,19 @@ var Checkbox = function Checkbox(_ref) {
94
88
  "--color-error-opacity-12": hexToRgba(theme.colors.error, OPACITY.medium).toString(),
95
89
  "--color-error-opacity-20": hexToRgba(theme.colors.error, OPACITY.thicker).toString(),
96
90
  "--color-on-error": theme.colors["on-error"]
97
- }),
91
+ };
92
+ }, [theme]);
93
+ var styled = {
94
+ checkbox: _stylex.props(styles.checkbox["default"], styles.checkbox.medium, isDisabled && styles.checkbox.disabled),
95
+ layer: _stylex.props(styles.layer["default"]["default"], ripple && [styles.layer.rippleable["default"], (isChecked || indeterminate) && styles.layer.rippleable.checked, invalid && styles.layer.rippleable.invalid, isDisabled && styles.layer.rippleable.disabled]),
96
+ inputer: _stylex.props(styles.inputer["default"]["default"], isDisabled && styles.inputer["default"].disabled, (isChecked || indeterminate) && [styles.inputer.checked["default"], isDisabled && styles.inputer.checked.disabled], invalid && [styles.inputer.invalid["default"], (isChecked || indeterminate) && styles.inputer.invalid.checked, isDisabled && styles.inputer.invalid.disabled]),
97
+ input: _stylex.props(styles.input["default"]),
98
+ check: _stylex.props(styles.check["default"]),
99
+ label: _stylex.props(typography.label.small, styles.label["default"], invalid && styles.label.invalid)
100
+ };
101
+ return /*#__PURE__*/React.createElement("label", {
102
+ className: stringify(classNames.checkbox, className, styled.checkbox.className),
103
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.checkbox.style), style), styleVars),
98
104
  "aria-checked": isChecked,
99
105
  "aria-disabled": isDisabled
100
106
  }, /*#__PURE__*/React.createElement("span", {
@@ -113,9 +119,7 @@ var Checkbox = function Checkbox(_ref) {
113
119
  onChange: change,
114
120
  "aria-checked": isChecked,
115
121
  "aria-disabled": isDisabled,
116
- onClick: function onClick(e) {
117
- return e.stopPropagation();
118
- }
122
+ onClick: stopPropagation
119
123
  }), isChecked && /*#__PURE__*/React.createElement(Check, {
120
124
  className: styled.check.className,
121
125
  style: styled.check.style
@@ -9,7 +9,7 @@ var React = require('react');
9
9
  * checkbox class names
10
10
  */
11
11
  var CLASS_NAMES = {
12
- check: "checkbox",
12
+ checkbox: "checkbox",
13
13
  layer: "checkbox__layer",
14
14
  inputer: "checkbox__inputer",
15
15
  input: "checkbox__input",
@@ -4,7 +4,7 @@ import type { ContextValue } from "../../types/checkbox";
4
4
  * checkbox class names
5
5
  */
6
6
  export declare const CLASS_NAMES: {
7
- check: string;
7
+ checkbox: string;
8
8
  layer: string;
9
9
  inputer: string;
10
10
  input: string;
@@ -5,7 +5,7 @@ import { createContext } from 'react';
5
5
  * checkbox class names
6
6
  */
7
7
  var CLASS_NAMES = {
8
- check: "checkbox",
8
+ checkbox: "checkbox",
9
9
  layer: "checkbox__layer",
10
10
  inputer: "checkbox__inputer",
11
11
  input: "checkbox__input",
@@ -1,5 +1,5 @@
1
1
  import styles from "./styles";
2
- export declare const Checkbox: (({ value, className, style, children, onChange, disabled: _disabled, checked, indeterminate, ripple, invalid, defaultChecked, }: import("../../types/checkbox").CheckboxProps) => import("react").JSX.Element) & {
2
+ export declare const Checkbox: (({ value, className, style, children, onChange, disabled, checked, indeterminate, ripple, invalid, defaultChecked, }: import("../../types/checkbox").CheckboxProps) => import("react").JSX.Element) & {
3
3
  Group: ({ value: controlledValue, children, onChange, disabled, }: import("../../types/checkbox").CheckboxGroupProps) => import("react").JSX.Element;
4
4
  };
5
5
  export { styles };
@@ -10,7 +10,6 @@ var column = require('./column.cjs');
10
10
  var className = require('@aiszlab/relax/class-name');
11
11
  var divider = require('../divider/divider.cjs');
12
12
  var context = require('./context.cjs');
13
- var hooks = require('../theme/hooks.cjs');
14
13
 
15
14
  var Clock = function Clock(_ref) {
16
15
  var value = _ref.value,
@@ -22,17 +21,13 @@ var Clock = function Clock(_ref) {
22
21
  className: "musaex-78zum5 musaex-1m3v4wt musaex-5xj0sk"
23
22
  };
24
23
  var columns = ["hour", "minute", "second"];
25
- var theme = hooks.useTheme();
26
24
  return /*#__PURE__*/React.createElement(context.Context.Provider, {
27
25
  value: {
28
26
  classNames: classNames
29
27
  }
30
28
  }, /*#__PURE__*/React.createElement("div", {
31
29
  className: className.stringify(classNames.clock, className$1, styled.className),
32
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), style), {}, {
33
- // @ts-expect-error style vars
34
- "--color-secondary": theme.colors.secondary
35
- })
30
+ style: _objectSpread(_objectSpread({}, styled.style), style)
36
31
  }, columns.map(function (unit, index) {
37
32
  return [/*#__PURE__*/React.createElement(column.default, {
38
33
  unit: unit,
@@ -6,7 +6,6 @@ import Column from './column.mjs';
6
6
  import { stringify } from '@aiszlab/relax/class-name';
7
7
  import Divider from '../divider/divider.mjs';
8
8
  import { Context, CLASS_NAMES } from './context.mjs';
9
- import { useTheme } from '../theme/hooks.mjs';
10
9
 
11
10
  var Clock = function Clock(_ref) {
12
11
  var value = _ref.value,
@@ -18,17 +17,13 @@ var Clock = function Clock(_ref) {
18
17
  className: "musaex-78zum5 musaex-1m3v4wt musaex-5xj0sk"
19
18
  };
20
19
  var columns = ["hour", "minute", "second"];
21
- var theme = useTheme();
22
20
  return /*#__PURE__*/React.createElement(Context.Provider, {
23
21
  value: {
24
22
  classNames: classNames
25
23
  }
26
24
  }, /*#__PURE__*/React.createElement("div", {
27
25
  className: stringify(classNames.clock, className, styled.className),
28
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), style), {}, {
29
- // @ts-expect-error style vars
30
- "--color-secondary": theme.colors.secondary
31
- })
26
+ style: _objectSpread(_objectSpread({}, styled.style), style)
32
27
  }, columns.map(function (unit, index) {
33
28
  return [/*#__PURE__*/React.createElement(Column, {
34
29
  unit: unit,
@@ -2,19 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
5
6
  var React = require('react');
6
7
  var menu = require('../menu/menu.cjs');
7
8
  var relax = require('@aiszlab/relax');
9
+ var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.10.1/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
8
10
  var hooks = require('../theme/hooks.cjs');
9
11
  var className = require('@aiszlab/relax/class-name');
10
12
  var context = require('./context.cjs');
13
+ var theme = require('../theme/theme.cjs');
11
14
 
12
15
  var UNITS = {
13
16
  hour: 24,
14
17
  minute: 60,
15
18
  second: 60
16
19
  };
17
- var Column = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
20
+ var styles = {
21
+ menu: {
22
+ overflowX: "musaex-6ikm8r",
23
+ overflowY: "musaex-10wlt62 musaex-r8ctv5",
24
+ width: "musaex-17vrh6f",
25
+ marginBlock: "musaex-1yke8k6",
26
+ marginTop: null,
27
+ marginBottom: null,
28
+ $$css: true
29
+ }
30
+ };
31
+ var Column = function Column(_ref) {
18
32
  var unit = _ref.unit,
19
33
  value = _ref.value,
20
34
  onChange = _ref.onChange;
@@ -22,24 +36,19 @@ var Column = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
22
36
  var _useContext = React.useContext(context.Context),
23
37
  classNames = _useContext.classNames;
24
38
  var menuRef = React.useRef(null);
25
- hooks.useTheme();
39
+ var theme$1 = hooks.useTheme();
26
40
  var onClick = React.useCallback(function (key) {
27
41
  var _menuRef$current;
28
42
  onChange === null || onChange === void 0 || onChange(key);
29
43
  (_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 || _menuRef$current.scrollTo(key, 100);
30
44
  }, [onChange]);
31
- React.useImperativeHandle(ref, function () {
32
- return {};
33
- }, []);
34
45
  React.useEffect(function () {
35
46
  var _menuRef$current2;
36
47
  if (relax.isVoid(value)) return;
37
- (_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 || _menuRef$current2.scrollTo(value || 0, 100);
48
+ (_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 || _menuRef$current2.scrollTo(value !== null && value !== void 0 ? value : 0, 100);
38
49
  }, [value]);
39
50
  var styled = {
40
- menu: {
41
- className: "musaex-6ikm8r musaex-10wlt62 musaex-r8ctv5 musaex-17vrh6f musaex-1yke8k6 musaex-asoihx musaex-1uowca5 musaex-11y6kk5 musaex-jc8j51"
42
- },
51
+ menu: stylex.default.props(theme.scrollbar["default"], styles.menu),
43
52
  item: {
44
53
  className: "musaex-17vrh6f musaex-78zum5 musaex-l56j7k"
45
54
  }
@@ -48,7 +57,10 @@ var Column = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
48
57
  selectedKeys: value,
49
58
  ref: menuRef,
50
59
  className: className.stringify(styled.menu.className, classNames.column),
51
- style: styled.menu.style,
60
+ style: _objectSpread(_objectSpread({}, styled.menu.style), {}, {
61
+ // @ts-expect-error style vars
62
+ "--color-scrollbar-thumb": theme$1.colors.secondary
63
+ }),
52
64
  items: Array.from(Array(timeUnit).keys()).map(function (step) {
53
65
  return {
54
66
  key: step,
@@ -59,6 +71,6 @@ var Column = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
59
71
  }),
60
72
  onClick: onClick
61
73
  });
62
- });
74
+ };
63
75
 
64
76
  exports.default = Column;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import { ColumnProps } from "../../types/clock";
3
- declare const Column: React.ForwardRefExoticComponent<ColumnProps & React.RefAttributes<{}>>;
2
+ import type { ColumnProps } from "../../types/clock";
3
+ declare const Column: ({ unit, value, onChange }: ColumnProps) => React.JSX.Element;
4
4
  export default Column;
@@ -1,16 +1,30 @@
1
- import React, { forwardRef, useContext, useRef, useCallback, useImperativeHandle, useEffect } from 'react';
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import React, { useContext, useRef, useCallback, useEffect } from 'react';
2
3
  import Menu from '../menu/menu.mjs';
3
4
  import { isVoid } from '@aiszlab/relax';
5
+ import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.10.1/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
4
6
  import { useTheme } from '../theme/hooks.mjs';
5
7
  import { stringify } from '@aiszlab/relax/class-name';
6
8
  import { Context } from './context.mjs';
9
+ import { scrollbar } from '../theme/theme.mjs';
7
10
 
8
11
  var UNITS = {
9
12
  hour: 24,
10
13
  minute: 60,
11
14
  second: 60
12
15
  };
13
- var Column = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
+ var styles = {
17
+ menu: {
18
+ overflowX: "musaex-6ikm8r",
19
+ overflowY: "musaex-10wlt62 musaex-r8ctv5",
20
+ width: "musaex-17vrh6f",
21
+ marginBlock: "musaex-1yke8k6",
22
+ marginTop: null,
23
+ marginBottom: null,
24
+ $$css: true
25
+ }
26
+ };
27
+ var Column = function Column(_ref) {
14
28
  var unit = _ref.unit,
15
29
  value = _ref.value,
16
30
  onChange = _ref.onChange;
@@ -18,24 +32,19 @@ var Column = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
32
  var _useContext = useContext(Context),
19
33
  classNames = _useContext.classNames;
20
34
  var menuRef = useRef(null);
21
- useTheme();
35
+ var theme = useTheme();
22
36
  var onClick = useCallback(function (key) {
23
37
  var _menuRef$current;
24
38
  onChange === null || onChange === void 0 || onChange(key);
25
39
  (_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 || _menuRef$current.scrollTo(key, 100);
26
40
  }, [onChange]);
27
- useImperativeHandle(ref, function () {
28
- return {};
29
- }, []);
30
41
  useEffect(function () {
31
42
  var _menuRef$current2;
32
43
  if (isVoid(value)) return;
33
- (_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 || _menuRef$current2.scrollTo(value || 0, 100);
44
+ (_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 || _menuRef$current2.scrollTo(value !== null && value !== void 0 ? value : 0, 100);
34
45
  }, [value]);
35
46
  var styled = {
36
- menu: {
37
- className: "musaex-6ikm8r musaex-10wlt62 musaex-r8ctv5 musaex-17vrh6f musaex-1yke8k6 musaex-asoihx musaex-1uowca5 musaex-11y6kk5 musaex-jc8j51"
38
- },
47
+ menu: _stylex.props(scrollbar["default"], styles.menu),
39
48
  item: {
40
49
  className: "musaex-17vrh6f musaex-78zum5 musaex-l56j7k"
41
50
  }
@@ -44,7 +53,10 @@ var Column = /*#__PURE__*/forwardRef(function (_ref, ref) {
44
53
  selectedKeys: value,
45
54
  ref: menuRef,
46
55
  className: stringify(styled.menu.className, classNames.column),
47
- style: styled.menu.style,
56
+ style: _objectSpread(_objectSpread({}, styled.menu.style), {}, {
57
+ // @ts-expect-error style vars
58
+ "--color-scrollbar-thumb": theme.colors.secondary
59
+ }),
48
60
  items: Array.from(Array(timeUnit).keys()).map(function (step) {
49
61
  return {
50
62
  key: step,
@@ -55,6 +67,6 @@ var Column = /*#__PURE__*/forwardRef(function (_ref, ref) {
55
67
  }),
56
68
  onClick: onClick
57
69
  });
58
- });
70
+ };
59
71
 
60
72
  export { Column as default };
@@ -4,11 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
6
6
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
7
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
8
7
  var React = require('react');
9
8
  var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.10.1/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
10
9
  var relax = require('@aiszlab/relax');
11
- var framerMotion = require('framer-motion');
12
10
  var context = require('./context.cjs');
13
11
  var useExpandable = require('../../hooks/use-expandable.cjs');
14
12
  var hooks = require('../theme/hooks.cjs');
@@ -103,12 +101,9 @@ var CollapseItem = function CollapseItem(_ref) {
103
101
  toggle = _useContext.toggle,
104
102
  classNames = _useContext.classNames;
105
103
  var isExpanded = activeKeys.has(value);
106
- var _useAnimate = framerMotion.useAnimate(),
107
- _useAnimate2 = _slicedToArray(_useAnimate, 2),
108
- collapser = _useAnimate2[0],
109
- animate = _useAnimate2[1];
110
104
  var theme$1 = hooks.useTheme();
111
105
  var _useExpandable = useExpandable.useExpandable(),
106
+ ref = _useExpandable.ref,
112
107
  expand = _useExpandable.expand,
113
108
  collapse = _useExpandable.collapse;
114
109
  relax.useUpdateEffect(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -120,12 +115,12 @@ var CollapseItem = function CollapseItem(_ref) {
120
115
  break;
121
116
  }
122
117
  _context.next = 3;
123
- return expand([collapser, animate]);
118
+ return expand();
124
119
  case 3:
125
120
  return _context.abrupt("return");
126
121
  case 4:
127
122
  _context.next = 6;
128
- return collapse([collapser, animate]);
123
+ return collapse();
129
124
  case 6:
130
125
  case "end":
131
126
  return _context.stop();
@@ -157,7 +152,7 @@ var CollapseItem = function CollapseItem(_ref) {
157
152
  className: className.stringify(classNames.collapser, styled.collapser.className),
158
153
  style: styled.collapser.style
159
154
  }), label), /*#__PURE__*/React.createElement("div", {
160
- ref: collapser,
155
+ ref: ref,
161
156
  className: className.stringify(classNames.panel, isExpanded && classNames.panelActive, styled.panel.className),
162
157
  style: styled.panel.style
163
158
  }, /*#__PURE__*/React.createElement("div", {
@@ -1,10 +1,8 @@
1
1
  import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
2
2
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
3
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
3
  import React, { useContext } from 'react';
5
4
  import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.10.1/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
6
5
  import { useUpdateEffect, useEvent } from '@aiszlab/relax';
7
- import { useAnimate } from 'framer-motion';
8
6
  import { Context } from './context.mjs';
9
7
  import { useExpandable } from '../../hooks/use-expandable.mjs';
10
8
  import { useTheme } from '../theme/hooks.mjs';
@@ -99,12 +97,9 @@ var CollapseItem = function CollapseItem(_ref) {
99
97
  toggle = _useContext.toggle,
100
98
  classNames = _useContext.classNames;
101
99
  var isExpanded = activeKeys.has(value);
102
- var _useAnimate = useAnimate(),
103
- _useAnimate2 = _slicedToArray(_useAnimate, 2),
104
- collapser = _useAnimate2[0],
105
- animate = _useAnimate2[1];
106
100
  var theme = useTheme();
107
101
  var _useExpandable = useExpandable(),
102
+ ref = _useExpandable.ref,
108
103
  expand = _useExpandable.expand,
109
104
  collapse = _useExpandable.collapse;
110
105
  useUpdateEffect(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -116,12 +111,12 @@ var CollapseItem = function CollapseItem(_ref) {
116
111
  break;
117
112
  }
118
113
  _context.next = 3;
119
- return expand([collapser, animate]);
114
+ return expand();
120
115
  case 3:
121
116
  return _context.abrupt("return");
122
117
  case 4:
123
118
  _context.next = 6;
124
- return collapse([collapser, animate]);
119
+ return collapse();
125
120
  case 6:
126
121
  case "end":
127
122
  return _context.stop();
@@ -153,7 +148,7 @@ var CollapseItem = function CollapseItem(_ref) {
153
148
  className: stringify(classNames.collapser, styled.collapser.className),
154
149
  style: styled.collapser.style
155
150
  }), label), /*#__PURE__*/React.createElement("div", {
156
- ref: collapser,
151
+ ref: ref,
157
152
  className: stringify(classNames.panel, isExpanded && classNames.panelActive, styled.panel.className),
158
153
  style: styled.panel.style
159
154
  }, /*#__PURE__*/React.createElement("div", {