@mx-cartographer/experiences 9.5.3 → 9.6.0-alpha-ram1-connect-widget-testing
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 +13 -0
- package/dist/common/components/ConnectDrawer.es.js +17 -44
- package/dist/common/components/ConnectDrawer.es.js.map +1 -1
- package/dist/common/components/ConnectWidgetPanel.d.ts +8 -0
- package/dist/common/components/ConnectWidgetPanel.es.js +44 -0
- package/dist/common/components/ConnectWidgetPanel.es.js.map +1 -0
- package/dist/common/components/CurrencyDialog.d.ts +10 -2
- package/dist/common/components/CurrencyDialog.es.js +56 -50
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/common/components/dialog/Dialog.d.ts +2 -0
- package/dist/common/components/dialog/Dialog.es.js +30 -30
- package/dist/common/components/dialog/Dialog.es.js.map +1 -1
- package/dist/common/components/index.d.ts +1 -0
- package/dist/common/index.es.js +67 -65
- package/dist/core/index.es.js +111 -109
- package/dist/core/types/Insights.d.ts +33 -16
- package/dist/core/types/Insights.es.js +6 -0
- package/dist/core/types/Insights.es.js.map +1 -0
- package/dist/core/types/index.d.ts +2 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +108 -0
- package/dist/core/types/localization/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +24 -18
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.d.ts +13 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +128 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +14 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +14 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.d.ts +21 -0
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js +16 -0
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/ConnectionDetailActionBlock.d.ts +12 -0
- package/dist/insights-v2/actionBlocks/ConnectionDetailActionBlock.es.js +25 -0
- package/dist/insights-v2/actionBlocks/ConnectionDetailActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/FeedbackModalActionBlock.d.ts +17 -0
- package/dist/insights-v2/actionBlocks/FeedbackModalActionBlock.es.js +39 -0
- package/dist/insights-v2/actionBlocks/FeedbackModalActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.d.ts +16 -0
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +47 -0
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -0
- package/dist/insights-v2/beatActions.d.ts +2 -2
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +5 -2
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +36 -35
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.d.ts +2 -2
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js +6 -5
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +24 -24
- package/dist/insights-v2/components/CompactInsightCard.d.ts +4 -4
- package/dist/insights-v2/components/CompactInsightCard.es.js +50 -46
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/ConnectionDetailDrillDown.d.ts +32 -0
- package/dist/insights-v2/components/ConnectionDetailDrillDown.es.js +148 -0
- package/dist/insights-v2/components/ConnectionDetailDrillDown.es.js.map +1 -0
- package/dist/insights-v2/components/FeedbackDialog.d.ts +3 -1
- package/dist/insights-v2/components/FeedbackDialog.es.js +80 -72
- package/dist/insights-v2/components/FeedbackDialog.es.js.map +1 -1
- package/dist/insights-v2/components/FeedbackModal.d.ts +60 -0
- package/dist/insights-v2/components/FeedbackModal.es.js +61 -0
- package/dist/insights-v2/components/FeedbackModal.es.js.map +1 -0
- package/dist/insights-v2/components/SurveyModal.d.ts +65 -0
- package/dist/insights-v2/components/SurveyModal.es.js +138 -0
- package/dist/insights-v2/components/SurveyModal.es.js.map +1 -0
- package/dist/insights-v2/components/shared/StatusSnackbar.d.ts +28 -0
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js +19 -0
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +10 -10
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/index.d.ts +4 -0
- package/dist/insights-v2/index.es.js +70 -62
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +5 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +6 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.d.ts +2 -1
- package/dist/insights-v2/mappings/blocks.es.js +91 -68
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/insights-v2/mappings/hasDrawerBlock.d.ts +1 -0
- package/dist/insights-v2/mappings/hasDrawerBlock.es.js +13 -0
- package/dist/insights-v2/mappings/hasDrawerBlock.es.js.map +1 -0
- package/dist/insights-v2/resolveInsightRender.d.ts +8 -5
- package/dist/insights-v2/resolveInsightRender.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +32 -31
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [9.5.5] - 10-12-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Three Insights V2 CTA action blocks, registered in `actionBlocksKey`/`blocks`: `feedback_modal_block` (`FeedbackModalActionBlock`) renders a survey dialog with a success/error `StatusSnackbar` on top of the action drawer; `connection_detail_block` (`ConnectionDetailActionBlock`) shows the connection-details education drilldown (`ConnectionDetailDrillDown`); and `connect_widget_block` (`ConnectWidgetActionBlock`) boots MX's Connect widget (web-widget-sdk iframe) inside the drawer. Added `feedback_modal` and `connection_details` copy under `insights_feed`, exported the new `FeedbackModal`, `StatusSnackbar`, and `ConnectionDetailDrillDown` components, and added tests and stories (WEC-1879)
|
|
4
|
+
- **FIXED** - A CTA pointing at a 'modal' action block (`feedback_modal_block`, `survey_modal_block`) no longer also opens an empty action Drawer behind/under its dialog; `ActionBlockEntry` gains a `presentation?: 'drawer' | 'modal'` field and `ActionBlockLayer` skips the Drawer wrapper entirely for `'modal'` entries (WEC-1879)
|
|
5
|
+
- **ADDED** - Storybook stories for `FeedbackModalActionBlock`, `ConnectionDetailActionBlock`, `ConnectWidgetActionBlock`, and `SurveyModalActionBlock`, each rendered through `BaseLayout` with a CTA that opens the real action-block registry path (WEC-1879)
|
|
6
|
+
|
|
7
|
+
## [9.5.4] - 10-09-2026
|
|
8
|
+
|
|
9
|
+
- **ADDED** - `amount_input_modal_block`, the first modal action block: edits one whole-dollar setting in a dialog, picked by the CTA variant. `low_balance_threshold` (Low Account Balance "Edit Alert Settings") saves the threshold on the account's low-balance alert profile; `safety_net` (Savings Opportunity V2 "Set Reminder" / "Adjust Reminder") saves the safety net on the user insight profile. Saves run through `useCtaHandler`. Copy under `insights_feed.amount_input_modal`; mock beats, stories and `docs/action-blocks/amount-input-modal-block.md`.
|
|
10
|
+
- **ADDED** - `ActionBlockEntry.presentation: 'modal'`: `ActionBlockLayer` renders such a block without the drawer, and only while it is open for its beat.
|
|
11
|
+
- **ADDED** - Optional `CurrencyDialog` props `subtitle`, `errorText` and `isPrimaryDisabled`; `content` now accepts a node. Its helper text (validation or save error) is now announced with `role="alert"`. Existing callers are otherwise unchanged.
|
|
12
|
+
- **CHANGED** - `hasDrawerBlock` moved to `insights-v2/mappings/hasDrawerBlock.ts` (still re-exported from `mappings/blocks`) so action blocks can import `ctaActions` without an import cycle.
|
|
13
|
+
|
|
1
14
|
## [9.5.3] - 10-09-2026
|
|
2
15
|
|
|
3
16
|
- **CHANGED** - Repeating-transaction create flows show Sherlock-ineligible rows disabled instead of hiding them; `SelectTransaction` drives `TransactionList`'s new `isRowDisabled` prop instead of `filter` (MEW-4143)
|
|
@@ -1,53 +1,26 @@
|
|
|
1
|
-
import { useAccountStore as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let s;
|
|
12
|
-
const { refreshAccounts: f } = _(), { loadWidget: d } = b(), { connect: p } = g(), [C, e] = r.useState(!1), [h, t] = r.useState(!1), { palette: { mode: S } } = v();
|
|
13
|
-
return r.useEffect(() => (o ? (e(!0), d({
|
|
14
|
-
mode: S,
|
|
15
|
-
...l
|
|
16
|
-
}).then((E) => {
|
|
17
|
-
s = new w({
|
|
18
|
-
container: `#${a}`,
|
|
19
|
-
style: {
|
|
20
|
-
border: "none",
|
|
21
|
-
height: "calc(100% - 62px)",
|
|
22
|
-
maxWidth: "450px",
|
|
23
|
-
position: "absolute",
|
|
24
|
-
width: "100%"
|
|
25
|
-
},
|
|
26
|
-
url: E.url,
|
|
27
|
-
onSsoUrlLoadError: () => {
|
|
28
|
-
e(!1), t(!0);
|
|
29
|
-
},
|
|
30
|
-
onLoad: () => {
|
|
31
|
-
e(!1), t(!1);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
})) : (e(!1), t(!1)), () => {
|
|
35
|
-
s?.unmount();
|
|
36
|
-
}), [o]), /* @__PURE__ */ n(x, {
|
|
37
|
-
ariaLabelClose: p.close_manage_connection_aria,
|
|
1
|
+
import { useAccountStore as i, useGlobalCopyStore as m } from "../context/hooks.es.js";
|
|
2
|
+
import s from "./drawer/Drawer.es.js";
|
|
3
|
+
import l from "./ConnectWidgetPanel.es.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { observer as f } from "mobx-react-lite";
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
var p = ({ loadWidgetProps: e, onClose: t, showConnectWidget: o, title: n }) => {
|
|
8
|
+
const { refreshAccounts: a } = i(), { connect: c } = m();
|
|
9
|
+
return /* @__PURE__ */ r(s, {
|
|
10
|
+
ariaLabelClose: c.close_manage_connection_aria,
|
|
38
11
|
isOpen: o,
|
|
39
12
|
onClose: () => {
|
|
40
|
-
|
|
13
|
+
t(), a();
|
|
41
14
|
},
|
|
42
|
-
title:
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
title: n,
|
|
16
|
+
children: /* @__PURE__ */ r(l, {
|
|
17
|
+
isActive: o,
|
|
18
|
+
loadWidgetProps: e
|
|
46
19
|
})
|
|
47
20
|
});
|
|
48
|
-
},
|
|
21
|
+
}, D = f(p);
|
|
49
22
|
export {
|
|
50
|
-
|
|
23
|
+
D as default
|
|
51
24
|
};
|
|
52
25
|
|
|
53
26
|
//# sourceMappingURL=ConnectDrawer.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectDrawer.es.js","names":[],"sources":["../../../src/common/components/ConnectDrawer.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\
|
|
1
|
+
{"version":3,"file":"ConnectDrawer.es.js","names":[],"sources":["../../../src/common/components/ConnectDrawer.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ConnectWidgetPanel from './ConnectWidgetPanel'\nimport { Drawer, useAccountStore, useGlobalCopyStore } from '../../common'\n\ninterface ConnectDrawerProps {\n loadWidgetProps?: object\n onClose: () => void\n showConnectWidget: boolean\n title: string\n}\n\n/**\n * Drawer wrapper around `ConnectWidgetPanel` (SSO url via ConnectStore, the\n * iframe-based `@mxenabled/web-widget-sdk` ConnectWidget, loading/error\n * statuses) with an account refresh on close. Unchanged behaviour for its\n * existing callers; `ConnectWidgetActionBlock` renders `ConnectWidgetPanel`\n * directly instead, since `ActionBlockLayer` already supplies its own Drawer.\n */\nconst ConnectDrawer: React.FC<ConnectDrawerProps> = ({\n loadWidgetProps,\n onClose,\n showConnectWidget,\n title,\n}) => {\n const { refreshAccounts } = useAccountStore()\n const { connect: connectCopy } = useGlobalCopyStore()\n\n return (\n <Drawer\n ariaLabelClose={connectCopy.close_manage_connection_aria}\n isOpen={showConnectWidget}\n onClose={() => {\n onClose()\n refreshAccounts()\n }}\n title={title}\n >\n <ConnectWidgetPanel isActive={showConnectWidget} loadWidgetProps={loadWidgetProps} />\n </Drawer>\n )\n}\n\nexport default observer(ConnectDrawer)\n"],"mappings":";;;;;;AAoBA,IAAM,IAAA,CAA+C,EACnD,iBAAA,GACA,SAAA,GACA,mBAAA,GACA,OAAA,EAAA,MACI;AACJ,QAAM,EAAE,iBAAA,EAAA,IAAoB,EAAgB,GACtC,EAAE,SAAS,EAAA,IAAgB,EAAmB;AAEpD,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,EAAY;AAAA,IAC5B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAAQ,GACR,EAAgB;AAAA,IAClB;AAAA,IACO,OAAA;AAAA,IAEP,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAoB,UAAU;AAAA,MAAoC,iBAAA;AAAA,IAAkB,CAAA;AAAA,EAC9E,CAAA;AAEZ,GAEA,IAAe,EAAS,CAAa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ConnectWidgetPanelProps {
|
|
3
|
+
loadWidgetProps?: object;
|
|
4
|
+
/** Mounts/unmounts the underlying iframe-based ConnectWidget. */
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.FunctionComponent<ConnectWidgetPanelProps>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useConnectStore as g } from "../context/hooks.es.js";
|
|
2
|
+
import { CONNECT_WIDGET_ID as s, MemberConnectionStatus as a } from "../constants/Connect.es.js";
|
|
3
|
+
import i from "./ConnectStatus.es.js";
|
|
4
|
+
import o from "react";
|
|
5
|
+
import { observer as h } from "mobx-react-lite";
|
|
6
|
+
import { jsx as l, jsxs as C } from "react/jsx-runtime";
|
|
7
|
+
import { useTheme as E } from "@mui/material/styles";
|
|
8
|
+
import { ConnectWidget as W } from "@mxenabled/web-widget-sdk";
|
|
9
|
+
var x = ({ isActive: r, loadWidgetProps: d }) => {
|
|
10
|
+
let n;
|
|
11
|
+
const { loadWidget: f } = g(), [m, e] = o.useState(!1), [u, t] = o.useState(!1), { palette: { mode: c } } = E();
|
|
12
|
+
return o.useEffect(() => (r ? (e(!0), f({
|
|
13
|
+
mode: c,
|
|
14
|
+
...d
|
|
15
|
+
}).then((p) => {
|
|
16
|
+
n = new W({
|
|
17
|
+
container: `#${s}`,
|
|
18
|
+
style: {
|
|
19
|
+
border: "none",
|
|
20
|
+
height: "calc(100% - 62px)",
|
|
21
|
+
maxWidth: "450px",
|
|
22
|
+
position: "absolute",
|
|
23
|
+
width: "100%"
|
|
24
|
+
},
|
|
25
|
+
url: p.url,
|
|
26
|
+
onSsoUrlLoadError: () => {
|
|
27
|
+
e(!1), t(!0);
|
|
28
|
+
},
|
|
29
|
+
onLoad: () => {
|
|
30
|
+
e(!1), t(!1);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
})) : (e(!1), t(!1)), () => {
|
|
34
|
+
n?.unmount();
|
|
35
|
+
}), [r]), /* @__PURE__ */ C("div", {
|
|
36
|
+
id: s,
|
|
37
|
+
children: [u && /* @__PURE__ */ l(i, { status: a.Error }), m && /* @__PURE__ */ l(i, { status: a.Loading })]
|
|
38
|
+
});
|
|
39
|
+
}, w = h(x);
|
|
40
|
+
export {
|
|
41
|
+
w as default
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=ConnectWidgetPanel.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectWidgetPanel.es.js","names":[],"sources":["../../../src/common/components/ConnectWidgetPanel.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useTheme } from '@mui/material/styles'\nimport { ConnectWidget } from '@mxenabled/web-widget-sdk'\n\nimport ConnectStatus from './ConnectStatus'\nimport { CONNECT_WIDGET_ID, MemberConnectionStatus } from '../constants/Connect'\nimport { useConnectStore } from '../context/hooks'\n\nexport interface ConnectWidgetPanelProps {\n loadWidgetProps?: object\n /** Mounts/unmounts the underlying iframe-based ConnectWidget. */\n isActive: boolean\n}\n\n/**\n * The Connect widget itself (SSO url via ConnectStore, the iframe-based\n * `@mxenabled/web-widget-sdk` ConnectWidget, loading/error statuses) with no\n * `Drawer` of its own — content-only, so a caller can put it inside any\n * container (a `Drawer`, as `ConnectDrawer` does, or directly inside another\n * drawer's content slot, as `ConnectWidgetActionBlock` does).\n *\n * Extracted from `ConnectDrawer` so `ConnectWidgetActionBlock` can render just\n * the widget without nesting a second `Drawer` inside `ActionBlockLayer`'s.\n */\nconst ConnectWidgetPanel: React.FC<ConnectWidgetPanelProps> = ({ isActive, loadWidgetProps }) => {\n let connectWidget: ConnectWidget\n\n const { loadWidget } = useConnectStore()\n const [isLoading, setIsLoading] = React.useState(false)\n const [hasError, setHasError] = React.useState(false)\n const {\n palette: { mode },\n } = useTheme()\n\n React.useEffect(() => {\n if (isActive) {\n setIsLoading(true)\n loadWidget({ mode: mode, ...loadWidgetProps }).then((res) => {\n connectWidget = new ConnectWidget({\n container: `#${CONNECT_WIDGET_ID}`,\n style: {\n border: 'none',\n height: 'calc(100% - 62px)',\n maxWidth: '450px',\n position: 'absolute',\n width: '100%',\n },\n url: res.url,\n onSsoUrlLoadError: () => {\n setIsLoading(false)\n setHasError(true)\n },\n onLoad: () => {\n setIsLoading(false)\n setHasError(false)\n },\n })\n })\n } else {\n setIsLoading(false)\n setHasError(false)\n }\n\n return () => {\n connectWidget?.unmount()\n }\n }, [isActive])\n\n return (\n <div id={CONNECT_WIDGET_ID}>\n {hasError && <ConnectStatus status={MemberConnectionStatus.Error} />}\n {isLoading && <ConnectStatus status={MemberConnectionStatus.Loading} />}\n </div>\n )\n}\n\nexport default observer(ConnectWidgetPanel)\n"],"mappings":";;;;;;;;AAyBA,IAAM,IAAA,CAAyD,EAAE,UAAA,GAAU,iBAAA,EAAA,MAAsB;AAC/F,MAAI;AAEJ,QAAM,EAAE,YAAA,EAAA,IAAe,EAAgB,GACjC,CAAC,GAAW,CAAA,IAAgB,EAAM,SAAS,EAAK,GAChD,CAAC,GAAU,CAAA,IAAe,EAAM,SAAS,EAAK,GAC9C,EACJ,SAAS,EAAE,MAAA,EAAA,EAAA,IACT,EAAS;AAEb,SAAA,EAAM,UAAA,OACA,KACF,EAAa,EAAI,GACjB,EAAW;AAAA,IAAQ,MAAA;AAAA,IAAM,GAAG;AAAA,EAAgB,CAAC,EAAE,KAAA,CAAM,MAAQ;AAC3D,IAAA,IAAgB,IAAI,EAAc;AAAA,MAChC,WAAW,IAAI,CAAA;AAAA,MACf,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,MACA,KAAK,EAAI;AAAA,MACT,mBAAA,MAAyB;AACvB,QAAA,EAAa,EAAK,GAClB,EAAY,EAAI;AAAA,MAClB;AAAA,MACA,QAAA,MAAc;AACZ,QAAA,EAAa,EAAK,GAClB,EAAY,EAAK;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH,CAAC,MAED,EAAa,EAAK,GAClB,EAAY,EAAK,IAGnB,MAAa;AACX,IAAA,GAAe,QAAQ;AAAA,EACzB,IACC,CAAC,CAAQ,CAAC,GAGX,gBAAA,EAAC,OAAD;AAAA,IAAK,IAAI;AAAA,IAAT,UAAA,CACG,KAAY,gBAAA,EAAC,GAAD,EAAe,QAAQ,EAAuB,MAAQ,CAAA,GAClE,KAAa,gBAAA,EAAC,GAAD,EAAe,QAAQ,EAAuB,QAAU,CAAA,CACnE;AAAA;AAET,GAEA,IAAe,EAAS,CAAkB"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { ButtonProps } from '@mui/material/Button';
|
|
2
3
|
interface CurrencyDialogProps {
|
|
3
4
|
closeAriaLabel: string;
|
|
4
|
-
|
|
5
|
+
/** Body copy; a node so callers can emphasise part of it (e.g. a bold account name). */
|
|
6
|
+
content?: ReactNode;
|
|
7
|
+
/** Validation or save error, shown under the input and marking it invalid. */
|
|
8
|
+
errorText?: string;
|
|
5
9
|
inputLabel?: string;
|
|
6
10
|
inputValue?: string;
|
|
7
11
|
isOpen: boolean;
|
|
12
|
+
/** Disables the primary button on top of the built-in input check (e.g. while saving). */
|
|
13
|
+
isPrimaryDisabled?: boolean;
|
|
8
14
|
handleInputChange?: (value: string) => void;
|
|
9
15
|
handleModalClose: () => void;
|
|
10
16
|
handlePrimaryAction: () => void;
|
|
@@ -13,7 +19,9 @@ interface CurrencyDialogProps {
|
|
|
13
19
|
primaryText: string;
|
|
14
20
|
secondaryColor?: ButtonProps['color'];
|
|
15
21
|
secondaryText?: string;
|
|
22
|
+
/** A line under the title, e.g. the account a setting applies to. */
|
|
23
|
+
subtitle?: ReactNode;
|
|
16
24
|
title: string;
|
|
17
25
|
}
|
|
18
|
-
declare const CurrencyDialog: ({ closeAriaLabel, content, inputLabel, inputValue, isOpen, handleInputChange, handleModalClose, handlePrimaryAction, handleSecondaryAction, primaryColor, primaryText, secondaryColor, secondaryText, title, }: CurrencyDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare const CurrencyDialog: ({ closeAriaLabel, content, errorText, inputLabel, inputValue, isOpen, isPrimaryDisabled, handleInputChange, handleModalClose, handlePrimaryAction, handleSecondaryAction, primaryColor, primaryText, secondaryColor, secondaryText, subtitle, title, }: CurrencyDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
27
|
export default CurrencyDialog;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useScreenSize as
|
|
2
|
-
import
|
|
3
|
-
import { H3 as
|
|
4
|
-
import
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { jsx as o, jsxs as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */ o(
|
|
16
|
-
"aria-label":
|
|
1
|
+
import { useScreenSize as k } from "../hooks/useScreenSize.es.js";
|
|
2
|
+
import n from "@mui/material/Stack";
|
|
3
|
+
import { H3 as S, P as j } from "@mxenabled/mxui";
|
|
4
|
+
import f from "@mui/material/Button";
|
|
5
|
+
import { Icon as M } from "@mxenabled/mx-icons";
|
|
6
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
7
|
+
import $ from "@mui/material/Dialog";
|
|
8
|
+
import B from "@mui/material/DialogContent";
|
|
9
|
+
import F from "@mui/material/IconButton";
|
|
10
|
+
import H from "@mui/material/DialogActions";
|
|
11
|
+
import w from "@mui/material/InputAdornment";
|
|
12
|
+
import A from "@mui/material/TextField";
|
|
13
|
+
var U = ({ closeAriaLabel: h, content: g, errorText: a, inputLabel: r, inputValue: i, isOpen: u, isPrimaryDisabled: x = !1, handleInputChange: b, handleModalClose: m, handlePrimaryAction: s, handleSecondaryAction: C, primaryColor: D = "primary", primaryText: p, secondaryColor: v = "primary", secondaryText: l, subtitle: y, title: c }) => {
|
|
14
|
+
const d = x || (r ? !(i !== "" && i !== "0" && !isNaN(parseFloat(i ?? "0"))) : !1), { isSmallMobile: I } = k();
|
|
15
|
+
return /* @__PURE__ */ o($, {
|
|
16
|
+
"aria-label": c,
|
|
17
17
|
"aria-labelledby": "modal-title",
|
|
18
18
|
maxWidth: "xs",
|
|
19
|
-
onClose:
|
|
20
|
-
open:
|
|
19
|
+
onClose: m,
|
|
20
|
+
open: u,
|
|
21
21
|
role: "dialog",
|
|
22
22
|
sx: {
|
|
23
23
|
"& .MuiDialogContent-root": { p: 0 },
|
|
24
|
-
...
|
|
24
|
+
...I && { "& .MuiDialog-paper": { minWidth: "100%" } }
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */ o(
|
|
27
|
-
onSubmit: (
|
|
28
|
-
|
|
26
|
+
children: /* @__PURE__ */ o(B, { children: /* @__PURE__ */ t("form", {
|
|
27
|
+
onSubmit: (e) => {
|
|
28
|
+
e.preventDefault(), d || s();
|
|
29
29
|
},
|
|
30
30
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ t(n, {
|
|
32
32
|
sx: {
|
|
33
33
|
alignItems: "center",
|
|
34
34
|
flexDirection: "row",
|
|
@@ -39,46 +39,52 @@ var O = ({ closeAriaLabel: d, content: f, inputLabel: t, inputValue: i, isOpen:
|
|
|
39
39
|
pr: 16,
|
|
40
40
|
pt: 24
|
|
41
41
|
},
|
|
42
|
-
children: [/* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
children:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
children: [/* @__PURE__ */ t(n, {
|
|
43
|
+
sx: { gap: 4 },
|
|
44
|
+
children: [/* @__PURE__ */ o(S, {
|
|
45
|
+
id: "modal-title",
|
|
46
|
+
children: c
|
|
47
|
+
}), y]
|
|
48
|
+
}), /* @__PURE__ */ o(F, {
|
|
49
|
+
"aria-label": h,
|
|
50
|
+
onClick: m,
|
|
48
51
|
sx: {
|
|
49
52
|
minHeight: 24,
|
|
50
53
|
position: "absolute",
|
|
51
54
|
right: 8,
|
|
52
55
|
top: 18
|
|
53
56
|
},
|
|
54
|
-
children: /* @__PURE__ */ o(
|
|
57
|
+
children: /* @__PURE__ */ o(M, {
|
|
55
58
|
name: "close",
|
|
56
59
|
sx: { color: "action.active" }
|
|
57
60
|
})
|
|
58
61
|
})]
|
|
59
62
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ t(n, {
|
|
61
64
|
sx: {
|
|
62
65
|
gap: 24,
|
|
63
66
|
px: 24
|
|
64
67
|
},
|
|
65
|
-
children: [/* @__PURE__ */ o(
|
|
68
|
+
children: [/* @__PURE__ */ o(j, {
|
|
66
69
|
variant: "subtitle1",
|
|
67
|
-
children:
|
|
68
|
-
}),
|
|
70
|
+
children: g
|
|
71
|
+
}), r && /* @__PURE__ */ o(A, {
|
|
69
72
|
autoFocus: !0,
|
|
73
|
+
error: !!a,
|
|
74
|
+
helperText: a,
|
|
70
75
|
inputMode: "decimal",
|
|
71
|
-
label:
|
|
72
|
-
onChange: ({ target: { value:
|
|
73
|
-
/^\d*\.?\d*$/.test(
|
|
76
|
+
label: r,
|
|
77
|
+
onChange: ({ target: { value: e } }) => {
|
|
78
|
+
/^\d*\.?\d*$/.test(e) && b?.(e);
|
|
74
79
|
},
|
|
75
80
|
slotProps: {
|
|
76
|
-
input: { startAdornment: /* @__PURE__ */ o(
|
|
81
|
+
input: { startAdornment: /* @__PURE__ */ o(w, {
|
|
77
82
|
position: "start",
|
|
78
83
|
children: "$"
|
|
79
84
|
}) },
|
|
85
|
+
formHelperText: { role: "alert" },
|
|
80
86
|
htmlInput: {
|
|
81
|
-
"aria-label":
|
|
87
|
+
"aria-label": r,
|
|
82
88
|
noValidate: !0,
|
|
83
89
|
pattern: "[0-9]*\\.?[0-9]*"
|
|
84
90
|
}
|
|
@@ -87,25 +93,25 @@ var O = ({ closeAriaLabel: d, content: f, inputLabel: t, inputValue: i, isOpen:
|
|
|
87
93
|
value: i
|
|
88
94
|
})]
|
|
89
95
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ t(H, {
|
|
91
97
|
sx: {
|
|
92
98
|
justifyContent: "flex-end",
|
|
93
99
|
gap: 16,
|
|
94
100
|
p: 24,
|
|
95
101
|
">:not(style)~:not(style)": { ml: 0 }
|
|
96
102
|
},
|
|
97
|
-
children: [l && /* @__PURE__ */ o(
|
|
103
|
+
children: [l && /* @__PURE__ */ o(f, {
|
|
98
104
|
"aria-label": l,
|
|
99
|
-
color:
|
|
100
|
-
onClick:
|
|
105
|
+
color: v,
|
|
106
|
+
onClick: C,
|
|
101
107
|
children: l
|
|
102
|
-
}), /* @__PURE__ */ o(
|
|
103
|
-
"aria-label":
|
|
104
|
-
color:
|
|
105
|
-
disabled:
|
|
106
|
-
onClick:
|
|
108
|
+
}), /* @__PURE__ */ o(f, {
|
|
109
|
+
"aria-label": p,
|
|
110
|
+
color: D,
|
|
111
|
+
disabled: d,
|
|
112
|
+
onClick: s,
|
|
107
113
|
variant: "contained",
|
|
108
|
-
children:
|
|
114
|
+
children: p
|
|
109
115
|
})]
|
|
110
116
|
})
|
|
111
117
|
]
|
|
@@ -113,7 +119,7 @@ var O = ({ closeAriaLabel: d, content: f, inputLabel: t, inputValue: i, isOpen:
|
|
|
113
119
|
});
|
|
114
120
|
};
|
|
115
121
|
export {
|
|
116
|
-
|
|
122
|
+
U as default
|
|
117
123
|
};
|
|
118
124
|
|
|
119
125
|
//# sourceMappingURL=CurrencyDialog.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyDialog.es.js","names":[],"sources":["../../../src/common/components/CurrencyDialog.tsx"],"sourcesContent":["import { Icon } from '@mxenabled/mx-icons'\nimport { H3, P } from '@mxenabled/mxui'\n\nimport Button, { type ButtonProps } from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogActions from '@mui/material/DialogActions'\nimport DialogContent from '@mui/material/DialogContent'\nimport IconButton from '@mui/material/IconButton'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { useScreenSize } from '../hooks'\n\ninterface CurrencyDialogProps {\n closeAriaLabel: string\n content?: string\n inputLabel?: string\n inputValue?: string\n isOpen: boolean\n handleInputChange?: (value: string) => void\n handleModalClose: () => void\n handlePrimaryAction: () => void\n handleSecondaryAction?: () => void\n primaryColor?: ButtonProps['color']\n primaryText: string\n secondaryColor?: ButtonProps['color']\n secondaryText?: string\n title: string\n}\n\n// Created for V2 of BudgetDetailsDrawer.\n// The previous design will be replaced once the new design is finalized.\n// Also needs to be updated to use the mxui library\n// with the updated Dialog components.\n\nconst CurrencyDialog = ({\n closeAriaLabel,\n content,\n inputLabel,\n inputValue,\n isOpen,\n handleInputChange,\n handleModalClose,\n handlePrimaryAction,\n handleSecondaryAction,\n primaryColor = 'primary',\n primaryText,\n secondaryColor = 'primary',\n secondaryText,\n title,\n}: CurrencyDialogProps) => {\n const numericValue = parseFloat(inputValue ?? '0')\n const isValid = inputValue !== '' && inputValue !== '0' && !isNaN(numericValue)\n\n const { isSmallMobile } = useScreenSize()\n\n return (\n <Dialog\n aria-label={title}\n aria-labelledby=\"modal-title\"\n maxWidth=\"xs\"\n onClose={handleModalClose}\n open={isOpen}\n role=\"dialog\"\n sx={{\n '& .MuiDialogContent-root': { p: 0 },\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n }}\n >\n <DialogContent>\n <form\n onSubmit={(e) => {\n e.preventDefault()\n handlePrimaryAction()\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 12,\n pl: 24,\n position: 'relative',\n pr: 16,\n pt: 24,\n }}\n >\n <H3 id=\"modal-title\">{title}</H3>\n <IconButton\n aria-label={closeAriaLabel}\n onClick={handleModalClose}\n sx={{ minHeight: 24, position: 'absolute', right: 8, top: 18 }}\n >\n <Icon name=\"close\" sx={{ color: 'action.active' }} />\n </IconButton>\n </Stack>\n <Stack sx={{ gap: 24, px: 24 }}>\n <P variant=\"subtitle1\">{content}</P>\n {inputLabel && (\n <TextField\n autoFocus={true}\n inputMode=\"decimal\"\n label={inputLabel}\n onChange={({ target: { value } }) => {\n if (!/^\\d*\\.?\\d*$/.test(value)) return\n\n handleInputChange?.(value)\n }}\n slotProps={{\n input: {\n startAdornment: <InputAdornment position=\"start\">$</InputAdornment>,\n },\n htmlInput: {\n 'aria-label': inputLabel,\n noValidate: true,\n pattern: '[0-9]*\\\\.?[0-9]*',\n },\n }}\n type=\"text\"\n value={inputValue}\n />\n )}\n </Stack>\n <DialogActions\n sx={{\n justifyContent: 'flex-end',\n gap: 16,\n p: 24,\n '>:not(style)~:not(style)': { ml: 0 },\n }}\n >\n {secondaryText && (\n <Button\n aria-label={secondaryText}\n color={secondaryColor}\n onClick={handleSecondaryAction}\n >\n {secondaryText}\n </Button>\n )}\n <Button\n aria-label={primaryText}\n color={primaryColor}\n disabled={
|
|
1
|
+
{"version":3,"file":"CurrencyDialog.es.js","names":[],"sources":["../../../src/common/components/CurrencyDialog.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, P } from '@mxenabled/mxui'\n\nimport Button, { type ButtonProps } from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogActions from '@mui/material/DialogActions'\nimport DialogContent from '@mui/material/DialogContent'\nimport IconButton from '@mui/material/IconButton'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { useScreenSize } from '../hooks'\n\ninterface CurrencyDialogProps {\n closeAriaLabel: string\n /** Body copy; a node so callers can emphasise part of it (e.g. a bold account name). */\n content?: ReactNode\n /** Validation or save error, shown under the input and marking it invalid. */\n errorText?: string\n inputLabel?: string\n inputValue?: string\n isOpen: boolean\n /** Disables the primary button on top of the built-in input check (e.g. while saving). */\n isPrimaryDisabled?: boolean\n handleInputChange?: (value: string) => void\n handleModalClose: () => void\n handlePrimaryAction: () => void\n handleSecondaryAction?: () => void\n primaryColor?: ButtonProps['color']\n primaryText: string\n secondaryColor?: ButtonProps['color']\n secondaryText?: string\n /** A line under the title, e.g. the account a setting applies to. */\n subtitle?: ReactNode\n title: string\n}\n\n// Created for V2 of BudgetDetailsDrawer.\n// The previous design will be replaced once the new design is finalized.\n// Also needs to be updated to use the mxui library\n// with the updated Dialog components.\n\nconst CurrencyDialog = ({\n closeAriaLabel,\n content,\n errorText,\n inputLabel,\n inputValue,\n isOpen,\n isPrimaryDisabled = false,\n handleInputChange,\n handleModalClose,\n handlePrimaryAction,\n handleSecondaryAction,\n primaryColor = 'primary',\n primaryText,\n secondaryColor = 'primary',\n secondaryText,\n subtitle,\n title,\n}: CurrencyDialogProps) => {\n const numericValue = parseFloat(inputValue ?? '0')\n const isValid = inputValue !== '' && inputValue !== '0' && !isNaN(numericValue)\n // One rule for the button and for Enter: the form's submit must not bypass a disabled button.\n const isPrimaryBlocked = isPrimaryDisabled || (inputLabel ? !isValid : false)\n\n const { isSmallMobile } = useScreenSize()\n\n return (\n <Dialog\n aria-label={title}\n aria-labelledby=\"modal-title\"\n maxWidth=\"xs\"\n onClose={handleModalClose}\n open={isOpen}\n role=\"dialog\"\n sx={{\n '& .MuiDialogContent-root': { p: 0 },\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n }}\n >\n <DialogContent>\n <form\n onSubmit={(e) => {\n e.preventDefault()\n if (!isPrimaryBlocked) handlePrimaryAction()\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 12,\n pl: 24,\n position: 'relative',\n pr: 16,\n pt: 24,\n }}\n >\n <Stack sx={{ gap: 4 }}>\n <H3 id=\"modal-title\">{title}</H3>\n {subtitle}\n </Stack>\n <IconButton\n aria-label={closeAriaLabel}\n onClick={handleModalClose}\n sx={{ minHeight: 24, position: 'absolute', right: 8, top: 18 }}\n >\n <Icon name=\"close\" sx={{ color: 'action.active' }} />\n </IconButton>\n </Stack>\n <Stack sx={{ gap: 24, px: 24 }}>\n <P variant=\"subtitle1\">{content}</P>\n {inputLabel && (\n <TextField\n autoFocus={true}\n error={!!errorText}\n helperText={errorText}\n inputMode=\"decimal\"\n label={inputLabel}\n onChange={({ target: { value } }) => {\n if (!/^\\d*\\.?\\d*$/.test(value)) return\n\n handleInputChange?.(value)\n }}\n slotProps={{\n input: {\n startAdornment: <InputAdornment position=\"start\">$</InputAdornment>,\n },\n // Announce errors: focus is usually on the primary button when one appears.\n formHelperText: { role: 'alert' },\n htmlInput: {\n 'aria-label': inputLabel,\n noValidate: true,\n pattern: '[0-9]*\\\\.?[0-9]*',\n },\n }}\n type=\"text\"\n value={inputValue}\n />\n )}\n </Stack>\n <DialogActions\n sx={{\n justifyContent: 'flex-end',\n gap: 16,\n p: 24,\n '>:not(style)~:not(style)': { ml: 0 },\n }}\n >\n {secondaryText && (\n <Button\n aria-label={secondaryText}\n color={secondaryColor}\n onClick={handleSecondaryAction}\n >\n {secondaryText}\n </Button>\n )}\n <Button\n aria-label={primaryText}\n color={primaryColor}\n disabled={isPrimaryBlocked}\n onClick={handlePrimaryAction}\n variant=\"contained\"\n >\n {primaryText}\n </Button>\n </DialogActions>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport default CurrencyDialog\n"],"mappings":"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"}
|
|
@@ -9,6 +9,8 @@ export interface DialogProps extends Omit<MuiDialogProps, OwnedMuiProps> {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
copy: CopyObject;
|
|
11
11
|
disablePrimaryButton?: boolean;
|
|
12
|
+
/** Render the footer action buttons. Default true; content-only dialogs (e.g. the insights survey modal) pass false. */
|
|
13
|
+
showActions?: boolean;
|
|
12
14
|
isOpen: boolean;
|
|
13
15
|
onClose: (event?: unknown, reason?: string) => void;
|
|
14
16
|
onPrimaryAction?: () => void;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { useScreenSize as
|
|
2
|
-
import { useFocusReturn as
|
|
3
|
-
import
|
|
4
|
-
import { DialogFooter as
|
|
5
|
-
import { jsx as o, jsxs as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
var
|
|
9
|
-
const { sx: a, ...
|
|
10
|
-
|
|
11
|
-
},
|
|
1
|
+
import { useScreenSize as H } from "../../hooks/useScreenSize.es.js";
|
|
2
|
+
import { useFocusReturn as j } from "../../hooks/useFocusReturn.es.js";
|
|
3
|
+
import k from "react";
|
|
4
|
+
import { DialogFooter as v, DialogHeader as C } from "@mxenabled/mxui";
|
|
5
|
+
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
6
|
+
import W 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 = k.useId(), { isSmallMobile: P } = H(), { onExited: S, onFocus: A, rootRef: F } = j(e, p), M = () => {
|
|
10
|
+
m?.(), r();
|
|
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__ */
|
|
16
|
+
children: /* @__PURE__ */ I(W, {
|
|
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
|
-
...
|
|
23
|
+
...P && { "& .MuiDialog-paper": { minWidth: "100%" } },
|
|
24
24
|
height: "100%"
|
|
25
25
|
}, ...a ? [a] : []],
|
|
26
|
-
...
|
|
26
|
+
...D,
|
|
27
27
|
disableRestoreFocus: !0,
|
|
28
|
-
onFocus:
|
|
29
|
-
ref:
|
|
30
|
-
slotProps: { transition: { onExited:
|
|
28
|
+
onFocus: A,
|
|
29
|
+
ref: F,
|
|
30
|
+
slotProps: { transition: { onExited: S } },
|
|
31
31
|
children: [
|
|
32
|
-
/* @__PURE__ */ o(
|
|
32
|
+
/* @__PURE__ */ o(C, {
|
|
33
33
|
ariaHidden: !0,
|
|
34
34
|
copy: {
|
|
35
|
-
title:
|
|
36
|
-
close_aria:
|
|
35
|
+
title: b,
|
|
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(_, {
|
|
43
43
|
sx: { lineHeight: 1.5 },
|
|
44
|
-
children:
|
|
44
|
+
children: x
|
|
45
45
|
}),
|
|
46
|
-
/* @__PURE__ */ o(
|
|
46
|
+
c && /* @__PURE__ */ o(v, {
|
|
47
47
|
isPrimaryDisabled: n,
|
|
48
|
-
onPrimaryAction:
|
|
49
|
-
onSecondaryAction:
|
|
50
|
-
primaryColor:
|
|
51
|
-
primaryText:
|
|
52
|
-
secondaryColor:
|
|
53
|
-
secondaryText:
|
|
48
|
+
onPrimaryAction: M,
|
|
49
|
+
onSecondaryAction: R,
|
|
50
|
+
primaryColor: d,
|
|
51
|
+
primaryText: u,
|
|
52
|
+
secondaryColor: f,
|
|
53
|
+
secondaryText: g
|
|
54
54
|
})
|
|
55
55
|
]
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
export {
|
|
60
|
-
|
|
60
|
+
G as default
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
//# sourceMappingURL=Dialog.es.js.map
|
|
@@ -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 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 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 }}>{children}</DialogContent>\n\n <DialogFooter\n
|
|
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 }}>{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,IAAiB,WACjB,eAAA,IAAgB,UAChB,UAAA,GACA,GAAG,EAAA,MACC;AAEJ,QAAM,EAAE,IAAI,GAAQ,GAAG,EAAA,IAAc,GAC/B,IAAQ,GAAM,SAAS,IACvB,IAAY,GAAM,cAAc,SAIhC,IAAU,EAAM,MAAM,GAEtB,EAAE,eAAA,EAAA,IAAkB,EAAc,GAElC,EAAE,UAAA,GAAU,SAAA,GAAS,SAAA,EAAA,IAAY,EAAe,GAAQ,CAAa,GAErE,IAAA,MAA4B;AAChC,IAAA,IAAkB,GAClB,EAAQ;AAAA,EACV,GAEM,IAAA,MAA8B;AAClC,IAAI,KACF,EAAkB,GAEpB,EAAQ;AAAA,EACV;AAEA,SACE,gBAAA,EAAC,OAAD;AAAA,IAAK,WAAW,iBAAiB,CAAA;AAAA,IAC/B,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,mBAAiB;AAAA,MACjB,UAAS;AAAA,MACA,SAAA;AAAA,MACT,MAAM;AAAA,MACN,IACE,CACE;AAAA,QACE,iCAAiC,EAAE,iBAAiB,qBAAqB;AAAA,QACzE,GAAI,KAAiB,EAAE,sBAAsB,EAAE,UAAU,OAAO,EAAE;AAAA,QAClE,QAAQ;AAAA,MACV,GACA,GAAI,IAAS,CAAC,CAAM,IAAI,CAAC,CAC3B;AAAA,MAEF,GAAI;AAAA,MACJ,qBAAqB;AAAA,MACZ,SAAA;AAAA,MACT,KAAK;AAAA,MACL,WAAW,EAAE,YAAY,EAAE,UAAA,EAAS,EAAE;AAAA,MAnBxC,UAAA;AAAA,QAqBE,gBAAA,EAAC,GAAD;AAAA,UACE,YAAY;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,EAAE,YAAY,IAAI;AAAA,UAAI,UAAA;AAAA,QAAwB,CAAA;AAAA,QAEhE,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"}
|
|
@@ -10,6 +10,7 @@ export { default as MicroWidgetContainer } from './MicroWidgetContainer';
|
|
|
10
10
|
export { default as MiniWidgetContainer } from './MiniWidgetContainer';
|
|
11
11
|
export { WidgetContainer } from './WidgetContainer';
|
|
12
12
|
export { default as ConnectDrawer } from './ConnectDrawer';
|
|
13
|
+
export { default as ConnectWidgetPanel, type ConnectWidgetPanelProps } from './ConnectWidgetPanel';
|
|
13
14
|
export { default as CurrencyDialog } from './CurrencyDialog';
|
|
14
15
|
export { default as CurrencyInput } from './CurrencyInput';
|
|
15
16
|
export { default as Loader } from './Loader';
|