@fluidattacks/design 10.3.1 → 10.4.1

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.
@@ -77,7 +77,7 @@ type TSize = keyof FluidTheme["typography"]["heading"];
77
77
  type TSpacing = keyof FluidTheme["spacing"];
78
78
  type TShadows = keyof FluidTheme["shadows"];
79
79
  type TIconSize = "xl" | "lg" | "md" | "sm" | "xs" | string;
80
- type TIconType = "fa-brands" | "fa-gradient" | "fa-kit" | "fa-light" | "fa-regular" | "fa-solid";
80
+ type TIconType = "fa-brands" | "fa-gradient" | "fa-kit" | "fa-kit-duotone" | "fa-light" | "fa-regular" | "fa-solid";
81
81
  type TOrientation = "horizontal" | "vertical";
82
82
  interface IPaddingModifiable {
83
83
  padding?: [TSpacing, TSpacing, TSpacing, TSpacing];
@@ -115,7 +115,7 @@ interface IBorderModifiable {
115
115
  borderRadius?: string;
116
116
  }
117
117
  interface IIconModifiable {
118
- icon: IconName | "priority-bars-high" | "priority-bars-low" | "priority-bars-medium";
118
+ icon: IconName | "azure-devops" | "gitlab-tanuki" | "priority-bars-high" | "priority-bars-low" | "priority-bars-medium";
119
119
  iconColor?: string;
120
120
  iconSize: TIconSize;
121
121
  iconType?: TIconType;
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { IDrawerProps } from './types';
3
- declare const Drawer: ({ _containerId, _portal, actions, children, dismissable, footer, footerMessage, header, id, modalRef, side, size, subtitle, tabs, title, titleIcon, titleTag, onClose, }: Readonly<PropsWithChildren<IDrawerProps>>) => JSX.Element | null;
3
+ declare const Drawer: ({ _containerId, _portal, actions, children, dismissable, footer, footerMessage, header, id, modalRef, side, size, subtitle, tabs, title, titleIcon, titleIconColor, titleIconSecondaryColor, titleIconType, titleTag, onClose, }: Readonly<PropsWithChildren<IDrawerProps>>) => JSX.Element | null;
4
4
  export { Drawer };
5
5
  export type { IDrawerProps } from './types';
@@ -1,45 +1,48 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { useCallback as k, useEffect as O } from "react";
3
- import { createPortal as L } from "react-dom";
4
- import { useTheme as P } from "styled-components";
5
- import { DrawerWrapper as K, DrawerPanel as q, DrawerBody as A } from "./styles.js";
6
- import { Button as F } from "../button/index.js";
2
+ import { useCallback as C, useEffect as K } from "react";
3
+ import { createPortal as q } from "react-dom";
4
+ import { useTheme as A } from "styled-components";
5
+ import { DrawerWrapper as F, DrawerPanel as G, DrawerBody as H } from "./styles.js";
6
+ import { Button as J } from "../button/index.js";
7
7
  import { Container as i } from "../container/index.js";
8
- import { Icon as G } from "../icon/index.js";
9
- import { IconButton as C } from "../icon-button/index.js";
10
- import { Tabs as H } from "../tabs/index.js";
8
+ import { Icon as N } from "../icon/index.js";
9
+ import { IconButton as T } from "../icon-button/index.js";
10
+ import { Tabs as Q } from "../tabs/index.js";
11
11
  import "../typography/heading/index.js";
12
12
  import "../typography/span/index.js";
13
- import { Text as T } from "../typography/text/index.js";
14
- const re = ({
15
- _containerId: D = "portals",
16
- _portal: S = !0,
17
- actions: W = void 0,
18
- children: z = void 0,
13
+ import { Text as D } from "../typography/text/index.js";
14
+ const ne = ({
15
+ _containerId: W = "portals",
16
+ _portal: z = !0,
17
+ actions: B = void 0,
18
+ children: O = void 0,
19
19
  dismissable: a = !0,
20
20
  footer: s = void 0,
21
- footerMessage: y = void 0,
22
- header: B = void 0,
21
+ footerMessage: f = void 0,
22
+ header: S = void 0,
23
23
  id: d = "drawer-container",
24
24
  modalRef: n,
25
25
  side: g = "right",
26
- size: I = "md",
26
+ size: b = "md",
27
27
  subtitle: v = void 0,
28
28
  tabs: w = void 0,
29
- title: b,
29
+ title: j,
30
30
  titleIcon: x = void 0,
31
- titleTag: j = void 0,
32
- onClose: u = void 0
31
+ titleIconColor: E = void 0,
32
+ titleIconSecondaryColor: u = void 0,
33
+ titleIconType: I = "fa-solid",
34
+ titleTag: L = void 0,
35
+ onClose: $ = void 0
33
36
  }) => {
34
- const o = P(), p = k(() => {
35
- n.close(), u?.();
36
- }, [n, u]), E = k(
37
+ const o = A(), p = C(() => {
38
+ n.close(), $?.();
39
+ }, [n, $]), P = C(
37
40
  (r) => {
38
41
  a && r.target === r.currentTarget && p();
39
42
  },
40
43
  [a, p]
41
44
  );
42
- O(() => {
45
+ K(() => {
43
46
  if (!a || !n.isOpen)
44
47
  return () => {
45
48
  };
@@ -50,18 +53,18 @@ const re = ({
50
53
  window.removeEventListener("keydown", r);
51
54
  };
52
55
  }, [a, p, n.isOpen]);
53
- const $ = /* @__PURE__ */ e(
54
- K,
56
+ const k = /* @__PURE__ */ e(
57
+ F,
55
58
  {
56
59
  $side: g,
57
60
  id: `${d}-wrapper`,
58
- onClick: E,
61
+ onClick: P,
59
62
  role: "presentation",
60
63
  children: /* @__PURE__ */ t(
61
- q,
64
+ G,
62
65
  {
63
66
  $side: g,
64
- $size: I,
67
+ $size: b,
65
68
  "aria-label": n.name,
66
69
  "aria-modal": "true",
67
70
  "data-testid": d,
@@ -108,12 +111,14 @@ const re = ({
108
111
  minWidth: "2rem",
109
112
  width: "2rem",
110
113
  children: /* @__PURE__ */ e(
111
- G,
114
+ N,
112
115
  {
113
116
  icon: x,
114
- iconColor: o.palette.gray[700],
117
+ iconColor: E ?? o.palette.gray[700],
115
118
  iconSize: "md",
116
- iconType: "fa-solid"
119
+ iconType: I,
120
+ secondaryColor: u,
121
+ secondaryOpacity: u === void 0 ? void 0 : 1
117
122
  }
118
123
  )
119
124
  }
@@ -134,7 +139,7 @@ const re = ({
134
139
  minWidth: "0",
135
140
  children: [
136
141
  /* @__PURE__ */ e(
137
- T,
142
+ D,
138
143
  {
139
144
  color: o.palette.gray[800],
140
145
  display: "inline-block",
@@ -143,15 +148,15 @@ const re = ({
143
148
  size: "lg",
144
149
  textOverflow: "ellipsis",
145
150
  whiteSpace: "nowrap",
146
- children: b
151
+ children: j
147
152
  }
148
153
  ),
149
- j
154
+ L
150
155
  ]
151
156
  }
152
157
  ),
153
158
  v === void 0 ? void 0 : /* @__PURE__ */ e(
154
- T,
159
+ D,
155
160
  {
156
161
  color: o.palette.gray[400],
157
162
  overflow: "hidden",
@@ -167,21 +172,21 @@ const re = ({
167
172
  ]
168
173
  }
169
174
  ),
170
- B
175
+ S
171
176
  ]
172
177
  }
173
178
  ),
174
179
  /* @__PURE__ */ t(i, { display: "flex", gap: 0.25, children: [
175
- W?.map(
180
+ B?.map(
176
181
  ({
177
182
  disabled: r,
178
183
  icon: l,
179
184
  iconColor: h,
180
185
  shadow: c,
181
- tooltip: f,
186
+ tooltip: y,
182
187
  onClick: m
183
188
  }) => /* @__PURE__ */ e(
184
- C,
189
+ T,
185
190
  {
186
191
  disabled: r,
187
192
  icon: l ?? "paper-plane",
@@ -190,14 +195,14 @@ const re = ({
190
195
  iconType: "fa-light",
191
196
  onClick: m,
192
197
  shadow: c,
193
- tooltip: f,
198
+ tooltip: y,
194
199
  variant: "ghost"
195
200
  },
196
201
  `${d}-${l}`
197
202
  )
198
203
  ),
199
204
  a ? /* @__PURE__ */ e(
200
- C,
205
+ T,
201
206
  {
202
207
  icon: "xmark",
203
208
  iconColor: o.palette.gray[400],
@@ -212,9 +217,9 @@ const re = ({
212
217
  ]
213
218
  }
214
219
  ),
215
- w ? /* @__PURE__ */ e(i, { display: "flex", pt: 0.25, width: "100%", children: /* @__PURE__ */ e(H, { items: w }) }) : void 0,
216
- /* @__PURE__ */ e(A, { children: z }),
217
- s || y ? /* @__PURE__ */ t(
220
+ w ? /* @__PURE__ */ e(i, { display: "flex", pt: 0.25, width: "100%", children: /* @__PURE__ */ e(Q, { items: w }) }) : void 0,
221
+ /* @__PURE__ */ e(H, { children: O }),
222
+ s || f ? /* @__PURE__ */ t(
218
223
  i,
219
224
  {
220
225
  alignSelf: "stretch",
@@ -225,7 +230,7 @@ const re = ({
225
230
  px: 1.25,
226
231
  py: 1,
227
232
  children: [
228
- y,
233
+ f,
229
234
  s ? /* @__PURE__ */ e(
230
235
  i,
231
236
  {
@@ -234,13 +239,13 @@ const re = ({
234
239
  justify: "end",
235
240
  width: "100%",
236
241
  children: s.map(
237
- ({ disabled: r, icon: l, id: h, text: c, onClick: f }, m) => /* @__PURE__ */ e(
238
- F,
242
+ ({ disabled: r, icon: l, id: h, text: c, onClick: y }, m) => /* @__PURE__ */ e(
243
+ J,
239
244
  {
240
245
  disabled: r,
241
246
  icon: l,
242
247
  id: h,
243
- onClick: f,
248
+ onClick: y,
244
249
  variant: m === 0 ? "primary" : "tertiary",
245
250
  width: "100%",
246
251
  children: c
@@ -258,11 +263,11 @@ const re = ({
258
263
  )
259
264
  }
260
265
  );
261
- return n.isOpen ? S ? L(
262
- $,
263
- document.getElementById(D) ?? document.body
264
- ) : $ : null;
266
+ return n.isOpen ? z ? q(
267
+ k,
268
+ document.getElementById(W) ?? document.body
269
+ ) : k : null;
265
270
  };
266
271
  export {
267
- re as Drawer
272
+ ne as Drawer
268
273
  };
@@ -52,6 +52,9 @@ interface IDrawerButtonProps extends Partial<IIconModifiable> {
52
52
  * @property { ITabProps[] } [tabs] - The tab items.
53
53
  * @property { string } title - The title of the drawer.
54
54
  * @property { IIconModifiable["icon"] } [titleIcon] - Icon shown beside the title.
55
+ * @property { string } [titleIconColor] - Color of the title icon.
56
+ * @property { string } [titleIconSecondaryColor] - Color of a duotone title icon's secondary layer, shown at full opacity.
57
+ * @property { IIconModifiable["iconType"] } [titleIconType] - Font Awesome style of the title icon.
55
58
  * @property { React.ReactNode } [titleTag] - Content shown on the title line, after the title.
56
59
  * @property { Function } [onClose] - Handler called after the drawer closes.
57
60
  */
@@ -71,6 +74,9 @@ interface IDrawerProps {
71
74
  tabs?: ITabProps[];
72
75
  title: string;
73
76
  titleIcon?: IIconModifiable["icon"];
77
+ titleIconColor?: string;
78
+ titleIconSecondaryColor?: string;
79
+ titleIconType?: IIconModifiable["iconType"];
74
80
  titleTag?: React.ReactNode;
75
81
  onClose?: () => void;
76
82
  }
@@ -7,16 +7,17 @@ const w = b(function({
7
7
  hoverColor: l,
8
8
  icon: o,
9
9
  iconClass: n = "",
10
- iconColor: f,
10
+ iconColor: c,
11
11
  iconMask: r,
12
- iconSize: c,
12
+ iconSize: f,
13
13
  iconTransform: e,
14
14
  iconType: a = "fa-solid",
15
15
  onClick: $,
16
16
  rotation: m,
17
17
  spanClass: p,
18
18
  secondaryColor: v,
19
- ...I
19
+ secondaryOpacity: I,
20
+ ...y
20
21
  }, C) {
21
22
  const t = a === "fa-gradient", N = [
22
23
  t ? "fa-solid" : a,
@@ -28,17 +29,18 @@ const w = b(function({
28
29
  g,
29
30
  {
30
31
  $clickable: d,
31
- $color: f,
32
+ $color: c,
32
33
  $disabled: i,
33
34
  $hoverColor: l,
34
35
  $rotation: m,
35
36
  $secondaryColor: v,
36
- $size: c,
37
+ $secondaryOpacity: I,
38
+ $size: f,
37
39
  className: p,
38
40
  "data-testid": `${o}-icon`,
39
41
  onClick: $,
40
42
  ref: C,
41
- ...I,
43
+ ...y,
42
44
  children: /* @__PURE__ */ s(
43
45
  "i",
44
46
  {
@@ -7,6 +7,7 @@ interface IStyledIconWrapProps {
7
7
  $rotation?: IIconWrapProps["rotation"];
8
8
  $size: IIconWrapProps["iconSize"];
9
9
  $secondaryColor: IIconWrapProps["secondaryColor"];
10
+ $secondaryOpacity?: IIconWrapProps["secondaryOpacity"];
10
11
  }
11
12
  declare const IconWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<Omit<import('styled-components').FastOmit<import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('../@core').IPaddingModifiable | keyof import('../@core').IMarginModifiable | keyof import('../@core').IPositionModifiable | keyof import('../@core').IBorderModifiable | keyof import('../@core').IDisplayModifiable | keyof import('../@core').ITextModifiable | keyof import('../@core').IInteractionModifiable> & import('../@core').IBorderModifiable & import('../@core').IDisplayModifiable & import('../@core').IInteractionModifiable & import('../@core').IMarginModifiable & import('../@core').IPaddingModifiable & import('../@core').IPositionModifiable & import('../@core').ITextModifiable, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('../@core').IPaddingModifiable | keyof import('../@core').IMarginModifiable | keyof import('../@core').IPositionModifiable | keyof import('../@core').IBorderModifiable | keyof import('../@core').IDisplayModifiable | keyof import('../@core').ITextModifiable | keyof import('../@core').IInteractionModifiable> & import('../@core').IBorderModifiable & import('../@core').IDisplayModifiable & import('../@core').IInteractionModifiable & import('../@core').IMarginModifiable & import('../@core').IPaddingModifiable & import('../@core').IPositionModifiable & import('../@core').ITextModifiable, never>>, "as" | "forwardedAs"> & {
12
13
  as?: import('styled-components').WebTarget | undefined;
@@ -1,4 +1,4 @@
1
- import { styled as n } from "styled-components";
1
+ import { styled as o } from "styled-components";
2
2
  import { BaseSpanComponent as g } from "../@core/styles.js";
3
3
  const t = {
4
4
  xl: "24px",
@@ -6,28 +6,30 @@ const t = {
6
6
  md: "14px",
7
7
  sm: "12px",
8
8
  xs: "10px"
9
- }, f = (r) => t[r] ? t[r] : typeof r == "string" && r.includes("px") ? r : t.md, h = n(g)`
9
+ }, c = (r) => t[r] ? t[r] : typeof r == "string" && r.includes("px") ? r : t.md, m = o(g)`
10
10
  ${({
11
11
  $clickable: r,
12
- $color: o = "inherit",
13
- $disabled: l = !1,
12
+ $color: l = "inherit",
13
+ $disabled: s = !1,
14
14
  $hoverColor: e,
15
15
  $rotation: i,
16
- $size: s,
17
- $secondaryColor: a
16
+ $size: a,
17
+ $secondaryColor: d,
18
+ $secondaryOpacity: n
18
19
  }) => {
19
- const d = e ? "" : "brightness(50%)", p = e ?? "";
20
+ const p = e ? "" : "brightness(50%)", f = e ?? "";
20
21
  return `
21
- color: ${o};
22
+ color: ${l};
22
23
  cursor: ${r ? "pointer" : "inherit"};
23
- font-size: ${f(s)};
24
+ font-size: ${c(a)};
24
25
  line-height: 0;
25
26
  vertical-align: middle;
26
27
  pointer-events: inherit;
27
- opacity: ${l ? "0.5" : "1"};
28
+ opacity: ${s ? "0.5" : "1"};
28
29
 
29
30
  > svg {
30
- --fa-secondary-color: ${a};
31
+ --fa-secondary-color: ${d};
32
+ ${n === void 0 ? "" : `--fa-secondary-opacity: ${n};`}
31
33
  transform: ${i === void 0 ? "" : `rotate(${i}deg)`};
32
34
  }
33
35
 
@@ -41,13 +43,13 @@ const t = {
41
43
  }
42
44
 
43
45
  ${r ? `&:hover {
44
- filter: ${d};
45
- color: ${p};
46
+ filter: ${p};
47
+ color: ${f};
46
48
  }` : ""}
47
49
  `;
48
50
  }}
49
51
  `;
50
- n.div`
52
+ o.div`
51
53
  cursor: pointer;
52
54
  transition: all 0.2s ease-in-out;
53
55
 
@@ -56,5 +58,5 @@ n.div`
56
58
  }
57
59
  `;
58
60
  export {
59
- h as IconWrap
61
+ m as IconWrap
60
62
  };
@@ -10,6 +10,8 @@ import { IIconModifiable, IMarginModifiable } from '../@core';
10
10
  * @property {Function} [onClick] - Function handler for click event.
11
11
  * @property {boolean} [disabled] - Show disabled icon state.
12
12
  * @property {number} [rotation] - Rotation degrees to modify icon style.
13
+ * @property {string} [secondaryColor] - Color of a duotone icon's secondary layer.
14
+ * @property {number} [secondaryOpacity] - Opacity of a duotone icon's secondary layer.
13
15
  */
14
16
  interface IIconWrapProps extends IIconModifiable, IMarginModifiable {
15
17
  clickable?: boolean;
@@ -18,6 +20,7 @@ interface IIconWrapProps extends IIconModifiable, IMarginModifiable {
18
20
  disabled?: boolean;
19
21
  rotation?: number;
20
22
  secondaryColor?: string;
23
+ secondaryOpacity?: number;
21
24
  }
22
25
  /**
23
26
  * Icon component props.
@@ -4,9 +4,7 @@ import { ITabsProps } from './types';
4
4
  declare const config: Meta;
5
5
  declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
6
6
  declare const WithTooltips: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
7
- declare const SecondaryTabs: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
8
- declare const SecondaryNavTabs: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
7
+ declare const SecondaryNav: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
9
8
  declare const WithTag: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
10
- declare const SecondaryTagTabs: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<ITabsProps>>;
11
- export { Default, WithTooltips, SecondaryTabs, SecondaryNavTabs, WithTag, SecondaryTagTabs, };
9
+ export { Default, WithTooltips, SecondaryNav, WithTag };
12
10
  export default config;
@@ -1,5 +1,5 @@
1
1
  import { styled as o } from "styled-components";
2
- const e = (a, r, t) => t ? r === "secondary" ? `3px solid ${a.palette.primary[100]}` : `3px solid ${a.palette.primary[500]}` : "unset", n = (a, r) => `
2
+ const e = (a, r) => r ? `3px solid ${a.palette.primary[500]}` : "unset", n = (a, r) => `
3
3
  background-color: ${r ? a.palette.gray[200] : a.palette.white};
4
4
  border: 1px solid ${r ? a.palette.gray[300] : a.palette.gray[200]};
5
5
  border-radius: ${a.spacing[0.25]};
@@ -13,11 +13,11 @@ const e = (a, r, t) => t ? r === "secondary" ? `3px solid ${a.palette.primary[10
13
13
  font-weight: ${r ? a.typography.weight.bold : a.typography.weight.regular};
14
14
  line-height: 20px;
15
15
  }
16
- `, l = o.div`
16
+ `, g = o.div`
17
17
  display: flex;
18
18
  flex-direction: row;
19
19
  gap: ${({ theme: a }) => a.spacing[0.25]};
20
- border-bottom: ${({ theme: a, $borderButton: r, $variant: t }) => e(a, t, r)};
20
+ border-bottom: ${({ theme: a, $borderButton: r }) => e(a, r)};
21
21
  align-items: center;
22
22
  padding: ${({ theme: a }) => a.spacing[0.625]}
23
23
  ${({ theme: a }) => a.spacing[0.5]};
@@ -60,5 +60,5 @@ const e = (a, r, t) => t ? r === "secondary" ? `3px solid ${a.palette.primary[10
60
60
  ${({ theme: a, $borderButton: r, $variant: t }) => t === "secondaryNav" ? n(a, r) : ""}
61
61
  `;
62
62
  export {
63
- l as TabContainer
63
+ g as TabContainer
64
64
  };
@@ -1,5 +1,5 @@
1
1
  import { INotificationSignProps } from '../notification-sign/types';
2
- type TVariant = "primary" | "secondary" | "secondaryNav";
2
+ type TVariant = "primary" | "secondaryNav";
3
3
  /**
4
4
  * Individual tab props.
5
5
  * @property {boolean} [isActive] - Set the current tab active.
@@ -46,7 +46,7 @@ interface ITabProps extends IFixedTabProps {
46
46
  * @property {ITabProps[]} items - The lists of tabs to display.
47
47
  * @property {boolean} [borders] - Whether to add borders to set of tabs.
48
48
  * @property {boolean} [box] - Whether to add box container to set of tabs.
49
- * @property {"primary" | "secondary" | "secondaryNav"} [variant] - The variant of the tabs items.
49
+ * @property {"primary" | "secondaryNav"} [variant] - The variant of the tabs items.
50
50
  */
51
51
  interface ITabsProps {
52
52
  items: ITabProps[];
@@ -1,4 +1,4 @@
1
1
  import { ITagProps, TTagVariant } from './types';
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;
2
+ declare const Tag: ({ disabled, dot, icon, iconColor, iconType, id, filterId, filterValues, fontSize, fullWidth, href, linkLabel, onBodyClick, onClose, priority, selected, tagTitle, tagLabel, truncate, variant, wrap, }: Readonly<ITagProps>) => JSX.Element;
3
3
  export type { ITagProps, TTagVariant };
4
4
  export { Tag };
@@ -1,13 +1,13 @@
1
1
  import { jsxs as e, jsx as o } from "react/jsx-runtime";
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
- import { Link as C } from "../link/index.js";
2
+ import { l as E } from "../../_virtual/lodash.js";
3
+ import { StyledTag as j, StyledTagContent as K, StyledDot as P } from "./styles.js";
4
+ import { Icon as W } from "../icon/index.js";
5
+ import { IconButton as C } from "../icon-button/index.js";
6
+ import { Link as q } from "../link/index.js";
7
7
  import "../typography/heading/index.js";
8
- import { Span as q } from "../typography/span/index.js";
8
+ import { Span as A } from "../typography/span/index.js";
9
9
  import "../typography/text/index.js";
10
- const U = ({
10
+ const X = ({
11
11
  disabled: f,
12
12
  dot: h = !1,
13
13
  icon: d,
@@ -22,20 +22,21 @@ const U = ({
22
22
  linkLabel: $,
23
23
  onBodyClick: i,
24
24
  onClose: n,
25
- priority: T = "default",
25
+ priority: w = "default",
26
26
  selected: a,
27
27
  tagTitle: p = "",
28
28
  tagLabel: l,
29
- truncate: w = !0,
30
- variant: z = "default"
29
+ truncate: T = !0,
30
+ variant: z = "default",
31
+ wrap: D = !1
31
32
  }) => {
32
- const D = l.length > 25 && w && k.isEmpty(p + c), I = `${l.slice(0, 25)}...`, N = (t) => {
33
+ const I = l.length > 25 && T && E.isEmpty(p + c), N = `${l.slice(0, 25)}...`, b = (t) => {
33
34
  t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i?.());
34
- }, b = (t) => {
35
+ }, k = (t) => {
35
36
  t.stopPropagation(), n?.();
36
37
  }, s = i !== void 0, m = s && typeof a == "boolean";
37
38
  return /* @__PURE__ */ e(
38
- q,
39
+ A,
39
40
  {
40
41
  className: "gap-0.5",
41
42
  color: "inherit",
@@ -43,7 +44,7 @@ const U = ({
43
44
  size: "md",
44
45
  children: [
45
46
  /* @__PURE__ */ e(
46
- E,
47
+ j,
47
48
  {
48
49
  $fontSize: y,
49
50
  $fullWidth: S,
@@ -51,19 +52,20 @@ const U = ({
51
52
  $selectable: m,
52
53
  $selected: a === !0,
53
54
  $variant: z,
54
- className: T,
55
+ $wrap: D,
56
+ className: w,
55
57
  "data-testid": x,
56
58
  ...s && {
57
59
  ...m ? { "aria-pressed": a } : {},
58
60
  onClick: i,
59
- onKeyDown: N,
61
+ onKeyDown: b,
60
62
  role: "button",
61
63
  tabIndex: 0
62
64
  },
63
65
  children: [
64
- /* @__PURE__ */ e(j, { children: [
66
+ /* @__PURE__ */ e(K, { children: [
65
67
  d ? /* @__PURE__ */ o(
66
- P,
68
+ W,
67
69
  {
68
70
  icon: d,
69
71
  iconColor: u,
@@ -71,15 +73,15 @@ const U = ({
71
73
  iconType: v
72
74
  }
73
75
  ) : void 0,
74
- h ? /* @__PURE__ */ o(K, { "data-testid": "tag-dot" }) : void 0,
76
+ h ? /* @__PURE__ */ o(P, { "data-testid": "tag-dot" }) : void 0,
75
77
  /* @__PURE__ */ e("span", { className: "w-full", children: [
76
78
  /* @__PURE__ */ o("strong", { children: p }),
77
- /* @__PURE__ */ o("span", { children: D ? I : l }),
79
+ /* @__PURE__ */ o("span", { children: I ? N : l }),
78
80
  /* @__PURE__ */ o("strong", { className: "w-full", children: c })
79
81
  ] })
80
82
  ] }),
81
83
  n ? /* @__PURE__ */ o(
82
- W,
84
+ C,
83
85
  {
84
86
  disabled: f,
85
87
  icon: "xmark",
@@ -87,7 +89,7 @@ const U = ({
87
89
  iconSize: "xs",
88
90
  iconType: "fa-light",
89
91
  id: g,
90
- onClick: i !== void 0 ? b : n,
92
+ onClick: i !== void 0 ? k : n,
91
93
  px: 0.125,
92
94
  py: 0.125,
93
95
  variant: "ghost"
@@ -96,11 +98,11 @@ const U = ({
96
98
  ]
97
99
  }
98
100
  ),
99
- r === void 0 ? void 0 : /* @__PURE__ */ o(C, { href: r, children: $ })
101
+ r === void 0 ? void 0 : /* @__PURE__ */ o(q, { href: r, children: $ })
100
102
  ]
101
103
  }
102
104
  );
103
105
  };
104
106
  export {
105
- U as Tag
107
+ X as Tag
106
108
  };
@@ -6,6 +6,7 @@ interface IStyledTag {
6
6
  $selectable?: boolean;
7
7
  $selected?: boolean;
8
8
  $variant: TTagVariant;
9
+ $wrap?: boolean;
9
10
  }
10
11
  declare const StyledTag: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof IStyledTag> & IStyledTag, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof IStyledTag> & IStyledTag, never>>> & string;
11
12
  declare const StyledTagContent: 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;
@@ -1,6 +1,6 @@
1
1
  import { styled as a } from "styled-components";
2
- import { variantBuilder as i } from "../@core/variants/utils.js";
3
- const { getVariant: g } = i(
2
+ import { variantBuilder as g } from "../@core/variants/utils.js";
3
+ const { getVariant: e } = g(
4
4
  (o) => ({
5
5
  complementary: `
6
6
  background-color: ${o.palette.complementary[300]};
@@ -125,7 +125,7 @@ const { getVariant: g } = i(
125
125
  }
126
126
  `
127
127
  })
128
- ), e = (o, r) => `
128
+ ), d = (o, r) => `
129
129
  background-color: ${r ? o.palette.gray[800] : o.palette.white};
130
130
  border: 1px solid ${o.palette.gray[800]};
131
131
  color: ${r ? o.palette.white : o.palette.gray[800]};
@@ -134,15 +134,16 @@ const { getVariant: g } = i(
134
134
  &:hover {
135
135
  background-color: ${r ? o.palette.gray[800] : o.palette.gray[100]};
136
136
  }
137
- `, $ = a.span`
137
+ `, u = a.span`
138
138
  ${({
139
139
  theme: o,
140
140
  $fontSize: r = o.typography.text.sm,
141
- $fullWidth: t = !1,
141
+ $fullWidth: n = !1,
142
142
  $variant: l,
143
- $interactive: n = !1,
143
+ $interactive: p = !1,
144
144
  $selectable: c = !1,
145
- $selected: p = !1
145
+ $selected: i = !1,
146
+ $wrap: t = !1
146
147
  }) => `
147
148
  align-items: center;
148
149
  border-radius: ${o.spacing[l === "technique" ? 1 : 0.25]};
@@ -155,9 +156,10 @@ const { getVariant: g } = i(
155
156
  justify-content: center;
156
157
  line-height: 18px;
157
158
  padding: var(--tag-padding-y) var(--tag-padding-x);
158
- white-space: nowrap;
159
- width: ${t ? "100%" : "max-content"};
160
- ${n && !c ? "cursor: pointer;" : ""}
159
+ white-space: ${t ? "normal" : "nowrap"};
160
+ width: ${n ? "100%" : "max-content"};
161
+ ${t ? "max-width: 100%; overflow-wrap: anywhere;" : ""}
162
+ ${p && !c ? "cursor: pointer;" : ""}
161
163
 
162
164
  ~ a {
163
165
  font-size: ${o.typography.text.xs};
@@ -177,17 +179,17 @@ const { getVariant: g } = i(
177
179
  }
178
180
  }
179
181
 
180
- ${g(o, l)}
181
- ${c ? e(o, p) : ""}
182
+ ${e(o, l)}
183
+ ${c ? d(o, i) : ""}
182
184
  `}
183
- `, u = a.span`
185
+ `, y = a.span`
184
186
  ${({ theme: o }) => `
185
187
  align-items: center;
186
188
  display: inline-flex;
187
189
  gap: ${o.spacing[0.25]};
188
190
  min-width: 0;
189
191
  `}
190
- `, y = a.span`
192
+ `, b = a.span`
191
193
  background-color: currentColor;
192
194
  border-radius: 50%;
193
195
  flex-shrink: 0;
@@ -195,7 +197,7 @@ const { getVariant: g } = i(
195
197
  width: 6px;
196
198
  `;
197
199
  export {
198
- y as StyledDot,
199
- $ as StyledTag,
200
- u as StyledTagContent
200
+ b as StyledDot,
201
+ u as StyledTag,
202
+ y as StyledTagContent
201
203
  };
@@ -24,6 +24,8 @@ type TTagPriority = "default" | "high" | "low" | "medium";
24
24
  * @property { boolean } [truncate] - Whether the tag should truncate its content.
25
25
  * @property { TTagPriority } [priority] - The priority of the tag.
26
26
  * @property { TTagVariant } [variant] - The variant of the tag.
27
+ * @property { boolean } [wrap] - Whether a label wider than its container
28
+ * breaks onto more lines instead of overflowing.
27
29
  */
28
30
  interface ITagProps extends Partial<Pick<IIconModifiable, "icon" | "iconColor" | "iconType">>, React.HTMLAttributes<HTMLSpanElement> {
29
31
  disabled?: boolean;
@@ -42,5 +44,6 @@ interface ITagProps extends Partial<Pick<IIconModifiable, "icon" | "iconColor" |
42
44
  truncate?: boolean;
43
45
  priority?: TTagPriority;
44
46
  variant?: TTagVariant;
47
+ wrap?: boolean;
45
48
  }
46
49
  export type { ITagProps, TTagVariant };
package/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "10.3.1"
138
+ "version": "10.4.1"
139
139
  }