@apify/ui-library 1.97.2 → 1.98.1

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 (105) hide show
  1. package/dist/src/components/action_link.stories.d.ts +50 -0
  2. package/dist/src/components/action_link.stories.d.ts.map +1 -0
  3. package/dist/src/components/action_link.stories.js +129 -0
  4. package/dist/src/components/action_link.stories.js.map +1 -0
  5. package/dist/src/components/actor_template_card.stories.d.ts +49 -0
  6. package/dist/src/components/actor_template_card.stories.d.ts.map +1 -0
  7. package/dist/src/components/actor_template_card.stories.js +154 -0
  8. package/dist/src/components/actor_template_card.stories.js.map +1 -0
  9. package/dist/src/components/banner.stories.d.ts +53 -0
  10. package/dist/src/components/banner.stories.d.ts.map +1 -0
  11. package/dist/src/components/banner.stories.js +132 -0
  12. package/dist/src/components/banner.stories.js.map +1 -0
  13. package/dist/src/components/blog_article.stories.d.ts +33 -0
  14. package/dist/src/components/blog_article.stories.d.ts.map +1 -0
  15. package/dist/src/components/blog_article.stories.js +92 -0
  16. package/dist/src/components/blog_article.stories.js.map +1 -0
  17. package/dist/src/components/chip.stories.d.ts +98 -0
  18. package/dist/src/components/chip.stories.d.ts.map +1 -0
  19. package/dist/src/components/chip.stories.js +251 -0
  20. package/dist/src/components/chip.stories.js.map +1 -0
  21. package/dist/src/components/code/code_block/code_block_with_tabs.d.ts +1 -1
  22. package/dist/src/components/code/code_block/code_block_with_tabs.d.ts.map +1 -1
  23. package/dist/src/components/code/code_block/code_block_with_tabs.stories.d.ts +23 -0
  24. package/dist/src/components/code/code_block/code_block_with_tabs.stories.d.ts.map +1 -0
  25. package/dist/src/components/code/code_block/code_block_with_tabs.stories.js +63 -0
  26. package/dist/src/components/code/code_block/code_block_with_tabs.stories.js.map +1 -0
  27. package/dist/src/components/code/inline_code/inline_code.stories.d.ts +16 -0
  28. package/dist/src/components/code/inline_code/inline_code.stories.d.ts.map +1 -0
  29. package/dist/src/components/code/inline_code/inline_code.stories.js +47 -0
  30. package/dist/src/components/code/inline_code/inline_code.stories.js.map +1 -0
  31. package/dist/src/components/code/one_line_code/one_line_code.stories.d.ts +16 -0
  32. package/dist/src/components/code/one_line_code/one_line_code.stories.d.ts.map +1 -0
  33. package/dist/src/components/code/one_line_code/one_line_code.stories.js +81 -0
  34. package/dist/src/components/code/one_line_code/one_line_code.stories.js.map +1 -0
  35. package/dist/src/components/color_wheel_gradient.stories.d.ts +38 -0
  36. package/dist/src/components/color_wheel_gradient.stories.d.ts.map +1 -0
  37. package/dist/src/components/color_wheel_gradient.stories.js +126 -0
  38. package/dist/src/components/color_wheel_gradient.stories.js.map +1 -0
  39. package/dist/src/components/link.stories.d.ts +22 -0
  40. package/dist/src/components/link.stories.d.ts.map +1 -0
  41. package/dist/src/components/link.stories.js +112 -0
  42. package/dist/src/components/link.stories.js.map +1 -0
  43. package/dist/src/components/rating.stories.d.ts +32 -0
  44. package/dist/src/components/rating.stories.d.ts.map +1 -0
  45. package/dist/src/components/rating.stories.js +95 -0
  46. package/dist/src/components/rating.stories.js.map +1 -0
  47. package/dist/src/components/simple_markdown/simple_markdown.d.ts +2 -2
  48. package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
  49. package/dist/src/components/simple_markdown/simple_markdown.stories.d.ts +8 -0
  50. package/dist/src/components/simple_markdown/simple_markdown.stories.d.ts.map +1 -0
  51. package/dist/src/components/simple_markdown/simple_markdown.stories.js +60 -0
  52. package/dist/src/components/simple_markdown/simple_markdown.stories.js.map +1 -0
  53. package/dist/src/components/tabs/tab.stories.d.ts.map +1 -1
  54. package/dist/src/components/tabs/tab.stories.js +1 -0
  55. package/dist/src/components/tabs/tab.stories.js.map +1 -1
  56. package/dist/src/components/text/text.stories.d.ts +13 -0
  57. package/dist/src/components/text/text.stories.d.ts.map +1 -0
  58. package/dist/src/components/text/text.stories.js +14 -0
  59. package/dist/src/components/text/text.stories.js.map +1 -0
  60. package/dist/src/design_system/tokens/radiuses.d.ts +2 -0
  61. package/dist/src/design_system/tokens/radiuses.d.ts.map +1 -1
  62. package/dist/src/design_system/tokens/radiuses.js +2 -0
  63. package/dist/src/design_system/tokens/radiuses.js.map +1 -1
  64. package/dist/src/design_system/tokens/radiuses.stories.d.ts +6 -0
  65. package/dist/src/design_system/tokens/radiuses.stories.d.ts.map +1 -0
  66. package/dist/src/design_system/tokens/radiuses.stories.js +30 -0
  67. package/dist/src/design_system/tokens/radiuses.stories.js.map +1 -0
  68. package/dist/src/design_system/tokens/shadows.stories.d.ts +6 -0
  69. package/dist/src/design_system/tokens/shadows.stories.d.ts.map +1 -0
  70. package/dist/src/design_system/tokens/shadows.stories.js +37 -0
  71. package/dist/src/design_system/tokens/shadows.stories.js.map +1 -0
  72. package/dist/src/design_system/tokens/spaces.stories.d.ts +10 -0
  73. package/dist/src/design_system/tokens/spaces.stories.d.ts.map +1 -0
  74. package/dist/src/design_system/tokens/spaces.stories.js +92 -0
  75. package/dist/src/design_system/tokens/spaces.stories.js.map +1 -0
  76. package/dist/tsconfig.build.tsbuildinfo +1 -1
  77. package/package.json +3 -3
  78. package/src/components/action_link.stories.tsx +145 -0
  79. package/src/components/actor_template_card.stories.tsx +179 -0
  80. package/src/components/badge.doc.mdx +35 -0
  81. package/src/components/banner.stories.tsx +256 -0
  82. package/src/components/blog_article.stories.tsx +133 -0
  83. package/src/components/chip.stories.tsx +301 -0
  84. package/src/components/code/code_block/code_block.stories.jsx +133 -0
  85. package/src/components/code/code_block/code_block_with_tabs.stories.tsx +81 -0
  86. package/src/components/code/code_block/code_block_with_tabs.tsx +1 -1
  87. package/src/components/code/inline_code/inline_code.stories.tsx +88 -0
  88. package/src/components/code/one_line_code/one_line_code.stories.tsx +173 -0
  89. package/src/components/color_wheel_gradient.stories.tsx +157 -0
  90. package/src/components/floating/tooltip.stories.jsx +0 -1
  91. package/src/components/link.stories.tsx +127 -0
  92. package/src/components/message.stories.jsx +116 -0
  93. package/src/components/rating.stories.tsx +166 -0
  94. package/src/components/simple_markdown/simple_markdown.stories.tsx +71 -0
  95. package/src/components/simple_markdown/simple_markdown.tsx +1 -1
  96. package/src/components/tabs/tab.stories.tsx +1 -0
  97. package/src/components/tag.doc.mdx +38 -0
  98. package/src/components/text/text.stories.tsx +61 -0
  99. package/src/design_system/tokens/radiuses.doc.mdx +12 -0
  100. package/src/design_system/tokens/radiuses.stories.tsx +49 -0
  101. package/src/design_system/tokens/radiuses.ts +2 -0
  102. package/src/design_system/tokens/shadows.doc.mdx +16 -0
  103. package/src/design_system/tokens/shadows.stories.tsx +58 -0
  104. package/src/design_system/tokens/spaces.doc.mdx +18 -0
  105. package/src/design_system/tokens/spaces.stories.tsx +131 -0
@@ -0,0 +1,88 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import type { InlineCodeProps } from './inline_code.js';
4
+ import { InlineCode } from './inline_code.js';
5
+
6
+ /**
7
+ * Stories for the InlineCode component. This file showcases the
8
+ * various states and configurations of the inline code component,
9
+ * including different sizes and copy button functionality.
10
+ */
11
+ export default {
12
+ title: 'ui-library/InlineCode',
13
+ component: InlineCode,
14
+ tags: [],
15
+ argTypes: {
16
+ children: {
17
+ control: 'text',
18
+ description: 'The code content to display',
19
+ },
20
+ size: {
21
+ control: 'select',
22
+ options: ['regular', 'small', 'big'],
23
+ description: 'Size of the inline code text',
24
+ },
25
+ withCopyButton: {
26
+ control: 'boolean',
27
+ description: 'Whether to show a copy button',
28
+ },
29
+ },
30
+ parameters: {
31
+ design: {
32
+ type: 'figma',
33
+ url: 'https://www.figma.com/design/duSsGnk84UMYav8mg8QNgR/%F0%9F%93%96-Shared-library?node-id=2132-2425&t=tH2x12cMH5yh0fuf-0',
34
+ },
35
+ },
36
+ } as Meta<InlineCodeProps>;
37
+
38
+ type Story = StoryObj<InlineCodeProps>;
39
+
40
+ /**
41
+ * Comprehensive comparison of all InlineCode variants side by side.
42
+ * Shows different sizes, copy button states, and various code examples.
43
+ */
44
+ export const AllVariants: Story = {
45
+ render: () => (
46
+ <div style={{
47
+ display: 'grid',
48
+ gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
49
+ gap: '24px',
50
+ padding: '24px',
51
+ maxWidth: '1200px',
52
+ }}>
53
+ {/* Size variants without copy button */}
54
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
55
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Size Variants</h3>
56
+ <div>
57
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Small</p>
58
+ <InlineCode size="small">npm install @apify/ui-library</InlineCode>
59
+ </div>
60
+ <div>
61
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Regular</p>
62
+ <InlineCode size="regular">npm install @apify/ui-library</InlineCode>
63
+ </div>
64
+ <div>
65
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Big</p>
66
+ <InlineCode size="big">npm install @apify/ui-library</InlineCode>
67
+ </div>
68
+ </div>
69
+
70
+ {/* Size variants with copy button */}
71
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
72
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>With Copy Button</h3>
73
+ <div>
74
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Small</p>
75
+ <InlineCode size="small" withCopyButton>npm install @apify/ui-library</InlineCode>
76
+ </div>
77
+ <div>
78
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Regular</p>
79
+ <InlineCode size="regular" withCopyButton>npm install @apify/ui-library</InlineCode>
80
+ </div>
81
+ <div>
82
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Big</p>
83
+ <InlineCode size="big" withCopyButton>npm install @apify/ui-library</InlineCode>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ ),
88
+ };
@@ -0,0 +1,173 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { OneLineCode, type OneLineCodeProps } from './one_line_code.js';
4
+
5
+ /**
6
+ * Stories for the OneLineCode component. This file showcases the
7
+ * various states and configurations of the one line code component,
8
+ * including different languages, HTTP methods, and interactive features.
9
+ */
10
+ export default {
11
+ title: 'ui-library/OneLineCode',
12
+ component: OneLineCode,
13
+ tags: [],
14
+ argTypes: {
15
+ children: {
16
+ control: 'text',
17
+ description: 'The code content to display',
18
+ },
19
+ language: {
20
+ control: 'select',
21
+ options: ['javascript', 'python', 'bash', 'http', 'json', 'sql'],
22
+ description: 'Programming language for syntax highlighting',
23
+ },
24
+ size: {
25
+ control: 'select',
26
+ options: ['regular', 'small', 'big'],
27
+ description: 'Size of the code text',
28
+ },
29
+ httpMethod: {
30
+ control: 'select',
31
+ options: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'PATCH'],
32
+ description: 'HTTP method for API calls',
33
+ },
34
+ actionButtonLabel: {
35
+ control: 'text',
36
+ description: 'Label for the action button',
37
+ },
38
+ onActionButtonClick: {
39
+ action: 'actionButtonClicked',
40
+ description: 'Action button click handler',
41
+ },
42
+ fullWidth: {
43
+ control: 'boolean',
44
+ description: 'Whether the component should take full width',
45
+ },
46
+ secret: {
47
+ control: 'text',
48
+ description: 'Secret value to replace placeholder with',
49
+ },
50
+ secretPlaceholder: {
51
+ control: 'text',
52
+ description: 'Placeholder text for secrets',
53
+ },
54
+ disabled: {
55
+ control: 'boolean',
56
+ description: 'Whether the component is disabled',
57
+ },
58
+ hideCopyButton: {
59
+ control: 'boolean',
60
+ description: 'Whether to hide the copy button',
61
+ },
62
+ },
63
+ parameters: {
64
+ design: {
65
+ type: 'figma',
66
+ url: 'https://www.figma.com/design/duSsGnk84UMYav8mg8QNgR/%F0%9F%93%96-Shared-library?node-id=2131-885&t=tH2x12cMH5yh0fuf-0',
67
+ },
68
+ },
69
+ } as Meta<OneLineCodeProps>;
70
+
71
+ type Story = StoryObj<OneLineCodeProps>;
72
+
73
+ /**
74
+ * Comprehensive comparison of all OneLineCode variants side by side.
75
+ * Shows different languages, HTTP methods, and interactive features.
76
+ */
77
+ export const AllVariants: Story = {
78
+ render: () => (
79
+ <div style={{
80
+ display: 'flex',
81
+ flexDirection: 'column',
82
+ padding: '24px',
83
+ gap: '24px',
84
+ maxWidth: '1200px',
85
+ }}>
86
+ {/* Basic examples */}
87
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
88
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Basic Examples</h3>
89
+ <div>
90
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>JavaScript</p>
91
+ <OneLineCode language="javascript">const foo = &apos;bar&apos;;</OneLineCode>
92
+ </div>
93
+ <div>
94
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Python</p>
95
+ <OneLineCode language="python">foo = &apos;bar&apos;</OneLineCode>
96
+ </div>
97
+ <div>
98
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Bash</p>
99
+ <OneLineCode language="bash">curl -X GET https://api.example.com</OneLineCode>
100
+ </div>
101
+ </div>
102
+
103
+ {/* HTTP methods */}
104
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
105
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>HTTP Methods</h3>
106
+ <div>
107
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>GET</p>
108
+ <OneLineCode language="http" httpMethod="GET">https://api.example.com/users</OneLineCode>
109
+ </div>
110
+ <div>
111
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>POST</p>
112
+ <OneLineCode language="http" httpMethod="POST">https://api.example.com/users</OneLineCode>
113
+ </div>
114
+ <div>
115
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>PUT</p>
116
+ <OneLineCode language="http" httpMethod="PUT">https://api.example.com/users/123</OneLineCode>
117
+ </div>
118
+ <div>
119
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>DELETE</p>
120
+ <OneLineCode language="http" httpMethod="DELETE">https://api.example.com/users/123</OneLineCode>
121
+ </div>
122
+ </div>
123
+
124
+ {/* Interactive features */}
125
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
126
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Interactive</h3>
127
+ <div>
128
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>With Action Button</p>
129
+ <OneLineCode
130
+ language="javascript"
131
+ actionButtonLabel="Try it"
132
+ onActionButtonClick={() => console.log('Try it clicked')}
133
+ >
134
+ npm install @apify/ui-library
135
+ </OneLineCode>
136
+ </div>
137
+ <div>
138
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>With Secret</p>
139
+ <OneLineCode
140
+ language="http"
141
+ secret="VERY_SECRET_TOKEN"
142
+ httpMethod="GET"
143
+ >
144
+ https://api.example.com?token=***
145
+ </OneLineCode>
146
+ </div>
147
+ <div>
148
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Disabled</p>
149
+ <OneLineCode language="bash" disabled>
150
+ curl -X GET https://api.example.com
151
+ </OneLineCode>
152
+ </div>
153
+ </div>
154
+
155
+ {/* Size variants */}
156
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
157
+ <h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Size Variants</h3>
158
+ <div>
159
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Small</p>
160
+ <OneLineCode language="javascript" size="small">const foo = &apos;bar&apos;;</OneLineCode>
161
+ </div>
162
+ <div>
163
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Regular</p>
164
+ <OneLineCode language="javascript" size="regular">const foo = &apos;bar&apos;;</OneLineCode>
165
+ </div>
166
+ <div>
167
+ <p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Big</p>
168
+ <OneLineCode language="javascript" size="big">const foo = &apos;bar&apos;;</OneLineCode>
169
+ </div>
170
+ </div>
171
+ </div>
172
+ ),
173
+ };
@@ -0,0 +1,157 @@
1
+ import type { Meta, StoryContext, StoryObj } from '@storybook/react-vite';
2
+ import type { ElementType } from 'react';
3
+
4
+ import { ColorWheelGradient, type ColorWheelGradientProps } from './color_wheel_gradient.js';
5
+
6
+ const Wrapper = ({ children }: { children: React.ReactNode }) => (
7
+ <div
8
+ style={{
9
+ position: 'relative',
10
+ width: '400px',
11
+ height: '400px',
12
+ backgroundColor: '#f5f5f5',
13
+ border: '1px solid #ddd',
14
+ borderRadius: '8px',
15
+ overflow: 'hidden',
16
+ }}
17
+ >
18
+ <style>
19
+ {`
20
+ @keyframes rotate {
21
+ from { transform: rotate(0deg); }
22
+ to { transform: rotate(360deg); }
23
+ }
24
+ `}
25
+ </style>
26
+ {children}
27
+ </div>
28
+ );
29
+
30
+ export default {
31
+ title: 'UI-Library/ColorWheelGradient',
32
+ tags: ['deprecated'],
33
+ component: ColorWheelGradient,
34
+ decorators: [
35
+ (Story: ElementType, _context: StoryContext) => (
36
+ <Wrapper>
37
+ <Story />
38
+ </Wrapper>
39
+ ),
40
+ ],
41
+ argTypes: {
42
+ translateX: {
43
+ control: 'number',
44
+ },
45
+ translateY: {
46
+ control: 'number',
47
+ },
48
+ rotation: {
49
+ control: 'number',
50
+ },
51
+ radius: {
52
+ control: 'number',
53
+ },
54
+ blurSize: {
55
+ control: 'number',
56
+ },
57
+ },
58
+ parameters: {
59
+ design: {
60
+ type: 'figma',
61
+ url: 'TODO: Add Figma URL',
62
+ },
63
+ },
64
+ } as Meta<ColorWheelGradientProps>;
65
+
66
+ type Story = StoryObj<ColorWheelGradientProps>;
67
+
68
+ /**
69
+ * Default color wheel gradient with standard settings
70
+ */
71
+ export const Default: Story = {
72
+ args: {
73
+ radius: 200,
74
+ },
75
+ };
76
+
77
+ /**
78
+ * Small color wheel gradient
79
+ */
80
+ export const Small: Story = {
81
+ args: {
82
+ radius: 100,
83
+ },
84
+ };
85
+
86
+ /**
87
+ * Medium color wheel gradient
88
+ */
89
+ export const Medium: Story = {
90
+ args: {
91
+ radius: 150,
92
+ },
93
+ };
94
+
95
+ /**
96
+ * Large color wheel gradient
97
+ */
98
+ export const Large: Story = {
99
+ args: {
100
+ radius: 250,
101
+ },
102
+ };
103
+
104
+ /**
105
+ * Color wheel gradient with custom translation in both directions
106
+ */
107
+ export const Translated: Story = {
108
+ args: {
109
+ radius: 150,
110
+ translateX: 30,
111
+ translateY: -30,
112
+ },
113
+ };
114
+
115
+ /**
116
+ * Color wheel gradient with minimal blur
117
+ */
118
+ export const MinimalBlur: Story = {
119
+ args: {
120
+ radius: 200,
121
+ blurSize: 10,
122
+ },
123
+ };
124
+
125
+ /**
126
+ * Color wheel gradient with no blur (sharp edges)
127
+ */
128
+ export const NoBlur: Story = {
129
+ args: {
130
+ radius: 200,
131
+ blurSize: 0,
132
+ },
133
+ };
134
+
135
+ /**
136
+ * Animated rotating color wheel gradient
137
+ */
138
+ export const AnimatedRotation: Story = {
139
+ args: {
140
+ radius: 180,
141
+ },
142
+ render: (args) => (
143
+ <ColorWheelGradient
144
+ {...args}
145
+ style={{
146
+ animation: 'rotate 4s linear infinite',
147
+ }}
148
+ />
149
+ ),
150
+ parameters: {
151
+ docs: {
152
+ description: {
153
+ story: 'This story demonstrates a continuously rotating color wheel gradient using CSS animation.',
154
+ },
155
+ },
156
+ },
157
+ };
@@ -33,7 +33,6 @@ export default {
33
33
  content: 'This is a tooltip',
34
34
  isDarkTheme: false,
35
35
  },
36
- tags: ['new'],
37
36
  };
38
37
 
39
38
  const DefaultStoryWrapper = styled.div`
@@ -0,0 +1,127 @@
1
+ import type { Meta, StoryContext, StoryObj } from '@storybook/react-vite';
2
+ import type { ElementType } from 'react';
3
+
4
+ import { Link, type LinkProps } from './link.js';
5
+
6
+ // eslint-disable-next-line max-len
7
+ const longText = 'This is a very long link text that might wrap to multiple lines depending on the container width. It is used to test how the Link component handles overflow and wrapping in different scenarios.';
8
+
9
+ // Mock the UI dependencies provider for Storybook
10
+ const MockUIProvider = ({ children }: { children: React.ReactNode }) => {
11
+ const mockDependencies = {
12
+ windowLocationHost: 'localhost:6006',
13
+ isHrefTrusted: (href: string) => !href.includes('untrusted'),
14
+ trackClick: (trackingId: string, trackingData?: object) => {
15
+ console.log('Tracked click:', trackingId, trackingData);
16
+ },
17
+ InternalLink: 'a' as ElementType, // Use regular anchor for Storybook
18
+ };
19
+
20
+ // Inject mock context (in real implementation, this would use React Context)
21
+ return <div data-mock-ui-provider={JSON.stringify(mockDependencies)}>{children}</div>;
22
+ };
23
+
24
+ export default {
25
+ title: 'UI-Library/Link',
26
+ component: Link,
27
+ decorators: [
28
+ (Story: ElementType, _context: StoryContext) => (
29
+ <MockUIProvider>
30
+ <Story />
31
+ </MockUIProvider>
32
+ ),
33
+ ],
34
+ argTypes: {
35
+ to: {
36
+ control: 'text',
37
+ description: 'The destination URL or path object. Can be internal (/path) or external (https://example.com)',
38
+ },
39
+ hideExternalIcon: {
40
+ control: 'boolean',
41
+ description: 'Hide the external link icon even for external URLs',
42
+ },
43
+ showExternalIcon: {
44
+ control: 'boolean',
45
+ description: 'Force show the external link icon even for internal links',
46
+ },
47
+ rel: {
48
+ control: 'text',
49
+ description: 'Custom rel attribute for the link (e.g., "sponsored", "nofollow")',
50
+ },
51
+ target: {
52
+ control: 'select',
53
+ options: ['_self', '_blank', '_parent', '_top'],
54
+ description: 'Where to open the link. External links default to "_blank"',
55
+ },
56
+ trackingId: {
57
+ control: 'text',
58
+ description: 'Unique identifier for tracking link clicks in analytics',
59
+ },
60
+ trackingData: {
61
+ control: 'object',
62
+ description: 'Additional data to send with tracking events (object format)',
63
+ },
64
+ onClick: {
65
+ action: 'clicked',
66
+ description: 'Callback function fired when the link is clicked',
67
+ },
68
+ children: {
69
+ control: 'text',
70
+ description: 'The link text or content to display',
71
+ },
72
+ },
73
+ parameters: {
74
+ design: {
75
+ type: 'figma',
76
+ url: 'TODO: Add Figma URL',
77
+ },
78
+ },
79
+ } as Meta<LinkProps>;
80
+
81
+ type Story = StoryObj<LinkProps>;
82
+
83
+ /**
84
+ * Default internal link behavior
85
+ */
86
+ export const Default: Story = {
87
+ args: {
88
+ to: '/dashboard',
89
+ children: 'Go to Dashboard',
90
+ },
91
+ };
92
+
93
+ /**
94
+ * External link with automatic external icon
95
+ */
96
+ export const ExternalLink: Story = {
97
+ args: {
98
+ to: 'https://apify.com',
99
+ children: 'Visit Apify Website',
100
+ },
101
+ };
102
+
103
+ /**
104
+ * Long link text to test wrapping behavior
105
+ */
106
+ export const LongText: Story = {
107
+ args: {
108
+ to: 'https://apify.com/very-long-url-path',
109
+ showExternalIcon: true,
110
+ children: `${longText} ${longText}`,
111
+ },
112
+ };
113
+
114
+ /**
115
+ * Link with additional styling props
116
+ */
117
+ export const WithStyling: Story = {
118
+ args: {
119
+ to: '/settings',
120
+ children: 'Account Settings',
121
+ style: {
122
+ fontWeight: 'bold',
123
+ fontSize: '16px',
124
+ color: '#2563eb',
125
+ },
126
+ },
127
+ };
@@ -0,0 +1,116 @@
1
+ import { Fragment } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { PlaceholderIcon } from '@apify/ui-icons';
5
+
6
+ import { Link } from './link.tsx';
7
+ import { Message } from './message.tsx';
8
+
9
+ const handleDismissClick = () => {};
10
+
11
+ const MESSAGE_TYPES = ['info', 'warning', 'danger', 'success'];
12
+
13
+ export default {
14
+ title: 'UI-Library/Message (aka Banner)',
15
+ component: Message,
16
+ argTypes: {
17
+ type: {
18
+ control: {
19
+ type: 'radio',
20
+ options: MESSAGE_TYPES,
21
+ },
22
+ defaultValue: 'warning',
23
+ },
24
+ borderless: {
25
+ control: {
26
+ type: 'boolean',
27
+ },
28
+ defaultValue: false,
29
+ },
30
+ },
31
+ args: {
32
+ caption: 'Message title',
33
+ children: 'Hello, friends. I am a message',
34
+ onDismissClick: null,
35
+ },
36
+ };
37
+
38
+ const Template = (args) => <StyledWrapper>
39
+ {MESSAGE_TYPES.map((type) => <Fragment key={type}>
40
+ <Message {...args} type={type} />
41
+ </Fragment>)}
42
+ </StyledWrapper>;
43
+
44
+ const StyledWrapper = styled.div`
45
+ display: flex;
46
+ flex-direction: column;
47
+ `;
48
+
49
+ export const Index = (args) => <StyledWrapper>
50
+ {MESSAGE_TYPES.map((type) => <Fragment key={type}>
51
+ <Message {...args} type={type} />
52
+ <Message {...args} caption="" type={type} />
53
+ <Message
54
+ {...args}
55
+ type={type}
56
+ onDismissClick={() => console.log('dismiss clicked')}
57
+ />
58
+ <Message
59
+ {...args}
60
+ type={type}
61
+ caption=""
62
+ onDismissClick={() => console.log('dismiss clicked')}
63
+ />
64
+ <Message
65
+ {...args}
66
+ type={type}
67
+ onDismissClick={() => console.log('dismiss clicked')}
68
+ actions={[{ label: 'Action', onClick: () => console.log('Action clicked') }]}
69
+ />
70
+ </Fragment>)}
71
+ </StyledWrapper>;
72
+
73
+ export const OneLine = Template.bind({});
74
+ OneLine.args = {
75
+ children: 'Hello, friends, I am a short message',
76
+ };
77
+
78
+ export const MultiLine = Template.bind({});
79
+ MultiLine.args = {
80
+ children: <>
81
+ Hello, friends, <br />
82
+ I am a very very very very very very very very very very very very very very long message<br />
83
+ and I have some <Link to="https://www.youtube.com/watch?v=dQw4w9WgXcQ">and links!</Link>
84
+ </>,
85
+ };
86
+
87
+ export const CustomIcon = Template.bind({});
88
+ CustomIcon.args = {
89
+ Icon: PlaceholderIcon,
90
+ };
91
+
92
+ export const Dissmisable = Template.bind({});
93
+ Dissmisable.args = {
94
+ onDismissClick: handleDismissClick,
95
+ };
96
+
97
+ export const Actions = Template.bind({});
98
+ Actions.args = {
99
+ actions: [{ label: 'Action', onClick: () => console.log('Action clicked') }],
100
+ };
101
+
102
+ export const ActionsAndDissmisable = Template.bind({});
103
+ ActionsAndDissmisable.args = {
104
+ actions: [{ label: 'Action', onClick: () => console.log('Action clicked') }],
105
+ onDismissClick: handleDismissClick,
106
+ };
107
+
108
+ export const Captionless = Template.bind({});
109
+ Captionless.args = {
110
+ caption: '',
111
+ };
112
+
113
+ export const Borderless = Template.bind({});
114
+ Borderless.args = {
115
+ borderless: true,
116
+ };