@axinom/mosaic-ui 0.33.0-rc.1 → 0.33.0-rc.19

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 (99) hide show
  1. package/dist/components/Actions/Actions.models.d.ts +0 -13
  2. package/dist/components/Actions/Actions.models.d.ts.map +1 -1
  3. package/dist/components/DynamicDataList/DynamicDataList.d.ts.map +1 -1
  4. package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts +3 -1
  5. package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts.map +1 -1
  6. package/dist/components/FormElements/CustomTags/CustomTags.d.ts.map +1 -1
  7. package/dist/components/FormElements/FileUploadControl/FileUploadControl.d.ts.map +1 -1
  8. package/dist/components/FormElements/Radio/Radio.d.ts.map +1 -1
  9. package/dist/components/FormElements/Tags/Tags.d.ts.map +1 -1
  10. package/dist/components/FormElements/formStoryHelper.d.ts.map +1 -1
  11. package/dist/components/FormStation/FormStation.d.ts.map +1 -1
  12. package/dist/components/InfoPanel/InfoImage/InfoImage.d.ts.map +1 -1
  13. package/dist/components/List/List.d.ts.map +1 -1
  14. package/dist/components/Loaders/ImageLoader/ImageLoader.d.ts +2 -0
  15. package/dist/components/Loaders/ImageLoader/ImageLoader.d.ts.map +1 -1
  16. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +1 -11
  17. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
  18. package/dist/components/index.d.ts +1 -1
  19. package/dist/components/index.d.ts.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.es.js +3 -3
  23. package/dist/index.es.js.map +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/initialize.d.ts +7 -4
  27. package/dist/initialize.d.ts.map +1 -1
  28. package/dist/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.d.ts +9 -0
  29. package/dist/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.d.ts.map +1 -0
  30. package/dist/utils/ErrorMapper/ErrorMapper.d.ts +15 -0
  31. package/dist/utils/ErrorMapper/ErrorMapper.d.ts.map +1 -0
  32. package/dist/utils/ErrorMapper/ErrorMapper.type.d.ts +11 -0
  33. package/dist/utils/ErrorMapper/ErrorMapper.type.d.ts.map +1 -0
  34. package/dist/utils/ErrorMapper/index.d.ts +4 -0
  35. package/dist/utils/ErrorMapper/index.d.ts.map +1 -0
  36. package/dist/utils/ErrorTypeToStationError.d.ts +1 -1
  37. package/dist/utils/ErrorTypeToStationError.d.ts.map +1 -1
  38. package/package.json +3 -3
  39. package/src/components/Accordion/Accordion.scss +1 -1
  40. package/src/components/Accordion/AccordionItem/AccordionItem.scss +1 -1
  41. package/src/components/Actions/Action/Action.scss +0 -2
  42. package/src/components/Actions/Actions.models.ts +0 -14
  43. package/src/components/Actions/Actions.stories.tsx +4 -1
  44. package/src/components/Buttons/Button/Button.scss +66 -20
  45. package/src/components/Buttons/CompositeButton/CompositeButton.scss +50 -18
  46. package/src/components/Buttons/TextButton/TextButton.scss +45 -16
  47. package/src/components/DateTime/DatePicker/DatePicker.scss +15 -6
  48. package/src/components/DateTime/DateTimePicker.scss +6 -2
  49. package/src/components/DynamicDataList/DynamicDataList.tsx +1 -0
  50. package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.scss +15 -5
  51. package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.tsx +1 -1
  52. package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.scss +36 -12
  53. package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.tsx +2 -2
  54. package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.scss +26 -0
  55. package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.tsx +7 -1
  56. package/src/components/Filters/Filter/Filter.scss +8 -2
  57. package/src/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.scss +4 -1
  58. package/src/components/FormElements/Checkbox/Checkbox.scss +20 -0
  59. package/src/components/FormElements/CustomTags/CustomTags.scss +24 -0
  60. package/src/components/FormElements/CustomTags/CustomTags.tsx +8 -2
  61. package/src/components/FormElements/DateTimeField/DateTimeText.spec.tsx +1 -1
  62. package/src/components/FormElements/DateTimeField/DateTimeText.tsx +1 -1
  63. package/src/components/FormElements/FileUploadControl/FileUploadControl.scss +4 -2
  64. package/src/components/FormElements/FileUploadControl/FileUploadControl.tsx +12 -3
  65. package/src/components/FormElements/Radio/Radio.scss +18 -3
  66. package/src/components/FormElements/Radio/Radio.tsx +2 -2
  67. package/src/components/FormElements/Select/Select.scss +10 -0
  68. package/src/components/FormElements/SingleLineText/SingleLineText.spec.tsx +2 -2
  69. package/src/components/FormElements/SingleLineText/SingleLineText.tsx +1 -1
  70. package/src/components/FormElements/Tags/Tags.scss +14 -0
  71. package/src/components/FormElements/Tags/Tags.tsx +5 -1
  72. package/src/components/FormElements/TextArea/TextArea.spec.tsx +2 -2
  73. package/src/components/FormElements/TextArea/TextArea.tsx +1 -1
  74. package/src/components/FormElements/formStoryHelper.tsx +163 -97
  75. package/src/components/FormStation/FormStation.spec.tsx +13 -3
  76. package/src/components/FormStation/FormStation.tsx +13 -3
  77. package/src/components/InfoPanel/InfoImage/InfoImage.scss +8 -3
  78. package/src/components/InfoPanel/InfoImage/InfoImage.tsx +1 -0
  79. package/src/components/List/List.tsx +3 -1
  80. package/src/components/List/ListCheckBox/ListCheckBox.scss +8 -3
  81. package/src/components/List/ListRow/ListRow.scss +0 -4
  82. package/src/components/Loaders/ImageLoader/ImageLoader.scss +27 -21
  83. package/src/components/Loaders/ImageLoader/ImageLoader.spec.tsx +8 -12
  84. package/src/components/Loaders/ImageLoader/ImageLoader.tsx +8 -3
  85. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +0 -10
  86. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.scss +0 -1
  87. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.stories.tsx +5 -0
  88. package/src/components/index.ts +1 -1
  89. package/src/index.ts +1 -0
  90. package/src/initialize.ts +15 -12
  91. package/src/styles/variables.scss +32 -2
  92. package/src/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.spec.ts +32 -0
  93. package/src/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.tsx +33 -0
  94. package/src/utils/ErrorMapper/ErrorMapper.spec.ts +67 -0
  95. package/src/utils/ErrorMapper/ErrorMapper.ts +31 -0
  96. package/src/utils/ErrorMapper/ErrorMapper.type.ts +11 -0
  97. package/src/utils/ErrorMapper/index.ts +3 -0
  98. package/src/utils/ErrorTypeToStationError.spec.tsx +12 -0
  99. package/src/utils/ErrorTypeToStationError.tsx +5 -1
@@ -1,7 +1,18 @@
1
1
  import { faker } from '@faker-js/faker';
2
2
  import React, { useState } from 'react';
3
- import { CustomTags, ReadOnlyField, Select, SingleLineText, Tags } from '.';
3
+ import {
4
+ Checkbox,
5
+ CustomTags,
6
+ Divider,
7
+ FileUploadControl,
8
+ Radio,
9
+ ReadOnlyField,
10
+ Select,
11
+ SingleLineText,
12
+ Tags,
13
+ } from '.';
4
14
  import { generateItemArray } from '../../helpers/storybook';
15
+ import { TextButton } from '../Buttons';
5
16
  import { DynamicListColumn } from '../DynamicDataList/DynamicDataList.model';
6
17
  import {
7
18
  createInputRenderer,
@@ -10,6 +21,8 @@ import {
10
21
  import { formatDateTime } from '../Utils';
11
22
  import { BooleanViewField } from './BooleanView/BooleanViewField';
12
23
  import { DynamicDataListControl } from './DynamicDataListControl/DynamicDataListControl';
24
+ import { FileUpload } from './FileUploadControl/FileUploadControl';
25
+ import { TextArea } from './TextArea/TextArea';
13
26
 
14
27
  interface DynamicListStoryData {
15
28
  position: number;
@@ -67,13 +80,13 @@ const dataListColumns: DynamicListColumn<DynamicListStoryData>[] = [
67
80
  ];
68
81
 
69
82
  export const SampleForm: React.FC = () => useCreateForm().form;
70
-
71
83
  export const useCreateForm = (): {
72
84
  form: JSX.Element;
73
85
  title: string;
74
86
  } => {
75
87
  const [id] = useState(faker.datatype.uuid());
76
88
  const [title, setTitle] = useState(`The ${generateTitle()}`);
89
+ const [title2, setTitle2] = useState(`The ${generateTitle()}`);
77
90
  const [genres, setGenres] = useState<string[]>(['Crime', 'Drama']);
78
91
  const [ratings, setRatings] = useState<
79
92
  string | number | string[] | undefined
@@ -94,104 +107,157 @@ export const useCreateForm = (): {
94
107
  country: faker.address.country(),
95
108
  })),
96
109
  );
110
+ const [radio, setRadio] = useState(1);
111
+ const [check, setCheck] = useState<boolean>();
112
+ const [file, setFile] = useState<FileUpload>();
113
+
114
+ const [disabled, setDisabled] = useState<boolean>(false);
97
115
 
98
116
  return {
99
117
  form: (
100
- <form
101
- style={{
102
- display: 'grid',
103
- gridAutoRows: 'max-content',
104
- gridTemplateColumns: '1fr',
105
- rowGap: '20px',
106
- }}
107
- >
108
- <ReadOnlyField label="Id" value={id} />
109
- <SingleLineText
110
- name="title"
111
- label="Title"
112
- value={title}
113
- onChange={(e) => setTitle(e.currentTarget.value)}
114
- />
115
- <ReadOnlyField label="Publish State" value="PUBLISHED" />
116
- <BooleanViewField
117
- label="Status"
118
- value={status}
119
- trueLabel="Enabled"
120
- falseLabel="Disabled"
121
- />
122
- <Tags
123
- name="genres"
124
- label="Genre(s)"
125
- value={genres}
126
- tagsOptions={genresOptions}
127
- onChange={(e) =>
128
- setGenres(e.currentTarget.value as unknown as string[])
129
- }
130
- />
131
- <Select
132
- name="ratings"
133
- label="Rating"
134
- value={ratings}
135
- options={selectOptions}
136
- onChange={(e) => setRatings(e.currentTarget.value)}
137
- />
138
- <SingleLineText
139
- name="shortDescription"
140
- label="Short Description"
141
- value={shortDescription}
142
- placeholder="Enter a short description..."
143
- onChange={(e) => setShortDescription(e.currentTarget.value)}
144
- />
145
- <SingleLineText
146
- name="longDescription"
147
- label="Long Description"
148
- value={longDescription}
149
- placeholder="Enter a description..."
150
- onChange={(e) => setLongDescription(e.currentTarget.value)}
151
- />
152
- <CustomTags
153
- name="cast"
154
- value={cast}
155
- label="Cast"
156
- onChange={(e) =>
157
- setCast(e.currentTarget.value as unknown as string[])
158
- }
159
- />
160
- <CustomTags
161
- name="directors"
162
- value={directors}
163
- label="Director(s)"
164
- onChange={(e) =>
165
- setDirectors(e.currentTarget.value as unknown as string[])
166
- }
167
- />
168
- <Tags
169
- name="locales"
170
- value={locales}
171
- label="Locale(s)"
172
- tagsOptions={['en_US', 'pt_PT', 'zh_CN']}
173
- onChange={(e) =>
174
- setLocales(e.currentTarget.value as unknown as string[])
175
- }
176
- />
177
- <DynamicDataListControl
178
- name={'dataList'}
179
- label={'Subtitles'}
180
- columns={dataListColumns}
181
- value={dataList}
182
- positionPropertyName={'position'}
183
- allowReordering={true}
184
- allowRowDragging={true}
185
- allowNewData={true}
186
- onChange={(e) => setDataList(e as DynamicListStoryData[])}
187
- />
188
- <ReadOnlyField
189
- label="Created At"
190
- value={createdTime.toISOString()}
191
- transform={formatDateTime}
192
- />
193
- <ReadOnlyField label="Writer(s)" value={writers} />
194
- </form>
118
+ <>
119
+ <div style={{ marginBottom: 10 }}>
120
+ <TextButton
121
+ onButtonClicked={() => setDisabled(!disabled)}
122
+ text="Toggle Disabled"
123
+ />
124
+ </div>
125
+ <Divider />
126
+ <form
127
+ style={{
128
+ display: 'grid',
129
+ gridAutoRows: 'max-content',
130
+ gridTemplateColumns: '1fr',
131
+ rowGap: '20px',
132
+ }}
133
+ >
134
+ <ReadOnlyField label="Id" value={id} />
135
+ <SingleLineText
136
+ name="title"
137
+ label="Title"
138
+ value={title}
139
+ disabled={disabled}
140
+ onChange={(e) => setTitle(e.currentTarget.value)}
141
+ />
142
+ <ReadOnlyField label="Publish State" value="PUBLISHED" />
143
+ <BooleanViewField
144
+ label="Status"
145
+ value={status}
146
+ trueLabel="Enabled"
147
+ falseLabel="Disabled"
148
+ />
149
+ <Tags
150
+ name="genres"
151
+ label="Genre(s)"
152
+ value={genres}
153
+ tagsOptions={genresOptions}
154
+ onChange={(e) =>
155
+ setGenres(e.currentTarget.value as unknown as string[])
156
+ }
157
+ disabled={disabled}
158
+ />
159
+ <Select
160
+ name="ratings"
161
+ label="Rating"
162
+ value={ratings}
163
+ options={selectOptions}
164
+ onChange={(e) => setRatings(e.currentTarget.value)}
165
+ disabled={disabled}
166
+ />
167
+ <SingleLineText
168
+ name="shortDescription"
169
+ label="Short Description"
170
+ value={shortDescription}
171
+ placeholder="Enter a short description..."
172
+ onChange={(e) => setShortDescription(e.currentTarget.value)}
173
+ disabled={disabled}
174
+ />
175
+ <TextArea
176
+ name="longDescription"
177
+ label="Long Description"
178
+ value={longDescription}
179
+ placeholder="Enter a description..."
180
+ onChange={(e) => setLongDescription(e.currentTarget.value)}
181
+ disabled={disabled}
182
+ />
183
+ <CustomTags
184
+ name="cast"
185
+ value={cast}
186
+ label="Cast"
187
+ onChange={(e) =>
188
+ setCast(e.currentTarget.value as unknown as string[])
189
+ }
190
+ disabled={disabled}
191
+ />
192
+ <CustomTags
193
+ name="directors"
194
+ value={directors}
195
+ label="Director(s)"
196
+ onChange={(e) =>
197
+ setDirectors(e.currentTarget.value as unknown as string[])
198
+ }
199
+ disabled={disabled}
200
+ />
201
+ <Tags
202
+ name="locales"
203
+ value={locales}
204
+ label="Locale(s)"
205
+ tagsOptions={['en_US', 'pt_PT', 'zh_CN']}
206
+ onChange={(e) =>
207
+ setLocales(e.currentTarget.value as unknown as string[])
208
+ }
209
+ disabled={disabled}
210
+ />
211
+ <DynamicDataListControl
212
+ name={'dataList'}
213
+ label={'Subtitles'}
214
+ columns={dataListColumns}
215
+ value={dataList}
216
+ positionPropertyName={'position'}
217
+ allowReordering={true}
218
+ allowRowDragging={true}
219
+ allowNewData={true}
220
+ onChange={(e) => setDataList(e as DynamicListStoryData[])}
221
+ disabled={disabled}
222
+ />
223
+
224
+ <Radio
225
+ value={radio}
226
+ onChange={(e) => setRadio(Number(e.currentTarget.value))}
227
+ options={[
228
+ { value: 1, label: 'A' },
229
+ { value: 2, label: 'B' },
230
+ { value: 3, label: 'C' },
231
+ ]}
232
+ name={'radio'}
233
+ label={'Category'}
234
+ disabled={disabled}
235
+ />
236
+
237
+ <Checkbox
238
+ value={check}
239
+ onChange={setCheck}
240
+ name={'check'}
241
+ label={'Is Premium?'}
242
+ disabled={disabled}
243
+ />
244
+
245
+ <FileUploadControl
246
+ name={'file'}
247
+ value={file}
248
+ onFileSelected={(file) => setFile(file)}
249
+ placeholder={'Select a file'}
250
+ label={'File'}
251
+ disabled={disabled}
252
+ />
253
+ <ReadOnlyField
254
+ label="Created At"
255
+ value={createdTime.toISOString()}
256
+ transform={formatDateTime}
257
+ />
258
+ <ReadOnlyField label="Writer(s)" value={writers} />
259
+ </form>
260
+ </>
195
261
  ),
196
262
  title,
197
263
  };
@@ -5,7 +5,7 @@ import { act } from 'react-dom/test-utils';
5
5
  import { MemoryRouter, Route } from 'react-router-dom';
6
6
  import * as Yup from 'yup';
7
7
  import { noop } from '../../helpers/utils';
8
- import { hideSaveIndicator, showSaveIndicator } from '../../initialize';
8
+ import { IndicatorType, setSaveIndicator } from '../../initialize';
9
9
  import { ActionData, Actions } from '../Actions';
10
10
  import { Action } from '../Actions/Action';
11
11
  import { MessageBar } from '../MessageBar/MessageBar';
@@ -675,6 +675,11 @@ describe('Details', () => {
675
675
  </FormStation>
676
676
  </MemoryRouter>,
677
677
  );
678
+ expect(setSaveIndicator).toHaveBeenNthCalledWith(
679
+ 1,
680
+ IndicatorType.Inactive,
681
+ ); // 1. inactive 2. dirty
682
+ expect(setSaveIndicator).toHaveBeenNthCalledWith(2, IndicatorType.Dirty); // 1. inactive 2. dirty
678
683
 
679
684
  // submit form
680
685
  const actionSelected = wrapper
@@ -692,7 +697,7 @@ describe('Details', () => {
692
697
 
693
698
  wrapper.update();
694
699
 
695
- expect(showSaveIndicator).toHaveBeenCalledTimes(1);
700
+ expect(setSaveIndicator).toHaveBeenNthCalledWith(3, IndicatorType.Saving);
696
701
 
697
702
  // complete form submission
698
703
  await act(async () => {
@@ -700,7 +705,12 @@ describe('Details', () => {
700
705
  });
701
706
  wrapper.update();
702
707
 
703
- expect(hideSaveIndicator).toHaveBeenCalledTimes(1);
708
+ expect(setSaveIndicator).toHaveBeenNthCalledWith(
709
+ 4,
710
+ IndicatorType.Inactive,
711
+ );
712
+
713
+ console.warn((setSaveIndicator as jest.Mock).mock.calls);
704
714
  });
705
715
  });
706
716
  });
@@ -16,7 +16,7 @@ import React, {
16
16
  } from 'react';
17
17
  import { useHistory } from 'react-router-dom';
18
18
  import { OptionalObjectSchema } from 'yup/lib/object';
19
- import { hideSaveIndicator, showSaveIndicator } from '../../initialize';
19
+ import { IndicatorType, setSaveIndicator } from '../../initialize';
20
20
  import { Data } from '../../types/data';
21
21
  import { ErrorTypeToStationError } from '../../utils/ErrorTypeToStationError';
22
22
  import { Actions, ActionsProps } from '../Actions';
@@ -155,7 +155,7 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
155
155
 
156
156
  try {
157
157
  setIsFormSubmitting(true);
158
- showSaveIndicator();
158
+ setSaveIndicator(IndicatorType.Saving);
159
159
  setStationError(undefined);
160
160
  if (!initialData.loading && saveData) {
161
161
  const response = await saveData(values, initialData, formikHelpers);
@@ -171,13 +171,14 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
171
171
  ),
172
172
  );
173
173
 
174
+ setSaveIndicator(IndicatorType.Dirty);
175
+
174
176
  // We still throw the error, to make sure that navigation or action execution
175
177
  // will not continue after a failed save.
176
178
  throw error;
177
179
  } finally {
178
180
  formikHelpers.setSubmitting(false);
179
181
  setIsFormSubmitting(false);
180
- hideSaveIndicator();
181
182
  }
182
183
  },
183
184
  [isFormSubmitting, initialData, saveData, setStationError],
@@ -445,6 +446,15 @@ const FormStationHeader: React.FC<
445
446
  > = ({ titleProperty, defaultTitle, subtitle, cancelNavigationUrl }) => {
446
447
  const { dirty, resetForm, values } = useFormikContext<FormikValues>();
447
448
 
449
+ useEffect(() => {
450
+ // Set the save indicator to dirty depending on the form state
451
+ if (dirty) {
452
+ setSaveIndicator(IndicatorType.Dirty);
453
+ } else {
454
+ setSaveIndicator(IndicatorType.Inactive);
455
+ }
456
+ }, [dirty]);
457
+
448
458
  const history = useHistory();
449
459
 
450
460
  const title =
@@ -9,10 +9,15 @@
9
9
 
10
10
  place-items: center;
11
11
 
12
+ .image,
12
13
  .inlineMenu {
13
- position: absolute;
14
- bottom: 0;
15
- right: 0;
14
+ grid-row: 1;
15
+ grid-column: 1;
16
+ align-self: end;
17
+ }
18
+
19
+ .inlineMenu {
20
+ justify-self: end;
16
21
  }
17
22
 
18
23
  img {
@@ -36,6 +36,7 @@ export const InfoImage: React.FC<InfoImageProps> = ({
36
36
  data-test-id="info-image"
37
37
  >
38
38
  <ImageLoader
39
+ imageClassName={classes.image}
39
40
  imgSrc={imgSrc}
40
41
  height={420}
41
42
  width={419} /*1px border*/
@@ -320,7 +320,9 @@ export const List = <T extends Data>({
320
320
  horizontalTextAlign={horizontalTextAlign}
321
321
  verticalTextAlign={verticalTextAlign}
322
322
  showItemCheckbox={
323
- enableSelectAll && selectionMode === ListSelectMode.Multi
323
+ enableSelectAll &&
324
+ selectionMode === ListSelectMode.Multi &&
325
+ listItems.length > 0
324
326
  }
325
327
  isCheckboxDisabled={listItems.length === 0}
326
328
  onCheckboxToggled={headerCheckboxHandler}
@@ -9,8 +9,13 @@
9
9
 
10
10
  .disabled {
11
11
  background-color: var(
12
- --page-header-action-context-background-color,
13
- $page-header-action-context-background-color
14
- ) !important;
12
+ --actions-disabled-bg-color,
13
+ $actions-disabled-bg-color
14
+ );
15
+
16
+ // background-color: var(
17
+ // --page-header-action-context-background-color,
18
+ // $page-header-action-context-background-color
19
+ // ) !important;
15
20
  }
16
21
  }
@@ -30,10 +30,6 @@
30
30
  }
31
31
  }
32
32
 
33
- &.disabled {
34
- cursor: not-allowed;
35
- }
36
-
37
33
  .cell {
38
34
  white-space: nowrap;
39
35
  text-overflow: ellipsis;
@@ -1,29 +1,35 @@
1
1
  @import '../../../styles/common.scss';
2
2
 
3
3
  .container {
4
- @include boxSizing;
5
-
6
- width: 50px;
7
- height: 50px;
8
4
  display: grid;
9
- grid-template-columns: 1fr;
10
- grid-template-rows: 1fr;
11
- place-items: center;
12
- }
5
+ grid: 1fr / 1fr;
13
6
 
14
- .fallback {
15
- background-color: var(--fallback-image-bg-color, $fallback-image-bg-color);
16
- }
7
+ .loader {
8
+ @include boxSizing;
17
9
 
18
- .fallBackImage {
19
- height: 50px;
20
- width: 50px;
21
- align-self: center;
22
- }
10
+ width: 50px;
11
+ height: 50px;
12
+ display: grid;
13
+ grid: 1fr / 1fr;
14
+ place-items: center;
15
+ }
16
+
17
+ .imageContainer {
18
+ display: grid;
19
+ grid: 1fr / 1fr;
20
+ place-items: center;
21
+
22
+ .fallback {
23
+ background-color: var(
24
+ --fallback-image-bg-color,
25
+ $fallback-image-bg-color
26
+ );
27
+ }
23
28
 
24
- .imageContainer {
25
- position: relative;
26
- display: flex;
27
- height: 100%;
28
- width: fit-content;
29
+ .fallBackImage {
30
+ height: 50px;
31
+ width: 50px;
32
+ align-self: center;
33
+ }
34
+ }
29
35
  }
@@ -99,7 +99,7 @@ describe('ImageLoader', () => {
99
99
 
100
100
  const loader = wrapper.find(ContentLoader);
101
101
  const imgDisplay = wrapper.find('img').prop('style')?.display;
102
- const fallbackContainer = wrapper.find('.container');
102
+ const fallbackContainer = wrapper.find('.container').at(1);
103
103
 
104
104
  expect(loader.exists()).toBe(false);
105
105
  expect(imgDisplay).toBe('none');
@@ -116,7 +116,7 @@ describe('ImageLoader', () => {
116
116
 
117
117
  const loader = wrapper.find(ContentLoader);
118
118
  const images = wrapper.find('img');
119
- const fallbackContainer = wrapper.find('.container');
119
+ const fallbackContainer = wrapper.find('.container').at(1);
120
120
 
121
121
  expect(loader.exists()).toBe(false);
122
122
  expect(images.at(0).prop('style')?.display).toBe('none'); // hidden failed image
@@ -198,12 +198,10 @@ describe('ImageLoader', () => {
198
198
  it(`loader dimensions defaults to '50px' by '50px'`, () => {
199
199
  const wrapper = shallow(<ImageLoader imgSrc="" />);
200
200
 
201
- const container = wrapper
202
- .find('.container')
203
- .prop('style') as React.CSSProperties;
201
+ const loader = wrapper.find('.loader').prop('style') as React.CSSProperties;
204
202
 
205
- expect(container.height).toBe('50px');
206
- expect(container.width).toBe('50px');
203
+ expect(loader.height).toBe('50px');
204
+ expect(loader.width).toBe('50px');
207
205
  });
208
206
 
209
207
  it('sets the height and width of the loader', () => {
@@ -213,11 +211,9 @@ describe('ImageLoader', () => {
213
211
  <ImageLoader imgSrc="" height={mockHeight} width={mockWidth} />,
214
212
  );
215
213
 
216
- const container = wrapper
217
- .find('.container')
218
- .prop('style') as React.CSSProperties;
214
+ const loader = wrapper.find('.loader').prop('style') as React.CSSProperties;
219
215
 
220
- expect(container.height).toBe(`${mockHeight}px`);
221
- expect(container.width).toBe(`${mockWidth}px`);
216
+ expect(loader.height).toBe(`${mockHeight}px`);
217
+ expect(loader.width).toBe(`${mockWidth}px`);
222
218
  });
223
219
  });
@@ -40,6 +40,9 @@ export interface ImageLoaderProps {
40
40
  onImageClick?: (
41
41
  event: React.MouseEvent<HTMLImageElement, MouseEvent>,
42
42
  ) => void;
43
+
44
+ /** CSS Class name for additional img element styles */
45
+ imageClassName?: string;
43
46
  }
44
47
 
45
48
  /**
@@ -65,6 +68,7 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
65
68
  onError = noop,
66
69
  onImageClick = noop,
67
70
  children,
71
+ imageClassName = '',
68
72
  }) => {
69
73
  const actualViewBox = viewBox || `0 0 ${width} ${height}`;
70
74
 
@@ -106,9 +110,9 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
106
110
  }, [imgSrc, onError]);
107
111
 
108
112
  return (
109
- <>
113
+ <div className={classes.container}>
110
114
  {isLoading && (
111
- <div className={classes.container} style={customStyles}>
115
+ <div className={classes.loader} style={customStyles}>
112
116
  <ContentLoader
113
117
  speed={speed}
114
118
  backgroundColor={backgroundColor}
@@ -135,6 +139,7 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
135
139
  onError={onErrorHandler}
136
140
  onClick={onImageClick}
137
141
  data-test-id="image-loader-img"
142
+ className={imageClassName}
138
143
  />
139
144
  {fallBack &&
140
145
  (!fallbackSrc ? (
@@ -153,6 +158,6 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
153
158
  {!isLoading && !fallBack && children}
154
159
  </div>
155
160
  )}
156
- </>
161
+ </div>
157
162
  );
158
163
  };
@@ -5,14 +5,6 @@ import { ConfirmAction, DefaultHandler, LinkAction } from '../../models';
5
5
  export enum PageHeaderActionType {
6
6
  Active,
7
7
  Context,
8
- /**
9
- * @deprecated This value is no longer necessary for navigation type actions in the
10
- * `PageHeaderAction` component, and will be removed in the future.
11
- * To create a navigation link, use the `path` property instead of the `onClick` handler,
12
- * which will automatically generate an anchor element.
13
- * @note This deprecation only affects the `Navigation` enum value in the PageHeaderActionType
14
- */
15
- Navigation,
16
8
  }
17
9
 
18
10
  export type PageHeaderActionProps =
@@ -27,8 +19,6 @@ export interface PageHeaderJsActionProps
27
19
  /**
28
20
  * Whether the action is an 'Active' or 'Context' type.
29
21
  * Changes the background color to the corresponding action type. (default: 'Context')
30
- * Type `Navigation` is deprecated and will be removed in the future
31
- * define instead of `onClick` handler `path` property to render element with anchor tag
32
22
  */
33
23
  actionType?: PageHeaderActionType;
34
24
  }
@@ -145,7 +145,6 @@
145
145
  --actions-disabled-bg-color,
146
146
  $actions-disabled-bg-color
147
147
  );
148
- cursor: not-allowed;
149
148
 
150
149
  .pageHeaderActionsIcons {
151
150
  polygon,
@@ -25,6 +25,11 @@ const meta: Meta<typeof PageHeaderAction> = {
25
25
  },
26
26
  options: iconOptions,
27
27
  },
28
+ path: {
29
+ control: {
30
+ type: 'text',
31
+ },
32
+ },
28
33
  },
29
34
  decorators: [
30
35
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -19,8 +19,8 @@ export * from './List';
19
19
  export * from './Loaders';
20
20
  export * from './MessageBar';
21
21
  export * from './Modal';
22
- export * from './models';
23
22
  export * from './NavigationAwareStation';
24
23
  export * from './PageHeader';
25
24
  export * from './ProgressBar';
26
25
  export * from './Utils';
26
+ export * from './models';