@dloizides/ui-layout 1.42.0 → 1.43.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 +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +63 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -489,7 +489,7 @@ interface ModalProps {
|
|
|
489
489
|
testID?: string;
|
|
490
490
|
/** Accessible name of the dialog. Falls back to `title`, then the neutral "dialog" key. */
|
|
491
491
|
accessibilityLabel?: string;
|
|
492
|
-
/** testID
|
|
492
|
+
/** testID focused on open (web); the dialog's own testID focuses the dialog. Default: autoFocus child, else first focusable. */
|
|
493
493
|
initialFocusTestID?: string;
|
|
494
494
|
}
|
|
495
495
|
declare const Modal: ({ visible, onClose, title, children, footer, size, showClose, testID, accessibilityLabel, initialFocusTestID, }: ModalProps) => React.ReactElement;
|
|
@@ -521,6 +521,13 @@ interface BottomSheetProps {
|
|
|
521
521
|
/** A content-height panel docked to the screen bottom, with a dimmed backdrop and an optional pinned footer. */
|
|
522
522
|
declare const BottomSheet: ({ visible, onClose, title, children, footer, maxHeightFraction, testID, accessibilityLabel, initialFocusTestID, }: BottomSheetProps) => React.ReactElement;
|
|
523
523
|
|
|
524
|
+
/** Which control a {@link ConfirmDialog} focuses on open (web). `None` focuses the dialog itself. */
|
|
525
|
+
declare const enum ConfirmDialogFocus {
|
|
526
|
+
Cancel = "cancel",
|
|
527
|
+
Confirm = "confirm",
|
|
528
|
+
None = "none"
|
|
529
|
+
}
|
|
530
|
+
|
|
524
531
|
/**
|
|
525
532
|
* ConfirmDialog — a confirm/cancel popup built ON {@link Modal}, for the "are you sure?" moment.
|
|
526
533
|
*
|
|
@@ -554,10 +561,12 @@ interface ConfirmDialogProps {
|
|
|
554
561
|
onCancel: () => void;
|
|
555
562
|
/** In-flight: Confirm shows a spinner and Cancel is disabled. Default `false`. */
|
|
556
563
|
busy?: boolean;
|
|
564
|
+
/** Control focused on open (web). Default `Cancel`; never use `Confirm` for a destructive action. */
|
|
565
|
+
initialFocus?: ConfirmDialogFocus;
|
|
557
566
|
/** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */
|
|
558
567
|
testID?: string;
|
|
559
568
|
}
|
|
560
|
-
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
569
|
+
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
561
570
|
|
|
562
571
|
interface FormDialogProps {
|
|
563
572
|
visible: boolean;
|
|
@@ -1106,4 +1115,4 @@ interface RowLook {
|
|
|
1106
1115
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1107
1116
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1108
1117
|
|
|
1109
|
-
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, SideSheet, type SideSheetProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
1118
|
+
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, SideSheet, type SideSheetProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
package/dist/index.d.ts
CHANGED
|
@@ -489,7 +489,7 @@ interface ModalProps {
|
|
|
489
489
|
testID?: string;
|
|
490
490
|
/** Accessible name of the dialog. Falls back to `title`, then the neutral "dialog" key. */
|
|
491
491
|
accessibilityLabel?: string;
|
|
492
|
-
/** testID
|
|
492
|
+
/** testID focused on open (web); the dialog's own testID focuses the dialog. Default: autoFocus child, else first focusable. */
|
|
493
493
|
initialFocusTestID?: string;
|
|
494
494
|
}
|
|
495
495
|
declare const Modal: ({ visible, onClose, title, children, footer, size, showClose, testID, accessibilityLabel, initialFocusTestID, }: ModalProps) => React.ReactElement;
|
|
@@ -521,6 +521,13 @@ interface BottomSheetProps {
|
|
|
521
521
|
/** A content-height panel docked to the screen bottom, with a dimmed backdrop and an optional pinned footer. */
|
|
522
522
|
declare const BottomSheet: ({ visible, onClose, title, children, footer, maxHeightFraction, testID, accessibilityLabel, initialFocusTestID, }: BottomSheetProps) => React.ReactElement;
|
|
523
523
|
|
|
524
|
+
/** Which control a {@link ConfirmDialog} focuses on open (web). `None` focuses the dialog itself. */
|
|
525
|
+
declare const enum ConfirmDialogFocus {
|
|
526
|
+
Cancel = "cancel",
|
|
527
|
+
Confirm = "confirm",
|
|
528
|
+
None = "none"
|
|
529
|
+
}
|
|
530
|
+
|
|
524
531
|
/**
|
|
525
532
|
* ConfirmDialog — a confirm/cancel popup built ON {@link Modal}, for the "are you sure?" moment.
|
|
526
533
|
*
|
|
@@ -554,10 +561,12 @@ interface ConfirmDialogProps {
|
|
|
554
561
|
onCancel: () => void;
|
|
555
562
|
/** In-flight: Confirm shows a spinner and Cancel is disabled. Default `false`. */
|
|
556
563
|
busy?: boolean;
|
|
564
|
+
/** Control focused on open (web). Default `Cancel`; never use `Confirm` for a destructive action. */
|
|
565
|
+
initialFocus?: ConfirmDialogFocus;
|
|
557
566
|
/** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */
|
|
558
567
|
testID?: string;
|
|
559
568
|
}
|
|
560
|
-
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
569
|
+
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, initialFocus, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
561
570
|
|
|
562
571
|
interface FormDialogProps {
|
|
563
572
|
visible: boolean;
|
|
@@ -1106,4 +1115,4 @@ interface RowLook {
|
|
|
1106
1115
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1107
1116
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1108
1117
|
|
|
1109
|
-
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, SideSheet, type SideSheetProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
1118
|
+
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BottomSheet, type BottomSheetProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, type PageSize, type RowLook, type RowPalette, RowSelectedStyle, type RowState, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SelectedMarker, SideSheet, type SideSheetProps, StatusBadge, type StatusBadgeProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TextKind, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
package/dist/index.js
CHANGED
|
@@ -426,8 +426,14 @@ function getFocusableElements(container) {
|
|
|
426
426
|
function savePreviousFocus() {
|
|
427
427
|
return document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
428
428
|
}
|
|
429
|
+
var MAX_ATTACH_FRAMES = 10;
|
|
430
|
+
function findNamed(domNode, initialFocusTestID) {
|
|
431
|
+
if (initialFocusTestID === void 0) return null;
|
|
432
|
+
const selector = `[data-testid="${initialFocusTestID}"]`;
|
|
433
|
+
return domNode.matches(selector) ? domNode : domNode.querySelector(selector);
|
|
434
|
+
}
|
|
429
435
|
function focusInitial(domNode, initialFocusTestID) {
|
|
430
|
-
const named =
|
|
436
|
+
const named = findNamed(domNode, initialFocusTestID);
|
|
431
437
|
if (named) {
|
|
432
438
|
named.focus();
|
|
433
439
|
return;
|
|
@@ -461,15 +467,29 @@ function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
|
461
467
|
const previousFocusRef = React14.useRef(null);
|
|
462
468
|
React14.useEffect(() => {
|
|
463
469
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
let domNode = null;
|
|
471
|
+
let frame = 0;
|
|
472
|
+
let attempts = 0;
|
|
473
|
+
const listener = (e) => {
|
|
474
|
+
if (domNode) handleKeyDown(domNode, e);
|
|
475
|
+
};
|
|
476
|
+
const attach = () => {
|
|
477
|
+
const node = containerRef.current;
|
|
478
|
+
if (!node) {
|
|
479
|
+
attempts += 1;
|
|
480
|
+
if (attempts <= MAX_ATTACH_FRAMES) frame = requestAnimationFrame(attach);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
domNode = node;
|
|
484
|
+
const previous = savePreviousFocus();
|
|
485
|
+
previousFocusRef.current = previous !== null && node.contains(previous) ? null : previous;
|
|
486
|
+
queueMicrotask(() => focusInitial(node, initialFocusTestID));
|
|
487
|
+
node.addEventListener("keydown", listener);
|
|
488
|
+
};
|
|
489
|
+
attach();
|
|
471
490
|
return () => {
|
|
472
|
-
|
|
491
|
+
cancelAnimationFrame(frame);
|
|
492
|
+
domNode?.removeEventListener("keydown", listener);
|
|
473
493
|
previousFocusRef.current?.focus();
|
|
474
494
|
previousFocusRef.current = null;
|
|
475
495
|
};
|
|
@@ -508,7 +528,9 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
508
528
|
// react-native-web, which is why the fade is driven by `Animated` instead. `pointerEvents` lives
|
|
509
529
|
// in style (not the deprecated prop) so taps fall through to the sibling tap-catcher below.
|
|
510
530
|
scrim: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
531
|
+
backdrop: { zIndex: 0 },
|
|
511
532
|
dialog: {
|
|
533
|
+
zIndex: 1,
|
|
512
534
|
width: "100%",
|
|
513
535
|
borderRadius: DIALOG_RADIUS,
|
|
514
536
|
padding: DIALOG_PADDING,
|
|
@@ -571,6 +593,7 @@ var Modal = ({
|
|
|
571
593
|
[theme.colors.surface, size]
|
|
572
594
|
);
|
|
573
595
|
const hasHeader = title !== void 0 || showClose;
|
|
596
|
+
const focusesDialog = initialFocusTestID === testID;
|
|
574
597
|
const hardwareBackClose = reactNative.Platform.OS === "web" ? void 0 : onClose;
|
|
575
598
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.overlay, children: [
|
|
576
599
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -579,19 +602,6 @@ var Modal = ({
|
|
|
579
602
|
style: [reactNative.StyleSheet.absoluteFill, styles6.scrim, { opacity: backdrop.style.opacity }]
|
|
580
603
|
}
|
|
581
604
|
),
|
|
582
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
-
reactNative.TouchableOpacity,
|
|
584
|
-
{
|
|
585
|
-
accessible: true,
|
|
586
|
-
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
587
|
-
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
588
|
-
accessibilityRole: "button",
|
|
589
|
-
activeOpacity: 1,
|
|
590
|
-
style: reactNative.StyleSheet.absoluteFill,
|
|
591
|
-
testID: `${testID}-backdrop`,
|
|
592
|
-
onPress: onClose
|
|
593
|
-
}
|
|
594
|
-
),
|
|
595
605
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
596
606
|
reactNative.Animated.View,
|
|
597
607
|
{
|
|
@@ -600,6 +610,7 @@ var Modal = ({
|
|
|
600
610
|
"aria-label": accessibleName,
|
|
601
611
|
role: "dialog",
|
|
602
612
|
style: [dialogStyle, panel.style],
|
|
613
|
+
tabIndex: focusesDialog ? -1 : void 0,
|
|
603
614
|
testID,
|
|
604
615
|
children: [
|
|
605
616
|
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.headerRow, children: [
|
|
@@ -623,6 +634,20 @@ var Modal = ({
|
|
|
623
634
|
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { testID: `${testID}-footer`, children: footer }) : null
|
|
624
635
|
]
|
|
625
636
|
}
|
|
637
|
+
),
|
|
638
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
639
|
+
reactNative.TouchableOpacity,
|
|
640
|
+
{
|
|
641
|
+
accessible: true,
|
|
642
|
+
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
643
|
+
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
644
|
+
accessibilityRole: "button",
|
|
645
|
+
activeOpacity: 1,
|
|
646
|
+
style: [reactNative.StyleSheet.absoluteFill, styles6.backdrop],
|
|
647
|
+
focusable: false,
|
|
648
|
+
testID: `${testID}-backdrop`,
|
|
649
|
+
onPress: onClose
|
|
650
|
+
}
|
|
626
651
|
)
|
|
627
652
|
] }) });
|
|
628
653
|
};
|
|
@@ -2050,6 +2075,14 @@ var BottomSheet = ({
|
|
|
2050
2075
|
)
|
|
2051
2076
|
] }) });
|
|
2052
2077
|
};
|
|
2078
|
+
|
|
2079
|
+
// src/Modal/ConfirmDialogFocus.ts
|
|
2080
|
+
var ConfirmDialogFocus = /* @__PURE__ */ ((ConfirmDialogFocus2) => {
|
|
2081
|
+
ConfirmDialogFocus2["Cancel"] = "cancel";
|
|
2082
|
+
ConfirmDialogFocus2["Confirm"] = "confirm";
|
|
2083
|
+
ConfirmDialogFocus2["None"] = "none";
|
|
2084
|
+
return ConfirmDialogFocus2;
|
|
2085
|
+
})(ConfirmDialogFocus || {});
|
|
2053
2086
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
2054
2087
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
2055
2088
|
var styles18 = reactNative.StyleSheet.create({
|
|
@@ -2065,11 +2098,17 @@ var ConfirmDialog = ({
|
|
|
2065
2098
|
onConfirm,
|
|
2066
2099
|
onCancel,
|
|
2067
2100
|
busy = false,
|
|
2101
|
+
initialFocus = "cancel" /* Cancel */,
|
|
2068
2102
|
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
2069
2103
|
}) => {
|
|
2070
2104
|
const { theme, t } = uiFeedback.useUi();
|
|
2071
2105
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
2072
2106
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
2107
|
+
const focusTestID = {
|
|
2108
|
+
["cancel" /* Cancel */]: `${testID}-cancel`,
|
|
2109
|
+
["confirm" /* Confirm */]: `${testID}-confirm`,
|
|
2110
|
+
["none" /* None */]: testID
|
|
2111
|
+
};
|
|
2073
2112
|
const footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2074
2113
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2075
2114
|
uiButtons.Button,
|
|
@@ -2100,6 +2139,7 @@ var ConfirmDialog = ({
|
|
|
2100
2139
|
Modal,
|
|
2101
2140
|
{
|
|
2102
2141
|
footer,
|
|
2142
|
+
initialFocusTestID: focusTestID[initialFocus],
|
|
2103
2143
|
showClose: false,
|
|
2104
2144
|
size: "sm",
|
|
2105
2145
|
testID,
|
|
@@ -3069,6 +3109,7 @@ exports.BottomSheet = BottomSheet;
|
|
|
3069
3109
|
exports.BuildInfoFooter = BuildInfoFooter;
|
|
3070
3110
|
exports.COPY_FEEDBACK_MS = COPY_FEEDBACK_MS;
|
|
3071
3111
|
exports.ConfirmDialog = ConfirmDialog;
|
|
3112
|
+
exports.ConfirmDialogFocus = ConfirmDialogFocus;
|
|
3072
3113
|
exports.CopyStatus = CopyStatus;
|
|
3073
3114
|
exports.CopyableId = CopyableId;
|
|
3074
3115
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|