@abgov/jsonforms-components 2.6.6 → 2.6.8

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
@@ -6227,7 +6227,6 @@ const GoADateTimeInput = props => {
6227
6227
  uischema,
6228
6228
  isVisited,
6229
6229
  errors,
6230
- schema,
6231
6230
  label,
6232
6231
  setIsVisited
6233
6232
  } = props;
@@ -6344,7 +6343,6 @@ const EnumSelect = props => {
6344
6343
  path,
6345
6344
  handleChange,
6346
6345
  options,
6347
- config,
6348
6346
  label,
6349
6347
  uischema,
6350
6348
  required,
@@ -6418,7 +6416,6 @@ const RadioGroup = props => {
6418
6416
  var _a;
6419
6417
  const {
6420
6418
  data,
6421
- className,
6422
6419
  id,
6423
6420
  enabled,
6424
6421
  schema,
@@ -6428,7 +6425,6 @@ const RadioGroup = props => {
6428
6425
  options,
6429
6426
  config,
6430
6427
  label,
6431
- t,
6432
6428
  isVisited,
6433
6429
  errors
6434
6430
  } = props;
@@ -6513,7 +6509,6 @@ const GoABooleanControl = withJsonFormsControlProps(BooleanControl);
6513
6509
 
6514
6510
  const BooleanRadioComponent = ({
6515
6511
  data,
6516
- visible,
6517
6512
  enabled,
6518
6513
  uischema,
6519
6514
  handleChange,
@@ -6532,34 +6527,31 @@ const BooleanRadioComponent = ({
6532
6527
  const TrueDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForTrue);
6533
6528
  const FalseDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForFalse);
6534
6529
  const BaseTestId = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${path}-boolean-radio-jsonform`;
6535
- return jsx(Visible, {
6536
- visible: visible,
6537
- children: jsxs(GoARadioGroup, Object.assign({
6538
- error: isVisited && errors.length,
6539
- name: `${label}`,
6540
- value: data === true ? TrueValue : data === false ? FalseValue : null,
6541
- disabled: !enabled,
6542
- testId: BaseTestId,
6543
- onChange: (_name, value) => {
6544
- if (value === TrueValue) {
6545
- handleChange(path, true);
6546
- }
6547
- if (value === FalseValue) {
6548
- handleChange(path, false);
6549
- }
6530
+ return jsxs(GoARadioGroup, Object.assign({
6531
+ error: isVisited && errors.length,
6532
+ name: `${label}`,
6533
+ value: data === true ? TrueValue : data === false ? FalseValue : null,
6534
+ disabled: !enabled,
6535
+ testId: BaseTestId,
6536
+ onChange: (_name, value) => {
6537
+ if (value === TrueValue) {
6538
+ handleChange(path, true);
6550
6539
  }
6551
- }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
6552
- children: [jsx(GoARadioItem, {
6553
- value: TrueValue,
6554
- testId: `${BaseTestId}-yes-option`,
6555
- description: EnableDescription ? TrueDescription : null
6556
- }), jsx(GoARadioItem, {
6557
- value: FalseValue,
6558
- testId: `${BaseTestId}-no-option`,
6559
- description: EnableDescription ? FalseDescription : null
6560
- })]
6561
- }))
6562
- });
6540
+ if (value === FalseValue) {
6541
+ handleChange(path, false);
6542
+ }
6543
+ }
6544
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
6545
+ children: [jsx(GoARadioItem, {
6546
+ value: TrueValue,
6547
+ testId: `${BaseTestId}-yes-option`,
6548
+ description: EnableDescription ? TrueDescription : null
6549
+ }), jsx(GoARadioItem, {
6550
+ value: FalseValue,
6551
+ testId: `${BaseTestId}-no-option`,
6552
+ description: EnableDescription ? FalseDescription : null
6553
+ })]
6554
+ }));
6563
6555
  };
6564
6556
  const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
6565
6557
  input: BooleanRadioComponent
@@ -6602,8 +6594,7 @@ const CheckboxGroup = props => {
6602
6594
  handleChange,
6603
6595
  options,
6604
6596
  config,
6605
- label,
6606
- t
6597
+ label
6607
6598
  } = props;
6608
6599
  const newSchema = schema;
6609
6600
  const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || ((_a = newSchema === null || newSchema === void 0 ? void 0 : newSchema.items) === null || _a === void 0 ? void 0 : _a.enum) || [];
@@ -9983,14 +9974,15 @@ const ObjectArrayList = ({
9983
9974
  config,
9984
9975
  enabled,
9985
9976
  cells,
9986
- translations
9977
+ translations,
9978
+ currentTab,
9979
+ setCurrentTab
9987
9980
  }) => {
9988
9981
  const isEmptyList = data === 0;
9989
9982
  const rightRef = useRef(null);
9990
9983
  const current = rightRef.current;
9991
9984
  const minHeight = 300;
9992
9985
  const [rightHeight, setRightHeight] = useState(minHeight);
9993
- const [currentTab, setCurrentTab] = useState(0);
9994
9986
  useEffect(() => {
9995
9987
  const resizeObserver = new ResizeObserver(() => {
9996
9988
  if (rightHeight !== (current === null || current === void 0 ? void 0 : current.offsetHeight) && (current === null || current === void 0 ? void 0 : current.offsetHeight)) setRightHeight((current === null || current === void 0 ? void 0 : current.offsetHeight) > minHeight ? current === null || current === void 0 ? void 0 : current.offsetHeight : minHeight);
@@ -10063,8 +10055,14 @@ class ListWithDetailControl extends React.Component {
10063
10055
  const pathIdValue = (path === null || path === void 0 ? void 0 : path.split('.')) || '';
10064
10056
  if (pathIdValue.length > 1 && +this.props.data >= 0 || pathIdValue.length === 1) {
10065
10057
  this.props.addItem(path, value)();
10058
+ this.setState({
10059
+ currentTab: this.props.data + 1
10060
+ });
10066
10061
  }
10067
10062
  };
10063
+ this.state = {
10064
+ currentTab: 0
10065
+ };
10068
10066
  }
10069
10067
  render() {
10070
10068
  var _a;
@@ -10120,7 +10118,11 @@ class ListWithDetailControl extends React.Component {
10120
10118
  translations: translations,
10121
10119
  data: data,
10122
10120
  cells: cells,
10123
- config: config
10121
+ config: config,
10122
+ currentTab: this.state.currentTab,
10123
+ setCurrentTab: i => this.setState({
10124
+ currentTab: i
10125
+ })
10124
10126
  }, additionalProps))
10125
10127
  })]
10126
10128
  });
@@ -10802,7 +10804,7 @@ const AddressLookUpControl = props => {
10802
10804
  enabled,
10803
10805
  handleChange,
10804
10806
  uischema,
10805
- rootSchema
10807
+ visible
10806
10808
  } = props;
10807
10809
  const isAlbertaAddress = ((_b = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a.subdivisionCode) === null || _b === void 0 ? void 0 : _b.const) === 'AB';
10808
10810
  const formCtx = useContext(JsonFormContext);
@@ -10935,7 +10937,8 @@ const AddressLookUpControl = props => {
10935
10937
  }
10936
10938
  }, [activeIndex]);
10937
10939
  const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
10938
- return jsxs("div", {
10940
+ return jsxs(Visible, {
10941
+ visible: visible,
10939
10942
  children: [renderHelp(), jsx("h3", {
10940
10943
  children: label
10941
10944
  }), jsx(GoAFormItem, {
@@ -11337,7 +11340,8 @@ const FullNameControl = props => {
11337
11340
  path,
11338
11341
  schema,
11339
11342
  handleChange,
11340
- enabled
11343
+ enabled,
11344
+ visible
11341
11345
  } = props;
11342
11346
  const requiredFields = schema.required;
11343
11347
  const defaultName = {};
@@ -11353,14 +11357,17 @@ const FullNameControl = props => {
11353
11357
  setNameData(updatedName);
11354
11358
  updateFormData(updatedName);
11355
11359
  };
11356
- return jsx(NameInputs, {
11357
- firstName: nameData.firstName,
11358
- middleName: nameData.middleName,
11359
- lastName: nameData.lastName,
11360
- handleInputChange: handleInputChange,
11361
- data: data,
11362
- disabled: !enabled,
11363
- requiredFields: requiredFields
11360
+ return jsx(Visible, {
11361
+ visible: visible,
11362
+ children: jsx(NameInputs, {
11363
+ firstName: nameData.firstName,
11364
+ middleName: nameData.middleName,
11365
+ lastName: nameData.lastName,
11366
+ handleInputChange: handleInputChange,
11367
+ data: data,
11368
+ disabled: !enabled,
11369
+ requiredFields: requiredFields
11370
+ })
11364
11371
  });
11365
11372
  };
11366
11373
 
@@ -11444,7 +11451,8 @@ const FullNameDobControl = props => {
11444
11451
  path,
11445
11452
  schema,
11446
11453
  handleChange,
11447
- enabled
11454
+ enabled,
11455
+ visible
11448
11456
  } = props;
11449
11457
  const requiredFields = schema.required;
11450
11458
  const [errors, setErrors] = useState({});
@@ -11483,7 +11491,8 @@ const FullNameDobControl = props => {
11483
11491
  setErrors(err);
11484
11492
  };
11485
11493
  useSyncAutofillFields(['firstName', 'middleName', 'lastName', 'dateOfBirth'], formData, updateFormData, handleRequiredFieldBlur);
11486
- return jsxs(Fragment, {
11494
+ return jsxs(Visible, {
11495
+ visible: visible,
11487
11496
  children: [jsxs(GoAGrid, {
11488
11497
  minChildWidth: "0ch",
11489
11498
  gap: "s",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.6.6",
3
+ "version": "2.6.8",
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",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { RankedTester, ControlProps } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
- export declare const BooleanRadioComponent: ({ data, visible, enabled, uischema, handleChange, path, config, label, isVisited, errors, description, }: ControlProps & WithInputProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const BooleanRadioComponent: ({ data, enabled, uischema, handleChange, path, config, label, isVisited, errors, description, }: ControlProps & WithInputProps) => import("react/jsx-runtime").JSX.Element;
5
5
  export declare const BooleanRadioControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export declare const GoABooleanRadioControlTester: RankedTester;
7
7
  export declare const GoABooleanRadioControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -34,6 +34,9 @@ interface NonEmptyRowProps {
34
34
  export declare const NonEmptyList: React.MemoExoticComponent<({ childPath, schema, enabled, cells, uischema, }: NonEmptyRowProps & WithDeleteDialogSupport) => import("react/jsx-runtime").JSX.Element>;
35
35
  export declare class ListWithDetailControl extends React.Component<ObjectArrayControlProps, any> {
36
36
  addItem: (path: string, value: any) => void;
37
+ state: {
38
+ currentTab: number;
39
+ };
37
40
  render(): import("react/jsx-runtime").JSX.Element;
38
41
  }
39
42
  export {};