@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,499 @@
1
+ import resolveConfig from 'tailwindcss/resolveConfig'; // eslint-disable-line import/no-extraneous-dependencies
2
+ import tailwindConfig from '@kiva/kv-tokens/configs/tailwind.config.cjs';
3
+ import { textStyles } from '@kiva/kv-tokens/configs/kivaTypography.cjs';
4
+ import KvGrid from '../KvGrid.vue';
5
+ import KvPageContainer from '../KvPageContainer.vue';
6
+ import KvTab from '../KvTab.vue';
7
+ import KvTabs from '../KvTabs.vue';
8
+ import KvTabPanel from '../KvTabPanel.vue';
9
+ import KvToast from '../KvToast.vue';
10
+
11
+ const { headerNumberCase, kebabCase, removeObjectProperty } = require('../../utils/themeUtils.cjs');
12
+
13
+ const config = resolveConfig(tailwindConfig);
14
+ const { theme } = config;
15
+
16
+ function buildValuesFromThemeObj(initialObj) {
17
+ const arr = [];
18
+ const iterate = (obj, prefix = '') => {
19
+ Object.keys(obj).forEach((key) => {
20
+ if (typeof obj[key] === 'object') {
21
+ iterate(obj[key], key);
22
+ } else {
23
+ const niceKey = prefix ? `${prefix}-${key}` : key;
24
+ arr.push([niceKey, obj[key]]);
25
+ }
26
+ });
27
+ };
28
+ iterate(initialObj);
29
+ return arr;
30
+ }
31
+
32
+ export default {
33
+ title: 'Base Styling/Primitives',
34
+ };
35
+
36
+ export const Primitives = (args, { argTypes }) => ({
37
+ props: Object.keys(argTypes),
38
+ components: {
39
+ KvGrid,
40
+ KvPageContainer,
41
+ KvTab,
42
+ KvTabs,
43
+ KvTabPanel,
44
+ KvToast,
45
+ },
46
+ template: `
47
+ <kv-page-container>
48
+ <h1 class="tw-mt-4">Primitives</h1>
49
+ <section class="tw-py-8">
50
+ <h2 class="tw-mb-4">Background Colors</h2>
51
+ <kv-tabs>
52
+ <template #tabNav>
53
+ <kv-tab for-panel="bg_themable">Themable</kv-tab>
54
+ <kv-tab for-panel="bg_static">Static</kv-tab>
55
+ </template>
56
+ <template #tabPanels>
57
+ <kv-tab-panel id="bg_themable">
58
+ <kv-grid
59
+ as="ul"
60
+ class="tw-grid-cols-3 md:tw-grid-cols-4 lg:tw-grid-cols-5"
61
+ >
62
+ <li
63
+ v-for="color in backgroundColor"
64
+ v-if="!isStaticColor(color)"
65
+ :key="buildClassName('bg', color[0])"
66
+ >
67
+ <button
68
+ class="tw-flex tw-flex-col tw-h-full tw-w-full tw-text-left tw-border tw-rounded tw-p-1.5 tw-border-tertiary tw-font-book hover:tw-text-action-highlight"
69
+ @click="copy(buildClassName('tw-bg', color[0]))"
70
+ >
71
+ <div
72
+ class="tw-w-full tw-h-0 tw-block tw-mb-1"
73
+ style="padding-bottom: 100%;"
74
+ :class="buildClassName('tw-bg', color[0])"
75
+ >
76
+ </div>
77
+ <div class="tw-w-full">
78
+ .{{buildClassName('tw-bg', color[0])}}
79
+ <br><small class="tw-text-tertiary">var({{buildClassName('--bg', color[0])}})</small>
80
+ </div>
81
+ </button>
82
+ </li>
83
+ </kv-grid>
84
+ </kv-tab-panel>
85
+ <kv-tab-panel id="bg_static">
86
+ <kv-grid
87
+ as="ul"
88
+ class="tw-grid-cols-3 md:tw-grid-cols-4 lg:tw-grid-cols-5"
89
+ >
90
+ <li
91
+ v-for="color in backgroundColor"
92
+ v-if="isStaticColor(color)"
93
+ :key="buildClassName('bg', color[0])"
94
+ >
95
+ <button
96
+ class="tw-flex tw-flex-col tw-h-full tw-w-full tw-text-left tw-border tw-rounded tw-p-1.5 tw-border-tertiary tw-font-book hover:tw-text-action-highlight"
97
+ @click="copy(buildClassName('tw-bg', color[0]))"
98
+ >
99
+ <div
100
+ class="tw-w-full tw-h-0 tw-block tw-mb-1"
101
+ style="padding-bottom: 100%;"
102
+ :class="buildClassName('tw-bg', color[0])"
103
+ >
104
+ </div>
105
+ <div class="tw-w-full">
106
+ .{{buildClassName('tw-bg', color[0])}}
107
+ <br><small class="tw-text-tertiary">{{color[1]}}</small>
108
+ </div>
109
+ </button>
110
+ </li>
111
+ </kv-grid>
112
+ </kv-tab-panel>
113
+ </template>
114
+ </kv-tabs>
115
+ </section>
116
+ <hr>
117
+ <section class="tw-py-8">
118
+ <h2 class="tw-mb-4">Text Colors</h2>
119
+ <kv-tabs>
120
+ <template #tabNav>
121
+ <kv-tab for-panel="text_themable">Themable</kv-tab>
122
+ <kv-tab for-panel="text_static">Static</kv-tab>
123
+ </template>
124
+ <template #tabPanels>
125
+ <kv-tab-panel id="text_themable">
126
+ <table>
127
+ <tbody>
128
+ <tr
129
+ v-for="color in textColor"
130
+ v-if="!isStaticColor(color)"
131
+ :key="buildClassName('text-color', color[0])"
132
+ >
133
+ <td class="tw-py-1 tw-min-w-[300px]">
134
+ <button
135
+ class="hover:tw-text-action-highlight"
136
+ :class="buildClassName('tw-text', color[0])"
137
+ @click="copy(buildClassName('tw-text', color[0]))"
138
+ >.{{buildClassName('tw-text', color[0])}}</button>
139
+ </td>
140
+ <td>
141
+ <small class="tw-text-tertiary">var({{buildClassName('--text', color[0])}})</small>
142
+ </td>
143
+ </tr>
144
+ </tbody>
145
+ </table>
146
+ </kv-tab-panel>
147
+ <kv-tab-panel id="text_static">
148
+ <table>
149
+ <tbody>
150
+ <tr
151
+ v-for="color in textColor"
152
+ v-if="isStaticColor(color)"
153
+ :key="buildClassName('text-color', color[0])"
154
+ >
155
+ <td class="tw-py-1 tw-min-w-[300px]">
156
+ <button
157
+ class="hover:tw-text-action-highlight"
158
+ :class="buildClassName('tw-text', color[0])"
159
+ @click="copy(buildClassName('tw-text', color[0]))"
160
+ >.{{buildClassName('tw-text', color[0])}}</button>
161
+ </td>
162
+ <td>
163
+ <small class="tw-text-tertiary">var({{buildClassName('--text', color[0])}})</small>
164
+ </td>
165
+ </tr>
166
+ </tbody>
167
+ </table>
168
+ </kv-tab-panel>
169
+ </template>
170
+ </kv-tabs>
171
+ </section>
172
+ <hr>
173
+ <section class="tw-py-8">
174
+ <h2 class="tw-mb-4">Border/Ring Colors</h2>
175
+ <kv-tabs>
176
+ <template #tabNav>
177
+ <kv-tab for-panel="border_themable">Themable</kv-tab>
178
+ <kv-tab for-panel="border_static">Static</kv-tab>
179
+ </template>
180
+ <template #tabPanels>
181
+ <kv-tab-panel id="border_themable">
182
+ <table>
183
+ <tbody>
184
+ <tr
185
+ v-for="color in borderColor"
186
+ v-if="!isStaticColor(color)"
187
+ :key="buildClassName('border-color', color[0])"
188
+ >
189
+ <td class="tw-py-2 tw-min-w-[300px]">
190
+ <button
191
+ class="tw-ring-4 hover:tw-text-action-highlight"
192
+ :class="buildClassName('tw-ring', color[0])"
193
+ @click="copy(buildClassName('tw-border', color[0]))"
194
+ >.{{buildClassName('tw-border', color[0])}}</button>
195
+ </td>
196
+ <td>
197
+ <small class="tw-text-tertiary">var({{buildClassName('--border', color[0])}})</small>
198
+ </td>
199
+ </tr>
200
+ </tbody>
201
+ </table>
202
+ </kv-tab-panel>
203
+ <kv-tab-panel id="border_static">
204
+ <table>
205
+ <tbody>
206
+ <tr
207
+ v-for="color in borderColor"
208
+ v-if="isStaticColor(color)"
209
+ :key="buildClassName('border-color', color[0])"
210
+ >
211
+ <td class="tw-py-2 tw-min-w-[300px]">
212
+ <button
213
+ class="tw-ring-4 hover:tw-text-action-highlight"
214
+ :class="buildClassName('tw-ring', color[0])"
215
+ @click="copy(buildClassName('tw-border', color[0]))"
216
+ >.{{buildClassName('tw-border', color[0])}}</button>
217
+ </td>
218
+ <td>
219
+ <small class="tw-text-tertiary">var({{buildClassName('--border', color[0])}})</small>
220
+ </td>
221
+ </tr>
222
+ </tbody>
223
+ </table>
224
+ </kv-tab-panel>
225
+ </template>
226
+ </kv-tabs>
227
+ </section>
228
+ <hr>
229
+ <section class="tw-py-8">
230
+ <h2 class="tw-mb-4">Text Styles</h2>
231
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4">
232
+ <li
233
+ v-for="typeStyle in kivaTypography"
234
+ :key="buildClassName('text', typeStyle)"
235
+ class="tw-overflow-x-auto tw-w-full"
236
+ >
237
+ <button
238
+ class="tw-text-left tw-font-book hover:tw-text-action-highlight"
239
+ @click="copy(buildClassName('tw-text', typeStyle))"
240
+ >
241
+ <p
242
+ class="tw-mb-1"
243
+ :class="buildClassName('tw-text', typeStyle)"
244
+ style="width: 12em;"
245
+ >
246
+ The quick brown fox jumps over the lazy dog
247
+ </p>
248
+ <span>.{{buildClassName('tw-text', typeStyle)}}</span>
249
+ </button>
250
+ </li>
251
+ </ul>
252
+ </section>
253
+ <section class="tw-py-8">
254
+ <h2 class="tw-mb-4">Text Styles <i>(Italics)</i></h2>
255
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4">
256
+ <li
257
+ v-for="typeStyle in kivaTypography"
258
+ :key="buildClassName('text', typeStyle)"
259
+ class="tw-overflow-x-auto tw-w-full"
260
+ >
261
+ <button
262
+ class="tw-text-left tw-font-book hover:tw-text-action-highlight"
263
+ @click="copy(buildClassName('tw-text', typeStyle))"
264
+ >
265
+ <p
266
+ class="tw-mb-1 tw-italic"
267
+ :class="buildClassName('tw-text', typeStyle)"
268
+ style="width: 12em;"
269
+ >
270
+ The quick brown fox jumps over the lazy dog
271
+ </p>
272
+ <span>.{{buildClassName('tw-text', typeStyle)}} .tw-italic</span>
273
+ </button>
274
+ </li>
275
+ </ul>
276
+ </section>
277
+ <hr>
278
+ <section class="tw-py-8">
279
+ <h2 class="tw-mb-4">Font Weights</h2>
280
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4">
281
+ <li
282
+ v-for="fontWeight in fontWeights"
283
+ :key="buildClassName('tw-font', fontWeight[0])"
284
+ >
285
+ <button
286
+ class="tw-text-left tw-font-book hover:tw-text-action-highlight"
287
+ @click="copy(buildClassName('tw-font', fontWeight[0]))"
288
+ >
289
+ <p :class="buildClassName('tw-font', fontWeight[0])">
290
+ The quick brown fox jumps over the lazy dog
291
+ </p>
292
+ <span>.{{buildClassName('tw-font', fontWeight[0])}}</span>
293
+ </button>
294
+ </li>
295
+ </ul>
296
+ </section>
297
+ <hr>
298
+ <section class="tw-py-8">
299
+ <h2 class="tw-mb-4">Font Weights (Serif)</h2>
300
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4">
301
+ <li
302
+ v-for="fontWeight in fontWeights"
303
+ :key="buildClassName('tw-font', fontWeight[0])"
304
+ >
305
+ <button
306
+ class="tw-text-left tw-font-book hover:tw-text-action-highlight"
307
+ @click="copy(buildClassName('tw-font', fontWeight[0]))"
308
+ >
309
+ <p :class="[buildClassName('tw-font', fontWeight[0]), 'tw-font-serif']">
310
+ The quick brown fox jumps over the lazy dog
311
+ </p>
312
+ <span>.{{buildClassName('tw-font', fontWeight[0])}}</span>
313
+ </button>
314
+ </li>
315
+ </ul>
316
+ </section>
317
+ <hr>
318
+ <section class="tw-py-8">
319
+ <h2 class="tw-mb-4">Radii</h2>
320
+
321
+ <kv-grid
322
+ as="ul"
323
+ class="tw-grid-cols-3 md:tw-grid-cols-4 lg:tw-grid-cols-5"
324
+ >
325
+ <li
326
+ v-for="radius in radii"
327
+ :key="buildClassName('tw-rounded', radius[0])"
328
+ >
329
+ <button
330
+ class="tw-flex tw-flex-col tw-text-left tw-border tw-rounded tw-p-1.5 tw-w-full tw-h-full tw-border-tertiary tw-font-book hover:tw-text-action-highlight"
331
+ @click="copy(buildClassName('tw-rounded', radius[0]))"
332
+ >
333
+ <div
334
+ class="tw-bg-tertiary tw-w-full tw-h-0 tw-mb-1"
335
+ style="padding-bottom: 100%;"
336
+ :class="buildClassName('tw-rounded', radius[0])"
337
+ ></div>
338
+ <div>
339
+ .{{buildClassName('tw-rounded', radius[0])}}
340
+ <br><small class="tw-text-tertiary">({{remToPx(radius[1])}}px)</small>
341
+ </div>
342
+ </button>
343
+ </li>
344
+ </kv-grid>
345
+
346
+ </section>
347
+ <hr>
348
+ <section class="tw-py-8">
349
+ <h2 class="tw-mb-4">Opacity</h2>
350
+ <kv-grid as="ul" class="tw-grid-cols-3 md:tw-grid-cols-4 lg:tw-grid-cols-5">
351
+ <li
352
+ v-for="opacityItem in opacity"
353
+ :key="buildClassName('tw-opacity', opacityItem[0])"
354
+ >
355
+ <button
356
+ class="tw-flex tw-flex-col tw-text-left tw-border tw-rounded tw-p-1.5 tw-w-full tw-h-full tw-border-tertiary tw-font-book hover:tw-text-action-highlight"
357
+ @click="copy(buildClassName('tw-opacity', opacityItem[0]))"
358
+ >
359
+ <div
360
+ class="tw-bg-tertiary tw-w-full tw-h-0 tw-mb-1"
361
+ :class="buildClassName('tw-opacity', opacityItem[0])"
362
+ style="background-image: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet, red); padding-bottom: 100%;"
363
+ ></div>
364
+ <div>
365
+ .{{buildClassName('tw-opacity', opacityItem[0])}}<br>
366
+ <small class="tw-text-tertiary">({{opacityItem[1]}})</small>
367
+ </div>
368
+ </button>
369
+ </li>
370
+ </kv-grid>
371
+ </section>
372
+ <hr>
373
+ <section class="tw-py-8">
374
+ <h2 class="tw-mb-4">Space</h2>
375
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4">
376
+ <li
377
+ v-for="spaceItem in space"
378
+ class="block"
379
+ :key="buildClassName('tw-w', spaceItem[0])"
380
+ >
381
+ <button
382
+ class="tw-text-left tw-font-book hover:tw-text-action-highlight"
383
+ @click="copy(buildClassName('tw-w', spaceItem[0]))"
384
+ >
385
+ <div
386
+ class="tw-bg-tertiary tw-h-3 tw-inline-block"
387
+ :class="buildClassName('tw-w', spaceItem[0])"
388
+ ></div>
389
+ <div>
390
+ .{{buildClassName('tw-w', spaceItem[0])}}
391
+ <small class="tw-text-tertiary">({{remToPx(spaceItem[1])}}px)</small>
392
+ </div>
393
+ </button>
394
+ </li>
395
+ </ul>
396
+ </section>
397
+ <hr>
398
+ <section class="tw-py-8">
399
+ <h2 class="tw-mb-4">Breakpoints</h2>
400
+ <ul class="tw-flex tw-flex-wrap tw-flex-col tw-gap-4 tw-overflow-x-auto">
401
+ <li
402
+ v-for="breakpoint in breakpoints"
403
+ :key="buildClassName('tw-breakpoint', breakpoint[0])"
404
+ >
405
+ <div
406
+ class="tw-w-8 tw-h-4 tw-bg-tertiary tw-mb-1"
407
+ :style="{ 'width': breakpoint[1] }"
408
+ ></div>
409
+ <span>
410
+ {{breakpoint[0]}}
411
+ <small class="tw-text-tertiary">({{remToPx(breakpoint[1])}}px)</small>
412
+ </span>
413
+ </li>
414
+ </ul>
415
+ </section>
416
+ <hr>
417
+ <section class="tw-py-8">
418
+ <h2 class="tw-mb-4">Z-Indices</h2>
419
+ <ul class="tw-relative">
420
+ <li
421
+ v-for="(zIndex, index) in zIndices"
422
+ :key="buildClassName('tw-z', zIndex[0])"
423
+ class="tw-absolute"
424
+ :class="buildClassName('tw-z', zIndex[0])"
425
+ :style="{left: 'calc(' + index/zIndices.length * 100 + '% - ' + (index/zIndices.length * 250) + 'px)', top: index * 50 + 'px'}"
426
+ >
427
+ <button
428
+ class="tw-flex tw-text-left tw-content-start tw-align-top tw-p-2 tw-font-book hover:tw-text-action-highlight tw-h-12 tw-bg-tertiary tw-outline-2 tw-outline-dotted tw-outline-offset-2"
429
+ style="width: 250px;"
430
+ @click="copy(buildClassName('tw-z', zIndex[0]))"
431
+ >
432
+ <span>
433
+ {{buildClassName('tw-z', zIndex[0])}}
434
+ <small class="tw-text-tertiary">({{zIndex[1]}})</small>
435
+ </span>
436
+ </button>
437
+ </li>
438
+ </ul>
439
+ </section>
440
+
441
+ <!-- Toast -->
442
+ <div class="tw-fixed tw-inset-0 tw-z-toast tw-pointer-events-none">
443
+ <div class="tw-fixed tw-left-0 tw-right-0 tw-top-2 tw-pointer-events-auto">
444
+ <kv-toast ref="toastRef" />
445
+ </div>
446
+ </div>
447
+ </kv-page-container>
448
+ `,
449
+ data() {
450
+ return {
451
+ backgroundColor: buildValuesFromThemeObj(theme.backgroundColor),
452
+ textColor: buildValuesFromThemeObj(theme.textColor),
453
+ borderColor: buildValuesFromThemeObj(theme.borderColor),
454
+ space: buildValuesFromThemeObj(theme.spacing).sort((a, b) => a[0] - b[0]),
455
+ kivaTypography: Object.keys(textStyles).map((key) => headerNumberCase(kebabCase(key)).replace('text-', '')),
456
+ fontWeights: buildValuesFromThemeObj(theme.fontWeight),
457
+ breakpoints: buildValuesFromThemeObj(removeObjectProperty(theme.screens, 'print')),
458
+ radii: buildValuesFromThemeObj(theme.borderRadius),
459
+ opacity: buildValuesFromThemeObj(theme.opacity),
460
+ zIndices: buildValuesFromThemeObj(theme.zIndex).sort((a, b) => a[1] - b[1]),
461
+ isToastVisible: false,
462
+ toastMessage: '',
463
+ };
464
+ },
465
+ methods: {
466
+ async copy(val) {
467
+ await navigator.clipboard.writeText(val);
468
+ this.showToast(`copied: ${val}`);
469
+ },
470
+ showToast(message) {
471
+ this.$refs.toastRef.show(message);
472
+ },
473
+ remToPx(rem) {
474
+ return parseFloat(rem) * 16;
475
+ },
476
+ buildClassName(prefix, value) {
477
+ let name = `${prefix}-${value}`;
478
+ name = name.replace('-DEFAULT', '');
479
+ return name;
480
+ },
481
+ isStaticColor(colorName) {
482
+ const staticColors = [
483
+ 'transparent',
484
+ 'current',
485
+ 'brand',
486
+ 'black',
487
+ 'white',
488
+ 'eco-green',
489
+ 'marigold',
490
+ 'desert-rose',
491
+ 'stone',
492
+ 'gray',
493
+ 'social',
494
+ ];
495
+ const isStatic = staticColors.some((staticColor) => colorName[0].includes(staticColor));
496
+ return isStatic;
497
+ },
498
+ },
499
+ });