@astryxdesign/core 0.7.7-canary.bf14580 → 0.7.7-canary.c19ca12
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/AlertDialog/AlertDialog.d.ts +4 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +36 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +76 -6
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +23 -4
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +5 -4
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +3 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +47 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +13 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +14 -4
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +13 -27
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +22 -41
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -31
- package/dist/Field/Field.js +2 -2
- package/dist/HoverCard/HoverCard.d.ts +4 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +27 -2
- package/dist/HoverCard/useHoverCard.d.ts +5 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +17 -31
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +5 -2
- 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/usePressPin.d.ts +17 -5
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +62 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +18 -0
- package/dist/PowerSearch/PowerSearch.d.ts +36 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +522 -269
- 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/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 +60 -58
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- 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/Toast/Toast.d.ts +11 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +25 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +94 -34
- package/dist/Toast/types.d.ts +9 -3
- package/dist/Toast/types.d.ts.map +1 -1
- 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/Tooltip/useTooltip.d.ts +19 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +34 -53
- package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/animator/createAnimator.d.ts +98 -0
- package/dist/animator/createAnimator.d.ts.map +1 -0
- package/dist/animator/createAnimator.js +259 -0
- package/dist/astryx.css +22 -6
- package/dist/gestures/GestureHost.d.ts +27 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +90 -8
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +4 -3
- package/dist/hooks/actionGroupTracker.d.ts +4 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +13 -3
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/pressGroupContext.d.ts +6 -0
- package/dist/hooks/pressGroupContext.d.ts.map +1 -0
- package/dist/hooks/pressGroupContext.js +20 -0
- package/dist/hooks/useActionGroupTracking.d.ts +53 -0
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
- package/dist/hooks/useActionGroupTracking.js +174 -0
- package/dist/hooks/useAnimator.d.ts +41 -0
- package/dist/hooks/useAnimator.d.ts.map +1 -0
- package/dist/hooks/useAnimator.js +70 -0
- 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 +6 -2
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +95 -15
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +4 -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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/internal/indicatorPress.stylex.d.ts +20 -0
- package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
- package/dist/internal/indicatorPress.stylex.js +26 -0
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +41 -18
- package/dist/motion/reducedMotion.d.ts +24 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +78 -1
- package/dist/motion/uikit/alert.d.ts +41 -0
- package/dist/motion/uikit/alert.d.ts.map +1 -0
- package/dist/motion/uikit/alert.js +43 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +15 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +23 -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/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/focusReturn.d.ts +15 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +28 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +19 -6
- package/dist/utils/triggerFocus.d.ts +36 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -0
- package/dist/utils/triggerFocus.js +65 -0
- package/locales/en.json +120 -0
- package/locales/pseudo.json +90 -0
- package/package.json +9 -4
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +37 -5
- package/src/BottomSheet/BottomSheet.tsx +85 -5
- package/src/BottomSheet/BottomSheetPanel.tsx +40 -5
- package/src/BottomSheet/bottomSheetStack.ts +8 -4
- package/src/BottomSheet/useSheetGestures.ts +3 -1
- package/src/Button/Button.tsx +63 -5
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.tsx +36 -9
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/DateInput/MonthScroller.tsx +18 -22
- package/src/DateInput/Wheel.tsx +30 -32
- package/src/Dialog/Dialog.tsx +10 -31
- package/src/Field/Field.tsx +2 -2
- package/src/HoverCard/HoverCard.doc.mjs +4 -2
- package/src/HoverCard/HoverCard.tsx +35 -4
- package/src/HoverCard/useHoverCard.doc.mjs +178 -36
- package/src/HoverCard/useHoverCard.tsx +46 -52
- package/src/Icon/Icon.doc.mjs +49 -8
- package/src/Icon/Icon.tsx +15 -7
- package/src/Layer/layerAnimations.stylex.ts +24 -16
- package/src/Layer/usePressPin.ts +81 -15
- package/src/Lightbox/Lightbox.tsx +18 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +54 -5
- package/src/PowerSearch/PowerSearch.tsx +734 -288
- 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/SegmentedControl/useSegmentedSelectionMotion.ts +6 -3
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +46 -12
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/Toast/Toast.doc.mjs +4 -3
- package/src/Toast/Toast.tsx +52 -32
- package/src/Toast/ToastViewport.tsx +121 -35
- package/src/Toast/types.ts +9 -3
- package/src/Token/Token.tsx +13 -4
- package/src/Token/TokenNamingContext.ts +28 -0
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +61 -56
- package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/animator/createAnimator.doc.mjs +153 -0
- package/src/animator/createAnimator.ts +324 -0
- package/src/gestures/GestureHost.ts +105 -10
- package/src/gestures/PressTracker.ts +4 -3
- package/src/gestures/README.md +7 -1
- package/src/hooks/actionGroupTracker.ts +20 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- package/src/hooks/useActionGroupTracking.ts +224 -0
- package/src/hooks/useAnimator.doc.mjs +109 -0
- package/src/hooks/useAnimator.ts +67 -0
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +136 -15
- package/src/hooks/useMenuPress.ts +8 -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
- package/src/index.ts +13 -0
- package/src/internal/indicatorPress.stylex.ts +24 -0
- package/src/motion/README.md +8 -5
- package/src/motion/animator.ts +61 -29
- package/src/motion/reducedMotion.ts +79 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +23 -0
- package/src/utils/clickGuard.ts +37 -1
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/focusReturn.ts +30 -0
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/pressFeedback.ts +19 -6
- package/src/utils/triggerFocus.ts +80 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file layerAnimations.stylex.ts
|
|
3
|
-
* @input Uses StyleX, theme duration/easing tokens
|
|
3
|
+
* @input Uses StyleX, theme duration/easing tokens, the Reduce Motion fade
|
|
4
|
+
* constants
|
|
4
5
|
* @output Exports shared entry animation styles for layer-based components
|
|
5
6
|
* @position Shared animation primitives; consumed by DropdownMenu, Popover,
|
|
6
7
|
* HoverCard, Tooltip, Selector, and any component using useLayer
|
|
@@ -30,13 +31,11 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
30
31
|
* Keyed by LayerPlacement ('above' | 'below' | 'start' | 'end')
|
|
31
32
|
* for easy lookup: `layerAnimations[placement]`.
|
|
32
33
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* (design:reduced-motion DR2, DR3), as iOS does for its menus, popovers and
|
|
39
|
-
* tips.
|
|
34
|
+
* Under `prefers-reduced-motion: reduce` each entry drops its travel and
|
|
35
|
+
* scale. Under a finger (the primary pointer is coarse) the layer fades in,
|
|
36
|
+
* opacity only, in 200 ms on easeInOut: on a touch screen Reduce Motion
|
|
37
|
+
* replaces motion with a cross-fade rather than a jump; under any other
|
|
38
|
+
* pointer it appears at once.
|
|
40
39
|
*/
|
|
41
40
|
export declare const layerAnimations: Readonly<{
|
|
42
41
|
readonly below: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerAnimations.stylex.d.ts","sourceRoot":"","sources":["../../src/Layer/layerAnimations.stylex.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"layerAnimations.stylex.d.ts","sourceRoot":"","sources":["../../src/Layer/layerAnimations.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AA+E3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;EAuC1B,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file layerAnimations.stylex.ts
|
|
5
|
-
* @input Uses StyleX, theme duration/easing tokens
|
|
5
|
+
* @input Uses StyleX, theme duration/easing tokens, the Reduce Motion fade
|
|
6
|
+
* constants
|
|
6
7
|
* @output Exports shared entry animation styles for layer-based components
|
|
7
8
|
* @position Shared animation primitives; consumed by DropdownMenu, Popover,
|
|
8
9
|
* HoverCard, Tooltip, Selector, and any component using useLayer
|
|
@@ -27,6 +28,8 @@
|
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
import * as stylex from '@stylexjs/stylex';
|
|
31
|
+
import "../motion/reducedMotion.stylex.js";
|
|
32
|
+
import { reducedMotionFadeConsts } from "../motion/reducedMotion.stylex.js";
|
|
30
33
|
import "../theme/tokens.stylex.js";
|
|
31
34
|
import { durationVars, easeVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
32
35
|
const enterBelow = "xv1hr86-B";
|
|
@@ -44,13 +47,17 @@ const enterStartRtl = "xwmkjkf-B";
|
|
|
44
47
|
|
|
45
48
|
// Reduce Motion under a finger: the same entrance without its travel. A touch
|
|
46
49
|
// presentation substitutes a cross-fade for motion, never a jump.
|
|
47
|
-
|
|
50
|
+
// The fade's curve rides in its first keyframe, so the published class type
|
|
51
|
+
// of `animationTimingFunction` stays the theme ease's.
|
|
52
|
+
const fadeIn = "x12p7u8f-B";
|
|
53
|
+
|
|
54
|
+
// No theme value lengthens the Reduce Motion fade, so its values are constants.
|
|
55
|
+
// The media keys stay literal: StyleX gives an imported at-rule key a later
|
|
56
|
+
// priority layer (see reducedMotionKeys).
|
|
48
57
|
const animationBase = {
|
|
49
58
|
animationDuration: {
|
|
50
59
|
default: durationVars['--duration-fast-max'],
|
|
51
|
-
|
|
52
|
-
// (design:reduced-motion DR2).
|
|
53
|
-
'@media (prefers-reduced-motion: reduce) and (pointer: coarse)': `min(${durationVars['--duration-fast-max']}, 200ms)`
|
|
60
|
+
'@media (prefers-reduced-motion: reduce) and (pointer: coarse)': reducedMotionFadeConsts.duration
|
|
54
61
|
},
|
|
55
62
|
animationTimingFunction: easeVars['--ease-standard'],
|
|
56
63
|
animationFillMode: 'backwards'
|
|
@@ -62,39 +69,37 @@ const animationBase = {
|
|
|
62
69
|
* Keyed by LayerPlacement ('above' | 'below' | 'start' | 'end')
|
|
63
70
|
* for easy lookup: `layerAnimations[placement]`.
|
|
64
71
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* (design:reduced-motion DR2, DR3), as iOS does for its menus, popovers and
|
|
71
|
-
* tips.
|
|
72
|
+
* Under `prefers-reduced-motion: reduce` each entry drops its travel and
|
|
73
|
+
* scale. Under a finger (the primary pointer is coarse) the layer fades in,
|
|
74
|
+
* opacity only, in 200 ms on easeInOut: on a touch screen Reduce Motion
|
|
75
|
+
* replaces motion with a cross-fade rather than a jump; under any other
|
|
76
|
+
* pointer it appears at once.
|
|
72
77
|
*/
|
|
73
78
|
export const layerAnimations = {
|
|
74
79
|
below: {
|
|
75
|
-
kKVMdj: "xl1vlw0
|
|
76
|
-
k44tkh: "x9uej1z
|
|
80
|
+
kKVMdj: "xl1vlw0 x2g3n7u xaqowwx",
|
|
81
|
+
k44tkh: "x9uej1z x10got5w",
|
|
77
82
|
kyAemX: "x128ha8g",
|
|
78
83
|
kWV6AL: "xskzprw",
|
|
79
84
|
$$css: true
|
|
80
85
|
},
|
|
81
86
|
above: {
|
|
82
|
-
kKVMdj: "x3psbcj
|
|
83
|
-
k44tkh: "x9uej1z
|
|
87
|
+
kKVMdj: "x3psbcj x2g3n7u xaqowwx",
|
|
88
|
+
k44tkh: "x9uej1z x10got5w",
|
|
84
89
|
kyAemX: "x128ha8g",
|
|
85
90
|
kWV6AL: "xskzprw",
|
|
86
91
|
$$css: true
|
|
87
92
|
},
|
|
88
93
|
end: {
|
|
89
|
-
kKVMdj: "x1i331go x1vxsm5i
|
|
90
|
-
k44tkh: "x9uej1z
|
|
94
|
+
kKVMdj: "x1i331go x1vxsm5i x2g3n7u xaqowwx",
|
|
95
|
+
k44tkh: "x9uej1z x10got5w",
|
|
91
96
|
kyAemX: "x128ha8g",
|
|
92
97
|
kWV6AL: "xskzprw",
|
|
93
98
|
$$css: true
|
|
94
99
|
},
|
|
95
100
|
start: {
|
|
96
|
-
kKVMdj: "xck01x9 x18lne9g
|
|
97
|
-
k44tkh: "x9uej1z
|
|
101
|
+
kKVMdj: "xck01x9 x18lne9g x2g3n7u xaqowwx",
|
|
102
|
+
k44tkh: "x9uej1z x10got5w",
|
|
98
103
|
kyAemX: "x128ha8g",
|
|
99
104
|
kWV6AL: "xskzprw",
|
|
100
105
|
$$css: true
|
|
@@ -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.ts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ChC,+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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAC,S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AQ,CAAC,EACvB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,KAAK,EAAE,eAAe,EACtB,YAAgB,EAChB,aAAa,EACb,OAAe,EACf,WAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,KAAK,EACT,EAAE,aAAa,sCAuef;yBAvfe,QAAQ"}
|
|
@@ -42,6 +42,7 @@ import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
|
42
42
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
43
43
|
import english from "../i18n/generated-english/Lightbox/Lightbox.generated.js";
|
|
44
44
|
import { isRenderable } from "../utils/isRenderable.js";
|
|
45
|
+
import { prepareFocusReturnOnRemoval } from "../utils/focusReturn.js";
|
|
45
46
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
46
47
|
registerEnglishFallback(english);
|
|
47
48
|
/**
|
|
@@ -326,6 +327,23 @@ export function Lightbox({
|
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
}, [isOpen, hasItem]);
|
|
330
|
+
|
|
331
|
+
// A viewer that unmounts while open (rendered only while open, or removed
|
|
332
|
+
// with the rest of a view) never runs the close branch above. Focus the
|
|
333
|
+
// removal lost goes back to the opener while the opener is still on the
|
|
334
|
+
// page.
|
|
335
|
+
useEffect(() => {
|
|
336
|
+
const dialog = dialogRef.current;
|
|
337
|
+
if (dialog == null) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const returnFocusOnRemoval = prepareFocusReturnOnRemoval(dialog);
|
|
341
|
+
return () => {
|
|
342
|
+
if (dialog.open) {
|
|
343
|
+
returnFocusOnRemoval(triggerElementRef.current);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
}, [hasItem]);
|
|
329
347
|
const handleClose = useCallback(() => {
|
|
330
348
|
onOpenChange(false);
|
|
331
349
|
}, [onOpenChange]);
|
|
@@ -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;I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