@allxsmith/bestax-bulma 5.47.0 → 5.48.1
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/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/ScrollArea.js +225 -0
- package/dist/esm/components/ScrollArea.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +215 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/ScrollArea.d.ts +105 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-cjs/components/ScrollArea.d.ts +105 -0
- package/dist/types-cjs/index.d.ts +1 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +3 -2
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_scrollarea.scss +248 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Bestax Extras - ScrollArea Styles
|
|
2
|
+
// A box whose content scrolls inside it, on the browser's own scrollbars,
|
|
3
|
+
// made thin and colored from Bulma's tokens. Bulma has overflow helpers and
|
|
4
|
+
// no scrollbar styles anywhere.
|
|
5
|
+
//
|
|
6
|
+
// Two elements: the frame, which is the box on the page and takes the border,
|
|
7
|
+
// the radius and the focus ring, and the viewport inside it, which scrolls.
|
|
8
|
+
// The fade is a mask on the viewport, and a mask clips and fades everything
|
|
9
|
+
// its element paints, so nothing that must stay solid can live there.
|
|
10
|
+
|
|
11
|
+
@use "bulma/sass/utilities/initial-variables" as iv;
|
|
12
|
+
@use "bulma/sass/utilities/css-variables" as cv;
|
|
13
|
+
@use "../mixins" as *;
|
|
14
|
+
|
|
15
|
+
// Whatever `scrollbar-width` takes: `thin`, `auto`, or `none`, which hides the
|
|
16
|
+
// bars and with them any sign that the area scrolls.
|
|
17
|
+
$scroll-area-scrollbar-width: thin !default;
|
|
18
|
+
// Restyled bars owe WCAG 1.4.11 its 3:1, and `text-weak` clears it on
|
|
19
|
+
// `scheme-main` in both of Bulma's schemes. `border` doesn't come close.
|
|
20
|
+
$scroll-area-thumb-color: cv.getVar("text-weak") !default;
|
|
21
|
+
$scroll-area-thumb-hover-color: cv.getVar("text") !default;
|
|
22
|
+
$scroll-area-track-color: transparent !default;
|
|
23
|
+
// How far in from an edge the fade reaches full strength.
|
|
24
|
+
$scroll-area-fade-size: 2rem !default;
|
|
25
|
+
|
|
26
|
+
.#{iv.$class-prefix}scroll-area {
|
|
27
|
+
@include cv.register-vars(
|
|
28
|
+
(
|
|
29
|
+
"scroll-area-scrollbar-width": #{$scroll-area-scrollbar-width},
|
|
30
|
+
"scroll-area-thumb-color": #{$scroll-area-thumb-color},
|
|
31
|
+
"scroll-area-thumb-hover-color": #{$scroll-area-thumb-hover-color},
|
|
32
|
+
"scroll-area-track-color": #{$scroll-area-track-color},
|
|
33
|
+
"scroll-area-fade-size": #{$scroll-area-fade-size},
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---- The frame ---------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
// One cell that asks for no room of its own, so the viewport fills a frame
|
|
41
|
+
// with a fixed height and stops at one with a maximum. Its smallest size is
|
|
42
|
+
// nothing and its natural size is its content's, so in a flex item or a grid
|
|
43
|
+
// cell, a Bulma column included, it narrows and scrolls rather than
|
|
44
|
+
// stretching its parent, and in a box that fits its content it keeps the
|
|
45
|
+
// content's width. The minimums let it shrink as a flex item of its own.
|
|
46
|
+
.#{iv.$class-prefix}scroll-area {
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: minmax(0, 1fr);
|
|
49
|
+
grid-template-rows: minmax(0, 1fr);
|
|
50
|
+
min-width: 0;
|
|
51
|
+
min-height: 0;
|
|
52
|
+
|
|
53
|
+
&:not(:last-child) {
|
|
54
|
+
margin-bottom: cv.getVar("block-spacing");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ---- The viewport -------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
.#{iv.$class-prefix}scroll-area-viewport {
|
|
61
|
+
overflow: auto;
|
|
62
|
+
border-radius: inherit;
|
|
63
|
+
scrollbar-width: cv.getVar("scroll-area-scrollbar-width");
|
|
64
|
+
scrollbar-color: cv.getVar("scroll-area-thumb-color")
|
|
65
|
+
cv.getVar("scroll-area-track-color");
|
|
66
|
+
|
|
67
|
+
// Without `:has`, the ring is the viewport's own, drawn inside it.
|
|
68
|
+
&:focus {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:focus-visible {
|
|
73
|
+
@include extras-focus-outline;
|
|
74
|
+
outline-offset: -2px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.#{iv.$class-prefix}scroll-area:hover > .#{iv.$class-prefix}scroll-area-viewport {
|
|
79
|
+
scrollbar-color: cv.getVar("scroll-area-thumb-hover-color")
|
|
80
|
+
cv.getVar("scroll-area-track-color");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// The frame draws the ring, so a fade's mask never clips it.
|
|
84
|
+
@supports selector(:has(*)) {
|
|
85
|
+
.#{iv.$class-prefix}scroll-area:has(> .#{iv.$class-prefix}scroll-area-viewport:focus-visible) {
|
|
86
|
+
@include extras-focus-outline;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.#{iv.$class-prefix}scroll-area-viewport:focus-visible {
|
|
90
|
+
outline: none;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ---- Which way it scrolls, and when the bars show ------------------------------
|
|
95
|
+
|
|
96
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}is-vertical > .#{iv.$class-prefix}scroll-area-viewport {
|
|
97
|
+
overflow-x: hidden;
|
|
98
|
+
overflow-y: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}is-horizontal > .#{iv.$class-prefix}scroll-area-viewport {
|
|
102
|
+
overflow-x: auto;
|
|
103
|
+
overflow-y: hidden;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-visible-scrollbars {
|
|
107
|
+
> .#{iv.$class-prefix}scroll-area-viewport {
|
|
108
|
+
overflow: scroll;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.#{iv.$class-prefix}is-vertical > .#{iv.$class-prefix}scroll-area-viewport {
|
|
112
|
+
overflow-x: hidden;
|
|
113
|
+
overflow-y: scroll;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.#{iv.$class-prefix}is-horizontal > .#{iv.$class-prefix}scroll-area-viewport {
|
|
117
|
+
overflow-x: scroll;
|
|
118
|
+
overflow-y: hidden;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Colorless until the pointer is over the area or focus is in it. Forced
|
|
123
|
+
// colors computes `scrollbar-color` to `auto`, so there they always show.
|
|
124
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-hover-scrollbars {
|
|
125
|
+
> .#{iv.$class-prefix}scroll-area-viewport {
|
|
126
|
+
scrollbar-color: transparent transparent;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:hover > .#{iv.$class-prefix}scroll-area-viewport,
|
|
130
|
+
> .#{iv.$class-prefix}scroll-area-viewport:focus-within {
|
|
131
|
+
scrollbar-color: cv.getVar("scroll-area-thumb-hover-color")
|
|
132
|
+
cv.getVar("scroll-area-track-color");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-stable-gutter > .#{iv.$class-prefix}scroll-area-viewport {
|
|
137
|
+
scrollbar-gutter: stable;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---- The fade ------------------------------------------------------------------
|
|
141
|
+
|
|
142
|
+
// A mask reads only alpha: opaque shows what's under it and transparent hides
|
|
143
|
+
// it. This is that opacity rather than a color anyone sees, so it's no theme
|
|
144
|
+
// variable.
|
|
145
|
+
$-shown: #000;
|
|
146
|
+
|
|
147
|
+
// A gradient on each axis, opaque except toward an edge with more past it,
|
|
148
|
+
// intersected, then the strip each scrollbar takes made opaque again, so the
|
|
149
|
+
// bar never fades. `$inline` is the way the line runs, so start comes first.
|
|
150
|
+
@function -fade-mask($inline) {
|
|
151
|
+
$fade: cv.getVar("scroll-area-fade-size");
|
|
152
|
+
@return (
|
|
153
|
+
linear-gradient($-shown, $-shown),
|
|
154
|
+
linear-gradient($-shown, $-shown),
|
|
155
|
+
linear-gradient(
|
|
156
|
+
to bottom,
|
|
157
|
+
var(--scroll-area-fade-top),
|
|
158
|
+
$-shown $fade,
|
|
159
|
+
$-shown calc(100% - #{$fade}),
|
|
160
|
+
var(--scroll-area-fade-bottom)
|
|
161
|
+
),
|
|
162
|
+
linear-gradient(
|
|
163
|
+
$inline,
|
|
164
|
+
var(--scroll-area-fade-start),
|
|
165
|
+
$-shown $fade,
|
|
166
|
+
$-shown calc(100% - #{$fade}),
|
|
167
|
+
var(--scroll-area-fade-end)
|
|
168
|
+
)
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// The component measures the strips into `--scroll-area-bar-inline-size` and
|
|
173
|
+
// `--scroll-area-bar-block-size`, and marks the edges with `data-overflow-*`.
|
|
174
|
+
// A mask on the padding box alone fades a right-to-left page's bar, which
|
|
175
|
+
// sits on the left, so the strips are placed by direction.
|
|
176
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-fade > .#{iv.$class-prefix}scroll-area-viewport {
|
|
177
|
+
--scroll-area-fade-top: #{$-shown};
|
|
178
|
+
--scroll-area-fade-bottom: #{$-shown};
|
|
179
|
+
--scroll-area-fade-start: #{$-shown};
|
|
180
|
+
--scroll-area-fade-end: #{$-shown};
|
|
181
|
+
--scroll-area-bar-inline: var(--scroll-area-bar-inline-size, 0px);
|
|
182
|
+
--scroll-area-bar-block: var(--scroll-area-bar-block-size, 0px);
|
|
183
|
+
|
|
184
|
+
mask-image: -fade-mask(to right);
|
|
185
|
+
mask-size:
|
|
186
|
+
var(--scroll-area-bar-inline) 100%,
|
|
187
|
+
100% var(--scroll-area-bar-block),
|
|
188
|
+
100% calc(100% - var(--scroll-area-bar-block)),
|
|
189
|
+
calc(100% - var(--scroll-area-bar-inline)) 100%;
|
|
190
|
+
mask-position:
|
|
191
|
+
right top,
|
|
192
|
+
left bottom,
|
|
193
|
+
left top,
|
|
194
|
+
left top;
|
|
195
|
+
mask-repeat: no-repeat;
|
|
196
|
+
mask-composite: add, add, intersect, add;
|
|
197
|
+
|
|
198
|
+
&[data-overflow-top] {
|
|
199
|
+
--scroll-area-fade-top: transparent;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&[data-overflow-bottom] {
|
|
203
|
+
--scroll-area-fade-bottom: transparent;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&[data-overflow-start] {
|
|
207
|
+
--scroll-area-fade-start: transparent;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&[data-overflow-end] {
|
|
211
|
+
--scroll-area-fade-end: transparent;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Start is the right, and the vertical bar sits on the left.
|
|
215
|
+
&:dir(rtl) {
|
|
216
|
+
mask-image: -fade-mask(to left);
|
|
217
|
+
mask-position:
|
|
218
|
+
left top,
|
|
219
|
+
left bottom,
|
|
220
|
+
left top,
|
|
221
|
+
right top;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ---- Media ---------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
// The bars take the system's colors on their own. The fade dims text at an
|
|
228
|
+
// edge, which those who asked for contrast don't want.
|
|
229
|
+
@media (forced-colors: active) {
|
|
230
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-fade > .#{iv.$class-prefix}scroll-area-viewport {
|
|
231
|
+
mask-image: none;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Two rules, since a browser without `:has` would drop a list holding it.
|
|
235
|
+
.#{iv.$class-prefix}scroll-area-viewport:focus-visible {
|
|
236
|
+
outline-color: CanvasText;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.#{iv.$class-prefix}scroll-area:has(> .#{iv.$class-prefix}scroll-area-viewport:focus-visible) {
|
|
240
|
+
outline-color: CanvasText;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media (prefers-contrast: more) {
|
|
245
|
+
.#{iv.$class-prefix}scroll-area.#{iv.$class-prefix}has-fade > .#{iv.$class-prefix}scroll-area-viewport {
|
|
246
|
+
mask-image: none;
|
|
247
|
+
}
|
|
248
|
+
}
|