@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.
- package/dist/THIRD-PARTY-LICENSES.txt +1296 -0
- package/dist/cjs/components/ActionBar/ActionBar.d.ts +26 -0
- package/dist/cjs/components/ActionBar/ActionBar.d.ts.map +1 -0
- package/dist/cjs/components/ActionBar/ActionBar.model.d.ts +49 -0
- package/dist/cjs/components/ActionBar/ActionBar.model.d.ts.map +1 -0
- package/dist/cjs/components/ActionBar/ActionBarButton/ActionBarButton.d.ts +22 -0
- package/dist/cjs/components/ActionBar/ActionBarButton/ActionBarButton.d.ts.map +1 -0
- package/dist/cjs/components/ActionBar/helpers.d.ts +22 -0
- package/dist/cjs/components/ActionBar/helpers.d.ts.map +1 -0
- package/dist/cjs/components/ActionBar/index.d.ts +3 -0
- package/dist/cjs/components/ActionBar/index.d.ts.map +1 -0
- package/dist/cjs/components/Actions/Action/Action.d.ts.map +1 -1
- package/dist/cjs/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/cjs/components/ConfirmDialog/index.d.ts.map +1 -1
- package/dist/cjs/components/ConfirmDialog/useConfirmableAction.d.ts +55 -0
- package/dist/cjs/components/ConfirmDialog/useConfirmableAction.d.ts.map +1 -0
- package/dist/cjs/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
- package/dist/cjs/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/cjs/components/Explorer/QuickEdit/useQuickEdit.d.ts +14 -3
- package/dist/cjs/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -1
- package/dist/cjs/components/Explorer/helpers/useActions.d.ts +15 -4
- package/dist/cjs/components/Explorer/helpers/useActions.d.ts.map +1 -1
- package/dist/cjs/components/Explorer/helpers/useSubtitle.d.ts.map +1 -1
- package/dist/cjs/components/List/List.d.ts +17 -3
- package/dist/cjs/components/List/List.d.ts.map +1 -1
- package/dist/cjs/components/List/List.model.d.ts +5 -1
- package/dist/cjs/components/List/List.model.d.ts.map +1 -1
- package/dist/cjs/components/List/ListHeader/ListHeader.d.ts +10 -1
- package/dist/cjs/components/List/ListHeader/ListHeader.d.ts.map +1 -1
- package/dist/cjs/components/List/ListRow/ListRow.d.ts +16 -5
- package/dist/cjs/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/cjs/components/List/ListRowRenderer/ListRowRenderer.d.ts.map +1 -1
- package/dist/cjs/components/List/helpers.d.ts +11 -3
- package/dist/cjs/components/List/helpers.d.ts.map +1 -1
- package/dist/cjs/components/List/useColumnsSize.d.ts +4 -2
- package/dist/cjs/components/List/useColumnsSize.d.ts.map +1 -1
- package/dist/cjs/components/PageHeader/PageHeader.d.ts +4 -1
- package/dist/cjs/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/cjs/components/PageHeader/PageHeader.model.d.ts +37 -1
- package/dist/cjs/components/PageHeader/PageHeader.model.d.ts.map +1 -1
- package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +3 -0
- package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
- package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +8 -0
- package/dist/cjs/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
- package/dist/cjs/components/PageHeader/helpers.d.ts +9 -0
- package/dist/cjs/components/PageHeader/helpers.d.ts.map +1 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/useElementWidthObserver/useElementWidthObserver.d.ts.map +1 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/ActionBar/ActionBar.d.ts +26 -0
- package/dist/esm/components/ActionBar/ActionBar.d.ts.map +1 -0
- package/dist/esm/components/ActionBar/ActionBar.model.d.ts +49 -0
- package/dist/esm/components/ActionBar/ActionBar.model.d.ts.map +1 -0
- package/dist/esm/components/ActionBar/ActionBarButton/ActionBarButton.d.ts +22 -0
- package/dist/esm/components/ActionBar/ActionBarButton/ActionBarButton.d.ts.map +1 -0
- package/dist/esm/components/ActionBar/helpers.d.ts +22 -0
- package/dist/esm/components/ActionBar/helpers.d.ts.map +1 -0
- package/dist/esm/components/ActionBar/index.d.ts +3 -0
- package/dist/esm/components/ActionBar/index.d.ts.map +1 -0
- package/dist/esm/components/Actions/Action/Action.d.ts.map +1 -1
- package/dist/esm/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/esm/components/ConfirmDialog/index.d.ts.map +1 -1
- package/dist/esm/components/ConfirmDialog/useConfirmableAction.d.ts +55 -0
- package/dist/esm/components/ConfirmDialog/useConfirmableAction.d.ts.map +1 -0
- package/dist/esm/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
- package/dist/esm/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/esm/components/Explorer/QuickEdit/useQuickEdit.d.ts +14 -3
- package/dist/esm/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -1
- package/dist/esm/components/Explorer/helpers/useActions.d.ts +15 -4
- package/dist/esm/components/Explorer/helpers/useActions.d.ts.map +1 -1
- package/dist/esm/components/Explorer/helpers/useSubtitle.d.ts.map +1 -1
- package/dist/esm/components/List/List.d.ts +17 -3
- package/dist/esm/components/List/List.d.ts.map +1 -1
- package/dist/esm/components/List/List.model.d.ts +5 -1
- package/dist/esm/components/List/List.model.d.ts.map +1 -1
- package/dist/esm/components/List/ListHeader/ListHeader.d.ts +10 -1
- package/dist/esm/components/List/ListHeader/ListHeader.d.ts.map +1 -1
- package/dist/esm/components/List/ListRow/ListRow.d.ts +16 -5
- package/dist/esm/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/esm/components/List/ListRowRenderer/ListRowRenderer.d.ts.map +1 -1
- package/dist/esm/components/List/helpers.d.ts +11 -3
- package/dist/esm/components/List/helpers.d.ts.map +1 -1
- package/dist/esm/components/List/useColumnsSize.d.ts +4 -2
- package/dist/esm/components/List/useColumnsSize.d.ts.map +1 -1
- package/dist/esm/components/PageHeader/PageHeader.d.ts +4 -1
- package/dist/esm/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/esm/components/PageHeader/PageHeader.model.d.ts +37 -1
- package/dist/esm/components/PageHeader/PageHeader.model.d.ts.map +1 -1
- package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +3 -0
- package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
- package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +8 -0
- package/dist/esm/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
- package/dist/esm/components/PageHeader/helpers.d.ts +9 -0
- package/dist/esm/components/PageHeader/helpers.d.ts.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/useElementWidthObserver/useElementWidthObserver.d.ts.map +1 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +7 -3
- package/src/components/ActionBar/ActionBar.model.ts +61 -0
- package/src/components/ActionBar/ActionBar.module.scss +64 -0
- package/src/components/ActionBar/ActionBar.spec.tsx +398 -0
- package/src/components/ActionBar/ActionBar.stories.tsx +205 -0
- package/src/components/ActionBar/ActionBar.tsx +170 -0
- package/src/components/ActionBar/ActionBarButton/ActionBarButton.module.scss +140 -0
- package/src/components/ActionBar/ActionBarButton/ActionBarButton.tsx +193 -0
- package/src/components/ActionBar/helpers.spec.ts +41 -0
- package/src/components/ActionBar/helpers.ts +54 -0
- package/src/components/ActionBar/index.ts +2 -0
- package/src/components/Actions/Action/Action.spec.tsx +64 -2
- package/src/components/Actions/Action/Action.tsx +6 -1
- package/src/components/ConfirmDialog/index.ts +1 -0
- package/src/components/ConfirmDialog/useConfirmableAction.tsx +159 -0
- package/src/components/EmptyStation/EmptyStation.stories.tsx +97 -0
- package/src/components/Explorer/BulkEdit/useBulkEdit.tsx +2 -0
- package/src/components/Explorer/Explorer.spec.tsx +97 -8
- package/src/components/Explorer/Explorer.tsx +26 -13
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.stories.tsx +124 -1
- package/src/components/Explorer/QuickEdit/useQuickEdit.spec.tsx +94 -50
- package/src/components/Explorer/QuickEdit/useQuickEdit.tsx +101 -42
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +46 -13
- package/src/components/Explorer/helpers/useActions.ts +125 -73
- package/src/components/Explorer/helpers/useSubtitle.spec.tsx +33 -23
- package/src/components/Explorer/helpers/useSubtitle.tsx +18 -26
- package/src/components/List/List.model.ts +5 -1
- package/src/components/List/List.module.scss +25 -6
- package/src/components/List/List.spec.tsx +498 -1
- package/src/components/List/List.stories.tsx +137 -8
- package/src/components/List/List.tsx +305 -194
- package/src/components/List/ListHeader/ListHeader.module.scss +14 -0
- package/src/components/List/ListHeader/ListHeader.spec.tsx +1 -0
- package/src/components/List/ListHeader/ListHeader.tsx +25 -8
- package/src/components/List/ListRow/ListRow.module.scss +1 -1
- package/src/components/List/ListRow/ListRow.spec.tsx +109 -22
- package/src/components/List/ListRow/ListRow.tsx +52 -13
- package/src/components/List/ListRowRenderer/ListRowRenderer.tsx +28 -22
- package/src/components/List/helpers.spec.ts +29 -0
- package/src/components/List/helpers.ts +17 -9
- package/src/components/List/useColumnsSize.ts +17 -7
- package/src/components/PageHeader/PageHeader.model.ts +38 -1
- package/src/components/PageHeader/PageHeader.module.scss +39 -18
- package/src/components/PageHeader/PageHeader.spec.tsx +407 -18
- package/src/components/PageHeader/PageHeader.stories.tsx +95 -12
- package/src/components/PageHeader/PageHeader.tsx +89 -38
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +8 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.module.scss +50 -42
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +193 -1
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.stories.tsx +36 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +81 -130
- package/src/components/PageHeader/helpers.spec.ts +60 -0
- package/src/components/PageHeader/helpers.ts +36 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/styles/variables.scss +41 -7
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +0 -35
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +0 -1
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +0 -6
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +0 -1
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts +0 -3
- package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts.map +0 -1
- package/dist/cjs/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +0 -1
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +0 -35
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +0 -1
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +0 -6
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +0 -1
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts +0 -3
- package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts.map +0 -1
- package/dist/esm/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +0 -1
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.module.scss +0 -77
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +0 -122
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +0 -235
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.ts +0 -15
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.tsx +0 -37
- /package/dist/cjs/{components/PageHeader/helpers → hooks/useElementWidthObserver}/useElementWidthObserver.d.ts +0 -0
- /package/dist/esm/{components/PageHeader/helpers → hooks/useElementWidthObserver}/useElementWidthObserver.d.ts +0 -0
- /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:
|
|
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
|
-
|
|
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:
|
|
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
|
package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map
DELETED
|
@@ -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"}
|
package/dist/cjs/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts
DELETED
|
@@ -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 +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
|
package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map
DELETED
|
@@ -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"}
|
package/dist/esm/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts
DELETED
|
@@ -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 +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
|
-
});
|