@tamagui/collapsible 1.14.1 → 1.14.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/dist/cjs/Collapsible.js +28 -1
- package/dist/cjs/Collapsible.js.map +2 -2
- package/dist/cjs/index.js +18 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/Collapsible.js +4 -1
- package/dist/esm/Collapsible.js.map +2 -2
- package/dist/esm/Collapsible.mjs +4 -1
- package/dist/esm/Collapsible.mjs.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/jsx/Collapsible.js +4 -1
- package/dist/jsx/Collapsible.js.map +2 -2
- package/dist/jsx/Collapsible.mjs +4 -1
- package/dist/jsx/Collapsible.mjs.map +2 -2
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +1 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/cjs/Collapsible.js
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Collapsible_exports = {};
|
|
20
|
+
__export(Collapsible_exports, {
|
|
21
|
+
Collapsible: () => Collapsible
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Collapsible_exports);
|
|
24
|
+
const Collapsible = {};
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
Collapsible
|
|
28
|
+
});
|
|
2
29
|
//# sourceMappingURL=Collapsible.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Collapsible.tsx"],
|
|
4
4
|
"sourcesContent": ["export const Collapsible = {}\n\n// import { useComposedRefs } from '@tamagui/compose-refs'\n// import { Stack, StackProps, TamaguiElement, composeEventHandlers, useId } from '@tamagui/core'\n// import type { Scope } from '@tamagui/create-context'\n// import { createContextScope } from '@tamagui/create-context'\n// // import { Presence } from '@tamagui/react-presence'\n// import { useControllableState } from '@tamagui/use-controllable-state'\n// import * as React from 'react'\n\n// /* -------------------------------------------------------------------------------------------------\n// * Collapsible\n// * -----------------------------------------------------------------------------------------------*/\n\n// const COLLAPSIBLE_NAME = 'Collapsible'\n\n// type ScopedProps<P> = P & { __scopeCollapsible?: Scope }\n// const [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME)\n\n// type CollapsibleContextValue = {\n// contentId: string\n// disabled?: boolean\n// open: boolean\n// onOpenToggle(): void\n// }\n\n// const [CollapsibleProvider, useCollapsibleContext] =\n// createCollapsibleContext<CollapsibleContextValue>(COLLAPSIBLE_NAME)\n\n// type CollapsibleElement = TamaguiElement\n// interface CollapsibleProps extends StackProps {\n// defaultOpen?: boolean\n// open?: boolean\n// disabled?: boolean\n// onOpenChange?(open: boolean): void\n// }\n\n// const Collapsible = React.forwardRef<CollapsibleElement, CollapsibleProps>(\n// (props: ScopedProps<CollapsibleProps>, forwardedRef) => {\n// const {\n// __scopeCollapsible,\n// open: openProp,\n// defaultOpen,\n// disabled,\n// onOpenChange,\n// ...collapsibleProps\n// } = props\n\n// const [open, setOpen] = useControllableState({\n// prop: openProp,\n// defaultProp: defaultOpen || false,\n// onChange: onOpenChange,\n// })\n\n// return (\n// <CollapsibleProvider\n// scope={__scopeCollapsible}\n// disabled={disabled}\n// contentId={useId() || ''}\n// open={open}\n// onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n// >\n// <Stack\n// data-state={getState(open)}\n// data-disabled={disabled ? '' : undefined}\n// {...collapsibleProps}\n// ref={forwardedRef}\n// />\n// </CollapsibleProvider>\n// )\n// }\n// )\n\n// Collapsible.displayName = COLLAPSIBLE_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleTrigger\n// * -----------------------------------------------------------------------------------------------*/\n\n// const TRIGGER_NAME = 'CollapsibleTrigger'\n\n// type CollapsibleTriggerElement = TamaguiElement\n// interface CollapsibleTriggerProps extends StackProps {}\n\n// const CollapsibleTrigger = React.forwardRef<CollapsibleTriggerElement, CollapsibleTriggerProps>(\n// (props: ScopedProps<CollapsibleTriggerProps>, forwardedRef) => {\n// const { __scopeCollapsible, ...triggerProps } = props\n// const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible)\n// return (\n// <Stack\n// type=\"button\"\n// aria-controls={context.contentId}\n// aria-expanded={context.open || false}\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// disabled={context.disabled}\n// {...triggerProps}\n// ref={forwardedRef}\n// //\n// // onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n// />\n// )\n// }\n// )\n\n// CollapsibleTrigger.displayName = TRIGGER_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleContent\n// * -----------------------------------------------------------------------------------------------*/\n\n// const CONTENT_NAME = 'CollapsibleContent'\n\n// type CollapsibleContentElement = CollapsibleContentImplElement\n// interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {\n// /**\n// * Used to force mounting when more control is needed. Useful when\n// * controlling animation with React animation libraries.\n// */\n// forceMount?: true\n// }\n\n// const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(\n// (props: ScopedProps<CollapsibleContentProps>, forwardedRef) => {\n// const { forceMount, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible)\n// return (\n// // <Presence present={forceMount || context.open}>\n// <>\n// {({ present }) => (\n// <CollapsibleContentImpl {...contentProps} ref={forwardedRef} present={present} />\n// )}\n// </>\n// // </Presence>\n// )\n// }\n// )\n\n// CollapsibleContent.displayName = CONTENT_NAME\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// type CollapsibleContentImplElement = TamaguiElement\n// interface CollapsibleContentImplProps extends StackProps {\n// present: boolean\n// }\n\n// const CollapsibleContentImpl = React.forwardRef<\n// CollapsibleContentImplElement,\n// CollapsibleContentImplProps\n// >((props: ScopedProps<CollapsibleContentImplProps>, forwardedRef) => {\n// const { __scopeCollapsible, present, children, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible)\n// const [isPresent, setIsPresent] = React.useState(present)\n// const ref = React.useRef<CollapsibleContentImplElement>(null)\n// const composedRefs = useComposedRefs(forwardedRef, ref)\n// const heightRef = React.useRef<number | undefined>(0)\n// const height = heightRef.current\n// const widthRef = React.useRef<number | undefined>(0)\n// const width = widthRef.current\n// // when opening we want it to immediately open to retrieve dimensions\n// // when closing we delay `present` to retrieve dimensions before closing\n// const isOpen = context.open || isPresent\n// const isMountAnimationPreventedRef = React.useRef(isOpen)\n// const originalStylesRef = React.useRef<Record<string, string>>()\n\n// React.useEffect(() => {\n// const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false))\n// return () => cancelAnimationFrame(rAF)\n// }, [])\n\n// // useIsomorphicLayoutEffect(() => {\n// // const node = ref.current\n// // if (node) {\n// // originalStylesRef.current = originalStylesRef.current || {\n// // transitionDuration: node.style.transitionDuration,\n// // animationDuration: node.style.animationDuration,\n// // animationFillMode: node.style.animationFillMode,\n// // }\n// // // block any animations/transitions so the element renders at its full dimensions\n// // node.style.transitionDuration = '0s'\n// // node.style.animationDuration = '0s'\n// // node.style.animationFillMode = 'none'\n\n// // // get width and height from full dimensions\n// // const rect = node.getBoundingClientRect()\n// // heightRef.current = rect.height\n// // widthRef.current = rect.width\n\n// // // kick off any animations/transitions that were originally set up if it isn't the initial mount\n// // if (!isMountAnimationPreventedRef.current) {\n// // node.style.transitionDuration = originalStylesRef.current.transitionDuration\n// // node.style.animationDuration = originalStylesRef.current.animationDuration\n// // node.style.animationFillMode = originalStylesRef.current.animationFillMode\n// // }\n\n// // setIsPresent(present)\n// // }\n// // /**\n// // * depends on `context.open` because it will change to `false`\n// // * when a close is triggered but `present` will be `false` on\n// // * animation end (so when close finishes). This allows us to\n// // * retrieve the dimensions *before* closing.\n// // */\n// // }, [context.open, present])\n\n// return (\n// <Stack\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// id={context.contentId}\n// hidden={!isOpen}\n// {...contentProps}\n// // @ts-expect-error\n// ref={composedRefs}\n// // style={{\n// // [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined,\n// // [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined,\n// // ...props.style,\n// // }}\n// >\n// {isOpen && children}\n// </Stack>\n// )\n// })\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// function getState(open?: boolean) {\n// return open ? 'open' : 'closed'\n// }\n\n// const Root = Collapsible\n// const Trigger = CollapsibleTrigger\n// const Content = CollapsibleContent\n\n// export {\n// createCollapsibleScope,\n// //\n// Collapsible,\n// CollapsibleTrigger,\n// CollapsibleContent,\n// //\n// Root,\n// Trigger,\n// Content,\n// }\n// export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var src_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
|
18
|
+
__reExport(src_exports, require("./Collapsible"), module.exports);
|
|
2
19
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './Collapsible'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/Collapsible.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Collapsible.tsx"],
|
|
4
4
|
"sourcesContent": ["export const Collapsible = {}\n\n// import { useComposedRefs } from '@tamagui/compose-refs'\n// import { Stack, StackProps, TamaguiElement, composeEventHandlers, useId } from '@tamagui/core'\n// import type { Scope } from '@tamagui/create-context'\n// import { createContextScope } from '@tamagui/create-context'\n// // import { Presence } from '@tamagui/react-presence'\n// import { useControllableState } from '@tamagui/use-controllable-state'\n// import * as React from 'react'\n\n// /* -------------------------------------------------------------------------------------------------\n// * Collapsible\n// * -----------------------------------------------------------------------------------------------*/\n\n// const COLLAPSIBLE_NAME = 'Collapsible'\n\n// type ScopedProps<P> = P & { __scopeCollapsible?: Scope }\n// const [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME)\n\n// type CollapsibleContextValue = {\n// contentId: string\n// disabled?: boolean\n// open: boolean\n// onOpenToggle(): void\n// }\n\n// const [CollapsibleProvider, useCollapsibleContext] =\n// createCollapsibleContext<CollapsibleContextValue>(COLLAPSIBLE_NAME)\n\n// type CollapsibleElement = TamaguiElement\n// interface CollapsibleProps extends StackProps {\n// defaultOpen?: boolean\n// open?: boolean\n// disabled?: boolean\n// onOpenChange?(open: boolean): void\n// }\n\n// const Collapsible = React.forwardRef<CollapsibleElement, CollapsibleProps>(\n// (props: ScopedProps<CollapsibleProps>, forwardedRef) => {\n// const {\n// __scopeCollapsible,\n// open: openProp,\n// defaultOpen,\n// disabled,\n// onOpenChange,\n// ...collapsibleProps\n// } = props\n\n// const [open, setOpen] = useControllableState({\n// prop: openProp,\n// defaultProp: defaultOpen || false,\n// onChange: onOpenChange,\n// })\n\n// return (\n// <CollapsibleProvider\n// scope={__scopeCollapsible}\n// disabled={disabled}\n// contentId={useId() || ''}\n// open={open}\n// onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n// >\n// <Stack\n// data-state={getState(open)}\n// data-disabled={disabled ? '' : undefined}\n// {...collapsibleProps}\n// ref={forwardedRef}\n// />\n// </CollapsibleProvider>\n// )\n// }\n// )\n\n// Collapsible.displayName = COLLAPSIBLE_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleTrigger\n// * -----------------------------------------------------------------------------------------------*/\n\n// const TRIGGER_NAME = 'CollapsibleTrigger'\n\n// type CollapsibleTriggerElement = TamaguiElement\n// interface CollapsibleTriggerProps extends StackProps {}\n\n// const CollapsibleTrigger = React.forwardRef<CollapsibleTriggerElement, CollapsibleTriggerProps>(\n// (props: ScopedProps<CollapsibleTriggerProps>, forwardedRef) => {\n// const { __scopeCollapsible, ...triggerProps } = props\n// const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible)\n// return (\n// <Stack\n// type=\"button\"\n// aria-controls={context.contentId}\n// aria-expanded={context.open || false}\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// disabled={context.disabled}\n// {...triggerProps}\n// ref={forwardedRef}\n// //\n// // onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n// />\n// )\n// }\n// )\n\n// CollapsibleTrigger.displayName = TRIGGER_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleContent\n// * -----------------------------------------------------------------------------------------------*/\n\n// const CONTENT_NAME = 'CollapsibleContent'\n\n// type CollapsibleContentElement = CollapsibleContentImplElement\n// interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {\n// /**\n// * Used to force mounting when more control is needed. Useful when\n// * controlling animation with React animation libraries.\n// */\n// forceMount?: true\n// }\n\n// const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(\n// (props: ScopedProps<CollapsibleContentProps>, forwardedRef) => {\n// const { forceMount, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible)\n// return (\n// // <Presence present={forceMount || context.open}>\n// <>\n// {({ present }) => (\n// <CollapsibleContentImpl {...contentProps} ref={forwardedRef} present={present} />\n// )}\n// </>\n// // </Presence>\n// )\n// }\n// )\n\n// CollapsibleContent.displayName = CONTENT_NAME\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// type CollapsibleContentImplElement = TamaguiElement\n// interface CollapsibleContentImplProps extends StackProps {\n// present: boolean\n// }\n\n// const CollapsibleContentImpl = React.forwardRef<\n// CollapsibleContentImplElement,\n// CollapsibleContentImplProps\n// >((props: ScopedProps<CollapsibleContentImplProps>, forwardedRef) => {\n// const { __scopeCollapsible, present, children, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible)\n// const [isPresent, setIsPresent] = React.useState(present)\n// const ref = React.useRef<CollapsibleContentImplElement>(null)\n// const composedRefs = useComposedRefs(forwardedRef, ref)\n// const heightRef = React.useRef<number | undefined>(0)\n// const height = heightRef.current\n// const widthRef = React.useRef<number | undefined>(0)\n// const width = widthRef.current\n// // when opening we want it to immediately open to retrieve dimensions\n// // when closing we delay `present` to retrieve dimensions before closing\n// const isOpen = context.open || isPresent\n// const isMountAnimationPreventedRef = React.useRef(isOpen)\n// const originalStylesRef = React.useRef<Record<string, string>>()\n\n// React.useEffect(() => {\n// const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false))\n// return () => cancelAnimationFrame(rAF)\n// }, [])\n\n// // useIsomorphicLayoutEffect(() => {\n// // const node = ref.current\n// // if (node) {\n// // originalStylesRef.current = originalStylesRef.current || {\n// // transitionDuration: node.style.transitionDuration,\n// // animationDuration: node.style.animationDuration,\n// // animationFillMode: node.style.animationFillMode,\n// // }\n// // // block any animations/transitions so the element renders at its full dimensions\n// // node.style.transitionDuration = '0s'\n// // node.style.animationDuration = '0s'\n// // node.style.animationFillMode = 'none'\n\n// // // get width and height from full dimensions\n// // const rect = node.getBoundingClientRect()\n// // heightRef.current = rect.height\n// // widthRef.current = rect.width\n\n// // // kick off any animations/transitions that were originally set up if it isn't the initial mount\n// // if (!isMountAnimationPreventedRef.current) {\n// // node.style.transitionDuration = originalStylesRef.current.transitionDuration\n// // node.style.animationDuration = originalStylesRef.current.animationDuration\n// // node.style.animationFillMode = originalStylesRef.current.animationFillMode\n// // }\n\n// // setIsPresent(present)\n// // }\n// // /**\n// // * depends on `context.open` because it will change to `false`\n// // * when a close is triggered but `present` will be `false` on\n// // * animation end (so when close finishes). This allows us to\n// // * retrieve the dimensions *before* closing.\n// // */\n// // }, [context.open, present])\n\n// return (\n// <Stack\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// id={context.contentId}\n// hidden={!isOpen}\n// {...contentProps}\n// // @ts-expect-error\n// ref={composedRefs}\n// // style={{\n// // [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined,\n// // [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined,\n// // ...props.style,\n// // }}\n// >\n// {isOpen && children}\n// </Stack>\n// )\n// })\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// function getState(open?: boolean) {\n// return open ? 'open' : 'closed'\n// }\n\n// const Root = Collapsible\n// const Trigger = CollapsibleTrigger\n// const Content = CollapsibleContent\n\n// export {\n// createCollapsibleScope,\n// //\n// Collapsible,\n// CollapsibleTrigger,\n// CollapsibleContent,\n// //\n// Root,\n// Trigger,\n// Content,\n// }\n// export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,cAAc,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/Collapsible.mjs
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Collapsible.tsx"],
|
|
4
4
|
"sourcesContent": ["export const Collapsible = {}\n\n// import { useComposedRefs } from '@tamagui/compose-refs'\n// import { Stack, StackProps, TamaguiElement, composeEventHandlers, useId } from '@tamagui/core'\n// import type { Scope } from '@tamagui/create-context'\n// import { createContextScope } from '@tamagui/create-context'\n// // import { Presence } from '@tamagui/react-presence'\n// import { useControllableState } from '@tamagui/use-controllable-state'\n// import * as React from 'react'\n\n// /* -------------------------------------------------------------------------------------------------\n// * Collapsible\n// * -----------------------------------------------------------------------------------------------*/\n\n// const COLLAPSIBLE_NAME = 'Collapsible'\n\n// type ScopedProps<P> = P & { __scopeCollapsible?: Scope }\n// const [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME)\n\n// type CollapsibleContextValue = {\n// contentId: string\n// disabled?: boolean\n// open: boolean\n// onOpenToggle(): void\n// }\n\n// const [CollapsibleProvider, useCollapsibleContext] =\n// createCollapsibleContext<CollapsibleContextValue>(COLLAPSIBLE_NAME)\n\n// type CollapsibleElement = TamaguiElement\n// interface CollapsibleProps extends StackProps {\n// defaultOpen?: boolean\n// open?: boolean\n// disabled?: boolean\n// onOpenChange?(open: boolean): void\n// }\n\n// const Collapsible = React.forwardRef<CollapsibleElement, CollapsibleProps>(\n// (props: ScopedProps<CollapsibleProps>, forwardedRef) => {\n// const {\n// __scopeCollapsible,\n// open: openProp,\n// defaultOpen,\n// disabled,\n// onOpenChange,\n// ...collapsibleProps\n// } = props\n\n// const [open, setOpen] = useControllableState({\n// prop: openProp,\n// defaultProp: defaultOpen || false,\n// onChange: onOpenChange,\n// })\n\n// return (\n// <CollapsibleProvider\n// scope={__scopeCollapsible}\n// disabled={disabled}\n// contentId={useId() || ''}\n// open={open}\n// onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n// >\n// <Stack\n// data-state={getState(open)}\n// data-disabled={disabled ? '' : undefined}\n// {...collapsibleProps}\n// ref={forwardedRef}\n// />\n// </CollapsibleProvider>\n// )\n// }\n// )\n\n// Collapsible.displayName = COLLAPSIBLE_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleTrigger\n// * -----------------------------------------------------------------------------------------------*/\n\n// const TRIGGER_NAME = 'CollapsibleTrigger'\n\n// type CollapsibleTriggerElement = TamaguiElement\n// interface CollapsibleTriggerProps extends StackProps {}\n\n// const CollapsibleTrigger = React.forwardRef<CollapsibleTriggerElement, CollapsibleTriggerProps>(\n// (props: ScopedProps<CollapsibleTriggerProps>, forwardedRef) => {\n// const { __scopeCollapsible, ...triggerProps } = props\n// const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible)\n// return (\n// <Stack\n// type=\"button\"\n// aria-controls={context.contentId}\n// aria-expanded={context.open || false}\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// disabled={context.disabled}\n// {...triggerProps}\n// ref={forwardedRef}\n// //\n// // onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n// />\n// )\n// }\n// )\n\n// CollapsibleTrigger.displayName = TRIGGER_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleContent\n// * -----------------------------------------------------------------------------------------------*/\n\n// const CONTENT_NAME = 'CollapsibleContent'\n\n// type CollapsibleContentElement = CollapsibleContentImplElement\n// interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {\n// /**\n// * Used to force mounting when more control is needed. Useful when\n// * controlling animation with React animation libraries.\n// */\n// forceMount?: true\n// }\n\n// const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(\n// (props: ScopedProps<CollapsibleContentProps>, forwardedRef) => {\n// const { forceMount, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible)\n// return (\n// // <Presence present={forceMount || context.open}>\n// <>\n// {({ present }) => (\n// <CollapsibleContentImpl {...contentProps} ref={forwardedRef} present={present} />\n// )}\n// </>\n// // </Presence>\n// )\n// }\n// )\n\n// CollapsibleContent.displayName = CONTENT_NAME\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// type CollapsibleContentImplElement = TamaguiElement\n// interface CollapsibleContentImplProps extends StackProps {\n// present: boolean\n// }\n\n// const CollapsibleContentImpl = React.forwardRef<\n// CollapsibleContentImplElement,\n// CollapsibleContentImplProps\n// >((props: ScopedProps<CollapsibleContentImplProps>, forwardedRef) => {\n// const { __scopeCollapsible, present, children, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible)\n// const [isPresent, setIsPresent] = React.useState(present)\n// const ref = React.useRef<CollapsibleContentImplElement>(null)\n// const composedRefs = useComposedRefs(forwardedRef, ref)\n// const heightRef = React.useRef<number | undefined>(0)\n// const height = heightRef.current\n// const widthRef = React.useRef<number | undefined>(0)\n// const width = widthRef.current\n// // when opening we want it to immediately open to retrieve dimensions\n// // when closing we delay `present` to retrieve dimensions before closing\n// const isOpen = context.open || isPresent\n// const isMountAnimationPreventedRef = React.useRef(isOpen)\n// const originalStylesRef = React.useRef<Record<string, string>>()\n\n// React.useEffect(() => {\n// const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false))\n// return () => cancelAnimationFrame(rAF)\n// }, [])\n\n// // useIsomorphicLayoutEffect(() => {\n// // const node = ref.current\n// // if (node) {\n// // originalStylesRef.current = originalStylesRef.current || {\n// // transitionDuration: node.style.transitionDuration,\n// // animationDuration: node.style.animationDuration,\n// // animationFillMode: node.style.animationFillMode,\n// // }\n// // // block any animations/transitions so the element renders at its full dimensions\n// // node.style.transitionDuration = '0s'\n// // node.style.animationDuration = '0s'\n// // node.style.animationFillMode = 'none'\n\n// // // get width and height from full dimensions\n// // const rect = node.getBoundingClientRect()\n// // heightRef.current = rect.height\n// // widthRef.current = rect.width\n\n// // // kick off any animations/transitions that were originally set up if it isn't the initial mount\n// // if (!isMountAnimationPreventedRef.current) {\n// // node.style.transitionDuration = originalStylesRef.current.transitionDuration\n// // node.style.animationDuration = originalStylesRef.current.animationDuration\n// // node.style.animationFillMode = originalStylesRef.current.animationFillMode\n// // }\n\n// // setIsPresent(present)\n// // }\n// // /**\n// // * depends on `context.open` because it will change to `false`\n// // * when a close is triggered but `present` will be `false` on\n// // * animation end (so when close finishes). This allows us to\n// // * retrieve the dimensions *before* closing.\n// // */\n// // }, [context.open, present])\n\n// return (\n// <Stack\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// id={context.contentId}\n// hidden={!isOpen}\n// {...contentProps}\n// // @ts-expect-error\n// ref={composedRefs}\n// // style={{\n// // [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined,\n// // [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined,\n// // ...props.style,\n// // }}\n// >\n// {isOpen && children}\n// </Stack>\n// )\n// })\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// function getState(open?: boolean) {\n// return open ? 'open' : 'closed'\n// }\n\n// const Root = Collapsible\n// const Trigger = CollapsibleTrigger\n// const Content = CollapsibleContent\n\n// export {\n// createCollapsibleScope,\n// //\n// Collapsible,\n// CollapsibleTrigger,\n// CollapsibleContent,\n// //\n// Root,\n// Trigger,\n// Content,\n// }\n// export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,cAAc,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./Collapsible";
|
|
1
|
+
export * from "./Collapsible";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./Collapsible";
|
|
1
|
+
export * from "./Collapsible";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
package/dist/jsx/Collapsible.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Collapsible.tsx"],
|
|
4
4
|
"sourcesContent": ["export const Collapsible = {}\n\n// import { useComposedRefs } from '@tamagui/compose-refs'\n// import { Stack, StackProps, TamaguiElement, composeEventHandlers, useId } from '@tamagui/core'\n// import type { Scope } from '@tamagui/create-context'\n// import { createContextScope } from '@tamagui/create-context'\n// // import { Presence } from '@tamagui/react-presence'\n// import { useControllableState } from '@tamagui/use-controllable-state'\n// import * as React from 'react'\n\n// /* -------------------------------------------------------------------------------------------------\n// * Collapsible\n// * -----------------------------------------------------------------------------------------------*/\n\n// const COLLAPSIBLE_NAME = 'Collapsible'\n\n// type ScopedProps<P> = P & { __scopeCollapsible?: Scope }\n// const [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME)\n\n// type CollapsibleContextValue = {\n// contentId: string\n// disabled?: boolean\n// open: boolean\n// onOpenToggle(): void\n// }\n\n// const [CollapsibleProvider, useCollapsibleContext] =\n// createCollapsibleContext<CollapsibleContextValue>(COLLAPSIBLE_NAME)\n\n// type CollapsibleElement = TamaguiElement\n// interface CollapsibleProps extends StackProps {\n// defaultOpen?: boolean\n// open?: boolean\n// disabled?: boolean\n// onOpenChange?(open: boolean): void\n// }\n\n// const Collapsible = React.forwardRef<CollapsibleElement, CollapsibleProps>(\n// (props: ScopedProps<CollapsibleProps>, forwardedRef) => {\n// const {\n// __scopeCollapsible,\n// open: openProp,\n// defaultOpen,\n// disabled,\n// onOpenChange,\n// ...collapsibleProps\n// } = props\n\n// const [open, setOpen] = useControllableState({\n// prop: openProp,\n// defaultProp: defaultOpen || false,\n// onChange: onOpenChange,\n// })\n\n// return (\n// <CollapsibleProvider\n// scope={__scopeCollapsible}\n// disabled={disabled}\n// contentId={useId() || ''}\n// open={open}\n// onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n// >\n// <Stack\n// data-state={getState(open)}\n// data-disabled={disabled ? '' : undefined}\n// {...collapsibleProps}\n// ref={forwardedRef}\n// />\n// </CollapsibleProvider>\n// )\n// }\n// )\n\n// Collapsible.displayName = COLLAPSIBLE_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleTrigger\n// * -----------------------------------------------------------------------------------------------*/\n\n// const TRIGGER_NAME = 'CollapsibleTrigger'\n\n// type CollapsibleTriggerElement = TamaguiElement\n// interface CollapsibleTriggerProps extends StackProps {}\n\n// const CollapsibleTrigger = React.forwardRef<CollapsibleTriggerElement, CollapsibleTriggerProps>(\n// (props: ScopedProps<CollapsibleTriggerProps>, forwardedRef) => {\n// const { __scopeCollapsible, ...triggerProps } = props\n// const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible)\n// return (\n// <Stack\n// type=\"button\"\n// aria-controls={context.contentId}\n// aria-expanded={context.open || false}\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// disabled={context.disabled}\n// {...triggerProps}\n// ref={forwardedRef}\n// //\n// // onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n// />\n// )\n// }\n// )\n\n// CollapsibleTrigger.displayName = TRIGGER_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleContent\n// * -----------------------------------------------------------------------------------------------*/\n\n// const CONTENT_NAME = 'CollapsibleContent'\n\n// type CollapsibleContentElement = CollapsibleContentImplElement\n// interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {\n// /**\n// * Used to force mounting when more control is needed. Useful when\n// * controlling animation with React animation libraries.\n// */\n// forceMount?: true\n// }\n\n// const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(\n// (props: ScopedProps<CollapsibleContentProps>, forwardedRef) => {\n// const { forceMount, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible)\n// return (\n// // <Presence present={forceMount || context.open}>\n// <>\n// {({ present }) => (\n// <CollapsibleContentImpl {...contentProps} ref={forwardedRef} present={present} />\n// )}\n// </>\n// // </Presence>\n// )\n// }\n// )\n\n// CollapsibleContent.displayName = CONTENT_NAME\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// type CollapsibleContentImplElement = TamaguiElement\n// interface CollapsibleContentImplProps extends StackProps {\n// present: boolean\n// }\n\n// const CollapsibleContentImpl = React.forwardRef<\n// CollapsibleContentImplElement,\n// CollapsibleContentImplProps\n// >((props: ScopedProps<CollapsibleContentImplProps>, forwardedRef) => {\n// const { __scopeCollapsible, present, children, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible)\n// const [isPresent, setIsPresent] = React.useState(present)\n// const ref = React.useRef<CollapsibleContentImplElement>(null)\n// const composedRefs = useComposedRefs(forwardedRef, ref)\n// const heightRef = React.useRef<number | undefined>(0)\n// const height = heightRef.current\n// const widthRef = React.useRef<number | undefined>(0)\n// const width = widthRef.current\n// // when opening we want it to immediately open to retrieve dimensions\n// // when closing we delay `present` to retrieve dimensions before closing\n// const isOpen = context.open || isPresent\n// const isMountAnimationPreventedRef = React.useRef(isOpen)\n// const originalStylesRef = React.useRef<Record<string, string>>()\n\n// React.useEffect(() => {\n// const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false))\n// return () => cancelAnimationFrame(rAF)\n// }, [])\n\n// // useIsomorphicLayoutEffect(() => {\n// // const node = ref.current\n// // if (node) {\n// // originalStylesRef.current = originalStylesRef.current || {\n// // transitionDuration: node.style.transitionDuration,\n// // animationDuration: node.style.animationDuration,\n// // animationFillMode: node.style.animationFillMode,\n// // }\n// // // block any animations/transitions so the element renders at its full dimensions\n// // node.style.transitionDuration = '0s'\n// // node.style.animationDuration = '0s'\n// // node.style.animationFillMode = 'none'\n\n// // // get width and height from full dimensions\n// // const rect = node.getBoundingClientRect()\n// // heightRef.current = rect.height\n// // widthRef.current = rect.width\n\n// // // kick off any animations/transitions that were originally set up if it isn't the initial mount\n// // if (!isMountAnimationPreventedRef.current) {\n// // node.style.transitionDuration = originalStylesRef.current.transitionDuration\n// // node.style.animationDuration = originalStylesRef.current.animationDuration\n// // node.style.animationFillMode = originalStylesRef.current.animationFillMode\n// // }\n\n// // setIsPresent(present)\n// // }\n// // /**\n// // * depends on `context.open` because it will change to `false`\n// // * when a close is triggered but `present` will be `false` on\n// // * animation end (so when close finishes). This allows us to\n// // * retrieve the dimensions *before* closing.\n// // */\n// // }, [context.open, present])\n\n// return (\n// <Stack\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// id={context.contentId}\n// hidden={!isOpen}\n// {...contentProps}\n// // @ts-expect-error\n// ref={composedRefs}\n// // style={{\n// // [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined,\n// // [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined,\n// // ...props.style,\n// // }}\n// >\n// {isOpen && children}\n// </Stack>\n// )\n// })\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// function getState(open?: boolean) {\n// return open ? 'open' : 'closed'\n// }\n\n// const Root = Collapsible\n// const Trigger = CollapsibleTrigger\n// const Content = CollapsibleContent\n\n// export {\n// createCollapsibleScope,\n// //\n// Collapsible,\n// CollapsibleTrigger,\n// CollapsibleContent,\n// //\n// Root,\n// Trigger,\n// Content,\n// }\n// export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,cAAc,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Collapsible.mjs
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Collapsible.tsx"],
|
|
4
4
|
"sourcesContent": ["export const Collapsible = {}\n\n// import { useComposedRefs } from '@tamagui/compose-refs'\n// import { Stack, StackProps, TamaguiElement, composeEventHandlers, useId } from '@tamagui/core'\n// import type { Scope } from '@tamagui/create-context'\n// import { createContextScope } from '@tamagui/create-context'\n// // import { Presence } from '@tamagui/react-presence'\n// import { useControllableState } from '@tamagui/use-controllable-state'\n// import * as React from 'react'\n\n// /* -------------------------------------------------------------------------------------------------\n// * Collapsible\n// * -----------------------------------------------------------------------------------------------*/\n\n// const COLLAPSIBLE_NAME = 'Collapsible'\n\n// type ScopedProps<P> = P & { __scopeCollapsible?: Scope }\n// const [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME)\n\n// type CollapsibleContextValue = {\n// contentId: string\n// disabled?: boolean\n// open: boolean\n// onOpenToggle(): void\n// }\n\n// const [CollapsibleProvider, useCollapsibleContext] =\n// createCollapsibleContext<CollapsibleContextValue>(COLLAPSIBLE_NAME)\n\n// type CollapsibleElement = TamaguiElement\n// interface CollapsibleProps extends StackProps {\n// defaultOpen?: boolean\n// open?: boolean\n// disabled?: boolean\n// onOpenChange?(open: boolean): void\n// }\n\n// const Collapsible = React.forwardRef<CollapsibleElement, CollapsibleProps>(\n// (props: ScopedProps<CollapsibleProps>, forwardedRef) => {\n// const {\n// __scopeCollapsible,\n// open: openProp,\n// defaultOpen,\n// disabled,\n// onOpenChange,\n// ...collapsibleProps\n// } = props\n\n// const [open, setOpen] = useControllableState({\n// prop: openProp,\n// defaultProp: defaultOpen || false,\n// onChange: onOpenChange,\n// })\n\n// return (\n// <CollapsibleProvider\n// scope={__scopeCollapsible}\n// disabled={disabled}\n// contentId={useId() || ''}\n// open={open}\n// onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n// >\n// <Stack\n// data-state={getState(open)}\n// data-disabled={disabled ? '' : undefined}\n// {...collapsibleProps}\n// ref={forwardedRef}\n// />\n// </CollapsibleProvider>\n// )\n// }\n// )\n\n// Collapsible.displayName = COLLAPSIBLE_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleTrigger\n// * -----------------------------------------------------------------------------------------------*/\n\n// const TRIGGER_NAME = 'CollapsibleTrigger'\n\n// type CollapsibleTriggerElement = TamaguiElement\n// interface CollapsibleTriggerProps extends StackProps {}\n\n// const CollapsibleTrigger = React.forwardRef<CollapsibleTriggerElement, CollapsibleTriggerProps>(\n// (props: ScopedProps<CollapsibleTriggerProps>, forwardedRef) => {\n// const { __scopeCollapsible, ...triggerProps } = props\n// const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible)\n// return (\n// <Stack\n// type=\"button\"\n// aria-controls={context.contentId}\n// aria-expanded={context.open || false}\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// disabled={context.disabled}\n// {...triggerProps}\n// ref={forwardedRef}\n// //\n// // onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n// />\n// )\n// }\n// )\n\n// CollapsibleTrigger.displayName = TRIGGER_NAME\n\n// /* -------------------------------------------------------------------------------------------------\n// * CollapsibleContent\n// * -----------------------------------------------------------------------------------------------*/\n\n// const CONTENT_NAME = 'CollapsibleContent'\n\n// type CollapsibleContentElement = CollapsibleContentImplElement\n// interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {\n// /**\n// * Used to force mounting when more control is needed. Useful when\n// * controlling animation with React animation libraries.\n// */\n// forceMount?: true\n// }\n\n// const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(\n// (props: ScopedProps<CollapsibleContentProps>, forwardedRef) => {\n// const { forceMount, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible)\n// return (\n// // <Presence present={forceMount || context.open}>\n// <>\n// {({ present }) => (\n// <CollapsibleContentImpl {...contentProps} ref={forwardedRef} present={present} />\n// )}\n// </>\n// // </Presence>\n// )\n// }\n// )\n\n// CollapsibleContent.displayName = CONTENT_NAME\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// type CollapsibleContentImplElement = TamaguiElement\n// interface CollapsibleContentImplProps extends StackProps {\n// present: boolean\n// }\n\n// const CollapsibleContentImpl = React.forwardRef<\n// CollapsibleContentImplElement,\n// CollapsibleContentImplProps\n// >((props: ScopedProps<CollapsibleContentImplProps>, forwardedRef) => {\n// const { __scopeCollapsible, present, children, ...contentProps } = props\n// const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible)\n// const [isPresent, setIsPresent] = React.useState(present)\n// const ref = React.useRef<CollapsibleContentImplElement>(null)\n// const composedRefs = useComposedRefs(forwardedRef, ref)\n// const heightRef = React.useRef<number | undefined>(0)\n// const height = heightRef.current\n// const widthRef = React.useRef<number | undefined>(0)\n// const width = widthRef.current\n// // when opening we want it to immediately open to retrieve dimensions\n// // when closing we delay `present` to retrieve dimensions before closing\n// const isOpen = context.open || isPresent\n// const isMountAnimationPreventedRef = React.useRef(isOpen)\n// const originalStylesRef = React.useRef<Record<string, string>>()\n\n// React.useEffect(() => {\n// const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false))\n// return () => cancelAnimationFrame(rAF)\n// }, [])\n\n// // useIsomorphicLayoutEffect(() => {\n// // const node = ref.current\n// // if (node) {\n// // originalStylesRef.current = originalStylesRef.current || {\n// // transitionDuration: node.style.transitionDuration,\n// // animationDuration: node.style.animationDuration,\n// // animationFillMode: node.style.animationFillMode,\n// // }\n// // // block any animations/transitions so the element renders at its full dimensions\n// // node.style.transitionDuration = '0s'\n// // node.style.animationDuration = '0s'\n// // node.style.animationFillMode = 'none'\n\n// // // get width and height from full dimensions\n// // const rect = node.getBoundingClientRect()\n// // heightRef.current = rect.height\n// // widthRef.current = rect.width\n\n// // // kick off any animations/transitions that were originally set up if it isn't the initial mount\n// // if (!isMountAnimationPreventedRef.current) {\n// // node.style.transitionDuration = originalStylesRef.current.transitionDuration\n// // node.style.animationDuration = originalStylesRef.current.animationDuration\n// // node.style.animationFillMode = originalStylesRef.current.animationFillMode\n// // }\n\n// // setIsPresent(present)\n// // }\n// // /**\n// // * depends on `context.open` because it will change to `false`\n// // * when a close is triggered but `present` will be `false` on\n// // * animation end (so when close finishes). This allows us to\n// // * retrieve the dimensions *before* closing.\n// // */\n// // }, [context.open, present])\n\n// return (\n// <Stack\n// data-state={getState(context.open)}\n// data-disabled={context.disabled ? '' : undefined}\n// id={context.contentId}\n// hidden={!isOpen}\n// {...contentProps}\n// // @ts-expect-error\n// ref={composedRefs}\n// // style={{\n// // [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined,\n// // [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined,\n// // ...props.style,\n// // }}\n// >\n// {isOpen && children}\n// </Stack>\n// )\n// })\n\n// /* -----------------------------------------------------------------------------------------------*/\n\n// function getState(open?: boolean) {\n// return open ? 'open' : 'closed'\n// }\n\n// const Root = Collapsible\n// const Trigger = CollapsibleTrigger\n// const Content = CollapsibleContent\n\n// export {\n// createCollapsibleScope,\n// //\n// Collapsible,\n// CollapsibleTrigger,\n// CollapsibleContent,\n// //\n// Root,\n// Trigger,\n// Content,\n// }\n// export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,cAAc,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./Collapsible";
|
|
1
|
+
export * from "./Collapsible";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/jsx/index.js.map
CHANGED
package/dist/jsx/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./Collapsible";
|
|
1
|
+
export * from "./Collapsible";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/jsx/index.mjs.map
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/collapsible",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"watch": "tamagui-build --watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tamagui/compose-refs": "1.14.
|
|
21
|
-
"@tamagui/core": "1.14.
|
|
22
|
-
"@tamagui/create-context": "1.14.
|
|
23
|
-
"@tamagui/polyfill-dev": "1.14.
|
|
24
|
-
"@tamagui/stacks": "1.14.
|
|
25
|
-
"@tamagui/use-controllable-state": "1.14.
|
|
20
|
+
"@tamagui/compose-refs": "1.14.3",
|
|
21
|
+
"@tamagui/core": "1.14.3",
|
|
22
|
+
"@tamagui/create-context": "1.14.3",
|
|
23
|
+
"@tamagui/polyfill-dev": "1.14.3",
|
|
24
|
+
"@tamagui/stacks": "1.14.3",
|
|
25
|
+
"@tamagui/use-controllable-state": "1.14.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "*"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tamagui/build": "1.14.
|
|
31
|
+
"@tamagui/build": "1.14.3",
|
|
32
32
|
"react": "^18.2.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|