@apify/ui-library 1.134.3 → 1.136.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 (35) hide show
  1. package/dist/src/components/card_container.d.ts +11 -1
  2. package/dist/src/components/card_container.d.ts.map +1 -1
  3. package/dist/src/components/card_container.js +13 -5
  4. package/dist/src/components/card_container.js.map +1 -1
  5. package/dist/src/components/code/code_block/utils.js +1 -1
  6. package/dist/src/components/code/code_block/utils.js.map +1 -1
  7. package/dist/src/design_system/colors/generated/css_variables.dark.d.ts +1 -1
  8. package/dist/src/design_system/colors/generated/css_variables.dark.d.ts.map +1 -1
  9. package/dist/src/design_system/colors/generated/css_variables.dark.js +1 -0
  10. package/dist/src/design_system/colors/generated/css_variables.dark.js.map +1 -1
  11. package/dist/src/design_system/colors/generated/css_variables.light.d.ts +1 -1
  12. package/dist/src/design_system/colors/generated/css_variables.light.d.ts.map +1 -1
  13. package/dist/src/design_system/colors/generated/css_variables.light.js +1 -0
  14. package/dist/src/design_system/colors/generated/css_variables.light.js.map +1 -1
  15. package/dist/src/design_system/colors/generated/properties_theme.d.ts +1 -0
  16. package/dist/src/design_system/colors/generated/properties_theme.d.ts.map +1 -1
  17. package/dist/src/design_system/colors/generated/properties_theme.js +1 -0
  18. package/dist/src/design_system/colors/generated/properties_theme.js.map +1 -1
  19. package/dist/src/design_system/theme.d.ts +1 -0
  20. package/dist/src/design_system/theme.d.ts.map +1 -1
  21. package/dist/tsconfig.build.tsbuildinfo +1 -1
  22. package/package.json +5 -5
  23. package/src/codemods/generate_typograpy_tokens_files.mjs +1 -1
  24. package/src/components/badge.stories.jsx +1 -1
  25. package/src/components/card_container.stories.tsx +17 -3
  26. package/src/components/card_container.tsx +25 -6
  27. package/src/components/code/code_block/utils.tsx +2 -2
  28. package/src/design_system/colors/Colors.mdx +21 -2
  29. package/src/design_system/colors/figma_color_tokens.dark.json +4 -0
  30. package/src/design_system/colors/figma_color_tokens.light.json +4 -0
  31. package/src/design_system/colors/generated/css_variables.dark.ts +1 -0
  32. package/src/design_system/colors/generated/css_variables.light.ts +1 -0
  33. package/src/design_system/colors/generated/properties_theme.ts +1 -0
  34. package/style/colors/dark.scss +1 -0
  35. package/style/colors/light.scss +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "1.134.3",
3
+ "version": "1.136.0",
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 .",
16
- "lint:fix": "eslint . --fix",
15
+ "lint": "oxlint --type-aware .",
16
+ "lint:fix": "oxlint --type-aware --fix .",
17
17
  "build": "npm run clean && npm run compile",
18
18
  "clean": "rimraf ./dist",
19
19
  "compile": "tsc -p tsconfig.build.json",
@@ -27,7 +27,7 @@
27
27
  "It's not nice, but helps us to get around the problem of multiple react instances."
28
28
  ],
29
29
  "dependencies": {
30
- "@apify/ui-icons": "^1.35.0",
30
+ "@apify/ui-icons": "^1.37.0",
31
31
  "@floating-ui/react": "^0.27.19",
32
32
  "@radix-ui/react-checkbox": "^1.3.3",
33
33
  "@radix-ui/react-collapsible": "^1.1.12",
@@ -70,5 +70,5 @@
70
70
  "src",
71
71
  "style"
72
72
  ],
73
- "gitHead": "a32a7d8199b17ee2467b767642bb826672ba8b59"
73
+ "gitHead": "28c73a5d1efc6bb7bd3621f92a83dd4910d59d3f"
74
74
  }
@@ -1,6 +1,6 @@
1
1
  import { readFileSync, writeFileSync } from 'node:fs';
2
2
 
3
- // eslint-disable-next-line import-x/no-extraneous-dependencies
3
+ // eslint-disable-next-line import-js/no-extraneous-dependencies
4
4
  import { print, types } from 'recast';
5
5
 
6
6
  const { builders } = types;
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line import-x/no-extraneous-dependencies
1
+ // eslint-disable-next-line import-js/no-extraneous-dependencies
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
@@ -1,10 +1,11 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { expect } from 'storybook/test';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  import { DragIndicatorIcon } from '@apify/ui-icons';
5
6
 
6
- import { CardContainer, type CardContainerProps } from './card_container.js';
7
7
  import { IconButton } from './icon_button.js';
8
+ import { CardContainer, cardContainerClassNames, type CardContainerProps } from './card_container.js';
8
9
 
9
10
  export default {
10
11
  title: 'UI-Library/Cards/CardContainer',
@@ -14,6 +15,10 @@ export default {
14
15
  control: { type: 'select' },
15
16
  options: ['TOP', 'BOTTOM'],
16
17
  },
18
+ contentPadding: {
19
+ control: { type: 'select' },
20
+ options: ['none', 'space2', 'space4', 'space8', 'space12', 'space16', 'space24'],
21
+ },
17
22
  },
18
23
  tags: ['new'],
19
24
  } as Meta<CardContainerProps>;
@@ -25,8 +30,9 @@ const StoryWrapper = styled.div`
25
30
  gap: 1rem;
26
31
  grid-template-columns: 1fr 1fr 1fr;
27
32
  `;
33
+
28
34
  /**
29
- * Default color wheel gradient with standard settings
35
+ * Default CardContainer with various header configurations.
30
36
  */
31
37
  export const Default: Story = {
32
38
  args: {
@@ -40,7 +46,7 @@ export const Default: Story = {
40
46
  <CardContainer
41
47
  {...args}
42
48
  header={<>
43
- <CardContainer.Heading>TEst</CardContainer.Heading>
49
+ <CardContainer.Heading>Test</CardContainer.Heading>
44
50
  <IconButton Icon={DragIndicatorIcon}/>
45
51
  </>}
46
52
  />
@@ -64,4 +70,12 @@ export const Default: Story = {
64
70
  </CardContainer>
65
71
  </StoryWrapper>;
66
72
  },
73
+ play: async ({ canvasElement }) => {
74
+ const headers = canvasElement.querySelectorAll(`.${cardContainerClassNames.HEADER}`);
75
+ // 5 of 6 containers have headers (one has header={null})
76
+ await expect(headers.length).toBe(5);
77
+
78
+ const contents = canvasElement.querySelectorAll(`.${cardContainerClassNames.CONTENT}`);
79
+ await expect(contents.length).toBe(6);
80
+ },
67
81
  };
@@ -4,6 +4,7 @@ import styled from 'styled-components';
4
4
  import type { ValueOf } from '@apify-packages/types';
5
5
 
6
6
  import { theme } from '../design_system/theme.js';
7
+ import type { Size } from '../design_system/tokens/index.js';
7
8
  import { Box, type BoxProps } from './box.js';
8
9
 
9
10
  export const cardContainerClassNames = {
@@ -16,7 +17,15 @@ const HEADER_PLACEMENT = {
16
17
  BOTTOM: 'BOTTOM',
17
18
  } as const;
18
19
 
19
- const Wrapper = styled(Box)<{ $headerPlacement: ValueOf<typeof HEADER_PLACEMENT> }>`
20
+ type ContentPaddingValue = Size | 'none';
21
+
22
+ const getContentPadding = (contentPadding?: ContentPaddingValue) => {
23
+ if (contentPadding === 'none') return 0;
24
+ if (contentPadding) return theme.space[contentPadding];
25
+ return theme.space.space16;
26
+ };
27
+
28
+ const Wrapper = styled(Box)<{ $headerPlacement: ValueOf<typeof HEADER_PLACEMENT>; $contentPadding?: ContentPaddingValue }>`
20
29
  background-color: ${theme.color.neutral.backgroundSubtle};
21
30
  border-radius: ${theme.radius.radius12};
22
31
 
@@ -26,11 +35,12 @@ const Wrapper = styled(Box)<{ $headerPlacement: ValueOf<typeof HEADER_PLACEMENT>
26
35
  flex-direction: ${({ $headerPlacement }) => ($headerPlacement === HEADER_PLACEMENT.TOP ? 'column' : 'column-reverse')};
27
36
 
28
37
  .${cardContainerClassNames.CONTENT} {
29
- /* Inner radius = outer radius - padding */
30
- border-radius: calc(${theme.radius.radius12} - ${theme.space.space2});
31
- background-color: ${theme.color.neutral.background};
38
+ /* 11px inner radius to match Figma (outer 12px - 1px visual offset) */
39
+ border-radius: 1.1rem;
40
+ background-color: ${({ $contentPadding }) => ($contentPadding === 'none' ? 'transparent' : theme.color.neutral.background)};
41
+ ${({ $contentPadding }) => $contentPadding === 'none' && 'overflow: hidden;'}
32
42
 
33
- padding: ${theme.space.space16};
43
+ padding: ${({ $contentPadding }) => getContentPadding($contentPadding)};
34
44
  flex-grow: 1;
35
45
  }
36
46
 
@@ -53,6 +63,14 @@ export type CardContainerProps = BoxProps & {
53
63
  * Pass `null` to render without a header section.
54
64
  */
55
65
  header: React.ReactNode,
66
+ /**
67
+ * Controls the padding of the content area. Accepts a space token or `'none'`.
68
+ * When set to `'none'`, padding is removed, the content background becomes transparent
69
+ * (the wrapper's subtle background shows through grid gaps), and overflow is hidden (corners clip to the inner border-radius).
70
+ * Other values (e.g. `'space8'`) change the padding but keep the white background.
71
+ * Defaults to `space16` with white background when not provided.
72
+ */
73
+ contentPadding?: ContentPaddingValue,
56
74
  };
57
75
 
58
76
  /**
@@ -64,9 +82,10 @@ export const CardContainer = ({
64
82
  children,
65
83
  header,
66
84
  headerPlacement = HEADER_PLACEMENT.TOP,
85
+ contentPadding,
67
86
  ...rest
68
87
  }: CardContainerProps) => (
69
- <Wrapper {...rest} $headerPlacement={headerPlacement}>
88
+ <Wrapper {...rest} $headerPlacement={headerPlacement} $contentPadding={contentPadding}>
70
89
  {header != null && (
71
90
  <div className={cardContainerClassNames.HEADER}>
72
91
  {typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
@@ -19,9 +19,9 @@ export const getBashLinePrefixes = (
19
19
  // by default each line that is not empty or comment is a command start
20
20
  if (bashCommandsStart.length === 0) {
21
21
  return isEmptyLine ? (
22
- <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} />
22
+ <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} key={`code-highlighter-line-bash-prefix-${i}`} />
23
23
  ) : (
24
- <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} color={theme.color.lavender.base}>$</CodeHighlighterLineBashPrefix>
24
+ <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} color={theme.color.lavender.base} key={`code-highlighter-line-bash-prefix-${i}`}>$</CodeHighlighterLineBashPrefix>
25
25
  );
26
26
  }
27
27
 
@@ -6,9 +6,28 @@ import { darkTheme } from './generated/colors_theme.dark.ts';
6
6
 
7
7
  # Colors
8
8
 
9
+ ## Semantic tokens
10
+
11
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '2rem' }}>
12
+ <div>
13
+ <h3>Light</h3>
14
+ <ColorPalette>
15
+ <ColorItem title="neutral.onSurface" subtitle="#6d71781f" colors={{ color: '#6d71781f' }} />
16
+ </ColorPalette>
17
+ </div>
18
+ <div>
19
+ <h3>Dark</h3>
20
+ <ColorPalette>
21
+ <ColorItem title="neutral.onSurface" subtitle="#6d717838" colors={{ color: '#6d717838' }} />
22
+ </ColorPalette>
23
+ </div>
24
+ </div>
25
+
26
+ ## Palette
27
+
9
28
  <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '2rem' }}>
10
29
  <div>
11
- <h2>Light Theme</h2>
30
+ <h3>Light Theme</h3>
12
31
  <ColorPalette>
13
32
  {Object.entries(lightTheme)
14
33
  .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))
@@ -18,7 +37,7 @@ import { darkTheme } from './generated/colors_theme.dark.ts';
18
37
  </ColorPalette>
19
38
  </div>
20
39
  <div>
21
- <h2>Dark Theme</h2>
40
+ <h3>Dark Theme</h3>
22
41
  <ColorPalette>
23
42
  {Object.entries(darkTheme)
24
43
  .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))
@@ -61,6 +61,10 @@
61
61
  "$type": "color",
62
62
  "$value": "{Palette.Neutral.775}"
63
63
  },
64
+ "On_Surface": {
65
+ "$type": "color",
66
+ "$value": "#6d717838"
67
+ },
64
68
  "Disabled": {
65
69
  "$type": "color",
66
70
  "$value": "{Palette.Neutral.750}"
@@ -61,6 +61,10 @@
61
61
  "$type": "color",
62
62
  "$value": "{Palette.Neutral.75}"
63
63
  },
64
+ "On_Surface": {
65
+ "$type": "color",
66
+ "$value": "#6d71781f"
67
+ },
64
68
  "Disabled": {
65
69
  "$type": "color",
66
70
  "$value": "{Palette.Neutral.50}"
@@ -18,6 +18,7 @@ export const tokens = `
18
18
  --color-neutral-border: #3d3f43;
19
19
  --color-neutral-separator-subtle: #333538;
20
20
  --color-neutral-hover: #292b2e;
21
+ --color-neutral-on-surface: rgba(109, 113, 120, 0.22);
21
22
  --color-neutral-disabled: #333538;
22
23
  --color-neutral-overflow: #242528;
23
24
  --color-neutral-icon: #bfc1c5;
@@ -18,6 +18,7 @@ export const tokens = `
18
18
  --color-neutral-border: #d2d3d6;
19
19
  --color-neutral-separator-subtle: #e4e5e6;
20
20
  --color-neutral-hover: #edeeef;
21
+ --color-neutral-on-surface: rgba(109, 113, 120, 0.12);
21
22
  --color-neutral-disabled: #f4f4f5;
22
23
  --color-neutral-overflow: #e4e5e6;
23
24
  --color-neutral-icon: #4f5257;
@@ -19,6 +19,7 @@ export const colorProperties = {
19
19
  border: 'var(--color-neutral-border)',
20
20
  separatorSubtle: 'var(--color-neutral-separator-subtle)',
21
21
  hover: 'var(--color-neutral-hover)',
22
+ onSurface: 'var(--color-neutral-on-surface)',
22
23
  disabled: 'var(--color-neutral-disabled)',
23
24
  overflow: 'var(--color-neutral-overflow)',
24
25
  icon: 'var(--color-neutral-icon)',
@@ -19,6 +19,7 @@ $tokens: (
19
19
  'color-neutral-border': #3d3f43,
20
20
  'color-neutral-separator-subtle': #333538,
21
21
  'color-neutral-hover': #292b2e,
22
+ 'color-neutral-on-surface': rgba(109, 113, 120, 0.22),
22
23
  'color-neutral-disabled': #333538,
23
24
  'color-neutral-overflow': #242528,
24
25
  'color-neutral-icon': #bfc1c5,
@@ -19,6 +19,7 @@ $tokens: (
19
19
  'color-neutral-border': #d2d3d6,
20
20
  'color-neutral-separator-subtle': #e4e5e6,
21
21
  'color-neutral-hover': #edeeef,
22
+ 'color-neutral-on-surface': rgba(109, 113, 120, 0.12),
22
23
  'color-neutral-disabled': #f4f4f5,
23
24
  'color-neutral-overflow': #e4e5e6,
24
25
  'color-neutral-icon': #4f5257,