@abgov/jsonforms-components 2.3.3 → 2.3.4

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.
Files changed (2) hide show
  1. package/index.esm.js +20 -17
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -6332,7 +6332,7 @@ const FormStepperView = props => {
6332
6332
  const submitForm = submitFormFunction && submitFormFunction();
6333
6333
  const optionProps = uischema.options || {};
6334
6334
  const [isOpen, setIsOpen] = useState(false);
6335
- const [staleCategories, setStaleCategories] = React.useState(categories);
6335
+ const headersRef = useRef([]);
6336
6336
  const handleSubmit = () => {
6337
6337
  if (submitForm) {
6338
6338
  submitForm(data);
@@ -6340,14 +6340,9 @@ const FormStepperView = props => {
6340
6340
  setIsOpen(true);
6341
6341
  }
6342
6342
  };
6343
- useEffect(() => {
6344
- setStaleCategories(categories);
6345
- }, [categories]);
6346
6343
  const onCloseModal = () => {
6347
6344
  setIsOpen(false);
6348
6345
  };
6349
- // eslint-disable-next-line
6350
- uischema.options;
6351
6346
  return jsxs("div", {
6352
6347
  "data-testid": "form-stepper-test-wrapper",
6353
6348
  children: [jsx(Visible, {
@@ -6355,20 +6350,26 @@ const FormStepperView = props => {
6355
6350
  children: jsxs("div", {
6356
6351
  id: `${path || `goa`}-form-stepper`,
6357
6352
  className: "formStepper",
6358
- children: [categories.length === staleCategories.length && jsxs(GoAFormStepper, {
6353
+ children: [jsxs(GoAFormStepper, {
6359
6354
  testId: `form-stepper-headers-${(_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.testId}` || 'form-stepper-test',
6360
6355
  onChange: step => {
6361
6356
  goToPage(step - 1);
6362
6357
  },
6363
6358
  children: [categories === null || categories === void 0 ? void 0 : categories.map((c, index) => {
6364
- return jsx(GoAFormStep, {
6365
- "data-testid": `stepper-tab-${index}`,
6366
- text: `${c.label}`,
6367
- status: c.isVisited ? c.isCompleted && c.isValid ? 'complete' : 'incomplete' : undefined
6368
- }, `stepper-tab-${index}`);
6369
- }), jsx(GoAFormStep, {
6370
- text: "Review"
6371
- }, `stepper-tab-review`)]
6359
+ return jsx("div", {
6360
+ ref: el => headersRef.current[index] = el,
6361
+ children: jsx(GoAFormStep, {
6362
+ "data-testid": `stepper-tab-${index}`,
6363
+ text: `${c.label}`,
6364
+ status: c.isVisited ? c.isCompleted && c.isValid ? 'complete' : 'incomplete' : undefined
6365
+ }, `stepper-tab-${index}`)
6366
+ });
6367
+ }), jsx("div", {
6368
+ ref: el => headersRef.current[categories.length] = el,
6369
+ children: jsx(GoAFormStep, {
6370
+ text: "Review"
6371
+ }, `stepper-tab-review`)
6372
+ })]
6372
6373
  }, "stepper-form-stepper-wrapper"), jsxs(GoAPages, {
6373
6374
  current: activeId + 1,
6374
6375
  mb: "xl",
@@ -6406,11 +6407,12 @@ const FormStepperView = props => {
6406
6407
  type: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonType) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonType : 'secondary',
6407
6408
  disabled: selectIsDisabled(),
6408
6409
  onClick: () => {
6410
+ var _a, _b, _c;
6409
6411
  const element = document.getElementById(`${path || `goa`}-form-stepper`);
6410
6412
  if (element) {
6411
6413
  element.scrollIntoView();
6412
6414
  }
6413
- goToPage(activeId - 1, activeId);
6415
+ headersRef.current[activeId - 1] && ((_c = (_b = (_a = headersRef.current[activeId - 1].querySelector('goa-form-step')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input')) === null || _c === void 0 ? void 0 : _c.click());
6414
6416
  },
6415
6417
  testId: "prev-button",
6416
6418
  children: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonLabel) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.previousButtonLabel : 'Previous'
@@ -6420,7 +6422,8 @@ const FormStepperView = props => {
6420
6422
  type: (optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonType) ? optionProps === null || optionProps === void 0 ? void 0 : optionProps.nextButtonType : 'primary',
6421
6423
  disabled: selectIsDisabled(),
6422
6424
  onClick: () => {
6423
- goToPage(activeId + 1, activeId);
6425
+ var _a, _b, _c;
6426
+ headersRef.current[activeId + 1] && ((_c = (_b = (_a = headersRef.current[activeId + 1].querySelector('goa-form-step')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input')) === null || _c === void 0 ? void 0 : _c.click());
6424
6427
  const element = document.getElementById(`${path || `goa`}-form-stepper`);
6425
6428
  if (element) {
6426
6429
  element.scrollIntoView();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
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",