@fluidattacks/design 8.3.0 → 8.4.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,43 @@
1
- import { jsx as r, jsxs as s } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
2
  import { useRef as k, useState as j, useCallback as m } from "react";
3
3
  import { createPortal as w } from "react-dom";
4
4
  import { useTheme as H } from "styled-components";
5
- import { ModalWrapper as S, ModalContainer as P } from "../styles.js";
5
+ import { Dialog as S } from "../dialog/index.js";
6
+ import { ModalContainer as D } from "../styles.js";
6
7
  import { Button as p } from "../../button/index.js";
7
8
  import { Container as c } from "../../container/index.js";
8
9
  import { Divider as d } from "../../divider/index.js";
9
- import { IconButton as T } from "../../icon-button/index.js";
10
- import { PreviewPanel as z } from "./preview-panel/index.js";
11
- import { SearchPanel as B } from "./search-panel/index.js";
12
- import { Heading as D } from "../../typography/heading/index.js";
10
+ import { IconButton as P } from "../../icon-button/index.js";
11
+ import { PreviewPanel as T } from "./preview-panel/index.js";
12
+ import { SearchPanel as z } from "./search-panel/index.js";
13
+ import { Heading as B } from "../../typography/heading/index.js";
13
14
  import "../../typography/span/index.js";
14
15
  import "../../typography/text/index.js";
15
- const N = ({
16
+ const U = ({
16
17
  _containerId: h = "portals",
17
18
  title: y,
18
19
  modalRef: e,
19
20
  variant: f
20
21
  }) => {
21
22
  const a = H(), u = k(null), [o, g] = j(void 0), C = m(
22
- (t) => {
23
- const { checked: n, value: i } = t.target, x = e.columns.map((l) => l.name === i ? (l.toggleVisibility?.(n), { ...l, visible: n }) : l);
23
+ (i) => {
24
+ const { checked: n, value: r } = i.target, x = e.columns.map((s) => s.name === r ? (s.toggleVisibility?.(n), { ...s, visible: n }) : s);
24
25
  e.setColumns(x);
25
26
  },
26
27
  [e]
27
28
  ), b = m(
28
- (t) => {
29
- const n = e.columns.map((i) => i.id === t ? (i.toggleVisibility?.(!1), { ...i, visible: !1 }) : i);
29
+ (i) => {
30
+ const n = e.columns.map((r) => r.id === i ? (r.toggleVisibility?.(!1), { ...r, visible: !1 }) : r);
30
31
  e.setColumns(n);
31
32
  },
32
33
  [e]
33
34
  ), v = m(() => {
34
- const t = u.current?.scrollHeight;
35
- o !== t && g(t);
35
+ const i = u.current?.scrollHeight;
36
+ o !== i && g(i);
36
37
  }, [o]);
37
38
  return e.isOpen ? w(
38
- /* @__PURE__ */ r(S, { "aria-label": e.name, "aria-modal": "true", children: /* @__PURE__ */ s(P, { $size: "md", flexDirection: "column", children: [
39
- /* @__PURE__ */ s(
39
+ /* @__PURE__ */ t(S, { label: e.name, children: /* @__PURE__ */ l(D, { $size: "md", flexDirection: "column", children: [
40
+ /* @__PURE__ */ l(
40
41
  c,
41
42
  {
42
43
  display: "flex",
@@ -44,9 +45,9 @@ const N = ({
44
45
  px: 1.25,
45
46
  py: 1.25,
46
47
  children: [
47
- /* @__PURE__ */ r(D, { size: "sm", children: y }),
48
- /* @__PURE__ */ r(
49
- T,
48
+ /* @__PURE__ */ t(B, { size: "sm", children: y }),
49
+ /* @__PURE__ */ t(
50
+ P,
50
51
  {
51
52
  icon: "close",
52
53
  iconColor: a.palette.gray[400],
@@ -63,8 +64,8 @@ const N = ({
63
64
  ]
64
65
  }
65
66
  ),
66
- /* @__PURE__ */ r(d, { mb: 0, mt: 0 }),
67
- /* @__PURE__ */ s(
67
+ /* @__PURE__ */ t(d, { mb: 0, mt: 0 }),
68
+ /* @__PURE__ */ l(
68
69
  c,
69
70
  {
70
71
  display: "flex",
@@ -75,8 +76,8 @@ const N = ({
75
76
  scroll: "y",
76
77
  width: "100%",
77
78
  children: [
78
- /* @__PURE__ */ r(
79
- B,
79
+ /* @__PURE__ */ t(
80
+ z,
80
81
  {
81
82
  columns: e.columns,
82
83
  formId: "columns-visibility",
@@ -84,15 +85,15 @@ const N = ({
84
85
  variant: f
85
86
  }
86
87
  ),
87
- /* @__PURE__ */ r(
88
+ /* @__PURE__ */ t(
88
89
  c,
89
90
  {
90
91
  borderLeft: `2px solid ${a.palette.gray[100]}`,
91
92
  height: o ? `${o}px` : "auto"
92
93
  }
93
94
  ),
94
- /* @__PURE__ */ r(
95
- z,
95
+ /* @__PURE__ */ t(
96
+ T,
96
97
  {
97
98
  description: "Click and drag to reorder the columns",
98
99
  items: e.columns,
@@ -104,8 +105,8 @@ const N = ({
104
105
  ]
105
106
  }
106
107
  ),
107
- /* @__PURE__ */ r(d, { mb: 0, mt: 0 }),
108
- /* @__PURE__ */ s(
108
+ /* @__PURE__ */ t(d, { mb: 0, mt: 0 }),
109
+ /* @__PURE__ */ l(
109
110
  c,
110
111
  {
111
112
  display: "flex",
@@ -113,7 +114,7 @@ const N = ({
113
114
  px: 1.25,
114
115
  py: 1.25,
115
116
  children: [
116
- /* @__PURE__ */ r(
117
+ /* @__PURE__ */ t(
117
118
  p,
118
119
  {
119
120
  disabled: !e.hasChanged,
@@ -126,7 +127,7 @@ const N = ({
126
127
  children: "Reset to default"
127
128
  }
128
129
  ),
129
- /* @__PURE__ */ r(
130
+ /* @__PURE__ */ t(
130
131
  p,
131
132
  {
132
133
  id: "columns-modal-submit",
@@ -141,8 +142,8 @@ const N = ({
141
142
  )
142
143
  ] }) }),
143
144
  document.getElementById(h) ?? document.body
144
- ) : /* @__PURE__ */ r("div", {});
145
+ ) : /* @__PURE__ */ t("div", {});
145
146
  };
146
147
  export {
147
- N as ColumnsModal
148
+ U as ColumnsModal
148
149
  };
@@ -0,0 +1,4 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { IDialogProps } from '../types';
3
+ declare const Dialog: ({ children, id, label, }: Readonly<PropsWithChildren<IDialogProps>>) => JSX.Element;
4
+ export { Dialog };
@@ -0,0 +1,32 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { useRef as f, useState as c } from "react";
3
+ import { trapTabKey as o } from "./utils.js";
4
+ import { ModalWrapper as p } from "../styles.js";
5
+ import { useMountEffect as s } from "../../../hooks/use-mount-effect.js";
6
+ const w = ({
7
+ children: n = void 0,
8
+ id: a = void 0,
9
+ label: i
10
+ }) => {
11
+ const r = f(null), [t] = c(() => document.activeElement);
12
+ return s(() => {
13
+ const e = r.current;
14
+ return e?.contains(document.activeElement) !== !0 && e?.focus(), e?.addEventListener("keydown", o), () => {
15
+ e?.removeEventListener("keydown", o), t instanceof HTMLElement && t.focus();
16
+ };
17
+ }), /* @__PURE__ */ m(
18
+ p,
19
+ {
20
+ "aria-label": i,
21
+ "aria-modal": "true",
22
+ id: a,
23
+ ref: r,
24
+ role: "dialog",
25
+ tabIndex: -1,
26
+ children: n
27
+ }
28
+ );
29
+ };
30
+ export {
31
+ w as Dialog
32
+ };
@@ -0,0 +1,2 @@
1
+ declare const trapTabKey: (event: Readonly<KeyboardEvent>) => void;
2
+ export { trapTabKey };
@@ -0,0 +1,26 @@
1
+ const s = [
2
+ "a[href]",
3
+ "area[href]",
4
+ "button:not([disabled])",
5
+ "input:not([disabled]):not([type='hidden'])",
6
+ "select:not([disabled])",
7
+ "textarea:not([disabled])",
8
+ "iframe",
9
+ "[contenteditable='true']",
10
+ "[tabindex]:not([tabindex='-1'])"
11
+ ].join(", "), c = (t) => Array.from(t.querySelectorAll(s)), d = (t) => {
12
+ const { currentTarget: n } = t;
13
+ if (t.key !== "Tab" || !(n instanceof HTMLElement)) return;
14
+ const e = c(n);
15
+ if (e.length === 0) {
16
+ t.preventDefault();
17
+ return;
18
+ }
19
+ const a = e.findIndex(
20
+ (r) => r === document.activeElement
21
+ ), o = t.shiftKey && a <= 0, i = !t.shiftKey && a === e.length - 1;
22
+ (o || i) && (t.preventDefault(), e[o ? e.length - 1 : 0].focus());
23
+ };
24
+ export {
25
+ d as trapTabKey
26
+ };
@@ -1,26 +1,27 @@
1
- import { jsx as i, jsxs as v } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
2
  import o from "../../_virtual/lodash.js";
3
3
  import { useState as E, useRef as y, useEffect as F } from "react";
4
4
  import { createPortal as $ } from "react-dom";
5
5
  import { useTheme as z } from "styled-components";
6
- import { ModalFooter as k } from "./footer/index.js";
7
- import { Header as A } from "./header/index.js";
8
- import { ModalConfirm as mr } from "./modal-confirm/index.js";
9
- import { ModalWrapper as I, ModalContainer as w, ModalContent as B, ImageContainer as D } from "./styles.js";
6
+ import { Dialog as k } from "./dialog/index.js";
7
+ import { ModalFooter as A } from "./footer/index.js";
8
+ import { Header as D } from "./header/index.js";
9
+ import { ModalConfirm as si } from "./modal-confirm/index.js";
10
+ import { ModalContainer as I, ModalContent as w, ImageContainer as B } from "./styles.js";
10
11
  import { CloudImage as N } from "../cloud-image/index.js";
11
12
  import { Container as P } from "../container/index.js";
12
- import { Tabs as W } from "../tabs/index.js";
13
+ import { Tabs as _ } from "../tabs/index.js";
13
14
  import "../typography/heading/index.js";
14
15
  import "../typography/span/index.js";
15
- import { Text as _ } from "../typography/text/index.js";
16
- import { ColumnsModal as ar } from "./columns-modal/index.js";
17
- const er = ({
16
+ import { Text as q } from "../typography/text/index.js";
17
+ import { ColumnsModal as ai } from "./columns-modal/index.js";
18
+ const oi = ({
18
19
  _portal: b = !0,
19
20
  alert: C,
20
21
  cancelButton: n = void 0,
21
22
  children: l = void 0,
22
23
  confirmButton: p = void 0,
23
- content: r = void 0,
24
+ content: i = void 0,
24
25
  description: M = void 0,
25
26
  dismissable: O = !0,
26
27
  modalRef: e,
@@ -31,84 +32,76 @@ const er = ({
31
32
  size: H,
32
33
  id: c = "modal-container"
33
34
  }) => {
34
- const f = z(), [u, g] = E(void 0), a = y(null), d = y(!1), m = Array.isArray(t) && t.length > 0, S = n ?? p;
35
+ const f = z(), [g, u] = E(void 0), d = y(null), a = y(!1), m = Array.isArray(t) && t.length > 0, S = n ?? p;
35
36
  F(() => {
36
- if (m && !d.current && a.current) {
37
- const x = a.current.getBoundingClientRect().height;
38
- x > 50 && (g(x), d.current = !0);
37
+ if (m && !a.current && d.current) {
38
+ const x = d.current.getBoundingClientRect().height;
39
+ x > 50 && (u(x), a.current = !0);
39
40
  }
40
- e.isOpen || (g(void 0), d.current = !1);
41
+ e.isOpen || (u(void 0), a.current = !1);
41
42
  }, [m, e.isOpen]);
42
- const h = /* @__PURE__ */ i(
43
+ const h = /* @__PURE__ */ r(k, { id: "modal-wrapper", label: e.name, children: /* @__PURE__ */ v(
43
44
  I,
44
45
  {
45
- "aria-label": e.name,
46
- "aria-modal": "true",
47
- id: "modal-wrapper",
48
- children: /* @__PURE__ */ v(
49
- w,
50
- {
51
- $size: H,
52
- "data-testid": c,
53
- flexDirection: "column",
54
- id: c,
55
- ref: m ? a : void 0,
56
- style: m && u ? { height: u } : void 0,
57
- children: [
58
- !o.isEmpty(s) && !o.isNil(s) && /* @__PURE__ */ i(
59
- A,
60
- {
61
- description: M,
62
- dismissable: O,
63
- modalRef: e,
64
- onClose: j,
65
- otherActions: T,
66
- title: s
67
- }
68
- ),
69
- t && /* @__PURE__ */ i(
70
- P,
71
- {
72
- borderTop: `1px solid ${f.palette.gray[300]}`,
73
- display: "block",
74
- mb: 1.25,
75
- position: "sticky",
76
- children: /* @__PURE__ */ i(W, { items: t })
77
- }
78
- ),
79
- (o.isObject(r) || l) && /* @__PURE__ */ v(
80
- B,
81
- {
82
- style: S ? { borderBottom: `1px solid ${f.palette.gray[200]}` } : void 0,
83
- children: [
84
- l,
85
- o.isObject(r) && o.isString(r.imageSrc) && /* @__PURE__ */ i(D, { $framed: r.imageFramed, children: /* @__PURE__ */ i(N, { alt: "modal-img", publicId: r.imageSrc }) }),
86
- o.isObject(r) && o.isString(r.imageText) && /* @__PURE__ */ i(_, { size: "md", children: r.imageText })
87
- ]
88
- }
89
- ),
90
- /* @__PURE__ */ i(
91
- k,
92
- {
93
- alert: C,
94
- cancelButton: n,
95
- confirmButton: p,
96
- modalRef: e
97
- }
98
- )
99
- ]
100
- }
101
- )
46
+ $size: H,
47
+ "data-testid": c,
48
+ flexDirection: "column",
49
+ id: c,
50
+ ref: m ? d : void 0,
51
+ style: m && g ? { height: g } : void 0,
52
+ children: [
53
+ !o.isEmpty(s) && !o.isNil(s) && /* @__PURE__ */ r(
54
+ D,
55
+ {
56
+ description: M,
57
+ dismissable: O,
58
+ modalRef: e,
59
+ onClose: j,
60
+ otherActions: T,
61
+ title: s
62
+ }
63
+ ),
64
+ t && /* @__PURE__ */ r(
65
+ P,
66
+ {
67
+ borderTop: `1px solid ${f.palette.gray[300]}`,
68
+ display: "block",
69
+ mb: 1.25,
70
+ position: "sticky",
71
+ children: /* @__PURE__ */ r(_, { items: t })
72
+ }
73
+ ),
74
+ (o.isObject(i) || l) && /* @__PURE__ */ v(
75
+ w,
76
+ {
77
+ style: S ? { borderBottom: `1px solid ${f.palette.gray[200]}` } : void 0,
78
+ children: [
79
+ l,
80
+ o.isObject(i) && o.isString(i.imageSrc) && /* @__PURE__ */ r(B, { $framed: i.imageFramed, children: /* @__PURE__ */ r(N, { alt: "modal-img", publicId: i.imageSrc }) }),
81
+ o.isObject(i) && o.isString(i.imageText) && /* @__PURE__ */ r(q, { size: "md", children: i.imageText })
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ r(
86
+ A,
87
+ {
88
+ alert: C,
89
+ cancelButton: n,
90
+ confirmButton: p,
91
+ modalRef: e
92
+ }
93
+ )
94
+ ]
102
95
  }
103
- );
96
+ ) });
104
97
  return b && e.isOpen ? $(
105
98
  h,
106
99
  document.getElementById("portals") ?? document.body
107
100
  ) : e.isOpen ? h : null;
108
101
  };
109
102
  export {
110
- ar as ColumnsModal,
111
- er as Modal,
112
- mr as ModalConfirm,
113
- k as ModalFooter
103
+ ai as ColumnsModal,
104
+ oi as Modal,
105
+ si as ModalConfirm,
106
+ A as ModalFooter
114
107
  };
@@ -25,6 +25,16 @@ interface IModalContent {
25
25
  imageFramed?: boolean;
26
26
  imageText?: string;
27
27
  }
28
+ /**
29
+ * Modal dialog props.
30
+ * @interface IDialogProps
31
+ * @property { string } [id] - The id of the dialog element.
32
+ * @property { string } label - The accessible name announced when the dialog takes focus.
33
+ */
34
+ interface IDialogProps {
35
+ id?: string;
36
+ label: string;
37
+ }
28
38
  /**
29
39
  * Modal header component props.
30
40
  * @interface IModalHeaderProps
@@ -92,4 +102,4 @@ interface IModalConfirmProps {
92
102
  txtCancel?: string;
93
103
  txtConfirm?: React.ReactNode | string;
94
104
  }
95
- export type { IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
105
+ export type { IDialogProps, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
@@ -5,6 +5,7 @@ import { Button as f } from "../../button/index.js";
5
5
  import "../../../_virtual/lodash.js";
6
6
  import "react-dom";
7
7
  import "styled-components";
8
+ import { useColumnsModal as b } from "../../../hooks/use-columns-modal.js";
8
9
  import "../../container/index.js";
9
10
  import "../../icon-button/index.js";
10
11
  import "../../typography/heading/index.js";
@@ -14,8 +15,7 @@ import "../../cloud-image/index.js";
14
15
  import "react-router";
15
16
  import "../../notification-sign/index.js";
16
17
  import "../../icon/index.js";
17
- import { ColumnsModal as b } from "../../modal/columns-modal/index.js";
18
- import { useColumnsModal as C } from "../../../hooks/use-columns-modal.js";
18
+ import { ColumnsModal as C } from "../../modal/columns-modal/index.js";
19
19
  const G = (s) => {
20
20
  const { table: t } = s, { meta: m } = t.options, [, n] = t.getHeaderGroups(), a = t.getVisibleLeafColumns().filter((o) => o.id !== "selection").length, i = l(
21
21
  () => t.getAllLeafColumns().filter((o) => o.id !== "selection"),
@@ -27,7 +27,7 @@ const G = (s) => {
27
27
  name: typeof o.columnDef.header == "string" ? o.columnDef.header : o.columnDef.id ?? "",
28
28
  toggleVisibility: o.toggleVisibility,
29
29
  visible: o.getIsVisible()
30
- })), [i]), e = C({
30
+ })), [i]), e = b({
31
31
  columnOrder: m?.defaultColumnOrder ?? [],
32
32
  items: d,
33
33
  name: "table-column-management",
@@ -48,7 +48,7 @@ const G = (s) => {
48
48
  }
49
49
  ),
50
50
  /* @__PURE__ */ r(
51
- b,
51
+ C,
52
52
  {
53
53
  modalRef: e,
54
54
  title: "Manage columns",
@@ -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 b } from "../../_virtual/lodash.js";
3
- import { StyledTag as k, StyledTagContent as E, StyledDot as j } from "./styles.js";
4
- import { Icon as K } from "../icon/index.js";
5
- import { IconButton as P } from "../icon-button/index.js";
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 W } from "../typography/span/index.js";
8
+ import { Span as q } from "../typography/span/index.js";
9
9
  import "../typography/text/index.js";
10
- const R = ({
10
+ const U = ({
11
11
  disabled: f,
12
12
  dot: h = !1,
13
- icon: c,
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: d = "",
18
+ filterValues: c = "",
19
19
  fontSize: y,
20
+ fullWidth: S = !1,
20
21
  href: r,
21
- linkLabel: S,
22
+ linkLabel: $,
22
23
  onBodyClick: i,
23
24
  onClose: n,
24
- priority: $ = "default",
25
+ priority: T = "default",
25
26
  selected: a,
26
27
  tagTitle: p = "",
27
- tagLabel: s,
28
- truncate: T = !0,
29
- variant: w = "default"
28
+ tagLabel: l,
29
+ truncate: w = !0,
30
+ variant: z = "default"
30
31
  }) => {
31
- const z = s.length > 25 && T && b.isEmpty(p + d), D = `${s.slice(0, 25)}...`, I = (t) => {
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
- }, N = (t) => {
34
+ }, b = (t) => {
34
35
  t.stopPropagation(), n?.();
35
- }, l = i !== void 0, m = l && typeof a == "boolean";
36
+ }, s = i !== void 0, m = s && typeof a == "boolean";
36
37
  return /* @__PURE__ */ e(
37
- W,
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
- k,
46
+ E,
46
47
  {
47
48
  $fontSize: y,
48
- $interactive: l,
49
+ $fullWidth: S,
50
+ $interactive: s,
49
51
  $selectable: m,
50
52
  $selected: a === !0,
51
- $variant: w,
52
- className: $,
53
+ $variant: z,
54
+ className: T,
53
55
  "data-testid": x,
54
- ...l && {
56
+ ...s && {
55
57
  ...m ? { "aria-pressed": a } : {},
56
58
  onClick: i,
57
- onKeyDown: I,
59
+ onKeyDown: N,
58
60
  role: "button",
59
61
  tabIndex: 0
60
62
  },
61
63
  children: [
62
- /* @__PURE__ */ e(E, { children: [
63
- c ? /* @__PURE__ */ o(
64
- K,
64
+ /* @__PURE__ */ e(j, { children: [
65
+ d ? /* @__PURE__ */ o(
66
+ P,
65
67
  {
66
- icon: c,
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(j, { "data-testid": "tag-dot" }) : void 0,
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: z ? D : s }),
76
- /* @__PURE__ */ o("strong", { className: "w-full", children: d })
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
- P,
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 ? N : n,
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: S })
99
+ r === void 0 ? void 0 : /* @__PURE__ */ o(C, { href: r, children: $ })
98
100
  ]
99
101
  }
100
102
  );
101
103
  };
102
104
  export {
103
- R as Tag
105
+ U as Tag
104
106
  };
@@ -1,6 +1,7 @@
1
1
  import { TTagVariant } from './types';
2
2
  interface IStyledTag {
3
3
  $fontSize?: string;
4
+ $fullWidth?: boolean;
4
5
  $interactive?: boolean;
5
6
  $selectable?: boolean;
6
7
  $selected?: boolean;
@@ -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: p } = i(
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
- `, d = a.span`
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: c = !1,
115
- $selectable: t = !1,
116
- $selected: n = !1
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
- ${c && !t ? "cursor: pointer;" : ""}
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
- ${p(o, l)}
152
- ${t ? e(o, n) : ""}
180
+ ${g(o, l)}
181
+ ${c ? e(o, p) : ""}
153
182
  `}
154
- `, $ = a.span`
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
- `, u = a.span`
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
- u as StyledDot,
170
- d as StyledTag,
171
- $ as StyledTagContent
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/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "8.3.0"
138
+ "version": "8.4.0"
139
139
  }