@astryxdesign/core 0.7.7-canary.fc68123 → 0.7.7

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 (240) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/AlertDialog/AlertDialog.d.ts +1 -4
  3. package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
  4. package/dist/AlertDialog/AlertDialog.js +6 -36
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +4 -23
  7. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  8. package/dist/BottomSheet/useSheetGestures.js +1 -3
  9. package/dist/Button/Button.d.ts.map +1 -1
  10. package/dist/Button/Button.js +1 -17
  11. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  12. package/dist/CheckboxInput/CheckboxInput.js +2 -13
  13. package/dist/ComplexSelector/ComplexSelector.d.ts +1 -4
  14. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  15. package/dist/ComplexSelector/ComplexSelector.js +4 -14
  16. package/dist/ContextMenu/ContextMenu.js +2 -2
  17. package/dist/Dialog/Dialog.d.ts.map +1 -1
  18. package/dist/Dialog/Dialog.js +31 -7
  19. package/dist/Field/Field.js +2 -2
  20. package/dist/HoverCard/HoverCard.d.ts +3 -4
  21. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  22. package/dist/HoverCard/HoverCard.js +2 -27
  23. package/dist/HoverCard/useHoverCard.d.ts +4 -5
  24. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  25. package/dist/HoverCard/useHoverCard.js +31 -17
  26. package/dist/Icon/Icon.d.ts +1 -5
  27. package/dist/Icon/Icon.d.ts.map +1 -1
  28. package/dist/Icon/Icon.js +2 -5
  29. package/dist/Layer/usePressPin.d.ts +5 -17
  30. package/dist/Layer/usePressPin.d.ts.map +1 -1
  31. package/dist/Layer/usePressPin.js +12 -62
  32. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  33. package/dist/Lightbox/Lightbox.js +0 -18
  34. package/dist/PowerSearch/PowerSearch.d.ts +3 -36
  35. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  36. package/dist/PowerSearch/PowerSearch.js +127 -433
  37. package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -32
  38. package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
  39. package/dist/PowerSearch/PowerSearchEditPopover.js +6 -17
  40. package/dist/PowerSearch/PowerSearchValueEditor.d.ts +3 -38
  41. package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
  42. package/dist/PowerSearch/PowerSearchValueEditor.js +61 -170
  43. package/dist/PowerSearch/formatFilterValue.d.ts +0 -7
  44. package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
  45. package/dist/PowerSearch/formatFilterValue.js +1 -11
  46. package/dist/RadioList/RadioList.d.ts.map +1 -1
  47. package/dist/RadioList/RadioList.js +2 -3
  48. package/dist/RadioList/RadioListItem.d.ts +1 -1
  49. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  50. package/dist/RadioList/RadioListItem.js +3 -5
  51. package/dist/Resizable/ResizeHandle.d.ts +1 -2
  52. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  53. package/dist/Resizable/ResizeHandle.js +77 -99
  54. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
  55. package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
  56. package/dist/Slider/sliderTouchController.js +2 -2
  57. package/dist/Spinner/Spinner.d.ts +1 -1
  58. package/dist/Spinner/Spinner.d.ts.map +1 -1
  59. package/dist/Spinner/Spinner.js +58 -60
  60. package/dist/Switch/useSwitchTouch.js +4 -4
  61. package/dist/Table/BaseTable.d.ts.map +1 -1
  62. package/dist/Table/BaseTable.js +8 -29
  63. package/dist/TextInput/TextInput.d.ts +2 -2
  64. package/dist/TextInput/TextInput.d.ts.map +1 -1
  65. package/dist/TextInput/TextInput.js +7 -10
  66. package/dist/Toast/Toast.d.ts +1 -11
  67. package/dist/Toast/Toast.d.ts.map +1 -1
  68. package/dist/Toast/Toast.js +15 -25
  69. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  70. package/dist/Toast/ToastViewport.js +34 -94
  71. package/dist/Toast/types.d.ts +3 -9
  72. package/dist/Toast/types.d.ts.map +1 -1
  73. package/dist/Tooltip/useTooltip.d.ts +1 -19
  74. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  75. package/dist/Tooltip/useTooltip.js +53 -34
  76. package/dist/Typeahead/TypeaheadItem.d.ts +1 -2
  77. package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
  78. package/dist/astryx.css +6 -35
  79. package/dist/gestures/PressTracker.d.ts.map +1 -1
  80. package/dist/gestures/PressTracker.js +3 -4
  81. package/dist/hooks/actionGroupTracker.d.ts +1 -4
  82. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  83. package/dist/hooks/actionGroupTracker.js +3 -13
  84. package/dist/hooks/index.d.ts +0 -1
  85. package/dist/hooks/index.d.ts.map +1 -1
  86. package/dist/hooks/index.js +0 -1
  87. package/dist/hooks/useAttachment.d.ts +1 -1
  88. package/dist/hooks/useAttachment.js +1 -1
  89. package/dist/hooks/useInputStatusIcon.d.ts +1 -1
  90. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  91. package/dist/hooks/useInputStatusIcon.js +2 -2
  92. package/dist/hooks/useLongPress.d.ts +2 -6
  93. package/dist/hooks/useLongPress.d.ts.map +1 -1
  94. package/dist/hooks/useLongPress.js +15 -95
  95. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
  96. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
  97. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  98. package/dist/i18n/generated-locales/en.generated.js +0 -30
  99. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  100. package/dist/i18n/generated-locales/pseudo.generated.js +0 -30
  101. package/dist/index.d.ts +0 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +0 -4
  104. package/dist/motion/animatedLayout.d.ts.map +1 -1
  105. package/dist/motion/animatedLayout.js +6 -5
  106. package/dist/motion/animator.d.ts +14 -14
  107. package/dist/motion/animator.d.ts.map +1 -1
  108. package/dist/motion/animator.js +18 -41
  109. package/dist/utils/dateParser.d.ts.map +1 -1
  110. package/dist/utils/dateParser.js +0 -12
  111. package/dist/utils/focusReturn.d.ts +0 -15
  112. package/dist/utils/focusReturn.d.ts.map +1 -1
  113. package/dist/utils/focusReturn.js +0 -28
  114. package/dist/utils/interactionOverlay.stylex.d.ts +2 -3
  115. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  116. package/dist/utils/interactionOverlay.stylex.js +2 -3
  117. package/dist/utils/pressFeedback.d.ts.map +1 -1
  118. package/dist/utils/pressFeedback.js +6 -19
  119. package/locales/en.json +0 -120
  120. package/locales/pseudo.json +0 -90
  121. package/package.json +5 -10
  122. package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
  123. package/src/AlertDialog/AlertDialog.tsx +5 -37
  124. package/src/BottomSheet/BottomSheetPanel.tsx +3 -37
  125. package/src/BottomSheet/useSheetGestures.ts +1 -3
  126. package/src/Button/Button.tsx +4 -26
  127. package/src/CheckboxInput/CheckboxInput.doc.mjs +0 -18
  128. package/src/CheckboxInput/CheckboxInput.tsx +9 -36
  129. package/src/ComplexSelector/ComplexSelector.tsx +5 -20
  130. package/src/ContextMenu/ContextMenu.tsx +2 -2
  131. package/src/Dialog/Dialog.tsx +31 -10
  132. package/src/Field/Field.tsx +2 -2
  133. package/src/HoverCard/HoverCard.doc.mjs +2 -4
  134. package/src/HoverCard/HoverCard.tsx +4 -35
  135. package/src/HoverCard/useHoverCard.doc.mjs +36 -178
  136. package/src/HoverCard/useHoverCard.tsx +52 -46
  137. package/src/Icon/Icon.doc.mjs +8 -49
  138. package/src/Icon/Icon.tsx +7 -15
  139. package/src/Layer/usePressPin.ts +15 -81
  140. package/src/Lightbox/Lightbox.tsx +0 -18
  141. package/src/PowerSearch/PowerSearch.doc.mjs +5 -54
  142. package/src/PowerSearch/PowerSearch.tsx +155 -609
  143. package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -28
  144. package/src/PowerSearch/PowerSearchValueEditor.tsx +38 -203
  145. package/src/PowerSearch/formatFilterValue.ts +1 -18
  146. package/src/RadioList/RadioList.tsx +2 -3
  147. package/src/RadioList/RadioListItem.tsx +3 -5
  148. package/src/Resizable/Resizable.doc.mjs +4 -5
  149. package/src/Resizable/ResizeHandle.tsx +109 -167
  150. package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -6
  151. package/src/Slider/sliderTouchController.ts +2 -2
  152. package/src/Spinner/Spinner.tsx +63 -77
  153. package/src/Switch/useSwitchTouch.ts +4 -4
  154. package/src/Table/BaseTable.tsx +12 -46
  155. package/src/TextInput/TextInput.tsx +10 -11
  156. package/src/Toast/Toast.doc.mjs +3 -4
  157. package/src/Toast/Toast.tsx +32 -52
  158. package/src/Toast/ToastViewport.tsx +35 -121
  159. package/src/Toast/types.ts +3 -9
  160. package/src/Tooltip/useTooltip.doc.mjs +0 -24
  161. package/src/Tooltip/useTooltip.tsx +56 -61
  162. package/src/Typeahead/TypeaheadItem.doc.mjs +3 -6
  163. package/src/Typeahead/TypeaheadItem.tsx +1 -2
  164. package/src/gestures/PressTracker.ts +3 -4
  165. package/src/gestures/README.md +1 -7
  166. package/src/hooks/actionGroupTracker.ts +5 -20
  167. package/src/hooks/index.ts +0 -2
  168. package/src/hooks/useAttachment.ts +1 -1
  169. package/src/hooks/useInputStatusIcon.tsx +2 -3
  170. package/src/hooks/useLongPress.doc.mjs +2 -2
  171. package/src/hooks/useLongPress.ts +15 -136
  172. package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
  173. package/src/i18n/generated-locales/en.generated.ts +0 -41
  174. package/src/i18n/generated-locales/pseudo.generated.ts +0 -42
  175. package/src/index.ts +0 -13
  176. package/src/motion/README.md +5 -9
  177. package/src/motion/animatedLayout.ts +4 -5
  178. package/src/motion/animator.ts +29 -61
  179. package/src/utils/dateParser.ts +0 -16
  180. package/src/utils/focusReturn.ts +0 -30
  181. package/src/utils/interactionOverlay.stylex.ts +2 -3
  182. package/src/utils/pressFeedback.ts +6 -19
  183. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +0 -100
  184. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +0 -1
  185. package/dist/PowerSearch/PowerSearchBottomSheet.js +0 -1913
  186. package/dist/PowerSearch/formatTokenValue.d.ts +0 -28
  187. package/dist/PowerSearch/formatTokenValue.d.ts.map +0 -1
  188. package/dist/PowerSearch/formatTokenValue.js +0 -160
  189. package/dist/PowerSearch/powerSearchSheetUtils.d.ts +0 -65
  190. package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +0 -1
  191. package/dist/PowerSearch/powerSearchSheetUtils.js +0 -168
  192. package/dist/animator/createAnimator.d.ts +0 -98
  193. package/dist/animator/createAnimator.d.ts.map +0 -1
  194. package/dist/animator/createAnimator.js +0 -259
  195. package/dist/hooks/pressGroupContext.d.ts +0 -6
  196. package/dist/hooks/pressGroupContext.d.ts.map +0 -1
  197. package/dist/hooks/pressGroupContext.js +0 -20
  198. package/dist/hooks/useActionGroupTracking.d.ts +0 -53
  199. package/dist/hooks/useActionGroupTracking.d.ts.map +0 -1
  200. package/dist/hooks/useActionGroupTracking.js +0 -174
  201. package/dist/hooks/useAnimator.d.ts +0 -41
  202. package/dist/hooks/useAnimator.d.ts.map +0 -1
  203. package/dist/hooks/useAnimator.js +0 -70
  204. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +0 -8
  205. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +0 -1
  206. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +0 -42
  207. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +0 -8
  208. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +0 -1
  209. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +0 -14
  210. package/dist/internal/indicatorPress.stylex.d.ts +0 -20
  211. package/dist/internal/indicatorPress.stylex.d.ts.map +0 -1
  212. package/dist/internal/indicatorPress.stylex.js +0 -26
  213. package/dist/motion/progress.d.ts +0 -88
  214. package/dist/motion/progress.d.ts.map +0 -1
  215. package/dist/motion/progress.js +0 -128
  216. package/dist/motion/uikit/alert.d.ts +0 -41
  217. package/dist/motion/uikit/alert.d.ts.map +0 -1
  218. package/dist/motion/uikit/alert.js +0 -43
  219. package/dist/privateAttributes/pressGroupItem.stylex.d.ts +0 -15
  220. package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +0 -1
  221. package/dist/privateAttributes/pressGroupItem.stylex.js +0 -23
  222. package/dist/utils/triggerFocus.d.ts +0 -36
  223. package/dist/utils/triggerFocus.d.ts.map +0 -1
  224. package/dist/utils/triggerFocus.js +0 -65
  225. package/src/PowerSearch/PowerSearchBottomSheet.tsx +0 -2515
  226. package/src/PowerSearch/formatTokenValue.ts +0 -215
  227. package/src/PowerSearch/powerSearchSheetUtils.ts +0 -224
  228. package/src/animator/createAnimator.doc.mjs +0 -153
  229. package/src/animator/createAnimator.ts +0 -324
  230. package/src/hooks/pressGroupContext.ts +0 -21
  231. package/src/hooks/useActionGroupTracking.ts +0 -224
  232. package/src/hooks/useAnimator.doc.mjs +0 -109
  233. package/src/hooks/useAnimator.ts +0 -67
  234. package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +0 -43
  235. package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +0 -15
  236. package/src/internal/indicatorPress.stylex.ts +0 -24
  237. package/src/motion/progress.ts +0 -155
  238. package/src/motion/uikit/alert.ts +0 -43
  239. package/src/privateAttributes/pressGroupItem.stylex.ts +0 -23
  240. package/src/utils/triggerFocus.ts +0 -80
@@ -5,8 +5,7 @@
5
5
  /**
6
6
  * @file PowerSearchEditPopover.tsx
7
7
  * @input InternalConfig, PartialFilter
8
- * @output Edit popover content with field/operator selectors and value editor;
9
- * the built-in NestedEditor the sheet presentation's value step shares
8
+ * @output Edit popover content with field/operator selectors and value editor
10
9
  * @position Sub-component; consumed by PowerSearch
11
10
  *
12
11
  * SYNC: When modified, update:
@@ -385,7 +384,7 @@ function NestedSubFilterRow({
385
384
  // Nested editor
386
385
  // =============================================================================
387
386
 
388
- export interface NestedEditorProps {
387
+ interface NestedEditorProps {
389
388
  config: InternalConfig;
390
389
  partialFilter: PartialFilter;
391
390
  operatorOptions: {value: string; label: string}[];
@@ -393,25 +392,9 @@ export interface NestedEditorProps {
393
392
  onPartialFilterChange: (filter: PartialFilter) => void;
394
393
  maxMenuItems?: number;
395
394
  isReadOnly: boolean;
396
- /** Styles for the editor's tree root (the sheet makes it a query container). */
397
- xstyle?: stylex.StyleXStyles;
398
- /**
399
- * Whether the tree root offers the group-operator picker when the field has
400
- * several operators. The popover shows it; the sheet presentation's value
401
- * step owns the operator choice in its own Operator group and hides it.
402
- * @default true
403
- */
404
- hasRootOperatorPicker?: boolean;
405
395
  }
406
396
 
407
- /**
408
- * The built-in editor for a `nested` value: a tree of sub-filters with Add,
409
- * field/operator/value rows and removal. The popover renders it below its
410
- * field selector; the sheet presentation's value step renders the same editor
411
- * in its body, so a `nested` filter is created
412
- * and edited the same way in both presentations.
413
- */
414
- export function NestedEditor({
397
+ function NestedEditor({
415
398
  config,
416
399
  partialFilter,
417
400
  operatorOptions,
@@ -419,8 +402,6 @@ export function NestedEditor({
419
402
  onPartialFilterChange,
420
403
  maxMenuItems,
421
404
  isReadOnly,
422
- xstyle,
423
- hasRootOperatorPicker = true,
424
405
  }: NestedEditorProps) {
425
406
  const t = useComponentTranslator();
426
407
  const [subFilters, setSubFilters] = useState<EditablePartialFilter[]>(() => {
@@ -606,7 +587,7 @@ export function NestedEditor({
606
587
 
607
588
  const rootLabel = (
608
589
  <div {...stylex.props(styles.nestedRootLabel)}>
609
- {hasRootOperatorPicker && operatorOptions.length > 1 ? (
590
+ {operatorOptions.length > 1 ? (
610
591
  <div {...stylex.props(styles.operatorSelector)}>
611
592
  <Selector
612
593
  label={t('@astryx.powersearch.editor.groupOperator')}
@@ -619,10 +600,7 @@ export function NestedEditor({
619
600
  />
620
601
  </div>
621
602
  ) : (
622
- (operatorOptions.find(option => option.value === partialFilter.operator)
623
- ?.label ??
624
- operatorOptions[0]?.label ??
625
- t('@astryx.powersearch.editor.group'))
603
+ (operatorOptions[0]?.label ?? t('@astryx.powersearch.editor.group'))
626
604
  )}
627
605
  </div>
628
606
  );
@@ -636,7 +614,7 @@ export function NestedEditor({
636
614
  },
637
615
  ];
638
616
 
639
- return <TreeList items={items} density="balanced" xstyle={xstyle} />;
617
+ return <TreeList items={items} density="balanced" />;
640
618
  }
641
619
 
642
620
  // =============================================================================
@@ -4,12 +4,9 @@
4
4
 
5
5
  /**
6
6
  * @file PowerSearchValueEditor.tsx
7
- * @input OperatorValue, FilterValue, onChange callback, and the presentation
8
- * the editor renders in
7
+ * @input OperatorValue, FilterValue, onChange callback
9
8
  * @output Renders the appropriate editor for a filter value type
10
- * @position Sub-component; consumed by PowerSearchEditPopover (popover
11
- * presentation) and PowerSearchBottomSheet (sheet presentation, which
12
- * renders the closed vocabularies as rows itself)
9
+ * @position Sub-component; consumed by PowerSearchEditPopover
13
10
  *
14
11
  * SYNC: When modified, update:
15
12
  * - /packages/core/src/PowerSearch/index.ts
@@ -46,10 +43,9 @@ import {DateRangeInput, type DateRange} from '../DateRangeInput';
46
43
  import {resolveDateTimeRangePart} from './resolveDateTimeRangePart';
47
44
  import {TimeInput} from '../TimeInput';
48
45
  import {Selector} from '../Selector';
49
- import {Tokenizer} from '../Tokenizer/Tokenizer';
46
+ import {Tokenizer} from '../Tokenizer';
50
47
  import {Typeahead} from '../Typeahead';
51
48
  import {useLocale} from '../i18n';
52
- import type {TranslatorFn} from '../i18n';
53
49
  import {
54
50
  registerEnglishFallback,
55
51
  useComponentTranslator,
@@ -68,30 +64,8 @@ export interface PowerSearchValueEditorProps {
68
64
  maxMenuItems?: number;
69
65
  isDisabled?: boolean;
70
66
  timezoneID?: string;
71
- /**
72
- * Called when a staged value no longer stands — the number input's draft is
73
- * empty or does not parse — so the sheet presentation's confirm action
74
- * disables again. Only the `bottom-sheet` presentation stages as typed; the
75
- * popover commits on blur or Enter and never calls this.
76
- */
77
- onUnstage?: () => void;
78
- /**
79
- * Where the editor renders. In the `bottom-sheet` presentation the inputs
80
- * fill the sheet's width, number inputs stage every parseable keystroke
81
- * (the sheet's footer confirms; there is no Enter-to-save), the date range
82
- * shows one month, and list values open the Tokenizer's own sheet titled
83
- * with `fieldLabel`.
84
- * @default 'popover'
85
- */
86
- presentation?: 'popover' | 'bottom-sheet';
87
- /** The field's label; names the Tokenizer sheet in the sheet presentation. */
88
- fieldLabel?: string;
89
67
  }
90
68
 
91
- type EditorPresentation = NonNullable<
92
- PowerSearchValueEditorProps['presentation']
93
- >;
94
-
95
69
  // =============================================================================
96
70
  // Helpers
97
71
  // =============================================================================
@@ -139,7 +113,6 @@ function StringEditor({
139
113
  onEnter: _onEnter,
140
114
  maxMenuItems,
141
115
  isDisabled,
142
- presentation,
143
116
  }: {
144
117
  operatorValue: OperatorValue & {type: 'string'};
145
118
  filterValue: FilterValue | undefined;
@@ -147,10 +120,8 @@ function StringEditor({
147
120
  onEnter?: () => void;
148
121
  maxMenuItems?: number;
149
122
  isDisabled?: boolean;
150
- presentation: EditorPresentation;
151
123
  }) {
152
124
  const t = useComponentTranslator();
153
- const width = presentation === 'bottom-sheet' ? '100%' : undefined;
154
125
  const currentValue = filterValue?.type === 'string' ? filterValue.value : '';
155
126
 
156
127
  // When a searchSource is provided, render a typeahead instead of a plain
@@ -177,7 +148,6 @@ function StringEditor({
177
148
  placeholder={t('@astryx.powersearch.valueEditor.searchPlaceholder')}
178
149
  debounceMs={150}
179
150
  maxMenuItems={maxMenuItems}
180
- width={width}
181
151
  />
182
152
  );
183
153
  }
@@ -192,7 +162,6 @@ function StringEditor({
192
162
  onChange={(value: string) => {
193
163
  onChange({type: 'string', value});
194
164
  }}
195
- width={width}
196
165
  />
197
166
  );
198
167
  }
@@ -203,19 +172,14 @@ function StringListEditor({
203
172
  onChange,
204
173
  maxMenuItems,
205
174
  isDisabled,
206
- presentation,
207
- fieldLabel,
208
175
  }: {
209
176
  operatorValue: OperatorValue & {type: 'string_list'};
210
177
  filterValue: FilterValue | undefined;
211
178
  onChange: (value: FilterValue) => void;
212
179
  maxMenuItems?: number;
213
180
  isDisabled?: boolean;
214
- presentation: EditorPresentation;
215
- fieldLabel?: string;
216
181
  }) {
217
182
  const t = useComponentTranslator();
218
- const isSheet = presentation === 'bottom-sheet';
219
183
  const currentValue: SearchableItem[] = useMemo(() => {
220
184
  if (filterValue?.type !== 'string_list') {
221
185
  return [];
@@ -239,16 +203,9 @@ function StringListEditor({
239
203
  const hasCreate =
240
204
  operatorValue.isArbitraryStringAllowed || !operatorValue.searchSource;
241
205
 
242
- // In the sheet presentation the list value edits through the Tokenizer's
243
- // own sheet, titled with the field's label; a popover menu inside a sheet
244
- // would stack a second anchored layer on a surface the person is already in.
245
206
  return (
246
207
  <Tokenizer
247
- label={
248
- isSheet && fieldLabel != null
249
- ? fieldLabel
250
- : t('@astryx.powersearch.valueEditor.values')
251
- }
208
+ label={t('@astryx.powersearch.valueEditor.values')}
252
209
  isLabelHidden
253
210
  isDisabled={isDisabled}
254
211
  searchSource={source}
@@ -263,8 +220,6 @@ function StringListEditor({
263
220
  debounceMs={operatorValue.searchSource ? 150 : 0}
264
221
  hasCreate={hasCreate}
265
222
  maxMenuItems={maxMenuItems}
266
- width={isSheet ? '100%' : undefined}
267
- experimental={isSheet ? {presentation: 'bottom-sheet'} : undefined}
268
223
  />
269
224
  );
270
225
  }
@@ -276,8 +231,6 @@ function useNumberEditorHandlers({
276
231
  isIntegerOnly,
277
232
  onChange,
278
233
  onEnter,
279
- onUnstage,
280
- stagesAsTyped,
281
234
  }: {
282
235
  valueType: 'integer' | 'float';
283
236
  min?: number;
@@ -285,14 +238,6 @@ function useNumberEditorHandlers({
285
238
  isIntegerOnly: boolean;
286
239
  onChange: (value: FilterValue, shouldSave?: boolean) => void;
287
240
  onEnter?: () => void;
288
- onUnstage?: () => void;
289
- /**
290
- * Stage every keystroke the input would commit, and unstage when the draft
291
- * stops parsing. The sheet presentation confirms from its footer, so the
292
- * confirm action must enable while the person is still typing and disable
293
- * again over an empty field; the popover commits on blur or Enter.
294
- */
295
- stagesAsTyped: boolean;
296
241
  }) {
297
242
  const locale = useLocale();
298
243
  const pendingDecisionRef = useRef<NumberInputCommitDecision | null>(null);
@@ -314,30 +259,12 @@ function useNumberEditorHandlers({
314
259
  }, []);
315
260
  const handleInput = useCallback(
316
261
  (event: FormEvent<HTMLElement>) => {
317
- const decision = resolveNumberInputCommit(
262
+ pendingDecisionRef.current = resolveNumberInputCommit(
318
263
  (event.currentTarget as HTMLInputElement).value,
319
264
  {min, max, isIntegerOnly, locale, hasClear: false},
320
265
  );
321
- pendingDecisionRef.current = decision;
322
- if (stagesAsTyped) {
323
- if (decision.type === 'commit') {
324
- onChange(toFilterValue(decision.value));
325
- } else {
326
- // Cleared, or not a number: nothing stands to confirm.
327
- onUnstage?.();
328
- }
329
- }
330
266
  },
331
- [
332
- isIntegerOnly,
333
- locale,
334
- max,
335
- min,
336
- onChange,
337
- onUnstage,
338
- stagesAsTyped,
339
- toFilterValue,
340
- ],
267
+ [isIntegerOnly, locale, max, min],
341
268
  );
342
269
  const handleEnter = useCallback(() => {
343
270
  const decision = pendingDecisionRef.current;
@@ -365,17 +292,13 @@ function IntegerEditor({
365
292
  filterValue,
366
293
  onChange,
367
294
  onEnter,
368
- onUnstage,
369
295
  isDisabled,
370
- presentation,
371
296
  }: {
372
297
  operatorValue: OperatorValue & {type: 'integer'};
373
298
  filterValue: FilterValue | undefined;
374
299
  onChange: (value: FilterValue, shouldSave?: boolean) => void;
375
300
  onEnter?: () => void;
376
- onUnstage?: () => void;
377
301
  isDisabled?: boolean;
378
- presentation: EditorPresentation;
379
302
  }) {
380
303
  const t = useComponentTranslator();
381
304
  const currentValue =
@@ -387,8 +310,6 @@ function IntegerEditor({
387
310
  isIntegerOnly: true,
388
311
  onChange,
389
312
  onEnter,
390
- onUnstage,
391
- stagesAsTyped: presentation === 'bottom-sheet',
392
313
  });
393
314
 
394
315
  return (
@@ -407,7 +328,6 @@ function IntegerEditor({
407
328
  units={operatorValue.units}
408
329
  isIntegerOnly
409
330
  placeholder={t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')}
410
- width={presentation === 'bottom-sheet' ? '100%' : undefined}
411
331
  />
412
332
  );
413
333
  }
@@ -417,17 +337,13 @@ function FloatEditor({
417
337
  filterValue,
418
338
  onChange,
419
339
  onEnter,
420
- onUnstage,
421
340
  isDisabled,
422
- presentation,
423
341
  }: {
424
342
  operatorValue: OperatorValue & {type: 'float'};
425
343
  filterValue: FilterValue | undefined;
426
344
  onChange: (value: FilterValue, shouldSave?: boolean) => void;
427
345
  onEnter?: () => void;
428
- onUnstage?: () => void;
429
346
  isDisabled?: boolean;
430
- presentation: EditorPresentation;
431
347
  }) {
432
348
  const t = useComponentTranslator();
433
349
  const currentValue =
@@ -439,8 +355,6 @@ function FloatEditor({
439
355
  isIntegerOnly: false,
440
356
  onChange,
441
357
  onEnter,
442
- onUnstage,
443
- stagesAsTyped: presentation === 'bottom-sheet',
444
358
  });
445
359
 
446
360
  return (
@@ -458,7 +372,6 @@ function FloatEditor({
458
372
  max={operatorValue.maxValue}
459
373
  units={operatorValue.units}
460
374
  placeholder={t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')}
461
- width={presentation === 'bottom-sheet' ? '100%' : undefined}
462
375
  />
463
376
  );
464
377
  }
@@ -468,13 +381,11 @@ function TimeEditor({
468
381
  filterValue,
469
382
  onChange,
470
383
  isDisabled,
471
- presentation,
472
384
  }: {
473
385
  operatorValue: OperatorValue & {type: 'time'};
474
386
  filterValue: FilterValue | undefined;
475
387
  onChange: (value: FilterValue) => void;
476
388
  isDisabled?: boolean;
477
- presentation: EditorPresentation;
478
389
  }) {
479
390
  const t = useComponentTranslator();
480
391
  const currentValue =
@@ -495,7 +406,6 @@ function TimeEditor({
495
406
  }}
496
407
  min={operatorValue.minValue as ISOTimeString | undefined}
497
408
  max={operatorValue.maxValue as ISOTimeString | undefined}
498
- width={presentation === 'bottom-sheet' ? '100%' : undefined}
499
409
  />
500
410
  );
501
411
  }
@@ -504,13 +414,11 @@ function DateAbsoluteEditor({
504
414
  filterValue,
505
415
  onChange,
506
416
  isDisabled,
507
- presentation,
508
417
  }: {
509
418
  operatorValue: OperatorValue & {type: 'date_absolute'};
510
419
  filterValue: FilterValue | undefined;
511
420
  onChange: (value: FilterValue) => void;
512
421
  isDisabled?: boolean;
513
- presentation: EditorPresentation;
514
422
  }) {
515
423
  const t = useComponentTranslator();
516
424
  // Convert unixSeconds to ISO date string for the date input
@@ -534,69 +442,10 @@ function DateAbsoluteEditor({
534
442
  onChange({type: 'date_absolute', unixSeconds});
535
443
  }
536
444
  }}
537
- width={presentation === 'bottom-sheet' ? '100%' : undefined}
538
445
  />
539
446
  );
540
447
  }
541
448
 
542
- const RELATIVE_DATE_UNITS = [
543
- {
544
- unit: 'day',
545
- plural: 'days',
546
- amounts: [1, 3, 7, 14, 30],
547
- ago: '@astryx.powersearch.sheet.relativeDaysAgo',
548
- fromNow: '@astryx.powersearch.sheet.relativeDaysFromNow',
549
- },
550
- {
551
- unit: 'week',
552
- plural: 'weeks',
553
- amounts: [1, 2, 4],
554
- ago: '@astryx.powersearch.sheet.relativeWeeksAgo',
555
- fromNow: '@astryx.powersearch.sheet.relativeWeeksFromNow',
556
- },
557
- {
558
- unit: 'month',
559
- plural: 'months',
560
- amounts: [1, 3, 6, 12],
561
- ago: '@astryx.powersearch.sheet.relativeMonthsAgo',
562
- fromNow: '@astryx.powersearch.sheet.relativeMonthsFromNow',
563
- },
564
- ] as const;
565
-
566
- /**
567
- * The relative-date choices an operator offers, in display order. Shared by
568
- * the popover's Selector and the sheet presentation's rows so both list the
569
- * same values. With `t` the labels resolve through the catalog's ICU plural
570
- * messages (the sheet presentation's rows); without it they are the popover
571
- * editor's own literals. In English the two read identically.
572
- */
573
- export function buildRelativeDateOptions(
574
- operatorValue: OperatorValue & {type: 'date_relative'},
575
- t?: TranslatorFn,
576
- ): {value: string; label: string}[] {
577
- const result: {value: string; label: string}[] = [];
578
- for (const {unit, plural, amounts, ago, fromNow} of RELATIVE_DATE_UNITS) {
579
- for (const amount of amounts) {
580
- const unitWord = amount === 1 ? unit : plural;
581
- if (operatorValue.isPastAllowed !== false) {
582
- result.push({
583
- value: `${amount}${unit[0]}_ago`,
584
- label: t ? t(ago, {count: amount}) : `${amount} ${unitWord} ago`,
585
- });
586
- }
587
- if (operatorValue.isFutureAllowed !== false) {
588
- result.push({
589
- value: `${amount}${unit[0]}_from_now`,
590
- label: t
591
- ? t(fromNow, {count: amount})
592
- : `${amount} ${unitWord} from now`,
593
- });
594
- }
595
- }
596
- }
597
- return result;
598
- }
599
-
600
449
  function DateRelativeEditor({
601
450
  operatorValue,
602
451
  filterValue,
@@ -612,18 +461,37 @@ function DateRelativeEditor({
612
461
  const currentValue =
613
462
  filterValue?.type === 'date_relative' ? filterValue.value : undefined;
614
463
 
615
- // The choices depend on the two flags only; a config that rebuilds its
616
- // operator objects per render keeps the same memoized list.
617
- const {isPastAllowed, isFutureAllowed} = operatorValue;
618
- const options = useMemo(
619
- () =>
620
- buildRelativeDateOptions({
621
- type: 'date_relative',
622
- isPastAllowed,
623
- isFutureAllowed,
624
- }),
625
- [isPastAllowed, isFutureAllowed],
626
- );
464
+ const options = useMemo(() => {
465
+ const result: {value: string; label: string}[] = [];
466
+ const units = [
467
+ {unit: 'day', plural: 'days'},
468
+ {unit: 'week', plural: 'weeks'},
469
+ {unit: 'month', plural: 'months'},
470
+ ];
471
+ for (const {unit, plural} of units) {
472
+ const amounts =
473
+ unit === 'day'
474
+ ? [1, 3, 7, 14, 30]
475
+ : unit === 'week'
476
+ ? [1, 2, 4]
477
+ : [1, 3, 6, 12];
478
+ for (const amount of amounts) {
479
+ if (operatorValue.isPastAllowed !== false) {
480
+ result.push({
481
+ value: `${amount}${unit[0]}_ago`,
482
+ label: `${amount} ${amount === 1 ? unit : plural} ago`,
483
+ });
484
+ }
485
+ if (operatorValue.isFutureAllowed !== false) {
486
+ result.push({
487
+ value: `${amount}${unit[0]}_from_now`,
488
+ label: `${amount} ${amount === 1 ? unit : plural} from now`,
489
+ });
490
+ }
491
+ }
492
+ }
493
+ return result;
494
+ }, [operatorValue.isPastAllowed, operatorValue.isFutureAllowed]);
627
495
 
628
496
  return (
629
497
  <Selector
@@ -643,13 +511,11 @@ function DateRangeEditor({
643
511
  filterValue,
644
512
  onChange,
645
513
  isDisabled,
646
- presentation,
647
514
  }: {
648
515
  operatorValue: OperatorValue & {type: 'date_range'};
649
516
  filterValue: FilterValue | undefined;
650
517
  onChange: (value: FilterValue) => void;
651
518
  isDisabled?: boolean;
652
- presentation: EditorPresentation;
653
519
  }) {
654
520
  const t = useComponentTranslator();
655
521
  const currentValue = useMemo<DateRange | null>(() => {
@@ -703,9 +569,6 @@ function DateRangeEditor({
703
569
  value={currentValue}
704
570
  onChange={handleChange}
705
571
  hasClear={false}
706
- // A phone-wide sheet fits one month; the popover keeps the default.
707
- numberOfMonths={presentation === 'bottom-sheet' ? 1 : undefined}
708
- width={presentation === 'bottom-sheet' ? '100%' : undefined}
709
572
  />
710
573
  </div>
711
574
  );
@@ -808,19 +671,14 @@ function EntityListEditor({
808
671
  onChange,
809
672
  maxMenuItems,
810
673
  isDisabled,
811
- presentation,
812
- fieldLabel,
813
674
  }: {
814
675
  operatorValue: OperatorValue & {type: 'entity_list'};
815
676
  filterValue: FilterValue | undefined;
816
677
  onChange: (value: FilterValue) => void;
817
678
  maxMenuItems?: number;
818
679
  isDisabled?: boolean;
819
- presentation: EditorPresentation;
820
- fieldLabel?: string;
821
680
  }) {
822
681
  const t = useComponentTranslator();
823
- const isSheet = presentation === 'bottom-sheet';
824
682
  const source = useMemo<SearchSource<SearchableItem>>(() => {
825
683
  if (operatorValue.searchSource) {
826
684
  return operatorValue.searchSource;
@@ -843,15 +701,9 @@ function EntityListEditor({
843
701
  }));
844
702
  }, [filterValue]);
845
703
 
846
- // Sheet presentation: the Tokenizer's own sheet, titled with the field
847
- // label, as for string_list.
848
704
  return (
849
705
  <Tokenizer
850
- label={
851
- isSheet && fieldLabel != null
852
- ? fieldLabel
853
- : t('@astryx.powersearch.valueEditor.entities')
854
- }
706
+ label={t('@astryx.powersearch.valueEditor.entities')}
855
707
  isLabelHidden
856
708
  isDisabled={isDisabled}
857
709
  searchSource={source}
@@ -874,8 +726,6 @@ function EntityListEditor({
874
726
  placeholder={t('@astryx.powersearch.valueEditor.searchPlaceholder')}
875
727
  debounceMs={operatorValue.searchSource ? 150 : 0}
876
728
  maxMenuItems={maxMenuItems}
877
- width={isSheet ? '100%' : undefined}
878
- experimental={isSheet ? {presentation: 'bottom-sheet'} : undefined}
879
729
  />
880
730
  );
881
731
  }
@@ -921,9 +771,6 @@ export function PowerSearchValueEditor({
921
771
  onEnter,
922
772
  maxMenuItems,
923
773
  isDisabled,
924
- onUnstage,
925
- presentation = 'popover',
926
- fieldLabel,
927
774
  }: PowerSearchValueEditorProps) {
928
775
  switch (operatorValue.type) {
929
776
  case 'empty':
@@ -933,7 +780,6 @@ export function PowerSearchValueEditor({
933
780
  return (
934
781
  <StringEditor
935
782
  isDisabled={isDisabled}
936
- presentation={presentation}
937
783
  operatorValue={operatorValue}
938
784
  filterValue={filterValue}
939
785
  onChange={onChange}
@@ -946,8 +792,6 @@ export function PowerSearchValueEditor({
946
792
  return (
947
793
  <StringListEditor
948
794
  isDisabled={isDisabled}
949
- presentation={presentation}
950
- fieldLabel={fieldLabel}
951
795
  operatorValue={operatorValue}
952
796
  filterValue={filterValue}
953
797
  onChange={onChange}
@@ -959,8 +803,6 @@ export function PowerSearchValueEditor({
959
803
  return (
960
804
  <IntegerEditor
961
805
  isDisabled={isDisabled}
962
- presentation={presentation}
963
- onUnstage={onUnstage}
964
806
  operatorValue={operatorValue}
965
807
  filterValue={filterValue}
966
808
  onChange={onChange}
@@ -972,8 +814,6 @@ export function PowerSearchValueEditor({
972
814
  return (
973
815
  <FloatEditor
974
816
  isDisabled={isDisabled}
975
- presentation={presentation}
976
- onUnstage={onUnstage}
977
817
  operatorValue={operatorValue}
978
818
  filterValue={filterValue}
979
819
  onChange={onChange}
@@ -985,7 +825,6 @@ export function PowerSearchValueEditor({
985
825
  return (
986
826
  <TimeEditor
987
827
  isDisabled={isDisabled}
988
- presentation={presentation}
989
828
  operatorValue={operatorValue}
990
829
  filterValue={filterValue}
991
830
  onChange={onChange}
@@ -996,7 +835,6 @@ export function PowerSearchValueEditor({
996
835
  return (
997
836
  <DateAbsoluteEditor
998
837
  isDisabled={isDisabled}
999
- presentation={presentation}
1000
838
  operatorValue={operatorValue}
1001
839
  filterValue={filterValue}
1002
840
  onChange={onChange}
@@ -1017,7 +855,6 @@ export function PowerSearchValueEditor({
1017
855
  return (
1018
856
  <DateRangeEditor
1019
857
  isDisabled={isDisabled}
1020
- presentation={presentation}
1021
858
  operatorValue={operatorValue}
1022
859
  filterValue={filterValue}
1023
860
  onChange={onChange}
@@ -1048,8 +885,6 @@ export function PowerSearchValueEditor({
1048
885
  return (
1049
886
  <EntityListEditor
1050
887
  isDisabled={isDisabled}
1051
- presentation={presentation}
1052
- fieldLabel={fieldLabel}
1053
888
  operatorValue={operatorValue}
1054
889
  filterValue={filterValue}
1055
890
  onChange={onChange}
@@ -32,27 +32,10 @@ function formatEnumLabel(
32
32
  }
33
33
 
34
34
  function formatNumber(value: number, locale: Locale, units?: string): string {
35
- const formatted = formatSharedNumber(value, locale);
35
+ const formatted = new Intl.NumberFormat(locale).format(value);
36
36
  return units ? `${formatted} ${units}` : formatted;
37
37
  }
38
38
 
39
- /**
40
- * A number in the provider locale's digits, decimal mark, and — unless the
41
- * options say otherwise — grouping. The shared number helper for
42
- * PowerSearch's own readings of a value — this module owns the raw `Intl`
43
- * access.
44
- */
45
- export function formatSharedNumber(
46
- value: number,
47
- locale: Locale,
48
- options?: Pick<
49
- Intl.NumberFormatOptions,
50
- 'useGrouping' | 'maximumFractionDigits'
51
- >,
52
- ): string {
53
- return new Intl.NumberFormat(locale, options).format(value);
54
- }
55
-
56
39
  export function formatDateAbsolute(
57
40
  unixSeconds: number,
58
41
  locale: Locale,
@@ -29,10 +29,9 @@ import * as stylex from '@stylexjs/stylex';
29
29
  import {spacingVars} from '../theme/tokens.stylex';
30
30
  import {Field} from '../Field/Field';
31
31
  import type {InputStatus} from '../Field/types';
32
- import {useTooltip} from '../Tooltip/useTooltip';
32
+ import {useTooltip} from '../Tooltip';
33
33
  import {useResolvedRequired} from '../hooks/useResolvedRequired';
34
- import {composeEventHandlers} from '../utils/composeEventHandlers';
35
- import {mergeProps} from '../utils/mergeProps';
34
+ import {composeEventHandlers, mergeProps} from '../utils';
36
35
  import {joinAriaIDs} from '../utils/inputAria';
37
36
  import {
38
37
  type FieldInputBaseProps,