@apify/ui-library 0.60.2 → 0.61.1-feataddaiagentcategories-114da5.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 (124) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/src/components/actor_template_card.d.ts +1 -0
  3. package/dist/src/components/actor_template_card.d.ts.map +1 -1
  4. package/dist/src/components/actor_template_card.js +31 -32
  5. package/dist/src/components/actor_template_card.js.map +1 -1
  6. package/dist/src/components/badge.d.ts +3 -3
  7. package/dist/src/components/badge.d.ts.map +1 -1
  8. package/dist/src/components/badge.js +32 -32
  9. package/dist/src/components/badge.js.map +1 -1
  10. package/dist/src/components/banner.d.ts.map +1 -1
  11. package/dist/src/components/banner.js +0 -2
  12. package/dist/src/components/banner.js.map +1 -1
  13. package/dist/src/components/button.d.ts +1 -1
  14. package/dist/src/components/button.d.ts.map +1 -1
  15. package/dist/src/components/button.js +1 -3
  16. package/dist/src/components/button.js.map +1 -1
  17. package/dist/src/components/code/code_block/code_block.d.ts +2 -2
  18. package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
  19. package/dist/src/components/code/code_block/code_block.js +2 -2
  20. package/dist/src/components/code/code_block/code_block.js.map +1 -1
  21. package/dist/src/components/code/one_line_code/one_line_code.js +1 -1
  22. package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
  23. package/dist/src/components/code/syntax_highlighter.d.ts +2 -2
  24. package/dist/src/components/code/syntax_highlighter.d.ts.map +1 -1
  25. package/dist/src/components/code/syntax_highlighter.js +0 -1
  26. package/dist/src/components/code/syntax_highlighter.js.map +1 -1
  27. package/dist/src/components/floating/menu.js +2 -2
  28. package/dist/src/components/floating/menu.js.map +1 -1
  29. package/dist/src/components/floating/menu_common.js +1 -1
  30. package/dist/src/components/floating/menu_common.js.map +1 -1
  31. package/dist/src/components/floating/menu_components.d.ts +9 -5
  32. package/dist/src/components/floating/menu_components.d.ts.map +1 -1
  33. package/dist/src/components/floating/menu_components.js.map +1 -1
  34. package/dist/src/components/readme_renderer/index.d.ts +2 -2
  35. package/dist/src/components/readme_renderer/index.d.ts.map +1 -1
  36. package/dist/src/components/readme_renderer/index.js +2 -2
  37. package/dist/src/components/readme_renderer/index.js.map +1 -1
  38. package/dist/src/components/readme_renderer/pythonize_value.d.ts +1 -2
  39. package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -1
  40. package/dist/src/components/readme_renderer/pythonize_value.js +2 -3
  41. package/dist/src/components/readme_renderer/pythonize_value.js.map +1 -1
  42. package/dist/src/components/readme_renderer/table_of_contents.d.ts +1 -2
  43. package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -1
  44. package/dist/src/components/readme_renderer/table_of_contents.js +11 -9
  45. package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
  46. package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
  47. package/dist/src/components/simple_markdown/simple_markdown.js +33 -33
  48. package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
  49. package/dist/src/components/simple_markdown/simple_markdown_components.d.ts +1 -1
  50. package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
  51. package/dist/src/components/simple_markdown/simple_markdown_components.js +11 -13
  52. package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
  53. package/dist/src/components/tag.d.ts +2 -2
  54. package/dist/src/components/tag.d.ts.map +1 -1
  55. package/dist/src/components/tag.js +1 -2
  56. package/dist/src/components/tag.js.map +1 -1
  57. package/dist/src/components/text/heading_content.js +0 -1
  58. package/dist/src/components/text/heading_content.js.map +1 -1
  59. package/dist/src/components/text/heading_marketing.js +0 -1
  60. package/dist/src/components/text/heading_marketing.js.map +1 -1
  61. package/dist/src/components/text/heading_shared.d.ts +2 -2
  62. package/dist/src/components/text/heading_shared.d.ts.map +1 -1
  63. package/dist/src/components/text/heading_shared.js +1 -3
  64. package/dist/src/components/text/heading_shared.js.map +1 -1
  65. package/dist/src/components/text/index.d.ts +2 -2
  66. package/dist/src/components/text/index.d.ts.map +1 -1
  67. package/dist/src/components/text/index.js +2 -2
  68. package/dist/src/components/text/index.js.map +1 -1
  69. package/dist/src/components/text/text_base.js +0 -1
  70. package/dist/src/components/text/text_base.js.map +1 -1
  71. package/dist/src/components/text/text_content.js +0 -1
  72. package/dist/src/components/text/text_content.js.map +1 -1
  73. package/dist/src/components/text/text_marketing.js +0 -1
  74. package/dist/src/components/text/text_marketing.js.map +1 -1
  75. package/dist/src/components/text/text_shared.d.ts +1 -2
  76. package/dist/src/components/text/text_shared.d.ts.map +1 -1
  77. package/dist/src/components/text/text_shared.js +1 -4
  78. package/dist/src/components/text/text_shared.js.map +1 -1
  79. package/dist/src/components/to_consolidate/card.js +0 -2
  80. package/dist/src/components/to_consolidate/card.js.map +1 -1
  81. package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
  82. package/dist/src/components/to_consolidate/markdown.js +2 -1
  83. package/dist/src/components/to_consolidate/markdown.js.map +1 -1
  84. package/dist/src/design_system/theme.js +1 -1
  85. package/dist/src/design_system/theme.js.map +1 -1
  86. package/dist/src/design_system/tokens/spaces.d.ts +1 -1
  87. package/dist/src/design_system/tokens/spaces.d.ts.map +1 -1
  88. package/dist/src/design_system/tokens/spaces.js.map +1 -1
  89. package/dist/tsconfig.build.tsbuildinfo +1 -1
  90. package/eslint.config.mjs +36 -0
  91. package/package.json +8 -9
  92. package/src/codemods/generate_color_property_tokens.mjs +2 -1
  93. package/src/codemods/generate_color_theme_files.mjs +2 -1
  94. package/src/codemods/generate_typograpy_tokens_files.mjs +2 -1
  95. package/src/components/actor_template_card.tsx +54 -37
  96. package/src/components/badge.tsx +47 -47
  97. package/src/components/banner.tsx +1 -2
  98. package/src/components/button.tsx +4 -4
  99. package/src/components/code/code_block/code_block.tsx +22 -22
  100. package/src/components/code/one_line_code/one_line_code.tsx +1 -1
  101. package/src/components/code/syntax_highlighter.tsx +3 -5
  102. package/src/components/floating/menu.tsx +8 -8
  103. package/src/components/floating/menu_common.tsx +2 -2
  104. package/src/components/floating/menu_components.tsx +7 -2
  105. package/src/components/readme_renderer/index.ts +2 -2
  106. package/src/components/readme_renderer/pythonize_value.ts +2 -4
  107. package/src/components/readme_renderer/table_of_contents.tsx +26 -11
  108. package/src/components/simple_markdown/simple_markdown.tsx +36 -36
  109. package/src/components/simple_markdown/simple_markdown_components.tsx +26 -28
  110. package/src/components/tag.tsx +29 -28
  111. package/src/components/text/heading_content.tsx +1 -1
  112. package/src/components/text/heading_marketing.tsx +1 -1
  113. package/src/components/text/heading_shared.tsx +2 -4
  114. package/src/components/text/index.ts +2 -2
  115. package/src/components/text/text_base.tsx +1 -1
  116. package/src/components/text/text_content.tsx +1 -1
  117. package/src/components/text/text_marketing.tsx +1 -1
  118. package/src/components/text/text_shared.tsx +2 -5
  119. package/src/components/to_consolidate/card.tsx +2 -2
  120. package/src/components/to_consolidate/markdown.tsx +2 -1
  121. package/src/design_system/generate_color_definitions.js +4 -3
  122. package/src/design_system/theme.ts +4 -4
  123. package/src/design_system/tokens/spaces.ts +2 -2
  124. package/.eslintrc +0 -41
@@ -0,0 +1,36 @@
1
+ import react from 'eslint-plugin-react';
2
+ import reactHooks from 'eslint-plugin-react-hooks';
3
+ import sonarjs from 'eslint-plugin-sonarjs';
4
+
5
+ import apifyJestConfig from '@apify/eslint-config/jest.js';
6
+ import apifyTypescriptConfig from '@apify/eslint-config/ts.js';
7
+
8
+ // eslint-disable-next-line import/no-default-export
9
+ export default [
10
+ { ignores: ['**/dist'] }, // Ignores need to happen first
11
+ ...apifyTypescriptConfig,
12
+ ...apifyJestConfig,
13
+ {
14
+
15
+ plugins: {
16
+ sonarjs,
17
+ react,
18
+ 'react-hooks': reactHooks,
19
+ },
20
+
21
+ languageOptions: {
22
+ sourceType: 'module',
23
+
24
+ parserOptions: {
25
+ projectService: true,
26
+ tsconfigRootDir: import.meta.dirname,
27
+ },
28
+ },
29
+ rules: {
30
+ 'react/react-in-jsx-scope': 'off',
31
+ 'no-void': 'off',
32
+ 'react/display-name': 'off',
33
+ 'react-hooks/exhaustive-deps': 'error',
34
+ },
35
+ },
36
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "0.60.2",
3
+ "version": "0.61.1-feataddaiagentcategories-114da5.67+8d90f77170f",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "scripts": {
14
14
  "test": "echo \"Warning: no test specified\" && exit 0",
15
- "lint": "eslint . --ext .ts,.tsx",
16
- "lint:fix": "eslint . --ext .ts,.tsx --fix",
15
+ "lint": "eslint .",
16
+ "lint:fix": "eslint . --fix",
17
17
  "build": "npm run clean && npm run compile",
18
18
  "clean": "rimraf ./dist",
19
19
  "compile": "tsc -p tsconfig.build.json",
@@ -51,21 +51,20 @@
51
51
  "styled-components": "^5.3.3"
52
52
  },
53
53
  "devDependencies": {
54
- "@apify/eslint-config-ts": "^0.4.1",
54
+ "@apify/eslint-config": "^1.0.0",
55
55
  "@types/lodash": "^4.14.200",
56
56
  "@types/node": "^22.10.5",
57
57
  "@types/react": "^18.2.74",
58
58
  "@types/react-syntax-highlighter": "^15.5.9",
59
59
  "@types/styled-components": "^5.1.34",
60
- "@typescript-eslint/eslint-plugin": "^5.62.0",
61
- "@typescript-eslint/parser": "^5.62.0",
62
- "eslint": "^8.45.0",
60
+ "eslint": "^9.22.0",
63
61
  "eslint-plugin-import": "2.26.0",
64
62
  "eslint-plugin-react": "^7.32.2",
65
63
  "eslint-plugin-react-hooks": "^4.6.0",
66
64
  "eslint-plugin-sonarjs": "^1.0.3",
67
65
  "recast": "^0.23.9",
68
- "typescript": "^5.1.6"
66
+ "typescript": "^5.1.6",
67
+ "typescript-eslint": "^8.24.0"
69
68
  },
70
- "gitHead": "9be44755b36f63bffd9cc9e248842eb758d469d8"
69
+ "gitHead": "8d90f77170fcb05cb8ed54e91ff0cdc366400ae3"
71
70
  }
@@ -1,5 +1,6 @@
1
- import { readFileSync, writeFileSync } from 'fs';
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
2
 
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
4
  import { print, types } from 'recast';
4
5
 
5
6
  const { builders } = types;
@@ -1,5 +1,6 @@
1
- import { readFileSync, writeFileSync } from 'fs';
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
2
 
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
4
  import { print, types } from 'recast';
4
5
 
5
6
  const { builders } = types;
@@ -1,5 +1,6 @@
1
- import { readFileSync, writeFileSync } from 'fs';
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
2
 
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
4
  import { print, types } from 'recast';
4
5
 
5
6
  const { builders } = types;
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import { theme } from '../design_system/theme.js';
5
- import { TextBaseComponent } from './text/text_base.js';
5
+ import { Badge } from './badge.js';
6
+ import { TextMarketing } from './text/text_marketing.js';
6
7
  import { VerticalTile } from './tile/index.js';
7
8
 
8
9
  interface ActorTemplateCardProps {
@@ -10,44 +11,16 @@ interface ActorTemplateCardProps {
10
11
  label: string;
11
12
  description: string;
12
13
  icons: React.ReactNode[];
14
+ useCases?: string[];
13
15
  }
14
16
 
15
17
  const WrapperClasses = {
16
18
  TEMPLATE_CARD_IMAGES: 'TemplateCard-Images',
17
19
  TEMPLATE_CARD_TEXT: 'TemplateCard-Text',
20
+ TEMPLATE_CARD_DESCRIPTION: 'TemplateCard-Description',
21
+ TEMPLATE_CARD_BADGES: 'TemplateCard-Badges',
18
22
  };
19
23
 
20
- const Text = styled(TextBaseComponent)`
21
- ${theme.typography.marketing.mobile.bodyM}
22
- color: ${theme.color.neutral.textMuted};
23
- overflow: hidden;
24
- text-overflow: ellipsis;
25
- display: -webkit-box;
26
- -webkit-line-clamp: 3;
27
- -webkit-box-orient: vertical;
28
-
29
- @media ${theme.layout.tablet} {
30
- ${theme.typography.marketing.tablet.bodyM}
31
- }
32
-
33
- @media ${theme.layout.desktop} {
34
- ${theme.typography.marketing.desktop.bodyM}
35
- }
36
- `;
37
-
38
- const Heading = styled(TextBaseComponent)`
39
- ${theme.typography.marketing.mobile.titleXs}
40
- color: ${theme.color.neutral.text};
41
-
42
- @media ${theme.layout.tablet} {
43
- ${theme.typography.marketing.tablet.titleXs}
44
- }
45
-
46
- @media ${theme.layout.desktop} {
47
- ${theme.typography.marketing.desktop.titleXs}
48
- }
49
- `;
50
-
51
24
  const TemplateCardContentWrapper = styled.div`
52
25
  display: flex;
53
26
  flex-direction: column;
@@ -55,11 +28,18 @@ const TemplateCardContentWrapper = styled.div`
55
28
  align-self: stretch;
56
29
  flex: 1 0 0;
57
30
  gap: ${theme.space.space16};
31
+ color: ${theme.color.neutral.text};
58
32
 
59
33
  .${WrapperClasses.TEMPLATE_CARD_IMAGES} {
60
34
  display: flex;
61
35
  align-items: flex-start;
62
36
  gap: ${theme.space.space16};
37
+ flex-wrap: wrap;
38
+ img,
39
+ svg {
40
+ max-width: ${theme.space.space40};
41
+ max-height: ${theme.space.space40};
42
+ }
63
43
  }
64
44
 
65
45
  .${WrapperClasses.TEMPLATE_CARD_TEXT} {
@@ -68,6 +48,20 @@ const TemplateCardContentWrapper = styled.div`
68
48
  align-items: flex-start;
69
49
  align-self: stretch;
70
50
  gap: ${theme.space.space4};
51
+
52
+ .${WrapperClasses.TEMPLATE_CARD_DESCRIPTION} {
53
+ color: ${theme.color.neutral.textMuted};
54
+ overflow: hidden;
55
+ text-overflow: ellipsis;
56
+ display: -webkit-box;
57
+ -webkit-line-clamp: 3;
58
+ -webkit-box-orient: vertical;
59
+ }
60
+ }
61
+
62
+ .${WrapperClasses.TEMPLATE_CARD_BADGES} {
63
+ display: flex;
64
+ gap: ${theme.space.space4};
71
65
  }
72
66
  `;
73
67
 
@@ -76,15 +70,38 @@ export const ActorTemplateCard: React.FC<ActorTemplateCardProps> = ({
76
70
  label,
77
71
  description,
78
72
  icons,
73
+ useCases,
79
74
  }) => {
80
75
  const templateCardContent = (
81
76
  <TemplateCardContentWrapper>
82
- <div className={WrapperClasses.TEMPLATE_CARD_IMAGES}>
83
- {icons}
84
- </div>
77
+ <div className={WrapperClasses.TEMPLATE_CARD_IMAGES}>{icons}</div>
85
78
  <div className={WrapperClasses.TEMPLATE_CARD_TEXT}>
86
- <Heading>{label}</Heading>
87
- <Text>{description}</Text>
79
+ <TextMarketing size="regular" weight="bold">
80
+ {label}
81
+ </TextMarketing>
82
+ <TextMarketing
83
+ size="small"
84
+ className={WrapperClasses.TEMPLATE_CARD_DESCRIPTION}
85
+ >
86
+ {description}
87
+ </TextMarketing>
88
+ </div>
89
+ <div className={WrapperClasses.TEMPLATE_CARD_BADGES}>
90
+ {useCases?.includes('STARTER') && (
91
+ <Badge variant="success">Starter</Badge>
92
+ )}
93
+ {useCases?.includes('AI') && (
94
+ <Badge
95
+ variant="success"
96
+ style={{
97
+ color: '#6E00F4',
98
+ fill: '#6E00F4',
99
+ background: '#E4D4F7',
100
+ }}
101
+ >
102
+ AI Agent
103
+ </Badge>
104
+ )}
88
105
  </div>
89
106
  </TemplateCardContentWrapper>
90
107
  );
@@ -5,17 +5,29 @@ import type { IconComponent, IconSize } from '@apify/ui-icons';
5
5
 
6
6
  import { theme } from '../design_system/theme.js';
7
7
  import type { WithTransientProps } from '../type_utils.js';
8
- import { type RegularBoxProps, type MarginSpacingProps, Box } from './box.js';
9
-
10
- type BadgeSize = typeof BADGE_SIZES[number];
8
+ import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
11
9
 
12
10
  export const BADGE_SIZES = ['medium', 'small'] as const;
13
11
 
12
+ type BadgeSize = typeof BADGE_SIZES[number];
13
+
14
14
  const BADGE_ICON_SIZES = {
15
15
  medium: '16',
16
16
  small: '12',
17
17
  } satisfies Record<BadgeSize, IconSize>;
18
18
 
19
+ export const BADGE_VARIANTS = ['neutral', 'neutral_muted', 'neutral_subtle', 'primary_black', 'primary_blue', 'success', 'warning', 'danger'] as const;
20
+
21
+ type BadgeVariant = typeof BADGE_VARIANTS[number];
22
+
23
+ export type BadgeProps = Omit<RegularBoxProps, 'onClick'> & MarginSpacingProps & {
24
+ as?: Exclude<React.ElementType, 'a' | 'button'>;
25
+ size?: BadgeSize;
26
+ variant?: BadgeVariant;
27
+ LeadingIcon?: IconComponent;
28
+ code?: boolean;
29
+ };
30
+
19
31
  const badgeSizeStyle = {
20
32
  medium: ($code) => css`
21
33
  padding: ${theme.space.space4} ${theme.space.space8};
@@ -36,82 +48,70 @@ const badgeSizeStyle = {
36
48
  `,
37
49
  } satisfies Record<BadgeSize, (code: boolean) => FlattenSimpleInterpolation>;
38
50
 
39
- type BadgeVariant = typeof BADGE_VARIANTS[number];
40
-
41
- export const BADGE_VARIANTS = ['neutral', 'neutral_muted', 'neutral_subtle', 'primary_black', 'primary_blue', 'success', 'warning', 'danger'] as const;
42
-
43
51
  const badgeVariantStyle = {
44
52
  neutral: css`
45
53
  color: ${theme.color.neutral.text};
46
54
  fill: ${theme.color.neutral.text};
47
55
  background: ${theme.color.neutral.background};
48
56
  box-shadow: inset 0 0 0 1px ${theme.color.neutral.border};
49
- `,
57
+ `,
50
58
  neutral_muted: css`
51
- color: ${theme.color.neutral.text};
52
- fill: ${theme.color.neutral.text};
53
- background: ${theme.color.neutral.chipBackground};
59
+ color: ${theme.color.neutral.text};
60
+ fill: ${theme.color.neutral.text};
61
+ background: ${theme.color.neutral.chipBackground};
54
62
  `,
55
63
  neutral_subtle: css`
56
- color: ${theme.color.neutral.textSubtle};
57
- fill: ${theme.color.neutral.textSubtle};
58
- background: ${theme.color.neutral.backgroundSubtle};
64
+ color: ${theme.color.neutral.textSubtle};
65
+ fill: ${theme.color.neutral.textSubtle};
66
+ background: ${theme.color.neutral.backgroundSubtle};
59
67
  `,
60
68
  primary_black: css`
61
69
  color: ${theme.color.primaryBlack.chipText};
62
70
  fill: ${theme.color.primaryBlack.chipText};
63
71
  background: ${theme.color.primaryBlack.background};
64
- `,
72
+ `,
65
73
  primary_blue: css`
66
- color: ${theme.color.primary.chipText};
67
- fill: ${theme.color.primaryBlack.chipText};
68
- background: ${theme.color.primary.background};
74
+ color: ${theme.color.primary.chipText};
75
+ fill: ${theme.color.primaryBlack.chipText};
76
+ background: ${theme.color.primary.background};
69
77
  `,
70
78
  success: css`
71
- color: ${theme.color.success.chipText};
72
- fill: ${theme.color.success.chipText};
73
- background: ${theme.color.success.background};
79
+ color: ${theme.color.success.chipText};
80
+ fill: ${theme.color.success.chipText};
81
+ background: ${theme.color.success.background};
74
82
  `,
75
83
  warning: css`
76
- color: ${theme.color.warning.chipText};
77
- fill: ${theme.color.warning.chipText};
78
- background: ${theme.color.warning.background};
84
+ color: ${theme.color.warning.chipText};
85
+ fill: ${theme.color.warning.chipText};
86
+ background: ${theme.color.warning.background};
79
87
  `,
80
88
  danger: css`
81
- color: ${theme.color.danger.chipText};
82
- fill: ${theme.color.danger.chipText};
83
- background: ${theme.color.danger.background};
89
+ color: ${theme.color.danger.chipText};
90
+ fill: ${theme.color.danger.chipText};
91
+ background: ${theme.color.danger.background};
84
92
  `,
85
93
  } satisfies Record<BadgeVariant, FlattenSimpleInterpolation>;
86
94
 
87
95
  type StyledBadgeProps = WithTransientProps<
88
- Required<Pick<BadgeProps, 'size' | 'variant' | 'code'>>
96
+ Required<Pick<BadgeProps, 'size' | 'variant' | 'code'>>
89
97
  >;
90
98
 
91
99
  const StyledBadge = styled(Box)<StyledBadgeProps>`
92
- ${({ $size, $code }) => badgeSizeStyle[$size]($code)};
93
- ${({ $variant }) => badgeVariantStyle[$variant]};
100
+ ${({ $size, $code }) => badgeSizeStyle[$size]($code)};
101
+ ${({ $variant }) => badgeVariantStyle[$variant]};
94
102
 
95
103
  /* Static styles */
96
- width: fit-content;
97
- border: none;
98
- outline: none;
99
- display: flex;
100
- flex-direction: row;
101
- justify-content: center;
102
- align-items: center;
103
- white-space: nowrap;
104
- gap: ${theme.space.space4};
104
+ width: fit-content;
105
+ border: none;
106
+ outline: none;
107
+ display: flex;
108
+ flex-direction: row;
109
+ justify-content: center;
110
+ align-items: center;
111
+ white-space: nowrap;
112
+ gap: ${theme.space.space4};
105
113
  `;
106
114
 
107
- export type BadgeProps = Omit<RegularBoxProps, 'onClick'> & MarginSpacingProps & {
108
- as?: Exclude<React.ElementType, 'a' | 'button'>;
109
- size?: BadgeSize;
110
- variant?: BadgeVariant;
111
- LeadingIcon?: IconComponent;
112
- code?: boolean;
113
- };
114
-
115
115
  /**
116
116
  * Component for displaying non-interactive chip descendant.
117
117
  */
@@ -3,7 +3,6 @@ import styled, { css } from 'styled-components';
3
3
 
4
4
  import { theme } from '../design_system/theme.js';
5
5
 
6
- /* eslint-disable max-len */
7
6
  const BANNER_GRADIENT_BACKGROUND_SVG = `<svg width="1200" height="148" viewBox="0 0 1200 148" fill="none" xmlns="http://www.w3.org/2000/svg">
8
7
  <g clip-path="url(#clip0_2285_34756)">
9
8
  <g filter="url(#filter0_f_2285_34756)">
@@ -57,7 +56,7 @@ interface BannerProps {
57
56
  width?: string,
58
57
  className?: string,
59
58
  children: React.ReactNode,
60
- };
59
+ }
61
60
 
62
61
  const getBannerBackground = (background?: string, useGradientBackground?: boolean) => {
63
62
  return css`
@@ -6,8 +6,8 @@ import { ExternalLinkIcon } from '@apify/ui-icons';
6
6
  import { theme } from '../design_system/theme.js';
7
7
  import { type WithRequired, type WithTransientProps } from '../type_utils.js';
8
8
  import { useSharedUiDependencies } from '../ui_dependency_provider.js';
9
- import { Box, type RegularBoxProps, type MarginSpacingProps } from './box.js';
10
- import { Link, isUrlExternal, type LinkProps } from './link.js';
9
+ import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
10
+ import { isUrlExternal, Link, type LinkProps } from './link.js';
11
11
 
12
12
  type ButtonSize = 'medium' | 'small';
13
13
  type ButtonColor = 'default' | 'success' | 'danger';
@@ -17,7 +17,7 @@ export interface TransientButtonProps {
17
17
  size?: ButtonSize;
18
18
  color?: ButtonColor;
19
19
  variant?: ButtonVariant;
20
- };
20
+ }
21
21
 
22
22
  export interface RegularButtonProps {
23
23
  trackingId?: string,
@@ -25,7 +25,7 @@ export interface RegularButtonProps {
25
25
  LeftIcon?: React.ElementType,
26
26
  RightIcon?: React.ElementType,
27
27
  disabled?: boolean;
28
- };
28
+ }
29
29
 
30
30
  // Props shared for both types of the button
31
31
  export type CommonButtonProps = RegularButtonProps & TransientButtonProps & MarginSpacingProps;
@@ -7,10 +7,31 @@ import { Link } from '../../link.js';
7
7
  import { Text } from '../../text/index.js';
8
8
  import type { SharedTextSize } from '../../text/text_shared.js';
9
9
  import { ActionButton, CopyButton } from '../action_button.js';
10
- import SyntaxHighlighter from '../syntax_highlighter.js';
10
+ import { SyntaxHighlighter } from '../syntax_highlighter.js';
11
11
  import { CodeBlockWrapper } from './code_block.styled.js';
12
12
  import { mapPrefixToBashLine } from './utils.js';
13
13
 
14
+ type CodeTab = {
15
+ key: string;
16
+ label: string;
17
+ code: string;
18
+ id?: string;
19
+ highlightLines?: number[];
20
+ language?: string;
21
+ bashCommandsStart?: number[];
22
+ to?: string;
23
+ }
24
+
25
+ type HeaderProps = {
26
+ tabs: CodeTab[] | null;
27
+ currentTab: CodeTab | null;
28
+ onTabChange: (tab: CodeTab, e: React.MouseEvent) => void;
29
+ title?: string;
30
+ showBashHeader?: boolean;
31
+ }
32
+
33
+ const LANGUAGES_WITHOUT_LINE_NUMBERS = ['json', 'jsonp', 'jsonp', 'rss', 'yaml', 'xml', 'html', 'bash', 'text', 'dockerfile', 'http'];
34
+
14
35
  function HeaderDots() {
15
36
  return (
16
37
  <div className="CodeBlock-HederDotsWrapper">
@@ -21,14 +42,6 @@ function HeaderDots() {
21
42
  );
22
43
  }
23
44
 
24
- interface HeaderProps {
25
- tabs: CodeTab[] | null;
26
- currentTab: CodeTab | null;
27
- onTabChange: (tab: CodeTab, e: React.MouseEvent) => void;
28
- title?: string;
29
- showBashHeader?: boolean;
30
- }
31
-
32
45
  function Header({
33
46
  tabs,
34
47
  currentTab,
@@ -76,19 +89,6 @@ function Header({
76
89
  );
77
90
  }
78
91
 
79
- const LANGUAGES_WITHOUT_LINE_NUMBERS = ['json', 'jsonp', 'jsonp', 'rss', 'yaml', 'xml', 'html', 'bash', 'text', 'dockerfile', 'http'];
80
-
81
- interface CodeTab {
82
- key: string;
83
- label: string;
84
- code: string;
85
- id?: string;
86
- highlightLines?: number[];
87
- language?: string;
88
- bashCommandsStart?: number[];
89
- to?: string;
90
- }
91
-
92
92
  type CodeBlockProps = RegularBoxProps & {
93
93
  content: string | CodeTab[]; // TODO: Try to make it work with children props
94
94
  size?: SharedTextSize;
@@ -8,8 +8,8 @@ import type { BoxProps } from '../../box.js';
8
8
  import { Text } from '../../text/index.js';
9
9
  import type { SharedTextSize } from '../../text/text_shared.js';
10
10
  import { ActionButton, CopyButton } from '../action_button.js';
11
- import SyntaxHighlighter, { SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter.js';
12
11
  import type { SyntaxHighlighterBaseStylesWrapperProps } from '../syntax_highlighter.js';
12
+ import { SyntaxHighlighter, SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter.js';
13
13
 
14
14
  export const oneLineCodeClassNames = {
15
15
  gradientWrapper: 'OneLineCode-GradientWrapper',
@@ -34,7 +34,7 @@ import styled, { css } from 'styled-components';
34
34
  import { theme } from '../../design_system/theme.js';
35
35
  import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
36
36
  import { Box } from '../box.js';
37
- import { Text, type SharedTextProps } from '../text/index.js';
37
+ import { type SharedTextProps, Text } from '../text/index.js';
38
38
  import type { SharedTextSize } from '../text/text_shared.js';
39
39
 
40
40
  ReactSyntaxHighlighter.registerLanguage('typescript', ts);
@@ -96,7 +96,7 @@ export const SyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterPro
96
96
  }, ref) => {
97
97
  const { uiTheme } = useSharedUiDependencies();
98
98
 
99
- const PreTag = (preProps: any) => {
99
+ const PreTag = (preProps: ReactSyntaxHighlighterProps) => {
100
100
  return <StyledPre {...preProps} size={size} forwardedAs='pre' type='code' ref={ref}/>;
101
101
  };
102
102
 
@@ -116,7 +116,7 @@ export const SyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterPro
116
116
  export type SyntaxHighlighterBaseStylesWrapperProps = SharedTextProps & {
117
117
  $fullWidth?: boolean;
118
118
  $fullHeight?: string;
119
- $showLineNumbers?: any;
119
+ $showLineNumbers?: boolean;
120
120
  }
121
121
 
122
122
  export const SyntaxHighlighterBaseStylesWrapper = styled(Box)<SyntaxHighlighterBaseStylesWrapperProps>`
@@ -132,5 +132,3 @@ export const SyntaxHighlighterBaseStylesWrapper = styled(Box)<SyntaxHighlighterB
132
132
  background-color: transparent;
133
133
  position: relative;
134
134
  `;
135
-
136
- export default SyntaxHighlighter;
@@ -1,18 +1,18 @@
1
1
  import {
2
- useRole,
3
- useListNavigation,
4
- useTypeahead,
2
+ FloatingFocusManager,
3
+ FloatingPortal,
5
4
  useClick,
6
5
  useDismiss,
7
6
  useInteractions,
8
- FloatingPortal,
9
- FloatingFocusManager,
7
+ useListNavigation,
8
+ useRole,
9
+ useTypeahead,
10
10
  } from '@floating-ui/react';
11
11
  import clsx from 'clsx';
12
12
  import React, {
13
- useState,
14
- useRef,
15
13
  useMemo,
14
+ useRef,
15
+ useState,
16
16
  } from 'react';
17
17
 
18
18
  import {
@@ -91,7 +91,7 @@ export const Menu = <T extends MenuOption>({
91
91
  if (closeOnSelect) setIsOpen(false);
92
92
  };
93
93
 
94
- const listRef = useRef<Array<HTMLElement | null>>([]);
94
+ const listRef = useRef<(HTMLElement | null)[]>([]);
95
95
  const isTypingRef = useRef(false);
96
96
  const listContentRef = useRef(options.map((option) => option.label));
97
97
 
@@ -1,8 +1,8 @@
1
1
  import {
2
- useFloating,
2
+ autoUpdate,
3
3
  offset,
4
4
  size,
5
- autoUpdate,
5
+ useFloating,
6
6
  } from '@floating-ui/react';
7
7
 
8
8
  export const useFloatingMenu = ({
@@ -1,6 +1,6 @@
1
1
  import {
2
- type UseFloatingReturn,
3
2
  type ReferenceType,
3
+ type UseFloatingReturn,
4
4
  } from '@floating-ui/react';
5
5
  import { forwardRef } from 'react';
6
6
  import styled, { css } from 'styled-components';
@@ -8,6 +8,7 @@ import styled, { css } from 'styled-components';
8
8
  import { ChevronDownIcon } from '@apify/ui-icons';
9
9
 
10
10
  import { theme } from '../../design_system/theme.js';
11
+ import type { BoxProps } from '../box.js';
11
12
  import { Box } from '../box.js';
12
13
 
13
14
  export type FloatingContext = Pick<UseFloatingReturn<ReferenceType>, 'context'>['context'];
@@ -78,10 +79,14 @@ export const PlainMenuBaseComponent = styled(Box)`
78
79
  }
79
80
  `;
80
81
 
82
+ type DropdownMenuBaseComponentProps = {
83
+ children: React.ReactNode;
84
+ } & BoxProps;
85
+
81
86
  /**
82
87
  * Menu base component WITH dropdown icon
83
88
  */
84
- export const DropdownMenuBaseComponent = forwardRef<HTMLElement, any>(({
89
+ export const DropdownMenuBaseComponent = forwardRef<HTMLElement, DropdownMenuBaseComponentProps>(({
85
90
  children,
86
91
  ...props
87
92
  }, ref) => {
@@ -1,3 +1,3 @@
1
1
  export { useActorTitleHeadingFilter } from './utils.js';
2
- export { default as pythonizeValue } from './pythonize_value.js';
3
- export { default as TableOfContents } from './table_of_contents.js';
2
+ export { pythonizeValue } from './pythonize_value.js';
3
+ export { TableOfContents } from './table_of_contents.js';
@@ -22,7 +22,7 @@ const escapeChar = (character: string) => {
22
22
  // Escapes special characters in a string and surrounds it with proper quotes
23
23
  const pythonQuoteString = (str: string, escapeNewlines = true) => {
24
24
  const escapedValue = str.replace(/[\x00-\x09\x0b-\x1f\x22\x5c]/g, escapeChar);
25
- if (!escapeNewlines && /\n/.test(escapedValue)) {
25
+ if (!escapeNewlines && escapedValue.includes('\n')) {
26
26
  return '"""' + escapedValue + '"""';
27
27
  }
28
28
  return '"' + escapedValue.replace(/\n/g, '\\n') + '"';
@@ -34,7 +34,7 @@ const INDENT = ' ';
34
34
  // Doesn't support everything, because that would be impossible,
35
35
  // only the values which are supported in an input schema prefill (booleans, numbers, strings, arrays, objects)
36
36
  // Tries to keep the representation short, but readable.
37
- const pythonizeValue = <T>(value: T, depth = 0): string | T => {
37
+ export const pythonizeValue = <T>(value: T, depth = 0): string | T => {
38
38
  // None-like values
39
39
  if (value === undefined) return 'None';
40
40
  if (value === null) return 'None';
@@ -74,5 +74,3 @@ const pythonizeValue = <T>(value: T, depth = 0): string | T => {
74
74
  // This should never happen, if it did, something went wrong
75
75
  return 'UNSUPPORTED VALUE';
76
76
  };
77
-
78
- export default pythonizeValue;