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

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.54",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -8,9 +8,18 @@
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
+
14
23
  <Delete />
15
24
  <UTableview />
16
25
  <div class="">
@@ -1024,6 +1033,11 @@ const openModal = () => {
1024
1033
  customModal.value = false;
1025
1034
  };
1026
1035
 
1036
+ // accordion active Index
1037
+ const handleActiveItem = (activeItems:number) => {
1038
+ console.log("Currently active accordion(s):", activeItems)
1039
+ }
1040
+
1027
1041
  //TODO: Select Data
1028
1042
  const datas = ref([
1029
1043
  {
@@ -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,7 +17,8 @@
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
@@ -25,6 +28,7 @@
25
28
  : 'group-open:pb-4 justify-center gap-6 group-open:border-b group-open:border-gray-200',
26
29
  'flex items-center font-semibold list-none cursor-pointer select-none focus:outline-none',
27
30
  ]"
31
+ :aria-expanded="openAccordions[index]"
28
32
  >
29
33
  <div
30
34
  :class="[
@@ -110,9 +114,9 @@ onMounted(() => {
110
114
  });
111
115
  });
112
116
 
117
+ const emit = defineEmits(['update:activeItem']);
113
118
  const onClick = (index: number) => {
114
- // openAccordions.value = openAccordions.value.map((isOpen, i) => i === index ? !isOpen : isOpen);
115
-
119
+ // openAccordions.value = openAccordions.value.map((isOpen, i) => i === index ? !isOpen : isOpen);
116
120
  if (props.collapse) {
117
121
  openAccordions.value = openAccordions.value.map((_, i) => i === index);
118
122
  } else {
@@ -120,6 +124,10 @@ const onClick = (index: number) => {
120
124
  i === index ? !isOpen : isOpen
121
125
  );
122
126
  }
127
+
128
+ // Emit active index accessible from parent component
129
+ const activeItems = openAccordions.value.map((isOpen, i) => (isOpen ? i : null)).filter((i) => i !== null);
130
+ emit('update:activeItem', activeItems);
123
131
  };
124
132
  </script>
125
133