@axinom/mosaic-ui 0.32.0-rc.3 → 0.32.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/components/Actions/Actions.models.d.ts +4 -16
  2. package/dist/components/Actions/Actions.models.d.ts.map +1 -1
  3. package/dist/components/Explorer/Explorer.d.ts.map +1 -1
  4. package/dist/components/Explorer/Explorer.model.d.ts +2 -2
  5. package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
  6. package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts +12 -3
  7. package/dist/components/Explorer/NavigationExplorer/NavigationExplorer.d.ts.map +1 -1
  8. package/dist/components/PageHeader/PageHeader.d.ts +1 -22
  9. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
  10. package/dist/components/PageHeader/PageHeader.model.d.ts +23 -0
  11. package/dist/components/PageHeader/PageHeader.model.d.ts.map +1 -0
  12. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts +20 -33
  13. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
  14. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +47 -0
  15. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -0
  16. package/dist/components/PageHeader/PageHeaderAction/index.d.ts +3 -0
  17. package/dist/components/PageHeader/PageHeaderAction/index.d.ts.map +1 -0
  18. package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts +2 -2
  19. package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts.map +1 -1
  20. package/dist/components/PageHeader/index.d.ts +3 -2
  21. package/dist/components/PageHeader/index.d.ts.map +1 -1
  22. package/dist/components/models.d.ts +19 -0
  23. package/dist/components/models.d.ts.map +1 -1
  24. package/dist/index.es.js +2 -2
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/index.js +2 -2
  27. package/dist/index.js.map +1 -1
  28. package/package.json +3 -3
  29. package/src/components/Actions/Actions.models.ts +4 -23
  30. package/src/components/Explorer/Explorer.model.ts +2 -2
  31. package/src/components/Explorer/Explorer.tsx +19 -14
  32. package/src/components/Explorer/NavigationExplorer/NavigationExplorer.tsx +31 -11
  33. package/src/components/PageHeader/PageHeader.model.ts +23 -0
  34. package/src/components/PageHeader/PageHeader.stories.tsx +2 -1
  35. package/src/components/PageHeader/PageHeader.tsx +2 -26
  36. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +60 -0
  37. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +46 -4
  38. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.stories.tsx +12 -1
  39. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +91 -45
  40. package/src/components/PageHeader/PageHeaderAction/index.ts +2 -0
  41. package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.spec.tsx +2 -2
  42. package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.tsx +56 -43
  43. package/src/components/PageHeader/index.ts +3 -2
  44. package/src/components/models.ts +27 -0
@@ -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
- <PageHeaderAction
112
- key={idx}
113
- {...action}
114
- disabled={bulkActionsDisabled}
115
- confirmationConfig={{
116
- ...action.confirmationConfig,
117
- onConfirmOpen: (isOpen, args) => {
118
- onConfirmToggled(
119
- isOpen,
120
- args as { id: string; mode: ConfirmationMode },
121
- );
122
- action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
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
- <PageHeaderAction
147
- key={idx}
148
- {...action}
149
- icon={action.icon}
150
- disabled={bulkActionsDisabled}
151
- onClick={() => {
152
- action.onClick();
153
- moreCollapse();
154
- setIsMouseOverMore(false);
155
- }}
156
- className={clsx(classes.dropDown)}
157
- confirmationConfig={{
158
- ...action.confirmationConfig,
159
- onConfirmOpen: (isOpen, args) => {
160
- onConfirmToggled(
161
- isOpen,
162
- args as { id: string; mode: ConfirmationMode },
163
- );
164
- action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
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, PageHeaderProps } from './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/PageHeaderAction';
7
+ } from './PageHeaderAction';
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ConfirmationConfig, ConfirmationMode } from './ConfirmDialog';
2
3
  import { MessageBarProps } from './MessageBar';
3
4
 
4
5
  export type StationError = Pick<MessageBarProps, 'title'> & {
@@ -16,8 +17,34 @@ export type StationMessage = MessageBarProps & {
16
17
  */
17
18
  body?: string | React.ReactNode;
18
19
  };
20
+
19
21
  /**
20
22
  * Possible error options the engine will handle
21
23
  */
22
24
  // eslint-disable-next-line @typescript-eslint/ban-types
23
25
  export type ErrorType = StationError | string | Object | Error;
26
+
27
+ /** Properties to generate a link */
28
+ export interface LinkAction {
29
+ /** Path to navigate to when the action is clicked. */
30
+ path: string;
31
+ }
32
+
33
+ /**
34
+ * Properties for Action click confirmation
35
+ */
36
+ export interface ConfirmAction {
37
+ /** If set to 'Simple', the action will require confirmation. If set to 'Advanced', action will require confirmation via a confirmation pop up. (default: 'None') */
38
+ confirmationMode?: ConfirmationMode;
39
+ /** Optional text overrides for the confirmation pop up. */
40
+ confirmationConfig?: ConfirmationConfig;
41
+ }
42
+
43
+ /**
44
+ * Default Action click event handler
45
+ */
46
+ export type DefaultHandler = () =>
47
+ | Promise<ErrorType | undefined | void>
48
+ | ErrorType
49
+ | undefined
50
+ | void;