@remoteoss/json-schema-form 0.11.15-beta.0 → 0.12.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ #### 0.12.0-beta.0 (2025-06-25)
2
+
3
+ ##### New Features
4
+
5
+ * allow select fields to be made from anyOf ([#197](https://github.com/remoteoss/json-schema-form/pull/197)) ([d5da6ae8](https://github.com/remoteoss/json-schema-form/commit/d5da6ae8816a28c8b0011fc699bf351078d6f437))
6
+
1
7
  #### 0.11.15-beta.0 (2025-06-06)
2
8
 
3
9
  ##### Bug Fixes
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2025 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.15-beta.0
5
- Generated: Fri, 06 Jun 2025 13:25:38 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.0-beta.0
5
+ Generated: Wed, 25 Jun 2025 12:45:39 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1456,8 +1456,8 @@ function getFieldOptions(node, presentation) {
1456
1456
  if (presentation.options) {
1457
1457
  return presentation.options;
1458
1458
  }
1459
- if (node.oneOf || presentation.inputType === "radio") {
1460
- return convertToOptions(node.oneOf || []);
1459
+ if (node.oneOf || node.anyOf || presentation.inputType === "radio") {
1460
+ return convertToOptions(node.oneOf || node.anyOf || []);
1461
1461
  }
1462
1462
  if (node.items?.anyOf) {
1463
1463
  return convertToOptions(node.items.anyOf);
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2025 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.15-beta.0
5
- Generated: Fri, 06 Jun 2025 13:25:38 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.0-beta.0
5
+ Generated: Wed, 25 Jun 2025 12:45:39 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1419,8 +1419,8 @@ function getFieldOptions(node, presentation) {
1419
1419
  if (presentation.options) {
1420
1420
  return presentation.options;
1421
1421
  }
1422
- if (node.oneOf || presentation.inputType === "radio") {
1423
- return convertToOptions(node.oneOf || []);
1422
+ if (node.oneOf || node.anyOf || presentation.inputType === "radio") {
1423
+ return convertToOptions(node.oneOf || node.anyOf || []);
1424
1424
  }
1425
1425
  if (node.items?.anyOf) {
1426
1426
  return convertToOptions(node.items.anyOf);
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2025 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.15-beta.0
5
- Generated: Fri, 06 Jun 2025 13:25:38 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.0-beta.0
5
+ Generated: Wed, 25 Jun 2025 12:45:39 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12935,8 +12935,8 @@ function getFieldOptions(node, presentation) {
12935
12935
  if (presentation.options) {
12936
12936
  return presentation.options;
12937
12937
  }
12938
- if (node.oneOf || presentation.inputType === "radio") {
12939
- return convertToOptions(node.oneOf || []);
12938
+ if (node.oneOf || node.anyOf || presentation.inputType === "radio") {
12939
+ return convertToOptions(node.oneOf || node.anyOf || []);
12940
12940
  }
12941
12941
  if (node.items?.anyOf) {
12942
12942
  return convertToOptions(node.items.anyOf);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.11.15-beta.0",
3
+ "version": "0.12.0-beta.0",
4
4
  "description": "Headless UI form powered by JSON Schemas",
5
5
  "author": "Remote.com <engineering@remote.com> (https://remote.com/)",
6
6
  "license": "MIT",
@@ -571,6 +571,44 @@ describe('createHeadlessForm', () => {
571
571
  });
572
572
  });
573
573
 
574
+ it('support "select" field type from anyOf', () => {
575
+ const schema = {
576
+ type: 'object',
577
+ properties: {
578
+ browser: {
579
+ type: 'string',
580
+ anyOf: [
581
+ { title: 'Chrome', const: 'chr' },
582
+ { title: 'Firefox', const: 'ff' },
583
+ { title: 'Add new option', pattern: '.*' },
584
+ ],
585
+ 'x-jsf-presentation': {
586
+ inputType: 'select',
587
+ },
588
+ },
589
+ },
590
+ };
591
+
592
+ const { fields } = createHeadlessForm(schema);
593
+ const fieldSelect = fields[0];
594
+ expect(fieldSelect).toMatchObject({
595
+ options: [
596
+ {
597
+ value: 'chr',
598
+ label: 'Chrome',
599
+ },
600
+ {
601
+ value: 'ff',
602
+ label: 'Firefox',
603
+ },
604
+ {
605
+ label: 'Add new option',
606
+ pattern: '.*',
607
+ },
608
+ ],
609
+ });
610
+ });
611
+
574
612
  it('supports "select" field type with multiple options @deprecated', () => {
575
613
  const result = createHeadlessForm(schemaInputTypeSelectMultipleDeprecated);
576
614
  expect(result).toMatchObject({