edvoyui-component-library-test-flight 0.0.216 → 0.0.218

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.
@@ -8,6 +8,7 @@ declare function __VLS_template(): {
8
8
  'right-icon'?(_: {
9
9
  item: any;
10
10
  open: boolean;
11
+ toggle: () => void;
11
12
  }): any;
12
13
  content?(_: {
13
14
  item: any;
@@ -35,10 +36,18 @@ declare const __VLS_component: import('../../../node_modules/vue').DefineCompone
35
36
  type: PropType<"grouped" | "separated">;
36
37
  default: string;
37
38
  };
39
+ rightIconActions: {
40
+ type: BooleanConstructor;
41
+ default: boolean;
42
+ };
38
43
  className: {
39
44
  type: StringConstructor;
40
45
  required: false;
41
46
  };
47
+ animateContent: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
42
51
  }>, {}, {}, {}, {}, import('../../../node_modules/vue').ComponentOptionsMixin, import('../../../node_modules/vue').ComponentOptionsMixin, {
43
52
  "update:activeItem": (...args: any[]) => void;
44
53
  }, string, import('../../../node_modules/vue').PublicProps, Readonly<import('../../../node_modules/vue').ExtractPropTypes<{
@@ -59,10 +68,18 @@ declare const __VLS_component: import('../../../node_modules/vue').DefineCompone
59
68
  type: PropType<"grouped" | "separated">;
60
69
  default: string;
61
70
  };
71
+ rightIconActions: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
62
75
  className: {
63
76
  type: StringConstructor;
64
77
  required: false;
65
78
  };
79
+ animateContent: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
66
83
  }>> & Readonly<{
67
84
  "onUpdate:activeItem"?: ((...args: any[]) => any) | undefined;
68
85
  }>, {
@@ -70,6 +87,8 @@ declare const __VLS_component: import('../../../node_modules/vue').DefineCompone
70
87
  defaultOpen: number[];
71
88
  collapse: boolean;
72
89
  accordionStyle: "grouped" | "separated";
90
+ rightIconActions: boolean;
91
+ animateContent: boolean;
73
92
  }, {}, {}, {}, string, import('../../../node_modules/vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
74
93
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
75
94
  export default _default;
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <div>
2
+ <div :class="['accordion-root', { 'accordion-animated': animateContent }]">
3
3
  <div
4
4
  :class="[
5
5
  accordionStyle === 'grouped'
6
- ? 'p-2 bg-gray-50 rounded-xl'
6
+ ? 'space-y-1'
7
7
  : 'space-y-3',
8
8
  'max-w-full transition-all duration-100 ease-in-out',
9
9
  ]"
@@ -12,59 +12,60 @@
12
12
  v-for="(item, index) in datas"
13
13
  :key="`accordion-${index}`"
14
14
  :open="openAccordions[index]"
15
- @click.prevent="onClick(index)"
16
15
  :class="[
17
- 'box-border relative mx-auto my-0 text-base font-normal transition-colors duration-150 ease-in-out group/accordion',
16
+ 'box-border relative mx-auto my-0 text-base font-normal transition-colors duration-150 ease-in-out group/accordion bg-white',
18
17
  accordionStyle === 'grouped'
19
- ? 'rounded-lg hover:bg-gray-100 open:bg-gray-100 open:mb-4 open:last:mb-0'
20
- : '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
+ ? 'rounded-lg open:mb-4 open:last:mb-0'
19
+ : 'rounded-2xl ring-1 ring-gray-50 hover:bg-gray-50 hover:open:bg-white open:ring-gray-100 open:shadow-md open:shadow-purple-100',
21
20
  className, item?.className,
22
21
  ]"
23
22
  >
24
23
  <summary
24
+ @click.prevent="onClick(index)"
25
25
  :class="[
26
26
  'flex items-center font-semibold list-none cursor-pointer select-none focus:outline-none max-w-full justify-between',
27
27
  accordionStyle === 'grouped'
28
- ? 'p-4'
29
- : 'group-open/accordion:pb-4 gap-6 group-open/accordion:border-b group-open/accordion:border-gray-200',
28
+ ? 'px-4 min-h-12 group-open/accordion:py-2'
29
+ : 'px-6 min-h-16 group-open/accordion:py-4 gap-6 group-open/accordion:border-b group-open/accordion:border-gray-200',
30
30
  ]"
31
31
  :aria-expanded="openAccordions[index]"
32
32
  >
33
33
  <div
34
34
  :class="[
35
- 'text-gray-700 transition-all duration-200 ease-in-out faq-title group-hover/accordion:text-gray-900 group-open/accordion:text-gray-900',
36
- accordionStyle === 'grouped' ? 'w-11/12' : 'flex-initial w-[calc(75%-1.5rem)]',
35
+ 'text-gray-600 transition-all duration-200 ease-in-out faq-title group-hover/accordion:text-gray-900 group-open/accordion:text-gray-900',
36
+ rightIconActions
37
+ ? 'flex-1 min-w-0'
38
+ : accordionStyle === 'grouped' ? 'w-11/12' : 'flex-initial w-[calc(75%-1.5rem)]',
37
39
  ]"
38
40
  >
39
41
  <slot name="title" :item="item">
40
42
  {{ item.title }}
41
43
  </slot>
42
44
  </div>
43
- <svg
44
- v-if="accordionStyle === 'grouped'"
45
- xmlns="http://www.w3.org/2000/svg"
46
- class="absolute text-gray-700 transition-all duration-150 ease-out pointer-events-none expand-icon group-open/accordion:text-gray-900 right-4 group-open/accordion:rotate-90"
47
- width="24"
48
- height="24"
49
- viewBox="0 0 24 24"
50
- stroke-width="2"
51
- stroke="currentColor"
52
- fill="none"
53
- stroke-linecap="round"
54
- stroke-linejoin="round"
45
+
46
+ <div
47
+ :class="[
48
+ 'flex items-center gap-3',
49
+ rightIconActions
50
+ ? 'justify-end shrink-0'
51
+ : accordionStyle === 'grouped'
52
+ ? 'absolute right-4'
53
+ : 'justify-end min-w-0 shrink-0',
54
+ ]"
55
+ @click="onRightSideClick"
55
56
  >
56
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
57
- <path d="M9 6l6 6l-6 6"></path>
58
- </svg>
59
- <div v-else class="flex-1 max-w-[25%] flex items-center justify-end gap-3" @click.stop>
60
- <slot name="right-icon" :item="item" :open="openAccordions[index]"></slot>
57
+ <slot name="right-icon" :item="item" :open="openAccordions[index]" :toggle="() => onClick(index)">
58
+ <svg
59
+ class="text-gray-500 transition-all duration-150 ease-out pointer-events-none expand-icon group-open/accordion:text-gray-900 group-open/accordion:rotate-90" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10 8.13867C11.4619 9.20073 12.7713 10.4457 13.8942 11.8408C14.0353 12.016 14.0353 12.2613 13.8942 12.4365C12.7713 13.8316 11.4619 15.0766 10 16.1387" stroke="currentColor" stroke-opacity="0.8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
60
+ </svg>
61
+ </slot>
61
62
  </div>
62
63
  </summary>
63
64
  <div
64
- v-if="openAccordions[index]"
65
+ v-if="animateContent || openAccordions[index]"
65
66
  :class="[
66
- 'font-light text-gray-600 transition-all duration-300 ease-in-out h-auto faq-content',
67
- accordionStyle === 'grouped' ? 'p-4 pt-1' : 'pt-3',
67
+ 'font-light text-gray-600 faq-content',
68
+ accordionStyle === 'grouped' ? 'px-4 pt-1 pb-3' : 'py-3 px-6',
68
69
  ]"
69
70
  >
70
71
  <slot name="content" :item="item">
@@ -97,10 +98,25 @@ const props = defineProps({
97
98
  type: String as PropType<"grouped" | "separated">,
98
99
  default: "grouped",
99
100
  },
101
+ // When true, the `right-icon` slot becomes an interactive "actions" area:
102
+ // clicks inside it no longer toggle the accordion (so buttons/menus work
103
+ // on their own), and it renders in normal flow instead of as an absolute
104
+ // overlay — in both `grouped` and `separated` styles.
105
+ rightIconActions: {
106
+ type: Boolean,
107
+ default: false,
108
+ },
100
109
  className: {
101
110
  type: String,
102
111
  required: false,
103
112
  },
113
+ // When true, content stays mounted and the open/close height animates
114
+ // smoothly. When false (default), content is lazily mounted via v-if and
115
+ // opens/closes instantly — preserves the original behavior.
116
+ animateContent: {
117
+ type: Boolean,
118
+ default: true,
119
+ },
104
120
  });
105
121
 
106
122
  const openAccordions = ref<boolean[]>(Array(props.datas.length).fill(false));
@@ -127,6 +143,18 @@ onMounted(() => {
127
143
  });
128
144
  });
129
145
 
146
+ // In actions mode, stop clicks on the right-icon side from toggling the
147
+ // accordion: `.stop` skips the summary's managed onClick and `.prevent`
148
+ // blocks the native <details> toggle. Slot click handlers still run (they
149
+ // fire earlier, during bubbling). When the prop is off this is a no-op, so
150
+ // the default chevron keeps toggling on click.
151
+ const onRightSideClick = (e: MouseEvent) => {
152
+ if (props.rightIconActions) {
153
+ e.stopPropagation();
154
+ e.preventDefault();
155
+ }
156
+ };
157
+
130
158
  const emit = defineEmits(['update:activeItem']);
131
159
  const onClick = (index: number) => {
132
160
  // openAccordions.value = openAccordions.value.map((isOpen, i) => i === index ? !isOpen : isOpen);
@@ -150,4 +178,22 @@ summary {
150
178
  display: none;
151
179
  }
152
180
  }
181
+
182
+ /* Opt-in (:animateContent) smooth expand/collapse of the native <details>
183
+ content instead of snapping. `interpolate-size` enables animating
184
+ to/from `height: auto`. Without this class the accordion keeps its
185
+ original instant open/close behaviour. */
186
+ .accordion-animated {
187
+ interpolate-size: allow-keywords;
188
+
189
+ details::details-content {
190
+ height: 0;
191
+ overflow: clip;
192
+ transition: height 0.3s ease, content-visibility 0.3s ease allow-discrete;
193
+ }
194
+
195
+ details[open]::details-content {
196
+ height: auto;
197
+ }
198
+ }
153
199
  </style>
@@ -882,6 +882,20 @@ const open = () => {
882
882
  }
883
883
  }
884
884
 
885
+ /* Disabled: the control is non-interactive, so suppress the hover
886
+ affordances (red color change, "Clear Selected" tooltip) and block
887
+ clearing/deselecting. pointer-events:none stops :hover from firing,
888
+ so the underlying toggle's not-allowed cursor is what shows. */
889
+ .vs--disabled {
890
+ .vs__clear,
891
+ .vs__deselect,
892
+ .vs__open-indicator,
893
+ .vs__selected {
894
+ pointer-events: none;
895
+ user-select: none;
896
+ }
897
+ }
898
+
885
899
  .vs__selected-options {
886
900
  @apply group-focus:bg-transparent focus-within:bg-transparent border-transparent;
887
901
  background-color: v-bind(selectBG);