@lobehub/ui 1.168.11 → 1.168.13

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.
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
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); }
2
4
  var _excluded = ["children", "copyButtonSize", "fullFeatured", "copyable", "showLanguage", "style", "type", "enablePanZoom", "className", "bodyRender", "actionsRender"];
3
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; }
@@ -16,12 +16,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
17
  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; }
18
18
  import { Button } from 'antd';
19
- import { ChevronUpIcon, CommandIcon, CornerDownLeft } from 'lucide-react';
20
19
  import { memo, useState } from 'react';
20
+ import { useHotkeys } from 'react-hotkeys-hook';
21
21
  import { Flexbox } from 'react-layout-kit';
22
- import Icon from "../../Icon";
22
+ import Hotkey from "../../Hotkey";
23
+ import { KeyMapEnum } from "../../Hotkey/type";
24
+ import { combineKeys } from "../../Hotkey/utils";
23
25
  import { TextArea } from "../../Input";
24
- import { isMacLike } from "../../utils/platform";
25
26
  import { useStyles } from "./style";
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
27
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -52,7 +53,15 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
52
53
  var _useStyles = useStyles(),
53
54
  cx = _useStyles.cx,
54
55
  styles = _useStyles.styles;
56
+ var hotkey = combineKeys([KeyMapEnum.Mod, KeyMapEnum.Enter]);
55
57
  var isAutoSize = height === 'auto';
58
+ useHotkeys(hotkey, function () {
59
+ return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(temporaryValue);
60
+ }, {
61
+ enableOnFormTags: true,
62
+ enabled: shortcut,
63
+ preventDefault: true
64
+ });
56
65
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
57
66
  gap: 16,
58
67
  style: _objectSpread({
@@ -70,11 +79,6 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
70
79
  onChange: function onChange(e) {
71
80
  return setValue(e.target.value);
72
81
  },
73
- onPressEnter: shortcut ? function (e) {
74
- if (isMacLike ? e.metaKey : e.ctrlKey) {
75
- onConfirm === null || onConfirm === void 0 || onConfirm(temporaryValue);
76
- }
77
- } : undefined,
78
82
  placeholder: placeholder,
79
83
  resize: false,
80
84
  style: textareaStyle,
@@ -90,24 +94,13 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
90
94
  }) : /*#__PURE__*/_jsxs(_Fragment, {
91
95
  children: [/*#__PURE__*/_jsxs(Button, {
92
96
  onClick: function onClick() {
93
- onConfirm === null || onConfirm === void 0 || onConfirm(temporaryValue);
97
+ return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(temporaryValue);
94
98
  },
95
99
  size: editButtonSize,
96
100
  type: "primary",
97
- children: [(text === null || text === void 0 ? void 0 : text.confirm) || 'Confirm', shortcut && /*#__PURE__*/_jsxs(Flexbox, {
98
- gap: 4,
99
- horizontal: true,
100
- children: [/*#__PURE__*/_jsx(Icon, {
101
- icon: isMacLike ? CommandIcon : ChevronUpIcon,
102
- size: {
103
- fontSize: 12
104
- }
105
- }), /*#__PURE__*/_jsx(Icon, {
106
- icon: CornerDownLeft,
107
- size: {
108
- fontSize: 12
109
- }
110
- })]
101
+ children: [(text === null || text === void 0 ? void 0 : text.confirm) || 'Confirm', shortcut && /*#__PURE__*/_jsx(Hotkey, {
102
+ inverseTheme: true,
103
+ keys: combineKeys([KeyMapEnum.Mod, KeyMapEnum.Enter])
111
104
  })]
112
105
  }), /*#__PURE__*/_jsx(Button, {
113
106
  onClick: onCancel,
@@ -19,9 +19,9 @@ export var generateColorNeutralPalette = function generateColorNeutralPalette(_r
19
19
  colorBgElevated: appearance === 'dark' ? scale[appearance][2] : scale[appearance][0],
20
20
  colorBgLayout: appearance === 'dark' ? scale[appearance][0] : scale[appearance][1],
21
21
  colorBgMask: scale.lightA[8],
22
- colorBgSpotlight: scale[appearance][5],
23
- colorBorder: scale[appearance][4],
24
- colorBorderSecondary: scale[appearance][3],
22
+ colorBgSpotlight: scale[appearance][4],
23
+ colorBorder: scale[appearance][3],
24
+ colorBorderSecondary: scale[appearance][2],
25
25
  colorFill: scale["".concat(appearance, "A")][3],
26
26
  colorFillQuaternary: scale["".concat(appearance, "A")][0],
27
27
  colorFillSecondary: scale["".concat(appearance, "A")][2],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.168.11",
3
+ "version": "1.168.13",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",