@gooddata/sdk-ui-kit 11.61.0-alpha.4 → 11.61.0-alpha.5

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.
@@ -57,5 +57,24 @@ export interface IUiResizableSidebarStateOptions {
57
57
  minContentWidth?: number;
58
58
  isResizable: boolean;
59
59
  isCollapsible: boolean;
60
+ /**
61
+ * When defined, takes precedence over the persisted collapsed flag, e.g. for an embedder-driven
62
+ * sidebar. The setters keep writing only the persisted state, so release the override from
63
+ * `onUserChange`, or it keeps winning over the user's change.
64
+ */
65
+ collapsedOverride?: boolean;
66
+ /**
67
+ * When defined, takes precedence over the persisted expanded width; clamped to the current
68
+ * bounds like any width. Released the same way as `collapsedOverride`.
69
+ */
70
+ widthOverride?: number;
71
+ /**
72
+ * Called with the changed property right before a live setter persists a user change; never
73
+ * called by a setter that cannot change anything (resize while collapsed or not resizable,
74
+ * collapse while not collapsible). The place to release an override of the property. Keep the
75
+ * reference stable (useCallback): the setters keep their identity only while it is, and
76
+ * consumers hold them in effect dependencies.
77
+ */
78
+ onUserChange?: (property: "collapsed" | "width") => void;
60
79
  }
61
80
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,YA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;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,KAAK,IAAI,CAAC;CAC5D"}
@@ -15,5 +15,5 @@ export declare const UI_RESIZABLE_SIDEBAR_RAIL_WIDTH = 48;
15
15
  *
16
16
  * @internal
17
17
  */
18
- export declare function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail, minContentWidth, isResizable, isCollapsible, }: IUiResizableSidebarStateOptions): IUiResizableSidebarState;
18
+ export declare function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail, minContentWidth, isResizable, isCollapsible, collapsedOverride, widthOverride, onUserChange, }: IUiResizableSidebarStateOptions): IUiResizableSidebarState;
19
19
  //# sourceMappingURL=useUiResizableSidebarState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUiResizableSidebarState.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/useUiResizableSidebarState.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAIjG;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAsBlD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,EACvC,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,OAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,GAChB,EAAE,+BAA+B,GAAG,wBAAwB,CAyE5D"}
1
+ {"version":3,"file":"useUiResizableSidebarState.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/useUiResizableSidebarState.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAIjG;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAsBlD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,EACvC,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,OAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,YAAY,GACf,EAAE,+BAA+B,GAAG,wBAAwB,CA8F5D"}
@@ -1,5 +1,5 @@
1
1
  // (C) 2026 GoodData Corporation
2
- import { useEffect, useMemo, useState } from "react";
2
+ import { useCallback, useEffect, useMemo, useState } from "react";
3
3
  import { clamp } from "lodash-es";
4
4
  import { useLocalStorage } from "@gooddata/sdk-ui";
5
5
  const noop = () => { };
@@ -33,21 +33,29 @@ function useWindowWidth(active) {
33
33
  *
34
34
  * @internal
35
35
  */
36
- export function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail = false, minContentWidth, isResizable, isCollapsible, }) {
36
+ export function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail = false, minContentWidth, isResizable, isCollapsible, collapsedOverride, widthOverride, onUserChange, }) {
37
37
  const viewportWidth = useWindowWidth(isResizable && minContentWidth !== undefined);
38
38
  const [storedWidth, setPersistedWidth] = useLocalStorage(widthStorageKey, null);
39
39
  const [storedCollapsed, setPersistedCollapsed] = useLocalStorage(collapsedStorageKey, false);
40
- // Anything may have written these keys, so only well-formed values are trusted.
40
+ // Anything may have written these keys, so only well-formed values are trusted; the overrides
41
+ // win over them but go through the same clamping.
41
42
  const persistedWidth = typeof storedWidth === "number" && Number.isFinite(storedWidth) ? storedWidth : minWidth;
42
- const persistedCollapsed = storedCollapsed === true;
43
+ const preferredWidth = typeof widthOverride === "number" && Number.isFinite(widthOverride) ? widthOverride : persistedWidth;
44
+ const preferredCollapsed = collapsedOverride ?? storedCollapsed === true;
45
+ // Consumers keep setCollapsed in effect deps (AI-mode auto-collapse), so its identity must survive recomputes.
46
+ const announceAndSetCollapsed = useCallback((collapsed) => {
47
+ onUserChange?.("collapsed");
48
+ setPersistedCollapsed(collapsed);
49
+ }, [onUserChange, setPersistedCollapsed]);
43
50
  return useMemo(() => {
44
51
  const collapsedWidth = hasRail ? UI_RESIZABLE_SIDEBAR_RAIL_WIDTH : 0;
45
52
  const max = minContentWidth === undefined
46
53
  ? maxWidth
47
54
  : clamp(viewportWidth - minContentWidth, minWidth, maxWidth);
48
- const expandedWidth = isResizable ? clamp(persistedWidth, minWidth, max) : minWidth;
49
- const setCollapsed = isCollapsible ? setPersistedCollapsed : noop;
50
- if (isCollapsible && persistedCollapsed) {
55
+ const expandedWidth = isResizable ? clamp(preferredWidth, minWidth, max) : minWidth;
56
+ // Live setters announce the user change first so the caller can release an override of the property.
57
+ const setCollapsed = isCollapsible ? announceAndSetCollapsed : noop;
58
+ if (isCollapsible && preferredCollapsed) {
51
59
  return {
52
60
  width: collapsedWidth,
53
61
  expandedWidth,
@@ -75,28 +83,35 @@ export function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKe
75
83
  setCollapsed,
76
84
  };
77
85
  }
86
+ const canResize = max > minWidth;
78
87
  return {
79
88
  width: expandedWidth,
80
89
  expandedWidth,
81
90
  min: minWidth,
82
91
  max,
83
- canResize: max > minWidth,
84
- setWidth: (next) => setPersistedWidth(clamp(next, minWidth, max)),
92
+ canResize,
93
+ setWidth: canResize
94
+ ? (next) => {
95
+ onUserChange?.("width");
96
+ setPersistedWidth(clamp(next, minWidth, max));
97
+ }
98
+ : noop,
85
99
  canCollapse: isCollapsible,
86
100
  hasRail,
87
101
  isCollapsed: false,
88
102
  setCollapsed,
89
103
  };
90
104
  }, [
105
+ announceAndSetCollapsed,
91
106
  hasRail,
92
107
  isCollapsible,
93
108
  isResizable,
94
109
  maxWidth,
95
110
  minContentWidth,
96
111
  minWidth,
97
- persistedCollapsed,
98
- persistedWidth,
99
- setPersistedCollapsed,
112
+ onUserChange,
113
+ preferredCollapsed,
114
+ preferredWidth,
100
115
  setPersistedWidth,
101
116
  viewportWidth,
102
117
  ]);
@@ -716,6 +716,9 @@ export declare const defaultFocusCheckFn: (element: HTMLElement) => boolean;
716
716
  export declare function DefaultSyntaxHighlightingInput({ className, highlightStyle, ...props }: IDefaultSyntaxHighlightingInputProps): JSX.Element;
717
717
 
718
718
  /**
719
+ * Token colors use only the complementary scale and the semantic palette.
720
+ * Both invert with the theme, so tokens stay legible on dark surfaces.
721
+ *
719
722
  * @internal
720
723
  */
721
724
  export declare const defaultSyntaxHighlightStyle: HighlightStyle;
@@ -9353,6 +9356,25 @@ export declare interface IUiResizableSidebarStateOptions {
9353
9356
  minContentWidth?: number;
9354
9357
  isResizable: boolean;
9355
9358
  isCollapsible: boolean;
9359
+ /**
9360
+ * When defined, takes precedence over the persisted collapsed flag, e.g. for an embedder-driven
9361
+ * sidebar. The setters keep writing only the persisted state, so release the override from
9362
+ * `onUserChange`, or it keeps winning over the user's change.
9363
+ */
9364
+ collapsedOverride?: boolean;
9365
+ /**
9366
+ * When defined, takes precedence over the persisted expanded width; clamped to the current
9367
+ * bounds like any width. Released the same way as `collapsedOverride`.
9368
+ */
9369
+ widthOverride?: number;
9370
+ /**
9371
+ * Called with the changed property right before a live setter persists a user change; never
9372
+ * called by a setter that cannot change anything (resize while collapsed or not resizable,
9373
+ * collapse while not collapsible). The place to release an override of the property. Keep the
9374
+ * reference stable (useCallback): the setters keep their identity only while it is, and
9375
+ * consumers hold them in effect dependencies.
9376
+ */
9377
+ onUserChange?: (property: "collapsed" | "width") => void;
9356
9378
  }
9357
9379
 
9358
9380
  /**
@@ -13277,7 +13299,7 @@ export declare function useUiResizableSidebar(fallback?: IUiResizableSidebarStat
13277
13299
  *
13278
13300
  * @internal
13279
13301
  */
13280
- export declare function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail, minContentWidth, isResizable, isCollapsible, }: IUiResizableSidebarStateOptions): IUiResizableSidebarState;
13302
+ export declare function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail, minContentWidth, isResizable, isCollapsible, collapsedOverride, widthOverride, onUserChange, }: IUiResizableSidebarStateOptions): IUiResizableSidebarState;
13281
13303
 
13282
13304
  /**
13283
13305
  * @internal
@@ -1,5 +1,8 @@
1
1
  import { HighlightStyle } from "@codemirror/language";
2
2
  /**
3
+ * Token colors use only the complementary scale and the semantic palette.
4
+ * Both invert with the theme, so tokens stay legible on dark surfaces.
5
+ *
3
6
  * @internal
4
7
  */
5
8
  export declare const defaultSyntaxHighlightStyle: HighlightStyle;
@@ -1 +1 @@
1
- {"version":3,"file":"defaultHighlightStyle.d.ts","sourceRoot":"","sources":["../../src/syntaxHighlightingInput/defaultHighlightStyle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;GAEG;AACH,eAAO,MAAM,2BAA2B,gBAQtC,CAAC"}
1
+ {"version":3,"file":"defaultHighlightStyle.d.ts","sourceRoot":"","sources":["../../src/syntaxHighlightingInput/defaultHighlightStyle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,gBAetC,CAAC"}
@@ -2,14 +2,24 @@
2
2
  import { HighlightStyle } from "@codemirror/language";
3
3
  import { tags as t } from "@lezer/highlight";
4
4
  /**
5
+ * Token colors use only the complementary scale and the semantic palette.
6
+ * Both invert with the theme, so tokens stay legible on dark surfaces.
7
+ *
5
8
  * @internal
6
9
  */
7
10
  export const defaultSyntaxHighlightStyle = HighlightStyle.define([
8
- { tag: t.punctuation, color: "#94a1ad" },
9
- { tag: t.bracket, color: "#94a1ad" },
10
- { tag: t.variableName, color: "#464e56" },
11
- { tag: t.string, color: "#a11" },
12
- { tag: t.special(t.variableName), color: "#13b1e2", fontWeight: "bold" },
13
- { tag: t.standard(t.variableName), color: "#00c18e", fontWeight: "bold" },
14
- { tag: t.keyword, color: "#ab55a3", fontWeight: "bold" },
11
+ { tag: [t.punctuation, t.bracket], color: "var(--gd-palette-complementary-6)" },
12
+ { tag: t.variableName, color: "var(--gd-palette-complementary-8)" },
13
+ { tag: t.string, color: "var(--gd-palette-primary-base)" },
14
+ {
15
+ tag: t.special(t.variableName),
16
+ color: "var(--gd-palette-primary-base)",
17
+ fontWeight: "bold",
18
+ },
19
+ {
20
+ tag: t.standard(t.variableName),
21
+ color: "var(--gd-palette-success-base)",
22
+ fontWeight: "bold",
23
+ },
24
+ { tag: t.keyword, color: "var(--gd-palette-warning-base)", fontWeight: "bold" },
15
25
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-kit",
3
- "version": "11.61.0-alpha.4",
3
+ "version": "11.61.0-alpha.5",
4
4
  "description": "GoodData SDK - UI Building Components",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -79,11 +79,11 @@
79
79
  "unified": "^11.0.5",
80
80
  "uuid": "11.1.1",
81
81
  "yaml": "2.8.3",
82
- "@gooddata/sdk-backend-spi": "11.61.0-alpha.4",
83
- "@gooddata/sdk-model": "11.61.0-alpha.4",
84
- "@gooddata/sdk-ui": "11.61.0-alpha.4",
85
- "@gooddata/sdk-ui-theme-provider": "11.61.0-alpha.4",
86
- "@gooddata/util": "11.61.0-alpha.4"
82
+ "@gooddata/sdk-backend-spi": "11.61.0-alpha.5",
83
+ "@gooddata/sdk-model": "11.61.0-alpha.5",
84
+ "@gooddata/sdk-ui": "11.61.0-alpha.5",
85
+ "@gooddata/sdk-ui-theme-provider": "11.61.0-alpha.5",
86
+ "@gooddata/util": "11.61.0-alpha.5"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@microsoft/api-documenter": "7.30.16",
@@ -128,11 +128,11 @@
128
128
  "typescript": "7.0.2",
129
129
  "vitest": "4.1.11",
130
130
  "vitest-dom": "0.1.1",
131
- "@gooddata/eslint-config": "11.61.0-alpha.4",
132
- "@gooddata/reference-workspace": "11.61.0-alpha.4",
133
- "@gooddata/sdk-backend-mockingbird": "11.61.0-alpha.4",
134
- "@gooddata/oxlint-config": "11.61.0-alpha.4",
135
- "@gooddata/stylelint-config": "11.61.0-alpha.4"
131
+ "@gooddata/eslint-config": "11.61.0-alpha.5",
132
+ "@gooddata/oxlint-config": "11.61.0-alpha.5",
133
+ "@gooddata/reference-workspace": "11.61.0-alpha.5",
134
+ "@gooddata/sdk-backend-mockingbird": "11.61.0-alpha.5",
135
+ "@gooddata/stylelint-config": "11.61.0-alpha.5"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "react": "^18.0.0 || ^19.0.0",
@@ -418,7 +418,7 @@ textarea.gd-input, textarea.input-text {
418
418
  font-size: 14px;
419
419
  font-family: var(--gd-font-family, gdcustomfont, Avenir, "Helvetica Neue", arial, sans-serif);
420
420
  font-weight: 200;
421
- color: var(--gd-palette-complementary-6-from-theme, #b0beca);
421
+ color: var(--gd-palette-complementary-6-from-theme, #94a1ad);
422
422
  min-width: 30px;
423
423
  text-align: center;
424
424
  background-color: var(--gd-palette-complementary-1-from-theme, #fcfcfd);
@@ -8621,7 +8621,7 @@ textarea.gd-input, textarea.input-text {
8621
8621
  font-size: 14px;
8622
8622
  font-family: var(--gd-font-family, gdcustomfont, Avenir, "Helvetica Neue", arial, sans-serif);
8623
8623
  font-weight: 200;
8624
- color: var(--gd-palette-complementary-6-from-theme, #b0beca);
8624
+ color: var(--gd-palette-complementary-6-from-theme, #94a1ad);
8625
8625
  min-width: 30px;
8626
8626
  text-align: center;
8627
8627
  background-color: var(--gd-palette-complementary-1-from-theme, #fcfcfd);
@@ -316,7 +316,7 @@ textarea {
316
316
  flex: 0 0 auto;
317
317
  @include form-mixins.gd-input-base;
318
318
 
319
- color: var(--gd-palette-complementary-6-from-theme, variables.$default-gd-color-disabled);
319
+ color: var(--gd-palette-complementary-6-from-theme, variables.$default-gd-color-state-blank);
320
320
  min-width: 30px;
321
321
  text-align: center;
322
322
  background-color: var(--gd-palette-complementary-1-from-theme, variables.$default-gd-color-light);