@kiva/kv-components 3.102.5 → 3.103.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.103.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.5...@kiva/kv-components@3.103.0) (2024-10-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * new voting card ([#466](https://github.com/kiva/kv-ui-elements/issues/466)) ([039bca4](https://github.com/kiva/kv-ui-elements/commit/039bca45ac0b8fa2f902f4623af04da5d55a0a88))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.102.5](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.4...@kiva/kv-components@3.102.5) (2024-10-08)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.102.5",
3
+ "version": "3.103.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": "bb14366bd43ee865345ce371e52e4103791eb7c0"
86
+ "gitHead": "959188a1e62533846d7d1627c44218eaec5abcab"
87
87
  }
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div
3
+ class="vote_card"
4
+ :style="cssProps"
5
+ >
6
+ <h2 class="tw-italic tw-pb-1">
7
+ {{ title }}
8
+ </h2>
9
+ <p class="tw-pb-1.5">
10
+ {{ description }}
11
+ </p>
12
+ <div class="tw-block md:tw-flex tw-justify-between">
13
+ <div
14
+ v-if="showPercentage"
15
+ class="tw-flex tw-items-center tw-w-full tw-max-w-16"
16
+ >
17
+ <kv-progress-bar
18
+ class="tw-flex-grow"
19
+ :aria-label="'Percent of votes for ' + description"
20
+ :value="percentage"
21
+ />
22
+ <div class="tw-ml-2">
23
+ {{ percentage }}%
24
+ </div>
25
+ </div>
26
+ <kv-button
27
+ v-if="showVoteButton"
28
+ variant="secondary"
29
+ class="tw-flex-grow-0 tw-min-w-16 tw-mt-2"
30
+ @click="castVote"
31
+ >
32
+ Vote
33
+ </kv-button>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import {
40
+ computed,
41
+ toRefs,
42
+ } from 'vue-demi';
43
+ import KvProgressBar from './KvProgressBar.vue';
44
+ import KvButton from './KvButton.vue';
45
+
46
+ export default {
47
+ name: 'KvVotingCard',
48
+ components: {
49
+ KvProgressBar,
50
+ KvButton,
51
+ },
52
+ props: {
53
+ title: {
54
+ type: String,
55
+ default: '',
56
+ },
57
+ description: {
58
+ type: String,
59
+ default: '',
60
+ },
61
+ backgroundImageUrl: {
62
+ type: String,
63
+ default: '',
64
+ },
65
+ percentage: {
66
+ type: Number,
67
+ default: 0,
68
+ },
69
+ showVoteButton: {
70
+ type: Boolean,
71
+ default: true,
72
+ },
73
+ showPercentage: {
74
+ type: Boolean,
75
+ default: true,
76
+ },
77
+ },
78
+ emits: [
79
+ 'vote',
80
+ ],
81
+ setup(props, { emit }) {
82
+ const {
83
+ backgroundImageUrl,
84
+ } = toRefs(props);
85
+
86
+ const cssProps = computed(() => {
87
+ return {
88
+ '--background-image-voting-card': `url(${backgroundImageUrl.value})`,
89
+ };
90
+ });
91
+
92
+ return {
93
+ cssProps,
94
+ castVote() {
95
+ emit('vote');
96
+ },
97
+ };
98
+ },
99
+ };
100
+ </script>
101
+
102
+ <style lang="postcss">
103
+ .vote_card {
104
+ background-image:
105
+ linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 1) 100%),
106
+ var(--background-image-voting-card);
107
+ background-size: cover;
108
+ padding-top: 35%;
109
+ @apply tw-rounded tw-px-4 tw-pb-4 tw-text-white;
110
+ }
111
+ </style>
@@ -0,0 +1,33 @@
1
+ import KvVotingCardV2 from '../KvVotingCardV2.vue';
2
+
3
+ export default {
4
+ title: 'KvVotingCardV2',
5
+ component: KvVotingCardV2,
6
+ };
7
+
8
+ const Template = (args) => ({
9
+ components: { KvVotingCardV2 },
10
+ setup() {
11
+ return { args };
12
+ },
13
+ template: `
14
+ <div style="max-width: 524px;">
15
+ <kv-voting-card-v2 v-bind="args" @vote="vote"/>
16
+ </div>
17
+ `,
18
+ methods: {
19
+ vote() {
20
+ console.log('vote');
21
+ },
22
+ },
23
+ });
24
+
25
+ export const Default = Template.bind({});
26
+ Default.args = {
27
+ title: 'Women owned small businesses',
28
+ description: 'Just half of all women-owned businesses in the U.S. who apply for a loan are approved. Kiva provides access where others don\'t, creating more opportunities for women entrepreneurs.',
29
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/3LZLziZYCl05YAhb6zlH6G/df770c45b790f065b8f3d11744ef1417/Lola__Oregon__United_States.jpeg',
30
+ percentage: 45,
31
+ showVoteButton: true,
32
+ showPercentage: true,
33
+ };