@dloizides/ui-feedback 1.21.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 +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -29,10 +29,18 @@ interface FeedbackThemeSemantic {
|
|
|
29
29
|
error: FeedbackColorScale;
|
|
30
30
|
[name: string]: FeedbackColorScale;
|
|
31
31
|
}
|
|
32
|
+
/** Text colours readable on the mode's surfaces; `semantic` stays the fill. */
|
|
33
|
+
interface FeedbackThemeSemanticText {
|
|
34
|
+
success: string;
|
|
35
|
+
warning: string;
|
|
36
|
+
error: string;
|
|
37
|
+
info: string;
|
|
38
|
+
}
|
|
32
39
|
interface FeedbackTheme {
|
|
33
40
|
colors: FeedbackThemeColors;
|
|
34
41
|
palette: FeedbackThemePalette;
|
|
35
42
|
semantic: FeedbackThemeSemantic;
|
|
43
|
+
semanticText?: FeedbackThemeSemanticText;
|
|
36
44
|
}
|
|
37
45
|
/** Translate function — mirrors the apps' `FM(key, p1?, p2?, p3?)` helper. */
|
|
38
46
|
type FeedbackTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
|
|
@@ -660,4 +668,4 @@ declare function LiveRunCard(props: LiveRunCardProps): React.ReactElement;
|
|
|
660
668
|
/** The theme colour for a step or group state; falls back to primary/text when a semantic scale is absent. */
|
|
661
669
|
declare function runToneColor(theme: FeedbackTheme, state: RunStepState): string;
|
|
662
670
|
|
|
663
|
-
export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, type DoneSummary, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorReferenceRow, type ErrorReferenceRowProps, ErrorState, type ErrorStateAction, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, type FlatRunStep, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, type LiveRunCardLabels, type LiveRunCardProps, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ProgressBar, type ProgressBarProps, type RunGroup, type RunStep, type RunStepState, type StepSplit, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
|
|
671
|
+
export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, type DoneSummary, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorReferenceRow, type ErrorReferenceRowProps, ErrorState, type ErrorStateAction, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackThemeSemanticText, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, type FlatRunStep, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, type LiveRunCardLabels, type LiveRunCardProps, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ProgressBar, type ProgressBarProps, type RunGroup, type RunStep, type RunStepState, type StepSplit, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackThemeSemanticText as UiThemeSemanticText, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
|
package/dist/index.d.ts
CHANGED
|
@@ -29,10 +29,18 @@ interface FeedbackThemeSemantic {
|
|
|
29
29
|
error: FeedbackColorScale;
|
|
30
30
|
[name: string]: FeedbackColorScale;
|
|
31
31
|
}
|
|
32
|
+
/** Text colours readable on the mode's surfaces; `semantic` stays the fill. */
|
|
33
|
+
interface FeedbackThemeSemanticText {
|
|
34
|
+
success: string;
|
|
35
|
+
warning: string;
|
|
36
|
+
error: string;
|
|
37
|
+
info: string;
|
|
38
|
+
}
|
|
32
39
|
interface FeedbackTheme {
|
|
33
40
|
colors: FeedbackThemeColors;
|
|
34
41
|
palette: FeedbackThemePalette;
|
|
35
42
|
semantic: FeedbackThemeSemantic;
|
|
43
|
+
semanticText?: FeedbackThemeSemanticText;
|
|
36
44
|
}
|
|
37
45
|
/** Translate function — mirrors the apps' `FM(key, p1?, p2?, p3?)` helper. */
|
|
38
46
|
type FeedbackTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
|
|
@@ -660,4 +668,4 @@ declare function LiveRunCard(props: LiveRunCardProps): React.ReactElement;
|
|
|
660
668
|
/** The theme colour for a step or group state; falls back to primary/text when a semantic scale is absent. */
|
|
661
669
|
declare function runToneColor(theme: FeedbackTheme, state: RunStepState): string;
|
|
662
670
|
|
|
663
|
-
export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, type DoneSummary, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorReferenceRow, type ErrorReferenceRowProps, ErrorState, type ErrorStateAction, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, type FlatRunStep, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, type LiveRunCardLabels, type LiveRunCardProps, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ProgressBar, type ProgressBarProps, type RunGroup, type RunStep, type RunStepState, type StepSplit, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
|
|
671
|
+
export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, type DoneSummary, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorReferenceRow, type ErrorReferenceRowProps, ErrorState, type ErrorStateAction, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackThemeSemanticText, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, type FlatRunStep, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, type LiveRunCardLabels, type LiveRunCardProps, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ProgressBar, type ProgressBarProps, type RunGroup, type RunStep, type RunStepState, type StepSplit, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackThemeSemanticText as UiThemeSemanticText, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
|
package/dist/index.js
CHANGED
|
@@ -332,7 +332,7 @@ var ErrorState = ({
|
|
|
332
332
|
const primary = theme.palette.primary["500"];
|
|
333
333
|
const hasTitle = typeof title === "string" && title !== "";
|
|
334
334
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
335
|
-
const messageColor = hasTitle ? theme.colors.textSecondary : errorColor;
|
|
335
|
+
const messageColor = hasTitle ? theme.colors.textSecondary : theme.semanticText?.error ?? errorColor;
|
|
336
336
|
const retry = typeof onRetry === "function" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
337
|
reactNative.TouchableOpacity,
|
|
338
338
|
{
|
|
@@ -1194,6 +1194,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1194
1194
|
}) => {
|
|
1195
1195
|
const { theme } = useFeedbackUi();
|
|
1196
1196
|
const warningColor = (theme.semantic.warning ?? theme.semantic.error)["500"];
|
|
1197
|
+
const warningText = theme.semanticText?.warning ?? warningColor;
|
|
1197
1198
|
const primaryColor = theme.palette.primary["500"];
|
|
1198
1199
|
const hasDetails = showDetails && error !== null;
|
|
1199
1200
|
const primaryFill = { backgroundColor: primaryColor };
|
|
@@ -1241,7 +1242,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1241
1242
|
style: [styles10.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
|
|
1242
1243
|
testID: `${testIDPrefix}-details`,
|
|
1243
1244
|
children: [
|
|
1244
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.detailsTitle, { color:
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.detailsTitle, { color: warningText }], children: labels.errorDetails }),
|
|
1245
1246
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.detailsText, { color: theme.colors.textSecondary }], children: error.message })
|
|
1246
1247
|
]
|
|
1247
1248
|
}
|
|
@@ -1537,6 +1538,15 @@ function runToneColor(theme, state) {
|
|
|
1537
1538
|
if (state === "done") return scale(theme, "success") ?? theme.colors.text;
|
|
1538
1539
|
return theme.colors.textSecondary;
|
|
1539
1540
|
}
|
|
1541
|
+
function runToneTextColor(theme, state) {
|
|
1542
|
+
const inks = {
|
|
1543
|
+
failed: theme.semanticText?.error,
|
|
1544
|
+
running: theme.semanticText?.warning,
|
|
1545
|
+
done: theme.semanticText?.success,
|
|
1546
|
+
pending: void 0
|
|
1547
|
+
};
|
|
1548
|
+
return inks[state] ?? runToneColor(theme, state);
|
|
1549
|
+
}
|
|
1540
1550
|
var MARK = { done: "\u2713", running: "\u25CF", pending: "\u25CB", failed: "\u2715" };
|
|
1541
1551
|
var styles14 = reactNative.StyleSheet.create({
|
|
1542
1552
|
row: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
|
|
@@ -1553,9 +1563,10 @@ function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect })
|
|
|
1553
1563
|
const { theme } = useFeedbackUi();
|
|
1554
1564
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles14.row, testID, children: groups.map((group) => {
|
|
1555
1565
|
const color = runToneColor(theme, group.state);
|
|
1566
|
+
const ink = runToneTextColor(theme, group.state);
|
|
1556
1567
|
const selected = group.id === selectedId;
|
|
1557
1568
|
const a11y = labels.groupA11y(group.label, group.state, labels.formatDuration(group.durationSec));
|
|
1558
|
-
const body = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.text, { color }, selected || group.state === "running" ? styles14.strong : null], children: chipText(group, labels) });
|
|
1569
|
+
const body = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.text, { color: ink }, selected || group.state === "running" ? styles14.strong : null], children: chipText(group, labels) });
|
|
1559
1570
|
const look = [styles14.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
|
|
1560
1571
|
if (onSelect === void 0) {
|
|
1561
1572
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [look, styles14.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
|
|
@@ -1583,7 +1594,7 @@ function RunGroupSummary({ groups, labels, testID }) {
|
|
|
1583
1594
|
const doneColor = runToneColor(theme, "done");
|
|
1584
1595
|
const doneText = labels.doneSummary(done.count, labels.formatDuration(done.durationSec));
|
|
1585
1596
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, testID, children: [
|
|
1586
|
-
done.count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.chip, styles14.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.text, { color:
|
|
1597
|
+
done.count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.chip, styles14.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.text, { color: runToneTextColor(theme, "done") }], children: `${MARK.done} ${doneText}` }) }) : null,
|
|
1587
1598
|
/* @__PURE__ */ jsxRuntime.jsx(RunGroupChips, { groups: open, labels, testID: `${testID}-open` })
|
|
1588
1599
|
] });
|
|
1589
1600
|
}
|
|
@@ -1669,17 +1680,18 @@ function LiveRunCard(props) {
|
|
|
1669
1680
|
const selectedId = groups.some((g) => g.id === picked) ? picked : defaultGroupId(groups);
|
|
1670
1681
|
const selected = groups.find((g) => g.id === selectedId);
|
|
1671
1682
|
const tone = runToneColor(theme, status);
|
|
1683
|
+
const toneText = runToneTextColor(theme, status);
|
|
1672
1684
|
const percent = progressPercent(progress);
|
|
1673
1685
|
const showTimings = !compact || open;
|
|
1674
1686
|
const muted = { color: theme.colors.textSecondary };
|
|
1675
1687
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
|
|
1676
1688
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.head, children: [
|
|
1677
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.pill, { borderColor: tone }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.pillText, { color:
|
|
1689
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.pill, { borderColor: tone }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.pillText, { color: toneText }], testID: `${testID}-status`, children: labels.status }) }),
|
|
1678
1690
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.titleBox, children: [
|
|
1679
1691
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
|
|
1680
1692
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.meta, muted], testID: `${testID}-meta`, children: labels.meta })
|
|
1681
1693
|
] }),
|
|
1682
|
-
onCancel !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1694
|
+
onCancel !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semanticText?.error ?? theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1683
1695
|
] }),
|
|
1684
1696
|
currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
|
|
1685
1697
|
percent !== null ? /* @__PURE__ */ jsxRuntime.jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
|