@abgov/jsonforms-components 1.49.0 → 1.50.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.
package/index.esm.js CHANGED
@@ -5805,6 +5805,10 @@ const stepperReducer = (state, action) => {
5805
5805
  } = state;
5806
5806
  const lastId = categories[categories.length - 1].id;
5807
5807
  switch (action.type) {
5808
+ case 'update/uischema':
5809
+ {
5810
+ return Object.assign({}, action.payload.state);
5811
+ }
5808
5812
  case 'page/next':
5809
5813
  {
5810
5814
  state.activeId += 1;
@@ -5998,6 +6002,16 @@ const JsonFormsStepperContextProvider = ({
5998
6002
  }
5999
6003
  };
6000
6004
  }, [ctx === null || ctx === void 0 ? void 0 : ctx.core, stepperDispatch, stepperState]);
6005
+ useEffect(() => {
6006
+ if ((context === null || context === void 0 ? void 0 : context.isProvided) === true) {
6007
+ stepperDispatch({
6008
+ type: 'update/uischema',
6009
+ payload: {
6010
+ state: createStepperContextInitData(StepperProps)
6011
+ }
6012
+ });
6013
+ }
6014
+ }, [StepperProps.uischema]);
6001
6015
  return jsx(JsonFormsStepperContext.Provider, {
6002
6016
  value: context,
6003
6017
  children: children
@@ -7867,7 +7881,8 @@ const AddressInputs = ({
7867
7881
  readOnly,
7868
7882
  errors,
7869
7883
  handleOnBlur,
7870
- requiredFields
7884
+ requiredFields,
7885
+ enabled
7871
7886
  }) => {
7872
7887
  var _a, _b;
7873
7888
  const provinces = [{
@@ -7916,7 +7931,7 @@ const AddressInputs = ({
7916
7931
  children: jsx(GoAInput, {
7917
7932
  name: "addressLine2",
7918
7933
  testId: "address-form-address2",
7919
- disabled: readOnly,
7934
+ disabled: !enabled,
7920
7935
  readonly: readOnly,
7921
7936
  ariaLabel: 'address-form-address2',
7922
7937
  placeholder: "Unit number, suite, apartment",
@@ -7935,7 +7950,7 @@ const AddressInputs = ({
7935
7950
  name: "municipality",
7936
7951
  testId: "address-form-city",
7937
7952
  ariaLabel: 'address-form-city',
7938
- disabled: readOnly,
7953
+ disabled: !enabled,
7939
7954
  readonly: readOnly,
7940
7955
  value: (address === null || address === void 0 ? void 0 : address.municipality) || '',
7941
7956
  onChange: (name, value) => handleInputChange(name, value),
@@ -7950,7 +7965,7 @@ const AddressInputs = ({
7950
7965
  name: "postalCode",
7951
7966
  testId: "address-form-postal-code",
7952
7967
  ariaLabel: 'address-form-postal-code',
7953
- disabled: readOnly,
7968
+ disabled: !enabled,
7954
7969
  readonly: readOnly,
7955
7970
  placeholder: "A0A 0A0",
7956
7971
  value: (address === null || address === void 0 ? void 0 : address.postalCode) || '',
@@ -7970,6 +7985,7 @@ const AddressInputs = ({
7970
7985
  children: "Alberta"
7971
7986
  }), !isAlbertaAddress && jsx(GoADropdown, {
7972
7987
  name: "subdivisionCode",
7988
+ disabled: !enabled,
7973
7989
  testId: "address-form-province-dropdown",
7974
7990
  ariaLabel: 'address-form-province',
7975
7991
  value: (address === null || address === void 0 ? void 0 : address.subdivisionCode) || '',
@@ -8541,6 +8557,7 @@ const AddressLookUpControl = props => {
8541
8557
  address: address,
8542
8558
  errors: errors,
8543
8559
  readOnly: readOnly,
8560
+ enabled: enabled,
8544
8561
  handleInputChange: handleInputChange,
8545
8562
  isAlbertaAddress: isAlbertaAddress,
8546
8563
  handleOnBlur: handleRequiredFieldBlur,
@@ -8708,7 +8725,8 @@ const NameInputs = ({
8708
8725
  lastName,
8709
8726
  handleInputChange,
8710
8727
  data,
8711
- requiredFields
8728
+ requiredFields,
8729
+ disabled
8712
8730
  }) => {
8713
8731
  var _a, _b;
8714
8732
  const [errors, setErrors] = useState({});
@@ -8736,6 +8754,7 @@ const NameInputs = ({
8736
8754
  children: jsx(GoAInput, {
8737
8755
  type: "text",
8738
8756
  name: "firstName",
8757
+ disabled: disabled,
8739
8758
  testId: "name-form-first-name",
8740
8759
  ariaLabel: 'name-form-first-name',
8741
8760
  value: firstName || '',
@@ -8752,6 +8771,7 @@ const NameInputs = ({
8752
8771
  children: jsx(GoAInput, {
8753
8772
  type: "text",
8754
8773
  name: "middleName",
8774
+ disabled: disabled,
8755
8775
  testId: "name-form-middle-name",
8756
8776
  ariaLabel: 'name-form-middle-name',
8757
8777
  value: middleName || '',
@@ -8766,6 +8786,7 @@ const NameInputs = ({
8766
8786
  children: jsx(GoAInput, {
8767
8787
  type: "text",
8768
8788
  name: "lastName",
8789
+ disabled: disabled,
8769
8790
  testId: "name-form-last-name",
8770
8791
  ariaLabel: 'name-form-last-name',
8771
8792
  value: lastName || '',
@@ -8833,7 +8854,8 @@ const FullNameControl = props => {
8833
8854
  data,
8834
8855
  path,
8835
8856
  schema,
8836
- handleChange
8857
+ handleChange,
8858
+ enabled
8837
8859
  } = props;
8838
8860
  const requiredFields = schema.required;
8839
8861
  const defaultName = {
@@ -8859,6 +8881,7 @@ const FullNameControl = props => {
8859
8881
  lastName: defaultName.lastName,
8860
8882
  handleInputChange: handleInputChange,
8861
8883
  data: data,
8884
+ disabled: !enabled,
8862
8885
  requiredFields: requiredFields
8863
8886
  });
8864
8887
  };
@@ -8894,7 +8917,7 @@ const FullNameDobControl = props => {
8894
8917
  path,
8895
8918
  schema,
8896
8919
  handleChange,
8897
- uischema
8920
+ enabled
8898
8921
  } = props;
8899
8922
  const requiredFields = schema.required;
8900
8923
  const [errors, setErrors] = useState({});
@@ -8952,6 +8975,7 @@ const FullNameDobControl = props => {
8952
8975
  requirement: ((_a = schema === null || schema === void 0 ? void 0 : schema.required) === null || _a === void 0 ? void 0 : _a.includes('firstName')) ? 'required' : undefined,
8953
8976
  error: (_b = errors === null || errors === void 0 ? void 0 : errors['firstName']) !== null && _b !== void 0 ? _b : '',
8954
8977
  children: jsx(GoAInput, {
8978
+ disabled: !enabled,
8955
8979
  type: "text",
8956
8980
  name: "firstName",
8957
8981
  testId: "name-form-first-name",
@@ -8971,6 +8995,7 @@ const FullNameDobControl = props => {
8971
8995
  children: jsx(GoAInput, {
8972
8996
  type: "text",
8973
8997
  name: "middleName",
8998
+ disabled: !enabled,
8974
8999
  testId: "name-form-middle-name",
8975
9000
  ariaLabel: 'name-form-middle-name',
8976
9001
  value: formData.middleName || '',
@@ -8984,6 +9009,7 @@ const FullNameDobControl = props => {
8984
9009
  children: jsx(GoAInput, {
8985
9010
  type: "text",
8986
9011
  name: "lastName",
9012
+ disabled: !enabled,
8987
9013
  testId: "name-form-last-name",
8988
9014
  ariaLabel: 'name-form-last-name',
8989
9015
  value: formData.lastName || '',
@@ -9005,6 +9031,7 @@ const FullNameDobControl = props => {
9005
9031
  children: jsx(GoAInput, {
9006
9032
  type: "date",
9007
9033
  name: "dateOfBirth",
9034
+ disabled: !enabled,
9008
9035
  min: validDates().minDate,
9009
9036
  max: validDates().maxDate,
9010
9037
  testId: `dob-form-dateOfBirth`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.49.0",
3
+ "version": "1.50.0",
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",
@@ -8,6 +8,7 @@ interface AddressInputsProps {
8
8
  errors?: any;
9
9
  handleOnBlur: (field: string) => void;
10
10
  requiredFields?: string[];
11
+ enabled?: boolean;
11
12
  }
12
13
  export declare const AddressInputs: React.FC<AddressInputsProps>;
13
14
  export {};
@@ -22,5 +22,10 @@ export type StepperAction = {
22
22
  payload: {
23
23
  errors?: ErrorObject[];
24
24
  };
25
+ } | {
26
+ type: 'update/uischema';
27
+ payload: {
28
+ state: StepperContextDataType;
29
+ };
25
30
  };
26
31
  export declare const stepperReducer: (state: StepperContextDataType, action: StepperAction) => StepperContextDataType;
@@ -4,6 +4,7 @@ interface NameInputsProps {
4
4
  middleName?: string;
5
5
  lastName: string;
6
6
  isStepperReview?: boolean;
7
+ disabled?: boolean;
7
8
  data: any;
8
9
  requiredFields: string[];
9
10
  handleInputChange: (field: string, value: string) => void;