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