@dloizides/ui-feedback 1.20.0 → 1.22.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/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +40 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -330,7 +330,7 @@ var ErrorState = ({
|
|
|
330
330
|
const primary = theme.palette.primary["500"];
|
|
331
331
|
const hasTitle = typeof title === "string" && title !== "";
|
|
332
332
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
333
|
-
const messageColor = hasTitle ? theme.colors.textSecondary : errorColor;
|
|
333
|
+
const messageColor = hasTitle ? theme.colors.textSecondary : theme.semanticText?.error ?? errorColor;
|
|
334
334
|
const retry = typeof onRetry === "function" ? /* @__PURE__ */ jsx(
|
|
335
335
|
TouchableOpacity,
|
|
336
336
|
{
|
|
@@ -1142,6 +1142,10 @@ var styles10 = StyleSheet.create({
|
|
|
1142
1142
|
maxWidth: CONTENT_MAX_WIDTH,
|
|
1143
1143
|
alignItems: "center"
|
|
1144
1144
|
},
|
|
1145
|
+
logo: {
|
|
1146
|
+
alignItems: "center",
|
|
1147
|
+
marginBottom: TITLE_MARGIN_BOTTOM2
|
|
1148
|
+
},
|
|
1145
1149
|
title: {
|
|
1146
1150
|
fontSize: TITLE_FONT_SIZE3,
|
|
1147
1151
|
fontWeight: "bold",
|
|
@@ -1183,10 +1187,12 @@ var ErrorBoundaryFallback = ({
|
|
|
1183
1187
|
showRetry,
|
|
1184
1188
|
reloadIsPrimary,
|
|
1185
1189
|
onRetry,
|
|
1186
|
-
onReload
|
|
1190
|
+
onReload,
|
|
1191
|
+
logo
|
|
1187
1192
|
}) => {
|
|
1188
1193
|
const { theme } = useFeedbackUi();
|
|
1189
1194
|
const warningColor = (theme.semantic.warning ?? theme.semantic.error)["500"];
|
|
1195
|
+
const warningText = theme.semanticText?.warning ?? warningColor;
|
|
1190
1196
|
const primaryColor = theme.palette.primary["500"];
|
|
1191
1197
|
const hasDetails = showDetails && error !== null;
|
|
1192
1198
|
const primaryFill = { backgroundColor: primaryColor };
|
|
@@ -1225,6 +1231,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1225
1231
|
style: [styles10.container, { backgroundColor: theme.colors.background }],
|
|
1226
1232
|
testID: testIDPrefix,
|
|
1227
1233
|
children: /* @__PURE__ */ jsxs(View, { style: styles10.content, children: [
|
|
1234
|
+
logo !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles10.logo, testID: `${testIDPrefix}-logo`, children: logo }) : null,
|
|
1228
1235
|
/* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: theme.colors.text }], children: labels.title }),
|
|
1229
1236
|
/* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
|
|
1230
1237
|
hasDetails ? /* @__PURE__ */ jsxs(
|
|
@@ -1233,7 +1240,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1233
1240
|
style: [styles10.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
|
|
1234
1241
|
testID: `${testIDPrefix}-details`,
|
|
1235
1242
|
children: [
|
|
1236
|
-
/* @__PURE__ */ jsx(Text, { style: [styles10.detailsTitle, { color:
|
|
1243
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.detailsTitle, { color: warningText }], children: labels.errorDetails }),
|
|
1237
1244
|
/* @__PURE__ */ jsx(Text, { style: [styles10.detailsText, { color: theme.colors.textSecondary }], children: error.message })
|
|
1238
1245
|
]
|
|
1239
1246
|
}
|
|
@@ -1327,12 +1334,23 @@ var AppErrorBoundary = class extends Component {
|
|
|
1327
1334
|
if (isHandled) this.setState({ recovering: true });
|
|
1328
1335
|
}
|
|
1329
1336
|
render() {
|
|
1330
|
-
const { children, fallback
|
|
1337
|
+
const { children, fallback } = this.props;
|
|
1331
1338
|
const { hasError, error, recovering } = this.state;
|
|
1339
|
+
if (!hasError) return children;
|
|
1340
|
+
if (typeof fallback === "function")
|
|
1341
|
+
return fallback({
|
|
1342
|
+
error,
|
|
1343
|
+
recovering,
|
|
1344
|
+
retry: this.handleRetry,
|
|
1345
|
+
renderDefault: (logo) => this.renderDefaultFallback(logo)
|
|
1346
|
+
});
|
|
1347
|
+
return this.renderDefaultFallback();
|
|
1348
|
+
}
|
|
1349
|
+
renderDefaultFallback(logo) {
|
|
1350
|
+
const { labels, labelsFor, showDetails, onReload } = this.props;
|
|
1351
|
+
const { error, recovering } = this.state;
|
|
1332
1352
|
const testIDPrefix = this.props.testIDPrefix ?? FEEDBACK_TEST_IDS.errorBoundary;
|
|
1333
1353
|
const resolvedLabels = resolveLabels(labels, labelsFor, error);
|
|
1334
|
-
if (!hasError) return children;
|
|
1335
|
-
if (typeof fallback === "function") return fallback({ error, recovering, retry: this.handleRetry });
|
|
1336
1354
|
if (recovering)
|
|
1337
1355
|
return /* @__PURE__ */ jsx(ErrorBoundaryRecovering, { message: resolvedLabels.updating, testID: `${testIDPrefix}-updating` });
|
|
1338
1356
|
return /* @__PURE__ */ jsx(
|
|
@@ -1340,6 +1358,7 @@ var AppErrorBoundary = class extends Component {
|
|
|
1340
1358
|
{
|
|
1341
1359
|
error,
|
|
1342
1360
|
labels: resolvedLabels,
|
|
1361
|
+
logo,
|
|
1343
1362
|
reloadIsPrimary: this.props.reloadIsPrimary === true,
|
|
1344
1363
|
showDetails: resolveShowDetails(showDetails, error),
|
|
1345
1364
|
showRetry: resolveRetryable(this.props.retryable, error),
|
|
@@ -1517,6 +1536,15 @@ function runToneColor(theme, state) {
|
|
|
1517
1536
|
if (state === "done") return scale(theme, "success") ?? theme.colors.text;
|
|
1518
1537
|
return theme.colors.textSecondary;
|
|
1519
1538
|
}
|
|
1539
|
+
function runToneTextColor(theme, state) {
|
|
1540
|
+
const inks = {
|
|
1541
|
+
failed: theme.semanticText?.error,
|
|
1542
|
+
running: theme.semanticText?.warning,
|
|
1543
|
+
done: theme.semanticText?.success,
|
|
1544
|
+
pending: void 0
|
|
1545
|
+
};
|
|
1546
|
+
return inks[state] ?? runToneColor(theme, state);
|
|
1547
|
+
}
|
|
1520
1548
|
var MARK = { done: "\u2713", running: "\u25CF", pending: "\u25CB", failed: "\u2715" };
|
|
1521
1549
|
var styles14 = StyleSheet.create({
|
|
1522
1550
|
row: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
|
|
@@ -1533,9 +1561,10 @@ function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect })
|
|
|
1533
1561
|
const { theme } = useFeedbackUi();
|
|
1534
1562
|
return /* @__PURE__ */ jsx(View, { style: styles14.row, testID, children: groups.map((group) => {
|
|
1535
1563
|
const color = runToneColor(theme, group.state);
|
|
1564
|
+
const ink = runToneTextColor(theme, group.state);
|
|
1536
1565
|
const selected = group.id === selectedId;
|
|
1537
1566
|
const a11y = labels.groupA11y(group.label, group.state, labels.formatDuration(group.durationSec));
|
|
1538
|
-
const body = /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color }, selected || group.state === "running" ? styles14.strong : null], children: chipText(group, labels) });
|
|
1567
|
+
const body = /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color: ink }, selected || group.state === "running" ? styles14.strong : null], children: chipText(group, labels) });
|
|
1539
1568
|
const look = [styles14.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
|
|
1540
1569
|
if (onSelect === void 0) {
|
|
1541
1570
|
return /* @__PURE__ */ jsx(View, { style: [look, styles14.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
|
|
@@ -1563,7 +1592,7 @@ function RunGroupSummary({ groups, labels, testID }) {
|
|
|
1563
1592
|
const doneColor = runToneColor(theme, "done");
|
|
1564
1593
|
const doneText = labels.doneSummary(done.count, labels.formatDuration(done.durationSec));
|
|
1565
1594
|
return /* @__PURE__ */ jsxs(View, { style: styles14.row, testID, children: [
|
|
1566
|
-
done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [styles14.chip, styles14.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color:
|
|
1595
|
+
done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [styles14.chip, styles14.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color: runToneTextColor(theme, "done") }], children: `${MARK.done} ${doneText}` }) }) : null,
|
|
1567
1596
|
/* @__PURE__ */ jsx(RunGroupChips, { groups: open, labels, testID: `${testID}-open` })
|
|
1568
1597
|
] });
|
|
1569
1598
|
}
|
|
@@ -1649,17 +1678,18 @@ function LiveRunCard(props) {
|
|
|
1649
1678
|
const selectedId = groups.some((g) => g.id === picked) ? picked : defaultGroupId(groups);
|
|
1650
1679
|
const selected = groups.find((g) => g.id === selectedId);
|
|
1651
1680
|
const tone = runToneColor(theme, status);
|
|
1681
|
+
const toneText = runToneTextColor(theme, status);
|
|
1652
1682
|
const percent = progressPercent(progress);
|
|
1653
1683
|
const showTimings = !compact || open;
|
|
1654
1684
|
const muted = { color: theme.colors.textSecondary };
|
|
1655
1685
|
return /* @__PURE__ */ jsxs(View, { style: [styles16.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
|
|
1656
1686
|
/* @__PURE__ */ jsxs(View, { style: styles16.head, children: [
|
|
1657
|
-
/* @__PURE__ */ jsx(View, { style: [styles16.pill, { borderColor: tone }], children: /* @__PURE__ */ jsx(Text, { style: [styles16.pillText, { color:
|
|
1687
|
+
/* @__PURE__ */ jsx(View, { style: [styles16.pill, { borderColor: tone }], children: /* @__PURE__ */ jsx(Text, { style: [styles16.pillText, { color: toneText }], testID: `${testID}-status`, children: labels.status }) }),
|
|
1658
1688
|
/* @__PURE__ */ jsxs(View, { style: styles16.titleBox, children: [
|
|
1659
1689
|
/* @__PURE__ */ jsx(Text, { style: [styles16.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
|
|
1660
1690
|
/* @__PURE__ */ jsx(Text, { style: [styles16.meta, muted], testID: `${testID}-meta`, children: labels.meta })
|
|
1661
1691
|
] }),
|
|
1662
|
-
onCancel !== void 0 ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1692
|
+
onCancel !== void 0 ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semanticText?.error ?? theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1663
1693
|
] }),
|
|
1664
1694
|
currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [styles16.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
|
|
1665
1695
|
percent !== null ? /* @__PURE__ */ jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
|