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