@faststore/ui 1.4.22 → 1.4.26

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,41 @@
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
+ ## 1.4.26 (2022-02-02)
7
+
8
+ **Note:** Version bump only for package @faststore/ui
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.4.25 (2022-02-02)
15
+
16
+ **Note:** Version bump only for package @faststore/ui
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.4.24 (2022-02-02)
23
+
24
+ **Note:** Version bump only for package @faststore/ui
25
+
26
+
27
+
28
+
29
+
30
+ ## 1.4.23 (2022-02-01)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * unfiltered allCollections query ([#1131](https://github.com/vtex/faststore/issues/1131)) ([4a1744a](https://github.com/vtex/faststore/commit/4a1744ad267517bfb6d3b7d7747725da0533d13f))
36
+
37
+
38
+
39
+
40
+
6
41
  ## 1.4.22 (2022-01-26)
7
42
 
8
43
  **Note:** Version bump only for package @faststore/ui
@@ -4,6 +4,7 @@ interface AccordionItemContext {
4
4
  index: number;
5
5
  panel: string;
6
6
  button: string;
7
+ prefixId: string;
7
8
  }
8
9
  declare const AccordionItemContext: React.Context<AccordionItemContext | undefined>;
9
10
  export interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
@@ -16,6 +17,11 @@ export interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
16
17
  * Index of the current accordion item within the accordion.
17
18
  */
18
19
  index?: number;
20
+ /**
21
+ * Namespace ID prefix for the current Accordion item's panel and button
22
+ * to avoid ID duplication when multiple instances are on the same page.
23
+ */
24
+ prefixId?: string;
19
25
  }
20
26
  declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
21
27
  export declare function useAccordionItem(): AccordionItemContext;
@@ -1317,13 +1317,15 @@ const AccordionItemContext = /*#__PURE__*/React.createContext(undefined);
1317
1317
  const AccordionItem = /*#__PURE__*/React.forwardRef(function AccordionItem({
1318
1318
  testId = 'store-accordion-item',
1319
1319
  children,
1320
+ prefixId = '',
1320
1321
  index = 0,
1321
1322
  ...otherProps
1322
1323
  }, ref) {
1323
1324
  const context = {
1324
1325
  index,
1325
- panel: `panel--${index}`,
1326
- button: `button--${index}`
1326
+ prefixId,
1327
+ panel: `${prefixId && `${prefixId}-`}panel--${index}`,
1328
+ button: `${prefixId && `${prefixId}-`}button--${index}`
1327
1329
  };
1328
1330
  return React__default.createElement(AccordionItemContext.Provider, {
1329
1331
  value: context
@@ -1356,7 +1358,8 @@ const AccordionButton = /*#__PURE__*/React.forwardRef(function AccordionButton({
1356
1358
  const {
1357
1359
  index,
1358
1360
  panel,
1359
- button
1361
+ button,
1362
+ prefixId
1360
1363
  } = useAccordionItem();
1361
1364
 
1362
1365
  const onKeyDown = event => {
@@ -1368,12 +1371,12 @@ const AccordionButton = /*#__PURE__*/React.forwardRef(function AccordionButton({
1368
1371
 
1369
1372
  const getNext = () => {
1370
1373
  const next = Number(index) + 1 === numberOfItems ? 0 : Number(index) + 1;
1371
- return document.getElementById(`button--${next}`);
1374
+ return document.getElementById(`${prefixId && `${prefixId}-`}button--${next}`);
1372
1375
  };
1373
1376
 
1374
1377
  const getPrevious = () => {
1375
1378
  const previous = Number(index) - 1 < 0 ? numberOfItems - 1 : Number(index) - 1;
1376
- return document.getElementById(`button--${previous}`);
1379
+ return document.getElementById(`${prefixId && `${prefixId}-`}button--${previous}`);
1377
1380
  };
1378
1381
 
1379
1382
  switch (event.key) {