@fluidattacks/design 8.3.1 → 8.5.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/collapsible-card/index.d.ts +5 -0
- package/dist/components/collapsible-card/index.js +41 -0
- package/dist/components/collapsible-card/index.stories.d.ts +7 -0
- package/dist/components/collapsible-card/index.test.d.ts +1 -0
- package/dist/components/collapsible-card/styles.d.ts +5 -0
- package/dist/components/collapsible-card/styles.js +48 -0
- package/dist/components/collapsible-card/types.d.ts +14 -0
- package/dist/components/comparison-table/index.d.ts +4 -0
- package/dist/components/comparison-table/index.js +32 -0
- package/dist/components/comparison-table/index.stories.d.ts +8 -0
- package/dist/components/comparison-table/index.test.d.ts +1 -0
- package/dist/components/comparison-table/styles.d.ts +8 -0
- package/dist/components/comparison-table/styles.js +114 -0
- package/dist/components/comparison-table/types.d.ts +33 -0
- package/dist/components/tag/index.d.ts +1 -1
- package/dist/components/tag/index.js +36 -34
- package/dist/components/tag/styles.d.ts +1 -0
- package/dist/components/tag/styles.js +43 -14
- package/dist/components/tag/types.d.ts +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +286 -282
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ICollapsibleCardProps } from './types';
|
|
3
|
+
declare const CollapsibleCard: ({ children, expanded, title, }: Readonly<PropsWithChildren<ICollapsibleCardProps>>) => JSX.Element;
|
|
4
|
+
export { CollapsibleCard };
|
|
5
|
+
export type { ICollapsibleCardProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useId as p, useState as m, useCallback as C } from "react";
|
|
3
|
+
import { useTheme as h } from "styled-components";
|
|
4
|
+
import { CollapsibleContainer as f, CardToggle as u, CardTitle as g, CardContent as x } from "./styles.js";
|
|
5
|
+
import { Icon as T } from "../icon/index.js";
|
|
6
|
+
const k = ({
|
|
7
|
+
children: r,
|
|
8
|
+
expanded: i = !1,
|
|
9
|
+
title: a
|
|
10
|
+
}) => {
|
|
11
|
+
const l = h(), n = p(), [o, d] = m(i), c = C(() => {
|
|
12
|
+
d((s) => !s);
|
|
13
|
+
}, []);
|
|
14
|
+
return /* @__PURE__ */ t(f, { children: [
|
|
15
|
+
/* @__PURE__ */ t(
|
|
16
|
+
u,
|
|
17
|
+
{
|
|
18
|
+
"aria-controls": n,
|
|
19
|
+
"aria-expanded": o,
|
|
20
|
+
onClick: c,
|
|
21
|
+
type: "button",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ e(g, { children: a }),
|
|
24
|
+
/* @__PURE__ */ e(
|
|
25
|
+
T,
|
|
26
|
+
{
|
|
27
|
+
icon: o ? "chevron-up" : "chevron-down",
|
|
28
|
+
iconColor: l.palette.gray[700],
|
|
29
|
+
iconSize: "md",
|
|
30
|
+
iconType: "fa-light"
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
o ? /* @__PURE__ */ e(x, { id: n, children: r }) : void 0
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
k as CollapsibleCard
|
|
41
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { ICollapsibleCardProps } from './types';
|
|
3
|
+
declare const config: Meta;
|
|
4
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, ICollapsibleCardProps>;
|
|
5
|
+
declare const Expanded: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, ICollapsibleCardProps>;
|
|
6
|
+
export { Default, Expanded };
|
|
7
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const CollapsibleContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
2
|
+
declare const CardToggle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>> & string;
|
|
3
|
+
declare const CardTitle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
4
|
+
declare const CardContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
5
|
+
export { CardContent, CardTitle, CardToggle, CollapsibleContainer };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { styled as n } from "styled-components";
|
|
2
|
+
const i = n.div`
|
|
3
|
+
${({ theme: a }) => `
|
|
4
|
+
background-color: ${a.palette.white};
|
|
5
|
+
border: 1px solid ${a.palette.gray[300]};
|
|
6
|
+
border-radius: ${a.spacing[0.25]};
|
|
7
|
+
`}
|
|
8
|
+
`, o = n.button`
|
|
9
|
+
${({ theme: a }) => `
|
|
10
|
+
align-items: center;
|
|
11
|
+
background: none;
|
|
12
|
+
border: none;
|
|
13
|
+
border-radius: ${a.spacing[0.25]};
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: ${a.spacing[0.75]};
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
padding: ${a.spacing[0.75]};
|
|
19
|
+
width: 100%;
|
|
20
|
+
|
|
21
|
+
> :last-child {
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&[aria-expanded="true"] {
|
|
26
|
+
padding-bottom: ${a.spacing[0.625]};
|
|
27
|
+
}
|
|
28
|
+
`}
|
|
29
|
+
`, r = n.span`
|
|
30
|
+
${({ theme: a }) => `
|
|
31
|
+
color: ${a.palette.gray[400]};
|
|
32
|
+
font-family: ${a.typography.type.primary};
|
|
33
|
+
font-size: ${a.typography.text.sm};
|
|
34
|
+
font-weight: ${a.typography.weight.bold};
|
|
35
|
+
line-height: 18px;
|
|
36
|
+
text-align: start;
|
|
37
|
+
`}
|
|
38
|
+
`, p = n.div`
|
|
39
|
+
${({ theme: a }) => `
|
|
40
|
+
padding: 0 ${a.spacing[0.75]} ${a.spacing[0.75]};
|
|
41
|
+
`}
|
|
42
|
+
`;
|
|
43
|
+
export {
|
|
44
|
+
p as CardContent,
|
|
45
|
+
r as CardTitle,
|
|
46
|
+
o as CardToggle,
|
|
47
|
+
i as CollapsibleContainer
|
|
48
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapsible card component props. The content, passed as children, is
|
|
3
|
+
* mounted only while the card is open.
|
|
4
|
+
* @interface ICollapsibleCardProps
|
|
5
|
+
* @property { boolean } [expanded] - Whether the card starts open. Later
|
|
6
|
+
* changes to it are ignored; the card keeps its own open state.
|
|
7
|
+
* @property { string } title - Title shown in the header, which also names
|
|
8
|
+
* the toggle button.
|
|
9
|
+
*/
|
|
10
|
+
interface ICollapsibleCardProps {
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
14
|
+
export type { ICollapsibleCardProps };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IComparisonRow, IComparisonTableProps } from './types';
|
|
2
|
+
declare const ComparisonTable: ({ currentHeader, labelHeader, previousHeader, rows, }: Readonly<IComparisonTableProps>) => JSX.Element;
|
|
3
|
+
export { ComparisonTable };
|
|
4
|
+
export type { IComparisonRow, IComparisonTableProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { ComparisonFrame as p, StyledComparisonTable as m, ComparisonRow as u } from "./styles.js";
|
|
3
|
+
const i = "—", s = (e) => e === void 0 || e.trim() === "" ? void 0 : e, b = (e, o) => e === o ? "unchanged" : e === void 0 ? "added" : "changed", g = ({
|
|
4
|
+
currentHeader: e,
|
|
5
|
+
labelHeader: o,
|
|
6
|
+
previousHeader: h,
|
|
7
|
+
rows: l
|
|
8
|
+
}) => /* @__PURE__ */ r(p, { children: /* @__PURE__ */ n(m, { children: [
|
|
9
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
10
|
+
/* @__PURE__ */ r("th", { scope: "col", children: o }),
|
|
11
|
+
/* @__PURE__ */ r("th", { scope: "col", children: h }),
|
|
12
|
+
/* @__PURE__ */ r("th", { scope: "col", children: e })
|
|
13
|
+
] }) }),
|
|
14
|
+
/* @__PURE__ */ r("tbody", { children: l.map((t, a) => {
|
|
15
|
+
const c = s(t.previous), d = s(t.current);
|
|
16
|
+
return /* @__PURE__ */ n(
|
|
17
|
+
u,
|
|
18
|
+
{
|
|
19
|
+
$status: b(c, d),
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ r("th", { scope: "row", children: t.label }),
|
|
22
|
+
/* @__PURE__ */ r("td", { children: c ?? i }),
|
|
23
|
+
/* @__PURE__ */ r("td", { children: d ?? i })
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
a
|
|
27
|
+
);
|
|
28
|
+
}) })
|
|
29
|
+
] }) });
|
|
30
|
+
export {
|
|
31
|
+
g as ComparisonTable
|
|
32
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
2
|
+
import { IComparisonTableProps } from './types';
|
|
3
|
+
declare const config: Meta;
|
|
4
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComparisonTableProps>;
|
|
5
|
+
declare const WithoutPrevious: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComparisonTableProps>;
|
|
6
|
+
declare const Narrow: StoryFn<IComparisonTableProps>;
|
|
7
|
+
export { Default, Narrow, WithoutPrevious };
|
|
8
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TComparisonStatus } from './types';
|
|
2
|
+
interface IStyledComparisonRow {
|
|
3
|
+
$status: TComparisonStatus;
|
|
4
|
+
}
|
|
5
|
+
declare const ComparisonFrame: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
6
|
+
declare const StyledComparisonTable: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>>> & string;
|
|
7
|
+
declare const ComparisonRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$status"> & IStyledComparisonRow, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$status"> & IStyledComparisonRow, never>>> & string;
|
|
8
|
+
export { ComparisonFrame, ComparisonRow, StyledComparisonTable };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { styled as o } from "styled-components";
|
|
2
|
+
import { variantBuilder as r } from "../@core/variants/utils.js";
|
|
3
|
+
const { getVariant: i } = r(
|
|
4
|
+
(t) => {
|
|
5
|
+
const a = `
|
|
6
|
+
background-color: ${t.palette.warning[200]}26;
|
|
7
|
+
|
|
8
|
+
> th {
|
|
9
|
+
box-shadow: inset 2px 0 0 ${t.palette.warning[500]};
|
|
10
|
+
padding-left: calc(${t.spacing[0.625]} + 2px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
> td:nth-of-type(2) {
|
|
14
|
+
color: ${t.palette.warning[600]};
|
|
15
|
+
font-weight: ${t.typography.weight.bold};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
return {
|
|
19
|
+
added: a,
|
|
20
|
+
changed: `
|
|
21
|
+
${a}
|
|
22
|
+
|
|
23
|
+
> td:nth-of-type(1) {
|
|
24
|
+
color: ${t.palette.gray[800]};
|
|
25
|
+
font-weight: ${t.typography.weight.bold};
|
|
26
|
+
}
|
|
27
|
+
`,
|
|
28
|
+
unchanged: ""
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
), l = o.div`
|
|
32
|
+
${({ theme: t }) => `
|
|
33
|
+
background-color: ${t.palette.white};
|
|
34
|
+
border: 1px solid ${t.palette.gray[100]};
|
|
35
|
+
border-radius: ${t.spacing[0.25]};
|
|
36
|
+
container-type: inline-size;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
`}
|
|
39
|
+
`, n = o.table`
|
|
40
|
+
${({ theme: t }) => `
|
|
41
|
+
border-collapse: collapse;
|
|
42
|
+
font-family: ${t.typography.type.primary};
|
|
43
|
+
font-size: ${t.typography.text.md};
|
|
44
|
+
line-height: ${t.spacing[1.25]};
|
|
45
|
+
table-layout: fixed;
|
|
46
|
+
width: 100%;
|
|
47
|
+
|
|
48
|
+
th,
|
|
49
|
+
td {
|
|
50
|
+
border-bottom: 1px solid ${t.palette.gray[200]};
|
|
51
|
+
border-right: 1px solid ${t.palette.gray[200]};
|
|
52
|
+
padding: 0 ${t.spacing[0.625]};
|
|
53
|
+
text-align: start;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
th:last-child,
|
|
57
|
+
td:last-child {
|
|
58
|
+
border-color: ${t.palette.gray[100]};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
thead th {
|
|
62
|
+
background-color: ${t.palette.gray[600]};
|
|
63
|
+
color: ${t.palette.white};
|
|
64
|
+
font-weight: ${t.typography.weight.bold};
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
padding-bottom: ${t.spacing[0.25]};
|
|
67
|
+
padding-top: ${t.spacing[0.25]};
|
|
68
|
+
white-space: pre;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
thead th:first-child {
|
|
72
|
+
width: 150px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Beside a 150px label column, a header line of about 80px only fits
|
|
76
|
+
down to a 330px table. Narrower, the label column gives width back to
|
|
77
|
+
the values and headers also wrap at spaces. A fixed-layout table
|
|
78
|
+
ignores min() on a cell width, hence the query rather than one rule. */
|
|
79
|
+
@container (max-width: 330px) {
|
|
80
|
+
thead th {
|
|
81
|
+
white-space: pre-line;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
thead th:first-child {
|
|
85
|
+
width: 40%;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
tbody tr {
|
|
90
|
+
height: ${t.spacing[1.75]};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
tbody th,
|
|
94
|
+
tbody td {
|
|
95
|
+
color: ${t.palette.gray[600]};
|
|
96
|
+
font-weight: ${t.typography.weight.regular};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
tbody tr:last-child > * {
|
|
100
|
+
border-bottom: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
tbody tr:last-child > td:last-child {
|
|
104
|
+
border-right: none;
|
|
105
|
+
}
|
|
106
|
+
`}
|
|
107
|
+
`, p = o.tr`
|
|
108
|
+
${({ $status: t, theme: a }) => i(a, t)}
|
|
109
|
+
`;
|
|
110
|
+
export {
|
|
111
|
+
l as ComparisonFrame,
|
|
112
|
+
p as ComparisonRow,
|
|
113
|
+
n as StyledComparisonTable
|
|
114
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comparison table row.
|
|
3
|
+
* @interface IComparisonRow
|
|
4
|
+
* @property {string} current - Value after the change.
|
|
5
|
+
* @property {string} label - Name of the compared property.
|
|
6
|
+
* @property {string} [previous] - Value before the change. Leave it undefined
|
|
7
|
+
* when there is no previous value. A blank value counts as missing, and its
|
|
8
|
+
* cell shows an em dash.
|
|
9
|
+
*/
|
|
10
|
+
interface IComparisonRow {
|
|
11
|
+
current: string;
|
|
12
|
+
label: string;
|
|
13
|
+
previous?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Comparison table component props. A row is highlighted when its previous
|
|
17
|
+
* and current values differ, which includes every row without a previous
|
|
18
|
+
* value. Headers break where they hold a "\n", and also wrap at spaces when
|
|
19
|
+
* the table is narrower than 330px.
|
|
20
|
+
* @interface IComparisonTableProps
|
|
21
|
+
* @property {string} currentHeader - Header of the current values column.
|
|
22
|
+
* @property {string} labelHeader - Header of the property names column.
|
|
23
|
+
* @property {string} previousHeader - Header of the previous values column.
|
|
24
|
+
* @property {IComparisonRow[]} rows - Rows to compare, in display order.
|
|
25
|
+
*/
|
|
26
|
+
interface IComparisonTableProps {
|
|
27
|
+
currentHeader: string;
|
|
28
|
+
labelHeader: string;
|
|
29
|
+
previousHeader: string;
|
|
30
|
+
rows: IComparisonRow[];
|
|
31
|
+
}
|
|
32
|
+
type TComparisonStatus = "added" | "changed" | "unchanged";
|
|
33
|
+
export type { IComparisonRow, IComparisonTableProps, TComparisonStatus };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ITagProps, TTagVariant } from './types';
|
|
2
|
-
declare const Tag: ({ disabled, dot, icon, iconColor, iconType, id, filterId, filterValues, fontSize, href, linkLabel, onBodyClick, onClose, priority, selected, tagTitle, tagLabel, truncate, variant, }: Readonly<ITagProps>) => JSX.Element;
|
|
2
|
+
declare const Tag: ({ disabled, dot, icon, iconColor, iconType, id, filterId, filterValues, fontSize, fullWidth, href, linkLabel, onBodyClick, onClose, priority, selected, tagTitle, tagLabel, truncate, variant, }: Readonly<ITagProps>) => JSX.Element;
|
|
3
3
|
export type { ITagProps, TTagVariant };
|
|
4
4
|
export { Tag };
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { l as
|
|
3
|
-
import { StyledTag as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { IconButton as
|
|
2
|
+
import { l as k } from "../../_virtual/lodash.js";
|
|
3
|
+
import { StyledTag as E, StyledTagContent as j, StyledDot as K } from "./styles.js";
|
|
4
|
+
import { Icon as P } from "../icon/index.js";
|
|
5
|
+
import { IconButton as W } from "../icon-button/index.js";
|
|
6
6
|
import { Link as C } from "../link/index.js";
|
|
7
7
|
import "../typography/heading/index.js";
|
|
8
|
-
import { Span as
|
|
8
|
+
import { Span as q } from "../typography/span/index.js";
|
|
9
9
|
import "../typography/text/index.js";
|
|
10
|
-
const
|
|
10
|
+
const U = ({
|
|
11
11
|
disabled: f,
|
|
12
12
|
dot: h = !1,
|
|
13
|
-
icon:
|
|
13
|
+
icon: d,
|
|
14
14
|
iconColor: u = "inherit",
|
|
15
15
|
iconType: v = "fa-light",
|
|
16
16
|
id: g = "close-tag",
|
|
17
17
|
filterId: x = "",
|
|
18
|
-
filterValues:
|
|
18
|
+
filterValues: c = "",
|
|
19
19
|
fontSize: y,
|
|
20
|
+
fullWidth: S = !1,
|
|
20
21
|
href: r,
|
|
21
|
-
linkLabel:
|
|
22
|
+
linkLabel: $,
|
|
22
23
|
onBodyClick: i,
|
|
23
24
|
onClose: n,
|
|
24
|
-
priority:
|
|
25
|
+
priority: T = "default",
|
|
25
26
|
selected: a,
|
|
26
27
|
tagTitle: p = "",
|
|
27
|
-
tagLabel:
|
|
28
|
-
truncate:
|
|
29
|
-
variant:
|
|
28
|
+
tagLabel: l,
|
|
29
|
+
truncate: w = !0,
|
|
30
|
+
variant: z = "default"
|
|
30
31
|
}) => {
|
|
31
|
-
const
|
|
32
|
+
const D = l.length > 25 && w && k.isEmpty(p + c), I = `${l.slice(0, 25)}...`, N = (t) => {
|
|
32
33
|
t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i?.());
|
|
33
|
-
},
|
|
34
|
+
}, b = (t) => {
|
|
34
35
|
t.stopPropagation(), n?.();
|
|
35
|
-
},
|
|
36
|
+
}, s = i !== void 0, m = s && typeof a == "boolean";
|
|
36
37
|
return /* @__PURE__ */ e(
|
|
37
|
-
|
|
38
|
+
q,
|
|
38
39
|
{
|
|
39
40
|
className: "gap-0.5",
|
|
40
41
|
color: "inherit",
|
|
@@ -42,42 +43,43 @@ const R = ({
|
|
|
42
43
|
size: "md",
|
|
43
44
|
children: [
|
|
44
45
|
/* @__PURE__ */ e(
|
|
45
|
-
|
|
46
|
+
E,
|
|
46
47
|
{
|
|
47
48
|
$fontSize: y,
|
|
48
|
-
$
|
|
49
|
+
$fullWidth: S,
|
|
50
|
+
$interactive: s,
|
|
49
51
|
$selectable: m,
|
|
50
52
|
$selected: a === !0,
|
|
51
|
-
$variant:
|
|
52
|
-
className:
|
|
53
|
+
$variant: z,
|
|
54
|
+
className: T,
|
|
53
55
|
"data-testid": x,
|
|
54
|
-
...
|
|
56
|
+
...s && {
|
|
55
57
|
...m ? { "aria-pressed": a } : {},
|
|
56
58
|
onClick: i,
|
|
57
|
-
onKeyDown:
|
|
59
|
+
onKeyDown: N,
|
|
58
60
|
role: "button",
|
|
59
61
|
tabIndex: 0
|
|
60
62
|
},
|
|
61
63
|
children: [
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
/* @__PURE__ */ e(j, { children: [
|
|
65
|
+
d ? /* @__PURE__ */ o(
|
|
66
|
+
P,
|
|
65
67
|
{
|
|
66
|
-
icon:
|
|
68
|
+
icon: d,
|
|
67
69
|
iconColor: u,
|
|
68
70
|
iconSize: "sm",
|
|
69
71
|
iconType: v
|
|
70
72
|
}
|
|
71
73
|
) : void 0,
|
|
72
|
-
h ? /* @__PURE__ */ o(
|
|
74
|
+
h ? /* @__PURE__ */ o(K, { "data-testid": "tag-dot" }) : void 0,
|
|
73
75
|
/* @__PURE__ */ e("span", { className: "w-full", children: [
|
|
74
76
|
/* @__PURE__ */ o("strong", { children: p }),
|
|
75
|
-
/* @__PURE__ */ o("span", { children:
|
|
76
|
-
/* @__PURE__ */ o("strong", { className: "w-full", children:
|
|
77
|
+
/* @__PURE__ */ o("span", { children: D ? I : l }),
|
|
78
|
+
/* @__PURE__ */ o("strong", { className: "w-full", children: c })
|
|
77
79
|
] })
|
|
78
80
|
] }),
|
|
79
81
|
n ? /* @__PURE__ */ o(
|
|
80
|
-
|
|
82
|
+
W,
|
|
81
83
|
{
|
|
82
84
|
disabled: f,
|
|
83
85
|
icon: "xmark",
|
|
@@ -85,7 +87,7 @@ const R = ({
|
|
|
85
87
|
iconSize: "xs",
|
|
86
88
|
iconType: "fa-light",
|
|
87
89
|
id: g,
|
|
88
|
-
onClick: i !== void 0 ?
|
|
90
|
+
onClick: i !== void 0 ? b : n,
|
|
89
91
|
px: 0.125,
|
|
90
92
|
py: 0.125,
|
|
91
93
|
variant: "ghost"
|
|
@@ -94,11 +96,11 @@ const R = ({
|
|
|
94
96
|
]
|
|
95
97
|
}
|
|
96
98
|
),
|
|
97
|
-
r === void 0 ? void 0 : /* @__PURE__ */ o(C, { href: r, children:
|
|
99
|
+
r === void 0 ? void 0 : /* @__PURE__ */ o(C, { href: r, children: $ })
|
|
98
100
|
]
|
|
99
101
|
}
|
|
100
102
|
);
|
|
101
103
|
};
|
|
102
104
|
export {
|
|
103
|
-
|
|
105
|
+
U as Tag
|
|
104
106
|
};
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { styled as a } from "styled-components";
|
|
2
2
|
import { variantBuilder as i } from "../@core/variants/utils.js";
|
|
3
|
-
const { getVariant:
|
|
3
|
+
const { getVariant: g } = i(
|
|
4
4
|
(o) => ({
|
|
5
5
|
complementary: `
|
|
6
6
|
background-color: ${o.palette.complementary[300]};
|
|
7
7
|
color: ${o.palette.white};
|
|
8
8
|
`,
|
|
9
|
+
cwe: `
|
|
10
|
+
--tag-padding-y: calc(${o.spacing[0.125]} - 1px);
|
|
11
|
+
--tag-padding-x: ${o.spacing[0.25]};
|
|
12
|
+
|
|
13
|
+
background-color: ${o.palette.gray[50]};
|
|
14
|
+
border: 1px solid ${o.palette.gray[300]};
|
|
15
|
+
border-radius: ${o.spacing[0.5]};
|
|
16
|
+
color: ${o.palette.gray[600]};
|
|
17
|
+
|
|
18
|
+
a:hover & {
|
|
19
|
+
text-decoration: underline;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
9
22
|
default: `
|
|
10
23
|
background-color: ${o.palette.gray[100]};
|
|
11
24
|
color: ${o.palette.gray[600]};
|
|
@@ -47,6 +60,21 @@ const { getVariant: p } = i(
|
|
|
47
60
|
color: ${o.palette.info[50]};
|
|
48
61
|
}
|
|
49
62
|
`,
|
|
63
|
+
overflow: `
|
|
64
|
+
--tag-padding-y: calc(${o.spacing[0.125]} - 1px);
|
|
65
|
+
--tag-padding-x: ${o.spacing[0.25]};
|
|
66
|
+
|
|
67
|
+
background-color: ${o.palette.gray[300]};
|
|
68
|
+
border: 1px solid ${o.palette.gray[300]};
|
|
69
|
+
border-radius: ${o.spacing[0.5]};
|
|
70
|
+
color: ${o.palette.gray[600]};
|
|
71
|
+
|
|
72
|
+
&[role="button"]:hover {
|
|
73
|
+
background-color: ${o.palette.gray[500]};
|
|
74
|
+
border-color: ${o.palette.gray[500]};
|
|
75
|
+
color: ${o.palette.gray[25]};
|
|
76
|
+
}
|
|
77
|
+
`,
|
|
50
78
|
reachable: `
|
|
51
79
|
background-color: ${o.palette.gray[50]};
|
|
52
80
|
color: ${o.palette.gray[800]};
|
|
@@ -106,14 +134,15 @@ const { getVariant: p } = i(
|
|
|
106
134
|
&:hover {
|
|
107
135
|
background-color: ${r ? o.palette.gray[800] : o.palette.gray[100]};
|
|
108
136
|
}
|
|
109
|
-
`,
|
|
137
|
+
`, $ = a.span`
|
|
110
138
|
${({
|
|
111
139
|
theme: o,
|
|
112
140
|
$fontSize: r = o.typography.text.sm,
|
|
141
|
+
$fullWidth: t = !1,
|
|
113
142
|
$variant: l,
|
|
114
|
-
$interactive:
|
|
115
|
-
$selectable:
|
|
116
|
-
$selected:
|
|
143
|
+
$interactive: n = !1,
|
|
144
|
+
$selectable: c = !1,
|
|
145
|
+
$selected: p = !1
|
|
117
146
|
}) => `
|
|
118
147
|
align-items: center;
|
|
119
148
|
border-radius: ${o.spacing[l === "technique" ? 1 : 0.25]};
|
|
@@ -127,8 +156,8 @@ const { getVariant: p } = i(
|
|
|
127
156
|
line-height: 18px;
|
|
128
157
|
padding: var(--tag-padding-y) var(--tag-padding-x);
|
|
129
158
|
white-space: nowrap;
|
|
130
|
-
width: max-content;
|
|
131
|
-
${
|
|
159
|
+
width: ${t ? "100%" : "max-content"};
|
|
160
|
+
${n && !c ? "cursor: pointer;" : ""}
|
|
132
161
|
|
|
133
162
|
~ a {
|
|
134
163
|
font-size: ${o.typography.text.xs};
|
|
@@ -148,17 +177,17 @@ const { getVariant: p } = i(
|
|
|
148
177
|
}
|
|
149
178
|
}
|
|
150
179
|
|
|
151
|
-
${
|
|
152
|
-
${
|
|
180
|
+
${g(o, l)}
|
|
181
|
+
${c ? e(o, p) : ""}
|
|
153
182
|
`}
|
|
154
|
-
`,
|
|
183
|
+
`, u = a.span`
|
|
155
184
|
${({ theme: o }) => `
|
|
156
185
|
align-items: center;
|
|
157
186
|
display: inline-flex;
|
|
158
187
|
gap: ${o.spacing[0.25]};
|
|
159
188
|
min-width: 0;
|
|
160
189
|
`}
|
|
161
|
-
`,
|
|
190
|
+
`, y = a.span`
|
|
162
191
|
background-color: currentColor;
|
|
163
192
|
border-radius: 50%;
|
|
164
193
|
flex-shrink: 0;
|
|
@@ -166,7 +195,7 @@ const { getVariant: p } = i(
|
|
|
166
195
|
width: 6px;
|
|
167
196
|
`;
|
|
168
197
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
198
|
+
y as StyledDot,
|
|
199
|
+
$ as StyledTag,
|
|
200
|
+
u as StyledTagContent
|
|
172
201
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IIconModifiable } from '../@core';
|
|
2
|
-
type TTagVariant = "complementary" | "default" | "error" | "inactive" | "inactiveOutline" | "info" | "reachable" | "remediation" | "role" | "success" | "technique" | "warning";
|
|
2
|
+
type TTagVariant = "complementary" | "cwe" | "default" | "error" | "inactive" | "inactiveOutline" | "info" | "overflow" | "reachable" | "remediation" | "role" | "success" | "technique" | "warning";
|
|
3
3
|
type TTagPriority = "default" | "high" | "low" | "medium";
|
|
4
4
|
/**
|
|
5
5
|
* Tag component props.
|
|
@@ -10,6 +10,8 @@ type TTagPriority = "default" | "high" | "low" | "medium";
|
|
|
10
10
|
* @property { boolean } [dot] - Whether to render a status dot before the label.
|
|
11
11
|
* @property { string } [filterValues] - The filter values for the tag.
|
|
12
12
|
* @property { string } [fontSize] - The font size for the tag.
|
|
13
|
+
* @property { boolean } [fullWidth] - Whether the tag fills the width of its
|
|
14
|
+
* container instead of fitting its content.
|
|
13
15
|
* @property { string } [href] - The href for the tag.
|
|
14
16
|
* @property { string } [linkLabel] - The link label for the tag.
|
|
15
17
|
* @property { Function } [onClose] - Function handler for close button click.
|
|
@@ -29,6 +31,7 @@ interface ITagProps extends Partial<Pick<IIconModifiable, "icon" | "iconColor" |
|
|
|
29
31
|
filterValues?: string;
|
|
30
32
|
filterId?: string;
|
|
31
33
|
fontSize?: string;
|
|
34
|
+
fullWidth?: boolean;
|
|
32
35
|
href?: string;
|
|
33
36
|
linkLabel?: string;
|
|
34
37
|
onBodyClick?: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export * from './components/checkbox';
|
|
|
12
12
|
export * from './components/circular-progress';
|
|
13
13
|
export * from './components/cloud-image';
|
|
14
14
|
export * from './components/code-snippet';
|
|
15
|
+
export * from './components/collapsible-card';
|
|
15
16
|
export * from './components/colors';
|
|
17
|
+
export * from './components/comparison-table';
|
|
16
18
|
export * from './components/conditions-dialog';
|
|
17
19
|
export * from './components/confirm-dialog';
|
|
18
20
|
export * from './components/container';
|