@dloizides/ui-feedback 1.24.0 → 1.26.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
@@ -5,6 +5,7 @@ import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
5
5
  import { Skeleton } from '@dloizides/ui-motion';
6
6
  import { Z_INDEX, resolveOnBrand, UI_DEEP_STEP, UI_MAIN_STEP, isHexColor, canCarryAccessibleInk } from '@dloizides/design-tokens';
7
7
  import { createPortal } from 'react-dom';
8
+ import { LocalModelPhase } from '@dloizides/text-generation';
8
9
 
9
10
  // src/context/FeedbackUiContext.tsx
10
11
  var DEFAULT_FEEDBACK_VALUE = {
@@ -379,6 +380,26 @@ var ErrorState = ({
379
380
  )
380
381
  ] });
381
382
  };
383
+ var BORDER_WIDTH = 1;
384
+ var BORDER_RADIUS = 8;
385
+ var PADDING = 12;
386
+ var LINE_GAP = 4;
387
+ var styles4 = StyleSheet.create({
388
+ notice: { borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS, padding: PADDING, gap: LINE_GAP }
389
+ });
390
+ var ErrorNotice = ({ children, testID }) => {
391
+ const { theme } = useFeedbackUi();
392
+ const { error } = theme.semantic;
393
+ return /* @__PURE__ */ jsx(
394
+ View,
395
+ {
396
+ "aria-live": "polite",
397
+ style: [styles4.notice, { borderColor: error["500"], backgroundColor: error["50"] }],
398
+ testID,
399
+ children
400
+ }
401
+ );
402
+ };
382
403
  var MESSAGE_FONT_SIZE2 = 16;
383
404
  var CTA_MARGIN_TOP = 16;
384
405
  var CTA_PADDING_VERTICAL = 10;
@@ -386,7 +407,7 @@ var CTA_PADDING_HORIZONTAL = 20;
386
407
  var CTA_BORDER_RADIUS = 8;
387
408
  var CTA_FONT_SIZE = 14;
388
409
  var CONTAINER_PADDING2 = 32;
389
- var styles4 = StyleSheet.create({
410
+ var styles5 = StyleSheet.create({
390
411
  container: {
391
412
  flex: 1,
392
413
  justifyContent: "center",
@@ -422,25 +443,25 @@ var EmptyListState = ({
422
443
  if (typeof ctaRoute === "string" && typeof navigate === "function") navigate(ctaRoute);
423
444
  }, [navigate, ctaRoute]);
424
445
  const showCta = typeof ctaTextKey === "string" && typeof ctaHintKey === "string" && typeof ctaRoute === "string";
425
- return /* @__PURE__ */ jsxs(View, { style: styles4.container, testID, children: [
426
- /* @__PURE__ */ jsx(Text, { style: [styles4.message, { color: colors.textSecondary }], children: t(messageKey) }),
446
+ return /* @__PURE__ */ jsxs(View, { style: styles5.container, testID, children: [
447
+ /* @__PURE__ */ jsx(Text, { style: [styles5.message, { color: colors.textSecondary }], children: t(messageKey) }),
427
448
  showCta ? /* @__PURE__ */ jsx(
428
449
  TouchableOpacity,
429
450
  {
430
451
  accessibilityHint: t(ctaHintKey),
431
452
  accessibilityLabel: t(ctaTextKey),
432
453
  accessibilityRole: "button",
433
- style: [styles4.ctaButton, { backgroundColor: primary }],
454
+ style: [styles5.ctaButton, { backgroundColor: primary }],
434
455
  testID: FEEDBACK_TEST_IDS.emptyListCta,
435
456
  onPress: handlePress,
436
- children: /* @__PURE__ */ jsx(Text, { style: [styles4.ctaText, { color: colors.background }], children: t(ctaTextKey) })
457
+ children: /* @__PURE__ */ jsx(Text, { style: [styles5.ctaText, { color: colors.background }], children: t(ctaTextKey) })
437
458
  }
438
459
  ) : null
439
460
  ] });
440
461
  };
441
462
  var FULLSCREEN_MIN_HEIGHT = 300;
442
463
  var CONTAINER_MIN_HEIGHT = 100;
443
- var styles5 = StyleSheet.create({
464
+ var styles6 = StyleSheet.create({
444
465
  container: {
445
466
  flex: 1,
446
467
  justifyContent: "center",
@@ -461,7 +482,7 @@ var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
461
482
  accessibilityHint: t("loadingFallback.hint"),
462
483
  accessibilityLabel: t("loadingFallback.label"),
463
484
  accessibilityRole: "progressbar",
464
- style: [styles5.container, fullScreen && styles5.fullScreen, { backgroundColor: colors.background }],
485
+ style: [styles6.container, fullScreen && styles6.fullScreen, { backgroundColor: colors.background }],
465
486
  testID: FEEDBACK_TEST_IDS.loadingFallback,
466
487
  children: /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size })
467
488
  }
@@ -478,7 +499,7 @@ var TEXT_LINE_HEIGHT = 16;
478
499
  var TEXT_LINE_FULL_WIDTH = "100%";
479
500
  var TEXT_LINE_SHORT_WIDTH = "70%";
480
501
  var CARD_HEIGHT = 120;
481
- var styles6 = StyleSheet.create({
502
+ var styles7 = StyleSheet.create({
482
503
  container: {
483
504
  flex: 1,
484
505
  padding: 16
@@ -512,25 +533,25 @@ var PageSkeleton = ({
512
533
  const { theme, t } = useFeedbackUi();
513
534
  const colors = theme.colors;
514
535
  const skeletonColor = String(colors.border);
515
- const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles6.row, children: [
536
+ const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles7.row, children: [
516
537
  /* @__PURE__ */ jsx(
517
538
  Skeleton,
518
539
  {
519
540
  backgroundColor: skeletonColor,
520
541
  borderRadius: AVATAR_BORDER_RADIUS,
521
542
  height: AVATAR_SIZE,
522
- style: styles6.avatar,
543
+ style: styles7.avatar,
523
544
  width: AVATAR_SIZE
524
545
  }
525
546
  ),
526
- /* @__PURE__ */ jsxs(View, { style: styles6.textContainer, children: [
547
+ /* @__PURE__ */ jsxs(View, { style: styles7.textContainer, children: [
527
548
  /* @__PURE__ */ jsx(
528
549
  Skeleton,
529
550
  {
530
551
  backgroundColor: skeletonColor,
531
552
  borderRadius: SKELETON_BORDER_RADIUS,
532
553
  height: TEXT_LINE_HEIGHT,
533
- style: styles6.textLine,
554
+ style: styles7.textLine,
534
555
  width: TEXT_LINE_FULL_WIDTH
535
556
  }
536
557
  ),
@@ -540,7 +561,7 @@ var PageSkeleton = ({
540
561
  backgroundColor: skeletonColor,
541
562
  borderRadius: SKELETON_BORDER_RADIUS,
542
563
  height: TEXT_LINE_HEIGHT,
543
- style: styles6.textLine,
564
+ style: styles7.textLine,
544
565
  width: TEXT_LINE_SHORT_WIDTH
545
566
  }
546
567
  )
@@ -552,7 +573,7 @@ var PageSkeleton = ({
552
573
  backgroundColor: skeletonColor,
553
574
  borderRadius: CARD_BORDER_RADIUS,
554
575
  height: CARD_HEIGHT,
555
- style: styles6.card
576
+ style: styles7.card
556
577
  },
557
578
  index
558
579
  );
@@ -563,7 +584,7 @@ var PageSkeleton = ({
563
584
  accessibilityHint: t("pageSkeleton.loadingHint"),
564
585
  accessibilityLabel: t("pageSkeleton.loadingLabel"),
565
586
  accessibilityState: { busy: true },
566
- style: [styles6.container, { backgroundColor: colors.background }],
587
+ style: [styles7.container, { backgroundColor: colors.background }],
567
588
  testID: FEEDBACK_TEST_IDS.pageSkeleton,
568
589
  children: [
569
590
  showHeader ? /* @__PURE__ */ jsx(
@@ -572,7 +593,7 @@ var PageSkeleton = ({
572
593
  backgroundColor: skeletonColor,
573
594
  borderRadius: SKELETON_BORDER_RADIUS,
574
595
  height: HEADER_HEIGHT,
575
- style: styles6.header,
596
+ style: styles7.header,
576
597
  width: HEADER_WIDTH
577
598
  }
578
599
  ) : null,
@@ -604,7 +625,7 @@ function confirmInk(theme, destructive) {
604
625
  return resolveOnBrand(confirmFill(theme, destructive));
605
626
  }
606
627
  var DIALOG_MAX_WIDTH = 400;
607
- var styles7 = StyleSheet.create({
628
+ var styles8 = StyleSheet.create({
608
629
  overlay: {
609
630
  flex: 1,
610
631
  backgroundColor: MODAL_OVERLAY_COLOR,
@@ -696,17 +717,17 @@ var ConfirmDialog = ({
696
717
  animationType: "fade",
697
718
  visible,
698
719
  onRequestClose: onCancel,
699
- children: /* @__PURE__ */ jsx(View, { style: styles7.overlay, testID: FEEDBACK_TEST_IDS.confirmDialog, children: /* @__PURE__ */ jsxs(
720
+ children: /* @__PURE__ */ jsx(View, { style: styles8.overlay, testID: FEEDBACK_TEST_IDS.confirmDialog, children: /* @__PURE__ */ jsxs(
700
721
  View,
701
722
  {
702
723
  accessibilityViewIsModal: true,
703
724
  "aria-label": innerDialogRole === void 0 ? void 0 : title,
704
725
  role: innerDialogRole,
705
- style: [styles7.dialog, colorStyles.dialog],
726
+ style: [styles8.dialog, colorStyles.dialog],
706
727
  children: [
707
- /* @__PURE__ */ jsx(Text, { nativeID: titleId, style: [styles7.title, colorStyles.title], children: title }),
708
- /* @__PURE__ */ jsx(Text, { style: [styles7.message, colorStyles.message], children: message }),
709
- /* @__PURE__ */ jsxs(View, { style: styles7.buttonRow, children: [
728
+ /* @__PURE__ */ jsx(Text, { nativeID: titleId, style: [styles8.title, colorStyles.title], children: title }),
729
+ /* @__PURE__ */ jsx(Text, { style: [styles8.message, colorStyles.message], children: message }),
730
+ /* @__PURE__ */ jsxs(View, { style: styles8.buttonRow, children: [
710
731
  /* @__PURE__ */ jsx(
711
732
  TouchableOpacity,
712
733
  {
@@ -714,13 +735,13 @@ var ConfirmDialog = ({
714
735
  accessibilityLabel: resolvedCancelLabel,
715
736
  accessibilityRole: "button",
716
737
  style: [
717
- styles7.button,
718
- styles7.cancelButton,
738
+ styles8.button,
739
+ styles8.cancelButton,
719
740
  colorStyles.cancelButton
720
741
  ],
721
742
  testID: FEEDBACK_TEST_IDS.cancelConfirmButton,
722
743
  onPress: onCancel,
723
- children: /* @__PURE__ */ jsx(Text, { style: [styles7.buttonText, colorStyles.cancelButtonText], children: resolvedCancelLabel })
744
+ children: /* @__PURE__ */ jsx(Text, { style: [styles8.buttonText, colorStyles.cancelButtonText], children: resolvedCancelLabel })
724
745
  }
725
746
  ),
726
747
  /* @__PURE__ */ jsx(
@@ -732,10 +753,10 @@ var ConfirmDialog = ({
732
753
  accessibilityState: { disabled: isConfirmDisabled },
733
754
  disabled: isConfirmDisabled,
734
755
  style: [
735
- styles7.button,
736
- styles7.confirmButton,
756
+ styles8.button,
757
+ styles8.confirmButton,
737
758
  colorStyles.confirmButton,
738
- isConfirmDisabled && styles7.disabledButton
759
+ isConfirmDisabled && styles8.disabledButton
739
760
  ],
740
761
  testID: FEEDBACK_TEST_IDS.confirmButton,
741
762
  onPress: onConfirm,
@@ -749,7 +770,7 @@ var ConfirmDialog = ({
749
770
  ) : /* @__PURE__ */ jsx(
750
771
  Text,
751
772
  {
752
- style: [styles7.buttonText, colorStyles.confirmButtonText],
773
+ style: [styles8.buttonText, colorStyles.confirmButtonText],
753
774
  children: resolvedConfirmLabel
754
775
  }
755
776
  )
@@ -765,7 +786,7 @@ var ConfirmDialog = ({
765
786
  var ACTION_PADDING_HORIZONTAL = 12;
766
787
  var ACTION_BORDER_RADIUS = 6;
767
788
  var ACTION_FONT_SIZE = 14;
768
- var styles8 = StyleSheet.create({
789
+ var styles9 = StyleSheet.create({
769
790
  button: {
770
791
  minWidth: MIN_TOUCH_TARGET,
771
792
  minHeight: MIN_TOUCH_TARGET,
@@ -788,10 +809,10 @@ var ToastAction = ({ action, color, testID, onDismiss }) => {
788
809
  accessibilityHint: action.hint ?? action.label,
789
810
  accessibilityLabel: action.label,
790
811
  accessibilityRole: "button",
791
- style: [styles8.button, { borderColor: color }],
812
+ style: [styles9.button, { borderColor: color }],
792
813
  testID,
793
814
  onPress: handlePress,
794
- children: /* @__PURE__ */ jsx(Text, { style: [styles8.label, { color }], children: action.label })
815
+ children: /* @__PURE__ */ jsx(Text, { style: [styles9.label, { color }], children: action.label })
795
816
  }
796
817
  );
797
818
  };
@@ -852,7 +873,7 @@ var C1_CONTROL_END = 159;
852
873
  var ZERO_WIDTH_START = 8203;
853
874
  var ZERO_WIDTH_END = 8207;
854
875
  var BYTE_ORDER_MARK = 65279;
855
- var styles9 = StyleSheet.create({
876
+ var styles10 = StyleSheet.create({
856
877
  container: {
857
878
  position: "absolute",
858
879
  left: TOAST_HORIZONTAL_MARGIN,
@@ -929,12 +950,12 @@ var ToastItem = ({ message, onDone, tone, durationMs, fadeMs, testID }) => {
929
950
  {
930
951
  accessibilityLiveRegion: isError ? "assertive" : "polite",
931
952
  role: isError ? "alert" : "status",
932
- style: [styles9.toast, { backgroundColor: tone.fill, borderColor: tone.border, transform: [{ translateY }], opacity }],
953
+ style: [styles10.toast, { backgroundColor: tone.fill, borderColor: tone.border, transform: [{ translateY }], opacity }],
933
954
  testID,
934
955
  children: [
935
- /* @__PURE__ */ jsx(View, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: [styles9.glyph, { borderColor: tone.ink }], children: /* @__PURE__ */ jsx(Text, { style: [styles9.glyphText, { color: tone.ink }], children: tone.glyph }) }),
936
- /* @__PURE__ */ jsxs(View, { style: styles9.body, children: [
937
- /* @__PURE__ */ jsx(Text, { style: [styles9.text, { color: tone.ink }], children: message.text }),
956
+ /* @__PURE__ */ jsx(View, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: [styles10.glyph, { borderColor: tone.ink }], children: /* @__PURE__ */ jsx(Text, { style: [styles10.glyphText, { color: tone.ink }], children: tone.glyph }) }),
957
+ /* @__PURE__ */ jsxs(View, { style: styles10.body, children: [
958
+ /* @__PURE__ */ jsx(Text, { style: [styles10.text, { color: tone.ink }], children: message.text }),
938
959
  /* @__PURE__ */ jsx(ErrorReferenceRow, { actionColor: tone.ink, color: tone.ink, testID: `${testID}-reference`, traceId: message.traceId })
939
960
  ] }),
940
961
  message.action ? /* @__PURE__ */ jsx(ToastAction, { action: message.action, color: tone.ink, testID: `${testID}-action`, onDismiss: handleDone }) : null
@@ -978,7 +999,7 @@ var ToastHost = ({
978
999
  useEffect(() => subscribe(push), [subscribe, push]);
979
1000
  if (messages.length === 0) return null;
980
1001
  const canPortal = IS_WEB && typeof document !== "undefined";
981
- const layer = /* @__PURE__ */ jsx(View, { style: [styles9.container, { top: toastTop(IS_WEB, topInset) }, canPortal ? WEB_FIXED_LAYER : null], children: messages.map((m) => /* @__PURE__ */ jsx(
1002
+ const layer = /* @__PURE__ */ jsx(View, { style: [styles10.container, { top: toastTop(IS_WEB, topInset) }, canPortal ? WEB_FIXED_LAYER : null], children: messages.map((m) => /* @__PURE__ */ jsx(
982
1003
  ToastItem,
983
1004
  {
984
1005
  durationMs,
@@ -1054,7 +1075,7 @@ var SUBTITLE_FONT_SIZE = 15;
1054
1075
  var ATTEMPT_FONT_SIZE = 13;
1055
1076
  var CARD_PADDING = 24;
1056
1077
  var NO_ATTEMPT = 0;
1057
- var styles10 = StyleSheet.create({
1078
+ var styles11 = StyleSheet.create({
1058
1079
  overlay: {
1059
1080
  position: "absolute",
1060
1081
  top: 0,
@@ -1111,13 +1132,13 @@ var WarmingOverlay = ({
1111
1132
  {
1112
1133
  accessibilityLabel: mergedLabels.accessibilityLabel,
1113
1134
  accessibilityRole: "alert",
1114
- style: [styles10.overlay, { backgroundColor: colors.background }],
1135
+ style: [styles11.overlay, { backgroundColor: colors.background }],
1115
1136
  testID: testIdPrefix,
1116
- children: /* @__PURE__ */ jsxs(View, { style: styles10.card, children: [
1137
+ children: /* @__PURE__ */ jsxs(View, { style: styles11.card, children: [
1117
1138
  /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size: "large" }),
1118
- /* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: colors.text }], testID: `${testIdPrefix}-title`, children: mergedLabels.title }),
1119
- /* @__PURE__ */ jsx(Text, { style: [styles10.subtitle, { color: colors.textSecondary }], testID: `${testIdPrefix}-subtitle`, children: mergedLabels.subtitle }),
1120
- showHint ? /* @__PURE__ */ jsx(Text, { style: [styles10.attempt, { color: colors.textSecondary }], testID: `${testIdPrefix}-attempt`, children: mergedLabels.attemptHint(snapshot2.attempt) }) : null
1139
+ /* @__PURE__ */ jsx(Text, { style: [styles11.title, { color: colors.text }], testID: `${testIdPrefix}-title`, children: mergedLabels.title }),
1140
+ /* @__PURE__ */ jsx(Text, { style: [styles11.subtitle, { color: colors.textSecondary }], testID: `${testIdPrefix}-subtitle`, children: mergedLabels.subtitle }),
1141
+ showHint ? /* @__PURE__ */ jsx(Text, { style: [styles11.attempt, { color: colors.textSecondary }], testID: `${testIdPrefix}-attempt`, children: mergedLabels.attemptHint(snapshot2.attempt) }) : null
1121
1142
  ] })
1122
1143
  }
1123
1144
  );
@@ -1174,7 +1195,7 @@ var BUTTON_PADDING_V3 = 12;
1174
1195
  var BUTTON_BORDER_RADIUS3 = 8;
1175
1196
  var BUTTON_MARGIN_TOP3 = 12;
1176
1197
  var BUTTON_FONT_SIZE3 = 16;
1177
- var styles11 = StyleSheet.create({
1198
+ var styles12 = StyleSheet.create({
1178
1199
  container: {
1179
1200
  flex: 1,
1180
1201
  justifyContent: "center",
@@ -1248,10 +1269,10 @@ var ErrorBoundaryFallback = ({
1248
1269
  accessibilityHint: labels.tryAgainHint,
1249
1270
  accessibilityLabel: labels.tryAgain,
1250
1271
  accessibilityRole: "button",
1251
- style: [styles11.button, reloadIsPrimary ? secondaryFill : primaryFill],
1272
+ style: [styles12.button, reloadIsPrimary ? secondaryFill : primaryFill],
1252
1273
  testID: `${testIDPrefix}-retry-button`,
1253
1274
  onPress: onRetry,
1254
- children: /* @__PURE__ */ jsx(Text, { style: [styles11.buttonText, reloadIsPrimary ? secondaryInk : primaryInk], children: labels.tryAgain })
1275
+ children: /* @__PURE__ */ jsx(Text, { style: [styles12.buttonText, reloadIsPrimary ? secondaryInk : primaryInk], children: labels.tryAgain })
1255
1276
  }
1256
1277
  ) : null;
1257
1278
  const reloadButton = typeof onReload === "function" ? /* @__PURE__ */ jsx(
@@ -1260,10 +1281,10 @@ var ErrorBoundaryFallback = ({
1260
1281
  accessibilityHint: labels.reloadHint,
1261
1282
  accessibilityLabel: labels.reload,
1262
1283
  accessibilityRole: "button",
1263
- style: [styles11.button, reloadIsPrimary ? primaryFill : secondaryFill],
1284
+ style: [styles12.button, reloadIsPrimary ? primaryFill : secondaryFill],
1264
1285
  testID: `${testIDPrefix}-reload-button`,
1265
1286
  onPress: onReload,
1266
- children: /* @__PURE__ */ jsx(Text, { style: [styles11.buttonText, reloadIsPrimary ? primaryInk : secondaryInk], children: labels.reload })
1287
+ children: /* @__PURE__ */ jsx(Text, { style: [styles12.buttonText, reloadIsPrimary ? primaryInk : secondaryInk], children: labels.reload })
1267
1288
  }
1268
1289
  ) : null;
1269
1290
  return /* @__PURE__ */ jsx(
@@ -1271,20 +1292,20 @@ var ErrorBoundaryFallback = ({
1271
1292
  {
1272
1293
  accessibilityLiveRegion: "assertive",
1273
1294
  role: "alert",
1274
- style: [styles11.container, { backgroundColor: theme.colors.background }],
1295
+ style: [styles12.container, { backgroundColor: theme.colors.background }],
1275
1296
  testID: testIDPrefix,
1276
- children: /* @__PURE__ */ jsxs(View, { style: styles11.content, children: [
1277
- logo !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles11.logo, testID: `${testIDPrefix}-logo`, children: logo }) : null,
1278
- /* @__PURE__ */ jsx(Text, { style: [styles11.title, { color: theme.colors.text }], children: labels.title }),
1297
+ children: /* @__PURE__ */ jsxs(View, { style: styles12.content, children: [
1298
+ logo !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles12.logo, testID: `${testIDPrefix}-logo`, children: logo }) : null,
1299
+ /* @__PURE__ */ jsx(Text, { style: [styles12.title, { color: theme.colors.text }], children: labels.title }),
1279
1300
  /* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
1280
1301
  hasDetails ? /* @__PURE__ */ jsxs(
1281
1302
  View,
1282
1303
  {
1283
- style: [styles11.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
1304
+ style: [styles12.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
1284
1305
  testID: `${testIDPrefix}-details`,
1285
1306
  children: [
1286
- /* @__PURE__ */ jsx(Text, { style: [styles11.detailsTitle, { color: warningText }], children: labels.errorDetails }),
1287
- /* @__PURE__ */ jsx(Text, { style: [styles11.detailsText, { color: theme.colors.textSecondary }], children: error.message })
1307
+ /* @__PURE__ */ jsx(Text, { style: [styles12.detailsTitle, { color: warningText }], children: labels.errorDetails }),
1308
+ /* @__PURE__ */ jsx(Text, { style: [styles12.detailsText, { color: theme.colors.textSecondary }], children: error.message })
1288
1309
  ]
1289
1310
  }
1290
1311
  ) : null,
@@ -1297,7 +1318,7 @@ var ErrorBoundaryFallback = ({
1297
1318
  var CONTAINER_PADDING4 = 20;
1298
1319
  var MESSAGE_FONT_SIZE3 = 16;
1299
1320
  var MESSAGE_MARGIN_TOP = 12;
1300
- var styles12 = StyleSheet.create({
1321
+ var styles13 = StyleSheet.create({
1301
1322
  container: {
1302
1323
  flex: 1,
1303
1324
  justifyContent: "center",
@@ -1320,11 +1341,11 @@ var ErrorBoundaryRecovering = ({
1320
1341
  {
1321
1342
  accessibilityLiveRegion: "polite",
1322
1343
  role: "status",
1323
- style: [styles12.container, { backgroundColor: theme.colors.background }],
1344
+ style: [styles13.container, { backgroundColor: theme.colors.background }],
1324
1345
  testID,
1325
1346
  children: [
1326
1347
  /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.palette.primary["500"], size: "large" }),
1327
- /* @__PURE__ */ jsx(Text, { style: [styles12.message, { color: theme.colors.textSecondary }], children: message })
1348
+ /* @__PURE__ */ jsx(Text, { style: [styles13.message, { color: theme.colors.textSecondary }], children: message })
1328
1349
  ]
1329
1350
  }
1330
1351
  );
@@ -1426,7 +1447,7 @@ var TRACK_MARGIN = 4;
1426
1447
  var INDET_FRACTION = 0.35;
1427
1448
  var INDET_DURATION_MS = 1300;
1428
1449
  var LABEL_FONT_SIZE = 12;
1429
- var styles13 = StyleSheet.create({
1450
+ var styles14 = StyleSheet.create({
1430
1451
  track: { height: BAR_HEIGHT, borderRadius: RADIUS, overflow: "hidden", marginVertical: TRACK_MARGIN },
1431
1452
  fill: { height: "100%", borderRadius: RADIUS },
1432
1453
  label: { fontSize: LABEL_FONT_SIZE, textAlign: "right", fontVariant: ["tabular-nums"] }
@@ -1445,7 +1466,7 @@ function IndeterminateFill({ color, width, testID }) {
1445
1466
  return /* @__PURE__ */ jsx(
1446
1467
  Animated.View,
1447
1468
  {
1448
- style: [styles13.fill, { backgroundColor: color, width: barWidth, transform: [{ translateX }] }],
1469
+ style: [styles14.fill, { backgroundColor: color, width: barWidth, transform: [{ translateX }] }],
1449
1470
  testID
1450
1471
  }
1451
1472
  );
@@ -1480,13 +1501,13 @@ function ProgressBar(props) {
1480
1501
  role: "progressbar",
1481
1502
  testID,
1482
1503
  children: [
1483
- /* @__PURE__ */ jsx(View, { style: [styles13.track, { backgroundColor: trackColor }], onLayout, children: indeterminate ? /* @__PURE__ */ jsx(IndeterminateFill, { color, testID: fillTestID, width }) : /* @__PURE__ */ jsx(View, { style: [styles13.fill, { backgroundColor: color, width: `${safePct}%` }], testID: fillTestID }) }),
1484
- !indeterminate && label !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles13.label, { color: textColor }], children: label }) : null
1504
+ /* @__PURE__ */ jsx(View, { style: [styles14.track, { backgroundColor: trackColor }], onLayout, children: indeterminate ? /* @__PURE__ */ jsx(IndeterminateFill, { color, testID: fillTestID, width }) : /* @__PURE__ */ jsx(View, { style: [styles14.fill, { backgroundColor: color, width: `${safePct}%` }], testID: fillTestID }) }),
1505
+ !indeterminate && label !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles14.label, { color: textColor }], children: label }) : null
1485
1506
  ]
1486
1507
  }
1487
1508
  );
1488
1509
  }
1489
- var styles14 = StyleSheet.create({
1510
+ var styles15 = StyleSheet.create({
1490
1511
  button: {
1491
1512
  minHeight: MIN_TOUCH_TARGET_PX,
1492
1513
  minWidth: MIN_TOUCH_TARGET_PX,
@@ -1509,9 +1530,9 @@ function RunCardButton({ label, hint, color, onPress, testID, disabled = false,
1509
1530
  accessibilityState: { disabled, expanded },
1510
1531
  disabled,
1511
1532
  onPress,
1512
- style: [styles14.button, { borderColor: color }, disabled ? { opacity: DISABLED_OPACITY } : null],
1533
+ style: [styles15.button, { borderColor: color }, disabled ? { opacity: DISABLED_OPACITY } : null],
1513
1534
  testID,
1514
- children: /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color }], children: label })
1535
+ children: /* @__PURE__ */ jsx(Text, { style: [styles15.text, { color }], children: label })
1515
1536
  }
1516
1537
  );
1517
1538
  }
@@ -1589,7 +1610,7 @@ function runToneTextColor(theme, state) {
1589
1610
  return inks[state] ?? runToneColor(theme, state);
1590
1611
  }
1591
1612
  var MARK = { done: "\u2713", running: "\u25CF", pending: "\u25CB", failed: "\u2715" };
1592
- var styles15 = StyleSheet.create({
1613
+ var styles16 = StyleSheet.create({
1593
1614
  row: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
1594
1615
  chip: { borderWidth: 1, borderRadius: 6, paddingHorizontal: 10, justifyContent: "center" },
1595
1616
  tap: { minHeight: MIN_TOUCH_TARGET_PX },
@@ -1602,15 +1623,15 @@ function chipText(group, labels) {
1602
1623
  }
1603
1624
  function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect }) {
1604
1625
  const { theme } = useFeedbackUi();
1605
- return /* @__PURE__ */ jsx(View, { style: styles15.row, testID, children: groups.map((group) => {
1626
+ return /* @__PURE__ */ jsx(View, { style: styles16.row, testID, children: groups.map((group) => {
1606
1627
  const color = runToneColor(theme, group.state);
1607
1628
  const ink = runToneTextColor(theme, group.state);
1608
1629
  const selected = group.id === selectedId;
1609
1630
  const a11y = labels.groupA11y(group.label, group.state, labels.formatDuration(group.durationSec));
1610
- const body = /* @__PURE__ */ jsx(Text, { style: [styles15.text, { color: ink }, selected || group.state === "running" ? styles15.strong : null], children: chipText(group, labels) });
1611
- const look = [styles15.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
1631
+ const body = /* @__PURE__ */ jsx(Text, { style: [styles16.text, { color: ink }, selected || group.state === "running" ? styles16.strong : null], children: chipText(group, labels) });
1632
+ const look = [styles16.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
1612
1633
  if (onSelect === void 0) {
1613
- return /* @__PURE__ */ jsx(View, { style: [look, styles15.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
1634
+ return /* @__PURE__ */ jsx(View, { style: [look, styles16.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
1614
1635
  }
1615
1636
  return /* @__PURE__ */ jsx(
1616
1637
  Pressable,
@@ -1620,7 +1641,7 @@ function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect })
1620
1641
  accessibilityHint: labels.groupHint,
1621
1642
  accessibilityState: { selected },
1622
1643
  onPress: () => onSelect(group.id),
1623
- style: [look, styles15.tap],
1644
+ style: [look, styles16.tap],
1624
1645
  testID: `${testID}-${group.id}`,
1625
1646
  children: body
1626
1647
  },
@@ -1634,8 +1655,8 @@ function RunGroupSummary({ groups, labels, testID }) {
1634
1655
  const open = groups.filter((g) => g.state !== "done");
1635
1656
  const doneColor = runToneColor(theme, "done");
1636
1657
  const doneText = labels.doneSummary(done.count, labels.formatDuration(done.durationSec));
1637
- return /* @__PURE__ */ jsxs(View, { style: styles15.row, testID, children: [
1638
- done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [styles15.chip, styles15.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsx(Text, { style: [styles15.text, { color: runToneTextColor(theme, "done") }], children: `${MARK.done} ${doneText}` }) }) : null,
1658
+ return /* @__PURE__ */ jsxs(View, { style: styles16.row, testID, children: [
1659
+ done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [styles16.chip, styles16.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsx(Text, { style: [styles16.text, { color: runToneTextColor(theme, "done") }], children: `${MARK.done} ${doneText}` }) }) : null,
1639
1660
  /* @__PURE__ */ jsx(RunGroupChips, { groups: open, labels, testID: `${testID}-open` })
1640
1661
  ] });
1641
1662
  }
@@ -1645,7 +1666,7 @@ var LABEL_SHARE = "35%";
1645
1666
  var LABEL_LINES = 2;
1646
1667
  var DURATION_WIDTH = 64;
1647
1668
  var PERCENT = 100;
1648
- var styles16 = StyleSheet.create({
1669
+ var styles17 = StyleSheet.create({
1649
1670
  list: { gap: 6 },
1650
1671
  row: { flexDirection: "row", alignItems: "center", gap: 8 },
1651
1672
  stack: { gap: 4 },
@@ -1664,22 +1685,22 @@ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
1664
1685
  const maxSec = steps.reduce((m, s) => Math.max(m, s.durationSec), 0);
1665
1686
  const folded = split.hiddenCount > 0;
1666
1687
  const canFold = all && steps.length > maxBars;
1667
- return /* @__PURE__ */ jsxs(View, { style: styles16.list, testID, children: [
1688
+ return /* @__PURE__ */ jsxs(View, { style: styles17.list, testID, children: [
1668
1689
  split.visible.map((step, i) => {
1669
1690
  const color = runToneColor(theme, step.state);
1670
1691
  const duration = labels.formatDuration(step.durationSec);
1671
- const strong = step.state === "running" ? styles16.strong : null;
1672
- const name = /* @__PURE__ */ jsx(Text, { style: [compact ? styles16.compactLabel : styles16.label, { color: theme.colors.text }, strong], numberOfLines: LABEL_LINES, testID: `${testID}-name-${String(i)}`, children: step.label });
1673
- const time = /* @__PURE__ */ jsx(Text, { style: [styles16.duration, { color: theme.colors.textSecondary }, strong], children: duration });
1674
- const bar = /* @__PURE__ */ jsx(View, { style: [compact ? styles16.fullTrack : styles16.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles16.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) });
1692
+ const strong = step.state === "running" ? styles17.strong : null;
1693
+ const name = /* @__PURE__ */ jsx(Text, { style: [compact ? styles17.compactLabel : styles17.label, { color: theme.colors.text }, strong], numberOfLines: LABEL_LINES, testID: `${testID}-name-${String(i)}`, children: step.label });
1694
+ const time = /* @__PURE__ */ jsx(Text, { style: [styles17.duration, { color: theme.colors.textSecondary }, strong], children: duration });
1695
+ const bar = /* @__PURE__ */ jsx(View, { style: [compact ? styles17.fullTrack : styles17.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles17.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) });
1675
1696
  const a11y = { accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}` };
1676
- return compact ? /* @__PURE__ */ jsxs(View, { style: styles16.stack, ...a11y, children: [
1677
- /* @__PURE__ */ jsxs(View, { style: styles16.row, children: [
1697
+ return compact ? /* @__PURE__ */ jsxs(View, { style: styles17.stack, ...a11y, children: [
1698
+ /* @__PURE__ */ jsxs(View, { style: styles17.row, children: [
1678
1699
  name,
1679
1700
  time
1680
1701
  ] }),
1681
1702
  bar
1682
- ] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxs(View, { style: styles16.row, ...a11y, children: [
1703
+ ] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxs(View, { style: styles17.row, ...a11y, children: [
1683
1704
  name,
1684
1705
  bar,
1685
1706
  time
@@ -1700,7 +1721,7 @@ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
1700
1721
  }
1701
1722
  var LIVE_RUN_CARD_COMPACT_MAX_PX = 640;
1702
1723
  var DEFAULT_MAX_BARS = 4;
1703
- var styles17 = StyleSheet.create({
1724
+ var styles18 = StyleSheet.create({
1704
1725
  card: { borderWidth: 1, borderRadius: 8, padding: 14, gap: 10 },
1705
1726
  head: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10 },
1706
1727
  titleBox: { flexGrow: 1, flexShrink: 1, flexBasis: 200, minWidth: 0, gap: 2 },
@@ -1725,25 +1746,68 @@ function LiveRunCard(props) {
1725
1746
  const percent = progressPercent(progress);
1726
1747
  const showTimings = !compact || open;
1727
1748
  const muted = { color: theme.colors.textSecondary };
1728
- return /* @__PURE__ */ jsxs(View, { style: [styles17.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
1729
- /* @__PURE__ */ jsxs(View, { style: styles17.head, children: [
1730
- /* @__PURE__ */ jsx(View, { style: [styles17.pill, { borderColor: tone }], children: /* @__PURE__ */ jsx(Text, { style: [styles17.pillText, { color: toneText }], testID: `${testID}-status`, children: labels.status }) }),
1731
- /* @__PURE__ */ jsxs(View, { style: styles17.titleBox, children: [
1732
- /* @__PURE__ */ jsx(Text, { style: [styles17.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
1733
- /* @__PURE__ */ jsx(Text, { style: [styles17.meta, muted], testID: `${testID}-meta`, children: labels.meta })
1749
+ return /* @__PURE__ */ jsxs(View, { style: [styles18.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
1750
+ /* @__PURE__ */ jsxs(View, { style: styles18.head, children: [
1751
+ /* @__PURE__ */ jsx(View, { style: [styles18.pill, { borderColor: tone }], children: /* @__PURE__ */ jsx(Text, { style: [styles18.pillText, { color: toneText }], testID: `${testID}-status`, children: labels.status }) }),
1752
+ /* @__PURE__ */ jsxs(View, { style: styles18.titleBox, children: [
1753
+ /* @__PURE__ */ jsx(Text, { style: [styles18.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
1754
+ /* @__PURE__ */ jsx(Text, { style: [styles18.meta, muted], testID: `${testID}-meta`, children: labels.meta })
1734
1755
  ] }),
1735
1756
  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
1736
1757
  ] }),
1737
- currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [styles17.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
1758
+ currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [styles18.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
1738
1759
  percent !== null ? /* @__PURE__ */ jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
1739
- percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles17.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
1760
+ percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles18.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
1740
1761
  compact && !open ? /* @__PURE__ */ jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
1741
1762
  compact ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.stepTimings, hint: labels.stepTimingsHint, color: theme.colors.textSecondary, onPress: () => setOpen(!open), expanded: open, testID: `${testID}-timings-toggle` }) : null,
1742
1763
  showTimings ? /* @__PURE__ */ jsx(RunGroupChips, { groups, labels, selectedId, onSelect: setPicked, testID: `${testID}-groups` }) : null,
1743
1764
  showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsx(RunStepBars, { steps: selected.steps, maxBars, labels, compact, testID: `${testID}-steps` }, selected.id) : null
1744
1765
  ] });
1745
1766
  }
1767
+ function useLocalModel(model) {
1768
+ const state = useSyncExternalStore(model.subscribe, model.state);
1769
+ useEffect(() => {
1770
+ model.check().catch(() => void 0);
1771
+ }, [model]);
1772
+ return state;
1773
+ }
1774
+ var PERCENT2 = 100;
1775
+ var LocalModelGate = ({
1776
+ model,
1777
+ labels,
1778
+ testIds,
1779
+ slots,
1780
+ children
1781
+ }) => {
1782
+ const { phase, block, progress } = useLocalModel(model);
1783
+ const consent = useCallback(() => {
1784
+ model.consent().catch(() => void 0);
1785
+ }, [model]);
1786
+ const { Card, Text: Text16, Button } = slots;
1787
+ switch (phase) {
1788
+ case LocalModelPhase.Checking:
1789
+ return null;
1790
+ case LocalModelPhase.Blocked:
1791
+ return /* @__PURE__ */ jsx(Card, { testID: testIds.blocked, children: /* @__PURE__ */ jsx(Text16, { children: labels.blocked(block) }) });
1792
+ case LocalModelPhase.Offer:
1793
+ return /* @__PURE__ */ jsxs(Card, { testID: testIds.offer, children: [
1794
+ /* @__PURE__ */ jsx(Text16, { heading: true, children: labels.title }),
1795
+ /* @__PURE__ */ jsx(Text16, { children: labels.offerBody }),
1796
+ /* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.consent, testID: testIds.consent, onPress: consent })
1797
+ ] });
1798
+ case LocalModelPhase.Loading:
1799
+ return /* @__PURE__ */ jsx(Card, { testID: testIds.loading, children: /* @__PURE__ */ jsx(Text16, { children: labels.loading(String(Math.round(progress * PERCENT2))) }) });
1800
+ case LocalModelPhase.Failed:
1801
+ return /* @__PURE__ */ jsxs(Card, { testID: testIds.failed, children: [
1802
+ /* @__PURE__ */ jsx(Text16, { children: labels.failed }),
1803
+ /* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.retry, testID: testIds.consent, onPress: consent })
1804
+ ] });
1805
+ case LocalModelPhase.Ready:
1806
+ default:
1807
+ return children;
1808
+ }
1809
+ };
1746
1810
 
1747
- export { AppErrorBoundary, AsyncSurface, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, MODAL_OVERLAY_COLOR, PageSkeleton, ProgressBar, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
1811
+ export { AppErrorBoundary, AsyncSurface, COPY_FEEDBACK_MS, 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, PageSkeleton, ProgressBar, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useLocalModel, useFeedbackUi as useUi };
1748
1812
  //# sourceMappingURL=index.mjs.map
1749
1813
  //# sourceMappingURL=index.mjs.map