@community-release/nx-ui 0.0.65 → 0.0.67

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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "configKey": "ui",
4
- "version": "0.0.65"
4
+ "version": "0.0.67"
5
5
  }
@@ -1,13 +1,20 @@
1
1
  <template>
2
2
  <section class="component-ui-accordion-item"
3
3
  :class="{'tag-active': accordionData.open.value === id, 'tag-icon': accordionData.haveIcon}"
4
+ :data-id="id"
4
5
  >
5
- <div class="header" @click="accordionData.open.value = accordionData.open.value === id ? -1 : id">
6
+ <button
7
+ :id="`acc-button-${cid}`"
8
+ class="header"
9
+ @click="accordionData.onClick(id)"
10
+ :aria-expanded="accordionData.open.value === id ? 'true' : 'false'"
11
+ :aria-controls="`acc-content-${cid}`"
12
+ >
6
13
  <i class="icon"></i>
7
14
  <div class="title">{{ title }}</div>
8
15
  <div class="btn-toggle"></div>
9
- </div>
10
- <div class="text">
16
+ </button>
17
+ <div :id="`acc-content-${cid}`" class="text" role="region" :aria-labelledby="`acc-button-${cid}`">
11
18
  <div><slot /></div>
12
19
  </div>
13
20
  </section>
@@ -15,7 +22,7 @@
15
22
 
16
23
  <script setup>
17
24
  // Import
18
- import { inject } from 'vue'
25
+ import { inject } from 'vue';
19
26
 
20
27
  // Data
21
28
  const accordionData = inject('accordionData');
@@ -24,6 +31,7 @@
24
31
  text: String,
25
32
  });
26
33
  const id = accordionData.counter.value++;
34
+ const cid = accordionData.cid + id;
27
35
  </script>
28
36
 
29
37
  <style lang="less">
@@ -68,9 +76,18 @@
68
76
  font-size: @com-text-medium;
69
77
 
70
78
  .header {
79
+ // box-sizing: border-box;
80
+ display: block;
81
+ width: 100%;
71
82
  position: relative;
72
83
  padding: @com-space-small var(--ui-accordion-btn-padding) @com-space-small calc(var(--ui-accordion-icon-size) + @com-space-default);
73
84
  margin-bottom: @com-space-mini;
85
+
86
+ font: inherit;
87
+ text-align: left;
88
+
89
+ border: none;
90
+ background: transparent;
74
91
  cursor: pointer;
75
92
  }
76
93
 
@@ -9,7 +9,8 @@
9
9
 
10
10
  <script setup>
11
11
  // Imports
12
- import { ref, computed, provide } from 'vue';
12
+ import { ref, computed, provide, defineEmits } from 'vue';
13
+ import uniq from '../helpers/uniq';
13
14
  import comProps from '#build/ui.accordion.mjs';
14
15
  import UiAccordionItem from './accordion-item.vue';
15
16
 
@@ -43,8 +44,11 @@
43
44
  },
44
45
  });
45
46
 
47
+ const emit = defineEmits(['itemClick']);
48
+
46
49
  const open = ref(props.open);
47
50
  const counter = ref(0);
51
+ const cid = uniq();
48
52
 
49
53
  const iconLightComputed = computed(() => {
50
54
  return props.icon !== '' ? `url(${props.icon})` : 'none';
@@ -54,10 +58,20 @@
54
58
  return props.iconDark !== '' ? `url(${props.iconDark})` : iconLightComputed.value;
55
59
  });
56
60
 
61
+
62
+ // Methods
63
+ function onClick(id) {
64
+ open.value = open.value === id ? -1 : id;
65
+ emit('itemClick', id);
66
+ }
67
+
68
+ // Provide
57
69
  provide('accordionData', {
70
+ cid,
58
71
  counter,
59
72
  open,
60
- haveIcon: !!props.icon
73
+ haveIcon: !!props.icon,
74
+ onClick
61
75
  });
62
76
  </script>
63
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@community-release/nx-ui",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "packageManager": "pnpm@10.14.0",
5
5
  "description": "nx-ui - Nuxt UI library",
6
6
  "repository": {