@repobit/dex-system-design 0.22.1 → 0.22.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.22.3](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@0.22.2...@repobit/dex-system-design@0.22.3) (2026-02-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **DEX-1013:** resolve document.createElement() issue in accordion component ([58df884](https://github.com/bitdefender/dex-core/commit/58df8842e531c3610dc57f376a57bc04292e5012))
12
+
13
+
14
+
15
+ ## [0.22.2](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@0.22.1...@repobit/dex-system-design@0.22.2) (2026-02-04)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **DEX-25763:** remove unused id property from BdAccordionBgItem constructor ([4c368e3](https://github.com/bitdefender/dex-core/commit/4c368e32284b3bf4cecfe11f9c31566e2df06a39))
21
+
22
+
23
+
6
24
  ## [0.22.1](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@0.22.0...@repobit/dex-system-design@0.22.1) (2026-01-19)
7
25
 
8
26
  **Note:** Version bump only for package @repobit/dex-system-design
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-system-design",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "description": "Design system based on Web Components.",
5
5
  "author": "Iordache Matei Cezar <miordache@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -85,5 +85,5 @@
85
85
  "volta": {
86
86
  "node": "22.14.0"
87
87
  },
88
- "gitHead": "6fcaf5133ff6a150fd7d2d3e8a261f9b88b35bc1"
88
+ "gitHead": "85911b2085c6c3aef20dae229701cb49b2dac835"
89
89
  }
@@ -29,9 +29,10 @@ class BdAccordionBg extends LitElement {
29
29
 
30
30
  class BdAccordionBgItem extends LitElement {
31
31
  static properties = {
32
- title: { type: String },
33
- open : { type: Boolean, reflect: true },
34
- noBg : { type: Boolean, attribute: 'no-bg' }
32
+ title : { type: String },
33
+ open : { type: Boolean, reflect: true },
34
+ noBg : { type: Boolean, attribute: 'no-bg' },
35
+ _accordionId: { type: String, state: true }
35
36
  };
36
37
 
37
38
  constructor() {
@@ -39,8 +40,15 @@ class BdAccordionBgItem extends LitElement {
39
40
  this.title = "";
40
41
  this.open = false;
41
42
  this.noBg = false;
42
- this.id = `accordion-${Math.random().toString(36)
43
- .substr(2, 9)}`;
43
+ this._accordionId = "";
44
+ }
45
+
46
+ firstUpdated() {
47
+ // Generează ID-ul doar după ce elementul este conectat la DOM
48
+ if (!this._accordionId) {
49
+ this._accordionId = `accordion-${Math.random().toString(36)
50
+ .substr(2, 9)}`;
51
+ }
44
52
  }
45
53
 
46
54
  static styles = [tokens, accordionCSS];
@@ -70,7 +78,7 @@ class BdAccordionBgItem extends LitElement {
70
78
  class="bd-accordion-bg-item ${this.open ? "open" : ""} ${this.noBg ? 'no-bg' : ''}"
71
79
  role="button"
72
80
  aria-expanded="${this.open}"
73
- aria-controls="${this.id}"
81
+ aria-controls="${this._accordionId}"
74
82
  tabindex="0"
75
83
  @click=${this.toggleItem}
76
84
  @keydown=${this.handleKeyDown}
@@ -80,10 +88,10 @@ class BdAccordionBgItem extends LitElement {
80
88
  <span class="bd-accordion-bg-question-text">${this.title}</span>
81
89
  </div>
82
90
  <div
83
- id="${this.id}"
91
+ id="${this._accordionId}"
84
92
  class="bd-accordion-bg-answer"
85
93
  role="region"
86
- aria-labelledby="${this.id}"
94
+ aria-labelledby="${this._accordionId}"
87
95
  >
88
96
  <slot @slotchange=${this.#onSlot}></slot>
89
97
  </div>
@@ -93,4 +101,4 @@ class BdAccordionBgItem extends LitElement {
93
101
  }
94
102
 
95
103
  customElements.define("bd-accordion-bg", BdAccordionBg);
96
- customElements.define("bd-accordion-bg-item", BdAccordionBgItem);
104
+ customElements.define("bd-accordion-bg-item", BdAccordionBgItem);
@@ -132,6 +132,68 @@ OpenAccordionItem.parameters = {
132
132
  }
133
133
  };
134
134
 
135
+ // **Adăugat exemplu pentru testarea creării dinamice**
136
+ export const DynamicCreation = () => {
137
+ // Funcție pentru crearea dinamică a unui accordion item
138
+ const createDynamicItem = () => {
139
+ const item = document.createElement('bd-accordion-bg-item');
140
+ item.title = 'Dynamically Created Item';
141
+ item.noBg = false;
142
+ item.open = false;
143
+
144
+ const paragraph = document.createElement('bd-p');
145
+ paragraph.setAttribute('kind', 'regular');
146
+ paragraph.textContent = 'This accordion item was created dynamically using document.createElement(). It should work without any errors.';
147
+
148
+ item.appendChild(paragraph);
149
+ return item;
150
+ };
151
+
152
+ const handleAddItem = () => {
153
+ const container = document.getElementById('dynamic-accordion-container');
154
+ if (container) {
155
+ const newItem = createDynamicItem();
156
+ container.appendChild(newItem);
157
+ }
158
+ };
159
+
160
+ return html`
161
+ <div style="max-width: 800px; margin: 0 auto;">
162
+ <bd-h as="h2">Dynamic Accordion Creation Test</bd-h>
163
+ <bd-p kind="regular" style="margin-bottom: 1rem;">
164
+ This example demonstrates creating accordion items dynamically using <code>document.createElement()</code>.
165
+ The issue with setting attributes in the constructor should now be resolved.
166
+ </bd-p>
167
+
168
+ <div style="margin-bottom: 2rem;">
169
+ <button
170
+ @click=${handleAddItem}
171
+ style="padding: 0.5rem 1rem; background: #3b82f6; color: white; border: none; border-radius: 4px; cursor: pointer;"
172
+ >
173
+ Add Dynamic Accordion Item
174
+ </button>
175
+ </div>
176
+
177
+ <bd-accordion-bg title="Dynamically Created Items" no-bg>
178
+ <div id="dynamic-accordion-container">
179
+ <!-- Items will be added here dynamically -->
180
+ </div>
181
+ </bd-accordion-bg>
182
+
183
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
184
+ Try clicking the button above to add accordion items dynamically. Each should have a unique ID and work correctly.
185
+ </bd-p>
186
+ </div>
187
+ `;
188
+ };
189
+ DynamicCreation.parameters = {
190
+ docs: {
191
+ description: {
192
+ story: 'Test case for dynamic creation of accordion items using document.createElement(). Demonstrates that the ID generation issue has been resolved.'
193
+ }
194
+ }
195
+ };
196
+
135
197
  export const SecurityFAQ = () => html`
136
198
  <bd-accordion-bg title="Security & Protection FAQ">
137
199
  <bd-accordion-bg-item title="How does Bitdefender protect against ransomware?">