@abgov/jsonforms-components 2.67.6 → 2.67.7

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
@@ -1,4 +1,3 @@
1
- import * as runtime from 'react/jsx-runtime';
2
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
2
  import React, { useContext, useReducer, useMemo, useEffect, createContext, useCallback, useRef, useState, useLayoutEffect } from 'react';
4
3
  import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabTable, GoabModal, GoabButtonGroup, GoabContainer, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
@@ -16,7 +15,9 @@ import merge from 'lodash/merge';
16
15
  import isEmpty from 'lodash/isEmpty';
17
16
  import range from 'lodash/range';
18
17
  import pluralize from 'pluralize';
19
- import { evaluateSync, compileSync } from '@mdx-js/mdx';
18
+ import { compileSync } from '@mdx-js/mdx';
19
+ import ReactMarkdown from 'react-markdown';
20
+ import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
20
21
  import { Parser } from 'expr-eval-fork';
21
22
  import addErrors from 'ajv-errors';
22
23
  import addFormats from 'ajv-formats';
@@ -13734,13 +13735,24 @@ const RenderLink = props => {
13734
13735
  });
13735
13736
  };
13736
13737
 
13737
- const _excluded$3 = ["isParent", "showLabel"];
13738
+ const _excluded$3 = ["node"],
13739
+ _excluded2 = ["isParent", "showLabel"];
13738
13740
  const markdownComponents = {
13739
- a: props => jsx("a", Object.assign({}, props, {
13740
- target: "_blank",
13741
- rel: "noopener noreferrer"
13742
- }))
13741
+ // Destructure node out (react-markdown internal prop) so it is not forwarded to the DOM element.
13742
+ a: _ref => {
13743
+ let props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
13744
+ return jsx("a", Object.assign({}, props, {
13745
+ target: "_blank",
13746
+ rel: "noopener noreferrer"
13747
+ }));
13748
+ }
13743
13749
  };
13750
+ // rehype-sanitize strips dangerous HTML (script tags, event-handler attributes, javascript: hrefs, etc.)
13751
+ // from the HAST tree before rendering. defaultSchema allows standard HTML but blocks XSS vectors.
13752
+ // Cast required: react-markdown vendors its own copy of unified, causing a type mismatch with the
13753
+ // top-level unified package even though the runtime behaviour is identical.
13754
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13755
+ const rehypePlugins = [[rehypeSanitize, defaultSchema]];
13744
13756
  const HelpContentReviewComponent = () => {
13745
13757
  return jsx(Fragment, {
13746
13758
  children: " "
@@ -13750,7 +13762,11 @@ const checkMarkDownIsValid = markdown => {
13750
13762
  let isValid = true;
13751
13763
  let error = '';
13752
13764
  try {
13753
- compileSync(markdown, {});
13765
+ // clean-code-ignore: 2.14
13766
+ // to allow testing the compile and catching the error
13767
+ compileSync(markdown, {
13768
+ rehypePlugins: [[rehypeSanitize, defaultSchema]]
13769
+ });
13754
13770
  } catch (err) {
13755
13771
  if (err instanceof Error) {
13756
13772
  error = err.message;
@@ -13768,26 +13784,23 @@ const MarkdownComponent = ({
13768
13784
  }) => {
13769
13785
  const response = checkMarkDownIsValid(markdown);
13770
13786
  if (response.isValid) {
13771
- const {
13772
- default: MDXContent
13773
- } = evaluateSync(markdown, Object.assign({}, runtime, {
13774
- Fragment: React.Fragment
13775
- }));
13776
- return /*#__PURE__*/React.createElement(MDXContent, {
13777
- components: markdownComponents
13787
+ return jsx(ReactMarkdown, {
13788
+ rehypePlugins: rehypePlugins,
13789
+ components: markdownComponents,
13790
+ children: markdown
13778
13791
  });
13779
13792
  }
13780
13793
  return jsxs(InvalidMarkdown, {
13781
13794
  children: ["Help content markdown is invalid: ", response.error, " "]
13782
13795
  });
13783
13796
  };
13784
- const HelpContentComponent = _ref => {
13797
+ const HelpContentComponent = _ref2 => {
13785
13798
  var _uischema$options, _uischema$options$mar, _uischema$options2, _uischema$options3, _uischema$options4, _uischema$options5, _uischema$options6, _uischema$options7, _uischema$options1, _uischema$options10, _uischema$options11, _uischema$options12, _uischema$options13, _uischema$options14, _uischema$options15, _uischema$options16, _uischema$options17, _uischema$elements2, _uischema$options18;
13786
13799
  let {
13787
13800
  isParent = true,
13788
13801
  showLabel = true
13789
- } = _ref,
13790
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
13802
+ } = _ref2,
13803
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
13791
13804
  const labelClass = isParent ? 'parent-label' : 'child-label';
13792
13805
  const marginClass = isParent ? 'parent-margin' : 'child-margin';
13793
13806
  // eslint-disable-next-line
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.67.6",
3
+ "version": "2.67.7",
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",
@@ -17,7 +17,9 @@
17
17
  "ajv-formats": "^3.0.1",
18
18
  "@mdx-js/mdx": "^3.1.0",
19
19
  "expr-eval-fork": "^3.0.1",
20
- "pluralize": "^8.0.0"
20
+ "pluralize": "^8.0.0",
21
+ "rehype-sanitize": "^6.0.0",
22
+ "react-markdown": "^8.0.3"
21
23
  },
22
24
  "dependencies": {
23
25
  "axios": "^1.15.2",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-06-23T21:16:03.119Z",
4
- "sourceCommit": "a83b527a2f034d3e3d4699630165799b4f644517",
3
+ "generatedAt": "2026-06-24T15:43:06.124Z",
4
+ "sourceCommit": "08d590f507a0d7cc7dfd71287692ce6bc227e6df",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import { RankedTester } from '@jsonforms/core';
3
3
  import { ControlProps, ControlElement } from '@jsonforms/core';
4
- import * as runtime from 'react/jsx-runtime';
5
- import './HelpContent.css';
4
+ import './HelpContent';
6
5
  interface OptionProps {
7
6
  ariaLabel?: string;
8
7
  help?: string | string[];
@@ -29,7 +28,9 @@ interface MdxMarkdown {
29
28
  markdown: string;
30
29
  }
31
30
  export declare const markdownComponents: {
32
- a: (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => runtime.JSX.Element;
31
+ a: ({ node, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
32
+ node?: unknown;
33
+ }) => import("react/jsx-runtime").JSX.Element;
33
34
  };
34
35
  export declare const MarkdownComponent: ({ markdown }: MdxMarkdown) => JSX.Element;
35
36
  export declare const HelpContentComponent: ({ isParent, showLabel, ...props }: CustomControlProps & ExtraHelpContentProps) => JSX.Element;