@astryxdesign/core 0.7.7-canary.4a8a76e → 0.7.7-canary.4e495ec
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/AppShell/useCloseMobileDrawerOnActivate.d.ts +13 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.js +45 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +79 -9
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +1 -1
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +5 -4
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +2 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +7 -3
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +7 -1
- package/dist/CheckboxList/CheckboxListContext.d.ts +6 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +10 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +5 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +5 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +16 -14
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +15 -11
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +5 -1
- package/dist/Field/PanelSearchInput.d.ts +9 -1
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +3 -1
- package/dist/InfoTip/InfoTip.d.ts +2 -2
- package/dist/InfoTip/InfoTip.js +4 -4
- package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +25 -20
- package/dist/Layer/useBackdropPress.d.ts +27 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -0
- package/dist/Layer/useBackdropPress.js +53 -0
- package/dist/Layer/usePressPin.d.ts +3 -5
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +4 -6
- package/dist/MobileNav/MobileNav.js +0 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +2 -4
- package/dist/Outline/Outline.d.ts +2 -4
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -52
- package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromMarkdown.js +1 -0
- package/dist/Outline/useScrollSpy.js +3 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +134 -179
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +5 -0
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +118 -260
- package/dist/Resizable/resizeGesture.d.ts +91 -0
- package/dist/Resizable/resizeGesture.d.ts.map +1 -0
- package/dist/Resizable/resizeGesture.js +251 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +3 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +115 -8
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +8 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts +357 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +1349 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +70 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +264 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +96 -67
- package/dist/Selector/optionShape.d.ts +24 -0
- package/dist/Selector/optionShape.d.ts.map +1 -0
- package/dist/Selector/optionShape.js +48 -0
- package/dist/Selector/selectableOptionEntries.d.ts +20 -0
- package/dist/Selector/selectableOptionEntries.d.ts.map +1 -0
- package/dist/Selector/selectableOptionEntries.js +38 -0
- package/dist/Selector/utils.d.ts +2 -17
- package/dist/Selector/utils.d.ts.map +1 -1
- package/dist/Selector/utils.js +3 -51
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -9
- package/dist/Switch/switchTouch.d.ts +0 -7
- package/dist/Switch/switchTouch.d.ts.map +1 -1
- package/dist/Switch/switchTouch.js +2 -10
- package/dist/Switch/useSwitchTouch.d.ts +2 -11
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +26 -85
- package/dist/Token/Token.d.ts +2 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +12 -4
- package/dist/Token/TokenNamingContext.d.ts +14 -0
- package/dist/Token/TokenNamingContext.d.ts.map +1 -0
- package/dist/Token/TokenNamingContext.js +23 -0
- package/dist/Tokenizer/Tokenizer.d.ts +46 -59
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +35 -58
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +25 -28
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +157 -54
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +5 -3
- package/dist/Tooltip/Tooltip.d.ts +25 -30
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +24 -5
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +28 -29
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +20 -8
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +4 -7
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +4 -7
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -7
- package/dist/astryx.css +76 -5
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +53 -5
- package/dist/hooks/actionGroupTracker.d.ts +3 -3
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +6 -53
- package/dist/hooks/useHighlightedOptionScroll.d.ts +11 -1
- package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
- package/dist/hooks/useHighlightedOptionScroll.js +112 -11
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +7 -4
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +4 -2
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.js +1 -0
- package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.js +7 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/internal/SheetConfirmation.d.ts +11 -0
- package/dist/internal/SheetConfirmation.d.ts.map +1 -0
- package/dist/internal/SheetConfirmation.js +92 -0
- package/dist/internal/sheetDraft.d.ts +35 -0
- package/dist/internal/sheetDraft.d.ts.map +1 -0
- package/dist/internal/sheetDraft.js +65 -0
- package/dist/internal/touch-sheet.d.ts +21 -0
- package/dist/internal/touch-sheet.d.ts.map +1 -0
- package/dist/internal/touch-sheet.js +19 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts +24 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts.map +1 -0
- package/dist/internal/useDismissSearchOnTouchDrag.js +56 -0
- package/dist/motion/roles.d.ts +7 -1
- package/dist/motion/roles.d.ts.map +1 -1
- package/dist/motion/roles.js +20 -1
- package/dist/motion/uikit/index.d.ts +6 -5
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +6 -5
- package/dist/motion/uikit/segmented.d.ts +55 -0
- package/dist/motion/uikit/segmented.d.ts.map +1 -0
- package/dist/motion/uikit/segmented.js +77 -0
- package/dist/motion/uikit/springs.d.ts +0 -18
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +5 -21
- package/dist/privateAttributes/segmentTitle.stylex.d.ts +5 -0
- package/dist/privateAttributes/segmentTitle.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/segmentTitle.stylex.js +22 -0
- package/dist/utils/browserClickWait.d.ts +35 -0
- package/dist/utils/browserClickWait.d.ts.map +1 -0
- package/dist/utils/browserClickWait.js +123 -0
- package/dist/utils/clickGuard.d.ts +8 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +24 -1
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +8 -8
- package/src/AppShell/useCloseMobileDrawerOnActivate.ts +52 -0
- package/src/BottomSheet/BottomSheet.tsx +95 -10
- package/src/BottomSheet/BottomSheetPanel.tsx +7 -2
- package/src/BottomSheet/bottomSheetStack.ts +8 -4
- package/src/Breadcrumbs/BreadcrumbItem.tsx +13 -3
- package/src/CheckboxList/CheckboxList.doc.mjs +4 -2
- package/src/CheckboxList/CheckboxList.tsx +6 -0
- package/src/CheckboxList/CheckboxListContext.tsx +6 -0
- package/src/CheckboxList/CheckboxListItem.tsx +11 -2
- package/src/DateInput/DateInput.tsx +8 -2
- package/src/DateTimeInput/DateTimeInput.tsx +8 -2
- package/src/Dialog/Dialog.tsx +44 -14
- package/src/Drawer/Drawer.tsx +28 -11
- package/src/Drawer/useDrawerDialogPresence.ts +5 -1
- package/src/Field/PanelSearchInput.tsx +11 -0
- package/src/InfoTip/InfoTip.doc.mjs +3 -3
- package/src/InfoTip/InfoTip.tsx +5 -5
- package/src/Layer/layerAnimations.stylex.ts +24 -16
- package/src/Layer/useBackdropPress.ts +81 -0
- package/src/Layer/usePressPin.ts +5 -11
- package/src/MobileNav/MobileNav.tsx +1 -1
- package/src/MultiSelector/hooks.ts +2 -4
- package/src/Outline/Outline.doc.mjs +177 -51
- package/src/Outline/Outline.tsx +5 -57
- package/src/Outline/useOutlineFromMarkdown.doc.mjs +157 -0
- package/src/Outline/useOutlineFromMarkdown.ts +1 -0
- package/src/Outline/useScrollSpy.ts +3 -3
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/PowerSearch/PowerSearch.tsx +196 -183
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioList.tsx +4 -0
- package/src/Resizable/ResizeHandle.tsx +133 -328
- package/src/Resizable/resizeGesture.ts +368 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +3 -3
- package/src/SegmentedControl/SegmentedControl.tsx +179 -5
- package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +12 -1
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +1637 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +308 -0
- package/src/Selector/Selector.tsx +136 -89
- package/src/Selector/optionShape.ts +64 -0
- package/src/Selector/selectableOptionEntries.ts +39 -0
- package/src/Selector/utils.ts +9 -68
- package/src/SideNav/SideNavItem.tsx +3 -7
- package/src/Switch/switchTouch.ts +2 -10
- package/src/Switch/useSwitchTouch.ts +26 -96
- package/src/Token/Token.tsx +13 -4
- package/src/Token/TokenNamingContext.ts +28 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Tokenizer/Tokenizer.tsx +81 -86
- package/src/Tokenizer/TokenizerBottomSheet.tsx +219 -93
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +5 -3
- package/src/Tooltip/Tooltip.doc.mjs +123 -54
- package/src/Tooltip/Tooltip.tsx +36 -39
- package/src/Tooltip/index.ts +0 -1
- package/src/Tooltip/useTooltip.doc.mjs +147 -33
- package/src/Tooltip/useTooltip.tsx +39 -32
- package/src/TopNav/TopNavItem.tsx +6 -5
- package/src/TopNav/TopNavMegaMenuItem.tsx +6 -5
- package/src/TopNav/TopNavMenu.tsx +6 -5
- package/src/gestures/GestureHost.ts +73 -4
- package/src/hooks/actionGroupTracker.ts +12 -56
- package/src/hooks/useHighlightedOptionScroll.ts +123 -15
- package/src/hooks/useMediaQuery.doc.mjs +2 -2
- package/src/hooks/useMediaQuery.ts +13 -4
- package/src/hooks/useMenuPress.ts +8 -2
- package/src/i18n/generated-english/PowerSearch/PowerSearch.generated.ts +1 -0
- package/src/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.ts +7 -1
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/internal/SheetConfirmation.tsx +101 -0
- package/src/internal/sheetDraft.ts +80 -0
- package/src/internal/touch-sheet.ts +21 -0
- package/src/internal/useDismissSearchOnTouchDrag.ts +69 -0
- package/src/motion/MEASUREMENTS.md +7 -0
- package/src/motion/README.md +1 -0
- package/src/motion/roles.ts +20 -1
- package/src/motion/uikit/index.ts +5 -5
- package/src/motion/uikit/segmented.ts +74 -0
- package/src/motion/uikit/springs.ts +5 -21
- package/src/privateAttributes/segmentTitle.stylex.ts +22 -0
- package/src/utils/browserClickWait.ts +133 -0
- package/src/utils/clickGuard.ts +37 -1
- package/dist/internal/tokenizer-presentation.d.ts +0 -21
- package/dist/internal/tokenizer-presentation.d.ts.map +0 -1
- package/dist/internal/tokenizer-presentation.js +0 -21
- package/src/internal/tokenizer-presentation.ts +0 -25
package/dist/Outline/Outline.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Outline.tsx
|
|
7
|
-
* @input Uses React, StyleX, Astryx link provider integration, Outline hooks/types
|
|
7
|
+
* @input Uses React, StyleX, Astryx link provider integration, Outline hooks/types
|
|
8
8
|
* @output Exports Outline component and OutlineProps type
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - Sliding indicator track (vertical divider + animated active bar)
|
|
13
13
|
* - Density variant (default/compact)
|
|
14
14
|
* - Scroll-spy active state when uncontrolled
|
|
15
|
-
* -
|
|
15
|
+
* - Each link in the normal Tab order (Enter/Space activate)
|
|
16
16
|
* - onNavigateStart / onNavigateEnd callbacks around the smooth scroll
|
|
17
17
|
* - Scroll scoping (offset, scrollContainerRef, hasScrollOnClick)
|
|
18
18
|
*
|
|
@@ -27,8 +27,6 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
27
27
|
import "../theme/tokens.stylex.js";
|
|
28
28
|
import { colorVars, durationVars, easeVars, radiusVars, spacingVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
29
29
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
30
|
-
import { useListFocus } from "../hooks/useListFocus.js";
|
|
31
|
-
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
32
30
|
import { mergeProps } from "../utils/index.js";
|
|
33
31
|
import { useScrollSpy } from "./useScrollSpy.js";
|
|
34
32
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -172,10 +170,8 @@ function moveFocusTo(id) {
|
|
|
172
170
|
* scroll root) plus the heading's own `scroll-margin-top`. It defaults to the
|
|
173
171
|
* first item at the top and the last at the bottom.
|
|
174
172
|
*
|
|
175
|
-
* Keyboard:
|
|
176
|
-
*
|
|
177
|
-
* and Enter/Space activate — so a long table of contents costs one Tab press,
|
|
178
|
-
* not one per heading.
|
|
173
|
+
* Keyboard: each link is in the normal Tab order, and Enter/Space activate.
|
|
174
|
+
* There is no arrow, Home, or End movement between links.
|
|
179
175
|
*
|
|
180
176
|
* @example
|
|
181
177
|
* ```
|
|
@@ -240,47 +236,6 @@ export function Outline({
|
|
|
240
236
|
onNavigateEnd
|
|
241
237
|
});
|
|
242
238
|
|
|
243
|
-
// Roving tabindex over the links: the whole outline is one tab stop, and
|
|
244
|
-
// arrows move between headings. The hook owns `tabindex` on the items.
|
|
245
|
-
const {
|
|
246
|
-
listRef,
|
|
247
|
-
handleKeyDown: handleListKeyDown,
|
|
248
|
-
handleFocus
|
|
249
|
-
} = useListFocus({
|
|
250
|
-
itemSelector: 'a[href]',
|
|
251
|
-
orientation: 'vertical',
|
|
252
|
-
hasRovingTabIndex: true
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// Seat the tab stop on the *active* heading. WAI-ARIA puts the single tab
|
|
256
|
-
// stop on the current item, so tabbing into a table of contents while
|
|
257
|
-
// reading section 7 lands on section 7 — not back at section 1, which is
|
|
258
|
-
// where useListFocus would otherwise leave it (it promotes the first item on
|
|
259
|
-
// mount and then keeps whichever item already holds the stop).
|
|
260
|
-
//
|
|
261
|
-
// Only while focus is outside the list: once the reader has arrowed to an
|
|
262
|
-
// item, the stop is theirs and scroll-spy must not yank it away. Sets
|
|
263
|
-
// `tabindex` only — it never steals focus. Registered after useListFocus so
|
|
264
|
-
// it runs after the hook's own layout effect and wins; on later commits the
|
|
265
|
-
// hook then finds this item already holding the stop and keeps it.
|
|
266
|
-
useIsomorphicLayoutEffect(() => {
|
|
267
|
-
const list = listRef.current;
|
|
268
|
-
if (list == null || list.contains(document.activeElement)) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const links = Array.from(list.querySelectorAll('a[href]'));
|
|
272
|
-
const active = links.find(link => link.getAttribute('aria-current') === 'location');
|
|
273
|
-
if (active == null) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
for (const link of links) {
|
|
277
|
-
const tabIndex = link === active ? '0' : '-1';
|
|
278
|
-
if (link.getAttribute('tabindex') !== tabIndex) {
|
|
279
|
-
link.setAttribute('tabindex', tabIndex);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
|
|
284
239
|
/**
|
|
285
240
|
* The single navigation path, shared by click and keyboard activation:
|
|
286
241
|
* push the hash, then hand off to the scroll-spy's `scrollTo`, which fires
|
|
@@ -342,10 +297,7 @@ export function Outline({
|
|
|
342
297
|
...{
|
|
343
298
|
className: "x78zum5 xdt5ytf x1lsbc85 x1ghz6dp x1717udv xe8uvvx x98rzlu xeuugli"
|
|
344
299
|
},
|
|
345
|
-
ref: listRef,
|
|
346
300
|
role: "list",
|
|
347
|
-
onKeyDown: handleListKeyDown,
|
|
348
|
-
onFocus: handleFocus,
|
|
349
301
|
children: items.map(item => {
|
|
350
302
|
const isActive = item.id === resolvedActiveId;
|
|
351
303
|
return /*#__PURE__*/_jsx("li", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOutlineFromMarkdown.d.ts","sourceRoot":"","sources":["../../src/Outline/useOutlineFromMarkdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOutlineFromMarkdown.d.ts","sourceRoot":"","sources":["../../src/Outline/useOutlineFromMarkdown.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC,uDAAuD;AACvD,wBAAgB,sBAAsB,CACpC,IAAI,SAAS,qBAAqB,GAAG,KAAK,EAE1C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,+BAA+B,CAAC,IAAI,CAAC,GAC9C,WAAW,EAAE,CAWf"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/Outline/Outline.doc.mjs
|
|
13
|
+
* - /packages/core/src/Outline/useOutlineFromMarkdown.doc.mjs
|
|
13
14
|
* - /packages/core/src/Outline/index.ts
|
|
14
15
|
*/
|
|
15
16
|
import { useMemo } from 'react';
|
|
@@ -302,9 +302,9 @@ export function useScrollSpy({
|
|
|
302
302
|
const onSettle = () => finish(true);
|
|
303
303
|
const onManual = () => finish(false);
|
|
304
304
|
const onKeyDown = event => {
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
305
|
+
// The outline prevents the Space key that activates a link. The
|
|
306
|
+
// browser then does not scroll. So this key is not a manual scroll, and
|
|
307
|
+
// it does not end the navigation.
|
|
308
308
|
if (!event.defaultPrevented && SCROLL_KEYS.has(event.key)) {
|
|
309
309
|
finish(false);
|
|
310
310
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAOZ,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;
|
|
1
|
+
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAOZ,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;AAwB1C,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAIjB,qBAAqB,EACrB,iBAAiB,EAIjB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AA4MxE,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,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E,KAAK,CAAC,SAAS,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,6BAA6B;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACzC;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,EACR,KAAK,EAAE,cAAc,EACrB,aAAoB,EACpB,WAAW,EAAE,oBAAoB,EACjC,YAAoB,EACpB,QAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAA0B,EAC1B,SAAS,EACT,cAAmB,EACnB,oBAAoB,EACpB,gBAA6C,EAC7C,sBAAsB,EAAE,+BAA+B,EACvD,UAAU,EACV,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,GAAG,EACH,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EAAE,kBAAkB,GAC/B,EAAE,gBAAgB,qBA8oBlB;yBAhrBe,WAAW"}
|
|
@@ -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,
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
149
|
-
...{
|
|
150
|
-
className: "x1lvx875"
|
|
151
|
-
},
|
|
152
|
-
children: [items.length, " items"]
|
|
153
|
-
});
|
|
124
|
+
return `${items.length} items`;
|
|
154
125
|
}
|
|
155
|
-
return
|
|
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
|
|
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
|
|
181
|
-
...{
|
|
182
|
-
className: "x1lvx875"
|
|
183
|
-
},
|
|
184
|
-
children: [labels.length, " items"]
|
|
185
|
-
});
|
|
141
|
+
return `${labels.length} items`;
|
|
186
142
|
}
|
|
187
|
-
return
|
|
188
|
-
...{
|
|
189
|
-
className: "x1lvx875"
|
|
190
|
-
},
|
|
191
|
-
children: labels.join(', ')
|
|
192
|
-
});
|
|
143
|
+
return labels.join(', ');
|
|
193
144
|
}
|
|
194
145
|
if (items.length === 1) {
|
|
195
|
-
return
|
|
196
|
-
...{
|
|
197
|
-
className: "x1lvx875"
|
|
198
|
-
},
|
|
199
|
-
children: truncateString(items[0], maxLength)
|
|
200
|
-
});
|
|
146
|
+
return truncateString(items[0], maxLength);
|
|
201
147
|
}
|
|
202
|
-
return
|
|
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
|
|
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
|
|
226
|
-
...{
|
|
227
|
-
className: "x1lvx875"
|
|
228
|
-
},
|
|
229
|
-
children: [entities.length, " items"]
|
|
230
|
-
});
|
|
161
|
+
return `${entities.length} items`;
|
|
231
162
|
}
|
|
232
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
//
|
|
438
|
-
// stays on the tokenizer input, so a
|
|
439
|
-
|
|
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'
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
onChange(
|
|
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
|
|
546
|
-
// locks every token of a read-only
|
|
547
|
-
|
|
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
|
|
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
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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,
|
|
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
|
|
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,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,GAAG,IAAI,CAAC;AAExC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,6CAE5B,CAAC;AAiBF,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,mBAAmB,CAAC,cAAc,CAAC,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
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":"
|
|
1
|
+
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/Resizable/ResizeHandle.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAkBxB,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AA0NzD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,SAAS,CAAC,cAAc,CAAC,EACzB,OAAO,CACR;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAEtC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEhC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG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