@kiva/kv-components 3.102.5 → 3.104.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.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
+
8
+
9
+ ### Features
10
+
11
+ * vertically align contents inside voting cards 2 to bottom ([828e24d](https://github.com/kiva/kv-ui-elements/commit/828e24dd12b40674fd2f5079b2741ebf0e014c03))
12
+
13
+
14
+
15
+
16
+
17
+ # [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * new voting card ([#466](https://github.com/kiva/kv-ui-elements/issues/466)) ([039bca4](https://github.com/kiva/kv-ui-elements/commit/039bca45ac0b8fa2f902f4623af04da5d55a0a88))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [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
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.102.5",
3
+ "version": "3.104.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": "244b386005bccd8280e918bde08c7fd4d6fd7502"
87
87
  }
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <div
3
+ class="vote_card tw-flex tw-flex-col tw-justify-end"
4
+ :style="cssProps"
5
+ >
6
+ <div
7
+ class="tw-flex-grow-0"
8
+ >
9
+ <h2 class="tw-italic tw-pb-1">
10
+ {{ title }}
11
+ </h2>
12
+ <p class="tw-pb-1.5">
13
+ {{ description }}
14
+ </p>
15
+ <div class="tw-block md:tw-flex tw-justify-between">
16
+ <div
17
+ v-if="showPercentage"
18
+ class="tw-flex tw-items-center tw-w-full tw-max-w-16"
19
+ >
20
+ <kv-progress-bar
21
+ class="tw-flex-grow"
22
+ :aria-label="'Percent of votes for ' + description"
23
+ :value="percentage"
24
+ />
25
+ <div class="tw-ml-2">
26
+ {{ percentage }}%
27
+ </div>
28
+ </div>
29
+ <kv-button
30
+ v-if="showVoteButton"
31
+ variant="secondary"
32
+ class="tw-flex-grow-0 tw-min-w-16 tw-mt-2"
33
+ @click="castVote"
34
+ >
35
+ Vote
36
+ </kv-button>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ import {
44
+ computed,
45
+ toRefs,
46
+ } from 'vue-demi';
47
+ import KvProgressBar from './KvProgressBar.vue';
48
+ import KvButton from './KvButton.vue';
49
+
50
+ export default {
51
+ name: 'KvVotingCard',
52
+ components: {
53
+ KvProgressBar,
54
+ KvButton,
55
+ },
56
+ props: {
57
+ title: {
58
+ type: String,
59
+ default: '',
60
+ },
61
+ description: {
62
+ type: String,
63
+ default: '',
64
+ },
65
+ backgroundImageUrl: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+ percentage: {
70
+ type: Number,
71
+ default: 0,
72
+ },
73
+ showVoteButton: {
74
+ type: Boolean,
75
+ default: true,
76
+ },
77
+ showPercentage: {
78
+ type: Boolean,
79
+ default: true,
80
+ },
81
+ },
82
+ emits: [
83
+ 'vote',
84
+ ],
85
+ setup(props, { emit }) {
86
+ const {
87
+ backgroundImageUrl,
88
+ } = toRefs(props);
89
+
90
+ const cssProps = computed(() => {
91
+ return {
92
+ '--background-image-voting-card': `url(${backgroundImageUrl.value})`,
93
+ };
94
+ });
95
+
96
+ return {
97
+ cssProps,
98
+ castVote() {
99
+ emit('vote');
100
+ },
101
+ };
102
+ },
103
+ };
104
+ </script>
105
+
106
+ <style lang="postcss">
107
+ .vote_card {
108
+ background-image:
109
+ linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 1) 100%),
110
+ var(--background-image-voting-card);
111
+ background-size: cover;
112
+ @apply tw-rounded tw-px-4 tw-pb-4 tw-text-white;
113
+ }
114
+ </style>
@@ -0,0 +1,89 @@
1
+ import KvVotingCardV2 from '../KvVotingCardV2.vue';
2
+
3
+ export default {
4
+ title: 'KvVotingCardV2',
5
+ component: KvVotingCardV2,
6
+ };
7
+
8
+ const TemplateDefault = (args) => ({
9
+ components: { KvVotingCardV2 },
10
+ setup() {
11
+ return { args };
12
+ },
13
+ template: `
14
+ <div>
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
+ const TemplateMultiple = () => ({
26
+ components: { KvVotingCardV2 },
27
+ setup() {
28
+ const args1 = {
29
+ title: 'Women owned small businesses',
30
+ 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.',
31
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/2l422gpfOYHz02yy3V1Qey/12e64dbe0690fb2f12e0d95f6321f6d1/Jacqueline-Rwanda.jpg',
32
+ percentage: 45,
33
+ showVoteButton: true,
34
+ showPercentage: true,
35
+ };
36
+ const args2 = {
37
+ title: 'BIPOC-owned small businesses',
38
+ description: 'Small businesses create more opportunities for women entrepreneurs.',
39
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/3LZLziZYCl05YAhb6zlH6G/df770c45b790f065b8f3d11744ef1417/Lola__Oregon__United_States.jpeg',
40
+ percentage: 45,
41
+ showVoteButton: true,
42
+ showPercentage: true,
43
+ };
44
+ const args3 = {
45
+ title: 'Early-stage small businesses',
46
+ description: 'Local shops are the heartbeat of our communities — but only 80% of these businesses survive their first year. When you support U.S. small businesses, youre helping to create employment opportunities and stimulate local economies.',
47
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/65YeFWuXaomM61E8PYasqp/0594e95be96cb8eac86b9ebc26bd684d/Natasha__California__United_States_sm.jpeg',
48
+ percentage: 45,
49
+ showVoteButton: true,
50
+ showPercentage: true,
51
+ };
52
+ const args4 = {
53
+ title: 'Food and retail small businesses',
54
+ description: 'Food and retail businesses are vital contributors to their communities. Sadly they face challenges in getting the financing they need. Loans can help them grow and operate sustainably so they can keep feeding their local neighborhoods.',
55
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/2B3wamFMVgJnjuIgMmWCNB/51e4a36aeeb86156f8fe967486c13126/Anna__California__United_States.jpg',
56
+ percentage: 45,
57
+ showVoteButton: true,
58
+ showPercentage: true,
59
+ };
60
+ return {
61
+ args1, args2, args3, args4,
62
+ };
63
+ },
64
+ template: `
65
+ <div class="tw-flex md:tw-flex-wrap" style="max-width: 1200px;">
66
+ <kv-voting-card-v2 v-bind="args1" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
67
+ <kv-voting-card-v2 v-bind="args2" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
68
+ <kv-voting-card-v2 v-bind="args3" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
69
+ <kv-voting-card-v2 v-bind="args4" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
70
+ </div>
71
+ `,
72
+ methods: {
73
+ vote() {
74
+ console.log('vote');
75
+ },
76
+ },
77
+ });
78
+
79
+ export const Default = TemplateDefault.bind({});
80
+ Default.args = {
81
+ title: 'Women owned small businesses',
82
+ 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.',
83
+ backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/3LZLziZYCl05YAhb6zlH6G/df770c45b790f065b8f3d11744ef1417/Lola__Oregon__United_States.jpeg',
84
+ percentage: 45,
85
+ showVoteButton: true,
86
+ showPercentage: true,
87
+ };
88
+
89
+ export const MultipleInGrid = TemplateMultiple.bind({});