@axinom/mosaic-ui 0.75.0-rc.5 → 0.77.0

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 (183) hide show
  1. package/dist/THIRD-PARTY-LICENSES.txt +1296 -0
  2. package/dist/cjs/components/ActionBar/ActionBar.d.ts +26 -0
  3. package/dist/cjs/components/ActionBar/ActionBar.d.ts.map +1 -0
  4. package/dist/cjs/components/ActionBar/ActionBar.model.d.ts +49 -0
  5. package/dist/cjs/components/ActionBar/ActionBar.model.d.ts.map +1 -0
  6. package/dist/cjs/components/ActionBar/ActionBarButton/ActionBarButton.d.ts +22 -0
  7. package/dist/cjs/components/ActionBar/ActionBarButton/ActionBarButton.d.ts.map +1 -0
  8. package/dist/cjs/components/ActionBar/helpers.d.ts +22 -0
  9. package/dist/cjs/components/ActionBar/helpers.d.ts.map +1 -0
  10. package/dist/cjs/components/ActionBar/index.d.ts +3 -0
  11. package/dist/cjs/components/ActionBar/index.d.ts.map +1 -0
  12. package/dist/cjs/components/Actions/Action/Action.d.ts.map +1 -1
  13. package/dist/cjs/components/ConfirmDialog/index.d.ts +1 -0
  14. package/dist/cjs/components/ConfirmDialog/index.d.ts.map +1 -1
  15. package/dist/cjs/components/ConfirmDialog/useConfirmableAction.d.ts +55 -0
  16. package/dist/cjs/components/ConfirmDialog/useConfirmableAction.d.ts.map +1 -0
  17. package/dist/cjs/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
  18. package/dist/cjs/components/Explorer/Explorer.d.ts.map +1 -1
  19. package/dist/cjs/components/Explorer/QuickEdit/useQuickEdit.d.ts +14 -3
  20. package/dist/cjs/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -1
  21. package/dist/cjs/components/Explorer/helpers/useActions.d.ts +15 -4
  22. package/dist/cjs/components/Explorer/helpers/useActions.d.ts.map +1 -1
  23. package/dist/cjs/components/Explorer/helpers/useSubtitle.d.ts.map +1 -1
  24. package/dist/cjs/components/List/List.d.ts +17 -3
  25. package/dist/cjs/components/List/List.d.ts.map +1 -1
  26. package/dist/cjs/components/List/List.model.d.ts +5 -1
  27. package/dist/cjs/components/List/List.model.d.ts.map +1 -1
  28. package/dist/cjs/components/List/ListHeader/ListHeader.d.ts +10 -1
  29. package/dist/cjs/components/List/ListHeader/ListHeader.d.ts.map +1 -1
  30. package/dist/cjs/components/List/ListRow/ListRow.d.ts +16 -5
  31. package/dist/cjs/components/List/ListRow/ListRow.d.ts.map +1 -1
  32. package/dist/cjs/components/List/ListRowRenderer/ListRowRenderer.d.ts.map +1 -1
  33. package/dist/cjs/components/List/helpers.d.ts +11 -3
  34. package/dist/cjs/components/List/helpers.d.ts.map +1 -1
  35. package/dist/cjs/components/List/useColumnsSize.d.ts +4 -2
  36. package/dist/cjs/components/List/useColumnsSize.d.ts.map +1 -1
  37. package/dist/cjs/components/PageHeader/PageHeader.d.ts +4 -1
  38. package/dist/cjs/components/PageHeader/PageHeader.d.ts.map +1 -1
  39. package/dist/cjs/components/PageHeader/PageHeader.model.d.ts +37 -1
  40. package/dist/cjs/components/PageHeader/PageHeader.model.d.ts.map +1 -1
  41. package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +3 -0
  42. package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
  43. package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +8 -0
  44. package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
  45. package/dist/cjs/components/PageHeader/helpers.d.ts +9 -0
  46. package/dist/cjs/components/PageHeader/helpers.d.ts.map +1 -0
  47. package/dist/cjs/components/index.d.ts +1 -0
  48. package/dist/cjs/components/index.d.ts.map +1 -1
  49. package/dist/cjs/hooks/index.d.ts +1 -0
  50. package/dist/cjs/hooks/index.d.ts.map +1 -1
  51. package/dist/cjs/hooks/useElementWidthObserver/useElementWidthObserver.d.ts.map +1 -0
  52. package/dist/cjs/index.js +4 -4
  53. package/dist/cjs/index.js.map +1 -1
  54. package/dist/esm/components/ActionBar/ActionBar.d.ts +26 -0
  55. package/dist/esm/components/ActionBar/ActionBar.d.ts.map +1 -0
  56. package/dist/esm/components/ActionBar/ActionBar.model.d.ts +49 -0
  57. package/dist/esm/components/ActionBar/ActionBar.model.d.ts.map +1 -0
  58. package/dist/esm/components/ActionBar/ActionBarButton/ActionBarButton.d.ts +22 -0
  59. package/dist/esm/components/ActionBar/ActionBarButton/ActionBarButton.d.ts.map +1 -0
  60. package/dist/esm/components/ActionBar/helpers.d.ts +22 -0
  61. package/dist/esm/components/ActionBar/helpers.d.ts.map +1 -0
  62. package/dist/esm/components/ActionBar/index.d.ts +3 -0
  63. package/dist/esm/components/ActionBar/index.d.ts.map +1 -0
  64. package/dist/esm/components/Actions/Action/Action.d.ts.map +1 -1
  65. package/dist/esm/components/ConfirmDialog/index.d.ts +1 -0
  66. package/dist/esm/components/ConfirmDialog/index.d.ts.map +1 -1
  67. package/dist/esm/components/ConfirmDialog/useConfirmableAction.d.ts +55 -0
  68. package/dist/esm/components/ConfirmDialog/useConfirmableAction.d.ts.map +1 -0
  69. package/dist/esm/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
  70. package/dist/esm/components/Explorer/Explorer.d.ts.map +1 -1
  71. package/dist/esm/components/Explorer/QuickEdit/useQuickEdit.d.ts +14 -3
  72. package/dist/esm/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -1
  73. package/dist/esm/components/Explorer/helpers/useActions.d.ts +15 -4
  74. package/dist/esm/components/Explorer/helpers/useActions.d.ts.map +1 -1
  75. package/dist/esm/components/Explorer/helpers/useSubtitle.d.ts.map +1 -1
  76. package/dist/esm/components/List/List.d.ts +17 -3
  77. package/dist/esm/components/List/List.d.ts.map +1 -1
  78. package/dist/esm/components/List/List.model.d.ts +5 -1
  79. package/dist/esm/components/List/List.model.d.ts.map +1 -1
  80. package/dist/esm/components/List/ListHeader/ListHeader.d.ts +10 -1
  81. package/dist/esm/components/List/ListHeader/ListHeader.d.ts.map +1 -1
  82. package/dist/esm/components/List/ListRow/ListRow.d.ts +16 -5
  83. package/dist/esm/components/List/ListRow/ListRow.d.ts.map +1 -1
  84. package/dist/esm/components/List/ListRowRenderer/ListRowRenderer.d.ts.map +1 -1
  85. package/dist/esm/components/List/helpers.d.ts +11 -3
  86. package/dist/esm/components/List/helpers.d.ts.map +1 -1
  87. package/dist/esm/components/List/useColumnsSize.d.ts +4 -2
  88. package/dist/esm/components/List/useColumnsSize.d.ts.map +1 -1
  89. package/dist/esm/components/PageHeader/PageHeader.d.ts +4 -1
  90. package/dist/esm/components/PageHeader/PageHeader.d.ts.map +1 -1
  91. package/dist/esm/components/PageHeader/PageHeader.model.d.ts +37 -1
  92. package/dist/esm/components/PageHeader/PageHeader.model.d.ts.map +1 -1
  93. package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +3 -0
  94. package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
  95. package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +8 -0
  96. package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
  97. package/dist/esm/components/PageHeader/helpers.d.ts +9 -0
  98. package/dist/esm/components/PageHeader/helpers.d.ts.map +1 -0
  99. package/dist/esm/components/index.d.ts +1 -0
  100. package/dist/esm/components/index.d.ts.map +1 -1
  101. package/dist/esm/hooks/index.d.ts +1 -0
  102. package/dist/esm/hooks/index.d.ts.map +1 -1
  103. package/dist/esm/hooks/useElementWidthObserver/useElementWidthObserver.d.ts.map +1 -0
  104. package/dist/esm/index.js +4 -4
  105. package/dist/esm/index.js.map +1 -1
  106. package/package.json +7 -3
  107. package/src/components/ActionBar/ActionBar.model.ts +61 -0
  108. package/src/components/ActionBar/ActionBar.module.scss +64 -0
  109. package/src/components/ActionBar/ActionBar.spec.tsx +398 -0
  110. package/src/components/ActionBar/ActionBar.stories.tsx +205 -0
  111. package/src/components/ActionBar/ActionBar.tsx +170 -0
  112. package/src/components/ActionBar/ActionBarButton/ActionBarButton.module.scss +140 -0
  113. package/src/components/ActionBar/ActionBarButton/ActionBarButton.tsx +193 -0
  114. package/src/components/ActionBar/helpers.spec.ts +41 -0
  115. package/src/components/ActionBar/helpers.ts +54 -0
  116. package/src/components/ActionBar/index.ts +2 -0
  117. package/src/components/Actions/Action/Action.spec.tsx +64 -2
  118. package/src/components/Actions/Action/Action.tsx +6 -1
  119. package/src/components/ConfirmDialog/index.ts +1 -0
  120. package/src/components/ConfirmDialog/useConfirmableAction.tsx +159 -0
  121. package/src/components/EmptyStation/EmptyStation.stories.tsx +97 -0
  122. package/src/components/Explorer/BulkEdit/useBulkEdit.tsx +2 -0
  123. package/src/components/Explorer/Explorer.spec.tsx +97 -8
  124. package/src/components/Explorer/Explorer.tsx +26 -13
  125. package/src/components/Explorer/NavigationExplorer/NavigationExplorer.stories.tsx +124 -1
  126. package/src/components/Explorer/QuickEdit/useQuickEdit.spec.tsx +94 -50
  127. package/src/components/Explorer/QuickEdit/useQuickEdit.tsx +101 -42
  128. package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +46 -13
  129. package/src/components/Explorer/helpers/useActions.ts +125 -73
  130. package/src/components/Explorer/helpers/useSubtitle.spec.tsx +33 -23
  131. package/src/components/Explorer/helpers/useSubtitle.tsx +18 -26
  132. package/src/components/List/List.model.ts +5 -1
  133. package/src/components/List/List.module.scss +25 -6
  134. package/src/components/List/List.spec.tsx +498 -1
  135. package/src/components/List/List.stories.tsx +137 -8
  136. package/src/components/List/List.tsx +305 -194
  137. package/src/components/List/ListHeader/ListHeader.module.scss +14 -0
  138. package/src/components/List/ListHeader/ListHeader.spec.tsx +1 -0
  139. package/src/components/List/ListHeader/ListHeader.tsx +25 -8
  140. package/src/components/List/ListRow/ListRow.module.scss +1 -1
  141. package/src/components/List/ListRow/ListRow.spec.tsx +109 -22
  142. package/src/components/List/ListRow/ListRow.tsx +52 -13
  143. package/src/components/List/ListRowRenderer/ListRowRenderer.tsx +28 -22
  144. package/src/components/List/helpers.spec.ts +29 -0
  145. package/src/components/List/helpers.ts +17 -9
  146. package/src/components/List/useColumnsSize.ts +17 -7
  147. package/src/components/PageHeader/PageHeader.model.ts +38 -1
  148. package/src/components/PageHeader/PageHeader.module.scss +39 -18
  149. package/src/components/PageHeader/PageHeader.spec.tsx +407 -18
  150. package/src/components/PageHeader/PageHeader.stories.tsx +95 -12
  151. package/src/components/PageHeader/PageHeader.tsx +89 -38
  152. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +8 -0
  153. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.module.scss +50 -42
  154. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +193 -1
  155. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.stories.tsx +36 -0
  156. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +81 -130
  157. package/src/components/PageHeader/helpers.spec.ts +60 -0
  158. package/src/components/PageHeader/helpers.ts +36 -0
  159. package/src/components/index.ts +1 -0
  160. package/src/hooks/index.ts +1 -0
  161. package/src/styles/variables.scss +41 -7
  162. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +0 -35
  163. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +0 -1
  164. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +0 -6
  165. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +0 -1
  166. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts +0 -3
  167. package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts.map +0 -1
  168. package/dist/cjs/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +0 -1
  169. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +0 -35
  170. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +0 -1
  171. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +0 -6
  172. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +0 -1
  173. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts +0 -3
  174. package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts.map +0 -1
  175. package/dist/esm/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +0 -1
  176. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.module.scss +0 -77
  177. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +0 -122
  178. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +0 -235
  179. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.ts +0 -15
  180. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.tsx +0 -37
  181. /package/dist/cjs/{components/PageHeader/helpers → hooks/useElementWidthObserver}/useElementWidthObserver.d.ts +0 -0
  182. /package/dist/esm/{components/PageHeader/helpers → hooks/useElementWidthObserver}/useElementWidthObserver.d.ts +0 -0
  183. /package/src/{components/PageHeader/helpers → hooks/useElementWidthObserver}/useElementWidthObserver.tsx +0 -0
@@ -136,11 +136,21 @@ $landingpage-smalltile-stroke-color: var(--mosaic-accent);
136
136
  /* PageHeader */
137
137
  $page-header-color: #ffffff;
138
138
  $page-header-background-color: var(--mosaic-accent);
139
- $page-header-height: 100px;
139
+ $page-header-height: 70px;
140
+ $page-header-padding: 16px;
141
+ $page-header-title-font-size: 24px;
142
+ $page-header-subtitle-font-size: 12px;
143
+ $page-header-actions-gap: 1px;
144
+ // Distance between groups of actions, e.g. the actions of a station and the
145
+ // toggle of the bulk actions.
146
+ $page-header-spacer-width: 5px;
140
147
 
141
148
  /* PageHeaderAction */
142
149
  $page-header-action-color: #ffffff;
143
150
  $page-header-action-background-color: var(--mosaic-primary);
151
+ $page-header-action-width: 70px;
152
+ $page-header-action-icon-size: 34px;
153
+ $page-header-action-font-size: 12px;
144
154
  $page-header-action-tag-background-color: var(--mosaic-neutral-2);
145
155
  $page-header-action-tag-font-size: 10px;
146
156
 
@@ -148,7 +158,12 @@ $page-header-action-confirmation-background-color: var(--mosaic-warning);
148
158
  $page-header-action-pressed-color: $page-header-action-background-color;
149
159
  $page-header-action-pressed-background-color: $page-header-action-color;
150
160
  $page-header-action-icon-color: #ffffff;
151
- $page-header-action-active-background-color: #ffffff;
161
+ // Matches the action bar that opens below a toggled action, which the action
162
+ // then runs into.
163
+ $page-header-action-active-background-color: var(
164
+ --action-bar-background-color,
165
+ var(--mosaic-neutral-3)
166
+ );
152
167
  $page-header-action-context-background-color: var(--mosaic-secondary);
153
168
 
154
169
  $page-header-action-hover-background-color: color-mix(
@@ -173,11 +188,7 @@ $page-header-action-context-disabled-color: color-mix(
173
188
  white
174
189
  );
175
190
 
176
- $page-header-action-active-hover-background-color: color-mix(
177
- in srgb,
178
- $page-header-action-active-background-color 75%,
179
- white
180
- );
191
+ $page-header-action-active-hover-background-color: var(--mosaic-neutral-2);
181
192
  $page-header-action-disabled-fg-color: color-mix(
182
193
  in srgb,
183
194
  white 50%,
@@ -505,6 +516,29 @@ $list-error-bg-color: color-mix(in srgb, var(--mosaic-error) 15%, transparent);
505
516
  $list-header-border-color: var(--mosaic-neutral-2);
506
517
  $list-header-resize-handle-border-color: var(--mosaic-neutral-2);
507
518
 
519
+ /* List ActionBar additional vars */
520
+ // Gap between the action bar of the List and whatever sits next to it, e.g. the filters.
521
+ $list-action-bar-start-gap: 2px;
522
+
523
+ /* ActionBar additional vars */
524
+ $action-bar-background-color: var(--mosaic-neutral-3);
525
+ $action-bar-border-color: var(--mosaic-neutral-2);
526
+ $action-bar-label-color: var(--mosaic-neutral-1);
527
+ $action-bar-action-color: var(--mosaic-secondary);
528
+ // Matches the icon of the button that expands the filters, which sits in the
529
+ // same band as the bar of the List.
530
+ $action-bar-action-icon-size: 27px;
531
+ $action-bar-action-icon-stroke-width: 1.5px;
532
+ $action-bar-action-min-width: 90px;
533
+ // The same tint as a hovered option of the Select, which sets it apart from the
534
+ // background of a toggled action.
535
+ $action-bar-action-hover-background-color: $popper-item-hover-color;
536
+ $action-bar-action-toggled-color: var(--mosaic-accent);
537
+ $action-bar-action-toggled-background-color: var(--mosaic-neutral-2);
538
+ $action-bar-action-confirmation-background-color: var(--mosaic-warning);
539
+ $action-bar-action-disabled-color: var(--mosaic-neutral);
540
+ $action-bar-action-tag-font-size: 10px;
541
+
508
542
  /* ListRow additional vars */
509
543
  $list-row-disabled-text-color: var(--mosaic-neutral);
510
544
 
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { IconName } from '../../Icons';
3
- import { type PageHeaderActionProps } from '../PageHeaderAction/PageHeaderAction.model';
4
- export interface PageHeaderActionsGroupProps {
5
- /** Array of Actions to be rendered (default: []) */
6
- actions: PageHeaderActionProps[];
7
- /** Whether group is disabled (default: false) */
8
- disabled?: boolean;
9
- /** Whether actions in the group are disabled or not (default: false)*/
10
- groupActionsDisabled?: boolean;
11
- /** CSS Class name for additional styles */
12
- className?: string;
13
- /** The label of the action. */
14
- label: string;
15
- /** Optional built in icon. This prop also accepts an img src. */
16
- icon?: IconName | string;
17
- /** Whether group actions are shown by default. (default: false) */
18
- openActionsGroupOnStart?: boolean;
19
- /** The number of actions that can be displayed in the group. (default: actions.length) */
20
- availableActionSpace?: number;
21
- /**
22
- * Callback to emit when Group Actions is toggled
23
- * The expanded state is supplied as an argument
24
- */
25
- onActionsGroupToggled?: (expanded: boolean) => Promise<void>;
26
- }
27
- /**
28
- * Used to perform group operations from the PageHeader component.
29
- * @example
30
- * <PageHeaderActionsGroup>
31
- * <PageHeaderAction action={action} onActionsGroupToggled={onActionsGroupToggledHandler} />
32
- * </PageHeaderActionsGroup>
33
- */
34
- export declare const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps>;
35
- //# sourceMappingURL=PageHeaderActionsGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKvC,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,4CAA4C,CAAC;AAIpD,MAAM,WAAW,2BAA2B;IAC1C,oDAAoD;IACpD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,mEAAmE;IACnE,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0FAA0F;IAC1F,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAyLxE,CAAC"}
@@ -1,6 +0,0 @@
1
- export interface PageHeaderActionsGroupContextType {
2
- registerCollapse: (readonly: () => Promise<void>, uuid: string) => void;
3
- collapseAll: (uuid: string) => Promise<void[]>;
4
- }
5
- export declare const PageHeaderActionsGroupContext: import("react").Context<PageHeaderActionsGroupContextType>;
6
- //# sourceMappingURL=PageHeaderActionsGroupsContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroupsContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iCAAiC;IAChD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,6BAA6B,4DAMtC,CAAC"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const PageHeaderActionsGroupContextProvider: React.FC;
3
- //# sourceMappingURL=PageHeaderActionsGroupsContextProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroupsContextProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAKrD,eAAO,MAAM,qCAAqC,EAAE,KAAK,CAAC,EA+BzD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useElementWidthObserver.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/helpers/useElementWidthObserver.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,WAAW,OAAK;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAyBzB,CAAC"}
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { IconName } from '../../Icons';
3
- import { type PageHeaderActionProps } from '../PageHeaderAction/PageHeaderAction.model';
4
- export interface PageHeaderActionsGroupProps {
5
- /** Array of Actions to be rendered (default: []) */
6
- actions: PageHeaderActionProps[];
7
- /** Whether group is disabled (default: false) */
8
- disabled?: boolean;
9
- /** Whether actions in the group are disabled or not (default: false)*/
10
- groupActionsDisabled?: boolean;
11
- /** CSS Class name for additional styles */
12
- className?: string;
13
- /** The label of the action. */
14
- label: string;
15
- /** Optional built in icon. This prop also accepts an img src. */
16
- icon?: IconName | string;
17
- /** Whether group actions are shown by default. (default: false) */
18
- openActionsGroupOnStart?: boolean;
19
- /** The number of actions that can be displayed in the group. (default: actions.length) */
20
- availableActionSpace?: number;
21
- /**
22
- * Callback to emit when Group Actions is toggled
23
- * The expanded state is supplied as an argument
24
- */
25
- onActionsGroupToggled?: (expanded: boolean) => Promise<void>;
26
- }
27
- /**
28
- * Used to perform group operations from the PageHeader component.
29
- * @example
30
- * <PageHeaderActionsGroup>
31
- * <PageHeaderAction action={action} onActionsGroupToggled={onActionsGroupToggledHandler} />
32
- * </PageHeaderActionsGroup>
33
- */
34
- export declare const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps>;
35
- //# sourceMappingURL=PageHeaderActionsGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKvC,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,4CAA4C,CAAC;AAIpD,MAAM,WAAW,2BAA2B;IAC1C,oDAAoD;IACpD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,mEAAmE;IACnE,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0FAA0F;IAC1F,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAyLxE,CAAC"}
@@ -1,6 +0,0 @@
1
- export interface PageHeaderActionsGroupContextType {
2
- registerCollapse: (readonly: () => Promise<void>, uuid: string) => void;
3
- collapseAll: (uuid: string) => Promise<void[]>;
4
- }
5
- export declare const PageHeaderActionsGroupContext: import("react").Context<PageHeaderActionsGroupContextType>;
6
- //# sourceMappingURL=PageHeaderActionsGroupsContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroupsContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iCAAiC;IAChD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,6BAA6B,4DAMtC,CAAC"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const PageHeaderActionsGroupContextProvider: React.FC;
3
- //# sourceMappingURL=PageHeaderActionsGroupsContextProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageHeaderActionsGroupsContextProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAKrD,eAAO,MAAM,qCAAqC,EAAE,KAAK,CAAC,EA+BzD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useElementWidthObserver.d.ts","sourceRoot":"","sources":["../../../../../src/components/PageHeader/helpers/useElementWidthObserver.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,WAAW,OAAK;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAyBzB,CAAC"}
@@ -1,77 +0,0 @@
1
- @import '../../../styles/common.scss';
2
-
3
- .container {
4
- display: grid;
5
- grid-template-rows: $page-header-height 1fr;
6
- grid-template-columns: max-content 1fr;
7
- grid-gap: 1px;
8
- justify-content: end;
9
- width: max-content;
10
-
11
- .actions {
12
- display: grid;
13
- grid-auto-flow: column;
14
- grid-gap: 1px;
15
- transition: max-width 200ms linear, opacity 150ms linear;
16
- overflow: hidden;
17
- }
18
-
19
- .dropDownList {
20
- width: 100%;
21
- max-width: 360px;
22
- display: grid;
23
- grid-template-columns: 1fr;
24
- grid-auto-rows: 60px;
25
- grid-gap: 1px;
26
-
27
- border-top: 2px solid white;
28
-
29
- grid-column: 1 / span 2;
30
- place-self: end;
31
-
32
- background-color: white;
33
-
34
- z-index: 2;
35
-
36
- .dropDown {
37
- height: unset;
38
- width: unset;
39
-
40
- display: grid;
41
- grid-template-columns: 1fr 40px;
42
- grid-template-rows: 1fr;
43
-
44
- // icon
45
- div:first-child {
46
- display: grid;
47
- align-items: center;
48
- grid-row: 1 / span 1;
49
- justify-items: start;
50
- grid-column: 2 / span 1;
51
- padding: 0px;
52
-
53
- svg,
54
- img {
55
- height: 30px;
56
- }
57
- }
58
-
59
- // label
60
- div:last-child {
61
- display: grid;
62
- align-items: center;
63
- grid-column: 1 / span 1;
64
- justify-items: start;
65
-
66
- padding: 0px 0px 0px 20px;
67
-
68
- span {
69
- height: 30px;
70
-
71
- display: grid;
72
- align-items: center;
73
- }
74
- }
75
- }
76
- }
77
- }
@@ -1,122 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import { act } from 'react-dom/test-utils';
4
- import { describe, expect, it, vi } from 'vitest';
5
- import { noop } from '../../../helpers/utils';
6
- import type { PageHeaderActionProps } from '../PageHeaderAction/PageHeaderAction.model';
7
- import {
8
- PageHeaderActionsGroup,
9
- type PageHeaderActionsGroupProps,
10
- } from './PageHeaderActionsGroup';
11
-
12
- vi.mock('../../../utils/GenerateId', () => ({
13
- uuid: vi.fn().mockReturnValue('test-uuid'),
14
- }));
15
-
16
- const defaultActions: PageHeaderActionProps[] = [
17
- {
18
- label: 'Group Action 1',
19
- onClick: noop,
20
- },
21
- {
22
- label: 'Group Action 2',
23
- onClick: noop,
24
- },
25
- {
26
- label: 'Group Action 3',
27
- onClick: noop,
28
- },
29
- {
30
- label: 'Group Action 4',
31
- onClick: noop,
32
- },
33
- ];
34
-
35
- const defaultProps: PageHeaderActionsGroupProps = {
36
- label: 'Group Actions',
37
- actions: defaultActions,
38
- };
39
-
40
- describe('PageHeaderActionsGroup', () => {
41
- it('renders the component without crashing', () => {
42
- const { container } = render(<PageHeaderActionsGroup {...defaultProps} />);
43
- expect(container).toBeTruthy();
44
- });
45
-
46
- it(`'Group Actions' has the 'Context' actionType when closed and 'Active' actionType when open`, async () => {
47
- const { container } = render(<PageHeaderActionsGroup {...defaultProps} />);
48
-
49
- // The component should render with a group action container
50
- const groupContainer = container.querySelector(
51
- '.page-header-group-action-container',
52
- );
53
- expect(groupContainer).toBeInTheDocument();
54
-
55
- // Click to toggle the group open
56
- const groupActionButton = container.querySelector(
57
- '[data-test-id="action"]',
58
- ) as HTMLElement;
59
-
60
- await act(async () => {
61
- groupActionButton.click();
62
- });
63
-
64
- // After clicking, the actions should be visible
65
- const visibleActions = container.querySelectorAll(
66
- '[data-test-id="action"]',
67
- );
68
- expect(visibleActions.length).toBeGreaterThan(1);
69
- });
70
-
71
- it(`renders all actions when 'Group Actions' is selected and there is enough available action slots`, async () => {
72
- const { container } = render(
73
- <PageHeaderActionsGroup {...defaultProps} availableActionSpace={5} />,
74
- );
75
- const groupActionsToggle = container.querySelector(
76
- '[data-test-id="action"]',
77
- ) as HTMLElement;
78
-
79
- await act(async () => {
80
- groupActionsToggle.click();
81
- });
82
-
83
- // Should have 1 group action button + 4 action buttons inside = 5 total
84
- const actions = container.querySelectorAll('[data-test-id="action"]');
85
- expect(actions).toHaveLength(5);
86
- });
87
-
88
- it(`raises onActionsGroupToggled`, async () => {
89
- const groupActionSpy = vi.fn().mockResolvedValue(undefined);
90
- const { container } = render(
91
- <PageHeaderActionsGroup
92
- {...defaultProps}
93
- onActionsGroupToggled={groupActionSpy}
94
- />,
95
- );
96
- const groupActionsToggle = container.querySelector(
97
- '[data-test-id="action"]',
98
- ) as HTMLElement;
99
-
100
- await act(async () => {
101
- groupActionsToggle.click();
102
- });
103
-
104
- expect(groupActionSpy).toHaveBeenCalledTimes(1);
105
- expect(groupActionSpy).toHaveBeenCalledWith(true);
106
- });
107
-
108
- it(`renders 'Group Actions' and 'More Actions' if openActionsGroupOnStart is set to true and there isn't enough available space`, () => {
109
- const { container } = render(
110
- <PageHeaderActionsGroup
111
- {...defaultProps}
112
- openActionsGroupOnStart={true}
113
- availableActionSpace={3}
114
- />,
115
- );
116
-
117
- // Should render group action button + visible action buttons based on available space
118
- const actions = container.querySelectorAll('[data-test-id="action"]');
119
-
120
- expect(actions.length).toBeGreaterThanOrEqual(3);
121
- });
122
- });
@@ -1,235 +0,0 @@
1
- import clsx from 'clsx';
2
- import React, { useCallback, useEffect, useState } from 'react';
3
- import { noop } from '../../../helpers/utils';
4
- import { useExpand } from '../../../hooks/useExpand/useExpand';
5
- import { uuid } from '../../../utils/GenerateId';
6
- import type { ConfirmationMode } from '../../ConfirmDialog';
7
- import { IconName } from '../../Icons';
8
- import {
9
- PageHeaderAction,
10
- isPageHeaderJsAction,
11
- } from '../PageHeaderAction/PageHeaderAction';
12
- import {
13
- type PageHeaderActionProps,
14
- PageHeaderActionType,
15
- } from '../PageHeaderAction/PageHeaderAction.model';
16
- import classes from './PageHeaderActionsGroup.module.scss';
17
- import { PageHeaderActionsGroupContext } from './PageHeaderActionsGroupsContext';
18
-
19
- export interface PageHeaderActionsGroupProps {
20
- /** Array of Actions to be rendered (default: []) */
21
- actions: PageHeaderActionProps[];
22
- /** Whether group is disabled (default: false) */
23
- disabled?: boolean;
24
- /** Whether actions in the group are disabled or not (default: false)*/
25
- groupActionsDisabled?: boolean;
26
- /** CSS Class name for additional styles */
27
- className?: string;
28
- /** The label of the action. */
29
- label: string;
30
- /** Optional built in icon. This prop also accepts an img src. */
31
- icon?: IconName | string;
32
- /** Whether group actions are shown by default. (default: false) */
33
- openActionsGroupOnStart?: boolean;
34
- /** The number of actions that can be displayed in the group. (default: actions.length) */
35
- availableActionSpace?: number;
36
- /**
37
- * Callback to emit when Group Actions is toggled
38
- * The expanded state is supplied as an argument
39
- */
40
- onActionsGroupToggled?: (expanded: boolean) => Promise<void>;
41
- }
42
-
43
- /**
44
- * Used to perform group operations from the PageHeader component.
45
- * @example
46
- * <PageHeaderActionsGroup>
47
- * <PageHeaderAction action={action} onActionsGroupToggled={onActionsGroupToggledHandler} />
48
- * </PageHeaderActionsGroup>
49
- */
50
- export const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps> = ({
51
- actions = [],
52
- openActionsGroupOnStart = false,
53
- label,
54
- icon,
55
- onActionsGroupToggled = noop,
56
- groupActionsDisabled = false,
57
- disabled = false,
58
- availableActionSpace = actions.length,
59
- className = '',
60
- }) => {
61
- const [uniqueId] = useState<string>(uuid());
62
- const { isExpanded, toggleExpanded, collapse } = useExpand(
63
- openActionsGroupOnStart,
64
- );
65
-
66
- const { registerCollapse, collapseAll } = React.useContext(
67
- PageHeaderActionsGroupContext,
68
- );
69
-
70
- const customCollapse = useCallback(
71
- () => Promise.resolve(onActionsGroupToggled(false)).then(() => collapse()),
72
- [collapse, onActionsGroupToggled],
73
- );
74
-
75
- useEffect(() => {
76
- registerCollapse(customCollapse, uniqueId);
77
- }, [customCollapse, registerCollapse, uniqueId]);
78
-
79
- const {
80
- isExpanded: isMoreExpanded,
81
- expand: moreExpanded,
82
- collapse: moreCollapse,
83
- toggleExpanded: toggleMoreExpanded,
84
- } = useExpand();
85
-
86
- const [isMouseOverMore, setIsMouseOverMore] = useState<boolean>(false);
87
- const [isConfirmOpen, setIsConfirmOpen] = useState<Record<string, boolean>>(
88
- {},
89
- );
90
-
91
- const onConfirmToggled = (
92
- isOpen: boolean,
93
- data: { id: string; mode: ConfirmationMode },
94
- ): void => {
95
- setIsConfirmOpen((prevState) => {
96
- return { ...prevState, [data.id]: isOpen };
97
- });
98
- };
99
-
100
- useEffect(() => {
101
- const hasConfirm: boolean = Object.values(isConfirmOpen).includes(true);
102
-
103
- // open drop down
104
- if (isMouseOverMore) {
105
- moreExpanded();
106
- // close drop down if no confirmation is active
107
- } else if (!isMouseOverMore && !hasConfirm) {
108
- moreCollapse();
109
- // keep the drop down open if confirmation is active
110
- } else if (!isMouseOverMore && hasConfirm) {
111
- return;
112
- }
113
- }, [isConfirmOpen, isMouseOverMore, moreCollapse, moreExpanded]);
114
-
115
- const showMore = actions.length > availableActionSpace && actions.length > 1;
116
- const visibleActions = showMore
117
- ? Math.max(availableActionSpace, 1)
118
- : actions.length;
119
-
120
- const actionsSlice = showMore
121
- ? Math.max(availableActionSpace - 1, 0)
122
- : actions.length;
123
-
124
- return (
125
- <div
126
- className={clsx(
127
- classes.container,
128
- 'page-header-group-action-container',
129
- className,
130
- )}
131
- onMouseLeave={() => setIsMouseOverMore(false)}
132
- >
133
- <PageHeaderAction
134
- label={label}
135
- actionType={
136
- isExpanded
137
- ? PageHeaderActionType.Active
138
- : PageHeaderActionType.Context
139
- }
140
- icon={icon}
141
- onClick={async () => {
142
- try {
143
- if (!isExpanded) {
144
- await collapseAll(uniqueId);
145
- }
146
- await onActionsGroupToggled(!isExpanded);
147
- toggleExpanded();
148
- } catch (_) {
149
- // Abort the action if an error occurs
150
- return;
151
- }
152
- }}
153
- disabled={disabled}
154
- />
155
- <div
156
- style={{
157
- maxWidth: isExpanded ? `${visibleActions * 121}px` : `0px`,
158
- opacity: isExpanded ? 1 : 0,
159
- }}
160
- className={classes.actions}
161
- >
162
- {actions.slice(0, actionsSlice).map((action, idx) =>
163
- isPageHeaderJsAction(action) ? (
164
- <PageHeaderAction
165
- key={idx}
166
- {...action}
167
- disabled={groupActionsDisabled}
168
- confirmationConfig={{
169
- ...action.confirmationConfig,
170
- onConfirmOpen: (isOpen: boolean, args: unknown) => {
171
- onConfirmToggled(
172
- isOpen,
173
- args as { id: string; mode: ConfirmationMode },
174
- );
175
- action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
176
- },
177
- }}
178
- />
179
- ) : (
180
- <PageHeaderAction key={idx} {...action} />
181
- ),
182
- )}
183
- {showMore && (
184
- <div onMouseEnter={() => setIsMouseOverMore(true)}>
185
- <PageHeaderAction
186
- label="More"
187
- icon={IconName.Ellipsis}
188
- actionType={
189
- isMoreExpanded
190
- ? PageHeaderActionType.Active
191
- : PageHeaderActionType.Context
192
- }
193
- onClick={() => toggleMoreExpanded()}
194
- />
195
- </div>
196
- )}
197
- </div>
198
- {isMoreExpanded && (
199
- <div className={clsx(classes.dropDownList)}>
200
- {actions.slice(actionsSlice).map((action, idx) =>
201
- isPageHeaderJsAction(action) ? (
202
- <PageHeaderAction
203
- key={idx}
204
- {...action}
205
- tag={undefined}
206
- label={
207
- action.tag ? `${action.label} (${action.tag})` : action.label
208
- }
209
- disabled={groupActionsDisabled}
210
- onClick={() => {
211
- action.onClick();
212
- moreCollapse();
213
- setIsMouseOverMore(false);
214
- }}
215
- className={clsx(classes.dropDown)}
216
- confirmationConfig={{
217
- ...action.confirmationConfig,
218
- onConfirmOpen: (isOpen, args) => {
219
- onConfirmToggled(
220
- isOpen,
221
- args as { id: string; mode: ConfirmationMode },
222
- );
223
- action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
224
- },
225
- }}
226
- />
227
- ) : (
228
- <PageHeaderAction key={idx} {...action} />
229
- ),
230
- )}
231
- </div>
232
- )}
233
- </div>
234
- );
235
- };
@@ -1,15 +0,0 @@
1
- import { createContext } from 'react';
2
- import { noop } from '../../../helpers/utils';
3
-
4
- export interface PageHeaderActionsGroupContextType {
5
- registerCollapse: (readonly: () => Promise<void>, uuid: string) => void;
6
- collapseAll: (uuid: string) => Promise<void[]>;
7
- }
8
-
9
- export const PageHeaderActionsGroupContext =
10
- createContext<PageHeaderActionsGroupContextType>({
11
- registerCollapse: noop,
12
- collapseAll: async () => {
13
- return [];
14
- },
15
- });