@kvass/widgets 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/package.json +4 -1
  2. package/.github/workflows/semantic-release.yml +0 -21
  3. package/.prettierrc +0 -6
  4. package/.releaserc +0 -3
  5. package/index.html +0 -38
  6. package/src/contact/README.md +0 -80
  7. package/src/contact/api.js +0 -82
  8. package/src/contact/components/Checkbox.ce.vue +0 -127
  9. package/src/contact/components/Field.ce.vue +0 -156
  10. package/src/contact/components/Fieldset.ce.vue +0 -63
  11. package/src/contact/components/Form.ce.vue +0 -407
  12. package/src/contact/main.js +0 -9
  13. package/src/contact/utils.js +0 -14
  14. package/src/flatfinder/README.md +0 -58
  15. package/src/flatfinder/components/Flatfinder.ce.vue +0 -34
  16. package/src/flatfinder/main.js +0 -4
  17. package/src/font-selector/README.md +0 -60
  18. package/src/font-selector/components/FontSelector.ce.vue +0 -246
  19. package/src/font-selector/main.js +0 -4
  20. package/src/font-selector/providers.js +0 -48
  21. package/src/font-selector/selector.svg +0 -7
  22. package/src/img-comparison-slider/README.md +0 -69
  23. package/src/img-comparison-slider/components/ImgComparisonSlider.ce.vue +0 -139
  24. package/src/img-comparison-slider/main.js +0 -7
  25. package/src/map/README.md +0 -59
  26. package/src/map/components/Map.ce.vue +0 -66
  27. package/src/map/main.js +0 -4
  28. package/src/project-portal/App.ce.vue +0 -308
  29. package/src/project-portal/api.js +0 -48
  30. package/src/project-portal/assets/logo.png +0 -0
  31. package/src/project-portal/assets/map-pin-solid.svg +0 -1
  32. package/src/project-portal/components/Card.ce.vue +0 -110
  33. package/src/project-portal/components/Category.ce.vue +0 -87
  34. package/src/project-portal/components/CategorySelector.ce.vue +0 -43
  35. package/src/project-portal/components/ProjectTypeSelector.ce.vue +0 -70
  36. package/src/project-portal/main.js +0 -16
  37. package/src/project-portal/styles/_variables.scss +0 -19
  38. package/src/project-portal/styles/components/_card.scss +0 -178
  39. package/src/utils/index.js +0 -40
  40. package/src/vimeo/README.md +0 -58
  41. package/src/vimeo/components/Vimeo.ce.vue +0 -311
  42. package/src/vimeo/main.js +0 -4
  43. package/src/youtube/README.md +0 -58
  44. package/src/youtube/components/Youtube.ce.vue +0 -322
  45. package/src/youtube/main.js +0 -4
  46. package/vite.config.js +0 -51
@@ -1,308 +0,0 @@
1
- <template>
2
- <!-- <Loader :value="promise"> -->
3
- <div class="project-selector" :class="`project-selector--theme-${theme}`">
4
- <div
5
- v-if="!disableNav || !navItems.length"
6
- class="project-selector__navigation"
7
- >
8
- <CategorySelector
9
- class="project-selector__navigation-category"
10
- v-if="navItems.length"
11
- :items="navItems"
12
- :value="category"
13
- @input="
14
- ($ev) => {
15
- category = $ev
16
- filterItems()
17
- }
18
- "
19
- />
20
-
21
- <ProjectTypeSelector
22
- v-if="projectTypes.length > 1"
23
- class="project-selector__navigation-project-type"
24
- :items="projectTypes"
25
- :value="projectType"
26
- @input="
27
- ($ev) => {
28
- projectType = $ev.target.value
29
- filterItems()
30
- }
31
- "
32
- />
33
- </div>
34
-
35
- <transition-group
36
- v-if="items && items.length"
37
- tag="div"
38
- name="list"
39
- appear
40
- class="project-selector__card"
41
- >
42
- <Card
43
- v-for="(item, index) in items"
44
- :disable-label="disableNav"
45
- :key="index"
46
- :item="item"
47
- theme="border"
48
- />
49
- </transition-group>
50
-
51
- <div class="project-selector__no-result" v-else>Ingen resultater</div>
52
- </div>
53
- <!-- </Loader> -->
54
- </template>
55
-
56
- <script>
57
- export default {
58
- created() {
59
- this.fetch()
60
- },
61
- }
62
- </script>
63
-
64
- <script setup>
65
- import { ref, computed } from 'vue'
66
-
67
- import Card from './components/Card.ce.vue'
68
- import CategorySelector from './components/CategorySelector.ce.vue'
69
- import ProjectTypeSelector from './components/ProjectTypeSelector.ce.vue'
70
- // import { LoaderComponent as Loader } from 'vue-elder-loader'
71
-
72
- import { getProjects } from './api'
73
-
74
- function getSortValue(type, value) {
75
- switch (type) {
76
- case 'status':
77
- switch (value[type]) {
78
- case 'sale':
79
- return 2
80
- case 'upcoming':
81
- return 1
82
- default:
83
- return 0
84
- }
85
- case 'name':
86
- return value[type]
87
- }
88
- }
89
-
90
- const props = defineProps({
91
- source: {
92
- type: String,
93
- default: 'https://feature.kvass.no',
94
- },
95
- startCategory: {
96
- type: String,
97
- default: 'all',
98
- enums: ['all', 'sale', 'upcoming', 'development', 'sold'],
99
- },
100
- enabledCategories: {
101
- type: String,
102
- default: 'all,sale,upcoming,development,sold',
103
- },
104
- theme: {
105
- type: String,
106
- enum: ['default', 'tiles'],
107
- default: 'default',
108
- },
109
- sortOn: {
110
- type: String,
111
- enum: ['status', 'name'],
112
- default: 'status',
113
- },
114
- // triggerLabel: {
115
- // type: String,
116
- // default: 'Velg type',
117
- // },
118
- disableNav: {
119
- type: Boolean,
120
- default: false,
121
- },
122
- })
123
-
124
- const category = ref('')
125
- const projectType = ref('none')
126
- const items = ref([])
127
- var allItems = []
128
- const promise = ref(null)
129
-
130
- const navItems = computed(() => {
131
- return [
132
- ...props.enabledCategories.split(',').filter((i) => {
133
- if (i === 'all') return true
134
- return allItems.find((k) => k.status.includes(i))
135
- }),
136
- ]
137
- })
138
-
139
- const projectTypes = computed(() => {
140
- let types = ['none'].concat(
141
- allItems.map((i) => {
142
- if (i.customFields && i.customFields['project-type'])
143
- return i.customFields['project-type']
144
- }),
145
- )
146
-
147
- return [...new Set(types || [])].filter(Boolean)
148
- })
149
-
150
- function filterItems() {
151
- items.value = allItems
152
- .filter((i) => {
153
- if (category.value === 'all') return true
154
- return i.status.includes(category.value)
155
- })
156
- .filter((i) => {
157
- if (!projectTypes.length || projectType.value === 'none') return true
158
- if (!i.customFields || !i.customFields['project-type']) return
159
- return i.customFields['project-type'].includes(projectType.value)
160
- })
161
- }
162
-
163
- function getFromSource() {
164
- if (props.source) return getProjects(props.source)
165
- return Promise.resolve()
166
- }
167
-
168
- function getStatus(item) {
169
- if (item.status) return item.status
170
- let total = item.stats.total
171
- if (item.isPublished && total && !item.stats.sale) return 'sold'
172
- if (item.isPublished && total) return 'sale'
173
- if (item.isPublished && !total) return 'upcoming'
174
- if (!item.isPublished) return 'development'
175
- return 'development'
176
- }
177
-
178
- function fetch() {
179
- promise.value = getFromSource()
180
- .then(async (data) => {
181
- let items = []
182
- //read from global customItems
183
- if (typeof customItems !== 'undefined') {
184
- items =
185
- typeof customItems === 'function' ? await customItems() : customItems
186
- }
187
- //remove kvass projects that is defined in customItems
188
- let kvassProjects = data
189
- ? data.Projects.filter((item) => {
190
- if (items.find((i) => (i.id ? i.id.includes(item.id) : undefined)))
191
- return
192
- return item
193
- })
194
- : []
195
-
196
- allItems = [...kvassProjects, ...items]
197
-
198
- return (allItems = allItems
199
- .map((item) => {
200
- item.status = getStatus(item)
201
- return {
202
- intro: item.customFields ? item.customFields['project-intro'] : '',
203
- ...item,
204
- sortVale: getSortValue(props.sortOn, item),
205
- url: item.url,
206
- }
207
- })
208
- .sort((a, b) => {
209
- switch (props.sortOn) {
210
- case 'status':
211
- if (a.sortVale < b.sortVale) return 1
212
- if (a.sortVale > b.sortVale) return -1
213
- }
214
- })
215
- .filter((i) => props.enabledCategories.split(',').includes(i.status)))
216
- })
217
- .then(() => {
218
- category.value = props.startCategory
219
- items.value = allItems
220
- })
221
- }
222
- </script>
223
-
224
- <style lang="scss">
225
- @import './styles/_variables';
226
- .project-selector {
227
- $gap: 1.5rem;
228
- &__navigation {
229
- display: flex;
230
- justify-content: var(--kvass-project-selector-nav-position, center);
231
- padding: 0 2rem;
232
- padding-bottom: 3rem;
233
- gap: $gap;
234
- @media (max-width: $kvass-project-selector-resposive) {
235
- flex-direction: column-reverse;
236
- justify-content: center;
237
- gap: $gap - 1rem;
238
- }
239
- &-category {
240
- display: flex;
241
- justify-content: center;
242
- gap: $gap;
243
- @media (max-width: $kvass-project-selector-resposive) {
244
- flex-direction: column;
245
- gap: $gap - 1rem;
246
- align-items: center;
247
- }
248
- }
249
- }
250
- &__card {
251
- position: relative;
252
- display: grid;
253
- grid-template-columns: repeat(
254
- var(--kvass-project-selector-grid-columns, 4),
255
- 1fr
256
- );
257
- gap: var(--kvass-project-selector-grid-gap, 2rem);
258
- @media (max-width: $kvass-project-selector-resposive) {
259
- grid-template-columns: 1fr;
260
- padding-top: 2rem;
261
- }
262
- }
263
- &__no-result {
264
- font-size: 1.2em;
265
- text-align: center;
266
- display: flex;
267
- justify-content: center;
268
- align-items: center;
269
- min-height: 200px;
270
- margin: 2rem 0;
271
- background-color: GetVariable('light-grey');
272
- @media (max-width: $kvass-project-selector-resposive) {
273
- min-height: 100px;
274
- }
275
- }
276
- .list {
277
- &-leave-active {
278
- position: absolute;
279
- }
280
- &-move,
281
- &-enter-active,
282
- &-leave-active {
283
- transition: all 500ms ease;
284
- }
285
- &-enter {
286
- transform: scale(0.95);
287
- }
288
- &-enter,
289
- &-leave-to {
290
- opacity: 0;
291
- }
292
- }
293
- }
294
- // tiles theme
295
- .project-selector--theme-tiles {
296
- .project-selector__card {
297
- grid-template-columns: repeat(
298
- var(--kvass-project-selector-grid-columns, 2),
299
- 1fr
300
- );
301
- gap: var(--kvass-project-selector-grid-gap, 0rem);
302
- @media (max-width: $kvass-project-selector-resposive) {
303
- grid-template-columns: 1fr;
304
- padding-top: 2rem;
305
- }
306
- }
307
- }
308
- </style>
@@ -1,48 +0,0 @@
1
- function getProjects(url) {
2
- return fetch(`${url}/api/graphql`, {
3
- method: 'POST',
4
- headers: {
5
- 'Content-Type': 'application/json',
6
- },
7
- body: JSON.stringify({
8
- query: `
9
- query {
10
- Projects {
11
- id
12
- name
13
- url
14
- isPublished
15
- media {
16
- cover {
17
- url
18
- type
19
- }
20
- gallery {
21
- url
22
- type
23
- }
24
- }
25
- address {
26
- street
27
- city
28
- county
29
- postcode
30
- location {
31
- coordinates
32
- }
33
- }
34
- stats {
35
- total
36
- sale
37
- }
38
- customFields(keys: ["project-intro", "project-type"])
39
- }
40
- }
41
- `,
42
- }),
43
- })
44
- .then((res) => res.json())
45
- .then((res) => res.data)
46
- }
47
-
48
- export { getProjects }
Binary file
@@ -1 +0,0 @@
1
- <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="map-pin" class="svg-inline--fa fa-map-pin fa-w-9" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 512"><path fill="currentColor" d="M112 316.94v156.69l22.02 33.02c4.75 7.12 15.22 7.12 19.97 0L176 473.63V316.94c-10.39 1.92-21.06 3.06-32 3.06s-21.61-1.14-32-3.06zM144 0C64.47 0 0 64.47 0 144s64.47 144 144 144 144-64.47 144-144S223.53 0 144 0zm0 76c-37.5 0-68 30.5-68 68 0 6.62-5.38 12-12 12s-12-5.38-12-12c0-50.73 41.28-92 92-92 6.62 0 12 5.38 12 12s-5.38 12-12 12z"></path></svg>
@@ -1,110 +0,0 @@
1
- <template>
2
- <div class="project-selector-card" :class="'project-selector-card--' + theme">
3
- <component
4
- :is="item.url && !['development'].includes(status) ? 'a' : 'div'"
5
- class="project-selector-card__header"
6
- :href="item.url"
7
- >
8
- <div v-if="!disableLabel" class="project-selector-card__header-category">
9
- <Category :value="status" component="div" active />
10
- </div>
11
- <div
12
- class="project-selector-card__header-cover"
13
- :style="{ backgroundImage: `url(${cover})` }"
14
- ></div>
15
- </component>
16
- <div class="project-selector-card__content">
17
- <h2 class="project-selector-card__content-name">
18
- {{ item.name }}
19
- </h2>
20
-
21
- <span
22
- v-if="item.address && item.address.city"
23
- class="project-selector-card__content-location"
24
- >
25
- <svg
26
- aria-hidden="true"
27
- focusable="false"
28
- data-prefix="fas"
29
- data-icon="map-pin"
30
- role="img"
31
- xmlns="http://www.w3.org/2000/svg"
32
- viewBox="0 0 288 512"
33
- >
34
- <path
35
- fill="currentColor"
36
- d="M112 316.94v156.69l22.02 33.02c4.75 7.12 15.22 7.12 19.97 0L176 473.63V316.94c-10.39 1.92-21.06 3.06-32 3.06s-21.61-1.14-32-3.06zM144 0C64.47 0 0 64.47 0 144s64.47 144 144 144 144-64.47 144-144S223.53 0 144 0zm0 76c-37.5 0-68 30.5-68 68 0 6.62-5.38 12-12 12s-12-5.38-12-12c0-50.73 41.28-92 92-92 6.62 0 12 5.38 12 12s-5.38 12-12 12z"
37
- ></path>
38
- </svg>
39
-
40
- <span class="project-selector-card__content-city">
41
- {{ item.address ? item.address.city : '' }}
42
- </span>
43
- </span>
44
- <div
45
- class="project-selector-card__content-intro"
46
- v-html="item.intro"
47
- ></div>
48
- <a
49
- v-if="item.url && !['development'].includes(status)"
50
- class="project-selector-card__content-url"
51
- :href="item.url"
52
- >
53
- Se prosjektet</a
54
- >
55
- </div>
56
- </div>
57
- </template>
58
-
59
- <script setup>
60
- import Category from './Category.ce.vue'
61
- import { ref } from 'vue'
62
- import { computed } from '@vue/reactivity'
63
-
64
- const props = defineProps({
65
- item: {
66
- type: Object,
67
- default: () => ({}),
68
- },
69
- theme: {
70
- type: String,
71
- default: 'default',
72
- enums: ['default', 'primary', 'flat'],
73
- },
74
- disableLabel: {
75
- type: Boolean,
76
- default: false,
77
- },
78
- })
79
-
80
- const cover = computed(() => {
81
- return (
82
- getImage(
83
- props.item.media && props.item.media.cover
84
- ? props.item.media.cover
85
- : null,
86
- ) ||
87
- getImage(
88
- props.item.media && props.item.media.gallery
89
- ? props.item.media.gallery
90
- : null,
91
- )
92
- )
93
- })
94
-
95
- const status = computed(() => props.item.status)
96
-
97
- function getImage(value) {
98
- if (!value || !value.length) return
99
- let result = value.find((i) => {
100
- if (i.type) return i.type.startsWith('image')
101
- return i
102
- })
103
- if (!result) return
104
- return result.url
105
- }
106
- </script>
107
-
108
- <style lang="scss">
109
- @import '../styles/components/card';
110
- </style>
@@ -1,87 +0,0 @@
1
- <template>
2
- <component
3
- class="category"
4
- :class="[`category--${status}`, { 'category--active': active }]"
5
- :is="component"
6
- >
7
- <span>{{ label }}</span>
8
- </component>
9
- </template>
10
-
11
- <script setup>
12
- import { computed } from '@vue/reactivity'
13
- const themeMap = {
14
- sale: 'sale',
15
- upcoming: 'upcoming',
16
- development: 'development',
17
- sold: 'sold',
18
- }
19
-
20
- const categoryMap = {
21
- sale: 'Til salgs',
22
- upcoming: 'Kommer for salg',
23
- development: 'Under utvikling',
24
- all: 'Alle',
25
- sold: 'Utsolgt',
26
- }
27
-
28
- const props = defineProps({
29
- value: {
30
- type: String,
31
- default: 'development',
32
- },
33
- component: {
34
- type: String,
35
- default: 'div',
36
- },
37
- active: {
38
- type: Boolean,
39
- },
40
- })
41
-
42
- const status = computed(() => {
43
- if (themeMap[props.value]) return themeMap[props.value]
44
- return 'default'
45
- })
46
-
47
- const label = computed(() => categoryMap[props.value])
48
- </script>
49
-
50
- <style lang="scss">
51
- .category {
52
- @import '../styles/_variables';
53
- padding: 1rem 1.5rem;
54
- border: none;
55
- border-radius: GetVariable('border-radius');
56
- font-size: 0.9em;
57
- background-color: GetVariable('light-grey');
58
-
59
- &:focus-visible {
60
- outline: 2px solid GetVariable('primary');
61
- outline-offset: 2px;
62
- }
63
-
64
- &--primary.category--active {
65
- background-color: GetVariable('primary');
66
- }
67
- &--sale.category--active {
68
- background-color: GetVariable('sale');
69
- }
70
- &--sold.category--active {
71
- background-color: GetVariable('sold');
72
- }
73
- &--development.category--active {
74
- background-color: GetVariable('development');
75
- }
76
- &--upcoming.category--active {
77
- background-color: GetVariable('upcoming');
78
- }
79
- &--default.category--active {
80
- background-color: GetVariable('default');
81
- }
82
-
83
- &--active {
84
- color: white;
85
- }
86
- }
87
- </style>
@@ -1,43 +0,0 @@
1
- <template>
2
- <div class="project-selector-category">
3
- <CategoryTrigger
4
- v-for="(item, index) in items"
5
- :key="index"
6
- class="project-selector-category__selector"
7
- :value="item"
8
- :active="value == item"
9
- component="button"
10
- @click.native="$emit('input', item)"
11
- />
12
- </div>
13
- </template>
14
-
15
- <script setup>
16
- import CategoryTrigger from './Category.ce.vue'
17
-
18
- const props = defineProps({
19
- items: {
20
- type: Array,
21
- default: () => [],
22
- },
23
- value: {
24
- type: String,
25
- },
26
- })
27
- </script>
28
-
29
- <style lang="scss">
30
- .project-selector-category {
31
- @import '../styles/_variables';
32
-
33
- &__selector {
34
- @media (max-width: $kvass-project-selector-resposive) {
35
- width: 100%;
36
- }
37
- &:hover {
38
- box-shadow: inset 0 0 0 2em rgba(74, 74, 74, 0.2);
39
- }
40
- cursor: pointer;
41
- }
42
- }
43
- </style>
@@ -1,70 +0,0 @@
1
- <template>
2
- <select class="project-type-selector__trigger">
3
- <option
4
- v-for="(item, index) in items"
5
- :key="index"
6
- :value="item"
7
- @change="$emit('input', item)"
8
- class="project-type-selector__dropdown-item"
9
- >
10
- {{ Capitalize(item === 'none' ? 'Velg type' : item) }}
11
- </option>
12
- </select>
13
- </template>
14
-
15
- <script setup>
16
- function Capitalize(value) {
17
- return value.charAt(0).toUpperCase() + value.substring(1)
18
- }
19
-
20
- const props = defineProps({
21
- items: {
22
- type: Array,
23
- default: () => [],
24
- },
25
- value: {
26
- type: String,
27
- },
28
- })
29
- </script>
30
-
31
- <style lang="scss">
32
- @import '../styles/_variables';
33
- .project-type-selector {
34
- .elder-dropdown__content {
35
- z-index: 11;
36
- }
37
- &__trigger {
38
- // remove select arrow
39
- appearance: none;
40
-
41
- /* for IE 10 */
42
- &:-ms-expand {
43
- display: none;
44
- }
45
-
46
- padding: 1rem 2rem;
47
- border: none;
48
- border-radius: GetVariable('border-radius');
49
- font-size: 0.9em;
50
- background-color: GetVariable('primary');
51
- color: white;
52
-
53
- @media (max-width: $kvass-project-selector-resposive) {
54
- width: 100%;
55
- }
56
- }
57
- &__dropdown-item {
58
- &--selected {
59
- background-color: rgba(143, 143, 143, 0.4);
60
- }
61
- text-align: center !important;
62
- padding: 0.5rem 1.5rem;
63
- font-size: 0.9em;
64
-
65
- &:hover {
66
- background-color: rgba(36, 36, 36, 0.4);
67
- }
68
- }
69
- }
70
- </style>
@@ -1,16 +0,0 @@
1
- import { defineCustomElement } from 'vue'
2
- import App from './App.ce.vue'
3
- import Card from './components/Card.ce.vue'
4
- import Category from './components/Category.ce.vue'
5
- import CategorySelector from './components/CategorySelector.ce.vue'
6
- import ProjectTypeSelector from './components/ProjectTypeSelector.ce.vue'
7
-
8
- App.styles = [
9
- ...App.styles,
10
- ...Card.styles,
11
- ...Category.styles,
12
- ...CategorySelector.styles,
13
- ...ProjectTypeSelector.styles,
14
- ]
15
-
16
- customElements.define('kvass-project-portal', defineCustomElement(App))
@@ -1,19 +0,0 @@
1
- $kvass-project-selector-resposive: 767px;
2
-
3
- $variables: (
4
- 'primary': #0523a8,
5
- 'secondary': #3d495b,
6
- 'background-color': #efeded,
7
- 'dark': #272727,
8
- 'sale': #2da71d,
9
- 'sold': #cc3434,
10
- 'upcoming': #e9b03d,
11
- 'development': #3d495b,
12
- 'border-radius': 3px,
13
- 'card-spacing': 2.5rem,
14
- 'light-grey': #efefef,
15
- );
16
-
17
- @function GetVariable($key) {
18
- @return var(--kvass-project-selector-#{$key}, map-get($variables, $key));
19
- }