asma-ui-core 3.119.0 → 3.120.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.
- package/dist/components/utils/filter-menu/StyledFilterButton.js +19 -18
- package/dist/components/utils/filter-menu/StyledFilterMenu.js +48 -47
- package/dist/components/utils/filter-menu/filterButtonText.js +8 -0
- package/dist/src/components/utils/filter-menu/StyledFilterButton.d.ts +5 -2
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +5 -2
- package/dist/src/components/utils/filter-menu/filterButtonText.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { StyledBadge as
|
|
2
|
-
import { FilterIcon as
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import { useDynamicToolbarLayout as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { StyledBadge as f } from "../../data-display/badge/StyledBadge.js";
|
|
2
|
+
import { FilterIcon as p } from "../../icons/filter-icon/FilterIcon.js";
|
|
3
|
+
import { StyledButton as h } from "../../inputs/button/StyledButton.js";
|
|
4
|
+
import { useDynamicToolbarLayout as u } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
|
|
5
|
+
import { filterButtonText as g, isFilterDotShown as y } from "./filterButtonText.js";
|
|
6
|
+
import b from "clsx";
|
|
7
|
+
import { Fragment as x, jsx as o, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
var j = ({ filterIsActive: l, activeCount: r, label: a, hideLabel: n, size: t = "large", variant: m = "outlined", ...s }) => {
|
|
9
|
+
const { filterIconOnly: d } = u(), e = n ?? d, i = g(a, r), c = y(l, r);
|
|
10
|
+
return /* @__PURE__ */ o(x, { children: /* @__PURE__ */ v("div", {
|
|
10
11
|
className: "relative h-fit w-fit",
|
|
11
|
-
children: [/* @__PURE__ */
|
|
12
|
-
...
|
|
12
|
+
children: [/* @__PURE__ */ o(h, {
|
|
13
|
+
...s,
|
|
13
14
|
type: "button",
|
|
14
|
-
"aria-label": e ?
|
|
15
|
-
startIcon: /* @__PURE__ */
|
|
15
|
+
"aria-label": e ? i : void 0,
|
|
16
|
+
startIcon: /* @__PURE__ */ o(p, {
|
|
16
17
|
width: t === "large" ? 24 : 20,
|
|
17
18
|
height: t === "large" ? 24 : 20
|
|
18
19
|
}),
|
|
19
|
-
variant:
|
|
20
|
+
variant: m,
|
|
20
21
|
size: t,
|
|
21
|
-
children: !e &&
|
|
22
|
-
}),
|
|
22
|
+
children: !e && i
|
|
23
|
+
}), c && /* @__PURE__ */ o(f, {
|
|
23
24
|
dataTest: "filter-button-active-dot",
|
|
24
25
|
variant: "dot",
|
|
25
26
|
purpose: "filter",
|
|
26
|
-
className:
|
|
27
|
+
className: b("absolute", t === "large" ? "right-2 top-2" : "right-1 top-1")
|
|
27
28
|
})]
|
|
28
29
|
}) });
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
j as StyledFilterButton
|
|
32
33
|
};
|
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
import { StyledBadge as
|
|
2
|
-
import { FilterIcon as
|
|
3
|
-
import { StyledButton as
|
|
1
|
+
import { StyledBadge as S } from "../../data-display/badge/StyledBadge.js";
|
|
2
|
+
import { FilterIcon as E } from "../../icons/filter-icon/FilterIcon.js";
|
|
3
|
+
import { StyledButton as k } from "../../inputs/button/StyledButton.js";
|
|
4
4
|
import { StyledPopover as F } from "../popover/StyledPopover.js";
|
|
5
|
-
import { useDynamicToolbarLayout as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
t
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { useDynamicToolbarLayout as I } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
|
|
6
|
+
import { filterButtonText as w, isFilterDotShown as C } from "./filterButtonText.js";
|
|
7
|
+
import N from "clsx";
|
|
8
|
+
import c, { useState as B } from "react";
|
|
9
|
+
import { Fragment as D, jsx as l, jsxs as A } from "react/jsx-runtime";
|
|
10
|
+
var T = () => {
|
|
11
|
+
const [r, n] = B(null), i = (t) => {
|
|
12
|
+
const s = t.currentTarget;
|
|
13
|
+
n(s);
|
|
14
|
+
}, a = () => {
|
|
15
|
+
n(null);
|
|
15
16
|
};
|
|
16
17
|
return {
|
|
17
18
|
anchorEl: r,
|
|
18
|
-
onClose:
|
|
19
|
-
onAnchorClick: (
|
|
20
|
-
r ?
|
|
19
|
+
onClose: a,
|
|
20
|
+
onAnchorClick: (t) => {
|
|
21
|
+
r ? a() : i(t);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
|
-
},
|
|
24
|
-
const { onAnchorClick: u, onClose: m, anchorEl:
|
|
25
|
-
isOpen: !!
|
|
24
|
+
}, $ = (r) => c.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), K = ({ filterIsActive: r, activeCount: n, popoverContent: i, dataTest: a, disabled: h, size: t = "large", variant: s = "outlined", popoverProps: e, anchorNode: d, label: O, hideLabel: b }) => {
|
|
25
|
+
const { onAnchorClick: u, onClose: m, anchorEl: o } = T(), { filterIconOnly: v } = I(), f = b ?? v, g = w(O, n), x = C(r, n), p = d?.({
|
|
26
|
+
isOpen: !!o,
|
|
26
27
|
onClose: m
|
|
27
|
-
}),
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
}), y = c.useId();
|
|
29
|
+
return /* @__PURE__ */ A(D, { children: [/* @__PURE__ */ A("div", {
|
|
29
30
|
className: "relative h-fit w-fit",
|
|
30
|
-
children: [d &&
|
|
31
|
+
children: [d && c.isValidElement(p) ? c.cloneElement(p, { onClick: u }) : /* @__PURE__ */ l(k, {
|
|
31
32
|
type: "button",
|
|
32
|
-
disabled:
|
|
33
|
-
variant:
|
|
34
|
-
startIcon: /* @__PURE__ */
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
33
|
+
disabled: h,
|
|
34
|
+
variant: s,
|
|
35
|
+
startIcon: /* @__PURE__ */ l(E, {
|
|
36
|
+
width: t === "large" ? 24 : 20,
|
|
37
|
+
height: t === "large" ? 24 : 20
|
|
37
38
|
}),
|
|
38
39
|
onClick: u,
|
|
39
|
-
size:
|
|
40
|
-
dataTest:
|
|
41
|
-
"aria-label":
|
|
40
|
+
size: t,
|
|
41
|
+
dataTest: a,
|
|
42
|
+
"aria-label": f ? g : void 0,
|
|
42
43
|
"aria-haspopup": "true",
|
|
43
|
-
"aria-expanded": !!
|
|
44
|
-
"aria-controls":
|
|
45
|
-
children: !
|
|
46
|
-
}),
|
|
47
|
-
dataTest: `${
|
|
44
|
+
"aria-expanded": !!o,
|
|
45
|
+
"aria-controls": o ? y : void 0,
|
|
46
|
+
children: !f && g
|
|
47
|
+
}), x && /* @__PURE__ */ l(S, {
|
|
48
|
+
dataTest: `${a}-active-dot`,
|
|
48
49
|
variant: "dot",
|
|
49
50
|
purpose: "filter",
|
|
50
|
-
className:
|
|
51
|
+
className: N("absolute", t === "large" ? "right-2 top-2" : "right-1 top-1")
|
|
51
52
|
})]
|
|
52
|
-
}), /* @__PURE__ */
|
|
53
|
-
...
|
|
54
|
-
id:
|
|
55
|
-
open: !!
|
|
56
|
-
anchorEl:
|
|
53
|
+
}), /* @__PURE__ */ l(F, {
|
|
54
|
+
...e,
|
|
55
|
+
id: y,
|
|
56
|
+
open: !!o,
|
|
57
|
+
anchorEl: o,
|
|
57
58
|
onClose: m,
|
|
58
|
-
anchorOrigin:
|
|
59
|
+
anchorOrigin: e?.anchorOrigin ?? {
|
|
59
60
|
vertical: "bottom",
|
|
60
61
|
horizontal: "right"
|
|
61
62
|
},
|
|
62
|
-
transformOrigin:
|
|
63
|
+
transformOrigin: e?.transformOrigin ?? {
|
|
63
64
|
vertical: "top",
|
|
64
65
|
horizontal: "right"
|
|
65
66
|
},
|
|
66
|
-
className:
|
|
67
|
-
children:
|
|
68
|
-
isOpen: !!
|
|
67
|
+
className: e?.className ?? "my-1",
|
|
68
|
+
children: $(i) ? i : i({
|
|
69
|
+
isOpen: !!o,
|
|
69
70
|
onClose: m
|
|
70
71
|
})
|
|
71
72
|
})] });
|
|
72
73
|
};
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
K as StyledFilterMenu
|
|
75
76
|
};
|
|
@@ -5,11 +5,14 @@ import { StyledButtonProps } from '../../inputs/button';
|
|
|
5
5
|
* Figma's `Parent=Filter` dot at top-right when `filterIsActive`.
|
|
6
6
|
*
|
|
7
7
|
* Custom props:
|
|
8
|
-
* @param filterIsActive -
|
|
8
|
+
* @param filterIsActive - shows the dot in the top right corner indicating some changes were made
|
|
9
|
+
* @param activeCount - the number of filter controls that differ from the page default (the page computes it); shown as `Filter (N)`, dot when N > 0
|
|
9
10
|
* @param hideLabel - icon-only mode. When omitted, follows the surrounding DynamicToolbar layout (filterIconOnly).
|
|
10
11
|
*/
|
|
11
12
|
interface StyledFilterMenuProps {
|
|
12
|
-
|
|
13
|
+
/** Ignored when `activeCount` is given. */
|
|
14
|
+
filterIsActive?: boolean;
|
|
15
|
+
activeCount?: number;
|
|
13
16
|
label?: string;
|
|
14
17
|
hideLabel?: boolean;
|
|
15
18
|
}
|
|
@@ -8,13 +8,16 @@ import { StyledPopoverProps } from '../popover';
|
|
|
8
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
|
-
* @param filterIsActive -
|
|
11
|
+
* @param filterIsActive - shows the dot in the top right corner indicating some changes were made
|
|
12
|
+
* @param activeCount - the number of filter controls that differ from the page default (the page computes it); shown as `Filter (N)`, dot when N > 0
|
|
12
13
|
* @param popoverContent
|
|
13
14
|
* @param hideLabel - icon-only mode. When omitted, follows the surrounding DynamicToolbar layout (filterIconOnly).
|
|
14
15
|
*/
|
|
15
16
|
interface StyledFilterMenuProps {
|
|
16
17
|
dataTest: string;
|
|
17
|
-
|
|
18
|
+
/** Ignored when `activeCount` is given. */
|
|
19
|
+
filterIsActive?: boolean;
|
|
20
|
+
activeCount?: number;
|
|
18
21
|
popoverContent: ((props: {
|
|
19
22
|
isOpen: boolean;
|
|
20
23
|
onClose: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Filter trigger's text, which is also its accessible name when the label is hidden.
|
|
3
|
+
*
|
|
4
|
+
* `activeCount`: the number of filter controls that differ from the page default (the page computes it).
|
|
5
|
+
*
|
|
6
|
+
* @see asma-modules/_docs/ux/specs/spec-design-system-popover.md:100 — Filter trigger label
|
|
7
|
+
* @see asma-modules/_docs/ux/patterns/pattern-filter-default-state.md:70 — what counts as changed
|
|
8
|
+
*/
|
|
9
|
+
export declare const filterButtonText: (label: string | undefined, activeCount: number | undefined) => string;
|
|
10
|
+
/** `activeCount`, when given, alone decides the dot; `filterIsActive` serves callers without a count. */
|
|
11
|
+
export declare const isFilterDotShown: (filterIsActive: boolean | undefined, activeCount: number | undefined) => boolean;
|