@seed-design/lynx-react 0.7.1 → 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 (241) 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 +39 -8
  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 +2 -1
  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/index.js +29 -6
  156. package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
  157. package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
  158. package/lib/types.d.ts +1 -0
  159. package/lib/types.d.ts.map +1 -1
  160. package/package.json +9 -5
  161. package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
  162. package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
  163. package/src/components/AlertDialog/AlertDialog.tsx +374 -0
  164. package/src/components/AlertDialog/index.ts +24 -0
  165. package/src/components/AppBar/AppBar.namespace.ts +1 -0
  166. package/src/components/AppBar/AppBar.test.tsx +231 -0
  167. package/src/components/AppBar/AppBar.tsx +105 -13
  168. package/src/components/AppBar/index.ts +1 -0
  169. package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
  170. package/src/components/AttachmentDisplay/index.ts +48 -0
  171. package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
  172. package/src/components/AttachmentInput/index.ts +49 -0
  173. package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
  174. package/src/components/BottomSheet/BottomSheet.tsx +1 -19
  175. package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
  176. package/src/components/ChipTabs/ChipTabs.tsx +119 -0
  177. package/src/components/ChipTabs/index.ts +16 -0
  178. package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
  179. package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
  180. package/src/components/ContextualFloatingButton/index.ts +4 -0
  181. package/src/components/Dialog/Dialog.namespace.ts +24 -0
  182. package/src/components/Dialog/Dialog.test.tsx +172 -0
  183. package/src/components/Dialog/Dialog.tsx +373 -0
  184. package/src/components/Dialog/index.ts +26 -0
  185. package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
  186. package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
  187. package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
  188. package/src/components/FloatingActionButton/index.ts +10 -0
  189. package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
  190. package/src/components/HelpBubble/HelpBubble.tsx +998 -0
  191. package/src/components/HelpBubble/index.ts +26 -0
  192. package/src/components/Icon/Icon.test.tsx +0 -3
  193. package/src/components/Icon/Icon.tsx +11 -1
  194. package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
  195. package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
  196. package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
  197. package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
  198. package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
  199. package/src/components/IdentityPlaceholder/index.ts +8 -0
  200. package/src/components/InputButton/InputButton.test.tsx +128 -1
  201. package/src/components/InputButton/InputButton.tsx +60 -9
  202. package/src/components/List/List.test.tsx +54 -2
  203. package/src/components/List/List.tsx +43 -10
  204. package/src/components/Menu/Menu.tsx +14 -4
  205. package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
  206. package/src/components/PageBanner/PageBanner.test.tsx +110 -3
  207. package/src/components/PageBanner/PageBanner.tsx +83 -19
  208. package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
  209. package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
  210. package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
  211. package/src/components/QuantityPicker/index.ts +14 -0
  212. package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
  213. package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
  214. package/src/components/ReactionButton/ReactionButton.tsx +20 -12
  215. package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
  216. package/src/components/ScrollFog/ScrollFog.tsx +172 -0
  217. package/src/components/ScrollFog/index.ts +1 -0
  218. package/src/components/Select/Select.namespace.ts +34 -0
  219. package/src/components/Select/Select.test.tsx +297 -0
  220. package/src/components/Select/Select.tsx +1483 -0
  221. package/src/components/Select/index.ts +39 -0
  222. package/src/components/Skeleton/Skeleton.test.tsx +64 -0
  223. package/src/components/Skeleton/Skeleton.tsx +45 -0
  224. package/src/components/Skeleton/index.ts +1 -0
  225. package/src/components/Slider/Slider.namespace.ts +26 -0
  226. package/src/components/Slider/Slider.test.tsx +260 -0
  227. package/src/components/Slider/Slider.tsx +897 -0
  228. package/src/components/Slider/Slider.utils.ts +167 -0
  229. package/src/components/Slider/index.ts +30 -0
  230. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
  231. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
  232. package/src/components/Switch/Switch.tsx +14 -13
  233. package/src/components/Tabs/Tabs.test.tsx +218 -1
  234. package/src/components/Tabs/Tabs.tsx +346 -75
  235. package/src/components/Tabs/Tabs.utils.ts +51 -1
  236. package/src/components/Tabs/index.ts +17 -1
  237. package/src/components/index.ts +14 -0
  238. package/src/hooks/useControllableState.ts +1 -43
  239. package/src/hooks/usePressTap.test.ts +23 -11
  240. package/src/hooks/usePressTap.ts +1 -60
  241. package/src/types.ts +1 -0
@@ -0,0 +1,67 @@
1
+ import { HelpBubbleVariantProps } from '@seed-design/lynx-css/recipes/help-bubble';
2
+ import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps, LynxViewProps } from '../../types';
3
+ import { StyleProps } from '../../utils/styled';
4
+ import { Placement } from '../private/Positioning';
5
+ import * as React from "@lynx-js/react";
6
+ type HelpBubblePublicVariantProps = Omit<HelpBubbleVariantProps, "open" | "positioned" | "side" | "pressed">;
7
+ export interface HelpBubbleRootProps extends HelpBubblePublicVariantProps, LynxStyledElementProps {
8
+ open?: boolean;
9
+ defaultOpen?: boolean;
10
+ onOpenChange?: (open: boolean) => void;
11
+ /** @default "top" */
12
+ placement?: Placement;
13
+ /** @default 4 */
14
+ gutter?: number;
15
+ /** @default 16 */
16
+ overflowPadding?: number;
17
+ /** @default 14 */
18
+ arrowPadding?: number;
19
+ /** @default true */
20
+ flip?: boolean | {
21
+ fallbackStrategy?: "bestFit" | "initialPlacement";
22
+ fallbackPlacements?: Placement[];
23
+ };
24
+ /** @default true */
25
+ closeOnInteractOutside?: boolean;
26
+ }
27
+ /**
28
+ * @platform Lynx
29
+ *
30
+ * The native implementation uses fixed positioned views rather than DOM portals.
31
+ * `closeOnInteractOutside={false}` has no full-screen hit surface, so other native
32
+ * controls and independently-open HelpBubbles remain interactive.
33
+ */
34
+ export declare const HelpBubbleRoot: React.ForwardRefExoticComponent<HelpBubbleRootProps & React.RefAttributes<unknown>>;
35
+ export interface HelpBubbleAnchorProps extends LynxStyledElementProps, Pick<LynxViewProps, "bindlayoutchange"> {
36
+ }
37
+ export declare const HelpBubbleAnchor: React.ForwardRefExoticComponent<HelpBubbleAnchorProps & React.RefAttributes<unknown>>;
38
+ export interface HelpBubbleTriggerProps extends LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps, Pick<LynxViewProps, "bindlayoutchange"> {
39
+ }
40
+ export declare const HelpBubbleTrigger: React.ForwardRefExoticComponent<HelpBubbleTriggerProps & React.RefAttributes<unknown>>;
41
+ export interface HelpBubblePositionerProps extends LynxStyledElementProps {
42
+ zIndexOffset?: number;
43
+ }
44
+ export declare const HelpBubblePositioner: React.ForwardRefExoticComponent<HelpBubblePositionerProps & React.RefAttributes<unknown>>;
45
+ export interface HelpBubbleContentProps extends Pick<StyleProps, "maxWidth">, LynxStyledElementProps {
46
+ }
47
+ export declare const HelpBubbleContent: React.ForwardRefExoticComponent<HelpBubbleContentProps & React.RefAttributes<unknown>>;
48
+ export interface HelpBubbleArrowProps extends LynxStyledElementProps {
49
+ }
50
+ export declare const HelpBubbleArrow: React.ForwardRefExoticComponent<HelpBubbleArrowProps & React.RefAttributes<unknown>>;
51
+ export interface HelpBubbleArrowTipProps extends LynxStyledElementProps {
52
+ }
53
+ export declare const HelpBubbleArrowTip: React.ForwardRefExoticComponent<HelpBubbleArrowTipProps & React.RefAttributes<unknown>>;
54
+ export interface HelpBubbleBodyProps extends LynxStyledElementProps {
55
+ }
56
+ export declare const HelpBubbleBody: React.ForwardRefExoticComponent<HelpBubbleBodyProps & React.RefAttributes<unknown>>;
57
+ export interface HelpBubbleTitleProps extends LynxStyledElementProps, LynxAccessibilityProps {
58
+ }
59
+ export declare const HelpBubbleTitle: React.ForwardRefExoticComponent<HelpBubbleTitleProps & React.RefAttributes<unknown>>;
60
+ export interface HelpBubbleDescriptionProps extends LynxStyledElementProps, LynxAccessibilityProps {
61
+ }
62
+ export declare const HelpBubbleDescription: React.ForwardRefExoticComponent<HelpBubbleDescriptionProps & React.RefAttributes<unknown>>;
63
+ export interface HelpBubbleCloseButtonProps extends LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
64
+ }
65
+ export declare const HelpBubbleCloseButton: React.ForwardRefExoticComponent<HelpBubbleCloseButtonProps & React.RefAttributes<unknown>>;
66
+ export {};
67
+ //# sourceMappingURL=HelpBubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HelpBubble.d.ts","sourceRoot":"","sources":["../../../src/components/HelpBubble/HelpBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAGpG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAKxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAEtB,aAAa,EAEd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,wBAAwB,CAAC;AAIhC,KAAK,4BAA4B,GAAG,IAAI,CACtC,sBAAsB,EACtB,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAC3C,CAAC;AAoFF,MAAM,WAAW,mBAAoB,SAAQ,4BAA4B,EAAE,sBAAsB;IAC/F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,qBAAqB;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB;IACpB,IAAI,CAAC,EACD,OAAO,GACP;QACE,gBAAgB,CAAC,EAAE,SAAS,GAAG,kBAAkB,CAAC;QAClD,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;KAClC,CAAC;IACN,oBAAoB;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,qFAsLzB,CAAC;AAKH,MAAM,WAAW,qBACf,SAAQ,sBAAsB,EAC5B,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC;CAAG;AAE9C,eAAO,MAAM,gBAAgB,uFA8B3B,CAAC;AAKH,MAAM,WAAW,sBACf,SAAQ,sBAAsB,EAC5B,kBAAkB,EAClB,sBAAsB,EACtB,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC;CAAG;AAE9C,eAAO,MAAM,iBAAiB,wFAgE5B,CAAC;AAKH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA8DD,eAAO,MAAM,oBAAoB,2FA+BhC,CAAC;AAKF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAClC,sBAAsB;CAAG;AAE7B,eAAO,MAAM,iBAAiB,wFAyR5B,CAAC;AAKH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;CAAG;AAEvE,eAAO,MAAM,eAAe,sFAuB1B,CAAC;AAGH,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;CAAG;AAE1E,eAAO,MAAM,kBAAkB,yFAc9B,CAAC;AAKF,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;CAAG;AAEtE,eAAO,MAAM,cAAc,qFAWzB,CAAC;AAGH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAE/F,eAAO,MAAM,eAAe,sFAW1B,CAAC;AAGH,MAAM,WAAW,0BACf,SAAQ,sBAAsB,EAC5B,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FAajC,CAAC;AAKF,MAAM,WAAW,0BACf,SAAQ,sBAAsB,EAC5B,kBAAkB,EAClB,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FAmDjC,CAAC"}
@@ -0,0 +1,600 @@
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
+ import { mergeProps } from "../../utils/merge-props.js";
4
+ import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
5
+ import { useStyleProps } from "../../utils/styled.js";
6
+ import { computePosition } from "../private/Positioning.js";
7
+ import * as React from "@lynx-js/react";
8
+ import clsx from "clsx";
9
+ import { getRectByRef } from "@lynx-js/lynx-ui-common";
10
+ import { helpBubble } from "@seed-design/lynx-css/recipes/help-bubble";
11
+ //#region src/components/HelpBubble/HelpBubble.tsx
12
+ var { ClassNamesProvider, useClassNames } = createSlotRecipeContext(helpBubble);
13
+ var HelpBubbleContext = React.createContext(null);
14
+ function useHelpBubbleContext(consumer) {
15
+ const context = React.useContext(HelpBubbleContext);
16
+ if (!context) throw new Error(`<${consumer}/> must be rendered inside <HelpBubbleRoot/>.`);
17
+ return context;
18
+ }
19
+ function mergeNodeRef(forwardedRef, node) {
20
+ if (typeof forwardedRef === "function") forwardedRef(node);
21
+ else if (forwardedRef) forwardedRef.current = node;
22
+ }
23
+ function toPixel(value) {
24
+ return `${value}px`;
25
+ }
26
+ function getLayoutSize(event) {
27
+ const width = event.detail?.width ?? event.params?.width;
28
+ const height = event.detail?.height ?? event.params?.height;
29
+ if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
30
+ return {
31
+ width: Math.max(0, width),
32
+ height: Math.max(0, height)
33
+ };
34
+ }
35
+ function hasExitTransition(event) {
36
+ if (event.target.uid !== event.currentTarget.uid) return false;
37
+ return event.params.animation_type === "transition-opacity" || event.params.animation_name === "opacity";
38
+ }
39
+ var EXIT_TRANSITION_FALLBACK_MS = 200;
40
+ function getRootRect() {
41
+ "background only";
42
+ return getRectByRef({ current: lynx.createSelectorQuery().selectRoot() }, true);
43
+ }
44
+ function areStylesEqual(left, right) {
45
+ if (left === right) return true;
46
+ if (!left || !right) return false;
47
+ const leftEntries = Object.entries(left);
48
+ if (leftEntries.length !== Object.keys(right).length) return false;
49
+ return leftEntries.every(([key, value]) => Object.is(value, right[key]));
50
+ }
51
+ /**
52
+ * @platform Lynx
53
+ *
54
+ * The native implementation uses fixed positioned views rather than DOM portals.
55
+ * `closeOnInteractOutside={false}` has no full-screen hit surface, so other native
56
+ * controls and independently-open HelpBubbles remain interactive.
57
+ */
58
+ var HelpBubbleRoot = React.forwardRef((props, ref) => {
59
+ const { children, className, style, open: openProp, defaultOpen = false, onOpenChange, placement = "top", gutter = 4, overflowPadding = 16, arrowPadding = 14, flip = true, closeOnInteractOutside = true, ...nativeProps } = props;
60
+ const [open, setOpen] = useControllableState({
61
+ value: openProp,
62
+ defaultValue: defaultOpen
63
+ });
64
+ const [mounted, setMounted] = React.useState(open);
65
+ const [position, setPositionState] = React.useState(null);
66
+ const [positionedEpoch, setPositionedEpoch] = React.useState(null);
67
+ const [referenceRect, setReferenceRect] = React.useState(null);
68
+ const [positionRevision, setPositionRevision] = React.useState(0);
69
+ const positionRevisionRef = React.useRef(0);
70
+ const isOpenRef = React.useRef(open);
71
+ const openEpochRef = React.useRef(0);
72
+ const anchorRef = React.useRef(null);
73
+ const triggerRef = React.useRef(null);
74
+ if (open && !isOpenRef.current) openEpochRef.current += 1;
75
+ isOpenRef.current = open;
76
+ const openEpoch = openEpochRef.current;
77
+ const positioned = positionedEpoch === openEpoch;
78
+ React.useEffect(() => {
79
+ "background only";
80
+ if (open) {
81
+ setMounted(true);
82
+ return;
83
+ }
84
+ if (!positioned) setMounted(false);
85
+ }, [open, positioned]);
86
+ const requestOpen = React.useCallback((nextOpen) => {
87
+ "background only";
88
+ if (nextOpen === open) return;
89
+ setOpen(nextOpen);
90
+ onOpenChange?.(nextOpen);
91
+ }, [
92
+ onOpenChange,
93
+ open,
94
+ setOpen
95
+ ]);
96
+ const finishClose = React.useCallback(() => {
97
+ "background only";
98
+ if (!isOpenRef.current) {
99
+ setMounted(false);
100
+ setPositionedEpoch(null);
101
+ setPositionState(null);
102
+ setReferenceRect(null);
103
+ }
104
+ }, []);
105
+ const setPosition = React.useCallback((nextPosition, nextReferenceRect) => {
106
+ setPositionState((previous) => {
107
+ if (previous !== null && nextPosition !== null && previous.left === nextPosition.left && previous.top === nextPosition.top && previous.width === nextPosition.width && previous.height === nextPosition.height && previous.placement === nextPosition.placement && previous.transformOrigin === nextPosition.transformOrigin && previous.availableWidth === nextPosition.availableWidth && previous.availableHeight === nextPosition.availableHeight && previous.arrow?.left === nextPosition.arrow?.left && previous.arrow?.top === nextPosition.arrow?.top && previous.arrow?.centerOffset === nextPosition.arrow?.centerOffset) return previous;
108
+ return nextPosition;
109
+ });
110
+ setReferenceRect((previous) => {
111
+ if (previous !== null && nextReferenceRect !== null && previous.left === nextReferenceRect.left && previous.top === nextReferenceRect.top && previous.right === nextReferenceRect.right && previous.bottom === nextReferenceRect.bottom && previous.width === nextReferenceRect.width && previous.height === nextReferenceRect.height) return previous;
112
+ return nextReferenceRect;
113
+ });
114
+ setPositionedEpoch(nextPosition ? openEpochRef.current : null);
115
+ }, []);
116
+ const resetPosition = React.useCallback(() => {
117
+ setPositionState(null);
118
+ setReferenceRect(null);
119
+ setPositionedEpoch(null);
120
+ }, []);
121
+ const requestPositionUpdate = React.useCallback(() => {
122
+ positionRevisionRef.current += 1;
123
+ setPositionRevision(positionRevisionRef.current);
124
+ }, []);
125
+ const classes = helpBubble({
126
+ open,
127
+ positioned,
128
+ side: position?.placement.split("-")[0],
129
+ pressed: false
130
+ });
131
+ const contextValue = React.useMemo(() => ({
132
+ open,
133
+ mounted,
134
+ positioned,
135
+ side: position?.placement.split("-")[0] ?? "top",
136
+ placement,
137
+ gutter,
138
+ overflowPadding,
139
+ arrowPadding,
140
+ flip,
141
+ closeOnInteractOutside,
142
+ openEpoch,
143
+ isOpenRef,
144
+ openEpochRef,
145
+ anchorRef,
146
+ triggerRef,
147
+ position,
148
+ referenceRect,
149
+ positionRevision,
150
+ positionRevisionRef,
151
+ requestOpen,
152
+ finishClose,
153
+ setPosition,
154
+ resetPosition,
155
+ requestPositionUpdate
156
+ }), [
157
+ arrowPadding,
158
+ closeOnInteractOutside,
159
+ finishClose,
160
+ flip,
161
+ gutter,
162
+ mounted,
163
+ open,
164
+ openEpoch,
165
+ overflowPadding,
166
+ placement,
167
+ position,
168
+ positioned,
169
+ requestOpen,
170
+ resetPosition,
171
+ setPosition,
172
+ referenceRect,
173
+ positionRevisionRef,
174
+ positionRevision,
175
+ requestPositionUpdate
176
+ ]);
177
+ return <HelpBubbleContext.Provider value={contextValue}>
178
+ <ClassNamesProvider value={classes}>
179
+ <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={className} style={style}>
180
+ {children}
181
+ </view>
182
+ </ClassNamesProvider>
183
+ </HelpBubbleContext.Provider>;
184
+ });
185
+ HelpBubbleRoot.displayName = "HelpBubbleRoot";
186
+ var HelpBubbleAnchor = React.forwardRef((props, ref) => {
187
+ const { children, className, style, bindlayoutchange, ...nativeProps } = props;
188
+ const context = useHelpBubbleContext("HelpBubbleAnchor");
189
+ const handleRef = React.useCallback((node) => {
190
+ context.anchorRef.current = node;
191
+ mergeNodeRef(ref, node);
192
+ }, [context.anchorRef, ref]);
193
+ const handleLayoutChange = React.useCallback((...args) => {
194
+ "background only";
195
+ context.requestPositionUpdate();
196
+ bindlayoutchange?.(...args);
197
+ }, [bindlayoutchange, context.requestPositionUpdate]);
198
+ return <view ref={handleRef} className={className} style={style} bindlayoutchange={handleLayoutChange} {...nativeProps}>
199
+ {children}
200
+ </view>;
201
+ });
202
+ HelpBubbleAnchor.displayName = "HelpBubbleAnchor";
203
+ var HelpBubbleTrigger = React.forwardRef((props, ref) => {
204
+ const { children, className, style, bindtap, bindlayoutchange, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
205
+ const context = useHelpBubbleContext("HelpBubbleTrigger");
206
+ const { pressed: _pressed, bindtap: triggerTap, ...pressHandlers } = usePressTap({
207
+ onTap: React.useCallback((event, instance) => {
208
+ "background only";
209
+ context.requestOpen(!context.open);
210
+ bindtap?.(event, instance);
211
+ }, [bindtap, context]),
212
+ mainThreadOnTap: mainThreadBindtap
213
+ });
214
+ const handleRef = React.useCallback((node) => {
215
+ context.triggerRef.current = node;
216
+ mergeNodeRef(ref, node);
217
+ }, [context.triggerRef, ref]);
218
+ const handleLayoutChange = React.useCallback((...args) => {
219
+ "background only";
220
+ context.requestPositionUpdate();
221
+ bindlayoutchange?.(...args);
222
+ }, [bindlayoutchange, context.requestPositionUpdate]);
223
+ return <view ref={handleRef} className={className} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description="button" accessibility-value={context.open ? "expanded" : "collapsed"} accessibility-traits={accessibilityTraits ?? "button"} {...nativeProps} {...pressHandlers} bindtap={triggerTap} bindlayoutchange={handleLayoutChange}>
224
+ {children}
225
+ </view>;
226
+ });
227
+ HelpBubbleTrigger.displayName = "HelpBubbleTrigger";
228
+ function OutsidePressCatcher({ referenceRect, onTap }) {
229
+ const screen = typeof SystemInfo === "undefined" ? void 0 : SystemInfo;
230
+ const pixelRatio = screen?.pixelRatio;
231
+ const width = screen?.pixelWidth;
232
+ const height = screen?.pixelHeight;
233
+ if (typeof pixelRatio !== "number" || pixelRatio <= 0 || typeof width !== "number" || typeof height !== "number") return null;
234
+ const screenWidth = width / pixelRatio;
235
+ const screenHeight = height / pixelRatio;
236
+ const left = Math.max(0, referenceRect.left);
237
+ const top = Math.max(0, referenceRect.top);
238
+ const right = Math.min(screenWidth, referenceRect.right);
239
+ const bottom = Math.min(screenHeight, referenceRect.bottom);
240
+ const areas = [
241
+ {
242
+ top: 0,
243
+ left: 0,
244
+ width: screenWidth,
245
+ height: top
246
+ },
247
+ {
248
+ top: bottom,
249
+ left: 0,
250
+ width: screenWidth,
251
+ height: Math.max(0, screenHeight - bottom)
252
+ },
253
+ {
254
+ top,
255
+ left: 0,
256
+ width: left,
257
+ height: Math.max(0, bottom - top)
258
+ },
259
+ {
260
+ top,
261
+ left: right,
262
+ width: Math.max(0, screenWidth - right),
263
+ height: Math.max(0, bottom - top)
264
+ }
265
+ ];
266
+ return <>
267
+ {areas.map((area, index) => area.width > 0 && area.height > 0 ? <view key={index} style={{
268
+ position: "fixed",
269
+ top: toPixel(area.top),
270
+ left: toPixel(area.left),
271
+ width: toPixel(area.width),
272
+ height: toPixel(area.height),
273
+ zIndex: 0
274
+ }} bindtap={onTap} /> : null)}
275
+ </>;
276
+ }
277
+ var HelpBubblePositioner = React.forwardRef((props, ref) => {
278
+ const { children, className, style, zIndexOffset = 0, ...nativeProps } = props;
279
+ const context = useHelpBubbleContext("HelpBubblePositioner");
280
+ const classNames = useClassNames();
281
+ const handleOutsideTap = React.useCallback(() => {
282
+ "background only";
283
+ context.requestOpen(false);
284
+ }, [context.requestOpen]);
285
+ if (!context.mounted) return null;
286
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.positioner, className)} style={{
287
+ left: toPixel(context.position?.left ?? 0),
288
+ top: toPixel(context.position?.top ?? 0),
289
+ width: context.position ? toPixel(context.position.width) : void 0,
290
+ zIndex: 99 + zIndexOffset,
291
+ ...style
292
+ }}>
293
+ {context.closeOnInteractOutside && context.open && context.referenceRect ? <OutsidePressCatcher referenceRect={context.referenceRect} onTap={handleOutsideTap} /> : null}
294
+ {children}
295
+ </view>;
296
+ });
297
+ HelpBubblePositioner.displayName = "HelpBubblePositioner";
298
+ var HelpBubbleContent = React.forwardRef((props, ref) => {
299
+ const { style, restProps } = useStyleProps(props);
300
+ const { children, className, ...nativeProps } = restProps;
301
+ const context = useHelpBubbleContext("HelpBubbleContent");
302
+ const measurementVersionRef = React.useRef(0);
303
+ const intrinsicWidthRef = React.useRef(null);
304
+ const measurementConfigRef = React.useRef(0);
305
+ const configuredClassNameRef = React.useRef(className);
306
+ const configuredStyleRef = React.useRef(style);
307
+ const [contentNode, setContentNode] = React.useState(null);
308
+ const [measurementRevision, setMeasurementRevision] = React.useState(0);
309
+ const [intrinsicSize, setIntrinsicSize] = React.useState(null);
310
+ const [widthConstraint, setWidthConstraint] = React.useState(null);
311
+ const closeFinishedRef = React.useRef(false);
312
+ const finishClose = React.useCallback(() => {
313
+ "background only";
314
+ if (closeFinishedRef.current) return;
315
+ closeFinishedRef.current = true;
316
+ context.finishClose();
317
+ }, [context.finishClose]);
318
+ const measureIntrinsicSize = React.useCallback(async () => {
319
+ "background only";
320
+ const openEpoch = context.openEpoch;
321
+ const config = measurementConfigRef.current;
322
+ if (!context.open || !contentNode) return;
323
+ const version = ++measurementVersionRef.current;
324
+ try {
325
+ const rect = await getRectByRef({ current: contentNode }, true);
326
+ if (version !== measurementVersionRef.current || !context.isOpenRef.current || openEpoch !== context.openEpochRef.current || config !== measurementConfigRef.current) return;
327
+ if (intrinsicWidthRef.current === null) intrinsicWidthRef.current = rect.width;
328
+ setIntrinsicSize((current) => {
329
+ const width = intrinsicWidthRef.current ?? rect.width;
330
+ if (current?.width === width && current.height === rect.height && current.epoch === openEpoch && current.config === config) return current;
331
+ return {
332
+ width,
333
+ height: rect.height,
334
+ epoch: openEpoch,
335
+ config
336
+ };
337
+ });
338
+ } catch {}
339
+ }, [
340
+ contentNode,
341
+ context.isOpenRef,
342
+ context.open,
343
+ context.openEpoch,
344
+ context.openEpochRef
345
+ ]);
346
+ const measurePosition = React.useCallback(async () => {
347
+ "background only";
348
+ const referenceNode = context.anchorRef.current ?? context.triggerRef.current;
349
+ const openEpoch = context.openEpoch;
350
+ const positionRevision = context.positionRevisionRef.current;
351
+ if (!context.open || !referenceNode || !intrinsicSize || intrinsicSize.epoch !== openEpoch || intrinsicSize.config !== measurementConfigRef.current) return;
352
+ const version = ++measurementVersionRef.current;
353
+ try {
354
+ const [reference, boundary] = await Promise.all([getRectByRef({ current: referenceNode }, true), getRootRect()]);
355
+ if (version !== measurementVersionRef.current || !context.isOpenRef.current || openEpoch !== context.openEpochRef.current || positionRevision !== context.positionRevisionRef.current) return;
356
+ const width = widthConstraint ?? intrinsicWidthRef.current ?? intrinsicSize.width;
357
+ const nextPosition = await computePosition({
358
+ reference,
359
+ boundary,
360
+ width,
361
+ height: intrinsicSize.height,
362
+ placement: context.placement,
363
+ gutter: context.gutter,
364
+ overflowPadding: context.overflowPadding,
365
+ flip: context.flip === false ? false : context.flip === true ? { fallbackStrategy: "bestFit" } : context.flip,
366
+ shift: {
367
+ crossAxis: true,
368
+ limit: true
369
+ },
370
+ arrow: {
371
+ size: 12,
372
+ tipHeight: 8,
373
+ padding: context.arrowPadding
374
+ }
375
+ });
376
+ if (version !== measurementVersionRef.current || !context.isOpenRef.current || openEpoch !== context.openEpochRef.current || positionRevision !== context.positionRevisionRef.current) return;
377
+ if (nextPosition.availableWidth < width) {
378
+ const constrainedWidth = nextPosition.availableWidth;
379
+ if (widthConstraint !== constrainedWidth) {
380
+ setWidthConstraint(constrainedWidth);
381
+ setIntrinsicSize(null);
382
+ context.resetPosition();
383
+ setMeasurementRevision((current) => current + 1);
384
+ }
385
+ return;
386
+ }
387
+ context.setPosition(nextPosition, reference);
388
+ } catch {}
389
+ }, [
390
+ context.anchorRef,
391
+ context.arrowPadding,
392
+ context.flip,
393
+ context.gutter,
394
+ context.isOpenRef,
395
+ context.open,
396
+ context.openEpoch,
397
+ context.openEpochRef,
398
+ context.overflowPadding,
399
+ context.placement,
400
+ context.resetPosition,
401
+ context.setPosition,
402
+ context.triggerRef,
403
+ intrinsicSize,
404
+ widthConstraint
405
+ ]);
406
+ React.useEffect(() => {
407
+ "background only";
408
+ measurementVersionRef.current += 1;
409
+ intrinsicWidthRef.current = null;
410
+ setWidthConstraint(null);
411
+ setIntrinsicSize(null);
412
+ context.resetPosition();
413
+ }, [context.openEpoch, context.resetPosition]);
414
+ React.useEffect(() => {
415
+ "background only";
416
+ if (configuredClassNameRef.current === className && areStylesEqual(configuredStyleRef.current, style)) return;
417
+ measurementVersionRef.current += 1;
418
+ intrinsicWidthRef.current = null;
419
+ measurementConfigRef.current += 1;
420
+ configuredClassNameRef.current = className;
421
+ configuredStyleRef.current = style;
422
+ setWidthConstraint(null);
423
+ setIntrinsicSize(null);
424
+ context.resetPosition();
425
+ setMeasurementRevision((current) => current + 1);
426
+ }, [
427
+ className,
428
+ context.resetPosition,
429
+ style
430
+ ]);
431
+ React.useEffect(() => {
432
+ "background only";
433
+ if (!context.open) return;
434
+ const frame = requestAnimationFrame(() => {
435
+ "background only";
436
+ measureIntrinsicSize();
437
+ });
438
+ return () => cancelAnimationFrame(frame);
439
+ }, [
440
+ context.open,
441
+ context.openEpoch,
442
+ measureIntrinsicSize,
443
+ measurementRevision
444
+ ]);
445
+ React.useEffect(() => {
446
+ "background only";
447
+ if (!context.open) return;
448
+ let disposed = false;
449
+ let frame;
450
+ const trackPosition = () => {
451
+ measurePosition().finally(() => {
452
+ if (!disposed && context.isOpenRef.current) frame = requestAnimationFrame(trackPosition);
453
+ });
454
+ };
455
+ trackPosition();
456
+ return () => {
457
+ disposed = true;
458
+ measurementVersionRef.current += 1;
459
+ if (frame !== void 0) cancelAnimationFrame(frame);
460
+ };
461
+ }, [
462
+ context.isOpenRef,
463
+ context.open,
464
+ context.openEpoch,
465
+ context.positionRevision,
466
+ measurePosition
467
+ ]);
468
+ React.useEffect(() => {
469
+ "background only";
470
+ if (context.open) {
471
+ closeFinishedRef.current = false;
472
+ return;
473
+ }
474
+ if (!context.mounted) return;
475
+ const timer = setTimeout(() => {
476
+ "background only";
477
+ finishClose();
478
+ }, EXIT_TRANSITION_FALLBACK_MS);
479
+ return () => clearTimeout(timer);
480
+ }, [
481
+ context.mounted,
482
+ context.open,
483
+ finishClose
484
+ ]);
485
+ const handleRef = React.useCallback((node) => {
486
+ measurementVersionRef.current += 1;
487
+ setContentNode(node);
488
+ mergeNodeRef(ref, node);
489
+ }, [ref]);
490
+ const handleLayoutChange = React.useCallback((event) => {
491
+ "background only";
492
+ const nextSize = getLayoutSize(event);
493
+ if (!nextSize || !context.open) return;
494
+ measurementVersionRef.current += 1;
495
+ if (intrinsicWidthRef.current === null) intrinsicWidthRef.current = nextSize.width;
496
+ setIntrinsicSize((current) => {
497
+ const width = intrinsicWidthRef.current ?? nextSize.width;
498
+ if (current?.width === width && current.height === nextSize.height && current.epoch === context.openEpoch && current.config === measurementConfigRef.current) return current;
499
+ return {
500
+ width,
501
+ height: nextSize.height,
502
+ epoch: context.openEpoch,
503
+ config: measurementConfigRef.current
504
+ };
505
+ });
506
+ }, [context.open, context.openEpoch]);
507
+ const handleTransitionEnd = React.useCallback((event) => {
508
+ "background only";
509
+ if (!context.open && hasExitTransition(event)) finishClose();
510
+ }, [context.open, finishClose]);
511
+ const motionClassName = useClassNames().motion;
512
+ return <view className={motionClassName} bindtransitionend={handleTransitionEnd}>
513
+ <view ref={handleRef} className={clsx(useClassNames().content, className)} style={{
514
+ ...style,
515
+ ...widthConstraint != null ? { width: toPixel(widthConstraint) } : {}
516
+ }} bindlayoutchange={handleLayoutChange} {...nativeProps}>
517
+ {children}
518
+ </view>
519
+ </view>;
520
+ });
521
+ HelpBubbleContent.displayName = "HelpBubbleContent";
522
+ var HelpBubbleArrow = React.forwardRef((props, ref) => {
523
+ const { children, className, style, ...nativeProps } = props;
524
+ const context = useHelpBubbleContext("HelpBubbleArrow");
525
+ const arrow = context.position?.arrow;
526
+ const side = context.side;
527
+ const geometryStyle = side === "top" ? {
528
+ left: toPixel(arrow?.left ?? 0),
529
+ top: "100%"
530
+ } : side === "bottom" ? {
531
+ left: toPixel(arrow?.left ?? 0),
532
+ bottom: "100%"
533
+ } : side === "right" ? {
534
+ top: toPixel(arrow?.top ?? 0),
535
+ right: "100%"
536
+ } : {
537
+ top: toPixel(arrow?.top ?? 0),
538
+ left: "100%"
539
+ };
540
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(useClassNames().arrow, className)} style={{
541
+ ...geometryStyle,
542
+ ...style
543
+ }}>
544
+ {children}
545
+ </view>;
546
+ });
547
+ HelpBubbleArrow.displayName = "HelpBubbleArrow";
548
+ var HelpBubbleArrowTip = React.forwardRef((props, ref) => {
549
+ const { children, className, style, ...nativeProps } = props;
550
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(useClassNames().arrowTip, className)} style={style} accessibility-elements-hidden={true}>
551
+ {children}
552
+ </view>;
553
+ });
554
+ HelpBubbleArrowTip.displayName = "HelpBubbleArrowTip";
555
+ var HelpBubbleBody = React.forwardRef((props, ref) => {
556
+ const { children, className, style, ...nativeProps } = props;
557
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(useClassNames().body, className)} style={style}>
558
+ {children}
559
+ </view>;
560
+ });
561
+ HelpBubbleBody.displayName = "HelpBubbleBody";
562
+ var HelpBubbleTitle = React.forwardRef((props, ref) => {
563
+ const { children, className, style, ...nativeProps } = props;
564
+ return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(useClassNames().title, className)} style={style}>
565
+ {children}
566
+ </text>;
567
+ });
568
+ HelpBubbleTitle.displayName = "HelpBubbleTitle";
569
+ var HelpBubbleDescription = React.forwardRef((props, ref) => {
570
+ const { children, className, style, ...nativeProps } = props;
571
+ return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(useClassNames().description, className)} style={style}>
572
+ {children}
573
+ </text>;
574
+ });
575
+ HelpBubbleDescription.displayName = "HelpBubbleDescription";
576
+ var HelpBubbleCloseButton = React.forwardRef((props, ref) => {
577
+ const { children, className, style, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits = "button", ...nativeProps } = props;
578
+ const context = useHelpBubbleContext("HelpBubbleCloseButton");
579
+ const { pressed, ...pressHandlers } = usePressTap({
580
+ onTap: React.useCallback((event, instance) => {
581
+ "background only";
582
+ bindtap?.(event, instance);
583
+ context.requestOpen(false);
584
+ }, [bindtap, context]),
585
+ mainThreadOnTap: mainThreadBindtap
586
+ });
587
+ const closeButtonClassNames = helpBubble({
588
+ open: context.open,
589
+ positioned: context.positioned,
590
+ side: context.side,
591
+ pressed
592
+ });
593
+ if (process.env.NODE_ENV !== "production" && accessibilityElement && !accessibilityLabel) console.warn("HelpBubbleCloseButton requires `accessibility-label` for accessibility.");
594
+ return <view {...mergeProps(ref ? { ref } : {}, pressHandlers, nativeProps)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-traits={accessibilityTraits} className={clsx(closeButtonClassNames.closeButton, className)} style={style} flatten={false}>
595
+ {children}
596
+ </view>;
597
+ });
598
+ HelpBubbleCloseButton.displayName = "HelpBubbleCloseButton";
599
+ //#endregion
600
+ export { HelpBubbleAnchor, HelpBubbleArrow, HelpBubbleArrowTip, HelpBubbleBody, HelpBubbleCloseButton, HelpBubbleContent, HelpBubbleDescription, HelpBubblePositioner, HelpBubbleRoot, HelpBubbleTitle, HelpBubbleTrigger };
@@ -0,0 +1,2 @@
1
+ export { HelpBubbleAnchor as Anchor, HelpBubbleArrow as Arrow, HelpBubbleArrowTip as ArrowTip, HelpBubbleBody as Body, HelpBubbleCloseButton as CloseButton, HelpBubbleContent as Content, HelpBubbleDescription as Description, HelpBubblePositioner as Positioner, HelpBubbleRoot as Root, HelpBubbleTitle as Title, HelpBubbleTrigger as Trigger, type HelpBubbleAnchorProps as AnchorProps, type HelpBubbleArrowProps as ArrowProps, type HelpBubbleArrowTipProps as ArrowTipProps, type HelpBubbleBodyProps as BodyProps, type HelpBubbleCloseButtonProps as CloseButtonProps, type HelpBubbleContentProps as ContentProps, type HelpBubbleDescriptionProps as DescriptionProps, type HelpBubblePositionerProps as PositionerProps, type HelpBubbleRootProps as RootProps, type HelpBubbleTitleProps as TitleProps, type HelpBubbleTriggerProps as TriggerProps, } from './HelpBubble';
2
+ //# sourceMappingURL=HelpBubble.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HelpBubble.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/HelpBubble/HelpBubble.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,MAAM,EAC1B,eAAe,IAAI,KAAK,EACxB,kBAAkB,IAAI,QAAQ,EAC9B,cAAc,IAAI,IAAI,EACtB,qBAAqB,IAAI,WAAW,EACpC,iBAAiB,IAAI,OAAO,EAC5B,qBAAqB,IAAI,WAAW,EACpC,oBAAoB,IAAI,UAAU,EAClC,cAAc,IAAI,IAAI,EACtB,eAAe,IAAI,KAAK,EACxB,iBAAiB,IAAI,OAAO,EAC5B,KAAK,qBAAqB,IAAI,WAAW,EACzC,KAAK,oBAAoB,IAAI,UAAU,EACvC,KAAK,uBAAuB,IAAI,aAAa,EAC7C,KAAK,mBAAmB,IAAI,SAAS,EACrC,KAAK,0BAA0B,IAAI,gBAAgB,EACnD,KAAK,sBAAsB,IAAI,YAAY,EAC3C,KAAK,0BAA0B,IAAI,gBAAgB,EACnD,KAAK,yBAAyB,IAAI,eAAe,EACjD,KAAK,mBAAmB,IAAI,SAAS,EACrC,KAAK,oBAAoB,IAAI,UAAU,EACvC,KAAK,sBAAsB,IAAI,YAAY,GAC5C,MAAM,cAAc,CAAC"}