@vaadin/vaadin-tabs 22.0.0-alpha6 → 22.0.0-beta1

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/package.json CHANGED
@@ -1,10 +1,29 @@
1
1
  {
2
2
  "name": "@vaadin/vaadin-tabs",
3
- "version": "22.0.0-alpha6",
3
+ "version": "22.0.0-beta1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
4
7
  "description": "vaadin-tabs",
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/vaadin/web-components.git",
12
+ "directory": "packages/vaadin-tabs"
13
+ },
14
+ "author": "Vaadin Ltd",
15
+ "homepage": "https://vaadin.com/components",
16
+ "bugs": {
17
+ "url": "https://github.com/vaadin/vaadin-tabs/issues"
18
+ },
5
19
  "main": "vaadin-tabs.js",
6
20
  "module": "vaadin-tabs.js",
7
- "repository": "vaadin/vaadin-tabs",
21
+ "files": [
22
+ "src",
23
+ "theme",
24
+ "vaadin-*.d.ts",
25
+ "vaadin-*.js"
26
+ ],
8
27
  "keywords": [
9
28
  "Vaadin",
10
29
  "vaadin-tabs",
@@ -12,35 +31,8 @@
12
31
  "web-component",
13
32
  "polymer"
14
33
  ],
15
- "author": "Vaadin Ltd",
16
- "license": "Apache-2.0",
17
- "bugs": {
18
- "url": "https://github.com/vaadin/vaadin-tabs/issues"
19
- },
20
- "homepage": "https://vaadin.com/components",
21
- "files": [
22
- "vaadin-*.d.ts",
23
- "vaadin-*.js",
24
- "src",
25
- "theme"
26
- ],
27
34
  "dependencies": {
28
- "@polymer/iron-resizable-behavior": "^3.0.0",
29
- "@polymer/polymer": "^3.0.0",
30
- "@vaadin/vaadin-element-mixin": "^22.0.0-alpha6",
31
- "@vaadin/vaadin-item": "^22.0.0-alpha6",
32
- "@vaadin/vaadin-list-mixin": "^22.0.0-alpha6",
33
- "@vaadin/vaadin-lumo-styles": "^22.0.0-alpha6",
34
- "@vaadin/vaadin-material-styles": "^22.0.0-alpha6",
35
- "@vaadin/vaadin-themable-mixin": "^22.0.0-alpha6"
36
- },
37
- "devDependencies": {
38
- "@esm-bundle/chai": "^4.3.4",
39
- "@vaadin/testing-helpers": "^0.3.0",
40
- "sinon": "^9.2.1"
41
- },
42
- "publishConfig": {
43
- "access": "public"
35
+ "@vaadin/tabs": "22.0.0-beta1"
44
36
  },
45
- "gitHead": "4b136b1c7da8942960e7255f40c27859125b3a45"
37
+ "gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e"
46
38
  }
@@ -1,39 +1,18 @@
1
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
-
3
- import { ItemMixin } from '@vaadin/vaadin-item/src/vaadin-item-mixin.js';
4
-
5
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { Tab } from '@vaadin/tabs/src/vaadin-tab.js';
6
7
 
7
8
  /**
8
- * `<vaadin-tab>` is a Web Component providing an accessible and customizable tab.
9
- *
10
- * ```
11
- * <vaadin-tab>
12
- * Tab 1
13
- * </vaadin-tab>
14
- * ```
15
- *
16
- * The following state attributes are available for styling:
17
- *
18
- * Attribute | Description | Part name
19
- * -----------|-------------|------------
20
- * `disabled` | Set to a disabled tab | :host
21
- * `focused` | Set when the element is focused | :host
22
- * `focus-ring` | Set when the element is keyboard focused | :host
23
- * `selected` | Set when the tab is selected | :host
24
- * `active` | Set when mousedown or enter/spacebar pressed | :host
25
- * `orientation` | Set to `horizontal` or `vertical` depending on the direction of items | :host
26
- *
27
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
9
+ * @deprecated Import `Tab` from `@vaadin/tabs/vaadin-tab` instead.
28
10
  */
29
- declare class TabElement extends ElementMixin(ThemableMixin(ItemMixin(HTMLElement))) {
30
- _onKeyup(event: KeyboardEvent): void;
31
- }
11
+ export type TabElement = Tab;
32
12
 
33
- declare global {
34
- interface HTMLElementTagNameMap {
35
- 'vaadin-tab': TabElement;
36
- }
37
- }
13
+ /**
14
+ * @deprecated Import `Tab` from `@vaadin/tabs/vaadin-tab` instead.
15
+ */
16
+ export const TabElement: typeof Tab;
38
17
 
39
- export { TabElement };
18
+ export * from '@vaadin/tabs/src/vaadin-tab.js';
package/src/vaadin-tab.js CHANGED
@@ -3,71 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
7
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
- import { ItemMixin } from '@vaadin/vaadin-item/src/vaadin-item-mixin.js';
9
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
6
+ import { Tab } from '@vaadin/tabs/src/vaadin-tab.js';
10
7
 
11
8
  /**
12
- * `<vaadin-tab>` is a Web Component providing an accessible and customizable tab.
13
- *
14
- * ```
15
- * <vaadin-tab>
16
- * Tab 1
17
- * </vaadin-tab>
18
- * ```
19
- *
20
- * The following state attributes are available for styling:
21
- *
22
- * Attribute | Description | Part name
23
- * -----------|-------------|------------
24
- * `disabled` | Set to a disabled tab | :host
25
- * `focused` | Set when the element is focused | :host
26
- * `focus-ring` | Set when the element is keyboard focused | :host
27
- * `selected` | Set when the tab is selected | :host
28
- * `active` | Set when mousedown or enter/spacebar pressed | :host
29
- * `orientation` | Set to `horizontal` or `vertical` depending on the direction of items | :host
30
- *
31
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
32
- *
33
- * @extends HTMLElement
34
- * @mixes ElementMixin
35
- * @mixes ThemableMixin
36
- * @mixes ItemMixin
9
+ * @deprecated Import `Tab` from `@vaadin/tabs/vaadin-tab` instead.
37
10
  */
38
- class TabElement extends ElementMixin(ThemableMixin(ItemMixin(PolymerElement))) {
39
- static get template() {
40
- return html`<slot></slot>`;
41
- }
11
+ export const TabElement = Tab;
42
12
 
43
- static get is() {
44
- return 'vaadin-tab';
45
- }
46
-
47
- /** @protected */
48
- ready() {
49
- super.ready();
50
- this.setAttribute('role', 'tab');
51
- }
52
-
53
- /**
54
- * @param {!KeyboardEvent} event
55
- * @protected
56
- */
57
- _onKeyup(event) {
58
- const willClick = this.hasAttribute('active');
59
-
60
- super._onKeyup(event);
61
-
62
- if (willClick) {
63
- const anchor = this.querySelector('a');
64
- if (anchor) {
65
- anchor.click();
66
- }
67
- }
68
- }
69
- }
70
-
71
- customElements.define(TabElement.is, TabElement);
72
-
73
- export { TabElement };
13
+ export * from '@vaadin/tabs/src/vaadin-tab.js';
@@ -1,95 +1,18 @@
1
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
-
3
- import { ListMixin } from '@vaadin/vaadin-list-mixin/vaadin-list-mixin.js';
4
-
5
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
6
-
7
- import { ListOrientation } from '@vaadin/vaadin-list-mixin/interfaces';
8
-
9
1
  /**
10
- * Fired when the `items` property changes.
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
11
5
  */
12
- export type TabsItemsChangedEvent = CustomEvent<{ value: Array<Element> }>;
6
+ import { Tabs } from '@vaadin/tabs/src/vaadin-tabs.js';
13
7
 
14
8
  /**
15
- * Fired when the `selected` property changes.
9
+ * @deprecated Import `Tabs` from `@vaadin/tabs` instead.
16
10
  */
17
- export type TabsSelectedChangedEvent = CustomEvent<{ value: number }>;
18
-
19
- export interface TabsElementEventMap {
20
- 'items-changed': TabsItemsChangedEvent;
21
-
22
- 'selected-changed': TabsSelectedChangedEvent;
23
- }
24
-
25
- export interface TabsEventMap extends HTMLElementEventMap, TabsElementEventMap {}
11
+ export type TabsElement = Tabs;
26
12
 
27
13
  /**
28
- * `<vaadin-tabs>` is a Web Component for easy switching between different views.
29
- *
30
- * ```
31
- * <vaadin-tabs selected="4">
32
- * <vaadin-tab>Page 1</vaadin-tab>
33
- * <vaadin-tab>Page 2</vaadin-tab>
34
- * <vaadin-tab>Page 3</vaadin-tab>
35
- * <vaadin-tab>Page 4</vaadin-tab>
36
- * </vaadin-tabs>
37
- * ```
38
- *
39
- * ### Styling
40
- *
41
- * The following shadow DOM parts are available for styling:
42
- *
43
- * Part name | Description
44
- * ------------------|--------------------------------------
45
- * `back-button` | Button for moving the scroll back
46
- * `tabs` | The tabs container
47
- * `forward-button` | Button for moving the scroll forward
48
- *
49
- * The following state attributes are available for styling:
50
- *
51
- * Attribute | Description | Part name
52
- * -----------|-------------|------------
53
- * `orientation` | Tabs disposition, valid values are `horizontal` and `vertical`. | :host
54
- * `overflow` | It's set to `start`, `end`, none or both. | :host
55
- *
56
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
57
- *
58
- * @fires {CustomEvent} items-changed - Fired when the `items` property changes.
59
- * @fires {CustomEvent} selected-changed - Fired when the `selected` property changes.
14
+ * @deprecated Import `Tabs` from `@vaadin/tabs` instead.
60
15
  */
61
- declare class TabsElement extends ElementMixin(ListMixin(ThemableMixin(HTMLElement))) {
62
- readonly _scrollerElement: HTMLElement;
63
-
64
- /**
65
- * The index of the selected tab.
66
- */
67
- selected: number | null | undefined;
68
-
69
- /**
70
- * Set tabs disposition. Possible values are `horizontal|vertical`
71
- */
72
- orientation: ListOrientation;
73
-
74
- readonly _scrollOffset: number;
75
-
76
- addEventListener<K extends keyof TabsEventMap>(
77
- type: K,
78
- listener: (this: TabsElement, ev: TabsEventMap[K]) => void,
79
- options?: boolean | AddEventListenerOptions
80
- ): void;
81
-
82
- removeEventListener<K extends keyof TabsEventMap>(
83
- type: K,
84
- listener: (this: TabsElement, ev: TabsEventMap[K]) => void,
85
- options?: boolean | EventListenerOptions
86
- ): void;
87
- }
88
-
89
- declare global {
90
- interface HTMLElementTagNameMap {
91
- 'vaadin-tabs': TabsElement;
92
- }
93
- }
16
+ export const TabsElement: typeof Tabs;
94
17
 
95
- export { TabsElement };
18
+ export * from '@vaadin/tabs/src/vaadin-tabs.js';
@@ -3,238 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
7
- import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
8
- import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
9
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { ListMixin } from '@vaadin/vaadin-list-mixin/vaadin-list-mixin.js';
11
- import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
12
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
13
- import './vaadin-tab.js';
6
+ import { Tabs } from '@vaadin/tabs/src/vaadin-tabs.js';
14
7
 
15
8
  /**
16
- * `<vaadin-tabs>` is a Web Component for easy switching between different views.
17
- *
18
- * ```
19
- * <vaadin-tabs selected="4">
20
- * <vaadin-tab>Page 1</vaadin-tab>
21
- * <vaadin-tab>Page 2</vaadin-tab>
22
- * <vaadin-tab>Page 3</vaadin-tab>
23
- * <vaadin-tab>Page 4</vaadin-tab>
24
- * </vaadin-tabs>
25
- * ```
26
- *
27
- * ### Styling
28
- *
29
- * The following shadow DOM parts are available for styling:
30
- *
31
- * Part name | Description
32
- * ------------------|--------------------------------------
33
- * `back-button` | Button for moving the scroll back
34
- * `tabs` | The tabs container
35
- * `forward-button` | Button for moving the scroll forward
36
- *
37
- * The following state attributes are available for styling:
38
- *
39
- * Attribute | Description | Part name
40
- * -----------|-------------|------------
41
- * `orientation` | Tabs disposition, valid values are `horizontal` and `vertical`. | :host
42
- * `overflow` | It's set to `start`, `end`, none or both. | :host
43
- *
44
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
45
- *
46
- * @fires {CustomEvent} items-changed - Fired when the `items` property changes.
47
- * @fires {CustomEvent} selected-changed - Fired when the `selected` property changes.
48
- *
49
- * @extends HTMLElement
50
- * @mixes ElementMixin
51
- * @mixes ListMixin
52
- * @mixes ThemableMixin
9
+ * @deprecated Import `Tabs` from `@vaadin/tabs` instead.
53
10
  */
54
- class TabsElement extends ElementMixin(
55
- ListMixin(ThemableMixin(mixinBehaviors([IronResizableBehavior], PolymerElement)))
56
- ) {
57
- static get template() {
58
- return html`
59
- <style>
60
- :host {
61
- display: flex;
62
- align-items: center;
63
- }
11
+ export const TabsElement = Tabs;
64
12
 
65
- :host([hidden]) {
66
- display: none !important;
67
- }
68
-
69
- :host([orientation='vertical']) {
70
- display: block;
71
- }
72
-
73
- :host([orientation='horizontal']) [part='tabs'] {
74
- flex-grow: 1;
75
- display: flex;
76
- align-self: stretch;
77
- overflow-x: auto;
78
- -webkit-overflow-scrolling: touch;
79
- }
80
-
81
- /* This seems more future-proof than \`overflow: -moz-scrollbars-none\` which is marked obsolete
82
- and is no longer guaranteed to work:
83
- https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#Mozilla_Extensions */
84
- @-moz-document url-prefix() {
85
- :host([orientation='horizontal']) [part='tabs'] {
86
- overflow: hidden;
87
- }
88
- }
89
-
90
- :host([orientation='horizontal']) [part='tabs']::-webkit-scrollbar {
91
- display: none;
92
- }
93
-
94
- :host([orientation='vertical']) [part='tabs'] {
95
- height: 100%;
96
- overflow-y: auto;
97
- -webkit-overflow-scrolling: touch;
98
- }
99
-
100
- [part='back-button'],
101
- [part='forward-button'] {
102
- pointer-events: none;
103
- opacity: 0;
104
- cursor: default;
105
- }
106
-
107
- :host([overflow~='start']) [part='back-button'],
108
- :host([overflow~='end']) [part='forward-button'] {
109
- pointer-events: auto;
110
- opacity: 1;
111
- }
112
-
113
- [part='back-button']::after {
114
- content: '◀';
115
- }
116
-
117
- [part='forward-button']::after {
118
- content: '▶';
119
- }
120
-
121
- :host([orientation='vertical']) [part='back-button'],
122
- :host([orientation='vertical']) [part='forward-button'] {
123
- display: none;
124
- }
125
-
126
- /* RTL specific styles */
127
-
128
- :host([dir='rtl']) [part='back-button']::after {
129
- content: '▶';
130
- }
131
-
132
- :host([dir='rtl']) [part='forward-button']::after {
133
- content: '◀';
134
- }
135
- </style>
136
- <div on-click="_scrollBack" part="back-button"></div>
137
-
138
- <div id="scroll" part="tabs">
139
- <slot></slot>
140
- </div>
141
-
142
- <div on-click="_scrollForward" part="forward-button"></div>
143
- `;
144
- }
145
-
146
- static get is() {
147
- return 'vaadin-tabs';
148
- }
149
-
150
- static get properties() {
151
- return {
152
- /**
153
- * Set tabs disposition. Possible values are `horizontal|vertical`
154
- * @type {!ListOrientation}
155
- */
156
- orientation: {
157
- value: 'horizontal',
158
- type: String
159
- },
160
-
161
- /**
162
- * The index of the selected tab.
163
- */
164
- selected: {
165
- value: 0,
166
- type: Number
167
- }
168
- };
169
- }
170
-
171
- static get observers() {
172
- return ['_updateOverflow(items.*)'];
173
- }
174
-
175
- ready() {
176
- super.ready();
177
- this.addEventListener('iron-resize', () => this._updateOverflow());
178
- this._scrollerElement.addEventListener('scroll', () => this._updateOverflow());
179
- this.setAttribute('role', 'tablist');
180
-
181
- // Wait for the vaadin-tab elements to upgrade and get styled
182
- afterNextRender(this, () => {
183
- this._updateOverflow();
184
- });
185
- }
186
-
187
- /** @private */
188
- _scrollForward() {
189
- this._scroll(-this.__direction * this._scrollOffset);
190
- }
191
-
192
- /** @private */
193
- _scrollBack() {
194
- this._scroll(this.__direction * this._scrollOffset);
195
- }
196
-
197
- /**
198
- * @return {number}
199
- * @protected
200
- */
201
- get _scrollOffset() {
202
- return this._vertical ? this._scrollerElement.offsetHeight : this._scrollerElement.offsetWidth;
203
- }
204
-
205
- /**
206
- * @return {!HTMLElement}
207
- * @protected
208
- */
209
- get _scrollerElement() {
210
- return this.$.scroll;
211
- }
212
-
213
- /** @private */
214
- get __direction() {
215
- return !this._vertical && this.getAttribute('dir') === 'rtl' ? 1 : -1;
216
- }
217
-
218
- /** @private */
219
- _updateOverflow() {
220
- const scrollPosition = this._vertical
221
- ? this._scrollerElement.scrollTop
222
- : this.__getNormalizedScrollLeft(this._scrollerElement);
223
- const scrollSize = this._vertical ? this._scrollerElement.scrollHeight : this._scrollerElement.scrollWidth;
224
-
225
- let overflow = scrollPosition > 0 ? 'start' : '';
226
- overflow += scrollPosition + this._scrollOffset < scrollSize ? ' end' : '';
227
-
228
- if (this.__direction == 1) {
229
- overflow = overflow.replace(/start|end/gi, (matched) => {
230
- return matched === 'start' ? 'end' : 'start';
231
- });
232
- }
233
-
234
- overflow ? this.setAttribute('overflow', overflow.trim()) : this.removeAttribute('overflow');
235
- }
236
- }
237
-
238
- customElements.define(TabsElement.is, TabsElement);
239
-
240
- export { TabsElement };
13
+ export * from '@vaadin/tabs/src/vaadin-tabs.js';
@@ -1,2 +1 @@
1
- import './vaadin-tab-styles.js';
2
- import '../../src/vaadin-tab.js';
1
+ import '@vaadin/tabs/theme/lumo/vaadin-tab.js';
@@ -1,3 +1 @@
1
- import './vaadin-tab.js';
2
- import './vaadin-tabs-styles.js';
3
- import '../../src/vaadin-tabs.js';
1
+ import '@vaadin/tabs/theme/lumo/vaadin-tabs.js';
@@ -1,2 +1 @@
1
- import './vaadin-tab-styles.js';
2
- import '../../src/vaadin-tab.js';
1
+ import '@vaadin/tabs/theme/material/vaadin-tab.js';
@@ -1,3 +1 @@
1
- import './vaadin-tab.js';
2
- import './vaadin-tabs-styles.js';
3
- import '../../src/vaadin-tabs.js';
1
+ import '@vaadin/tabs/theme/material/vaadin-tabs.js';
@@ -1,235 +0,0 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
- import '@vaadin/vaadin-lumo-styles/color.js';
3
- import '@vaadin/vaadin-lumo-styles/sizing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import '@vaadin/vaadin-lumo-styles/typography.js';
6
-
7
- registerStyles(
8
- 'vaadin-tab',
9
- css`
10
- :host {
11
- box-sizing: border-box;
12
- padding: 0.5rem 0.75rem;
13
- font-family: var(--lumo-font-family);
14
- font-size: var(--lumo-font-size-m);
15
- line-height: var(--lumo-line-height-xs);
16
- font-weight: 500;
17
- opacity: 1;
18
- color: var(--lumo-contrast-60pct);
19
- transition: 0.15s color, 0.2s transform;
20
- flex-shrink: 0;
21
- display: flex;
22
- align-items: center;
23
- position: relative;
24
- cursor: var(--lumo-clickable-cursor);
25
- transform-origin: 50% 100%;
26
- outline: none;
27
- -webkit-font-smoothing: antialiased;
28
- -moz-osx-font-smoothing: grayscale;
29
- overflow: hidden;
30
- min-width: var(--lumo-size-m);
31
- -webkit-user-select: none;
32
- -moz-user-select: none;
33
- user-select: none;
34
- }
35
-
36
- :host(:not([orientation='vertical'])) {
37
- text-align: center;
38
- }
39
-
40
- :host([orientation='vertical']) {
41
- transform-origin: 0% 50%;
42
- padding: 0.25rem 1rem;
43
- min-height: var(--lumo-size-m);
44
- min-width: 0;
45
- }
46
-
47
- :host(:hover),
48
- :host([focus-ring]) {
49
- color: var(--lumo-body-text-color);
50
- }
51
-
52
- :host([selected]) {
53
- color: var(--lumo-primary-text-color);
54
- transition: 0.6s color;
55
- }
56
-
57
- :host([active]:not([selected])) {
58
- color: var(--lumo-primary-text-color);
59
- transition-duration: 0.1s;
60
- }
61
-
62
- :host::before,
63
- :host::after {
64
- content: '';
65
- position: absolute;
66
- display: var(--_lumo-tab-marker-display, block);
67
- bottom: 0;
68
- left: 50%;
69
- width: var(--lumo-size-s);
70
- height: 2px;
71
- background-color: var(--lumo-contrast-60pct);
72
- border-radius: var(--lumo-border-radius-s) var(--lumo-border-radius-s) 0 0;
73
- transform: translateX(-50%) scale(0);
74
- transform-origin: 50% 100%;
75
- transition: 0.14s transform cubic-bezier(0.12, 0.32, 0.54, 1);
76
- will-change: transform;
77
- }
78
-
79
- :host([selected])::before,
80
- :host([selected])::after {
81
- background-color: var(--lumo-primary-color);
82
- }
83
-
84
- :host([orientation='vertical'])::before,
85
- :host([orientation='vertical'])::after {
86
- left: 0;
87
- bottom: 50%;
88
- transform: translateY(50%) scale(0);
89
- width: 2px;
90
- height: var(--lumo-size-xs);
91
- border-radius: 0 var(--lumo-border-radius-s) var(--lumo-border-radius-s) 0;
92
- transform-origin: 100% 50%;
93
- }
94
-
95
- :host::after {
96
- box-shadow: 0 0 0 4px var(--lumo-primary-color);
97
- opacity: 0.15;
98
- transition: 0.15s 0.02s transform, 0.8s 0.17s opacity;
99
- }
100
-
101
- :host([selected])::before,
102
- :host([selected])::after {
103
- transform: translateX(-50%) scale(1);
104
- transition-timing-function: cubic-bezier(0.12, 0.32, 0.54, 1.5);
105
- }
106
-
107
- :host([orientation='vertical'][selected])::before,
108
- :host([orientation='vertical'][selected])::after {
109
- transform: translateY(50%) scale(1);
110
- }
111
-
112
- :host([selected]:not([active]))::after {
113
- opacity: 0;
114
- }
115
-
116
- :host(:not([orientation='vertical'])) ::slotted(a[href]) {
117
- justify-content: center;
118
- }
119
-
120
- :host ::slotted(a) {
121
- display: flex;
122
- width: 100%;
123
- align-items: center;
124
- height: 100%;
125
- margin: -0.5rem -0.75rem;
126
- padding: 0.5rem 0.75rem;
127
- outline: none;
128
-
129
- /*
130
- Override the CSS inherited from \`lumo-color\` and \`lumo-typography\`.
131
- Note: \`!important\` is needed because of the \`:slotted\` specificity.
132
- */
133
- text-decoration: none !important;
134
- color: inherit !important;
135
- }
136
-
137
- :host ::slotted(vaadin-icon),
138
- :host ::slotted(iron-icon) {
139
- margin: 0 4px;
140
- width: var(--lumo-icon-size-m);
141
- height: var(--lumo-icon-size-m);
142
- }
143
-
144
- /* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
145
- :host ::slotted(vaadin-icon[icon^='vaadin:']),
146
- :host ::slotted(iron-icon[icon^='vaadin:']) {
147
- padding: 0.25rem;
148
- box-sizing: border-box !important;
149
- }
150
-
151
- :host(:not([dir='rtl'])) ::slotted(vaadin-icon:first-child),
152
- :host(:not([dir='rtl'])) ::slotted(iron-icon:first-child) {
153
- margin-left: 0;
154
- }
155
-
156
- :host(:not([dir='rtl'])) ::slotted(vaadin-icon:last-child),
157
- :host(:not([dir='rtl'])) ::slotted(iron-icon:last-child) {
158
- margin-right: 0;
159
- }
160
-
161
- :host([theme~='icon-on-top']) {
162
- display: flex;
163
- flex-direction: column;
164
- align-items: center;
165
- justify-content: space-around;
166
- text-align: center;
167
- padding-bottom: 0.5rem;
168
- padding-top: 0.25rem;
169
- }
170
-
171
- :host([theme~='icon-on-top']) ::slotted(a) {
172
- flex-direction: column;
173
- align-items: center;
174
- margin-top: -0.25rem;
175
- padding-top: 0.25rem;
176
- }
177
-
178
- :host([theme~='icon-on-top']) ::slotted(vaadin-icon),
179
- :host([theme~='icon-on-top']) ::slotted(iron-icon) {
180
- margin: 0;
181
- }
182
-
183
- /* Disabled */
184
-
185
- :host([disabled]) {
186
- pointer-events: none;
187
- opacity: 1;
188
- color: var(--lumo-disabled-text-color);
189
- }
190
-
191
- /* Focus-ring */
192
-
193
- :host([focus-ring]) {
194
- box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
195
- border-radius: var(--lumo-border-radius-m);
196
- }
197
-
198
- /* RTL specific styles */
199
-
200
- :host([dir='rtl'])::before,
201
- :host([dir='rtl'])::after {
202
- left: auto;
203
- right: 50%;
204
- transform: translateX(50%) scale(0);
205
- }
206
-
207
- :host([dir='rtl'][selected]:not([orientation='vertical']))::before,
208
- :host([dir='rtl'][selected]:not([orientation='vertical']))::after {
209
- transform: translateX(50%) scale(1);
210
- }
211
-
212
- :host([dir='rtl']) ::slotted(vaadin-icon:first-child),
213
- :host([dir='rtl']) ::slotted(iron-icon:first-child) {
214
- margin-right: 0;
215
- }
216
-
217
- :host([dir='rtl']) ::slotted(vaadin-icon:last-child),
218
- :host([dir='rtl']) ::slotted(iron-icon:last-child) {
219
- margin-left: 0;
220
- }
221
-
222
- :host([orientation='vertical'][dir='rtl']) {
223
- transform-origin: 100% 50%;
224
- }
225
-
226
- :host([dir='rtl'][orientation='vertical'])::before,
227
- :host([dir='rtl'][orientation='vertical'])::after {
228
- left: auto;
229
- right: 0;
230
- border-radius: var(--lumo-border-radius-s) 0 0 var(--lumo-border-radius-s);
231
- transform-origin: 0% 50%;
232
- }
233
- `,
234
- { moduleId: 'lumo-tab' }
235
- );
@@ -1,247 +0,0 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
3
- import '@vaadin/vaadin-lumo-styles/color.js';
4
- import '@vaadin/vaadin-lumo-styles/sizing.js';
5
- import '@vaadin/vaadin-lumo-styles/spacing.js';
6
- import '@vaadin/vaadin-lumo-styles/style.js';
7
- import '@vaadin/vaadin-lumo-styles/typography.js';
8
-
9
- registerStyles(
10
- 'vaadin-tabs',
11
- css`
12
- :host {
13
- -webkit-tap-highlight-color: transparent;
14
- }
15
-
16
- :host(:not([orientation='vertical'])) {
17
- box-shadow: inset 0 -1px 0 0 var(--lumo-contrast-10pct);
18
- position: relative;
19
- min-height: var(--lumo-size-l);
20
- }
21
-
22
- :host([orientation='horizontal']) [part='tabs'] ::slotted(vaadin-tab:not([theme~='icon-on-top'])) {
23
- justify-content: center;
24
- }
25
-
26
- :host([orientation='vertical']) {
27
- box-shadow: -1px 0 0 0 var(--lumo-contrast-10pct);
28
- }
29
-
30
- :host([orientation='horizontal']) [part='tabs'] {
31
- margin: 0 0.75rem;
32
- }
33
-
34
- :host([orientation='vertical']) [part='tabs'] {
35
- width: 100%;
36
- margin: 0.5rem 0;
37
- }
38
-
39
- [part='forward-button'],
40
- [part='back-button'] {
41
- position: absolute;
42
- z-index: 1;
43
- font-family: lumo-icons;
44
- color: var(--lumo-tertiary-text-color);
45
- font-size: var(--lumo-icon-size-m);
46
- display: flex;
47
- align-items: center;
48
- justify-content: center;
49
- width: 1.5em;
50
- height: 100%;
51
- transition: 0.2s opacity;
52
- top: 0;
53
- }
54
-
55
- [part='forward-button']:hover,
56
- [part='back-button']:hover {
57
- color: inherit;
58
- }
59
-
60
- :host(:not([dir='rtl'])) [part='forward-button'] {
61
- right: 0;
62
- }
63
-
64
- [part='forward-button']::after {
65
- content: var(--lumo-icons-angle-right);
66
- }
67
-
68
- [part='back-button']::after {
69
- content: var(--lumo-icons-angle-left);
70
- }
71
-
72
- /* Tabs overflow */
73
-
74
- [part='tabs'] {
75
- --_lumo-tabs-overflow-mask-image: none;
76
- -webkit-mask-image: var(--_lumo-tabs-overflow-mask-image);
77
- mask-image: var(--_lumo-tabs-overflow-mask-image);
78
- }
79
-
80
- /* Horizontal tabs overflow */
81
-
82
- /* Both ends overflowing */
83
- :host([overflow~='start'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
84
- --_lumo-tabs-overflow-mask-image: linear-gradient(
85
- 90deg,
86
- transparent 2em,
87
- #000 4em,
88
- #000 calc(100% - 4em),
89
- transparent calc(100% - 2em)
90
- );
91
- }
92
-
93
- /* End overflowing */
94
- :host([overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
95
- --_lumo-tabs-overflow-mask-image: linear-gradient(90deg, #000 calc(100% - 4em), transparent calc(100% - 2em));
96
- }
97
-
98
- /* Start overflowing */
99
- :host([overflow~='start']:not([orientation='vertical'])) [part='tabs'] {
100
- --_lumo-tabs-overflow-mask-image: linear-gradient(90deg, transparent 2em, #000 4em);
101
- }
102
-
103
- /* Vertical tabs overflow */
104
-
105
- /* Both ends overflowing */
106
- :host([overflow~='start'][overflow~='end'][orientation='vertical']) [part='tabs'] {
107
- --_lumo-tabs-overflow-mask-image: linear-gradient(transparent, #000 2em, #000 calc(100% - 2em), transparent);
108
- }
109
-
110
- /* End overflowing */
111
- :host([overflow~='end'][orientation='vertical']) [part='tabs'] {
112
- --_lumo-tabs-overflow-mask-image: linear-gradient(#000 calc(100% - 2em), transparent);
113
- }
114
-
115
- /* Start overflowing */
116
- :host([overflow~='start'][orientation='vertical']) [part='tabs'] {
117
- --_lumo-tabs-overflow-mask-image: linear-gradient(transparent, #000 2em);
118
- }
119
-
120
- :host [part='tabs'] ::slotted(:not(vaadin-tab)) {
121
- margin-left: var(--lumo-space-m);
122
- }
123
-
124
- /* Centered */
125
-
126
- :host([theme~='centered'][orientation='horizontal']) [part='tabs'] {
127
- justify-content: center;
128
- }
129
-
130
- /* Small */
131
-
132
- :host([theme~='small']),
133
- :host([theme~='small']) [part='tabs'] {
134
- min-height: var(--lumo-size-m);
135
- }
136
-
137
- :host([theme~='small']) [part='tabs'] ::slotted(vaadin-tab) {
138
- font-size: var(--lumo-font-size-s);
139
- }
140
-
141
- /* Minimal */
142
-
143
- :host([theme~='minimal']) {
144
- box-shadow: none;
145
- --_lumo-tab-marker-display: none;
146
- }
147
-
148
- /* Hide-scroll-buttons */
149
-
150
- :host([theme~='hide-scroll-buttons']) [part='back-button'],
151
- :host([theme~='hide-scroll-buttons']) [part='forward-button'] {
152
- display: none;
153
- }
154
-
155
- /* prettier-ignore */
156
- :host([theme~='hide-scroll-buttons'][overflow~='start'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
157
- --_lumo-tabs-overflow-mask-image: linear-gradient(
158
- 90deg,
159
- transparent,
160
- #000 2em,
161
- #000 calc(100% - 2em),
162
- transparent 100%
163
- );
164
- }
165
-
166
- :host([theme~='hide-scroll-buttons'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
167
- --_lumo-tabs-overflow-mask-image: linear-gradient(90deg, #000 calc(100% - 2em), transparent 100%);
168
- }
169
-
170
- :host([theme~='hide-scroll-buttons'][overflow~='start']:not([orientation='vertical'])) [part='tabs'] {
171
- --_lumo-tabs-overflow-mask-image: linear-gradient(90deg, transparent, #000 2em);
172
- }
173
-
174
- /* Equal-width tabs */
175
- :host([theme~='equal-width-tabs']) {
176
- flex: auto;
177
- }
178
-
179
- :host([theme~='equal-width-tabs']) [part='tabs'] ::slotted(vaadin-tab) {
180
- flex: 1 0 0%;
181
- }
182
-
183
- /* RTL specific styles */
184
-
185
- :host([dir='rtl']) [part='forward-button']::after {
186
- content: var(--lumo-icons-angle-left);
187
- }
188
-
189
- :host([dir='rtl']) [part='back-button']::after {
190
- content: var(--lumo-icons-angle-right);
191
- }
192
-
193
- :host([orientation='vertical'][dir='rtl']) {
194
- box-shadow: 1px 0 0 0 var(--lumo-contrast-10pct);
195
- }
196
-
197
- :host([dir='rtl']) [part='forward-button'] {
198
- left: 0;
199
- }
200
-
201
- :host([dir='rtl']) [part='tabs'] ::slotted(:not(vaadin-tab)) {
202
- margin-left: 0;
203
- margin-right: var(--lumo-space-m);
204
- }
205
-
206
- /* Both ends overflowing */
207
- :host([dir='rtl'][overflow~='start'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
208
- --_lumo-tabs-overflow-mask-image: linear-gradient(
209
- -90deg,
210
- transparent 2em,
211
- #000 4em,
212
- #000 calc(100% - 4em),
213
- transparent calc(100% - 2em)
214
- );
215
- }
216
-
217
- /* End overflowing */
218
- :host([dir='rtl'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
219
- --_lumo-tabs-overflow-mask-image: linear-gradient(-90deg, #000 calc(100% - 4em), transparent calc(100% - 2em));
220
- }
221
-
222
- /* Start overflowing */
223
- :host([dir='rtl'][overflow~='start']:not([orientation='vertical'])) [part='tabs'] {
224
- --_lumo-tabs-overflow-mask-image: linear-gradient(-90deg, transparent 2em, #000 4em);
225
- }
226
-
227
- :host([dir='rtl'][theme~='hide-scroll-buttons'][overflow~='start'][overflow~='end']:not([orientation='vertical']))
228
- [part='tabs'] {
229
- --_lumo-tabs-overflow-mask-image: linear-gradient(
230
- -90deg,
231
- transparent,
232
- #000 2em,
233
- #000 calc(100% - 2em),
234
- transparent 100%
235
- );
236
- }
237
-
238
- :host([dir='rtl'][theme~='hide-scroll-buttons'][overflow~='end']:not([orientation='vertical'])) [part='tabs'] {
239
- --_lumo-tabs-overflow-mask-image: linear-gradient(-90deg, #000 calc(100% - 2em), transparent 100%);
240
- }
241
-
242
- :host([dir='rtl'][theme~='hide-scroll-buttons'][overflow~='start']:not([orientation='vertical'])) [part='tabs'] {
243
- --_lumo-tabs-overflow-mask-image: linear-gradient(-90deg, transparent, #000 2em);
244
- }
245
- `,
246
- { moduleId: 'lumo-tabs' }
247
- );
@@ -1,143 +0,0 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
- import '@vaadin/vaadin-material-styles/color.js';
3
- import '@vaadin/vaadin-material-styles/typography.js';
4
-
5
- registerStyles(
6
- 'vaadin-tab',
7
- css`
8
- :host {
9
- display: flex;
10
- flex-direction: column;
11
- flex-shrink: 0;
12
- flex-grow: 1;
13
- align-items: center;
14
- justify-content: center;
15
- text-align: center;
16
- min-width: 90px;
17
- padding: 12px 16px;
18
- box-sizing: border-box;
19
- font-family: var(--material-font-family);
20
- font-size: var(--material-button-font-size);
21
- text-transform: uppercase;
22
- letter-spacing: 0.05em;
23
- white-space: nowrap;
24
- min-height: 48px;
25
- line-height: 1.2;
26
- font-weight: 500;
27
- color: var(--material-secondary-text-color);
28
- overflow: hidden;
29
- position: relative;
30
- cursor: pointer;
31
- outline: none;
32
- -webkit-font-smoothing: antialiased;
33
- -moz-osx-font-smoothing: grayscale;
34
- transition: box-shadow 0.3s;
35
- -webkit-user-select: none;
36
- user-select: none;
37
- }
38
-
39
- /* do not prevent click on slotted links */
40
- :host::before,
41
- :host::after {
42
- pointer-events: none;
43
- }
44
-
45
- :host::before {
46
- content: '';
47
- position: absolute;
48
- top: 0;
49
- right: 0;
50
- bottom: 0;
51
- left: 0;
52
- background-color: var(--material-primary-color);
53
- opacity: 0;
54
- transition: opacity 0.1s linear;
55
- }
56
-
57
- :host(:hover)::before {
58
- opacity: 0.04;
59
- }
60
-
61
- :host([focus-ring])::before {
62
- opacity: 0.1;
63
- }
64
-
65
- :host([selected]) {
66
- color: var(--material-primary-text-color);
67
- box-shadow: inset 0 -2px 0 0 var(--material-primary-color);
68
- }
69
-
70
- :host([orientation='vertical'][selected]) {
71
- box-shadow: inset 2px 0 0 0 var(--material-primary-color);
72
- }
73
-
74
- /* Ripple */
75
-
76
- :host::after {
77
- content: '';
78
- position: absolute;
79
- top: 50%;
80
- left: 50%;
81
- width: 100px;
82
- height: 100px;
83
- border-radius: 50%;
84
- transform: translate(-50%, -50%) scale(0);
85
- background-color: var(--material-primary-color);
86
- opacity: 0;
87
- transition: transform 0s cubic-bezier(0.05, 0.8, 0.5, 1), opacity 0s linear;
88
- }
89
-
90
- :host([focused]:not([focus-ring]))::after,
91
- :host([focused][active])::after,
92
- :host([focus-ring][selected])::after {
93
- transform: translate(-50%, -50%) scale(3);
94
- opacity: 0;
95
- transition-duration: 2s, 0.6s;
96
- }
97
-
98
- :host([active]:not([selected]))::after {
99
- opacity: 0.2;
100
- transition-duration: 2s, 0s;
101
- }
102
-
103
- /* Disabled */
104
- :host([disabled]) {
105
- pointer-events: none;
106
- opacity: 1;
107
- color: var(--material-disabled-text-color);
108
- }
109
-
110
- :host ::slotted(a) {
111
- display: flex;
112
- align-items: center;
113
- justify-content: center;
114
- width: 100%;
115
- height: 100%;
116
- margin: -12px -16px;
117
- padding: 12px 16px;
118
- text-decoration: none;
119
- color: inherit;
120
- outline: none;
121
- }
122
-
123
- /* Touch device adjustments */
124
- @media (pointer: coarse) {
125
- :host(:hover)::before {
126
- display: none;
127
- }
128
- }
129
-
130
- /* Small space between icon and label */
131
- ::slotted(vaadin-icon:not(:only-child)),
132
- ::slotted(iron-icon:not(:only-child)) {
133
- margin-bottom: 8px;
134
- }
135
-
136
- /* RTL specific styles */
137
-
138
- :host([dir='rtl'][orientation='vertical'][selected]) {
139
- box-shadow: inset -2px 0 0 0 var(--material-primary-color);
140
- }
141
- `,
142
- { moduleId: 'material-tab' }
143
- );
@@ -1,91 +0,0 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
- import '@vaadin/vaadin-material-styles/font-icons.js';
3
- import '@vaadin/vaadin-material-styles/color.js';
4
-
5
- registerStyles(
6
- 'vaadin-tabs',
7
- css`
8
- :host {
9
- -webkit-tap-highlight-color: transparent;
10
- }
11
-
12
- :host {
13
- display: flex;
14
- flex-shrink: 0;
15
- }
16
-
17
- /* Hide scroll buttons when no needed, and on touch devices */
18
-
19
- :host(:not([overflow])) [part='forward-button'],
20
- :host(:not([overflow])) [part='back-button'] {
21
- display: none;
22
- }
23
-
24
- @media (pointer: coarse) {
25
- [part='back-button'],
26
- [part='forward-button'] {
27
- display: none !important;
28
- }
29
- }
30
-
31
- [part='forward-button'],
32
- [part='back-button'] {
33
- font-family: material-icons;
34
- color: var(--material-secondary-text-color);
35
- font-size: 24px;
36
- display: flex;
37
- flex-shrink: 0;
38
- flex-grow: 0;
39
- align-items: center;
40
- justify-content: center;
41
- width: 48px;
42
- height: 100%;
43
- transition: 0.2s opacity;
44
- top: 0;
45
- }
46
-
47
- [part='forward-button']:hover,
48
- [part='back-button']:hover {
49
- color: inherit;
50
- }
51
-
52
- :host(:not([dir='rtl'])) [part='forward-button'] {
53
- right: 0;
54
- }
55
-
56
- [part='forward-button']::after {
57
- content: var(--material-icons-chevron-right);
58
- }
59
-
60
- [part='back-button']::after {
61
- content: var(--material-icons-chevron-left);
62
- }
63
-
64
- :host([overflow]) [part='tabs']::after {
65
- content: '';
66
- display: flex;
67
- flex-shrink: 0;
68
- width: 32px;
69
- }
70
-
71
- /* Fixed width tabs */
72
- :host([theme~='fixed']) [part='tabs'] ::slotted(vaadin-tab) {
73
- flex-basis: 0.0001px;
74
- }
75
-
76
- /* RTL specific styles */
77
-
78
- :host([dir='rtl']) [part='forward-button'] {
79
- left: 0;
80
- }
81
-
82
- :host([dir='rtl']) [part='forward-button']::after {
83
- content: var(--material-icons-chevron-left);
84
- }
85
-
86
- :host([dir='rtl']) [part='back-button']::after {
87
- content: var(--material-icons-chevron-right);
88
- }
89
- `,
90
- { moduleId: 'material-tabs' }
91
- );