@kiva/kv-components 3.107.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.
Files changed (177) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/.storybook/main.js +85 -0
  3. package/dist/components/.storybook/package.json +3 -0
  4. package/dist/components/.storybook/preview.js +61 -0
  5. package/dist/components/.storybook/tailwind.css +5 -0
  6. package/dist/components/KvAccordionItem.vue +130 -0
  7. package/dist/components/KvActivityRow.vue +33 -0
  8. package/dist/components/KvBorrowerImage.vue +179 -0
  9. package/dist/components/KvButton.vue +287 -0
  10. package/dist/components/KvCarousel.vue +297 -0
  11. package/dist/components/KvCartModal.vue +365 -0
  12. package/dist/components/KvCheckbox.vue +203 -0
  13. package/dist/components/KvChip.vue +54 -0
  14. package/dist/components/KvClassicLoanCard.vue +527 -0
  15. package/dist/components/KvCommentsAdd.vue +135 -0
  16. package/dist/components/KvCommentsContainer.vue +84 -0
  17. package/dist/components/KvCommentsHeartButton.vue +70 -0
  18. package/dist/components/KvCommentsList.vue +68 -0
  19. package/dist/components/KvCommentsListItem.vue +241 -0
  20. package/dist/components/KvCommentsReplyButton.vue +52 -0
  21. package/dist/components/KvContentfulImg.vue +273 -0
  22. package/dist/components/KvCountdownTimer.vue +59 -0
  23. package/dist/components/KvExpandable.vue +84 -0
  24. package/dist/components/KvExpandableQuestion.vue +120 -0
  25. package/dist/components/KvFlag.vue +120 -0
  26. package/dist/components/KvGrid.vue +28 -0
  27. package/dist/components/KvImpactDashboardHeader.vue +40 -0
  28. package/dist/components/KvInlineActivityCard.vue +55 -0
  29. package/dist/components/KvInlineActivityFeed.vue +38 -0
  30. package/dist/components/KvIntroductionLoanCard.vue +446 -0
  31. package/dist/components/KvLendAmountButton.vue +65 -0
  32. package/dist/components/KvLendCta.vue +451 -0
  33. package/dist/components/KvLightbox.vue +334 -0
  34. package/dist/components/KvLineGraph.vue +128 -0
  35. package/dist/components/KvLoadingPlaceholder.vue +38 -0
  36. package/dist/components/KvLoadingSpinner.vue +81 -0
  37. package/dist/components/KvLoanActivities.vue +268 -0
  38. package/dist/components/KvLoanBookmark.vue +39 -0
  39. package/dist/components/KvLoanCallouts.vue +53 -0
  40. package/dist/components/KvLoanProgressGroup.vue +76 -0
  41. package/dist/components/KvLoanTag.vue +88 -0
  42. package/dist/components/KvLoanTeamPick.vue +44 -0
  43. package/dist/components/KvLoanUse.vue +92 -0
  44. package/dist/components/KvMap.vue +599 -0
  45. package/dist/components/KvMaterialIcon.vue +47 -0
  46. package/dist/components/KvPageContainer.vue +15 -0
  47. package/dist/components/KvPagination.vue +198 -0
  48. package/dist/components/KvPieChart.vue +257 -0
  49. package/dist/components/KvPopper.vue +178 -0
  50. package/dist/components/KvProgressBar.vue +149 -0
  51. package/dist/components/KvRadio.vue +198 -0
  52. package/dist/components/KvSelect.vue +114 -0
  53. package/dist/components/KvSideSheet.vue +134 -0
  54. package/dist/components/KvSwitch.vue +143 -0
  55. package/dist/components/KvTab.vue +90 -0
  56. package/dist/components/KvTabPanel.vue +64 -0
  57. package/dist/components/KvTabs.vue +182 -0
  58. package/dist/components/KvTextInput.vue +247 -0
  59. package/dist/components/KvTextLink.vue +138 -0
  60. package/dist/components/KvThemeProvider.vue +122 -0
  61. package/dist/components/KvToast.vue +221 -0
  62. package/dist/components/KvTooltip.vue +168 -0
  63. package/dist/components/KvTreeMapChart.vue +229 -0
  64. package/dist/components/KvUserAvatar.vue +132 -0
  65. package/dist/components/KvVerticalCarousel.vue +156 -0
  66. package/dist/components/KvVotingCard.vue +160 -0
  67. package/dist/components/KvVotingCardV2.vue +154 -0
  68. package/dist/components/KvWideLoanCard.vue +432 -0
  69. package/dist/components/stories/Forms.stories.js +62 -0
  70. package/dist/components/stories/KvAccordionItem.stories.js +24 -0
  71. package/dist/components/stories/KvActivityRow.stories.js +25 -0
  72. package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
  73. package/dist/components/stories/KvButton.stories.js +144 -0
  74. package/dist/components/stories/KvCarousel.stories.js +426 -0
  75. package/dist/components/stories/KvCartModal.stories.js +54 -0
  76. package/dist/components/stories/KvCheckbox.stories.js +163 -0
  77. package/dist/components/stories/KvChip.stories.js +43 -0
  78. package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
  79. package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
  80. package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
  81. package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
  82. package/dist/components/stories/KvCommentsList.stories.js +39 -0
  83. package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
  84. package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
  85. package/dist/components/stories/KvContentfulImg.stories.js +196 -0
  86. package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
  87. package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
  88. package/dist/components/stories/KvFlag.stories.js +36 -0
  89. package/dist/components/stories/KvGrid.stories.js +97 -0
  90. package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
  91. package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
  92. package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
  93. package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
  94. package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
  95. package/dist/components/stories/KvLendCta.stories.js +177 -0
  96. package/dist/components/stories/KvLightbox.stories.js +304 -0
  97. package/dist/components/stories/KvLineGraph.stories.js +52 -0
  98. package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
  99. package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
  100. package/dist/components/stories/KvLoanActivities.stories.js +104 -0
  101. package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
  102. package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
  103. package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
  104. package/dist/components/stories/KvLoanTag.stories.js +61 -0
  105. package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
  106. package/dist/components/stories/KvLoanUse.stories.js +60 -0
  107. package/dist/components/stories/KvMap.stories.js +121 -0
  108. package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
  109. package/dist/components/stories/KvPageContainer.stories.js +50 -0
  110. package/dist/components/stories/KvPagination.stories.js +70 -0
  111. package/dist/components/stories/KvPieChart.stories.js +47 -0
  112. package/dist/components/stories/KvProgressBar.stories.js +53 -0
  113. package/dist/components/stories/KvRadio.stories.js +140 -0
  114. package/dist/components/stories/KvSelect.stories.js +125 -0
  115. package/dist/components/stories/KvSideSheet.stories.js +50 -0
  116. package/dist/components/stories/KvSwitch.stories.js +66 -0
  117. package/dist/components/stories/KvTabs.stories.js +106 -0
  118. package/dist/components/stories/KvTextInput.stories.js +194 -0
  119. package/dist/components/stories/KvTextLink.stories.js +55 -0
  120. package/dist/components/stories/KvThemeProvider.stories.js +178 -0
  121. package/dist/components/stories/KvToast.stories.js +117 -0
  122. package/dist/components/stories/KvTooltip.stories.js +26 -0
  123. package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
  124. package/dist/components/stories/KvUserAvatar.stories.js +47 -0
  125. package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
  126. package/dist/components/stories/KvVotingCard.stories.js +33 -0
  127. package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
  128. package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
  129. package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
  130. package/dist/components/stories/StyleguideProse.stories.js +215 -0
  131. package/dist/data/countries-borders.json +1 -0
  132. package/dist/data/ne_110m_admin_0_countries.json +1 -0
  133. package/dist/utils/Alea.js +9 -0
  134. package/dist/utils/attrs.js +7 -0
  135. package/dist/utils/carousels.js +8 -0
  136. package/dist/{attrs.js → utils/chunk-3HK4G4NT.js} +1 -0
  137. package/dist/{loanCard.js → utils/chunk-55HF2ORX.js} +1 -0
  138. package/dist/{expander.js → utils/chunk-AY3PR5S4.js} +3 -2
  139. package/dist/{carousels.js → utils/chunk-AZPWOFD5.js} +1 -0
  140. package/dist/{printing.js → utils/chunk-B5J5WLAH.js} +1 -0
  141. package/dist/{Alea.js → utils/chunk-GPSH6OPA.js} +2 -1
  142. package/dist/{scrollLock.js → utils/chunk-HIY5IW65.js} +2 -1
  143. package/dist/{treemap.js → utils/chunk-MSMZIN54.js} +1 -0
  144. package/dist/{imageUtils.js → utils/chunk-OXJCCNNW.js} +1 -0
  145. package/dist/{touchEvents.js → utils/chunk-S3MABILA.js} +3 -2
  146. package/dist/{mapUtils.js → utils/chunk-VIGEMAKO.js} +5 -4
  147. package/dist/utils/chunk-YCNMJ4YV.js +37 -0
  148. package/dist/{loanUtils.js → utils/chunk-YFEC5ODJ.js} +7 -6
  149. package/dist/utils/expander.js +9 -0
  150. package/dist/utils/imageUtils.js +9 -0
  151. package/dist/utils/index.cjs +1118 -0
  152. package/dist/utils/index.js +166 -0
  153. package/dist/utils/loanCard.js +9 -0
  154. package/dist/utils/loanUtils.js +23 -0
  155. package/dist/utils/mapUtils.js +15 -0
  156. package/dist/utils/printing.js +9 -0
  157. package/dist/utils/scrollLock.js +13 -0
  158. package/dist/{throttle.js → utils/throttle.js} +1 -0
  159. package/dist/utils/touchEvents.js +11 -0
  160. package/dist/utils/treemap.js +7 -0
  161. package/package.json +7 -7
  162. package/utils/index.js +14 -0
  163. package/index.js +0 -3
  164. /package/dist/{Alea.cjs → utils/Alea.cjs} +0 -0
  165. /package/dist/{attrs.cjs → utils/attrs.cjs} +0 -0
  166. /package/dist/{carousels.cjs → utils/carousels.cjs} +0 -0
  167. /package/dist/{chunk-HV3AUBFT.js → utils/chunk-HV3AUBFT.js} +0 -0
  168. /package/dist/{expander.cjs → utils/expander.cjs} +0 -0
  169. /package/dist/{imageUtils.cjs → utils/imageUtils.cjs} +0 -0
  170. /package/dist/{loanCard.cjs → utils/loanCard.cjs} +0 -0
  171. /package/dist/{loanUtils.cjs → utils/loanUtils.cjs} +0 -0
  172. /package/dist/{mapUtils.cjs → utils/mapUtils.cjs} +0 -0
  173. /package/dist/{printing.cjs → utils/printing.cjs} +0 -0
  174. /package/dist/{scrollLock.cjs → utils/scrollLock.cjs} +0 -0
  175. /package/dist/{throttle.cjs → utils/throttle.cjs} +0 -0
  176. /package/dist/{touchEvents.cjs → utils/touchEvents.cjs} +0 -0
  177. /package/dist/{treemap.cjs → utils/treemap.cjs} +0 -0
@@ -0,0 +1,60 @@
1
+ import KvLoanUse from '../KvLoanUse.vue';
2
+
3
+ export default {
4
+ title: 'KvLoanUse',
5
+ component: KvLoanUse,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (_args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvLoanUse },
12
+ template: `
13
+ <kv-loan-use
14
+ :anonymization-level="anonymizationLevel"
15
+ :use="use"
16
+ :loan-amount="loanAmount"
17
+ :status="status"
18
+ :borrower-count="borrowerCount"
19
+ :name="name"
20
+ :distribution-model="distributionModel"
21
+ :why-special="whySpecial"
22
+ />
23
+ `,
24
+ });
25
+ template.args = args;
26
+ return template;
27
+ };
28
+
29
+ export const Anonymous = story({ anonymizationLevel: 'full' });
30
+
31
+ export const Partner = story({
32
+ use: 'buy supplies.',
33
+ loanAmount: '1000.00',
34
+ status: 'fundraising',
35
+ name: 'Bob Smith',
36
+ distributionModel: 'partner',
37
+ });
38
+
39
+ export const Direct = story({
40
+ use: 'buy supplies.',
41
+ loanAmount: '1000.00',
42
+ status: 'fundraising',
43
+ name: 'Bob Smith',
44
+ });
45
+
46
+ export const Group = story({
47
+ use: 'buy supplies.',
48
+ loanAmount: '1000.00',
49
+ status: 'fundraising',
50
+ name: 'Farm Organization',
51
+ borrowerCount: 2,
52
+ });
53
+
54
+ export const WhySpecial = story({
55
+ use: 'buy supplies.',
56
+ loanAmount: '1000.00',
57
+ status: 'fundraising',
58
+ name: 'Bob Smith',
59
+ whySpecial: 'It supports organic farming and includes a lower interest rate.',
60
+ });
@@ -0,0 +1,121 @@
1
+ import mockLenderCountries from '../../tests/fixtures/mockLenderCountries';
2
+ import KvMap from '../KvMap.vue';
3
+
4
+ export default {
5
+ title: 'KvMap',
6
+ component: KvMap,
7
+ args: {
8
+ autoZoomDelay: 1000,
9
+ height: null,
10
+ initialZoom: null,
11
+ lat: 37.700091,
12
+ long: -123.013243,
13
+ mapId: 0,
14
+ useLeaflet: false,
15
+ width: null,
16
+ zoomLevel: 4,
17
+ advancedAnimation: {},
18
+ },
19
+ };
20
+
21
+ const Template = (args, { argTypes }) => ({
22
+ props: Object.keys(argTypes),
23
+ components: { KvMap },
24
+ template: `<kv-map
25
+ class="tw-rounded tw-overflow-hidden"
26
+ :auto-zoom-delay="autoZoomDelay"
27
+ :height="height"
28
+ :lat="lat"
29
+ :long="long"
30
+ :initial-zoom="initialZoom"
31
+ :map-id="mapId"
32
+ :use-leaflet="useLeaflet"
33
+ :width="width"
34
+ :zoom-level="zoomLevel"
35
+ :advanced-animation="advancedAnimation"
36
+ :show-zoom-control="showZoomControl"
37
+ :allow-dragging="allowDragging"
38
+ :show-labels="showLabels"
39
+ :countries-data="countriesData"
40
+ :show-fundraising-loans="showFundraisingLoans"
41
+ />`,
42
+ });
43
+
44
+ export const Default = Template.bind({});
45
+ Default.args = {
46
+ initialZoom: null,
47
+ mapId: 1,
48
+ zoomLevel: 14,
49
+ };
50
+
51
+ export const AutoZoom = Template.bind({});
52
+ AutoZoom.args = {
53
+ initialZoom: 1,
54
+ lat: -0.023559,
55
+ long: 37.906193,
56
+ mapId: 2,
57
+ zoomLevel: 4,
58
+ };
59
+
60
+ export const FixedDimensions = Template.bind({});
61
+ FixedDimensions.args = {
62
+ initialZoom: null,
63
+ height: 250,
64
+ mapId: 3,
65
+ width: 250,
66
+ zoomLevel: 14,
67
+ };
68
+
69
+ export const Leaflet = Template.bind({});
70
+ Leaflet.args = {
71
+ initialZoom: null,
72
+ lat: -0.023559,
73
+ long: 37.906193,
74
+ mapId: 4,
75
+ useLeaflet: true,
76
+ zoomLevel: 6,
77
+ };
78
+
79
+ export const AdvancedAnimation = Template.bind({});
80
+ const advancedAnimation = {
81
+ borrowerPoints: [
82
+ {
83
+ image: 'https://www-kiva-org.freetls.fastly.net/img/w80h80fz50/e60a3d61ff052d60991c5d6bbf4a45d3.jpg',
84
+ location: [-77.032, 38.913],
85
+ },
86
+ {
87
+ image: 'https://www-kiva-org.freetls.fastly.net/img/w80h80fz50/6101929097c6e5de48232a4d1ae3b71c.jpg',
88
+ location: [41.402, 7.160],
89
+ },
90
+ {
91
+ image: 'https://www-kiva-org.freetls.fastly.net/img/w80h80fz50/11e018ee3d8b9c5adee459c16a29d264.jpg',
92
+ location: [-73.356596, 3.501],
93
+ },
94
+ ],
95
+ };
96
+ AdvancedAnimation.args = {
97
+ initialZoom: null,
98
+ mapId: 5,
99
+ useLeaflet: false,
100
+ zoomLevel: 2,
101
+ height: 600,
102
+ width: 1000,
103
+ lat: 21.096,
104
+ long: -31.690,
105
+ advancedAnimation,
106
+ };
107
+
108
+ export const LoansMap = Template.bind({});
109
+ LoansMap.args = {
110
+ autoZoomDelay: 500,
111
+ aspectRatio: 1.8,
112
+ lat: 30,
113
+ long: 1,
114
+ zoomLevel: 2,
115
+ useLeaflet: true,
116
+ showZoomControl: true,
117
+ allowDragging: true,
118
+ showLabels: false,
119
+ countriesData: mockLenderCountries,
120
+ showFundraisingLoans: true,
121
+ };
@@ -0,0 +1,201 @@
1
+ import {
2
+ mdiAlertCircleOutline,
3
+ mdiArrowDown,
4
+ mdiArrowBottomLeft,
5
+ mdiArrowLeft,
6
+ mdiArrowTopLeft,
7
+ mdiArrowUp,
8
+ mdiArrowTopRight,
9
+ mdiArrowRight,
10
+ mdiArrowBottomRight,
11
+ mdiCart,
12
+ mdiCheck,
13
+ mdiChevronLeft,
14
+ mdiChevronRight,
15
+ mdiChevronDown,
16
+ mdiChevronUp,
17
+ mdiClose,
18
+ mdiMagnify,
19
+ mdiStar,
20
+ mdiStarOutline,
21
+ } from '@mdi/js';
22
+
23
+ import KvMaterialIcon from '../KvMaterialIcon.vue';
24
+
25
+ export default {
26
+ title: 'KvMaterialIcon',
27
+ component: KvMaterialIcon,
28
+ argTypes: {
29
+ icon: {
30
+ control: {
31
+ disable: true,
32
+ },
33
+ },
34
+ },
35
+ };
36
+
37
+ const DefaultTemplate = (args, { argTypes }) => ({
38
+ props: Object.keys(argTypes),
39
+ components: { KvMaterialIcon },
40
+ template: `
41
+ <kv-material-icon
42
+ :icon="icon"
43
+ />`,
44
+ });
45
+
46
+ export const Default = DefaultTemplate.bind({});
47
+ Default.args = {
48
+ icon: mdiCart,
49
+ };
50
+
51
+ export const Common = (args, { argTypes }) => ({
52
+ props: Object.keys(argTypes),
53
+ components: { KvMaterialIcon },
54
+ template: `
55
+ <div class="tw-flex tw-gap-1">
56
+ <kv-material-icon
57
+ v-for="(icon, i) in [
58
+ mdiAlertCircleOutline,
59
+ mdiArrowDown,
60
+ mdiArrowBottomLeft,
61
+ mdiArrowLeft,
62
+ mdiArrowTopLeft,
63
+ mdiArrowUp,
64
+ mdiArrowTopRight,
65
+ mdiArrowRight,
66
+ mdiArrowBottomRight,
67
+ mdiChevronLeft,
68
+ mdiChevronRight,
69
+ mdiChevronDown,
70
+ mdiChevronUp,
71
+ mdiClose,
72
+ mdiMagnify,
73
+ ]"
74
+ :key="i"
75
+ :icon="icon"
76
+ />
77
+ </div>
78
+ `,
79
+ data() {
80
+ return {
81
+ mdiAlertCircleOutline,
82
+ mdiArrowDown,
83
+ mdiArrowBottomLeft,
84
+ mdiArrowLeft,
85
+ mdiArrowTopLeft,
86
+ mdiArrowUp,
87
+ mdiArrowTopRight,
88
+ mdiArrowRight,
89
+ mdiArrowBottomRight,
90
+ mdiChevronLeft,
91
+ mdiChevronRight,
92
+ mdiChevronDown,
93
+ mdiChevronUp,
94
+ mdiClose,
95
+ mdiMagnify,
96
+ };
97
+ },
98
+ });
99
+
100
+ export const Colored = (args, { argTypes }) => ({
101
+ props: Object.keys(argTypes),
102
+ components: { KvMaterialIcon },
103
+ template: `
104
+ <div>
105
+ <p class="tw-mb-2">Use text-color to set the icon color</p>
106
+ <kv-material-icon
107
+ :icon="mdiCheck"
108
+ class="tw-text-action"
109
+ />
110
+ <kv-material-icon
111
+ :icon="mdiAlertCircleOutline"
112
+ class="tw-text-danger"
113
+ />
114
+ </div>`,
115
+ data() {
116
+ return {
117
+ mdiAlertCircleOutline,
118
+ mdiCheck,
119
+ };
120
+ },
121
+ });
122
+
123
+ export const InlineWithText = (args, { argTypes }) => ({
124
+ props: Object.keys(argTypes),
125
+ components: { KvMaterialIcon },
126
+ template: `
127
+ <a href="#" class="tw-inline-flex">
128
+ <span class="tw-text-h4">He went thataway</span>
129
+ <kv-material-icon class="tw-w-2.5" :icon="mdiChevronRight" />
130
+ </a>`,
131
+ data() {
132
+ return {
133
+ mdiChevronRight,
134
+ };
135
+ },
136
+ });
137
+
138
+ export const Sizing = (args, { argTypes }) => ({
139
+ props: Object.keys(argTypes),
140
+ components: { KvMaterialIcon },
141
+ template: `
142
+ <div>
143
+ <p class="tw-mb-2">Icons can be sized using any of the standard sizing classes (.tw-w-2, .tw-w-3, .tw-w-full, etc.). By default they are 24 x 24 (.tw-w-3).</p>
144
+ <kv-material-icon class="tw-bg-secondary tw-w-2" :icon="mdiChevronRight" />
145
+ <kv-material-icon class="tw-bg-secondary tw-w-4" :icon="mdiChevronRight" />
146
+ <kv-material-icon class="tw-bg-secondary tw-w-8" :icon="mdiChevronRight" />
147
+ <kv-material-icon class="tw-bg-secondary tw-w-16" :icon="mdiChevronRight" />
148
+ </div>`,
149
+ data() {
150
+ return {
151
+ mdiChevronRight,
152
+ };
153
+ },
154
+ });
155
+
156
+ export const WithAccessibleText = (args, { argTypes }) => ({
157
+ props: Object.keys(argTypes),
158
+ components: { KvMaterialIcon },
159
+ template: `
160
+ <div>
161
+ <p class="tw-mb-2">If you don't include text and your icon is not decorative, be sure to include screen-reader text</p>
162
+ <button class="tw-rounded-sm tw-bg-secondary hover:tw-bg-tertiary tw-p-1 tw-inline-flex">
163
+ <kv-material-icon class="tw-w-3" :icon="mdiClose" />
164
+ <span class="tw-sr-only">Close modal</span>
165
+ </button>
166
+ </div>`,
167
+ data() {
168
+ return {
169
+ mdiClose,
170
+ };
171
+ },
172
+ });
173
+
174
+ export const StarsDemo = (args, { argTypes }) => ({
175
+ props: Object.keys(argTypes),
176
+ components: { KvMaterialIcon },
177
+ template: `
178
+ <div class="tw-flex">
179
+ <button
180
+ v-for="i in 5"
181
+ :key="i"
182
+ @click="rating = i"
183
+ class="hover:tw-text-action-highlight"
184
+ >
185
+ <kv-material-icon :icon="getStarIcon(i)"/>
186
+ <span class="tw-sr-only">Set rating to {{i}}</span>
187
+ </button>
188
+ </div>`,
189
+ data() {
190
+ return {
191
+ rating: 2,
192
+ mdiStar,
193
+ mdiStarOutline,
194
+ };
195
+ },
196
+ methods: {
197
+ getStarIcon(index) {
198
+ return this.rating >= index ? this.mdiStar : this.mdiStarOutline;
199
+ },
200
+ },
201
+ });
@@ -0,0 +1,50 @@
1
+ import KvPageContainer from '../KvPageContainer.vue';
2
+
3
+ export default {
4
+ title: 'Layout/KvPageContainer',
5
+ component: KvPageContainer,
6
+ parameters: {
7
+ layout: 'fullscreen',
8
+ },
9
+ };
10
+
11
+ const DefaultTemplate = () => ({
12
+ components: { KvPageContainer },
13
+ template: `
14
+ <div class="demo">
15
+ <component is="style">
16
+ .demo * { outline: 1px solid red !important; }
17
+ </component>
18
+
19
+ <kv-page-container>
20
+ <p>I'm constrained!</p>
21
+ </kv-page-container>
22
+ </div>`,
23
+ });
24
+
25
+ const BreakingOutTemplate = () => ({
26
+ components: { KvPageContainer },
27
+ template: `
28
+ <div class="demo">
29
+ <component is="style">
30
+ .demo * { outline: 1px solid red !important; }
31
+ </component>
32
+
33
+ <div>
34
+ <kv-page-container>
35
+ <p>I'm constrained!</p>
36
+ </kv-page-container>
37
+
38
+ <img
39
+ class="tw-w-full"
40
+ src="https://via.placeholder.com/2000x400">
41
+
42
+ <kv-page-container>
43
+ <p>I'm constrained!</p>
44
+ </kv-page-container>
45
+ </div>
46
+ </div>`,
47
+ });
48
+
49
+ export const Default = DefaultTemplate.bind({});
50
+ export const BreakingOut = BreakingOutTemplate.bind({});
@@ -0,0 +1,70 @@
1
+ import KvPagination from '../KvPagination.vue';
2
+
3
+ export default {
4
+ title: 'KvPagination',
5
+ component: KvPagination,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (_args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvPagination },
12
+ template: `<kv-pagination
13
+ :limit="limit"
14
+ :total="total"
15
+ :offset="offset"
16
+ :extra-pages="extraPages"
17
+ :kv-track-function="kvTrackMock"
18
+ :track-event-category="trackEventCategory"
19
+ />`,
20
+ methods: {
21
+ kvTrackMock(
22
+ category,
23
+ action,
24
+ label,
25
+ property,
26
+ value,
27
+ ) {
28
+ console.log(category, action, label, property, value);
29
+ },
30
+ },
31
+ });
32
+ template.args = args;
33
+ return template;
34
+ };
35
+
36
+ export const Default = story({ limit: 10, total: 0, trackEventCategory: 'blog-articles' });
37
+
38
+ export const FewerPages = story({ limit: 10, total: 30, trackEventCategory: 'blog-articles' });
39
+
40
+ export const MorePages = story({ limit: 10, total: 1000, trackEventCategory: 'blog-articles' });
41
+
42
+ export const SecondSelected = story({
43
+ limit: 10, total: 1000, offset: 10, trackEventCategory: 'blog-articles',
44
+ });
45
+
46
+ export const ThirdSelected = story({
47
+ limit: 10, total: 1000, offset: 20, trackEventCategory: 'blog-articles',
48
+ });
49
+
50
+ export const FourthSelected = story({
51
+ limit: 10, total: 1000, offset: 30, trackEventCategory: 'blog-articles',
52
+ });
53
+
54
+ export const LastSelected = story({
55
+ limit: 10, total: 1000, offset: 990, trackEventCategory: 'blog-articles',
56
+ });
57
+
58
+ export const SecondToLastSelected = story({
59
+ limit: 10, total: 1000, offset: 980, trackEventCategory: 'blog-articles',
60
+ });
61
+
62
+ export const ThirdToLastSelected = story({
63
+ limit: 10, total: 1000, offset: 970, trackEventCategory: 'blog-articles',
64
+ });
65
+
66
+ export const FourthToLastSelected = story({
67
+ limit: 10, total: 1000, offset: 960, trackEventCategory: 'blog-articles',
68
+ });
69
+
70
+ export const MoreExtraPages = story({ limit: 10, total: 1000, extraPages: 6 });
@@ -0,0 +1,47 @@
1
+ import KvPieChart from '../KvPieChart.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/KvPieChart',
8
+ component: KvPieChart,
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
+ KvPieChart,
21
+ },
22
+ template: `
23
+ <div>
24
+ <kv-pie-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
+ };
43
+
44
+ export const OneValue = Template.bind({});
45
+ OneValue.args = {
46
+ values: [{ label: 'Female', value: 1, percent: 1 }],
47
+ };
@@ -0,0 +1,53 @@
1
+ import KvProgressBar from '../KvProgressBar.vue';
2
+
3
+ export default {
4
+ title: 'KvProgressBar',
5
+ component: KvProgressBar,
6
+ args: {
7
+ min: 0,
8
+ max: 100,
9
+ value: 50,
10
+ ariaLabel: 'Amount the loan has fundraised',
11
+ variant: 'primary',
12
+ bgVariant: 'secondary',
13
+ },
14
+ };
15
+
16
+ const Template = (args, { argTypes }) => ({
17
+ props: Object.keys(argTypes),
18
+ components: { KvProgressBar },
19
+ template: `
20
+ <kv-progress-bar
21
+ :aria-label="ariaLabel"
22
+ :min="min"
23
+ :max="max"
24
+ :value="value"
25
+ :variant="variant"
26
+ :bg-variant="bgVariant"
27
+
28
+ ></kv-progress-bar>`,
29
+ });
30
+
31
+ export const Default = Template.bind({});
32
+ Default.args = {};
33
+
34
+ // Variants
35
+ export const VariantCaution = Template.bind({});
36
+ VariantCaution.args = {
37
+ variant: 'caution',
38
+ };
39
+
40
+ export const VariantDanger = Template.bind({});
41
+ VariantDanger.args = {
42
+ variant: 'danger',
43
+ };
44
+
45
+ export const VariantGhost = Template.bind({});
46
+ VariantGhost.args = {
47
+ variant: 'ghost',
48
+ };
49
+
50
+ export const BgVariantTertiary = Template.bind({});
51
+ BgVariantTertiary.args = {
52
+ bgVariant: 'tertiary',
53
+ };