@dloizides/ui-feedback 1.19.2 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +1 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -761,11 +761,13 @@ var TOAST_TOP_WEB = APP_HEADER_HEIGHT + HEADER_GAP;
|
|
|
761
761
|
var GLYPHS = {
|
|
762
762
|
success: "\u2713",
|
|
763
763
|
error: "!",
|
|
764
|
-
info: "i"
|
|
764
|
+
info: "i",
|
|
765
|
+
warning: "\u25B2"
|
|
765
766
|
};
|
|
766
767
|
function scaleFor(theme, type) {
|
|
767
768
|
if (type === "error") return theme.semantic.error;
|
|
768
769
|
if (type === "success") return theme.semantic.success ?? theme.palette.primary;
|
|
770
|
+
if (type === "warning") return theme.semantic.warning ?? theme.palette.primary;
|
|
769
771
|
return theme.palette.primary;
|
|
770
772
|
}
|
|
771
773
|
function readableInk(fill) {
|
|
@@ -917,7 +919,8 @@ var ToastHost = ({
|
|
|
917
919
|
() => ({
|
|
918
920
|
success: resolveToastTone(theme, "success"),
|
|
919
921
|
error: resolveToastTone(theme, "error"),
|
|
920
|
-
info: resolveToastTone(theme, "info")
|
|
922
|
+
info: resolveToastTone(theme, "info"),
|
|
923
|
+
warning: resolveToastTone(theme, "warning")
|
|
921
924
|
}),
|
|
922
925
|
[theme]
|
|
923
926
|
);
|
|
@@ -1106,6 +1109,9 @@ function createToastBus() {
|
|
|
1106
1109
|
},
|
|
1107
1110
|
info(text) {
|
|
1108
1111
|
emit2(text, "info");
|
|
1112
|
+
},
|
|
1113
|
+
warning(text) {
|
|
1114
|
+
emit2(text, "warning");
|
|
1109
1115
|
}
|
|
1110
1116
|
};
|
|
1111
1117
|
}
|
|
@@ -1136,6 +1142,10 @@ var styles10 = StyleSheet.create({
|
|
|
1136
1142
|
maxWidth: CONTENT_MAX_WIDTH,
|
|
1137
1143
|
alignItems: "center"
|
|
1138
1144
|
},
|
|
1145
|
+
logo: {
|
|
1146
|
+
alignItems: "center",
|
|
1147
|
+
marginBottom: TITLE_MARGIN_BOTTOM2
|
|
1148
|
+
},
|
|
1139
1149
|
title: {
|
|
1140
1150
|
fontSize: TITLE_FONT_SIZE3,
|
|
1141
1151
|
fontWeight: "bold",
|
|
@@ -1177,7 +1187,8 @@ var ErrorBoundaryFallback = ({
|
|
|
1177
1187
|
showRetry,
|
|
1178
1188
|
reloadIsPrimary,
|
|
1179
1189
|
onRetry,
|
|
1180
|
-
onReload
|
|
1190
|
+
onReload,
|
|
1191
|
+
logo
|
|
1181
1192
|
}) => {
|
|
1182
1193
|
const { theme } = useFeedbackUi();
|
|
1183
1194
|
const warningColor = (theme.semantic.warning ?? theme.semantic.error)["500"];
|
|
@@ -1219,6 +1230,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1219
1230
|
style: [styles10.container, { backgroundColor: theme.colors.background }],
|
|
1220
1231
|
testID: testIDPrefix,
|
|
1221
1232
|
children: /* @__PURE__ */ jsxs(View, { style: styles10.content, children: [
|
|
1233
|
+
logo !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles10.logo, testID: `${testIDPrefix}-logo`, children: logo }) : null,
|
|
1222
1234
|
/* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: theme.colors.text }], children: labels.title }),
|
|
1223
1235
|
/* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
|
|
1224
1236
|
hasDetails ? /* @__PURE__ */ jsxs(
|
|
@@ -1321,12 +1333,23 @@ var AppErrorBoundary = class extends Component {
|
|
|
1321
1333
|
if (isHandled) this.setState({ recovering: true });
|
|
1322
1334
|
}
|
|
1323
1335
|
render() {
|
|
1324
|
-
const { children, fallback
|
|
1336
|
+
const { children, fallback } = this.props;
|
|
1325
1337
|
const { hasError, error, recovering } = this.state;
|
|
1338
|
+
if (!hasError) return children;
|
|
1339
|
+
if (typeof fallback === "function")
|
|
1340
|
+
return fallback({
|
|
1341
|
+
error,
|
|
1342
|
+
recovering,
|
|
1343
|
+
retry: this.handleRetry,
|
|
1344
|
+
renderDefault: (logo) => this.renderDefaultFallback(logo)
|
|
1345
|
+
});
|
|
1346
|
+
return this.renderDefaultFallback();
|
|
1347
|
+
}
|
|
1348
|
+
renderDefaultFallback(logo) {
|
|
1349
|
+
const { labels, labelsFor, showDetails, onReload } = this.props;
|
|
1350
|
+
const { error, recovering } = this.state;
|
|
1326
1351
|
const testIDPrefix = this.props.testIDPrefix ?? FEEDBACK_TEST_IDS.errorBoundary;
|
|
1327
1352
|
const resolvedLabels = resolveLabels(labels, labelsFor, error);
|
|
1328
|
-
if (!hasError) return children;
|
|
1329
|
-
if (typeof fallback === "function") return fallback({ error, recovering, retry: this.handleRetry });
|
|
1330
1353
|
if (recovering)
|
|
1331
1354
|
return /* @__PURE__ */ jsx(ErrorBoundaryRecovering, { message: resolvedLabels.updating, testID: `${testIDPrefix}-updating` });
|
|
1332
1355
|
return /* @__PURE__ */ jsx(
|
|
@@ -1334,6 +1357,7 @@ var AppErrorBoundary = class extends Component {
|
|
|
1334
1357
|
{
|
|
1335
1358
|
error,
|
|
1336
1359
|
labels: resolvedLabels,
|
|
1360
|
+
logo,
|
|
1337
1361
|
reloadIsPrimary: this.props.reloadIsPrimary === true,
|
|
1338
1362
|
showDetails: resolveShowDetails(showDetails, error),
|
|
1339
1363
|
showRetry: resolveRetryable(this.props.retryable, error),
|