@sesamehr/react-design-system 3.11.0 → 3.12.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.
@@ -34,8 +34,22 @@ export interface AvatarGroupProps extends Omit<React.ButtonHTMLAttributes<HTMLBu
34
34
  interactive?: boolean;
35
35
  /** The size every avatar in the stack is drawn at. */
36
36
  size?: AvatarSize;
37
- /** Click handler (only fired when interactive) */
38
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
37
+ /**
38
+ * Click handler (only fired when interactive). `avatar` is the avatar the
39
+ * click landed on and `index` its index into `avatars`.
40
+ *
41
+ * Avatars only report themselves while the stack is **complete**. The
42
+ * moment there is an overflow counter the stack is one affordance for the
43
+ * whole group, so every click fires with no payload at all, a click straight
44
+ * on a face included: what is on show is a subset, and pointing at one cannot
45
+ * stand for a person. So an absent avatar means "the group", and a caller
46
+ * written before this ignores the arguments and is unaffected.
47
+ *
48
+ * The faces are still not individually focusable, since the stack is one
49
+ * `<button>`, so this is a pointer-grade affordance. A caller that needs
50
+ * per-person keyboard access has to paint the avatars itself.
51
+ */
52
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, avatar?: AvatarItem, index?: number) => void;
39
53
  dataTestid: string;
40
54
  }
41
55
  export declare const AvatarGroup: import('react').ForwardRefExoticComponent<AvatarGroupProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,90 +1,102 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import * as d from "@radix-ui/react-tooltip";
3
- import { forwardRef as b, useMemo as f } from "react";
4
- import { cn as y } from "../../lib/utils.js";
1
+ import { jsx as a, jsxs as p } from "react/jsx-runtime";
2
+ import * as c from "@radix-ui/react-tooltip";
3
+ import { forwardRef as I, useMemo as v } from "react";
4
+ import { cn as $ } from "../../lib/utils.js";
5
5
  import o from "./AvatarGroup.module.css.js";
6
- import { AvatarRounded as g } from "../Avatar/AvatarRounded/AvatarRounded.js";
7
- import { TooltipContent as I } from "../../Feedback/Tooltip/TooltipContent.js";
8
- const N = 300, $ = b(
6
+ import { AvatarRounded as G } from "../Avatar/AvatarRounded/AvatarRounded.js";
7
+ import { TooltipContent as R } from "../../Feedback/Tooltip/TooltipContent.js";
8
+ const T = 300, w = I(
9
9
  ({
10
- className: v,
11
- avatars: e,
12
- max: c = 3,
13
- total: p,
14
- interactive: u = !0,
15
- size: a = "xs",
16
- onClick: s,
17
- dataTestid: n,
18
- ...x
19
- }, G) => {
20
- const i = f(() => e.slice(0, c), [e, c]), h = f(() => {
21
- const r = p ?? e.length;
22
- return Math.max(0, Math.trunc(r) - i.length) || 0;
23
- }, [p, e.length, i.length]);
24
- return /* @__PURE__ */ t(
10
+ className: b,
11
+ avatars: d,
12
+ max: h = 3,
13
+ total: x,
14
+ interactive: A = !0,
15
+ size: l = "xs",
16
+ onClick: r,
17
+ dataTestid: i,
18
+ ...N
19
+ }, y) => {
20
+ const s = v(() => d.slice(0, h), [d, h]), m = v(() => {
21
+ const t = x ?? d.length;
22
+ return Math.max(0, Math.trunc(t) - s.length) || 0;
23
+ }, [x, d.length, s.length]);
24
+ return /* @__PURE__ */ a(
25
25
  "button",
26
26
  {
27
- ref: G,
27
+ ref: y,
28
28
  type: "button",
29
29
  "data-slot": "avatar-group",
30
- "data-testid": n,
31
- className: y(
30
+ "data-testid": i,
31
+ className: $(
32
32
  o.oxAvatarGroup,
33
- o[`oxAvatarGroup--${a}`],
34
- u && o.oxAvatarGroupInteractive,
35
- v
33
+ o[`oxAvatarGroup--${l}`],
34
+ A && o.oxAvatarGroupInteractive,
35
+ m > 0 && o.oxAvatarGroupOverflowing,
36
+ b
36
37
  ),
37
- onClick: (r) => {
38
- u && (s == null || s(r));
38
+ onClick: (t) => {
39
+ var u, g;
40
+ if (!A) return;
41
+ if (m > 0) {
42
+ r == null || r(t);
43
+ return;
44
+ }
45
+ const e = (g = (u = t.target) == null ? void 0 : u.closest) == null ? void 0 : g.call(
46
+ u,
47
+ "[data-avatar-index]"
48
+ ), n = e ? Number(e.getAttribute("data-avatar-index")) : -1, f = s[n];
49
+ f ? r == null || r(t, f, n) : r == null || r(t);
39
50
  },
40
- ...x,
41
- children: /* @__PURE__ */ t(d.Provider, { delayDuration: N, children: /* @__PURE__ */ m("div", { className: o.oxAvatarGroupStack, children: [
42
- i.map((r, l) => {
43
- const A = /* @__PURE__ */ t(
44
- g,
51
+ ...N,
52
+ children: /* @__PURE__ */ a(c.Provider, { delayDuration: T, children: /* @__PURE__ */ p("div", { className: o.oxAvatarGroupStack, children: [
53
+ s.map((t, e) => {
54
+ const n = /* @__PURE__ */ a(
55
+ G,
45
56
  {
46
- role: r.name ? "img" : void 0,
47
- "aria-label": r.name,
48
- dataTestid: `${n}-avatar-${l}`,
49
- src: r.src,
50
- size: a,
51
- disabled: r.disabled,
52
- children: r.initials
57
+ role: t.name ? "img" : void 0,
58
+ "aria-label": t.name,
59
+ dataTestid: `${i}-avatar-${e}`,
60
+ src: t.src,
61
+ size: l,
62
+ disabled: t.disabled,
63
+ children: t.initials
53
64
  }
54
65
  );
55
- return /* @__PURE__ */ t(
66
+ return /* @__PURE__ */ a(
56
67
  "div",
57
68
  {
58
69
  className: o.oxAvatarGroupItem,
59
- style: { zIndex: l },
60
- children: r.name ? /* @__PURE__ */ m(d.Root, { children: [
61
- /* @__PURE__ */ t(d.Trigger, { asChild: !0, children: A }),
62
- /* @__PURE__ */ t(
63
- I,
70
+ "data-avatar-index": e,
71
+ style: { zIndex: e },
72
+ children: t.name ? /* @__PURE__ */ p(c.Root, { children: [
73
+ /* @__PURE__ */ a(c.Trigger, { asChild: !0, children: n }),
74
+ /* @__PURE__ */ a(
75
+ R,
64
76
  {
65
- dataTestid: `${n}-tooltip-${l}`,
66
- children: r.name
77
+ dataTestid: `${i}-tooltip-${e}`,
78
+ children: t.name
67
79
  }
68
80
  )
69
- ] }) : A
81
+ ] }) : n
70
82
  },
71
- l
83
+ e
72
84
  );
73
85
  }),
74
- h > 0 && /* @__PURE__ */ t(
86
+ m > 0 && /* @__PURE__ */ a(
75
87
  "div",
76
88
  {
77
89
  className: o.oxAvatarGroupItem,
78
- style: { zIndex: i.length },
79
- children: /* @__PURE__ */ m(
80
- g,
90
+ style: { zIndex: s.length },
91
+ children: /* @__PURE__ */ p(
92
+ G,
81
93
  {
82
- dataTestid: `${n}-count`,
83
- size: a,
94
+ dataTestid: `${i}-count`,
95
+ size: l,
84
96
  tone: "neutral",
85
97
  children: [
86
98
  "+",
87
- h
99
+ m
88
100
  ]
89
101
  }
90
102
  )
@@ -95,7 +107,7 @@ const N = 300, $ = b(
95
107
  );
96
108
  }
97
109
  );
98
- $.displayName = "OxAvatarGroup";
110
+ w.displayName = "OxAvatarGroup";
99
111
  export {
100
- $ as AvatarGroup
112
+ w as AvatarGroup
101
113
  };
@@ -1,18 +1,20 @@
1
- const a = "_oxAvatarGroup_11xgt_2", t = "_oxAvatarGroupInteractive_11xgt_2", o = "_oxAvatarGroupStack_11xgt_2", r = "_oxAvatarGroupItem_11xgt_2", x = {
2
- oxAvatarGroup: a,
3
- "oxAvatarGroup--xs": "_oxAvatarGroup--xs_11xgt_2",
4
- "oxAvatarGroup--sm": "_oxAvatarGroup--sm_11xgt_2",
5
- "oxAvatarGroup--md": "_oxAvatarGroup--md_11xgt_2",
6
- "oxAvatarGroup--lg": "_oxAvatarGroup--lg_11xgt_2",
7
- "oxAvatarGroup--xl": "_oxAvatarGroup--xl_11xgt_2",
8
- oxAvatarGroupInteractive: t,
9
- oxAvatarGroupStack: o,
10
- oxAvatarGroupItem: r
1
+ const o = "_oxAvatarGroup_1tcwh_2", a = "_oxAvatarGroupInteractive_1tcwh_2", r = "_oxAvatarGroupOverflowing_1tcwh_2", t = "_oxAvatarGroupStack_1tcwh_2", v = "_oxAvatarGroupItem_1tcwh_2", x = {
2
+ oxAvatarGroup: o,
3
+ "oxAvatarGroup--xs": "_oxAvatarGroup--xs_1tcwh_2",
4
+ "oxAvatarGroup--sm": "_oxAvatarGroup--sm_1tcwh_2",
5
+ "oxAvatarGroup--md": "_oxAvatarGroup--md_1tcwh_2",
6
+ "oxAvatarGroup--lg": "_oxAvatarGroup--lg_1tcwh_2",
7
+ "oxAvatarGroup--xl": "_oxAvatarGroup--xl_1tcwh_2",
8
+ oxAvatarGroupInteractive: a,
9
+ oxAvatarGroupOverflowing: r,
10
+ oxAvatarGroupStack: t,
11
+ oxAvatarGroupItem: v
11
12
  };
12
13
  export {
13
14
  x as default,
14
- a as oxAvatarGroup,
15
- t as oxAvatarGroupInteractive,
16
- r as oxAvatarGroupItem,
17
- o as oxAvatarGroupStack
15
+ o as oxAvatarGroup,
16
+ a as oxAvatarGroupInteractive,
17
+ v as oxAvatarGroupItem,
18
+ r as oxAvatarGroupOverflowing,
19
+ t as oxAvatarGroupStack
18
20
  };
@@ -4,6 +4,11 @@ export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
4
4
  dismissible?: boolean;
5
5
  collapsible?: boolean;
6
6
  isOpen?: boolean;
7
+ /**
8
+ * Drops the "Generated with AI" marker from an `ai` alert. Read on `ai` and
9
+ * ignored everywhere else.
10
+ */
11
+ hideAiTag?: boolean;
7
12
  /** Called once the alert has been dismissed. */
8
13
  onDismissed?: () => void;
9
14
  /** Called with the next open state — the controlled half of `isOpen`. */
@@ -1,60 +1,71 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as p, useState as I } from "react";
3
- import { TransitionFade as y } from "../../Transitions/TransitionFade/TransitionFade.js";
4
- import { cn as M } from "../../lib/utils.js";
5
- import o from "./Alert.module.css.js";
6
- import { AlertContext as N } from "./alert-context.js";
7
- const j = 200, w = p(
1
+ import { jsx as i, jsxs as s } from "react/jsx-runtime";
2
+ import { IconSesameIa as j } from "@sesame/orxata-icons/IconSesameIa";
3
+ import { Icon as y } from "@sesame/orxata-icons/react";
4
+ import { forwardRef as M, useState as N } from "react";
5
+ import { AiTag as T } from "../../Display/AiTag/AiTag.js";
6
+ import { TransitionFade as w } from "../../Transitions/TransitionFade/TransitionFade.js";
7
+ import { cn as D } from "../../lib/utils.js";
8
+ import m from "./Alert.module.css.js";
9
+ import { AlertContext as F } from "./alert-context.js";
10
+ import { useTranslate as P } from "../../Locale/useTranslate.js";
11
+ const R = 200, _ = M(
8
12
  ({
9
- className: m,
13
+ className: c,
10
14
  variant: r = "info",
11
15
  dismissible: f = !1,
12
- collapsible: c = !1,
16
+ collapsible: x = !1,
13
17
  isOpen: t = !0,
14
- onDismissed: e,
15
- onOpenChange: l,
16
- onToggled: i,
18
+ hideAiTag: d = !1,
19
+ onDismissed: a,
20
+ onOpenChange: e,
21
+ onToggled: o,
17
22
  children: u,
18
- ...x
23
+ ...p
19
24
  }, A) => {
20
- const [a, S] = I(!1), v = () => {
21
- S(!0), e == null || e();
22
- }, d = () => {
23
- l == null || l(!t), i == null || i(!t);
25
+ const [l, I] = N(!1), S = P(), v = () => {
26
+ I(!0), a == null || a();
27
+ }, h = () => {
28
+ e == null || e(!t), o == null || o(!t);
24
29
  };
25
- return /* @__PURE__ */ s(
26
- N.Provider,
30
+ return /* @__PURE__ */ i(
31
+ F.Provider,
27
32
  {
28
33
  value: {
29
34
  variant: r,
30
- isDismissed: a,
35
+ isDismissed: l,
31
36
  isOpen: t,
32
37
  dismissible: f,
33
- collapsible: c,
38
+ collapsible: x,
34
39
  handleDismiss: v,
35
- handleToggle: d
40
+ handleToggle: h
36
41
  },
37
- children: /* @__PURE__ */ s(y, { in: !a, leaveDuration: j, children: /* @__PURE__ */ s(
42
+ children: /* @__PURE__ */ i(w, { in: !l, leaveDuration: R, children: /* @__PURE__ */ s(
38
43
  "div",
39
44
  {
40
45
  ref: A,
41
- className: M(
42
- o.oxAlert,
43
- o[`oxAlert-${r}`],
44
- m
46
+ className: D(
47
+ m.oxAlert,
48
+ m[`oxAlert-${r}`],
49
+ c
45
50
  ),
46
51
  role: "alert",
47
52
  "aria-live": r === "error" ? "assertive" : "polite",
48
53
  "aria-atomic": "true",
49
- ...x,
50
- children: u
54
+ ...p,
55
+ children: [
56
+ r === "ai" && !d && /* @__PURE__ */ s(T, { dataTestid: "ox-alert-ai-tag", children: [
57
+ /* @__PURE__ */ i(y, { icon: j, "data-slot": "icon" }),
58
+ S("orxata.alert.aiTag")
59
+ ] }),
60
+ u
61
+ ]
51
62
  }
52
63
  ) })
53
64
  }
54
65
  );
55
66
  }
56
67
  );
57
- w.displayName = "OxAlert";
68
+ _.displayName = "OxAlert";
58
69
  export {
59
- w as Alert
70
+ _ as Alert
60
71
  };
@@ -1,10 +1,11 @@
1
- const e = "_oxAlert_gm4hh_2", r = {
1
+ const e = "_oxAlert_1nisp_2", r = {
2
2
  oxAlert: e,
3
- "oxAlert-warning": "_oxAlert-warning_gm4hh_2",
4
- "oxAlert-error": "_oxAlert-error_gm4hh_2",
5
- "oxAlert-info": "_oxAlert-info_gm4hh_2",
6
- "oxAlert-success": "_oxAlert-success_gm4hh_2",
7
- "oxAlert-muted": "_oxAlert-muted_gm4hh_2"
3
+ "oxAlert-warning": "_oxAlert-warning_1nisp_2",
4
+ "oxAlert-error": "_oxAlert-error_1nisp_2",
5
+ "oxAlert-info": "_oxAlert-info_1nisp_2",
6
+ "oxAlert-success": "_oxAlert-success_1nisp_2",
7
+ "oxAlert-muted": "_oxAlert-muted_1nisp_2",
8
+ "oxAlert-ai": "_oxAlert-ai_1nisp_2"
8
9
  };
9
10
  export {
10
11
  r as default,
@@ -1,4 +1,4 @@
1
- const t = "_oxAlertDescription_tbt8n_2", e = {
1
+ const t = "_oxAlertDescription_1swes_2", e = {
2
2
  oxAlertDescription: t
3
3
  };
4
4
  export {
@@ -1,37 +1,39 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { IconAlertCircle as f } from "@sesame/orxata-icons/IconAlertCircle";
3
- import { IconAlertTriangle as l } from "@sesame/orxata-icons/IconAlertTriangle";
4
- import { IconCircleCheck as a } from "@sesame/orxata-icons/IconCircleCheck";
2
+ import { IconAlertCircle as a } from "@sesame/orxata-icons/IconAlertCircle";
3
+ import { IconAlertTriangle as f } from "@sesame/orxata-icons/IconAlertTriangle";
4
+ import { IconCircleCheck as l } from "@sesame/orxata-icons/IconCircleCheck";
5
5
  import { IconInfoCircle as s } from "@sesame/orxata-icons/IconInfoCircle";
6
- import { IconStar as p } from "@sesame/orxata-icons/IconStar";
7
- import { Icon as I } from "@sesame/orxata-icons/react";
8
- import { forwardRef as d } from "react";
9
- import { cn as u } from "../../lib/utils.js";
10
- import A from "./AlertIcon.module.css.js";
11
- import { useAlertContext as x } from "./alert-context.js";
12
- const C = {
6
+ import { IconSesameIa as p } from "@sesame/orxata-icons/IconSesameIa";
7
+ import { IconStar as I } from "@sesame/orxata-icons/IconStar";
8
+ import { Icon as d } from "@sesame/orxata-icons/react";
9
+ import { forwardRef as u } from "react";
10
+ import { cn as A } from "../../lib/utils.js";
11
+ import x from "./AlertIcon.module.css.js";
12
+ import { useAlertContext as C } from "./alert-context.js";
13
+ const g = {
13
14
  info: s,
14
- warning: l,
15
- error: f,
16
- success: a,
17
- muted: p
18
- }, g = d(
19
- ({ className: t, children: e, dataTestid: o, ...n }, c) => {
20
- const { variant: m } = x(), i = C[m];
15
+ warning: f,
16
+ error: a,
17
+ success: l,
18
+ muted: I,
19
+ ai: p
20
+ }, h = u(
21
+ ({ className: t, children: e, dataTestid: o, ...m }, n) => {
22
+ const { variant: c } = C(), i = g[c];
21
23
  return /* @__PURE__ */ r(
22
24
  "div",
23
25
  {
24
- ref: c,
25
- className: u(A.oxAlertIcon, t),
26
+ ref: n,
27
+ className: A(x.oxAlertIcon, t),
26
28
  "data-slot": "icon",
27
29
  "data-testid": o,
28
- ...n,
29
- children: e ?? /* @__PURE__ */ r(I, { icon: i, "data-testid": `${o}-default` })
30
+ ...m,
31
+ children: e ?? /* @__PURE__ */ r(d, { icon: i, "data-testid": `${o}-default` })
30
32
  }
31
33
  );
32
34
  }
33
35
  );
34
- g.displayName = "OxAlertIcon";
36
+ h.displayName = "OxAlertIcon";
35
37
  export {
36
- g as AlertIcon
38
+ h as AlertIcon
37
39
  };
@@ -1,7 +1,8 @@
1
1
  export type AlertLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
2
2
  /**
3
- * AlertLink — the action link the board sits to the right of the text, before
4
- * the close. A `link` prop on `Alert` would carry the text and the destination
5
- * as configuration; `href` and the rest arrive here as native attributes.
3
+ * AlertLink — the action link, which the board puts in a row of its own under
4
+ * the description rather than beside it. A `link` prop on `Alert` would carry
5
+ * the text and the destination as configuration; `href` and the rest arrive
6
+ * here as native attributes.
6
7
  */
7
8
  export declare const AlertLink: import('react').ForwardRefExoticComponent<AlertLinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
@@ -1,4 +1,4 @@
1
- const t = "_oxAlertLink_1kej5_2", e = {
1
+ const t = "_oxAlertLink_manc3_2", e = {
2
2
  oxAlertLink: t
3
3
  };
4
4
  export {
@@ -1,4 +1,4 @@
1
- export type AlertVariant = 'warning' | 'error' | 'info' | 'success' | 'muted';
1
+ export type AlertVariant = 'warning' | 'error' | 'info' | 'success' | 'muted' | 'ai';
2
2
  export interface AlertContextValue {
3
3
  variant: AlertVariant;
4
4
  isDismissed: boolean;