@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
@@ -0,0 +1,251 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file resizeGesture.ts
5
+ * @input A handle element, a resize model (its state, and a gesture's start,
6
+ * move, end and cancel), and the handle's axis, reversal and disabled state
7
+ * @output createResizeGesture: the window splitter's input in one place: a
8
+ * pointer drag that holds its pointer, the arrow keys, Home, End and Enter,
9
+ * and a double-click collapse; and the body's drag cursor
10
+ * @position Internal to the Resizable family. ResizeHandle forwards its React
11
+ * events to it. No React, and no DOM work on import
12
+ */
13
+
14
+ /** Pixels an arrow key moves the separator; Shift moves it further. */
15
+ export const KEYBOARD_STEP = 10;
16
+ export const KEYBOARD_LARGE_STEP = 50;
17
+
18
+ /** What a gesture reads from its region when an input arrives. */
19
+
20
+ /** The region a gesture resizes. */
21
+
22
+ /** The handle's configuration, read at each input. */
23
+
24
+ /** The fields of a pointer event the gesture reads (native or React). */
25
+
26
+ /** The fields of a key event the gesture reads (native or React). */
27
+
28
+ /**
29
+ * Drag feedback lives on the page's `<body>`, not on the handle. During a
30
+ * drag the pointer moves over whatever the panels contain, and the resize
31
+ * cursor must hold there.
32
+ */
33
+ function applyBodyDragStyles(isHorizontal) {
34
+ document.body.style.cursor = isHorizontal ? 'col-resize' : 'row-resize';
35
+ document.body.style.userSelect = 'none';
36
+ }
37
+ function clearBodyDragStyles() {
38
+ document.body.style.cursor = '';
39
+ document.body.style.userSelect = '';
40
+ }
41
+
42
+ /**
43
+ * The snap point `count` points away from the region's current size in
44
+ * `direction` (+1 grows, -1 shrinks). A point beyond the minimum or the
45
+ * maximum counts as that bound. When fewer points remain, the nearest end
46
+ * point serves, or the current size when the region is already there.
47
+ */
48
+ function adjacentSnapPoint(state, direction, count) {
49
+ const points = [...new Set(state.snaps.map(p => Math.min(state.maxPx, Math.max(state.minPx, p))))].sort((a, b) => a - b);
50
+ const {
51
+ size
52
+ } = state;
53
+ const ahead = direction > 0 ? points.filter(p => p > size) : points.filter(p => p < size).reverse();
54
+ if (ahead.length === 0) {
55
+ return size;
56
+ }
57
+ return ahead[Math.min(count, ahead.length) - 1];
58
+ }
59
+ function step(model, delta) {
60
+ model.start();
61
+ model.move(delta);
62
+ model.end();
63
+ }
64
+
65
+ /**
66
+ * Collapse an open pane, or restore a collapsed one to the size it had before
67
+ * it collapsed, with the region's own collapse and expand. A region without
68
+ * them falls back to a resize gesture to the minimum. That gesture cannot
69
+ * reopen a pane whose minimum sits below its collapse threshold.
70
+ */
71
+ function toggleCollapse(model) {
72
+ const state = model.state();
73
+ if (model.collapse != null && model.expand != null) {
74
+ if (state.isCollapsed) {
75
+ model.expand();
76
+ } else {
77
+ model.collapse();
78
+ }
79
+ return;
80
+ }
81
+ step(model, state.isCollapsed ? state.minPx : -state.size);
82
+ }
83
+
84
+ /**
85
+ * The window splitter's input for one handle. A drag takes pointer capture
86
+ * on the element the press landed on. The rest of the gesture then goes to
87
+ * that element. Without capture, the browser hit-tests each move, and an
88
+ * embedded frame under the pointer takes the drag.
89
+ */
90
+ export function createResizeGesture(getHandle, model, getConfig, onDraggingChange) {
91
+ let drag = null;
92
+ const rtlMultiplier = () => {
93
+ const handle = getHandle();
94
+ if (handle == null) {
95
+ return 1;
96
+ }
97
+ const view = handle.ownerDocument.defaultView;
98
+ return view?.getComputedStyle(handle).direction === 'rtl' ? -1 : 1;
99
+ };
100
+ const clearDrag = () => {
101
+ const ending = drag;
102
+ drag = null;
103
+ const target = ending?.target;
104
+ if (ending != null && target != null && target.hasPointerCapture?.(ending.pointerId) === true) {
105
+ target.releasePointerCapture(ending.pointerId);
106
+ }
107
+ if (ending != null) {
108
+ clearBodyDragStyles();
109
+ }
110
+ onDraggingChange?.(false);
111
+ };
112
+ return {
113
+ get isDragging() {
114
+ return drag != null;
115
+ },
116
+ pointerDown(event) {
117
+ const config = getConfig();
118
+ if (config.isDisabled || drag != null) {
119
+ return;
120
+ }
121
+ event.preventDefault();
122
+ event.stopPropagation();
123
+ // An element from another document (an iframe, a popup) is not an
124
+ // instance of this page's Element, so test for the capture API itself.
125
+ const current = event.currentTarget;
126
+ const target = typeof current?.setPointerCapture === 'function' ? current : null;
127
+ target?.setPointerCapture?.(event.pointerId);
128
+ const isHorizontal = config.direction === 'horizontal';
129
+ drag = {
130
+ pointerId: event.pointerId,
131
+ startPos: isHorizontal ? event.clientX : event.clientY,
132
+ rtl: isHorizontal ? rtlMultiplier() : 1,
133
+ target
134
+ };
135
+ onDraggingChange?.(true);
136
+ model.start();
137
+ applyBodyDragStyles(isHorizontal);
138
+ },
139
+ pointerMove(event) {
140
+ if (drag == null || drag.pointerId !== event.pointerId) {
141
+ return;
142
+ }
143
+ const config = getConfig();
144
+ const position = config.direction === 'horizontal' ? event.clientX : event.clientY;
145
+ const sign = config.isReversed ? -1 : 1;
146
+ model.move((position - drag.startPos) * drag.rtl * sign);
147
+ },
148
+ pointerUp(event) {
149
+ if (drag?.pointerId !== event.pointerId) {
150
+ return;
151
+ }
152
+ clearDrag();
153
+ model.end();
154
+ },
155
+ // Serves pointercancel and lostpointercapture alike: an interrupted drag
156
+ // ends without a resize end. The implicit release after every pointerup
157
+ // or pointercancel also fires lostpointercapture. By then the drag is
158
+ // already cleared, and this is a no-op.
159
+ pointerCancel(event) {
160
+ if (drag?.pointerId !== event.pointerId) {
161
+ return;
162
+ }
163
+ clearDrag();
164
+ model.cancel();
165
+ },
166
+ interrupt() {
167
+ if (drag == null) {
168
+ return;
169
+ }
170
+ clearDrag();
171
+ model.cancel();
172
+ },
173
+ keyDown(event) {
174
+ const config = getConfig();
175
+ if (config.isDisabled) {
176
+ return;
177
+ }
178
+ const state = model.state();
179
+ const isHorizontal = config.direction === 'horizontal';
180
+ const sign = config.isReversed ? -1 : 1;
181
+ const keyStep = event.shiftKey ? KEYBOARD_LARGE_STEP : KEYBOARD_STEP;
182
+ const rtl = isHorizontal ? rtlMultiplier() : 1;
183
+
184
+ // The pane's grow direction on this key: ArrowRight/Down grow unless the
185
+ // layout is reversed or, on the inline axis, right-to-left.
186
+ const grows = key => (key === 'ArrowRight' || key === 'ArrowDown' ? 1 : key === 'ArrowLeft' || key === 'ArrowUp' ? -1 : 0) * (isHorizontal ? rtl : 1) * sign > 0;
187
+ switch (event.key) {
188
+ case 'ArrowRight':
189
+ case 'ArrowDown':
190
+ case 'ArrowLeft':
191
+ case 'ArrowUp':
192
+ {
193
+ event.preventDefault();
194
+ if (state.isCollapsed) {
195
+ // A collapsed pane answers only the grow arrow. It opens one step
196
+ // above its minimum, the value the separator announces while
197
+ // collapsed. If the collapse threshold is larger, it opens there.
198
+ // A bare step would stay below the threshold and leave the pane
199
+ // closed. The shrink arrow is a no-op.
200
+ if (grows(event.key)) {
201
+ step(model, Math.max(state.minPx + keyStep, state.collapsedSize));
202
+ }
203
+ break;
204
+ }
205
+ if (state.snaps.length > 0) {
206
+ // With snap points the region rests only on a point, so a pixel
207
+ // step would snap straight back. The arrow moves to the adjacent
208
+ // point in its direction instead, two points with Shift, within
209
+ // the bounds.
210
+ step(model, adjacentSnapPoint(state, grows(event.key) ? 1 : -1, event.shiftKey ? 2 : 1) - state.size);
211
+ break;
212
+ }
213
+ const direction = event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1;
214
+ step(model, direction * keyStep * (isHorizontal ? rtl : 1) * sign);
215
+ break;
216
+ }
217
+ case 'Home':
218
+ {
219
+ event.preventDefault();
220
+ step(model, state.minPx - state.size);
221
+ break;
222
+ }
223
+ case 'End':
224
+ {
225
+ event.preventDefault();
226
+ // Only a configured maximum is the region's own limit. The reported
227
+ // stand-in for an unbounded region is where the pane could reach,
228
+ // not where End may move it.
229
+ if (state.maxPx !== Infinity) {
230
+ step(model, state.maxPx - state.size);
231
+ }
232
+ break;
233
+ }
234
+ case 'Enter':
235
+ {
236
+ event.preventDefault();
237
+ if (state.collapsible) {
238
+ toggleCollapse(model);
239
+ }
240
+ break;
241
+ }
242
+ }
243
+ },
244
+ doubleClick() {
245
+ if (getConfig().isDisabled || !model.state().collapsible) {
246
+ return;
247
+ }
248
+ toggleCollapse(model);
249
+ }
250
+ };
251
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EG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EACR,OAAO,GACP;QACE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;KACpD,CAAC;IACN;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,UAAkB,EAClB,UAAkB,EAClB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EAAE,eAAe,EAC5B,IAAW,EACX,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,MAAM,EACN,GAAG,IAAI,EACR,EAAE,gBAAgB,sCA4clB;yBA9de,WAAW"}
@@ -50,7 +50,7 @@ import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js"
50
50
  import { usePressFeedback } from "../hooks/usePressFeedback.js";
51
51
  import { useSideNavCollapse, SideNavCollapseContext } from "./SideNavCollapseContext.js";
52
52
  import { useSideNavRenderMode } from "./SideNavRenderContext.js";
53
- import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
53
+ import { useCloseMobileDrawerOnActivate } from "../AppShell/useCloseMobileDrawerOnActivate.js";
54
54
  import { themeProps } from "../utils/themeProps.js";
55
55
  import { disabledInteractionProps } from "../utils/disabledInteraction.js";
56
56
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
@@ -319,10 +319,8 @@ export function SideNavItem({
319
319
  isCollapsed
320
320
  } = useSideNavCollapse();
321
321
  const renderMode = useSideNavRenderMode();
322
- const {
323
- closeMobileNav
324
- } = useAppShellMobile();
325
322
  const isInDrawer = renderMode === 'drawer' || renderMode === 'drawer-content';
323
+ const closeDrawerAfter = useCloseMobileDrawerOnActivate(isInDrawer);
326
324
  const id = useId();
327
325
  const hasChildren = !!children;
328
326
  const depth = use(SideNavItemDepthContext);
@@ -396,11 +394,7 @@ export function SideNavItem({
396
394
  toggleItemCollapse();
397
395
  return;
398
396
  }
399
- onClick?.(e);
400
- // Close the mobile nav when a nav item is activated inside the drawer
401
- if (isInDrawer) {
402
- closeMobileNav();
403
- }
397
+ closeDrawerAfter(onClick)?.(e);
404
398
  };
405
399
  const handleToggleClick = e => {
406
400
  e.preventDefault();
@@ -12,7 +12,7 @@
12
12
  * - /apps/storybook/stories/Token.stories.tsx (storybook stories)
13
13
  * - /packages/cli/assets/templates/blocks/components/Token/ (showcase blocks)
14
14
  */
15
- import type { ReactNode } from 'react';
15
+ import { type ReactNode } from 'react';
16
16
  import type { BaseProps } from '../BaseProps.js';
17
17
  import type { TokenColorMap } from './index.js';
18
18
  /**
@@ -95,7 +95,7 @@ export interface TokenProps extends BaseProps<HTMLElement> {
95
95
  * <Token label="Link" href="/path" />
96
96
  * ```
97
97
  */
98
- export declare function Token({ label, size, color, icon, isDisabled, onRemove, onClick, href, description, endContent, isLabelHidden, xstyle, className, style, 'data-testid': testId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ref, ...rest }: TokenProps): import("react").JSX.Element;
98
+ export declare function Token({ label, size, color, icon, isDisabled, onRemove, onClick, href, description, endContent, isLabelHidden, xstyle, className, style, 'data-testid': testId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-haspopup': ariaHasPopup, 'aria-expanded': ariaExpanded, ref, ...rest }: TokenProps): import("react").JSX.Element;
99
99
  export declare namespace Token {
100
100
  var displayName: string;
101
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/Token/Token.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAiBrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAc3C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,WAAW,CAAC;IACxD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,OAAO,CAA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I,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA6JD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAW,EACX,KAAiB,EACjB,IAAI,EACJ,UAAkB,EAClB,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,UAAU,EACV,aAAqB,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY,EAC7B,GAAG,EACH,GAAG,IAAI,EACR,EAAE,UAAU,+BA8QZ;yBApSe,KAAK"}
@@ -16,6 +16,7 @@
16
16
  * - /apps/storybook/stories/Token.stories.tsx (storybook stories)
17
17
  * - /packages/cli/assets/templates/blocks/components/Token/ (showcase blocks)
18
18
  */
19
+ import { use } from 'react';
19
20
  import * as stylex from '@stylexjs/stylex';
20
21
  import "../theme/tokens.stylex.js";
21
22
  import { colorVars, spacingVars, radiusVars, sizeVars, durationVars, easeVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
@@ -29,6 +30,7 @@ import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
29
30
  import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
30
31
  import { usePressFeedback } from "../hooks/usePressFeedback.js";
31
32
  import { disabledInteractionProps } from "../utils/disabledInteraction.js";
33
+ import { TokenNamingContext } from "./TokenNamingContext.js";
32
34
  import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
33
35
  import english from "../i18n/generated-english/Token/Token.generated.js";
34
36
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
@@ -216,6 +218,8 @@ export function Token({
216
218
  'data-testid': testId,
217
219
  'aria-labelledby': ariaLabelledBy,
218
220
  'aria-describedby': ariaDescribedBy,
221
+ 'aria-haspopup': ariaHasPopup,
222
+ 'aria-expanded': ariaExpanded,
219
223
  ref,
220
224
  ...rest
221
225
  }) {
@@ -230,6 +234,7 @@ export function Token({
230
234
  onClick,
231
235
  isDisabled
232
236
  });
237
+ const naming = use(TokenNamingContext);
233
238
 
234
239
  // When role is 'button' via context (no explicit onClick), treat as
235
240
  // if onClick was provided — the popover attaches its own handler.
@@ -237,7 +242,7 @@ export function Token({
237
242
  const removeButton = onRemove != null && /*#__PURE__*/_jsx("button", {
238
243
  type: "button",
239
244
  "aria-label": t('@astryx.token.remove', {
240
- label
245
+ label: naming?.removeName ?? label
241
246
  }),
242
247
  onClick: e => {
243
248
  e.stopPropagation();
@@ -268,12 +273,14 @@ export function Token({
268
273
  }), endContent, removeButton]
269
274
  });
270
275
 
271
- // Naming inputs reach the element that owns the token's action: the inner
272
- // button of a clickable token, otherwise the root
276
+ // Naming and popup inputs reach the element that owns the token's action:
277
+ // the inner button of a clickable token, otherwise the root
273
278
  // (architecture:public-component-api INV5).
274
279
  const labellingProps = {
275
280
  'aria-labelledby': ariaLabelledBy,
276
- 'aria-describedby': ariaDescribedBy
281
+ 'aria-describedby': ariaDescribedBy,
282
+ 'aria-haspopup': ariaHasPopup,
283
+ 'aria-expanded': ariaExpanded
277
284
  };
278
285
  const sharedProps = {
279
286
  'data-testid': testId,
@@ -398,6 +405,7 @@ export function Token({
398
405
  children: [icon, /*#__PURE__*/_jsx("button", {
399
406
  type: "button",
400
407
  onClick: effectiveOnClick,
408
+ "aria-label": ariaLabelledBy == null ? naming?.actionName : undefined,
401
409
  ...labellingProps,
402
410
  "aria-disabled": isDisabled || undefined,
403
411
  ...(isDisabled ? disabledInteractionProps() : null),
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Names for a Token whose visible text runs past its label. PowerSearch
3
+ * provides them: its tokens show the value as `endContent`.
4
+ *
5
+ * - `actionName` names a clickable token's inner button in place of `label`.
6
+ * - `removeName` names the remove button in place of `label`. The remove word
7
+ * still comes from the catalog, so each locale keeps its word order.
8
+ */
9
+ export interface TokenNaming {
10
+ actionName?: string;
11
+ removeName?: string;
12
+ }
13
+ export declare const TokenNamingContext: import("react").Context<TokenNaming | null>;
14
+ //# sourceMappingURL=TokenNamingContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenNamingContext.d.ts","sourceRoot":"","sources":["../../src/Token/TokenNamingContext.ts"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,6CAA0C,CAAC"}
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file TokenNamingContext.ts
7
+ * @input Naming parts from a caller whose token value renders outside its label
8
+ * @output Internal context: the names of a token's action and remove button
9
+ * @position Internal to Core; not exported from the Token entry point
10
+ */
11
+ import { createContext } from 'react';
12
+
13
+ /**
14
+ * Names for a Token whose visible text runs past its label. PowerSearch
15
+ * provides them: its tokens show the value as `endContent`.
16
+ *
17
+ * - `actionName` names a clickable token's inner button in place of `label`.
18
+ * - `removeName` names the remove button in place of `label`. The remove word
19
+ * still comes from the catalog, so each locale keeps its word order.
20
+ */
21
+
22
+ export const TokenNamingContext = /*#__PURE__*/createContext(null);
23
+ TokenNamingContext.displayName = 'TokenNamingContext';
@@ -2,16 +2,10 @@
2
2
  * @file Tokenizer.tsx
3
3
  * @input Uses React, BaseTypeahead, Field, Token, useAnnounce,
4
4
  * useAdaptivePresentation, and TokenizerBottomSheet (lazy)
5
- * @output Exports Tokenizer multi-select typeahead component, and the
6
- * internal TokenizerWithPresentation signature the `internal/tokenizer-presentation`
7
- * entry re-exports
5
+ * @output Exports Tokenizer multi-select typeahead component
8
6
  * @position Composed component; forwards DOM ref and exposes focus control via
9
- * handleRef. The sheet presentation — a trigger that opens
10
- * TokenizerBottomSheet — is implemented but not exposed: `TokenizerProps`
11
- * offers no `experimental.presentation` while its user experience is being
12
- * finished (`component:Tokenizer` DEC-3, implementation gap), and only
13
- * Astryx's own packages reach it through the internal entry
14
- * (`architecture:react-component-runtime` INV13).
7
+ * handleRef. The experimental `presentation` option swaps the inline
8
+ * combobox for a trigger that opens TokenizerBottomSheet.
15
9
  *
16
10
  * SYNC: When modified, update:
17
11
  * - /packages/core/src/Tokenizer/index.ts
@@ -59,35 +53,6 @@ export interface TokenizerHandle {
59
53
  /** Blur the typeahead input. */
60
54
  blur(): void;
61
55
  }
62
- /**
63
- * The presentation options the sheet-capable signature admits. Not public:
64
- * `TokenizerProps` has no `experimental` while the sheet's user experience is
65
- * being finished; Astryx's own packages reach the sheet through
66
- * `@astryxdesign/core/internal/tokenizer-presentation`.
67
- */
68
- export interface TokenizerPresentationOptions {
69
- /**
70
- * How the field presents its choices.
71
- * - `'popover'`: the inline combobox with its anchored suggestion menu —
72
- * the stable behavior.
73
- * - `'bottom-sheet'`: a trigger showing the selected tokens that opens one
74
- * tall modal sheet: a search row on top, full-width checkbox rows that
75
- * keep their place while the sheet is open, a create row with
76
- * `hasCreate`, and a footer with a confirmed Clear all and Done. Suited
77
- * to compact touch screens, where the inline combobox competes with the
78
- * software keyboard.
79
- * - `'adaptive'`: the bottom sheet on compact coarse-pointer screens,
80
- * otherwise the popover — the same resolution Selector uses.
81
- *
82
- * In the sheet presentation the trigger is the control: `ref`, `id`,
83
- * `aria-*`, and `data-*` reach it. `renderItem`, `renderToken`,
84
- * `endContent`, `hasClear`, `hasEntriesOnFocus`, `menuWidth`,
85
- * `tokenOverflowBehavior`, and `hasAutoFocus` have no surface to act on
86
- * and warn once in development.
87
- * @default 'popover'
88
- */
89
- presentation?: 'popover' | 'bottom-sheet' | 'adaptive';
90
- }
91
56
  export interface TokenizerProps<T extends SearchableItem> extends Omit<FieldInputBaseProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown'> {
92
57
  /**
93
58
  * Key handler. Runs after the built-in key handling, so it observes every key
@@ -241,38 +206,60 @@ export interface TokenizerProps<T extends SearchableItem> extends Omit<FieldInpu
241
206
  ref?: React.Ref<HTMLInputElement>;
242
207
  /** Imperative handle ref for focus/blur control. */
243
208
  handleRef?: React.Ref<TokenizerHandle>;
209
+ /**
210
+ * Experimental options, outside the stable compatibility promise: anything
211
+ * in this object may change or be removed in a patch release. Omit it for
212
+ * the stable behavior.
213
+ * @experimental
214
+ */
215
+ experimental?: {
216
+ /**
217
+ * How the field presents its choices.
218
+ * - `'popover'`: the inline combobox with its anchored suggestion menu —
219
+ * the stable behavior.
220
+ * - `'bottom-sheet'`: a trigger showing the selected tokens that opens one
221
+ * tall modal sheet: a search row on top, full-width checkbox rows that
222
+ * keep their place while the sheet is open, a create row with
223
+ * `hasCreate`, and a footer pinned in every state with a confirmed Clear
224
+ * all and Save. The sheet edits a draft: `onChange` fires once, when Save
225
+ * commits it, and a swipe, scrim or Escape close of a changed draft asks
226
+ * before discarding. Suited to compact touch screens, where the inline
227
+ * combobox competes with the software keyboard.
228
+ * - `'adaptive'`: the bottom sheet on compact coarse-pointer screens,
229
+ * otherwise the popover — the same resolution Selector uses.
230
+ *
231
+ * In the sheet presentation the trigger is the control: `ref`, `id`,
232
+ * `aria-*`, and `data-*` reach it. `renderItem`, `renderToken`,
233
+ * `endContent`, `hasClear`, `hasEntriesOnFocus`, `menuWidth`,
234
+ * `tokenOverflowBehavior`, and `hasAutoFocus` have no surface to act on
235
+ * and warn once in development.
236
+ * @experimental
237
+ * @default 'popover'
238
+ */
239
+ presentation?: 'popover' | 'bottom-sheet' | 'adaptive';
240
+ };
244
241
  }
245
242
  /**
246
- * The props of the sheet-capable signature: `TokenizerProps` plus the
247
- * presentation options and a `ref` that also accepts the sheet presentation's
248
- * trigger button, the control it stands for there. Not public: reached only
249
- * as `TokenizerWithPresentation` through the internal entry, so the released
250
- * `TokenizerProps` — an interface, so `interface X extends TokenizerProps<T>`,
251
- * `Omit<TokenizerProps<T>, …>` and `ComponentProps<typeof Tokenizer>` keep
252
- * their released shapes — names no presentation.
243
+ * The props the experimental opt-in admits. `experimental` is present, and
244
+ * `ref` also accepts the sheet presentation's trigger button, the control it
245
+ * stands for there. Only the overload below reaches this type. `TokenizerProps`
246
+ * stays the component's declared props type: it is an interface, so
247
+ * `interface X extends TokenizerProps<T>`, `Omit<TokenizerProps<T>, …>` and
248
+ * `ComponentProps<typeof Tokenizer>` keep their released shapes.
253
249
  */
254
- export type TokenizerWithPresentationProps<T extends SearchableItem> = Omit<TokenizerProps<T>, 'ref'> & {
255
- /** How the field presents its choices; see `TokenizerPresentationOptions`. */
256
- experimental?: TokenizerPresentationOptions;
250
+ type TokenizerExperimentalProps<T extends SearchableItem> = Omit<TokenizerProps<T>, 'ref' | 'experimental'> & {
251
+ /** @experimental */
252
+ experimental: NonNullable<TokenizerProps<T>['experimental']>;
257
253
  /**
258
254
  * Ref forwarded to the control: the combobox input in the popover
259
255
  * presentation, the trigger button in the sheet presentation.
256
+ * @experimental
260
257
  */
261
258
  ref?: React.Ref<HTMLInputElement | HTMLButtonElement>;
262
259
  };
260
+ export declare function Tokenizer<T extends SearchableItem>(props: TokenizerExperimentalProps<T>): React.JSX.Element;
263
261
  export declare function Tokenizer<T extends SearchableItem>(props: TokenizerProps<T>): React.JSX.Element;
264
262
  export declare namespace Tokenizer {
265
263
  var displayName: string;
266
264
  }
267
- /**
268
- * The same component with the sheet presentation reachable: `experimental`
269
- * (`presentation: 'popover' | 'bottom-sheet' | 'adaptive'`) and a `ref` that
270
- * also takes the trigger button. Not public — re-exported only by
271
- * `@astryxdesign/core/internal/tokenizer-presentation`, the entry reserved
272
- * for Astryx's own packages (`architecture:react-component-runtime` INV13),
273
- * while the sheet's user experience is being finished (`component:Tokenizer`
274
- * DEC-3). The public `Tokenizer` renders the popover presentation for every
275
- * field.
276
- */
277
- export declare const TokenizerWithPresentation: <T extends SearchableItem>(props: TokenizerWithPresentationProps<T>) => React.JSX.Element;
278
265
  //# sourceMappingURL=Tokenizer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tokenizer.d.ts","sourceRoot":"","sources":["../../src/Tokenizer/Tokenizer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,EAYZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAUf,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAWtD,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAO5B,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAWxE,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAMlB;;GAEG;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