@granto-umbrella/umbrella-components 2.3.20 → 2.3.21
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/umbrella-components.es.js +228 -208
- package/dist/umbrella-components.umd.js +11 -11
- package/package.json +1 -1
- package/src/components/atoms/Pill/Pill.styles.ts +46 -0
- package/src/components/atoms/Pill/Pill.tsx +36 -0
- package/src/components/atoms/Pill/Pill.types.ts +18 -0
- package/src/styles/tokens/colors.ts +25 -3
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import {
|
|
3
|
+
semanticColors,
|
|
4
|
+
semanticSizes,
|
|
5
|
+
semanticRadius,
|
|
6
|
+
typographyTokens,
|
|
7
|
+
} from "../../../styles/tokens";
|
|
8
|
+
|
|
9
|
+
const pillVariants = {
|
|
10
|
+
tradicional: css`
|
|
11
|
+
background: ${semanticColors.info.surface.pills.tradicional};
|
|
12
|
+
color: ${semanticColors.info.text.pills.tradicional};
|
|
13
|
+
`,
|
|
14
|
+
supply: css`
|
|
15
|
+
background: ${semanticColors.warning.surface.pills.supply};
|
|
16
|
+
color: ${semanticColors.warning.text.pills.supply};
|
|
17
|
+
`,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const pillSizes = {
|
|
21
|
+
sm: css`
|
|
22
|
+
padding: ${semanticSizes.global.padding.xs} ${semanticSizes.global
|
|
23
|
+
.padding.sm};
|
|
24
|
+
font-size: ${typographyTokens.fontSizes.captionM};
|
|
25
|
+
`,
|
|
26
|
+
md: css`
|
|
27
|
+
padding: ${semanticSizes.global.padding.sm} ${semanticSizes.global
|
|
28
|
+
.padding.md};
|
|
29
|
+
font-size: ${typographyTokens.fontSizes.labelM};
|
|
30
|
+
`,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const StyledPill = styled.span<{
|
|
34
|
+
$size?: keyof typeof pillSizes;
|
|
35
|
+
$variant?: keyof typeof pillVariants;
|
|
36
|
+
$radius: keyof typeof semanticRadius.global.radius;
|
|
37
|
+
}>`
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: ${semanticSizes.global.gap.xs};
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
border-radius: ${semanticRadius.global.radius.full};
|
|
43
|
+
|
|
44
|
+
${({ $size = "md" }) => pillSizes[$size]}
|
|
45
|
+
${({ $variant = "tradicional" }) => pillVariants[$variant]}
|
|
46
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Pill.tsx
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { StyledPill } from "./Pill.styles";
|
|
5
|
+
import { PillProps } from "./Pill.types";
|
|
6
|
+
import * as Icons from "@phosphor-icons/react";
|
|
7
|
+
|
|
8
|
+
const Pill: React.FC<PillProps> = ({
|
|
9
|
+
children,
|
|
10
|
+
size,
|
|
11
|
+
variant = "supply",
|
|
12
|
+
icon,
|
|
13
|
+
onClose,
|
|
14
|
+
}) => {
|
|
15
|
+
// CORREÇÃO: Removemos o 'as keyof typeof Icons' pois o tipo já está correto.
|
|
16
|
+
const IconComponent =
|
|
17
|
+
icon && (Icons[icon] as React.ElementType);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<StyledPill $size={size} $variant={variant} $radius="full">
|
|
21
|
+
{IconComponent && (
|
|
22
|
+
<span className="icon">
|
|
23
|
+
<IconComponent size={16} />
|
|
24
|
+
</span>
|
|
25
|
+
)}
|
|
26
|
+
{children}
|
|
27
|
+
{onClose && (
|
|
28
|
+
<span className="close-icon" onClick={onClose}>
|
|
29
|
+
<Icons.X size={16} />
|
|
30
|
+
</span>
|
|
31
|
+
)}
|
|
32
|
+
</StyledPill>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default Pill;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import * as Icons from "@phosphor-icons/react";
|
|
5
|
+
|
|
6
|
+
export type IconName = keyof typeof Icons;
|
|
7
|
+
|
|
8
|
+
export interface PillProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
|
|
14
|
+
hasIcon?: boolean;
|
|
15
|
+
size?: "sm" | "md";
|
|
16
|
+
variant?: "tradicional" | "supply";
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
}
|
|
@@ -188,30 +188,46 @@ export const semanticColors = {
|
|
|
188
188
|
warning: {
|
|
189
189
|
surface: {
|
|
190
190
|
feedback: primitiveColors.yellow[100],
|
|
191
|
+
pills: {
|
|
192
|
+
supply: primitiveColors.orange[200],
|
|
193
|
+
},
|
|
191
194
|
},
|
|
192
195
|
text: {
|
|
193
196
|
feedback: {
|
|
194
197
|
strong: primitiveColors.yellow[1100],
|
|
195
198
|
},
|
|
199
|
+
pills: {
|
|
200
|
+
supply: primitiveColors.orange[1000],
|
|
201
|
+
},
|
|
196
202
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
},
|
|
204
|
+
border: {
|
|
205
|
+
feedback: primitiveColors.yellow[900],
|
|
200
206
|
},
|
|
201
207
|
info: {
|
|
202
208
|
surface: {
|
|
203
209
|
feedback: primitiveColors.blue[100],
|
|
210
|
+
pills: {
|
|
211
|
+
tradicional: primitiveColors.blue[100],
|
|
212
|
+
},
|
|
204
213
|
},
|
|
205
214
|
text: {
|
|
206
215
|
feedback: {
|
|
207
216
|
strong: primitiveColors.blue[1100],
|
|
208
217
|
},
|
|
218
|
+
pills: {
|
|
219
|
+
tradicional: primitiveColors.blue[1000],
|
|
220
|
+
},
|
|
209
221
|
},
|
|
210
222
|
border: {
|
|
211
223
|
feedback: primitiveColors.blue[900],
|
|
212
224
|
},
|
|
213
225
|
},
|
|
214
226
|
global: {
|
|
227
|
+
foreground: {
|
|
228
|
+
default: primitiveColors.gray[100],
|
|
229
|
+
},
|
|
230
|
+
|
|
215
231
|
surface: {
|
|
216
232
|
default: primitiveColors.base.white,
|
|
217
233
|
overlay: "rgba(0, 0, 0, 0.5)",
|
|
@@ -223,6 +239,12 @@ export const semanticColors = {
|
|
|
223
239
|
disabled: primitiveColors.red[100],
|
|
224
240
|
},
|
|
225
241
|
},
|
|
242
|
+
|
|
243
|
+
status: {
|
|
244
|
+
online: primitiveColors.green[600],
|
|
245
|
+
notification: primitiveColors.red[600],
|
|
246
|
+
offline: primitiveColors.gray[600],
|
|
247
|
+
},
|
|
226
248
|
text: {
|
|
227
249
|
default: {
|
|
228
250
|
enabled: primitiveColors.base.black,
|