@namelivia/vue-components 4.4.5 → 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 (54) hide show
  1. package/dist/index.esm.js +1083 -939
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +1111 -962
  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.cy.js +10 -0
  18. package/src/Icons/CalendarIcon/CalendarIcon.stories.js +24 -0
  19. package/src/Icons/CalendarIcon/CalendarIcon.vue +16 -0
  20. package/src/Icons/CreateIcon/CreateIcon.cy.js +10 -0
  21. package/src/Icons/CreateIcon/CreateIcon.stories.js +24 -0
  22. package/src/Icons/CreateIcon/CreateIcon.vue +16 -0
  23. package/src/Icons/DropIcon/DropIcon.cy.js +33 -0
  24. package/src/Icons/DropIcon/DropIcon.stories.js +24 -0
  25. package/src/Icons/DropIcon/DropIcon.vue +30 -0
  26. package/src/Icons/SaveIcon/SaveIcon.cy.js +10 -0
  27. package/src/Icons/SaveIcon/SaveIcon.stories.js +24 -0
  28. package/src/Icons/SaveIcon/SaveIcon.vue +16 -0
  29. package/src/Icons/SkullIcon/SkullIcon.cy.js +10 -0
  30. package/src/Icons/SkullIcon/SkullIcon.stories.js +24 -0
  31. package/src/Icons/SkullIcon/SkullIcon.vue +16 -0
  32. package/src/Inputs/CheckBoxInput/CheckBoxInput.vue +9 -27
  33. package/src/Inputs/ImageInput/ImageInput.vue +10 -30
  34. package/src/Inputs/NumberInput/NumberInput.vue +12 -37
  35. package/src/Inputs/ResizeImageUpload/ResizeImageUpload.vue +28 -50
  36. package/src/Inputs/Selector/Selector.vue +27 -52
  37. package/src/Inputs/TextInput/TextInput.vue +10 -31
  38. package/src/Loading/Loading.vue +3 -7
  39. package/src/Modal/Modal.vue +9 -16
  40. package/src/Navbar/MobileMenuButton.vue +5 -17
  41. package/src/Navbar/MobileNavigationLink.vue +9 -27
  42. package/src/Navbar/MobileNavigationLinks.vue +6 -19
  43. package/src/Navbar/Navbar.vue +22 -53
  44. package/src/Navbar/NavbarTitle.vue +7 -19
  45. package/src/Navbar/NavigationLink.vue +9 -27
  46. package/src/Navbar/NavigationLinks.vue +5 -15
  47. package/src/Navbar/RightContent.vue +9 -24
  48. package/src/Pagination/Pagination.vue +8 -14
  49. package/src/RangeView/RangeView.vue +3 -7
  50. package/src/SectionTitle/SectionTitle.vue +5 -9
  51. package/src/Spinner/Spinner.vue +2 -5
  52. package/src/StyledTable/StyledTable.vue +2 -5
  53. package/src/Temperature/Temperature.vue +11 -22
  54. package/src/index.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namelivia/vue-components",
3
- "version": "4.4.5",
3
+ "version": "4.6.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "peerDependencies": {
@@ -2,13 +2,9 @@
2
2
  span(class="badge")
3
3
  | {{text}}
4
4
  </template>
5
- <script lang="js">
6
- import { defineComponent } from 'vue'
7
- export default defineComponent({
8
- name: "Badge",
9
- props: {
10
- text: String,
11
- },
5
+ <script setup>
6
+ defineProps({
7
+ text: String,
12
8
  })
13
9
  </script>
14
10
  <style scoped>
@@ -3,20 +3,12 @@ button(v-on:click="onClick" class="danger-button")
3
3
  | {{text}}
4
4
  </template>
5
5
 
6
- <script lang="js">
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- name: "DangerButton",
10
- props: {
11
- text: String,
12
- },
13
- emits: ['click'],
14
- methods: {
15
- onClick(evt) {
16
- this.$emit('click', evt);
17
- },
18
- },
6
+ <script setup>
7
+ defineProps({
8
+ text: String,
19
9
  });
10
+ const emit = defineEmits(['click']);
11
+ const onClick = (evt) => emit('click', evt);
20
12
  </script>
21
13
 
22
14
  <style scoped>
@@ -3,36 +3,33 @@ button(v-on:click="onClick" :class="cssClass" :disabled="loading")
3
3
  | {{ loading ? textWhileLoading : text }}
4
4
  </template>
5
5
 
6
- <script lang="js">
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- name: "RegularButton",
10
- props: {
11
- text: String,
12
- loading: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- textWhileLoading: {
17
- type: String,
18
- default: '...',
19
- },
20
- },
21
- emits: ['click'],
22
- computed: {
23
- cssClass: function () {
24
- if (this.loading) {
25
- return 'regular-button loading';
26
- }
27
- return 'regular-button'
28
- },
6
+ <script setup>
7
+ import { computed } from 'vue';
8
+
9
+ const props = defineProps({
10
+ text: String,
11
+ loading: {
12
+ type: Boolean,
13
+ default: false,
29
14
  },
30
- methods: {
31
- onClick(evt) {
32
- this.$emit('click', evt);
33
- },
15
+ textWhileLoading: {
16
+ type: String,
17
+ default: '...',
34
18
  },
35
19
  });
20
+
21
+ const emit = defineEmits(['click']);
22
+
23
+ const cssClass = computed(() => {
24
+ if (props.loading) {
25
+ return 'regular-button loading';
26
+ }
27
+ return 'regular-button';
28
+ });
29
+
30
+ const onClick = (evt) => {
31
+ emit('click', evt);
32
+ };
36
33
  </script>
37
34
 
38
35
  <style scoped>
@@ -60,4 +57,3 @@ export default defineComponent({
60
57
  background-color: var(--color-regular-disabled);
61
58
  }
62
59
  </style>
63
-
@@ -3,13 +3,9 @@ button(type="reset" class="reset-button")
3
3
  | {{text}}
4
4
  </template>
5
5
 
6
- <script lang="js">
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- name: "ResetButton",
10
- props: {
11
- text: String,
12
- },
6
+ <script setup>
7
+ defineProps({
8
+ text: String,
13
9
  });
14
10
  </script>
15
11
 
@@ -3,20 +3,12 @@ button(v-on:click="onClick" class="secondary-button")
3
3
  | {{text}}
4
4
  </template>
5
5
 
6
- <script lang="js">
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- name: "SecondaryButton",
10
- props: {
11
- text: String,
12
- },
13
- emits: ['click'],
14
- methods: {
15
- onClick(evt) {
16
- this.$emit('click', evt);
17
- },
18
- },
6
+ <script setup>
7
+ defineProps({
8
+ text: String,
19
9
  });
10
+ const emit = defineEmits(['click']);
11
+ const onClick = (evt) => emit('click', evt);
20
12
  </script>
21
13
 
22
14
  <style scoped>
@@ -7,18 +7,10 @@ button(
7
7
  | {{text}}
8
8
  </template>
9
9
 
10
- <script lang="js">
11
- import { defineComponent } from 'vue';
12
- export default defineComponent({
13
- name: "SubmitButton",
14
- props: {
15
- text: {
16
- type: String,
17
- },
18
- disabled: {
19
- type: Boolean,
20
- },
21
- },
10
+ <script setup>
11
+ defineProps({
12
+ text: String,
13
+ disabled: Boolean,
22
14
  });
23
15
  </script>
24
16
 
package/src/Card/Card.vue CHANGED
@@ -5,26 +5,20 @@ div(v-if="!dismissed" class="card-container")
5
5
  card-body(:title="title")
6
6
  slot
7
7
  </template>
8
- <script lang="js">
9
- import { default as CardImage } from './CardImage.vue'
10
- import { default as CardBody } from './CardBody.vue'
11
- import { defineComponent } from 'vue'
12
- export default defineComponent({
13
- name: "Card",
14
- props: {
15
- image: String,
16
- title: String,
17
- dismissed: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- },
22
- components: {
23
- CardImage,
24
- CardBody,
8
+ <script setup>
9
+ import CardImage from './CardImage.vue'
10
+ import CardBody from './CardBody.vue'
11
+
12
+ defineProps({
13
+ image: String,
14
+ title: String,
15
+ dismissed: {
16
+ type: Boolean,
17
+ default: false,
25
18
  },
26
- emits: ['width']
27
- })
19
+ });
20
+
21
+ defineEmits(['width']);
28
22
  </script>
29
23
  <style scoped>
30
24
  .card-container {
@@ -5,14 +5,10 @@ div(class="card-body")
5
5
  p(class="card-text")
6
6
  slot
7
7
  </template>
8
- <script lang="js">
9
- import { defineComponent } from 'vue'
10
- export default defineComponent({
11
- name: "CardBody",
12
- props: {
13
- title: String,
14
- },
15
- })
8
+ <script setup>
9
+ defineProps({
10
+ title: String,
11
+ });
16
12
  </script>
17
13
  <style scoped>
18
14
  .card-body {
@@ -30,4 +26,3 @@ export default defineComponent({
30
26
  font-size: var(--font-size-base);
31
27
  }
32
28
  </style>
33
-
@@ -2,32 +2,25 @@
2
2
  img(:src="src" :alt="alt" ref="image")
3
3
  </template>
4
4
 
5
- <script lang="js">
6
- import { defineComponent } from 'vue'
7
- export default defineComponent({
8
- name: "CardImage",
9
- props: {
10
- src: String,
11
- alt: String,
12
- },
13
- data: function () {
14
- return {
15
- imageWidth: 0,
16
- }
17
- },
18
- methods: {
19
- calculateWidth() {
20
- return this.$refs.image.clientWidth
21
- },
22
- },
23
- emits: ['width'],
24
- mounted: function () {
25
- this.$emit('width', this.calculateWidth())
26
- },
27
- })
5
+ <script setup>
6
+ import { ref, onMounted } from 'vue';
7
+
8
+ defineProps({
9
+ src: String,
10
+ alt: String,
11
+ });
12
+
13
+ const emit = defineEmits(['width']);
14
+ const image = ref(null);
15
+
16
+ const calculateWidth = () => image.value.clientWidth;
17
+
18
+ onMounted(() => {
19
+ emit('width', calculateWidth());
20
+ });
28
21
  </script>
29
22
  <style scoped>
30
23
  img {
31
24
  width: 100%;
32
25
  }
33
- </style
26
+ </style>
@@ -2,11 +2,8 @@
2
2
  div(class="card-grid")
3
3
  slot
4
4
  </template>
5
- <script lang="js">
6
- import { defineComponent } from 'vue';
7
- export default defineComponent({
8
- name: "CardGrid"
9
- });
5
+ <script setup>
6
+ // No logic needed
10
7
  </script>
11
8
  <style scoped>
12
9
  .card-grid {
@@ -3,11 +3,8 @@ div(class="container")
3
3
  slot
4
4
  </template>
5
5
 
6
- <script lang="js">
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- name: "Container"
10
- });
6
+ <script setup>
7
+ // No logic needed
11
8
  </script>
12
9
 
13
10
  <style scoped>
@@ -0,0 +1,10 @@
1
+ import CalendarIcon from './CalendarIcon.vue'
2
+
3
+ describe('<CalendarIcon />', () => {
4
+ it('renders with default values', () => {
5
+ cy.mount(CalendarIcon)
6
+ cy.get('svg')
7
+ .should('be.visible')
8
+ .and('have.attr', 'width', '24')
9
+ })
10
+ })
@@ -0,0 +1,24 @@
1
+ import CalendarIcon from './CalendarIcon.vue';
2
+
3
+ export default {
4
+ title: 'Icons/CalendarIcon',
5
+ component: CalendarIcon,
6
+ argTypes: {
7
+ size: { control: { type: 'range', min: 12, max: 100, step: 1 } },
8
+ color: { control: 'color' },
9
+ },
10
+ };
11
+
12
+ export const Default = {
13
+ args: {
14
+ size: 24,
15
+ color: '#000000',
16
+ },
17
+ render: (args) => ({
18
+ components: { CalendarIcon },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: '<CalendarIcon v-bind="args" />',
23
+ }),
24
+ };
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" viewBox="0 0 24 24" fill="none" :stroke="color" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-icon lucide-calendar"><path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/></svg>
3
+ </template>
4
+
5
+ <script setup>
6
+ defineProps({
7
+ size: {
8
+ type: [Number, String],
9
+ default: 24
10
+ },
11
+ color: {
12
+ type: String,
13
+ default: 'currentColor'
14
+ }
15
+ });
16
+ </script>
@@ -0,0 +1,10 @@
1
+ import CreateIcon from './CreateIcon.vue'
2
+
3
+ describe('<CreateIcon />', () => {
4
+ it('renders with default values', () => {
5
+ cy.mount(CreateIcon)
6
+ cy.get('svg')
7
+ .should('be.visible')
8
+ .and('have.attr', 'width', '24')
9
+ })
10
+ })
@@ -0,0 +1,24 @@
1
+ import CreateIcon from './CreateIcon.vue';
2
+
3
+ export default {
4
+ title: 'Icons/CreateIcon',
5
+ component: CreateIcon,
6
+ argTypes: {
7
+ size: { control: { type: 'range', min: 12, max: 100, step: 1 } },
8
+ color: { control: 'color' },
9
+ },
10
+ };
11
+
12
+ export const Default = {
13
+ args: {
14
+ size: 24,
15
+ color: '#000000',
16
+ },
17
+ render: (args) => ({
18
+ components: { CreateIcon },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: '<CreateIcon v-bind="args" />',
23
+ }),
24
+ };
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" viewBox="0 0 24 24" fill="none" :stroke="color" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-badge-plus-icon lucide-badge-plus"><path d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"/><line x1="12" x2="12" y1="8" y2="16"/><line x1="8" x2="16" y1="12" y2="12"/></svg>
3
+ </template>
4
+
5
+ <script setup>
6
+ defineProps({
7
+ size: {
8
+ type: [Number, String],
9
+ default: 24
10
+ },
11
+ color: {
12
+ type: String,
13
+ default: 'currentColor'
14
+ }
15
+ });
16
+ </script>
@@ -0,0 +1,33 @@
1
+ import DropIcon from './DropIcon.vue'
2
+
3
+ describe('<DropIcon />', () => {
4
+ it('renders with default values', () => {
5
+ cy.mount(DropIcon)
6
+ cy.get('svg')
7
+ .should('be.visible')
8
+ .and('have.attr', 'width', '24')
9
+ .and('have.attr', 'stroke', 'currentColor')
10
+ })
11
+
12
+ it('renders with custom size', () => {
13
+ const customSize = 48
14
+ cy.mount(DropIcon, {
15
+ props: {
16
+ size: customSize
17
+ }
18
+ })
19
+ cy.get('svg')
20
+ .should('have.attr', 'width', customSize.toString())
21
+ .and('have.attr', 'height', customSize.toString())
22
+ })
23
+
24
+ it('renders with custom color', () => {
25
+ const customColor = 'rgb(255, 0, 0)'
26
+ cy.mount(DropIcon, {
27
+ props: {
28
+ color: customColor
29
+ }
30
+ })
31
+ cy.get('svg').should('have.attr', 'stroke', customColor)
32
+ })
33
+ })
@@ -0,0 +1,24 @@
1
+ import DropIcon from './DropIcon.vue';
2
+
3
+ export default {
4
+ title: 'Icons/DropIcon',
5
+ component: DropIcon,
6
+ argTypes: {
7
+ size: { control: { type: 'range', min: 12, max: 100, step: 1 } },
8
+ color: { control: 'color' },
9
+ },
10
+ };
11
+
12
+ export const Default = {
13
+ args: {
14
+ size: 24,
15
+ color: '#000000',
16
+ },
17
+ render: (args) => ({
18
+ components: { DropIcon },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: '<DropIcon v-bind="args" />',
23
+ }),
24
+ };
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ :width="size"
5
+ :height="size"
6
+ viewBox="0 0 24 24"
7
+ fill="none"
8
+ :stroke="color"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ class="lucide lucide-droplets-icon lucide-droplets"
13
+ >
14
+ <path d="M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z"/>
15
+ <path d="M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97"/>
16
+ </svg>
17
+ </template>
18
+
19
+ <script setup>
20
+ defineProps({
21
+ size: {
22
+ type: [Number, String],
23
+ default: 24
24
+ },
25
+ color: {
26
+ type: String,
27
+ default: 'currentColor'
28
+ }
29
+ });
30
+ </script>
@@ -0,0 +1,10 @@
1
+ import SaveIcon from './SaveIcon.vue'
2
+
3
+ describe('<SaveIcon />', () => {
4
+ it('renders with default values', () => {
5
+ cy.mount(SaveIcon)
6
+ cy.get('svg')
7
+ .should('be.visible')
8
+ .and('have.attr', 'width', '24')
9
+ })
10
+ })
@@ -0,0 +1,24 @@
1
+ import SaveIcon from './SaveIcon.vue';
2
+
3
+ export default {
4
+ title: 'Icons/SaveIcon',
5
+ component: SaveIcon,
6
+ argTypes: {
7
+ size: { control: { type: 'range', min: 12, max: 100, step: 1 } },
8
+ color: { control: 'color' },
9
+ },
10
+ };
11
+
12
+ export const Default = {
13
+ args: {
14
+ size: 24,
15
+ color: '#000000',
16
+ },
17
+ render: (args) => ({
18
+ components: { SaveIcon },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: '<SaveIcon v-bind="args" />',
23
+ }),
24
+ };
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" viewBox="0 0 24 24" fill="none" :stroke="color" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-save-icon lucide-save"><path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/></svg>
3
+ </template>
4
+
5
+ <script setup>
6
+ defineProps({
7
+ size: {
8
+ type: [Number, String],
9
+ default: 24
10
+ },
11
+ color: {
12
+ type: String,
13
+ default: 'currentColor'
14
+ }
15
+ });
16
+ </script>
@@ -0,0 +1,10 @@
1
+ import SkullIcon from './SkullIcon.vue'
2
+
3
+ describe('<SkullIcon />', () => {
4
+ it('renders with default values', () => {
5
+ cy.mount(SkullIcon)
6
+ cy.get('svg')
7
+ .should('be.visible')
8
+ .and('have.attr', 'width', '24')
9
+ })
10
+ })
@@ -0,0 +1,24 @@
1
+ import SkullIcon from './SkullIcon.vue';
2
+
3
+ export default {
4
+ title: 'Icons/SkullIcon',
5
+ component: SkullIcon,
6
+ argTypes: {
7
+ size: { control: { type: 'range', min: 12, max: 100, step: 1 } },
8
+ color: { control: 'color' },
9
+ },
10
+ };
11
+
12
+ export const Default = {
13
+ args: {
14
+ size: 24,
15
+ color: '#000000',
16
+ },
17
+ render: (args) => ({
18
+ components: { SkullIcon },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: '<SkullIcon v-bind="args" />',
23
+ }),
24
+ };
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" viewBox="0 0 24 24" fill="none" :stroke="color" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-skull-icon lucide-skull"><path d="m12.5 17-.5-1-.5 1h1z"/><path d="M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z"/><circle cx="15" cy="12" r="1"/><circle cx="9" cy="12" r="1"/></svg>
3
+ </template>
4
+
5
+ <script setup>
6
+ defineProps({
7
+ size: {
8
+ type: [Number, String],
9
+ default: 24
10
+ },
11
+ color: {
12
+ type: String,
13
+ default: 'currentColor'
14
+ }
15
+ });
16
+ </script>