@seed-design/lynx-react 0.7.0 → 0.8.0

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 (245) hide show
  1. package/lib/components/Accordion/Accordion.jsx +2 -2
  2. package/lib/components/ActionButton/ActionButton.jsx +1 -1
  3. package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
  4. package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
  5. package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
  6. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
  7. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
  8. package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
  9. package/lib/components/AlertDialog/index.d.ts +3 -0
  10. package/lib/components/AlertDialog/index.d.ts.map +1 -0
  11. package/lib/components/AppBar/AppBar.d.ts +14 -1
  12. package/lib/components/AppBar/AppBar.d.ts.map +1 -1
  13. package/lib/components/AppBar/AppBar.jsx +46 -10
  14. package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
  15. package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
  16. package/lib/components/AppBar/index.d.ts +1 -1
  17. package/lib/components/AppBar/index.d.ts.map +1 -1
  18. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
  19. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
  20. package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
  21. package/lib/components/AttachmentDisplay/index.d.ts +2 -0
  22. package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
  23. package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
  24. package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
  25. package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
  26. package/lib/components/AttachmentInput/index.d.ts +2 -0
  27. package/lib/components/AttachmentInput/index.d.ts.map +1 -0
  28. package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
  29. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  30. package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
  31. package/lib/components/Callout/Callout.jsx +2 -2
  32. package/lib/components/Checkbox/Checkbox.jsx +2 -2
  33. package/lib/components/Chip/Chip.jsx +2 -2
  34. package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
  35. package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
  36. package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
  37. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
  38. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
  39. package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
  40. package/lib/components/ChipTabs/index.d.ts +3 -0
  41. package/lib/components/ChipTabs/index.d.ts.map +1 -0
  42. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
  43. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
  44. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
  45. package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
  46. package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
  47. package/lib/components/Dialog/Dialog.d.ts +87 -0
  48. package/lib/components/Dialog/Dialog.d.ts.map +1 -0
  49. package/lib/components/Dialog/Dialog.jsx +147 -0
  50. package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
  51. package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
  52. package/lib/components/Dialog/Dialog.namespace.js +18 -0
  53. package/lib/components/Dialog/index.d.ts +3 -0
  54. package/lib/components/Dialog/index.d.ts.map +1 -0
  55. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
  56. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
  57. package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
  58. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
  59. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
  60. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
  61. package/lib/components/FloatingActionButton/index.d.ts +3 -0
  62. package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
  63. package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
  64. package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
  65. package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
  66. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
  67. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
  68. package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
  69. package/lib/components/HelpBubble/index.d.ts +3 -0
  70. package/lib/components/HelpBubble/index.d.ts.map +1 -0
  71. package/lib/components/Icon/Icon.d.ts +1 -0
  72. package/lib/components/Icon/Icon.d.ts.map +1 -1
  73. package/lib/components/Icon/Icon.jsx +3 -2
  74. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
  75. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
  76. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
  77. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
  78. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
  79. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
  80. package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
  81. package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
  82. package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
  83. package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
  84. package/lib/components/InputButton/InputButton.d.ts +2 -0
  85. package/lib/components/InputButton/InputButton.d.ts.map +1 -1
  86. package/lib/components/InputButton/InputButton.jsx +40 -8
  87. package/lib/components/List/List.d.ts +1 -1
  88. package/lib/components/List/List.d.ts.map +1 -1
  89. package/lib/components/List/List.jsx +26 -12
  90. package/lib/components/Menu/Menu.d.ts.map +1 -1
  91. package/lib/components/Menu/Menu.jsx +15 -5
  92. package/lib/components/PageBanner/PageBanner.d.ts +3 -0
  93. package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
  94. package/lib/components/PageBanner/PageBanner.jsx +49 -11
  95. package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
  96. package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
  97. package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
  98. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
  99. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
  100. package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
  101. package/lib/components/QuantityPicker/index.d.ts +3 -0
  102. package/lib/components/QuantityPicker/index.d.ts.map +1 -0
  103. package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
  104. package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
  105. package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
  106. package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
  107. package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
  108. package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
  109. package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
  110. package/lib/components/ScrollFog/index.d.ts +2 -0
  111. package/lib/components/ScrollFog/index.d.ts.map +1 -0
  112. package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
  113. package/lib/components/Select/Select.d.ts +112 -0
  114. package/lib/components/Select/Select.d.ts.map +1 -0
  115. package/lib/components/Select/Select.jsx +885 -0
  116. package/lib/components/Select/Select.namespace.d.ts +2 -0
  117. package/lib/components/Select/Select.namespace.d.ts.map +1 -0
  118. package/lib/components/Select/Select.namespace.js +23 -0
  119. package/lib/components/Select/index.d.ts +3 -0
  120. package/lib/components/Select/index.d.ts.map +1 -0
  121. package/lib/components/Skeleton/Skeleton.d.ts +15 -0
  122. package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
  123. package/lib/components/Skeleton/Skeleton.jsx +18 -0
  124. package/lib/components/Skeleton/index.d.ts +2 -0
  125. package/lib/components/Skeleton/index.d.ts.map +1 -0
  126. package/lib/components/Slider/Slider.d.ts +101 -0
  127. package/lib/components/Slider/Slider.d.ts.map +1 -0
  128. package/lib/components/Slider/Slider.jsx +573 -0
  129. package/lib/components/Slider/Slider.namespace.d.ts +2 -0
  130. package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
  131. package/lib/components/Slider/Slider.namespace.js +19 -0
  132. package/lib/components/Slider/Slider.utils.d.ts +19 -0
  133. package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
  134. package/lib/components/Slider/Slider.utils.js +106 -0
  135. package/lib/components/Slider/index.d.ts +3 -0
  136. package/lib/components/Slider/index.d.ts.map +1 -0
  137. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
  138. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
  139. package/lib/components/Switch/Switch.d.ts.map +1 -1
  140. package/lib/components/Switch/Switch.jsx +5 -3
  141. package/lib/components/Tabs/Tabs.d.ts +34 -2
  142. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  143. package/lib/components/Tabs/Tabs.jsx +186 -56
  144. package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
  145. package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
  146. package/lib/components/Tabs/Tabs.utils.js +24 -3
  147. package/lib/components/Tabs/index.d.ts +1 -1
  148. package/lib/components/Tabs/index.d.ts.map +1 -1
  149. package/lib/components/index.d.ts +14 -0
  150. package/lib/components/index.d.ts.map +1 -1
  151. package/lib/hooks/useControllableState.d.ts +1 -14
  152. package/lib/hooks/useControllableState.d.ts.map +1 -1
  153. package/lib/hooks/usePressTap.d.ts +1 -27
  154. package/lib/hooks/usePressTap.d.ts.map +1 -1
  155. package/lib/hooks/useScaleFeedback.d.ts +1 -1
  156. package/lib/hooks/useScaleFeedback.js +1 -1
  157. package/lib/index.js +29 -6
  158. package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
  159. package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
  160. package/lib/types.d.ts +1 -0
  161. package/lib/types.d.ts.map +1 -1
  162. package/package.json +9 -5
  163. package/src/components/ActionButton/ActionButton.test.tsx +7 -7
  164. package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
  165. package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
  166. package/src/components/AlertDialog/AlertDialog.tsx +374 -0
  167. package/src/components/AlertDialog/index.ts +24 -0
  168. package/src/components/AppBar/AppBar.namespace.ts +1 -0
  169. package/src/components/AppBar/AppBar.test.tsx +257 -0
  170. package/src/components/AppBar/AppBar.tsx +109 -14
  171. package/src/components/AppBar/index.ts +1 -0
  172. package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
  173. package/src/components/AttachmentDisplay/index.ts +48 -0
  174. package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
  175. package/src/components/AttachmentInput/index.ts +49 -0
  176. package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
  177. package/src/components/BottomSheet/BottomSheet.tsx +1 -19
  178. package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
  179. package/src/components/ChipTabs/ChipTabs.tsx +119 -0
  180. package/src/components/ChipTabs/index.ts +16 -0
  181. package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
  182. package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
  183. package/src/components/ContextualFloatingButton/index.ts +4 -0
  184. package/src/components/Dialog/Dialog.namespace.ts +24 -0
  185. package/src/components/Dialog/Dialog.test.tsx +172 -0
  186. package/src/components/Dialog/Dialog.tsx +373 -0
  187. package/src/components/Dialog/index.ts +26 -0
  188. package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
  189. package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
  190. package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
  191. package/src/components/FloatingActionButton/index.ts +10 -0
  192. package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
  193. package/src/components/HelpBubble/HelpBubble.tsx +998 -0
  194. package/src/components/HelpBubble/index.ts +26 -0
  195. package/src/components/Icon/Icon.test.tsx +57 -5
  196. package/src/components/Icon/Icon.tsx +16 -2
  197. package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
  198. package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
  199. package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
  200. package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
  201. package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
  202. package/src/components/IdentityPlaceholder/index.ts +8 -0
  203. package/src/components/InputButton/InputButton.test.tsx +128 -1
  204. package/src/components/InputButton/InputButton.tsx +60 -9
  205. package/src/components/List/List.test.tsx +54 -2
  206. package/src/components/List/List.tsx +43 -10
  207. package/src/components/Menu/Menu.tsx +14 -4
  208. package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
  209. package/src/components/PageBanner/PageBanner.test.tsx +110 -3
  210. package/src/components/PageBanner/PageBanner.tsx +83 -19
  211. package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
  212. package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
  213. package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
  214. package/src/components/QuantityPicker/index.ts +14 -0
  215. package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
  216. package/src/components/ReactionButton/ReactionButton.test.tsx +6 -4
  217. package/src/components/ReactionButton/ReactionButton.tsx +20 -12
  218. package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
  219. package/src/components/ScrollFog/ScrollFog.tsx +172 -0
  220. package/src/components/ScrollFog/index.ts +1 -0
  221. package/src/components/Select/Select.namespace.ts +34 -0
  222. package/src/components/Select/Select.test.tsx +297 -0
  223. package/src/components/Select/Select.tsx +1483 -0
  224. package/src/components/Select/index.ts +39 -0
  225. package/src/components/Skeleton/Skeleton.test.tsx +64 -0
  226. package/src/components/Skeleton/Skeleton.tsx +45 -0
  227. package/src/components/Skeleton/index.ts +1 -0
  228. package/src/components/Slider/Slider.namespace.ts +26 -0
  229. package/src/components/Slider/Slider.test.tsx +260 -0
  230. package/src/components/Slider/Slider.tsx +897 -0
  231. package/src/components/Slider/Slider.utils.ts +167 -0
  232. package/src/components/Slider/index.ts +30 -0
  233. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
  234. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
  235. package/src/components/Switch/Switch.tsx +14 -13
  236. package/src/components/Tabs/Tabs.test.tsx +218 -1
  237. package/src/components/Tabs/Tabs.tsx +346 -75
  238. package/src/components/Tabs/Tabs.utils.ts +51 -1
  239. package/src/components/Tabs/index.ts +17 -1
  240. package/src/components/index.ts +14 -0
  241. package/src/hooks/useControllableState.ts +1 -43
  242. package/src/hooks/usePressTap.test.ts +23 -11
  243. package/src/hooks/usePressTap.ts +1 -60
  244. package/src/hooks/useScaleFeedback.ts +1 -1
  245. package/src/types.ts +1 -0
@@ -1,15 +1,29 @@
1
- import { useControllableState } from "../../hooks/useControllableState.js";
2
- import { usePressTap } from "../../hooks/usePressTap.js";
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
3
3
  import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
4
4
  import { mergeProps } from "../../utils/merge-props.js";
5
5
  import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
6
6
  import { Box } from "../Box/Box.jsx";
7
- import { areTabsTransitionsEnabled, getTabsLayoutWidth, getTabsOrderedItems, getTabsTriggerRects } from "./Tabs.utils.js";
7
+ import { HStack } from "../Stack/Stack.jsx";
8
+ import { areTabsTransitionsEnabled, getTabsLayoutWidth, getTabsOrderedItems, getTabsScrollOffset, getTabsTriggerRects } from "./Tabs.utils.js";
8
9
  import * as React from "@lynx-js/react";
10
+ import { runOnMainThread } from "@lynx-js/react";
9
11
  import clsx from "clsx";
10
12
  import { tabs } from "@seed-design/lynx-css/recipes/tabs";
11
13
  //#region src/components/Tabs/Tabs.tsx
12
- var { ClassNamesProvider, useClassNames } = createSlotRecipeContext(tabs);
14
+ function getTabsContentInsets(contentRef) {
15
+ "main thread";
16
+ const content = contentRef.current;
17
+ if (!content || typeof content.getComputedStyleProperty !== "function") return null;
18
+ const start = Number.parseFloat(content.getComputedStyleProperty("padding-left"));
19
+ const end = Number.parseFloat(content.getComputedStyleProperty("padding-right"));
20
+ if (!Number.isFinite(start) || !Number.isFinite(end) || start < 0 || end < 0) return null;
21
+ return {
22
+ start,
23
+ end
24
+ };
25
+ }
26
+ var { ClassNamesProvider } = createSlotRecipeContext(tabs);
13
27
  function invokeSelectTab(pager, index, smooth) {
14
28
  "background only";
15
29
  if (!pager || index < 0) return;
@@ -52,9 +66,8 @@ function useTabsCarouselContext(consumer) {
52
66
  if (!context) throw new Error(`<${consumer}/> must be rendered inside <TabsCarousel/>.`);
53
67
  return context;
54
68
  }
55
- var TabsRoot = React.forwardRef((props, ref) => {
56
- const [variantProps, otherProps] = tabs.splitVariantProps(props);
57
- const { children, className, style, value: valueProp, defaultValue, onValueChange, ...nativeProps } = otherProps;
69
+ var TabsRootPrimitive = React.forwardRef((props, ref) => {
70
+ const { recipe, inlineNotification = false, children, className, style, value: valueProp, defaultValue, onValueChange, ...nativeProps } = props;
58
71
  const [value, setValueInternal] = useControllableState({
59
72
  value: valueProp,
60
73
  defaultValue,
@@ -67,24 +80,20 @@ var TabsRoot = React.forwardRef((props, ref) => {
67
80
  const [contentValues, setContentValues] = React.useState([]);
68
81
  const [indicatorValue, setIndicatorValue] = React.useState();
69
82
  const [triggerWidths, setTriggerWidths] = React.useState({});
70
- const listRef = React.useRef(null);
71
83
  const pagerRef = React.useRef(null);
72
84
  const indicatorRef = React.useMainThreadRef(null);
73
85
  const pagerValues = React.useMemo(() => contentValues.filter((contentValue) => !items.find((item) => item.value === contentValue)?.disabled), [contentValues, items]);
74
- const triggerRects = React.useMemo(() => getTabsTriggerRects(items.map((item) => item.value), triggerWidths), [items, triggerWidths]);
86
+ const triggerRects = React.useMemo(() => getTabsTriggerRects(items.map((item) => item.value), triggerWidths, recipe.triggerGap), [
87
+ items,
88
+ recipe.triggerGap,
89
+ triggerWidths
90
+ ]);
75
91
  const transitionsEnabled = areTabsTransitionsEnabled(items.map((item) => item.value), triggerRects);
76
- const classNames = tabs({
77
- ...variantProps,
78
- transitionEnabled: transitionsEnabled
79
- });
92
+ const getClassNames = recipe.getClassNames;
93
+ const classNames = getClassNames({ transitionEnabled: transitionsEnabled });
80
94
  const visualValue = indicatorValue ?? value;
81
95
  const indicatorIndex = items.findIndex((item) => item.value === visualValue);
82
96
  const selectedPagerIndex = value === void 0 ? -1 : pagerValues.indexOf(value);
83
- const selectedOffset = (value === void 0 ? void 0 : triggerRects[value])?.left ?? null;
84
- const setListNode = React.useCallback((node) => {
85
- listRef.current = node;
86
- if (node && selectedOffset !== null) invokeScrollToOffset(node, selectedOffset);
87
- }, [selectedOffset]);
88
97
  const setPagerNode = React.useCallback((node) => {
89
98
  pagerRef.current = node;
90
99
  if (node && selectedPagerIndex >= 0) invokeSelectTab(node, selectedPagerIndex, false);
@@ -148,12 +157,14 @@ var TabsRoot = React.forwardRef((props, ref) => {
148
157
  React.useEffect(() => {
149
158
  "background only";
150
159
  if (selectedPagerIndex >= 0) invokeSelectTab(pagerRef.current, selectedPagerIndex, false);
151
- if (selectedOffset !== null) invokeScrollToOffset(listRef.current, selectedOffset);
152
- }, [selectedPagerIndex, selectedOffset]);
160
+ }, [selectedPagerIndex]);
153
161
  const contextValue = React.useMemo(() => ({
154
162
  value,
155
163
  visualValue,
156
- variantProps,
164
+ classNames,
165
+ getClassNames,
166
+ getIndicatorClassName: recipe.getIndicatorClassName,
167
+ inlineNotification,
157
168
  items,
158
169
  pagerValues,
159
170
  indicatorIndex,
@@ -166,7 +177,6 @@ var TabsRoot = React.forwardRef((props, ref) => {
166
177
  updateTriggerDisabled,
167
178
  syncTriggerOrder,
168
179
  updateTriggerWidth,
169
- setListRef: setListNode,
170
180
  setPagerRef: setPagerNode,
171
181
  selectValue,
172
182
  handlePagerWillChange,
@@ -174,7 +184,10 @@ var TabsRoot = React.forwardRef((props, ref) => {
174
184
  }), [
175
185
  value,
176
186
  visualValue,
177
- variantProps,
187
+ classNames,
188
+ getClassNames,
189
+ recipe.getIndicatorClassName,
190
+ inlineNotification,
178
191
  items,
179
192
  pagerValues,
180
193
  indicatorIndex,
@@ -187,20 +200,36 @@ var TabsRoot = React.forwardRef((props, ref) => {
187
200
  updateTriggerDisabled,
188
201
  syncTriggerOrder,
189
202
  updateTriggerWidth,
190
- setListNode,
191
203
  setPagerNode,
192
204
  selectValue,
193
205
  handlePagerWillChange,
194
206
  handlePagerChange
195
207
  ]);
196
208
  return <TabsContext.Provider value={contextValue}>
197
- <ClassNamesProvider value={classNames}>
198
- <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.root, className)} style={style}>
199
- {children}
200
- </view>
201
- </ClassNamesProvider>
209
+ <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.root, className)} style={style}>
210
+ {children}
211
+ </view>
202
212
  </TabsContext.Provider>;
203
213
  });
214
+ TabsRootPrimitive.displayName = "TabsRootPrimitive";
215
+ var TabsRoot = React.forwardRef((props, ref) => {
216
+ const [variantProps, rootProps] = tabs.splitVariantProps(props);
217
+ const getClassNames = React.useCallback((state = {}) => tabs({
218
+ ...variantProps,
219
+ selected: state.selected,
220
+ disabled: state.disabled,
221
+ inCarousel: state.inCarousel,
222
+ transitionEnabled: state.transitionEnabled
223
+ }), [variantProps]);
224
+ const recipe = React.useMemo(() => ({
225
+ getClassNames,
226
+ getIndicatorClassName: (state) => getClassNames(state).indicator,
227
+ triggerGap: 0
228
+ }), [getClassNames]);
229
+ return <ClassNamesProvider value={getClassNames()}>
230
+ <TabsRootPrimitive {...rootProps} ref={ref} recipe={recipe} />
231
+ </ClassNamesProvider>;
232
+ });
204
233
  TabsRoot.displayName = "TabsRoot";
205
234
  function getTabsTriggerValues(children) {
206
235
  const values = [];
@@ -220,10 +249,21 @@ function getTabsTriggerValues(children) {
220
249
  return values;
221
250
  }
222
251
  var TabsList = React.forwardRef((props, ref) => {
223
- const { children, className, style, ...nativeProps } = props;
224
- const classNames = useClassNames();
225
- const { items, setListRef, syncTriggerOrder } = useTabsContext("TabsList");
252
+ const { children, className, style, scrollAlign = "start", ...nativeProps } = props;
253
+ const { classNames, items, syncTriggerOrder, triggerRects, value } = useTabsContext("TabsList");
254
+ const scrollRef = React.useRef(null);
255
+ const contentRef = React.useMainThreadRef(null);
256
+ const metricsRef = React.useRef({
257
+ currentOffset: 0,
258
+ viewportWidth: null,
259
+ contentWidth: null,
260
+ insets: null
261
+ });
262
+ const contentInsetRequestRef = React.useRef(0);
263
+ const selectedValueRef = React.useRef(value);
264
+ const [geometryRevision, setGeometryRevision] = React.useState(0);
226
265
  const triggerOrder = React.useMemo(() => getTabsTriggerValues(children), [children]);
266
+ selectedValueRef.current = value;
227
267
  React.useEffect(() => {
228
268
  "background only";
229
269
  syncTriggerOrder(triggerOrder);
@@ -232,9 +272,84 @@ var TabsList = React.forwardRef((props, ref) => {
232
272
  syncTriggerOrder,
233
273
  triggerOrder
234
274
  ]);
235
- const mergedRef = React.useMemo(() => mergeProps({ ref: setListRef }, { ref }).ref, [ref, setListRef]);
236
- return <scroll-view {...mergeProps({ ref: mergedRef }, nativeProps)} scroll-orientation="horizontal" scroll-bar-enable={false} accessibility-element={false} accessibility-traits="tabbar" className={clsx(classNames.list, className)} style={style}>
237
- <view className={classNames.listContent}>{children}</view>
275
+ const requestContentInsets = React.useCallback(() => {
276
+ "background only";
277
+ const request = ++contentInsetRequestRef.current;
278
+ metricsRef.current.insets = null;
279
+ runOnMainThread(getTabsContentInsets)(contentRef).then((insets) => {
280
+ "background only";
281
+ if (request !== contentInsetRequestRef.current || !insets) return;
282
+ metricsRef.current.insets = insets;
283
+ setGeometryRevision((revision) => revision + 1);
284
+ }, () => {});
285
+ }, [contentRef]);
286
+ const handleListLayoutChange = React.useCallback((event) => {
287
+ "background only";
288
+ const width = getTabsLayoutWidth(event);
289
+ if (width !== null && width > 0 && metricsRef.current.viewportWidth !== width) {
290
+ metricsRef.current.viewportWidth = width;
291
+ setGeometryRevision((revision) => revision + 1);
292
+ }
293
+ }, []);
294
+ const handleContentLayoutChange = React.useCallback((event) => {
295
+ "background only";
296
+ const width = getTabsLayoutWidth(event);
297
+ if (width !== null && width > 0 && metricsRef.current.contentWidth !== width) {
298
+ metricsRef.current.contentWidth = width;
299
+ setGeometryRevision((revision) => revision + 1);
300
+ }
301
+ requestContentInsets();
302
+ }, [requestContentInsets]);
303
+ const updateScrollMetrics = React.useCallback((scrollLeft, scrollWidth) => {
304
+ "background only";
305
+ if (Number.isFinite(scrollLeft)) metricsRef.current.currentOffset = Math.max(0, scrollLeft);
306
+ if (Number.isFinite(scrollWidth) && scrollWidth > 0 && metricsRef.current.contentWidth !== scrollWidth) {
307
+ metricsRef.current.contentWidth = scrollWidth;
308
+ requestContentInsets();
309
+ setGeometryRevision((revision) => revision + 1);
310
+ }
311
+ }, [requestContentInsets]);
312
+ const handleScroll = React.useCallback((event) => {
313
+ "background only";
314
+ updateScrollMetrics(event.detail.scrollLeft, event.detail.scrollWidth);
315
+ }, [updateScrollMetrics]);
316
+ const handleContentSizeChanged = React.useCallback((event) => {
317
+ "background only";
318
+ updateScrollMetrics(event.detail.scrollLeft, event.detail.scrollWidth);
319
+ }, [updateScrollMetrics]);
320
+ React.useEffect(() => {
321
+ "background only";
322
+ const selectedRect = value === void 0 ? void 0 : triggerRects[value];
323
+ const { currentOffset, viewportWidth, contentWidth, insets } = metricsRef.current;
324
+ if (!scrollRef.current || value === void 0 || !selectedRect || viewportWidth === null || contentWidth === null || insets === null) return;
325
+ const targetOffset = getTabsScrollOffset({
326
+ scrollAlign,
327
+ currentOffset,
328
+ viewportWidth,
329
+ contentWidth,
330
+ contentInsetStart: insets.start,
331
+ contentInsetEnd: insets.end,
332
+ triggerRect: selectedRect
333
+ });
334
+ if (selectedValueRef.current !== value || targetOffset === currentOffset) return;
335
+ invokeScrollToOffset(scrollRef.current, targetOffset);
336
+ }, [
337
+ geometryRevision,
338
+ items,
339
+ scrollAlign,
340
+ triggerRects,
341
+ value
342
+ ]);
343
+ const mergedRef = React.useMemo(() => mergeProps({ ref: scrollRef }, { ref }).ref, [ref]);
344
+ return <scroll-view {...mergeProps({
345
+ ref: mergedRef,
346
+ bindlayoutchange: handleListLayoutChange,
347
+ bindscroll: handleScroll,
348
+ bindcontentsizechanged: handleContentSizeChanged
349
+ }, nativeProps)} scroll-orientation="horizontal" scroll-bar-enable={false} accessibility-element={false} accessibility-traits="tabbar" className={clsx(classNames.list, className)} style={style}>
350
+ <view className={classNames.listContent} main-thread:ref={contentRef} bindlayoutchange={handleContentLayoutChange}>
351
+ {children}
352
+ </view>
238
353
  </scroll-view>;
239
354
  });
240
355
  TabsList.displayName = "TabsList";
@@ -255,7 +370,7 @@ var TabsTrigger = React.forwardRef((props, ref) => {
255
370
  triggerValue,
256
371
  disabled
257
372
  ]);
258
- const { pressed: _pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
373
+ const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
259
374
  disabled,
260
375
  onTap: React.useCallback((...args) => {
261
376
  "background only";
@@ -278,25 +393,29 @@ var TabsTrigger = React.forwardRef((props, ref) => {
278
393
  const width = getTabsLayoutWidth(args[0]);
279
394
  if (width !== null) context.updateTriggerWidth(triggerValue, width);
280
395
  }, [context.updateTriggerWidth, triggerValue]);
281
- const triggerClasses = tabs({
282
- ...context.variantProps,
396
+ const triggerClasses = context.getClassNames({
283
397
  selected: visuallySelected,
284
398
  disabled,
399
+ pressed,
285
400
  transitionEnabled: context.transitionsEnabled
286
401
  });
287
402
  const label = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
288
403
  return <view {...mergeProps({ bindlayoutchange: handleLayoutChange }, ref ? { ref } : {}, pressHandlers, scaleFeedbackTargetProps, scaleFeedbackTriggerProps, nativeProps)} flatten={false} accessibility-element={true} accessibility-role-description="tab" accessibility-label={accessibilityLabel ?? label} accessibility-value={selected ? "selected" : "not selected"} accessibility-traits={disabled ? "disabled" : selected ? "selected" : "button"} className={clsx(triggerClasses.trigger, className)} style={style}>
289
- {notification ? <Box position="relative">
290
- <text className={triggerClasses.triggerLabel}>{children}</text>
291
- {notification}
292
- </Box> : <text className={triggerClasses.triggerLabel}>{children}</text>}
404
+ {notification ? context.inlineNotification ? <HStack position="relative" gap="x1_5">
405
+ <text className={triggerClasses.triggerLabel}>{children}</text>
406
+ <view accessibility-elements-hidden={true}>{notification}</view>
407
+ </HStack> : <Box position="relative">
408
+ <text className={triggerClasses.triggerLabel}>{children}</text>
409
+ {notification}
410
+ </Box> : <text className={triggerClasses.triggerLabel}>{children}</text>}
293
411
  </view>;
294
412
  });
295
413
  TabsTrigger.displayName = "TabsTrigger";
296
414
  var TabsIndicator = React.forwardRef((props, ref) => {
297
415
  const { className, style, ...nativeProps } = props;
298
- const classNames = useClassNames();
299
- const { indicatorRef, items, indicatorIndex, triggerRects } = useTabsContext("TabsIndicator");
416
+ const { indicatorRef, items, indicatorIndex, triggerRects, getIndicatorClassName, transitionsEnabled } = useTabsContext("TabsIndicator");
417
+ if (!getIndicatorClassName) throw new Error("<TabsIndicator/> is only supported inside <TabsRoot/>.");
418
+ const indicatorClassName = getIndicatorClassName({ transitionEnabled: transitionsEnabled });
300
419
  const position = indicatorIndex;
301
420
  const lowerIndex = Math.max(0, Math.floor(position));
302
421
  const upperIndex = Math.min(items.length - 1, Math.ceil(position));
@@ -305,7 +424,7 @@ var TabsIndicator = React.forwardRef((props, ref) => {
305
424
  const upperRect = triggerRects[items[upperIndex]?.value ?? ""] ?? lowerRect;
306
425
  const x = lowerRect ? lowerRect.left + ((upperRect?.left ?? lowerRect.left) - lowerRect.left) * progress : 0;
307
426
  const width = lowerRect ? lowerRect.width + ((upperRect?.width ?? lowerRect.width) - lowerRect.width) * progress : 0;
308
- return <view {...mergeProps({ "main-thread:ref": indicatorRef }, ref ? { ref } : {}, nativeProps)} accessibility-elements-hidden={true} className={clsx(classNames.indicator, className)} style={{
427
+ return <view {...mergeProps({ "main-thread:ref": indicatorRef }, ref ? { ref } : {}, nativeProps)} accessibility-elements-hidden={true} className={clsx(indicatorClassName, className)} style={{
309
428
  "--tabs-indicator-x": `${x}px`,
310
429
  "--tabs-indicator-width": `${width}px`,
311
430
  ...style
@@ -318,8 +437,7 @@ var TabsContent = React.forwardRef((props, ref) => {
318
437
  const inCarousel = useTabsCarouselCameraContext();
319
438
  const selected = tabsContext.value === contentValue;
320
439
  const disabled = tabsContext.items.find((item) => item.value === contentValue)?.disabled ?? false;
321
- const contentClasses = tabs({
322
- ...tabsContext.variantProps,
440
+ const contentClasses = tabsContext.getClassNames({
323
441
  selected,
324
442
  inCarousel
325
443
  });
@@ -343,7 +461,7 @@ var TabsContent = React.forwardRef((props, ref) => {
343
461
  TabsContent.displayName = "TabsContent";
344
462
  var TabsCarousel = React.forwardRef((props, ref) => {
345
463
  const { children, className, style, swipeable = false, iosBackGestureEdgeWidth = 32, onSettle, onSwipeStart, onSwipeEnd, ...nativeProps } = props;
346
- const classNames = useClassNames();
464
+ const { classNames } = useTabsContext("TabsCarousel");
347
465
  const contextValue = React.useMemo(() => ({
348
466
  swipeable,
349
467
  iosBackGestureEdgeWidth,
@@ -366,19 +484,33 @@ var TabsCarousel = React.forwardRef((props, ref) => {
366
484
  TabsCarousel.displayName = "TabsCarousel";
367
485
  var TabsCarouselCamera = React.forwardRef((props, ref) => {
368
486
  const { children, className, style, bindchange, bindwillchange, bindoffsetchange, ...nativeProps } = props;
369
- const classNames = useClassNames();
370
487
  const tabsContext = useTabsContext("TabsCarouselCamera");
488
+ const { classNames } = tabsContext;
371
489
  const carouselContext = useTabsCarouselContext("TabsCarouselCamera");
372
490
  const swipingRef = React.useRef(false);
373
491
  const { indicatorRef, pagerValues, triggerRects } = tabsContext;
374
492
  const indicatorRects = pagerValues.map((value) => triggerRects[value] ?? null);
375
493
  const mergedRef = React.useMemo(() => mergeProps({ ref: tabsContext.setPagerRef }, { ref }).ref, [ref, tabsContext.setPagerRef]);
494
+ const finishSwipe = React.useCallback(() => {
495
+ "background only";
496
+ if (!swipingRef.current) return;
497
+ swipingRef.current = false;
498
+ carouselContext.onSwipeEnd?.();
499
+ }, [carouselContext.onSwipeEnd]);
500
+ const handleTouchEnd = React.useCallback(() => {
501
+ "background only";
502
+ finishSwipe();
503
+ }, [finishSwipe]);
504
+ const handleTouchCancel = React.useCallback(() => {
505
+ "background only";
506
+ finishSwipe();
507
+ }, [finishSwipe]);
376
508
  const handleWillChange = React.useCallback((event) => {
377
509
  "background only";
378
510
  bindwillchange?.(event);
379
511
  if (event.detail.isDragged) {
380
512
  tabsContext.handlePagerWillChange(event.detail.index);
381
- if (!swipingRef.current) {
513
+ if (carouselContext.swipeable && !swipingRef.current) {
382
514
  swipingRef.current = true;
383
515
  carouselContext.onSwipeStart?.();
384
516
  }
@@ -386,6 +518,7 @@ var TabsCarouselCamera = React.forwardRef((props, ref) => {
386
518
  }, [
387
519
  bindwillchange,
388
520
  carouselContext.onSwipeStart,
521
+ carouselContext.swipeable,
389
522
  tabsContext.handlePagerWillChange
390
523
  ]);
391
524
  const handleChange = React.useCallback((event) => {
@@ -393,14 +526,9 @@ var TabsCarouselCamera = React.forwardRef((props, ref) => {
393
526
  bindchange?.(event);
394
527
  tabsContext.handlePagerChange(event.detail.index);
395
528
  carouselContext.onSettle?.();
396
- if (swipingRef.current || event.detail.isDragged) {
397
- swipingRef.current = false;
398
- carouselContext.onSwipeEnd?.();
399
- }
400
529
  }, [
401
530
  bindchange,
402
531
  carouselContext.onSettle,
403
- carouselContext.onSwipeEnd,
404
532
  tabsContext.handlePagerChange
405
533
  ]);
406
534
  const handleOffsetChange = React.useCallback((event) => {
@@ -426,6 +554,8 @@ var TabsCarouselCamera = React.forwardRef((props, ref) => {
426
554
  }
427
555
  return <viewpager {...mergeProps({
428
556
  ref: mergedRef,
557
+ bindtouchend: handleTouchEnd,
558
+ bindtouchcancel: handleTouchCancel,
429
559
  bindwillchange: handleWillChange,
430
560
  bindchange: handleChange,
431
561
  bindoffsetchange: handleOffsetChange,
@@ -438,4 +568,4 @@ var TabsCarouselCamera = React.forwardRef((props, ref) => {
438
568
  });
439
569
  TabsCarouselCamera.displayName = "TabsCarouselCamera";
440
570
  //#endregion
441
- export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger };
571
+ export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsRootPrimitive, TabsTrigger };
@@ -14,6 +14,19 @@ export declare function getTabsLayoutWidth(event: TabsLayoutChangeEvent): number
14
14
  export declare function getTabsOrderedItems<T extends {
15
15
  value: string;
16
16
  }>(items: T[], values: string[]): T[];
17
- export declare function getTabsTriggerRects(values: string[], widths: Record<string, number>): Record<string, TabsLayoutRect>;
17
+ export declare function getTabsTriggerRects(values: string[], widths: Record<string, number>, triggerGap?: number): Record<string, TabsLayoutRect>;
18
+ /**
19
+ * Trigger rectangles begin at the first trigger, so they exclude list-content
20
+ * padding. Scroll offsets are measured from the scroll content edge.
21
+ */
22
+ export declare function getTabsScrollOffset({ scrollAlign, currentOffset, viewportWidth, contentWidth, contentInsetStart, contentInsetEnd, triggerRect, }: {
23
+ scrollAlign: "nearest" | "start" | "center" | "end";
24
+ currentOffset: number;
25
+ viewportWidth: number;
26
+ contentWidth: number;
27
+ contentInsetStart: number;
28
+ contentInsetEnd: number;
29
+ triggerRect: TabsLayoutRect;
30
+ }): number;
18
31
  export declare function areTabsTransitionsEnabled(values: string[], rects: Record<string, TabsLayoutRect>): boolean;
19
32
  //# sourceMappingURL=Tabs.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.utils.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.utils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAI9E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC7D,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,EAAE,MAAM,EAAE,GACf,CAAC,EAAE,CAUL;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAiBhC;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC,OAAO,CAET"}
1
+ {"version":3,"file":"Tabs.utils.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.utils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAI9E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC7D,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,EAAE,MAAM,EAAE,GACf,CAAC,EAAE,CAUL;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,UAAU,SAAI,GACb,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAiBhC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,cAAc,CAAC;CAC7B,GAAG,MAAM,CA2BT;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC,OAAO,CAET"}
@@ -15,7 +15,7 @@ function getTabsOrderedItems(items, values) {
15
15
  ordered.push(...itemsByValue.values());
16
16
  return ordered;
17
17
  }
18
- function getTabsTriggerRects(values, widths) {
18
+ function getTabsTriggerRects(values, widths, triggerGap = 0) {
19
19
  const rects = Object.create(null);
20
20
  let left = 0;
21
21
  let hasCompletePrefix = true;
@@ -29,12 +29,33 @@ function getTabsTriggerRects(values, widths) {
29
29
  left,
30
30
  width
31
31
  };
32
- left += width;
32
+ left += width + triggerGap;
33
33
  }
34
34
  return rects;
35
35
  }
36
+ /**
37
+ * Trigger rectangles begin at the first trigger, so they exclude list-content
38
+ * padding. Scroll offsets are measured from the scroll content edge.
39
+ */
40
+ function getTabsScrollOffset({ scrollAlign, currentOffset, viewportWidth, contentWidth, contentInsetStart, contentInsetEnd, triggerRect }) {
41
+ const maxOffset = Math.max(0, contentWidth - viewportWidth);
42
+ const clampOffset = (offset) => Math.min(maxOffset, Math.max(0, offset));
43
+ const clampedCurrentOffset = clampOffset(currentOffset);
44
+ if (maxOffset === 0) return clampedCurrentOffset;
45
+ const triggerStart = contentInsetStart + triggerRect.left;
46
+ const triggerEnd = triggerStart + triggerRect.width;
47
+ if (scrollAlign === "nearest") {
48
+ const visibleStart = clampedCurrentOffset;
49
+ const visibleEnd = clampedCurrentOffset + viewportWidth;
50
+ if (triggerStart >= visibleStart && triggerEnd <= visibleEnd) return clampedCurrentOffset;
51
+ return clampOffset(triggerStart < visibleStart ? triggerStart - contentInsetStart : triggerEnd + contentInsetEnd - viewportWidth);
52
+ }
53
+ if (scrollAlign === "start") return clampOffset(triggerStart - contentInsetStart);
54
+ if (scrollAlign === "center") return clampOffset(triggerStart + triggerRect.width / 2 - viewportWidth / 2);
55
+ return clampOffset(triggerEnd + contentInsetEnd - viewportWidth);
56
+ }
36
57
  function areTabsTransitionsEnabled(values, rects) {
37
58
  return values.length > 0 && values.every((value) => rects[value] !== void 0);
38
59
  }
39
60
  //#endregion
40
- export { areTabsTransitionsEnabled, getTabsLayoutWidth, getTabsOrderedItems, getTabsTriggerRects };
61
+ export { areTabsTransitionsEnabled, getTabsLayoutWidth, getTabsOrderedItems, getTabsScrollOffset, getTabsTriggerRects };
@@ -1,3 +1,3 @@
1
- export * from './Tabs';
1
+ export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger, type TabsCarouselCameraProps, type TabsCarouselProps, type TabsContentProps, type TabsIndicatorProps, type TabsListProps, type TabsRootProps, type TabsTriggerProps, } from './Tabs';
2
2
  export * as Tabs from './Tabs.namespace';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
@@ -7,10 +7,17 @@ export * from './BottomSheet';
7
7
  export * from './Callout';
8
8
  export * from './Checkbox';
9
9
  export * from './Chip';
10
+ export * from './ChipTabs';
10
11
  export * from './Count';
12
+ export * from './ContextualFloatingButton';
11
13
  export * from './Divider';
12
14
  export * from './Field';
15
+ export * from './FloatingActionButton';
13
16
  export * from './Icon';
17
+ export * from './Dialog';
18
+ export * from './AlertDialog';
19
+ export * from './HelpBubble';
20
+ export * from './IdentityPlaceholder';
14
21
  export * from './InputButton';
15
22
  export * from './KeyboardAvoidingScrollView';
16
23
  export * from './MannerTemp';
@@ -20,16 +27,23 @@ export * from './NotificationBadge';
20
27
  export * from './PageBanner';
21
28
  export * from './List';
22
29
  export * from './ProgressCircle';
30
+ export * from './QuantityPicker';
23
31
  export * from './RadioGroup';
24
32
  export * from './ReactionButton';
25
33
  export * from './ScaleFeedback';
26
34
  export * from './SegmentedControl';
35
+ export * from './Select';
27
36
  export * from './SelectBox';
37
+ export * from './Skeleton';
38
+ export * from './Slider';
28
39
  export * from './Stack';
29
40
  export * from './Switch';
41
+ export * from './ScrollFog';
30
42
  export * from './SwipeableMenuSheet';
31
43
  export * from './Tabs';
32
44
  export * from './TagGroup';
33
45
  export * from './Text';
34
46
  export * from './TextField';
47
+ export * from './AttachmentInput';
48
+ export * from './AttachmentDisplay';
35
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -1,15 +1,2 @@
1
- export interface UseControllableStateProps<T> {
2
- value?: T;
3
- defaultValue: T;
4
- onChange?: (value: T) => void;
5
- }
6
- /**
7
- * Controlled/uncontrolled state pattern for Lynx components.
8
- *
9
- * - When `value` is provided, the component is controlled.
10
- * - When `value` is `undefined`, the component manages its own state
11
- * starting from `defaultValue`.
12
- * - `onChange` fires in both modes.
13
- */
14
- export declare function useControllableState<T>(props: UseControllableStateProps<T>): [T, (value: T) => void];
1
+ export * from '@seed-design/lynx-react-use-controllable-state';
15
2
  //# sourceMappingURL=useControllableState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../src/hooks/useControllableState.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,YAAY,EAAE,CAAC,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAClC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAuBzB"}
1
+ {"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../src/hooks/useControllableState.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC"}
@@ -1,28 +1,2 @@
1
- import { BaseTouchEvent, EventHandler, Target } from '@lynx-js/types';
2
- import { LynxTouchProps } from '../types';
3
- type TouchHandler = EventHandler<BaseTouchEvent<Target>>;
4
- type PressStateHandler = TouchHandler & (() => void);
5
- export interface UsePressTapOptions {
6
- disabled?: boolean;
7
- onTap?: TouchHandler;
8
- mainThreadOnTap?: LynxTouchProps["main-thread:bindtap"];
9
- }
10
- export interface UsePressTapReturn {
11
- pressed: boolean;
12
- bindtap: TouchHandler;
13
- bindtouchstart: PressStateHandler;
14
- bindtouchend: PressStateHandler;
15
- bindtouchcancel: PressStateHandler;
16
- "main-thread:bindtap"?: LynxTouchProps["main-thread:bindtap"];
17
- }
18
- /**
19
- * Hook that provides press/tap interaction state for Lynx elements.
20
- *
21
- * - Tracks `pressed` state via touch events.
22
- * - When `disabled` is true, the element cannot become active and no tap fires.
23
- * - If the element becomes disabled during a press, the active state is cleared.
24
- * - `main-thread:bindtap` is conditionally included (only when enabled and provided).
25
- */
26
- export declare function usePressTap(options?: UsePressTapOptions): UsePressTapReturn;
27
- export {};
1
+ export * from '@seed-design/lynx-react-use-press-tap';
28
2
  //# sourceMappingURL=usePressTap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePressTap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePressTap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,KAAK,iBAAiB,GAAG,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,eAAe,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,cAAc,EAAE,iBAAiB,CAAC;IAClC,YAAY,EAAE,iBAAiB,CAAC;IAChC,eAAe,EAAE,iBAAiB,CAAC;IACnC,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CAC/D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,iBAAiB,CA2B/E"}
1
+ {"version":3,"file":"usePressTap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePressTap.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
@@ -39,7 +39,7 @@ export interface UseScaleFeedbackReturn {
39
39
  * The target's transform is owned by this hook. Use a separate content layer
40
40
  * when the element already uses translate, rotate, or another transform.
41
41
  *
42
- * Supported on Lynx Engine 3.9 and later. Missing or unknown
42
+ * Supported on Lynx Engine 3.6 and later. Missing or unknown
43
43
  * `GlobalProps.motion` values preserve the default motion; only the exact
44
44
  * `"reduced"` value disables scaling.
45
45
  */
@@ -42,7 +42,7 @@ function readScaleFeedbackScale(target) {
42
42
  * The target's transform is owned by this hook. Use a separate content layer
43
43
  * when the element already uses translate, rotate, or another transform.
44
44
  *
45
- * Supported on Lynx Engine 3.9 and later. Missing or unknown
45
+ * Supported on Lynx Engine 3.6 and later. Missing or unknown
46
46
  * `GlobalProps.motion` values preserve the default motion; only the exact
47
47
  * `"reduced"` value disables scaling.
48
48
  */