@axinom/mosaic-ui 0.39.1-feat-gs.3 → 0.40.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/components/FormStation/Create/Create.d.ts +1 -1
  2. package/dist/components/FormStation/Create/Create.d.ts.map +1 -1
  3. package/dist/components/FormStation/Details/Details.d.ts +2 -2
  4. package/dist/components/FormStation/Details/Details.d.ts.map +1 -1
  5. package/dist/components/FormStation/FormStation.d.ts +15 -8
  6. package/dist/components/FormStation/FormStation.d.ts.map +1 -1
  7. package/dist/components/FormStation/FormStation.models.d.ts +3 -17
  8. package/dist/components/FormStation/FormStation.models.d.ts.map +1 -1
  9. package/dist/components/FormStation/StationErrorStateType.d.ts +5 -0
  10. package/dist/components/FormStation/StationErrorStateType.d.ts.map +1 -0
  11. package/dist/components/FormStation/index.d.ts +1 -1
  12. package/dist/components/FormStation/index.d.ts.map +1 -1
  13. package/dist/components/FormStation/{helpers/useValidationError.d.ts → useValidationError.d.ts} +1 -1
  14. package/dist/components/FormStation/useValidationError.d.ts.map +1 -0
  15. package/dist/components/Utils/Postgraphile/getArrayDiff.d.ts.map +1 -1
  16. package/dist/components/Utils/Postgraphile/getFormDiff.d.ts.map +1 -1
  17. package/dist/helpers/testing.d.ts +1 -4
  18. package/dist/helpers/testing.d.ts.map +1 -1
  19. package/dist/index.es.js +4 -4
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/index.js +4 -4
  22. package/dist/index.js.map +1 -1
  23. package/package.json +4 -3
  24. package/src/components/Actions/Action/Action.scss +0 -1
  25. package/src/components/FormElements/Tags/Tags.tsx +3 -3
  26. package/src/components/FormStation/Create/Create.stories.tsx +9 -1
  27. package/src/components/FormStation/Create/Create.tsx +1 -4
  28. package/src/components/FormStation/Details/Details.tsx +2 -5
  29. package/src/components/FormStation/FormStation.models.ts +3 -29
  30. package/src/components/FormStation/FormStation.scss +70 -0
  31. package/src/components/FormStation/FormStation.spec.tsx +1 -2
  32. package/src/components/FormStation/FormStation.stories.tsx +1 -20
  33. package/src/components/FormStation/FormStation.tsx +403 -68
  34. package/src/components/FormStation/StationErrorStateType.tsx +5 -0
  35. package/src/components/FormStation/index.ts +5 -1
  36. package/src/components/FormStation/{helpers/useValidationError.tsx → useValidationError.tsx} +1 -1
  37. package/src/components/Utils/Postgraphile/getArrayDiff.ts +6 -7
  38. package/src/components/Utils/Postgraphile/getFormDiff.ts +1 -2
  39. package/dist/components/FormStation/FormContentWrapper/FormContentWrapper.d.ts +0 -11
  40. package/dist/components/FormStation/FormContentWrapper/FormContentWrapper.d.ts.map +0 -1
  41. package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts +0 -21
  42. package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts.map +0 -1
  43. package/dist/components/FormStation/FormStationContext/FormStationContext.d.ts +0 -13
  44. package/dist/components/FormStation/FormStationContext/FormStationContext.d.ts.map +0 -1
  45. package/dist/components/FormStation/FormStationContext/FormStationContextProvider.d.ts +0 -10
  46. package/dist/components/FormStation/FormStationContext/FormStationContextProvider.d.ts.map +0 -1
  47. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts +0 -12
  48. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +0 -1
  49. package/dist/components/FormStation/helpers/mergeData.d.ts +0 -7
  50. package/dist/components/FormStation/helpers/mergeData.d.ts.map +0 -1
  51. package/dist/components/FormStation/helpers/useChangeSets.d.ts +0 -12
  52. package/dist/components/FormStation/helpers/useChangeSets.d.ts.map +0 -1
  53. package/dist/components/FormStation/helpers/useDataProvider.d.ts +0 -14
  54. package/dist/components/FormStation/helpers/useDataProvider.d.ts.map +0 -1
  55. package/dist/components/FormStation/helpers/useDebouncedFormikValues.d.ts +0 -7
  56. package/dist/components/FormStation/helpers/useDebouncedFormikValues.d.ts.map +0 -1
  57. package/dist/components/FormStation/helpers/useUndo.d.ts +0 -6
  58. package/dist/components/FormStation/helpers/useUndo.d.ts.map +0 -1
  59. package/dist/components/FormStation/helpers/useValidationError.d.ts.map +0 -1
  60. package/src/components/FormStation/FormContentWrapper/FormContentWrapper.scss +0 -66
  61. package/src/components/FormStation/FormContentWrapper/FormContentWrapper.tsx +0 -77
  62. package/src/components/FormStation/FormStationActions/FormStationActions.tsx +0 -132
  63. package/src/components/FormStation/FormStationContext/FormStationContext.ts +0 -22
  64. package/src/components/FormStation/FormStationContext/FormStationContextProvider.tsx +0 -86
  65. package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +0 -85
  66. package/src/components/FormStation/helpers/mergeData.ts +0 -26
  67. package/src/components/FormStation/helpers/useChangeSets.ts +0 -70
  68. package/src/components/FormStation/helpers/useDataProvider.ts +0 -169
  69. package/src/components/FormStation/helpers/useDebouncedFormikValues.ts +0 -22
  70. package/src/components/FormStation/helpers/useUndo.ts +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.39.1-feat-gs.3",
3
+ "version": "0.40.0-rc.0",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -32,7 +32,7 @@
32
32
  "build-storybook": "storybook build"
33
33
  },
34
34
  "dependencies": {
35
- "@axinom/mosaic-core": "^0.4.12-rc.4",
35
+ "@axinom/mosaic-core": "^0.4.13-rc.0",
36
36
  "@faker-js/faker": "^7.4.0",
37
37
  "@popperjs/core": "^2.11.8",
38
38
  "clsx": "^1.1.0",
@@ -103,5 +103,6 @@
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public"
106
- }
106
+ },
107
+ "gitHead": "7e42eb287fb9e6dd04c88a1ca5955a164c0e3d46"
107
108
  }
@@ -76,7 +76,6 @@
76
76
  --page-header-action-disabled-bg-color,
77
77
  $page-header-action-disabled-bg-color
78
78
  );
79
- transition: background-color $confirmation-transition linear;
80
79
 
81
80
  pointer-events: none;
82
81
 
@@ -34,7 +34,7 @@ export interface TagsProps<T = string>
34
34
  export const Tags = <T,>({
35
35
  id,
36
36
  name,
37
- value,
37
+ value = [],
38
38
  dropDownLabel = '',
39
39
  tagsOptions = [],
40
40
  disabled = false,
@@ -48,14 +48,14 @@ export const Tags = <T,>({
48
48
  className = '',
49
49
  ...rest
50
50
  }: PropsWithChildren<TagsProps<T>>): JSX.Element => {
51
- const [currentTags, setCurrentTags] = useState<string[]>(value ?? []); // Current tags the user has selected
51
+ const [currentTags, setCurrentTags] = useState<string[]>(value); // Current tags the user has selected
52
52
 
53
53
  const [shouldAnimate, setShouldAnimate] = useState<boolean>(false);
54
54
 
55
55
  const ref = useRef<FormEvent<HTMLSelectElement>>();
56
56
 
57
57
  useEffect(() => {
58
- setCurrentTags(value ?? []);
58
+ setCurrentTags(value);
59
59
  }, [value]);
60
60
 
61
61
  const errorMsg: string | undefined = error;
@@ -13,7 +13,7 @@ import {
13
13
  TagsField,
14
14
  } from '../../FormElements';
15
15
  import { FileUploadField } from '../../FormElements/FileUploadControl/FileUploadField';
16
- import { ObjectSchemaDefinition } from '../FormStation.models';
16
+ import { ObjectSchemaDefinition } from '../FormStation';
17
17
  import { Create } from './Create';
18
18
 
19
19
  interface CreateValues {
@@ -120,6 +120,14 @@ export const Default: StoryObj<CreateStoryType> = {
120
120
  }),
121
121
  initialData: {
122
122
  loading: false,
123
+ data: {
124
+ title: '',
125
+ genres: [],
126
+ ratings: '',
127
+ shortDescription: '',
128
+ longDescription: '',
129
+ cast: [],
130
+ },
123
131
  },
124
132
  cancelNavigationUrl: '/',
125
133
  },
@@ -11,7 +11,6 @@ export type CreateProps<TValues extends Data, TSubmitResponse = unknown> = Omit<
11
11
  | 'defaultTitle'
12
12
  | 'titleProperty'
13
13
  | 'alwaysSubmitBeforeAction'
14
- | 'autosave'
15
14
  > & {
16
15
  /** The title of the station */
17
16
  title: string;
@@ -57,7 +56,7 @@ export const Create = <TValues extends Data, TSubmitResponse = unknown>(
57
56
  }
58
57
 
59
58
  return (
60
- <FormStation<TValues, TSubmitResponse>
59
+ <FormStation
61
60
  {...props}
62
61
  saveData={(values, initialData, formikHelpers) => {
63
62
  if (denyProceeding) {
@@ -66,7 +65,6 @@ export const Create = <TValues extends Data, TSubmitResponse = unknown>(
66
65
  'Unable to navigate away with pending changes still on the form.',
67
66
  };
68
67
  }
69
-
70
68
  return props.saveData(values, initialData, formikHelpers);
71
69
  }}
72
70
  defaultTitle={props.title}
@@ -78,7 +76,6 @@ export const Create = <TValues extends Data, TSubmitResponse = unknown>(
78
76
  },
79
77
  ]}
80
78
  alwaysSubmitBeforeAction={true}
81
- autosave={false}
82
79
  ></FormStation>
83
80
  );
84
81
  };
@@ -4,7 +4,7 @@ import { FormStation, FormStationProps } from '../FormStation';
4
4
 
5
5
  export type DetailsProps<
6
6
  TValues extends Data,
7
- TSubmitResponse = Partial<TValues>,
7
+ TSubmitResponse = unknown,
8
8
  > = Omit<
9
9
  FormStationProps<TValues, TSubmitResponse>,
10
10
  'cancelNavigationUrl' | 'alwaysSubmitBeforeAction'
@@ -23,10 +23,7 @@ export type DetailsProps<
23
23
  * In addition, it allows the definition of `actions`, which will be presented to the user in the appropriate panel.
24
24
  * The component uses the `onActionSelected` callback to notify the application when an action needs to be executed by the application.
25
25
  */
26
- export const Details = <
27
- TValues extends Data,
28
- TSubmitResponse = Partial<TValues>,
29
- >(
26
+ export const Details = <TValues extends Data, TSubmitResponse = unknown>(
30
27
  props: PropsWithChildren<DetailsProps<TValues, TSubmitResponse>>,
31
28
  ): JSX.Element => (
32
29
  <FormStation
@@ -1,7 +1,6 @@
1
- import type { FormikHelpers, FormikValues } from 'formik';
2
- import type { Data } from '../../types';
3
- import type { ActionData } from '../Actions';
4
- import type { ErrorType, StationError } from '../models';
1
+ import { FormikValues } from 'formik';
2
+ import { ActionData } from '../Actions';
3
+ import { ErrorType } from '../models';
5
4
 
6
5
  export interface InitialFormData<T> {
7
6
  /** Indicates whether the data is still loading or not */
@@ -23,15 +22,6 @@ export interface InitialFormData<T> {
23
22
  error?: ErrorType;
24
23
  }
25
24
 
26
- export type SaveDataFunction<TValues, TSubmitResponse> = (
27
- /** The current values of the form */
28
- values: TValues,
29
- /** The initial values of the form */
30
- initialData: InitialFormData<TValues>,
31
- /** The Formik state helpers */
32
- formikHelpers: FormikHelpers<TValues>,
33
- ) => Promise<TSubmitResponse | void> | void;
34
-
35
25
  /**
36
26
  * A function to handle an action execution on a FormStation.
37
27
  * If action can not be performed, an error can be thrown which will then be displayed by the FormStation.
@@ -50,19 +40,3 @@ export type FormActionData<
50
40
  TValues = FormikValues,
51
41
  TSubmitResponse = unknown,
52
42
  > = ActionData<ActionHandler<TValues, TSubmitResponse>>;
53
-
54
- export type ObjectSchemaDefinition<
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- T extends Data | null = any,
57
- > = {
58
- // TODO: Adding 'any' here since there are a couple of open issues regarding generics in the latest version of yup.
59
- // https://github.com/jquense/yup/issues/1159
60
- // https://github.com/jquense/yup/issues/1247
61
- // Consider revisiting once 'yup' has addressed these issues.
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- [field in keyof T]: any;
64
- };
65
-
66
- export interface StationErrorStateType extends StationError {
67
- type?: string;
68
- }
@@ -18,6 +18,71 @@
18
18
  grid-row: 1 / 2;
19
19
  }
20
20
 
21
+ // Extend all components, except PageHeader, to the bottom
22
+ // Enable scrolling children
23
+ .children {
24
+ grid-row: 2 / -1;
25
+ overflow-y: auto;
26
+ display: grid;
27
+ grid-template-columns: 1fr auto;
28
+
29
+ overflow: hidden;
30
+ overflow-x: auto;
31
+
32
+ .main {
33
+ display: grid;
34
+ grid: 1fr / minmax(740px, 1fr) auto;
35
+
36
+ overflow-y: auto;
37
+ scrollbar-width: thin; //for Firefox only
38
+
39
+ .formWrapper {
40
+ display: grid;
41
+ grid: 1fr / 1fr;
42
+
43
+ &.hasMessage {
44
+ grid: min-content 1fr / 1fr;
45
+ }
46
+ }
47
+ }
48
+
49
+ //Custom scrollbar for Chrome, Safari and Edge
50
+ ::-webkit-scrollbar {
51
+ width: var(--scrollbar-size, $scrollbar-size);
52
+ height: var(--scrollbar-size, $scrollbar-size);
53
+ }
54
+ ::-webkit-scrollbar-track {
55
+ background: var(--scrollbar-track-color, $scrollbar-track-color);
56
+ }
57
+
58
+ ::-webkit-scrollbar-thumb {
59
+ background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
60
+ }
61
+
62
+ ::-webkit-scrollbar-thumb:hover {
63
+ background: var(
64
+ --scrollbar-thumb-hover-color,
65
+ $scrollbar-thumb-hover-color
66
+ );
67
+ }
68
+
69
+ ::-webkit-scrollbar-corner {
70
+ background: var(--scrollbar-corner-color, $scrollbar-corner-color);
71
+ }
72
+
73
+ .formContainer {
74
+ overflow-x: hidden;
75
+ }
76
+
77
+ .paddedContent {
78
+ padding: 30px;
79
+ }
80
+
81
+ .loadingError {
82
+ display: grid;
83
+ grid: 1fr / 1fr;
84
+ }
85
+ }
21
86
  .actionsPanel {
22
87
  overflow: auto;
23
88
  }
@@ -39,6 +104,11 @@
39
104
  &.hasError {
40
105
  grid-template-rows: min-content min-content 1fr;
41
106
 
107
+ .errorMessage {
108
+ grid-row: 2 / 3;
109
+ grid-column: 1 / -1;
110
+ }
111
+
42
112
  .children {
43
113
  grid-row: 3 / 4;
44
114
  grid-column: 1 / 2;
@@ -10,8 +10,7 @@ import { ActionData, Actions } from '../Actions';
10
10
  import { Action } from '../Actions/Action';
11
11
  import { MessageBar } from '../MessageBar/MessageBar';
12
12
  import { PageHeader, PageHeaderAction } from '../PageHeader';
13
- import { FormStation } from './FormStation';
14
- import { ObjectSchemaDefinition } from './FormStation.models';
13
+ import { FormStation, ObjectSchemaDefinition } from './FormStation';
15
14
  import { SaveOnNavigate } from './SaveOnNavigate/SaveOnNavigate';
16
15
 
17
16
  jest.mock('../../initialize');
@@ -15,7 +15,6 @@ import {
15
15
  import {
16
16
  CustomTagsField,
17
17
  DateTimeTextField,
18
- FormikDebug,
19
18
  ReadOnlyField,
20
19
  SelectField,
21
20
  SingleLineTextField,
@@ -27,7 +26,7 @@ import { MaskedSingleLineTextField } from '../FormElements/MaskedSingleLineText/
27
26
  import { InfoPanel, Paragraph, Section } from '../InfoPanel';
28
27
  import { ErrorType } from '../models';
29
28
  import { Details, DetailsProps } from './Details/Details';
30
- import { ObjectSchemaDefinition } from './FormStation.models';
29
+ import { ObjectSchemaDefinition } from './FormStation';
31
30
 
32
31
  const groups = createGroups({
33
32
  Content: [
@@ -171,15 +170,6 @@ export const Extended: StoryObj<typeof Details> = (() => {
171
170
  list: listData,
172
171
  archived: false,
173
172
  timestamp: '00:00:00.001',
174
- userRoleTagAssignments: {
175
- __typename: 'UserRoleTagAssignmentsConnection',
176
- nodes: [
177
- {
178
- __typename: 'UserRoleTagAssignment',
179
- tag: 'Test',
180
- },
181
- ],
182
- },
183
173
  },
184
174
  },
185
175
  infoPanel: (
@@ -194,14 +184,6 @@ export const Extended: StoryObj<typeof Details> = (() => {
194
184
  </Section>
195
185
  </InfoPanel>
196
186
  ),
197
- saveData: (...args) => {
198
- action('saveData')(args);
199
- return new Promise<APIResponse>((resolve) => {
200
- setTimeout(() => {
201
- resolve({ status: 'ok' });
202
- }, 100);
203
- });
204
- },
205
187
  children: (
206
188
  <>
207
189
  <Field name="id" label="Id" as={ReadOnlyField} />
@@ -306,7 +288,6 @@ export const Extended: StoryObj<typeof Details> = (() => {
306
288
  mask="00:00:00.000"
307
289
  as={MaskedSingleLineTextField}
308
290
  />
309
- <FormikDebug />
310
291
  </>
311
292
  ),
312
293
  },