@iress-oss/ids-components 6.0.0-beta.8 → 6.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.
@@ -2,6 +2,14 @@ import { ReactNode } from 'react';
2
2
  import { IressStyledProps } from '../../types';
3
3
  import { IressIconProps } from '../Icon';
4
4
  type AvatarMode = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | '10' | '20' | '30' | '40' | '50' | '60' | '70' | '80' | '90' | 'danger' | 'info' | 'success' | 'warning';
5
+ export interface IressAvatarTooltip {
6
+ /** The person's name, displayed prominently. */
7
+ name: string;
8
+ /** Badge label (e.g. "New"). Shown as muted metadata. */
9
+ badge?: string;
10
+ /** Type label (e.g. "Group"). Shown as muted metadata. */
11
+ type?: string;
12
+ }
5
13
  export interface IressAvatarProps extends IressStyledProps<'span'> {
6
14
  /**
7
15
  * Badge indicator at the top-right of the avatar.
@@ -32,6 +40,11 @@ export interface IressAvatarProps extends IressStyledProps<'span'> {
32
40
  * Controls the avatar's background and text colour.
33
41
  */
34
42
  mode?: AvatarMode;
43
+ /**
44
+ * Tooltip shown on hover. Displays the name prominently with optional
45
+ * metadata (badge and type) in muted text separated by a dot.
46
+ */
47
+ tooltip?: IressAvatarTooltip;
35
48
  /**
36
49
  * Secondary circle at the bottom-right. Pass an icon `ReactNode` to display, or `false`/`undefined` to hide.
37
50
  * @default false
@@ -46,7 +59,7 @@ export interface IressAvatarProps extends IressStyledProps<'span'> {
46
59
  } | false;
47
60
  }
48
61
  export declare const IressAvatar: {
49
- ({ children, badge, type, mode, compact, className, ...restProps }: IressAvatarProps): import("react/jsx-runtime").JSX.Element;
62
+ ({ children, badge, type, mode, compact, tooltip, className, ...restProps }: IressAvatarProps): import("react/jsx-runtime").JSX.Element;
50
63
  displayName: string;
51
64
  };
52
65
  export {};
@@ -3,53 +3,64 @@ import { t } from "../../cx-CZ8IJJTy.js";
3
3
  import { n } from "../../is-valid-prop-BoZ7GJt2.js";
4
4
  import { GlobalCSSClass as r } from "../../enums.js";
5
5
  import { IressIcon as i } from "../Icon/Icon.js";
6
- import { avatar as a } from "./Avatar.styles.js";
7
- import { useId as o } from "react";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { IressTooltip as a } from "../Tooltip/Tooltip.js";
7
+ import { avatar as o } from "./Avatar.styles.js";
8
+ import { useId as s } from "react";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
10
  //#region src/components/Avatar/Avatar.tsx
10
- var l = ({ children: l, badge: u = !1, type: d = !1, mode: f, compact: p = !1, className: m, ...h }) => {
11
- let g = a({
12
- compact: p,
13
- mode: f
14
- }), _ = a.raw({
15
- badgeMode: typeof u == "object" && u.mode ? String(u.mode) : void 0,
16
- compact: p,
17
- mode: f,
18
- noBadgeIcon: u && !u.icon
19
- }), [v, y] = n(h), b = o();
20
- return /* @__PURE__ */ c("span", {
21
- ...y,
22
- className: t(e(_.root, v), m, r.Avatar),
11
+ var u = ({ children: u, badge: d = !1, type: f = !1, mode: p, compact: m = !1, tooltip: h, className: g, ..._ }) => {
12
+ let v = o({
13
+ compact: m,
14
+ mode: p
15
+ }), y = o.raw({
16
+ badgeMode: typeof d == "object" && d.mode ? String(d.mode) : void 0,
17
+ compact: m,
18
+ mode: p,
19
+ noBadgeIcon: d && !d.icon
20
+ }), [b, x] = n(_), S = s(), C = () => {
21
+ if (!h) return [];
22
+ let e = [h.badge, h.type].filter(Boolean), t = [h.name];
23
+ return e.length > 0 && t.push(e.join(" · ")), t;
24
+ }, w = /* @__PURE__ */ l("span", {
25
+ ...x,
26
+ tabIndex: h ? x.tabIndex ?? 0 : x.tabIndex,
27
+ className: t(e(y.root, b), g, r.Avatar),
23
28
  role: "img",
24
- "aria-labelledby": b,
29
+ "aria-labelledby": S,
25
30
  children: [
26
- /* @__PURE__ */ s("span", {
27
- className: g.initials,
28
- id: b,
29
- "aria-label": h["aria-label"],
30
- children: l
31
+ /* @__PURE__ */ c("span", {
32
+ className: v.initials,
33
+ id: S,
34
+ "aria-label": _["aria-label"],
35
+ children: u
31
36
  }),
32
- u && /* @__PURE__ */ s("span", {
33
- className: g.badge,
37
+ d && /* @__PURE__ */ c("span", {
38
+ className: v.badge,
34
39
  role: "img",
35
- "aria-label": u.ariaLabel,
36
- children: u.icon && /* @__PURE__ */ s(i, {
37
- name: u.icon,
38
- filled: u.filled,
40
+ "aria-label": d.ariaLabel,
41
+ children: d.icon && /* @__PURE__ */ c(i, {
42
+ name: d.icon,
43
+ filled: d.filled,
39
44
  "aria-hidden": "true"
40
45
  })
41
46
  }),
42
- d && /* @__PURE__ */ s("span", {
43
- className: g.type,
44
- children: /* @__PURE__ */ s(i, {
45
- name: d.icon,
46
- filled: d.filled,
47
- screenreaderText: d.ariaLabel
47
+ f && /* @__PURE__ */ c("span", {
48
+ className: v.type,
49
+ children: /* @__PURE__ */ c(i, {
50
+ name: f.icon,
51
+ filled: f.filled,
52
+ screenreaderText: f.ariaLabel
48
53
  })
49
54
  })
50
55
  ]
51
56
  });
57
+ return h ? /* @__PURE__ */ c(a, {
58
+ tooltipText: C(),
59
+ variant: "rich",
60
+ delay: 300,
61
+ children: w
62
+ }) : w;
52
63
  };
53
- l.displayName = "IressAvatar";
64
+ u.displayName = "IressAvatar";
54
65
  //#endregion
55
- export { l as IressAvatar };
66
+ export { u as IressAvatar };
@@ -23,6 +23,11 @@ export declare const field: import('../../styled-system/types').SlotRecipeRuntim
23
23
  label: {
24
24
  mb: "none";
25
25
  };
26
+ element: {
27
+ '& > .ids-radio-group:first-child, & > .ids-checkbox-group:first-child, & > .ids-checkbox:first-child': {
28
+ mt: "spacing.0";
29
+ };
30
+ };
26
31
  };
27
32
  };
28
33
  hasError: {
@@ -18,7 +18,10 @@ var t = e({
18
18
  maxWidth: "12/12",
19
19
  position: "relative"
20
20
  },
21
- element: { position: "relative" },
21
+ element: {
22
+ position: "relative",
23
+ "& > .ids-radio-group:first-child, & > .ids-checkbox-group:first-child, & > .ids-checkbox:first-child": { mt: "spacing.1" }
24
+ },
22
25
  hint: {
23
26
  color: "colour.neutral.70",
24
27
  mb: "spacing.1",
@@ -53,7 +56,8 @@ var t = e({
53
56
  gridArea: "footer",
54
57
  mt: "spacing.1"
55
58
  },
56
- label: { mb: "none" }
59
+ label: { mb: "none" },
60
+ element: { "& > .ids-radio-group:first-child, & > .ids-checkbox-group:first-child, & > .ids-checkbox:first-child": { mt: "spacing.0" } }
57
61
  } },
58
62
  hasError: { true: { root: { _nestedFormElements: { "--iress-border-color": "{colors.colour.system.danger.fill}" } } } },
59
63
  hasHint: { true: { label: { mb: "spacing.0" } } },
@@ -29,6 +29,7 @@ var t = e({
29
29
  fields: {
30
30
  display: "flex",
31
31
  flexDirection: "column",
32
+ "& > .ids-radio-group:first-child, & > .ids-checkbox-group:first-child, & > .ids-checkbox:first-child": { mt: "spacing.1" },
32
33
  _nestedFormLabels: {
33
34
  color: "colour.neutral.70",
34
35
  mb: "spacing.1"
@@ -16,7 +16,7 @@ export interface IressTabSetProps extends Omit<IressStyledProps, 'onChange'> {
16
16
  * Layout options for the positioning of tabs.
17
17
  * @default top-left
18
18
  */
19
- layout?: 'top-left' | 'top-center' | 'top-right';
19
+ layout?: 'top-left' | 'top-center' | 'top-right' | 'top-stretch';
20
20
  /**
21
21
  * Emitted when a tab changes.
22
22
  */
@@ -15,6 +15,24 @@ export declare const tabSet: import('../../styled-system/types').SlotRecipeRunti
15
15
  justifyContent: "flex-end";
16
16
  };
17
17
  };
18
+ 'top-stretch': {
19
+ list: {
20
+ justifyContent: "flex-start";
21
+ '& > *': {
22
+ flex: "1";
23
+ };
24
+ '& [role="tab"]': {
25
+ width: "12/12";
26
+ justifyContent: "center";
27
+ };
28
+ };
29
+ activeIndicator: {
30
+ flex: "none";
31
+ };
32
+ hoverIndicator: {
33
+ flex: "none";
34
+ };
35
+ };
18
36
  };
19
37
  overflowEnd: {
20
38
  true: {
@@ -94,7 +94,19 @@ var t = e({
94
94
  layout: {
95
95
  "top-left": { list: { justifyContent: "flex-start" } },
96
96
  "top-center": { list: { justifyContent: "center" } },
97
- "top-right": { list: { justifyContent: "flex-end" } }
97
+ "top-right": { list: { justifyContent: "flex-end" } },
98
+ "top-stretch": {
99
+ list: {
100
+ justifyContent: "flex-start",
101
+ "& > *": { flex: "1" },
102
+ "& [role=\"tab\"]": {
103
+ width: "12/12",
104
+ justifyContent: "center"
105
+ }
106
+ },
107
+ activeIndicator: { flex: "none" },
108
+ hoverIndicator: { flex: "none" }
109
+ }
98
110
  },
99
111
  overflowEnd: { true: { overflowEndIndicator: {
100
112
  layerStyle: "overflow",
@@ -24,8 +24,14 @@ export interface IressTooltipProps extends IressStyledProps {
24
24
  * Sets the tooltip text. Can accept a string or an array of strings - if given an array, will output each string on a new line.
25
25
  */
26
26
  tooltipText: string | string[];
27
+ /**
28
+ * Visual variant of the tooltip.
29
+ * - When not set (default): renders plain text, with arrays shown as multiple lines separated by line breaks.
30
+ * - `rich`: Displays structured content with the first line as a prominent name and subsequent lines as muted metadata.
31
+ */
32
+ variant?: 'rich';
27
33
  }
28
34
  export declare const IressTooltip: {
29
- ({ children, className, align, delay, open, tooltipText, "data-testid": testid, ...restProps }: IressTooltipProps): import("react/jsx-runtime").JSX.Element;
35
+ ({ children, className, align, delay, open, tooltipText, variant, "data-testid": testid, ...restProps }: IressTooltipProps): import("react/jsx-runtime").JSX.Element;
30
36
  displayName: string;
31
37
  };
@@ -10,44 +10,47 @@ import { tooltip as _ } from "./Tooltip.styles.js";
10
10
  import { Fragment as v, useEffect as y, useState as b } from "react";
11
11
  import { jsx as x, jsxs as S } from "react/jsx-runtime";
12
12
  //#region src/components/Tooltip/Tooltip.tsx
13
- var C = ({ children: C, className: w, align: T = "top", delay: E = 500, open: D = !1, tooltipText: O, "data-testid": k, ...A }) => {
14
- let j = _(), M = T === "auto", [N, P] = b(D), { refs: F, floatingStyles: I, context: L } = l({
15
- placement: M ? void 0 : T,
16
- open: N,
17
- onOpenChange: P,
13
+ var C = ({ children: C, className: w, align: T = "top", delay: E = 500, open: D = !1, tooltipText: O, variant: k, "data-testid": A, ...j }) => {
14
+ let M = _({ variant: k }), N = T === "auto", [P, F] = b(D), { refs: I, floatingStyles: L, context: R } = l({
15
+ placement: N ? void 0 : T,
16
+ open: P,
17
+ onOpenChange: F,
18
18
  middleware: [
19
19
  s(5),
20
- M ? h() : c(),
20
+ N ? h() : c(),
21
21
  m()
22
22
  ]
23
- }), { getReferenceProps: R, getFloatingProps: z } = u([
24
- d(L, {
23
+ }), { getReferenceProps: z, getFloatingProps: B } = u([
24
+ d(R, {
25
25
  move: !1,
26
26
  restMs: E
27
27
  }),
28
- f(L),
29
- p(L),
30
- g(L, { role: "tooltip" })
28
+ f(R),
29
+ p(R),
30
+ g(R, { role: "tooltip" })
31
31
  ]);
32
32
  return y(() => {
33
- !C || !F.reference.current || o(F.reference.current).length > 0 || r("IressTooltip: The content that activates the tooltip is not focusable,\n which is a failure of WCAG Level AA Success Criterion 1.4.13 - Content on Hover or Focus.\n To fix this warning, change the activator to either IressButton, IressMenuItem or another focusable component.", "warn");
34
- }, [C, F.reference]), /* @__PURE__ */ S(t.div, {
35
- className: e(j.root, w, n.Tooltip),
36
- ...A,
37
- "data-testid": k,
33
+ !C || !I.reference.current || o(I.reference.current).length > 0 || r("IressTooltip: The content that activates the tooltip is not focusable,\n which is a failure of WCAG Level AA Success Criterion 1.4.13 - Content on Hover or Focus.\n To fix this warning, change the activator to either IressButton, IressMenuItem or another focusable component.", "warn");
34
+ }, [C, I.reference]), /* @__PURE__ */ S(t.div, {
35
+ className: e(M.root, w, n.Tooltip),
36
+ ...j,
37
+ "data-testid": A,
38
38
  children: [/* @__PURE__ */ x("div", {
39
- className: j.activator,
40
- "data-testid": i(k, "activator"),
41
- ref: F.setReference,
42
- ...R(),
43
- children: C
44
- }), N && /* @__PURE__ */ x("div", {
45
- className: j.content,
46
- style: I,
47
- "data-testid": i(k, "tooltip-text"),
48
- ref: F.setFloating,
39
+ className: M.activator,
40
+ "data-testid": i(A, "activator"),
41
+ ref: I.setReference,
49
42
  ...z(),
50
- children: a(O).map((e, t, n) => /* @__PURE__ */ S(v, { children: [e, t < n.length - 1 && /* @__PURE__ */ x("br", {})] }, t))
43
+ children: C
44
+ }), P && /* @__PURE__ */ x("div", {
45
+ className: M.content,
46
+ style: L,
47
+ "data-testid": i(A, "tooltip-text"),
48
+ ref: I.setFloating,
49
+ ...B(),
50
+ children: k === "rich" ? a(O).map((e, t) => /* @__PURE__ */ x("span", {
51
+ className: t === 0 ? M.richName : M.richMeta,
52
+ children: e
53
+ }, t)) : a(O).map((e, t, n) => /* @__PURE__ */ S(v, { children: [e, t < n.length - 1 && /* @__PURE__ */ x("br", {})] }, t))
51
54
  })]
52
55
  });
53
56
  };
@@ -1 +1,10 @@
1
- export declare const tooltip: import('../../styled-system/types').SlotRecipeRuntimeFn<"content" | "root" | "activator", {}>;
1
+ export declare const tooltip: import('../../styled-system/types').SlotRecipeRuntimeFn<"content" | "root" | "activator" | "richName" | "richMeta", {
2
+ variant: {
3
+ rich: {
4
+ content: {
5
+ display: "flex";
6
+ flexDirection: "column";
7
+ };
8
+ };
9
+ };
10
+ }>;
@@ -4,7 +4,9 @@ var t = e({
4
4
  slots: [
5
5
  "root",
6
6
  "activator",
7
- "content"
7
+ "content",
8
+ "richName",
9
+ "richMeta"
8
10
  ],
9
11
  base: {
10
12
  root: {
@@ -25,9 +27,17 @@ var t = e({
25
27
  textStyle: "typography.body.sm.regular",
26
28
  color: "colour.neutral.10",
27
29
  bg: "colour.neutral.80"
30
+ },
31
+ richName: { textStyle: "typography.body.md.medium" },
32
+ richMeta: {
33
+ textStyle: "typography.body.sm.regular",
34
+ opacity: "[0.75]"
28
35
  }
29
36
  },
30
- variants: {},
37
+ variants: { variant: { rich: { content: {
38
+ display: "flex",
39
+ flexDirection: "column"
40
+ } } } },
31
41
  compoundVariants: []
32
42
  });
33
43
  //#endregion
package/dist/main.js CHANGED
@@ -149,7 +149,7 @@ import { IressFormField as mn } from "./patterns/Form/FormField/FormField.js";
149
149
  import { IressFormFieldset as hn } from "./patterns/Form/FormField/FormFieldset.js";
150
150
  import { IressLoading as gn } from "./patterns/Loading/Loading.js";
151
151
  import { IressLoadingSuspense as _n } from "./patterns/Loading/LoadingSuspense.js";
152
- import { t as vn } from "./Shadow-Duhyx42v.js";
152
+ import { t as vn } from "./Shadow-BL3YAhE_.js";
153
153
  import { contextualMenu as yn } from "./patterns/ContextualMenu/ContextualMenu.styles.js";
154
154
  import { IressContextualMenu as bn } from "./patterns/ContextualMenu/ContextualMenu.js";
155
155
  import { sideNav as xn } from "./patterns/SideNav/SideNav.styles.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../Shadow-Duhyx42v.js";
1
+ import { t as e } from "../../Shadow-BL3YAhE_.js";
2
2
  export { e as IressShadow };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../Shadow-Duhyx42v.js";
1
+ import { t as e } from "../../Shadow-BL3YAhE_.js";
2
2
  export { e as IressShadow };