@chotot/clad-ui 2.1.0 → 2.2.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/README.md +2 -2
- package/dist/components/Badge/Badge.d.ts +10 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +11 -6
- package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/components/Badge/Badge.stories.js +143 -124
- package/dist/components/Badge/Badge.styles.d.ts +1 -1
- package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
- package/dist/components/Badge/Badge.styles.js +67 -17
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +1 -0
- package/dist/components/Button/GhostButton.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.js +1 -0
- package/dist/components/Button/IconButton.d.ts.map +1 -1
- package/dist/components/Button/IconButton.js +1 -0
- package/dist/components/Pagination/PageItem.d.ts.map +1 -1
- package/dist/components/Pagination/PageItem.js +1 -0
- package/dist/storybook/Popover.js +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- badges -->
|
|
2
2
|
|
|
3
|
-
[<img src="https://img.shields.io/badge/clad--ui-2.1.0-FFBA00" alt="clad-ui npm version" />](
|
|
4
|
-
[<img src="https://img.shields.io/badge/@
|
|
3
|
+
[<img src="https://img.shields.io/badge/@chotot/clad--ui-2.1.0-FFBA00" alt="@chotot/clad-ui npm version" />](https://www.npmjs.com/package/@chotot/clad-ui)
|
|
4
|
+
[<img src="https://img.shields.io/badge/@chotot/charts-1.0.2-FFBA00" alt="@chotot/charts npm version" />](https://www.npmjs.com/package/@chotot/charts)
|
|
5
5
|
[<img src="https://img.shields.io/badge/react-%3E=16.8-0088CC" alt="React dependency version" />](https://github.com/facebook/react/)
|
|
6
6
|
[<img src="https://img.shields.io/badge/linaria-^4.2.10-DE2D68" alt="Linaria dependency version" />](https://github.com/callstack/linaria)
|
|
7
7
|
[<img src="https://img.shields.io/badge/storybook-7.6.20-FF4785" alt="Storybook dependency version" />](https://storybook.js.org/)
|
|
@@ -3,7 +3,7 @@ export interface BadgeProps {
|
|
|
3
3
|
/**
|
|
4
4
|
* Size of Badge
|
|
5
5
|
*/
|
|
6
|
-
size?: 'lg' | 'md' | 'sm';
|
|
6
|
+
size?: 'lg' | 'md' | 'sm' | 'dot';
|
|
7
7
|
/**
|
|
8
8
|
* Badge Label
|
|
9
9
|
*/
|
|
@@ -11,7 +11,11 @@ export interface BadgeProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* Badge Background Color
|
|
13
13
|
*/
|
|
14
|
-
backgroundColor?: '
|
|
14
|
+
backgroundColor?: 'error' | 'warning' | 'info' | 'success' | 'neutral';
|
|
15
|
+
/**
|
|
16
|
+
* Badge Variant
|
|
17
|
+
*/
|
|
18
|
+
variant?: 'solid' | 'tonal';
|
|
15
19
|
/**
|
|
16
20
|
* Badge Position
|
|
17
21
|
*/
|
|
@@ -28,6 +32,10 @@ export interface BadgeProps {
|
|
|
28
32
|
* z-index
|
|
29
33
|
*/
|
|
30
34
|
zIndex?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Badge Class Name
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* Badge Component for menus and notifications
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,CAAC,EACZ,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AAEH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAgG/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
|
-
import { badgeSizeSmallClass, badgeSizeLargeClass, badgeSizeMediumClass, StyledBadgeWrapper, StyledBadge, } from './Badge.styles';
|
|
3
|
+
import { badgeSizeSmallClass, badgeSizeLargeClass, badgeSizeMediumClass, StyledBadgeWrapper, StyledBadge, badgeSizeDotClass, } from './Badge.styles';
|
|
4
|
+
import cx from '../../utils/cx';
|
|
4
5
|
const { radii } = theme;
|
|
5
6
|
const { useMemo } = React;
|
|
6
7
|
/**
|
|
@@ -8,9 +9,9 @@ const { useMemo } = React;
|
|
|
8
9
|
*
|
|
9
10
|
* `✅ Stable`
|
|
10
11
|
*/
|
|
11
|
-
const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', backgroundColor = '
|
|
12
|
+
const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', backgroundColor = 'warning', variant = 'solid', position = 'topRight', zIndex = 1, borderRadius: borderRadiusProp = 'none', className = '', }) => {
|
|
12
13
|
const badgePosition = useMemo(() => {
|
|
13
|
-
const positionValue = { sm: '8px', md: '8px', lg: '10px' }[size] || '8px';
|
|
14
|
+
const positionValue = { dot: '1px', sm: '8px', md: '8px', lg: '10px' }[size] || '8px';
|
|
14
15
|
switch (position) {
|
|
15
16
|
// Keep legacy behavior for right position
|
|
16
17
|
case 'right':
|
|
@@ -62,6 +63,11 @@ const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', b
|
|
|
62
63
|
className: badgeSizeLargeClass,
|
|
63
64
|
borderRadius,
|
|
64
65
|
};
|
|
66
|
+
case 'dot':
|
|
67
|
+
return {
|
|
68
|
+
borderRadius,
|
|
69
|
+
className: badgeSizeDotClass,
|
|
70
|
+
};
|
|
65
71
|
default:
|
|
66
72
|
return {
|
|
67
73
|
className: '',
|
|
@@ -70,16 +76,15 @@ const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', b
|
|
|
70
76
|
}
|
|
71
77
|
}, [size, borderRadiusProp]);
|
|
72
78
|
const attrs = {
|
|
73
|
-
backgroundColor,
|
|
74
79
|
position,
|
|
75
80
|
badgeSizing,
|
|
76
81
|
badgePosition,
|
|
77
|
-
className: badgeSizing.className,
|
|
78
82
|
zIndex,
|
|
83
|
+
className: cx(badgeSizing.className, backgroundColor, variant, className),
|
|
79
84
|
};
|
|
80
85
|
return (<StyledBadgeWrapper>
|
|
81
86
|
<StyledBadge data-clad="Badge" {...attrs}>
|
|
82
|
-
{label}
|
|
87
|
+
{size !== 'dot' && label}
|
|
83
88
|
</StyledBadge>
|
|
84
89
|
{children}
|
|
85
90
|
</StyledBadgeWrapper>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.stories.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;CA4Bf,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,eAAO,MAAM,QAAQ;;CAiBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Badge.stories.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;CA4Bf,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,eAAO,MAAM,QAAQ;;CAiBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA+CxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAkKzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CAkC5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAwChC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { css } from '@linaria/core';
|
|
3
2
|
import theme from '@clad-ui/theme';
|
|
4
3
|
import Col from '../Grid/Col';
|
|
5
4
|
import Grid from '../Grid/Grid';
|
|
6
5
|
import Badge from './Badge';
|
|
7
6
|
import Button from '../Button/Button';
|
|
8
|
-
|
|
7
|
+
import Chat from '../../icons/Chat';
|
|
8
|
+
const { colors } = theme;
|
|
9
9
|
const badgeStory = {
|
|
10
10
|
title: 'Components/Badge',
|
|
11
11
|
component: Badge,
|
|
@@ -53,130 +53,163 @@ export const Overview = {
|
|
|
53
53
|
export const SizeVariants = {
|
|
54
54
|
render: () => (<Grid>
|
|
55
55
|
<Col>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</div>
|
|
56
|
+
<Badge size="lg" label="99+" position="topRight" borderRadius="pill" backgroundColor="error">
|
|
57
|
+
<Button color="tertiary" variant="outline">
|
|
58
|
+
Large (lg)
|
|
59
|
+
</Button>
|
|
60
|
+
</Badge>
|
|
62
61
|
</Col>
|
|
63
62
|
<Col>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</div>
|
|
63
|
+
<Badge size="md" label="9" position="topRight" borderRadius="pill" backgroundColor="error">
|
|
64
|
+
<Button color="tertiary" variant="outline">
|
|
65
|
+
Medium (md)
|
|
66
|
+
</Button>
|
|
67
|
+
</Badge>
|
|
70
68
|
</Col>
|
|
71
69
|
<Col>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</div>
|
|
70
|
+
<Badge size="sm" label="9" position="topRight" borderRadius="pill" backgroundColor="error">
|
|
71
|
+
<Button color="tertiary" variant="outline">
|
|
72
|
+
Small (sm)
|
|
73
|
+
</Button>
|
|
74
|
+
</Badge>
|
|
78
75
|
</Col>
|
|
76
|
+
|
|
79
77
|
<Col>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<Button color="tertiary"> lg Input</Button>
|
|
84
|
-
</Badge>
|
|
85
|
-
</div>
|
|
78
|
+
<Badge size="dot" borderRadius="circle" position="topRight" backgroundColor="error">
|
|
79
|
+
<Chat style={{ width: '20px', height: '20px' }}/>
|
|
80
|
+
</Badge>
|
|
86
81
|
</Col>
|
|
87
82
|
</Grid>),
|
|
88
83
|
parameters: {
|
|
89
84
|
docs: {
|
|
90
85
|
description: {
|
|
91
|
-
story: '
|
|
86
|
+
story: 'Badge supports 4 size variants: sm (small), md (medium), lg (large), and dot (notification indicator without label).',
|
|
92
87
|
},
|
|
93
88
|
},
|
|
94
89
|
},
|
|
95
90
|
};
|
|
96
91
|
export const ColorVariants = {
|
|
97
|
-
render: () => (
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
92
|
+
render: () => (<>
|
|
93
|
+
<div style={{ marginBottom: '32px' }}>
|
|
94
|
+
<h3 style={{ marginBottom: '16px', fontSize: '16px', fontWeight: '600' }}>
|
|
95
|
+
Solid Variant (Default)
|
|
96
|
+
</h3>
|
|
97
|
+
<Grid>
|
|
98
|
+
<Col>
|
|
99
|
+
<Badge size="sm" backgroundColor="error" label="99+" position="topRight" borderRadius="pill">
|
|
100
|
+
<Button color="tertiary" variant="outline">
|
|
101
|
+
Error
|
|
102
|
+
</Button>
|
|
103
|
+
</Badge>
|
|
104
|
+
</Col>
|
|
105
|
+
<Col>
|
|
106
|
+
<Badge size="sm" backgroundColor="info" label="99+" position="topRight" borderRadius="pill">
|
|
107
|
+
<Button color="tertiary" variant="outline">
|
|
108
|
+
Info
|
|
109
|
+
</Button>
|
|
110
|
+
</Badge>
|
|
111
|
+
</Col>
|
|
112
|
+
<Col>
|
|
113
|
+
<Badge size="sm" backgroundColor="success" label="99+" position="topRight" borderRadius="pill">
|
|
114
|
+
<Button color="tertiary" variant="outline">
|
|
115
|
+
Success
|
|
116
|
+
</Button>
|
|
117
|
+
</Badge>
|
|
118
|
+
</Col>
|
|
119
|
+
<Col>
|
|
120
|
+
<Badge size="sm" backgroundColor="neutral" label="99+" position="topRight" borderRadius="pill">
|
|
121
|
+
<Button color="tertiary" variant="outline">
|
|
122
|
+
Neutral
|
|
123
|
+
</Button>
|
|
124
|
+
</Badge>
|
|
125
|
+
</Col>
|
|
126
|
+
<Col>
|
|
127
|
+
<Badge size="sm" backgroundColor="warning" label="99+" position="topRight" borderRadius="pill">
|
|
128
|
+
<Button color="tertiary" variant="outline">
|
|
129
|
+
Warning
|
|
130
|
+
</Button>
|
|
131
|
+
</Badge>
|
|
132
|
+
</Col>
|
|
133
|
+
</Grid>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div>
|
|
137
|
+
<h3 style={{ marginBottom: '16px', fontSize: '16px', fontWeight: '600' }}>Tonal Variant</h3>
|
|
138
|
+
<Grid>
|
|
139
|
+
<Col>
|
|
140
|
+
<Badge size="sm" backgroundColor="error" variant="tonal" label="99+" position="topRight" borderRadius="pill">
|
|
141
|
+
<Button color="tertiary" variant="outline">
|
|
142
|
+
Error
|
|
143
|
+
</Button>
|
|
144
|
+
</Badge>
|
|
145
|
+
</Col>
|
|
146
|
+
<Col>
|
|
147
|
+
<Badge size="sm" backgroundColor="info" variant="tonal" label="99+" position="topRight" borderRadius="pill">
|
|
148
|
+
<Button color="tertiary" variant="outline">
|
|
149
|
+
Info
|
|
150
|
+
</Button>
|
|
151
|
+
</Badge>
|
|
152
|
+
</Col>
|
|
153
|
+
<Col>
|
|
154
|
+
<Badge size="sm" backgroundColor="success" variant="tonal" label="99+" position="topRight" borderRadius="pill">
|
|
155
|
+
<Button color="tertiary" variant="outline">
|
|
156
|
+
Success
|
|
157
|
+
</Button>
|
|
158
|
+
</Badge>
|
|
159
|
+
</Col>
|
|
160
|
+
<Col>
|
|
161
|
+
<Badge size="sm" backgroundColor="neutral" variant="tonal" label="99+" position="topRight" borderRadius="pill">
|
|
162
|
+
<Button color="tertiary" variant="outline">
|
|
163
|
+
Neutral
|
|
164
|
+
</Button>
|
|
165
|
+
</Badge>
|
|
166
|
+
</Col>
|
|
167
|
+
<Col>
|
|
168
|
+
<Badge size="sm" backgroundColor="warning" variant="tonal" label="99+" position="topRight" borderRadius="pill">
|
|
169
|
+
<Button color="tertiary" variant="outline">
|
|
170
|
+
Warning
|
|
171
|
+
</Button>
|
|
172
|
+
</Badge>
|
|
173
|
+
</Col>
|
|
174
|
+
</Grid>
|
|
175
|
+
</div>
|
|
176
|
+
</>),
|
|
115
177
|
parameters: {
|
|
116
178
|
docs: {
|
|
117
179
|
description: {
|
|
118
|
-
story: '
|
|
180
|
+
story: 'Badge supports solid (default) and tonal variants across all color options: error, info, success, neutral, and warning.',
|
|
119
181
|
},
|
|
120
182
|
},
|
|
121
183
|
},
|
|
122
184
|
};
|
|
123
|
-
const demoWrapperClass = css `
|
|
124
|
-
display: flex;
|
|
125
|
-
flex-direction: column;
|
|
126
|
-
gap: ${space.sm};
|
|
127
|
-
`;
|
|
128
|
-
const demoBorderedClass = css `
|
|
129
|
-
display: flex;
|
|
130
|
-
flex-direction: column;
|
|
131
|
-
border: 1px solid ${colors.borderRegular};
|
|
132
|
-
padding: 8px;
|
|
133
|
-
`;
|
|
134
|
-
const titleClass = css `
|
|
135
|
-
font-size: ${fontSizes.body};
|
|
136
|
-
line-height: ${space.md};
|
|
137
|
-
`;
|
|
138
|
-
const descriptionClass = css `
|
|
139
|
-
font-size: ${fontSizes.xs};
|
|
140
|
-
line-height: ${space.md};
|
|
141
|
-
color: ${colors.textTertiary};
|
|
142
|
-
`;
|
|
143
185
|
export const PositionVariants = {
|
|
144
186
|
render: () => (<Grid>
|
|
145
187
|
<Col>
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</div>
|
|
188
|
+
<Badge position="right" label="New">
|
|
189
|
+
<Button color="tertiary" variant="outline">
|
|
190
|
+
Right
|
|
191
|
+
</Button>
|
|
192
|
+
</Badge>
|
|
152
193
|
</Col>
|
|
153
|
-
|
|
154
194
|
<Col>
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
</div>
|
|
161
|
-
</Badge>
|
|
162
|
-
</div>
|
|
195
|
+
<Badge position="topRight" label="99+" borderRadius="pill">
|
|
196
|
+
<Button color="tertiary" variant="outline">
|
|
197
|
+
Top Right
|
|
198
|
+
</Button>
|
|
199
|
+
</Badge>
|
|
163
200
|
</Col>
|
|
164
|
-
|
|
165
201
|
<Col>
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
</div>
|
|
172
|
-
</Badge>
|
|
173
|
-
</div>
|
|
202
|
+
<Badge position="topLeft" label="99+" borderRadius="pill">
|
|
203
|
+
<Button color="tertiary" variant="outline">
|
|
204
|
+
Top Left
|
|
205
|
+
</Button>
|
|
206
|
+
</Badge>
|
|
174
207
|
</Col>
|
|
175
208
|
</Grid>),
|
|
176
209
|
parameters: {
|
|
177
210
|
docs: {
|
|
178
211
|
description: {
|
|
179
|
-
story: '
|
|
212
|
+
story: 'Badge position: right (inline), topRight, and topLeft (overlay).',
|
|
180
213
|
},
|
|
181
214
|
},
|
|
182
215
|
},
|
|
@@ -184,50 +217,36 @@ export const PositionVariants = {
|
|
|
184
217
|
export const BorderRadiusVariants = {
|
|
185
218
|
render: () => (<Grid>
|
|
186
219
|
<Col>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
</Button>
|
|
193
|
-
</Badge>
|
|
194
|
-
</div>
|
|
220
|
+
<Badge label="99+" position="topRight" backgroundColor="error">
|
|
221
|
+
<Button color="tertiary" variant="outline">
|
|
222
|
+
Default
|
|
223
|
+
</Button>
|
|
224
|
+
</Badge>
|
|
195
225
|
</Col>
|
|
196
226
|
<Col>
|
|
197
|
-
borderRadius
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
</Button>
|
|
203
|
-
</Badge>
|
|
204
|
-
</div>
|
|
227
|
+
<Badge borderRadius="sm" label="99+" position="topRight" backgroundColor="error">
|
|
228
|
+
<Button color="tertiary" variant="outline">
|
|
229
|
+
Small
|
|
230
|
+
</Button>
|
|
231
|
+
</Badge>
|
|
205
232
|
</Col>
|
|
206
233
|
<Col>
|
|
207
|
-
borderRadius
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</Button>
|
|
213
|
-
</Badge>
|
|
214
|
-
</div>
|
|
234
|
+
<Badge borderRadius="pill" label="99+" position="topRight" backgroundColor="error">
|
|
235
|
+
<Button color="tertiary" variant="outline">
|
|
236
|
+
Pill
|
|
237
|
+
</Button>
|
|
238
|
+
</Badge>
|
|
215
239
|
</Col>
|
|
216
240
|
<Col>
|
|
217
|
-
borderRadius
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<Button color="tertiary" variant="outline">
|
|
221
|
-
Border Radius: xl
|
|
222
|
-
</Button>
|
|
223
|
-
</Badge>
|
|
224
|
-
</div>
|
|
241
|
+
<Badge borderRadius="circle" size="dot" position="topRight" backgroundColor="error">
|
|
242
|
+
<Chat style={{ width: '20px', height: '20px' }}/>
|
|
243
|
+
</Badge>
|
|
225
244
|
</Col>
|
|
226
245
|
</Grid>),
|
|
227
246
|
parameters: {
|
|
228
247
|
docs: {
|
|
229
248
|
description: {
|
|
230
|
-
story: '
|
|
249
|
+
story: 'Typical border radius options: sm, xl, pill (fully rounded), and circle (for dots). Other options available: none, xs, md, lg.',
|
|
231
250
|
},
|
|
232
251
|
},
|
|
233
252
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const badgeSizeSmallClass: import("@linaria/core").LinariaClassName;
|
|
2
2
|
export declare const badgeSizeMediumClass: import("@linaria/core").LinariaClassName;
|
|
3
3
|
export declare const badgeSizeLargeClass: import("@linaria/core").LinariaClassName;
|
|
4
|
+
export declare const badgeSizeDotClass: import("@linaria/core").LinariaClassName;
|
|
4
5
|
export declare const StyledBadgeWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
5
6
|
as?: import("react").ElementType;
|
|
6
7
|
}>;
|
|
@@ -9,7 +10,6 @@ export declare const StyledBadgeWrapper: import("@linaria/react").StyledMeta & i
|
|
|
9
10
|
*/
|
|
10
11
|
export declare const StyledBadge: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
11
12
|
zIndex: number;
|
|
12
|
-
backgroundColor: string;
|
|
13
13
|
badgePosition: {
|
|
14
14
|
top: string;
|
|
15
15
|
left: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.styles.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Badge.styles.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,0CAS/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,0CAShC,CAAC;AACF,eAAO,MAAM,mBAAmB,0CAS/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,0CAQ7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;EAI9B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,WAAW;YACd,MAAM;mBACC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB;iBACY;QACX,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB;;;EAsDF,CAAC"}
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import { css } from '@linaria/core';
|
|
2
2
|
import { styled } from '@linaria/react';
|
|
3
3
|
import theme from '@clad-ui/theme';
|
|
4
|
-
const { colors, typo, space } = theme;
|
|
4
|
+
const { colors, typo, space, radii } = theme;
|
|
5
5
|
// Keep legacy behavior for sm size
|
|
6
6
|
export const badgeSizeSmallClass = css `
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
&& {
|
|
8
|
+
padding: 0 ${space.xxs};
|
|
9
|
+
height: ${space.md};
|
|
10
|
+
min-width: ${space.md};
|
|
11
|
+
min-height: ${space.md};
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
${typo.body.annotation};
|
|
14
|
+
}
|
|
13
15
|
`;
|
|
14
16
|
export const badgeSizeMediumClass = css `
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
&& {
|
|
18
|
+
padding: 0 ${space.xxs};
|
|
19
|
+
height: ${space.mdl};
|
|
20
|
+
min-width: ${space.mdl};
|
|
21
|
+
min-height: ${space.mdl};
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
${typo.label.annotation};
|
|
24
|
+
}
|
|
21
25
|
`;
|
|
22
26
|
export const badgeSizeLargeClass = css `
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
&& {
|
|
28
|
+
padding: 0 6px;
|
|
29
|
+
height: ${space.lg};
|
|
30
|
+
min-width: ${space.lg};
|
|
31
|
+
min-height: ${space.lg};
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
${typo.label.caption};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
export const badgeSizeDotClass = css `
|
|
37
|
+
&& {
|
|
38
|
+
width: 6px;
|
|
39
|
+
height: 6px;
|
|
40
|
+
border-radius: ${radii.circle};
|
|
41
|
+
box-sizing: content-box;
|
|
42
|
+
border-width: 1px;
|
|
43
|
+
}
|
|
29
44
|
`;
|
|
30
45
|
export const StyledBadgeWrapper = styled.div `
|
|
31
46
|
position: relative;
|
|
@@ -47,10 +62,45 @@ export const StyledBadge = styled.div `
|
|
|
47
62
|
z-index: ${({ zIndex }) => zIndex};
|
|
48
63
|
border: 2px solid ${colors.borderBlank};
|
|
49
64
|
color: ${colors.textBlank};
|
|
50
|
-
background-color: ${({ backgroundColor }) => colors[backgroundColor]};
|
|
51
65
|
top: ${({ badgePosition }) => badgePosition.top};
|
|
52
66
|
left: ${({ badgePosition }) => badgePosition.left};
|
|
53
67
|
right: ${({ badgePosition }) => badgePosition.right};
|
|
54
68
|
transform: ${({ badgePosition }) => badgePosition.transform};
|
|
55
69
|
border-radius: ${({ badgeSizing }) => badgeSizing.borderRadius};
|
|
70
|
+
|
|
71
|
+
&.error {
|
|
72
|
+
background-color: ${colors.backgroundError};
|
|
73
|
+
&.tonal {
|
|
74
|
+
background-color: ${colors.backgroundErrorLight};
|
|
75
|
+
color: ${colors.textError};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
&.warning {
|
|
79
|
+
background-color: ${colors.backgroundWarning};
|
|
80
|
+
&.tonal {
|
|
81
|
+
background-color: ${colors.backgroundWarningLight};
|
|
82
|
+
color: ${colors.textWarning};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
&.info {
|
|
86
|
+
background-color: ${colors.backgroundInfo};
|
|
87
|
+
&.tonal {
|
|
88
|
+
background-color: ${colors.backgroundInfoLight};
|
|
89
|
+
color: ${colors.textInfo};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
&.success {
|
|
93
|
+
background-color: ${colors.backgroundSuccess};
|
|
94
|
+
&.tonal {
|
|
95
|
+
background-color: ${colors.backgroundSuccessLight};
|
|
96
|
+
color: ${colors.textSuccess};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
&.neutral {
|
|
100
|
+
background-color: ${colors.backgroundInverted};
|
|
101
|
+
&.tonal {
|
|
102
|
+
background-color: ${colors.backgroundTertiary};
|
|
103
|
+
color: ${colors.textSecondary};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
56
106
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIpF;;GAEG;AACH,KAAK,qBAAqB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M,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,GAAG,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AAEH,eAAO,MAAM,MAAM,qFAsCjB,CAAC;
|
|
1
|
+
{"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,GAAG,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AAEH,eAAO,MAAM,MAAM,qFAsCjB,CAAC;AAIH,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;CAAG;AAEjF;;;;GAIG;AAEH,QAAA,MAAM,UAAU,yFAEd,CAAC;
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;CAAG;AAEjF;;;;GAIG;AAEH,QAAA,MAAM,UAAU,yFAEd,CAAC;AAIH,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageItem.d.ts","sourceRoot":"","sources":["../../../components/Pagination/PageItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,WAAW,aAAc,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,QAAQ,uFAWZ,CAAC;
|
|
1
|
+
{"version":3,"file":"PageItem.d.ts","sourceRoot":"","sources":["../../../components/Pagination/PageItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,WAAW,aAAc,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,QAAQ,uFAWZ,CAAC;AAIH,eAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chotot/clad-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Classified Ads group (Carousell, Chotot, Mudah, Onekyat) design system.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=18"
|
|
91
91
|
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"access": "public",
|
|
94
|
+
"registry": "https://registry.npmjs.org"
|
|
95
|
+
},
|
|
92
96
|
"scripts": {
|
|
93
97
|
"build": "tsc",
|
|
94
98
|
"build-brand": "pnpm dlx @svgr/cli --template scripts/template-svg-icon.js --index-template scripts/template-icons-index.js --svg-props fill=none --replace-attr-values '#222=currentColor' -d brand/ assets/brand/",
|