@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.
@@ -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
- export { Default, Secondary, Tertiary, Ghost };
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
- (a) => ({
5
+ (r) => ({
6
6
  ghost: `
7
7
  background: transparent;
8
8
  border: none;
9
- color: ${a.palette.gray[800]};
10
- --btn-padding-x: ${a.spacing[0.5]};
11
- --btn-padding-y: ${a.spacing[0.625]};
12
- --btn-spacing: ${a.spacing[0.25]};
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: ${a.palette.gray[400]};
15
+ color: ${r.palette.gray[400]};
16
16
  cursor: not-allowed;
17
17
  }
18
18
 
19
19
  &:hover:not([disabled]) {
20
- background-color: ${a.palette.gray[100]};
21
- color: ${a.palette.gray[800]};
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: ${a.palette.gray[800]};
27
+ color: ${r.palette.gray[800]};
28
28
 
29
29
  &:hover {
30
- color: ${a.palette.gray[500]};
30
+ color: ${r.palette.gray[500]};
31
31
  }
32
32
  `,
33
33
  primary: `
34
- background: ${a.palette.primary[500]};
34
+ background: ${r.palette.primary[500]};
35
35
  border: none;
36
- color: ${a.palette.white};
37
- --btn-spacing: ${a.spacing[0.25]};
36
+ color: ${r.palette.white};
37
+ --btn-spacing: ${r.spacing[0.25]};
38
38
 
39
39
  &:disabled {
40
- background: ${a.palette.gray[200]};
41
- color: ${a.palette.gray[400]};
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: ${a.palette.primary[700]};
47
- color: ${a.palette.white};
46
+ background-color: ${r.palette.primary[700]};
47
+ color: ${r.palette.white};
48
48
  }
49
49
  `,
50
50
  secondary: `
51
- background: ${a.palette.gray[800]};
51
+ background: ${r.palette.gray[800]};
52
52
  border: none;
53
- color: ${a.palette.white};
54
- --btn-spacing: ${a.spacing[0.25]};
53
+ color: ${r.palette.white};
54
+ --btn-spacing: ${r.spacing[0.25]};
55
55
 
56
56
  &:disabled {
57
- background: ${a.palette.gray[200]};
58
- color: ${a.palette.gray[400]};
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: ${a.palette.gray[600]};
64
- color: ${a.palette.white};
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 ${a.palette.primary[500]};
70
- color: ${a.palette.primary[500]};
71
- --btn-spacing: ${a.spacing[0.25]};
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 ${a.palette.gray[200]};
76
- color: ${a.palette.gray[300]};
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: ${a.palette.primary[500]};
82
- color: ${a.palette.white};
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: a, justify: o, $variant: r }) => `
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: ${a.typography.type.primary};
93
- font-size: ${a.typography.text.md};
94
- font-weight: ${a.typography.weight.regular};
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: ${a.spacing[1.25]};
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: ${a.breakpoints.mobile}) {
109
- ${r !== "link" ? `--btn-padding-y: ${a.spacing[1]}` : ""};
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(a, r ?? "primary")}
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 t, jsx as r } from "react/jsx-runtime";
2
- import { useTheme as n } from "styled-components";
3
- import { RankPositionIcon as c } from "./icon/index.js";
4
- import { Container as l } from "../container/index.js";
5
- import { Heading as a } from "../typography/heading/index.js";
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 x = ({ rank: e }) => {
9
- const o = n(), i = {
10
- 1: {
11
- color: o.palette.error[700],
12
- icon: "gauge-max"
13
- },
14
- 2: {
15
- color: o.palette.error[500],
16
- icon: "gauge-high"
17
- },
18
- 3: {
19
- color: o.palette.warning[500],
20
- icon: "gauge"
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
- x as RankPosition
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
- export { Default };
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
- type TRankPosition = 1 | 2 | 3 | 4 | 5 | 6;
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-6).
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
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "8.5.0"
138
+ "version": "8.7.0"
139
139
  }