@abgov/jsonforms-components 1.23.0 → 1.23.2

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
@@ -4881,6 +4881,7 @@ const FormStepper = props => {
4881
4881
  const categorization = uischema;
4882
4882
  const allCategories = JSON.parse(JSON.stringify(categorization));
4883
4883
  const componentProps = (_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) !== null && _b !== void 0 ? _b : {};
4884
+ const optionProps = uischema.options || {};
4884
4885
  const [step, setStep] = React.useState(0);
4885
4886
  const [isFormValid, setIsFormValid] = React.useState(false);
4886
4887
  const [showNextBtn, setShowNextBtn] = React.useState(true);
@@ -5051,7 +5052,7 @@ const FormStepper = props => {
5051
5052
  minChildWidth: "100px",
5052
5053
  children: [jsx("div", {
5053
5054
  children: step !== 1 ? jsx(GoAButton, {
5054
- type: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonType) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonType : 'secondary',
5055
+ type: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonType) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonType : 'secondary',
5055
5056
  disabled: disabledCategoryMap[step - 1],
5056
5057
  onClick: () => {
5057
5058
  const element = document.getElementById(`${path || `goa`}-form-stepper`);
@@ -5061,11 +5062,11 @@ const FormStepper = props => {
5061
5062
  prevPage(step, disabledCategoryMap);
5062
5063
  },
5063
5064
  testId: "prev-button",
5064
- children: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonLabel) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonLabel : 'Previous'
5065
+ children: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonLabel) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonLabel : 'Previous'
5065
5066
  }) : jsx("div", {})
5066
5067
  }), jsxs(RightAlignmentDiv, {
5067
5068
  children: [step !== null && showNextBtn && jsx(GoAButton, {
5068
- type: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonType) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonType : 'primary',
5069
+ type: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonType) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonType : 'primary',
5069
5070
  disabled: disabledCategoryMap[step - 1],
5070
5071
  onClick: () => {
5071
5072
  const element = document.getElementById(`${path || `goa`}-form-stepper`);
@@ -5075,7 +5076,7 @@ const FormStepper = props => {
5075
5076
  nextPage(step, disabledCategoryMap);
5076
5077
  },
5077
5078
  testId: "next-button",
5078
- children: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonLabel) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonLabel : 'Next'
5079
+ children: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonLabel) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonLabel : 'Next'
5079
5080
  }), !showNextBtn && !isFormSubmitted && jsx("div", {
5080
5081
  children: jsx(GoAButton, {
5081
5082
  type: 'primary',
@@ -5382,8 +5383,9 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
5382
5383
  rootSchema,
5383
5384
  uischema
5384
5385
  }) {
5385
- var _a, _b;
5386
+ var _a, _b, _c, _d;
5386
5387
  const buttonPosition = ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.addButtonPosition) || 'left';
5388
+ const arrayLabel = getLabelText(uischema.scope, label);
5387
5389
  return jsx(Fragment, {
5388
5390
  children: jsx("div", {
5389
5391
  style: {
@@ -5394,7 +5396,8 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
5394
5396
  testId: `object-array-toolbar-${label}`,
5395
5397
  "aria-label": translations.addAriaLabel,
5396
5398
  onClick: addItem(path, createDefaultValue(schema, rootSchema)),
5397
- children: ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.addButtonText) || 'Add'
5399
+ type: (_c = (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.addButtonType) !== null && _c !== void 0 ? _c : 'primary',
5400
+ children: ((_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.addButtonText) || capitalizeFirstLetter(`Add ${arrayLabel}`)
5398
5401
  })
5399
5402
  })
5400
5403
  });
@@ -5981,7 +5984,7 @@ const RenderLink = props => {
5981
5984
  };
5982
5985
 
5983
5986
  const HelpContentComponent = _a => {
5984
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5987
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5985
5988
  var {
5986
5989
  isParent = true
5987
5990
  } = _a,
@@ -6019,24 +6022,25 @@ const HelpContentComponent = _a => {
6019
6022
  alt: alt
6020
6023
  });
6021
6024
  };
6025
+ const textVariant = !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) || ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) !== 'link';
6022
6026
  return jsx(Visible, {
6023
6027
  visible: visible,
6024
6028
  children: jsx(HelpContentDiv, {
6025
- "aria-label": (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.ariaLabel,
6029
+ "aria-label": (_f = uischema.options) === null || _f === void 0 ? void 0 : _f.ariaLabel,
6026
6030
  children: jsxs("div", {
6027
6031
  className: marginClass,
6028
- children: [label && !((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) && ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) !== 'details' && jsxs("div", {
6032
+ children: [label && (!((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) || ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'link') && jsxs("div", {
6029
6033
  className: labelClass,
6030
6034
  "data-testid": label,
6031
6035
  children: [label, jsx("br", {})]
6032
- }), ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.variant) && ((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) === 'img' && renderImage(uischema.options), ((_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.link) && link !== '' && RenderLink(uischema === null || uischema === void 0 ? void 0 : uischema.options), (!((_j = uischema.options) === null || _j === void 0 ? void 0 : _j.variant) || ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) !== 'details') && !link && renderHelp(), ((_l = uischema.options) === null || _l === void 0 ? void 0 : _l.variant) && ((_m = uischema.options) === null || _m === void 0 ? void 0 : _m.variant) === 'details' && jsxs(GoADetails, {
6036
+ }), ((_j = uischema.options) === null || _j === void 0 ? void 0 : _j.variant) && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) === 'img' && renderImage(uischema.options), ((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.variant) && ((_m = uischema.options) === null || _m === void 0 ? void 0 : _m.variant) === 'link' && link && RenderLink(uischema === null || uischema === void 0 ? void 0 : uischema.options), textVariant && renderHelp(), ((_o = uischema.options) === null || _o === void 0 ? void 0 : _o.variant) && ((_p = uischema.options) === null || _p === void 0 ? void 0 : _p.variant) === 'details' && jsxs(GoADetails, {
6033
6037
  heading: label ? label : '',
6034
6038
  mt: "3xs",
6035
6039
  mb: "none",
6036
- children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_o = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _o === void 0 ? void 0 : _o.length) > 0 && jsx(HelpContents, {
6040
+ children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_q = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _q === void 0 ? void 0 : _q.length) > 0 && jsx(HelpContents, {
6037
6041
  elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
6038
6042
  })]
6039
- }), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_p = uischema.options) === null || _p === void 0 ? void 0 : _p.variant) !== 'details' && jsx(HelpContents, {
6043
+ }), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_r = uischema.options) === null || _r === void 0 ? void 0 : _r.variant) !== 'details' && jsx(HelpContents, {
6040
6044
  elements: uischema.elements,
6041
6045
  isParent: false
6042
6046
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
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",
@@ -5,12 +5,14 @@ import { AjvProps } from '../../util/layout';
5
5
  export interface CategorizationStepperLayoutRendererProps extends StatePropsOfLayout, AjvProps, TranslateProps {
6
6
  }
7
7
  export interface FormStepperComponentProps {
8
+ controlledNav?: number;
9
+ readOnly?: boolean;
10
+ }
11
+ export interface FormStepperOptionProps {
8
12
  nextButtonLabel?: string;
9
13
  nextButtonType?: GoAButtonType;
10
14
  previousButtonLabel?: string;
11
15
  previousButtonType?: GoAButtonType;
12
- controlledNav?: number;
13
- readOnly?: boolean;
14
16
  }
15
17
  export declare const FormStepper: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
16
18
  export declare const FormStepperControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => import("react/jsx-runtime").JSX.Element;