@gooddata/sdk-ui-kit 11.57.0-alpha.5 → 11.57.0-alpha.7

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 (34) hide show
  1. package/esm/@ui/UiColorPicker/components/UiColorValueField.d.ts.map +1 -1
  2. package/esm/@ui/UiColorPicker/components/UiColorValueField.js +3 -1
  3. package/esm/@ui/UiConfirmDialog/UiConfirmDialog.d.ts +2 -2
  4. package/esm/@ui/UiConfirmDialog/UiConfirmDialog.js +2 -2
  5. package/esm/@ui/UiModalDialog/UiModalDialog.d.ts +10 -4
  6. package/esm/@ui/UiModalDialog/UiModalDialog.d.ts.map +1 -1
  7. package/esm/@ui/UiModalDialog/UiModalDialog.js +6 -5
  8. package/esm/@ui/UiToolbarColorSwatch/UiToolbarColorSwatch.d.ts +1 -1
  9. package/esm/@ui/UiToolbarColorSwatch/UiToolbarColorSwatch.js +3 -2
  10. package/esm/@ui/UiToolbarStepper/UiToolbarStepper.d.ts +17 -0
  11. package/esm/@ui/UiToolbarStepper/UiToolbarStepper.d.ts.map +1 -1
  12. package/esm/@ui/UiToolbarStepper/UiToolbarStepper.js +21 -2
  13. package/esm/Header/generateHeaderCommonHelpMenuItems.d.ts +12 -0
  14. package/esm/Header/generateHeaderCommonHelpMenuItems.d.ts.map +1 -0
  15. package/esm/Header/generateHeaderCommonHelpMenuItems.js +51 -0
  16. package/esm/RichText/RichText.d.ts.map +1 -1
  17. package/esm/RichText/RichText.js +1 -0
  18. package/esm/RichText/helpers/references.d.ts.map +1 -1
  19. package/esm/RichText/helpers/references.js +21 -7
  20. package/esm/RichText/hooks/useEvaluatedMetricsAndAttributes.d.ts +24 -0
  21. package/esm/RichText/hooks/useEvaluatedMetricsAndAttributes.d.ts.map +1 -1
  22. package/esm/RichText/hooks/useEvaluatedMetricsAndAttributes.js +46 -22
  23. package/esm/RichText/plugins/types.d.ts +12 -0
  24. package/esm/RichText/plugins/types.d.ts.map +1 -1
  25. package/esm/RichText/plugins/types.js +14 -2
  26. package/esm/index.d.ts +1 -0
  27. package/esm/index.d.ts.map +1 -1
  28. package/esm/index.js +1 -0
  29. package/esm/sdk-ui-kit.d.ts +53 -7
  30. package/package.json +14 -14
  31. package/src/@ui/UiToolbarColorSwatch/UiToolbarColorSwatch.scss +13 -0
  32. package/src/@ui/UiToolbarStepper/UiToolbarStepper.scss +10 -0
  33. package/styles/css/main.css +15 -0
  34. package/styles/css/main.css.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"UiColorValueField.d.ts","sourceRoot":"","sources":["../../../../src/@ui/UiColorPicker/components/UiColorValueField.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAIzB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,qBAAqB;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,aAAa,CAAC;IACxB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,aAAa,GAChB,EAAE,qBAAqB,2CAyEvB"}
1
+ {"version":3,"file":"UiColorValueField.d.ts","sourceRoot":"","sources":["../../../../src/@ui/UiColorPicker/components/UiColorValueField.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAIzB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,qBAAqB;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,aAAa,CAAC;IACxB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,aAAa,GAChB,EAAE,qBAAqB,2CA2EvB"}
@@ -35,5 +35,7 @@ export function UiColorValueField({ value, onChange, notation, onNotationChange,
35
35
  if (event.key === "Enter") {
36
36
  settle();
37
37
  }
38
- }, isError: draft !== undefined && parseColorPickerValue(draft, value) === undefined, accessibilityConfig: { ariaLabel: label }, dataTestId: "ui-color-picker-value" }), _jsx(UiDropdown, { closeOnEscape: true, width: "auto", accessibilityConfig: { triggerRole: "combobox", popupRole: "listbox" }, renderButton: ({ ref, isOpen, toggleDropdown, ariaAttributes }) => (_jsx(UiButton, { ref: ref, size: "small", variant: "secondary", label: notation.toUpperCase(), iconAfter: isOpen ? "navigateUp" : "navigateDown", disableIconAnimation: true, onClick: toggleDropdown, accessibilityConfig: { ariaLabel: notationLabel, ...ariaAttributes } })), renderBody: ({ closeDropdown, ariaAttributes }) => (_jsx(UiListbox, { items: items, selectedItemId: notation, ariaAttributes: { ...ariaAttributes, "aria-label": notationLabel }, isCompact: true, onSelect: (item) => onNotationChange(item.data), onClose: closeDropdown })) })] }));
38
+ }, isError: draft !== undefined && parseColorPickerValue(draft, value) === undefined, accessibilityConfig: { ariaLabel: label }, dataTestId: "ui-color-picker-value" }), _jsx(UiDropdown, { closeOnEscape: true,
39
+ // The list portals out of the picker, so the keyboard reaches it only by being put there.
40
+ autofocusOnOpen: true, width: "auto", accessibilityConfig: { triggerRole: "combobox", popupRole: "listbox" }, renderButton: ({ ref, isOpen, toggleDropdown, ariaAttributes }) => (_jsx(UiButton, { ref: ref, size: "small", variant: "secondary", label: notation.toUpperCase(), iconAfter: isOpen ? "navigateUp" : "navigateDown", disableIconAnimation: true, onClick: toggleDropdown, accessibilityConfig: { ariaLabel: notationLabel, ...ariaAttributes } })), renderBody: ({ closeDropdown, ariaAttributes }) => (_jsx(UiListbox, { items: items, selectedItemId: notation, ariaAttributes: { ...ariaAttributes, "aria-label": notationLabel }, isCompact: true, onSelect: (item) => onNotationChange(item.data), onClose: closeDropdown })) })] }));
39
41
  }
@@ -10,8 +10,8 @@ export interface IUiConfirmDialogProps extends IUiConfirmDialogCardProps {
10
10
  * Modal confirm dialog used for actions that need explicit user confirmation
11
11
  * (granting workspace access, restricting access, removing a grantee,
12
12
  * transferring ownership). Wraps `UiConfirmDialogCard` in `UiModalDialog`
13
- * for the full modal contract — portal, dimmed backdrop, focus trap,
14
- * Esc and backdrop dismiss.
13
+ * for the full modal contract — portal, dimmed backdrop, focus trap
14
+ * and Esc dismiss.
15
15
  *
16
16
  * @internal
17
17
  */
@@ -6,8 +6,8 @@ import { UiConfirmDialogCard } from "./UiConfirmDialogCard.js";
6
6
  * Modal confirm dialog used for actions that need explicit user confirmation
7
7
  * (granting workspace access, restricting access, removing a grantee,
8
8
  * transferring ownership). Wraps `UiConfirmDialogCard` in `UiModalDialog`
9
- * for the full modal contract — portal, dimmed backdrop, focus trap,
10
- * Esc and backdrop dismiss.
9
+ * for the full modal contract — portal, dimmed backdrop, focus trap
10
+ * and Esc dismiss.
11
11
  *
12
12
  * @internal
13
13
  */
@@ -24,7 +24,13 @@ export interface IUiModalDialogProps {
24
24
  children: ReactNode;
25
25
  /** Whether the modal is shown. */
26
26
  isOpen: boolean;
27
- /** Fires when the user dismisses via Esc, backdrop click, or `onClose` from inside. */
27
+ /**
28
+ * Whether a press on the backdrop dismisses the modal. Defaults to `false`
29
+ * so a stray click cannot discard what the user typed; dialogs that hold no
30
+ * user input can opt in.
31
+ */
32
+ closeOnOutsideClick?: boolean;
33
+ /** Fires when the user dismisses via Esc, backdrop press, or `onClose` from inside. */
28
34
  onClose: () => void;
29
35
  /** Card width in px. Defaults to 540. */
30
36
  width?: number;
@@ -40,12 +46,12 @@ export interface IUiModalDialogProps {
40
46
  }
41
47
  /**
42
48
  * Modal dialog — portal, dimmed backdrop, card chrome (radius, shadow, fill,
43
- * padding), focus management, dismiss-on-outside / Esc, and the dialog
44
- * landmark (`role="dialog"`, `aria-modal="true"`). Compose `UiDialogHeader`,
49
+ * padding), focus management, Esc dismiss, and the dialog landmark
50
+ * (`role="dialog"`, `aria-modal="true"`). Compose `UiDialogHeader`,
45
51
  * an optional `UiDialogBody`, and `UiDialogFooter` as children.
46
52
  *
47
53
  * @internal
48
54
  */
49
- export declare function UiModalDialog({ children, isOpen, onClose, width, accessibilityConfig, dataTestId, }: IUiModalDialogProps): import("react/jsx-runtime").JSX.Element | null;
55
+ export declare function UiModalDialog({ children, isOpen, onClose, width, closeOnOutsideClick, accessibilityConfig, dataTestId, }: IUiModalDialogProps): import("react/jsx-runtime").JSX.Element | null;
50
56
  export {};
51
57
  //# sourceMappingURL=UiModalDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiModalDialog.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiModalDialog/UiModalDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,SAAS,EAQjB,MAAM,OAAO,CAAC;AAcf,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAK/E,UAAU,gBAAgB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,MAAM,IAAI,CAAC;CAClC;AAID;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;4DACwD;IACxD,QAAQ,EAAE,SAAS,CAAC;IACpB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;IACrF,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC1B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,UAAU,GACb,EAAE,mBAAmB,kDAcrB"}
1
+ {"version":3,"file":"UiModalDialog.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiModalDialog/UiModalDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,SAAS,EAQjB,MAAM,OAAO,CAAC;AAcf,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAK/E,UAAU,gBAAgB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,MAAM,IAAI,CAAC;CAClC;AAID;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;4DACwD;IACxD,QAAQ,EAAE,SAAS,CAAC;IACpB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,uFAAuF;IACvF,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;IACrF,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC1B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,GACb,EAAE,mBAAmB,kDAerB"}
@@ -15,24 +15,24 @@ export function useUiDialogContext() {
15
15
  }
16
16
  /**
17
17
  * Modal dialog — portal, dimmed backdrop, card chrome (radius, shadow, fill,
18
- * padding), focus management, dismiss-on-outside / Esc, and the dialog
19
- * landmark (`role="dialog"`, `aria-modal="true"`). Compose `UiDialogHeader`,
18
+ * padding), focus management, Esc dismiss, and the dialog landmark
19
+ * (`role="dialog"`, `aria-modal="true"`). Compose `UiDialogHeader`,
20
20
  * an optional `UiDialogBody`, and `UiDialogFooter` as children.
21
21
  *
22
22
  * @internal
23
23
  */
24
- export function UiModalDialog({ children, isOpen, onClose, width, accessibilityConfig, dataTestId, }) {
24
+ export function UiModalDialog({ children, isOpen, onClose, width, closeOnOutsideClick, accessibilityConfig, dataTestId, }) {
25
25
  if (!isOpen) {
26
26
  return null;
27
27
  }
28
- return (_jsx(OpenModalDialog, { onClose: onClose, width: width, accessibilityConfig: accessibilityConfig, dataTestId: dataTestId, children: children }));
28
+ return (_jsx(OpenModalDialog, { onClose: onClose, width: width, closeOnOutsideClick: closeOnOutsideClick, accessibilityConfig: accessibilityConfig, dataTestId: dataTestId, children: children }));
29
29
  }
30
30
  /**
31
31
  * Inner body — only mounted while the modal is open so the z-index slot is
32
32
  * reserved for the open lifetime only. Splitting this out matters because
33
33
  * `useOverlayZIndexWithRegister` registers in a mount effect.
34
34
  */
35
- function OpenModalDialog({ children, onClose, width = 540, accessibilityConfig, dataTestId, }) {
35
+ function OpenModalDialog({ children, onClose, width = 540, closeOnOutsideClick = false, accessibilityConfig, dataTestId, }) {
36
36
  const zIndex = useOverlayZIndexWithRegister();
37
37
  const titleId = useId();
38
38
  const descriptionId = useId();
@@ -72,6 +72,7 @@ function OpenModalDialog({ children, onClose, width = 540, accessibilityConfig,
72
72
  setHasAutofocusTarget(target !== null);
73
73
  }, [refs]);
74
74
  const dismiss = useDismiss(context, {
75
+ enabled: closeOnOutsideClick,
75
76
  outsidePressEvent: "mousedown",
76
77
  // Nested kit floating popups (dropdowns, menus, autocomplete listbox)
77
78
  // portal their bodies outside our `refs.floating`, so a click on a
@@ -18,7 +18,7 @@ export interface IUiToolbarColorSwatchProps {
18
18
  */
19
19
  hasBorder?: boolean;
20
20
  /**
21
- * No colour is set. Applies to the "fill" variant only.
21
+ * No colour is set: the fill, or the bar of the "text" variant, shows a checker instead.
22
22
  * @defaultValue false
23
23
  */
24
24
  isTransparent?: boolean;
@@ -8,6 +8,7 @@ const { b, e } = bem("gd-ui-kit-toolbar-color-swatch");
8
8
  * @internal
9
9
  */
10
10
  export function UiToolbarColorSwatch({ variant = "fill", color, hasBorder = false, isTransparent = false, glyph = "A", }) {
11
- const isTransparentFill = variant === "fill" && isTransparent;
12
- return (_jsx("span", { className: b({ variant, hasBorder, isTransparent: isTransparentFill }), "aria-hidden": true, children: variant === "fill" ? (_jsx("span", { className: e("fill"), style: { backgroundColor: isTransparentFill ? undefined : color }, children: isTransparentFill ? _jsx("span", { className: e("transparent") }) : null })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: e("glyph"), children: glyph }), _jsx("span", { className: e("bar"), style: { backgroundColor: color } })] })) }));
11
+ const swatchStyle = { backgroundColor: isTransparent ? undefined : color };
12
+ const checker = isTransparent ? _jsx("span", { className: e("transparent") }) : null;
13
+ return (_jsx("span", { className: b({ variant, hasBorder, isTransparent }), "aria-hidden": true, children: variant === "fill" ? (_jsx("span", { className: e("fill"), style: swatchStyle, children: checker })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: e("glyph"), children: glyph }), _jsx("span", { className: e("bar"), style: swatchStyle, children: checker })] })) }));
13
14
  }
@@ -49,6 +49,23 @@ export interface IUiToolbarStepperProps {
49
49
  * revert the typed text to the committed value.
50
50
  */
51
51
  onCommit?: (value: string) => void;
52
+ /**
53
+ * Reports every change of the typed text. A consumer that applies the text live must pass it
54
+ * back as `value` while it is being typed, because `value` is what the field shows. Such a
55
+ * consumer has committed each keystroke already, so Escape and blur restore the `value` it
56
+ * passes and any return to the text from before the edit is its own to make. A consumer that
57
+ * waits for `onCommit` leaves `value` alone and gets that return from the field.
58
+ */
59
+ onDraftChange?: (draft: string) => void;
60
+ /**
61
+ * Marks the typed text as not acceptable.
62
+ * @defaultValue false
63
+ */
64
+ isInvalid?: boolean;
65
+ /**
66
+ * Shown in the editable value while it is empty.
67
+ */
68
+ placeholder?: string;
52
69
  /**
53
70
  * Held while the preset list is on screen.
54
71
  * @defaultValue false
@@ -1 +1 @@
1
- {"version":3,"file":"UiToolbarStepper.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiToolbarStepper/UiToolbarStepper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAwB,MAAM,OAAO,CAAC;AAE9G,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAK3E;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACjD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;I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AAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,oCAAoC,CAAC;IAC1D,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,4BAA4B,CAAC,gBAAgB,CAAC,CAAC;IAChE,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAsBD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,mHAsJ3B,CAAC"}
@@ -27,13 +27,21 @@ const DEFAULT_ICONS = {
27
27
  *
28
28
  * @internal
29
29
  */
30
- export const UiToolbarStepper = forwardRef(function UiToolbarStepper({ variant, value, onStep, canStepUp = true, canStepDown = true, isDisabled = false, accessibilityConfig, decreaseIcon, increaseIcon, onCommit, isOpen = false, ariaAttributes, inputRef, onClick, onInputKeyDown, dataTestId, }, ref) {
30
+ export const UiToolbarStepper = forwardRef(function UiToolbarStepper({ variant, value, onStep, canStepUp = true, canStepDown = true, isDisabled = false, accessibilityConfig, decreaseIcon, increaseIcon, onCommit, onDraftChange, isInvalid = false, placeholder, isOpen = false, ariaAttributes, inputRef, onClick, onInputKeyDown, dataTestId, }, ref) {
31
31
  const isEditable = variant === "value" && onCommit !== undefined;
32
32
  const [draft, setDraft] = useState(value);
33
33
  const [committed, setCommitted] = useState(value);
34
+ // The text last typed, while it may still come back as `value`.
35
+ const [typed, setTyped] = useState();
36
+ // What the status region says. A value that merely echoes the typed text is left out: the
37
+ // input reads the keystrokes itself, and a second reading of each one would talk over it.
38
+ const [announced, setAnnounced] = useState(value);
34
39
  if (committed !== value) {
35
40
  setCommitted(value);
36
41
  setDraft(value);
42
+ if (value !== typed) {
43
+ setAnnounced(value);
44
+ }
37
45
  }
38
46
  const handleKeyDown = (event) => {
39
47
  // A disabled value is read-only but focusable; the keys that would open an enclosing
@@ -60,6 +68,7 @@ export const UiToolbarStepper = forwardRef(function UiToolbarStepper({ variant,
60
68
  event.preventDefault();
61
69
  event.stopPropagation();
62
70
  if (canStepUp) {
71
+ setTyped(undefined);
63
72
  onStep(1);
64
73
  }
65
74
  }
@@ -67,19 +76,29 @@ export const UiToolbarStepper = forwardRef(function UiToolbarStepper({ variant,
67
76
  event.preventDefault();
68
77
  event.stopPropagation();
69
78
  if (canStepDown) {
79
+ setTyped(undefined);
70
80
  onStep(-1);
71
81
  }
72
82
  }
73
83
  else if (event.code === "Enter") {
74
84
  event.preventDefault();
75
85
  event.stopPropagation();
86
+ setTyped(undefined);
76
87
  onCommit?.(draft);
77
88
  }
78
89
  else if (event.code === "Escape") {
79
90
  // Not stopped: an enclosing dropdown closes its preset list on the same key.
91
+ setTyped(undefined);
80
92
  setDraft(value);
81
93
  }
82
94
  };
83
95
  const icons = DEFAULT_ICONS[variant];
84
- return (_jsxs("div", { ref: ref, className: b({ variant }), "data-testid": dataTestId, children: [_jsx(UiToolbarIconButton, { size: "small", icon: decreaseIcon ?? icons.decrease, label: accessibilityConfig.decrementLabel, isDisabled: isDisabled || !canStepDown, onClick: () => onStep(-1), onKeyDown: keepPopupKeys }), isEditable ? (_jsx("input", { ref: inputRef, className: e("value", { isEditable, isActive: isOpen }), type: "text", inputMode: "decimal", value: draft, "aria-label": accessibilityConfig.ariaLabel, "aria-disabled": isDisabled || undefined, readOnly: isDisabled, onChange: (event) => setDraft(event.target.value), onBlur: () => setDraft(value), onClick: isDisabled ? undefined : onClick, onKeyDown: handleKeyDown, ...ariaAttributes })) : (_jsx("span", { className: e("value", { isEditable }), role: "status", "aria-label": accessibilityConfig.ariaLabel, children: value })), isEditable ? (_jsx("span", { className: "sr-only", role: "status", "aria-label": accessibilityConfig.ariaLabel, children: value })) : null, _jsx(UiToolbarIconButton, { size: "small", icon: increaseIcon ?? icons.increase, label: accessibilityConfig.incrementLabel, isDisabled: isDisabled || !canStepUp, onClick: () => onStep(1), onKeyDown: keepPopupKeys })] }));
96
+ return (_jsxs("div", { ref: ref, className: b({ variant }), "data-testid": dataTestId, children: [_jsx(UiToolbarIconButton, { size: "small", icon: decreaseIcon ?? icons.decrease, label: accessibilityConfig.decrementLabel, isDisabled: isDisabled || !canStepDown, onClick: () => onStep(-1), onKeyDown: keepPopupKeys }), isEditable ? (_jsx("input", { ref: inputRef, className: e("value", { isEditable, isActive: isOpen, isInvalid }), type: "text", inputMode: "decimal", value: draft, placeholder: placeholder, "aria-label": accessibilityConfig.ariaLabel, "aria-disabled": isDisabled || undefined, "aria-invalid": isInvalid || undefined, readOnly: isDisabled, onChange: (event) => {
97
+ setDraft(event.target.value);
98
+ setTyped(event.target.value);
99
+ onDraftChange?.(event.target.value);
100
+ }, onBlur: () => {
101
+ setTyped(undefined);
102
+ setDraft(value);
103
+ }, onClick: isDisabled ? undefined : onClick, onKeyDown: handleKeyDown, ...ariaAttributes })) : (_jsx("span", { className: e("value", { isEditable }), role: "status", "aria-label": accessibilityConfig.ariaLabel, children: value })), isEditable ? (_jsx("span", { className: "sr-only", role: "status", children: `${accessibilityConfig.ariaLabel} ${announced}` })) : null, _jsx(UiToolbarIconButton, { size: "small", icon: increaseIcon ?? icons.increase, label: accessibilityConfig.incrementLabel, isDisabled: isDisabled || !canStepUp, onClick: () => onStep(1), onKeyDown: keepPopupKeys })] }));
85
104
  });
@@ -0,0 +1,12 @@
1
+ import { type IHeaderMenuItem } from "./typings.js";
2
+ /**
3
+ * Product-wide contextual help links, valid in any application.
4
+ *
5
+ * @remarks
6
+ * Prepend these to {@link generateHeaderStaticHelpMenuItems} to build a help menu. The last item
7
+ * carries the divider class, so append the static items directly after it.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare function generateHeaderCommonHelpMenuItems(): IHeaderMenuItem[];
12
+ //# sourceMappingURL=generateHeaderCommonHelpMenuItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateHeaderCommonHelpMenuItems.d.ts","sourceRoot":"","sources":["../../src/Header/generateHeaderCommonHelpMenuItems.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAepD;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,IAAI,eAAe,EAAE,CA2BrE"}
@@ -0,0 +1,51 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { defineMessage } from "react-intl";
3
+ const HEADER_COMMON_HELP_MENU_ITEM_ID_GETTING_STARTED = defineMessage({
4
+ id: "gs.header.helpMenu.gettingStarted",
5
+ }).id;
6
+ const HEADER_COMMON_HELP_MENU_ITEM_ID_CONNECT_DATA = defineMessage({
7
+ id: "gs.header.helpMenu.connectData",
8
+ }).id;
9
+ const HEADER_COMMON_HELP_MENU_ITEM_ID_MANAGE_WORKSPACES = defineMessage({
10
+ id: "gs.header.helpMenu.manage.ws",
11
+ }).id;
12
+ const HEADER_COMMON_HELP_MENU_ITEM_ID_MANAGE_USERS = defineMessage({
13
+ id: "gs.header.helpMenu.manage.user",
14
+ }).id;
15
+ /**
16
+ * Product-wide contextual help links, valid in any application.
17
+ *
18
+ * @remarks
19
+ * Prepend these to {@link generateHeaderStaticHelpMenuItems} to build a help menu. The last item
20
+ * carries the divider class, so append the static items directly after it.
21
+ *
22
+ * @internal
23
+ */
24
+ export function generateHeaderCommonHelpMenuItems() {
25
+ return [
26
+ {
27
+ key: HEADER_COMMON_HELP_MENU_ITEM_ID_GETTING_STARTED,
28
+ className: "s-getting-started",
29
+ href: "https://www.gooddata.com/developers/cloud-native/doc/cloud/getting-started/",
30
+ target: "_blank",
31
+ },
32
+ {
33
+ key: HEADER_COMMON_HELP_MENU_ITEM_ID_CONNECT_DATA,
34
+ className: "s-connect-data",
35
+ href: "https://www.gooddata.com/developers/cloud-native/doc/cloud/getting-started/connect-data/",
36
+ target: "_blank",
37
+ },
38
+ {
39
+ key: HEADER_COMMON_HELP_MENU_ITEM_ID_MANAGE_WORKSPACES,
40
+ className: "s-manage-workspaces",
41
+ href: "https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/manage-workspaces/",
42
+ target: "_blank",
43
+ },
44
+ {
45
+ key: HEADER_COMMON_HELP_MENU_ITEM_ID_MANAGE_USERS,
46
+ className: "s-manage-users gd-menu-item-divider",
47
+ href: "https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/manage-users/",
48
+ target: "_blank",
49
+ },
50
+ ];
51
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/RichText/RichText.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAGlB,KAAK,YAAY,EAIpB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,C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H,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAGlB,gBAAgB,CAAC,EAAE,aAAa,CAAC;CACpC;AAqND;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,2CAM7C"}
@@ -19,6 +19,7 @@ const RICH_TEXT_PLACEHOLDER = `
19
19
  ![image](http://url/img.png)
20
20
  {metric/metric_id}
21
21
  {label/label_id}
22
+ {computed_attribute/computed_attribute_id}
22
23
  `;
23
24
  function DefaultLoadingComponent() {
24
25
  return _jsx(LoadingComponent, {});
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/RichText/helpers/references.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAIxG,MAAM,MAAM,YAAY,GAAG,MAAM,CAC7B,MAAM,EACN;IACI,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;CACpB,CACJ,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,gBAkBhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,YAAY,CAS5F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAkBjG"}
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/RichText/helpers/references.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAIxG,MAAM,MAAM,YAAY,GAAG,MAAM,CAC7B,MAAM,EACN;IACI,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;CACpB,CACJ,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,gBAkBhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,YAAY,CAS5F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7B,CAkBA"}
@@ -1,4 +1,4 @@
1
- // (C) 2022-2025 GoodData Corporation
1
+ // (C) 2022-2026 GoodData Corporation
2
2
  import { areObjRefsEqual } from "@gooddata/sdk-model";
3
3
  import { REFERENCE_REGEX_MATCH } from "../plugins/types.js";
4
4
  export function collectReferences(content) {
@@ -45,12 +45,26 @@ export function createReference(parts) {
45
45
  ref: null,
46
46
  };
47
47
  }
48
+ /**
49
+ * The object type a reference prefix names. A computed attribute keeps its own type rather than
50
+ * collapsing to `displayForm`: it has no labels on the backend, and the `computedAttribute` type on
51
+ * the ref is what tells the execution - and everything else handling an attribute-shaped ref - that
52
+ * this is one. See {@link @gooddata/sdk-model#isComputedAttributeRef}.
53
+ *
54
+ * Compared case-insensitively, the way the reference regex matches the prefix - otherwise a
55
+ * prefix the regex accepts could still resolve to nothing and be left as literal text.
56
+ */
48
57
  function normalizeType(type) {
49
- if (type === "label" || type === "displayForm") {
50
- return "displayForm";
51
- }
52
- if (type === "metric" || type === "measure") {
53
- return "measure";
58
+ switch (type.toLowerCase()) {
59
+ case "label":
60
+ case "displayform":
61
+ return "displayForm";
62
+ case "metric":
63
+ case "measure":
64
+ return "measure";
65
+ case "computed_attribute":
66
+ return "computedAttribute";
67
+ default:
68
+ return null;
54
69
  }
55
- return null;
56
70
  }
@@ -1,6 +1,16 @@
1
1
  import { type IExecutionConfig, type IFilter, type IMeasure, type IResultHeader, type ObjRef } from "@gooddata/sdk-model";
2
2
  import { type DataPoint } from "@gooddata/sdk-ui";
3
3
  import { type ReferenceMap } from "../helpers/references.js";
4
+ /**
5
+ * How a reference's "is there more than one value?" question is answered, per value measure.
6
+ *
7
+ * `count` is a DISTINCT count, so `> 1` means several values. `min` answers the same question by
8
+ * comparison - used where the backend cannot count the item, see {@link getLabels}.
9
+ */
10
+ type MultiplicityProbes = Record<string, {
11
+ localId: string;
12
+ kind: "count" | "min";
13
+ }>;
4
14
  export type EvaluatedMetric = {
5
15
  def: IMeasure;
6
16
  header: IResultHeader;
@@ -17,4 +27,18 @@ export declare function useEvaluatedMetricsAndAttributes(references: ReferenceMa
17
27
  error: any;
18
28
  result: EvaluatedMetric[] | undefined;
19
29
  };
30
+ /**
31
+ * The measures resolving attribute-shaped references: `max` for the value, and `count` alongside it
32
+ * to tell a single value from several.
33
+ *
34
+ * A computed attribute is referenced like any other attribute - its ref goes on the display form
35
+ * slot, typed `computedAttribute` - but it is only asked for its value, see below.
36
+ *
37
+ * @internal
38
+ */
39
+ export declare function getLabels(references: ReferenceMap): {
40
+ probes: MultiplicityProbes;
41
+ metrics: IMeasure<import("@gooddata/sdk-model").IMeasureDefinitionType>[];
42
+ };
43
+ export {};
20
44
  //# sourceMappingURL=useEvaluatedMetricsAndAttributes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEvaluatedMetricsAndAttributes.d.ts","sourceRoot":"","sources":["../../../src/RichText/hooks/useEvaluatedMetricsAndAttributes.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,MAAM,EAId,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,SAAS,EAKjB,MAAM,kB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ACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,gCAAgC,CAC5C,UAAU,EAAE,YAAY,EACxB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE;IA6GvE,OAAO;IAKP,KAAK;IACL,MAAM;EAEb;AAeD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,YAAY;;;EAgDjD"}
@@ -1,11 +1,11 @@
1
1
  // (C) 2022-2026 GoodData Corporation
2
- import { isMeasureDefinition, newAttribute, newMeasure, } from "@gooddata/sdk-model";
2
+ import { isComputedAttributeRef, isMeasureDefinition, newAttribute, newMeasure, } from "@gooddata/sdk-model";
3
3
  import { useBackend, useCancelablePromise, useExecutionDataView, useWorkspace, } from "@gooddata/sdk-ui";
4
4
  export function useEvaluatedMetricsAndAttributes(references, filters, config) {
5
5
  const workspace = useWorkspace();
6
6
  const backend = useBackend();
7
7
  const metrics = getMeasures(references);
8
- const { metrics: labels, countMap } = getLabels(references);
8
+ const { metrics: labels, probes } = getLabels(references);
9
9
  const items = [...metrics, ...labels];
10
10
  const { enabled, isFiltersLoading, ...execConfig } = config;
11
11
  const { status: executionStatus, result: executionResult, error: executionError, } = useExecutionDataView({
@@ -26,8 +26,8 @@ export function useEvaluatedMetricsAndAttributes(references, filters, config) {
26
26
  const dataSeries = executionResult.data().series().toArray();
27
27
  const definition = executionResult.definition;
28
28
  const items = [];
29
- const skippedLocalIds = Object.values(countMap);
30
- const valueLocalIds = Object.keys(countMap);
29
+ const skippedLocalIds = Object.values(probes).map((probe) => probe.localId);
30
+ const valueLocalIds = Object.keys(probes);
31
31
  const relatedHeaders = headerItems[0][0];
32
32
  relatedHeaders.forEach((header, i) => {
33
33
  const data = dataSeries[i].dataPoints()[0];
@@ -49,18 +49,25 @@ export function useEvaluatedMetricsAndAttributes(references, filters, config) {
49
49
  ref: def.measure.definition.measureDefinition.item,
50
50
  });
51
51
  }
52
- // Attribute measure with count as next
52
+ // Attribute measure, with its multiplicity probe as next
53
53
  if (isMeasureDefinition(def.measure.definition) &&
54
54
  valueLocalIds.includes(def.measure.localIdentifier)) {
55
- const countLocalId = countMap[def.measure.localIdentifier];
56
- const countIndex = definition.measures.findIndex((d) => d.measure.localIdentifier === countLocalId);
57
- const countData = dataSeries[countIndex]?.dataPoints()[0] ?? undefined;
55
+ const probe = probes[def.measure.localIdentifier];
56
+ const probeIndex = definition.measures.findIndex((d) => d.measure.localIdentifier === probe.localId);
57
+ const probeData = dataSeries[probeIndex]?.dataPoints()[0] ?? undefined;
58
58
  items.push({
59
59
  def,
60
60
  data,
61
61
  header,
62
62
  format: descriptor.measureHeaderItem.format,
63
- count: parseInt((countData?.rawValue ?? "0").toString()),
63
+ // `count` reads as: 0 none, 1 one value, more than one several. A min
64
+ // probe cannot see "none" - an absent value already surfaces as an
65
+ // empty raw value - so it only distinguishes one from several.
66
+ count: probe.kind === "count"
67
+ ? parseInt((probeData?.rawValue ?? "0").toString())
68
+ : probeData?.rawValue === data.rawValue
69
+ ? 1
70
+ : 2,
64
71
  ref: def.measure.definition.measureDefinition.item,
65
72
  });
66
73
  }
@@ -88,9 +95,18 @@ function getMeasures(references) {
88
95
  });
89
96
  });
90
97
  }
91
- function getLabels(references) {
98
+ /**
99
+ * The measures resolving attribute-shaped references: `max` for the value, and `count` alongside it
100
+ * to tell a single value from several.
101
+ *
102
+ * A computed attribute is referenced like any other attribute - its ref goes on the display form
103
+ * slot, typed `computedAttribute` - but it is only asked for its value, see below.
104
+ *
105
+ * @internal
106
+ */
107
+ export function getLabels(references) {
92
108
  const attributes = Object.values(references)
93
- .map(({ type, ref }) => (type === "displayForm" || type === "attribute" ? ref : null))
109
+ .map(({ type, ref }) => type === "displayForm" || type === "attribute" || type === "computedAttribute" ? ref : null)
94
110
  .filter(Boolean);
95
111
  const items = attributes.map((ref, i) => {
96
112
  return newAttribute(ref, (m) => {
@@ -98,27 +114,35 @@ function getLabels(references) {
98
114
  return m;
99
115
  });
100
116
  });
101
- const countMap = {};
117
+ const probes = {};
102
118
  const metrics = items.reduce((acc, attr, i) => {
103
119
  const valueLocalId = `m_max_${i}`;
104
- const countLocalId = `m_count_${i}`;
105
- countMap[valueLocalId] = countLocalId;
120
+ const value = newMeasure(attr.attribute.displayForm, (m) => {
121
+ m.localId(valueLocalId);
122
+ m.aggregation("max");
123
+ return m;
124
+ });
125
+ // A computed attribute cannot be counted without a slicing context: it is functionally
126
+ // determined by the attributes it is computed on, and its own dataset is synthetic, so
127
+ // the backend has no single witness to count over and rejects the whole execution with
128
+ // "Ambiguous context for count" - which would take every other reference in the widget
129
+ // with it. Its minimum answers the same question: `count` here compiles to a DISTINCT
130
+ // count, so "more than one value" is precisely "the smallest differs from the largest".
131
+ const useMin = isComputedAttributeRef(attr.attribute.displayForm);
132
+ const probeLocalId = useMin ? `m_min_${i}` : `m_count_${i}`;
133
+ probes[valueLocalId] = { localId: probeLocalId, kind: useMin ? "min" : "count" };
106
134
  return [
107
135
  ...acc,
136
+ value,
108
137
  newMeasure(attr.attribute.displayForm, (m) => {
109
- m.localId(valueLocalId);
110
- m.aggregation("max");
111
- return m;
112
- }),
113
- newMeasure(attr.attribute.displayForm, (m) => {
114
- m.localId(countLocalId);
115
- m.aggregation("count");
138
+ m.localId(probeLocalId);
139
+ m.aggregation(useMin ? "min" : "count");
116
140
  return m;
117
141
  }),
118
142
  ];
119
143
  }, []);
120
144
  return {
121
- countMap,
145
+ probes,
122
146
  metrics,
123
147
  };
124
148
  }
@@ -8,10 +8,22 @@ export type TextNode = HtmlNode & {
8
8
  value: string;
9
9
  };
10
10
  /**
11
+ * A computed attribute has no labels on the backend, so it cannot be named by the `label` prefix
12
+ * and carries a prefix of its own. It is spelled the MAQL way, `computed_attribute` - as every
13
+ * prefix here is a MAQL object type, and as drill URL placeholders and the YAML convertors spell
14
+ * it too. The REST form of the type, `computedAttribute`, is deliberately not accepted: one
15
+ * spelling per object keeps stored content comparable across all of them.
16
+ *
17
+ * Prefixes are matched case-insensitively; identifiers are not, LDM identifiers being
18
+ * case-sensitive.
19
+ *
11
20
  * @internal
12
21
  */
13
22
  export declare const REFERENCE_REGEX_SPLIT: RegExp;
14
23
  /**
24
+ * Capture groups, relied on by every consumer: 1 = the whole `{…}`, 2 = `prefix/identifier`,
25
+ * 3 = the prefix, 4 = the identifier. Keep the group structure when adding a prefix.
26
+ *
15
27
  * @internal
16
28
  */
17
29
  export declare const REFERENCE_REGEX_MATCH: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/RichText/plugins/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AACtG,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAA2C,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAA6C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/RichText/plugins/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAA8D,CAAC;AAEjG;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAgE,CAAC"}
@@ -1,9 +1,21 @@
1
1
  // (C) 2022-2026 GoodData Corporation
2
2
  /**
3
+ * A computed attribute has no labels on the backend, so it cannot be named by the `label` prefix
4
+ * and carries a prefix of its own. It is spelled the MAQL way, `computed_attribute` - as every
5
+ * prefix here is a MAQL object type, and as drill URL placeholders and the YAML convertors spell
6
+ * it too. The REST form of the type, `computedAttribute`, is deliberately not accepted: one
7
+ * spelling per object keeps stored content comparable across all of them.
8
+ *
9
+ * Prefixes are matched case-insensitively; identifiers are not, LDM identifiers being
10
+ * case-sensitive.
11
+ *
3
12
  * @internal
4
13
  */
5
- export const REFERENCE_REGEX_SPLIT = /(\{(?:label|metric)\/[a-z0-9._-]*\})/gi;
14
+ export const REFERENCE_REGEX_SPLIT = /(\{(?:label|metric|computed_attribute)\/[a-z0-9._-]*\})/gi;
6
15
  /**
16
+ * Capture groups, relied on by every consumer: 1 = the whole `{…}`, 2 = `prefix/identifier`,
17
+ * 3 = the prefix, 4 = the identifier. Keep the group structure when adding a prefix.
18
+ *
7
19
  * @internal
8
20
  */
9
- export const REFERENCE_REGEX_MATCH = /(\{((label|metric)\/([a-z0-9._-]*))\})/gi;
21
+ export const REFERENCE_REGEX_MATCH = /(\{((label|metric|computed_attribute)\/([a-z0-9._-]*))\})/gi;
package/esm/index.d.ts CHANGED
@@ -83,6 +83,7 @@ export { HeaderWorkspacePicker, type IHeaderWorkspace, type IHeaderWorkspacePick
83
83
  export { HeaderDataMenu, type IHeaderDataMenuItem, type IHeaderDataMenuProps, } from "./Header/HeaderDataMenu.js";
84
84
  export { generateHeaderAccountMenuItems, type IUiSettings } from "./Header/generateHeaderAccountMenuItems.js";
85
85
  export { generateHeaderHelpMenuItems } from "./Header/generateHeaderHelpMenuItems.js";
86
+ export { generateHeaderCommonHelpMenuItems } from "./Header/generateHeaderCommonHelpMenuItems.js";
86
87
  export { generateHeaderStaticHelpMenuItems } from "./Header/generateHeaderStaticHelpMenuItems.js";
87
88
  export { HeaderBadge, type IHeaderBadgeProps } from "./Header/HeaderBadge.js";
88
89
  export { HeaderBadgeWithModal, type IHeaderBadgeWithModalProps } from "./Header/HeaderBadgeWithModal.js";