@lobehub/ui 1.11.0 → 1.11.1

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 (91) hide show
  1. package/lib/ActionIcon/index.js +77 -79
  2. package/lib/ActionIcon/style.js +17 -61
  3. package/lib/Avatar/index.js +62 -67
  4. package/lib/Chat/const.js +6 -27
  5. package/lib/Chat/index.js +24 -28
  6. package/lib/Chat/store/index.js +46 -40
  7. package/lib/Chat/store/initialState.js +6 -27
  8. package/lib/Chat/store/messageReducer.js +51 -58
  9. package/lib/Chat/store/selectors.js +44 -46
  10. package/lib/Chat/store/store.js +242 -115
  11. package/lib/Chat/types.js +4 -16
  12. package/lib/Chat/utils/fetch.js +104 -68
  13. package/lib/ContextMenu/MenuItem/icons.js +48 -66
  14. package/lib/ContextMenu/MenuItem/index.js +73 -66
  15. package/lib/ContextMenu/MenuItem/style.js +19 -89
  16. package/lib/ContextMenu/index.js +194 -178
  17. package/lib/ContextMenu/style.js +17 -85
  18. package/lib/ContextMenu/types/index.js +15 -18
  19. package/lib/ContextMenu/types/menuItem.js +4 -16
  20. package/lib/Conversation/App.js +47 -50
  21. package/lib/Conversation/ChatList/MessageItem/Content.js +98 -93
  22. package/lib/Conversation/ChatList/MessageItem/Toolbar.js +94 -104
  23. package/lib/Conversation/ChatList/MessageItem/index.js +125 -157
  24. package/lib/Conversation/ChatList/index.js +64 -58
  25. package/lib/Conversation/InputArea/ActionBar.js +74 -92
  26. package/lib/Conversation/InputArea/index.js +103 -142
  27. package/lib/Conversation/StoreUpdater.js +28 -48
  28. package/lib/Conversation/index.js +30 -42
  29. package/lib/CopyButton/index.js +37 -62
  30. package/lib/DraggablePanel/index.js +192 -207
  31. package/lib/DraggablePanel/style.js +30 -278
  32. package/lib/DraggablePanel/utils.js +14 -35
  33. package/lib/EditableMessage/index.js +66 -89
  34. package/lib/EditableMessageList/index.js +97 -112
  35. package/lib/EditableText/index.js +36 -49
  36. package/lib/Highlighter/SyntaxHighlighter/Prism.js +43 -38
  37. package/lib/Highlighter/SyntaxHighlighter/index.js +62 -53
  38. package/lib/Highlighter/SyntaxHighlighter/style.js +18 -56
  39. package/lib/Highlighter/index.js +52 -58
  40. package/lib/Highlighter/style.js +22 -101
  41. package/lib/Icon/index.js +29 -36
  42. package/lib/Input/index.js +45 -43
  43. package/lib/Input/style.js +17 -67
  44. package/lib/List/ListItem/index.js +108 -150
  45. package/lib/List/ListItem/time.js +15 -47
  46. package/lib/List/index.js +9 -37
  47. package/lib/Logo/Divider.js +21 -34
  48. package/lib/Logo/Logo3D.js +17 -33
  49. package/lib/Logo/LogoFlat.js +108 -118
  50. package/lib/Logo/LogoHighContrast.js +30 -33
  51. package/lib/Logo/LogoText.js +21 -34
  52. package/lib/Logo/index.js +97 -59
  53. package/lib/Logo/style.js +13 -36
  54. package/lib/Markdown/Code.js +16 -30
  55. package/lib/Markdown/CodeBlock.js +33 -65
  56. package/lib/Markdown/index.js +35 -54
  57. package/lib/Markdown/style.js +15 -129
  58. package/lib/MessageInput/index.js +60 -56
  59. package/lib/MessageModal/index.js +80 -91
  60. package/lib/SearchBar/index.js +86 -73
  61. package/lib/SearchBar/style.js +18 -46
  62. package/lib/SideNav/index.js +43 -31
  63. package/lib/SideNav/style.js +13 -43
  64. package/lib/Snippet/index.js +42 -45
  65. package/lib/Snippet/style.js +13 -71
  66. package/lib/StroyBook/index.js +60 -61
  67. package/lib/StroyBook/style.js +19 -87
  68. package/lib/Swatches/index.js +35 -53
  69. package/lib/TabsNav/index.js +23 -31
  70. package/lib/TabsNav/style.js +17 -60
  71. package/lib/ThemeProvider/GlobalStyle.js +29 -92
  72. package/lib/ThemeProvider/index.js +43 -57
  73. package/lib/ThemeSwitch/index.js +62 -46
  74. package/lib/Tooltip/index.js +26 -31
  75. package/lib/Tooltip/style.js +13 -49
  76. package/lib/components/ControlInput.js +86 -87
  77. package/lib/hooks/useCopied.js +27 -37
  78. package/lib/hooks/useHighlight.js +65 -70
  79. package/lib/index.js +211 -120
  80. package/lib/styles/algorithms/generateColorPalette.js +28 -60
  81. package/lib/styles/algorithms/generateCustomStylish.js +22 -117
  82. package/lib/styles/algorithms/generateCustomToken.js +51 -65
  83. package/lib/styles/algorithms/generateTheme.js +22 -53
  84. package/lib/styles/colors.js +121 -1766
  85. package/lib/styles/index.js +23 -32
  86. package/lib/styles/theme/base.js +11 -32
  87. package/lib/styles/theme/dark.js +38 -62
  88. package/lib/styles/theme/light.js +38 -62
  89. package/lib/types/index.js +4 -16
  90. package/lib/utils/colorUtils.js +14 -48
  91. package/package.json +1 -1
@@ -1,72 +1,108 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/Chat/utils/fetch.ts
20
- var fetch_exports = {};
21
- __export(fetch_exports, {
22
- fetchSSE: () => fetchSSE
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(fetch_exports);
7
+ exports.fetchSSE = void 0;
8
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
25
10
  var codeMessage = {
26
- 200: "成功获取数据,服务已响应",
27
- 201: "操作成功,数据已保存",
28
- 202: "您的请求已进入后台排队,请耐心等待异步任务完成",
29
- 204: "数据已成功删除",
30
- 400: "很抱歉,您的请求出错,服务器未执行任何数据的创建或修改操作",
31
- 401: "很抱歉,您的权限不足。请确认用户名或密码是否正确",
32
- 403: "很抱歉,您无权访问此内容",
33
- 404: "很抱歉,您请求的记录不存在,服务器未能执行任何操作",
34
- 406: "很抱歉,服务器不支持该请求格式",
35
- 410: "很抱歉,你所请求的资源已永久删除",
36
- 422: "很抱歉,在创建对象时遇到验证错误,请稍后再试",
37
- 500: "很抱歉,服务器出现了问题,请稍后再试",
38
- 502: "很抱歉,您遇到了网关错误。这可能是由于网络故障或服务器问题导致的。请稍后再试,或联系管理员以获取更多帮助",
39
- 503: "很抱歉,我们的服务器过载或处在维护中,服务暂时不可用",
40
- 504: "很抱歉,网关请求超时,请稍后再试"
11
+ 200: '成功获取数据,服务已响应',
12
+ 201: '操作成功,数据已保存',
13
+ 202: '您的请求已进入后台排队,请耐心等待异步任务完成',
14
+ 204: '数据已成功删除',
15
+ 400: '很抱歉,您的请求出错,服务器未执行任何数据的创建或修改操作',
16
+ 401: '很抱歉,您的权限不足。请确认用户名或密码是否正确',
17
+ 403: '很抱歉,您无权访问此内容',
18
+ 404: '很抱歉,您请求的记录不存在,服务器未能执行任何操作',
19
+ 406: '很抱歉,服务器不支持该请求格式',
20
+ 410: '很抱歉,你所请求的资源已永久删除',
21
+ 422: '很抱歉,在创建对象时遇到验证错误,请稍后再试',
22
+ 500: '很抱歉,服务器出现了问题,请稍后再试',
23
+ 502: '很抱歉,您遇到了网关错误。这可能是由于网络故障或服务器问题导致的。请稍后再试,或联系管理员以获取更多帮助',
24
+ 503: '很抱歉,我们的服务器过载或处在维护中,服务暂时不可用',
25
+ 504: '很抱歉,网关请求超时,请稍后再试'
41
26
  };
42
- var fetchSSE = async (fetchFn, options = {}) => {
43
- var _a, _b;
44
- const response = await fetchFn();
45
- if (!response.ok) {
46
- const chatMessageError = {
47
- type: "chatbot",
48
- message: codeMessage[response.status],
49
- status: response.status
50
- };
51
- (_a = options.onErrorHandle) == null ? void 0 : _a.call(options, chatMessageError);
52
- return;
53
- }
54
- const returnRes = response.clone();
55
- const data = response.body;
56
- if (!data)
57
- return;
58
- const reader = data.getReader();
59
- const decoder = new TextDecoder();
60
- let done = false;
61
- while (!done) {
62
- const { value, done: doneReading } = await reader.read();
63
- done = doneReading;
64
- const chunkValue = decoder.decode(value);
65
- (_b = options.onMessageHandle) == null ? void 0 : _b.call(options, chunkValue);
66
- }
67
- return returnRes;
68
- };
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- fetchSSE
72
- });
27
+ /**
28
+ * 使用流式方法获取数据
29
+ * @param fetchFn
30
+ * @param options
31
+ */
32
+ var fetchSSE = /*#__PURE__*/function () {
33
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(fetchFn) {
34
+ var options,
35
+ response,
36
+ _options$onErrorHandl,
37
+ chatMessageError,
38
+ returnRes,
39
+ data,
40
+ reader,
41
+ decoder,
42
+ done,
43
+ _options$onMessageHan,
44
+ _yield$reader$read,
45
+ value,
46
+ doneReading,
47
+ chunkValue,
48
+ _args = arguments;
49
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
50
+ while (1) switch (_context.prev = _context.next) {
51
+ case 0:
52
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
53
+ _context.next = 3;
54
+ return fetchFn();
55
+ case 3:
56
+ response = _context.sent;
57
+ if (response.ok) {
58
+ _context.next = 8;
59
+ break;
60
+ }
61
+ chatMessageError = {
62
+ type: 'chatbot',
63
+ message: codeMessage[response.status],
64
+ status: response.status
65
+ };
66
+ (_options$onErrorHandl = options.onErrorHandle) === null || _options$onErrorHandl === void 0 ? void 0 : _options$onErrorHandl.call(options, chatMessageError);
67
+ return _context.abrupt("return");
68
+ case 8:
69
+ returnRes = response.clone();
70
+ data = response.body;
71
+ if (data) {
72
+ _context.next = 12;
73
+ break;
74
+ }
75
+ return _context.abrupt("return");
76
+ case 12:
77
+ reader = data.getReader();
78
+ decoder = new TextDecoder();
79
+ done = false;
80
+ case 15:
81
+ if (done) {
82
+ _context.next = 26;
83
+ break;
84
+ }
85
+ _context.next = 18;
86
+ return reader.read();
87
+ case 18:
88
+ _yield$reader$read = _context.sent;
89
+ value = _yield$reader$read.value;
90
+ doneReading = _yield$reader$read.done;
91
+ done = doneReading;
92
+ chunkValue = decoder.decode(value);
93
+ (_options$onMessageHan = options.onMessageHandle) === null || _options$onMessageHan === void 0 ? void 0 : _options$onMessageHan.call(options, chunkValue);
94
+ _context.next = 15;
95
+ break;
96
+ case 26:
97
+ return _context.abrupt("return", returnRes);
98
+ case 27:
99
+ case "end":
100
+ return _context.stop();
101
+ }
102
+ }, _callee);
103
+ }));
104
+ return function fetchSSE(_x) {
105
+ return _ref.apply(this, arguments);
106
+ };
107
+ }();
108
+ exports.fetchSSE = fetchSSE;
@@ -1,100 +1,82 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/ContextMenu/MenuItem/icons.tsx
20
- var icons_exports = {};
21
- __export(icons_exports, {
22
- AltIcon: () => AltIcon,
23
- CommandIcon: () => CommandIcon,
24
- ControlIcon: () => ControlIcon,
25
- ShiftIcon: () => ShiftIcon
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
26
5
  });
27
- module.exports = __toCommonJS(icons_exports);
6
+ exports.ShiftIcon = exports.ControlIcon = exports.CommandIcon = exports.AltIcon = void 0;
7
+ var _jsxRuntime = require("react/jsx-runtime");
28
8
  var strokeWidth = 2.2;
29
- var iconSize = "13px";
30
- var CommandIcon = () => /* @__PURE__ */ React.createElement(
31
- "svg",
32
- {
9
+ var iconSize = '13px';
10
+ var CommandIcon = function CommandIcon() {
11
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
33
12
  xmlns: "http://www.w3.org/2000/svg",
34
13
  width: iconSize,
35
14
  height: iconSize,
36
15
  viewBox: "0 0 24 24",
37
16
  fill: "none",
38
17
  stroke: "currentColor",
39
- strokeWidth,
18
+ strokeWidth: strokeWidth,
40
19
  strokeLinecap: "round",
41
- strokeLinejoin: "round"
42
- },
43
- /* @__PURE__ */ React.createElement("path", { d: "M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z" })
44
- );
45
- var ControlIcon = () => /* @__PURE__ */ React.createElement(
46
- "svg",
47
- {
20
+ strokeLinejoin: "round",
21
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
22
+ d: "M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"
23
+ })
24
+ });
25
+ };
26
+ exports.CommandIcon = CommandIcon;
27
+ var ControlIcon = function ControlIcon() {
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
48
29
  xmlns: "http://www.w3.org/2000/svg",
49
30
  width: iconSize,
50
31
  height: iconSize,
51
32
  viewBox: "0 0 24 24",
52
33
  fill: "none",
53
34
  stroke: "currentColor",
54
- strokeWidth,
35
+ strokeWidth: strokeWidth,
55
36
  strokeLinecap: "round",
56
37
  strokeLinejoin: "round",
57
- className: "lucide lucide-chevron-up"
58
- },
59
- /* @__PURE__ */ React.createElement("polyline", { points: "18 15 12 9 6 15" })
60
- );
61
- var ShiftIcon = () => /* @__PURE__ */ React.createElement(
62
- "svg",
63
- {
38
+ className: "lucide lucide-chevron-up",
39
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
40
+ points: "18 15 12 9 6 15"
41
+ })
42
+ });
43
+ };
44
+ exports.ControlIcon = ControlIcon;
45
+ var ShiftIcon = function ShiftIcon() {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
64
47
  xmlns: "http://www.w3.org/2000/svg",
65
48
  width: iconSize,
66
49
  height: iconSize,
67
50
  viewBox: "0 0 24 24",
68
51
  fill: "none",
69
52
  stroke: "currentColor",
70
- strokeWidth,
53
+ strokeWidth: strokeWidth,
71
54
  strokeLinecap: "round",
72
55
  strokeLinejoin: "round",
73
- className: "lucide lucide-chevron-up"
74
- },
75
- /* @__PURE__ */ React.createElement("path", { d: "M9 18v-6H5l7-7 7 7h-4v6H9z" })
76
- );
77
- var AltIcon = () => /* @__PURE__ */ React.createElement(
78
- "svg",
79
- {
56
+ className: "lucide lucide-chevron-up",
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
58
+ d: "M9 18v-6H5l7-7 7 7h-4v6H9z"
59
+ })
60
+ });
61
+ };
62
+ exports.ShiftIcon = ShiftIcon;
63
+ var AltIcon = function AltIcon() {
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
80
65
  xmlns: "http://www.w3.org/2000/svg",
81
66
  width: iconSize,
82
67
  height: iconSize,
83
68
  viewBox: "0 0 24 24",
84
69
  fill: "none",
85
70
  stroke: "currentColor",
86
- strokeWidth,
71
+ strokeWidth: strokeWidth,
87
72
  strokeLinecap: "round",
88
73
  strokeLinejoin: "round",
89
- className: "lucide lucide-chevron-up"
90
- },
91
- /* @__PURE__ */ React.createElement("path", { d: "M3 3h6l6 18h6" }),
92
- /* @__PURE__ */ React.createElement("path", { d: "M14 3h7" })
93
- );
94
- // Annotate the CommonJS export names for ESM import in node:
95
- 0 && (module.exports = {
96
- AltIcon,
97
- CommandIcon,
98
- ControlIcon,
99
- ShiftIcon
100
- });
74
+ className: "lucide lucide-chevron-up",
75
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
76
+ d: "M3 3h6l6 18h6"
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
78
+ d: "M14 3h7"
79
+ })]
80
+ });
81
+ };
82
+ exports.AltIcon = AltIcon;
@@ -1,72 +1,79 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/ContextMenu/MenuItem/index.tsx
20
- var MenuItem_exports = {};
21
- __export(MenuItem_exports, {
22
- default: () => MenuItem_default
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(MenuItem_exports);
25
- var import_lucide_react = require("lucide-react");
26
- var import_react = require("react");
27
- var import_react_layout_kit = require("react-layout-kit");
28
- var import_icons = require("./icons");
29
- var import_style = require("./style");
7
+ exports.default = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _lucideReact = require("lucide-react");
12
+ var _react = require("react");
13
+ var _reactLayoutKit = require("react-layout-kit");
14
+ var _icons = require("./icons");
15
+ var _style = require("./style");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ var _excluded = ["label", "icon", "disabled", "nested", "shortcut", "active", "selected"];
30
18
  var KEYBOARD_ICON_MAP = {
31
- meta: /* @__PURE__ */ React.createElement(import_icons.CommandIcon, null),
32
- control: /* @__PURE__ */ React.createElement(import_icons.ControlIcon, null),
33
- shift: /* @__PURE__ */ React.createElement(import_icons.ShiftIcon, null),
34
- alt: /* @__PURE__ */ React.createElement(import_icons.AltIcon, null),
35
- enter: ""
19
+ meta: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CommandIcon, {}),
20
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ControlIcon, {}),
21
+ shift: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShiftIcon, {}),
22
+ alt: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AltIcon, {}),
23
+ enter: ''
36
24
  };
37
25
  var CODE_MAP = {
38
- meta: "meta",
39
- command: "meta",
40
- cmd: "meta",
41
- ctl: "control",
42
- control: "control",
43
- shift: "shift",
44
- alt: "alt"
26
+ meta: 'meta',
27
+ command: 'meta',
28
+ cmd: 'meta',
29
+ ctl: 'control',
30
+ control: 'control',
31
+ shift: 'shift',
32
+ alt: 'alt'
45
33
  };
46
- var MenuItem = (0, import_react.forwardRef)(
47
- ({ label, icon, disabled, nested, shortcut, active, selected, ...props }, ref) => {
48
- const { styles, cx } = (0, import_style.useStyles)();
49
- return /* @__PURE__ */ React.createElement(
50
- "button",
51
- {
52
- type: "button",
53
- ...props,
54
- ref,
55
- role: "menuitem",
56
- disabled,
57
- className: cx(styles.item, {
58
- [styles.selected]: selected,
59
- [styles.active]: active
60
- })
61
- },
62
- /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, icon && /* @__PURE__ */ React.createElement("span", null, icon), label),
63
- nested ? /* @__PURE__ */ React.createElement("span", { "aria-hidden": true }, /* @__PURE__ */ React.createElement(import_lucide_react.ChevronRightIcon, { className: styles.arrow })) : shortcut ? /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, align: "center" }, shortcut.map((c) => {
64
- const code = CODE_MAP[c.toLowerCase()];
65
- return /* @__PURE__ */ React.createElement("kbd", { className: styles.kbd, key: c }, code ? KEYBOARD_ICON_MAP[code] : c.toUpperCase());
66
- })) : null
67
- );
68
- }
69
- );
70
- var MenuItem_default = MenuItem;
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {});
34
+ var MenuItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
35
+ var _cx;
36
+ var label = _ref.label,
37
+ icon = _ref.icon,
38
+ disabled = _ref.disabled,
39
+ nested = _ref.nested,
40
+ shortcut = _ref.shortcut,
41
+ active = _ref.active,
42
+ selected = _ref.selected,
43
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
44
+ var _useStyles = (0, _style.useStyles)(),
45
+ styles = _useStyles.styles,
46
+ cx = _useStyles.cx;
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", (0, _objectSpread2.default)((0, _objectSpread2.default)({
48
+ type: 'button'
49
+ }, props), {}, {
50
+ ref: ref,
51
+ role: "menuitem",
52
+ disabled: disabled,
53
+ className: cx(styles.item, (_cx = {}, (0, _defineProperty2.default)(_cx, styles.selected, selected), (0, _defineProperty2.default)(_cx, styles.active, active), _cx)),
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactLayoutKit.Flexbox, {
55
+ horizontal: true,
56
+ gap: 8,
57
+ children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
58
+ children: icon
59
+ }), label]
60
+ }), nested ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
61
+ "aria-hidden": true,
62
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReact.ChevronRightIcon, {
63
+ className: styles.arrow
64
+ })
65
+ }) : shortcut ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLayoutKit.Flexbox, {
66
+ horizontal: true,
67
+ align: 'center',
68
+ children: shortcut.map(function (c) {
69
+ var code = CODE_MAP[c.toLowerCase()];
70
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("kbd", {
71
+ className: styles.kbd,
72
+ children: code ? KEYBOARD_ICON_MAP[code] : c.toUpperCase()
73
+ }, c);
74
+ })
75
+ }) : null]
76
+ }));
77
+ });
78
+ var _default = MenuItem;
79
+ exports.default = _default;
@@ -1,94 +1,24 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/ContextMenu/MenuItem/style.ts
20
- var style_exports = {};
21
- __export(style_exports, {
22
- useStyles: () => useStyles
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(style_exports);
25
- var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, cx, token }, prefixCls) => {
27
- const selected = css`
28
- font-weight: bold;
29
- color: ${token.colorPrimaryText};
30
- background: ${token.colorPrimaryBg};
31
- &:hover {
32
- color: ${token.colorPrimaryTextHover};
33
- background: ${token.colorPrimaryBgHover};
34
- }
35
- `;
7
+ exports.useStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _antdStyle = require("antd-style");
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
11
+ var useStyles = (0, _antdStyle.createStyles)(function (_ref, prefixCls) {
12
+ var css = _ref.css,
13
+ cx = _ref.cx,
14
+ token = _ref.token;
15
+ var selected = css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n font-weight: bold;\n color: ", ";\n background: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n "])), token.colorPrimaryText, token.colorPrimaryBg, token.colorPrimaryTextHover, token.colorPrimaryBgHover);
36
16
  return {
37
- item: cx(
38
- `${prefixCls}-item`,
39
- css`
40
- all: unset;
41
-
42
- user-select: none;
43
- scroll-margin: 50px;
44
-
45
- display: flex;
46
- align-items: center;
47
- justify-content: space-between;
48
-
49
- box-sizing: inherit;
50
- width: 100%;
51
- padding: 12px 10px;
52
-
53
- font-family: ${token.fontFamily};
54
- font-weight: normal;
55
- line-height: 1;
56
- color: ${token.colorText};
57
-
58
- background: transparent;
59
- border-radius: 5px;
60
- &:hover {
61
- background: ${token.colorFillTertiary};
62
- }
63
- `
64
- ),
65
- selected: cx(`${prefixCls}-item-selected`, selected),
66
- active: cx(
67
- `${prefixCls}-item-active`,
68
- css`
69
- background: ${token.colorFillTertiary};
70
- `
71
- ),
72
- arrow: css`
73
- color: ${token.colorTextTertiary};
74
- `,
75
- kbd: css`
76
- display: flex;
77
- align-items: center;
78
- justify-content: center;
79
-
80
- width: 18px;
81
- height: 20px;
82
-
83
- font-family: ${token.fontFamily};
84
- font-size: 14px;
85
- color: ${token.colorTextQuaternary};
86
-
87
- border-radius: 2px;
88
- `
17
+ item: cx("".concat(prefixCls, "-item"), css(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n all: unset;\n\n user-select: none;\n scroll-margin: 50px;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n box-sizing: inherit;\n width: 100%;\n padding: 12px 10px;\n\n font-family: ", ";\n font-weight: normal;\n line-height: 1;\n color: ", ";\n\n background: transparent;\n border-radius: 5px;\n &:hover {\n background: ", ";\n }\n "])), token.fontFamily, token.colorText, token.colorFillTertiary)),
18
+ selected: cx("".concat(prefixCls, "-item-selected"), selected),
19
+ active: cx("".concat(prefixCls, "-item-active"), css(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n "])), token.colorFillTertiary)),
20
+ arrow: css(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n "])), token.colorTextTertiary),
21
+ kbd: css(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 18px;\n height: 20px;\n\n font-family: ", ";\n font-size: 14px;\n color: ", ";\n\n border-radius: 2px;\n "])), token.fontFamily, token.colorTextQuaternary)
89
22
  };
90
23
  });
91
- // Annotate the CommonJS export names for ESM import in node:
92
- 0 && (module.exports = {
93
- useStyles
94
- });
24
+ exports.useStyles = useStyles;