@abgov/jsonforms-components 2.34.1 → 2.36.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.
Files changed (2) hide show
  1. package/index.esm.js +89 -2
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -10447,7 +10447,31 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
10447
10447
  children: jsx(GoAFormItem, {
10448
10448
  error: (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : '',
10449
10449
  mb: errorRow && !error && '2xl' || 'xs',
10450
- children: dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
10450
+ children: dataObject.enum ? jsxs(GoADropdown, {
10451
+ id: schemaName,
10452
+ name: schemaName,
10453
+ value: currentData != null ? String(currentData) : '',
10454
+ testId: `#/properties/${schemaName}-select-${i}`,
10455
+ onChange: (name, value) => {
10456
+ const selectedValue = Array.isArray(value) ? value[0] : value;
10457
+ const coerced = dataObject.type === 'number' && selectedValue !== '' ? Number(selectedValue) : selectedValue;
10458
+ handleChange(rowPath, {
10459
+ [num]: {
10460
+ [schemaName]: coerced
10461
+ }
10462
+ });
10463
+ },
10464
+ width: "100%",
10465
+ ariaLabel: schemaName,
10466
+ error: !!(error === null || error === void 0 ? void 0 : error.message),
10467
+ children: [!(required === null || required === void 0 ? void 0 : required.includes(schemaName)) && jsx(GoADropdownItem, {
10468
+ value: "",
10469
+ label: `-- Select ${convertToSentenceCase(schemaName)} --`
10470
+ }), dataObject.enum.map(opt => jsx(GoADropdownItem, {
10471
+ value: String(opt),
10472
+ label: String(opt)
10473
+ }, String(opt)))]
10474
+ }) : dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
10451
10475
  error: (error === null || error === void 0 ? void 0 : error.message.length) > 0,
10452
10476
  type: dataObject.type === 'number' ? 'number' : 'text',
10453
10477
  id: schemaName,
@@ -10468,7 +10492,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
10468
10492
  size: "medium",
10469
10493
  testId: "form-support-callout",
10470
10494
  heading: "Not supported",
10471
- children: "Only string and number are supported inside arrays"
10495
+ children: "Only string, number, and enum are supported inside arrays"
10472
10496
  })
10473
10497
  })
10474
10498
  }, ix);
@@ -11715,6 +11739,69 @@ const HelpContentDiv = styled.div(_t$1 || (_t$1 = _$1`
11715
11739
  .single-line {
11716
11740
  margin: var(--goa-space-2xs) 0 var(--goa-space-2xs) 0;
11717
11741
  }
11742
+
11743
+ .help-content-markdown details {
11744
+ margin: 1.5rem 0 !important;
11745
+ font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif !important;
11746
+ }
11747
+
11748
+ .help-content-markdown details summary {
11749
+ font-size: 1.5em;
11750
+ font-weight: bold;
11751
+ color: red;
11752
+ list-style: none;
11753
+ cursor: pointer;
11754
+ position: relative;
11755
+ padding-left: 0;
11756
+ font-weight: 600;
11757
+ font-size: 1.125rem; /* 18px */
11758
+ color: #111827; /* gray-900 */
11759
+ user-select: none;
11760
+ border-left: 0; /* vertical line */
11761
+ }
11762
+
11763
+ .help-content-markdown details summary::before {
11764
+ content: '';
11765
+ display: inline-block;
11766
+ width: 1.25rem;
11767
+ height: 1.25rem;
11768
+ margin-right: 0.5rem;
11769
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M184 112l144 144-144 144'/></svg>");
11770
+ background-size: contain;
11771
+ background-repeat: no-repeat;
11772
+ transition: opacity 0.2s ease;
11773
+ }
11774
+
11775
+ .help-content-markdown details[open] summary::before {
11776
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M112 184l144 144 144-144'/></svg>");
11777
+ }
11778
+
11779
+ .help-content-markdown details[open] {
11780
+ margin-left: 1.75rem !important;
11781
+ }
11782
+ .help-content-markdown details[open] summary {
11783
+ margin-left: -1.75rem !important;
11784
+ }
11785
+
11786
+ .help-content-markdown details[open] {
11787
+ position: relative;
11788
+ }
11789
+
11790
+ .help-content-markdown details[open]::before {
11791
+ margin-left: -1.75rem !important;
11792
+ content: '';
11793
+ position: absolute;
11794
+ left: 0.6rem;
11795
+ top: 2.2rem;
11796
+ bottom: 0.5rem;
11797
+ width: 2px;
11798
+ background-color: #ccc;
11799
+ pointer-events: none;
11800
+ }
11801
+
11802
+ .help-content-markdown summary {
11803
+ text-decoration: underline;
11804
+ }
11718
11805
  `));
11719
11806
  const InvalidMarkdown = styled.div(_t2 || (_t2 = _$1`
11720
11807
  color: var(--goa-color-interactive-error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.34.1",
3
+ "version": "2.36.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",