@sphereon/ui-components.ssi-react 0.4.1-next.12 → 0.4.1-next.14

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.
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import { elementColors, fontColors, Localization } from '@sphereon/ui-components.core';
3
4
  import StepMarker from '../../assets/markers/StepMarker';
4
5
  import { gradientColors } from '../../../styles/colors';
@@ -7,7 +8,7 @@ import { StepStatus } from '../../../types';
7
8
  const getStepRowElement = (stepNumber, status, step, maxSteps) => {
8
9
  const { title, description, required = true } = step;
9
10
  const gridRowNumber = stepNumber * 2 - 1;
10
- return (_jsxs(_Fragment, { children: [_jsxs(StepMarkerCell, { style: { gridRow: gridRowNumber }, children: [_jsx(StepMarker, { stepNumber: stepNumber, status: status }), stepNumber < maxSteps && (_jsx(StepLine, { style: {
11
+ return (_jsxs(Fragment, { children: [_jsxs(StepMarkerCell, { style: { gridRow: gridRowNumber }, children: [_jsx(StepMarker, { stepNumber: stepNumber, status: status }), stepNumber < maxSteps && (_jsx(StepLine, { style: {
11
12
  ...(status === StepStatus.COMPLETED && {
12
13
  backgroundColor: elementColors.purple,
13
14
  }),
@@ -24,7 +25,7 @@ const getStepRowElement = (stepNumber, status, step, maxSteps) => {
24
25
  ...(status === StepStatus.COMPLETED && {
25
26
  backgroundColor: elementColors.purple,
26
27
  }),
27
- } }) }))] }));
28
+ } }) }))] }, stepNumber));
28
29
  };
29
30
  const getStepStatus = (stepNumber, activeStep) => {
30
31
  if (stepNumber < activeStep) {
@@ -14,7 +14,7 @@ const initializeDefaultValues = (schema, currentData = {}) => {
14
14
  if (property.const && (!(key in result) || !result[key])) {
15
15
  result[key] = property.const;
16
16
  }
17
- if (property.default && (!(key in result) || !result[key])) {
17
+ if (property.default !== undefined && !(key in result)) {
18
18
  if (property.format?.startsWith('date') || property.format?.startsWith('time')) {
19
19
  result[key] = formatDateToISO(property.default, property.format);
20
20
  }
@@ -35,11 +35,16 @@ const initializeDefaultValues = (schema, currentData = {}) => {
35
35
  const FormView = (props) => {
36
36
  const { data, schema, uiSchema, validationMode = 'ValidateAndShow', renderers = jsonFormsMaterialRenderers, cells = materialCells, style, middleware, ajv, onFormStateChange, readonly = false, config, } = props;
37
37
  const [formData, setFormData] = useState(data ?? {});
38
+ const [initialized, setInitialized] = useState(false);
38
39
  useEffect(() => {
39
40
  const initializedData = initializeDefaultValues(schema, formData);
40
41
  setFormData(initializedData);
42
+ setInitialized(true);
41
43
  }, [schema]);
42
44
  const onFormStateChanged = (state) => {
45
+ if (!initialized) {
46
+ return;
47
+ }
43
48
  setFormData(state.data);
44
49
  void onFormStateChange?.(state);
45
50
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ui-components.ssi-react",
3
3
  "private": false,
4
- "version": "0.4.1-next.12+d938de1",
4
+ "version": "0.4.1-next.14+058ed44",
5
5
  "description": "SSI UI components for React",
6
6
  "repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
7
7
  "author": "Sphereon <dev@sphereon.com>",
@@ -49,7 +49,7 @@
49
49
  "@mui/system": "^5.15.12",
50
50
  "@mui/x-date-pickers": "^6.19.5",
51
51
  "@sphereon/ssi-sdk.data-store": "^0.33",
52
- "@sphereon/ui-components.core": "0.4.1-next.12+d938de1",
52
+ "@sphereon/ui-components.core": "0.4.1-next.14+058ed44",
53
53
  "@tanstack/react-table": "^8.9.3",
54
54
  "react-json-tree": "^0.18.0",
55
55
  "react-loader-spinner": "5.4.5",
@@ -68,5 +68,5 @@
68
68
  "peerDependencies": {
69
69
  "react": ">= 18"
70
70
  },
71
- "gitHead": "d938de1eba7a040ecde24cab23ad428711f707d8"
71
+ "gitHead": "058ed44f059a5a204b34c967d3dda6e7b869d106"
72
72
  }