@easyv/react-components 0.0.31 → 0.0.33
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.
- package/dist/Menu/index.d.ts +5 -5
- package/dist/Menu/index.js +4 -1
- package/dist/Tabs/index.less +14 -10
- package/dist/Tabs/interface.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useTheme.d.ts +1 -0
- package/dist/hooks/useTheme.js +41 -0
- package/dist/util/util.d.ts +1 -0
- package/dist/util/util.js +3 -0
- package/package.json +1 -1
package/dist/Menu/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { MenuProps } from './interface';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare const XMenu:
|
|
5
|
-
Item:
|
|
4
|
+
declare const XMenu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<unknown>> & {
|
|
5
|
+
Item: import("react").ForwardRefExoticComponent<import("@arco-design/web-react").MenuItemProps & import("react").RefAttributes<unknown>> & {
|
|
6
6
|
menuType: string;
|
|
7
7
|
};
|
|
8
|
-
ItemGroup:
|
|
8
|
+
ItemGroup: import("react").ForwardRefExoticComponent<import("@arco-design/web-react").MenuItemGroupProps & import("react").RefAttributes<unknown>> & {
|
|
9
9
|
menuType: string;
|
|
10
10
|
};
|
|
11
|
-
SubMenu:
|
|
11
|
+
SubMenu: import("react").ForwardRefExoticComponent<import("@arco-design/web-react").MenuSubMenuProps & import("react").RefAttributes<unknown>> & {
|
|
12
12
|
menuType: string;
|
|
13
13
|
};
|
|
14
14
|
__ARCO_MENU__: boolean;
|
package/dist/Menu/index.js
CHANGED
|
@@ -4,15 +4,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
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); }
|
|
7
|
-
import
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
8
|
import { Menu } from '@arco-design/web-react';
|
|
9
9
|
import { DownOutlined, RightOutlined } from '@easyv/react-icons';
|
|
10
10
|
import "./index.less";
|
|
11
|
+
import { useTheme } from "../hooks/useTheme";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
var XMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
14
|
+
var theme = useTheme();
|
|
13
15
|
return /*#__PURE__*/_jsx(Menu, _objectSpread(_objectSpread({
|
|
14
16
|
ref: ref
|
|
15
17
|
}, props), {}, {
|
|
18
|
+
theme: theme,
|
|
16
19
|
icons: {
|
|
17
20
|
horizontalArrowDown: /*#__PURE__*/_jsx(DownOutlined, {
|
|
18
21
|
style: {
|
package/dist/Tabs/index.less
CHANGED
|
@@ -26,33 +26,37 @@
|
|
|
26
26
|
.arco-tabs-header-title-text {
|
|
27
27
|
padding: 0;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
&:first-of-type {
|
|
31
|
-
margin-left: 24px;
|
|
32
|
-
}
|
|
33
29
|
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
&.arco-tabs-horizontal {
|
|
39
|
-
.arco-tabs-header-scroll {
|
|
31
|
+
.arco-tabs-header:not(.arco-tabs-header-no-padding) {
|
|
40
32
|
.arco-tabs-header-title {
|
|
41
33
|
&:first-of-type {
|
|
42
|
-
margin-left:
|
|
34
|
+
margin-left: 24px;
|
|
43
35
|
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
44
38
|
|
|
39
|
+
.arco-tabs-header.arco-tabs-header-no-padding {
|
|
40
|
+
.arco-tabs-header-title {
|
|
45
41
|
&:nth-last-child(2) {
|
|
46
42
|
margin-right: 0;
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
}
|
|
47
|
+
}
|
|
51
48
|
|
|
49
|
+
&.arco-tabs-borderless {
|
|
52
50
|
.arco-tabs-header-nav {
|
|
53
51
|
&::before {
|
|
54
52
|
content: none;
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
}
|
|
56
|
+
|
|
57
|
+
&.arco-tabs-content-no-padding {
|
|
58
|
+
.arco-tabs-content {
|
|
59
|
+
padding-top: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
58
62
|
}
|
package/dist/Tabs/interface.d.ts
CHANGED
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTheme(): "light" | "dark";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { getTheme } from "../util/util";
|
|
9
|
+
export function useTheme() {
|
|
10
|
+
var _useState = useState(getTheme()),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
theme = _useState2[0],
|
|
13
|
+
setTheme = _useState2[1];
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
setTheme(getTheme());
|
|
16
|
+
}, []);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var observer = new MutationObserver(function (mutationsList, observer) {
|
|
19
|
+
mutationsList.forEach(function (mutation) {
|
|
20
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'arco-theme') {
|
|
21
|
+
// 处理属性变化的逻辑
|
|
22
|
+
var newTheme = mutation.target.getAttribute('arco-theme');
|
|
23
|
+
if (newTheme && ['light', 'dark'].includes(newTheme)) {
|
|
24
|
+
setTheme(newTheme);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var bodyElement = document.querySelector('body');
|
|
30
|
+
var config = {
|
|
31
|
+
attributes: true
|
|
32
|
+
};
|
|
33
|
+
if (bodyElement) {
|
|
34
|
+
observer.observe(bodyElement, config);
|
|
35
|
+
}
|
|
36
|
+
return function () {
|
|
37
|
+
observer.disconnect();
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return theme;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTheme(): any;
|