sprintify-ui 0.0.189 → 0.0.190

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 (40) hide show
  1. package/dist/sprintify-ui.es.js +2691 -2681
  2. package/dist/types/src/components/BaseActionItem.vue.d.ts +22 -33
  3. package/dist/types/src/components/BaseAlert.vue.d.ts +3 -3
  4. package/dist/types/src/components/BaseAppDialogs.vue.d.ts +1 -1
  5. package/dist/types/src/components/BaseAutocomplete.vue.d.ts +1 -1
  6. package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +1 -1
  7. package/dist/types/src/components/BaseBelongsTo.vue.d.ts +1 -1
  8. package/dist/types/src/components/BaseButtonGroup.vue.d.ts +1 -1
  9. package/dist/types/src/components/BaseColor.vue.d.ts +1 -1
  10. package/dist/types/src/components/BaseCounter.vue.d.ts +3 -3
  11. package/dist/types/src/components/BaseDatePicker.vue.d.ts +1 -1
  12. package/dist/types/src/components/BaseDateSelect.vue.d.ts +1 -1
  13. package/dist/types/src/components/BaseDialog.vue.d.ts +2 -2
  14. package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +1 -1
  15. package/dist/types/src/components/BaseField.vue.d.ts +1 -1
  16. package/dist/types/src/components/BaseFieldI18n.vue.d.ts +1 -1
  17. package/dist/types/src/components/BaseInput.vue.d.ts +3 -3
  18. package/dist/types/src/components/BaseInputPercent.vue.d.ts +1 -1
  19. package/dist/types/src/components/BaseMenu.vue.d.ts +3 -3
  20. package/dist/types/src/components/BaseMenuItem.vue.d.ts +3 -3
  21. package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +1 -1
  22. package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +1 -1
  23. package/dist/types/src/components/BaseNumber.vue.d.ts +4 -4
  24. package/dist/types/src/components/BasePassword.vue.d.ts +1 -1
  25. package/dist/types/src/components/BaseRadioGroup.vue.d.ts +1 -1
  26. package/dist/types/src/components/BaseRichText.vue.d.ts +4 -4
  27. package/dist/types/src/components/BaseSelect.vue.d.ts +1 -1
  28. package/dist/types/src/components/BaseShortcut.vue.d.ts +23 -4
  29. package/dist/types/src/components/BaseStatistic.vue.d.ts +1 -1
  30. package/dist/types/src/components/BaseSwitch.vue.d.ts +4 -4
  31. package/dist/types/src/components/BaseSystemAlert.vue.d.ts +3 -3
  32. package/dist/types/src/components/BaseTableColumn.vue.d.ts +1 -1
  33. package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +1 -1
  34. package/dist/types/src/components/BaseTextarea.vue.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/components/BaseActionItem.vue +21 -28
  37. package/src/components/BaseNavbarItem.vue +4 -2
  38. package/src/components/BaseNavbarSideItem.vue +8 -5
  39. package/src/components/BaseShortcut.stories.js +20 -1
  40. package/src/components/BaseShortcut.vue +13 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.189",
3
+ "version": "0.0.190",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <RouterLink
3
- v-if="item.to"
3
+ v-if="to"
4
4
  v-slot="{ isActive, href: slotHref, navigate }"
5
5
  custom
6
- :to="item.to"
6
+ :to="to"
7
7
  >
8
8
  <a
9
9
  :active="isActive"
10
10
  :href="slotHref"
11
- :class="itemClass"
11
+ :class="props.class"
12
12
  :aria-current="isActive ? 'page' : undefined"
13
13
  @click.prevent="onClick(navigate)"
14
14
  >
@@ -16,41 +16,34 @@
16
16
  </a>
17
17
  </RouterLink>
18
18
  <button
19
- v-else-if="item.action"
19
+ v-else-if="action"
20
20
  type="button"
21
- :class="itemClass"
22
- @click="onClick(item.action)"
21
+ class="text-left"
22
+ :class="props.class"
23
+ @click="onClick(action)"
23
24
  >
24
25
  <slot :active="false"> </slot>
25
26
  </button>
26
- <a
27
- v-else-if="item.href"
28
- :href="item.href"
29
- :class="itemClass"
30
- @click="onClick()"
31
- >
27
+ <a v-else-if="href" :href="href" :class="props.class" @click="onClick()">
32
28
  <slot :active="false"> </slot>
33
29
  </a>
34
30
  </template>
35
31
 
32
+ <script lang="ts">
33
+ export default {
34
+ inheritAttrs: false,
35
+ };
36
+ </script>
37
+
36
38
  <script setup lang="ts">
37
- import { PropType } from 'vue';
38
- import { ActionItem } from '@/types';
39
+ import { RouteLocationRaw } from 'vue-router';
39
40
 
40
- defineProps({
41
- item: {
42
- required: true,
43
- type: Object as PropType<ActionItem>,
44
- },
45
- dark: {
46
- default: false,
47
- type: Boolean,
48
- },
49
- itemClass: {
50
- default: '',
51
- type: [String, Array, Object],
52
- },
53
- });
41
+ const props = defineProps<{
42
+ to?: RouteLocationRaw;
43
+ href?: string;
44
+ action?: (() => Promise<void>) | (() => void);
45
+ class?: string | string[] | null;
46
+ }>();
54
47
 
55
48
  const closeMenu = inject('closeMenu', () => {
56
49
  return;
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <div class="flex">
3
3
  <BaseActionItem
4
- :item="item"
4
+ :to="item.to"
5
+ :href="item.href"
6
+ :action="item.action"
5
7
  :dark="dark"
6
- item-class="flex w-full"
8
+ class="flex w-full"
7
9
  @click="onClick"
8
10
  >
9
11
  <template #default="{ active }">
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <div>
3
3
  <BaseActionItem
4
- :item="item"
4
+ :to="item.to"
5
+ :href="item.href"
6
+ :action="item.action"
5
7
  :dark="dark"
6
- item-class="flex w-full"
8
+ class="flex w-full"
7
9
  @click="onClick"
8
10
  >
9
11
  <template #default="{ active }">
@@ -23,9 +25,10 @@
23
25
  >
24
26
  <div v-for="subItem in item.actions" :key="subItem.label" class="mb-1">
25
27
  <BaseActionItem
26
- :item="subItem"
27
- :dark="dark"
28
- :item-class="[
28
+ :to="subItem.to"
29
+ :href="subItem.href"
30
+ :action="subItem.action"
31
+ :class="[
29
32
  'flex w-full',
30
33
  dark
31
34
  ? 'text-slate-300 hover:text-white'
@@ -35,7 +35,8 @@ export const Basic = Template.bind({});
35
35
  Basic.args = {
36
36
  to: '/restaurants',
37
37
  title: 'Basic shortcut',
38
- icon: 'heroicons:user',
38
+ icon: 'heroicons:user-solid',
39
+ color: 'blue',
39
40
  };
40
41
 
41
42
  export const Colors = (args) => ({
@@ -81,3 +82,21 @@ Contrast.args = {
81
82
  'Le lorem ipsum est, en imprimerie, une suite de mots sans signification utilisée à titre provisoire pour calibrer une mise en page',
82
83
  linkText: 'Open app',
83
84
  };
85
+
86
+ export const Href = Template.bind({});
87
+ Href.args = {
88
+ href: 'https://www.google.com',
89
+ title: 'Basic shortcut',
90
+ icon: 'heroicons:user-solid',
91
+ color: 'blue',
92
+ };
93
+
94
+ export const Action = Template.bind({});
95
+ Action.args = {
96
+ action() {
97
+ alert(1);
98
+ },
99
+ title: 'Basic shortcut',
100
+ icon: 'heroicons:user-solid',
101
+ color: 'blue',
102
+ };
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <BaseCard class="flex duration-200 hover:bg-slate-50">
3
- <router-link :to="to">
3
+ <BaseActionItem :to="to" :href="href" :action="action" class="block w-full">
4
4
  <section class="whitespace-pre-line p-4">
5
5
  <!-- Icon -->
6
6
  <div
@@ -38,7 +38,7 @@
38
38
  </div>
39
39
  </div>
40
40
  </section>
41
- </router-link>
41
+ </BaseActionItem>
42
42
  </BaseCard>
43
43
  </template>
44
44
 
@@ -48,11 +48,20 @@ import { Icon as BaseIcon } from '@iconify/vue';
48
48
  import BaseCard from './BaseCard.vue';
49
49
  import { RouteLocationRaw } from 'vue-router';
50
50
  import { getColorConfig } from '@/utils/colors';
51
+ import BaseActionItem from './BaseActionItem.vue';
51
52
 
52
53
  const props = defineProps({
53
54
  to: {
54
- required: true,
55
- type: [String, Object] as PropType<RouteLocationRaw>,
55
+ default: undefined,
56
+ type: [String, Object, undefined] as PropType<RouteLocationRaw | undefined>,
57
+ },
58
+ href: {
59
+ default: undefined,
60
+ type: [String, undefined] as PropType<string | undefined>,
61
+ },
62
+ action: {
63
+ default: undefined,
64
+ type: [Function, undefined] as PropType<() => Promise<void> | undefined>,
56
65
  },
57
66
  title: {
58
67
  required: true,