@astryxdesign/core 0.7.8-canary.ffd29c5 → 0.7.8
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 +132 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +30 -14
- package/dist/BottomSheet/bottomSheetStack.js +1 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +4 -0
- package/dist/CheckboxList/CheckboxList.d.ts +13 -2
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +10 -4
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +14 -2
- package/dist/CheckboxList/requiredGroup.d.ts +22 -0
- package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
- package/dist/CheckboxList/requiredGroup.js +52 -0
- package/dist/DateInput/PickerWheel.d.ts +1 -1
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +27 -6
- package/dist/DateInput/Wheel.d.ts +2 -2
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +20 -6
- package/dist/DateInput/datePickerTouch.d.ts +13 -0
- package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
- package/dist/DateInput/datePickerTouch.js +14 -0
- package/dist/DateInput/wheelOptions.d.ts +22 -2
- package/dist/DateInput/wheelOptions.d.ts.map +1 -1
- package/dist/DateInput/wheelOptions.js +14 -2
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +62 -119
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +6 -1
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +7 -2
- package/dist/PowerSearch/PowerSearch.d.ts +4 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +24 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +172 -50
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +15 -15
- package/dist/Resizable/createResizable.d.ts +70 -16
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +180 -22
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.js +2 -2
- package/dist/TimeInput/TimeWheels.d.ts +32 -0
- package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
- package/dist/TimeInput/TimeWheels.js +144 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +63 -118
- package/dist/TimeInput/timeWheelRules.d.ts +124 -0
- package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
- package/dist/TimeInput/timeWheelRules.js +277 -0
- package/dist/Tokenizer/TokenizerBottomSheet.js +8 -12
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +6 -0
- package/dist/astryx.css +3 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +3 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +5 -2
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -2
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -2
- package/dist/keyboard/index.d.ts +17 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/keyboard/index.js +19 -0
- package/dist/keyboard/keyboardHeight.d.ts +149 -0
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
- package/dist/keyboard/keyboardHeight.js +432 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
- package/dist/keyboard/keyboardLayoutGuide.js +207 -0
- package/dist/keyboard/keyboardModel.d.ts +93 -0
- package/dist/keyboard/keyboardModel.d.ts.map +1 -0
- package/dist/keyboard/keyboardModel.js +220 -0
- package/dist/keyboard/rideKeyboard.d.ts +42 -0
- package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
- package/dist/keyboard/rideKeyboard.js +77 -0
- package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
- package/dist/keyboard/useMobileKeyboard.js +699 -0
- package/dist/motion/android/index.d.ts +16 -0
- package/dist/motion/android/index.d.ts.map +1 -0
- package/dist/motion/android/index.js +18 -0
- package/dist/motion/android/keyboard.d.ts +83 -0
- package/dist/motion/android/keyboard.d.ts.map +1 -0
- package/dist/motion/android/keyboard.js +96 -0
- package/dist/motion/uikit/datePicker.d.ts +58 -0
- package/dist/motion/uikit/datePicker.d.ts.map +1 -0
- package/dist/motion/uikit/datePicker.js +60 -0
- package/dist/motion/uikit/index.d.ts +4 -3
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +4 -3
- 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/layoutViewport.d.ts +25 -0
- package/dist/utils/layoutViewport.d.ts.map +1 -0
- package/dist/utils/layoutViewport.js +102 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +74 -9
- package/dist/utils/pressGesture.d.ts +4 -2
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +3 -1
- package/dist/utils/selectionLock.d.ts +10 -1
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +31 -5
- package/dist/utils/sharedMutationObserver.d.ts +2 -1
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +2 -1
- package/dist/utils/timeParser.d.ts +2 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +29 -3
- package/locales/en.json +21 -9
- package/locales/pseudo.json +15 -6
- package/package.json +5 -5
- package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +41 -13
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +1 -1
- package/src/BottomSheet/useSheetGestures.ts +6 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +7 -0
- package/src/CheckboxList/CheckboxList.tsx +34 -2
- package/src/CheckboxList/CheckboxListContext.tsx +9 -1
- package/src/CheckboxList/CheckboxListItem.tsx +23 -2
- package/src/CheckboxList/requiredGroup.ts +77 -0
- package/src/DateInput/PickerWheel.tsx +37 -4
- package/src/DateInput/Wheel.tsx +30 -3
- package/src/DateInput/datePickerTouch.ts +15 -0
- package/src/DateInput/wheelOptions.ts +31 -2
- package/src/DateTimeInput/TouchDateTimeField.tsx +94 -178
- package/src/HoverCard/useHoverCard.tsx +6 -1
- package/src/Overlay/Overlay.tsx +7 -2
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.tsx +4 -2
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +237 -62
- package/src/Resizable/ResizeHandle.tsx +18 -26
- package/src/Resizable/createResizable.ts +242 -27
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +2 -2
- package/src/TimeInput/TimeWheels.tsx +218 -0
- package/src/TimeInput/TouchTimeField.tsx +93 -157
- package/src/TimeInput/timeWheelRules.ts +352 -0
- package/src/Tokenizer/TokenizerBottomSheet.tsx +8 -12
- package/src/Tooltip/useTooltip.tsx +6 -0
- package/src/gestures/GestureHost.ts +5 -4
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +5 -2
- package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
- package/src/i18n/generated-locales/en.generated.ts +6 -4
- package/src/i18n/generated-locales/pseudo.generated.ts +6 -4
- package/src/keyboard/README.md +197 -0
- package/src/keyboard/index.ts +48 -0
- package/src/keyboard/keyboardHeight.ts +543 -0
- package/src/keyboard/keyboardLayoutGuide.ts +266 -0
- package/src/keyboard/keyboardModel.ts +301 -0
- package/src/keyboard/rideKeyboard.ts +100 -0
- package/src/keyboard/useMobileKeyboard.ts +866 -0
- package/src/motion/MEASUREMENTS.md +10 -0
- package/src/motion/README.md +2 -0
- package/src/motion/android/index.ts +18 -0
- package/src/motion/android/keyboard.ts +96 -0
- package/src/motion/uikit/datePicker.ts +60 -0
- package/src/motion/uikit/index.ts +4 -3
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/layoutViewport.ts +104 -0
- package/src/utils/pressFeedback.ts +99 -21
- package/src/utils/pressGesture.ts +4 -2
- package/src/utils/selectionLock.ts +40 -6
- package/src/utils/sharedMutationObserver.ts +2 -1
- package/src/utils/timeParser.ts +40 -3
- package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
- package/dist/BottomSheet/useMobileKeyboard.js +0 -413
- package/src/BottomSheet/useMobileKeyboard.ts +0 -542
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACd,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC7D,8CAA8C;IAC9C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iDAAiD;IACjD,OAAO,EAAE,SAAS,CAAC;IACnB,wBAAwB;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,qBAAqB;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;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,KAAK,EACL,GAAG,EACH,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,IAAI,EACR,EAAE,YAAY,+BA0Dd;yBAzEe,OAAO"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -66,8 +66,13 @@ export function Overlay({
|
|
|
66
66
|
align
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
//
|
|
70
|
-
//
|
|
69
|
+
// Copies the first child's radius onto the wrapper, so the scrim clips to
|
|
70
|
+
// the media's rounded corners. This is a layout read of the mounted DOM, and
|
|
71
|
+
// no user interaction causes it. It runs again when a hidden Activity shows
|
|
72
|
+
// the wrapper, because the child can change while it is hidden. A ref
|
|
73
|
+
// callback runs again when a caller's ref changes identity, so it cannot
|
|
74
|
+
// keep this once-per-show timing. A useOverlay consumer sets the radius on
|
|
75
|
+
// its own element.
|
|
71
76
|
useIsomorphicLayoutEffect(() => {
|
|
72
77
|
const el = overlay.containerRef.current;
|
|
73
78
|
if (!el) {
|
|
@@ -133,8 +133,10 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
133
133
|
* above it with the fields (or the content search with inline
|
|
134
134
|
* suggestions), and a value step opens above that, stages operator →
|
|
135
135
|
* value, and confirms from its footer. Dismissing a step reveals the
|
|
136
|
-
* one beneath.
|
|
137
|
-
*
|
|
136
|
+
* one beneath. The flow edits a draft: `onChange` is called when Done
|
|
137
|
+
* applies it, once per edit in order, and a dismissal with a changed
|
|
138
|
+
* draft asks before discarding it. Suited to compact touch screens,
|
|
139
|
+
* where the editor popover competes with the software keyboard.
|
|
138
140
|
* - `'adaptive'`: the bottom sheet on compact coarse-pointer screens,
|
|
139
141
|
* otherwise the popover — the same resolution Selector uses. The server
|
|
140
142
|
* render and the hydrating render are the popover.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"A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;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;IACnC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED,oFAAoF;AACpF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAoC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAC9B,YAAyB,GAC1B,EAAE,gBAAgB,qBAmiClB;yBAtkCe,WAAW"}
|
|
@@ -72,7 +72,14 @@ export interface PowerSearchBottomSheetProps {
|
|
|
72
72
|
config: InternalConfig;
|
|
73
73
|
/** The caller's config, handed to Editor overrides as they expect it. */
|
|
74
74
|
configProp: PowerSearchConfig;
|
|
75
|
+
/** The committed filters; the draft the sheet edits starts from them. */
|
|
75
76
|
filters: ReadonlyArray<PowerSearchFilter>;
|
|
77
|
+
/**
|
|
78
|
+
* The field's `onChange`. Done replays the draft's edits through it, in
|
|
79
|
+
* order, onto the field's latest filters, each call carrying that list
|
|
80
|
+
* with the edit applied; nothing is reported before Done, and nothing when
|
|
81
|
+
* the field is read-only or disabled at Done.
|
|
82
|
+
*/
|
|
76
83
|
onChange: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void;
|
|
77
84
|
/** The field typeahead source; the content search lists its suggestions. */
|
|
78
85
|
searchSource: SearchSource<PowerSearchItem>;
|
|
@@ -90,13 +97,29 @@ export interface PowerSearchBottomSheetProps {
|
|
|
90
97
|
components?: PowerSearchComponents;
|
|
91
98
|
editors: PowerSearchSheetEditors;
|
|
92
99
|
}
|
|
100
|
+
/** One edit of the draft: the draft before and after it, and its type and index in the draft; Done replays it onto the field's latest filters. */
|
|
101
|
+
interface DraftEdit {
|
|
102
|
+
before: ReadonlyArray<PowerSearchFilter>;
|
|
103
|
+
after: ReadonlyArray<PowerSearchFilter>;
|
|
104
|
+
changeType: PowerSearchChangeType;
|
|
105
|
+
index: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Replays the draft's edits onto `base`, the field's latest filters, and
|
|
109
|
+
* reports each through `report` with the list after it. An add appends; an
|
|
110
|
+
* edit replaces the first filter matching the one it edited; a removal drops
|
|
111
|
+
* the filters it removed, by signature. An edit or removal whose target is
|
|
112
|
+
* not in the base list is skipped: the parent removed it meanwhile.
|
|
113
|
+
*/
|
|
114
|
+
export declare function replayDraftEdits(base: ReadonlyArray<PowerSearchFilter>, edits: ReadonlyArray<DraftEdit>, report: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void): ReadonlyArray<PowerSearchFilter>;
|
|
93
115
|
/**
|
|
94
116
|
* The sheet flow of PowerSearch's touch presentation: Filters, Add filter,
|
|
95
117
|
* and the value step, as standalone sheets that stack, each open beneath the
|
|
96
118
|
* step it led to.
|
|
97
119
|
*/
|
|
98
|
-
export declare function PowerSearchBottomSheet({ isOpen, onOpenChange, finalFocusRef, resultCountText, config, configProp, filters, onChange, searchSource, placeholder, isReadOnly, isDisabled, hasClear, maxOperatorMenuItems, timezoneID, maxSearchResults, saveButtonLabel: saveButtonLabelFromProps, components: componentOverrides, editors, }: PowerSearchBottomSheetProps): React.JSX.Element;
|
|
120
|
+
export declare function PowerSearchBottomSheet({ isOpen, onOpenChange, finalFocusRef, resultCountText, config, configProp, filters: committedFilters, onChange: onCommit, searchSource, placeholder, isReadOnly, isDisabled, hasClear, maxOperatorMenuItems, timezoneID, maxSearchResults, saveButtonLabel: saveButtonLabelFromProps, components: componentOverrides, editors, }: PowerSearchBottomSheetProps): React.JSX.Element;
|
|
99
121
|
export declare namespace PowerSearchBottomSheet {
|
|
100
122
|
var displayName: string;
|
|
101
123
|
}
|
|
124
|
+
export {};
|
|
102
125
|
//# sourceMappingURL=PowerSearchBottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchBottomSheet.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAkCrD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAe3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAIV,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAEjB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAajB;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,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ACR,EAAE,2BAA2B,qBAmsD7B;yBAvtDe,sBAAsB"}
|
|
@@ -104,6 +104,82 @@ registerEnglishFallback(english);
|
|
|
104
104
|
// Styles
|
|
105
105
|
// =============================================================================
|
|
106
106
|
|
|
107
|
+
/** One edit of the draft: the draft before and after it, and its type and index in the draft; Done replays it onto the field's latest filters. */
|
|
108
|
+
|
|
109
|
+
// Whether two filter lists hold the same filters in the same order, by the
|
|
110
|
+
// key-order-insensitive signature the sheet matches filters with.
|
|
111
|
+
function hasSameFilters(a, b) {
|
|
112
|
+
return a.length === b.length && a.every((filter, index) => b[index] != null && filterSignature(filter) === filterSignature(b[index]));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// The filters `before` holds that `after` does not, as a multiset by
|
|
116
|
+
// signature, in `before` order.
|
|
117
|
+
function removedFilters(before, after) {
|
|
118
|
+
const remaining = new Map();
|
|
119
|
+
for (const filter of after) {
|
|
120
|
+
const signature = filterSignature(filter);
|
|
121
|
+
remaining.set(signature, (remaining.get(signature) ?? 0) + 1);
|
|
122
|
+
}
|
|
123
|
+
return before.filter(filter => {
|
|
124
|
+
const signature = filterSignature(filter);
|
|
125
|
+
const count = remaining.get(signature) ?? 0;
|
|
126
|
+
if (count > 0) {
|
|
127
|
+
remaining.set(signature, count - 1);
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Replays the draft's edits onto `base`, the field's latest filters, and
|
|
136
|
+
* reports each through `report` with the list after it. An add appends; an
|
|
137
|
+
* edit replaces the first filter matching the one it edited; a removal drops
|
|
138
|
+
* the filters it removed, by signature. An edit or removal whose target is
|
|
139
|
+
* not in the base list is skipped: the parent removed it meanwhile.
|
|
140
|
+
*/
|
|
141
|
+
export function replayDraftEdits(base, edits, report) {
|
|
142
|
+
let current = base;
|
|
143
|
+
for (const edit of edits) {
|
|
144
|
+
if (edit.changeType === 'add') {
|
|
145
|
+
const added = edit.after[edit.index];
|
|
146
|
+
if (added == null) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
current = [...current, added];
|
|
150
|
+
report(current, 'add', current.length - 1);
|
|
151
|
+
} else if (edit.changeType === 'edit') {
|
|
152
|
+
const original = edit.before[edit.index];
|
|
153
|
+
const updated = edit.after[edit.index];
|
|
154
|
+
if (original == null || updated == null) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const signature = filterSignature(original);
|
|
158
|
+
const index = current.findIndex(filter => filterSignature(filter) === signature);
|
|
159
|
+
if (index === -1) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
current = current.map((filter, i) => i === index ? updated : filter);
|
|
163
|
+
report(current, 'edit', index);
|
|
164
|
+
} else {
|
|
165
|
+
const removed = removedFilters(edit.before, edit.after).map(filterSignature);
|
|
166
|
+
const indexes = [];
|
|
167
|
+
for (const signature of removed) {
|
|
168
|
+
const index = current.findIndex((filter, i) => !indexes.includes(i) && filterSignature(filter) === signature);
|
|
169
|
+
if (index !== -1) {
|
|
170
|
+
indexes.push(index);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (indexes.length === 0) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
current = current.filter((_, i) => !indexes.includes(i));
|
|
177
|
+
report(current, 'remove', Math.min(...indexes));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return current;
|
|
181
|
+
}
|
|
182
|
+
|
|
107
183
|
// The trailing plus a field row shows when choosing it adds the filter at
|
|
108
184
|
// once, and the Add filter actions' glyph. Core's default icon set has no plus.
|
|
109
185
|
function PlusIcon(props) {
|
|
@@ -514,8 +590,8 @@ export function PowerSearchBottomSheet({
|
|
|
514
590
|
resultCountText,
|
|
515
591
|
config,
|
|
516
592
|
configProp,
|
|
517
|
-
filters,
|
|
518
|
-
onChange,
|
|
593
|
+
filters: committedFilters,
|
|
594
|
+
onChange: onCommit,
|
|
519
595
|
searchSource,
|
|
520
596
|
placeholder,
|
|
521
597
|
isReadOnly,
|
|
@@ -535,6 +611,27 @@ export function PowerSearchBottomSheet({
|
|
|
535
611
|
const locale = useLocale();
|
|
536
612
|
const formatList = useListFormatter();
|
|
537
613
|
const isInteractive = !isDisabled && !isReadOnly;
|
|
614
|
+
|
|
615
|
+
// ---- draft ----
|
|
616
|
+
// One open flow edits one draft of the filter list; `onChange` waits for
|
|
617
|
+
// Done, and a dismissal with a changed draft asks first.
|
|
618
|
+
const [filtersAtOpen, setFiltersAtOpen] = useState(() => committedFilters);
|
|
619
|
+
const [filters, setFilters] = useState(() => committedFilters);
|
|
620
|
+
// The draft as of the last edit, for the edit log's `before` lists.
|
|
621
|
+
const draftRef = useRef(filters);
|
|
622
|
+
const draftEditsRef = useRef([]);
|
|
623
|
+
const onChange = useCallback((next, changeType, index) => {
|
|
624
|
+
draftEditsRef.current.push({
|
|
625
|
+
before: draftRef.current,
|
|
626
|
+
after: next,
|
|
627
|
+
changeType,
|
|
628
|
+
index
|
|
629
|
+
});
|
|
630
|
+
draftRef.current = next;
|
|
631
|
+
setFilters(next);
|
|
632
|
+
}, []);
|
|
633
|
+
const isDraftDirty = !hasSameFilters(filtersAtOpen, filters);
|
|
634
|
+
const [isDiscardConfirmationOpen, setIsDiscardConfirmationOpen] = useState(false);
|
|
538
635
|
const contentSearchFieldKey = config.config.contentSearchFieldKey;
|
|
539
636
|
const contentSearchOperator = contentSearchFieldKey == null ? undefined : config.getDefaultOperator(contentSearchFieldKey);
|
|
540
637
|
const hasContentSearch = contentSearchOperator?.value.type === 'string';
|
|
@@ -616,9 +713,6 @@ export function PowerSearchBottomSheet({
|
|
|
616
713
|
const [contentQuery, setContentQuery] = useState('');
|
|
617
714
|
const [isClearConfirmationOpen, setIsClearConfirmationOpen] = useState(false);
|
|
618
715
|
const clearAllButtonRef = useRef(null);
|
|
619
|
-
// Set while Clear all commits, so the result count that changes in that
|
|
620
|
-
// commit is spoken with Clear all's outcome, as one message.
|
|
621
|
-
const isClearingRef = useRef(false);
|
|
622
716
|
|
|
623
717
|
// `useAnnounce` delivers inside the open Astryx modal that encloses its
|
|
624
718
|
// caller, and this component renders above the
|
|
@@ -645,13 +739,21 @@ export function PowerSearchBottomSheet({
|
|
|
645
739
|
if (isOpen !== wasOpen) {
|
|
646
740
|
setWasOpen(isOpen);
|
|
647
741
|
if (isOpen) {
|
|
742
|
+
// A fresh draft from the committed filters; the entry step is judged
|
|
743
|
+
// against them, not the previous session's draft.
|
|
744
|
+
setFiltersAtOpen(committedFilters);
|
|
745
|
+
setFilters(committedFilters);
|
|
746
|
+
draftRef.current = committedFilters;
|
|
747
|
+
draftEditsRef.current = [];
|
|
748
|
+
const startsOnAddFilter = committedFilters.length === 0 && isInteractive;
|
|
648
749
|
setFieldQuery('');
|
|
649
750
|
setContentQuery('');
|
|
650
|
-
setStep(
|
|
651
|
-
setFieldPickerOrigin(
|
|
751
|
+
setStep(startsOnAddFilter ? 'fields' : 'manage');
|
|
752
|
+
setFieldPickerOrigin(startsOnAddFilter ? 'trigger' : 'manage');
|
|
652
753
|
} else {
|
|
653
754
|
setStep(null);
|
|
654
755
|
setIsClearConfirmationOpen(false);
|
|
756
|
+
setIsDiscardConfirmationOpen(false);
|
|
655
757
|
}
|
|
656
758
|
}
|
|
657
759
|
const closeFlow = useCallback(() => {
|
|
@@ -659,6 +761,32 @@ export function PowerSearchBottomSheet({
|
|
|
659
761
|
setStep(null);
|
|
660
762
|
onOpenChange(false);
|
|
661
763
|
}, [onOpenChange]);
|
|
764
|
+
// Done replays each edit in order onto the field's latest filters, so a
|
|
765
|
+
// consumer gets the calls a popover session makes and keeps a filter it
|
|
766
|
+
// added meanwhile.
|
|
767
|
+
const commitAndClose = useCallback(() => {
|
|
768
|
+
// A field that became read-only while the flow was open reports nothing.
|
|
769
|
+
if (isDraftDirty && isInteractive) {
|
|
770
|
+
replayDraftEdits(committedFilters, draftEditsRef.current, onCommit);
|
|
771
|
+
}
|
|
772
|
+
draftEditsRef.current = [];
|
|
773
|
+
closeFlow();
|
|
774
|
+
}, [closeFlow, committedFilters, isDraftDirty, isInteractive, onCommit]);
|
|
775
|
+
const requestDismiss = useCallback(() => {
|
|
776
|
+
if (isDraftDirty) {
|
|
777
|
+
setIsDiscardConfirmationOpen(true);
|
|
778
|
+
} else {
|
|
779
|
+
closeFlow();
|
|
780
|
+
}
|
|
781
|
+
}, [closeFlow, isDraftDirty]);
|
|
782
|
+
const closeDiscardConfirmation = () => {
|
|
783
|
+
// eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves back into the sheet
|
|
784
|
+
flushSync(() => setIsDiscardConfirmationOpen(false));
|
|
785
|
+
const target = stepRef.current === 'manage' ? managerAddButtonRef.current ?? manageSheetRef.current?.closest('[tabindex="-1"]') : fieldsSheetRef.current?.closest('[tabindex="-1"]');
|
|
786
|
+
target?.focus({
|
|
787
|
+
preventScroll: true
|
|
788
|
+
});
|
|
789
|
+
};
|
|
662
790
|
|
|
663
791
|
// Whether a Filters row is a button: the field interactive and the
|
|
664
792
|
// filter not read-only. The row opens the value step — the editor for its
|
|
@@ -864,14 +992,8 @@ export function PowerSearchBottomSheet({
|
|
|
864
992
|
// is quiet then, so the change is spoken here, inside the dialog. Only a
|
|
865
993
|
// change after the flow opened is spoken.
|
|
866
994
|
const announcedResultCountRef = useRef(resultCountText);
|
|
867
|
-
// The latest result count, for Clear all's handler to read after its
|
|
868
|
-
// commit has flushed.
|
|
869
|
-
const latestResultCountRef = useRef(resultCountText);
|
|
870
|
-
useLayoutEffect(() => {
|
|
871
|
-
latestResultCountRef.current = resultCountText;
|
|
872
|
-
}, [resultCountText]);
|
|
873
995
|
useEffect(() => {
|
|
874
|
-
if (
|
|
996
|
+
if (resultCountText === announcedResultCountRef.current) {
|
|
875
997
|
return;
|
|
876
998
|
}
|
|
877
999
|
announcedResultCountRef.current = resultCountText;
|
|
@@ -1138,26 +1260,21 @@ export function PowerSearchBottomSheet({
|
|
|
1138
1260
|
// confirmation must be gone before focus moves into the sheet and the
|
|
1139
1261
|
// outcome is routed into the sheet's region, so its close is flushed
|
|
1140
1262
|
// first. The outcome is "Editable filters removed" while a read-only filter
|
|
1141
|
-
// remains, otherwise "All filters removed"
|
|
1142
|
-
//
|
|
1143
|
-
// sheet's first remaining control: a kept read-only row has none,
|
|
1144
|
-
// filter.
|
|
1263
|
+
// remains, otherwise "All filters removed"; the result count follows the
|
|
1264
|
+
// applied filters, which change on Done, so none changes here. Focus moves
|
|
1265
|
+
// to the sheet's first remaining control: a kept read-only row has none,
|
|
1266
|
+
// so Add filter.
|
|
1145
1267
|
const closeClearConfirmation = confirmed => {
|
|
1146
1268
|
const kept = filters.filter(filter => filter.isReadOnly);
|
|
1147
1269
|
const firstRemovedIndex = filters.findIndex(filter => !filter.isReadOnly);
|
|
1148
1270
|
const isClearing = confirmed && isInteractive && firstRemovedIndex >= 0;
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
});
|
|
1158
|
-
} finally {
|
|
1159
|
-
isClearingRef.current = false;
|
|
1160
|
-
}
|
|
1271
|
+
// eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves into the sheet and the words are routed into it
|
|
1272
|
+
flushSync(() => {
|
|
1273
|
+
setIsClearConfirmationOpen(false);
|
|
1274
|
+
if (isClearing) {
|
|
1275
|
+
onChange(kept, 'remove', firstRemovedIndex);
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1161
1278
|
if (!isClearing) {
|
|
1162
1279
|
clearAllButtonRef.current?.focus();
|
|
1163
1280
|
return;
|
|
@@ -1165,18 +1282,7 @@ export function PowerSearchBottomSheet({
|
|
|
1165
1282
|
managerAddButtonRef.current?.focus({
|
|
1166
1283
|
preventScroll: true
|
|
1167
1284
|
});
|
|
1168
|
-
|
|
1169
|
-
const changedCount = resultCount !== announcedResultCountRef.current ? resultCount : null;
|
|
1170
|
-
announcedResultCountRef.current = resultCount;
|
|
1171
|
-
if (kept.length > 0) {
|
|
1172
|
-
announce(changedCount == null ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.sheet.editableFiltersClearedWithCount', {
|
|
1173
|
-
resultCount: changedCount
|
|
1174
|
-
}));
|
|
1175
|
-
} else {
|
|
1176
|
-
announce(changedCount == null ? t('@astryx.powersearch.allFiltersRemoved') : t('@astryx.powersearch.sheet.filtersClearedWithCount', {
|
|
1177
|
-
resultCount: changedCount
|
|
1178
|
-
}));
|
|
1179
|
-
}
|
|
1285
|
+
announce(kept.length > 0 ? t('@astryx.powersearch.editableFiltersRemoved') : t('@astryx.powersearch.allFiltersRemoved'));
|
|
1180
1286
|
};
|
|
1181
1287
|
const handleOperatorSelect = useCallback(operator => {
|
|
1182
1288
|
setDraft(current => {
|
|
@@ -1270,20 +1376,20 @@ export function PowerSearchBottomSheet({
|
|
|
1270
1376
|
// Every step change goes through the handlers above.
|
|
1271
1377
|
const handleManageOpenChange = useCallback(isSheetOpen => {
|
|
1272
1378
|
if (!isSheetOpen && stepRef.current === 'manage') {
|
|
1273
|
-
|
|
1379
|
+
requestDismiss();
|
|
1274
1380
|
}
|
|
1275
|
-
}, [
|
|
1381
|
+
}, [requestDismiss]);
|
|
1276
1382
|
const handleFieldsOpenChange = useCallback(isSheetOpen => {
|
|
1277
1383
|
if (isSheetOpen || stepRef.current !== 'fields') {
|
|
1278
1384
|
return;
|
|
1279
1385
|
}
|
|
1280
1386
|
if (fieldPickerOrigin === 'trigger') {
|
|
1281
|
-
|
|
1387
|
+
requestDismiss();
|
|
1282
1388
|
return;
|
|
1283
1389
|
}
|
|
1284
1390
|
queueManagerAddFocus();
|
|
1285
1391
|
setStep('manage');
|
|
1286
|
-
}, [
|
|
1392
|
+
}, [fieldPickerOrigin, queueManagerAddFocus, requestDismiss]);
|
|
1287
1393
|
const handleValueOpenChange = useCallback(isSheetOpen => {
|
|
1288
1394
|
if (!isSheetOpen && stepRef.current === 'value') {
|
|
1289
1395
|
returnFromValue();
|
|
@@ -1510,7 +1616,7 @@ export function PowerSearchBottomSheet({
|
|
|
1510
1616
|
// action. Mounted only while the sheet is open, so its text
|
|
1511
1617
|
// is spoken in this sheet when it appears.
|
|
1512
1618
|
isManageSheetOpen && /*#__PURE__*/_jsx(EmptyState, {
|
|
1513
|
-
title: t('@astryx.powersearch.sheet.noFilters'),
|
|
1619
|
+
title: t(isDraftDirty ? '@astryx.powersearch.sheet.noFiltersInDraft' : '@astryx.powersearch.sheet.noFilters'),
|
|
1514
1620
|
description: t('@astryx.powersearch.sheet.noFiltersDescription'),
|
|
1515
1621
|
headingLevel: 4,
|
|
1516
1622
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -1574,7 +1680,7 @@ export function PowerSearchBottomSheet({
|
|
|
1574
1680
|
})
|
|
1575
1681
|
})
|
|
1576
1682
|
})
|
|
1577
|
-
}), filterRows.length > 0 && /*#__PURE__*/_jsxs("div", {
|
|
1683
|
+
}), (filterRows.length > 0 || isDraftDirty) && /*#__PURE__*/_jsxs("div", {
|
|
1578
1684
|
...{
|
|
1579
1685
|
className: "x1vjfegm x78zum5 x6s0dn4 x1qughib x1txdalj x8o8v82 x1pzlopt x10xzikg x1n2onr6 xdd4er5 x2lah0s"
|
|
1580
1686
|
},
|
|
@@ -1590,7 +1696,7 @@ export function PowerSearchBottomSheet({
|
|
|
1590
1696
|
variant: "primary",
|
|
1591
1697
|
size: "lg",
|
|
1592
1698
|
xstyle: isClearAllShown ? styles.footerEqualAction : [styles.footerSoleAction, styles.touchHitArea],
|
|
1593
|
-
onClick:
|
|
1699
|
+
onClick: commitAndClose,
|
|
1594
1700
|
width: isClearAllShown ? undefined : '100%'
|
|
1595
1701
|
})]
|
|
1596
1702
|
})]
|
|
@@ -1776,7 +1882,7 @@ export function PowerSearchBottomSheet({
|
|
|
1776
1882
|
variant: "primary",
|
|
1777
1883
|
width: "100%",
|
|
1778
1884
|
xstyle: styles.touchAction,
|
|
1779
|
-
onClick:
|
|
1885
|
+
onClick: commitAndClose
|
|
1780
1886
|
})
|
|
1781
1887
|
})]
|
|
1782
1888
|
})
|
|
@@ -1913,6 +2019,22 @@ export function PowerSearchBottomSheet({
|
|
|
1913
2019
|
actionLabel: t('@astryx.powersearch.sheet.clearAllConfirm'),
|
|
1914
2020
|
cancelLabel: t('@astryx.powersearch.sheet.clearAllCancel'),
|
|
1915
2021
|
onAction: () => closeClearConfirmation(true)
|
|
2022
|
+
}), isDiscardConfirmationOpen && /*#__PURE__*/_jsx(SheetConfirmation, {
|
|
2023
|
+
isOpen: true,
|
|
2024
|
+
onOpenChange: isConfirmationOpen => {
|
|
2025
|
+
if (!isConfirmationOpen) {
|
|
2026
|
+
closeDiscardConfirmation();
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
title: t('@astryx.powersearch.sheet.discardTitle'),
|
|
2030
|
+
description: t('@astryx.powersearch.sheet.discardDescription'),
|
|
2031
|
+
actionLabel: t('@astryx.powersearch.sheet.discardConfirm'),
|
|
2032
|
+
cancelLabel: t('@astryx.powersearch.sheet.keepEditing'),
|
|
2033
|
+
onAction: () => {
|
|
2034
|
+
setIsDiscardConfirmationOpen(false);
|
|
2035
|
+
draftEditsRef.current = [];
|
|
2036
|
+
closeFlow();
|
|
2037
|
+
}
|
|
1916
2038
|
})]
|
|
1917
2039
|
});
|
|
1918
2040
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/Resizable/ResizeHandle.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiB,SAAS,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"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R,MAAM,EACN,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAsSnB;yBArTe,YAAY"}
|
|
@@ -19,6 +19,7 @@ import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
|
19
19
|
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
20
20
|
import { getCollapseControls, getEffectiveMaxPx } from "./useResizable.js";
|
|
21
21
|
import { createResizeGesture } from "./resizeGesture.js";
|
|
22
|
+
import { separatorAttributes } from "./separatorAttributes.js";
|
|
22
23
|
import { themeProps } from "../utils/themeProps.js";
|
|
23
24
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
24
25
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
@@ -410,20 +411,25 @@ export function ResizeHandle({
|
|
|
410
411
|
}, [hasRegion, regionGesture]);
|
|
411
412
|
|
|
412
413
|
// --- ARIA ---
|
|
413
|
-
// When collapsed the panel's real size (0) sits below aria-valuemin, which
|
|
414
|
-
// is invalid per WCAG 4.1.2. Clamp aria-valuenow to the minimum and announce
|
|
415
|
-
// the true state via aria-valuetext instead; the valuetext is removed as
|
|
416
|
-
// soon as the panel expands so the numeric value reads again.
|
|
417
414
|
const sizeNow = resizable?._size;
|
|
418
415
|
const minNow = resizable?._minSizePx;
|
|
419
|
-
const ariaValueNow = sizeNow == null || minNow == null ? undefined : isCollapsed ? Math.max(sizeNow, minNow) : sizeNow;
|
|
420
|
-
const ariaValueMin = minNow;
|
|
421
416
|
// A separator with a value needs a maximum (WAI-ARIA, APG window splitter).
|
|
422
417
|
// Unbounded regions report the basis they can fill; a hand-built props
|
|
423
418
|
// object without it reports only a configured maximum.
|
|
424
419
|
const effectiveMax = resizable ? getEffectiveMaxPx(resizable) ?? (resizable._maxSizePx !== Infinity ? resizable._maxSizePx : undefined) : undefined;
|
|
425
|
-
|
|
426
|
-
|
|
420
|
+
// The attributes createResizable writes on a plain element, from the same
|
|
421
|
+
// derivation.
|
|
422
|
+
const aria = separatorAttributes({
|
|
423
|
+
direction,
|
|
424
|
+
isDisabled,
|
|
425
|
+
value: sizeNow == null || minNow == null ? undefined : {
|
|
426
|
+
size: sizeNow,
|
|
427
|
+
minPx: minNow,
|
|
428
|
+
maxPx: effectiveMax,
|
|
429
|
+
isCollapsed,
|
|
430
|
+
collapsedText: t('@astryx.resizable.collapsed')
|
|
431
|
+
}
|
|
432
|
+
});
|
|
427
433
|
|
|
428
434
|
// The Grip pill takes the pointer as the Grab zone does, so a pill drawn
|
|
429
435
|
// outside the zone still resizes.
|
|
@@ -447,14 +453,8 @@ export function ResizeHandle({
|
|
|
447
453
|
return /*#__PURE__*/_jsxs("div", {
|
|
448
454
|
ref: useMergedRefs(ref, handleRef),
|
|
449
455
|
role: "separator",
|
|
450
|
-
|
|
451
|
-
"aria-valuenow": ariaValueNow,
|
|
452
|
-
"aria-valuemin": ariaValueMin,
|
|
453
|
-
"aria-valuemax": ariaValueMax,
|
|
454
|
-
"aria-valuetext": ariaValueText,
|
|
456
|
+
...aria,
|
|
455
457
|
"aria-label": label,
|
|
456
|
-
"aria-disabled": isDisabled || undefined,
|
|
457
|
-
tabIndex: isDisabled ? -1 : 0,
|
|
458
458
|
onDoubleClick: () => {
|
|
459
459
|
if (!isDisabled) {
|
|
460
460
|
gesture?.doubleClick();
|