edvoyui-component-library-test-flight 0.0.53 → 0.0.55

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.53",
4
+ "version": "0.0.55",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -8,9 +8,28 @@
8
8
  <style lang="scss"></style>
9
9
 
10
10
  <!-- Development code here -->
11
- <!-- <template>
11
+ <!-- <template>
12
12
  <div class="h-[clac(100svh-64px)] w-full px-10 py-8 max-w-screen-xl mx-auto">
13
13
  <h1 class="mb-2 font-semibold text-gray-900 tetx-lg">Edvoy UI Componnet</h1>
14
+
15
+ <EUIAccordion
16
+ :datas="accordionData"
17
+ :defaultOpen="[1]"
18
+ :collapse="true"
19
+ accordionStyle="separated"
20
+ @update:activeItem="handleActiveItem"
21
+ >
22
+ <template #title="{ item}">
23
+ <div>{{ item.title }}</div>
24
+ </template>
25
+ <template #right-icon="{item}">
26
+ <div :key="item" class="w-10 h-10 bg-red-100 border border-red-500 rounded-full" />
27
+ </template>
28
+ <template #content="{item}">
29
+ <div>{{ item.content }}</div>
30
+ </template>
31
+ </EUIAccordion>
32
+
14
33
  <Delete />
15
34
  <UTableview />
16
35
  <div class="">
@@ -1024,6 +1043,11 @@ const openModal = () => {
1024
1043
  customModal.value = false;
1025
1044
  };
1026
1045
 
1046
+ // accordion active Index
1047
+ const handleActiveItem = (activeItems:number) => {
1048
+ console.log("Currently active accordion(s):", activeItems)
1049
+ }
1050
+
1027
1051
  //TODO: Select Data
1028
1052
  const datas = ref([
1029
1053
  {
@@ -9,7 +9,7 @@ const meta: Meta<typeof EUIAccordion> = {
9
9
  datas: {
10
10
  control: "object",
11
11
  description:
12
- "* The template method allows you to define how content is rendered in the <mark>EUIAccordion</mark> component. \n\n* Named slots <mark>(#title, #content)</mark> enable you to customize the display of titles and content for each accordion item.",
12
+ "* The template method allows you to define how content is rendered in the <mark>EUIAccordion</mark> component. \n\n* Named slots <mark>(#title, #content)</mark> enable you to customize the display of titles and content for each accordion item. \n\n* The <mark>item.className</mark> data to send additional CSS classes for styling the accordion item.",
13
13
  },
14
14
  defaultOpen: {
15
15
  control: { type: "object" },
@@ -2,7 +2,9 @@
2
2
  <div>
3
3
  <div
4
4
  :class="[
5
- accordionStyle === 'grouped' ? 'p-2 bg-gray-50 rounded-xl' : 'space-y-3',
5
+ accordionStyle === 'grouped'
6
+ ? 'p-2 bg-gray-50 rounded-xl'
7
+ : 'space-y-3',
6
8
  'max-w-full transition-all duration-100 ease-in-out',
7
9
  ]"
8
10
  >
@@ -15,20 +17,22 @@
15
17
  accordionStyle === 'grouped'
16
18
  ? 'rounded-lg hover:bg-gray-100 open:bg-gray-100 open:mb-4 open:last:mb-0'
17
19
  : 'bg-white px-8 py-4 rounded-2xl hover:ring-2 hover:ring-purple-500 open:ring-2 ring-purple-700 open:shadow-lg open:shadow-purple-100',
18
- 'box-border relative mx-auto my-0 text-base font-normal transition-colors duration-150 ease-in-out group', className
20
+ 'box-border relative mx-auto my-0 text-base font-normal transition-colors duration-150 ease-in-out group',
21
+ className, item?.className,
19
22
  ]"
20
23
  >
21
24
  <summary
22
25
  :class="[
23
26
  accordionStyle === 'grouped'
24
27
  ? 'p-4'
25
- : 'group-open:pb-4 justify-center gap-6 group-open:border-b group-open:border-gray-200',
26
- 'flex items-center font-semibold list-none cursor-pointer select-none focus:outline-none',
28
+ : 'group-open:pb-4 gap-6 group-open:border-b group-open:border-gray-200',
29
+ 'flex items-center font-semibold list-none cursor-pointer select-none focus:outline-none max-w-full justify-between',
27
30
  ]"
31
+ :aria-expanded="openAccordions[index]"
28
32
  >
29
33
  <div
30
34
  :class="[
31
- accordionStyle === 'grouped' ? 'w-11/12' : 'flex-initial w-10/12',
35
+ accordionStyle === 'grouped' ? 'w-11/12' : 'flex-initial w-[calc(75%-1.5rem)]',
32
36
  'text-gray-700 transition-all duration-200 ease-in-out faq-title group-hover:text-gray-900 group-open:text-gray-900',
33
37
  ]"
34
38
  >
@@ -52,10 +56,8 @@
52
56
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
53
57
  <path d="M9 6l6 6l-6 6"></path>
54
58
  </svg>
55
- <div v-else class="flex-1 truncate">
56
- <div class="flex items-end w-full text-start">
57
- <slot name="right-icon" :item="item"></slot>
58
- </div>
59
+ <div v-else class="flex-1 max-w-[25%] flex items-center justify-end">
60
+ <slot name="right-icon" :item="item"></slot>
59
61
  </div>
60
62
  </summary>
61
63
  <div
@@ -110,9 +112,9 @@ onMounted(() => {
110
112
  });
111
113
  });
112
114
 
115
+ const emit = defineEmits(['update:activeItem']);
113
116
  const onClick = (index: number) => {
114
- // openAccordions.value = openAccordions.value.map((isOpen, i) => i === index ? !isOpen : isOpen);
115
-
117
+ // openAccordions.value = openAccordions.value.map((isOpen, i) => i === index ? !isOpen : isOpen);
116
118
  if (props.collapse) {
117
119
  openAccordions.value = openAccordions.value.map((_, i) => i === index);
118
120
  } else {
@@ -120,6 +122,10 @@ const onClick = (index: number) => {
120
122
  i === index ? !isOpen : isOpen
121
123
  );
122
124
  }
125
+
126
+ // Emit active index accessible from parent component
127
+ const activeItems = openAccordions.value.map((isOpen, i) => (isOpen ? i : null)).filter((i) => i !== null);
128
+ emit('update:activeItem', activeItems);
123
129
  };
124
130
  </script>
125
131