@lobehub/ui 1.168.21 → 1.169.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.
@@ -0,0 +1,20 @@
1
+ import { type DrawerProps as AntdDrawerProps } from 'antd';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ export interface DrawProps extends Omit<AntdDrawerProps, 'styles' | 'classNames'> {
4
+ classNames?: AntdDrawerProps['classNames'] & {
5
+ bodyContent?: string;
6
+ extra?: string;
7
+ title?: string;
8
+ };
9
+ containerMaxWidth?: number;
10
+ noHeader?: boolean;
11
+ sidebar?: ReactNode;
12
+ sidebarWidth?: number;
13
+ styles?: AntdDrawerProps['styles'] & {
14
+ bodyContent?: CSSProperties;
15
+ extra?: CSSProperties;
16
+ title?: CSSProperties;
17
+ };
18
+ }
19
+ declare const Draw: import("react").NamedExoticComponent<DrawProps>;
20
+ export default Draw;
@@ -0,0 +1,166 @@
1
+ 'use client';
2
+
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 = ["onClose", "containerMaxWidth", "classNames", "title", "placement", "styles", "children", "height", "width", "extra", "noHeader", "sidebarWidth", "sidebar"];
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
+ 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
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ 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; }
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
+ import { Drawer as AntdDraw } from 'antd';
13
+ import { useTheme } from 'antd-style';
14
+ import { XIcon } from 'lucide-react';
15
+ import { memo, useMemo } from 'react';
16
+ import { Flexbox } from 'react-layout-kit';
17
+ import ActionIcon from "../ActionIcon";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
20
+ import { Fragment as _Fragment } from "react/jsx-runtime";
21
+ var Draw = /*#__PURE__*/memo(function (_ref) {
22
+ var onClose = _ref.onClose,
23
+ _ref$containerMaxWidt = _ref.containerMaxWidth,
24
+ containerMaxWidth = _ref$containerMaxWidt === void 0 ? 1024 : _ref$containerMaxWidt,
25
+ classNames = _ref.classNames,
26
+ title = _ref.title,
27
+ placement = _ref.placement,
28
+ styles = _ref.styles,
29
+ children = _ref.children,
30
+ height = _ref.height,
31
+ width = _ref.width,
32
+ extra = _ref.extra,
33
+ noHeader = _ref.noHeader,
34
+ _ref$sidebarWidth = _ref.sidebarWidth,
35
+ sidebarWidth = _ref$sidebarWidth === void 0 ? 280 : _ref$sidebarWidth,
36
+ sidebar = _ref.sidebar,
37
+ rest = _objectWithoutProperties(_ref, _excluded);
38
+ var theme = useTheme();
39
+ var headerBorder = useMemo(function () {
40
+ if (height === '100%' || width === '100%' || height === '100vh' || width === '100vw') return {};
41
+ switch (placement) {
42
+ case 'top':
43
+ {
44
+ return {
45
+ borderBottom: "1px solid ".concat(theme.colorBorder)
46
+ };
47
+ }
48
+ case 'bottom':
49
+ {
50
+ return {
51
+ borderTop: "1px solid ".concat(theme.colorBorder)
52
+ };
53
+ }
54
+ case 'left':
55
+ {
56
+ return {
57
+ borderRight: "1px solid ".concat(theme.colorBorder)
58
+ };
59
+ }
60
+ case 'right':
61
+ {
62
+ return {
63
+ borderLeft: "1px solid ".concat(theme.colorBorder)
64
+ };
65
+ }
66
+ default:
67
+ {
68
+ return {};
69
+ }
70
+ }
71
+ }, [placement, height, width, theme.colorBorder]);
72
+ var extraNode = /*#__PURE__*/_jsxs(Flexbox, {
73
+ align: 'center',
74
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.extra,
75
+ gap: 4,
76
+ horizontal: true,
77
+ justify: 'flex-end',
78
+ style: _objectSpread({
79
+ position: 'absolute',
80
+ right: 4,
81
+ top: 4
82
+ }, styles === null || styles === void 0 ? void 0 : styles.extra),
83
+ children: [extra, /*#__PURE__*/_jsx(ActionIcon, {
84
+ icon: XIcon,
85
+ onClick: onClose,
86
+ size: 'site'
87
+ })]
88
+ });
89
+ return /*#__PURE__*/_jsx(AntdDraw, _objectSpread(_objectSpread({
90
+ classNames: classNames,
91
+ closable: false,
92
+ extra: noHeader ? undefined : extraNode,
93
+ height: height,
94
+ keyboard: true,
95
+ onClose: onClose,
96
+ placement: placement,
97
+ styles: _objectSpread(_objectSpread({}, styles), {}, {
98
+ body: _objectSpread({
99
+ background: 'transparent',
100
+ padding: '0 4px'
101
+ }, styles === null || styles === void 0 ? void 0 : styles.body),
102
+ content: _objectSpread({
103
+ background: sidebar ? "linear-gradient(to right, ".concat(theme.colorBgContainer, " 49.9%, ").concat(theme.colorBgLayout, " 50%)") : theme.colorBgContainer
104
+ }, styles === null || styles === void 0 ? void 0 : styles.content),
105
+ header: _objectSpread({
106
+ background: 'transparent',
107
+ display: noHeader ? 'none' : undefined,
108
+ padding: 4
109
+ }, styles === null || styles === void 0 ? void 0 : styles.header),
110
+ wrapper: _objectSpread(_objectSpread({
111
+ background: theme.colorBgContainer
112
+ }, headerBorder), styles === null || styles === void 0 ? void 0 : styles.wrapper)
113
+ }),
114
+ title: /*#__PURE__*/_jsx(Flexbox, {
115
+ align: 'center',
116
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.title,
117
+ horizontal: true,
118
+ justify: 'flex-start',
119
+ paddingBlock: 8,
120
+ paddingInline: 16,
121
+ style: _objectSpread({
122
+ justifySelf: 'center',
123
+ maxWidth: containerMaxWidth,
124
+ width: '100%'
125
+ }, styles === null || styles === void 0 ? void 0 : styles.title),
126
+ children: title
127
+ }),
128
+ width: width
129
+ }, rest), {}, {
130
+ children: /*#__PURE__*/_jsxs(Flexbox, {
131
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.bodyContent,
132
+ height: '100%',
133
+ horizontal: !!sidebar,
134
+ paddingBlock: sidebar ? undefined : 12,
135
+ paddingInline: sidebar ? undefined : 16,
136
+ style: _objectSpread({
137
+ justifySelf: 'center',
138
+ maxWidth: containerMaxWidth,
139
+ width: '100%'
140
+ }, styles === null || styles === void 0 ? void 0 : styles.bodyContent),
141
+ children: [noHeader && extraNode, sidebar ? /*#__PURE__*/_jsxs(_Fragment, {
142
+ children: [/*#__PURE__*/_jsx(Flexbox, {
143
+ paddingBlock: 12,
144
+ paddingInline: 16,
145
+ style: {
146
+ background: theme.colorBgContainer,
147
+ borderRight: "1px solid ".concat(theme.colorBorderSecondary),
148
+ height: '100%'
149
+ },
150
+ width: sidebarWidth,
151
+ children: sidebar
152
+ }), /*#__PURE__*/_jsx(Flexbox, {
153
+ flex: 1,
154
+ paddingBlock: 12,
155
+ paddingInline: 16,
156
+ style: {
157
+ background: theme.colorBgLayout,
158
+ height: '100%'
159
+ },
160
+ children: children
161
+ })]
162
+ }) : children]
163
+ })
164
+ }));
165
+ });
166
+ export default Draw;
@@ -91,7 +91,7 @@ var mappingKey = function mappingKey(isAppleDevice) {
91
91
  icon: ArrowRightToLineIcon
92
92
  }) : 'Tab'), KeyMapEnum.Up, /*#__PURE__*/_jsx(Icon, {
93
93
  icon: ArrowUpIcon
94
- })), KeyMapEnum.Comma, ','), KeyMapEnum.Period, '.'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMapEnum.Slash, '/'), KeyMapEnum.Semicolon, ';'), KeyMapEnum.Quote, "'"), KeyMapEnum.Backquote, '`'), KeyMapEnum.Backslash, '\\'), KeyMapEnum.BracketLeft, '['), KeyMapEnum.BracketRight, ']'), KeyMapEnum.Minus, '-'), KeyMapEnum.Equal, '=');
94
+ })), KeyMapEnum.Comma, ','), KeyMapEnum.Period, '.'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMapEnum.Slash, '?'), KeyMapEnum.Semicolon, ';'), KeyMapEnum.Quote, "'"), KeyMapEnum.Backquote, '`'), KeyMapEnum.Backslash, '\\'), KeyMapEnum.BracketLeft, '['), KeyMapEnum.BracketRight, ']'), KeyMapEnum.Minus, '-'), KeyMapEnum.Equal, '+');
95
95
  };
96
96
  var Hotkey = /*#__PURE__*/memo(function (_ref2) {
97
97
  var _ref2$variant = _ref2.variant,
@@ -127,7 +127,7 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
127
127
  return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
128
128
  align: 'center',
129
129
  className: cx(s, className),
130
- gap: 2,
130
+ gap: isPure ? 6 : 2,
131
131
  horizontal: true,
132
132
  style: _objectSpread({
133
133
  visibility: visibility
@@ -19,6 +19,8 @@ export declare const KeyMapEnum: {
19
19
  readonly Minus: "minus";
20
20
  readonly Mod: "mod";
21
21
  readonly Period: "period";
22
+ readonly Plus: "equal";
23
+ readonly QuestionMark: "slash";
22
24
  readonly Quote: "quote";
23
25
  readonly Right: "right";
24
26
  readonly RightClick: "right-click";
package/es/Hotkey/type.js CHANGED
@@ -29,6 +29,10 @@ export var KeyMapEnum = {
29
29
  // Command on Mac, Ctrl on Win
30
30
  Period: 'period',
31
31
  // .
32
+ Plus: 'equal',
33
+ // +
34
+ QuestionMark: 'slash',
35
+ // ?
32
36
  Quote: 'quote',
33
37
  // '
34
38
  Right: 'right',
@@ -263,7 +263,7 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
263
263
  style: {
264
264
  pointerEvents: 'none'
265
265
  }
266
- }), allowReset && hotkeyValue && hotkeyValue !== resetValue && !disabled && /*#__PURE__*/_jsx(ActionIcon, {
266
+ }), !isFocused && allowReset && hotkeyValue && hotkeyValue !== resetValue && !disabled && /*#__PURE__*/_jsx(ActionIcon, {
267
267
  active: true,
268
268
  icon: Undo2Icon,
269
269
  onClick: handleReset,
@@ -13,6 +13,7 @@ export { default as DraggablePanelBody, type DraggablePanelBodyProps, } from './
13
13
  export { default as DraggablePanelContainer, type DraggablePanelContainerProps, } from './DraggablePanel/components/DraggablePanelContainer';
14
14
  export { default as DraggablePanelFooter, type DraggablePanelFooterProps, } from './DraggablePanel/components/DraggablePanelFooter';
15
15
  export { default as DraggablePanelHeader, type DraggablePanelHeaderProps, } from './DraggablePanel/components/DraggablePanelHeader';
16
+ export { default as Draw, type DrawProps } from './Draw';
16
17
  export { default as EditableText, type EditableTextProps } from './EditableText';
17
18
  export { default as EmojiPicker, type EmojiPickerProps } from './EmojiPicker';
18
19
  export { default as EmptyCard, type EmptyCardProps } from './EmptyCard';
package/es/components.js CHANGED
@@ -13,6 +13,7 @@ export { default as DraggablePanelBody } from "./DraggablePanel/components/Dragg
13
13
  export { default as DraggablePanelContainer } from "./DraggablePanel/components/DraggablePanelContainer";
14
14
  export { default as DraggablePanelFooter } from "./DraggablePanel/components/DraggablePanelFooter";
15
15
  export { default as DraggablePanelHeader } from "./DraggablePanel/components/DraggablePanelHeader";
16
+ export { default as Draw } from "./Draw";
16
17
  export { default as EditableText } from "./EditableText";
17
18
  export { default as EmojiPicker } from "./EmojiPicker";
18
19
  export { default as EmptyCard } from "./EmptyCard";
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { DivProps } from "../../types";
3
- export interface StoryBookProps extends DivProps {
2
+ import { FlexboxProps } from 'react-layout-kit';
3
+ export interface StoryBookProps extends FlexboxProps {
4
4
  /**
5
5
  * @description The Leva store instance to be used by the component
6
6
  * @type levaStore
@@ -11,6 +11,6 @@ export interface StoryBookProps extends DivProps {
11
11
  */
12
12
  noPadding?: boolean;
13
13
  }
14
- export declare const StoryBook: import("react").NamedExoticComponent<StoryBookProps>;
14
+ export declare const StoryBook: import("react").ForwardRefExoticComponent<StoryBookProps & import("react").RefAttributes<HTMLDivElement>>;
15
15
  export default StoryBook;
16
16
  export { useControls, useCreateStore } from 'leva';
@@ -11,13 +11,13 @@ 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 { useResponsive } from 'antd-style';
13
13
  import { LevaPanel } from 'leva';
14
- import { memo } from 'react';
14
+ import { forwardRef } from 'react';
15
15
  import { Flexbox } from 'react-layout-kit';
16
16
  import DraggablePanel from "../../DraggablePanel";
17
17
  import { useStyles } from "./style";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
- export var StoryBook = /*#__PURE__*/memo(function (_ref) {
20
+ export var StoryBook = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
21
  var levaStore = _ref.levaStore,
22
22
  noPadding = _ref.noPadding,
23
23
  className = _ref.className,
@@ -32,7 +32,8 @@ export var StoryBook = /*#__PURE__*/memo(function (_ref) {
32
32
  align: 'stretch',
33
33
  className: cx(styles.editor, className),
34
34
  horizontal: !mobile,
35
- justify: 'stretch'
35
+ justify: 'stretch',
36
+ ref: ref
36
37
  }, rest), {}, {
37
38
  children: [/*#__PURE__*/_jsx(Flexbox, {
38
39
  align: 'center',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.168.21",
3
+ "version": "1.169.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",