@lobehub/ui 1.164.5 → 1.164.7

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,10 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { FormItemProps as AntdFormItemProps } from 'antd';
3
3
  import { type FormTitleProps } from './FormTitle';
4
- export declare const useStyles: (props?: string | number | undefined) => import("antd-style").ReturnStyles<{
4
+ export declare const useStyles: (props?: {
5
+ minWidth?: string | number | undefined;
6
+ } | undefined) => import("antd-style").ReturnStyles<{
5
7
  item: import("antd-style").SerializedStyles;
6
8
  itemMinWidth: import("antd-style").SerializedStyles;
7
9
  itemNoDivider: import("antd-style").SerializedStyles;
10
+ verticalLayout: import("antd-style").SerializedStyles;
8
11
  }>;
9
12
  export interface FormItemProps extends AntdFormItemProps {
10
13
  avatar?: FormTitleProps['avatar'];
@@ -1,8 +1,8 @@
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 = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider"];
5
- var _templateObject, _templateObject2, _templateObject3;
4
+ var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider", "layout"];
5
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
6
6
  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; }
7
7
  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; }
8
8
  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; }
@@ -21,38 +21,45 @@ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  import { Fragment as _Fragment } from "react/jsx-runtime";
22
22
  import { jsxs as _jsxs } from "react/jsx-runtime";
23
23
  var Item = Form.Item;
24
- export var useStyles = createStyles(function (_ref, itemMinWidth) {
24
+ export var useStyles = createStyles(function (_ref, _ref2) {
25
25
  var css = _ref.css,
26
26
  responsive = _ref.responsive,
27
27
  prefixCls = _ref.prefixCls;
28
+ var minWidth = _ref2.minWidth;
28
29
  return {
29
30
  item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-form-item {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-form-item-label {\n text-align: start;\n }\n\n .", "-row {\n gap: 12px;\n justify-content: space-between;\n\n > div {\n flex: unset;\n flex-grow: unset;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", " {\n .", "-row {\n flex-direction: column;\n align-items: stretch;\n\n > div {\n width: 100%;\n }\n }\n }\n\n ", " {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls, responsive.md, prefixCls, responsive.mobile, prefixCls),
30
- itemMinWidth: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n ", " {\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), prefixCls, isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth, responsive.mobile, prefixCls, prefixCls),
31
- itemNoDivider: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-block-start: 0;\n }\n "])))
31
+ itemMinWidth: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n ", " {\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), prefixCls, isNumber(minWidth) ? "".concat(minWidth, "px") : minWidth, responsive.mobile, prefixCls, prefixCls),
32
+ itemNoDivider: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-block-start: 0;\n }\n "]))),
33
+ verticalLayout: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &.", "-form-item {\n .", "-row {\n align-items: stretch;\n }\n }\n "])), prefixCls, prefixCls)
32
34
  };
33
35
  });
34
- var FormItem = /*#__PURE__*/memo(function (_ref2) {
35
- var desc = _ref2.desc,
36
- tag = _ref2.tag,
37
- minWidth = _ref2.minWidth,
38
- avatar = _ref2.avatar,
39
- className = _ref2.className,
40
- label = _ref2.label,
41
- children = _ref2.children,
42
- divider = _ref2.divider,
43
- rest = _objectWithoutProperties(_ref2, _excluded);
44
- var _useStyles = useStyles(minWidth),
36
+ var FormItem = /*#__PURE__*/memo(function (_ref3) {
37
+ var desc = _ref3.desc,
38
+ tag = _ref3.tag,
39
+ minWidth = _ref3.minWidth,
40
+ avatar = _ref3.avatar,
41
+ className = _ref3.className,
42
+ label = _ref3.label,
43
+ children = _ref3.children,
44
+ divider = _ref3.divider,
45
+ layout = _ref3.layout,
46
+ rest = _objectWithoutProperties(_ref3, _excluded);
47
+ var _useStyles = useStyles({
48
+ minWidth: minWidth
49
+ }),
45
50
  cx = _useStyles.cx,
46
51
  styles = _useStyles.styles;
52
+ var isVertical = layout === 'vertical';
47
53
  return /*#__PURE__*/_jsxs(_Fragment, {
48
54
  children: [divider && /*#__PURE__*/_jsx(FormDivider, {}), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({
49
- className: cx(styles.item, Boolean(minWidth) && styles.itemMinWidth, !divider && styles.itemNoDivider, className),
55
+ className: cx(styles.item, Boolean(minWidth) && styles.itemMinWidth, !divider && styles.itemNoDivider, isVertical && styles.verticalLayout, className),
50
56
  label: /*#__PURE__*/_jsx(FormTitle, {
51
57
  avatar: avatar,
52
58
  desc: desc,
53
59
  tag: tag,
54
60
  title: label
55
- })
61
+ }),
62
+ layout: layout
56
63
  }, rest), {}, {
57
64
  children: children
58
65
  }))]
@@ -28,6 +28,7 @@ import Link from "../mdx/mdxComponents/Link";
28
28
  import Video from "../mdx/mdxComponents/Video";
29
29
  import { CodeFullFeatured, CodeLite } from "./CodeBlock";
30
30
  import { useStyles as useMarkdownStyles } from "./markdown.style";
31
+ import { rehypeKatexDir } from "./rehypePlugin";
31
32
  import { useStyles } from "./style";
32
33
  import { escapeBrackets, escapeMhchem, fixMarkdownBold } from "./utils";
33
34
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -108,7 +109,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
108
109
  }, [].concat(_toConsumableArray(Object.values(components || {})), _toConsumableArray(Object.values(componentProps || {})), [enableImageGallery, enableMermaid, fullFeaturedCodeBlock]));
109
110
  var innerRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : [rehypePlugins];
110
111
  var memoRehypePlugins = useMemo(function () {
111
- return [allowHtml && rehypeRaw, enableLatex && rehypeKatex].concat(_toConsumableArray(innerRehypePlugins)).filter(Boolean);
112
+ return [allowHtml && rehypeRaw, enableLatex && rehypeKatex, enableLatex && rehypeKatexDir].concat(_toConsumableArray(innerRehypePlugins)).filter(Boolean);
112
113
  }, [allowHtml, enableLatex].concat(_toConsumableArray(innerRehypePlugins)));
113
114
  var innerRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : [remarkPlugins];
114
115
  var memoRemarkPlugins = useMemo(function () {
@@ -0,0 +1,2 @@
1
+ import type { Node } from 'unist';
2
+ export declare const rehypeKatexDir: () => (tree: Node) => void;
@@ -0,0 +1,16 @@
1
+ // katex-directive
2
+ // 给 class="katex" 的节点加上 dir="ltr" 属性
3
+
4
+ import { visit } from 'unist-util-visit';
5
+
6
+ // eslint-disable-next-line unicorn/consistent-function-scoping
7
+ export var rehypeKatexDir = function rehypeKatexDir() {
8
+ return function (tree) {
9
+ visit(tree, 'element', function (node) {
10
+ var _node$properties;
11
+ if ((_node$properties = node.properties) !== null && _node$properties !== void 0 && (_node$properties = _node$properties.className) !== null && _node$properties !== void 0 && _node$properties.includes('katex')) {
12
+ node.properties.dir = 'ltr';
13
+ }
14
+ });
15
+ };
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.164.5",
3
+ "version": "1.164.7",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",