@abgov/jsonforms-components 1.17.2 → 1.18.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.
package/index.esm.js CHANGED
@@ -2948,7 +2948,8 @@ const GoAInputBaseControl = props => {
2948
2948
  label,
2949
2949
  input,
2950
2950
  required,
2951
- errors
2951
+ errors,
2952
+ path
2952
2953
  } = props;
2953
2954
  const InnerComponent = input;
2954
2955
  const labelToUpdate = getLabelText(uischema.scope, label || '');
@@ -2985,6 +2986,7 @@ const GoAInputBaseControl = props => {
2985
2986
  children: jsx(GoAFormItem, {
2986
2987
  requirement: required ? 'required' : undefined,
2987
2988
  error: '',
2989
+ testId: `${path}`,
2988
2990
  label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
2989
2991
  helpText: typeof ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) === 'string' ? (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help : '',
2990
2992
  children: jsx(InnerComponent, Object.assign({}, modifiedProps))
@@ -3166,12 +3168,15 @@ const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput
3166
3168
 
3167
3169
  // Used locally for callout presentation
3168
3170
  const callout = props => {
3171
+ var _a;
3169
3172
  const componentProps = Object.assign({
3170
3173
  size: 'medium',
3171
3174
  type: 'emergency',
3172
3175
  message: 'unknown'
3173
3176
  }, props);
3177
+ const testid = (_a = componentProps.message) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '');
3174
3178
  return jsx(GoACallout, Object.assign({}, componentProps, {
3179
+ "data-testid": testid,
3175
3180
  children: componentProps.message
3176
3181
  }));
3177
3182
  };
@@ -4606,9 +4611,15 @@ const getFormFieldValue = (scope, data) => {
4606
4611
  value: flatten(objToArray(currentValue))
4607
4612
  } : {
4608
4613
  type: 'primitive',
4609
- value: currentValue
4614
+ value: getValue(currentValue)
4610
4615
  };
4611
4616
  };
4617
+ const getValue = currentValue => {
4618
+ if (typeof currentValue === 'boolean') {
4619
+ return currentValue ? 'Yes' : 'No';
4620
+ }
4621
+ return currentValue ? String(currentValue) : undefined;
4622
+ };
4612
4623
 
4613
4624
  const renderValue = (label, key,
4614
4625
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -4951,7 +4962,7 @@ const FormStepper = props => {
4951
4962
  })]
4952
4963
  }), jsx(Grid, {
4953
4964
  children: jsx(RenderFormReviewFields, {
4954
- elements: category.elements,
4965
+ elements: category === null || category === void 0 ? void 0 : category.elements,
4955
4966
  data: data,
4956
4967
  requiredFields: requiredFields
4957
4968
  })
@@ -4960,7 +4971,7 @@ const FormStepper = props => {
4960
4971
  })
4961
4972
  })]
4962
4973
  })]
4963
- }), step && step !== 0 && jsxs(GoAGrid, {
4974
+ }), step !== 0 && jsxs(GoAGrid, {
4964
4975
  minChildWidth: "100px",
4965
4976
  children: [jsx("div", {
4966
4977
  children: step !== 1 ? jsx(GoAButton, {
@@ -5856,6 +5867,7 @@ const HelpContentComponent = _a => {
5856
5867
  className: marginClass,
5857
5868
  children: [label && !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) && ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && jsxs("div", {
5858
5869
  className: labelClass,
5870
+ "data-testid": label,
5859
5871
  children: [label, jsx("br", {})]
5860
5872
  }), (!((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) || ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.variant) !== 'details') && renderHelp(), ((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) && ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'details' && jsxs(GoADetails, {
5861
5873
  heading: label ? label : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.17.2",
3
+ "version": "1.18.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -3,7 +3,7 @@ type jsonformsLabel = string | boolean | LabelDescription | undefined;
3
3
  export declare const labelToString: (label: jsonformsLabel, scope: string) => string;
4
4
  export interface InputValue {
5
5
  type: 'primitive' | 'object';
6
- value?: string[][];
6
+ value?: string | string[][];
7
7
  }
8
8
  export declare const getFormFieldValue: (scope: string, data: unknown) => InputValue;
9
9
  export {};