@dloizides/ui-layout 1.40.3 → 1.42.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 +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +116 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -559,6 +559,22 @@ interface ConfirmDialogProps {
|
|
|
559
559
|
}
|
|
560
560
|
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
561
561
|
|
|
562
|
+
interface FormDialogProps {
|
|
563
|
+
visible: boolean;
|
|
564
|
+
title: string;
|
|
565
|
+
children: React.ReactNode;
|
|
566
|
+
submitLabel: string;
|
|
567
|
+
submitHint: string;
|
|
568
|
+
cancelLabel?: string;
|
|
569
|
+
loading?: boolean;
|
|
570
|
+
onSubmit: () => void;
|
|
571
|
+
onCancel: () => void;
|
|
572
|
+
size?: ModalSize;
|
|
573
|
+
testID?: string;
|
|
574
|
+
}
|
|
575
|
+
/** A centred dialog of form fields with Cancel + Submit; ids `${testID}-dialog`, `-save`, `-cancel`. */
|
|
576
|
+
declare const FormDialog: ({ visible, title, children, submitLabel, submitHint, cancelLabel, loading, onSubmit, onCancel, size, testID, }: FormDialogProps) => React.ReactElement;
|
|
577
|
+
|
|
562
578
|
/**
|
|
563
579
|
* AccordionVariant — the two visual treatments for an {@link Accordion}.
|
|
564
580
|
*
|
|
@@ -910,10 +926,14 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
910
926
|
readonly bottomSheet: "bottom-sheet";
|
|
911
927
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
912
928
|
readonly confirmDialog: "confirm-dialog";
|
|
929
|
+
/** Default base testID for `FormDialog`: `form-dialog`, `form-save`, `form-cancel`. */
|
|
930
|
+
readonly formDialog: "form";
|
|
913
931
|
readonly accordion: "accordion";
|
|
914
932
|
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
915
933
|
readonly buildInfoFooter: "build-info-footer";
|
|
916
934
|
};
|
|
935
|
+
/** Window width (px) below which a dialog footer stacks its actions full width. */
|
|
936
|
+
declare const MODAL_FOOTER_STACK_BELOW = 400;
|
|
917
937
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
918
938
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
919
939
|
/**
|
|
@@ -1006,6 +1026,12 @@ declare const TYPE_SCALE_BREAKPOINT = 600;
|
|
|
1006
1026
|
* `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.
|
|
1007
1027
|
*/
|
|
1008
1028
|
declare const LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
1029
|
+
/**
|
|
1030
|
+
* Viewport width (px) below which a header stacks its identity block (name,
|
|
1031
|
+
* email, account) on its own full-width row under the bar, so long text wraps
|
|
1032
|
+
* by word instead of in a narrow column (TEXT-FIT-1).
|
|
1033
|
+
*/
|
|
1034
|
+
declare const HEADER_STACK_BREAKPOINT = 400;
|
|
1009
1035
|
/**
|
|
1010
1036
|
* Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,
|
|
1011
1037
|
* never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.
|
|
@@ -1017,6 +1043,8 @@ declare const MIN_TARGET_PX = 44;
|
|
|
1017
1043
|
* `false`, whatever the width.
|
|
1018
1044
|
*/
|
|
1019
1045
|
declare function isWideWebViewport(width: number, platformOS: string, breakpoint?: number): boolean;
|
|
1046
|
+
/** Whether a dialog footer stacks its actions full width at this window width. */
|
|
1047
|
+
declare function isModalFooterStacked(width: number): boolean;
|
|
1020
1048
|
|
|
1021
1049
|
declare enum RowSelectedStyle {
|
|
1022
1050
|
Surface = "surface",
|
|
@@ -1078,4 +1106,4 @@ interface RowLook {
|
|
|
1078
1106
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1079
1107
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1080
1108
|
|
|
1081
|
-
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, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, 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, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -559,6 +559,22 @@ interface ConfirmDialogProps {
|
|
|
559
559
|
}
|
|
560
560
|
declare const ConfirmDialog: ({ visible, title, message, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, busy, testID, }: ConfirmDialogProps) => React.ReactElement;
|
|
561
561
|
|
|
562
|
+
interface FormDialogProps {
|
|
563
|
+
visible: boolean;
|
|
564
|
+
title: string;
|
|
565
|
+
children: React.ReactNode;
|
|
566
|
+
submitLabel: string;
|
|
567
|
+
submitHint: string;
|
|
568
|
+
cancelLabel?: string;
|
|
569
|
+
loading?: boolean;
|
|
570
|
+
onSubmit: () => void;
|
|
571
|
+
onCancel: () => void;
|
|
572
|
+
size?: ModalSize;
|
|
573
|
+
testID?: string;
|
|
574
|
+
}
|
|
575
|
+
/** A centred dialog of form fields with Cancel + Submit; ids `${testID}-dialog`, `-save`, `-cancel`. */
|
|
576
|
+
declare const FormDialog: ({ visible, title, children, submitLabel, submitHint, cancelLabel, loading, onSubmit, onCancel, size, testID, }: FormDialogProps) => React.ReactElement;
|
|
577
|
+
|
|
562
578
|
/**
|
|
563
579
|
* AccordionVariant — the two visual treatments for an {@link Accordion}.
|
|
564
580
|
*
|
|
@@ -910,10 +926,14 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
910
926
|
readonly bottomSheet: "bottom-sheet";
|
|
911
927
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
912
928
|
readonly confirmDialog: "confirm-dialog";
|
|
929
|
+
/** Default base testID for `FormDialog`: `form-dialog`, `form-save`, `form-cancel`. */
|
|
930
|
+
readonly formDialog: "form";
|
|
913
931
|
readonly accordion: "accordion";
|
|
914
932
|
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
915
933
|
readonly buildInfoFooter: "build-info-footer";
|
|
916
934
|
};
|
|
935
|
+
/** Window width (px) below which a dialog footer stacks its actions full width. */
|
|
936
|
+
declare const MODAL_FOOTER_STACK_BELOW = 400;
|
|
917
937
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
918
938
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
919
939
|
/**
|
|
@@ -1006,6 +1026,12 @@ declare const TYPE_SCALE_BREAKPOINT = 600;
|
|
|
1006
1026
|
* `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.
|
|
1007
1027
|
*/
|
|
1008
1028
|
declare const LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
1029
|
+
/**
|
|
1030
|
+
* Viewport width (px) below which a header stacks its identity block (name,
|
|
1031
|
+
* email, account) on its own full-width row under the bar, so long text wraps
|
|
1032
|
+
* by word instead of in a narrow column (TEXT-FIT-1).
|
|
1033
|
+
*/
|
|
1034
|
+
declare const HEADER_STACK_BREAKPOINT = 400;
|
|
1009
1035
|
/**
|
|
1010
1036
|
* Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,
|
|
1011
1037
|
* never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.
|
|
@@ -1017,6 +1043,8 @@ declare const MIN_TARGET_PX = 44;
|
|
|
1017
1043
|
* `false`, whatever the width.
|
|
1018
1044
|
*/
|
|
1019
1045
|
declare function isWideWebViewport(width: number, platformOS: string, breakpoint?: number): boolean;
|
|
1046
|
+
/** Whether a dialog footer stacks its actions full width at this window width. */
|
|
1047
|
+
declare function isModalFooterStacked(width: number): boolean;
|
|
1020
1048
|
|
|
1021
1049
|
declare enum RowSelectedStyle {
|
|
1022
1050
|
Surface = "surface",
|
|
@@ -1078,4 +1106,4 @@ interface RowLook {
|
|
|
1078
1106
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1079
1107
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1080
1108
|
|
|
1081
|
-
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, Heading, type HeadingLevel, type HeadingProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, 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, isWideWebViewport, pageScale, resolveRowLook, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -109,10 +109,13 @@ var LAYOUT_TEST_IDS = {
|
|
|
109
109
|
bottomSheet: "bottom-sheet",
|
|
110
110
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
111
111
|
confirmDialog: "confirm-dialog",
|
|
112
|
+
/** Default base testID for `FormDialog`: `form-dialog`, `form-save`, `form-cancel`. */
|
|
113
|
+
formDialog: "form",
|
|
112
114
|
accordion: "accordion",
|
|
113
115
|
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
114
116
|
buildInfoFooter: "build-info-footer"
|
|
115
117
|
};
|
|
118
|
+
var MODAL_FOOTER_STACK_BELOW = 400;
|
|
116
119
|
var DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
117
120
|
var LAYOUT_I18N = {
|
|
118
121
|
/** Placeholder shown by `ModalDropdown` when no option matches the current value. */
|
|
@@ -174,6 +177,7 @@ var LAYOUT_I18N = {
|
|
|
174
177
|
};
|
|
175
178
|
var TYPE_SCALE_BREAKPOINT = 600;
|
|
176
179
|
var LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
180
|
+
var HEADER_STACK_BREAKPOINT = 400;
|
|
177
181
|
var MIN_TARGET_PX = 44;
|
|
178
182
|
|
|
179
183
|
// src/responsive.ts
|
|
@@ -181,6 +185,9 @@ var WEB_PLATFORM = "web";
|
|
|
181
185
|
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
182
186
|
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
183
187
|
}
|
|
188
|
+
function isModalFooterStacked(width) {
|
|
189
|
+
return width < MODAL_FOOTER_STACK_BELOW;
|
|
190
|
+
}
|
|
184
191
|
|
|
185
192
|
// src/hooks/useIsWideViewport.ts
|
|
186
193
|
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
@@ -484,6 +491,7 @@ var DIALOG_RADIUS = 12;
|
|
|
484
491
|
var DIALOG_PADDING = 16;
|
|
485
492
|
var HEADER_GAP = 12;
|
|
486
493
|
var FOOTER_MARGIN = 16;
|
|
494
|
+
var FOOTER_GAP = 12;
|
|
487
495
|
var HEADER_MARGIN = 12;
|
|
488
496
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
489
497
|
var PANEL_ENTER_SCALE = 0.96;
|
|
@@ -515,8 +523,27 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
515
523
|
},
|
|
516
524
|
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
517
525
|
titleWrap: { flex: 1 },
|
|
518
|
-
|
|
526
|
+
footerRow: {
|
|
527
|
+
marginTop: FOOTER_MARGIN,
|
|
528
|
+
flexDirection: "row",
|
|
529
|
+
flexWrap: "wrap",
|
|
530
|
+
justifyContent: "flex-end",
|
|
531
|
+
alignItems: "center",
|
|
532
|
+
columnGap: FOOTER_GAP,
|
|
533
|
+
rowGap: FOOTER_GAP
|
|
534
|
+
},
|
|
535
|
+
footerStack: {
|
|
536
|
+
marginTop: FOOTER_MARGIN,
|
|
537
|
+
flexDirection: "column-reverse",
|
|
538
|
+
alignItems: "stretch",
|
|
539
|
+
rowGap: FOOTER_GAP
|
|
540
|
+
}
|
|
519
541
|
});
|
|
542
|
+
var ModalFooter = ({ children, testID }) => {
|
|
543
|
+
const { width } = reactNative.useWindowDimensions();
|
|
544
|
+
const style = isModalFooterStacked(width) ? styles6.footerStack : styles6.footerRow;
|
|
545
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
|
|
546
|
+
};
|
|
520
547
|
var Modal = ({
|
|
521
548
|
visible,
|
|
522
549
|
onClose,
|
|
@@ -593,7 +620,7 @@ var Modal = ({
|
|
|
593
620
|
) : null
|
|
594
621
|
] }) : null,
|
|
595
622
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
596
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
623
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { testID: `${testID}-footer`, children: footer }) : null
|
|
597
624
|
]
|
|
598
625
|
}
|
|
599
626
|
)
|
|
@@ -2025,10 +2052,8 @@ var BottomSheet = ({
|
|
|
2025
2052
|
};
|
|
2026
2053
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
2027
2054
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
2028
|
-
var BUTTON_GAP = 12;
|
|
2029
2055
|
var styles18 = reactNative.StyleSheet.create({
|
|
2030
|
-
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT }
|
|
2031
|
-
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
2056
|
+
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT }
|
|
2032
2057
|
});
|
|
2033
2058
|
var ConfirmDialog = ({
|
|
2034
2059
|
visible,
|
|
@@ -2045,7 +2070,7 @@ var ConfirmDialog = ({
|
|
|
2045
2070
|
const { theme, t } = uiFeedback.useUi();
|
|
2046
2071
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
2047
2072
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
2048
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2073
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2049
2074
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2050
2075
|
uiButtons.Button,
|
|
2051
2076
|
{
|
|
@@ -2085,6 +2110,87 @@ var ConfirmDialog = ({
|
|
|
2085
2110
|
}
|
|
2086
2111
|
);
|
|
2087
2112
|
};
|
|
2113
|
+
var FIELD_SELECTOR = "input:not([disabled]), textarea:not([disabled]), select:not([disabled])";
|
|
2114
|
+
var FORM_STYLE = { display: "contents" };
|
|
2115
|
+
var WebFormBody = ({ children, visible, onSubmit }) => {
|
|
2116
|
+
const formRef = React14.useRef(null);
|
|
2117
|
+
React14.useEffect(() => {
|
|
2118
|
+
if (reactNative.Platform.OS !== "web" || !visible) return;
|
|
2119
|
+
formRef.current?.querySelector(FIELD_SELECTOR)?.focus();
|
|
2120
|
+
}, [visible]);
|
|
2121
|
+
const handleSubmit = React14.useCallback(
|
|
2122
|
+
(event) => {
|
|
2123
|
+
event.preventDefault();
|
|
2124
|
+
onSubmit();
|
|
2125
|
+
},
|
|
2126
|
+
[onSubmit]
|
|
2127
|
+
);
|
|
2128
|
+
if (reactNative.Platform.OS !== "web") return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2129
|
+
return React14__default.default.createElement(
|
|
2130
|
+
"form",
|
|
2131
|
+
{ ref: formRef, noValidate: true, style: FORM_STYLE, onSubmit: handleSubmit },
|
|
2132
|
+
children,
|
|
2133
|
+
React14__default.default.createElement("button", { type: "submit", hidden: true, tabIndex: -1, "aria-hidden": true })
|
|
2134
|
+
);
|
|
2135
|
+
};
|
|
2136
|
+
var FormDialogActions = (props) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2138
|
+
uiButtons.Button,
|
|
2139
|
+
{
|
|
2140
|
+
accessibilityHint: props.cancelHint,
|
|
2141
|
+
accessibilityLabel: props.cancelLabel,
|
|
2142
|
+
disabled: props.loading,
|
|
2143
|
+
label: props.cancelLabel,
|
|
2144
|
+
testID: `${props.testID}-cancel`,
|
|
2145
|
+
variant: "secondary",
|
|
2146
|
+
onPress: props.onCancel
|
|
2147
|
+
}
|
|
2148
|
+
),
|
|
2149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2150
|
+
uiButtons.Button,
|
|
2151
|
+
{
|
|
2152
|
+
accessibilityHint: props.submitHint,
|
|
2153
|
+
accessibilityLabel: props.submitLabel,
|
|
2154
|
+
label: props.submitLabel,
|
|
2155
|
+
loading: props.loading,
|
|
2156
|
+
testID: `${props.testID}-save`,
|
|
2157
|
+
variant: "primary",
|
|
2158
|
+
onPress: props.onSubmit
|
|
2159
|
+
}
|
|
2160
|
+
)
|
|
2161
|
+
] });
|
|
2162
|
+
var FormDialog = ({
|
|
2163
|
+
visible,
|
|
2164
|
+
title,
|
|
2165
|
+
children,
|
|
2166
|
+
submitLabel,
|
|
2167
|
+
submitHint,
|
|
2168
|
+
cancelLabel,
|
|
2169
|
+
loading = false,
|
|
2170
|
+
onSubmit,
|
|
2171
|
+
onCancel,
|
|
2172
|
+
size = "md",
|
|
2173
|
+
testID = LAYOUT_TEST_IDS.formDialog
|
|
2174
|
+
}) => {
|
|
2175
|
+
const { t } = uiFeedback.useUi();
|
|
2176
|
+
const submit = React14.useCallback(() => {
|
|
2177
|
+
if (!loading) onSubmit();
|
|
2178
|
+
}, [loading, onSubmit]);
|
|
2179
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2180
|
+
FormDialogActions,
|
|
2181
|
+
{
|
|
2182
|
+
cancelHint: t(LAYOUT_I18N.cancelHint),
|
|
2183
|
+
cancelLabel: cancelLabel ?? t(LAYOUT_I18N.cancel),
|
|
2184
|
+
loading,
|
|
2185
|
+
submitHint,
|
|
2186
|
+
submitLabel,
|
|
2187
|
+
testID,
|
|
2188
|
+
onCancel,
|
|
2189
|
+
onSubmit: submit
|
|
2190
|
+
}
|
|
2191
|
+
);
|
|
2192
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Modal, { footer, size, testID: `${testID}-dialog`, title, visible, onClose: onCancel, children: /* @__PURE__ */ jsxRuntime.jsx(WebFormBody, { visible, onSubmit: submit, children }) });
|
|
2193
|
+
};
|
|
2088
2194
|
var AccordionContext = React14.createContext(null);
|
|
2089
2195
|
function useAccordionContext() {
|
|
2090
2196
|
const value = React14.useContext(AccordionContext);
|
|
@@ -2968,12 +3074,15 @@ exports.CopyableId = CopyableId;
|
|
|
2968
3074
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
2969
3075
|
exports.DropdownVariant = DropdownVariant;
|
|
2970
3076
|
exports.ELLIPSIS = ELLIPSIS;
|
|
3077
|
+
exports.FormDialog = FormDialog;
|
|
3078
|
+
exports.HEADER_STACK_BREAKPOINT = HEADER_STACK_BREAKPOINT;
|
|
2971
3079
|
exports.Heading = Heading;
|
|
2972
3080
|
exports.LAYOUT_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
2973
3081
|
exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
2974
3082
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2975
3083
|
exports.ListRow = ListRow;
|
|
2976
3084
|
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
3085
|
+
exports.MODAL_FOOTER_STACK_BELOW = MODAL_FOOTER_STACK_BELOW;
|
|
2977
3086
|
exports.Modal = Modal;
|
|
2978
3087
|
exports.ModalDropdown = ModalDropdown;
|
|
2979
3088
|
exports.ModalShell = ModalShell;
|
|
@@ -2997,6 +3106,7 @@ exports.copyText = copyText;
|
|
|
2997
3106
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2998
3107
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2999
3108
|
exports.isKeyboardOpen = isKeyboardOpen;
|
|
3109
|
+
exports.isModalFooterStacked = isModalFooterStacked;
|
|
3000
3110
|
exports.isWideWebViewport = isWideWebViewport;
|
|
3001
3111
|
exports.pageScale = pageScale;
|
|
3002
3112
|
exports.resolveRowLook = resolveRowLook;
|