@dloizides/ui-layout 1.41.0 → 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 +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +114 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -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
|
/**
|
|
@@ -1023,6 +1043,8 @@ declare const MIN_TARGET_PX = 44;
|
|
|
1023
1043
|
* `false`, whatever the width.
|
|
1024
1044
|
*/
|
|
1025
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;
|
|
1026
1048
|
|
|
1027
1049
|
declare enum RowSelectedStyle {
|
|
1028
1050
|
Surface = "surface",
|
|
@@ -1084,4 +1106,4 @@ interface RowLook {
|
|
|
1084
1106
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1085
1107
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1086
1108
|
|
|
1087
|
-
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, 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, 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
|
/**
|
|
@@ -1023,6 +1043,8 @@ declare const MIN_TARGET_PX = 44;
|
|
|
1023
1043
|
* `false`, whatever the width.
|
|
1024
1044
|
*/
|
|
1025
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;
|
|
1026
1048
|
|
|
1027
1049
|
declare enum RowSelectedStyle {
|
|
1028
1050
|
Surface = "surface",
|
|
@@ -1084,4 +1106,4 @@ interface RowLook {
|
|
|
1084
1106
|
/** Resolves a row's container style and text colours from its selected style and state. */
|
|
1085
1107
|
declare function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook;
|
|
1086
1108
|
|
|
1087
|
-
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, 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, 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. */
|
|
@@ -182,6 +185,9 @@ var WEB_PLATFORM = "web";
|
|
|
182
185
|
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
183
186
|
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
184
187
|
}
|
|
188
|
+
function isModalFooterStacked(width) {
|
|
189
|
+
return width < MODAL_FOOTER_STACK_BELOW;
|
|
190
|
+
}
|
|
185
191
|
|
|
186
192
|
// src/hooks/useIsWideViewport.ts
|
|
187
193
|
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
@@ -485,6 +491,7 @@ var DIALOG_RADIUS = 12;
|
|
|
485
491
|
var DIALOG_PADDING = 16;
|
|
486
492
|
var HEADER_GAP = 12;
|
|
487
493
|
var FOOTER_MARGIN = 16;
|
|
494
|
+
var FOOTER_GAP = 12;
|
|
488
495
|
var HEADER_MARGIN = 12;
|
|
489
496
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
490
497
|
var PANEL_ENTER_SCALE = 0.96;
|
|
@@ -516,8 +523,27 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
516
523
|
},
|
|
517
524
|
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
518
525
|
titleWrap: { flex: 1 },
|
|
519
|
-
|
|
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
|
+
}
|
|
520
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
|
+
};
|
|
521
547
|
var Modal = ({
|
|
522
548
|
visible,
|
|
523
549
|
onClose,
|
|
@@ -594,7 +620,7 @@ var Modal = ({
|
|
|
594
620
|
) : null
|
|
595
621
|
] }) : null,
|
|
596
622
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
597
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
623
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { testID: `${testID}-footer`, children: footer }) : null
|
|
598
624
|
]
|
|
599
625
|
}
|
|
600
626
|
)
|
|
@@ -2026,10 +2052,8 @@ var BottomSheet = ({
|
|
|
2026
2052
|
};
|
|
2027
2053
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
2028
2054
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
2029
|
-
var BUTTON_GAP = 12;
|
|
2030
2055
|
var styles18 = reactNative.StyleSheet.create({
|
|
2031
|
-
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT }
|
|
2032
|
-
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
2056
|
+
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT }
|
|
2033
2057
|
});
|
|
2034
2058
|
var ConfirmDialog = ({
|
|
2035
2059
|
visible,
|
|
@@ -2046,7 +2070,7 @@ var ConfirmDialog = ({
|
|
|
2046
2070
|
const { theme, t } = uiFeedback.useUi();
|
|
2047
2071
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
2048
2072
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
2049
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2073
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2050
2074
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2051
2075
|
uiButtons.Button,
|
|
2052
2076
|
{
|
|
@@ -2086,6 +2110,87 @@ var ConfirmDialog = ({
|
|
|
2086
2110
|
}
|
|
2087
2111
|
);
|
|
2088
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
|
+
};
|
|
2089
2194
|
var AccordionContext = React14.createContext(null);
|
|
2090
2195
|
function useAccordionContext() {
|
|
2091
2196
|
const value = React14.useContext(AccordionContext);
|
|
@@ -2969,6 +3074,7 @@ exports.CopyableId = CopyableId;
|
|
|
2969
3074
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
2970
3075
|
exports.DropdownVariant = DropdownVariant;
|
|
2971
3076
|
exports.ELLIPSIS = ELLIPSIS;
|
|
3077
|
+
exports.FormDialog = FormDialog;
|
|
2972
3078
|
exports.HEADER_STACK_BREAKPOINT = HEADER_STACK_BREAKPOINT;
|
|
2973
3079
|
exports.Heading = Heading;
|
|
2974
3080
|
exports.LAYOUT_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
@@ -2976,6 +3082,7 @@ exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
|
2976
3082
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2977
3083
|
exports.ListRow = ListRow;
|
|
2978
3084
|
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
3085
|
+
exports.MODAL_FOOTER_STACK_BELOW = MODAL_FOOTER_STACK_BELOW;
|
|
2979
3086
|
exports.Modal = Modal;
|
|
2980
3087
|
exports.ModalDropdown = ModalDropdown;
|
|
2981
3088
|
exports.ModalShell = ModalShell;
|
|
@@ -2999,6 +3106,7 @@ exports.copyText = copyText;
|
|
|
2999
3106
|
exports.formatBuildInfo = formatBuildInfo;
|
|
3000
3107
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
3001
3108
|
exports.isKeyboardOpen = isKeyboardOpen;
|
|
3109
|
+
exports.isModalFooterStacked = isModalFooterStacked;
|
|
3002
3110
|
exports.isWideWebViewport = isWideWebViewport;
|
|
3003
3111
|
exports.pageScale = pageScale;
|
|
3004
3112
|
exports.resolveRowLook = resolveRowLook;
|