sprintify-ui 0.1.9 → 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.
@@ -16663,19 +16663,27 @@ const ub = { class: "absolute inset-0 flex h-full w-full items-center justify-ce
16663
16663
  __name: "BaseHeader",
16664
16664
  props: {
16665
16665
  title: null,
16666
- subtitle: null,
16667
- attributes: null,
16668
- actions: null,
16669
- badge: null,
16670
- layout: null,
16671
- breadcrumbs: null
16666
+ subtitle: { default: void 0 },
16667
+ attributes: { default: void 0 },
16668
+ actions: { default: void 0 },
16669
+ badge: { default: void 0 },
16670
+ layout: { default: "default" },
16671
+ breadcrumbs: { default: void 0 }
16672
16672
  },
16673
16673
  setup(t) {
16674
- const r = t, e = W(
16675
- () => r.actions.findIndex((u) => u.color == "primary")
16676
- ), n = W(() => r.actions[e.value]), i = W(
16677
- () => r.actions.filter((u, f) => f !== e.value)
16678
- ), a = se(null), l = se(800);
16674
+ const r = t, e = W(() => {
16675
+ var u, f;
16676
+ if (r.actions)
16677
+ return ((u = r.actions) == null ? void 0 : u.length) === 1 ? 0 : (f = r.actions) == null ? void 0 : f.findIndex((d) => d.color == "primary");
16678
+ }), n = W(() => {
16679
+ if (!r.actions)
16680
+ return;
16681
+ const u = e.value;
16682
+ return u ? r.actions[u] : null;
16683
+ }), i = W(() => {
16684
+ var u;
16685
+ return r.actions ? (u = r.actions) == null ? void 0 : u.filter((f, d) => d !== e.value) : [];
16686
+ }), a = se(null), l = se(800);
16679
16687
  Er(a, () => {
16680
16688
  var u;
16681
16689
  l.value = ((u = a.value) == null ? void 0 : u.clientWidth) ?? 800;
@@ -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: ActionItem[];
10
- badge: {
9
+ actions?: ActionItem[] | undefined;
10
+ badge?: {
11
11
  icon: string;
12
12
  label: string;
13
13
  color: string;
14
- };
15
- layout: 'default' | 'compact';
14
+ } | undefined;
15
+ layout?: "default" | "compact" | undefined;
16
16
  breadcrumbs?: Breadcrumb[] | undefined;
17
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
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
- layout: 'default' | 'compact';
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.9",
3
+ "version": "0.1.10",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -110,25 +110,56 @@ import BaseActionItemButton from './BaseActionItemButton.vue';
110
110
  import BaseBadge from './BaseBadge.vue';
111
111
  import BaseMenu from './BaseMenu.vue';
112
112
 
113
- const props = defineProps<{
114
- title: string;
115
- subtitle?: string;
116
- attributes?: { icon: string; label: string }[];
117
- actions: ActionItem[];
118
- badge: { icon: string; label: string; color: string };
119
- layout: 'default' | 'compact';
120
- breadcrumbs?: Breadcrumb[];
121
- }>();
122
-
123
- const primaryActionIndex = computed(() =>
124
- props.actions.findIndex((a) => a.color == 'primary')
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
+ }
125
131
  );
126
132
 
127
- const primaryAction = computed(() => props.actions[primaryActionIndex.value]);
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
+ }
128
147
 
129
- const secondaryActions = computed(() =>
130
- props.actions.filter((a, i) => i !== primaryActionIndex.value)
131
- );
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
+ });
132
163
 
133
164
  const baseHeaderRef = ref<HTMLElement | null>(null);
134
165