@abgov/jsonforms-components 1.22.0 → 1.22.1

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
@@ -5990,7 +5990,7 @@ const HelpContentDiv = styled.div(_t || (_t = _`
5990
5990
  `));
5991
5991
 
5992
5992
  const HelpContentComponent = _a => {
5993
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
5993
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5994
5994
  var {
5995
5995
  isParent = true
5996
5996
  } = _a,
@@ -6014,6 +6014,19 @@ const HelpContentComponent = _a => {
6014
6014
  children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
6015
6015
  });
6016
6016
  };
6017
+ const renderImage = ({
6018
+ height,
6019
+ width,
6020
+ alt,
6021
+ img
6022
+ }) => {
6023
+ return jsx("img", {
6024
+ src: img,
6025
+ width: width,
6026
+ height: height,
6027
+ alt: alt
6028
+ });
6029
+ };
6017
6030
  return jsx(Visible, {
6018
6031
  visible: visible,
6019
6032
  children: jsx(HelpContentDiv, {
@@ -6024,14 +6037,14 @@ const HelpContentComponent = _a => {
6024
6037
  className: labelClass,
6025
6038
  "data-testid": label,
6026
6039
  children: [label, jsx("br", {})]
6027
- }), (!((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) || ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.variant) !== 'details') && renderHelp(), ((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) && ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'details' && jsxs(GoADetails, {
6040
+ }), ((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.img) && ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.img) !== '' && renderImage(uischema.options), (!((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) || ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) !== 'details') && renderHelp(), ((_j = uischema.options) === null || _j === void 0 ? void 0 : _j.variant) && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) === 'details' && jsxs(GoADetails, {
6028
6041
  heading: label ? label : '',
6029
6042
  mt: "3xs",
6030
6043
  mb: "none",
6031
- children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_j = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _j === void 0 ? void 0 : _j.length) > 0 && jsx(HelpContents, {
6044
+ children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_l = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _l === void 0 ? void 0 : _l.length) > 0 && jsx(HelpContents, {
6032
6045
  elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
6033
6046
  })]
6034
- }), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) !== 'details' && jsx(HelpContents, {
6047
+ }), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_m = uischema.options) === null || _m === void 0 ? void 0 : _m.variant) !== 'details' && jsx(HelpContents, {
6035
6048
  elements: uischema.elements,
6036
6049
  isParent: false
6037
6050
  })]
@@ -6063,24 +6076,6 @@ const HelpContents = ({
6063
6076
  const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
6064
6077
  const HelpContent = withJsonFormsControlProps(HelpContentComponent);
6065
6078
 
6066
- const ImageComponent = ({
6067
- uischema
6068
- }) => {
6069
- var _a, _b, _c, _d;
6070
- const url = ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.url) || '';
6071
- const width = ((_b = uischema.options) === null || _b === void 0 ? void 0 : _b.width) || '';
6072
- const height = ((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.height) || '';
6073
- const alt = ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.alt) || '';
6074
- return jsx("img", {
6075
- src: url,
6076
- width: width,
6077
- height: height,
6078
- alt: alt
6079
- });
6080
- };
6081
- const ImageControlTester = rankWith(1, uiTypeIs('ImageContent'));
6082
- const ImageControl = withJsonFormsControlProps(ImageComponent);
6083
-
6084
6079
  const isNullSchema = schema => {
6085
6080
  return schema === undefined || schema === null;
6086
6081
  };
@@ -6107,7 +6102,7 @@ const isLayoutType = schema => {
6107
6102
  return hasType(schema, 'VerticalLayout') || hasType(schema, 'HorizontalLayout') || hasType(schema, 'Categorization') || hasType(schema, 'Group');
6108
6103
  };
6109
6104
  const isKnownType = schema => {
6110
- return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || hasType(schema, 'ImageContent') || isListWithDetail(schema) || hasType(schema, 'Callout');
6105
+ return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || isListWithDetail(schema) || hasType(schema, 'Callout');
6111
6106
  };
6112
6107
  const isListWithDetail = schema => {
6113
6108
  return hasType(schema, 'ListWithDetail');
@@ -6321,9 +6316,6 @@ const GoABaseRenderers = [
6321
6316
  }, {
6322
6317
  tester: HelpContentTester,
6323
6318
  renderer: HelpContent
6324
- }, {
6325
- tester: ImageControlTester,
6326
- renderer: ImageControl
6327
6319
  }];
6328
6320
  const GoARenderers = [...GoABaseRenderers, {
6329
6321
  tester: CategorizationRendererTester,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
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,6 +5,10 @@ interface OptionProps {
5
5
  ariaLabel?: string;
6
6
  help?: string | string[];
7
7
  variant?: string;
8
+ img?: string;
9
+ alt?: string;
10
+ height?: string;
11
+ width?: string;
8
12
  }
9
13
  interface CustomControlElement extends ControlElement {
10
14
  options?: OptionProps;
@@ -1,2 +1 @@
1
1
  export * from './HelpContent';
2
- export * from './ImageControl';
@@ -1,18 +0,0 @@
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 {};