@kiva/kv-components 3.104.0 → 3.105.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,17 @@
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.105.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.104.0...@kiva/kv-components@3.105.0) (2024-10-15)
7
+
8
+
9
+ ### Features
10
+
11
+ * vote card read more ([b7d2c74](https://github.com/kiva/kv-ui-elements/commit/b7d2c74dfa6c464e68b3a6a52298a4a37b11d184))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.104.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.103.0...@kiva/kv-components@3.104.0) (2024-10-09)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.104.0",
3
+ "version": "3.105.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -83,5 +83,5 @@
83
83
  "optional": true
84
84
  }
85
85
  },
86
- "gitHead": "244b386005bccd8280e918bde08c7fd4d6fd7502"
86
+ "gitHead": "1e9645f3136ca83e1768fab93e3e97e636fa29e7"
87
87
  }
@@ -4,13 +4,18 @@
4
4
  :style="cssProps"
5
5
  >
6
6
  <div
7
- class="tw-flex-grow-0"
7
+ class="tw-flex-grow-0 tw-text-white"
8
8
  >
9
9
  <h2 class="tw-italic tw-pb-1">
10
10
  {{ title }}
11
11
  </h2>
12
12
  <p class="tw-pb-1.5">
13
- {{ description }}
13
+ {{ truncatedDescription }}
14
+ <a
15
+ v-if="isTruncated"
16
+ class="tw-underline tw-pl-1 tw-text-white tw-cursor-pointer"
17
+ @click="isLightboxOpen = true"
18
+ >read more</a>
14
19
  </p>
15
20
  <div class="tw-block md:tw-flex tw-justify-between">
16
21
  <div
@@ -36,22 +41,39 @@
36
41
  </kv-button>
37
42
  </div>
38
43
  </div>
44
+ <KvLightbox
45
+ :title="title"
46
+ :visible="isLightboxOpen"
47
+ @lightbox-closed="isLightboxOpen = false"
48
+ >
49
+ <template #header>
50
+ <h3>
51
+ {{ title }}
52
+ </h3>
53
+ </template>
54
+ <p class="tw-pb-1.5">
55
+ {{ description }}
56
+ </p>
57
+ </KvLightbox>
39
58
  </div>
40
59
  </template>
41
60
 
42
61
  <script>
43
62
  import {
44
63
  computed,
64
+ ref,
45
65
  toRefs,
46
66
  } from 'vue-demi';
47
67
  import KvProgressBar from './KvProgressBar.vue';
48
68
  import KvButton from './KvButton.vue';
69
+ import KvLightbox from './KvLightbox.vue';
49
70
 
50
71
  export default {
51
72
  name: 'KvVotingCard',
52
73
  components: {
53
- KvProgressBar,
54
74
  KvButton,
75
+ KvLightbox,
76
+ KvProgressBar,
55
77
  },
56
78
  props: {
57
79
  title: {
@@ -83,8 +105,13 @@ export default {
83
105
  'vote',
84
106
  ],
85
107
  setup(props, { emit }) {
108
+ const isLightboxOpen = ref(false);
109
+
110
+ const TRUNCATION_LIMIT = 110;
111
+
86
112
  const {
87
113
  backgroundImageUrl,
114
+ description,
88
115
  } = toRefs(props);
89
116
 
90
117
  const cssProps = computed(() => {
@@ -93,11 +120,24 @@ export default {
93
120
  };
94
121
  });
95
122
 
123
+ const isTruncated = computed(() => {
124
+ return description?.value && (description?.value.length > TRUNCATION_LIMIT);
125
+ });
126
+
127
+ const truncatedDescription = computed(() => {
128
+ if (isTruncated.value) {
129
+ return `${description.value.substring(0, TRUNCATION_LIMIT)}...`;
130
+ }
131
+ return description.value;
132
+ });
96
133
  return {
97
134
  cssProps,
98
135
  castVote() {
99
136
  emit('vote');
100
137
  },
138
+ isLightboxOpen,
139
+ isTruncated,
140
+ truncatedDescription,
101
141
  };
102
142
  },
103
143
  };
@@ -109,6 +149,6 @@ export default {
109
149
  linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 1) 100%),
110
150
  var(--background-image-voting-card);
111
151
  background-size: cover;
112
- @apply tw-rounded tw-px-4 tw-pb-4 tw-text-white;
152
+ @apply tw-rounded tw-px-4 tw-pb-4;
113
153
  }
114
154
  </style>