@vcita/design-system 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/config/locales/ds.en.yml +8 -1
- package/config/locales/ds.he.yml +3 -0
- package/dist/@vcita/design-system.esm.js +1652 -958
- package/dist/@vcita/design-system.min.js +2 -2
- package/dist/@vcita/design-system.ssr.js +1468 -854
- package/init/DesignSystem.js +2 -0
- package/init/SvgIcons.js +12 -2
- package/package.json +1 -1
- package/src/components/VcAvatar/VcAvatar.stories.js +0 -1
- package/src/components/VcBreadcrumbs/VcBreadcrumbs.spec.js +82 -0
- package/src/components/VcBreadcrumbs/VcBreadcrumbs.stories.js +86 -0
- package/src/components/VcBreadcrumbs/VcBreadcrumbs.vue +59 -0
- package/src/components/VcButton/VcButton.stories.js +13 -2
- package/src/components/VcButton/VcButton.vue +16 -7
- package/src/components/VcGalleryItem/VcGalleryItem.spec.js +120 -0
- package/src/components/VcGalleryItem/VcGalleryItem.stories.js +94 -0
- package/src/components/VcGalleryItem/VcGalleryItem.vue +161 -0
- package/src/components/VcGalleryList/VcGalleryList.spec.js +86 -0
- package/src/components/VcGalleryList/VcGalleryList.stories.js +63 -0
- package/src/components/VcGalleryList/VcGalleryList.vue +102 -0
- package/src/components/VcGalleryList/mockData.js +50 -0
- package/src/components/VcLink/VcLink.vue +13 -1
- package/src/components/VcMiniBanner/VcMiniBanner.spec.js +74 -0
- package/src/components/VcMiniBanner/VcMiniBanner.stories.js +75 -0
- package/src/components/VcMiniBanner/VcMiniBanner.vue +129 -0
- package/src/components/VcSearchPicker/VcSearchPicker.vue +12 -5
- package/src/components/VcSideNav/VcSideNav.vue +2 -0
- package/src/components/VcTextField/VcTextField.stories.js +2 -1
- package/src/components/VcUpsellBlock/VcUpsellBlock.stories.js +7 -2
- package/src/components/VcUpsellBlock/VcUpsellBlock.vue +3 -0
- package/src/components/index.js +5 -0
- package/src/components/list/VcList/pattern/VcMobilePickerPattern.stories.js +3 -0
- package/src/components/modal/elements/VcModalContainer.stories.js +6 -0
- package/src/components/modal/elements/VcModalContainer.vue +7 -14
- package/src/components/page/elements/VcPageHeader.spec.js +123 -0
- package/src/components/page/elements/VcPageHeader.stories.js +80 -0
- package/src/components/page/elements/VcPageHeader.vue +96 -0
- package/src/components/page/layouts/SideNavPage/SideNavLayout.stories.js +223 -0
- package/src/components/page/layouts/centeredPage/CenteredPageLayout.stories.js +162 -0
- package/src/stories/assets/app-market/fc.svg +31 -0
- package/src/stories/assets/app-market/google.svg +1 -0
- package/src/stories/assets/app-market/qb.svg +9 -0
- package/src/stories/assets/app-market/stripe.svg +1 -0
- package/src/stories/assets/app-market/zapier.svg +1 -0
- package/src/stories/assets/pics/gallery-item-1.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-2.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-3.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-4.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-5.jpg +0 -0
- package/src/stories/variables.stories.mdx +9 -2
- package/styles/variables.scss +9 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/VcMenu/.DS_Store +0 -0
package/init/DesignSystem.js
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
VTab,
|
|
48
48
|
VTabsItems,
|
|
49
49
|
VTabItem,
|
|
50
|
+
VBreadcrumbs,
|
|
50
51
|
} from "vuetify/lib/components";
|
|
51
52
|
// import initI18n from "./initI18n";
|
|
52
53
|
import svgImages from "./svgImages";
|
|
@@ -98,6 +99,7 @@ Vue.use(Vuetify, {
|
|
|
98
99
|
VTab,
|
|
99
100
|
VTabsItems,
|
|
100
101
|
VTabItem,
|
|
102
|
+
VBreadcrumbs,
|
|
101
103
|
}
|
|
102
104
|
});
|
|
103
105
|
|
package/init/SvgIcons.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When adding items to this file, please test them using the VcIcon component.
|
|
3
|
+
* Please make sure that setting the color property takes the appropriate effect.
|
|
4
|
+
* For most icons this means that they use the color as set in the prop.
|
|
5
|
+
* For some cases, the color should not have any effect, for example logos.
|
|
6
|
+
*
|
|
7
|
+
* If the color doesn't work as needed, remove the "fill" attributes in the svg
|
|
8
|
+
* until you arrive at the desired result.
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
export default {
|
|
2
12
|
flag: `<svg viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 12C1.81066 12 2.06249 11.7481 2.06249 11.4375V9.22496C2.72602 8.94223 3.5527 8.70648 4.74455 8.70648C6.00054 8.70648 7.03778 9.52171 8.61683 9.52171C9.74579 9.52171 10.6481 9.13982 11.488 8.56411C11.6915 8.42463 11.8125 8.19305 11.8125 7.94634V2.24871C11.8125 1.70042 11.2437 1.33769 10.7464 1.56863C9.94162 1.94242 8.95452 2.31522 8.00542 2.31522C6.74946 2.31522 5.71219 1.49999 4.13314 1.49999C3.54825 1.49999 3.02435 1.60274 2.53834 1.78154C2.5862 1.65657 2.62504 1.4465 2.62504 1.31265C2.62504 1.28963 2.62385 1.2523 2.62238 1.22932C2.58087 0.562837 2.0345 0.0282617 1.36729 0.00111634C0.617453 -0.0293935 0 0.569429 0 1.31249C0 1.75842 0.222587 2.15214 0.562499 2.38933V11.4375C0.562499 11.7481 0.814337 12 1.125 12H1.5Z"/></svg>`,
|
|
3
13
|
customer: `<svg viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.47508 3.49999C8.47508 4.88085 7.35595 5.99999 5.97509 5.99999C4.59423 5.99999 3.47509 4.88085 3.47509 3.49999C3.47509 2.11913 4.59423 1 5.97509 1C7.35595 1 8.47508 2.11913 8.47508 3.49999ZM10.3501 10.0625C10.3501 10.5801 9.93016 11 9.41258 11H2.5376C2.02002 11 1.6001 10.5801 1.6001 10.0625V9.24999C1.6001 7.80077 2.77588 6.62499 4.2251 6.62499H4.55125C4.98682 6.82421 5.46728 6.93749 5.97509 6.93749C6.4829 6.93749 6.96532 6.82421 7.39892 6.62499H7.72508C9.17429 6.62499 10.3501 7.80077 10.3501 9.24999V10.0625Z"/></svg>`,
|
|
@@ -23,8 +33,8 @@ export default {
|
|
|
23
33
|
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>`,
|
|
24
34
|
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>`,
|
|
25
35
|
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>',
|
|
26
|
-
chevron_right: `<svg class="vc-chevron-right" viewBox="0 0 12 12"
|
|
27
|
-
chevron_left: `<svg viewBox="0 0 12 12"
|
|
36
|
+
chevron_right: `<svg class="vc-chevron-right" viewBox="0 0 12 12" 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>`,
|
|
37
|
+
chevron_left: `<svg viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.38826 11.0964L5.85229 10.6323C5.96213 10.5225 5.96213 10.3444 5.85229 10.2346L1.61717 5.98938L5.85229 1.74416C5.96213 1.63432 5.96213 1.45625 5.85229 1.34641L5.38826 0.882351C5.27844 0.772533 5.10035 0.772533 4.99051 0.882351L0.0823801 5.7905C-0.02746 5.90034 -0.02746 6.07841 0.0823801 6.18828L4.99051 11.0964C5.10035 11.2062 5.27844 11.2062 5.38826 11.0964Z"/></svg>`,
|
|
28
38
|
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>`,
|
|
29
39
|
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>`,
|
|
30
40
|
trash: `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.75 2H11.5L10.4375 0.625C10.1875 0.28125 9.65625 0 9.25 0H6.75C6.3125 0 5.78125 0.28125 5.53125 0.625L4.5 2H1.25C1.09375 2 1 2.125 1 2.25V2.75C1 2.90625 1.09375 3 1.25 3H2V14.5C2 15.3438 2.65625 16 3.5 16H12.5C13.3125 16 14 15.3438 14 14.5V3H14.75C14.875 3 15 2.90625 15 2.75V2.25C15 2.125 14.875 2 14.75 2ZM5.75 13.5H5.25C5.09375 13.5 5 13.4062 5 13.25V4.75C5 4.625 5.09375 4.5 5.25 4.5H5.75C5.875 4.5 6 4.625 6 4.75V13.25C6 13.4062 5.875 13.5 5.75 13.5ZM10.75 13.5H10.25C10.0938 13.5 10 13.4062 10 13.25V4.75C10 4.625 10.0938 4.5 10.25 4.5H10.75C10.875 4.5 11 4.625 11 4.75V13.25C11 13.4062 10.875 13.5 10.75 13.5ZM6.75 1C6.59375 1.03125 6.40625 1.09375 6.34375 1.21875L5.75 2H10.25L9.625 1.21875C9.5625 1.09375 9.375 1.03125 9.25 1H6.75ZM13 14.5C13 14.7812 12.75 15 12.5 15H3.5C3.21875 15 3 14.7812 3 14.5V3H13V14.5ZM8.25 13.5H7.75C7.59375 13.5 7.5 13.4062 7.5 13.25V4.75C7.5 4.625 7.59375 4.5 7.75 4.5H8.25C8.375 4.5 8.5 4.625 8.5 4.75V13.25C8.5 13.4062 8.375 13.5 8.25 13.5Z" fill="black"/></svg>`,
|
package/package.json
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcBreadcrumbs from "./VcBreadcrumbs.vue";
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
import Vuetify from 'vuetify'
|
|
5
|
+
import {render} from "@testing-library/vue";
|
|
6
|
+
import init from "../../../testing-library.config";
|
|
7
|
+
import userEvent from '@testing-library/user-event';
|
|
8
|
+
|
|
9
|
+
init();
|
|
10
|
+
|
|
11
|
+
Vue.use(Vuetify)
|
|
12
|
+
|
|
13
|
+
describe("VcBreadcrumbs.vue", () => {
|
|
14
|
+
|
|
15
|
+
const renderWithVuetify = (component, options, callback, isMobile = false) => {
|
|
16
|
+
const root = document.createElement('div')
|
|
17
|
+
root.setAttribute('data-app', 'true')
|
|
18
|
+
|
|
19
|
+
const vuetify = new Vuetify()
|
|
20
|
+
if (isMobile) {
|
|
21
|
+
const breakpoint = {
|
|
22
|
+
init: jest.fn(),
|
|
23
|
+
framework: {},
|
|
24
|
+
smAndDown: true,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vuetify.framework.breakpoint = breakpoint;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return render(
|
|
31
|
+
component,
|
|
32
|
+
{
|
|
33
|
+
container: document.body.appendChild(root),
|
|
34
|
+
// for Vuetify components that use the vuetify instance property
|
|
35
|
+
vuetify,
|
|
36
|
+
...options,
|
|
37
|
+
mocks: {
|
|
38
|
+
$t: value => value,
|
|
39
|
+
$dst: value => value, // <- for the design system
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
callback,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
it("mounts", () => {
|
|
47
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
48
|
+
const {container, getByTestId, getByText} = renderWithVuetify(VcBreadcrumbs, {
|
|
49
|
+
props: {
|
|
50
|
+
items: [
|
|
51
|
+
{
|
|
52
|
+
text: 'item 1',
|
|
53
|
+
disabled: false,
|
|
54
|
+
href: 'item_1',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
text: 'item 2',
|
|
58
|
+
disabled: false,
|
|
59
|
+
href: 'item_2',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
text: 'item 3',
|
|
63
|
+
disabled: false,
|
|
64
|
+
href: 'item_3',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
71
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
72
|
+
|
|
73
|
+
// Make sure the component has the data-qa attribute
|
|
74
|
+
const component = getByTestId('VcBreadcrumbs');
|
|
75
|
+
expect(component).toBeInTheDocument();
|
|
76
|
+
|
|
77
|
+
expect(getByText('item 1')).toBeInTheDocument();
|
|
78
|
+
expect(getByText('item 2')).toBeInTheDocument();
|
|
79
|
+
expect(getByText('item 3')).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import VcBreadcrumbsCmp from './VcBreadcrumbs';
|
|
2
|
+
import VcBaseDocs from '@/stories/VcBaseDocs.mdx';
|
|
3
|
+
|
|
4
|
+
const baseProps = {
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
text: 'item 1',
|
|
8
|
+
disabled: false,
|
|
9
|
+
href: 'item_1',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
text: 'item 2',
|
|
13
|
+
disabled: false,
|
|
14
|
+
href: 'item_2',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: 'item 3',
|
|
18
|
+
disabled: false,
|
|
19
|
+
href: 'item_3',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
dataQa: 'VcBreadcrumbs',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Template = (args, {argTypes}) => ({
|
|
26
|
+
components: {VcBreadcrumbs: VcBreadcrumbsCmp},
|
|
27
|
+
props: Object.keys(argTypes),
|
|
28
|
+
template: `
|
|
29
|
+
<div>
|
|
30
|
+
This is component was created for the SettingPagePattern story, it is *not* final
|
|
31
|
+
<VcBreadcrumbs :items="items" @click="onClick" :data-qa="dataQa"/>
|
|
32
|
+
</div>`,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const Playground = Template.bind({});
|
|
36
|
+
|
|
37
|
+
// Set default values
|
|
38
|
+
Playground.args = {
|
|
39
|
+
...baseProps,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Disabled = Template.bind({});
|
|
43
|
+
|
|
44
|
+
// Set default values
|
|
45
|
+
Disabled.args = {
|
|
46
|
+
...baseProps,
|
|
47
|
+
items: [
|
|
48
|
+
{
|
|
49
|
+
text: 'item 1',
|
|
50
|
+
disabled: true,
|
|
51
|
+
href: 'item_1',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
text: 'item 2',
|
|
55
|
+
disabled: true,
|
|
56
|
+
href: 'item_2',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
text: 'item 3',
|
|
60
|
+
disabled: true,
|
|
61
|
+
href: 'item_3',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
title: 'controls / VcBreadcrumbs', // This will control the story sidebar position
|
|
68
|
+
id: 'VcBreadcrumbs', // This will be the permanent link to this component
|
|
69
|
+
component: VcBreadcrumbsCmp,
|
|
70
|
+
argTypes: {
|
|
71
|
+
onClick: {action: 'click', table: {disable: true}},
|
|
72
|
+
},
|
|
73
|
+
parameters: {
|
|
74
|
+
design: {
|
|
75
|
+
type: 'figma',
|
|
76
|
+
url: 'https://www.figma.com',
|
|
77
|
+
},
|
|
78
|
+
status: {
|
|
79
|
+
type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
80
|
+
url: 'https://vuetifyjs.com/en/components/breadcrumbs', // will make the tag a link
|
|
81
|
+
},
|
|
82
|
+
docs: {
|
|
83
|
+
page: VcBaseDocs,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-breadcrumbs :items="items" :data-qa="dataQa" class="VcBreadcrumbs">
|
|
3
|
+
<template #divider>
|
|
4
|
+
<VcIcon size="6">$chevron_right</VcIcon>
|
|
5
|
+
</template>
|
|
6
|
+
<template #item="{item}">
|
|
7
|
+
<VcLink secondary :label="item.text" :url="item.href" :disabled="item.disabled" :data-qa="`${dataQa}-${item.text}`"></VcLink>
|
|
8
|
+
</template>
|
|
9
|
+
</v-breadcrumbs>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import VcIcon from "@/components/VcIcon/VcIcon.vue";
|
|
14
|
+
import VcLink from "@/components/VcLink/VcLink.vue";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "VcBreadcrumbs",
|
|
18
|
+
components: {VcLink, VcIcon},
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* The options for each item:
|
|
22
|
+
* disabled: boolean,
|
|
23
|
+
* exact: boolean,
|
|
24
|
+
* href: string,
|
|
25
|
+
* link: boolean,
|
|
26
|
+
* text: string | number,
|
|
27
|
+
* to: string | object
|
|
28
|
+
*/
|
|
29
|
+
items: {
|
|
30
|
+
type: Array,
|
|
31
|
+
required: true,
|
|
32
|
+
validator: items => items.every(item => item.text)
|
|
33
|
+
},
|
|
34
|
+
dataQa: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'VcBreadcrumbs'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style lang="scss" scoped>
|
|
43
|
+
|
|
44
|
+
.VcBreadcrumbs {
|
|
45
|
+
padding: 0;
|
|
46
|
+
|
|
47
|
+
::v-deep {
|
|
48
|
+
a {
|
|
49
|
+
font-size: var(--font-size-xx-small);
|
|
50
|
+
color: var(--gray-darken-3);
|
|
51
|
+
|
|
52
|
+
&:last-child label {
|
|
53
|
+
color: var(--gray-darken-5);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import VcButtonCmp from './VcButton';
|
|
2
2
|
import VcIcon from "@/components/VcIcon/VcIcon";
|
|
3
3
|
import VcButtonDocs from './VcButtonDocs.mdx';
|
|
4
|
+
import icons from "../../../init/SvgIcons";
|
|
4
5
|
|
|
5
6
|
const baseProps = {
|
|
6
7
|
label: 'label',
|
|
@@ -18,6 +19,8 @@ const baseProps = {
|
|
|
18
19
|
disabled: false,
|
|
19
20
|
href: '',
|
|
20
21
|
prependDefaultIcon: false,
|
|
22
|
+
prependIcon: 'plus',
|
|
23
|
+
iconSize: 16,
|
|
21
24
|
plain: false,
|
|
22
25
|
block: false,
|
|
23
26
|
ripple: false,
|
|
@@ -46,6 +49,8 @@ const GeneralTemplate = (args, {argTypes}) => ({
|
|
|
46
49
|
:disabled="disabled"
|
|
47
50
|
:href="href"
|
|
48
51
|
:prepend-default-icon="prependDefaultIcon"
|
|
52
|
+
:prepend-icon="prependIcon"
|
|
53
|
+
:icon-size="iconSize"
|
|
49
54
|
@click="onClick">
|
|
50
55
|
{{ label }}
|
|
51
56
|
</VcButton>
|
|
@@ -196,7 +201,7 @@ const TemplateWithIcon = (args, {argTypes}) => ({
|
|
|
196
201
|
:loading="loading"
|
|
197
202
|
@click="onClick">{{ label }}
|
|
198
203
|
<template #prepend>
|
|
199
|
-
<VcIcon>$check_circle</VcIcon>
|
|
204
|
+
<VcIcon color="currentColor">$check_circle</VcIcon>
|
|
200
205
|
</template>
|
|
201
206
|
</VcButton>
|
|
202
207
|
</div>`,
|
|
@@ -206,6 +211,7 @@ export const WithIcon = TemplateWithIcon.bind({});
|
|
|
206
211
|
|
|
207
212
|
// Set default values
|
|
208
213
|
WithIcon.args = {
|
|
214
|
+
...baseProps,
|
|
209
215
|
label: 'Add Item',
|
|
210
216
|
}
|
|
211
217
|
|
|
@@ -255,12 +261,12 @@ export const Flavor = TemplateFlavor.bind({});
|
|
|
255
261
|
|
|
256
262
|
// Set default values
|
|
257
263
|
Flavor.args = {
|
|
264
|
+
...baseProps,
|
|
258
265
|
flavor: 'primary',
|
|
259
266
|
outlined: true,
|
|
260
267
|
label: 'flavor'
|
|
261
268
|
}
|
|
262
269
|
|
|
263
|
-
|
|
264
270
|
export default {
|
|
265
271
|
title: 'Action / VcButton',
|
|
266
272
|
id: 'VcButton',
|
|
@@ -271,6 +277,11 @@ export default {
|
|
|
271
277
|
href: {table: {category: 'Button Content', subcategory: 'Text'}},
|
|
272
278
|
icon: {table: {category: 'Button Content', subcategory: 'Icon'}},
|
|
273
279
|
prependDefaultIcon: {table: {category: 'Button Content', subcategory: 'Icon'}},
|
|
280
|
+
prependIcon: {
|
|
281
|
+
options: Object.keys(icons),
|
|
282
|
+
control: {type: 'select'},
|
|
283
|
+
table: {category: 'Button Content', subcategory: 'Icon'}},
|
|
284
|
+
iconSize: {table: {category: 'Button Content', subcategory: 'Icon'}},
|
|
274
285
|
color: {
|
|
275
286
|
options: ['white', 'secondary'],
|
|
276
287
|
control: {type: 'radio'},
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
@click="$emit('click')"
|
|
25
25
|
>
|
|
26
26
|
<slot name="prepend">
|
|
27
|
-
<VcIcon v-if="prependDefaultIcon"
|
|
28
|
-
|
|
29
|
-
>
|
|
27
|
+
<VcIcon v-if="prependDefaultIcon" color="currentColor"
|
|
28
|
+
:class="{prependDefaultIcon: !icon}" :size="iconSize">{{getPrependIcon}}</VcIcon>
|
|
30
29
|
</slot>
|
|
31
30
|
{{ label || ($slots.default && $slots.default[0].text) || "" }}
|
|
32
31
|
<slot name="append" />
|
|
@@ -101,6 +100,9 @@ export default {
|
|
|
101
100
|
type: Boolean,
|
|
102
101
|
default: false
|
|
103
102
|
},
|
|
103
|
+
/**
|
|
104
|
+
* The button will contain an icon and no text
|
|
105
|
+
*/
|
|
104
106
|
icon: {
|
|
105
107
|
type: Boolean,
|
|
106
108
|
default: false,
|
|
@@ -144,6 +146,14 @@ export default {
|
|
|
144
146
|
type: Boolean,
|
|
145
147
|
default: false,
|
|
146
148
|
},
|
|
149
|
+
prependIcon: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: 'plus',
|
|
152
|
+
},
|
|
153
|
+
iconSize: {
|
|
154
|
+
type: Number,
|
|
155
|
+
default: 16,
|
|
156
|
+
},
|
|
147
157
|
dataQa: {
|
|
148
158
|
type: String,
|
|
149
159
|
default: "vc-btn",
|
|
@@ -158,6 +168,9 @@ export default {
|
|
|
158
168
|
return this.outlined ? '--gray-darken-5' : '--neutral-lighten-2';
|
|
159
169
|
}
|
|
160
170
|
},
|
|
171
|
+
getPrependIcon() {
|
|
172
|
+
return `$${this.prependIcon}`;
|
|
173
|
+
}
|
|
161
174
|
},
|
|
162
175
|
};
|
|
163
176
|
</script>
|
|
@@ -173,10 +186,6 @@ export default {
|
|
|
173
186
|
|
|
174
187
|
.prependDefaultIcon {
|
|
175
188
|
margin-inline-end: var(--size-value3);
|
|
176
|
-
|
|
177
|
-
::v-deep svg {
|
|
178
|
-
fill: currentColor;
|
|
179
|
-
}
|
|
180
189
|
}
|
|
181
190
|
|
|
182
191
|
&.secondary__text {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcGalleryItem from './VcGalleryItem.vue';
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import { render } from '@testing-library/vue';
|
|
5
|
+
import init from '../../../testing-library.config';
|
|
6
|
+
import { fireEvent } from "@testing-library/dom";
|
|
7
|
+
|
|
8
|
+
init();
|
|
9
|
+
|
|
10
|
+
const baseProps = {
|
|
11
|
+
uid: '1a',
|
|
12
|
+
label: 'Correct item label',
|
|
13
|
+
isMobile: false,
|
|
14
|
+
isCreate: false,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe('VcGalleryItem.vue', () => {
|
|
18
|
+
|
|
19
|
+
const renderWithVuetify = (options, callback) => {
|
|
20
|
+
const root = document.createElement('div')
|
|
21
|
+
root.setAttribute('data-app', 'true')
|
|
22
|
+
|
|
23
|
+
return render(
|
|
24
|
+
VcGalleryItem,
|
|
25
|
+
{
|
|
26
|
+
container: document.body.appendChild(root),
|
|
27
|
+
vuetify: new Vuetify(),
|
|
28
|
+
...options,
|
|
29
|
+
mocks: {$dst: value => value},
|
|
30
|
+
},
|
|
31
|
+
callback,
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
it('Mounts', () => {
|
|
36
|
+
const {container} = renderWithVuetify({
|
|
37
|
+
props: baseProps
|
|
38
|
+
})
|
|
39
|
+
expect(container).toHaveAttribute('data-app', 'true')
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('Displays slot content', async () => {
|
|
43
|
+
const labelSlotContent = 'label slot content';
|
|
44
|
+
const buttonSlotContent = 'slot-button';
|
|
45
|
+
const {queryByText, getByTestId} = renderWithVuetify({
|
|
46
|
+
props: baseProps,
|
|
47
|
+
slots: {
|
|
48
|
+
actions: `<div>${buttonSlotContent}</div>`,
|
|
49
|
+
label: `<div>${labelSlotContent}</div>`,
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
expect(queryByText(labelSlotContent)).toBeInTheDocument();
|
|
53
|
+
const VcGalleryItem = getByTestId('VcGalleryItem');
|
|
54
|
+
await fireEvent.mouseEnter(VcGalleryItem);
|
|
55
|
+
expect(queryByText(buttonSlotContent)).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('Button events emission', async () => {
|
|
59
|
+
const {getByTestId, emitted} = renderWithVuetify({
|
|
60
|
+
props: baseProps
|
|
61
|
+
})
|
|
62
|
+
const VcGalleryItem = getByTestId('VcGalleryItem');
|
|
63
|
+
await fireEvent.mouseEnter(VcGalleryItem);
|
|
64
|
+
const selectBtn = getByTestId('VcGalleryItem-select-btn')
|
|
65
|
+
const previewBtn = getByTestId('VcGalleryItem-preview-btn')
|
|
66
|
+
await fireEvent.click(selectBtn)
|
|
67
|
+
await fireEvent.click(previewBtn)
|
|
68
|
+
expect(emitted().onSelect.length).toBe(1)
|
|
69
|
+
expect(emitted().onPreview.length).toBe(1)
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('Mobile events emission', async () => {
|
|
73
|
+
const {getByTestId, emitted, updateProps} = renderWithVuetify({
|
|
74
|
+
props: Object.assign(baseProps, { isMobile: true })
|
|
75
|
+
})
|
|
76
|
+
const thumbnail = getByTestId('VcGalleryItem-thumbnail');
|
|
77
|
+
await fireEvent.click(thumbnail);
|
|
78
|
+
expect(emitted().onExpend.length).toBe(1);
|
|
79
|
+
await updateProps({ isMobile: false })
|
|
80
|
+
await fireEvent.click(thumbnail);
|
|
81
|
+
expect(emitted().onExpend.length).toBe(1);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('Displays correct label', async () => {
|
|
85
|
+
const {queryByText, updateProps} = renderWithVuetify({
|
|
86
|
+
props: baseProps
|
|
87
|
+
})
|
|
88
|
+
expect(queryByText(baseProps.label)).toBeInTheDocument();
|
|
89
|
+
expect(queryByText(baseProps.label.repeat(2))).toBeNull();
|
|
90
|
+
await updateProps({label: baseProps.label.repeat(2)})
|
|
91
|
+
expect(queryByText(baseProps.label.repeat(2))).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
it('Toggle isCreate modifier class', async () => {
|
|
96
|
+
const {getByTestId, updateProps} = renderWithVuetify({
|
|
97
|
+
props: baseProps
|
|
98
|
+
})
|
|
99
|
+
const VcGalleryItem = getByTestId('VcGalleryItem');
|
|
100
|
+
expect(VcGalleryItem).not.toHaveClass('vc-gallery-item--is-create');
|
|
101
|
+
await fireEvent.mouseEnter(VcGalleryItem);
|
|
102
|
+
await updateProps({ isCreate: true })
|
|
103
|
+
expect(VcGalleryItem).toHaveClass('vc-gallery-item--is-create');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('Fires onCreate event', async () => {
|
|
107
|
+
const {getByTestId, updateProps, emitted} = renderWithVuetify({
|
|
108
|
+
props: Object.assign(baseProps, { isCreate: true })
|
|
109
|
+
})
|
|
110
|
+
const VcGalleryItem = getByTestId('VcGalleryItem');
|
|
111
|
+
const thumbnail = getByTestId('VcGalleryItem-thumbnail');
|
|
112
|
+
await fireEvent.mouseEnter(VcGalleryItem);
|
|
113
|
+
await fireEvent.click(thumbnail)
|
|
114
|
+
expect(emitted().onCreate.length).toBe(1)
|
|
115
|
+
await updateProps({ isCreate: false })
|
|
116
|
+
await fireEvent.click(thumbnail)
|
|
117
|
+
expect(emitted().onCreate.length).toBe(1)
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import VcGalleryItemCmp from './VcGalleryItem';
|
|
2
|
+
import VcButton from '../VcButton/VcButton';
|
|
3
|
+
import VcIcon from '../VcIcon/VcIcon';
|
|
4
|
+
|
|
5
|
+
const baseProps = {
|
|
6
|
+
isMobile: false,
|
|
7
|
+
uid: '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bef',
|
|
8
|
+
isCreate: false,
|
|
9
|
+
dataQa: 'VcGalleryItem',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Template = (args, {argTypes}) => ({
|
|
13
|
+
components: { VcGalleryItem: VcGalleryItemCmp, VcButton, VcIcon },
|
|
14
|
+
props: Object.keys(argTypes),
|
|
15
|
+
template: `<div>
|
|
16
|
+
<div class="description" :style="{margin: '20px 0'}">
|
|
17
|
+
<h4 :style="{margin: '8px 0'}">
|
|
18
|
+
This component functions as a list/grid item and is meant to show inner content.
|
|
19
|
+
</h4>
|
|
20
|
+
<h4 :style="{fontWeight: 400}">
|
|
21
|
+
It keeps a specific ratio while it's text is flushed beneath.<br />
|
|
22
|
+
It presents control-buttons layer on hover, and a simplified click-action on mobile.<br />
|
|
23
|
+
It's slots api label and actions modularity.<br />
|
|
24
|
+
When 'isCreate' is passed as true, it functions as a 'new-item' button. <br />
|
|
25
|
+
</h4>
|
|
26
|
+
</div>
|
|
27
|
+
<VcGalleryItem :isMobile="isMobile"
|
|
28
|
+
:uid="uid"
|
|
29
|
+
:src="src"
|
|
30
|
+
:label="label"
|
|
31
|
+
:dataQa="dataQa"
|
|
32
|
+
:isCreate="isCreate"
|
|
33
|
+
@onSelect="onSelect"
|
|
34
|
+
@onPreview="onPreview"
|
|
35
|
+
@onExpend="onExpend"
|
|
36
|
+
@onCreate="onCreate"
|
|
37
|
+
>
|
|
38
|
+
<template #actions v-if="actionsSlotContent">
|
|
39
|
+
${args.actionsSlotContent}
|
|
40
|
+
</template>
|
|
41
|
+
<template #label v-if="labelSlotContent">
|
|
42
|
+
${args.labelSlotContent}
|
|
43
|
+
</template>
|
|
44
|
+
</VcGalleryItem>
|
|
45
|
+
</div>
|
|
46
|
+
`,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
export const Playground = Template.bind({});
|
|
50
|
+
Playground.args = {
|
|
51
|
+
...baseProps,
|
|
52
|
+
src: require('@/stories/assets/pics/gallery-item-1.jpg'),
|
|
53
|
+
label: 'Thank’s for your application',
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export const LabelSlotContent = Template.bind({});
|
|
58
|
+
LabelSlotContent.args = {
|
|
59
|
+
...baseProps,
|
|
60
|
+
src: require('@/stories/assets/pics/gallery-item-2.jpg'),
|
|
61
|
+
labelSlotContent: `<span :style="{color: 'green'}">Slot content label</span>`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export const ActionsSlotContent = Template.bind({});
|
|
66
|
+
ActionsSlotContent.args = {
|
|
67
|
+
...baseProps,
|
|
68
|
+
src: require('@/stories/assets/pics/gallery-item-3.jpg'),
|
|
69
|
+
label: 'Thank’s for your application',
|
|
70
|
+
actionsSlotContent: `<VcButton @click="$emit('onSelect')" flavor="primary" label="Yes" class="buttons__select">
|
|
71
|
+
<template #prepend><VcIcon :style="{ marginRight: '12px' }">$check_circle</VcIcon></template>
|
|
72
|
+
</VcButton>`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const CreateItem = Template.bind({});
|
|
76
|
+
CreateItem.args = {
|
|
77
|
+
...baseProps,
|
|
78
|
+
isCreate: true,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
title: 'Content display / VcGalleryItem',
|
|
83
|
+
id: 'VcGalleryItem',
|
|
84
|
+
component: VcGalleryItemCmp,
|
|
85
|
+
parameters: {
|
|
86
|
+
design: {
|
|
87
|
+
type: 'figma',
|
|
88
|
+
url: 'https://www.figma.com/file/7FONyMxCo0nkhyz013Xmai/Campaign-editor?node-id=1504%3A205665',
|
|
89
|
+
},
|
|
90
|
+
status: {
|
|
91
|
+
type: 'stable', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|