asma-ui-core 3.99.0 → 3.100.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.
@@ -1,8 +1,8 @@
1
- import { resolveSx as p } from "../../../helpers/sx.js";
2
- import E from "clsx";
3
- import { useEffect as L, useRef as u } from "react";
4
- import { jsx as m, jsxs as D } from "react/jsx-runtime";
5
- var b = {
1
+ import { resolveSx as v } from "../../../helpers/sx.js";
2
+ import g from "clsx";
3
+ import { useEffect as I, useRef as y } from "react";
4
+ import { jsx as h, jsxs as T } from "react/jsx-runtime";
5
+ var _ = {
6
6
  primary: {
7
7
  backgroundColor: "var(--colors-badge-background)",
8
8
  color: "var(--colors-badge-label)"
@@ -31,41 +31,43 @@ var b = {
31
31
  backgroundColor: "var(--colors-warning-700)",
32
32
  color: "#fff"
33
33
  }
34
- }, $ = {
34
+ }, Z = {
35
35
  "top-right": "top-0 right-0 translate-x-1/2 -translate-y-1/2 origin-[100%_0%]",
36
36
  "top-left": "top-0 left-0 -translate-x-1/2 -translate-y-1/2 origin-[0%_0%]",
37
37
  "bottom-right": "bottom-0 right-0 translate-x-1/2 translate-y-1/2 origin-[100%_100%]",
38
38
  "bottom-left": "bottom-0 left-0 -translate-x-1/2 translate-y-1/2 origin-[0%_100%]"
39
- }, x = "& .MuiBadge-badge", J = ({ color: l = "primary", dataTest: v, size: s = "medium", badgeContent: r, max: z, showZero: I, variant: y = "standard", statusMessage: n, invisible: g, anchorOrigin: c, children: h, className: _, sx: t, overlap: T, classes: Z, slots: G, slotProps: i, component: H, tabIndex: W, ...S }) => {
40
- const a = u(null), e = typeof r == "number" ? r : void 0, d = u(e);
41
- L(() => {
42
- e !== d.current && (d.current = e, a.current && (a.current.textContent = n ?? ""));
43
- }, [e, n]);
44
- const f = t && typeof t == "object" && !Array.isArray(t) ? t : {}, w = p(f[x]), k = p(Object.fromEntries(Object.entries(f).filter(([B]) => B !== x))), o = y === "dot", j = !!g || !o && (r === 0 || r === void 0 || r === null), O = o ? null : typeof r == "number" && r > 99 ? "99+" : r, A = typeof r == "number" && r > 0 && r < 10, C = c?.vertical ?? "top", N = c?.horizontal ?? "right", R = l === "primary" ? {
45
- borderColor: o ? "var(--colors-badge-border-dot)" : "var(--colors-badge-border-count)",
39
+ }, w = "& .MuiBadge-badge", U = ({ color: s = "primary", dataTest: S, size: i = "medium", badgeContent: o, max: G, showZero: H, variant: k = "standard", purpose: j = "notification", statusMessage: c, invisible: A, anchorOrigin: d, children: f, className: u, sx: e, overlap: W, classes: X, slots: Y, slotProps: m, component: q, tabIndex: F, ...p }) => {
40
+ const l = y(null), a = typeof o == "number" ? o : void 0, b = y(a);
41
+ I(() => {
42
+ a !== b.current && (b.current = a, l.current && (l.current.textContent = c ?? ""));
43
+ }, [a, c]);
44
+ const x = e && typeof e == "object" && !Array.isArray(e) ? e : {}, C = v(x[w]), O = v(Object.fromEntries(Object.entries(x).filter(([z]) => z !== w))), r = k === "dot", n = r && j !== "notification", t = r && f === void 0, R = !!A || !r && (o === 0 || o === void 0 || o === null), D = r ? null : typeof o == "number" && o > 99 ? "99+" : o, B = typeof o == "number" && o > 0 && o < 10, E = d?.vertical ?? "top", L = d?.horizontal ?? "right", N = s === "primary" && !n ? {
45
+ borderColor: r ? "var(--colors-badge-border-dot)" : "var(--colors-badge-border-count)",
46
46
  borderStyle: "solid",
47
- borderWidth: o ? "var(--border-badge-dot)" : "var(--border-badge-count)"
48
- } : {};
49
- return /* @__PURE__ */ D("span", {
50
- className: "relative inline-flex shrink-0 align-middle",
51
- "data-testid": v,
52
- style: k,
53
- ...S,
47
+ borderWidth: r ? "var(--border-badge-dot)" : "var(--border-badge-count)"
48
+ } : {}, $ = t && p["aria-label"] ? { role: "img" } : {};
49
+ return /* @__PURE__ */ T("span", {
50
+ className: t ? g("inline-flex shrink-0 align-middle", u) : "relative inline-flex shrink-0 align-middle",
51
+ "data-testid": S,
52
+ style: O,
53
+ ...$,
54
+ ...p,
54
55
  children: [
55
- h,
56
- !j && /* @__PURE__ */ m("span", {
56
+ f,
57
+ !R && /* @__PURE__ */ h("span", {
57
58
  "aria-hidden": "true",
58
- className: E("absolute z-[1] box-border flex items-center justify-center whitespace-nowrap font-roboto font-semibold", $[`${C}-${N}`], o ? "h-[12px] w-[12px] min-w-[12px] rounded-full p-0" : s === "small" ? "h-[16px] w-max min-w-[16px] rounded-[20px] px-[4px] text-[0.75rem]" : "h-[20px] min-w-[20px] rounded-[20px] px-[6px] text-sm leading-5", !o && s === "medium" && A && "w-[20px]", _, i?.badge?.className),
59
+ className: g("box-border flex items-center justify-center whitespace-nowrap font-roboto font-semibold", !t && "absolute z-[1]", !t && Z[`${E}-${L}`], n ? "h-[8px] w-[8px] min-w-[8px] rounded-full p-0" : r ? "h-[12px] w-[12px] min-w-[12px] rounded-full p-0" : i === "small" ? "h-[16px] w-max min-w-[16px] rounded-[20px] px-[4px] text-[0.75rem]" : "h-[20px] min-w-[20px] rounded-[20px] px-[6px] text-sm leading-5", !r && i === "medium" && B && "w-[20px]", !t && u, m?.badge?.className),
59
60
  style: {
60
- ...b[l] ?? b.default,
61
- ...R,
62
- ...w,
63
- ...i?.badge?.style
61
+ ..._[s] ?? _.default,
62
+ ...n ? { backgroundColor: "var(--colors-gama-500)" } : {},
63
+ ...N,
64
+ ...C,
65
+ ...m?.badge?.style
64
66
  },
65
- children: O
67
+ children: D
66
68
  }),
67
- /* @__PURE__ */ m("span", {
68
- ref: a,
69
+ /* @__PURE__ */ h("span", {
70
+ ref: l,
69
71
  "aria-atomic": "true",
70
72
  "aria-live": "polite",
71
73
  className: "sr-only",
@@ -75,5 +77,5 @@ var b = {
75
77
  });
76
78
  };
77
79
  export {
78
- J as StyledBadge
80
+ U as StyledBadge
79
81
  };
@@ -1,26 +1,32 @@
1
- import { FilterIcon as d } from "../../icons/filter-icon/FilterIcon.js";
2
- import { StyledButton as c } from "../../inputs/button/StyledButton.js";
3
- import { useDynamicToolbarLayout as s } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
4
- import g from "clsx";
5
- import { Fragment as h, jsx as r, jsxs as u } from "react/jsx-runtime";
6
- var F = ({ filterIsActive: i, label: o, hideLabel: l, size: t = "large", variant: a = "outlined", ...n }) => {
7
- const { filterIconOnly: m } = s(), e = l ?? m;
8
- return /* @__PURE__ */ r(h, { children: /* @__PURE__ */ u("div", {
1
+ import { StyledBadge as m } from "../../data-display/badge/StyledBadge.js";
2
+ import { FilterIcon as c } from "../../icons/filter-icon/FilterIcon.js";
3
+ import { StyledButton as s } from "../../inputs/button/StyledButton.js";
4
+ import { useDynamicToolbarLayout as p } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
5
+ import f from "clsx";
6
+ import { Fragment as u, jsx as r, jsxs as g } from "react/jsx-runtime";
7
+ var B = ({ filterIsActive: i, label: o, hideLabel: l, size: t = "large", variant: a = "outlined", ...n }) => {
8
+ const { filterIconOnly: d } = p(), e = l ?? d;
9
+ return /* @__PURE__ */ r(u, { children: /* @__PURE__ */ g("div", {
9
10
  className: "relative h-fit w-fit",
10
- children: [/* @__PURE__ */ r(c, {
11
+ children: [/* @__PURE__ */ r(s, {
11
12
  ...n,
12
13
  type: "button",
13
14
  "aria-label": e ? o ?? "Filter" : void 0,
14
- startIcon: /* @__PURE__ */ r(d, {
15
+ startIcon: /* @__PURE__ */ r(c, {
15
16
  width: t === "large" ? 24 : 20,
16
17
  height: t === "large" ? 24 : 20
17
18
  }),
18
19
  variant: a,
19
20
  size: t,
20
21
  children: !e && (o ?? "Filter")
21
- }), i && /* @__PURE__ */ r("div", { className: g("absolute h-2 w-2 rounded-full bg-gama-400", t === "large" ? "right-2 top-2" : "right-1 top-1") })]
22
+ }), i && /* @__PURE__ */ r(m, {
23
+ dataTest: "filter-button-active-dot",
24
+ variant: "dot",
25
+ purpose: "filter",
26
+ className: f("absolute", t === "large" ? "right-2 top-2" : "right-1 top-1")
27
+ })]
22
28
  }) });
23
29
  };
24
30
  export {
25
- F as StyledFilterButton
31
+ B as StyledFilterButton
26
32
  };
@@ -1,12 +1,13 @@
1
+ import { StyledBadge as O } from "../../data-display/badge/StyledBadge.js";
1
2
  import { FilterIcon as b } from "../../icons/filter-icon/FilterIcon.js";
2
- import { StyledButton as v } from "../../inputs/button/StyledButton.js";
3
- import { StyledPopover as E } from "../popover/StyledPopover.js";
4
- import { useDynamicToolbarLayout as F } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
5
- import k from "clsx";
6
- import c, { useState as x } from "react";
7
- import { Fragment as C, jsx as e, jsxs as y } from "react/jsx-runtime";
8
- var I = () => {
9
- const [r, t] = x(null), s = (a) => {
3
+ import { StyledButton as E } from "../../inputs/button/StyledButton.js";
4
+ import { StyledPopover as F } from "../popover/StyledPopover.js";
5
+ import { useDynamicToolbarLayout as k } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
6
+ import x from "clsx";
7
+ import s, { useState as C } from "react";
8
+ import { Fragment as I, jsx as c, jsxs as y } from "react/jsx-runtime";
9
+ var S = () => {
10
+ const [r, t] = C(null), e = (a) => {
10
11
  const o = a.currentTarget;
11
12
  t(o);
12
13
  }, l = () => {
@@ -16,38 +17,43 @@ var I = () => {
16
17
  anchorEl: r,
17
18
  onClose: l,
18
19
  onAnchorClick: (a) => {
19
- r ? l() : s(a);
20
+ r ? l() : e(a);
20
21
  }
21
22
  };
22
- }, N = (r) => c.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), $ = ({ filterIsActive: r, popoverContent: t, dataTest: s, disabled: l, size: i = "large", variant: a = "outlined", popoverProps: o, anchorNode: h, label: d, hideLabel: A }) => {
23
- const { onAnchorClick: u, onClose: m, anchorEl: n } = I(), { filterIconOnly: O } = F(), g = A ?? O, f = h?.({
24
- isOpen: !!n,
23
+ }, N = (r) => s.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), D = ({ filterIsActive: r, popoverContent: t, dataTest: e, disabled: l, size: n = "large", variant: a = "outlined", popoverProps: o, anchorNode: d, label: h, hideLabel: v }) => {
24
+ const { onAnchorClick: u, onClose: m, anchorEl: i } = S(), { filterIconOnly: A } = k(), g = v ?? A, f = d?.({
25
+ isOpen: !!i,
25
26
  onClose: m
26
- }), p = c.useId();
27
- return /* @__PURE__ */ y(C, { children: [/* @__PURE__ */ y("div", {
27
+ }), p = s.useId();
28
+ return /* @__PURE__ */ y(I, { children: [/* @__PURE__ */ y("div", {
28
29
  className: "relative h-fit w-fit",
29
- children: [h && c.isValidElement(f) ? c.cloneElement(f, { onClick: u }) : /* @__PURE__ */ e(v, {
30
+ children: [d && s.isValidElement(f) ? s.cloneElement(f, { onClick: u }) : /* @__PURE__ */ c(E, {
30
31
  type: "button",
31
32
  disabled: l,
32
33
  variant: a,
33
- startIcon: /* @__PURE__ */ e(b, {
34
- width: i === "large" ? 24 : 20,
35
- height: i === "large" ? 24 : 20
34
+ startIcon: /* @__PURE__ */ c(b, {
35
+ width: n === "large" ? 24 : 20,
36
+ height: n === "large" ? 24 : 20
36
37
  }),
37
38
  onClick: u,
38
- size: i,
39
- dataTest: s,
40
- "aria-label": g ? d ?? "Filter" : void 0,
39
+ size: n,
40
+ dataTest: e,
41
+ "aria-label": g ? h ?? "Filter" : void 0,
41
42
  "aria-haspopup": "true",
42
- "aria-expanded": !!n,
43
- "aria-controls": n ? p : void 0,
44
- children: !g && (d ?? "Filter")
45
- }), r && /* @__PURE__ */ e("div", { className: k("absolute h-2 w-2 rounded-full bg-gama-400", i === "large" ? "right-2 top-2" : "right-1 top-1") })]
46
- }), /* @__PURE__ */ e(E, {
43
+ "aria-expanded": !!i,
44
+ "aria-controls": i ? p : void 0,
45
+ children: !g && (h ?? "Filter")
46
+ }), r && /* @__PURE__ */ c(O, {
47
+ dataTest: `${e}-active-dot`,
48
+ variant: "dot",
49
+ purpose: "filter",
50
+ className: x("absolute", n === "large" ? "right-2 top-2" : "right-1 top-1")
51
+ })]
52
+ }), /* @__PURE__ */ c(F, {
47
53
  ...o,
48
54
  id: p,
49
- open: !!n,
50
- anchorEl: n,
55
+ open: !!i,
56
+ anchorEl: i,
51
57
  onClose: m,
52
58
  anchorOrigin: o?.anchorOrigin ?? {
53
59
  vertical: "bottom",
@@ -59,11 +65,11 @@ var I = () => {
59
65
  },
60
66
  className: o?.className ?? "my-1",
61
67
  children: N(t) ? t : t({
62
- isOpen: !!n,
68
+ isOpen: !!i,
63
69
  onClose: m
64
70
  })
65
71
  })] });
66
72
  };
67
73
  export {
68
- $ as StyledFilterMenu
74
+ D as StyledFilterMenu
69
75
  };
@@ -1,10 +1,19 @@
1
1
  import { CSSProperties, ElementType, HTMLAttributes, ReactNode } from 'react';
2
2
  type StyledBadgeSize = 'medium' | 'small';
3
+ /** Figma's `Parent` axis. It sets the dot's size and fill together, which is why it is not a colour. */
4
+ type StyledBadgePurpose = 'notification' | 'unread' | 'filter';
3
5
  /**
4
6
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#15181-43817
5
7
  * Figma "Badge". Notification count = 20px lime pill with a 1px border and Helper-Semibold 14/20;
6
8
  * `dot` = 12px lime circle with a stronger 2px border. Other colors and `small` are legacy app
7
9
  * extensions with no matching Figma notification variant.
10
+ *
11
+ * Pass children to decorate them — the badge anchors to their corner. Pass none and a `dot` becomes
12
+ * a flow element (Figma `Size=Dot`, node 44267-214524), for a table cell or a marker in a row, and
13
+ * `className` then applies to the badge's own root so the caller can place it.
14
+ *
15
+ * `purpose` selects Figma's `Parent`: the default notification dot, or the 8px solid primary dot
16
+ * that marks something unread or a filter as active.
8
17
  */
9
18
  interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
10
19
  /** @figmaProp Badge content (the number/label) */
@@ -15,8 +24,17 @@ interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
15
24
  max?: number;
16
25
  /** @deprecated A zero notification count is always omitted. */
17
26
  showZero?: boolean;
18
- /** @figmaProp Size = dot→"Dot" (12px) | standard→"Default" count badge */
27
+ /**
28
+ * @figmaProp Size = dot→"Dot" (12px) | standard→"Default" count badge
29
+ * A `dot` with no children renders in normal flow rather than anchored to a corner.
30
+ */
19
31
  variant?: 'standard' | 'dot';
32
+ /**
33
+ * @figmaProp Parent = notification→the lime ringed dot | unread/filter→an 8px solid primary dot
34
+ * `unread` and `filter` are the same mark in Figma and differ only in meaning. Dots only: a
35
+ * count badge is always the notification pill.
36
+ */
37
+ purpose?: StyledBadgePurpose;
20
38
  /** Polite live-update text. Keep this contextual and include the real, uncapped count. */
21
39
  statusMessage?: string;
22
40
  invisible?: boolean;
@@ -46,5 +64,5 @@ type StyledBadgeProps = BadgeProps & {
46
64
  * The established styling API `sx={{ '& .MuiBadge-badge': {...} }}` is preserved by extracting that
47
65
  * slot and applying `resolveSx` to the badge span (DEC-007 slot-sx). Signature unchanged (DEC-003).
48
66
  */
49
- export declare const StyledBadge: ({ color, dataTest, size, badgeContent, max: _max, showZero: _showZero, variant, statusMessage, invisible, anchorOrigin, children, className, sx, overlap: _overlap, classes: _classes, slots: _slots, slotProps, component: _component, tabIndex: _tabIndex, ...props }: StyledBadgeProps) => JSX.Element;
67
+ export declare const StyledBadge: ({ color, dataTest, size, badgeContent, max: _max, showZero: _showZero, variant, purpose, statusMessage, invisible, anchorOrigin, children, className, sx, overlap: _overlap, classes: _classes, slots: _slots, slotProps, component: _component, tabIndex: _tabIndex, ...props }: StyledBadgeProps) => JSX.Element;
50
68
  export {};
@@ -2,7 +2,7 @@ import { StyledButtonProps } from '../../inputs/button';
2
2
  /**
3
3
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#16741-35884 (Design-System · "Filter button") — button-only variant
4
4
  * of `StyledFilterMenu` (no popover). Aligned `StyledButton` (Outlined) + the "Filters applied" badge:
5
- * an 8px `gama-400` dot at top-right when `filterIsActive`.
5
+ * Figma's `Parent=Filter` dot at top-right when `filterIsActive`.
6
6
  *
7
7
  * Custom props:
8
8
  * @param filterIsActive - needed to determine whether or not to show the dot in the top right corner indicating some changes were made
@@ -4,8 +4,8 @@ import { StyledPopoverProps } from '../popover';
4
4
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#16741-35884 (Design-System · "Filter button")
5
5
  *
6
6
  * Composes the aligned `StyledButton` (Secondary/Outlined, filter icon 24/20) + `StyledPopover`
7
- * (Menus surface). `filterIsActive` shows the DS "Filters applied" badge — an 8px `gama-400` dot at
8
- * top-right. No own styling beyond that dot; all visuals come from the aligned primitives.
7
+ * (Menus surface). `filterIsActive` shows the DS "Filters applied" badge — Figma's `Parent=Filter`
8
+ * dot at top-right. No own styling beyond that dot; all visuals come from the aligned primitives.
9
9
  *
10
10
  * Custom props:
11
11
  * @param filterIsActive - needed to determine whether or not to show the dot in the top right corner indicating some changes were made
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.99.0",
6
+ "version": "3.100.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",