@fluidattacks/design 8.5.0 → 8.7.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/components/button/index.stories.d.ts +2 -1
- package/dist/components/button/styles.js +56 -39
- package/dist/components/button/types.d.ts +1 -1
- package/dist/components/rank-position/index.js +19 -36
- package/dist/components/rank-position/index.stories.d.ts +3 -2
- package/dist/components/rank-position/index.test.d.ts +1 -0
- package/dist/components/rank-position/types.d.ts +16 -3
- package/package.json +1 -1
|
@@ -12,5 +12,6 @@ declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import(
|
|
|
12
12
|
declare const Secondary: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<IButtonStoryProps>>;
|
|
13
13
|
declare const Tertiary: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<IButtonStoryProps>>;
|
|
14
14
|
declare const Ghost: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<IButtonStoryProps>>;
|
|
15
|
-
|
|
15
|
+
declare const TextLink: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<IButtonStoryProps>>;
|
|
16
|
+
export { Default, Secondary, Tertiary, Ghost, TextLink };
|
|
16
17
|
export default config;
|
|
@@ -2,99 +2,116 @@ import { styled as n } from "styled-components";
|
|
|
2
2
|
import { variantBuilder as t } from "../@core/variants/utils.js";
|
|
3
3
|
import { BaseButtonComponent as i } from "../@core/styles.js";
|
|
4
4
|
const { getVariant: l } = t(
|
|
5
|
-
(
|
|
5
|
+
(r) => ({
|
|
6
6
|
ghost: `
|
|
7
7
|
background: transparent;
|
|
8
8
|
border: none;
|
|
9
|
-
color: ${
|
|
10
|
-
--btn-padding-x: ${
|
|
11
|
-
--btn-padding-y: ${
|
|
12
|
-
--btn-spacing: ${
|
|
9
|
+
color: ${r.palette.gray[800]};
|
|
10
|
+
--btn-padding-x: ${r.spacing[0.5]};
|
|
11
|
+
--btn-padding-y: ${r.spacing[0.625]};
|
|
12
|
+
--btn-spacing: ${r.spacing[0.25]};
|
|
13
13
|
|
|
14
14
|
&:disabled {
|
|
15
|
-
color: ${
|
|
15
|
+
color: ${r.palette.gray[400]};
|
|
16
16
|
cursor: not-allowed;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
&:hover:not([disabled]) {
|
|
20
|
-
background-color: ${
|
|
21
|
-
color: ${
|
|
20
|
+
background-color: ${r.palette.gray[100]};
|
|
21
|
+
color: ${r.palette.gray[800]};
|
|
22
22
|
}
|
|
23
23
|
`,
|
|
24
24
|
link: `
|
|
25
25
|
--btn-padding-x: 0;
|
|
26
26
|
--btn-padding-y: 0;
|
|
27
|
-
color: ${
|
|
27
|
+
color: ${r.palette.gray[800]};
|
|
28
28
|
|
|
29
29
|
&:hover {
|
|
30
|
-
color: ${
|
|
30
|
+
color: ${r.palette.gray[500]};
|
|
31
31
|
}
|
|
32
32
|
`,
|
|
33
33
|
primary: `
|
|
34
|
-
background: ${
|
|
34
|
+
background: ${r.palette.primary[500]};
|
|
35
35
|
border: none;
|
|
36
|
-
color: ${
|
|
37
|
-
--btn-spacing: ${
|
|
36
|
+
color: ${r.palette.white};
|
|
37
|
+
--btn-spacing: ${r.spacing[0.25]};
|
|
38
38
|
|
|
39
39
|
&:disabled {
|
|
40
|
-
background: ${
|
|
41
|
-
color: ${
|
|
40
|
+
background: ${r.palette.gray[200]};
|
|
41
|
+
color: ${r.palette.gray[400]};
|
|
42
42
|
cursor: not-allowed;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&:hover:not([disabled]) {
|
|
46
|
-
background-color: ${
|
|
47
|
-
color: ${
|
|
46
|
+
background-color: ${r.palette.primary[700]};
|
|
47
|
+
color: ${r.palette.white};
|
|
48
48
|
}
|
|
49
49
|
`,
|
|
50
50
|
secondary: `
|
|
51
|
-
background: ${
|
|
51
|
+
background: ${r.palette.gray[800]};
|
|
52
52
|
border: none;
|
|
53
|
-
color: ${
|
|
54
|
-
--btn-spacing: ${
|
|
53
|
+
color: ${r.palette.white};
|
|
54
|
+
--btn-spacing: ${r.spacing[0.25]};
|
|
55
55
|
|
|
56
56
|
&:disabled {
|
|
57
|
-
background: ${
|
|
58
|
-
color: ${
|
|
57
|
+
background: ${r.palette.gray[200]};
|
|
58
|
+
color: ${r.palette.gray[400]};
|
|
59
59
|
cursor: not-allowed;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&:hover:not([disabled]) {
|
|
63
|
-
background-color: ${
|
|
64
|
-
color: ${
|
|
63
|
+
background-color: ${r.palette.gray[600]};
|
|
64
|
+
color: ${r.palette.white};
|
|
65
65
|
}
|
|
66
66
|
`,
|
|
67
67
|
tertiary: `
|
|
68
68
|
background: transparent;
|
|
69
|
-
border: 1px solid ${
|
|
70
|
-
color: ${
|
|
71
|
-
--btn-spacing: ${
|
|
69
|
+
border: 1px solid ${r.palette.primary[500]};
|
|
70
|
+
color: ${r.palette.primary[500]};
|
|
71
|
+
--btn-spacing: ${r.spacing[0.25]};
|
|
72
72
|
|
|
73
73
|
&:disabled {
|
|
74
74
|
background: transparent;
|
|
75
|
-
border: 1px solid ${
|
|
76
|
-
color: ${
|
|
75
|
+
border: 1px solid ${r.palette.gray[200]};
|
|
76
|
+
color: ${r.palette.gray[300]};
|
|
77
77
|
cursor: not-allowed;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
&:hover:not([disabled]) {
|
|
81
|
-
background-color: ${
|
|
82
|
-
color: ${
|
|
81
|
+
background-color: ${r.palette.primary[500]};
|
|
82
|
+
color: ${r.palette.white};
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
textLink: `
|
|
86
|
+
background: transparent;
|
|
87
|
+
border: none;
|
|
88
|
+
color: ${r.palette.primary[500]};
|
|
89
|
+
--btn-padding-x: 0;
|
|
90
|
+
--btn-padding-y: 0;
|
|
91
|
+
|
|
92
|
+
&:disabled {
|
|
93
|
+
color: ${r.palette.gray[300]};
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover:not([disabled]) {
|
|
98
|
+
color: ${r.palette.primary[400]};
|
|
99
|
+
text-decoration: underline;
|
|
83
100
|
}
|
|
84
101
|
`
|
|
85
102
|
})
|
|
86
103
|
), c = n(i)`
|
|
87
|
-
${({ theme:
|
|
104
|
+
${({ theme: r, justify: o, $variant: a }) => `
|
|
88
105
|
align-items: center;
|
|
89
106
|
border-radius: var(--btn-spacing);
|
|
90
107
|
cursor: pointer;
|
|
91
108
|
display: inline-flex;
|
|
92
|
-
font-family: ${
|
|
93
|
-
font-size: ${
|
|
94
|
-
font-weight: ${
|
|
109
|
+
font-family: ${r.typography.type.primary};
|
|
110
|
+
font-size: ${r.typography.text.md};
|
|
111
|
+
font-weight: ${r.typography.weight.regular};
|
|
95
112
|
gap: var(--btn-spacing);
|
|
96
113
|
justify-content: ${o ?? "center"};
|
|
97
|
-
line-height: ${
|
|
114
|
+
line-height: ${r.spacing[1.25]};
|
|
98
115
|
padding: var(--btn-padding-y) var(--btn-padding-x);
|
|
99
116
|
position: relative;
|
|
100
117
|
text-align: start;
|
|
@@ -105,11 +122,11 @@ const { getVariant: l } = t(
|
|
|
105
122
|
text-decoration: underline;
|
|
106
123
|
}
|
|
107
124
|
|
|
108
|
-
@media screen and (max-width: ${
|
|
109
|
-
${
|
|
125
|
+
@media screen and (max-width: ${r.breakpoints.mobile}) {
|
|
126
|
+
${a === "link" || a === "textLink" ? "" : `--btn-padding-y: ${r.spacing[1]}`};
|
|
110
127
|
}
|
|
111
128
|
|
|
112
|
-
${l(
|
|
129
|
+
${l(r, a ?? "primary")}
|
|
113
130
|
`}
|
|
114
131
|
`;
|
|
115
132
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { IBorderModifiable, IDisplayModifiable, IIconModifiable, IMarginModifiable, IPaddingModifiable } from '../@core';
|
|
3
3
|
import { TPlace } from '../tooltip/types';
|
|
4
|
-
type TVariant = "primary" | "secondary" | "tertiary" | "ghost" | "link";
|
|
4
|
+
type TVariant = "primary" | "secondary" | "tertiary" | "ghost" | "link" | "textLink";
|
|
5
5
|
/**
|
|
6
6
|
* Button component props.
|
|
7
7
|
* @interface IButtonProps
|
|
@@ -1,42 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { RankPositionIcon as
|
|
4
|
-
import { Container as
|
|
5
|
-
import { Heading as
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as r } from "styled-components";
|
|
3
|
+
import { RankPositionIcon as t } from "./icon/index.js";
|
|
4
|
+
import { Container as g } from "../container/index.js";
|
|
5
|
+
import { Heading as l } from "../typography/heading/index.js";
|
|
6
6
|
import "../typography/span/index.js";
|
|
7
7
|
import "../typography/text/index.js";
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
4: {
|
|
23
|
-
color: o.palette.success[500],
|
|
24
|
-
icon: "gauge-low"
|
|
25
|
-
},
|
|
26
|
-
5: {
|
|
27
|
-
color: o.palette.info[700],
|
|
28
|
-
icon: "gauge-min"
|
|
29
|
-
},
|
|
30
|
-
6: {
|
|
31
|
-
color: o.palette.gray[400],
|
|
32
|
-
icon: "gauge-min"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
return /* @__PURE__ */ t(l, { alignItems: "center", display: "inline-flex", gap: 0.5, children: [
|
|
36
|
-
/* @__PURE__ */ r(c, { color: i[e].color, icon: i[e].icon }),
|
|
37
|
-
/* @__PURE__ */ r(a, { fontWeight: "bold", size: "xs", children: e })
|
|
8
|
+
const h = {
|
|
9
|
+
1: { icon: "gauge-max", scale: "error", shade: "700" },
|
|
10
|
+
2: { icon: "gauge-high", scale: "error", shade: "500" },
|
|
11
|
+
3: { icon: "gauge-high", scale: "warning", shade: "600" },
|
|
12
|
+
4: { icon: "gauge", scale: "warning", shade: "500" },
|
|
13
|
+
5: { icon: "gauge-low", scale: "success", shade: "500" },
|
|
14
|
+
6: { icon: "gauge-low", scale: "info", shade: "500" },
|
|
15
|
+
7: { icon: "gauge-min", scale: "info", shade: "700" }
|
|
16
|
+
}, R = ({ rank: e }) => {
|
|
17
|
+
const i = r(), { icon: n, scale: a, shade: s } = h[e];
|
|
18
|
+
return /* @__PURE__ */ c(g, { alignItems: "center", display: "inline-flex", gap: 0.5, children: [
|
|
19
|
+
/* @__PURE__ */ o(t, { color: i.palette[a][s], icon: n }),
|
|
20
|
+
/* @__PURE__ */ o(l, { fontWeight: "bold", size: "xs", children: e })
|
|
38
21
|
] });
|
|
39
22
|
};
|
|
40
23
|
export {
|
|
41
|
-
|
|
24
|
+
R as RankPosition
|
|
42
25
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Meta } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
2
2
|
import { IRankPositionProps } from './types';
|
|
3
3
|
declare const config: Meta;
|
|
4
4
|
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IRankPositionProps>;
|
|
5
|
-
|
|
5
|
+
declare const Scale: StoryFn;
|
|
6
|
+
export { Default, Scale };
|
|
6
7
|
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IconName } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
-
|
|
2
|
+
import { ColorPalette } from '../@core/types';
|
|
3
|
+
type TRankPosition = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
3
4
|
/**
|
|
4
5
|
* Rank position icon.
|
|
5
6
|
* @interface IRankPositionIcon
|
|
@@ -10,12 +11,24 @@ interface IRankPositionIcon {
|
|
|
10
11
|
color: string;
|
|
11
12
|
icon: IconName;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Icon and theme color of one rank, from the most urgent (1) to the least (7).
|
|
16
|
+
* @interface IRankPositionTone
|
|
17
|
+
* @property { IconName } icon - The gauge icon, its needle falling with the rank.
|
|
18
|
+
* @property { string } scale - The theme palette the color comes from.
|
|
19
|
+
* @property { ColorPalette } shade - The shade of that palette.
|
|
20
|
+
*/
|
|
21
|
+
interface IRankPositionTone {
|
|
22
|
+
icon: IconName;
|
|
23
|
+
scale: "error" | "info" | "success" | "warning";
|
|
24
|
+
shade: ColorPalette;
|
|
25
|
+
}
|
|
13
26
|
/**
|
|
14
27
|
* Rank position component props.
|
|
15
28
|
* @interface IRankPositionProps
|
|
16
|
-
* @property { number } rank - The rank position (1-
|
|
29
|
+
* @property { number } rank - The rank position (1-7).
|
|
17
30
|
*/
|
|
18
31
|
interface IRankPositionProps {
|
|
19
32
|
rank: TRankPosition;
|
|
20
33
|
}
|
|
21
|
-
export type { IRankPositionProps, IRankPositionIcon, TRankPosition };
|
|
34
|
+
export type { IRankPositionProps, IRankPositionIcon, IRankPositionTone, TRankPosition, };
|
package/package.json
CHANGED