@flipdish/ui-library 0.64.0 → 0.65.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/components/__internal__/overlay/PageScrollbarGutterRelease.cjs +18 -0
- package/dist/components/__internal__/overlay/PageScrollbarGutterRelease.cjs.map +1 -0
- package/dist/components/__internal__/overlay/PageScrollbarGutterRelease.d.ts +6 -0
- package/dist/components/__internal__/overlay/PageScrollbarGutterRelease.d.ts.map +1 -0
- package/dist/components/__internal__/overlay/PageScrollbarGutterRelease.js +16 -0
- package/dist/components/__internal__/overlay/PageScrollbarGutterRelease.js.map +1 -0
- package/dist/components/__internal__/popover/ScrollClosingPopover.cjs +5 -3
- package/dist/components/__internal__/popover/ScrollClosingPopover.cjs.map +1 -1
- package/dist/components/__internal__/popover/ScrollClosingPopover.d.ts.map +1 -1
- package/dist/components/__internal__/popover/ScrollClosingPopover.js +6 -4
- package/dist/components/__internal__/popover/ScrollClosingPopover.js.map +1 -1
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.cjs +7 -2
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.cjs.map +1 -1
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.d.ts +6 -0
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.d.ts.map +1 -1
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.js +7 -2
- package/dist/components/__internal__/popover/hooks/useCloseOnTriggerScroll.js.map +1 -1
- package/dist/components/forms/FormUnsavedChangesModal/index.cjs +2 -2
- package/dist/components/forms/FormUnsavedChangesModal/index.cjs.map +1 -1
- package/dist/components/forms/FormUnsavedChangesModal/index.d.ts +4 -2
- package/dist/components/forms/FormUnsavedChangesModal/index.d.ts.map +1 -1
- package/dist/components/forms/FormUnsavedChangesModal/index.js +2 -2
- package/dist/components/forms/FormUnsavedChangesModal/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +11 -19
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +11 -19
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs +90 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs.map +1 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts +79 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts.map +1 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js +83 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js.map +1 -0
- package/dist/components/molecules/Modal/index.d.ts +1 -1
- package/dist/components/molecules/Modal/index.d.ts.map +1 -1
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.cjs +8 -5
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.cjs.map +1 -1
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.d.ts +12 -5
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.d.ts.map +1 -1
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.js +9 -6
- package/dist/components/molecules/Modals/ConfirmationModal/ConfirmationModal.js.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.cjs +76 -9
- package/dist/components/molecules/Modals/Modal/Modal.cjs.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.d.ts +35 -1
- package/dist/components/molecules/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.js +77 -13
- package/dist/components/molecules/Modals/Modal/Modal.js.map +1 -1
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.cjs +15 -0
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.cjs.map +1 -0
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.d.ts +9 -0
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.d.ts.map +1 -0
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.js +13 -0
- package/dist/components/molecules/Modals/Modal/utilities/modalBody.utils.js.map +1 -0
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.cjs +4 -4
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.cjs.map +1 -1
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.d.ts +4 -2
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.d.ts.map +1 -1
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.js +5 -5
- package/dist/components/molecules/Modals/UnsavedChangesModal/UnsavedChangesModal.js.map +1 -1
- package/dist/components/molecules/Modals/index.cjs +3 -0
- package/dist/components/molecules/Modals/index.cjs.map +1 -1
- package/dist/components/molecules/Modals/index.d.ts +2 -2
- package/dist/components/molecules/Modals/index.d.ts.map +1 -1
- package/dist/components/molecules/Modals/index.js +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs +3 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.js +5 -3
- package/dist/components/organisms/CommandMenu/components/CommandInput.js.map +1 -1
- package/dist/components/organisms/CommandMenu/index.cjs +15 -2
- package/dist/components/organisms/CommandMenu/index.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/index.js +15 -2
- package/dist/components/organisms/CommandMenu/index.js.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.cjs +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.js +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.js.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +4 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +4 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.cjs +11 -2
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js +12 -3
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js.map +1 -1
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.cjs +6 -4
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.d.ts +4 -2
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.js +8 -6
- package/dist/components/organisms/DatePickers/components/CalendarOverlay.js.map +1 -1
- package/dist/components/organisms/DatePickers/providers/CalendarSheet.context.d.ts +7 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSheet.context.d.ts.map +1 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.cjs +14 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.cjs.map +1 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.d.ts +8 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.d.ts.map +1 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.js +12 -0
- package/dist/components/organisms/DatePickers/providers/CalendarSurface.context.js.map +1 -0
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs +10 -7
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts +14 -5
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js +11 -8
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js.map +1 -1
- package/dist/components/organisms/FilterBar/index.cjs +3 -1
- package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/index.js +3 -1
- package/dist/components/organisms/FilterBar/index.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/MobileHeader.cjs +2 -1
- package/dist/components/organisms/HeaderNavigation/components/MobileHeader.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/MobileHeader.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/MobileHeader.js +2 -1
- package/dist/components/organisms/HeaderNavigation/components/MobileHeader.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/MobileHeader.cjs +2 -1
- package/dist/components/organisms/SidebarNavigation/components/MobileHeader.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/MobileHeader.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/MobileHeader.js +2 -1
- package/dist/components/organisms/SidebarNavigation/components/MobileHeader.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs +33 -11
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts +4 -3
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js +35 -13
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.cjs +28 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.d.ts +20 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.js +26 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/index.cjs +14 -8
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts +8 -7
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +14 -8
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.cjs +24 -0
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.cjs.map +1 -0
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.d.ts +10 -0
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.js +22 -0
- package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.js.map +1 -0
- package/dist/hooks/useBreakpoints/index.cjs +6 -5
- package/dist/hooks/useBreakpoints/index.cjs.map +1 -1
- package/dist/hooks/useBreakpoints/index.d.ts +5 -5
- package/dist/hooks/useBreakpoints/index.d.ts.map +1 -1
- package/dist/hooks/useBreakpoints/index.js +6 -5
- package/dist/hooks/useBreakpoints/index.js.map +1 -1
- package/dist/styles.css +5 -0
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.cjs +58 -0
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.d.ts +8 -0
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.js +58 -1
- package/dist/utilities/__internal__/scrollUtils/scroll.utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusOnBecomingSheet.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,8BAA8B;IACtC,qDAAqD;IACrD,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,mCAAmC,8BAA8B,KAAG,IAU3G,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { getFocusedElement } from '../../../../utilities/__internal__/focusUtils/focus.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Moves focus into the panel when it becomes a sheet while open, as the window narrows below `md`: everything behind a
|
|
6
|
+
* sheet goes out of reach, so focus left there would be lost. Focus already inside the panel stays where it is, and a
|
|
7
|
+
* panel that opened as a sheet or is on its way out is left alone.
|
|
8
|
+
*
|
|
9
|
+
* @param options The dialog element, whether the panel is a sheet, and whether it is still present.
|
|
10
|
+
* @returns Nothing.
|
|
11
|
+
*/
|
|
12
|
+
const useFocusOnBecomingSheet = ({ dialogRef, isSheet, isPresent }) => {
|
|
13
|
+
const wasSheet = useRef(isSheet);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const hasBecomeSheet = isSheet && !wasSheet.current;
|
|
16
|
+
wasSheet.current = isSheet;
|
|
17
|
+
if (!hasBecomeSheet || !isPresent)
|
|
18
|
+
return;
|
|
19
|
+
const focused = getFocusedElement();
|
|
20
|
+
if (!focused || !dialogRef.current?.contains(focused))
|
|
21
|
+
dialogRef.current?.focus({ preventScroll: true });
|
|
22
|
+
}, [dialogRef, isSheet, isPresent]);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { useFocusOnBecomingSheet };
|
|
26
|
+
//# sourceMappingURL=useFocusOnBecomingSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusOnBecomingSheet.js","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useFocusOnBecomingSheet.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAeA;;;;;;;AAOG;AACI,MAAM,uBAAuB,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAkC,KAAU;AACjH,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;IAEhC,SAAS,CAAC,MAAK;QACb,MAAM,cAAc,GAAG,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO;AACnD,QAAA,QAAQ,CAAC,OAAO,GAAG,OAAO;AAC1B,QAAA,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS;YAAE;AACnC,QAAA,MAAM,OAAO,GAAG,iBAAiB,EAAE;QACnC,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;YAAE,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IAC1G,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AACrC;;"}
|
|
@@ -19,7 +19,9 @@ const Content = React.forwardRef(({ 'data-testid': dataTestId, ...props }, ref)
|
|
|
19
19
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
20
20
|
const contentTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'content') : undefined);
|
|
21
21
|
// No landmark role: the panel floats over a page that has its own `main`, and a dialog's content is not a second one.
|
|
22
|
-
return (jsxRuntime.jsx("div", { ...props, ref: ref, "data-testid": contentTestId,
|
|
22
|
+
return (jsxRuntime.jsx("div", { ...props, ref: ref, "data-testid": contentTestId,
|
|
23
|
+
// The space above a footer is padding in here, not a gap after it, so the content scrolls right up to the footer's border.
|
|
24
|
+
className: cx.cx('flex size-full flex-col gap-6 overflow-y-auto overscroll-auto px-6 pb-6 max-md:scrollbar-thin', props.className) }));
|
|
23
25
|
});
|
|
24
26
|
Content.displayName = 'SlideoutContent';
|
|
25
27
|
const Header = React.forwardRef(({ className, children, onClose, closeLabel, href, linkLabel = 'Open full page', onLinkPress, 'data-testid': dataTestId, ...props }, ref) => {
|
|
@@ -37,26 +39,30 @@ const Header = React.forwardRef(({ className, children, onClose, closeLabel, hre
|
|
|
37
39
|
// A `div`, not `header`: inside a dialog that element maps to `banner` and would duplicate the page's own.
|
|
38
40
|
return (jsxRuntime.jsxs("div", { ...props, ref: headerRef, "data-testid": headerTestId,
|
|
39
41
|
// Right padding clears the close button, and the link beside it, so a long title wraps instead of running under them.
|
|
40
|
-
className: cx.cx('relative z-1 w-full pt-6 pl-
|
|
42
|
+
className: cx.cx('relative z-1 w-full pt-6 pl-6', href ? 'pr-24' : 'pr-12', className), children: [jsxRuntime.jsx("div", { ref: titleRef, className: "contents", children: children }), href && (jsxRuntime.jsx(Buttons.IconButton, { href: href, onPress: onLinkPress, icon: uiIcons.ArrowUpRight, tooltip: linkLabel, color: "tertiary", size: "sm", className: "absolute top-3 right-12 size-9 shrink-0", "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'link') : undefined })), jsxRuntime.jsx(Buttons.CloseButton, { size: "sm", label: closeLabel ?? (panel?.label ? `Close ${panel.label}` : undefined), className: "absolute top-3 right-3 shrink-0", onClick: onClose ?? panel?.close, "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'close') : undefined })] }));
|
|
41
43
|
});
|
|
42
44
|
Header.displayName = 'SlideoutHeader';
|
|
45
|
+
/** Actions pinned under the content. Given `flex`, a row of actions stacks at full width below `md`, the last one first; `max-md:flex-row` keeps the row there. */
|
|
43
46
|
const Footer = React.forwardRef(({ 'data-testid': dataTestId, ...props }, ref) => {
|
|
44
47
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
45
48
|
const footerTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'footer') : undefined);
|
|
46
49
|
// A `div`, not `footer`: inside a dialog that element maps to `contentinfo` and would duplicate the page's own.
|
|
47
|
-
return (jsxRuntime.jsx("div", { ...props, ref: ref, "data-testid": footerTestId,
|
|
50
|
+
return (jsxRuntime.jsx("div", { ...props, ref: ref, "data-testid": footerTestId,
|
|
51
|
+
// A row of actions stacks below `md`, the last one first: side by side, translated labels wrap or clip on a phone. No
|
|
52
|
+
// `display` here, so a footer the consumer hides or lays out as a block is left alone. `-mt-6` takes back the panel's
|
|
53
|
+
// gap, which `Content` carries as padding, so the border sits directly under what scrolls.
|
|
54
|
+
className: cx.cx('-mt-6 w-full px-6 py-4 shadow-[inset_0px_1px_0px_0px] shadow-border-secondary max-md:flex-col-reverse max-md:items-stretch max-md:gap-3', props.className) }));
|
|
48
55
|
});
|
|
49
56
|
Footer.displayName = 'SlideoutFooter';
|
|
50
57
|
/** Names what the slideouts below it cover below `lg`, for a layout of its own; `AppShell` does it for its page area. */
|
|
51
58
|
const PageArea = ({ areaRef, children }) => jsxRuntime.jsx(PageArea_context.PageAreaContext.Provider, { value: areaRef, children: children });
|
|
52
59
|
PageArea.displayName = 'SlideoutPageArea';
|
|
53
60
|
/**
|
|
54
|
-
* Panel
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* closes. Compose `Header`, `Content` and `Footer` inside it.
|
|
61
|
+
* Panel for the detail of the record the user just selected. From `md` it slides in from the right edge without
|
|
62
|
+
* dimming or blocking the page and covers the page area only, filling it below `lg`; below `md` it is a modal
|
|
63
|
+
* bottom sheet over a backdrop. Compose `Header`, `Content` and `Footer` inside it.
|
|
58
64
|
*
|
|
59
|
-
* @summary
|
|
65
|
+
* @summary panel for the selected record's detail, a sheet on a phone
|
|
60
66
|
*/
|
|
61
67
|
const SlideoutMenu = Menu;
|
|
62
68
|
SlideoutMenu.displayName = 'SlideoutMenu';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","SlideoutShell","forwardRef","useTestIdPrefix","joinTestId","cx","useContext","SlideoutMenuContext","useRef","useObjectRef","useLayoutEffect","_jsxs","IconButton","ArrowUpRight","CloseButton","PageAreaContext","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","SlideoutShell","forwardRef","useTestIdPrefix","joinTestId","cx","useContext","SlideoutMenuContext","useRef","useObjectRef","useLayoutEffect","_jsxs","IconButton","ArrowUpRight","CloseButton","PageAreaContext","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;;;AAsDA,MAAM,IAAI,GAAG,CAAC,KAAwB,KAAKA,cAAA,CAACC,2BAAa,EAAA,EAAA,GAAK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,MAAM,MAAM,GAAGC,2BAAe,EAAE;IAChC,MAAM,YAAY,GAAG,UAAU,KAAK,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;;IAGtF,QACEJ,2BACM,KAAK,EACT,GAAG,EAAE,GAAG,iBACK,YAAY;;;;QAIzB,SAAS,EAAEK,KAAE,CACX,yIAAyI,EACzI,KAAK,CAAC,SAAS,CAChB,EAAA,CACD;AAEN,CAAC,CACF;AACD,MAAM,CAAC,WAAW,GAAG,gBAAgB;AAarC;AACA,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAyB,KAAKL,eAACe,gCAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;AAClJ,QAAQ,CAAC,WAAW,GAAG,kBAAkB;AAEzC;;;;;;AAMG;AACH,MAAM,YAAY,GAAG;AAOrB,YAAY,CAAC,WAAW,GAAG,cAAc;AAEzC,YAAY,CAAC,OAAO,GAAGC,iCAAiB;AACxC,YAAY,CAAC,OAAO,GAAG,OAAO;AAC9B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,QAAQ,GAAG,QAAQ;;;;;"}
|
|
@@ -15,10 +15,11 @@ export interface SlideoutMenuProps {
|
|
|
15
15
|
* `SlideoutMenu.Trigger` the trigger owns the state, so pass `onOpenChange` to the trigger instead.
|
|
16
16
|
*/
|
|
17
17
|
onOpenChange?: (isOpen: boolean) => void;
|
|
18
|
-
/** Keeps the panel open on Escape, pressed inside the panel or anywhere on the page
|
|
18
|
+
/** Keeps the panel open on Escape, pressed inside the panel or anywhere on the page, and on a press on the sheet's backdrop below `md`. */
|
|
19
19
|
isKeyboardDismissDisabled?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* The box the panel may cover, as distances from the viewport edges; a number is pixels, a string any CSS length.
|
|
21
|
+
* The box the panel may cover from `md` up, as distances from the viewport edges; a number is pixels, a string any CSS length.
|
|
22
|
+
* The modal sheet below `md` covers the viewport and ignores it. Defaults to
|
|
22
23
|
* the `AppShell` page area, else the host's `--app-header-height`, `--app-sidebar-width` and `--app-side-panel-width`, read
|
|
23
24
|
* from `:root`, `body` or any ancestor of the element overlays portal into, each `0px` when unset. A key given here falls
|
|
24
25
|
* back to its variable when the others are omitted.
|
|
@@ -59,6 +60,7 @@ export interface SlideoutHeaderProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
59
60
|
'data-testid'?: string;
|
|
60
61
|
}
|
|
61
62
|
declare const Header: import("react").ForwardRefExoticComponent<SlideoutHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
+
/** Actions pinned under the content. Given `flex`, a row of actions stacks at full width below `md`, the last one first; `max-md:flex-row` keeps the row there. */
|
|
62
64
|
declare const Footer: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
63
65
|
'data-testid'?: string;
|
|
64
66
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -78,12 +80,11 @@ declare const PageArea: {
|
|
|
78
80
|
displayName: string;
|
|
79
81
|
};
|
|
80
82
|
/**
|
|
81
|
-
* Panel
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* closes. Compose `Header`, `Content` and `Footer` inside it.
|
|
83
|
+
* Panel for the detail of the record the user just selected. From `md` it slides in from the right edge without
|
|
84
|
+
* dimming or blocking the page and covers the page area only, filling it below `lg`; below `md` it is a modal
|
|
85
|
+
* bottom sheet over a backdrop. Compose `Header`, `Content` and `Footer` inside it.
|
|
85
86
|
*
|
|
86
|
-
* @summary
|
|
87
|
+
* @summary panel for the selected record's detail, a sheet on a phone
|
|
87
88
|
*/
|
|
88
89
|
declare const SlideoutMenu: typeof Menu & {
|
|
89
90
|
Trigger: typeof AriaDialogTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAExH,MAAM,WAAW,iBAAiB;IAChC,uGAAuG;IACvG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,g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aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,MAAM,gHAiDX,CAAC;AAGF,mKAAmK;AACnK,QAAA,MAAM,MAAM;oBAAkF,MAAM;kDAqBnG,CAAC;AAGF,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACvC,wGAAwG;IACxG,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,yHAAyH;AACzH,QAAA,MAAM,QAAQ;4BAA2B,qBAAqB;;CAAoF,CAAC;AAGnJ;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,EAAW,OAAO,IAAI,GAAG;IACzC,OAAO,EAAE,OAAO,iBAAiB,CAAC;IAClC,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,QAAQ,CAAC;CAC3B,CAAC;AASF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -17,7 +17,9 @@ const Content = forwardRef(({ 'data-testid': dataTestId, ...props }, ref) => {
|
|
|
17
17
|
const prefix = useTestIdPrefix();
|
|
18
18
|
const contentTestId = dataTestId ?? (prefix ? joinTestId(prefix, 'content') : undefined);
|
|
19
19
|
// No landmark role: the panel floats over a page that has its own `main`, and a dialog's content is not a second one.
|
|
20
|
-
return (jsx("div", { ...props, ref: ref, "data-testid": contentTestId,
|
|
20
|
+
return (jsx("div", { ...props, ref: ref, "data-testid": contentTestId,
|
|
21
|
+
// The space above a footer is padding in here, not a gap after it, so the content scrolls right up to the footer's border.
|
|
22
|
+
className: cx('flex size-full flex-col gap-6 overflow-y-auto overscroll-auto px-6 pb-6 max-md:scrollbar-thin', props.className) }));
|
|
21
23
|
});
|
|
22
24
|
Content.displayName = 'SlideoutContent';
|
|
23
25
|
const Header = forwardRef(({ className, children, onClose, closeLabel, href, linkLabel = 'Open full page', onLinkPress, 'data-testid': dataTestId, ...props }, ref) => {
|
|
@@ -35,26 +37,30 @@ const Header = forwardRef(({ className, children, onClose, closeLabel, href, lin
|
|
|
35
37
|
// A `div`, not `header`: inside a dialog that element maps to `banner` and would duplicate the page's own.
|
|
36
38
|
return (jsxs("div", { ...props, ref: headerRef, "data-testid": headerTestId,
|
|
37
39
|
// Right padding clears the close button, and the link beside it, so a long title wraps instead of running under them.
|
|
38
|
-
className: cx('relative z-1 w-full pt-6 pl-
|
|
40
|
+
className: cx('relative z-1 w-full pt-6 pl-6', href ? 'pr-24' : 'pr-12', className), children: [jsx("div", { ref: titleRef, className: "contents", children: children }), href && (jsx(IconButton, { href: href, onPress: onLinkPress, icon: ArrowUpRight, tooltip: linkLabel, color: "tertiary", size: "sm", className: "absolute top-3 right-12 size-9 shrink-0", "data-testid": prefix ? joinTestId(prefix, 'link') : undefined })), jsx(CloseButton, { size: "sm", label: closeLabel ?? (panel?.label ? `Close ${panel.label}` : undefined), className: "absolute top-3 right-3 shrink-0", onClick: onClose ?? panel?.close, "data-testid": prefix ? joinTestId(prefix, 'close') : undefined })] }));
|
|
39
41
|
});
|
|
40
42
|
Header.displayName = 'SlideoutHeader';
|
|
43
|
+
/** Actions pinned under the content. Given `flex`, a row of actions stacks at full width below `md`, the last one first; `max-md:flex-row` keeps the row there. */
|
|
41
44
|
const Footer = forwardRef(({ 'data-testid': dataTestId, ...props }, ref) => {
|
|
42
45
|
const prefix = useTestIdPrefix();
|
|
43
46
|
const footerTestId = dataTestId ?? (prefix ? joinTestId(prefix, 'footer') : undefined);
|
|
44
47
|
// A `div`, not `footer`: inside a dialog that element maps to `contentinfo` and would duplicate the page's own.
|
|
45
|
-
return (jsx("div", { ...props, ref: ref, "data-testid": footerTestId,
|
|
48
|
+
return (jsx("div", { ...props, ref: ref, "data-testid": footerTestId,
|
|
49
|
+
// A row of actions stacks below `md`, the last one first: side by side, translated labels wrap or clip on a phone. No
|
|
50
|
+
// `display` here, so a footer the consumer hides or lays out as a block is left alone. `-mt-6` takes back the panel's
|
|
51
|
+
// gap, which `Content` carries as padding, so the border sits directly under what scrolls.
|
|
52
|
+
className: cx('-mt-6 w-full px-6 py-4 shadow-[inset_0px_1px_0px_0px] shadow-border-secondary max-md:flex-col-reverse max-md:items-stretch max-md:gap-3', props.className) }));
|
|
46
53
|
});
|
|
47
54
|
Footer.displayName = 'SlideoutFooter';
|
|
48
55
|
/** Names what the slideouts below it cover below `lg`, for a layout of its own; `AppShell` does it for its page area. */
|
|
49
56
|
const PageArea = ({ areaRef, children }) => jsx(PageAreaContext.Provider, { value: areaRef, children: children });
|
|
50
57
|
PageArea.displayName = 'SlideoutPageArea';
|
|
51
58
|
/**
|
|
52
|
-
* Panel
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* closes. Compose `Header`, `Content` and `Footer` inside it.
|
|
59
|
+
* Panel for the detail of the record the user just selected. From `md` it slides in from the right edge without
|
|
60
|
+
* dimming or blocking the page and covers the page area only, filling it below `lg`; below `md` it is a modal
|
|
61
|
+
* bottom sheet over a backdrop. Compose `Header`, `Content` and `Footer` inside it.
|
|
56
62
|
*
|
|
57
|
-
* @summary
|
|
63
|
+
* @summary panel for the selected record's detail, a sheet on a phone
|
|
58
64
|
*/
|
|
59
65
|
const SlideoutMenu = Menu;
|
|
60
66
|
SlideoutMenu.displayName = 'SlideoutMenu';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;AAsDA,MAAM,IAAI,GAAG,CAAC,KAAwB,KAAKA,GAAA,CAAC,aAAa,EAAA,EAAA,GA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AAM,YAAY,GAAG,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;;IAGtF,QACEA,gBACM,KAAK,EACT,GAAG,EAAE,GAAG,iBACK,YAAY;;;;QAIzB,SAAS,EAAE,EAAE,CACX,yIAAyI,EACzI,KAAK,CAAC,SAAS,CAChB,EAAA,CACD;AAEN,CAAC,CACF;AACD,MAAM,CAAC,WAAW,GAAG,gBAAgB;AAarC;AACA,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAyB,KAAKA,IAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;AAClJ,QAAQ,CAAC,WAAW,GAAG,kBAAkB;AAEzC;;;;;;AAMG;AACH,MAAM,YAAY,GAAG;AAOrB,YAAY,CAAC,WAAW,GAAG,cAAc;AAEzC,YAAY,CAAC,OAAO,GAAGE,aAAiB;AACxC,YAAY,CAAC,OAAO,GAAG,OAAO;AAC9B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,QAAQ,GAAG,QAAQ;;"}
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var scroll_utils = require('../../../utilities/__internal__/scrollUtils/scroll.utils.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Lets a modal overlay cover the full width of the window: while `isActive`, the page gives up the scrollbar gutter
|
|
8
|
+
* react-aria reserves under its scroll lock, and is padded so it does not shift. Pass the overlay's own open state, so
|
|
9
|
+
* the gutter comes back in the same commit as react-aria unlocks, before the overlay has finished leaving.
|
|
10
|
+
*
|
|
11
|
+
* @param isActive Whether the overlay is open and has locked page scroll.
|
|
12
|
+
* @returns Nothing.
|
|
13
|
+
*/
|
|
14
|
+
const useReleasePageScrollbarGutter = (isActive) => {
|
|
15
|
+
// Passive on purpose: react-aria locks in a layout effect, and the release needs its lock in place to find the gutter.
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (!isActive)
|
|
18
|
+
return;
|
|
19
|
+
return scroll_utils.releasePageScrollbarGutter();
|
|
20
|
+
}, [isActive]);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.useReleasePageScrollbarGutter = useReleasePageScrollbarGutter;
|
|
24
|
+
//# sourceMappingURL=useReleasePageScrollbarGutter.cjs.map
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReleasePageScrollbarGutter.cjs","sources":["../../../../src/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.ts"],"sourcesContent":[null],"names":["useEffect","releasePageScrollbarGutter"],"mappings":";;;;;AAKA;;;;;;;AAOG;AACI,MAAM,6BAA6B,GAAG,CAAC,QAAiB,KAAU;;IAEvEA,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,QAAQ;YAAE;QACf,OAAOC,uCAA0B,EAAE;AACrC,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAChB;;"}
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets a modal overlay cover the full width of the window: while `isActive`, the page gives up the scrollbar gutter
|
|
3
|
+
* react-aria reserves under its scroll lock, and is padded so it does not shift. Pass the overlay's own open state, so
|
|
4
|
+
* the gutter comes back in the same commit as react-aria unlocks, before the overlay has finished leaving.
|
|
5
|
+
*
|
|
6
|
+
* @param isActive Whether the overlay is open and has locked page scroll.
|
|
7
|
+
* @returns Nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useReleasePageScrollbarGutter: (isActive: boolean) => void;
|
|
10
|
+
//# sourceMappingURL=useReleasePageScrollbarGutter.d.ts.map
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReleasePageScrollbarGutter.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GAAI,UAAU,OAAO,KAAG,IAMjE,CAAC"}
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { releasePageScrollbarGutter } from '../../../utilities/__internal__/scrollUtils/scroll.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Lets a modal overlay cover the full width of the window: while `isActive`, the page gives up the scrollbar gutter
|
|
6
|
+
* react-aria reserves under its scroll lock, and is padded so it does not shift. Pass the overlay's own open state, so
|
|
7
|
+
* the gutter comes back in the same commit as react-aria unlocks, before the overlay has finished leaving.
|
|
8
|
+
*
|
|
9
|
+
* @param isActive Whether the overlay is open and has locked page scroll.
|
|
10
|
+
* @returns Nothing.
|
|
11
|
+
*/
|
|
12
|
+
const useReleasePageScrollbarGutter = (isActive) => {
|
|
13
|
+
// Passive on purpose: react-aria locks in a layout effect, and the release needs its lock in place to find the gutter.
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!isActive)
|
|
16
|
+
return;
|
|
17
|
+
return releasePageScrollbarGutter();
|
|
18
|
+
}, [isActive]);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { useReleasePageScrollbarGutter };
|
|
22
|
+
//# sourceMappingURL=useReleasePageScrollbarGutter.js.map
|
package/dist/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReleasePageScrollbarGutter.js","sources":["../../../../src/hooks/__internal__/useReleasePageScrollbarGutter/useReleasePageScrollbarGutter.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAKA;;;;;;;AAOG;AACI,MAAM,6BAA6B,GAAG,CAAC,QAAiB,KAAU;;IAEvE,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,QAAQ;YAAE;QACf,OAAO,0BAA0B,EAAE;AACrC,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAChB;;"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
|
+
// In rem, as Tailwind's own breakpoints are, so a branch taken here and an `md:` class always switch at the same width, whatever font size the browser is set to.
|
|
5
6
|
const screens = {
|
|
6
|
-
sm: '
|
|
7
|
-
md: '
|
|
8
|
-
lg: '
|
|
9
|
-
xl: '
|
|
10
|
-
'2xl': '
|
|
7
|
+
sm: '40rem', // 640px
|
|
8
|
+
md: '48rem', // 768px
|
|
9
|
+
lg: '64rem', // 1024px
|
|
10
|
+
xl: '80rem', // 1280px
|
|
11
|
+
'2xl': '96rem', // 1536px
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Reports whether the viewport is at least the given Tailwind breakpoint, updating as the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useBreakpoints/index.ts"],"sourcesContent":[null],"names":["useState","useEffect"],"mappings":";;;;AAIA,MAAM,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useBreakpoints/index.ts"],"sourcesContent":[null],"names":["useState","useEffect"],"mappings":";;;;AAIA;AACA,MAAM,OAAO,GAAG;IACd,EAAE,EA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|
-
readonly '2xl': "
|
|
2
|
+
readonly sm: "40rem";
|
|
3
|
+
readonly md: "48rem";
|
|
4
|
+
readonly lg: "64rem";
|
|
5
|
+
readonly xl: "80rem";
|
|
6
|
+
readonly '2xl': "96rem";
|
|
7
7
|
};
|
|
8
8
|
type Breakpoint = keyof typeof screens;
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBreakpoints/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBreakpoints/index.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,OAAO;;;;;;CAMH,CAAC;AAEX,KAAK,UAAU,GAAG,MAAM,OAAO,OAAO,CAAC;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,UAAU,YAwB9C,CAAC;AAEF,kHAAkH;AAClH,eAAO,MAAM,aAAa,SA3BW,UAAU,YA2BJ,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
+
// In rem, as Tailwind's own breakpoints are, so a branch taken here and an `md:` class always switch at the same width, whatever font size the browser is set to.
|
|
3
4
|
const screens = {
|
|
4
|
-
sm: '
|
|
5
|
-
md: '
|
|
6
|
-
lg: '
|
|
7
|
-
xl: '
|
|
8
|
-
'2xl': '
|
|
5
|
+
sm: '40rem', // 640px
|
|
6
|
+
md: '48rem', // 768px
|
|
7
|
+
lg: '64rem', // 1024px
|
|
8
|
+
xl: '80rem', // 1280px
|
|
9
|
+
'2xl': '96rem', // 1536px
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* Reports whether the viewport is at least the given Tailwind breakpoint, updating as the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useBreakpoints/index.ts"],"sourcesContent":[null],"names":[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AAM,aAAa,GAAG;;"}
|
package/dist/styles.css
CHANGED
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
scrollbar-width: none;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/* A narrow scrollbar for a surface as small as a bottom sheet: it still shows the content scrolls, and costs less of its width. */
|
|
70
|
+
@utility scrollbar-thin {
|
|
71
|
+
scrollbar-width: thin;
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
@utility transition-inherit-all {
|
|
70
75
|
transition-property: inherit;
|
|
71
76
|
transition-duration: inherit;
|
|
@@ -18,6 +18,64 @@ const subscribeToAncestorScroll = (target, onScroll) => {
|
|
|
18
18
|
window.addEventListener('scroll', handleScroll, true);
|
|
19
19
|
return () => window.removeEventListener('scroll', handleScroll, true);
|
|
20
20
|
};
|
|
21
|
+
/** Counts the overlays holding the page's scrollbar gutter released. On the root element, so every copy of the library on the page shares it. */
|
|
22
|
+
const GUTTER_RELEASES_ATTRIBUTE = 'data-fd-gutter-releases';
|
|
23
|
+
/** Holds the root's own inline `padding-right` while the release adds the gutter's width to it. */
|
|
24
|
+
const GUTTER_PADDING_ATTRIBUTE = 'data-fd-gutter-padding';
|
|
25
|
+
/** Width of the gutter the page keeps beside its content: what a fixed box spanning the viewport falls short of the window by. */
|
|
26
|
+
const measurePageGutter = () => {
|
|
27
|
+
const probe = document.createElement('div');
|
|
28
|
+
probe.style.cssText = 'position:fixed;left:0;right:0;height:0;visibility:hidden;pointer-events:none';
|
|
29
|
+
document.documentElement.append(probe);
|
|
30
|
+
const gutter = window.innerWidth - probe.getBoundingClientRect().width;
|
|
31
|
+
probe.remove();
|
|
32
|
+
return Math.max(0, Math.round(gutter));
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Releases the scrollbar gutter react-aria reserves on the page while it locks scroll, which the browser paints in the
|
|
36
|
+
* page's background over any overlay, and pads the page by the same width so its content stays where it was. Call it
|
|
37
|
+
* after react-aria has locked scroll, from a passive effect; it does nothing when the page had no scrollbar taking width.
|
|
38
|
+
*
|
|
39
|
+
* @returns Gives the gutter back once every caller has, to react-aria's lock when another overlay still holds it.
|
|
40
|
+
*/
|
|
41
|
+
const releasePageScrollbarGutter = () => {
|
|
42
|
+
const root = document.documentElement;
|
|
43
|
+
const held = Number(root.getAttribute(GUTTER_RELEASES_ATTRIBUTE) ?? 0);
|
|
44
|
+
if (held === 0) {
|
|
45
|
+
// react-aria writes `stable` inline only when the page's scrollbar takes width, so anything else needs no release.
|
|
46
|
+
if (root.style.scrollbarGutter !== 'stable')
|
|
47
|
+
return () => { };
|
|
48
|
+
const gutter = measurePageGutter();
|
|
49
|
+
// Added to any padding the page already has, so its content stays where it was.
|
|
50
|
+
const ownPadding = Number.parseFloat(getComputedStyle(root).paddingRight) || 0;
|
|
51
|
+
root.setAttribute(GUTTER_PADDING_ATTRIBUTE, root.style.paddingRight);
|
|
52
|
+
root.style.setProperty('scrollbar-gutter', 'auto', 'important');
|
|
53
|
+
root.style.paddingRight = `${ownPadding + gutter}px`;
|
|
54
|
+
}
|
|
55
|
+
root.setAttribute(GUTTER_RELEASES_ATTRIBUTE, String(held + 1));
|
|
56
|
+
let isHolding = true;
|
|
57
|
+
return () => {
|
|
58
|
+
if (!isHolding)
|
|
59
|
+
return;
|
|
60
|
+
isHolding = false;
|
|
61
|
+
const remaining = Number(root.getAttribute(GUTTER_RELEASES_ATTRIBUTE) ?? 1) - 1;
|
|
62
|
+
if (remaining > 0) {
|
|
63
|
+
root.setAttribute(GUTTER_RELEASES_ATTRIBUTE, String(remaining));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
root.removeAttribute(GUTTER_RELEASES_ATTRIBUTE);
|
|
67
|
+
root.style.paddingRight = root.getAttribute(GUTTER_PADDING_ATTRIBUTE) ?? '';
|
|
68
|
+
root.removeAttribute(GUTTER_PADDING_ATTRIBUTE);
|
|
69
|
+
// While react-aria still holds the lock for another overlay, the gutter goes back to it. Once it has unlocked it has
|
|
70
|
+
// put back whatever the page had inline, so only a value that is still this release's own is removed.
|
|
71
|
+
const isStillReleased = root.style.getPropertyValue('scrollbar-gutter') === 'auto' && root.style.getPropertyPriority('scrollbar-gutter') === 'important';
|
|
72
|
+
if (root.style.overflow === 'hidden')
|
|
73
|
+
root.style.scrollbarGutter = 'stable';
|
|
74
|
+
else if (isStillReleased)
|
|
75
|
+
root.style.removeProperty('scrollbar-gutter');
|
|
76
|
+
};
|
|
77
|
+
};
|
|
21
78
|
|
|
79
|
+
exports.releasePageScrollbarGutter = releasePageScrollbarGutter;
|
|
22
80
|
exports.subscribeToAncestorScroll = subscribeToAncestorScroll;
|
|
23
81
|
//# sourceMappingURL=scroll.utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.utils.cjs","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;MACU,yBAAyB,GAAG,CAAC,MAAe,EAAE,QAAoB,KAAkB;AAC/F,IAAA,MAAM,YAAY,GAAG,CAAC,KAAY,KAAI;AACpC,QAAA,IAAI,EAAE,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE;AACvE,QAAA,QAAQ,EAAE;AACZ,IAAA,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;AACrD,IAAA,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;AACvE;;"}
|
|
1
|
+
{"version":3,"file":"scroll.utils.cjs","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;MACU,yBAAyB,GAAG,CAAC,MAAe,EAAE,QAAoB,KAAkB;AAC/F,IAAA,MAAM,YAAY,GAAG,CA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CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ;AAAE,YAAA,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,QAAQ;AACtE,aAAA,IAAI,eAAe;AAAE,YAAA,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC;AACzE,IAAA,CAAC;AACH;;;"}
|
|
@@ -8,4 +8,12 @@
|
|
|
8
8
|
* @returns Removes the subscription.
|
|
9
9
|
*/
|
|
10
10
|
export declare const subscribeToAncestorScroll: (target: Element, onScroll: () => void) => (() => void);
|
|
11
|
+
/**
|
|
12
|
+
* Releases the scrollbar gutter react-aria reserves on the page while it locks scroll, which the browser paints in the
|
|
13
|
+
* page's background over any overlay, and pads the page by the same width so its content stays where it was. Call it
|
|
14
|
+
* after react-aria has locked scroll, from a passive effect; it does nothing when the page had no scrollbar taking width.
|
|
15
|
+
*
|
|
16
|
+
* @returns Gives the gutter back once every caller has, to react-aria's lock when another overlay still holds it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const releasePageScrollbarGutter: () => (() => void);
|
|
11
19
|
//# sourceMappingURL=scroll.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,OAAO,EAAE,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAQ5F,CAAC"}
|
|
1
|
+
{"version":3,"file":"scroll.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,OAAO,EAAE,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAQ5F,CAAC;AAiBF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAAO,CAAC,MAAM,IAAI,CAkCxD,CAAC"}
|
|
@@ -16,6 +16,63 @@ const subscribeToAncestorScroll = (target, onScroll) => {
|
|
|
16
16
|
window.addEventListener('scroll', handleScroll, true);
|
|
17
17
|
return () => window.removeEventListener('scroll', handleScroll, true);
|
|
18
18
|
};
|
|
19
|
+
/** Counts the overlays holding the page's scrollbar gutter released. On the root element, so every copy of the library on the page shares it. */
|
|
20
|
+
const GUTTER_RELEASES_ATTRIBUTE = 'data-fd-gutter-releases';
|
|
21
|
+
/** Holds the root's own inline `padding-right` while the release adds the gutter's width to it. */
|
|
22
|
+
const GUTTER_PADDING_ATTRIBUTE = 'data-fd-gutter-padding';
|
|
23
|
+
/** Width of the gutter the page keeps beside its content: what a fixed box spanning the viewport falls short of the window by. */
|
|
24
|
+
const measurePageGutter = () => {
|
|
25
|
+
const probe = document.createElement('div');
|
|
26
|
+
probe.style.cssText = 'position:fixed;left:0;right:0;height:0;visibility:hidden;pointer-events:none';
|
|
27
|
+
document.documentElement.append(probe);
|
|
28
|
+
const gutter = window.innerWidth - probe.getBoundingClientRect().width;
|
|
29
|
+
probe.remove();
|
|
30
|
+
return Math.max(0, Math.round(gutter));
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Releases the scrollbar gutter react-aria reserves on the page while it locks scroll, which the browser paints in the
|
|
34
|
+
* page's background over any overlay, and pads the page by the same width so its content stays where it was. Call it
|
|
35
|
+
* after react-aria has locked scroll, from a passive effect; it does nothing when the page had no scrollbar taking width.
|
|
36
|
+
*
|
|
37
|
+
* @returns Gives the gutter back once every caller has, to react-aria's lock when another overlay still holds it.
|
|
38
|
+
*/
|
|
39
|
+
const releasePageScrollbarGutter = () => {
|
|
40
|
+
const root = document.documentElement;
|
|
41
|
+
const held = Number(root.getAttribute(GUTTER_RELEASES_ATTRIBUTE) ?? 0);
|
|
42
|
+
if (held === 0) {
|
|
43
|
+
// react-aria writes `stable` inline only when the page's scrollbar takes width, so anything else needs no release.
|
|
44
|
+
if (root.style.scrollbarGutter !== 'stable')
|
|
45
|
+
return () => { };
|
|
46
|
+
const gutter = measurePageGutter();
|
|
47
|
+
// Added to any padding the page already has, so its content stays where it was.
|
|
48
|
+
const ownPadding = Number.parseFloat(getComputedStyle(root).paddingRight) || 0;
|
|
49
|
+
root.setAttribute(GUTTER_PADDING_ATTRIBUTE, root.style.paddingRight);
|
|
50
|
+
root.style.setProperty('scrollbar-gutter', 'auto', 'important');
|
|
51
|
+
root.style.paddingRight = `${ownPadding + gutter}px`;
|
|
52
|
+
}
|
|
53
|
+
root.setAttribute(GUTTER_RELEASES_ATTRIBUTE, String(held + 1));
|
|
54
|
+
let isHolding = true;
|
|
55
|
+
return () => {
|
|
56
|
+
if (!isHolding)
|
|
57
|
+
return;
|
|
58
|
+
isHolding = false;
|
|
59
|
+
const remaining = Number(root.getAttribute(GUTTER_RELEASES_ATTRIBUTE) ?? 1) - 1;
|
|
60
|
+
if (remaining > 0) {
|
|
61
|
+
root.setAttribute(GUTTER_RELEASES_ATTRIBUTE, String(remaining));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
root.removeAttribute(GUTTER_RELEASES_ATTRIBUTE);
|
|
65
|
+
root.style.paddingRight = root.getAttribute(GUTTER_PADDING_ATTRIBUTE) ?? '';
|
|
66
|
+
root.removeAttribute(GUTTER_PADDING_ATTRIBUTE);
|
|
67
|
+
// While react-aria still holds the lock for another overlay, the gutter goes back to it. Once it has unlocked it has
|
|
68
|
+
// put back whatever the page had inline, so only a value that is still this release's own is removed.
|
|
69
|
+
const isStillReleased = root.style.getPropertyValue('scrollbar-gutter') === 'auto' && root.style.getPropertyPriority('scrollbar-gutter') === 'important';
|
|
70
|
+
if (root.style.overflow === 'hidden')
|
|
71
|
+
root.style.scrollbarGutter = 'stable';
|
|
72
|
+
else if (isStillReleased)
|
|
73
|
+
root.style.removeProperty('scrollbar-gutter');
|
|
74
|
+
};
|
|
75
|
+
};
|
|
19
76
|
|
|
20
|
-
export { subscribeToAncestorScroll };
|
|
77
|
+
export { releasePageScrollbarGutter, subscribeToAncestorScroll };
|
|
21
78
|
//# sourceMappingURL=scroll.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.utils.js","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;AAQG;MACU,yBAAyB,GAAG,CAAC,MAAe,EAAE,QAAoB,KAAkB;AAC/F,IAAA,MAAM,YAAY,GAAG,CAAC,KAAY,KAAI;AACpC,QAAA,IAAI,EAAE,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE;AACvE,QAAA,QAAQ,EAAE;AACZ,IAAA,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;AACrD,IAAA,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;AACvE;;"}
|
|
1
|
+
{"version":3,"file":"scroll.utils.js","sources":["../../../../src/utilities/__internal__/scrollUtils/scroll.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;AAQG;MACU,yBAAyB,GAAG,CAAC,MAAe,EAAE,QAAoB,KAAkB;AAC/F,IAAA,MAAM,YAAY,GAAG,CAAC,KAAY,KAAI;AACpC,QAAA,IAAI,EAAE,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE;AACvE,QAAA,QAAQ,EAAE;AACZ,IAAA,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC;AACrD,IAAA,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,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