@arcblock/ux 2.5.58 → 2.5.60

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 (135) hide show
  1. package/lib/ActionButton/index.js +20 -39
  2. package/lib/ActivityIndicator/index.js +20 -41
  3. package/lib/Address/compact-text.js +16 -38
  4. package/lib/Address/did-address.js +22 -51
  5. package/lib/Address/index.js +6 -19
  6. package/lib/Address/responsive-did-address.js +20 -36
  7. package/lib/Alert/index.js +12 -34
  8. package/lib/AnimationWaiter/index.js +35 -59
  9. package/lib/Async/index.js +5 -19
  10. package/lib/Avatar/did-motif.js +12 -26
  11. package/lib/Avatar/etherscan-blockies.js +2 -20
  12. package/lib/Avatar/index.js +28 -54
  13. package/lib/Badge/index.js +12 -33
  14. package/lib/Blocklet/blocklet.js +20 -47
  15. package/lib/Blocklet/index.js +0 -6
  16. package/lib/Blocklet/utils.js +0 -6
  17. package/lib/BlockletNFT/index.js +37 -67
  18. package/lib/Button/index.js +0 -4
  19. package/lib/Button/wrap.js +19 -38
  20. package/lib/ButtonGroup/index.js +0 -5
  21. package/lib/CardSelector/index.js +9 -22
  22. package/lib/Center/index.js +2 -12
  23. package/lib/ClickToCopy/copy-button.js +9 -26
  24. package/lib/ClickToCopy/hook.js +0 -10
  25. package/lib/ClickToCopy/index.js +13 -41
  26. package/lib/CodeBlock/LightBox.js +1 -6
  27. package/lib/CodeBlock/index.js +12 -80
  28. package/lib/Colors/index.js +0 -2
  29. package/lib/Colors/themes/default.js +2 -3
  30. package/lib/ContactForm/index.js +5 -35
  31. package/lib/CookieConsent/index.js +10 -32
  32. package/lib/CountDown/index.js +10 -35
  33. package/lib/DID/index.js +8 -32
  34. package/lib/Datatable/CustomToolbar.js +9 -56
  35. package/lib/Datatable/DatatableContext.js +2 -5
  36. package/lib/Datatable/TableSearch.js +0 -21
  37. package/lib/Datatable/index.js +76 -152
  38. package/lib/Datatable/utils.js +14 -27
  39. package/lib/Dialog/confirm.js +18 -31
  40. package/lib/Dialog/dialog.js +24 -50
  41. package/lib/Dialog/index.js +0 -3
  42. package/lib/DidLogo/index.js +0 -7
  43. package/lib/DriftBot/index.js +1 -12
  44. package/lib/Earth/index.js +17 -58
  45. package/lib/Earth/util.js +0 -7
  46. package/lib/Empty/index.js +9 -23
  47. package/lib/ErrorBoundary/fallback.js +0 -14
  48. package/lib/ErrorBoundary/index.js +0 -2
  49. package/lib/Footer/index.js +1 -14
  50. package/lib/Header/auto-hidden.js +9 -23
  51. package/lib/Header/header.js +19 -38
  52. package/lib/Header/index.js +0 -3
  53. package/lib/Header/responsive-header.js +16 -40
  54. package/lib/Icon/image.js +12 -26
  55. package/lib/Icon/index.js +15 -34
  56. package/lib/Img/index.js +32 -54
  57. package/lib/InfoRow/index.js +11 -27
  58. package/lib/Layout/dashboard/external-link.js +13 -30
  59. package/lib/Layout/dashboard/full-page.js +8 -24
  60. package/lib/Layout/dashboard/index.js +28 -72
  61. package/lib/Layout/dashboard/sidebar.js +11 -31
  62. package/lib/Layout/dashboard-legacy/header.js +14 -36
  63. package/lib/Layout/dashboard-legacy/index.js +19 -44
  64. package/lib/Layout/dashboard-legacy/sidebar.js +10 -32
  65. package/lib/Layout/index.js +18 -52
  66. package/lib/Locale/browser-lang.js +6 -19
  67. package/lib/Locale/context.js +15 -51
  68. package/lib/Locale/languages.js +3 -7
  69. package/lib/Locale/selector.js +11 -44
  70. package/lib/Locale/util.js +0 -10
  71. package/lib/Logo/index.js +10 -33
  72. package/lib/Metric/index.js +1 -9
  73. package/lib/NFTDisplay/aspect-ratio-container.js +7 -20
  74. package/lib/NFTDisplay/broken.js +0 -8
  75. package/lib/NFTDisplay/index.js +63 -110
  76. package/lib/NFTDisplay/loading.js +0 -6
  77. package/lib/NFTDisplay/svg-embedder/img.js +9 -22
  78. package/lib/NFTDisplay/svg-embedder/inline-svg.js +9 -23
  79. package/lib/NavMenu/index.js +0 -2
  80. package/lib/NavMenu/nav-menu.js +40 -69
  81. package/lib/NavMenu/style.js +1 -5
  82. package/lib/PageScroller/index.js +9 -39
  83. package/lib/PageScroller/story/FifthComponent.js +0 -2
  84. package/lib/PageScroller/story/FirstComponent.js +0 -2
  85. package/lib/PageScroller/story/FourthComponent.js +0 -2
  86. package/lib/PageScroller/story/FullPage.js +1 -14
  87. package/lib/PageScroller/story/PageContain.js +1 -14
  88. package/lib/PageScroller/story/SecondComponent.js +0 -2
  89. package/lib/PageScroller/story/ThirdComponent.js +0 -2
  90. package/lib/PageScroller/usePrevValue.js +1 -2
  91. package/lib/PricingTable/PricingPlan.js +0 -12
  92. package/lib/PricingTable/index.js +0 -14
  93. package/lib/QRCode/index.js +14 -24
  94. package/lib/RelativeTime/index.js +12 -45
  95. package/lib/Result/common.js +43 -63
  96. package/lib/Result/index.js +6 -23
  97. package/lib/Result/result.js +9 -23
  98. package/lib/Screenshot/BaseScreenshot/index.js +9 -26
  99. package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +9 -10
  100. package/lib/Screenshot/BaseScreenshot/shells/Phone.js +3 -8
  101. package/lib/Screenshot/index.js +32 -65
  102. package/lib/SessionManager/federated-login-detecter.js +171 -0
  103. package/lib/SessionManager/index.js +189 -271
  104. package/lib/SessionManager/user-popper.js +83 -0
  105. package/lib/Sparkline/index.js +40 -42
  106. package/lib/Spinner/index.js +12 -23
  107. package/lib/SplitButton/index.js +20 -48
  108. package/lib/Switch/index.js +7 -22
  109. package/lib/Tabs/index.js +8 -22
  110. package/lib/Tag/index.js +13 -33
  111. package/lib/TextCollapse/index.js +14 -31
  112. package/lib/Theme/index.js +3 -13
  113. package/lib/Theme/theme-provider.js +1 -10
  114. package/lib/Theme/theme.js +15 -27
  115. package/lib/Toast/index.js +13 -40
  116. package/lib/Util/deprecate.js +3 -12
  117. package/lib/Util/index.js +13 -74
  118. package/lib/Util/wallet.js +3 -10
  119. package/lib/Video/index.js +3 -19
  120. package/lib/Wallet/Action.js +9 -28
  121. package/lib/Wallet/Download.js +11 -36
  122. package/lib/Wallet/Open.js +0 -12
  123. package/lib/WebWalletSWKeeper/index.js +30 -55
  124. package/lib/WechatPrompt/index.js +0 -16
  125. package/lib/index.js +0 -38
  126. package/lib/withTheme/index.js +3 -15
  127. package/lib/withTracker/error_boundary.js +3 -14
  128. package/lib/withTracker/index.js +3 -24
  129. package/package.json +5 -5
  130. package/src/Blocklet/blocklet.js +1 -1
  131. package/src/BlockletNFT/index.js +1 -1
  132. package/src/NFTDisplay/index.js +4 -4
  133. package/src/SessionManager/federated-login-detecter.jsx +138 -0
  134. package/src/SessionManager/index.jsx +140 -233
  135. package/src/SessionManager/user-popper.jsx +121 -0
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = UserPopper;
7
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _material = require("@mui/material");
9
+ var _Theme = require("../Theme");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ var _templateObject;
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
14
+ function UserPopper(_ref) {
15
+ let {
16
+ anchorEl,
17
+ dark,
18
+ children,
19
+ open,
20
+ onClose
21
+ } = _ref;
22
+ return anchorEl && /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopper, {
23
+ open: open,
24
+ disablePortal: true,
25
+ anchorEl: anchorEl,
26
+ placement: "bottom-end",
27
+ $dark: dark,
28
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Paper, {
29
+ sx: [theme => ({
30
+ borderColor: '#F0F0F0',
31
+ boxShadow: '0px 8px 12px rgba(92, 92, 92, 0.04)',
32
+ borderRadius: theme.spacing(2),
33
+ overflow: 'hidden',
34
+ maxWidth: 'calc(100vw - 10px)',
35
+ '& .MuiChip-root .MuiChip-icon': {
36
+ color: theme.palette.success.main
37
+ }
38
+ }), dark && {
39
+ backgroundColor: '#27282c',
40
+ color: '#fff',
41
+ border: 0,
42
+ '& .MuiChip-root': {
43
+ borderColor: '#aaa'
44
+ },
45
+ '& .MuiListItem-root, & .MuiChip-label': {
46
+ color: '#aaa'
47
+ },
48
+ '& .MuiListItem-root:hover': {
49
+ backgroundColor: '#363434'
50
+ }
51
+ }],
52
+ variant: "outlined",
53
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ClickAwayListener, {
54
+ onClickAway: onClose,
55
+ children: children
56
+ })
57
+ })
58
+ });
59
+ }
60
+ UserPopper.propTypes = {
61
+ anchorEl: _propTypes.default.instanceOf(Element),
62
+ dark: _propTypes.default.bool,
63
+ open: _propTypes.default.bool,
64
+ children: _propTypes.default.any.isRequired,
65
+ onClose: _propTypes.default.func
66
+ };
67
+ UserPopper.defaultProps = {
68
+ anchorEl: null,
69
+ dark: false,
70
+ open: false,
71
+ onClose: () => {}
72
+ };
73
+ const StyledPopper = (0, _Theme.styled)(_material.Popper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: ", ";\n .MuiList-root {\n /* HACK: \u9700\u8981288px \u624D\u80FD\u5C06 did \u5C55\u793A\u5B8C\u6574 */\n width: 290px;\n }\n .session-manager-user {\n font-size: 12px;\n flex-direction: column;\n align-items: flex-start;\n padding: 24px 24px 10px;\n }\n .session-manager-user-name {\n font-size: 20px;\n color: ", ";\n font-weight: bold;\n margin-bottom: 10px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .session-manager-id-item {\n position: relative;\n padding-left: 8px;\n /* HACK: \u5F53\u524D\u5143\u7D20\u65E2\u662F\u7B2C\u4E00\u4E2A\uFF0C\u4E5F\u662F\u6700\u540E\u4E00\u4E2A\uFF0C\u5373\u53EA\u6709\u4E00\u4E2A\u540C\u7EA7\u5143\u7D20 */\n &:first-of-type:last-of-type {\n padding-left: 0;\n &:before,\n &:after {\n content: unset;\n }\n }\n &:before {\n position: absolute;\n content: '';\n left: 0px;\n top: 50%;\n width: 6px;\n height: 1px;\n background-color: #aeaeae;\n }\n &:not(:last-of-type):after {\n position: absolute;\n content: '';\n left: 0px;\n top: 50%;\n height: 100%;\n width: 1px;\n background-color: #aeaeae;\n }\n }\n .session-manager-menu-item {\n padding: 18.5px 24px;\n color: #777;\n font-size: 16px;\n &:hover {\n background-color: #fbfbfb;\n }\n }\n .session-manager-menu-icon {\n color: #999;\n margin-right: 16px;\n }\n"])), _ref2 => {
74
+ let {
75
+ theme
76
+ } = _ref2;
77
+ return theme.zIndex.tooltip;
78
+ }, _ref3 => {
79
+ let {
80
+ $dark
81
+ } = _ref3;
82
+ return $dark ? '#aaa' : '#222';
83
+ });
@@ -4,43 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = sparkline;
7
-
8
7
  /* eslint-disable guard-for-in */
9
-
10
8
  /* eslint-disable no-restricted-syntax */
11
9
  // origin: https://github.com/fnando/sparkline
12
10
  function getY(max, height, diff, value) {
13
11
  return parseFloat((height - value * height / max + diff).toFixed(2));
14
12
  }
15
-
16
13
  function removeChildren(svg) {
17
14
  [...svg.querySelectorAll('*')].forEach(element => svg.removeChild(element));
18
15
  }
19
-
20
16
  function defaultFetch(entry) {
21
17
  return entry.value;
22
18
  }
23
-
24
19
  function buildElement(tag, attrs) {
25
20
  const element = document.createElementNS('http://www.w3.org/2000/svg', tag);
26
-
27
21
  for (const name in attrs) {
28
22
  element.setAttribute(name, attrs[name]);
29
23
  }
30
-
31
24
  return element;
32
25
  }
33
-
34
26
  function sparkline(svg, entries, options) {
35
27
  removeChildren(svg);
36
-
37
28
  if (entries.length <= 1) {
38
29
  return;
39
- } // eslint-disable-next-line no-param-reassign
40
-
30
+ }
41
31
 
32
+ // eslint-disable-next-line no-param-reassign
42
33
  options = options || {};
43
-
44
34
  if (typeof entries[0] === 'number') {
45
35
  // eslint-disable-next-line no-param-reassign
46
36
  entries = entries.map(entry => {
@@ -48,58 +38,74 @@ function sparkline(svg, entries, options) {
48
38
  value: entry
49
39
  };
50
40
  });
51
- } // This function will be called whenever the mouse moves
41
+ }
42
+
43
+ // This function will be called whenever the mouse moves
52
44
  // over the SVG. You can use it to render something like a
53
45
  // tooltip.
54
-
55
-
56
46
  const {
57
47
  onmousemove
58
- } = options; // This function will be called whenever the mouse leaves
59
- // the SVG area. You can use it to hide the tooltip.
48
+ } = options;
60
49
 
50
+ // This function will be called whenever the mouse leaves
51
+ // the SVG area. You can use it to hide the tooltip.
61
52
  const {
62
53
  onmouseout
63
- } = options; // Should we run in interactive mode? If yes, this will handle the
64
- // cursor and spot position when moving the mouse.
54
+ } = options;
65
55
 
66
- const interactive = 'interactive' in options ? options.interactive : !!onmousemove; // Define how big should be the spot area.
56
+ // Should we run in interactive mode? If yes, this will handle the
57
+ // cursor and spot position when moving the mouse.
58
+ const interactive = 'interactive' in options ? options.interactive : !!onmousemove;
67
59
 
60
+ // Define how big should be the spot area.
68
61
  const spotRadius = options.spotRadius || 2;
69
- const spotDiameter = spotRadius * 2; // Define how wide should be the cursor area.
62
+ const spotDiameter = spotRadius * 2;
63
+
64
+ // Define how wide should be the cursor area.
65
+ const cursorWidth = options.cursorWidth || 2;
70
66
 
71
- const cursorWidth = options.cursorWidth || 2; // Get the stroke width; this is used to compute the
67
+ // Get the stroke width; this is used to compute the
72
68
  // rendering offset.
69
+ const strokeWidth = parseFloat(svg.attributes['stroke-width'].value);
73
70
 
74
- const strokeWidth = parseFloat(svg.attributes['stroke-width'].value); // By default, data must be formatted as an array of numbers or
71
+ // By default, data must be formatted as an array of numbers or
75
72
  // an array of objects with the value key (like `[{value: 1}]`).
76
73
  // You can set a custom function to return data for a different
77
74
  // data structure.
75
+ const fetch = options.fetch || defaultFetch;
78
76
 
79
- const fetch = options.fetch || defaultFetch; // Retrieve only values, easing the find for the maximum value.
77
+ // Retrieve only values, easing the find for the maximum value.
78
+ const values = entries.map(entry => fetch(entry));
80
79
 
81
- const values = entries.map(entry => fetch(entry)); // The rendering width will account for the spot size.
80
+ // The rendering width will account for the spot size.
81
+ const width = parseFloat(svg.attributes.width.value) - spotDiameter * 2;
82
82
 
83
- const width = parseFloat(svg.attributes.width.value) - spotDiameter * 2; // Get the SVG element's full height.
83
+ // Get the SVG element's full height.
84
84
  // This is used
85
+ const fullHeight = parseFloat(svg.attributes.height.value);
85
86
 
86
- const fullHeight = parseFloat(svg.attributes.height.value); // The rendering height accounts for stroke width and spot size.
87
+ // The rendering height accounts for stroke width and spot size.
88
+ const height = fullHeight - strokeWidth * 2 - spotDiameter;
87
89
 
88
- const height = fullHeight - strokeWidth * 2 - spotDiameter; // The maximum value. This is used to calculate the Y coord of
90
+ // The maximum value. This is used to calculate the Y coord of
89
91
  // each sparkline datapoint.
92
+ const max = Math.max(...values) === 0 ? 1 : Math.max(...values);
90
93
 
91
- const max = Math.max(...values) === 0 ? 1 : Math.max(...values); // Some arbitrary value to remove the cursor and spot out of
94
+ // Some arbitrary value to remove the cursor and spot out of
92
95
  // the viewing canvas.
96
+ const offscreen = -1000;
93
97
 
94
- const offscreen = -1000; // Cache the last item index.
98
+ // Cache the last item index.
99
+ const lastItemIndex = values.length - 1;
95
100
 
96
- const lastItemIndex = values.length - 1; // Calculate the X coord base step.
101
+ // Calculate the X coord base step.
102
+ const offset = width / lastItemIndex;
97
103
 
98
- const offset = width / lastItemIndex; // Hold all datapoints, which is whatever we got as the entry plus
104
+ // Hold all datapoints, which is whatever we got as the entry plus
99
105
  // x/y coords and the index.
106
+ const datapoints = [];
100
107
 
101
- const datapoints = []; // Hold the line coordinates.
102
-
108
+ // Hold the line coordinates.
103
109
  const pathY = getY(max, height, strokeWidth + spotRadius, values[0]);
104
110
  let pathCoords = "M".concat(spotDiameter, " ").concat(pathY);
105
111
  values.forEach((value, index) => {
@@ -125,11 +131,9 @@ function sparkline(svg, entries, options) {
125
131
  });
126
132
  svg.appendChild(fill);
127
133
  svg.appendChild(path);
128
-
129
134
  if (!interactive) {
130
135
  return;
131
136
  }
132
-
133
137
  const cursor = buildElement('line', {
134
138
  class: 'sparkline--cursor',
135
139
  x1: offscreen,
@@ -157,7 +161,6 @@ function sparkline(svg, entries, options) {
157
161
  cursor.setAttribute('x1', offscreen);
158
162
  cursor.setAttribute('x2', offscreen);
159
163
  spot.setAttribute('cx', offscreen);
160
-
161
164
  if (onmouseout) {
162
165
  onmouseout(event);
163
166
  }
@@ -167,22 +170,18 @@ function sparkline(svg, entries, options) {
167
170
  let nextDataPoint = datapoints.find(entry => {
168
171
  return entry.x >= mouseX;
169
172
  });
170
-
171
173
  if (!nextDataPoint) {
172
174
  nextDataPoint = datapoints[lastItemIndex];
173
175
  }
174
-
175
176
  const previousDataPoint = datapoints[datapoints.indexOf(nextDataPoint) - 1];
176
177
  let currentDataPoint;
177
178
  let halfway;
178
-
179
179
  if (previousDataPoint) {
180
180
  halfway = previousDataPoint.x + (nextDataPoint.x - previousDataPoint.x) / 2;
181
181
  currentDataPoint = mouseX >= halfway ? nextDataPoint : previousDataPoint;
182
182
  } else {
183
183
  currentDataPoint = nextDataPoint;
184
184
  }
185
-
186
185
  const {
187
186
  x
188
187
  } = currentDataPoint;
@@ -193,7 +192,6 @@ function sparkline(svg, entries, options) {
193
192
  spot.setAttribute('cy', y);
194
193
  cursor.setAttribute('x1', x);
195
194
  cursor.setAttribute('x2', x);
196
-
197
195
  if (onmousemove) {
198
196
  onmousemove(event, currentDataPoint);
199
197
  }
@@ -4,43 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
9
-
10
8
  var _deprecate = require("../Util/deprecate");
11
-
12
9
  var _jsxRuntime = require("react/jsx-runtime");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
-
18
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
-
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
-
22
- /**
23
- * Spinner
24
- *
25
- * 之前的 Spinner 实现由内外 2 个环构成, 现在改为基于 @mui/material/CircularProgress 的实现
26
- *
27
- * - 之前 size prop array 类型, 需要与 CircularProgress#size 兼容
28
- * - color 默认使用 #4598fa, 如果调用方传入了 color prop 或 style#color, 则默认 color 被覆盖
29
- */
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
16
+ * Spinner
17
+ *
18
+ * 之前的 Spinner 实现由内外 2 个环构成, 现在改为基于 @mui/material/CircularProgress 的实现
19
+ *
20
+ * - 之前 size prop 是 array 类型, 需要与 CircularProgress#size 兼容
21
+ * - color 默认使用 #4598fa, 如果调用方传入了 color prop style#color, 则默认 color 被覆盖
22
+ */
30
23
  function Spinner(props) {
31
- const _props = _objectSpread({}, props); // 兼容之前的 size prop (设置外圈/内圈的尺寸)
32
-
33
-
24
+ const _props = _objectSpread({}, props);
25
+ // 兼容之前的 size prop (设置外圈/内圈的尺寸)
34
26
  if (_props.size && Array.isArray(_props.size)) {
35
27
  [_props.size] = _props.size;
36
28
  }
37
-
38
29
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, _objectSpread({}, _props));
39
30
  }
40
-
41
31
  var _default = (0, _deprecate.withDeprecated)(Spinner, {
42
32
  name: 'Spinner',
43
33
  alternative: '@mui/material/CircularProgress'
44
34
  });
45
-
46
35
  exports.default = _default;
@@ -4,49 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = SplitButton;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
13
-
14
10
  var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
15
-
16
11
  var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
17
-
18
12
  var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAwayListener"));
19
-
20
13
  var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
21
-
22
14
  var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
23
-
24
15
  var _ButtonGroup = _interopRequireDefault(require("@mui/material/ButtonGroup"));
25
-
26
16
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
27
-
28
17
  var _Theme = require("../Theme");
29
-
30
18
  var _jsxRuntime = require("react/jsx-runtime");
31
-
32
19
  var _templateObject, _templateObject2;
33
-
34
20
  const _excluded = ["size", "color", "menu", "children", "variant", "onClick", "menuButtonProps"];
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
39
-
40
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
41
-
42
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43
-
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
47
-
48
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
49
-
50
21
  /**
51
22
  * SplitButton 组件 Props
52
23
  * @typedef {{
@@ -59,51 +30,54 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
59
30
  * menuButtonProps?: import('@mui/material').ButtonProps;
60
31
  * } & import('@mui/material').ButtonGroupProps } SplitButtonProps
61
32
  */
62
-
63
33
  /**
64
34
  * @description SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
65
35
  * @export
66
36
  * @param {SplitButtonProps} props
67
37
  * @return {JSX.Element}
68
38
  */
39
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
41
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
42
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
45
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
46
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
47
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
69
48
  function SplitButton(props) {
70
49
  const {
71
- size,
72
- color,
73
- menu,
74
- children,
75
- variant,
76
- onClick,
77
- menuButtonProps
78
- } = props,
79
- rest = _objectWithoutProperties(props, _excluded);
80
-
50
+ size,
51
+ color,
52
+ menu,
53
+ children,
54
+ variant,
55
+ onClick,
56
+ menuButtonProps
57
+ } = props,
58
+ rest = _objectWithoutProperties(props, _excluded);
81
59
  const [open, setOpen] = (0, _react.useState)(false);
82
60
  const anchorRef = (0, _react.useRef)(null);
83
61
  const menuItems = Array.isArray(menu) ? menu.map((item, index) => /*#__PURE__*/(0, _react.isValidElement)(item) ? item : /*#__PURE__*/(0, _react.createElement)(_MenuItem.default, _objectSpread(_objectSpread({}, item), {}, {
84
62
  key: index
85
63
  }))) // eslint-disable-line react/no-array-index-key
86
64
  : menu;
87
-
88
65
  const onToggle = () => {
89
66
  setOpen(prevOpen => !prevOpen);
90
67
  };
91
-
92
68
  const handleClose = e => {
93
69
  if (anchorRef.current && anchorRef.current.contains(e.target)) {
94
70
  return;
95
71
  }
96
-
97
72
  setOpen(false);
98
- }; // 点击 item 后收起下拉菜单, 如果想要点击 action 后不收起下拉菜单, 可以在 item#onClick 时调用 e.stopPropagation()
99
-
73
+ };
100
74
 
75
+ // 点击 item 后收起下拉菜单, 如果想要点击 action 后不收起下拉菜单, 可以在 item#onClick 时调用 e.stopPropagation()
101
76
  const handleItemClick = e => {
102
77
  if (e.target.closest('.MuiMenuItem-root')) {
103
78
  setOpen(false);
104
79
  }
105
80
  };
106
-
107
81
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
108
82
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledButtonGroup, _objectSpread(_objectSpread({
109
83
  variant: variant,
@@ -139,7 +113,6 @@ function SplitButton(props) {
139
113
  })]
140
114
  });
141
115
  }
142
-
143
116
  SplitButton.propTypes = {
144
117
  size: _propTypes.default.oneOf(['small', 'medium', 'large']),
145
118
  color: _propTypes.default.oneOf(['primary', 'secondary', 'inherit']),
@@ -162,7 +135,6 @@ SplitButton.defaultProps = {
162
135
  /**
163
136
  * @type {import('@mui/material').MenuItem}
164
137
  */
165
-
166
138
  SplitButton.Item = _MenuItem.default;
167
139
  const StyledButtonGroup = (0, _Theme.styled)(_ButtonGroup.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n > .MuiButtonBase-root:last-of-type {\n min-width: 2em;\n padding-left: 0;\n padding-right: 0;\n }\n"])));
168
140
  const StyledPopper = (0, _Theme.styled)(_Popper.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: ", ";\n .MuiList-root {\n padding: 4px 0;\n }\n .MuiListItem-root {\n padding-top: 4px;\n padding-bottom: 4px;\n }\n"])), props => props.theme.zIndex.tooltip);
@@ -4,32 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
8
  var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
11
-
12
9
  var _Switch = _interopRequireDefault(require("@mui/material/Switch"));
13
-
14
10
  var _Theme = require("../Theme");
15
-
16
11
  var _jsxRuntime = require("react/jsx-runtime");
17
-
18
12
  const _excluded = ["labelProps"];
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
-
24
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
-
26
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
-
28
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
-
30
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
-
32
- // 参考: https://mui.com/material-ui/react-switch/#customization
18
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // 参考: https://mui.com/material-ui/react-switch/#customization
33
21
  const IOSSwitch = (0, _Theme.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Switch.default, _objectSpread({
34
22
  focusVisibleClassName: ".Mui-focusVisible",
35
23
  disableRipple: true
@@ -83,6 +71,7 @@ const IOSSwitch = (0, _Theme.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(
83
71
  }
84
72
  };
85
73
  });
74
+
86
75
  /**
87
76
  * Switch 组件 Props
88
77
  * @typedef {{
@@ -97,22 +86,18 @@ const IOSSwitch = (0, _Theme.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(
97
86
  * @param {SwitchProps} props
98
87
  * @returns {JSX.Element}
99
88
  */
100
-
101
89
  function Switch(_ref2) {
102
90
  let {
103
- labelProps
104
- } = _ref2,
105
- rest = _objectWithoutProperties(_ref2, _excluded);
106
-
91
+ labelProps
92
+ } = _ref2,
93
+ rest = _objectWithoutProperties(_ref2, _excluded);
107
94
  if (labelProps) {
108
95
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, _objectSpread({
109
96
  control: /*#__PURE__*/(0, _jsxRuntime.jsx)(IOSSwitch, _objectSpread({}, rest))
110
97
  }, labelProps));
111
98
  }
112
-
113
99
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(IOSSwitch, _objectSpread({}, rest));
114
100
  }
115
-
116
101
  Switch.propTypes = {
117
102
  labelProps: _propTypes.default.object
118
103
  };
package/lib/Tabs/index.js CHANGED
@@ -4,31 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Tabs;
7
-
8
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
8
  var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
11
-
12
9
  var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
13
-
14
10
  var _Theme = require("../Theme");
15
-
16
11
  var _jsxRuntime = require("react/jsx-runtime");
17
-
18
12
  const _excluded = ["tabs", "current", "onChange"];
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
28
19
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
-
30
20
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
-
32
21
  const PREFIX = 'index';
33
22
  const classes = {
34
23
  tabs: "".concat(PREFIX, "-tabs"),
@@ -48,15 +37,13 @@ const StyledMuiTabs = (0, _Theme.styled)(_Tabs.default)(_ref => {
48
37
  }
49
38
  };
50
39
  });
51
-
52
40
  function Tabs(_ref2) {
53
41
  let {
54
- tabs,
55
- current,
56
- onChange: _onChange
57
- } = _ref2,
58
- rest = _objectWithoutProperties(_ref2, _excluded);
59
-
42
+ tabs,
43
+ current,
44
+ onChange: _onChange
45
+ } = _ref2,
46
+ rest = _objectWithoutProperties(_ref2, _excluded);
60
47
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMuiTabs, _objectSpread(_objectSpread({
61
48
  scrollButtons: "auto",
62
49
  variant: "scrollable",
@@ -73,7 +60,6 @@ function Tabs(_ref2) {
73
60
  }, x.value))
74
61
  }));
75
62
  }
76
-
77
63
  Tabs.propTypes = {
78
64
  tabs: _propTypes.default.array.isRequired,
79
65
  current: _propTypes.default.string.isRequired,