@aurodesignsystem/auro-accordion 4.3.1 → 4.4.0

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/index.js CHANGED
@@ -1,7 +1,3 @@
1
1
  import { AuroAccordion } from './src/auro-accordion.js';
2
- import { AuroAccordionGroup } from './src/auro-accordion-group.js';
3
- import { AuroAccordionButton } from './src/auro-accordion-button.js';
4
2
 
5
3
  AuroAccordion.register();
6
- AuroAccordionGroup.register();
7
- AuroAccordionButton.register();
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "================================================================================"
8
8
  ],
9
9
  "name": "@aurodesignsystem/auro-accordion",
10
- "version": "4.3.1",
10
+ "version": "4.4.0",
11
11
  "description": "auro-accordion HTML custom element",
12
12
  "repository": {
13
13
  "type": "git",
@@ -10,10 +10,13 @@ import { LitElement, nothing } from "lit";
10
10
  import { html } from 'lit/static-html.js';
11
11
  import { classMap } from 'lit/directives/class-map.js';
12
12
 
13
- import AuroLibraryRuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';
13
+ import { AuroAccordionGroup } from './auro-accordion-group.js';
14
+ import { AuroAccordionButton } from './auro-accordion-button.js';
14
15
 
15
16
  import { AuroDependencyVersioning } from '@aurodesignsystem/auro-library/scripts/runtime/dependencyTagVersioning.mjs';
16
17
 
18
+ import AuroLibraryRuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';
19
+
17
20
  import { AuroIcon } from '@aurodesignsystem/auro-icon/src/auro-icon.js';
18
21
  import iconVersion from './iconVersion.js';
19
22
 
@@ -56,6 +59,16 @@ export class AuroAccordion extends LitElement {
56
59
  */
57
60
  this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon);
58
61
 
62
+ /**
63
+ * @private
64
+ */
65
+ this.buttonNameHash = this.generateRandomLetters(4); //eslint-disable-line
66
+
67
+ /**
68
+ * @private
69
+ */
70
+ this.buttonTag = versioning.generateTag('auro-accordion-button', this.buttonNameHash, AuroAccordionButton);
71
+
59
72
  /**
60
73
  * @private
61
74
  */
@@ -115,7 +128,9 @@ export class AuroAccordion extends LitElement {
115
128
  *
116
129
  */
117
130
  static register(name = "auro-accordion") {
131
+ const nameGroup = `${name}-group`;
118
132
  AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroAccordion);
133
+ AuroAccordionGroup.register(nameGroup);
119
134
  }
120
135
 
121
136
  firstUpdated() {
@@ -138,6 +153,23 @@ export class AuroAccordion extends LitElement {
138
153
  return html`${svg}`;
139
154
  }
140
155
 
156
+ /**
157
+ * Generates a random string of letters.
158
+ * @private
159
+ * @param {number} length - The number of characters to generate in the string.
160
+ * @returns {string} - The generated string.
161
+ */
162
+ generateRandomLetters(length) {
163
+ let result = '';
164
+ const characters = 'abcdefghijklmnopqrstuvwxyz';
165
+ const charactersLength = characters.length;
166
+ for (let index = 0; index < length; index += 1) {
167
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
168
+ }
169
+
170
+ return result;
171
+ }
172
+
141
173
  /**
142
174
  * Toggles the visibility of the accordion content.
143
175
  */
@@ -164,7 +196,7 @@ export class AuroAccordion extends LitElement {
164
196
 
165
197
  return html`
166
198
  <div class="componentWrapper" part="accordion">
167
- <auro-accordion-button
199
+ <${this.buttonTag}
168
200
  ?fluid="${this.emphasis}"
169
201
  class="${classMap(buttonClasses)}"
170
202
  id="accordionTrigger"
@@ -181,7 +213,7 @@ export class AuroAccordion extends LitElement {
181
213
  </${this.iconTag}>
182
214
  `}
183
215
  <slot name="trigger" part="triggerSlot"></slot>
184
- </auro-accordion-button>
216
+ </${this.buttonTag}>
185
217
  <div class="content" id="accordionContent" aria-labelledby="accordionTrigger" inert="${!this.expanded || nothing}" part="content">
186
218
  <div class="contentWrapper" part="contentWrapper">
187
219
  <slot></slot>
@@ -3,6 +3,8 @@ import { AuroAccordion } from '../src/auro-accordion';
3
3
 
4
4
  AuroAccordion.register();
5
5
 
6
+ // import './../index.js';
7
+
6
8
  describe('auro-accordion', () => {
7
9
  it('auro-accordion is accessible', async () => {
8
10
  const el = await defaultFixture();