@lobehub/ui 1.128.4 → 1.128.6

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/README.md CHANGED
@@ -63,7 +63,7 @@ $ bun add @lobehub/ui
63
63
  ### Compile with NextJS
64
64
 
65
65
  > \[!NOTE]\
66
- > By work correct with nextjs ssr, add `transpilePackages: ['@lobehub/ui']` to `next.config.js`. For example:
66
+ > By work correct with nextjs page router SSR, add `transpilePackages: ['@lobehub/ui']` to `next.config.js`. For example:
67
67
 
68
68
  ```js
69
69
  // next.config.js
@@ -11,7 +11,8 @@ var Title = /*#__PURE__*/memo(function (_ref) {
11
11
  avatar = _ref.avatar;
12
12
  var _useStyles = useStyles({
13
13
  placement: placement,
14
- showTitle: showTitle
14
+ showTitle: showTitle,
15
+ time: time
15
16
  }),
16
17
  styles = _useStyles.styles;
17
18
  return /*#__PURE__*/_jsxs(Flexbox, {
@@ -48,6 +48,7 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
48
48
  placement: placement,
49
49
  primary: primary,
50
50
  showTitle: showTitle,
51
+ time: time,
51
52
  title: avatar.title,
52
53
  type: type
53
54
  }),
@@ -4,6 +4,7 @@ export declare const useStyles: (props?: {
4
4
  placement?: "left" | "right" | undefined;
5
5
  primary?: boolean | undefined;
6
6
  showTitle?: boolean | undefined;
7
+ time?: number | undefined;
7
8
  title?: string | undefined;
8
9
  type?: "block" | "pure" | undefined;
9
10
  } | undefined) => import("antd-style").ReturnStyles<{
@@ -12,8 +12,8 @@ export var useStyles = createStyles(function (_ref, _ref2) {
12
12
  title = _ref2.title,
13
13
  primary = _ref2.primary,
14
14
  avatarSize = _ref2.avatarSize,
15
- showTitle = _ref2.showTitle,
16
- editing = _ref2.editing;
15
+ editing = _ref2.editing,
16
+ time = _ref2.time;
17
17
  var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 12px;\n background-color: ", ";\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFill : token.colorBgElevated : isDarkMode ? token.colorFillSecondary : token.colorBgContainer, token.borderRadiusLG, token.motionEaseOut);
18
18
  var pureStylish = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-top: ", ";\n "])), title ? 0 : '6px');
19
19
  var pureContainerStylish = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: -16px;\n transition: background-color 100ms ", ";\n "])), token.motionEaseOut);
@@ -23,15 +23,15 @@ export var useStyles = createStyles(function (_ref, _ref2) {
23
23
  actions: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: none;\n align-self: ", ";\n justify-content: ", ";\n "])), type === 'block' ? 'flex-end' : placement === 'left' ? 'flex-start' : 'flex-end', placement === 'left' ? 'flex-end' : 'flex-start'), editing && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none !important;\n opacity: 0 !important;\n "])))),
24
24
  avatarContainer: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n flex: none;\n width: ", "px;\n height: ", "px;\n "])), avatarSize, avatarSize),
25
25
  avatarGroupContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), avatarSize),
26
- container: cx(type === 'pure' && pureContainerStylish, css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n width: 100%;\n max-width: 100vw;\n padding: 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='menubar'] {\n display: flex;\n }\n\n time,\n div[role='menubar'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='menubar'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 8px;\n }\n "])), token.motionEaseOut, responsive.mobile)),
26
+ container: cx(type === 'pure' && pureContainerStylish, css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n max-width: 100vw;\n padding: 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='menubar'] {\n display: flex;\n }\n\n time,\n div[role='menubar'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='menubar'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 8px;\n }\n "])), token.motionEaseOut, responsive.mobile)),
27
27
  editingContainer: cx(editingStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 8px 12px 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
28
28
  editingInput: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n width: 100%;\n "]))),
29
29
  errorContainer: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n width: 100%;\n "]))),
30
30
  loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", ";\n bottom: 0;\n left: ", ";\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), placement === 'left' ? '-4px' : 'unset', placement === 'right' ? '-4px' : 'unset', token.colorBgLayout, token.colorPrimary),
31
31
  message: cx(typeStylish, css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n position: relative;\n\n ", " {\n width: 100%;\n }\n "])), responsive.mobile)),
32
- messageContainer: cx(editingStylish, css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n ", " {\n overflow-x: auto;\n }\n "])), responsive.mobile)),
32
+ messageContainer: cx(editingStylish, css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n margin-top: ", "px;\n\n ", " {\n overflow-x: auto;\n }\n "])), time ? -16 : 0, responsive.mobile)),
33
33
  messageContent: cx(editingStylish, css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n position: relative;\n overflow-x: hidden;\n max-width: 100%;\n\n ", " {\n flex-direction: column !important;\n }\n "])), responsive.mobile)),
34
34
  messageExtra: cx('message-extra'),
35
- name: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n position: ", ";\n top: ", ";\n right: ", ";\n left: ", ";\n\n margin-bottom: 6px;\n\n font-size: 12px;\n line-height: 1;\n color: ", ";\n text-align: ", ";\n "])), showTitle ? 'relative' : 'absolute', showTitle ? 'unset' : '-16px', placement === 'right' ? '0' : 'unset', placement === 'left' ? '0' : 'unset', token.colorTextDescription, placement === 'left' ? 'left' : 'right')
35
+ name: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n margin-bottom: 6px;\n\n font-size: 12px;\n line-height: 1;\n color: ", ";\n text-align: ", ";\n "])), token.colorTextDescription, placement === 'left' ? 'left' : 'right')
36
36
  };
37
37
  });
@@ -3,9 +3,10 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  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; }
4
4
  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; }
5
5
  import { useHover } from 'ahooks';
6
+ import { ConfigProvider } from 'antd';
6
7
  import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from 'lucide-react';
7
8
  import { Resizable } from 're-resizable';
8
- import { memo, useEffect, useMemo, useRef, useState } from 'react';
9
+ import { memo, useContext, useEffect, useMemo, useRef, useState } from 'react';
9
10
  import { Center } from 'react-layout-kit';
10
11
  import useControlledState from 'use-merge-value';
11
12
  import { useStyles } from "./style";
@@ -46,10 +47,21 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
46
47
  destroyOnClose = _ref.destroyOnClose,
47
48
  hanlderStyle = _ref.hanlderStyle,
48
49
  _ref$classNames = _ref.classNames,
49
- classNames = _ref$classNames === void 0 ? {} : _ref$classNames;
50
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
51
+ dir = _ref.dir;
50
52
  var reference = useRef();
51
53
  var isHovering = useHover(reference);
52
54
  var isVertical = placement === 'top' || placement === 'bottom';
55
+
56
+ // inherit direction from Ant Design ConfigProvider
57
+ var _useContext = useContext(ConfigProvider.ConfigContext),
58
+ antdDirection = _useContext.direction;
59
+ var direction = dir !== null && dir !== void 0 ? dir : antdDirection;
60
+ var internalPlacement = placement;
61
+ // reverse the placement when dir is rtl
62
+ if (direction === 'rtl' && ['left', 'right'].includes(placement)) {
63
+ internalPlacement = internalPlacement === 'left' ? 'right' : 'left';
64
+ }
53
65
  var _useStyles = useStyles(headerHeight),
54
66
  styles = _useStyles.styles,
55
67
  cx = _useStyles.cx;
@@ -79,8 +91,8 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
79
91
  var canResizing = resize !== false && isExpand;
80
92
  var resizeHandleClassNames = useMemo(function () {
81
93
  if (!canResizing) return {};
82
- return _defineProperty({}, revesePlacement(placement), styles["".concat(revesePlacement(placement), "Handle")]);
83
- }, [canResizing, placement]);
94
+ return _defineProperty({}, revesePlacement(internalPlacement), styles["".concat(revesePlacement(internalPlacement), "Handle")]);
95
+ }, [canResizing, internalPlacement]);
84
96
  var resizing = _objectSpread(_defineProperty({
85
97
  bottom: false,
86
98
  bottomLeft: false,
@@ -90,7 +102,7 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
90
102
  top: false,
91
103
  topLeft: false,
92
104
  topRight: false
93
- }, revesePlacement(placement), true), resize);
105
+ }, revesePlacement(internalPlacement), true), resize);
94
106
  var defaultSize = useMemo(function () {
95
107
  if (isVertical) return _objectSpread({
96
108
  height: DEFAULT_HEIGHT,
@@ -120,7 +132,7 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
120
132
  }
121
133
  };
122
134
  var _useMemo = useMemo(function () {
123
- switch (placement) {
135
+ switch (internalPlacement) {
124
136
  case 'top':
125
137
  {
126
138
  return {
@@ -150,7 +162,7 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
150
162
  };
151
163
  }
152
164
  }
153
- }, [styles, placement]),
165
+ }, [styles, internalPlacement]),
154
166
  Arrow = _useMemo.Arrow,
155
167
  arrowPlacement = _useMemo.className;
156
168
  var handler = /*#__PURE__*/_jsx(Center
@@ -214,7 +226,8 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
214
226
  return /*#__PURE__*/_jsxs("aside", {
215
227
  className: cx(styles.container,
216
228
  // @ts-ignore
217
- styles[mode === 'fixed' ? 'fixed' : "".concat(placement, "Float")], className),
229
+ styles[mode === 'fixed' ? 'fixed' : "".concat(internalPlacement, "Float")], className),
230
+ dir: dir,
218
231
  ref: reference,
219
232
  style: isExpand ? _defineProperty({}, "border".concat(arrowPlacement, "Width"), 1) : {},
220
233
  children: [expandable && showExpand && handler, destroyOnClose ? isExpand && inner : inner]
@@ -10,6 +10,6 @@ export var useStyles = createStyles(function (_ref) {
10
10
  icon: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextPlaceholder),
11
11
  input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 8px 0 12px;\n "]))),
12
12
  search: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n "]))),
13
- tag: cx(stylish.blur, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n\n color: ", ";\n "])), token.colorTextDescription))
13
+ tag: cx(stylish.blur, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n inset-block-start: 50%;\n inset-inline-end: 12px;\n transform: translateY(-50%);\n\n color: ", ";\n "])), token.colorTextDescription))
14
14
  };
15
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.128.4",
3
+ "version": "1.128.6",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -31,7 +31,6 @@
31
31
  "build:watch": "father dev",
32
32
  "ci": "npm run lint && npm run type-check",
33
33
  "clean": "rm -r es lib dist coverage .dumi/tmp .eslintcache node_modules/.cache",
34
- "dev": "father dev",
35
34
  "docs:build": "dumi build",
36
35
  "docs:build-analyze": "ANALYZE=1 dumi build",
37
36
  "docs:dev": "dumi dev",