@lobehub/ui 1.121.0 → 1.122.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 (79) hide show
  1. package/es/ActionIcon/index.js +4 -1
  2. package/es/ActionIcon/style.js +1 -1
  3. package/es/ActionIconGroup/index.js +4 -3
  4. package/es/ActionIconGroup/style.d.ts +0 -1
  5. package/es/ActionIconGroup/style.js +2 -3
  6. package/es/ColorScales/ScaleRow.js +5 -1
  7. package/es/ColorScales/index.js +14 -5
  8. package/es/ColorScales/style.d.ts +0 -1
  9. package/es/ColorScales/style.js +4 -5
  10. package/es/ContextMenu/index.d.ts +4 -17
  11. package/es/ContextMenu/index.js +6 -249
  12. package/es/DraggablePanel/components/DraggablePanelBody.js +4 -2
  13. package/es/DraggablePanel/components/DraggablePanelContainer.js +2 -1
  14. package/es/DraggablePanel/components/DraggablePanelFooter.js +8 -2
  15. package/es/DraggablePanel/components/DraggablePanelHeader.js +8 -2
  16. package/es/DraggablePanel/components/style.js +4 -4
  17. package/es/FluentEmoji/style.d.ts +0 -1
  18. package/es/FluentEmoji/style.js +3 -5
  19. package/es/Form/components/FormFooter.js +6 -6
  20. package/es/Form/components/FormGroup.d.ts +14 -1
  21. package/es/Form/components/FormGroup.js +57 -15
  22. package/es/Form/components/FormItem.d.ts +4 -0
  23. package/es/Form/components/FormItem.js +23 -11
  24. package/es/Form/components/FormTitle.d.ts +3 -0
  25. package/es/Form/components/FormTitle.js +19 -8
  26. package/es/Form/index.d.ts +5 -2
  27. package/es/Form/index.js +38 -17
  28. package/es/Form/style.d.ts +0 -1
  29. package/es/Form/style.js +2 -3
  30. package/es/GaussianBackground/index.d.ts +17 -0
  31. package/es/GaussianBackground/index.js +48 -0
  32. package/es/GaussianBackground/style.d.ts +5 -0
  33. package/es/GaussianBackground/style.js +11 -0
  34. package/es/GaussianBackground/useGaussianBackground.d.ts +7 -0
  35. package/es/GaussianBackground/useGaussianBackground.js +19 -0
  36. package/es/GaussianBackground/vendor/gaussianBackground.d.ts +38 -0
  37. package/es/GaussianBackground/vendor/gaussianBackground.js +222 -0
  38. package/es/GaussianBackground/vendor/stackBlur.d.ts +1 -0
  39. package/es/GaussianBackground/vendor/stackBlur.js +184 -0
  40. package/es/GaussianBackground/vendor/stackBlurTable.d.ts +2 -0
  41. package/es/GaussianBackground/vendor/stackBlurTable.js +2 -0
  42. package/es/Header/index.js +4 -1
  43. package/es/Header/style.js +1 -1
  44. package/es/Hero/index.js +4 -1
  45. package/es/Hero/style.js +1 -1
  46. package/es/Highlighter/SyntaxHighlighter/index.js +4 -2
  47. package/es/Highlighter/SyntaxHighlighter/style.js +1 -1
  48. package/es/List/ListItem/time.d.ts +0 -1
  49. package/es/List/ListItem/time.js +0 -4
  50. package/es/MessageModal/index.js +1 -1
  51. package/es/SideNav/index.js +5 -2
  52. package/es/SideNav/style.js +1 -1
  53. package/es/Snippet/index.js +6 -2
  54. package/es/Snippet/style.js +1 -1
  55. package/es/SpotlightCard/SpotlightCardItem.js +1 -1
  56. package/es/SpotlightCard/style.js +1 -1
  57. package/es/StoryBook/index.js +10 -3
  58. package/es/StoryBook/style.js +2 -2
  59. package/es/Tag/index.js +1 -1
  60. package/es/ThemeProvider/GlobalStyle/antdOverride.js +1 -1
  61. package/es/TokenTag/index.js +6 -1
  62. package/es/TokenTag/style.js +1 -1
  63. package/es/index.d.ts +1 -0
  64. package/es/index.js +1 -0
  65. package/package.json +1 -2
  66. package/es/ContextMenu/MenuItem/icons.d.ts +0 -4
  67. package/es/ContextMenu/MenuItem/icons.js +0 -73
  68. package/es/ContextMenu/MenuItem/index.d.ts +0 -12
  69. package/es/ContextMenu/MenuItem/index.js +0 -73
  70. package/es/ContextMenu/MenuItem/style.d.ts +0 -7
  71. package/es/ContextMenu/MenuItem/style.js +0 -16
  72. package/es/ContextMenu/style.d.ts +0 -4
  73. package/es/ContextMenu/style.js +0 -12
  74. package/es/ContextMenu/types/index.d.ts +0 -5
  75. package/es/ContextMenu/types/index.js +0 -2
  76. package/es/ContextMenu/types/menuItem.d.ts +0 -21
  77. package/es/ContextMenu/types/menuItem.js +0 -1
  78. package/es/Form/components/style.d.ts +0 -11
  79. package/es/Form/components/style.js +0 -23
@@ -1,35 +1,77 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["className", "icon", "title", "children", "extra"];
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
+ var _excluded = ["className", "icon", "title", "children", "extra", "itemsType", "variant", "defaultActive"];
5
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
4
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; }
5
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; }
6
8
  import { Icon } from "../..";
7
9
  import { Collapse } from 'antd';
8
- import { useResponsive } from 'antd-style';
10
+ import { createStyles, useResponsive } from 'antd-style';
9
11
  import { ChevronDown } from 'lucide-react';
10
12
  import { memo } from 'react';
11
13
  import { Flexbox } from 'react-layout-kit';
12
- import { useStyles } from "./style";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
- var FormGroup = /*#__PURE__*/memo(function (_ref) {
16
- var className = _ref.className,
17
- icon = _ref.icon,
18
- title = _ref.title,
19
- children = _ref.children,
20
- extra = _ref.extra,
21
- rest = _objectWithoutProperties(_ref, _excluded);
16
+ export var useStyles = createStyles(function (_ref, variant) {
17
+ var css = _ref.css,
18
+ cx = _ref.cx,
19
+ token = _ref.token,
20
+ isDarkMode = _ref.isDarkMode,
21
+ responsive = _ref.responsive,
22
+ prefixCls = _ref.prefixCls;
23
+ var pureStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n border-radius: 0;\n\n .", "-collapse-header {\n background: transparent !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n background: transparent;\n border-radius: 0;\n }\n "])), prefixCls, prefixCls);
24
+ var blockStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: ", ";\n border: none;\n border-radius: ", "px;\n\n .", "-collapse-content {\n border: none !important;\n }\n "])), token.colorFillQuaternary, token.borderRadiusLG, prefixCls);
25
+ var ghostStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: transparent;\n border: 1px solid ", ";\n .", "-collapse-header {\n background: transparent !important;\n }\n\n .", "-collapse-content-box {\n background: transparent;\n }\n "])), token.colorBorderSecondary, prefixCls, prefixCls);
26
+ var defaultStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.colorBorderSecondary, token.borderRadiusLG);
27
+ var variantStyle = cx(variant === 'default' && defaultStyle, variant === 'block' && blockStyle, variant === 'ghost' && ghostStyle, variant === 'pure' && pureStyle);
28
+ return {
29
+ flatGroup: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: hidden;\n padding-inline: 16px;\n "]))), variantStyle),
30
+ group: cx(isDarkMode && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .", "-collapse-content {\n background: transparent;\n border-color: ", ";\n }\n\n .", "-collapse-header {\n background: ", ";\n }\n "])), prefixCls, token.colorBorderSecondary, prefixCls, token.colorFillTertiary), css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n .", "-collapse-item {\n border: none;\n }\n\n .", "-collapse-header {\n align-items: center !important;\n border-radius: 0 !important;\n }\n\n .", "-collapse-content-box {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n }\n\n .", "-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls), variantStyle),
31
+ icon: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
32
+ mobileGroupBody: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 0 16px;\n background: ", ";\n "])), token.colorBgContainer),
33
+ mobileGroupHeader: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 16px;\n background: ", ";\n "])), token.colorBgLayout),
34
+ title: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n\n .anticon {\n color: ", ";\n }\n\n ", " {\n font-size: 14px;\n font-weight: 400;\n opacity: 0.5;\n }\n "])), token.colorPrimary, responsive.mobile)
35
+ };
36
+ });
37
+ var FormGroup = /*#__PURE__*/memo(function (_ref2) {
38
+ var className = _ref2.className,
39
+ icon = _ref2.icon,
40
+ title = _ref2.title,
41
+ children = _ref2.children,
42
+ extra = _ref2.extra,
43
+ itemsType = _ref2.itemsType,
44
+ _ref2$variant = _ref2.variant,
45
+ variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
46
+ _ref2$defaultActive = _ref2.defaultActive,
47
+ defaultActive = _ref2$defaultActive === void 0 ? true : _ref2$defaultActive,
48
+ rest = _objectWithoutProperties(_ref2, _excluded);
22
49
  var _useResponsive = useResponsive(),
23
50
  mobile = _useResponsive.mobile;
24
- var _useStyles = useStyles(),
51
+ var _useStyles = useStyles(variant),
25
52
  cx = _useStyles.cx,
26
53
  styles = _useStyles.styles;
27
- var titleContent = /*#__PURE__*/_jsxs("div", {
54
+ var titleContent = /*#__PURE__*/_jsxs(Flexbox, {
28
55
  className: styles.title,
56
+ gap: 8,
57
+ horizontal: true,
29
58
  children: [icon && /*#__PURE__*/_jsx(Icon, {
30
59
  icon: icon
31
60
  }), title]
32
61
  });
62
+ if (itemsType === 'flat') {
63
+ if (mobile) return /*#__PURE__*/_jsx(Flexbox, {
64
+ className: className,
65
+ children: /*#__PURE__*/_jsx("div", {
66
+ className: styles.mobileGroupBody,
67
+ children: children
68
+ })
69
+ });
70
+ return /*#__PURE__*/_jsx(Flexbox, {
71
+ className: cx(styles.flatGroup, className),
72
+ children: children
73
+ });
74
+ }
33
75
  if (mobile) return /*#__PURE__*/_jsxs(Flexbox, {
34
76
  className: className,
35
77
  children: [/*#__PURE__*/_jsxs(Flexbox, {
@@ -44,9 +86,9 @@ var FormGroup = /*#__PURE__*/memo(function (_ref) {
44
86
  });
45
87
  return /*#__PURE__*/_jsx(Collapse, _objectSpread({
46
88
  className: cx(styles.group, className),
47
- defaultActiveKey: [1],
48
- expandIcon: function expandIcon(_ref2) {
49
- var isActive = _ref2.isActive;
89
+ defaultActiveKey: defaultActive ? [1] : undefined,
90
+ expandIcon: function expandIcon(_ref3) {
91
+ var isActive = _ref3.isActive;
50
92
  return /*#__PURE__*/_jsx(Icon, {
51
93
  className: styles.icon,
52
94
  icon: ChevronDown,
@@ -1,6 +1,10 @@
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<{
5
+ item: import("antd-style").SerializedStyles;
6
+ itemNoDivider: import("antd-style").SerializedStyles;
7
+ }>;
4
8
  export interface FormItemProps extends AntdFormItemProps {
5
9
  avatar?: FormTitleProps['avatar'];
6
10
  desc?: FormTitleProps['desc'];
@@ -1,27 +1,39 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
3
4
  var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider"];
5
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
4
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; }
5
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; }
6
8
  import { Form } from 'antd';
9
+ import { createStyles } from 'antd-style';
10
+ import { isNumber } from 'lodash-es';
7
11
  import { memo } from 'react';
8
12
  import FormDivider from "./FormDivider";
9
13
  import FormTitle from "./FormTitle";
10
- import { useStyles } from "./style";
11
14
  import { jsx as _jsx } from "react/jsx-runtime";
12
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
17
  var Item = Form.Item;
15
- var FormItem = /*#__PURE__*/memo(function (_ref) {
16
- var desc = _ref.desc,
17
- tag = _ref.tag,
18
- minWidth = _ref.minWidth,
19
- avatar = _ref.avatar,
20
- className = _ref.className,
21
- label = _ref.label,
22
- children = _ref.children,
23
- divider = _ref.divider,
24
- rest = _objectWithoutProperties(_ref, _excluded);
18
+ export var useStyles = createStyles(function (_ref, itemMinWidth) {
19
+ var css = _ref.css,
20
+ responsive = _ref.responsive,
21
+ prefixCls = _ref.prefixCls;
22
+ return {
23
+ item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 16px 0;\n\n .", "-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", "\n\n ", " {\n padding: 16px 0;\n\n ", "\n }\n "])), prefixCls, prefixCls, itemMinWidth && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n "])), prefixCls, isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth), responsive.mobile, itemMinWidth ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n "])), prefixCls, prefixCls) : css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n "])), prefixCls)),
24
+ itemNoDivider: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-top: 0;\n }\n "])))
25
+ };
26
+ });
27
+ var FormItem = /*#__PURE__*/memo(function (_ref2) {
28
+ var desc = _ref2.desc,
29
+ tag = _ref2.tag,
30
+ minWidth = _ref2.minWidth,
31
+ avatar = _ref2.avatar,
32
+ className = _ref2.className,
33
+ label = _ref2.label,
34
+ children = _ref2.children,
35
+ divider = _ref2.divider,
36
+ rest = _objectWithoutProperties(_ref2, _excluded);
25
37
  var _useStyles = useStyles(minWidth),
26
38
  cx = _useStyles.cx,
27
39
  styles = _useStyles.styles;
@@ -1,5 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DivProps } from "../../types";
3
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
4
+ formTitle: import("antd-style").SerializedStyles;
5
+ }>;
3
6
  export interface FormTitleProps extends DivProps {
4
7
  avatar?: ReactNode;
5
8
  desc?: ReactNode;
@@ -1,20 +1,31 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { createStyles } from 'antd-style';
1
4
  import { memo } from 'react';
2
5
  import { Flexbox } from 'react-layout-kit';
3
6
  import Tag from "../../Tag";
4
- import { useStyles } from "./style";
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
- var FormTitle = /*#__PURE__*/memo(function (_ref) {
8
- var className = _ref.className,
9
- tag = _ref.tag,
10
- title = _ref.title,
11
- desc = _ref.desc,
12
- avatar = _ref.avatar;
9
+ export var useStyles = createStyles(function (_ref) {
10
+ var css = _ref.css,
11
+ token = _ref.token,
12
+ prefixCls = _ref.prefixCls;
13
+ return {
14
+ formTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n text-align: left;\n\n > div {\n font-weight: 500;\n line-height: 1;\n }\n\n > small {\n display: block;\n\n line-height: 1.2;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n\n .", "-tag {\n font-family: ", ";\n }\n "])), token.colorTextDescription, prefixCls, token.fontFamilyCode)
15
+ };
16
+ });
17
+ var FormTitle = /*#__PURE__*/memo(function (_ref2) {
18
+ var className = _ref2.className,
19
+ tag = _ref2.tag,
20
+ title = _ref2.title,
21
+ desc = _ref2.desc,
22
+ avatar = _ref2.avatar;
13
23
  var _useStyles = useStyles(),
14
24
  cx = _useStyles.cx,
15
25
  styles = _useStyles.styles;
16
- var titleNode = /*#__PURE__*/_jsxs("div", {
26
+ var titleNode = /*#__PURE__*/_jsxs(Flexbox, {
17
27
  className: cx(styles.formTitle, className),
28
+ gap: 6,
18
29
  children: [/*#__PURE__*/_jsxs(Flexbox, {
19
30
  align: 'center',
20
31
  direction: 'horizontal',
@@ -1,9 +1,10 @@
1
1
  import { FormProps as AntFormProps, type FormInstance } from 'antd';
2
2
  import { type ReactNode, RefAttributes } from 'react';
3
- import FormGroup, { type FormGroupProps } from './components/FormGroup';
3
+ import FormGroup, { type FormGroupProps, FormVariant, ItemsType } from './components/FormGroup';
4
4
  import FormItem, { type FormItemProps } from './components/FormItem';
5
5
  export interface ItemGroup {
6
6
  children: FormItemProps[] | ReactNode;
7
+ defaultActive?: boolean;
7
8
  extra?: FormGroupProps['extra'];
8
9
  icon?: FormGroupProps['icon'];
9
10
  title: FormGroupProps['title'];
@@ -12,7 +13,9 @@ export interface FormProps extends AntFormProps {
12
13
  children?: ReactNode;
13
14
  footer?: ReactNode;
14
15
  itemMinWidth?: FormItemProps['minWidth'];
15
- items?: ItemGroup[];
16
+ items?: ItemGroup[] | FormItemProps[];
17
+ itemsType?: ItemsType;
18
+ variant?: FormVariant;
16
19
  }
17
20
  export interface IForm {
18
21
  (props: FormProps & RefAttributes<FormInstance>): ReactNode;
package/es/Form/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children"];
3
+ var _excluded = ["className", "itemMinWidth", "footer", "form", "items", "children", "itemsType", "variant"];
4
4
  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; }
5
5
  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; }
6
6
  import { Form as AntForm } from 'antd';
@@ -16,12 +16,37 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
16
  itemMinWidth = _ref.itemMinWidth,
17
17
  footer = _ref.footer,
18
18
  form = _ref.form,
19
- items = _ref.items,
19
+ _ref$items = _ref.items,
20
+ items = _ref$items === void 0 ? [] : _ref$items,
20
21
  children = _ref.children,
22
+ _ref$itemsType = _ref.itemsType,
23
+ itemsType = _ref$itemsType === void 0 ? 'tree' : _ref$itemsType,
24
+ _ref$variant = _ref.variant,
25
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
21
26
  rest = _objectWithoutProperties(_ref, _excluded);
22
27
  var _useStyles = useStyles(),
23
28
  cx = _useStyles.cx,
24
29
  styles = _useStyles.styles;
30
+ var mapFlat = function mapFlat(item, itemIndex) {
31
+ return /*#__PURE__*/_jsx(FormItem, _objectSpread({
32
+ divider: itemIndex !== 0,
33
+ minWidth: itemMinWidth
34
+ }, item), itemIndex);
35
+ };
36
+ var mapTree = function mapTree(group, groupIndex) {
37
+ return /*#__PURE__*/_jsx(FormGroup, {
38
+ defaultActive: group === null || group === void 0 ? void 0 : group.defaultActive,
39
+ extra: group === null || group === void 0 ? void 0 : group.extra,
40
+ icon: group === null || group === void 0 ? void 0 : group.icon,
41
+ title: group.title,
42
+ variant: variant,
43
+ children: Array.isArray(group.children) ? group.children.filter(function (item) {
44
+ return !item.hidden;
45
+ }).map(function (item, i) {
46
+ return mapFlat(item, i);
47
+ }) : group.children
48
+ }, groupIndex);
49
+ };
25
50
  return /*#__PURE__*/_jsxs(AntForm, _objectSpread(_objectSpread({
26
51
  className: cx(styles.form, className),
27
52
  colon: false,
@@ -29,21 +54,17 @@ var FormParent = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
54
  layout: "horizontal",
30
55
  ref: ref
31
56
  }, rest), {}, {
32
- children: [items === null || items === void 0 ? void 0 : items.map(function (group, groupIndex) {
33
- return /*#__PURE__*/_jsx(FormGroup, {
34
- extra: group === null || group === void 0 ? void 0 : group.extra,
35
- icon: group === null || group === void 0 ? void 0 : group.icon,
36
- title: group.title,
37
- children: Array.isArray(group.children) ? group.children.filter(function (item) {
38
- return !item.hidden;
39
- }).map(function (item, itemIndex) {
40
- return /*#__PURE__*/_jsx(FormItem, _objectSpread({
41
- divider: itemIndex !== 0,
42
- minWidth: itemMinWidth
43
- }, item), itemIndex);
44
- }) : group.children
45
- }, groupIndex);
46
- }), children, footer && /*#__PURE__*/_jsx(FormFooter, {
57
+ children: [(items === null || items === void 0 ? void 0 : items.length) > 0 ? itemsType === 'tree' ? items === null || items === void 0 ? void 0 : items.map(function (item, i) {
58
+ return mapTree(item, i);
59
+ }) : /*#__PURE__*/_jsx(FormGroup, {
60
+ itemsType: 'flat',
61
+ variant: variant,
62
+ children: items === null || items === void 0 ? void 0 : items.filter(function (item) {
63
+ return !item.hidden;
64
+ }).map(function (item, i) {
65
+ return mapFlat(item, i);
66
+ })
67
+ }) : null, children, footer && /*#__PURE__*/_jsx(FormFooter, {
47
68
  children: footer
48
69
  })]
49
70
  }));
@@ -1,4 +1,3 @@
1
1
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
- footer: import("antd-style").SerializedStyles;
3
2
  form: import("antd-style").SerializedStyles;
4
3
  }>;
package/es/Form/style.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2;
2
+ var _templateObject;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref) {
5
5
  var css = _ref.css,
@@ -7,7 +7,6 @@ export var useStyles = createStyles(function (_ref) {
7
7
  prefixCls = _ref.prefixCls,
8
8
  responsive = _ref.responsive;
9
9
  return {
10
- footer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n "]))),
11
- form: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n ", " {\n gap: 0;\n }\n\n .", "-form-item {\n margin: 0 !important;\n }\n\n .", "-form-item .", "-form-item-label > label {\n height: unset;\n }\n\n .", "-row {\n position: relative;\n flex-wrap: nowrap;\n }\n\n .", "-form-item-label {\n position: relative;\n flex: 1;\n max-width: 100%;\n }\n\n .", "-form-item-control {\n position: relative;\n flex: 0;\n min-width: unset !important;\n }\n\n .", "-collapse-item {\n overflow: hidden !important;\n border-radius: ", "px !important;\n }\n "])), responsive.mobile, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, token.borderRadius)
10
+ form: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n width: 100%;\n\n ", " {\n gap: 0;\n }\n\n .", "-form-item {\n margin: 0 !important;\n }\n\n .", "-form-item .", "-form-item-label > label {\n height: unset;\n }\n\n .", "-row {\n position: relative;\n flex-wrap: nowrap;\n }\n\n .", "-form-item-label {\n position: relative;\n flex: 1;\n max-width: 100%;\n }\n\n .", "-form-item-row {\n align-items: center;\n }\n\n .", "-form-item-control {\n position: relative;\n\n display: flex;\n flex: 0;\n align-items: center;\n\n min-width: unset !important;\n }\n\n .", "-collapse-item {\n overflow: hidden !important;\n border-radius: ", "px !important;\n }\n "])), responsive.mobile, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, token.borderRadius)
12
11
  };
13
12
  });
@@ -0,0 +1,17 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { DivProps } from "../types";
3
+ import { ColorLayer } from './vendor/gaussianBackground';
4
+ export interface GaussianBackgroundProps extends PropsWithChildren, DivProps {
5
+ classNames?: {
6
+ canvas?: string;
7
+ content?: string;
8
+ };
9
+ layers: ColorLayer[];
10
+ options?: {
11
+ blurRadius?: number;
12
+ fpsCap?: number;
13
+ scale?: number;
14
+ };
15
+ }
16
+ declare const GaussianBackground: import("react").NamedExoticComponent<GaussianBackgroundProps>;
17
+ export default GaussianBackground;
@@ -0,0 +1,48 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["layers", "options", "className", "children", "classNames", "style"];
4
+ 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; }
5
+ 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; }
6
+ import { memo, useEffect, useRef } from 'react';
7
+ import { Flexbox } from 'react-layout-kit';
8
+ import { useGaussianBackground } from "./useGaussianBackground";
9
+ import { useStyles } from "./style";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var DEFAULT_OPTIONS = {
13
+ blurRadius: 16,
14
+ fpsCap: 60,
15
+ scale: 16
16
+ };
17
+ var GaussianBackground = /*#__PURE__*/memo(function (_ref) {
18
+ var layers = _ref.layers,
19
+ _ref$options = _ref.options,
20
+ options = _ref$options === void 0 ? DEFAULT_OPTIONS : _ref$options,
21
+ className = _ref.className,
22
+ children = _ref.children,
23
+ classNames = _ref.classNames,
24
+ style = _ref.style,
25
+ rest = _objectWithoutProperties(_ref, _excluded);
26
+ var ref = useRef(null);
27
+ var _useStyles = useStyles(),
28
+ cx = _useStyles.cx,
29
+ styles = _useStyles.styles;
30
+ var run = useGaussianBackground(ref);
31
+ useEffect(function () {
32
+ if (!run) return;
33
+ run(layers, options);
34
+ }, [run, options, layers]);
35
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
36
+ className: cx(styles.container, className),
37
+ style: style
38
+ }, rest), {}, {
39
+ children: [/*#__PURE__*/_jsx("canvas", {
40
+ className: cx(styles.canvas, classNames === null || classNames === void 0 ? void 0 : classNames.canvas),
41
+ ref: ref
42
+ }), /*#__PURE__*/_jsx(Flexbox, {
43
+ className: cx(styles.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
44
+ children: children
45
+ })]
46
+ }));
47
+ });
48
+ export default GaussianBackground;
@@ -0,0 +1,5 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ canvas: import("antd-style").SerializedStyles;
3
+ container: import("antd-style").SerializedStyles;
4
+ content: import("antd-style").SerializedStyles;
5
+ }>;
@@ -0,0 +1,11 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css;
6
+ return {
7
+ canvas: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n "]))),
8
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 100%;\n "]))),
9
+ content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n width: 100%;\n height: 100%;\n "])))
10
+ };
11
+ });
@@ -0,0 +1,7 @@
1
+ import { RefObject } from 'react';
2
+ import { ColorLayer } from './vendor/gaussianBackground';
3
+ export declare const useGaussianBackground: (ref: RefObject<HTMLCanvasElement>) => (layers: ColorLayer[], options?: {
4
+ blurRadius?: number;
5
+ fpsCap?: number;
6
+ scale?: number;
7
+ }) => void;
@@ -0,0 +1,19 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import GaussianBackgroundClient from "./vendor/gaussianBackground";
4
+ export var useGaussianBackground = function useGaussianBackground(ref) {
5
+ var _useState = useState(),
6
+ _useState2 = _slicedToArray(_useState, 2),
7
+ client = _useState2[0],
8
+ setClient = _useState2[1];
9
+ useEffect(function () {
10
+ if (!ref.current) return;
11
+ setClient(new GaussianBackgroundClient(ref.current));
12
+ }, []);
13
+ var handleRun = useCallback(function (layers, options) {
14
+ if (!client) return;
15
+ if (options) client.updateOptions(options);
16
+ client.run(layers);
17
+ }, [client]);
18
+ return handleRun;
19
+ };
@@ -0,0 +1,38 @@
1
+ export interface ColorLayer {
2
+ color: string;
3
+ maxVelocity?: number;
4
+ orbs?: number;
5
+ radius?: number;
6
+ splitX?: number;
7
+ splitY?: number;
8
+ }
9
+ export interface GaussianBackgroundOptions {
10
+ blurRadius?: number;
11
+ fpsCap?: number;
12
+ scale?: number;
13
+ }
14
+ declare class GaussianBackground {
15
+ private fpsAverage?;
16
+ private canvas;
17
+ private context;
18
+ private animationFrame;
19
+ private timestep;
20
+ private firstCallTime;
21
+ private lastCallTime;
22
+ private timeElapsed;
23
+ private fpsTotal;
24
+ private layers;
25
+ private options;
26
+ constructor(node: HTMLCanvasElement, options?: GaussianBackgroundOptions);
27
+ run(layers: ColorLayer[]): void;
28
+ private generateLayer;
29
+ private createOrb;
30
+ private displayLoop;
31
+ drawBackground(): void;
32
+ private drawBlur;
33
+ private updateLayers;
34
+ updateOptions({ blurRadius, fpsCap, scale, }: Partial<GaussianBackgroundOptions>): void;
35
+ prototype(): void;
36
+ play(): void;
37
+ }
38
+ export default GaussianBackground;