@alfalab/core-components-bottom-sheet 6.1.0 → 6.2.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.
Files changed (62) hide show
  1. package/component.d.ts +5 -0
  2. package/component.js +256 -13
  3. package/components/footer/Component.js +1 -1
  4. package/components/footer/index.css +26 -26
  5. package/components/header/Component.d.ts +7 -0
  6. package/components/header/Component.js +31 -13
  7. package/components/header/index.css +13 -13
  8. package/components/swipeable-backdrop/Component.d.ts +1 -1
  9. package/cssm/component.d.ts +5 -0
  10. package/cssm/component.js +256 -15
  11. package/cssm/components/header/Component.d.ts +7 -0
  12. package/cssm/components/header/Component.js +30 -16
  13. package/cssm/components/swipeable-backdrop/Component.d.ts +1 -1
  14. package/cssm/index.d.ts +3 -1
  15. package/cssm/index.js +7 -5
  16. package/cssm/index.module.css +23 -10
  17. package/{component-b5d23e5e.d.ts → cssm/types.d.ts} +36 -15
  18. package/cssm/types.js +2 -0
  19. package/cssm/utils.d.ts +8 -0
  20. package/cssm/utils.js +33 -0
  21. package/esm/component.d.ts +5 -0
  22. package/esm/component.js +253 -10
  23. package/esm/components/footer/Component.js +1 -1
  24. package/esm/components/footer/index.css +26 -26
  25. package/esm/components/header/Component.d.ts +7 -0
  26. package/esm/components/header/Component.js +29 -12
  27. package/esm/components/header/index.css +13 -13
  28. package/esm/components/swipeable-backdrop/Component.d.ts +1 -1
  29. package/esm/index.css +55 -42
  30. package/esm/index.d.ts +3 -1
  31. package/esm/index.js +3 -1
  32. package/esm/{component-612e671f.d.ts → types.d.ts} +36 -15
  33. package/esm/types.js +1 -0
  34. package/esm/utils.d.ts +8 -0
  35. package/esm/utils.js +23 -0
  36. package/index.css +55 -42
  37. package/index.d.ts +3 -1
  38. package/index.js +6 -4
  39. package/modern/component.d.ts +5 -0
  40. package/modern/component.js +284 -9
  41. package/modern/components/footer/Component.js +1 -1
  42. package/modern/components/footer/index.css +26 -26
  43. package/modern/components/header/Component.d.ts +7 -0
  44. package/modern/components/header/Component.js +26 -11
  45. package/modern/components/header/index.css +13 -13
  46. package/modern/components/swipeable-backdrop/Component.d.ts +1 -1
  47. package/modern/index.css +55 -42
  48. package/modern/index.d.ts +3 -1
  49. package/modern/index.js +3 -1
  50. package/{cssm/component-517950e0.d.ts → modern/types.d.ts} +36 -15
  51. package/modern/types.js +1 -0
  52. package/modern/utils.d.ts +8 -0
  53. package/modern/utils.js +23 -0
  54. package/package.json +5 -5
  55. package/{modern/component-1cd1bc34.d.ts → types.d.ts} +36 -15
  56. package/types.js +2 -0
  57. package/utils.d.ts +8 -0
  58. package/utils.js +33 -0
  59. package/component-b5d23e5e.js +0 -204
  60. package/cssm/component-517950e0.js +0 -202
  61. package/esm/component-612e671f.js +0 -193
  62. package/modern/component-1cd1bc34.js +0 -221
package/esm/component.js CHANGED
@@ -1,12 +1,255 @@
1
- import 'tslib';
2
- import 'react';
3
- import 'react-div-100vh';
4
- import 'react-merge-refs';
5
- import 'react-swipeable';
6
- import 'classnames';
7
- import '@alfalab/core-components-base-modal/esm';
8
- export { B as BottomSheet, C as CLOSE_OFFSET, H as HEADER_OFFSET } from './component-612e671f.js';
9
- import './components/footer/Component.js';
10
- import './components/swipeable-backdrop/Component.js';
1
+ import { __assign } from 'tslib';
2
+ import React, { forwardRef, useMemo, useState, useRef, useEffect, useImperativeHandle } from 'react';
3
+ import { use100vh } from 'react-div-100vh';
4
+ import mergeRefs from 'react-merge-refs';
5
+ import { useSwipeable } from 'react-swipeable';
6
+ import cn from 'classnames';
7
+ import { BaseModal } from '@alfalab/core-components-base-modal/esm';
8
+ import { Footer } from './components/footer/Component.js';
9
+ import { Header } from './components/header/Component.js';
10
+ import { SwipeableBackdrop } from './components/swipeable-backdrop/Component.js';
11
+ import { convertPercentToNumber, HEADER_OFFSET, TIMEOUT, MARKER_HEIGHT, SCROLL_OFFSET, SWIPE_VELOCITY, CLOSE_OFFSET } from './utils.js';
11
12
  import '@alfalab/core-components-navigation-bar/esm';
12
13
  import '@alfalab/core-components-backdrop/esm';
14
+
15
+ var getDataTestId = function (dataTestId, element) {
16
+ var elementPart = element ? "-".concat(element.toLowerCase()) : '';
17
+ return dataTestId ? "".concat(dataTestId).concat(elementPart) : undefined;
18
+ };
19
+
20
+ var isClient = function () { return typeof window !== 'undefined'; };
21
+
22
+ var styles = {"modal":"bottom-sheet__modal_6ikry","wrapper":"bottom-sheet__wrapper_6ikry","component":"bottom-sheet__component_6ikry","withTransition":"bottom-sheet__withTransition_6ikry","scrollableContainer":"bottom-sheet__scrollableContainer_6ikry","marker":"bottom-sheet__marker_6ikry","content":"bottom-sheet__content_6ikry","noHeader":"bottom-sheet__noHeader_6ikry","noFooter":"bottom-sheet__noFooter_6ikry","scrollLocked":"bottom-sheet__scrollLocked_6ikry","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_6ikry","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_6ikry","appear":"bottom-sheet__appear_6ikry","enter":"bottom-sheet__enter_6ikry","appearActive":"bottom-sheet__appearActive_6ikry","enterActive":"bottom-sheet__enterActive_6ikry","enterDone":"bottom-sheet__enterDone_6ikry","appearDone":"bottom-sheet__appearDone_6ikry","exit":"bottom-sheet__exit_6ikry","exitActive":"bottom-sheet__exitActive_6ikry","background-accent":"bottom-sheet__background-accent_6ikry","background-info":"bottom-sheet__background-info_6ikry","background-attention-muted":"bottom-sheet__background-attention-muted_6ikry","background-positive-muted":"bottom-sheet__background-positive-muted_6ikry","background-negative-muted":"bottom-sheet__background-negative-muted_6ikry","background-primary":"bottom-sheet__background-primary_6ikry","background-primary-inverted":"bottom-sheet__background-primary-inverted_6ikry","background-secondary":"bottom-sheet__background-secondary_6ikry","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_6ikry","background-tertiary":"bottom-sheet__background-tertiary_6ikry","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_6ikry","background-quaternary":"bottom-sheet__background-quaternary_6ikry","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_6ikry","background-specialbg-component":"bottom-sheet__background-specialbg-component_6ikry","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_6ikry","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_6ikry","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_6ikry","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_6ikry","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_6ikry","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_6ikry","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_6ikry","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_6ikry"};
23
+ require('./index.css')
24
+
25
+ var BottomSheet = forwardRef(function (_a, ref) {
26
+ var _b, _c, _d, _e;
27
+ var open = _a.open, title = _a.title, container = _a.container, backgroundColor = _a.backgroundColor, _f = _a.titleSize, titleSize = _f === void 0 ? 'default' : _f, subtitle = _a.subtitle, actionButton = _a.actionButton, contentClassName = _a.contentClassName, containerClassName = _a.containerClassName, containerProps = _a.containerProps, headerClassName = _a.headerClassName, footerClassName = _a.footerClassName, addonClassName = _a.addonClassName, closerClassName = _a.closerClassName, backerClassName = _a.backerClassName, modalClassName = _a.modalClassName, modalWrapperClassName = _a.modalWrapperClassName, className = _a.className, leftAddons = _a.leftAddons, rightAddons = _a.rightAddons, bottomAddons = _a.bottomAddons, hasCloser = _a.hasCloser, hasBacker = _a.hasBacker, _g = _a.titleAlign, titleAlign = _g === void 0 ? 'left' : _g, trimTitle = _a.trimTitle, stickyHeader = _a.stickyHeader, _h = _a.stickyFooter, stickyFooter = _h === void 0 ? true : _h, _j = _a.initialHeight, initialHeight = _j === void 0 ? 'default' : _j, hideOverlay = _a.hideOverlay, hideScrollbar = _a.hideScrollbar, hideHeader = _a.hideHeader, disableOverlayClick = _a.disableOverlayClick, disableBlockingScroll = _a.disableBlockingScroll, children = _a.children, zIndex = _a.zIndex, _k = _a.transitionProps, transitionProps = _k === void 0 ? {} : _k, magneticAreasProp = _a.magneticAreas, initialActiveAreaIndex = _a.initialActiveAreaIndex, dataTestId = _a.dataTestId, _l = _a.swipeable, swipeable = _l === void 0 ? true : _l, scrollLockedProp = _a.scrollLocked, backdropProps = _a.backdropProps, _m = _a.scrollableContainerRef, scrollableContainerRef = _m === void 0 ? function () { return null; } : _m, bottomSheetInstanceRef = _a.bottomSheetInstanceRef, _o = _a.sheetContainerRef, sheetContainerRef = _o === void 0 ? function () { return null; } : _o, onClose = _a.onClose, onBack = _a.onBack, onMagnetize = _a.onMagnetize;
28
+ var hasInitialIdx = initialActiveAreaIndex !== undefined;
29
+ var fullHeight = use100vh() || isClient() ? window.innerHeight : 0;
30
+ var magneticAreas = useMemo(function () {
31
+ if (magneticAreasProp) {
32
+ return magneticAreasProp.map(function (area) { return convertPercentToNumber(area, fullHeight); });
33
+ }
34
+ return [0, fullHeight - HEADER_OFFSET];
35
+ }, [fullHeight, magneticAreasProp]);
36
+ var lastMagneticArea = magneticAreas[magneticAreas.length - 1];
37
+ var _p = useState(hasInitialIdx
38
+ ? lastMagneticArea - magneticAreas[initialActiveAreaIndex]
39
+ : magneticAreas[0]), sheetOffset = _p[0], setSheetOffset = _p[1];
40
+ var _q = useState(1), backdropOpacity = _q[0], setBackdropOpacity = _q[1];
41
+ var _r = useState(hasInitialIdx ? magneticAreas[initialActiveAreaIndex] : lastMagneticArea), activeArea = _r[0], setActiveArea = _r[1];
42
+ var swipingInProgress = useRef(false);
43
+ var headerRef = useRef(null);
44
+ var sheetHeight = useRef(0);
45
+ var sheetRef = useRef(null);
46
+ var scrollableContainer = useRef(null);
47
+ var emptyHeader = !hasCloser && !leftAddons && !title && !hasBacker && !rightAddons;
48
+ var titleIsReactElement = React.isValidElement(title);
49
+ var headerProps = __assign(__assign({}, (titleIsReactElement
50
+ ? { children: title }
51
+ : { title: title ? title === null || title === void 0 ? void 0 : title.toString() : undefined })), { scrollableParentRef: scrollableContainer, headerRef: headerRef, className: headerClassName, addonClassName: addonClassName, closerClassName: closerClassName, backButtonClassName: backerClassName, leftAddons: leftAddons, rightAddons: rightAddons, bottomAddons: bottomAddons, hasCloser: hasCloser, hasBackButton: hasBacker, align: titleAlign, trim: trimTitle, sticky: stickyHeader, dataTestId: getDataTestId(dataTestId, 'header'), onBack: onBack, titleSize: titleSize, subtitle: subtitle, onClose: onClose });
52
+ var getBackdropOpacity = function (offset) {
53
+ var canClose = magneticAreas[0] === 0;
54
+ var secondArea = magneticAreas[1];
55
+ var isSecondArea = secondArea === activeArea;
56
+ if (canClose && isSecondArea && sheetOffset > lastMagneticArea - secondArea) {
57
+ var opacity = 1 - (offset - (lastMagneticArea - secondArea)) / secondArea;
58
+ return Math.max(0, Number(opacity.toFixed(2)));
59
+ }
60
+ return 1;
61
+ };
62
+ var getSheetOffset = function (deltaY) {
63
+ var offset = lastMagneticArea - activeArea + deltaY;
64
+ var maxOffset = magneticAreas[0] === 0 ? 0 : lastMagneticArea - magneticAreas[0];
65
+ if (maxOffset) {
66
+ offset = Math.min(maxOffset, offset);
67
+ }
68
+ return Math.max(0, Math.round(offset));
69
+ };
70
+ var getActiveAreaIndex = function (area) { return magneticAreas.findIndex(function (a) { return a === area; }); };
71
+ var setSheetHeight = function () {
72
+ if (sheetRef.current) {
73
+ sheetHeight.current = sheetRef.current.getBoundingClientRect().height - sheetOffset;
74
+ }
75
+ };
76
+ var scrollToArea = function (idx) {
77
+ var nextArea = magneticAreas[idx];
78
+ if (nextArea === 0) {
79
+ onClose();
80
+ return;
81
+ }
82
+ if (nextArea) {
83
+ setActiveArea(nextArea);
84
+ setSheetOffset(lastMagneticArea - nextArea);
85
+ }
86
+ };
87
+ var magnetize = function (dir, velocity, deltaY) {
88
+ var shouldMagnetizeDownByVelocity = dir === 'Down' && velocity >= SWIPE_VELOCITY;
89
+ var shouldMagnetizeUpByVelocity = dir === 'Up' && velocity >= SWIPE_VELOCITY;
90
+ if (shouldMagnetizeDownByVelocity) {
91
+ var nextArea_1 = magneticAreas
92
+ .slice()
93
+ .reverse()
94
+ .find(function (area) { return area < activeArea; });
95
+ if (nextArea_1 === 0) {
96
+ onClose();
97
+ return;
98
+ }
99
+ var offset_1 = nextArea_1
100
+ ? lastMagneticArea - nextArea_1
101
+ : lastMagneticArea - activeArea;
102
+ setSheetOffset(offset_1);
103
+ setActiveArea(function (prevState) { return nextArea_1 !== null && nextArea_1 !== void 0 ? nextArea_1 : prevState; });
104
+ return;
105
+ }
106
+ if (shouldMagnetizeUpByVelocity) {
107
+ var nextArea_2 = magneticAreas.find(function (area) { return area > activeArea; });
108
+ var offset_2 = nextArea_2 ? lastMagneticArea - nextArea_2 : 0;
109
+ setSheetOffset(offset_2);
110
+ setActiveArea(function (prevState) { return nextArea_2 !== null && nextArea_2 !== void 0 ? nextArea_2 : prevState; });
111
+ return;
112
+ }
113
+ var offset = getSheetOffset(deltaY);
114
+ var currentSheetHeight = lastMagneticArea - offset;
115
+ var secondArea = magneticAreas[1];
116
+ var isSecondArea = activeArea === secondArea;
117
+ var canClose = magneticAreas[0] === 0 && dir === 'Down';
118
+ var shouldCloseByOffset = isSecondArea && canClose && 1 - currentSheetHeight / activeArea > CLOSE_OFFSET;
119
+ if (shouldCloseByOffset) {
120
+ onClose();
121
+ return;
122
+ }
123
+ var nearestArea = magneticAreas.reduceRight(function (res, area) {
124
+ if (Math.abs(area - currentSheetHeight) < res.minOffset) {
125
+ res.minOffset = area - currentSheetHeight;
126
+ res.nearestArea = area;
127
+ }
128
+ return res;
129
+ }, {
130
+ nearestArea: lastMagneticArea,
131
+ minOffset: lastMagneticArea,
132
+ }).nearestArea;
133
+ if (nearestArea === 0) {
134
+ onClose();
135
+ }
136
+ else {
137
+ setSheetOffset(lastMagneticArea - nearestArea);
138
+ setActiveArea(nearestArea);
139
+ setBackdropOpacity(1);
140
+ }
141
+ };
142
+ /**
143
+ * Если контент внутри шторки скроллится - то шторка не должна свайпаться
144
+ * Если шапка внутри шторки зафиксирована - то шторка должна свайпаться только в области шапки
145
+ */
146
+ var shouldSkipSwiping = function (dir, startY) {
147
+ if (!swipeable)
148
+ return true;
149
+ if (scrollLockedProp || swipingInProgress.current)
150
+ return false;
151
+ var scrollableNode = scrollableContainer.current;
152
+ // Точка верхней границы (y координата)
153
+ var bottomSheetTopY = fullHeight - sheetHeight.current;
154
+ if (!scrollableNode ||
155
+ (!stickyHeader && Math.abs(bottomSheetTopY - startY) <= MARKER_HEIGHT) ||
156
+ (stickyHeader &&
157
+ headerRef.current &&
158
+ Math.abs(bottomSheetTopY - startY) <= headerRef.current.clientHeight)) {
159
+ return false;
160
+ }
161
+ return dir === 'Down'
162
+ ? scrollableNode.scrollTop > 0
163
+ : scrollableNode.scrollHeight -
164
+ scrollableNode.scrollTop -
165
+ scrollableNode.clientHeight >
166
+ SCROLL_OFFSET;
167
+ };
168
+ var handleSheetSwipe = function (_a) {
169
+ var dir = _a.dir, initial = _a.initial, velocity = _a.velocity, deltaY = _a.deltaY;
170
+ if (shouldSkipSwiping(dir, initial[1])) {
171
+ return;
172
+ }
173
+ magnetize(dir, velocity, deltaY);
174
+ };
175
+ var handleSheetSwipeStart = function (_a) {
176
+ var dir = _a.dir, initial = _a.initial;
177
+ if (shouldSkipSwiping(dir, initial[1])) {
178
+ return;
179
+ }
180
+ swipingInProgress.current = true;
181
+ };
182
+ var handleSheetSwiped = function () {
183
+ swipingInProgress.current = false;
184
+ };
185
+ var handleSheetSwiping = function (_a) {
186
+ var initial = _a.initial, deltaY = _a.deltaY, dir = _a.dir;
187
+ if (shouldSkipSwiping(dir, initial[1])) {
188
+ return;
189
+ }
190
+ var offset = getSheetOffset(deltaY);
191
+ var opacity = getBackdropOpacity(offset);
192
+ setSheetOffset(offset);
193
+ setBackdropOpacity(opacity);
194
+ };
195
+ var sheetSwipeableHandlers = useSwipeable({
196
+ onSwipeStart: handleSheetSwipeStart,
197
+ onSwiping: handleSheetSwiping,
198
+ onSwipedDown: handleSheetSwipe,
199
+ onSwipedUp: handleSheetSwipe,
200
+ onSwiped: handleSheetSwiped,
201
+ trackMouse: swipeable,
202
+ delta: 5,
203
+ });
204
+ var handleExited = function (node) {
205
+ var idx = initialActiveAreaIndex;
206
+ setBackdropOpacity(1);
207
+ setSheetOffset(hasInitialIdx ? lastMagneticArea - magneticAreas[idx] : magneticAreas[0]);
208
+ setActiveArea(hasInitialIdx ? magneticAreas[idx] : lastMagneticArea);
209
+ if (transitionProps.onExited) {
210
+ transitionProps.onExited(node);
211
+ }
212
+ };
213
+ var handleEntered = function (node, isAppearing) {
214
+ setBackdropOpacity(1);
215
+ setSheetHeight();
216
+ if (transitionProps.onEntered) {
217
+ transitionProps.onEntered(node, isAppearing);
218
+ }
219
+ };
220
+ useEffect(function () {
221
+ onMagnetize === null || onMagnetize === void 0 ? void 0 : onMagnetize(open ? getActiveAreaIndex(activeArea) : 0);
222
+ // eslint-disable-next-line react-hooks/exhaustive-deps
223
+ }, [activeArea, open]);
224
+ useImperativeHandle(bottomSheetInstanceRef, function () { return ({
225
+ scrollToArea: scrollToArea,
226
+ }); });
227
+ var getSwipeStyles = function () { return ({
228
+ transform: sheetOffset ? "translateY(".concat(sheetOffset, "px)") : '',
229
+ }); };
230
+ var getHeightStyles = function () { return ({
231
+ height: initialHeight === 'full' ? "".concat(lastMagneticArea, "px") : 'unset',
232
+ maxHeight: "".concat(lastMagneticArea, "px"),
233
+ }); };
234
+ var bgClassName = backgroundColor && styles["background-".concat(backgroundColor)];
235
+ return (React.createElement(BaseModal, { open: open, ref: ref, container: container, dataTestId: dataTestId, zIndex: zIndex, onClose: onClose, scrollHandler: scrollableContainer, Backdrop: SwipeableBackdrop, backdropProps: __assign(__assign({}, backdropProps), { className: styles.disabledPointerEvents, opacity: backdropOpacity, opacityTimeout: TIMEOUT, invisible: hideOverlay }), disableBackdropClick: hideOverlay ? true : disableOverlayClick, className: cn(styles.modal, modalClassName), wrapperClassName: cn(modalWrapperClassName, (_b = {},
236
+ _b[styles.disabledPointerEvents] = hideOverlay,
237
+ _b)), disableBlockingScroll: disableBlockingScroll, transitionProps: __assign(__assign({ appear: true, timeout: TIMEOUT, classNames: styles }, transitionProps), { onExited: handleExited, onEntered: handleEntered }) },
238
+ React.createElement("div", { style: __assign({}, getHeightStyles()), className: styles.wrapper, onTransitionEnd: setSheetHeight },
239
+ React.createElement("div", __assign({ className: cn(styles.component, bgClassName, className, (_c = {},
240
+ _c[styles.withTransition] = !swipingInProgress.current,
241
+ _c)), style: __assign(__assign({}, getSwipeStyles()), getHeightStyles()) }, sheetSwipeableHandlers, { ref: mergeRefs([sheetRef, sheetContainerRef, sheetSwipeableHandlers.ref]), onTransitionEnd: setSheetHeight }),
242
+ React.createElement("div", __assign({}, containerProps, { className: cn(styles.scrollableContainer, containerProps === null || containerProps === void 0 ? void 0 : containerProps.className, containerClassName, (_d = {},
243
+ _d[styles.scrollLocked] = scrollLockedProp || swipingInProgress.current,
244
+ _d[styles.hiddenScrollbar] = hideScrollbar,
245
+ _d)), ref: mergeRefs([scrollableContainer, scrollableContainerRef]) }),
246
+ swipeable && React.createElement("div", { className: cn(styles.marker) }),
247
+ !hideHeader && !emptyHeader && React.createElement(Header, __assign({}, headerProps)),
248
+ React.createElement("div", { className: cn(styles.content, contentClassName, (_e = {},
249
+ _e[styles.noHeader] = hideHeader || emptyHeader,
250
+ _e[styles.noFooter] = !actionButton,
251
+ _e)) }, children),
252
+ actionButton && (React.createElement(Footer, { sticky: stickyFooter, className: cn(bgClassName, footerClassName) }, actionButton)))))));
253
+ });
254
+
255
+ export { BottomSheet };
@@ -2,7 +2,7 @@ import React, { useContext, useEffect } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { BaseModalContext } from '@alfalab/core-components-base-modal/esm';
4
4
 
5
- var styles = {"footer":"bottom-sheet__footer_7gxws","sticky":"bottom-sheet__sticky_7gxws","highlighted":"bottom-sheet__highlighted_7gxws","background-accent":"bottom-sheet__background-accent_7gxws","background-info":"bottom-sheet__background-info_7gxws","background-attention-muted":"bottom-sheet__background-attention-muted_7gxws","background-positive-muted":"bottom-sheet__background-positive-muted_7gxws","background-negative-muted":"bottom-sheet__background-negative-muted_7gxws","background-primary":"bottom-sheet__background-primary_7gxws","background-primary-inverted":"bottom-sheet__background-primary-inverted_7gxws","background-secondary":"bottom-sheet__background-secondary_7gxws","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_7gxws","background-tertiary":"bottom-sheet__background-tertiary_7gxws","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_7gxws","background-quaternary":"bottom-sheet__background-quaternary_7gxws","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_7gxws","background-specialbg-component":"bottom-sheet__background-specialbg-component_7gxws","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_7gxws","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_7gxws","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_7gxws","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_7gxws","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_7gxws","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_7gxws","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_7gxws","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_7gxws"};
5
+ var styles = {"footer":"bottom-sheet__footer_w482m","sticky":"bottom-sheet__sticky_w482m","highlighted":"bottom-sheet__highlighted_w482m","background-accent":"bottom-sheet__background-accent_w482m","background-info":"bottom-sheet__background-info_w482m","background-attention-muted":"bottom-sheet__background-attention-muted_w482m","background-positive-muted":"bottom-sheet__background-positive-muted_w482m","background-negative-muted":"bottom-sheet__background-negative-muted_w482m","background-primary":"bottom-sheet__background-primary_w482m","background-primary-inverted":"bottom-sheet__background-primary-inverted_w482m","background-secondary":"bottom-sheet__background-secondary_w482m","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_w482m","background-tertiary":"bottom-sheet__background-tertiary_w482m","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_w482m","background-quaternary":"bottom-sheet__background-quaternary_w482m","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_w482m","background-specialbg-component":"bottom-sheet__background-specialbg-component_w482m","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_w482m","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_w482m","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_w482m","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_w482m","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_w482m","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_w482m","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_w482m","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_w482m"};
6
6
  require('./index.css')
7
7
 
8
8
  var Footer = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1nw41 */
1
+ /* hash: xwbh9 */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-bg-accent: #ef3124;
@@ -41,58 +41,58 @@
41
41
  } :root {
42
42
  --bottom-sheet-footer-border-top: 1px solid var(--color-light-border-secondary);
43
43
  --bottom-sheet-footer-background-color: var(--color-light-bg-primary);
44
- } .bottom-sheet__footer_7gxws {
44
+ } .bottom-sheet__footer_w482m {
45
45
  padding: var(--gap-m) var(--gap-m);
46
46
  background-color: var(--color-light-bg-primary);
47
- } .bottom-sheet__sticky_7gxws {
47
+ } .bottom-sheet__sticky_w482m {
48
48
  position: sticky;
49
49
  bottom: 0;
50
50
  z-index: 1;
51
- } .bottom-sheet__highlighted_7gxws {
51
+ } .bottom-sheet__highlighted_w482m {
52
52
  border-top: var(--bottom-sheet-footer-border-top);
53
53
  background-color: var(--bottom-sheet-footer-background-color);
54
- } .bottom-sheet__background-accent_7gxws {
54
+ } .bottom-sheet__background-accent_w482m {
55
55
  background-color: var(--color-light-bg-accent);
56
- } .bottom-sheet__background-info_7gxws {
56
+ } .bottom-sheet__background-info_w482m {
57
57
  background-color: var(--color-light-bg-info);
58
- } .bottom-sheet__background-attention-muted_7gxws {
58
+ } .bottom-sheet__background-attention-muted_w482m {
59
59
  background-color: var(--color-light-bg-attention-muted);
60
- } .bottom-sheet__background-positive-muted_7gxws {
60
+ } .bottom-sheet__background-positive-muted_w482m {
61
61
  background-color: var(--color-light-bg-positive-muted);
62
- } .bottom-sheet__background-negative-muted_7gxws {
62
+ } .bottom-sheet__background-negative-muted_w482m {
63
63
  background-color: var(--color-light-bg-negative-muted);
64
- } .bottom-sheet__background-primary_7gxws {
64
+ } .bottom-sheet__background-primary_w482m {
65
65
  background-color: var(--color-light-bg-primary);
66
- } .bottom-sheet__background-primary-inverted_7gxws {
66
+ } .bottom-sheet__background-primary-inverted_w482m {
67
67
  background-color: var(--color-light-bg-primary-inverted);
68
- } .bottom-sheet__background-secondary_7gxws {
68
+ } .bottom-sheet__background-secondary_w482m {
69
69
  background-color: var(--color-light-bg-secondary);
70
- } .bottom-sheet__background-secondary-inverted_7gxws {
70
+ } .bottom-sheet__background-secondary-inverted_w482m {
71
71
  background-color: var(--color-light-bg-secondary-inverted);
72
- } .bottom-sheet__background-tertiary_7gxws {
72
+ } .bottom-sheet__background-tertiary_w482m {
73
73
  background-color: var(--color-light-bg-tertiary);
74
- } .bottom-sheet__background-tertiary-inverted_7gxws {
74
+ } .bottom-sheet__background-tertiary-inverted_w482m {
75
75
  background-color: var(--color-light-bg-tertiary-inverted);
76
- } .bottom-sheet__background-quaternary_7gxws {
76
+ } .bottom-sheet__background-quaternary_w482m {
77
77
  background-color: var(--color-light-bg-quaternary);
78
- } .bottom-sheet__background-quaternary-inverted_7gxws {
78
+ } .bottom-sheet__background-quaternary-inverted_w482m {
79
79
  background-color: var(--color-light-bg-quaternary-inverted);
80
- } .bottom-sheet__background-specialbg-component_7gxws {
80
+ } .bottom-sheet__background-specialbg-component_w482m {
81
81
  background-color: var(--color-light-specialbg-component);
82
- } .bottom-sheet__background-specialbg-component-inverted_7gxws {
82
+ } .bottom-sheet__background-specialbg-component-inverted_w482m {
83
83
  background-color: var(--color-light-specialbg-component-inverted);
84
- } .bottom-sheet__background-specialbg-primary-grouped_7gxws {
84
+ } .bottom-sheet__background-specialbg-primary-grouped_w482m {
85
85
  background-color: var(--color-light-specialbg-primary-grouped);
86
- } .bottom-sheet__background-specialbg-secondary-grouped_7gxws {
86
+ } .bottom-sheet__background-specialbg-secondary-grouped_w482m {
87
87
  background-color: var(--color-light-specialbg-secondary-grouped);
88
- } .bottom-sheet__background-specialbg-tertiary-grouped_7gxws {
88
+ } .bottom-sheet__background-specialbg-tertiary-grouped_w482m {
89
89
  background-color: var(--color-light-specialbg-tertiary-grouped);
90
- } .bottom-sheet__background-specialbg-secondary-transparent_7gxws {
90
+ } .bottom-sheet__background-specialbg-secondary-transparent_w482m {
91
91
  background-color: var(--color-light-specialbg-secondary-transparent);
92
- } .bottom-sheet__background-specialbg-secondary-transparent-inverted_7gxws {
92
+ } .bottom-sheet__background-specialbg-secondary-transparent-inverted_w482m {
93
93
  background-color: var(--color-light-specialbg-secondary-transparent-inverted);
94
- } .bottom-sheet__background-specialbg-tertiary-transparent_7gxws {
94
+ } .bottom-sheet__background-specialbg-tertiary-transparent_w482m {
95
95
  background-color: var(--color-light-specialbg-tertiary-transparent);
96
- } .bottom-sheet__background-specialbg-tertiary-transparent-inverted_7gxws {
96
+ } .bottom-sheet__background-specialbg-tertiary-transparent-inverted_w482m {
97
97
  background-color: var(--color-light-specialbg-tertiary-transparent-inverted);
98
98
  }
@@ -0,0 +1,7 @@
1
+ import { FC, RefObject } from 'react';
2
+ import { NavigationBarProps } from "@alfalab/core-components-navigation-bar";
3
+ type HeaderProps = Omit<NavigationBarProps, 'view' | 'size'> & {
4
+ headerRef: RefObject<HTMLDivElement>;
5
+ };
6
+ declare const Header: FC<HeaderProps>;
7
+ export { HeaderProps, Header };
@@ -1,12 +1,29 @@
1
- import 'tslib';
2
- import 'react';
3
- import 'classnames';
4
- import '@alfalab/core-components-base-modal/esm';
5
- import '@alfalab/core-components-navigation-bar/esm';
6
- export { a as Header } from '../../component-612e671f.js';
7
- import 'react-div-100vh';
8
- import 'react-merge-refs';
9
- import 'react-swipeable';
10
- import '../footer/Component.js';
11
- import '../swipeable-backdrop/Component.js';
12
- import '@alfalab/core-components-backdrop/esm';
1
+ import { __rest, __assign } from 'tslib';
2
+ import React, { useContext, useEffect } from 'react';
3
+ import cn from 'classnames';
4
+ import { BaseModalContext } from '@alfalab/core-components-base-modal/esm';
5
+ import { NavigationBar } from '@alfalab/core-components-navigation-bar/esm';
6
+ import { HEADER_OFFSET } from '../../utils.js';
7
+
8
+ var styles = {"headerWrapper":"bottom-sheet__headerWrapper_tel2m","hasContent":"bottom-sheet__hasContent_tel2m","header":"bottom-sheet__header_tel2m","sticky":"bottom-sheet__sticky_tel2m","highlighted":"bottom-sheet__highlighted_tel2m","justifyEnd":"bottom-sheet__justifyEnd_tel2m","addon":"bottom-sheet__addon_tel2m","addonFixed":"bottom-sheet__addonFixed_tel2m","title":"bottom-sheet__title_tel2m","titleCenter":"bottom-sheet__titleCenter_tel2m","titleLeft":"bottom-sheet__titleLeft_tel2m","trimTitle":"bottom-sheet__trimTitle_tel2m"};
9
+ require('./index.css')
10
+
11
+ var Header = function (_a) {
12
+ var _b;
13
+ var className = _a.className, sticky = _a.sticky, headerRef = _a.headerRef, title = _a.title, children = _a.children, restProps = __rest(_a, ["className", "sticky", "headerRef", "title", "children"]);
14
+ var _c = useContext(BaseModalContext), setHeaderOffset = _c.setHeaderOffset, setHasHeader = _c.setHasHeader, headerHighlighted = _c.headerHighlighted, onClose = _c.onClose;
15
+ useEffect(function () {
16
+ setHeaderOffset(HEADER_OFFSET);
17
+ }, [setHeaderOffset]);
18
+ useEffect(function () {
19
+ setHasHeader(true);
20
+ }, [setHasHeader]);
21
+ var hasContent = Boolean(title || children);
22
+ return (React.createElement(NavigationBar, __assign({}, restProps, { ref: headerRef, title: title, onClose: onClose, sticky: sticky, view: 'mobile', className: cn(styles.headerWrapper, className, (_b = {},
23
+ _b[styles.highlighted] = hasContent && headerHighlighted && sticky,
24
+ _b[styles.sticky] = sticky,
25
+ _b[styles.hasContent] = hasContent,
26
+ _b)), contentClassName: cn(styles.title) }), children));
27
+ };
28
+
29
+ export { Header };
@@ -1,4 +1,4 @@
1
- /* hash: 16nrz */
1
+ /* hash: gnzfi */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-secondary: #e9e9eb; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -27,42 +27,42 @@
27
27
  --bottom-sheet-title-font-weight: 700;
28
28
  --bottom-sheet-title-line-height: 24px;
29
29
  --bottom-sheet-title-font-family: var(--font-family-system);
30
- } .bottom-sheet__headerWrapper_1034c {
30
+ } .bottom-sheet__headerWrapper_tel2m {
31
31
  padding: var(--gap-s) var(--gap-xs) var(--gap-2xs);
32
32
  border-top-right-radius: var(--border-radius-xl);
33
33
  border-top-left-radius: var(--border-radius-xl);
34
34
  z-index: 1;
35
- } .bottom-sheet__hasContent_1034c {
35
+ } .bottom-sheet__hasContent_tel2m {
36
36
  background-color: inherit;
37
- } .bottom-sheet__header_1034c {
37
+ } .bottom-sheet__header_tel2m {
38
38
  display: flex;
39
- } .bottom-sheet__sticky_1034c {
39
+ } .bottom-sheet__sticky_tel2m {
40
40
  position: sticky;
41
41
  top: 0;
42
- } .bottom-sheet__highlighted_1034c {
42
+ } .bottom-sheet__highlighted_tel2m {
43
43
  border-bottom: var(--bottom-sheet-header-border-bottom);
44
- } .bottom-sheet__justifyEnd_1034c {
44
+ } .bottom-sheet__justifyEnd_tel2m {
45
45
  justify-content: flex-end;
46
- } .bottom-sheet__addon_1034c {
46
+ } .bottom-sheet__addon_tel2m {
47
47
  display: flex;
48
48
  justify-content: center;
49
49
  align-items: center;
50
50
  min-width: 48px;
51
51
  height: 48px;
52
- } .bottom-sheet__addonFixed_1034c {
52
+ } .bottom-sheet__addonFixed_tel2m {
53
53
  position: fixed;
54
- } .bottom-sheet__title_1034c {
54
+ } .bottom-sheet__title_tel2m {
55
55
  padding: var(--gap-s) var(--gap-xs);
56
56
  width: 100%;
57
57
  font-size: var(--bottom-sheet-title-font-size);
58
58
  font-weight: var(--bottom-sheet-title-font-weight);
59
59
  line-height: var(--bottom-sheet-title-line-height);
60
60
  font-family: var(--bottom-sheet-title-font-family);
61
- } .bottom-sheet__titleCenter_1034c {
61
+ } .bottom-sheet__titleCenter_tel2m {
62
62
  text-align: center;
63
- } .bottom-sheet__titleLeft_1034c {
63
+ } .bottom-sheet__titleLeft_tel2m {
64
64
  text-align: left;
65
- } .bottom-sheet__trimTitle_1034c {
65
+ } .bottom-sheet__trimTitle_tel2m {
66
66
  white-space: nowrap;
67
67
  overflow: hidden;
68
68
  text-overflow: ellipsis;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { SwipeableHandlers } from 'react-swipeable/types';
2
+ import { SwipeableHandlers } from 'react-swipeable';
3
3
  import { BackdropProps } from "@alfalab/core-components-backdrop";
4
4
  type SwipeableBackdropProps = BackdropProps & {
5
5
  /**