srcdev-nuxt-components 5.0.3 → 6.0.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 +0 -8
- package/nuxt.config.ts +5 -2
- package/package.json +11 -12
- package/assets/styles/extends-layer/srcdev-components/display-prompt-core/index.css +0 -70
- package/assets/styles/extends-layer/srcdev-components/index.css +0 -2
- package/assets/styles/extends-layer/srcdev-components/themes/_error.css +0 -15
- package/assets/styles/extends-layer/srcdev-components/themes/_info.css +0 -15
- package/assets/styles/extends-layer/srcdev-components/themes/_success.css +0 -15
- package/assets/styles/extends-layer/srcdev-components/themes/_warning.css +0 -15
- package/assets/styles/extends-layer/srcdev-components/themes/index.css +0 -4
- package/assets/styles/main.css +0 -2
- package/assets/styles/setup/_head.css +0 -5
- package/assets/styles/setup/a11y/_utils.css +0 -20
- package/assets/styles/setup/a11y/_variables.css +0 -10
- package/assets/styles/setup/a11y/index.css +0 -2
- package/assets/styles/setup/index.css +0 -5
- package/assets/styles/setup/typography/index.css +0 -2
- package/assets/styles/setup/typography/utility-classes/_generic-font-classes.css +0 -192
- package/assets/styles/setup/typography/utility-classes/_generic-font-variation-settings.css +0 -29
- package/assets/styles/setup/typography/utility-classes/_generic-font-weights.css +0 -41
- package/assets/styles/setup/typography/utility-classes/index.css +0 -3
- package/assets/styles/setup/typography/vars/_reponsive-font-sizes.css +0 -10
- package/assets/styles/setup/typography/vars/index.css +0 -1
- package/assets/styles/setup/utility-classes/_margin-helpers.css +0 -334
- package/assets/styles/setup/utility-classes/_padding-helpers.css +0 -308
- package/assets/styles/setup/utility-classes/_page.css +0 -50
- package/assets/styles/setup/utility-classes/index.css +0 -3
- package/assets/styles/setup/variables/colors/_blue.css +0 -15
- package/assets/styles/setup/variables/colors/_gray.css +0 -16
- package/assets/styles/setup/variables/colors/_green.css +0 -15
- package/assets/styles/setup/variables/colors/_orange.css +0 -15
- package/assets/styles/setup/variables/colors/_red.css +0 -15
- package/assets/styles/setup/variables/colors/_yellow.css +0 -15
- package/assets/styles/setup/variables/colors/index.css +0 -6
- package/assets/styles/setup/variables/index.css +0 -1
- package/components/accordian/AccordianCore.vue +0 -46
- package/components/animated-svg-text/AnimatedSvgText.vue +0 -87
- package/components/canvas-switcher/CanvasSwitcher.vue +0 -77
- package/components/carousel-basic/CarouselBasic.vue +0 -291
- package/components/carousel-basic/CarouselFlip.vue +0 -461
- package/components/carousel-basic/CarouselInfinite.vue +0 -325
- package/components/clip-element/ClipElement.vue +0 -73
- package/components/clipped-panels/ClippedPanel.vue +0 -73
- package/components/container-glow/ContainerGlowCore.vue +0 -211
- package/components/content-grid/ContentGrid.vue +0 -85
- package/components/deep-expanding-menu/DeepExpandingMenu.vue +0 -214
- package/components/deep-expanding-menu/DeepExpandingMenuOld.vue +0 -218
- package/components/display-banner/DisplayBanner.vue +0 -63
- package/components/display-details/DisplayDetailsCore.vue +0 -301
- package/components/display-dialog/DisplayDialogCore.vue +0 -255
- package/components/display-dialog/variants/DisplayDialogConfirm.vue +0 -45
- package/components/display-dialog/variants/DisplayDialogScrollableContent.vue +0 -49
- package/components/display-grid/DisplayGridCore.vue +0 -22
- package/components/display-prompt/DisplayPromptCore.vue +0 -187
- package/components/display-prompt/variants/DisplayPromptError.vue +0 -53
- package/components/expanding-panel/ExpandingPanel.vue +0 -124
- package/components/image-galleries/SliderGallery.vue +0 -784
- package/components/layout-grids/LayoutGridA.vue +0 -103
- package/components/layout-grids/LayoutGridB.vue +0 -132
- package/components/layout-row/LayoutRow.vue +0 -165
- package/components/masonry-grid/MasonryGrid.vue +0 -62
- package/components/masonry-grid-ordered/MasonryGridOrdered.vue +0 -158
- package/components/masonry-grid-sorted/MasonryGridSorted.vue +0 -115
- package/components/pop-over/PopOver.vue +0 -88
- package/components/responsive-header/NavigationItems.vue +0 -169
- package/components/responsive-header/ResponsiveHeader.vue +0 -686
- package/components/rotating-carousel/RotatingCarouselImage.vue +0 -200
- package/components/skip-links/SkipLinks.vue +0 -92
- package/components/tabs/TabsCore.vue +0 -277
- package/composables/useDialogControls.ts +0 -44
- package/composables/useStyleClassPassthrough.ts +0 -35
- package/composables/useTabs.ts +0 -201
- package/types/gallery-data.ts +0 -13
- package/types/responsiveHeader.ts +0 -38
- package/types/types.carousel-basic.ts +0 -19
|
@@ -1,103 +0,0 @@
|
|
|
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>
|
|
@@ -1,132 +0,0 @@
|
|
|
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>
|
|
@@ -1,165 +0,0 @@
|
|
|
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>
|
|
@@ -1,62 +0,0 @@
|
|
|
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>
|
|
@@ -1,158 +0,0 @@
|
|
|
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>
|