@tamagui/tabs 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/StyledContext.cjs +16 -20
- package/dist/cjs/StyledContext.native.cjs +31 -0
- package/dist/cjs/StyledContext.native.js +17 -20
- package/dist/cjs/StyledContext.native.js.map +1 -1
- package/dist/cjs/Tabs.cjs +227 -68
- package/dist/cjs/Tabs.native.cjs +250 -0
- package/dist/cjs/Tabs.native.js +233 -67
- package/dist/cjs/Tabs.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -27
- package/dist/cjs/index.native.cjs +22 -0
- package/dist/cjs/index.native.js +11 -27
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/StyledContext.mjs +3 -4
- package/dist/esm/StyledContext.mjs.map +1 -1
- package/dist/esm/StyledContext.native.js +3 -4
- package/dist/esm/StyledContext.native.js.map +1 -1
- package/dist/esm/Tabs.mjs +206 -55
- package/dist/esm/Tabs.mjs.map +1 -1
- package/dist/esm/Tabs.native.js +212 -55
- package/dist/esm/Tabs.native.js.map +1 -1
- package/dist/esm/index.js +3 -11
- package/dist/esm/index.mjs +3 -11
- package/dist/esm/index.native.js +3 -11
- package/dist/jsx/StyledContext.mjs +3 -4
- package/dist/jsx/StyledContext.mjs.map +1 -1
- package/dist/jsx/StyledContext.native.cjs +31 -0
- package/dist/jsx/StyledContext.native.js +17 -20
- package/dist/jsx/StyledContext.native.js.map +1 -1
- package/dist/jsx/Tabs.mjs +206 -55
- package/dist/jsx/Tabs.mjs.map +1 -1
- package/dist/jsx/Tabs.native.cjs +250 -0
- package/dist/jsx/Tabs.native.js +233 -67
- package/dist/jsx/Tabs.native.js.map +1 -1
- package/dist/jsx/index.js +3 -11
- package/dist/jsx/index.mjs +3 -11
- package/dist/jsx/index.native.cjs +22 -0
- package/dist/jsx/index.native.js +11 -27
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +11 -17
- package/src/StyledContext.tsx +3 -3
- package/src/Tabs.tsx +368 -55
- package/src/index.ts +1 -9
- package/types/StyledContext.d.ts +3 -3
- package/types/StyledContext.d.ts.map +1 -1
- package/types/Tabs.d.ts +398 -35
- package/types/Tabs.d.ts.map +1 -1
- package/types/index.d.ts +1 -537
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/createTabs.cjs +0 -293
- package/dist/cjs/createTabs.native.js +0 -308
- package/dist/cjs/createTabs.native.js.map +0 -1
- package/dist/esm/createTabs.mjs +0 -257
- package/dist/esm/createTabs.mjs.map +0 -1
- package/dist/esm/createTabs.native.js +0 -269
- package/dist/esm/createTabs.native.js.map +0 -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/createTabs.mjs +0 -257
- package/dist/jsx/createTabs.mjs.map +0 -1
- package/dist/jsx/createTabs.native.js +0 -308
- package/dist/jsx/createTabs.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/src/createTabs.tsx +0 -438
- package/types/createTabs.d.ts +0 -527
- package/types/createTabs.d.ts.map +0 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var Tabs_exports = {};
|
|
31
|
+
__export(Tabs_exports, {
|
|
32
|
+
Tabs: () => Tabs2,
|
|
33
|
+
TabsContent: () => TabsContent,
|
|
34
|
+
TabsContentFrame: () => TabsContentFrame,
|
|
35
|
+
TabsFrame: () => TabsFrame,
|
|
36
|
+
TabsList: () => TabsList,
|
|
37
|
+
TabsListFrame: () => TabsListFrame,
|
|
38
|
+
TabsTab: () => TabsTab,
|
|
39
|
+
TabsTabFrame: () => TabsTabFrame
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(Tabs_exports);
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var import_compose_refs = require("@tamagui/compose-refs");
|
|
44
|
+
var import_constants = require("@tamagui/constants");
|
|
45
|
+
var import_core = require("@tamagui/core");
|
|
46
|
+
var import_helpers = require("@tamagui/helpers");
|
|
47
|
+
var import_roving_focus = require("@tamagui/roving-focus");
|
|
48
|
+
var import_size = require("@tamagui/size");
|
|
49
|
+
var import_tabs_headless = require("@tamagui/tabs-headless");
|
|
50
|
+
var import_web = require("@tamagui/web");
|
|
51
|
+
var React = __toESM(require("react"), 1);
|
|
52
|
+
var import_StyledContext = require("./StyledContext.native.js");
|
|
53
|
+
var TABS_CONTEXT = "TabsContext";
|
|
54
|
+
var TabsFrame = (0, import_core.styled)(import_core.View, {
|
|
55
|
+
displayName: "Tabs",
|
|
56
|
+
context: import_size.SizeContext
|
|
57
|
+
});
|
|
58
|
+
var TabsListFrame = (0, import_core.styled)(import_core.View, {
|
|
59
|
+
displayName: "TabsList",
|
|
60
|
+
context: import_size.SizeContext,
|
|
61
|
+
role: "tablist"
|
|
62
|
+
});
|
|
63
|
+
var TabsTabFrame = (0, import_core.styled)(import_core.View, {
|
|
64
|
+
displayName: "TabsTrigger",
|
|
65
|
+
context: import_size.SizeContext,
|
|
66
|
+
role: "tab",
|
|
67
|
+
variants: { disabled: { true: { pointerEvents: "none" } } }
|
|
68
|
+
});
|
|
69
|
+
var TabsContentFrame = (0, import_core.styled)(import_core.View, {
|
|
70
|
+
displayName: "TabsContent",
|
|
71
|
+
context: import_size.SizeContext
|
|
72
|
+
});
|
|
73
|
+
var TabsListDisabledContext = /* @__PURE__ */ React.createContext(false);
|
|
74
|
+
var TabsList = (0, import_core.createStyledHOC)(TabsListFrame, function TabsList2(props, forwardedRef) {
|
|
75
|
+
var { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;
|
|
76
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
77
|
+
var { listProps: headlessListProps } = (0, import_tabs_headless.useTabsList)({
|
|
78
|
+
orientation: context.orientation,
|
|
79
|
+
disabled
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListDisabledContext.Provider, {
|
|
82
|
+
value: disabled,
|
|
83
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
84
|
+
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
85
|
+
orientation: context.orientation,
|
|
86
|
+
dir: context.dir,
|
|
87
|
+
loop,
|
|
88
|
+
asChild: true,
|
|
89
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListFrame, {
|
|
90
|
+
...headlessListProps,
|
|
91
|
+
flexDirection: context.orientation === "vertical" ? "column" : "row",
|
|
92
|
+
ref: forwardedRef,
|
|
93
|
+
...listProps,
|
|
94
|
+
children
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
var TabsTab = (0, import_core.createStyledHOC)(TabsTabFrame, function TabsTab2(props, forwardedRef) {
|
|
100
|
+
var { __scopeTabs, value, disabled: disabledProp, onInteraction, activeStyle, activeTheme, onLayout, onMouseEnter, onMouseLeave, onPress, onKeyDown, onFocus, onBlur, ...triggerProps } = props;
|
|
101
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
102
|
+
var listDisabled = React.useContext(TabsListDisabledContext);
|
|
103
|
+
var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : listDisabled;
|
|
104
|
+
var { isSelected, tabProps } = (0, import_tabs_headless.useTab)({
|
|
105
|
+
baseId: context.baseId,
|
|
106
|
+
value,
|
|
107
|
+
selectedValue: context.value,
|
|
108
|
+
disabled,
|
|
109
|
+
activationMode: context.activationMode,
|
|
110
|
+
onChange: context.onChange
|
|
111
|
+
});
|
|
112
|
+
var { onPress: activateOnPress, onKeyDown: activateOnKeyDown, onFocus: activateOnFocus, ...tabA11yProps } = tabProps;
|
|
113
|
+
var [layout, setLayout] = React.useState(null);
|
|
114
|
+
var triggerRef = React.useRef(null);
|
|
115
|
+
var emitInteraction = (0, import_web.useEvent)(function(type, layout2) {
|
|
116
|
+
onInteraction === null || onInteraction === void 0 ? void 0 : onInteraction(type, layout2);
|
|
117
|
+
});
|
|
118
|
+
React.useEffect(function() {
|
|
119
|
+
context.registerTrigger();
|
|
120
|
+
return function() {
|
|
121
|
+
return context.unregisterTrigger();
|
|
122
|
+
};
|
|
123
|
+
}, []);
|
|
124
|
+
React.useEffect(function() {
|
|
125
|
+
if (!triggerRef.current || !import_constants.isWeb) return;
|
|
126
|
+
var element = triggerRef.current;
|
|
127
|
+
function updateTriggerSize() {
|
|
128
|
+
var next = {
|
|
129
|
+
width: element.offsetWidth,
|
|
130
|
+
height: element.offsetHeight,
|
|
131
|
+
x: element.offsetLeft,
|
|
132
|
+
y: element.offsetTop
|
|
133
|
+
};
|
|
134
|
+
setLayout(function(previous) {
|
|
135
|
+
return previous && previous.width === next.width && previous.height === next.height && previous.x === next.x && previous.y === next.y ? previous : next;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
updateTriggerSize();
|
|
139
|
+
var observer = new ResizeObserver(updateTriggerSize);
|
|
140
|
+
observer.observe(element);
|
|
141
|
+
return function() {
|
|
142
|
+
return observer.disconnect();
|
|
143
|
+
};
|
|
144
|
+
}, [context.triggersCount]);
|
|
145
|
+
React.useEffect(function() {
|
|
146
|
+
if (isSelected && layout) {
|
|
147
|
+
emitInteraction("select", layout);
|
|
148
|
+
}
|
|
149
|
+
}, [
|
|
150
|
+
emitInteraction,
|
|
151
|
+
isSelected,
|
|
152
|
+
layout
|
|
153
|
+
]);
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
155
|
+
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
156
|
+
asChild: true,
|
|
157
|
+
tabIndex: disabled ? -1 : 0,
|
|
158
|
+
active: isSelected,
|
|
159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTabFrame, {
|
|
160
|
+
onLayout: import_constants.isWeb ? onLayout : (0, import_helpers.composeEventHandlers)(onLayout, function(event) {
|
|
161
|
+
setLayout(event.nativeEvent.layout);
|
|
162
|
+
}),
|
|
163
|
+
onMouseEnter: (0, import_helpers.composeEventHandlers)(onMouseEnter, function() {
|
|
164
|
+
if (layout) {
|
|
165
|
+
emitInteraction("hover", layout);
|
|
166
|
+
}
|
|
167
|
+
}),
|
|
168
|
+
onMouseLeave: (0, import_helpers.composeEventHandlers)(onMouseLeave, function() {
|
|
169
|
+
emitInteraction("hover", null);
|
|
170
|
+
}),
|
|
171
|
+
...tabA11yProps,
|
|
172
|
+
theme: isSelected ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : null,
|
|
173
|
+
size: context.size,
|
|
174
|
+
...triggerProps,
|
|
175
|
+
...isSelected && activeStyle,
|
|
176
|
+
ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),
|
|
177
|
+
onPress: (0, import_helpers.composeEventHandlers)(onPress !== null && onPress !== void 0 ? onPress : void 0, activateOnPress),
|
|
178
|
+
...import_constants.isWeb && {
|
|
179
|
+
onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, activateOnKeyDown),
|
|
180
|
+
onFocus: (0, import_helpers.composeEventHandlers)(onFocus, (0, import_helpers.composeEventHandlers)(function() {
|
|
181
|
+
if (layout) {
|
|
182
|
+
emitInteraction("focus", layout);
|
|
183
|
+
}
|
|
184
|
+
}, activateOnFocus)),
|
|
185
|
+
onBlur: (0, import_helpers.composeEventHandlers)(onBlur, function() {
|
|
186
|
+
emitInteraction("focus", null);
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
var TabsContent = (0, import_core.createStyledHOC)(TabsContentFrame, function TabsContent2(props, forwardedRef) {
|
|
193
|
+
var { __scopeTabs, value, forceMount, children, ...contentProps } = props;
|
|
194
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
195
|
+
var { shouldMount, contentProps: headlessContentProps } = (0, import_tabs_headless.useTabContent)({
|
|
196
|
+
baseId: context.baseId,
|
|
197
|
+
value,
|
|
198
|
+
selectedValue: context.value,
|
|
199
|
+
orientation: context.orientation,
|
|
200
|
+
forceMount
|
|
201
|
+
});
|
|
202
|
+
if (!shouldMount) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContentFrame, {
|
|
206
|
+
...headlessContentProps,
|
|
207
|
+
...contentProps,
|
|
208
|
+
ref: forwardedRef,
|
|
209
|
+
children
|
|
210
|
+
}, value);
|
|
211
|
+
});
|
|
212
|
+
var TabsComponent = (0, import_core.createStyledHOC)(TabsFrame, function Tabs(props, forwardedRef) {
|
|
213
|
+
var { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", size = true, ...tabsProps } = props;
|
|
214
|
+
var { value, setValue, baseId, direction, triggersCount, registerTrigger, unregisterTrigger, tabsProps: headlessTabsProps } = (0, import_tabs_headless.useTabs)({
|
|
215
|
+
value: valueProp,
|
|
216
|
+
onValueChange,
|
|
217
|
+
defaultValue,
|
|
218
|
+
orientation,
|
|
219
|
+
dir,
|
|
220
|
+
activationMode
|
|
221
|
+
});
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size.SizeContext.Provider, {
|
|
223
|
+
size,
|
|
224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.TabsProvider, {
|
|
225
|
+
scope: __scopeTabs,
|
|
226
|
+
baseId,
|
|
227
|
+
value,
|
|
228
|
+
onChange: setValue,
|
|
229
|
+
orientation,
|
|
230
|
+
dir: direction,
|
|
231
|
+
activationMode,
|
|
232
|
+
size,
|
|
233
|
+
registerTrigger,
|
|
234
|
+
triggersCount,
|
|
235
|
+
unregisterTrigger,
|
|
236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsFrame, {
|
|
237
|
+
direction,
|
|
238
|
+
...headlessTabsProps,
|
|
239
|
+
...tabsProps,
|
|
240
|
+
ref: forwardedRef
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
var Tabs2 = (0, import_helpers.withStaticProperties)(TabsComponent, {
|
|
246
|
+
Frame: TabsFrame,
|
|
247
|
+
List: TabsList,
|
|
248
|
+
Tab: TabsTab,
|
|
249
|
+
Content: TabsContent
|
|
250
|
+
});
|
package/dist/cjs/Tabs.native.js
CHANGED
|
@@ -1,86 +1,252 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
10
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
21
24
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
30
|
var Tabs_exports = {};
|
|
26
31
|
__export(Tabs_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
Tabs: () => Tabs2,
|
|
33
|
+
TabsContent: () => TabsContent,
|
|
34
|
+
TabsContentFrame: () => TabsContentFrame,
|
|
35
|
+
TabsFrame: () => TabsFrame,
|
|
36
|
+
TabsList: () => TabsList,
|
|
37
|
+
TabsListFrame: () => TabsListFrame,
|
|
38
|
+
TabsTab: () => TabsTab,
|
|
39
|
+
TabsTabFrame: () => TabsTabFrame
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(Tabs_exports);
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var import_compose_refs = require("@tamagui/compose-refs");
|
|
44
|
+
var import_constants = require("@tamagui/constants");
|
|
32
45
|
var import_core = require("@tamagui/core");
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
46
|
+
var import_helpers = require("@tamagui/helpers");
|
|
47
|
+
var import_roving_focus = require("@tamagui/roving-focus");
|
|
48
|
+
var import_size = require("@tamagui/size");
|
|
49
|
+
var import_tabs_headless = require("@tamagui/tabs-headless");
|
|
50
|
+
var import_web = require("@tamagui/web");
|
|
51
|
+
var React = __toESM(require("react"), 1);
|
|
52
|
+
var import_StyledContext = require("./StyledContext.native.js");
|
|
53
|
+
var TABS_CONTEXT = "TabsContext";
|
|
54
|
+
var TabsFrame = (0, import_core.styled)(import_core.View, {
|
|
55
|
+
displayName: "Tabs",
|
|
56
|
+
context: import_size.SizeContext
|
|
57
|
+
});
|
|
58
|
+
var TabsListFrame = (0, import_core.styled)(import_core.View, {
|
|
59
|
+
displayName: "TabsList",
|
|
60
|
+
context: import_size.SizeContext,
|
|
61
|
+
role: "tablist"
|
|
62
|
+
});
|
|
63
|
+
var TabsTabFrame = (0, import_core.styled)(import_core.View, {
|
|
64
|
+
displayName: "TabsTrigger",
|
|
65
|
+
context: import_size.SizeContext,
|
|
66
|
+
role: "tab",
|
|
67
|
+
variants: { disabled: { true: { pointerEvents: "none" } } }
|
|
68
|
+
});
|
|
69
|
+
var TabsContentFrame = (0, import_core.styled)(import_core.View, {
|
|
70
|
+
displayName: "TabsContent",
|
|
71
|
+
context: import_size.SizeContext
|
|
38
72
|
});
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
focusVisibleStyle: {
|
|
66
|
-
outlineColor: "$outlineColor",
|
|
67
|
-
outlineWidth: 2,
|
|
68
|
-
outlineStyle: "solid",
|
|
69
|
-
zIndex: 10
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
defaultVariants: {
|
|
75
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
accept: {
|
|
79
|
-
activeStyle: "style"
|
|
80
|
-
}
|
|
73
|
+
var TabsListDisabledContext = /* @__PURE__ */ React.createContext(false);
|
|
74
|
+
var TabsList = (0, import_core.createStyledHOC)(TabsListFrame, function TabsList2(props, forwardedRef) {
|
|
75
|
+
var { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;
|
|
76
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
77
|
+
var { listProps: headlessListProps } = (0, import_tabs_headless.useTabsList)({
|
|
78
|
+
orientation: context.orientation,
|
|
79
|
+
disabled
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListDisabledContext.Provider, {
|
|
82
|
+
value: disabled,
|
|
83
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
84
|
+
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
85
|
+
orientation: context.orientation,
|
|
86
|
+
dir: context.dir,
|
|
87
|
+
loop,
|
|
88
|
+
asChild: true,
|
|
89
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListFrame, {
|
|
90
|
+
...headlessListProps,
|
|
91
|
+
flexDirection: context.orientation === "vertical" ? "column" : "row",
|
|
92
|
+
ref: forwardedRef,
|
|
93
|
+
...listProps,
|
|
94
|
+
children
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
});
|
|
81
98
|
});
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
|
|
99
|
+
var TabsTab = (0, import_core.createStyledHOC)(TabsTabFrame, function TabsTab2(props, forwardedRef) {
|
|
100
|
+
var { __scopeTabs, value, disabled: disabledProp, onInteraction, activeStyle, activeTheme, onLayout, onMouseEnter, onMouseLeave, onPress, onKeyDown, onFocus, onBlur, ...triggerProps } = props;
|
|
101
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
102
|
+
var listDisabled = React.useContext(TabsListDisabledContext);
|
|
103
|
+
var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : listDisabled;
|
|
104
|
+
var { isSelected, tabProps } = (0, import_tabs_headless.useTab)({
|
|
105
|
+
baseId: context.baseId,
|
|
106
|
+
value,
|
|
107
|
+
selectedValue: context.value,
|
|
108
|
+
disabled,
|
|
109
|
+
activationMode: context.activationMode,
|
|
110
|
+
onChange: context.onChange
|
|
111
|
+
});
|
|
112
|
+
var { onPress: activateOnPress, onKeyDown: activateOnKeyDown, onFocus: activateOnFocus, ...tabA11yProps } = tabProps;
|
|
113
|
+
var [layout, setLayout] = React.useState(null);
|
|
114
|
+
var triggerRef = React.useRef(null);
|
|
115
|
+
var emitInteraction = (0, import_web.useEvent)(function(type, layout2) {
|
|
116
|
+
onInteraction === null || onInteraction === void 0 ? void 0 : onInteraction(type, layout2);
|
|
117
|
+
});
|
|
118
|
+
React.useEffect(function() {
|
|
119
|
+
context.registerTrigger();
|
|
120
|
+
return function() {
|
|
121
|
+
return context.unregisterTrigger();
|
|
122
|
+
};
|
|
123
|
+
}, []);
|
|
124
|
+
React.useEffect(function() {
|
|
125
|
+
if (!triggerRef.current || !import_constants.isWeb) return;
|
|
126
|
+
var element = triggerRef.current;
|
|
127
|
+
function updateTriggerSize() {
|
|
128
|
+
var next = {
|
|
129
|
+
width: element.offsetWidth,
|
|
130
|
+
height: element.offsetHeight,
|
|
131
|
+
x: element.offsetLeft,
|
|
132
|
+
y: element.offsetTop
|
|
133
|
+
};
|
|
134
|
+
setLayout(function(previous) {
|
|
135
|
+
return previous && previous.width === next.width && previous.height === next.height && previous.x === next.x && previous.y === next.y ? previous : next;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
updateTriggerSize();
|
|
139
|
+
var observer = new ResizeObserver(updateTriggerSize);
|
|
140
|
+
observer.observe(element);
|
|
141
|
+
return function() {
|
|
142
|
+
return observer.disconnect();
|
|
143
|
+
};
|
|
144
|
+
}, [context.triggersCount]);
|
|
145
|
+
React.useEffect(function() {
|
|
146
|
+
if (isSelected && layout) {
|
|
147
|
+
emitInteraction("select", layout);
|
|
148
|
+
}
|
|
149
|
+
}, [
|
|
150
|
+
emitInteraction,
|
|
151
|
+
isSelected,
|
|
152
|
+
layout
|
|
153
|
+
]);
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
155
|
+
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
156
|
+
asChild: true,
|
|
157
|
+
tabIndex: disabled ? -1 : 0,
|
|
158
|
+
active: isSelected,
|
|
159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTabFrame, {
|
|
160
|
+
onLayout: import_constants.isWeb ? onLayout : (0, import_helpers.composeEventHandlers)(onLayout, function(event) {
|
|
161
|
+
setLayout(event.nativeEvent.layout);
|
|
162
|
+
}),
|
|
163
|
+
onMouseEnter: (0, import_helpers.composeEventHandlers)(onMouseEnter, function() {
|
|
164
|
+
if (layout) {
|
|
165
|
+
emitInteraction("hover", layout);
|
|
166
|
+
}
|
|
167
|
+
}),
|
|
168
|
+
onMouseLeave: (0, import_helpers.composeEventHandlers)(onMouseLeave, function() {
|
|
169
|
+
emitInteraction("hover", null);
|
|
170
|
+
}),
|
|
171
|
+
...tabA11yProps,
|
|
172
|
+
theme: isSelected ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : null,
|
|
173
|
+
size: context.size,
|
|
174
|
+
...triggerProps,
|
|
175
|
+
...isSelected && activeStyle,
|
|
176
|
+
ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),
|
|
177
|
+
onPress: (0, import_helpers.composeEventHandlers)(onPress !== null && onPress !== void 0 ? onPress : void 0, activateOnPress),
|
|
178
|
+
...import_constants.isWeb && {
|
|
179
|
+
onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, activateOnKeyDown),
|
|
180
|
+
onFocus: (0, import_helpers.composeEventHandlers)(onFocus, (0, import_helpers.composeEventHandlers)(function() {
|
|
181
|
+
if (layout) {
|
|
182
|
+
emitInteraction("focus", layout);
|
|
183
|
+
}
|
|
184
|
+
}, activateOnFocus)),
|
|
185
|
+
onBlur: (0, import_helpers.composeEventHandlers)(onBlur, function() {
|
|
186
|
+
emitInteraction("focus", null);
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
});
|
|
85
191
|
});
|
|
192
|
+
var TabsContent = (0, import_core.createStyledHOC)(TabsContentFrame, function TabsContent2(props, forwardedRef) {
|
|
193
|
+
var { __scopeTabs, value, forceMount, children, ...contentProps } = props;
|
|
194
|
+
var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
195
|
+
var { shouldMount, contentProps: headlessContentProps } = (0, import_tabs_headless.useTabContent)({
|
|
196
|
+
baseId: context.baseId,
|
|
197
|
+
value,
|
|
198
|
+
selectedValue: context.value,
|
|
199
|
+
orientation: context.orientation,
|
|
200
|
+
forceMount
|
|
201
|
+
});
|
|
202
|
+
if (!shouldMount) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContentFrame, {
|
|
206
|
+
...headlessContentProps,
|
|
207
|
+
...contentProps,
|
|
208
|
+
ref: forwardedRef,
|
|
209
|
+
children
|
|
210
|
+
}, value);
|
|
211
|
+
});
|
|
212
|
+
var TabsComponent = (0, import_core.createStyledHOC)(TabsFrame, function Tabs(props, forwardedRef) {
|
|
213
|
+
var { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", size = true, ...tabsProps } = props;
|
|
214
|
+
var { value, setValue, baseId, direction, triggersCount, registerTrigger, unregisterTrigger, tabsProps: headlessTabsProps } = (0, import_tabs_headless.useTabs)({
|
|
215
|
+
value: valueProp,
|
|
216
|
+
onValueChange,
|
|
217
|
+
defaultValue,
|
|
218
|
+
orientation,
|
|
219
|
+
dir,
|
|
220
|
+
activationMode
|
|
221
|
+
});
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size.SizeContext.Provider, {
|
|
223
|
+
size,
|
|
224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.TabsProvider, {
|
|
225
|
+
scope: __scopeTabs,
|
|
226
|
+
baseId,
|
|
227
|
+
value,
|
|
228
|
+
onChange: setValue,
|
|
229
|
+
orientation,
|
|
230
|
+
dir: direction,
|
|
231
|
+
activationMode,
|
|
232
|
+
size,
|
|
233
|
+
registerTrigger,
|
|
234
|
+
triggersCount,
|
|
235
|
+
unregisterTrigger,
|
|
236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsFrame, {
|
|
237
|
+
direction,
|
|
238
|
+
...headlessTabsProps,
|
|
239
|
+
...tabsProps,
|
|
240
|
+
ref: forwardedRef
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
var Tabs2 = (0, import_helpers.withStaticProperties)(TabsComponent, {
|
|
246
|
+
Frame: TabsFrame,
|
|
247
|
+
List: TabsList,
|
|
248
|
+
Tab: TabsTab,
|
|
249
|
+
Content: TabsContent
|
|
250
|
+
});
|
|
251
|
+
|
|
86
252
|
//# sourceMappingURL=Tabs.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Tabs_exports","__export","DefaultTabsContentFrame","DefaultTabsFrame","DefaultTabsTabFrame","module","exports","import_core","require","import_get_button_sized","import_stacks","TABS_NAME","styled","SizableStack","name","TRIGGER_NAME","View","role","variants","size","getButtonSized","disabled","true","pointerEvents","unstyled","false","borderWidth","backgroundColor","userSelect","justifyContent","alignItems","flexWrap","flexDirection","cursor","pressStyle","focusVisibleStyle","outlineColor","outlineWidth","outlineStyle","zIndex","defaultVariants","process","env","TAMAGUI_HEADLESS","accept","activeStyle","CONTENT_NAME","ThemeableStack"],"sources":["../../src/Tabs.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,YAAA;AAAAC,QAAA,CAAAD,YAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAA6B,CAAAK,YAAA;AAC7B,IAAAO,WAAA,GAAAC,OAAA,gBAA+B;AAC/B,IAAAC,uBAA6C,GAAAD,OAAA;AAE7C,IAAAE,aAAM,GAAYF,OAAA;AACX,IAAAG,SAAM;AAAwC,IACnDR,gBAAM,OAAAI,WAAA,CAAAK,MAAA,EAAAF,aAAA,CAAAG,YAAA;EACPC,IAAA,EAAAH;AAED;AAEO,IAAAI,YAAM,gBAAsB;AAAA,IACjCX,mBAAA,OAAAG,WAAA,CAAAK,MAAA,EAAAL,WAAA,CAAAS,IAAA;EACAF,IAAA,EAAAC,YAAA;EAAAE,IACE,OAAM;EAAAC,QACA;IAENC,IAAA;MACE,SAAM,EAAAV,uBAAA,CAAAW;IAAA;IACOC,QACb;MAEAC,IAAA;QACEC,aAAM;MAAA;IACW;IACjBC,QACF;MAEAC,KAAA;QACEC,WAAO;QAAAC,eACQ;QAAAC,UACb;QAAiBC,cACL;QAAAC,UACZ,UAAgB;QAAAC,QAChB,UAAY;QAAAC,aACF;QAAAC,MACV,WAAe;QAAAC,UACP;UAERP,eAAY;QAAA;QACOQ,iBACnB;UAEAC,YAAA,iBAAmB;UAAAC,YACjB;UAAcC,YACd,SAAc;UAAAC,MACd;QAAc;MACN;IACV;EACF;EACFC,eACF;IAEAhB,QAAA,EAAAiB,OAAiB,CAAAC,GAAA,CAAAC,gBAAA;EAAA;AAC4B;EAE/CC,MAAA;IACAC,WAAA;EAAA;AACU;AACO,IACfC,YAAA;AAAA,IACF5C,uBAAA,OAAAK,WAAA,CAAAK,MAAA,EAAAF,aAAA,CAAAqC,cAAA;EACFjC,IAAA,EAAAgC;AAEA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Tabs.native.js","names":[],"sources":["cjs/Tabs.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Tabs_exports = {};\n__export(Tabs_exports, {\n Tabs: () => Tabs2,\n TabsContent: () => TabsContent,\n TabsContentFrame: () => TabsContentFrame,\n TabsFrame: () => TabsFrame,\n TabsList: () => TabsList,\n TabsListFrame: () => TabsListFrame,\n TabsTab: () => TabsTab,\n TabsTabFrame: () => TabsTabFrame\n});\nmodule.exports = __toCommonJS(Tabs_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_roving_focus = require(\"@tamagui/roving-focus\");\nvar import_size = require(\"@tamagui/size\");\nvar import_tabs_headless = require(\"@tamagui/tabs-headless\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_StyledContext = require(\"./StyledContext\");\nvar TABS_CONTEXT = \"TabsContext\";\nvar TabsFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"Tabs\",\n context: import_size.SizeContext\n});\nvar TabsListFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"TabsList\",\n context: import_size.SizeContext,\n role: \"tablist\"\n});\nvar TabsTabFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"TabsTrigger\",\n context: import_size.SizeContext,\n role: \"tab\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar TabsContentFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"TabsContent\",\n context: import_size.SizeContext\n});\nvar TabsListDisabledContext = /* @__PURE__ */ React.createContext(false);\nvar TabsList = (0, import_core.createStyledHOC)(TabsListFrame, function TabsList2(props, forwardedRef) {\n var { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;\n var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);\n var { listProps: headlessListProps } = (0, import_tabs_headless.useTabsList)({\n orientation: context.orientation,\n disabled\n });\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListDisabledContext.Provider, {\n value: disabled,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {\n __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,\n orientation: context.orientation,\n dir: context.dir,\n loop,\n asChild: true,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListFrame, {\n ...headlessListProps,\n flexDirection: context.orientation === \"vertical\" ? \"column\" : \"row\",\n ref: forwardedRef,\n ...listProps,\n children\n })\n })\n });\n});\nvar TabsTab = (0, import_core.createStyledHOC)(TabsTabFrame, function TabsTab2(props, forwardedRef) {\n var { __scopeTabs, value, disabled: disabledProp, onInteraction, activeStyle, activeTheme, onLayout, onMouseEnter, onMouseLeave, onPress, onKeyDown, onFocus, onBlur, ...triggerProps } = props;\n var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);\n var listDisabled = React.useContext(TabsListDisabledContext);\n var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : listDisabled;\n var { isSelected, tabProps } = (0, import_tabs_headless.useTab)({\n baseId: context.baseId,\n value,\n selectedValue: context.value,\n disabled,\n activationMode: context.activationMode,\n onChange: context.onChange\n });\n var { onPress: activateOnPress, onKeyDown: activateOnKeyDown, onFocus: activateOnFocus, ...tabA11yProps } = tabProps;\n var [layout, setLayout] = React.useState(null);\n var triggerRef = React.useRef(null);\n var emitInteraction = (0, import_web.useEvent)(function(type, layout2) {\n onInteraction === null || onInteraction === void 0 ? void 0 : onInteraction(type, layout2);\n });\n React.useEffect(function() {\n context.registerTrigger();\n return function() {\n return context.unregisterTrigger();\n };\n }, []);\n React.useEffect(function() {\n if (!triggerRef.current || !import_constants.isWeb) return;\n var element = triggerRef.current;\n function updateTriggerSize() {\n var next = {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop\n };\n setLayout(function(previous) {\n return previous && previous.width === next.width && previous.height === next.height && previous.x === next.x && previous.y === next.y ? previous : next;\n });\n }\n updateTriggerSize();\n var observer = new ResizeObserver(updateTriggerSize);\n observer.observe(element);\n return function() {\n return observer.disconnect();\n };\n }, [\n context.triggersCount\n ]);\n React.useEffect(function() {\n if (isSelected && layout) {\n emitInteraction(\"select\", layout);\n }\n }, [\n emitInteraction,\n isSelected,\n layout\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {\n __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,\n asChild: true,\n tabIndex: disabled ? -1 : 0,\n active: isSelected,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTabFrame, {\n onLayout: import_constants.isWeb ? onLayout : (0, import_helpers.composeEventHandlers)(onLayout, function(event) {\n setLayout(event.nativeEvent.layout);\n }),\n onMouseEnter: (0, import_helpers.composeEventHandlers)(onMouseEnter, function() {\n if (layout) {\n emitInteraction(\"hover\", layout);\n }\n }),\n onMouseLeave: (0, import_helpers.composeEventHandlers)(onMouseLeave, function() {\n emitInteraction(\"hover\", null);\n }),\n ...tabA11yProps,\n theme: isSelected ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : null,\n size: context.size,\n ...triggerProps,\n // after triggerProps so active styles beat base styles from styled() skins\n ...isSelected && activeStyle,\n ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),\n onPress: (0, import_helpers.composeEventHandlers)(onPress !== null && onPress !== void 0 ? onPress : void 0, activateOnPress),\n ...import_constants.isWeb && {\n onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, activateOnKeyDown),\n // emit the focus interaction before activating, matching the order\n // the indicator animations were built against\n onFocus: (0, import_helpers.composeEventHandlers)(onFocus, (0, import_helpers.composeEventHandlers)(function() {\n if (layout) {\n emitInteraction(\"focus\", layout);\n }\n }, activateOnFocus)),\n onBlur: (0, import_helpers.composeEventHandlers)(onBlur, function() {\n emitInteraction(\"focus\", null);\n })\n }\n })\n });\n});\nvar TabsContent = (0, import_core.createStyledHOC)(TabsContentFrame, function TabsContent2(props, forwardedRef) {\n var { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n var context = (0, import_StyledContext.useTabsContext)(__scopeTabs);\n var { shouldMount, contentProps: headlessContentProps } = (0, import_tabs_headless.useTabContent)({\n baseId: context.baseId,\n value,\n selectedValue: context.value,\n orientation: context.orientation,\n forceMount\n });\n if (!shouldMount) {\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContentFrame, {\n // @ts-ignore hidden is a web-only accessibility attribute\n ...headlessContentProps,\n ...contentProps,\n ref: forwardedRef,\n children\n }, value);\n});\nvar TabsComponent = (0, import_core.createStyledHOC)(TabsFrame, function Tabs(props, forwardedRef) {\n var { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = \"horizontal\", dir, activationMode = \"automatic\", size = true, ...tabsProps } = props;\n var { value, setValue, baseId, direction, triggersCount, registerTrigger, unregisterTrigger, tabsProps: headlessTabsProps } = (0, import_tabs_headless.useTabs)({\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation,\n dir,\n activationMode\n });\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size.SizeContext.Provider, {\n size,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.TabsProvider, {\n scope: __scopeTabs,\n baseId,\n value,\n onChange: setValue,\n orientation,\n dir: direction,\n activationMode,\n size,\n registerTrigger,\n triggersCount,\n unregisterTrigger,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsFrame, {\n direction,\n ...headlessTabsProps,\n ...tabsProps,\n ref: forwardedRef\n })\n })\n });\n});\nvar Tabs2 = (0, import_helpers.withStaticProperties)(TabsComponent, {\n Frame: TabsFrame,\n List: TabsList,\n Tab: TabsTab,\n Content: TabsContent\n});\n//# sourceMappingURL=Tabs.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,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OAAO;CACT;CACA,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,kBAAkB;EAEnE,GAAG;EACH,GAAG;EACH,KAAK;EACL;CACF,GAAG,KAAK;AACV,CAAC;AACD,IAAI,iBAAiB,GAAG,YAAY,iBAAiB,WAAW,SAAS,KAAK,OAAO,cAAc;CACjG,IAAI,EAAE,aAAa,OAAO,WAAW,eAAe,cAAc,cAAc,cAAc,KAAK,iBAAiB,aAAa,OAAO,MAAM,GAAG,cAAc;CAC/J,IAAI,EAAE,OAAO,UAAU,QAAQ,WAAW,eAAe,iBAAiB,mBAAmB,WAAW,uBAAuB,GAAG,qBAAqB,SAAS;EAC9J,OAAO;EACP;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,YAAY,YAAY,UAAU;EACnF;EACA,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,qBAAqB,cAAc;GACvF,OAAO;GACP;GACA;GACA,UAAU;GACV;GACA,KAAK;GACL;GACA;GACA;GACA;GACA;GACA,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,WAAW;IAC/D;IACA,GAAG;IACH,GAAG;IACH,KAAK;GACP,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,SAAS,GAAG,eAAe,sBAAsB,eAAe;CAClE,OAAO;CACP,MAAM;CACN,KAAK;CACL,SAAS;AACX,CAAC"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
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
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
6
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
19
14
|
};
|
|
20
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
22
|
-
value: true
|
|
23
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
17
|
var index_exports = {};
|
|
25
|
-
__export(index_exports, {
|
|
26
|
-
Tabs: () => Tabs
|
|
27
|
-
});
|
|
28
18
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var import_createTabs = require("./createTabs.cjs");
|
|
30
|
-
var import_Tabs = require("./Tabs.cjs");
|
|
31
|
-
__reExport(index_exports, require("./createTabs.cjs"), module.exports);
|
|
32
19
|
__reExport(index_exports, require("./StyledContext.cjs"), module.exports);
|
|
33
|
-
|
|
34
|
-
ContentFrame: import_Tabs.DefaultTabsContentFrame,
|
|
35
|
-
TabFrame: import_Tabs.DefaultTabsTabFrame,
|
|
36
|
-
TabsFrame: import_Tabs.DefaultTabsFrame
|
|
37
|
-
});
|
|
20
|
+
__reExport(index_exports, require("./Tabs.cjs"), module.exports);
|