@abgov/jsonforms-components 1.20.0 → 1.21.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
@@ -5014,7 +5014,13 @@ const FormStepper = props => {
5014
5014
  children: step !== 1 ? jsx(GoAButton, {
5015
5015
  type: "secondary",
5016
5016
  disabled: disabledCategoryMap[step - 1],
5017
- onClick: () => prevPage(step, disabledCategoryMap),
5017
+ onClick: () => {
5018
+ const element = document.getElementById(`${path || `goa`}-form-stepper`);
5019
+ if (element) {
5020
+ element.scrollIntoView();
5021
+ }
5022
+ prevPage(step, disabledCategoryMap);
5023
+ },
5018
5024
  testId: "prev-button",
5019
5025
  children: "Previous"
5020
5026
  }) : jsx("div", {})
@@ -5022,7 +5028,13 @@ const FormStepper = props => {
5022
5028
  children: [step !== null && showNextBtn && jsx(GoAButton, {
5023
5029
  type: "primary",
5024
5030
  disabled: disabledCategoryMap[step - 1],
5025
- onClick: () => nextPage(step, disabledCategoryMap),
5031
+ onClick: () => {
5032
+ const element = document.getElementById(`${path || `goa`}-form-stepper`);
5033
+ if (element) {
5034
+ element.scrollIntoView();
5035
+ }
5036
+ nextPage(step, disabledCategoryMap);
5037
+ },
5026
5038
  testId: "next-button",
5027
5039
  children: "Next"
5028
5040
  }), !showNextBtn && !isFormSubmitted && jsx("div", {
@@ -5946,6 +5958,24 @@ const HelpContents = ({
5946
5958
  const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
5947
5959
  const HelpContent = withJsonFormsControlProps(HelpContentComponent);
5948
5960
 
5961
+ const ImageComponent = ({
5962
+ uischema
5963
+ }) => {
5964
+ var _a, _b, _c, _d;
5965
+ const url = ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.url) || '';
5966
+ const width = ((_b = uischema.options) === null || _b === void 0 ? void 0 : _b.width) || '';
5967
+ const height = ((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.height) || '';
5968
+ const alt = ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.alt) || '';
5969
+ return jsx("img", {
5970
+ src: url,
5971
+ width: width,
5972
+ height: height,
5973
+ alt: alt
5974
+ });
5975
+ };
5976
+ const ImageControlTester = rankWith(1, uiTypeIs('ImageContent'));
5977
+ const ImageControl = withJsonFormsControlProps(ImageComponent);
5978
+
5949
5979
  const isNullSchema = schema => {
5950
5980
  return schema === undefined || schema === null;
5951
5981
  };
@@ -5972,7 +6002,7 @@ const isLayoutType = schema => {
5972
6002
  return hasType(schema, 'VerticalLayout') || hasType(schema, 'HorizontalLayout') || hasType(schema, 'Categorization') || hasType(schema, 'Group');
5973
6003
  };
5974
6004
  const isKnownType = schema => {
5975
- return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || isListWithDetail(schema) || hasType(schema, 'Callout');
6005
+ return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || hasType(schema, 'ImageContent') || isListWithDetail(schema) || hasType(schema, 'Callout');
5976
6006
  };
5977
6007
  const isListWithDetail = schema => {
5978
6008
  return hasType(schema, 'ListWithDetail');
@@ -6183,6 +6213,9 @@ const GoABaseRenderers = [
6183
6213
  }, {
6184
6214
  tester: HelpContentTester,
6185
6215
  renderer: HelpContent
6216
+ }, {
6217
+ tester: ImageControlTester,
6218
+ renderer: ImageControl
6186
6219
  }];
6187
6220
  const GoARenderers = [...GoABaseRenderers, {
6188
6221
  tester: CategorizationRendererTester,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.20.0",
3
+ "version": "1.21.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",
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ControlElement, ControlProps, RankedTester } from '@jsonforms/core';
3
+ interface OptionProps {
4
+ url?: string;
5
+ width?: string;
6
+ height?: string;
7
+ alt?: string;
8
+ }
9
+ interface ImageCustomControlElement extends ControlElement {
10
+ options?: OptionProps;
11
+ }
12
+ interface ImageCustomControlProps extends ControlProps {
13
+ uischema: ImageCustomControlElement;
14
+ }
15
+ export declare const ImageComponent: ({ uischema }: ImageCustomControlProps) => JSX.Element;
16
+ export declare const ImageControlTester: RankedTester;
17
+ export declare const ImageControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
18
+ export {};
@@ -1 +1,2 @@
1
1
  export * from './HelpContent';
2
+ export * from './ImageControl';