@astryxdesign/core 0.7.7-canary.fc68123 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -4
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +6 -36
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +4 -23
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +1 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +1 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -13
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -4
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +4 -14
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +31 -7
- package/dist/Field/Field.js +2 -2
- package/dist/HoverCard/HoverCard.d.ts +3 -4
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -27
- package/dist/HoverCard/useHoverCard.d.ts +4 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +31 -17
- package/dist/Icon/Icon.d.ts +1 -5
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +2 -5
- package/dist/Layer/usePressPin.d.ts +5 -17
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +12 -62
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +0 -18
- package/dist/PowerSearch/PowerSearch.d.ts +3 -36
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +127 -433
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -32
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +6 -17
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +3 -38
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +61 -170
- package/dist/PowerSearch/formatFilterValue.d.ts +0 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +1 -11
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +2 -3
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +3 -5
- package/dist/Resizable/ResizeHandle.d.ts +1 -2
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +77 -99
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +58 -60
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -29
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +7 -10
- package/dist/Toast/Toast.d.ts +1 -11
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +15 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +34 -94
- package/dist/Toast/types.d.ts +3 -9
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +1 -19
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +53 -34
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -2
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/astryx.css +6 -35
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -4
- package/dist/hooks/actionGroupTracker.d.ts +1 -4
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +3 -13
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- 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/hooks/useLongPress.d.ts +2 -6
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +15 -95
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +0 -30
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +0 -30
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +6 -5
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +18 -41
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +0 -12
- package/dist/utils/focusReturn.d.ts +0 -15
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +0 -28
- package/dist/utils/interactionOverlay.stylex.d.ts +2 -3
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +2 -3
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +6 -19
- package/locales/en.json +0 -120
- package/locales/pseudo.json +0 -90
- package/package.json +5 -10
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +5 -37
- package/src/BottomSheet/BottomSheetPanel.tsx +3 -37
- package/src/BottomSheet/useSheetGestures.ts +1 -3
- package/src/Button/Button.tsx +4 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +0 -18
- package/src/CheckboxInput/CheckboxInput.tsx +9 -36
- package/src/ComplexSelector/ComplexSelector.tsx +5 -20
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/Dialog/Dialog.tsx +31 -10
- package/src/Field/Field.tsx +2 -2
- package/src/HoverCard/HoverCard.doc.mjs +2 -4
- package/src/HoverCard/HoverCard.tsx +4 -35
- package/src/HoverCard/useHoverCard.doc.mjs +36 -178
- package/src/HoverCard/useHoverCard.tsx +52 -46
- package/src/Icon/Icon.doc.mjs +8 -49
- package/src/Icon/Icon.tsx +7 -15
- package/src/Layer/usePressPin.ts +15 -81
- package/src/Lightbox/Lightbox.tsx +0 -18
- package/src/PowerSearch/PowerSearch.doc.mjs +5 -54
- package/src/PowerSearch/PowerSearch.tsx +155 -609
- package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -28
- package/src/PowerSearch/PowerSearchValueEditor.tsx +38 -203
- package/src/PowerSearch/formatFilterValue.ts +1 -18
- package/src/RadioList/RadioList.tsx +2 -3
- package/src/RadioList/RadioListItem.tsx +3 -5
- package/src/Resizable/Resizable.doc.mjs +4 -5
- package/src/Resizable/ResizeHandle.tsx +109 -167
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -6
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +63 -77
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +12 -46
- package/src/TextInput/TextInput.tsx +10 -11
- package/src/Toast/Toast.doc.mjs +3 -4
- package/src/Toast/Toast.tsx +32 -52
- package/src/Toast/ToastViewport.tsx +35 -121
- package/src/Toast/types.ts +3 -9
- package/src/Tooltip/useTooltip.doc.mjs +0 -24
- package/src/Tooltip/useTooltip.tsx +56 -61
- package/src/Typeahead/TypeaheadItem.doc.mjs +3 -6
- package/src/Typeahead/TypeaheadItem.tsx +1 -2
- package/src/gestures/PressTracker.ts +3 -4
- package/src/gestures/README.md +1 -7
- package/src/hooks/actionGroupTracker.ts +5 -20
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useInputStatusIcon.tsx +2 -3
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +15 -136
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-locales/en.generated.ts +0 -41
- package/src/i18n/generated-locales/pseudo.generated.ts +0 -42
- package/src/index.ts +0 -13
- package/src/motion/README.md +5 -9
- package/src/motion/animatedLayout.ts +4 -5
- package/src/motion/animator.ts +29 -61
- package/src/utils/dateParser.ts +0 -16
- package/src/utils/focusReturn.ts +0 -30
- package/src/utils/interactionOverlay.stylex.ts +2 -3
- package/src/utils/pressFeedback.ts +6 -19
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +0 -100
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +0 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +0 -1913
- package/dist/PowerSearch/formatTokenValue.d.ts +0 -28
- package/dist/PowerSearch/formatTokenValue.d.ts.map +0 -1
- package/dist/PowerSearch/formatTokenValue.js +0 -160
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +0 -65
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +0 -1
- package/dist/PowerSearch/powerSearchSheetUtils.js +0 -168
- package/dist/animator/createAnimator.d.ts +0 -98
- package/dist/animator/createAnimator.d.ts.map +0 -1
- package/dist/animator/createAnimator.js +0 -259
- package/dist/hooks/pressGroupContext.d.ts +0 -6
- package/dist/hooks/pressGroupContext.d.ts.map +0 -1
- package/dist/hooks/pressGroupContext.js +0 -20
- package/dist/hooks/useActionGroupTracking.d.ts +0 -53
- package/dist/hooks/useActionGroupTracking.d.ts.map +0 -1
- package/dist/hooks/useActionGroupTracking.js +0 -174
- package/dist/hooks/useAnimator.d.ts +0 -41
- package/dist/hooks/useAnimator.d.ts.map +0 -1
- package/dist/hooks/useAnimator.js +0 -70
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +0 -42
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +0 -14
- package/dist/internal/indicatorPress.stylex.d.ts +0 -20
- package/dist/internal/indicatorPress.stylex.d.ts.map +0 -1
- package/dist/internal/indicatorPress.stylex.js +0 -26
- package/dist/motion/progress.d.ts +0 -88
- package/dist/motion/progress.d.ts.map +0 -1
- package/dist/motion/progress.js +0 -128
- package/dist/motion/uikit/alert.d.ts +0 -41
- package/dist/motion/uikit/alert.d.ts.map +0 -1
- package/dist/motion/uikit/alert.js +0 -43
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +0 -15
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +0 -1
- package/dist/privateAttributes/pressGroupItem.stylex.js +0 -23
- package/dist/utils/triggerFocus.d.ts +0 -36
- package/dist/utils/triggerFocus.d.ts.map +0 -1
- package/dist/utils/triggerFocus.js +0 -65
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +0 -2515
- package/src/PowerSearch/formatTokenValue.ts +0 -215
- package/src/PowerSearch/powerSearchSheetUtils.ts +0 -224
- package/src/animator/createAnimator.doc.mjs +0 -153
- package/src/animator/createAnimator.ts +0 -324
- package/src/hooks/pressGroupContext.ts +0 -21
- package/src/hooks/useActionGroupTracking.ts +0 -224
- package/src/hooks/useAnimator.doc.mjs +0 -109
- package/src/hooks/useAnimator.ts +0 -67
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +0 -43
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +0 -15
- package/src/internal/indicatorPress.stylex.ts +0 -24
- package/src/motion/progress.ts +0 -155
- package/src/motion/uikit/alert.ts +0 -43
- package/src/privateAttributes/pressGroupItem.stylex.ts +0 -23
- package/src/utils/triggerFocus.ts +0 -80
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file PowerSearchEditPopover.tsx
|
|
3
3
|
* @input InternalConfig, PartialFilter
|
|
4
|
-
* @output Edit popover content with field/operator selectors and value editor
|
|
5
|
-
* the built-in NestedEditor the sheet presentation's value step shares
|
|
4
|
+
* @output Edit popover content with field/operator selectors and value editor
|
|
6
5
|
* @position Sub-component; consumed by PowerSearch
|
|
7
6
|
*
|
|
8
7
|
* SYNC: When modified, update:
|
|
9
8
|
* - /packages/core/src/PowerSearch/index.ts
|
|
10
9
|
*/
|
|
11
10
|
import React from 'react';
|
|
12
|
-
import * as stylex from '@stylexjs/stylex';
|
|
13
11
|
import type { InternalConfig } from './useInternalConfig.js';
|
|
14
12
|
import type { PowerSearchFilter, PartialFilter } from './types.js';
|
|
15
13
|
export interface PowerSearchEditPopoverProps {
|
|
@@ -29,34 +27,5 @@ export interface PowerSearchEditPopoverProps {
|
|
|
29
27
|
/** Whether the filter is read-only. */
|
|
30
28
|
isReadOnly?: boolean;
|
|
31
29
|
}
|
|
32
|
-
export interface NestedEditorProps {
|
|
33
|
-
config: InternalConfig;
|
|
34
|
-
partialFilter: PartialFilter;
|
|
35
|
-
operatorOptions: {
|
|
36
|
-
value: string;
|
|
37
|
-
label: string;
|
|
38
|
-
}[];
|
|
39
|
-
onOperatorChange: (operatorKey: string) => void;
|
|
40
|
-
onPartialFilterChange: (filter: PartialFilter) => void;
|
|
41
|
-
maxMenuItems?: number;
|
|
42
|
-
isReadOnly: boolean;
|
|
43
|
-
/** Styles for the editor's tree root (the sheet makes it a query container). */
|
|
44
|
-
xstyle?: stylex.StyleXStyles;
|
|
45
|
-
/**
|
|
46
|
-
* Whether the tree root offers the group-operator picker when the field has
|
|
47
|
-
* several operators. The popover shows it; the sheet presentation's value
|
|
48
|
-
* step owns the operator choice in its own Operator group and hides it.
|
|
49
|
-
* @default true
|
|
50
|
-
*/
|
|
51
|
-
hasRootOperatorPicker?: boolean;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The built-in editor for a `nested` value: a tree of sub-filters with Add,
|
|
55
|
-
* field/operator/value rows and removal. The popover renders it below its
|
|
56
|
-
* field selector; the sheet presentation's value step renders the same editor
|
|
57
|
-
* in its body, so a `nested` filter is created
|
|
58
|
-
* and edited the same way in both presentations.
|
|
59
|
-
*/
|
|
60
|
-
export declare function NestedEditor({ config, partialFilter, operatorOptions, onOperatorChange, onPartialFilterChange, maxMenuItems, isReadOnly, xstyle, hasRootOperatorPicker, }: NestedEditorProps): React.JSX.Element;
|
|
61
30
|
export declare function PowerSearchEditPopover({ config, filter: initialFilter, mode, onSave, onCancel, saveButtonLabel: saveButtonLabelFromProps, maxMenuItems, isReadOnly, }: PowerSearchEditPopoverProps): React.JSX.Element;
|
|
62
31
|
//# sourceMappingURL=PowerSearchEditPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchEditPopover.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchEditPopover.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"PowerSearchEditPopover.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchEditPopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAA0D,MAAM,OAAO,CAAC;AAc/E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EAId,MAAM,SAAS,CAAC;AAsEjB,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,uCAAuC;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,qDAAqD;IACrD,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,wDAAwD;IACxD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA0hBD,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,MAAM,EAAE,aAAa,EACrB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,eAAe,EAAE,wBAAwB,EACzC,YAAY,EACZ,UAAkB,GACnB,EAAE,2BAA2B,qBAsS7B"}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file PowerSearchEditPopover.tsx
|
|
7
7
|
* @input InternalConfig, PartialFilter
|
|
8
|
-
* @output Edit popover content with field/operator selectors and value editor
|
|
9
|
-
* the built-in NestedEditor the sheet presentation's value step shares
|
|
8
|
+
* @output Edit popover content with field/operator selectors and value editor
|
|
10
9
|
* @position Sub-component; consumed by PowerSearch
|
|
11
10
|
*
|
|
12
11
|
* SYNC: When modified, update:
|
|
@@ -242,23 +241,14 @@ function NestedSubFilterRow({
|
|
|
242
241
|
// Nested editor
|
|
243
242
|
// =============================================================================
|
|
244
243
|
|
|
245
|
-
|
|
246
|
-
* The built-in editor for a `nested` value: a tree of sub-filters with Add,
|
|
247
|
-
* field/operator/value rows and removal. The popover renders it below its
|
|
248
|
-
* field selector; the sheet presentation's value step renders the same editor
|
|
249
|
-
* in its body, so a `nested` filter is created
|
|
250
|
-
* and edited the same way in both presentations.
|
|
251
|
-
*/
|
|
252
|
-
export function NestedEditor({
|
|
244
|
+
function NestedEditor({
|
|
253
245
|
config,
|
|
254
246
|
partialFilter,
|
|
255
247
|
operatorOptions,
|
|
256
248
|
onOperatorChange,
|
|
257
249
|
onPartialFilterChange,
|
|
258
250
|
maxMenuItems,
|
|
259
|
-
isReadOnly
|
|
260
|
-
xstyle,
|
|
261
|
-
hasRootOperatorPicker = true
|
|
251
|
+
isReadOnly
|
|
262
252
|
}) {
|
|
263
253
|
const t = useComponentTranslator();
|
|
264
254
|
const [subFilters, setSubFilters] = useState(() => {
|
|
@@ -400,7 +390,7 @@ export function NestedEditor({
|
|
|
400
390
|
...{
|
|
401
391
|
className: "xcr08ib"
|
|
402
392
|
},
|
|
403
|
-
children:
|
|
393
|
+
children: operatorOptions.length > 1 ? /*#__PURE__*/_jsx("div", {
|
|
404
394
|
...{
|
|
405
395
|
className: "x1iyjqo2 x2lah0s x193iq5w"
|
|
406
396
|
},
|
|
@@ -413,7 +403,7 @@ export function NestedEditor({
|
|
|
413
403
|
isDisabled: isReadOnly,
|
|
414
404
|
size: "md"
|
|
415
405
|
})
|
|
416
|
-
}) : operatorOptions
|
|
406
|
+
}) : operatorOptions[0]?.label ?? t('@astryx.powersearch.editor.group')
|
|
417
407
|
});
|
|
418
408
|
const items = [{
|
|
419
409
|
id: 'nested-root',
|
|
@@ -423,8 +413,7 @@ export function NestedEditor({
|
|
|
423
413
|
}];
|
|
424
414
|
return /*#__PURE__*/_jsx(TreeList, {
|
|
425
415
|
items: items,
|
|
426
|
-
density: "balanced"
|
|
427
|
-
xstyle: xstyle
|
|
416
|
+
density: "balanced"
|
|
428
417
|
});
|
|
429
418
|
}
|
|
430
419
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file PowerSearchValueEditor.tsx
|
|
3
|
-
* @input OperatorValue, FilterValue, onChange callback
|
|
4
|
-
* the editor renders in
|
|
3
|
+
* @input OperatorValue, FilterValue, onChange callback
|
|
5
4
|
* @output Renders the appropriate editor for a filter value type
|
|
6
|
-
* @position Sub-component; consumed by PowerSearchEditPopover
|
|
7
|
-
* presentation) and PowerSearchBottomSheet (sheet presentation, which
|
|
8
|
-
* renders the closed vocabularies as rows itself)
|
|
5
|
+
* @position Sub-component; consumed by PowerSearchEditPopover
|
|
9
6
|
*
|
|
10
7
|
* SYNC: When modified, update:
|
|
11
8
|
* - /packages/core/src/PowerSearch/index.ts
|
|
@@ -13,7 +10,6 @@
|
|
|
13
10
|
import React from 'react';
|
|
14
11
|
import type { OperatorValue, FilterValue } from './types.js';
|
|
15
12
|
import type { InternalConfig } from './useInternalConfig.js';
|
|
16
|
-
import type { TranslatorFn } from '../i18n/index.js';
|
|
17
13
|
export interface PowerSearchValueEditorProps {
|
|
18
14
|
operatorValue: OperatorValue;
|
|
19
15
|
filterValue: FilterValue | undefined;
|
|
@@ -24,37 +20,6 @@ export interface PowerSearchValueEditorProps {
|
|
|
24
20
|
maxMenuItems?: number;
|
|
25
21
|
isDisabled?: boolean;
|
|
26
22
|
timezoneID?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Called when a staged value no longer stands — the number input's draft is
|
|
29
|
-
* empty or does not parse — so the sheet presentation's confirm action
|
|
30
|
-
* disables again. Only the `bottom-sheet` presentation stages as typed; the
|
|
31
|
-
* popover commits on blur or Enter and never calls this.
|
|
32
|
-
*/
|
|
33
|
-
onUnstage?: () => void;
|
|
34
|
-
/**
|
|
35
|
-
* Where the editor renders. In the `bottom-sheet` presentation the inputs
|
|
36
|
-
* fill the sheet's width, number inputs stage every parseable keystroke
|
|
37
|
-
* (the sheet's footer confirms; there is no Enter-to-save), the date range
|
|
38
|
-
* shows one month, and list values open the Tokenizer's own sheet titled
|
|
39
|
-
* with `fieldLabel`.
|
|
40
|
-
* @default 'popover'
|
|
41
|
-
*/
|
|
42
|
-
presentation?: 'popover' | 'bottom-sheet';
|
|
43
|
-
/** The field's label; names the Tokenizer sheet in the sheet presentation. */
|
|
44
|
-
fieldLabel?: string;
|
|
45
23
|
}
|
|
46
|
-
|
|
47
|
-
* The relative-date choices an operator offers, in display order. Shared by
|
|
48
|
-
* the popover's Selector and the sheet presentation's rows so both list the
|
|
49
|
-
* same values. With `t` the labels resolve through the catalog's ICU plural
|
|
50
|
-
* messages (the sheet presentation's rows); without it they are the popover
|
|
51
|
-
* editor's own literals. In English the two read identically.
|
|
52
|
-
*/
|
|
53
|
-
export declare function buildRelativeDateOptions(operatorValue: OperatorValue & {
|
|
54
|
-
type: 'date_relative';
|
|
55
|
-
}, t?: TranslatorFn): {
|
|
56
|
-
value: string;
|
|
57
|
-
label: string;
|
|
58
|
-
}[];
|
|
59
|
-
export declare function PowerSearchValueEditor({ operatorValue, filterValue, onChange, onEnter, maxMenuItems, isDisabled, onUnstage, presentation, fieldLabel, }: PowerSearchValueEditorProps): React.JSX.Element | null;
|
|
24
|
+
export declare function PowerSearchValueEditor({ operatorValue, filterValue, onChange, onEnter, maxMenuItems, isDisabled, }: PowerSearchValueEditorProps): React.JSX.Element | null;
|
|
60
25
|
//# sourceMappingURL=PowerSearchValueEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchValueEditor.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchValueEditor.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"PowerSearchValueEditor.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchValueEditor.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAIZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AA4BxD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA4rBD,wBAAgB,sBAAsB,CAAC,EACrC,aAAa,EACb,WAAW,EACX,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,GACX,EAAE,2BAA2B,4BA0I7B"}
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file PowerSearchValueEditor.tsx
|
|
7
|
-
* @input OperatorValue, FilterValue, onChange callback
|
|
8
|
-
* the editor renders in
|
|
7
|
+
* @input OperatorValue, FilterValue, onChange callback
|
|
9
8
|
* @output Renders the appropriate editor for a filter value type
|
|
10
|
-
* @position Sub-component; consumed by PowerSearchEditPopover
|
|
11
|
-
* presentation) and PowerSearchBottomSheet (sheet presentation, which
|
|
12
|
-
* renders the closed vocabularies as rows itself)
|
|
9
|
+
* @position Sub-component; consumed by PowerSearchEditPopover
|
|
13
10
|
*
|
|
14
11
|
* SYNC: When modified, update:
|
|
15
12
|
* - /packages/core/src/PowerSearch/index.ts
|
|
@@ -24,7 +21,7 @@ import { DateRangeInput } from "../DateRangeInput/index.js";
|
|
|
24
21
|
import { resolveDateTimeRangePart } from "./resolveDateTimeRangePart.js";
|
|
25
22
|
import { TimeInput } from "../TimeInput/index.js";
|
|
26
23
|
import { Selector } from "../Selector/index.js";
|
|
27
|
-
import { Tokenizer } from "../Tokenizer/
|
|
24
|
+
import { Tokenizer } from "../Tokenizer/index.js";
|
|
28
25
|
import { Typeahead } from "../Typeahead/index.js";
|
|
29
26
|
import { useLocale } from "../i18n/index.js";
|
|
30
27
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -66,11 +63,9 @@ function StringEditor({
|
|
|
66
63
|
onChange,
|
|
67
64
|
onEnter: _onEnter,
|
|
68
65
|
maxMenuItems,
|
|
69
|
-
isDisabled
|
|
70
|
-
presentation
|
|
66
|
+
isDisabled
|
|
71
67
|
}) {
|
|
72
68
|
const t = useComponentTranslator();
|
|
73
|
-
const width = presentation === 'bottom-sheet' ? '100%' : undefined;
|
|
74
69
|
const currentValue = filterValue?.type === 'string' ? filterValue.value : '';
|
|
75
70
|
|
|
76
71
|
// When a searchSource is provided, render a typeahead instead of a plain
|
|
@@ -101,8 +96,7 @@ function StringEditor({
|
|
|
101
96
|
},
|
|
102
97
|
placeholder: t('@astryx.powersearch.valueEditor.searchPlaceholder'),
|
|
103
98
|
debounceMs: 150,
|
|
104
|
-
maxMenuItems: maxMenuItems
|
|
105
|
-
width: width
|
|
99
|
+
maxMenuItems: maxMenuItems
|
|
106
100
|
});
|
|
107
101
|
}
|
|
108
102
|
return /*#__PURE__*/_jsx(TextInput, {
|
|
@@ -116,8 +110,7 @@ function StringEditor({
|
|
|
116
110
|
type: 'string',
|
|
117
111
|
value
|
|
118
112
|
});
|
|
119
|
-
}
|
|
120
|
-
width: width
|
|
113
|
+
}
|
|
121
114
|
});
|
|
122
115
|
}
|
|
123
116
|
function StringListEditor({
|
|
@@ -125,12 +118,9 @@ function StringListEditor({
|
|
|
125
118
|
filterValue,
|
|
126
119
|
onChange,
|
|
127
120
|
maxMenuItems,
|
|
128
|
-
isDisabled
|
|
129
|
-
presentation,
|
|
130
|
-
fieldLabel
|
|
121
|
+
isDisabled
|
|
131
122
|
}) {
|
|
132
123
|
const t = useComponentTranslator();
|
|
133
|
-
const isSheet = presentation === 'bottom-sheet';
|
|
134
124
|
const currentValue = useMemo(() => {
|
|
135
125
|
if (filterValue?.type !== 'string_list') {
|
|
136
126
|
return [];
|
|
@@ -154,12 +144,8 @@ function StringListEditor({
|
|
|
154
144
|
// Enable creatable mode when no searchSource is provided (free-text tags)
|
|
155
145
|
// or when isArbitraryStringAllowed is explicitly set (#1107).
|
|
156
146
|
const hasCreate = operatorValue.isArbitraryStringAllowed || !operatorValue.searchSource;
|
|
157
|
-
|
|
158
|
-
// In the sheet presentation the list value edits through the Tokenizer's
|
|
159
|
-
// own sheet, titled with the field's label; a popover menu inside a sheet
|
|
160
|
-
// would stack a second anchored layer on a surface the person is already in.
|
|
161
147
|
return /*#__PURE__*/_jsx(Tokenizer, {
|
|
162
|
-
label:
|
|
148
|
+
label: t('@astryx.powersearch.valueEditor.values'),
|
|
163
149
|
isLabelHidden: true,
|
|
164
150
|
isDisabled: isDisabled,
|
|
165
151
|
searchSource: source,
|
|
@@ -173,11 +159,7 @@ function StringListEditor({
|
|
|
173
159
|
placeholder: t('@astryx.powersearch.valueEditor.addValuesPlaceholder'),
|
|
174
160
|
debounceMs: operatorValue.searchSource ? 150 : 0,
|
|
175
161
|
hasCreate: hasCreate,
|
|
176
|
-
maxMenuItems: maxMenuItems
|
|
177
|
-
width: isSheet ? '100%' : undefined,
|
|
178
|
-
experimental: isSheet ? {
|
|
179
|
-
presentation: 'bottom-sheet'
|
|
180
|
-
} : undefined
|
|
162
|
+
maxMenuItems: maxMenuItems
|
|
181
163
|
});
|
|
182
164
|
}
|
|
183
165
|
function useNumberEditorHandlers({
|
|
@@ -186,9 +168,7 @@ function useNumberEditorHandlers({
|
|
|
186
168
|
max,
|
|
187
169
|
isIntegerOnly,
|
|
188
170
|
onChange,
|
|
189
|
-
onEnter
|
|
190
|
-
onUnstage,
|
|
191
|
-
stagesAsTyped
|
|
171
|
+
onEnter
|
|
192
172
|
}) {
|
|
193
173
|
const locale = useLocale();
|
|
194
174
|
const pendingDecisionRef = useRef(null);
|
|
@@ -206,23 +186,14 @@ function useNumberEditorHandlers({
|
|
|
206
186
|
pendingDecisionRef.current = null;
|
|
207
187
|
}, []);
|
|
208
188
|
const handleInput = useCallback(event => {
|
|
209
|
-
|
|
189
|
+
pendingDecisionRef.current = resolveNumberInputCommit(event.currentTarget.value, {
|
|
210
190
|
min,
|
|
211
191
|
max,
|
|
212
192
|
isIntegerOnly,
|
|
213
193
|
locale,
|
|
214
194
|
hasClear: false
|
|
215
195
|
});
|
|
216
|
-
|
|
217
|
-
if (stagesAsTyped) {
|
|
218
|
-
if (decision.type === 'commit') {
|
|
219
|
-
onChange(toFilterValue(decision.value));
|
|
220
|
-
} else {
|
|
221
|
-
// Cleared, or not a number: nothing stands to confirm.
|
|
222
|
-
onUnstage?.();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, [isIntegerOnly, locale, max, min, onChange, onUnstage, stagesAsTyped, toFilterValue]);
|
|
196
|
+
}, [isIntegerOnly, locale, max, min]);
|
|
226
197
|
const handleEnter = useCallback(() => {
|
|
227
198
|
const decision = pendingDecisionRef.current;
|
|
228
199
|
pendingDecisionRef.current = null;
|
|
@@ -250,9 +221,7 @@ function IntegerEditor({
|
|
|
250
221
|
filterValue,
|
|
251
222
|
onChange,
|
|
252
223
|
onEnter,
|
|
253
|
-
|
|
254
|
-
isDisabled,
|
|
255
|
-
presentation
|
|
224
|
+
isDisabled
|
|
256
225
|
}) {
|
|
257
226
|
const t = useComponentTranslator();
|
|
258
227
|
const currentValue = filterValue?.type === 'integer' ? filterValue.value : undefined;
|
|
@@ -262,9 +231,7 @@ function IntegerEditor({
|
|
|
262
231
|
max: operatorValue.maxValue,
|
|
263
232
|
isIntegerOnly: true,
|
|
264
233
|
onChange,
|
|
265
|
-
onEnter
|
|
266
|
-
onUnstage,
|
|
267
|
-
stagesAsTyped: presentation === 'bottom-sheet'
|
|
234
|
+
onEnter
|
|
268
235
|
});
|
|
269
236
|
return /*#__PURE__*/_jsx(NumberInput, {
|
|
270
237
|
label: t('@astryx.powersearch.valueEditor.value'),
|
|
@@ -280,8 +247,7 @@ function IntegerEditor({
|
|
|
280
247
|
max: operatorValue.maxValue,
|
|
281
248
|
units: operatorValue.units,
|
|
282
249
|
isIntegerOnly: true,
|
|
283
|
-
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
284
|
-
width: presentation === 'bottom-sheet' ? '100%' : undefined
|
|
250
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
285
251
|
});
|
|
286
252
|
}
|
|
287
253
|
function FloatEditor({
|
|
@@ -289,9 +255,7 @@ function FloatEditor({
|
|
|
289
255
|
filterValue,
|
|
290
256
|
onChange,
|
|
291
257
|
onEnter,
|
|
292
|
-
|
|
293
|
-
isDisabled,
|
|
294
|
-
presentation
|
|
258
|
+
isDisabled
|
|
295
259
|
}) {
|
|
296
260
|
const t = useComponentTranslator();
|
|
297
261
|
const currentValue = filterValue?.type === 'float' ? filterValue.value : undefined;
|
|
@@ -301,9 +265,7 @@ function FloatEditor({
|
|
|
301
265
|
max: operatorValue.maxValue,
|
|
302
266
|
isIntegerOnly: false,
|
|
303
267
|
onChange,
|
|
304
|
-
onEnter
|
|
305
|
-
onUnstage,
|
|
306
|
-
stagesAsTyped: presentation === 'bottom-sheet'
|
|
268
|
+
onEnter
|
|
307
269
|
});
|
|
308
270
|
return /*#__PURE__*/_jsx(NumberInput, {
|
|
309
271
|
label: t('@astryx.powersearch.valueEditor.value'),
|
|
@@ -318,16 +280,14 @@ function FloatEditor({
|
|
|
318
280
|
min: operatorValue.minValue,
|
|
319
281
|
max: operatorValue.maxValue,
|
|
320
282
|
units: operatorValue.units,
|
|
321
|
-
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
322
|
-
width: presentation === 'bottom-sheet' ? '100%' : undefined
|
|
283
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
323
284
|
});
|
|
324
285
|
}
|
|
325
286
|
function TimeEditor({
|
|
326
287
|
operatorValue,
|
|
327
288
|
filterValue,
|
|
328
289
|
onChange,
|
|
329
|
-
isDisabled
|
|
330
|
-
presentation
|
|
290
|
+
isDisabled
|
|
331
291
|
}) {
|
|
332
292
|
const t = useComponentTranslator();
|
|
333
293
|
const currentValue = filterValue?.type === 'time' ? filterValue.value : undefined;
|
|
@@ -345,15 +305,13 @@ function TimeEditor({
|
|
|
345
305
|
}
|
|
346
306
|
},
|
|
347
307
|
min: operatorValue.minValue,
|
|
348
|
-
max: operatorValue.maxValue
|
|
349
|
-
width: presentation === 'bottom-sheet' ? '100%' : undefined
|
|
308
|
+
max: operatorValue.maxValue
|
|
350
309
|
});
|
|
351
310
|
}
|
|
352
311
|
function DateAbsoluteEditor({
|
|
353
312
|
filterValue,
|
|
354
313
|
onChange,
|
|
355
|
-
isDisabled
|
|
356
|
-
presentation
|
|
314
|
+
isDisabled
|
|
357
315
|
}) {
|
|
358
316
|
const t = useComponentTranslator();
|
|
359
317
|
// Convert unixSeconds to ISO date string for the date input
|
|
@@ -377,67 +335,8 @@ function DateAbsoluteEditor({
|
|
|
377
335
|
unixSeconds
|
|
378
336
|
});
|
|
379
337
|
}
|
|
380
|
-
},
|
|
381
|
-
width: presentation === 'bottom-sheet' ? '100%' : undefined
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
const RELATIVE_DATE_UNITS = [{
|
|
385
|
-
unit: 'day',
|
|
386
|
-
plural: 'days',
|
|
387
|
-
amounts: [1, 3, 7, 14, 30],
|
|
388
|
-
ago: '@astryx.powersearch.sheet.relativeDaysAgo',
|
|
389
|
-
fromNow: '@astryx.powersearch.sheet.relativeDaysFromNow'
|
|
390
|
-
}, {
|
|
391
|
-
unit: 'week',
|
|
392
|
-
plural: 'weeks',
|
|
393
|
-
amounts: [1, 2, 4],
|
|
394
|
-
ago: '@astryx.powersearch.sheet.relativeWeeksAgo',
|
|
395
|
-
fromNow: '@astryx.powersearch.sheet.relativeWeeksFromNow'
|
|
396
|
-
}, {
|
|
397
|
-
unit: 'month',
|
|
398
|
-
plural: 'months',
|
|
399
|
-
amounts: [1, 3, 6, 12],
|
|
400
|
-
ago: '@astryx.powersearch.sheet.relativeMonthsAgo',
|
|
401
|
-
fromNow: '@astryx.powersearch.sheet.relativeMonthsFromNow'
|
|
402
|
-
}];
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* The relative-date choices an operator offers, in display order. Shared by
|
|
406
|
-
* the popover's Selector and the sheet presentation's rows so both list the
|
|
407
|
-
* same values. With `t` the labels resolve through the catalog's ICU plural
|
|
408
|
-
* messages (the sheet presentation's rows); without it they are the popover
|
|
409
|
-
* editor's own literals. In English the two read identically.
|
|
410
|
-
*/
|
|
411
|
-
export function buildRelativeDateOptions(operatorValue, t) {
|
|
412
|
-
const result = [];
|
|
413
|
-
for (const {
|
|
414
|
-
unit,
|
|
415
|
-
plural,
|
|
416
|
-
amounts,
|
|
417
|
-
ago,
|
|
418
|
-
fromNow
|
|
419
|
-
} of RELATIVE_DATE_UNITS) {
|
|
420
|
-
for (const amount of amounts) {
|
|
421
|
-
const unitWord = amount === 1 ? unit : plural;
|
|
422
|
-
if (operatorValue.isPastAllowed !== false) {
|
|
423
|
-
result.push({
|
|
424
|
-
value: `${amount}${unit[0]}_ago`,
|
|
425
|
-
label: t ? t(ago, {
|
|
426
|
-
count: amount
|
|
427
|
-
}) : `${amount} ${unitWord} ago`
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
if (operatorValue.isFutureAllowed !== false) {
|
|
431
|
-
result.push({
|
|
432
|
-
value: `${amount}${unit[0]}_from_now`,
|
|
433
|
-
label: t ? t(fromNow, {
|
|
434
|
-
count: amount
|
|
435
|
-
}) : `${amount} ${unitWord} from now`
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
338
|
}
|
|
439
|
-
}
|
|
440
|
-
return result;
|
|
339
|
+
});
|
|
441
340
|
}
|
|
442
341
|
function DateRelativeEditor({
|
|
443
342
|
operatorValue,
|
|
@@ -447,18 +346,40 @@ function DateRelativeEditor({
|
|
|
447
346
|
}) {
|
|
448
347
|
const t = useComponentTranslator();
|
|
449
348
|
const currentValue = filterValue?.type === 'date_relative' ? filterValue.value : undefined;
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
349
|
+
const options = useMemo(() => {
|
|
350
|
+
const result = [];
|
|
351
|
+
const units = [{
|
|
352
|
+
unit: 'day',
|
|
353
|
+
plural: 'days'
|
|
354
|
+
}, {
|
|
355
|
+
unit: 'week',
|
|
356
|
+
plural: 'weeks'
|
|
357
|
+
}, {
|
|
358
|
+
unit: 'month',
|
|
359
|
+
plural: 'months'
|
|
360
|
+
}];
|
|
361
|
+
for (const {
|
|
362
|
+
unit,
|
|
363
|
+
plural
|
|
364
|
+
} of units) {
|
|
365
|
+
const amounts = unit === 'day' ? [1, 3, 7, 14, 30] : unit === 'week' ? [1, 2, 4] : [1, 3, 6, 12];
|
|
366
|
+
for (const amount of amounts) {
|
|
367
|
+
if (operatorValue.isPastAllowed !== false) {
|
|
368
|
+
result.push({
|
|
369
|
+
value: `${amount}${unit[0]}_ago`,
|
|
370
|
+
label: `${amount} ${amount === 1 ? unit : plural} ago`
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
if (operatorValue.isFutureAllowed !== false) {
|
|
374
|
+
result.push({
|
|
375
|
+
value: `${amount}${unit[0]}_from_now`,
|
|
376
|
+
label: `${amount} ${amount === 1 ? unit : plural} from now`
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return result;
|
|
382
|
+
}, [operatorValue.isPastAllowed, operatorValue.isFutureAllowed]);
|
|
462
383
|
return /*#__PURE__*/_jsx(Selector, {
|
|
463
384
|
label: t('@astryx.powersearch.valueEditor.relativeDate'),
|
|
464
385
|
isLabelHidden: true,
|
|
@@ -476,8 +397,7 @@ function DateRelativeEditor({
|
|
|
476
397
|
function DateRangeEditor({
|
|
477
398
|
filterValue,
|
|
478
399
|
onChange,
|
|
479
|
-
isDisabled
|
|
480
|
-
presentation
|
|
400
|
+
isDisabled
|
|
481
401
|
}) {
|
|
482
402
|
const t = useComponentTranslator();
|
|
483
403
|
const currentValue = useMemo(() => {
|
|
@@ -528,10 +448,6 @@ function DateRangeEditor({
|
|
|
528
448
|
value: currentValue,
|
|
529
449
|
onChange: handleChange,
|
|
530
450
|
hasClear: false
|
|
531
|
-
// A phone-wide sheet fits one month; the popover keeps the default.
|
|
532
|
-
,
|
|
533
|
-
numberOfMonths: presentation === 'bottom-sheet' ? 1 : undefined,
|
|
534
|
-
width: presentation === 'bottom-sheet' ? '100%' : undefined
|
|
535
451
|
})
|
|
536
452
|
});
|
|
537
453
|
}
|
|
@@ -609,12 +525,9 @@ function EntityListEditor({
|
|
|
609
525
|
filterValue,
|
|
610
526
|
onChange,
|
|
611
527
|
maxMenuItems,
|
|
612
|
-
isDisabled
|
|
613
|
-
presentation,
|
|
614
|
-
fieldLabel
|
|
528
|
+
isDisabled
|
|
615
529
|
}) {
|
|
616
530
|
const t = useComponentTranslator();
|
|
617
|
-
const isSheet = presentation === 'bottom-sheet';
|
|
618
531
|
const source = useMemo(() => {
|
|
619
532
|
if (operatorValue.searchSource) {
|
|
620
533
|
return operatorValue.searchSource;
|
|
@@ -638,11 +551,8 @@ function EntityListEditor({
|
|
|
638
551
|
} : undefined
|
|
639
552
|
}));
|
|
640
553
|
}, [filterValue]);
|
|
641
|
-
|
|
642
|
-
// Sheet presentation: the Tokenizer's own sheet, titled with the field
|
|
643
|
-
// label, as for string_list.
|
|
644
554
|
return /*#__PURE__*/_jsx(Tokenizer, {
|
|
645
|
-
label:
|
|
555
|
+
label: t('@astryx.powersearch.valueEditor.entities'),
|
|
646
556
|
isLabelHidden: true,
|
|
647
557
|
isDisabled: isDisabled,
|
|
648
558
|
searchSource: source,
|
|
@@ -666,11 +576,7 @@ function EntityListEditor({
|
|
|
666
576
|
renderItem: operatorValue.renderItem,
|
|
667
577
|
placeholder: t('@astryx.powersearch.valueEditor.searchPlaceholder'),
|
|
668
578
|
debounceMs: operatorValue.searchSource ? 150 : 0,
|
|
669
|
-
maxMenuItems: maxMenuItems
|
|
670
|
-
width: isSheet ? '100%' : undefined,
|
|
671
|
-
experimental: isSheet ? {
|
|
672
|
-
presentation: 'bottom-sheet'
|
|
673
|
-
} : undefined
|
|
579
|
+
maxMenuItems: maxMenuItems
|
|
674
580
|
});
|
|
675
581
|
}
|
|
676
582
|
function CustomEditor({
|
|
@@ -707,10 +613,7 @@ export function PowerSearchValueEditor({
|
|
|
707
613
|
onChange,
|
|
708
614
|
onEnter,
|
|
709
615
|
maxMenuItems,
|
|
710
|
-
isDisabled
|
|
711
|
-
onUnstage,
|
|
712
|
-
presentation = 'popover',
|
|
713
|
-
fieldLabel
|
|
616
|
+
isDisabled
|
|
714
617
|
}) {
|
|
715
618
|
switch (operatorValue.type) {
|
|
716
619
|
case 'empty':
|
|
@@ -718,7 +621,6 @@ export function PowerSearchValueEditor({
|
|
|
718
621
|
case 'string':
|
|
719
622
|
return /*#__PURE__*/_jsx(StringEditor, {
|
|
720
623
|
isDisabled: isDisabled,
|
|
721
|
-
presentation: presentation,
|
|
722
624
|
operatorValue: operatorValue,
|
|
723
625
|
filterValue: filterValue,
|
|
724
626
|
onChange: onChange,
|
|
@@ -728,8 +630,6 @@ export function PowerSearchValueEditor({
|
|
|
728
630
|
case 'string_list':
|
|
729
631
|
return /*#__PURE__*/_jsx(StringListEditor, {
|
|
730
632
|
isDisabled: isDisabled,
|
|
731
|
-
presentation: presentation,
|
|
732
|
-
fieldLabel: fieldLabel,
|
|
733
633
|
operatorValue: operatorValue,
|
|
734
634
|
filterValue: filterValue,
|
|
735
635
|
onChange: onChange,
|
|
@@ -738,8 +638,6 @@ export function PowerSearchValueEditor({
|
|
|
738
638
|
case 'integer':
|
|
739
639
|
return /*#__PURE__*/_jsx(IntegerEditor, {
|
|
740
640
|
isDisabled: isDisabled,
|
|
741
|
-
presentation: presentation,
|
|
742
|
-
onUnstage: onUnstage,
|
|
743
641
|
operatorValue: operatorValue,
|
|
744
642
|
filterValue: filterValue,
|
|
745
643
|
onChange: onChange,
|
|
@@ -748,8 +646,6 @@ export function PowerSearchValueEditor({
|
|
|
748
646
|
case 'float':
|
|
749
647
|
return /*#__PURE__*/_jsx(FloatEditor, {
|
|
750
648
|
isDisabled: isDisabled,
|
|
751
|
-
presentation: presentation,
|
|
752
|
-
onUnstage: onUnstage,
|
|
753
649
|
operatorValue: operatorValue,
|
|
754
650
|
filterValue: filterValue,
|
|
755
651
|
onChange: onChange,
|
|
@@ -758,7 +654,6 @@ export function PowerSearchValueEditor({
|
|
|
758
654
|
case 'time':
|
|
759
655
|
return /*#__PURE__*/_jsx(TimeEditor, {
|
|
760
656
|
isDisabled: isDisabled,
|
|
761
|
-
presentation: presentation,
|
|
762
657
|
operatorValue: operatorValue,
|
|
763
658
|
filterValue: filterValue,
|
|
764
659
|
onChange: onChange
|
|
@@ -766,7 +661,6 @@ export function PowerSearchValueEditor({
|
|
|
766
661
|
case 'date_absolute':
|
|
767
662
|
return /*#__PURE__*/_jsx(DateAbsoluteEditor, {
|
|
768
663
|
isDisabled: isDisabled,
|
|
769
|
-
presentation: presentation,
|
|
770
664
|
operatorValue: operatorValue,
|
|
771
665
|
filterValue: filterValue,
|
|
772
666
|
onChange: onChange
|
|
@@ -781,7 +675,6 @@ export function PowerSearchValueEditor({
|
|
|
781
675
|
case 'date_range':
|
|
782
676
|
return /*#__PURE__*/_jsx(DateRangeEditor, {
|
|
783
677
|
isDisabled: isDisabled,
|
|
784
|
-
presentation: presentation,
|
|
785
678
|
operatorValue: operatorValue,
|
|
786
679
|
filterValue: filterValue,
|
|
787
680
|
onChange: onChange
|
|
@@ -803,8 +696,6 @@ export function PowerSearchValueEditor({
|
|
|
803
696
|
case 'entity_list':
|
|
804
697
|
return /*#__PURE__*/_jsx(EntityListEditor, {
|
|
805
698
|
isDisabled: isDisabled,
|
|
806
|
-
presentation: presentation,
|
|
807
|
-
fieldLabel: fieldLabel,
|
|
808
699
|
operatorValue: operatorValue,
|
|
809
700
|
filterValue: filterValue,
|
|
810
701
|
onChange: onChange,
|
|
@@ -10,13 +10,6 @@
|
|
|
10
10
|
import type { OperatorValue, FilterValue } from './types.js';
|
|
11
11
|
import type { InternalConfig } from './useInternalConfig.js';
|
|
12
12
|
import type { Locale, TranslatorFn } from '../i18n/index.js';
|
|
13
|
-
/**
|
|
14
|
-
* A number in the provider locale's digits, decimal mark, and — unless the
|
|
15
|
-
* options say otherwise — grouping. The shared number helper for
|
|
16
|
-
* PowerSearch's own readings of a value — this module owns the raw `Intl`
|
|
17
|
-
* access.
|
|
18
|
-
*/
|
|
19
|
-
export declare function formatSharedNumber(value: number, locale: Locale, options?: Pick<Intl.NumberFormatOptions, 'useGrouping' | 'maximumFractionDigits'>): string;
|
|
20
13
|
export declare function formatDateAbsolute(unixSeconds: number, locale: Locale, timezoneID?: string): string;
|
|
21
14
|
/**
|
|
22
15
|
* Compact date-only rendering (no time-of-day) for the token pill's inline
|