Skip to content

Commit bfc4690

Browse files
committed
chore: finalize sheet breakpoints
1 parent 1d0f3cf commit bfc4690

5 files changed

Lines changed: 26 additions & 24 deletions

File tree

src/core/components/sheet/sheet-class.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ class Sheet extends Modal {
605605
}
606606
setBackdropBreakpoint(value);
607607
setPushBreakpoint(value);
608-
$el.trigger('sheet:breakpoint', index);
609-
sheet.emit('local::breakpoint sheetBreakpoint', sheet, index);
608+
$el.trigger('sheet:breakpoint', value);
609+
sheet.emit('local::breakpoint sheetBreakpoint', sheet, value);
610610
currentBreakpointIndex = index;
611611
$el[0].style.setProperty('--f7-sheet-breakpoint', `${breakpointsTranslate[index]}px`);
612612
$el.addClass('modal-in-breakpoint');
@@ -688,9 +688,7 @@ class Sheet extends Modal {
688688
sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset));
689689
} else {
690690
$pushViewEl = app.$el.children('.view, .views');
691-
pushBorderRadius = parseFloat(
692-
$el.css(`border-${isTopSheetModal ? 'bottom' : 'top'}-left-radius`),
693-
);
691+
pushBorderRadius = app.theme === 'ios' ? 10 : 16;
694692
$pushViewEl.css('border-radius', '0px');
695693
}
696694
}
@@ -727,8 +725,10 @@ class Sheet extends Modal {
727725
if (sheet.push && pushOffset) {
728726
sheet.$htmlEl.removeClass('with-modal-sheet-push');
729727
sheet.$htmlEl.addClass('with-modal-sheet-push-closing');
730-
$pushViewEl.transform('');
731-
$pushViewEl.css('border-radius', '');
728+
if ($pushViewEl) {
729+
$pushViewEl.transform('');
730+
$pushViewEl.css('border-radius', '');
731+
}
732732
}
733733
});
734734
sheet.on('closed', () => {

src/core/components/sheet/sheet.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export namespace Sheet {
5353
swipeToStep?: boolean;
5454
/** Use instead of swipeToStep to enable swipe breakpoints. Must be an array of numbers > 0 and < 1, where 0 is fully closed and 1 is fully opened, e.g. [0.33, 0.66], [0.5], etc. */
5555
breakpoints?: number[];
56-
/** Defines breakpoint when backdrop becomes visible. Number from `0` (ideally from the lowest (first) value of `breakpoints` array) to `1` */
56+
/** Defines breakpoint when backdrop becomes visible. Number from `0` (ideally from the lowest (first) value of `breakpoints` array) to `1` (default 0) */
5757
backdropBreakpoint?: number;
58-
/** Defines breakpoint when to push back the view behind (`push` must be enabled). Number from `0` (ideally from the lowest (first) value of `breakpoints` array) to `1` */
58+
/** Defines breakpoint when to push back the view behind (`push` must be enabled). Number from `0` (ideally from the lowest (first) value of `breakpoints` array) to `1` (default 0) */
5959
pushBreakpoint?: number;
6060
/** When enabled it will be possible to close sheet with swipe only on specified handler element (default null) */
6161
swipeHandler?: HTMLElement | CSSSelector;

src/core/components/sheet/sheet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export default {
1717
swipeToClose: false,
1818
swipeToStep: false,
1919
breakpoints: [],
20-
backdropBreakpoint: null,
21-
pushBreakpoint: null,
20+
backdropBreakpoint: 0,
21+
pushBreakpoint: 0,
2222
swipeHandler: null,
2323
containerEl: null,
2424
},

src/core/components/sheet/sheet.less

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ html.with-modal-sheet-push-closing {
142142
height: 100%;
143143
background: rgba(255,255,255,0.1);
144144
z-index: 13000;
145-
border-radius: var(--f7-sheet-push-border-radius) var(--f7-sheet-push-border-radius) 0 0;
146145
opacity: 1;
147-
animation: sheet-dark-push-overlay-fade-in var(--f7-sheet-transition-duration) forwards;
146+
transition-duration: var(--f7-sheet-transition-duration);
147+
transition-timing-function: var(--f7-sheet-transition-timing-function);
148+
animation: sheet-dark-push-overlay-fade-in var(--f7-sheet-transition-duration);
148149
animation-timing-function: var(--f7-sheet-transition-timing-function);
149150
}
150151
}
@@ -171,8 +172,8 @@ html.with-modal-sheet-push {
171172
.framework7-root > .views.dark,
172173
.framework7-root > .view.dark {
173174
&:after {
174-
animation: sheet-dark-push-overlay-fade-out var(--f7-sheet-transition-duration) forwards;
175-
animation-timing-function: var(--f7-sheet-transition-timing-function);
175+
opacity: 0;
176+
animation: none;
176177
}
177178
}
178179
}
@@ -185,14 +186,6 @@ html.with-modal-sheet-push {
185186
opacity: 1;
186187
}
187188
}
188-
@keyframes sheet-dark-push-overlay-fade-out {
189-
from {
190-
opacity: 1;
191-
}
192-
to {
193-
opacity: 0;
194-
}
195-
}
196189
});
197190

198191
.if-ios-theme({

src/svelte/components/sheet.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
isOpened: opened,
4040
isClosing: false,
4141
swipeStep: false,
42+
breakpoint: false,
4243
};
4344
4445
export function instance() {
@@ -59,6 +60,7 @@
5960
{
6061
'sheet-modal-push': push,
6162
'modal-in-swipe-step': state.swipeStep,
63+
'modal-in-breakpoint': state.breakpoint,
6264
},
6365
6466
modalStateClasses(state),
@@ -127,7 +129,14 @@
127129
stepOpen: onStepOpen,
128130
stepClose: onStepClose,
129131
stepProgress: onStepProgress,
130-
breakpoint: onBreakpoint,
132+
breakpoint: (s, value) => {
133+
if (value > 0 && value < 1) {
134+
state.breakpoint = true;
135+
} else {
136+
state.breakpoint = false;
137+
}
138+
onBreakpoint(s, value);
139+
},
131140
// eslint-disable-next-line
132141
_swipeStep(isSwipeStep) {
133142
state.swipeStep = isSwipeStep;

0 commit comments

Comments
 (0)