@mx-cartographer/experiences 9.7.84 → 9.7.86

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [9.7.86] - 11-02-2026
2
+
3
+ - **FIXED** - dialogs fit on small mobile screens in single widgets (WELL-51)
4
+
5
+ ## [9.7.85] - 11-02-2026
6
+
7
+ - **FIXED** - account filter keeps the selection and shows a loading state while it saves (WELL-46)
8
+
1
9
  ## [9.7.84] - 11-03-2026
2
10
 
3
11
  - **FIXED** - An Insights 2.0 mini card's action link hands its tap to the host as the card tap (`HOST_ACTIONS.cardClick` through `beatActions.onCtaAction`), as micro's link does, so the host sends its post message and analytics (WEC-2196)
@@ -1,96 +1,105 @@
1
- import { buildDynamicCopy as O } from "../../core/utils/Localization.es.js";
2
- import { useAccountStore as T, useGlobalCopyStore as j, useGlobalUiStore as W, useHostMessage as H } from "../context/hooks.es.js";
3
- import { useAriaLive as A } from "../hooks/useAriaLive.es.js";
4
- import { buildSelectionFilter as I, getSelectionCounts as K } from "./globalaccountfilter/selection.es.js";
5
- import { GlobalAccountFilterList as P } from "./globalaccountfilter/GlobalAccountFilterList.es.js";
6
- import i from "react";
7
- import { observer as U } from "mobx-react-lite";
8
- import C from "@mui/material/Stack";
9
- import u from "@mui/material/Button";
10
- import { FilterAlt as S } from "@mxenabled/mx-icons";
11
- import { jsx as t, jsxs as p } from "react/jsx-runtime";
12
- import q from "@mui/material/Box";
13
- import J from "@mui/material/IconButton";
14
- import N from "@mui/material/Divider";
15
- import Q from "@mui/material/Popover";
16
- import V from "@mui/material/Tooltip";
17
- var dt = U(({ allowedAccountTypes: d, isDesktop: F, onAccountFilterClick: k, sx: _ = {}, variant: w = "text" }) => {
18
- const { common: a } = j(), { accountFilterMap: m, resetAccountFilterMap: B } = W(), { detailedAccounts: f, updateAccountFilter: E } = T(), { sendHostMessage: c } = H(), { announce: L, ariaLive: D } = A(), { announce: h, ariaLive: R } = A(), [b, s] = i.useState(null), o = i.useRef(null), l = i.useRef(0), n = a.account_filter, g = (r) => {
19
- l.current += 1, o.current = null, B(), s(r.currentTarget), k?.();
20
- }, v = () => {
21
- l.current += 1, s(null);
22
- }, x = async () => {
23
- const { selected: r, total: G } = K(I(m, f, d)), M = l.current;
24
- await E(m), M === l.current && (o.current = O(n.applied_announcement, String(r), String(G)), s(null));
25
- }, z = (r) => {
26
- r.key === "Enter" && r.target === r.currentTarget && x();
27
- }, e = !!b, y = f.length === 0;
28
- return i.useEffect(() => {
1
+ import { buildDynamicCopy as I } from "../../core/utils/Localization.es.js";
2
+ import { useAccountStore as W, useGlobalCopyStore as H, useGlobalUiStore as K, useHostMessage as P } from "../context/hooks.es.js";
3
+ import { useAriaLive as k } from "../hooks/useAriaLive.es.js";
4
+ import { buildSelectionFilter as U, getSelectionCounts as q } from "./globalaccountfilter/selection.es.js";
5
+ import { GlobalAccountFilterList as J } from "./globalaccountfilter/GlobalAccountFilterList.es.js";
6
+ import n from "react";
7
+ import { observer as N } from "mobx-react-lite";
8
+ import _ from "@mui/material/Stack";
9
+ import d from "@mui/material/Button";
10
+ import { FilterAlt as w } from "@mxenabled/mx-icons";
11
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
12
+ import Q from "@mui/material/Box";
13
+ import V from "@mui/material/IconButton";
14
+ import X from "@mui/material/Divider";
15
+ import Y from "@mui/material/Popover";
16
+ import Z from "@mui/material/Tooltip";
17
+ var gt = N(({ allowedAccountTypes: m, isDesktop: B, onAccountFilterClick: E, sx: L = {}, variant: D = "text" }) => {
18
+ const { common: i } = H(), c = K(), { accountFilterMap: g, resetAccountFilterMap: b, setIsApplyingAccountFilter: h } = c, s = c.isApplyingAccountFilter, { detailedAccounts: y, updateAccountFilter: R } = W(), { sendHostMessage: u } = P(), { announce: z, ariaLive: G } = k(), { announce: A, ariaLive: M } = k(), [v, p] = n.useState(null), l = n.useRef(null), a = n.useRef(0), o = i.account_filter, x = (r) => {
19
+ a.current += 1, b(), p(r.currentTarget), E?.();
20
+ }, F = () => {
21
+ a.current += 1, p(null);
22
+ }, S = async () => {
23
+ if (c.isApplyingAccountFilter) return;
24
+ const { selected: r, total: T } = q(U(g, y, m)), j = a.current;
25
+ h(!0);
26
+ try {
27
+ await R(g);
28
+ } finally {
29
+ h(!1);
30
+ }
31
+ b(), j === a.current && (l.current = I(o.applied_announcement, String(r), String(T)), p(null));
32
+ }, O = (r) => {
33
+ r.key === "Enter" && r.target === r.currentTarget && S();
34
+ }, e = !!v, C = y.length === 0;
35
+ return n.useEffect(() => {
29
36
  if (e)
30
- return c("focusTrap", { trapped: !0 }), () => c("focusTrap", { trapped: !1 });
31
- }, [e, c]), i.useEffect(() => {
32
- e || !o.current || (h(o.current), o.current = null);
33
- }, [e, h]), /* @__PURE__ */ p(q, {
34
- sx: { ..._ },
37
+ return u("focusTrap", { trapped: !0 }), () => u("focusTrap", { trapped: !1 });
38
+ }, [e, u]), n.useEffect(() => {
39
+ e || !l.current || (A(l.current), l.current = null);
40
+ }, [e, A]), /* @__PURE__ */ f(Q, {
41
+ sx: { ...L },
35
42
  children: [
36
- R,
37
- F ? /* @__PURE__ */ t(u, {
43
+ M,
44
+ B ? /* @__PURE__ */ t(d, {
38
45
  "aria-controls": e ? "filter_accounts" : void 0,
39
46
  "aria-expanded": e,
40
47
  "aria-haspopup": "dialog",
41
- "aria-label": n.title,
42
- disabled: y,
43
- onClick: g,
44
- startIcon: /* @__PURE__ */ t(S, { size: 24 }),
48
+ "aria-label": o.title,
49
+ disabled: C,
50
+ onClick: x,
51
+ startIcon: /* @__PURE__ */ t(w, { size: 24 }),
45
52
  sx: {
46
53
  p: 8,
47
54
  whiteSpace: "nowrap",
48
55
  minWidth: "max-content"
49
56
  },
50
- variant: w,
51
- children: a.filter_button
52
- }) : /* @__PURE__ */ t(V, {
57
+ variant: D,
58
+ children: i.filter_button
59
+ }) : /* @__PURE__ */ t(Z, {
53
60
  id: "filter-accounts",
54
61
  placement: "bottom",
55
- title: n.title,
56
- children: /* @__PURE__ */ t(J, {
62
+ title: o.title,
63
+ children: /* @__PURE__ */ t(V, {
57
64
  "aria-controls": e ? "filter_accounts" : void 0,
58
65
  "aria-expanded": e,
59
66
  "aria-haspopup": "dialog",
60
- "aria-label": n.title,
67
+ "aria-label": o.title,
61
68
  color: "primary",
62
- disabled: y,
63
- onClick: g,
69
+ disabled: C,
70
+ onClick: x,
64
71
  sx: { p: 8 },
65
- children: /* @__PURE__ */ t(S, { size: 24 })
72
+ children: /* @__PURE__ */ t(w, { size: 24 })
66
73
  })
67
74
  }),
68
- /* @__PURE__ */ t(Q, {
69
- anchorEl: b,
75
+ /* @__PURE__ */ t(Y, {
76
+ anchorEl: v,
70
77
  anchorOrigin: {
71
78
  vertical: "bottom",
72
79
  horizontal: "left"
73
80
  },
74
- onClose: v,
81
+ onClose: F,
75
82
  open: e,
76
83
  slotProps: { paper: {
77
- "aria-label": n.title,
84
+ "aria-busy": s,
85
+ "aria-label": o.title,
78
86
  "aria-modal": !0,
79
- onKeyDown: z,
87
+ onKeyDown: O,
80
88
  role: "dialog"
81
89
  } },
82
90
  transformOrigin: {
83
91
  vertical: "top",
84
92
  horizontal: "left"
85
93
  },
86
- children: /* @__PURE__ */ p(C, { children: [
87
- D,
88
- /* @__PURE__ */ t(P, {
89
- allowedAccountTypes: d,
90
- announce: L
94
+ children: /* @__PURE__ */ f(_, { children: [
95
+ G,
96
+ /* @__PURE__ */ t(J, {
97
+ allowedAccountTypes: m,
98
+ announce: z,
99
+ disabled: s
91
100
  }),
92
- /* @__PURE__ */ t(N, {}),
93
- /* @__PURE__ */ p(C, {
101
+ /* @__PURE__ */ t(X, {}),
102
+ /* @__PURE__ */ f(_, {
94
103
  direction: "row",
95
104
  justifyContent: "space-between",
96
105
  spacing: 16,
@@ -100,17 +109,18 @@ var dt = U(({ allowedAccountTypes: d, isDesktop: F, onAccountFilterClick: k, sx:
100
109
  p: 16,
101
110
  position: "sticky"
102
111
  },
103
- children: [/* @__PURE__ */ t(u, {
112
+ children: [/* @__PURE__ */ t(d, {
104
113
  fullWidth: !0,
105
- onClick: v,
114
+ onClick: F,
106
115
  variant: "text",
107
- children: a.cancel_button
108
- }), /* @__PURE__ */ t(u, {
116
+ children: i.cancel_button
117
+ }), /* @__PURE__ */ t(d, {
109
118
  color: "primary",
110
119
  fullWidth: !0,
111
- onClick: x,
120
+ loading: s,
121
+ onClick: S,
112
122
  variant: "contained",
113
- children: a.filter_button
123
+ children: i.filter_button
114
124
  })]
115
125
  })
116
126
  ] })
@@ -119,7 +129,7 @@ var dt = U(({ allowedAccountTypes: d, isDesktop: F, onAccountFilterClick: k, sx:
119
129
  });
120
130
  });
121
131
  export {
122
- dt as GlobalAccountFilter
132
+ gt as GlobalAccountFilter
123
133
  };
124
134
 
125
135
  //# sourceMappingURL=GlobalAccountFilter.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalAccountFilter.es.js","names":[],"sources":["../../../src/common/components/GlobalAccountFilter.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport IconButton from '@mui/material/IconButton'\nimport Popover from '@mui/material/Popover'\nimport Stack from '@mui/material/Stack'\nimport Tooltip from '@mui/material/Tooltip'\nimport { SxProps } from '@mui/material/styles'\n\nimport { FilterAlt } from '@mxenabled/mx-icons'\n\nimport { useAccountStore, useGlobalCopyStore, useGlobalUiStore, useHostMessage } from '../context'\nimport { AccountType } from '../../core'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\nimport { useAriaLive } from '../hooks/useAriaLive'\n\nimport { GlobalAccountFilterList } from './globalaccountfilter/GlobalAccountFilterList'\nimport { buildSelectionFilter, getSelectionCounts } from './globalaccountfilter/selection'\n\nexport interface GlobalAccountFilterProps {\n allowedAccountTypes?: AccountType[] | undefined\n isDesktop?: boolean\n onAccountFilterClick?: () => void\n sx?: SxProps\n variant?: 'outlined' | 'text'\n}\n\nexport const GlobalAccountFilter = observer(\n ({\n allowedAccountTypes,\n isDesktop,\n onAccountFilterClick,\n sx = {},\n variant = 'text',\n }: GlobalAccountFilterProps) => {\n const { common: commonCopy } = useGlobalCopyStore()\n const { accountFilterMap, resetAccountFilterMap } = useGlobalUiStore()\n\n const { detailedAccounts, updateAccountFilter } = useAccountStore()\n const { sendHostMessage } = useHostMessage()\n\n // Two regions, because MUI's ModalManager sets aria-hidden on every body\n // child outside the popover while it is open (and aria-modal tells AT to\n // ignore them anyway). Selection changes happen while the dialog is open, so\n // that region must live INSIDE it; the applied message is spoken after the\n // dialog is gone, so its region must live outside to survive the unmount.\n const { announce: announceSelection, ariaLive: selectionAriaLive } = useAriaLive()\n const { announce: announceApplied, ariaLive: appliedAriaLive } = useAriaLive()\n\n const [filterButtonEl, setFilterButtonEl] = React.useState<HTMLButtonElement | null>(null)\n // Set once the update resolves, consumed by the close effect below. It cannot\n // be announced from handleFilter directly: aria-hidden is still on the rest of\n // the document at that point, so the message would go into a hidden region.\n const pendingAppliedRef = React.useRef<string | null>(null)\n // Identifies one open..close cycle of the dialog. `handleFilter` captures it\n // before awaiting and bails if it changed, so a slow request cannot reach\n // back into a session the user has already left.\n const generationRef = React.useRef(0)\n\n const copy = commonCopy.account_filter\n\n const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {\n generationRef.current += 1\n // Not subsumed by the generation guard. handleOpen and handleCancel both\n // bump the generation, so a single interrupted apply bails before it writes.\n // What still reaches this line is a SECOND apply started while the first was\n // in flight -- applying does not bump, so both continuations pass the guard.\n // The first closes the dialog and the effect consumes its message; the second\n // then writes onto an already-null anchor, so setFilterButtonEl(null) is a\n // no-op, React bails out of the render, and the effect never runs to consume\n // it. Clearing on the way back in stops that leftover surfacing later.\n //\n // Pinned by 'discards a leftover message from a second apply on the next\n // open' -- delete this line and that test fails. An in-flight guard on apply\n // (MEW-4138) would remove the reachable case and retire both.\n pendingAppliedRef.current = null\n resetAccountFilterMap()\n setFilterButtonEl(event.currentTarget)\n onAccountFilterClick?.()\n }\n\n const handleCancel = () => {\n // Ends the session too, so a request abandoned here cannot write its message\n // even if it resolves before the user reopens.\n generationRef.current += 1\n setFilterButtonEl(null)\n }\n\n const handleFilter = async () => {\n const { selected, total } = getSelectionCounts(\n buildSelectionFilter(accountFilterMap, detailedAccounts, allowedAccountTypes),\n )\n\n const generation = generationRef.current\n\n await updateAccountFilter(accountFilterMap)\n\n // The dialog moved on while this was in flight -- the user cancelled, or\n // cancelled and reopened. Announcing now would speak over a session that did\n // not ask for it, and closing would shut a dialog the user just opened.\n // NOTE: the update itself already committed; cancelling does not roll it\n // back. Only the announcement and the close are suppressed here.\n if (generation !== generationRef.current) return\n\n pendingAppliedRef.current = buildDynamicCopy(\n copy.applied_announcement,\n String(selected),\n String(total),\n ) as string\n setFilterButtonEl(null)\n }\n\n // Bound to the Paper, not an inner element: FocusTrap focuses the Paper on\n // open (getFocusTarget finds no `data-mui-focusable` marker and falls back to\n // the root), and keydown there bubbles UP -- a handler on a descendant would\n // never see the first keypress.\n //\n // Only fires when the Paper ITSELF holds focus. Anything focused inside it\n // owns its own Enter behaviour: buttons activate, and a checkbox must not\n // submit -- native checkboxes ignore Enter, so without this the keypress\n // bubbled up here and closed the dialog out from under someone who was just\n // moving through the list. A whitelist rather than a `closest()` exclusion\n // list, so a control added later cannot silently inherit submit-on-Enter.\n //\n // Narrower than it looks: the Paper is tabIndex=\"-1\", so once focus moves off\n // it there is no way to Tab back. Enter-applies is a one-shot affordance,\n // available only before the first Tab. The scroll region (tabIndex={0}) is the\n // first stop after it and deliberately does nothing on Enter.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter') return\n if (event.target !== event.currentTarget) return\n\n handleFilter()\n }\n\n const isFilterOpen = Boolean(filterButtonEl)\n const filterDisabled = detailedAccounts.length === 0\n\n React.useEffect(() => {\n if (!isFilterOpen) return\n\n sendHostMessage('focusTrap', { trapped: true })\n return () => sendHostMessage('focusTrap', { trapped: false })\n }, [isFilterOpen, sendHostMessage])\n\n // Announce only once the popover is closed. `handleFilter` cannot announce\n // directly: at that point ModalManager still has aria-hidden on the rest of\n // the document, so the message would be written into a hidden region.\n //\n // Modal lifts aria-hidden in an effect when `open` flips false\n // (`closeAfterTransition` defaults false, so `useModal`'s open/close effect\n // calls handleClose immediately rather than waiting for the exit). Modal is a\n // descendant of this component and React flushes child effects first (and every\n // destroy before any create, so FocusTrap's restore lands first too), meaning\n // by the time this effect runs focus is back on the trigger and the document is\n // exposed again.\n //\n // Only ever consumes a message from the session that is closing. An apply\n // interrupted by a cancel or a reopen is stopped at the generation guard in\n // handleFilter and never writes one, in either order.\n React.useEffect(() => {\n if (isFilterOpen || !pendingAppliedRef.current) return\n\n announceApplied(pendingAppliedRef.current)\n pendingAppliedRef.current = null\n }, [isFilterOpen, announceApplied])\n\n return (\n <Box sx={{ ...sx }}>\n {appliedAriaLive}\n {isDesktop ? (\n <Button\n aria-controls={isFilterOpen ? 'filter_accounts' : undefined}\n aria-expanded={isFilterOpen}\n aria-haspopup=\"dialog\"\n aria-label={copy.title}\n disabled={filterDisabled}\n onClick={handleOpen}\n startIcon={<FilterAlt size={24} />}\n sx={{ p: 8, whiteSpace: 'nowrap', minWidth: 'max-content' }}\n variant={variant}\n >\n {commonCopy.filter_button}\n </Button>\n ) : (\n <Tooltip id=\"filter-accounts\" placement=\"bottom\" title={copy.title}>\n <IconButton\n aria-controls={isFilterOpen ? 'filter_accounts' : undefined}\n aria-expanded={isFilterOpen}\n aria-haspopup=\"dialog\"\n aria-label={copy.title}\n color=\"primary\"\n disabled={filterDisabled}\n onClick={handleOpen}\n sx={{ p: 8 }}\n >\n <FilterAlt size={24} />\n </IconButton>\n </Tooltip>\n )}\n\n <Popover\n anchorEl={filterButtonEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n onClose={handleCancel}\n open={isFilterOpen}\n // aria-modal is what Chrome surfaces to the Android accessibility API as a\n // modal subtree. Without it TalkBack walks past the last control and out of\n // the webview into the host app's native chrome -- aria-hidden (applied to\n // background siblings by MUI's Modal) only bounds the DOM, not the webview.\n slotProps={{\n paper: {\n 'aria-label': copy.title,\n 'aria-modal': true,\n onKeyDown: handleKeyDown,\n role: 'dialog',\n },\n }}\n transformOrigin={{ vertical: 'top', horizontal: 'left' }}\n >\n <Stack>\n {selectionAriaLive}\n <GlobalAccountFilterList\n allowedAccountTypes={allowedAccountTypes}\n announce={announceSelection}\n />\n <Divider />\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n spacing={16}\n sx={{ bgcolor: 'background.paper', bottom: 0, p: 16, position: 'sticky' }}\n >\n <Button fullWidth={true} onClick={handleCancel} variant=\"text\">\n {commonCopy.cancel_button}\n </Button>\n <Button color=\"primary\" fullWidth={true} onClick={handleFilter} variant=\"contained\">\n {commonCopy.filter_button}\n </Button>\n </Stack>\n </Stack>\n </Popover>\n </Box>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAa,KAAsB,EAAA,CAChC,EACC,qBAAA,GACA,WAAA,GACA,sBAAA,GACA,IAAA,IAAK,CAAC,GACN,SAAA,IAAU,OAAA,MACoB;AAC9B,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,kBAAA,GAAkB,uBAAA,EAAA,IAA0B,EAAiB,GAE/D,EAAE,kBAAA,GAAkB,qBAAA,EAAA,IAAwB,EAAgB,GAC5D,EAAE,iBAAA,EAAA,IAAoB,EAAe,GAOrC,EAAE,UAAU,GAAmB,UAAU,EAAA,IAAsB,EAAY,GAC3E,EAAE,UAAU,GAAiB,UAAU,EAAA,IAAoB,EAAY,GAEvE,CAAC,GAAgB,CAAA,IAAqB,EAAM,SAAmC,IAAI,GAInF,IAAoB,EAAM,OAAsB,IAAI,GAIpD,IAAgB,EAAM,OAAO,CAAC,GAE9B,IAAO,EAAW,gBAElB,IAAA,CAAc,MAA+C;AACjE,IAA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A,cAAG,GAAG;AAAA,cAAI,UAAU;AAAA,YAAS;AAAA,YAJ1E,UAAA,CAME,gBAAA,EAAC,GAAD;AAAA,cAAQ,WAAW;AAAA,cAAM,SAAS;AAAA,cAAc,SAAQ;AAAA,cACrD,UAAA,EAAW;AAAA,YACN,CAAA,GACR,gBAAA,EAAC,GAAD;AAAA,cAAQ,OAAM;AAAA,cAAU,WAAW;AAAA,cAAM,SAAS;AAAA,cAAc,SAAQ;AAAA,cACrE,UAAA,EAAW;AAAA,YACN,CAAA,CACH;AAAA;QACF,EAAA,CAAA;AAAA,MACA,CAAA;AAAA,IACN;AAAA;AAET,CACF"}
1
+ {"version":3,"file":"GlobalAccountFilter.es.js","names":[],"sources":["../../../src/common/components/GlobalAccountFilter.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport IconButton from '@mui/material/IconButton'\nimport Popover from '@mui/material/Popover'\nimport Stack from '@mui/material/Stack'\nimport Tooltip from '@mui/material/Tooltip'\nimport { SxProps } from '@mui/material/styles'\n\nimport { FilterAlt } from '@mxenabled/mx-icons'\n\nimport { useAccountStore, useGlobalCopyStore, useGlobalUiStore, useHostMessage } from '../context'\nimport { AccountType } from '../../core'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\nimport { useAriaLive } from '../hooks/useAriaLive'\n\nimport { GlobalAccountFilterList } from './globalaccountfilter/GlobalAccountFilterList'\nimport { buildSelectionFilter, getSelectionCounts } from './globalaccountfilter/selection'\n\nexport interface GlobalAccountFilterProps {\n allowedAccountTypes?: AccountType[] | undefined\n isDesktop?: boolean\n onAccountFilterClick?: () => void\n sx?: SxProps\n variant?: 'outlined' | 'text'\n}\n\nexport const GlobalAccountFilter = observer(\n ({\n allowedAccountTypes,\n isDesktop,\n onAccountFilterClick,\n sx = {},\n variant = 'text',\n }: GlobalAccountFilterProps) => {\n const { common: commonCopy } = useGlobalCopyStore()\n const globalUiStore = useGlobalUiStore()\n const { accountFilterMap, resetAccountFilterMap, setIsApplyingAccountFilter } = globalUiStore\n const isApplying = globalUiStore.isApplyingAccountFilter\n\n const { detailedAccounts, updateAccountFilter } = useAccountStore()\n const { sendHostMessage } = useHostMessage()\n\n // Two regions, because MUI's ModalManager sets aria-hidden on every body\n // child outside the popover while it is open (and aria-modal tells AT to\n // ignore them anyway). Selection changes happen while the dialog is open, so\n // that region must live INSIDE it; the applied message is spoken after the\n // dialog is gone, so its region must live outside to survive the unmount.\n const { announce: announceSelection, ariaLive: selectionAriaLive } = useAriaLive()\n const { announce: announceApplied, ariaLive: appliedAriaLive } = useAriaLive()\n\n const [filterButtonEl, setFilterButtonEl] = React.useState<HTMLButtonElement | null>(null)\n // Set once the update resolves, consumed by the close effect below. It cannot\n // be announced from handleFilter directly: aria-hidden is still on the rest of\n // the document at that point, so the message would go into a hidden region.\n const pendingAppliedRef = React.useRef<string | null>(null)\n // Identifies one open..close cycle of the dialog. `handleFilter` captures it\n // before awaiting and bails if it changed, so a slow request cannot reach\n // back into a session the user has already left.\n const generationRef = React.useRef(0)\n\n const copy = commonCopy.account_filter\n\n const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {\n generationRef.current += 1\n resetAccountFilterMap()\n setFilterButtonEl(event.currentTarget)\n onAccountFilterClick?.()\n }\n\n const handleCancel = () => {\n // Ends the session too, so a request abandoned here cannot write its message\n // even if it resolves before the user reopens.\n generationRef.current += 1\n setFilterButtonEl(null)\n }\n\n const handleFilter = async () => {\n // A second apply while the first is saving would send requests computed from\n // accounts that are about to change, so the earlier save could win. Read from\n // the store, not the render, so it holds even before React re-renders.\n if (globalUiStore.isApplyingAccountFilter) return\n\n const { selected, total } = getSelectionCounts(\n buildSelectionFilter(accountFilterMap, detailedAccounts, allowedAccountTypes),\n )\n\n const generation = generationRef.current\n\n setIsApplyingAccountFilter(true)\n try {\n await updateAccountFilter(accountFilterMap)\n } finally {\n setIsApplyingAccountFilter(false)\n }\n\n // A filter opened during the save, here or in another widget, was filled\n // before the save landed and would show the old selection. Its controls were\n // disabled, so no edit is lost.\n resetAccountFilterMap()\n\n // The dialog moved on while this was in flight -- the user cancelled, or\n // cancelled and reopened. Announcing now would speak over a session that did\n // not ask for it, and closing would shut a dialog the user just opened.\n // NOTE: the update itself already committed; cancelling does not roll it\n // back. Only the announcement and the close are suppressed here.\n if (generation !== generationRef.current) return\n\n pendingAppliedRef.current = buildDynamicCopy(\n copy.applied_announcement,\n String(selected),\n String(total),\n ) as string\n setFilterButtonEl(null)\n }\n\n // Bound to the Paper, not an inner element: FocusTrap focuses the Paper on\n // open (getFocusTarget finds no `data-mui-focusable` marker and falls back to\n // the root), and keydown there bubbles UP -- a handler on a descendant would\n // never see the first keypress.\n //\n // Only fires when the Paper ITSELF holds focus. Anything focused inside it\n // owns its own Enter behaviour: buttons activate, and a checkbox must not\n // submit -- native checkboxes ignore Enter, so without this the keypress\n // bubbled up here and closed the dialog out from under someone who was just\n // moving through the list. A whitelist rather than a `closest()` exclusion\n // list, so a control added later cannot silently inherit submit-on-Enter.\n //\n // Narrower than it looks: the Paper is tabIndex=\"-1\", so once focus moves off\n // it there is no way to Tab back. Enter-applies is a one-shot affordance,\n // available only before the first Tab. The scroll region (tabIndex={0}) is the\n // first stop after it and deliberately does nothing on Enter.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter') return\n if (event.target !== event.currentTarget) return\n\n handleFilter()\n }\n\n const isFilterOpen = Boolean(filterButtonEl)\n const filterDisabled = detailedAccounts.length === 0\n\n React.useEffect(() => {\n if (!isFilterOpen) return\n\n sendHostMessage('focusTrap', { trapped: true })\n return () => sendHostMessage('focusTrap', { trapped: false })\n }, [isFilterOpen, sendHostMessage])\n\n // Announce only once the popover is closed. `handleFilter` cannot announce\n // directly: at that point ModalManager still has aria-hidden on the rest of\n // the document, so the message would be written into a hidden region.\n //\n // Modal lifts aria-hidden in an effect when `open` flips false\n // (`closeAfterTransition` defaults false, so `useModal`'s open/close effect\n // calls handleClose immediately rather than waiting for the exit). Modal is a\n // descendant of this component and React flushes child effects first (and every\n // destroy before any create, so FocusTrap's restore lands first too), meaning\n // by the time this effect runs focus is back on the trigger and the document is\n // exposed again.\n //\n // Only ever consumes a message from the session that is closing. An apply\n // interrupted by a cancel or a reopen is stopped at the generation guard in\n // handleFilter and never writes one, in either order.\n React.useEffect(() => {\n if (isFilterOpen || !pendingAppliedRef.current) return\n\n announceApplied(pendingAppliedRef.current)\n pendingAppliedRef.current = null\n }, [isFilterOpen, announceApplied])\n\n return (\n <Box sx={{ ...sx }}>\n {appliedAriaLive}\n {isDesktop ? (\n <Button\n aria-controls={isFilterOpen ? 'filter_accounts' : undefined}\n aria-expanded={isFilterOpen}\n aria-haspopup=\"dialog\"\n aria-label={copy.title}\n disabled={filterDisabled}\n onClick={handleOpen}\n startIcon={<FilterAlt size={24} />}\n sx={{ p: 8, whiteSpace: 'nowrap', minWidth: 'max-content' }}\n variant={variant}\n >\n {commonCopy.filter_button}\n </Button>\n ) : (\n <Tooltip id=\"filter-accounts\" placement=\"bottom\" title={copy.title}>\n <IconButton\n aria-controls={isFilterOpen ? 'filter_accounts' : undefined}\n aria-expanded={isFilterOpen}\n aria-haspopup=\"dialog\"\n aria-label={copy.title}\n color=\"primary\"\n disabled={filterDisabled}\n onClick={handleOpen}\n sx={{ p: 8 }}\n >\n <FilterAlt size={24} />\n </IconButton>\n </Tooltip>\n )}\n\n <Popover\n anchorEl={filterButtonEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n onClose={handleCancel}\n open={isFilterOpen}\n // aria-modal is what Chrome surfaces to the Android accessibility API as a\n // modal subtree. Without it TalkBack walks past the last control and out of\n // the webview into the host app's native chrome -- aria-hidden (applied to\n // background siblings by MUI's Modal) only bounds the DOM, not the webview.\n slotProps={{\n paper: {\n 'aria-busy': isApplying,\n 'aria-label': copy.title,\n 'aria-modal': true,\n onKeyDown: handleKeyDown,\n role: 'dialog',\n },\n }}\n transformOrigin={{ vertical: 'top', horizontal: 'left' }}\n >\n <Stack>\n {selectionAriaLive}\n <GlobalAccountFilterList\n allowedAccountTypes={allowedAccountTypes}\n announce={announceSelection}\n disabled={isApplying}\n />\n <Divider />\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n spacing={16}\n sx={{ bgcolor: 'background.paper', bottom: 0, p: 16, position: 'sticky' }}\n >\n <Button fullWidth={true} onClick={handleCancel} variant=\"text\">\n {commonCopy.cancel_button}\n </Button>\n <Button\n color=\"primary\"\n fullWidth={true}\n loading={isApplying}\n onClick={handleFilter}\n variant=\"contained\"\n >\n {commonCopy.filter_button}\n </Button>\n </Stack>\n </Stack>\n </Popover>\n </Box>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAa,KAAsB,EAAA,CAChC,EACC,qBAAA,GACA,WAAA,GACA,sBAAA,GACA,IAAA,IAAK,CAAC,GACN,SAAA,IAAU,OAAA,MACoB;AAC9B,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,IAAgB,EAAiB,GACjC,EAAE,kBAAA,GAAkB,uBAAA,GAAuB,4BAAA,EAAA,IAA+B,GAC1E,IAAa,EAAc,yBAE3B,EAAE,kBAAA,GAAkB,qBAAA,EAAA,IAAwB,EAAgB,GAC5D,EAAE,iBAAA,EAAA,IAAoB,EAAe,GAOrC,EAAE,UAAU,GAAmB,UAAU,EAAA,IAAsB,EAAY,GAC3E,EAAE,UAAU,GAAiB,UAAU,EAAA,IAAoB,EAAY,GAEvE,CAAC,GAAgB,CAAA,IAAqB,EAAM,SAAmC,IAAI,GAInF,IAAoB,EAAM,OAAsB,IAAI,GAIpD,IAAgB,EAAM,OAAO,CAAC,GAE9B,IAAO,EAAW,gBAElB,IAAA,CAAc,MAA+C;AACjE,IAAA,EAAc,WAAW,GACzB,EAAsB,GACtB,EAAkB,EAAM,aAAa,GACrC,IAAuB;AAAA,EACzB,GAEM,IAAA,MAAqB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ACT,IAAI;AAAA,cAAE,SAAS;AAAA,cAAoB,QAAQ;AAAA,cAAG,GAAG;AAAA,cAAI,UAAU;AAAA,YAAS;AAAA,YAJ1E,UAAA,CAME,gBAAA,EAAC,GAAD;AAAA,cAAQ,WAAW;AAAA,cAAM,SAAS;AAAA,cAAc,SAAQ;AAAA,cACrD,UAAA,EAAW;AAAA,YACN,CAAA,GACR,gBAAA,EAAC,GAAD;AAAA,cACE,OAAM;AAAA,cACN,WAAW;AAAA,cACX,SAAS;AAAA,cACT,SAAS;AAAA,cACT,SAAQ;AAAA,cAEP,UAAA,EAAW;AAAA,YACN,CAAA,CACH;AAAA;QACF,EAAA,CAAA;AAAA,MACA,CAAA;AAAA,IACN;AAAA;AAET,CACF"}
@@ -2,49 +2,50 @@ import { useScreenSize as H } from "../../hooks/useScreenSize.es.js";
2
2
  import { useFocusReturn as W } from "../../hooks/useFocusReturn.es.js";
3
3
  import j from "react";
4
4
  import { DialogFooter as k, DialogHeader as v } from "@mxenabled/mxui";
5
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
6
- import I from "@mui/material/Dialog";
7
- import _ from "@mui/material/DialogContent";
8
- var G = ({ className: l, copy: i, disablePrimaryButton: n = !1, showActions: c = !0, isOpen: e = !1, onClose: r, onPrimaryAction: m, primaryColor: d = "primary", primaryText: u = "Confirm", returnFocusTo: p, onSecondaryAction: t, secondaryColor: f = "primary", secondaryText: g = "Cancel", children: x, ...h }) => {
9
- const { sx: a, ...D } = h, b = i?.title ?? "", y = i?.close_aria ?? "Close", s = j.useId(), { isSmallMobile: P } = H(), { onExited: S, onFocus: A, rootRef: F } = W(e, p), M = () => {
5
+ import { jsx as o, jsxs as z } from "react/jsx-runtime";
6
+ import C from "@mui/material/Dialog";
7
+ import I from "@mui/material/DialogContent";
8
+ var G = ({ className: l, copy: i, disablePrimaryButton: n = !1, showActions: c = !0, isOpen: e = !1, onClose: r, onPrimaryAction: m, primaryColor: d = "primary", primaryText: u = "Confirm", returnFocusTo: p, onSecondaryAction: t, secondaryColor: f = "primary", secondaryText: x = "Cancel", children: g, ...b }) => {
9
+ const { sx: a, ...h } = b, D = i?.title ?? "", y = i?.close_aria ?? "Close", s = j.useId(), { isSmallMobile: S } = H(), { onExited: P, onFocus: A, rootRef: F } = W(e, p), M = () => {
10
10
  m?.(), r();
11
11
  }, R = () => {
12
12
  t && t(), r();
13
13
  };
14
14
  return /* @__PURE__ */ o("div", {
15
15
  className: `mx-cmn-dialog ${l}`,
16
- children: /* @__PURE__ */ C(I, {
16
+ children: /* @__PURE__ */ z(C, {
17
17
  "aria-labelledby": s,
18
18
  maxWidth: "xs",
19
19
  onClose: r,
20
20
  open: e,
21
21
  sx: [{
22
22
  "& .MuiDialog-paperScrollPaper": { backgroundColor: "background.default" },
23
- ...P && { "& .MuiDialog-paper": { minWidth: "100%" } },
23
+ ...S && { "& .MuiDialog-paper": { minWidth: "100%" } },
24
24
  height: "100%"
25
25
  }, ...a ? [a] : []],
26
- ...D,
26
+ ...h,
27
27
  disableRestoreFocus: !0,
28
28
  onFocus: A,
29
29
  ref: F,
30
- slotProps: { transition: { onExited: S } },
30
+ slotProps: { transition: { onExited: P } },
31
31
  children: [
32
32
  /* @__PURE__ */ o(v, {
33
33
  ariaHidden: !0,
34
34
  copy: {
35
- title: b,
35
+ title: D,
36
36
  close_aria: y
37
37
  },
38
38
  id: s,
39
39
  onClose: r,
40
40
  truncate: !0
41
41
  }),
42
- /* @__PURE__ */ o(_, {
42
+ /* @__PURE__ */ o(I, {
43
43
  sx: {
44
+ boxSizing: "border-box",
44
45
  lineHeight: 1.5,
45
46
  maxWidth: "100%"
46
47
  },
47
- children: x
48
+ children: g
48
49
  }),
49
50
  c && /* @__PURE__ */ o(k, {
50
51
  isPrimaryDisabled: n,
@@ -53,7 +54,7 @@ var G = ({ className: l, copy: i, disablePrimaryButton: n = !1, showActions: c =
53
54
  primaryColor: d,
54
55
  primaryText: u,
55
56
  secondaryColor: f,
56
- secondaryText: g
57
+ secondaryText: x
57
58
  })
58
59
  ]
59
60
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.es.js","names":[],"sources":["../../../../src/common/components/dialog/Dialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport { DialogProps as MuiDialogProps } from '@mui/material/Dialog'\nimport DialogContent from '@mui/material/DialogContent'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { DialogFooter, DialogHeader } from '@mxenabled/mxui'\nimport { useScreenSize } from '../../hooks'\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nexport type CopyObject = {\n close_aria?: string\n title: string\n}\n\ntype OwnedMuiProps =\n | 'disableRestoreFocus'\n | 'onFocus'\n | 'open'\n | 'slotProps'\n | 'slots'\n | 'TransitionComponent'\n | 'TransitionProps'\n\nexport interface DialogProps extends Omit<MuiDialogProps, OwnedMuiProps> {\n className?: string\n copy: CopyObject\n disablePrimaryButton?: boolean\n /** Render the footer action buttons. Default true; content-only dialogs (e.g. the insights survey modal) pass false. */\n showActions?: boolean\n isOpen: boolean\n onClose: (event?: unknown, reason?: string) => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n /** Where focus goes on close. Takes precedence over the element that opened the dialog. */\n returnFocusTo?: React.RefObject<HTMLElement | null>\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n}\n\nconst Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({\n className,\n copy,\n disablePrimaryButton = false,\n showActions = true,\n isOpen = false,\n onClose,\n onPrimaryAction,\n primaryColor = 'primary',\n primaryText = 'Confirm',\n returnFocusTo,\n onSecondaryAction,\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n children,\n ...rest\n}) => {\n // Extract sx from rest to merge with Dialog's own styles instead of overwriting\n const { sx: restSx, ...restProps } = rest\n const title = copy?.title ?? ''\n const closeAria = copy?.close_aria ?? 'Close'\n\n // Label the dialog *by* its visible heading (WAI-ARIA APG) instead of a duplicate\n // aria-label, so screen readers announce the title once rather than name + heading.\n const titleId = React.useId()\n\n const { isSmallMobile } = useScreenSize()\n\n const { onExited, onFocus, rootRef } = useFocusReturn(isOpen, returnFocusTo)\n\n const handlePrimaryAction = () => {\n onPrimaryAction?.()\n onClose()\n }\n\n const handleSecondaryAction = () => {\n if (onSecondaryAction) {\n onSecondaryAction()\n }\n onClose()\n }\n\n return (\n <div className={`mx-cmn-dialog ${className}`}>\n <MuiDialog\n aria-labelledby={titleId}\n maxWidth=\"xs\"\n onClose={onClose}\n open={isOpen}\n sx={\n [\n {\n '& .MuiDialog-paperScrollPaper': { backgroundColor: 'background.default' },\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n height: '100%',\n },\n ...(restSx ? [restSx] : []),\n ] as SxProps\n }\n {...restProps}\n disableRestoreFocus={true}\n onFocus={onFocus}\n ref={rootRef}\n slotProps={{ transition: { onExited } }}\n >\n <DialogHeader\n ariaHidden={true}\n copy={{ title, close_aria: closeAria }}\n id={titleId}\n onClose={onClose}\n truncate={true}\n />\n\n <DialogContent sx={{ lineHeight: 1.5, maxWidth: '100%' }}>{children}</DialogContent>\n\n {showActions && (\n <DialogFooter\n isPrimaryDisabled={disablePrimaryButton}\n onPrimaryAction={handlePrimaryAction}\n onSecondaryAction={handleSecondaryAction}\n primaryColor={primaryColor}\n primaryText={primaryText}\n secondaryColor={secondaryColor}\n secondaryText={secondaryText}\n />\n )}\n </MuiDialog>\n </div>\n )\n}\n\nexport default Dialog\n"],"mappings":";;;;;;;AA2CA,IAAM,IAAA,CAA0D,EAC9D,WAAA,GACA,MAAA,GACA,sBAAA,IAAuB,IACvB,aAAA,IAAc,IACd,QAAA,IAAS,IACT,SAAA,GACA,iBAAA,GACA,cAAA,IAAe,WACf,aAAA,IAAc,WACd,eAAA,GACA,mBAAA,GACA,gBAAA,I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AAAA,UAAI,UAAA;AAAA,QAAwB,CAAA;AAAA,QAElF,KACC,gBAAA,EAAC,GAAD;AAAA,UACE,mBAAmB;AAAA,UACnB,iBAAiB;AAAA,UACjB,mBAAmB;AAAA,UACL,cAAA;AAAA,UACD,aAAA;AAAA,UACG,gBAAA;AAAA,UACD,eAAA;AAAA,QAChB,CAAA;AAAA,MAEM;AAAA;EACR,CAAA;AAET"}
1
+ {"version":3,"file":"Dialog.es.js","names":[],"sources":["../../../../src/common/components/dialog/Dialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport { DialogProps as MuiDialogProps } from '@mui/material/Dialog'\nimport DialogContent from '@mui/material/DialogContent'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { DialogFooter, DialogHeader } from '@mxenabled/mxui'\nimport { useScreenSize } from '../../hooks'\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nexport type CopyObject = {\n close_aria?: string\n title: string\n}\n\ntype OwnedMuiProps =\n | 'disableRestoreFocus'\n | 'onFocus'\n | 'open'\n | 'slotProps'\n | 'slots'\n | 'TransitionComponent'\n | 'TransitionProps'\n\nexport interface DialogProps extends Omit<MuiDialogProps, OwnedMuiProps> {\n className?: string\n copy: CopyObject\n disablePrimaryButton?: boolean\n /** Render the footer action buttons. Default true; content-only dialogs (e.g. the insights survey modal) pass false. */\n showActions?: boolean\n isOpen: boolean\n onClose: (event?: unknown, reason?: string) => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n /** Where focus goes on close. Takes precedence over the element that opened the dialog. */\n returnFocusTo?: React.RefObject<HTMLElement | null>\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n}\n\nconst Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({\n className,\n copy,\n disablePrimaryButton = false,\n showActions = true,\n isOpen = false,\n onClose,\n onPrimaryAction,\n primaryColor = 'primary',\n primaryText = 'Confirm',\n returnFocusTo,\n onSecondaryAction,\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n children,\n ...rest\n}) => {\n // Extract sx from rest to merge with Dialog's own styles instead of overwriting\n const { sx: restSx, ...restProps } = rest\n const title = copy?.title ?? ''\n const closeAria = copy?.close_aria ?? 'Close'\n\n // Label the dialog *by* its visible heading (WAI-ARIA APG) instead of a duplicate\n // aria-label, so screen readers announce the title once rather than name + heading.\n const titleId = React.useId()\n\n const { isSmallMobile } = useScreenSize()\n\n const { onExited, onFocus, rootRef } = useFocusReturn(isOpen, returnFocusTo)\n\n const handlePrimaryAction = () => {\n onPrimaryAction?.()\n onClose()\n }\n\n const handleSecondaryAction = () => {\n if (onSecondaryAction) {\n onSecondaryAction()\n }\n onClose()\n }\n\n return (\n <div className={`mx-cmn-dialog ${className}`}>\n <MuiDialog\n aria-labelledby={titleId}\n maxWidth=\"xs\"\n onClose={onClose}\n open={isOpen}\n sx={\n [\n {\n '& .MuiDialog-paperScrollPaper': { backgroundColor: 'background.default' },\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n height: '100%',\n },\n ...(restSx ? [restSx] : []),\n ] as SxProps\n }\n {...restProps}\n disableRestoreFocus={true}\n onFocus={onFocus}\n ref={rootRef}\n slotProps={{ transition: { onExited } }}\n >\n <DialogHeader\n ariaHidden={true}\n copy={{ title, close_aria: closeAria }}\n id={titleId}\n onClose={onClose}\n truncate={true}\n />\n\n <DialogContent sx={{ boxSizing: 'border-box', lineHeight: 1.5, maxWidth: '100%' }}>\n {children}\n </DialogContent>\n\n {showActions && (\n <DialogFooter\n isPrimaryDisabled={disablePrimaryButton}\n onPrimaryAction={handlePrimaryAction}\n onSecondaryAction={handleSecondaryAction}\n primaryColor={primaryColor}\n primaryText={primaryText}\n secondaryColor={secondaryColor}\n secondaryText={secondaryText}\n />\n )}\n </MuiDialog>\n </div>\n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AY;AAAA,UACZ,MAAM;AAAA,YAAE,OAAA;AAAA,YAAO,YAAY;AAAA,UAAU;AAAA,UACrC,IAAI;AAAA,UACK,SAAA;AAAA,UACT,UAAU;AAAA,QACX,CAAA;AAAA,QAED,gBAAA,EAAC,GAAD;AAAA,UAAe,IAAI;AAAA,YAAE,WAAW;AAAA,YAAc,YAAY;AAAA,YAAK,UAAU;AAAA,UAAO;AAAA,UAC7E,UAAA;AAAA,QACY,CAAA;AAAA,QAEd,KACC,gBAAA,EAAC,GAAD;AAAA,UACE,mBAAmB;AAAA,UACnB,iBAAiB;AAAA,UACjB,mBAAmB;AAAA,UACL,cAAA;AAAA,UACD,aAAA;AAAA,UACG,gBAAA;AAAA,UACD,eAAA;AAAA,QAChB,CAAA;AAAA,MAEM;AAAA;EACR,CAAA;AAET"}
@@ -2,7 +2,8 @@ import { AccountType } from '../../../core';
2
2
  export interface GlobalAccountFilterListProps {
3
3
  allowedAccountTypes: AccountType[] | undefined;
4
4
  announce?: (message: string) => void;
5
+ disabled?: boolean;
5
6
  }
6
- export declare const GlobalAccountFilterList: (({ allowedAccountTypes, announce }: GlobalAccountFilterListProps) => import("react/jsx-runtime").JSX.Element) & {
7
+ export declare const GlobalAccountFilterList: (({ allowedAccountTypes, announce, disabled }: GlobalAccountFilterListProps) => import("react/jsx-runtime").JSX.Element) & {
7
8
  displayName: string;
8
9
  };
@@ -1,33 +1,33 @@
1
- import { buildDynamicCopy as L } from "../../../core/utils/Localization.es.js";
2
- import { useAccountStore as W, useGlobalCopyStore as B, useGlobalUiStore as H } from "../../context/hooks.es.js";
3
- import { buildSelectionFilter as S, getSelectionCounts as I } from "./selection.es.js";
4
- import { TriStateCheckbox as x } from "./TriStateCheckbox.es.js";
1
+ import { buildDynamicCopy as W } from "../../../core/utils/Localization.es.js";
2
+ import { useAccountStore as B, useGlobalCopyStore as D, useGlobalUiStore as H } from "../../context/hooks.es.js";
3
+ import { buildSelectionFilter as x, getSelectionCounts as I } from "./selection.es.js";
4
+ import { TriStateCheckbox as C } from "./TriStateCheckbox.es.js";
5
5
  import { observer as M } from "mobx-react-lite";
6
6
  import j from "@mui/material/Stack";
7
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
8
- import D from "@mui/material/Box";
9
- import N from "@mui/material/Divider";
10
- import U from "@mui/material/Checkbox";
7
+ import { jsx as t, jsxs as k } from "react/jsx-runtime";
8
+ import N from "@mui/material/Box";
9
+ import U from "@mui/material/Divider";
10
+ import Y from "@mui/material/Checkbox";
11
11
  import g from "@mui/material/FormControlLabel";
12
- import k from "@mui/material/List";
12
+ import _ from "@mui/material/List";
13
13
  import a from "@mui/material/ListItem";
14
- var T = M(({ allowedAccountTypes: n, announce: _ }) => {
15
- const { accountFilterMap: i, updateAccountFilterMap: d } = H(), { accounts: h, common: A } = B(), { account_filter: p } = A, { accountsByTypeMap: m, detailedAccounts: b } = W(), s = S(i, b, n), u = s.size > 0 && Array.from(s.values()).every((e) => e), F = Array.from(s.values()).some((e) => e), f = () => {
16
- const { selected: e, total: o } = I(S(i, b, n));
17
- _?.(L(p.selection_announcement, String(e), String(o)));
18
- }, G = () => {
14
+ var ee = M(({ allowedAccountTypes: l, announce: A, disabled: h = !1 }) => {
15
+ const { accountFilterMap: i, updateAccountFilterMap: d } = H(), { accounts: p, common: F } = D(), { account_filter: b } = F, { accountsByTypeMap: m, detailedAccounts: f } = B(), s = x(i, f, l), u = s.size > 0 && Array.from(s.values()).every((e) => e), G = Array.from(s.values()).some((e) => e), y = () => {
16
+ const { selected: e, total: o } = I(x(i, f, l));
17
+ A?.(W(b.selection_announcement, String(e), String(o)));
18
+ }, P = () => {
19
19
  for (const e of s.keys()) d(e, !u);
20
- f();
21
- }, P = (e) => {
22
- if (n && !n.includes(e)) return;
20
+ y();
21
+ }, z = (e) => {
22
+ if (l && !l.includes(e)) return;
23
23
  const o = m.get(e);
24
24
  if (!o) return;
25
- const c = o.every((l) => i.get(l.guid));
26
- for (const l of o) d(l.guid, !c);
27
- f();
25
+ const c = o.every((n) => i.get(n.guid));
26
+ for (const n of o) d(n.guid, !c);
27
+ y();
28
28
  };
29
- return /* @__PURE__ */ t(D, {
30
- "aria-label": h.title,
29
+ return /* @__PURE__ */ t(N, {
30
+ "aria-label": p.title,
31
31
  id: "filter_accounts",
32
32
  role: "region",
33
33
  sx: {
@@ -36,20 +36,21 @@ var T = M(({ allowedAccountTypes: n, announce: _ }) => {
36
36
  minWidth: 280
37
37
  },
38
38
  tabIndex: 0,
39
- children: /* @__PURE__ */ C(k, {
39
+ children: /* @__PURE__ */ k(_, {
40
40
  dense: !0,
41
41
  children: [/* @__PURE__ */ t(a, {
42
42
  disableGutters: !0,
43
43
  disablePadding: !0,
44
44
  sx: { py: 16 },
45
45
  children: /* @__PURE__ */ t(g, {
46
- control: /* @__PURE__ */ t(x, {
46
+ control: /* @__PURE__ */ t(C, {
47
47
  checked: u,
48
- indeterminate: !u && F,
49
- onChange: G,
48
+ disabled: h,
49
+ indeterminate: !u && G,
50
+ onChange: P,
50
51
  size: "small"
51
52
  }),
52
- label: p.select_all_accounts,
53
+ label: b.select_all_accounts,
53
54
  slotProps: { typography: {
54
55
  variant: "body1",
55
56
  fontWeight: "normal"
@@ -61,33 +62,33 @@ var T = M(({ allowedAccountTypes: n, announce: _ }) => {
61
62
  }
62
63
  })
63
64
  }), Array.from(m.keys()).map((e) => {
64
- const o = m.get(e), c = n ? !n.includes(e) : !1, l = h.account_type_accounts[e], y = `account-filter-group-${e}`, v = !!o?.length && o.every((r) => i.get(r.guid)), z = !!o?.some((r) => i.get(r.guid));
65
+ const o = m.get(e), c = h || (l ? !l.includes(e) : !1), n = p.account_type_accounts[e], v = `account-filter-group-${e}`, S = !!o?.length && o.every((r) => i.get(r.guid)), L = !!o?.some((r) => i.get(r.guid));
65
66
  return /* @__PURE__ */ t(a, {
66
67
  disableGutters: !0,
67
68
  disablePadding: !0,
68
- children: /* @__PURE__ */ C(j, {
69
- "aria-labelledby": y,
69
+ children: /* @__PURE__ */ k(j, {
70
+ "aria-labelledby": v,
70
71
  role: "group",
71
72
  sx: {
72
73
  pb: 8,
73
74
  width: "100%"
74
75
  },
75
- children: [/* @__PURE__ */ t(N, {}), /* @__PURE__ */ t(k, {
76
+ children: [/* @__PURE__ */ t(U, {}), /* @__PURE__ */ t(_, {
76
77
  dense: !0,
77
78
  subheader: /* @__PURE__ */ t(a, {
78
79
  disableGutters: !0,
79
80
  disablePadding: !0,
80
81
  children: /* @__PURE__ */ t(g, {
81
- control: /* @__PURE__ */ t(x, {
82
- checked: v,
82
+ control: /* @__PURE__ */ t(C, {
83
+ checked: S,
83
84
  disabled: c,
84
- indeterminate: !v && z,
85
- onChange: () => P(e),
85
+ indeterminate: !S && L,
86
+ onChange: () => z(e),
86
87
  size: "small"
87
88
  }),
88
- label: l,
89
+ label: n,
89
90
  slotProps: { typography: {
90
- id: y,
91
+ id: v,
91
92
  variant: "body1",
92
93
  fontWeight: "bold"
93
94
  } },
@@ -100,7 +101,7 @@ var T = M(({ allowedAccountTypes: n, announce: _ }) => {
100
101
  })
101
102
  }),
102
103
  children: o?.map((r) => /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(g, {
103
- control: /* @__PURE__ */ t(U, {
104
+ control: /* @__PURE__ */ t(Y, {
104
105
  checked: !!i.get(r.guid),
105
106
  disabled: c,
106
107
  onChange: () => d(r.guid, !i.get(r.guid)),
@@ -126,7 +127,7 @@ var T = M(({ allowedAccountTypes: n, announce: _ }) => {
126
127
  });
127
128
  });
128
129
  export {
129
- T as GlobalAccountFilterList
130
+ ee as GlobalAccountFilterList
130
131
  };
131
132
 
132
133
  //# sourceMappingURL=GlobalAccountFilterList.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalAccountFilterList.es.js","names":[],"sources":["../../../../src/common/components/globalaccountfilter/GlobalAccountFilterList.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport CheckBox from '@mui/material/Checkbox'\nimport Divider from '@mui/material/Divider'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport Stack from '@mui/material/Stack'\n\nimport { useAccountStore, useGlobalCopyStore, useGlobalUiStore } from '../../context'\nimport { AccountType } from '../../../core'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nimport { buildSelectionFilter, getSelectionCounts } from './selection'\nimport { TriStateCheckbox } from './TriStateCheckbox'\n\nexport interface GlobalAccountFilterListProps {\n allowedAccountTypes: AccountType[] | undefined\n announce?: (message: string) => void\n}\n\nexport const GlobalAccountFilterList = observer(\n ({ allowedAccountTypes, announce }: GlobalAccountFilterListProps) => {\n const { accountFilterMap, updateAccountFilterMap } = useGlobalUiStore()\n const { accounts: accountsCopy, common: commonCopy } = useGlobalCopyStore()\n const { account_filter: copy } = commonCopy\n\n const { accountsByTypeMap, detailedAccounts } = useAccountStore()\n\n // Only the accounts this widget is allowed to show drive the select-all\n // state and the announced counts.\n const selectionFilter = buildSelectionFilter(\n accountFilterMap,\n detailedAccounts,\n allowedAccountTypes,\n )\n\n // `every` is vacuously true on an empty set, which would render Select All\n // checked when no account is selectable. Mirrors the per-group guard below.\n const allSelected =\n selectionFilter.size > 0 &&\n Array.from(selectionFilter.values()).every((isSelected) => isSelected)\n const someSelected = Array.from(selectionFilter.values()).some((isSelected) => isSelected)\n\n // Bulk changes move many checkboxes at once, so the resulting count is\n // announced rather than left to the individual checkbox states. This is\n // also what conveys the tri-state to screen readers that handle\n // aria-checked=\"mixed\" poorly.\n const announceSelection = () => {\n const { selected, total } = getSelectionCounts(\n buildSelectionFilter(accountFilterMap, detailedAccounts, allowedAccountTypes),\n )\n\n announce?.(\n buildDynamicCopy(copy.selection_announcement, String(selected), String(total)) as string,\n )\n }\n\n const handleSelectAllClick = () => {\n for (const guid of selectionFilter.keys()) {\n updateAccountFilterMap(guid, !allSelected)\n }\n\n announceSelection()\n }\n\n const handleSelectAccountTypeClick = (accountType: AccountType) => {\n if (allowedAccountTypes && !allowedAccountTypes.includes(accountType)) return\n\n const accounts = accountsByTypeMap.get(accountType)\n if (!accounts) return\n\n const allAccountsSelected = accounts.every((account) => accountFilterMap.get(account.guid))\n for (const account of accounts) {\n updateAccountFilterMap(account.guid, !allAccountsSelected)\n }\n\n announceSelection()\n }\n\n return (\n <Box\n // Named for the content it holds, not the dialog it sits in -- the paper\n // already announces \"Filter accounts\", so reusing that here made screen\n // readers say the same name twice on entry.\n aria-label={accountsCopy.title}\n id=\"filter_accounts\"\n role=\"region\"\n sx={{ overflowY: 'scroll', maxHeight: 350, minWidth: 280 }}\n tabIndex={0}\n >\n <List dense={true}>\n {/* Select All Checkbox */}\n <ListItem disableGutters={true} disablePadding={true} sx={{ py: 16 }}>\n <FormControlLabel\n control={\n <TriStateCheckbox\n checked={allSelected}\n indeterminate={!allSelected && someSelected}\n onChange={handleSelectAllClick}\n size=\"small\"\n />\n }\n label={copy.select_all_accounts}\n slotProps={{ typography: { variant: 'body1', fontWeight: 'normal' } }}\n sx={{ width: '100%', m: 0, '&:hover': { bgcolor: 'action.hover' } }}\n />\n </ListItem>\n\n {Array.from(accountsByTypeMap.keys()).map((accountType) => {\n const accounts = accountsByTypeMap.get(accountType)\n const disabled = allowedAccountTypes\n ? !allowedAccountTypes.includes(accountType)\n : false\n const typeName = accountsCopy.account_type_accounts[accountType]\n const headingId = `account-filter-group-${accountType}`\n\n const typeAllSelected =\n !!accounts?.length && accounts.every((account) => accountFilterMap.get(account.guid))\n const typeSomeSelected = !!accounts?.some((account) =>\n accountFilterMap.get(account.guid),\n )\n\n return (\n // Account Type Group\n <ListItem disableGutters={true} disablePadding={true} key={accountType}>\n <Stack aria-labelledby={headingId} role=\"group\" sx={{ pb: 8, width: '100%' }}>\n <Divider />\n <List\n dense={true}\n subheader={\n // Account Type Checkbox — toggles every account of this type\n <ListItem disableGutters={true} disablePadding={true}>\n <FormControlLabel\n control={\n <TriStateCheckbox\n checked={typeAllSelected}\n disabled={disabled}\n indeterminate={!typeAllSelected && typeSomeSelected}\n onChange={() => handleSelectAccountTypeClick(accountType)}\n size=\"small\"\n />\n }\n label={typeName}\n slotProps={{\n typography: { id: headingId, variant: 'body1', fontWeight: 'bold' },\n }}\n sx={{\n width: '100%',\n m: 0,\n minHeight: 40,\n '&:hover': { bgcolor: 'action.hover' },\n }}\n />\n </ListItem>\n }\n >\n {accounts?.map((account) => (\n // Account Checkbox\n <ListItem key={account.guid}>\n <FormControlLabel\n control={\n <CheckBox\n checked={!!accountFilterMap.get(account.guid)}\n disabled={disabled}\n onChange={() =>\n updateAccountFilterMap(\n account.guid,\n !accountFilterMap.get(account.guid),\n )\n }\n size=\"small\"\n />\n }\n label={account.displayName}\n slotProps={{ typography: { variant: 'body1', fontWeight: 'normal' } }}\n sx={{\n width: '100%',\n m: 0,\n minHeight: 40,\n '&:hover': { bgcolor: 'action.hover' },\n }}\n />\n </ListItem>\n ))}\n </List>\n </Stack>\n </ListItem>\n )\n })}\n </List>\n </Box>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAa,IAA0B,EAAA,CACpC,EAAE,qBAAA,GAAqB,UAAA,EAAA,MAA6C;AACnE,QAAM,EAAE,kBAAA,GAAkB,wBAAA,EAAA,IAA2B,EAAiB,GAChE,EAAE,UAAU,GAAc,QAAQ,EAAA,IAAe,EAAmB,GACpE,EAAE,gBAAgB,EAAA,IAAS,GAE3B,EAAE,mBAAA,GAAmB,kBAAA,EAAA,IAAqB,EAAgB,GAI1D,IAAkB,EACtB,GACA,GACA,CACF,GAIM,IACJ,EAAgB,OAAO,KACvB,MAAM,KAAK,EAAgB,OAAO,CAAC,EAAE,MAAA,CAAO,MAAe,CAAU,GACjE,IAAe,MAAM,KAAK,EAAgB,OAAO,CAAC,EAAE,KAAA,CAAM,MAAe,CAAU,GAMnF,IAAA,MAA0B;AAC9B,UAAM,EAAE,UAAA,GAAU,OAAA,EAAA,IAAU,EAC1B,EAAqB,GAAkB,GAAkB,CAAmB,CAC9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OAAO;AAAA,oBACP,GAAG;AAAA,oBACH,WAAW;AAAA,oBACX,WAAW,EAAE,SAAS,eAAe;AAAA,kBACvC;AAAA,gBACD,CAAA;AAAA,cACO,CAAA;AAAA,cAGX,UAAA,GAAU,IAAA,CAAK,MAEd,gBAAA,EAAC,GAAD,EAAA,UACE,gBAAA,EAAC,GAAD;AAAA,gBACE,SACE,gBAAA,EAAC,GAAD;AAAA,kBACE,SAAS,CAAC,CAAC,EAAiB,IAAI,EAAQ,IAAI;AAAA,kBAClC,UAAA;AAAA,kBACV,UAAA,MACE,EACE,EAAQ,MACR,CAAC,EAAiB,IAAI,EAAQ,IAAI,CACpC;AAAA,kBAEF,MAAK;AAAA,gBACN,CAAA;AAAA,gBAEH,OAAO,EAAQ;AAAA,gBACf,WAAW,EAAE,YAAY;AAAA,kBAAE,SAAS;AAAA,kBAAS,YAAY;AAAA,gBAAS,EAAE;AAAA,gBACpE,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,GAAG;AAAA,kBACH,WAAW;AAAA,kBACX,WAAW,EAAE,SAAS,eAAe;AAAA,gBACvC;AAAA,cACD,CAAA,EACO,GAxBK,EAAQ,IAwBb,CACX;AAAA,YACG,CAAA,CACD;AAAA;QACC,GA9DiD,CA8DjD;AAAA,MAEd,CAAC,CACG;AAAA;EACH,CAAA;AAET,CACF"}
1
+ {"version":3,"file":"GlobalAccountFilterList.es.js","names":[],"sources":["../../../../src/common/components/globalaccountfilter/GlobalAccountFilterList.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport CheckBox from '@mui/material/Checkbox'\nimport Divider from '@mui/material/Divider'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport Stack from '@mui/material/Stack'\n\nimport { useAccountStore, useGlobalCopyStore, useGlobalUiStore } from '../../context'\nimport { AccountType } from '../../../core'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nimport { buildSelectionFilter, getSelectionCounts } from './selection'\nimport { TriStateCheckbox } from './TriStateCheckbox'\n\nexport interface GlobalAccountFilterListProps {\n allowedAccountTypes: AccountType[] | undefined\n announce?: (message: string) => void\n disabled?: boolean\n}\n\nexport const GlobalAccountFilterList = observer(\n ({ allowedAccountTypes, announce, disabled = false }: GlobalAccountFilterListProps) => {\n const { accountFilterMap, updateAccountFilterMap } = useGlobalUiStore()\n const { accounts: accountsCopy, common: commonCopy } = useGlobalCopyStore()\n const { account_filter: copy } = commonCopy\n\n const { accountsByTypeMap, detailedAccounts } = useAccountStore()\n\n // Only the accounts this widget is allowed to show drive the select-all\n // state and the announced counts.\n const selectionFilter = buildSelectionFilter(\n accountFilterMap,\n detailedAccounts,\n allowedAccountTypes,\n )\n\n // `every` is vacuously true on an empty set, which would render Select All\n // checked when no account is selectable. Mirrors the per-group guard below.\n const allSelected =\n selectionFilter.size > 0 &&\n Array.from(selectionFilter.values()).every((isSelected) => isSelected)\n const someSelected = Array.from(selectionFilter.values()).some((isSelected) => isSelected)\n\n // Bulk changes move many checkboxes at once, so the resulting count is\n // announced rather than left to the individual checkbox states. This is\n // also what conveys the tri-state to screen readers that handle\n // aria-checked=\"mixed\" poorly.\n const announceSelection = () => {\n const { selected, total } = getSelectionCounts(\n buildSelectionFilter(accountFilterMap, detailedAccounts, allowedAccountTypes),\n )\n\n announce?.(\n buildDynamicCopy(copy.selection_announcement, String(selected), String(total)) as string,\n )\n }\n\n const handleSelectAllClick = () => {\n for (const guid of selectionFilter.keys()) {\n updateAccountFilterMap(guid, !allSelected)\n }\n\n announceSelection()\n }\n\n const handleSelectAccountTypeClick = (accountType: AccountType) => {\n if (allowedAccountTypes && !allowedAccountTypes.includes(accountType)) return\n\n const accounts = accountsByTypeMap.get(accountType)\n if (!accounts) return\n\n const allAccountsSelected = accounts.every((account) => accountFilterMap.get(account.guid))\n for (const account of accounts) {\n updateAccountFilterMap(account.guid, !allAccountsSelected)\n }\n\n announceSelection()\n }\n\n return (\n <Box\n // Named for the content it holds, not the dialog it sits in -- the paper\n // already announces \"Filter accounts\", so reusing that here made screen\n // readers say the same name twice on entry.\n aria-label={accountsCopy.title}\n id=\"filter_accounts\"\n role=\"region\"\n sx={{ overflowY: 'scroll', maxHeight: 350, minWidth: 280 }}\n tabIndex={0}\n >\n <List dense={true}>\n {/* Select All Checkbox */}\n <ListItem disableGutters={true} disablePadding={true} sx={{ py: 16 }}>\n <FormControlLabel\n control={\n <TriStateCheckbox\n checked={allSelected}\n disabled={disabled}\n indeterminate={!allSelected && someSelected}\n onChange={handleSelectAllClick}\n size=\"small\"\n />\n }\n label={copy.select_all_accounts}\n slotProps={{ typography: { variant: 'body1', fontWeight: 'normal' } }}\n sx={{ width: '100%', m: 0, '&:hover': { bgcolor: 'action.hover' } }}\n />\n </ListItem>\n\n {Array.from(accountsByTypeMap.keys()).map((accountType) => {\n const accounts = accountsByTypeMap.get(accountType)\n const typeDisabled =\n disabled || (allowedAccountTypes ? !allowedAccountTypes.includes(accountType) : false)\n const typeName = accountsCopy.account_type_accounts[accountType]\n const headingId = `account-filter-group-${accountType}`\n\n const typeAllSelected =\n !!accounts?.length && accounts.every((account) => accountFilterMap.get(account.guid))\n const typeSomeSelected = !!accounts?.some((account) =>\n accountFilterMap.get(account.guid),\n )\n\n return (\n // Account Type Group\n <ListItem disableGutters={true} disablePadding={true} key={accountType}>\n <Stack aria-labelledby={headingId} role=\"group\" sx={{ pb: 8, width: '100%' }}>\n <Divider />\n <List\n dense={true}\n subheader={\n // Account Type Checkbox — toggles every account of this type\n <ListItem disableGutters={true} disablePadding={true}>\n <FormControlLabel\n control={\n <TriStateCheckbox\n checked={typeAllSelected}\n disabled={typeDisabled}\n indeterminate={!typeAllSelected && typeSomeSelected}\n onChange={() => handleSelectAccountTypeClick(accountType)}\n size=\"small\"\n />\n }\n label={typeName}\n slotProps={{\n typography: { id: headingId, variant: 'body1', fontWeight: 'bold' },\n }}\n sx={{\n width: '100%',\n m: 0,\n minHeight: 40,\n '&:hover': { bgcolor: 'action.hover' },\n }}\n />\n </ListItem>\n }\n >\n {accounts?.map((account) => (\n // Account Checkbox\n <ListItem key={account.guid}>\n <FormControlLabel\n control={\n <CheckBox\n checked={!!accountFilterMap.get(account.guid)}\n disabled={typeDisabled}\n onChange={() =>\n updateAccountFilterMap(\n account.guid,\n !accountFilterMap.get(account.guid),\n )\n }\n size=\"small\"\n />\n }\n label={account.displayName}\n slotProps={{ typography: { variant: 'body1', fontWeight: 'normal' } }}\n sx={{\n width: '100%',\n m: 0,\n minHeight: 40,\n '&:hover': { bgcolor: 'action.hover' },\n }}\n />\n </ListItem>\n ))}\n </List>\n </Stack>\n </ListItem>\n )\n })}\n </List>\n </Box>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,KAA0B,EAAA,CACpC,EAAE,qBAAA,GAAqB,UAAA,GAAU,UAAA,IAAW,GAAA,MAA0C;AACrF,QAAM,EAAE,kBAAA,GAAkB,wBAAA,EAAA,IAA2B,EAAiB,GAChE,EAAE,UAAU,GAAc,QAAQ,EAAA,IAAe,EAAmB,GACpE,EAAE,gBAAgB,EAAA,IAAS,GAE3B,EAAE,mBAAA,GAAmB,kBAAA,EAAA,IAAqB,EAAgB,GAI1D,IAAkB,EACtB,GACA,GACA,CACF,GAIM,IACJ,EAAgB,OAAO,KACvB,MAAM,KAAK,EAAgB,OAAO,CAAC,EAAE,MAAA,CAAO,MAAe,CAAU,GACjE,IAAe,MAAM,KAAK,EAAgB,OAAO,CAAC,EAAE,KAAA,CAAM,MAAe,CAAU,GAMnF,IAAA,MAA0B;AAC9B,UAAM,EAAE,UAAA,GAAU,OAAA,EAAA,IAAU,EAC1B,EAAqB,GAAkB,GAAkB,CAAmB,CAC9E;AAEA,IAAA,IACE,EAAiB,EAAK,wBAAwB,OAAO,CAAQ,GAAG,OAAO,CAAK,CAAC,CAC/E;AAAA,EACF,GAEM,IAAA,MAA6B;AACjC,eAAW,KAAQ,EAAgB,KAA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O,CAAA;AAAA,cAGX,UAAA,GAAU,IAAA,CAAK,MAEd,gBAAA,EAAC,GAAD,EAAA,UACE,gBAAA,EAAC,GAAD;AAAA,gBACE,SACE,gBAAA,EAAC,GAAD;AAAA,kBACE,SAAS,CAAC,CAAC,EAAiB,IAAI,EAAQ,IAAI;AAAA,kBAC5C,UAAU;AAAA,kBACV,UAAA,MACE,EACE,EAAQ,MACR,CAAC,EAAiB,IAAI,EAAQ,IAAI,CACpC;AAAA,kBAEF,MAAK;AAAA,gBACN,CAAA;AAAA,gBAEH,OAAO,EAAQ;AAAA,gBACf,WAAW,EAAE,YAAY;AAAA,kBAAE,SAAS;AAAA,kBAAS,YAAY;AAAA,gBAAS,EAAE;AAAA,gBACpE,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,GAAG;AAAA,kBACH,WAAW;AAAA,kBACX,WAAW,EAAE,SAAS,eAAe;AAAA,gBACvC;AAAA,cACD,CAAA,EACO,GAxBK,EAAQ,IAwBb,CACX;AAAA,YACG,CAAA,CACD;AAAA;QACC,GA9DiD,CA8DjD;AAAA,MAEd,CAAC,CACG;AAAA;EACH,CAAA;AAET,CACF"}
@@ -3,6 +3,7 @@ import { GlobalStore } from './GlobalStore';
3
3
  export declare class GlobalUiStore {
4
4
  globalStore: GlobalStore;
5
5
  accountFilterMap: Map<string, boolean>;
6
+ isApplyingAccountFilter: boolean;
6
7
  displayedDate: Date;
7
8
  displayedDateRange: {
8
9
  start: Date;
@@ -20,6 +21,7 @@ export declare class GlobalUiStore {
20
21
  populateAccountFilterMap: (accounts: Account[]) => void;
21
22
  resetAccountFilterMap: () => void;
22
23
  updateAccountFilterMap: (guid: string, isIncluded: boolean) => void;
24
+ setIsApplyingAccountFilter: (isApplying: boolean) => void;
23
25
  setDisplayedDate: (startDate: Date, endDate: Date) => void;
24
26
  get shouldDisableNextDate(): boolean;
25
27
  get shouldDisablePrevDate(): boolean;
@@ -1,20 +1,19 @@
1
1
  import { addMonths as o } from "date-fns/addMonths";
2
- import { endOfMonth as s } from "date-fns/endOfMonth";
3
- import { startOfMonth as i } from "date-fns/startOfMonth";
4
- import { makeAutoObservable as r, reaction as l } from "mobx";
2
+ import { endOfMonth as i } from "date-fns/endOfMonth";
3
+ import { startOfMonth as s } from "date-fns/startOfMonth";
4
+ import { makeAutoObservable as r } from "mobx";
5
5
  import { getMonth as a } from "date-fns/getMonth";
6
- var h = class {
6
+ var p = class {
7
7
  globalStore;
8
8
  accountFilterMap = /* @__PURE__ */ new Map();
9
+ isApplyingAccountFilter = !1;
9
10
  displayedDate = /* @__PURE__ */ new Date();
10
11
  displayedDateRange = {
11
- start: i(this.displayedDate),
12
- end: s(this.displayedDate)
12
+ start: s(this.displayedDate),
13
+ end: i(this.displayedDate)
13
14
  };
14
15
  constructor(t) {
15
- r(this), this.globalStore = t, l(() => this.globalStore.accountStore.visibleAccounts, (e) => {
16
- this.populateAccountFilterMap(e);
17
- });
16
+ r(this), this.globalStore = t;
18
17
  }
19
18
  get allSelectedAccounts() {
20
19
  return this.globalStore.accountStore.detailedAccounts.filter((t) => !t.is_excluded_from_accounts);
@@ -53,6 +52,9 @@ var h = class {
53
52
  updateAccountFilterMap = (t, e) => {
54
53
  this.accountFilterMap.set(t, e);
55
54
  };
55
+ setIsApplyingAccountFilter = (t) => {
56
+ this.isApplyingAccountFilter = t;
57
+ };
56
58
  setDisplayedDate = (t, e) => {
57
59
  this.displayedDate = e, this.displayedDateRange = {
58
60
  start: t,
@@ -67,7 +69,7 @@ var h = class {
67
69
  }
68
70
  };
69
71
  export {
70
- h as GlobalUiStore
72
+ p as GlobalUiStore
71
73
  };
72
74
 
73
75
  //# sourceMappingURL=GlobalUiStore.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalUiStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalUiStore.ts"],"sourcesContent":["import { makeAutoObservable, reaction } from 'mobx'\n\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { getMonth } from 'date-fns/getMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { Account } from '../types'\n\nimport type { GlobalStore } from './GlobalStore'\n\nexport class GlobalUiStore {\n globalStore: GlobalStore\n\n accountFilterMap: Map<string, boolean> = new Map()\n\n displayedDate = new Date()\n displayedDateRange = {\n start: startOfMonth(this.displayedDate),\n end: endOfMonth(this.displayedDate),\n }\n\n constructor(globalStore: GlobalStore) {\n makeAutoObservable(this)\n this.globalStore = globalStore\n\n reaction(\n () => this.globalStore.accountStore.visibleAccounts,\n (visibleAccounts) => {\n this.populateAccountFilterMap(visibleAccounts)\n },\n )\n }\n\n get allSelectedAccounts() {\n return this.globalStore.accountStore.detailedAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccounts() {\n return this.globalStore.accountStore.visibleAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccountGuids() {\n return this.selectedAccounts.map((account) => account.guid)\n }\n\n get isCopyLoaded() {\n return this.globalStore.copyStore.isInitialized\n }\n\n get isConfigLoaded() {\n return this.globalStore.appDataStore.isAppDataLoaded\n }\n\n get areUserFeaturesLoaded() {\n return this.globalStore.userStore.userFeaturesLoaded\n }\n\n get isInitialized() {\n return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded\n }\n\n get shouldShowWelcomeDialog() {\n if (!this.isInitialized) {\n return false\n }\n\n const { config } = this.globalStore.appDataStore.appConfig\n const user = this.globalStore.appDataStore.user\n\n return Boolean(config.display_terms_and_conditions && user && !user.has_accepted_terms)\n }\n\n populateAccountFilterMap = (accounts: Account[]) => {\n if (accounts) {\n accounts.forEach((account) => {\n this.accountFilterMap.set(account.guid, !account.is_excluded_from_accounts)\n })\n }\n }\n\n resetAccountFilterMap = () => {\n this.accountFilterMap.clear()\n this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts)\n }\n\n updateAccountFilterMap = (guid: string, isIncluded: boolean) => {\n this.accountFilterMap.set(guid, isIncluded)\n }\n\n setDisplayedDate = (startDate: Date, endDate: Date) => {\n this.displayedDate = endDate\n this.displayedDateRange = {\n start: startDate,\n end: endDate,\n }\n }\n\n get shouldDisableNextDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const nextMonth = getMonth(addMonths(new Date(), 1))\n\n return selectedMonth === nextMonth\n }\n\n get shouldDisablePrevDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const currentMonth = getMonth(new Date())\n\n return selectedMonth === currentMonth\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EAEA,mBAAyC,oBAAI,IAAI;AAAA,EAEjD,gBAAgB,oBAAI,KAAK;AAAA,EACzB,qBAAqB;AAAA,IACnB,OAAO,EAAa,KAAK,aAAa;AAAA,IACtC,KAAK,EAAW,KAAK,aAAa;AAAA,EACpC;AAAA,EAEA,YAAY,GAA0B;AACpC,IAAA,EAAmB,IAAI,GACvB,KAAK,cAAc,GAEnB,EAAA,MACQ,KAAK,YAAY,aAAa,iBAAA,CACnC,MAAoB;AACnB,WAAK,yBAAyB,CAAe;AAAA,IAC/C,CACF;AAAA,EACF;AAAA,EAEA,IAAI,sBAAsB;AACxB,WAAO,KAAK,YAAY,aAAa,iBAAiB,OAAA,CACnD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK,YAAY,aAAa,gBAAgB,OAAA,CAClD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,iBAAiB,IAAA,CAAK,MAAY,EAAQ,IAAI;AAAA,EAC5D;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,KAAK,gBAAgB,KAAK,kBAAkB,KAAK;AAAA,EAC1D;AAAA,EAEA,IAAI,0BAA0B;AAC5B,QAAI,CAAC,KAAK,cACR,QAAO;AAGT,UAAM,EAAE,QAAA,EAAA,IAAW,KAAK,YAAY,aAAa,WAC3C,IAAO,KAAK,YAAY,aAAa;AAE3C,WAAO,GAAQ,EAAO,gCAAgC,KAAQ,CAAC,EAAK;AAAA,EACtE;AAAA,EAEA,2BAAA,CAA4B,MAAwB;AAClD,IAAI,KACF,EAAS,QAAA,CAAS,MAAY;AAC5B,WAAK,iBAAiB,IAAI,EAAQ,MAAM,CAAC,EAAQ,yBAAyB;AAAA,IAC5E,CAAC;AAAA,EAEL;AAAA,EAEA,wBAAA,MAA8B;AAC5B,SAAK,iBAAiB,MAAM,GAC5B,KAAK,yBAAyB,KAAK,YAAY,aAAa,eAAe;AAAA,EAC7E;AAAA,EAEA,yBAAA,CAA0B,GAAc,MAAwB;AAC9D,SAAK,iBAAiB,IAAI,GAAM,CAAU;AAAA,EAC5C;AAAA,EAEA,mBAAA,CAAoB,GAAiB,MAAkB;AACrD,SAAK,gBAAgB,GACrB,KAAK,qBAAqB;AAAA,MACxB,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFW,EAAS,EAAU,oBAAI,KAAK,GAAG,CAAC,CAEzB;AAAA,EAC3B;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFc,EAAS,oBAAI,KAAK,CAEd;AAAA,EAC3B;AACF"}
1
+ {"version":3,"file":"GlobalUiStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalUiStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { getMonth } from 'date-fns/getMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { Account } from '../types'\n\nimport type { GlobalStore } from './GlobalStore'\n\nexport class GlobalUiStore {\n globalStore: GlobalStore\n\n accountFilterMap: Map<string, boolean> = new Map()\n // Shared, not per filter: the map is global, so a filter in another widget\n // must not accept edits that a save started elsewhere will overwrite.\n isApplyingAccountFilter = false\n\n displayedDate = new Date()\n displayedDateRange = {\n start: startOfMonth(this.displayedDate),\n end: endOfMonth(this.displayedDate),\n }\n\n constructor(globalStore: GlobalStore) {\n makeAutoObservable(this)\n this.globalStore = globalStore\n }\n\n get allSelectedAccounts() {\n return this.globalStore.accountStore.detailedAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccounts() {\n return this.globalStore.accountStore.visibleAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccountGuids() {\n return this.selectedAccounts.map((account) => account.guid)\n }\n\n get isCopyLoaded() {\n return this.globalStore.copyStore.isInitialized\n }\n\n get isConfigLoaded() {\n return this.globalStore.appDataStore.isAppDataLoaded\n }\n\n get areUserFeaturesLoaded() {\n return this.globalStore.userStore.userFeaturesLoaded\n }\n\n get isInitialized() {\n return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded\n }\n\n get shouldShowWelcomeDialog() {\n if (!this.isInitialized) {\n return false\n }\n\n const { config } = this.globalStore.appDataStore.appConfig\n const user = this.globalStore.appDataStore.user\n\n return Boolean(config.display_terms_and_conditions && user && !user.has_accepted_terms)\n }\n\n populateAccountFilterMap = (accounts: Account[]) => {\n if (accounts) {\n accounts.forEach((account) => {\n this.accountFilterMap.set(account.guid, !account.is_excluded_from_accounts)\n })\n }\n }\n\n resetAccountFilterMap = () => {\n this.accountFilterMap.clear()\n this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts)\n }\n\n updateAccountFilterMap = (guid: string, isIncluded: boolean) => {\n this.accountFilterMap.set(guid, isIncluded)\n }\n\n setIsApplyingAccountFilter = (isApplying: boolean) => {\n this.isApplyingAccountFilter = isApplying\n }\n\n setDisplayedDate = (startDate: Date, endDate: Date) => {\n this.displayedDate = endDate\n this.displayedDateRange = {\n start: startDate,\n end: endDate,\n }\n }\n\n get shouldDisableNextDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const nextMonth = getMonth(addMonths(new Date(), 1))\n\n return selectedMonth === nextMonth\n }\n\n get shouldDisablePrevDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const currentMonth = getMonth(new Date())\n\n return selectedMonth === currentMonth\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EAEA,mBAAyC,oBAAI,IAAI;AAAA,EAGjD,0BAA0B;AAAA,EAE1B,gBAAgB,oBAAI,KAAK;AAAA,EACzB,qBAAqB;AAAA,IACnB,OAAO,EAAa,KAAK,aAAa;AAAA,IACtC,KAAK,EAAW,KAAK,aAAa;AAAA,EACpC;AAAA,EAEA,YAAY,GAA0B;AACpC,IAAA,EAAmB,IAAI,GACvB,KAAK,cAAc;AAAA,EACrB;AAAA,EAEA,IAAI,sBAAsB;AACxB,WAAO,KAAK,YAAY,aAAa,iBAAiB,OAAA,CACnD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK,YAAY,aAAa,gBAAgB,OAAA,CAClD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,iBAAiB,IAAA,CAAK,MAAY,EAAQ,IAAI;AAAA,EAC5D;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,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": "9.7.86",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",