@astryxdesign/core 0.7.7-canary.f9ac85f → 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 (198) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts +13 -0
  3. package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -0
  4. package/dist/AppShell/useCloseMobileDrawerOnActivate.js +45 -0
  5. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheet.js +79 -9
  7. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  8. package/dist/BottomSheet/BottomSheetPanel.js +1 -1
  9. package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
  10. package/dist/BottomSheet/bottomSheetStack.js +5 -4
  11. package/dist/Breadcrumbs/BreadcrumbItem.d.ts +2 -1
  12. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  13. package/dist/Breadcrumbs/BreadcrumbItem.js +7 -3
  14. package/dist/Button/Button.d.ts.map +1 -1
  15. package/dist/Button/Button.js +30 -2
  16. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  17. package/dist/CheckboxList/CheckboxList.js +7 -1
  18. package/dist/CheckboxList/CheckboxListContext.d.ts +6 -0
  19. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  20. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  21. package/dist/CheckboxList/CheckboxListItem.js +10 -2
  22. package/dist/DateInput/DateInput.d.ts.map +1 -1
  23. package/dist/DateInput/DateInput.js +5 -2
  24. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  25. package/dist/DateInput/MonthScroller.js +13 -27
  26. package/dist/DateInput/Wheel.d.ts.map +1 -1
  27. package/dist/DateInput/Wheel.js +22 -41
  28. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  29. package/dist/DateTimeInput/DateTimeInput.js +5 -2
  30. package/dist/Dialog/Dialog.d.ts.map +1 -1
  31. package/dist/Dialog/Dialog.js +4 -3
  32. package/dist/Drawer/Drawer.js +0 -1
  33. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  34. package/dist/Drawer/useDrawerDialogPresence.js +5 -1
  35. package/dist/Field/PanelSearchInput.d.ts +9 -1
  36. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  37. package/dist/Field/PanelSearchInput.js +3 -1
  38. package/dist/InfoTip/InfoTip.d.ts +2 -2
  39. package/dist/InfoTip/InfoTip.js +4 -4
  40. package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
  41. package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
  42. package/dist/Layer/layerAnimations.stylex.js +25 -20
  43. package/dist/Layer/usePressPin.d.ts +3 -5
  44. package/dist/Layer/usePressPin.d.ts.map +1 -1
  45. package/dist/Layer/usePressPin.js +4 -6
  46. package/dist/MobileNav/MobileNav.js +0 -1
  47. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  48. package/dist/MultiSelector/hooks.js +2 -4
  49. package/dist/Outline/Outline.d.ts +2 -4
  50. package/dist/Outline/Outline.d.ts.map +1 -1
  51. package/dist/Outline/Outline.js +4 -52
  52. package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
  53. package/dist/Outline/useOutlineFromMarkdown.js +1 -0
  54. package/dist/Outline/useScrollSpy.js +3 -3
  55. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  56. package/dist/PowerSearch/PowerSearch.js +134 -179
  57. package/dist/RadioList/RadioList.d.ts.map +1 -1
  58. package/dist/RadioList/RadioList.js +5 -0
  59. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  60. package/dist/Resizable/ResizeHandle.js +118 -260
  61. package/dist/Resizable/resizeGesture.d.ts +91 -0
  62. package/dist/Resizable/resizeGesture.d.ts.map +1 -0
  63. package/dist/Resizable/resizeGesture.js +251 -0
  64. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  65. package/dist/SideNav/SideNavItem.js +3 -9
  66. package/dist/Token/Token.d.ts +2 -2
  67. package/dist/Token/Token.d.ts.map +1 -1
  68. package/dist/Token/Token.js +12 -4
  69. package/dist/Token/TokenNamingContext.d.ts +14 -0
  70. package/dist/Token/TokenNamingContext.d.ts.map +1 -0
  71. package/dist/Token/TokenNamingContext.js +23 -0
  72. package/dist/Tokenizer/Tokenizer.d.ts +46 -59
  73. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  74. package/dist/Tokenizer/Tokenizer.js +35 -58
  75. package/dist/Tokenizer/TokenizerBottomSheet.d.ts +25 -28
  76. package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
  77. package/dist/Tokenizer/TokenizerBottomSheet.js +157 -54
  78. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
  79. package/dist/Tokenizer/TokenizerItemRemovableContext.js +5 -3
  80. package/dist/Tooltip/Tooltip.d.ts +25 -30
  81. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  82. package/dist/Tooltip/Tooltip.js +24 -5
  83. package/dist/Tooltip/index.d.ts +1 -1
  84. package/dist/Tooltip/index.d.ts.map +1 -1
  85. package/dist/Tooltip/useTooltip.d.ts +28 -29
  86. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  87. package/dist/Tooltip/useTooltip.js +20 -8
  88. package/dist/TopNav/TopNavItem.d.ts.map +1 -1
  89. package/dist/TopNav/TopNavItem.js +4 -7
  90. package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
  91. package/dist/TopNav/TopNavMegaMenuItem.js +4 -7
  92. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  93. package/dist/TopNav/TopNavMenu.js +4 -7
  94. package/dist/astryx.css +5 -5
  95. package/dist/gestures/GestureHost.d.ts +27 -1
  96. package/dist/gestures/GestureHost.d.ts.map +1 -1
  97. package/dist/gestures/GestureHost.js +90 -8
  98. package/dist/hooks/useHighlightedOptionScroll.d.ts +11 -1
  99. package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
  100. package/dist/hooks/useHighlightedOptionScroll.js +103 -5
  101. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  102. package/dist/hooks/useMenuPress.js +4 -2
  103. package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.d.ts.map +1 -1
  104. package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.js +1 -0
  105. package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.d.ts.map +1 -1
  106. package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.js +7 -1
  107. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  108. package/dist/i18n/generated-locales/en.generated.js +1 -0
  109. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  110. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  111. package/dist/internal/SheetConfirmation.d.ts +11 -0
  112. package/dist/internal/SheetConfirmation.d.ts.map +1 -0
  113. package/dist/internal/SheetConfirmation.js +92 -0
  114. package/dist/internal/sheetDraft.d.ts +35 -0
  115. package/dist/internal/sheetDraft.d.ts.map +1 -0
  116. package/dist/internal/sheetDraft.js +65 -0
  117. package/dist/internal/touch-sheet.d.ts +21 -0
  118. package/dist/internal/touch-sheet.d.ts.map +1 -0
  119. package/dist/internal/touch-sheet.js +19 -0
  120. package/dist/internal/useDismissSearchOnTouchDrag.d.ts +24 -0
  121. package/dist/internal/useDismissSearchOnTouchDrag.d.ts.map +1 -0
  122. package/dist/internal/useDismissSearchOnTouchDrag.js +56 -0
  123. package/dist/motion/reducedMotion.d.ts +24 -0
  124. package/dist/motion/reducedMotion.d.ts.map +1 -1
  125. package/dist/motion/reducedMotion.js +78 -1
  126. package/dist/utils/clickGuard.d.ts +8 -1
  127. package/dist/utils/clickGuard.d.ts.map +1 -1
  128. package/dist/utils/clickGuard.js +24 -1
  129. package/locales/en.json +4 -0
  130. package/locales/pseudo.json +3 -0
  131. package/package.json +9 -9
  132. package/src/AppShell/useCloseMobileDrawerOnActivate.ts +52 -0
  133. package/src/BottomSheet/BottomSheet.tsx +95 -10
  134. package/src/BottomSheet/BottomSheetPanel.tsx +7 -2
  135. package/src/BottomSheet/bottomSheetStack.ts +8 -4
  136. package/src/Breadcrumbs/BreadcrumbItem.tsx +13 -3
  137. package/src/Button/Button.tsx +37 -1
  138. package/src/CheckboxList/CheckboxList.doc.mjs +4 -2
  139. package/src/CheckboxList/CheckboxList.tsx +6 -0
  140. package/src/CheckboxList/CheckboxListContext.tsx +6 -0
  141. package/src/CheckboxList/CheckboxListItem.tsx +11 -2
  142. package/src/DateInput/DateInput.tsx +8 -2
  143. package/src/DateInput/MonthScroller.tsx +18 -22
  144. package/src/DateInput/Wheel.tsx +30 -32
  145. package/src/DateTimeInput/DateTimeInput.tsx +8 -2
  146. package/src/Dialog/Dialog.tsx +19 -4
  147. package/src/Drawer/Drawer.tsx +1 -1
  148. package/src/Drawer/useDrawerDialogPresence.ts +5 -1
  149. package/src/Field/PanelSearchInput.tsx +11 -0
  150. package/src/InfoTip/InfoTip.doc.mjs +3 -3
  151. package/src/InfoTip/InfoTip.tsx +5 -5
  152. package/src/Layer/layerAnimations.stylex.ts +24 -16
  153. package/src/Layer/usePressPin.ts +5 -11
  154. package/src/MobileNav/MobileNav.tsx +1 -1
  155. package/src/MultiSelector/hooks.ts +2 -4
  156. package/src/Outline/Outline.doc.mjs +177 -51
  157. package/src/Outline/Outline.tsx +5 -57
  158. package/src/Outline/useOutlineFromMarkdown.doc.mjs +157 -0
  159. package/src/Outline/useOutlineFromMarkdown.ts +1 -0
  160. package/src/Outline/useScrollSpy.ts +3 -3
  161. package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
  162. package/src/PowerSearch/PowerSearch.tsx +196 -183
  163. package/src/RadioList/RadioList.doc.mjs +4 -2
  164. package/src/RadioList/RadioList.tsx +4 -0
  165. package/src/Resizable/ResizeHandle.tsx +133 -328
  166. package/src/Resizable/resizeGesture.ts +368 -0
  167. package/src/SideNav/SideNavItem.tsx +3 -7
  168. package/src/Token/Token.tsx +13 -4
  169. package/src/Token/TokenNamingContext.ts +28 -0
  170. package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
  171. package/src/Tokenizer/Tokenizer.tsx +81 -86
  172. package/src/Tokenizer/TokenizerBottomSheet.tsx +219 -93
  173. package/src/Tokenizer/TokenizerItemRemovableContext.ts +5 -3
  174. package/src/Tooltip/Tooltip.doc.mjs +123 -54
  175. package/src/Tooltip/Tooltip.tsx +36 -39
  176. package/src/Tooltip/index.ts +0 -1
  177. package/src/Tooltip/useTooltip.doc.mjs +147 -33
  178. package/src/Tooltip/useTooltip.tsx +39 -32
  179. package/src/TopNav/TopNavItem.tsx +6 -5
  180. package/src/TopNav/TopNavMegaMenuItem.tsx +6 -5
  181. package/src/TopNav/TopNavMenu.tsx +6 -5
  182. package/src/gestures/GestureHost.ts +105 -10
  183. package/src/hooks/useHighlightedOptionScroll.ts +113 -9
  184. package/src/hooks/useMenuPress.ts +8 -2
  185. package/src/i18n/generated-english/PowerSearch/PowerSearch.generated.ts +1 -0
  186. package/src/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.ts +7 -1
  187. package/src/i18n/generated-locales/en.generated.ts +1 -0
  188. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  189. package/src/internal/SheetConfirmation.tsx +101 -0
  190. package/src/internal/sheetDraft.ts +80 -0
  191. package/src/internal/touch-sheet.ts +21 -0
  192. package/src/internal/useDismissSearchOnTouchDrag.ts +69 -0
  193. package/src/motion/reducedMotion.ts +79 -1
  194. package/src/utils/clickGuard.ts +37 -1
  195. package/dist/internal/tokenizer-presentation.d.ts +0 -21
  196. package/dist/internal/tokenizer-presentation.d.ts.map +0 -1
  197. package/dist/internal/tokenizer-presentation.js +0 -21
  198. package/src/internal/tokenizer-presentation.ts +0 -25
@@ -20,6 +20,7 @@ import { TokenizerClearAllMessageContext } from "../Tokenizer/TokenizerClearAllM
20
20
  import { TokenizerItemRemovableContext } from "../Tokenizer/TokenizerItemRemovableContext.js";
21
21
  import { TypeaheadItem } from "../Typeahead/TypeaheadItem.js";
22
22
  import { Token } from "../Token/index.js";
23
+ import { TokenNamingContext } from "../Token/TokenNamingContext.js";
23
24
  import { Avatar } from "../Avatar/index.js";
24
25
  import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
25
26
  import { Icon } from "../Icon/index.js";
@@ -41,7 +42,7 @@ import { useLocale } from "../i18n/useLocale.js";
41
42
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
42
43
  import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
43
44
  import english from "../i18n/generated-english/PowerSearch/PowerSearch.generated.js";
44
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
45
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
45
46
  registerEnglishFallback(english);
46
47
  // =============================================================================
47
48
  // Icon mapping for typeahead entries
@@ -90,45 +91,25 @@ function truncateString(value, limit) {
90
91
  function getEnumLabel(values, value) {
91
92
  return values.find(v => v.value === value)?.label ?? value;
92
93
  }
93
- function PowerSearchTokenValue({
94
- operatorValue,
95
- filterValue,
96
- maxLength,
97
- locale
98
- }) {
94
+
95
+ /**
96
+ * The visible text of a filter token's value. The token renders it, and the
97
+ * token's remove button and editor dialog are named by the same text.
98
+ */
99
+ function tokenValueText(operatorValue, filterValue, maxLength, locale) {
99
100
  switch (filterValue.type) {
100
101
  case 'empty':
101
102
  return null;
102
103
  case 'string':
103
- return /*#__PURE__*/_jsx("span", {
104
- ...{
105
- className: "x1lvx875"
106
- },
107
- children: truncateString(filterValue.value, maxLength)
108
- });
104
+ return truncateString(filterValue.value, maxLength);
109
105
  case 'integer':
110
106
  case 'float':
111
- return /*#__PURE__*/_jsx("span", {
112
- ...{
113
- className: "x1lvx875"
114
- },
115
- children: filterValue.value
116
- });
107
+ return String(filterValue.value);
117
108
  case 'enum':
118
109
  if (operatorValue.type === 'enum') {
119
- return /*#__PURE__*/_jsx("span", {
120
- ...{
121
- className: "x1lvx875"
122
- },
123
- children: truncateString(getEnumLabel(operatorValue.values, filterValue.value), maxLength)
124
- });
110
+ return truncateString(getEnumLabel(operatorValue.values, filterValue.value), maxLength);
125
111
  }
126
- return /*#__PURE__*/_jsx("span", {
127
- ...{
128
- className: "x1lvx875"
129
- },
130
- children: truncateString(filterValue.value, maxLength)
131
- });
112
+ return truncateString(filterValue.value, maxLength);
132
113
  case 'string_list':
133
114
  {
134
115
  const items = filterValue.value;
@@ -136,28 +117,13 @@ function PowerSearchTokenValue({
136
117
  return null;
137
118
  }
138
119
  if (items.length === 1) {
139
- return /*#__PURE__*/_jsx("span", {
140
- ...{
141
- className: "x1lvx875"
142
- },
143
- children: truncateString(items[0], maxLength)
144
- });
120
+ return truncateString(items[0], maxLength);
145
121
  }
146
122
  const totalLength = items.reduce((sum, s) => sum + s.length, 0);
147
123
  if (totalLength > maxLength) {
148
- return /*#__PURE__*/_jsxs("span", {
149
- ...{
150
- className: "x1lvx875"
151
- },
152
- children: [items.length, " items"]
153
- });
124
+ return `${items.length} items`;
154
125
  }
155
- return /*#__PURE__*/_jsx("span", {
156
- ...{
157
- className: "x1lvx875"
158
- },
159
- children: items.join(', ')
160
- });
126
+ return items.join(', ');
161
127
  }
162
128
  case 'enum_list':
163
129
  {
@@ -168,43 +134,18 @@ function PowerSearchTokenValue({
168
134
  if (operatorValue.type === 'enum_list') {
169
135
  const labels = items.map(v => getEnumLabel(operatorValue.values, v));
170
136
  if (labels.length === 1) {
171
- return /*#__PURE__*/_jsx("span", {
172
- ...{
173
- className: "x1lvx875"
174
- },
175
- children: truncateString(labels[0], maxLength)
176
- });
137
+ return truncateString(labels[0], maxLength);
177
138
  }
178
139
  const totalLength = labels.reduce((sum, s) => sum + s.length, 0);
179
140
  if (totalLength > maxLength) {
180
- return /*#__PURE__*/_jsxs("span", {
181
- ...{
182
- className: "x1lvx875"
183
- },
184
- children: [labels.length, " items"]
185
- });
141
+ return `${labels.length} items`;
186
142
  }
187
- return /*#__PURE__*/_jsx("span", {
188
- ...{
189
- className: "x1lvx875"
190
- },
191
- children: labels.join(', ')
192
- });
143
+ return labels.join(', ');
193
144
  }
194
145
  if (items.length === 1) {
195
- return /*#__PURE__*/_jsx("span", {
196
- ...{
197
- className: "x1lvx875"
198
- },
199
- children: truncateString(items[0], maxLength)
200
- });
146
+ return truncateString(items[0], maxLength);
201
147
  }
202
- return /*#__PURE__*/_jsxs("span", {
203
- ...{
204
- className: "x1lvx875"
205
- },
206
- children: [items.length, " items"]
207
- });
148
+ return `${items.length} items`;
208
149
  }
209
150
  case 'entity_list':
210
151
  {
@@ -213,89 +154,46 @@ function PowerSearchTokenValue({
213
154
  return null;
214
155
  }
215
156
  if (entities.length === 1) {
216
- return /*#__PURE__*/_jsx("span", {
217
- ...{
218
- className: "x1lvx875"
219
- },
220
- children: truncateString(entities[0].label, maxLength)
221
- });
157
+ return truncateString(entities[0].label, maxLength);
222
158
  }
223
159
  const totalLength = entities.reduce((sum, e) => sum + e.label.length, 0);
224
160
  if (totalLength > maxLength) {
225
- return /*#__PURE__*/_jsxs("span", {
226
- ...{
227
- className: "x1lvx875"
228
- },
229
- children: [entities.length, " items"]
230
- });
161
+ return `${entities.length} items`;
231
162
  }
232
- return /*#__PURE__*/_jsx("span", {
233
- ...{
234
- className: "x1lvx875"
235
- },
236
- children: entities.map(e => e.label).join(', ')
237
- });
163
+ return entities.map(e => e.label).join(', ');
238
164
  }
239
165
  case 'time':
240
- return /*#__PURE__*/_jsx("span", {
241
- ...{
242
- className: "x1lvx875"
243
- },
244
- children: filterValue.value
245
- });
166
+ return filterValue.value;
246
167
  case 'date_absolute':
247
- {
248
- const formatted = formatDateAbsoluteCompact(filterValue.unixSeconds, locale);
249
- return /*#__PURE__*/_jsx("span", {
250
- ...{
251
- className: "x1lvx875"
252
- },
253
- children: truncateString(formatted, maxLength)
254
- });
255
- }
168
+ return truncateString(formatDateAbsoluteCompact(filterValue.unixSeconds, locale), maxLength);
256
169
  case 'date_relative':
257
- return /*#__PURE__*/_jsx("span", {
258
- ...{
259
- className: "x1lvx875"
260
- },
261
- children: truncateString(filterValue.value, maxLength)
262
- });
170
+ return truncateString(filterValue.value, maxLength);
263
171
  case 'date_range':
264
- return /*#__PURE__*/_jsx("span", {
265
- ...{
266
- className: "x1lvx875"
267
- },
268
- children: "date range"
269
- });
172
+ return 'date range';
270
173
  case 'custom':
271
174
  if (operatorValue.type === 'custom') {
272
- return /*#__PURE__*/_jsx("span", {
273
- ...{
274
- className: "x1lvx875"
275
- },
276
- children: truncateString(operatorValue.getString(filterValue.value), maxLength)
277
- });
175
+ return truncateString(operatorValue.getString(filterValue.value), maxLength);
278
176
  }
279
- return /*#__PURE__*/_jsx("span", {
280
- ...{
281
- className: "x1lvx875"
282
- },
283
- children: filterValue.value
284
- });
177
+ return filterValue.value;
285
178
  case 'nested':
286
179
  {
287
180
  const count = filterValue.value.length;
288
- return /*#__PURE__*/_jsx("span", {
289
- ...{
290
- className: "x1lvx875"
291
- },
292
- children: count === 1 ? '1 filter' : `${count} filters`
293
- });
181
+ return count === 1 ? '1 filter' : `${count} filters`;
294
182
  }
295
183
  default:
296
184
  return null;
297
185
  }
298
186
  }
187
+ function PowerSearchTokenValue({
188
+ text
189
+ }) {
190
+ return /*#__PURE__*/_jsx("span", {
191
+ ...{
192
+ className: "x1lvx875"
193
+ },
194
+ children: text
195
+ });
196
+ }
299
197
 
300
198
  // =============================================================================
301
199
  // Types
@@ -309,6 +207,14 @@ function PowerSearchTokenValue({
309
207
  // Component
310
208
  // =============================================================================
311
209
 
210
+ /**
211
+ * Whether a press on a token with this operator commits the filter instead of
212
+ * opening its editor: an `empty` operator with no `empty` Editor override.
213
+ */
214
+ function commitsWithoutEditor(operator, componentOverrides) {
215
+ return operator?.value.type === 'empty' && componentOverrides?.empty?.Editor == null;
216
+ }
217
+
312
218
  /**
313
219
  * Structured filter bar where each token represents a filter (field + operator + value).
314
220
  *
@@ -423,6 +329,28 @@ export function PowerSearch({
423
329
  type: 'idle'
424
330
  });
425
331
 
332
+ // A default filter token's visible text: its label (field and operator)
333
+ // and its value. The token's remove button and editor dialog are named by
334
+ // the same text.
335
+ const tokenText = useCallback(filter => {
336
+ const field = config.getField(filter.field);
337
+ const operator = config.getOperator(filter.field, filter.operator);
338
+ const fieldLabel = field?.label ?? '';
339
+ const operatorLabel = operator ? resolveOperatorLabel(operator, t) : '';
340
+ const label = `${fieldLabel}: ${operatorLabel}`.trim();
341
+ const value = operator ? tokenValueText(operator.value, filter.value, Math.max(maxTokenLength - fieldLabel.length - operatorLabel.length, 10), locale) : null;
342
+ return {
343
+ label,
344
+ value,
345
+ full: value != null ? `${label} ${value}` : label
346
+ };
347
+ }, [config, maxTokenLength, t, locale]);
348
+ // The built-in token being edited. A token from a `components` override
349
+ // names itself, so its editor keeps the plain popover.
350
+ const editedFilter = popoverState.type === 'editing' ? filters[popoverState.filterIndex] : undefined;
351
+ const editedOperator = editedFilter != null ? config.getOperator(editedFilter.field, editedFilter.operator) : undefined;
352
+ const editedBuiltInFilter = editedOperator == null || componentOverrides?.[editedOperator.value.type]?.Token == null ? editedFilter : undefined;
353
+
426
354
  // Layer for positioning the edit popover anchored to the tokenizer
427
355
  const handleLayerHide = useCallback(() => {
428
356
  setPopoverStateRaw({
@@ -434,9 +362,13 @@ export function PowerSearch({
434
362
  hasLightDismiss: true,
435
363
  hasCloseButton: false,
436
364
  hasAutoFocus: false,
437
- // The popup's own listbox/menu content is the exposed semantics; focus
438
- // stays on the tokenizer input, so a modal dialog wrapper is incorrect.
439
- role: 'none'
365
+ // Adding: the popup's own listbox/menu content is the exposed semantics,
366
+ // and focus stays on the tokenizer input, so a dialog wrapper is
367
+ // incorrect. Editing a token: focus moves into the editor's controls, so
368
+ // the editor is a non-modal dialog named by the token's visible text.
369
+ role: editedBuiltInFilter != null ? 'dialog' : 'none',
370
+ isModal: false,
371
+ dialogLabel: editedBuiltInFilter != null ? tokenText(editedBuiltInFilter).full : undefined
440
372
  });
441
373
 
442
374
  // Wrapper that manages layer visibility and tokenizer focus alongside state
@@ -533,18 +465,25 @@ export function PowerSearch({
533
465
  value: undefined
534
466
  }
535
467
  });
536
- } else if (change.type === 'remove' && change.item) {
537
- const auxData = change.item.auxiliaryData;
538
- if (auxData?.filterIndex != null) {
539
- const newFilters = filters.filter((_, i) => _items.some(item => item.auxiliaryData?.filterIndex === i));
540
- onChange(newFilters, 'remove', auxData.filterIndex);
468
+ } else if (change.type === 'remove') {
469
+ const keptIndices = new Set(_items.map(item => item.auxiliaryData?.filterIndex));
470
+ const firstRemovedIndex = filters.findIndex((_, i) => !keptIndices.has(i));
471
+ if (firstRemovedIndex >= 0) {
472
+ onChange(filters.filter((_, i) => keptIndices.has(i)), 'remove', firstRemovedIndex);
541
473
  }
542
474
  }
543
475
  }, [config, filters, onChange, setPopoverState]);
544
476
 
545
- // Tokenizer's Backspace does not go through renderToken. This predicate
546
- // locks every token of a read-only field.
547
- const isItemRemovable = useCallback(() => !isReadOnly, [isReadOnly]);
477
+ // Tokenizer's Backspace and Clear all do not go through renderToken. This
478
+ // predicate locks each read-only filter, and every token of a read-only
479
+ // field.
480
+ const isItemRemovable = useCallback(item => {
481
+ if (isReadOnly) {
482
+ return false;
483
+ }
484
+ const filterIndex = item.auxiliaryData?.filterIndex;
485
+ return filterIndex == null || !filters[filterIndex]?.isReadOnly;
486
+ }, [filters, isReadOnly]);
548
487
 
549
488
  // Handle clicking a token to edit
550
489
  const handleTokenClick = useCallback(index => {
@@ -560,7 +499,7 @@ export function PowerSearch({
560
499
  // edit: commit it as that editor's save would, the way adding one does,
561
500
  // instead of opening it. A consumer's `empty` Editor override still opens.
562
501
  const operator = config.getOperator(filter.field, filter.operator);
563
- if (operator?.value.type === 'empty' && componentOverrides?.empty?.Editor == null) {
502
+ if (commitsWithoutEditor(operator, componentOverrides)) {
564
503
  const newFilters = [...filters];
565
504
  newFilters[index] = {
566
505
  field: filter.field,
@@ -645,13 +584,14 @@ export function PowerSearch({
645
584
  // Default token rendering
646
585
  const fieldLabel = field?.label ?? '';
647
586
  const operatorLabel = operator ? resolveOperatorLabel(operator, t) : '';
648
- const tokenLabel = `${fieldLabel}: ${operatorLabel}`.trim();
649
- const adjustedMaxLength = Math.max(maxTokenLength - fieldLabel.length - operatorLabel.length, 10);
650
- const valueContent = operator && filter ? /*#__PURE__*/_jsx(PowerSearchTokenValue, {
651
- operatorValue: operator.value,
652
- filterValue: filter.value,
653
- maxLength: adjustedMaxLength,
654
- locale: locale
587
+ const text = filter != null ? tokenText(filter) : {
588
+ label: `${fieldLabel}: ${operatorLabel}`.trim(),
589
+ value: null
590
+ };
591
+ const tokenLabel = text.label;
592
+ const fullText = text.value != null ? `${text.label} ${text.value}` : text.label;
593
+ const valueContent = text.value != null ? /*#__PURE__*/_jsx(PowerSearchTokenValue, {
594
+ text: text.value
655
595
  }) : undefined;
656
596
 
657
597
  // Show entity photo as token icon for single-entity filters
@@ -664,24 +604,38 @@ export function PowerSearch({
664
604
  size: 16
665
605
  });
666
606
  }
667
- return /*#__PURE__*/_jsx(Token, {
668
- label: tokenLabel,
669
- size: size,
670
- icon: tokenIcon,
671
- endContent: valueContent,
672
- onMouseDown: handleClick ? e => {
673
- // Keep a token press from entering Tokenizer's input-focus
674
- // redirect. Click still edits/removes; Tab entry is unchanged.
675
- e.preventDefault();
676
- } : undefined,
677
- onClick: handleClick ? e => {
678
- e.stopPropagation();
679
- handleClick();
680
- } : undefined,
681
- onRemove: handleRemove,
682
- isDisabled: isDisabled
607
+
608
+ // A token that opens its editor says that it opens a dialog, and the
609
+ // naming context names it by all its visible text.
610
+ const editorProps = handleClick != null && !commitsWithoutEditor(operator, componentOverrides) ? {
611
+ 'aria-haspopup': 'dialog',
612
+ 'aria-expanded': popoverState.type === 'editing' && popoverState.filterIndex === filterIndex
613
+ } : null;
614
+ return /*#__PURE__*/_jsx(TokenNamingContext, {
615
+ value: {
616
+ actionName: fullText,
617
+ removeName: fullText
618
+ },
619
+ children: /*#__PURE__*/_jsx(Token, {
620
+ label: tokenLabel,
621
+ size: size,
622
+ icon: tokenIcon,
623
+ ...editorProps,
624
+ endContent: valueContent,
625
+ onMouseDown: handleClick ? e => {
626
+ // Keep a token press from entering Tokenizer's input-focus
627
+ // redirect. Click still edits/removes; Tab entry is unchanged.
628
+ e.preventDefault();
629
+ } : undefined,
630
+ onClick: handleClick ? e => {
631
+ e.stopPropagation();
632
+ handleClick();
633
+ } : undefined,
634
+ onRemove: handleRemove,
635
+ isDisabled: isDisabled
636
+ })
683
637
  });
684
- }, [filters, config, configProp, maxTokenLength, locale, size, isReadOnly, isDisabled, handleTokenClick, componentOverrides, t]);
638
+ }, [filters, config, configProp, maxTokenLength, size, isReadOnly, isDisabled, handleTokenClick, componentOverrides, t, popoverState, tokenText]);
685
639
 
686
640
  // Custom typeahead item renderer — adds field icon and description
687
641
  const renderItem = useCallback(item => {
@@ -779,7 +733,8 @@ export function PowerSearch({
779
733
  const announce = useAnnounce();
780
734
  // PowerSearch words its Clear all as its record does; the field announces
781
735
  // these words instead of Tokenizer's (component:Tokenizer AR7).
782
- const clearAllMessage = useMemo(() => t('@astryx.powersearch.allFiltersRemoved'), [t]);
736
+ const hasReadOnlyFilter = filters.some(filter => filter.isReadOnly);
737
+ const clearAllMessage = useMemo(() => hasReadOnlyFilter ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.allFiltersRemoved'), [hasReadOnlyFilter, t]);
783
738
  const announcedResultCountRef = useRef(resultCountText);
784
739
  useEffect(() => {
785
740
  if (resultCountText === announcedResultCountRef.current) {
@@ -1 +1 @@
1
- {"version":3,"file":"RadioList.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,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AC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,KAAK,EACL,QAAQ,EACR,WAAwB,EACxB,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,MAAM,EACN,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAAiB,EAAE,kBAAkB,EACrC,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,cAAc,qBA8NhB;yBA1Pe,SAAS"}
1
+ {"version":3,"file":"RadioList.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAA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IG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,KAAK,EACL,QAAQ,EACR,WAAwB,EACxB,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,MAAM,EACN,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAAiB,EAAE,kBAAkB,EACrC,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,cAAc,qBAkOhB;yBA9Pe,SAAS"}
@@ -247,6 +247,11 @@ export function RadioList({
247
247
  disabledMessageTooltip.ref(el);
248
248
  },
249
249
  role: "radiogroup"
250
+ // Screen readers announce the whole group as unavailable. Its dimmed
251
+ // label then labels a disabled control. An enabled list keeps a
252
+ // caller's own value.
253
+ ,
254
+ "aria-disabled": isDisabled || rest['aria-disabled']
250
255
  // A caller aria-labelledby names the group together with its label.
251
256
  ,
252
257
  "aria-labelledby": joinAriaIDs(labelID, ariaLabelledByProp),
@@ -1 +1 @@
1
- {"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/Resizable/ResizeHandle.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAW5C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAcxB,KAAK,aAAa,GAAG,OAAO,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