edvoyui-component-library-test-flight 0.0.133 → 0.0.134

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edvoyui-component-library-test-flight",
3
3
  "private": false,
4
- "version": "0.0.133",
4
+ "version": "0.0.134",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -6,13 +6,13 @@
6
6
  Edvoy User Interface
7
7
  </h1>
8
8
 
9
- <div class="">
9
+ <div class="mb-10">
10
10
  <EUITabOutline
11
11
  activeColor="purple"
12
12
  size="sm"
13
13
  :items="allDays"
14
- :defaultActive="activeDays"
15
- @update:clicked-button="onchangeActiveTab"
14
+ :defaultActive="activeTab"
15
+ @update:activeTabItem="onchangeActiveTab"
16
16
  >
17
17
  <template v-slot:content="{ data, activeName }">
18
18
  <div class="space-y-4">
@@ -30,11 +30,34 @@
30
30
  </template>
31
31
  </EUITabOutline>
32
32
  </div>
33
+
34
+ <div>
35
+ <EUIButtonGroup
36
+ activeColor="purple"
37
+ size="sm"
38
+ :rounded="false"
39
+ :items="allDays"
40
+ :defaultActive="activeDays"
41
+ @update:activeButton="onchangeDays"
42
+ >
43
+ <template #before>
44
+ <div
45
+ class="px-2 text-sm font-normal leading-tight tracking-wide text-black me-4 font-inter"
46
+ >
47
+ Renewals due in <span class="font-bold text-red-500 text-xxs"> {{ activeDays }}</span>
48
+ </div>
49
+ </template>
50
+ <template #default="{ data, activeName}">
51
+ {{ data.name }} <small :class="activeName === data.name ? 'opacity-100': 'opacity-75'">({{ data.count }})</small>
52
+ </template>
53
+ </EUIButtonGroup>
54
+ </div>
33
55
  </div>
34
56
  </template>
35
57
  <script setup lang="ts">
36
58
  import { ref } from "vue";
37
59
  import EUITabOutline from "./tabs/EUITabOutline.vue";
60
+ import EUIButtonGroup from "./button/EUIButtonGroup.vue";
38
61
 
39
62
  const allDays = ref([
40
63
  { name: "7 days", count: 5 },
@@ -45,10 +68,15 @@ const allDays = ref([
45
68
  ]);
46
69
 
47
70
  const activeDays = ref(allDays.value[0].name);
71
+ const activeTab = ref(allDays.value[3].name)
48
72
 
49
73
  const onchangeActiveTab = (val: any) => {
50
- activeDays.value = val.name;
74
+ activeTab.value = val.name;
51
75
  };
76
+
77
+ const onchangeDays = (val:any) => {
78
+ activeDays.value = val.name
79
+ }
52
80
  </script>
53
81
  <style lang="scss"></style>
54
82
 
@@ -1,8 +1,9 @@
1
1
  <template>
2
2
  <div>
3
3
  <div
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']"
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"
6
7
  >
7
8
  <slot name="before" />
8
9
  <nav class="relative z-0 inline-flex flex-row items-center gap-2">
@@ -16,7 +17,7 @@
16
17
  <button
17
18
  v-for="(data, index) in items"
18
19
  :key="`data-${index}`"
19
- v-bind="$attrs"
20
+ v-bind="buttonAttrs"
20
21
  :type="type"
21
22
  :size="size"
22
23
  :iconType="iconType"
@@ -84,6 +85,7 @@ import {
84
85
  reactive,
85
86
  ref,
86
87
  toRefs,
88
+ useAttrs,
87
89
  } from "vue";
88
90
 
89
91
  interface Item {
@@ -97,8 +99,8 @@ const props = defineProps({
97
99
  default: () => [],
98
100
  },
99
101
  defaultActive: {
100
- type: String,
101
- default: "",
102
+ type:String,
103
+ default: '',
102
104
  },
103
105
  type: {
104
106
  type: String as PropType<"button" | "submit" | "reset">,
@@ -136,8 +138,17 @@ const props = defineProps({
136
138
  disabled: Boolean,
137
139
  });
138
140
 
141
+ defineOptions({
142
+ inheritAttrs: false, // 🛑 prevents auto-inheritance of $attrs to root
143
+ })
144
+ const attrs = useAttrs()
145
+ const buttonAttrs = computed(() => {
146
+ const { class: _class, style: _style, id: _id, ...rest } = attrs;
147
+ return rest;
148
+ });
149
+
139
150
  const emit = defineEmits<{
140
- (event: "update:clickedButton", activeTab: Item): void;
151
+ (event: "update:activeButton", activeButton: Item): void;
141
152
  }>();
142
153
 
143
154
  const { items, defaultActive } = toRefs(props);
@@ -153,7 +164,7 @@ const marker = (el: HTMLElement) => {
153
164
 
154
165
  const handleOnChange = (val: any) => {
155
166
  activeBtnName.value = val?.name;
156
- emit("update:clickedButton", val);
167
+ emit("update:activeButton", val);
157
168
  nextTick(() => {
158
169
  const activeBtn = document.querySelector(
159
170
  `nav button[data-name="${activeBtnName.value}"]`
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="bg-white">
2
+ <div class="bg-white" v-bind="$attrs">
3
3
  <div
4
4
  class="relative z-10 inline-flex items-center w-full gap-2 pt-3 overflow-hidden transition-all duration-200 ease-in border border-b-0 border-solid rounded-t-xl isolate before:h-4 before:w-px before:bg-gray-200 before:-bottom-3 before:-left-px before:absolute after:h-4 after:w-px after:bg-gray-200 after:-bottom-3 after:-right-px after:absolute bg-gradient-to-b from-gray-100"
5
5
  >
@@ -7,7 +7,7 @@
7
7
  class="relative z-0 inline-flex flex-row items-center w-full gap-2 px-6"
8
8
  >
9
9
  <div
10
- id="nav-indicator"
10
+ id="tab-indicator"
11
11
  :style="{
12
12
  '--border': allColor[activeColor],
13
13
  }"
@@ -17,10 +17,8 @@
17
17
  <button
18
18
  v-for="(data, index) in items"
19
19
  :key="`data-${index}`"
20
- v-bind="$attrs"
21
- :size="size"
22
- :iconType="iconType"
23
- :data-name="data.name"
20
+ v-bind="buttonAttrs"
21
+ :data-tab="data.name"
24
22
  :class="[
25
23
  'capitalize box-border border-none inline-flex flex-row gap-x-2 items-center',
26
24
  getBtnClass(data.name || ''),
@@ -28,7 +26,6 @@
28
26
  ]"
29
27
  :disabled="disabled"
30
28
  :loading="loading"
31
- :icon="icon"
32
29
  @click="handleOnChange(data || '')"
33
30
  style="transition: all 350ms cubic-bezier(0.15, 0.3, 0.25, 1)"
34
31
  >
@@ -97,6 +94,7 @@ import {
97
94
  reactive,
98
95
  ref,
99
96
  toRefs,
97
+ useAttrs,
100
98
  } from "vue";
101
99
 
102
100
  interface Item {
@@ -138,14 +136,23 @@ const props = defineProps({
138
136
  });
139
137
 
140
138
  const emit = defineEmits<{
141
- (event: "update:clickedButton", activeTab: Item): void;
139
+ (event: "update:activeTabItem", activeTabItem: Item): void;
142
140
  }>();
143
141
 
142
+ defineOptions({
143
+ inheritAttrs: false, // 🛑 prevents auto-inheritance of $attrs to root
144
+ });
145
+ const attrs = useAttrs();
146
+ const buttonAttrs = computed(() => {
147
+ const { class: _class, style: _style, id: _id, ...rest } = attrs;
148
+ return rest;
149
+ });
150
+
144
151
  const { items, defaultActive } = toRefs(props);
145
152
  const activeBtnName = ref(defaultActive.value || items.value[0]?.name || "");
146
153
 
147
154
  const marker = (el: HTMLElement) => {
148
- const indicator = document.querySelector("#nav-indicator") as HTMLElement;
155
+ const indicator = document.querySelector("#tab-indicator") as HTMLElement;
149
156
  if (indicator && el) {
150
157
  indicator.style.left = el.offsetLeft + "px";
151
158
  indicator.style.width = el.offsetWidth + "px";
@@ -154,10 +161,10 @@ const marker = (el: HTMLElement) => {
154
161
 
155
162
  const handleOnChange = (val: any) => {
156
163
  activeBtnName.value = val?.name;
157
- emit("update:clickedButton", val);
164
+ emit("update:activeTabItem", val);
158
165
  nextTick(() => {
159
166
  const activeBtn = document.querySelector(
160
- `nav button[data-name="${activeBtnName.value}"]`
167
+ `nav button[data-tab="${activeBtnName.value}"]`
161
168
  );
162
169
  if (activeBtn) marker(activeBtn as HTMLElement);
163
170
  });
@@ -167,7 +174,7 @@ onMounted(() => {
167
174
  nextTick(() => {
168
175
  requestAnimationFrame(() => {
169
176
  const activeBtn = document.querySelector(
170
- `nav button[data-name="${activeBtnName.value}"]`
177
+ `nav button[data-tab="${activeBtnName.value}"]`
171
178
  );
172
179
  if (activeBtn) marker(activeBtn as HTMLElement);
173
180
  });
@@ -232,7 +239,7 @@ const allColor = {
232
239
  --clr: theme("colors.white");
233
240
  }
234
241
 
235
- #nav-indicator {
242
+ #tab-indicator {
236
243
  transition: all 350ms cubic-bezier(0.15, 0.3, 0.25, 1);
237
244
  background-image: linear-gradient(90deg, #fff, #fff),
238
245
  linear-gradient(to top, #e5e7eb, #e5e7eb, var(--border));