@apify/ui-library 0.71.1-featcolortokens-178953.63 → 0.71.1-featcolortokens-178953.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 (86) hide show
  1. package/dist/tsconfig.build.tsbuildinfo +1 -1
  2. package/package.json +3 -2
  3. package/src/codemods/generate_typograpy_tokens_files.mjs +137 -0
  4. package/src/components/action_link.tsx +60 -0
  5. package/src/components/actor_template_card.tsx +116 -0
  6. package/src/components/badge.tsx +148 -0
  7. package/src/components/banner.tsx +94 -0
  8. package/src/components/blog_article.tsx +85 -0
  9. package/src/components/box.tsx +127 -0
  10. package/src/components/button.tsx +305 -0
  11. package/src/components/chip.tsx +128 -0
  12. package/src/components/code/action_button.tsx +96 -0
  13. package/src/components/code/code_block/code_block.styled.tsx +180 -0
  14. package/src/components/code/code_block/code_block.tsx +224 -0
  15. package/src/components/code/code_block/code_block_with_tabs.tsx +257 -0
  16. package/src/components/code/code_block/utils.tsx +67 -0
  17. package/src/components/code/index.ts +5 -0
  18. package/src/components/code/inline_code/inline_code.tsx +62 -0
  19. package/src/components/code/one_line_code/one_line_code.tsx +228 -0
  20. package/src/components/code/prism_highlighter.tsx +180 -0
  21. package/src/components/color_wheel_gradient.tsx +31 -0
  22. package/src/components/floating/index.ts +3 -0
  23. package/src/components/floating/menu.tsx +189 -0
  24. package/src/components/floating/menu_common.tsx +31 -0
  25. package/src/components/floating/menu_components.tsx +99 -0
  26. package/src/components/image.tsx +24 -0
  27. package/src/components/index.ts +22 -0
  28. package/src/components/link.tsx +114 -0
  29. package/src/components/message.tsx +153 -0
  30. package/src/components/rating.tsx +106 -0
  31. package/src/components/readme_renderer/index.ts +3 -0
  32. package/src/components/readme_renderer/pythonize_value.ts +76 -0
  33. package/src/components/readme_renderer/table_of_contents.tsx +272 -0
  34. package/src/components/readme_renderer/utils.tsx +46 -0
  35. package/src/components/simple_markdown/index.ts +2 -0
  36. package/src/components/simple_markdown/simple_markdown.tsx +214 -0
  37. package/src/components/simple_markdown/simple_markdown_components.tsx +293 -0
  38. package/src/components/tabs/index.ts +2 -0
  39. package/src/components/tabs/tab.tsx +217 -0
  40. package/src/components/tabs/tabs.tsx +169 -0
  41. package/src/components/tag.tsx +196 -0
  42. package/src/components/text/heading_content.tsx +56 -0
  43. package/src/components/text/heading_marketing.tsx +55 -0
  44. package/src/components/text/heading_shared.tsx +55 -0
  45. package/src/components/text/index.ts +19 -0
  46. package/src/components/text/text_base.tsx +52 -0
  47. package/src/components/text/text_content.tsx +104 -0
  48. package/src/components/text/text_marketing.tsx +152 -0
  49. package/src/components/text/text_shared.tsx +95 -0
  50. package/src/components/tile/horizontal_tile.tsx +77 -0
  51. package/src/components/tile/index.ts +2 -0
  52. package/src/components/tile/shared.ts +27 -0
  53. package/src/components/tile/vertical_tile.tsx +59 -0
  54. package/src/components/to_consolidate/card.tsx +141 -0
  55. package/src/components/to_consolidate/index.ts +4 -0
  56. package/src/components/to_consolidate/markdown.tsx +609 -0
  57. package/src/components/to_consolidate/pagination.tsx +136 -0
  58. package/src/components/to_consolidate/tab_number_chip.tsx +31 -0
  59. package/src/design_system/colors/build_color_tokens.js +183 -0
  60. package/src/design_system/colors/figma_color_tokens.dark.json +886 -0
  61. package/src/design_system/colors/figma_color_tokens.light.json +886 -0
  62. package/src/design_system/colors/generated/colors_theme.dark.ts +110 -0
  63. package/src/design_system/colors/generated/colors_theme.light.ts +110 -0
  64. package/src/design_system/colors/generated/css_variables.dark.ts +147 -0
  65. package/src/design_system/colors/generated/css_variables.light.ts +147 -0
  66. package/src/design_system/colors/generated/css_variables_palette.dark.ts +74 -0
  67. package/src/design_system/colors/generated/css_variables_palette.light.ts +74 -0
  68. package/src/design_system/colors/generated/properties_theme.ts +179 -0
  69. package/src/design_system/colors/index.ts +7 -0
  70. package/src/design_system/supernova_typography_tokens.json +657 -0
  71. package/src/design_system/theme.ts +25 -0
  72. package/src/design_system/tokens/index.ts +5 -0
  73. package/src/design_system/tokens/layouts.ts +29 -0
  74. package/src/design_system/tokens/radiuses.ts +22 -0
  75. package/src/design_system/tokens/shadows.ts +22 -0
  76. package/src/design_system/tokens/spaces.ts +15 -0
  77. package/src/design_system/tokens/transitions.ts +19 -0
  78. package/src/design_system/typography_theme.ts +197 -0
  79. package/src/index.ts +8 -0
  80. package/src/type_utils.ts +7 -0
  81. package/src/ui_dependency_provider.tsx +58 -0
  82. package/src/utils/copy_to_clipboard.ts +24 -0
  83. package/src/utils/image_color.ts +42 -0
  84. package/src/utils/index.ts +4 -0
  85. package/src/utils/resize_observer.ts +18 -0
  86. package/src/utils/sanitization.ts +14 -0
@@ -0,0 +1,67 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ import { theme } from '../../../design_system/theme.js';
4
+ import { CodeHighlighterLineBashPrefix, CodeHighlighterLinePrefix } from '../prism_highlighter.js';
5
+
6
+ // input: [2, 4, 5, 6, 8, 10, 11, 12]
7
+ // returns string indicating what type of line it is (bashStartCommand, bashCommand, bashEmptyLine)
8
+ // commands start -> bashStartCommand
9
+ // every next line after command start until next command start or empty line -> bashCommand
10
+ export const getBashLinePrefixes = (
11
+ code: string,
12
+ bashCommandsStart: number[] = [],
13
+ isOneLine?: boolean) => {
14
+ const lines = code.split('\n').map((line) => line.trim());
15
+
16
+ const bashLinePrefixesArray = lines.map((line, i) => {
17
+ const isEmptyLine = line.startsWith('#') || !line;
18
+
19
+ // by default each line that is not empty or comment is a command start
20
+ if (bashCommandsStart.length === 0) {
21
+ return isEmptyLine ? (
22
+ <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} />
23
+ ) : (
24
+ <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} color={theme.color.lavender.base}>$</CodeHighlighterLineBashPrefix>
25
+ );
26
+ }
27
+
28
+ if (bashCommandsStart.includes(i + 1)) {
29
+ return (
30
+ <CodeHighlighterLineBashPrefix
31
+ $isOneLine={isOneLine}
32
+ color={theme.color.lavender.base}
33
+ key={`code-highlighter-line-bash-prefix-${i}`}
34
+ >$</CodeHighlighterLineBashPrefix>
35
+ );
36
+ }
37
+
38
+ if (isEmptyLine) {
39
+ return (
40
+ <CodeHighlighterLineBashPrefix
41
+ $isOneLine={isOneLine}
42
+ key={`code-highlighter-line-bash-prefix-${i}`}
43
+ />
44
+ );
45
+ }
46
+
47
+ return (
48
+ <CodeHighlighterLineBashPrefix
49
+ $isOneLine={isOneLine}
50
+ color={theme.color.lavender.base}
51
+ key={`code-highlighter-line-bash-prefix-${i}`}
52
+ >&lt;</CodeHighlighterLineBashPrefix>
53
+ );
54
+ });
55
+
56
+ return Object.fromEntries(bashLinePrefixesArray.map((linePrefix, i) => [i + 1, linePrefix]));
57
+ };
58
+
59
+ export const getNumberLinePrefixes = (code: string): Record<number, ReactNode> => {
60
+ const numberOfLines = code.split('\n').length;
61
+ const numbersArray = Array.from({ length: numberOfLines }, (_, i) => i + 1);
62
+
63
+ return Object.fromEntries(numbersArray.map((number) => [
64
+ number,
65
+ <CodeHighlighterLinePrefix key={`code-highlighter-line-prefix-${number}`}>{number}</CodeHighlighterLinePrefix>,
66
+ ]));
67
+ };
@@ -0,0 +1,5 @@
1
+ export * from './code_block/code_block.js';
2
+ export * from './code_block/code_block_with_tabs.js';
3
+ export * from './one_line_code/one_line_code.js';
4
+ export * from './inline_code/inline_code.js';
5
+ export * from './prism_highlighter.js';
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { CheckIcon, CopyIcon } from '@apify/ui-icons';
5
+
6
+ import { theme } from '../../../design_system/theme.js';
7
+ import { useCopyToClipboard } from '../../../utils/copy_to_clipboard.js';
8
+ import type { RegularBoxProps } from '../../box.js';
9
+ import { Text } from '../../text/index.js';
10
+ import type { SharedTextSize } from '../../text/text_shared.js';
11
+
12
+ // TODO: We should not need to export these once we consolidate Markdown
13
+ export const inlineCodeStyles = css`
14
+ width: fit-content;
15
+ padding: ${theme.space.space2} 0.6rem;
16
+ background-color: ${theme.color.neutral.backgroundMuted};
17
+ border-radius: ${theme.radius.radius8};
18
+ border: 1px solid ${theme.color.neutral.border};
19
+ `;
20
+
21
+ const CopyButtonWrapper = styled.div`
22
+ display: inline-flex;
23
+ cursor: pointer;
24
+ vertical-align: text-top;
25
+ margin-left: ${theme.space.space4};
26
+ `;
27
+
28
+ const CopyButton: React.FC<{ text: string }> = ({ text }) => {
29
+ const [isCopied, copyToClipboard] = useCopyToClipboard({ text });
30
+ return <CopyButtonWrapper role='button' onClick={copyToClipboard} title='Copy to clipboard'>
31
+ {isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
32
+ </CopyButtonWrapper>;
33
+ };
34
+
35
+ const Wrapper = styled.span`
36
+ code {
37
+ ${inlineCodeStyles}
38
+ }
39
+ `;
40
+
41
+ export type InlineCodeProps = RegularBoxProps & {
42
+ children: React.ReactNode,
43
+ size?: SharedTextSize,
44
+ withCopyButton?: boolean,
45
+ }
46
+
47
+ // This might be just a Chip component
48
+ export const InlineCode: React.FC<InlineCodeProps> = ({
49
+ children,
50
+ size,
51
+ withCopyButton,
52
+ ...props
53
+ }) => <Wrapper {...props}>
54
+ <Text
55
+ type="code"
56
+ as="code"
57
+ size={size}
58
+ >
59
+ {children}
60
+ {withCopyButton && <CopyButton text={children?.toString() ?? ''} />}
61
+ </Text>
62
+ </Wrapper>;
@@ -0,0 +1,228 @@
1
+ import { useMemo, useState } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { EyeIcon, EyeOffIcon } from '@apify/ui-icons';
5
+
6
+ import { theme } from '../../../design_system/theme.js';
7
+ import type { BoxProps } from '../../box.js';
8
+ import { Text } from '../../text/index.js';
9
+ import type { SharedTextSize } from '../../text/text_shared.js';
10
+ import { ActionButton, CopyButton } from '../action_button.js';
11
+ import type { SyntaxHighlighterBaseStylesWrapperProps } from '../code_block/code_block.styled.js';
12
+ import { SyntaxHighlighterBaseStylesWrapper } from '../code_block/code_block.styled.js';
13
+ import { getBashLinePrefixes } from '../code_block/utils.js';
14
+ import { PrismSyntaxHighlighter } from '../prism_highlighter.js';
15
+
16
+ export const oneLineCodeClassNames = {
17
+ gradientWrapper: 'OneLineCode-GradientWrapper',
18
+ scrollableWrapper: 'OneLineCode-ScrollableWrapper',
19
+ methodChip: 'OneLineCode-MethodChip',
20
+ gradient: 'OneLineCode-Gradient',
21
+ buttons: 'OneLineCode-Buttons',
22
+ };
23
+
24
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'PATCH';
25
+ type ThemeType = keyof Pick<
26
+ (typeof theme)['color'],
27
+ 'primary' | 'success' | 'warning' | 'danger' | 'neutral'
28
+ >;
29
+
30
+ const HTML_METHOD_CHIP_STYLES: Record<HttpMethod, ThemeType> = {
31
+ GET: 'primary',
32
+ POST: 'success',
33
+ PUT: 'warning',
34
+ DELETE: 'danger',
35
+ HEAD: 'neutral',
36
+ PATCH: 'neutral',
37
+ };
38
+
39
+ function getChipStyles(httpMethod: HttpMethod) {
40
+ const styles = theme.color[HTML_METHOD_CHIP_STYLES[httpMethod]];
41
+ return css`
42
+ background-color: ${styles.chipBackground};
43
+ color: ${'chipText' in styles ? styles.chipText : styles.text};
44
+ `;
45
+ }
46
+
47
+ type OneLineCodeWrapperProps = SyntaxHighlighterBaseStylesWrapperProps & {
48
+ $httpMethod?: HttpMethod;
49
+ $fitContent?: boolean;
50
+ $showBashPrefixes?: boolean;
51
+ $disabled?: boolean;
52
+ }
53
+
54
+ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCodeWrapperProps>`
55
+ display: flex;
56
+ padding-right: ${theme.space.space16} !important;
57
+ ${({ $fitContent }) => $fitContent && css`
58
+ width: fit-content;
59
+ `}
60
+
61
+ ${({ $disabled }) => $disabled && css`
62
+ opacity: 0.5;
63
+ cursor: not-allowed;
64
+ `}
65
+
66
+ height: 4.6rem;
67
+
68
+ .${oneLineCodeClassNames.buttons} {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: ${theme.space.space8};
72
+ }
73
+
74
+ .${oneLineCodeClassNames.methodChip} {
75
+ padding: 0 ${theme.space.space4};
76
+ border-radius: ${theme.radius.radius6};
77
+ height: 2.4rem;
78
+ ${({ $httpMethod }) => $httpMethod && getChipStyles($httpMethod)}
79
+ display: flex;
80
+ align-items: center;
81
+ }
82
+
83
+ .${oneLineCodeClassNames.gradientWrapper} {
84
+ position: relative;
85
+ flex: 1;
86
+ min-width: 0;
87
+ display: flex;
88
+
89
+ .${oneLineCodeClassNames.gradient} {
90
+ position: absolute;
91
+ right: 0;
92
+ top: 0;
93
+ bottom: 0;
94
+ width: 4rem;
95
+ z-index: 5;
96
+ background: linear-gradient(
97
+ to right,
98
+ transparent,
99
+ ${theme.color.neutral.backgroundMuted} 3rem
100
+ );
101
+ }
102
+ }
103
+
104
+ .${oneLineCodeClassNames.scrollableWrapper} {
105
+ flex: 1;
106
+ overflow-x: auto;
107
+ overflow-y: hidden;
108
+ display: flex;
109
+ align-items: center;
110
+ gap: ${theme.space.space16};
111
+ padding: 0 ${theme.space.space8} !important;
112
+ margin-left: ${theme.space.space8} !important;
113
+ height: 100%;
114
+
115
+ scrollbar-width: thin;
116
+ scrollbar-color: ${theme.color.neutral.border} transparent;
117
+
118
+
119
+ pre {
120
+ display: flex;
121
+ flex: 1;
122
+ align-items: center;
123
+ height: 100%;
124
+
125
+ code {
126
+ height: 100%;
127
+ display: flex;
128
+ align-items: center;
129
+
130
+ & > div {
131
+ padding-right: ${theme.space.space16};
132
+ }
133
+ }
134
+ }
135
+ }
136
+ `;
137
+
138
+ export type OneLineCodeProps = BoxProps & {
139
+ children: string;
140
+ language?: string;
141
+ size?: SharedTextSize;
142
+ httpMethod?: HttpMethod;
143
+ actionButtonLabel?: string;
144
+ onActionButtonClick?: () => Promise<void> | void;
145
+ fullWidth?: boolean;
146
+ secretPlaceholder?: string;
147
+ secret?: string;
148
+ disabled?: boolean;
149
+ hideCopyButton?: boolean;
150
+ }
151
+
152
+ export function OneLineCode({
153
+ children,
154
+ language,
155
+ size,
156
+ httpMethod,
157
+ actionButtonLabel,
158
+ onActionButtonClick,
159
+ fullWidth,
160
+ secretPlaceholder = '***',
161
+ secret,
162
+ disabled,
163
+ hideCopyButton,
164
+ ...rest
165
+ }: OneLineCodeProps) {
166
+ const hasSecret = secret !== undefined;
167
+ const [showSecret, setShowSecret] = useState(false);
168
+ const codeWithSecret = useMemo(() => {
169
+ if (!hasSecret) return children;
170
+ return children.replace(secretPlaceholder, secret);
171
+ }, [children, secret, hasSecret, secretPlaceholder]);
172
+ const code = showSecret ? codeWithSecret : children;
173
+
174
+ const showBashPrefixes = language === 'bash';
175
+
176
+ const linePrefixes = useMemo(
177
+ () => (showBashPrefixes ? getBashLinePrefixes(code, [1], true) : {}),
178
+ [showBashPrefixes, code],
179
+ );
180
+
181
+ return (
182
+ <OneLineCodeWrapper
183
+ $httpMethod={httpMethod}
184
+ $fullWidth={fullWidth}
185
+ $showBashPrefixes={showBashPrefixes}
186
+ $disabled={disabled}
187
+ {...rest}
188
+ >
189
+ <div className={oneLineCodeClassNames.gradientWrapper}>
190
+ <div className={oneLineCodeClassNames.scrollableWrapper}>
191
+ {httpMethod && (
192
+ <Text className={oneLineCodeClassNames.methodChip} as='div'>
193
+ {httpMethod}
194
+ </Text>
195
+ )}
196
+ <PrismSyntaxHighlighter
197
+ language={language}
198
+ size={size}
199
+ linePrefixes={linePrefixes}
200
+ code={code}
201
+ isSingleLine={true}
202
+ />
203
+ </div>
204
+ <div className={oneLineCodeClassNames.gradient} />
205
+ </div>
206
+ <div className={oneLineCodeClassNames.buttons}>
207
+ {hasSecret && (
208
+ <ActionButton
209
+ onClick={() => setShowSecret((prev) => !prev)}
210
+ data-test='toggle-visibility-button'
211
+ >
212
+ {showSecret ? (
213
+ <EyeOffIcon size="16" />
214
+ ) : (
215
+ <EyeIcon size="16" />
216
+ )}
217
+ </ActionButton>
218
+ )}
219
+ {!hideCopyButton && <CopyButton code={codeWithSecret} />}
220
+ {!!onActionButtonClick && (
221
+ <ActionButton onClick={onActionButtonClick}>
222
+ {actionButtonLabel}
223
+ </ActionButton>
224
+ )}
225
+ </div>
226
+ </OneLineCodeWrapper >
227
+ );
228
+ }
@@ -0,0 +1,180 @@
1
+ import clsx from 'clsx';
2
+ import _ from 'lodash';
3
+ import type { HighlightProps } from 'prism-react-renderer';
4
+ import { Highlight, Prism, themes } from 'prism-react-renderer';
5
+ import type { ReactNode } from 'react';
6
+ import { forwardRef, useRef } from 'react';
7
+ import styled, { css } from 'styled-components';
8
+
9
+ import { theme } from '../../design_system/theme.js';
10
+ import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
11
+ import { Text } from '../text/index.js';
12
+ import type { SharedTextSize } from '../text/text_shared.js';
13
+
14
+ (typeof global !== 'undefined' ? global : window).Prism = Prism;
15
+
16
+ const HIGHLIGHT_BACKGROUND_COLOR = 'rgba(22, 114, 235, 0.05)';
17
+
18
+ const loadLanguages = async () => {
19
+ await Promise.all([
20
+ // @ts-expect-error The library is badly typed and does not export the type
21
+ import('prismjs/components/prism-bash.js'),
22
+ // @ts-expect-error The library is badly typed and does not export the type
23
+ import('prismjs/components/prism-rust.js'),
24
+ // @ts-expect-error The library is badly typed and does not export the type
25
+ import('prismjs/components/prism-bash.js'),
26
+ // @ts-expect-error The library is badly typed and does not export the type
27
+ import('prismjs/components/prism-docker.js'),
28
+ // @ts-expect-error The library is badly typed and does not export the type
29
+ import('prismjs/components/prism-http.js'),
30
+ // @ts-expect-error The library is badly typed and does not export the type
31
+ import('prismjs/components/prism-javascript.js'),
32
+ // @ts-expect-error The library is badly typed and does not export the type
33
+ import('prismjs/components/prism-json.js'),
34
+ // @ts-expect-error The library is badly typed and does not export the type
35
+ import('prismjs/components/prism-markup.js'),
36
+ // @ts-expect-error The library is badly typed and does not export the type
37
+ import('prismjs/components/prism-python.js'),
38
+ // @ts-expect-error The library is badly typed and does not export the type
39
+ import('prismjs/components/prism-typescript.js'),
40
+ // @ts-expect-error The library is badly typed and does not export the type
41
+ import('prismjs/components/prism-xml-doc.js'),
42
+ // @ts-expect-error The library is badly typed and does not export the type
43
+ import('prismjs/components/prism-yaml.js'),
44
+ ]);
45
+ };
46
+
47
+ void loadLanguages();
48
+
49
+ type StyledPreProps = {
50
+ $hasLinePrefixes: boolean,
51
+ $isSingleLine: boolean
52
+ };
53
+
54
+ const StyledPre = styled.pre<StyledPreProps>`
55
+ width: 100%;
56
+ position: relative;
57
+ overflow: auto;
58
+ z-index: 2;
59
+ padding: ${({ $isSingleLine }) => ($isSingleLine ? 0 : `${theme.space.space16} 0`)};
60
+ margin: 0;
61
+
62
+ code {
63
+ min-width: 100%;
64
+ display: inline-block;
65
+ vertical-align: middle;
66
+
67
+ *,
68
+ *::before,
69
+ *::after {
70
+ text-shadow: none !important;
71
+ font-style: normal !important;
72
+ font-family: inherit !important;
73
+ font-size: inherit !important;
74
+ font-weight: inherit !important;
75
+ line-height: inherit !important;
76
+ background-color: transparent !important;
77
+ }
78
+
79
+ & > div {
80
+ display: block;
81
+
82
+ &.highlighted {
83
+ background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
84
+ border-left: 6px solid ${theme.color.neutral.border} !important;
85
+ padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
86
+ }
87
+
88
+ ${({ $isSingleLine }) => !$isSingleLine && css<{$hasLinePrefixes: boolean}>`
89
+ &:hover {
90
+ background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
91
+ border-left: 6px solid ${theme.color.neutral.border} !important;
92
+ padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
93
+ }
94
+ `}
95
+
96
+ ${({ $isSingleLine }) => ($isSingleLine ? css<StyledPreProps>`
97
+ white-space: nowrap;
98
+ vertical-align: text-top;
99
+ ` : css<StyledPreProps>`
100
+ padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? theme.space.space8 : theme.space.space16)};
101
+ padding-right: ${theme.space.space16};
102
+
103
+ &:hover {
104
+ background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
105
+ border-left: 6px solid ${theme.color.neutral.border} !important;
106
+ padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
107
+ }
108
+ `)}
109
+ }
110
+ }
111
+ `;
112
+
113
+ export const CodeHighlighterLinePrefix = styled(Text).attrs({ as: 'span' })`
114
+ display: inline-block;
115
+ margin-right: ${theme.space.space16};
116
+ text-align: right;
117
+ min-width: ${theme.space.space24};
118
+ color: ${({ color }) => color || theme.color.neutral.textSubtle};
119
+ user-select: none;
120
+ -webkit-user-select: none;
121
+ `;
122
+
123
+ export const CodeHighlighterLineBashPrefix = styled(CodeHighlighterLinePrefix)<{ $isOneLine?: boolean }>`
124
+ min-width: ${({ $isOneLine }) => ($isOneLine ? 'unset' : theme.space.space16)} !important;
125
+ `;
126
+
127
+ type SyntaxHighlighterProps = Omit<HighlightProps, 'children' | 'language'> & {
128
+ size?: SharedTextSize,
129
+ linePrefixes?: Record<string, ReactNode>,
130
+ highlightLines?: number[],
131
+ language?: string,
132
+ className?: string,
133
+ isSingleLine: boolean,
134
+ };
135
+
136
+ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterProps>(({
137
+ size = 'regular',
138
+ linePrefixes = {},
139
+ highlightLines = [],
140
+ language = 'javascript',
141
+ className,
142
+ isSingleLine,
143
+ ...rest
144
+ }, ref) => {
145
+ const { uiTheme } = useSharedUiDependencies();
146
+ const hasLinePrefixes = !_.isEmpty(linePrefixes);
147
+ const highlightedLinesObject = useRef<Record<number, boolean>>(Object.fromEntries(highlightLines.map((e) => [e, true])));
148
+
149
+ return (
150
+ <Highlight
151
+ theme={uiTheme === 'DARK' ? themes.nightOwl : themes.oneLight}
152
+ language={language}
153
+ {...rest}
154
+ >
155
+ {({ className: prismClassName, tokens, getLineProps, getTokenProps }) => (
156
+ <StyledPre
157
+ className={clsx(className, prismClassName)}
158
+ $hasLinePrefixes={hasLinePrefixes}
159
+ $isSingleLine={isSingleLine}
160
+ ref={ref}
161
+ >
162
+ <Text
163
+ size={size}
164
+ type='code'
165
+ as='code'
166
+ >
167
+ {tokens.map((line, i) => (
168
+ <div key={i} {...getLineProps({ line, className: highlightedLinesObject.current[i + 1] ? 'highlighted' : '' })}>
169
+ {hasLinePrefixes && (linePrefixes[i + 1] || <CodeHighlighterLinePrefix />)}
170
+ {line.map((token, key) => (
171
+ <span key={key} {...getTokenProps({ token })} />
172
+ ))}
173
+ </div>
174
+ ))}
175
+ </Text>
176
+ </StyledPre>
177
+ )}
178
+ </Highlight>
179
+ );
180
+ });
@@ -0,0 +1,31 @@
1
+ import styled from 'styled-components';
2
+
3
+ export interface ColorWheelGradientProps {
4
+ translateX?: number,
5
+ translateY?: number,
6
+ rotation?: number,
7
+ radius?: number,
8
+ blurSize?: number,
9
+ }
10
+
11
+ export const ColorWheelGradient = styled.div<ColorWheelGradientProps>`${({ radius, rotation = 0, blurSize = 40, translateX = 0, translateY = 0 }) => `
12
+ z-index: 1;
13
+ position: absolute;
14
+ width: ${radius ? `${radius}px` : 'auto'};
15
+ height: ${radius ? `${radius}px` : 'auto'};
16
+ transform-origin: center;
17
+ transform: translate(${translateX}px, ${translateY}px) rotate(${rotation}deg);
18
+
19
+ opacity: 0.30;
20
+ background: conic-gradient(
21
+ rgba(93, 133, 225, 0.99) 0deg,
22
+ rgba(106, 20, 222, 0.99) 69deg,
23
+ rgba(228, 68, 103, 0.99) 150deg,
24
+ rgba(250, 129, 54, 0.99) 221deg,
25
+ rgba(240, 178, 27, 0.99) 287deg,
26
+ rgba(18, 150, 111, 0.99) 360deg
27
+ );
28
+
29
+ border-radius: 50%;
30
+ filter: blur(${blurSize}px)
31
+ `}`;
@@ -0,0 +1,3 @@
1
+ export * from './menu.js';
2
+ export * from './menu_components.js';
3
+ export * from './menu_common.js';