@apify/ui-library 1.84.3 → 1.86.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/dist/src/components/rating.d.ts +4 -0
- package/dist/src/components/rating.d.ts.map +1 -1
- package/dist/src/components/rating.js +4 -0
- package/dist/src/components/rating.js.map +1 -1
- package/dist/src/design_system/colors/colors.stories.d.ts +6 -0
- package/dist/src/design_system/colors/colors.stories.d.ts.map +1 -0
- package/dist/src/design_system/colors/colors.stories.js +17 -0
- package/dist/src/design_system/colors/colors.stories.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/components/badge.stories.jsx +104 -0
- package/src/components/button.stories.jsx +126 -0
- package/src/components/rating.tsx +16 -0
- package/src/design_system/colors/colors.stories.tsx +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.86.0",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"It's not nice, but helps us to get around the problem of multiple react instances."
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@apify/ui-icons": "^1.
|
|
29
|
+
"@apify/ui-icons": "^1.15.0",
|
|
30
30
|
"@floating-ui/react": "^0.26.2",
|
|
31
31
|
"@react-hook/resize-observer": "^2.0.2",
|
|
32
32
|
"clsx": "^2.0.0",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"styled-components": "^5.3.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@storybook/react-vite": "^9.0.16",
|
|
55
56
|
"@types/lodash": "^4.14.200",
|
|
56
57
|
"@types/node": "^22.10.5",
|
|
57
58
|
"@types/react": "^18.2.74",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"src",
|
|
66
67
|
"style"
|
|
67
68
|
],
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e2a1096a40a3aad2fabf49fb184aa7ec366aa4c1"
|
|
69
70
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { PeopleIcon } from '@apify/ui-icons';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { Badge, BADGE_SIZES, BADGE_VARIANTS } from './badge';
|
|
6
|
+
import { SHARED_TEXT_TYPES } from './text';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'UI-Library/Badge',
|
|
10
|
+
component: Badge,
|
|
11
|
+
parameters: {
|
|
12
|
+
design: {
|
|
13
|
+
type: 'figma',
|
|
14
|
+
url: 'https://www.figma.com/design/duSsGnk84UMYav8mg8QNgR/Shared-library?node-id=4253-5781&t=6aCmGWZ0tbFpElNN-0',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Table = styled.table`
|
|
20
|
+
td {
|
|
21
|
+
padding: 8px
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const Default = () => {
|
|
26
|
+
return (
|
|
27
|
+
<Table>
|
|
28
|
+
<tbody>
|
|
29
|
+
{BADGE_VARIANTS.map((variant) => <tr key={variant}>
|
|
30
|
+
{BADGE_SIZES.map((size) => {
|
|
31
|
+
return (
|
|
32
|
+
<React.Fragment key={size}>
|
|
33
|
+
<td>
|
|
34
|
+
<Badge
|
|
35
|
+
size={size}
|
|
36
|
+
variant={variant}
|
|
37
|
+
LeadingIcon={PeopleIcon}
|
|
38
|
+
>
|
|
39
|
+
Badge
|
|
40
|
+
</Badge>
|
|
41
|
+
</td>
|
|
42
|
+
<td>
|
|
43
|
+
<Badge
|
|
44
|
+
size={size}
|
|
45
|
+
type="code"
|
|
46
|
+
variant={variant}
|
|
47
|
+
LeadingIcon={PeopleIcon}
|
|
48
|
+
>
|
|
49
|
+
Badge
|
|
50
|
+
</Badge>
|
|
51
|
+
</td>
|
|
52
|
+
</React.Fragment>
|
|
53
|
+
);
|
|
54
|
+
})}
|
|
55
|
+
</tr>,
|
|
56
|
+
)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</Table>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Playground = ({ size, LeadingIcon, ...props }) => {
|
|
63
|
+
return (
|
|
64
|
+
<Badge
|
|
65
|
+
size={size}
|
|
66
|
+
LeadingIcon={LeadingIcon ? PeopleIcon : undefined}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
Playground.propTypes = {
|
|
73
|
+
size: PropTypes.string,
|
|
74
|
+
LeadingIcon: PropTypes.bool,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Playground.args = {
|
|
78
|
+
size: 'small',
|
|
79
|
+
type: 'body',
|
|
80
|
+
variant: 'neutral',
|
|
81
|
+
children: 'Badge',
|
|
82
|
+
LeadingIcon: false,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Playground.argTypes = {
|
|
86
|
+
size: {
|
|
87
|
+
options: BADGE_SIZES,
|
|
88
|
+
control: 'select',
|
|
89
|
+
},
|
|
90
|
+
type: {
|
|
91
|
+
options: SHARED_TEXT_TYPES,
|
|
92
|
+
control: 'select',
|
|
93
|
+
},
|
|
94
|
+
variant: {
|
|
95
|
+
options: BADGE_VARIANTS,
|
|
96
|
+
control: 'select',
|
|
97
|
+
},
|
|
98
|
+
children: {
|
|
99
|
+
control: 'text',
|
|
100
|
+
},
|
|
101
|
+
LeadingIcon: {
|
|
102
|
+
control: 'boolean',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { X16 } from '@apify/icons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Button } from './button';
|
|
5
|
+
import { theme } from '../design_system/theme';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'UI-Library/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
design: {
|
|
12
|
+
type: 'figma',
|
|
13
|
+
url: 'https://www.figma.com/design/yftmrF413idIDbu0OcjlAQ/%F0%9F%8E%AE-Console-library?node-id=0-1',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Wrapper = styled.div`
|
|
19
|
+
background-color: ${theme.color.neutral.background};
|
|
20
|
+
padding: 2rem;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
gap: 8px;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const TwoColumns = styled.div`
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: auto auto;
|
|
30
|
+
gap: 40px;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const ButtonGrid = styled.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
margin-bottom: 16px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const ButtonSection = ({
|
|
40
|
+
...props
|
|
41
|
+
}) => {
|
|
42
|
+
return (
|
|
43
|
+
<Wrapper>
|
|
44
|
+
<ButtonGrid>
|
|
45
|
+
<Button {...props} variant='primary'>Primary</Button>
|
|
46
|
+
<Button {...props} variant='secondary'>Secondary</Button>
|
|
47
|
+
<Button {...props} variant='tertiary'>Tertiary</Button>
|
|
48
|
+
<Button {...props} disabled>Disabled</Button>
|
|
49
|
+
</ButtonGrid>
|
|
50
|
+
|
|
51
|
+
<h6>With leading icon</h6>
|
|
52
|
+
<ButtonGrid>
|
|
53
|
+
<Button {...props} LeftIcon={X16} variant='primary'>Primary</Button>
|
|
54
|
+
<Button {...props} LeftIcon={X16} variant='secondary'>Secondary</Button>
|
|
55
|
+
<Button {...props} LeftIcon={X16} variant='tertiary'>Tertiary</Button>
|
|
56
|
+
<Button {...props} LeftIcon={X16} disabled>Disabled</Button>
|
|
57
|
+
</ButtonGrid>
|
|
58
|
+
|
|
59
|
+
<h6>With trailing icon</h6>
|
|
60
|
+
<ButtonGrid>
|
|
61
|
+
<Button {...props} RightIcon={X16} variant='primary'>Primary</Button>
|
|
62
|
+
<Button {...props} RightIcon={X16} variant='secondary'>Secondary</Button>
|
|
63
|
+
<Button {...props} RightIcon={X16} variant='tertiary'>Tertiary</Button>
|
|
64
|
+
<Button {...props} RightIcon={X16} disabled>Disabled</Button>
|
|
65
|
+
</ButtonGrid>
|
|
66
|
+
|
|
67
|
+
<h6>With both icons</h6>
|
|
68
|
+
<ButtonGrid>
|
|
69
|
+
<Button
|
|
70
|
+
{...props}
|
|
71
|
+
RightIcon={X16}
|
|
72
|
+
LeftIcon={X16}
|
|
73
|
+
variant='primary'
|
|
74
|
+
>
|
|
75
|
+
Primary test
|
|
76
|
+
</Button>
|
|
77
|
+
<Button
|
|
78
|
+
{...props}
|
|
79
|
+
RightIcon={X16}
|
|
80
|
+
LeftIcon={X16}
|
|
81
|
+
variant='secondary'
|
|
82
|
+
>
|
|
83
|
+
Secondary
|
|
84
|
+
</Button>
|
|
85
|
+
<Button
|
|
86
|
+
{...props}
|
|
87
|
+
RightIcon={X16}
|
|
88
|
+
LeftIcon={X16}
|
|
89
|
+
variant='tertiary'
|
|
90
|
+
>
|
|
91
|
+
Tertiary
|
|
92
|
+
</Button>
|
|
93
|
+
<Button
|
|
94
|
+
{...props}
|
|
95
|
+
RightIcon={X16}
|
|
96
|
+
LeftIcon={X16}
|
|
97
|
+
disabled
|
|
98
|
+
>
|
|
99
|
+
Disabled
|
|
100
|
+
</Button>
|
|
101
|
+
</ButtonGrid>
|
|
102
|
+
</Wrapper>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Default = () => {
|
|
107
|
+
return (
|
|
108
|
+
<Wrapper>
|
|
109
|
+
<h4>Primary</h4>
|
|
110
|
+
<TwoColumns>
|
|
111
|
+
<ButtonSection color='default' />
|
|
112
|
+
<ButtonSection color='default' size='small' />
|
|
113
|
+
</TwoColumns>
|
|
114
|
+
<h4>Success</h4>
|
|
115
|
+
<TwoColumns>
|
|
116
|
+
<ButtonSection color='success' />
|
|
117
|
+
<ButtonSection color='success' size='small' />
|
|
118
|
+
</TwoColumns>
|
|
119
|
+
<h4>Danger</h4>
|
|
120
|
+
<TwoColumns>
|
|
121
|
+
<ButtonSection color='danger' />
|
|
122
|
+
<ButtonSection color='danger' size='small' />
|
|
123
|
+
</TwoColumns>
|
|
124
|
+
</Wrapper>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
@@ -17,6 +17,7 @@ type RatingStatsProps = {
|
|
|
17
17
|
|
|
18
18
|
const StyledRating = styled(Box)`
|
|
19
19
|
display: flex;
|
|
20
|
+
align-items: center;
|
|
20
21
|
`;
|
|
21
22
|
|
|
22
23
|
const StyledRatingStats = styled(Box)`
|
|
@@ -54,6 +55,21 @@ const StyledRatingBar = styled(Box)<{ $widthPercent: number }>`
|
|
|
54
55
|
}
|
|
55
56
|
`;
|
|
56
57
|
|
|
58
|
+
type SingleStarRatingProps = BoxProps & {
|
|
59
|
+
color?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const SingleStarRating: FC<SingleStarRatingProps> = ({
|
|
63
|
+
color = theme.color.neutral.icon,
|
|
64
|
+
...rest
|
|
65
|
+
}) => {
|
|
66
|
+
return (
|
|
67
|
+
<StyledRating {...rest}>
|
|
68
|
+
<StarFullIcon size="12" color={color} />
|
|
69
|
+
</StyledRating>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
57
73
|
// 0 is only for empty rating - we don't display any stars filled
|
|
58
74
|
type RatingProps = BoxProps & {
|
|
59
75
|
rating: number | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-default-export
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Design Tokens/Colors',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Grid = styled.div`
|
|
9
|
+
padding: 32px;
|
|
10
|
+
width: 100%;
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-columns: repeat( auto-fit, minmax(100px, 1fr) );
|
|
13
|
+
gap: 32px 16px;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const Default = () => {
|
|
17
|
+
return (
|
|
18
|
+
<Grid>
|
|
19
|
+
TODO COLORS PALETTE
|
|
20
|
+
</Grid>
|
|
21
|
+
);
|
|
22
|
+
};
|