@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.
Files changed (67) hide show
  1. package/dist/cjs/StyledContext.cjs +16 -20
  2. package/dist/cjs/StyledContext.native.cjs +31 -0
  3. package/dist/cjs/StyledContext.native.js +17 -20
  4. package/dist/cjs/StyledContext.native.js.map +1 -1
  5. package/dist/cjs/Tabs.cjs +227 -68
  6. package/dist/cjs/Tabs.native.cjs +250 -0
  7. package/dist/cjs/Tabs.native.js +233 -67
  8. package/dist/cjs/Tabs.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +10 -27
  10. package/dist/cjs/index.native.cjs +22 -0
  11. package/dist/cjs/index.native.js +11 -27
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/esm/StyledContext.mjs +3 -4
  14. package/dist/esm/StyledContext.mjs.map +1 -1
  15. package/dist/esm/StyledContext.native.js +3 -4
  16. package/dist/esm/StyledContext.native.js.map +1 -1
  17. package/dist/esm/Tabs.mjs +206 -55
  18. package/dist/esm/Tabs.mjs.map +1 -1
  19. package/dist/esm/Tabs.native.js +212 -55
  20. package/dist/esm/Tabs.native.js.map +1 -1
  21. package/dist/esm/index.js +3 -11
  22. package/dist/esm/index.mjs +3 -11
  23. package/dist/esm/index.native.js +3 -11
  24. package/dist/jsx/StyledContext.mjs +3 -4
  25. package/dist/jsx/StyledContext.mjs.map +1 -1
  26. package/dist/jsx/StyledContext.native.cjs +31 -0
  27. package/dist/jsx/StyledContext.native.js +17 -20
  28. package/dist/jsx/StyledContext.native.js.map +1 -1
  29. package/dist/jsx/Tabs.mjs +206 -55
  30. package/dist/jsx/Tabs.mjs.map +1 -1
  31. package/dist/jsx/Tabs.native.cjs +250 -0
  32. package/dist/jsx/Tabs.native.js +233 -67
  33. package/dist/jsx/Tabs.native.js.map +1 -1
  34. package/dist/jsx/index.js +3 -11
  35. package/dist/jsx/index.mjs +3 -11
  36. package/dist/jsx/index.native.cjs +22 -0
  37. package/dist/jsx/index.native.js +11 -27
  38. package/dist/jsx/index.native.js.map +1 -1
  39. package/package.json +11 -17
  40. package/src/StyledContext.tsx +3 -3
  41. package/src/Tabs.tsx +368 -55
  42. package/src/index.ts +1 -9
  43. package/types/StyledContext.d.ts +3 -3
  44. package/types/StyledContext.d.ts.map +1 -1
  45. package/types/Tabs.d.ts +398 -35
  46. package/types/Tabs.d.ts.map +1 -1
  47. package/types/index.d.ts +1 -537
  48. package/types/index.d.ts.map +1 -1
  49. package/dist/cjs/createTabs.cjs +0 -293
  50. package/dist/cjs/createTabs.native.js +0 -308
  51. package/dist/cjs/createTabs.native.js.map +0 -1
  52. package/dist/esm/createTabs.mjs +0 -257
  53. package/dist/esm/createTabs.mjs.map +0 -1
  54. package/dist/esm/createTabs.native.js +0 -269
  55. package/dist/esm/createTabs.native.js.map +0 -1
  56. package/dist/esm/index.js.map +0 -1
  57. package/dist/esm/index.mjs.map +0 -1
  58. package/dist/esm/index.native.js.map +0 -1
  59. package/dist/jsx/createTabs.mjs +0 -257
  60. package/dist/jsx/createTabs.mjs.map +0 -1
  61. package/dist/jsx/createTabs.native.js +0 -308
  62. package/dist/jsx/createTabs.native.js.map +0 -1
  63. package/dist/jsx/index.js.map +0 -1
  64. package/dist/jsx/index.mjs.map +0 -1
  65. package/src/createTabs.tsx +0 -438
  66. package/types/createTabs.d.ts +0 -527
  67. package/types/createTabs.d.ts.map +0 -1
@@ -1,56 +1,213 @@
1
- import { styled, View } from "@tamagui/core";
2
- import { getButtonSized } from "@tamagui/get-button-sized";
3
- import { SizableStack, ThemeableStack } from "@tamagui/stacks";
4
- var TABS_NAME = "Tabs";
5
- var DefaultTabsFrame = styled(SizableStack, {
6
- name: TABS_NAME
7
- });
8
- var TRIGGER_NAME = "TabsTrigger";
9
- var DefaultTabsTabFrame = styled(View, {
10
- name: TRIGGER_NAME,
11
- role: "tab",
12
- variants: {
13
- size: {
14
- "...size": getButtonSized
15
- },
16
- disabled: {
17
- true: {
18
- pointerEvents: "none"
19
- }
20
- },
21
- unstyled: {
22
- false: {
23
- borderWidth: 0,
24
- backgroundColor: "$background",
25
- userSelect: "none",
26
- justifyContent: "center",
27
- alignItems: "center",
28
- flexWrap: "nowrap",
29
- flexDirection: "row",
30
- cursor: "pointer",
31
- pressStyle: {
32
- backgroundColor: "$backgroundPress"
33
- },
34
- focusVisibleStyle: {
35
- outlineColor: "$outlineColor",
36
- outlineWidth: 2,
37
- outlineStyle: "solid",
38
- zIndex: 10
39
- }
40
- }
41
- }
42
- },
43
- defaultVariants: {
44
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
45
- }
46
- }, {
47
- accept: {
48
- activeStyle: "style"
49
- }
50
- });
51
- var CONTENT_NAME = "TabsContent";
52
- var DefaultTabsContentFrame = styled(ThemeableStack, {
53
- name: CONTENT_NAME
54
- });
55
- export { DefaultTabsContentFrame, DefaultTabsFrame, DefaultTabsTabFrame };
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { composeRefs } from "@tamagui/compose-refs";
3
+ import { isWeb } from "@tamagui/constants";
4
+ import { View, createStyledHOC, styled } from "@tamagui/core";
5
+ import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
6
+ import { RovingFocusGroup } from "@tamagui/roving-focus";
7
+ import { SizeContext } from "@tamagui/size";
8
+ import { useTab, useTabContent, useTabs, useTabsList } from "@tamagui/tabs-headless";
9
+ import { useEvent } from "@tamagui/web";
10
+ import * as React from "react";
11
+ import { TabsProvider, useTabsContext } from "./StyledContext.native.js";
12
+
13
+ var TABS_CONTEXT = "TabsContext";
14
+ var TabsFrame = styled(View, {
15
+ displayName: "Tabs",
16
+ context: SizeContext
17
+ });
18
+ var TabsListFrame = styled(View, {
19
+ displayName: "TabsList",
20
+ context: SizeContext,
21
+ role: "tablist"
22
+ });
23
+ var TabsTabFrame = styled(View, {
24
+ displayName: "TabsTrigger",
25
+ context: SizeContext,
26
+ role: "tab",
27
+ variants: { disabled: { true: { pointerEvents: "none" } } }
28
+ });
29
+ var TabsContentFrame = styled(View, {
30
+ displayName: "TabsContent",
31
+ context: SizeContext
32
+ });
33
+ var TabsListDisabledContext = /* @__PURE__ */ React.createContext(false);
34
+ var TabsList = createStyledHOC(TabsListFrame, function TabsList2(props, forwardedRef) {
35
+ var { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;
36
+ var context = useTabsContext(__scopeTabs);
37
+ var { listProps: headlessListProps } = useTabsList({
38
+ orientation: context.orientation,
39
+ disabled
40
+ });
41
+ return /* @__PURE__ */ jsx(TabsListDisabledContext.Provider, {
42
+ value: disabled,
43
+ children: /* @__PURE__ */ jsx(RovingFocusGroup, {
44
+ __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
45
+ orientation: context.orientation,
46
+ dir: context.dir,
47
+ loop,
48
+ asChild: true,
49
+ children: /* @__PURE__ */ jsx(TabsListFrame, {
50
+ ...headlessListProps,
51
+ flexDirection: context.orientation === "vertical" ? "column" : "row",
52
+ ref: forwardedRef,
53
+ ...listProps,
54
+ children
55
+ })
56
+ })
57
+ });
58
+ });
59
+ var TabsTab = createStyledHOC(TabsTabFrame, function TabsTab2(props, forwardedRef) {
60
+ var { __scopeTabs, value, disabled: disabledProp, onInteraction, activeStyle, activeTheme, onLayout, onMouseEnter, onMouseLeave, onPress, onKeyDown, onFocus, onBlur, ...triggerProps } = props;
61
+ var context = useTabsContext(__scopeTabs);
62
+ var listDisabled = React.useContext(TabsListDisabledContext);
63
+ var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : listDisabled;
64
+ var { isSelected, tabProps } = useTab({
65
+ baseId: context.baseId,
66
+ value,
67
+ selectedValue: context.value,
68
+ disabled,
69
+ activationMode: context.activationMode,
70
+ onChange: context.onChange
71
+ });
72
+ var { onPress: activateOnPress, onKeyDown: activateOnKeyDown, onFocus: activateOnFocus, ...tabA11yProps } = tabProps;
73
+ var [layout, setLayout] = React.useState(null);
74
+ var triggerRef = React.useRef(null);
75
+ var emitInteraction = useEvent(function(type, layout2) {
76
+ onInteraction === null || onInteraction === void 0 ? void 0 : onInteraction(type, layout2);
77
+ });
78
+ React.useEffect(function() {
79
+ context.registerTrigger();
80
+ return function() {
81
+ return context.unregisterTrigger();
82
+ };
83
+ }, []);
84
+ React.useEffect(function() {
85
+ if (!triggerRef.current || !isWeb) return;
86
+ var element = triggerRef.current;
87
+ function updateTriggerSize() {
88
+ var next = {
89
+ width: element.offsetWidth,
90
+ height: element.offsetHeight,
91
+ x: element.offsetLeft,
92
+ y: element.offsetTop
93
+ };
94
+ setLayout(function(previous) {
95
+ return previous && previous.width === next.width && previous.height === next.height && previous.x === next.x && previous.y === next.y ? previous : next;
96
+ });
97
+ }
98
+ updateTriggerSize();
99
+ var observer = new ResizeObserver(updateTriggerSize);
100
+ observer.observe(element);
101
+ return function() {
102
+ return observer.disconnect();
103
+ };
104
+ }, [context.triggersCount]);
105
+ React.useEffect(function() {
106
+ if (isSelected && layout) {
107
+ emitInteraction("select", layout);
108
+ }
109
+ }, [
110
+ emitInteraction,
111
+ isSelected,
112
+ layout
113
+ ]);
114
+ return /* @__PURE__ */ jsx(RovingFocusGroup.Item, {
115
+ __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
116
+ asChild: true,
117
+ tabIndex: disabled ? -1 : 0,
118
+ active: isSelected,
119
+ children: /* @__PURE__ */ jsx(TabsTabFrame, {
120
+ onLayout: isWeb ? onLayout : composeEventHandlers(onLayout, function(event) {
121
+ setLayout(event.nativeEvent.layout);
122
+ }),
123
+ onMouseEnter: composeEventHandlers(onMouseEnter, function() {
124
+ if (layout) {
125
+ emitInteraction("hover", layout);
126
+ }
127
+ }),
128
+ onMouseLeave: composeEventHandlers(onMouseLeave, function() {
129
+ emitInteraction("hover", null);
130
+ }),
131
+ ...tabA11yProps,
132
+ theme: isSelected ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : null,
133
+ size: context.size,
134
+ ...triggerProps,
135
+ ...isSelected && activeStyle,
136
+ ref: composeRefs(forwardedRef, triggerRef),
137
+ onPress: composeEventHandlers(onPress !== null && onPress !== void 0 ? onPress : void 0, activateOnPress),
138
+ ...isWeb && {
139
+ onKeyDown: composeEventHandlers(onKeyDown, activateOnKeyDown),
140
+ onFocus: composeEventHandlers(onFocus, composeEventHandlers(function() {
141
+ if (layout) {
142
+ emitInteraction("focus", layout);
143
+ }
144
+ }, activateOnFocus)),
145
+ onBlur: composeEventHandlers(onBlur, function() {
146
+ emitInteraction("focus", null);
147
+ })
148
+ }
149
+ })
150
+ });
151
+ });
152
+ var TabsContent = createStyledHOC(TabsContentFrame, function TabsContent2(props, forwardedRef) {
153
+ var { __scopeTabs, value, forceMount, children, ...contentProps } = props;
154
+ var context = useTabsContext(__scopeTabs);
155
+ var { shouldMount, contentProps: headlessContentProps } = useTabContent({
156
+ baseId: context.baseId,
157
+ value,
158
+ selectedValue: context.value,
159
+ orientation: context.orientation,
160
+ forceMount
161
+ });
162
+ if (!shouldMount) {
163
+ return null;
164
+ }
165
+ return /* @__PURE__ */ jsx(TabsContentFrame, {
166
+ ...headlessContentProps,
167
+ ...contentProps,
168
+ ref: forwardedRef,
169
+ children
170
+ }, value);
171
+ });
172
+ var TabsComponent = createStyledHOC(TabsFrame, function Tabs(props, forwardedRef) {
173
+ var { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", size = true, ...tabsProps } = props;
174
+ var { value, setValue, baseId, direction, triggersCount, registerTrigger, unregisterTrigger, tabsProps: headlessTabsProps } = useTabs({
175
+ value: valueProp,
176
+ onValueChange,
177
+ defaultValue,
178
+ orientation,
179
+ dir,
180
+ activationMode
181
+ });
182
+ return /* @__PURE__ */ jsx(SizeContext.Provider, {
183
+ size,
184
+ children: /* @__PURE__ */ jsx(TabsProvider, {
185
+ scope: __scopeTabs,
186
+ baseId,
187
+ value,
188
+ onChange: setValue,
189
+ orientation,
190
+ dir: direction,
191
+ activationMode,
192
+ size,
193
+ registerTrigger,
194
+ triggersCount,
195
+ unregisterTrigger,
196
+ children: /* @__PURE__ */ jsx(TabsFrame, {
197
+ direction,
198
+ ...headlessTabsProps,
199
+ ...tabsProps,
200
+ ref: forwardedRef
201
+ })
202
+ })
203
+ });
204
+ });
205
+ var Tabs2 = withStaticProperties(TabsComponent, {
206
+ Frame: TabsFrame,
207
+ List: TabsList,
208
+ Tab: TabsTab,
209
+ Content: TabsContent
210
+ });
211
+
212
+ export { Tabs2 as Tabs, TabsContent, TabsContentFrame, TabsFrame, TabsList, TabsListFrame, TabsTab, TabsTabFrame };
56
213
  //# sourceMappingURL=Tabs.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["styled","View","getButtonSized","SizableStack","ThemeableStack","TABS_NAME","DefaultTabsFrame","name","TRIGGER_NAME","DefaultTabsTabFrame","role","variants","size","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","DefaultTabsContentFrame"],"sources":["../../src/Tabs.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,EAAQC,IAAA,QAAY;AAC7B,SAASC,cAAA,QAAsB;AAC/B,SAASC,YAAA,EAAcC,cAAA,QAAsB;AAE7C,IAAAC,SAAM,SAAY;AACX,IAAAC,gBAAM,GAAAN,MAAmB,CAAAG,YAAO;EACrCI,IAAA,EAAMF;AACR,CAAC;AAED,IAAAG,YAAM,gBAAe;AAEd,IAAAC,mBAAM,GAAAT,MAAsB,CAAAC,IAAA;EACjCM,IAAA,EAAAC,YAAA;EACAE,IAAA;EAAAC,QACQ;IACNC,IAAA,EAAM;MAEN,SAAU,EAAAV;IAAA;IACFW,QACJ;MACFC,IAAA;QAEAC,aAAU;MAAA;IACF;IACWC,QACjB;MACFC,KAAA;QAEAC,WAAU;QACRC,eAAO;QAAAC,UACL,QAAa;QAAAC,cACb,UAAiB;QAAAC,UACjB,UAAY;QAAAC,QACZ,UAAgB;QAAAC,aAChB,EAAY;QAAAC,MACZ,WAAU;QAAAC,UACV;UACAP,eAAQ;QAAA;QAEIQ,iBACV;UACFC,YAAA;UAEAC,YAAA;UAAmBC,YACjB,SAAc;UAAAC,MACd;QAAc;MACA;IACN;EACV;EACFC,eACF;IACFhB,QAAA,EAAAiB,OAAA,CAAAC,GAAA,CAAAC,gBAAA;EAAA;AAEiB;EAC4BC,MAC7C;IACFC,WAAA;EACA;AAAA;AACU,IAAAC,YACN,GAAa;AAAA,IACfC,uBAAA,GAAAvC,MAAA,CAAAI,cAAA;EACFG,IAAA,EAAA+B;AACF;AAEA,SAEOC,uBAAM,EACXjC,gBAAM,EACPG,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Tabs.native.js","names":[],"sources":["esm/Tabs.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { composeRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { createStyledHOC, styled, View } from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { RovingFocusGroup } from \"@tamagui/roving-focus\";\nimport { SizeContext } from \"@tamagui/size\";\nimport { useTab, useTabContent, useTabs, useTabsList } from \"@tamagui/tabs-headless\";\nimport { useEvent } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { TabsProvider, useTabsContext } from \"./StyledContext\";\nvar TABS_CONTEXT = \"TabsContext\";\nvar TabsFrame = styled(View, {\n displayName: \"Tabs\",\n context: SizeContext\n});\nvar TabsListFrame = styled(View, {\n displayName: \"TabsList\",\n context: SizeContext,\n role: \"tablist\"\n});\nvar TabsTabFrame = styled(View, {\n displayName: \"TabsTrigger\",\n context: SizeContext,\n role: \"tab\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar TabsContentFrame = styled(View, {\n displayName: \"TabsContent\",\n context: SizeContext\n});\nvar TabsListDisabledContext = /* @__PURE__ */ React.createContext(false);\nvar TabsList = createStyledHOC(TabsListFrame, function TabsList2(props, forwardedRef) {\n var { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;\n var context = useTabsContext(__scopeTabs);\n var { listProps: headlessListProps } = useTabsList({\n orientation: context.orientation,\n disabled\n });\n return /* @__PURE__ */ _jsx(TabsListDisabledContext.Provider, {\n value: disabled,\n children: /* @__PURE__ */ _jsx(RovingFocusGroup, {\n __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,\n orientation: context.orientation,\n dir: context.dir,\n loop,\n asChild: true,\n children: /* @__PURE__ */ _jsx(TabsListFrame, {\n ...headlessListProps,\n flexDirection: context.orientation === \"vertical\" ? \"column\" : \"row\",\n ref: forwardedRef,\n ...listProps,\n children\n })\n })\n });\n});\nvar TabsTab = 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 = useTabsContext(__scopeTabs);\n var listDisabled = React.useContext(TabsListDisabledContext);\n var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : listDisabled;\n var { isSelected, tabProps } = 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 = 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 || !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__ */ _jsx(RovingFocusGroup.Item, {\n __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,\n asChild: true,\n tabIndex: disabled ? -1 : 0,\n active: isSelected,\n children: /* @__PURE__ */ _jsx(TabsTabFrame, {\n onLayout: isWeb ? onLayout : composeEventHandlers(onLayout, function(event) {\n setLayout(event.nativeEvent.layout);\n }),\n onMouseEnter: composeEventHandlers(onMouseEnter, function() {\n if (layout) {\n emitInteraction(\"hover\", layout);\n }\n }),\n onMouseLeave: 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: composeRefs(forwardedRef, triggerRef),\n onPress: composeEventHandlers(onPress !== null && onPress !== void 0 ? onPress : void 0, activateOnPress),\n ...isWeb && {\n onKeyDown: composeEventHandlers(onKeyDown, activateOnKeyDown),\n // emit the focus interaction before activating, matching the order\n // the indicator animations were built against\n onFocus: composeEventHandlers(onFocus, composeEventHandlers(function() {\n if (layout) {\n emitInteraction(\"focus\", layout);\n }\n }, activateOnFocus)),\n onBlur: composeEventHandlers(onBlur, function() {\n emitInteraction(\"focus\", null);\n })\n }\n })\n });\n});\nvar TabsContent = createStyledHOC(TabsContentFrame, function TabsContent2(props, forwardedRef) {\n var { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n var context = useTabsContext(__scopeTabs);\n var { shouldMount, contentProps: headlessContentProps } = 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__ */ _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 = 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 } = useTabs({\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation,\n dir,\n activationMode\n });\n return /* @__PURE__ */ _jsx(SizeContext.Provider, {\n size,\n children: /* @__PURE__ */ _jsx(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__ */ _jsx(TabsFrame, {\n direction,\n ...headlessTabsProps,\n ...tabsProps,\n ref: forwardedRef\n })\n })\n });\n});\nvar Tabs2 = withStaticProperties(TabsComponent, {\n Frame: TabsFrame,\n List: TabsList,\n Tab: TabsTab,\n Content: TabsContent\n});\nexport {\n Tabs2 as Tabs,\n TabsContent,\n TabsContentFrame,\n TabsFrame,\n TabsList,\n TabsListFrame,\n TabsTab,\n TabsTabFrame\n};\n//# sourceMappingURL=Tabs.js.map\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAI,eAAe;AACnB,IAAI,YAAY,OAAO,MAAM;CAC3B,aAAa;CACb,SAAS;AACX,CAAC;AACD,IAAI,gBAAgB,OAAO,MAAM;CAC/B,aAAa;CACb,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,WAAW,eAAe,cAAc,cAAc,cAAc,KAAK,iBAAiB,aAAa,OAAO,MAAM,GAAG,cAAc;CAC/J,IAAI,EAAE,OAAO,UAAU,QAAQ,WAAW,eAAe,iBAAiB,mBAAmB,WAAW,sBAAsB,QAAQ;EACpI,OAAO;EACP;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,oBAAK,YAAY,UAAU;EAChD;EACA,UAA0B,oBAAK,cAAc;GAC3C,OAAO;GACP;GACA;GACA,UAAU;GACV;GACA,KAAK;GACL;GACA;GACA;GACA;GACA;GACA,UAA0B,oBAAK,WAAW;IACxC;IACA,GAAG;IACH,GAAG;IACH,KAAK;GACP,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,QAAQ,qBAAqB,eAAe;CAC9C,OAAO;CACP,MAAM;CACN,KAAK;CACL,SAAS;AACX,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,11 +1,3 @@
1
- import { createTabs } from "./createTabs.mjs";
2
- import { DefaultTabsContentFrame, DefaultTabsFrame, DefaultTabsTabFrame } from "./Tabs.mjs";
3
- export * from "./createTabs.mjs";
4
- export * from "./StyledContext.mjs";
5
- const Tabs = createTabs({
6
- ContentFrame: DefaultTabsContentFrame,
7
- TabFrame: DefaultTabsTabFrame,
8
- TabsFrame: DefaultTabsFrame
9
- });
10
- export { Tabs };
11
- //# sourceMappingURL=index.js.map
1
+ export * from "./StyledContext.mjs"
2
+
3
+ export * from "./Tabs.mjs"
@@ -1,11 +1,3 @@
1
- import { createTabs } from "./createTabs.mjs";
2
- import { DefaultTabsContentFrame, DefaultTabsFrame, DefaultTabsTabFrame } from "./Tabs.mjs";
3
- export * from "./createTabs.mjs";
4
- export * from "./StyledContext.mjs";
5
- const Tabs = createTabs({
6
- ContentFrame: DefaultTabsContentFrame,
7
- TabFrame: DefaultTabsTabFrame,
8
- TabsFrame: DefaultTabsFrame
9
- });
10
- export { Tabs };
11
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./StyledContext.mjs"
2
+
3
+ export * from "./Tabs.mjs"
@@ -1,11 +1,3 @@
1
- import { createTabs } from "./createTabs.native.js";
2
- import { DefaultTabsContentFrame, DefaultTabsFrame, DefaultTabsTabFrame } from "./Tabs.native.js";
3
- export * from "./createTabs.native.js";
4
- export * from "./StyledContext.native.js";
5
- var Tabs = createTabs({
6
- ContentFrame: DefaultTabsContentFrame,
7
- TabFrame: DefaultTabsTabFrame,
8
- TabsFrame: DefaultTabsFrame
9
- });
10
- export { Tabs };
11
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./StyledContext.native.js"
2
+
3
+ export * from "./Tabs.native.js"
@@ -1,7 +1,6 @@
1
1
  import { createStyledContext } from "@tamagui/core";
2
- const {
3
- Provider: TabsProvider,
4
- useStyledContext: useTabsContext
5
- } = createStyledContext();
2
+
3
+ const { Provider: TabsProvider, useStyledContext: useTabsContext } = createStyledContext();
4
+
6
5
  export { TabsProvider, useTabsContext };
7
6
  //# sourceMappingURL=StyledContext.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStyledContext","Provider","TabsProvider","useStyledContext","useTabsContext"],"sources":["../../src/StyledContext.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAgB7B,MAAM;EAAEC,QAAA,EAAUC,YAAA;EAAcC,gBAAA,EAAkBC;AAAe,IACtEJ,mBAAA,CAAsC","ignoreList":[]}
1
+ {"version":3,"file":"StyledContext.js","names":[],"sources":["jsx/StyledContext.js"],"sourcesContent":["import { createStyledContext } from \"@tamagui/core\";\nconst { Provider: TabsProvider, useStyledContext: useTabsContext } = createStyledContext();\nexport {\n TabsProvider,\n useTabsContext\n};\n//# sourceMappingURL=StyledContext.js.map\n"],"mappings":";;;AACA,MAAM,EAAE,UAAU,cAAc,kBAAkB,mBAAmB,oBAAoB"}
@@ -0,0 +1,31 @@
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 __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var StyledContext_exports = {};
25
+ __export(StyledContext_exports, {
26
+ TabsProvider: () => TabsProvider,
27
+ useTabsContext: () => useTabsContext
28
+ });
29
+ module.exports = __toCommonJS(StyledContext_exports);
30
+ var import_core = require("@tamagui/core");
31
+ var { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();
@@ -1,36 +1,33 @@
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 __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
24
  var StyledContext_exports = {};
26
25
  __export(StyledContext_exports, {
27
- TabsProvider: () => TabsProvider,
28
- useTabsContext: () => useTabsContext
26
+ TabsProvider: () => TabsProvider,
27
+ useTabsContext: () => useTabsContext
29
28
  });
30
29
  module.exports = __toCommonJS(StyledContext_exports);
31
30
  var import_core = require("@tamagui/core");
32
- var {
33
- Provider: TabsProvider,
34
- useStyledContext: useTabsContext
35
- } = (0, import_core.createStyledContext)();
31
+ var { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();
32
+
36
33
  //# sourceMappingURL=StyledContext.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__defProp","Object","defineProperty"],"sources":["../../src/StyledContext.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AAgBF,IAAAA,SAAQ,GAAAC,MAAU,CAAAC,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"StyledContext.native.js","names":[],"sources":["jsx/StyledContext.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar StyledContext_exports = {};\n__export(StyledContext_exports, {\n TabsProvider: () => TabsProvider,\n useTabsContext: () => useTabsContext\n});\nmodule.exports = __toCommonJS(StyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();\n//# sourceMappingURL=StyledContext.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB;CAC9B,oBAAoB;CACpB,sBAAsB;AACxB,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,EAAE,UAAU,cAAc,kBAAkB,oBAAoB,GAAG,YAAY,qBAAqB"}