@lobehub/ui 1.168.1 → 1.168.3
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/Hotkey/index.d.ts +0 -1
- package/es/Hotkey/index.js +22 -29
- package/es/Hotkey/type.d.ts +18 -0
- package/es/Hotkey/type.js +18 -0
- package/es/Hotkey/utils.d.ts +0 -16
- package/es/Hotkey/utils.js +0 -16
- package/es/Tooltip/index.d.ts +9 -4
- package/es/Tooltip/index.js +21 -3
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/package.json +1 -1
package/es/Hotkey/index.d.ts
CHANGED
package/es/Hotkey/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
var _excluded = ["classNames", "styles", "keys", "
|
|
3
|
+
var _excluded = ["classNames", "styles", "keys", "inverseTheme", "isApple", "compact", "className", "style"];
|
|
4
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -22,60 +22,60 @@ import Icon from "../Icon";
|
|
|
22
22
|
import LeftClickIcon from "./components/LeftClickIcon";
|
|
23
23
|
import RightClickIcon from "./components/RightClickIcon";
|
|
24
24
|
import { useStyles } from "./style";
|
|
25
|
-
import {
|
|
25
|
+
import { KeyMap } from "./type";
|
|
26
|
+
import { checkIsAppleDevice, splitKeysByPlus, startCase } from "./utils";
|
|
26
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
28
|
var mappingKey = function mappingKey(isAppleDevice) {
|
|
29
29
|
var _ref;
|
|
30
|
-
return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref,
|
|
30
|
+
return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMap.Alt, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
31
31
|
icon: Option
|
|
32
|
-
}) : 'Alt'),
|
|
32
|
+
}) : 'Alt'), KeyMap.Backspace, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
33
33
|
icon: Delete
|
|
34
|
-
}) : 'Backspace'),
|
|
34
|
+
}) : 'Backspace'), KeyMap.Ctrl, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
35
35
|
icon: ChevronUpIcon
|
|
36
|
-
}) : 'Ctrl'),
|
|
36
|
+
}) : 'Ctrl'), KeyMap.Down, /*#__PURE__*/_jsx(Icon, {
|
|
37
37
|
icon: ArrowDownIcon
|
|
38
|
-
})),
|
|
38
|
+
})), KeyMap.Enter, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
39
39
|
icon: CornerDownLeftIcon
|
|
40
|
-
}) : 'Enter'),
|
|
40
|
+
}) : 'Enter'), KeyMap.LeftClick, /*#__PURE__*/_jsx(Icon, {
|
|
41
41
|
icon: LeftClickIcon,
|
|
42
42
|
size: {
|
|
43
43
|
fontSize: '1.15em',
|
|
44
44
|
strokeWidth: 1.75
|
|
45
45
|
}
|
|
46
|
-
})),
|
|
46
|
+
})), KeyMap.Left, /*#__PURE__*/_jsx(Icon, {
|
|
47
47
|
icon: ArrowLeftIcon
|
|
48
|
-
})),
|
|
48
|
+
})), KeyMap.Meta, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
49
49
|
icon: Command
|
|
50
50
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
51
51
|
icon: Grid2X2Icon
|
|
52
|
-
})),
|
|
52
|
+
})), KeyMap.MiddleClick, /*#__PURE__*/_jsx(Icon, {
|
|
53
53
|
icon: MouseIcon,
|
|
54
54
|
size: {
|
|
55
55
|
fontSize: '1.15em',
|
|
56
56
|
strokeWidth: 1.75
|
|
57
57
|
}
|
|
58
|
-
})),
|
|
58
|
+
})), KeyMap.Mod, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
59
59
|
icon: Command
|
|
60
|
-
}) : 'Ctrl'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref,
|
|
60
|
+
}) : 'Ctrl'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMap.RightClick, /*#__PURE__*/_jsx(Icon, {
|
|
61
61
|
icon: RightClickIcon,
|
|
62
62
|
size: {
|
|
63
63
|
fontSize: '1.15em',
|
|
64
64
|
strokeWidth: 1.75
|
|
65
65
|
}
|
|
66
|
-
})),
|
|
66
|
+
})), KeyMap.Right, /*#__PURE__*/_jsx(Icon, {
|
|
67
67
|
icon: ArrowRightIcon
|
|
68
|
-
})),
|
|
68
|
+
})), KeyMap.Shift, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
69
69
|
icon: ArrowBigUpIcon,
|
|
70
70
|
size: {
|
|
71
71
|
fontSize: '1.15em',
|
|
72
72
|
strokeWidth: 1.75
|
|
73
73
|
}
|
|
74
|
-
}) : 'Shift'),
|
|
74
|
+
}) : 'Shift'), KeyMap.Space, /*#__PURE__*/_jsx(Icon, {
|
|
75
75
|
icon: SpaceIcon
|
|
76
|
-
})),
|
|
76
|
+
})), KeyMap.Tab, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
|
|
77
77
|
icon: ArrowRightToLineIcon
|
|
78
|
-
}) : 'Tab'),
|
|
78
|
+
}) : 'Tab'), KeyMap.Up, /*#__PURE__*/_jsx(Icon, {
|
|
79
79
|
icon: ArrowUpIcon
|
|
80
80
|
}));
|
|
81
81
|
};
|
|
@@ -83,7 +83,6 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
|
|
|
83
83
|
var classNames = _ref2.classNames,
|
|
84
84
|
styles = _ref2.styles,
|
|
85
85
|
keys = _ref2.keys,
|
|
86
|
-
desc = _ref2.desc,
|
|
87
86
|
inverseTheme = _ref2.inverseTheme,
|
|
88
87
|
isApple = _ref2.isApple,
|
|
89
88
|
compact = _ref2.compact,
|
|
@@ -108,7 +107,7 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
|
|
|
108
107
|
var mapping = useMemo(function () {
|
|
109
108
|
return mappingKey(isAppleDevice);
|
|
110
109
|
}, [isAppleDevice]);
|
|
111
|
-
return /*#__PURE__*/
|
|
110
|
+
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
112
111
|
align: 'center',
|
|
113
112
|
className: cx(s, className),
|
|
114
113
|
gap: 2,
|
|
@@ -117,13 +116,7 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
|
|
|
117
116
|
visibility: visibility
|
|
118
117
|
}, style)
|
|
119
118
|
}, rest), {}, {
|
|
120
|
-
children:
|
|
121
|
-
className: classNames === null || classNames === void 0 ? void 0 : classNames.descClassName,
|
|
122
|
-
style: _objectSpread({
|
|
123
|
-
marginRight: 10
|
|
124
|
-
}, styles === null || styles === void 0 ? void 0 : styles.descStyle),
|
|
125
|
-
children: desc
|
|
126
|
-
}), compact ? /*#__PURE__*/_jsx(Flexbox, {
|
|
119
|
+
children: compact ? /*#__PURE__*/_jsx(Flexbox, {
|
|
127
120
|
align: 'center',
|
|
128
121
|
as: 'kbd',
|
|
129
122
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.descClassName,
|
|
@@ -143,7 +136,7 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
|
|
|
143
136
|
style: styles === null || styles === void 0 ? void 0 : styles.kbdStyle,
|
|
144
137
|
children: (_mapping$key2 = mapping[key]) !== null && _mapping$key2 !== void 0 ? _mapping$key2 : startCase(key)
|
|
145
138
|
}, index);
|
|
146
|
-
})
|
|
139
|
+
})
|
|
147
140
|
}));
|
|
148
141
|
});
|
|
149
142
|
export default Hotkey;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const enum KeyMap {
|
|
2
|
+
Alt = "alt",
|
|
3
|
+
Backspace = "backspace",
|
|
4
|
+
Ctrl = "ctrl",
|
|
5
|
+
Down = "down",
|
|
6
|
+
Enter = "enter",
|
|
7
|
+
Left = "left",
|
|
8
|
+
LeftClick = "left-click",
|
|
9
|
+
Meta = "meta",
|
|
10
|
+
MiddleClick = "middle-click",
|
|
11
|
+
Mod = "mod",
|
|
12
|
+
Right = "right",
|
|
13
|
+
RightClick = "right-click",
|
|
14
|
+
Shift = "shift",
|
|
15
|
+
Space = "space",
|
|
16
|
+
Tab = "tab",
|
|
17
|
+
Up = "up"
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var KeyMap = {
|
|
2
|
+
Alt: "alt",
|
|
3
|
+
Backspace: "backspace",
|
|
4
|
+
Ctrl: "ctrl",
|
|
5
|
+
Down: "down",
|
|
6
|
+
Enter: "enter",
|
|
7
|
+
Left: "left",
|
|
8
|
+
LeftClick: "left-click",
|
|
9
|
+
Meta: "meta",
|
|
10
|
+
MiddleClick: "middle-click",
|
|
11
|
+
Mod: "mod",
|
|
12
|
+
Right: "right",
|
|
13
|
+
RightClick: "right-click",
|
|
14
|
+
Shift: "shift",
|
|
15
|
+
Space: "space",
|
|
16
|
+
Tab: "tab",
|
|
17
|
+
Up: "up"
|
|
18
|
+
};
|
package/es/Hotkey/utils.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
export declare const ALT_KEY = "alt";
|
|
2
|
-
export declare const MOD_KEY = "mod";
|
|
3
|
-
export declare const SHIFT_KEY = "shift";
|
|
4
|
-
export declare const META_KEY = "meta";
|
|
5
|
-
export declare const BACKSPACE_KEY = "backspace";
|
|
6
|
-
export declare const CONTROL_KEY = "ctrl";
|
|
7
|
-
export declare const SPACE_KEY = "space";
|
|
8
|
-
export declare const TAB_KEY = "tab";
|
|
9
|
-
export declare const ENTER_KEY = "enter";
|
|
10
|
-
export declare const LEFT_KEY = "left";
|
|
11
|
-
export declare const RIGHT_KEY = "right";
|
|
12
|
-
export declare const UP_KEY = "up";
|
|
13
|
-
export declare const DOWN_KEY = "down";
|
|
14
|
-
export declare const RIGHT_CLICK_KEY = "right-click";
|
|
15
|
-
export declare const LEFT_CLICK_KEY = "left-click";
|
|
16
|
-
export declare const MID_CLICK_KEY = "mid-click";
|
|
17
1
|
export declare const splitKeysByPlus: (keys: string) => string[];
|
|
18
2
|
export declare const startCase: (str: string) => string;
|
|
19
3
|
export declare const checkIsAppleDevice: (isApple?: boolean) => boolean;
|
package/es/Hotkey/utils.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
export var ALT_KEY = 'alt';
|
|
2
|
-
export var MOD_KEY = 'mod';
|
|
3
|
-
export var SHIFT_KEY = 'shift';
|
|
4
|
-
export var META_KEY = 'meta';
|
|
5
|
-
export var BACKSPACE_KEY = 'backspace';
|
|
6
|
-
export var CONTROL_KEY = 'ctrl';
|
|
7
|
-
export var SPACE_KEY = 'space';
|
|
8
|
-
export var TAB_KEY = 'tab';
|
|
9
|
-
export var ENTER_KEY = 'enter';
|
|
10
|
-
export var LEFT_KEY = 'left';
|
|
11
|
-
export var RIGHT_KEY = 'right';
|
|
12
|
-
export var UP_KEY = 'up';
|
|
13
|
-
export var DOWN_KEY = 'down';
|
|
14
|
-
export var RIGHT_CLICK_KEY = 'right-click';
|
|
15
|
-
export var LEFT_CLICK_KEY = 'left-click';
|
|
16
|
-
export var MID_CLICK_KEY = 'mid-click';
|
|
17
1
|
export var splitKeysByPlus = function splitKeysByPlus(keys) {
|
|
18
2
|
var placeholder = 'PLACEHOLDER';
|
|
19
3
|
var parts = keys.replaceAll('++', "+".concat(placeholder)).split('+');
|
package/es/Tooltip/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type TooltipProps as AntdTooltipProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { type HotkeyProps } from "../Hotkey";
|
|
4
|
+
export type TooltipProps = Omit<AntdTooltipProps, 'title'> & {
|
|
5
|
+
hotkey?: string;
|
|
6
|
+
hotkeyProps?: Omit<HotkeyProps, 'keys'>;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const Tooltip: import("react").NamedExoticComponent<TooltipProps>;
|
|
5
10
|
export default Tooltip;
|
package/es/Tooltip/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["className", "arrow"];
|
|
4
|
+
var _excluded = ["hotkey", "className", "arrow", "title", "hotkeyProps"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
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; }
|
|
@@ -11,12 +11,18 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
11
11
|
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; }
|
|
12
12
|
import { Tooltip as AntdTooltip } from 'antd';
|
|
13
13
|
import { memo } from 'react';
|
|
14
|
+
import { Flexbox } from 'react-layout-kit';
|
|
15
|
+
import Hotkey from "../Hotkey";
|
|
14
16
|
import { useStyles } from "./style";
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
19
|
var Tooltip = /*#__PURE__*/memo(function (_ref) {
|
|
17
|
-
var
|
|
20
|
+
var hotkey = _ref.hotkey,
|
|
21
|
+
className = _ref.className,
|
|
18
22
|
_ref$arrow = _ref.arrow,
|
|
19
23
|
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
24
|
+
title = _ref.title,
|
|
25
|
+
hotkeyProps = _ref.hotkeyProps,
|
|
20
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
27
|
var _useStyles = useStyles(),
|
|
22
28
|
styles = _useStyles.styles,
|
|
@@ -25,7 +31,19 @@ var Tooltip = /*#__PURE__*/memo(function (_ref) {
|
|
|
25
31
|
arrow: arrow,
|
|
26
32
|
classNames: {
|
|
27
33
|
root: cx(styles.tooltip, className)
|
|
28
|
-
}
|
|
34
|
+
},
|
|
35
|
+
title: hotkey ? /*#__PURE__*/_jsxs(Flexbox, {
|
|
36
|
+
align: 'center',
|
|
37
|
+
gap: 8,
|
|
38
|
+
horizontal: true,
|
|
39
|
+
justify: 'space-between',
|
|
40
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
41
|
+
children: title
|
|
42
|
+
}), /*#__PURE__*/_jsx(Hotkey, _objectSpread({
|
|
43
|
+
inverseTheme: true,
|
|
44
|
+
keys: hotkey
|
|
45
|
+
}, hotkeyProps))]
|
|
46
|
+
}) : title
|
|
29
47
|
}, rest));
|
|
30
48
|
});
|
|
31
49
|
export default Tooltip;
|
package/es/components.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { default as Header, type HeaderProps } from './Header';
|
|
|
32
32
|
export { default as Highlighter, type HighlighterProps, SyntaxHighlighter, type SyntaxHighlighterProps, } from './Highlighter';
|
|
33
33
|
export { useChatListActionsBar } from './hooks/useChatListActionsBar';
|
|
34
34
|
export { default as Hotkey, type HotkeyProps } from './Hotkey';
|
|
35
|
+
export { KeyMap } from './Hotkey/type';
|
|
35
36
|
export { default as HotkeyInput, type HotkeyInputProps } from './HotkeyInput';
|
|
36
37
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
37
38
|
export * from './Icon/icons';
|
package/es/components.js
CHANGED
|
@@ -32,6 +32,7 @@ export { default as Header } from "./Header";
|
|
|
32
32
|
export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
|
|
33
33
|
export { useChatListActionsBar } from "./hooks/useChatListActionsBar";
|
|
34
34
|
export { default as Hotkey } from "./Hotkey";
|
|
35
|
+
export { KeyMap } from "./Hotkey/type";
|
|
35
36
|
export { default as HotkeyInput } from "./HotkeyInput";
|
|
36
37
|
export { default as Icon } from "./Icon";
|
|
37
38
|
export * from "./Icon/icons";
|