@apify/ui-library 1.129.0 → 1.130.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "1.129.0",
3
+ "version": "1.130.0",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -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.31.0",
30
+ "@apify/ui-icons": "^1.32.0",
31
31
  "@floating-ui/react": "^0.26.2",
32
32
  "@radix-ui/react-checkbox": "^1.3.3",
33
33
  "@radix-ui/react-collapsible": "^1.0.0",
@@ -70,5 +70,5 @@
70
70
  "src",
71
71
  "style"
72
72
  ],
73
- "gitHead": "87c4357f05dcc81e71f9d2c3c53bed7df0c8877d"
73
+ "gitHead": "65136123362e410981952225035b672473abdf0e"
74
74
  }
@@ -14,8 +14,8 @@ export const actorAvatarClassnames = {
14
14
  SVG: 'ActorAvatar-svg',
15
15
  };
16
16
 
17
- const StyledBoringAvatarMarble = styled(BoringAvatarMarble)`
18
- border-radius: ${theme.radius.radius8};
17
+ const StyledBoringAvatarMarble = styled(BoringAvatarMarble)<{ $borderRadius: string | number }>`
18
+ border-radius: ${({ $borderRadius }) => $borderRadius};
19
19
 
20
20
  text {
21
21
  ${theme.typography.shared.mobile.bodyMStrong}
@@ -44,6 +44,7 @@ interface ActorAvatarProps extends React.ImgHTMLAttributes<HTMLImageElement> {
44
44
  url?: string | null;
45
45
  alt?: string;
46
46
  size: number;
47
+ borderRadius?: string | number;
47
48
  }
48
49
 
49
50
  export const ActorAvatarInner: FC<ActorAvatarProps> = ({
@@ -52,6 +53,7 @@ export const ActorAvatarInner: FC<ActorAvatarProps> = ({
52
53
  url,
53
54
  size,
54
55
  alt,
56
+ borderRadius = theme.radius.radius8,
55
57
  ...rest
56
58
  }) => {
57
59
  const [hasImageError, setHasImageError] = useState(false);
@@ -120,6 +122,7 @@ export const ActorAvatarInner: FC<ActorAvatarProps> = ({
120
122
  name={name}
121
123
  square={true}
122
124
  alt={altText}
125
+ $borderRadius={borderRadius}
123
126
  />
124
127
  );
125
128
  };
@@ -46,12 +46,12 @@ export const Default: Story = {
46
46
  />
47
47
  <CardContainer
48
48
  {...args}
49
- header={<>
49
+ header={
50
50
  <div>
51
51
  <CardContainer.Heading># Videos with this hashtag</CardContainer.Heading>
52
52
  <code style={{ marginLeft: 8 }}>Required</code>
53
53
  </div>
54
- </>}
54
+ }
55
55
  />
56
56
  <CardContainer
57
57
  {...args}
@@ -59,6 +59,9 @@ export const Default: Story = {
59
59
  Completely custom header content
60
60
  </>}
61
61
  />
62
+ <CardContainer {...args} header={null}>
63
+ Content without header
64
+ </CardContainer>
62
65
  </StoryWrapper>;
63
66
  },
64
67
  };
@@ -6,7 +6,7 @@ import type { ValueOf } from '@apify-packages/types';
6
6
  import { theme } from '../design_system/theme.js';
7
7
  import { Box, type BoxProps } from './box.js';
8
8
 
9
- const classNames = {
9
+ export const cardContainerClassNames = {
10
10
  CONTENT: 'CardContainer-Content',
11
11
  HEADER: 'CardContainer-Header',
12
12
  };
@@ -25,7 +25,7 @@ const Wrapper = styled(Box)<{$headerPlacement: ValueOf<typeof HEADER_PLACEMENT>}
25
25
  display: flex;
26
26
  flex-direction: ${({ $headerPlacement }) => ($headerPlacement === HEADER_PLACEMENT.TOP ? 'column' : 'column-reverse')};
27
27
 
28
- .${classNames.CONTENT} {
28
+ .${cardContainerClassNames.CONTENT} {
29
29
  /* Inner radius = outer radius - padding */
30
30
  border-radius: calc(${theme.radius.radius12} - ${theme.space.space2});
31
31
  background-color: ${theme.color.neutral.background};
@@ -34,7 +34,7 @@ const Wrapper = styled(Box)<{$headerPlacement: ValueOf<typeof HEADER_PLACEMENT>}
34
34
  flex-grow: 1;
35
35
  }
36
36
 
37
- .${classNames.HEADER} {
37
+ .${cardContainerClassNames.HEADER} {
38
38
  padding: ${theme.space.space4} ${theme.space.space8};
39
39
  display: flex;
40
40
  justify-content: space-between;
@@ -50,6 +50,7 @@ export type CardContainerProps = BoxProps & {
50
50
  /**
51
51
  * If string is passed, the correct styles are applied automatically.
52
52
  * In case of custom component, use `CardContainer.Heading` component to get the same styles.
53
+ * Pass `null` to render without a header section.
53
54
  */
54
55
  header: React.ReactNode,
55
56
  };
@@ -66,10 +67,12 @@ export const CardContainer = ({
66
67
  ...rest
67
68
  }: CardContainerProps) => (
68
69
  <Wrapper {...rest} $headerPlacement={headerPlacement}>
69
- <div className={classNames.HEADER}>
70
- {typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
71
- </div>
72
- <div className={classNames.CONTENT}>
70
+ {header != null && (
71
+ <div className={cardContainerClassNames.HEADER}>
72
+ {typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
73
+ </div>
74
+ )}
75
+ <div className={cardContainerClassNames.CONTENT}>
73
76
  {children}
74
77
  </div>
75
78
  </Wrapper>
@@ -38,10 +38,6 @@ const meta = {
38
38
  control: 'number',
39
39
  description: 'Size of the avatar in pixels',
40
40
  },
41
- newStyle: {
42
- control: 'boolean',
43
- description: 'Uses new styling with larger gap and different typography',
44
- },
45
41
  },
46
42
  } satisfies Meta<typeof StoreActorHeader>;
47
43
 
@@ -75,51 +71,108 @@ export const WithLongNames: Story = {
75
71
  export const Variants: Story = {
76
72
  render: () => (
77
73
  <div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
78
- <div>
79
- <h4>Basic</h4>
80
- <StoreActorHeader
81
- name="web-scraper"
82
- title="Web Scraper"
83
- username="apify"
84
- />
85
- </div>
86
- <div>
87
- <h4>With Picture</h4>
88
- <StoreActorHeader
89
- name="web-scraper"
90
- title="Web Scraper"
91
- username="apify"
92
- pictureUrl="https://apify.github.io/apify-web/img/apify-logo/logomark-32x32.svg"
93
- />
94
- </div>
95
- <div>
96
- <h4>With Rising Star Badge</h4>
97
- <StoreActorHeader
98
- name="instagram-scraper"
99
- title="Instagram Scraper"
100
- username="apify"
101
- hasRisingStarBadge={true}
102
- />
103
- </div>
104
- <div>
105
- <h4>Under Maintenance</h4>
106
- <StoreActorHeader
107
- name="amazon-scraper"
108
- title="Amazon Product Scraper"
109
- username="junglee"
110
- isUnderMaintenance={true}
111
- />
74
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px', alignItems: 'start' }}>
75
+ <span />
76
+ <h4 style={{ margin: 0 }}>Compact</h4>
112
77
  </div>
113
- <div>
114
- <h4>All Features Combined</h4>
115
- <StoreActorHeader
116
- name="twitter-scraper"
117
- title="Twitter Scraper"
118
- username="vdrmota"
119
- pictureUrl="https://apify.com/img/actors/twitter-scraper.png"
120
- hasRisingStarBadge={true}
121
- isUnderMaintenance={true}
122
- />
78
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px', alignItems: 'center' }}>
79
+ <div>
80
+ <h4>Basic</h4>
81
+ <StoreActorHeader
82
+ name="web-scraper"
83
+ title="Web Scraper"
84
+ username="apify"
85
+ />
86
+ </div>
87
+ <div>
88
+ <h4>Basic</h4>
89
+ <StoreActorHeader
90
+ compact
91
+ name="web-scraper"
92
+ title="Web Scraper"
93
+ username="apify"
94
+ />
95
+ </div>
96
+ <div>
97
+ <h4>With Picture</h4>
98
+ <StoreActorHeader
99
+ name="web-scraper"
100
+ title="Web Scraper"
101
+ username="apify"
102
+ pictureUrl="https://apify.github.io/apify-web/img/apify-logo/logomark-32x32.svg"
103
+ />
104
+ </div>
105
+ <div>
106
+ <h4>With Picture</h4>
107
+ <StoreActorHeader
108
+ compact
109
+ name="web-scraper"
110
+ title="Web Scraper"
111
+ username="apify"
112
+ pictureUrl="https://apify.github.io/apify-web/img/apify-logo/logomark-32x32.svg"
113
+ />
114
+ </div>
115
+ <div>
116
+ <h4>With Rising Star Badge</h4>
117
+ <StoreActorHeader
118
+ name="instagram-scraper"
119
+ title="Instagram Scraper"
120
+ username="apify"
121
+ hasRisingStarBadge={true}
122
+ />
123
+ </div>
124
+ <div>
125
+ <h4>With Rising Star Badge</h4>
126
+ <StoreActorHeader
127
+ compact
128
+ name="instagram-scraper"
129
+ title="Instagram Scraper"
130
+ username="apify"
131
+ hasRisingStarBadge={true}
132
+ />
133
+ </div>
134
+ <div>
135
+ <h4>Under Maintenance</h4>
136
+ <StoreActorHeader
137
+ name="amazon-scraper"
138
+ title="Amazon Product Scraper"
139
+ username="junglee"
140
+ isUnderMaintenance={true}
141
+ />
142
+ </div>
143
+ <div>
144
+ <h4>Under Maintenance</h4>
145
+ <StoreActorHeader
146
+ compact
147
+ name="amazon-scraper"
148
+ title="Amazon Product Scraper"
149
+ username="junglee"
150
+ isUnderMaintenance={true}
151
+ />
152
+ </div>
153
+ <div>
154
+ <h4>All Features Combined</h4>
155
+ <StoreActorHeader
156
+ name="twitter-scraper"
157
+ title="Twitter Scraper"
158
+ username="vdrmota"
159
+ pictureUrl="https://apify.com/img/actors/twitter-scraper.png"
160
+ hasRisingStarBadge={true}
161
+ isUnderMaintenance={true}
162
+ />
163
+ </div>
164
+ <div>
165
+ <h4>All Features Combined</h4>
166
+ <StoreActorHeader
167
+ compact
168
+ name="twitter-scraper"
169
+ title="Twitter Scraper"
170
+ username="vdrmota"
171
+ pictureUrl="https://apify.com/img/actors/twitter-scraper.png"
172
+ hasRisingStarBadge={true}
173
+ isUnderMaintenance={true}
174
+ />
175
+ </div>
123
176
  </div>
124
177
  </div>
125
178
  ),
@@ -2,7 +2,7 @@ import styled from 'styled-components';
2
2
 
3
3
  import { StarEmptyIcon, WarningTriangleIcon } from '@apify/ui-icons';
4
4
 
5
- import { Badge, Box, type BoxProps, Heading, Text } from '../../components/index.js';
5
+ import { Badge, Box, type BoxProps, Text } from '../../components/index.js';
6
6
  import { theme } from '../../design_system/theme.js';
7
7
  import { ActorAvatar, actorAvatarClassnames } from '../avatar/actor_avatar.js';
8
8
 
@@ -12,10 +12,10 @@ const storeActorHeaderClassNames = {
12
12
  badge: 'ActorStoreItem-badge',
13
13
  };
14
14
 
15
- const StyledStoreActorHeader = styled(Box)<{ $newStyle?: boolean }>`
15
+ const StyledStoreActorHeader = styled(Box)<{ $compact: boolean}>`
16
16
  display: flex;
17
- gap: ${({ $newStyle }) => ($newStyle ? theme.space.space12 : theme.space.space8)};
18
- align-items: center;
17
+ gap: ${({ $compact }) => ($compact ? theme.space.space4 : theme.space.space12)};
18
+ align-items: ${({ $compact }) => ($compact ? 'flex-start' : 'center')};
19
19
 
20
20
  .${actorAvatarClassnames.BASE} {
21
21
  border: 1px solid ${theme.color.neutral.border};
@@ -78,7 +78,7 @@ export type StoreActorHeaderProps = {
78
78
  isUnderMaintenance?: boolean,
79
79
  hasRisingStarBadge?: boolean,
80
80
  avatarSize?: number,
81
- newStyle?: boolean,
81
+ compact?: boolean;
82
82
  }
83
83
 
84
84
  export const StoreActorHeader: React.FC<StoreActorHeaderProps & BoxProps> = ({
@@ -89,18 +89,19 @@ export const StoreActorHeader: React.FC<StoreActorHeaderProps & BoxProps> = ({
89
89
  isUnderMaintenance = false,
90
90
  hasRisingStarBadge = false,
91
91
  avatarSize = 40,
92
- newStyle = false,
92
+ compact = false,
93
93
  ...rest
94
94
  }) => {
95
95
  return (
96
- <StyledStoreActorHeader data-test="actor-store-item-header" $newStyle={newStyle} {...rest}>
96
+ <StyledStoreActorHeader data-test="actor-store-item-header" $compact={compact} {...rest}>
97
97
  <ActorAvatarWrapper>
98
98
  <ActorAvatar
99
- size={avatarSize}
99
+ size={compact ? 20 : avatarSize}
100
100
  url={pictureUrl}
101
101
  name={title}
102
+ borderRadius={compact ? theme.radius.radius4 : theme.radius.radius8}
102
103
  />
103
- {hasRisingStarBadge && <StyledCompactBadge
104
+ {!compact && hasRisingStarBadge && <StyledCompactBadge
104
105
  variant='primary_blue'
105
106
  size='small'
106
107
  LeadingIcon={StarEmptyIcon}
@@ -109,17 +110,12 @@ export const StoreActorHeader: React.FC<StoreActorHeaderProps & BoxProps> = ({
109
110
  </ActorAvatarWrapper>
110
111
  <ActorTitleWrapper>
111
112
  <div className={storeActorHeaderClassNames.title}>
112
- { newStyle
113
- ? <Text as='h3' weight='bold' color={theme.color.neutral.text}>{title}</Text>
114
- : <Heading as='h3' type="titleS" color={theme.color.neutral.text}>
115
- {title}
116
- </Heading>}
117
-
113
+ <Text as='h3' weight={compact ? 'medium' : 'bold'} color={theme.color.neutral.text}>{title}</Text>
118
114
  {isUnderMaintenance && (<WarningTriangleIcon size="12" color={theme.color.warning.icon} />)}
119
115
  </div>
120
116
  <Text
121
117
  size="small"
122
- weight={newStyle ? 'medium' : 'normal'}
118
+ weight='medium'
123
119
  type="code"
124
120
  color={theme.color.neutral.textSubtle}
125
121
  className={storeActorHeaderClassNames.slug}