@astryxdesign/core 0.7.7-canary.ae97fa8 → 0.7.7-canary.ba5866a
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.
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +22 -3
- package/dist/Field/Field.js +2 -2
- package/dist/Layer/usePressPin.d.ts +17 -5
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +62 -12
- package/dist/PowerSearch/PowerSearch.d.ts +36 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +433 -127
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +100 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +1913 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +32 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +17 -6
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +170 -61
- package/dist/PowerSearch/formatFilterValue.d.ts +7 -0
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +11 -1
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +160 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -2
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -3
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +10 -7
- package/dist/Tooltip/useTooltip.d.ts +19 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +24 -7
- package/dist/astryx.css +11 -0
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +42 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +30 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +30 -0
- package/locales/en.json +120 -0
- package/locales/pseudo.json +90 -0
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheetPanel.tsx +33 -3
- package/src/Field/Field.tsx +2 -2
- package/src/Layer/usePressPin.ts +81 -15
- package/src/PowerSearch/PowerSearch.doc.mjs +54 -5
- package/src/PowerSearch/PowerSearch.tsx +609 -155
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2515 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +28 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +203 -38
- package/src/PowerSearch/formatFilterValue.ts +18 -1
- package/src/PowerSearch/formatTokenValue.ts +215 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/RadioList/RadioList.tsx +3 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +51 -6
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +43 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
- package/src/i18n/generated-locales/en.generated.ts +41 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +42 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA+B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAQvB,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC5D,YAAY,EAAC,oBAAoB,EAAC,CAAC;AA4CnC,eAAO,MAAM,2BAA2B,2DACkB,CAAC;AA2M3D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAA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|
205
205
|
let done = false;
|
|
206
206
|
let timer = null;
|
|
207
|
+
let backstopMs = 0;
|
|
207
208
|
const finish = () => {
|
|
208
209
|
if (done) {
|
|
209
210
|
return;
|
|
@@ -217,9 +218,21 @@ function waitForTransition(element, propertyName, complete) {
|
|
|
217
218
|
complete();
|
|
218
219
|
};
|
|
219
220
|
const handleTransitionEnd = event => {
|
|
220
|
-
if (event.target
|
|
221
|
-
|
|
221
|
+
if (event.target !== element || event.propertyName !== propertyName) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
// The engine cancels a transition whose end value changes mid-flight. A
|
|
225
|
+
// percentage transform does when the closing frame moves the height by a
|
|
226
|
+
// fraction of a pixel. A replacement runs on from where it was. That one
|
|
227
|
+
// ends the motion, not the cancel.
|
|
228
|
+
if (event.type === 'transitioncancel' && hasRunningTransition(element, propertyName)) {
|
|
229
|
+
if (timer != null) {
|
|
230
|
+
clearTimeout(timer);
|
|
231
|
+
timer = setTimeout(finish, backstopMs);
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
222
234
|
}
|
|
235
|
+
finish();
|
|
223
236
|
};
|
|
224
237
|
element.addEventListener('transitionend', handleTransitionEnd);
|
|
225
238
|
element.addEventListener('transitioncancel', handleTransitionEnd);
|
|
@@ -257,7 +270,8 @@ function waitForTransition(element, propertyName, complete) {
|
|
|
257
270
|
finish();
|
|
258
271
|
return () => {};
|
|
259
272
|
}
|
|
260
|
-
|
|
273
|
+
backstopMs = transitionMs + TRANSITION_BACKSTOP_BUFFER_MS;
|
|
274
|
+
timer = setTimeout(finish, backstopMs);
|
|
261
275
|
return () => {
|
|
262
276
|
if (timer != null) {
|
|
263
277
|
clearTimeout(timer);
|
|
@@ -266,6 +280,11 @@ function waitForTransition(element, propertyName, complete) {
|
|
|
266
280
|
element.removeEventListener('transitioncancel', handleTransitionEnd);
|
|
267
281
|
};
|
|
268
282
|
}
|
|
283
|
+
|
|
284
|
+
// Whether a CSS transition of `propertyName` still runs on `element`.
|
|
285
|
+
function hasRunningTransition(element, propertyName) {
|
|
286
|
+
return (element.getAnimations?.() ?? []).some(animation => animation.transitionProperty === propertyName && (animation.playState === 'running' || animation.playState === 'paused'));
|
|
287
|
+
}
|
|
269
288
|
function parseTransitionTime(value) {
|
|
270
289
|
const normalizedValue = value.trim();
|
|
271
290
|
if (!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(normalizedValue)) {
|
package/dist/Field/Field.js
CHANGED
|
@@ -22,11 +22,11 @@ import { FieldStatus } from "../FieldStatus/FieldStatus.js";
|
|
|
22
22
|
import { useFieldStatusAnnouncement } from "../FieldStatus/useFieldStatusAnnouncement.js";
|
|
23
23
|
import "../theme/tokens.stylex.js";
|
|
24
24
|
import { spacingVars, borderVars, sizeVars } from "../theme/tokens.stylex.js";
|
|
25
|
-
import { mergeProps } from "../utils/
|
|
25
|
+
import { mergeProps } from "../utils/mergeProps.js";
|
|
26
26
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
27
27
|
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
28
28
|
import { Text } from "../Text/Text.js";
|
|
29
|
-
import { VisuallyHidden } from "../VisuallyHidden/
|
|
29
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
30
30
|
import { themeProps } from "../utils/themeProps.js";
|
|
31
31
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
32
32
|
const styles = {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @file usePressPin.ts
|
|
3
3
|
* @input A hover layer's trigger, open state, show and hide, and its
|
|
4
4
|
* `triggerBehavior` and `touchTrigger` options
|
|
5
|
-
* @output usePressPin, the press toggle that pins a hover layer open
|
|
6
|
-
*
|
|
5
|
+
* @output usePressPin, the press toggle that pins a hover layer open, and
|
|
6
|
+
* the app hold behind useTooltip's show() and hide(); isPressPinTrigger;
|
|
7
|
+
* stopPressPinClick; the LayerTriggerBehavior type
|
|
7
8
|
* @position Core-internal: one call per hover layer, useTooltip's. It owns
|
|
8
9
|
* the layer's touch trigger, so the host makes no second touch-trigger call.
|
|
9
10
|
*
|
|
@@ -66,8 +67,18 @@ export interface UsePressPinReturn {
|
|
|
66
67
|
isHeldOpen: () => boolean;
|
|
67
68
|
/** Wires the trigger element, or unwires it with `null`. */
|
|
68
69
|
attach: (element: HTMLElement | null) => void;
|
|
69
|
-
/** Drops the pin: Escape, or a hide
|
|
70
|
+
/** Drops the pin and the app hold: Escape, or a hide from elsewhere. */
|
|
70
71
|
unpin: () => void;
|
|
72
|
+
/**
|
|
73
|
+
* The app's `show()`: shows the layer and holds it open, as a pin does,
|
|
74
|
+
* until `release`, Escape, a press outside, or focus leaving the trigger
|
|
75
|
+
* and the layer. A controlled layer reports the request instead.
|
|
76
|
+
*/
|
|
77
|
+
hold: () => void;
|
|
78
|
+
/** The app's `hide()`: drops the hold and hides the layer. */
|
|
79
|
+
release: () => void;
|
|
80
|
+
/** Whether the app's `show()` holds the layer open now. */
|
|
81
|
+
isAppHeld: () => boolean;
|
|
71
82
|
/**
|
|
72
83
|
* While pinned, focus moving onto an element outside the trigger and the
|
|
73
84
|
* layer closes it. Returns whether the pin decided. The pin calls it for its
|
|
@@ -75,8 +86,9 @@ export interface UsePressPinReturn {
|
|
|
75
86
|
*/
|
|
76
87
|
handleFocusLeave: (event: FocusEvent) => boolean;
|
|
77
88
|
/**
|
|
78
|
-
* Whether the layer shows pinned on a wired trigger
|
|
79
|
-
* its rendered text, unless the layer has
|
|
89
|
+
* Whether the layer shows pinned on a wired trigger, or held by the app's
|
|
90
|
+
* `show()`. The host then announces its rendered text, unless the layer has
|
|
91
|
+
* a `label`.
|
|
80
92
|
*/
|
|
81
93
|
isPinShown: boolean;
|
|
82
94
|
/** The layer's touch trigger (useTouchTriggerInternal), wired to the pin. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePressPin.d.ts","sourceRoot":"","sources":["../../src/Layer/usePressPin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;IAChC,+EAA+E;IAC/E,eAAe,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;IAC1D;;;;OAIG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,wEAAwE;IACxE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;OAIG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;IACjD;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,KAAK,EAAE,IAAI,CACT,qBAAqB,EACnB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,cAAc,CACjB,CAAC;CACH;AAwBD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAqZ1E"}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* @file usePressPin.ts
|
|
7
7
|
* @input A hover layer's trigger, open state, show and hide, and its
|
|
8
8
|
* `triggerBehavior` and `touchTrigger` options
|
|
9
|
-
* @output usePressPin, the press toggle that pins a hover layer open
|
|
10
|
-
*
|
|
9
|
+
* @output usePressPin, the press toggle that pins a hover layer open, and
|
|
10
|
+
* the app hold behind useTooltip's show() and hide(); isPressPinTrigger;
|
|
11
|
+
* stopPressPinClick; the LayerTriggerBehavior type
|
|
11
12
|
* @position Core-internal: one call per hover layer, useTooltip's. It owns
|
|
12
13
|
* the layer's touch trigger, so the host makes no second touch-trigger call.
|
|
13
14
|
*
|
|
@@ -94,8 +95,19 @@ export function usePressPin(options) {
|
|
|
94
95
|
setIsPinnedState(next);
|
|
95
96
|
}, []);
|
|
96
97
|
|
|
98
|
+
// The app's show() holds the layer on any trigger, in any mode.
|
|
99
|
+
const isAppHeldRef = useRef(false);
|
|
100
|
+
const [isAppHeldState, setIsAppHeldState] = useState(false);
|
|
101
|
+
const setAppHeld = useCallback(next => {
|
|
102
|
+
isAppHeldRef.current = next;
|
|
103
|
+
setIsAppHeldState(next);
|
|
104
|
+
}, []);
|
|
105
|
+
|
|
97
106
|
// The last offered element lets a `triggerBehavior` change rewire it.
|
|
98
107
|
const triggerRef = useRef(null);
|
|
108
|
+
// Every offered trigger, in any mode, so focus leaving ends a pin or an
|
|
109
|
+
// app hold.
|
|
110
|
+
const focusTargetRef = useRef(null);
|
|
99
111
|
const offeredRef = useRef(null);
|
|
100
112
|
// A primitive: re-attaching the same trigger renders nothing.
|
|
101
113
|
const [offeredKind, setOfferedKind] = useState('none');
|
|
@@ -106,6 +118,13 @@ export function usePressPin(options) {
|
|
|
106
118
|
// a pinned layer through the pin, so the pin drops with it.
|
|
107
119
|
const hideFromTouch = useCallback(() => {
|
|
108
120
|
const current = optionsRef.current;
|
|
121
|
+
if (isAppHeldRef.current) {
|
|
122
|
+
setAppHeld(false);
|
|
123
|
+
if (current.isOpen !== undefined) {
|
|
124
|
+
current.report(false);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
109
128
|
if (current.triggerBehavior === 'toggle' && triggerRef.current != null) {
|
|
110
129
|
if (current.isOpen !== undefined) {
|
|
111
130
|
current.report(false);
|
|
@@ -116,7 +135,7 @@ export function usePressPin(options) {
|
|
|
116
135
|
}
|
|
117
136
|
}
|
|
118
137
|
current.hide();
|
|
119
|
-
}, [setPinned]);
|
|
138
|
+
}, [setPinned, setAppHeld]);
|
|
120
139
|
const {
|
|
121
140
|
isTouchPointerRef,
|
|
122
141
|
isTouchInteraction,
|
|
@@ -138,13 +157,14 @@ export function usePressPin(options) {
|
|
|
138
157
|
const close = useCallback(() => {
|
|
139
158
|
const current = optionsRef.current;
|
|
140
159
|
clearTapOpen();
|
|
160
|
+
setAppHeld(false);
|
|
141
161
|
if (current.isOpen !== undefined) {
|
|
142
162
|
current.report(false);
|
|
143
163
|
return;
|
|
144
164
|
}
|
|
145
165
|
setPinned(false);
|
|
146
166
|
current.hide();
|
|
147
|
-
}, [setPinned, clearTapOpen]);
|
|
167
|
+
}, [setPinned, setAppHeld, clearTapOpen]);
|
|
148
168
|
const announceName = useCallback(() => {
|
|
149
169
|
const current = optionsRef.current;
|
|
150
170
|
const name = current.label?.trim() ?? '';
|
|
@@ -233,6 +253,9 @@ export function usePressPin(options) {
|
|
|
233
253
|
}, [pressFromKey]);
|
|
234
254
|
const isHeldOpen = useCallback(() => {
|
|
235
255
|
const current = optionsRef.current;
|
|
256
|
+
if (isAppHeldRef.current && current.isLayerOpen) {
|
|
257
|
+
return current.isOpen !== false;
|
|
258
|
+
}
|
|
236
259
|
if (current.triggerBehavior !== 'toggle' || triggerRef.current == null) {
|
|
237
260
|
return false;
|
|
238
261
|
}
|
|
@@ -245,7 +268,7 @@ export function usePressPin(options) {
|
|
|
245
268
|
return false;
|
|
246
269
|
}
|
|
247
270
|
const next = event.relatedTarget;
|
|
248
|
-
const trigger =
|
|
271
|
+
const trigger = focusTargetRef.current;
|
|
249
272
|
// Focus that leaves for no element is a press's to decide. The trigger
|
|
250
273
|
// can sit in another document, so the check uses its own window.
|
|
251
274
|
const view = trigger?.ownerDocument.defaultView;
|
|
@@ -260,6 +283,8 @@ export function usePressPin(options) {
|
|
|
260
283
|
return true;
|
|
261
284
|
}, [isHeldOpen, close]);
|
|
262
285
|
const unwire = useCallback(() => {
|
|
286
|
+
focusTargetRef.current?.removeEventListener('focusout', handleFocusLeave);
|
|
287
|
+
focusTargetRef.current = null;
|
|
263
288
|
const previous = triggerRef.current;
|
|
264
289
|
if (previous == null) {
|
|
265
290
|
return;
|
|
@@ -267,7 +292,6 @@ export function usePressPin(options) {
|
|
|
267
292
|
previous.removeEventListener('click', handlePress);
|
|
268
293
|
previous.removeEventListener('keydown', handleKeyDown);
|
|
269
294
|
previous.removeEventListener('keyup', handleKeyUp);
|
|
270
|
-
previous.removeEventListener('focusout', handleFocusLeave);
|
|
271
295
|
const own = ownStateRef.current;
|
|
272
296
|
if (own != null) {
|
|
273
297
|
restoreAttribute(previous, 'aria-expanded', own.expanded);
|
|
@@ -290,10 +314,14 @@ export function usePressPin(options) {
|
|
|
290
314
|
mode: current.triggerBehavior
|
|
291
315
|
};
|
|
292
316
|
unwire();
|
|
293
|
-
if (element == null
|
|
317
|
+
if (element == null) {
|
|
294
318
|
return;
|
|
295
319
|
}
|
|
296
|
-
|
|
320
|
+
// Its own focus-leave listener, in any mode: `focusTrigger="never"`
|
|
321
|
+
// attaches none, and an app hold needs it on any trigger.
|
|
322
|
+
element.addEventListener('focusout', handleFocusLeave);
|
|
323
|
+
focusTargetRef.current = element;
|
|
324
|
+
if (current.triggerBehavior !== 'toggle' || !isPressPinTrigger(element)) {
|
|
297
325
|
return;
|
|
298
326
|
}
|
|
299
327
|
element.addEventListener('click', handlePress);
|
|
@@ -301,8 +329,6 @@ export function usePressPin(options) {
|
|
|
301
329
|
element.addEventListener('keydown', handleKeyDown);
|
|
302
330
|
element.addEventListener('keyup', handleKeyUp);
|
|
303
331
|
}
|
|
304
|
-
// Its own focus-leave listener: `focusTrigger="never"` attaches none.
|
|
305
|
-
element.addEventListener('focusout', handleFocusLeave);
|
|
306
332
|
ownStateRef.current = {
|
|
307
333
|
expanded: element.getAttribute('aria-expanded'),
|
|
308
334
|
controls: element.getAttribute('aria-controls')
|
|
@@ -328,7 +354,28 @@ export function usePressPin(options) {
|
|
|
328
354
|
if (isPinnedRef.current) {
|
|
329
355
|
setPinned(false);
|
|
330
356
|
}
|
|
331
|
-
|
|
357
|
+
if (isAppHeldRef.current) {
|
|
358
|
+
setAppHeld(false);
|
|
359
|
+
}
|
|
360
|
+
}, [setPinned, setAppHeld]);
|
|
361
|
+
const hold = useCallback(() => {
|
|
362
|
+
const current = optionsRef.current;
|
|
363
|
+
if (!current.isEnabled) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
setAppHeld(true);
|
|
367
|
+
armOutsideDismiss();
|
|
368
|
+
announceName();
|
|
369
|
+
if (current.isOpen !== undefined) {
|
|
370
|
+
current.report(true);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
current.show();
|
|
374
|
+
}, [setAppHeld, armOutsideDismiss, announceName]);
|
|
375
|
+
const release = useCallback(() => {
|
|
376
|
+
close();
|
|
377
|
+
}, [close]);
|
|
378
|
+
const isAppHeld = useCallback(() => isAppHeldRef.current, []);
|
|
332
379
|
|
|
333
380
|
// Each path that hides a pinned layer drops the pin itself, so a layer that
|
|
334
381
|
// does not show is never reported expanded.
|
|
@@ -344,12 +391,15 @@ export function usePressPin(options) {
|
|
|
344
391
|
writeAttribute(trigger, 'aria-expanded', isExpanded ? 'true' : 'false');
|
|
345
392
|
writeAttribute(trigger, 'aria-controls', isLayerOpen ? layerId : null);
|
|
346
393
|
});
|
|
347
|
-
const isPinShown = isToggleMode && isWired && isExpanded;
|
|
394
|
+
const isPinShown = isToggleMode && isWired && isExpanded || isAppHeldState && isLayerOpen && isOpen !== false;
|
|
348
395
|
return {
|
|
349
396
|
isToggleTrigger,
|
|
350
397
|
isHeldOpen,
|
|
351
398
|
attach,
|
|
352
399
|
unpin,
|
|
400
|
+
hold,
|
|
401
|
+
release,
|
|
402
|
+
isAppHeld,
|
|
353
403
|
handleFocusLeave,
|
|
354
404
|
isPinShown,
|
|
355
405
|
touch: {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file PowerSearch.tsx
|
|
3
|
-
* @input PowerSearchConfig, filters, onChange
|
|
3
|
+
* @input PowerSearchConfig, filters, onChange; Tokenizer, Field parts, Token,
|
|
4
|
+
* useAdaptivePresentation, and PowerSearchBottomSheet (lazy)
|
|
4
5
|
* @output Structured filter bar with token-based filter management
|
|
5
6
|
* @position Main component; forwards DOM ref and exposes tokenizer control via
|
|
6
|
-
* handleRef
|
|
7
|
+
* handleRef. The experimental `presentation` option swaps the tokenizer
|
|
8
|
+
* field and editor popover for one trigger that opens PowerSearchBottomSheet.
|
|
7
9
|
*
|
|
8
10
|
* SYNC: When modified, update:
|
|
9
11
|
* - /packages/core/src/PowerSearch/index.ts
|
|
12
|
+
* - /packages/core/src/PowerSearch/PowerSearchBottomSheet.tsx (sheet presentation)
|
|
10
13
|
* - /packages/cli/assets/templates/blocks/components/PowerSearch/ (showcase blocks)
|
|
11
14
|
*/
|
|
12
15
|
import React, { type ReactNode } from 'react';
|
|
@@ -112,6 +115,36 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
112
115
|
* Keys are operator value types (e.g. 'string', 'enum', 'date_absolute').
|
|
113
116
|
*/
|
|
114
117
|
components?: PowerSearchComponents;
|
|
118
|
+
/**
|
|
119
|
+
* Experimental options, outside the stable compatibility promise: anything
|
|
120
|
+
* in this object may change or be removed in a patch release. Omit it for
|
|
121
|
+
* the stable behavior.
|
|
122
|
+
* @experimental
|
|
123
|
+
*/
|
|
124
|
+
experimental?: {
|
|
125
|
+
/**
|
|
126
|
+
* How the field presents filter editing.
|
|
127
|
+
* - `'popover'`: the tokenizer field with its typeahead and the editor
|
|
128
|
+
* popover — the stable behavior.
|
|
129
|
+
* - `'bottom-sheet'`: the whole field is one trigger showing display-only
|
|
130
|
+
* filter tokens; it opens a stack of sheets. Filters lists the filters
|
|
131
|
+
* as rows that edit or remove one, with Add filter, Done, and Clear
|
|
132
|
+
* all, which asks first and keeps read-only filters. Add filter opens
|
|
133
|
+
* above it with the fields (or the content search with inline
|
|
134
|
+
* suggestions), and a value step opens above that, stages operator →
|
|
135
|
+
* value, and confirms from its footer. Dismissing a step reveals the
|
|
136
|
+
* one beneath. Suited to compact touch screens, where the editor
|
|
137
|
+
* popover competes with the software keyboard.
|
|
138
|
+
* - `'adaptive'`: the bottom sheet on compact coarse-pointer screens,
|
|
139
|
+
* otherwise the popover — the same resolution Selector uses.
|
|
140
|
+
*
|
|
141
|
+
* In the sheet presentation `menuWidth` and `tokenOverflowBehavior` have
|
|
142
|
+
* no surface to act on and warn in development.
|
|
143
|
+
* @experimental
|
|
144
|
+
* @default 'popover'
|
|
145
|
+
*/
|
|
146
|
+
presentation?: 'popover' | 'bottom-sheet' | 'adaptive';
|
|
147
|
+
};
|
|
115
148
|
}
|
|
116
149
|
/**
|
|
117
150
|
* Structured filter bar where each token represents a filter (field + operator + value).
|
|
@@ -179,7 +212,7 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
179
212
|
* };
|
|
180
213
|
* ```
|
|
181
214
|
*/
|
|
182
|
-
export declare function PowerSearch({ config: configProp, filters, onChange, label: labelFromProps, isLabelHidden, placeholder: placeholderFromProps, hasAutoFocus, hasClear, isReadOnly, isDisabled, disabledMessage, startIcon, onFocus, onBlur, status, statusVariant, menuWidth, maxTokenLength, maxOperatorMenuItems, maxSearchResults, popoverSaveButtonLabel: popoverSaveButtonLabelFromProps, timezoneID, tokenOverflowBehavior, endContent, resultCount, ref, handleRef, size: sizeProp, 'data-testid': testId, xstyle, className, style, components: componentOverrides, }: PowerSearchProps): React.JSX.Element;
|
|
215
|
+
export declare function PowerSearch({ config: configProp, filters, onChange, label: labelFromProps, isLabelHidden, placeholder: placeholderFromProps, hasAutoFocus, hasClear, isReadOnly, isDisabled, disabledMessage, startIcon, onFocus, onBlur, status, statusVariant, menuWidth, maxTokenLength, maxOperatorMenuItems, maxSearchResults, popoverSaveButtonLabel: popoverSaveButtonLabelFromProps, timezoneID, tokenOverflowBehavior, endContent, resultCount, ref, handleRef, size: sizeProp, 'data-testid': testId, xstyle, className, style, components: componentOverrides, experimental, }: PowerSearchProps): React.JSX.Element;
|
|
183
216
|
export declare namespace PowerSearch {
|
|
184
217
|
var displayName: string;
|
|
185
218
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAuC1C,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAIjB,qBAAqB,EACrB,iBAAiB,EAGjB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAQjB,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAyMxE,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,yEAAyE;IACzE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gCAAgC;IAChC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1C,kCAAkC;IAClC,QAAQ,EAAE,CACR,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;IACV,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,C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