@gooddata/sdk-ui-kit 11.47.0-alpha.2 → 11.47.0-alpha.4
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/@ui/UiButton/UiButton.d.ts.map +1 -1
- package/esm/@ui/UiButton/UiButton.js +2 -1
- package/esm/@ui/UiCertificationIcon/UiCertificationIcon.d.ts +1 -1
- package/esm/@ui/UiCertificationIcon/UiCertificationIcon.d.ts.map +1 -1
- package/esm/@ui/UiCertificationIcon/UiCertificationIcon.js +2 -2
- package/esm/@ui/UiCertificationIcon/types.d.ts +2 -0
- package/esm/@ui/UiCertificationIcon/types.d.ts.map +1 -1
- package/esm/Dialog/ExportTabularPdfDialog.d.ts.map +1 -1
- package/esm/Dialog/ExportTabularPdfDialog.js +6 -6
- package/esm/Dropdown/DropdownButton.d.ts +2 -2
- package/esm/Dropdown/DropdownButton.d.ts.map +1 -1
- package/esm/Form/InputPure.d.ts +1 -1
- package/esm/Form/InputPure.d.ts.map +1 -1
- package/esm/Form/InputPure.js +9 -6
- package/esm/Form/InputWithNumberFormat.d.ts +4 -1
- package/esm/Form/InputWithNumberFormat.d.ts.map +1 -1
- package/esm/ParameterControl/NumberParameterControlDropdown.d.ts +37 -0
- package/esm/ParameterControl/NumberParameterControlDropdown.d.ts.map +1 -0
- package/esm/ParameterControl/NumberParameterControlDropdown.js +52 -0
- package/esm/ParameterControl/ParameterControl.d.ts +23 -0
- package/esm/ParameterControl/ParameterControl.d.ts.map +1 -0
- package/esm/ParameterControl/ParameterControl.js +21 -0
- package/esm/ParameterControl/ParameterControlButton.d.ts +2 -1
- package/esm/ParameterControl/ParameterControlButton.d.ts.map +1 -1
- package/esm/ParameterControl/ParameterControlDropdown.d.ts +12 -25
- package/esm/ParameterControl/ParameterControlDropdown.d.ts.map +1 -1
- package/esm/ParameterControl/ParameterControlDropdown.js +7 -54
- package/esm/ParameterControl/StringParameterControlDropdown.d.ts +28 -0
- package/esm/ParameterControl/StringParameterControlDropdown.d.ts.map +1 -0
- package/esm/ParameterControl/StringParameterControlDropdown.js +32 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -1
- package/esm/measureNumberFormat/customFormatDialog/previewSection/Preview.js +1 -1
- package/esm/sdk-ui-kit.d.ts +112 -23
- package/esm/syntaxHighlightingInput/YamlEditor.d.ts +36 -0
- package/esm/syntaxHighlightingInput/YamlEditor.d.ts.map +1 -0
- package/esm/syntaxHighlightingInput/YamlEditor.js +29 -0
- package/esm/syntaxHighlightingInput/hooks/useCodemirror.d.ts.map +1 -1
- package/esm/syntaxHighlightingInput/hooks/useCodemirror.js +3 -2
- package/esm/syntaxHighlightingInput/yamlSyntaxLinter.d.ts +12 -0
- package/esm/syntaxHighlightingInput/yamlSyntaxLinter.d.ts.map +1 -0
- package/esm/syntaxHighlightingInput/yamlSyntaxLinter.js +32 -0
- package/esm/typings/accessibility.d.ts +1 -0
- package/esm/typings/accessibility.d.ts.map +1 -1
- package/esm/typings/accessibility.js +1 -1
- package/esm/typings/utilities.d.ts.map +1 -1
- package/esm/typings/utilities.js +3 -0
- package/package.json +13 -11
- package/styles/css/form.css +3 -0
- package/styles/css/form.css.map +1 -1
- package/styles/css/main.css +11 -1
- package/styles/css/main.css.map +1 -1
- package/styles/css/syntaxHighlightingInput.css +8 -1
- package/styles/css/syntaxHighlightingInput.css.map +1 -1
- package/styles/scss/form.scss +3 -0
- package/styles/scss/syntaxHighlightingInput.scss +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiButton.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiButton/UiButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAIxF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"UiButton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AAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,4BAA4B,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAQD;;GAEG;AACH,eAAO,MAAM,QAAQ,8GAmFpB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2024-2026 GoodData Corporation
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { simplifyText } from "@gooddata/util";
|
|
5
|
+
import { accessibilityConfigToAttributes } from "../../typings/utilities.js";
|
|
5
6
|
import { bem } from "../@utils/bem.js";
|
|
6
7
|
import { UiIcon } from "../UiIcon/UiIcon.js";
|
|
7
8
|
const { b, e } = bem("gd-ui-kit-button");
|
|
@@ -24,6 +25,6 @@ export const UiButton = forwardRef(({ id, size = "medium", variant = "secondary"
|
|
|
24
25
|
hasIconBefore,
|
|
25
26
|
hasIconAfter,
|
|
26
27
|
isSelected: isSelected ?? false,
|
|
27
|
-
}), disabled: isDisabled, tabIndex: tabIndex, autoFocus: autoFocus, onClick: onClick, onKeyDown: onKeyDown, "data-id": dataId, "data-testid": testId,
|
|
28
|
+
}), disabled: isDisabled, tabIndex: tabIndex, autoFocus: autoFocus, onClick: onClick, onKeyDown: onKeyDown, "data-id": dataId, "data-testid": testId, ...accessibilityConfigToAttributes(accessibilityConfig), children: [iconBefore ? (_jsx(UiIcon, { type: iconBefore, size: iconBeforeSize, accessibilityConfig: { ariaHidden: accessibilityConfig?.iconAriaHidden }, disableAnimation: disableIconAnimation })) : null, _jsx("span", { className: e("text"), style: { maxWidth }, children: label }), badgeAfter !== undefined && typeof badgeAfter === "number" ? (_jsxs("span", { className: e("badge"), children: ["(", badgeAfter, ")"] })) : null, badgeAfter !== undefined && typeof badgeAfter === "string" ? (_jsx("span", { className: e("badge"), children: badgeAfter })) : null, iconAfter ? (_jsx(UiIcon, { type: iconAfter, size: iconAfterSize, accessibilityConfig: { ariaHidden: accessibilityConfig?.iconAriaHidden }, disableAnimation: disableIconAnimation })) : null] }));
|
|
28
29
|
});
|
|
29
30
|
UiButton.displayName = "UiButton";
|
|
@@ -2,5 +2,5 @@ import { type IUiCertificationIconProps } from "./types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare function UiCertificationIcon({ certification, accessibilityConfig }: IUiCertificationIconProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function UiCertificationIcon({ certification, size, tabIndex, accessibilityConfig }: IUiCertificationIconProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=UiCertificationIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiCertificationIcon.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiCertificationIcon/UiCertificationIcon.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAI5D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"UiCertificationIcon.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiCertificationIcon/UiCertificationIcon.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAI5D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAChC,aAAa,EACb,IAAI,EACJ,QAAY,EACZ,mBAAmB,EACtB,EAAE,yBAAyB,2CAsE3B"}
|
|
@@ -10,11 +10,11 @@ const { b, e } = bem("gd-ui-kit-certification-icon");
|
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
export function UiCertificationIcon({ certification, accessibilityConfig }) {
|
|
13
|
+
export function UiCertificationIcon({ certification, size, tabIndex = 0, accessibilityConfig, }) {
|
|
14
14
|
const intl = useIntl();
|
|
15
15
|
const tooltipId = useIdPrefixed("certification-tooltip");
|
|
16
16
|
const certificationAriaLabel = accessibilityConfig?.ariaLabel ?? intl.formatMessage({ id: "uiKit.certification.tooltip.title" });
|
|
17
|
-
const icon = (_jsx("span", { tabIndex:
|
|
17
|
+
const icon = (_jsx("span", { tabIndex: tabIndex, "aria-label": certificationAriaLabel, "aria-describedby": tooltipId, children: _jsx(UiIcon, { type: "certification", size: size ?? 16, backgroundSize: 26, color: "success", layout: "block", accessibilityConfig: { ariaHidden: true } }) }));
|
|
18
18
|
return (_jsx("div", { className: b(), children: _jsx(UiTooltip, { id: tooltipId, arrowPlacement: "top", optimalPlacement: true, triggerBy: ["hover", "focus"], variant: "none", showArrow: false, width: 200, offset: -6, anchor: icon, content: _jsxs("div", { className: e("tooltip"), children: [
|
|
19
19
|
_jsxs("div", { className: e("tooltip-header"), children: [
|
|
20
20
|
_jsx(UiIcon, { type: "certification", size: 14, color: "success", layout: "block" }), _jsx("span", { className: e("tooltip-title"), children: intl.formatMessage({ id: "uiKit.certification.tooltip.title" }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiCertificationIcon/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,aAAa,EAAE,gBAAgB,CAAC;IAChC,mBAAmB,CAAC,EAAE;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACL"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiCertificationIcon/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,aAAa,EAAE,gBAAgB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportTabularPdfDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/ExportTabularPdfDialog.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,4BAA4B,EAAuC,MAAM,cAAc,CAAC;AA0CtG;;GAEG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ExportTabularPdfDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/ExportTabularPdfDialog.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,4BAA4B,EAAuC,MAAM,cAAc,CAAC;AA0CtG;;GAEG;AACH,eAAO,MAAM,sBAAsB,oEA0KjC,CAAC"}
|
|
@@ -57,6 +57,8 @@ export const ExportTabularPdfDialog = memo(function ExportTabularPdfDialog({ dis
|
|
|
57
57
|
const orientationMenuItems = useMemo(() => getOrientationMenuItems(intl), [intl]);
|
|
58
58
|
const dialogId = useIdPrefixed("pdfExportDialog");
|
|
59
59
|
const showInfoPageId = useIdPrefixed("showInfoPage");
|
|
60
|
+
const pageSizeDropdownButtonId = useIdPrefixed("pageSizeDropdownButton");
|
|
61
|
+
const orientationDropdownButtonId = useIdPrefixed("orientationDropdownButton");
|
|
60
62
|
const handleSubmit = useCallback(() => {
|
|
61
63
|
onSubmit?.({
|
|
62
64
|
pageSize: selectedSize,
|
|
@@ -73,9 +75,8 @@ export const ExportTabularPdfDialog = memo(function ExportTabularPdfDialog({ dis
|
|
|
73
75
|
return (_jsx(Overlay, { alignPoints: alignPoints, isModal: true, positionType: "fixed", children: _jsxs(ConfirmDialogBase, { className: "gd-pdf-export-dialog", displayCloseButton: displayCloseButton, isPositive: isPositive, isSubmitDisabled: isSubmitDisabled, headline: intl.formatMessage({ id: "dialogs.export.pdf.headline" }), cancelButtonText: cancelButtonText || intl.formatMessage({ id: "cancel" }), submitButtonText: submitButtonText || intl.formatMessage({ id: "dialogs.export.submit" }), onCancel: onCancel, onSubmit: handleSubmit, autofocusOnOpen: true, accessibilityConfig: {
|
|
74
76
|
dialogId,
|
|
75
77
|
}, children: [
|
|
76
|
-
_jsxs("div", { className: "gd-pdf-export-dialog-item", children: [
|
|
77
|
-
_jsx("
|
|
78
|
-
ariaLabelledBy: "page-size-label",
|
|
78
|
+
_jsxs("div", { className: "gd-input gd-pdf-export-dialog-item", children: [
|
|
79
|
+
_jsx("label", { className: "gd-label", htmlFor: pageSizeDropdownButtonId, children: _jsx(FormattedMessage, { id: "dialogs.export.pdf.pageSize" }) }), _jsx(Dropdown, { fullscreenOnMobile: false, renderButton: ({ isOpen, toggleDropdown }) => (_jsx(DropdownButton, { id: pageSizeDropdownButtonId, value: pageSizeMenuItems.find((item) => item.data === selectedSize)?.stringTitle, isOpen: isOpen, onClick: toggleDropdown, accessibilityConfig: {
|
|
79
80
|
ariaHaspopup: "true",
|
|
80
81
|
ariaExpanded: isOpen,
|
|
81
82
|
...(isOpen ? { ariaControls: "page-size-menu" } : {}),
|
|
@@ -87,10 +88,9 @@ export const ExportTabularPdfDialog = memo(function ExportTabularPdfDialog({ dis
|
|
|
87
88
|
}, onClose: closeDropdown, shouldCloseOnSelect: true, ariaAttributes: {
|
|
88
89
|
"aria-label": "Page size options",
|
|
89
90
|
id: "page-size-menu",
|
|
90
|
-
}, maxWidth: 150 })), autofocusOnOpen: true })] }), _jsxs("div", { className: "gd-pdf-export-dialog-item", children: [
|
|
91
|
-
_jsx("
|
|
91
|
+
}, maxWidth: 150 })), autofocusOnOpen: true })] }), _jsxs("div", { className: "gd-input gd-pdf-export-dialog-item", children: [
|
|
92
|
+
_jsx("label", { className: "gd-label", htmlFor: orientationDropdownButtonId, children: _jsx(FormattedMessage, { id: "dialogs.export.pdf.pageOrientation" }) }), _jsx(Dropdown, { fullscreenOnMobile: false, renderButton: ({ isOpen, toggleDropdown }) => (_jsx(DropdownButton, { id: orientationDropdownButtonId, value: orientationMenuItems.find((item) => item.data === selectedOrientation)
|
|
92
93
|
?.stringTitle, isOpen: isOpen, onClick: toggleDropdown, accessibilityConfig: {
|
|
93
|
-
ariaLabelledBy: "orientation-label",
|
|
94
94
|
ariaHaspopup: "true",
|
|
95
95
|
ariaExpanded: isOpen,
|
|
96
96
|
...(isOpen ? { ariaControls: "orientation-menu" } : {}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type MouseEvent, type
|
|
1
|
+
import { type AriaAttributes, type MouseEvent, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { type IAccessibilityConfigBase } from "../typings/accessibility.js";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
@@ -19,7 +19,7 @@ export interface IDropdownButtonProps {
|
|
|
19
19
|
onClick?: (e: MouseEvent) => void;
|
|
20
20
|
children?: ReactNode;
|
|
21
21
|
dropdownId?: string;
|
|
22
|
-
buttonRef?:
|
|
22
|
+
buttonRef?: Ref<HTMLElement>;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../src/Dropdown/DropdownButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../src/Dropdown/DropdownButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAMvF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,wBAAwB,GAAG;QAAE,SAAS,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAA;KAAE,CAAC;IAEjG,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAElC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC3B,EAAE,EACF,SAAS,EACT,mBAAmB,EAEnB,KAAK,EACL,KAAa,EACb,QAAQ,EAER,MAAM,EACN,OAAc,EACd,QAAQ,EACR,WAAmB,EACnB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACZ,EAAE,oBAAoB,2CAuDtB"}
|
package/esm/Form/InputPure.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ export declare class InputPure extends PureComponent<IInputPureProps> implements
|
|
|
90
90
|
private getSuffixA11yId;
|
|
91
91
|
renderPrefix(prefix: string, ariaLabel?: string): ReactNode;
|
|
92
92
|
renderSuffix(suffix: string, ariaLabel?: string): ReactNode;
|
|
93
|
-
renderLabel(label: ReactNode): ReactNode;
|
|
93
|
+
renderLabel(label: ReactNode, htmlFor?: string): ReactNode;
|
|
94
94
|
renderSearch(isSearch: boolean): ReactNode;
|
|
95
95
|
renderClearIcon(clearOnEsc: boolean): ReactNode;
|
|
96
96
|
renderIconButton(iconButton: IconType, iconButtonLabel: string, onIconButtonClick: (e: MouseEvent<HTMLButtonElement>) => void): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPure.d.ts","sourceRoot":"","sources":["../../src/Form/InputPure.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,aAAa,EACb,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,KAAK,wBAAwB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G,IAAI,CAIjD;CACJ"}
|
package/esm/Form/InputPure.js
CHANGED
|
@@ -110,14 +110,14 @@ export class InputPure extends PureComponent {
|
|
|
110
110
|
return suffix ? (_jsxs(_Fragment, { children: [
|
|
111
111
|
_jsx("span", { className: "gd-input-suffix", "aria-hidden": "true", children: suffix }), ariaLabel ? (_jsx("span", { className: "sr-only", id: this.getSuffixA11yId(), children: ariaLabel })) : null] })) : (false);
|
|
112
112
|
}
|
|
113
|
-
renderLabel(label) {
|
|
114
|
-
return label ? _jsx("
|
|
113
|
+
renderLabel(label, htmlFor) {
|
|
114
|
+
return label ? (_jsx("label", { htmlFor: htmlFor, className: "gd-input-label", children: label })) : (false);
|
|
115
115
|
}
|
|
116
116
|
renderSearch(isSearch) {
|
|
117
117
|
return isSearch ? _jsx("span", { className: "gd-input-icon gd-icon-search" }) : false;
|
|
118
118
|
}
|
|
119
119
|
renderClearIcon(clearOnEsc) {
|
|
120
|
-
return clearOnEsc && this.props.value.length > 0 ? (_jsx("
|
|
120
|
+
return clearOnEsc && this.props.value.length > 0 ? (_jsx("button", { type: "button", className: "gd-input-icon-clear gd-icon-clear s-input-clear", "aria-label": "Input clear", onClick: (e) => {
|
|
121
121
|
// react events use delegation and don't bubble, click on clear needs to be kept local
|
|
122
122
|
// to avoid handling by overlay close handler and others
|
|
123
123
|
e.stopPropagation();
|
|
@@ -142,15 +142,18 @@ export class InputPure extends PureComponent {
|
|
|
142
142
|
return describedBy.length ? describedBy : undefined;
|
|
143
143
|
}
|
|
144
144
|
renderInput() {
|
|
145
|
-
const { clearOnEsc, disabled, isSearch, placeholder, prefix, readonly, suffix, maxlength, value, onBlur, onFocus,
|
|
145
|
+
const { clearOnEsc, disabled, isSearch, placeholder, prefix, readonly, suffix, maxlength, value, onBlur, onFocus, name, type, required, accessibilityConfig, autocomplete, iconButton, iconButtonLabel, onIconButtonClick, dataTestId, } = this.props;
|
|
146
146
|
return (_jsxs("div", { className: "gd-input-wrapper", children: [
|
|
147
147
|
_jsx("input", { ref: (ref) => {
|
|
148
148
|
this.inputNodeRef = ref;
|
|
149
|
-
}, type: type ?? "text", id:
|
|
149
|
+
}, type: type ?? "text", id: this.getA11yIdBase(), name: name, required: required, className: this.getInputClassNames(), disabled: disabled, maxLength: maxlength, onChange: this.onChange, onBlur: onBlur, onFocus: onFocus, onKeyDown: this.props.onKeyDown ?? this.onKeyPress, placeholder: placeholder, readOnly: readonly, value: value, role: accessibilityConfig?.role, "aria-label": accessibilityConfig?.ariaLabel ?? undefined, "aria-describedby": this.getAriaDescribedBy(), "aria-labelledby": accessibilityConfig?.ariaLabelledBy, "aria-expanded": accessibilityConfig?.ariaExpanded, "aria-controls": accessibilityConfig?.ariaControls, "aria-activedescendant": accessibilityConfig?.ariaActiveDescendant, "aria-readonly": readonly || undefined, "aria-autocomplete": accessibilityConfig?.ariaAutocomplete, "aria-invalid": accessibilityConfig?.ariaInvalid, autoComplete: isSearch ? "off" : autocomplete, "data-testid": dataTestId }), this.renderSearch(isSearch ?? false), this.renderClearIcon(clearOnEsc ?? false), this.renderPrefix(prefix ?? "", accessibilityConfig?.prefixAriaLabel), this.renderSuffix(suffix ?? "", accessibilityConfig?.suffixAriaLabel), this.renderIconButton(iconButton, iconButtonLabel ?? "", onIconButtonClick)] }));
|
|
150
150
|
}
|
|
151
151
|
render() {
|
|
152
152
|
const { className, label } = this.props;
|
|
153
|
-
|
|
153
|
+
if (label) {
|
|
154
|
+
return (_jsxs("div", { className: this.getLabelClassNames(className ?? ""), children: [this.renderLabel(label, this.getA11yIdBase()), this.renderInput()] }));
|
|
155
|
+
}
|
|
156
|
+
return _jsx("div", { className: this.getLabelClassNames(className ?? ""), children: this.renderInput() });
|
|
154
157
|
}
|
|
155
158
|
focus(options) {
|
|
156
159
|
if (this.inputNodeRef) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ChangeEvent } from "react";
|
|
1
2
|
import { type IInputPureProps } from "./InputPure.js";
|
|
2
3
|
import { type Separators } from "./typings.js";
|
|
3
4
|
export declare const MAX_NUMBER: number;
|
|
@@ -17,7 +18,9 @@ export interface IInputWithNumberFormatState {
|
|
|
17
18
|
/**
|
|
18
19
|
* @internal
|
|
19
20
|
*/
|
|
20
|
-
export interface IInputWithNumberFormatProps extends IInputWithNumberFormatOwnProps, IInputPureProps {
|
|
21
|
+
export interface IInputWithNumberFormatProps extends IInputWithNumberFormatOwnProps, Omit<IInputPureProps, "onChange"> {
|
|
22
|
+
/** Called with the parsed number; null when the input is cleared or holds no parseable value yet. */
|
|
23
|
+
onChange?: (value: number | null, e?: ChangeEvent<HTMLInputElement>) => void;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputWithNumberFormat.d.ts","sourceRoot":"","sources":["../../src/Form/InputWithNumberFormat.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputWithNumberFormat.d.ts","sourceRoot":"","sources":["../../src/Form/InputWithNumberFormat.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAsD,MAAM,OAAO,CAAC;AAI7F,OAAO,EAAE,KAAK,eAAe,EAAa,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,eAAO,MAAM,UAAU,QAAW,CAAC;AA6DnC;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,UAAU,CAAC,EAAE,UAAU,CAAC;CAC3B;AAED;;GAEG;AAEH,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AAEH,MAAM,WAAW,2BACb,SAAQ,8BAA8B,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACzE,qGAAqG;IACrG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAChF;AAUD;;GAEG;AACH,eAAO,MAAM,qBAAqB,mEAsEhC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type MessageDescriptor } from "react-intl";
|
|
2
|
+
import { type INumberParameterConstraints } from "@gooddata/sdk-model";
|
|
3
|
+
import { type IDropdownBodyRenderProps } from "../Dropdown/Dropdown.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface INumberParameterControlDropdownProps {
|
|
8
|
+
name: string;
|
|
9
|
+
value: number;
|
|
10
|
+
/**
|
|
11
|
+
* Workspace-default snapshot used by the Reset link. Reset is hidden when this is
|
|
12
|
+
* `undefined` or equals the current (valid) draft value. Reset writes this value into the
|
|
13
|
+
* draft input only; the user must click Apply to commit.
|
|
14
|
+
*/
|
|
15
|
+
resetValue?: number;
|
|
16
|
+
constraints?: INumberParameterConstraints;
|
|
17
|
+
inputId?: string;
|
|
18
|
+
ariaAttributes?: IDropdownBodyRenderProps["ariaAttributes"];
|
|
19
|
+
onApply: (value: number) => void;
|
|
20
|
+
onCancel: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Dropdown panel for editing a numeric parameter value. Owns the draft, inline validation,
|
|
24
|
+
* preview, and (mode-aware) Reset via `resetValue`.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function NumberParameterControlDropdown({ name, value, resetValue, constraints, inputId, ariaAttributes, onApply, onCancel }: INumberParameterControlDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the message to show for an invalid draft, or `undefined` when the draft is a valid
|
|
31
|
+
* in-range number. The single source of truth the dropdown derives its error row, input style,
|
|
32
|
+
* and Apply-disabled state from.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function getDraftValidationError(draft: string, constraints?: INumberParameterConstraints): MessageDescriptor | undefined;
|
|
37
|
+
//# sourceMappingURL=NumberParameterControlDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberParameterControlDropdown.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/NumberParameterControlDropdown.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,iBAAiB,EAAkB,MAAM,YAAY,CAAC;AAEtF,OAAO,EAAE,KAAK,2BAA2B,EAA+B,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAWxE;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,EAC3C,IAAI,EACJ,KAAK,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACX,EAAE,oCAAoC,2CA0BtC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,2BAA2B,GAC1C,iBAAiB,GAAG,SAAS,CAgB/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { FormattedMessage, defineMessages } from "react-intl";
|
|
5
|
+
import { isValidNumberParameterValue } from "@gooddata/sdk-model";
|
|
6
|
+
import { ParameterControlDropdown } from "./ParameterControlDropdown.js";
|
|
7
|
+
const messages = defineMessages({
|
|
8
|
+
errorNotANumber: { id: "parameter_filter.dropdown.error.notANumber" },
|
|
9
|
+
errorOutOfRange: { id: "parameter_filter.dropdown.error.outOfRange" },
|
|
10
|
+
errorOutOfRangeMin: { id: "parameter_filter.dropdown.error.outOfRange.min" },
|
|
11
|
+
errorOutOfRangeMax: { id: "parameter_filter.dropdown.error.outOfRange.max" },
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Dropdown panel for editing a numeric parameter value. Owns the draft, inline validation,
|
|
15
|
+
* preview, and (mode-aware) Reset via `resetValue`.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function NumberParameterControlDropdown({ name, value, resetValue, constraints, inputId, ariaAttributes, onApply, onCancel, }) {
|
|
20
|
+
const [draft, setDraft] = useState(String(value));
|
|
21
|
+
const error = getDraftValidationError(draft, constraints);
|
|
22
|
+
const effectiveValue = error ? value : parseDraft(draft);
|
|
23
|
+
const showReset = resetValue !== undefined && effectiveValue !== resetValue;
|
|
24
|
+
return (_jsx(ParameterControlDropdown, { name: name, draft: draft, onDraftChange: setDraft, inputProps: { type: "number", min: constraints?.min, max: constraints?.max }, inputId: inputId, ariaAttributes: ariaAttributes, errorMessage: error ? (_jsx(FormattedMessage, { ...error, values: { min: constraints?.min, max: constraints?.max } })) : undefined, previewValue: effectiveValue, onReset: showReset ? () => setDraft(String(resetValue)) : undefined, onApply: () => onApply(parseDraft(draft)), onCancel: onCancel }));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the message to show for an invalid draft, or `undefined` when the draft is a valid
|
|
28
|
+
* in-range number. The single source of truth the dropdown derives its error row, input style,
|
|
29
|
+
* and Apply-disabled state from.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export function getDraftValidationError(draft, constraints) {
|
|
34
|
+
const value = parseDraft(draft);
|
|
35
|
+
if (!Number.isFinite(value)) {
|
|
36
|
+
return messages.errorNotANumber;
|
|
37
|
+
}
|
|
38
|
+
if (isValidNumberParameterValue(value, constraints)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const { min, max } = constraints ?? {};
|
|
42
|
+
if (min !== undefined && max === undefined) {
|
|
43
|
+
return messages.errorOutOfRangeMin;
|
|
44
|
+
}
|
|
45
|
+
if (max !== undefined && min === undefined) {
|
|
46
|
+
return messages.errorOutOfRangeMax;
|
|
47
|
+
}
|
|
48
|
+
return messages.errorOutOfRange;
|
|
49
|
+
}
|
|
50
|
+
function parseDraft(draft) {
|
|
51
|
+
return draft.trim() === "" ? Number.NaN : Number(draft);
|
|
52
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type IParameterDefinition, type ParameterValue } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IDropdownBodyRenderProps } from "../Dropdown/Dropdown.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface IParameterControlProps {
|
|
7
|
+
name: string;
|
|
8
|
+
definition: IParameterDefinition;
|
|
9
|
+
value: ParameterValue;
|
|
10
|
+
resetValue?: ParameterValue;
|
|
11
|
+
inputId?: string;
|
|
12
|
+
ariaAttributes?: IDropdownBodyRenderProps["ariaAttributes"];
|
|
13
|
+
onApply: (value: ParameterValue) => void;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Selects the parameter editing control by `definition.type` — the single seam where control
|
|
18
|
+
* variants are dispatched. New parameter types get a sibling control and a new arm here.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function ParameterControl({ name, definition, value, resetValue, inputId, ariaAttributes, onApply, onCancel }: IParameterControlProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=ParameterControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterControl.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/ParameterControl.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAEtG,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAKxE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,oBAAoB,CAAC;IACjC,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACX,EAAE,sBAAsB,2CA+BxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { throwUnexpected } from "@gooddata/sdk-model";
|
|
4
|
+
import { NumberParameterControlDropdown } from "./NumberParameterControlDropdown.js";
|
|
5
|
+
import { StringParameterControlDropdown } from "./StringParameterControlDropdown.js";
|
|
6
|
+
/**
|
|
7
|
+
* Selects the parameter editing control by `definition.type` — the single seam where control
|
|
8
|
+
* variants are dispatched. New parameter types get a sibling control and a new arm here.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function ParameterControl({ name, definition, value, resetValue, inputId, ariaAttributes, onApply, onCancel, }) {
|
|
13
|
+
switch (definition.type) {
|
|
14
|
+
case "NUMBER":
|
|
15
|
+
return (_jsx(NumberParameterControlDropdown, { name: name, value: Number(value), resetValue: resetValue === undefined ? undefined : Number(resetValue), constraints: definition.constraints, inputId: inputId, ariaAttributes: ariaAttributes, onApply: onApply, onCancel: onCancel }));
|
|
16
|
+
case "STRING":
|
|
17
|
+
return (_jsx(StringParameterControlDropdown, { name: name, value: String(value), resetValue: resetValue === undefined ? undefined : String(resetValue), constraints: definition.constraints, inputId: inputId, ariaAttributes: ariaAttributes, onApply: onApply, onCancel: onCancel }));
|
|
18
|
+
default:
|
|
19
|
+
return throwUnexpected(definition);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ParameterValue } from "@gooddata/sdk-model";
|
|
1
2
|
/**
|
|
2
3
|
* @internal
|
|
3
4
|
*/
|
|
4
5
|
export interface IParameterControlButtonProps {
|
|
5
6
|
name: string;
|
|
6
|
-
value:
|
|
7
|
+
value: ParameterValue;
|
|
7
8
|
isActive: boolean;
|
|
8
9
|
isDraggable?: boolean;
|
|
9
10
|
isDragging?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterControlButton.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/ParameterControlButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParameterControlButton.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/ParameterControlButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAS1D;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACnC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACV,OAAO,EACP,SAAS,EACT,aAAa,EAAE,UAAU,EAC5B,EAAE,4BAA4B,2CAoB9B"}
|
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type ParameterValue } from "@gooddata/sdk-model";
|
|
3
3
|
import { type IDropdownBodyRenderProps } from "../Dropdown/Dropdown.js";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export interface IParameterControlDropdownProps {
|
|
8
8
|
name: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* `undefined` or equals `value`. Reset writes this value into the draft input only;
|
|
13
|
-
* the user must click Apply to commit.
|
|
14
|
-
*/
|
|
15
|
-
resetValue?: number;
|
|
16
|
-
constraints?: INumberParameterConstraints;
|
|
9
|
+
draft: string;
|
|
10
|
+
onDraftChange: (draft: string) => void;
|
|
11
|
+
inputProps?: Pick<ComponentPropsWithoutRef<"input">, "type" | "min" | "max">;
|
|
17
12
|
inputId?: string;
|
|
18
13
|
ariaAttributes?: IDropdownBodyRenderProps["ariaAttributes"];
|
|
19
|
-
|
|
14
|
+
errorMessage?: ReactNode;
|
|
15
|
+
previewValue: ParameterValue;
|
|
16
|
+
onReset?: () => void;
|
|
17
|
+
onApply: () => void;
|
|
20
18
|
onCancel: () => void;
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Reset is visible only when `resetValue` is set and differs from `value`; clicking it
|
|
27
|
-
* writes `resetValue` into the draft input only. The user must click Apply to commit.
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare function ParameterControlDropdown({ name, value, resetValue, constraints, inputId: inputIdProp, ariaAttributes, onApply, onCancel }: IParameterControlDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Returns the message to show for an invalid draft, or `undefined` when the draft is a valid
|
|
34
|
-
* in-range number. The single source of truth the dropdown derives its error row, input style,
|
|
35
|
-
* and Apply-disabled state from.
|
|
21
|
+
* Presentational dropdown shared by the parameter control variants; variants own the draft state,
|
|
22
|
+
* parsing, and validation.
|
|
36
23
|
*
|
|
37
24
|
* @internal
|
|
38
25
|
*/
|
|
39
|
-
export declare function
|
|
26
|
+
export declare function ParameterControlDropdown({ name, draft, onDraftChange, inputProps, inputId: inputIdProp, ariaAttributes, errorMessage, previewValue, onReset, onApply, onCancel }: IParameterControlDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
40
27
|
//# sourceMappingURL=ParameterControlDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterControlDropdown.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/ParameterControlDropdown.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParameterControlDropdown.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/ParameterControlDropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAaxE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC5D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,EAAE,cAAc,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,IAAI,EACJ,KAAK,EACL,aAAa,EACb,UAAU,EACV,OAAO,EAAE,WAAW,EACpB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACX,EAAE,8BAA8B,2CA4EhC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { useState } from "react";
|
|
4
2
|
import cx from "classnames";
|
|
5
3
|
import { FormattedMessage, defineMessages, useIntl } from "react-intl";
|
|
6
|
-
import { isValidNumberParameterValue } from "@gooddata/sdk-model";
|
|
7
4
|
import { bem } from "../@ui/@utils/bem.js";
|
|
8
5
|
import { UiButton } from "../@ui/UiButton/UiButton.js";
|
|
9
6
|
import { useId } from "../utils/useId.js";
|
|
@@ -14,72 +11,28 @@ const messages = defineMessages({
|
|
|
14
11
|
previewLabel: { id: "parameter_filter.dropdown.preview_label" },
|
|
15
12
|
apply: { id: "parameter_filter.dropdown.apply" },
|
|
16
13
|
cancel: { id: "cancel" },
|
|
17
|
-
errorNotANumber: { id: "parameter_filter.dropdown.error.notANumber" },
|
|
18
|
-
errorOutOfRange: { id: "parameter_filter.dropdown.error.outOfRange" },
|
|
19
|
-
errorOutOfRangeMin: { id: "parameter_filter.dropdown.error.outOfRange.min" },
|
|
20
|
-
errorOutOfRangeMax: { id: "parameter_filter.dropdown.error.outOfRange.max" },
|
|
21
14
|
});
|
|
22
15
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Reset is visible only when `resetValue` is set and differs from `value`; clicking it
|
|
27
|
-
* writes `resetValue` into the draft input only. The user must click Apply to commit.
|
|
16
|
+
* Presentational dropdown shared by the parameter control variants; variants own the draft state,
|
|
17
|
+
* parsing, and validation.
|
|
28
18
|
*
|
|
29
19
|
* @internal
|
|
30
20
|
*/
|
|
31
|
-
export function ParameterControlDropdown({ name,
|
|
21
|
+
export function ParameterControlDropdown({ name, draft, onDraftChange, inputProps, inputId: inputIdProp, ariaAttributes, errorMessage, previewValue, onReset, onApply, onCancel, }) {
|
|
32
22
|
const intl = useIntl();
|
|
33
23
|
const generatedInputId = useId();
|
|
34
24
|
const inputId = inputIdProp ?? generatedInputId;
|
|
35
|
-
const [draft, setDraft] = useState(String(value));
|
|
36
|
-
const error = getDraftValidationError(draft, constraints);
|
|
37
|
-
const effectiveValue = error ? value : parseDraft(draft);
|
|
38
|
-
const handleApply = () => {
|
|
39
|
-
if (error) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
onApply(parseDraft(draft));
|
|
43
|
-
};
|
|
44
|
-
const showReset = resetValue !== undefined && effectiveValue !== resetValue;
|
|
45
25
|
return (_jsxs("div", { ...ariaAttributes, className: `${b({ dropdown: true })} overlay gd-dialog gd-dropdown`, "data-testid": "parameter-control-dropdown", children: [
|
|
46
|
-
_jsxs("div", { className: cx(e("dropdown-field"), { "has-error": !!
|
|
26
|
+
_jsxs("div", { className: cx(e("dropdown-field"), { "has-error": !!errorMessage }), children: [
|
|
47
27
|
_jsxs("div", { className: e("dropdown-field-header"), children: [
|
|
48
|
-
_jsx("label", { htmlFor: inputId, className: e("dropdown-label"), children: intl.formatMessage(messages.valueLabel) }),
|
|
28
|
+
_jsx("label", { htmlFor: inputId, className: e("dropdown-label"), children: intl.formatMessage(messages.valueLabel) }), onReset ? (_jsx("button", { type: "button", className: e("dropdown-reset"), "data-testid": "parameter-control-dropdown-reset", onClick: onReset, children: intl.formatMessage(messages.reset) })) : null] }), _jsx("input", { ...inputProps, id: inputId, className: `${e("dropdown-input")} gd-input-field`, "data-testid": "parameter-control-dropdown-input", value: draft, onChange: (event) => onDraftChange(event.target.value) }), errorMessage ? (_jsx("div", { className: e("dropdown-error"), "data-testid": "parameter-control-dropdown-error", children: errorMessage })) : null] }), _jsx("div", { className: e("dropdown-divider") }), _jsxs("div", { className: e("dropdown-preview"), "data-testid": "parameter-control-dropdown-preview", children: [
|
|
49
29
|
_jsx("span", { className: e("dropdown-preview-label"), children: intl.formatMessage(messages.previewLabel) }), _jsx("span", { className: e("dropdown-preview-text"), children: _jsx(FormattedMessage, { id: "parameter_filter.dropdown.preview", values: {
|
|
50
30
|
name,
|
|
51
|
-
value:
|
|
31
|
+
value: previewValue,
|
|
52
32
|
strong: (chunks) => _jsx("strong", { children: chunks }),
|
|
53
33
|
} }) })
|
|
54
34
|
] }), _jsxs("div", { className: e("dropdown-footer"), children: [
|
|
55
|
-
_jsx(UiButton, { variant: "secondary", size: "small", label: intl.formatMessage(messages.cancel), dataTestId: "parameter-control-dropdown-cancel", onClick: onCancel }), _jsx(UiButton, { variant: "primary", size: "small", label: intl.formatMessage(messages.apply), dataTestId: "parameter-control-dropdown-apply", onClick:
|
|
35
|
+
_jsx(UiButton, { variant: "secondary", size: "small", label: intl.formatMessage(messages.cancel), dataTestId: "parameter-control-dropdown-cancel", onClick: onCancel }), _jsx(UiButton, { variant: "primary", size: "small", label: intl.formatMessage(messages.apply), dataTestId: "parameter-control-dropdown-apply", onClick: onApply, isDisabled: !!errorMessage })
|
|
56
36
|
] })
|
|
57
37
|
] }));
|
|
58
38
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Returns the message to show for an invalid draft, or `undefined` when the draft is a valid
|
|
61
|
-
* in-range number. The single source of truth the dropdown derives its error row, input style,
|
|
62
|
-
* and Apply-disabled state from.
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
export function getDraftValidationError(draft, constraints) {
|
|
67
|
-
const value = parseDraft(draft);
|
|
68
|
-
if (!Number.isFinite(value)) {
|
|
69
|
-
return messages.errorNotANumber;
|
|
70
|
-
}
|
|
71
|
-
if (isValidNumberParameterValue(value, constraints)) {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
const { min, max } = constraints ?? {};
|
|
75
|
-
if (min !== undefined && max === undefined) {
|
|
76
|
-
return messages.errorOutOfRangeMin;
|
|
77
|
-
}
|
|
78
|
-
if (max !== undefined && min === undefined) {
|
|
79
|
-
return messages.errorOutOfRangeMax;
|
|
80
|
-
}
|
|
81
|
-
return messages.errorOutOfRange;
|
|
82
|
-
}
|
|
83
|
-
function parseDraft(draft) {
|
|
84
|
-
return draft.trim() === "" ? Number.NaN : Number(draft);
|
|
85
|
-
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IStringParameterConstraints } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IDropdownBodyRenderProps } from "../Dropdown/Dropdown.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface IStringParameterControlDropdownProps {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* Workspace-default snapshot used by the Reset link. Reset is hidden when this is
|
|
11
|
+
* `undefined` or equals the current (valid) draft value. Reset writes this value into the
|
|
12
|
+
* draft input only; the user must click Apply to commit.
|
|
13
|
+
*/
|
|
14
|
+
resetValue?: string;
|
|
15
|
+
constraints?: IStringParameterConstraints;
|
|
16
|
+
inputId?: string;
|
|
17
|
+
ariaAttributes?: IDropdownBodyRenderProps["ariaAttributes"];
|
|
18
|
+
onApply: (value: string) => void;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Dropdown panel for editing a string parameter value as free text. Owns the draft, inline
|
|
23
|
+
* length validation, preview, and (mode-aware) Reset via `resetValue`.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function StringParameterControlDropdown({ name, value, resetValue, constraints, inputId, ariaAttributes, onApply, onCancel }: IStringParameterControlDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=StringParameterControlDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringParameterControlDropdown.d.ts","sourceRoot":"","sources":["../../src/ParameterControl/StringParameterControlDropdown.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,2BAA2B,EAA+B,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AASxE;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,EAC3C,IAAI,EACJ,KAAK,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACX,EAAE,oCAAoC,2CA6BtC"}
|