@lobehub/ui 1.1.0 → 1.2.0

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 (74) hide show
  1. package/README.md +6 -3
  2. package/es/ActionIcon/index.d.ts +19 -6
  3. package/es/ActionIcon/index.js +18 -47
  4. package/es/ActionIcon/style.d.ts +3 -0
  5. package/es/ActionIcon/style.js +10 -0
  6. package/es/DraggablePanel/index.d.ts +60 -0
  7. package/es/DraggablePanel/style.js +1 -1
  8. package/es/Icon/index.d.ts +21 -0
  9. package/es/Icon/index.js +36 -0
  10. package/es/Logo/Divider.d.ts +3 -0
  11. package/es/Logo/Divider.js +20 -0
  12. package/es/Logo/Logo3D.d.ts +1 -2
  13. package/es/Logo/LogoFlat.d.ts +1 -2
  14. package/es/Logo/LogoFlat.js +0 -1
  15. package/es/Logo/LogoHighContrast.d.ts +1 -2
  16. package/es/Logo/LogoHighContrast.js +0 -1
  17. package/es/Logo/LogoText.d.ts +1 -2
  18. package/es/Logo/index.d.ts +13 -1
  19. package/es/Logo/index.js +49 -5
  20. package/es/Logo/style.d.ts +4 -0
  21. package/es/Logo/style.js +10 -0
  22. package/es/SideNav/index.d.ts +9 -0
  23. package/es/StroyBook/index.d.ts +18 -0
  24. package/es/StroyBook/index.js +40 -0
  25. package/es/StroyBook/style.d.ts +5 -0
  26. package/es/StroyBook/style.js +12 -0
  27. package/es/TabsNav/index.d.ts +22 -0
  28. package/es/{Template → TabsNav}/index.js +12 -7
  29. package/es/TabsNav/style.d.ts +3 -0
  30. package/es/TabsNav/style.js +14 -0
  31. package/es/ThemeProvider/GlobalStyle.js +1 -1
  32. package/es/ThemeProvider/index.js +4 -0
  33. package/es/ThemeSwitch/index.d.ts +27 -0
  34. package/es/ThemeSwitch/index.js +64 -0
  35. package/es/index.d.ts +6 -3
  36. package/es/index.js +5 -2
  37. package/lib/ActionIcon/index.d.ts +19 -6
  38. package/lib/ActionIcon/index.js +7 -38
  39. package/lib/ActionIcon/style.d.ts +3 -0
  40. package/lib/ActionIcon/style.js +57 -0
  41. package/lib/DraggablePanel/index.d.ts +60 -0
  42. package/lib/DraggablePanel/style.js +1 -1
  43. package/lib/Icon/index.d.ts +21 -0
  44. package/lib/Icon/index.js +59 -0
  45. package/lib/Logo/Divider.d.ts +3 -0
  46. package/lib/Logo/Divider.js +51 -0
  47. package/lib/Logo/Logo3D.d.ts +1 -2
  48. package/lib/Logo/LogoFlat.d.ts +1 -2
  49. package/lib/Logo/LogoFlat.js +1 -1
  50. package/lib/Logo/LogoHighContrast.d.ts +1 -2
  51. package/lib/Logo/LogoHighContrast.js +6 -19
  52. package/lib/Logo/LogoText.d.ts +1 -2
  53. package/lib/Logo/index.d.ts +13 -1
  54. package/lib/Logo/index.js +18 -1
  55. package/lib/Logo/style.d.ts +4 -0
  56. package/lib/Logo/style.js +41 -0
  57. package/lib/SideNav/index.d.ts +9 -0
  58. package/lib/StroyBook/index.d.ts +18 -0
  59. package/lib/StroyBook/index.js +58 -0
  60. package/lib/StroyBook/style.d.ts +5 -0
  61. package/lib/StroyBook/style.js +75 -0
  62. package/lib/TabsNav/index.d.ts +22 -0
  63. package/lib/{Template → TabsNav}/index.js +11 -8
  64. package/lib/TabsNav/style.d.ts +3 -0
  65. package/lib/TabsNav/style.js +65 -0
  66. package/lib/ThemeProvider/GlobalStyle.js +7 -3
  67. package/lib/ThemeProvider/index.js +1 -1
  68. package/lib/ThemeSwitch/index.d.ts +27 -0
  69. package/lib/ThemeSwitch/index.js +67 -0
  70. package/lib/index.d.ts +6 -3
  71. package/lib/index.js +18 -5
  72. package/package.json +7 -6
  73. package/es/Template/index.d.ts +0 -7
  74. package/lib/Template/index.d.ts +0 -7
package/README.md CHANGED
@@ -66,17 +66,20 @@ $ pnpm start
66
66
 
67
67
  <!-- CONTRIBUTION GROUP -->
68
68
 
69
- > 📊 Total: <kbd>**3**</kbd>
69
+ > 📊 Total: <kbd>**4**</kbd>
70
70
 
71
71
  <a href="https://github.com/canisminor1990" title="canisminor1990">
72
72
  <img src="https://avatars.githubusercontent.com/u/17870709?v=4" width="50" />
73
73
  </a>
74
- <a href="https://github.com/actions-user" title="actions-user">
75
- <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
74
+ <a href="https://github.com/arvinxx" title="arvinxx">
75
+ <img src="https://avatars.githubusercontent.com/u/28616219?v=4" width="50" />
76
76
  </a>
77
77
  <a href="https://github.com/apps/dependabot" title="dependabot[bot]">
78
78
  <img src="https://avatars.githubusercontent.com/in/29110?v=4" width="50" />
79
79
  </a>
80
+ <a href="https://github.com/actions-user" title="actions-user">
81
+ <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
82
+ </a>
80
83
 
81
84
  <!-- CONTRIBUTION END -->
82
85
 
@@ -1,14 +1,27 @@
1
1
  import { DivProps } from "../types";
2
2
  import { LucideIcon } from 'lucide-react';
3
3
  import React from 'react';
4
+ export declare type ActionIconSize = 'large' | 'normal' | 'small' | {
5
+ blockSize?: number;
6
+ fontSize?: number;
7
+ strokeWidth?: number;
8
+ borderRadius?: number;
9
+ };
4
10
  export interface ActionIconProps extends DivProps {
11
+ /**
12
+ * @description Whether the icon is active or not
13
+ * @default false
14
+ */
5
15
  active?: boolean;
6
- size?: 'large' | 'normal' | 'small' | {
7
- blockSize: number;
8
- fontSize: number;
9
- strokeWidth: number;
10
- borderRadius: number;
11
- };
16
+ /**
17
+ * @description Size of the icon
18
+ * @default 'normal'
19
+ */
20
+ size?: ActionIconSize;
21
+ /**
22
+ * @description The icon element to be rendered
23
+ * @type LucideIcon
24
+ */
12
25
  icon: LucideIcon;
13
26
  }
14
27
  declare const _default: React.NamedExoticComponent<ActionIconProps>;
@@ -1,74 +1,45 @@
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";
4
- var _excluded = ["active", "icon", "size", "style"];
5
- var _templateObject;
3
+ var _excluded = ["className", "active", "icon", "size", "style"];
6
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { Icon } from "./..";
8
7
  import React from 'react';
9
- import styled from 'styled-components';
8
+ import { useStyles } from "./style";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
- var Block = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: all 0.2s ", ";\n\n &:hover {\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background: ", ";\n }\n"])), function (_ref) {
12
- var active = _ref.active,
13
- theme = _ref.theme;
14
- return active ? theme.colorText : theme.colorTextQuaternary;
15
- }, function (_ref2) {
16
- var active = _ref2.active,
17
- theme = _ref2.theme;
18
- return active ? theme.colorFill : 'transparent';
19
- }, function (_ref3) {
20
- var theme = _ref3.theme;
21
- return theme.motionEaseOut;
22
- }, function (_ref4) {
23
- var theme = _ref4.theme;
24
- return theme.colorFillTertiary;
25
- }, function (_ref5) {
26
- var theme = _ref5.theme;
27
- return theme.colorText;
28
- }, function (_ref6) {
29
- var theme = _ref6.theme;
30
- return theme.colorFill;
31
- });
32
- var ActionIcon = function ActionIcon(_ref7) {
33
- var active = _ref7.active,
34
- icon = _ref7.icon,
35
- _ref7$size = _ref7.size,
36
- size = _ref7$size === void 0 ? 'normal' : _ref7$size,
37
- style = _ref7.style,
38
- props = _objectWithoutProperties(_ref7, _excluded);
10
+ var ActionIcon = function ActionIcon(_ref) {
11
+ var className = _ref.className,
12
+ active = _ref.active,
13
+ icon = _ref.icon,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'normal' : _ref$size,
16
+ style = _ref.style,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+ var _useStyles = useStyles(active),
19
+ styles = _useStyles.styles,
20
+ cx = _useStyles.cx;
39
21
  var blockSize;
40
- var fontSize;
41
- var strokeWidth;
42
22
  var borderRadius;
43
- var Icon = icon;
44
23
  switch (size) {
45
24
  case 'large':
46
25
  blockSize = 44;
47
- fontSize = 24;
48
- strokeWidth = 2;
49
26
  borderRadius = 8;
50
27
  break;
51
28
  case 'normal':
52
29
  blockSize = 36;
53
- fontSize = 24;
54
- strokeWidth = 2;
55
30
  borderRadius = 5;
56
31
  break;
57
32
  case 'small':
58
33
  blockSize = 28;
59
- fontSize = 20;
60
- strokeWidth = 1.5;
61
34
  borderRadius = 5;
62
35
  break;
63
36
  default:
64
37
  blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
65
- fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
66
- strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
67
38
  borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
68
39
  break;
69
40
  }
70
- return /*#__PURE__*/_jsx(Block, _objectSpread(_objectSpread({
71
- active: active,
41
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
42
+ className: cx(styles.block, className),
72
43
  style: _objectSpread({
73
44
  width: blockSize,
74
45
  height: blockSize,
@@ -76,8 +47,8 @@ var ActionIcon = function ActionIcon(_ref7) {
76
47
  }, style)
77
48
  }, props), {}, {
78
49
  children: /*#__PURE__*/_jsx(Icon, {
79
- size: fontSize,
80
- strokeWidth: strokeWidth
50
+ size: size,
51
+ icon: icon
81
52
  })
82
53
  }));
83
54
  };
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ block: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref, active) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ block: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: color 600ms ", ", background-color 100ms ", ";\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), active ? token.colorText : token.colorTextQuaternary, active ? token.colorFill : 'transparent', token.motionEaseOut, token.motionEaseOut, token.colorText, token.colorFillTertiary, token.colorText, token.colorFill)
9
+ };
10
+ });
@@ -4,22 +4,82 @@ import React from 'react';
4
4
  import type { Props as RndProps } from 'react-rnd';
5
5
  export declare type placementType = 'right' | 'left' | 'top' | 'bottom';
6
6
  export interface DraggablePanelProps extends DivProps {
7
+ /**
8
+ * @description Whether the panel can be pinned or not
9
+ * @default true
10
+ */
7
11
  pin?: boolean;
12
+ /**
13
+ * @description The mode of the panel, fixed or float
14
+ * @default 'fixed'
15
+ */
8
16
  mode?: 'fixed' | 'float';
17
+ /**
18
+ * @description The placement of the panel, right, left, top or bottom
19
+ * @default 'right'
20
+ */
9
21
  placement: placementType;
22
+ /**
23
+ * @description The minimum width of the panel
24
+ */
10
25
  minWidth?: number;
26
+ /**
27
+ * @description The minimum height of the panel
28
+ */
11
29
  minHeight?: number;
30
+ /**
31
+ * @description Whether the panel can be resized or not
32
+ * @default true
33
+ */
12
34
  resize?: RndProps['enableResizing'];
35
+ /**
36
+ * @description The size of the panel
37
+ */
13
38
  size?: Partial<Size>;
39
+ /**
40
+ * @description Callback function when the size of the panel changes
41
+ */
14
42
  onSizeChange?: (delta: NumberSize, size?: Size) => void;
43
+ /**
44
+ * @description Callback function when the panel is being resized
45
+ */
15
46
  onSizeDragging?: (delta: NumberSize, size?: Size) => void;
47
+ /**
48
+ * @description Whether the panel is expandable or not
49
+ * @default true
50
+ */
16
51
  expandable?: boolean;
52
+ /**
53
+ * @description Whether the panel is expanded or not
54
+ */
17
55
  expand?: boolean;
56
+ /**
57
+ * @description The default expand state of the panel
58
+ * @default true
59
+ */
18
60
  defaultExpand?: boolean;
61
+ /**
62
+ * @description Callback function when the expand state of the panel changes
63
+ */
19
64
  onExpandChange?: (expand: boolean) => void;
65
+ /**
66
+ * @description The default size of the panel
67
+ */
20
68
  defaultSize?: Partial<Size>;
69
+ /**
70
+ * @description Whether the panel should be destroyed when closed or not
71
+ * @default false
72
+ */
21
73
  destroyOnClose?: boolean;
74
+ /**
75
+ * @description Whether the panel handler should be shown when unexpanded or not
76
+ * @default true
77
+ */
22
78
  showHandlerWhenUnexpand?: boolean;
79
+ /**
80
+ * @description The style of the panel handler
81
+ * @type CSSProperties
82
+ */
23
83
  hanlderStyle?: React.CSSProperties;
24
84
  }
25
85
  declare const _default: React.NamedExoticComponent<DraggablePanelProps>;
@@ -1,7 +1,7 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
3
3
  import { createStyles, css, cx } from 'antd-style';
4
- var offset = 16;
4
+ var offset = 17;
5
5
  var toggleLength = 40;
6
6
  var toggleShort = 16;
7
7
  export var useStyle = createStyles(function (_ref, prefix) {
@@ -0,0 +1,21 @@
1
+ import { SvgProps } from "../types";
2
+ import { LucideIcon } from 'lucide-react';
3
+ import React from 'react';
4
+ export declare type IconSize = 'large' | 'normal' | 'small' | {
5
+ fontSize?: number;
6
+ strokeWidth?: number;
7
+ };
8
+ export interface IconProps extends SvgProps {
9
+ /**
10
+ * @description Size of the icon
11
+ * @default 'normal'
12
+ */
13
+ size?: IconSize;
14
+ /**
15
+ * @description The icon element to be rendered
16
+ * @type LucideIcon
17
+ */
18
+ icon: LucideIcon;
19
+ }
20
+ declare const _default: React.NamedExoticComponent<IconProps>;
21
+ export default _default;
@@ -0,0 +1,36 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["icon", "size"];
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import React from 'react';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ var Icon = function Icon(_ref) {
9
+ var icon = _ref.icon,
10
+ _ref$size = _ref.size,
11
+ size = _ref$size === void 0 ? 'normal' : _ref$size,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ var fontSize;
14
+ var strokeWidth;
15
+ var SvgIcon = icon;
16
+ switch (size) {
17
+ case 'large':
18
+ case 'normal':
19
+ fontSize = 24;
20
+ strokeWidth = 2;
21
+ break;
22
+ case 'small':
23
+ fontSize = 20;
24
+ strokeWidth = 1.5;
25
+ break;
26
+ default:
27
+ fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
28
+ strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
29
+ break;
30
+ }
31
+ return /*#__PURE__*/_jsx(SvgIcon, _objectSpread({
32
+ size: fontSize,
33
+ strokeWidth: strokeWidth
34
+ }, props));
35
+ };
36
+ export default /*#__PURE__*/React.memo(Icon);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.NamedExoticComponent<any>;
3
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import React from 'react';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var Divider = function Divider(props) {
7
+ return /*#__PURE__*/_jsx("svg", _objectSpread(_objectSpread({
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeLinecap: "round",
11
+ strokeLinejoin: "round",
12
+ shapeRendering: "geometricPrecision",
13
+ viewBox: "0 0 24 24"
14
+ }, props), {}, {
15
+ children: /*#__PURE__*/_jsx("path", {
16
+ d: "M16.88 3.549L7.12 20.451"
17
+ })
18
+ }));
19
+ };
20
+ export default /*#__PURE__*/React.memo(Divider);
@@ -1,4 +1,3 @@
1
- import { ImgProps } from "../types";
2
1
  import React from 'react';
3
- declare const _default: React.NamedExoticComponent<ImgProps>;
2
+ declare const _default: React.NamedExoticComponent<any>;
4
3
  export default _default;
@@ -1,4 +1,3 @@
1
- import { SvgProps } from "../types";
2
1
  import React from 'react';
3
- declare const _default: React.NamedExoticComponent<SvgProps>;
2
+ declare const _default: React.NamedExoticComponent<any>;
4
3
  export default _default;
@@ -6,7 +6,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var LogoFlat = function LogoFlat(props) {
8
8
  return /*#__PURE__*/_jsxs("svg", _objectSpread(_objectSpread({
9
- xmlns: "http://www.w3.org/2000/svg",
10
9
  fill: "none",
11
10
  viewBox: "0 0 320 320"
12
11
  }, props), {}, {
@@ -1,4 +1,3 @@
1
- import { SvgProps } from "../types";
2
1
  import React from 'react';
3
- declare const _default: React.NamedExoticComponent<SvgProps>;
2
+ declare const _default: React.NamedExoticComponent<any>;
4
3
  export default _default;
@@ -6,7 +6,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var LogoHighContrast = function LogoHighContrast(props) {
8
8
  return /*#__PURE__*/_jsxs("svg", _objectSpread(_objectSpread({
9
- xmlns: "http://www.w3.org/2000/svg",
10
9
  viewBox: "0 0 320 320",
11
10
  fill: "currentColor",
12
11
  fillRule: "evenodd"
@@ -1,4 +1,3 @@
1
- import { SvgProps } from "../types";
2
1
  import React from 'react';
3
- declare const _default: React.NamedExoticComponent<SvgProps>;
2
+ declare const _default: React.NamedExoticComponent<any>;
4
3
  export default _default;
@@ -1,8 +1,20 @@
1
1
  import { DivProps } from "../types";
2
2
  import React from 'react';
3
3
  export interface LogoProps extends DivProps {
4
- type?: '3d' | 'flat' | 'high-contrast' | 'text';
4
+ /**
5
+ * @description Type of the logo to be rendered
6
+ * @default '3d'
7
+ */
8
+ type?: '3d' | 'flat' | 'high-contrast' | 'text' | 'combine';
9
+ /**
10
+ * @description Size of the logo in pixels
11
+ * @default 32
12
+ */
5
13
  size?: number;
14
+ /**
15
+ * @description Additional React Node to be rendered next to the logo
16
+ */
17
+ extra?: React.ReactNode;
6
18
  }
7
19
  declare const _default: React.NamedExoticComponent<LogoProps>;
8
20
  export default _default;
package/es/Logo/index.js CHANGED
@@ -1,24 +1,35 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["type", "size", "style"];
3
+ var _excluded = ["type", "size", "style", "extra", "className"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { useTheme } from 'antd-style';
6
7
  import React from 'react';
8
+ import Divider from "./Divider";
7
9
  import Logo3D from "./Logo3D";
8
10
  import LogoFlat from "./LogoFlat";
9
11
  import LogoHighContrast from "./LogoHighContrast";
10
12
  import LogoText from "./LogoText";
13
+ import { useStyles } from "./style";
11
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
17
  var Logo = function Logo(_ref) {
13
18
  var _ref$type = _ref.type,
14
19
  type = _ref$type === void 0 ? '3d' : _ref$type,
15
20
  _ref$size = _ref.size,
16
21
  size = _ref$size === void 0 ? 32 : _ref$size,
17
22
  style = _ref.style,
23
+ extra = _ref.extra,
24
+ className = _ref.className,
18
25
  props = _objectWithoutProperties(_ref, _excluded);
26
+ var theme = useTheme();
27
+ var _useStyles = useStyles(),
28
+ styles = _useStyles.styles,
29
+ cx = _useStyles.cx;
30
+ var logoComponent;
19
31
  switch (type) {
20
32
  case '3d':
21
- // @ts-ignore
22
33
  return /*#__PURE__*/_jsx(Logo3D, _objectSpread({
23
34
  style: _objectSpread({
24
35
  height: size,
@@ -26,7 +37,6 @@ var Logo = function Logo(_ref) {
26
37
  }, style)
27
38
  }, props));
28
39
  case 'flat':
29
- // @ts-ignore
30
40
  return /*#__PURE__*/_jsx(LogoFlat, _objectSpread({
31
41
  style: _objectSpread({
32
42
  height: size,
@@ -34,7 +44,6 @@ var Logo = function Logo(_ref) {
34
44
  }, style)
35
45
  }, props));
36
46
  case 'high-contrast':
37
- // @ts-ignore
38
47
  return /*#__PURE__*/_jsx(LogoHighContrast, _objectSpread({
39
48
  style: _objectSpread({
40
49
  height: size,
@@ -42,13 +51,48 @@ var Logo = function Logo(_ref) {
42
51
  }, style)
43
52
  }, props));
44
53
  case 'text':
45
- // @ts-ignore
46
54
  return /*#__PURE__*/_jsx(LogoText, _objectSpread({
47
55
  style: _objectSpread({
48
56
  height: size,
49
57
  width: 'auto'
50
58
  }, style)
51
59
  }, props));
60
+ case 'combine':
61
+ logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
62
+ children: [/*#__PURE__*/_jsx(Logo3D, {
63
+ style: {
64
+ height: size,
65
+ width: size
66
+ }
67
+ }), /*#__PURE__*/_jsx(LogoText, {
68
+ style: {
69
+ marginLeft: Math.round(size / 4),
70
+ height: size,
71
+ width: 'auto'
72
+ }
73
+ })]
74
+ });
52
75
  }
76
+ var extraSize = Math.round(size / 3 * 2);
77
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
78
+ className: cx(styles.flexCenter, className),
79
+ style: style
80
+ }, props), {}, {
81
+ children: [logoComponent, extra && /*#__PURE__*/_jsxs(_Fragment, {
82
+ children: [/*#__PURE__*/_jsx(Divider, {
83
+ style: {
84
+ height: extraSize,
85
+ width: extraSize,
86
+ color: theme.colorBorder
87
+ }
88
+ }), /*#__PURE__*/_jsx("div", {
89
+ className: styles.extraTitle,
90
+ style: {
91
+ fontSize: extraSize
92
+ },
93
+ children: extra
94
+ })]
95
+ })]
96
+ }));
53
97
  };
54
98
  export default /*#__PURE__*/React.memo(Logo);
@@ -0,0 +1,4 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ flexCenter: import("antd-style").SerializedStyles;
3
+ extraTitle: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css;
6
+ return {
7
+ flexCenter: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n "]))),
8
+ extraTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n white-space: nowrap;\n font-weight: 200;\n "])))
9
+ };
10
+ });
@@ -1,8 +1,17 @@
1
1
  import { DivProps } from "../types";
2
2
  import React from 'react';
3
3
  export interface SideNavProps extends DivProps {
4
+ /**
5
+ * @description Avatar to be displayed at the top of the sidenav
6
+ */
4
7
  avatar?: React.ReactNode;
8
+ /**
9
+ * @description Actions to be displayed below the avatar
10
+ */
5
11
  topActions?: React.ReactNode;
12
+ /**
13
+ * @description Actions to be displayed at the bottom of the sidenav
14
+ */
6
15
  bottomActions: React.ReactNode;
7
16
  }
8
17
  declare const _default: React.NamedExoticComponent<SideNavProps>;
@@ -0,0 +1,18 @@
1
+ import { DivProps } from "../types";
2
+ import { useControls, useCreateStore } from 'leva';
3
+ import React from 'react';
4
+ export { useCreateStore, useControls };
5
+ export interface StroyBookProps extends DivProps {
6
+ /**
7
+ * @description The Leva store instance to be used by the component
8
+ * @type levaStore
9
+ */
10
+ levaStore: any;
11
+ /**
12
+ * @description If use padding around component
13
+ */
14
+ noPadding?: boolean;
15
+ }
16
+ export declare const StroyBook: React.FC<StroyBookProps>;
17
+ declare const _default: React.NamedExoticComponent<StroyBookProps>;
18
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["levaStore", "noPadding", "className", "children"];
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { DraggablePanel } from "./..";
7
+ import { LevaPanel, useControls, useCreateStore } from 'leva';
8
+ import React from 'react';
9
+ import { useStyles } from "./style";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ export { useCreateStore, useControls };
13
+ export var StroyBook = function StroyBook(_ref) {
14
+ var levaStore = _ref.levaStore,
15
+ noPadding = _ref.noPadding,
16
+ className = _ref.className,
17
+ children = _ref.children,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ var _useStyles = useStyles(noPadding),
20
+ styles = _useStyles.styles,
21
+ cx = _useStyles.cx;
22
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
23
+ className: cx(styles.editor, className)
24
+ }, props), {}, {
25
+ children: [/*#__PURE__*/_jsx("div", {
26
+ className: styles.left,
27
+ children: children
28
+ }), /*#__PURE__*/_jsxs(DraggablePanel, {
29
+ className: styles.right,
30
+ placement: "right",
31
+ children: [/*#__PURE__*/_jsx(LevaPanel, {
32
+ fill: true,
33
+ store: levaStore,
34
+ titleBar: false,
35
+ flat: true
36
+ }), ' ']
37
+ })]
38
+ }));
39
+ };
40
+ export default /*#__PURE__*/React.memo(StroyBook);
@@ -0,0 +1,5 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ editor: import("antd-style").SerializedStyles;
3
+ left: import("antd-style").SerializedStyles;
4
+ right: import("antd-style").SerializedStyles;
5
+ }>;
@@ -0,0 +1,12 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref, noPadding) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n width: inherit;\n min-height: inherit;\n "]))),
9
+ left: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n ", "\n "])), !noPadding && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
10
+ right: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n input:checked + label > svg {\n stroke: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.colorBgLayout, token.colorBorder)
11
+ };
12
+ });