@tamagui/tabs 2.7.7 → 3.0.0-beta.1093.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 +15 -20
  2. package/dist/cjs/StyledContext.native.cjs +30 -0
  3. package/dist/cjs/StyledContext.native.js +16 -20
  4. package/dist/cjs/StyledContext.native.js.map +1 -1
  5. package/dist/cjs/Tabs.cjs +230 -68
  6. package/dist/cjs/Tabs.native.cjs +253 -0
  7. package/dist/cjs/Tabs.native.js +236 -67
  8. package/dist/cjs/Tabs.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +9 -27
  10. package/dist/cjs/index.native.cjs +21 -0
  11. package/dist/cjs/index.native.js +10 -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 +210 -55
  18. package/dist/esm/Tabs.mjs.map +1 -1
  19. package/dist/esm/Tabs.native.js +216 -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 +30 -0
  27. package/dist/jsx/StyledContext.native.js +16 -20
  28. package/dist/jsx/StyledContext.native.js.map +1 -1
  29. package/dist/jsx/Tabs.mjs +210 -55
  30. package/dist/jsx/Tabs.mjs.map +1 -1
  31. package/dist/jsx/Tabs.native.cjs +253 -0
  32. package/dist/jsx/Tabs.native.js +236 -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 +21 -0
  37. package/dist/jsx/index.native.js +10 -27
  38. package/dist/jsx/index.native.js.map +1 -1
  39. package/package.json +14 -18
  40. package/src/StyledContext.tsx +3 -3
  41. package/src/Tabs.tsx +379 -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
@@ -3,31 +3,26 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var StyledContext_exports = {};
24
22
  __export(StyledContext_exports, {
25
- TabsProvider: () => TabsProvider,
26
- useTabsContext: () => useTabsContext
23
+ TabsProvider: () => TabsProvider,
24
+ useTabsContext: () => useTabsContext
27
25
  });
28
26
  module.exports = __toCommonJS(StyledContext_exports);
29
27
  var import_core = require("@tamagui/core");
30
- const {
31
- Provider: TabsProvider,
32
- useStyledContext: useTabsContext
33
- } = (0, import_core.createStyledContext)();
28
+ const { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ 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;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var StyledContext_exports = {};
24
+ __export(StyledContext_exports, {
25
+ TabsProvider: () => TabsProvider,
26
+ useTabsContext: () => useTabsContext
27
+ });
28
+ module.exports = __toCommonJS(StyledContext_exports);
29
+ var import_core = require("@tamagui/core");
30
+ var { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();
@@ -5,32 +5,28 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  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;
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;
21
21
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var StyledContext_exports = {};
26
24
  __export(StyledContext_exports, {
27
- TabsProvider: () => TabsProvider,
28
- useTabsContext: () => useTabsContext
25
+ TabsProvider: () => TabsProvider,
26
+ useTabsContext: () => useTabsContext
29
27
  });
30
28
  module.exports = __toCommonJS(StyledContext_exports);
31
29
  var import_core = require("@tamagui/core");
32
- var {
33
- Provider: TabsProvider,
34
- useStyledContext: useTabsContext
35
- } = (0, import_core.createStyledContext)();
30
+ var { Provider: TabsProvider, useStyledContext: useTabsContext } = (0, import_core.createStyledContext)();
31
+
36
32
  //# sourceMappingURL=StyledContext.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","StyledContext_exports","__export","TabsProvider","useTabsContext","module","exports","import_core","require"],"sources":["../../src/StyledContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAV,YAAoC,CAAAK,qBAAA;AAgB7B,IAAAM,WAAQ,GAAUC,OAAA,gBAAc","ignoreList":[]}
1
+ {"version":3,"file":"StyledContext.native.js","names":[],"sources":["cjs/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,oBAAmB,CAAE"}
package/dist/cjs/Tabs.cjs CHANGED
@@ -1,83 +1,245 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
10
12
  };
11
13
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
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;
19
21
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
27
  var Tabs_exports = {};
24
28
  __export(Tabs_exports, {
25
- DefaultTabsContentFrame: () => DefaultTabsContentFrame,
26
- DefaultTabsFrame: () => DefaultTabsFrame,
27
- DefaultTabsTabFrame: () => DefaultTabsTabFrame
29
+ Tabs: () => Tabs2,
30
+ TabsContent: () => TabsContent,
31
+ TabsContentFrame: () => TabsContentFrame,
32
+ TabsFrame: () => TabsFrame,
33
+ TabsList: () => TabsList,
34
+ TabsListFrame: () => TabsListFrame,
35
+ TabsTab: () => TabsTab,
36
+ TabsTabFrame: () => TabsTabFrame
28
37
  });
29
38
  module.exports = __toCommonJS(Tabs_exports);
39
+ var import_compose_refs = require("@tamagui/compose-refs");
40
+ var import_constants = require("@tamagui/constants");
30
41
  var import_core = require("@tamagui/core");
31
- var import_get_button_sized = require("@tamagui/get-button-sized");
32
- var import_stacks = require("@tamagui/stacks");
33
- const TABS_NAME = "Tabs";
34
- const DefaultTabsFrame = (0, import_core.styled)(import_stacks.SizableStack, {
35
- name: TABS_NAME
42
+ var import_helpers = require("@tamagui/helpers");
43
+ var import_roving_focus = require("@tamagui/roving-focus");
44
+ var import_size = require("@tamagui/size");
45
+ var import_tabs_headless = require("@tamagui/tabs-headless");
46
+ var import_web = require("@tamagui/web");
47
+ var React = __toESM(require("react"), 1);
48
+ var import_StyledContext = require("./StyledContext.cjs");
49
+ var import_jsx_runtime = require("react/jsx-runtime");
50
+ const TABS_CONTEXT = "TabsContext";
51
+ const TabsFrame = (0, import_core.styled)(import_core.View, {
52
+ displayName: "Tabs",
53
+ context: import_size.SizeContext
36
54
  });
37
- const TRIGGER_NAME = "TabsTrigger";
38
- const DefaultTabsTabFrame = (0, import_core.styled)(import_core.View, {
39
- name: TRIGGER_NAME,
40
- role: "tab",
41
- variants: {
42
- size: {
43
- "...size": import_get_button_sized.getButtonSized
44
- },
45
- disabled: {
46
- true: {
47
- pointerEvents: "none"
48
- }
49
- },
50
- unstyled: {
51
- false: {
52
- borderWidth: 0,
53
- backgroundColor: "$background",
54
- userSelect: "none",
55
- justifyContent: "center",
56
- alignItems: "center",
57
- flexWrap: "nowrap",
58
- flexDirection: "row",
59
- cursor: "pointer",
60
- pressStyle: {
61
- backgroundColor: "$backgroundPress"
62
- },
63
- focusVisibleStyle: {
64
- outlineColor: "$outlineColor",
65
- outlineWidth: 2,
66
- outlineStyle: "solid",
67
- zIndex: 10
68
- }
69
- }
70
- }
71
- },
72
- defaultVariants: {
73
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
74
- }
75
- }, {
76
- accept: {
77
- activeStyle: "style"
78
- }
55
+ const TabsListFrame = (0, import_core.styled)(import_core.View, {
56
+ displayName: "TabsList",
57
+ context: import_size.SizeContext,
58
+ role: "tablist"
59
+ });
60
+ const TabsTabFrame = (0, import_core.styled)(import_core.View, {
61
+ displayName: "TabsTrigger",
62
+ context: import_size.SizeContext,
63
+ role: "tab",
64
+ variants: { disabled: { true: { pointerEvents: "none" } } }
65
+ });
66
+ const TabsContentFrame = (0, import_core.styled)(import_core.View, {
67
+ displayName: "TabsContent",
68
+ context: import_size.SizeContext
69
+ });
70
+ const TabsListDisabledContext = React.createContext(false);
71
+ const TabsList = (0, import_core.createStyledHOC)(TabsListFrame, function TabsList2(props, forwardedRef) {
72
+ const { __scopeTabs, loop = true, disabled = false, children, ...listProps } = props;
73
+ const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
74
+ const { listProps: headlessListProps } = (0, import_tabs_headless.useTabsList)({
75
+ orientation: context.orientation,
76
+ disabled
77
+ });
78
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListDisabledContext.Provider, {
79
+ value: disabled,
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
81
+ __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
82
+ orientation: context.orientation,
83
+ dir: context.dir,
84
+ loop,
85
+ asChild: true,
86
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsListFrame, {
87
+ ...headlessListProps,
88
+ flexDirection: context.orientation === "vertical" ? "column" : "row",
89
+ ref: forwardedRef,
90
+ ...listProps,
91
+ children
92
+ })
93
+ })
94
+ });
95
+ });
96
+ const TabsTab = (0, import_core.createStyledHOC)(TabsTabFrame, function TabsTab2(props, forwardedRef) {
97
+ const { __scopeTabs, value, disabled: disabledProp, onInteraction, activeStyle, activeTheme, onLayout, onMouseEnter, onMouseLeave, onPress, onKeyDown, onFocus, onBlur, ...triggerProps } = props;
98
+ const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
99
+ const listDisabled = React.useContext(TabsListDisabledContext);
100
+ const disabled = (disabledProp ?? listDisabled) === true;
101
+ const { isSelected, tabProps } = (0, import_tabs_headless.useTab)({
102
+ baseId: context.baseId,
103
+ value,
104
+ selectedValue: context.value,
105
+ disabled,
106
+ activationMode: context.activationMode,
107
+ onChange: context.onChange
108
+ });
109
+ const { onPress: activateOnPress, onKeyDown: activateOnKeyDown, onFocus: activateOnFocus, ...tabA11yProps } = tabProps;
110
+ const [layout, setLayout] = React.useState(null);
111
+ const triggerRef = React.useRef(null);
112
+ const emitInteraction = (0, import_web.useEvent)((type, layout2) => {
113
+ onInteraction?.(type, layout2);
114
+ });
115
+ React.useEffect(() => {
116
+ context.registerTrigger();
117
+ return () => context.unregisterTrigger();
118
+ }, []);
119
+ React.useEffect(() => {
120
+ if (!triggerRef.current || !import_constants.isWeb) return;
121
+ const element = triggerRef.current;
122
+ function updateTriggerSize() {
123
+ const next = {
124
+ width: element.offsetWidth,
125
+ height: element.offsetHeight,
126
+ x: element.offsetLeft,
127
+ y: element.offsetTop
128
+ };
129
+ setLayout((previous) => previous && previous.width === next.width && previous.height === next.height && previous.x === next.x && previous.y === next.y ? previous : next);
130
+ }
131
+ updateTriggerSize();
132
+ const observer = new ResizeObserver(updateTriggerSize);
133
+ observer.observe(element);
134
+ const offsetParent = element.offsetParent;
135
+ if (offsetParent) {
136
+ observer.observe(offsetParent);
137
+ }
138
+ return () => observer.disconnect();
139
+ }, [context.triggersCount]);
140
+ React.useEffect(() => {
141
+ if (isSelected && layout) {
142
+ emitInteraction("select", layout);
143
+ }
144
+ }, [
145
+ emitInteraction,
146
+ isSelected,
147
+ layout
148
+ ]);
149
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
150
+ __scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
151
+ asChild: true,
152
+ tabIndex: disabled ? -1 : 0,
153
+ active: isSelected,
154
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTabFrame, {
155
+ onLayout: import_constants.isWeb ? onLayout : (0, import_helpers.composeEventHandlers)(onLayout, (event) => {
156
+ setLayout(event.nativeEvent.layout);
157
+ }),
158
+ onMouseEnter: (0, import_helpers.composeEventHandlers)(onMouseEnter, () => {
159
+ if (layout) {
160
+ emitInteraction("hover", layout);
161
+ }
162
+ }),
163
+ onMouseLeave: (0, import_helpers.composeEventHandlers)(onMouseLeave, () => {
164
+ emitInteraction("hover", null);
165
+ }),
166
+ ...tabA11yProps,
167
+ theme: isSelected ? activeTheme ?? null : null,
168
+ size: context.size,
169
+ ...triggerProps,
170
+ style: [triggerProps.style, isSelected && activeStyle],
171
+ ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),
172
+ onPress: (0, import_helpers.composeEventHandlers)(onPress ?? void 0, activateOnPress),
173
+ ...import_constants.isWeb && {
174
+ onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, activateOnKeyDown),
175
+ onFocus: (0, import_helpers.composeEventHandlers)(onFocus, (0, import_helpers.composeEventHandlers)(() => {
176
+ if (layout) {
177
+ emitInteraction("focus", layout);
178
+ }
179
+ }, activateOnFocus)),
180
+ onBlur: (0, import_helpers.composeEventHandlers)(onBlur, () => {
181
+ emitInteraction("focus", null);
182
+ })
183
+ }
184
+ })
185
+ });
186
+ });
187
+ const TabsContent = (0, import_core.createStyledHOC)(TabsContentFrame, function TabsContent2(props, forwardedRef) {
188
+ const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
189
+ const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
190
+ const { shouldMount, contentProps: headlessContentProps } = (0, import_tabs_headless.useTabContent)({
191
+ baseId: context.baseId,
192
+ value,
193
+ selectedValue: context.value,
194
+ orientation: context.orientation,
195
+ forceMount
196
+ });
197
+ if (!shouldMount) {
198
+ return null;
199
+ }
200
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContentFrame, {
201
+ ...headlessContentProps,
202
+ ...contentProps,
203
+ ref: forwardedRef,
204
+ children
205
+ }, value);
206
+ });
207
+ const TabsComponent = (0, import_core.createStyledHOC)(TabsFrame, function Tabs(props, forwardedRef) {
208
+ const { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", size = true, ...tabsProps } = props;
209
+ const { value, setValue, baseId, direction, triggersCount, registerTrigger, unregisterTrigger, tabsProps: headlessTabsProps } = (0, import_tabs_headless.useTabs)({
210
+ value: valueProp,
211
+ onValueChange,
212
+ defaultValue,
213
+ orientation,
214
+ dir,
215
+ activationMode
216
+ });
217
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size.SizeContext.Provider, {
218
+ size,
219
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.TabsProvider, {
220
+ scope: __scopeTabs,
221
+ baseId,
222
+ value,
223
+ onChange: setValue,
224
+ orientation,
225
+ dir: direction,
226
+ activationMode,
227
+ size,
228
+ registerTrigger,
229
+ triggersCount,
230
+ unregisterTrigger,
231
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsFrame, {
232
+ direction,
233
+ ...headlessTabsProps,
234
+ ...tabsProps,
235
+ ref: forwardedRef
236
+ })
237
+ })
238
+ });
239
+ });
240
+ const Tabs2 = (0, import_helpers.withStaticProperties)(TabsComponent, {
241
+ Frame: TabsFrame,
242
+ List: TabsList,
243
+ Tab: TabsTab,
244
+ Content: TabsContent
79
245
  });
80
- const CONTENT_NAME = "TabsContent";
81
- const DefaultTabsContentFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
82
- name: CONTENT_NAME
83
- });