@gooddata/sdk-ui-kit 11.43.0-alpha.0 → 11.43.0-alpha.2

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/@types/icon.d.ts +1 -1
  2. package/esm/@ui/@types/icon.d.ts.map +1 -1
  3. package/esm/@ui/UiGeneralAccessRadio/UiGeneralAccessRadio.d.ts +3 -1
  4. package/esm/@ui/UiGeneralAccessRadio/UiGeneralAccessRadio.d.ts.map +1 -1
  5. package/esm/@ui/UiGeneralAccessRadio/UiGeneralAccessRadio.js +2 -2
  6. package/esm/@ui/UiGranteeAsyncPicker/UiGranteeAsyncPicker.d.ts.map +1 -1
  7. package/esm/@ui/UiGranteeAsyncPicker/UiGranteeAsyncPicker.js +7 -4
  8. package/esm/@ui/UiGranteeRow/UiGranteeRow.d.ts +3 -1
  9. package/esm/@ui/UiGranteeRow/UiGranteeRow.d.ts.map +1 -1
  10. package/esm/@ui/UiGranteeRow/UiGranteeRow.js +2 -2
  11. package/esm/@ui/UiGranteeRowControls/UiGranteeRowControls.d.ts +15 -15
  12. package/esm/@ui/UiGranteeRowControls/UiGranteeRowControls.d.ts.map +1 -1
  13. package/esm/@ui/UiGranteeRowControls/UiGranteeRowControls.js +20 -18
  14. package/esm/@ui/UiIcon/icons.d.ts.map +1 -1
  15. package/esm/@ui/UiIcon/icons.js +1 -0
  16. package/esm/@ui/UiLabelsChecklist/UiLabelsChecklist.d.ts +44 -0
  17. package/esm/@ui/UiLabelsChecklist/UiLabelsChecklist.d.ts.map +1 -0
  18. package/esm/@ui/UiLabelsChecklist/UiLabelsChecklist.js +58 -0
  19. package/esm/@ui/UiLabelsList/UiLabelsList.d.ts +6 -1
  20. package/esm/@ui/UiLabelsList/UiLabelsList.d.ts.map +1 -1
  21. package/esm/@ui/UiLabelsList/UiLabelsList.js +2 -3
  22. package/esm/@ui/UiMoreOptionsMenu/UiMoreOptionsMenu.d.ts +23 -0
  23. package/esm/@ui/UiMoreOptionsMenu/UiMoreOptionsMenu.d.ts.map +1 -0
  24. package/esm/@ui/UiMoreOptionsMenu/UiMoreOptionsMenu.js +83 -0
  25. package/esm/@ui/UiObjectShareDialog/UiObjectShareDialogCard.d.ts +14 -1
  26. package/esm/@ui/UiObjectShareDialog/UiObjectShareDialogCard.d.ts.map +1 -1
  27. package/esm/@ui/UiObjectShareDialog/UiObjectShareDialogCard.js +5 -3
  28. package/esm/@ui/UiPermissionMenu/UiPermissionMenu.d.ts +4 -15
  29. package/esm/@ui/UiPermissionMenu/UiPermissionMenu.d.ts.map +1 -1
  30. package/esm/@ui/UiPermissionMenu/UiPermissionMenu.js +11 -23
  31. package/esm/@ui/UiPopover/UiPopover.d.ts +29 -1
  32. package/esm/@ui/UiPopover/UiPopover.d.ts.map +1 -1
  33. package/esm/@ui/UiPopover/UiPopover.js +4 -4
  34. package/esm/@ui/UiTag/UiTag.d.ts +1 -0
  35. package/esm/@ui/UiTag/UiTag.d.ts.map +1 -1
  36. package/esm/@ui/UiTag/UiTag.js +10 -4
  37. package/esm/@ui/UiTags/UiTag.d.ts +0 -2
  38. package/esm/@ui/UiTags/UiTag.d.ts.map +1 -1
  39. package/esm/@ui/UiTags/UiTag.js +14 -9
  40. package/esm/@ui/UiTags/UiTags.d.ts.map +1 -1
  41. package/esm/@ui/UiTags/UiTags.js +38 -24
  42. package/esm/@ui/UiTags/interactions.d.ts +4 -9
  43. package/esm/@ui/UiTags/interactions.d.ts.map +1 -1
  44. package/esm/@ui/UiTags/interactions.js +58 -228
  45. package/esm/@ui/UiTooltip/UiTooltip.d.ts +1 -1
  46. package/esm/@ui/UiTooltip/UiTooltip.d.ts.map +1 -1
  47. package/esm/@ui/UiTooltip/UiTooltip.js +17 -9
  48. package/esm/@ui/UiTooltip/types.d.ts +10 -1
  49. package/esm/@ui/UiTooltip/types.d.ts.map +1 -1
  50. package/esm/Button/Button.d.ts.map +1 -1
  51. package/esm/Button/Button.js +2 -2
  52. package/esm/Datepicker/Datepicker.d.ts.map +1 -1
  53. package/esm/Datepicker/Datepicker.js +1 -1
  54. package/esm/Icon/icons/InsightIcons/Radar.d.ts.map +1 -1
  55. package/esm/Icon/icons/InsightIcons/Radar.js +3 -1
  56. package/esm/List/MenuList.d.ts +2 -1
  57. package/esm/List/MenuList.d.ts.map +1 -1
  58. package/esm/List/MenuList.js +2 -2
  59. package/esm/index.d.ts +2 -1
  60. package/esm/index.d.ts.map +1 -1
  61. package/esm/index.js +2 -1
  62. package/esm/locales.d.ts +11 -4
  63. package/esm/locales.d.ts.map +1 -1
  64. package/esm/locales.js +5 -4
  65. package/esm/sdk-ui-kit.d.ts +139 -85
  66. package/esm/tsdoc-metadata.json +1 -1
  67. package/package.json +11 -11
  68. package/src/@ui/UiGranteeAsyncPicker/UiGranteeAsyncPicker.scss +12 -0
  69. package/src/@ui/UiGranteeRow/UiGranteeRow.scss +5 -0
  70. package/src/@ui/UiGranteeRowControls/UiGranteeRowControls.scss +7 -0
  71. package/src/@ui/UiLabelsChecklist/UiLabelsChecklist.scss +31 -0
  72. package/src/@ui/UiLabelsList/UiLabelsList.scss +3 -0
  73. package/src/@ui/UiModalDialog/UiModalDialog.scss +11 -1
  74. package/src/@ui/UiMoreOptionsMenu/UiMoreOptionsMenu.scss +10 -0
  75. package/src/@ui/UiObjectShareDialog/UiObjectShareDialog.scss +7 -0
  76. package/src/@ui/UiPermissionMenu/UiPermissionMenu.scss +0 -7
  77. package/src/@ui/UiPopover/UiPopover.scss +7 -0
  78. package/src/@ui/UiTabs/UiTabs.scss +0 -1
  79. package/src/@ui/UiTag/UiTag.scss +4 -0
  80. package/src/@ui/UiTags/UiTags.scss +5 -1
  81. package/src/@ui/index.scss +2 -1
  82. package/styles/css/main.css +66 -21
  83. package/styles/css/main.css.map +1 -1
  84. package/styles/images/visualization-types/radar-active.svg +10 -6
  85. package/styles/images/visualization-types/radar.svg +16 -5
  86. package/esm/@ui/UiLabelsPicker/UiLabelsPicker.d.ts +0 -64
  87. package/esm/@ui/UiLabelsPicker/UiLabelsPicker.d.ts.map +0 -1
  88. package/esm/@ui/UiLabelsPicker/UiLabelsPicker.js +0 -89
  89. package/src/@ui/UiLabelsPicker/UiLabelsPicker.scss +0 -29
@@ -1,7 +1,11 @@
1
- <svg width="32" height="30" viewBox="0 0 32 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M14.4122 15.4619L9.40442 22.4717C7.31888 20.639 6.0011 17.9536 6.0011 14.959C6.0011 14.1517 6.0988 13.3672 6.27942 12.6152L14.4122 15.4619Z" fill="#14B2E2" fill-opacity="0.6"/>
3
- <path d="M17.0011 4.00488C21.0165 4.36689 24.4069 6.887 26.0089 10.3965L17.0011 13.5488V4.00488Z" fill="#14B2E2" fill-opacity="0.6"/>
4
- <path d="M15.0011 13.5488L5.04504 10.0645C6.78918 6.16628 10.5491 3.36728 15.0011 3V13.5488Z" fill="#14B2E2"/>
5
- <path d="M24.7734 12.9201C24.9196 13.5616 25 14.2285 25 14.9142C25 17.5737 23.8441 19.9605 22.0098 21.6076L17.5889 15.4191L24.7734 12.9201Z" fill="#14B2E2"/>
6
- <path d="M22.1359 25.2676C20.3405 26.3395 18.2441 26.959 16.0011 26.959C13.7577 26.959 11.66 26.3406 9.86438 25.2686L16.0011 16.6787L22.1359 25.2676Z" fill="#14B2E2" fill-opacity="0.4"/>
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M20.4203 10.55L14.8012 17.1228L6.92188 20.2578L5.32422 11.1213L12.0015 6.30664L20.4203 10.55Z" fill="#14B2E2" fill-opacity="0.3"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M23.4131 9.56543L19.0537 22.9814H4.94629L0.586914 9.56543L12 1.27344L23.4131 9.56543ZM9.08887 18.1279L6.28613 21.9814H17.7139L14.9111 18.1279H9.08887ZM17.5137 12.0098L15.7178 17.5361L18.5195 21.3887L22.043 10.541L17.5137 12.0098ZM5.47949 21.3877L8.28027 17.5352L6.48926 12.0205L1.96094 10.5596L5.47949 21.3877ZM9.81543 17.1279H14.1846L12 14.124L9.81543 17.1279ZM12.8096 13.5371L14.9912 16.5371L16.3379 12.3916L12.8096 13.5371ZM9.00781 16.5361L11.1895 13.5371L7.66309 12.3994L9.00781 16.5361ZM12.5 12.5869L16.0342 11.4395L12.5 8.87207V12.5869ZM7.95898 11.4434L11.5 12.5859V8.87109L7.95898 11.4434ZM2.23926 9.59863L6.78223 11.0635L11.5 7.63574V2.87109L2.23926 9.59863ZM12.5 7.63574L17.21 11.0586L21.7441 9.58789L12.5 2.87109V7.63574Z" fill="#14B2E2" fill-opacity="0.3"/>
4
+ <path d="M5.32617 21.4727C5.87846 21.4727 6.32617 21.9204 6.32617 22.4727C6.32617 23.0249 5.87846 23.4727 5.32617 23.4727C4.77389 23.4727 4.32617 23.0249 4.32617 22.4727C4.32617 21.9204 4.77389 21.4727 5.32617 21.4727Z" fill="#14B2E2"/>
5
+ <path d="M18.6904 21.4727C19.2427 21.4727 19.6904 21.9204 19.6904 22.4727C19.6904 23.0249 19.2427 23.4727 18.6904 23.4727C18.1381 23.4727 17.6904 23.0249 17.6904 22.4727C17.6904 21.9204 18.1381 21.4727 18.6904 21.4727Z" fill="#14B2E2"/>
6
+ <path d="M12 12.2734C12.5523 12.2734 13 12.7212 13 13.2734C13 13.8257 12.5523 14.2734 12 14.2734C11.4477 14.2734 11 13.8257 11 13.2734C11 12.7212 11.4477 12.2734 12 12.2734Z" fill="#14B2E2"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M21.2148 10.3896L15.1006 17.541L14.9863 17.5859L6.53516 20.9492L4.83203 11.2061L4.77734 10.8975L5.03223 10.7148L11.9551 5.72266L21.2148 10.3896ZM5.87012 11.3428L7.30762 19.5645L14.501 16.7021L19.626 10.708L12.0469 6.8877L5.87012 11.3428Z" fill="#14B2E2"/>
8
+ <path d="M1.17969 8.77344C1.73197 8.77344 2.17969 9.22115 2.17969 9.77344C2.17969 10.3257 1.73197 10.7734 1.17969 10.7734C0.627403 10.7734 0.179688 10.3257 0.179688 9.77344C0.179688 9.22115 0.627403 8.77344 1.17969 8.77344Z" fill="#14B2E2"/>
9
+ <path d="M22.8203 8.77344C23.3726 8.77344 23.8203 9.22115 23.8203 9.77344C23.8203 10.3257 23.3726 10.7734 22.8203 10.7734C22.268 10.7734 21.8203 10.3257 21.8203 9.77344C21.8203 9.22115 22.268 8.77344 22.8203 8.77344Z" fill="#14B2E2"/>
10
+ <path d="M12 0.914062C12.5523 0.914062 13 1.36178 13 1.91406C13 2.46635 12.5523 2.91406 12 2.91406C11.4477 2.91406 11 2.46635 11 1.91406C11 1.36178 11.4477 0.914062 12 0.914062Z" fill="#14B2E2"/>
7
11
  </svg>
@@ -1,7 +1,18 @@
1
1
  <svg width="32" height="30" viewBox="0 0 32 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M14.4122 15.4619L9.40442 22.4717C7.31888 20.639 6.0011 17.9536 6.0011 14.959C6.0011 14.1517 6.0988 13.3672 6.27942 12.6152L14.4122 15.4619Z" fill="#B0BECA" fill-opacity="0.6"/>
3
- <path d="M17.0011 4.00488C21.0165 4.36689 24.4069 6.887 26.0089 10.3965L17.0011 13.5488V4.00488Z" fill="#B0BECA" fill-opacity="0.6"/>
4
- <path d="M15.0011 13.5488L5.04504 10.0645C6.78918 6.16628 10.5491 3.36728 15.0011 3V13.5488Z" fill="#B0BECA"/>
5
- <path d="M24.7734 12.9201C24.9196 13.5616 25 14.2285 25 14.9142C25 17.5737 23.8441 19.9605 22.0098 21.6076L17.5889 15.4191L24.7734 12.9201Z" fill="#B0BECA"/>
6
- <path d="M22.1359 25.2676C20.3405 26.3395 18.2441 26.959 16.0011 26.959C13.7577 26.959 11.66 26.3406 9.86438 25.2686L16.0011 16.6787L22.1359 25.2676Z" fill="#B0BECA" fill-opacity="0.4"/>
2
+ <g clip-path="url(#clip0_8094_5335)">
3
+ <path d="M24.4203 13.5509L18.8012 20.1236L10.9219 23.2587L9.32422 14.1222L16.0015 9.3075L24.4203 13.5509Z" fill="#B0BECA" fill-opacity="0.3"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M27.4131 12.5663L23.0537 25.9823H8.94629L4.58691 12.5663L16 4.27429L27.4131 12.5663ZM13.0889 21.1288L10.2861 24.9823H21.7139L18.9111 21.1288H13.0889ZM21.5137 15.0106L19.7178 20.537L22.5195 24.3895L26.043 13.5419L21.5137 15.0106ZM9.47949 24.3885L12.2803 20.536L10.4893 15.0214L5.96094 13.5604L9.47949 24.3885ZM13.8154 20.1288H18.1846L16 17.1249L13.8154 20.1288ZM16.8096 16.538L18.9912 19.538L20.3379 15.3925L16.8096 16.538ZM13.0078 19.537L15.1895 16.538L11.6631 15.4003L13.0078 19.537ZM16.5 15.5878L20.0342 14.4403L16.5 11.8729V15.5878ZM11.959 14.4442L15.5 15.5868V11.8719L11.959 14.4442ZM6.23926 12.5995L10.7822 14.0643L15.5 10.6366V5.87195L6.23926 12.5995ZM16.5 10.6366L21.21 14.0594L25.7441 12.5887L16.5 5.87195V10.6366Z" fill="#B0BECA" fill-opacity="0.3"/>
5
+ <path d="M9.32617 24.4735C9.87846 24.4735 10.3262 24.9212 10.3262 25.4735C10.3262 26.0258 9.87846 26.4735 9.32617 26.4735C8.77389 26.4735 8.32617 26.0258 8.32617 25.4735C8.32617 24.9212 8.77389 24.4735 9.32617 24.4735Z" fill="#B0BECA"/>
6
+ <path d="M22.6904 24.4735C23.2427 24.4735 23.6904 24.9212 23.6904 25.4735C23.6904 26.0258 23.2427 26.4735 22.6904 26.4735C22.1381 26.4735 21.6904 26.0258 21.6904 25.4735C21.6904 24.9212 22.1381 24.4735 22.6904 24.4735Z" fill="#B0BECA"/>
7
+ <path d="M16 15.2743C16.5523 15.2743 17 15.722 17 16.2743C17 16.8266 16.5523 17.2743 16 17.2743C15.4477 17.2743 15 16.8266 15 16.2743C15 15.722 15.4477 15.2743 16 15.2743Z" fill="#B0BECA"/>
8
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M25.2148 13.3905L19.1006 20.5419L18.9863 20.5868L10.5352 23.9501L8.83203 14.2069L8.77734 13.8983L9.03223 13.7157L15.9551 8.72351L25.2148 13.3905ZM9.87012 14.3436L11.3076 22.5653L18.501 19.703L23.626 13.7089L16.0469 9.88855L9.87012 14.3436Z" fill="#B0BECA"/>
9
+ <path d="M5.17969 11.7743C5.73197 11.7743 6.17969 12.222 6.17969 12.7743C6.17969 13.3266 5.73197 13.7743 5.17969 13.7743C4.6274 13.7743 4.17969 13.3266 4.17969 12.7743C4.17969 12.222 4.6274 11.7743 5.17969 11.7743Z" fill="#B0BECA"/>
10
+ <path d="M26.8203 11.7743C27.3726 11.7743 27.8203 12.222 27.8203 12.7743C27.8203 13.3266 27.3726 13.7743 26.8203 13.7743C26.268 13.7743 25.8203 13.3266 25.8203 12.7743C25.8203 12.222 26.268 11.7743 26.8203 11.7743Z" fill="#B0BECA"/>
11
+ <path d="M16 3.91492C16.5523 3.91492 17 4.36263 17 4.91492C17 5.4672 16.5523 5.91492 16 5.91492C15.4477 5.91492 15 5.4672 15 4.91492C15 4.36263 15.4477 3.91492 16 3.91492Z" fill="#B0BECA"/>
12
+ </g>
13
+ <defs>
14
+ <clipPath id="clip0_8094_5335">
15
+ <rect width="24" height="24" fill="white" transform="translate(4 3)"/>
16
+ </clipPath>
17
+ </defs>
7
18
  </svg>
@@ -1,64 +0,0 @@
1
- import { type ReactElement } from "react";
2
- import { type LabelRowKind } from "../UiLabelRow/UiLabelRow.js";
3
- /**
4
- * One label entry in the picker.
5
- *
6
- * @internal
7
- */
8
- export interface IUiLabelsPickerItem {
9
- /** Stable identifier — used as the React key and in selection state. */
10
- id: string;
11
- /** Label text. */
12
- label: string;
13
- /** Drives the icon + suffix. Omit for a regular label. */
14
- kind?: LabelRowKind;
15
- /**
16
- * When true the item is rendered locked (checked + disabled). Used for
17
- * the primary-key row, which is always included.
18
- */
19
- locked?: boolean;
20
- }
21
- /**
22
- * Predicate the picker uses to decide whether an item is effectively selected:
23
- * locked items always count as selected, otherwise membership in the staged
24
- * `selected` set. Exported so consumers (e.g. the grantee row counter) can
25
- * apply the same rule without re-encoding it.
26
- *
27
- * @internal
28
- */
29
- export declare const isLabelsPickerItemChecked: (item: IUiLabelsPickerItem, selectedIds: readonly string[]) => boolean;
30
- /**
31
- * @internal
32
- */
33
- export interface IUiLabelsPickerProps {
34
- /** Element that opens the picker on click. */
35
- anchor: ReactElement<any>;
36
- /** All available label items, in source order. */
37
- items: ReadonlyArray<IUiLabelsPickerItem>;
38
- /**
39
- * Initial set of selected item ids. Locked items are always treated as
40
- * selected regardless of what's passed here. Consumers that need to
41
- * reset the staged state when switching contexts (e.g. picking labels
42
- * for a different grantee) should pass `key={contextId}` so React
43
- * remounts the picker body.
44
- */
45
- defaultSelectedIds: ReadonlyArray<string>;
46
- /**
47
- * Fires when the user clicks Apply with the (locked-augmented) set of
48
- * selected ids. The picker keeps its own staged state — the caller is
49
- * notified only on commit.
50
- */
51
- onApply: (selectedIds: string[]) => void;
52
- /** Test id forwarded to the picker body. */
53
- dataTestId?: string;
54
- }
55
- /**
56
- * Per-label picker popover. Anchored on a click target; stages selection
57
- * internally and commits via `onApply`. Locked items are always included
58
- * — at render time via {@link isLabelsPickerItemChecked} and again at
59
- * commit via the locked-aware filter.
60
- *
61
- * @internal
62
- */
63
- export declare function UiLabelsPicker({ anchor, items, defaultSelectedIds, onApply, dataTestId }: IUiLabelsPickerProps): import("react/jsx-runtime").JSX.Element;
64
- //# sourceMappingURL=UiLabelsPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UiLabelsPicker.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiLabelsPicker/UiLabelsPicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,YAAY,EAAyC,MAAM,OAAO,CAAC;AAQrG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,0EAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,wEAG6B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,8CAA8C;IAC9C,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;IAC1B,kDAAkD;IAClD,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC1C;;;;;;OAMG;IACH,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;OAIG;IACH,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,UAAU,EACb,EAAE,oBAAoB,2CAqBtB"}
@@ -1,89 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // (C) 2026 GoodData Corporation
3
- import { useCallback, useId, useMemo, useState } from "react";
4
- import { useIntl } from "react-intl";
5
- import { commonDialogMessages, olpLabelMessages } from "../../locales.js";
6
- import { bem } from "../@utils/bem.js";
7
- import { UiButton } from "../UiButton/UiButton.js";
8
- import { UiLabelChecklistRow } from "../UiLabelChecklistRow/UiLabelChecklistRow.js";
9
- import { UiPopover } from "../UiPopover/UiPopover.js";
10
- const { b, e } = bem("gd-ui-kit-labels-picker");
11
- /**
12
- * Predicate the picker uses to decide whether an item is effectively selected:
13
- * locked items always count as selected, otherwise membership in the staged
14
- * `selected` set. Exported so consumers (e.g. the grantee row counter) can
15
- * apply the same rule without re-encoding it.
16
- *
17
- * @internal
18
- */
19
- export const isLabelsPickerItemChecked = (item, selectedIds) => item.locked === true || selectedIds.includes(item.id);
20
- /**
21
- * Per-label picker popover. Anchored on a click target; stages selection
22
- * internally and commits via `onApply`. Locked items are always included
23
- * — at render time via {@link isLabelsPickerItemChecked} and again at
24
- * commit via the locked-aware filter.
25
- *
26
- * @internal
27
- */
28
- export function UiLabelsPicker({ anchor, items, defaultSelectedIds, onApply, dataTestId, }) {
29
- const intl = useIntl();
30
- const groupId = useId();
31
- return (_jsx(UiPopover, { anchor: anchor, anchorAccessibilityConfig: { ariaHaspopup: "dialog", ariaControls: groupId }, title: intl.formatMessage(olpLabelMessages.popoverTitle), width: 245, content: ({ onClose }) => (_jsx(PickerBody, { items: items, defaultSelectedIds: defaultSelectedIds, onApply: onApply, onClose: onClose, dataTestId: dataTestId, groupId: groupId })) }));
32
- }
33
- function PickerBody({ items, defaultSelectedIds, onApply, onClose, dataTestId, groupId }) {
34
- const intl = useIntl();
35
- // The user's staged toggles. We never merge locked ids into here — the
36
- // locked-aware predicate handles that at render and at commit. The body
37
- // only mounts when the popover opens, so this captures the initial
38
- // selection once; parent rerenders don't disturb staged edits.
39
- const [selected, setSelected] = useState(() => [...defaultSelectedIds]);
40
- const toggle = useCallback((id, next) => {
41
- setSelected((prev) => next ? (prev.includes(id) ? prev : [...prev, id]) : prev.filter((x) => x !== id));
42
- }, []);
43
- const handleApply = useCallback(() => {
44
- onApply(items.filter((item) => isLabelsPickerItemChecked(item, selected)).map((item) => item.id));
45
- onClose();
46
- }, [items, selected, onApply, onClose]);
47
- const isDirty = useMemo(() => {
48
- // Compare against the locked-aware initial set so re-Apply on an
49
- // unchanged selection stays disabled even when defaultSelectedIds
50
- // omits a locked id (the picker silently includes it).
51
- const initial = new Set();
52
- for (const id of defaultSelectedIds)
53
- initial.add(id);
54
- for (const item of items)
55
- if (item.locked)
56
- initial.add(item.id);
57
- const current = new Set();
58
- for (const item of items) {
59
- if (isLabelsPickerItemChecked(item, selected))
60
- current.add(item.id);
61
- }
62
- if (initial.size !== current.size)
63
- return true;
64
- for (const id of initial) {
65
- if (!current.has(id))
66
- return true;
67
- }
68
- return false;
69
- }, [items, defaultSelectedIds, selected]);
70
- const handleKeyDown = (event) => {
71
- // Enter commits when something has changed — scoped to the items
72
- // group only so Enter on the footer Cancel/Apply buttons keeps its
73
- // native semantics.
74
- if (event.key === "Enter" && isDirty) {
75
- event.preventDefault();
76
- handleApply();
77
- }
78
- };
79
- const suffixFor = (kind) => {
80
- if (!kind)
81
- return undefined;
82
- return intl.formatMessage(kind === "primary" ? olpLabelMessages.suffixPrimary : olpLabelMessages.suffixDefault);
83
- };
84
- return (_jsxs("div", { className: b(), "data-testid": dataTestId, children: [
85
- _jsx("div", { id: groupId, className: e("items"), role: "group", "aria-label": intl.formatMessage(olpLabelMessages.popoverTitle), onKeyDown: handleKeyDown, children: items.map((item) => (_jsx(UiLabelChecklistRow, { label: item.label, kind: item.kind, suffix: suffixFor(item.kind), checked: isLabelsPickerItemChecked(item, selected), disabled: item.locked, onChange: (next) => toggle(item.id, next) }, item.id))) }), _jsxs("div", { className: e("actions"), children: [
86
- _jsx(UiButton, { variant: "secondary", size: "small", label: intl.formatMessage(commonDialogMessages.cancel), onClick: onClose }), _jsx(UiButton, { variant: "primary", size: "small", label: intl.formatMessage(commonDialogMessages.apply), onClick: handleApply, isDisabled: !isDirty })
87
- ] })
88
- ] }));
89
- }
@@ -1,29 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
-
3
- // Rendered inside UiPopover.__content (which adds 10px padding + 20px gap).
4
- // Pull the padding back so the rows stretch edge-to-edge of the popover and
5
- // disable the gap. The actions strip sits flush at the bottom with its own
6
- // top border.
7
-
8
- .gd-ui-kit-labels-picker {
9
- align-self: stretch;
10
- display: flex;
11
- flex-direction: column;
12
- // UiPopover's __content adds 10px padding all around. Pull it back so rows
13
- // reach edge-to-edge of the popover; the popover sets its own width.
14
- margin: calc(-1 * var(--gd-spacing-10px));
15
-
16
- &__items {
17
- display: flex;
18
- flex-direction: column;
19
- padding: var(--gd-spacing-10px) 0;
20
- }
21
-
22
- &__actions {
23
- display: flex;
24
- justify-content: flex-end;
25
- gap: var(--gd-spacing-10px);
26
- padding: var(--gd-spacing-10px);
27
- border-top: 1px solid var(--gd-palette-complementary-3);
28
- }
29
- }