sprintify-ui 0.1.8 → 0.1.10
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/dist/sprintify-ui.es.js +4472 -4295
- package/dist/tailwindcss/index.js +20 -20
- package/dist/types/src/components/BaseActionItemButton.vue.d.ts +29 -0
- package/dist/types/src/components/BaseAddressForm.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAlert.vue.d.ts +3 -3
- package/dist/types/src/components/BaseAppDialogs.vue.d.ts +1 -1
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +5 -5
- package/dist/types/src/components/BaseAutocompleteDrawer.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +5 -5
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +3 -3
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +2 -2
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseColor.vue.d.ts +2 -2
- package/dist/types/src/components/BaseCounter.vue.d.ts +3 -3
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseDialog.vue.d.ts +2 -2
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +5 -5
- package/dist/types/src/components/BaseFieldI18n.vue.d.ts +2 -2
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +2 -2
- package/dist/types/src/components/BaseHasMany.vue.d.ts +2 -2
- package/dist/types/src/components/BaseHeader.vue.d.ts +75 -0
- package/dist/types/src/components/BaseInput.vue.d.ts +5 -5
- package/dist/types/src/components/BaseInputPercent.vue.d.ts +4 -4
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +2 -2
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +4 -4
- package/dist/types/src/components/BaseMediaListItem.vue.d.ts +1 -1
- package/dist/types/src/components/BaseMenuItem.vue.d.ts +3 -3
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseModalSide.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNumber.vue.d.ts +7 -7
- package/dist/types/src/components/BasePassword.vue.d.ts +2 -2
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +1 -1
- package/dist/types/src/components/BaseRichText.vue.d.ts +2 -2
- package/dist/types/src/components/BaseSelect.vue.d.ts +3 -3
- package/dist/types/src/components/BaseSwitch.vue.d.ts +4 -4
- package/dist/types/src/components/BaseSystemAlert.vue.d.ts +3 -3
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +4 -4
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +2 -2
- package/dist/types/src/components/BaseTextarea.vue.d.ts +3 -3
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +2 -2
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts +6 -5
- package/package.json +1 -1
- package/src/components/BaseActionItemButton.vue +73 -0
- package/src/components/BaseBreadcrumbs.vue +25 -6
- package/src/components/BaseHeader.stories.js +120 -0
- package/src/components/BaseHeader.vue +177 -0
- package/src/components/BaseMenuItem.vue +3 -1
- package/src/components/index.ts +2 -0
- package/src/lang/en.json +1 -0
- package/src/lang/fr.json +1 -0
- package/src/types/index.ts +6 -5
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import BaseHeader from './BaseHeader.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseHeader',
|
|
5
|
+
component: BaseHeader,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => ({
|
|
9
|
+
components: {
|
|
10
|
+
BaseHeader,
|
|
11
|
+
},
|
|
12
|
+
setup() {
|
|
13
|
+
return { args };
|
|
14
|
+
},
|
|
15
|
+
template: `
|
|
16
|
+
<BaseHeader v-bind="args"></BaseHeader>
|
|
17
|
+
`,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const badge = {
|
|
21
|
+
label: 'Draft',
|
|
22
|
+
color: 'yellow',
|
|
23
|
+
icon: 'heroicons:document-text-solid',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const attributes = [
|
|
27
|
+
{
|
|
28
|
+
label: 'Full Time',
|
|
29
|
+
icon: 'heroicons:briefcase-solid',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Remote',
|
|
33
|
+
icon: 'heroicons:map-pin-solid',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const actions = [
|
|
38
|
+
{
|
|
39
|
+
label: 'Edit',
|
|
40
|
+
to: '/articles',
|
|
41
|
+
icon: 'heroicons:pencil-solid',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'View',
|
|
45
|
+
icon: 'heroicons:link-solid',
|
|
46
|
+
action() {
|
|
47
|
+
alert('View');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'Publish',
|
|
52
|
+
to: '/articles',
|
|
53
|
+
color: 'primary',
|
|
54
|
+
icon: 'heroicons:check-solid',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const breadcrumbs = [
|
|
59
|
+
{
|
|
60
|
+
label: 'Home',
|
|
61
|
+
icon: 'heroicons:home-20-solid',
|
|
62
|
+
to: '/',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'Users',
|
|
66
|
+
to: '/users',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'John Doe',
|
|
70
|
+
to: '/users/1',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: 'Very long title this is a very long title that will be truncated',
|
|
74
|
+
to: '/users/1/settings',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
export const Demo = Template.bind({});
|
|
79
|
+
Demo.args = {
|
|
80
|
+
title: 'Create Article',
|
|
81
|
+
subtitle: 'Create a new article, and publish it to the world. ',
|
|
82
|
+
actions: actions,
|
|
83
|
+
attributes: attributes,
|
|
84
|
+
badge: badge,
|
|
85
|
+
breadcrumbs: breadcrumbs,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Simple = Template.bind({});
|
|
89
|
+
Simple.args = {
|
|
90
|
+
title: 'Create Article',
|
|
91
|
+
actions: actions,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Subtitle = Template.bind({});
|
|
95
|
+
Subtitle.args = {
|
|
96
|
+
title: 'Create Article',
|
|
97
|
+
subtitle: 'Create a new article, and publish it to the world. ',
|
|
98
|
+
actions: actions,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const Attributes = Template.bind({});
|
|
102
|
+
Attributes.args = {
|
|
103
|
+
title: 'Create Article',
|
|
104
|
+
attributes: attributes,
|
|
105
|
+
actions: actions,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const Badge = Template.bind({});
|
|
109
|
+
Badge.args = {
|
|
110
|
+
title: 'Create Article',
|
|
111
|
+
actions: actions,
|
|
112
|
+
badge: badge,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Breadcrumbs = Template.bind({});
|
|
116
|
+
Breadcrumbs.args = {
|
|
117
|
+
title: 'Create Article',
|
|
118
|
+
actions: actions,
|
|
119
|
+
breadcrumbs: breadcrumbs,
|
|
120
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="baseHeaderRef">
|
|
3
|
+
<BaseBreadcrumbs
|
|
4
|
+
v-if="breadcrumbs"
|
|
5
|
+
:breadcrumbs="breadcrumbs"
|
|
6
|
+
:class="[attributes || subtitle ? 'mb-3' : 'mb-2']"
|
|
7
|
+
></BaseBreadcrumbs>
|
|
8
|
+
<div class="lg:flex lg:items-center lg:justify-between">
|
|
9
|
+
<div class="min-w-0 flex-1">
|
|
10
|
+
<div
|
|
11
|
+
class="flex flex-wrap items-center"
|
|
12
|
+
:class="[compactLayout ? 'gap-2' : 'gap-3']"
|
|
13
|
+
>
|
|
14
|
+
<h2
|
|
15
|
+
class="font-bold text-slate-900"
|
|
16
|
+
:class="[
|
|
17
|
+
compactLayout
|
|
18
|
+
? 'text-2xl leading-7'
|
|
19
|
+
: 'truncate text-3xl tracking-tight',
|
|
20
|
+
]"
|
|
21
|
+
>
|
|
22
|
+
{{ title }}
|
|
23
|
+
</h2>
|
|
24
|
+
|
|
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>
|
|
33
|
+
</div>
|
|
34
|
+
<h3
|
|
35
|
+
v-if="subtitle"
|
|
36
|
+
class="mt-0.5 leading-tight text-slate-500"
|
|
37
|
+
:class="[compactLayout ? 'text-sm' : 'truncate text-base']"
|
|
38
|
+
>
|
|
39
|
+
{{ subtitle }}
|
|
40
|
+
</h3>
|
|
41
|
+
<div
|
|
42
|
+
v-if="attributes"
|
|
43
|
+
class="flex"
|
|
44
|
+
:class="[
|
|
45
|
+
compactLayout
|
|
46
|
+
? 'mt-1 flex-col'
|
|
47
|
+
: 'mt-0 flex-row flex-wrap space-x-6',
|
|
48
|
+
]"
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
v-for="attribute in attributes"
|
|
52
|
+
:key="attribute.label"
|
|
53
|
+
class="mt-2 flex items-center text-sm text-slate-500"
|
|
54
|
+
>
|
|
55
|
+
<BaseIcon
|
|
56
|
+
:icon="attribute.icon"
|
|
57
|
+
class="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
58
|
+
aria-hidden="true"
|
|
59
|
+
/>
|
|
60
|
+
{{ attribute.label }}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div v-if="compactLayout" class="mt-5 flex gap-2">
|
|
66
|
+
<BaseActionItemButton
|
|
67
|
+
v-if="primaryAction"
|
|
68
|
+
:action="primaryAction"
|
|
69
|
+
size="sm"
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<BaseMenu
|
|
73
|
+
v-if="secondaryActions.length"
|
|
74
|
+
:items="secondaryActions"
|
|
75
|
+
size="sm"
|
|
76
|
+
position="bottom-right"
|
|
77
|
+
>
|
|
78
|
+
<template #button="{ open }">
|
|
79
|
+
<div
|
|
80
|
+
class="btn btn-sm flex items-center gap-1 hover:border-slate-400"
|
|
81
|
+
:class="[open ? 'bg-slate-100' : '']"
|
|
82
|
+
>
|
|
83
|
+
<span>{{ $t('sui.more') }}</span>
|
|
84
|
+
<BaseIcon
|
|
85
|
+
icon="heroicons:chevron-down-solid"
|
|
86
|
+
class="h-5 w-5 text-slate-500"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
</BaseMenu>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div v-else class="mt-5 flex gap-2 lg:mt-0 lg:ml-4">
|
|
94
|
+
<BaseActionItemButton
|
|
95
|
+
v-for="action in actions"
|
|
96
|
+
:key="action.label"
|
|
97
|
+
:action="action"
|
|
98
|
+
size="sm"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<script setup lang="ts">
|
|
106
|
+
import { ActionItem, Breadcrumb } from '@/types';
|
|
107
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
108
|
+
import { BaseBreadcrumbs, BaseIcon } from '..';
|
|
109
|
+
import BaseActionItemButton from './BaseActionItemButton.vue';
|
|
110
|
+
import BaseBadge from './BaseBadge.vue';
|
|
111
|
+
import BaseMenu from './BaseMenu.vue';
|
|
112
|
+
|
|
113
|
+
const props = withDefaults(
|
|
114
|
+
defineProps<{
|
|
115
|
+
title: string;
|
|
116
|
+
subtitle?: string;
|
|
117
|
+
attributes?: { icon: string; label: string }[];
|
|
118
|
+
actions?: ActionItem[];
|
|
119
|
+
badge?: { icon: string; label: string; color: string };
|
|
120
|
+
layout?: 'default' | 'compact';
|
|
121
|
+
breadcrumbs?: Breadcrumb[];
|
|
122
|
+
}>(),
|
|
123
|
+
{
|
|
124
|
+
subtitle: undefined,
|
|
125
|
+
attributes: undefined,
|
|
126
|
+
actions: undefined,
|
|
127
|
+
badge: undefined,
|
|
128
|
+
layout: 'default',
|
|
129
|
+
breadcrumbs: undefined,
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const primaryActionIndex = computed(() => {
|
|
134
|
+
if (!props.actions) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
if (props.actions?.length === 1) {
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
return props.actions?.findIndex((a) => a.color == 'primary');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const primaryAction = computed(() => {
|
|
144
|
+
if (!props.actions) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const index = primaryActionIndex.value;
|
|
149
|
+
|
|
150
|
+
if (index) {
|
|
151
|
+
return props.actions[index];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return null;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const secondaryActions = computed(() => {
|
|
158
|
+
if (!props.actions) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
return props.actions?.filter((a, i) => i !== primaryActionIndex.value);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const baseHeaderRef = ref<HTMLElement | null>(null);
|
|
165
|
+
|
|
166
|
+
const width = ref(800);
|
|
167
|
+
useResizeObserver(baseHeaderRef, () => {
|
|
168
|
+
width.value = baseHeaderRef.value?.clientWidth ?? 800;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const compactLayout = computed(() => {
|
|
172
|
+
if (props.layout === 'compact') {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return width.value < 500;
|
|
176
|
+
});
|
|
177
|
+
</script>
|
|
@@ -34,7 +34,7 @@ const props = defineProps({
|
|
|
34
34
|
color: {
|
|
35
35
|
default: 'dark',
|
|
36
36
|
type: String as PropType<
|
|
37
|
-
'dark' | 'light' | 'danger' | 'success' | 'warning'
|
|
37
|
+
'dark' | 'light' | 'danger' | 'success' | 'warning' | 'primary'
|
|
38
38
|
>,
|
|
39
39
|
},
|
|
40
40
|
size: {
|
|
@@ -54,6 +54,8 @@ const textColor = computed((): string => {
|
|
|
54
54
|
return 'text-green-600';
|
|
55
55
|
} else if (props.color == 'warning') {
|
|
56
56
|
return 'text-yellow-600';
|
|
57
|
+
} else if (props.color == 'primary') {
|
|
58
|
+
return 'text-primary-600';
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
return '';
|
package/src/components/index.ts
CHANGED
|
@@ -42,6 +42,7 @@ import BaseFilePickerCrop from './BaseFilePickerCrop.vue';
|
|
|
42
42
|
import BaseFileUploader from './BaseFileUploader.vue';
|
|
43
43
|
import BaseForm from './BaseForm.vue';
|
|
44
44
|
import BaseHasMany from './BaseHasMany.vue';
|
|
45
|
+
import BaseHeader from './BaseHeader.vue';
|
|
45
46
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
46
47
|
import BaseIconPicker from './BaseIconPicker.vue';
|
|
47
48
|
import BaseInput from './BaseInput.vue';
|
|
@@ -136,6 +137,7 @@ export {
|
|
|
136
137
|
BaseFileUploader,
|
|
137
138
|
BaseForm,
|
|
138
139
|
BaseHasMany,
|
|
140
|
+
BaseHeader,
|
|
139
141
|
BaseIcon,
|
|
140
142
|
BaseIconPicker,
|
|
141
143
|
BaseInput,
|
package/src/lang/en.json
CHANGED
package/src/lang/fr.json
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -67,13 +67,13 @@ export interface PaginatedCollection extends PaginationMetadata {
|
|
|
67
67
|
|
|
68
68
|
export interface MenuItemInterface {
|
|
69
69
|
label?: string;
|
|
70
|
-
icon?: string;
|
|
71
|
-
action?: () => Promise<void> | void;
|
|
72
|
-
to?: RouteLocationRaw;
|
|
73
70
|
href?: string;
|
|
74
|
-
|
|
71
|
+
to?: RouteLocationRaw;
|
|
72
|
+
action?: () => Promise<void> | void;
|
|
73
|
+
icon?: string;
|
|
75
74
|
count?: number;
|
|
76
|
-
color?: 'dark' | 'light' | 'danger' | 'success' | 'warning';
|
|
75
|
+
color?: 'dark' | 'light' | 'danger' | 'success' | 'warning' | 'primary';
|
|
76
|
+
line?: boolean;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export interface ActionItem {
|
|
@@ -83,6 +83,7 @@ export interface ActionItem {
|
|
|
83
83
|
action?: () => Promise<void> | void;
|
|
84
84
|
icon?: string;
|
|
85
85
|
count?: number;
|
|
86
|
+
color?: 'dark' | 'light' | 'danger' | 'success' | 'warning' | 'primary';
|
|
86
87
|
disabled?: boolean;
|
|
87
88
|
meta?: Record<string, any>;
|
|
88
89
|
actions?: ActionItem[];
|