@lobehub/ui 1.2.0 → 1.3.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 (179) hide show
  1. package/es/ActionIcon/index.d.ts +10 -5
  2. package/es/ActionIcon/index.js +15 -7
  3. package/es/ActionIcon/style.d.ts +4 -1
  4. package/es/ActionIcon/style.js +5 -3
  5. package/es/CopyButton/index.d.ts +34 -0
  6. package/es/CopyButton/index.js +49 -0
  7. package/es/DraggablePanel/index.d.ts +4 -4
  8. package/es/DraggablePanel/index.js +4 -4
  9. package/es/DraggablePanel/style.js +2 -2
  10. package/es/DraggablePanel/utils.d.ts +1 -1
  11. package/es/EditableText/ControlInput.d.ts +9 -0
  12. package/es/EditableText/ControlInput.js +88 -0
  13. package/es/EditableText/index.d.ts +5 -0
  14. package/es/EditableText/index.js +35 -0
  15. package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  16. package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
  17. package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  18. package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
  19. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  20. package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
  21. package/es/Highlighter/index.d.ts +36 -0
  22. package/es/Highlighter/index.js +42 -0
  23. package/es/Highlighter/style.d.ts +5 -0
  24. package/es/Highlighter/style.js +18 -0
  25. package/es/Icon/index.d.ts +2 -3
  26. package/es/Icon/index.js +2 -2
  27. package/es/Logo/Divider.d.ts +3 -3
  28. package/es/Logo/Divider.js +6 -4
  29. package/es/Logo/Logo3D.d.ts +3 -3
  30. package/es/Logo/Logo3D.js +6 -4
  31. package/es/Logo/LogoFlat.d.ts +3 -3
  32. package/es/Logo/LogoFlat.js +6 -4
  33. package/es/Logo/LogoHighContrast.d.ts +3 -3
  34. package/es/Logo/LogoHighContrast.js +6 -4
  35. package/es/Logo/LogoText.d.ts +3 -3
  36. package/es/Logo/LogoText.js +6 -4
  37. package/es/Logo/index.d.ts +3 -3
  38. package/es/Logo/index.js +5 -5
  39. package/es/Logo/style.js +1 -1
  40. package/es/Markdown/Code.d.ts +3 -0
  41. package/es/Markdown/Code.js +12 -0
  42. package/es/Markdown/CodeBlock.d.ts +3 -0
  43. package/es/Markdown/CodeBlock.js +27 -0
  44. package/es/Markdown/index.d.ts +13 -0
  45. package/es/Markdown/index.js +28 -0
  46. package/es/Markdown/style.d.ts +4 -0
  47. package/es/Markdown/style.js +12 -0
  48. package/es/MessageInput/index.d.ts +35 -0
  49. package/es/MessageInput/index.js +63 -0
  50. package/es/SearchBar/index.d.ts +5 -0
  51. package/es/SearchBar/index.js +27 -0
  52. package/es/SideNav/index.d.ts +6 -6
  53. package/es/SideNav/index.js +17 -20
  54. package/es/SideNav/style.d.ts +1 -0
  55. package/es/SideNav/style.js +8 -0
  56. package/es/Snippet/index.d.ts +29 -0
  57. package/es/Snippet/index.js +39 -0
  58. package/es/Snippet/style.d.ts +1 -0
  59. package/es/Snippet/style.js +9 -0
  60. package/es/StroyBook/index.d.ts +3 -4
  61. package/es/StroyBook/index.js +14 -7
  62. package/es/StroyBook/style.d.ts +4 -1
  63. package/es/StroyBook/style.js +7 -5
  64. package/es/Swatches/index.d.ts +8 -0
  65. package/es/Swatches/index.js +44 -0
  66. package/es/TabsNav/index.d.ts +3 -3
  67. package/es/TabsNav/index.js +4 -4
  68. package/es/ThemeProvider/GlobalStyle.js +1 -1
  69. package/es/ThemeProvider/index.d.ts +15 -0
  70. package/es/ThemeSwitch/index.d.ts +5 -5
  71. package/es/ThemeSwitch/index.js +5 -9
  72. package/es/Tooltip/index.d.ts +5 -0
  73. package/es/Tooltip/index.js +20 -0
  74. package/es/Tooltip/style.d.ts +3 -0
  75. package/es/Tooltip/style.js +10 -0
  76. package/es/hooks/useCopied.d.ts +4 -0
  77. package/es/hooks/useCopied.js +26 -0
  78. package/es/hooks/useHighlight.d.ts +36 -0
  79. package/es/hooks/useHighlight.js +63 -0
  80. package/es/index.d.ts +9 -0
  81. package/es/index.js +10 -1
  82. package/es/styles/theme/base.d.ts +2 -0
  83. package/es/styles/theme/base.js +15 -0
  84. package/es/styles/theme/dark.js +6 -14
  85. package/es/styles/theme/light.js +11 -12
  86. package/es/types/index.d.ts +14 -5
  87. package/lib/ActionIcon/index.d.ts +10 -5
  88. package/lib/ActionIcon/index.js +39 -50
  89. package/lib/ActionIcon/style.d.ts +4 -1
  90. package/lib/ActionIcon/style.js +29 -22
  91. package/lib/CopyButton/index.d.ts +34 -0
  92. package/lib/CopyButton/index.js +70 -0
  93. package/lib/DraggablePanel/index.d.ts +4 -4
  94. package/lib/DraggablePanel/index.js +160 -158
  95. package/lib/DraggablePanel/style.js +1 -2
  96. package/lib/DraggablePanel/utils.d.ts +1 -1
  97. package/lib/EditableText/ControlInput.d.ts +9 -0
  98. package/lib/EditableText/ControlInput.js +101 -0
  99. package/lib/EditableText/index.d.ts +5 -0
  100. package/lib/EditableText/index.js +52 -0
  101. package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  102. package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
  103. package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  104. package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
  105. package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  106. package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
  107. package/lib/Highlighter/index.d.ts +36 -0
  108. package/lib/Highlighter/index.js +62 -0
  109. package/lib/Highlighter/style.d.ts +5 -0
  110. package/lib/Highlighter/style.js +107 -0
  111. package/lib/Icon/index.d.ts +2 -3
  112. package/lib/Icon/index.js +3 -13
  113. package/lib/Logo/Divider.d.ts +3 -3
  114. package/lib/Logo/Divider.js +5 -15
  115. package/lib/Logo/Logo3D.d.ts +3 -3
  116. package/lib/Logo/Logo3D.js +4 -14
  117. package/lib/Logo/LogoFlat.d.ts +3 -3
  118. package/lib/Logo/LogoFlat.js +18 -28
  119. package/lib/Logo/LogoHighContrast.d.ts +3 -3
  120. package/lib/Logo/LogoHighContrast.js +4 -14
  121. package/lib/Logo/LogoText.d.ts +3 -3
  122. package/lib/Logo/LogoText.js +5 -15
  123. package/lib/Logo/index.d.ts +3 -3
  124. package/lib/Logo/index.js +11 -18
  125. package/lib/Logo/style.js +1 -1
  126. package/lib/Markdown/Code.d.ts +3 -0
  127. package/lib/Markdown/Code.js +33 -0
  128. package/lib/Markdown/CodeBlock.d.ts +3 -0
  129. package/lib/Markdown/CodeBlock.js +64 -0
  130. package/lib/Markdown/index.d.ts +13 -0
  131. package/lib/Markdown/index.js +48 -0
  132. package/lib/Markdown/style.d.ts +4 -0
  133. package/lib/Markdown/style.js +64 -0
  134. package/lib/MessageInput/index.d.ts +35 -0
  135. package/lib/MessageInput/index.js +58 -0
  136. package/lib/SearchBar/index.d.ts +5 -0
  137. package/lib/SearchBar/index.js +42 -0
  138. package/lib/SideNav/index.d.ts +6 -6
  139. package/lib/SideNav/index.js +7 -31
  140. package/lib/SideNav/style.d.ts +1 -0
  141. package/lib/SideNav/style.js +46 -0
  142. package/lib/Snippet/index.d.ts +29 -0
  143. package/lib/Snippet/index.js +47 -0
  144. package/lib/Snippet/style.d.ts +1 -0
  145. package/lib/Snippet/style.js +71 -0
  146. package/lib/StroyBook/index.d.ts +3 -4
  147. package/lib/StroyBook/index.js +20 -13
  148. package/lib/StroyBook/style.d.ts +4 -1
  149. package/lib/StroyBook/style.js +49 -43
  150. package/lib/Swatches/index.d.ts +8 -0
  151. package/lib/Swatches/index.js +68 -0
  152. package/lib/TabsNav/index.d.ts +3 -3
  153. package/lib/TabsNav/index.js +5 -15
  154. package/lib/ThemeProvider/GlobalStyle.js +7 -5
  155. package/lib/ThemeProvider/index.d.ts +15 -0
  156. package/lib/ThemeSwitch/index.d.ts +5 -5
  157. package/lib/ThemeSwitch/index.js +15 -32
  158. package/lib/Tooltip/index.d.ts +5 -0
  159. package/lib/Tooltip/index.js +34 -0
  160. package/lib/Tooltip/style.d.ts +3 -0
  161. package/lib/Tooltip/style.js +51 -0
  162. package/lib/hooks/useCopied.d.ts +4 -0
  163. package/lib/hooks/useCopied.js +44 -0
  164. package/lib/hooks/useHighlight.d.ts +36 -0
  165. package/lib/hooks/useHighlight.js +76 -0
  166. package/lib/index.d.ts +9 -0
  167. package/lib/index.js +29 -0
  168. package/lib/styles/theme/base.d.ts +2 -0
  169. package/lib/styles/theme/base.js +43 -0
  170. package/lib/styles/theme/dark.js +5 -12
  171. package/lib/styles/theme/light.js +10 -10
  172. package/lib/types/index.d.ts +14 -5
  173. package/package.json +12 -4
  174. package/es/ThemeProvider/token.d.ts +0 -3
  175. package/es/ThemeProvider/token.js +0 -45
  176. package/es/types/index.js +0 -1
  177. package/lib/ThemeProvider/token.d.ts +0 -3
  178. package/lib/ThemeProvider/token.js +0 -73
  179. package/lib/types/index.js +0 -17
@@ -0,0 +1,26 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
+ export var useCopied = function useCopied() {
4
+ var _useState = useState(false),
5
+ _useState2 = _slicedToArray(_useState, 2),
6
+ copied = _useState2[0],
7
+ setCopy = _useState2[1];
8
+ useEffect(function () {
9
+ if (!copied) return;
10
+ var timer = setTimeout(function () {
11
+ setCopy(false);
12
+ }, 2000);
13
+ return function () {
14
+ clearTimeout(timer);
15
+ };
16
+ }, [copied]);
17
+ var setCopied = useCallback(function () {
18
+ return setCopy(true);
19
+ }, []);
20
+ return useMemo(function () {
21
+ return {
22
+ copied: copied,
23
+ setCopied: setCopied
24
+ };
25
+ }, [copied]);
26
+ };
@@ -0,0 +1,36 @@
1
+ import { Highlighter, Theme } from 'shiki-es';
2
+ export interface ShikiSyntaxTheme {
3
+ /**
4
+ * @title 暗色模式主题
5
+ */
6
+ dark: Theme;
7
+ /**
8
+ * @title 亮色模式主题
9
+ */
10
+ light: Theme;
11
+ }
12
+ export declare const languageMap: readonly ["javascript", "js", "jsx", "json", "markdown", "md", "less", "css", "typescript", "ts", "tsx", "diff", "bash"];
13
+ /**
14
+ * @title 代码高亮的存储对象
15
+ */
16
+ interface Store {
17
+ /**
18
+ * @title 高亮器对象
19
+ */
20
+ highlighter?: Highlighter;
21
+ /**
22
+ * @title 初始化高亮器对象
23
+ * @returns 初始化 Promise 对象
24
+ */
25
+ initHighlighter: () => Promise<void>;
26
+ /**
27
+ * @title 将代码转化为 HTML 字符串
28
+ * @param text - 代码文本
29
+ * @param language - 代码语言
30
+ * @param isDarkMode - 是否为暗黑模式
31
+ * @returns HTML 字符串
32
+ */
33
+ codeToHtml: (text: string, language: string, isDarkMode: boolean) => string;
34
+ }
35
+ export declare const useHighlight: import("zustand").UseBoundStore<import("zustand").StoreApi<Store>>;
36
+ export {};
@@ -0,0 +1,63 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { getHighlighter } from 'shiki-es';
4
+ import { create } from 'zustand';
5
+ var THEME = {
6
+ dark: 'material-darker',
7
+ light: 'material-lighter'
8
+ };
9
+ export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', 'less', 'css', 'typescript', 'ts', 'tsx', 'diff', 'bash'];
10
+
11
+ /**
12
+ * @title 代码高亮的存储对象
13
+ */
14
+
15
+ export var useHighlight = create(function (set, get) {
16
+ return {
17
+ highlighter: undefined,
18
+ initHighlighter: function () {
19
+ var _initHighlighter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
+ var highlighter;
21
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
22
+ while (1) switch (_context.prev = _context.next) {
23
+ case 0:
24
+ if (get().highlighter) {
25
+ _context.next = 5;
26
+ break;
27
+ }
28
+ _context.next = 3;
29
+ return getHighlighter({
30
+ langs: languageMap,
31
+ themes: Object.values(THEME)
32
+ });
33
+ case 3:
34
+ highlighter = _context.sent;
35
+ set({
36
+ highlighter: highlighter
37
+ });
38
+ case 5:
39
+ case "end":
40
+ return _context.stop();
41
+ }
42
+ }, _callee);
43
+ }));
44
+ function initHighlighter() {
45
+ return _initHighlighter.apply(this, arguments);
46
+ }
47
+ return initHighlighter;
48
+ }(),
49
+ codeToHtml: function codeToHtml(text, language, isDarkMode) {
50
+ var _get = get(),
51
+ highlighter = _get.highlighter;
52
+ if (!highlighter) return '';
53
+ try {
54
+ return highlighter === null || highlighter === void 0 ? void 0 : highlighter.codeToHtml(text, {
55
+ lang: language,
56
+ theme: isDarkMode ? THEME.dark : THEME.light
57
+ });
58
+ } catch (e) {
59
+ return text;
60
+ }
61
+ }
62
+ };
63
+ });
package/es/index.d.ts CHANGED
@@ -1,9 +1,18 @@
1
1
  export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
2
+ export { default as CopyButton, type CopyButtonProps } from './CopyButton';
2
3
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
4
+ export { default as EditableText, type EditableTextProps } from './EditableText';
5
+ export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
3
6
  export { default as Icon, type IconProps, type IconSize } from './Icon';
4
7
  export { default as Logo, type LogoProps } from './Logo';
8
+ export { default as Markdown, type MarkdownProps } from './Markdown';
9
+ export { default as MessageInput, type MessageInputProps } from './MessageInput';
10
+ export { default as SearchBar, type SearchBarProps } from './SearchBar';
5
11
  export { default as SideNav, type SideNavProps } from './SideNav';
12
+ export { default as Snippet, type SnippetProps } from './Snippet';
6
13
  export { default as StroyBook, useControls, useCreateStore, type StroyBookProps, } from './StroyBook';
14
+ export { default as Swatches, type SwatchesProps } from './Swatches';
7
15
  export { default as TabsNav, type TabsNavProps } from './TabsNav';
8
16
  export { default as ThemeProvider } from './ThemeProvider';
9
17
  export { default as ThemeSwitch, type ThemeSwitchProps } from './ThemeSwitch';
18
+ export { default as Tooltip, type TooltipProps } from './Tooltip';
package/es/index.js CHANGED
@@ -1,9 +1,18 @@
1
1
  export { default as ActionIcon } from "./ActionIcon";
2
+ export { default as CopyButton } from "./CopyButton";
2
3
  export { default as DraggablePanel } from "./DraggablePanel";
4
+ export { default as EditableText } from "./EditableText";
5
+ export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
3
6
  export { default as Icon } from "./Icon";
4
7
  export { default as Logo } from "./Logo";
8
+ export { default as Markdown } from "./Markdown";
9
+ export { default as MessageInput } from "./MessageInput";
10
+ export { default as SearchBar } from "./SearchBar";
5
11
  export { default as SideNav } from "./SideNav";
12
+ export { default as Snippet } from "./Snippet";
6
13
  export { default as StroyBook, useControls, useCreateStore } from "./StroyBook";
14
+ export { default as Swatches } from "./Swatches";
7
15
  export { default as TabsNav } from "./TabsNav";
8
16
  export { default as ThemeProvider } from "./ThemeProvider";
9
- export { default as ThemeSwitch } from "./ThemeSwitch";
17
+ export { default as ThemeSwitch } from "./ThemeSwitch";
18
+ export { default as Tooltip } from "./Tooltip";
@@ -0,0 +1,2 @@
1
+ import { ThemeConfig } from 'antd';
2
+ export declare const baseTheme: ThemeConfig;
@@ -0,0 +1,15 @@
1
+ export var baseTheme = {
2
+ token: {
3
+ colorInfo: '#0070f3',
4
+ colorSuccess: '#50e3c2',
5
+ colorWarning: '#f5a623',
6
+ colorError: '#ee0000',
7
+ borderRadius: 5,
8
+ borderRadiusXS: 3,
9
+ borderRadiusSM: 3,
10
+ borderRadiusLG: 8,
11
+ controlHeight: 36,
12
+ fontFamily: "'Segoe UI', SegoeUI, AliPuHui, -apple-system ,BlinkMacSystemFont,Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'",
13
+ fontFamilyCode: "'Hack Nerd Font Mono', 'Hack', 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
14
+ }
15
+ };
@@ -3,6 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3
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
4
  import { theme } from 'antd';
5
5
  import { genMapTokenAlgorithm } from "../algorithms";
6
+ import { baseTheme } from "./base";
6
7
  var cyanColors = ['rgba(0, 225, 242, 0.12)', 'rgba(0, 232, 245, 0.22)', 'rgba(0, 237, 250, 0.32)', 'rgba(0, 243, 255, 0.42)', 'rgba(0, 247, 255, 0.53)', 'rgba(0, 246, 254, 0.65)', 'rgba(0, 247, 253, 0.77)', 'rgba(0, 245, 255, 0.75)', 'rgba(0, 244, 255, 0.73)', 'rgba(0, 239, 253, 0.72)', 'rgba(0, 237, 253, 0.7)'];
7
8
  var darkModeRelationship = function darkModeRelationship(type) {
8
9
  var _ref;
@@ -49,7 +50,7 @@ var darkAlgorithm = function darkAlgorithm(seedToken, mapToken) {
49
50
  });
50
51
  };
51
52
  export var darkTheme = {
52
- token: {
53
+ token: _objectSpread(_objectSpread({}, baseTheme.token), {}, {
53
54
  colorTextLightSolid: '#000000',
54
55
  colorBgLayout: '#000000',
55
56
  colorBgContainer: '#111111',
@@ -62,21 +63,12 @@ export var darkTheme = {
62
63
  colorTextTertiary: '#888888',
63
64
  colorTextQuaternary: '#666666',
64
65
  colorPrimary: '#ffffff',
65
- colorInfo: '#0070f3',
66
- colorSuccess: '#50e3c2',
67
- colorWarning: '#f5a623',
68
- colorError: '#ee0000',
69
66
  colorFillQuaternary: 'rgba(0,0,0,0)',
70
- borderRadius: 5,
71
- borderRadiusXS: 3,
72
- borderRadiusSM: 3,
73
- borderRadiusLG: 8,
74
- controlHeight: 36,
75
67
  boxShadow: '0 12px 20px 6px rgb(0 0 0 / 0.08)',
76
68
  boxShadowSecondary: '0 2px 8px 2px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.04)',
77
- colorLinkHover: darkColorPalettes.primary[7],
78
- colorLink: darkColorPalettes.primary[6],
79
- colorLinkActive: darkColorPalettes.primary[5]
80
- },
69
+ colorLinkHover: '#3291ff',
70
+ colorLink: '#0070f3',
71
+ colorLinkActive: '#0761d1'
72
+ }),
81
73
  algorithm: darkAlgorithm
82
74
  };
@@ -2,13 +2,14 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
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
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
4
  import { genMapTokenAlgorithm } from "../algorithms";
5
+ import { baseTheme } from "./base";
5
6
  var lightMode = genMapTokenAlgorithm('light');
6
7
  export var lightColorPalettes = lightMode.palettes;
7
8
  export var lightTheme = {
8
- token: {
9
+ token: _objectSpread(_objectSpread({}, baseTheme.token), {}, {
9
10
  colorTextLightSolid: '#ffffff',
10
- colorBgLayout: '#ffffff',
11
- colorBgContainer: '#fafafa',
11
+ colorBgLayout: '#fafafa',
12
+ colorBgContainer: '#ffffff',
12
13
  colorBgElevated: '#f2f2f2',
13
14
  colorBgSpotlight: '#999999',
14
15
  colorBorder: '#eaeaea',
@@ -18,18 +19,16 @@ export var lightTheme = {
18
19
  colorTextTertiary: '#666666',
19
20
  colorTextQuaternary: '#888888',
20
21
  colorPrimary: '#000000',
22
+ colorFill: 'rgba(0,0,0,0.1)',
23
+ colorFillSecondary: 'rgba(0,0,0,0.075)',
24
+ colorFillTertiary: 'rgba(0,0,0,0.05)',
21
25
  colorFillQuaternary: 'rgba(0,0,0,0)',
22
- borderRadius: 5,
23
- borderRadiusXS: 3,
24
- borderRadiusSM: 3,
25
- borderRadiusLG: 8,
26
- controlHeight: 36,
27
26
  boxShadow: '0 12px 20px 6px rgb(104 112 118 / 0.08)',
28
27
  boxShadowSecondary: '0 2px 8px 2px rgb(104 112 118 / 0.07), 0 2px 4px -1px rgb(104 112 118 / 0.04)',
29
- colorLinkHover: lightColorPalettes.primary[5],
30
- colorLink: lightColorPalettes.primary[6],
31
- colorLinkActive: lightColorPalettes.primary[7]
32
- },
28
+ colorLinkHover: '#3291ff',
29
+ colorLink: '#0070f3',
30
+ colorLinkActive: '#0761d1'
31
+ }),
33
32
  algorithm: function algorithm(seedToken, mapToken) {
34
33
  return _objectSpread(_objectSpread({}, mapToken), lightMode.tokens);
35
34
  }
@@ -1,9 +1,18 @@
1
1
  import { Theme as AntdStyleTheme } from 'antd-style';
2
2
  import React from 'react';
3
+
3
4
  declare module 'styled-components' {
4
- interface DefaultTheme extends AntdStyleTheme {
5
- }
5
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
+ export interface DefaultTheme extends AntdStyleTheme {}
7
+ }
8
+
9
+ export type DivProps = React.DetailedHTMLProps<
10
+ React.HTMLAttributes<HTMLDivElement>,
11
+ HTMLDivElement
12
+ >;
13
+
14
+ declare global {
15
+ type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
16
+
17
+ type ImgProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLImageElement>, HTMLImageElement>;
6
18
  }
7
- export declare type DivProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
8
- export declare type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
9
- export declare type ImgProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLImageElement>, HTMLImageElement>;
@@ -1,7 +1,7 @@
1
- import { DivProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import { LucideIcon } from 'lucide-react';
3
- import React from 'react';
4
- export declare type ActionIconSize = 'large' | 'normal' | 'small' | {
3
+ import { DivProps } from "../types";
4
+ export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
5
5
  blockSize?: number;
6
6
  fontSize?: number;
7
7
  strokeWidth?: number;
@@ -23,6 +23,11 @@ export interface ActionIconProps extends DivProps {
23
23
  * @type LucideIcon
24
24
  */
25
25
  icon: LucideIcon;
26
+ /**
27
+ * @description Glass blur style
28
+ * @default 'false'
29
+ */
30
+ glass?: boolean;
26
31
  }
27
- declare const _default: React.NamedExoticComponent<ActionIconProps>;
28
- export default _default;
32
+ declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
33
+ export default ActionIcon;
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/ActionIcon/index.tsx
@@ -33,47 +23,46 @@ __export(ActionIcon_exports, {
33
23
  });
34
24
  module.exports = __toCommonJS(ActionIcon_exports);
35
25
  var import__ = require("../index");
36
- var import_react = __toESM(require("react"));
26
+ var import_react = require("react");
37
27
  var import_style = require("./style");
38
- var ActionIcon = ({
39
- className,
40
- active,
41
- icon,
42
- size = "normal",
43
- style,
44
- ...props
45
- }) => {
46
- const { styles, cx } = (0, import_style.useStyles)(active);
47
- let blockSize;
48
- let borderRadius;
49
- switch (size) {
50
- case "large":
51
- blockSize = 44;
52
- borderRadius = 8;
53
- break;
54
- case "normal":
55
- blockSize = 36;
56
- borderRadius = 5;
57
- break;
58
- case "small":
59
- blockSize = 28;
60
- borderRadius = 5;
61
- break;
62
- default:
63
- blockSize = (size == null ? void 0 : size.blockSize) || 36;
64
- borderRadius = (size == null ? void 0 : size.borderRadius) || 5;
65
- break;
28
+ var ActionIcon = (0, import_react.memo)(
29
+ ({ className, active, icon, size = "normal", style, glass, ...props }) => {
30
+ const { styles, cx } = (0, import_style.useStyles)({ active: Boolean(active), glass: Boolean(glass) });
31
+ let blockSize;
32
+ let borderRadius;
33
+ switch (size) {
34
+ case "large":
35
+ blockSize = 44;
36
+ borderRadius = 8;
37
+ break;
38
+ case "normal":
39
+ blockSize = 36;
40
+ borderRadius = 5;
41
+ break;
42
+ case "small":
43
+ blockSize = 28;
44
+ borderRadius = 5;
45
+ break;
46
+ case "site":
47
+ blockSize = 34;
48
+ borderRadius = 5;
49
+ break;
50
+ default:
51
+ blockSize = (size == null ? void 0 : size.blockSize) || 36;
52
+ borderRadius = (size == null ? void 0 : size.borderRadius) || 5;
53
+ break;
54
+ }
55
+ return /* @__PURE__ */ React.createElement(
56
+ "div",
57
+ {
58
+ className: cx(styles.block, className),
59
+ style: { width: blockSize, height: blockSize, borderRadius, ...style },
60
+ ...props
61
+ },
62
+ /* @__PURE__ */ React.createElement(import__.Icon, { size: size === "site" ? "small" : size, icon })
63
+ );
66
64
  }
67
- return /* @__PURE__ */ import_react.default.createElement(
68
- "div",
69
- {
70
- className: cx(styles.block, className),
71
- style: { width: blockSize, height: blockSize, borderRadius, ...style },
72
- ...props
73
- },
74
- /* @__PURE__ */ import_react.default.createElement(import__.Icon, { size, icon })
75
- );
76
- };
77
- var ActionIcon_default = import_react.default.memo(ActionIcon);
65
+ );
66
+ var ActionIcon_default = ActionIcon;
78
67
  // Annotate the CommonJS export names for ESM import in node:
79
68
  0 && (module.exports = {});
@@ -1,3 +1,6 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
1
+ export declare const useStyles: (props?: {
2
+ active: boolean;
3
+ glass: boolean;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
2
5
  block: import("antd-style").SerializedStyles;
3
6
  }>;
@@ -23,34 +23,41 @@ __export(style_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(style_exports);
25
25
  var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, token }, active) => {
27
- return {
28
- block: css`
29
- cursor: pointer;
26
+ var useStyles = (0, import_antd_style.createStyles)(
27
+ ({ css, token }, { active, glass }) => {
28
+ return {
29
+ block: css`
30
+ cursor: pointer;
30
31
 
31
- display: flex;
32
- flex: none;
33
- align-items: center;
34
- justify-content: center;
32
+ display: flex;
33
+ flex: none;
34
+ align-items: center;
35
+ justify-content: center;
35
36
 
36
- color: ${active ? token.colorText : token.colorTextQuaternary};
37
+ color: ${active ? token.colorText : token.colorTextQuaternary};
37
38
 
38
- background: ${active ? token.colorFill : "transparent"};
39
+ background: ${active ? token.colorFillTertiary : "transparent"};
39
40
 
40
- transition: color 600ms ${token.motionEaseOut}, background-color 100ms ${token.motionEaseOut};
41
+ transition: color 600ms ${token.motionEaseOut},
42
+ background-color 100ms ${token.motionEaseOut};
41
43
 
42
- &:hover {
43
- color: ${token.colorText};
44
- background-color: ${token.colorFillTertiary};
45
- }
44
+ ${glass && css`
45
+ backdrop-filter: saturate(180%) blur(10px);
46
+ `}
46
47
 
47
- &:active {
48
- color: ${token.colorText};
49
- background-color: ${token.colorFill};
50
- }
51
- `
52
- };
53
- });
48
+ &:hover {
49
+ color: ${token.colorText};
50
+ background-color: ${active ? token.colorFillSecondary : token.colorFillTertiary};
51
+ }
52
+
53
+ &:active {
54
+ color: ${token.colorText};
55
+ background-color: ${token.colorFill};
56
+ }
57
+ `
58
+ };
59
+ }
60
+ );
54
61
  // Annotate the CommonJS export names for ESM import in node:
55
62
  0 && (module.exports = {
56
63
  useStyles
@@ -0,0 +1,34 @@
1
+ import { ActionIconSize, TooltipProps } from "../index";
2
+ import { DivProps } from "../types";
3
+ import { ReactNode } from 'react';
4
+ export interface CopyButtonProps extends DivProps {
5
+ /**
6
+ * @description The text content to be copied
7
+ */
8
+ content: string;
9
+ /**
10
+ * @description The size of the icon
11
+ * @enum ['large', 'normal', 'small', 'site']
12
+ * @default 'site'
13
+ */
14
+ size?: ActionIconSize;
15
+ /**
16
+ * @description Additional class name
17
+ */
18
+ className?: string;
19
+ /**
20
+ * @description The placement of the tooltip
21
+ * @enum ['top', 'left', 'right', 'bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop', 'rightBottom']
22
+ * @default 'right'
23
+ */
24
+ placement?: TooltipProps['placement'];
25
+ /**
26
+ * @description A function that returns the children to be rendered
27
+
28
+ */
29
+ render?: (props: {
30
+ handleCopy: () => void;
31
+ }) => ReactNode;
32
+ }
33
+ declare const CopyButton: ({ content, className, placement, size, render, ...props }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
34
+ export default CopyButton;
@@ -0,0 +1,70 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/CopyButton/index.tsx
30
+ var CopyButton_exports = {};
31
+ __export(CopyButton_exports, {
32
+ default: () => CopyButton_default
33
+ });
34
+ module.exports = __toCommonJS(CopyButton_exports);
35
+ var import_useCopied = require("../hooks/useCopied");
36
+ var import__ = require("../index");
37
+ var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
38
+ var import_lucide_react = require("lucide-react");
39
+ var CopyButton = ({
40
+ content,
41
+ className,
42
+ placement = "right",
43
+ size = "site",
44
+ render,
45
+ ...props
46
+ }) => {
47
+ const { copied, setCopied } = (0, import_useCopied.useCopied)();
48
+ const handleCopy = () => {
49
+ (0, import_copy_to_clipboard.default)(content);
50
+ setCopied();
51
+ };
52
+ const children = render ? render({ handleCopy }) : /* @__PURE__ */ React.createElement(
53
+ import__.ActionIcon,
54
+ {
55
+ ...props,
56
+ icon: import_lucide_react.Copy,
57
+ className,
58
+ size,
59
+ glass: true,
60
+ onClick: () => {
61
+ (0, import_copy_to_clipboard.default)(content);
62
+ setCopied();
63
+ }
64
+ }
65
+ );
66
+ return /* @__PURE__ */ React.createElement(import__.Tooltip, { arrow: false, placement, title: copied ? /* @__PURE__ */ React.createElement(React.Fragment, null, "✅ Success") : "Copy" }, children);
67
+ };
68
+ var CopyButton_default = CopyButton;
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {});
@@ -1,7 +1,7 @@
1
- import type { DivProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import type { NumberSize, Size } from 're-resizable';
3
- import React from 'react';
4
3
  import type { Props as RndProps } from 'react-rnd';
4
+ import { DivProps } from "../types";
5
5
  export declare type placementType = 'right' | 'left' | 'top' | 'bottom';
6
6
  export interface DraggablePanelProps extends DivProps {
7
7
  /**
@@ -82,5 +82,5 @@ export interface DraggablePanelProps extends DivProps {
82
82
  */
83
83
  hanlderStyle?: React.CSSProperties;
84
84
  }
85
- declare const _default: React.NamedExoticComponent<DraggablePanelProps>;
86
- export default _default;
85
+ declare const DraggablePanel: import("react").NamedExoticComponent<DraggablePanelProps>;
86
+ export default DraggablePanel;