@abgov/jsonforms-components 2.67.5 → 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';
@@ -5974,7 +5975,6 @@ const NoneGivenText = styled.span(_t1$2 || (_t1$2 = _$a`
5974
5975
  `));
5975
5976
  const NoneGivenTableText = styled.span(_t10$2 || (_t10$2 = _$a`
5976
5977
  padding-top: var(--goa-space-l);
5977
- padding-left: var(--goa-space-xs);
5978
5978
  color: var(--goa-color-greyscale-700);
5979
5979
  font-style: italic;
5980
5980
  `));
@@ -7363,12 +7363,12 @@ const InnerGoAInputText = props => {
7363
7363
  setLocalValue(isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data);
7364
7364
  }, [data, isSinField]);
7365
7365
  useEffect(() => {
7366
- if (typeof handleChange === 'function' && hasDefault && !manualInput) {
7366
+ if (typeof handleChange === 'function' && hasDefault && data === undefined && !manualInput) {
7367
7367
  handleChange(props.path, schema.default);
7368
7368
  setLocalValue(schema.default);
7369
7369
  }
7370
7370
  // eslint-disable-next-line react-hooks/exhaustive-deps
7371
- }, [schema.default]);
7371
+ }, [schema.default, data]);
7372
7372
  /* istanbul ignore next */
7373
7373
  useEffect(() => {
7374
7374
  const dataForInput = isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data;
@@ -10521,11 +10521,12 @@ const GoAEmailInput = props => {
10521
10521
  splitErrors[splintIndex] = `${primaryLabel} is required`;
10522
10522
  const finalErrors = splitErrors.join('\n');
10523
10523
  useEffect(() => {
10524
- if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined) {
10524
+ if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined && data === undefined) {
10525
10525
  handleChange(props.path, schema.default);
10526
+ setLocalValue(schema.default);
10526
10527
  }
10527
10528
  // eslint-disable-next-line react-hooks/exhaustive-deps
10528
- }, [schema.default]);
10529
+ }, [schema.default, data]);
10529
10530
  return jsx(Visible, {
10530
10531
  visible: visible,
10531
10532
  children: jsx(JsonFormRegisterProvider, {
@@ -12044,7 +12045,6 @@ const renderCellColumn = ({
12044
12045
  title: "warning",
12045
12046
  size: "small",
12046
12047
  theme: "filled",
12047
- ml: "2xs",
12048
12048
  mt: "2xs"
12049
12049
  }), error ? error : '']
12050
12050
  })]
@@ -12304,7 +12304,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
12304
12304
  style: {
12305
12305
  display: 'flex',
12306
12306
  marginBottom: '0.5rem',
12307
- alignItems: 'center'
12307
+ alignItems: 'flex-start'
12308
12308
  },
12309
12309
  "data-testid": `#/properties/${key}-input-${i}-row`,
12310
12310
  children: [jsxs("strong", {
@@ -13735,13 +13735,24 @@ const RenderLink = props => {
13735
13735
  });
13736
13736
  };
13737
13737
 
13738
- const _excluded$3 = ["isParent", "showLabel"];
13738
+ const _excluded$3 = ["node"],
13739
+ _excluded2 = ["isParent", "showLabel"];
13739
13740
  const markdownComponents = {
13740
- a: props => jsx("a", Object.assign({}, props, {
13741
- target: "_blank",
13742
- rel: "noopener noreferrer"
13743
- }))
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
+ }
13744
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]];
13745
13756
  const HelpContentReviewComponent = () => {
13746
13757
  return jsx(Fragment, {
13747
13758
  children: " "
@@ -13751,7 +13762,11 @@ const checkMarkDownIsValid = markdown => {
13751
13762
  let isValid = true;
13752
13763
  let error = '';
13753
13764
  try {
13754
- 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
+ });
13755
13770
  } catch (err) {
13756
13771
  if (err instanceof Error) {
13757
13772
  error = err.message;
@@ -13769,26 +13784,23 @@ const MarkdownComponent = ({
13769
13784
  }) => {
13770
13785
  const response = checkMarkDownIsValid(markdown);
13771
13786
  if (response.isValid) {
13772
- const {
13773
- default: MDXContent
13774
- } = evaluateSync(markdown, Object.assign({}, runtime, {
13775
- Fragment: React.Fragment
13776
- }));
13777
- return /*#__PURE__*/React.createElement(MDXContent, {
13778
- components: markdownComponents
13787
+ return jsx(ReactMarkdown, {
13788
+ rehypePlugins: rehypePlugins,
13789
+ components: markdownComponents,
13790
+ children: markdown
13779
13791
  });
13780
13792
  }
13781
13793
  return jsxs(InvalidMarkdown, {
13782
13794
  children: ["Help content markdown is invalid: ", response.error, " "]
13783
13795
  });
13784
13796
  };
13785
- const HelpContentComponent = _ref => {
13797
+ const HelpContentComponent = _ref2 => {
13786
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;
13787
13799
  let {
13788
13800
  isParent = true,
13789
13801
  showLabel = true
13790
- } = _ref,
13791
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
13802
+ } = _ref2,
13803
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
13792
13804
  const labelClass = isParent ? 'parent-label' : 'child-label';
13793
13805
  const marginClass = isParent ? 'parent-margin' : 'child-margin';
13794
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.5",
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-19T15:48:15.845Z",
4
- "sourceCommit": "a7f4a980305903c0abae4128f5d5e5e6bd9c6360",
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;