@remoteoss/json-schema-form 0.12.1-dev.20250929100600 → 0.12.1-dev.20251008013953

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/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.12.1-dev.20250929100600
5
- Generated: Mon, 29 Sep 2025 10:07:37 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.1-dev.20251008013953
5
+ Generated: Wed, 08 Oct 2025 01:40:15 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -737,7 +737,9 @@ function buildYupSchema(field, config, logic) {
737
737
  const fieldSetShape = {};
738
738
  innerFields.forEach((fieldSetfield) => {
739
739
  if (fieldSetfield.fields) {
740
- fieldSetShape[fieldSetfield.name] = (0, import_yup.object)().shape(buildFieldSetSchema(fieldSetfield.fields)).nullable();
740
+ fieldSetShape[fieldSetfield.name] = (0, import_yup.object)().shape(
741
+ buildFieldSetSchema(fieldSetfield.fields)
742
+ );
741
743
  } else {
742
744
  fieldSetShape[fieldSetfield.name] = buildYupSchema(
743
745
  {
@@ -1264,30 +1266,6 @@ function getPrefillValues(fields, initialValues = {}) {
1264
1266
  });
1265
1267
  return initialValues;
1266
1268
  }
1267
- function preserveNestedFieldsVisibility(field, parentPath = "") {
1268
- return field.fields?.reduce?.((acc, f) => {
1269
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
1270
- if (!(0, import_isNil.default)(f.isVisible)) {
1271
- acc[path] = f.isVisible;
1272
- }
1273
- if (f.fields) {
1274
- Object.assign(acc, preserveNestedFieldsVisibility(f, path));
1275
- }
1276
- return acc;
1277
- }, {});
1278
- }
1279
- function restoreNestedFieldsVisibility(field, nestedFieldsVisibility, parentPath = "") {
1280
- field.fields.forEach((f) => {
1281
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
1282
- const visibility = (0, import_get2.default)(nestedFieldsVisibility, path);
1283
- if (!(0, import_isNil.default)(visibility)) {
1284
- f.isVisible = visibility;
1285
- }
1286
- if (f.fields) {
1287
- restoreNestedFieldsVisibility(f, nestedFieldsVisibility, path);
1288
- }
1289
- });
1290
- }
1291
1269
  function updateField(field, requiredFields, node, formValues, logic, config) {
1292
1270
  if (!field) {
1293
1271
  return;
@@ -1299,13 +1277,9 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1299
1277
  if (fieldIsRequired) {
1300
1278
  field.isVisible = true;
1301
1279
  }
1302
- const nestedFieldsVisibility = preserveNestedFieldsVisibility(field);
1303
1280
  const updateAttributes = (fieldAttrs) => {
1304
1281
  Object.entries(fieldAttrs).forEach(([key, value]) => {
1305
1282
  field[key] = value;
1306
- if (key === "fields" && !(0, import_isNil.default)(nestedFieldsVisibility)) {
1307
- restoreNestedFieldsVisibility(field, nestedFieldsVisibility);
1308
- }
1309
1283
  if (key === "schema" && typeof value === "function") {
1310
1284
  field[key] = value();
1311
1285
  }
@@ -1357,19 +1331,9 @@ function processNode({
1357
1331
  logic
1358
1332
  }) {
1359
1333
  const requiredFields = new Set(accRequired);
1360
- Object.entries(node.properties ?? []).forEach(([fieldName, nestedNode]) => {
1334
+ Object.keys(node.properties ?? []).forEach((fieldName) => {
1361
1335
  const field = getField(fieldName, formFields);
1362
1336
  updateField(field, requiredFields, node, formValues, logic, { parentID });
1363
- const isFieldset = field?.inputType === supportedTypes.FIELDSET;
1364
- if (isFieldset) {
1365
- processNode({
1366
- node: nestedNode,
1367
- formValues: formValues[fieldName] || {},
1368
- formFields: field.fields,
1369
- parentID,
1370
- logic
1371
- });
1372
- }
1373
1337
  });
1374
1338
  node.required?.forEach((fieldName) => {
1375
1339
  requiredFields.add(fieldName);
@@ -1427,6 +1391,20 @@ function processNode({
1427
1391
  allOfItemRequired.forEach(requiredFields.add, requiredFields);
1428
1392
  });
1429
1393
  }
1394
+ if (node.properties) {
1395
+ Object.entries(node.properties).forEach(([name, nestedNode]) => {
1396
+ const inputType = getInputType(nestedNode);
1397
+ if (inputType === supportedTypes.FIELDSET) {
1398
+ processNode({
1399
+ node: nestedNode,
1400
+ formValues: formValues[name] || {},
1401
+ formFields: getField(name, formFields).fields,
1402
+ parentID: name,
1403
+ logic
1404
+ });
1405
+ }
1406
+ });
1407
+ }
1430
1408
  if (node["x-jsf-logic"]) {
1431
1409
  const { required: requiredFromLogic } = processJSONLogicNode({
1432
1410
  node: node["x-jsf-logic"],
@@ -1535,7 +1513,7 @@ function extractParametersFromNode(schemaNode) {
1535
1513
  // — For checkboxes that only accept one value (string)
1536
1514
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
1537
1515
  // - For checkboxes with boolean value
1538
- ...presentation?.inputType === "checkbox" && node.type === "boolean" && {
1516
+ ...presentation?.inputType === "checkbox" && hasType(node.type, "boolean") && {
1539
1517
  // true is what describes this checkbox as a boolean, regardless if its required or not
1540
1518
  checkboxValue: true
1541
1519
  },
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.12.1-dev.20250929100600
5
- Generated: Mon, 29 Sep 2025 10:07:37 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.1-dev.20251008013953
5
+ Generated: Wed, 08 Oct 2025 01:40:15 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -699,7 +699,9 @@ function buildYupSchema(field, config, logic) {
699
699
  const fieldSetShape = {};
700
700
  innerFields.forEach((fieldSetfield) => {
701
701
  if (fieldSetfield.fields) {
702
- fieldSetShape[fieldSetfield.name] = object().shape(buildFieldSetSchema(fieldSetfield.fields)).nullable();
702
+ fieldSetShape[fieldSetfield.name] = object().shape(
703
+ buildFieldSetSchema(fieldSetfield.fields)
704
+ );
703
705
  } else {
704
706
  fieldSetShape[fieldSetfield.name] = buildYupSchema(
705
707
  {
@@ -1226,30 +1228,6 @@ function getPrefillValues(fields, initialValues = {}) {
1226
1228
  });
1227
1229
  return initialValues;
1228
1230
  }
1229
- function preserveNestedFieldsVisibility(field, parentPath = "") {
1230
- return field.fields?.reduce?.((acc, f) => {
1231
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
1232
- if (!isNil(f.isVisible)) {
1233
- acc[path] = f.isVisible;
1234
- }
1235
- if (f.fields) {
1236
- Object.assign(acc, preserveNestedFieldsVisibility(f, path));
1237
- }
1238
- return acc;
1239
- }, {});
1240
- }
1241
- function restoreNestedFieldsVisibility(field, nestedFieldsVisibility, parentPath = "") {
1242
- field.fields.forEach((f) => {
1243
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
1244
- const visibility = get2(nestedFieldsVisibility, path);
1245
- if (!isNil(visibility)) {
1246
- f.isVisible = visibility;
1247
- }
1248
- if (f.fields) {
1249
- restoreNestedFieldsVisibility(f, nestedFieldsVisibility, path);
1250
- }
1251
- });
1252
- }
1253
1231
  function updateField(field, requiredFields, node, formValues, logic, config) {
1254
1232
  if (!field) {
1255
1233
  return;
@@ -1261,13 +1239,9 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1261
1239
  if (fieldIsRequired) {
1262
1240
  field.isVisible = true;
1263
1241
  }
1264
- const nestedFieldsVisibility = preserveNestedFieldsVisibility(field);
1265
1242
  const updateAttributes = (fieldAttrs) => {
1266
1243
  Object.entries(fieldAttrs).forEach(([key, value]) => {
1267
1244
  field[key] = value;
1268
- if (key === "fields" && !isNil(nestedFieldsVisibility)) {
1269
- restoreNestedFieldsVisibility(field, nestedFieldsVisibility);
1270
- }
1271
1245
  if (key === "schema" && typeof value === "function") {
1272
1246
  field[key] = value();
1273
1247
  }
@@ -1319,19 +1293,9 @@ function processNode({
1319
1293
  logic
1320
1294
  }) {
1321
1295
  const requiredFields = new Set(accRequired);
1322
- Object.entries(node.properties ?? []).forEach(([fieldName, nestedNode]) => {
1296
+ Object.keys(node.properties ?? []).forEach((fieldName) => {
1323
1297
  const field = getField(fieldName, formFields);
1324
1298
  updateField(field, requiredFields, node, formValues, logic, { parentID });
1325
- const isFieldset = field?.inputType === supportedTypes.FIELDSET;
1326
- if (isFieldset) {
1327
- processNode({
1328
- node: nestedNode,
1329
- formValues: formValues[fieldName] || {},
1330
- formFields: field.fields,
1331
- parentID,
1332
- logic
1333
- });
1334
- }
1335
1299
  });
1336
1300
  node.required?.forEach((fieldName) => {
1337
1301
  requiredFields.add(fieldName);
@@ -1389,6 +1353,20 @@ function processNode({
1389
1353
  allOfItemRequired.forEach(requiredFields.add, requiredFields);
1390
1354
  });
1391
1355
  }
1356
+ if (node.properties) {
1357
+ Object.entries(node.properties).forEach(([name, nestedNode]) => {
1358
+ const inputType = getInputType(nestedNode);
1359
+ if (inputType === supportedTypes.FIELDSET) {
1360
+ processNode({
1361
+ node: nestedNode,
1362
+ formValues: formValues[name] || {},
1363
+ formFields: getField(name, formFields).fields,
1364
+ parentID: name,
1365
+ logic
1366
+ });
1367
+ }
1368
+ });
1369
+ }
1392
1370
  if (node["x-jsf-logic"]) {
1393
1371
  const { required: requiredFromLogic } = processJSONLogicNode({
1394
1372
  node: node["x-jsf-logic"],
@@ -1497,7 +1475,7 @@ function extractParametersFromNode(schemaNode) {
1497
1475
  // — For checkboxes that only accept one value (string)
1498
1476
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
1499
1477
  // - For checkboxes with boolean value
1500
- ...presentation?.inputType === "checkbox" && node.type === "boolean" && {
1478
+ ...presentation?.inputType === "checkbox" && hasType(node.type, "boolean") && {
1501
1479
  // true is what describes this checkbox as a boolean, regardless if its required or not
1502
1480
  checkboxValue: true
1503
1481
  },
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2025 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.12.1-dev.20250929100600
5
- Generated: Mon, 29 Sep 2025 10:07:37 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.12.1-dev.20251008013953
5
+ Generated: Wed, 08 Oct 2025 01:40:15 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12215,7 +12215,9 @@ function buildYupSchema(field, config, logic) {
12215
12215
  const fieldSetShape = {};
12216
12216
  innerFields.forEach((fieldSetfield) => {
12217
12217
  if (fieldSetfield.fields) {
12218
- fieldSetShape[fieldSetfield.name] = ObjectSchema().shape(buildFieldSetSchema(fieldSetfield.fields)).nullable();
12218
+ fieldSetShape[fieldSetfield.name] = ObjectSchema().shape(
12219
+ buildFieldSetSchema(fieldSetfield.fields)
12220
+ );
12219
12221
  } else {
12220
12222
  fieldSetShape[fieldSetfield.name] = buildYupSchema(
12221
12223
  {
@@ -12742,30 +12744,6 @@ function getPrefillValues(fields, initialValues = {}) {
12742
12744
  });
12743
12745
  return initialValues;
12744
12746
  }
12745
- function preserveNestedFieldsVisibility(field, parentPath = "") {
12746
- return field.fields?.reduce?.((acc, f) => {
12747
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
12748
- if (!(0, import_isNil.default)(f.isVisible)) {
12749
- acc[path] = f.isVisible;
12750
- }
12751
- if (f.fields) {
12752
- Object.assign(acc, preserveNestedFieldsVisibility(f, path));
12753
- }
12754
- return acc;
12755
- }, {});
12756
- }
12757
- function restoreNestedFieldsVisibility(field, nestedFieldsVisibility, parentPath = "") {
12758
- field.fields.forEach((f) => {
12759
- const path = parentPath ? `${parentPath}.${f.name}` : f.name;
12760
- const visibility = (0, import_get3.default)(nestedFieldsVisibility, path);
12761
- if (!(0, import_isNil.default)(visibility)) {
12762
- f.isVisible = visibility;
12763
- }
12764
- if (f.fields) {
12765
- restoreNestedFieldsVisibility(f, nestedFieldsVisibility, path);
12766
- }
12767
- });
12768
- }
12769
12747
  function updateField(field, requiredFields, node, formValues, logic, config) {
12770
12748
  if (!field) {
12771
12749
  return;
@@ -12777,13 +12755,9 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
12777
12755
  if (fieldIsRequired) {
12778
12756
  field.isVisible = true;
12779
12757
  }
12780
- const nestedFieldsVisibility = preserveNestedFieldsVisibility(field);
12781
12758
  const updateAttributes = (fieldAttrs) => {
12782
12759
  Object.entries(fieldAttrs).forEach(([key, value]) => {
12783
12760
  field[key] = value;
12784
- if (key === "fields" && !(0, import_isNil.default)(nestedFieldsVisibility)) {
12785
- restoreNestedFieldsVisibility(field, nestedFieldsVisibility);
12786
- }
12787
12761
  if (key === "schema" && typeof value === "function") {
12788
12762
  field[key] = value();
12789
12763
  }
@@ -12835,19 +12809,9 @@ function processNode({
12835
12809
  logic
12836
12810
  }) {
12837
12811
  const requiredFields = new Set(accRequired);
12838
- Object.entries(node.properties ?? []).forEach(([fieldName, nestedNode]) => {
12812
+ Object.keys(node.properties ?? []).forEach((fieldName) => {
12839
12813
  const field = getField(fieldName, formFields);
12840
12814
  updateField(field, requiredFields, node, formValues, logic, { parentID });
12841
- const isFieldset = field?.inputType === supportedTypes.FIELDSET;
12842
- if (isFieldset) {
12843
- processNode({
12844
- node: nestedNode,
12845
- formValues: formValues[fieldName] || {},
12846
- formFields: field.fields,
12847
- parentID,
12848
- logic
12849
- });
12850
- }
12851
12815
  });
12852
12816
  node.required?.forEach((fieldName) => {
12853
12817
  requiredFields.add(fieldName);
@@ -12905,6 +12869,20 @@ function processNode({
12905
12869
  allOfItemRequired.forEach(requiredFields.add, requiredFields);
12906
12870
  });
12907
12871
  }
12872
+ if (node.properties) {
12873
+ Object.entries(node.properties).forEach(([name, nestedNode]) => {
12874
+ const inputType = getInputType(nestedNode);
12875
+ if (inputType === supportedTypes.FIELDSET) {
12876
+ processNode({
12877
+ node: nestedNode,
12878
+ formValues: formValues[name] || {},
12879
+ formFields: getField(name, formFields).fields,
12880
+ parentID: name,
12881
+ logic
12882
+ });
12883
+ }
12884
+ });
12885
+ }
12908
12886
  if (node["x-jsf-logic"]) {
12909
12887
  const { required: requiredFromLogic } = processJSONLogicNode({
12910
12888
  node: node["x-jsf-logic"],
@@ -13013,7 +12991,7 @@ function extractParametersFromNode(schemaNode) {
13013
12991
  // — For checkboxes that only accept one value (string)
13014
12992
  ...presentation?.inputType === "checkbox" && { checkboxValue: node.const },
13015
12993
  // - For checkboxes with boolean value
13016
- ...presentation?.inputType === "checkbox" && node.type === "boolean" && {
12994
+ ...presentation?.inputType === "checkbox" && hasType(node.type, "boolean") && {
13017
12995
  // true is what describes this checkbox as a boolean, regardless if its required or not
13018
12996
  checkboxValue: true
13019
12997
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.12.1-dev.20250929100600",
3
+ "version": "0.12.1-dev.20251008013953",
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",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "lint-staged": {
45
45
  "*.{js,jsx}": [
46
- "npm run format --prefix ./v0"
46
+ "npm run format"
47
47
  ]
48
48
  },
49
49
  "dependencies": {
@@ -63,7 +63,6 @@ import {
63
63
  schemaForErrorMessageSpecificity,
64
64
  jsfConfigForErrorMessageSpecificity,
65
65
  schemaInputTypeFile,
66
- schemaWithNestedFieldsetsConditionals,
67
66
  } from './helpers';
68
67
  import { mockConsole, restoreConsoleAndEnsureItWasNotCalled } from './testUtils';
69
68
  import { createHeadlessForm } from '@/createHeadlessForm';
@@ -2201,112 +2200,6 @@ describe('createHeadlessForm', () => {
2201
2200
  ).toBeUndefined();
2202
2201
  });
2203
2202
  });
2204
-
2205
- describe('supports conditionals over nested fieldsets', () => {
2206
- it('retirement_plan fieldset is hidden when no values are provided', () => {
2207
- const { fields, handleValidation } = createHeadlessForm(
2208
- schemaWithNestedFieldsetsConditionals,
2209
- {}
2210
- );
2211
- const validateForm = (vals) => friendlyError(handleValidation(vals));
2212
-
2213
- expect(getField(fields, 'perks', 'retirement_plan').isVisible).toBe(false);
2214
-
2215
- expect(validateForm({ perks: {} })).toEqual({
2216
- perks: {
2217
- benefits_package: 'Required field',
2218
- has_retirement_plan: 'Required field',
2219
- },
2220
- });
2221
-
2222
- expect(getField(fields, 'perks', 'retirement_plan').isVisible).toBe(false);
2223
- });
2224
-
2225
- it("submits without retirement_plan when user selects 'no' for has_retirement_plan", () => {
2226
- const { fields, handleValidation } = createHeadlessForm(
2227
- schemaWithNestedFieldsetsConditionals,
2228
- {}
2229
- );
2230
- const validateForm = (vals) => friendlyError(handleValidation(vals));
2231
-
2232
- expect(
2233
- validateForm({ perks: { benefits_package: 'basic', has_retirement_plan: 'no' } })
2234
- ).toBeUndefined();
2235
-
2236
- expect(getField(fields, 'perks', 'retirement_plan').isVisible).toBe(false);
2237
- });
2238
-
2239
- it("retirement_plan fieldset is visible when user selects 'yes' for has_retirement_plan", () => {
2240
- const { fields, handleValidation } = createHeadlessForm(
2241
- schemaWithNestedFieldsetsConditionals,
2242
- {}
2243
- );
2244
- const validateForm = (vals) => friendlyError(handleValidation(vals));
2245
-
2246
- expect(
2247
- validateForm({
2248
- perks: {
2249
- benefits_package: 'basic',
2250
- has_retirement_plan: 'yes',
2251
- declare_amount: 'yes',
2252
- retirement_plan: { plan_name: 'test', year: 2025 },
2253
- },
2254
- })
2255
- ).toEqual({
2256
- perks: {
2257
- retirement_plan: {
2258
- amount: 'Required field',
2259
- },
2260
- },
2261
- });
2262
-
2263
- expect(getField(fields, 'perks', 'retirement_plan').isVisible).toBe(true);
2264
- expect(getField(fields, 'perks', 'declare_amount').isVisible).toBe(true);
2265
- expect(getField(fields, 'perks', 'declare_amount').default).toBe('yes');
2266
- expect(getField(fields, 'perks', 'retirement_plan', 'amount').isVisible).toBe(true);
2267
- });
2268
-
2269
- it("retirement_plan's amount field is hidden when user selects 'no' for declare_amount", () => {
2270
- const { fields, handleValidation } = createHeadlessForm(
2271
- schemaWithNestedFieldsetsConditionals,
2272
- {}
2273
- );
2274
- const validateForm = (vals) => friendlyError(handleValidation(vals));
2275
-
2276
- expect(
2277
- validateForm({
2278
- perks: {
2279
- benefits_package: 'basic',
2280
- has_retirement_plan: 'yes',
2281
- declare_amount: 'no',
2282
- retirement_plan: { plan_name: 'test', year: 2025 },
2283
- },
2284
- })
2285
- ).toBeUndefined();
2286
-
2287
- expect(getField(fields, 'perks', 'retirement_plan').isVisible).toBe(true);
2288
- expect(getField(fields, 'perks', 'declare_amount').isVisible).toBe(true);
2289
- expect(getField(fields, 'perks', 'retirement_plan', 'amount').isVisible).toBe(false);
2290
- });
2291
-
2292
- it('submits with valid retirement_plan', async () => {
2293
- const { handleValidation } = createHeadlessForm(
2294
- schemaWithNestedFieldsetsConditionals,
2295
- {}
2296
- );
2297
- const validateForm = (vals) => friendlyError(handleValidation(vals));
2298
-
2299
- expect(
2300
- validateForm({
2301
- perks: {
2302
- benefits_package: 'plus',
2303
- has_retirement_plan: 'yes',
2304
- retirement_plan: { plan_name: 'test', year: 2025, amount: 1000 },
2305
- },
2306
- })
2307
- ).toBeUndefined();
2308
- });
2309
- });
2310
2203
  });
2311
2204
 
2312
2205
  it('support "email" field type', () => {
@@ -2434,6 +2327,28 @@ describe('createHeadlessForm', () => {
2434
2327
  // Explained at "Given values from hidden fields, it does not thrown an error"
2435
2328
  expect(handleValidation({ has_pet: false, pet_is_cat: true }).formErrors).toBeUndefined();
2436
2329
  });
2330
+
2331
+ it('should set checkboxValue: true for optional boolean type', () => {
2332
+ const schema = {
2333
+ type: 'object',
2334
+ properties: {
2335
+ boolean_checkbox: {
2336
+ title: 'Boolean Checkbox Test',
2337
+ type: ['boolean', 'null'],
2338
+ 'x-jsf-presentation': {
2339
+ inputType: 'checkbox',
2340
+ },
2341
+ },
2342
+ },
2343
+ required: [],
2344
+ };
2345
+
2346
+ const result = createHeadlessForm(schema);
2347
+
2348
+ const [optionalCheckbox] = result.fields;
2349
+ expect(optionalCheckbox?.inputType).toBe('checkbox');
2350
+ expect(optionalCheckbox?.checkboxValue).toBe(true);
2351
+ });
2437
2352
  });
2438
2353
  });
2439
2354
 
@@ -1939,6 +1939,7 @@ export const schemaWithConditionalToFieldset = {
1939
1939
  then: {
1940
1940
  properties: {
1941
1941
  pto: {
1942
+ $comment: '@BUG: This description does not disappear once activated.',
1942
1943
  description: 'Above 30 hours, the PTO needs to be at least 20 days.',
1943
1944
  minimum: 20,
1944
1945
  },
@@ -1971,178 +1972,6 @@ export const schemaWithConditionalToFieldset = {
1971
1972
  required: ['perks', 'work_hours_per_week'],
1972
1973
  };
1973
1974
 
1974
- export const schemaWithNestedFieldsetsConditionals = {
1975
- additionalProperties: false,
1976
- type: 'object',
1977
- properties: {
1978
- perks: {
1979
- additionalProperties: false,
1980
- properties: {
1981
- benefits_package: {
1982
- oneOf: [
1983
- {
1984
- const: 'basic',
1985
- title: 'Basic',
1986
- },
1987
- {
1988
- const: 'plus',
1989
- title: 'Plus',
1990
- },
1991
- ],
1992
- title: 'Benefits package',
1993
- type: 'string',
1994
- 'x-jsf-presentation': {
1995
- inputType: 'radio',
1996
- },
1997
- },
1998
- has_retirement_plan: {
1999
- oneOf: [
2000
- {
2001
- const: 'yes',
2002
- title: 'Yes',
2003
- },
2004
- {
2005
- const: 'no',
2006
- title: 'No',
2007
- },
2008
- ],
2009
- title: 'Has retirement plan?',
2010
- type: 'string',
2011
- 'x-jsf-presentation': {
2012
- inputType: 'radio',
2013
- },
2014
- },
2015
- declare_amount: {
2016
- oneOf: [
2017
- {
2018
- const: 'yes',
2019
- title: 'Yes',
2020
- },
2021
- {
2022
- const: 'no',
2023
- title: 'No',
2024
- },
2025
- ],
2026
- title: 'Declare retirement amount?',
2027
- type: 'string',
2028
- default: 'yes',
2029
- 'x-jsf-presentation': {
2030
- inputType: 'radio',
2031
- },
2032
- },
2033
- retirement_plan: {
2034
- type: 'object',
2035
- title: 'Retirement plan',
2036
- properties: {
2037
- plan_name: {
2038
- type: 'string',
2039
- title: 'Plan name',
2040
- },
2041
- year: {
2042
- type: 'number',
2043
- title: 'Year',
2044
- },
2045
- amount: {
2046
- type: 'number',
2047
- title: 'Amount',
2048
- },
2049
- },
2050
- required: ['plan_name', 'year'],
2051
- 'x-jsf-presentation': {
2052
- inputType: 'fieldset',
2053
- },
2054
- },
2055
- },
2056
- required: ['benefits_package', 'has_retirement_plan'],
2057
- title: 'Perks',
2058
- type: 'object',
2059
- 'x-jsf-presentation': {
2060
- inputType: 'fieldset',
2061
- },
2062
- },
2063
- },
2064
- allOf: [
2065
- {
2066
- if: {
2067
- properties: {
2068
- perks: {
2069
- properties: {
2070
- has_retirement_plan: {
2071
- const: 'no',
2072
- },
2073
- },
2074
- },
2075
- },
2076
- },
2077
- then: {
2078
- properties: {
2079
- perks: {
2080
- properties: {
2081
- retirement_plan: false,
2082
- declare_amount: false,
2083
- },
2084
- },
2085
- },
2086
- },
2087
- },
2088
- {
2089
- if: {
2090
- properties: {
2091
- perks: {
2092
- properties: {
2093
- declare_amount: {
2094
- const: 'no',
2095
- },
2096
- },
2097
- required: ['declare_amount'],
2098
- },
2099
- },
2100
- },
2101
- then: {
2102
- properties: {
2103
- perks: {
2104
- properties: {
2105
- retirement_plan: {
2106
- properties: {
2107
- amount: false,
2108
- },
2109
- },
2110
- },
2111
- },
2112
- },
2113
- },
2114
- },
2115
- {
2116
- if: {
2117
- properties: {
2118
- perks: {
2119
- properties: {
2120
- has_retirement_plan: {
2121
- const: 'yes',
2122
- },
2123
- declare_amount: {
2124
- const: 'yes',
2125
- },
2126
- },
2127
- required: ['has_retirement_plan', 'declare_amount'],
2128
- },
2129
- },
2130
- },
2131
- then: {
2132
- properties: {
2133
- perks: {
2134
- properties: {
2135
- retirement_plan: {
2136
- required: ['amount'],
2137
- },
2138
- },
2139
- },
2140
- },
2141
- },
2142
- },
2143
- ],
2144
- };
2145
-
2146
1975
  export const schemaWorkSchedule = {
2147
1976
  type: 'object',
2148
1977
  properties: {
File without changes