@astryxdesign/core 0.7.7 → 0.7.8-canary.0588a13

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 (798) hide show
  1. package/dist/AlertDialog/AlertDialog.d.ts +4 -1
  2. package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
  3. package/dist/AlertDialog/AlertDialog.js +46 -6
  4. package/dist/AppShell/AppShell.d.ts.map +1 -1
  5. package/dist/AppShell/AppShell.js +11 -3
  6. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  7. package/dist/BottomSheet/BottomSheet.js +1 -0
  8. package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
  9. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  10. package/dist/BottomSheet/BottomSheetPanel.js +55 -18
  11. package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
  12. package/dist/BottomSheet/BottomSheetSwitcher.js +5 -0
  13. package/dist/BottomSheet/bottomSheetStack.js +1 -1
  14. package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
  15. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  16. package/dist/BottomSheet/useSheetGestures.js +16 -1
  17. package/dist/Button/Button.d.ts.map +1 -1
  18. package/dist/Button/Button.js +17 -1
  19. package/dist/Calendar/Calendar.d.ts.map +1 -1
  20. package/dist/Calendar/Calendar.js +18 -22
  21. package/dist/Calendar/getWeekdayHeaderNames.d.ts +16 -0
  22. package/dist/Calendar/getWeekdayHeaderNames.d.ts.map +1 -0
  23. package/dist/Calendar/getWeekdayHeaderNames.js +70 -0
  24. package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
  25. package/dist/Calendar/hooks/useCalendarDays.js +2 -10
  26. package/dist/Calendar/{standaloneShortWeekdayNames.generated.d.ts → weekdayHeaderNames.generated.d.ts} +14 -14
  27. package/dist/Calendar/weekdayHeaderNames.generated.d.ts.map +1 -0
  28. package/dist/Calendar/{standaloneShortWeekdayNames.generated.js → weekdayHeaderNames.generated.js} +12 -12
  29. package/dist/Carousel/Carousel.d.ts.map +1 -1
  30. package/dist/Carousel/Carousel.js +2 -0
  31. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  32. package/dist/Chat/ChatComposerInput.js +6 -1
  33. package/dist/Chat/ChatMessageList.d.ts.map +1 -1
  34. package/dist/Chat/ChatMessageList.js +2 -1
  35. package/dist/Chat/useChatDictation.d.ts.map +1 -1
  36. package/dist/Chat/useChatDictation.js +2 -0
  37. package/dist/Chat/useChatNewMessages.js +1 -1
  38. package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
  39. package/dist/Chat/useChatStreamScroll.js +2 -0
  40. package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
  41. package/dist/Chat/useSpeechRecognition.js +3 -0
  42. package/dist/Chat/useTriggerMenu.js +1 -1
  43. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  44. package/dist/CheckboxInput/CheckboxInput.js +17 -12
  45. package/dist/CheckboxList/CheckboxList.d.ts +20 -2
  46. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  47. package/dist/CheckboxList/CheckboxList.js +12 -4
  48. package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
  49. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  50. package/dist/CheckboxList/CheckboxListContext.js +2 -1
  51. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  52. package/dist/CheckboxList/CheckboxListItem.js +14 -2
  53. package/dist/CheckboxList/requiredGroup.d.ts +22 -0
  54. package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
  55. package/dist/CheckboxList/requiredGroup.js +52 -0
  56. package/dist/CodeBlock/CodeBlock.d.ts +10 -1
  57. package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
  58. package/dist/CodeBlock/CodeBlock.js +28 -11
  59. package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
  60. package/dist/CommandPalette/CommandPalette.js +2 -0
  61. package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
  62. package/dist/CommandPalette/CommandPaletteItem.js +2 -0
  63. package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
  64. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  65. package/dist/ComplexSelector/ComplexSelector.js +14 -4
  66. package/dist/ContextMenu/ContextMenu.js +2 -2
  67. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  68. package/dist/DateInput/MonthScroller.js +5 -2
  69. package/dist/DateInput/PickerWheel.d.ts +19 -0
  70. package/dist/DateInput/PickerWheel.d.ts.map +1 -0
  71. package/dist/DateInput/PickerWheel.js +646 -0
  72. package/dist/DateInput/TouchDateField.d.ts.map +1 -1
  73. package/dist/DateInput/TouchDateField.js +9 -30
  74. package/dist/DateInput/Wheel.d.ts +18 -37
  75. package/dist/DateInput/Wheel.d.ts.map +1 -1
  76. package/dist/DateInput/Wheel.js +133 -120
  77. package/dist/DateInput/datePickerTouch.d.ts +13 -0
  78. package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
  79. package/dist/DateInput/datePickerTouch.js +14 -0
  80. package/dist/DateInput/useOwnScrollGesture.d.ts +10 -0
  81. package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -1
  82. package/dist/DateInput/useOwnScrollGesture.js +16 -3
  83. package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
  84. package/dist/DateInput/usePointerDragScroll.js +2 -0
  85. package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
  86. package/dist/DateInput/useScrollSettle.js +3 -0
  87. package/dist/DateInput/useWheelListbox.d.ts +59 -0
  88. package/dist/DateInput/useWheelListbox.d.ts.map +1 -0
  89. package/dist/DateInput/useWheelListbox.js +88 -0
  90. package/dist/DateInput/wheelOptions.d.ts +94 -0
  91. package/dist/DateInput/wheelOptions.d.ts.map +1 -0
  92. package/dist/DateInput/wheelOptions.js +110 -0
  93. package/dist/DateInput/wheelPhysics.d.ts +127 -0
  94. package/dist/DateInput/wheelPhysics.d.ts.map +1 -0
  95. package/dist/DateInput/wheelPhysics.js +341 -0
  96. package/dist/DateInput/wheelStrip.d.ts +92 -0
  97. package/dist/DateInput/wheelStrip.d.ts.map +1 -0
  98. package/dist/DateInput/wheelStrip.js +258 -0
  99. package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
  100. package/dist/DateTimeInput/TouchDateTimeField.js +70 -127
  101. package/dist/Dialog/Dialog.d.ts.map +1 -1
  102. package/dist/Dialog/Dialog.js +9 -32
  103. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  104. package/dist/Drawer/useDrawerDialogPresence.js +3 -0
  105. package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
  106. package/dist/DropdownMenu/useMenuOverflow.js +5 -0
  107. package/dist/Field/Field.js +2 -2
  108. package/dist/FieldStatus/useFieldStatusAnnouncement.d.ts.map +1 -1
  109. package/dist/FieldStatus/useFieldStatusAnnouncement.js +1 -0
  110. package/dist/FormLayout/FormLayout.d.ts +5 -1
  111. package/dist/FormLayout/FormLayout.d.ts.map +1 -1
  112. package/dist/HoverCard/HoverCard.d.ts +6 -4
  113. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  114. package/dist/HoverCard/HoverCard.js +48 -3
  115. package/dist/HoverCard/useHoverCard.d.ts +5 -4
  116. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  117. package/dist/HoverCard/useHoverCard.js +26 -34
  118. package/dist/Icon/Icon.d.ts +5 -1
  119. package/dist/Icon/Icon.d.ts.map +1 -1
  120. package/dist/Icon/Icon.js +20 -3
  121. package/dist/InfoTip/InfoTip.d.ts +5 -5
  122. package/dist/InfoTip/InfoTip.d.ts.map +1 -1
  123. package/dist/InfoTip/InfoTip.js +58 -19
  124. package/dist/Item/useSwipeAction.d.ts.map +1 -1
  125. package/dist/Item/useSwipeAction.js +3 -0
  126. package/dist/Layer/modalOutlet.d.ts.map +1 -1
  127. package/dist/Layer/modalOutlet.js +2 -0
  128. package/dist/Layer/outsidePress.d.ts.map +1 -1
  129. package/dist/Layer/outsidePress.js +1 -0
  130. package/dist/Layer/useLayer.d.ts.map +1 -1
  131. package/dist/Layer/useLayer.js +4 -1
  132. package/dist/Layer/useLayerDismissal.d.ts.map +1 -1
  133. package/dist/Layer/useLayerDismissal.js +3 -0
  134. package/dist/Layer/useTouchTrigger.d.ts +13 -7
  135. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  136. package/dist/Layer/useTouchTrigger.js +20 -6
  137. package/dist/Layout/index.d.ts +1 -1
  138. package/dist/Layout/index.d.ts.map +1 -1
  139. package/dist/Layout/index.js +1 -1
  140. package/dist/Layout/layoutReset.js +1 -1
  141. package/dist/Layout/overlayPaddingReset.stylex.d.ts +68 -0
  142. package/dist/Layout/overlayPaddingReset.stylex.d.ts.map +1 -0
  143. package/dist/Layout/overlayPaddingReset.stylex.js +72 -0
  144. package/dist/Layout/padding.stylex.d.ts +5 -129
  145. package/dist/Layout/padding.stylex.d.ts.map +1 -1
  146. package/dist/Layout/padding.stylex.js +9 -143
  147. package/dist/Layout/paddingStyles.stylex.d.ts +83 -0
  148. package/dist/Layout/paddingStyles.stylex.d.ts.map +1 -0
  149. package/dist/Layout/paddingStyles.stylex.js +99 -0
  150. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  151. package/dist/Lightbox/Lightbox.js +20 -1
  152. package/dist/MobileNav/MobileNav.d.ts +3 -2
  153. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  154. package/dist/MobileNav/MobileNav.js +10 -26
  155. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  156. package/dist/MultiSelector/MultiSelector.js +2 -1
  157. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  158. package/dist/NumberInput/NumberInput.js +2 -1
  159. package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
  160. package/dist/Outline/useOutlineFromDOM.js +3 -0
  161. package/dist/Outline/useScrollSpy.d.ts.map +1 -1
  162. package/dist/Outline/useScrollSpy.js +3 -0
  163. package/dist/OverflowList/OverflowList.d.ts.map +1 -1
  164. package/dist/OverflowList/OverflowList.js +3 -0
  165. package/dist/Overlay/Overlay.d.ts.map +1 -1
  166. package/dist/Overlay/Overlay.js +7 -2
  167. package/dist/Popover/Popover.d.ts.map +1 -1
  168. package/dist/Popover/Popover.js +6 -0
  169. package/dist/Popover/usePopover.js +2 -2
  170. package/dist/PowerSearch/PowerSearch.d.ts +41 -4
  171. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  172. package/dist/PowerSearch/PowerSearch.js +441 -134
  173. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +125 -0
  174. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
  175. package/dist/PowerSearch/PowerSearchBottomSheet.js +2041 -0
  176. package/dist/PowerSearch/PowerSearchEditPopover.d.ts +35 -2
  177. package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
  178. package/dist/PowerSearch/PowerSearchEditPopover.js +43 -10
  179. package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
  180. package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
  181. package/dist/PowerSearch/PowerSearchFilterEditor.js +4 -2
  182. package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
  183. package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
  184. package/dist/PowerSearch/PowerSearchToken.js +3 -2
  185. package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
  186. package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
  187. package/dist/PowerSearch/PowerSearchValueEditor.js +273 -86
  188. package/dist/PowerSearch/formatFilterValue.d.ts +14 -7
  189. package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
  190. package/dist/PowerSearch/formatFilterValue.js +31 -23
  191. package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
  192. package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
  193. package/dist/PowerSearch/formatTokenValue.js +161 -0
  194. package/dist/PowerSearch/index.d.ts +1 -1
  195. package/dist/PowerSearch/index.d.ts.map +1 -1
  196. package/dist/PowerSearch/powerSearchDateZone.d.ts +25 -0
  197. package/dist/PowerSearch/powerSearchDateZone.d.ts.map +1 -0
  198. package/dist/PowerSearch/powerSearchDateZone.js +57 -0
  199. package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
  200. package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
  201. package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
  202. package/dist/PowerSearch/types.d.ts +8 -1
  203. package/dist/PowerSearch/types.d.ts.map +1 -1
  204. package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -1
  205. package/dist/ProgressBar/ProgressBarTouch.js +2 -0
  206. package/dist/RadioList/RadioList.d.ts.map +1 -1
  207. package/dist/RadioList/RadioList.js +3 -2
  208. package/dist/RadioList/RadioListItem.d.ts +1 -1
  209. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  210. package/dist/RadioList/RadioListItem.js +5 -3
  211. package/dist/Resizable/ResizeHandle.d.ts +2 -1
  212. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  213. package/dist/Resizable/ResizeHandle.js +116 -92
  214. package/dist/Resizable/createResizable.d.ts +199 -0
  215. package/dist/Resizable/createResizable.d.ts.map +1 -0
  216. package/dist/Resizable/createResizable.js +733 -0
  217. package/dist/Resizable/separatorAttributes.d.ts +45 -0
  218. package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
  219. package/dist/Resizable/separatorAttributes.js +35 -0
  220. package/dist/Resizable/useResizable.d.ts +3 -3
  221. package/dist/Resizable/useResizable.d.ts.map +1 -1
  222. package/dist/Resizable/useResizable.js +252 -459
  223. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
  224. package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
  225. package/dist/SelectableCard/SelectableCard.d.ts +2 -0
  226. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  227. package/dist/SelectableCard/SelectableCard.js +36 -11
  228. package/dist/SelectableCard/selectableCardInput.d.ts +12 -0
  229. package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -0
  230. package/dist/SelectableCard/selectableCardInput.js +20 -0
  231. package/dist/Selector/Selector.d.ts.map +1 -1
  232. package/dist/Selector/Selector.js +7 -9
  233. package/dist/SideNav/SideNav.d.ts.map +1 -1
  234. package/dist/SideNav/SideNav.js +36 -5
  235. package/dist/Slider/Slider.d.ts.map +1 -1
  236. package/dist/Slider/Slider.js +16 -11
  237. package/dist/Slider/sliderTouchController.js +2 -2
  238. package/dist/Spinner/Spinner.d.ts +1 -1
  239. package/dist/Spinner/Spinner.d.ts.map +1 -1
  240. package/dist/Spinner/Spinner.js +60 -58
  241. package/dist/Stepper/Stepper.d.ts.map +1 -1
  242. package/dist/Stepper/Stepper.js +10 -15
  243. package/dist/Switch/Switch.d.ts.map +1 -1
  244. package/dist/Switch/Switch.js +4 -10
  245. package/dist/Switch/useSwitchTouch.js +4 -4
  246. package/dist/Table/BaseTable.d.ts.map +1 -1
  247. package/dist/Table/BaseTable.js +29 -8
  248. package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
  249. package/dist/Table/plugins/columnResize/useTableColumnResize.js +3 -1
  250. package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
  251. package/dist/Table/plugins/filtering/useTableFiltering.js +2 -1
  252. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +12 -0
  253. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  254. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +17 -3
  255. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
  256. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -0
  257. package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
  258. package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
  259. package/dist/Table/plugins/tree/useTableTreeData.js +27 -14
  260. package/dist/TextArea/TextArea.d.ts.map +1 -1
  261. package/dist/TextArea/TextArea.js +2 -1
  262. package/dist/TextInput/TextInput.d.ts +2 -2
  263. package/dist/TextInput/TextInput.d.ts.map +1 -1
  264. package/dist/TextInput/TextInput.js +12 -8
  265. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  266. package/dist/TimeInput/TimeInput.js +2 -0
  267. package/dist/TimeInput/TimeWheels.d.ts +32 -0
  268. package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
  269. package/dist/TimeInput/TimeWheels.js +144 -0
  270. package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
  271. package/dist/TimeInput/TouchTimeField.js +63 -116
  272. package/dist/TimeInput/timeWheelRules.d.ts +124 -0
  273. package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
  274. package/dist/TimeInput/timeWheelRules.js +277 -0
  275. package/dist/Timer/Timer.d.ts.map +1 -1
  276. package/dist/Timer/Timer.js +2 -0
  277. package/dist/Timestamp/Timestamp.js +1 -1
  278. package/dist/Timestamp/formatInstant.d.ts.map +1 -1
  279. package/dist/Timestamp/formatInstant.js +1 -23
  280. package/dist/Toast/Toast.d.ts +11 -1
  281. package/dist/Toast/Toast.d.ts.map +1 -1
  282. package/dist/Toast/Toast.js +25 -15
  283. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  284. package/dist/Toast/ToastViewport.js +97 -34
  285. package/dist/Toast/types.d.ts +9 -3
  286. package/dist/Toast/types.d.ts.map +1 -1
  287. package/dist/Toast/useToast.d.ts.map +1 -1
  288. package/dist/Toast/useToast.js +1 -0
  289. package/dist/Tokenizer/Tokenizer.d.ts +44 -46
  290. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  291. package/dist/Tokenizer/Tokenizer.js +20 -21
  292. package/dist/Tokenizer/TokenizerBottomSheet.d.ts +1 -1
  293. package/dist/Tokenizer/TokenizerBottomSheet.js +12 -18
  294. package/dist/Tokenizer/index.d.ts +1 -1
  295. package/dist/Tokenizer/index.d.ts.map +1 -1
  296. package/dist/Tooltip/Tooltip.d.ts +2 -23
  297. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  298. package/dist/Tooltip/Tooltip.js +5 -29
  299. package/dist/Tooltip/useTooltip.d.ts +23 -30
  300. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  301. package/dist/Tooltip/useTooltip.js +200 -108
  302. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  303. package/dist/Typeahead/BaseTypeahead.js +27 -18
  304. package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
  305. package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
  306. package/dist/animator/createAnimator.d.ts +98 -0
  307. package/dist/animator/createAnimator.d.ts.map +1 -0
  308. package/dist/animator/createAnimator.js +259 -0
  309. package/dist/astryx.css +53 -8
  310. package/dist/gestures/GestureHost.d.ts +16 -1
  311. package/dist/gestures/GestureHost.d.ts.map +1 -1
  312. package/dist/gestures/GestureHost.js +4 -1
  313. package/dist/gestures/PressTracker.d.ts.map +1 -1
  314. package/dist/gestures/PressTracker.js +4 -3
  315. package/dist/hooks/ModalAnnounceProvider.d.ts.map +1 -1
  316. package/dist/hooks/ModalAnnounceProvider.js +1 -0
  317. package/dist/hooks/actionGroupTracker.d.ts +4 -1
  318. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  319. package/dist/hooks/actionGroupTracker.js +18 -7
  320. package/dist/hooks/index.d.ts +1 -0
  321. package/dist/hooks/index.d.ts.map +1 -1
  322. package/dist/hooks/index.js +1 -0
  323. package/dist/hooks/longPressDetector.d.ts +66 -0
  324. package/dist/hooks/longPressDetector.d.ts.map +1 -0
  325. package/dist/hooks/longPressDetector.js +200 -0
  326. package/dist/hooks/pressGroupContext.d.ts +6 -0
  327. package/dist/hooks/pressGroupContext.d.ts.map +1 -0
  328. package/dist/hooks/pressGroupContext.js +20 -0
  329. package/dist/hooks/rootScrollStyles.d.ts +48 -0
  330. package/dist/hooks/rootScrollStyles.d.ts.map +1 -0
  331. package/dist/hooks/rootScrollStyles.js +207 -0
  332. package/dist/hooks/scrollLockTouchGuard.d.ts +13 -0
  333. package/dist/hooks/scrollLockTouchGuard.d.ts.map +1 -0
  334. package/dist/hooks/scrollLockTouchGuard.js +117 -0
  335. package/dist/hooks/scrollbarGutter.d.ts +4 -4
  336. package/dist/hooks/scrollbarGutter.d.ts.map +1 -1
  337. package/dist/hooks/scrollbarGutter.js +36 -23
  338. package/dist/hooks/useActionGroupTracking.d.ts +53 -0
  339. package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
  340. package/dist/hooks/useActionGroupTracking.js +174 -0
  341. package/dist/hooks/useAnimator.d.ts +41 -0
  342. package/dist/hooks/useAnimator.d.ts.map +1 -0
  343. package/dist/hooks/useAnimator.js +70 -0
  344. package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
  345. package/dist/hooks/useAnnounceRenderedText.js +1 -0
  346. package/dist/hooks/useAttachment.d.ts +1 -1
  347. package/dist/hooks/useAttachment.js +1 -1
  348. package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
  349. package/dist/hooks/useAutoMediaMode.js +1 -0
  350. package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
  351. package/dist/hooks/useBusyAnnouncement.js +2 -0
  352. package/dist/hooks/useDevWarning.d.ts.map +1 -1
  353. package/dist/hooks/useDevWarning.js +2 -0
  354. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  355. package/dist/hooks/useFocusTrap.js +2 -0
  356. package/dist/hooks/useGridFocus.d.ts +8 -5
  357. package/dist/hooks/useGridFocus.d.ts.map +1 -1
  358. package/dist/hooks/useGridFocus.js +4 -3
  359. package/dist/hooks/useHotkeys.d.ts.map +1 -1
  360. package/dist/hooks/useHotkeys.js +3 -0
  361. package/dist/hooks/useImageMode.d.ts.map +1 -1
  362. package/dist/hooks/useImageMode.js +3 -0
  363. package/dist/hooks/useInputStatusIcon.d.ts +1 -1
  364. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  365. package/dist/hooks/useInputStatusIcon.js +2 -2
  366. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  367. package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
  368. package/dist/hooks/useKeyboardHint.js +1 -1
  369. package/dist/hooks/useLongPress.d.ts +8 -9
  370. package/dist/hooks/useLongPress.d.ts.map +1 -1
  371. package/dist/hooks/useLongPress.js +23 -106
  372. package/dist/hooks/useMenuHover.d.ts.map +1 -1
  373. package/dist/hooks/useMenuHover.js +2 -0
  374. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  375. package/dist/hooks/useMenuPress.js +3 -0
  376. package/dist/hooks/useOverflow.d.ts.map +1 -1
  377. package/dist/hooks/useOverflow.js +2 -1
  378. package/dist/hooks/usePressFeedback.d.ts.map +1 -1
  379. package/dist/hooks/usePressFeedback.js +1 -0
  380. package/dist/hooks/useResolvedRequired.d.ts +3 -0
  381. package/dist/hooks/useResolvedRequired.d.ts.map +1 -1
  382. package/dist/hooks/useResolvedRequired.js +3 -0
  383. package/dist/hooks/useScrollLock.d.ts +8 -9
  384. package/dist/hooks/useScrollLock.d.ts.map +1 -1
  385. package/dist/hooks/useScrollLock.js +50 -48
  386. package/dist/hooks/useScrollableArea.d.ts.map +1 -1
  387. package/dist/hooks/useScrollableArea.js +5 -0
  388. package/dist/hooks/useStreamingText.d.ts.map +1 -1
  389. package/dist/hooks/useStreamingText.js +3 -0
  390. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
  391. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
  392. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +45 -0
  393. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
  394. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
  395. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
  396. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
  397. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
  398. package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
  399. package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
  400. package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
  401. package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.d.ts.map +1 -1
  402. package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.js +3 -1
  403. package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.d.ts.map +1 -1
  404. package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.js +3 -1
  405. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
  406. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
  407. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
  408. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  409. package/dist/i18n/generated-locales/en.generated.js +37 -0
  410. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  411. package/dist/i18n/generated-locales/pseudo.generated.js +37 -0
  412. package/dist/index.d.ts +1 -0
  413. package/dist/index.d.ts.map +1 -1
  414. package/dist/index.js +4 -0
  415. package/dist/internal/indicatorPress.stylex.d.ts +20 -0
  416. package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
  417. package/dist/internal/indicatorPress.stylex.js +26 -0
  418. package/dist/internal/selectable-card.d.ts +21 -0
  419. package/dist/internal/selectable-card.d.ts.map +1 -0
  420. package/dist/internal/selectable-card.js +20 -0
  421. package/dist/internal/sheetDraft.d.ts +2 -2
  422. package/dist/internal/sheetDraft.js +2 -2
  423. package/dist/keyboard/index.d.ts +17 -0
  424. package/dist/keyboard/index.d.ts.map +1 -0
  425. package/dist/keyboard/index.js +19 -0
  426. package/dist/keyboard/keyboardHeight.d.ts +149 -0
  427. package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
  428. package/dist/keyboard/keyboardHeight.js +432 -0
  429. package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
  430. package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
  431. package/dist/keyboard/keyboardLayoutGuide.js +207 -0
  432. package/dist/keyboard/keyboardModel.d.ts +93 -0
  433. package/dist/keyboard/keyboardModel.d.ts.map +1 -0
  434. package/dist/keyboard/keyboardModel.js +220 -0
  435. package/dist/keyboard/rideKeyboard.d.ts +42 -0
  436. package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
  437. package/dist/keyboard/rideKeyboard.js +77 -0
  438. package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
  439. package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
  440. package/dist/keyboard/useMobileKeyboard.js +699 -0
  441. package/dist/motion/android/index.d.ts +16 -0
  442. package/dist/motion/android/index.d.ts.map +1 -0
  443. package/dist/motion/android/index.js +18 -0
  444. package/dist/motion/android/keyboard.d.ts +83 -0
  445. package/dist/motion/android/keyboard.d.ts.map +1 -0
  446. package/dist/motion/android/keyboard.js +96 -0
  447. package/dist/motion/animatedLayout.d.ts +8 -0
  448. package/dist/motion/animatedLayout.d.ts.map +1 -1
  449. package/dist/motion/animatedLayout.js +246 -53
  450. package/dist/motion/animator.d.ts +14 -14
  451. package/dist/motion/animator.d.ts.map +1 -1
  452. package/dist/motion/animator.js +45 -26
  453. package/dist/motion/frameBlock.d.ts +14 -0
  454. package/dist/motion/frameBlock.d.ts.map +1 -0
  455. package/dist/motion/frameBlock.js +16 -0
  456. package/dist/motion/progress.d.ts +88 -0
  457. package/dist/motion/progress.d.ts.map +1 -0
  458. package/dist/motion/progress.js +128 -0
  459. package/dist/motion/reducedMotion.d.ts.map +1 -1
  460. package/dist/motion/reducedMotion.js +3 -1
  461. package/dist/motion/uikit/alert.d.ts +41 -0
  462. package/dist/motion/uikit/alert.d.ts.map +1 -0
  463. package/dist/motion/uikit/alert.js +43 -0
  464. package/dist/motion/uikit/datePicker.d.ts +58 -0
  465. package/dist/motion/uikit/datePicker.d.ts.map +1 -0
  466. package/dist/motion/uikit/datePicker.js +60 -0
  467. package/dist/motion/uikit/index.d.ts +6 -4
  468. package/dist/motion/uikit/index.d.ts.map +1 -1
  469. package/dist/motion/uikit/index.js +6 -4
  470. package/dist/motion/uikit/picker.d.ts +96 -0
  471. package/dist/motion/uikit/picker.d.ts.map +1 -0
  472. package/dist/motion/uikit/picker.js +117 -0
  473. package/dist/privateAttributes/pressGroupItem.stylex.d.ts +22 -0
  474. package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
  475. package/dist/privateAttributes/pressGroupItem.stylex.js +36 -0
  476. package/dist/privateAttributes/reducedMotion.stylex.d.ts +23 -0
  477. package/dist/privateAttributes/reducedMotion.stylex.d.ts.map +1 -0
  478. package/dist/privateAttributes/reducedMotion.stylex.js +40 -0
  479. package/dist/theme/Theme.d.ts.map +1 -1
  480. package/dist/theme/Theme.js +29 -4
  481. package/dist/theme/generateThemeRules.d.ts.map +1 -1
  482. package/dist/theme/generateThemeRules.js +14 -13
  483. package/dist/theme/motionKnobs.d.ts +4 -3
  484. package/dist/theme/motionKnobs.d.ts.map +1 -1
  485. package/dist/theme/motionKnobs.js +3 -2
  486. package/dist/theme/themeMotion.d.ts +6 -0
  487. package/dist/theme/themeMotion.d.ts.map +1 -1
  488. package/dist/theme/themeMotion.js +15 -2
  489. package/dist/theme/tokens.stylex.d.ts +3 -0
  490. package/dist/theme/tokens.stylex.d.ts.map +1 -1
  491. package/dist/theme/tokens.stylex.js +4 -1
  492. package/dist/utils/dateParser.d.ts.map +1 -1
  493. package/dist/utils/dateParser.js +12 -0
  494. package/dist/utils/disabledInteraction.d.ts +10 -2
  495. package/dist/utils/disabledInteraction.d.ts.map +1 -1
  496. package/dist/utils/disabledInteraction.js +16 -2
  497. package/dist/utils/focusReturn.d.ts +22 -25
  498. package/dist/utils/focusReturn.d.ts.map +1 -1
  499. package/dist/utils/focusReturn.js +36 -29
  500. package/dist/utils/index.d.ts +1 -1
  501. package/dist/utils/index.d.ts.map +1 -1
  502. package/dist/utils/index.js +1 -1
  503. package/dist/utils/interactionModality.d.ts.map +1 -1
  504. package/dist/utils/interactionModality.js +4 -0
  505. package/dist/utils/interactionOverlay.stylex.d.ts +6 -4
  506. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  507. package/dist/utils/interactionOverlay.stylex.js +6 -4
  508. package/dist/utils/isFocusDetached.d.ts +27 -0
  509. package/dist/utils/isFocusDetached.d.ts.map +1 -0
  510. package/dist/utils/isFocusDetached.js +32 -0
  511. package/dist/utils/layoutViewport.d.ts +25 -0
  512. package/dist/utils/layoutViewport.d.ts.map +1 -0
  513. package/dist/utils/layoutViewport.js +102 -0
  514. package/dist/utils/plainDate.d.ts +31 -0
  515. package/dist/utils/plainDate.d.ts.map +1 -1
  516. package/dist/utils/plainDate.js +68 -4
  517. package/dist/utils/pressFeedback.d.ts +6 -0
  518. package/dist/utils/pressFeedback.d.ts.map +1 -1
  519. package/dist/utils/pressFeedback.js +97 -18
  520. package/dist/utils/pressGesture.d.ts +4 -2
  521. package/dist/utils/pressGesture.d.ts.map +1 -1
  522. package/dist/utils/pressGesture.js +3 -1
  523. package/dist/utils/selectionLock.d.ts +10 -1
  524. package/dist/utils/selectionLock.d.ts.map +1 -1
  525. package/dist/utils/selectionLock.js +31 -5
  526. package/dist/utils/sharedMutationObserver.d.ts +2 -1
  527. package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
  528. package/dist/utils/sharedMutationObserver.js +2 -1
  529. package/dist/utils/timeParser.d.ts +2 -1
  530. package/dist/utils/timeParser.d.ts.map +1 -1
  531. package/dist/utils/timeParser.js +29 -3
  532. package/dist/utils/triggerFocus.d.ts +36 -0
  533. package/dist/utils/triggerFocus.d.ts.map +1 -0
  534. package/dist/utils/triggerFocus.js +65 -0
  535. package/locales/en.json +148 -0
  536. package/locales/pseudo.json +111 -0
  537. package/package.json +14 -9
  538. package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
  539. package/src/AlertDialog/AlertDialog.tsx +46 -5
  540. package/src/AppShell/AppShell.tsx +13 -4
  541. package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
  542. package/src/BottomSheet/BottomSheet.tsx +1 -0
  543. package/src/BottomSheet/BottomSheetPanel.tsx +80 -16
  544. package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
  545. package/src/BottomSheet/BottomSheetSwitcher.tsx +5 -0
  546. package/src/BottomSheet/bottomSheetStack.ts +1 -1
  547. package/src/BottomSheet/useSheetGestures.ts +16 -1
  548. package/src/Button/Button.tsx +26 -4
  549. package/src/Calendar/Calendar.tsx +40 -32
  550. package/src/Calendar/getWeekdayHeaderNames.ts +88 -0
  551. package/src/Calendar/hooks/useCalendarDays.ts +5 -10
  552. package/src/Calendar/{standaloneShortWeekdayNames.generated.ts → weekdayHeaderNames.generated.ts} +14 -14
  553. package/src/Carousel/Carousel.tsx +1 -0
  554. package/src/Chat/ChatComposerInput.tsx +4 -7
  555. package/src/Chat/ChatMessageList.tsx +2 -1
  556. package/src/Chat/useChatDictation.ts +1 -0
  557. package/src/Chat/useChatNewMessages.ts +1 -1
  558. package/src/Chat/useChatStreamScroll.ts +2 -0
  559. package/src/Chat/useSpeechRecognition.ts +2 -0
  560. package/src/Chat/useTriggerMenu.tsx +1 -1
  561. package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
  562. package/src/CheckboxInput/CheckboxInput.tsx +38 -15
  563. package/src/CheckboxList/CheckboxList.doc.mjs +14 -0
  564. package/src/CheckboxList/CheckboxList.tsx +43 -2
  565. package/src/CheckboxList/CheckboxListContext.tsx +9 -1
  566. package/src/CheckboxList/CheckboxListItem.tsx +23 -2
  567. package/src/CheckboxList/requiredGroup.ts +77 -0
  568. package/src/CodeBlock/CodeBlock.doc.mjs +9 -1
  569. package/src/CodeBlock/CodeBlock.tsx +41 -4
  570. package/src/CommandPalette/CommandPalette.tsx +1 -0
  571. package/src/CommandPalette/CommandPaletteItem.tsx +1 -0
  572. package/src/ComplexSelector/ComplexSelector.tsx +20 -5
  573. package/src/ContextMenu/ContextMenu.tsx +2 -2
  574. package/src/DateInput/MonthScroller.tsx +8 -2
  575. package/src/DateInput/PickerWheel.tsx +796 -0
  576. package/src/DateInput/TouchDateField.tsx +6 -32
  577. package/src/DateInput/Wheel.tsx +188 -171
  578. package/src/DateInput/datePickerTouch.ts +15 -0
  579. package/src/DateInput/useOwnScrollGesture.ts +25 -3
  580. package/src/DateInput/usePointerDragScroll.ts +1 -0
  581. package/src/DateInput/useScrollSettle.ts +2 -0
  582. package/src/DateInput/useWheelListbox.ts +112 -0
  583. package/src/DateInput/wheelOptions.ts +184 -0
  584. package/src/DateInput/wheelPhysics.ts +406 -0
  585. package/src/DateInput/wheelStrip.ts +341 -0
  586. package/src/DateTimeInput/TouchDateTimeField.tsx +100 -189
  587. package/src/Dialog/Dialog.tsx +12 -32
  588. package/src/Drawer/useDrawerDialogPresence.ts +2 -0
  589. package/src/DropdownMenu/useMenuOverflow.ts +3 -0
  590. package/src/Field/Field.tsx +2 -2
  591. package/src/FieldStatus/useFieldStatusAnnouncement.ts +1 -0
  592. package/src/FormLayout/FormLayout.doc.mjs +181 -46
  593. package/src/FormLayout/FormLayout.tsx +5 -1
  594. package/src/HoverCard/HoverCard.doc.mjs +10 -8
  595. package/src/HoverCard/HoverCard.tsx +58 -6
  596. package/src/HoverCard/useHoverCard.doc.mjs +178 -36
  597. package/src/HoverCard/useHoverCard.tsx +55 -55
  598. package/src/Icon/Icon.doc.mjs +51 -10
  599. package/src/Icon/Icon.tsx +31 -8
  600. package/src/IconButton/IconButton.doc.mjs +141 -21
  601. package/src/InfoTip/InfoTip.tsx +72 -16
  602. package/src/Item/useSwipeAction.ts +2 -0
  603. package/src/Layer/modalOutlet.ts +2 -0
  604. package/src/Layer/outsidePress.ts +1 -0
  605. package/src/Layer/useLayer.tsx +3 -1
  606. package/src/Layer/useLayerDismissal.ts +2 -0
  607. package/src/Layer/useTouchTrigger.ts +19 -6
  608. package/src/Layout/index.ts +1 -1
  609. package/src/Layout/layoutReset.ts +1 -1
  610. package/src/Layout/overlayPaddingReset.stylex.ts +73 -0
  611. package/src/Layout/padding.stylex.ts +9 -133
  612. package/src/Layout/paddingStyles.stylex.ts +87 -0
  613. package/src/Lightbox/Lightbox.tsx +20 -1
  614. package/src/Lightbox/useLightbox.doc.mjs +167 -0
  615. package/src/MobileNav/MobileNav.tsx +10 -31
  616. package/src/MultiSelector/MultiSelector.tsx +2 -7
  617. package/src/NumberInput/NumberInput.tsx +2 -7
  618. package/src/Outline/useOutlineFromDOM.ts +2 -0
  619. package/src/Outline/useScrollSpy.ts +2 -0
  620. package/src/OverflowList/OverflowList.tsx +2 -0
  621. package/src/Overlay/Overlay.tsx +7 -2
  622. package/src/Popover/Popover.tsx +4 -0
  623. package/src/Popover/usePopover.tsx +2 -2
  624. package/src/PowerSearch/PowerSearch.doc.mjs +60 -8
  625. package/src/PowerSearch/PowerSearch.tsx +622 -157
  626. package/src/PowerSearch/PowerSearchBottomSheet.tsx +2700 -0
  627. package/src/PowerSearch/PowerSearchEditPopover.tsx +65 -9
  628. package/src/PowerSearch/PowerSearchFilterEditor.tsx +2 -0
  629. package/src/PowerSearch/PowerSearchToken.tsx +2 -0
  630. package/src/PowerSearch/PowerSearchValueEditor.tsx +340 -59
  631. package/src/PowerSearch/formatFilterValue.ts +49 -27
  632. package/src/PowerSearch/formatTokenValue.ts +220 -0
  633. package/src/PowerSearch/index.ts +5 -1
  634. package/src/PowerSearch/powerSearchDateZone.ts +95 -0
  635. package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
  636. package/src/PowerSearch/types.ts +8 -1
  637. package/src/ProgressBar/ProgressBarTouch.ts +2 -0
  638. package/src/RadioList/RadioList.tsx +3 -2
  639. package/src/RadioList/RadioListItem.tsx +5 -3
  640. package/src/Resizable/Resizable.doc.mjs +5 -4
  641. package/src/Resizable/ResizeHandle.tsx +187 -135
  642. package/src/Resizable/createResizable.ts +1046 -0
  643. package/src/Resizable/separatorAttributes.ts +73 -0
  644. package/src/Resizable/useResizable.ts +292 -623
  645. package/src/SegmentedControl/useSegmentedSelectionMotion.ts +6 -3
  646. package/src/SelectableCard/SelectableCard.tsx +39 -10
  647. package/src/SelectableCard/selectableCardInput.ts +30 -0
  648. package/src/Selector/Selector.tsx +7 -19
  649. package/src/SideNav/SideNav.tsx +41 -5
  650. package/src/Slider/Slider.tsx +20 -11
  651. package/src/Slider/sliderTouchController.ts +2 -2
  652. package/src/Spinner/Spinner.tsx +77 -63
  653. package/src/Stepper/Stepper.tsx +10 -27
  654. package/src/Switch/Switch.tsx +2 -6
  655. package/src/Switch/useSwitchTouch.ts +4 -4
  656. package/src/Table/BaseTable.tsx +46 -12
  657. package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
  658. package/src/Table/plugins/filtering/useTableFiltering.tsx +1 -0
  659. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +31 -7
  660. package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +2 -0
  661. package/src/Table/plugins/tree/useTableTreeData.tsx +43 -20
  662. package/src/Table/useTableRowExpansion.doc.mjs +9 -0
  663. package/src/Table/useTableTreeData.doc.mjs +15 -3
  664. package/src/TextArea/TextArea.tsx +2 -7
  665. package/src/TextInput/TextInput.tsx +13 -17
  666. package/src/TimeInput/TimeInput.tsx +2 -0
  667. package/src/TimeInput/TimeWheels.tsx +218 -0
  668. package/src/TimeInput/TouchTimeField.tsx +93 -155
  669. package/src/TimeInput/timeWheelRules.ts +352 -0
  670. package/src/Timer/Timer.tsx +1 -0
  671. package/src/Timestamp/Timestamp.tsx +1 -1
  672. package/src/Timestamp/formatInstant.ts +1 -33
  673. package/src/Toast/Toast.doc.mjs +4 -3
  674. package/src/Toast/Toast.tsx +52 -32
  675. package/src/Toast/ToastViewport.tsx +123 -35
  676. package/src/Toast/types.ts +9 -3
  677. package/src/Toast/useToast.tsx +1 -0
  678. package/src/Tokenizer/Tokenizer.doc.mjs +10 -10
  679. package/src/Tokenizer/Tokenizer.tsx +61 -62
  680. package/src/Tokenizer/TokenizerBottomSheet.tsx +17 -23
  681. package/src/Tokenizer/index.ts +1 -0
  682. package/src/Tooltip/Tooltip.tsx +6 -42
  683. package/src/Tooltip/useTooltip.doc.mjs +24 -0
  684. package/src/Tooltip/useTooltip.tsx +243 -134
  685. package/src/Typeahead/BaseTypeahead.tsx +27 -17
  686. package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
  687. package/src/Typeahead/TypeaheadItem.tsx +2 -1
  688. package/src/animator/createAnimator.doc.mjs +153 -0
  689. package/src/animator/createAnimator.ts +324 -0
  690. package/src/gestures/GestureHost.ts +6 -5
  691. package/src/gestures/PressTracker.ts +4 -3
  692. package/src/gestures/README.md +10 -4
  693. package/src/hooks/ModalAnnounceProvider.tsx +1 -0
  694. package/src/hooks/actionGroupTracker.ts +25 -9
  695. package/src/hooks/index.ts +2 -0
  696. package/src/hooks/longPressDetector.ts +273 -0
  697. package/src/hooks/pressGroupContext.ts +21 -0
  698. package/src/hooks/rootScrollStyles.ts +247 -0
  699. package/src/hooks/scrollLockTouchGuard.ts +149 -0
  700. package/src/hooks/scrollbarGutter.ts +41 -26
  701. package/src/hooks/useActionGroupTracking.ts +224 -0
  702. package/src/hooks/useAnimator.doc.mjs +109 -0
  703. package/src/hooks/useAnimator.ts +67 -0
  704. package/src/hooks/useAnnounceRenderedText.ts +1 -0
  705. package/src/hooks/useAttachment.ts +1 -1
  706. package/src/hooks/useAutoMediaMode.ts +1 -0
  707. package/src/hooks/useBusyAnnouncement.ts +2 -0
  708. package/src/hooks/useDevWarning.ts +2 -0
  709. package/src/hooks/useFocusTrap.ts +2 -0
  710. package/src/hooks/useGridFocus.doc.mjs +6 -6
  711. package/src/hooks/useGridFocus.ts +10 -7
  712. package/src/hooks/useHotkeys.ts +2 -0
  713. package/src/hooks/useImageMode.ts +2 -0
  714. package/src/hooks/useInputStatusIcon.tsx +3 -2
  715. package/src/hooks/useKeyboardHint.tsx +1 -1
  716. package/src/hooks/useLongPress.doc.mjs +2 -2
  717. package/src/hooks/useLongPress.ts +32 -122
  718. package/src/hooks/useMenuHover.ts +1 -0
  719. package/src/hooks/useMenuPress.ts +2 -0
  720. package/src/hooks/useOverflow.ts +2 -1
  721. package/src/hooks/usePressFeedback.ts +1 -0
  722. package/src/hooks/useResolvedRequired.ts +3 -0
  723. package/src/hooks/useScrollLock.doc.mjs +51 -12
  724. package/src/hooks/useScrollLock.ts +53 -60
  725. package/src/hooks/useScrollableArea.ts +4 -0
  726. package/src/hooks/useStreamingText.ts +2 -0
  727. package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +46 -0
  728. package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
  729. package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
  730. package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
  731. package/src/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.ts +3 -1
  732. package/src/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.ts +3 -1
  733. package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
  734. package/src/i18n/generated-locales/en.generated.ts +47 -0
  735. package/src/i18n/generated-locales/pseudo.generated.ts +48 -0
  736. package/src/index.ts +13 -0
  737. package/src/internal/indicatorPress.stylex.ts +24 -0
  738. package/src/internal/selectable-card.ts +21 -0
  739. package/src/internal/sheetDraft.ts +2 -2
  740. package/src/keyboard/README.md +197 -0
  741. package/src/keyboard/index.ts +48 -0
  742. package/src/keyboard/keyboardHeight.ts +543 -0
  743. package/src/keyboard/keyboardLayoutGuide.ts +266 -0
  744. package/src/keyboard/keyboardModel.ts +301 -0
  745. package/src/keyboard/rideKeyboard.ts +100 -0
  746. package/src/keyboard/useMobileKeyboard.ts +866 -0
  747. package/src/motion/MEASUREMENTS.md +28 -0
  748. package/src/motion/README.md +12 -5
  749. package/src/motion/android/index.ts +18 -0
  750. package/src/motion/android/keyboard.ts +96 -0
  751. package/src/motion/animatedLayout.ts +323 -60
  752. package/src/motion/animator.ts +66 -37
  753. package/src/motion/frameBlock.ts +16 -0
  754. package/src/motion/progress.ts +155 -0
  755. package/src/motion/reducedMotion.ts +3 -1
  756. package/src/motion/uikit/alert.ts +43 -0
  757. package/src/motion/uikit/datePicker.ts +60 -0
  758. package/src/motion/uikit/index.ts +6 -4
  759. package/src/motion/uikit/picker.ts +116 -0
  760. package/src/privateAttributes/pressGroupItem.stylex.ts +44 -0
  761. package/src/privateAttributes/reducedMotion.stylex.ts +45 -0
  762. package/src/theme/Theme.tsx +37 -3
  763. package/src/theme/generateThemeRules.ts +14 -12
  764. package/src/theme/motionKnobs.ts +4 -3
  765. package/src/theme/themeMotion.ts +17 -2
  766. package/src/theme/tokens.stylex.ts +2 -0
  767. package/src/utils/dateParser.ts +16 -0
  768. package/src/utils/disabledInteraction.ts +23 -2
  769. package/src/utils/focusReturn.ts +38 -31
  770. package/src/utils/index.ts +1 -1
  771. package/src/utils/interactionModality.ts +4 -0
  772. package/src/utils/interactionOverlay.stylex.ts +6 -4
  773. package/src/utils/isFocusDetached.ts +34 -0
  774. package/src/utils/layoutViewport.ts +104 -0
  775. package/src/utils/plainDate.ts +80 -4
  776. package/src/utils/pressFeedback.ts +126 -30
  777. package/src/utils/pressGesture.ts +4 -2
  778. package/src/utils/selectionLock.ts +40 -6
  779. package/src/utils/sharedMutationObserver.ts +2 -1
  780. package/src/utils/timeParser.ts +40 -3
  781. package/src/utils/triggerFocus.ts +80 -0
  782. package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
  783. package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
  784. package/dist/BottomSheet/useMobileKeyboard.js +0 -407
  785. package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +0 -14
  786. package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +0 -1
  787. package/dist/Calendar/getStandaloneShortWeekdayNames.js +0 -26
  788. package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +0 -1
  789. package/dist/Layer/usePressPin.d.ts +0 -93
  790. package/dist/Layer/usePressPin.d.ts.map +0 -1
  791. package/dist/Layer/usePressPin.js +0 -363
  792. package/dist/internal/touch-sheet.d.ts +0 -21
  793. package/dist/internal/touch-sheet.d.ts.map +0 -1
  794. package/dist/internal/touch-sheet.js +0 -19
  795. package/src/BottomSheet/useMobileKeyboard.ts +0 -538
  796. package/src/Calendar/getStandaloneShortWeekdayNames.ts +0 -38
  797. package/src/Layer/usePressPin.ts +0 -510
  798. package/src/internal/touch-sheet.ts +0 -21
@@ -0,0 +1,2041 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file PowerSearchBottomSheet.tsx
7
+ * @input The field's InternalConfig, filters, onChange, the field typeahead
8
+ * source, and the sheet options PowerSearch forwards; BottomSheet,
9
+ * Button, EmptyState, Heading, Icon, IconButton, Indicator, List,
10
+ * RadioList, Text, TextInput, PowerSearchValueEditor, the internal sheet
11
+ * confirmation and search-drag owners, i18n
12
+ * @output Exports PowerSearchBottomSheet — the touch surface of
13
+ * `PowerSearch presentation="bottom-sheet"`: a Filters sheet
14
+ * with editable rows and trailing remove actions, Add filter in its fixed
15
+ * header and Clear all / Done in its fixed footer, an Add filter sheet with
16
+ * grouped field rows or the content search with inline suggestions, and a
17
+ * value step that stages field → operator → value and confirms from its
18
+ * footer
19
+ * @position Internal presentation surface of PowerSearch. Loaded on demand by
20
+ * PowerSearch.tsx so the popover presentation never carries it. The
21
+ * trigger lives in PowerSearch.tsx.
22
+ *
23
+ * The three steps are sibling standalone BottomSheets that stack: each step
24
+ * opens above the sheet that led to it, which stays open beneath as a covered
25
+ * sheet, so no sheet needs a Back action. A dismissal closes only the top
26
+ * sheet and reveals the step beneath; dismissing the bottom sheet ends the
27
+ * flow. A list value's Tokenizer opens its own sheet above the value step, as
28
+ * the top sheet of the stack.
29
+ *
30
+ * The sheets pad their own content (`padding={0}` on BottomSheet). The
31
+ * Filters and Add filter sheets keep their header and footer fixed around a
32
+ * scroll viewport that reaches the sheet edge; its content publishes the
33
+ * padding as container padding so `edge="bleed"` lists run edge to edge with
34
+ * row text on the header's inset. The sheets are pinned tall: the field list
35
+ * resizes as it is searched and the editor changes with the operator, and
36
+ * only a fully expanded tall sheet gives mobile-keyboard accommodation.
37
+ *
38
+ * SYNC: When modified, update:
39
+ * - /packages/core/src/PowerSearch/PowerSearch.tsx (the trigger and the lazy host)
40
+ * - /docs/specs/components/PowerSearch/PowerSearch.spec.md (FR10–FR21, AR4–AR6, PR5)
41
+ */
42
+ import React, { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
43
+ import { flushSync } from 'react-dom';
44
+ import * as stylex from '@stylexjs/stylex';
45
+ import { BottomSheet } from "../BottomSheet/BottomSheet.js";
46
+ import { Button } from "../Button/Button.js";
47
+ import { EmptyState } from "../EmptyState/EmptyState.js";
48
+ import { Heading } from "../Heading/Heading.js";
49
+ import { Icon } from "../Icon/Icon.js";
50
+ import { IconButton } from "../IconButton/IconButton.js";
51
+ import { CheckboxIndicator } from "../Indicator/CheckboxIndicator.js";
52
+ import { RadioIndicator } from "../Indicator/RadioIndicator.js";
53
+ import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
54
+ import { isRenderable } from "../utils/isRenderable.js";
55
+ import { containerPaddingInlineVarStyles } from "../Layout/padding.stylex.js";
56
+ import { List } from "../List/List.js";
57
+ import { ListItem } from "../List/ListItem.js";
58
+ import { RadioList } from "../RadioList/RadioList.js";
59
+ import { RadioListItem } from "../RadioList/RadioListItem.js";
60
+ import { Text } from "../Text/Text.js";
61
+ import { TextInput } from "../TextInput/TextInput.js";
62
+ import { useAnnounce } from "../hooks/useAnnounce.js";
63
+ import { useListFormatter } from "../i18n/useListFormatter.js";
64
+ import { useLocale } from "../i18n/useLocale.js";
65
+ import { SheetConfirmation } from "../internal/SheetConfirmation.js";
66
+ import { useDismissSearchOnTouchDrag } from "../internal/useDismissSearchOnTouchDrag.js";
67
+ import "../theme/tokens.stylex.js";
68
+ import { colorVars, fontWeightVars, radiusVars, spacingVars } from "../theme/tokens.stylex.js";
69
+ import { isImeKeyEvent } from "../utils/ime.js";
70
+ import { rtlStyles } from "../utils/rtlStyles.js";
71
+ import { formatTokenValueText } from "./formatTokenValue.js";
72
+ function resolveRelativeDateLabel(operatorValue, value, t, buildRelativeDateOptions) {
73
+ return buildRelativeDateOptions(operatorValue, t).find(option => option.value === value)?.label ?? value;
74
+ }
75
+
76
+ // A placeholder the Filters row formats `labelValue` with, then splits on, so
77
+ // the value segment can render bold inside the catalog's ordering. A private
78
+ // use code point: never part of a label or value.
79
+ const ROW_VALUE_SLOT = '\uE000';
80
+ import { useAnnounceRenderedText } from "../hooks/useAnnounceRenderedText.js";
81
+ import { useInternalListFocus } from "../hooks/useListFocus.js";
82
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
83
+ import { groupItems } from "../utils/groupItems.js";
84
+ import { createSheetSuggestionSource, fieldMatchesQuery, createFilterIdentities, filterSignature, isSupportedOperator, nearestEditableIndex, resolveFilterIdentityIndex } from "./powerSearchSheetUtils.js";
85
+ import { resolveOperatorLabel } from "./resolveOperatorLabel.js";
86
+ import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
87
+ import english from "../i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js";
88
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
89
+ registerEnglishFallback(english);
90
+
91
+ // =============================================================================
92
+ // Props
93
+ // =============================================================================
94
+
95
+ /**
96
+ * The popover presentation's editors, which the value step reuses. They come
97
+ * from PowerSearch.tsx, whose module graph already loads them for the popover
98
+ * presentation. Imported here, they and every component they reach would join
99
+ * this lazily imported graph, whose modules must import Core directly and
100
+ * never through a barrel.
101
+ */
102
+
103
+ // =============================================================================
104
+ // Styles
105
+ // =============================================================================
106
+
107
+ /** One edit of the draft: the draft before and after it, and its type and index in the draft; Done replays it onto the field's latest filters. */
108
+
109
+ // Whether two filter lists hold the same filters in the same order, by the
110
+ // key-order-insensitive signature the sheet matches filters with.
111
+ function hasSameFilters(a, b) {
112
+ return a.length === b.length && a.every((filter, index) => b[index] != null && filterSignature(filter) === filterSignature(b[index]));
113
+ }
114
+
115
+ // The filters `before` holds that `after` does not, as a multiset by
116
+ // signature, in `before` order.
117
+ function removedFilters(before, after) {
118
+ const remaining = new Map();
119
+ for (const filter of after) {
120
+ const signature = filterSignature(filter);
121
+ remaining.set(signature, (remaining.get(signature) ?? 0) + 1);
122
+ }
123
+ return before.filter(filter => {
124
+ const signature = filterSignature(filter);
125
+ const count = remaining.get(signature) ?? 0;
126
+ if (count > 0) {
127
+ remaining.set(signature, count - 1);
128
+ return false;
129
+ }
130
+ return true;
131
+ });
132
+ }
133
+
134
+ /**
135
+ * Replays the draft's edits onto `base`, the field's latest filters, and
136
+ * reports each through `report` with the list after it. An add appends; an
137
+ * edit replaces the first filter matching the one it edited; a removal drops
138
+ * the filters it removed, by signature. An edit or removal whose target is
139
+ * not in the base list is skipped: the parent removed it meanwhile.
140
+ */
141
+ export function replayDraftEdits(base, edits, report) {
142
+ let current = base;
143
+ for (const edit of edits) {
144
+ if (edit.changeType === 'add') {
145
+ const added = edit.after[edit.index];
146
+ if (added == null) {
147
+ continue;
148
+ }
149
+ current = [...current, added];
150
+ report(current, 'add', current.length - 1);
151
+ } else if (edit.changeType === 'edit') {
152
+ const original = edit.before[edit.index];
153
+ const updated = edit.after[edit.index];
154
+ if (original == null || updated == null) {
155
+ continue;
156
+ }
157
+ const signature = filterSignature(original);
158
+ const index = current.findIndex(filter => filterSignature(filter) === signature);
159
+ if (index === -1) {
160
+ continue;
161
+ }
162
+ current = current.map((filter, i) => i === index ? updated : filter);
163
+ report(current, 'edit', index);
164
+ } else {
165
+ const removed = removedFilters(edit.before, edit.after).map(filterSignature);
166
+ const indexes = [];
167
+ for (const signature of removed) {
168
+ const index = current.findIndex((filter, i) => !indexes.includes(i) && filterSignature(filter) === signature);
169
+ if (index !== -1) {
170
+ indexes.push(index);
171
+ }
172
+ }
173
+ if (indexes.length === 0) {
174
+ continue;
175
+ }
176
+ current = current.filter((_, i) => !indexes.includes(i));
177
+ report(current, 'remove', Math.min(...indexes));
178
+ }
179
+ }
180
+ return current;
181
+ }
182
+
183
+ // The trailing plus a field row shows when choosing it adds the filter at
184
+ // once, and the Add filter actions' glyph. Core's default icon set has no plus.
185
+ function PlusIcon(props) {
186
+ return /*#__PURE__*/_jsxs("svg", {
187
+ viewBox: "0 0 24 24",
188
+ fill: "none",
189
+ stroke: "currentColor",
190
+ strokeWidth: 1.5,
191
+ strokeLinecap: "round",
192
+ strokeLinejoin: "round",
193
+ ...props,
194
+ children: [/*#__PURE__*/_jsx("path", {
195
+ d: "M5 12h14"
196
+ }), /*#__PURE__*/_jsx("path", {
197
+ d: "M12 5v14"
198
+ })]
199
+ });
200
+ }
201
+ const styles = {
202
+ touchAction: {
203
+ kAzted: "x1gg8mnh",
204
+ $$css: true
205
+ },
206
+ touchHitArea: {
207
+ "--_power-search-sheet-hit-inset": "x1o3f7l6 xhx5icg",
208
+ "--_power-search-sheet-hit-content": "x1bs45cr x73lxwv",
209
+ k5JduY: "x1oocgs0",
210
+ kwXMNM: "x1j6awrg",
211
+ kv0HGH: "xl7hj2y",
212
+ $$css: true
213
+ },
214
+ body: {
215
+ kzQI83: "x1iyjqo2",
216
+ k1xSpc: "x78zum5",
217
+ kXwgrk: "xdt5ytf",
218
+ kOIVth: "x18g69wz",
219
+ kg3NbH: "x1pzlopt",
220
+ kGO01o: "x1awphl8",
221
+ $$css: true
222
+ },
223
+ scrollContent: {
224
+ kAzted: "x1us19tq",
225
+ k1xSpc: "x78zum5",
226
+ kXwgrk: "xdt5ytf",
227
+ kOIVth: "x18g69wz",
228
+ kg3NbH: "x1pzlopt",
229
+ kGO01o: "x1awphl8",
230
+ $$css: true
231
+ },
232
+ footerEqualAction: {
233
+ kzQI83: "x1iyjqo2",
234
+ kCS8Yb: "x1r8uery",
235
+ k7Eaqz: "xeuugli",
236
+ kAzted: "x1gg8mnh",
237
+ $$css: true
238
+ },
239
+ footerSoleAction: {
240
+ kzQI83: "x1iyjqo2",
241
+ $$css: true
242
+ },
243
+ emptyState: {
244
+ kzQI83: "x1iyjqo2",
245
+ k1xSpc: "x78zum5",
246
+ kGNEyG: "x6s0dn4",
247
+ kjj79g: "xl56j7k",
248
+ $$css: true
249
+ },
250
+ controlSection: {
251
+ kmVPX3: "x1b2ylru",
252
+ kaIpWk: "x1hviunn",
253
+ kWkggS: "xwmxj5m",
254
+ $$css: true
255
+ },
256
+ trailingControlRow: {
257
+ kXwgrk: "x15zctf7",
258
+ $$css: true
259
+ },
260
+ nestedEditorContainer: {
261
+ k9g6sI: "x12h1iku",
262
+ kVQacm: "xb3r6kr",
263
+ $$css: true
264
+ },
265
+ choiceRow: {
266
+ k1xSpc: "x78zum5",
267
+ kGNEyG: "x6s0dn4",
268
+ kOIVth: "xjcht0a",
269
+ kzqmXN: "xh8yej3",
270
+ kAzted: "x1gg8mnh",
271
+ k8WAf4: "x8o8v82",
272
+ kZCmMZ: "x1ew2rer",
273
+ kwRFfy: "x19m2zy8",
274
+ kMzoRj: "xc342km",
275
+ kaIpWk: "x2u8bby",
276
+ kWkggS: "xjbqb8w",
277
+ kMwMTN: "x1tgivj0",
278
+ kMv6JI: "xjb2p0i",
279
+ k9WMMc: "x1yc453h",
280
+ kkrTdU: "x1ypdohk xvivl9a",
281
+ $$css: true
282
+ },
283
+ choiceRowDisabled: {
284
+ kMwMTN: "xv1l7n4 x1bhcspo",
285
+ $$css: true
286
+ },
287
+ choiceLabel: {
288
+ kzQI83: "x1iyjqo2",
289
+ k7Eaqz: "xeuugli",
290
+ $$css: true
291
+ }
292
+ };
293
+
294
+ // =============================================================================
295
+ // Draft state
296
+ // =============================================================================
297
+
298
+ function resolveDraftFilterIndex(filters, draft) {
299
+ if (draft.mode !== 'edit' || draft.filterIndex == null || draft.sourceFilter == null || draft.sourceSignature == null) {
300
+ return null;
301
+ }
302
+ return resolveFilterIdentityIndex(filters, draft.sourceFilter, draft.sourceSignature, draft.filterIndex);
303
+ }
304
+
305
+ // Below this many fields a search box is noise: the whole list is on screen.
306
+ const SEARCHABLE_FIELD_COUNT = 8;
307
+ // Empty-query browsing keeps the popover presentation's safety ceiling.
308
+ const MAX_BROWSE_MENU_ITEMS = 1000;
309
+
310
+ // =============================================================================
311
+ // Choice rows (enum, enum_list, date_relative)
312
+ // =============================================================================
313
+
314
+ /**
315
+ * Rendered inside a step's BottomSheet so that `useAnnounce` resolves the
316
+ * sheet's dialog as the enclosing modal; publishes that
317
+ * dialog's `announce` to the flow above through `onAnnounceChange` while
318
+ * mounted. Renders nothing.
319
+ */
320
+ function SheetAnnouncer({
321
+ onAnnounceChange
322
+ }) {
323
+ const announce = useAnnounce();
324
+ // Hands this dialog's announce function up; the cleanup withdraws it when
325
+ // the step changes or the flow closes.
326
+ useEffect(() => {
327
+ onAnnounceChange(announce);
328
+ return () => {
329
+ onAnnounceChange(null);
330
+ };
331
+ }, [announce, onAnnounceChange]);
332
+ return null;
333
+ }
334
+
335
+ /**
336
+ * The value step's "This filter is no longer available" message, rendered
337
+ * inside the step's dialog. The shared own-content module reads the rendered
338
+ * text and speaks it once per opened filter while the step is the open one.
339
+ * Called from inside the sheet's dialog, `useAnnounce` routes it into the
340
+ * dialog. The message is plain text, not an EmptyState, so nothing announces
341
+ * it a second time.
342
+ */
343
+ function SheetEmptyMessage({
344
+ id,
345
+ message,
346
+ occasion,
347
+ isShown
348
+ }) {
349
+ const ref = useRef(null);
350
+ useAnnounceRenderedText(ref, isShown, occasion);
351
+ return /*#__PURE__*/_jsx("div", {
352
+ ref: ref,
353
+ id: id,
354
+ ...{
355
+ className: "xq6koh6 x2b8uid"
356
+ },
357
+ children: /*#__PURE__*/_jsx(Text, {
358
+ type: "supporting",
359
+ color: "secondary",
360
+ children: message
361
+ })
362
+ });
363
+ }
364
+ // A radio group's one tab stop: the checked row, else the first.
365
+ function radioTabStopOrder(list) {
366
+ const rows = Array.from(list.querySelectorAll('[role="radio"]'));
367
+ const checked = rows.find(row => row.getAttribute('aria-checked') === 'true');
368
+ return checked == null ? rows : [checked, ...rows.filter(row => row !== checked)];
369
+ }
370
+
371
+ /**
372
+ * Closed vocabularies render as full-width rows with a trailing check instead
373
+ * of the popover presentation's Selector or Tokenizer: a dropdown layer inside
374
+ * a sheet stacks a second overlay on a surface the person is already inside.
375
+ */
376
+ function ChoiceRows({
377
+ items,
378
+ selected,
379
+ isDisabled,
380
+ isMultiple,
381
+ label,
382
+ onToggle
383
+ }) {
384
+ // The rows carry their state as state, not as a name suffix: `radio` rows
385
+ // in a `radiogroup` for a single choice, `checkbox` rows in a `group` for
386
+ // `enum_list`, each with `aria-checked`, as the Tokenizer's sheet rows do.
387
+ // Disabled rows stay focusable with `aria-disabled`.
388
+ //
389
+ // Keyboard: a radio group is one tab stop — the checked row, else the
390
+ // first — and the arrow keys move focus and check the row they land on,
391
+ // wrapping; Home and End move to and check the first and last row. The
392
+ // shared list focus owns the tab stop and the moves; a row that takes focus
393
+ // from an arrow, Home or End is checked here. Space and Enter check the
394
+ // focused radio row and toggle a checkbox row: each row is a native
395
+ // `button`, whose activation fires `onClick` for both keys. A checkbox row
396
+ // is its own tab stop.
397
+ const isKeyMoveRef = useRef(false);
398
+ const {
399
+ listRef,
400
+ handleKeyDown,
401
+ handleFocus
402
+ } = useInternalListFocus({
403
+ itemSelector: '[role="radio"]',
404
+ orientation: 'both',
405
+ hasRovingTabIndex: !isMultiple,
406
+ tabStopOrder: radioTabStopOrder
407
+ });
408
+ const handleRadioKeyDown = event => {
409
+ isKeyMoveRef.current = true;
410
+ try {
411
+ handleKeyDown(event);
412
+ } finally {
413
+ isKeyMoveRef.current = false;
414
+ }
415
+ };
416
+ const handleRadioFocus = event => {
417
+ handleFocus(event);
418
+ if (!isKeyMoveRef.current || isDisabled) {
419
+ return;
420
+ }
421
+ const value = event.target.closest('[role="radio"]')?.dataset.value;
422
+ if (value != null && !selected.has(value)) {
423
+ onToggle(value, false);
424
+ }
425
+ };
426
+ return /*#__PURE__*/_jsx("div", {
427
+ ref: listRef,
428
+ role: isMultiple ? 'group' : 'radiogroup',
429
+ "aria-label": label,
430
+ onKeyDown: isMultiple ? undefined : handleRadioKeyDown,
431
+ onFocus: isMultiple ? undefined : handleRadioFocus,
432
+ ...{
433
+ className: "x78zum5 xdt5ytf xojxgvx x1fcf3bl xx6qvi6"
434
+ },
435
+ children: items.map(item => {
436
+ const isSelected = selected.has(item.value);
437
+ return /*#__PURE__*/_jsxs("button", {
438
+ type: "button",
439
+ role: isMultiple ? 'checkbox' : 'radio',
440
+ "aria-checked": isSelected,
441
+ "aria-disabled": isDisabled || undefined,
442
+ "data-value": item.value,
443
+ onClick: () => {
444
+ if (!isDisabled) {
445
+ onToggle(item.value, isSelected);
446
+ }
447
+ },
448
+ ...stylex.props(focusOutlineStyles.focusVisible, styles.choiceRow, isDisabled && styles.choiceRowDisabled),
449
+ children: [isRenderable(item.icon) && /*#__PURE__*/_jsx("span", {
450
+ "aria-hidden": "true",
451
+ ...{
452
+ className: "x3nfvp2 x2lah0s"
453
+ },
454
+ children: item.icon
455
+ }), /*#__PURE__*/_jsx(Text, {
456
+ type: "body",
457
+ color: isDisabled ? 'inherit' : undefined,
458
+ xstyle: styles.choiceLabel,
459
+ children: item.label
460
+ }), isMultiple ? /*#__PURE__*/_jsx(CheckboxIndicator, {
461
+ state: isSelected ? 'checked' : 'unchecked',
462
+ size: "md",
463
+ isDisabled: isDisabled
464
+ }) : /*#__PURE__*/_jsx(RadioIndicator, {
465
+ state: isSelected ? 'checked' : 'unchecked',
466
+ size: "md",
467
+ isDisabled: isDisabled
468
+ })]
469
+ }, item.value);
470
+ })
471
+ });
472
+ }
473
+
474
+ /**
475
+ * The value control for one filter inside the value step. Closed vocabularies
476
+ * are rows here; every other type is the popover presentation's own editor in
477
+ * its sheet presentation.
478
+ */
479
+ function SheetValueEditor({
480
+ operatorValue,
481
+ filterValue,
482
+ onChange,
483
+ onUnstage,
484
+ config,
485
+ fieldLabel,
486
+ isDisabled,
487
+ maxMenuItems,
488
+ timezoneID,
489
+ editors
490
+ }) {
491
+ const {
492
+ buildRelativeDateOptions,
493
+ PowerSearchValueEditor
494
+ } = editors;
495
+ const t = useComponentTranslator();
496
+ const selectedValues = useMemo(() => {
497
+ if (filterValue?.type === 'enum' || filterValue?.type === 'date_relative') {
498
+ return new Set([filterValue.value]);
499
+ }
500
+ if (filterValue?.type === 'enum_list') {
501
+ return new Set(filterValue.value);
502
+ }
503
+ return new Set();
504
+ }, [filterValue]);
505
+ switch (operatorValue.type) {
506
+ case 'empty':
507
+ case 'nested':
508
+ return null;
509
+ case 'enum':
510
+ return /*#__PURE__*/_jsx(ChoiceRows, {
511
+ items: operatorValue.values,
512
+ selected: selectedValues,
513
+ isDisabled: isDisabled,
514
+ isMultiple: false,
515
+ label: fieldLabel,
516
+ onToggle: value => onChange({
517
+ type: 'enum',
518
+ value
519
+ })
520
+ });
521
+ case 'enum_list':
522
+ return /*#__PURE__*/_jsx(ChoiceRows, {
523
+ items: operatorValue.values,
524
+ selected: selectedValues,
525
+ isDisabled: isDisabled,
526
+ isMultiple: true,
527
+ label: fieldLabel,
528
+ onToggle: (value, isSelected) => {
529
+ const existing = filterValue?.type === 'enum_list' ? filterValue.value : [];
530
+ onChange({
531
+ type: 'enum_list',
532
+ value: isSelected ? existing.filter(v => v !== value) : [...existing, value]
533
+ });
534
+ }
535
+ });
536
+ case 'date_relative':
537
+ return /*#__PURE__*/_jsx(ChoiceRows, {
538
+ items: buildRelativeDateOptions(operatorValue, t),
539
+ selected: selectedValues,
540
+ isDisabled: isDisabled,
541
+ isMultiple: false,
542
+ label: fieldLabel,
543
+ onToggle: value => onChange({
544
+ type: 'date_relative',
545
+ value
546
+ })
547
+ });
548
+ case 'string':
549
+ case 'string_list':
550
+ case 'integer':
551
+ case 'float':
552
+ case 'time':
553
+ case 'date_absolute':
554
+ case 'date_range':
555
+ case 'entity_list':
556
+ case 'custom':
557
+ return /*#__PURE__*/_jsx("div", {
558
+ ...{
559
+ className: "xfsso4q"
560
+ },
561
+ children: /*#__PURE__*/_jsx(PowerSearchValueEditor, {
562
+ operatorValue: operatorValue,
563
+ filterValue: filterValue,
564
+ onChange: onChange,
565
+ onUnstage: onUnstage,
566
+ config: config,
567
+ maxMenuItems: maxMenuItems,
568
+ isDisabled: isDisabled,
569
+ presentation: "bottom-sheet",
570
+ fieldLabel: fieldLabel,
571
+ timezoneID: timezoneID
572
+ })
573
+ });
574
+ }
575
+ }
576
+
577
+ // =============================================================================
578
+ // Component
579
+ // =============================================================================
580
+
581
+ /**
582
+ * The sheet flow of PowerSearch's touch presentation: Filters, Add filter,
583
+ * and the value step, as standalone sheets that stack, each open beneath the
584
+ * step it led to.
585
+ */
586
+ export function PowerSearchBottomSheet({
587
+ isOpen,
588
+ onOpenChange,
589
+ finalFocusRef,
590
+ resultCountText,
591
+ config,
592
+ configProp,
593
+ filters: committedFilters,
594
+ onChange: onCommit,
595
+ searchSource,
596
+ placeholder,
597
+ isReadOnly,
598
+ isDisabled,
599
+ hasClear,
600
+ maxOperatorMenuItems,
601
+ timezoneID,
602
+ maxSearchResults,
603
+ saveButtonLabel: saveButtonLabelFromProps,
604
+ components: componentOverrides,
605
+ editors
606
+ }) {
607
+ const {
608
+ NestedEditor
609
+ } = editors;
610
+ const t = useComponentTranslator();
611
+ const locale = useLocale();
612
+ const formatList = useListFormatter();
613
+ const isInteractive = !isDisabled && !isReadOnly;
614
+
615
+ // ---- draft ----
616
+ // One open flow edits one draft of the filter list; `onChange` waits for
617
+ // Done, and a dismissal with a changed draft asks first.
618
+ const [filtersAtOpen, setFiltersAtOpen] = useState(() => committedFilters);
619
+ const [filters, setFilters] = useState(() => committedFilters);
620
+ // The draft as of the last edit, for the edit log's `before` lists.
621
+ const draftRef = useRef(filters);
622
+ const draftEditsRef = useRef([]);
623
+ const onChange = useCallback((next, changeType, index) => {
624
+ draftEditsRef.current.push({
625
+ before: draftRef.current,
626
+ after: next,
627
+ changeType,
628
+ index
629
+ });
630
+ draftRef.current = next;
631
+ setFilters(next);
632
+ }, []);
633
+ const isDraftDirty = !hasSameFilters(filtersAtOpen, filters);
634
+ const [isDiscardConfirmationOpen, setIsDiscardConfirmationOpen] = useState(false);
635
+ const contentSearchFieldKey = config.config.contentSearchFieldKey;
636
+ const contentSearchOperator = contentSearchFieldKey == null ? undefined : config.getDefaultOperator(contentSearchFieldKey);
637
+ const hasContentSearch = contentSearchOperator?.value.type === 'string';
638
+ const suggestionSource = useMemo(() => createSheetSuggestionSource(config, searchSource), [config, searchSource]);
639
+ const contentResultsId = useId();
640
+ const managerAddButtonRef = useRef(null);
641
+ const contentSearchRef = useRef(null);
642
+ const fieldSearchRef = useRef(null);
643
+ // The Add filter sheet's panel: the fallback focus target when the control
644
+ // a step came from is gone — its first focusable control, which is the
645
+ // search field when one shows, else the first field row.
646
+ const fieldsSheetRef = useRef(null);
647
+ // The content search and its suggestion rows are one vertical list for the
648
+ // arrow keys: ArrowDown from the searchbox reaches the first suggestion,
649
+ // ArrowUp from the first suggestion returns to the searchbox, and the ends
650
+ // do not wrap. Home and End stay with the searchbox's caret.
651
+ const contentListFocus = useInternalListFocus({
652
+ itemSelector: `[role="searchbox"], [id="${contentResultsId}"] button`,
653
+ wrap: false,
654
+ hasHomeEnd: false
655
+ });
656
+ const fieldsSheetCallbackRef = useMergedRefs(fieldsSheetRef, contentListFocus.listRef);
657
+ const handleContentListKeyDown = event => {
658
+ if (!isImeKeyEvent(event.nativeEvent)) {
659
+ contentListFocus.handleKeyDown(event);
660
+ }
661
+ };
662
+ const manageSheetRef = useRef(null);
663
+ // Where focus was inside the Filters or Add filter sheet, read on every
664
+ // focus change there, so a controlled update that unmounts the focused
665
+ // control (a filter's row, a dropped field's row, Clear all after the last
666
+ // filter) can put focus on the nearest remaining row by that index, else
667
+ // the sheet's first control, else the sheet panel. A removed element
668
+ // fires no blur, so the position is what the effect below reads.
669
+ const lastSheetFocusRef = useRef(null);
670
+ // One index space for the record and the recovery: rows that are buttons
671
+ // (a plain read-only row is passed over, as the removal and Apply/Cancel
672
+ // rules pass it over), in document order.
673
+ const buttonRowsOf = panel => Array.from(panel.querySelectorAll('li')).map(row => row.querySelector('button')).filter(button => button != null);
674
+ const noteSheetFocus = useCallback(sheet => event => {
675
+ const row = event.target.closest('li');
676
+ const button = row?.querySelector('button') ?? null;
677
+ const rowIndex = button == null ? -1 : buttonRowsOf(event.currentTarget).indexOf(button);
678
+ lastSheetFocusRef.current = {
679
+ sheet,
680
+ rowIndex: rowIndex === -1 ? null : rowIndex
681
+ };
682
+ }, []);
683
+ const managerRowsRef = useRef(new Map());
684
+ const fieldRowsRef = useRef(new Map());
685
+ const latestFiltersRef = useRef(filters);
686
+ const pendingSheetFocusRef = useRef(null);
687
+ const pendingMutationFocusRef = useRef(false);
688
+
689
+ // The step an open starts on: Add filter directly when an interactive field
690
+ // has nothing to manage yet, otherwise Filters. Neither search field takes
691
+ // focus on open, so the software keyboard stays down until the person taps
692
+ // the search. Add filter opened directly is the flow's entry point: no
693
+ // Filters sheet beneath it, and Done in its footer.
694
+ const isEntryAddFilter = filters.length === 0 && isInteractive;
695
+ const [step, setStep] = useState(() => isOpen ? isEntryAddFilter ? 'fields' : 'manage' : null);
696
+ const [fieldPickerOrigin, setFieldPickerOrigin] = useState(() => isOpen && isEntryAddFilter ? 'trigger' : 'manage');
697
+ // The current step, read by the sheets' close reports and by a removal that
698
+ // decides where to speak.
699
+ const stepRef = useRef(step);
700
+ useLayoutEffect(() => {
701
+ stepRef.current = step;
702
+ }, [step]);
703
+ // The draft outlives a step change on purpose: a closing value step stays
704
+ // presented through its exit, and clearing the draft with the step would
705
+ // blank that sheet mid-transition.
706
+ const [draft, setDraft] = useState(null);
707
+ const draftGenerationRef = useRef(0);
708
+ const nextDraftGeneration = useCallback(() => {
709
+ draftGenerationRef.current += 1;
710
+ return draftGenerationRef.current;
711
+ }, []);
712
+ const [fieldQuery, setFieldQuery] = useState('');
713
+ const [contentQuery, setContentQuery] = useState('');
714
+ const [isClearConfirmationOpen, setIsClearConfirmationOpen] = useState(false);
715
+ const clearAllButtonRef = useRef(null);
716
+
717
+ // `useAnnounce` delivers inside the open Astryx modal that encloses its
718
+ // caller, and this component renders above the
719
+ // sheets, so it cannot call the hook itself. Each step's body renders a
720
+ // `SheetAnnouncer` inside its BottomSheet, which publishes the dialog's own
721
+ // `announce` here while that step is the active one; the effects below
722
+ // speak through it, so every message about a sheet's content is delivered
723
+ // in that sheet's dialog.
724
+ const announceRef = useRef(null);
725
+ const handleAnnounceChange = useCallback(next => {
726
+ announceRef.current = next;
727
+ }, []);
728
+ const announce = useCallback(message => {
729
+ announceRef.current?.(message);
730
+ }, []);
731
+ const pendingAnnouncementRef = useRef(null);
732
+
733
+ // The controlled `isOpen` opens and closes the flow; the step follows it in
734
+ // the render that sees the change, not an effect, so the entry step's sheet
735
+ // opens in the same commit as the flow (React's adjust-state-on-
736
+ // prop-change pattern). Closing from outside — the field became disabled —
737
+ // ends the flow wherever it was, the Clear all confirmation included.
738
+ const [wasOpen, setWasOpen] = useState(isOpen);
739
+ if (isOpen !== wasOpen) {
740
+ setWasOpen(isOpen);
741
+ if (isOpen) {
742
+ // A fresh draft from the committed filters; the entry step is judged
743
+ // against them, not the previous session's draft.
744
+ setFiltersAtOpen(committedFilters);
745
+ setFilters(committedFilters);
746
+ draftRef.current = committedFilters;
747
+ draftEditsRef.current = [];
748
+ const startsOnAddFilter = committedFilters.length === 0 && isInteractive;
749
+ setFieldQuery('');
750
+ setContentQuery('');
751
+ setStep(startsOnAddFilter ? 'fields' : 'manage');
752
+ setFieldPickerOrigin(startsOnAddFilter ? 'trigger' : 'manage');
753
+ } else {
754
+ setStep(null);
755
+ setIsClearConfirmationOpen(false);
756
+ setIsDiscardConfirmationOpen(false);
757
+ }
758
+ }
759
+ const closeFlow = useCallback(() => {
760
+ pendingSheetFocusRef.current = null;
761
+ setStep(null);
762
+ onOpenChange(false);
763
+ }, [onOpenChange]);
764
+ // Done replays each edit in order onto the field's latest filters, so a
765
+ // consumer gets the calls a popover session makes and keeps a filter it
766
+ // added meanwhile.
767
+ const commitAndClose = useCallback(() => {
768
+ // A field that became read-only while the flow was open reports nothing.
769
+ if (isDraftDirty && isInteractive) {
770
+ replayDraftEdits(committedFilters, draftEditsRef.current, onCommit);
771
+ }
772
+ draftEditsRef.current = [];
773
+ closeFlow();
774
+ }, [closeFlow, committedFilters, isDraftDirty, isInteractive, onCommit]);
775
+ const requestDismiss = useCallback(() => {
776
+ if (isDraftDirty) {
777
+ setIsDiscardConfirmationOpen(true);
778
+ } else {
779
+ closeFlow();
780
+ }
781
+ }, [closeFlow, isDraftDirty]);
782
+ const closeDiscardConfirmation = () => {
783
+ // eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves back into the sheet
784
+ flushSync(() => setIsDiscardConfirmationOpen(false));
785
+ const target = stepRef.current === 'manage' ? managerAddButtonRef.current ?? manageSheetRef.current?.closest('[tabindex="-1"]') : fieldsSheetRef.current?.closest('[tabindex="-1"]');
786
+ target?.focus({
787
+ preventScroll: true
788
+ });
789
+ };
790
+
791
+ // Whether a Filters row is a button: the field interactive and the
792
+ // filter not read-only. The row opens the value step — the editor for its
793
+ // operator's value type, the built-in nested editor for a `nested` one, or
794
+ // for a filter the config no longer knows the unavailable state — and its
795
+ // trailing remove action removes it, as the popover's token has its × for
796
+ // it.
797
+ const isRowButton = useCallback(filter => !filter.isReadOnly && isInteractive, [isInteractive]);
798
+
799
+ // ------------------------------------------------------------------ focus --
800
+
801
+ // The control a step change named also becomes where the closing step
802
+ // sheets return focus when their exit ends: a closing sheet that held focus
803
+ // keeps it until then, and BottomSheet then returns it, so the named control
804
+ // receives it even when the first move could not land. With no control
805
+ // named, the closing steps return focus as the flow does.
806
+ const stepReturnTargetRef = useRef(null);
807
+ const stepFinalFocusRef = useMemo(() => ({
808
+ get current() {
809
+ return stepReturnTargetRef.current ?? finalFocusRef.current;
810
+ }
811
+ }), [finalFocusRef]);
812
+ const placeFocus = element => {
813
+ if (element == null) {
814
+ return;
815
+ }
816
+ stepReturnTargetRef.current = element;
817
+ element.focus({
818
+ preventScroll: true
819
+ });
820
+ };
821
+ const focusPendingSheetTarget = useCallback(() => {
822
+ const target = pendingSheetFocusRef.current;
823
+ if (target == null) {
824
+ return;
825
+ }
826
+ pendingSheetFocusRef.current = null;
827
+ if (target.type === 'manager-add') {
828
+ placeFocus(managerAddButtonRef.current);
829
+ return;
830
+ }
831
+ // Add filter's fallback: a controlled update may have removed the field
832
+ // whose row opened the step, or the content-search field itself; the
833
+ // sheet's first focusable control then takes focus — the search field
834
+ // when one shows, else the first field row.
835
+ const firstFieldsControl = () => {
836
+ const panel = fieldsSheetRef.current;
837
+ return panel?.querySelector('input') ?? panel?.querySelector('li button') ?? panel?.querySelector('button') ?? null;
838
+ };
839
+ if (target.type === 'content-search') {
840
+ placeFocus(contentSearchRef.current?.querySelector('input') ?? firstFieldsControl());
841
+ return;
842
+ }
843
+ if (target.type === 'field') {
844
+ placeFocus(fieldRowsRef.current.get(target.fieldKey)?.querySelector('button') ?? firstFieldsControl());
845
+ return;
846
+ }
847
+ // The row the step came from, followed across a controlled reorder or
848
+ // clone; when a controlled update removed it, or left two filters it
849
+ // could be, the nearest remaining row that is a button, as after a
850
+ // removal; else Add filter.
851
+ const index = resolveFilterIdentityIndex(latestFiltersRef.current, target.sourceFilter, target.sourceSignature, target.preferredIndex) ?? nearestEditableIndex(latestFiltersRef.current, target.preferredIndex, isRowButton);
852
+ const row = index == null ? null : managerRowsRef.current.get(index);
853
+ const rowButton = target.part === 'remove' ? row?.querySelector('[data-sheet-remove]') ?? row?.querySelector('button') : row?.querySelector('button');
854
+ placeFocus(rowButton ?? managerAddButtonRef.current);
855
+ }, [isRowButton]);
856
+
857
+ // A controlled update that unmounts the focused control of the Filters or
858
+ // Add filter sheet leaves focus on the page body inside the open modal.
859
+ // Read before paint on every commit of an open step: when focus is no
860
+ // longer inside the sheet's dialog, the nearest remaining row by the last
861
+ // focused index takes it, else the sheet's first control, else its panel.
862
+ // The pending-target effects below run after and win when a step
863
+ // change named a control.
864
+ useLayoutEffect(() => {
865
+ const last = lastSheetFocusRef.current;
866
+ if (step !== 'manage' && step !== 'fields') {
867
+ return;
868
+ }
869
+ if (last == null || last.sheet !== step) {
870
+ return;
871
+ }
872
+ const panel = step === 'manage' ? manageSheetRef.current : fieldsSheetRef.current;
873
+ const dialog = panel?.closest('dialog');
874
+ const active = document.activeElement;
875
+ if (panel == null || dialog == null || active != null && active !== document.body && dialog.contains(active)) {
876
+ return;
877
+ }
878
+ const rowButtons = buttonRowsOf(panel);
879
+ let target = null;
880
+ if (last.rowIndex != null && rowButtons.length > 0) {
881
+ // The following button row, else the last.
882
+ target = rowButtons[Math.min(last.rowIndex, rowButtons.length - 1)];
883
+ }
884
+ target ??= panel.querySelector('input') ?? rowButtons[0] ?? panel.querySelector('button') ?? null;
885
+ if (target != null) {
886
+ target.focus({
887
+ preventScroll: true
888
+ });
889
+ } else {
890
+ const focusable = dialog.querySelector('[tabindex="-1"]');
891
+ (focusable ?? dialog).focus({
892
+ preventScroll: true
893
+ });
894
+ }
895
+ });
896
+
897
+ // Both Effects move focus inside the entering sheet — the external system
898
+ // is the document's focus — to the control the step named. They run after
899
+ // the entering sheet's own
900
+ // panel focus (child effects commit first), so the intended control wins,
901
+ // and they acquire nothing, so they need no cleanup. The filters effect is
902
+ // declared first so a mutation that lands in the same commit as the step
903
+ // change resolves its row against the new filters.
904
+ useEffect(() => {
905
+ latestFiltersRef.current = filters;
906
+ if (step === 'manage' && pendingMutationFocusRef.current) {
907
+ pendingMutationFocusRef.current = false;
908
+ focusPendingSheetTarget();
909
+ }
910
+ }, [filters, focusPendingSheetTarget, step]);
911
+
912
+ // A target still pending when the flow closes, such as a commit that
913
+ // disabled the field, never carries into the next open.
914
+ useEffect(() => {
915
+ if (step == null) {
916
+ stepReturnTargetRef.current = null;
917
+ pendingSheetFocusRef.current = null;
918
+ return;
919
+ }
920
+ // A step that opens starts with no named return target; a return to
921
+ // Filters keeps the one its commit, or its removal, has just named.
922
+ if (step !== 'manage') {
923
+ stepReturnTargetRef.current = null;
924
+ }
925
+ focusPendingSheetTarget();
926
+ }, [focusPendingSheetTarget, step]);
927
+
928
+ // An announcement queued by a step change — a suggestion or a removal that
929
+ // changed the filters — is spoken in the commit that shows the next step,
930
+ // so it lands in that step's dialog region rather than the one about to
931
+ // close. It synchronizes the live region named above and acquires nothing.
932
+ useEffect(() => {
933
+ const message = pendingAnnouncementRef.current;
934
+ if (step != null && message != null) {
935
+ pendingAnnouncementRef.current = null;
936
+ announce(message);
937
+ }
938
+ }, [announce, step]);
939
+
940
+ // ----------------------------------------------------------------- fields --
941
+
942
+ // Every visible field lists: the value step edits every operator's value,
943
+ // `nested` through the popover's built-in editor.
944
+ const fields = useMemo(() => config.getVisibleFields(), [config]);
945
+ const normalizedFieldQuery = fieldQuery.trim().toLowerCase();
946
+ const matchingFields = useMemo(() => {
947
+ const matches = fields.filter(field => fieldMatchesQuery(field, normalizedFieldQuery));
948
+ return normalizedFieldQuery === '' ? matches : matches.slice(0, maxSearchResults);
949
+ }, [fields, maxSearchResults, normalizedFieldQuery]);
950
+
951
+ // Ungrouped fields first, then each group in first-appearance order — the
952
+ // same grouping the popover presentation's field suggestions use
953
+ // (`groupItems` with `ungroupedFirst`), so the two presentations
954
+ // list a config's fields in one order.
955
+ const groupedFields = useMemo(() => matchingFields.length === 0 ? [] : groupItems(matchingFields.map(field => ({
956
+ id: field.key,
957
+ label: field.label,
958
+ auxiliaryData: {
959
+ group: field.group
960
+ },
961
+ field
962
+ })), {
963
+ ungroupedFirst: true
964
+ }).map(group => [group.heading ?? '', group.items.map(item => item.field)]), [matchingFields]);
965
+ const isFieldSearchShown = fields.length >= SEARCHABLE_FIELD_COUNT;
966
+
967
+ // A field whose only operator takes an `empty` value is a one-tap filter:
968
+ // its row adds it with no value step, and shows a plus, not a chevron.
969
+ const isImmediateAddField = useCallback(field => {
970
+ const operators = config.getVisibleOperators(field.key);
971
+ return operators.length === 1 && operators[0].value.type === 'empty';
972
+ }, [config]);
973
+
974
+ // The steps stack: each opens above the sheet that led to it, which stays
975
+ // open beneath. Add filter entered directly has no Filters sheet beneath.
976
+ const isFieldPickerDirectEntry = fieldPickerOrigin === 'trigger';
977
+ const isManageSheetOpen = step === 'manage' || step === 'fields' && !isFieldPickerDirectEntry || step === 'value' && (draft?.mode === 'edit' || !isFieldPickerDirectEntry);
978
+ const isFieldsSheetOpen = step === 'fields' || step === 'value' && draft?.mode === 'create';
979
+
980
+ // The suggestions derive synchronously from the config, so a list never
981
+ // waits on a request: an empty list means an empty result, not a pending
982
+ // one. They stay listed while the value step covers Add filter.
983
+ const contentResults = useMemo(() => {
984
+ if (!isFieldsSheetOpen || !hasContentSearch || !isInteractive) {
985
+ return [];
986
+ }
987
+ const results = contentQuery.trim() === '' ? suggestionSource.bootstrap() : suggestionSource.search(contentQuery);
988
+ return results.slice(0, MAX_BROWSE_MENU_ITEMS);
989
+ }, [contentQuery, hasContentSearch, isFieldsSheetOpen, isInteractive, suggestionSource]);
990
+
991
+ // The field's result count, while a sheet is open: the owner's own Effect
992
+ // is quiet then, so the change is spoken here, inside the dialog. Only a
993
+ // change after the flow opened is spoken.
994
+ const announcedResultCountRef = useRef(resultCountText);
995
+ useEffect(() => {
996
+ if (resultCountText === announcedResultCountRef.current) {
997
+ return;
998
+ }
999
+ announcedResultCountRef.current = resultCountText;
1000
+ if (step != null && resultCountText != null) {
1001
+ announce(resultCountText);
1002
+ }
1003
+ }, [announce, resultCountText, step]);
1004
+
1005
+ // ------------------------------------------------------------------ draft --
1006
+
1007
+ const draftField = draft ? config.getField(draft.field) : undefined;
1008
+ const draftOperator = draft?.operator != null ? config.getOperator(draft.field, draft.operator) : undefined;
1009
+ const draftOperators = useMemo(() => draft ? config.getVisibleOperators(draft.field) : [], [config, draft]);
1010
+
1011
+ // The two parts of a Filters row's text for `filter`: "{field} {operator}"
1012
+ // as one catalog message, and the value as the popover presentation's
1013
+ // token shows it — the same function, so the same words and the same zone
1014
+ // handling, before the token's width budget. The rows render these, and
1015
+ // the removal announcement joins them, so the three can never
1016
+ // disagree.
1017
+ const describeFilterParts = useCallback(filter => {
1018
+ const field = config.getField(filter.field);
1019
+ const operator = config.getOperator(filter.field, filter.operator);
1020
+ // A filter whose field or operator the config no longer has still
1021
+ // lists, by its raw keys, as its token does on the trigger; its row
1022
+ // opens the unavailable step, and its trailing remove action removes
1023
+ // it.
1024
+ const fieldLabel = field?.label ?? filter.field;
1025
+ const operatorLabel = operator == null ? filter.operator : resolveOperatorLabel(operator, t);
1026
+ const label = operatorLabel ? t('@astryx.powersearch.sheet.fieldOperator', {
1027
+ field: fieldLabel,
1028
+ operator: operatorLabel
1029
+ }) : fieldLabel;
1030
+ if (operator == null) {
1031
+ return {
1032
+ label,
1033
+ value: null
1034
+ };
1035
+ }
1036
+ // A relative-date value is stored as a key (`3d_ago`); the row reads it
1037
+ // as the value step's choice row does ("3 days ago"), through the
1038
+ // catalog's relative-date messages, so the sheet agrees with itself. The popover token
1039
+ // shows the stored key (a known gap of the record).
1040
+ const value = operator.value.type === 'date_relative' && filter.value.type === 'date_relative' ? resolveRelativeDateLabel(operator.value, filter.value.value, t, editors.buildRelativeDateOptions) : formatTokenValueText(operator.value, filter.value, Number.MAX_SAFE_INTEGER, locale, t, formatList, timezoneID);
1041
+ return {
1042
+ label,
1043
+ value
1044
+ };
1045
+ }, [config, editors, formatList, locale, t, timezoneID]);
1046
+ const describeFilter = useCallback(filter => {
1047
+ const parts = describeFilterParts(filter);
1048
+ return parts.value ? t('@astryx.powersearch.sheet.labelValue', {
1049
+ label: parts.label,
1050
+ value: parts.value
1051
+ }) : parts.label;
1052
+ }, [describeFilterParts, t]);
1053
+ const openFieldList = useCallback(() => {
1054
+ if (!isInteractive) {
1055
+ return;
1056
+ }
1057
+ setFieldPickerOrigin('manage');
1058
+ setFieldQuery('');
1059
+ setContentQuery('');
1060
+ pendingSheetFocusRef.current = null;
1061
+ setStep('fields');
1062
+ }, [isInteractive]);
1063
+ const queueManagerAddFocus = useCallback(() => {
1064
+ pendingSheetFocusRef.current = {
1065
+ type: 'manager-add'
1066
+ };
1067
+ }, []);
1068
+ const commitSavedFilter = useCallback((next, filter) => {
1069
+ if (!isInteractive) {
1070
+ queueManagerAddFocus();
1071
+ setStep('manage');
1072
+ return;
1073
+ }
1074
+ if (next.mode === 'edit') {
1075
+ const filterIndex = resolveDraftFilterIndex(filters, next);
1076
+ const currentFilter = filterIndex == null ? undefined : filters[filterIndex];
1077
+ if (filterIndex == null || currentFilter == null || currentFilter.isReadOnly) {
1078
+ // A controlled update removed the edited filter, or left two it
1079
+ // could be, or made it read-only: nothing is written, and focus
1080
+ // returns to the nearest row that is a button around where it was,
1081
+ // else Add filter.
1082
+ pendingSheetFocusRef.current = next.sourceFilter != null && next.sourceSignature != null && next.filterIndex != null ? {
1083
+ type: 'manager-filter',
1084
+ sourceFilter: next.sourceFilter,
1085
+ sourceSignature: next.sourceSignature,
1086
+ preferredIndex: next.filterIndex
1087
+ } : {
1088
+ type: 'manager-add'
1089
+ };
1090
+ setStep('manage');
1091
+ return;
1092
+ }
1093
+ pendingSheetFocusRef.current = {
1094
+ type: 'manager-filter',
1095
+ sourceFilter: filter,
1096
+ sourceSignature: filterSignature(filter),
1097
+ preferredIndex: filterIndex
1098
+ };
1099
+ const updated = [...filters];
1100
+ updated[filterIndex] = filter;
1101
+ onChange(updated, 'edit', filterIndex);
1102
+ } else {
1103
+ queueManagerAddFocus();
1104
+ onChange([...filters, filter], 'add', filters.length);
1105
+ }
1106
+ setStep('manage');
1107
+ }, [filters, isInteractive, onChange, queueManagerAddFocus]);
1108
+
1109
+ // Opening a new filter can come from a field row or a content-search
1110
+ // suggestion. The origin is kept so Cancel returns to the control the person
1111
+ // came from.
1112
+ const openCreateEditor = useCallback((field, operator, returnFocus = 'field') => {
1113
+ setDraft({
1114
+ mode: 'create',
1115
+ generation: nextDraftGeneration(),
1116
+ returnFocus,
1117
+ field: field.key,
1118
+ operator: operator.key,
1119
+ value: operator.value.type === 'empty' ? {
1120
+ type: 'empty'
1121
+ } : undefined
1122
+ });
1123
+ pendingSheetFocusRef.current = null;
1124
+ setStep('value');
1125
+ }, [nextDraftGeneration]);
1126
+ const handleFieldSelect = useCallback(field => {
1127
+ if (!isInteractive) {
1128
+ return;
1129
+ }
1130
+ // A one-tap filter has nothing to stage: choosing its field adds it
1131
+ // and returns to Filters.
1132
+ if (isImmediateAddField(field)) {
1133
+ const [operator] = config.getVisibleOperators(field.key);
1134
+ const nextFilter = {
1135
+ field: field.key,
1136
+ operator: operator.key,
1137
+ value: {
1138
+ type: 'empty'
1139
+ }
1140
+ };
1141
+ pendingSheetFocusRef.current = {
1142
+ type: 'manager-filter',
1143
+ sourceFilter: nextFilter,
1144
+ sourceSignature: filterSignature(nextFilter),
1145
+ preferredIndex: filters.length
1146
+ };
1147
+ pendingMutationFocusRef.current = true;
1148
+ onChange([...filters, nextFilter], 'add', filters.length);
1149
+ pendingAnnouncementRef.current = t('@astryx.tokenizer.tokenAdded', {
1150
+ label: describeFilter(nextFilter)
1151
+ });
1152
+ setStep('manage');
1153
+ return;
1154
+ }
1155
+ const operator = config.getDefaultOperator(field.key) ?? field.operators[0];
1156
+ if (operator == null) {
1157
+ return;
1158
+ }
1159
+ openCreateEditor(field, operator);
1160
+ }, [config, describeFilter, filters, isImmediateAddField, isInteractive, onChange, openCreateEditor, t]);
1161
+ const handleContentSuggestionSelect = useCallback(item => {
1162
+ if (!isInteractive || item?.auxiliaryData == null) {
1163
+ return;
1164
+ }
1165
+ const {
1166
+ fieldKey,
1167
+ filterValue,
1168
+ operatorKey
1169
+ } = item.auxiliaryData;
1170
+ const field = config.getField(fieldKey);
1171
+ const operator = operatorKey == null ? config.getDefaultOperator(fieldKey) : config.getOperator(fieldKey, operatorKey);
1172
+ if (field == null || operator == null) {
1173
+ return;
1174
+ }
1175
+ setContentQuery('');
1176
+ if (filterValue != null) {
1177
+ const nextFilter = {
1178
+ field: field.key,
1179
+ operator: operator.key,
1180
+ value: filterValue
1181
+ };
1182
+ pendingSheetFocusRef.current = {
1183
+ type: 'manager-filter',
1184
+ sourceFilter: nextFilter,
1185
+ sourceSignature: filterSignature(nextFilter),
1186
+ preferredIndex: filters.length
1187
+ };
1188
+ pendingMutationFocusRef.current = true;
1189
+ onChange([...filters, nextFilter], 'add', filters.length);
1190
+ // The same announcement the popover presentation's typeahead add
1191
+ // makes, so assistive technology hears one phrase for one outcome;
1192
+ // spoken once the Filters sheet is the open dialog.
1193
+ pendingAnnouncementRef.current = t('@astryx.tokenizer.tokenAdded', {
1194
+ label: item.label
1195
+ });
1196
+ setStep('manage');
1197
+ return;
1198
+ }
1199
+ openCreateEditor(field, operator, 'content-search');
1200
+ }, [config, filters, isInteractive, onChange, openCreateEditor, t]);
1201
+ const handleFilterEdit = useCallback(index => {
1202
+ const filter = filters[index];
1203
+ if (!isInteractive || filter == null || filter.isReadOnly) {
1204
+ return;
1205
+ }
1206
+ setDraft({
1207
+ mode: 'edit',
1208
+ generation: nextDraftGeneration(),
1209
+ filterIndex: index,
1210
+ sourceFilter: filter,
1211
+ sourceSignature: filterSignature(filter),
1212
+ field: filter.field,
1213
+ operator: filter.operator,
1214
+ value: filter.value
1215
+ });
1216
+ pendingSheetFocusRef.current = null;
1217
+ setStep('value');
1218
+ }, [filters, isInteractive, nextDraftGeneration]);
1219
+ const handleRemoveFilter = useCallback(index => {
1220
+ const filter = filters[index];
1221
+ if (!isInteractive || filter == null || filter.isReadOnly) {
1222
+ return;
1223
+ }
1224
+ const nextFilters = filters.filter((_, i) => i !== index);
1225
+ const nextIndex = nearestEditableIndex(nextFilters, index, isRowButton);
1226
+ if (nextIndex == null) {
1227
+ pendingSheetFocusRef.current = {
1228
+ type: 'manager-add'
1229
+ };
1230
+ } else {
1231
+ const nextFilter = nextFilters[nextIndex];
1232
+ pendingSheetFocusRef.current = {
1233
+ type: 'manager-filter',
1234
+ sourceFilter: nextFilter,
1235
+ sourceSignature: filterSignature(nextFilter),
1236
+ preferredIndex: nextIndex,
1237
+ part: 'remove'
1238
+ };
1239
+ }
1240
+ pendingMutationFocusRef.current = true;
1241
+ onChange(nextFilters, 'remove', index);
1242
+ // The popover presentation's token × announces the same phrase. A
1243
+ // removal from a Filters row stays in that sheet and speaks at once; a
1244
+ // caller's Editor that removes while returning to Filters speaks once
1245
+ // the Filters sheet is the open dialog.
1246
+ const message = t('@astryx.tokenizer.tokenRemoved', {
1247
+ label: describeFilter(filter)
1248
+ });
1249
+ if (stepRef.current === 'manage') {
1250
+ announce(message);
1251
+ } else {
1252
+ pendingAnnouncementRef.current = message;
1253
+ }
1254
+ }, [announce, describeFilter, filters, isInteractive, isRowButton, onChange, t]);
1255
+
1256
+ // Closing Clear all's confirmation. Kept, focus returns to Clear all.
1257
+ // Confirmed, Clear all removes the filters the person can edit and keeps
1258
+ // read-only ones, which are the consumer's: one `remove` at the first
1259
+ // removed index. The Filters sheet stays open for further editing. The
1260
+ // confirmation must be gone before focus moves into the sheet and the
1261
+ // outcome is routed into the sheet's region, so its close is flushed
1262
+ // first. The outcome is "Editable filters removed" while a read-only filter
1263
+ // remains, otherwise "All filters removed"; the result count follows the
1264
+ // applied filters, which change on Done, so none changes here. Focus moves
1265
+ // to the sheet's first remaining control: a kept read-only row has none,
1266
+ // so Add filter.
1267
+ const closeClearConfirmation = confirmed => {
1268
+ const kept = filters.filter(filter => filter.isReadOnly);
1269
+ const firstRemovedIndex = filters.findIndex(filter => !filter.isReadOnly);
1270
+ const isClearing = confirmed && isInteractive && firstRemovedIndex >= 0;
1271
+ // eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves into the sheet and the words are routed into it
1272
+ flushSync(() => {
1273
+ setIsClearConfirmationOpen(false);
1274
+ if (isClearing) {
1275
+ onChange(kept, 'remove', firstRemovedIndex);
1276
+ }
1277
+ });
1278
+ if (!isClearing) {
1279
+ clearAllButtonRef.current?.focus();
1280
+ return;
1281
+ }
1282
+ managerAddButtonRef.current?.focus({
1283
+ preventScroll: true
1284
+ });
1285
+ announce(kept.length > 0 ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.allFiltersRemoved'));
1286
+ };
1287
+ const handleOperatorSelect = useCallback(operator => {
1288
+ setDraft(current => {
1289
+ if (current == null) {
1290
+ return current;
1291
+ }
1292
+ // A value survives an operator change only when the new operator
1293
+ // reads the same value type.
1294
+ const keepsValue = current.value != null && current.value.type === operator.value.type;
1295
+ return {
1296
+ ...current,
1297
+ operator: operator.key,
1298
+ value: operator.value.type === 'empty' ? {
1299
+ type: 'empty'
1300
+ } : keepsValue ? current.value : undefined
1301
+ };
1302
+ });
1303
+ }, []);
1304
+ const handleDraftValueChange = useCallback(value => {
1305
+ setDraft(current => current == null ? current : {
1306
+ ...current,
1307
+ value
1308
+ });
1309
+ }, []);
1310
+ // The number input's draft was cleared or stopped parsing: nothing stands
1311
+ // to confirm, so the confirm action disables again.
1312
+ const handleDraftUnstage = useCallback(() => {
1313
+ setDraft(current => current == null ? current : {
1314
+ ...current,
1315
+ value: undefined
1316
+ });
1317
+ }, []);
1318
+ const handleSave = useCallback(() => {
1319
+ if (draft?.value == null || draft.operator == null) {
1320
+ return;
1321
+ }
1322
+ commitSavedFilter(draft, {
1323
+ field: draft.field,
1324
+ operator: draft.operator,
1325
+ value: draft.value
1326
+ });
1327
+ }, [commitSavedFilter, draft]);
1328
+ const returnFromValue = useCallback(() => {
1329
+ if (draft == null) {
1330
+ queueManagerAddFocus();
1331
+ setStep('manage');
1332
+ return;
1333
+ }
1334
+ if (draft.mode === 'edit' && draft.sourceFilter != null && draft.sourceSignature != null && draft.filterIndex != null) {
1335
+ pendingSheetFocusRef.current = {
1336
+ type: 'manager-filter',
1337
+ sourceFilter: draft.sourceFilter,
1338
+ sourceSignature: draft.sourceSignature,
1339
+ preferredIndex: resolveDraftFilterIndex(filters, draft) ?? draft.filterIndex
1340
+ };
1341
+ setStep('manage');
1342
+ return;
1343
+ }
1344
+ if (draft.returnFocus === 'content-search') {
1345
+ pendingSheetFocusRef.current = {
1346
+ type: 'content-search'
1347
+ };
1348
+ setStep('fields');
1349
+ return;
1350
+ }
1351
+ pendingSheetFocusRef.current = {
1352
+ type: 'field',
1353
+ fieldKey: draft.field
1354
+ };
1355
+ setStep('fields');
1356
+ }, [draft, filters, queueManagerAddFocus]);
1357
+ const handleRemove = useCallback(() => {
1358
+ if (draft?.mode !== 'edit') {
1359
+ return;
1360
+ }
1361
+ const filterIndex = resolveDraftFilterIndex(filters, draft);
1362
+ if (filterIndex == null || filters[filterIndex]?.isReadOnly) {
1363
+ queueManagerAddFocus();
1364
+ setStep('manage');
1365
+ return;
1366
+ }
1367
+ handleRemoveFilter(filterIndex);
1368
+ setStep('manage');
1369
+ }, [draft, filters, handleRemoveFilter, queueManagerAddFocus]);
1370
+
1371
+ // Each step sheet is controlled by `step`; a sheet only ever asks to close
1372
+ // (a dismissal its `purpose` allows: Escape, the scrim, a swipe, a platform
1373
+ // close request), which only the top sheet of the stack receives. Closing
1374
+ // the top step reveals the step beneath it; closing the bottom one ends the
1375
+ // flow. A stale report from a step that is no longer current is ignored.
1376
+ // Every step change goes through the handlers above.
1377
+ const handleManageOpenChange = useCallback(isSheetOpen => {
1378
+ if (!isSheetOpen && stepRef.current === 'manage') {
1379
+ requestDismiss();
1380
+ }
1381
+ }, [requestDismiss]);
1382
+ const handleFieldsOpenChange = useCallback(isSheetOpen => {
1383
+ if (isSheetOpen || stepRef.current !== 'fields') {
1384
+ return;
1385
+ }
1386
+ if (fieldPickerOrigin === 'trigger') {
1387
+ requestDismiss();
1388
+ return;
1389
+ }
1390
+ queueManagerAddFocus();
1391
+ setStep('manage');
1392
+ }, [fieldPickerOrigin, queueManagerAddFocus, requestDismiss]);
1393
+ const handleValueOpenChange = useCallback(isSheetOpen => {
1394
+ if (!isSheetOpen && stepRef.current === 'value') {
1395
+ returnFromValue();
1396
+ }
1397
+ }, [returnFromValue]);
1398
+
1399
+ // ---------------------------------------------------------------- render --
1400
+
1401
+ // Rows are keyed by filter identity, not position: a parent's reorder or a
1402
+ // removal above the focused row then moves elements instead of remounting
1403
+ // them, and focus stays on the same filter. Only a filter that is
1404
+ // itself removed loses its element, and the re-home effect above takes
1405
+ // over.
1406
+ const [filterIdentities] = useState(createFilterIdentities);
1407
+ const filterIds = filterIdentities.next(filters);
1408
+ const filterRows = filters.map((filter, index) => {
1409
+ const {
1410
+ label,
1411
+ value
1412
+ } = describeFilterParts(filter);
1413
+ const isEditable = isRowButton(filter);
1414
+ // The row reads from the same catalog message the removal announcement
1415
+ // uses (`labelValue`), so a locale that reorders it reorders both: the
1416
+ // message is formatted with a placeholder for the value, and the text
1417
+ // either side of that placeholder wraps the bold value.
1418
+ let displayLabel = label;
1419
+ if (value) {
1420
+ const [before, after] = t('@astryx.powersearch.sheet.labelValue', {
1421
+ label,
1422
+ value: ROW_VALUE_SLOT
1423
+ }).split(ROW_VALUE_SLOT);
1424
+ displayLabel = /*#__PURE__*/_jsxs(_Fragment, {
1425
+ children: [before, /*#__PURE__*/_jsx("span", {
1426
+ ...{
1427
+ className: "x1lvx875"
1428
+ },
1429
+ children: value
1430
+ }), after]
1431
+ });
1432
+ }
1433
+ return {
1434
+ displayLabel,
1435
+ filter,
1436
+ index,
1437
+ isEditable,
1438
+ key: `filter-${filterIds[index]}`
1439
+ };
1440
+ });
1441
+ const hasRemovableFilter = filters.some(filter => !filter.isReadOnly);
1442
+ const isClearAllShown = hasClear && isInteractive && hasRemovableFilter;
1443
+ const EditorOverride = draftOperator != null ? componentOverrides?.[draftOperator.value.type]?.Editor : undefined;
1444
+ const draftOperatorLabel = draftOperator == null ? '' : resolveOperatorLabel(draftOperator, t);
1445
+ // The title names the filter's own operator when the step offers no
1446
+ // Operator group: one visible operator, or an operator the config no longer
1447
+ // lists as visible. The step then never shows another operator's name.
1448
+ const showsOperatorGroup = draftOperators.length > 1 && draftOperator != null && draftOperators.includes(draftOperator);
1449
+ // The title — the dialog's name — reads the field and operator as
1450
+ // the Filters row does: by their labels, or, for a filter whose field or
1451
+ // operator the config no longer has, by the raw keys the row shows.
1452
+ const editorTitle = draft == null ? t('@astryx.powersearch.sheet.addFilter') : draftField == null || draftOperator == null && draft.operator != null ? t('@astryx.powersearch.sheet.fieldOperator', {
1453
+ field: draftField?.label ?? draft.field,
1454
+ operator: draftOperatorLabel !== '' ? draftOperatorLabel : draft.operator ?? ''
1455
+ }).trim() : !showsOperatorGroup && draftOperatorLabel !== '' ? t('@astryx.powersearch.sheet.fieldOperator', {
1456
+ field: draftField.label,
1457
+ operator: draftOperatorLabel
1458
+ }) : draftField.label;
1459
+ const saveButtonLabel = saveButtonLabelFromProps ?? (draft?.mode === 'edit' ? t('@astryx.powersearch.editor.apply') : t('@astryx.powersearch.sheet.addFilter'));
1460
+
1461
+ // Every sheet body: padded, and publishing that padding to its lists.
1462
+ const bodyProps = stylex.props(styles.body, containerPaddingInlineVarStyles[4]);
1463
+ const scrollContentProps = stylex.props(styles.scrollContent, containerPaddingInlineVarStyles[4]);
1464
+ const controlSectionProps = stylex.props(styles.controlSection, containerPaddingInlineVarStyles[3]);
1465
+
1466
+ // A vertical touch drag on the Add filter rows moves focus off a focused
1467
+ // search to the sheet, so the software keyboard leaves and the rows can be
1468
+ // read.
1469
+ const fieldPickerDragProps = useDismissSearchOnTouchDrag(() => [contentSearchRef.current?.querySelector('input'), fieldSearchRef.current?.querySelector('input')], () => fieldsSheetRef.current?.closest('[tabindex="-1"]'));
1470
+ const isEditorDisabled = isDisabled || isReadOnly;
1471
+ const isSaveDisabled = isEditorDisabled || draft?.operator == null || draft.value == null;
1472
+ // The step has something to edit when the field and operator still exist
1473
+ // (a controlled config update can remove either). A caller's `Editor`
1474
+ // override replaces the body for its value type with the props the popover
1475
+ // hands it; otherwise a `nested` value takes the popover's built-in
1476
+ // NestedEditor and every other type the sheet's own control.
1477
+ const isDraftRenderable = draft != null && draftField != null && draftOperator != null;
1478
+ const isDraftNested = isDraftRenderable && !isSupportedOperator(draftOperator);
1479
+ // A controlled config update that removes the field or operator being
1480
+ // edited replaces the step's body with the unavailable state while focus
1481
+ // may be on one of the body's controls, which unmount without a blur. Focus
1482
+ // then moves to Cancel, the way back to the Filters row whose remove action
1483
+ // is the removal path, so it never falls to the page body inside the open
1484
+ // sheet. The message itself is announced by its rendered element.
1485
+ const cancelButtonRef = useRef(null);
1486
+ const wasDraftRenderableRef = useRef(isDraftRenderable);
1487
+ useLayoutEffect(() => {
1488
+ const becameUnavailable = wasDraftRenderableRef.current && !isDraftRenderable && draft != null;
1489
+ wasDraftRenderableRef.current = isDraftRenderable;
1490
+ if (!becameUnavailable || step !== 'value') {
1491
+ return;
1492
+ }
1493
+ const active = document.activeElement;
1494
+ const dialog = cancelButtonRef.current?.closest('dialog');
1495
+ if (dialog != null && active != null && dialog.contains(active)) {
1496
+ return;
1497
+ }
1498
+ cancelButtonRef.current?.focus();
1499
+ }, [draft, isDraftRenderable, step]);
1500
+ // The operator group stays outside either editor, so switching operators
1501
+ // swaps the body — a `nested` operator beside a plain one included.
1502
+ const operatorGroup = isDraftRenderable && showsOperatorGroup && /*#__PURE__*/_jsx(RadioList, {
1503
+ label: t('@astryx.powersearch.editor.operator'),
1504
+ isLabelHidden: true,
1505
+ value: draft.operator ?? '',
1506
+ onChange: operatorKey => {
1507
+ const operator = draftOperators.find(candidate => candidate.key === operatorKey);
1508
+ if (operator != null) {
1509
+ handleOperatorSelect(operator);
1510
+ }
1511
+ },
1512
+ isDisabled: isEditorDisabled,
1513
+ children: draftOperators.map(operator => /*#__PURE__*/_jsx(RadioListItem, {
1514
+ label: t('@astryx.powersearch.sheet.fieldOperator', {
1515
+ field: draftField.label,
1516
+ operator: resolveOperatorLabel(operator, t)
1517
+ }),
1518
+ value: operator.key,
1519
+ xstyle: styles.trailingControlRow
1520
+ }, operator.key))
1521
+ });
1522
+ // The step's Operator group owns the operator choice, so the built-in
1523
+ // nested editor's root operator picker is hidden and its root shows the
1524
+ // checked operator's label.
1525
+ const nestedOperatorOptions = useMemo(() => draftOperator == null ? [] : [{
1526
+ value: draftOperator.key,
1527
+ label: resolveOperatorLabel(draftOperator, t)
1528
+ }], [draftOperator, t]);
1529
+ const handleNestedDraftChange = useCallback(next => {
1530
+ setDraft(current => current == null ? current : {
1531
+ ...current,
1532
+ value: next.value
1533
+ });
1534
+ }, []);
1535
+ const valueEditor = isDraftRenderable && (isDraftNested ? /*#__PURE__*/_jsx(NestedEditor, {
1536
+ config: config,
1537
+ partialFilter: {
1538
+ field: draft.field,
1539
+ operator: draft.operator,
1540
+ value: draft.value
1541
+ },
1542
+ operatorOptions: nestedOperatorOptions,
1543
+ hasRootOperatorPicker: false,
1544
+ onOperatorChange: () => {},
1545
+ onPartialFilterChange: handleNestedDraftChange,
1546
+ maxMenuItems: maxOperatorMenuItems,
1547
+ timezoneID: timezoneID,
1548
+ isReadOnly: isEditorDisabled,
1549
+ xstyle: styles.nestedEditorContainer
1550
+ }, `${draft.generation}-${draft.field}-${draft.operator}`) : /*#__PURE__*/_jsx(SheetValueEditor, {
1551
+ operatorValue: draftOperator.value,
1552
+ filterValue: draft.value,
1553
+ onChange: handleDraftValueChange,
1554
+ onUnstage: handleDraftUnstage,
1555
+ config: config,
1556
+ fieldLabel: draftField.label,
1557
+ isDisabled: isEditorDisabled,
1558
+ maxMenuItems: maxOperatorMenuItems,
1559
+ timezoneID: timezoneID,
1560
+ editors: editors
1561
+ }, `${draft.generation}-${draft.field}-${draft.operator}`));
1562
+ return /*#__PURE__*/_jsxs(_Fragment, {
1563
+ children: [/*#__PURE__*/_jsx(BottomSheet, {
1564
+ isOpen: isManageSheetOpen,
1565
+ onOpenChange: handleManageOpenChange,
1566
+ finalFocusRef: finalFocusRef,
1567
+ label: t('@astryx.powersearch.sheet.filtersTitle'),
1568
+ height: "tall",
1569
+ padding: 0,
1570
+ children: /*#__PURE__*/_jsxs("div", {
1571
+ ref: manageSheetRef,
1572
+ onFocus: noteSheetFocus('manage'),
1573
+ ...{
1574
+ className: "x78zum5 xdt5ytf x1us19tq xc8icb0 x5yr21d xb3r6kr"
1575
+ },
1576
+ children: [step === 'manage' && /*#__PURE__*/_jsx(SheetAnnouncer, {
1577
+ onAnnounceChange: handleAnnounceChange
1578
+ }), /*#__PURE__*/_jsx("div", {
1579
+ ...{
1580
+ className: "x7wzq59 x13vifvy x1vjfegm x78zum5 xdt5ytf xjcht0a x1adxfkp xvmdzux x1pzlopt x10xzikg"
1581
+ },
1582
+ children: /*#__PURE__*/_jsxs("div", {
1583
+ ...{
1584
+ className: "x78zum5 x6s0dn4 x1txdalj"
1585
+ },
1586
+ children: [/*#__PURE__*/_jsx("div", {
1587
+ ...{
1588
+ className: "xeuugli x1iyjqo2 x78zum5 xdt5ytf"
1589
+ },
1590
+ children: /*#__PURE__*/_jsx(Heading, {
1591
+ level: 3,
1592
+ children: t('@astryx.powersearch.sheet.filtersTitle')
1593
+ })
1594
+ }), isInteractive && filterRows.length > 0 && /*#__PURE__*/_jsx(Button, {
1595
+ ref: managerAddButtonRef,
1596
+ label: t('@astryx.powersearch.sheet.addFilter'),
1597
+ icon: /*#__PURE__*/_jsx(Icon, {
1598
+ icon: PlusIcon,
1599
+ size: "sm"
1600
+ }),
1601
+ isIconOnly: true,
1602
+ variant: "secondary",
1603
+ size: "md",
1604
+ xstyle: styles.touchHitArea,
1605
+ onClick: openFieldList
1606
+ })]
1607
+ })
1608
+ }), /*#__PURE__*/_jsx("div", {
1609
+ ...{
1610
+ className: "x1iyjqo2 x2lwn1j x1odjw0f x1e4zzel"
1611
+ },
1612
+ children: /*#__PURE__*/_jsx("div", {
1613
+ ...scrollContentProps,
1614
+ children: filterRows.length === 0 ?
1615
+ // With no filter the single thing to do is the only visible
1616
+ // action. Mounted only while the sheet is open, so its text
1617
+ // is spoken in this sheet when it appears.
1618
+ isManageSheetOpen && /*#__PURE__*/_jsx(EmptyState, {
1619
+ title: t(isDraftDirty ? '@astryx.powersearch.sheet.noFiltersInDraft' : '@astryx.powersearch.sheet.noFilters'),
1620
+ description: t('@astryx.powersearch.sheet.noFiltersDescription'),
1621
+ headingLevel: 4,
1622
+ icon: /*#__PURE__*/_jsx(Icon, {
1623
+ icon: "funnel",
1624
+ size: "lg",
1625
+ color: "secondary"
1626
+ }),
1627
+ xstyle: styles.emptyState,
1628
+ actions: isInteractive ? /*#__PURE__*/_jsx(Button, {
1629
+ ref: managerAddButtonRef,
1630
+ label: t('@astryx.powersearch.sheet.addFilter'),
1631
+ icon: /*#__PURE__*/_jsx(Icon, {
1632
+ icon: PlusIcon,
1633
+ size: "sm"
1634
+ }),
1635
+ variant: "primary",
1636
+ size: "lg",
1637
+ xstyle: styles.touchHitArea,
1638
+ onClick: openFieldList
1639
+ }) : undefined
1640
+ }) : /*#__PURE__*/_jsx(List, {
1641
+ hasDividers: true,
1642
+ density: "spacious",
1643
+ edge: "bleed",
1644
+ children: filterRows.map(row => {
1645
+ const operator = config.getOperator(row.filter.field, row.filter.operator);
1646
+ const fieldLabel = config.getField(row.filter.field)?.label ?? row.filter.field;
1647
+ // A one-tap filter has no value to edit: its row removes
1648
+ // it.
1649
+ const isOneTap = operator?.value.type === 'empty';
1650
+ const removeLabel = t('@astryx.powersearch.sheet.removeFilter', {
1651
+ field: fieldLabel
1652
+ });
1653
+ return /*#__PURE__*/_jsx(ListItem, {
1654
+ ref: node => {
1655
+ if (node == null) {
1656
+ managerRowsRef.current.delete(row.index);
1657
+ } else {
1658
+ managerRowsRef.current.set(row.index, node);
1659
+ }
1660
+ },
1661
+ label: row.displayLabel,
1662
+ onClick: row.isEditable ? isOneTap ? () => handleRemoveFilter(row.index) : () => handleFilterEdit(row.index) : undefined,
1663
+ endContent: row.isEditable ? /*#__PURE__*/_jsx(IconButton, {
1664
+ "data-sheet-remove": "",
1665
+ label: removeLabel,
1666
+ tooltip: removeLabel,
1667
+ icon: /*#__PURE__*/_jsx(Icon, {
1668
+ icon: "close",
1669
+ size: "sm"
1670
+ }),
1671
+ variant: "ghost",
1672
+ size: "md",
1673
+ xstyle: styles.touchHitArea,
1674
+ onClick: event => {
1675
+ event.stopPropagation();
1676
+ handleRemoveFilter(row.index);
1677
+ }
1678
+ }) : undefined
1679
+ }, row.key);
1680
+ })
1681
+ })
1682
+ })
1683
+ }), (filterRows.length > 0 || isDraftDirty) && /*#__PURE__*/_jsxs("div", {
1684
+ ...{
1685
+ className: "x1vjfegm x78zum5 x6s0dn4 x1qughib x1txdalj x8o8v82 x1pzlopt x10xzikg x1n2onr6 xdd4er5 x2lah0s"
1686
+ },
1687
+ children: [isClearAllShown && /*#__PURE__*/_jsx(Button, {
1688
+ ref: clearAllButtonRef,
1689
+ label: t('@astryx.powersearch.sheet.clearAll'),
1690
+ variant: "secondary",
1691
+ size: "lg",
1692
+ xstyle: styles.footerEqualAction,
1693
+ onClick: () => setIsClearConfirmationOpen(true)
1694
+ }), /*#__PURE__*/_jsx(Button, {
1695
+ label: t('@astryx.powersearch.sheet.done'),
1696
+ variant: "primary",
1697
+ size: "lg",
1698
+ xstyle: isClearAllShown ? styles.footerEqualAction : [styles.footerSoleAction, styles.touchHitArea],
1699
+ onClick: commitAndClose,
1700
+ width: isClearAllShown ? undefined : '100%'
1701
+ })]
1702
+ })]
1703
+ })
1704
+ }), /*#__PURE__*/_jsx(BottomSheet, {
1705
+ isOpen: isFieldsSheetOpen,
1706
+ onOpenChange: handleFieldsOpenChange,
1707
+ finalFocusRef: stepFinalFocusRef,
1708
+ label: t('@astryx.powersearch.sheet.addFilter'),
1709
+ height: "tall",
1710
+ padding: 0,
1711
+ children: /*#__PURE__*/_jsxs("div", {
1712
+ ref: fieldsSheetCallbackRef,
1713
+ onFocus: noteSheetFocus('fields'),
1714
+ onKeyDown: hasContentSearch ? handleContentListKeyDown : undefined,
1715
+ ...{
1716
+ className: "x78zum5 xdt5ytf x1us19tq xc8icb0 x5yr21d xb3r6kr"
1717
+ },
1718
+ children: [step === 'fields' && /*#__PURE__*/_jsx(SheetAnnouncer, {
1719
+ onAnnounceChange: handleAnnounceChange
1720
+ }), /*#__PURE__*/_jsxs("div", {
1721
+ ...{
1722
+ className: "x7wzq59 x13vifvy x1vjfegm x78zum5 xdt5ytf xjcht0a x1adxfkp xvmdzux x1pzlopt x10xzikg"
1723
+ },
1724
+ children: [/*#__PURE__*/_jsx("div", {
1725
+ ...{
1726
+ className: "x78zum5 x6s0dn4 x1txdalj"
1727
+ },
1728
+ children: /*#__PURE__*/_jsx("div", {
1729
+ ...{
1730
+ className: "xeuugli x1iyjqo2 x78zum5 xdt5ytf"
1731
+ },
1732
+ children: /*#__PURE__*/_jsx(Heading, {
1733
+ level: 3,
1734
+ children: t('@astryx.powersearch.sheet.addFilter')
1735
+ })
1736
+ })
1737
+ }), hasContentSearch ? /*#__PURE__*/_jsx("div", {
1738
+ ref: contentSearchRef,
1739
+ children: /*#__PURE__*/_jsx(TextInput, {
1740
+ label: t('@astryx.powersearch.sheet.search'),
1741
+ isLabelHidden: true,
1742
+ role: "searchbox",
1743
+ "aria-controls": contentResultsId,
1744
+ value: contentQuery,
1745
+ onChange: setContentQuery,
1746
+ onKeyDown: event => {
1747
+ if (isImeKeyEvent(event.nativeEvent)) {
1748
+ return;
1749
+ }
1750
+ if (event.key === 'Enter' && contentResults[0] != null) {
1751
+ event.preventDefault();
1752
+ handleContentSuggestionSelect(contentResults[0]);
1753
+ }
1754
+ },
1755
+ placeholder: placeholder,
1756
+ hasClear: true,
1757
+ startIcon: /*#__PURE__*/_jsx(Icon, {
1758
+ icon: "search",
1759
+ size: "sm",
1760
+ color: "secondary"
1761
+ }),
1762
+ isDisabled: !isInteractive,
1763
+ size: "lg",
1764
+ width: "100%"
1765
+ })
1766
+ }) : isFieldSearchShown ? /*#__PURE__*/_jsx("div", {
1767
+ ref: fieldSearchRef,
1768
+ children: /*#__PURE__*/_jsx(TextInput, {
1769
+ label: t('@astryx.powersearch.sheet.searchFields'),
1770
+ isLabelHidden: true,
1771
+ placeholder: t('@astryx.powersearch.sheet.searchFieldsPlaceholder'),
1772
+ value: fieldQuery,
1773
+ onChange: setFieldQuery,
1774
+ startIcon: /*#__PURE__*/_jsx(Icon, {
1775
+ icon: "search",
1776
+ size: "sm",
1777
+ color: "secondary"
1778
+ }),
1779
+ isDisabled: !isInteractive,
1780
+ size: "lg",
1781
+ width: "100%"
1782
+ })
1783
+ }) : null]
1784
+ }), /*#__PURE__*/_jsx("div", {
1785
+ ...{
1786
+ className: "x1iyjqo2 x2lwn1j x1odjw0f x1e4zzel"
1787
+ },
1788
+ ...fieldPickerDragProps,
1789
+ children: /*#__PURE__*/_jsx("div", {
1790
+ ...scrollContentProps,
1791
+ children: hasContentSearch ? contentResults.length > 0 ? /*#__PURE__*/_jsx(List, {
1792
+ id: contentResultsId,
1793
+ "aria-label": t('@astryx.powersearch.sheet.searchResults'),
1794
+ hasDividers: true,
1795
+ density: "spacious",
1796
+ edge: "bleed",
1797
+ children: contentResults.map(item => /*#__PURE__*/_jsx(ListItem, {
1798
+ label: item.label,
1799
+ isDisabled: !isInteractive,
1800
+ onClick: () => handleContentSuggestionSelect(item)
1801
+ }, item.id))
1802
+ }) : contentQuery.trim() !== '' ?
1803
+ /*#__PURE__*/
1804
+ // The searchbox's `aria-controls` target while nothing
1805
+ // lists. The empty state mounts only while this step is the
1806
+ // open one and is spoken from its rendered text, once per
1807
+ // query that matches nothing.
1808
+ _jsx("div", {
1809
+ id: contentResultsId,
1810
+ children: step === 'fields' && /*#__PURE__*/_jsx(EmptyState, {
1811
+ icon: /*#__PURE__*/_jsx(Icon, {
1812
+ icon: "search",
1813
+ size: "lg",
1814
+ color: "secondary"
1815
+ }),
1816
+ title: t('@astryx.powersearch.sheet.noResults'),
1817
+ description: t('@astryx.powersearch.sheet.tryDifferentSearch'),
1818
+ headingLevel: 4,
1819
+ isCompact: true,
1820
+ xstyle: styles.emptyState
1821
+ }, contentQuery)
1822
+ }) :
1823
+ /*#__PURE__*/
1824
+ // An empty query with no bootstrap suggestion: the results
1825
+ // region exists, empty, so the searchbox's `aria-controls`
1826
+ // always names an element in the document.
1827
+ _jsx("div", {
1828
+ id: contentResultsId
1829
+ }) : groupedFields.length === 0 ?
1830
+ // A search outcome: only a non-empty query that matches
1831
+ // nothing shows it; a config with no field lists nothing.
1832
+ normalizedFieldQuery !== '' && step === 'fields' && /*#__PURE__*/_jsx(EmptyState, {
1833
+ icon: /*#__PURE__*/_jsx(Icon, {
1834
+ icon: "search",
1835
+ size: "lg",
1836
+ color: "secondary"
1837
+ }),
1838
+ title: t('@astryx.powersearch.sheet.noMatchingFields'),
1839
+ description: t('@astryx.powersearch.sheet.tryDifferentSearch'),
1840
+ headingLevel: 4,
1841
+ isCompact: true,
1842
+ xstyle: styles.emptyState
1843
+ }, normalizedFieldQuery) : groupedFields.map(([group, groupFields]) => /*#__PURE__*/_jsx(List, {
1844
+ hasDividers: true,
1845
+ density: "spacious",
1846
+ header: /*#__PURE__*/_jsx(Heading, {
1847
+ level: 4,
1848
+ children: group === '' ? t('@astryx.powersearch.sheet.ungroupedFields') : group
1849
+ }),
1850
+ edge: "bleed",
1851
+ children: groupFields.map(field => /*#__PURE__*/_jsx(ListItem, {
1852
+ ref: node => {
1853
+ if (node == null) {
1854
+ fieldRowsRef.current.delete(field.key);
1855
+ } else {
1856
+ fieldRowsRef.current.set(field.key, node);
1857
+ }
1858
+ },
1859
+ label: field.label,
1860
+ isDisabled: !isInteractive,
1861
+ startContent: field.icon,
1862
+ endContent: isImmediateAddField(field) ? /*#__PURE__*/_jsx(Icon, {
1863
+ icon: PlusIcon,
1864
+ size: "sm",
1865
+ color: "secondary"
1866
+ }) : /*#__PURE__*/_jsx(Icon, {
1867
+ icon: "chevronRight",
1868
+ size: "sm",
1869
+ color: "secondary",
1870
+ xstyle: rtlStyles.mirror
1871
+ }),
1872
+ onClick: () => handleFieldSelect(field)
1873
+ }, field.key))
1874
+ }, group))
1875
+ })
1876
+ }), isFieldPickerDirectEntry && /*#__PURE__*/_jsx("div", {
1877
+ ...{
1878
+ className: "x1vjfegm x78zum5 x6s0dn4 x1qughib x1txdalj x8o8v82 x1pzlopt x10xzikg x1n2onr6 xdd4er5 x2lah0s"
1879
+ },
1880
+ children: /*#__PURE__*/_jsx(Button, {
1881
+ label: t('@astryx.powersearch.sheet.done'),
1882
+ variant: "primary",
1883
+ width: "100%",
1884
+ xstyle: styles.touchAction,
1885
+ onClick: commitAndClose
1886
+ })
1887
+ })]
1888
+ })
1889
+ }), /*#__PURE__*/_jsx(BottomSheet, {
1890
+ isOpen: step === 'value',
1891
+ onOpenChange: handleValueOpenChange,
1892
+ finalFocusRef: stepFinalFocusRef,
1893
+ label: editorTitle,
1894
+ height: "tall",
1895
+ padding: 0,
1896
+ purpose: "info",
1897
+ children: /*#__PURE__*/_jsxs("div", {
1898
+ ...{
1899
+ className: "x78zum5 xdt5ytf x1us19tq xc8icb0"
1900
+ },
1901
+ children: [/*#__PURE__*/_jsx("div", {
1902
+ ...{
1903
+ className: "x7wzq59 x13vifvy x1vjfegm x78zum5 xdt5ytf xjcht0a x1adxfkp xvmdzux x1pzlopt x10xzikg"
1904
+ },
1905
+ children: /*#__PURE__*/_jsx("div", {
1906
+ ...{
1907
+ className: "x78zum5 x6s0dn4 x1txdalj"
1908
+ },
1909
+ children: /*#__PURE__*/_jsx("div", {
1910
+ ...{
1911
+ className: "xeuugli x1iyjqo2 x78zum5 xdt5ytf"
1912
+ },
1913
+ children: /*#__PURE__*/_jsx(Heading, {
1914
+ level: 3,
1915
+ maxLines: 1,
1916
+ children: editorTitle
1917
+ })
1918
+ })
1919
+ })
1920
+ }), isDraftRenderable && EditorOverride != null ? /*#__PURE__*/_jsxs("div", {
1921
+ ...bodyProps,
1922
+ children: [step === 'value' && /*#__PURE__*/_jsx(SheetAnnouncer, {
1923
+ onAnnounceChange: handleAnnounceChange
1924
+ }), operatorGroup && /*#__PURE__*/_jsx("div", {
1925
+ ...controlSectionProps,
1926
+ children: operatorGroup
1927
+ }), /*#__PURE__*/_jsx(EditorOverride, {
1928
+ config: configProp,
1929
+ filter: {
1930
+ field: draft.field,
1931
+ operator: draft.operator,
1932
+ value: draft.value
1933
+ },
1934
+ mode: draft.mode,
1935
+ onSave: saved => {
1936
+ if (saved == null) {
1937
+ if (draft.mode === 'edit') {
1938
+ handleRemove();
1939
+ } else {
1940
+ queueManagerAddFocus();
1941
+ setStep('manage');
1942
+ }
1943
+ return;
1944
+ }
1945
+ commitSavedFilter(draft, saved);
1946
+ },
1947
+ onCancel: returnFromValue,
1948
+ saveButtonLabel: saveButtonLabel,
1949
+ isReadOnly: isEditorDisabled,
1950
+ timezoneID: timezoneID
1951
+ }, `${draft.generation}-${draft.field}-${draft.operator}`)]
1952
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
1953
+ children: [/*#__PURE__*/_jsxs("div", {
1954
+ ...bodyProps,
1955
+ children: [step === 'value' && /*#__PURE__*/_jsx(SheetAnnouncer, {
1956
+ onAnnounceChange: handleAnnounceChange
1957
+ }), isDraftRenderable ?
1958
+ // A lone editor sits on the sheet's surface; with the
1959
+ // Operator group above it, each section is a muted
1960
+ // container.
1961
+ operatorGroup ? /*#__PURE__*/_jsxs(_Fragment, {
1962
+ children: [/*#__PURE__*/_jsx("div", {
1963
+ ...controlSectionProps,
1964
+ children: operatorGroup
1965
+ }), /*#__PURE__*/_jsx("div", {
1966
+ ...controlSectionProps,
1967
+ children: valueEditor
1968
+ })]
1969
+ }) : valueEditor :
1970
+ // A controlled config update removed the field or operator
1971
+ // being edited: say so (the element's rendered text is
1972
+ // announced, once per opened filter, while this step is the
1973
+ // open one) and keep a way out.
1974
+ draft != null && /*#__PURE__*/_jsx(SheetEmptyMessage, {
1975
+ message: t('@astryx.powersearch.sheet.filterUnavailable'),
1976
+ occasion: String(draft.generation),
1977
+ isShown: step === 'value'
1978
+ })]
1979
+ }), /*#__PURE__*/_jsx("div", {
1980
+ ...{
1981
+ className: "x7wzq59 x1ey2m1c x1vjfegm x78zum5 x6s0dn4 x1qughib x1txdalj x8o8v82 x1pzlopt x10xzikg"
1982
+ },
1983
+ children: isReadOnly ? /*#__PURE__*/_jsx(Button, {
1984
+ ref: cancelButtonRef,
1985
+ label: t('@astryx.powersearch.editor.cancel'),
1986
+ variant: "secondary",
1987
+ width: "100%",
1988
+ xstyle: [styles.footerSoleAction, styles.touchHitArea],
1989
+ onClick: returnFromValue
1990
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
1991
+ children: [/*#__PURE__*/_jsx(Button, {
1992
+ ref: cancelButtonRef,
1993
+ label: t('@astryx.powersearch.editor.cancel'),
1994
+ variant: "secondary",
1995
+ size: "lg",
1996
+ xstyle: styles.footerEqualAction,
1997
+ onClick: returnFromValue
1998
+ }), isDraftRenderable && /*#__PURE__*/_jsx(Button, {
1999
+ label: saveButtonLabel,
2000
+ variant: "primary",
2001
+ size: "lg",
2002
+ isDisabled: isSaveDisabled,
2003
+ xstyle: styles.footerEqualAction,
2004
+ onClick: handleSave
2005
+ })]
2006
+ })
2007
+ })]
2008
+ })]
2009
+ })
2010
+ }), isClearConfirmationOpen && /*#__PURE__*/_jsx(SheetConfirmation, {
2011
+ isOpen: true,
2012
+ onOpenChange: isConfirmationOpen => {
2013
+ if (!isConfirmationOpen) {
2014
+ closeClearConfirmation(false);
2015
+ }
2016
+ },
2017
+ title: t('@astryx.powersearch.sheet.clearAllTitle'),
2018
+ description: t('@astryx.powersearch.sheet.clearAllDescription'),
2019
+ actionLabel: t('@astryx.powersearch.sheet.clearAllConfirm'),
2020
+ cancelLabel: t('@astryx.powersearch.sheet.clearAllCancel'),
2021
+ onAction: () => closeClearConfirmation(true)
2022
+ }), isDiscardConfirmationOpen && /*#__PURE__*/_jsx(SheetConfirmation, {
2023
+ isOpen: true,
2024
+ onOpenChange: isConfirmationOpen => {
2025
+ if (!isConfirmationOpen) {
2026
+ closeDiscardConfirmation();
2027
+ }
2028
+ },
2029
+ title: t('@astryx.powersearch.sheet.discardTitle'),
2030
+ description: t('@astryx.powersearch.sheet.discardDescription'),
2031
+ actionLabel: t('@astryx.powersearch.sheet.discardConfirm'),
2032
+ cancelLabel: t('@astryx.powersearch.sheet.keepEditing'),
2033
+ onAction: () => {
2034
+ setIsDiscardConfirmationOpen(false);
2035
+ draftEditsRef.current = [];
2036
+ closeFlow();
2037
+ }
2038
+ })]
2039
+ });
2040
+ }
2041
+ PowerSearchBottomSheet.displayName = 'PowerSearchBottomSheet';