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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/badge/StyledBadge.js +33 -31
- package/dist/components/utils/filter-menu/StyledFilterButton.js +18 -12
- package/dist/components/utils/filter-menu/StyledFilterMenu.js +36 -30
- package/dist/src/components/data-display/badge/StyledBadge.d.ts +20 -2
- package/dist/src/components/utils/filter-menu/StyledFilterButton.d.ts +1 -1
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveSx as
|
|
2
|
-
import
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
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
|
-
},
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
const
|
|
45
|
-
borderColor:
|
|
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:
|
|
48
|
-
} : {};
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
className: "relative inline-flex shrink-0 align-middle",
|
|
51
|
-
"data-testid":
|
|
52
|
-
style:
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
!
|
|
56
|
+
f,
|
|
57
|
+
!R && /* @__PURE__ */ h("span", {
|
|
57
58
|
"aria-hidden": "true",
|
|
58
|
-
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
|
-
...
|
|
61
|
-
...
|
|
62
|
-
...
|
|
63
|
-
...
|
|
61
|
+
..._[s] ?? _.default,
|
|
62
|
+
...n ? { backgroundColor: "var(--colors-gama-500)" } : {},
|
|
63
|
+
...N,
|
|
64
|
+
...C,
|
|
65
|
+
...m?.badge?.style
|
|
64
66
|
},
|
|
65
|
-
children:
|
|
67
|
+
children: D
|
|
66
68
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
ref:
|
|
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
|
-
|
|
80
|
+
U as StyledBadge
|
|
79
81
|
};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
|
3
|
-
import { StyledPopover as
|
|
4
|
-
import { useDynamicToolbarLayout as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Fragment as
|
|
8
|
-
var
|
|
9
|
-
const [r, t] =
|
|
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() :
|
|
20
|
+
r ? l() : e(a);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
|
-
}, N = (r) =>
|
|
23
|
-
const { onAnchorClick: u, onClose: m, anchorEl:
|
|
24
|
-
isOpen: !!
|
|
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 =
|
|
27
|
-
return /* @__PURE__ */ y(
|
|
27
|
+
}), p = s.useId();
|
|
28
|
+
return /* @__PURE__ */ y(I, { children: [/* @__PURE__ */ y("div", {
|
|
28
29
|
className: "relative h-fit w-fit",
|
|
29
|
-
children: [
|
|
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__ */
|
|
34
|
-
width:
|
|
35
|
-
height:
|
|
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:
|
|
39
|
-
dataTest:
|
|
40
|
-
"aria-label": g ?
|
|
39
|
+
size: n,
|
|
40
|
+
dataTest: e,
|
|
41
|
+
"aria-label": g ? h ?? "Filter" : void 0,
|
|
41
42
|
"aria-haspopup": "true",
|
|
42
|
-
"aria-expanded": !!
|
|
43
|
-
"aria-controls":
|
|
44
|
-
children: !g && (
|
|
45
|
-
}), r && /* @__PURE__ */
|
|
46
|
-
|
|
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: !!
|
|
50
|
-
anchorEl:
|
|
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: !!
|
|
68
|
+
isOpen: !!i,
|
|
63
69
|
onClose: m
|
|
64
70
|
})
|
|
65
71
|
})] });
|
|
66
72
|
};
|
|
67
73
|
export {
|
|
68
|
-
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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 —
|
|
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
|