@kvass/widgets 1.2.7 → 1.2.8

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,407 +0,0 @@
1
- <script setup>
2
- import { computed, onMounted, reactive, ref, useAttrs } from 'vue'
3
- import { createLead, getProjects } from '../api'
4
- import { Capitalize } from '../utils'
5
-
6
- import Checkbox from './Checkbox.ce.vue'
7
- import Field from './Field.ce.vue'
8
- import Fieldset from './Fieldset.ce.vue'
9
-
10
- const Labels = {
11
- nb: {
12
- title: 'Meld interesse',
13
- submit: 'Meld interesse',
14
- name: 'Navn',
15
- email: 'E-post',
16
- phone: 'Telefonnummer',
17
- message: 'Melding',
18
- projects: 'Hvilke prosjekter er du interessert i?',
19
- upsell: 'Jeg ønsker informasjon om lignende prosjekter',
20
- privacy:
21
- 'Jeg ønsker å bli kontaktet i samtykke med [personvernerklæringen]',
22
- success: 'Takk for interessen!',
23
- },
24
- en: {
25
- title: 'Contact agent',
26
- submit: 'Submit',
27
- name: 'Name',
28
- email: 'Email',
29
- phone: 'Phone',
30
- message: 'Message',
31
- projects: 'Which projects are you interested in?',
32
- upsell: 'I want to know about other similar projects',
33
- privacy: 'I agree to the [privacy policy]',
34
- success: 'Thank you for your interest',
35
- },
36
- }
37
-
38
- const attrs = useAttrs()
39
- const props = defineProps({
40
- lang: {
41
- type: String,
42
- default: () => {
43
- return document.documentElement.getAttribute('lang') || 'nb'
44
- },
45
- },
46
- privacyUrl: String,
47
- upsell: {
48
- type: Boolean,
49
- default: false,
50
- },
51
- accountUrl: {
52
- type: String,
53
- required: true,
54
- },
55
- projects: {
56
- type: String,
57
- default: '',
58
- },
59
- references: {
60
- type: String,
61
- default: '',
62
- },
63
- tags: {
64
- type: String,
65
- default: '',
66
- },
67
- defaultAssignees: String,
68
- successTheme: {
69
- type: String,
70
- default: 'default',
71
- enums: ['overlay', 'default'],
72
- },
73
- submitTimeout: {
74
- type: Number,
75
- default: 2000,
76
- },
77
- })
78
-
79
- const privacy = ref(false)
80
- const privacyUrlComp = computed(() =>
81
- props.privacyUrl
82
- ? props.privacyUrl
83
- : `${props.accountUrl}/api/legal/privacy/tenant`,
84
- )
85
-
86
- const initialForm = {
87
- contact: {
88
- name: null,
89
- email: null,
90
- phone: null,
91
- upsell: false,
92
- tags: props.tags.split(','),
93
- },
94
- comment: null,
95
- }
96
- const form = reactive(structuredClone(initialForm))
97
-
98
- const submitted = ref(false)
99
- const fetchedProjects = ref([])
100
- const selectedProjects = ref([])
101
- const references = ref([])
102
-
103
- function getLabel(key) {
104
- let label = attrs['label' + Capitalize(key)] || Labels[props.lang][key]
105
- if (key === 'privacy')
106
- return label.replace(
107
- /\[(.+)\]/,
108
- `<a href="${privacyUrlComp.value}" target="_blank">$1</a>`,
109
- )
110
- return label
111
- }
112
-
113
- function resetForm() {
114
- form.comment = null
115
- form.contact.upsell = false
116
- privacy.value = false
117
- selectedProjects.value = []
118
- }
119
-
120
- function submit() {
121
- createLead(
122
- props.accountUrl,
123
- {
124
- ...form,
125
- references: references.value,
126
- },
127
- selectedProjects.value,
128
- props.defaultAssignees?.split(','),
129
- ).then(() => {
130
- submitted.value = true
131
- resetForm()
132
- setTimeout(() => (submitted.value = false), props.submitTimeout)
133
- })
134
- }
135
-
136
- function setReferences() {
137
- const refs = props.references
138
- .split(',')
139
- .filter(Boolean)
140
- .map((r) => {
141
- const [onModel, ref] = r.split(':')
142
- return {
143
- onModel,
144
- ref,
145
- }
146
- })
147
- references.value = refs
148
- }
149
-
150
- onMounted(() => {
151
- if (props.projects !== 'disable') {
152
- if (!props.projects) {
153
- getProjects(props.accountUrl).then(
154
- (projects) => (fetchedProjects.value = projects),
155
- )
156
- } else {
157
- props.projects.split(',').forEach((p) => selectedProjects.value.push(p))
158
- }
159
- }
160
- setReferences()
161
- })
162
- </script>
163
-
164
- <template>
165
- <form
166
- class="kvass-contact"
167
- :class="[
168
- { 'kvass-contact--submitted': submitted },
169
- `kvass-contact--theme-${successTheme}`,
170
- ]"
171
- @submit.prevent="submit"
172
- >
173
- <div
174
- v-if="successTheme === 'overlay' && submitted"
175
- class="kvass-contact__success--overlay"
176
- >
177
- <div v-html="getLabel('success')"></div>
178
- </div>
179
- <template v-else>
180
- <div class="kvass-contact__header">
181
- <h2 class="kvass-contact__title">{{ getLabel('title') }}</h2>
182
- <p class="kvass-contact__subtitle" v-if="getLabel('subtitle')">
183
- {{ getLabel('subtitle') }}
184
- </p>
185
- </div>
186
-
187
- <div class="kvass-contact__fields">
188
- <Field
189
- :label="getLabel('name')"
190
- type="text"
191
- required
192
- v-model="form.contact.name"
193
- />
194
- <Field
195
- :label="getLabel('email')"
196
- type="email"
197
- pattern="\b[\w\.-]+@[\w\.-]+\.\w{2,4}"
198
- required
199
- v-model="form.contact.email"
200
- />
201
- <Field
202
- :label="getLabel('phone')"
203
- type="tel"
204
- v-model="form.contact.phone"
205
- />
206
- <Fieldset :label="getLabel('projects')" v-if="!projects">
207
- <Checkbox
208
- v-for="project in fetchedProjects"
209
- :key="project.id"
210
- :state="project.id"
211
- :label="project.name"
212
- :checked="selectedProjects.includes(project.id)"
213
- v-model="selectedProjects"
214
- />
215
- </Fieldset>
216
- <Field
217
- :label="getLabel('message')"
218
- type="textarea"
219
- rows="5"
220
- class="kvass-contact-field--full-width"
221
- v-model="form.comment"
222
- />
223
- <Checkbox
224
- v-if="upsell"
225
- :label="getLabel('upsell')"
226
- class="kvass-contact-field--full-width"
227
- :checked="form.contact.upsell"
228
- v-model="form.contact.upsell"
229
- />
230
- <Checkbox
231
- :label="getLabel('privacy')"
232
- class="kvass-contact-field--full-width"
233
- required
234
- :checked="privacy"
235
- v-model="privacy"
236
- />
237
- </div>
238
- <button class="kvass-contact__submit" type="submit" :disabled="submitted">
239
- {{ submitted ? getLabel('success') : getLabel('submit') }}
240
- </button>
241
- </template>
242
- </form>
243
- </template>
244
-
245
- <style lang="scss">
246
- .kvass-contact {
247
- // default variables
248
-
249
- --kvass-contact-default-background: #ffffff;
250
- --kvass-contact-default-spacing: 2rem;
251
- --kvass-contact-default-padding: var(
252
- --kvass-contact-spacing,
253
- var(--kvass-contact-default-spacing)
254
- );
255
- --kvass-contact-default-border-radius: 4px;
256
- --kvass-contact-default-border-color: #eaeaea;
257
- --kvass-contact-default-border-width: 1px;
258
- --kvass-contact-default-color: #222222;
259
- --kvass-contact-default-color-inverted: #ffffff;
260
- --kvass-contact-default-max-width: 720px;
261
- --kvass-contact-default-primary: #1d56d8;
262
- --kvass-contact-default-error: #d81d1d;
263
- --kvass-contact-default-grid-columns: 1;
264
- --kvass-contact-default-disabled: #eaeaea;
265
- --kvass-contact-default-input-background: #ffffff;
266
- --kvass-contact-default-outline-width: 2px;
267
- --kvass-contact-default-outline-offset: 0px;
268
- --kvass-contact-default-checkbox-size: 1em;
269
- --kvass-contact-default-label-transform: 0;
270
- --kvass-contact-default-checkbox-border-width: var(
271
- --kvass-contact-default-border-width
272
- );
273
-
274
- --kvass-contact-default-checkbox-border-radius: var(
275
- --kvass-contact-default-border-radius
276
- );
277
-
278
- background-color: var(
279
- --kvass-contact-background,
280
- var(--kvass-contact-default-background)
281
- );
282
- padding: var(--kvass-contact-padding, var(--kvass-contact-default-padding));
283
- border-radius: var(
284
- --kvass-contact-border-radius,
285
- var(--kvass-contact-default-border-radius)
286
- );
287
- color: var(--kvass-contact-color, var(--kvass-contact-default-color));
288
- max-width: var(
289
- --kvass-contact-max-width,
290
- var(--kvass-contact-default-max-width)
291
- );
292
- font: inherit;
293
- accent-color: var(
294
- --kvass-contact-primary,
295
- var(--kvass-contact-default-primary)
296
- );
297
-
298
- font-size: var(--kvass-contact-font-size, inherit);
299
- height: inherit;
300
- min-height: inherit;
301
- max-height: inherit;
302
- display: flex;
303
- flex-direction: column;
304
- gap: var(--kvass-contact-spacing, var(--kvass-contact-default-spacing));
305
-
306
- @media (max-width: 600px) {
307
- --kvass-contact-grid-columns: 1;
308
- padding: calc(
309
- var(--kvass-contact-spacing, var(--kvass-contact-default-spacing)) / 2
310
- );
311
- }
312
-
313
- * {
314
- &:focus-visible {
315
- outline: 2px solid
316
- var(--kvass-contact-color, var(--kvass-contact-default-color));
317
- outline-offset: 2px;
318
- }
319
- }
320
-
321
- &--submitted {
322
- &.kvass-contact--theme-overlay {
323
- height: 100%;
324
- width: 100%;
325
- position: absolute;
326
- z-index: 2000;
327
- max-width: 100%;
328
- left: 0;
329
- top: 0;
330
- }
331
- }
332
-
333
- &__header {
334
- display: flex;
335
- flex-direction: column;
336
- gap: 0.5rem;
337
- }
338
-
339
- &__fields {
340
- display: grid;
341
- grid-template-columns: repeat(
342
- var(
343
- --kvass-contact-grid-columns,
344
- var(--kvass-contact-default-grid-columns)
345
- ),
346
- 1fr
347
- );
348
- gap: calc(
349
- var(--kvass-contact-spacing, var(--kvass-contact-default-spacing)) / 2
350
- );
351
- }
352
-
353
- &__success--overlay {
354
- margin: auto;
355
- font-size: var(--kvass-contact-success-label-font-size, inherit);
356
- }
357
-
358
- &__title {
359
- font-size: 2rem;
360
- margin: 0;
361
- }
362
-
363
- &__subtitle {
364
- opacity: 0.7;
365
- margin: 0;
366
- }
367
-
368
- &__submit {
369
- padding: calc(
370
- var(--kvass-contact-spacing, var(--kvass-contact-default-spacing)) / 2
371
- );
372
- border-radius: var(
373
- --kvass-contact-border-radius,
374
- var(--kvass-contact-default-border-radius)
375
- );
376
- background-color: var(
377
- --kvass-contact-primary,
378
- var(--kvass-contact-default-primary)
379
- );
380
- color: var(
381
- --kvass-contact-color-inverted,
382
- var(--kvass-contact-default-color-inverted)
383
- );
384
- border: none;
385
- font: inherit;
386
- width: 100%;
387
- cursor: pointer;
388
-
389
- &:active {
390
- filter: brightness(0.95);
391
- }
392
-
393
- &:disabled {
394
- background-color: var(
395
- --kvass-contact-disabled,
396
- var(--kvass-contact-default-disabled)
397
- );
398
- color: var(--kvass-contact-color, var(--kvass-contact-default-color));
399
- cursor: not-allowed;
400
- }
401
- }
402
-
403
- a {
404
- color: inherit;
405
- }
406
- }
407
- </style>
@@ -1,9 +0,0 @@
1
- import { defineCustomElement } from 'vue';
2
- import Checkbox from './components/Checkbox.ce.vue';
3
- import Field from './components/Field.ce.vue';
4
- import Fieldset from './components/Fieldset.ce.vue';
5
- import Form from './components/Form.ce.vue';
6
-
7
- Form.styles = [...Form.styles, ...Field.styles, ...Fieldset.styles, ...Checkbox.styles]
8
-
9
- customElements.define('kvass-contact', defineCustomElement(Form));
@@ -1,14 +0,0 @@
1
- function Debounce(fn, wait = 300) {
2
- let timer
3
- return (...args) => {
4
- clearTimeout(timer)
5
- timer = setTimeout(() => { fn.apply(this, args) }, wait)
6
- }
7
- }
8
-
9
- const Capitalize = (value) => value.charAt(0).toUpperCase() + value.substring(1)
10
-
11
- export {
12
- Debounce,
13
- Capitalize
14
- }
@@ -1,58 +0,0 @@
1
- # kvass-flatfinder
2
-
3
- A simple, embeddable Web Component for navigating Kvass projects.
4
-
5
- `https://unpkg.com/@kvass/widgets@latest/dist/flatfinder.js`
6
-
7
- ## Develop
8
-
9
- To run in development mode, first install the neccessary packages.
10
-
11
- ```
12
- npm install
13
- ```
14
-
15
- Then, run in development mode.
16
-
17
- ```
18
- npm run dev
19
- ```
20
-
21
- Open `localhost:3000` in the browser of your choice, and you will see the form widget.
22
-
23
- ## Build
24
-
25
- To build the widget for production, run `build` instead of `dev`.
26
-
27
- ```
28
- npm run build
29
- ```
30
-
31
- To use the widget, use the `<kvass-flatfinder />` element as shown here.
32
-
33
- ```html
34
- <kvass-flatfinder
35
- project-url="https://example.kvass.no"
36
- project-id="88eda909-9a78-4c2a-8fe3-bc263c283984"
37
- path-prefix="/residential"
38
- />
39
- ```
40
-
41
- ## Props
42
-
43
- The component has several props for easy configuration.
44
-
45
- | Name | Type | Description | Default |
46
- | :--------------------- | :----- | :----------------------------------------------------------- | :------ |
47
- | project-url `required` | String | Project URL where data will be fetched from. | |
48
- | project-id `required` | String | The ID of the project specified in the `project-url` prop | |
49
- | path-prefix | String | The prefix in the url path for each property when navigating | |
50
-
51
- ## Styling
52
-
53
- The widget's styles are based on CSS custom properties, and can be overwritten.
54
- These are the available CSS variables.
55
-
56
- | Name | Description | Default |
57
- | :---------------------------- | :-------------------------- | :-------- |
58
- | --kvass-flatfinder-background | The form's background color | `#ffffff` |
@@ -1,34 +0,0 @@
1
- <script setup>
2
- import { Flatfinder as FlatfinderComponent } from '@kvass/vue3-flatfinder'
3
- import { LazyLoad } from '@kvass/ui'
4
-
5
- const props = defineProps({
6
- projectUrl: {
7
- type: String,
8
- required: true,
9
- },
10
- projectId: {
11
- type: String,
12
- required: true,
13
- },
14
- pathPrefix: {
15
- type: String,
16
- default: '',
17
- },
18
- })
19
- </script>
20
-
21
- <template>
22
- <LazyLoad>
23
- <FlatfinderComponent
24
- class="kvass-flatfinder"
25
- :project-url="projectUrl"
26
- :project-id="projectId"
27
- :path-prefix="pathPrefix"
28
- />
29
- </LazyLoad>
30
- </template>
31
-
32
- <style>
33
- @import url('@kvass/vue3-flatfinder/style.css');
34
- </style>
@@ -1,4 +0,0 @@
1
- import { defineCustomElement } from 'vue';
2
- import Flatfinder from './components/Flatfinder.ce.vue'
3
-
4
- customElements.define('kvass-flatfinder', defineCustomElement(Flatfinder));
@@ -1,60 +0,0 @@
1
- # kvass-font-selector
2
-
3
- A simple, embeddable Web Component for selecting fonts.
4
-
5
- `https://unpkg.com/@kvass/widgets@latest/dist/font-selector.js`
6
-
7
- ## Develop
8
-
9
- To run in development mode, first install the neccessary packages.
10
-
11
- ```
12
- npm install
13
- ```
14
-
15
- Then, run in development mode.
16
-
17
- ```
18
- npm run dev
19
- ```
20
-
21
- Open `localhost:3000` in the browser of your choice, and you will see the form widget.
22
-
23
- ## Build
24
-
25
- To build the widget for production, run `build` instead of `dev`.
26
-
27
- ```
28
- npm run build
29
- ```
30
-
31
- To use the widget, use the `<kvass-flatfinder />` element as shown here.
32
-
33
- ```html
34
- <kvass-font-selector provider="google" />
35
- ```
36
-
37
- ## Props
38
-
39
- The component has several props for easy configuration.
40
-
41
- | Name | Type | Description | Default |
42
- | :----------- | :----- | :-------------------------------- | :------- |
43
- | provider | String | The provider to fetch fonts from. | `google` |
44
- | default-font | String | The default selected font. | |
45
-
46
- ## Styling
47
-
48
- The widget's styles are based on CSS custom properties, and can be overwritten.
49
- These are the available CSS variables.
50
-
51
- | Name | Description | Default |
52
- | :------------------------------------- | :------------------------------------ | :-------- |
53
- | --kvass-font-selector-border-radius | The border radius of the input field | `6px` |
54
- | --kvass-font-selector-background-color | The background color of the component | `white` |
55
- | --kvass-font-selector-padding-y | The inline padding | `1rem` |
56
- | --kvass-font-selector-padding-x | The block padding | `1rem` |
57
- | --kvass-font-selector-border-width | The width of the borders | `1px` |
58
- | --kvass-font-selector-border-style | The style of the borders | `solid` |
59
- | --kvass-font-selector-border-color | The color of the borders | #`eaeaea` |
60
- | --kvass-font-selector-max-width | The maximum width of the component | `500px` |