@apify/ui-library 1.119.0 → 1.120.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 (25) hide show
  1. package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
  2. package/dist/src/components/simple_markdown/simple_markdown_components.js +23 -6
  3. package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
  4. package/dist/tsconfig.build.tsbuildinfo +1 -1
  5. package/package.json +2 -2
  6. package/src/components/card_container.stories.tsx +2 -1
  7. package/src/components/code/code_block/code_block.stories.jsx +1 -1
  8. package/src/components/code/inline_code/inline_code.stories.tsx +1 -1
  9. package/src/components/code/one_line_code/one_line_code.stories.tsx +1 -1
  10. package/src/components/readme_renderer/table_of_contents.stories.tsx +476 -0
  11. package/src/components/simple_markdown/simple_markdown.stories.tsx +1 -1
  12. package/src/components/simple_markdown/simple_markdown_components.tsx +27 -5
  13. package/src/components/text/heading_content.stories.tsx +167 -0
  14. package/src/components/text/heading_marketing.stories.tsx +123 -0
  15. package/src/components/text/heading_shared.stories.tsx +118 -0
  16. package/src/components/text/text_content.stories.tsx +189 -0
  17. package/src/components/text/text_marketing.stories.tsx +187 -0
  18. package/src/components/text/text_shared.stories.tsx +246 -0
  19. package/src/components/tile/horizontal_tile.stories.tsx +105 -0
  20. package/src/components/tile/vertical_tile.stories.tsx +167 -0
  21. package/src/components/to_consolidate/card.stories.tsx +91 -0
  22. package/src/components/to_consolidate/markdown.stories.tsx +160 -0
  23. package/src/components/to_consolidate/pagination.stories.tsx +64 -0
  24. package/src/components/to_consolidate/tab_number_chip.stories.tsx +113 -0
  25. package/src/components/text/text.stories.tsx +0 -61
@@ -0,0 +1,167 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import styled from 'styled-components';
3
+
4
+ import { CheckCircleIcon, SettingsIcon, StarFullIcon } from '@apify/ui-icons';
5
+
6
+ import { Button } from '../button.js';
7
+ import { TextShared } from '../text/text_shared.js';
8
+ import { TILE_SIZES } from './shared.js';
9
+ import { VerticalTile } from './vertical_tile.js';
10
+
11
+ export default {
12
+ title: 'UI-Library/Tile/VerticalTile',
13
+ component: VerticalTile,
14
+ argTypes: {
15
+ content: {
16
+ control: 'text',
17
+ description: 'The main content of the tile',
18
+ },
19
+ size: {
20
+ control: { type: 'select' },
21
+ options: [TILE_SIZES.SMALL, TILE_SIZES.LARGE],
22
+ description: 'Size of the tile (S or L)',
23
+ },
24
+ onClick: {
25
+ action: 'clicked',
26
+ description: 'Click handler for the tile',
27
+ },
28
+ },
29
+ } as Meta<typeof VerticalTile>;
30
+
31
+ type Story = StoryObj<typeof VerticalTile>;
32
+
33
+ const StoryWrapper = styled.div`
34
+ display: grid;
35
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
36
+ gap: 1rem;
37
+ max-width: 1000px;
38
+ `;
39
+
40
+ export const Default: Story = {
41
+ render: () => (
42
+ <StoryWrapper>
43
+ <VerticalTile
44
+ content={<TextShared>Option 1</TextShared>}
45
+ size={TILE_SIZES.SMALL}
46
+ />
47
+ <VerticalTile
48
+ content={<TextShared>Option 2</TextShared>}
49
+ size={TILE_SIZES.SMALL}
50
+ />
51
+ <VerticalTile
52
+ content={<TextShared>Option 3</TextShared>}
53
+ size={TILE_SIZES.SMALL}
54
+ />
55
+ <VerticalTile
56
+ content={<TextShared>Option 4</TextShared>}
57
+ size={TILE_SIZES.SMALL}
58
+ />
59
+ </StoryWrapper>
60
+ ),
61
+ };
62
+
63
+ export const CardStyleGrid: Story = {
64
+ render: () => (
65
+ <StoryWrapper>
66
+ <VerticalTile
67
+ content={
68
+ <div>
69
+ <div style={{ marginBottom: '1rem' }}>
70
+ <StarFullIcon size="40" color="#FFD700" />
71
+ </div>
72
+ <TextShared weight="bold" mb="space8">
73
+ Web Scraper
74
+ </TextShared>
75
+ <TextShared size="small" color="#666" mb="space12">
76
+ Extract data from any website quickly and efficiently
77
+ </TextShared>
78
+ <Button size="small" fullWidth>
79
+ Take Action
80
+ </Button>
81
+ </div>
82
+ }
83
+ size={TILE_SIZES.LARGE}
84
+ onClick={() => alert('Clicked Web Scraper')}
85
+ />
86
+ <VerticalTile
87
+ content={
88
+ <div>
89
+ <div style={{ marginBottom: '1rem' }}>
90
+ <SettingsIcon size="40" color="#2196F3" />
91
+ </div>
92
+ <TextShared weight="bold" mb="space8">
93
+ API Integration
94
+ </TextShared>
95
+ <TextShared size="small" color="#666" mb="space12">
96
+ Connect your APIs and automate workflows
97
+ </TextShared>
98
+ <Button size="small" fullWidth>
99
+ Take Action
100
+ </Button>
101
+ </div>
102
+ }
103
+ size={TILE_SIZES.LARGE}
104
+ onClick={() => alert('Clicked API Integration')}
105
+ />
106
+ <VerticalTile
107
+ content={
108
+ <div>
109
+ <div style={{ marginBottom: '1rem' }}>
110
+ <CheckCircleIcon size="40" color="#4CAF50" />
111
+ </div>
112
+ <TextShared weight="bold" mb="space8">
113
+ Data Processor
114
+ </TextShared>
115
+ <TextShared size="small" color="#666" mb="space12">
116
+ Transform and clean your data automatically
117
+ </TextShared>
118
+ <Button size="small" fullWidth>
119
+ Take Action
120
+ </Button>
121
+ </div>
122
+ }
123
+ size={TILE_SIZES.LARGE}
124
+ onClick={() => alert('Clicked Data Processor')}
125
+ />
126
+ </StoryWrapper>
127
+ ),
128
+ };
129
+
130
+ export const SizeComparison: Story = {
131
+ render: () => (
132
+ <StoryWrapper>
133
+ <div>
134
+ <TextShared size="small" weight="bold" mb="space8">Small Size</TextShared>
135
+ <VerticalTile
136
+ content={
137
+ <div>
138
+ <TextShared weight="bold" mb="space4">
139
+ Small Tile
140
+ </TextShared>
141
+ <TextShared size="small" color="#666">
142
+ 16px padding
143
+ </TextShared>
144
+ </div>
145
+ }
146
+ size={TILE_SIZES.SMALL}
147
+ />
148
+ </div>
149
+ <div>
150
+ <TextShared size="small" weight="bold" mb="space8">Large Size</TextShared>
151
+ <VerticalTile
152
+ content={
153
+ <div>
154
+ <TextShared weight="bold" mb="space4">
155
+ Large Tile
156
+ </TextShared>
157
+ <TextShared size="small" color="#666">
158
+ 24px padding
159
+ </TextShared>
160
+ </div>
161
+ }
162
+ size={TILE_SIZES.LARGE}
163
+ />
164
+ </div>
165
+ </StoryWrapper>
166
+ ),
167
+ };
@@ -0,0 +1,91 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { Button } from '../button.js';
4
+ import { Card, type CardProps } from './card.js';
5
+
6
+ export default {
7
+ title: 'UI-Library/Cards/Card',
8
+ component: Card,
9
+ argTypes: {
10
+ caption: {
11
+ control: 'text',
12
+ description: 'The heading/title text of the card',
13
+ },
14
+ description: {
15
+ control: 'text',
16
+ description: 'Additional description text displayed below the caption',
17
+ },
18
+ actions: {
19
+ control: false,
20
+ description: 'Action buttons or elements displayed in the header',
21
+ },
22
+ children: {
23
+ control: 'text',
24
+ description: 'Main content of the card',
25
+ },
26
+ disabled: {
27
+ control: 'boolean',
28
+ description: 'Whether the card content is disabled (overlayed)',
29
+ },
30
+ shadowless: {
31
+ control: 'boolean',
32
+ description: 'Whether to remove the box shadow from the card',
33
+ },
34
+ as: {
35
+ control: 'text',
36
+ description: 'The HTML element type to render as',
37
+ },
38
+ },
39
+ } as Meta<CardProps>;
40
+
41
+ type Story = StoryObj<CardProps>;
42
+
43
+ /**
44
+ * A basic card with caption and content
45
+ */
46
+ export const Default: Story = {
47
+ args: {
48
+ caption: 'Card Title',
49
+ children: 'This is the main content of the card.',
50
+ },
51
+ };
52
+
53
+ /**
54
+ * A card with all features: caption, description, actions, and content
55
+ */
56
+ export const WithAllFeatures: Story = {
57
+ args: {
58
+ caption: 'Complete Card',
59
+ description: 'This is a description that provides additional context about the card content.',
60
+ actions: <Button size="small">Action</Button>,
61
+ children: 'This card demonstrates all available features including caption, description, actions, and content.',
62
+ },
63
+ };
64
+
65
+ /**
66
+ * A card with action buttons in the header
67
+ */
68
+ export const WithActions: Story = {
69
+ args: {
70
+ caption: 'Card with Actions',
71
+ actions: (
72
+ <>
73
+ <Button size="small" variant="tertiary">Cancel</Button>
74
+ <Button size="small">Save</Button>
75
+ </>
76
+ ),
77
+ children: 'This card includes action buttons in its header.',
78
+ },
79
+ };
80
+
81
+ /**
82
+ * A disabled card with overlayed content
83
+ */
84
+ export const Disabled: Story = {
85
+ args: {
86
+ caption: 'Disabled Card',
87
+ description: 'The content of this card is disabled.',
88
+ children: 'You cannot interact with this content.',
89
+ disabled: true,
90
+ },
91
+ };
@@ -0,0 +1,160 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { Markdown, type MarkdownProps } from './markdown.js';
4
+
5
+ export default {
6
+ title: 'UI-Library/Markdown/Markdown',
7
+ component: Markdown,
8
+ argTypes: {
9
+ markdown: {
10
+ control: 'text',
11
+ description: 'The markdown content to render',
12
+ },
13
+ scrollMarginTopPx: {
14
+ control: { type: 'number', min: 0 },
15
+ description: 'Offset from top of page to account for sticky header',
16
+ },
17
+ addHeadingAnchors: {
18
+ control: 'boolean',
19
+ description: 'Whether to add clickable anchor links to headings',
20
+ },
21
+ isUserGeneratedContent: {
22
+ control: 'boolean',
23
+ description: 'Whether the content is user-generated (adds ugc rel attribute to external links)',
24
+ },
25
+ lazyLoadImages: {
26
+ control: 'boolean',
27
+ description: 'Whether to lazy load images',
28
+ },
29
+ transformLinkUri: {
30
+ control: false,
31
+ description: 'Function to transform link URIs',
32
+ },
33
+ transformImageUri: {
34
+ control: false,
35
+ description: 'Function to transform image URIs',
36
+ },
37
+ currentPathHostname: {
38
+ control: 'text',
39
+ description: 'Current path hostname for link handling',
40
+ },
41
+ allowElement: {
42
+ control: false,
43
+ description: 'Function to filter allowed elements',
44
+ },
45
+ LinkRenderer: {
46
+ control: false,
47
+ description: 'Custom link renderer component',
48
+ },
49
+ },
50
+ } as Meta<MarkdownProps>;
51
+
52
+ type Story = StoryObj<MarkdownProps>;
53
+
54
+ const sampleMarkdown = `# Heading 1
55
+
56
+ This is a paragraph with **bold** and *italic* text.
57
+
58
+ ## Heading 2
59
+
60
+ Here's a list:
61
+ - Item 1
62
+ - Item 2
63
+ - Item 3
64
+
65
+ ### Heading 3
66
+
67
+ And a numbered list:
68
+ 1. First
69
+ 2. Second
70
+ 3. Third
71
+
72
+ #### Code Example
73
+
74
+ Inline code: \`const example = "hello"\`
75
+
76
+ \`\`\`javascript
77
+ function greet(name) {
78
+ return \`Hello, \${name}!\`;
79
+ }
80
+ \`\`\`
81
+ `;
82
+
83
+ /**
84
+ * Basic markdown rendering with common elements
85
+ */
86
+ export const Default: Story = {
87
+ args: {
88
+ markdown: sampleMarkdown,
89
+ },
90
+ };
91
+
92
+ /**
93
+ * Markdown with images
94
+ */
95
+ export const WithImages: Story = {
96
+ args: {
97
+ markdown: `# Images Example
98
+
99
+ ![Placeholder](https://console.apify.com/img/logos_apify/logo_apify_full_dark_text.svg)
100
+
101
+ Images are responsive and scale to fit their container.`,
102
+ lazyLoadImages: true,
103
+ },
104
+ };
105
+
106
+ /**
107
+ * Markdown with mixed content
108
+ */
109
+ export const ComplexMarkdown: Story = {
110
+ args: {
111
+ markdown: `# Complex Markdown Example
112
+
113
+ This demonstrates various markdown features together.
114
+
115
+ ## Features
116
+
117
+ Here's what we can do:
118
+
119
+ ### Lists and Formatting
120
+
121
+ 1. **Bold text** for emphasis
122
+ 2. *Italic text* for subtlety
123
+ 3. \`Inline code\` for technical terms
124
+ 4. ~~Strikethrough~~ for corrections
125
+
126
+ ### Code Block
127
+
128
+ \`\`\`typescript
129
+ interface Actor {
130
+ id: string;
131
+ name: string;
132
+ version: string;
133
+ }
134
+
135
+ const myActor: Actor = {
136
+ id: "abc123",
137
+ name: "web-scraper",
138
+ version: "1.0.0"
139
+ };
140
+ \`\`\`
141
+
142
+ ### Blockquote
143
+
144
+ > Important information is highlighted in blockquotes.
145
+
146
+ ### Table
147
+
148
+ | Feature | Supported | Notes |
149
+ |---------|-----------|-------|
150
+ | Headings | ✅ | H1-H6 |
151
+ | Lists | ✅ | Ordered & unordered |
152
+ | Code | ✅ | Inline & blocks |
153
+ | Tables | ✅ | With alignment |
154
+
155
+ ---
156
+
157
+ That's a comprehensive example!`,
158
+ addHeadingAnchors: true,
159
+ },
160
+ };
@@ -0,0 +1,64 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { PaginationButtons, type PaginationButtonsProps } from './pagination.js';
4
+
5
+ export default {
6
+ title: 'UI-Library/PaginationButtons',
7
+ component: PaginationButtons,
8
+ argTypes: {
9
+ page: {
10
+ control: { type: 'number', min: 0 },
11
+ description: 'Current page index (0-based)',
12
+ },
13
+ totalPages: {
14
+ control: { type: 'number', min: 1 },
15
+ description: 'Total number of pages',
16
+ },
17
+ onPageChange: {
18
+ action: 'pageChanged',
19
+ description: 'Callback when page changes',
20
+ },
21
+ },
22
+ } as Meta<PaginationButtonsProps>;
23
+
24
+ type Story = StoryObj<PaginationButtonsProps>;
25
+
26
+ /**
27
+ * Basic pagination with a few pages
28
+ */
29
+ export const Default: Story = {
30
+ args: {
31
+ page: 0,
32
+ totalPages: 5,
33
+ },
34
+ };
35
+
36
+ /**
37
+ * Pagination at the beginning of many pages
38
+ */
39
+ export const ManyPagesStart: Story = {
40
+ args: {
41
+ page: 0,
42
+ totalPages: 20,
43
+ },
44
+ };
45
+
46
+ /**
47
+ * Pagination in the middle of many pages
48
+ */
49
+ export const ManyPagesMiddle: Story = {
50
+ args: {
51
+ page: 10,
52
+ totalPages: 20,
53
+ },
54
+ };
55
+
56
+ /**
57
+ * Pagination at the end of many pages
58
+ */
59
+ export const ManyPagesEnd: Story = {
60
+ args: {
61
+ page: 19,
62
+ totalPages: 20,
63
+ },
64
+ };
@@ -0,0 +1,113 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import styled from 'styled-components';
3
+
4
+ import { TabNumberChip } from './tab_number_chip.js';
5
+
6
+ interface TabNumberChipProps {
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ const StoryWrapper = styled.div`
11
+ display: flex;
12
+ gap: 1rem;
13
+ align-items: center;
14
+ `;
15
+
16
+ export default {
17
+ title: 'UI-Library/TabNumberChip',
18
+ component: TabNumberChip,
19
+ argTypes: {
20
+ children: {
21
+ control: 'text',
22
+ description: 'The content to display inside the chip (typically a number)',
23
+ },
24
+ },
25
+ decorators: [
26
+ (Story: ElementType, _context: StoryContext) => (
27
+ <StoryWrapper>
28
+ <Story />
29
+ </StoryWrapper>
30
+ ),
31
+ ],
32
+ } as Meta<TabNumberChipProps>;
33
+
34
+ type Story = StoryObj<TabNumberChipProps>;
35
+
36
+ /**
37
+ * A basic chip showing a number
38
+ */
39
+ export const Default: Story = {
40
+ args: {
41
+ children: '5',
42
+ },
43
+ };
44
+
45
+ /**
46
+ * A chip with a single digit
47
+ */
48
+ export const SingleDigit: Story = {
49
+ args: {
50
+ children: '3',
51
+ },
52
+ };
53
+
54
+ /**
55
+ * A chip with a double digit number
56
+ */
57
+ export const DoubleDigit: Story = {
58
+ args: {
59
+ children: '42',
60
+ },
61
+ };
62
+
63
+ /**
64
+ * A chip with a large number
65
+ */
66
+ export const LargeNumber: Story = {
67
+ args: {
68
+ children: '999',
69
+ },
70
+ };
71
+
72
+ /**
73
+ * A chip with text content
74
+ */
75
+ export const WithText: Story = {
76
+ args: {
77
+ children: 'New',
78
+ },
79
+ };
80
+
81
+ const DisabledParent = styled.div`
82
+ &._disabled {
83
+ opacity: 1;
84
+ }
85
+ `;
86
+
87
+ /**
88
+ * A chip in disabled state (requires parent with _disabled class)
89
+ */
90
+ export const Disabled: Story = {
91
+ args: {
92
+ children: '7',
93
+ },
94
+ render: (args) => (
95
+ <DisabledParent className="_disabled">
96
+ <TabNumberChip {...args} />
97
+ </DisabledParent>
98
+ ),
99
+ };
100
+
101
+ /**
102
+ * Multiple chips with different values
103
+ */
104
+ export const Multiple: Story = {
105
+ render: () => (
106
+ <StoryWrapper>
107
+ <TabNumberChip>1</TabNumberChip>
108
+ <TabNumberChip>12</TabNumberChip>
109
+ <TabNumberChip>999</TabNumberChip>
110
+ <TabNumberChip>New</TabNumberChip>
111
+ </StoryWrapper>
112
+ ),
113
+ };
@@ -1,61 +0,0 @@
1
- import {
2
- Heading,
3
- Text,
4
- } from './index.js';
5
-
6
- export default {
7
- title: 'UI-Library/Text',
8
- component: Text,
9
- args: {
10
- },
11
- parameters: {
12
- layout: 'centered',
13
- },
14
- };
15
-
16
- export const Default = () => (<div>
17
- <Heading type="title3xl" mb='space24'>Title 3XL</Heading>
18
- <Heading type="title2xl">Title 2XL</Heading>
19
- <Heading type="titleXl">Title XL</Heading>
20
- <Heading type="titleL">Title L</Heading>
21
- <Heading type="titleM">Title M</Heading>
22
- <Heading type="titleS">Title S</Heading>
23
- <Heading type="titleXs">Title XS</Heading>
24
- <br />
25
- <Text type="body">Body default</Text>
26
- <Text type="body" size='small'>Body size=small</Text>
27
- <Text type="body" size='big'>Body size=big</Text>
28
- <br />
29
- <Text type="code">Code default</Text>
30
- <Text type="code" size='small'>Code size=small</Text>
31
- <Text type="code" size='big'>Code size=big</Text>
32
- <br />
33
- <Text type="body" weight='bold'>Body weight=bold</Text>
34
- <Text type="body" weight='bold' size='small'>Body size=small weight=bold</Text>
35
- <Text type="body" weight='bold' size='big'>Body size=big weight=bold</Text>
36
- <br />
37
- <Text type="code" weight='bold'>Code default weight=bold</Text>
38
- <Text type="code" weight='bold' size='small'>Code size=small weight=bold</Text>
39
- <Text type="code" weight='bold' size='big'>Code size=big weight=bold</Text>
40
- </div>);
41
-
42
- export const HeadingExtras = () => (<div style={{ minWidth: '20rem' }}>
43
- <Heading align='left'>Heading align=left</Heading>
44
- <Heading align='center'>Heading align=center</Heading>
45
- <Heading align='right'>Heading align=right</Heading>
46
- <br />
47
- <Heading color="deeppink">Heading color=deeppink</Heading>
48
- <br />
49
- <Heading type='titleL' as="h2">Heading type=titleL as=h2</Heading>
50
- </div>);
51
-
52
- export const TextExtras = () => (<div style={{ minWidth: '20rem' }}>
53
- <Text align='left'>Text align=left</Text>
54
- <Text align='center'>Text align=center</Text>
55
- <Text align='right'>Text align=right</Text>
56
- <br />
57
- <Text color='deeppink'>Text color=deeppink</Text>
58
- <br />
59
- <Text italic>Text italic=true</Text>
60
- <Text uppercase={true}>Text uppercase=true</Text>
61
- </div>);