srcdev-nuxt-components 6.0.0 → 6.1.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/README.md +2 -2
- package/app/assets/styles/extends-layer/srcdev-components/components/_display-prompt-core.css +72 -0
- package/app/assets/styles/extends-layer/srcdev-components/components/index.css +1 -0
- package/app/assets/styles/extends-layer/srcdev-components/index.css +2 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/index.css +1 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_error.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_info.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_secondary.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_success.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_warning.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/index.css +5 -0
- package/app/assets/styles/main.css +2 -0
- package/app/assets/styles/setup/_head.css +36 -0
- package/app/assets/styles/setup/a11y/_utils.css +20 -0
- package/app/assets/styles/setup/a11y/_variables.css +8 -0
- package/app/assets/styles/setup/a11y/index.css +2 -0
- package/app/assets/styles/setup/index.css +5 -0
- package/app/assets/styles/setup/typography/index.css +2 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-classes.css +217 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-variation-settings.css +29 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-weights.css +39 -0
- package/app/assets/styles/setup/typography/utility-classes/index.css +3 -0
- package/app/assets/styles/setup/typography/vars/_colors.css +14 -0
- package/app/assets/styles/setup/typography/vars/_reponsive-font-sizes.css +12 -0
- package/app/assets/styles/setup/typography/vars/index.css +2 -0
- package/app/assets/styles/setup/utility-classes/_fluid-spacing.css +13 -0
- package/app/assets/styles/setup/utility-classes/animations/_auto-rotate.css +13 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-exit-blur.css +16 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-slide-in.css +15 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-zoom-reveal.css +15 -0
- package/app/assets/styles/setup/utility-classes/animations/index.css +4 -0
- package/app/assets/styles/setup/utility-classes/index.css +2 -0
- package/app/assets/styles/setup/variables/colors/_blue.css +15 -0
- package/app/assets/styles/setup/variables/colors/_gray.css +16 -0
- package/app/assets/styles/setup/variables/colors/_green.css +15 -0
- package/app/assets/styles/setup/variables/colors/_orange.css +15 -0
- package/app/assets/styles/setup/variables/colors/_red.css +15 -0
- package/app/assets/styles/setup/variables/colors/_yellow.css +15 -0
- package/app/assets/styles/setup/variables/colors/index.css +6 -0
- package/app/assets/styles/setup/variables/index.css +1 -0
- package/app/components/accordian/AccordianCore.vue +53 -0
- package/app/components/animated-svg-text/AnimatedSvgText.vue +87 -0
- package/app/components/canvas-switcher/CanvasSwitcher.vue +77 -0
- package/app/components/carousel-basic/CarouselBasic.vue +291 -0
- package/app/components/carousel-basic/CarouselFlip.vue +461 -0
- package/app/components/carousel-basic/CarouselInfinite.vue +325 -0
- package/app/components/clip-element/ClipElement.vue +73 -0
- package/app/components/clipped-panels/ClippedPanel.vue +73 -0
- package/app/components/container-glow/ContainerGlowCore.vue +211 -0
- package/app/components/content-grid/ContentGrid.vue +85 -0
- package/app/components/deep-expanding-menu/DeepExpandingMenu.vue +214 -0
- package/app/components/deep-expanding-menu/DeepExpandingMenuOld.vue +218 -0
- package/app/components/display-banner/DisplayBanner.vue +63 -0
- package/app/components/display-details/DisplayDetailsCore.vue +301 -0
- package/app/components/display-dialog/DisplayDialogCore.vue +255 -0
- package/app/components/display-dialog/variants/DisplayDialogConfirm.vue +45 -0
- package/app/components/display-dialog/variants/DisplayDialogScrollableContent.vue +49 -0
- package/app/components/display-grid/DisplayGridCore.vue +22 -0
- package/app/components/display-prompt/DisplayPromptCore.vue +187 -0
- package/app/components/display-prompt/variants/DisplayPromptError.vue +53 -0
- package/app/components/expanding-panel/ExpandingPanel.vue +124 -0
- package/app/components/image-galleries/SliderGallery.vue +784 -0
- package/app/components/layout-grids/LayoutGridA.vue +103 -0
- package/app/components/layout-grids/LayoutGridB.vue +132 -0
- package/app/components/layout-row/LayoutRow.vue +165 -0
- package/app/components/masonry-grid/MasonryGrid.vue +62 -0
- package/app/components/masonry-grid-ordered/MasonryGridOrdered.vue +158 -0
- package/app/components/masonry-grid-sorted/MasonryGridSorted.vue +115 -0
- package/app/components/pop-over/PopOver.vue +88 -0
- package/app/components/responsive-header/NavigationItems.vue +169 -0
- package/app/components/responsive-header/ResponsiveHeader.vue +686 -0
- package/app/components/rotating-carousel/RotatingCarouselImage.vue +200 -0
- package/app/components/skip-links/SkipLinks.vue +92 -0
- package/app/components/tabs/TabsCore.vue +277 -0
- package/app/composables/useDialogControls.ts +44 -0
- package/app/composables/useStyleClassPassthrough.ts +35 -0
- package/app/composables/useTabs.ts +201 -0
- package/app/types/gallery-data.ts +13 -0
- package/app/types/responsiveHeader.ts +38 -0
- package/app/types/types.carousel-basic.ts +19 -0
- package/nuxt.config.ts +14 -14
- package/package.json +4 -7
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-grid-a-wrapper" :class="[elementClasses]">
|
|
3
|
+
<div class="layout-grid-a">
|
|
4
|
+
<div class="slot1">
|
|
5
|
+
<slot name="slot1"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="slot2">
|
|
8
|
+
<slot name="slot2"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="slot3">
|
|
11
|
+
<slot name="slot3"></slot>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="slot4">
|
|
14
|
+
<slot name="slot4"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
styleClassPassthrough: {
|
|
23
|
+
type: Array as PropType<string[]>,
|
|
24
|
+
default: () => [],
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
29
|
+
|
|
30
|
+
watch(
|
|
31
|
+
() => props.styleClassPassthrough,
|
|
32
|
+
() => {
|
|
33
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style lang="css">
|
|
39
|
+
.layout-grid-a-wrapper {
|
|
40
|
+
container-type: inline-size;
|
|
41
|
+
|
|
42
|
+
.layout-grid-a {
|
|
43
|
+
display: grid;
|
|
44
|
+
gap: 20px;
|
|
45
|
+
|
|
46
|
+
& > div {
|
|
47
|
+
padding: 20px;
|
|
48
|
+
outline: 1px solid light-dark(black, white);
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@container (min-width: 768px) {
|
|
53
|
+
grid-template-columns: repeat(2, auto);
|
|
54
|
+
grid-template-rows: repeat(3, auto);
|
|
55
|
+
|
|
56
|
+
.slot1 {
|
|
57
|
+
grid-column: 1 / span 2;
|
|
58
|
+
grid-row: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.slot2 {
|
|
62
|
+
grid-column: 1 / span 2;
|
|
63
|
+
grid-row: 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.slot3 {
|
|
67
|
+
grid-column: 1;
|
|
68
|
+
grid-row: 3;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.slot4 {
|
|
72
|
+
grid-column: 2;
|
|
73
|
+
grid-row: 3;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@container (min-width: 1060px) {
|
|
78
|
+
grid-template-columns: repeat(3, auto);
|
|
79
|
+
grid-template-rows: repeat(2, auto);
|
|
80
|
+
|
|
81
|
+
.slot1 {
|
|
82
|
+
grid-column: 1;
|
|
83
|
+
grid-row: 1 / span 2;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.slot2 {
|
|
87
|
+
grid-column: 2 / span 2;
|
|
88
|
+
grid-row: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.slot3 {
|
|
92
|
+
grid-column: 2;
|
|
93
|
+
grid-row: 2;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.slot4 {
|
|
97
|
+
grid-column: 3;
|
|
98
|
+
grid-row: 2;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-grid-b" :class="[elementClasses]">
|
|
3
|
+
<section class="top-row">
|
|
4
|
+
<div class="top-row-slot-1">
|
|
5
|
+
<div class="top-row-slot-1-inner">
|
|
6
|
+
<div v-for="key in topRowSlot1ItemCount" class="panel">
|
|
7
|
+
<slot :name="`top-row-slot1-${key}-content`"></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="top-row-slot-2">
|
|
13
|
+
<div class="panel">
|
|
14
|
+
<slot name="top-row-slot-2"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="top-row-slot-3">
|
|
18
|
+
<div class="panel">
|
|
19
|
+
<slot name="top-row-slot-3"></slot>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</section>
|
|
23
|
+
|
|
24
|
+
<section class="bottom-row">
|
|
25
|
+
<div v-for="key in bottomRowItemCount" class="panel">
|
|
26
|
+
<slot :name="`bottom-row-${key}-content`"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
</section>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
topRowSlot1ItemCount: {
|
|
35
|
+
type: Number as PropType<number>,
|
|
36
|
+
default: 6,
|
|
37
|
+
},
|
|
38
|
+
bottomRowItemCount: {
|
|
39
|
+
type: Number as PropType<number>,
|
|
40
|
+
default: 4,
|
|
41
|
+
},
|
|
42
|
+
styleClassPassthrough: {
|
|
43
|
+
type: Array as PropType<string[]>,
|
|
44
|
+
default: () => [],
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
() => props.styleClassPassthrough,
|
|
52
|
+
() => {
|
|
53
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="css">
|
|
59
|
+
.layout-grid-b {
|
|
60
|
+
--_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
|
|
61
|
+
--_color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
|
|
62
|
+
--_gap: 12px;
|
|
63
|
+
|
|
64
|
+
.panel {
|
|
65
|
+
border: 1px solid var(--_border-color);
|
|
66
|
+
border-radius: 12px;
|
|
67
|
+
padding: 12px;
|
|
68
|
+
height: auto;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
container-type: inline-size;
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: 1fr;
|
|
74
|
+
gap: var(--_gap);
|
|
75
|
+
width: 100%;
|
|
76
|
+
margin-inline: auto;
|
|
77
|
+
|
|
78
|
+
.top-row {
|
|
79
|
+
display: grid;
|
|
80
|
+
gap: var(--_gap);
|
|
81
|
+
width: 100%;
|
|
82
|
+
|
|
83
|
+
grid-template-columns: 1fr;
|
|
84
|
+
grid-template-areas:
|
|
85
|
+
'slot1'
|
|
86
|
+
'slot2'
|
|
87
|
+
'slot3';
|
|
88
|
+
|
|
89
|
+
@container (min-width: 1024px) {
|
|
90
|
+
grid-template-columns: 1fr minmax(460px, 33%);
|
|
91
|
+
grid-template-areas:
|
|
92
|
+
'slot1 slot2'
|
|
93
|
+
'slot3 slot2';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.top-row-slot-1 {
|
|
98
|
+
grid-area: slot1;
|
|
99
|
+
container-type: inline-size;
|
|
100
|
+
|
|
101
|
+
.top-row-slot-1-inner {
|
|
102
|
+
display: grid;
|
|
103
|
+
grid-template-columns: repeat(2, 1fr);
|
|
104
|
+
|
|
105
|
+
gap: var(--_gap);
|
|
106
|
+
|
|
107
|
+
@container (min-width: 680px) {
|
|
108
|
+
grid-template-columns: repeat(3, 1fr);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.panel {
|
|
112
|
+
display: grid;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.top-row-slot-2 {
|
|
118
|
+
grid-area: slot2;
|
|
119
|
+
display: grid;
|
|
120
|
+
}
|
|
121
|
+
.top-row-slot-3 {
|
|
122
|
+
grid-area: slot3;
|
|
123
|
+
display: grid;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.bottom-row {
|
|
127
|
+
display: grid;
|
|
128
|
+
grid-template-columns: repeat(2, 1fr);
|
|
129
|
+
gap: var(--_gap);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</style>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="layout-row" :class="elementClasses" :id :tab-index="isLandmark ? 0 : null" :aria-label="isLandmark ? 'Layout Row Landmark' : undefined">
|
|
3
|
+
<div :data-testid="dataTestid" class="layout-row-inner" :class="variant">
|
|
4
|
+
<div>
|
|
5
|
+
<slot name="default"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</component>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
const TAGS_ALLOWED = <string[]>['div', 'section', 'article', 'aside', 'header', 'footer', 'main', 'nav', 'ul', 'ol'];
|
|
13
|
+
|
|
14
|
+
const VARIANT_CLASSES = <string[]>[
|
|
15
|
+
'full',
|
|
16
|
+
'full-start',
|
|
17
|
+
'full-end',
|
|
18
|
+
'popout',
|
|
19
|
+
'popout-start',
|
|
20
|
+
'popout-end',
|
|
21
|
+
'content',
|
|
22
|
+
'content-start',
|
|
23
|
+
'content-end',
|
|
24
|
+
'inset-content',
|
|
25
|
+
'inset-content-start',
|
|
26
|
+
'inset-content-end',
|
|
27
|
+
'full-width',
|
|
28
|
+
'full-content',
|
|
29
|
+
'full-content-nopad',
|
|
30
|
+
'full-content',
|
|
31
|
+
];
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
dataTestid: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'layout-row',
|
|
39
|
+
},
|
|
40
|
+
tag: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'div',
|
|
43
|
+
validator(value: string) {
|
|
44
|
+
return TAGS_ALLOWED.includes(value);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: true,
|
|
50
|
+
validator(value: string) {
|
|
51
|
+
return VARIANT_CLASSES.includes(value);
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
id: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
styleClassPassthrough: {
|
|
59
|
+
type: Array as PropType<string[]>,
|
|
60
|
+
default: () => [],
|
|
61
|
+
},
|
|
62
|
+
isLandmark: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style lang="css">
|
|
72
|
+
/*
|
|
73
|
+
* Page Layout by https://layout-breakouts-builder.vercel.app
|
|
74
|
+
**/
|
|
75
|
+
.layout-row > *,
|
|
76
|
+
.full-width > * {
|
|
77
|
+
grid-column: content;
|
|
78
|
+
}
|
|
79
|
+
.layout-row,
|
|
80
|
+
.full-width {
|
|
81
|
+
--minimum-content-padding: 1rem;
|
|
82
|
+
|
|
83
|
+
/** TRACK WIDTHS **/
|
|
84
|
+
--full-max-width: 1fr;
|
|
85
|
+
--popout-max-width: 1400px;
|
|
86
|
+
--content-max-width: 1060px;
|
|
87
|
+
--inset-content-max-width: 840px;
|
|
88
|
+
|
|
89
|
+
/** TRACK SIZES **/
|
|
90
|
+
--full: minmax(var(--minimum-content-padding), 1fr);
|
|
91
|
+
--popout: minmax(0, calc((var(--popout-max-width) - var(--content-max-width)) * 0.5));
|
|
92
|
+
--content: minmax(0, calc((var(--content-max-width) - var(--inset-content-max-width)) * 0.5));
|
|
93
|
+
--inset-content: min(var(--inset-content-max-width), 100% - var(--minimum-content-padding) * 2);
|
|
94
|
+
|
|
95
|
+
display: grid;
|
|
96
|
+
grid-template-columns:
|
|
97
|
+
[full-start]
|
|
98
|
+
var(--full)
|
|
99
|
+
[popout-start]
|
|
100
|
+
var(--popout)
|
|
101
|
+
[content-start]
|
|
102
|
+
var(--content)
|
|
103
|
+
[inset-content-start]
|
|
104
|
+
var(--inset-content)
|
|
105
|
+
[inset-content-end]
|
|
106
|
+
var(--content)
|
|
107
|
+
[content-end]
|
|
108
|
+
var(--popout)
|
|
109
|
+
[popout-end]
|
|
110
|
+
var(--full)
|
|
111
|
+
[full-end];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** CLASSES **/
|
|
115
|
+
.full {
|
|
116
|
+
grid-column: full;
|
|
117
|
+
}
|
|
118
|
+
.full-start {
|
|
119
|
+
grid-column-start: full-start;
|
|
120
|
+
}
|
|
121
|
+
.full-end {
|
|
122
|
+
grid-column-end: full-end;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.popout {
|
|
126
|
+
grid-column: popout;
|
|
127
|
+
}
|
|
128
|
+
.popout-start {
|
|
129
|
+
grid-column-start: popout-start;
|
|
130
|
+
}
|
|
131
|
+
.popout-end {
|
|
132
|
+
grid-column-end: popout-end;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.content {
|
|
136
|
+
grid-column: content;
|
|
137
|
+
}
|
|
138
|
+
.content-start {
|
|
139
|
+
grid-column-start: content-start;
|
|
140
|
+
}
|
|
141
|
+
.content-end {
|
|
142
|
+
grid-column-end: content-end;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.inset-content {
|
|
146
|
+
grid-column: inset-content;
|
|
147
|
+
}
|
|
148
|
+
.inset-content-start {
|
|
149
|
+
grid-column-start: inset-content-start;
|
|
150
|
+
}
|
|
151
|
+
.inset-content-end {
|
|
152
|
+
grid-column-end: inset-content-end;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.full-width {
|
|
156
|
+
grid-column: full;
|
|
157
|
+
}
|
|
158
|
+
.full-content,
|
|
159
|
+
.full-content-nopad {
|
|
160
|
+
grid-column: full;
|
|
161
|
+
}
|
|
162
|
+
.full-content {
|
|
163
|
+
padding-inline: var(--minimum-content-padding);
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="masonry-grid-wrapper" :class="[elementClasses]" :style="`--_masonry-grid-gap: ${gap}${unit}; --_item-min-width: ${itemMinWidth}px`">
|
|
3
|
+
<template v-for="item in gridData" :key="item.id">
|
|
4
|
+
<div class="masonry-grid-item">
|
|
5
|
+
<slot :name="item.id"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
gridData: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: {},
|
|
16
|
+
},
|
|
17
|
+
itemMinWidth: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 300,
|
|
20
|
+
},
|
|
21
|
+
gap: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 1.2,
|
|
24
|
+
},
|
|
25
|
+
unit: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'rem',
|
|
28
|
+
},
|
|
29
|
+
styleClassPassthrough: {
|
|
30
|
+
type: Array as PropType<string[]>,
|
|
31
|
+
default: () => [],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
36
|
+
|
|
37
|
+
const gridData = toRef(() => props.gridData);
|
|
38
|
+
|
|
39
|
+
watch(
|
|
40
|
+
() => props.styleClassPassthrough,
|
|
41
|
+
() => {
|
|
42
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style lang="css">
|
|
48
|
+
.masonry-grid-wrapper {
|
|
49
|
+
--_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
|
|
50
|
+
--_color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
|
|
51
|
+
|
|
52
|
+
columns: var(--_item-min-width);
|
|
53
|
+
gap: 12px;
|
|
54
|
+
|
|
55
|
+
.masonry-grid-item {
|
|
56
|
+
break-inside: avoid;
|
|
57
|
+
outline: 0.1rem solid var(--_border-color);
|
|
58
|
+
padding: 1.2rem;
|
|
59
|
+
margin-block-end: var(--_masonry-grid-gap);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="masonry-grid-ordered" :class="[elementClasses]">
|
|
3
|
+
<div class="masonry-grid-ordered-wrapper" ref="gridWrapper">
|
|
4
|
+
<div v-for="item in gridData" :key="item.id" class="masonry-grid-ordered-item" ref="gridItemsRefs">
|
|
5
|
+
<slot :name="item.id"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { useBreakpoints, useElementSize, useResizeObserver } from '@vueuse/core';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
gridData: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: {},
|
|
18
|
+
},
|
|
19
|
+
minTileWidth: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 312,
|
|
22
|
+
},
|
|
23
|
+
gap: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 12,
|
|
26
|
+
},
|
|
27
|
+
styleClassPassthrough: {
|
|
28
|
+
type: Array as PropType<string[]>,
|
|
29
|
+
default: () => [],
|
|
30
|
+
},
|
|
31
|
+
mobilePreferredColCount: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1,
|
|
34
|
+
},
|
|
35
|
+
fixedWidth: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
justify: {
|
|
40
|
+
type: String as PropType<String>,
|
|
41
|
+
default: 'left',
|
|
42
|
+
validator: (val: string) => ['left', 'center', 'right'].includes(val),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
47
|
+
|
|
48
|
+
const gridData = toRef(() => props.gridData);
|
|
49
|
+
|
|
50
|
+
const minTileWidth = toRef(() => props.minTileWidth);
|
|
51
|
+
const gridWrapper = ref<null | HTMLDivElement>(null);
|
|
52
|
+
const gridItemsRefs = ref<HTMLDivElement[]>([]);
|
|
53
|
+
const { width } = useElementSize(gridWrapper);
|
|
54
|
+
const columnCount = computed(() => {
|
|
55
|
+
return Math.floor(width.value / minTileWidth.value);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const gapNum = toRef(props.gap);
|
|
59
|
+
const gapStr = toRef(props.gap + 'px');
|
|
60
|
+
|
|
61
|
+
const fixedWidth = toRef(() => props.fixedWidth);
|
|
62
|
+
const minTileWidthStr = toRef(props.minTileWidth + 'px');
|
|
63
|
+
const maxTileWidth = computed(() => {
|
|
64
|
+
return fixedWidth.value ? minTileWidth.value + 'px' : '1fr';
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const justify = computed(() => {
|
|
68
|
+
return fixedWidth.value ? props.justify : 'stretch';
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const updateGrid = () => {
|
|
72
|
+
if (gridWrapper.value !== null) {
|
|
73
|
+
const wrapperWidth = gridWrapper.value?.offsetWidth ?? 0;
|
|
74
|
+
const itemWidth = fixedWidth.value ? minTileWidth.value : Math.floor((wrapperWidth - (columnCount.value - 1) * gapNum.value) / columnCount.value);
|
|
75
|
+
|
|
76
|
+
const colHeights = Array(columnCount.value).fill(0);
|
|
77
|
+
|
|
78
|
+
gridItemsRefs.value.forEach((item) => {
|
|
79
|
+
const minHeight = Math.min(...colHeights);
|
|
80
|
+
const minIndex = colHeights.indexOf(minHeight);
|
|
81
|
+
|
|
82
|
+
item?.style.setProperty('--_position', 'absolute');
|
|
83
|
+
item?.style.setProperty('--_position-top', minHeight + 'px');
|
|
84
|
+
item?.style.setProperty('--_position-left', minIndex * (100 / columnCount.value) + '%');
|
|
85
|
+
item?.style.setProperty('--_element-width', itemWidth + 'px');
|
|
86
|
+
|
|
87
|
+
colHeights[minIndex] += Math.floor(item.offsetHeight + gapNum.value);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const maxHeight = Math.max(...colHeights);
|
|
91
|
+
gridWrapper.value?.style.setProperty('--_wrapper-height', maxHeight + 'px');
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
useResizeObserver(gridWrapper, () => {
|
|
96
|
+
updateGrid();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
watch(
|
|
100
|
+
() => fixedWidth.value,
|
|
101
|
+
() => {
|
|
102
|
+
updateGrid();
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
watch(
|
|
107
|
+
() => props.styleClassPassthrough,
|
|
108
|
+
() => {
|
|
109
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style scoped lang="css">
|
|
115
|
+
.masonry-grid-ordered {
|
|
116
|
+
--_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
|
|
117
|
+
--_transition-duration: 0.3s;
|
|
118
|
+
|
|
119
|
+
container-type: inline-size;
|
|
120
|
+
position: relative;
|
|
121
|
+
|
|
122
|
+
transition: max-width var(--_transition-duration) ease;
|
|
123
|
+
|
|
124
|
+
.masonry-grid-ordered-wrapper {
|
|
125
|
+
display: grid;
|
|
126
|
+
justify-self: v-bind(justify);
|
|
127
|
+
grid-gap: v-bind(gapStr);
|
|
128
|
+
grid-template-columns: repeat(1, minmax(v-bind(minTileWidthStr), v-bind(maxTileWidth)));
|
|
129
|
+
position: relative;
|
|
130
|
+
|
|
131
|
+
height: var(--_wrapper-height);
|
|
132
|
+
|
|
133
|
+
@container (min-width: 768px) {
|
|
134
|
+
grid-template-columns: repeat(2, minmax(v-bind(minTileWidthStr), v-bind(maxTileWidth)));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@container (min-width: 1024px) {
|
|
138
|
+
grid-template-columns: repeat(3, minmax(v-bind(minTileWidthStr), v-bind(maxTileWidth)));
|
|
139
|
+
}
|
|
140
|
+
@container (min-width: 1280px) {
|
|
141
|
+
grid-template-columns: repeat(4, minmax(v-bind(minTileWidthStr), v-bind(maxTileWidth)));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.masonry-grid-ordered-item {
|
|
145
|
+
transition: position var(--_transition-duration) ease, top var(--_transition-duration) ease, left var(--_transition-duration) ease;
|
|
146
|
+
|
|
147
|
+
position: var(--_position);
|
|
148
|
+
top: var(--_position-top);
|
|
149
|
+
left: var(--_position-left);
|
|
150
|
+
width: var(--_element-width);
|
|
151
|
+
|
|
152
|
+
outline: 0.1rem solid var(--_border-color);
|
|
153
|
+
padding: 1.2rem;
|
|
154
|
+
border-radius: 4px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
</style>
|