@fluidattacks/design 8.6.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.
|
@@ -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