@axinom/mosaic-ui 0.32.0-rc.1 → 0.32.0-rc.10
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/components/Actions/Action/Action.d.ts.map +1 -1
- package/dist/components/Actions/Actions.models.d.ts +4 -16
- package/dist/components/Actions/Actions.models.d.ts.map +1 -1
- package/dist/components/Buttons/Button/Button.d.ts +9 -10
- package/dist/components/Buttons/Button/Button.d.ts.map +1 -1
- package/dist/components/Buttons/Button/Button.model.d.ts +21 -0
- package/dist/components/Buttons/Button/Button.model.d.ts.map +1 -0
- package/dist/components/Buttons/Button/index.d.ts +3 -0
- package/dist/components/Buttons/Button/index.d.ts.map +1 -0
- package/dist/components/Buttons/Button.model.d.ts +69 -7
- package/dist/components/Buttons/Button.model.d.ts.map +1 -1
- package/dist/components/Buttons/CompositeButton/CompositeButton.d.ts +5 -14
- package/dist/components/Buttons/CompositeButton/CompositeButton.d.ts.map +1 -1
- package/dist/components/Buttons/CompositeButton/CompositeButton.model.d.ts +20 -0
- package/dist/components/Buttons/CompositeButton/CompositeButton.model.d.ts.map +1 -0
- package/dist/components/Buttons/CompositeButton/index.d.ts +3 -0
- package/dist/components/Buttons/CompositeButton/index.d.ts.map +1 -0
- package/dist/components/Buttons/TextButton/TextButton.d.ts +5 -9
- package/dist/components/Buttons/TextButton/TextButton.d.ts.map +1 -1
- package/dist/components/Buttons/TextButton/TextButton.model.d.ts +18 -0
- package/dist/components/Buttons/TextButton/TextButton.model.d.ts.map +1 -0
- package/dist/components/Buttons/TextButton/index.d.ts +3 -0
- package/dist/components/Buttons/TextButton/index.d.ts.map +1 -0
- package/dist/components/Buttons/index.d.ts +3 -3
- package/dist/components/Buttons/index.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts +2 -2
- package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
- package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts +13 -3
- package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts.map +1 -1
- package/dist/components/FormElements/ToggleButton/ToggleButton.d.ts +2 -2
- package/dist/components/FormElements/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/List.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +1 -22
- package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.model.d.ts +23 -0
- package/dist/components/PageHeader/PageHeader.model.d.ts.map +1 -0
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +20 -33
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +47 -0
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -0
- package/dist/components/PageHeader/PageHeaderAction/index.d.ts +3 -0
- package/dist/components/PageHeader/PageHeaderAction/index.d.ts.map +1 -0
- package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts +2 -2
- package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts.map +1 -1
- package/dist/components/PageHeader/index.d.ts +3 -2
- package/dist/components/PageHeader/index.d.ts.map +1 -1
- package/dist/components/models.d.ts +22 -0
- package/dist/components/models.d.ts.map +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Actions/Action/Action.spec.tsx +14 -0
- package/src/components/Actions/Action/Action.tsx +5 -2
- package/src/components/Actions/Actions.models.ts +4 -23
- package/src/components/Buttons/Button/Button.model.ts +30 -0
- package/src/components/Buttons/Button/Button.scss +3 -1
- package/src/components/Buttons/Button/Button.spec.tsx +254 -83
- package/src/components/Buttons/Button/Button.stories.tsx +20 -0
- package/src/components/Buttons/Button/Button.tsx +103 -32
- package/src/components/Buttons/Button/index.ts +2 -0
- package/src/components/Buttons/Button.model.ts +84 -9
- package/src/components/Buttons/CompositeButton/CompositeButton.model.ts +32 -0
- package/src/components/Buttons/CompositeButton/CompositeButton.scss +6 -1
- package/src/components/Buttons/CompositeButton/CompositeButton.spec.tsx +277 -89
- package/src/components/Buttons/CompositeButton/CompositeButton.stories.tsx +20 -0
- package/src/components/Buttons/CompositeButton/CompositeButton.tsx +94 -30
- package/src/components/Buttons/CompositeButton/index.ts +2 -0
- package/src/components/Buttons/TextButton/TextButton.model.ts +27 -0
- package/src/components/Buttons/TextButton/TextButton.scss +3 -1
- package/src/components/Buttons/TextButton/TextButton.spec.tsx +198 -87
- package/src/components/Buttons/TextButton/TextButton.stories.tsx +20 -0
- package/src/components/Buttons/TextButton/TextButton.tsx +74 -20
- package/src/components/Buttons/TextButton/index.ts +2 -0
- package/src/components/Buttons/index.ts +3 -6
- package/src/components/Explorer/Explorer.model.ts +2 -2
- package/src/components/Explorer/Explorer.tsx +21 -16
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.tsx +32 -11
- package/src/components/FormElements/CustomTags/CustomTags.spec.tsx +26 -16
- package/src/components/FormElements/ToggleButton/ToggleButton.tsx +2 -2
- package/src/components/List/List.spec.tsx +23 -0
- package/src/components/List/List.stories.tsx +8 -0
- package/src/components/List/List.tsx +15 -3
- package/src/components/List/ListRow/ListRow.tsx +18 -13
- package/src/components/PageHeader/PageHeader.model.ts +23 -0
- package/src/components/PageHeader/PageHeader.stories.tsx +2 -1
- package/src/components/PageHeader/PageHeader.tsx +2 -26
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +60 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +549 -382
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.stories.tsx +12 -1
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +94 -44
- package/src/components/PageHeader/PageHeaderAction/index.ts +2 -0
- package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.spec.tsx +2 -2
- package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.tsx +56 -43
- package/src/components/PageHeader/index.ts +3 -2
- package/src/components/models.ts +30 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MemoryRouter } from 'react-router';
|
|
2
4
|
import { enumToObj } from '../../../helpers/storybook';
|
|
3
5
|
import { IconName } from '../../Icons';
|
|
4
|
-
import { PageHeaderAction
|
|
6
|
+
import { PageHeaderAction } from './PageHeaderAction';
|
|
7
|
+
import { PageHeaderActionType } from './PageHeaderAction.model';
|
|
5
8
|
|
|
6
9
|
const iconOptions = enumToObj(IconName);
|
|
7
10
|
const actionTypeOptions = enumToObj(PageHeaderActionType);
|
|
@@ -23,6 +26,14 @@ const meta: Meta<typeof PageHeaderAction> = {
|
|
|
23
26
|
options: iconOptions,
|
|
24
27
|
},
|
|
25
28
|
},
|
|
29
|
+
decorators: [
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
31
|
+
(Story) => (
|
|
32
|
+
<MemoryRouter>
|
|
33
|
+
<Story />
|
|
34
|
+
</MemoryRouter>
|
|
35
|
+
),
|
|
36
|
+
],
|
|
26
37
|
};
|
|
27
38
|
export default meta;
|
|
28
39
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
3
4
|
import { noop } from '../../../helpers/utils';
|
|
4
5
|
import {
|
|
5
6
|
ConfirmationConfig,
|
|
@@ -8,41 +9,14 @@ import {
|
|
|
8
9
|
useConfirmationDelay,
|
|
9
10
|
} from '../../ConfirmDialog';
|
|
10
11
|
import { IconName, Icons } from '../../Icons';
|
|
11
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
PageHeaderActionProps,
|
|
14
|
+
PageHeaderActionType,
|
|
15
|
+
PageHeaderJsActionProps,
|
|
16
|
+
PageHeaderNavigationActionProps,
|
|
17
|
+
} from './PageHeaderAction.model';
|
|
12
18
|
import classes from './PageHeaderAction.scss';
|
|
13
19
|
|
|
14
|
-
export enum PageHeaderActionType {
|
|
15
|
-
Active,
|
|
16
|
-
Context,
|
|
17
|
-
Navigation,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface PageHeaderActionProps {
|
|
21
|
-
/** The label of the action. */
|
|
22
|
-
label: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the action is an 'Active', 'Context', or 'Navigation' type.
|
|
25
|
-
* Changes the background color to the corresponding action type. (default: 'Navigation')
|
|
26
|
-
*/
|
|
27
|
-
actionType?: PageHeaderActionType;
|
|
28
|
-
/** Optional built in icon. This prop also accepts an img src. */
|
|
29
|
-
icon?: IconName | string;
|
|
30
|
-
/** Optional image alt attribute. */
|
|
31
|
-
imgAlt?: string;
|
|
32
|
-
/** Whether the action is disabled. If set to true, disallows interactions. (default: undefined) */
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
/** Optional class */
|
|
35
|
-
className?: string;
|
|
36
|
-
/** If set to 'Simple', the action will require confirmation. If set to 'Advanced', action will require confirmation via a confirmation pop up. (default: 'None') */
|
|
37
|
-
confirmationMode?: ConfirmationMode;
|
|
38
|
-
/** Optional text overrides for the confirmation pop up. */
|
|
39
|
-
confirmationConfig?: ConfirmationConfig;
|
|
40
|
-
/**
|
|
41
|
-
* Callback to emit when a user clicks on the component
|
|
42
|
-
*/
|
|
43
|
-
onClick: () => Promise<ErrorType | void> | ErrorType | void;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
20
|
/**
|
|
47
21
|
* Simple Confirm message
|
|
48
22
|
* @example
|
|
@@ -65,12 +39,29 @@ const SimpleConfirmDialog: React.FC<{
|
|
|
65
39
|
|
|
66
40
|
/**
|
|
67
41
|
* Used to create actions for the PageHeader component.
|
|
42
|
+
* To generate anchor tag provide `path` property
|
|
43
|
+
* To generate HTML element with event handler provide `onClick` property
|
|
44
|
+
* (and optionally `confirmationMode`, `confirmationConfig`)
|
|
68
45
|
* @example
|
|
46
|
+
* // Action with JS clickHandler
|
|
69
47
|
* <PageHeaderAction label={'Action Label'} onClick={clickHandler} />
|
|
48
|
+
*
|
|
49
|
+
* // Action with anchor tag
|
|
50
|
+
* <PageHeaderAction label={'Action Label'} path={'/action-path'} />
|
|
51
|
+
*/
|
|
52
|
+
export const PageHeaderAction: React.FC<PageHeaderActionProps> = (props) =>
|
|
53
|
+
isPageHeaderNavigationAction(props) ? (
|
|
54
|
+
<PageHeaderNavigationAction {...props} />
|
|
55
|
+
) : (
|
|
56
|
+
<PageHeaderJSAction {...props} />
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Page header action with JS handler and optional confirmation mode
|
|
70
61
|
*/
|
|
71
|
-
|
|
62
|
+
const PageHeaderJSAction: React.FC<PageHeaderJsActionProps> = ({
|
|
72
63
|
label,
|
|
73
|
-
actionType = PageHeaderActionType.
|
|
64
|
+
actionType = PageHeaderActionType.Context,
|
|
74
65
|
icon,
|
|
75
66
|
imgAlt,
|
|
76
67
|
confirmationMode = 'None',
|
|
@@ -147,15 +138,12 @@ export const PageHeaderAction: React.FC<PageHeaderActionProps> = ({
|
|
|
147
138
|
data-test-id="action"
|
|
148
139
|
>
|
|
149
140
|
<div className={classes.icon}>
|
|
150
|
-
{!confirmation &&
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)}
|
|
157
|
-
</>
|
|
158
|
-
)}
|
|
141
|
+
{!confirmation &&
|
|
142
|
+
(typeof icon === 'string' ? (
|
|
143
|
+
<img src={icon} alt={imgAlt} />
|
|
144
|
+
) : (
|
|
145
|
+
<Icons icon={icon} className={classes.pageHeaderActionsIcons} />
|
|
146
|
+
))}
|
|
159
147
|
</div>
|
|
160
148
|
<div className={classes.label}>
|
|
161
149
|
{confirmation && confirmationMode === 'Simple' ? (
|
|
@@ -190,3 +178,65 @@ export const PageHeaderAction: React.FC<PageHeaderActionProps> = ({
|
|
|
190
178
|
</>
|
|
191
179
|
);
|
|
192
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Page header action rendered as anchor tag
|
|
184
|
+
*/
|
|
185
|
+
const PageHeaderNavigationAction: React.FC<PageHeaderNavigationActionProps> = ({
|
|
186
|
+
className,
|
|
187
|
+
disabled,
|
|
188
|
+
icon,
|
|
189
|
+
imgAlt,
|
|
190
|
+
label,
|
|
191
|
+
openInNewTab = false,
|
|
192
|
+
path,
|
|
193
|
+
}) => {
|
|
194
|
+
const headerIcon = icon ? icon : openInNewTab ? IconName.External : undefined;
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<Link
|
|
198
|
+
className={clsx(
|
|
199
|
+
classes.container,
|
|
200
|
+
'page-header-action-container',
|
|
201
|
+
{ [classes.disabled]: disabled },
|
|
202
|
+
className,
|
|
203
|
+
)}
|
|
204
|
+
data-test-id="action"
|
|
205
|
+
to={path}
|
|
206
|
+
target={openInNewTab ? '_blank' : undefined}
|
|
207
|
+
>
|
|
208
|
+
<div className={classes.icon}>
|
|
209
|
+
{typeof headerIcon === 'string' ? (
|
|
210
|
+
<img src={headerIcon} alt={imgAlt} />
|
|
211
|
+
) : (
|
|
212
|
+
<Icons icon={headerIcon} className={classes.pageHeaderActionsIcons} />
|
|
213
|
+
)}
|
|
214
|
+
</div>
|
|
215
|
+
<div className={classes.label}>
|
|
216
|
+
<span data-test-id="label">{label}</span>
|
|
217
|
+
</div>
|
|
218
|
+
</Link>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Determines whether an action data object is a PageHeaderNavigationActionProps object.
|
|
224
|
+
* @param {PageHeaderActionProps} action - The action data object to check.
|
|
225
|
+
* @returns {boolean} - Whether the action data object is a PageHeaderNavigationActionProps object.
|
|
226
|
+
*/
|
|
227
|
+
export function isPageHeaderNavigationAction(
|
|
228
|
+
action: PageHeaderActionProps,
|
|
229
|
+
): action is PageHeaderNavigationActionProps {
|
|
230
|
+
return 'path' in action && !!action.path;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Determines whether an action data object is a PageHeaderJsActionProps object.
|
|
235
|
+
* @param {PageHeaderActionProps} action - The action data object to check.
|
|
236
|
+
* @returns {boolean} - Whether the action data object is a PageHeaderJsActionProps object.
|
|
237
|
+
*/
|
|
238
|
+
export function isPageHeaderJsAction(
|
|
239
|
+
action: PageHeaderActionProps,
|
|
240
|
+
): action is PageHeaderJsActionProps {
|
|
241
|
+
return 'onClick' in action && !!action.onClick;
|
|
242
|
+
}
|
|
@@ -2,11 +2,11 @@ import { mount, shallow } from 'enzyme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { act } from 'react-dom/test-utils';
|
|
4
4
|
import { noop } from '../../../helpers/utils';
|
|
5
|
+
import { PageHeaderAction } from '../PageHeaderAction/PageHeaderAction';
|
|
5
6
|
import {
|
|
6
|
-
PageHeaderAction,
|
|
7
7
|
PageHeaderActionProps,
|
|
8
8
|
PageHeaderActionType,
|
|
9
|
-
} from '../PageHeaderAction/PageHeaderAction';
|
|
9
|
+
} from '../PageHeaderAction/PageHeaderAction.model';
|
|
10
10
|
import {
|
|
11
11
|
PageHeaderBulkActions,
|
|
12
12
|
PageHeaderBulkActionsProps,
|
|
@@ -4,12 +4,15 @@ import { noop } from '../../../helpers/utils';
|
|
|
4
4
|
import { useExpand } from '../../../hooks/useExpand/useExpand';
|
|
5
5
|
import { ConfirmationMode } from '../../ConfirmDialog';
|
|
6
6
|
import { IconName } from '../../Icons';
|
|
7
|
-
import { PageHeaderProps } from '../PageHeader';
|
|
7
|
+
import { PageHeaderProps } from '../PageHeader.model';
|
|
8
8
|
import {
|
|
9
|
+
isPageHeaderJsAction,
|
|
9
10
|
PageHeaderAction,
|
|
11
|
+
} from '../PageHeaderAction/PageHeaderAction';
|
|
12
|
+
import {
|
|
10
13
|
PageHeaderActionProps,
|
|
11
14
|
PageHeaderActionType,
|
|
12
|
-
} from '../PageHeaderAction/PageHeaderAction';
|
|
15
|
+
} from '../PageHeaderAction/PageHeaderAction.model';
|
|
13
16
|
import classes from './PageHeaderBulkActions.scss';
|
|
14
17
|
|
|
15
18
|
export interface PageHeaderBulkActionsProps
|
|
@@ -107,23 +110,27 @@ export const PageHeaderBulkActions: React.FC<PageHeaderBulkActionsProps> = ({
|
|
|
107
110
|
}}
|
|
108
111
|
/>
|
|
109
112
|
{isExpanded &&
|
|
110
|
-
actions.slice(0, availableActionSpace).map((action, idx) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
actions.slice(0, availableActionSpace).map((action, idx) =>
|
|
114
|
+
isPageHeaderJsAction(action) ? (
|
|
115
|
+
<PageHeaderAction
|
|
116
|
+
key={idx}
|
|
117
|
+
{...action}
|
|
118
|
+
disabled={bulkActionsDisabled}
|
|
119
|
+
confirmationConfig={{
|
|
120
|
+
...action.confirmationConfig,
|
|
121
|
+
onConfirmOpen: (isOpen, args) => {
|
|
122
|
+
onConfirmToggled(
|
|
123
|
+
isOpen,
|
|
124
|
+
args as { id: string; mode: ConfirmationMode },
|
|
125
|
+
);
|
|
126
|
+
action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
|
|
127
|
+
},
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
) : (
|
|
131
|
+
<PageHeaderAction key={idx} {...action} />
|
|
132
|
+
),
|
|
133
|
+
)}
|
|
127
134
|
{isExpanded && actions.length > availableActionSpace && (
|
|
128
135
|
<div
|
|
129
136
|
className={clsx(classes.hasMore)}
|
|
@@ -142,30 +149,36 @@ export const PageHeaderBulkActions: React.FC<PageHeaderBulkActionsProps> = ({
|
|
|
142
149
|
/>
|
|
143
150
|
{isMoreExpanded && (
|
|
144
151
|
<div className={clsx(classes.dropDownList)}>
|
|
145
|
-
{actions.slice(availableActionSpace).map((action, idx) =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
152
|
+
{actions.slice(availableActionSpace).map((action, idx) =>
|
|
153
|
+
isPageHeaderJsAction(action) ? (
|
|
154
|
+
<PageHeaderAction
|
|
155
|
+
key={idx}
|
|
156
|
+
{...action}
|
|
157
|
+
disabled={bulkActionsDisabled}
|
|
158
|
+
onClick={() => {
|
|
159
|
+
action.onClick();
|
|
160
|
+
moreCollapse();
|
|
161
|
+
setIsMouseOverMore(false);
|
|
162
|
+
}}
|
|
163
|
+
className={clsx(classes.dropDown)}
|
|
164
|
+
confirmationConfig={{
|
|
165
|
+
...action.confirmationConfig,
|
|
166
|
+
onConfirmOpen: (isOpen, args) => {
|
|
167
|
+
onConfirmToggled(
|
|
168
|
+
isOpen,
|
|
169
|
+
args as { id: string; mode: ConfirmationMode },
|
|
170
|
+
);
|
|
171
|
+
action.confirmationConfig?.onConfirmOpen?.(
|
|
172
|
+
isOpen,
|
|
173
|
+
args,
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
) : (
|
|
179
|
+
<PageHeaderAction key={idx} {...action} />
|
|
180
|
+
),
|
|
181
|
+
)}
|
|
169
182
|
</div>
|
|
170
183
|
)}
|
|
171
184
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { PageHeader
|
|
1
|
+
export { PageHeader } from './PageHeader';
|
|
2
|
+
export { PageHeaderProps } from './PageHeader.model';
|
|
2
3
|
export {
|
|
3
4
|
PageHeaderAction,
|
|
4
5
|
PageHeaderActionProps,
|
|
5
6
|
PageHeaderActionType,
|
|
6
|
-
} from './PageHeaderAction
|
|
7
|
+
} from './PageHeaderAction';
|
package/src/components/models.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { LocationDescriptor } from 'history';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { ConfirmationConfig, ConfirmationMode } from './ConfirmDialog';
|
|
2
4
|
import { MessageBarProps } from './MessageBar';
|
|
3
5
|
|
|
4
6
|
export type StationError = Pick<MessageBarProps, 'title'> & {
|
|
@@ -16,8 +18,36 @@ export type StationMessage = MessageBarProps & {
|
|
|
16
18
|
*/
|
|
17
19
|
body?: string | React.ReactNode;
|
|
18
20
|
};
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Possible error options the engine will handle
|
|
21
24
|
*/
|
|
22
25
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
23
26
|
export type ErrorType = StationError | string | Object | Error;
|
|
27
|
+
|
|
28
|
+
/** Properties to generate a link */
|
|
29
|
+
export interface LinkAction {
|
|
30
|
+
/** Where to navigate to when the action is clicked. */
|
|
31
|
+
path: LocationDescriptor<unknown>;
|
|
32
|
+
/** If set to true, the link will open in a new tab. */
|
|
33
|
+
openInNewTab?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Properties for Action click confirmation
|
|
38
|
+
*/
|
|
39
|
+
export interface ConfirmAction {
|
|
40
|
+
/** If set to 'Simple', the action will require confirmation. If set to 'Advanced', action will require confirmation via a confirmation pop up. (default: 'None') */
|
|
41
|
+
confirmationMode?: ConfirmationMode;
|
|
42
|
+
/** Optional text overrides for the confirmation pop up. */
|
|
43
|
+
confirmationConfig?: ConfirmationConfig;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Default Action click event handler
|
|
48
|
+
*/
|
|
49
|
+
export type DefaultHandler = () =>
|
|
50
|
+
| Promise<ErrorType | undefined | void>
|
|
51
|
+
| ErrorType
|
|
52
|
+
| undefined
|
|
53
|
+
| void;
|