sprintify-ui 0.4.11 → 0.5.3

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 (73) hide show
  1. package/dist/sprintify-ui.es.js +11240 -11075
  2. package/dist/style.css +1 -1
  3. package/dist/types/src/components/BaseActionItem.vue.d.ts +7 -17
  4. package/dist/types/src/components/BaseActionItemButton.vue.d.ts +3 -3
  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/BaseBelongsToFetch.vue.d.ts +1 -1
  9. package/dist/types/src/components/BaseButtonGroup.vue.d.ts +1 -1
  10. package/dist/types/src/components/BaseColor.vue.d.ts +1 -1
  11. package/dist/types/src/components/BaseDataIterator.vue.d.ts +5 -4
  12. package/dist/types/src/components/BaseDataTable.vue.d.ts +8 -7
  13. package/dist/types/src/components/BaseDatePicker.vue.d.ts +9 -9
  14. package/dist/types/src/components/BaseDateSelect.vue.d.ts +1 -1
  15. package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +1 -1
  16. package/dist/types/src/components/BaseField.vue.d.ts +1 -1
  17. package/dist/types/src/components/BaseFieldI18n.vue.d.ts +1 -1
  18. package/dist/types/src/components/BaseHeader.vue.d.ts +2 -1
  19. package/dist/types/src/components/BaseInput.vue.d.ts +1 -1
  20. package/dist/types/src/components/BaseInputPercent.vue.d.ts +1 -1
  21. package/dist/types/src/components/BaseLayoutSidebarConfigurable.vue.d.ts +4 -3
  22. package/dist/types/src/components/BaseLayoutStacked.vue.d.ts +39 -7
  23. package/dist/types/src/components/BaseLayoutStackedConfigurable.vue.d.ts +20 -1
  24. package/dist/types/src/components/BaseMenu.vue.d.ts +7 -7
  25. package/dist/types/src/components/BaseMenuItem.vue.d.ts +9 -0
  26. package/dist/types/src/components/BaseNavbar.vue.d.ts +40 -8
  27. package/dist/types/src/components/BaseNavbarItem.vue.d.ts +10 -1
  28. package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +4 -4
  29. package/dist/types/src/components/BaseNavbarSideItem.vue.d.ts +1 -10
  30. package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +1 -1
  31. package/dist/types/src/components/BasePassword.vue.d.ts +1 -1
  32. package/dist/types/src/components/BaseRadioGroup.vue.d.ts +1 -1
  33. package/dist/types/src/components/BaseRichText.vue.d.ts +4 -4
  34. package/dist/types/src/components/BaseSelect.vue.d.ts +1 -1
  35. package/dist/types/src/components/BaseShortcut.vue.d.ts +1 -1
  36. package/dist/types/src/components/BaseStatistic.vue.d.ts +1 -1
  37. package/dist/types/src/components/BaseSwitch.vue.d.ts +1 -1
  38. package/dist/types/src/components/BaseSystemAlert.vue.d.ts +1 -1
  39. package/dist/types/src/components/BaseTableColumn.vue.d.ts +1 -1
  40. package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +1 -1
  41. package/dist/types/src/components/BaseTextarea.vue.d.ts +1 -1
  42. package/dist/types/src/types/ActionItem.d.ts +15 -0
  43. package/dist/types/src/types/index.d.ts +0 -26
  44. package/package.json +1 -1
  45. package/src/components/BaseActionItem.vue +25 -14
  46. package/src/components/BaseActionItemButton.vue +14 -16
  47. package/src/components/BaseDataIterator.stories.js +1 -1
  48. package/src/components/BaseDataIterator.vue +2 -2
  49. package/src/components/BaseDataTable.stories.js +1 -1
  50. package/src/components/BaseDataTable.vue +4 -4
  51. package/src/components/BaseHeader.vue +3 -2
  52. package/src/components/BaseLayoutNotificationDropdown.vue +7 -7
  53. package/src/components/BaseLayoutSidebarConfigurable.stories.js +25 -5
  54. package/src/components/BaseLayoutSidebarConfigurable.vue +23 -27
  55. package/src/components/BaseLayoutStacked.vue +38 -11
  56. package/src/components/BaseLayoutStackedConfigurable.stories.js +50 -1
  57. package/src/components/BaseLayoutStackedConfigurable.vue +22 -6
  58. package/src/components/BaseMenu.vue +3 -3
  59. package/src/components/BaseMenuItem.vue +39 -15
  60. package/src/components/BaseNavbar.stories.js +8 -7
  61. package/src/components/BaseNavbar.vue +81 -17
  62. package/src/components/BaseNavbarItem.vue +38 -7
  63. package/src/components/BaseNavbarItemContent.vue +37 -19
  64. package/src/components/BaseNavbarSideItem.vue +22 -17
  65. package/src/components/BaseNavbarSideItemContent.vue +1 -1
  66. package/src/components/BaseShortcut.vue +5 -3
  67. package/src/components/BaseSideNavigation.stories.js +1 -1
  68. package/src/components/BaseTabItem.vue +4 -9
  69. package/src/components/BaseTabs.stories.js +7 -3
  70. package/src/components/BaseTabs.vue +94 -5
  71. package/src/stories/List.stories.js +1 -1
  72. package/src/types/ActionItem.ts +16 -0
  73. package/src/types/index.ts +0 -29
@@ -6,7 +6,7 @@ import BaseCardRow from './BaseCardRow.vue';
6
6
  import BaseCounter from './BaseCounter.vue';
7
7
 
8
8
  export default {
9
- title: 'Layout/BaseSideNavigation',
9
+ title: 'Navigation/BaseSideNavigation',
10
10
  component: BaseSideNavigation,
11
11
  args: {},
12
12
  };
@@ -20,19 +20,14 @@
20
20
  >
21
21
  <div class="relative flex py-1">
22
22
  <div
23
- v-if="isActiveInternal(isActive, isExactActive)"
24
- class="absolute left-0 bottom-0 w-full h-[2px] bg-primary-600"
25
- />
26
- <div
27
- class="whitespace-nowrap rounded-md"
28
23
  :class="[
29
- isActiveInternal(isActive, isExactActive)
30
- ? 'group-hover:bg-primary-100'
31
- : 'group-hover:bg-slate-200',
24
+ 'whitespace-nowrap rounded-md group-hover:bg-black group-hover:bg-opacity-5',
32
25
  sizeClassInner
33
26
  ]"
34
27
  >
35
- <slot :active="isActiveInternal(isActive, isExactActive)" />
28
+ <div class="base-tab-item-slot">
29
+ <slot :active="isActiveInternal(isActive, isExactActive)" />
30
+ </div>
36
31
  </div>
37
32
  </div>
38
33
  </a>
@@ -6,7 +6,7 @@ import BaseCardRow from './BaseCardRow.vue';
6
6
  import BaseCounter from './BaseCounter.vue';
7
7
 
8
8
  export default {
9
- title: 'Layout/BaseTabs',
9
+ title: 'Navigation/BaseTabs',
10
10
  component: BaseTabs,
11
11
  args: {},
12
12
  };
@@ -30,8 +30,12 @@ const Template = (args) => ({
30
30
  <BaseTabItem to="/" v-slot="{active}">
31
31
  <div class="flex items-center">
32
32
  <span class="mr-1">Home</span>
33
- <BaseCounter :size="['lg', 'md'].includes(args.size) ? 'sm' : 'xs'" :color="active ? 'primary' : 'light'" :count="1"></BaseCounter>
34
- </div>
33
+ <BaseCounter
34
+ :size="['lg', 'md'].includes(args.size) ? 'sm' : 'xs'"
35
+ :color="active ? 'primary' : 'light'"
36
+ :count="1"
37
+ ></BaseCounter>
38
+ </div>
35
39
  </BaseTabItem>
36
40
  <BaseTabItem to="/setup">
37
41
  Setup
@@ -4,9 +4,20 @@
4
4
  <div
5
5
  ref="scrollable"
6
6
  class="scrollable relative overflow-x-auto overflow-y-hidden"
7
+ :class="{
8
+ '-mx-2': size == 'xs',
9
+ '-mx-3': size == 'sm',
10
+ '-mx-4': size == 'md',
11
+ '-mx-5': size == 'lg',
12
+ }"
7
13
  data-scroll-lock-scrollable
8
14
  >
9
15
  <ul class="flex text-center">
16
+ <div
17
+ ref="lineRef"
18
+ style="visibility: hidden; width: 0px;"
19
+ class="absolute left-0 bottom-0 w-full h-[2px] bg-primary-600"
20
+ />
10
21
  <slot />
11
22
  </ul>
12
23
  </div>
@@ -31,6 +42,7 @@ watch(
31
42
  () => {
32
43
  nextTick(() => {
33
44
  scrollToCenter();
45
+ animateLine();
34
46
  });
35
47
  }
36
48
  );
@@ -40,15 +52,37 @@ provide(
40
52
  computed(() => props.size)
41
53
  );
42
54
 
43
- function scrollToCenter() {
55
+ function getActiveTab(): HTMLElement | null {
56
+
44
57
  if (!scrollable.value) {
45
- return;
58
+ return null;
46
59
  }
47
60
 
48
- const activeTab = scrollable.value.querySelector(
61
+ return scrollable.value.querySelector(
49
62
  '.active'
50
63
  ) as HTMLElement | null;
51
64
 
65
+ }
66
+
67
+ function getActiveTabSlot(): HTMLElement | null {
68
+
69
+ if (!scrollable.value) {
70
+ return null;
71
+ }
72
+
73
+ return scrollable.value.querySelector(
74
+ '.active .base-tab-item-slot'
75
+ ) as HTMLElement | null;
76
+
77
+ }
78
+
79
+ function scrollToCenter() {
80
+ if (!scrollable.value) {
81
+ return;
82
+ }
83
+
84
+ const activeTab = getActiveTab();
85
+
52
86
  if (!activeTab) {
53
87
  return;
54
88
  }
@@ -56,14 +90,69 @@ function scrollToCenter() {
56
90
  const scrollableRect = scrollable.value.getBoundingClientRect();
57
91
  const activeTabRect = activeTab.getBoundingClientRect();
58
92
 
59
- const scrollLeft =
60
- activeTab.offsetLeft - (scrollableRect.width - activeTabRect.width) / 2;
93
+ const scrollLeft = activeTab.offsetLeft - (scrollableRect.width - activeTabRect.width) / 2;
61
94
 
62
95
  scrollable.value.scrollTo({
63
96
  left: scrollLeft,
64
97
  behavior: 'smooth',
65
98
  });
66
99
  }
100
+
101
+ // Line animation
102
+
103
+ const lineRef = ref<HTMLElement | null>(null);
104
+
105
+ onMounted(() => {
106
+ nextTick(() => {
107
+ animateLine(false);
108
+ });
109
+ });
110
+
111
+ function animateLine(animate = true) {
112
+
113
+ const activeTabSlot = getActiveTabSlot();
114
+
115
+ if (!scrollable.value) {
116
+ return;
117
+ }
118
+
119
+ if (!lineRef.value) {
120
+ return;
121
+ }
122
+
123
+ if (!activeTabSlot) {
124
+ return;
125
+ }
126
+
127
+ const width = activeTabSlot.clientWidth;
128
+ const activeTabSlotRect = activeTabSlot.getBoundingClientRect();
129
+ const scrollableRect = scrollable.value.getBoundingClientRect();
130
+
131
+ const x = activeTabSlotRect.left - scrollableRect.left + scrollable.value.scrollLeft;
132
+
133
+ lineRef.value.style.visibility = 'visible';
134
+
135
+ if (!animate) {
136
+ lineRef.value.style.transform = `translateX(${x}px)`;
137
+ lineRef.value.style.width = `${width}px`;
138
+ return;
139
+ }
140
+
141
+ lineRef.value.animate(
142
+ [
143
+ {
144
+ transform: `translateX(${x}px)`,
145
+ width: `${width}px`,
146
+ },
147
+ ],
148
+ {
149
+ duration: 200,
150
+ easing: 'ease-in-out',
151
+ fill: 'both',
152
+ }
153
+ );
154
+
155
+ }
67
156
  </script>
68
157
 
69
158
  <style scoped>
@@ -55,7 +55,7 @@ export default {
55
55
  icon: 'heroicons:arrow-down-tray',
56
56
  action: () => alert('export!'),
57
57
  },
58
- { line: true },
58
+ { meta: { line: true } },
59
59
  {
60
60
  label: 'Delete all',
61
61
  icon: 'heroicons:trash',
@@ -0,0 +1,16 @@
1
+ import { RouteLocationRaw } from "vue-router";
2
+ import { ActionColors } from ".";
3
+
4
+ export interface ActionItem {
5
+ label?: string;
6
+ description?: string;
7
+ href?: string;
8
+ to?: RouteLocationRaw;
9
+ action?: () => Promise<void> | void;
10
+ icon?: string;
11
+ count?: number;
12
+ color?: ActionColors;
13
+ disabled?: boolean;
14
+ meta?: Record<string, any>;
15
+ actions?: ActionItem[];
16
+ }
@@ -75,35 +75,6 @@ export type ActionColors =
75
75
  | 'primary'
76
76
  | 'secondary';
77
77
 
78
- export interface MenuItemInterface {
79
- label?: string;
80
- href?: string;
81
- to?: RouteLocationRaw;
82
- action?: () => Promise<void> | void;
83
- icon?: string;
84
- count?: number;
85
- color?: ActionColors;
86
- line?: boolean;
87
- }
88
-
89
- export interface ActionItem {
90
- label: string;
91
- href?: string;
92
- to?: RouteLocationRaw;
93
- action?: () => Promise<void> | void;
94
- icon?: string;
95
- count?: number;
96
- color?: ActionColors;
97
- disabled?: boolean;
98
- meta?: Record<string, any>;
99
- actions?: ActionItem[];
100
- }
101
-
102
- export interface ActionSection {
103
- title: string;
104
- actions: ActionItem[];
105
- }
106
-
107
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
79
  export type Row = Record<string, any>;
109
80