@gooddata/sdk-ui-filters 11.65.0-alpha.8 → 11.65.0-alpha.9
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/esm/DateFilter/DateFilterBody/DateFilterBody.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBody.js +5 -3
- package/esm/DateFilter/DateFilterBody/DateFilterFormContent.d.ts +1 -2
- package/esm/DateFilter/DateFilterBody/DateFilterFormContent.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterFormContent.js +7 -14
- package/esm/DateFilter/DateRangePicker/DateRangePicker.js +1 -1
- package/esm/DateFilter/PeriodRangePicker/AccessibleFieldInput.d.ts.map +1 -1
- package/esm/DateFilter/PeriodRangePicker/AccessibleFieldInput.js +3 -4
- package/esm/DateFilter/accessibility/keyboardNavigation.d.ts +3 -5
- package/esm/DateFilter/accessibility/keyboardNavigation.d.ts.map +1 -1
- package/esm/DateFilter/accessibility/keyboardNavigation.js +3 -5
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilterBody.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/DateFilterBody/DateFilterBody.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,YAAY,EACjB,KAAK,SAAS,EAMjB,MAAM,OAAO,CAAC;AAMf,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAKjB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAGjC,MAAM,wBAAwB,CAAC;AA4BhC,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,wBAAwB,CAAC;IACxC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,4BAA4B,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAA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E,gBAAgB,CAAC;IAEnC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,eAAO,MAAM,cAAc,iHA2czB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import cx from "classnames";
|
|
|
5
5
|
import { isEmpty } from "lodash-es";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import { isAbsoluteDateFilterForm, isAllTimeDateFilterOption, isEmptyValuesDateFilterOption, isRelativeDateFilterForm, } from "@gooddata/sdk-model";
|
|
8
|
-
import { useIdPrefixed } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
import { isEscapeKey, useIdPrefixed } from "@gooddata/sdk-ui-kit";
|
|
9
9
|
import { isEditableElement } from "../../shared/utils/domUtilities.js";
|
|
10
10
|
import { CheckboxSection } from "../CheckboxSection/CheckboxSection.js";
|
|
11
11
|
import { getDateFilterOptionGranularity } from "../utils/OptionUtils.js";
|
|
@@ -169,7 +169,9 @@ export const DateFilterBody = forwardRef((props, ref) => {
|
|
|
169
169
|
const hasFormOptions = !!(filterOptions.absoluteForm ||
|
|
170
170
|
(filterOptions.relativeForm && availableGranularities.length > 0));
|
|
171
171
|
const handleKeyDown = (e) => {
|
|
172
|
-
|
|
172
|
+
// In a form, Escape steps back to the option list like Back; from the list it closes the filter.
|
|
173
|
+
const isBackKey = isEscapeKey(e) || (e.key === "ArrowLeft" && !isEditableElement(e.target));
|
|
174
|
+
if (route && isBackKey) {
|
|
173
175
|
e.preventDefault();
|
|
174
176
|
e.stopPropagation();
|
|
175
177
|
handleBackNavigation();
|
|
@@ -193,7 +195,7 @@ export const DateFilterBody = forwardRef((props, ref) => {
|
|
|
193
195
|
return (_jsxs("div", { ref: rootRef, className: cx(!isMobile && "gd-extended-date-filter-body-redesigned", "gd-extended-date-filter-body", "s-extended-date-filters-body", isMobile && "gd-extended-date-filter-body-mobile", route && "gd-active-form"), onKeyDown: handleKeyDown, onFocus: handleFocus, role: "dialog", id: formId, "aria-label": formLabel, children: [route === null && isMobile ? (_jsx("div", { className: "gd-extended-date-filter-mobile-header", onClick: () => {
|
|
194
196
|
onCancelClick();
|
|
195
197
|
closeDropdown();
|
|
196
|
-
}, children: dateFilterButton })) : null, route ? (_jsx("div", { className: "gd-extended-date-filter-form-wrapper", ref: ref, children: _jsx(DateFilterFormContent, { filterOptions: filterOptions, selectedFilterOption: selectedFilterOption, onSelectedFilterOptionChange: onSelectedFilterOptionChange, dateFormat: dateFormat, weekStart: weekStart, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled: props.isAbsoluteDateFilterGranularityEnabled, availableGranularities: filteredAvailableGranularities, absoluteAvailableGranularities: filteredAbsoluteAvailableGranularities, isMobile: isMobile, withoutApply: withoutApply, enableEmptyDateValues: props.enableEmptyDateValues, customRangeHint: props.customRangeHint, onPeriodRangeValidityChange: setIsPeriodRangeValid, activeForm: route, onBackNavigation: handleBackNavigation,
|
|
198
|
+
}, children: dateFilterButton })) : null, route ? (_jsx("div", { className: "gd-extended-date-filter-form-wrapper", ref: ref, children: _jsx(DateFilterFormContent, { filterOptions: filterOptions, selectedFilterOption: selectedFilterOption, onSelectedFilterOptionChange: onSelectedFilterOptionChange, dateFormat: dateFormat, weekStart: weekStart, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled: props.isAbsoluteDateFilterGranularityEnabled, availableGranularities: filteredAvailableGranularities, absoluteAvailableGranularities: filteredAbsoluteAvailableGranularities, isMobile: isMobile, withoutApply: withoutApply, enableEmptyDateValues: props.enableEmptyDateValues, customRangeHint: props.customRangeHint, onPeriodRangeValidityChange: setIsPeriodRangeValid, activeForm: route, onBackNavigation: handleBackNavigation, submitForm: () => {
|
|
197
199
|
onApplyClick();
|
|
198
200
|
if (!withoutApply) {
|
|
199
201
|
closeDropdown();
|
|
@@ -20,7 +20,6 @@ export interface IDateFilterFormContentProps {
|
|
|
20
20
|
onPeriodRangeValidityChange?: (isValid: boolean) => void;
|
|
21
21
|
activeForm: DateFilterRoute;
|
|
22
22
|
onBackNavigation: () => void;
|
|
23
|
-
onClose: () => void;
|
|
24
23
|
submitForm: () => void;
|
|
25
24
|
errors?: IExtendedDateFilterErrors;
|
|
26
25
|
}
|
|
@@ -30,5 +29,5 @@ export interface IDateFilterFormContentProps {
|
|
|
30
29
|
*
|
|
31
30
|
* @internal
|
|
32
31
|
*/
|
|
33
|
-
export declare function DateFilterFormContent({ filterOptions, selectedFilterOption, onSelectedFilterOptionChange, dateFormat, weekStart, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled, availableGranularities, absoluteAvailableGranularities, isMobile, withoutApply, enableEmptyDateValues, customRangeHint, onPeriodRangeValidityChange, activeForm, onBackNavigation,
|
|
32
|
+
export declare function DateFilterFormContent({ filterOptions, selectedFilterOption, onSelectedFilterOptionChange, dateFormat, weekStart, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled, availableGranularities, absoluteAvailableGranularities, isMobile, withoutApply, enableEmptyDateValues, customRangeHint, onPeriodRangeValidityChange, activeForm, onBackNavigation, submitForm, errors, }: IDateFilterFormContentProps): import("react/jsx-runtime").JSX.Element;
|
|
34
33
|
//# sourceMappingURL=DateFilterFormContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilterFormContent.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/DateFilterBody/DateFilterFormContent.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"DateFilterFormContent.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/DateFilterBody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AChC,sCAAsC,EACtC,sBAAsB,EACtB,8BAA8B,EAC9B,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,2BAA2B,EAC3B,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,MAAM,GACT,EAAE,2BAA2B,2CA0I7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2025-2026 GoodData Corporation
|
|
3
|
-
import {
|
|
3
|
+
import { useRef } from "react";
|
|
4
4
|
import { isEmpty } from "lodash-es";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { isAbsoluteDateFilterForm, isAllTimeDateFilterOption, isEmptyValuesDateFilterOption, isRelativeDateFilterForm, } from "@gooddata/sdk-model";
|
|
@@ -11,22 +11,13 @@ import { DateFilterFormWrapper } from "../DateFilterFormWrapper/DateFilterFormWr
|
|
|
11
11
|
import { EmptyValuesHandlingToggle } from "../EmptyValuesHandlingToggle/EmptyValuesHandlingToggle.js";
|
|
12
12
|
import { RelativeDateFilterForm } from "../RelativeDateFilterForm/RelativeDateFilterForm.js";
|
|
13
13
|
import { DateFilterFormNavigationWrapper } from "./DateFilterFormNavigationWrapper.js";
|
|
14
|
-
/**
|
|
15
|
-
* Builds the keydown handler bound to a granularity tabs container, shared by the absolute and relative
|
|
16
|
-
* form's wrapper `<div>`s below - the only two consumers, hence a local hook rather than a shared export.
|
|
17
|
-
*/
|
|
18
|
-
function useGranularityTabsKeydownHandler(tabGranularityRef, closeDropdown) {
|
|
19
|
-
return useCallback((event) => {
|
|
20
|
-
createGranularityTabsKeyboardHandler({ tabGranularityRef, closeDropdown })(event);
|
|
21
|
-
}, [tabGranularityRef, closeDropdown]);
|
|
22
|
-
}
|
|
23
14
|
/**
|
|
24
15
|
* Component that renders the form content (absolute or relative) for date filter.
|
|
25
16
|
* This component is purely presentational and doesn't manage any navigation state.
|
|
26
17
|
*
|
|
27
18
|
* @internal
|
|
28
19
|
*/
|
|
29
|
-
export function DateFilterFormContent({ filterOptions, selectedFilterOption, onSelectedFilterOptionChange, dateFormat, weekStart, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled, availableGranularities, absoluteAvailableGranularities, isMobile, withoutApply, enableEmptyDateValues, customRangeHint, onPeriodRangeValidityChange, activeForm, onBackNavigation,
|
|
20
|
+
export function DateFilterFormContent({ filterOptions, selectedFilterOption, onSelectedFilterOptionChange, dateFormat, weekStart, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isAbsoluteDateFilterGranularityEnabled, availableGranularities, absoluteAvailableGranularities, isMobile, withoutApply, enableEmptyDateValues, customRangeHint, onPeriodRangeValidityChange, activeForm, onBackNavigation, submitForm, errors, }) {
|
|
30
21
|
const showStaticForm = activeForm === "absoluteForm" && filterOptions.absoluteForm;
|
|
31
22
|
const showRelativeForm = activeForm === "relativeForm" && filterOptions.relativeForm && availableGranularities.length > 0;
|
|
32
23
|
const absoluteSelectedFilterOption = filterOptions.absoluteForm && isAbsoluteDateFilterForm(selectedFilterOption)
|
|
@@ -46,8 +37,10 @@ export function DateFilterFormContent({ filterOptions, selectedFilterOption, onS
|
|
|
46
37
|
selectedFilterOption.emptyValueHandling !== "only";
|
|
47
38
|
const effectiveEmptyValueHandling = selectedFilterOption.emptyValueHandling ?? "exclude";
|
|
48
39
|
const emptyValueHandlingToggleChecked = effectiveEmptyValueHandling === "include";
|
|
49
|
-
const handleRelativeDateFilterKeydown =
|
|
50
|
-
const handleAbsoluteDateFilterKeydown =
|
|
40
|
+
const handleRelativeDateFilterKeydown = createGranularityTabsKeyboardHandler({ tabGranularityRef });
|
|
41
|
+
const handleAbsoluteDateFilterKeydown = createGranularityTabsKeyboardHandler({
|
|
42
|
+
tabGranularityRef: absoluteTabGranularityRef,
|
|
43
|
+
});
|
|
51
44
|
return (_jsxs("div", { className: "gd-date-filter-form-content", children: [showStaticForm ? (_jsx(DateFilterFormNavigationWrapper, { title: filterOptions.absoluteForm?.name
|
|
52
45
|
? filterOptions.absoluteForm.name
|
|
53
46
|
: intl.formatMessage({ id: "filters.staticPeriod" }), onBack: onBackNavigation, backLabel: intl.formatMessage({ id: "menu.back" }), isMobile: isMobile, children: _jsx("div", { onKeyDown: handleAbsoluteDateFilterKeydown, children: _jsxs(DateFilterFormWrapper, { isMobile: isMobile, children: [_jsx(AbsoluteDateFilterForm, { dateFormat: dateFormat, onSelectedFilterOptionChange: onSelectedFilterOptionChange, selectedFilterOption: absoluteSelectedFilterOption, isMobile: isMobile, isTimeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsEnabled: isSecondsForAbsoluteRangeEnabled, isGranularityEnabled: isAbsoluteDateFilterGranularityEnabled, availableGranularities: absoluteAvailableGranularities, accessibilityConfig: { id: absoluteDateFilterId }, weekStart: weekStart, submitForm: submitForm, withoutApply: withoutApply, customRangeHint: customRangeHint, onPeriodRangeValidityChange: onPeriodRangeValidityChange, granularityTabsRef: absoluteTabGranularityRef }), shouldRenderEmptyValuesHandling ? (_jsx(EmptyValuesHandlingToggle, { mode: "include", className: "gd-date-filter-empty-values-handling-toggle", checked: emptyValueHandlingToggleChecked, onChange: (checked) => {
|
|
@@ -58,7 +51,7 @@ export function DateFilterFormContent({ filterOptions, selectedFilterOption, onS
|
|
|
58
51
|
});
|
|
59
52
|
} })) : null] }) }) })) : null, showRelativeForm ? (_jsx(DateFilterFormNavigationWrapper, { title: filterOptions.relativeForm?.name
|
|
60
53
|
? filterOptions.relativeForm.name
|
|
61
|
-
: intl.formatMessage({ id: "filters.floatingRange" }), onBack: onBackNavigation, backLabel: intl.formatMessage({ id: "menu.back" }), isMobile: isMobile, children: _jsx("div", { onKeyDown: handleRelativeDateFilterKeydown, children: _jsxs(DateFilterFormWrapper, { isMobile: isMobile, children: [_jsx(RelativeDateFilterForm, { onSelectedFilterOptionChange: onSelectedFilterOptionChange, selectedFilterOption: relativeSelectedFilterOption, availableGranularities: availableGranularities, isMobile: isMobile, ref: tabGranularityRef, relativeDateFilterId: relativeDateFilterId, onKeyDown: (event) => submitRelativeDateFilterForm(event, isEmpty(errors), withoutApply ?? false,
|
|
54
|
+
: intl.formatMessage({ id: "filters.floatingRange" }), onBack: onBackNavigation, backLabel: intl.formatMessage({ id: "menu.back" }), isMobile: isMobile, children: _jsx("div", { onKeyDown: handleRelativeDateFilterKeydown, children: _jsxs(DateFilterFormWrapper, { isMobile: isMobile, children: [_jsx(RelativeDateFilterForm, { onSelectedFilterOptionChange: onSelectedFilterOptionChange, selectedFilterOption: relativeSelectedFilterOption, availableGranularities: availableGranularities, isMobile: isMobile, ref: tabGranularityRef, relativeDateFilterId: relativeDateFilterId, onKeyDown: (event) => submitRelativeDateFilterForm(event, isEmpty(errors), withoutApply ?? false, submitForm) }), shouldRenderEmptyValuesHandling ? (_jsx(EmptyValuesHandlingToggle, { mode: "include", className: "gd-date-filter-empty-values-handling-toggle", checked: emptyValueHandlingToggleChecked, onChange: (checked) => {
|
|
62
55
|
const emptyValueHandling = checked ? "include" : undefined;
|
|
63
56
|
onSelectedFilterOptionChange({
|
|
64
57
|
...relativeSelectedFilterOption,
|
|
@@ -33,7 +33,7 @@ const useCalendarPopup = () => {
|
|
|
33
33
|
const onDateInputKeyDown = useCallback((e) => {
|
|
34
34
|
if (isOpen && (e.key === "Escape" || e.key === "Tab")) {
|
|
35
35
|
setIsOpen(false);
|
|
36
|
-
e.stopPropagation(); //
|
|
36
|
+
e.stopPropagation(); // only the calendar closes, the form stays open
|
|
37
37
|
}
|
|
38
38
|
}, [isOpen]);
|
|
39
39
|
const closeCalendarPopup = useCallback(() => setIsOpen(false), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessibleFieldInput.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/PeriodRangePicker/AccessibleFieldInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,mBAAmB,EAO3B,MAAM,OAAO,CAAC;AAMf,UAAU,0BAA2B,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC9E,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"AccessibleFieldInput.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/PeriodRangePicker/AccessibleFieldInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,mBAAmB,EAO3B,MAAM,OAAO,CAAC;AAMf,UAAU,0BAA2B,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC9E,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,yHAmH/B,CAAC"}
|
|
@@ -81,10 +81,9 @@ export const AccessibleFieldInput = forwardRef((props, ref) => {
|
|
|
81
81
|
e.stopPropagation();
|
|
82
82
|
}
|
|
83
83
|
// rc-picker already closes its own calendar on Escape internally; without this, the event keeps
|
|
84
|
-
// bubbling up to
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
// handles natively, never also reaches that outer handler's own key routing.
|
|
84
|
+
// bubbling up to DateFilterBody, which would also step the form back to the option list. The Tab
|
|
85
|
+
// branch is a deliberate extra guard so Tab-ing between the two fields, which the browser handles
|
|
86
|
+
// natively, never also reaches the outer handlers' own key routing.
|
|
88
87
|
if (isCalendarOpen && (e.key === "Escape" || e.key === "Tab")) {
|
|
89
88
|
e.stopPropagation();
|
|
90
89
|
}
|
|
@@ -18,8 +18,6 @@ interface IDateFilterKeyboardNavigationConfig {
|
|
|
18
18
|
interface IGranularityTabsKeyboardNavigationConfig {
|
|
19
19
|
/** Reference to the granularity tabs element */
|
|
20
20
|
tabGranularityRef: MutableRefObject<HTMLDivElement | null>;
|
|
21
|
-
/** Callback to close the dropdown */
|
|
22
|
-
closeDropdown?: () => void;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
* Creates a keyboard event handler for the date filter component
|
|
@@ -31,11 +29,11 @@ export declare const createDateFilterKeyboardHandler: ({ dateFilterContainerRef,
|
|
|
31
29
|
/**
|
|
32
30
|
* Creates a keyboard event handler for a granularity tabs element, shared by the relative and absolute
|
|
33
31
|
* date filter forms.
|
|
34
|
-
* @param config - Configuration object containing
|
|
32
|
+
* @param config - Configuration object containing the granularity tabs ref
|
|
35
33
|
* @returns Keyboard event handler function
|
|
36
34
|
* @internal
|
|
37
35
|
*/
|
|
38
|
-
export declare const createGranularityTabsKeyboardHandler: ({ tabGranularityRef,
|
|
39
|
-
export declare const submitRelativeDateFilterForm: (event: KeyboardEvent, canSubmit: boolean, withoutApply: boolean,
|
|
36
|
+
export declare const createGranularityTabsKeyboardHandler: ({ tabGranularityRef, }: IGranularityTabsKeyboardNavigationConfig) => (event: KeyboardEvent) => void;
|
|
37
|
+
export declare const submitRelativeDateFilterForm: (event: KeyboardEvent, canSubmit: boolean, withoutApply: boolean, submit: () => void) => void;
|
|
40
38
|
export {};
|
|
41
39
|
//# sourceMappingURL=keyboardNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardNavigation.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/accessibility/keyboardNavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAYlE;;;GAGG;AACH,UAAU,mCAAmC;IACzC,qDAAqD;IACrD,sBAAsB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChE,gDAAgD;IAChD,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,UAAU,wCAAwC;IAC9C,gDAAgD;IAChD,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"keyboardNavigation.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/accessibility/keyboardNavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAYlE;;;GAGG;AACH,UAAU,mCAAmC;IACzC,qDAAqD;IACrD,sBAAsB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChE,gDAAgD;IAChD,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,UAAU,wCAAwC;IAC9C,gDAAgD;IAChD,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC9D;AA+DD;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,iEACuB,mCAAmC,aAC1F,aAAa,KAAG,IAoDvB,CAAC;AAEN;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,2BAE9C,wCAAwC,aACxB,aAAa,KAAG,IAwClC,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAC9B,aAAa,aACT,OAAO,gBACJ,OAAO,UACb,MAAM,IAAI,SAYrB,CAAC"}
|
|
@@ -101,11 +101,11 @@ export const createDateFilterKeyboardHandler = ({ dateFilterContainerRef, dateFi
|
|
|
101
101
|
/**
|
|
102
102
|
* Creates a keyboard event handler for a granularity tabs element, shared by the relative and absolute
|
|
103
103
|
* date filter forms.
|
|
104
|
-
* @param config - Configuration object containing
|
|
104
|
+
* @param config - Configuration object containing the granularity tabs ref
|
|
105
105
|
* @returns Keyboard event handler function
|
|
106
106
|
* @internal
|
|
107
107
|
*/
|
|
108
|
-
export const createGranularityTabsKeyboardHandler = ({ tabGranularityRef,
|
|
108
|
+
export const createGranularityTabsKeyboardHandler = ({ tabGranularityRef, }) => {
|
|
109
109
|
return (event) => {
|
|
110
110
|
if (!tabGranularityRef.current) {
|
|
111
111
|
return;
|
|
@@ -138,17 +138,15 @@ export const createGranularityTabsKeyboardHandler = ({ tabGranularityRef, closeD
|
|
|
138
138
|
lastElement?.focus();
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
-
onClose: closeDropdown,
|
|
142
141
|
});
|
|
143
142
|
keyboardHandler(event);
|
|
144
143
|
};
|
|
145
144
|
};
|
|
146
|
-
export const submitRelativeDateFilterForm = (event, canSubmit, withoutApply,
|
|
145
|
+
export const submitRelativeDateFilterForm = (event, canSubmit, withoutApply, submit) => {
|
|
147
146
|
if (event.key === "Enter") {
|
|
148
147
|
const canSubmitForm = canSubmit && document.activeElement instanceof HTMLInputElement;
|
|
149
148
|
if (canSubmitForm && !withoutApply) {
|
|
150
149
|
submit();
|
|
151
|
-
onSubmit();
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
if (event.key !== "Escape") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-filters",
|
|
3
|
-
"version": "11.65.0-alpha.
|
|
3
|
+
"version": "11.65.0-alpha.9",
|
|
4
4
|
"description": "GoodData.UI SDK - Filter Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"ts-invariant": "0.10.3",
|
|
48
48
|
"tslib": "2.8.1",
|
|
49
49
|
"uuid": "11.1.1",
|
|
50
|
-
"@gooddata/sdk-backend-spi": "11.65.0-alpha.
|
|
51
|
-
"@gooddata/sdk-
|
|
52
|
-
"@gooddata/sdk-ui": "11.65.0-alpha.
|
|
53
|
-
"@gooddata/sdk-
|
|
54
|
-
"@gooddata/util": "11.65.0-alpha.
|
|
50
|
+
"@gooddata/sdk-backend-spi": "11.65.0-alpha.9",
|
|
51
|
+
"@gooddata/sdk-ui": "11.65.0-alpha.9",
|
|
52
|
+
"@gooddata/sdk-ui-kit": "11.65.0-alpha.9",
|
|
53
|
+
"@gooddata/sdk-model": "11.65.0-alpha.9",
|
|
54
|
+
"@gooddata/util": "11.65.0-alpha.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@microsoft/api-documenter": "7.30.16",
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"stylelint": "16.26.1",
|
|
90
90
|
"typescript": "7.0.2",
|
|
91
91
|
"vitest": "5.0.4",
|
|
92
|
-
"@gooddata/eslint-config": "11.65.0-alpha.
|
|
93
|
-
"@gooddata/oxlint-config": "11.65.0-alpha.
|
|
94
|
-
"@gooddata/reference-workspace": "11.65.0-alpha.
|
|
95
|
-
"@gooddata/sdk-backend-mockingbird": "11.65.0-alpha.
|
|
96
|
-
"@gooddata/sdk-ui-theme-provider": "11.65.0-alpha.
|
|
97
|
-
"@gooddata/stylelint-config": "11.65.0-alpha.
|
|
92
|
+
"@gooddata/eslint-config": "11.65.0-alpha.9",
|
|
93
|
+
"@gooddata/oxlint-config": "11.65.0-alpha.9",
|
|
94
|
+
"@gooddata/reference-workspace": "11.65.0-alpha.9",
|
|
95
|
+
"@gooddata/sdk-backend-mockingbird": "11.65.0-alpha.9",
|
|
96
|
+
"@gooddata/sdk-ui-theme-provider": "11.65.0-alpha.9",
|
|
97
|
+
"@gooddata/stylelint-config": "11.65.0-alpha.9"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"react": "^18.0.0 || ^19.0.0",
|