@gooddata/sdk-ui-kit 11.60.0-alpha.2 → 11.60.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/esm/@ui/@dev/ComponentTable.js +2 -2
  2. package/esm/@ui/@types/icon.d.ts +1 -1
  3. package/esm/@ui/@types/icon.d.ts.map +1 -1
  4. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTable.d.ts.map +1 -1
  5. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTable.js +12 -4
  6. package/esm/@ui/UiAsyncTable/UiAsyncTable/UiAsyncTableRow.js +7 -6
  7. package/esm/@ui/UiAsyncTable/types.d.ts +9 -0
  8. package/esm/@ui/UiAsyncTable/types.d.ts.map +1 -1
  9. package/esm/@ui/UiChip/ChipActionButton.d.ts +1 -1
  10. package/esm/@ui/UiChip/ChipActionButton.d.ts.map +1 -1
  11. package/esm/@ui/UiChip/ChipActionButton.js +22 -2
  12. package/esm/@ui/UiChip/ChipContent.d.ts +1 -1
  13. package/esm/@ui/UiChip/ChipContent.d.ts.map +1 -1
  14. package/esm/@ui/UiChip/ChipContent.js +59 -17
  15. package/esm/@ui/UiChip/UiChip.d.ts +1 -1
  16. package/esm/@ui/UiChip/UiChip.d.ts.map +1 -1
  17. package/esm/@ui/UiChip/UiChip.js +3 -3
  18. package/esm/@ui/UiChip/types.d.ts +4 -0
  19. package/esm/@ui/UiChip/types.d.ts.map +1 -1
  20. package/esm/@ui/UiIcon/icons.d.ts.map +1 -1
  21. package/esm/@ui/UiIcon/icons.js +2 -0
  22. package/esm/@ui/UiResizableSidebar/UiResizableSidebar.d.ts +38 -0
  23. package/esm/@ui/UiResizableSidebar/UiResizableSidebar.d.ts.map +1 -0
  24. package/esm/@ui/UiResizableSidebar/UiResizableSidebar.js +116 -0
  25. package/esm/@ui/UiResizableSidebar/UiResizableSidebarCollapseToggle.d.ts +31 -0
  26. package/esm/@ui/UiResizableSidebar/UiResizableSidebarCollapseToggle.d.ts.map +1 -0
  27. package/esm/@ui/UiResizableSidebar/UiResizableSidebarCollapseToggle.js +52 -0
  28. package/esm/@ui/UiResizableSidebar/UiResizableSidebarContext.d.ts +48 -0
  29. package/esm/@ui/UiResizableSidebar/UiResizableSidebarContext.d.ts.map +1 -0
  30. package/esm/@ui/UiResizableSidebar/UiResizableSidebarContext.js +75 -0
  31. package/esm/@ui/UiResizableSidebar/UiResizableSidebarExpandTrigger.d.ts +21 -0
  32. package/esm/@ui/UiResizableSidebar/UiResizableSidebarExpandTrigger.d.ts.map +1 -0
  33. package/esm/@ui/UiResizableSidebar/UiResizableSidebarExpandTrigger.js +29 -0
  34. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandle.d.ts +17 -0
  35. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandle.d.ts.map +1 -0
  36. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandle.js +40 -0
  37. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandleContext.d.ts +16 -0
  38. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandleContext.d.ts.map +1 -0
  39. package/esm/@ui/UiResizableSidebar/UiResizableSidebarHandleContext.js +4 -0
  40. package/esm/@ui/UiResizableSidebar/types.d.ts +61 -0
  41. package/esm/@ui/UiResizableSidebar/types.d.ts.map +1 -0
  42. package/esm/@ui/UiResizableSidebar/types.js +2 -0
  43. package/esm/@ui/UiResizableSidebar/useUiResizableSidebarState.d.ts +19 -0
  44. package/esm/@ui/UiResizableSidebar/useUiResizableSidebarState.d.ts.map +1 -0
  45. package/esm/@ui/UiResizableSidebar/useUiResizableSidebarState.js +103 -0
  46. package/esm/Dialog/ConfirmDialogBase.js +1 -1
  47. package/esm/Dialog/StylingEditorDialog/StylingEditorDialog.js +1 -1
  48. package/esm/Header/generateHeaderMenuItemsGroups.js +3 -6
  49. package/esm/Timepicker/Timepicker.js +1 -1
  50. package/esm/index.d.ts +7 -0
  51. package/esm/index.d.ts.map +1 -1
  52. package/esm/index.js +6 -0
  53. package/esm/sdk-ui-kit.d.ts +224 -2
  54. package/package.json +11 -11
  55. package/src/@ui/UiAsyncTable/asyncTable.scss +8 -0
  56. package/src/@ui/UiResizableSidebar/UiResizableSidebar.scss +132 -0
  57. package/src/@ui/index.scss +2 -1
  58. package/styles/css/main.css +100 -0
  59. package/styles/css/main.css.map +1 -1
@@ -0,0 +1,116 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState, } from "react";
4
+ import { clamp } from "lodash-es";
5
+ import { bem } from "../@utils/bem.js";
6
+ import { useCloseOnEscape } from "../hooks/useCloseOnEscape.js";
7
+ import { useOptionalUiResizableSidebar } from "./UiResizableSidebarContext.js";
8
+ import { UiResizableSidebarHandleContext, } from "./UiResizableSidebarHandleContext.js";
9
+ const { b } = bem("gd-ui-kit-resizable-sidebar");
10
+ const DEFAULT_KEYBOARD_STEP = 10;
11
+ /**
12
+ * Drag-to-resize wrapper for a sidebar. Owns only the in-progress drag: the sidebar keeps its committed
13
+ * width during the gesture while the handle shows the indicated width, and the width is committed on
14
+ * release. Escape cancels the drag.
15
+ *
16
+ * @remarks
17
+ * The width transition can be kept in step with sibling layout transitions by setting the
18
+ * `--resizable-sidebar-slide-duration` custom property on the sidebar element. A sidebar collapsed to
19
+ * zero width is inert, so its collapse toggle cannot restore it: render a second
20
+ * {@link UiResizableSidebarCollapseToggle} or a {@link UiResizableSidebarExpandTrigger} outside it.
21
+ *
22
+ * @internal
23
+ */
24
+ export function UiResizableSidebar({ state, keyboardStep = DEFAULT_KEYBOARD_STEP, dataTestId, children, }) {
25
+ const providedState = useOptionalUiResizableSidebar();
26
+ const resolvedState = state ?? providedState;
27
+ if (!resolvedState) {
28
+ throw new Error("`UiResizableSidebar` needs a `state` prop or a `UiResizableSidebarProvider` above it");
29
+ }
30
+ const { width, min, max, canResize, setWidth: onWidthChange, isCollapsed } = resolvedState;
31
+ const [dragWidth, setDragWidth] = useState(null);
32
+ const dragRef = useRef(null);
33
+ const rootRef = useRef(null);
34
+ const isDragging = dragWidth !== null;
35
+ const isHidden = isCollapsed && width === 0;
36
+ // Set imperatively: React 18 drops a boolean `inert` and React 19 treats an empty string as false.
37
+ useLayoutEffect(() => {
38
+ rootRef.current?.toggleAttribute("inert", isHidden);
39
+ }, [isHidden]);
40
+ const endDrag = useCallback(() => {
41
+ const drag = dragRef.current;
42
+ dragRef.current = null;
43
+ setDragWidth(null);
44
+ // Clearing the drag first keeps the resulting lostpointercapture from committing anything.
45
+ if (drag?.handle.hasPointerCapture?.(drag.pointerId)) {
46
+ drag.handle.releasePointerCapture(drag.pointerId);
47
+ }
48
+ }, []);
49
+ useCloseOnEscape(isDragging, endDrag);
50
+ const onPointerDown = useCallback((event) => {
51
+ if (!event.isPrimary || event.button !== 0) {
52
+ return;
53
+ }
54
+ event.preventDefault();
55
+ // Capturing keeps the gesture on the handle even when the cursor leaves its narrow hit area.
56
+ event.currentTarget.setPointerCapture?.(event.pointerId);
57
+ dragRef.current = {
58
+ originX: event.clientX,
59
+ originWidth: width,
60
+ pointerId: event.pointerId,
61
+ width,
62
+ handle: event.currentTarget,
63
+ };
64
+ setDragWidth(width);
65
+ }, [width]);
66
+ const onPointerMove = useCallback((event) => {
67
+ const drag = dragRef.current;
68
+ if (!drag) {
69
+ return;
70
+ }
71
+ if (event.pointerId !== drag.pointerId) {
72
+ return;
73
+ }
74
+ drag.width = clamp(drag.originWidth + (event.clientX - drag.originX), min, max);
75
+ setDragWidth(drag.width);
76
+ }, [min, max]);
77
+ // Fires for pointerup, pointercancel, and a pointer lost to another window, so the width is committed
78
+ // even when no plain pointerup reaches the handle.
79
+ const onLostPointerCapture = useCallback(() => {
80
+ if (dragRef.current) {
81
+ onWidthChange(dragRef.current.width);
82
+ }
83
+ endDrag();
84
+ }, [onWidthChange, endDrag]);
85
+ const handleContext = useMemo(() => ({
86
+ width,
87
+ min,
88
+ max,
89
+ canResize,
90
+ isDragging,
91
+ dragWidth,
92
+ keyboardStep,
93
+ setWidth: onWidthChange,
94
+ onPointerDown,
95
+ onPointerMove,
96
+ onLostPointerCapture,
97
+ }), [
98
+ width,
99
+ min,
100
+ max,
101
+ canResize,
102
+ isDragging,
103
+ dragWidth,
104
+ keyboardStep,
105
+ onWidthChange,
106
+ onPointerDown,
107
+ onPointerMove,
108
+ onLostPointerCapture,
109
+ ]);
110
+ return (_jsx(UiResizableSidebarHandleContext.Provider, { value: handleContext, children: _jsx("div", { ref: rootRef, className: b({
111
+ resizable: canResize,
112
+ dragging: isDragging,
113
+ collapsed: isCollapsed,
114
+ hidden: isHidden,
115
+ }), style: { width }, "data-testid": dataTestId, children: children }) }));
116
+ }
@@ -0,0 +1,31 @@
1
+ import { type ReactElement } from "react";
2
+ /**
3
+ * @internal
4
+ */
5
+ export interface IUiResizableSidebarCollapseToggleProps {
6
+ isCollapsed: boolean;
7
+ onToggle: () => void;
8
+ /**
9
+ * Accessible name while the sidebar is expanded, e.g. "Collapse sidebar".
10
+ */
11
+ collapseLabel: string;
12
+ /**
13
+ * Accessible name while the sidebar is collapsed, e.g. "Expand sidebar".
14
+ */
15
+ expandLabel: string;
16
+ dataTestId?: string;
17
+ }
18
+ /**
19
+ * Collapses and expands a {@link UiResizableSidebar}. Render it in the sidebar header, in a collapsed
20
+ * rail, or anywhere under the same state, e.g. as the restore control of a fully hidden sidebar.
21
+ *
22
+ * @remarks
23
+ * Under a {@link UiResizableSidebarProvider}, a toggle that becomes unusable by its own activation (it is
24
+ * unmounted, or turns inert with a completely hidden sidebar) hands keyboard focus to another toggle under
25
+ * the same provider, even one that mounts later. A sidebar that hides completely therefore needs a second
26
+ * toggle outside it, e.g. in a page header.
27
+ *
28
+ * @internal
29
+ */
30
+ export declare function UiResizableSidebarCollapseToggle({ isCollapsed, onToggle, collapseLabel, expandLabel, dataTestId, }: IUiResizableSidebarCollapseToggleProps): ReactElement;
31
+ //# sourceMappingURL=UiResizableSidebarCollapseToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiResizableSidebarCollapseToggle.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/UiResizableSidebarCollapseToggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAS7D;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAAC,EAC7C,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,UAAU,GACb,EAAE,sCAAsC,GAAG,YAAY,CAuDvD"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { useEffect, useRef } from "react";
4
+ import { bem } from "../@utils/bem.js";
5
+ import { UiIconButton } from "../UiIconButton/UiIconButton.js";
6
+ import { useUiResizableSidebarFocusRegistry } from "./UiResizableSidebarContext.js";
7
+ const { e } = bem("gd-ui-kit-resizable-sidebar");
8
+ /**
9
+ * Collapses and expands a {@link UiResizableSidebar}. Render it in the sidebar header, in a collapsed
10
+ * rail, or anywhere under the same state, e.g. as the restore control of a fully hidden sidebar.
11
+ *
12
+ * @remarks
13
+ * Under a {@link UiResizableSidebarProvider}, a toggle that becomes unusable by its own activation (it is
14
+ * unmounted, or turns inert with a completely hidden sidebar) hands keyboard focus to another toggle under
15
+ * the same provider, even one that mounts later. A sidebar that hides completely therefore needs a second
16
+ * toggle outside it, e.g. in a page header.
17
+ *
18
+ * @internal
19
+ */
20
+ export function UiResizableSidebarCollapseToggle({ isCollapsed, onToggle, collapseLabel, expandLabel, dataTestId, }) {
21
+ const label = isCollapsed ? expandLabel : collapseLabel;
22
+ const registry = useUiResizableSidebarFocusRegistry();
23
+ const buttonRef = useRef(null);
24
+ const activatedRef = useRef(false);
25
+ useEffect(() => {
26
+ const button = buttonRef.current;
27
+ if (!registry || !button) {
28
+ return undefined;
29
+ }
30
+ const unregister = registry.register(button);
31
+ return () => {
32
+ unregister();
33
+ // An activated toggle that disappears with the change hands focus on its way out.
34
+ if (activatedRef.current) {
35
+ activatedRef.current = false;
36
+ registry.handOff(null);
37
+ }
38
+ };
39
+ }, [registry]);
40
+ useEffect(() => {
41
+ if (!activatedRef.current) {
42
+ return;
43
+ }
44
+ activatedRef.current = false;
45
+ registry?.handOff(buttonRef.current);
46
+ }, [isCollapsed, registry]);
47
+ const handleClick = () => {
48
+ activatedRef.current = !!registry;
49
+ onToggle();
50
+ };
51
+ return (_jsx("div", { className: e("collapse-toggle"), children: _jsx(UiIconButton, { ref: buttonRef, icon: "sidePanel", label: label, size: "medium", variant: "tertiary", dataTestId: dataTestId, accessibilityConfig: { ariaLabel: label, ariaExpanded: !isCollapsed }, onClick: handleClick }) }));
52
+ }
@@ -0,0 +1,48 @@
1
+ import { type ReactNode } from "react";
2
+ import { type IUiResizableSidebarState } from "./types.js";
3
+ /**
4
+ * Collapse toggles under one provider register here, so the control whose activation made it unusable can
5
+ * hand keyboard focus to another one, even one that mounts later.
6
+ *
7
+ * @internal
8
+ */
9
+ export interface IUiResizableSidebarFocusRegistry {
10
+ /**
11
+ * Registers a mounted toggle and returns the function that unregisters it. A toggle that mounts while
12
+ * a hand-off is waiting takes focus right away.
13
+ */
14
+ register: (button: HTMLButtonElement) => () => void;
15
+ /**
16
+ * Called by the control whose activation changed the collapse state. The control keeps focus while it
17
+ * stays usable; otherwise another usable toggle takes it, or the next toggle to mount does.
18
+ */
19
+ handOff: (activated: HTMLButtonElement | null) => void;
20
+ }
21
+ /**
22
+ * @internal
23
+ */
24
+ export interface IUiResizableSidebarProviderProps {
25
+ value: IUiResizableSidebarState;
26
+ children: ReactNode;
27
+ }
28
+ /**
29
+ * Shares one sidebar state between the sidebar and controls rendered outside it.
30
+ *
31
+ * @internal
32
+ */
33
+ export declare function UiResizableSidebarProvider({ value, children }: IUiResizableSidebarProviderProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function useUiResizableSidebarFocusRegistry(): IUiResizableSidebarFocusRegistry | undefined;
35
+ /**
36
+ * Returns the sidebar state shared by the nearest {@link UiResizableSidebarProvider}, or undefined outside one.
37
+ */
38
+ export declare function useOptionalUiResizableSidebar(): IUiResizableSidebarState | undefined;
39
+ /**
40
+ * Returns the sidebar state shared by the nearest {@link UiResizableSidebarProvider}.
41
+ *
42
+ * @param fallback - State to use when rendered outside a provider, e.g. a fixed sidebar that cannot be
43
+ * resized. Without a fallback, rendering outside a provider throws.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare function useUiResizableSidebar(fallback?: IUiResizableSidebarState): IUiResizableSidebarState;
48
+ //# sourceMappingURL=UiResizableSidebarContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiResizableSidebarContext.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/UiResizableSidebarContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAe3D;;;;;GAKG;AACH,MAAM,WAAW,gCAAgC;IAC7C;;;OAGG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,MAAM,IAAI,CAAC;IACpD;;;OAGG;IACH,OAAO,EAAE,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D;AAsCD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC7C,KAAK,EAAE,wBAAwB,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,2CAQ/F;AAED,wBAAgB,kCAAkC,IAAI,gCAAgC,GAAG,SAAS,CAEjG;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,wBAAwB,GAAG,SAAS,CAEpF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,wBAAwB,GAAG,wBAAwB,CAUnG"}
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { createContext, useContext, useState } from "react";
4
+ const UiResizableSidebarContext = createContext(undefined);
5
+ UiResizableSidebarContext.displayName = "UiResizableSidebarContext";
6
+ function isUsable(button) {
7
+ return (!!button &&
8
+ button.isConnected &&
9
+ !button.disabled &&
10
+ !button.closest("[inert]") &&
11
+ (button.checkVisibility?.() ?? true));
12
+ }
13
+ function createFocusRegistry() {
14
+ const toggles = new Set();
15
+ let pending = false;
16
+ return {
17
+ register: (button) => {
18
+ toggles.add(button);
19
+ if (pending) {
20
+ pending = false;
21
+ button.focus();
22
+ }
23
+ return () => {
24
+ toggles.delete(button);
25
+ };
26
+ },
27
+ handOff: (activated) => {
28
+ if (isUsable(activated)) {
29
+ return;
30
+ }
31
+ const receiver = [...toggles].find((toggle) => toggle !== activated && isUsable(toggle));
32
+ if (receiver) {
33
+ receiver.focus();
34
+ }
35
+ else {
36
+ pending = true;
37
+ }
38
+ },
39
+ };
40
+ }
41
+ const FocusRegistryContext = createContext(undefined);
42
+ FocusRegistryContext.displayName = "UiResizableSidebarFocusRegistryContext";
43
+ /**
44
+ * Shares one sidebar state between the sidebar and controls rendered outside it.
45
+ *
46
+ * @internal
47
+ */
48
+ export function UiResizableSidebarProvider({ value, children }) {
49
+ const [focusRegistry] = useState(createFocusRegistry);
50
+ return (_jsx(UiResizableSidebarContext.Provider, { value: value, children: _jsx(FocusRegistryContext.Provider, { value: focusRegistry, children: children }) }));
51
+ }
52
+ export function useUiResizableSidebarFocusRegistry() {
53
+ return useContext(FocusRegistryContext);
54
+ }
55
+ /**
56
+ * Returns the sidebar state shared by the nearest {@link UiResizableSidebarProvider}, or undefined outside one.
57
+ */
58
+ export function useOptionalUiResizableSidebar() {
59
+ return useContext(UiResizableSidebarContext);
60
+ }
61
+ /**
62
+ * Returns the sidebar state shared by the nearest {@link UiResizableSidebarProvider}.
63
+ *
64
+ * @param fallback - State to use when rendered outside a provider, e.g. a fixed sidebar that cannot be
65
+ * resized. Without a fallback, rendering outside a provider throws.
66
+ *
67
+ * @internal
68
+ */
69
+ export function useUiResizableSidebar(fallback) {
70
+ const state = useContext(UiResizableSidebarContext) ?? fallback;
71
+ if (!state) {
72
+ throw new Error("`useUiResizableSidebar` must be used within `UiResizableSidebarProvider` or be given a fallback");
73
+ }
74
+ return state;
75
+ }
@@ -0,0 +1,21 @@
1
+ import { type ReactElement } from "react";
2
+ /**
3
+ * @internal
4
+ */
5
+ export interface IUiResizableSidebarExpandTriggerProps {
6
+ onExpand: () => void;
7
+ /**
8
+ * Accessible name, e.g. "Expand sidebar".
9
+ */
10
+ label: string;
11
+ dataTestId?: string;
12
+ }
13
+ /**
14
+ * Expands a fully hidden {@link UiResizableSidebar} from the edge it collapsed to. Render it as the
15
+ * sibling right before the collapsed sidebar: it keeps a 10px hit area over the content edge with no
16
+ * layout footprint, and slides a bar in on hover and keyboard focus. Click, Enter or Space expand.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function UiResizableSidebarExpandTrigger({ onExpand, label, dataTestId, }: IUiResizableSidebarExpandTriggerProps): ReactElement;
21
+ //# sourceMappingURL=UiResizableSidebarExpandTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiResizableSidebarExpandTrigger.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/UiResizableSidebarExpandTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAQ7D;;GAEG;AACH,MAAM,WAAW,qCAAqC;IAClD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,EAC5C,QAAQ,EACR,KAAK,EACL,UAAU,GACb,EAAE,qCAAqC,GAAG,YAAY,CA6BtD"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { useEffect, useRef } from "react";
4
+ import { bem } from "../@utils/bem.js";
5
+ import { useUiResizableSidebarFocusRegistry } from "./UiResizableSidebarContext.js";
6
+ const { e } = bem("gd-ui-kit-resizable-sidebar");
7
+ /**
8
+ * Expands a fully hidden {@link UiResizableSidebar} from the edge it collapsed to. Render it as the
9
+ * sibling right before the collapsed sidebar: it keeps a 10px hit area over the content edge with no
10
+ * layout footprint, and slides a bar in on hover and keyboard focus. Click, Enter or Space expand.
11
+ *
12
+ * @internal
13
+ */
14
+ export function UiResizableSidebarExpandTrigger({ onExpand, label, dataTestId, }) {
15
+ const registry = useUiResizableSidebarFocusRegistry();
16
+ const activatedRef = useRef(false);
17
+ // The trigger disappears with the expand; a usable collapse toggle takes focus on its way out.
18
+ useEffect(() => () => {
19
+ if (activatedRef.current) {
20
+ activatedRef.current = false;
21
+ registry?.handOff(null);
22
+ }
23
+ }, [registry]);
24
+ const handleClick = () => {
25
+ activatedRef.current = !!registry;
26
+ onExpand();
27
+ };
28
+ return (_jsx("button", { type: "button", className: e("expand-trigger"), "aria-label": label, "data-testid": dataTestId, onClick: handleClick }));
29
+ }
@@ -0,0 +1,17 @@
1
+ import { type ReactElement } from "react";
2
+ import { type IAccessibilityConfigBase } from "../../typings/accessibility.js";
3
+ /**
4
+ * @internal
5
+ */
6
+ export interface IUiResizableSidebarHandleProps {
7
+ accessibilityConfig?: Pick<IAccessibilityConfigBase, "ariaLabel" | "ariaLabelledBy" | "ariaControls">;
8
+ dataTestId?: string;
9
+ }
10
+ /**
11
+ * The drag handle of {@link UiResizableSidebar}: a vertical separator that follows the pointer during a
12
+ * drag and resizes by arrow, Home and End keys when focused. Must be rendered inside the sidebar.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare function UiResizableSidebarHandle({ accessibilityConfig, dataTestId, }: IUiResizableSidebarHandleProps): ReactElement;
17
+ //# sourceMappingURL=UiResizableSidebarHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiResizableSidebarHandle.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/UiResizableSidebarHandle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,YAAY,EAAc,MAAM,OAAO,CAAC;AAI1E,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAe/E;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,mBAAmB,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,gBAAgB,GAAG,cAAc,CAAC,CAAC;IACtG,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,mBAAmB,EACnB,UAAU,GACb,EAAE,8BAA8B,GAAG,YAAY,CAyD/C"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { useContext } from "react";
4
+ import { clamp } from "lodash-es";
5
+ import { bem } from "../@utils/bem.js";
6
+ import { makeKeyboardNavigation } from "../@utils/keyboardNavigation.js";
7
+ import { UiResizableSidebarHandleContext } from "./UiResizableSidebarHandleContext.js";
8
+ const { e } = bem("gd-ui-kit-resizable-sidebar");
9
+ const handleSeparatorKeyboardNavigation = makeKeyboardNavigation({
10
+ shrink: [{ code: "ArrowLeft" }],
11
+ grow: [{ code: "ArrowRight" }],
12
+ minimize: [{ code: "Home" }],
13
+ maximize: [{ code: "End" }],
14
+ });
15
+ /**
16
+ * The drag handle of {@link UiResizableSidebar}: a vertical separator that follows the pointer during a
17
+ * drag and resizes by arrow, Home and End keys when focused. Must be rendered inside the sidebar.
18
+ *
19
+ * @internal
20
+ */
21
+ export function UiResizableSidebarHandle({ accessibilityConfig, dataTestId, }) {
22
+ const context = useContext(UiResizableSidebarHandleContext);
23
+ if (!context) {
24
+ throw new Error("`UiResizableSidebarHandle` must be rendered within `UiResizableSidebar`");
25
+ }
26
+ const { width, min, max, canResize, isDragging, dragWidth, keyboardStep, setWidth, onPointerDown, onPointerMove, onLostPointerCapture, } = context;
27
+ const resizeTo = (next) => {
28
+ const clamped = clamp(next, min, max);
29
+ if (clamped !== width) {
30
+ setWidth(clamped);
31
+ }
32
+ };
33
+ const handleKeyDown = handleSeparatorKeyboardNavigation({
34
+ shrink: () => resizeTo(width - keyboardStep),
35
+ grow: () => resizeTo(width + keyboardStep),
36
+ minimize: () => resizeTo(min),
37
+ maximize: () => resizeTo(max),
38
+ });
39
+ return (_jsx("button", { type: "button", style: { "--resizable-sidebar-drag-x": `${isDragging ? dragWidth : width}px` }, className: e("handle", { dragging: isDragging }), disabled: !canResize, role: "separator", "aria-orientation": "vertical", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": width, "aria-label": accessibilityConfig?.ariaLabel, "aria-labelledby": accessibilityConfig?.ariaLabelledBy, "aria-controls": accessibilityConfig?.ariaControls, "data-testid": dataTestId, onPointerDown: canResize ? onPointerDown : undefined, onPointerMove: onPointerMove, onLostPointerCapture: onLostPointerCapture, onKeyDown: isDragging ? undefined : handleKeyDown }));
40
+ }
@@ -0,0 +1,16 @@
1
+ import { type PointerEvent as ReactPointerEvent } from "react";
2
+ export interface IUiResizableSidebarHandleContext {
3
+ width: number;
4
+ min: number;
5
+ max: number;
6
+ canResize: boolean;
7
+ isDragging: boolean;
8
+ dragWidth: number | null;
9
+ keyboardStep: number;
10
+ setWidth: (width: number) => void;
11
+ onPointerDown: (event: ReactPointerEvent<HTMLButtonElement>) => void;
12
+ onPointerMove: (event: ReactPointerEvent<HTMLButtonElement>) => void;
13
+ onLostPointerCapture: () => void;
14
+ }
15
+ export declare const UiResizableSidebarHandleContext: import("react").Context<IUiResizableSidebarHandleContext | undefined>;
16
+ //# sourceMappingURL=UiResizableSidebarHandleContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiResizableSidebarHandleContext.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiResizableSidebar/UiResizableSidebarHandleContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,IAAI,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAE9E,MAAM,WAAW,gCAAgC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACrE,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACrE,oBAAoB,EAAE,MAAM,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,+BAA+B,uEAE3C,CAAC"}
@@ -0,0 +1,4 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { createContext } from "react";
3
+ export const UiResizableSidebarHandleContext = createContext(undefined);
4
+ UiResizableSidebarHandleContext.displayName = "UiResizableSidebarHandleContext";
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Width state of a resizable, collapsible sidebar, shared between the sidebar and controls rendered
3
+ * elsewhere (for example a restore control in a header).
4
+ *
5
+ * @internal
6
+ */
7
+ export interface IUiResizableSidebarState {
8
+ /**
9
+ * Width to render right now: the expanded width, or the collapsed width while collapsed.
10
+ */
11
+ width: number;
12
+ /**
13
+ * Width restored on expand; equals `width` while expanded.
14
+ */
15
+ expandedWidth: number;
16
+ min: number;
17
+ max: number;
18
+ canResize: boolean;
19
+ setWidth: (width: number) => void;
20
+ canCollapse: boolean;
21
+ /**
22
+ * Whether a collapsed sidebar keeps a rail of fixed width ({@link UI_RESIZABLE_SIDEBAR_RAIL_WIDTH}) instead
23
+ * of hiding completely.
24
+ */
25
+ hasRail: boolean;
26
+ isCollapsed: boolean;
27
+ setCollapsed: (collapsed: boolean) => void;
28
+ }
29
+ /**
30
+ * @internal
31
+ */
32
+ export interface IUiResizableSidebarStateOptions {
33
+ /**
34
+ * localStorage key of the persisted expanded width.
35
+ */
36
+ widthStorageKey: string;
37
+ /**
38
+ * localStorage key of the persisted collapsed flag.
39
+ */
40
+ collapsedStorageKey: string;
41
+ /**
42
+ * Narrowest expanded width; also the width of a sidebar that cannot be resized.
43
+ */
44
+ minWidth: number;
45
+ /**
46
+ * Widest expanded width, before the `minContentWidth` constraint applies.
47
+ */
48
+ maxWidth: number;
49
+ /**
50
+ * Keeps a rail of fixed width ({@link UI_RESIZABLE_SIDEBAR_RAIL_WIDTH}) while collapsed instead of hiding the
51
+ * sidebar completely. Defaults to false.
52
+ */
53
+ hasRail?: boolean;
54
+ /**
55
+ * Width the sibling content must keep. Caps the maximum at the viewport width minus this value.
56
+ */
57
+ minContentWidth?: number;
58
+ isResizable: boolean;
59
+ isCollapsible: boolean;
60
+ }
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC5C;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ // (C) 2026 GoodData Corporation
2
+ export {};
@@ -0,0 +1,19 @@
1
+ import { type IUiResizableSidebarState, type IUiResizableSidebarStateOptions } from "./types.js";
2
+ /**
3
+ * Width of a collapsed sidebar that keeps a rail. Fixed so every rail in the application lines up.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const UI_RESIZABLE_SIDEBAR_RAIL_WIDTH = 48;
8
+ /**
9
+ * Computes the width state of a resizable, collapsible sidebar and persists it in localStorage.
10
+ *
11
+ * @remarks
12
+ * Every write is clamped to the current bounds, so an out-of-range width is never persisted or applied.
13
+ * While collapsed the sidebar reports the rail width, or zero when it hides completely, and cannot be
14
+ * resized; the expanded width is kept so that expanding restores it.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function useUiResizableSidebarState({ widthStorageKey, collapsedStorageKey, minWidth, maxWidth, hasRail, minContentWidth, isResizable, isCollapsible, }: IUiResizableSidebarStateOptions): IUiResizableSidebarState;
19
+ //# sourceMappingURL=useUiResizableSidebarState.d.ts.map
@@ -0,0 +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"}