@kiva/kv-components 3.83.2 → 3.85.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.85.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.84.0...@kiva/kv-components@3.85.0) (2024-07-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * carousel controls arrow added for aside version ([#423](https://github.com/kiva/kv-ui-elements/issues/423)) ([f1f8fb3](https://github.com/kiva/kv-ui-elements/commit/f1f8fb337b4a8ffb343e8341ce7a8d932805df1f))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.84.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.83.2...@kiva/kv-components@3.84.0) (2024-07-08)
18
+
19
+
20
+ ### Features
21
+
22
+ * aside controls variant added to carousel component ([#420](https://github.com/kiva/kv-ui-elements/issues/420)) ([d50ca9e](https://github.com/kiva/kv-ui-elements/commit/d50ca9eaa9023d437a5b9e385b95bfdecee7b122))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [3.83.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.83.1...@kiva/kv-components@3.83.2) (2024-06-25)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.83.2",
3
+ "version": "3.85.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,5 +75,5 @@
75
75
  "optional": true
76
76
  }
77
77
  },
78
- "gitHead": "b24be12d68662bf99ee0d17a1ed6f4b788ae0ce5"
78
+ "gitHead": "70ca09fb749daec6850f8eba2a97023a1b43f47c"
79
79
  }
@@ -2,11 +2,13 @@
2
2
  <section
3
3
  ref="rootEl"
4
4
  class="kv-carousel tw-overflow-hidden tw-w-full"
5
+ :class="{ 'lg:tw-relative': asideControls }"
5
6
  aria-label="carousel"
6
7
  >
7
8
  <!-- Carousel Content -->
8
9
  <div
9
10
  class="tw-flex tw-gap-x-4"
11
+ :class="{ 'tw-mx-auto aside-controls-content': asideControls }"
10
12
  @click.capture="onCarouselContainerClick"
11
13
  >
12
14
  <div
@@ -32,6 +34,7 @@
32
34
  class="kv-carousel__controls tw-flex
33
35
  tw-justify-between md:tw-justify-center tw-items-center
34
36
  tw-mt-4 tw-w-full"
37
+ :class="{ 'lg:tw-hidden': asideControls }"
35
38
  >
36
39
  <button
37
40
  class="tw-text-primary
@@ -45,7 +48,7 @@
45
48
  >
46
49
  <kv-material-icon
47
50
  class="tw-w-4"
48
- :icon="mdiChevronLeft"
51
+ :icon="asideControls? mdiArrowLeft : mdiChevronLeft"
49
52
  />
50
53
  <span class="tw-sr-only">Show previous slide</span>
51
54
  </button>
@@ -67,11 +70,55 @@
67
70
  >
68
71
  <kv-material-icon
69
72
  class="tw-w-4"
70
- :icon="mdiChevronRight"
73
+ :icon="asideControls ? mdiArrowRight : mdiChevronRight"
71
74
  />
72
75
  <span class="tw-sr-only">Show next slide</span>
73
76
  </button>
74
77
  </div>
78
+ <!-- Aside Buttons -->
79
+ <template v-if="asideControls">
80
+ <div
81
+ class="tw-hidden lg:tw-flex tw-absolute tw-h-full tw-top-0 tw-items-center"
82
+ style="background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%); width: 8%;"
83
+ >
84
+ <button
85
+ class="tw-text-primary tw-bg-gray-100
86
+ tw-rounded-full
87
+ tw-h-6 tw-w-6 tw-ml-3
88
+ tw-flex tw-items-center tw-justify-center
89
+ disabled:tw-opacity-low disabled:tw-cursor-default"
90
+ :disabled="embla && !embla.canScrollPrev()"
91
+ @click="handleUserInteraction(previousIndex, 'click-left-arrow')"
92
+ >
93
+ <kv-material-icon
94
+ class="tw-w-4"
95
+ :icon="mdiArrowLeft"
96
+ />
97
+ <span class="tw-sr-only">Show previous slide</span>
98
+ </button>
99
+ </div>
100
+ <div
101
+ class="tw-hidden lg:tw-flex tw-absolute tw-h-full
102
+ tw-top-0 tw-right-0 tw-items-center tw-justify-end tw-w-16"
103
+ style="background: linear-gradient(270deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%); width: 8%;"
104
+ >
105
+ <button
106
+ class="tw-text-primary tw-bg-gray-100
107
+ tw-rounded-full
108
+ tw-h-6 tw-w-6 tw-mr-3
109
+ tw-flex tw-items-center tw-justify-center
110
+ disabled:tw-opacity-low disabled:tw-cursor-default"
111
+ :disabled="embla && !embla.canScrollNext()"
112
+ @click="handleUserInteraction(nextIndex, 'click-right-arrow')"
113
+ >
114
+ <kv-material-icon
115
+ class="tw-w-4"
116
+ :icon="mdiArrowRight"
117
+ />
118
+ <span class="tw-sr-only">Show next slide</span>
119
+ </button>
120
+ </div>
121
+ </template>
75
122
  </section>
76
123
  </template>
77
124
 
@@ -85,7 +132,12 @@ import {
85
132
  nextTick,
86
133
  } from 'vue-demi';
87
134
  import EmblaCarousel from 'embla-carousel';
88
- import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
135
+ import {
136
+ mdiChevronLeft,
137
+ mdiChevronRight,
138
+ mdiArrowLeft,
139
+ mdiArrowRight,
140
+ } from '@mdi/js';
89
141
  import { throttle } from '../utils/throttle';
90
142
 
91
143
  import KvMaterialIcon from './KvMaterialIcon.vue';
@@ -133,6 +185,13 @@ export default {
133
185
  type: String,
134
186
  default: '',
135
187
  },
188
+ /**
189
+ * Aside controls version of the carousel
190
+ * */
191
+ asideControls: {
192
+ type: Boolean,
193
+ default: false,
194
+ },
136
195
  },
137
196
  emits: [
138
197
  'change',
@@ -301,6 +360,8 @@ export default {
301
360
  rootEl,
302
361
  mdiChevronLeft,
303
362
  mdiChevronRight,
363
+ mdiArrowLeft,
364
+ mdiArrowRight,
304
365
  embla,
305
366
  slides,
306
367
  currentIndex,
@@ -319,3 +380,11 @@ export default {
319
380
  },
320
381
  };
321
382
  </script>
383
+
384
+ <style scoped>
385
+ .aside-controls-content {
386
+ @screen lg {
387
+ width: 82%;
388
+ }
389
+ }
390
+ </style>
@@ -353,3 +353,44 @@ export const CustomStartIndex = () => ({
353
353
  </kv-carousel>
354
354
  `,
355
355
  });
356
+
357
+ export const AsideControls = () => ({
358
+ components: {
359
+ KvCarousel,
360
+ KvButton,
361
+ },
362
+ template: `
363
+ <kv-carousel
364
+ :embla-options="{ loop: false }"
365
+ :multiple-slides-visible="true"
366
+ :aside-controls="true"
367
+ slides-to-scroll="visible"
368
+ class="tw-w-full"
369
+ >
370
+ <template #slide1>
371
+ ${generateLoanCardTemplate(1)}
372
+ </template>
373
+ <template #slide2>
374
+ ${generateLoanCardTemplate(2)}
375
+ </template>
376
+ <template #slide3>
377
+ ${generateLoanCardTemplate(3)}
378
+ </template>
379
+ <template #slide4>
380
+ ${generateLoanCardTemplate(4)}
381
+ </template>
382
+ <template #slide5>
383
+ ${generateLoanCardTemplate(5)}
384
+ </template>
385
+ <template #slide6>
386
+ ${generateLoanCardTemplate(6)}
387
+ </template>
388
+ <template #slide7>
389
+ ${generateLoanCardTemplate(7)}
390
+ </template>
391
+ <template #slide8>
392
+ ${generateLoanCardTemplate(8)}
393
+ </template>
394
+ </kv-carousel>
395
+ `,
396
+ });