@vaadin/scroller 23.0.0-alpha1 → 23.0.0-alpha2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/scroller",
3
- "version": "23.0.0-alpha1",
3
+ "version": "23.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,14 +33,14 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "23.0.0-alpha1",
37
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha1",
38
- "@vaadin/vaadin-material-styles": "23.0.0-alpha1",
39
- "@vaadin/vaadin-themable-mixin": "23.0.0-alpha1"
36
+ "@vaadin/component-base": "23.0.0-alpha2",
37
+ "@vaadin/vaadin-lumo-styles": "23.0.0-alpha2",
38
+ "@vaadin/vaadin-material-styles": "23.0.0-alpha2",
39
+ "@vaadin/vaadin-themable-mixin": "23.0.0-alpha2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@esm-bundle/chai": "^4.3.4",
43
43
  "@vaadin/testing-helpers": "^0.3.2"
44
44
  },
45
- "gitHead": "fbcb07328fdf88260e3b461088d207426b21c710"
45
+ "gitHead": "070f586dead02ca41b66717820c647f48bf1665f"
46
46
  }
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
+ import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
7
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
 
9
10
  /**
@@ -14,13 +15,24 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
14
15
  * <div>Content</div>
15
16
  * </vaadin-scroller>
16
17
  * ```
18
+ * The following attributes are exposed for styling:
19
+ *
20
+ * Attribute | Description
21
+ * -------------| -----------
22
+ * `focus-ring` | Set when the element is focused using the keyboard.
23
+ * `focused` | Set when the element is focused.
17
24
  */
18
- declare class Scroller extends ThemableMixin(ElementMixin(HTMLElement)) {
25
+ declare class Scroller extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement))) {
19
26
  /**
20
27
  * This property indicates the scroll direction. Supported values are `vertical`, `horizontal`, `none`.
21
28
  * When `scrollDirection` is undefined scrollbars will be shown in both directions.
22
29
  */
23
30
  scrollDirection: 'horizontal' | 'vertical' | 'none' | undefined;
31
+
32
+ /**
33
+ * Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
34
+ */
35
+ tabindex: number;
24
36
  }
25
37
 
26
38
  declare global {
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
+ import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
8
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
 
10
11
  /**
@@ -15,12 +16,19 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
15
16
  * <div>Content</div>
16
17
  * </vaadin-scroller>
17
18
  * ```
19
+ * The following attributes are exposed for styling:
20
+ *
21
+ * Attribute | Description
22
+ * -------------| -----------
23
+ * `focus-ring` | Set when the element is focused using the keyboard.
24
+ * `focused` | Set when the element is focused.
18
25
  *
19
26
  * @extends HTMLElement
20
27
  * @mixes ThemableMixin
21
28
  * @mixes ElementMixin
29
+ * @mixes FocusMixin
22
30
  */
23
- class Scroller extends ElementMixin(ThemableMixin(PolymerElement)) {
31
+ class Scroller extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
24
32
  static get template() {
25
33
  return html`
26
34
  <style>
@@ -63,9 +71,30 @@ class Scroller extends ElementMixin(ThemableMixin(PolymerElement)) {
63
71
  scrollDirection: {
64
72
  type: String,
65
73
  reflectToAttribute: true
74
+ },
75
+
76
+ /**
77
+ * Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
78
+ * @protected
79
+ */
80
+ tabindex: {
81
+ type: Number,
82
+ value: 0,
83
+ reflectToAttribute: true
66
84
  }
67
85
  };
68
86
  }
87
+
88
+ /**
89
+ * Override method inherited from `FocusMixin` to mark the scroller as focused
90
+ * only when the host is focused.
91
+ * @param {Event} event
92
+ * @return {boolean}
93
+ * @protected
94
+ */
95
+ _shouldSetFocus(event) {
96
+ return event.target === this;
97
+ }
69
98
  }
70
99
 
71
100
  customElements.define(Scroller.is, Scroller);
@@ -0,0 +1,16 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
+
4
+ const scroller = css`
5
+ :host {
6
+ outline: none;
7
+ }
8
+
9
+ :host([focus-ring]) {
10
+ box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
11
+ }
12
+ `;
13
+
14
+ registerStyles('vaadin-scroller', scroller, { moduleId: 'lumo-scroller' });
15
+
16
+ export { scroller };
@@ -1 +1,2 @@
1
+ import './vaadin-scroller-styles.js';
1
2
  import '../../src/vaadin-scroller.js';
@@ -0,0 +1,16 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
+
4
+ const scroller = css`
5
+ :host {
6
+ outline: none;
7
+ }
8
+
9
+ :host([focus-ring]) {
10
+ box-shadow: 0 0 0 2px var(--material-primary-color);
11
+ }
12
+ `;
13
+
14
+ registerStyles('vaadin-scroller', scroller, { moduleId: 'material-scroller' });
15
+
16
+ export { scroller };
@@ -1 +1,2 @@
1
+ import './vaadin-scroller-styles.js';
1
2
  import '../../src/vaadin-scroller.js';