@abgov/jsonforms-components 2.48.1 → 2.48.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.
Files changed (2) hide show
  1. package/index.esm.js +83 -78
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -10,12 +10,12 @@ import * as _$c from 'lodash';
10
10
  import ___default, { isEqual, isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
11
11
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
12
12
  import Ajv from 'ajv';
13
+ import dompurify from 'dompurify';
14
+ import * as xss from 'xss';
13
15
  import merge from 'lodash/merge';
14
16
  import isEmpty from 'lodash/isEmpty';
15
17
  import range from 'lodash/range';
16
18
  import pluralize from 'pluralize';
17
- import dompurify from 'dompurify';
18
- import * as xss from 'xss';
19
19
  import { evaluateSync, compileSync } from '@mdx-js/mdx';
20
20
  import { Parser } from 'expr-eval-fork';
21
21
  import addErrors from 'ajv-errors';
@@ -8004,6 +8004,81 @@ const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props
8004
8004
  const GoATimeControlTester = rankWith(4, isTimeControl);
8005
8005
  const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
8006
8006
 
8007
+ const options = {
8008
+ whiteList: {
8009
+ html: ['lang'],
8010
+ meta: ['name', 'content', 'charset'],
8011
+ div: ['style', 'class'],
8012
+ style: [],
8013
+ a: ['href', 'title', 'target', 'style', 'class'],
8014
+ em: [],
8015
+ main: [],
8016
+ footer: ['style'],
8017
+ header: ['style'],
8018
+ head: [],
8019
+ abbr: ['title', 'style'],
8020
+ title: [],
8021
+ address: ['style'],
8022
+ area: ['shape', 'coords', 'href', 'alt', 'style'],
8023
+ article: [],
8024
+ blockquote: [],
8025
+ aside: [],
8026
+ details: [],
8027
+ h1: [],
8028
+ h2: [],
8029
+ h3: [],
8030
+ h4: [],
8031
+ h5: [],
8032
+ h6: [],
8033
+ hr: [],
8034
+ i: [],
8035
+ img: ['src', 'alt', 'title', 'width', 'height'],
8036
+ ins: ['datetime'],
8037
+ li: [],
8038
+ mark: [],
8039
+ nav: [],
8040
+ ol: [],
8041
+ p: [],
8042
+ pre: [],
8043
+ s: [],
8044
+ section: [],
8045
+ small: [],
8046
+ span: ['class', 'style'],
8047
+ sub: [],
8048
+ summary: [],
8049
+ sup: [],
8050
+ select: [],
8051
+ optgroup: [],
8052
+ form: [],
8053
+ strong: [],
8054
+ label: [],
8055
+ strike: [],
8056
+ table: ['width', 'border', 'align', 'valign', 'class', 'style'],
8057
+ tbody: ['align', 'valign', 'class', 'style'],
8058
+ body: ['class', 'style'],
8059
+ td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
8060
+ tfoot: ['align', 'valign', 'class', 'style'],
8061
+ th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
8062
+ thead: ['align', 'valign'],
8063
+ tr: ['rowspan', 'align', 'valign'],
8064
+ tt: [],
8065
+ u: [],
8066
+ ul: [],
8067
+ br: [],
8068
+ b: [],
8069
+ option: []
8070
+ }
8071
+ }; // Custom rules
8072
+ new xss.FilterXSS(options);
8073
+ const sanitizeHtml = dompurify.sanitize;
8074
+ dompurify.addHook('afterSanitizeAttributes', function (node) {
8075
+ // set all elements owning target to target=_blank
8076
+ if ('target' in node) {
8077
+ node.setAttribute('target', '_blank');
8078
+ node.setAttribute('rel', 'noopener noreferrer');
8079
+ }
8080
+ });
8081
+
8007
8082
  // Used locally for callout presentation
8008
8083
  const callout = props => {
8009
8084
  var _componentProps$messa;
@@ -8013,9 +8088,14 @@ const callout = props => {
8013
8088
  message: 'unknown'
8014
8089
  }, props);
8015
8090
  const testid = (_componentProps$messa = componentProps.message) == null ? void 0 : _componentProps$messa.replace(/\s/g, '');
8091
+ const sanitizedHtml = sanitizeHtml(componentProps.message || '');
8016
8092
  return jsx(GoabCallout, Object.assign({}, componentProps, {
8017
8093
  "data-testid": testid,
8018
- children: componentProps == null ? void 0 : componentProps.message
8094
+ children: jsx("div", {
8095
+ dangerouslySetInnerHTML: {
8096
+ __html: sanitizedHtml
8097
+ }
8098
+ })
8019
8099
  }));
8020
8100
  };
8021
8101
  const GoACalloutController = props => {
@@ -13454,81 +13534,6 @@ const SummaryRow = ({
13454
13534
  });
13455
13535
  };
13456
13536
 
13457
- const options = {
13458
- whiteList: {
13459
- html: ['lang'],
13460
- meta: ['name', 'content', 'charset'],
13461
- div: ['style', 'class'],
13462
- style: [],
13463
- a: ['href', 'title', 'target', 'style', 'class'],
13464
- em: [],
13465
- main: [],
13466
- footer: ['style'],
13467
- header: ['style'],
13468
- head: [],
13469
- abbr: ['title', 'style'],
13470
- title: [],
13471
- address: ['style'],
13472
- area: ['shape', 'coords', 'href', 'alt', 'style'],
13473
- article: [],
13474
- blockquote: [],
13475
- aside: [],
13476
- details: [],
13477
- h1: [],
13478
- h2: [],
13479
- h3: [],
13480
- h4: [],
13481
- h5: [],
13482
- h6: [],
13483
- hr: [],
13484
- i: [],
13485
- img: ['src', 'alt', 'title', 'width', 'height'],
13486
- ins: ['datetime'],
13487
- li: [],
13488
- mark: [],
13489
- nav: [],
13490
- ol: [],
13491
- p: [],
13492
- pre: [],
13493
- s: [],
13494
- section: [],
13495
- small: [],
13496
- span: ['class', 'style'],
13497
- sub: [],
13498
- summary: [],
13499
- sup: [],
13500
- select: [],
13501
- optgroup: [],
13502
- form: [],
13503
- strong: [],
13504
- label: [],
13505
- strike: [],
13506
- table: ['width', 'border', 'align', 'valign', 'class', 'style'],
13507
- tbody: ['align', 'valign', 'class', 'style'],
13508
- body: ['class', 'style'],
13509
- td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
13510
- tfoot: ['align', 'valign', 'class', 'style'],
13511
- th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
13512
- thead: ['align', 'valign'],
13513
- tr: ['rowspan', 'align', 'valign'],
13514
- tt: [],
13515
- u: [],
13516
- ul: [],
13517
- br: [],
13518
- b: [],
13519
- option: []
13520
- }
13521
- }; // Custom rules
13522
- new xss.FilterXSS(options);
13523
- const sanitizeHtml = dompurify.sanitize;
13524
- dompurify.addHook('afterSanitizeAttributes', function (node) {
13525
- // set all elements owning target to target=_blank
13526
- if ('target' in node) {
13527
- node.setAttribute('target', '_blank');
13528
- node.setAttribute('rel', 'noopener noreferrer');
13529
- }
13530
- });
13531
-
13532
13537
  const _excluded$1 = ["type"];
13533
13538
  const AdditionalInstructionsRow = ({
13534
13539
  additionalInstructions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.48.1",
3
+ "version": "2.48.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",