@abgov/jsonforms-components 1.20.1 → 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
@@ -5958,6 +5958,24 @@ const HelpContents = ({
5958
5958
  const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
5959
5959
  const HelpContent = withJsonFormsControlProps(HelpContentComponent);
5960
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
+
5961
5979
  const isNullSchema = schema => {
5962
5980
  return schema === undefined || schema === null;
5963
5981
  };
@@ -5984,7 +6002,7 @@ const isLayoutType = schema => {
5984
6002
  return hasType(schema, 'VerticalLayout') || hasType(schema, 'HorizontalLayout') || hasType(schema, 'Categorization') || hasType(schema, 'Group');
5985
6003
  };
5986
6004
  const isKnownType = schema => {
5987
- 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');
5988
6006
  };
5989
6007
  const isListWithDetail = schema => {
5990
6008
  return hasType(schema, 'ListWithDetail');
@@ -6195,6 +6213,9 @@ const GoABaseRenderers = [
6195
6213
  }, {
6196
6214
  tester: HelpContentTester,
6197
6215
  renderer: HelpContent
6216
+ }, {
6217
+ tester: ImageControlTester,
6218
+ renderer: ImageControl
6198
6219
  }];
6199
6220
  const GoARenderers = [...GoABaseRenderers, {
6200
6221
  tester: CategorizationRendererTester,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.20.1",
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';