@ionic/core 7.4.3-dev.11696355997.1d94070b → 7.4.3-dev.11696365694.156f41d3
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/components/ion-header.js +1 -1
- package/components/ion-segment.js +23 -35
- package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
- package/dist/cjs/ion-segment_2.cjs.entry.js +24 -35
- package/dist/collection/components/header/header.ios.css +18 -0
- package/dist/collection/components/segment/segment.js +23 -35
- package/dist/collection/components/segment/test/scrollable/segment.e2e.js +1 -53
- package/dist/docs.json +1 -1
- package/dist/esm/ion-app_8.entry.js +1 -1
- package/dist/esm/ion-segment_2.entry.js +24 -35
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-segment_2.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-048d7153.system.entry.js → p-47cb95be.system.entry.js} +1 -1
- package/dist/ionic/p-55b99166.entry.js +4 -0
- package/dist/ionic/{p-f547e62f.entry.js → p-605b085a.entry.js} +1 -1
- package/dist/ionic/p-6edbc09b.system.js +1 -1
- package/dist/ionic/p-b5637aeb.system.entry.js +4 -0
- package/dist/types/components/segment/segment.d.ts +0 -1
- package/hydrate/index.js +24 -35
- package/package.json +1 -1
- package/dist/ionic/p-155dfdda.entry.js +0 -4
- package/dist/ionic/p-f1a71e75.system.entry.js +0 -4
package/components/ion-header.js
CHANGED
|
@@ -183,7 +183,7 @@ const handleHeaderFade = (scrollEl, baseEl, condenseHeader) => {
|
|
|
183
183
|
});
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";
|
|
186
|
+
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}ion-header:not(.header-collapse-main):has(~ion-content ion-header[collapse=condense]){opacity:0}";
|
|
187
187
|
|
|
188
188
|
const headerMdCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md{-webkit-box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.header-collapse-condense{display:none}.header-md.ion-no-border{-webkit-box-shadow:none;box-shadow:none}";
|
|
189
189
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, writeTask, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { r as raf } from './helpers.js';
|
|
6
5
|
import { i as isRTL } from './dir.js';
|
|
7
6
|
import { c as createColorClasses, h as hostContext } from './theme.js';
|
|
8
7
|
import { b as getIonMode } from './ionic-global.js';
|
|
@@ -87,7 +86,29 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
87
86
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
88
87
|
*/
|
|
89
88
|
this.ionSelect.emit({ value });
|
|
90
|
-
this.
|
|
89
|
+
if (this.scrollable) {
|
|
90
|
+
const buttons = this.getButtons();
|
|
91
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
92
|
+
if (activeButton !== undefined) {
|
|
93
|
+
/**
|
|
94
|
+
* Scrollable segment buttons should be
|
|
95
|
+
* centered within the view including
|
|
96
|
+
* buttons that are partially offscreen.
|
|
97
|
+
*/
|
|
98
|
+
activeButton.scrollIntoView({
|
|
99
|
+
behavior: 'smooth',
|
|
100
|
+
inline: 'center',
|
|
101
|
+
/**
|
|
102
|
+
* Segment should scroll on the
|
|
103
|
+
* horizontal axis. `block: 'nearest'`
|
|
104
|
+
* ensures that the vertical axis
|
|
105
|
+
* does not scroll if the segment
|
|
106
|
+
* as a whole is already in view.
|
|
107
|
+
*/
|
|
108
|
+
block: 'nearest',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
91
112
|
}
|
|
92
113
|
disabledChanged() {
|
|
93
114
|
this.gestureChanged();
|
|
@@ -109,13 +130,6 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
109
130
|
}
|
|
110
131
|
async componentDidLoad() {
|
|
111
132
|
this.setCheckedClasses();
|
|
112
|
-
/**
|
|
113
|
-
* We need to wait for the buttons to all be rendered
|
|
114
|
-
* before we can scroll.
|
|
115
|
-
*/
|
|
116
|
-
raf(() => {
|
|
117
|
-
this.scrollActiveButtonIntoView();
|
|
118
|
-
});
|
|
119
133
|
this.gesture = (await import('./index3.js')).createGesture({
|
|
120
134
|
el: this.el,
|
|
121
135
|
gestureName: 'segment',
|
|
@@ -244,32 +258,6 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
244
258
|
buttons[next].classList.add('segment-button-after-checked');
|
|
245
259
|
}
|
|
246
260
|
}
|
|
247
|
-
scrollActiveButtonIntoView() {
|
|
248
|
-
const { scrollable, value } = this;
|
|
249
|
-
if (scrollable) {
|
|
250
|
-
const buttons = this.getButtons();
|
|
251
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
252
|
-
if (activeButton !== undefined) {
|
|
253
|
-
/**
|
|
254
|
-
* Scrollable segment buttons should be
|
|
255
|
-
* centered within the view including
|
|
256
|
-
* buttons that are partially offscreen.
|
|
257
|
-
*/
|
|
258
|
-
activeButton.scrollIntoView({
|
|
259
|
-
behavior: 'smooth',
|
|
260
|
-
inline: 'center',
|
|
261
|
-
/**
|
|
262
|
-
* Segment should scroll on the
|
|
263
|
-
* horizontal axis. `block: 'nearest'`
|
|
264
|
-
* ensures that the vertical axis
|
|
265
|
-
* does not scroll if the segment
|
|
266
|
-
* as a whole is already in view.
|
|
267
|
-
*/
|
|
268
|
-
block: 'nearest',
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
261
|
setNextIndex(detail, isEnd = false) {
|
|
274
262
|
const rtl = isRTL(this.el);
|
|
275
263
|
const activated = this.activated;
|
|
@@ -788,7 +788,7 @@ const handleHeaderFade = (scrollEl, baseEl, condenseHeader) => {
|
|
|
788
788
|
});
|
|
789
789
|
};
|
|
790
790
|
|
|
791
|
-
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";
|
|
791
|
+
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}ion-header:not(.header-collapse-main):has(~ion-content ion-header[collapse=condense]){opacity:0}";
|
|
792
792
|
|
|
793
793
|
const headerMdCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md{-webkit-box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.header-collapse-condense{display:none}.header-md.ion-no-border{-webkit-box-shadow:none;box-shadow:none}";
|
|
794
794
|
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6f887430.js');
|
|
9
|
-
const helpers = require('./helpers-ea4ccbcb.js');
|
|
10
9
|
const dir = require('./dir-f1e0ca26.js');
|
|
11
10
|
const theme = require('./theme-fbc56b3b.js');
|
|
12
11
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
12
|
+
const helpers = require('./helpers-ea4ccbcb.js');
|
|
13
13
|
|
|
14
14
|
const segmentIosCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.065);border-radius:8px;overflow:hidden;z-index:0}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.065)}:host(.in-toolbar){-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:auto}:host(.in-toolbar:not(.ion-color)){background:var(--ion-toolbar-segment-background, var(--background))}:host(.in-toolbar-color:not(.ion-color)){background:rgba(var(--ion-color-contrast-rgb), 0.11)}";
|
|
15
15
|
|
|
@@ -89,7 +89,29 @@ const Segment = class {
|
|
|
89
89
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
90
90
|
*/
|
|
91
91
|
this.ionSelect.emit({ value });
|
|
92
|
-
this.
|
|
92
|
+
if (this.scrollable) {
|
|
93
|
+
const buttons = this.getButtons();
|
|
94
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
95
|
+
if (activeButton !== undefined) {
|
|
96
|
+
/**
|
|
97
|
+
* Scrollable segment buttons should be
|
|
98
|
+
* centered within the view including
|
|
99
|
+
* buttons that are partially offscreen.
|
|
100
|
+
*/
|
|
101
|
+
activeButton.scrollIntoView({
|
|
102
|
+
behavior: 'smooth',
|
|
103
|
+
inline: 'center',
|
|
104
|
+
/**
|
|
105
|
+
* Segment should scroll on the
|
|
106
|
+
* horizontal axis. `block: 'nearest'`
|
|
107
|
+
* ensures that the vertical axis
|
|
108
|
+
* does not scroll if the segment
|
|
109
|
+
* as a whole is already in view.
|
|
110
|
+
*/
|
|
111
|
+
block: 'nearest',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
93
115
|
}
|
|
94
116
|
disabledChanged() {
|
|
95
117
|
this.gestureChanged();
|
|
@@ -111,13 +133,6 @@ const Segment = class {
|
|
|
111
133
|
}
|
|
112
134
|
async componentDidLoad() {
|
|
113
135
|
this.setCheckedClasses();
|
|
114
|
-
/**
|
|
115
|
-
* We need to wait for the buttons to all be rendered
|
|
116
|
-
* before we can scroll.
|
|
117
|
-
*/
|
|
118
|
-
helpers.raf(() => {
|
|
119
|
-
this.scrollActiveButtonIntoView();
|
|
120
|
-
});
|
|
121
136
|
this.gesture = (await Promise.resolve().then(function () { return require('./index-0ee995e4.js'); })).createGesture({
|
|
122
137
|
el: this.el,
|
|
123
138
|
gestureName: 'segment',
|
|
@@ -246,32 +261,6 @@ const Segment = class {
|
|
|
246
261
|
buttons[next].classList.add('segment-button-after-checked');
|
|
247
262
|
}
|
|
248
263
|
}
|
|
249
|
-
scrollActiveButtonIntoView() {
|
|
250
|
-
const { scrollable, value } = this;
|
|
251
|
-
if (scrollable) {
|
|
252
|
-
const buttons = this.getButtons();
|
|
253
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
254
|
-
if (activeButton !== undefined) {
|
|
255
|
-
/**
|
|
256
|
-
* Scrollable segment buttons should be
|
|
257
|
-
* centered within the view including
|
|
258
|
-
* buttons that are partially offscreen.
|
|
259
|
-
*/
|
|
260
|
-
activeButton.scrollIntoView({
|
|
261
|
-
behavior: 'smooth',
|
|
262
|
-
inline: 'center',
|
|
263
|
-
/**
|
|
264
|
-
* Segment should scroll on the
|
|
265
|
-
* horizontal axis. `block: 'nearest'`
|
|
266
|
-
* ensures that the vertical axis
|
|
267
|
-
* does not scroll if the segment
|
|
268
|
-
* as a whole is already in view.
|
|
269
|
-
*/
|
|
270
|
-
block: 'nearest',
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
264
|
setNextIndex(detail, isEnd = false) {
|
|
276
265
|
const rtl = dir.isRTL(this.el);
|
|
277
266
|
const activated = this.activated;
|
|
@@ -103,4 +103,22 @@ ion-header ion-toolbar:first-of-type {
|
|
|
103
103
|
.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,
|
|
104
104
|
.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse {
|
|
105
105
|
visibility: hidden;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The main header is only hidden once the collapsible large
|
|
110
|
+
* title is configured. As a result, if the main header loads
|
|
111
|
+
* before the collapsible large title is configured then the
|
|
112
|
+
* main header will be visible briefly before being hidden
|
|
113
|
+
* by the collapsible large title.
|
|
114
|
+
*
|
|
115
|
+
* The following selector ensures that any main header
|
|
116
|
+
* on a page with a collapsible large title is hidden
|
|
117
|
+
* before the collapsible large title is configured.
|
|
118
|
+
* Once the collapsible large title is configured the main
|
|
119
|
+
* header will have the ".header-collapse-main" class, and
|
|
120
|
+
* this selector will no longer apply.
|
|
121
|
+
*/
|
|
122
|
+
ion-header:not(.header-collapse-main):has(~ ion-content ion-header[collapse=condense]) {
|
|
123
|
+
opacity: 0;
|
|
106
124
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { Host, h, writeTask } from "@stencil/core";
|
|
5
|
-
import { raf } from "../../utils/helpers";
|
|
6
5
|
import { isRTL } from "../../utils/rtl/index";
|
|
7
6
|
import { createColorClasses, hostContext } from "../../utils/theme";
|
|
8
7
|
import { getIonMode } from "../../global/ionic-global";
|
|
@@ -79,7 +78,29 @@ export class Segment {
|
|
|
79
78
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
80
79
|
*/
|
|
81
80
|
this.ionSelect.emit({ value });
|
|
82
|
-
this.
|
|
81
|
+
if (this.scrollable) {
|
|
82
|
+
const buttons = this.getButtons();
|
|
83
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
84
|
+
if (activeButton !== undefined) {
|
|
85
|
+
/**
|
|
86
|
+
* Scrollable segment buttons should be
|
|
87
|
+
* centered within the view including
|
|
88
|
+
* buttons that are partially offscreen.
|
|
89
|
+
*/
|
|
90
|
+
activeButton.scrollIntoView({
|
|
91
|
+
behavior: 'smooth',
|
|
92
|
+
inline: 'center',
|
|
93
|
+
/**
|
|
94
|
+
* Segment should scroll on the
|
|
95
|
+
* horizontal axis. `block: 'nearest'`
|
|
96
|
+
* ensures that the vertical axis
|
|
97
|
+
* does not scroll if the segment
|
|
98
|
+
* as a whole is already in view.
|
|
99
|
+
*/
|
|
100
|
+
block: 'nearest',
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
83
104
|
}
|
|
84
105
|
disabledChanged() {
|
|
85
106
|
this.gestureChanged();
|
|
@@ -101,13 +122,6 @@ export class Segment {
|
|
|
101
122
|
}
|
|
102
123
|
async componentDidLoad() {
|
|
103
124
|
this.setCheckedClasses();
|
|
104
|
-
/**
|
|
105
|
-
* We need to wait for the buttons to all be rendered
|
|
106
|
-
* before we can scroll.
|
|
107
|
-
*/
|
|
108
|
-
raf(() => {
|
|
109
|
-
this.scrollActiveButtonIntoView();
|
|
110
|
-
});
|
|
111
125
|
this.gesture = (await import('../../utils/gesture')).createGesture({
|
|
112
126
|
el: this.el,
|
|
113
127
|
gestureName: 'segment',
|
|
@@ -236,32 +250,6 @@ export class Segment {
|
|
|
236
250
|
buttons[next].classList.add('segment-button-after-checked');
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
|
-
scrollActiveButtonIntoView() {
|
|
240
|
-
const { scrollable, value } = this;
|
|
241
|
-
if (scrollable) {
|
|
242
|
-
const buttons = this.getButtons();
|
|
243
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
244
|
-
if (activeButton !== undefined) {
|
|
245
|
-
/**
|
|
246
|
-
* Scrollable segment buttons should be
|
|
247
|
-
* centered within the view including
|
|
248
|
-
* buttons that are partially offscreen.
|
|
249
|
-
*/
|
|
250
|
-
activeButton.scrollIntoView({
|
|
251
|
-
behavior: 'smooth',
|
|
252
|
-
inline: 'center',
|
|
253
|
-
/**
|
|
254
|
-
* Segment should scroll on the
|
|
255
|
-
* horizontal axis. `block: 'nearest'`
|
|
256
|
-
* ensures that the vertical axis
|
|
257
|
-
* does not scroll if the segment
|
|
258
|
-
* as a whole is already in view.
|
|
259
|
-
*/
|
|
260
|
-
block: 'nearest',
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
253
|
setNextIndex(detail, isEnd = false) {
|
|
266
254
|
const rtl = isRTL(this.el);
|
|
267
255
|
const activated = this.activated;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { expect } from "@playwright/test";
|
|
5
5
|
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
6
|
configs().forEach(({ title, screenshot, config }) => {
|
|
7
|
-
test.describe(title('segment: scrollable
|
|
7
|
+
test.describe(title('segment: scrollable'), () => {
|
|
8
8
|
test('should not have visual regressions', async ({ page }) => {
|
|
9
9
|
await page.setContent(`
|
|
10
10
|
<ion-segment scrollable="true" value="2">
|
|
@@ -42,55 +42,3 @@ configs().forEach(({ title, screenshot, config }) => {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
-
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
46
|
-
test.describe(title('segment: scrollable (functionality)'), () => {
|
|
47
|
-
test('should scroll active button into view when value is already set', async ({ page }) => {
|
|
48
|
-
await page.setContent(`
|
|
49
|
-
<ion-segment scrollable="true" value="8">
|
|
50
|
-
<ion-segment-button value="1">
|
|
51
|
-
<ion-label>First</ion-label>
|
|
52
|
-
</ion-segment-button>
|
|
53
|
-
<ion-segment-button value="2">
|
|
54
|
-
<ion-label>Second</ion-label>
|
|
55
|
-
</ion-segment-button>
|
|
56
|
-
<ion-segment-button value="3">
|
|
57
|
-
<ion-label>Third</ion-label>
|
|
58
|
-
</ion-segment-button>
|
|
59
|
-
<ion-segment-button value="4">
|
|
60
|
-
<ion-label>Fourth</ion-label>
|
|
61
|
-
</ion-segment-button>
|
|
62
|
-
<ion-segment-button value="5">
|
|
63
|
-
<ion-label>Fifth</ion-label>
|
|
64
|
-
</ion-segment-button>
|
|
65
|
-
<ion-segment-button value="6">
|
|
66
|
-
<ion-label>Sixth</ion-label>
|
|
67
|
-
</ion-segment-button>
|
|
68
|
-
<ion-segment-button value="7">
|
|
69
|
-
<ion-label>Seventh</ion-label>
|
|
70
|
-
</ion-segment-button>
|
|
71
|
-
<ion-segment-button id="activeButton" value="8">
|
|
72
|
-
<ion-label>Eighth</ion-label>
|
|
73
|
-
</ion-segment-button>
|
|
74
|
-
<ion-segment-button value="9">
|
|
75
|
-
<ion-label>Ninth</ion-label>
|
|
76
|
-
</ion-segment-button>
|
|
77
|
-
</ion-segment>
|
|
78
|
-
`, config);
|
|
79
|
-
const activeButton = page.locator('#activeButton');
|
|
80
|
-
// wait for segment to scroll, which is done in a raf
|
|
81
|
-
await page.waitForTimeout(500);
|
|
82
|
-
/**
|
|
83
|
-
* We can't use toBeVisible() here because it returns true
|
|
84
|
-
* even if the element is outside the viewport.
|
|
85
|
-
*/
|
|
86
|
-
const box = await activeButton.boundingBox();
|
|
87
|
-
const viewport = page.viewportSize();
|
|
88
|
-
let isInViewport = false;
|
|
89
|
-
if (box && viewport) {
|
|
90
|
-
isInViewport =
|
|
91
|
-
box.x >= 0 && box.y >= 0 && box.x + box.width <= viewport.width && box.y + box.height <= viewport.height;
|
|
92
|
-
}
|
|
93
|
-
expect(isInViewport).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
package/dist/docs.json
CHANGED
|
@@ -784,7 +784,7 @@ const handleHeaderFade = (scrollEl, baseEl, condenseHeader) => {
|
|
|
784
784
|
});
|
|
785
785
|
};
|
|
786
786
|
|
|
787
|
-
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";
|
|
787
|
+
const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:1px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}ion-header:not(.header-collapse-main):has(~ion-content ion-header[collapse=condense]){opacity:0}";
|
|
788
788
|
|
|
789
789
|
const headerMdCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md{-webkit-box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.header-collapse-condense{display:none}.header-md.ion-no-border{-webkit-box-shadow:none;box-shadow:none}";
|
|
790
790
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { r as registerInstance, d as createEvent, w as writeTask, h, H as Host, f as getElement, i as forceUpdate } from './index-2d388930.js';
|
|
5
|
-
import { r as raf, a as addEventListener, b as removeEventListener, k as inheritAttributes } from './helpers-3379ba19.js';
|
|
6
5
|
import { i as isRTL } from './dir-912e3e13.js';
|
|
7
6
|
import { c as createColorClasses, h as hostContext } from './theme-17531cdf.js';
|
|
8
7
|
import { b as getIonMode } from './ionic-global-b3fc28dd.js';
|
|
8
|
+
import { a as addEventListener, b as removeEventListener, k as inheritAttributes } from './helpers-3379ba19.js';
|
|
9
9
|
|
|
10
10
|
const segmentIosCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.065);border-radius:8px;overflow:hidden;z-index:0}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.065)}:host(.in-toolbar){-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:auto}:host(.in-toolbar:not(.ion-color)){background:var(--ion-toolbar-segment-background, var(--background))}:host(.in-toolbar-color:not(.ion-color)){background:rgba(var(--ion-color-contrast-rgb), 0.11)}";
|
|
11
11
|
|
|
@@ -85,7 +85,29 @@ const Segment = class {
|
|
|
85
85
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
86
86
|
*/
|
|
87
87
|
this.ionSelect.emit({ value });
|
|
88
|
-
this.
|
|
88
|
+
if (this.scrollable) {
|
|
89
|
+
const buttons = this.getButtons();
|
|
90
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
91
|
+
if (activeButton !== undefined) {
|
|
92
|
+
/**
|
|
93
|
+
* Scrollable segment buttons should be
|
|
94
|
+
* centered within the view including
|
|
95
|
+
* buttons that are partially offscreen.
|
|
96
|
+
*/
|
|
97
|
+
activeButton.scrollIntoView({
|
|
98
|
+
behavior: 'smooth',
|
|
99
|
+
inline: 'center',
|
|
100
|
+
/**
|
|
101
|
+
* Segment should scroll on the
|
|
102
|
+
* horizontal axis. `block: 'nearest'`
|
|
103
|
+
* ensures that the vertical axis
|
|
104
|
+
* does not scroll if the segment
|
|
105
|
+
* as a whole is already in view.
|
|
106
|
+
*/
|
|
107
|
+
block: 'nearest',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
89
111
|
}
|
|
90
112
|
disabledChanged() {
|
|
91
113
|
this.gestureChanged();
|
|
@@ -107,13 +129,6 @@ const Segment = class {
|
|
|
107
129
|
}
|
|
108
130
|
async componentDidLoad() {
|
|
109
131
|
this.setCheckedClasses();
|
|
110
|
-
/**
|
|
111
|
-
* We need to wait for the buttons to all be rendered
|
|
112
|
-
* before we can scroll.
|
|
113
|
-
*/
|
|
114
|
-
raf(() => {
|
|
115
|
-
this.scrollActiveButtonIntoView();
|
|
116
|
-
});
|
|
117
132
|
this.gesture = (await import('./index-ff313b19.js')).createGesture({
|
|
118
133
|
el: this.el,
|
|
119
134
|
gestureName: 'segment',
|
|
@@ -242,32 +257,6 @@ const Segment = class {
|
|
|
242
257
|
buttons[next].classList.add('segment-button-after-checked');
|
|
243
258
|
}
|
|
244
259
|
}
|
|
245
|
-
scrollActiveButtonIntoView() {
|
|
246
|
-
const { scrollable, value } = this;
|
|
247
|
-
if (scrollable) {
|
|
248
|
-
const buttons = this.getButtons();
|
|
249
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
250
|
-
if (activeButton !== undefined) {
|
|
251
|
-
/**
|
|
252
|
-
* Scrollable segment buttons should be
|
|
253
|
-
* centered within the view including
|
|
254
|
-
* buttons that are partially offscreen.
|
|
255
|
-
*/
|
|
256
|
-
activeButton.scrollIntoView({
|
|
257
|
-
behavior: 'smooth',
|
|
258
|
-
inline: 'center',
|
|
259
|
-
/**
|
|
260
|
-
* Segment should scroll on the
|
|
261
|
-
* horizontal axis. `block: 'nearest'`
|
|
262
|
-
* ensures that the vertical axis
|
|
263
|
-
* does not scroll if the segment
|
|
264
|
-
* as a whole is already in view.
|
|
265
|
-
*/
|
|
266
|
-
block: 'nearest',
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
260
|
setNextIndex(detail, isEnd = false) {
|
|
272
261
|
const rtl = isRTL(this.el);
|
|
273
262
|
const activated = this.activated;
|