@mantine/code-highlight 7.0.0-alpha.9 → 7.0.0-beta.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 (90) hide show
  1. package/cjs/CodeHighlight.js +83 -31
  2. package/cjs/CodeHighlight.js.map +1 -1
  3. package/cjs/CodeHighlight.module.css.js +1 -1
  4. package/cjs/CodeHighlight.theme.module.css.js +1 -1
  5. package/cjs/CodeHighlightTabs.js +157 -60
  6. package/cjs/CodeHighlightTabs.js.map +1 -1
  7. package/cjs/CopyIcon.js +44 -9
  8. package/cjs/CopyIcon.js.map +1 -1
  9. package/cjs/ExpandIcon.js +43 -15
  10. package/cjs/ExpandIcon.js.map +1 -1
  11. package/cjs/FileIcon.js +8 -8
  12. package/cjs/FileIcon.js.map +1 -1
  13. package/cjs/InlineCodeHighlight.js +57 -19
  14. package/cjs/InlineCodeHighlight.js.map +1 -1
  15. package/cjs/index.css +81 -118
  16. package/cjs/use-highlight.js +13 -13
  17. package/cjs/use-highlight.js.map +1 -1
  18. package/esm/CodeHighlight.js +83 -31
  19. package/esm/CodeHighlight.js.map +1 -1
  20. package/esm/CodeHighlight.module.css.js +1 -1
  21. package/esm/CodeHighlight.theme.module.css.js +1 -1
  22. package/esm/CodeHighlightTabs.js +157 -60
  23. package/esm/CodeHighlightTabs.js.map +1 -1
  24. package/esm/CopyIcon.js +44 -9
  25. package/esm/CopyIcon.js.map +1 -1
  26. package/esm/ExpandIcon.js +43 -15
  27. package/esm/ExpandIcon.js.map +1 -1
  28. package/esm/FileIcon.js +8 -8
  29. package/esm/FileIcon.js.map +1 -1
  30. package/esm/InlineCodeHighlight.js +57 -19
  31. package/esm/InlineCodeHighlight.js.map +1 -1
  32. package/esm/index.css +81 -118
  33. package/esm/use-highlight.js +13 -13
  34. package/esm/use-highlight.js.map +1 -1
  35. package/lib/CodeHighlight.d.ts +0 -3
  36. package/lib/CodeHighlightTabs.d.ts +1 -2
  37. package/lib/CopyIcon.d.ts +1 -1
  38. package/lib/ExpandIcon.d.ts +1 -1
  39. package/lib/FileIcon.d.ts +3 -1
  40. package/lib/InlineCodeHighlight.d.ts +0 -1
  41. package/lib/index.d.ts +3 -3
  42. package/package.json +8 -8
  43. package/src/CodeHighlight.module.css +14 -1
  44. package/src/CodeHighlight.story.tsx +6 -0
  45. package/src/CodeHighlight.tsx +1 -3
  46. package/src/CodeHighlightTabs.tsx +9 -4
  47. package/src/FileIcon.tsx +13 -3
  48. package/src/InlineCodeHighlight.tsx +0 -1
  49. package/src/index.ts +0 -3
  50. package/tsconfig.build.tsbuildinfo +1 -1
  51. package/cjs/src/mantine-code-highlight/src/CodeHighlight.js +0 -55
  52. package/cjs/src/mantine-code-highlight/src/CodeHighlight.js.map +0 -1
  53. package/cjs/src/mantine-code-highlight/src/CodeHighlight.module.css.js +0 -8
  54. package/cjs/src/mantine-code-highlight/src/CodeHighlight.module.css.js.map +0 -1
  55. package/cjs/src/mantine-code-highlight/src/CodeHighlight.theme.module.css.js +0 -8
  56. package/cjs/src/mantine-code-highlight/src/CodeHighlight.theme.module.css.js.map +0 -1
  57. package/cjs/src/mantine-code-highlight/src/CodeHighlightTabs.js +0 -90
  58. package/cjs/src/mantine-code-highlight/src/CodeHighlightTabs.js.map +0 -1
  59. package/cjs/src/mantine-code-highlight/src/CopyIcon.js +0 -25
  60. package/cjs/src/mantine-code-highlight/src/CopyIcon.js.map +0 -1
  61. package/cjs/src/mantine-code-highlight/src/ExpandIcon.js +0 -31
  62. package/cjs/src/mantine-code-highlight/src/ExpandIcon.js.map +0 -1
  63. package/cjs/src/mantine-code-highlight/src/FileIcon.js +0 -22
  64. package/cjs/src/mantine-code-highlight/src/FileIcon.js.map +0 -1
  65. package/cjs/src/mantine-code-highlight/src/InlineCodeHighlight.js +0 -43
  66. package/cjs/src/mantine-code-highlight/src/InlineCodeHighlight.js.map +0 -1
  67. package/cjs/src/mantine-code-highlight/src/index.js +0 -14
  68. package/cjs/src/mantine-code-highlight/src/index.js.map +0 -1
  69. package/cjs/src/mantine-code-highlight/src/use-highlight.js +0 -29
  70. package/cjs/src/mantine-code-highlight/src/use-highlight.js.map +0 -1
  71. package/esm/src/mantine-code-highlight/src/CodeHighlight.js +0 -46
  72. package/esm/src/mantine-code-highlight/src/CodeHighlight.js.map +0 -1
  73. package/esm/src/mantine-code-highlight/src/CodeHighlight.module.css.js +0 -4
  74. package/esm/src/mantine-code-highlight/src/CodeHighlight.module.css.js.map +0 -1
  75. package/esm/src/mantine-code-highlight/src/CodeHighlight.theme.module.css.js +0 -4
  76. package/esm/src/mantine-code-highlight/src/CodeHighlight.theme.module.css.js.map +0 -1
  77. package/esm/src/mantine-code-highlight/src/CodeHighlightTabs.js +0 -80
  78. package/esm/src/mantine-code-highlight/src/CodeHighlightTabs.js.map +0 -1
  79. package/esm/src/mantine-code-highlight/src/CopyIcon.js +0 -17
  80. package/esm/src/mantine-code-highlight/src/CopyIcon.js.map +0 -1
  81. package/esm/src/mantine-code-highlight/src/ExpandIcon.js +0 -23
  82. package/esm/src/mantine-code-highlight/src/ExpandIcon.js.map +0 -1
  83. package/esm/src/mantine-code-highlight/src/FileIcon.js +0 -14
  84. package/esm/src/mantine-code-highlight/src/FileIcon.js.map +0 -1
  85. package/esm/src/mantine-code-highlight/src/InlineCodeHighlight.js +0 -33
  86. package/esm/src/mantine-code-highlight/src/InlineCodeHighlight.js.map +0 -1
  87. package/esm/src/mantine-code-highlight/src/index.js +0 -4
  88. package/esm/src/mantine-code-highlight/src/index.js.map +0 -1
  89. package/esm/src/mantine-code-highlight/src/use-highlight.js +0 -21
  90. package/esm/src/mantine-code-highlight/src/use-highlight.js.map +0 -1
@@ -2,19 +2,19 @@ import { useState, useEffect } from 'react';
2
2
  import hljs from 'highlight.js';
3
3
 
4
4
  function useHighlight({ code, language, highlightOnClient }) {
5
- const getHighlightedCode = () => hljs.highlight(code.trim(), { language: language }).value;
6
- const [highlighted, setHighlighted] = useState(!highlightOnClient);
7
- const [highlightedCode, setHighlightedCode] = useState(highlightOnClient ? code : getHighlightedCode());
8
- const getCodeProps = () => highlighted
9
- ? { dangerouslySetInnerHTML: { __html: highlightedCode } }
10
- : { children: code.trim() };
11
- useEffect(() => {
12
- if (highlightOnClient) {
13
- setHighlightedCode(getHighlightedCode());
14
- setHighlighted(true);
15
- }
16
- }, []);
17
- return getCodeProps;
5
+ const getHighlightedCode = () => hljs.highlight(code.trim(), { language }).value;
6
+ const [highlighted, setHighlighted] = useState(!highlightOnClient);
7
+ const [highlightedCode, setHighlightedCode] = useState(
8
+ highlightOnClient ? code : getHighlightedCode()
9
+ );
10
+ const getCodeProps = () => highlighted ? { dangerouslySetInnerHTML: { __html: highlightedCode } } : { children: code.trim() };
11
+ useEffect(() => {
12
+ if (highlightOnClient) {
13
+ setHighlightedCode(getHighlightedCode());
14
+ setHighlighted(true);
15
+ }
16
+ }, []);
17
+ return getCodeProps;
18
18
  }
19
19
 
20
20
  export { useHighlight };
@@ -1 +1 @@
1
- {"version":3,"file":"use-highlight.js","sources":["../src/use-highlight.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport hljs from 'highlight.js';\n\ninterface UseHighlightInput {\n code: string;\n language: string;\n highlightOnClient: boolean | undefined;\n}\n\nexport function useHighlight({ code, language, highlightOnClient }: UseHighlightInput) {\n const getHighlightedCode = () => hljs.highlight(code.trim(), { language: language! }).value;\n const [highlighted, setHighlighted] = useState(!highlightOnClient);\n const [highlightedCode, setHighlightedCode] = useState(\n highlightOnClient ? code : getHighlightedCode()\n );\n\n const getCodeProps = () =>\n highlighted\n ? { dangerouslySetInnerHTML: { __html: highlightedCode } }\n : { children: code.trim() };\n\n useEffect(() => {\n if (highlightOnClient) {\n setHighlightedCode(getHighlightedCode());\n setHighlighted(true);\n }\n }, []);\n\n return getCodeProps;\n}\n"],"names":[],"mappings":";;;SASgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAqB;IACnF,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAS,EAAE,CAAC,CAAC,KAAK,CAAC;IAC5F,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CACpD,iBAAiB,GAAG,IAAI,GAAG,kBAAkB,EAAE,CAChD,CAAC;IAEF,MAAM,YAAY,GAAG,MACnB,WAAW;UACP,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE;UACxD,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;IAEhC,SAAS,CAAC;QACR,IAAI,iBAAiB,EAAE;YACrB,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;YACzC,cAAc,CAAC,IAAI,CAAC,CAAC;SACtB;KACF,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC;AACtB;;;;"}
1
+ {"version":3,"file":"use-highlight.js","sources":["../src/use-highlight.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport hljs from 'highlight.js';\n\ninterface UseHighlightInput {\n code: string;\n language: string;\n highlightOnClient: boolean | undefined;\n}\n\nexport function useHighlight({ code, language, highlightOnClient }: UseHighlightInput) {\n const getHighlightedCode = () => hljs.highlight(code.trim(), { language: language! }).value;\n const [highlighted, setHighlighted] = useState(!highlightOnClient);\n const [highlightedCode, setHighlightedCode] = useState(\n highlightOnClient ? code : getHighlightedCode()\n );\n\n const getCodeProps = () =>\n highlighted\n ? { dangerouslySetInnerHTML: { __html: highlightedCode } }\n : { children: code.trim() };\n\n useEffect(() => {\n if (highlightOnClient) {\n setHighlightedCode(getHighlightedCode());\n setHighlighted(true);\n }\n }, []);\n\n return getCodeProps;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE;AACpE,EAAE,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;AACnF,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACrE,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ;AACxD,IAAI,iBAAiB,GAAG,IAAI,GAAG,kBAAkB,EAAE;AACnD,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,MAAM,WAAW,GAAG,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;AAChI,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,IAAI,iBAAiB,EAAE;AAC3B,MAAM,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAC/C,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;AAC3B,KAAK;AACL,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,OAAO,YAAY,CAAC;AACtB;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { BoxProps, StylesApiProps, ElementProps, Factory } from '@mantine/core';
2
2
  export type CodeHighlightStylesNames = 'root' | 'code' | 'pre' | 'copy';
3
- export type CodeHighlightVariant = string;
4
3
  export interface CodeHighlightProps extends BoxProps, StylesApiProps<CodeHighlightFactory>, ElementProps<'div'> {
5
4
  /** Code to highlight */
6
5
  code: string;
@@ -19,11 +18,9 @@ export type CodeHighlightFactory = Factory<{
19
18
  props: CodeHighlightProps;
20
19
  ref: HTMLDivElement;
21
20
  stylesNames: CodeHighlightStylesNames;
22
- variant: CodeHighlightVariant;
23
21
  }>;
24
22
  export declare const CodeHighlight: import("@mantine/core").MantineComponent<{
25
23
  props: CodeHighlightProps;
26
24
  ref: HTMLDivElement;
27
25
  stylesNames: CodeHighlightStylesNames;
28
- variant: CodeHighlightVariant;
29
26
  }>;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BoxProps, StylesApiProps, ElementProps, Factory } from '@mantine/core';
3
- export type CodeHighlightTabsStylesNames = 'root' | 'code' | 'codeWrapper' | 'showCodeButton' | 'pre' | 'controls' | 'control' | 'header' | 'file' | 'files';
4
- export type CodeHighlightTabsVariant = string;
3
+ export type CodeHighlightTabsStylesNames = 'root' | 'code' | 'codeWrapper' | 'showCodeButton' | 'pre' | 'controls' | 'control' | 'header' | 'file' | 'files' | 'fileIcon';
5
4
  export type CodeHighlightTabsCssVariables = {
6
5
  root: '--ch-max-collapsed-height';
7
6
  };
package/lib/CopyIcon.d.ts CHANGED
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  interface CopyIconProps extends React.ComponentPropsWithoutRef<'svg'> {
3
3
  copied: boolean;
4
4
  }
5
- export declare function CopyIcon({ copied, style, ...others }: CopyIconProps): JSX.Element;
5
+ export declare function CopyIcon({ copied, style, ...others }: CopyIconProps): React.JSX.Element;
6
6
  export declare namespace CopyIcon {
7
7
  var displayName: string;
8
8
  }
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  interface ExpandIconProps extends React.ComponentPropsWithoutRef<'svg'> {
3
3
  expanded: boolean;
4
4
  }
5
- export declare function ExpandIcon({ expanded, style, ...others }: ExpandIconProps): JSX.Element;
5
+ export declare function ExpandIcon({ expanded, style, ...others }: ExpandIconProps): React.JSX.Element;
6
6
  export {};
package/lib/FileIcon.d.ts CHANGED
@@ -3,6 +3,8 @@ interface FileIconProps {
3
3
  fileName: string | undefined;
4
4
  getFileIcon?: ((fileName: string) => React.ReactNode) | undefined;
5
5
  fileIcon: React.ReactNode | undefined;
6
+ className?: string;
7
+ style?: React.CSSProperties;
6
8
  }
7
- export declare function FileIcon({ fileIcon, fileName, getFileIcon }: FileIconProps): JSX.Element | null;
9
+ export declare function FileIcon({ fileIcon, fileName, getFileIcon, className, style }: FileIconProps): React.JSX.Element | null;
8
10
  export {};
@@ -1,6 +1,5 @@
1
1
  import { BoxProps, StylesApiProps, ElementProps, Factory } from '@mantine/core';
2
2
  export type InlineCodeHighlightStylesNames = 'code';
3
- export type InlineCodeHighlightVariant = string;
4
3
  export interface InlineCodeHighlightProps extends BoxProps, StylesApiProps<InlineCodeHighlightFactory>, ElementProps<'div'> {
5
4
  /** Code to highlight */
6
5
  code: string;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { CodeHighlightTabs } from './CodeHighlightTabs';
2
2
  export { CodeHighlight } from './CodeHighlight';
3
3
  export { InlineCodeHighlight } from './InlineCodeHighlight';
4
- export type { CodeHighlightTabsFactory, CodeHighlightTabsStylesNames, CodeHighlightTabsProps, CodeHighlightTabsCode, CodeHighlightTabsVariant, CodeHighlightTabsCssVariables, } from './CodeHighlightTabs';
5
- export type { CodeHighlightFactory, CodeHighlightProps, CodeHighlightStylesNames, CodeHighlightVariant, } from './CodeHighlight';
6
- export type { InlineCodeHighlightFactory, InlineCodeHighlightProps, InlineCodeHighlightStylesNames, InlineCodeHighlightVariant, } from './InlineCodeHighlight';
4
+ export type { CodeHighlightTabsFactory, CodeHighlightTabsStylesNames, CodeHighlightTabsProps, CodeHighlightTabsCode, CodeHighlightTabsCssVariables, } from './CodeHighlightTabs';
5
+ export type { CodeHighlightFactory, CodeHighlightProps, CodeHighlightStylesNames, } from './CodeHighlight';
6
+ export type { InlineCodeHighlightFactory, InlineCodeHighlightProps, InlineCodeHighlightStylesNames, } from './InlineCodeHighlight';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@mantine/code-highlight",
3
3
  "description": "Code highlight with Mantine theme",
4
- "version": "7.0.0-alpha.9",
4
+ "version": "7.0.0-beta.0",
5
5
  "types": "./lib/index.d.ts",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./esm/index.js",
9
- "require": "./cjs/index.js"
9
+ "require": "./cjs/index.js",
10
+ "types": "./lib/index.d.ts"
10
11
  },
11
12
  "./styles.css": "./esm/index.css"
12
13
  },
@@ -36,15 +37,14 @@
36
37
  "syntax-highlight"
37
38
  ],
38
39
  "peerDependencies": {
39
- "@mantine/core": "7.0.0-alpha.9",
40
- "@mantine/hooks": "7.0.0-alpha.9",
41
- "react": ">=16.8.0",
42
- "react-dom": ">=16.8.0"
40
+ "@mantine/core": "7.0.0-beta.0",
41
+ "@mantine/hooks": "7.0.0-beta.0",
42
+ "react": "^18.2.0",
43
+ "react-dom": "^18.2.0"
43
44
  },
44
45
  "dependencies": {
45
46
  "highlight.js": "^11.7.0",
46
- "clsx": "1.1.1",
47
- "tslib": "^2.5.2"
47
+ "clsx": "2.0.0"
48
48
  },
49
49
  "devDependencies": {}
50
50
  }
@@ -11,7 +11,6 @@
11
11
  display: block;
12
12
  padding: var(--mantine-spacing-xs) var(--mantine-spacing-md);
13
13
  margin: 0;
14
- font-size: 16px; /* Required for Safari to be set in px */
15
14
  --_code-line-height: 1.7;
16
15
  }
17
16
 
@@ -67,6 +66,7 @@
67
66
  color: var(--_file-color);
68
67
  opacity: var(--_file-opacity);
69
68
  background-color: var(--_file-bg);
69
+ white-space: nowrap;
70
70
 
71
71
  @mixin hover {
72
72
  --_file-opacity: 1;
@@ -115,6 +115,7 @@
115
115
 
116
116
  &::before {
117
117
  content: '';
118
+ z-index: 100;
118
119
  position: absolute;
119
120
  inset: 0;
120
121
  pointer-events: none;
@@ -140,6 +141,7 @@
140
141
  color: var(--mantine-color-anchor);
141
142
  width: 100%;
142
143
  text-align: center;
144
+ z-index: 101;
143
145
  padding-top: var(--mantine-spacing-xs);
144
146
  padding-bottom: var(--mantine-spacing-xs);
145
147
 
@@ -152,3 +154,14 @@
152
154
  margin-top: 0;
153
155
  position: relative;
154
156
  }
157
+
158
+ .fileIcon {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ flex: 0;
163
+
164
+ & > svg {
165
+ display: block;
166
+ }
167
+ }
@@ -194,6 +194,12 @@ export function Tabs() {
194
194
  code={[
195
195
  { code: tsxCode, language: 'tsx', icon: <TsIcon />, fileName: 'Component.tsx' },
196
196
  { code: cssCode, language: 'css', icon: <CSSIcon />, fileName: 'Component.module.css' },
197
+ {
198
+ code: cssCode,
199
+ language: 'css',
200
+ icon: <CSSIcon />,
201
+ fileName: 'Long-file-name-that-will-break-to-another-line.css',
202
+ },
197
203
  ]}
198
204
  defaultExpanded={false}
199
205
  >
@@ -22,7 +22,6 @@ import themeClasses from './CodeHighlight.theme.module.css';
22
22
  const classes = { ..._classes, root: cx(_classes.root, themeClasses.theme) };
23
23
 
24
24
  export type CodeHighlightStylesNames = 'root' | 'code' | 'pre' | 'copy';
25
- export type CodeHighlightVariant = string;
26
25
 
27
26
  export interface CodeHighlightProps
28
27
  extends BoxProps,
@@ -51,7 +50,6 @@ export type CodeHighlightFactory = Factory<{
51
50
  props: CodeHighlightProps;
52
51
  ref: HTMLDivElement;
53
52
  stylesNames: CodeHighlightStylesNames;
54
- variant: CodeHighlightVariant;
55
53
  }>;
56
54
 
57
55
  const defaultProps: Partial<CodeHighlightProps> = {
@@ -111,7 +109,7 @@ export const CodeHighlight = factory<CodeHighlightFactory>((_props, ref) => {
111
109
  </CopyButton>
112
110
  )}
113
111
 
114
- <ScrollArea type="auto" dir="ltr" offsetScrollbars={false}>
112
+ <ScrollArea type="hover" dir="ltr" offsetScrollbars={false}>
115
113
  <pre {...getStyles('pre')}>
116
114
  <code {...getStyles('code')} {...getCodeProps()} />
117
115
  </pre>
@@ -37,9 +37,9 @@ export type CodeHighlightTabsStylesNames =
37
37
  | 'control'
38
38
  | 'header'
39
39
  | 'file'
40
- | 'files';
40
+ | 'files'
41
+ | 'fileIcon';
41
42
 
42
- export type CodeHighlightTabsVariant = string;
43
43
  export type CodeHighlightTabsCssVariables = {
44
44
  root: '--ch-max-collapsed-height';
45
45
  };
@@ -189,7 +189,12 @@ export const CodeHighlightTabs = factory<CodeHighlightTabsFactory>((_props, ref)
189
189
  mod={{ active: index === value }}
190
190
  onClick={() => setValue(index)}
191
191
  >
192
- <FileIcon fileIcon={node.icon} getFileIcon={getFileIcon} fileName={node.fileName} />
192
+ <FileIcon
193
+ fileIcon={node.icon}
194
+ getFileIcon={getFileIcon}
195
+ fileName={node.fileName}
196
+ {...getStyles('fileIcon')}
197
+ />
193
198
  <span>{node.fileName}</span>
194
199
  </UnstyledButton>
195
200
  ));
@@ -243,7 +248,7 @@ export const CodeHighlightTabs = factory<CodeHighlightTabsFactory>((_props, ref)
243
248
  mod={{ hidden: _expanded }}
244
249
  onClick={() => setExpanded(true)}
245
250
  >
246
- Expand code
251
+ {expandCodeLabel}
247
252
  </UnstyledButton>
248
253
  </Box>
249
254
  );
package/src/FileIcon.tsx CHANGED
@@ -4,15 +4,25 @@ interface FileIconProps {
4
4
  fileName: string | undefined;
5
5
  getFileIcon?: ((fileName: string) => React.ReactNode) | undefined;
6
6
  fileIcon: React.ReactNode | undefined;
7
+ className?: string;
8
+ style?: React.CSSProperties;
7
9
  }
8
10
 
9
- export function FileIcon({ fileIcon, fileName, getFileIcon }: FileIconProps) {
11
+ export function FileIcon({ fileIcon, fileName, getFileIcon, className, style }: FileIconProps) {
10
12
  if (fileIcon) {
11
- return <>{fileIcon}</>;
13
+ return (
14
+ <span className={className} style={style}>
15
+ {fileIcon}
16
+ </span>
17
+ );
12
18
  }
13
19
 
14
20
  if (getFileIcon && fileName) {
15
- return <>{getFileIcon(fileName)}</>;
21
+ return (
22
+ <span className={className} style={style}>
23
+ {getFileIcon(fileName)}
24
+ </span>
25
+ );
16
26
  }
17
27
 
18
28
  return null;
@@ -17,7 +17,6 @@ import themeClasses from './CodeHighlight.theme.module.css';
17
17
  const classes = { ..._classes, code: cx(_classes.code, themeClasses.theme) };
18
18
 
19
19
  export type InlineCodeHighlightStylesNames = 'code';
20
- export type InlineCodeHighlightVariant = string;
21
20
 
22
21
  export interface InlineCodeHighlightProps
23
22
  extends BoxProps,
package/src/index.ts CHANGED
@@ -6,18 +6,15 @@ export type {
6
6
  CodeHighlightTabsStylesNames,
7
7
  CodeHighlightTabsProps,
8
8
  CodeHighlightTabsCode,
9
- CodeHighlightTabsVariant,
10
9
  CodeHighlightTabsCssVariables,
11
10
  } from './CodeHighlightTabs';
12
11
  export type {
13
12
  CodeHighlightFactory,
14
13
  CodeHighlightProps,
15
14
  CodeHighlightStylesNames,
16
- CodeHighlightVariant,
17
15
  } from './CodeHighlight';
18
16
  export type {
19
17
  InlineCodeHighlightFactory,
20
18
  InlineCodeHighlightProps,
21
19
  InlineCodeHighlightStylesNames,
22
- InlineCodeHighlightVariant,
23
20
  } from './InlineCodeHighlight';