sprintify-ui 0.1.10 → 0.1.12

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -39,7 +39,7 @@
39
39
  "vue-router": "^4.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@headlessui/vue": "^1.7.9",
42
+ "@headlessui/vue": "^1.7.12",
43
43
  "color2k": "^2.0.2"
44
44
  },
45
45
  "devDependencies": {
@@ -4,7 +4,7 @@
4
4
  :href="action.href"
5
5
  :action="action.action"
6
6
  :class="classes"
7
- class="flex items-center"
7
+ class="flex items-center justify-center"
8
8
  >
9
9
  <BaseIcon
10
10
  v-if="action.icon"
@@ -8,14 +8,14 @@
8
8
  >
9
9
  <BaseIcon :icon="rowAction.icon" class="text-slate-500" />
10
10
  </button>
11
- <router-link
11
+ <RouterLink
12
12
  v-else-if="rowAction.to"
13
13
  :to="rowAction.to(row)"
14
14
  :disabled="rowAction.disabled && rowAction.disabled(row)"
15
15
  class="btn btn-white border border-slate-300 p-2 shadow-sm hover:bg-slate-100"
16
16
  >
17
17
  <BaseIcon :icon="rowAction.icon" class="text-slate-500" />
18
- </router-link>
18
+ </RouterLink>
19
19
  </template>
20
20
 
21
21
  <script lang="ts" setup>
@@ -3,37 +3,36 @@
3
3
  <BaseBreadcrumbs
4
4
  v-if="breadcrumbs"
5
5
  :breadcrumbs="breadcrumbs"
6
- :class="[attributes || subtitle ? 'mb-3' : 'mb-2']"
7
- ></BaseBreadcrumbs>
6
+ class="mb-2"
7
+ />
8
+
8
9
  <div class="lg:flex lg:items-center lg:justify-between">
9
10
  <div class="min-w-0 flex-1">
10
- <div
11
- class="flex flex-wrap items-center"
12
- :class="[compactLayout ? 'gap-2' : 'gap-3']"
13
- >
11
+ <div class="flex flex-col xs:flex-row xs:flex-wrap xs:items-center">
14
12
  <h2
15
- class="font-bold text-slate-900"
13
+ class="order-2 font-bold text-slate-900 xs:order-1"
16
14
  :class="[
17
15
  compactLayout
18
- ? 'text-2xl leading-7'
19
- : 'truncate text-3xl tracking-tight',
16
+ ? 'mr-2 text-2xl leading-7'
17
+ : 'mr-3 truncate text-3xl tracking-tight',
20
18
  ]"
21
19
  >
22
20
  {{ title }}
23
21
  </h2>
24
22
 
25
- <BaseBadge
26
- v-if="badge"
27
- :color="badge.color"
28
- :icon="badge.icon"
29
- class="relative -bottom-px"
30
- >
31
- {{ badge.label }}
32
- </BaseBadge>
23
+ <div v-if="badge" class="order-1 mb-1 xs:order-2 xs:mb-0">
24
+ <BaseBadge
25
+ :color="badge.color"
26
+ :icon="badge.icon"
27
+ class="relative xs:-bottom-[2px]"
28
+ >
29
+ {{ badge.label }}
30
+ </BaseBadge>
31
+ </div>
33
32
  </div>
34
33
  <h3
35
34
  v-if="subtitle"
36
- class="mt-0.5 leading-tight text-slate-500"
35
+ class="mt-1 leading-tight text-slate-500"
37
36
  :class="[compactLayout ? 'text-sm' : 'truncate text-base']"
38
37
  >
39
38
  {{ subtitle }}
@@ -70,7 +69,7 @@
70
69
  />
71
70
 
72
71
  <BaseMenu
73
- v-if="secondaryActions.length"
72
+ v-if="secondaryActions.length > 1"
74
73
  :items="secondaryActions"
75
74
  size="sm"
76
75
  position="bottom-right"
@@ -88,6 +87,11 @@
88
87
  </div>
89
88
  </template>
90
89
  </BaseMenu>
90
+ <BaseActionItemButton
91
+ v-else-if="secondaryActions.length === 1"
92
+ :action="secondaryActions[0]"
93
+ size="sm"
94
+ />
91
95
  </div>
92
96
 
93
97
  <div v-else class="mt-5 flex gap-2 lg:mt-0 lg:ml-4">
@@ -131,13 +135,21 @@ const props = withDefaults(
131
135
  );
132
136
 
133
137
  const primaryActionIndex = computed(() => {
134
- if (!props.actions) {
138
+ if (!props.actions || props.actions.length === 0) {
135
139
  return undefined;
136
140
  }
141
+
137
142
  if (props.actions?.length === 1) {
138
143
  return 0;
139
144
  }
140
- return props.actions?.findIndex((a) => a.color == 'primary');
145
+
146
+ const primaryIndex = props.actions?.findIndex((a) => a.color == 'primary');
147
+
148
+ if (primaryIndex !== -1) {
149
+ return primaryIndex;
150
+ }
151
+
152
+ return 0;
141
153
  });
142
154
 
143
155
  const primaryAction = computed(() => {
@@ -147,7 +159,7 @@ const primaryAction = computed(() => {
147
159
 
148
160
  const index = primaryActionIndex.value;
149
161
 
150
- if (index) {
162
+ if (index !== undefined) {
151
163
  return props.actions[index];
152
164
  }
153
165
 
@@ -30,6 +30,7 @@
30
30
  @click="onClick"
31
31
  ></BaseLayoutNotificationItem>
32
32
  </template>
33
+
33
34
  <div
34
35
  v-if="notificationsConfig.items.length == 0"
35
36
  class="flex items-center justify-center p-6"
@@ -49,14 +50,11 @@
49
50
  v-if="notificationsConfig.footerTo"
50
51
  class="mt-1 border-t border-slate-200 pt-1"
51
52
  >
52
- <RouterLink
53
- v-slot="{ href, navigate }"
54
- custom
55
- :to="notificationsConfig.footerTo"
56
- >
57
- <MenuItem as="a" :href="href" @click="navigate">
53
+ <MenuItem v-slot="{ active, close }">
54
+ <RouterLink :to="notificationsConfig.footerTo" @mouseup="close">
58
55
  <div
59
56
  class="hover block px-3 py-2 text-center text-sm font-medium text-primary-600 hover:bg-slate-100"
57
+ :class="[active ? 'bg-slate-100' : '']"
60
58
  >
61
59
  {{
62
60
  notificationsConfig.footerLabel
@@ -64,8 +62,8 @@
64
62
  : $t('sui.see_all_notifications')
65
63
  }}
66
64
  </div>
67
- </MenuItem>
68
- </RouterLink>
65
+ </RouterLink>
66
+ </MenuItem>
69
67
  </div>
70
68
  </template>
71
69
  </BaseMenu>
@@ -1,32 +1,18 @@
1
1
  <template>
2
- <router-link
3
- v-if="notification.to"
4
- v-slot="{ href, navigate }"
5
- custom
6
- :to="notification.to"
7
- >
8
- <MenuItem
9
- v-slot="{ active }"
10
- as="a"
11
- :href="href"
12
- @click.prevent="onClick(navigate)"
13
- >
2
+ <MenuItem v-if="notification.to" v-slot="{ active, close }">
3
+ <RouterLink :to="notification.to" @mouseup="onClick(close)">
14
4
  <BaseLayoutNotificationItemContent
15
5
  :active="active"
16
6
  :notification="notification"
17
7
  ></BaseLayoutNotificationItemContent>
18
- </MenuItem>
19
- </router-link>
8
+ </RouterLink>
9
+ </MenuItem>
20
10
  <div v-else>
21
- <MenuItem
22
- v-slot="{ active }"
23
- as="button"
24
- class="w-full text-left"
25
- @click.prevent="onClick()"
26
- >
11
+ <MenuItem v-slot="{ active }" as="button" class="w-full text-left">
27
12
  <BaseLayoutNotificationItemContent
28
13
  :active="active"
29
14
  :notification="notification"
15
+ @mouseup="onClick()"
30
16
  ></BaseLayoutNotificationItemContent>
31
17
  </MenuItem>
32
18
  </div>
@@ -47,10 +33,11 @@ const props = defineProps({
47
33
  },
48
34
  });
49
35
 
50
- function onClick(navigate: (() => void) | null) {
36
+ function onClick(close: () => void | null) {
51
37
  emit('click', props.notification);
52
- if (navigate) {
53
- navigate();
38
+
39
+ if (close) {
40
+ close();
54
41
  }
55
42
  }
56
43
  </script>
@@ -6,9 +6,9 @@
6
6
 
7
7
  <div class="flex justify-center">
8
8
  <!-- Logo -->
9
- <router-link to="/" class="flex flex-shrink-0 items-center p-2 pl-0">
9
+ <RouterLink to="/" class="flex flex-shrink-0 items-center p-2 pl-0">
10
10
  <img class="block h-8 w-auto" :src="logoUrl" :alt="appName" />
11
- </router-link>
11
+ </RouterLink>
12
12
 
13
13
  <!-- Links (desktop) -->
14
14
  <div class="ml-10 hidden space-x-4 md:flex">
@@ -27,18 +27,8 @@
27
27
  <template v-for="item in items" :key="item.label + 'link'">
28
28
  <div v-if="item.line" class="my-1 -mx-1 flex h-px bg-slate-200" />
29
29
 
30
- <router-link
31
- v-else-if="item.to"
32
- v-slot="{ href, navigate }"
33
- custom
34
- :to="item.to"
35
- >
36
- <MenuItem
37
- v-slot="{ active }"
38
- as="a"
39
- :href="href"
40
- @click="navigate"
41
- >
30
+ <MenuItem v-else-if="item.to" v-slot="{ active, close }">
31
+ <RouterLink :to="item.to" @mouseup="close">
42
32
  <slot name="item" :item="item">
43
33
  <BaseMenuItem
44
34
  :label="item.label"
@@ -49,8 +39,8 @@
49
39
  :size="size"
50
40
  />
51
41
  </slot>
52
- </MenuItem>
53
- </router-link>
42
+ </RouterLink>
43
+ </MenuItem>
54
44
 
55
45
  <MenuItem
56
46
  v-else-if="item.href"
@@ -76,13 +76,13 @@ const Template = (args) => ({
76
76
 
77
77
  <div class="flex justify-center">
78
78
  <!-- Logo -->
79
- <router-link to="/" class="flex flex-shrink-0 grow items-center p-2 pl-0">
79
+ <RouterLink to="/" class="flex flex-shrink-0 grow items-center p-2 pl-0">
80
80
  <img
81
81
  class="block h-8 w-auto"
82
82
  src="https://sprintify.witify.io/img/logo/logo-side.svg"
83
83
  alt="Sprintify"
84
84
  />
85
- </router-link>
85
+ </RouterLink>
86
86
 
87
87
  <!-- Links (desktop) -->
88
88
  <div class="ml-10 hidden space-x-4 md:flex">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <router-link
2
+ <RouterLink
3
3
  v-slot="{ href, navigate, isActive, isExactActive }"
4
4
  :to="to"
5
5
  custom
@@ -29,7 +29,7 @@
29
29
  <slot :active="isActiveInternal(isActive, isExactActive)" />
30
30
  </div>
31
31
  </a>
32
- </router-link>
32
+ </RouterLink>
33
33
  </template>
34
34
 
35
35
  <script lang="ts" setup>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <li>
3
- <router-link
3
+ <RouterLink
4
4
  v-slot="{ href, navigate, isActive, isExactActive }"
5
5
  :to="to"
6
6
  custom
@@ -32,7 +32,7 @@
32
32
  </div>
33
33
  </div>
34
34
  </a>
35
- </router-link>
35
+ </RouterLink>
36
36
  </li>
37
37
  </template>
38
38
 
@@ -1,45 +0,0 @@
1
- import { PropType } from 'vue';
2
- import { RouteLocationRaw } from 'vue-router';
3
- declare const _default: import("vue").DefineComponent<{
4
- title: {
5
- required: true;
6
- type: StringConstructor;
7
- };
8
- subtitle: {
9
- default: string;
10
- type: StringConstructor;
11
- };
12
- level: {
13
- default: number;
14
- type: NumberConstructor;
15
- };
16
- back: {
17
- default: string;
18
- type: PropType<RouteLocationRaw>;
19
- };
20
- }, unknown, unknown, {
21
- titleClass(): string;
22
- subtitleClass(): string;
23
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
- title: {
25
- required: true;
26
- type: StringConstructor;
27
- };
28
- subtitle: {
29
- default: string;
30
- type: StringConstructor;
31
- };
32
- level: {
33
- default: number;
34
- type: NumberConstructor;
35
- };
36
- back: {
37
- default: string;
38
- type: PropType<RouteLocationRaw>;
39
- };
40
- }>>, {
41
- subtitle: string;
42
- level: number;
43
- back: RouteLocationRaw;
44
- }>;
45
- export default _default;
@@ -1,80 +0,0 @@
1
- <template>
2
- <div class="flex w-full space-x-4">
3
- <div v-if="back">
4
- <router-link
5
- :to="back"
6
- class="block rounded-full border border-slate-200 bg-white p-2 shadow duration-150 hover:bg-slate-100"
7
- >
8
- <BaseIcon class="h-6 w-6" icon="mdi:chevron-left" />
9
- </router-link>
10
- </div>
11
- <div class="grow sm:flex sm:items-start">
12
- <div class="sm:flex-auto">
13
- <component :is="`h${level}`" :class="titleClass">
14
- {{ title }}
15
- </component>
16
- <p v-if="subtitle" :class="subtitleClass">
17
- {{ subtitle }}
18
- </p>
19
- </div>
20
- <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
21
- <slot name="actions" />
22
- </div>
23
- </div>
24
- </div>
25
- </template>
26
-
27
- <script lang="ts">
28
- import { defineComponent, PropType } from 'vue';
29
- import { RouteLocationRaw } from 'vue-router';
30
-
31
- export default defineComponent({
32
- props: {
33
- title: {
34
- required: true,
35
- type: String,
36
- },
37
- subtitle: {
38
- default: '',
39
- type: String,
40
- },
41
- level: {
42
- default: 1,
43
- type: Number,
44
- },
45
- back: {
46
- default: '',
47
- type: [String, Object] as PropType<RouteLocationRaw>,
48
- },
49
- },
50
- computed: {
51
- titleClass(): string {
52
- let classes =
53
- 'font-display md:leading-tight font-semibold text-slate-900';
54
-
55
- if (this.level == 1) {
56
- classes += ' md:text-3xl text-3xl leading-9';
57
- }
58
-
59
- if (this.level == 2) {
60
- classes += ' md:text-xl text-xl leading-6';
61
- }
62
-
63
- return classes;
64
- },
65
- subtitleClass(): string {
66
- let classes = 'mt-1 text-slate-600';
67
-
68
- if (this.level == 1) {
69
- classes += ' text-base leading-5';
70
- }
71
-
72
- if (this.level == 2) {
73
- classes += ' text-base leading-5';
74
- }
75
-
76
- return classes;
77
- },
78
- },
79
- });
80
- </script>