@remoteoss/json-schema-form 0.10.0-beta.0 → 0.10.1-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.10.1-beta.0 (2024-07-23)
2
+
3
+ ##### Chores
4
+
5
+ * **Text field docs:** Change naming of ID number property ([#74](https://github.com/remoteoss/json-schema-form/pull/74)) ([338ddd2a](https://github.com/remoteoss/json-schema-form/commit/338ddd2a5f008ec089f38db834f075100b856001))
6
+
1
7
  #### 0.10.0-beta.0 (2024-06-20)
2
8
 
3
9
  Adds `modify` utility for better customizations ([#75](https://github.com/remoteoss/json-schema-form/pull/75))
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.10.0-beta.0
5
- Generated: Thu, 20 Jun 2024 10:37:49 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.10.1-beta.0
5
+ Generated: Tue, 23 Jul 2024 21:13:09 GMT
6
6
 
7
7
  MIT License
8
8
 
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.10.0-beta.0
5
- Generated: Thu, 20 Jun 2024 10:37:49 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.10.1-beta.0
5
+ Generated: Tue, 23 Jul 2024 21:13:09 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.10.0-beta.0
5
- Generated: Thu, 20 Jun 2024 10:37:49 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.10.1-beta.0
5
+ Generated: Tue, 23 Jul 2024 21:13:09 GMT
6
6
 
7
7
  MIT License
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.10.0-beta.0",
3
+ "version": "0.10.1-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",
@@ -467,9 +467,9 @@ describe('createHeadlessForm', () => {
467
467
  const { fields, handleValidation } = createHeadlessForm(schemaInputTypeText);
468
468
 
469
469
  expect(fields[0]).toMatchObject({
470
- description: 'The number of your national identification (max 10 digits)',
471
- label: 'ID number',
472
- name: 'id_number',
470
+ description: 'Your username (max 10 characters)',
471
+ label: 'Username',
472
+ name: 'username',
473
473
  required: true,
474
474
  schema: expect.any(Object),
475
475
  inputType: 'text',
@@ -485,8 +485,8 @@ describe('createHeadlessForm', () => {
485
485
  expect(fieldValidator.isValidSync(1)).toBe(false);
486
486
  expect(fieldValidator.isValidSync(0)).toBe(false);
487
487
 
488
- expect(handleValidation({ id_number: 1 }).formErrors).toEqual({
489
- id_number: 'id_number must be a `string` type, but the final value was: `1`.',
488
+ expect(handleValidation({ username: 1 }).formErrors).toEqual({
489
+ username: 'username must be a `string` type, but the final value was: `1`.',
490
490
  });
491
491
 
492
492
  expect(() => fieldValidator.validateSync('')).toThrowError('Required field');
@@ -496,20 +496,18 @@ describe('createHeadlessForm', () => {
496
496
  const resultsWithRootDescription = createHeadlessForm(
497
497
  JSONSchemaBuilder()
498
498
  .addInput({
499
- id_number: mockTextInput,
499
+ username: mockTextInput,
500
500
  })
501
- .setRequiredFields(['id_number'])
501
+ .setRequiredFields(['username'])
502
502
  .build()
503
503
  );
504
504
 
505
- expect(resultsWithRootDescription.fields[0].description).toMatch(
506
- /the number of your national/i
507
- );
505
+ expect(resultsWithRootDescription.fields[0].description).toMatch(/your username/i);
508
506
 
509
507
  const resultsWithPresentationDescription = createHeadlessForm(
510
508
  JSONSchemaBuilder()
511
509
  .addInput({
512
- id_number: {
510
+ username: {
513
511
  ...mockTextInput,
514
512
  'x-jsf-presentation': {
515
513
  inputType: 'text',
@@ -519,7 +517,7 @@ describe('createHeadlessForm', () => {
519
517
  },
520
518
  },
521
519
  })
522
- .setRequiredFields(['id_number'])
520
+ .setRequiredFields(['username'])
523
521
  .build()
524
522
  );
525
523
 
@@ -532,20 +530,18 @@ describe('createHeadlessForm', () => {
532
530
  const resultsWithRootDescription = createHeadlessForm(
533
531
  JSONSchemaBuilder()
534
532
  .addInput({
535
- id_number: mockTextInputDeprecated,
533
+ username: mockTextInputDeprecated,
536
534
  })
537
- .setRequiredFields(['id_number'])
535
+ .setRequiredFields(['username'])
538
536
  .build()
539
537
  );
540
538
 
541
- expect(resultsWithRootDescription.fields[0].description).toMatch(
542
- /the number of your national/i
543
- );
539
+ expect(resultsWithRootDescription.fields[0].description).toMatch(/your username/i);
544
540
 
545
541
  const resultsWithPresentationDescription = createHeadlessForm(
546
542
  JSONSchemaBuilder()
547
543
  .addInput({
548
- id_number: {
544
+ username: {
549
545
  ...mockTextInputDeprecated,
550
546
  presentation: {
551
547
  inputType: 'text',
@@ -555,7 +551,7 @@ describe('createHeadlessForm', () => {
555
551
  },
556
552
  },
557
553
  })
558
- .setRequiredFields(['id_number'])
554
+ .setRequiredFields(['username'])
559
555
  .build()
560
556
  );
561
557
 
@@ -1561,9 +1557,9 @@ describe('createHeadlessForm', () => {
1561
1557
  required: false,
1562
1558
  fields: [
1563
1559
  {
1564
- description: 'The number of your national identification (max 10 digits)',
1565
- label: 'ID number',
1566
- name: 'id_number',
1560
+ description: 'Your username (max 10 characters)',
1561
+ label: 'Username',
1562
+ name: 'username',
1567
1563
  type: 'text',
1568
1564
  required: true,
1569
1565
  },
@@ -1608,9 +1604,9 @@ describe('createHeadlessForm', () => {
1608
1604
  required: false,
1609
1605
  fields: [
1610
1606
  {
1611
- description: 'The number of your national identification (max 10 digits)',
1612
- label: 'ID number',
1613
- name: 'id_number',
1607
+ description: 'Your username (max 10 characters)',
1608
+ label: 'Username',
1609
+ name: 'username',
1614
1610
  type: 'text',
1615
1611
  required: true,
1616
1612
  },
@@ -2018,12 +2014,12 @@ describe('createHeadlessForm', () => {
2018
2014
 
2019
2015
  // Assert the yupError shape is really a YupError
2020
2016
  expect(yupError).toEqual(expect.any(Error));
2021
- expect(yupError.inner[0].path).toBe('id_number');
2017
+ expect(yupError.inner[0].path).toBe('username');
2022
2018
  expect(yupError.inner[0].message).toBe('Required field');
2023
2019
 
2024
2020
  // Assert the converted YupError to formErrors
2025
2021
  expect(formErrors).toEqual({
2026
- id_number: 'Required field',
2022
+ username: 'Required field',
2027
2023
  });
2028
2024
  });
2029
2025
  });
@@ -2812,7 +2808,7 @@ describe('createHeadlessForm', () => {
2812
2808
  validateForm({
2813
2809
  validate_tabs: 'no',
2814
2810
  a_fieldset: {
2815
- id_number: '123',
2811
+ username: 'abc',
2816
2812
  },
2817
2813
  mandatory_group_array: 'no',
2818
2814
  })
@@ -2827,7 +2823,7 @@ describe('createHeadlessForm', () => {
2827
2823
  validateForm({
2828
2824
  validate_tabs: 'yes',
2829
2825
  a_fieldset: {
2830
- id_number: '123',
2826
+ username: 'abc',
2831
2827
  },
2832
2828
  mandatory_group_array: 'no',
2833
2829
  })
@@ -2843,7 +2839,7 @@ describe('createHeadlessForm', () => {
2843
2839
  validateForm({
2844
2840
  validate_tabs: 'yes',
2845
2841
  a_fieldset: {
2846
- id_number: '123',
2842
+ username: 'abc',
2847
2843
  },
2848
2844
  mandatory_group_array: 'yes',
2849
2845
  a_group_array: [{ full_name: 'adfs' }],
@@ -2854,7 +2850,7 @@ describe('createHeadlessForm', () => {
2854
2850
  validateForm({
2855
2851
  validate_tabs: 'yes',
2856
2852
  a_fieldset: {
2857
- id_number: '123',
2853
+ username: 'abc',
2858
2854
  tabs: 2,
2859
2855
  },
2860
2856
  mandatory_group_array: 'no',
@@ -2943,18 +2939,18 @@ describe('createHeadlessForm', () => {
2943
2939
 
2944
2940
  expect(
2945
2941
  validateForm({
2946
- validate_fieldset: ['id_number'],
2942
+ validate_fieldset: ['username'],
2947
2943
  a_fieldset: {
2948
- id_number: '123',
2944
+ username: 'abc',
2949
2945
  },
2950
2946
  })
2951
2947
  ).toBeUndefined();
2952
2948
 
2953
2949
  expect(
2954
2950
  validateForm({
2955
- validate_fieldset: ['id_number', 'all'],
2951
+ validate_fieldset: ['username', 'all'],
2956
2952
  a_fieldset: {
2957
- id_number: '123',
2953
+ username: 'abc',
2958
2954
  },
2959
2955
  })
2960
2956
  ).toEqual({
@@ -2965,9 +2961,9 @@ describe('createHeadlessForm', () => {
2965
2961
 
2966
2962
  expect(
2967
2963
  validateForm({
2968
- validate_fieldset: ['id_number', 'all'],
2964
+ validate_fieldset: ['username', 'all'],
2969
2965
  a_fieldset: {
2970
- id_number: '123',
2966
+ username: 'abc',
2971
2967
  tabs: 2,
2972
2968
  },
2973
2969
  })
@@ -2980,18 +2976,18 @@ describe('createHeadlessForm', () => {
2980
2976
 
2981
2977
  expect(
2982
2978
  validateForm({
2983
- validate_fieldset: ['id_number'],
2979
+ validate_fieldset: ['username'],
2984
2980
  a_fieldset: {
2985
- id_number: '123',
2981
+ username: 'abc',
2986
2982
  },
2987
2983
  })
2988
2984
  ).toBeUndefined();
2989
2985
 
2990
2986
  expect(
2991
2987
  validateForm({
2992
- validate_fieldset: ['id_number', 'all'],
2988
+ validate_fieldset: ['username', 'all'],
2993
2989
  a_fieldset: {
2994
- id_number: '123',
2990
+ username: 'abc',
2995
2991
  },
2996
2992
  })
2997
2993
  ).toEqual({
@@ -3002,9 +2998,9 @@ describe('createHeadlessForm', () => {
3002
2998
 
3003
2999
  expect(
3004
3000
  validateForm({
3005
- validate_fieldset: ['id_number', 'all'],
3001
+ validate_fieldset: ['username', 'all'],
3006
3002
  a_fieldset: {
3007
- id_number: '123',
3003
+ username: 'abc',
3008
3004
  tabs: 2,
3009
3005
  },
3010
3006
  })
@@ -3584,7 +3580,7 @@ describe('createHeadlessForm', () => {
3584
3580
 
3585
3581
  // It returns fields without errors
3586
3582
  expect(result.fields).toBeDefined();
3587
- expect(result.fields[0].fields[0].name).toBe('id_number');
3583
+ expect(result.fields[0].fields[0].name).toBe('username');
3588
3584
  expect(result.fields[0].fields[1].name).toBe('tabs');
3589
3585
 
3590
3586
  // Warn about those missmatched values
@@ -3727,14 +3723,14 @@ describe('createHeadlessForm', () => {
3727
3723
  id_number: { 'data-field': 'field' },
3728
3724
  fieldset: {
3729
3725
  customProperties: {
3730
- id_number: { 'data-fieldset': 'fieldset' },
3726
+ username: { 'data-fieldset': 'fieldset' },
3731
3727
  },
3732
3728
  },
3733
3729
  nestedFieldset: {
3734
3730
  customProperties: {
3735
3731
  innerFieldset: {
3736
3732
  customProperties: {
3737
- id_number: { 'data-nested-fieldset': 'nested-fieldset' },
3733
+ username: { 'data-nested-fieldset': 'nested-fieldset' },
3738
3734
  },
3739
3735
  },
3740
3736
  },
@@ -3753,7 +3749,7 @@ describe('createHeadlessForm', () => {
3753
3749
  name: 'fieldset',
3754
3750
  fields: [
3755
3751
  {
3756
- name: 'id_number',
3752
+ name: 'username',
3757
3753
  'data-fieldset': 'fieldset',
3758
3754
  },
3759
3755
  {
@@ -3768,7 +3764,7 @@ describe('createHeadlessForm', () => {
3768
3764
  name: 'innerFieldset',
3769
3765
  fields: [
3770
3766
  {
3771
- name: 'id_number',
3767
+ name: 'username',
3772
3768
  'data-nested-fieldset': 'nested-fieldset',
3773
3769
  },
3774
3770
  {
@@ -3790,8 +3786,8 @@ describe('createHeadlessForm', () => {
3790
3786
  expect(fieldResult).not.toHaveProperty('data-fieldset');
3791
3787
  expect(fieldResult).not.toHaveProperty('data-nested-fieldset');
3792
3788
 
3793
- // $.fieldset.id_number
3794
- expect(fildsetResult.fields[0]).toHaveProperty('name', 'id_number');
3789
+ // $.fieldset.username
3790
+ expect(fildsetResult.fields[0]).toHaveProperty('name', 'username');
3795
3791
  expect(fildsetResult.fields[0]).toHaveProperty('data-fieldset', 'fieldset');
3796
3792
  expect(fildsetResult.fields[0]).not.toHaveProperty('data-field');
3797
3793
  expect(fildsetResult.fields[0]).not.toHaveProperty('data-nested-fieldset');
@@ -3799,7 +3795,7 @@ describe('createHeadlessForm', () => {
3799
3795
  expect(fildsetResult.fields[1]).not.toHaveProperty('data-nested-fieldset');
3800
3796
 
3801
3797
  // $.nestedFieldset.innerFieldset.id_number
3802
- expect(nestedFieldsetResult.fields[0].fields[0]).toHaveProperty('name', 'id_number');
3798
+ expect(nestedFieldsetResult.fields[0].fields[0]).toHaveProperty('name', 'username');
3803
3799
  expect(nestedFieldsetResult.fields[0].fields[0]).toHaveProperty(
3804
3800
  'data-nested-fieldset',
3805
3801
  'nested-fieldset'
@@ -3,8 +3,8 @@
3
3
  // -------------------------------------
4
4
 
5
5
  export const mockTextInput = {
6
- title: 'ID number',
7
- description: 'The number of your national identification (max 10 digits)',
6
+ title: 'Username',
7
+ description: 'Your username (max 10 characters)',
8
8
  maxLength: 10,
9
9
  'x-jsf-presentation': {
10
10
  inputType: 'text',
@@ -14,8 +14,8 @@ export const mockTextInput = {
14
14
  };
15
15
 
16
16
  export const mockTextInputDeprecated = {
17
- title: 'ID number',
18
- description: 'The number of your national identification (max 10 digits)',
17
+ title: 'Username',
18
+ description: 'Your username (max 10 characters)',
19
19
  maxLength: 10,
20
20
  presentation: {
21
21
  inputType: 'text',
@@ -313,10 +313,10 @@ export const mockFieldset = {
313
313
  inputType: 'fieldset',
314
314
  },
315
315
  properties: {
316
- id_number: mockTextInput,
316
+ username: mockTextInput,
317
317
  tabs: mockNumberInput,
318
318
  },
319
- required: ['id_number'],
319
+ required: ['username'],
320
320
  type: 'object',
321
321
  };
322
322
 
@@ -328,10 +328,10 @@ export const mockFocusedFieldset = {
328
328
  variant: 'focused',
329
329
  },
330
330
  properties: {
331
- id_number: mockTextInput,
331
+ username: mockTextInput,
332
332
  tabs: mockNumberInput,
333
333
  },
334
- required: ['id_number'],
334
+ required: ['username'],
335
335
  type: 'object',
336
336
  };
337
337
 
@@ -501,7 +501,7 @@ export const mockTelWithPattern = {
501
501
  * @returns {Object} A JSON schema
502
502
  * @example
503
503
  * JSONSchemaBuilder().addInput({
504
- id_number: mockTextInput,
504
+ username: mockTextInput,
505
505
  })
506
506
  .build();
507
507
  */
@@ -708,9 +708,9 @@ export const schemaWithoutTypes = {
708
708
 
709
709
  export const schemaInputTypeText = {
710
710
  properties: {
711
- id_number: mockTextInput,
711
+ username: mockTextInput,
712
712
  },
713
- required: ['id_number'],
713
+ required: ['username'],
714
714
  };
715
715
 
716
716
  export const schemaInputWithStatement = {
@@ -1292,7 +1292,7 @@ export const schemaDynamicValidationConst = {
1292
1292
  then: {
1293
1293
  properties: {
1294
1294
  a_fieldset: {
1295
- required: ['id_number', 'tabs'],
1295
+ required: ['username', 'tabs'],
1296
1296
  },
1297
1297
  },
1298
1298
  },
@@ -1369,7 +1369,7 @@ export const schemaDynamicValidationContains = JSONSchemaBuilder()
1369
1369
  type: 'array',
1370
1370
  description: 'Select what fieldset fields are required',
1371
1371
  items: {
1372
- enum: ['all', 'id_number'],
1372
+ enum: ['all', 'username'],
1373
1373
  },
1374
1374
  'x-jsf-presentation': {
1375
1375
  inputType: 'select',
@@ -1379,8 +1379,8 @@ export const schemaDynamicValidationContains = JSONSchemaBuilder()
1379
1379
  value: 'all',
1380
1380
  },
1381
1381
  {
1382
- label: 'ID Number',
1383
- value: 'id_number',
1382
+ label: 'Username',
1383
+ value: 'username',
1384
1384
  },
1385
1385
  ],
1386
1386
  placeholder: 'Select...',
@@ -1401,7 +1401,7 @@ export const schemaDynamicValidationContains = JSONSchemaBuilder()
1401
1401
  {
1402
1402
  properties: {
1403
1403
  a_fieldset: {
1404
- required: ['id_number', 'tabs'],
1404
+ required: ['username', 'tabs'],
1405
1405
  },
1406
1406
  },
1407
1407
  }