@allxsmith/bestax-bulma 5.41.0 → 5.42.0

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.
@@ -1,6 +1,12 @@
1
1
  // Carousel component styles
2
2
  @use "bulma/sass/utilities/initial-variables" as iv;
3
3
  @use "bulma/sass/utilities/css-variables" as cv;
4
+ @use "bulma/sass/utilities/mixins" as mx;
5
+
6
+ // The space between two items in view, left out at the track's edges. A
7
+ // length, so `0px` rather than `0`: the track's offset adds it to a
8
+ // percentage inside `calc()`, where a bare `0` is not a length.
9
+ $carousel-item-gap: 0px !default;
4
10
 
5
11
  // Carousel-specific SCSS sizing variables
6
12
  $carousel-arrow-size: 48px !default;
@@ -126,10 +132,70 @@ $carousel-indicator-line-radius: cv.getVar("radius-small") !default;
126
132
  "carousel-overlay-indicator-background-active": #{$carousel-overlay-indicator-background-active},
127
133
  "carousel-transition-duration": #{$carousel-transition-duration},
128
134
  "carousel-fade-duration": #{$carousel-fade-duration},
135
+ "carousel-item-gap": #{$carousel-item-gap},
136
+ // How many items are in view. `Carousel` writes each `itemsToShow*`
137
+ // prop it is given as the variable of the same name on its own
138
+ // element; the rest fall back the way the props do, each viewport to
139
+ // the next narrower one and all of them to `itemsToShow`. Declared
140
+ // here, on every carousel, so one nested in another's items starts
141
+ // from its own props rather than inheriting the outer one's.
142
+ "carousel-items-to-show": 1,
143
+ "carousel-items-to-show-mobile": #{cv.getVar("carousel-items-to-show")},
144
+ "carousel-items-to-show-tablet": #{cv.getVar("carousel-items-to-show")},
145
+ "carousel-items-to-show-desktop": #{cv.getVar("carousel-items-to-show-tablet")},
146
+ "carousel-items-to-show-widescreen": #{cv.getVar("carousel-items-to-show-desktop")},
147
+ "carousel-items-to-show-fullhd": #{cv.getVar("carousel-items-to-show-widescreen")},
148
+ // The count for the viewport the page is in, which the item widths and
149
+ // the track's offset both read. Bulma's breakpoint mixins below pick
150
+ // the tablet count and wider; every width they don't reach is mobile,
151
+ // as it is to the script. A `mobile` block of its own would leave out
152
+ // the fractional widths between Bulma's `mobile` query (up to 768px)
153
+ // and its `tablet` one (from 769px), where the two would disagree.
154
+ "carousel-items-in-view": #{cv.getVar("carousel-items-to-show-mobile")},
129
155
  )
130
156
  );
131
157
  }
132
158
 
159
+ @include mx.tablet {
160
+ .#{iv.$class-prefix}carousel {
161
+ @include cv.register-vars(
162
+ (
163
+ "carousel-items-in-view": #{cv.getVar("carousel-items-to-show-tablet")},
164
+ )
165
+ );
166
+ }
167
+ }
168
+
169
+ @include mx.desktop {
170
+ .#{iv.$class-prefix}carousel {
171
+ @include cv.register-vars(
172
+ (
173
+ "carousel-items-in-view": #{cv.getVar("carousel-items-to-show-desktop")},
174
+ )
175
+ );
176
+ }
177
+ }
178
+
179
+ @include mx.widescreen {
180
+ .#{iv.$class-prefix}carousel {
181
+ @include cv.register-vars(
182
+ (
183
+ "carousel-items-in-view": #{cv.getVar("carousel-items-to-show-widescreen")},
184
+ )
185
+ );
186
+ }
187
+ }
188
+
189
+ @include mx.fullhd {
190
+ .#{iv.$class-prefix}carousel {
191
+ @include cv.register-vars(
192
+ (
193
+ "carousel-items-in-view": #{cv.getVar("carousel-items-to-show-fullhd")},
194
+ )
195
+ );
196
+ }
197
+ }
198
+
133
199
  .#{iv.$class-prefix}carousel {
134
200
  position: relative;
135
201
  overflow: hidden;
@@ -147,15 +213,22 @@ $carousel-indicator-line-radius: cv.getVar("radius-small") !default;
147
213
  // Slides container
148
214
  .#{iv.$class-prefix}carousel-slides {
149
215
  display: flex;
216
+ gap: cv.getVar("carousel-item-gap");
150
217
  width: 100%;
151
218
  will-change: transform;
152
219
  }
153
220
 
154
- // Individual slide
221
+ // Individual slide: an equal share of the track, less the gaps between
222
+ // the items in view
155
223
  .#{iv.$class-prefix}carousel-item {
156
- flex: 0 0 100%;
157
- width: 100%;
158
- min-width: 100%;
224
+ $carousel-item-width: calc(
225
+ (100% - (#{cv.getVar("carousel-items-in-view")} - 1) * #{cv.getVar("carousel-item-gap")}) /
226
+ #{cv.getVar("carousel-items-in-view")}
227
+ );
228
+
229
+ flex: 0 0 $carousel-item-width;
230
+ width: $carousel-item-width;
231
+ min-width: $carousel-item-width;
159
232
 
160
233
  // Allow images to fill the slide
161
234
  img {
@@ -505,26 +578,6 @@ $carousel-indicator-line-radius: cv.getVar("radius-small") !default;
505
578
  }
506
579
  }
507
580
 
508
- // Carousel list variant (multiple visible items)
509
- .#{iv.$class-prefix}carousel-list {
510
- .#{iv.$class-prefix}carousel-container {
511
- overflow: visible;
512
- }
513
-
514
- .#{iv.$class-prefix}carousel-slides {
515
- display: flex;
516
- gap: 1rem;
517
- }
518
-
519
- .#{iv.$class-prefix}carousel-item {
520
- flex: 0 0 auto;
521
- width: auto;
522
- position: relative;
523
- opacity: 1;
524
- visibility: visible;
525
- }
526
- }
527
-
528
581
  // Responsive adjustments
529
582
  @media screen and (max-width: 768px) {
530
583
  .#{iv.$class-prefix}carousel {