@remoteoss/json-schema-form 0.6.6-beta.0 → 0.7.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,16 @@
1
+ #### 0.7.0-beta.0 (2023-10-23)
2
+
3
+ ##### Chores
4
+
5
+ BREAKING CHANGES:
6
+
7
+ - **Description/Extra/Statement fields:** We have removed the sorrounding spans that we output in these fields ([#17](https://github.com/remoteoss/json-schema-form/pull/27)) ([6257533](https://github.com/remoteoss/json-schema-form/commit/6257533bead9c0f7391f240c2e5bacc801a90af7))
8
+
9
+ ```diff
10
+ -description: '<span class="jsf-description">Write in <b>hh:ss</b> format</span>',
11
+ +description: 'Write in <b>hh:ss</b> format',
12
+ ```
13
+
1
14
  #### 0.6.6-beta.0 (2023-10-17)
2
15
 
3
16
  ##### Chores
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.6.6-beta.0
5
- Generated: Tue, 17 Oct 2023 13:38:25 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.0-beta.0
5
+ Generated: Mon, 23 Oct 2023 10:15:24 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -91,13 +91,6 @@ function convertDiskSizeFromTo(from, to) {
91
91
  return value * Math.pow(1024, units.indexOf(from.toLowerCase())) / Math.pow(1024, units.indexOf(to.toLowerCase()));
92
92
  };
93
93
  }
94
- function containsHTML(str = "") {
95
- return /<[a-z][\s\S]*>/i.test(str);
96
- }
97
- function wrapWithSpan(html, properties = {}) {
98
- const attributes = Object.entries(properties).reduce((acc, [key, value]) => `${acc}${key}="${value}" `, "").trim();
99
- return `<span ${attributes}>${html}</span>`;
100
- }
101
94
  function hasProperty(object2, propertyName) {
102
95
  return Object.prototype.hasOwnProperty.call(object2, propertyName);
103
96
  }
@@ -1329,7 +1322,7 @@ function extractParametersFromNode(schemaNode) {
1329
1322
  const decoratedComputedAttributes = getDecoratedComputedAttributes(computedAttributes);
1330
1323
  const node = (0, import_omit.default)(schemaNode, ["x-jsf-presentation", "presentation"]);
1331
1324
  const description = presentation?.description || node.description;
1332
- const statementDescription = containsHTML(presentation.statement?.description) ? wrapWithSpan(presentation.statement.description, { class: "jsf-statement" }) : presentation.statement?.description;
1325
+ const statementDescription = presentation.statement?.description;
1333
1326
  const value = typeof node.const !== "undefined" && typeof node.default !== "undefined" ? { value: node.const } : {};
1334
1327
  return (0, import_omitBy.default)(
1335
1328
  {
@@ -1371,10 +1364,8 @@ function extractParametersFromNode(schemaNode) {
1371
1364
  ...presentation,
1372
1365
  jsonLogicValidations,
1373
1366
  computedAttributes: decoratedComputedAttributes,
1374
- description: containsHTML(description) ? wrapWithSpan(description, {
1375
- class: "jsf-description"
1376
- }) : description,
1377
- extra: containsHTML(presentation.extra) ? wrapWithSpan(presentation.extra, { class: "jsf-extra" }) : presentation.extra,
1367
+ description,
1368
+ extra: presentation.extra,
1378
1369
  statement: presentation.statement && {
1379
1370
  ...presentation.statement,
1380
1371
  description: statementDescription
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.6.6-beta.0
5
- Generated: Tue, 17 Oct 2023 13:38:25 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.0-beta.0
5
+ Generated: Mon, 23 Oct 2023 10:15:24 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -55,13 +55,6 @@ function convertDiskSizeFromTo(from, to) {
55
55
  return value * Math.pow(1024, units.indexOf(from.toLowerCase())) / Math.pow(1024, units.indexOf(to.toLowerCase()));
56
56
  };
57
57
  }
58
- function containsHTML(str = "") {
59
- return /<[a-z][\s\S]*>/i.test(str);
60
- }
61
- function wrapWithSpan(html, properties = {}) {
62
- const attributes = Object.entries(properties).reduce((acc, [key, value]) => `${acc}${key}="${value}" `, "").trim();
63
- return `<span ${attributes}>${html}</span>`;
64
- }
65
58
  function hasProperty(object2, propertyName) {
66
59
  return Object.prototype.hasOwnProperty.call(object2, propertyName);
67
60
  }
@@ -1293,7 +1286,7 @@ function extractParametersFromNode(schemaNode) {
1293
1286
  const decoratedComputedAttributes = getDecoratedComputedAttributes(computedAttributes);
1294
1287
  const node = omit(schemaNode, ["x-jsf-presentation", "presentation"]);
1295
1288
  const description = presentation?.description || node.description;
1296
- const statementDescription = containsHTML(presentation.statement?.description) ? wrapWithSpan(presentation.statement.description, { class: "jsf-statement" }) : presentation.statement?.description;
1289
+ const statementDescription = presentation.statement?.description;
1297
1290
  const value = typeof node.const !== "undefined" && typeof node.default !== "undefined" ? { value: node.const } : {};
1298
1291
  return omitBy(
1299
1292
  {
@@ -1335,10 +1328,8 @@ function extractParametersFromNode(schemaNode) {
1335
1328
  ...presentation,
1336
1329
  jsonLogicValidations,
1337
1330
  computedAttributes: decoratedComputedAttributes,
1338
- description: containsHTML(description) ? wrapWithSpan(description, {
1339
- class: "jsf-description"
1340
- }) : description,
1341
- extra: containsHTML(presentation.extra) ? wrapWithSpan(presentation.extra, { class: "jsf-extra" }) : presentation.extra,
1331
+ description,
1332
+ extra: presentation.extra,
1342
1333
  statement: presentation.statement && {
1343
1334
  ...presentation.statement,
1344
1335
  description: statementDescription
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.6.6-beta.0
5
- Generated: Tue, 17 Oct 2023 13:38:25 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.0-beta.0
5
+ Generated: Mon, 23 Oct 2023 10:15:24 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -3577,7 +3577,7 @@ var require_property_expr = __commonJS({
3577
3577
  );
3578
3578
  }
3579
3579
  function split2(path) {
3580
- return path.match(SPLIT_REGEX);
3580
+ return path.match(SPLIT_REGEX) || [""];
3581
3581
  }
3582
3582
  function forEach2(parts, iter, thisArg) {
3583
3583
  var len = parts.length, part, idx, isArray2, isBracket;
@@ -6898,13 +6898,13 @@ function _extends() {
6898
6898
  }
6899
6899
 
6900
6900
  // node_modules/@babel/runtime/helpers/esm/typeof.js
6901
- function _typeof(obj) {
6901
+ function _typeof(o) {
6902
6902
  "@babel/helpers - typeof";
6903
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
6904
- return typeof obj2;
6905
- } : function(obj2) {
6906
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
6907
- }, _typeof(obj);
6903
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
6904
+ return typeof o2;
6905
+ } : function(o2) {
6906
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
6907
+ }, _typeof(o);
6908
6908
  }
6909
6909
 
6910
6910
  // node_modules/@babel/runtime/helpers/esm/toPrimitive.js
@@ -11410,13 +11410,6 @@ function convertDiskSizeFromTo(from2, to) {
11410
11410
  return value * Math.pow(1024, units.indexOf(from2.toLowerCase())) / Math.pow(1024, units.indexOf(to.toLowerCase()));
11411
11411
  };
11412
11412
  }
11413
- function containsHTML(str = "") {
11414
- return /<[a-z][\s\S]*>/i.test(str);
11415
- }
11416
- function wrapWithSpan(html, properties = {}) {
11417
- const attributes = Object.entries(properties).reduce((acc, [key, value]) => `${acc}${key}="${value}" `, "").trim();
11418
- return `<span ${attributes}>${html}</span>`;
11419
- }
11420
11413
  function hasProperty(object2, propertyName) {
11421
11414
  return Object.prototype.hasOwnProperty.call(object2, propertyName);
11422
11415
  }
@@ -12647,7 +12640,7 @@ function extractParametersFromNode(schemaNode) {
12647
12640
  const decoratedComputedAttributes = getDecoratedComputedAttributes(computedAttributes);
12648
12641
  const node = (0, import_omit.default)(schemaNode, ["x-jsf-presentation", "presentation"]);
12649
12642
  const description = presentation?.description || node.description;
12650
- const statementDescription = containsHTML(presentation.statement?.description) ? wrapWithSpan(presentation.statement.description, { class: "jsf-statement" }) : presentation.statement?.description;
12643
+ const statementDescription = presentation.statement?.description;
12651
12644
  const value = typeof node.const !== "undefined" && typeof node.default !== "undefined" ? { value: node.const } : {};
12652
12645
  return (0, import_omitBy.default)(
12653
12646
  {
@@ -12689,10 +12682,8 @@ function extractParametersFromNode(schemaNode) {
12689
12682
  ...presentation,
12690
12683
  jsonLogicValidations,
12691
12684
  computedAttributes: decoratedComputedAttributes,
12692
- description: containsHTML(description) ? wrapWithSpan(description, {
12693
- class: "jsf-description"
12694
- }) : description,
12695
- extra: containsHTML(presentation.extra) ? wrapWithSpan(presentation.extra, { class: "jsf-extra" }) : presentation.extra,
12685
+ description,
12686
+ extra: presentation.extra,
12696
12687
  statement: presentation.statement && {
12697
12688
  ...presentation.statement,
12698
12689
  description: statementDescription
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.6.6-beta.0",
3
+ "version": "0.7.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",
@@ -2040,10 +2040,7 @@ describe('createHeadlessForm', () => {
2040
2040
  });
2041
2041
 
2042
2042
  expect(result).toMatchObject({
2043
- fields: [
2044
- { description: 'I am regular' },
2045
- { description: '<span class="jsf-description">I am <b>bold</b>.</span>' },
2046
- ],
2043
+ fields: [{ description: 'I am regular' }, { description: 'I am <b>bold</b>.' }],
2047
2044
  });
2048
2045
  });
2049
2046
 
@@ -2502,7 +2499,7 @@ describe('createHeadlessForm', () => {
2502
2499
  });
2503
2500
 
2504
2501
  describe('when a field has conditional presentation properties', () => {
2505
- it('adds .jsf-statement to nested statement markup when visible', () => {
2502
+ it('returns the nested properties when the conditional matches', () => {
2506
2503
  const { fields } = createHeadlessForm(schemaWithConditionalPresentationProperties, {
2507
2504
  initialValues: {
2508
2505
  // show the hidden statement
@@ -2510,9 +2507,7 @@ describe('createHeadlessForm', () => {
2510
2507
  },
2511
2508
  });
2512
2509
 
2513
- expect(fields[0].statement.description).toBe(
2514
- `<span class="jsf-statement"><a href="">conditional statement markup</a></span>`
2515
- );
2510
+ expect(fields[0].statement.description).toBe(`<a href="">conditional statement markup</a>`);
2516
2511
  });
2517
2512
  });
2518
2513
 
@@ -3710,7 +3705,7 @@ describe('createHeadlessForm', () => {
3710
3705
  expect(fields).toMatchObject([
3711
3706
  {
3712
3707
  name: 'time',
3713
- description: '<span class="jsf-description">Write in <b>hh:ss</b> format</span>', // from presentation
3708
+ description: 'Write in <b>hh:ss</b> format', // from presentation
3714
3709
  inputType: 'clock', // arbitrary type from presentation
3715
3710
  deprecated: {
3716
3711
  description: 'In favor of X', // from presentation