sprintify-ui 0.1.9 → 0.1.11
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.
|
@@ -1,35 +1,63 @@
|
|
|
1
1
|
import { ActionItem, Breadcrumb } from '@/types';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
title: string;
|
|
4
4
|
subtitle?: string | undefined;
|
|
5
5
|
attributes?: {
|
|
6
6
|
icon: string;
|
|
7
7
|
label: string;
|
|
8
8
|
}[] | undefined;
|
|
9
|
-
actions
|
|
10
|
-
badge
|
|
9
|
+
actions?: ActionItem[] | undefined;
|
|
10
|
+
badge?: {
|
|
11
11
|
icon: string;
|
|
12
12
|
label: string;
|
|
13
13
|
color: string;
|
|
14
|
-
};
|
|
15
|
-
layout
|
|
14
|
+
} | undefined;
|
|
15
|
+
layout?: "default" | "compact" | undefined;
|
|
16
16
|
breadcrumbs?: Breadcrumb[] | undefined;
|
|
17
|
-
}>, {
|
|
17
|
+
}>, {
|
|
18
|
+
subtitle: undefined;
|
|
19
|
+
attributes: undefined;
|
|
20
|
+
actions: undefined;
|
|
21
|
+
badge: undefined;
|
|
22
|
+
layout: string;
|
|
23
|
+
breadcrumbs: undefined;
|
|
24
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
18
25
|
title: string;
|
|
19
26
|
subtitle?: string | undefined;
|
|
20
27
|
attributes?: {
|
|
21
28
|
icon: string;
|
|
22
29
|
label: string;
|
|
23
30
|
}[] | undefined;
|
|
31
|
+
actions?: ActionItem[] | undefined;
|
|
32
|
+
badge?: {
|
|
33
|
+
icon: string;
|
|
34
|
+
label: string;
|
|
35
|
+
color: string;
|
|
36
|
+
} | undefined;
|
|
37
|
+
layout?: "default" | "compact" | undefined;
|
|
38
|
+
breadcrumbs?: Breadcrumb[] | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
subtitle: undefined;
|
|
41
|
+
attributes: undefined;
|
|
42
|
+
actions: undefined;
|
|
43
|
+
badge: undefined;
|
|
44
|
+
layout: string;
|
|
45
|
+
breadcrumbs: undefined;
|
|
46
|
+
}>>>, {
|
|
47
|
+
attributes: {
|
|
48
|
+
icon: string;
|
|
49
|
+
label: string;
|
|
50
|
+
}[];
|
|
24
51
|
actions: ActionItem[];
|
|
52
|
+
breadcrumbs: Breadcrumb[];
|
|
53
|
+
layout: 'default' | 'compact';
|
|
54
|
+
subtitle: string;
|
|
25
55
|
badge: {
|
|
26
56
|
icon: string;
|
|
27
57
|
label: string;
|
|
28
58
|
color: string;
|
|
29
59
|
};
|
|
30
|
-
|
|
31
|
-
breadcrumbs?: Breadcrumb[] | undefined;
|
|
32
|
-
}>>>, {}>;
|
|
60
|
+
}>;
|
|
33
61
|
export default _default;
|
|
34
62
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
35
63
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -40,3 +68,8 @@ type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
40
68
|
required: true;
|
|
41
69
|
};
|
|
42
70
|
};
|
|
71
|
+
type __VLS_WithDefaults<P, D> = {
|
|
72
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
73
|
+
default: D[K];
|
|
74
|
+
} : P[K];
|
|
75
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprintify-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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.
|
|
42
|
+
"@headlessui/vue": "^1.7.12",
|
|
43
43
|
"color2k": "^2.0.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -3,37 +3,36 @@
|
|
|
3
3
|
<BaseBreadcrumbs
|
|
4
4
|
v-if="breadcrumbs"
|
|
5
5
|
:breadcrumbs="breadcrumbs"
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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-
|
|
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">
|
|
@@ -110,25 +114,64 @@ import BaseActionItemButton from './BaseActionItemButton.vue';
|
|
|
110
114
|
import BaseBadge from './BaseBadge.vue';
|
|
111
115
|
import BaseMenu from './BaseMenu.vue';
|
|
112
116
|
|
|
113
|
-
const props =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
const props = withDefaults(
|
|
118
|
+
defineProps<{
|
|
119
|
+
title: string;
|
|
120
|
+
subtitle?: string;
|
|
121
|
+
attributes?: { icon: string; label: string }[];
|
|
122
|
+
actions?: ActionItem[];
|
|
123
|
+
badge?: { icon: string; label: string; color: string };
|
|
124
|
+
layout?: 'default' | 'compact';
|
|
125
|
+
breadcrumbs?: Breadcrumb[];
|
|
126
|
+
}>(),
|
|
127
|
+
{
|
|
128
|
+
subtitle: undefined,
|
|
129
|
+
attributes: undefined,
|
|
130
|
+
actions: undefined,
|
|
131
|
+
badge: undefined,
|
|
132
|
+
layout: 'default',
|
|
133
|
+
breadcrumbs: undefined,
|
|
134
|
+
}
|
|
125
135
|
);
|
|
126
136
|
|
|
127
|
-
const
|
|
137
|
+
const primaryActionIndex = computed(() => {
|
|
138
|
+
if (!props.actions || props.actions.length === 0) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
128
141
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
if (props.actions?.length === 1) {
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const primaryIndex = props.actions?.findIndex((a) => a.color == 'primary');
|
|
147
|
+
|
|
148
|
+
if (primaryIndex !== -1) {
|
|
149
|
+
return primaryIndex;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return 0;
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const primaryAction = computed(() => {
|
|
156
|
+
if (!props.actions) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const index = primaryActionIndex.value;
|
|
161
|
+
|
|
162
|
+
if (index !== undefined) {
|
|
163
|
+
return props.actions[index];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return null;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const secondaryActions = computed(() => {
|
|
170
|
+
if (!props.actions) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return props.actions?.filter((a, i) => i !== primaryActionIndex.value);
|
|
174
|
+
});
|
|
132
175
|
|
|
133
176
|
const baseHeaderRef = ref<HTMLElement | null>(null);
|
|
134
177
|
|