@xfers/design-system 8.1.1-dev.a00bad6994 → 8.1.1-dev.ca3af7627f
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.
|
@@ -17,7 +17,7 @@ const Toast = ({ tone = 'positive', message, showIcon = true, className, }) => {
|
|
|
17
17
|
const textColor = (0, Toast_styles_1.getToastTextColor)(tone);
|
|
18
18
|
return (react_1.default.createElement(Toast_styles_1.StyledToast, { tone: tone, className: className, role: tone === 'critical' ? 'alert' : 'status', "aria-live": tone === 'critical' ? 'assertive' : 'polite' },
|
|
19
19
|
showIcon && (react_1.default.createElement(Toast_styles_1.ToastIconContainer, { "aria-hidden": "true" },
|
|
20
|
-
react_1.default.createElement(MaterialSymbols_1.default, { icon: TONE_ICON[tone], size: "s", fill:
|
|
20
|
+
react_1.default.createElement(MaterialSymbols_1.default, { icon: TONE_ICON[tone], size: "s", fill: 0, color: textColor }))),
|
|
21
21
|
react_1.default.createElement(Typography_1.Typography.Body, { size: "md", color: textColor, style: { whiteSpace: 'nowrap' } }, message)));
|
|
22
22
|
};
|
|
23
23
|
exports.default = Toast;
|
|
@@ -8,7 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const antd_1 = require("antd");
|
|
9
9
|
const Toast_1 = __importDefault(require("./Toast"));
|
|
10
10
|
const Toast_styles_1 = require("./Toast.styles");
|
|
11
|
-
// Only one toast is shown at a time
|
|
11
|
+
// Only one toast is shown at a time: every call shares this key so a new
|
|
12
12
|
// toast replaces whatever is currently showing, instead of stacking.
|
|
13
13
|
const SHARED_KEY = 'fds3-toast';
|
|
14
14
|
const DEFAULT_DURATION = 5;
|
|
@@ -28,10 +28,10 @@ const injectOverrideStyles = () => {
|
|
|
28
28
|
document.head.appendChild(style);
|
|
29
29
|
};
|
|
30
30
|
// antd does not restart a message's auto-close timer when open() is called
|
|
31
|
-
// again with the same key
|
|
32
|
-
// the
|
|
33
|
-
//
|
|
34
|
-
//
|
|
31
|
+
// again with the same key; it only swaps the content in place. So that every
|
|
32
|
+
// trigger resets the dismiss countdown (repeated triggers keep the toast
|
|
33
|
+
// visible), we disable antd's own timer (duration: 0) and drive dismissal
|
|
34
|
+
// ourselves, clearing and restarting it on every call.
|
|
35
35
|
let dismissTimer;
|
|
36
36
|
// Incrementing this on every call and using it as Toast's React key forces a
|
|
37
37
|
// remount each time, so the entrance animation replays even when the same
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showToast.js","sourceRoot":"","sources":["../../../src/components/Toast/showToast.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+BAA8B;AAE9B,oDAA2B;AAE3B,iDAGuB;AAEvB,
|
|
1
|
+
{"version":3,"file":"showToast.js","sourceRoot":"","sources":["../../../src/components/Toast/showToast.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+BAA8B;AAE9B,oDAA2B;AAE3B,iDAGuB;AAEvB,yEAAyE;AACzE,qEAAqE;AACrE,MAAM,UAAU,GAAG,YAAY,CAAA;AAE/B,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAC1B,MAAM,YAAY,GAAG,CAAC,CAAA;AACtB,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAU,EAAE,CACjD,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE1D,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,iDAAiD;AACjD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,IAAI,QAAQ,CAAC,cAAc,CAAC,sCAAuB,CAAC;QAAE,OAAM;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC7C,KAAK,CAAC,EAAE,GAAG,sCAAuB,CAAA;IAClC,KAAK,CAAC,WAAW,GAAG,y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/es/index.js
CHANGED
|
@@ -1124,7 +1124,7 @@ padding-top:
|
|
|
1124
1124
|
`,_f=jn.div`
|
|
1125
1125
|
display: flex;
|
|
1126
1126
|
flex-shrink: 0;
|
|
1127
|
-
`,wf="fds3-toast-message",kf=`\n .ant-message-notice.${wf} {\n background: transparent;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n margin-top: 16px;\n }\n`,Ef={positive:"check_circle",warning:"warning",critical:"error",info:"info"},Sf=({tone:t="positive",message:e,showIcon:n=!0,className:i})=>{const o=(t=>yf[t])(t);return et.createElement(vf,{tone:t,className:i,role:"critical"===t?"alert":"status","aria-live":"critical"===t?"assertive":"polite"},n&&et.createElement(_f,{"aria-hidden":"true"},et.createElement(Xh,{icon:Ef[t],size:"s",fill:
|
|
1127
|
+
`,wf="fds3-toast-message",kf=`\n .ant-message-notice.${wf} {\n background: transparent;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n margin-top: 16px;\n }\n`,Ef={positive:"check_circle",warning:"warning",critical:"error",info:"info"},Sf=({tone:t="positive",message:e,showIcon:n=!0,className:i})=>{const o=(t=>yf[t])(t);return et.createElement(vf,{tone:t,className:i,role:"critical"===t?"alert":"status","aria-live":"critical"===t?"assertive":"polite"},n&&et.createElement(_f,{"aria-hidden":"true"},et.createElement(Xh,{icon:Ef[t],size:"s",fill:0,color:o})),et.createElement(rn.Body,{size:"md",color:o,style:{whiteSpace:"nowrap"}},e))},Mf="fds3-toast";let Df,Cf=0;const Of=(t,e,n)=>{(()=>{if(document.getElementById(wf))return;const t=document.createElement("style");t.id=wf,t.textContent=kf,document.head.appendChild(t)})();const i=void 0!==(null==n?void 0:n.duration)?(t=>Math.min(7,Math.max(3,t)))(n.duration):5;return Df&&clearTimeout(Df),Df=setTimeout(()=>{Tt.destroy(Mf),Df=void 0},1e3*i),Cf+=1,Tt.open({content:et.createElement(Sf,{key:Cf,tone:t,message:e,showIcon:null==n?void 0:n.showIcon}),duration:0,key:Mf,icon:et.createElement(et.Fragment,null),className:wf})},$f={Title:jn(no)`
|
|
1128
1128
|
color: #1b2736;
|
|
1129
1129
|
margin-bottom: 5px;
|
|
1130
1130
|
`,Subtitle:jn(io)`
|