@kiva/kv-components 3.91.0 → 3.92.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.92.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.91.1...@kiva/kv-components@3.92.0) (2024-08-16)
7
+
8
+
9
+ ### Features
10
+
11
+ * dotted version for carousel controls ([#444](https://github.com/kiva/kv-ui-elements/issues/444)) ([a719d75](https://github.com/kiva/kv-ui-elements/commit/a719d75ce7622695668fe1467bf1129d916800c2))
12
+
13
+
14
+
15
+
16
+
17
+ ## [3.91.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.91.0...@kiva/kv-components@3.91.1) (2024-08-14)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * resolve issue found in ui vue migration ([0050e5e](https://github.com/kiva/kv-ui-elements/commit/0050e5e93cf189f18fda0c468a577546f5f1911c))
23
+
24
+
25
+
26
+
27
+
6
28
  # [3.91.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.90.5...@kiva/kv-components@3.91.0) (2024-08-14)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.91.0",
3
+ "version": "3.92.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -82,5 +82,5 @@
82
82
  "optional": true
83
83
  }
84
84
  },
85
- "gitHead": "d7a9fad77e1a68fd3d4483619c937c37a3807503"
85
+ "gitHead": "fb2c7d62581911858d5b04e6d1dd81f371981a03"
86
86
  }
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
  <!-- Carousel Controls -->
32
32
  <div
33
- v-if="slideIndicatorCount > 1"
33
+ v-if="slideIndicatorCount > 1 && !isDotted"
34
34
  class="kv-carousel__controls tw-flex
35
35
  tw-justify-between md:tw-justify-center tw-items-center
36
36
  tw-mt-4 tw-w-full"
@@ -75,6 +75,26 @@
75
75
  <span class="tw-sr-only">Show next slide</span>
76
76
  </button>
77
77
  </div>
78
+ <!-- Dotted Controls -->
79
+ <div
80
+ v-else-if="slideIndicatorCount > 1"
81
+ class="kv-carousel__controls tw-flex tw-justify-center tw-items-center tw-gap-1.5 tw-mt-4 tw-w-full"
82
+ >
83
+ <button
84
+ v-for="slide in slideIndicatorCount"
85
+ :key="slide"
86
+ @click="goToSlide(slide - 1)"
87
+ >
88
+ <div
89
+ class="tw-rounded-full tw-border tw-transition tw-duration-500 tw-ease-in-out"
90
+ :class="[
91
+ { 'tw-bg-black tw-border-black tw-h-1.5 tw-w-1.5': currentIndex === slide - 1 },
92
+ { 'tw-bg-tertiary tw-border-tertiary tw-h-1 tw-w-1': currentIndex !== slide - 1 }
93
+ ]"
94
+ >
95
+ </div>
96
+ </button>
97
+ </div>
78
98
  <!-- Aside Buttons -->
79
99
  <template v-if="asideControls">
80
100
  <div
@@ -192,6 +212,13 @@ export default {
192
212
  type: Boolean,
193
213
  default: false,
194
214
  },
215
+ /**
216
+ * Dotted controls version of the carousel
217
+ * */
218
+ isDotted: {
219
+ type: Boolean,
220
+ default: false,
221
+ },
195
222
  },
196
223
  emits: [
197
224
  'change',
@@ -217,16 +217,23 @@ export default {
217
217
  const kvLightbox = ref(null);
218
218
  const kvLightboxBody = ref(null);
219
219
  const controlsRef = ref(null);
220
+ const activateFocusTrap = ref(null);
221
+ const deactivateFocusTrap = ref(null);
220
222
 
221
- const trapElements = computed(() => [
222
- kvLightbox.value, // This lightbox
223
- '[role="alert"]', // Any open toasts/alerts on the page
224
- ]);
225
- const {
226
- activate: activateFocusTrap,
227
- deactivate: deactivateFocusTrap,
228
- } = useFocusTrap(trapElements, {
229
- allowOutsideClick: true, // allow clicking outside the lightbox to close it
223
+ // Ensure the lightbox ref isn't null
224
+ nextTick(() => {
225
+ const trapElements = computed(() => [
226
+ kvLightbox.value, // This lightbox
227
+ '[role="alert"]', // Any open toasts/alerts on the page
228
+ ]);
229
+ const {
230
+ activate,
231
+ deactivate,
232
+ } = useFocusTrap(trapElements, {
233
+ allowOutsideClick: true, // allow clicking outside the lightbox to close it
234
+ });
235
+ activateFocusTrap.value = activate;
236
+ deactivateFocusTrap.value = deactivate;
230
237
  });
231
238
 
232
239
  let makePageInertCallback = null;
@@ -242,7 +249,7 @@ export default {
242
249
  const hide = (closedBy = '') => {
243
250
  // scroll any content inside the lightbox back to top
244
251
  if (kvLightbox.value && kvLightboxBody.value) {
245
- deactivateFocusTrap();
252
+ deactivateFocusTrap.value?.();
246
253
  kvLightboxBody.value.scrollTop = 0;
247
254
  unlockPrintSingleEl(kvLightboxBody.value);
248
255
  }
@@ -279,7 +286,7 @@ export default {
279
286
 
280
287
  nextTick(() => {
281
288
  if (kvLightbox.value && kvLightboxBody.value) {
282
- activateFocusTrap();
289
+ activateFocusTrap.value?.();
283
290
  makePageInertCallback = makePageInert(kvLightbox.value);
284
291
  lockPrintSingleEl(kvLightboxBody.value);
285
292
  }
@@ -394,3 +394,17 @@ export const AsideControls = () => ({
394
394
  </kv-carousel>
395
395
  `,
396
396
  });
397
+
398
+ export const Dotted = () => ({
399
+ components: {
400
+ KvCarousel,
401
+ },
402
+ template: `
403
+ <kv-carousel
404
+ style="max-width: 400px;"
405
+ is-dotted="true"
406
+ >
407
+ ${defaultCarouselSlides}
408
+ </kv-carousel>
409
+ `,
410
+ });