@tidbcloud/uikit 2.0.0-beta.65 → 2.0.0-beta.67

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 (20) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/biz/CodeBlock/index.cjs +3 -3
  3. package/dist/biz/CodeBlock/index.d.cts +2 -2
  4. package/dist/biz/CodeBlock/index.d.ts +2 -2
  5. package/dist/biz/CodeBlock/index.js +3 -3
  6. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlightTabs.cjs +172 -0
  7. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlightTabs.js +172 -0
  8. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/ExpandIcon.cjs +36 -0
  9. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/ExpandIcon.js +36 -0
  10. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/FileIcon.cjs +13 -0
  11. package/dist/node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/FileIcon.js +13 -0
  12. package/dist/primitive/MediaQuery/index.cjs +1 -1
  13. package/dist/primitive/MediaQuery/index.d.cts +1 -1
  14. package/dist/primitive/MediaQuery/index.d.ts +1 -1
  15. package/dist/primitive/MediaQuery/index.js +1 -1
  16. package/dist/primitive/index.cjs +4 -0
  17. package/dist/primitive/index.d.cts +2 -0
  18. package/dist/primitive/index.d.ts +2 -0
  19. package/dist/primitive/index.js +4 -0
  20. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.0.0-beta.67
4
+
5
+ ### Minor Changes
6
+
7
+ - Re-export code-highlight
8
+
9
+ ## 2.0.0-beta.66
10
+
11
+ ### Patch Changes
12
+
13
+ - fix MediaQuery type error
14
+
3
15
  ## 2.0.0-beta.65
4
16
 
5
17
  ### Patch Changes
@@ -39,7 +39,7 @@ const CodeBlock = ({
39
39
  children,
40
40
  copyContent,
41
41
  onCopyClick,
42
- codeHightlightProps,
42
+ codeHighlightProps,
43
43
  foldProps,
44
44
  ...rest
45
45
  }) => {
@@ -69,7 +69,7 @@ const CodeBlock = ({
69
69
  children: codeRender ? codeRender(children) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
70
70
  CodeHighlight.CodeHighlight,
71
71
  {
72
- ...codeHightlightProps,
72
+ ...codeHighlightProps,
73
73
  withCopyButton: false,
74
74
  code: children,
75
75
  language,
@@ -89,7 +89,7 @@ const CodeBlock = ({
89
89
  // whiteSpace: 'pre-wrap'
90
90
  // }
91
91
  },
92
- codeHightlightProps == null ? void 0 : codeHightlightProps.styles
92
+ codeHighlightProps == null ? void 0 : codeHighlightProps.styles
93
93
  ])
94
94
  }
95
95
  )
@@ -7,7 +7,7 @@ export interface CodeBlockProps extends BoxProps {
7
7
  codeRender?: (content: string) => React.ReactNode;
8
8
  copyContent?: string;
9
9
  onCopyClick?: () => void;
10
- codeHightlightProps?: Omit<CodeHighlightProps, 'language' | 'children'>;
10
+ codeHighlightProps?: Omit<CodeHighlightProps, 'language' | 'children' | 'code'>;
11
11
  foldProps?: {
12
12
  defaultHeight?: number;
13
13
  persistenceKey?: string;
@@ -15,7 +15,7 @@ export interface CodeBlockProps extends BoxProps {
15
15
  onIconClick?: (folded: boolean) => void;
16
16
  };
17
17
  }
18
- export declare const CodeBlock: ({ language, codeRender, children, copyContent, onCopyClick, codeHightlightProps, foldProps, ...rest }: React.PropsWithChildren<CodeBlockProps>) => import("react/jsx-runtime.js").JSX.Element;
18
+ export declare const CodeBlock: ({ language, codeRender, children, copyContent, onCopyClick, codeHighlightProps, foldProps, ...rest }: React.PropsWithChildren<CodeBlockProps>) => import("react/jsx-runtime.js").JSX.Element;
19
19
  export interface CopyTextProps extends CodeProps {
20
20
  value: string;
21
21
  }
@@ -7,7 +7,7 @@ export interface CodeBlockProps extends BoxProps {
7
7
  codeRender?: (content: string) => React.ReactNode;
8
8
  copyContent?: string;
9
9
  onCopyClick?: () => void;
10
- codeHightlightProps?: Omit<CodeHighlightProps, 'language' | 'children'>;
10
+ codeHighlightProps?: Omit<CodeHighlightProps, 'language' | 'children' | 'code'>;
11
11
  foldProps?: {
12
12
  defaultHeight?: number;
13
13
  persistenceKey?: string;
@@ -15,7 +15,7 @@ export interface CodeBlockProps extends BoxProps {
15
15
  onIconClick?: (folded: boolean) => void;
16
16
  };
17
17
  }
18
- export declare const CodeBlock: ({ language, codeRender, children, copyContent, onCopyClick, codeHightlightProps, foldProps, ...rest }: React.PropsWithChildren<CodeBlockProps>) => import("react/jsx-runtime.js").JSX.Element;
18
+ export declare const CodeBlock: ({ language, codeRender, children, copyContent, onCopyClick, codeHighlightProps, foldProps, ...rest }: React.PropsWithChildren<CodeBlockProps>) => import("react/jsx-runtime.js").JSX.Element;
19
19
  export interface CopyTextProps extends CodeProps {
20
20
  value: string;
21
21
  }
@@ -37,7 +37,7 @@ const CodeBlock = ({
37
37
  children,
38
38
  copyContent,
39
39
  onCopyClick,
40
- codeHightlightProps,
40
+ codeHighlightProps,
41
41
  foldProps,
42
42
  ...rest
43
43
  }) => {
@@ -67,7 +67,7 @@ const CodeBlock = ({
67
67
  children: codeRender ? codeRender(children) : /* @__PURE__ */ jsxRuntimeExports.jsx(
68
68
  CodeHighlight,
69
69
  {
70
- ...codeHightlightProps,
70
+ ...codeHighlightProps,
71
71
  withCopyButton: false,
72
72
  code: children,
73
73
  language,
@@ -87,7 +87,7 @@ const CodeBlock = ({
87
87
  // whiteSpace: 'pre-wrap'
88
88
  // }
89
89
  },
90
- codeHightlightProps == null ? void 0 : codeHightlightProps.styles
90
+ codeHighlightProps == null ? void 0 : codeHighlightProps.styles
91
91
  ])
92
92
  }
93
93
  )
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("../../../../../react@18.3.1/node_modules/react/jsx-runtime.cjs");
4
+ const React = require("react");
5
+ const clsx = require("clsx");
6
+ const index = require("../../../../../highlight.js@11.10.0/node_modules/highlight.js/lib/index.cjs");
7
+ const CopyIcon = require("./CopyIcon.cjs");
8
+ const ExpandIcon = require("./ExpandIcon.cjs");
9
+ const FileIcon = require("./FileIcon.cjs");
10
+ const CodeHighlight_module_css = require("./CodeHighlight.module.css.cjs");
11
+ const CodeHighlight_theme_module_css = require("./CodeHighlight.theme.module.css.cjs");
12
+ const rem = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/utils/units-converters/rem.cjs");
13
+ const factory = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/factory/factory.cjs");
14
+ const useProps = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/MantineProvider/use-props/use-props.cjs");
15
+ const useStyles = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/styles-api/use-styles/use-styles.cjs");
16
+ const useUncontrolled = require("../../../../../@mantine_hooks@7.13.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.cjs");
17
+ const UnstyledButton = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.cjs");
18
+ const Box = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/Box/Box.cjs");
19
+ const ScrollArea = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/ScrollArea/ScrollArea.cjs");
20
+ const Tooltip = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.cjs");
21
+ const ActionIcon = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.cjs");
22
+ const CopyButton = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/CopyButton/CopyButton.cjs");
23
+ const createVarsResolver = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
24
+ const classes = { ...CodeHighlight_module_css.default, root: clsx(CodeHighlight_module_css.default.root, CodeHighlight_theme_module_css.default.theme) };
25
+ const defaultProps = {
26
+ withHeader: true,
27
+ copyLabel: "Copy code",
28
+ copiedLabel: "Copied",
29
+ maxCollapsedHeight: rem.rem("8rem"),
30
+ expandCodeLabel: "Expand code",
31
+ collapseCodeLabel: "Collapse code",
32
+ withCopyButton: true
33
+ };
34
+ const varsResolver = createVarsResolver.createVarsResolver((_, { maxCollapsedHeight }) => ({
35
+ root: { "--ch-max-collapsed-height": rem.rem(maxCollapsedHeight) }
36
+ }));
37
+ const CodeHighlightTabs = factory.factory((_props, ref) => {
38
+ const props = useProps.useProps("CodeHighlightTabs", defaultProps, _props);
39
+ const {
40
+ classNames,
41
+ className,
42
+ style,
43
+ styles,
44
+ unstyled,
45
+ vars,
46
+ children,
47
+ code,
48
+ defaultActiveTab,
49
+ activeTab,
50
+ onTabChange,
51
+ withHeader,
52
+ copiedLabel,
53
+ copyLabel,
54
+ getFileIcon,
55
+ maxCollapsedHeight,
56
+ expanded,
57
+ defaultExpanded,
58
+ onExpandedChange,
59
+ expandCodeLabel,
60
+ collapseCodeLabel,
61
+ withExpandButton,
62
+ withCopyButton,
63
+ mod,
64
+ ...others
65
+ } = props;
66
+ const getStyles = useStyles.useStyles({
67
+ name: "CodeHighlightTabs",
68
+ props,
69
+ classes,
70
+ className,
71
+ style,
72
+ classNames,
73
+ styles,
74
+ unstyled,
75
+ vars,
76
+ varsResolver
77
+ });
78
+ const [value, setValue] = useUncontrolled.useUncontrolled({
79
+ defaultValue: defaultActiveTab,
80
+ value: activeTab,
81
+ finalValue: 0,
82
+ onChange: onTabChange
83
+ });
84
+ const [_expanded, setExpanded] = useUncontrolled.useUncontrolled({
85
+ defaultValue: defaultExpanded,
86
+ value: expanded,
87
+ finalValue: true,
88
+ onChange: onExpandedChange
89
+ });
90
+ const nodes = Array.isArray(code) ? code : [code];
91
+ const currentCode = nodes[value];
92
+ const highlighted = index.default.highlight(currentCode.code.trim(), {
93
+ language: currentCode.language || "plaintext"
94
+ }).value;
95
+ const files = nodes.map((node, index2) => /* @__PURE__ */ React.createElement(
96
+ UnstyledButton.UnstyledButton,
97
+ {
98
+ ...getStyles("file"),
99
+ key: node.fileName,
100
+ mod: { active: index2 === value },
101
+ onClick: () => setValue(index2)
102
+ },
103
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
104
+ FileIcon.FileIcon,
105
+ {
106
+ fileIcon: node.icon,
107
+ getFileIcon,
108
+ fileName: node.fileName,
109
+ ...getStyles("fileIcon")
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { children: node.fileName })
113
+ ));
114
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
115
+ Box.Box,
116
+ {
117
+ ...getStyles("root"),
118
+ mod: [{ collapsed: !_expanded }, mod],
119
+ ref,
120
+ ...others,
121
+ dir: "ltr",
122
+ children: [
123
+ withHeader && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { ...getStyles("header"), children: [
124
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ScrollArea.ScrollArea, { type: "never", dir: "ltr", offsetScrollbars: false, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { ...getStyles("files"), children: files }) }),
125
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { ...getStyles("controls"), children: [
126
+ withExpandButton && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
127
+ Tooltip.Tooltip,
128
+ {
129
+ label: _expanded ? collapseCodeLabel : expandCodeLabel,
130
+ fz: "sm",
131
+ position: "left",
132
+ children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
133
+ ActionIcon.ActionIcon,
134
+ {
135
+ onClick: () => setExpanded(!_expanded),
136
+ variant: "none",
137
+ "aria-label": _expanded ? collapseCodeLabel : expandCodeLabel,
138
+ ...getStyles("control"),
139
+ children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ExpandIcon.ExpandIcon, { expanded: _expanded })
140
+ }
141
+ )
142
+ }
143
+ ),
144
+ withCopyButton && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(CopyButton.CopyButton, { value: currentCode.code.trim(), children: ({ copied, copy }) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Tooltip.Tooltip, { label: copied ? copiedLabel : copyLabel, fz: "sm", position: "left", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
145
+ ActionIcon.ActionIcon,
146
+ {
147
+ onClick: copy,
148
+ variant: "none",
149
+ ...getStyles("control"),
150
+ "aria-label": copied ? copiedLabel : copyLabel,
151
+ children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(CopyIcon.CopyIcon, { copied })
152
+ }
153
+ ) }) })
154
+ ] })
155
+ ] }),
156
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ScrollArea.ScrollArea, { type: "auto", dir: "ltr", offsetScrollbars: false, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { ...getStyles("codeWrapper"), mod: { expanded: _expanded }, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("pre", { ...getStyles("pre"), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("code", { ...getStyles("code"), dangerouslySetInnerHTML: { __html: highlighted } }) }) }) }),
157
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
158
+ UnstyledButton.UnstyledButton,
159
+ {
160
+ ...getStyles("showCodeButton"),
161
+ mod: { hidden: _expanded },
162
+ onClick: () => setExpanded(true),
163
+ children: expandCodeLabel
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ );
169
+ });
170
+ CodeHighlightTabs.displayName = "@mantine/core/CodeHighlightTabs";
171
+ CodeHighlightTabs.classes = classes;
172
+ exports.CodeHighlightTabs = CodeHighlightTabs;
@@ -0,0 +1,172 @@
1
+ import { j as jsxRuntimeExports } from "../../../../../react@18.3.1/node_modules/react/jsx-runtime.js";
2
+ import { createElement } from "react";
3
+ import clsx from "clsx";
4
+ import HighlightJS from "../../../../../highlight.js@11.10.0/node_modules/highlight.js/lib/index.js";
5
+ import { CopyIcon } from "./CopyIcon.js";
6
+ import { ExpandIcon } from "./ExpandIcon.js";
7
+ import { FileIcon } from "./FileIcon.js";
8
+ import _classes from "./CodeHighlight.module.css.js";
9
+ import themeClasses from "./CodeHighlight.theme.module.css.js";
10
+ import { rem } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/utils/units-converters/rem.js";
11
+ import { factory } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/factory/factory.js";
12
+ import { useProps } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/MantineProvider/use-props/use-props.js";
13
+ import { useStyles } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/styles-api/use-styles/use-styles.js";
14
+ import { useUncontrolled } from "../../../../../@mantine_hooks@7.13.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.js";
15
+ import { UnstyledButton } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.js";
16
+ import { Box } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/Box/Box.js";
17
+ import { ScrollArea } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/ScrollArea/ScrollArea.js";
18
+ import { Tooltip } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.js";
19
+ import { ActionIcon } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.js";
20
+ import { CopyButton } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/components/CopyButton/CopyButton.js";
21
+ import { createVarsResolver } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/styles-api/create-vars-resolver/create-vars-resolver.js";
22
+ const classes = { ..._classes, root: clsx(_classes.root, themeClasses.theme) };
23
+ const defaultProps = {
24
+ withHeader: true,
25
+ copyLabel: "Copy code",
26
+ copiedLabel: "Copied",
27
+ maxCollapsedHeight: rem("8rem"),
28
+ expandCodeLabel: "Expand code",
29
+ collapseCodeLabel: "Collapse code",
30
+ withCopyButton: true
31
+ };
32
+ const varsResolver = createVarsResolver((_, { maxCollapsedHeight }) => ({
33
+ root: { "--ch-max-collapsed-height": rem(maxCollapsedHeight) }
34
+ }));
35
+ const CodeHighlightTabs = factory((_props, ref) => {
36
+ const props = useProps("CodeHighlightTabs", defaultProps, _props);
37
+ const {
38
+ classNames,
39
+ className,
40
+ style,
41
+ styles,
42
+ unstyled,
43
+ vars,
44
+ children,
45
+ code,
46
+ defaultActiveTab,
47
+ activeTab,
48
+ onTabChange,
49
+ withHeader,
50
+ copiedLabel,
51
+ copyLabel,
52
+ getFileIcon,
53
+ maxCollapsedHeight,
54
+ expanded,
55
+ defaultExpanded,
56
+ onExpandedChange,
57
+ expandCodeLabel,
58
+ collapseCodeLabel,
59
+ withExpandButton,
60
+ withCopyButton,
61
+ mod,
62
+ ...others
63
+ } = props;
64
+ const getStyles = useStyles({
65
+ name: "CodeHighlightTabs",
66
+ props,
67
+ classes,
68
+ className,
69
+ style,
70
+ classNames,
71
+ styles,
72
+ unstyled,
73
+ vars,
74
+ varsResolver
75
+ });
76
+ const [value, setValue] = useUncontrolled({
77
+ defaultValue: defaultActiveTab,
78
+ value: activeTab,
79
+ finalValue: 0,
80
+ onChange: onTabChange
81
+ });
82
+ const [_expanded, setExpanded] = useUncontrolled({
83
+ defaultValue: defaultExpanded,
84
+ value: expanded,
85
+ finalValue: true,
86
+ onChange: onExpandedChange
87
+ });
88
+ const nodes = Array.isArray(code) ? code : [code];
89
+ const currentCode = nodes[value];
90
+ const highlighted = HighlightJS.highlight(currentCode.code.trim(), {
91
+ language: currentCode.language || "plaintext"
92
+ }).value;
93
+ const files = nodes.map((node, index) => /* @__PURE__ */ createElement(
94
+ UnstyledButton,
95
+ {
96
+ ...getStyles("file"),
97
+ key: node.fileName,
98
+ mod: { active: index === value },
99
+ onClick: () => setValue(index)
100
+ },
101
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
102
+ FileIcon,
103
+ {
104
+ fileIcon: node.icon,
105
+ getFileIcon,
106
+ fileName: node.fileName,
107
+ ...getStyles("fileIcon")
108
+ }
109
+ ),
110
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: node.fileName })
111
+ ));
112
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
113
+ Box,
114
+ {
115
+ ...getStyles("root"),
116
+ mod: [{ collapsed: !_expanded }, mod],
117
+ ref,
118
+ ...others,
119
+ dir: "ltr",
120
+ children: [
121
+ withHeader && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getStyles("header"), children: [
122
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { type: "never", dir: "ltr", offsetScrollbars: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getStyles("files"), children: files }) }),
123
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getStyles("controls"), children: [
124
+ withExpandButton && /* @__PURE__ */ jsxRuntimeExports.jsx(
125
+ Tooltip,
126
+ {
127
+ label: _expanded ? collapseCodeLabel : expandCodeLabel,
128
+ fz: "sm",
129
+ position: "left",
130
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
131
+ ActionIcon,
132
+ {
133
+ onClick: () => setExpanded(!_expanded),
134
+ variant: "none",
135
+ "aria-label": _expanded ? collapseCodeLabel : expandCodeLabel,
136
+ ...getStyles("control"),
137
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandIcon, { expanded: _expanded })
138
+ }
139
+ )
140
+ }
141
+ ),
142
+ withCopyButton && /* @__PURE__ */ jsxRuntimeExports.jsx(CopyButton, { value: currentCode.code.trim(), children: ({ copied, copy }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { label: copied ? copiedLabel : copyLabel, fz: "sm", position: "left", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
143
+ ActionIcon,
144
+ {
145
+ onClick: copy,
146
+ variant: "none",
147
+ ...getStyles("control"),
148
+ "aria-label": copied ? copiedLabel : copyLabel,
149
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { copied })
150
+ }
151
+ ) }) })
152
+ ] })
153
+ ] }),
154
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { type: "auto", dir: "ltr", offsetScrollbars: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { ...getStyles("codeWrapper"), mod: { expanded: _expanded }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { ...getStyles("pre"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("code", { ...getStyles("code"), dangerouslySetInnerHTML: { __html: highlighted } }) }) }) }),
155
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
156
+ UnstyledButton,
157
+ {
158
+ ...getStyles("showCodeButton"),
159
+ mod: { hidden: _expanded },
160
+ onClick: () => setExpanded(true),
161
+ children: expandCodeLabel
162
+ }
163
+ )
164
+ ]
165
+ }
166
+ );
167
+ });
168
+ CodeHighlightTabs.displayName = "@mantine/core/CodeHighlightTabs";
169
+ CodeHighlightTabs.classes = classes;
170
+ export {
171
+ CodeHighlightTabs
172
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("../../../../../react@18.3.1/node_modules/react/jsx-runtime.cjs");
4
+ const rem = require("../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/utils/units-converters/rem.cjs");
5
+ function ExpandIcon({ expanded, style, ...others }) {
6
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
7
+ "svg",
8
+ {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ style: { width: rem.rem(18), height: rem.rem(18), ...style },
11
+ viewBox: "0 0 24 24",
12
+ strokeWidth: "2",
13
+ stroke: "currentColor",
14
+ fill: "none",
15
+ strokeLinecap: "round",
16
+ strokeLinejoin: "round",
17
+ ...others,
18
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
19
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
20
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M12 13v-8l-3 3m6 0l-3 -3" }),
21
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M9 17l1 0" }),
22
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M14 17l1 0" }),
23
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M19 17l1 0" }),
24
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M4 17l1 0" })
25
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
26
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
27
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M12 11v8l3 -3m-6 0l3 3" }),
28
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M9 7l1 0" }),
29
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M14 7l1 0" }),
30
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M19 7l1 0" }),
31
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("path", { d: "M4 7l1 0" })
32
+ ] })
33
+ }
34
+ );
35
+ }
36
+ exports.ExpandIcon = ExpandIcon;
@@ -0,0 +1,36 @@
1
+ import { j as jsxRuntimeExports } from "../../../../../react@18.3.1/node_modules/react/jsx-runtime.js";
2
+ import { rem } from "../../../../../@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hooks@7.13.2_react@18.3.1_hlfamvk7n3o6ychyvm5cyru4yu/node_modules/@mantine/core/esm/core/utils/units-converters/rem.js";
3
+ function ExpandIcon({ expanded, style, ...others }) {
4
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
5
+ "svg",
6
+ {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ style: { width: rem(18), height: rem(18), ...style },
9
+ viewBox: "0 0 24 24",
10
+ strokeWidth: "2",
11
+ stroke: "currentColor",
12
+ fill: "none",
13
+ strokeLinecap: "round",
14
+ strokeLinejoin: "round",
15
+ ...others,
16
+ children: expanded ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
18
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 13v-8l-3 3m6 0l-3 -3" }),
19
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M9 17l1 0" }),
20
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M14 17l1 0" }),
21
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M19 17l1 0" }),
22
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 17l1 0" })
23
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
24
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
25
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 11v8l3 -3m-6 0l3 3" }),
26
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M9 7l1 0" }),
27
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M14 7l1 0" }),
28
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M19 7l1 0" }),
29
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 7l1 0" })
30
+ ] })
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ ExpandIcon
36
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("../../../../../react@18.3.1/node_modules/react/jsx-runtime.cjs");
4
+ function FileIcon({ fileIcon, fileName, getFileIcon, className, style }) {
5
+ if (fileIcon) {
6
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className, style, children: fileIcon });
7
+ }
8
+ if (getFileIcon && fileName) {
9
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className, style, children: getFileIcon(fileName) });
10
+ }
11
+ return null;
12
+ }
13
+ exports.FileIcon = FileIcon;
@@ -0,0 +1,13 @@
1
+ import { j as jsxRuntimeExports } from "../../../../../react@18.3.1/node_modules/react/jsx-runtime.js";
2
+ function FileIcon({ fileIcon, fileName, getFileIcon, className, style }) {
3
+ if (fileIcon) {
4
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, style, children: fileIcon });
5
+ }
6
+ if (getFileIcon && fileName) {
7
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, style, children: getFileIcon(fileName) });
8
+ }
9
+ return null;
10
+ }
11
+ export {
12
+ FileIcon
13
+ };
@@ -8,7 +8,7 @@ function MediaQuery(props) {
8
8
  const { children, smallerThan, largerThan, query, styles: styles$1, className } = useProps.useProps("MediaQuery", {}, props);
9
9
  const { classes, cx } = styles.default({ smallerThan, largerThan, query, styles: styles$1 });
10
10
  if (children === void 0) {
11
- return void 0;
11
+ return null;
12
12
  }
13
13
  const child = React.Children.only(children);
14
14
  if (typeof child === "object" && child !== null && "props" in child) {
@@ -15,4 +15,4 @@ export interface MediaQueryProps {
15
15
  /** Styles applied to child when breakpoint matches */
16
16
  styles: CSSObject | ((theme: MantineTheme) => CSSObject);
17
17
  }
18
- export declare function MediaQuery(props: MediaQueryProps): string | number | boolean | Iterable<React.ReactNode> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
18
+ export declare function MediaQuery(props: MediaQueryProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -15,4 +15,4 @@ export interface MediaQueryProps {
15
15
  /** Styles applied to child when breakpoint matches */
16
16
  styles: CSSObject | ((theme: MantineTheme) => CSSObject);
17
17
  }
18
- export declare function MediaQuery(props: MediaQueryProps): string | number | boolean | Iterable<React.ReactNode> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
18
+ export declare function MediaQuery(props: MediaQueryProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -6,7 +6,7 @@ function MediaQuery(props) {
6
6
  const { children, smallerThan, largerThan, query, styles, className } = useProps("MediaQuery", {}, props);
7
7
  const { classes, cx } = useStyles({ smallerThan, largerThan, query, styles });
8
8
  if (children === void 0) {
9
- return void 0;
9
+ return null;
10
10
  }
11
11
  const child = Children.only(children);
12
12
  if (typeof child === "object" && child !== null && "props" in child) {
@@ -132,6 +132,8 @@ const Calendar = require("../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_c
132
132
  const Month = require("../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hoo_fqvtf6tg4qjwkxanualzufe6zy/node_modules/@mantine/dates/esm/components/Month/Month.cjs");
133
133
  const TimeInput = require("../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hoo_fqvtf6tg4qjwkxanualzufe6zy/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.cjs");
134
134
  const TextInput = require("./TextInput/TextInput.cjs");
135
+ const CodeHighlight = require("../node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlight.cjs");
136
+ const CodeHighlightTabs = require("../node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlightTabs.cjs");
135
137
  exports.useColorScheme = useColorScheme.useColorScheme;
136
138
  exports.Dropzone = index.Dropzone;
137
139
  exports.notifier = index$1.notifier;
@@ -269,3 +271,5 @@ exports.Calendar = Calendar.Calendar;
269
271
  exports.Month = Month.Month;
270
272
  exports.TimeInput = TimeInput.TimeInput;
271
273
  exports.TextInput = TextInput.TextInput;
274
+ exports.CodeHighlight = CodeHighlight.CodeHighlight;
275
+ exports.CodeHighlightTabs = CodeHighlightTabs.CodeHighlightTabs;
@@ -44,3 +44,5 @@ export { TextInput, type TextInputProps } from './TextInput/index.js';
44
44
  export { notifier } from './notifier/index.js';
45
45
  export { Typography, TYPOGRAPHY_STYLES_MAP, type TypographyProps } from './Typography/index.js';
46
46
  export { MediaQuery, type MediaQueryProps } from './MediaQuery/index.js';
47
+ export { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';
48
+ export type { CodeHighlightProps, CodeHighlightTabsProps } from '@mantine/code-highlight';
@@ -44,3 +44,5 @@ export { TextInput, type TextInputProps } from './TextInput/index.js';
44
44
  export { notifier } from './notifier/index.js';
45
45
  export { Typography, TYPOGRAPHY_STYLES_MAP, type TypographyProps } from './Typography/index.js';
46
46
  export { MediaQuery, type MediaQueryProps } from './MediaQuery/index.js';
47
+ export { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';
48
+ export type { CodeHighlightProps, CodeHighlightTabsProps } from '@mantine/code-highlight';
@@ -130,6 +130,8 @@ import { Calendar } from "../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_c
130
130
  import { Month } from "../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hoo_fqvtf6tg4qjwkxanualzufe6zy/node_modules/@mantine/dates/esm/components/Month/Month.js";
131
131
  import { TimeInput } from "../node_modules/.pnpm/@mantine_dates@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@mantine_hoo_fqvtf6tg4qjwkxanualzufe6zy/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.js";
132
132
  import { TextInput } from "./TextInput/TextInput.js";
133
+ import { CodeHighlight } from "../node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlight.js";
134
+ import { CodeHighlightTabs } from "../node_modules/.pnpm/@mantine_code-highlight@7.13.2_@mantine_core@7.13.2_patch_hash_v5k5cxye7xaihpcgowhgciky7a_@ma_tdwfyw6pqjurzjjnx3eualyu44/node_modules/@mantine/code-highlight/esm/CodeHighlightTabs.js";
133
135
  export {
134
136
  Accordion,
135
137
  ActionIcon,
@@ -156,6 +158,8 @@ export {
156
158
  Chip,
157
159
  CloseButton,
158
160
  Code,
161
+ CodeHighlight,
162
+ CodeHighlightTabs,
159
163
  Collapse,
160
164
  ColorInput,
161
165
  ColorPicker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidbcloud/uikit",
3
- "version": "2.0.0-beta.65",
3
+ "version": "2.0.0-beta.67",
4
4
  "description": "tidbcloud uikit",
5
5
  "type": "module",
6
6
  "main": "dist/primitive/index.cjs",