@tamagui/collapsible 2.7.7 → 3.0.0-beta.643.1
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.cjs +75 -106
- package/dist/cjs/Collapsible.native.cjs +116 -0
- package/dist/cjs/Collapsible.native.js +79 -109
- package/dist/cjs/Collapsible.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Collapsible.mjs +55 -78
- package/dist/esm/Collapsible.mjs.map +1 -1
- package/dist/esm/Collapsible.native.js +60 -83
- package/dist/esm/Collapsible.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/jsx/Collapsible.mjs +55 -78
- package/dist/jsx/Collapsible.mjs.map +1 -1
- package/dist/jsx/Collapsible.native.cjs +116 -0
- package/dist/jsx/Collapsible.native.js +79 -109
- package/dist/jsx/Collapsible.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +21 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +11 -11
- package/src/Collapsible.tsx +29 -27
- package/types/Collapsible.d.ts +27 -8
- package/types/Collapsible.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
17
|
var index_exports = {};
|
|
19
18
|
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./Collapsible.cjs"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./Collapsible.cjs"), module.exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./Collapsible.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
var index_exports = {};
|
|
21
20
|
module.exports = __toCommonJS(index_exports);
|
|
22
21
|
__reExport(index_exports, require("./Collapsible.native.js"), module.exports);
|
|
22
|
+
|
|
23
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Collapsible\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,yBAAe,GAAG,OAAO,OAAO"}
|
package/dist/esm/Collapsible.mjs
CHANGED
|
@@ -1,101 +1,78 @@
|
|
|
1
|
+
import { createRefComponent, createStyledHOC } from "@tamagui/core";
|
|
1
2
|
import { AnimatePresence, ResetPresence } from "@tamagui/animate-presence";
|
|
2
3
|
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
3
4
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
4
5
|
import { View, createStyledContext, styled } from "@tamagui/web";
|
|
5
6
|
import * as React from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
7
9
|
const COLLAPSIBLE_NAME = "Collapsible";
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
contentId: React.useId(),
|
|
30
|
-
open,
|
|
31
|
-
onOpenToggle: React.useCallback(() => setOpen(prevOpen => !prevOpen), [setOpen]),
|
|
32
|
-
children: /* @__PURE__ */jsx(View, {
|
|
33
|
-
"data-state": getState(open),
|
|
34
|
-
"data-disabled": disabled ? "" : void 0,
|
|
35
|
-
...collapsibleProps,
|
|
36
|
-
ref: forwardedRef
|
|
37
|
-
})
|
|
38
|
-
});
|
|
10
|
+
const { Provider: CollapsibleProvider, useStyledContext: useCollapsibleContext } = createStyledContext();
|
|
11
|
+
const _Collapsible = createRefComponent((props, forwardedRef) => {
|
|
12
|
+
const { __scopeCollapsible, open: openProp, defaultOpen, disabled, onOpenChange, ...collapsibleProps } = props;
|
|
13
|
+
const [open = false, setOpen] = useControllableState({
|
|
14
|
+
prop: openProp,
|
|
15
|
+
defaultProp: defaultOpen,
|
|
16
|
+
onChange: onOpenChange
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx(CollapsibleProvider, {
|
|
19
|
+
scope: __scopeCollapsible,
|
|
20
|
+
disabled,
|
|
21
|
+
contentId: React.useId(),
|
|
22
|
+
open,
|
|
23
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
24
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
25
|
+
"data-state": getState(open),
|
|
26
|
+
"data-disabled": disabled ? "" : void 0,
|
|
27
|
+
...collapsibleProps,
|
|
28
|
+
ref: forwardedRef
|
|
29
|
+
})
|
|
30
|
+
});
|
|
39
31
|
});
|
|
40
32
|
_Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
41
33
|
const TRIGGER_NAME = "CollapsibleTrigger";
|
|
42
34
|
const CollapsibleTriggerFrame = styled(View, {
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
displayName: TRIGGER_NAME,
|
|
36
|
+
render: "button"
|
|
45
37
|
});
|
|
46
|
-
const CollapsibleTrigger = CollapsibleTriggerFrame
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ref: forwardedRef,
|
|
61
|
-
onPress: composeEventHandlers(props.onPress, context.onOpenToggle),
|
|
62
|
-
children: typeof children === "function" ? children({
|
|
63
|
-
open: context.open
|
|
64
|
-
}) : children
|
|
65
|
-
});
|
|
38
|
+
const CollapsibleTrigger = createStyledHOC(CollapsibleTriggerFrame, (props, forwardedRef) => {
|
|
39
|
+
const { __scopeCollapsible, children, ...triggerProps } = props;
|
|
40
|
+
const context = useCollapsibleContext(__scopeCollapsible);
|
|
41
|
+
return /* @__PURE__ */ jsx(CollapsibleTriggerFrame, {
|
|
42
|
+
"aria-controls": context.contentId,
|
|
43
|
+
"aria-expanded": context.open || false,
|
|
44
|
+
"data-state": getState(context.open),
|
|
45
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
46
|
+
disabled: context.disabled,
|
|
47
|
+
...triggerProps,
|
|
48
|
+
ref: forwardedRef,
|
|
49
|
+
onPress: composeEventHandlers(props.onPress, context.onOpenToggle),
|
|
50
|
+
children: typeof children === "function" ? children({ open: context.open }) : children
|
|
51
|
+
});
|
|
66
52
|
});
|
|
67
53
|
CollapsibleTrigger.displayName = TRIGGER_NAME;
|
|
68
54
|
const CONTENT_NAME = "CollapsibleContent";
|
|
69
|
-
const CollapsibleContentFrame = styled(View, {
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return /* @__PURE__ */jsx(AnimatePresence, {
|
|
82
|
-
...contentProps,
|
|
83
|
-
children: forceMount || context.open ? /* @__PURE__ */jsx(CollapsibleContentFrame, {
|
|
84
|
-
ref: forwardedRef,
|
|
85
|
-
...contentProps,
|
|
86
|
-
children: /* @__PURE__ */jsx(ResetPresence, {
|
|
87
|
-
children
|
|
88
|
-
})
|
|
89
|
-
}) : null
|
|
90
|
-
});
|
|
55
|
+
const CollapsibleContentFrame = styled(View, { displayName: CONTENT_NAME });
|
|
56
|
+
const CollapsibleContent = createStyledHOC(CollapsibleContentFrame, (props, forwardedRef) => {
|
|
57
|
+
const { forceMount, children, __scopeCollapsible, ...contentProps } = props;
|
|
58
|
+
const context = useCollapsibleContext(__scopeCollapsible);
|
|
59
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
60
|
+
...contentProps,
|
|
61
|
+
children: forceMount || context.open ? /* @__PURE__ */ jsx(CollapsibleContentFrame, {
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
...contentProps,
|
|
64
|
+
children: /* @__PURE__ */ jsx(ResetPresence, { children })
|
|
65
|
+
}) : null
|
|
66
|
+
});
|
|
91
67
|
});
|
|
92
68
|
CollapsibleContent.displayName = CONTENT_NAME;
|
|
93
69
|
function getState(open) {
|
|
94
|
-
|
|
70
|
+
return open ? "open" : "closed";
|
|
95
71
|
}
|
|
96
72
|
const Collapsible = withStaticProperties(_Collapsible, {
|
|
97
|
-
|
|
98
|
-
|
|
73
|
+
Trigger: CollapsibleTrigger,
|
|
74
|
+
Content: CollapsibleContent
|
|
99
75
|
});
|
|
76
|
+
|
|
100
77
|
export { Collapsible, CollapsibleContent, CollapsibleContentFrame, CollapsibleTrigger, CollapsibleTriggerFrame };
|
|
101
78
|
//# sourceMappingURL=Collapsible.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"Collapsible.js","names":[],"sources":["esm/Collapsible.js"],"sourcesContent":["import { createStyledHOC, createRefComponent } from \"@tamagui/core\";\nimport { AnimatePresence, ResetPresence } from \"@tamagui/animate-presence\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { View, createStyledContext, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst COLLAPSIBLE_NAME = \"Collapsible\";\nconst { Provider: CollapsibleProvider, useStyledContext: useCollapsibleContext } = createStyledContext();\nconst _Collapsible = createRefComponent(\n (props, forwardedRef) => {\n const {\n __scopeCollapsible,\n open: openProp,\n defaultOpen,\n disabled,\n onOpenChange,\n ...collapsibleProps\n } = props;\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange\n });\n return /* @__PURE__ */ jsx(\n CollapsibleProvider,\n {\n scope: __scopeCollapsible,\n disabled,\n contentId: React.useId(),\n open,\n onOpenToggle: React.useCallback(\n () => setOpen((prevOpen) => !prevOpen),\n [setOpen]\n ),\n children: /* @__PURE__ */ jsx(\n View,\n {\n \"data-state\": getState(open),\n \"data-disabled\": disabled ? \"\" : void 0,\n ...collapsibleProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\n_Collapsible.displayName = COLLAPSIBLE_NAME;\nconst TRIGGER_NAME = \"CollapsibleTrigger\";\nconst CollapsibleTriggerFrame = styled(View, {\n displayName: TRIGGER_NAME,\n render: \"button\"\n});\nconst CollapsibleTrigger = createStyledHOC(\n CollapsibleTriggerFrame,\n (props, forwardedRef) => {\n const { __scopeCollapsible, children, ...triggerProps } = props;\n const context = useCollapsibleContext(__scopeCollapsible);\n return /* @__PURE__ */ jsx(\n CollapsibleTriggerFrame,\n {\n \"aria-controls\": context.contentId,\n \"aria-expanded\": context.open || false,\n \"data-state\": getState(context.open),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n disabled: context.disabled,\n ...triggerProps,\n ref: forwardedRef,\n onPress: composeEventHandlers(props.onPress, context.onOpenToggle),\n children: typeof children === \"function\" ? children({ open: context.open }) : children\n }\n );\n }\n);\nCollapsibleTrigger.displayName = TRIGGER_NAME;\nconst CONTENT_NAME = \"CollapsibleContent\";\nconst CollapsibleContentFrame = styled(View, {\n displayName: CONTENT_NAME\n});\nconst CollapsibleContent = createStyledHOC(\n CollapsibleContentFrame,\n (props, forwardedRef) => {\n const {\n forceMount,\n children,\n // @ts-expect-error\n __scopeCollapsible,\n ...contentProps\n } = props;\n const context = useCollapsibleContext(__scopeCollapsible);\n return /* @__PURE__ */ jsx(AnimatePresence, { ...contentProps, children: forceMount || context.open ? /* @__PURE__ */ jsx(CollapsibleContentFrame, { ref: forwardedRef, ...contentProps, children: /* @__PURE__ */ jsx(ResetPresence, { children }) }) : null });\n }\n);\nCollapsibleContent.displayName = CONTENT_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nconst Collapsible = withStaticProperties(_Collapsible, {\n Trigger: CollapsibleTrigger,\n Content: CollapsibleContent\n});\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleContentFrame,\n CollapsibleTrigger,\n CollapsibleTriggerFrame\n};\n//# sourceMappingURL=Collapsible.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,mBAAmB;AACzB,MAAM,EAAE,UAAU,qBAAqB,kBAAkB,0BAA0B,oBAAoB;AACvG,MAAM,eAAe,oBAClB,OAAO,iBAAiB;CACvB,MAAM,EACJ,oBACA,MAAM,UACN,aACA,UACA,cACA,GAAG,qBACD;CACJ,MAAM,CAAC,OAAO,OAAO,WAAW,qBAAqB;EACnD,MAAM;EACN,aAAa;EACb,UAAU;CACZ,CAAC;CACD,OAAuB,oBACrB,qBACA;EACE,OAAO;EACP;EACA,WAAW,MAAM,MAAM;EACvB;EACA,cAAc,MAAM,kBACZ,SAAS,aAAa,CAAC,QAAQ,GACrC,CAAC,OAAO,CACV;EACA,UAA0B,oBACxB,MACA;GACE,cAAc,SAAS,IAAI;GAC3B,iBAAiB,WAAW,KAAK,KAAK;GACtC,GAAG;GACH,KAAK;EACP,CACF;CACF,CACF;AACF,CACF;AACA,aAAa,cAAc;AAC3B,MAAM,eAAe;AACrB,MAAM,0BAA0B,OAAO,MAAM;CAC3C,aAAa;CACb,QAAQ;AACV,CAAC;AACD,MAAM,qBAAqB,gBACzB,0BACC,OAAO,iBAAiB;CACvB,MAAM,EAAE,oBAAoB,UAAU,GAAG,iBAAiB;CAC1D,MAAM,UAAU,sBAAsB,kBAAkB;CACxD,OAAuB,oBACrB,yBACA;EACE,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ,QAAQ;EACjC,cAAc,SAAS,QAAQ,IAAI;EACnC,iBAAiB,QAAQ,WAAW,KAAK,KAAK;EAC9C,UAAU,QAAQ;EAClB,GAAG;EACH,KAAK;EACL,SAAS,qBAAqB,MAAM,SAAS,QAAQ,YAAY;EACjE,UAAU,OAAO,aAAa,aAAa,SAAS,EAAE,MAAM,QAAQ,KAAK,CAAC,IAAI;CAChF,CACF;AACF,CACF;AACA,mBAAmB,cAAc;AACjC,MAAM,eAAe;AACrB,MAAM,0BAA0B,OAAO,MAAM,EAC3C,aAAa,aACf,CAAC;AACD,MAAM,qBAAqB,gBACzB,0BACC,OAAO,iBAAiB;CACvB,MAAM,EACJ,YACA,UAEA,oBACA,GAAG,iBACD;CACJ,MAAM,UAAU,sBAAsB,kBAAkB;CACxD,OAAuB,oBAAI,iBAAiB;EAAE,GAAG;EAAc,UAAU,cAAc,QAAQ,OAAuB,oBAAI,yBAAyB;GAAE,KAAK;GAAc,GAAG;GAAc,UAA0B,oBAAI,eAAe,EAAE,SAAS,CAAC;EAAE,CAAC,IAAI;CAAK,CAAC;AACjQ,CACF;AACA,mBAAmB,cAAc;AACjC,SAAS,SAAS,MAAM;CACtB,OAAO,OAAO,SAAS;AACzB;AACA,MAAM,cAAc,qBAAqB,cAAc;CACrD,SAAS;CACT,SAAS;AACX,CAAC"}
|
|
@@ -1,105 +1,82 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createRefComponent, createStyledHOC } from "@tamagui/core";
|
|
2
3
|
import { AnimatePresence, ResetPresence } from "@tamagui/animate-presence";
|
|
3
4
|
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
4
5
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
5
6
|
import { View, createStyledContext, styled } from "@tamagui/web";
|
|
6
7
|
import * as React from "react";
|
|
8
|
+
|
|
7
9
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
8
|
-
var {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return !prevOpen;
|
|
34
|
-
});
|
|
35
|
-
}, [setOpen]),
|
|
36
|
-
children: /* @__PURE__ */_jsx(View, {
|
|
37
|
-
"data-state": getState(open),
|
|
38
|
-
"data-disabled": disabled ? "" : void 0,
|
|
39
|
-
...collapsibleProps,
|
|
40
|
-
ref: forwardedRef
|
|
41
|
-
})
|
|
42
|
-
});
|
|
10
|
+
var { Provider: CollapsibleProvider, useStyledContext: useCollapsibleContext } = createStyledContext();
|
|
11
|
+
var _Collapsible = createRefComponent(function(props, forwardedRef) {
|
|
12
|
+
var { __scopeCollapsible, open: openProp, defaultOpen, disabled, onOpenChange, ...collapsibleProps } = props;
|
|
13
|
+
var [open = false, setOpen] = useControllableState({
|
|
14
|
+
prop: openProp,
|
|
15
|
+
defaultProp: defaultOpen,
|
|
16
|
+
onChange: onOpenChange
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx(CollapsibleProvider, {
|
|
19
|
+
scope: __scopeCollapsible,
|
|
20
|
+
disabled,
|
|
21
|
+
contentId: React.useId(),
|
|
22
|
+
open,
|
|
23
|
+
onOpenToggle: React.useCallback(function() {
|
|
24
|
+
return setOpen(function(prevOpen) {
|
|
25
|
+
return !prevOpen;
|
|
26
|
+
});
|
|
27
|
+
}, [setOpen]),
|
|
28
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
29
|
+
"data-state": getState(open),
|
|
30
|
+
"data-disabled": disabled ? "" : void 0,
|
|
31
|
+
...collapsibleProps,
|
|
32
|
+
ref: forwardedRef
|
|
33
|
+
})
|
|
34
|
+
});
|
|
43
35
|
});
|
|
44
36
|
_Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
45
37
|
var TRIGGER_NAME = "CollapsibleTrigger";
|
|
46
38
|
var CollapsibleTriggerFrame = styled(View, {
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
displayName: TRIGGER_NAME,
|
|
40
|
+
render: "button"
|
|
49
41
|
});
|
|
50
|
-
var CollapsibleTrigger = CollapsibleTriggerFrame
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ref: forwardedRef,
|
|
65
|
-
onPress: composeEventHandlers(props.onPress, context.onOpenToggle),
|
|
66
|
-
children: typeof children === "function" ? children({
|
|
67
|
-
open: context.open
|
|
68
|
-
}) : children
|
|
69
|
-
});
|
|
42
|
+
var CollapsibleTrigger = createStyledHOC(CollapsibleTriggerFrame, function(props, forwardedRef) {
|
|
43
|
+
var { __scopeCollapsible, children, ...triggerProps } = props;
|
|
44
|
+
var context = useCollapsibleContext(__scopeCollapsible);
|
|
45
|
+
return /* @__PURE__ */ jsx(CollapsibleTriggerFrame, {
|
|
46
|
+
"aria-controls": context.contentId,
|
|
47
|
+
"aria-expanded": context.open || false,
|
|
48
|
+
"data-state": getState(context.open),
|
|
49
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
50
|
+
disabled: context.disabled,
|
|
51
|
+
...triggerProps,
|
|
52
|
+
ref: forwardedRef,
|
|
53
|
+
onPress: composeEventHandlers(props.onPress, context.onOpenToggle),
|
|
54
|
+
children: typeof children === "function" ? children({ open: context.open }) : children
|
|
55
|
+
});
|
|
70
56
|
});
|
|
71
57
|
CollapsibleTrigger.displayName = TRIGGER_NAME;
|
|
72
58
|
var CONTENT_NAME = "CollapsibleContent";
|
|
73
|
-
var CollapsibleContentFrame = styled(View, {
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return /* @__PURE__ */_jsx(AnimatePresence, {
|
|
86
|
-
...contentProps,
|
|
87
|
-
children: forceMount || context.open ? /* @__PURE__ */_jsx(CollapsibleContentFrame, {
|
|
88
|
-
ref: forwardedRef,
|
|
89
|
-
...contentProps,
|
|
90
|
-
children: /* @__PURE__ */_jsx(ResetPresence, {
|
|
91
|
-
children
|
|
92
|
-
})
|
|
93
|
-
}) : null
|
|
94
|
-
});
|
|
59
|
+
var CollapsibleContentFrame = styled(View, { displayName: CONTENT_NAME });
|
|
60
|
+
var CollapsibleContent = createStyledHOC(CollapsibleContentFrame, function(props, forwardedRef) {
|
|
61
|
+
var { forceMount, children, __scopeCollapsible, ...contentProps } = props;
|
|
62
|
+
var context = useCollapsibleContext(__scopeCollapsible);
|
|
63
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
64
|
+
...contentProps,
|
|
65
|
+
children: forceMount || context.open ? /* @__PURE__ */ jsx(CollapsibleContentFrame, {
|
|
66
|
+
ref: forwardedRef,
|
|
67
|
+
...contentProps,
|
|
68
|
+
children: /* @__PURE__ */ jsx(ResetPresence, { children })
|
|
69
|
+
}) : null
|
|
70
|
+
});
|
|
95
71
|
});
|
|
96
72
|
CollapsibleContent.displayName = CONTENT_NAME;
|
|
97
73
|
function getState(open) {
|
|
98
|
-
|
|
74
|
+
return open ? "open" : "closed";
|
|
99
75
|
}
|
|
100
76
|
var Collapsible = withStaticProperties(_Collapsible, {
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
Trigger: CollapsibleTrigger,
|
|
78
|
+
Content: CollapsibleContent
|
|
103
79
|
});
|
|
80
|
+
|
|
104
81
|
export { Collapsible, CollapsibleContent, CollapsibleContentFrame, CollapsibleTrigger, CollapsibleTriggerFrame };
|
|
105
82
|
//# sourceMappingURL=Collapsible.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"Collapsible.native.js","names":[],"sources":["esm/Collapsible.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createStyledHOC, createRefComponent } from \"@tamagui/core\";\nimport { AnimatePresence, ResetPresence } from \"@tamagui/animate-presence\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { View, createStyledContext, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nvar COLLAPSIBLE_NAME = \"Collapsible\";\nvar { Provider: CollapsibleProvider, useStyledContext: useCollapsibleContext } = createStyledContext();\nvar _Collapsible = createRefComponent(function(props, forwardedRef) {\n var { __scopeCollapsible, open: openProp, defaultOpen, disabled, onOpenChange, ...collapsibleProps } = props;\n var [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange\n });\n return /* @__PURE__ */ _jsx(CollapsibleProvider, {\n scope: __scopeCollapsible,\n disabled,\n contentId: React.useId(),\n open,\n onOpenToggle: React.useCallback(function() {\n return setOpen(function(prevOpen) {\n return !prevOpen;\n });\n }, [\n setOpen\n ]),\n children: /* @__PURE__ */ _jsx(View, {\n \"data-state\": getState(open),\n \"data-disabled\": disabled ? \"\" : void 0,\n ...collapsibleProps,\n ref: forwardedRef\n })\n });\n});\n_Collapsible.displayName = COLLAPSIBLE_NAME;\nvar TRIGGER_NAME = \"CollapsibleTrigger\";\nvar CollapsibleTriggerFrame = styled(View, {\n displayName: TRIGGER_NAME,\n render: \"button\"\n});\nvar CollapsibleTrigger = createStyledHOC(CollapsibleTriggerFrame, function(props, forwardedRef) {\n var { __scopeCollapsible, children, ...triggerProps } = props;\n var context = useCollapsibleContext(__scopeCollapsible);\n return /* @__PURE__ */ _jsx(CollapsibleTriggerFrame, {\n \"aria-controls\": context.contentId,\n \"aria-expanded\": context.open || false,\n \"data-state\": getState(context.open),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n disabled: context.disabled,\n ...triggerProps,\n ref: forwardedRef,\n onPress: composeEventHandlers(props.onPress, context.onOpenToggle),\n children: typeof children === \"function\" ? children({\n open: context.open\n }) : children\n });\n});\nCollapsibleTrigger.displayName = TRIGGER_NAME;\nvar CONTENT_NAME = \"CollapsibleContent\";\nvar CollapsibleContentFrame = styled(View, {\n displayName: CONTENT_NAME\n});\nvar CollapsibleContent = createStyledHOC(CollapsibleContentFrame, function(props, forwardedRef) {\n var {\n forceMount,\n children,\n // @ts-expect-error\n __scopeCollapsible,\n ...contentProps\n } = props;\n var context = useCollapsibleContext(__scopeCollapsible);\n return /* @__PURE__ */ _jsx(AnimatePresence, {\n ...contentProps,\n children: forceMount || context.open ? /* @__PURE__ */ _jsx(CollapsibleContentFrame, {\n ref: forwardedRef,\n ...contentProps,\n children: /* @__PURE__ */ _jsx(ResetPresence, {\n children\n })\n }) : null\n });\n});\nCollapsibleContent.displayName = CONTENT_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar Collapsible = withStaticProperties(_Collapsible, {\n Trigger: CollapsibleTrigger,\n Content: CollapsibleContent\n});\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleContentFrame,\n CollapsibleTrigger,\n CollapsibleTriggerFrame\n};\n//# sourceMappingURL=Collapsible.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,mBAAmB;AACvB,IAAI,EAAE,UAAU,qBAAqB,kBAAkB,0BAA0B,oBAAoB;AACrG,IAAI,eAAe,mBAAmB,SAAS,OAAO,cAAc;CAClE,IAAI,EAAE,oBAAoB,MAAM,UAAU,aAAa,UAAU,cAAc,GAAG,qBAAqB;CACvG,IAAI,CAAC,OAAO,OAAO,WAAW,qBAAqB;EACjD,MAAM;EACN,aAAa;EACb,UAAU;CACZ,CAAC;CACD,OAAuB,oBAAK,qBAAqB;EAC/C,OAAO;EACP;EACA,WAAW,MAAM,MAAM;EACvB;EACA,cAAc,MAAM,YAAY,WAAW;GACzC,OAAO,QAAQ,SAAS,UAAU;IAChC,OAAO,CAAC;GACV,CAAC;EACH,GAAG,CACD,OACF,CAAC;EACD,UAA0B,oBAAK,MAAM;GACnC,cAAc,SAAS,IAAI;GAC3B,iBAAiB,WAAW,KAAK,KAAK;GACtC,GAAG;GACH,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC;AACD,aAAa,cAAc;AAC3B,IAAI,eAAe;AACnB,IAAI,0BAA0B,OAAO,MAAM;CACzC,aAAa;CACb,QAAQ;AACV,CAAC;AACD,IAAI,qBAAqB,gBAAgB,yBAAyB,SAAS,OAAO,cAAc;CAC9F,IAAI,EAAE,oBAAoB,UAAU,GAAG,iBAAiB;CACxD,IAAI,UAAU,sBAAsB,kBAAkB;CACtD,OAAuB,oBAAK,yBAAyB;EACnD,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ,QAAQ;EACjC,cAAc,SAAS,QAAQ,IAAI;EACnC,iBAAiB,QAAQ,WAAW,KAAK,KAAK;EAC9C,UAAU,QAAQ;EAClB,GAAG;EACH,KAAK;EACL,SAAS,qBAAqB,MAAM,SAAS,QAAQ,YAAY;EACjE,UAAU,OAAO,aAAa,aAAa,SAAS,EAClD,MAAM,QAAQ,KAChB,CAAC,IAAI;CACP,CAAC;AACH,CAAC;AACD,mBAAmB,cAAc;AACjC,IAAI,eAAe;AACnB,IAAI,0BAA0B,OAAO,MAAM,EACzC,aAAa,aACf,CAAC;AACD,IAAI,qBAAqB,gBAAgB,yBAAyB,SAAS,OAAO,cAAc;CAC9F,IAAI,EACF,YACA,UAEA,oBACA,GAAG,iBACD;CACJ,IAAI,UAAU,sBAAsB,kBAAkB;CACtD,OAAuB,oBAAK,iBAAiB;EAC3C,GAAG;EACH,UAAU,cAAc,QAAQ,OAAuB,oBAAK,yBAAyB;GACnF,KAAK;GACL,GAAG;GACH,UAA0B,oBAAK,eAAe,EAC5C,SACF,CAAC;EACH,CAAC,IAAI;CACP,CAAC;AACH,CAAC;AACD,mBAAmB,cAAc;AACjC,SAAS,SAAS,MAAM;CACtB,OAAO,OAAO,SAAS;AACzB;AACA,IAAI,cAAc,qBAAqB,cAAc;CACnD,SAAS;CACT,SAAS;AACX,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Collapsible.mjs"
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./Collapsible.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Collapsible.mjs"
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from "./Collapsible.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Collapsible.native.js"
|
|
2
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export * from "./Collapsible.native.js"
|