@pareto-engineering/design-system 2.0.0-alpha.43 → 2.0.0-alpha.46

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.
Files changed (89) hide show
  1. package/.env.scripts.example +4 -0
  2. package/.eslintrc.js +25 -1
  3. package/babel.config.js +1 -0
  4. package/dist/cjs/f/FormInput/FormInput.js +13 -3
  5. package/dist/cjs/f/FormInput/styles.scss +11 -0
  6. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +214 -0
  7. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +194 -0
  8. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
  9. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +103 -0
  10. package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
  11. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +281 -0
  12. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
  13. package/dist/cjs/f/fields/QueryCombobox/common/index.js +21 -0
  14. package/dist/cjs/f/fields/QueryCombobox/index.js +15 -0
  15. package/dist/cjs/f/fields/QueryCombobox/styles.scss +84 -0
  16. package/dist/cjs/f/fields/SelectInput/SelectInput.js +0 -1
  17. package/dist/cjs/f/fields/SelectInput/styles.scss +8 -6
  18. package/dist/cjs/f/fields/index.js +9 -1
  19. package/dist/cjs/index.js +13 -0
  20. package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
  21. package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  22. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +49 -0
  23. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
  24. package/dist/cjs/test/QueryLoader/common/index.js +13 -0
  25. package/dist/cjs/test/QueryLoader/index.js +15 -0
  26. package/dist/cjs/test/QueryLoader/styles.scss +9 -0
  27. package/dist/cjs/test/index.js +13 -0
  28. package/dist/es/f/FormInput/FormInput.js +13 -3
  29. package/dist/es/f/FormInput/styles.scss +11 -0
  30. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +191 -0
  31. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +174 -0
  32. package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  33. package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
  34. package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  35. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +253 -0
  36. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  37. package/dist/es/f/fields/QueryCombobox/common/index.js +2 -0
  38. package/dist/es/f/fields/QueryCombobox/index.js +2 -0
  39. package/dist/es/f/fields/QueryCombobox/styles.scss +84 -0
  40. package/dist/es/f/fields/SelectInput/SelectInput.js +0 -1
  41. package/dist/es/f/fields/SelectInput/styles.scss +8 -6
  42. package/dist/es/f/fields/index.js +2 -1
  43. package/dist/es/index.js +2 -1
  44. package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
  45. package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  46. package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
  47. package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  48. package/dist/es/test/QueryLoader/common/index.js +1 -0
  49. package/dist/es/test/QueryLoader/index.js +2 -0
  50. package/dist/es/test/QueryLoader/styles.scss +9 -0
  51. package/dist/es/test/index.js +1 -0
  52. package/package.json +16 -3
  53. package/relay.config.js +12 -0
  54. package/schema.graphql +4075 -0
  55. package/scripts/fetchSchema.js +74 -0
  56. package/src/__snapshots__/Storyshots.test.js.snap +323 -8
  57. package/src/stories/f/FormInput.stories.jsx +115 -0
  58. package/src/stories/f/QueryCombobox.stories.jsx +220 -0
  59. package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
  60. package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
  61. package/src/stories/test/QueryLoader.stories.jsx +36 -0
  62. package/src/stories/utils/generateNodeId.js +12 -0
  63. package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
  64. package/src/stories/utils/relay/environment.js +5 -0
  65. package/src/stories/utils/relay/index.js +4 -0
  66. package/src/stories/utils/relay/mockRelayOperation.js +14 -0
  67. package/src/stories/utils/relay/mockResolvers.js +299 -0
  68. package/src/stories/utils/testData.js +63 -0
  69. package/src/ui/f/FormInput/FormInput.jsx +16 -1
  70. package/src/ui/f/FormInput/styles.scss +11 -0
  71. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +207 -0
  72. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +214 -0
  73. package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  74. package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
  75. package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  76. package/src/ui/f/fields/QueryCombobox/common/index.js +2 -0
  77. package/src/ui/f/fields/QueryCombobox/index.js +2 -0
  78. package/src/ui/f/fields/QueryCombobox/styles.scss +84 -0
  79. package/src/ui/f/fields/SelectInput/SelectInput.jsx +1 -1
  80. package/src/ui/f/fields/SelectInput/styles.scss +8 -6
  81. package/src/ui/f/fields/index.js +1 -0
  82. package/src/ui/index.js +1 -0
  83. package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
  84. package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
  85. package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
  86. package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  87. package/src/ui/test/QueryLoader/common/index.js +1 -0
  88. package/src/ui/test/QueryLoader/index.js +2 -0
  89. package/src/ui/test/index.js +1 -0
@@ -0,0 +1,74 @@
1
+ const https = require('https')
2
+ const fs = require('fs')
3
+
4
+ require('dotenv').config({ path: '.env.scripts' })
5
+
6
+ const {
7
+ GITHUB_BACKEND_ORG,
8
+ GITHUB_BACKEND_REPO,
9
+ GITHUB_READONLY_PAT,
10
+ DEBUG,
11
+ } = process.env
12
+
13
+ const isDebug = DEBUG === 'True'
14
+
15
+ const host = 'api.github.com'
16
+ const contentEndpoint = `/repos/${GITHUB_BACKEND_ORG}/${GITHUB_BACKEND_REPO}/contents/schema.graphql`
17
+ const authToken = GITHUB_READONLY_PAT
18
+
19
+ const defaultBranch = 'development'
20
+ const indexOfRefArg = process.argv.findIndex((arg) => arg === '--ref')
21
+ const selectedRef = (indexOfRefArg > -1) ? process.argv[indexOfRefArg + 1] : defaultBranch
22
+
23
+ const filename = 'schema.graphql'
24
+
25
+ const processContent = (data) => {
26
+ if (data.content) {
27
+ if (isDebug) {
28
+ console.log(Buffer.from(data.content, 'base64').toString('utf-8'))
29
+ }
30
+ fs.writeFile(filename, Buffer.from(data.content, 'base64'), 'utf8', (err) => {
31
+ if (err) {
32
+ console.log(err)
33
+ } else {
34
+ console.log(`${filename} successfully saved`)
35
+ }
36
+ })
37
+ } else {
38
+ console.error('Error in downloading the schema.')
39
+ }
40
+ }
41
+
42
+ function performRequest(success) {
43
+ console.log(`Fetching schema from ref=${selectedRef}`)
44
+ const options = {
45
+ host,
46
+ path :`${contentEndpoint}?ref=${selectedRef}`,
47
+ method :'GET',
48
+ headers:{
49
+ Authorization:`token ${authToken}`,
50
+ 'User-Agent' :'Nodejs CI script',
51
+ },
52
+ }
53
+
54
+ const req = https.request(options, (res) => {
55
+ res.setEncoding('utf-8')
56
+
57
+ let responseString = ''
58
+
59
+ res.on('data', (data) => {
60
+ responseString += data
61
+ })
62
+
63
+ res.on('end', () => {
64
+ // console.log(responseString)
65
+ const responseObject = JSON.parse(responseString)
66
+ success(responseObject)
67
+ })
68
+ })
69
+
70
+ // req.write()
71
+ req.end()
72
+ }
73
+
74
+ performRequest(processContent)
@@ -2663,7 +2663,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
2663
2663
  className="base timestamp"
2664
2664
  onClick={[Function]}
2665
2665
  >
2666
- in 6 months
2666
+ in 4 months
2667
2667
  </p>
2668
2668
  `;
2669
2669
 
@@ -10361,7 +10361,7 @@ exports[`Storyshots f/FormInput Base 1`] = `
10361
10361
  className="base select-input form-input y-background2"
10362
10362
  >
10363
10363
  <label
10364
- className="base label input-label x-main2"
10364
+ className="base label x-main2"
10365
10365
  htmlFor="food"
10366
10366
  >
10367
10367
  What do you want for dinner ?
@@ -10550,7 +10550,7 @@ exports[`Storyshots f/FormInput Disabled Form Input 1`] = `
10550
10550
  className="base select-input form-input y-background2"
10551
10551
  >
10552
10552
  <label
10553
- className="base label input-label x-main2"
10553
+ className="base label x-main2"
10554
10554
  htmlFor="food"
10555
10555
  >
10556
10556
  What do you want for dinner ?
@@ -10637,6 +10637,161 @@ exports[`Storyshots f/FormInput Extensible Form Input 1`] = `
10637
10637
  </form>
10638
10638
  `;
10639
10639
 
10640
+ exports[`Storyshots f/FormInput With Query Combobox 1`] = `
10641
+ <form
10642
+ action="#"
10643
+ onReset={[Function]}
10644
+ onSubmit={[Function]}
10645
+ >
10646
+ <div
10647
+ className="base text-input form-input y-background2"
10648
+ >
10649
+ <label
10650
+ className="base label v50 mb-v x-main2"
10651
+ htmlFor="firstName"
10652
+ >
10653
+ What's your first name ?
10654
+ </label>
10655
+ <input
10656
+ className="input"
10657
+ disabled={false}
10658
+ id="firstName"
10659
+ name="firstName"
10660
+ onBlur={[Function]}
10661
+ onChange={[Function]}
10662
+ type="text"
10663
+ value="Test"
10664
+ />
10665
+ </div>
10666
+ <div
10667
+ className="base choices-input form-input x-background2 y-main2"
10668
+ style={
10669
+ Object {
10670
+ "--grid-columns-desktop": 3,
10671
+ "--grid-columns-mobile": 2,
10672
+ }
10673
+ }
10674
+ >
10675
+ <p
10676
+ className="base label x-main2"
10677
+ >
10678
+ What are your favourite colors ?
10679
+ </p>
10680
+ <div
10681
+ className="choices"
10682
+ >
10683
+ <div
10684
+ className="base choice"
10685
+ >
10686
+ <input
10687
+ disabled={false}
10688
+ id="undefined-red"
10689
+ name="colors"
10690
+ onBlur={[Function]}
10691
+ onChange={[Function]}
10692
+ type="radio"
10693
+ value="red"
10694
+ />
10695
+ <label
10696
+ htmlFor="undefined-red"
10697
+ >
10698
+ Color Red
10699
+ </label>
10700
+ </div>
10701
+ <div
10702
+ className="base choice"
10703
+ >
10704
+ <input
10705
+ disabled={false}
10706
+ id="undefined-blue"
10707
+ name="colors"
10708
+ onBlur={[Function]}
10709
+ onChange={[Function]}
10710
+ type="radio"
10711
+ value="blue"
10712
+ />
10713
+ <label
10714
+ htmlFor="undefined-blue"
10715
+ >
10716
+ Color Blue
10717
+ </label>
10718
+ </div>
10719
+ <div
10720
+ className="base choice"
10721
+ >
10722
+ <input
10723
+ disabled={false}
10724
+ id="undefined-green"
10725
+ name="colors"
10726
+ onBlur={[Function]}
10727
+ onChange={[Function]}
10728
+ type="radio"
10729
+ value="green"
10730
+ />
10731
+ <label
10732
+ htmlFor="undefined-green"
10733
+ >
10734
+ Color Green
10735
+ </label>
10736
+ </div>
10737
+ </div>
10738
+ </div>
10739
+ <div
10740
+ className="base combobox form-input y-background2 x-main2"
10741
+ >
10742
+ <label
10743
+ className="base label x-main2"
10744
+ htmlFor="team"
10745
+ id="downshift-0-label"
10746
+ >
10747
+ Search for a team
10748
+ </label>
10749
+ <div
10750
+ aria-expanded={false}
10751
+ aria-haspopup="listbox"
10752
+ aria-owns="downshift-0-menu"
10753
+ className="input-wrapper"
10754
+ role="combobox"
10755
+ >
10756
+ <input
10757
+ aria-autocomplete="list"
10758
+ aria-controls="downshift-0-menu"
10759
+ aria-labelledby="downshift-0-label"
10760
+ autoComplete="off"
10761
+ className="input"
10762
+ id="downshift-0-input"
10763
+ onBlur={[Function]}
10764
+ onChange={[Function]}
10765
+ onKeyDown={[Function]}
10766
+ value=""
10767
+ />
10768
+ </div>
10769
+ <div
10770
+ className="base popover x-background1 bottom left"
10771
+ >
10772
+ <ul
10773
+ aria-labelledby="downshift-0-label"
10774
+ className="base menu"
10775
+ id="downshift-0-menu"
10776
+ onMouseLeave={[Function]}
10777
+ role="listbox"
10778
+ />
10779
+ </div>
10780
+ </div>
10781
+ <div
10782
+ className="debugger"
10783
+ >
10784
+ <button
10785
+ className="base button x-main2"
10786
+ onClick={[Function]}
10787
+ type="button"
10788
+ >
10789
+ Open FormDebugger
10790
+ </button>
10791
+ </div>
10792
+ </form>
10793
+ `;
10794
+
10640
10795
  exports[`Storyshots f/common/Description Base 1`] = `
10641
10796
  <div
10642
10797
  className="base description x-metadata"
@@ -11198,6 +11353,164 @@ exports[`Storyshots f/fields/ChoicesInput Multiple With Grid 1`] = `
11198
11353
  </form>
11199
11354
  `;
11200
11355
 
11356
+ exports[`Storyshots f/fields/QueryCombobox Single Select 1`] = `
11357
+ <form
11358
+ action="#"
11359
+ onReset={[Function]}
11360
+ onSubmit={[Function]}
11361
+ >
11362
+ <div
11363
+ className="base combobox y-background2 x-main2"
11364
+ >
11365
+ <label
11366
+ className="base label x-main2"
11367
+ htmlFor="team"
11368
+ id="downshift-1-label"
11369
+ >
11370
+ Search for a team
11371
+ </label>
11372
+ <div
11373
+ aria-expanded={false}
11374
+ aria-haspopup="listbox"
11375
+ aria-owns="downshift-1-menu"
11376
+ className="input-wrapper"
11377
+ role="combobox"
11378
+ >
11379
+ <input
11380
+ aria-autocomplete="list"
11381
+ aria-controls="downshift-1-menu"
11382
+ aria-labelledby="downshift-1-label"
11383
+ autoComplete="off"
11384
+ className="input"
11385
+ id="downshift-1-input"
11386
+ onBlur={[Function]}
11387
+ onChange={[Function]}
11388
+ onKeyDown={[Function]}
11389
+ value=""
11390
+ />
11391
+ </div>
11392
+ <div
11393
+ className="base popover x-background1 bottom left"
11394
+ >
11395
+ <ul
11396
+ aria-labelledby="downshift-1-label"
11397
+ className="base menu"
11398
+ id="downshift-1-menu"
11399
+ onMouseLeave={[Function]}
11400
+ role="listbox"
11401
+ />
11402
+ </div>
11403
+ </div>
11404
+ <div
11405
+ style={
11406
+ Object {
11407
+ "alignItems": "flex-end",
11408
+ "display": "flex",
11409
+ "flexDirection": "column",
11410
+ }
11411
+ }
11412
+ >
11413
+ <div
11414
+ className="debugger"
11415
+ >
11416
+ <button
11417
+ className="base button x-main2"
11418
+ onClick={[Function]}
11419
+ type="button"
11420
+ >
11421
+ Open FormDebugger
11422
+ </button>
11423
+ </div>
11424
+ <button
11425
+ className="base button x-main1"
11426
+ onClick={[Function]}
11427
+ type="button"
11428
+ >
11429
+ Replace initial value
11430
+ </button>
11431
+ </div>
11432
+ </form>
11433
+ `;
11434
+
11435
+ exports[`Storyshots f/fields/QueryCombobox Single Select With Default Formik State 1`] = `
11436
+ <form
11437
+ action="#"
11438
+ onReset={[Function]}
11439
+ onSubmit={[Function]}
11440
+ >
11441
+ <div
11442
+ className="base combobox y-background2 x-main2"
11443
+ >
11444
+ <label
11445
+ className="base label x-main2"
11446
+ htmlFor="team"
11447
+ id="downshift-2-label"
11448
+ >
11449
+ Search for a team
11450
+ </label>
11451
+ <div
11452
+ aria-expanded={false}
11453
+ aria-haspopup="listbox"
11454
+ aria-owns="downshift-2-menu"
11455
+ className="input-wrapper"
11456
+ role="combobox"
11457
+ >
11458
+ <input
11459
+ aria-autocomplete="list"
11460
+ aria-controls="downshift-2-menu"
11461
+ aria-labelledby="downshift-2-label"
11462
+ autoComplete="off"
11463
+ className="input"
11464
+ id="downshift-2-input"
11465
+ onBlur={[Function]}
11466
+ onChange={[Function]}
11467
+ onKeyDown={[Function]}
11468
+ value="Apple"
11469
+ />
11470
+ </div>
11471
+ <div
11472
+ className="base popover x-background1 bottom left"
11473
+ >
11474
+ <ul
11475
+ aria-labelledby="downshift-2-label"
11476
+ className="base menu"
11477
+ id="downshift-2-menu"
11478
+ onMouseLeave={[Function]}
11479
+ role="listbox"
11480
+ />
11481
+ </div>
11482
+ </div>
11483
+ <div
11484
+ style={
11485
+ Object {
11486
+ "alignItems": "flex-end",
11487
+ "display": "flex",
11488
+ "flexDirection": "column",
11489
+ }
11490
+ }
11491
+ >
11492
+ <div
11493
+ className="debugger"
11494
+ >
11495
+ <button
11496
+ className="base button x-main2"
11497
+ onClick={[Function]}
11498
+ type="button"
11499
+ >
11500
+ Open FormDebugger
11501
+ </button>
11502
+ </div>
11503
+ <button
11504
+ className="base button x-main1"
11505
+ onClick={[Function]}
11506
+ type="button"
11507
+ >
11508
+ Replace initial value
11509
+ </button>
11510
+ </div>
11511
+ </form>
11512
+ `;
11513
+
11201
11514
  exports[`Storyshots f/fields/RatingsInput Base 1`] = `
11202
11515
  <form
11203
11516
  action="#"
@@ -11995,7 +12308,7 @@ exports[`Storyshots f/fields/SelectInput Base 1`] = `
11995
12308
  className="base select-input y-background2"
11996
12309
  >
11997
12310
  <label
11998
- className="base label input-label x-main2"
12311
+ className="base label x-main2"
11999
12312
  htmlFor="workType"
12000
12313
  >
12001
12314
  Work Type
@@ -12059,7 +12372,7 @@ exports[`Storyshots f/fields/SelectInput Disabled Select Input 1`] = `
12059
12372
  className="base select-input y-background2"
12060
12373
  >
12061
12374
  <label
12062
- className="base label input-label x-main2"
12375
+ className="base label x-main2"
12063
12376
  htmlFor="workType"
12064
12377
  >
12065
12378
  Work Type
@@ -12135,7 +12448,7 @@ exports[`Storyshots f/fields/SelectInput Objects 1`] = `
12135
12448
  className="base select-input y-background2"
12136
12449
  >
12137
12450
  <label
12138
- className="base label input-label x-main2"
12451
+ className="base label x-main2"
12139
12452
  htmlFor="workType"
12140
12453
  >
12141
12454
  Work Type
@@ -12193,7 +12506,7 @@ exports[`Storyshots f/fields/SelectInput Required Select 1`] = `
12193
12506
  className="base select-input y-background2"
12194
12507
  >
12195
12508
  <label
12196
- className="base label input-label x-main2"
12509
+ className="base label x-main2"
12197
12510
  htmlFor="activity"
12198
12511
  >
12199
12512
  Activity Type
@@ -12251,7 +12564,7 @@ exports[`Storyshots f/fields/SelectInput String And Objects 1`] = `
12251
12564
  className="base select-input y-background2"
12252
12565
  >
12253
12566
  <label
12254
- className="base label input-label x-main2"
12567
+ className="base label x-main2"
12255
12568
  htmlFor="workType"
12256
12569
  >
12257
12570
  Work Type
@@ -12674,3 +12987,5 @@ exports[`Storyshots f/fields/TextareaInput Validation 1`] = `
12674
12987
  exports[`Storyshots r/SwitchRouteMap Base 1`] = `"This component does not need a visual test."`;
12675
12988
 
12676
12989
  exports[`Storyshots r/common/PrivateRoute Base 1`] = `"This component does not need a visual test."`;
12990
+
12991
+ exports[`Storyshots test/QueryLoader Base 1`] = `null`;
@@ -8,6 +8,15 @@ import {
8
8
  FormDebugger,
9
9
  } from 'ui'
10
10
 
11
+ import { fruits } from '../utils/testData'
12
+
13
+ import {
14
+ RelayEnvironmentProvider,
15
+ mockRelayOperation,
16
+ } from '../utils/relay'
17
+
18
+ import generateNodeId from '../utils/generateNodeId'
19
+
11
20
  export default {
12
21
  title :'f/FormInput',
13
22
  component :FormInput,
@@ -25,6 +34,11 @@ export default {
25
34
  </Form>
26
35
  </Formik>
27
36
  ),
37
+ (storyfn) => (
38
+ <RelayEnvironmentProvider>
39
+ { storyfn() }
40
+ </RelayEnvironmentProvider>
41
+ ),
28
42
  ],
29
43
  argTypes:{
30
44
  backgroundColor:{ control: 'color' },
@@ -99,6 +113,107 @@ export const Base = () => {
99
113
  )
100
114
  }
101
115
 
116
+ const allTeamsMockData = {
117
+ PageInfo() {
118
+ return {
119
+ hasNextPage :true,
120
+ hasPreviousPage:true,
121
+ }
122
+ },
123
+ TeamNodeConnection:(args) => {
124
+ const edges = fruits.map((fruit) => ({
125
+ node:{
126
+ id :generateNodeId('TeamNode'),
127
+ name:fruit,
128
+ },
129
+ }))
130
+
131
+ // eslint-disable-next-line camelcase
132
+ const { name_Icontains } = args?.args || {}
133
+
134
+ return ({
135
+ pageInfo:{
136
+ hasNextPage :true,
137
+ hasPreviousPage:true,
138
+ },
139
+ // eslint-disable-next-line camelcase
140
+ edges:name_Icontains?.trim()
141
+ ? edges.filter(({ node }) => node.name
142
+ .toLowerCase()
143
+ .includes(name_Icontains.toLowerCase()))
144
+ : [],
145
+ })
146
+ },
147
+ }
148
+
149
+ const FETCH_TEAMS_QUERY = graphql`
150
+ query FormInputAllTeamsQuery($name_Icontains: String) {
151
+ allTeams(name_Icontains: $name_Icontains) {
152
+ edges {
153
+ node {
154
+ id
155
+ name
156
+ }
157
+ }
158
+ }
159
+ }
160
+ `
161
+
162
+ export const WithQueryCombobox = () => {
163
+ const inputMap = [
164
+ {
165
+ type :'text',
166
+ name :'firstName',
167
+ label:"What's your first name ?",
168
+ },
169
+ {
170
+ type :'choices',
171
+ name :'colors',
172
+ label :'What are your favourite colors ?',
173
+ options:[
174
+ {
175
+ value:'red',
176
+ label:'Color Red',
177
+ },
178
+ {
179
+ value:'blue',
180
+ label:'Color Blue',
181
+ },
182
+ {
183
+ value:'green',
184
+ label:'Color Green',
185
+ },
186
+ ],
187
+ },
188
+ {
189
+ type :'query-combobox',
190
+ name :'team',
191
+ query :FETCH_TEAMS_QUERY,
192
+ label :'Search for a team',
193
+ optionsKeyMap:{
194
+ value:'id',
195
+ label:'name',
196
+ },
197
+ graphQlNode :'allTeams',
198
+ searchVariable:'name_Icontains',
199
+ },
200
+ ]
201
+
202
+ mockRelayOperation(allTeamsMockData)
203
+ mockRelayOperation(allTeamsMockData)
204
+ mockRelayOperation(allTeamsMockData)
205
+
206
+ return (
207
+ <>
208
+ {
209
+ inputMap.map((input) => <FormInput {...input} key={input.name} />)
210
+ }
211
+ <FormDebugger />
212
+
213
+ </>
214
+ )
215
+ }
216
+
102
217
  export const ExtensibleFormInput = () => {
103
218
  const ExtendedTextInput = (props) => (
104
219
  <TextInput