@sankhyalabs/ezui 2.7.3 → 2.7.5

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.
@@ -19,6 +19,7 @@
19
19
  display: flex;
20
20
  cursor: grab;
21
21
  width: 100%;
22
+ overflow: hidden;
22
23
  }
23
24
 
24
25
  .dragging {
@@ -27,139 +28,165 @@
27
28
 
28
29
  .ez-scroller__container {
29
30
  display: flex;
30
- flex-direction: column;
31
31
  overflow-y: hidden;
32
32
  overflow-x: hidden;
33
33
  scrollbar-width: thin;
34
+ scrollbar-color: transparent transparent;
35
+ }
34
36
 
37
+ .ez-scroller__container--both:not(.ez-scroller__container--locked),
38
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover {
35
39
  /*public*/
36
40
  scrollbar-color: var(--ez-scroller__scrollbar--color-clicked) var(--ez-scroller__scrollbar--color-background);
37
41
  }
38
42
 
39
- .ez-scroller__container--horizontal {
40
- flex-direction: row;
41
- overflow-y: hidden;
42
- overflow-x: hidden;
43
- padding-bottom: var(--ez-scroller__scrollbar--width);
44
- margin-bottom: calc(var(--ez-scroller__scrollbar--width) * -1);
45
- }
46
-
47
- .ez-scroller__container--horizontal:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover {
48
- overflow-x: overlay;
49
- }
50
-
51
- .ez-scroller__container--horizontal.ez-scroller__container--no-overlay {
52
- padding-bottom: 8px;
53
- margin-bottom: -8px;
43
+ .ez-scroller__container--both {
44
+ overflow-y: scroll;
45
+ overflow-x: scroll;
54
46
  }
55
47
 
56
- .ez-scroller__container--horizontal.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover {
57
- overflow-x: auto;
58
- padding-bottom: 0px;
48
+ .ez-scroller__container--horizontal {
49
+ overflow-x: scroll;
50
+ flex-direction: row;
59
51
  }
60
52
 
61
53
  .ez-scroller__container--vertical {
62
- overflow-y: hidden;
63
- overflow-x: hidden;
64
- padding-right: var(--ez-scroller__scrollbar--width);
65
- margin-right: calc(var(--ez-scroller__scrollbar--width) * -1);
66
- }
67
-
68
- .ez-scroller__container--vertical:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover {
69
- overflow-y: overlay;
70
- }
71
-
72
- .ez-scroller__container--vertical.ez-scroller__container--no-overlay {
73
- padding-right: 8px;
74
- margin-right: -8px;
75
- }
76
-
77
- .ez-scroller__container--vertical.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover {
78
- overflow-y: auto;
79
- padding-right: 0px;
80
- }
81
-
82
- .ez-scroller__container--both {
83
- overflow: auto;
54
+ overflow-y: scroll;
55
+ flex-direction: column;
84
56
  }
85
57
 
86
58
  .ez-scroller__container::-webkit-scrollbar {
59
+ background-color: transparent;
60
+
87
61
  /*public*/
88
- background-color: var(--ez-scroller__scrollbar--color-background);
89
62
  width: var(--ez-scroller__scrollbar--width);
90
63
  height: var(--ez-scroller__scrollbar--width);
91
64
  max-width: var(--ez-scroller__scrollbar--width);
92
65
  min-width: var(--ez-scroller__scrollbar--width);
93
66
  }
94
67
 
68
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar,
69
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar {
70
+ /*public*/
71
+ background-color: var(--ez-scroller__scrollbar--color-background);
72
+ }
73
+
95
74
  .ez-scroller__container::-webkit-scrollbar-track {
96
75
  visibility: hidden;
76
+ background-color: transparent;
97
77
 
98
78
  /*public*/
99
- background-color: var(--ez-scroller__scrollbar--color-background);
100
79
  border-radius: var(--ez-scroller__scrollbar--border-radius);
101
80
  }
102
81
 
82
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-track,
83
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-track {
84
+ /*public*/
85
+ background-color: var(--ez-scroller__scrollbar--color-background);
86
+ }
87
+
103
88
  .ez-scroller__container::-webkit-scrollbar-thumb {
89
+ background-color: transparent;
90
+
104
91
  /*public*/
105
- background-color: var(--ez-scroller__scrollbar--color-default);
106
92
  border-radius: var(--ez-scroller__scrollbar--border-radius);
107
93
  }
108
94
 
95
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-thumb,
96
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-thumb {
97
+ /*public*/
98
+ background-color: var(--ez-scroller__scrollbar--color-default);
99
+ }
100
+
109
101
  .ez-scroller__container::-webkit-scrollbar-thumb:vertical:hover,
110
102
  .ez-scroller__container::-webkit-scrollbar-thumb:horizontal:hover {
103
+ background-color: transparent;
104
+ }
105
+
106
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-thumb:vertical:hover,
107
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-thumb:horizontal:hover,
108
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-thumb:vertical:hover,
109
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-thumb:horizontal:hover {
111
110
  /*public*/
112
111
  background-color: var(--ez-scroller__scrollbar--color-hover);
113
112
  }
114
113
 
115
114
  .ez-scroller__container::-webkit-scrollbar-thumb:vertical:active,
116
115
  .ez-scroller__container::-webkit-scrollbar-thumb:horizontal:active {
116
+ background-color: transparent;
117
+ }
118
+
119
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-thumb:vertical:active,
120
+ .ez-scroller__container--both:not(.ez-scroller__container--locked)::-webkit-scrollbar-thumb:horizontal:active,
121
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-thumb:vertical:active,
122
+ .ez-scroller__container:not(.ez-scroller__container--locked):hover::-webkit-scrollbar-thumb:horizontal:active {
117
123
  /*public*/
118
124
  background-color: var(--ez-scroller__scrollbar--color-clicked);
119
125
  }
120
126
 
121
- .ez-scroller__shadow-start,
122
- .ez-scroller__shadow-end {
127
+ .ez-scroller__wrapper {
123
128
  display: flex;
124
129
  position: relative;
125
- z-index: 0;
126
- background: var(--ez-scroller--box-shadow-color);
130
+ width: 100%;
131
+ height: 100%;
127
132
  }
128
133
 
129
- .ez-scroller__shadow-start--horizontal,
130
- .ez-scroller__shadow-end--horizontal {
131
- width: 10px;
132
- min-height: 100%;
133
- top: -13px;
134
+ .ez-scroller__wrapper--horizontal {
135
+ flex-direction: row;
136
+ width: 100%;
137
+ height: auto;
134
138
  }
135
139
 
136
- .ez-scroller__shadow-start--horizontal {
137
- box-shadow: var(--ez-scroller--box-shadow-color) -4px 0px 6px 10px;
138
- margin-right: -10px;
140
+ .ez-scroller__wrapper--vertical {
141
+ flex-direction: column;
142
+ width: auto;
143
+ height: 100%;
139
144
  }
140
145
 
141
- .ez-scroller__shadow-end--horizontal {
142
- box-shadow: var(--ez-scroller--box-shadow-color) 4px 0px 6px 10px;
143
- margin-left: -10px;
146
+ .ez-scroller__wrapper--shadow-start::before,
147
+ .ez-scroller__wrapper--shadow-end::after {
148
+ content: "";
149
+ display: flex;
150
+ position: absolute;
151
+ z-index: 1;
144
152
  }
145
153
 
146
- .ez-scroller__shadow-start--vertical,
147
- .ez-scroller__shadow-end--vertical {
148
- min-width: 100%;
149
- height: 10px;
150
- left: -13px;
154
+ .ez-scroller__wrapper--horizontal.ez-scroller__wrapper--shadow-start::before,
155
+ .ez-scroller__wrapper--horizontal.ez-scroller__wrapper--shadow-end::after {
156
+ width: 24px;
157
+ min-height: calc(100% - 10px);
151
158
  }
152
159
 
153
- .ez-scroller__shadow-start--vertical {
154
- box-shadow: var(--ez-scroller--box-shadow-color) 0px -4px 6px 10px;
155
- margin-bottom: -10px;
160
+ .ez-scroller__wrapper--horizontal.ez-scroller__wrapper--shadow-start::before {
161
+ left: 0;
162
+
163
+ /*public*/
164
+ background: linear-gradient(to right, var(--ez-scroller--box-shadow-color) 20%, transparent 80%);
156
165
  }
157
166
 
158
- .ez-scroller__shadow-end--vertical {
159
- box-shadow: var(--ez-scroller--box-shadow-color) 0px 4px 6px 10px;
160
- margin-top: -10px;
167
+ .ez-scroller__wrapper--horizontal.ez-scroller__wrapper--shadow-end::after {
168
+ right: 0;
169
+
170
+ /*public*/
171
+ background: linear-gradient(to left, var(--ez-scroller--box-shadow-color) 20%, transparent 80%);
161
172
  }
162
173
 
163
- .ez-scroller__shadow--hidden {
164
- display: none;
174
+ .ez-scroller__wrapper--vertical.ez-scroller__wrapper--shadow-start::before,
175
+ .ez-scroller__wrapper--vertical.ez-scroller__wrapper--shadow-end::after {
176
+ min-width: calc(100% - 10px);
177
+ height: 24px;
178
+ }
179
+
180
+ .ez-scroller__wrapper--vertical.ez-scroller__wrapper--shadow-start::before {
181
+ top: 0;
182
+
183
+ /*public*/
184
+ background: linear-gradient(to bottom, var(--ez-scroller--box-shadow-color) 20%, transparent 80%);
185
+ }
186
+
187
+ .ez-scroller__wrapper--vertical.ez-scroller__wrapper--shadow-end::after {
188
+ bottom: 0;
189
+
190
+ /*public*/
191
+ background: linear-gradient(to top, var(--ez-scroller--box-shadow-color) 20%, transparent 80%);
165
192
  }
@@ -1,10 +1,10 @@
1
- import { JSUtils, UserAgentUtils } from '@sankhyalabs/core';
1
+ import { JSUtils } from '@sankhyalabs/core';
2
2
  import { Component, h, Host, Listen, Prop, State } from '@stencil/core';
3
3
  import { EzScrollDirection } from './EzScrollDirection';
4
4
  export class EzScroller {
5
5
  constructor() {
6
- this._classHidden = "ez-scroller__shadow--hidden";
7
- this.isFirefox = false;
6
+ this._shadowStart = "ez-scroller__wrapper--shadow-start";
7
+ this._shadowEnd = "ez-scroller__wrapper--shadow-end";
8
8
  this.isActive = false;
9
9
  /**
10
10
  * Define se o `scroll` estará bloqueado.
@@ -20,15 +20,11 @@ export class EzScroller {
20
20
  //---------------------------------------------
21
21
  getContainerClass() {
22
22
  return `ez-scroller__container ez-scroller__container--${this.direction}
23
- ${this.locked ? " ez-scroller__container--locked" : ""}
24
- ${this.isFirefox && this.isActive ? " ez-scroller__container--no-overlay" : ""}
23
+ ${this.locked || !this.isActive ? " ez-scroller__container--locked" : ""}
25
24
  `;
26
25
  }
27
- getShadowStartClass() {
28
- return `ez-scroller__shadow-start ez-scroller__shadow-start--${this.direction}`;
29
- }
30
- getShadowEndClass() {
31
- return `ez-scroller__shadow-end ez-scroller__shadow-end--${this.direction}`;
26
+ getWrapperClass() {
27
+ return `ez-scroller__wrapper ez-scroller__wrapper--${this.direction}`;
32
28
  }
33
29
  finishDrag() {
34
30
  if (this._controller) {
@@ -37,38 +33,40 @@ export class EzScroller {
37
33
  }
38
34
  updateShadow() {
39
35
  const container = this._container;
40
- if (container) {
41
- let remainingScroll;
42
- if (this.direction === EzScrollDirection.HORIZONTAL) {
43
- const { scrollWidth, clientWidth, scrollLeft } = container;
44
- remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
45
- this._startHidden = container.scrollLeft > 0;
46
- }
47
- else if (this.direction === EzScrollDirection.VERTICAL) {
48
- const { scrollHeight, clientHeight, scrollTop } = container;
49
- remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
50
- this._startHidden = container.scrollTop > 0;
51
- }
52
- this._endHidden = remainingScroll > 0;
53
- this.isActive = this._startHidden || this._endHidden;
54
- const shadowPositions = ["", "start", "end", "middle"];
55
- const currentPosition = shadowPositions[Number(this._startHidden) | Number(this._endHidden) << 1];
56
- if (currentPosition === "start") {
57
- this._shadowStart.classList.remove(this._classHidden);
58
- this._shadowEnd.classList.add(this._classHidden);
59
- }
60
- else if (currentPosition === "end") {
61
- this._shadowStart.classList.add(this._classHidden);
62
- this._shadowEnd.classList.remove(this._classHidden);
63
- }
64
- else if (currentPosition === "middle") {
65
- this._shadowStart.classList.remove(this._classHidden);
66
- this._shadowEnd.classList.remove(this._classHidden);
67
- }
68
- else {
69
- this._shadowStart.classList.add(this._classHidden);
70
- this._shadowEnd.classList.add(this._classHidden);
71
- }
36
+ const wrapper = this._wrapper;
37
+ if (container == undefined || wrapper == undefined) {
38
+ return;
39
+ }
40
+ let remainingScroll;
41
+ if (this.direction === EzScrollDirection.HORIZONTAL) {
42
+ const { scrollWidth, clientWidth, scrollLeft } = container;
43
+ remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
44
+ this._startHidden = container.scrollLeft > 0;
45
+ }
46
+ else if (this.direction === EzScrollDirection.VERTICAL) {
47
+ const { scrollHeight, clientHeight, scrollTop } = container;
48
+ remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
49
+ this._startHidden = container.scrollTop > 0;
50
+ }
51
+ this._endHidden = remainingScroll > 0;
52
+ this.isActive = this._startHidden || this._endHidden;
53
+ const shadowPositions = ["", "start", "end", "middle"];
54
+ const currentPosition = shadowPositions[Number(this._startHidden) | Number(this._endHidden) << 1];
55
+ if (currentPosition === "start") {
56
+ wrapper.classList.add(this._shadowStart);
57
+ wrapper.classList.remove(this._shadowEnd);
58
+ }
59
+ else if (currentPosition === "end") {
60
+ wrapper.classList.remove(this._shadowStart);
61
+ wrapper.classList.add(this._shadowEnd);
62
+ }
63
+ else if (currentPosition === "middle") {
64
+ wrapper.classList.add(this._shadowStart);
65
+ wrapper.classList.add(this._shadowEnd);
66
+ }
67
+ else {
68
+ wrapper.classList.remove(this._shadowStart);
69
+ wrapper.classList.remove(this._shadowEnd);
72
70
  }
73
71
  }
74
72
  configResize() {
@@ -82,6 +80,10 @@ export class EzScroller {
82
80
  this._resizeObserver = new ResizeObserver(JSUtils.debounce(this.updateShadow.bind(this), 200));
83
81
  this._resizeObserver.observe(container);
84
82
  }
83
+ getContainerElement() {
84
+ return h("div", { ref: ref => this._container = ref, class: this.getContainerClass() },
85
+ h("slot", null));
86
+ }
85
87
  //---------------------------------------------
86
88
  // Event handlers
87
89
  //---------------------------------------------
@@ -120,14 +122,11 @@ export class EzScroller {
120
122
  }
121
123
  }
122
124
  }
123
- componentDidLoad() {
124
- this.isFirefox = UserAgentUtils.isFirefox();
125
- }
126
125
  componentDidRender() {
127
126
  var _a, _b;
128
127
  if (this.direction === EzScrollDirection.BOTH) {
129
- (_a = this._shadowStart) === null || _a === void 0 ? void 0 : _a.classList.add(this._classHidden);
130
- (_b = this._shadowEnd) === null || _b === void 0 ? void 0 : _b.classList.add(this._classHidden);
128
+ (_a = this._wrapper) === null || _a === void 0 ? void 0 : _a.classList.remove(this._shadowStart);
129
+ (_b = this._wrapper) === null || _b === void 0 ? void 0 : _b.classList.remove(this._shadowEnd);
131
130
  return;
132
131
  }
133
132
  if (this._container && this.activeShadow) {
@@ -137,13 +136,9 @@ export class EzScroller {
137
136
  }
138
137
  }
139
138
  render() {
140
- return (h(Host, null,
141
- this.activeShadow &&
142
- h("span", { ref: ref => this._shadowStart = ref, class: this.getShadowStartClass() }),
143
- h("div", { ref: ref => this._container = ref, class: this.getContainerClass() },
144
- h("slot", null)),
145
- this.activeShadow &&
146
- h("span", { ref: ref => this._shadowEnd = ref, class: this.getShadowEndClass() })));
139
+ return (h(Host, null, this.activeShadow
140
+ ? h("div", { ref: ref => this._wrapper = ref, class: this.getWrapperClass() }, this.getContainerElement())
141
+ : this.getContainerElement()));
147
142
  }
148
143
  static get is() { return "ez-scroller"; }
149
144
  static get encapsulation() { return "shadow"; }
@@ -214,7 +209,6 @@ export class EzScroller {
214
209
  }
215
210
  }; }
216
211
  static get states() { return {
217
- "isFirefox": {},
218
212
  "isActive": {}
219
213
  }; }
220
214
  static get listeners() { return [{