@abgov/jsonforms-components 2.58.2 → 2.58.4

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
@@ -6,7 +6,7 @@ import Ajv from 'ajv';
6
6
  import styled from 'styled-components';
7
7
  import axios from 'axios';
8
8
  import get$1 from 'lodash/get';
9
- import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, or, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
9
+ import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, or, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
10
10
  import * as _$c from 'lodash';
11
11
  import ___default, { isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
12
12
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
@@ -8315,7 +8315,7 @@ const BooleanRadioComponent = ({
8315
8315
  const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
8316
8316
  input: BooleanRadioComponent
8317
8317
  }));
8318
- const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
8318
+ const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, or(optionIs('format', 'radio'), optionIs('radio', true))));
8319
8319
  const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
8320
8320
 
8321
8321
  let _$9 = t => t,
@@ -12314,17 +12314,67 @@ const PrimitiveArrayControl = props => {
12314
12314
  const addItem = () => {
12315
12315
  handleChange(path, [...items, '']);
12316
12316
  };
12317
+ const getOptionValue = option => typeof option === 'string' ? option : option.const;
12318
+ const getOptionLabel = option => typeof option === 'string' ? option : option.title || option.const;
12319
+ const getOptionDescription = option => typeof option === 'string' ? undefined : option.description;
12317
12320
  const removeItem = index => {
12318
12321
  const copy = [...items];
12319
12322
  copy.splice(index, 1);
12320
12323
  handleChange(path, copy);
12321
12324
  };
12325
+ const getPrimitiveArrayOptions = schema => {
12326
+ const itemSchema = schema == null ? void 0 : schema.items;
12327
+ if (Array.isArray(itemSchema == null ? void 0 : itemSchema.oneOf)) {
12328
+ return itemSchema.oneOf;
12329
+ }
12330
+ if (Array.isArray(itemSchema == null ? void 0 : itemSchema.enum)) {
12331
+ return itemSchema.enum;
12332
+ }
12333
+ return [];
12334
+ };
12322
12335
  const itemUiSchema = Object.assign({}, uischema, {
12323
12336
  scope: '#'
12324
12337
  });
12338
+ const options = uischema.options || {};
12325
12339
  const label = (uischema == null ? void 0 : uischema.label) || (schema == null ? void 0 : schema.title) || 'Item';
12326
12340
  const arrayLabel = getLabelText(uischema.scope, label);
12327
12341
  const prettyLabel = pluralize.singular(arrayLabel.charAt(0).toLocaleUpperCase() + arrayLabel.slice(1));
12342
+ if (options.format === 'checkboxes') {
12343
+ const checkboxOptions = getPrimitiveArrayOptions(schema);
12344
+ return jsxs(Visible, {
12345
+ visible: visible,
12346
+ children: [jsx("h4", {
12347
+ children: prettyLabel
12348
+ }), jsx("div", {
12349
+ children: checkboxOptions.map(option => {
12350
+ const value = getOptionValue(option);
12351
+ const text = getOptionLabel(option);
12352
+ const description = getOptionDescription(option);
12353
+ const checked = items.includes(value);
12354
+ return jsx(GoabCheckbox, {
12355
+ name: value,
12356
+ value: value,
12357
+ text: text,
12358
+ description: description,
12359
+ checked: checked,
12360
+ disabled: !enabled,
12361
+ testId: `${value}-checkbox`,
12362
+ onChange: detail => {
12363
+ let newValue = [...items];
12364
+ if (detail.value) {
12365
+ if (!newValue.includes(value)) {
12366
+ newValue.push(value);
12367
+ }
12368
+ } else {
12369
+ newValue = newValue.filter(item => item !== value);
12370
+ }
12371
+ handleChange(path, newValue.length ? newValue : undefined);
12372
+ }
12373
+ }, value);
12374
+ })
12375
+ })]
12376
+ });
12377
+ }
12328
12378
  return jsxs(Visible, {
12329
12379
  visible: visible,
12330
12380
  children: [jsx("div", {
@@ -12336,6 +12386,10 @@ const PrimitiveArrayControl = props => {
12336
12386
  onClick: () => addItem(),
12337
12387
  children: ["Add ", prettyLabel]
12338
12388
  })
12389
+ }), jsx("pre", {
12390
+ children: JSON.stringify(schema.items, null, 2)
12391
+ }), jsx("pre", {
12392
+ children: JSON.stringify(itemUiSchema, null, 2)
12339
12393
  }), items.length === 0 && jsxs("p", {
12340
12394
  style: {
12341
12395
  opacity: 0.7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.58.2",
3
+ "version": "2.58.4",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-04-01T17:26:01.951Z",
4
- "sourceCommit": "29aae2716f1a5c05b00e4213c92ece4b2e44a7da",
3
+ "generatedAt": "2026-04-06T15:59:11.776Z",
4
+ "sourceCommit": "9a6e59e4af0b3b0d94b6f490f509009439cd97d8",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -375,6 +375,7 @@
375
375
  "type": "Control",
376
376
  "options": {
377
377
  "required": {
378
+ "format": "radio",
378
379
  "radio": true
379
380
  },
380
381
  "optional": {}