@apify/ui-library 1.138.2-featpublictasks-2f3d3c.50 → 1.138.2

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 (91) hide show
  1. package/dist/src/components/chip.d.ts.map +1 -1
  2. package/dist/src/components/chip.js +2 -25
  3. package/dist/src/components/chip.js.map +1 -1
  4. package/dist/src/components/collapsible_card/collapsible_card.d.ts +2 -3
  5. package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
  6. package/dist/src/components/collapsible_card/collapsible_card.js +2 -2
  7. package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
  8. package/dist/src/components/floating/floating_component_base.d.ts +1 -72
  9. package/dist/src/components/floating/floating_component_base.d.ts.map +1 -1
  10. package/dist/src/components/floating/floating_component_base.js +36 -66
  11. package/dist/src/components/floating/floating_component_base.js.map +1 -1
  12. package/dist/src/components/floating/tooltip.d.ts +3 -10
  13. package/dist/src/components/floating/tooltip.d.ts.map +1 -1
  14. package/dist/src/components/floating/tooltip.js +20 -24
  15. package/dist/src/components/floating/tooltip.js.map +1 -1
  16. package/dist/src/components/index.d.ts +0 -2
  17. package/dist/src/components/index.d.ts.map +1 -1
  18. package/dist/src/components/index.js +0 -2
  19. package/dist/src/components/index.js.map +1 -1
  20. package/dist/tsconfig.build.tsbuildinfo +1 -1
  21. package/package.json +5 -5
  22. package/src/components/chip.tsx +1 -27
  23. package/src/components/collapsible_card/collapsible_card.tsx +4 -6
  24. package/src/components/floating/floating_component_base.tsx +47 -89
  25. package/src/components/floating/tooltip.tsx +25 -53
  26. package/src/components/index.ts +0 -2
  27. package/dist/src/components/actor_example/actor_example.utils.d.ts +0 -17
  28. package/dist/src/components/actor_example/actor_example.utils.d.ts.map +0 -1
  29. package/dist/src/components/actor_example/actor_example.utils.js +0 -41
  30. package/dist/src/components/actor_example/actor_example.utils.js.map +0 -1
  31. package/dist/src/components/actor_example/actor_example_avatar.d.ts +0 -13
  32. package/dist/src/components/actor_example/actor_example_avatar.d.ts.map +0 -1
  33. package/dist/src/components/actor_example/actor_example_avatar.js +0 -34
  34. package/dist/src/components/actor_example/actor_example_avatar.js.map +0 -1
  35. package/dist/src/components/actor_example/actor_example_card.d.ts +0 -28
  36. package/dist/src/components/actor_example/actor_example_card.d.ts.map +0 -1
  37. package/dist/src/components/actor_example/actor_example_card.js +0 -79
  38. package/dist/src/components/actor_example/actor_example_card.js.map +0 -1
  39. package/dist/src/components/actor_example/actor_example_preview.d.ts +0 -28
  40. package/dist/src/components/actor_example/actor_example_preview.d.ts.map +0 -1
  41. package/dist/src/components/actor_example/actor_example_preview.js +0 -208
  42. package/dist/src/components/actor_example/actor_example_preview.js.map +0 -1
  43. package/dist/src/components/actor_example/actor_example_run_button.d.ts +0 -33
  44. package/dist/src/components/actor_example/actor_example_run_button.d.ts.map +0 -1
  45. package/dist/src/components/actor_example/actor_example_run_button.js +0 -12
  46. package/dist/src/components/actor_example/actor_example_run_button.js.map +0 -1
  47. package/dist/src/components/actor_example/actor_example_schema.d.ts +0 -20
  48. package/dist/src/components/actor_example/actor_example_schema.d.ts.map +0 -1
  49. package/dist/src/components/actor_example/actor_example_schema.js +0 -27
  50. package/dist/src/components/actor_example/actor_example_schema.js.map +0 -1
  51. package/dist/src/components/actor_example/actor_example_schema_field.d.ts +0 -19
  52. package/dist/src/components/actor_example/actor_example_schema_field.d.ts.map +0 -1
  53. package/dist/src/components/actor_example/actor_example_schema_field.js +0 -33
  54. package/dist/src/components/actor_example/actor_example_schema_field.js.map +0 -1
  55. package/dist/src/components/actor_example/actor_example_schema_field_badge.d.ts +0 -9
  56. package/dist/src/components/actor_example/actor_example_schema_field_badge.d.ts.map +0 -1
  57. package/dist/src/components/actor_example/actor_example_schema_field_badge.js +0 -48
  58. package/dist/src/components/actor_example/actor_example_schema_field_badge.js.map +0 -1
  59. package/dist/src/components/actor_example/actor_example_schema_legend.d.ts +0 -10
  60. package/dist/src/components/actor_example/actor_example_schema_legend.d.ts.map +0 -1
  61. package/dist/src/components/actor_example/actor_example_schema_legend.js +0 -29
  62. package/dist/src/components/actor_example/actor_example_schema_legend.js.map +0 -1
  63. package/dist/src/components/actor_example/actor_example_schema_property.d.ts +0 -24
  64. package/dist/src/components/actor_example/actor_example_schema_property.d.ts.map +0 -1
  65. package/dist/src/components/actor_example/actor_example_schema_property.js +0 -122
  66. package/dist/src/components/actor_example/actor_example_schema_property.js.map +0 -1
  67. package/dist/src/components/actor_example/index.d.ts +0 -11
  68. package/dist/src/components/actor_example/index.d.ts.map +0 -1
  69. package/dist/src/components/actor_example/index.js +0 -11
  70. package/dist/src/components/actor_example/index.js.map +0 -1
  71. package/dist/src/components/browser_window/browser_window.d.ts +0 -20
  72. package/dist/src/components/browser_window/browser_window.d.ts.map +0 -1
  73. package/dist/src/components/browser_window/browser_window.js +0 -72
  74. package/dist/src/components/browser_window/browser_window.js.map +0 -1
  75. package/dist/src/components/browser_window/index.d.ts +0 -2
  76. package/dist/src/components/browser_window/index.d.ts.map +0 -1
  77. package/dist/src/components/browser_window/index.js +0 -2
  78. package/dist/src/components/browser_window/index.js.map +0 -1
  79. package/src/components/actor_example/actor_example.utils.ts +0 -52
  80. package/src/components/actor_example/actor_example_avatar.tsx +0 -69
  81. package/src/components/actor_example/actor_example_card.tsx +0 -149
  82. package/src/components/actor_example/actor_example_preview.tsx +0 -295
  83. package/src/components/actor_example/actor_example_run_button.tsx +0 -61
  84. package/src/components/actor_example/actor_example_schema.tsx +0 -60
  85. package/src/components/actor_example/actor_example_schema_field.tsx +0 -87
  86. package/src/components/actor_example/actor_example_schema_field_badge.tsx +0 -66
  87. package/src/components/actor_example/actor_example_schema_legend.tsx +0 -49
  88. package/src/components/actor_example/actor_example_schema_property.tsx +0 -242
  89. package/src/components/actor_example/index.ts +0 -10
  90. package/src/components/browser_window/browser_window.tsx +0 -106
  91. package/src/components/browser_window/index.ts +0 -1
@@ -1,295 +0,0 @@
1
- import styled, { keyframes } from 'styled-components';
2
-
3
- import { theme } from '../../design_system/theme.js';
4
- import { Heading, Text } from '../text/index.js';
5
- import { ActorExampleAvatar } from './actor_example_avatar.js';
6
-
7
- const MAX_VISIBLE_FIELDS = 4;
8
- const BADGE_PICTURE_SIZE = 36;
9
-
10
- export const actorExamplePreviewClassNames = {
11
- CONTAINER: 'actor-example-preview',
12
- CONTENT: 'actor-example-preview__content',
13
- BADGE: 'actor-example-preview__badge',
14
- BADGE_PICTURE: 'actor-example-preview__badge-picture',
15
- BADGE_CONTENT: 'actor-example-preview__badge-content',
16
- BADGE_NAME: 'actor-example-preview__badge-name',
17
- BADGE_TECHNICAL_NAME: 'actor-example-preview__badge-technical-name',
18
- SCHEMA: 'actor-example-preview__schema',
19
- SCHEMA_FIELD: 'actor-example-preview__schema-field',
20
- SCHEMA_FIELD_NAME: 'actor-example-preview__schema-field-name',
21
- SCHEMA_MORE: 'actor-example-preview__schema-more',
22
- };
23
-
24
- const VISUAL_SEPARATOR_SIZE = '0.6rem';
25
- const VISUAL_CONNECTOR_LENGTH = '2.4rem';
26
-
27
- const noisePulse = keyframes`
28
- 0%, 100% { opacity: 0.1; }
29
- 50% { opacity: 0.4; }
30
- `;
31
-
32
- const ActorExamplePreviewWrapper = styled.div<{ $noiseImageUrl: string }>`
33
- @property --noise-cx {
34
- syntax: '<percentage>';
35
- inherits: false;
36
- initial-value: 50%;
37
- }
38
-
39
- @property --noise-cy {
40
- syntax: '<percentage>';
41
- inherits: false;
42
- initial-value: 50%;
43
- }
44
-
45
- position: relative;
46
- display: flex;
47
- flex-direction: column;
48
- align-items: center;
49
- justify-content: center;
50
- flex-shrink: 0;
51
-
52
- &::before {
53
- content: '';
54
- position: absolute;
55
- top: -${theme.space.space32};
56
- bottom: 0;
57
- inset-inline: -${theme.space.space32};
58
- background-image: url(${({ $noiseImageUrl }) => $noiseImageUrl});
59
- background-position: center;
60
- background-repeat: repeat;
61
- mask-image:
62
- linear-gradient(to bottom, transparent, black 30%, black 70%, transparent),
63
- linear-gradient(to right, transparent, black 30%, black 70%, transparent);
64
- mask-composite: intersect;
65
- -webkit-mask-image:
66
- linear-gradient(to bottom, transparent, black 30%, black 70%, transparent),
67
- linear-gradient(to right, transparent, black 30%, black 70%, transparent);
68
- -webkit-mask-composite: destination-in;
69
- animation: ${noisePulse} 4s ease-in-out infinite;
70
- opacity: 0.1;
71
- pointer-events: none;
72
-
73
- @media ${theme.device.desktop} {
74
- inset: 0;
75
- mask-image: radial-gradient(circle at var(--noise-cx) var(--noise-cy), black 30%, transparent 70%);
76
- -webkit-mask-image: radial-gradient(circle at var(--noise-cx) var(--noise-cy), black 30%, transparent 70%);
77
- }
78
-
79
- @media (prefers-reduced-motion: reduce) {
80
- animation: none;
81
- mask-image: none;
82
- -webkit-mask-image: none;
83
- }
84
- }
85
-
86
- .${actorExamplePreviewClassNames.CONTENT} {
87
- max-width: 100%;
88
- display: flex;
89
- gap: ${theme.space.space32};
90
- flex-direction: column;
91
- align-items: center;
92
- justify-content: center;
93
- }
94
-
95
- .${actorExamplePreviewClassNames.BADGE} {
96
- width: 100%;
97
- min-width: 0;
98
- padding: ${theme.space.space12};
99
- border: 1px solid ${theme.color.neutral.separatorSubtle};
100
- border-radius: ${theme.radius.radius12};
101
- background-color: ${theme.color.neutral.background};
102
- display: flex;
103
- gap: ${theme.space.space8};
104
- align-items: center;
105
- position: relative;
106
- }
107
-
108
- .${actorExamplePreviewClassNames.BADGE_PICTURE} {
109
- border: 1px solid ${theme.color.neutral.separatorSubtle};
110
- border-radius: ${theme.radius.radius8};
111
- flex-shrink: 0;
112
- object-fit: cover;
113
- }
114
-
115
- .${actorExamplePreviewClassNames.BADGE_CONTENT} {
116
- min-width: 0;
117
- display: flex;
118
- flex-direction: column;
119
- flex-grow: 1;
120
- }
121
-
122
- .${actorExamplePreviewClassNames.BADGE_NAME}, .${actorExamplePreviewClassNames.BADGE_TECHNICAL_NAME} {
123
- text-overflow: ellipsis;
124
- white-space: nowrap;
125
- overflow: hidden;
126
- }
127
-
128
- .${actorExamplePreviewClassNames.SCHEMA} {
129
- width: 100%;
130
- min-width: 0;
131
- padding: ${theme.space.space8};
132
- border: 1px solid ${theme.color.primary.text};
133
- border-radius: ${theme.radius.radius12};
134
- background-color: ${theme.color.neutral.background};
135
- display: flex;
136
- flex-direction: column;
137
- align-items: center;
138
- gap: ${theme.space.space4};
139
- position: relative;
140
-
141
- &::before {
142
- bottom: calc(100% + 0.5rem);
143
- left: calc(50% - 0.5px);
144
- width: 1px;
145
- height: ${VISUAL_CONNECTOR_LENGTH};
146
- background-color: ${theme.color.primary.text};
147
- content: '';
148
- display: block;
149
- position: absolute;
150
- }
151
-
152
- &::after {
153
- bottom: calc(100% + 0.5rem);
154
- left: calc(50% - (${VISUAL_SEPARATOR_SIZE} / 2));
155
- margin: 0 auto;
156
- width: ${VISUAL_SEPARATOR_SIZE};
157
- height: ${VISUAL_CONNECTOR_LENGTH};
158
- border-block: 1px solid ${theme.color.primary.text};
159
- box-sizing: border-box;
160
- content: '';
161
- display: block;
162
- position: absolute;
163
- }
164
- }
165
-
166
- .${actorExamplePreviewClassNames.SCHEMA_FIELD} {
167
- width: 100%;
168
- padding: ${theme.space.space4};
169
- border: 1px solid ${theme.color.primary.borderSubtle};
170
- border-radius: ${theme.radius.radius6};
171
- display: flex;
172
- gap: ${theme.space.space8};
173
- align-items: center;
174
- justify-content: center;
175
- }
176
-
177
- .${actorExamplePreviewClassNames.SCHEMA_FIELD_NAME} {
178
- min-width: 0;
179
- text-overflow: ellipsis;
180
- white-space: nowrap;
181
- overflow: hidden;
182
- }
183
-
184
- .${actorExamplePreviewClassNames.SCHEMA_MORE} {
185
- height: 2.4rem;
186
- margin-top: 2rem;
187
- padding: 0 ${theme.space.space8};
188
- border: 1px solid ${theme.color.primary.borderSubtle};
189
- border-radius: ${theme.radius.radius12};
190
- background-color: ${theme.color.primary.background};
191
- display: flex;
192
- align-items: center;
193
- justify-content: center;
194
- position: relative;
195
-
196
- &::before {
197
- top: calc(-1px - 1.6rem);
198
- left: calc(50% - 0.5px);
199
- width: 1px;
200
- height: 0.8rem;
201
- background-color: ${theme.color.primary.text};
202
- content: '';
203
- display: block;
204
- position: absolute;
205
- }
206
- }
207
- `;
208
-
209
- export type ActorExamplePreviewField = {
210
- name: string;
211
- title?: string;
212
- };
213
-
214
- export type ActorExamplePreviewProps = {
215
- actorName: string;
216
- actorTitle: string | undefined;
217
- actorPictureUrl: string | undefined;
218
- actorPictureFallbackUrl: string;
219
- outputFields: ActorExamplePreviewField[];
220
- staticWebUrl: string;
221
- username: string;
222
- };
223
-
224
- export const ActorExamplePreview = ({
225
- actorName,
226
- actorTitle,
227
- actorPictureUrl,
228
- actorPictureFallbackUrl,
229
- outputFields,
230
- staticWebUrl,
231
- username,
232
- }: ActorExamplePreviewProps) => {
233
- const visibleFields = outputFields.slice(0, MAX_VISIBLE_FIELDS);
234
- const remainingCount = Math.max(0, outputFields.length - MAX_VISIBLE_FIELDS);
235
-
236
- return (
237
- <ActorExamplePreviewWrapper
238
- className={actorExamplePreviewClassNames.CONTAINER}
239
- $noiseImageUrl={`${staticWebUrl}/img/pattern/noise.svg`}
240
- >
241
- <div className={actorExamplePreviewClassNames.CONTENT}>
242
- <div className={actorExamplePreviewClassNames.BADGE}>
243
- <ActorExampleAvatar
244
- title={actorTitle}
245
- name={actorName}
246
- pictureUrl={actorPictureUrl}
247
- fallbackPictureUrl={actorPictureFallbackUrl}
248
- size={BADGE_PICTURE_SIZE}
249
- className={actorExamplePreviewClassNames.BADGE_PICTURE}
250
- />
251
- <div className={actorExamplePreviewClassNames.BADGE_CONTENT}>
252
- <Heading as="span" type="titleS" className={actorExamplePreviewClassNames.BADGE_NAME}>
253
- {actorTitle ?? actorName}
254
- </Heading>
255
- <Text
256
- as="span"
257
- type="code"
258
- size="small"
259
- color={theme.color.neutral.textSubtle}
260
- className={actorExamplePreviewClassNames.BADGE_TECHNICAL_NAME}
261
- >
262
- {username}/{actorName}
263
- </Text>
264
- </div>
265
- </div>
266
- {visibleFields.length > 0 && (
267
- <div className={actorExamplePreviewClassNames.SCHEMA}>
268
- {visibleFields.map((field) => (
269
- <div key={field.name} className={actorExamplePreviewClassNames.SCHEMA_FIELD}>
270
- <Text
271
- as="span"
272
- size="small"
273
- color={theme.color.neutral.text}
274
- className={actorExamplePreviewClassNames.SCHEMA_FIELD_NAME}
275
- >
276
- {field.title ?? field.name}
277
- </Text>
278
- </div>
279
- ))}
280
- {remainingCount > 0 && (
281
- <Text
282
- as="span"
283
- size="small"
284
- color={theme.color.primary.text}
285
- className={actorExamplePreviewClassNames.SCHEMA_MORE}
286
- >
287
- +{remainingCount} {remainingCount === 1 ? 'field' : 'fields'}
288
- </Text>
289
- )}
290
- </div>
291
- )}
292
- </div>
293
- </ActorExamplePreviewWrapper>
294
- );
295
- };
@@ -1,61 +0,0 @@
1
- import type React from 'react';
2
-
3
- import { type IconProps, LightningIcon } from '@apify/ui-icons';
4
-
5
- import { theme } from '../../design_system/theme.js';
6
- import { type ButtonProps, Button } from '../button.js';
7
- import type { SharedTextProps } from '../text/text_shared.js';
8
-
9
- /**
10
- * Brand-coloured lightning icon — the standard leading slot for the card variant of the run
11
- * button. Hero-style call sites typically render without an icon; pass this explicitly via
12
- * `LeftIcon` when you want it.
13
- */
14
- export const ActorExampleRunButtonLightningIcon = (props: IconProps) => (
15
- <LightningIcon {...props} color={theme.color.primary.action} />
16
- );
17
-
18
- /**
19
- * "Run example" CTA shared by the actor-detail Examples tab (apify-core Console) and the
20
- * public actor-example landing/hero pages (apify-web). Encapsulates two universal defaults
21
- * for this CTA — `target="_self"` so external `console.apify.com` links don't open in a new
22
- * tab, and `hideExternalIcon` so the lightning leading icon (when present) is the only
23
- * action affordance — and pins the analytics shape to `{ element, cardTitle, actorId }`.
24
- *
25
- * Tracking flows through the host app's `trackClick` (apify-web's analytics, console's
26
- * client tracker) via the underlying `Button`.
27
- */
28
- export type ActorExampleRunButtonProps = Pick<ButtonProps, 'size' | 'variant' | 'LeftIcon' | 'RightIcon'> & {
29
- actorId: string;
30
- consoleUrl: string;
31
- trackingProps: {
32
- element: string;
33
- cardTitle: string;
34
- };
35
- textSize?: SharedTextProps['size'];
36
- className?: string;
37
- children: React.ReactNode;
38
- };
39
-
40
- export const ActorExampleRunButton = ({
41
- actorId,
42
- consoleUrl,
43
- size = 'extraLarge',
44
- variant = 'primary',
45
- trackingProps,
46
- children,
47
- ...buttonProps
48
- }: ActorExampleRunButtonProps) => (
49
- <Button
50
- {...buttonProps}
51
- to={consoleUrl}
52
- size={size}
53
- variant={variant}
54
- target="_self"
55
- hideExternalIcon
56
- trackingId={trackingProps.element}
57
- trackingData={{ cardTitle: trackingProps.cardTitle, actorId }}
58
- >
59
- {children}
60
- </Button>
61
- );
@@ -1,60 +0,0 @@
1
- import clsx from 'clsx';
2
- import { useState } from 'react';
3
- import styled from 'styled-components';
4
-
5
- import type { ActorExampleSchemaFieldSerialized } from '@apify-packages/types';
6
-
7
- import { theme } from '../../design_system/theme.js';
8
- import { ActorExampleSchemaField } from './actor_example_schema_field.js';
9
-
10
- export const actorExampleSchemaClassNames = {
11
- ROOT: 'actor-example-schema',
12
- };
13
-
14
- const ActorExampleSchemaWrapper = styled.div`
15
- width: 100%;
16
- padding: ${theme.space.space16};
17
- background-color: ${theme.color.neutral.background};
18
- border-radius: 1rem;
19
- display: flex;
20
- flex-direction: column;
21
- flex-grow: 1;
22
- gap: ${theme.space.space16};
23
- `;
24
-
25
- type Props = {
26
- fields: ActorExampleSchemaFieldSerialized[];
27
- canCollapse?: boolean;
28
- className?: string;
29
- /**
30
- * Per-row slot rendered before the type badge on each top-level field
31
- * (nested children render plain). Useful for configurators that need a
32
- * checkbox or other control alongside each field.
33
- */
34
- LeadingSlot?: (props: { field: ActorExampleSchemaFieldSerialized }) => React.ReactNode;
35
- };
36
-
37
- export const ActorExampleSchema = ({ fields, canCollapse = false, className, LeadingSlot }: Props) => {
38
- const [collapsedFields, setCollapsedFields] = useState<string[]>([]);
39
-
40
- const handleToggleCollapse = (id: string) => {
41
- setCollapsedFields((current) =>
42
- current.includes(id) ? current.filter((currentId) => currentId !== id) : [...current, id],
43
- );
44
- };
45
-
46
- return (
47
- <ActorExampleSchemaWrapper className={clsx(actorExampleSchemaClassNames.ROOT, className)}>
48
- {fields.map((field) => (
49
- <ActorExampleSchemaField
50
- key={field._id}
51
- field={field}
52
- canCollapse={canCollapse}
53
- collapsedFields={collapsedFields}
54
- onToggleCollapsed={handleToggleCollapse}
55
- leadingSlot={LeadingSlot ? <LeadingSlot field={field} /> : undefined}
56
- />
57
- ))}
58
- </ActorExampleSchemaWrapper>
59
- );
60
- };
@@ -1,87 +0,0 @@
1
- import clsx from 'clsx';
2
- import type { ReactNode } from 'react';
3
- import styled from 'styled-components';
4
-
5
- import type { ActorExampleSchemaFieldSerialized } from '@apify-packages/types';
6
-
7
- import { theme } from '../../design_system/theme.js';
8
- import { ActorExampleSchemaProperty } from './actor_example_schema_property.js';
9
-
10
- export const actorExampleSchemaFieldClassNames = {
11
- FIELD: 'actor-example-schema-field',
12
- CHILDREN: 'actor-example-schema-field__children',
13
- };
14
-
15
- const ActorExampleSchemaFieldWrapper = styled.div<{ $canCollapse: boolean }>`
16
- display: flex;
17
- flex-direction: column;
18
- gap: ${theme.space.space8};
19
-
20
- .${actorExampleSchemaFieldClassNames.CHILDREN} {
21
- margin-left: ${({ $canCollapse }) => ($canCollapse ? '5.6rem' : '2.8rem')};
22
- padding-left: 0.8rem;
23
- display: flex;
24
- flex-direction: column;
25
- gap: ${theme.space.space8};
26
- border-left: 1px solid ${theme.color.neutral.border};
27
- }
28
- `;
29
-
30
- const MAX_SCHEMA_FIELD_DEPTH = 1;
31
-
32
- type Props = {
33
- field: ActorExampleSchemaFieldSerialized;
34
- collapsedFields: string[];
35
- canCollapse?: boolean;
36
- onToggleCollapsed: (id: string) => void;
37
- depth?: number;
38
- className?: string;
39
- /** Slot rendered on the outer property only — nested children render plain. */
40
- leadingSlot?: ReactNode;
41
- };
42
-
43
- export const ActorExampleSchemaField = ({
44
- field,
45
- collapsedFields,
46
- canCollapse = false,
47
- onToggleCollapsed,
48
- depth = 0,
49
- className,
50
- leadingSlot,
51
- }: Props) => {
52
- const subfields = field.properties ?? field.items ?? [];
53
- const isCollapsed = collapsedFields.includes(field._id);
54
-
55
- if (subfields.length === 0 || depth >= MAX_SCHEMA_FIELD_DEPTH) {
56
- return <ActorExampleSchemaProperty {...field} className={className} leadingSlot={leadingSlot} />;
57
- }
58
-
59
- return (
60
- <ActorExampleSchemaFieldWrapper
61
- $canCollapse={canCollapse}
62
- className={clsx(actorExampleSchemaFieldClassNames.FIELD, className)}
63
- >
64
- <ActorExampleSchemaProperty
65
- {...field}
66
- isCollapsable={canCollapse}
67
- isCollapsed={isCollapsed}
68
- onToggleCollapsed={onToggleCollapsed}
69
- leadingSlot={leadingSlot}
70
- />
71
- {!isCollapsed && (
72
- <div className={actorExampleSchemaFieldClassNames.CHILDREN}>
73
- {subfields.map((subfield) => (
74
- <ActorExampleSchemaField
75
- key={subfield._id}
76
- field={subfield}
77
- collapsedFields={collapsedFields}
78
- canCollapse={canCollapse}
79
- onToggleCollapsed={onToggleCollapsed}
80
- depth={depth + 1}
81
- />
82
- ))}
83
- </div>
84
- )}
85
- </ActorExampleSchemaFieldWrapper>
86
- );
87
- };
@@ -1,66 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- import type { IconComponent } from '@apify/ui-icons';
4
-
5
- import type { ActorExampleSchemaFieldType } from '@apify-packages/types';
6
-
7
- import { theme } from '../../design_system/theme.js';
8
- import { actorExampleSchemaPropertyDefaultIcon, actorExampleSchemaPropertyMap } from './actor_example.utils.js';
9
-
10
- // Per-type colour variables consumed via `var(--actor-schema-field-*)` in `actor_example.utils.ts`.
11
- // Declared on this wrapper itself (rather than `:root`) so the badge is self-contained — no
12
- // host-app globals required. Dark-mode overrides hook into the existing `html[data-theme='dark']`
13
- // theming switch via a parent-selector cascade.
14
- const ActorExampleSchemaFieldBadgeWrapper = styled.div<{ $type?: ActorExampleSchemaFieldType }>`
15
- --actor-schema-field-string-text: #018181;
16
- --actor-schema-field-string-background: #ebfbf8;
17
- --actor-schema-field-number-text: #8c4e02;
18
- --actor-schema-field-number-background: #f9f0db;
19
- --actor-schema-field-boolean-text: #104b37;
20
- --actor-schema-field-boolean-background: #dffff0;
21
- --actor-schema-field-object-text: #4c41c0;
22
- --actor-schema-field-object-background: #e8e6f9;
23
- --actor-schema-field-array-text: #0043ca;
24
- --actor-schema-field-array-background: #e0ebff;
25
-
26
- html[data-theme='dark'] & {
27
- --actor-schema-field-string-text: #84f5e5;
28
- --actor-schema-field-string-background: #0f2e2a;
29
- --actor-schema-field-number-text: #ffd761;
30
- --actor-schema-field-number-background: #5d2e0e;
31
- --actor-schema-field-boolean-text: #a3e8cf;
32
- --actor-schema-field-boolean-background: #0b3225;
33
- --actor-schema-field-object-text: #a08cf2;
34
- --actor-schema-field-object-background: #2a2544;
35
- --actor-schema-field-array-text: #97bcff;
36
- --actor-schema-field-array-background: #152447;
37
- }
38
-
39
- width: 2rem;
40
- height: 2rem;
41
- color: ${({ $type }) => ($type ? actorExampleSchemaPropertyMap[$type].textColor : theme.color.neutral.text)};
42
- background-color: ${({ $type }) =>
43
- $type ? actorExampleSchemaPropertyMap[$type].backgroundColor : theme.color.neutral.backgroundSubtle};
44
- border-radius: ${theme.radius.radius4};
45
- display: flex;
46
- flex-shrink: 0;
47
- align-items: center;
48
- justify-content: center;
49
- `;
50
-
51
- type Props = {
52
- type?: ActorExampleSchemaFieldType;
53
- title: string;
54
- className?: string;
55
- };
56
-
57
- export const ActorExampleSchemaFieldBadge = ({ type, title, className }: Props) => {
58
- const Icon: IconComponent =
59
- (type ? actorExampleSchemaPropertyMap[type]?.Icon : undefined) ?? actorExampleSchemaPropertyDefaultIcon;
60
-
61
- return (
62
- <ActorExampleSchemaFieldBadgeWrapper $type={type} className={className}>
63
- <Icon size="12" title={title} />
64
- </ActorExampleSchemaFieldBadgeWrapper>
65
- );
66
- };
@@ -1,49 +0,0 @@
1
- import clsx from 'clsx';
2
- import styled from 'styled-components';
3
-
4
- import type { ActorExampleSchemaFieldType } from '@apify-packages/types';
5
-
6
- import { theme } from '../../design_system/theme.js';
7
- import { Text } from '../text/index.js';
8
- import { actorExampleSchemaPropertyMap } from './actor_example.utils.js';
9
- import { ActorExampleSchemaFieldBadge } from './actor_example_schema_field_badge.js';
10
-
11
- const LEGEND_TYPE_ORDER: ActorExampleSchemaFieldType[] = ['string', 'number', 'boolean', 'array', 'object'];
12
-
13
- export const actorExampleSchemaLegendClassNames = {
14
- ROOT: 'actor-example-schema-legend',
15
- ITEM: 'actor-example-schema-legend__item',
16
- };
17
-
18
- const ActorExampleSchemaLegendWrapper = styled.div`
19
- display: flex;
20
- flex-wrap: wrap;
21
- align-items: center;
22
- gap: ${theme.space.space12};
23
-
24
- .${actorExampleSchemaLegendClassNames.ITEM} {
25
- display: inline-flex;
26
- align-items: center;
27
- gap: ${theme.space.space4};
28
- }
29
- `;
30
-
31
- type Props = {
32
- className?: string;
33
- };
34
-
35
- export const ActorExampleSchemaLegend = ({ className }: Props) => (
36
- <ActorExampleSchemaLegendWrapper className={clsx(actorExampleSchemaLegendClassNames.ROOT, className)}>
37
- {LEGEND_TYPE_ORDER.map((type) => {
38
- const config = actorExampleSchemaPropertyMap[type];
39
- return (
40
- <span key={type} className={actorExampleSchemaLegendClassNames.ITEM}>
41
- <ActorExampleSchemaFieldBadge type={type} title={config.title} />
42
- <Text as="span" size="small" weight="medium">
43
- {config.title}
44
- </Text>
45
- </span>
46
- );
47
- })}
48
- </ActorExampleSchemaLegendWrapper>
49
- );