@fluidattacks/design 9.9.1 → 10.0.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/advisories-card/index.js +4 -2
- package/dist/components/card/card-with-input/index.js +3 -2
- package/dist/components/carousel/index.js +12 -10
- package/dist/components/cloud-image/index.js +10 -8
- package/dist/components/conditions-dialog/index.js +23 -21
- package/dist/components/confirm-dialog/index.js +9 -7
- package/dist/components/filters/filters-menu/index.js +24 -23
- package/dist/components/filters/options-menu/options/index.js +38 -37
- package/dist/components/item-card-db/index.js +10 -8
- package/dist/components/modal/dialog/index.js +8 -6
- package/dist/components/modal/footer/index.js +15 -14
- package/dist/components/modal/header/index.d.ts +1 -1
- package/dist/components/modal/header/index.js +58 -40
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/index.stories.d.ts +17 -5
- package/dist/components/modal/styles.js +22 -13
- package/dist/components/modal/types.d.ts +23 -3
- package/dist/components/package-card/index.js +25 -23
- package/dist/components/rules-card/index.js +19 -17
- package/dist/components/severity-indicator/index.js +16 -14
- package/dist/components/slider/index.js +3 -2
- package/dist/components/table/pagination/pagination-dropdown/index.js +4 -4
- package/dist/components/table/table-column-toggle/index.js +7 -6
- package/dist/components/table/wrapper/index.js +10 -8
- package/dist/components/weaknesses-card/index.js +4 -2
- package/dist/hooks/use-search.js +4 -3
- package/package.json +1 -1
|
@@ -7,25 +7,27 @@ import { Tag as y } from "../tag/index.js";
|
|
|
7
7
|
import { Heading as k } from "../typography/heading/index.js";
|
|
8
8
|
import "../typography/span/index.js";
|
|
9
9
|
import { Text as l } from "../typography/text/index.js";
|
|
10
|
+
import "../../_virtual/dayjs.min.js";
|
|
11
|
+
import "../../_virtual/lodash.js";
|
|
10
12
|
import { safeUrl as j } from "../../utils/url.js";
|
|
11
13
|
const L = {
|
|
12
14
|
md: { titleSize: "xs", descSize: "md", linkTextSize: "md" },
|
|
13
15
|
lg: { titleSize: "sm", descSize: "lg", linkTextSize: "lg" }
|
|
14
|
-
},
|
|
16
|
+
}, _ = ({
|
|
15
17
|
desc: r,
|
|
16
18
|
href: c,
|
|
17
19
|
icon: n,
|
|
18
20
|
imageHeight: m = 48,
|
|
19
21
|
imageWidth: a = 48,
|
|
20
|
-
Link:
|
|
21
|
-
LinkElement:
|
|
22
|
-
linkText:
|
|
22
|
+
Link: p,
|
|
23
|
+
LinkElement: h,
|
|
24
|
+
linkText: f = "Learn more ",
|
|
23
25
|
publicId: o,
|
|
24
26
|
size: z = "lg",
|
|
25
27
|
tag: d,
|
|
26
28
|
title: t
|
|
27
29
|
}) => {
|
|
28
|
-
const g =
|
|
30
|
+
const g = p ?? "a", { titleSize: x, descSize: S, linkTextSize: I } = L[z];
|
|
29
31
|
return /* @__PURE__ */ i(C, { "data-testid": t, children: [
|
|
30
32
|
/* @__PURE__ */ i(
|
|
31
33
|
w,
|
|
@@ -61,12 +63,12 @@ const L = {
|
|
|
61
63
|
),
|
|
62
64
|
/* @__PURE__ */ e(k, { size: x, children: t }),
|
|
63
65
|
r ? /* @__PURE__ */ e(l, { size: S, children: r }) : void 0,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
h ?? /* @__PURE__ */ e(g, { href: j(c), style: { textDecoration: "none" }, children: /* @__PURE__ */ i(l, { size: I, children: [
|
|
67
|
+
f,
|
|
66
68
|
/* @__PURE__ */ e(s, { icon: "arrow-right", iconSize: "sm", iconType: "fa-light" })
|
|
67
69
|
] }) })
|
|
68
70
|
] });
|
|
69
71
|
};
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
_ as ItemCardDB
|
|
72
74
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as p, useState as f } from "react";
|
|
3
3
|
import { trapTabKey as o } from "./utils.js";
|
|
4
|
-
import { ModalWrapper as
|
|
4
|
+
import { ModalWrapper as c } from "../styles.js";
|
|
5
|
+
import "../../../_virtual/lodash.js";
|
|
6
|
+
import "nuqs";
|
|
5
7
|
import { useMountEffect as s } from "../../../hooks/use-mount-effect.js";
|
|
6
|
-
const
|
|
8
|
+
const x = ({
|
|
7
9
|
children: n = void 0,
|
|
8
10
|
id: a = void 0,
|
|
9
11
|
label: i
|
|
10
12
|
}) => {
|
|
11
|
-
const r =
|
|
13
|
+
const r = p(null), [t] = f(() => document.activeElement);
|
|
12
14
|
return s(() => {
|
|
13
15
|
const e = r.current;
|
|
14
16
|
return e?.contains(document.activeElement) !== !0 && e?.focus(), e?.addEventListener("keydown", o), () => {
|
|
15
17
|
e?.removeEventListener("keydown", o), t instanceof HTMLElement && t.focus();
|
|
16
18
|
};
|
|
17
19
|
}), /* @__PURE__ */ m(
|
|
18
|
-
|
|
20
|
+
c,
|
|
19
21
|
{
|
|
20
22
|
"aria-label": i,
|
|
21
23
|
"aria-modal": "true",
|
|
@@ -28,5 +30,5 @@ const w = ({
|
|
|
28
30
|
);
|
|
29
31
|
};
|
|
30
32
|
export {
|
|
31
|
-
|
|
33
|
+
x as Dialog
|
|
32
34
|
};
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { l as x } from "../../../_virtual/lodash.js";
|
|
3
|
-
import { useCallback as
|
|
3
|
+
import { useCallback as l } from "react";
|
|
4
4
|
import { Footer as C } from "../styles.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Container as
|
|
5
|
+
import { Button as s } from "../../button/index.js";
|
|
6
|
+
import { Container as f } from "../../container/index.js";
|
|
7
7
|
const w = ({
|
|
8
8
|
alert: p,
|
|
9
9
|
modalRef: a,
|
|
10
10
|
confirmButton: i = void 0,
|
|
11
11
|
cancelButton: r = void 0
|
|
12
12
|
}) => {
|
|
13
|
-
const { close: o } = a, h =
|
|
13
|
+
const { close: o } = a, h = l(() => {
|
|
14
14
|
r?.onClick && r.onClick(), o();
|
|
15
|
-
}, [r, o]),
|
|
15
|
+
}, [r, o]), m = l(() => {
|
|
16
16
|
i?.onClick && i.onClick(), o();
|
|
17
17
|
}, [i, o]);
|
|
18
18
|
return [i, r].some(
|
|
19
|
-
(
|
|
20
|
-
) ? /* @__PURE__ */
|
|
21
|
-
|
|
19
|
+
(t) => !x.isEmpty(t)
|
|
20
|
+
) ? /* @__PURE__ */ d(
|
|
21
|
+
f,
|
|
22
22
|
{
|
|
23
23
|
display: "flex",
|
|
24
24
|
flexDirection: "column",
|
|
25
25
|
gap: 0.625,
|
|
26
|
+
id: "modal-footer",
|
|
26
27
|
position: "sticky",
|
|
27
28
|
px: 1.25,
|
|
28
29
|
py: 1.25,
|
|
29
30
|
children: [
|
|
30
31
|
p,
|
|
31
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ d("div", { children: [
|
|
32
33
|
r && /* @__PURE__ */ e(
|
|
33
|
-
|
|
34
|
+
s,
|
|
34
35
|
{
|
|
35
36
|
id: r.id,
|
|
36
37
|
onClick: h,
|
|
37
|
-
variant: "tertiary",
|
|
38
|
+
variant: i ? "tertiary" : "primary",
|
|
38
39
|
width: "100%",
|
|
39
40
|
children: r.text
|
|
40
41
|
}
|
|
41
42
|
),
|
|
42
43
|
i && /* @__PURE__ */ e(
|
|
43
|
-
|
|
44
|
+
s,
|
|
44
45
|
{
|
|
45
46
|
id: i.id,
|
|
46
|
-
onClick:
|
|
47
|
+
onClick: m,
|
|
47
48
|
variant: "primary",
|
|
48
49
|
width: "100%",
|
|
49
50
|
children: i.text
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IModalHeaderProps } from '../types';
|
|
2
|
-
declare const Header: ({ title, description, dismissable,
|
|
2
|
+
declare const Header: ({ title, description, dismissable, headerActions, modalRef, onClose, }: Readonly<IModalHeaderProps>) => JSX.Element;
|
|
3
3
|
export { Header };
|
|
@@ -1,67 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { l as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { Header as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
import { Heading as
|
|
8
|
-
import { Span as
|
|
9
|
-
import { Text as
|
|
10
|
-
const
|
|
11
|
-
title:
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { l as c } from "../../../_virtual/lodash.js";
|
|
3
|
+
import { useCallback as w, useEffect as u } from "react";
|
|
4
|
+
import { useTheme as k } from "styled-components";
|
|
5
|
+
import { Header as v, Title as x } from "../styles.js";
|
|
6
|
+
import { IconButton as f } from "../../icon-button/index.js";
|
|
7
|
+
import { Heading as E } from "../../typography/heading/index.js";
|
|
8
|
+
import { Span as T } from "../../typography/span/index.js";
|
|
9
|
+
import { Text as z } from "../../typography/text/index.js";
|
|
10
|
+
const N = ({
|
|
11
|
+
title: i,
|
|
12
12
|
description: e,
|
|
13
|
-
dismissable:
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
dismissable: n = !0,
|
|
14
|
+
headerActions: h,
|
|
15
|
+
modalRef: l,
|
|
16
16
|
onClose: d
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
d?.(),
|
|
20
|
-
}, [
|
|
21
|
-
return
|
|
22
|
-
if (!
|
|
18
|
+
const t = k(), a = w(() => {
|
|
19
|
+
d?.(), l.close();
|
|
20
|
+
}, [l, d]);
|
|
21
|
+
return u(() => {
|
|
22
|
+
if (!n) return () => {
|
|
23
23
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const o = (m) => {
|
|
25
|
+
m.key === "Escape" && a();
|
|
26
26
|
};
|
|
27
|
-
return window.addEventListener("keydown",
|
|
28
|
-
window.removeEventListener("keydown",
|
|
27
|
+
return window.addEventListener("keydown", o), () => {
|
|
28
|
+
window.removeEventListener("keydown", o);
|
|
29
29
|
};
|
|
30
|
-
}, [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
typeof
|
|
33
|
-
|
|
30
|
+
}, [n, a]), /* @__PURE__ */ s(v, { children: [
|
|
31
|
+
/* @__PURE__ */ s(x, { children: [
|
|
32
|
+
typeof i == "string" ? /* @__PURE__ */ r(
|
|
33
|
+
E,
|
|
34
34
|
{
|
|
35
35
|
fontWeight: "bold",
|
|
36
36
|
mr: 1,
|
|
37
37
|
size: "sm",
|
|
38
38
|
wordBreak: "break-word",
|
|
39
|
-
children:
|
|
39
|
+
children: i
|
|
40
40
|
}
|
|
41
|
-
) :
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
) : i,
|
|
42
|
+
/* @__PURE__ */ s("div", { className: "items-center flex gap-3", children: [
|
|
43
|
+
h?.filter(({ visible: o = !0 }) => o).map(({ icon: o, id: m, label: p, onClick: g, tooltip: y }) => /* @__PURE__ */ r(
|
|
44
|
+
f,
|
|
45
|
+
{
|
|
46
|
+
"aria-label": p,
|
|
47
|
+
icon: o,
|
|
48
|
+
iconColor: t.palette.gray[700],
|
|
49
|
+
iconSize: "sm",
|
|
50
|
+
iconType: "fa-light",
|
|
51
|
+
id: m,
|
|
52
|
+
onClick: g,
|
|
53
|
+
px: 0.25,
|
|
54
|
+
py: 0.25,
|
|
55
|
+
tooltip: y,
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
width: t.spacing[1.25]
|
|
58
|
+
},
|
|
59
|
+
p
|
|
60
|
+
)),
|
|
61
|
+
n && /* @__PURE__ */ r(
|
|
62
|
+
f,
|
|
46
63
|
{
|
|
47
64
|
icon: "close",
|
|
48
|
-
iconColor:
|
|
49
|
-
iconSize: "
|
|
65
|
+
iconColor: t.palette.gray[700],
|
|
66
|
+
iconSize: "sm",
|
|
50
67
|
iconTransform: "grow-2",
|
|
51
68
|
iconType: "fa-light",
|
|
52
69
|
id: "modal-close",
|
|
53
|
-
onClick:
|
|
70
|
+
onClick: a,
|
|
54
71
|
px: 0.25,
|
|
55
72
|
py: 0.25,
|
|
56
|
-
variant: "ghost"
|
|
73
|
+
variant: "ghost",
|
|
74
|
+
width: t.spacing[1.25]
|
|
57
75
|
}
|
|
58
76
|
)
|
|
59
77
|
] })
|
|
60
78
|
] }),
|
|
61
|
-
e &&
|
|
62
|
-
e && !
|
|
79
|
+
e && c.isString(e) && !c.isEmpty(e) ? /* @__PURE__ */ r(z, { mt: 0.5, size: "md", children: e }) : void 0,
|
|
80
|
+
e && !c.isString(e) && /* @__PURE__ */ r(T, { display: "block", mt: 0.5, size: "md", children: e })
|
|
63
81
|
] });
|
|
64
82
|
};
|
|
65
83
|
export {
|
|
66
|
-
|
|
84
|
+
N as Header
|
|
67
85
|
};
|
|
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { ModalFooter } from './footer';
|
|
3
3
|
import { ModalConfirm } from './modal-confirm';
|
|
4
4
|
import { IModalProps } from './types';
|
|
5
|
-
declare const Modal: ({ _portal, alert, cancelButton, children, confirmButton, content, description, dismissable,
|
|
5
|
+
declare const Modal: ({ _portal, alert, cancelButton, children, confirmButton, content, description, dismissable, headerActions, modalRef, onClose, tabItems, title, size, id, }: Readonly<PropsWithChildren<IModalProps>>) => JSX.Element | null;
|
|
6
6
|
export { Modal, ModalConfirm, ModalFooter };
|
|
7
7
|
export { ColumnsModal } from './columns-modal';
|
|
@@ -24,8 +24,8 @@ const oi = ({
|
|
|
24
24
|
content: i = void 0,
|
|
25
25
|
description: M = void 0,
|
|
26
26
|
dismissable: O = !0,
|
|
27
|
+
headerActions: T = void 0,
|
|
27
28
|
modalRef: e,
|
|
28
|
-
otherActions: T = void 0,
|
|
29
29
|
onClose: j = void 0,
|
|
30
30
|
tabItems: t = void 0,
|
|
31
31
|
title: s = void 0,
|
|
@@ -55,9 +55,9 @@ const oi = ({
|
|
|
55
55
|
{
|
|
56
56
|
description: M,
|
|
57
57
|
dismissable: O,
|
|
58
|
+
headerActions: T,
|
|
58
59
|
modalRef: e,
|
|
59
60
|
onClose: j,
|
|
60
|
-
otherActions: T,
|
|
61
61
|
title: s
|
|
62
62
|
}
|
|
63
63
|
),
|
|
@@ -2,14 +2,26 @@ import { Meta } from '@storybook/react-vite';
|
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { IModalProps } from './types';
|
|
4
4
|
declare const config: Meta;
|
|
5
|
-
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IModalProps & {
|
|
5
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
6
6
|
id: string;
|
|
7
|
-
}
|
|
8
|
-
declare const
|
|
7
|
+
}>>;
|
|
8
|
+
declare const WithForm: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
9
|
+
id: string;
|
|
10
|
+
}>>;
|
|
11
|
+
declare const ScrollableContent: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
12
|
+
id: string;
|
|
13
|
+
}>>;
|
|
14
|
+
declare const SingleAction: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
9
15
|
id: string;
|
|
10
|
-
}
|
|
16
|
+
}>>;
|
|
17
|
+
declare const WithoutFooter: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
18
|
+
id: string;
|
|
19
|
+
}>>;
|
|
20
|
+
declare const ImageModal: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
21
|
+
id: string;
|
|
22
|
+
}>>;
|
|
11
23
|
declare const WithTabs: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
12
24
|
id: string;
|
|
13
25
|
}>>;
|
|
14
26
|
export default config;
|
|
15
|
-
export { Default, ImageModal, WithTabs };
|
|
27
|
+
export { Default, ImageModal, WithTabs, ScrollableContent, SingleAction, WithoutFooter, WithForm, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled as a } from "styled-components";
|
|
2
|
-
import { variantBuilder as
|
|
2
|
+
import { variantBuilder as n } from "../@core/variants/utils.js";
|
|
3
3
|
import { Container as t } from "../container/index.js";
|
|
4
|
-
const { getVariant: r } =
|
|
4
|
+
const { getVariant: r } = n(
|
|
5
5
|
(i) => ({
|
|
6
6
|
fixed: `
|
|
7
7
|
height: auto;
|
|
@@ -31,7 +31,7 @@ const { getVariant: r } = o(
|
|
|
31
31
|
}
|
|
32
32
|
`
|
|
33
33
|
})
|
|
34
|
-
),
|
|
34
|
+
), l = a.div.attrs({
|
|
35
35
|
className: "comp-modal fixed inset-0 overflow-auto"
|
|
36
36
|
})`
|
|
37
37
|
align-items: center;
|
|
@@ -39,8 +39,8 @@ const { getVariant: r } = o(
|
|
|
39
39
|
display: flex;
|
|
40
40
|
justify-content: center;
|
|
41
41
|
z-index: 99999;
|
|
42
|
-
`,
|
|
43
|
-
${({ theme: i, $size:
|
|
42
|
+
`, c = a(t)`
|
|
43
|
+
${({ theme: i, $size: o }) => `
|
|
44
44
|
background-color: ${i.palette.white};
|
|
45
45
|
border: 1px solid ${i.palette.gray[200]};
|
|
46
46
|
border-radius: ${i.spacing[0.25]};
|
|
@@ -49,12 +49,16 @@ const { getVariant: r } = o(
|
|
|
49
49
|
font-family: ${i.typography.type.primary};
|
|
50
50
|
font-size: ${i.typography.text.md};
|
|
51
51
|
max-height: 80%;
|
|
52
|
-
min-height:
|
|
52
|
+
min-height: 32%;
|
|
53
53
|
box-shadow: ${i.shadows.lg};
|
|
54
54
|
margin: auto;
|
|
55
55
|
white-space: pre-line;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
> #modal-footer {
|
|
58
|
+
margin-top: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
${r(i, o)}
|
|
58
62
|
`}
|
|
59
63
|
`, p = a.div`
|
|
60
64
|
${({ theme: i }) => `
|
|
@@ -62,6 +66,7 @@ const { getVariant: r } = o(
|
|
|
62
66
|
border-radius: 0 0 ${i.spacing[0.25]} ${i.spacing[0.25]};
|
|
63
67
|
display: flex;
|
|
64
68
|
flex-direction: column;
|
|
69
|
+
flex-grow: 1;
|
|
65
70
|
overflow: hidden auto;
|
|
66
71
|
padding: 0 ${i.spacing[1.5]} ${i.spacing[1.5]} ${i.spacing[1.5]};
|
|
67
72
|
scrollbar-color: ${i.palette.gray[600]} ${i.palette.gray[100]};
|
|
@@ -71,6 +76,10 @@ const { getVariant: r } = o(
|
|
|
71
76
|
flex-direction: unset;
|
|
72
77
|
overflow: hidden;
|
|
73
78
|
padding: 0;
|
|
79
|
+
|
|
80
|
+
> form > div {
|
|
81
|
+
flex-grow: 1;
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
&:has(#footer) {
|
|
@@ -95,9 +104,9 @@ const { getVariant: r } = o(
|
|
|
95
104
|
padding-bottom: ${({ theme: i }) => `${i.spacing[1.5]}`};
|
|
96
105
|
position: sticky;
|
|
97
106
|
z-index: 1;
|
|
98
|
-
`,
|
|
107
|
+
`, f = a.div.attrs({
|
|
99
108
|
className: "flex items-center justify-between"
|
|
100
|
-
})``,
|
|
109
|
+
})``, $ = a.div`
|
|
101
110
|
${({ theme: i }) => `
|
|
102
111
|
border-radius: 0 0 ${i.spacing[0.25]} ${i.spacing[0.25]};
|
|
103
112
|
display: flex;
|
|
@@ -146,11 +155,11 @@ const { getVariant: r } = o(
|
|
|
146
155
|
}
|
|
147
156
|
`;
|
|
148
157
|
export {
|
|
149
|
-
|
|
158
|
+
$ as Footer,
|
|
150
159
|
g as Header,
|
|
151
160
|
x as ImageContainer,
|
|
152
|
-
|
|
161
|
+
c as ModalContainer,
|
|
153
162
|
p as ModalContent,
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
l as ModalWrapper,
|
|
164
|
+
f as Title
|
|
156
165
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IIconModifiable } from '../@core/types';
|
|
1
2
|
import { ITabProps } from '../tabs/types';
|
|
2
3
|
import { IUseModal } from '../../hooks';
|
|
3
4
|
type TSize = "fixed" | "lg" | "md" | "sm";
|
|
@@ -35,20 +36,39 @@ interface IDialogProps {
|
|
|
35
36
|
id?: string;
|
|
36
37
|
label: string;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Modal header action props.
|
|
41
|
+
* @interface IModalHeaderAction
|
|
42
|
+
* @property { IconName } icon - The icon the button shows.
|
|
43
|
+
* @property { string } [id] - The id of the button.
|
|
44
|
+
* @property { string } label - The name screen readers announce for the button, unique among the actions.
|
|
45
|
+
* @property { Function } onClick - The function to call when the button is clicked.
|
|
46
|
+
* @property { string } [tooltip] - The text shown when hovering the button.
|
|
47
|
+
* @property { boolean } [visible] - Whether the button is shown. Defaults to true.
|
|
48
|
+
*/
|
|
49
|
+
interface IModalHeaderAction {
|
|
50
|
+
icon: IIconModifiable["icon"];
|
|
51
|
+
id?: string;
|
|
52
|
+
label: string;
|
|
53
|
+
onClick: () => void;
|
|
54
|
+
tooltip?: string;
|
|
55
|
+
visible?: boolean;
|
|
56
|
+
}
|
|
57
|
+
type TModalHeaderActions = readonly [IModalHeaderAction, IModalHeaderAction, IModalHeaderAction] | readonly [IModalHeaderAction, IModalHeaderAction] | readonly [IModalHeaderAction];
|
|
38
58
|
/**
|
|
39
59
|
* Modal header component props.
|
|
40
60
|
* @interface IModalHeaderProps
|
|
41
61
|
* @property { React.ReactNode | string } [description] - The description of the modal.
|
|
62
|
+
* @property { TModalHeaderActions } [headerActions] - Up to three buttons shown left of the close button.
|
|
42
63
|
* @property { IUseModal } [modalRef] - The modal reference.
|
|
43
|
-
* @property { React.ReactNode } [otherActions] - The other actions of the modal.
|
|
44
64
|
* @property { Function } [onClose] - The function to call when the modal is closed.
|
|
45
65
|
* @property { React.ReactNode | string } [title] - The title of the modal.
|
|
46
66
|
*/
|
|
47
67
|
interface IModalHeaderProps {
|
|
48
68
|
description?: React.ReactNode | string;
|
|
49
69
|
dismissable?: boolean;
|
|
70
|
+
headerActions?: TModalHeaderActions;
|
|
50
71
|
modalRef: IModalProps["modalRef"];
|
|
51
|
-
otherActions?: React.ReactNode;
|
|
52
72
|
onClose?: () => void;
|
|
53
73
|
title?: React.ReactNode | string;
|
|
54
74
|
}
|
|
@@ -102,4 +122,4 @@ interface IModalConfirmProps {
|
|
|
102
122
|
txtCancel?: string;
|
|
103
123
|
txtConfirm?: React.ReactNode | string;
|
|
104
124
|
}
|
|
105
|
-
export type { IDialogProps, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
125
|
+
export type { IDialogProps, IModalHeaderAction, TModalHeaderActions, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import x from "../../_virtual/capitalize.js";
|
|
3
3
|
import { Fragment as y } from "react";
|
|
4
4
|
import { useTheme as b } from "styled-components";
|
|
@@ -7,8 +7,10 @@ import { SeverityBadge as u } from "../severity-badge/index.js";
|
|
|
7
7
|
import { Tag as I } from "../tag/index.js";
|
|
8
8
|
import { Heading as w } from "../typography/heading/index.js";
|
|
9
9
|
import "../typography/span/index.js";
|
|
10
|
-
import { Text as
|
|
10
|
+
import { Text as l } from "../typography/text/index.js";
|
|
11
11
|
import { CardContainer as C, Divisor as z } from "../weaknesses-card/styles.js";
|
|
12
|
+
import "../../_virtual/dayjs.min.js";
|
|
13
|
+
import "../../_virtual/lodash.js";
|
|
12
14
|
import { safeUrl as v } from "../../utils/url.js";
|
|
13
15
|
const R = {
|
|
14
16
|
critical: "critical",
|
|
@@ -16,23 +18,23 @@ const R = {
|
|
|
16
18
|
low: "low",
|
|
17
19
|
medium: "medium",
|
|
18
20
|
none: "disable"
|
|
19
|
-
},
|
|
20
|
-
affectedVersions:
|
|
21
|
-
ecosystem:
|
|
22
|
-
href:
|
|
21
|
+
}, B = ({
|
|
22
|
+
affectedVersions: a,
|
|
23
|
+
ecosystem: p,
|
|
24
|
+
href: d,
|
|
23
25
|
indx: s,
|
|
24
26
|
packageName: m,
|
|
25
|
-
severity:
|
|
27
|
+
severity: o,
|
|
26
28
|
status: c,
|
|
27
29
|
Link: h
|
|
28
30
|
}) => {
|
|
29
|
-
const r = b(), n =
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */ e(g, { href: v(
|
|
33
|
-
/* @__PURE__ */ e(I, { tagLabel:
|
|
31
|
+
const r = b(), n = o ? R[o.toLowerCase()] : void 0, g = h ?? "a", f = c === "vulnerable";
|
|
32
|
+
return /* @__PURE__ */ t(C, { $index: s, children: [
|
|
33
|
+
/* @__PURE__ */ t(i, { display: "flex", justify: "space-between", width: "100%", children: [
|
|
34
|
+
/* @__PURE__ */ e(g, { href: v(d), children: /* @__PURE__ */ e(i, { alignItems: "center", display: "flex", gap: 0.75, children: /* @__PURE__ */ e(w, { fontWeight: "bold", size: "sm", children: m }) }) }),
|
|
35
|
+
/* @__PURE__ */ e(I, { tagLabel: p })
|
|
34
36
|
] }),
|
|
35
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ t(
|
|
36
38
|
i,
|
|
37
39
|
{
|
|
38
40
|
alignItems: "center",
|
|
@@ -41,7 +43,7 @@ const R = {
|
|
|
41
43
|
width: "100%",
|
|
42
44
|
wrap: "wrap",
|
|
43
45
|
children: [
|
|
44
|
-
f ? /* @__PURE__ */
|
|
46
|
+
f ? /* @__PURE__ */ t(i, { alignItems: "center", display: "flex", children: [
|
|
45
47
|
/* @__PURE__ */ e(
|
|
46
48
|
i,
|
|
47
49
|
{
|
|
@@ -51,7 +53,7 @@ const R = {
|
|
|
51
53
|
borderRadius: "4px 0 0 4px",
|
|
52
54
|
display: "flex",
|
|
53
55
|
px: 0.25,
|
|
54
|
-
children: /* @__PURE__ */ e(
|
|
56
|
+
children: /* @__PURE__ */ e(l, { color: r.palette.primary[500], size: "md", children: "Vulnerable" })
|
|
55
57
|
}
|
|
56
58
|
),
|
|
57
59
|
/* @__PURE__ */ e(
|
|
@@ -62,7 +64,7 @@ const R = {
|
|
|
62
64
|
borderRadius: "0 4px 4px 0",
|
|
63
65
|
display: "flex",
|
|
64
66
|
px: 0.25,
|
|
65
|
-
children: /* @__PURE__ */ e(
|
|
67
|
+
children: /* @__PURE__ */ e(l, { color: r.palette.gray[800], size: "md", children: `${a} affected version${a === 1 ? "" : "s"}` })
|
|
66
68
|
}
|
|
67
69
|
)
|
|
68
70
|
] }) : /* @__PURE__ */ e(
|
|
@@ -73,14 +75,14 @@ const R = {
|
|
|
73
75
|
borderRadius: "4px",
|
|
74
76
|
display: "flex",
|
|
75
77
|
px: 0.25,
|
|
76
|
-
children: /* @__PURE__ */ e(
|
|
78
|
+
children: /* @__PURE__ */ e(l, { color: r.palette.success[500], size: "md", children: "Safe" })
|
|
77
79
|
}
|
|
78
80
|
),
|
|
79
|
-
|
|
81
|
+
o && /* @__PURE__ */ t(y, { children: [
|
|
80
82
|
/* @__PURE__ */ e(z, {}),
|
|
81
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ t(i, { alignItems: "center", display: "flex", gap: 0.5, children: [
|
|
82
84
|
/* @__PURE__ */ e(
|
|
83
|
-
|
|
85
|
+
l,
|
|
84
86
|
{
|
|
85
87
|
color: r.palette.gray[400],
|
|
86
88
|
fontWeight: "bold",
|
|
@@ -88,10 +90,10 @@ const R = {
|
|
|
88
90
|
children: "Max severity:"
|
|
89
91
|
}
|
|
90
92
|
),
|
|
91
|
-
n === void 0 ? /* @__PURE__ */ e(
|
|
93
|
+
n === void 0 ? /* @__PURE__ */ e(l, { color: r.palette.gray[400], size: "sm", children: "None" }) : /* @__PURE__ */ e(
|
|
92
94
|
u,
|
|
93
95
|
{
|
|
94
|
-
textR: x(
|
|
96
|
+
textR: x(o),
|
|
95
97
|
variant: n
|
|
96
98
|
}
|
|
97
99
|
)
|
|
@@ -103,5 +105,5 @@ const R = {
|
|
|
103
105
|
] });
|
|
104
106
|
};
|
|
105
107
|
export {
|
|
106
|
-
|
|
108
|
+
B as PackageCard
|
|
107
109
|
};
|