edvoyui-component-library-test-flight 0.0.152 → 0.0.153
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/{EUIButtonGroup.vue.d.ts → button/EUIButtonGroup.vue.d.ts} +1 -1
- package/dist/button/EUIButtonGroup.vue.d.ts.map +1 -0
- package/dist/library-vue-ts.cjs.js +39 -39
- package/dist/library-vue-ts.css +1 -1
- package/dist/library-vue-ts.es.js +2680 -2675
- package/dist/library-vue-ts.umd.js +42 -42
- package/package.json +1 -1
- package/src/components/button/EUIButtonGroup.vue +34 -29
- package/dist/EUIButtonGroup.vue.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
class="inline-flex items-center gap-2 px-2 py-2 overflow-hidden transition-all duration-200 ease-in bg-white shadow-xl w-max shadow-purple-50"
|
|
5
|
+
:class="[rounded ? 'rounded-full' : 'rounded-lg']"
|
|
6
|
+
v-bind="$attrs"
|
|
7
7
|
>
|
|
8
8
|
<slot name="before" />
|
|
9
|
-
<nav
|
|
9
|
+
<nav
|
|
10
|
+
ref="navContainer"
|
|
11
|
+
class="relative z-0 inline-flex flex-row items-center gap-2"
|
|
12
|
+
>
|
|
10
13
|
<div
|
|
11
|
-
|
|
14
|
+
ref="navIndicator"
|
|
15
|
+
class="absolute left-0 top-0 h-full w-auto -z-[1] transition-all duration-350 ease-[cubic-bezier(0.15,0.3,0.25,1)]"
|
|
12
16
|
:class="[
|
|
13
17
|
getBtnClass(activeBtnName),
|
|
14
18
|
rounded ? 'rounded-full' : 'rounded-lg',
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
<button
|
|
18
22
|
v-for="(data, index) in items"
|
|
19
23
|
:key="`data-${index}`"
|
|
20
|
-
|
|
24
|
+
v-bind="buttonAttrs"
|
|
21
25
|
:type="type"
|
|
22
26
|
:size="size"
|
|
23
27
|
:iconType="iconType"
|
|
@@ -99,8 +103,8 @@ const props = defineProps({
|
|
|
99
103
|
default: () => [],
|
|
100
104
|
},
|
|
101
105
|
defaultActive: {
|
|
102
|
-
type:String,
|
|
103
|
-
default:
|
|
106
|
+
type: String,
|
|
107
|
+
default: "",
|
|
104
108
|
},
|
|
105
109
|
type: {
|
|
106
110
|
type: String as PropType<"button" | "submit" | "reset">,
|
|
@@ -139,9 +143,9 @@ const props = defineProps({
|
|
|
139
143
|
});
|
|
140
144
|
|
|
141
145
|
defineOptions({
|
|
142
|
-
inheritAttrs: false,
|
|
143
|
-
})
|
|
144
|
-
const attrs = useAttrs()
|
|
146
|
+
inheritAttrs: false,
|
|
147
|
+
});
|
|
148
|
+
const attrs = useAttrs();
|
|
145
149
|
const buttonAttrs = computed(() => {
|
|
146
150
|
const { class: _class, style: _style, id: _id, ...rest } = attrs;
|
|
147
151
|
return rest;
|
|
@@ -151,45 +155,51 @@ const emit = defineEmits<{
|
|
|
151
155
|
(event: "update:activeButton", activeButton: Item): void;
|
|
152
156
|
}>();
|
|
153
157
|
|
|
158
|
+
const navIndicator = ref<HTMLElement | null>(null);
|
|
159
|
+
const navContainer = ref<HTMLElement | null>(null);
|
|
160
|
+
|
|
154
161
|
const { items, defaultActive } = toRefs(props);
|
|
155
162
|
const activeBtnName = ref(defaultActive.value || items.value[0]?.name || "");
|
|
156
163
|
|
|
157
164
|
const marker = (el: HTMLElement) => {
|
|
158
|
-
const indicator =
|
|
165
|
+
const indicator = navIndicator.value;
|
|
159
166
|
if (indicator && el) {
|
|
160
167
|
indicator.style.left = el.offsetLeft + "px";
|
|
161
168
|
indicator.style.width = el.offsetWidth + "px";
|
|
162
169
|
}
|
|
163
170
|
};
|
|
164
171
|
|
|
172
|
+
const updateMarkerPosition = () => {
|
|
173
|
+
const activeBtn = navContainer.value?.querySelector(
|
|
174
|
+
`button[data-name="${activeBtnName.value}"]`
|
|
175
|
+
);
|
|
176
|
+
if (activeBtn) {
|
|
177
|
+
marker(activeBtn as HTMLElement);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
165
181
|
const handleOnChange = (val: any) => {
|
|
166
182
|
activeBtnName.value = val?.name;
|
|
167
183
|
emit("update:activeButton", val);
|
|
168
184
|
nextTick(() => {
|
|
169
|
-
|
|
170
|
-
`nav button[data-name="${activeBtnName.value}"]`
|
|
171
|
-
);
|
|
172
|
-
if (activeBtn) marker(activeBtn as HTMLElement);
|
|
185
|
+
updateMarkerPosition();
|
|
173
186
|
});
|
|
174
187
|
};
|
|
175
188
|
|
|
176
189
|
onMounted(() => {
|
|
177
190
|
nextTick(() => {
|
|
178
191
|
requestAnimationFrame(() => {
|
|
179
|
-
|
|
180
|
-
`nav button[data-name="${activeBtnName.value}"]`
|
|
181
|
-
);
|
|
182
|
-
if (activeBtn) marker(activeBtn as HTMLElement);
|
|
192
|
+
updateMarkerPosition();
|
|
183
193
|
});
|
|
184
194
|
});
|
|
185
195
|
});
|
|
186
196
|
|
|
187
197
|
// Computed classes for button size
|
|
188
198
|
const sizeClasses = reactive({
|
|
189
|
-
xs: "text-xs font-medium leading-[normal]", //
|
|
190
|
-
sm: "text-sm font-medium", //
|
|
191
|
-
md: "text-base font-semibold", //
|
|
192
|
-
lg: "text-base font-semibold", //
|
|
199
|
+
xs: "text-xs font-medium leading-[normal]", //24
|
|
200
|
+
sm: "text-sm font-medium", //32
|
|
201
|
+
md: "text-base font-semibold", //40
|
|
202
|
+
lg: "text-base font-semibold", //48
|
|
193
203
|
});
|
|
194
204
|
|
|
195
205
|
const btnColors = {
|
|
@@ -261,11 +271,6 @@ const getBtnClass = (btnName: string) => {
|
|
|
261
271
|
</script>
|
|
262
272
|
|
|
263
273
|
<style lang="scss" scoped>
|
|
264
|
-
#nav-indicator {
|
|
265
|
-
transition: all 350ms cubic-bezier(0.15, 0.3, 0.25, 1);
|
|
266
|
-
@apply absolute left-0 w-auto h-full top-0 -z-[1];
|
|
267
|
-
}
|
|
268
|
-
|
|
269
274
|
.bar-indicator {
|
|
270
275
|
@apply relative;
|
|
271
276
|
&::before {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EUIButtonGroup.vue.d.ts","sourceRoot":"","sources":["../src/components/button/EUIButtonGroup.vue"],"names":[],"mappings":"AACA,cAAc,6GAA6G,CAAC;AAC5H,OAAO,2HAA2H,CAAC;;AAEnI,wBAA0F"}
|