@vcita/design-system 0.2.7 → 0.3.11
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 +10 -0
- package/README.md +1 -0
- package/dist/@vcita/design-system.esm.js +715 -424
- package/dist/@vcita/design-system.min.js +1 -1
- package/dist/@vcita/design-system.ssr.js +645 -369
- package/init/DesignSystem.js +18 -2
- package/init/SvgIcons.js +4 -0
- package/init/vuetify.config.js +3 -3
- package/package.json +1 -1
- package/src/components/VcActionList/VcActionList.spec.js +1 -1
- package/src/components/VcActionList/VcActionList.stories.js +1 -1
- package/src/components/VcActions/VcActions.spec.js +1 -1
- package/src/components/VcActions/VcActions.stories.js +1 -1
- package/src/components/VcActions/VcActions.vue +4 -6
- package/src/components/VcBanner/VcBanner.stories.js +14 -2
- package/src/components/VcBanner/VcBanner.vue +5 -2
- package/src/components/VcBottomActions/VcBottomActions.spec.js +1 -1
- package/src/components/VcBottomActions/VcBottomActions.stories.js +3 -3
- package/src/components/VcEmptyState/VcEmptyState.vue +1 -1
- package/src/components/VcExpansionCard/VcExpansionCard.spec.js +146 -0
- package/src/components/VcExpansionCard/VcExpansionCard.stories.js +43 -0
- package/src/components/VcExpansionCard/VcExpansionCard.vue +117 -0
- package/src/components/VcSwitch/VcSwitch.spec.js +40 -0
- package/src/components/VcSwitch/VcSwitch.stories.js +14 -3
- package/src/components/VcSwitch/VcSwitch.vue +162 -52
- package/src/components/index.js +2 -0
- package/src/components/list/VcListEntity/VcListEntity.spec.js +95 -0
- package/src/components/list/VcListEntity/VcListEntity.stories.js +77 -0
- package/src/components/list/VcListEntity/VcListEntity.vue +70 -0
- package/src/components/modal/VcConfirmModal/VcConfirmModal.vue +6 -2
- package/src/components/wizard/VcSteperContent/VcStepperContent.vue +6 -0
- package/src/components/wizard/VcWizard/VcWizard.spec.js +7 -0
- package/src/components/wizard/VcWizard/VcWizard.stories.js +3 -0
- package/src/components/wizard/VcWizard/VcWizard.vue +12 -4
- package/src/components/wizard/VcWizard/demoWizardPage.vue +1 -1
- package/src/stories/welcome.stories.mdx +1 -0
package/init/DesignSystem.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Vuetify from 'vuetify';
|
|
2
2
|
import Vue from "vue";
|
|
3
3
|
import vuetifyConfig from './vuetify.config';
|
|
4
|
+
import {reducer} from './vuetify.config';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
VAlert,
|
|
@@ -76,14 +77,29 @@ Vue.use(Vuetify, {
|
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
const DesignSystem = ({theme = {}, options = {}} = {}, locale ='en') => {
|
|
80
|
+
const DesignSystem = ({theme = {}, options = {}, extIcons = {}} = {}, locale ='en') => {
|
|
80
81
|
const ds = { ...(Vue.prototype.$ds || {}), ...options};
|
|
81
82
|
// Make the options available to all the components
|
|
82
83
|
Vue.prototype.$ds = ds;
|
|
83
84
|
Vue.prototype.$log = Vue.prototype.$log || console.log;
|
|
84
85
|
Vue.prototype.$svgImages = Vue.prototype.$svgImages || svgImages;
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
|
|
88
|
+
const DSIcons = vuetifyConfig.icons;
|
|
89
|
+
|
|
90
|
+
const iconsArray = Object.keys(extIcons).reduce((acc, key) => reducer(acc, key, extIcons), {});
|
|
91
|
+
|
|
92
|
+
const icons = {
|
|
93
|
+
icons:{
|
|
94
|
+
...DSIcons,
|
|
95
|
+
values: {
|
|
96
|
+
...DSIcons.values,
|
|
97
|
+
...iconsArray
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const vuetifyConfigOverride = {...vuetifyConfig, ...theme, ...icons };
|
|
87
103
|
// initI18n(locale);
|
|
88
104
|
return new Vuetify(vuetifyConfigOverride);
|
|
89
105
|
}
|
package/init/SvgIcons.js
CHANGED
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
arrow_right: `<svg class="arrow-right" viewBox="0 0 12 13" xmlns="http://www.w3.org/2000/svg"><path d="M6.40093 0.683058C6.15685 0.438981 5.76112 0.438981 5.51704 0.683058C5.27296 0.927136 5.27296 1.32286 5.51704 1.56694L7.78311 3.83301H0.625C0.279822 3.83301 0 4.11283 0 4.45801C0 4.80319 0.279822 5.08301 0.625 5.08301H7.78343L5.51704 7.3494C5.27296 7.59348 5.27296 7.98921 5.51704 8.23328C5.76112 8.47736 6.15685 8.47736 6.40093 8.23328L9.72198 4.91223C9.72612 4.90831 9.73021 4.90433 9.73426 4.90028C9.85634 4.77819 9.91736 4.61818 9.91732 4.45817C9.91736 4.29817 9.85634 4.13815 9.73426 4.01607C9.73021 4.01201 9.72611 4.00803 9.72198 4.00411L6.40093 0.683058Z"/></svg>`,
|
|
9
9
|
warning: `<svg class="vc-notif" viewBox="0 0 16 15" xmlns="http://www.w3.org/2000/svg"><path d="M8.31873 10.5C8.41874 10.5 8.50309 10.4188 8.50623 10.3188L8.74061 5.19378C8.74372 5.08752 8.65934 5.00002 8.55311 5.00002H7.44374C7.33747 5.00002 7.25309 5.08752 7.25624 5.19378L7.49061 10.3188C7.49372 10.4219 7.5781 10.5 7.67811 10.5H8.31873Z"/><path d="M7.99998 12.875C8.48435 12.875 8.87498 12.4844 8.87498 12C8.87498 11.5156 8.48435 11.125 7.99998 11.125C7.5156 11.125 7.12498 11.5156 7.12498 12C7.12498 12.4844 7.5156 12.875 7.99998 12.875Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6.844 0.65625C7.33344 -0.177083 8.52333 -0.216766 9.07706 0.537202L9.15518 0.65625L15.8194 13.0312C16.3119 13.8698 15.7405 14.9092 14.7923 14.9944L14.6665 15H1.33541C0.35042 15 -0.277403 13.993 0.121864 13.1414L6.844 0.65625ZM8.2917 1.16064C8.18032 0.969949 7.90489 0.948761 7.76849 1.07583L7.72445 1.13039L1.0426 13.5368C0.935848 13.719 1.04882 13.9484 1.26113 13.9925L1.33541 14H14.6665C14.8973 14 15.0441 13.7892 14.9714 13.5762L14.9389 13.5054L8.2917 1.16064Z"/></svg>`,
|
|
10
10
|
warning_fill: `<svg class="vc-warning-fill" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.665 15.1111C15.689 15.1111 16.3326 14.0002 15.8199 13.1115L9.1549 1.55518C8.64283 0.667643 7.35802 0.666016 6.84506 1.55518L0.179883 13.1115C-0.331836 13.9985 0.308789 15.1111 1.3348 15.1111H14.665ZM8.60496 9.85592H7.39499C7.23615 9.85592 7.10501 9.73174 7.09637 9.57314L6.91149 5.31541C6.90214 5.14408 7.03852 5.00002 7.21008 5.00002H8.78984C8.96141 5.00002 9.09781 5.14408 9.08846 5.31541L8.90358 9.57314C8.89494 9.73174 8.7638 9.85592 8.60496 9.85592ZM6.85349 11.871C6.85349 12.5042 7.36678 13.0175 7.99998 13.0175C8.63317 13.0175 9.14647 12.5042 9.14647 11.871C9.14647 11.2378 8.63317 10.7246 7.99998 10.7246C7.36678 10.7246 6.85349 11.2378 6.85349 11.871Z"/></svg>`,
|
|
11
|
+
check_button: `<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M3.63154 7.92003L9.92635 1.10796C10.0247 1.0015 10.0247 0.828852 9.92635 0.722369L9.33252 0.0797233C9.23412 -0.0267372 9.0746 -0.0267372 8.97621 0.0797233L3.45338 6.05635L1.42411 3.86033C1.32571 3.75385 1.16619 3.75385 1.06777 3.86033L0.473945 4.50296C0.375547 4.60944 0.375547 4.78207 0.473945 4.88857L3.27523 7.92003C3.3736 8.02649 3.53312 8.02649 3.63154 7.92003Z"/></svg>`,
|
|
11
12
|
check_circle: `<svg class="vc-notif" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 0.25C3.71875 0.25 0.25 3.75 0.25 8C0.25 12.2812 3.71875 15.75 8 15.75C12.25 15.75 15.75 12.2812 15.75 8C15.75 3.75 12.25 0.25 8 0.25ZM8 14.75C4.28125 14.75 1.25 11.75 1.25 8C1.25 4.3125 4.25 1.25 8 1.25C11.6875 1.25 14.75 4.28125 14.75 8C14.75 11.7188 11.7188 14.75 8 14.75ZM12.4062 5.65625C12.5625 5.78125 12.5625 6.03125 12.4062 6.1875L6.78125 11.7812C6.625 11.9062 6.375 11.9062 6.25 11.7812L3.5625 9.0625C3.40625 8.90625 3.40625 8.6875 3.5625 8.53125L3.8125 8.28125C3.96875 8.125 4.21875 8.125 4.34375 8.28125L6.5 10.4375L11.625 5.375C11.75 5.21875 12 5.21875 12.1562 5.375L12.4062 5.65625Z"/></svg>`,
|
|
12
13
|
check_fill: `<svg class="vc-check-fill" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M15.7533 8.0034C15.7533 12.2836 12.2835 15.7534 8.00329 15.7534C3.72309 15.7534 0.253311 12.2836 0.253311 8.0034C0.253311 3.7232 3.72309 0.253418 8.00329 0.253418C12.2835 0.253418 15.7533 3.7232 15.7533 8.0034ZM3.14973 8.85694L6.39972 12.1069C6.595 12.3022 6.91159 12.3022 7.10687 12.107L12.8569 6.35698C13.0521 6.16173 13.0521 5.84511 12.8569 5.64986L12.1497 4.94277C11.9545 4.74749 11.6379 4.74749 11.4426 4.94277L6.7533 9.63209L4.56397 7.44273C4.36872 7.24748 4.0521 7.24748 3.85685 7.44273L3.14973 8.14982C2.95451 8.34507 2.95451 8.66169 3.14973 8.85694Z"/></svg>`,
|
|
13
14
|
info: `<svg class="vc-notif" viewBox="0 0 16 17" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.25 8.5C0.25 4.25 3.71875 0.75 8 0.75C12.25 0.75 15.75 4.25 15.75 8.5C15.75 12.7812 12.25 16.25 8 16.25C3.71875 16.25 0.25 12.7812 0.25 8.5ZM14.75 8.5C14.75 4.78125 11.6875 1.75 8 1.75C4.25 1.75 1.25 4.78125 1.25 8.5C1.25 12.25 4.25 15.25 8 15.25C11.7188 15.25 14.75 12.25 14.75 8.5ZM6.875 11.5C6.65625 11.5 6.5 11.6875 6.5 11.875V12.125C6.5 12.3438 6.65625 12.5 6.875 12.5H9.125C9.3125 12.5 9.5 12.3438 9.5 12.125V11.875C9.5 11.6875 9.3125 11.5 9.125 11.5H8.75V7.125C8.75 6.9375 8.5625 6.75 8.375 6.75H6.875C6.65625 6.75 6.5 6.9375 6.5 7.125V7.375C6.5 7.59375 6.65625 7.75 6.875 7.75H7.25V11.5H6.875ZM7 5C7 4.46875 7.4375 4 8 4C8.53125 4 9 4.46875 9 5C9 5.5625 8.53125 6 8 6C7.4375 6 7 5.5625 7 5Z"/></svg>`,
|
|
@@ -20,4 +21,7 @@ export default {
|
|
|
20
21
|
attention_fill: `<svg class="vc-attention-fill" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.00249 11.815C9.21241 11.815 11.815 9.21335 11.815 6.00249C11.815 2.7935 9.21241 0.190002 6.00249 0.190002C2.79257 0.190002 0.190002 2.7935 0.190002 6.00249C0.190002 9.21335 2.79257 11.815 6.00249 11.815ZM5.43358 6.75249C5.28421 6.75249 5.16089 6.63571 5.15277 6.48657L4.97891 3.29908C4.97012 3.13797 5.09836 3.0025 5.2597 3.0025H6.74525C6.90659 3.0025 7.03486 3.13797 7.02607 3.29908L6.85221 6.48657C6.84409 6.63571 6.72076 6.75249 6.5714 6.75249H5.43358ZM4.92437 8.25248C4.92437 8.84792 5.40705 9.33061 6.00249 9.33061C6.59792 9.33061 7.08061 8.84792 7.08061 8.25248C7.08061 7.65705 6.59792 7.17436 6.00249 7.17436C5.40705 7.17436 4.92437 7.65705 4.92437 8.25248Z"/></svg>`,
|
|
21
22
|
three_dots: `<svg class="vc-three-dots" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.52637 2.47368C6.52637 3.30263 7.1711 3.94737 8.00005 3.94737C8.78295 3.94737 9.47374 3.30263 9.47374 2.47368C9.47374 1.69079 8.78295 1 8.00005 1C7.1711 1 6.52637 1.69079 6.52637 2.47368ZM8.00005 6.52632C7.1711 6.52632 6.52637 7.21711 6.52637 8.00001C6.52637 8.82895 7.1711 9.47369 8.00005 9.47369C8.78295 9.47369 9.47374 8.82895 9.47374 8.00001C9.47374 7.21711 8.78295 6.52632 8.00005 6.52632ZM8.00005 15C7.1711 15 6.52637 14.3553 6.52637 13.5263C6.52637 12.7435 7.1711 12.0526 8.00005 12.0526C8.78295 12.0526 9.47374 12.7435 9.47374 13.5263C9.47374 14.3553 8.78295 15 8.00005 15Z"/></svg>`,
|
|
22
23
|
indeterminate: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="4.5" y="11" width="7" height="2" rx="0.25" fill="white"/></svg>',
|
|
24
|
+
chevron_left: `<svg class="vc-chevron-left" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_652_11903)"><path d="M4.61199 0.903801L4.14795 1.36786C4.03811 1.47768 4.03811 1.65574 4.14795 1.76561L8.38308 6.01081L4.14795 10.256C4.03811 10.3659 4.03811 10.5439 4.14795 10.6538L4.61199 11.1178C4.7218 11.2276 4.8999 11.2276 5.00974 11.1178L9.91786 6.20968C10.0277 6.09984 10.0277 5.92177 9.91786 5.81191L5.00974 0.903779C4.8999 0.793962 4.72181 0.793962 4.61199 0.903801Z"/></g><defs><clipPath id="clip0_652_11903"><rect width="12" height="12" fill="white" transform="translate(12 12) rotate(-180)"/></clipPath></defs></svg>`,
|
|
25
|
+
mastercard: `<svg width="48" height="30" viewBox="0 0 48 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M30.4888 3.20898H17.5103V26.7923H30.4888V3.20898Z" fill="#FF5F00"/><path d="M18.3348 15C18.3348 10.2083 20.5597 5.95834 23.9794 3.20834C21.4661 1.20834 18.2936 0 14.8326 0C6.63348 0 0 6.70833 0 15C0 23.2917 6.63348 30 14.8326 30C18.2936 30 21.4661 28.7917 23.9794 26.7917C20.5597 24.0833 18.3348 19.7917 18.3348 15Z" fill="#EB001B"/><path d="M47.9997 15C47.9997 23.2917 41.3663 30 33.1672 30C29.7062 30 26.5337 28.7917 24.0204 26.7917C27.4813 24.0417 29.665 19.7917 29.665 15C29.665 10.2083 27.4401 5.95834 24.0204 3.20834C26.5337 1.20834 29.7062 0 33.1672 0C41.3663 0 47.9997 6.75 47.9997 15Z" fill="#F79E1B"/></svg>`,
|
|
26
|
+
visa: `<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.7996 31.3605H16.9113L19.3433 16.2734H23.2314L20.7996 31.3605Z" fill="#00579F"/><path d="M34.8956 16.6423C34.1287 16.3371 32.9122 16 31.4081 16C27.5682 16 24.8642 18.0543 24.8477 20.9913C24.8158 23.1583 26.7836 24.3618 28.2555 25.0844C29.7598 25.8227 30.2712 26.3046 30.2712 26.9627C30.2559 27.9734 29.0556 28.4393 27.9361 28.4393C26.3837 28.4393 25.5519 28.1991 24.2878 27.6368L23.7758 27.3957L23.2317 30.7824C24.1437 31.1993 25.8238 31.5692 27.5682 31.5854C31.6482 31.5854 34.3043 29.5629 34.3358 26.433C34.3513 24.7155 33.3122 23.3995 31.0719 22.3242C29.712 21.6339 28.8791 21.1684 28.8791 20.4621C28.895 19.82 29.5835 19.1623 31.1187 19.1623C32.3828 19.1301 33.3116 19.4349 34.0151 19.74L34.3668 19.9002L34.8956 16.6423Z" fill="#00579F"/><path d="M40.0634 26.0157C40.3836 25.1489 41.6158 21.7944 41.6158 21.7944C41.5996 21.8267 41.9354 20.9117 42.1274 20.35L42.3991 21.65C42.3991 21.65 43.1354 25.2614 43.2953 26.0157C42.6876 26.0157 40.8314 26.0157 40.0634 26.0157ZM44.863 16.2734H41.8554C40.9279 16.2734 40.2233 16.5461 39.8231 17.5252L34.0475 31.3603H38.1274C38.1274 31.3603 38.7991 29.4982 38.9435 29.0971C39.3911 29.0971 43.36 29.0971 43.9358 29.0971C44.0474 29.6268 44.3997 31.3603 44.3997 31.3603H48L44.863 16.2734Z" fill="#00579F"/><path d="M13.6636 16.2734L9.8556 26.5614L9.43948 24.4748C8.73547 22.0673 6.52754 19.4515 4.0636 18.1509L7.55156 31.3445H11.6634L17.7752 16.2734H13.6636Z" fill="#00579F"/><path d="M6.31995 16.2734H0.0640009L0 16.5783C4.88004 17.8303 8.11199 20.8481 9.43985 24.4755L8.07988 17.5416C7.85598 16.5781 7.16792 16.3052 6.31995 16.2734Z" fill="#FAA61A"/></svg>`
|
|
23
27
|
}
|
package/init/vuetify.config.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import VcSvg from "../src/components/VcSvg/VcSvg.vue";
|
|
2
2
|
import icons from "./SvgIcons";
|
|
3
3
|
|
|
4
|
-
const reducer = (acc, key) => {
|
|
4
|
+
export const reducer = (acc, key, obj = icons) => {
|
|
5
5
|
acc[key] = {
|
|
6
6
|
component: VcSvg,
|
|
7
|
-
props: {svg:
|
|
7
|
+
props: {svg: obj[key]}
|
|
8
8
|
};
|
|
9
9
|
return acc;
|
|
10
10
|
}
|
|
11
|
-
const iconsArray = Object.keys(icons).reduce(reducer, {});
|
|
11
|
+
const iconsArray = Object.keys(icons).reduce((acc, key) => reducer(acc, key), {});
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
icons: {
|
package/package.json
CHANGED
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
v-model="showSheet"
|
|
6
6
|
v-bind="$props">
|
|
7
7
|
<template v-slot="{attrs, on}">
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</VcIcon>
|
|
12
|
-
</slot>
|
|
8
|
+
<VcIcon v-bind="attrs" v-on="on" small @click="showSheet = !showSheet">
|
|
9
|
+
$three_dots
|
|
10
|
+
</VcIcon>
|
|
13
11
|
</template>
|
|
14
12
|
</component>
|
|
15
13
|
</template>
|
|
@@ -18,7 +16,7 @@
|
|
|
18
16
|
|
|
19
17
|
import VcActionList from "../VcActionList/VcActionList.vue";
|
|
20
18
|
import VcBottomActions from "../VcBottomActions/VcBottomActions.vue";
|
|
21
|
-
import VcIcon from "
|
|
19
|
+
import VcIcon from "../VcIcon/VcIcon.vue";
|
|
22
20
|
|
|
23
21
|
export default {
|
|
24
22
|
name: "VcActions",
|
|
@@ -3,8 +3,20 @@ import VcBanner from './VcBanner';
|
|
|
3
3
|
const Template = (args, {argTypes}) => ({
|
|
4
4
|
components: {VcBanner: VcBanner},
|
|
5
5
|
props: Object.keys(argTypes),
|
|
6
|
-
template:
|
|
7
|
-
|
|
6
|
+
template: `
|
|
7
|
+
<div>
|
|
8
|
+
<VcBanner
|
|
9
|
+
:title="title"
|
|
10
|
+
:subtitle="subtitle"
|
|
11
|
+
:backgroundColor="backgroundColor"
|
|
12
|
+
:image="image"
|
|
13
|
+
:buttonLabel="buttonLabel"
|
|
14
|
+
@onAction="onAction">
|
|
15
|
+
</VcBanner>
|
|
16
|
+
<br>
|
|
17
|
+
<p><b>Note</b>: You can add subtitle as a prop or as a slot</p>
|
|
18
|
+
</div>
|
|
19
|
+
`,
|
|
8
20
|
})
|
|
9
21
|
|
|
10
22
|
export const Playground = Template.bind({});
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
<img class="d-none d-md-block" v-if="image" :src="image">
|
|
4
4
|
<div class="text-container px-md-8 flex-grow-1">
|
|
5
5
|
<div class="banner-title pb-2 pb-md-0">{{title}}</div>
|
|
6
|
-
<div class="banner-subtitle pb-4 pb-md-0" v-if="subtitle">
|
|
6
|
+
<div class="banner-subtitle pb-4 pb-md-0" v-if="subtitle || $slots.subtitle">
|
|
7
|
+
<slot name="subtitle">
|
|
8
|
+
{{subtitle}}
|
|
9
|
+
</slot>
|
|
10
|
+
</div>
|
|
7
11
|
</div>
|
|
8
12
|
<VcButton :large="$vuetify.breakpoint.smAndUp" v-if="buttonLabel" @click="$emit('onAction')">{{buttonLabel}}</VcButton>
|
|
9
13
|
</div>
|
|
@@ -45,7 +49,6 @@ export default {
|
|
|
45
49
|
@import "../../scss/mixins.scss";
|
|
46
50
|
|
|
47
51
|
.VcBanner{
|
|
48
|
-
//font-family: var(--primary-font-family);
|
|
49
52
|
min-height: 128px;
|
|
50
53
|
box-sizing: border-box;
|
|
51
54
|
box-shadow: var(--shadow-10);
|
|
@@ -31,7 +31,7 @@ Playground.args = {
|
|
|
31
31
|
}, {
|
|
32
32
|
title: 'Remove from waitlist',
|
|
33
33
|
event: 'remove',
|
|
34
|
-
icon: '
|
|
34
|
+
icon: 'warning_fill'
|
|
35
35
|
}, {
|
|
36
36
|
title: 'Go to client page',
|
|
37
37
|
event: 'goToClientPage',
|
|
@@ -56,8 +56,8 @@ const noHeaderTemplate = (args, {argTypes}) => ({
|
|
|
56
56
|
:data-qa="dataQa"
|
|
57
57
|
@close="onClose"
|
|
58
58
|
@action="onAction">
|
|
59
|
-
<template>
|
|
60
|
-
<v-icon>$information</v-icon>
|
|
59
|
+
<template v-slot="{attrs, on}">
|
|
60
|
+
<v-icon v-bind="attrs" v-on="on">$information</v-icon>
|
|
61
61
|
</template>
|
|
62
62
|
</VcBottomActions>
|
|
63
63
|
</div>`,
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import VcExpansionCard from "./VcExpansionCard.vue";
|
|
3
|
+
import init from "../../../testing-library.config"
|
|
4
|
+
import Vuetify from 'vuetify';
|
|
5
|
+
import {render} from "@testing-library/vue";
|
|
6
|
+
import {fireEvent} from '@testing-library/dom'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
init();
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const props = {
|
|
13
|
+
basic: {
|
|
14
|
+
title: 'expansion card title',
|
|
15
|
+
value: true
|
|
16
|
+
},
|
|
17
|
+
valueFalse: {
|
|
18
|
+
title: 'expansion card title',
|
|
19
|
+
value: false
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("VcExpansionCard.vue", () => {
|
|
24
|
+
|
|
25
|
+
const renderWithVuetify = (component, options, callback, isMobile = false) => {
|
|
26
|
+
const root = document.createElement('div')
|
|
27
|
+
root.setAttribute('data-app', 'true')
|
|
28
|
+
|
|
29
|
+
const vuetify = new Vuetify()
|
|
30
|
+
const breakpoint = {
|
|
31
|
+
init: jest.fn(),
|
|
32
|
+
framework: {},
|
|
33
|
+
mdAndUp: true,
|
|
34
|
+
}
|
|
35
|
+
if (isMobile) {
|
|
36
|
+
breakpoint.mdAndUp = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vuetify.framework.breakpoint = breakpoint;
|
|
40
|
+
|
|
41
|
+
return render(
|
|
42
|
+
component,
|
|
43
|
+
{
|
|
44
|
+
container: document.body.appendChild(root),
|
|
45
|
+
// for Vuetify components that use the vuetify instance property
|
|
46
|
+
vuetify: vuetify,
|
|
47
|
+
...options,
|
|
48
|
+
mocks: {},
|
|
49
|
+
},
|
|
50
|
+
callback,
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
it("mounts", () => {
|
|
55
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
56
|
+
const {container, getByTestId} = renderWithVuetify(VcExpansionCard, {
|
|
57
|
+
props: props.basic
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
61
|
+
expect(container).toHaveAttribute('data-app', 'true')
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const component = getByTestId('VcExpansionCard');
|
|
65
|
+
expect(component).toBeInTheDocument();
|
|
66
|
+
|
|
67
|
+
//default value true
|
|
68
|
+
const border = container.querySelector('.expansionCard');
|
|
69
|
+
expect(border).toHaveClass('is-active');
|
|
70
|
+
|
|
71
|
+
//default desktop
|
|
72
|
+
const title = container.querySelector('.ec-text')
|
|
73
|
+
expect(title).toHaveClass('order-1');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("mounts mobile", async () => {
|
|
77
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
78
|
+
const {container, getByTestId} = renderWithVuetify(VcExpansionCard, {
|
|
79
|
+
props: props.basic
|
|
80
|
+
}, undefined, true);
|
|
81
|
+
|
|
82
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
83
|
+
expect(container).toHaveAttribute('data-app', 'true')
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const component = getByTestId('VcExpansionCard');
|
|
87
|
+
expect(component).toBeInTheDocument();
|
|
88
|
+
|
|
89
|
+
const title = container.querySelector('.ec-text')
|
|
90
|
+
expect(title).toHaveClass('full-width');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("have title", () => {
|
|
94
|
+
const {getByText} = renderWithVuetify(VcExpansionCard,{props: props.basic})
|
|
95
|
+
const title = getByText('expansion card title');
|
|
96
|
+
expect(title).toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
it("have 2 logos", () => {
|
|
101
|
+
const {container} = renderWithVuetify(VcExpansionCard,{props: props.basic});
|
|
102
|
+
const logo = container.querySelectorAll('.VcLogoImage');
|
|
103
|
+
expect(logo).toHaveLength(2);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("gray border on false value",()=>{
|
|
107
|
+
const {container} = renderWithVuetify(VcExpansionCard,{props: props.valueFalse});
|
|
108
|
+
const border = container.querySelector('.expansionCard');
|
|
109
|
+
expect(border).not.toHaveClass('is-active');
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('active with slot',()=>{
|
|
113
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
114
|
+
const {container,getByText} = renderWithVuetify(VcExpansionCard, {
|
|
115
|
+
props: props.basic,
|
|
116
|
+
slots: {
|
|
117
|
+
content: '<div>content</div>',
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
//default value true
|
|
121
|
+
const border = container.querySelector('.expansionCard');
|
|
122
|
+
expect(border).toHaveClass('is-active');
|
|
123
|
+
|
|
124
|
+
const slotContent = getByText('content');
|
|
125
|
+
expect(slotContent).toBeInTheDocument();
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('event emitted',async () => {
|
|
129
|
+
const {emitted,getByRole} = renderWithVuetify(VcExpansionCard, {
|
|
130
|
+
props: props.basic,
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
const switchName = getByRole('switch');
|
|
134
|
+
expect(switchName).toBeInTheDocument();
|
|
135
|
+
expect(switchName).toHaveAttribute('aria-checked',"true");
|
|
136
|
+
|
|
137
|
+
await fireEvent.click(switchName);
|
|
138
|
+
expect(switchName).toHaveAttribute('aria-checked',"false");
|
|
139
|
+
expect(emitted().input.length).toBe(1);
|
|
140
|
+
|
|
141
|
+
await fireEvent.click(switchName);
|
|
142
|
+
expect(switchName).toHaveAttribute('aria-checked',"true");
|
|
143
|
+
expect(emitted().input.length).toBe(2);
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import VcExpansionCardCmp from './VcExpansionCard.vue';
|
|
2
|
+
|
|
3
|
+
const Template = (args, {argTypes}) => ({
|
|
4
|
+
components: {VcExpansionCard: VcExpansionCardCmp},
|
|
5
|
+
props: Object.keys(argTypes),
|
|
6
|
+
data: () => ({
|
|
7
|
+
itemValue: true,
|
|
8
|
+
}),
|
|
9
|
+
computed: {
|
|
10
|
+
logoAppParam() {
|
|
11
|
+
return require('../../stories/assets/rabbit.svg');
|
|
12
|
+
},
|
|
13
|
+
logoDirectoryParam() {
|
|
14
|
+
return require('../../stories/assets/HeaderImage.svg');
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
template: '<div><VcExpansionCard :disabled="disabled" :value="value" :toLogo="logoAppParam" :fromLogo="logoDirectoryParam" :title="title" /></div>',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const Playground = Template.bind({});
|
|
21
|
+
|
|
22
|
+
// Set default values
|
|
23
|
+
Playground.args = {
|
|
24
|
+
disabled: false,
|
|
25
|
+
value: false,
|
|
26
|
+
title:'text to <b>storybook</b>'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
title: 'Form / VcExpansionCard',
|
|
31
|
+
id: 'VcExpansionCard',
|
|
32
|
+
component: VcExpansionCardCmp,
|
|
33
|
+
parameters: {
|
|
34
|
+
design: {
|
|
35
|
+
type: 'figma',
|
|
36
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=4133%3A39303',
|
|
37
|
+
},
|
|
38
|
+
status: {
|
|
39
|
+
type: 'stable', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
40
|
+
url: 'http://www.url.com/status', // will make the tag a link
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="container" class="expansionCard" :class="{'is-active': value}" :data-qa="dataQa">
|
|
3
|
+
<v-container fluid>
|
|
4
|
+
<div class="d-flex flex-wrap justify-space-between align-center" style="min-width:100%">
|
|
5
|
+
<div class="justify-start d-flex align-center" style="min-width:92px">
|
|
6
|
+
<img class="VcLogoImage" :src="fromLogo">
|
|
7
|
+
<VcIcon size="12">$chevron_left</VcIcon>
|
|
8
|
+
<img class="VcLogoImage" :src="toLogo">
|
|
9
|
+
</div>
|
|
10
|
+
<div class="d-flex justify-end" style="width:initial;" :class="{'order-2':$vuetify.breakpoint.mdAndUp}">
|
|
11
|
+
<VcSwitch
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:ripple="false"
|
|
14
|
+
icon
|
|
15
|
+
v-model="value"
|
|
16
|
+
color="secondary"
|
|
17
|
+
@input="val => $emit('input', Boolean(val))"
|
|
18
|
+
>
|
|
19
|
+
</VcSwitch>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="d-flex flex-wrap ec-text"
|
|
22
|
+
:class="{
|
|
23
|
+
'order-1 justify-start':$vuetify.breakpoint.mdAndUp,
|
|
24
|
+
'full-width':!$vuetify.breakpoint.mdAndUp
|
|
25
|
+
}">
|
|
26
|
+
<div
|
|
27
|
+
class="ec-title"
|
|
28
|
+
v-html="title"
|
|
29
|
+
>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
</div>
|
|
34
|
+
<slot name="content" v-if="value"></slot>
|
|
35
|
+
</v-container>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import VcIcon from '../VcIcon/VcIcon.vue'
|
|
40
|
+
import VcSwitch from '../VcSwitch/VcSwitch.vue';
|
|
41
|
+
export default {
|
|
42
|
+
components: { VcIcon, VcSwitch },
|
|
43
|
+
name: 'VcExpansionCard',
|
|
44
|
+
props: {
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
value: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
toLogo: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: "",
|
|
57
|
+
},
|
|
58
|
+
fromLogo: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: false,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
title: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
dataQa: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'VcExpansionCard'
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style lang="scss">
|
|
76
|
+
|
|
77
|
+
.expansionCard{
|
|
78
|
+
border-radius:6px;
|
|
79
|
+
border: 1px solid;
|
|
80
|
+
border-color: var(--gray-darken-1)!important;
|
|
81
|
+
margin: var(--size-value5) 0;
|
|
82
|
+
|
|
83
|
+
&.is-active{
|
|
84
|
+
border-color: var(--v-secondary-base)!important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& .ec-title {
|
|
88
|
+
font-size: var(--font-size-small2);
|
|
89
|
+
line-height: var(--size-value6);
|
|
90
|
+
margin: var(--size-value3) 0px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
& .vc-chevron-left {
|
|
94
|
+
fill: var(--gray-darken-1) !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
& .VcLogoImage {
|
|
98
|
+
width: var(--size-value7);
|
|
99
|
+
height:var(--size-value7);
|
|
100
|
+
margin: 0px 6px;
|
|
101
|
+
border: 1px solid var(--gray-lighten-1);
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
border-radius: 6px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
& .ec-text{
|
|
107
|
+
&.full-width{
|
|
108
|
+
width: 100%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.order-1{
|
|
112
|
+
flex-grow: 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -3,9 +3,16 @@ import VcSwitch from "./VcSwitch.vue";
|
|
|
3
3
|
import init from "../../../testing-library.config"
|
|
4
4
|
import Vuetify from 'vuetify'
|
|
5
5
|
import {render} from "@testing-library/vue";
|
|
6
|
+
import {fireEvent} from '@testing-library/dom'
|
|
6
7
|
|
|
7
8
|
init();
|
|
8
9
|
|
|
10
|
+
const props = {
|
|
11
|
+
withIcon: {
|
|
12
|
+
icon: true
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
describe("VcSwitch.vue", () => {
|
|
10
17
|
|
|
11
18
|
const renderWithVuetify = (component, options, callback) => {
|
|
@@ -35,4 +42,37 @@ describe("VcSwitch.vue", () => {
|
|
|
35
42
|
expect(container).toHaveAttribute('data-app', 'true')
|
|
36
43
|
});
|
|
37
44
|
|
|
45
|
+
it('with icon',() => {
|
|
46
|
+
const {container} = renderWithVuetify(VcSwitch, {
|
|
47
|
+
props: props.withIcon
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const icon = container.querySelector('.v-icon');
|
|
51
|
+
expect(icon).toBeInTheDocument();
|
|
52
|
+
|
|
53
|
+
const switchContainer = container.querySelector('.switchContainer');
|
|
54
|
+
expect(switchContainer).toHaveClass('with-icon');
|
|
55
|
+
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
it('event emitted',async () => {
|
|
60
|
+
const {emitted,getByRole} = renderWithVuetify(VcSwitch, {
|
|
61
|
+
props: props.basic,
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const switchName = getByRole('switch');
|
|
65
|
+
expect(switchName).toBeInTheDocument();
|
|
66
|
+
expect(switchName).toHaveAttribute('aria-checked',"true");
|
|
67
|
+
|
|
68
|
+
await fireEvent.click(switchName);
|
|
69
|
+
expect(switchName).toHaveAttribute('aria-checked',"false");
|
|
70
|
+
expect(emitted().input.length).toBe(1);
|
|
71
|
+
|
|
72
|
+
await fireEvent.click(switchName);
|
|
73
|
+
expect(switchName).toHaveAttribute('aria-checked',"true");
|
|
74
|
+
expect(emitted().input.length).toBe(2);
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
|
|
38
78
|
});
|
|
@@ -9,7 +9,7 @@ const Template = (args, {argTypes}) => ({
|
|
|
9
9
|
data: () => ({
|
|
10
10
|
itemValue: true,
|
|
11
11
|
}),
|
|
12
|
-
template: '<div><VcSwitch v-model="itemValue" color="secondary" :label="label" :ripple="ripple" :disabled="disabled" @input="onChange"/></div>',
|
|
12
|
+
template: '<div><VcSwitch v-model="itemValue" color="secondary" :label="label" :ripple="ripple" :disabled="disabled" @input="onChange" :icon="icon" /></div>',
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
export const Playground = Template.bind({});
|
|
@@ -20,6 +20,7 @@ Playground.args = {
|
|
|
20
20
|
onChange: action("input"),
|
|
21
21
|
ripple: true,
|
|
22
22
|
disabled: false,
|
|
23
|
+
icon: false,
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const TemplateDisabled = (args, {argTypes}) => ({
|
|
@@ -28,7 +29,7 @@ const TemplateDisabled = (args, {argTypes}) => ({
|
|
|
28
29
|
data: () => ({
|
|
29
30
|
itemValue: true,
|
|
30
31
|
}),
|
|
31
|
-
template: '<div><VcSwitch v-model="itemValue" color="secondary" :label="label" :ripple="ripple" :disabled="disabled" @input="onChange"/></div>',
|
|
32
|
+
template: '<div><VcSwitch v-model="itemValue" color="secondary" :label="label" :ripple="ripple" :disabled="disabled" @input="onChange" :icon="icon" /></div>',
|
|
32
33
|
})
|
|
33
34
|
|
|
34
35
|
export const Disabled = TemplateDisabled.bind({});
|
|
@@ -70,6 +71,16 @@ LabelInSlot.args = {
|
|
|
70
71
|
disabled: false,
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
export const WithIcon = Template.bind({});
|
|
75
|
+
|
|
76
|
+
// Set default values
|
|
77
|
+
WithIcon.args = {
|
|
78
|
+
value: true,
|
|
79
|
+
onChange: action("input"),
|
|
80
|
+
disabled: false,
|
|
81
|
+
icon: true,
|
|
82
|
+
}
|
|
83
|
+
|
|
73
84
|
export default {
|
|
74
85
|
title: 'Form / VcSwitch',
|
|
75
86
|
id: 'VcSwitch',
|
|
@@ -84,4 +95,4 @@ export default {
|
|
|
84
95
|
url: 'http://www.url.com/status', // will make the tag a link
|
|
85
96
|
},
|
|
86
97
|
},
|
|
87
|
-
};
|
|
98
|
+
};
|