@kiva/kv-components 3.106.0 → 3.107.1
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/.eslintrc.cjs +1 -0
- package/CHANGELOG.md +22 -0
- package/dist/components/.storybook/main.js +85 -0
- package/dist/components/.storybook/package.json +3 -0
- package/dist/components/.storybook/preview.js +61 -0
- package/dist/components/.storybook/tailwind.css +5 -0
- package/dist/components/KvAccordionItem.vue +130 -0
- package/dist/components/KvActivityRow.vue +33 -0
- package/dist/components/KvBorrowerImage.vue +179 -0
- package/dist/components/KvButton.vue +287 -0
- package/dist/components/KvCarousel.vue +297 -0
- package/dist/components/KvCartModal.vue +365 -0
- package/dist/components/KvCheckbox.vue +203 -0
- package/dist/components/KvChip.vue +54 -0
- package/dist/components/KvClassicLoanCard.vue +527 -0
- package/dist/components/KvCommentsAdd.vue +135 -0
- package/dist/components/KvCommentsContainer.vue +84 -0
- package/dist/components/KvCommentsHeartButton.vue +70 -0
- package/dist/components/KvCommentsList.vue +68 -0
- package/dist/components/KvCommentsListItem.vue +241 -0
- package/dist/components/KvCommentsReplyButton.vue +52 -0
- package/dist/components/KvContentfulImg.vue +273 -0
- package/dist/components/KvCountdownTimer.vue +59 -0
- package/dist/components/KvExpandable.vue +84 -0
- package/dist/components/KvExpandableQuestion.vue +120 -0
- package/dist/components/KvFlag.vue +120 -0
- package/dist/components/KvGrid.vue +28 -0
- package/dist/components/KvImpactDashboardHeader.vue +40 -0
- package/dist/components/KvInlineActivityCard.vue +55 -0
- package/dist/components/KvInlineActivityFeed.vue +38 -0
- package/dist/components/KvIntroductionLoanCard.vue +446 -0
- package/dist/components/KvLendAmountButton.vue +65 -0
- package/dist/components/KvLendCta.vue +451 -0
- package/dist/components/KvLightbox.vue +334 -0
- package/dist/components/KvLineGraph.vue +128 -0
- package/dist/components/KvLoadingPlaceholder.vue +38 -0
- package/dist/components/KvLoadingSpinner.vue +81 -0
- package/dist/components/KvLoanActivities.vue +268 -0
- package/dist/components/KvLoanBookmark.vue +39 -0
- package/dist/components/KvLoanCallouts.vue +53 -0
- package/dist/components/KvLoanProgressGroup.vue +76 -0
- package/dist/components/KvLoanTag.vue +88 -0
- package/dist/components/KvLoanTeamPick.vue +44 -0
- package/dist/components/KvLoanUse.vue +92 -0
- package/dist/components/KvMap.vue +599 -0
- package/dist/components/KvMaterialIcon.vue +47 -0
- package/dist/components/KvPageContainer.vue +15 -0
- package/dist/components/KvPagination.vue +198 -0
- package/dist/components/KvPieChart.vue +257 -0
- package/dist/components/KvPopper.vue +178 -0
- package/dist/components/KvProgressBar.vue +149 -0
- package/dist/components/KvRadio.vue +198 -0
- package/dist/components/KvSelect.vue +114 -0
- package/dist/components/KvSideSheet.vue +134 -0
- package/dist/components/KvSwitch.vue +143 -0
- package/dist/components/KvTab.vue +90 -0
- package/dist/components/KvTabPanel.vue +64 -0
- package/dist/components/KvTabs.vue +182 -0
- package/dist/components/KvTextInput.vue +247 -0
- package/dist/components/KvTextLink.vue +138 -0
- package/dist/components/KvThemeProvider.vue +122 -0
- package/dist/components/KvToast.vue +221 -0
- package/dist/components/KvTooltip.vue +168 -0
- package/dist/components/KvTreeMapChart.vue +229 -0
- package/dist/components/KvUserAvatar.vue +132 -0
- package/dist/components/KvVerticalCarousel.vue +156 -0
- package/dist/components/KvVotingCard.vue +160 -0
- package/dist/components/KvVotingCardV2.vue +154 -0
- package/dist/components/KvWideLoanCard.vue +432 -0
- package/dist/components/stories/Forms.stories.js +62 -0
- package/dist/components/stories/KvAccordionItem.stories.js +24 -0
- package/dist/components/stories/KvActivityRow.stories.js +25 -0
- package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
- package/dist/components/stories/KvButton.stories.js +144 -0
- package/dist/components/stories/KvCarousel.stories.js +426 -0
- package/dist/components/stories/KvCartModal.stories.js +54 -0
- package/dist/components/stories/KvCheckbox.stories.js +163 -0
- package/dist/components/stories/KvChip.stories.js +43 -0
- package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
- package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
- package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
- package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
- package/dist/components/stories/KvCommentsList.stories.js +39 -0
- package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
- package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
- package/dist/components/stories/KvContentfulImg.stories.js +196 -0
- package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
- package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
- package/dist/components/stories/KvFlag.stories.js +36 -0
- package/dist/components/stories/KvGrid.stories.js +97 -0
- package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
- package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
- package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
- package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
- package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
- package/dist/components/stories/KvLendCta.stories.js +177 -0
- package/dist/components/stories/KvLightbox.stories.js +304 -0
- package/dist/components/stories/KvLineGraph.stories.js +52 -0
- package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
- package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
- package/dist/components/stories/KvLoanActivities.stories.js +104 -0
- package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
- package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
- package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
- package/dist/components/stories/KvLoanTag.stories.js +61 -0
- package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
- package/dist/components/stories/KvLoanUse.stories.js +60 -0
- package/dist/components/stories/KvMap.stories.js +121 -0
- package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
- package/dist/components/stories/KvPageContainer.stories.js +50 -0
- package/dist/components/stories/KvPagination.stories.js +70 -0
- package/dist/components/stories/KvPieChart.stories.js +47 -0
- package/dist/components/stories/KvProgressBar.stories.js +53 -0
- package/dist/components/stories/KvRadio.stories.js +140 -0
- package/dist/components/stories/KvSelect.stories.js +125 -0
- package/dist/components/stories/KvSideSheet.stories.js +50 -0
- package/dist/components/stories/KvSwitch.stories.js +66 -0
- package/dist/components/stories/KvTabs.stories.js +106 -0
- package/dist/components/stories/KvTextInput.stories.js +194 -0
- package/dist/components/stories/KvTextLink.stories.js +55 -0
- package/dist/components/stories/KvThemeProvider.stories.js +178 -0
- package/dist/components/stories/KvToast.stories.js +117 -0
- package/dist/components/stories/KvTooltip.stories.js +26 -0
- package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
- package/dist/components/stories/KvUserAvatar.stories.js +47 -0
- package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
- package/dist/components/stories/KvVotingCard.stories.js +33 -0
- package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
- package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
- package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
- package/dist/components/stories/StyleguideProse.stories.js +215 -0
- package/dist/data/countries-borders.json +1 -0
- package/dist/data/ne_110m_admin_0_countries.json +1 -0
- package/dist/utils/Alea.cjs +87 -0
- package/dist/utils/Alea.js +9 -0
- package/dist/utils/attrs.cjs +50 -0
- package/dist/utils/attrs.js +7 -0
- package/dist/utils/carousels.cjs +184 -0
- package/dist/utils/carousels.js +8 -0
- package/dist/utils/chunk-3HK4G4NT.js +27 -0
- package/dist/utils/chunk-55HF2ORX.js +201 -0
- package/dist/utils/chunk-AY3PR5S4.js +54 -0
- package/dist/utils/chunk-AZPWOFD5.js +148 -0
- package/dist/utils/chunk-B5J5WLAH.js +18 -0
- package/dist/utils/chunk-GPSH6OPA.js +64 -0
- package/dist/utils/chunk-HIY5IW65.js +28 -0
- package/dist/utils/chunk-HV3AUBFT.js +15 -0
- package/dist/utils/chunk-MSMZIN54.js +110 -0
- package/dist/utils/chunk-OXJCCNNW.js +30 -0
- package/dist/utils/chunk-S3MABILA.js +22 -0
- package/dist/utils/chunk-VIGEMAKO.js +249 -0
- package/dist/utils/chunk-YCNMJ4YV.js +37 -0
- package/dist/utils/chunk-YFEC5ODJ.js +129 -0
- package/dist/utils/expander.cjs +78 -0
- package/dist/utils/expander.js +9 -0
- package/dist/utils/imageUtils.cjs +54 -0
- package/dist/utils/imageUtils.js +9 -0
- package/dist/utils/index.cjs +1118 -0
- package/dist/utils/index.js +166 -0
- package/dist/utils/loanCard.cjs +222 -0
- package/dist/utils/loanCard.js +9 -0
- package/dist/utils/loanUtils.cjs +170 -0
- package/dist/utils/loanUtils.js +23 -0
- package/dist/utils/mapUtils.cjs +276 -0
- package/dist/utils/mapUtils.js +15 -0
- package/dist/utils/printing.cjs +42 -0
- package/dist/utils/printing.js +9 -0
- package/dist/utils/scrollLock.cjs +54 -0
- package/dist/utils/scrollLock.js +13 -0
- package/dist/utils/throttle.cjs +38 -0
- package/dist/utils/throttle.js +7 -0
- package/dist/utils/touchEvents.cjs +47 -0
- package/dist/utils/touchEvents.js +11 -0
- package/dist/utils/treemap.cjs +133 -0
- package/dist/utils/treemap.js +7 -0
- package/package.json +12 -4
- package/utils/index.js +14 -0
- package/vue/KvVerticalCarousel.vue +1 -1
- package/index.js +0 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mdiArrowRight,
|
|
3
|
+
} from '@mdi/js';
|
|
4
|
+
import KvTextLink from '../KvTextLink.vue';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'KvTextLink',
|
|
8
|
+
component: KvTextLink,
|
|
9
|
+
args: {
|
|
10
|
+
state: '',
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
state: {
|
|
14
|
+
control: {
|
|
15
|
+
type: 'select',
|
|
16
|
+
options: ['', 'disabled'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Template = (args, { argTypes }) => ({
|
|
23
|
+
props: Object.keys(argTypes),
|
|
24
|
+
components: { KvTextLink },
|
|
25
|
+
template: `
|
|
26
|
+
<kv-text-link
|
|
27
|
+
:state="state"
|
|
28
|
+
:href="href"
|
|
29
|
+
:to="to"
|
|
30
|
+
:icon="icon"
|
|
31
|
+
@click="onClick"
|
|
32
|
+
>
|
|
33
|
+
Find a borrower
|
|
34
|
+
</kv-text-link>`,
|
|
35
|
+
methods: {
|
|
36
|
+
onClick(e) { console.log(e); },
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const Default = Template.bind({});
|
|
41
|
+
|
|
42
|
+
export const StateDisabled = Template.bind({});
|
|
43
|
+
StateDisabled.args = {
|
|
44
|
+
state: 'disabled',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithHref = Template.bind({});
|
|
48
|
+
WithHref.args = {
|
|
49
|
+
href: 'https://www.example.com',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithIcon = Template.bind({});
|
|
53
|
+
WithIcon.args = {
|
|
54
|
+
icon: mdiArrowRight,
|
|
55
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import primitives from '@kiva/kv-tokens/primitives.json';
|
|
2
|
+
import {
|
|
3
|
+
defaultTheme, darkTheme, darkGreenTheme, mintTheme, darkMintTheme, darkStoneTheme,
|
|
4
|
+
} from '@kiva/kv-tokens/configs/kivaColors.cjs';
|
|
5
|
+
import KvButton from '../KvButton.vue';
|
|
6
|
+
import KvGrid from '../KvGrid.vue';
|
|
7
|
+
import KvPageContainer from '../KvPageContainer.vue';
|
|
8
|
+
import KvTextLink from '../KvTextLink.vue';
|
|
9
|
+
import KvThemeProvider from '../KvThemeProvider.vue';
|
|
10
|
+
|
|
11
|
+
const defaultThemeTokens = primitives.colors.theme.DEFAULT;
|
|
12
|
+
|
|
13
|
+
const buildTailwindClasses = (prefix) => {
|
|
14
|
+
let twPrefix = prefix;
|
|
15
|
+
if (prefix === 'background') {
|
|
16
|
+
twPrefix = 'bg';
|
|
17
|
+
}
|
|
18
|
+
return Object.keys(defaultThemeTokens[prefix]).map((key) => `tw-${twPrefix}-${key}`);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
title: 'KvThemeProvider',
|
|
23
|
+
component: KvThemeProvider,
|
|
24
|
+
args: {
|
|
25
|
+
theme: '',
|
|
26
|
+
customTheme: null,
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
theme: {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'select',
|
|
32
|
+
options: ['', 'dark', 'darkGreen', 'mint'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const demoTemplate = `
|
|
39
|
+
<div class="tw-p-4 tw-mb-8 tw-rounded tw-bg-primary tw-border tw-flex tw-flex-col tw-gap-4">
|
|
40
|
+
<section>
|
|
41
|
+
<p
|
|
42
|
+
v-for="textVariable in textVariables"
|
|
43
|
+
:key="textVariable"
|
|
44
|
+
class="tw-text-h2 tw-mb-2"
|
|
45
|
+
:class="textVariable"
|
|
46
|
+
>
|
|
47
|
+
<span>{{textVariable}}</span>
|
|
48
|
+
<span class="tw-text-opacity-low" :class="textVariable">text-opacity-low</span>
|
|
49
|
+
</p>
|
|
50
|
+
<h1 class="tw-text-jumbo tw-mb-2">Jumbo: The quick <u>brown fox</u> jumped <u>over the lazy dog</u></h1>
|
|
51
|
+
<h1 class="tw-mb-2">H1: The quick <u>brown fox</u> jumped <u>over the lazy dog</u></h1>
|
|
52
|
+
<h2 class="tw-mb-2">H2: The quick <u>brown fox</u> jumped <u>over the lazy dog</u></h2>
|
|
53
|
+
<h3 class="tw-mb-2">H3: The quick <u>brown fox</u> jumped <u>over the lazy dog</u></h3>
|
|
54
|
+
<p>Body text: Voluptate culpa qui excepteur irure ad. Culpa commodo aliquip irure sunt do. Irure incididunt consequat reprehenderit ipsum mollit esse. Ex veniam nulla consequat deserunt fugiat est do in do sint sint ex.</p>
|
|
55
|
+
</section>
|
|
56
|
+
<kv-grid as="section" class="tw-grid-cols-2 tw-p-4 tw-gap-2" style="background-color: gray;">
|
|
57
|
+
<template
|
|
58
|
+
v-for="bgVariable in bgVariables"
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
|
|
62
|
+
class="tw-h-4"
|
|
63
|
+
:class="bgVariable"
|
|
64
|
+
>
|
|
65
|
+
{{bgVariable}}
|
|
66
|
+
</div>
|
|
67
|
+
<div
|
|
68
|
+
|
|
69
|
+
class="tw-h-4 tw-bg-opacity-low"
|
|
70
|
+
:class="bgVariable"
|
|
71
|
+
>
|
|
72
|
+
{{bgVariable}}
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
</kv-grid>
|
|
76
|
+
<kv-grid as="section" class="tw-grid-cols-2 tw-p-4 tw-gap-2">
|
|
77
|
+
<template
|
|
78
|
+
v-for="borderVariable in borderVariables"
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
class="tw-border-2 tw-h-4"
|
|
82
|
+
:class="borderVariable"
|
|
83
|
+
>
|
|
84
|
+
{{ borderVariable }}
|
|
85
|
+
</div>
|
|
86
|
+
<div
|
|
87
|
+
class="tw-border-2 tw-h-4 tw-border-opacity-low"
|
|
88
|
+
:class="borderVariable"
|
|
89
|
+
>
|
|
90
|
+
{{ borderVariable }}
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
</kv-grid>
|
|
94
|
+
<section>
|
|
95
|
+
<ul>
|
|
96
|
+
<li
|
|
97
|
+
v-for="variant in ['primary', 'secondary', 'link', 'danger', 'ghost']"
|
|
98
|
+
:key="variant"
|
|
99
|
+
class="tw-mb-2"
|
|
100
|
+
>
|
|
101
|
+
<kv-button :variant="variant">
|
|
102
|
+
Find a borrower
|
|
103
|
+
</kv-button>
|
|
104
|
+
</li>
|
|
105
|
+
</ul>
|
|
106
|
+
</section>
|
|
107
|
+
</div>
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
const Template = (args, {
|
|
111
|
+
argTypes,
|
|
112
|
+
}) => ({
|
|
113
|
+
props: Object.keys(argTypes),
|
|
114
|
+
components: {
|
|
115
|
+
KvButton,
|
|
116
|
+
KvGrid,
|
|
117
|
+
KvPageContainer,
|
|
118
|
+
KvTextLink,
|
|
119
|
+
KvThemeProvider,
|
|
120
|
+
},
|
|
121
|
+
data() {
|
|
122
|
+
return {
|
|
123
|
+
bgVariables: buildTailwindClasses('background'),
|
|
124
|
+
textVariables: buildTailwindClasses('text'),
|
|
125
|
+
borderVariables: buildTailwindClasses('border'),
|
|
126
|
+
defaultTheme,
|
|
127
|
+
darkTheme,
|
|
128
|
+
mintTheme,
|
|
129
|
+
darkMintTheme,
|
|
130
|
+
darkStoneTheme,
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
template: `
|
|
134
|
+
<kv-theme-provider :theme="theme">
|
|
135
|
+
${demoTemplate}
|
|
136
|
+
</kv-theme-provider>`,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const Default = Template.bind({});
|
|
140
|
+
|
|
141
|
+
export const Dark = Template.bind({});
|
|
142
|
+
Dark.args = {
|
|
143
|
+
theme: darkTheme,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Mint = Template.bind({});
|
|
147
|
+
Mint.args = {
|
|
148
|
+
theme: mintTheme,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const DarkGreen = Template.bind({});
|
|
152
|
+
DarkGreen.args = {
|
|
153
|
+
theme: darkGreenTheme,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const DarkMint = Template.bind({});
|
|
157
|
+
DarkMint.args = {
|
|
158
|
+
theme: darkMintTheme,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const Custom = Template.bind({});
|
|
162
|
+
Custom.args = {
|
|
163
|
+
theme: {
|
|
164
|
+
'--text-primary': '255, 0, 0',
|
|
165
|
+
'--text-secondary': '0, 255, 255',
|
|
166
|
+
'--text-action': '255, 255, 0',
|
|
167
|
+
'--text-action-highlight': '255, 200, 0',
|
|
168
|
+
'--bg-primary': '100, 199, 209',
|
|
169
|
+
'--bg-secondary': '191, 255, 191',
|
|
170
|
+
'--bg-action': '0, 0, 100',
|
|
171
|
+
'--bg-action-highlight': '0, 0, 150',
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const DarkStone = Template.bind({});
|
|
176
|
+
DarkStone.args = {
|
|
177
|
+
theme: darkStoneTheme,
|
|
178
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import KvButton from '../KvButton.vue';
|
|
2
|
+
import KvToast from '../KvToast.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'KvToast',
|
|
6
|
+
component: KvToast,
|
|
7
|
+
args: {
|
|
8
|
+
message: 'Successfully added to basket!',
|
|
9
|
+
persist: false,
|
|
10
|
+
type: 'confirmation',
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
message: {
|
|
14
|
+
control: {
|
|
15
|
+
type: 'text',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
type: {
|
|
19
|
+
options: ['confirmation', 'warning', 'error'],
|
|
20
|
+
control: {
|
|
21
|
+
type: 'select',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
persist: {
|
|
25
|
+
control: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
hideDelay: {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const Template = (args, {
|
|
38
|
+
argTypes,
|
|
39
|
+
}) => ({
|
|
40
|
+
props: Object.keys(argTypes),
|
|
41
|
+
components: {
|
|
42
|
+
KvToast,
|
|
43
|
+
KvButton,
|
|
44
|
+
},
|
|
45
|
+
template: `
|
|
46
|
+
<div>
|
|
47
|
+
<kv-button @click="showToast(message, type, persist, hideDelay)">Show Toast</kv-button>
|
|
48
|
+
|
|
49
|
+
<!-- div below is a kludge for storybook docs -->
|
|
50
|
+
<div class="tw-fixed tw-z-toast tw-inset-0 tw-pointer-events-none">
|
|
51
|
+
<div class="tw-fixed tw-left-0 tw-right-0 tw-top-2 tw-pointer-events-auto">
|
|
52
|
+
<kv-toast ref="toastRef" @close="onClose" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>`,
|
|
56
|
+
methods: {
|
|
57
|
+
showToast(messageInput, type, persistInput, hideDelay) {
|
|
58
|
+
this.$refs.toastRef.show(messageInput, type, persistInput, hideDelay);
|
|
59
|
+
},
|
|
60
|
+
onClose() {
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const typeConfirmation = Template.bind({});
|
|
66
|
+
typeConfirmation.args = { type: 'confirmation' };
|
|
67
|
+
|
|
68
|
+
export const typeWarning = Template.bind({});
|
|
69
|
+
typeWarning.args = { type: 'warning' };
|
|
70
|
+
|
|
71
|
+
export const typeError = Template.bind({});
|
|
72
|
+
typeError.args = { type: 'error' };
|
|
73
|
+
|
|
74
|
+
export const withLongTextAndHtml = Template.bind({});
|
|
75
|
+
withLongTextAndHtml.args = { message: 'This is a nice long content that could <b>live here</b> to show the spacing respect. This is a nice <a href="https://www.example.com">long content</a> that could live here to <i>show the spacing</i> respect.' };
|
|
76
|
+
|
|
77
|
+
export const persist = Template.bind({});
|
|
78
|
+
persist.args = { persist: true };
|
|
79
|
+
|
|
80
|
+
export const hideDelay = Template.bind({});
|
|
81
|
+
hideDelay.args = { hideDelay: 10000 };
|
|
82
|
+
|
|
83
|
+
const KivaLogoTemplate = (args, {
|
|
84
|
+
argTypes,
|
|
85
|
+
}) => ({
|
|
86
|
+
props: Object.keys(argTypes),
|
|
87
|
+
components: {
|
|
88
|
+
KvToast,
|
|
89
|
+
KvButton,
|
|
90
|
+
},
|
|
91
|
+
template: `
|
|
92
|
+
<div>
|
|
93
|
+
<kv-button @click="showToast(message, type, persist)">Show Toast</kv-button>
|
|
94
|
+
|
|
95
|
+
<!-- div below is a kludge for storybook docs -->
|
|
96
|
+
<div class="tw-fixed tw-z-toast tw-inset-0 tw-pointer-events-none">
|
|
97
|
+
<div class="tw-fixed tw-left-0 tw-right-0 tw-top-2 tw-pointer-events-auto">
|
|
98
|
+
<kv-toast ref="toastRef" @close="onClose">
|
|
99
|
+
<template #toastContent>
|
|
100
|
+
<div>
|
|
101
|
+
Welcome to Lending home! We’re doing something new based on your feedback this year. <button class="tw-text-action">Read more here</button>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
</kv-toast>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>`,
|
|
108
|
+
methods: {
|
|
109
|
+
showToast(messageInput, type, persistInput) {
|
|
110
|
+
this.$refs.toastRef.show(messageInput, type, persistInput);
|
|
111
|
+
},
|
|
112
|
+
onClose() {
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
export const typeKivaLogo = KivaLogoTemplate.bind({});
|
|
117
|
+
typeKivaLogo.args = { type: 'kiva-logo', message: '' };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import KvTooltip from '../KvTooltip.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvTooltip',
|
|
5
|
+
component: KvTooltip,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Default = () => ({
|
|
9
|
+
components: {
|
|
10
|
+
KvTooltip,
|
|
11
|
+
},
|
|
12
|
+
template: `
|
|
13
|
+
<div>
|
|
14
|
+
<button id="my-cool-btn">Hover of Focus Me!</button>
|
|
15
|
+
<kv-tooltip controller="my-cool-btn">
|
|
16
|
+
<template #title>
|
|
17
|
+
What is an Experimental Field Partner?
|
|
18
|
+
</template>
|
|
19
|
+
If a Field Partner is labeled as Experimental, this means that Kiva has
|
|
20
|
+
required only a comparatively light level of due diligence and
|
|
21
|
+
monitoring, in exchange for only allowing this Field Partner access to a
|
|
22
|
+
small amount of funding through Kiva at any given time.
|
|
23
|
+
</kv-tooltip>
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import KvTreeMapChart from '../KvTreeMapChart.vue';
|
|
2
|
+
|
|
3
|
+
const genderValues = [{ label: 'Female', value: 1243, percent: 0.6467221644120708 }, { label: 'Male', value: 676, percent: 0.3517169614984391 }, { label: 'Unspecified', value: 2, percent: 0.001040582726326743 }, { label: 'Nonbinary', value: 1, percent: 0.0005202913631633715 }];
|
|
4
|
+
const sectorValues = [{ label: 'Food', value: 575, percent: 0.2991675338189386 }, { label: 'Retail', value: 377, percent: 0.19614984391259105 }, { label: 'Agriculture', value: 285, percent: 0.14828303850156088 }, { label: 'Services', value: 211, percent: 0.10978147762747138 }, { label: 'Clothing', value: 183, percent: 0.09521331945889698 }, { label: 'Arts', value: 65, percent: 0.033818938605619145 }, { label: 'Housing', value: 65, percent: 0.033818938605619145 }, { label: 'Education', value: 36, percent: 0.018730489073881373 }, { label: 'Construction', value: 28, percent: 0.014568158168574402 }, { label: 'Health', value: 27, percent: 0.01404786680541103 }, { label: 'Transportation', value: 23, percent: 0.011966701352757543 }, { label: 'Personal Use', value: 19, percent: 0.009885535900104058 }, { label: 'Manufacturing', value: 13, percent: 0.006763787721123829 }, { label: 'Entertainment', value: 10, percent: 0.005202913631633715 }, { label: 'Wholesale', value: 5, percent: 0.0026014568158168575 }];
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Charts/KvTreeMapChart',
|
|
8
|
+
component: KvTreeMapChart,
|
|
9
|
+
args: {
|
|
10
|
+
loading: false,
|
|
11
|
+
values: genderValues,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args, {
|
|
16
|
+
argTypes,
|
|
17
|
+
}) => ({
|
|
18
|
+
props: Object.keys(argTypes),
|
|
19
|
+
components: {
|
|
20
|
+
KvTreeMapChart,
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<div>
|
|
24
|
+
<kv-tree-map-chart
|
|
25
|
+
:values="values"
|
|
26
|
+
:loading="loading"
|
|
27
|
+
/>
|
|
28
|
+
</div>`,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const Default = Template.bind({});
|
|
32
|
+
|
|
33
|
+
export const Loading = Template.bind({});
|
|
34
|
+
Loading.args = {
|
|
35
|
+
loading: true,
|
|
36
|
+
values: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const ManyValues = Template.bind({});
|
|
40
|
+
ManyValues.args = {
|
|
41
|
+
values: sectorValues,
|
|
42
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import KvUserAvatar from '../KvUserAvatar.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvUserAvatar',
|
|
5
|
+
component: KvUserAvatar,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const story = (args) => {
|
|
9
|
+
const template = (templateArgs, { argTypes }) => ({
|
|
10
|
+
props: Object.keys(argTypes),
|
|
11
|
+
components: { KvUserAvatar },
|
|
12
|
+
setup() { return { args: templateArgs }; },
|
|
13
|
+
template: `
|
|
14
|
+
<KvUserAvatar v-bind="args" />
|
|
15
|
+
`,
|
|
16
|
+
});
|
|
17
|
+
template.args = args;
|
|
18
|
+
return template;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Default = story({
|
|
22
|
+
lenderImageUrl: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
|
|
23
|
+
lenderName: 'Roger',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const NoImage = story({
|
|
27
|
+
lenderImageUrl: '',
|
|
28
|
+
lenderName: 'Roger',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const Anonymous = story({
|
|
32
|
+
lenderImageUrl: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
|
|
33
|
+
lenderName: 'Anonymous',
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const DefaultProfile = story({
|
|
37
|
+
lenderImageUrl: 'https://www.development.kiva.org/img/s100/4d844ac2c0b77a8a522741b908ea5c32.jpg',
|
|
38
|
+
lenderName: 'Default Profile',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const IsSmall = story({
|
|
42
|
+
lenderImageUrl: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
|
|
43
|
+
lenderName: 'Roger',
|
|
44
|
+
isSmall: true,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Fallback = story();
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import KvVerticalCarousel from '../KvVerticalCarousel.vue';
|
|
2
|
+
import KvButton from '../KvButton.vue';
|
|
3
|
+
|
|
4
|
+
const randomHexColor = (index) => {
|
|
5
|
+
const defaultColor = '96d4b3';
|
|
6
|
+
const colorArray = [
|
|
7
|
+
'D5573B',
|
|
8
|
+
'885053',
|
|
9
|
+
'777DA7',
|
|
10
|
+
'94C9A9',
|
|
11
|
+
'C6ECAE',
|
|
12
|
+
'C490D1',
|
|
13
|
+
'A0D2DB',
|
|
14
|
+
'7D8CC4',
|
|
15
|
+
'726DA8',
|
|
16
|
+
];
|
|
17
|
+
return colorArray?.[index] || defaultColor;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// This is not an actual loan card template, just a vague
|
|
21
|
+
// approximation to make testing in the stories nicer
|
|
22
|
+
const generateLoanCardTemplate = (index) => {
|
|
23
|
+
const amounts = [
|
|
24
|
+
'100',
|
|
25
|
+
'2,255',
|
|
26
|
+
'50',
|
|
27
|
+
'41,900',
|
|
28
|
+
];
|
|
29
|
+
const cardCopy = [
|
|
30
|
+
'A loan of $5,450 helps a member to buy flour, eggs, lard, sugar, sweets and other...',
|
|
31
|
+
'A loan of $1,125 helps to face the financial problem of covering tuition fees.',
|
|
32
|
+
'A loan of $450 helps to purchase store goods for resale.',
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
return `
|
|
36
|
+
<div style="width: 336px">
|
|
37
|
+
<img src="https://placehold.co/336x252/${randomHexColor(index)}/000000" class="tw-w-full tw-rounded tw-mb-2">
|
|
38
|
+
<h3>Card Title</h3>
|
|
39
|
+
<h4 class="tw-my-1">$${amounts?.[index] || amounts?.[1]} to go</h4>
|
|
40
|
+
<p class="tw-mt-1 tw-mb-9">${cardCopy?.[index] || cardCopy?.[1]}</p>
|
|
41
|
+
<kv-button
|
|
42
|
+
variant="primary"
|
|
43
|
+
>
|
|
44
|
+
Read more
|
|
45
|
+
</kv-button>
|
|
46
|
+
</div>`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const defaultCarouselSlides = `
|
|
50
|
+
<template #slide1>
|
|
51
|
+
<img src="https://placehold.co/400x150/${randomHexColor(1)}/000000">
|
|
52
|
+
</template>
|
|
53
|
+
<template #slide2>
|
|
54
|
+
<img src="https://placehold.co/400x150/${randomHexColor(2)}/000000">
|
|
55
|
+
</template>
|
|
56
|
+
<template #slide3>
|
|
57
|
+
<img src="https://placehold.co/400x150/${randomHexColor(3)}/000000">
|
|
58
|
+
</template>
|
|
59
|
+
<template #slide4>
|
|
60
|
+
<img src="https://placehold.co/400x150/${randomHexColor(4)}/000000">
|
|
61
|
+
</template>
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
title: 'KvVerticalCarousel',
|
|
66
|
+
component: KvVerticalCarousel,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Default = () => ({
|
|
70
|
+
components: {
|
|
71
|
+
KvVerticalCarousel,
|
|
72
|
+
},
|
|
73
|
+
template: `
|
|
74
|
+
<div style="width: 400px;">
|
|
75
|
+
<kv-vertical-carousel height-style="310px" class="tw-w-full">
|
|
76
|
+
${defaultCarouselSlides}
|
|
77
|
+
</kv-vertical-carousel>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const LoopFalse = () => ({
|
|
83
|
+
components: {
|
|
84
|
+
KvVerticalCarousel,
|
|
85
|
+
},
|
|
86
|
+
template: `
|
|
87
|
+
<div style="width: 400px;">
|
|
88
|
+
<kv-vertical-carousel height-style="400px" class="tw-w-full">
|
|
89
|
+
${defaultCarouselSlides}
|
|
90
|
+
</kv-vertical-carousel>
|
|
91
|
+
</div>
|
|
92
|
+
`,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const MultipleLoanCards = () => ({
|
|
96
|
+
components: {
|
|
97
|
+
KvVerticalCarousel,
|
|
98
|
+
KvButton,
|
|
99
|
+
},
|
|
100
|
+
template: `
|
|
101
|
+
<kv-vertical-carousel
|
|
102
|
+
:embla-options="{ loop: false }"
|
|
103
|
+
:multiple-slides-visible="true"
|
|
104
|
+
style="max-width: 600px;"
|
|
105
|
+
height-style="510px"
|
|
106
|
+
class="tw-w-full"
|
|
107
|
+
>
|
|
108
|
+
<template #slide1>
|
|
109
|
+
${generateLoanCardTemplate(1)}
|
|
110
|
+
</template>
|
|
111
|
+
<template #slide2>
|
|
112
|
+
${generateLoanCardTemplate(2)}
|
|
113
|
+
</template>
|
|
114
|
+
<template #slide3>
|
|
115
|
+
${generateLoanCardTemplate(3)}
|
|
116
|
+
</template>
|
|
117
|
+
<template #slide4>
|
|
118
|
+
${generateLoanCardTemplate(4)}
|
|
119
|
+
</template>
|
|
120
|
+
<template #slide5>
|
|
121
|
+
${generateLoanCardTemplate(5)}
|
|
122
|
+
</template>
|
|
123
|
+
</kv-vertical-carousel>
|
|
124
|
+
`,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const CustomStartIndex = () => ({
|
|
128
|
+
components: {
|
|
129
|
+
KvVerticalCarousel,
|
|
130
|
+
KvButton,
|
|
131
|
+
},
|
|
132
|
+
template: `
|
|
133
|
+
<kv-vertical-carousel
|
|
134
|
+
:embla-options="{ loop: false, align: 'center', startIndex: 1 }"
|
|
135
|
+
:multiple-slides-visible="true"
|
|
136
|
+
slides-to-scroll="visible"
|
|
137
|
+
style="max-width: 1072px;"
|
|
138
|
+
>
|
|
139
|
+
<template #slide1>
|
|
140
|
+
${generateLoanCardTemplate(1)}
|
|
141
|
+
</template>
|
|
142
|
+
<template #slide2>
|
|
143
|
+
${generateLoanCardTemplate(2)}
|
|
144
|
+
</template>
|
|
145
|
+
<template #slide3>
|
|
146
|
+
${generateLoanCardTemplate(3)}
|
|
147
|
+
</template>
|
|
148
|
+
<template #slide4>
|
|
149
|
+
${generateLoanCardTemplate(4)}
|
|
150
|
+
</template>
|
|
151
|
+
<template #slide5>
|
|
152
|
+
${generateLoanCardTemplate(5)}
|
|
153
|
+
</template>
|
|
154
|
+
<template #slide6>
|
|
155
|
+
${generateLoanCardTemplate(6)}
|
|
156
|
+
</template>
|
|
157
|
+
<template #slide7>
|
|
158
|
+
${generateLoanCardTemplate(7)}
|
|
159
|
+
</template>
|
|
160
|
+
<template #slide8>
|
|
161
|
+
${generateLoanCardTemplate(8)}
|
|
162
|
+
</template>
|
|
163
|
+
<template #slide9>
|
|
164
|
+
${generateLoanCardTemplate(9)}
|
|
165
|
+
</template>
|
|
166
|
+
</kv-vertical-carousel>
|
|
167
|
+
`,
|
|
168
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import KvVotingCard from '../KvVotingCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvVotingCard',
|
|
5
|
+
component: KvVotingCard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => ({
|
|
9
|
+
components: { KvVotingCard },
|
|
10
|
+
setup() {
|
|
11
|
+
return { args };
|
|
12
|
+
},
|
|
13
|
+
template: `
|
|
14
|
+
<kv-voting-card v-bind="args">
|
|
15
|
+
<template #image>
|
|
16
|
+
<img
|
|
17
|
+
class="tw-rounded"
|
|
18
|
+
src="https://www-kiva-org.freetls.fastly.net/img/w600h450/9673d0722a7675b9b8d11f90849d9b44.jpg"
|
|
19
|
+
alt="Default image"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
</kv-voting-card>
|
|
23
|
+
`,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const Default = Template.bind({});
|
|
27
|
+
Default.args = {
|
|
28
|
+
borrowerName: 'Jacqueline',
|
|
29
|
+
category: 'Helping households mitigate or adapt to climate change',
|
|
30
|
+
percentage: 45,
|
|
31
|
+
showVoteButton: true,
|
|
32
|
+
showInfoIcon: true,
|
|
33
|
+
};
|