@astryxdesign/core 0.7.8-canary.ffd29c5 → 0.7.8

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 (189) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
  3. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheetPanel.js +30 -14
  5. package/dist/BottomSheet/bottomSheetStack.js +1 -1
  6. package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
  7. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  8. package/dist/BottomSheet/useSheetGestures.js +4 -0
  9. package/dist/CheckboxList/CheckboxList.d.ts +13 -2
  10. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  11. package/dist/CheckboxList/CheckboxList.js +10 -4
  12. package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
  13. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  14. package/dist/CheckboxList/CheckboxListContext.js +2 -1
  15. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  16. package/dist/CheckboxList/CheckboxListItem.js +14 -2
  17. package/dist/CheckboxList/requiredGroup.d.ts +22 -0
  18. package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
  19. package/dist/CheckboxList/requiredGroup.js +52 -0
  20. package/dist/DateInput/PickerWheel.d.ts +1 -1
  21. package/dist/DateInput/PickerWheel.d.ts.map +1 -1
  22. package/dist/DateInput/PickerWheel.js +27 -6
  23. package/dist/DateInput/Wheel.d.ts +2 -2
  24. package/dist/DateInput/Wheel.d.ts.map +1 -1
  25. package/dist/DateInput/Wheel.js +20 -6
  26. package/dist/DateInput/datePickerTouch.d.ts +13 -0
  27. package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
  28. package/dist/DateInput/datePickerTouch.js +14 -0
  29. package/dist/DateInput/wheelOptions.d.ts +22 -2
  30. package/dist/DateInput/wheelOptions.d.ts.map +1 -1
  31. package/dist/DateInput/wheelOptions.js +14 -2
  32. package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
  33. package/dist/DateTimeInput/TouchDateTimeField.js +62 -119
  34. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  35. package/dist/HoverCard/useHoverCard.js +6 -1
  36. package/dist/Overlay/Overlay.d.ts.map +1 -1
  37. package/dist/Overlay/Overlay.js +7 -2
  38. package/dist/PowerSearch/PowerSearch.d.ts +4 -2
  39. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  40. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +24 -1
  41. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
  42. package/dist/PowerSearch/PowerSearchBottomSheet.js +172 -50
  43. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  44. package/dist/Resizable/ResizeHandle.js +15 -15
  45. package/dist/Resizable/createResizable.d.ts +70 -16
  46. package/dist/Resizable/createResizable.d.ts.map +1 -1
  47. package/dist/Resizable/createResizable.js +180 -22
  48. package/dist/Resizable/separatorAttributes.d.ts +45 -0
  49. package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
  50. package/dist/Resizable/separatorAttributes.js +35 -0
  51. package/dist/Resizable/useResizable.js +2 -2
  52. package/dist/TimeInput/TimeWheels.d.ts +32 -0
  53. package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
  54. package/dist/TimeInput/TimeWheels.js +144 -0
  55. package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
  56. package/dist/TimeInput/TouchTimeField.js +63 -118
  57. package/dist/TimeInput/timeWheelRules.d.ts +124 -0
  58. package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
  59. package/dist/TimeInput/timeWheelRules.js +277 -0
  60. package/dist/Tokenizer/TokenizerBottomSheet.js +8 -12
  61. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  62. package/dist/Tooltip/useTooltip.js +6 -0
  63. package/dist/astryx.css +3 -1
  64. package/dist/gestures/GestureHost.d.ts.map +1 -1
  65. package/dist/gestures/GestureHost.js +3 -0
  66. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -1
  67. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +5 -2
  68. package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
  69. package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
  70. package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
  71. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
  72. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
  73. package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
  74. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  75. package/dist/i18n/generated-locales/en.generated.js +5 -2
  76. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  77. package/dist/i18n/generated-locales/pseudo.generated.js +5 -2
  78. package/dist/keyboard/index.d.ts +17 -0
  79. package/dist/keyboard/index.d.ts.map +1 -0
  80. package/dist/keyboard/index.js +19 -0
  81. package/dist/keyboard/keyboardHeight.d.ts +149 -0
  82. package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
  83. package/dist/keyboard/keyboardHeight.js +432 -0
  84. package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
  85. package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
  86. package/dist/keyboard/keyboardLayoutGuide.js +207 -0
  87. package/dist/keyboard/keyboardModel.d.ts +93 -0
  88. package/dist/keyboard/keyboardModel.d.ts.map +1 -0
  89. package/dist/keyboard/keyboardModel.js +220 -0
  90. package/dist/keyboard/rideKeyboard.d.ts +42 -0
  91. package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
  92. package/dist/keyboard/rideKeyboard.js +77 -0
  93. package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
  94. package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
  95. package/dist/keyboard/useMobileKeyboard.js +699 -0
  96. package/dist/motion/android/index.d.ts +16 -0
  97. package/dist/motion/android/index.d.ts.map +1 -0
  98. package/dist/motion/android/index.js +18 -0
  99. package/dist/motion/android/keyboard.d.ts +83 -0
  100. package/dist/motion/android/keyboard.d.ts.map +1 -0
  101. package/dist/motion/android/keyboard.js +96 -0
  102. package/dist/motion/uikit/datePicker.d.ts +58 -0
  103. package/dist/motion/uikit/datePicker.d.ts.map +1 -0
  104. package/dist/motion/uikit/datePicker.js +60 -0
  105. package/dist/motion/uikit/index.d.ts +4 -3
  106. package/dist/motion/uikit/index.d.ts.map +1 -1
  107. package/dist/motion/uikit/index.js +4 -3
  108. package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
  109. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  110. package/dist/utils/interactionOverlay.stylex.js +3 -2
  111. package/dist/utils/layoutViewport.d.ts +25 -0
  112. package/dist/utils/layoutViewport.d.ts.map +1 -0
  113. package/dist/utils/layoutViewport.js +102 -0
  114. package/dist/utils/pressFeedback.d.ts.map +1 -1
  115. package/dist/utils/pressFeedback.js +74 -9
  116. package/dist/utils/pressGesture.d.ts +4 -2
  117. package/dist/utils/pressGesture.d.ts.map +1 -1
  118. package/dist/utils/pressGesture.js +3 -1
  119. package/dist/utils/selectionLock.d.ts +10 -1
  120. package/dist/utils/selectionLock.d.ts.map +1 -1
  121. package/dist/utils/selectionLock.js +31 -5
  122. package/dist/utils/sharedMutationObserver.d.ts +2 -1
  123. package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
  124. package/dist/utils/sharedMutationObserver.js +2 -1
  125. package/dist/utils/timeParser.d.ts +2 -1
  126. package/dist/utils/timeParser.d.ts.map +1 -1
  127. package/dist/utils/timeParser.js +29 -3
  128. package/locales/en.json +21 -9
  129. package/locales/pseudo.json +15 -6
  130. package/package.json +5 -5
  131. package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
  132. package/src/BottomSheet/BottomSheetPanel.tsx +41 -13
  133. package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
  134. package/src/BottomSheet/bottomSheetStack.ts +1 -1
  135. package/src/BottomSheet/useSheetGestures.ts +6 -0
  136. package/src/CheckboxList/CheckboxList.doc.mjs +7 -0
  137. package/src/CheckboxList/CheckboxList.tsx +34 -2
  138. package/src/CheckboxList/CheckboxListContext.tsx +9 -1
  139. package/src/CheckboxList/CheckboxListItem.tsx +23 -2
  140. package/src/CheckboxList/requiredGroup.ts +77 -0
  141. package/src/DateInput/PickerWheel.tsx +37 -4
  142. package/src/DateInput/Wheel.tsx +30 -3
  143. package/src/DateInput/datePickerTouch.ts +15 -0
  144. package/src/DateInput/wheelOptions.ts +31 -2
  145. package/src/DateTimeInput/TouchDateTimeField.tsx +94 -178
  146. package/src/HoverCard/useHoverCard.tsx +6 -1
  147. package/src/Overlay/Overlay.tsx +7 -2
  148. package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
  149. package/src/PowerSearch/PowerSearch.tsx +4 -2
  150. package/src/PowerSearch/PowerSearchBottomSheet.tsx +237 -62
  151. package/src/Resizable/ResizeHandle.tsx +18 -26
  152. package/src/Resizable/createResizable.ts +242 -27
  153. package/src/Resizable/separatorAttributes.ts +73 -0
  154. package/src/Resizable/useResizable.ts +2 -2
  155. package/src/TimeInput/TimeWheels.tsx +218 -0
  156. package/src/TimeInput/TouchTimeField.tsx +93 -157
  157. package/src/TimeInput/timeWheelRules.ts +352 -0
  158. package/src/Tokenizer/TokenizerBottomSheet.tsx +8 -12
  159. package/src/Tooltip/useTooltip.tsx +6 -0
  160. package/src/gestures/GestureHost.ts +5 -4
  161. package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +5 -2
  162. package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
  163. package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
  164. package/src/i18n/generated-locales/en.generated.ts +6 -4
  165. package/src/i18n/generated-locales/pseudo.generated.ts +6 -4
  166. package/src/keyboard/README.md +197 -0
  167. package/src/keyboard/index.ts +48 -0
  168. package/src/keyboard/keyboardHeight.ts +543 -0
  169. package/src/keyboard/keyboardLayoutGuide.ts +266 -0
  170. package/src/keyboard/keyboardModel.ts +301 -0
  171. package/src/keyboard/rideKeyboard.ts +100 -0
  172. package/src/keyboard/useMobileKeyboard.ts +866 -0
  173. package/src/motion/MEASUREMENTS.md +10 -0
  174. package/src/motion/README.md +2 -0
  175. package/src/motion/android/index.ts +18 -0
  176. package/src/motion/android/keyboard.ts +96 -0
  177. package/src/motion/uikit/datePicker.ts +60 -0
  178. package/src/motion/uikit/index.ts +4 -3
  179. package/src/utils/interactionOverlay.stylex.ts +3 -2
  180. package/src/utils/layoutViewport.ts +104 -0
  181. package/src/utils/pressFeedback.ts +99 -21
  182. package/src/utils/pressGesture.ts +4 -2
  183. package/src/utils/selectionLock.ts +40 -6
  184. package/src/utils/sharedMutationObserver.ts +2 -1
  185. package/src/utils/timeParser.ts +40 -3
  186. package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
  187. package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
  188. package/dist/BottomSheet/useMobileKeyboard.js +0 -413
  189. package/src/BottomSheet/useMobileKeyboard.ts +0 -542
@@ -1 +1 @@
1
- {"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACd,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,c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ACrB,iDAAiD;IACjD,OAAO,EAAE,SAAS,CAAC;IACnB,wBAAwB;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,qBAAqB;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,IAAI,EACR,EAAE,YAAY,+BA0Dd;yBAzEe,OAAO"}
@@ -66,8 +66,13 @@ export function Overlay({
66
66
  align
67
67
  });
68
68
 
69
- // Border radius: mirror first child's radius onto the wrapper.
70
- // Only the component needs this — hook consumers have their own radius.
69
+ // Copies the first child's radius onto the wrapper, so the scrim clips to
70
+ // the media's rounded corners. This is a layout read of the mounted DOM, and
71
+ // no user interaction causes it. It runs again when a hidden Activity shows
72
+ // the wrapper, because the child can change while it is hidden. A ref
73
+ // callback runs again when a caller's ref changes identity, so it cannot
74
+ // keep this once-per-show timing. A useOverlay consumer sets the radius on
75
+ // its own element.
71
76
  useIsomorphicLayoutEffect(() => {
72
77
  const el = overlay.containerRef.current;
73
78
  if (!el) {
@@ -133,8 +133,10 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
133
133
  * above it with the fields (or the content search with inline
134
134
  * suggestions), and a value step opens above that, stages operator →
135
135
  * value, and confirms from its footer. Dismissing a step reveals the
136
- * one beneath. Suited to compact touch screens, where the editor
137
- * popover competes with the software keyboard.
136
+ * one beneath. The flow edits a draft: `onChange` is called when Done
137
+ * applies it, once per edit in order, and a dismissal with a changed
138
+ * draft asks before discarding it. Suited to compact touch screens,
139
+ * where the editor popover competes with the software keyboard.
138
140
  * - `'adaptive'`: the bottom sheet on compact coarse-pointer screens,
139
141
  * otherwise the popover — the same resolution Selector uses. The server
140
142
  * render and the hydrating render are the popover.
@@ -1 +1 @@
1
- {"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAY1C,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,kCAAkC,CAAC;AA2B1C,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAIjB,qBAAqB,EACrB,iBAAiB,EAGjB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAQjB,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAyMxE,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,yEAAyE;IACzE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gCAAgC;IAChC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1C,kCAAkC;IAClC,QAAQ,EAAE,CACR,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,UAAU,EAAE,qBA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;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED,oFAAoF;AACpF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAoC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,EACR,KAAK,EAAE,cAAc,EACrB,aAAoB,EACpB,WAAW,EAAE,oBAAoB,EACjC,YAAoB,EACpB,QAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAA0B,EAC1B,SAAS,EACT,cAAmB,EACnB,oBAAoB,EACpB,gBAA6C,EAC7C,sBAAsB,EAAE,+BAA+B,EACvD,UAAU,EACV,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,GAAG,EACH,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EAAE,kBAAkB,EAC9B,YAAyB,GAC1B,EAAE,gBAAgB,qBAmiClB;yBAtkCe,WAAW"}
@@ -72,7 +72,14 @@ export interface PowerSearchBottomSheetProps {
72
72
  config: InternalConfig;
73
73
  /** The caller's config, handed to Editor overrides as they expect it. */
74
74
  configProp: PowerSearchConfig;
75
+ /** The committed filters; the draft the sheet edits starts from them. */
75
76
  filters: ReadonlyArray<PowerSearchFilter>;
77
+ /**
78
+ * The field's `onChange`. Done replays the draft's edits through it, in
79
+ * order, onto the field's latest filters, each call carrying that list
80
+ * with the edit applied; nothing is reported before Done, and nothing when
81
+ * the field is read-only or disabled at Done.
82
+ */
76
83
  onChange: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void;
77
84
  /** The field typeahead source; the content search lists its suggestions. */
78
85
  searchSource: SearchSource<PowerSearchItem>;
@@ -90,13 +97,29 @@ export interface PowerSearchBottomSheetProps {
90
97
  components?: PowerSearchComponents;
91
98
  editors: PowerSearchSheetEditors;
92
99
  }
100
+ /** 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. */
101
+ interface DraftEdit {
102
+ before: ReadonlyArray<PowerSearchFilter>;
103
+ after: ReadonlyArray<PowerSearchFilter>;
104
+ changeType: PowerSearchChangeType;
105
+ index: number;
106
+ }
107
+ /**
108
+ * Replays the draft's edits onto `base`, the field's latest filters, and
109
+ * reports each through `report` with the list after it. An add appends; an
110
+ * edit replaces the first filter matching the one it edited; a removal drops
111
+ * the filters it removed, by signature. An edit or removal whose target is
112
+ * not in the base list is skipped: the parent removed it meanwhile.
113
+ */
114
+ export declare function replayDraftEdits(base: ReadonlyArray<PowerSearchFilter>, edits: ReadonlyArray<DraftEdit>, report: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void): ReadonlyArray<PowerSearchFilter>;
93
115
  /**
94
116
  * The sheet flow of PowerSearch's touch presentation: Filters, Add filter,
95
117
  * and the value step, as standalone sheets that stack, each open beneath the
96
118
  * step it led to.
97
119
  */
98
- export declare function PowerSearchBottomSheet({ isOpen, onOpenChange, finalFocusRef, resultCountText, config, configProp, filters, onChange, searchSource, placeholder, isReadOnly, isDisabled, hasClear, maxOperatorMenuItems, timezoneID, maxSearchResults, saveButtonLabel: saveButtonLabelFromProps, components: componentOverrides, editors, }: PowerSearchBottomSheetProps): React.JSX.Element;
120
+ export declare function PowerSearchBottomSheet({ isOpen, onOpenChange, finalFocusRef, resultCountText, config, configProp, filters: committedFilters, onChange: onCommit, searchSource, placeholder, isReadOnly, isDisabled, hasClear, maxOperatorMenuItems, timezoneID, maxSearchResults, saveButtonLabel: saveButtonLabelFromProps, components: componentOverrides, editors, }: PowerSearchBottomSheetProps): React.JSX.Element;
99
121
  export declare namespace PowerSearchBottomSheet {
100
122
  var displayName: string;
101
123
  }
124
+ export {};
102
125
  //# sourceMappingURL=PowerSearchBottomSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PowerSearchBottomSheet.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAkCrD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAe3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAIV,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAEjB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAajB;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;IACtD,wBAAwB,EAAE,OAAO,wBAAwB,CAAC;CAC3D;AAED,MAAM,WAAW,2BAA2B;IAC1C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,aAAa,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,yEAAyE;IACzE,UAAU,EAAE,iBA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AO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAMD,kJAAkJ;AAClJ,UAAU,SAAS;IACjB,MAAM,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACzC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxC,UAAU,EAAE,qBAAqB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAwCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACtC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAC/B,MAAM,EAAE,CACN,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,MAAM,KACV,IAAI,GACR,aAAa,CAAC,iBAAiB,CAAC,CA+ClC;AAwmBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,MAAM,EACN,UAAU,EACV,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,eAAe,EAAE,wBAAwB,EACzC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GACR,EAAE,2BAA2B,qBAmsD7B;yBAvtDe,sBAAsB"}
@@ -104,6 +104,82 @@ registerEnglishFallback(english);
104
104
  // Styles
105
105
  // =============================================================================
106
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
+
107
183
  // The trailing plus a field row shows when choosing it adds the filter at
108
184
  // once, and the Add filter actions' glyph. Core's default icon set has no plus.
109
185
  function PlusIcon(props) {
@@ -514,8 +590,8 @@ export function PowerSearchBottomSheet({
514
590
  resultCountText,
515
591
  config,
516
592
  configProp,
517
- filters,
518
- onChange,
593
+ filters: committedFilters,
594
+ onChange: onCommit,
519
595
  searchSource,
520
596
  placeholder,
521
597
  isReadOnly,
@@ -535,6 +611,27 @@ export function PowerSearchBottomSheet({
535
611
  const locale = useLocale();
536
612
  const formatList = useListFormatter();
537
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);
538
635
  const contentSearchFieldKey = config.config.contentSearchFieldKey;
539
636
  const contentSearchOperator = contentSearchFieldKey == null ? undefined : config.getDefaultOperator(contentSearchFieldKey);
540
637
  const hasContentSearch = contentSearchOperator?.value.type === 'string';
@@ -616,9 +713,6 @@ export function PowerSearchBottomSheet({
616
713
  const [contentQuery, setContentQuery] = useState('');
617
714
  const [isClearConfirmationOpen, setIsClearConfirmationOpen] = useState(false);
618
715
  const clearAllButtonRef = useRef(null);
619
- // Set while Clear all commits, so the result count that changes in that
620
- // commit is spoken with Clear all's outcome, as one message.
621
- const isClearingRef = useRef(false);
622
716
 
623
717
  // `useAnnounce` delivers inside the open Astryx modal that encloses its
624
718
  // caller, and this component renders above the
@@ -645,13 +739,21 @@ export function PowerSearchBottomSheet({
645
739
  if (isOpen !== wasOpen) {
646
740
  setWasOpen(isOpen);
647
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;
648
749
  setFieldQuery('');
649
750
  setContentQuery('');
650
- setStep(isEntryAddFilter ? 'fields' : 'manage');
651
- setFieldPickerOrigin(isEntryAddFilter ? 'trigger' : 'manage');
751
+ setStep(startsOnAddFilter ? 'fields' : 'manage');
752
+ setFieldPickerOrigin(startsOnAddFilter ? 'trigger' : 'manage');
652
753
  } else {
653
754
  setStep(null);
654
755
  setIsClearConfirmationOpen(false);
756
+ setIsDiscardConfirmationOpen(false);
655
757
  }
656
758
  }
657
759
  const closeFlow = useCallback(() => {
@@ -659,6 +761,32 @@ export function PowerSearchBottomSheet({
659
761
  setStep(null);
660
762
  onOpenChange(false);
661
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
+ };
662
790
 
663
791
  // Whether a Filters row is a button: the field interactive and the
664
792
  // filter not read-only. The row opens the value step — the editor for its
@@ -864,14 +992,8 @@ export function PowerSearchBottomSheet({
864
992
  // is quiet then, so the change is spoken here, inside the dialog. Only a
865
993
  // change after the flow opened is spoken.
866
994
  const announcedResultCountRef = useRef(resultCountText);
867
- // The latest result count, for Clear all's handler to read after its
868
- // commit has flushed.
869
- const latestResultCountRef = useRef(resultCountText);
870
- useLayoutEffect(() => {
871
- latestResultCountRef.current = resultCountText;
872
- }, [resultCountText]);
873
995
  useEffect(() => {
874
- if (isClearingRef.current || resultCountText === announcedResultCountRef.current) {
996
+ if (resultCountText === announcedResultCountRef.current) {
875
997
  return;
876
998
  }
877
999
  announcedResultCountRef.current = resultCountText;
@@ -1138,26 +1260,21 @@ export function PowerSearchBottomSheet({
1138
1260
  // confirmation must be gone before focus moves into the sheet and the
1139
1261
  // outcome is routed into the sheet's region, so its close is flushed
1140
1262
  // first. The outcome is "Editable filters removed" while a read-only filter
1141
- // remains, otherwise "All filters removed", joined with a result count that
1142
- // changed in the same commit as one catalog message; focus moves to the
1143
- // sheet's first remaining control: a kept read-only row has none, so Add
1144
- // 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.
1145
1267
  const closeClearConfirmation = confirmed => {
1146
1268
  const kept = filters.filter(filter => filter.isReadOnly);
1147
1269
  const firstRemovedIndex = filters.findIndex(filter => !filter.isReadOnly);
1148
1270
  const isClearing = confirmed && isInteractive && firstRemovedIndex >= 0;
1149
- isClearingRef.current = isClearing;
1150
- try {
1151
- // 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
1152
- flushSync(() => {
1153
- setIsClearConfirmationOpen(false);
1154
- if (isClearing) {
1155
- onChange(kept, 'remove', firstRemovedIndex);
1156
- }
1157
- });
1158
- } finally {
1159
- isClearingRef.current = false;
1160
- }
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
+ });
1161
1278
  if (!isClearing) {
1162
1279
  clearAllButtonRef.current?.focus();
1163
1280
  return;
@@ -1165,18 +1282,7 @@ export function PowerSearchBottomSheet({
1165
1282
  managerAddButtonRef.current?.focus({
1166
1283
  preventScroll: true
1167
1284
  });
1168
- const resultCount = latestResultCountRef.current;
1169
- const changedCount = resultCount !== announcedResultCountRef.current ? resultCount : null;
1170
- announcedResultCountRef.current = resultCount;
1171
- if (kept.length > 0) {
1172
- announce(changedCount == null ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.sheet.editableFiltersClearedWithCount', {
1173
- resultCount: changedCount
1174
- }));
1175
- } else {
1176
- announce(changedCount == null ? t('@astryx.powersearch.allFiltersRemoved') : t('@astryx.powersearch.sheet.filtersClearedWithCount', {
1177
- resultCount: changedCount
1178
- }));
1179
- }
1285
+ announce(kept.length > 0 ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.allFiltersRemoved'));
1180
1286
  };
1181
1287
  const handleOperatorSelect = useCallback(operator => {
1182
1288
  setDraft(current => {
@@ -1270,20 +1376,20 @@ export function PowerSearchBottomSheet({
1270
1376
  // Every step change goes through the handlers above.
1271
1377
  const handleManageOpenChange = useCallback(isSheetOpen => {
1272
1378
  if (!isSheetOpen && stepRef.current === 'manage') {
1273
- closeFlow();
1379
+ requestDismiss();
1274
1380
  }
1275
- }, [closeFlow]);
1381
+ }, [requestDismiss]);
1276
1382
  const handleFieldsOpenChange = useCallback(isSheetOpen => {
1277
1383
  if (isSheetOpen || stepRef.current !== 'fields') {
1278
1384
  return;
1279
1385
  }
1280
1386
  if (fieldPickerOrigin === 'trigger') {
1281
- closeFlow();
1387
+ requestDismiss();
1282
1388
  return;
1283
1389
  }
1284
1390
  queueManagerAddFocus();
1285
1391
  setStep('manage');
1286
- }, [closeFlow, fieldPickerOrigin, queueManagerAddFocus]);
1392
+ }, [fieldPickerOrigin, queueManagerAddFocus, requestDismiss]);
1287
1393
  const handleValueOpenChange = useCallback(isSheetOpen => {
1288
1394
  if (!isSheetOpen && stepRef.current === 'value') {
1289
1395
  returnFromValue();
@@ -1510,7 +1616,7 @@ export function PowerSearchBottomSheet({
1510
1616
  // action. Mounted only while the sheet is open, so its text
1511
1617
  // is spoken in this sheet when it appears.
1512
1618
  isManageSheetOpen && /*#__PURE__*/_jsx(EmptyState, {
1513
- title: t('@astryx.powersearch.sheet.noFilters'),
1619
+ title: t(isDraftDirty ? '@astryx.powersearch.sheet.noFiltersInDraft' : '@astryx.powersearch.sheet.noFilters'),
1514
1620
  description: t('@astryx.powersearch.sheet.noFiltersDescription'),
1515
1621
  headingLevel: 4,
1516
1622
  icon: /*#__PURE__*/_jsx(Icon, {
@@ -1574,7 +1680,7 @@ export function PowerSearchBottomSheet({
1574
1680
  })
1575
1681
  })
1576
1682
  })
1577
- }), filterRows.length > 0 && /*#__PURE__*/_jsxs("div", {
1683
+ }), (filterRows.length > 0 || isDraftDirty) && /*#__PURE__*/_jsxs("div", {
1578
1684
  ...{
1579
1685
  className: "x1vjfegm x78zum5 x6s0dn4 x1qughib x1txdalj x8o8v82 x1pzlopt x10xzikg x1n2onr6 xdd4er5 x2lah0s"
1580
1686
  },
@@ -1590,7 +1696,7 @@ export function PowerSearchBottomSheet({
1590
1696
  variant: "primary",
1591
1697
  size: "lg",
1592
1698
  xstyle: isClearAllShown ? styles.footerEqualAction : [styles.footerSoleAction, styles.touchHitArea],
1593
- onClick: closeFlow,
1699
+ onClick: commitAndClose,
1594
1700
  width: isClearAllShown ? undefined : '100%'
1595
1701
  })]
1596
1702
  })]
@@ -1776,7 +1882,7 @@ export function PowerSearchBottomSheet({
1776
1882
  variant: "primary",
1777
1883
  width: "100%",
1778
1884
  xstyle: styles.touchAction,
1779
- onClick: closeFlow
1885
+ onClick: commitAndClose
1780
1886
  })
1781
1887
  })]
1782
1888
  })
@@ -1913,6 +2019,22 @@ export function PowerSearchBottomSheet({
1913
2019
  actionLabel: t('@astryx.powersearch.sheet.clearAllConfirm'),
1914
2020
  cancelLabel: t('@astryx.powersearch.sheet.clearAllCancel'),
1915
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
+ }
1916
2038
  })]
1917
2039
  });
1918
2040
  }
@@ -1 +1 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,EAAE,YAAuB,EACjC,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAsB,EACtB,aAAsB,EACtB,KAAK,EAAE,cAAc,EACrB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAsSnB;yBArTe,YAAY"}
@@ -19,6 +19,7 @@ import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
19
19
  import { mergeProps, rtlStyles } from "../utils/index.js";
20
20
  import { getCollapseControls, getEffectiveMaxPx } from "./useResizable.js";
21
21
  import { createResizeGesture } from "./resizeGesture.js";
22
+ import { separatorAttributes } from "./separatorAttributes.js";
22
23
  import { themeProps } from "../utils/themeProps.js";
23
24
  import { useDevWarning } from "../hooks/useDevWarning.js";
24
25
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
@@ -410,20 +411,25 @@ export function ResizeHandle({
410
411
  }, [hasRegion, regionGesture]);
411
412
 
412
413
  // --- ARIA ---
413
- // When collapsed the panel's real size (0) sits below aria-valuemin, which
414
- // is invalid per WCAG 4.1.2. Clamp aria-valuenow to the minimum and announce
415
- // the true state via aria-valuetext instead; the valuetext is removed as
416
- // soon as the panel expands so the numeric value reads again.
417
414
  const sizeNow = resizable?._size;
418
415
  const minNow = resizable?._minSizePx;
419
- const ariaValueNow = sizeNow == null || minNow == null ? undefined : isCollapsed ? Math.max(sizeNow, minNow) : sizeNow;
420
- const ariaValueMin = minNow;
421
416
  // A separator with a value needs a maximum (WAI-ARIA, APG window splitter).
422
417
  // Unbounded regions report the basis they can fill; a hand-built props
423
418
  // object without it reports only a configured maximum.
424
419
  const effectiveMax = resizable ? getEffectiveMaxPx(resizable) ?? (resizable._maxSizePx !== Infinity ? resizable._maxSizePx : undefined) : undefined;
425
- const ariaValueMax = effectiveMax != null && Number.isFinite(effectiveMax) ? effectiveMax : undefined;
426
- const ariaValueText = resizable != null && isCollapsed ? t('@astryx.resizable.collapsed') : undefined;
420
+ // The attributes createResizable writes on a plain element, from the same
421
+ // derivation.
422
+ const aria = separatorAttributes({
423
+ direction,
424
+ isDisabled,
425
+ value: sizeNow == null || minNow == null ? undefined : {
426
+ size: sizeNow,
427
+ minPx: minNow,
428
+ maxPx: effectiveMax,
429
+ isCollapsed,
430
+ collapsedText: t('@astryx.resizable.collapsed')
431
+ }
432
+ });
427
433
 
428
434
  // The Grip pill takes the pointer as the Grab zone does, so a pill drawn
429
435
  // outside the zone still resizes.
@@ -447,14 +453,8 @@ export function ResizeHandle({
447
453
  return /*#__PURE__*/_jsxs("div", {
448
454
  ref: useMergedRefs(ref, handleRef),
449
455
  role: "separator",
450
- "aria-orientation": isHorizontal ? 'vertical' : 'horizontal',
451
- "aria-valuenow": ariaValueNow,
452
- "aria-valuemin": ariaValueMin,
453
- "aria-valuemax": ariaValueMax,
454
- "aria-valuetext": ariaValueText,
456
+ ...aria,
455
457
  "aria-label": label,
456
- "aria-disabled": isDisabled || undefined,
457
- tabIndex: isDisabled ? -1 : 0,
458
458
  onDoubleClick: () => {
459
459
  if (!isDisabled) {
460
460
  gesture?.doubleClick();