@gooddata/sdk-ui-kit 11.65.0-alpha.9 → 11.65.1
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/README.md +1 -1
- package/esm/@ui/UiButton/UiButton.d.ts +4 -0
- package/esm/@ui/UiButton/UiButton.d.ts.map +1 -1
- package/esm/@ui/UiButton/UiButton.js +14 -2
- package/esm/@ui/UiConfigEditor/UiConfigEditor.d.ts +1 -1
- package/esm/@ui/UiConfigEditor/UiConfigEditor.d.ts.map +1 -1
- package/esm/@ui/UiConfigEditor/UiConfigEditor.js +34 -10
- package/esm/@ui/UiConfigEditor/configEditorWarnings.d.ts +10 -0
- package/esm/@ui/UiConfigEditor/configEditorWarnings.d.ts.map +1 -0
- package/esm/@ui/UiConfigEditor/configEditorWarnings.js +42 -0
- package/esm/@ui/UiConfigEditor/types.d.ts +24 -0
- package/esm/@ui/UiConfigEditor/types.d.ts.map +1 -1
- package/esm/@ui/UiToast/UiToastProvider.d.ts +8 -1
- package/esm/@ui/UiToast/UiToastProvider.d.ts.map +1 -1
- package/esm/@ui/UiToast/UiToastProvider.js +35 -5
- package/esm/@ui/UiToast/UiToastsContainer.d.ts.map +1 -1
- package/esm/@ui/UiToast/UiToastsContainer.js +6 -2
- package/esm/Button/Button.js +3 -3
- package/esm/Dialog/ShareDialog/ShareDialogBase/ShareLink.js +1 -1
- package/esm/Dialog/ShareDialog/types.d.ts +2 -2
- package/esm/Header/HeaderHelp.d.ts.map +1 -1
- package/esm/Header/HeaderHelp.js +1 -4
- package/esm/Header/generateHeaderMenuItemsGroups.js +3 -3
- package/esm/Messages/toasts/ToastsCenter.d.ts.map +1 -1
- package/esm/Messages/toasts/ToastsCenter.js +2 -2
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/locales.d.ts +10 -0
- package/esm/locales.d.ts.map +1 -1
- package/esm/locales.js +6 -0
- package/esm/sdk-ui-kit.d.ts +49 -4
- package/package.json +11 -11
- package/src/@ui/UiButton/UiButton.scss +18 -0
- package/src/@ui/UiToast/UiToast.scss +1 -1
- package/src/@ui/defaultTheme.scss +1 -0
- package/styles/css/main.css +16 -1
- package/styles/css/main.css.map +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,6 @@ These components are all marked as internal, and we do not recommend using them
|
|
|
13
13
|
|
|
14
14
|
## License
|
|
15
15
|
|
|
16
|
-
(C) 2017-
|
|
16
|
+
(C) 2017-2026 GoodData Corporation
|
|
17
17
|
|
|
18
18
|
This project is under MIT License. See [LICENSE](https://github.com/gooddata/gooddata-ui-sdk/blob/master/libs/sdk-ui-kit/LICENSE).
|
|
@@ -25,7 +25,11 @@ export interface IUiButtonProps {
|
|
|
25
25
|
label: string;
|
|
26
26
|
type?: "button" | "submit" | "reset";
|
|
27
27
|
isDisabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Doesn't do anything. Use `isPending` instead.
|
|
30
|
+
*/
|
|
28
31
|
isLoading?: boolean;
|
|
32
|
+
isPending?: boolean;
|
|
29
33
|
isSelected?: boolean;
|
|
30
34
|
tooltip?: ReactNode;
|
|
31
35
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -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;
|
|
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;AAQxF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,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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,8GA6FpB,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
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
|
+
import { useIntl } from "react-intl";
|
|
4
5
|
import { simplifyText } from "@gooddata/util";
|
|
6
|
+
import { LoadingSpinner } from "../../LoadingSpinner/LoadingSpinner.js";
|
|
7
|
+
import { uiButtonMessages } from "../../locales.js";
|
|
5
8
|
import { accessibilityConfigToAttributes } from "../../typings/utilities.js";
|
|
6
9
|
import { bem } from "../@utils/bem.js";
|
|
7
10
|
import { UiIcon } from "../UiIcon/UiIcon.js";
|
|
@@ -12,7 +15,7 @@ const getGeneratedTestId = (label, ariaLabel) => {
|
|
|
12
15
|
/**
|
|
13
16
|
* @internal
|
|
14
17
|
*/
|
|
15
|
-
export const UiButton = forwardRef(({ id, size = "medium", variant = "secondary", tabIndex = 0, label, type, isDisabled, isSelected, isLoading, disableIconAnimation, iconBefore, iconBeforeSize: iconBeforeSizeProp, iconAfter, iconAfterSize: iconAfterSizeProp, badgeAfter, onClick, onKeyDown, dataId, dataTestId, accessibilityConfig, maxWidth, autoFocus, }, ref) => {
|
|
18
|
+
export const UiButton = forwardRef(({ id, size = "medium", variant = "secondary", tabIndex = 0, label, type, isDisabled, isSelected, isLoading, isPending, disableIconAnimation, iconBefore, iconBeforeSize: iconBeforeSizeProp, iconAfter, iconAfterSize: iconAfterSizeProp, badgeAfter, onClick, onKeyDown, dataId, dataTestId, accessibilityConfig, maxWidth, autoFocus, }, ref) => {
|
|
16
19
|
const iconBeforeSize = iconBeforeSizeProp ?? (size === "small" ? 16 : 18);
|
|
17
20
|
const iconAfterSize = iconAfterSizeProp ?? (size === "small" ? 16 : 18);
|
|
18
21
|
const hasIconBefore = !!iconBefore;
|
|
@@ -22,9 +25,18 @@ export const UiButton = forwardRef(({ id, size = "medium", variant = "secondary"
|
|
|
22
25
|
size,
|
|
23
26
|
variant,
|
|
24
27
|
isLoading: isLoading ?? false,
|
|
28
|
+
isPending: isPending ?? false,
|
|
25
29
|
hasIconBefore,
|
|
26
30
|
hasIconAfter,
|
|
27
31
|
isSelected: isSelected ?? false,
|
|
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"), "data-testid": `${testId}-label`, style: { maxWidth }, children: label }), badgeAfter !== undefined && typeof badgeAfter === "number" ? (_jsxs("span", { className: e("badge-number"), "data-testid": `${testId}-badge`, children: ["(", badgeAfter, ")"] })) : null, badgeAfter !== undefined && typeof badgeAfter === "string" ? (_jsx("span", { className: e("badge-text"), "data-testid": `${testId}-badge`, children: badgeAfter })) : null, iconAfter ? (_jsx(UiIcon, { type: iconAfter, size: iconAfterSize, accessibilityConfig: { ariaHidden: accessibilityConfig?.iconAriaHidden }, disableAnimation: disableIconAnimation })) : null] }));
|
|
32
|
+
}), disabled: isPending ? false : isDisabled, "aria-disabled": isPending || undefined, tabIndex: tabIndex, autoFocus: autoFocus, onClick: isPending ? (e) => e.preventDefault() : 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"), "data-testid": `${testId}-label`, style: { maxWidth }, children: label }), badgeAfter !== undefined && typeof badgeAfter === "number" ? (_jsxs("span", { className: e("badge-number"), "data-testid": `${testId}-badge`, children: ["(", badgeAfter, ")"] })) : null, badgeAfter !== undefined && typeof badgeAfter === "string" ? (_jsx("span", { className: e("badge-text"), "data-testid": `${testId}-badge`, children: badgeAfter })) : null, iconAfter ? (_jsx(UiIcon, { type: iconAfter, size: iconAfterSize, accessibilityConfig: { ariaHidden: accessibilityConfig?.iconAriaHidden }, disableAnimation: disableIconAnimation })) : null, isPending ? _jsx(UiButtonPendingIndicator, {}) : null] }));
|
|
29
33
|
});
|
|
30
34
|
UiButton.displayName = "UiButton";
|
|
35
|
+
/**
|
|
36
|
+
* Extracted into a component because many current tests do not hook up `<IntlProvider />` in them
|
|
37
|
+
* (or do not use global `render()` function). `useIntl()` would otherwise throw there.
|
|
38
|
+
*/
|
|
39
|
+
function UiButtonPendingIndicator() {
|
|
40
|
+
const intl = useIntl();
|
|
41
|
+
return (_jsx("span", { className: e("pending-indicator"), role: "progressbar", "aria-label": intl.formatMessage(uiButtonMessages.pending), children: _jsx(LoadingSpinner, { className: "small", color: "currentColor" }) }));
|
|
42
|
+
}
|
|
@@ -16,5 +16,5 @@ import { type IUiConfigEditorProps } from "./types.js";
|
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
export declare function UiConfigEditor({ value, onChange, primaryLanguage, languages, language, onLanguageChange, completionSource, labels, renderContextMenu, label, placeholder, readOnly, disabled, rows, dataTestId, editorRef, }: IUiConfigEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function UiConfigEditor({ value, onChange, primaryLanguage, languages, language, onLanguageChange, completionSource, labels, warnings, renderContextMenu, label, placeholder, readOnly, disabled, rows, dataTestId, editorRef, }: IUiConfigEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
//# sourceMappingURL=UiConfigEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiConfigEditor.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/UiConfigEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UiConfigEditor.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/UiConfigEditor.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,eAAwB,EACxB,SAA4B,EAC5B,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,IAAS,EACT,UAAU,EACV,SAAS,GACZ,EAAE,oBAAoB,2CAuStB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
-
import { forceLinting, lintGutter } from "@codemirror/lint";
|
|
4
|
+
import { forceLinting, lintGutter, linter } from "@codemirror/lint";
|
|
5
5
|
import { Compartment } from "@codemirror/state";
|
|
6
6
|
import { lineNumbers } from "@codemirror/view";
|
|
7
|
+
import { isEqual } from "lodash-es";
|
|
8
|
+
import { useAutoupdateRef } from "@gooddata/sdk-ui";
|
|
7
9
|
import { createSyntaxErrorLinter } from "../../syntaxHighlightingInput/syntaxErrorLinter.js";
|
|
8
10
|
import { SyntaxHighlightingInput } from "../../syntaxHighlightingInput/SyntaxHighlightingInput.js";
|
|
9
11
|
import { yamlPositionAt } from "../../syntaxHighlightingInput/yamlPosition.js";
|
|
@@ -12,6 +14,7 @@ import { useLanguageGrammar } from "./configEditorGrammars.js";
|
|
|
12
14
|
import { themedHighlightStyle } from "./configEditorHighlighting.js";
|
|
13
15
|
import { beautify, convertText, isProjectable } from "./configEditorLanguage.js";
|
|
14
16
|
import { ConfigEditorToolbar } from "./ConfigEditorToolbar.js";
|
|
17
|
+
import { getWarningDiagnostics } from "./configEditorWarnings.js";
|
|
15
18
|
const { b, e } = bem("gd-ui-kit-config-editor");
|
|
16
19
|
/**
|
|
17
20
|
* A config editor: a CodeMirror source editor with syntax highlighting, line numbers and a lint
|
|
@@ -30,7 +33,7 @@ const { b, e } = bem("gd-ui-kit-config-editor");
|
|
|
30
33
|
*
|
|
31
34
|
* @internal
|
|
32
35
|
*/
|
|
33
|
-
export function UiConfigEditor({ value, onChange, primaryLanguage = "json", languages = ["json", "yaml"], language, onLanguageChange, completionSource, labels, renderContextMenu, label, placeholder, readOnly = false, disabled = false, rows = 12, dataTestId, editorRef, }) {
|
|
36
|
+
export function UiConfigEditor({ value, onChange, primaryLanguage = "json", languages = ["json", "yaml"], language, onLanguageChange, completionSource, labels, warnings, renderContextMenu, label, placeholder, readOnly = false, disabled = false, rows = 12, dataTestId, editorRef, }) {
|
|
34
37
|
// Scoped to this instance: several editors can sit on one page, and a shared radio `name` would
|
|
35
38
|
// make their language switchers fight over the same group.
|
|
36
39
|
const instanceId = useId();
|
|
@@ -177,36 +180,57 @@ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", lang
|
|
|
177
180
|
// view: remounting instead would throw away whatever the user did while the chunk was on the
|
|
178
181
|
// wire — selection, undo history, focus — and their next keystroke would land at offset 0.
|
|
179
182
|
const grammarCompartmentRef = useRef(new Compartment());
|
|
183
|
+
const syntaxErrorMessage = labels?.syntaxError;
|
|
184
|
+
const [syntaxErrorCompartment] = useState(() => new Compartment());
|
|
185
|
+
const syntaxErrorLinter = useCallback(() => (syntaxErrorMessage ? createSyntaxErrorLinter(syntaxErrorMessage) : []), [syntaxErrorMessage]);
|
|
180
186
|
useEffect(() => {
|
|
181
187
|
const view = viewRef.current;
|
|
182
188
|
if (view) {
|
|
183
189
|
// `grammar ?? []` and not a skip: switching to a language whose grammar is still
|
|
184
190
|
// loading must clear the previous one, or the document keeps being parsed, highlighted
|
|
185
191
|
// and linted as the old language until the chunk arrives — indefinitely, if it fails.
|
|
192
|
+
// A lint that already ran saw the previous grammar or none, and a lint runs again only
|
|
193
|
+
// when the document or the lint configuration changes, so a new syntax error linter is
|
|
194
|
+
// swapped in; `forceLinting` then runs it now rather than after the lint delay.
|
|
186
195
|
view.dispatch({
|
|
187
|
-
effects:
|
|
196
|
+
effects: [
|
|
197
|
+
grammarCompartmentRef.current.reconfigure(grammar ?? []),
|
|
198
|
+
syntaxErrorCompartment.reconfigure(syntaxErrorLinter()),
|
|
199
|
+
],
|
|
188
200
|
});
|
|
189
|
-
// The reconfigure changes neither the document nor the lint configuration, so the
|
|
190
|
-
// linter would not run again on its own — stale diagnostics from the previous grammar
|
|
191
|
-
// (or from the grammar-less tree) would stay in the gutter.
|
|
192
201
|
forceLinting(view);
|
|
193
202
|
}
|
|
194
|
-
}, [grammar]);
|
|
203
|
+
}, [grammar, syntaxErrorCompartment, syntaxErrorLinter]);
|
|
204
|
+
// The linter reads the warnings when it runs, so a remounted editor shows the current ones; a
|
|
205
|
+
// running view gets new warnings by swapping in a new linter. Each swap delays every linter's
|
|
206
|
+
// next run, the syntax error one included, so it happens only when the warnings' content changes.
|
|
207
|
+
const warningsRef = useAutoupdateRef(warnings);
|
|
208
|
+
const appliedWarningsRef = useRef(warnings ?? []);
|
|
209
|
+
const [warningsCompartment] = useState(() => new Compartment());
|
|
210
|
+
const warningLinter = useCallback(() => linter((view) => getWarningDiagnostics(view.state.doc.toString(), warningsRef.current ?? [])), [warningsRef]);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
const current = warnings ?? [];
|
|
213
|
+
if (isEqual(appliedWarningsRef.current, current)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
appliedWarningsRef.current = current;
|
|
217
|
+
viewRef.current?.dispatch({ effects: warningsCompartment.reconfigure(warningLinter()) });
|
|
218
|
+
}, [warnings, warningsCompartment, warningLinter]);
|
|
195
219
|
// Extensions are read once when CodeMirror initialises, so the editor is remounted (keyed on
|
|
196
220
|
// language) to swap grammars. Losing the undo history is reasonable there: the document was
|
|
197
221
|
// just rewritten in a different language, so there is nothing coherent left to undo into.
|
|
198
|
-
const syntaxErrorMessage = labels?.syntaxError;
|
|
199
222
|
const extensions = useMemo(() => [
|
|
200
223
|
grammarCompartmentRef.current.of(grammar ?? []),
|
|
201
224
|
lineNumbers(),
|
|
202
225
|
lintGutter(),
|
|
203
|
-
|
|
226
|
+
syntaxErrorCompartment.of(syntaxErrorLinter()),
|
|
227
|
+
warningsCompartment.of(warningLinter()),
|
|
204
228
|
],
|
|
205
229
|
// Keyed on `grammar` (which changes with the language) rather than the language itself: a
|
|
206
230
|
// running view gets a late-arriving grammar through the effect above, but any later remount
|
|
207
231
|
// (a completion-source toggle, say) is built from this memo — stale, it would mount an
|
|
208
232
|
// editor with no grammar at all.
|
|
209
|
-
[grammar,
|
|
233
|
+
[grammar, syntaxErrorCompartment, syntaxErrorLinter, warningsCompartment, warningLinter]);
|
|
210
234
|
// The completion source speaks in terms of the document's shape — the mapping keys enclosing the
|
|
211
235
|
// position — so the raw CodeMirror context is resolved into that here. YAML only: the position
|
|
212
236
|
// reader walks a YAML parse tree, and no JSON consumer has a completion schema.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Diagnostic } from "@codemirror/lint";
|
|
2
|
+
import { type IUiConfigEditorWarning } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The warnings as diagnostics on the text, each over the value its path names, or over each place the
|
|
5
|
+
* value holds its part. YAML reads JSON as well, so one parse serves either displayed language. Text
|
|
6
|
+
* that does not parse, and a path it does not hold, give nothing: the syntax error is reported on its
|
|
7
|
+
* own.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getWarningDiagnostics(text: string, warnings: readonly IUiConfigEditorWarning[]): Diagnostic[];
|
|
10
|
+
//# sourceMappingURL=configEditorWarnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configEditorWarnings.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/configEditorWarnings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAgBzD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,sBAAsB,EAAE,GAC5C,UAAU,EAAE,CAsBd"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isNode, parseDocument } from "yaml";
|
|
3
|
+
function partRanges(value, part) {
|
|
4
|
+
// "" matches at every offset, so the loop below would never advance.
|
|
5
|
+
if (!part) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
const ranges = [];
|
|
9
|
+
for (let at = value.indexOf(part); at !== -1; at = value.indexOf(part, at + part.length)) {
|
|
10
|
+
ranges.push([at, at + part.length]);
|
|
11
|
+
}
|
|
12
|
+
return ranges;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The warnings as diagnostics on the text, each over the value its path names, or over each place the
|
|
16
|
+
* value holds its part. YAML reads JSON as well, so one parse serves either displayed language. Text
|
|
17
|
+
* that does not parse, and a path it does not hold, give nothing: the syntax error is reported on its
|
|
18
|
+
* own.
|
|
19
|
+
*/
|
|
20
|
+
export function getWarningDiagnostics(text, warnings) {
|
|
21
|
+
if (warnings.length === 0) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
// A repeated key is valid JSON (JSON.parse keeps the last), so it must not drop every warning.
|
|
25
|
+
const document = parseDocument(text, { uniqueKeys: false });
|
|
26
|
+
if (document.errors.length > 0) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
return warnings.flatMap(({ path, part, message }) => {
|
|
30
|
+
const node = document.getIn(path, true);
|
|
31
|
+
if (!isNode(node) || node.range === undefined || node.range === null) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
const [start, end] = node.range;
|
|
35
|
+
const parts = partRanges(text.slice(start, end), part).map(([from, to]) => [
|
|
36
|
+
start + from,
|
|
37
|
+
start + to,
|
|
38
|
+
]);
|
|
39
|
+
const ranges = parts.length > 0 ? parts : [[start, end]];
|
|
40
|
+
return ranges.map(([from, to]) => ({ from, to, severity: "warning", message }));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -54,6 +54,25 @@ export interface IUiConfigEditorLabels {
|
|
|
54
54
|
*/
|
|
55
55
|
syntaxError?: string;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A warning about a value in the editor's text, shown in the lint gutter. It does not stop the value
|
|
59
|
+
* being edited or emitted.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export interface IUiConfigEditorWarning {
|
|
64
|
+
/**
|
|
65
|
+
* Where the value sits in the parsed document, as object keys and array indexes. The same path
|
|
66
|
+
* finds it whichever language is displayed.
|
|
67
|
+
*/
|
|
68
|
+
path: ReadonlyArray<string | number>;
|
|
69
|
+
/**
|
|
70
|
+
* A piece of the value's text to mark, such as one marker in a string, at each place the value
|
|
71
|
+
* holds it. The whole value is marked when it is absent or the value does not hold it.
|
|
72
|
+
*/
|
|
73
|
+
part?: string;
|
|
74
|
+
message: string;
|
|
75
|
+
}
|
|
57
76
|
/**
|
|
58
77
|
* @internal
|
|
59
78
|
*/
|
|
@@ -105,6 +124,11 @@ export interface IUiConfigEditorProps {
|
|
|
105
124
|
completionSource?: YamlCompletionSource;
|
|
106
125
|
/** The editor's localized texts. Anything omitted falls back to a neutral default. */
|
|
107
126
|
labels?: IUiConfigEditorLabels;
|
|
127
|
+
/**
|
|
128
|
+
* Warnings about values, shown in the lint gutter next to any syntax error. A warning whose path
|
|
129
|
+
* the displayed text does not hold is not shown.
|
|
130
|
+
*/
|
|
131
|
+
warnings?: readonly IUiConfigEditorWarning[];
|
|
108
132
|
/**
|
|
109
133
|
* Renders the contents of the toolbar's context menu, usually a `UiMenu`.
|
|
110
134
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,yFAAyF;IACzF,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC5C,+DAA+D;IAC/D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAED;;;;;GA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;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,kFAAkF;IAClF,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,sFAAsF;IACtF,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC7C;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,+BAA+B,KAAK,SAAS,CAAC;IAC1E;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;CACvC"}
|
|
@@ -9,6 +9,11 @@ interface IUiToastContextValue {
|
|
|
9
9
|
* runs `resolveText` against the consumer's `useIntl()`.
|
|
10
10
|
*/
|
|
11
11
|
push: (kind: UiToastKind, text: string, options?: IUiToastOptions) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Replace the text of a showing toast, keeping its dismiss timer. Returns
|
|
14
|
+
* whether the toast is still showing.
|
|
15
|
+
*/
|
|
16
|
+
update: (id: string, text: string) => boolean;
|
|
12
17
|
/** Dismiss one toast by id. */
|
|
13
18
|
remove: (id: string) => void;
|
|
14
19
|
/** Dismiss all toasts. */
|
|
@@ -39,7 +44,9 @@ export declare function UiToastProvider({ children }: {
|
|
|
39
44
|
* Consumer hook. Resolves the toast message via the **caller's**
|
|
40
45
|
* `useIntl()` so a consumer rendered under a nested `IntlProvider` formats
|
|
41
46
|
* `MessageDescriptor` content with that subtree's locale, not the
|
|
42
|
-
* provider's.
|
|
47
|
+
* provider's. `MessageDescriptor` toasts follow the caller's messages, e.g.
|
|
48
|
+
* once its locale's messages have loaded after the toast was added. Throws
|
|
49
|
+
* when called outside a `UiToastProvider`.
|
|
43
50
|
*
|
|
44
51
|
* @internal
|
|
45
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiToastProvider.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiToast/UiToastProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,SAAS,EASjB,MAAM,OAAO,CAAC;AAIf,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEnB,MAAM,YAAY,CAAC;AAuBpB,UAAU,oBAAoB;IAC1B,4CAA4C;IAC5C,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,MAAM,CAAC;IAC7E,+BAA+B;IAC/B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"UiToastProvider.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiToast/UiToastProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,SAAS,EASjB,MAAM,OAAO,CAAC;AAIf,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEnB,MAAM,YAAY,CAAC;AAuBpB,UAAU,oBAAoB;IAC1B,4CAA4C;IAC5C,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,MAAM,CAAC;IAC7E;;;OAGG;IACH,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,+BAA+B;IAC/B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAsJpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,IAAI,iBAAiB,CAsC9C;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,sDAAiB,CAAC"}
|
|
@@ -124,6 +124,16 @@ export function UiToastProvider({ children }) {
|
|
|
124
124
|
}
|
|
125
125
|
return id;
|
|
126
126
|
}, [idPrefix, remove, clearTimer, commit]);
|
|
127
|
+
const update = useCallback((id, text) => {
|
|
128
|
+
const current = toastsRef.current;
|
|
129
|
+
const toast = current.find((t) => t.id === id);
|
|
130
|
+
if (!toast)
|
|
131
|
+
return false;
|
|
132
|
+
if (toast.text !== text) {
|
|
133
|
+
commit(current.map((t) => (t === toast ? { ...t, text } : t)));
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}, [commit]);
|
|
127
137
|
// Cancel pending dismiss timers on unmount.
|
|
128
138
|
useEffect(() => {
|
|
129
139
|
const timers = timersRef.current;
|
|
@@ -155,15 +165,17 @@ export function UiToastProvider({ children }) {
|
|
|
155
165
|
// `UiToastsContainer` knows to render nothing.
|
|
156
166
|
return { ...parent, isNested: true };
|
|
157
167
|
}
|
|
158
|
-
return { toasts, push, remove, removeAll, isNested: false };
|
|
159
|
-
}, [parent, toasts, push, remove, removeAll]);
|
|
168
|
+
return { toasts, push, update, remove, removeAll, isNested: false };
|
|
169
|
+
}, [parent, toasts, push, update, remove, removeAll]);
|
|
160
170
|
return _jsx(UiToastContext.Provider, { value: value, children: children });
|
|
161
171
|
}
|
|
162
172
|
/**
|
|
163
173
|
* Consumer hook. Resolves the toast message via the **caller's**
|
|
164
174
|
* `useIntl()` so a consumer rendered under a nested `IntlProvider` formats
|
|
165
175
|
* `MessageDescriptor` content with that subtree's locale, not the
|
|
166
|
-
* provider's.
|
|
176
|
+
* provider's. `MessageDescriptor` toasts follow the caller's messages, e.g.
|
|
177
|
+
* once its locale's messages have loaded after the toast was added. Throws
|
|
178
|
+
* when called outside a `UiToastProvider`.
|
|
167
179
|
*
|
|
168
180
|
* @internal
|
|
169
181
|
*/
|
|
@@ -173,9 +185,27 @@ export function useUiToast() {
|
|
|
173
185
|
throw new Error("useUiToast must be used inside <UiToastProvider>");
|
|
174
186
|
}
|
|
175
187
|
const intl = useIntl();
|
|
176
|
-
const { push, remove, removeAll } = ctx;
|
|
188
|
+
const { push, update, remove, removeAll } = ctx;
|
|
189
|
+
const descriptorToastsRef = useRef(new Map());
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
for (const [id, message] of descriptorToastsRef.current) {
|
|
192
|
+
if (!update(id, resolveText(intl, message))) {
|
|
193
|
+
descriptorToastsRef.current.delete(id);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, [intl, update]);
|
|
177
197
|
return useMemo(() => {
|
|
178
|
-
const add = (kind, message, options) =>
|
|
198
|
+
const add = (kind, message, options) => {
|
|
199
|
+
const id = push(kind, resolveText(intl, message, options), options);
|
|
200
|
+
if (typeof message === "string") {
|
|
201
|
+
// A plain text may replace a descriptor toast with the same id
|
|
202
|
+
descriptorToastsRef.current.delete(id);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
descriptorToastsRef.current.set(id, message);
|
|
206
|
+
}
|
|
207
|
+
return id;
|
|
208
|
+
};
|
|
179
209
|
return {
|
|
180
210
|
addSuccess: (message, options) => add("success", message, options),
|
|
181
211
|
addInfo: (message, options) => add("info", message, options),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiToastsContainer.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiToast/UiToastsContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAQ5D,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,YAAY,CAAC;AAc7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,+DAA+D;IAC/D,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,SAAS,CA0C5E;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,uBAAuB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"UiToastsContainer.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiToast/UiToastsContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAQ5D,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,YAAY,CAAC;AAc7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,+DAA+D;IAC/D,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,SAAS,CA0C5E;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,uBAAuB,GAAG,SAAS,CAsCpF"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2026 GoodData Corporation
|
|
3
3
|
import { useContext, useMemo } from "react";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import { commonDialogMessages } from "../../locales.js";
|
|
5
|
+
import { commonDialogMessages, uiToastMessages } from "../../locales.js";
|
|
6
6
|
import { bem } from "../@utils/bem.js";
|
|
7
7
|
import { UiIcon } from "../UiIcon/UiIcon.js";
|
|
8
8
|
import { UiToastContextInternal } from "./UiToastProvider.js";
|
|
@@ -40,6 +40,7 @@ export function UiToastItem({ toast, onClose }) {
|
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
42
|
export function UiToastsContainer({ dataTestId }) {
|
|
43
|
+
const intl = useIntl();
|
|
43
44
|
const ctx = useContext(UiToastContextInternal);
|
|
44
45
|
// Render newest-first so the most recent notification sits at the top
|
|
45
46
|
// of the stack — matches the legacy `ToastsCenter` overlay
|
|
@@ -50,5 +51,8 @@ export function UiToastsContainer({ dataTestId }) {
|
|
|
50
51
|
if (!ctx || ctx.isNested) {
|
|
51
52
|
return null;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
const hasToasts = items.length > 0;
|
|
55
|
+
return (_jsx("div", { className: b(), role: hasToasts ? "region" : undefined, "aria-label": hasToasts
|
|
56
|
+
? intl.formatMessage(uiToastMessages.regionLabel, { count: items.length })
|
|
57
|
+
: undefined, "aria-live": "off", "data-testid": dataTestId, children: items.map((toast) => (_jsx(UiToastItem, { toast: toast, onClose: ctx.remove }, toast.id))) }));
|
|
54
58
|
}
|
package/esm/Button/Button.js
CHANGED
|
@@ -29,9 +29,9 @@ export const Button = forwardRef(function Button({ className, describedByFromVal
|
|
|
29
29
|
};
|
|
30
30
|
const ariaDropdownAttributesFromConfig = {
|
|
31
31
|
...ariaDropdownProps,
|
|
32
|
-
// override calculated dropdown props by explicit overrides from props
|
|
33
|
-
"aria-controls": ariaControls
|
|
34
|
-
"aria-expanded": ariaExpanded
|
|
32
|
+
// override calculated dropdown props by explicit overrides from props, when set
|
|
33
|
+
...(ariaControls === undefined ? {} : { "aria-controls": ariaControls }),
|
|
34
|
+
...(ariaExpanded === undefined ? {} : { "aria-expanded": ariaExpanded }),
|
|
35
35
|
};
|
|
36
36
|
const handleClick = useCallback((e) => {
|
|
37
37
|
if (disabled) {
|
|
@@ -20,7 +20,7 @@ export function ShareLink({ dashboardFilters, dashboardParameters, dashboardLink
|
|
|
20
20
|
const url = window.location.origin;
|
|
21
21
|
const hashLocation = window.location.hash.split("?")[0];
|
|
22
22
|
return url
|
|
23
|
-
.concat(dashboardLinkBasePath ??
|
|
23
|
+
.concat(dashboardLinkBasePath ?? window.location.pathname)
|
|
24
24
|
.concat(hashLocation)
|
|
25
25
|
.concat(`?${new URLSearchParams(queryParams).toString()}`);
|
|
26
26
|
}, [dashboardFilters, dashboardParameters, dashboardLinkBasePath]);
|
|
@@ -52,8 +52,8 @@ export interface IShareDialogProps {
|
|
|
52
52
|
dashboardFilters?: FilterContextItem[];
|
|
53
53
|
dashboardParameters?: IDashboardParameter[];
|
|
54
54
|
/**
|
|
55
|
-
* Base path used when building the dashboard share link, e.g. `/workspace/{id}/dashboards
|
|
56
|
-
*
|
|
55
|
+
* Base path used when building the dashboard share link, e.g. `/workspace/{id}/dashboards/`.
|
|
56
|
+
* Defaults to the current page path when omitted.
|
|
57
57
|
*/
|
|
58
58
|
dashboardLinkBasePath?: string;
|
|
59
59
|
isGranteeShareLoading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderHelp.d.ts","sourceRoot":"","sources":["../../src/Header/HeaderHelp.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AASvF,OAAO,EAAE,KAAK,2BAA2B,EAAoB,MAAM,2BAA2B,CAAC;AAG/F,UAAU,SAAS;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,UAAU,gBAAgB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAC1D,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,eAAe,CAAC,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,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EACvB,SAAS,EACT,KAAK,EACL,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,GAClB,EAAE,gBAAgB,2CA+HlB"}
|
package/esm/Header/HeaderHelp.js
CHANGED
|
@@ -62,8 +62,5 @@ export function HeaderHelp({ className, items, helpMenuDropdownAlignPoints, onMe
|
|
|
62
62
|
toggleHelpMenu(false);
|
|
63
63
|
}, children: disableDropdown ? null : (_jsx(UiFocusManager, { enableFocusTrap: true, enableAutofocus: true, enableReturnFocusOnUnmount: { returnFocusTo: helpMenuButtonRef }, children: _jsx("div", { id: dropdownId, className: "gd-dialog gd-dropdown overlay gd-header-help-dropdown", role: "listbox", "aria-label": intl.formatMessage({ id: "gs.header.help.label" }), children: _jsx("div", { className: "gd-list small", children: menuItems }) }) })) })) : (false);
|
|
64
64
|
};
|
|
65
|
-
return helpRedirectUrl ? (_jsx("a", { className: classNames, href: helpRedirectUrl, target: "_blank", rel: "noreferrer noopener", children: _jsx(FormattedMessage, { id: "gs.header.help" }) })) : (_jsxs(Button, { className: cx(classNames, "gd-header-button"), onClick: () => toggleHelpMenu(), accessibilityConfig: {
|
|
66
|
-
isExpanded: isOpen,
|
|
67
|
-
popupId: dropdownId,
|
|
68
|
-
}, ref: helpMenuButtonRef, children: [_jsx(FormattedMessage, { id: "gs.header.help" }), renderHelpMenu()] }));
|
|
65
|
+
return helpRedirectUrl ? (_jsx("a", { className: classNames, href: helpRedirectUrl, target: "_blank", rel: "noreferrer noopener", children: _jsx(FormattedMessage, { id: "gs.header.help" }) })) : (_jsxs(Button, { className: cx(classNames, "gd-header-button"), onClick: () => toggleHelpMenu(), accessibilityConfig: disableDropdown ? undefined : { isExpanded: isOpen, popupId: dropdownId }, ref: helpMenuButtonRef, children: [_jsx(FormattedMessage, { id: "gs.header.help" }), renderHelpMenu()] }));
|
|
69
66
|
}
|
|
@@ -57,7 +57,7 @@ function createManageItemsGroup(workspacePermissions, workspaceId, hasManage) {
|
|
|
57
57
|
}
|
|
58
58
|
function createInsightsItemsGroup(featureFlags, workspaceId, workspacePermissions, hasAnalyticalDashboards, hasMeasures, backendSupportsDataItem, hasNoDataSet, baseUrl) {
|
|
59
59
|
const insightItemsGroup = [];
|
|
60
|
-
const kpisUrl = kpisItemUrl(baseUrl, workspaceId
|
|
60
|
+
const kpisUrl = kpisItemUrl(baseUrl, workspaceId);
|
|
61
61
|
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_KPIS_NEW, "s-menu-kpis", kpisUrl), canShowKpisItem(workspacePermissions, hasAnalyticalDashboards));
|
|
62
62
|
const analyzeUrl = analyzeItemUrl(baseUrl, workspaceId);
|
|
63
63
|
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_ANALYZE, "s-menu-analyze", analyzeUrl), canShowAnalyzeItem(workspacePermissions));
|
|
@@ -104,8 +104,8 @@ function measuresItemUrl(baseUrl, workspaceId) {
|
|
|
104
104
|
function canShowMetricsItem(hasMetrics, workspacePermissions) {
|
|
105
105
|
return Boolean(workspacePermissions.canManageMetric === true && hasMetrics);
|
|
106
106
|
}
|
|
107
|
-
function kpisItemUrl(baseUrl, workspaceId
|
|
108
|
-
return withBaseUrl(baseUrl,
|
|
107
|
+
function kpisItemUrl(baseUrl, workspaceId) {
|
|
108
|
+
return withBaseUrl(baseUrl, `/workspace/${workspaceId}/dashboards`);
|
|
109
109
|
}
|
|
110
110
|
function canShowKpisItem(workspacePermissions, hasAnalyticalDashboards) {
|
|
111
111
|
return Boolean(hasAnalyticalDashboards || workspacePermissions.canCreateAnalyticalDashboard === true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastsCenter.d.ts","sourceRoot":"","sources":["../../../src/Messages/toasts/ToastsCenter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAC;AAU7E;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EACzB,kBAAkB,GACrB,EAAE;IACC,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,
|
|
1
|
+
{"version":3,"file":"ToastsCenter.d.ts","sourceRoot":"","sources":["../../../src/Messages/toasts/ToastsCenter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAC;AAU7E;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EACzB,kBAAkB,GACrB,EAAE;IACC,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,kDA2BA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,4CAShC;AAwFD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,EACxC,6BAA6B,EAC7B,kBAAkB,EAClB,QAAQ,GACX,EAAE;IACC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACvB,2CAQA"}
|
|
@@ -22,7 +22,7 @@ export function ToastsCenter({ containerClassName, }) {
|
|
|
22
22
|
if (hasParentContext) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsx(ScreenReaderToast, {}), _jsx(Overlay, { containerClassName: containerClassName, children: _jsx("div", { className: "gd-messages", role: "region", "aria-label": label, children: _jsx(ToastMessageList, { messages: sortedMessages, onRemoveMessage: removeMessage }) }) })] }));
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx(ScreenReaderToast, {}), _jsx(Overlay, { containerClassName: containerClassName, children: _jsx("div", { className: "gd-messages", role: label ? "region" : undefined, "aria-label": label, children: _jsx(ToastMessageList, { messages: sortedMessages, onRemoveMessage: removeMessage }) }) })] }));
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Stores the latest message for the screen reader to read
|
|
@@ -78,7 +78,7 @@ function useMessagesLabel(messages) {
|
|
|
78
78
|
const numSuccess = messages.filter((message) => message.type === "success").length;
|
|
79
79
|
const numProgress = messages.filter((message) => message.type === "progress").length;
|
|
80
80
|
if (numTotal === 0) {
|
|
81
|
-
return
|
|
81
|
+
return undefined;
|
|
82
82
|
}
|
|
83
83
|
const errorMessage = formatMessage({ id: "messages.accessibility.partial.error" }, { count: numErrors });
|
|
84
84
|
const warningMessage = formatMessage({ id: "messages.accessibility.partial.warning" }, { count: numWarnings });
|
package/esm/index.d.ts
CHANGED
|
@@ -431,7 +431,7 @@ export type { IUiTooltipProps, TooltipArrowPlacement } from "./@ui/UiTooltip/typ
|
|
|
431
431
|
export { TOOLTIP_WIDTH_MEDIUM } from "./@ui/UiTooltip/constants.js";
|
|
432
432
|
export { UiDropdownIconButton, type IUiDropdownIconButtonProps, } from "./@ui/UiDropdownIconButton/UiDropdownIconButton.js";
|
|
433
433
|
export { UiBadge, type IUiBadgeProps } from "./@ui/UiBadge/UiBadge.js";
|
|
434
|
-
export { makeMenuKeyboardNavigation, makeLinearKeyboardNavigation, makeKeyboardNavigation, makeTabsKeyboardNavigation, makeHorizontalKeyboardNavigation, makeRadioGroupKeyboardNavigation, modifierNegator, type IHandleActionOptions, type IModifier, } from "./@ui/@utils/keyboardNavigation.js";
|
|
434
|
+
export { makeMenuKeyboardNavigation, makeGridKeyboardNavigation, makeLinearKeyboardNavigation, makeKeyboardNavigation, makeTabsKeyboardNavigation, makeHorizontalKeyboardNavigation, makeRadioGroupKeyboardNavigation, modifierNegator, type IHandleActionOptions, type IModifier, } from "./@ui/@utils/keyboardNavigation.js";
|
|
435
435
|
export { useKeyboardNavigationTarget, type IUseKeyboardNavigationTargetProps, } from "./@ui/@utils/useKeyboardNavigationTarget.js";
|
|
436
436
|
export { matchesSearchQuery } from "./@ui/@utils/matchesSearchQuery.js";
|
|
437
437
|
export { useListWithActionsKeyboardNavigation, SELECT_ITEM_ACTION, } from "./@ui/hooks/useListWithActionsKeyboardNavigation.js";
|
|
@@ -504,7 +504,7 @@ export { UiSearchableSelectSearch, type IUiSearchableSelectSearchProps, } from "
|
|
|
504
504
|
export { UiDialogBody, type IUiDialogBodyProps } from "./@ui/UiModalDialog/UiDialogBody.js";
|
|
505
505
|
export { UiTextInput, type IUiTextInputProps, type IUiTextInputIconAfterButton, } from "./@ui/UiTextInput/UiTextInput.js";
|
|
506
506
|
export { UiConfigEditor } from "./@ui/UiConfigEditor/UiConfigEditor.js";
|
|
507
|
-
export { type IUiConfigEditorProps, type IUiConfigEditorApi, type IUiConfigEditorContextMenuProps, type IUiConfigEditorLabels, } from "./@ui/UiConfigEditor/types.js";
|
|
507
|
+
export { type IUiConfigEditorProps, type IUiConfigEditorApi, type IUiConfigEditorContextMenuProps, type IUiConfigEditorLabels, type IUiConfigEditorWarning, } from "./@ui/UiConfigEditor/types.js";
|
|
508
508
|
export { preloadUiConfigEditorGrammars } from "./@ui/UiConfigEditor/configEditorGrammars.js";
|
|
509
509
|
export { type ConfigEditorLanguage } from "./@ui/UiConfigEditor/configEditorLanguage.js";
|
|
510
510
|
export { UiRadio, type IUiRadioProps } from "./@ui/UiRadio/UiRadio.js";
|