@itwin/core-react 4.17.3 → 4.17.5
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 +11 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.js +41 -29
- package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.scss +3 -6
- package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.js +41 -29
- package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.scss +3 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Log - @itwin/core-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 14 Nov 2024 08:22:04 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.17.5
|
|
6
|
+
Thu, 14 Nov 2024 08:22:04 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.17.4
|
|
11
|
+
Fri, 08 Nov 2024 14:41:23 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
4
14
|
|
|
5
15
|
## 4.17.3
|
|
6
16
|
Wed, 06 Nov 2024 09:04:20 GMT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBox.d.ts","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB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,CAAC,aAAa,CAAC;IACnC,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAClE,OAAc,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,CAKlD;IAEc,MAAM,IAAI,KAAK,CAAC,YAAY;CAuB7C;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,QAAQ,EAAE,eAAe,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC9E;;OAEG;WACW,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IACjE;;;;OAIG;WACW,gBAAgB,CAC5B,QAAQ,EAAE,eAAe,EAEzB,MAAM,CAAC,EAAE,OAAO,GACf,MAAM;IAmCT;;;;OAIG;WAGW,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ;IAK5D,MAAM,IAAI,KAAK,CAAC,YAAY;CA+B7C"}
|
|
@@ -13,7 +13,7 @@ const classnames_1 = require("classnames");
|
|
|
13
13
|
const React = require("react");
|
|
14
14
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
15
15
|
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
16
|
-
const
|
|
16
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
17
17
|
const Dialog_1 = require("../dialog/Dialog");
|
|
18
18
|
/** Message Box React component.
|
|
19
19
|
* @public
|
|
@@ -71,40 +71,52 @@ class MessageContainer extends React.PureComponent {
|
|
|
71
71
|
*/
|
|
72
72
|
/* ignore for unit tests and replace with visual testing */
|
|
73
73
|
static getIcon(severity, hollow) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case appui_abstract_1.MessageSeverity.None:
|
|
77
|
-
iconSpec = "";
|
|
78
|
-
break;
|
|
79
|
-
case appui_abstract_1.MessageSeverity.Success:
|
|
80
|
-
iconSpec = hollow ? React.createElement(itwinui_icons_react_1.SvgStatusSuccessHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusSuccess, null);
|
|
81
|
-
break;
|
|
82
|
-
case appui_abstract_1.MessageSeverity.Information:
|
|
83
|
-
iconSpec = hollow ? React.createElement(itwinui_icons_react_1.SvgInfoCircularHollow, null) : React.createElement(itwinui_icons_react_1.SvgInfoCircular, null);
|
|
84
|
-
break;
|
|
85
|
-
case appui_abstract_1.MessageSeverity.Question:
|
|
86
|
-
iconSpec = hollow ? React.createElement(itwinui_icons_react_1.SvgHelpCircularHollow, null) : React.createElement(itwinui_icons_react_1.SvgHelpCircular, null);
|
|
87
|
-
break;
|
|
88
|
-
case appui_abstract_1.MessageSeverity.Warning:
|
|
89
|
-
iconSpec = React.createElement(itwinui_icons_react_1.SvgStatusWarning, null); // TODO - need icon-status-warning-hollow icon
|
|
90
|
-
break;
|
|
91
|
-
case appui_abstract_1.MessageSeverity.Error:
|
|
92
|
-
iconSpec = hollow ? React.createElement(itwinui_icons_react_1.SvgStatusErrorHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusError, null);
|
|
93
|
-
break;
|
|
94
|
-
case appui_abstract_1.MessageSeverity.Fatal:
|
|
95
|
-
iconSpec = hollow ? React.createElement(itwinui_icons_react_1.SvgStatusRejectedHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusRejected, null);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
return iconSpec;
|
|
74
|
+
const icon = getIcon(severity, hollow);
|
|
75
|
+
return icon ?? "";
|
|
99
76
|
}
|
|
100
77
|
render() {
|
|
101
78
|
const iconClassName = (0, classnames_1.default)("icon", "core-message-box-icon", MessageContainer.getIconClassName(this.props.severity));
|
|
102
|
-
const
|
|
79
|
+
const icon = getIcon(this.props.severity);
|
|
103
80
|
return (React.createElement("div", { className: "core-message-box-container" },
|
|
104
|
-
React.createElement(
|
|
105
|
-
React.createElement(IconComponent_1.Icon, { iconSpec: iconSpec })),
|
|
81
|
+
icon ? (React.createElement(itwinui_react_1.Icon, { className: iconClassName, size: "large", fill: toFill(this.props.severity) }, icon)) : undefined,
|
|
106
82
|
React.createElement("div", { className: (0, classnames_1.default)("core-message-box-content", this.props.className), style: this.props.style }, this.props.children)));
|
|
107
83
|
}
|
|
108
84
|
}
|
|
109
85
|
exports.MessageContainer = MessageContainer;
|
|
86
|
+
function getIcon(severity, hollow) {
|
|
87
|
+
switch (severity) {
|
|
88
|
+
case appui_abstract_1.MessageSeverity.None:
|
|
89
|
+
return undefined;
|
|
90
|
+
case appui_abstract_1.MessageSeverity.Success:
|
|
91
|
+
return hollow ? React.createElement(itwinui_icons_react_1.SvgStatusSuccessHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusSuccess, null);
|
|
92
|
+
case appui_abstract_1.MessageSeverity.Information:
|
|
93
|
+
return hollow ? React.createElement(itwinui_icons_react_1.SvgInfoCircularHollow, null) : React.createElement(itwinui_icons_react_1.SvgInfoCircular, null);
|
|
94
|
+
case appui_abstract_1.MessageSeverity.Question:
|
|
95
|
+
return hollow ? React.createElement(itwinui_icons_react_1.SvgHelpCircularHollow, null) : React.createElement(itwinui_icons_react_1.SvgHelpCircular, null);
|
|
96
|
+
case appui_abstract_1.MessageSeverity.Warning:
|
|
97
|
+
return React.createElement(itwinui_icons_react_1.SvgStatusWarning, null); // TODO - need icon-status-warning-hollow icon
|
|
98
|
+
case appui_abstract_1.MessageSeverity.Error:
|
|
99
|
+
return hollow ? React.createElement(itwinui_icons_react_1.SvgStatusErrorHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusError, null);
|
|
100
|
+
break;
|
|
101
|
+
case appui_abstract_1.MessageSeverity.Fatal:
|
|
102
|
+
return hollow ? React.createElement(itwinui_icons_react_1.SvgStatusRejectedHollow, null) : React.createElement(itwinui_icons_react_1.SvgStatusRejected, null);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function toFill(severity) {
|
|
106
|
+
switch (severity) {
|
|
107
|
+
case appui_abstract_1.MessageSeverity.None:
|
|
108
|
+
return undefined;
|
|
109
|
+
case appui_abstract_1.MessageSeverity.Success:
|
|
110
|
+
return "positive";
|
|
111
|
+
case appui_abstract_1.MessageSeverity.Information:
|
|
112
|
+
case appui_abstract_1.MessageSeverity.Question:
|
|
113
|
+
return "informational";
|
|
114
|
+
case appui_abstract_1.MessageSeverity.Warning:
|
|
115
|
+
return "warning";
|
|
116
|
+
case appui_abstract_1.MessageSeverity.Error:
|
|
117
|
+
case appui_abstract_1.MessageSeverity.Fatal:
|
|
118
|
+
return "negative";
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
110
122
|
//# sourceMappingURL=MessageBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBox.js","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6BAA2B;AAC3B,2CAAoC;AACpC,+BAA+B;AAE/B,0DAAwD;AAExD,oEAYoC;AAEpC,0DAA8C;AAC9C,6CAA0C;AA6C1C;;;GAGG;AACH,MAAa,UAAW,SAAQ,KAAK,CAAC,aAA8B;IAQlD,MAAM;QACpB,OAAO,CACL,oBAAC,eAAM,IACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EACvC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAE,IAAI,CAAC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D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEe,MAAM;QACpB,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,MAAM,EACN,uBAAuB,EACvB,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CACvD,CAAC;QAEF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/D,OAAO,CACL,6BAAK,SAAS,EAAC,4BAA4B;YACzC,6BAAK,SAAS,EAAE,aAAa;gBAC3B,oBAAC,oBAAI,IAAC,QAAQ,EAAE,QAAQ,GAAI,CACxB;YACN,6BACE,SAAS,EAAE,IAAA,oBAAU,EACnB,0BAA0B,EAC1B,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAEtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACF,CACP,CAAC;IACJ,CAAC;CACF;AA7GD,4CA6GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./MessageBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { MessageSeverity } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport {\n SvgHelpCircular,\n SvgHelpCircularHollow,\n SvgInfoCircular,\n SvgInfoCircularHollow,\n SvgStatusError,\n SvgStatusErrorHollow,\n SvgStatusRejected,\n SvgStatusRejectedHollow,\n SvgStatusSuccess,\n SvgStatusSuccessHollow,\n SvgStatusWarning,\n} from \"@itwin/itwinui-icons-react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { Dialog } from \"../dialog/Dialog\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Properties for the [[MessageBox]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageBox} component.\n */\nexport interface MessageBoxProps extends CommonProps {\n /** Severity of MessageBox */\n severity: MessageSeverity;\n /** whether to show dialog or not */\n opened: boolean;\n /** List of [[DialogButtonDef]] objects specifying buttons and associated onClick events */\n buttonCluster: DialogButtonDef[];\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for <Esc> key */\n onEscape?: () => void;\n /** minimum width that the dialog may be resized to. Default: 400 */\n minWidth?: number;\n /** minimum height that the dialog may be resized to. Default: 400 */\n minHeight?: number;\n /** initial width of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"50%\"\n */\n width?: string | number;\n /** initial height of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"\"\n */\n height?: string | number;\n /** Whether to show background overlay. Default: true */\n modal?: boolean;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n /** Message content */\n children?: React.ReactNode;\n}\n\n/** Message Box React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageBox extends React.PureComponent<MessageBoxProps> {\n public static defaultProps: Partial<MessageBoxProps> = {\n minWidth: 400,\n minHeight: 400,\n width: \"512px\",\n modal: true,\n };\n\n public override render(): React.ReactElement {\n return (\n <Dialog\n title={this.props.title}\n buttonCluster={this.props.buttonCluster}\n opened={this.props.opened}\n onClose={this.props.onClose}\n onEscape={this.props.onEscape}\n modal={this.props.modal}\n className={this.props.className}\n style={this.props.style}\n width={this.props.width}\n >\n <MessageContainer\n severity={this.props.severity}\n className={this.props.contentClassName}\n style={this.props.contentStyle}\n >\n {this.props.children}\n </MessageContainer>\n </Dialog>\n );\n }\n}\n\n/** Properties for the [[MessageContainer]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageContainer} component.\n */\nexport interface MessageContainerProps extends CommonProps {\n severity: MessageSeverity;\n /** Message Content */\n children?: React.ReactNode;\n}\n\n/** Message Container React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageContainer extends React.PureComponent<MessageContainerProps> {\n /** Returns the class name corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n */\n public static getIconClassName(severity: MessageSeverity): string;\n /** Returns the class name associated with the WebFont icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow Should the icon be hollow\n * @deprecated in 4.0.0. Hollow parameter ignored, WebFont is not returned, only the color.\n */\n public static getIconClassName(\n severity: MessageSeverity,\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n hollow?: boolean\n ): string;\n\n public static getIconClassName(\n severity: MessageSeverity,\n _hollow?: boolean\n ): string {\n let iconClassName = \"\";\n\n switch (severity) {\n case MessageSeverity.None:\n iconClassName = \"\";\n break;\n case MessageSeverity.Success:\n iconClassName = \"core-message-box-success\";\n break;\n case MessageSeverity.Information:\n iconClassName = \"core-message-box-information\";\n break;\n case MessageSeverity.Question:\n iconClassName = \"core-message-box-question\";\n break;\n case MessageSeverity.Warning:\n iconClassName = \"core-message-box-warning\";\n break;\n case MessageSeverity.Error:\n iconClassName = \"core-message-box-error\";\n break;\n case MessageSeverity.Fatal:\n iconClassName = \"core-message-box-fatal\";\n break;\n }\n\n return iconClassName;\n }\n\n /** Returns the React icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow set to true to return the hollow form of the icon.\n * @returns IconSpec\n */\n /* ignore for unit tests and replace with visual testing */\n\n public static getIcon(severity: MessageSeverity, hollow?: boolean): IconSpec {\n let iconSpec: IconSpec = \"\";\n switch (severity) {\n case MessageSeverity.None:\n iconSpec = \"\";\n break;\n case MessageSeverity.Success:\n iconSpec = hollow ? <SvgStatusSuccessHollow /> : <SvgStatusSuccess />;\n break;\n case MessageSeverity.Information:\n iconSpec = hollow ? <SvgInfoCircularHollow /> : <SvgInfoCircular />;\n break;\n case MessageSeverity.Question:\n iconSpec = hollow ? <SvgHelpCircularHollow /> : <SvgHelpCircular />;\n break;\n case MessageSeverity.Warning:\n iconSpec = <SvgStatusWarning />; // TODO - need icon-status-warning-hollow icon\n break;\n case MessageSeverity.Error:\n iconSpec = hollow ? <SvgStatusErrorHollow /> : <SvgStatusError />;\n break;\n case MessageSeverity.Fatal:\n iconSpec = hollow ? <SvgStatusRejectedHollow /> : <SvgStatusRejected />;\n break;\n }\n return iconSpec;\n }\n\n public override render(): React.ReactElement {\n const iconClassName = classnames(\n \"icon\",\n \"core-message-box-icon\",\n MessageContainer.getIconClassName(this.props.severity)\n );\n\n const iconSpec = MessageContainer.getIcon(this.props.severity);\n return (\n <div className=\"core-message-box-container\">\n <div className={iconClassName}>\n <Icon iconSpec={iconSpec} />\n </div>\n <div\n className={classnames(\n \"core-message-box-content\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.props.children}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MessageBox.js","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6BAA2B;AAC3B,2CAAoC;AACpC,+BAA+B;AAE/B,0DAAwD;AAExD,oEAYoC;AACpC,wDAA4C;AAE5C,6CAA0C;AA6C1C;;;GAGG;AACH,MAAa,UAAW,SAAQ,KAAK,CAAC,aAA8B;IAQlD,MAAM;QACpB,OAAO,CACL,oBAAC,eAAM,IACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EACvC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,M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,KAAK,gCAAe,CAAC,KAAK;YACxB,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./MessageBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { MessageSeverity } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport {\n SvgHelpCircular,\n SvgHelpCircularHollow,\n SvgInfoCircular,\n SvgInfoCircularHollow,\n SvgStatusError,\n SvgStatusErrorHollow,\n SvgStatusRejected,\n SvgStatusRejectedHollow,\n SvgStatusSuccess,\n SvgStatusSuccessHollow,\n SvgStatusWarning,\n} from \"@itwin/itwinui-icons-react\";\nimport { Icon } from \"@itwin/itwinui-react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Dialog } from \"../dialog/Dialog\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Properties for the [[MessageBox]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageBox} component.\n */\nexport interface MessageBoxProps extends CommonProps {\n /** Severity of MessageBox */\n severity: MessageSeverity;\n /** whether to show dialog or not */\n opened: boolean;\n /** List of [[DialogButtonDef]] objects specifying buttons and associated onClick events */\n buttonCluster: DialogButtonDef[];\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for <Esc> key */\n onEscape?: () => void;\n /** minimum width that the dialog may be resized to. Default: 400 */\n minWidth?: number;\n /** minimum height that the dialog may be resized to. Default: 400 */\n minHeight?: number;\n /** initial width of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"50%\"\n */\n width?: string | number;\n /** initial height of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"\"\n */\n height?: string | number;\n /** Whether to show background overlay. Default: true */\n modal?: boolean;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n /** Message content */\n children?: React.ReactNode;\n}\n\n/** Message Box React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageBox extends React.PureComponent<MessageBoxProps> {\n public static defaultProps: Partial<MessageBoxProps> = {\n minWidth: 400,\n minHeight: 400,\n width: \"512px\",\n modal: true,\n };\n\n public override render(): React.ReactElement {\n return (\n <Dialog\n title={this.props.title}\n buttonCluster={this.props.buttonCluster}\n opened={this.props.opened}\n onClose={this.props.onClose}\n onEscape={this.props.onEscape}\n modal={this.props.modal}\n className={this.props.className}\n style={this.props.style}\n width={this.props.width}\n >\n <MessageContainer\n severity={this.props.severity}\n className={this.props.contentClassName}\n style={this.props.contentStyle}\n >\n {this.props.children}\n </MessageContainer>\n </Dialog>\n );\n }\n}\n\n/** Properties for the [[MessageContainer]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageContainer} component.\n */\nexport interface MessageContainerProps extends CommonProps {\n severity: MessageSeverity;\n /** Message Content */\n children?: React.ReactNode;\n}\n\n/** Message Container React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageContainer extends React.PureComponent<MessageContainerProps> {\n /** Returns the class name corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n */\n public static getIconClassName(severity: MessageSeverity): string;\n /** Returns the class name associated with the WebFont icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow Should the icon be hollow\n * @deprecated in 4.0.0. Hollow parameter ignored, WebFont is not returned, only the color.\n */\n public static getIconClassName(\n severity: MessageSeverity,\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n hollow?: boolean\n ): string;\n\n public static getIconClassName(\n severity: MessageSeverity,\n _hollow?: boolean\n ): string {\n let iconClassName = \"\";\n\n switch (severity) {\n case MessageSeverity.None:\n iconClassName = \"\";\n break;\n case MessageSeverity.Success:\n iconClassName = \"core-message-box-success\";\n break;\n case MessageSeverity.Information:\n iconClassName = \"core-message-box-information\";\n break;\n case MessageSeverity.Question:\n iconClassName = \"core-message-box-question\";\n break;\n case MessageSeverity.Warning:\n iconClassName = \"core-message-box-warning\";\n break;\n case MessageSeverity.Error:\n iconClassName = \"core-message-box-error\";\n break;\n case MessageSeverity.Fatal:\n iconClassName = \"core-message-box-fatal\";\n break;\n }\n\n return iconClassName;\n }\n\n /** Returns the React icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow set to true to return the hollow form of the icon.\n * @returns IconSpec\n */\n /* ignore for unit tests and replace with visual testing */\n\n public static getIcon(severity: MessageSeverity, hollow?: boolean): IconSpec {\n const icon = getIcon(severity, hollow);\n return icon ?? \"\";\n }\n\n public override render(): React.ReactElement {\n const iconClassName = classnames(\n \"icon\",\n \"core-message-box-icon\",\n MessageContainer.getIconClassName(this.props.severity)\n );\n\n const icon = getIcon(this.props.severity);\n return (\n <div className=\"core-message-box-container\">\n {icon ? (\n <Icon\n className={iconClassName}\n size=\"large\"\n fill={toFill(this.props.severity)}\n >\n {icon}\n </Icon>\n ) : undefined}\n <div\n className={classnames(\n \"core-message-box-content\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.props.children}\n </div>\n </div>\n );\n }\n}\n\nfunction getIcon(\n severity: MessageSeverity,\n hollow?: boolean\n): React.ReactElement | undefined {\n switch (severity) {\n case MessageSeverity.None:\n return undefined;\n case MessageSeverity.Success:\n return hollow ? <SvgStatusSuccessHollow /> : <SvgStatusSuccess />;\n case MessageSeverity.Information:\n return hollow ? <SvgInfoCircularHollow /> : <SvgInfoCircular />;\n case MessageSeverity.Question:\n return hollow ? <SvgHelpCircularHollow /> : <SvgHelpCircular />;\n case MessageSeverity.Warning:\n return <SvgStatusWarning />; // TODO - need icon-status-warning-hollow icon\n case MessageSeverity.Error:\n return hollow ? <SvgStatusErrorHollow /> : <SvgStatusError />;\n break;\n case MessageSeverity.Fatal:\n return hollow ? <SvgStatusRejectedHollow /> : <SvgStatusRejected />;\n }\n}\n\ntype IconProps = React.ComponentProps<typeof Icon>;\n\nfunction toFill(severity: MessageSeverity): IconProps[\"fill\"] {\n switch (severity) {\n case MessageSeverity.None:\n return undefined;\n case MessageSeverity.Success:\n return \"positive\";\n case MessageSeverity.Information:\n case MessageSeverity.Question:\n return \"informational\";\n case MessageSeverity.Warning:\n return \"warning\";\n case MessageSeverity.Error:\n case MessageSeverity.Fatal:\n return \"negative\";\n }\n return undefined;\n}\n"]}
|
|
@@ -9,19 +9,16 @@
|
|
|
9
9
|
.core-message-box-container {
|
|
10
10
|
display: flex;
|
|
11
11
|
color: var(--iui-color-text);
|
|
12
|
+
gap: var(--iui-size-m);
|
|
12
13
|
|
|
13
14
|
.core-message-box-icon {
|
|
14
|
-
flex: 0 0;
|
|
15
15
|
font-size: $uicore-icons-medium;
|
|
16
|
-
padding: 0 $uicore-unbordered-padding $uicore-unbordered-padding
|
|
17
|
-
$uicore-unbordered-padding;
|
|
18
|
-
margin-top: 10px;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
.core-message-box-content {
|
|
22
19
|
display: flex;
|
|
23
|
-
|
|
24
|
-
flex:
|
|
20
|
+
flex: 1;
|
|
21
|
+
flex-direction: column;
|
|
25
22
|
|
|
26
23
|
a {
|
|
27
24
|
// iTwinUI anchor link style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBox.d.ts","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAA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CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAClE,OAAc,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,CAKlD;IAEc,MAAM,IAAI,KAAK,CAAC,YAAY;CAuB7C;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,QAAQ,EAAE,eAAe,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC9E;;OAEG;WACW,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IACjE;;;;OAIG;WACW,gBAAgB,CAC5B,QAAQ,EAAE,eAAe,EAEzB,MAAM,CAAC,EAAE,OAAO,GACf,MAAM;IAmCT;;;;OAIG;WAGW,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ;IAK5D,MAAM,IAAI,KAAK,CAAC,YAAY;CA+B7C"}
|
|
@@ -10,7 +10,7 @@ import classnames from "classnames";
|
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { MessageSeverity } from "@itwin/appui-abstract";
|
|
12
12
|
import { SvgHelpCircular, SvgHelpCircularHollow, SvgInfoCircular, SvgInfoCircularHollow, SvgStatusError, SvgStatusErrorHollow, SvgStatusRejected, SvgStatusRejectedHollow, SvgStatusSuccess, SvgStatusSuccessHollow, SvgStatusWarning, } from "@itwin/itwinui-icons-react";
|
|
13
|
-
import { Icon } from "
|
|
13
|
+
import { Icon } from "@itwin/itwinui-react";
|
|
14
14
|
import { Dialog } from "../dialog/Dialog";
|
|
15
15
|
/** Message Box React component.
|
|
16
16
|
* @public
|
|
@@ -67,39 +67,51 @@ export class MessageContainer extends React.PureComponent {
|
|
|
67
67
|
*/
|
|
68
68
|
/* ignore for unit tests and replace with visual testing */
|
|
69
69
|
static getIcon(severity, hollow) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
case MessageSeverity.None:
|
|
73
|
-
iconSpec = "";
|
|
74
|
-
break;
|
|
75
|
-
case MessageSeverity.Success:
|
|
76
|
-
iconSpec = hollow ? React.createElement(SvgStatusSuccessHollow, null) : React.createElement(SvgStatusSuccess, null);
|
|
77
|
-
break;
|
|
78
|
-
case MessageSeverity.Information:
|
|
79
|
-
iconSpec = hollow ? React.createElement(SvgInfoCircularHollow, null) : React.createElement(SvgInfoCircular, null);
|
|
80
|
-
break;
|
|
81
|
-
case MessageSeverity.Question:
|
|
82
|
-
iconSpec = hollow ? React.createElement(SvgHelpCircularHollow, null) : React.createElement(SvgHelpCircular, null);
|
|
83
|
-
break;
|
|
84
|
-
case MessageSeverity.Warning:
|
|
85
|
-
iconSpec = React.createElement(SvgStatusWarning, null); // TODO - need icon-status-warning-hollow icon
|
|
86
|
-
break;
|
|
87
|
-
case MessageSeverity.Error:
|
|
88
|
-
iconSpec = hollow ? React.createElement(SvgStatusErrorHollow, null) : React.createElement(SvgStatusError, null);
|
|
89
|
-
break;
|
|
90
|
-
case MessageSeverity.Fatal:
|
|
91
|
-
iconSpec = hollow ? React.createElement(SvgStatusRejectedHollow, null) : React.createElement(SvgStatusRejected, null);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
return iconSpec;
|
|
70
|
+
const icon = getIcon(severity, hollow);
|
|
71
|
+
return icon ?? "";
|
|
95
72
|
}
|
|
96
73
|
render() {
|
|
97
74
|
const iconClassName = classnames("icon", "core-message-box-icon", MessageContainer.getIconClassName(this.props.severity));
|
|
98
|
-
const
|
|
75
|
+
const icon = getIcon(this.props.severity);
|
|
99
76
|
return (React.createElement("div", { className: "core-message-box-container" },
|
|
100
|
-
React.createElement(
|
|
101
|
-
React.createElement(Icon, { iconSpec: iconSpec })),
|
|
77
|
+
icon ? (React.createElement(Icon, { className: iconClassName, size: "large", fill: toFill(this.props.severity) }, icon)) : undefined,
|
|
102
78
|
React.createElement("div", { className: classnames("core-message-box-content", this.props.className), style: this.props.style }, this.props.children)));
|
|
103
79
|
}
|
|
104
80
|
}
|
|
81
|
+
function getIcon(severity, hollow) {
|
|
82
|
+
switch (severity) {
|
|
83
|
+
case MessageSeverity.None:
|
|
84
|
+
return undefined;
|
|
85
|
+
case MessageSeverity.Success:
|
|
86
|
+
return hollow ? React.createElement(SvgStatusSuccessHollow, null) : React.createElement(SvgStatusSuccess, null);
|
|
87
|
+
case MessageSeverity.Information:
|
|
88
|
+
return hollow ? React.createElement(SvgInfoCircularHollow, null) : React.createElement(SvgInfoCircular, null);
|
|
89
|
+
case MessageSeverity.Question:
|
|
90
|
+
return hollow ? React.createElement(SvgHelpCircularHollow, null) : React.createElement(SvgHelpCircular, null);
|
|
91
|
+
case MessageSeverity.Warning:
|
|
92
|
+
return React.createElement(SvgStatusWarning, null); // TODO - need icon-status-warning-hollow icon
|
|
93
|
+
case MessageSeverity.Error:
|
|
94
|
+
return hollow ? React.createElement(SvgStatusErrorHollow, null) : React.createElement(SvgStatusError, null);
|
|
95
|
+
break;
|
|
96
|
+
case MessageSeverity.Fatal:
|
|
97
|
+
return hollow ? React.createElement(SvgStatusRejectedHollow, null) : React.createElement(SvgStatusRejected, null);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function toFill(severity) {
|
|
101
|
+
switch (severity) {
|
|
102
|
+
case MessageSeverity.None:
|
|
103
|
+
return undefined;
|
|
104
|
+
case MessageSeverity.Success:
|
|
105
|
+
return "positive";
|
|
106
|
+
case MessageSeverity.Information:
|
|
107
|
+
case MessageSeverity.Question:
|
|
108
|
+
return "informational";
|
|
109
|
+
case MessageSeverity.Warning:
|
|
110
|
+
return "warning";
|
|
111
|
+
case MessageSeverity.Error:
|
|
112
|
+
case MessageSeverity.Fatal:
|
|
113
|
+
return "negative";
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
105
117
|
//# sourceMappingURL=MessageBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBox.js","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA6C1C;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,aAA8B;IAQlD,MAAM;QACpB,OAAO,CACL,oBAAC,MAAM,IACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EACvC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC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AC9B,MAAM,EACN,uBAAuB,EACvB,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CACvD,CAAC;QAEF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/D,OAAO,CACL,6BAAK,SAAS,EAAC,4BAA4B;YACzC,6BAAK,SAAS,EAAE,aAAa;gBAC3B,oBAAC,IAAI,IAAC,QAAQ,EAAE,QAAQ,GAAI,CACxB;YACN,6BACE,SAAS,EAAE,UAAU,CACnB,0BAA0B,EAC1B,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAEtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACF,CACP,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./MessageBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { MessageSeverity } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport {\n SvgHelpCircular,\n SvgHelpCircularHollow,\n SvgInfoCircular,\n SvgInfoCircularHollow,\n SvgStatusError,\n SvgStatusErrorHollow,\n SvgStatusRejected,\n SvgStatusRejectedHollow,\n SvgStatusSuccess,\n SvgStatusSuccessHollow,\n SvgStatusWarning,\n} from \"@itwin/itwinui-icons-react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { Dialog } from \"../dialog/Dialog\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Properties for the [[MessageBox]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageBox} component.\n */\nexport interface MessageBoxProps extends CommonProps {\n /** Severity of MessageBox */\n severity: MessageSeverity;\n /** whether to show dialog or not */\n opened: boolean;\n /** List of [[DialogButtonDef]] objects specifying buttons and associated onClick events */\n buttonCluster: DialogButtonDef[];\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for <Esc> key */\n onEscape?: () => void;\n /** minimum width that the dialog may be resized to. Default: 400 */\n minWidth?: number;\n /** minimum height that the dialog may be resized to. Default: 400 */\n minHeight?: number;\n /** initial width of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"50%\"\n */\n width?: string | number;\n /** initial height of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"\"\n */\n height?: string | number;\n /** Whether to show background overlay. Default: true */\n modal?: boolean;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n /** Message content */\n children?: React.ReactNode;\n}\n\n/** Message Box React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageBox extends React.PureComponent<MessageBoxProps> {\n public static defaultProps: Partial<MessageBoxProps> = {\n minWidth: 400,\n minHeight: 400,\n width: \"512px\",\n modal: true,\n };\n\n public override render(): React.ReactElement {\n return (\n <Dialog\n title={this.props.title}\n buttonCluster={this.props.buttonCluster}\n opened={this.props.opened}\n onClose={this.props.onClose}\n onEscape={this.props.onEscape}\n modal={this.props.modal}\n className={this.props.className}\n style={this.props.style}\n width={this.props.width}\n >\n <MessageContainer\n severity={this.props.severity}\n className={this.props.contentClassName}\n style={this.props.contentStyle}\n >\n {this.props.children}\n </MessageContainer>\n </Dialog>\n );\n }\n}\n\n/** Properties for the [[MessageContainer]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageContainer} component.\n */\nexport interface MessageContainerProps extends CommonProps {\n severity: MessageSeverity;\n /** Message Content */\n children?: React.ReactNode;\n}\n\n/** Message Container React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageContainer extends React.PureComponent<MessageContainerProps> {\n /** Returns the class name corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n */\n public static getIconClassName(severity: MessageSeverity): string;\n /** Returns the class name associated with the WebFont icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow Should the icon be hollow\n * @deprecated in 4.0.0. Hollow parameter ignored, WebFont is not returned, only the color.\n */\n public static getIconClassName(\n severity: MessageSeverity,\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n hollow?: boolean\n ): string;\n\n public static getIconClassName(\n severity: MessageSeverity,\n _hollow?: boolean\n ): string {\n let iconClassName = \"\";\n\n switch (severity) {\n case MessageSeverity.None:\n iconClassName = \"\";\n break;\n case MessageSeverity.Success:\n iconClassName = \"core-message-box-success\";\n break;\n case MessageSeverity.Information:\n iconClassName = \"core-message-box-information\";\n break;\n case MessageSeverity.Question:\n iconClassName = \"core-message-box-question\";\n break;\n case MessageSeverity.Warning:\n iconClassName = \"core-message-box-warning\";\n break;\n case MessageSeverity.Error:\n iconClassName = \"core-message-box-error\";\n break;\n case MessageSeverity.Fatal:\n iconClassName = \"core-message-box-fatal\";\n break;\n }\n\n return iconClassName;\n }\n\n /** Returns the React icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow set to true to return the hollow form of the icon.\n * @returns IconSpec\n */\n /* ignore for unit tests and replace with visual testing */\n\n public static getIcon(severity: MessageSeverity, hollow?: boolean): IconSpec {\n let iconSpec: IconSpec = \"\";\n switch (severity) {\n case MessageSeverity.None:\n iconSpec = \"\";\n break;\n case MessageSeverity.Success:\n iconSpec = hollow ? <SvgStatusSuccessHollow /> : <SvgStatusSuccess />;\n break;\n case MessageSeverity.Information:\n iconSpec = hollow ? <SvgInfoCircularHollow /> : <SvgInfoCircular />;\n break;\n case MessageSeverity.Question:\n iconSpec = hollow ? <SvgHelpCircularHollow /> : <SvgHelpCircular />;\n break;\n case MessageSeverity.Warning:\n iconSpec = <SvgStatusWarning />; // TODO - need icon-status-warning-hollow icon\n break;\n case MessageSeverity.Error:\n iconSpec = hollow ? <SvgStatusErrorHollow /> : <SvgStatusError />;\n break;\n case MessageSeverity.Fatal:\n iconSpec = hollow ? <SvgStatusRejectedHollow /> : <SvgStatusRejected />;\n break;\n }\n return iconSpec;\n }\n\n public override render(): React.ReactElement {\n const iconClassName = classnames(\n \"icon\",\n \"core-message-box-icon\",\n MessageContainer.getIconClassName(this.props.severity)\n );\n\n const iconSpec = MessageContainer.getIcon(this.props.severity);\n return (\n <div className=\"core-message-box-container\">\n <div className={iconClassName}>\n <Icon iconSpec={iconSpec} />\n </div>\n <div\n className={classnames(\n \"core-message-box-content\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.props.children}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MessageBox.js","sourceRoot":"","sources":["../../../../src/core-react/messagebox/MessageBox.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA6C1C;;;G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C,WAAW,CAAC;QACjC,KAAK,eAAe,CAAC,QAAQ;YAC3B,OAAO,eAAe,CAAC;QACzB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./MessageBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { MessageSeverity } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport {\n SvgHelpCircular,\n SvgHelpCircularHollow,\n SvgInfoCircular,\n SvgInfoCircularHollow,\n SvgStatusError,\n SvgStatusErrorHollow,\n SvgStatusRejected,\n SvgStatusRejectedHollow,\n SvgStatusSuccess,\n SvgStatusSuccessHollow,\n SvgStatusWarning,\n} from \"@itwin/itwinui-icons-react\";\nimport { Icon } from \"@itwin/itwinui-react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Dialog } from \"../dialog/Dialog\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Properties for the [[MessageBox]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageBox} component.\n */\nexport interface MessageBoxProps extends CommonProps {\n /** Severity of MessageBox */\n severity: MessageSeverity;\n /** whether to show dialog or not */\n opened: boolean;\n /** List of [[DialogButtonDef]] objects specifying buttons and associated onClick events */\n buttonCluster: DialogButtonDef[];\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for <Esc> key */\n onEscape?: () => void;\n /** minimum width that the dialog may be resized to. Default: 400 */\n minWidth?: number;\n /** minimum height that the dialog may be resized to. Default: 400 */\n minHeight?: number;\n /** initial width of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"50%\"\n */\n width?: string | number;\n /** initial height of dialog.\n * Displayed in px if value is a number, otherwise displayed in specified CSS unit.\n * Default: \"\"\n */\n height?: string | number;\n /** Whether to show background overlay. Default: true */\n modal?: boolean;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n /** Message content */\n children?: React.ReactNode;\n}\n\n/** Message Box React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageBox extends React.PureComponent<MessageBoxProps> {\n public static defaultProps: Partial<MessageBoxProps> = {\n minWidth: 400,\n minHeight: 400,\n width: \"512px\",\n modal: true,\n };\n\n public override render(): React.ReactElement {\n return (\n <Dialog\n title={this.props.title}\n buttonCluster={this.props.buttonCluster}\n opened={this.props.opened}\n onClose={this.props.onClose}\n onEscape={this.props.onEscape}\n modal={this.props.modal}\n className={this.props.className}\n style={this.props.style}\n width={this.props.width}\n >\n <MessageContainer\n severity={this.props.severity}\n className={this.props.contentClassName}\n style={this.props.contentStyle}\n >\n {this.props.children}\n </MessageContainer>\n </Dialog>\n );\n }\n}\n\n/** Properties for the [[MessageContainer]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link MessageContainer} component.\n */\nexport interface MessageContainerProps extends CommonProps {\n severity: MessageSeverity;\n /** Message Content */\n children?: React.ReactNode;\n}\n\n/** Message Container React component.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI Dialog} instead.\n */\nexport class MessageContainer extends React.PureComponent<MessageContainerProps> {\n /** Returns the class name corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n */\n public static getIconClassName(severity: MessageSeverity): string;\n /** Returns the class name associated with the WebFont icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow Should the icon be hollow\n * @deprecated in 4.0.0. Hollow parameter ignored, WebFont is not returned, only the color.\n */\n public static getIconClassName(\n severity: MessageSeverity,\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n hollow?: boolean\n ): string;\n\n public static getIconClassName(\n severity: MessageSeverity,\n _hollow?: boolean\n ): string {\n let iconClassName = \"\";\n\n switch (severity) {\n case MessageSeverity.None:\n iconClassName = \"\";\n break;\n case MessageSeverity.Success:\n iconClassName = \"core-message-box-success\";\n break;\n case MessageSeverity.Information:\n iconClassName = \"core-message-box-information\";\n break;\n case MessageSeverity.Question:\n iconClassName = \"core-message-box-question\";\n break;\n case MessageSeverity.Warning:\n iconClassName = \"core-message-box-warning\";\n break;\n case MessageSeverity.Error:\n iconClassName = \"core-message-box-error\";\n break;\n case MessageSeverity.Fatal:\n iconClassName = \"core-message-box-fatal\";\n break;\n }\n\n return iconClassName;\n }\n\n /** Returns the React icon corresponding to the MessageSeverity.\n * @param severity MessageSeverity\n * @param hollow set to true to return the hollow form of the icon.\n * @returns IconSpec\n */\n /* ignore for unit tests and replace with visual testing */\n\n public static getIcon(severity: MessageSeverity, hollow?: boolean): IconSpec {\n const icon = getIcon(severity, hollow);\n return icon ?? \"\";\n }\n\n public override render(): React.ReactElement {\n const iconClassName = classnames(\n \"icon\",\n \"core-message-box-icon\",\n MessageContainer.getIconClassName(this.props.severity)\n );\n\n const icon = getIcon(this.props.severity);\n return (\n <div className=\"core-message-box-container\">\n {icon ? (\n <Icon\n className={iconClassName}\n size=\"large\"\n fill={toFill(this.props.severity)}\n >\n {icon}\n </Icon>\n ) : undefined}\n <div\n className={classnames(\n \"core-message-box-content\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.props.children}\n </div>\n </div>\n );\n }\n}\n\nfunction getIcon(\n severity: MessageSeverity,\n hollow?: boolean\n): React.ReactElement | undefined {\n switch (severity) {\n case MessageSeverity.None:\n return undefined;\n case MessageSeverity.Success:\n return hollow ? <SvgStatusSuccessHollow /> : <SvgStatusSuccess />;\n case MessageSeverity.Information:\n return hollow ? <SvgInfoCircularHollow /> : <SvgInfoCircular />;\n case MessageSeverity.Question:\n return hollow ? <SvgHelpCircularHollow /> : <SvgHelpCircular />;\n case MessageSeverity.Warning:\n return <SvgStatusWarning />; // TODO - need icon-status-warning-hollow icon\n case MessageSeverity.Error:\n return hollow ? <SvgStatusErrorHollow /> : <SvgStatusError />;\n break;\n case MessageSeverity.Fatal:\n return hollow ? <SvgStatusRejectedHollow /> : <SvgStatusRejected />;\n }\n}\n\ntype IconProps = React.ComponentProps<typeof Icon>;\n\nfunction toFill(severity: MessageSeverity): IconProps[\"fill\"] {\n switch (severity) {\n case MessageSeverity.None:\n return undefined;\n case MessageSeverity.Success:\n return \"positive\";\n case MessageSeverity.Information:\n case MessageSeverity.Question:\n return \"informational\";\n case MessageSeverity.Warning:\n return \"warning\";\n case MessageSeverity.Error:\n case MessageSeverity.Fatal:\n return \"negative\";\n }\n return undefined;\n}\n"]}
|
|
@@ -9,19 +9,16 @@
|
|
|
9
9
|
.core-message-box-container {
|
|
10
10
|
display: flex;
|
|
11
11
|
color: var(--iui-color-text);
|
|
12
|
+
gap: var(--iui-size-m);
|
|
12
13
|
|
|
13
14
|
.core-message-box-icon {
|
|
14
|
-
flex: 0 0;
|
|
15
15
|
font-size: $uicore-icons-medium;
|
|
16
|
-
padding: 0 $uicore-unbordered-padding $uicore-unbordered-padding
|
|
17
|
-
$uicore-unbordered-padding;
|
|
18
|
-
margin-top: 10px;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
.core-message-box-content {
|
|
22
19
|
display: flex;
|
|
23
|
-
|
|
24
|
-
flex:
|
|
20
|
+
flex: 1;
|
|
21
|
+
flex-direction: column;
|
|
25
22
|
|
|
26
23
|
a {
|
|
27
24
|
// iTwinUI anchor link style
|