@gluestack-ui/core 5.0.7-alpha.0 → 5.0.8-alpha.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionContent.d.ts","sourceRoot":"","sources":["../../../../src/accordion/creator/AccordionContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordionContent.d.ts","sourceRoot":"","sources":["../../../../src/accordion/creator/AccordionContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAKN,MAAM,OAAO,CAAC;AAIf,eAAO,MAAM,gBAAgB,GAAI,wBAAwB,GAAG,qFAkCxD,CAAC"}
|
|
@@ -9,14 +9,34 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import
|
|
12
|
+
import { mergeRefs } from '@gluestack-ui/utils/common';
|
|
13
|
+
import React, { forwardRef, useContext, useLayoutEffect, useRef, } from 'react';
|
|
14
|
+
import { Platform } from 'react-native';
|
|
13
15
|
import { AccordionItemContext } from './Context';
|
|
14
16
|
export const AccordionContent = (StyledAccordionContent) => forwardRef((_a, ref) => {
|
|
15
17
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
16
18
|
const { regionProps, isExpanded } = useContext(AccordionItemContext);
|
|
19
|
+
const contentRef = useRef(null);
|
|
20
|
+
const mergedRef = mergeRefs([ref, contentRef]);
|
|
21
|
+
// On web, collapsed panel content stays mounted (e.g. for height animation) but must
|
|
22
|
+
// not be tab-focusable. RN Web's View does not forward `inert`, so set it on the host.
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
if (Platform.OS !== 'web')
|
|
25
|
+
return;
|
|
26
|
+
const node = contentRef.current;
|
|
27
|
+
if (!node || typeof node.setAttribute !== 'function')
|
|
28
|
+
return;
|
|
29
|
+
if (!isExpanded) {
|
|
30
|
+
node.setAttribute('inert', '');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
node.removeAttribute('inert');
|
|
34
|
+
}
|
|
35
|
+
}, [isExpanded]);
|
|
36
|
+
const webCollapsedA11y = Platform.OS === 'web' && !isExpanded ? { 'aria-hidden': true } : {};
|
|
17
37
|
// Animation is now handled in the style file layer, not in core
|
|
18
38
|
// This allows users to customize animations by modifying the style file
|
|
19
|
-
return (<StyledAccordionContent ref={
|
|
39
|
+
return (<StyledAccordionContent ref={mergedRef} {...props} {...regionProps} {...webCollapsedA11y}>
|
|
20
40
|
{children}
|
|
21
41
|
</StyledAccordionContent>);
|
|
22
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionContent.jsx","sourceRoot":"","sources":["../../../../src/accordion/creator/AccordionContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AccordionContent.jsx","sourceRoot":"","sources":["../../../../src/accordion/creator/AccordionContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,UAAU,EACV,eAAe,EACf,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,sBAA2B,EAAE,EAAE,CAC9D,UAAU,CAAC,CAAC,EAA2B,EAAE,GAAS,EAAE,EAAE;QAA1C,EAAE,QAAQ,OAAiB,EAAZ,KAAK,cAApB,YAAsB,CAAF;IAC9B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/C,qFAAqF;IACrF,uFAAuF;IACvF,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK;YAAE,OAAO;QAClC,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU;YAAE,OAAO;QAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,MAAM,gBAAgB,GACpB,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,gEAAgE;IAChE,wEAAwE;IACxE,OAAO,CACL,CAAC,sBAAsB,CACrB,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,IAAI,KAAK,CAAC,CACV,IAAI,WAAW,CAAC,CAChB,IAAI,gBAAgB,CAAC,CAErB;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,sBAAsB,CAAC,CAC1B,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluestack-ui/core",
|
|
3
3
|
"description": "Universal UI components for React Native, Expo, and Next.js",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.8-alpha.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/gluestack/gluestack-ui.git"
|