@tamagui/accordion 1.135.2 → 1.135.4-1761748186554

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,299 +1,398 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var Accordion_exports = {};
25
35
  __export(Accordion_exports, {
26
36
  Accordion: () => Accordion
27
37
  });
28
38
  module.exports = __toCommonJS(Accordion_exports);
29
- var import_jsx_runtime = require("react/jsx-runtime"), import_collapsible = require("@tamagui/collapsible"), import_collection = require("@tamagui/collection"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_use_direction = require("@tamagui/use-direction"), React = __toESM(require("react")), ACCORDION_NAME = "Accordion", ACCORDION_KEYS = [
30
- "Home",
31
- "End",
32
- "ArrowDown",
33
- "ArrowUp",
34
- "ArrowLeft",
35
- "ArrowRight"
36
- ], [Collection, useCollection] = (0, import_collection.createCollection)(ACCORDION_NAME), ACCORDION_CONTEXT = "Accordion", AccordionComponent = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
37
- var { type, ...accordionProps } = props, singleProps = accordionProps, multipleProps = accordionProps;
38
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, {
39
- scope: props.__scopeAccordion || ACCORDION_CONTEXT,
40
- children: type === "multiple" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplMultiple, {
41
- ...multipleProps,
42
- ref: forwardedRef
43
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplSingle, {
44
- ...singleProps,
45
- ref: forwardedRef
46
- })
39
+ var import_jsx_runtime = require("react/jsx-runtime"),
40
+ import_collapsible = require("@tamagui/collapsible"),
41
+ import_collection = require("@tamagui/collection"),
42
+ import_compose_refs = require("@tamagui/compose-refs"),
43
+ import_constants = require("@tamagui/constants"),
44
+ import_core = require("@tamagui/core"),
45
+ import_helpers = require("@tamagui/helpers"),
46
+ import_stacks = require("@tamagui/stacks"),
47
+ import_text = require("@tamagui/text"),
48
+ import_use_controllable_state = require("@tamagui/use-controllable-state"),
49
+ import_use_direction = require("@tamagui/use-direction"),
50
+ React = __toESM(require("react"), 1),
51
+ ACCORDION_NAME = "Accordion",
52
+ ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"],
53
+ [Collection, useCollection] = (0, import_collection.createCollection)(ACCORDION_NAME),
54
+ ACCORDION_CONTEXT = "Accordion",
55
+ AccordionComponent = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
56
+ var {
57
+ type,
58
+ ...accordionProps
59
+ } = props,
60
+ singleProps = accordionProps,
61
+ multipleProps = accordionProps;
62
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Collection.Provider, {
63
+ scope: props.__scopeAccordion || ACCORDION_CONTEXT,
64
+ children: type === "multiple" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionImplMultiple, {
65
+ ...multipleProps,
66
+ ref: forwardedRef
67
+ }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionImplSingle, {
68
+ ...singleProps,
69
+ ref: forwardedRef
70
+ })
71
+ });
47
72
  });
48
- });
49
73
  AccordionComponent.displayName = ACCORDION_NAME;
50
74
  AccordionComponent.propTypes = {
51
75
  type(props) {
52
76
  var value = props.value || props.defaultValue;
53
- return props.type && ![
54
- "single",
55
- "multiple"
56
- ].includes(props.type) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.") : props.type === "multiple" && typeof value == "string" ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.") : props.type === "single" && Array.isArray(value) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.") : null;
77
+ return props.type && !["single", "multiple"].includes(props.type) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.") : props.type === "multiple" && typeof value == "string" ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.") : props.type === "single" && Array.isArray(value) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.") : null;
57
78
  }
58
79
  };
59
- var { Provider: AccordionValueProvider, useStyledContext: useAccordionValueContext } = (0, import_core.createStyledContext)(), { Provider: AccordionCollapsibleProvider, useStyledContext: useAccordionCollapsibleContext } = (0, import_core.createStyledContext)(), AccordionImplSingle = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
60
- var { value: valueProp, defaultValue, control, onValueChange = function() {
61
- }, collapsible = !1, ...accordionSingleProps } = props, [value, setValue] = (0, import_use_controllable_state.useControllableState)({
62
- prop: valueProp,
63
- defaultProp: defaultValue || "",
64
- onChange: onValueChange
65
- });
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionValueProvider, {
67
- scope: props.__scopeAccordion,
68
- value: value ? [
69
- value
70
- ] : [],
71
- onItemOpen: setValue,
72
- onItemClose: React.useCallback(function() {
73
- return collapsible && setValue("");
74
- }, [
75
- setValue,
76
- collapsible
77
- ]),
78
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, {
80
+ var {
81
+ Provider: AccordionValueProvider,
82
+ useStyledContext: useAccordionValueContext
83
+ } = (0, import_core.createStyledContext)(),
84
+ {
85
+ Provider: AccordionCollapsibleProvider,
86
+ useStyledContext: useAccordionCollapsibleContext
87
+ } = (0, import_core.createStyledContext)(),
88
+ AccordionImplSingle = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
89
+ var {
90
+ value: valueProp,
91
+ defaultValue,
92
+ control,
93
+ onValueChange = function () {},
94
+ collapsible = !1,
95
+ ...accordionSingleProps
96
+ } = props,
97
+ [value, setValue] = (0, import_use_controllable_state.useControllableState)({
98
+ prop: valueProp,
99
+ defaultProp: defaultValue || "",
100
+ onChange: onValueChange
101
+ });
102
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionValueProvider, {
79
103
  scope: props.__scopeAccordion,
80
- collapsible,
81
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImpl, {
82
- ...accordionSingleProps,
83
- ref: forwardedRef
104
+ value: value ? [value] : [],
105
+ onItemOpen: setValue,
106
+ onItemClose: React.useCallback(function () {
107
+ return collapsible && setValue("");
108
+ }, [setValue, collapsible]),
109
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, {
110
+ scope: props.__scopeAccordion,
111
+ collapsible,
112
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionImpl, {
113
+ ...accordionSingleProps,
114
+ ref: forwardedRef
115
+ })
84
116
  })
85
- })
86
- });
87
- }), AccordionImplMultiple = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
88
- var { value: valueProp, defaultValue, onValueChange = function() {
89
- }, ...accordionMultipleProps } = props, [value, setValue] = (0, import_use_controllable_state.useControllableState)({
90
- prop: valueProp,
91
- defaultProp: defaultValue || [],
92
- onChange: onValueChange
93
- }), handleItemOpen = React.useCallback(function(itemValue) {
94
- return setValue(function() {
95
- var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
96
- return [
97
- ...prevValue,
98
- itemValue
99
- ];
100
- });
101
- }, [
102
- setValue
103
- ]), handleItemClose = React.useCallback(function(itemValue) {
104
- return setValue(function() {
105
- var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
106
- return prevValue.filter(function(value2) {
107
- return value2 !== itemValue;
108
- });
109
117
  });
110
- }, [
111
- setValue
112
- ]);
113
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionValueProvider, {
114
- scope: props.__scopeAccordion,
115
- value: value || [],
116
- onItemOpen: handleItemOpen,
117
- onItemClose: handleItemClose,
118
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, {
118
+ }),
119
+ AccordionImplMultiple = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
120
+ var {
121
+ value: valueProp,
122
+ defaultValue,
123
+ onValueChange = function () {},
124
+ ...accordionMultipleProps
125
+ } = props,
126
+ [value, setValue] = (0, import_use_controllable_state.useControllableState)({
127
+ prop: valueProp,
128
+ defaultProp: defaultValue || [],
129
+ onChange: onValueChange
130
+ }),
131
+ handleItemOpen = React.useCallback(function (itemValue) {
132
+ return setValue(function () {
133
+ var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
134
+ return [...prevValue, itemValue];
135
+ });
136
+ }, [setValue]),
137
+ handleItemClose = React.useCallback(function (itemValue) {
138
+ return setValue(function () {
139
+ var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
140
+ return prevValue.filter(function (value2) {
141
+ return value2 !== itemValue;
142
+ });
143
+ });
144
+ }, [setValue]);
145
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionValueProvider, {
119
146
  scope: props.__scopeAccordion,
120
- collapsible: !0,
121
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImpl, {
122
- ...accordionMultipleProps,
123
- ref: forwardedRef
147
+ value: value || [],
148
+ onItemOpen: handleItemOpen,
149
+ onItemClose: handleItemClose,
150
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, {
151
+ scope: props.__scopeAccordion,
152
+ collapsible: !0,
153
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionImpl, {
154
+ ...accordionMultipleProps,
155
+ ref: forwardedRef
156
+ })
124
157
  })
125
- })
126
- });
127
- }), { Provider: AccordionImplProvider, useStyledContext: useAccordionContext } = (0, import_core.createStyledContext)(), AccordionImpl = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
128
- var { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props, accordionRef = React.useRef(null), composedRef = (0, import_compose_refs.useComposedRefs)(accordionRef, forwardedRef), getItems = useCollection(__scopeAccordion || ACCORDION_CONTEXT), direction = (0, import_use_direction.useDirection)(dir), isDirectionLTR = direction === "ltr", handleKeyDown = (0, import_helpers.composeEventHandlers)(props.onKeyDown, function(event) {
129
- var _triggerCollection_clampedIndex_ref_current;
130
- if (ACCORDION_KEYS.includes(event.key)) {
131
- var target = event.target, triggerCollection = getItems().filter(function(item) {
132
- var el = item.ref.current;
133
- return !(el != null && el.disabled);
134
- }), triggerIndex = triggerCollection.findIndex(function(item) {
135
- return item.ref.current === target;
136
- }), triggerCount = triggerCollection.length;
137
- if (triggerIndex !== -1) {
138
- event.preventDefault();
139
- var nextIndex = triggerIndex, homeIndex = 0, endIndex = triggerCount - 1, moveNext = function() {
140
- nextIndex = triggerIndex + 1, nextIndex > endIndex && (nextIndex = homeIndex);
141
- }, movePrev = function() {
142
- nextIndex = triggerIndex - 1, nextIndex < homeIndex && (nextIndex = endIndex);
143
- };
144
- switch (event.key) {
145
- case "Home":
146
- nextIndex = homeIndex;
147
- break;
148
- case "End":
149
- nextIndex = endIndex;
150
- break;
151
- case "ArrowRight":
152
- orientation === "horizontal" && (isDirectionLTR ? moveNext() : movePrev());
153
- break;
154
- case "ArrowDown":
155
- orientation === "vertical" && moveNext();
156
- break;
157
- case "ArrowLeft":
158
- orientation === "horizontal" && (isDirectionLTR ? movePrev() : moveNext());
159
- break;
160
- case "ArrowUp":
161
- orientation === "vertical" && movePrev();
162
- break;
163
- }
164
- var clampedIndex = nextIndex % triggerCount;
165
- (_triggerCollection_clampedIndex_ref_current = triggerCollection[clampedIndex].ref.current) === null || _triggerCollection_clampedIndex_ref_current === void 0 || _triggerCollection_clampedIndex_ref_current.focus();
166
- }
167
- }
168
- });
169
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplProvider, {
170
- scope: __scopeAccordion,
171
- disabled,
172
- direction: dir,
173
- orientation,
174
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, {
175
- scope: __scopeAccordion || ACCORDION_CONTEXT,
176
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
177
- "data-orientation": orientation,
178
- ref: composedRef,
179
- ...accordionProps,
180
- ...import_constants.isWeb && {
181
- onKeyDown: handleKeyDown
158
+ });
159
+ }),
160
+ {
161
+ Provider: AccordionImplProvider,
162
+ useStyledContext: useAccordionContext
163
+ } = (0, import_core.createStyledContext)(),
164
+ AccordionImpl = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
165
+ var {
166
+ __scopeAccordion,
167
+ disabled,
168
+ dir,
169
+ orientation = "vertical",
170
+ ...accordionProps
171
+ } = props,
172
+ accordionRef = React.useRef(null),
173
+ composedRef = (0, import_compose_refs.useComposedRefs)(accordionRef, forwardedRef),
174
+ getItems = useCollection(__scopeAccordion || ACCORDION_CONTEXT),
175
+ direction = (0, import_use_direction.useDirection)(dir),
176
+ isDirectionLTR = direction === "ltr",
177
+ handleKeyDown = (0, import_helpers.composeEventHandlers)(props.onKeyDown, function (event) {
178
+ var _triggerCollection_clampedIndex_ref_current;
179
+ if (ACCORDION_KEYS.includes(event.key)) {
180
+ var target = event.target,
181
+ triggerCollection = getItems().filter(function (item) {
182
+ var el = item.ref.current;
183
+ return !el?.disabled;
184
+ }),
185
+ triggerIndex = triggerCollection.findIndex(function (item) {
186
+ return item.ref.current === target;
187
+ }),
188
+ triggerCount = triggerCollection.length;
189
+ if (triggerIndex !== -1) {
190
+ event.preventDefault();
191
+ var nextIndex = triggerIndex,
192
+ homeIndex = 0,
193
+ endIndex = triggerCount - 1,
194
+ moveNext = function () {
195
+ nextIndex = triggerIndex + 1, nextIndex > endIndex && (nextIndex = homeIndex);
196
+ },
197
+ movePrev = function () {
198
+ nextIndex = triggerIndex - 1, nextIndex < homeIndex && (nextIndex = endIndex);
199
+ };
200
+ switch (event.key) {
201
+ case "Home":
202
+ nextIndex = homeIndex;
203
+ break;
204
+ case "End":
205
+ nextIndex = endIndex;
206
+ break;
207
+ case "ArrowRight":
208
+ orientation === "horizontal" && (isDirectionLTR ? moveNext() : movePrev());
209
+ break;
210
+ case "ArrowDown":
211
+ orientation === "vertical" && moveNext();
212
+ break;
213
+ case "ArrowLeft":
214
+ orientation === "horizontal" && (isDirectionLTR ? movePrev() : moveNext());
215
+ break;
216
+ case "ArrowUp":
217
+ orientation === "vertical" && movePrev();
218
+ break;
219
+ }
220
+ var clampedIndex = nextIndex % triggerCount;
221
+ (_triggerCollection_clampedIndex_ref_current = triggerCollection[clampedIndex].ref.current) === null || _triggerCollection_clampedIndex_ref_current === void 0 || _triggerCollection_clampedIndex_ref_current.focus();
222
+ }
182
223
  }
183
- })
184
- })
185
- });
186
- }), ITEM_NAME = "AccordionItem", { Provider: AccordionItemProvider, useStyledContext: useAccordionItemContext } = (0, import_core.createStyledContext)(), AccordionItem = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
187
- var { __scopeAccordion, value, ...accordionItemProps } = props, accordionContext = useAccordionContext(__scopeAccordion), valueContext = useAccordionValueContext(__scopeAccordion), triggerId = React.useId(), open = value && valueContext.value.includes(value) || !1, disabled = accordionContext.disabled || props.disabled;
188
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionItemProvider, {
189
- scope: __scopeAccordion,
190
- open,
191
- disabled,
192
- triggerId,
193
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collapsible.Collapsible, {
194
- "data-orientation": accordionContext.orientation,
195
- "data-state": open ? "open" : "closed",
196
- __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
197
- ...accordionItemProps,
198
- ref: forwardedRef,
224
+ });
225
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionImplProvider, {
226
+ scope: __scopeAccordion,
199
227
  disabled,
228
+ direction: dir,
229
+ orientation,
230
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Collection.Slot, {
231
+ scope: __scopeAccordion || ACCORDION_CONTEXT,
232
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.YStack, {
233
+ "data-orientation": orientation,
234
+ ref: composedRef,
235
+ ...accordionProps,
236
+ ...(import_constants.isWeb && {
237
+ onKeyDown: handleKeyDown
238
+ })
239
+ })
240
+ })
241
+ });
242
+ }),
243
+ ITEM_NAME = "AccordionItem",
244
+ {
245
+ Provider: AccordionItemProvider,
246
+ useStyledContext: useAccordionItemContext
247
+ } = (0, import_core.createStyledContext)(),
248
+ AccordionItem = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
249
+ var {
250
+ __scopeAccordion,
251
+ value,
252
+ ...accordionItemProps
253
+ } = props,
254
+ accordionContext = useAccordionContext(__scopeAccordion),
255
+ valueContext = useAccordionValueContext(__scopeAccordion),
256
+ triggerId = React.useId(),
257
+ open = value && valueContext.value.includes(value) || !1,
258
+ disabled = accordionContext.disabled || props.disabled;
259
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionItemProvider, {
260
+ scope: __scopeAccordion,
200
261
  open,
201
- onOpenChange: function(open2) {
202
- open2 ? valueContext.onItemOpen(value) : valueContext.onItemClose(value);
203
- }
204
- })
262
+ disabled,
263
+ triggerId,
264
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_collapsible.Collapsible, {
265
+ "data-orientation": accordionContext.orientation,
266
+ "data-state": open ? "open" : "closed",
267
+ __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
268
+ ...accordionItemProps,
269
+ ref: forwardedRef,
270
+ disabled,
271
+ open,
272
+ onOpenChange: function (open2) {
273
+ open2 ? valueContext.onItemOpen(value) : valueContext.onItemClose(value);
274
+ }
275
+ })
276
+ });
205
277
  });
206
- });
207
278
  AccordionItem.displayName = ITEM_NAME;
208
- var HEADER_NAME = "AccordionHeader", AccordionHeader = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
209
- var { __scopeAccordion, ...headerProps } = props, accordionContext = useAccordionContext(__scopeAccordion), itemContext = useAccordionItemContext(__scopeAccordion);
210
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.H1, {
211
- "data-orientation": accordionContext.orientation,
212
- "data-state": getState(itemContext.open),
213
- "data-disabled": itemContext.disabled ? "" : void 0,
214
- ...headerProps,
215
- ref: forwardedRef
279
+ var HEADER_NAME = "AccordionHeader",
280
+ AccordionHeader = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
281
+ var {
282
+ __scopeAccordion,
283
+ ...headerProps
284
+ } = props,
285
+ accordionContext = useAccordionContext(__scopeAccordion),
286
+ itemContext = useAccordionItemContext(__scopeAccordion);
287
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_text.H1, {
288
+ "data-orientation": accordionContext.orientation,
289
+ "data-state": getState(itemContext.open),
290
+ "data-disabled": itemContext.disabled ? "" : void 0,
291
+ ...headerProps,
292
+ ref: forwardedRef
293
+ });
216
294
  });
217
- });
218
295
  AccordionHeader.displayName = HEADER_NAME;
219
296
  var AccordionTriggerFrame = (0, import_core.styled)(import_collapsible.Collapsible.Trigger, {
220
- variants: {
221
- unstyled: {
222
- false: {
223
- cursor: "pointer",
224
- backgroundColor: "$background",
225
- borderColor: "$borderColor",
226
- borderWidth: 1,
227
- padding: "$true",
228
- hoverStyle: {
229
- backgroundColor: "$backgroundHover"
230
- },
231
- focusStyle: {
232
- backgroundColor: "$backgroundFocus"
233
- },
234
- pressStyle: {
235
- backgroundColor: "$backgroundPress"
297
+ variants: {
298
+ unstyled: {
299
+ false: {
300
+ cursor: "pointer",
301
+ backgroundColor: "$background",
302
+ borderColor: "$borderColor",
303
+ borderWidth: 1,
304
+ padding: "$true",
305
+ hoverStyle: {
306
+ backgroundColor: "$backgroundHover"
307
+ },
308
+ focusStyle: {
309
+ backgroundColor: "$backgroundFocus"
310
+ },
311
+ pressStyle: {
312
+ backgroundColor: "$backgroundPress"
313
+ }
236
314
  }
237
315
  }
316
+ },
317
+ defaultVariants: {
318
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
238
319
  }
239
- },
240
- defaultVariants: {
241
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
242
- }
243
- }), AccordionTrigger = AccordionTriggerFrame.styleable(function(props, forwardedRef) {
244
- var { __scopeAccordion, ...triggerProps } = props, accordionContext = useAccordionContext(__scopeAccordion), itemContext = useAccordionItemContext(__scopeAccordion), collapsibleContext = useAccordionCollapsibleContext(__scopeAccordion);
245
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, {
246
- scope: __scopeAccordion || ACCORDION_CONTEXT,
247
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTriggerFrame, {
248
- // @ts-ignore
249
- __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
250
- "aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
251
- "data-orientation": accordionContext.orientation,
252
- id: itemContext.triggerId,
253
- ...triggerProps,
254
- ref: forwardedRef
255
- })
256
- });
257
- }), AccordionContentFrame = (0, import_core.styled)(import_collapsible.Collapsible.Content, {
258
- variants: {
259
- unstyled: {
260
- false: {
261
- padding: "$true",
262
- backgroundColor: "$background"
320
+ }),
321
+ AccordionTrigger = AccordionTriggerFrame.styleable(function (props, forwardedRef) {
322
+ var {
323
+ __scopeAccordion,
324
+ ...triggerProps
325
+ } = props,
326
+ accordionContext = useAccordionContext(__scopeAccordion),
327
+ itemContext = useAccordionItemContext(__scopeAccordion),
328
+ collapsibleContext = useAccordionCollapsibleContext(__scopeAccordion);
329
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Collection.ItemSlot, {
330
+ scope: __scopeAccordion || ACCORDION_CONTEXT,
331
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionTriggerFrame, {
332
+ // @ts-ignore
333
+ __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
334
+ "aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
335
+ "data-orientation": accordionContext.orientation,
336
+ id: itemContext.triggerId,
337
+ ...triggerProps,
338
+ ref: forwardedRef
339
+ })
340
+ });
341
+ }),
342
+ AccordionContentFrame = (0, import_core.styled)(import_collapsible.Collapsible.Content, {
343
+ variants: {
344
+ unstyled: {
345
+ false: {
346
+ padding: "$true",
347
+ backgroundColor: "$background"
348
+ }
263
349
  }
350
+ },
351
+ defaultVariants: {
352
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
264
353
  }
265
- },
266
- defaultVariants: {
267
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
268
- }
269
- }), AccordionContent = AccordionContentFrame.styleable(function(props, forwardedRef) {
270
- var { __scopeAccordion, ...contentProps } = props, accordionContext = useAccordionContext(__scopeAccordion), itemContext = useAccordionItemContext(__scopeAccordion);
271
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContentFrame, {
272
- role: "region",
273
- "aria-labelledby": itemContext.triggerId,
274
- "data-orientation": accordionContext.orientation,
275
- // @ts-ignore
276
- __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
277
- ...contentProps,
278
- ref: forwardedRef
279
- });
280
- }), HeightAnimator = import_core.View.styleable(function(props, ref) {
281
- var itemContext = useAccordionItemContext(), { children, ...rest } = props, [height, setHeight] = React.useState(0);
282
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
283
- ref,
284
- height: itemContext.open ? height : 0,
285
- ...rest,
286
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
287
- position: "absolute",
288
- width: "100%",
289
- onLayout: function(param) {
290
- var { nativeEvent } = param;
291
- nativeEvent.layout.height && setHeight(nativeEvent.layout.height);
292
- },
293
- children
294
- })
354
+ }),
355
+ AccordionContent = AccordionContentFrame.styleable(function (props, forwardedRef) {
356
+ var {
357
+ __scopeAccordion,
358
+ ...contentProps
359
+ } = props,
360
+ accordionContext = useAccordionContext(__scopeAccordion),
361
+ itemContext = useAccordionItemContext(__scopeAccordion);
362
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AccordionContentFrame, {
363
+ role: "region",
364
+ "aria-labelledby": itemContext.triggerId,
365
+ "data-orientation": accordionContext.orientation,
366
+ // @ts-ignore
367
+ __scopeCollapsible: __scopeAccordion || ACCORDION_CONTEXT,
368
+ ...contentProps,
369
+ ref: forwardedRef
370
+ });
371
+ }),
372
+ HeightAnimator = import_core.View.styleable(function (props, ref) {
373
+ var itemContext = useAccordionItemContext(),
374
+ {
375
+ children,
376
+ ...rest
377
+ } = props,
378
+ [height, setHeight] = React.useState(0);
379
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.View, {
380
+ ref,
381
+ height: itemContext.open ? height : 0,
382
+ ...rest,
383
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.View, {
384
+ position: "absolute",
385
+ width: "100%",
386
+ onLayout: function (param) {
387
+ var {
388
+ nativeEvent
389
+ } = param;
390
+ nativeEvent.layout.height && setHeight(nativeEvent.layout.height);
391
+ },
392
+ children
393
+ })
394
+ });
295
395
  });
296
- });
297
396
  function getState(open) {
298
397
  return open ? "open" : "closed";
299
398
  }
@@ -304,8 +403,4 @@ var Accordion = (0, import_helpers.withStaticProperties)(AccordionComponent, {
304
403
  Item: AccordionItem,
305
404
  HeightAnimator
306
405
  });
307
- // Annotate the CommonJS export names for ESM import in node:
308
- 0 && (module.exports = {
309
- Accordion
310
- });
311
- //# sourceMappingURL=Accordion.js.map
406
+ //# sourceMappingURL=Accordion.native.js.map