asma-ui-core 3.136.0 → 3.136.2
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/asma-ui-core.css +1 -1
- package/dist/components/feedback/dialog/StyledDialog.js +129 -126
- package/dist/components/feedback/dialog/dialogHeaderStyles.js +5 -3
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +178 -171
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +120 -113
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +180 -135
- package/dist/components/utils/bottom-sheet/useDragToDismiss.hook.js +111 -31
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +3 -2
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +3 -3
- package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +15 -3
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +8 -2
- package/dist/src/components/utils/bottom-sheet/useDragToDismiss.hook.d.ts +14 -3
- package/package.json +1 -1
|
@@ -73,8 +73,14 @@ export interface StyledBottomSheetProps {
|
|
|
73
73
|
* can be expanded to 90vh — by dragging the handle up, or by activating it (Tab lands on it, Space /
|
|
74
74
|
* Enter toggle between the two heights) — and scrolls internally from there. Below 480px of viewport
|
|
75
75
|
* height (a phone in landscape) it becomes a full-screen dialog instead. Five equivalent dismiss
|
|
76
|
-
* routes — close button, "Vis resultater", scrim, Escape, dragging down past 30%
|
|
77
|
-
* commits or discards anything: filters apply as the user goes and actions commit on
|
|
76
|
+
* routes — close button, "Vis resultater", scrim, Escape, dragging down past 30% or flinging down — and
|
|
77
|
+
* none of them commits or discards anything: filters apply as the user goes and actions commit on
|
|
78
|
+
* activation.
|
|
79
|
+
*
|
|
80
|
+
* Motion follows Material 3: the sheet tracks the finger (on the handle, or on the body while it is
|
|
81
|
+
* scrolled to the top or can still expand), the scrim fades with a downward drag, a release settles on
|
|
82
|
+
* emphasized-decelerate, and closing slides the sheet out on emphasized-accelerate before the dialog
|
|
83
|
+
* closes. `prefers-reduced-motion` keeps all of it instant.
|
|
78
84
|
*
|
|
79
85
|
* Interaction model is the popover's: `role="dialog"`, `Tab` only, no `role="menu"`, no arrow keys.
|
|
80
86
|
* Focus moves to the sheet on open (so the title is announced first) and back to the trigger on
|
|
@@ -10,15 +10,26 @@ interface DragToDismiss {
|
|
|
10
10
|
dragHandleProps: DragHandleProps;
|
|
11
11
|
/** How far the sheet is currently dragged down, in px. `0` when at rest. */
|
|
12
12
|
dragOffset: number;
|
|
13
|
+
/** `dragOffset` as a share of the sheet's height, for the scrim to fade with the drag. */
|
|
14
|
+
dragRatio: number;
|
|
15
|
+
/** While the sheet is dragged up and can expand: its height under the finger, in px. */
|
|
16
|
+
liftedHeight: number | null;
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
15
|
-
* Drag the sheet down past 30% of its height to dismiss it; release earlier and it
|
|
16
|
-
*
|
|
19
|
+
* Drag the sheet down past 30% of its height, or fling it down, to dismiss it; release earlier and it
|
|
20
|
+
* settles back. Dragged up, a sheet that could expand when the gesture started follows the finger
|
|
21
|
+
* (`liftedHeight`); released after 48px or flung up, `onDragUp` expands it, otherwise it settles back.
|
|
22
|
+
* The way back is a drag too: an expanded sheet (`onCollapse`) dragged down 48px or flung down returns
|
|
23
|
+
* to half height, and only a drag that leaves less than 70% of that half on screen dismisses it.
|
|
24
|
+
*
|
|
25
|
+
* The drag starts on the handle row (any pointer) or, on touch, anywhere in the `body` while
|
|
26
|
+
* the body is scrolled to its top and the finger moves down, or while the sheet can still expand and the
|
|
27
|
+
* finger moves up — as Material's bottom sheet does. Otherwise the body just scrolls.
|
|
17
28
|
*
|
|
18
29
|
* Deliberately never the only exit or the only way to resize (WCAG 2.5.7): the close button, the scrim
|
|
19
30
|
* and Escape close it, and the drag handle toggles the height as a button. A press that starts on any
|
|
20
31
|
* other button in the drag zone is left alone, so the close control keeps working as a plain click.
|
|
21
32
|
* The pointer is captured only once it has moved, so a tap on the drag handle stays a click.
|
|
22
33
|
*/
|
|
23
|
-
export declare const useDragToDismiss: (sheetRef: RefObject<HTMLElement | null>, onDismiss: () => void, onDragUp?: () => void) => DragToDismiss;
|
|
34
|
+
export declare const useDragToDismiss: (sheetRef: RefObject<HTMLElement | null>, onDismiss: () => void, onDragUp?: () => void, onCollapse?: () => void, body?: HTMLElement | null) => DragToDismiss;
|
|
24
35
|
export {};
|