@dloizides/ui-feedback 1.29.0 → 1.31.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.mjs CHANGED
@@ -1847,23 +1847,23 @@ var LocalModelGate = ({
1847
1847
  const consent = useCallback(() => {
1848
1848
  model.consent().catch(() => void 0);
1849
1849
  }, [model]);
1850
- const { Card, Text: Text20, Button } = slots;
1850
+ const { Card, Text: Text21, Button } = slots;
1851
1851
  switch (phase) {
1852
1852
  case LocalModelPhase.Checking:
1853
1853
  return null;
1854
1854
  case LocalModelPhase.Blocked:
1855
- return /* @__PURE__ */ jsx(Card, { testID: testIds.blocked, children: /* @__PURE__ */ jsx(Text20, { children: labels.blocked(block) }) });
1855
+ return /* @__PURE__ */ jsx(Card, { testID: testIds.blocked, children: /* @__PURE__ */ jsx(Text21, { children: labels.blocked(block) }) });
1856
1856
  case LocalModelPhase.Offer:
1857
1857
  return /* @__PURE__ */ jsxs(Card, { testID: testIds.offer, children: [
1858
- /* @__PURE__ */ jsx(Text20, { heading: true, children: labels.title }),
1859
- /* @__PURE__ */ jsx(Text20, { children: labels.offerBody }),
1858
+ /* @__PURE__ */ jsx(Text21, { heading: true, children: labels.title }),
1859
+ /* @__PURE__ */ jsx(Text21, { children: labels.offerBody }),
1860
1860
  /* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.consent, testID: testIds.consent, onPress: consent })
1861
1861
  ] });
1862
1862
  case LocalModelPhase.Loading:
1863
- return /* @__PURE__ */ jsx(Card, { testID: testIds.loading, children: /* @__PURE__ */ jsx(Text20, { children: labels.loading(String(Math.round(progress * PERCENT2))) }) });
1863
+ return /* @__PURE__ */ jsx(Card, { testID: testIds.loading, children: /* @__PURE__ */ jsx(Text21, { children: labels.loading(String(Math.round(progress * PERCENT2))) }) });
1864
1864
  case LocalModelPhase.Failed:
1865
1865
  return /* @__PURE__ */ jsxs(Card, { testID: testIds.failed, children: [
1866
- /* @__PURE__ */ jsx(Text20, { children: labels.failed }),
1866
+ /* @__PURE__ */ jsx(Text21, { children: labels.failed }),
1867
1867
  /* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.retry, testID: testIds.consent, onPress: consent })
1868
1868
  ] });
1869
1869
  case LocalModelPhase.Ready:
@@ -2043,35 +2043,62 @@ var RADIUS5 = 8;
2043
2043
  var PAD3 = 12;
2044
2044
  var ACCENT = 3;
2045
2045
  var MIN_HIT2 = 44;
2046
+ var STATUS_TILE_TEST_ID = "status-tile";
2046
2047
  var styles24 = StyleSheet.create({
2047
2048
  head: { alignItems: "center", flexDirection: "row", gap: 6 },
2048
2049
  line: { fontSize: 13 },
2049
2050
  meta: { fontSize: 12 },
2050
2051
  status: { alignSelf: "flex-start" },
2052
+ muted: { borderStyle: "dashed" },
2051
2053
  title: { flexShrink: 1, fontSize: 14, fontWeight: "700" },
2052
2054
  wrap: { borderRadius: RADIUS5, borderWidth: 1, gap: 6, minHeight: MIN_HIT2, minWidth: 0, padding: PAD3 }
2053
2055
  });
2054
- var StatusTile = ({ title, icon, status, lines, accentColor, onPress, accessibilityLabel, accessibilityHint, testID }) => {
2056
+ var StatusTile = ({ title, icon, status, lines, accentColor, muted = false, onPress, accessibilityLabel, accessibilityHint, testID }) => {
2055
2057
  const { theme } = useFeedbackUi();
2056
2058
  const reduced = useReducedMotion();
2057
2059
  const accent = accentColor === void 0 ? { borderColor: theme.colors.border } : { borderColor: accentColor, borderTopWidth: ACCENT, paddingTop: PAD3 - ACCENT + 1 };
2058
2060
  const interactive = onPress !== void 0;
2059
2061
  const styleOf = (state) => [
2060
2062
  styles24.wrap,
2061
- { backgroundColor: theme.colors.surface },
2063
+ { backgroundColor: muted ? theme.colors.background : theme.colors.surface },
2062
2064
  accent,
2065
+ muted ? styles24.muted : null,
2063
2066
  tileMotionStyle(theme, { interaction: { hovered: state.hovered === true, pressed: state.pressed, focused: state.focused === true }, reduced, interactive, accentColor })
2064
2067
  ];
2065
- return /* @__PURE__ */ jsxs(Pressable, { accessibilityHint, accessibilityLabel, accessibilityRole: interactive ? "button" : void 0, disabled: !interactive, style: styleOf, testID, onPress, children: [
2068
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityHint, accessibilityLabel, accessibilityRole: interactive ? "button" : void 0, disabled: !interactive, style: styleOf, testID: testID ?? STATUS_TILE_TEST_ID, onPress, children: [
2066
2069
  /* @__PURE__ */ jsxs(View, { style: styles24.head, children: [
2067
2070
  icon,
2068
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles24.title, { color: theme.colors.text }], children: title })
2071
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles24.title, { color: muted ? theme.colors.textSecondary : theme.colors.text }], children: title })
2069
2072
  ] }),
2070
2073
  status === void 0 ? null : /* @__PURE__ */ jsx(View, { style: styles24.status, children: status }),
2071
- lines.map((line, index) => /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [index === 0 ? styles24.line : styles24.meta, { color: index === 0 ? theme.colors.text : theme.colors.textSecondary }], children: line }, `${String(index)}-${line}`))
2074
+ lines.map((line, index) => /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [index === 0 ? styles24.line : styles24.meta, { color: index === 0 && !muted ? theme.colors.text : theme.colors.textSecondary }], children: line }, `${String(index)}-${line}`))
2072
2075
  ] });
2073
2076
  };
2077
+ var PERCENT4 = 100;
2078
+ var BAR_HEIGHT3 = 6;
2079
+ var MARK_HEIGHT = 14;
2080
+ var MARK_WIDTH = 2;
2081
+ var styles25 = StyleSheet.create({
2082
+ fill: { borderRadius: BAR_HEIGHT3 / 2, height: BAR_HEIGHT3 },
2083
+ mark: { height: MARK_HEIGHT, position: "absolute", top: (BAR_HEIGHT3 - MARK_HEIGHT) / 2, width: MARK_WIDTH },
2084
+ track: { borderRadius: BAR_HEIGHT3 / 2, height: BAR_HEIGHT3, overflow: "visible", width: "100%" }
2085
+ });
2086
+ function scorePercentOf(value) {
2087
+ const clamped = Math.min(PERCENT4, Math.max(0, value * PERCENT4));
2088
+ return `${clamped}%`;
2089
+ }
2090
+ var ScoreBar = ({ value, threshold, colors, label, hint, testID }) => /* @__PURE__ */ jsxs(View, { accessibilityHint: hint, accessibilityLabel: label, accessibilityRole: "progressbar", style: [styles25.track, { backgroundColor: colors.track }], testID, children: [
2091
+ /* @__PURE__ */ jsx(View, { style: [styles25.fill, { backgroundColor: colors.fill, width: scorePercentOf(value) }] }),
2092
+ threshold === null ? null : /* @__PURE__ */ jsx(View, { style: [styles25.mark, { backgroundColor: colors.mark, left: scorePercentOf(threshold) }], testID: `${testID}-threshold` })
2093
+ ] });
2094
+ var DEFAULT_SIZE = 18;
2095
+ var RING_WIDTH = 1.5;
2096
+ var styles26 = StyleSheet.create({
2097
+ glyph: { fontSize: 10, fontWeight: "700", lineHeight: 12 },
2098
+ ring: { alignItems: "center", borderWidth: RING_WIDTH, justifyContent: "center" }
2099
+ });
2100
+ var StatusCircle = ({ glyph, color, size = DEFAULT_SIZE, testID }) => /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles26.ring, { borderColor: color, borderRadius: size / 2, height: size, width: size }], testID, children: /* @__PURE__ */ jsx(Text, { style: [styles26.glyph, { color }], children: glyph }) });
2074
2101
 
2075
- export { AppErrorBoundary, AsyncSurface, AttentionCard, COPY_FEEDBACK_MS, CheckPipeline, CheckStatus, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorNotice, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, LocalModelGate, MODAL_OVERLAY_COLOR, PIPELINE_COLLAPSE_BREAKPOINT, PageSkeleton, ProgressBar, SkeletonLines, StatusTile, TILE_MOTION_MS, ThresholdMeter, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, meetsThreshold, mergeRunSteps, meterPercent, notifyWarming, pipelineItemVariant, pipelineVariant, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, tileMotionStyle, useCopyToClipboard, useFeedbackUi, useLocalModel, useFeedbackUi as useUi };
2102
+ export { AppErrorBoundary, AsyncSurface, AttentionCard, COPY_FEEDBACK_MS, CheckPipeline, CheckStatus, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorNotice, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, LocalModelGate, MODAL_OVERLAY_COLOR, PIPELINE_COLLAPSE_BREAKPOINT, PageSkeleton, ProgressBar, STATUS_TILE_TEST_ID, ScoreBar, SkeletonLines, StatusCircle, StatusTile, TILE_MOTION_MS, ThresholdMeter, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, meetsThreshold, mergeRunSteps, meterPercent, notifyWarming, pipelineItemVariant, pipelineVariant, progressPercent, readTraceId, runToneColor, scorePercentOf, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, tileMotionStyle, useCopyToClipboard, useFeedbackUi, useLocalModel, useFeedbackUi as useUi };
2076
2103
  //# sourceMappingURL=index.mjs.map
2077
2104
  //# sourceMappingURL=index.mjs.map