@axinom/mosaic-ui 0.43.0-rc.0 → 0.43.0-rc.1

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 (52) hide show
  1. package/dist/components/FormStation/FormGrid/FormGrid.d.ts +7 -0
  2. package/dist/components/FormStation/FormGrid/FormGrid.d.ts.map +1 -0
  3. package/dist/components/FormStation/FormGrid/index.d.ts +2 -0
  4. package/dist/components/FormStation/FormGrid/index.d.ts.map +1 -0
  5. package/dist/components/FormStation/FormStation.d.ts +3 -12
  6. package/dist/components/FormStation/FormStation.d.ts.map +1 -1
  7. package/dist/components/FormStation/FormStation.models.d.ts +16 -2
  8. package/dist/components/FormStation/FormStation.models.d.ts.map +1 -1
  9. package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts +21 -0
  10. package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts.map +1 -0
  11. package/dist/components/FormStation/FormStationActions/index.d.ts +2 -0
  12. package/dist/components/FormStation/FormStationActions/index.d.ts.map +1 -0
  13. package/dist/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.d.ts +11 -0
  14. package/dist/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.d.ts.map +1 -0
  15. package/dist/components/FormStation/FormStationContentWrapper/index.d.ts +2 -0
  16. package/dist/components/FormStation/FormStationContentWrapper/index.d.ts.map +1 -0
  17. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts +11 -0
  18. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -0
  19. package/dist/components/FormStation/FormStationHeader/index.d.ts +2 -0
  20. package/dist/components/FormStation/FormStationHeader/index.d.ts.map +1 -0
  21. package/dist/components/FormStation/helpers/useDataProvider.d.ts +14 -0
  22. package/dist/components/FormStation/helpers/useDataProvider.d.ts.map +1 -0
  23. package/dist/components/FormStation/{useValidationError.d.ts → helpers/useValidationError.d.ts} +1 -1
  24. package/dist/components/FormStation/helpers/useValidationError.d.ts.map +1 -0
  25. package/dist/components/FormStation/index.d.ts +2 -1
  26. package/dist/components/FormStation/index.d.ts.map +1 -1
  27. package/dist/index.es.js +4 -4
  28. package/dist/index.es.js.map +1 -1
  29. package/dist/index.js +4 -4
  30. package/dist/index.js.map +1 -1
  31. package/package.json +3 -3
  32. package/src/components/FormStation/FormGrid/FormGrid.scss +10 -0
  33. package/src/components/FormStation/FormGrid/FormGrid.tsx +25 -0
  34. package/src/components/FormStation/FormGrid/index.ts +1 -0
  35. package/src/components/FormStation/FormStation.models.ts +28 -2
  36. package/src/components/FormStation/FormStation.scss +1 -117
  37. package/src/components/FormStation/FormStation.stories.tsx +4 -11
  38. package/src/components/FormStation/FormStation.tsx +39 -388
  39. package/src/components/FormStation/FormStationActions/FormStationActions.tsx +130 -0
  40. package/src/components/FormStation/FormStationActions/index.ts +1 -0
  41. package/src/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.scss +66 -0
  42. package/src/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.tsx +76 -0
  43. package/src/components/FormStation/FormStationContentWrapper/index.ts +1 -0
  44. package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +88 -0
  45. package/src/components/FormStation/FormStationHeader/index.ts +1 -0
  46. package/src/components/FormStation/helpers/useDataProvider.ts +124 -0
  47. package/src/components/FormStation/{useValidationError.tsx → helpers/useValidationError.tsx} +2 -1
  48. package/src/components/FormStation/index.ts +2 -5
  49. package/dist/components/FormStation/StationErrorStateType.d.ts +0 -5
  50. package/dist/components/FormStation/StationErrorStateType.d.ts.map +0 -1
  51. package/dist/components/FormStation/useValidationError.d.ts.map +0 -1
  52. package/src/components/FormStation/StationErrorStateType.tsx +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.43.0-rc.0",
3
+ "version": "0.43.0-rc.1",
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.16-rc.0",
35
+ "@axinom/mosaic-core": "^0.4.16-rc.1",
36
36
  "@faker-js/faker": "^7.4.0",
37
37
  "@popperjs/core": "^2.11.8",
38
38
  "clsx": "^1.1.0",
@@ -105,5 +105,5 @@
105
105
  "publishConfig": {
106
106
  "access": "public"
107
107
  },
108
- "gitHead": "b1b5a9a050664bc07d31401fec2b0f58b5c88f4b"
108
+ "gitHead": "efd204f4dc34b7717040a0105d2e148e8ad5ae17"
109
109
  }
@@ -0,0 +1,10 @@
1
+ .container {
2
+ padding: 30px;
3
+ }
4
+
5
+ .content {
6
+ display: grid;
7
+ grid-auto-rows: max-content;
8
+ grid-template-columns: 1fr;
9
+ row-gap: 20px;
10
+ }
@@ -0,0 +1,25 @@
1
+ import clsx from 'clsx';
2
+ import React from 'react';
3
+ import classes from './FormGrid.scss';
4
+
5
+ interface FormGridProps {
6
+ edgeToEdgeContent?: boolean;
7
+ }
8
+
9
+ export const FormGrid: React.FC<FormGridProps> = ({
10
+ children,
11
+ edgeToEdgeContent,
12
+ }) => {
13
+ return (
14
+ <div
15
+ className={clsx(
16
+ {
17
+ [classes.container]: !edgeToEdgeContent,
18
+ },
19
+ classes.content,
20
+ )}
21
+ >
22
+ {children}
23
+ </div>
24
+ );
25
+ };
@@ -0,0 +1 @@
1
+ export * from './FormGrid';
@@ -1,6 +1,7 @@
1
- import { FormikValues } from 'formik';
1
+ import { FormikHelpers, FormikValues } from 'formik';
2
+ import { Data } from '../../types';
2
3
  import { ActionData } from '../Actions';
3
- import { ErrorType } from '../models';
4
+ import { ErrorType, StationError } from '../models';
4
5
 
5
6
  export interface InitialFormData<T> {
6
7
  /** Indicates whether the data is still loading or not */
@@ -22,6 +23,15 @@ export interface InitialFormData<T> {
22
23
  error?: ErrorType;
23
24
  }
24
25
 
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;
34
+
25
35
  /**
26
36
  * A function to handle an action execution on a FormStation.
27
37
  * If action can not be performed, an error can be thrown which will then be displayed by the FormStation.
@@ -40,3 +50,19 @@ export type FormActionData<
40
50
  TValues = FormikValues,
41
51
  TSubmitResponse = unknown,
42
52
  > = 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
+ }
@@ -13,85 +13,15 @@
13
13
  background-color: var(--details-background-color, $details-background-color);
14
14
 
15
15
  // Place PageHeader at the top
16
- > div:first-child {
16
+ .header {
17
17
  grid-column: 1 / -1;
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
- }
86
21
  .actionsPanel {
87
22
  overflow: auto;
88
23
  }
89
24
 
90
- .children {
91
- grid-row: 2 / 3;
92
- grid-column: 1 / 2;
93
- }
94
-
95
25
  .actionsPanel {
96
26
  grid-row: 2 / 3;
97
27
  grid-column: 2 / 3;
@@ -104,55 +34,9 @@
104
34
  &.hasError {
105
35
  grid-template-rows: min-content min-content 1fr;
106
36
 
107
- .errorMessage {
108
- grid-row: 2 / 3;
109
- grid-column: 1 / -1;
110
- }
111
-
112
- .children {
113
- grid-row: 3 / 4;
114
- grid-column: 1 / 2;
115
- }
116
-
117
37
  .actionsPanel {
118
38
  grid-row: 3 / 4;
119
39
  grid-column: 2 / 3;
120
40
  }
121
41
  }
122
-
123
- form {
124
- display: grid;
125
- grid-auto-rows: max-content;
126
- grid-template-columns: 1fr;
127
- row-gap: 20px;
128
- }
129
- }
130
-
131
- .indicator {
132
- display: grid;
133
- grid-template-columns: auto 20px;
134
- font-weight: bold;
135
- color: var(--form-indicator-color, $form-indicator-color);
136
-
137
- &::after {
138
- overflow: hidden;
139
- display: inline-block;
140
- vertical-align: bottom;
141
- -webkit-animation: ellipsis steps(4, end) 900ms infinite;
142
- animation: ellipsis steps(4, end) 900ms infinite;
143
- content: '\2026'; /* ascii code for the ellipsis character */
144
- width: 0px;
145
- }
146
- }
147
-
148
- @keyframes ellipsis {
149
- to {
150
- width: 1.25em;
151
- }
152
- }
153
-
154
- @-webkit-keyframes ellipsis {
155
- to {
156
- width: 1.25em;
157
- }
158
42
  }
@@ -27,7 +27,8 @@ import { InfoPanel, Paragraph, Section } from '../InfoPanel';
27
27
  import { Tab, TabList, TabPanel, Tabs } from '../Tabs';
28
28
  import { ErrorType } from '../models';
29
29
  import { Details, DetailsProps } from './Details/Details';
30
- import { ObjectSchemaDefinition } from './FormStation';
30
+ import { FormGrid } from './FormGrid';
31
+ import { ObjectSchemaDefinition } from './FormStation.models';
31
32
 
32
33
  const groups = createGroups({
33
34
  Content: [
@@ -341,15 +342,7 @@ export const TabbedContent: StoryObj<typeof Details> = (() => {
341
342
  <Tab>Tab 2</Tab>
342
343
  </TabList>
343
344
  <TabPanel>
344
- <div
345
- style={{
346
- display: 'grid',
347
- gridAutoRows: 'max-content',
348
- rowGap: '20px',
349
- paddingTop: '20px',
350
- paddingBottom: '20px',
351
- }}
352
- >
345
+ <FormGrid>
353
346
  <Field name="id" label="Id" as={ReadOnlyField} />
354
347
  <Field name="title" label="Title" as={SingleLineTextField} />
355
348
  <Field
@@ -454,7 +447,7 @@ export const TabbedContent: StoryObj<typeof Details> = (() => {
454
447
  mask="00:00:00.000"
455
448
  as={MaskedSingleLineTextField}
456
449
  />
457
- </div>
450
+ </FormGrid>
458
451
  </TabPanel>
459
452
  <TabPanel>
460
453
  <h2>Tab 2</h2>