@lobehub/ui 1.2.0 → 1.3.0
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/es/ActionIcon/index.d.ts +10 -5
- package/es/ActionIcon/index.js +15 -7
- package/es/ActionIcon/style.d.ts +4 -1
- package/es/ActionIcon/style.js +5 -3
- package/es/CopyButton/index.d.ts +34 -0
- package/es/CopyButton/index.js +49 -0
- package/es/DraggablePanel/index.d.ts +4 -4
- package/es/DraggablePanel/index.js +4 -4
- package/es/DraggablePanel/style.js +2 -2
- package/es/DraggablePanel/utils.d.ts +1 -1
- package/es/EditableText/ControlInput.d.ts +9 -0
- package/es/EditableText/ControlInput.js +88 -0
- package/es/EditableText/index.d.ts +5 -0
- package/es/EditableText/index.js +35 -0
- package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
- package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
- package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
- package/es/Highlighter/index.d.ts +36 -0
- package/es/Highlighter/index.js +42 -0
- package/es/Highlighter/style.d.ts +5 -0
- package/es/Highlighter/style.js +18 -0
- package/es/Icon/index.d.ts +2 -3
- package/es/Icon/index.js +2 -2
- package/es/Logo/Divider.d.ts +3 -3
- package/es/Logo/Divider.js +6 -4
- package/es/Logo/Logo3D.d.ts +3 -3
- package/es/Logo/Logo3D.js +6 -4
- package/es/Logo/LogoFlat.d.ts +3 -3
- package/es/Logo/LogoFlat.js +6 -4
- package/es/Logo/LogoHighContrast.d.ts +3 -3
- package/es/Logo/LogoHighContrast.js +6 -4
- package/es/Logo/LogoText.d.ts +3 -3
- package/es/Logo/LogoText.js +6 -4
- package/es/Logo/index.d.ts +3 -3
- package/es/Logo/index.js +5 -5
- package/es/Logo/style.js +1 -1
- package/es/Markdown/Code.d.ts +3 -0
- package/es/Markdown/Code.js +12 -0
- package/es/Markdown/CodeBlock.d.ts +3 -0
- package/es/Markdown/CodeBlock.js +27 -0
- package/es/Markdown/index.d.ts +13 -0
- package/es/Markdown/index.js +28 -0
- package/es/Markdown/style.d.ts +4 -0
- package/es/Markdown/style.js +12 -0
- package/es/MessageInput/index.d.ts +35 -0
- package/es/MessageInput/index.js +63 -0
- package/es/SearchBar/index.d.ts +5 -0
- package/es/SearchBar/index.js +27 -0
- package/es/SideNav/index.d.ts +6 -6
- package/es/SideNav/index.js +17 -20
- package/es/SideNav/style.d.ts +1 -0
- package/es/SideNav/style.js +8 -0
- package/es/Snippet/index.d.ts +29 -0
- package/es/Snippet/index.js +39 -0
- package/es/Snippet/style.d.ts +1 -0
- package/es/Snippet/style.js +9 -0
- package/es/StroyBook/index.d.ts +3 -4
- package/es/StroyBook/index.js +14 -7
- package/es/StroyBook/style.d.ts +4 -1
- package/es/StroyBook/style.js +7 -5
- package/es/Swatches/index.d.ts +8 -0
- package/es/Swatches/index.js +44 -0
- package/es/TabsNav/index.d.ts +3 -3
- package/es/TabsNav/index.js +4 -4
- package/es/ThemeProvider/GlobalStyle.js +1 -1
- package/es/ThemeProvider/index.d.ts +15 -0
- package/es/ThemeSwitch/index.d.ts +5 -5
- package/es/ThemeSwitch/index.js +5 -9
- package/es/Tooltip/index.d.ts +5 -0
- package/es/Tooltip/index.js +20 -0
- package/es/Tooltip/style.d.ts +3 -0
- package/es/Tooltip/style.js +10 -0
- package/es/hooks/useCopied.d.ts +4 -0
- package/es/hooks/useCopied.js +26 -0
- package/es/hooks/useHighlight.d.ts +36 -0
- package/es/hooks/useHighlight.js +63 -0
- package/es/index.d.ts +9 -0
- package/es/index.js +10 -1
- package/es/styles/theme/base.d.ts +2 -0
- package/es/styles/theme/base.js +15 -0
- package/es/styles/theme/dark.js +6 -14
- package/es/styles/theme/light.js +11 -12
- package/es/types/index.d.ts +14 -5
- package/lib/ActionIcon/index.d.ts +10 -5
- package/lib/ActionIcon/index.js +39 -50
- package/lib/ActionIcon/style.d.ts +4 -1
- package/lib/ActionIcon/style.js +29 -22
- package/lib/CopyButton/index.d.ts +34 -0
- package/lib/CopyButton/index.js +70 -0
- package/lib/DraggablePanel/index.d.ts +4 -4
- package/lib/DraggablePanel/index.js +160 -158
- package/lib/DraggablePanel/style.js +1 -2
- package/lib/DraggablePanel/utils.d.ts +1 -1
- package/lib/EditableText/ControlInput.d.ts +9 -0
- package/lib/EditableText/ControlInput.js +101 -0
- package/lib/EditableText/index.d.ts +5 -0
- package/lib/EditableText/index.js +52 -0
- package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
- package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
- package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
- package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
- package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
- package/lib/Highlighter/index.d.ts +36 -0
- package/lib/Highlighter/index.js +62 -0
- package/lib/Highlighter/style.d.ts +5 -0
- package/lib/Highlighter/style.js +107 -0
- package/lib/Icon/index.d.ts +2 -3
- package/lib/Icon/index.js +3 -13
- package/lib/Logo/Divider.d.ts +3 -3
- package/lib/Logo/Divider.js +5 -15
- package/lib/Logo/Logo3D.d.ts +3 -3
- package/lib/Logo/Logo3D.js +4 -14
- package/lib/Logo/LogoFlat.d.ts +3 -3
- package/lib/Logo/LogoFlat.js +18 -28
- package/lib/Logo/LogoHighContrast.d.ts +3 -3
- package/lib/Logo/LogoHighContrast.js +4 -14
- package/lib/Logo/LogoText.d.ts +3 -3
- package/lib/Logo/LogoText.js +5 -15
- package/lib/Logo/index.d.ts +3 -3
- package/lib/Logo/index.js +11 -18
- package/lib/Logo/style.js +1 -1
- package/lib/Markdown/Code.d.ts +3 -0
- package/lib/Markdown/Code.js +33 -0
- package/lib/Markdown/CodeBlock.d.ts +3 -0
- package/lib/Markdown/CodeBlock.js +64 -0
- package/lib/Markdown/index.d.ts +13 -0
- package/lib/Markdown/index.js +48 -0
- package/lib/Markdown/style.d.ts +4 -0
- package/lib/Markdown/style.js +64 -0
- package/lib/MessageInput/index.d.ts +35 -0
- package/lib/MessageInput/index.js +58 -0
- package/lib/SearchBar/index.d.ts +5 -0
- package/lib/SearchBar/index.js +42 -0
- package/lib/SideNav/index.d.ts +6 -6
- package/lib/SideNav/index.js +7 -31
- package/lib/SideNav/style.d.ts +1 -0
- package/lib/SideNav/style.js +46 -0
- package/lib/Snippet/index.d.ts +29 -0
- package/lib/Snippet/index.js +47 -0
- package/lib/Snippet/style.d.ts +1 -0
- package/lib/Snippet/style.js +71 -0
- package/lib/StroyBook/index.d.ts +3 -4
- package/lib/StroyBook/index.js +20 -13
- package/lib/StroyBook/style.d.ts +4 -1
- package/lib/StroyBook/style.js +49 -43
- package/lib/Swatches/index.d.ts +8 -0
- package/lib/Swatches/index.js +68 -0
- package/lib/TabsNav/index.d.ts +3 -3
- package/lib/TabsNav/index.js +5 -15
- package/lib/ThemeProvider/GlobalStyle.js +7 -5
- package/lib/ThemeProvider/index.d.ts +15 -0
- package/lib/ThemeSwitch/index.d.ts +5 -5
- package/lib/ThemeSwitch/index.js +15 -32
- package/lib/Tooltip/index.d.ts +5 -0
- package/lib/Tooltip/index.js +34 -0
- package/lib/Tooltip/style.d.ts +3 -0
- package/lib/Tooltip/style.js +51 -0
- package/lib/hooks/useCopied.d.ts +4 -0
- package/lib/hooks/useCopied.js +44 -0
- package/lib/hooks/useHighlight.d.ts +36 -0
- package/lib/hooks/useHighlight.js +76 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +29 -0
- package/lib/styles/theme/base.d.ts +2 -0
- package/lib/styles/theme/base.js +43 -0
- package/lib/styles/theme/dark.js +5 -12
- package/lib/styles/theme/light.js +10 -10
- package/lib/types/index.d.ts +14 -5
- package/package.json +12 -4
- package/es/ThemeProvider/token.d.ts +0 -3
- package/es/ThemeProvider/token.js +0 -45
- package/es/types/index.js +0 -1
- package/lib/ThemeProvider/token.d.ts +0 -3
- package/lib/ThemeProvider/token.js +0 -73
- package/lib/types/index.js +0 -17
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import { Button, Input } from 'antd';
|
|
6
|
+
import { cx } from 'antd-style';
|
|
7
|
+
import { memo, useState } from 'react';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @title MessageInputProps
|
|
12
|
+
* @category Props
|
|
13
|
+
* @description MessageInput 组件的 Props
|
|
14
|
+
*/
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
19
|
+
var onCancel = _ref.onCancel,
|
|
20
|
+
defaultValue = _ref.defaultValue,
|
|
21
|
+
onConfirm = _ref.onConfirm,
|
|
22
|
+
renderButtons = _ref.renderButtons,
|
|
23
|
+
height = _ref.height,
|
|
24
|
+
className = _ref.className;
|
|
25
|
+
var _useState = useState(defaultValue || ''),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
tempSystemRole = _useState2[0],
|
|
28
|
+
setRole = _useState2[1];
|
|
29
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
30
|
+
gap: 8,
|
|
31
|
+
children: [/*#__PURE__*/_jsx(Input.TextArea, {
|
|
32
|
+
value: tempSystemRole,
|
|
33
|
+
allowClear: true,
|
|
34
|
+
placeholder: '例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。',
|
|
35
|
+
style: {
|
|
36
|
+
height: height !== null && height !== void 0 ? height : 200
|
|
37
|
+
},
|
|
38
|
+
onChange: function onChange(e) {
|
|
39
|
+
setRole(e.target.value);
|
|
40
|
+
},
|
|
41
|
+
className: cx('nowheel', className)
|
|
42
|
+
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
43
|
+
direction: 'horizontal-reverse',
|
|
44
|
+
gap: 8,
|
|
45
|
+
children: renderButtons ? renderButtons(tempSystemRole).map(function (buttonProps, index) {
|
|
46
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread({}, buttonProps), index);
|
|
47
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
49
|
+
type: 'primary',
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(tempSystemRole);
|
|
52
|
+
},
|
|
53
|
+
children: "\u8BBE\u5B9A"
|
|
54
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
type: 'text',
|
|
56
|
+
onClick: onCancel,
|
|
57
|
+
children: "\u53D6\u6D88"
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
export default MessageInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputProps } from 'antd';
|
|
3
|
+
export declare type SearchBarProps = InputProps;
|
|
4
|
+
declare const SearchBar: import("react").MemoExoticComponent<({ value, onChange, style, placeholder, ...props }: SearchBarProps) => import("react/jsx-runtime").JSX.Element>;
|
|
5
|
+
export default SearchBar;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["value", "onChange", "style", "placeholder"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
7
|
+
import { Input } from 'antd';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
+
var value = _ref.value,
|
|
12
|
+
onChange = _ref.onChange,
|
|
13
|
+
style = _ref.style,
|
|
14
|
+
placeholder = _ref.placeholder,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
17
|
+
prefix: /*#__PURE__*/_jsx(SearchOutlined, {}),
|
|
18
|
+
allowClear: true,
|
|
19
|
+
value: value,
|
|
20
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Search',
|
|
21
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
22
|
+
borderColor: 'transparent'
|
|
23
|
+
}),
|
|
24
|
+
onChange: onChange
|
|
25
|
+
}, props));
|
|
26
|
+
});
|
|
27
|
+
export default SearchBar;
|
package/es/SideNav/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { DivProps } from "../types";
|
|
2
|
-
import
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
export interface SideNavProps extends DivProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description Avatar to be displayed at the top of the sidenav
|
|
6
6
|
*/
|
|
7
|
-
avatar?:
|
|
7
|
+
avatar?: ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* @description Actions to be displayed below the avatar
|
|
10
10
|
*/
|
|
11
|
-
topActions?:
|
|
11
|
+
topActions?: ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* @description Actions to be displayed at the bottom of the sidenav
|
|
14
14
|
*/
|
|
15
|
-
bottomActions:
|
|
15
|
+
bottomActions: ReactNode;
|
|
16
16
|
}
|
|
17
|
-
declare const
|
|
18
|
-
export default
|
|
17
|
+
declare const SideNav: import("react").NamedExoticComponent<SideNavProps>;
|
|
18
|
+
export default SideNav;
|
package/es/SideNav/index.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
|
|
4
|
-
var _excluded = ["avatar", "topActions", "bottomActions"];
|
|
5
|
-
var _templateObject;
|
|
3
|
+
var _excluded = ["className", "avatar", "topActions", "bottomActions"];
|
|
6
4
|
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; }
|
|
7
5
|
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; }
|
|
8
6
|
import { Space } from 'antd';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useStyles } from "./style";
|
|
11
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return /*#__PURE__*/_jsxs(Layout, _objectSpread(_objectSpread({}, props), {}, {
|
|
11
|
+
var SideNav = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
+
var className = _ref.className,
|
|
13
|
+
avatar = _ref.avatar,
|
|
14
|
+
topActions = _ref.topActions,
|
|
15
|
+
bottomActions = _ref.bottomActions,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _useStyles = useStyles(),
|
|
18
|
+
styles = _useStyles.styles,
|
|
19
|
+
cx = _useStyles.cx;
|
|
20
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
21
|
+
className: cx(styles, className)
|
|
22
|
+
}, props), {}, {
|
|
26
23
|
children: [/*#__PURE__*/_jsxs(Space, {
|
|
27
24
|
size: 16,
|
|
28
25
|
direction: "vertical",
|
|
@@ -40,5 +37,5 @@ var SideNav = function SideNav(_ref3) {
|
|
|
40
37
|
children: bottomActions
|
|
41
38
|
})]
|
|
42
39
|
}));
|
|
43
|
-
};
|
|
44
|
-
export default
|
|
40
|
+
});
|
|
41
|
+
export default SideNav;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: none;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n\n width: 64px;\n height: 100%;\n min-height: 640px;\n padding: 16px 0;\n\n background: ", ";\n border-right: 1px solid ", ";\n "])), token.colorBgContainer, token.colorBorder);
|
|
8
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DivProps } from "../types";
|
|
3
|
+
export interface SnippetProps extends DivProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description The content to be displayed inside the Snippet component
|
|
6
|
+
*/
|
|
7
|
+
children: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description The symbol to be displayed before the content inside the Snippet component
|
|
10
|
+
*/
|
|
11
|
+
symbol?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description The language of the content inside the Snippet component
|
|
14
|
+
* @default 'tsx'
|
|
15
|
+
*/
|
|
16
|
+
language?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description Whether the Snippet component is copyable or not
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
copyable?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description The type of the Snippet component
|
|
24
|
+
* @default 'ghost'
|
|
25
|
+
*/
|
|
26
|
+
type?: 'ghost' | 'block';
|
|
27
|
+
}
|
|
28
|
+
declare const Snippet: import("react").NamedExoticComponent<SnippetProps>;
|
|
29
|
+
export default Snippet;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["symbol", "language", "children", "copyable", "type"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import CopyButton from "../CopyButton";
|
|
8
|
+
import { SyntaxHighlighter } from "../Highlighter";
|
|
9
|
+
import { useStyles } from "./style";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
13
|
+
var symbol = _ref.symbol,
|
|
14
|
+
_ref$language = _ref.language,
|
|
15
|
+
language = _ref$language === void 0 ? 'tsx' : _ref$language,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
_ref$copyable = _ref.copyable,
|
|
18
|
+
copyable = _ref$copyable === void 0 ? true : _ref$copyable,
|
|
19
|
+
_ref$type = _ref.type,
|
|
20
|
+
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _useStyles = useStyles(type),
|
|
23
|
+
styles = _useStyles.styles;
|
|
24
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
25
|
+
className: styles
|
|
26
|
+
}, props), {}, {
|
|
27
|
+
children: [/*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
28
|
+
language: language,
|
|
29
|
+
children: [symbol, children].filter(Boolean).join(' ')
|
|
30
|
+
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
31
|
+
size: {
|
|
32
|
+
fontSize: 14,
|
|
33
|
+
blockSize: 24
|
|
34
|
+
},
|
|
35
|
+
content: children
|
|
36
|
+
})]
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
export default Snippet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: "block" | "ghost" | undefined) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref, type) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token;
|
|
8
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n max-width: 100%;\n position: relative;\n align-items: center;\n border-radius: ", "px;\n gap: 8px;\n padding: 0 8px;\n height: 36px;\n transition: background-color 100ms ", ";\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n background: none !important;\n padding-top: 6px; !important;\n margin: 0 !important;\n line-height: 1;\n }\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), rgba(token.colorBgElevated, 0.6)) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), token.colorFillTertiary);
|
|
9
|
+
});
|
package/es/StroyBook/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { DivProps } from "../types";
|
|
2
3
|
import { useControls, useCreateStore } from 'leva';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
export { useCreateStore, useControls };
|
|
5
5
|
export interface StroyBookProps extends DivProps {
|
|
6
6
|
/**
|
|
@@ -13,6 +13,5 @@ export interface StroyBookProps extends DivProps {
|
|
|
13
13
|
*/
|
|
14
14
|
noPadding?: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare const StroyBook:
|
|
17
|
-
|
|
18
|
-
export default _default;
|
|
16
|
+
export declare const StroyBook: import("react").NamedExoticComponent<StroyBookProps>;
|
|
17
|
+
export default StroyBook;
|
package/es/StroyBook/index.js
CHANGED
|
@@ -3,20 +3,26 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["levaStore", "noPadding", "className", "children"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
|
-
import {
|
|
6
|
+
import { useResponsive } from 'antd-style';
|
|
7
7
|
import { LevaPanel, useControls, useCreateStore } from 'leva';
|
|
8
|
-
import
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import DraggablePanel from "../DraggablePanel";
|
|
9
10
|
import { useStyles } from "./style";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
export { useCreateStore, useControls };
|
|
13
|
-
export var StroyBook = function
|
|
14
|
+
export var StroyBook = /*#__PURE__*/memo(function (_ref) {
|
|
14
15
|
var levaStore = _ref.levaStore,
|
|
15
16
|
noPadding = _ref.noPadding,
|
|
16
17
|
className = _ref.className,
|
|
17
18
|
children = _ref.children,
|
|
18
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
var
|
|
20
|
+
var _useResponsive = useResponsive(),
|
|
21
|
+
mobile = _useResponsive.mobile;
|
|
22
|
+
var _useStyles = useStyles({
|
|
23
|
+
noPadding: Boolean(noPadding),
|
|
24
|
+
mobile: Boolean(mobile)
|
|
25
|
+
}),
|
|
20
26
|
styles = _useStyles.styles,
|
|
21
27
|
cx = _useStyles.cx;
|
|
22
28
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
@@ -27,7 +33,8 @@ export var StroyBook = function StroyBook(_ref) {
|
|
|
27
33
|
children: children
|
|
28
34
|
}), /*#__PURE__*/_jsxs(DraggablePanel, {
|
|
29
35
|
className: styles.right,
|
|
30
|
-
placement:
|
|
36
|
+
placement: mobile ? 'bottom' : 'right',
|
|
37
|
+
minWidth: 280,
|
|
31
38
|
children: [/*#__PURE__*/_jsx(LevaPanel, {
|
|
32
39
|
fill: true,
|
|
33
40
|
store: levaStore,
|
|
@@ -36,5 +43,5 @@ export var StroyBook = function StroyBook(_ref) {
|
|
|
36
43
|
}), ' ']
|
|
37
44
|
})]
|
|
38
45
|
}));
|
|
39
|
-
};
|
|
40
|
-
export default
|
|
46
|
+
});
|
|
47
|
+
export default StroyBook;
|
package/es/StroyBook/style.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare const useStyles: (props?:
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
noPadding: boolean;
|
|
3
|
+
mobile: boolean;
|
|
4
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
2
5
|
editor: import("antd-style").SerializedStyles;
|
|
3
6
|
left: import("antd-style").SerializedStyles;
|
|
4
7
|
right: import("antd-style").SerializedStyles;
|
package/es/StroyBook/style.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
export var useStyles = createStyles(function (_ref,
|
|
4
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
|
+
var noPadding = _ref2.noPadding,
|
|
8
|
+
mobile = _ref2.mobile;
|
|
7
9
|
return {
|
|
8
|
-
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
9
|
-
left: css(
|
|
10
|
-
right: css(
|
|
10
|
+
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n width: inherit;\n min-height: inherit;\n ", "\n "])), mobile && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-direction: column;\n "])))),
|
|
11
|
+
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: auto;\n ", "\n "])), !noPadding && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
|
|
12
|
+
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n input:checked + label > svg {\n stroke: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.colorBgLayout, token.colorBorder)
|
|
11
13
|
};
|
|
12
14
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useTheme } from 'antd-style';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Flexbox } from 'react-layout-kit';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
var Swatches = /*#__PURE__*/memo(function (_ref) {
|
|
7
|
+
var colors = _ref.colors,
|
|
8
|
+
activeColor = _ref.activeColor,
|
|
9
|
+
onSelect = _ref.onSelect;
|
|
10
|
+
var theme = useTheme();
|
|
11
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
12
|
+
horizontal: true,
|
|
13
|
+
gap: 8,
|
|
14
|
+
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
15
|
+
style: {
|
|
16
|
+
width: 24,
|
|
17
|
+
height: 24,
|
|
18
|
+
background: theme.colorBgContainer,
|
|
19
|
+
boxShadow: "inset 0 0 0px 2px ".concat(!activeColor ? theme.colorPrimary : 'rgba(0,0,0,0.1)'),
|
|
20
|
+
borderRadius: '50%',
|
|
21
|
+
cursor: 'pointer'
|
|
22
|
+
},
|
|
23
|
+
onClick: function onClick() {
|
|
24
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(null);
|
|
25
|
+
}
|
|
26
|
+
}), colors.map(function (c) {
|
|
27
|
+
var borderColor = c === activeColor ? theme.colorPrimary : 'rgba(0,0,0,0.1)';
|
|
28
|
+
return /*#__PURE__*/_jsx(Flexbox, {
|
|
29
|
+
style: {
|
|
30
|
+
width: 24,
|
|
31
|
+
height: 24,
|
|
32
|
+
background: c,
|
|
33
|
+
boxShadow: "inset 0 0 0px 2px ".concat(borderColor),
|
|
34
|
+
borderRadius: '50%',
|
|
35
|
+
cursor: 'pointer'
|
|
36
|
+
},
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(c);
|
|
39
|
+
}
|
|
40
|
+
}, c);
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
export default Swatches;
|
package/es/TabsNav/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TabsProps } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
export interface TabsNavProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description Additional className to apply to the component
|
|
@@ -18,5 +18,5 @@ export interface TabsNavProps {
|
|
|
18
18
|
*/
|
|
19
19
|
activeKey?: TabsProps['activeKey'];
|
|
20
20
|
}
|
|
21
|
-
declare const
|
|
22
|
-
export default
|
|
21
|
+
declare const TabsNav: import("react").NamedExoticComponent<TabsNavProps>;
|
|
22
|
+
export default TabsNav;
|
package/es/TabsNav/index.js
CHANGED
|
@@ -4,10 +4,10 @@ var _excluded = ["className"];
|
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import { Tabs } from 'antd';
|
|
7
|
-
import
|
|
7
|
+
import { memo } from 'react';
|
|
8
8
|
import { useStyles } from "./style";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
var TabsNav = function
|
|
10
|
+
var TabsNav = /*#__PURE__*/memo(function (_ref) {
|
|
11
11
|
var className = _ref.className,
|
|
12
12
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
13
|
var _useStyles = useStyles(),
|
|
@@ -16,5 +16,5 @@ var TabsNav = function TabsNav(_ref) {
|
|
|
16
16
|
return /*#__PURE__*/_jsx(Tabs, _objectSpread({
|
|
17
17
|
className: cx(styles.tabs, className)
|
|
18
18
|
}, props));
|
|
19
|
-
};
|
|
20
|
-
export default
|
|
19
|
+
});
|
|
20
|
+
export default TabsNav;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { createGlobalStyle } from 'antd-style';
|
|
4
|
-
var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n body {\n font-family:
|
|
4
|
+
var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n body {\n font-family: ", ";\n font-size: ", "px;\n line-height: 1;\n color: ", ";\n\n margin: 0;\n padding: 0;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n * {\n box-sizing: border-box;\n }\n\n #root {\n\t min-height: 100vh;\n }\n\n @font-face {\n font-family: AliPuHui;\n font-weight: normal;\n src: url('//at.alicdn.com/t/webfont_exesdog9toj.woff2') format('woff2'),\n url('//at.alicdn.com/t/webfont_exesdog9toj.woff') format('woff'),\n url('//at.alicdn.com/t/webfont_exesdog9toj.ttf') format('truetype');\n font-display: swap;\n }\n\n @font-face {\n font-family: AliPuHui;\n font-weight: bold;\n src: url('https://at.alicdn.com/wf/webfont/exMpJIukiCms/Gsw2PSKrftc1yNWMNlXgw.woff2') format('woff2'),\n url('https://at.alicdn.com/wf/webfont/exMpJIukiCms/vtu73by4O2gEBcvBuLgeu.woff') format('woff');\n font-display: swap;\n }\n\n /* \u5B9A\u4E49\u6EDA\u52A8\u69FD\u7684\u6837\u5F0F */\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n margin-right: 4px;\n background-color: transparent; // \u5B9A\u4E49\u6EDA\u52A8\u69FD\u7684\u80CC\u666F\u8272\n\n &-thumb {\n background-color: ", "; // \u5B9A\u4E49\u6EDA\u52A8\u5757\u7684\u80CC\u666F\u8272\n border-radius: 4px; // \u5B9A\u4E49\u6EDA\u52A8\u5757\u7684\u5706\u89D2\u534A\u5F84\n }\n\n &-corner {\n display: none;\n }\n }\n"])), function (_ref) {
|
|
5
5
|
var theme = _ref.theme;
|
|
6
6
|
return theme.fontFamily;
|
|
7
7
|
}, function (_ref2) {
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { extractStaticStyle, type ThemeMode } from 'antd-style';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface ThemeProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description Custom tokens to be used in the theme
|
|
6
|
+
*/
|
|
4
7
|
token?: any;
|
|
8
|
+
/**
|
|
9
|
+
* @description The children of the ThemeProvider component
|
|
10
|
+
*/
|
|
5
11
|
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @description The mode of the theme (light or dark)
|
|
14
|
+
*/
|
|
6
15
|
themeMode?: ThemeMode;
|
|
16
|
+
/**
|
|
17
|
+
* @description Whether to inline the styles on server-side rendering or not
|
|
18
|
+
*/
|
|
7
19
|
ssrInline?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Cache for the extracted static styles
|
|
22
|
+
*/
|
|
8
23
|
cache?: typeof extractStaticStyle.cache;
|
|
9
24
|
}
|
|
10
25
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ActionIconSize } from "..";
|
|
3
3
|
import { ThemeMode } from 'antd-style';
|
|
4
|
-
import
|
|
4
|
+
import { DivProps } from "../types";
|
|
5
5
|
export interface ThemeSwitchProps extends DivProps {
|
|
6
6
|
/**
|
|
7
7
|
* @description Size of the action icon
|
|
@@ -23,5 +23,5 @@ export interface ThemeSwitchProps extends DivProps {
|
|
|
23
23
|
*/
|
|
24
24
|
onThemeSwitch: (themeMode: ThemeMode) => void;
|
|
25
25
|
}
|
|
26
|
-
declare const
|
|
27
|
-
export default
|
|
26
|
+
declare const ThemeSwitch: import("react").NamedExoticComponent<ThemeSwitchProps>;
|
|
27
|
+
export default ThemeSwitch;
|
package/es/ThemeSwitch/index.js
CHANGED
|
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
import { ActionIcon, Icon } from "./..";
|
|
7
7
|
import { Dropdown } from 'antd';
|
|
8
8
|
import { Monitor, Moon, Sun } from 'lucide-react';
|
|
9
|
-
import
|
|
9
|
+
import { memo } from 'react';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
var icons = {
|
|
12
12
|
auto: Monitor,
|
|
@@ -35,13 +35,9 @@ var items = [{
|
|
|
35
35
|
}),
|
|
36
36
|
key: 'dark'
|
|
37
37
|
}];
|
|
38
|
-
var ThemeSwitch = function
|
|
38
|
+
var ThemeSwitch = /*#__PURE__*/memo(function (_ref) {
|
|
39
39
|
var _ref$size = _ref.size,
|
|
40
|
-
size = _ref$size === void 0 ?
|
|
41
|
-
blockSize: 34,
|
|
42
|
-
fontSize: 20,
|
|
43
|
-
strokeWidth: 1.5
|
|
44
|
-
} : _ref$size,
|
|
40
|
+
size = _ref$size === void 0 ? 'site' : _ref$size,
|
|
45
41
|
themeMode = _ref.themeMode,
|
|
46
42
|
onThemeSwitch = _ref.onThemeSwitch,
|
|
47
43
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -60,5 +56,5 @@ var ThemeSwitch = function ThemeSwitch(_ref) {
|
|
|
60
56
|
icon: icons[themeMode]
|
|
61
57
|
})
|
|
62
58
|
}));
|
|
63
|
-
};
|
|
64
|
-
export default
|
|
59
|
+
});
|
|
60
|
+
export default ThemeSwitch;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { Tooltip as AntdTooltip } from 'antd';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useStyles } from "./style";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
var Tooltip = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
+
var className = _ref.className,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
var _useStyles = useStyles(),
|
|
14
|
+
styles = _useStyles.styles,
|
|
15
|
+
cx = _useStyles.cx;
|
|
16
|
+
return /*#__PURE__*/_jsx(AntdTooltip, _objectSpread({
|
|
17
|
+
overlayClassName: cx(styles.tooltip, className)
|
|
18
|
+
}, props));
|
|
19
|
+
});
|
|
20
|
+
export default Tooltip;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
7
|
+
return {
|
|
8
|
+
tooltip: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n background-color: ", ";\n color: ", ";\n padding: 4px 8px;\n border-radius: ", "px;\n min-height: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .ant-tooltip-arrow {\n &:before,\n &:after {\n background: ", ";\n }\n }\n "])), token.colorText, token.colorBgLayout, token.borderRadiusSM, token.colorText)
|
|
9
|
+
};
|
|
10
|
+
});
|