@gooddata/sdk-ui-kit 11.68.0-alpha.2 → 11.68.0-alpha.3

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.
Files changed (89) hide show
  1. package/esm/@ui/UiAsyncTable/UiAsyncTable/SkeletonItemFactory.d.ts.map +1 -1
  2. package/esm/@ui/UiAsyncTable/UiAsyncTable/SkeletonItemFactory.js +2 -2
  3. package/esm/@ui/UiConfigEditor/UiConfigEditor.d.ts +1 -1
  4. package/esm/@ui/UiConfigEditor/UiConfigEditor.d.ts.map +1 -1
  5. package/esm/@ui/UiConfigEditor/UiConfigEditor.js +62 -25
  6. package/esm/@ui/UiConfigEditor/configEditorDiagnostics.d.ts +10 -0
  7. package/esm/@ui/UiConfigEditor/configEditorDiagnostics.d.ts.map +1 -0
  8. package/esm/@ui/UiConfigEditor/configEditorDiagnostics.js +65 -0
  9. package/esm/@ui/UiConfigEditor/configEditorYamlIndent.d.ts +8 -0
  10. package/esm/@ui/UiConfigEditor/configEditorYamlIndent.d.ts.map +1 -0
  11. package/esm/@ui/UiConfigEditor/configEditorYamlIndent.js +33 -0
  12. package/esm/@ui/UiConfigEditor/types.d.ts +9 -6
  13. package/esm/@ui/UiConfigEditor/types.d.ts.map +1 -1
  14. package/esm/@ui/UiDrawer/UiDrawer.d.ts.map +1 -1
  15. package/esm/@ui/UiDrawer/UiDrawer.js +14 -4
  16. package/esm/@ui/UiFocusManager/UiAutofocus.d.ts.map +1 -1
  17. package/esm/@ui/UiFocusManager/UiAutofocus.js +22 -2
  18. package/esm/@ui/UiFocusManager/UiModalOwner.d.ts +11 -0
  19. package/esm/@ui/UiFocusManager/UiModalOwner.d.ts.map +1 -0
  20. package/esm/@ui/UiFocusManager/UiModalOwner.js +18 -0
  21. package/esm/@ui/UiModalDialog/UiDialogHeader.d.ts +1 -9
  22. package/esm/@ui/UiModalDialog/UiDialogHeader.d.ts.map +1 -1
  23. package/esm/@ui/UiModalDialog/UiDialogHeader.js +5 -4
  24. package/esm/@ui/UiModalDialog/UiModalDialog.d.ts +16 -2
  25. package/esm/@ui/UiModalDialog/UiModalDialog.d.ts.map +1 -1
  26. package/esm/@ui/UiModalDialog/UiModalDialog.js +13 -5
  27. package/esm/@ui/UiSearchableSelect/UiSearchableSelect.d.ts +14 -1
  28. package/esm/@ui/UiSearchableSelect/UiSearchableSelect.d.ts.map +1 -1
  29. package/esm/@ui/UiSearchableSelect/UiSearchableSelect.js +76 -38
  30. package/esm/@ui/UiSearchableSelect/UiSearchableSelectContext.d.ts +12 -2
  31. package/esm/@ui/UiSearchableSelect/UiSearchableSelectContext.d.ts.map +1 -1
  32. package/esm/@ui/UiSearchableSelect/UiSearchableSelectList.d.ts.map +1 -1
  33. package/esm/@ui/UiSearchableSelect/UiSearchableSelectList.js +7 -13
  34. package/esm/@ui/UiSearchableSelect/UiSearchableSelectSearch.d.ts.map +1 -1
  35. package/esm/@ui/UiSearchableSelect/UiSearchableSelectSearch.js +6 -12
  36. package/esm/ChartSorting/ChartSorting.d.ts.map +1 -1
  37. package/esm/ChartSorting/ChartSorting.js +2 -2
  38. package/esm/ColorPicker/ColorPicker.d.ts.map +1 -1
  39. package/esm/ColorPicker/ColorPicker.js +2 -2
  40. package/esm/DescriptionPanel/DescriptionPanel.d.ts.map +1 -1
  41. package/esm/DescriptionPanel/DescriptionPanel.js +2 -2
  42. package/esm/DescriptionPanel/MetadataList.d.ts.map +1 -1
  43. package/esm/DescriptionPanel/MetadataList.js +2 -3
  44. package/esm/Dialog/DialogBase.d.ts.map +1 -1
  45. package/esm/Dialog/DialogBase.js +6 -2
  46. package/esm/Dialog/EmbedInsightDialog/EmbedInsightDialogBase/components/NumericInput.d.ts.map +1 -1
  47. package/esm/Dialog/EmbedInsightDialog/EmbedInsightDialogBase/components/NumericInput.js +4 -4
  48. package/esm/Dialog/ShareDialog/ShareDialogBase/types.d.ts.map +1 -1
  49. package/esm/Dialog/ShareDialog/ShareDialogBase/types.js +10 -10
  50. package/esm/Dialog/ShareDialog/ShareDialogBase/useShareDialogBase.d.ts.map +1 -1
  51. package/esm/Dialog/ShareDialog/ShareDialogBase/useShareDialogBase.js +3 -3
  52. package/esm/Dropdown/DropdownInvertableSelect.d.ts.map +1 -1
  53. package/esm/Dropdown/DropdownInvertableSelect.js +2 -2
  54. package/esm/Header/Header.d.ts.map +1 -1
  55. package/esm/Header/Header.js +3 -1
  56. package/esm/Header/HeaderHelp.d.ts.map +1 -1
  57. package/esm/Header/HeaderHelp.js +2 -2
  58. package/esm/Hyperlink/Hyperlink.d.ts.map +1 -1
  59. package/esm/Hyperlink/Hyperlink.js +3 -3
  60. package/esm/Overlay/Overlay.d.ts.map +1 -1
  61. package/esm/Overlay/Overlay.js +18 -11
  62. package/esm/RichText/plugins/rehype-references.js +1 -1
  63. package/esm/index.d.ts +4 -3
  64. package/esm/index.d.ts.map +1 -1
  65. package/esm/index.js +3 -2
  66. package/esm/sdk-ui-kit.d.ts +60 -37
  67. package/esm/syntaxHighlightingInput/hooks/useCodemirrorKeymap.d.ts +2 -0
  68. package/esm/syntaxHighlightingInput/hooks/useCodemirrorKeymap.d.ts.map +1 -1
  69. package/esm/syntaxHighlightingInput/hooks/useCodemirrorKeymap.js +6 -3
  70. package/esm/syntaxHighlightingInput/syntaxErrorLinter.d.ts +2 -2
  71. package/esm/syntaxHighlightingInput/syntaxErrorLinter.d.ts.map +1 -1
  72. package/esm/syntaxHighlightingInput/syntaxErrorLinter.js +10 -5
  73. package/package.json +11 -11
  74. package/src/@ui/UiListbox/UiListbox.scss +4 -2
  75. package/src/@ui/UiModalDialog/UiModalDialog.scss +49 -7
  76. package/src/@ui/UiSearchableSelect/UiSearchableSelect.scss +31 -0
  77. package/src/@ui/UiToast/UiToast.scss +7 -0
  78. package/styles/css/avenirFontPatch.css +111 -0
  79. package/styles/css/avenirFontPatch.css.map +1 -0
  80. package/styles/css/main.css +187 -6
  81. package/styles/css/main.css.map +1 -1
  82. package/styles/css/richText.css +2 -1
  83. package/styles/css/richText.css.map +1 -1
  84. package/styles/scss/avenirFontPatch.scss +63 -0
  85. package/styles/scss/main.scss +2 -1
  86. package/styles/scss/richText.scss +2 -1
  87. package/esm/@ui/UiConfigEditor/configEditorWarnings.d.ts +0 -10
  88. package/esm/@ui/UiConfigEditor/configEditorWarnings.d.ts.map +0 -1
  89. package/esm/@ui/UiConfigEditor/configEditorWarnings.js +0 -42
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonItemFactory.d.ts","sourceRoot":"","sources":["../../../../src/@ui/UiAsyncTable/UiAsyncTable/SkeletonItemFactory.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAgC,MAAM,OAAO,CAAC;AAIzE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,KAAK,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,OAAO,EAAE,KAAK,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKrF,wBAAgB,mBAAmB,CAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,GAC5B,aAAa,CAAC,oCAAoC,CAAC,CAerD;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,WAC7D,mBAAmB,CAAC,CAAC,CAAC,EAAE,eACpB,uBAAuB,EAAE,GAAG,SAAS,cACtC,OAAO,wDAmBtB,CAAC"}
1
+ {"version":3,"file":"SkeletonItemFactory.d.ts","sourceRoot":"","sources":["../../../../src/@ui/UiAsyncTable/UiAsyncTable/SkeletonItemFactory.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAgC,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,KAAK,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,OAAO,EAAE,KAAK,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKrF,wBAAgB,mBAAmB,CAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,GAC5B,aAAa,CAAC,oCAAoC,CAAC,CAerD;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,WAC7D,mBAAmB,CAAC,CAAC,CAAC,EAAE,eACpB,uBAAuB,EAAE,GAAG,SAAS,cACtC,OAAO,wDAmBtB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // (C) 2025-2026 GoodData Corporation
3
3
  import { useEffect, useMemo, useState } from "react";
4
- import { isEqual } from "lodash-es";
4
+ import { _isEqual } from "@gooddata/util";
5
5
  import { UiSkeleton } from "../../UiSkeleton/UiSkeleton.js";
6
6
  import { COLUMN_PADDING, SKELETON_ITEM_HEIGHT } from "./constants.js";
7
7
  import { getColumnWidths } from "./utils.js";
@@ -19,7 +19,7 @@ export const useSkeletonItem = (columns, bulkActions, isLargeRow) => {
19
19
  // this prevents the skeleton item from re-rendering when
20
20
  // irrelevant columns properties change(e.g. permissions)
21
21
  useEffect(() => {
22
- if (!isEqual(columnWidths, computedColumnWidths)) {
22
+ if (!_isEqual(columnWidths, computedColumnWidths)) {
23
23
  setColumnWidths(computedColumnWidths);
24
24
  }
25
25
  }, [computedColumnWidths, columnWidths]);
@@ -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, warnings, 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, diagnostics, 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":"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
+ {"version":3,"file":"UiConfigEditor.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/UiConfigEditor.tsx"],"names":[],"mappings":"AAkCA,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,WAAW,EACX,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,IAAS,EACT,UAAU,EACV,SAAS,GACZ,EAAE,oBAAoB,2CAsTtB"}
@@ -1,20 +1,23 @@
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 { startCompletion } from "@codemirror/autocomplete";
5
+ import { insertNewlineAndIndent } from "@codemirror/commands";
4
6
  import { forceLinting, lintGutter, linter } from "@codemirror/lint";
5
- import { Compartment } from "@codemirror/state";
6
- import { lineNumbers } from "@codemirror/view";
7
- import { isEqual } from "lodash-es";
7
+ import { Compartment, Prec } from "@codemirror/state";
8
+ import { keymap, lineNumbers } from "@codemirror/view";
8
9
  import { useAutoupdateRef } from "@gooddata/sdk-ui";
10
+ import { _isEqual } from "@gooddata/util";
9
11
  import { createSyntaxErrorLinter } from "../../syntaxHighlightingInput/syntaxErrorLinter.js";
10
12
  import { SyntaxHighlightingInput } from "../../syntaxHighlightingInput/SyntaxHighlightingInput.js";
11
13
  import { yamlPositionAt } from "../../syntaxHighlightingInput/yamlPosition.js";
12
14
  import { bem } from "../@utils/bem.js";
15
+ import { getPathDiagnostics } from "./configEditorDiagnostics.js";
13
16
  import { useLanguageGrammar } from "./configEditorGrammars.js";
14
17
  import { themedHighlightStyle } from "./configEditorHighlighting.js";
15
18
  import { beautify, convertText, isProjectable } from "./configEditorLanguage.js";
16
19
  import { ConfigEditorToolbar } from "./ConfigEditorToolbar.js";
17
- import { getWarningDiagnostics } from "./configEditorWarnings.js";
20
+ import { yamlBlockIndent } from "./configEditorYamlIndent.js";
18
21
  const { b, e } = bem("gd-ui-kit-config-editor");
19
22
  /**
20
23
  * A config editor: a CodeMirror source editor with syntax highlighting, line numbers and a lint
@@ -33,7 +36,7 @@ const { b, e } = bem("gd-ui-kit-config-editor");
33
36
  *
34
37
  * @internal
35
38
  */
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, }) {
39
+ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", languages = ["json", "yaml"], language, onLanguageChange, completionSource, labels, diagnostics, renderContextMenu, label, placeholder, readOnly = false, disabled = false, rows = 12, dataTestId, editorRef, }) {
37
40
  // Scoped to this instance: several editors can sit on one page, and a shared radio `name` would
38
41
  // make their language switchers fight over the same group.
39
42
  const instanceId = useId();
@@ -176,6 +179,7 @@ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", lang
176
179
  }
177
180
  }, [completionSource]);
178
181
  const grammar = useLanguageGrammar(displayLanguage);
182
+ const yamlIndent = useMemo(() => (displayLanguage === "yaml" ? yamlBlockIndent() : []), [displayLanguage]);
179
183
  // The grammar lives in a compartment so a first-time load can be injected into the running
180
184
  // view: remounting instead would throw away whatever the user did while the chunk was on the
181
185
  // wire — selection, undo history, focus — and their next keystroke would land at offset 0.
@@ -201,21 +205,27 @@ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", lang
201
205
  forceLinting(view);
202
206
  }
203
207
  }, [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]);
208
+ // The linter reads the diagnostics when it runs, so a remounted editor shows the current ones; a
209
+ // running view gets new diagnostics by swapping in a new linter. Each swap delays every linter's
210
+ // next run, the syntax error one included, so it happens only when the diagnostics' content changes.
211
+ const diagnosticsRef = useAutoupdateRef(diagnostics);
212
+ const appliedDiagnosticsRef = useRef(diagnostics ?? []);
213
+ const [diagnosticsCompartment] = useState(() => new Compartment());
214
+ const diagnosticLinter = useCallback(() => linter((view) => getPathDiagnostics(view.state.doc.toString(), diagnosticsRef.current ?? [])), [diagnosticsRef]);
211
215
  useEffect(() => {
212
- const current = warnings ?? [];
213
- if (isEqual(appliedWarningsRef.current, current)) {
216
+ const current = diagnostics ?? [];
217
+ if (_isEqual(appliedDiagnosticsRef.current, current)) {
214
218
  return;
215
219
  }
216
- appliedWarningsRef.current = current;
217
- viewRef.current?.dispatch({ effects: warningsCompartment.reconfigure(warningLinter()) });
218
- }, [warnings, warningsCompartment, warningLinter]);
220
+ appliedDiagnosticsRef.current = current;
221
+ viewRef.current?.dispatch({ effects: diagnosticsCompartment.reconfigure(diagnosticLinter()) });
222
+ }, [diagnostics, diagnosticsCompartment, diagnosticLinter]);
223
+ // The completion source speaks in terms of the document's shape — the mapping keys enclosing the
224
+ // position — so the raw CodeMirror context is resolved into that here. YAML only: the position
225
+ // reader walks a YAML parse tree, and no JSON consumer has a completion schema.
226
+ const onCompletion = useMemo(() => completionSource && displayLanguage === "yaml"
227
+ ? (context) => completionSource(context, yamlPositionAt(context.state, context.pos))
228
+ : undefined, [completionSource, displayLanguage]);
219
229
  // Extensions are read once when CodeMirror initialises, so the editor is remounted (keyed on
220
230
  // language) to swap grammars. Losing the undo history is reasonable there: the document was
221
231
  // just rewritten in a different language, so there is nothing coherent left to undo into.
@@ -224,19 +234,23 @@ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", lang
224
234
  lineNumbers(),
225
235
  lintGutter(),
226
236
  syntaxErrorCompartment.of(syntaxErrorLinter()),
227
- warningsCompartment.of(warningLinter()),
237
+ diagnosticsCompartment.of(diagnosticLinter()),
238
+ yamlIndent,
239
+ onCompletion ? enterOpensCompletions : [],
228
240
  ],
229
241
  // Keyed on `grammar` (which changes with the language) rather than the language itself: a
230
242
  // running view gets a late-arriving grammar through the effect above, but any later remount
231
243
  // (a completion-source toggle, say) is built from this memo — stale, it would mount an
232
244
  // editor with no grammar at all.
233
- [grammar, syntaxErrorCompartment, syntaxErrorLinter, warningsCompartment, warningLinter]);
234
- // The completion source speaks in terms of the document's shape — the mapping keys enclosing the
235
- // position — so the raw CodeMirror context is resolved into that here. YAML only: the position
236
- // reader walks a YAML parse tree, and no JSON consumer has a completion schema.
237
- const onCompletion = useMemo(() => completionSource && displayLanguage === "yaml"
238
- ? (context) => completionSource(context, yamlPositionAt(context.state, context.pos))
239
- : undefined, [completionSource, displayLanguage]);
245
+ [
246
+ grammar,
247
+ syntaxErrorCompartment,
248
+ syntaxErrorLinter,
249
+ diagnosticsCompartment,
250
+ diagnosticLinter,
251
+ yamlIndent,
252
+ onCompletion,
253
+ ]);
240
254
  return (_jsxs("div", { className: b({ disabled, readOnly }), style: { "--config-editor-rows": rows }, "data-testid": dataTestId, children: [_jsx(ConfigEditorToolbar, { languages: isSwitchable ? languages : [], displayLanguage: displayLanguage, onSelectLanguage: handleSelectLanguage, labels: labels, canAutoFormat: canAutoFormat, onAutoFormat: handleBeautify, renderContextMenu: renderContextMenu, readOnly: readOnly, disabled: disabled, languageGroupName: languageGroupName, contextMenuButtonId: contextMenuButtonId }), _jsx("div", { className: e("editor"), children: _jsx(SyntaxHighlightingInput, { className: e("input"), highlightStyle: themedHighlightStyle, value: draft, onChange: handleDraftChange,
241
255
  // An external replace means a new document here (an applied example, a dialog
242
256
  // reset), so the cursor goes to its end — a stale clamped offset would drop the
@@ -248,3 +262,26 @@ export function UiConfigEditor({ value, onChange, primaryLanguage = "json", lang
248
262
  viewRef.current = view;
249
263
  } }, editorEpoch) })] }));
250
264
  }
265
+ // Completions activate only on typed input, and a newline is not one, so the key opens them itself.
266
+ // `Prec.high` stays below the popup's own `Prec.highest` Enter, which keeps accepting the selection.
267
+ const enterOpensCompletions = Prec.high(keymap.of([
268
+ {
269
+ key: "Enter",
270
+ run: openCompletionsOnNewLine,
271
+ },
272
+ ]));
273
+ // Enter at the end of a line with content starts a line the user will fill. A blank line being
274
+ // broken again is the user making space (or an Escape just dismissed the list), and a split inside
275
+ // the text carries that text over, so neither opens the suggestions.
276
+ function openCompletionsOnNewLine(view) {
277
+ const { to } = view.state.selection.main;
278
+ const line = view.state.doc.lineAt(to);
279
+ const atEndOfContent = line.text.trim() !== "" && line.text.slice(to - line.from).trim() === "";
280
+ if (!insertNewlineAndIndent(view)) {
281
+ return false;
282
+ }
283
+ if (atEndOfContent) {
284
+ startCompletion(view);
285
+ }
286
+ return true;
287
+ }
@@ -0,0 +1,10 @@
1
+ import { type Diagnostic } from "@codemirror/lint";
2
+ import { type IUiConfigEditorDiagnostic } from "./types.js";
3
+ /**
4
+ * The diagnostics on the text, each over the value its path names, over each place the value holds
5
+ * its part, or over the key of the path for a key target. 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 getPathDiagnostics(text: string, diagnostics: readonly IUiConfigEditorDiagnostic[]): Diagnostic[];
10
+ //# sourceMappingURL=configEditorDiagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configEditorDiagnostics.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/configEditorDiagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAgB5D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,SAAS,yBAAyB,EAAE,GAClD,UAAU,EAAE,CAqBd"}
@@ -0,0 +1,65 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { isMap, isNode, isScalar, isSeq, 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 diagnostics on the text, each over the value its path names, over each place the value holds
16
+ * its part, or over the key of the path for a key target. 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 getPathDiagnostics(text, diagnostics) {
21
+ if (diagnostics.length === 0) {
22
+ return [];
23
+ }
24
+ // A repeated key is valid JSON (JSON.parse keeps the last), so it must not drop every diagnostic.
25
+ const document = parseDocument(text, { uniqueKeys: false });
26
+ if (document.errors.length > 0) {
27
+ return [];
28
+ }
29
+ return diagnostics.flatMap(({ path, part, target, severity, message }) => {
30
+ const range = target === "key" ? keyRange(document, path) : valueRange(document, path);
31
+ if (!range) {
32
+ return [];
33
+ }
34
+ const [start, end] = range;
35
+ const parts = partRanges(text.slice(start, end), target === "key" ? undefined : part).map(([from, to]) => [start + from, start + to]);
36
+ const ranges = parts.length > 0 ? parts : [range];
37
+ return ranges.map(([from, to]) => ({ from, to, severity, message }));
38
+ });
39
+ }
40
+ function valueRange(document, path) {
41
+ const node = document.getIn(path, true);
42
+ if (!isNode(node) || !node.range) {
43
+ return undefined;
44
+ }
45
+ if (node.range[0] !== node.range[1]) {
46
+ return [node.range[0], node.range[1]];
47
+ }
48
+ // A blank value has no character to underline, so its key carries the mark. A blank sequence
49
+ // item has no key of its own, so the key of the sequence stands in.
50
+ const keyPath = isSeq(document.getIn(path.slice(0, -1), true)) ? path.slice(0, -1) : path;
51
+ return keyRange(document, keyPath);
52
+ }
53
+ function keyRange(document, path) {
54
+ const parent = document.getIn(path.slice(0, -1), true);
55
+ if (!isMap(parent)) {
56
+ return undefined;
57
+ }
58
+ const key = String(path.at(-1));
59
+ for (const pair of parent.items) {
60
+ if (isScalar(pair.key) && String(pair.key.value) === key && pair.key.range) {
61
+ return [pair.key.range[0], pair.key.range[1]];
62
+ }
63
+ }
64
+ return undefined;
65
+ }
@@ -0,0 +1,8 @@
1
+ import { type Extension } from "@codemirror/state";
2
+ /**
3
+ * lang-yaml keeps the column after an empty `key:` or a bare `-`. Both start a nested value one
4
+ * level deeper, so the new line is indented. An empty key that takes a scalar gets the same indent,
5
+ * which one Backspace undoes; a schema-driven list of block keys would be harder to predict.
6
+ */
7
+ export declare function yamlBlockIndent(): Extension;
8
+ //# sourceMappingURL=configEditorYamlIndent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configEditorYamlIndent.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiConfigEditor/configEditorYamlIndent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAE3C"}
@@ -0,0 +1,33 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { getIndentUnit, indentService, syntaxTree } from "@codemirror/language";
3
+ /**
4
+ * lang-yaml keeps the column after an empty `key:` or a bare `-`. Both start a nested value one
5
+ * level deeper, so the new line is indented. An empty key that takes a scalar gets the same indent,
6
+ * which one Backspace undoes; a schema-driven list of block keys would be harder to predict.
7
+ */
8
+ export function yamlBlockIndent() {
9
+ return indentService.of(indentAfterOpenBlock);
10
+ }
11
+ const TEXT_NODES = new Set(["Comment", "BlockLiteralContent", "QuotedLiteral"]);
12
+ function indentAfterOpenBlock(context, pos) {
13
+ let at = pos - 1;
14
+ while (at >= 0) {
15
+ const line = context.lineAt(at, -1);
16
+ const text = line.text.trimEnd();
17
+ if (text !== "") {
18
+ const node = syntaxTree(context.state).resolveInner(line.from + text.length, -1);
19
+ if (TEXT_NODES.has(node.name) || !opensBlock(text)) {
20
+ return undefined;
21
+ }
22
+ return blockColumn(text) + getIndentUnit(context.state);
23
+ }
24
+ at = line.from - 1;
25
+ }
26
+ return undefined;
27
+ }
28
+ function opensBlock(text) {
29
+ return /^\s*-$/.test(text) || /^\s*(?:-\s+)*("[^"]*"|'[^']*'|[^\s:]+):$/.test(text);
30
+ }
31
+ function blockColumn(text) {
32
+ return /^\s*(?:-\s+)*/.exec(text)?.[0].length ?? 0;
33
+ }
@@ -55,12 +55,12 @@ export interface IUiConfigEditorLabels {
55
55
  syntaxError?: string;
56
56
  }
57
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.
58
+ * An error or warning about a value in the editor's text, shown in the lint gutter. It does not stop
59
+ * the value being edited or emitted.
60
60
  *
61
61
  * @internal
62
62
  */
63
- export interface IUiConfigEditorWarning {
63
+ export interface IUiConfigEditorDiagnostic {
64
64
  /**
65
65
  * Where the value sits in the parsed document, as object keys and array indexes. The same path
66
66
  * finds it whichever language is displayed.
@@ -71,6 +71,9 @@ export interface IUiConfigEditorWarning {
71
71
  * holds it. The whole value is marked when it is absent or the value does not hold it.
72
72
  */
73
73
  part?: string;
74
+ /** `"key"` marks the key that names the value instead of the value, such as an unknown key. */
75
+ target?: "key";
76
+ severity: "error" | "warning";
74
77
  message: string;
75
78
  }
76
79
  /**
@@ -125,10 +128,10 @@ export interface IUiConfigEditorProps {
125
128
  /** The editor's localized texts. Anything omitted falls back to a neutral default. */
126
129
  labels?: IUiConfigEditorLabels;
127
130
  /**
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.
131
+ * Errors and warnings about values, shown in the lint gutter next to any syntax error. A
132
+ * diagnostic whose path the displayed text does not hold is not shown.
130
133
  */
131
- warnings?: readonly IUiConfigEditorWarning[];
134
+ diagnostics?: readonly IUiConfigEditorDiagnostic[];
132
135
  /**
133
136
  * Renders the contents of the toolbar's context menu, usually a `UiMenu`.
134
137
  *
@@ -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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ACxC,sFAAsF;IACtF,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACnD;;;;;;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"UiDrawer.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiDrawer/UiDrawer.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAiB,EACjB,UAAU,EACV,QAAQ,EACR,MAAgB,EAChB,UAAU,EACV,WAAW,EACX,cAAc,EACd,UAAoB,EACpB,eAAsB,EACtB,eAAe,EACf,YAAmB,EACnB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,mBAAmB,GACtB,EAAE,cAAc,kDA+FhB"}
1
+ {"version":3,"file":"UiDrawer.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiDrawer/UiDrawer.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAiB,EACjB,UAAU,EACV,QAAQ,EACR,MAAgB,EAChB,UAAU,EACV,WAAW,EACX,cAAc,EACd,UAAoB,EACpB,eAAsB,EACtB,eAAe,EACf,YAAmB,EACnB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,mBAAmB,GACtB,EAAE,cAAc,kDA+GhB"}
@@ -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 { useMemo, useRef } from "react";
3
+ import { useCallback, useMemo, useRef, useState } from "react";
4
4
  import { Portal } from "react-portal";
5
5
  import { bem } from "../@utils/bem.js";
6
6
  import { makeDialogKeyboardNavigation } from "../@utils/keyboardNavigation.js";
@@ -8,6 +8,7 @@ import { OverlayContent, OverlayProvider } from "../@utils/OverlayStack.js";
8
8
  import { useElementSize } from "../hooks/useElementSize.js";
9
9
  import { UiAutofocus } from "../UiFocusManager/UiAutofocus.js";
10
10
  import { UiFocusTrap } from "../UiFocusManager/UiFocusTrap.js";
11
+ import { UiModalOwnerProvider, modalOwnerAttributes } from "../UiFocusManager/UiModalOwner.js";
11
12
  import { UiReturnFocusOnUnmount } from "../UiFocusManager/UiReturnFocusOnUnmount.js";
12
13
  import { UiIconButton } from "../UiIconButton/UiIconButton.js";
13
14
  import { useToggleDrawer } from "./hooks/useToggleDrawer.js";
@@ -17,6 +18,12 @@ const { b, e } = bem("gd-ui-kit-drawer");
17
18
  */
18
19
  export function UiDrawer({ open, zIndex, node, mode = "absolute", dataTestId, children, anchor = "right", transition, onEscapeKey, onClickOutside, closeLabel = "Close", showCloseButton = true, closeButtonSize, showBackdrop = true, header, onClickClose, refocusKey, initialFocus, returnFocusTo, accessibilityConfig, }) {
19
20
  const ref = useRef(null);
21
+ const contentRef = useRef(null);
22
+ const [content, setContent] = useState(null);
23
+ const setContentElement = useCallback((element) => {
24
+ contentRef.current = element;
25
+ setContent(element);
26
+ }, []);
20
27
  const { isOpen, isFullyOpen, view, backdropStyle, contentStyle } = useToggleDrawer(open ?? false, transition ?? {}, showBackdrop);
21
28
  const handleKeyDown = useMemo(() => makeDialogKeyboardNavigation({
22
29
  onClose: onEscapeKey,
@@ -24,7 +31,10 @@ export function UiDrawer({ open, zIndex, node, mode = "absolute", dataTestId, ch
24
31
  shouldPreventDefault: true,
25
32
  shouldStopPropagation: true,
26
33
  }), [onEscapeKey]);
27
- const { ref: headerRef, height } = useElementSize([isOpen, ref.current]);
34
+ const { ref: headerRef, height } = useElementSize([
35
+ isOpen,
36
+ showCloseButton ? ref.current : content,
37
+ ]);
28
38
  if (!isOpen) {
29
39
  return null;
30
40
  }
@@ -35,7 +45,7 @@ export function UiDrawer({ open, zIndex, node, mode = "absolute", dataTestId, ch
35
45
  position: mode,
36
46
  ...contentStyle,
37
47
  ...(height ? { paddingTop: height } : {}),
38
- }, onKeyDown: handleKeyDown, role: accessibilityConfig?.role ?? "dialog", "aria-label": accessibilityConfig?.ariaLabel, "aria-labelledby": accessibilityConfig?.ariaLabelledBy, "aria-describedby": accessibilityConfig?.ariaDescribedBy, "aria-modal": "true", className: e("content", {
48
+ }, onKeyDown: handleKeyDown, role: accessibilityConfig?.role ?? "dialog", "aria-label": accessibilityConfig?.ariaLabel, "aria-labelledby": accessibilityConfig?.ariaLabelledBy, "aria-describedby": accessibilityConfig?.ariaDescribedBy, "aria-modal": "true", ...modalOwnerAttributes, className: e("content", {
39
49
  showCloseButton: showCloseButton || Boolean(header),
40
- }), ref: showCloseButton ? undefined : ref, children: [_jsxs("div", { className: e("header"), ref: headerRef, children: [header, showCloseButton ? (_jsx("div", { className: e("close-button"), children: _jsx(UiIconButton, { label: closeLabel, icon: "close", variant: "tertiary", size: closeButtonSize, onClick: onClickClose, ref: ref }) })) : null] }), _jsx(UiAutofocus, { root: _jsx("div", { className: e("scrollable") }), active: isFullyOpen, refocusKey: refocusKey, initialFocus: initialFocus || ref, children: children })] }) })] }) }) })) }) }));
50
+ }), ref: setContentElement, children: [_jsxs("div", { className: e("header"), ref: headerRef, children: [_jsx(UiModalOwnerProvider, { modal: content, children: header }), showCloseButton ? (_jsx("div", { className: e("close-button"), children: _jsx(UiIconButton, { label: closeLabel, icon: "close", variant: "tertiary", size: closeButtonSize, onClick: onClickClose, ref: ref }) })) : null] }), _jsx(UiAutofocus, { root: _jsx("div", { className: e("scrollable") }), active: isFullyOpen, refocusKey: refocusKey, initialFocus: initialFocus || (showCloseButton ? ref : contentRef), children: _jsx(UiModalOwnerProvider, { modal: content, children: children }) })] }) })] }) }) })) }) }));
41
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UiAutofocus.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiFocusManager/UiAutofocus.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,0CAIzE,mBAAmB,KAAQ,wBAAwB,CAAC,CAAC,CA0GvD,CAAC;AAeF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,GAAG,OAAO,EACb,EAAE;IACC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB,GAAG,mBAAmB,iDAKtB"}
1
+ {"version":3,"file":"UiAutofocus.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiFocusManager/UiAutofocus.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAI3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,0CAIzE,mBAAmB,KAAQ,wBAAwB,CAAC,CAAC,CA8GvD,CAAC;AAuCF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,GAAG,OAAO,EACb,EAAE;IACC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB,GAAG,mBAAmB,iDAKtB"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // (C) 2025-2026 GoodData Corporation
3
3
  import { cloneElement, useCallback, useEffect, useMemo, useState, } from "react";
4
4
  import { getFocusableElements, isElementFocusable, isElementTextInput } from "../../utils/domUtilities.js";
5
+ import { isOwnershipAwareModal, useUiModalOwners } from "./UiModalOwner.js";
5
6
  import { resolveRef } from "./utils.js";
6
7
  /**
7
8
  * Provides a ref that will autofocus the element when it is mounted, or when `refocusKey` changes.
@@ -10,6 +11,8 @@ import { resolveRef } from "./utils.js";
10
11
  */
11
12
  export const useUiAutofocusConnectors = ({ active = true, refocusKey, initialFocus, } = {}) => {
12
13
  const [element, setElement] = useState(null);
14
+ const [modalsBeforeMount] = useState(getOpenModals);
15
+ const owners = useUiModalOwners();
13
16
  // Skip setState(null) on unmount — the effect cleanup handles observer teardown, and
14
17
  // calling setElement(null) during commit would trigger a state update outside act() in tests.
15
18
  // On re-mount, the ref callback fires with the new element, setting fresh state.
@@ -56,7 +59,9 @@ export const useUiAutofocusConnectors = ({ active = true, refocusKey, initialFoc
56
59
  intersectionObserver.observe(observedTarget);
57
60
  }
58
61
  };
59
- const isFocusSettled = () => element.contains(document.activeElement) || isElementTextInput(document.activeElement);
62
+ const isFocusSettled = () => element.contains(document.activeElement) ||
63
+ isElementTextInput(document.activeElement) ||
64
+ isFocusInModalItDoesNotBelongTo(element, owners, modalsBeforeMount);
60
65
  const attemptFocus = () => {
61
66
  if (isFocusSettled()) {
62
67
  return true;
@@ -98,9 +103,24 @@ export const useUiAutofocusConnectors = ({ active = true, refocusKey, initialFoc
98
103
  // Initial attempt — fast path when the first focusable is already present and visible.
99
104
  scheduleAttempt();
100
105
  return stop;
101
- }, [refocusKey, element, initialFocus, active]);
106
+ }, [refocusKey, element, initialFocus, active, owners, modalsBeforeMount]);
102
107
  return useMemo(() => ({ ref, element: element }), [ref, element]);
103
108
  };
109
+ const MODAL_SELECTOR = '[aria-modal="true"]';
110
+ function getOpenModals() {
111
+ return typeof document === "undefined" ? new Set() : new Set(document.querySelectorAll(MODAL_SELECTOR));
112
+ }
113
+ function isFocusInModalItDoesNotBelongTo(element, owners, modalsBeforeMount) {
114
+ const modal = document.activeElement?.closest(MODAL_SELECTOR);
115
+ if (!modal || modal.contains(element)) {
116
+ return false;
117
+ }
118
+ if (isOwnershipAwareModal(modal)) {
119
+ return !owners.includes(modal);
120
+ }
121
+ return (!modalsBeforeMount.has(modal) ||
122
+ !!(element.compareDocumentPosition(modal) & Node.DOCUMENT_POSITION_FOLLOWING));
123
+ }
104
124
  function getElementToFocus(element, initialFocus, includeHidden) {
105
125
  const initialFocusElement = resolveRef(initialFocus);
106
126
  const elementToCheck = initialFocusElement ?? element;
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ export declare const modalOwnerAttributes: {
3
+ readonly "data-gd-modal-owner": "";
4
+ };
5
+ export declare function UiModalOwnerProvider({ modal, children }: {
6
+ modal: Element | null;
7
+ children: ReactNode;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function useUiModalOwners(): readonly Element[];
10
+ export declare function isOwnershipAwareModal(modal: Element): boolean;
11
+ //# sourceMappingURL=UiModalOwner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiModalOwner.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiFocusManager/UiModalOwner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAsC,MAAM,OAAO,CAAC;AAI3E,eAAO,MAAM,oBAAoB;oCAA8B,EAAE;CAAW,CAAC;AAM7E,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAIvG;AAED,wBAAgB,gBAAgB,IAAI,SAAS,OAAO,EAAE,CAErD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE7D"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { createContext, useContext, useMemo } from "react";
4
+ const MODAL_OWNER_ATTRIBUTE = "data-gd-modal-owner";
5
+ export const modalOwnerAttributes = { [MODAL_OWNER_ATTRIBUTE]: "" };
6
+ const NO_OWNERS = [];
7
+ const UiModalOwnerContext = createContext(NO_OWNERS);
8
+ export function UiModalOwnerProvider({ modal, children }) {
9
+ const parentOwners = useContext(UiModalOwnerContext);
10
+ const owners = useMemo(() => (modal ? [modal, ...parentOwners] : parentOwners), [modal, parentOwners]);
11
+ return _jsx(UiModalOwnerContext.Provider, { value: owners, children: children });
12
+ }
13
+ export function useUiModalOwners() {
14
+ return useContext(UiModalOwnerContext);
15
+ }
16
+ export function isOwnershipAwareModal(modal) {
17
+ return modal.hasAttribute(MODAL_OWNER_ATTRIBUTE);
18
+ }
@@ -1,18 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
- /**
3
- * Title sizing variant.
4
- *
5
- * @internal
6
- */
7
- export type DialogHeaderTitleSize = "default" | "large";
8
2
  /**
9
3
  * @internal
10
4
  */
11
5
  export interface IUiDialogHeaderProps {
12
6
  /** Title shown in the header. */
13
7
  title: string;
14
- /** Title size — `"default"` = 18/26, `"large"` = 20/26. */
15
- titleSize?: DialogHeaderTitleSize;
16
8
  /** Fires when the user clicks the X close button. Omit to hide the X. */
17
9
  onClose?: () => void;
18
10
  /** Optional leading slot rendered before the title (e.g. a back button). */
@@ -23,5 +15,5 @@ export interface IUiDialogHeaderProps {
23
15
  *
24
16
  * @internal
25
17
  */
26
- export declare function UiDialogHeader({ title, titleSize, onClose, leading }: IUiDialogHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function UiDialogHeader({ title, onClose, leading }: IUiDialogHeaderProps): import("react/jsx-runtime").JSX.Element;
27
19
  //# sourceMappingURL=UiDialogHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiDialogHeader.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiModalDialog/UiDialogHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,OAAO,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,SAAqB,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,oBAAoB,2CA2BtG"}
1
+ {"version":3,"file":"UiDialogHeader.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiModalDialog/UiDialogHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,oBAAoB,2CA4B/E"}
@@ -10,13 +10,14 @@ const { b, e } = bem("gd-ui-kit-dialog-header");
10
10
  *
11
11
  * @internal
12
12
  */
13
- export function UiDialogHeader({ title, titleSize = "default", onClose, leading }) {
13
+ export function UiDialogHeader({ title, onClose, leading }) {
14
14
  const intl = useIntl();
15
15
  const dialogContext = useUiDialogContext();
16
- return (_jsxs("div", { className: b(), children: [leading ? _jsx("span", { className: e("leading"), children: leading }) : null, _jsx("h2", { id: dialogContext?.titleId, className: e("title", { size: titleSize }), children: title }), onClose ? (_jsx("span", { className: e("close"), children: _jsx(UiIconButton, { icon: "cross", variant: "tertiary",
16
+ const size = dialogContext?.size ?? "default";
17
+ return (_jsxs("div", { className: b({ size }), children: [leading ? _jsx("span", { className: e("leading"), children: leading }) : null, _jsx("h2", { id: dialogContext?.titleId, className: e("title", { size }), children: title }), onClose ? (_jsx("span", { className: e("close"), children: _jsx(UiIconButton, { icon: "cross", variant: "tertiary",
17
18
  // 18px cross, matching the design; the tertiary box has no fill or
18
- // border of its own, so only the icon size shows.
19
- size: "medium", onClick: onClose, accessibilityConfig: {
19
+ // border of its own, so only the icon size shows. On "large" size, the cross is 20px.
20
+ size: size === "large" ? "large" : "medium", onClick: onClose, accessibilityConfig: {
20
21
  ariaLabel: intl.formatMessage(commonDialogMessages.close),
21
22
  } }) })) : null] }));
22
23
  }
@@ -10,11 +10,19 @@ interface IUiDialogContext {
10
10
  * cleared when the last one unmounts.
11
11
  */
12
12
  registerBody: () => () => void;
13
+ /** The size of the header (title and close button) */
14
+ size: UiModalDialogSize;
13
15
  }
14
16
  /**
15
17
  * @internal
16
18
  */
17
19
  export declare function useUiDialogContext(): IUiDialogContext | null;
20
+ /**
21
+ * The size of the dialog's header: its title and close button.
22
+ *
23
+ * @internal
24
+ */
25
+ export type UiModalDialogSize = "default" | "large";
18
26
  /**
19
27
  * @internal
20
28
  */
@@ -34,8 +42,10 @@ export interface IUiModalDialogProps {
34
42
  closeOnOutsideClick?: boolean;
35
43
  /** Fires when the user dismisses via Esc, backdrop press, or `onClose` from inside. */
36
44
  onClose: () => void;
37
- /** Card width in px. Defaults to 540. */
45
+ /** Card width in px. Defaults to 540. Ignored when `isFullscreen` is set. */
38
46
  width?: number;
47
+ /** The size of the header: its title and close button. Ignored when `isFullscreen` is set. */
48
+ size?: UiModalDialogSize;
39
49
  /** Initial keyboard focus target. Defaults to the first tabbable element. */
40
50
  initialFocus?: RefObject<HTMLElement | null>;
41
51
  /**
@@ -50,6 +60,10 @@ export interface IUiModalDialogProps {
50
60
  };
51
61
  /** Test id forwarded to the overlay element. */
52
62
  dataTestId?: string;
63
+ /** Id of the dialog element, e.g. for the `aria-controls` of the button that opens it. */
64
+ id?: string;
65
+ /** Whether the dialog fills the viewport instead of showing as a card, e.g. on mobile. */
66
+ isFullscreen?: boolean;
53
67
  }
54
68
  /**
55
69
  * Modal dialog — portal, dimmed backdrop, card chrome (radius, shadow, fill,
@@ -59,6 +73,6 @@ export interface IUiModalDialogProps {
59
73
  *
60
74
  * @internal
61
75
  */
62
- export declare function UiModalDialog({ children, variant, isOpen, onClose, width, initialFocus, closeOnOutsideClick, accessibilityConfig, dataTestId, }: IUiModalDialogProps): import("react/jsx-runtime").JSX.Element | null;
76
+ export declare function UiModalDialog({ children, variant, isOpen, onClose, width, size, initialFocus, closeOnOutsideClick, accessibilityConfig, dataTestId, id, isFullscreen, }: IUiModalDialogProps): import("react/jsx-runtime").JSX.Element | null;
63
77
  export {};
64
78
  //# sourceMappingURL=UiModalDialog.d.ts.map