@namelivia/vue-components 4.5.1 → 4.6.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.
Files changed (43) hide show
  1. package/dist/index.esm.js +860 -931
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +865 -936
  4. package/dist/index.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/Badge/Badge.vue +3 -7
  7. package/src/Buttons/DangerButton/DangerButton.vue +5 -13
  8. package/src/Buttons/RegularButton/RegularButton.vue +24 -28
  9. package/src/Buttons/ResetButton/ResetButton.vue +3 -7
  10. package/src/Buttons/SecondaryButton/SecondaryButton.vue +5 -13
  11. package/src/Buttons/SubmitButton/SubmitButton.vue +4 -12
  12. package/src/Card/Card.vue +13 -19
  13. package/src/Card/CardBody.vue +4 -9
  14. package/src/Card/CardImage.vue +17 -24
  15. package/src/CardGrid/CardGrid.vue +2 -5
  16. package/src/Container/Container.vue +2 -5
  17. package/src/Icons/CalendarIcon/CalendarIcon.vue +10 -13
  18. package/src/Icons/CreateIcon/CreateIcon.vue +10 -13
  19. package/src/Icons/DropIcon/DropIcon.vue +10 -13
  20. package/src/Icons/SaveIcon/SaveIcon.vue +10 -13
  21. package/src/Icons/SkullIcon/SkullIcon.vue +10 -13
  22. package/src/Inputs/CheckBoxInput/CheckBoxInput.vue +9 -27
  23. package/src/Inputs/ImageInput/ImageInput.vue +10 -30
  24. package/src/Inputs/NumberInput/NumberInput.vue +12 -37
  25. package/src/Inputs/ResizeImageUpload/ResizeImageUpload.vue +28 -50
  26. package/src/Inputs/Selector/Selector.vue +27 -52
  27. package/src/Inputs/TextInput/TextInput.vue +10 -31
  28. package/src/Loading/Loading.vue +3 -7
  29. package/src/Modal/Modal.vue +9 -16
  30. package/src/Navbar/MobileMenuButton.vue +5 -17
  31. package/src/Navbar/MobileNavigationLink.vue +9 -27
  32. package/src/Navbar/MobileNavigationLinks.vue +6 -19
  33. package/src/Navbar/Navbar.vue +22 -53
  34. package/src/Navbar/NavbarTitle.vue +7 -19
  35. package/src/Navbar/NavigationLink.vue +9 -27
  36. package/src/Navbar/NavigationLinks.vue +5 -15
  37. package/src/Navbar/RightContent.vue +9 -24
  38. package/src/Pagination/Pagination.vue +8 -14
  39. package/src/RangeView/RangeView.vue +3 -7
  40. package/src/SectionTitle/SectionTitle.vue +5 -9
  41. package/src/Spinner/Spinner.vue +2 -5
  42. package/src/StyledTable/StyledTable.vue +2 -5
  43. package/src/Temperature/Temperature.vue +11 -22
@@ -12,58 +12,36 @@
12
12
  p(v-if="resizing") Resizing...
13
13
  </template>
14
14
 
15
- <script>
15
+ <script setup>
16
+ import { ref } from 'vue';
16
17
  import ImageBlobReduce from 'image-blob-reduce';
17
- import ImageInput from '../ImageInput/ImageInput.vue'
18
- import { defineComponent } from 'vue';
19
- export default defineComponent({
20
- name: "ResizeImageUpload",
21
- components: {
22
- ImageInput: ImageInput,
23
- },
24
- props: {
25
- id: {
26
- type: String,
27
- },
28
- required: {
29
- type: Boolean,
30
- },
31
- placeholder: {
32
- type: String,
33
- },
34
- dropPlaceholder: {
35
- type: String,
36
- },
37
- label: {
38
- type: String,
39
- },
40
- file: {
41
- type: Object,
42
- },
43
- },
44
- data() {
45
- return {
46
- rawImage: null,
47
- resizing: false,
48
- };
49
- },
50
- emits: ['loaded', 'error'],
51
- methods: {
52
- async onInput(file) {
53
- try {
54
- this.resizing = true;
55
- const reduce = new ImageBlobReduce();
56
- const blob = await reduce.toBlob(file, { max: 1024 });
57
- const newFile = new File([blob], file.name, { type: file.type });
58
- this.$emit('loaded', newFile);
59
- } catch (err) {
60
- this.$emit('error');
61
- } finally {
62
- this.resizing = false;
63
- }
64
- },
65
- },
18
+ import ImageInput from '../ImageInput/ImageInput.vue';
19
+
20
+ defineProps({
21
+ id: String,
22
+ required: Boolean,
23
+ placeholder: String,
24
+ dropPlaceholder: String,
25
+ label: String,
26
+ file: Object,
66
27
  });
28
+
29
+ const emit = defineEmits(['loaded', 'error']);
30
+ const resizing = ref(false);
31
+
32
+ const onInput = async (file) => {
33
+ try {
34
+ resizing.value = true;
35
+ const reduce = new ImageBlobReduce();
36
+ const blob = await reduce.toBlob(file, { max: 1024 });
37
+ const newFile = new File([blob], file.name, { type: file.type });
38
+ emit('loaded', newFile);
39
+ } catch (err) {
40
+ emit('error');
41
+ } finally {
42
+ resizing.value = false;
43
+ }
44
+ };
67
45
  </script>
68
46
 
69
47
  <style scoped>
@@ -28,59 +28,34 @@ div(class="selector-container")
28
28
  )
29
29
  </template>
30
30
 
31
- <script lang="js">
32
- import { defineComponent } from 'vue';
33
- export default defineComponent({
34
- name: "Selector",
35
- props: {
36
- id: {
37
- type: String,
38
- },
39
- disabled: {
40
- type: Boolean,
41
- },
42
- label: {
43
- type: String,
44
- },
45
- initialValue: {
46
- type: String,
47
- },
48
- options: {
49
- type: Array,
50
- },
51
- },
52
- data() {
53
- return {
54
- selected: '',
55
- };
56
- },
57
- watch: {
58
- initialValue: {
59
- immediate: true,
60
- handler: function (newSelectedValue) {
61
- if (newSelectedValue !== "" && newSelectedValue !== undefined) {
62
- this.selected = newSelectedValue;
63
- }
64
- },
65
- },
66
- options: {
67
- immediate: true,
68
- handler: function (newOptions) {
69
- const enabledOptions = newOptions.filter((option) => !option.disabled);
70
- if (enabledOptions.length === 1) {
71
- this.selected = enabledOptions[0].value;
72
- this.$emit('selected', this.selected);
73
- }
74
- },
75
- },
76
- },
77
- emits: ['selected'],
78
- methods: {
79
- onChange() {
80
- this.$emit('selected', this.selected);
81
- },
82
- },
31
+ <script setup>
32
+ import { ref, watch } from 'vue';
33
+
34
+ const props = defineProps({
35
+ id: String,
36
+ disabled: Boolean,
37
+ label: String,
38
+ initialValue: String,
39
+ options: Array,
83
40
  });
41
+
42
+ const emit = defineEmits(['selected']);
43
+ const selected = ref('');
44
+
45
+ watch(() => props.initialValue, (newVal) => {
46
+ if (newVal !== "" && newVal !== undefined) selected.value = newVal;
47
+ }, { immediate: true });
48
+
49
+ watch(() => props.options, (newOptions) => {
50
+ if (!newOptions) return;
51
+ const enabledOptions = newOptions.filter((o) => !o.disabled);
52
+ if (enabledOptions.length === 1) {
53
+ selected.value = enabledOptions[0].value;
54
+ emit('selected', selected.value);
55
+ }
56
+ }, { immediate: true });
57
+
58
+ const onChange = () => emit('selected', selected.value);
84
59
  </script>
85
60
 
86
61
  <style scoped>
@@ -15,37 +15,17 @@ div(class="text-input-container")
15
15
  )
16
16
  </template>
17
17
 
18
- <script lang="js">
19
- import { defineComponent } from 'vue';
20
- export default defineComponent({
21
- name: "TextInput",
22
- props: {
23
- id: {
24
- type: String,
25
- },
26
- required: {
27
- type: Boolean,
28
- },
29
- disabled: {
30
- type: Boolean,
31
- },
32
- placeholder: {
33
- type: String,
34
- },
35
- label: {
36
- type: String,
37
- },
38
- text: {
39
- type: String,
40
- },
41
- },
42
- emits: ['update'],
43
- methods: {
44
- onInput(event) {
45
- this.$emit('update', event.target.value);
46
- },
47
- },
18
+ <script setup>
19
+ defineProps({
20
+ id: String,
21
+ required: Boolean,
22
+ disabled: Boolean,
23
+ placeholder: String,
24
+ label: String,
25
+ text: String,
48
26
  });
27
+ const emit = defineEmits(['update']);
28
+ const onInput = (event) => emit('update', event.target.value);
49
29
  </script>
50
30
 
51
31
  <style scoped>
@@ -84,4 +64,3 @@ export default defineComponent({
84
64
  cursor: not-allowed;
85
65
  }
86
66
  </style>
87
-
@@ -7,13 +7,9 @@ div
7
7
  div(class="loading-ball red")
8
8
  </template>
9
9
 
10
- <script lang="js">
11
- import { defineComponent } from 'vue';
12
- export default defineComponent({
13
- name: "Loading",
14
- props: {
15
- text: String,
16
- },
10
+ <script setup>
11
+ defineProps({
12
+ text: String,
17
13
  });
18
14
  </script>
19
15
 
@@ -7,23 +7,16 @@ div(class="modal-overlay" v-if="open")
7
7
  danger-button.ml-2(@click="onConfirm" text="Yes")
8
8
  </template>
9
9
 
10
- <script lang="js">
11
- import { defineComponent } from 'vue';
12
- export default defineComponent({
13
- name: "Modal",
14
- emits: ['cancel', 'confirm'],
15
- props: {
16
- open: Boolean,
17
- },
18
- methods: {
19
- onCancel(evt) {
20
- this.$emit('cancel', evt);
21
- },
22
- onConfirm(evt) {
23
- this.$emit('confirm', evt);
24
- },
25
- },
10
+ <script setup>
11
+ import SecondaryButton from '../Buttons/SecondaryButton/SecondaryButton.vue';
12
+ import DangerButton from '../Buttons/DangerButton/DangerButton.vue';
13
+
14
+ defineProps({
15
+ open: Boolean,
26
16
  });
17
+ const emit = defineEmits(['cancel', 'confirm']);
18
+ const onCancel = (evt) => emit('cancel', evt);
19
+ const onConfirm = (evt) => emit('confirm', evt);
27
20
  </script>
28
21
 
29
22
  <style scoped>
@@ -19,23 +19,12 @@ button(
19
19
  )
20
20
  </template>
21
21
 
22
- <script lang="js">
23
- import { defineComponent } from 'vue';
24
- export default defineComponent({
25
- name: "MobileMenuButton",
26
- props: {
27
- open: {
28
- type: Boolean,
29
- default: false,
30
- },
31
- },
32
- emits: ['click'],
33
- methods: {
34
- onClick(evt) {
35
- this.$emit('click', evt);
36
- },
37
- },
22
+ <script setup>
23
+ defineProps({
24
+ open: { type: Boolean, default: false },
38
25
  });
26
+ const emit = defineEmits(['click']);
27
+ const onClick = (evt) => emit('click', evt);
39
28
  </script>
40
29
 
41
30
  <style scoped>
@@ -58,4 +47,3 @@ export default defineComponent({
58
47
  width: 1.5rem;
59
48
  }
60
49
  </style>
61
-
@@ -2,33 +2,15 @@
2
2
  a(:href="linkDestination" :class="linkClass" aria-current="page")
3
3
  | {{ text }}
4
4
  </template>
5
- <script lang="js">
6
- import { defineComponent } from 'vue'
7
- export default defineComponent({
8
- name: "MobileNavigationLink",
9
- props: {
10
- text: {
11
- type: String,
12
- },
13
- href: {
14
- type: String,
15
- },
16
- current: {
17
- type: Boolean,
18
- },
19
- },
20
- computed: {
21
- linkClass: function () {
22
- if (this.current) {
23
- return 'current-link'
24
- }
25
- return 'regular-link'
26
- },
27
- linkDestination: function () {
28
- return this.current ? '#' : this.href
29
- },
30
- },
31
- })
5
+ <script setup>
6
+ import { computed } from 'vue';
7
+ const props = defineProps({
8
+ text: String,
9
+ href: String,
10
+ current: Boolean,
11
+ });
12
+ const linkClass = computed(() => props.current ? 'current-link' : 'regular-link');
13
+ const linkDestination = computed(() => props.current ? '#' : props.href);
32
14
  </script>
33
15
  <style scoped>
34
16
  .current-link {
@@ -17,25 +17,12 @@ transition(
17
17
  :current="link.current"
18
18
  )
19
19
  </template>
20
- <script lang="js">
21
- import MobileNavigationLink from './MobileNavigationLink.vue'
22
-
23
- import { defineComponent } from 'vue'
24
- export default defineComponent({
25
- name: "MobileNavigationLinks",
26
- components: {
27
- MobileNavigationLink: MobileNavigationLink,
28
- },
29
- props: {
30
- links: {
31
- type: Array,
32
- },
33
- open: {
34
- type: Boolean,
35
- default: false,
36
- },
37
- },
38
- })
20
+ <script setup>
21
+ import MobileNavigationLink from './MobileNavigationLink.vue';
22
+ defineProps({
23
+ links: Array,
24
+ open: { type: Boolean, default: false },
25
+ });
39
26
  </script>
40
27
  <style scoped>
41
28
  .fade-scale-enter-active,
@@ -17,60 +17,29 @@ nav(class="navbar")
17
17
  )
18
18
  mobile-navigation-links(:links="links" :open="mobileMenuOpen")
19
19
  </template>
20
- <script lang="js">
21
- import MobileNavigationLinks from './MobileNavigationLinks.vue'
22
- import NavigationLinks from './NavigationLinks.vue'
23
- import NavbarTitle from './NavbarTitle.vue'
24
- import RightContent from './RightContent.vue'
25
- import MobileMenuButton from './MobileMenuButton.vue'
20
+ <script setup>
21
+ import { ref } from 'vue';
22
+ import MobileNavigationLinks from './MobileNavigationLinks.vue';
23
+ import NavigationLinks from './NavigationLinks.vue';
24
+ import NavbarTitle from './NavbarTitle.vue';
25
+ import RightContent from './RightContent.vue';
26
+ import MobileMenuButton from './MobileMenuButton.vue';
26
27
 
27
- import { defineComponent } from 'vue'
28
- export default defineComponent({
29
- name: "Navbar",
30
- components: {
31
- NavbarTitle: NavbarTitle,
32
- NavigationLinks: NavigationLinks,
33
- MobileNavigationLinks: MobileNavigationLinks,
34
- RightContent: RightContent,
35
- MobileMenuButton: MobileMenuButton,
36
- },
37
- data() {
38
- return {
39
- mobileMenuOpen: false,
40
- }
41
- },
42
- props: {
43
- links: {
44
- type: Array,
45
- },
46
- locale: {
47
- type: String,
48
- },
49
- currentUserEmail: {
50
- type: String,
51
- },
52
- currentUserName: {
53
- type: String,
54
- },
55
- currentUserPicture: {
56
- type: String,
57
- },
58
- title: {
59
- type: String,
60
- },
61
- imageBig: {
62
- type: String,
63
- },
64
- imageSmall: {
65
- type: String,
66
- },
67
- },
68
- methods: {
69
- onMobileMenuClick() {
70
- this.mobileMenuOpen = !this.mobileMenuOpen
71
- },
72
- }
73
- })
28
+ defineProps({
29
+ links: Array,
30
+ locale: String,
31
+ currentUserEmail: String,
32
+ currentUserName: String,
33
+ currentUserPicture: String,
34
+ title: String,
35
+ imageBig: String,
36
+ imageSmall: String,
37
+ });
38
+
39
+ const mobileMenuOpen = ref(false);
40
+ const onMobileMenuClick = () => {
41
+ mobileMenuOpen.value = !mobileMenuOpen.value;
42
+ };
74
43
  </script>
75
44
  <style scoped>
76
45
  .navbar {
@@ -11,25 +11,13 @@ a(:href="href" class="title-container")
11
11
  :alt="title"
12
12
  )
13
13
  </template>
14
- <script lang="js">
15
- import { defineComponent } from 'vue'
16
- export default defineComponent({
17
- name: "NavbarTitle",
18
- props: {
19
- href: {
20
- type: String,
21
- },
22
- title: {
23
- type: String,
24
- },
25
- imageBig: {
26
- type: String,
27
- },
28
- imageSmall: {
29
- type: String,
30
- },
31
- }
32
- })
14
+ <script setup>
15
+ defineProps({
16
+ href: String,
17
+ title: String,
18
+ imageBig: String,
19
+ imageSmall: String,
20
+ });
33
21
  </script>
34
22
  <style scoped>
35
23
  .title-container {
@@ -2,33 +2,15 @@
2
2
  a(:href="linkDestination" :class="linkClass" aria-current="page")
3
3
  | {{ text }}
4
4
  </template>
5
- <script lang="js">
6
- import { defineComponent } from 'vue'
7
- export default defineComponent({
8
- name: "NavigationLink",
9
- props: {
10
- text: {
11
- type: String,
12
- },
13
- href: {
14
- type: String,
15
- },
16
- current: {
17
- type: Boolean,
18
- },
19
- },
20
- computed: {
21
- linkClass: function () {
22
- if (this.current) {
23
- return 'current-link'
24
- }
25
- return 'regular-link'
26
- },
27
- linkDestination: function () {
28
- return this.current ? '#' : this.href
29
- },
30
- },
31
- })
5
+ <script setup>
6
+ import { computed } from 'vue';
7
+ const props = defineProps({
8
+ text: String,
9
+ href: String,
10
+ current: Boolean,
11
+ });
12
+ const linkClass = computed(() => props.current ? 'current-link' : 'regular-link');
13
+ const linkDestination = computed(() => props.current ? '#' : props.href);
32
14
  </script>
33
15
  <style scoped>
34
16
  .current-link {
@@ -9,21 +9,11 @@ div(class="links-container")
9
9
  :current="link.current"
10
10
  )
11
11
  </template>
12
- <script lang="js">
13
- import NavigationLink from './NavigationLink.vue'
14
-
15
- import { defineComponent } from 'vue'
16
- export default defineComponent({
17
- name: "NavigationLinks",
18
- components: {
19
- NavigationLink: NavigationLink,
20
- },
21
- props: {
22
- links: {
23
- type: Array,
24
- },
25
- },
26
- })
12
+ <script setup>
13
+ import NavigationLink from './NavigationLink.vue';
14
+ defineProps({
15
+ links: Array,
16
+ });
27
17
  </script>
28
18
  <style scoped>
29
19
  .links-container {
@@ -8,30 +8,15 @@ div(
8
8
  :alt="avatarAlt"
9
9
  )
10
10
  </template>
11
- <script lang="js">
12
- import { defineComponent } from 'vue'
13
- export default defineComponent({
14
- name: "RightContent",
15
- props: {
16
- locale: {
17
- type: String,
18
- },
19
- currentUserEmail: {
20
- type: String,
21
- },
22
- currentUserName: {
23
- type: String,
24
- },
25
- currentUserPicture: {
26
- type: String,
27
- },
28
- },
29
- computed: {
30
- avatarAlt: function () {
31
- return this.currentUserName + ` (${this.currentUserEmail})`
32
- },
33
- },
34
- })
11
+ <script setup>
12
+ import { computed } from 'vue';
13
+ const props = defineProps({
14
+ locale: String,
15
+ currentUserEmail: String,
16
+ currentUserName: String,
17
+ currentUserPicture: String,
18
+ });
19
+ const avatarAlt = computed(() => `${props.currentUserName} (${props.currentUserEmail})`);
35
20
  </script>
36
21
  <style scoped>
37
22
  .action-container {
@@ -6,21 +6,15 @@ div(class="pagination-container")
6
6
  regular-button(:text="nextLabel")
7
7
  </template>
8
8
 
9
- <script lang="js">
9
+ <script setup>
10
10
  import { default as RegularButton } from '../Buttons/RegularButton/RegularButton.vue';
11
- import { defineComponent } from 'vue';
12
- export default defineComponent({
13
- name: "Pagination",
14
- props: {
15
- previousLabel: String,
16
- nextLabel: String,
17
- showPrevious: Boolean,
18
- previousLink: String,
19
- nextLink: String,
20
- },
21
- components: {
22
- RegularButton,
23
- },
11
+
12
+ defineProps({
13
+ previousLabel: String,
14
+ nextLabel: String,
15
+ showPrevious: Boolean,
16
+ previousLink: String,
17
+ nextLink: String,
24
18
  });
25
19
  </script>
26
20
 
@@ -7,13 +7,9 @@ div.ranges-editor
7
7
  span.label {{ range.label }}
8
8
  </template>
9
9
 
10
- <script lang="js">
11
- import { defineComponent } from 'vue';
12
- export default defineComponent({
13
- name: "RangeView",
14
- props: {
15
- ranges: Array,
16
- },
10
+ <script setup>
11
+ defineProps({
12
+ ranges: Array,
17
13
  });
18
14
  </script>
19
15
 
@@ -2,15 +2,11 @@
2
2
  h1(class="section-title") {{text}}
3
3
  </template>
4
4
 
5
- <script lang="js">
6
- import { defineComponent } from 'vue';
7
- export default defineComponent({
8
- name: 'SectionTitle',
9
- props: {
10
- text: {
11
- type: String,
12
- default: ''
13
- }
5
+ <script setup>
6
+ defineProps({
7
+ text: {
8
+ type: String,
9
+ default: ''
14
10
  }
15
11
  });
16
12
  </script>