sprintify-ui 0.5.6 → 0.5.7

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.7",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -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 pt-0">
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>
@@ -11,6 +11,7 @@
11
11
  <div class="grow flex">
12
12
  <slot
13
13
  name="navbar"
14
+ :mobile="mobile"
14
15
  :dark="dark"
15
16
  :height="heightInner"
16
17
  />
@@ -52,7 +53,7 @@
52
53
  <!-- Mobile -->
53
54
  <div
54
55
  v-if="mobile && showMobileMenu"
55
- class="absolute w-full"
56
+ class="w-full"
56
57
  :class="backgroundClass"
57
58
  >
58
59
  <slot
@@ -72,6 +73,7 @@ import BaseContainer from './BaseContainer.vue';
72
73
  import { twMerge } from 'tailwind-merge';
73
74
  import { PropType } from 'vue';
74
75
  import { useWindowSize } from '@vueuse/core';
76
+ import { disableScroll, enableScroll } from '..';
75
77
 
76
78
  defineOptions({
77
79
  inheritAttrs: false,
@@ -106,6 +108,15 @@ const mobile = computed(() => {
106
108
  return window.width.value < props.breakpoint;
107
109
  });
108
110
 
111
+ watch(
112
+ () => window.width.value,
113
+ () => {
114
+ if (!mobile.value) {
115
+ closeMenu();
116
+ }
117
+ },
118
+ );
119
+
109
120
  const heightInner = computed(() => {
110
121
  if (props.height) {
111
122
  return props.height;
@@ -127,24 +138,36 @@ const backgroundClass = computed(() => {
127
138
  });
128
139
 
129
140
  const classInternal = computed(() => {
130
- return twMerge(
131
- 'w-full',
141
+
142
+ const classes = [
143
+ 'fixed flex flex-col top-0 left-0 w-full max-h-screen',
132
144
  backgroundClass.value,
133
- props.class,
134
- )
145
+ ];
146
+
147
+ if (mobile.value) {
148
+ classes.push('overflow-y-auto');
149
+ }
150
+
151
+ return twMerge(classes, props.class)
135
152
  })
136
153
 
137
154
  const showMobileMenu = ref(false);
138
155
 
139
156
  function toggleMenu() {
140
- showMobileMenu.value = !showMobileMenu.value;
157
+ if (showMobileMenu.value) {
158
+ closeMenu();
159
+ } else {
160
+ openMenu();
161
+ }
141
162
  }
142
163
 
143
164
  function openMenu() {
165
+ disableScroll();
144
166
  showMobileMenu.value = true;
145
167
  }
146
168
 
147
169
  function closeMenu() {
170
+ enableScroll();
148
171
  showMobileMenu.value = false;
149
172
  }
150
173
 
@@ -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;