sprintify-ui 0.10.66 → 0.10.68

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.
@@ -39,6 +39,7 @@ type __VLS_Props = {
39
39
  to?: RouteLocationRaw;
40
40
  tooltip?: string | null | undefined;
41
41
  };
42
+ declare const asInternal: import("vue").ComputedRef<string>;
42
43
  declare const classes: import("vue").ComputedRef<string>;
43
44
  declare const styles: import("vue").ComputedRef<{
44
45
  backgroundColor: string;
@@ -80,6 +81,7 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
80
81
  }>;
81
82
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
82
83
  BaseIcon: typeof BaseIcon;
84
+ asInternal: typeof asInternal;
83
85
  classes: typeof classes;
84
86
  styles: typeof styles;
85
87
  containerClass: typeof containerClass;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.10.66",
3
+ "version": "0.10.68",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -94,6 +94,8 @@ export const Sizes = (args) => ({
94
94
  <BaseBadge v-bind="args" :size="size">
95
95
  Administrator
96
96
  </BaseBadge>
97
+ <BaseBadge v-bind="args" :size="size">
98
+ </BaseBadge>
97
99
  </div>
98
100
  `,
99
101
  });
@@ -127,4 +129,4 @@ export const Wrap = (args) => ({
127
129
  </BaseBadge>
128
130
  </div>
129
131
  `,
130
- });
132
+ });
@@ -67,31 +67,52 @@ const sizeInternal = computed(() => {
67
67
  return props.size;
68
68
  });
69
69
 
70
+ const slots = useSlots();
71
+
72
+ const hasDefaultSlot = computed(() => !!(slots.default));
73
+
70
74
  const classes = computed(() => {
71
75
  const base = 'inline-flex items-center rounded leading-tight';
72
- const size = {
73
- xs: 'px-1 py-px text-[9px]',
74
- sm: 'px-1.5 py-px text-[10px]',
75
- md: 'px-1.5 py-0.5 text-xs',
76
- lg: 'px-1.5 py-0.5 text-sm',
77
- xl: 'px-2.5 py-1.5 text-sm',
76
+
77
+ const fontSize = {
78
+ xs: 'text-[9px]',
79
+ sm: 'text-[10px]',
80
+ md: 'text-xs',
81
+ lg: 'text-sm',
82
+ xl: 'text-sm',
83
+ }[sizeInternal.value];
84
+
85
+ const padding = {
86
+ xs: hasDefaultSlot.value ? 'px-1 py-px' : 'p-[3.7px]',
87
+ sm: hasDefaultSlot.value ? 'px-1.5 py-px' : 'p-[3.7px]',
88
+ md: hasDefaultSlot.value ? 'px-1.5 py-0.5' : 'p-1',
89
+ lg: hasDefaultSlot.value ? 'px-1.5 py-0.5' : 'p-1',
90
+ xl: hasDefaultSlot.value ? 'px-2.5 py-1.5' : 'p-1.5',
78
91
  }[sizeInternal.value];
79
92
 
80
93
  const wrap = props.wrap ? '' : 'whitespace-nowrap';
81
94
 
82
- return twMerge(base, wrap, size, props.class);
95
+ return twMerge(base, wrap, fontSize, padding, props.class);
83
96
  })
84
97
 
85
98
  const iconSizeClasses = computed(() => {
86
99
 
87
100
  const size = {
88
- xs: 'h-2 w-2 mr-1',
89
- sm: 'h-2.5 w-2.5 mr-1',
90
- md: 'h-3 w-3 mr-1',
91
- lg: 'h-4 w-4 mr-1',
92
- xl: 'h-5 w-5 mr-1.5',
101
+ xs: 'h-2 w-2',
102
+ sm: 'h-2.5 w-2.5',
103
+ md: 'h-3 w-3',
104
+ lg: 'h-4 w-4',
105
+ xl: 'h-5 w-5',
106
+ }[sizeInternal.value];
107
+
108
+ const margin = {
109
+ xs: hasDefaultSlot.value ? 'mr-1' : '',
110
+ sm: hasDefaultSlot.value ? 'mr-1' : '',
111
+ md: hasDefaultSlot.value ? 'mr-1' : '',
112
+ lg: hasDefaultSlot.value ? 'mr-1' : '',
113
+ xl: hasDefaultSlot.value ? 'mr-1.5' : '',
93
114
  }[sizeInternal.value];
94
115
 
95
- return size;
116
+ return twMerge(size, margin);
96
117
  });
97
118
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="as"
3
+ :is="asInternal"
4
4
  ref="buttonRef"
5
5
  :class="classes"
6
6
  :style="styles"
@@ -131,7 +131,7 @@ const props = withDefaults(defineProps<{
131
131
  to?: RouteLocationRaw;
132
132
  tooltip?: string | null | undefined;
133
133
  }>(), {
134
- as: 'button',
134
+ as: undefined,
135
135
  disabled: false,
136
136
  class: '',
137
137
  loading: false,
@@ -149,6 +149,22 @@ const props = withDefaults(defineProps<{
149
149
 
150
150
  defineEmits(['click', 'mouseover', 'mouseleave', 'mouseenter']);
151
151
 
152
+ const asInternal = computed(() => {
153
+ if (props.as) {
154
+ return props.as;
155
+ }
156
+
157
+ if (props.to) {
158
+ return 'RouterLink';
159
+ }
160
+
161
+ if (props.href) {
162
+ return 'a';
163
+ }
164
+
165
+ return 'button';
166
+ });
167
+
152
168
  const sizeInternal = computed(() => {
153
169
 
154
170
  if (props.sizeBehavior == SizeBehavior.default) {