sprintify-ui 0.5.6 → 0.5.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.
@@ -36,6 +36,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
36
36
  navbar: Record<string, unknown>;
37
37
  }, {}>, {
38
38
  navbar?(_: {
39
+ mobile: boolean;
39
40
  dark: boolean;
40
41
  height: number;
41
42
  }): any;
@@ -52,6 +52,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
52
52
  breakpoint: number;
53
53
  }, {}>, {
54
54
  navbar?(_: {
55
+ mobile: boolean;
55
56
  dark: boolean;
56
57
  height: number;
57
58
  }): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,6 +1,7 @@
1
1
  import { DateTime } from 'luxon';
2
2
  import PageDashboard from '../../.storybook/components/PageDashboard.vue';
3
3
  import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
4
+ import { useSystemAlertStore } from '../stores/systemAlerts';
4
5
 
5
6
  export default {
6
7
  title: 'Layout/BaseLayoutSidebarConfigurable',
@@ -141,6 +142,13 @@ const Template = (args) => ({
141
142
  PageDashboard,
142
143
  },
143
144
  setup() {
145
+
146
+ const alerts = useSystemAlertStore();
147
+ alerts.push({
148
+ color: 'warning',
149
+ message: 'This is a warning message',
150
+ });
151
+
144
152
  return { args };
145
153
  },
146
154
  template: `
@@ -1,3 +1,4 @@
1
+ import { useSystemAlertStore } from '../stores/systemAlerts';
1
2
  import BaseContainer from './BaseContainer.vue';
2
3
  import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
3
4
 
@@ -113,6 +114,13 @@ const Template = (args) => ({
113
114
  BaseContainer,
114
115
  },
115
116
  setup() {
117
+
118
+ const alerts = useSystemAlertStore();
119
+ alerts.push({
120
+ color: 'warning',
121
+ message: 'This is a warning message',
122
+ });
123
+
116
124
  return { args };
117
125
  },
118
126
  template: `
@@ -4,7 +4,7 @@
4
4
  :dark="dark"
5
5
  :navbar="navbar"
6
6
  >
7
- <template #navbar>
7
+ <template #navbar="{ mobile }">
8
8
  <div class="flex w-full justify-between">
9
9
  <!-- Left -->
10
10
 
@@ -22,7 +22,15 @@
22
22
  </RouterLink>
23
23
 
24
24
  <!-- Links (desktop) -->
25
- <div class="ml-10 hidden space-x-2 md:flex">
25
+ <div
26
+ v-if="!mobile"
27
+ class="flex"
28
+ :class="{
29
+ 'ml-4': size == 'xs',
30
+ 'ml-6 space-x-0.5': size == 'sm',
31
+ 'ml-8 space-x-1': size == 'md',
32
+ }"
33
+ >
26
34
  <BaseNavbarItem
27
35
  v-for="item in menu"
28
36
  :key="item.label"
@@ -34,11 +42,14 @@
34
42
  </div>
35
43
 
36
44
  <!-- Right -->
37
- <div class="flex shrink-0 items-center md:ml-6">
45
+ <div
46
+ class="flex shrink-0 items-center"
47
+ :class="[mobile ? '' : 'ml-6']"
48
+ >
38
49
  <!-- Notification dropdown -->
39
50
  <BaseLayoutNotificationDropdown
40
51
  v-if="notifications"
41
- class="mr-4 md:mr-5"
52
+ :class="[mobile ? 'mr-4' : 'mr-5']"
42
53
  :dark="dark"
43
54
  :size="size"
44
55
  :notifications-config="notifications"
@@ -48,9 +59,9 @@
48
59
 
49
60
  <!-- Profile dropdown -->
50
61
  <BaseMenu
62
+ v-if="!mobile"
51
63
  tw-menu="w-52"
52
- :size="size == 'xs' ? 'xs' : 'sm'"
53
- class="hidden md:block"
64
+ :size="size"
54
65
  :items="userMenu"
55
66
  >
56
67
  <template #button="{ open }">
@@ -72,11 +83,12 @@
72
83
 
73
84
  <template #mobile>
74
85
  <!-- Links mobile -->
75
- <div class="space-y-1 p-2 pt-0">
86
+ <div class="space-y-0.5 p-2">
76
87
  <BaseNavbarSideItem
77
88
  v-for="item in menu"
78
89
  :key="item.label"
79
90
  :item="item"
91
+ size="sm"
80
92
  :dark="dark"
81
93
  />
82
94
  </div>
@@ -100,6 +112,7 @@
100
112
  v-for="item in userMenu"
101
113
  :key="item.label"
102
114
  :item="item"
115
+ size="sm"
103
116
  :dark="dark"
104
117
  />
105
118
  </div>
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <nav :class="classInternal">
2
+ <nav
3
+ ref="navRef"
4
+ :class="classInternal"
5
+ :style="{
6
+ maxHeight: `${maxHeight}px`,
7
+ }"
8
+ >
3
9
  <BaseContainer size="7xl">
4
10
  <div
5
11
  :style="{
@@ -11,6 +17,7 @@
11
17
  <div class="grow flex">
12
18
  <slot
13
19
  name="navbar"
20
+ :mobile="mobile"
14
21
  :dark="dark"
15
22
  :height="heightInner"
16
23
  />
@@ -52,7 +59,7 @@
52
59
  <!-- Mobile -->
53
60
  <div
54
61
  v-if="mobile && showMobileMenu"
55
- class="absolute w-full"
62
+ class="w-full"
56
63
  :class="backgroundClass"
57
64
  >
58
65
  <slot
@@ -71,7 +78,8 @@ import { Icon as BaseIcon } from '@iconify/vue';
71
78
  import BaseContainer from './BaseContainer.vue';
72
79
  import { twMerge } from 'tailwind-merge';
73
80
  import { PropType } from 'vue';
74
- import { useWindowSize } from '@vueuse/core';
81
+ import { useElementBounding, useWindowSize } from '@vueuse/core';
82
+ import { disableScroll, enableScroll } from '..';
75
83
 
76
84
  defineOptions({
77
85
  inheritAttrs: false,
@@ -106,6 +114,15 @@ const mobile = computed(() => {
106
114
  return window.width.value < props.breakpoint;
107
115
  });
108
116
 
117
+ watch(
118
+ () => window.width.value,
119
+ () => {
120
+ if (!mobile.value) {
121
+ closeMenu();
122
+ }
123
+ },
124
+ );
125
+
109
126
  const heightInner = computed(() => {
110
127
  if (props.height) {
111
128
  return props.height;
@@ -127,24 +144,43 @@ const backgroundClass = computed(() => {
127
144
  });
128
145
 
129
146
  const classInternal = computed(() => {
130
- return twMerge(
131
- 'w-full',
147
+
148
+ const classes = [
149
+ 'flex flex-col top-0 left-0 w-full',
132
150
  backgroundClass.value,
133
- props.class,
134
- )
151
+ ];
152
+
153
+ if (mobile.value) {
154
+ classes.push('overflow-y-auto');
155
+ }
156
+
157
+ return twMerge(classes, props.class)
135
158
  })
136
159
 
160
+ const navRef = ref<HTMLElement | null>(null);
161
+ const navRefRect = useElementBounding(navRef);
162
+
163
+ const maxHeight = computed(() => {
164
+ return window.height.value - navRefRect.top.value;
165
+ });
166
+
137
167
  const showMobileMenu = ref(false);
138
168
 
139
169
  function toggleMenu() {
140
- showMobileMenu.value = !showMobileMenu.value;
170
+ if (showMobileMenu.value) {
171
+ closeMenu();
172
+ } else {
173
+ openMenu();
174
+ }
141
175
  }
142
176
 
143
177
  function openMenu() {
178
+ disableScroll();
144
179
  showMobileMenu.value = true;
145
180
  }
146
181
 
147
182
  function closeMenu() {
183
+ enableScroll();
148
184
  showMobileMenu.value = false;
149
185
  }
150
186
 
@@ -14,6 +14,7 @@
14
14
  class="relative -top-px ml-[5px]"
15
15
  >
16
16
  <BaseCounter
17
+ :size="size"
17
18
  :count="count"
18
19
  :max-digit="2"
19
20
  color="danger"
@@ -81,9 +82,17 @@ const classes = computed(() => {
81
82
 
82
83
  const classesInner = computed(() => {
83
84
  const classList = [
84
- 'px-3 py-1 grow rounded-md duration-100 flex items-center font-medium',
85
+ 'py-1 grow rounded-md duration-100 flex items-center font-medium',
85
86
  ];
86
87
 
88
+ if (props.size == 'xs') {
89
+ classList.push('px-2 h-7')
90
+ } else if (props.size == 'sm') {
91
+ classList.push('px-2 h-8')
92
+ } else {
93
+ classList.push('px-3 h-10')
94
+ }
95
+
87
96
  if (props.dark) {
88
97
  classList.push('hover:bg-slate-700');
89
98
  } else {
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <BaseActionItem
4
+ v-if="!item.meta?.line"
4
5
  :item="item"
5
6
  class="flex w-full"
6
7
  @click="onClick"
@@ -19,7 +20,7 @@
19
20
 
20
21
  <div
21
22
  v-if="showSubActions && item.actions && item.actions.length"
22
- class="mt-2 mb-3"
23
+ class="mt-1 sm:mt-2 mb-3"
23
24
  >
24
25
  <div
25
26
  v-for="subItem in item.actions"
@@ -107,11 +108,11 @@ const subItemClasses = computed((): string[] => {
107
108
  }
108
109
 
109
110
  if (props.size == 'xs') {
110
- classList.push('pl-[33.5px] text-[13px] mb-1 pr-2.5');
111
+ classList.push('pl-3 sm:pl-[33.5px] text-[13px] mb-1 pr-2.5');
111
112
  } else if (props.size == 'sm') {
112
- classList.push('pl-[36px] text-sm mb-1.5 pr-3');
113
+ classList.push('pl-3 sm:pl-[36px] text-sm mb-1.5 pr-3');
113
114
  } else {
114
- classList.push('pl-[40px] text-base mb-1 pr-3');
115
+ classList.push('pl-3 sm:pl-[40px] text-base mb-1 pr-3');
115
116
  }
116
117
 
117
118
  return classList;