@pareto-engineering/design-system 2.0.0-alpha.44 → 2.0.0-alpha.47

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 (35) hide show
  1. package/dist/cjs/f/FormInput/FormInput.js +8 -1
  2. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +49 -41
  3. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +72 -15
  4. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
  5. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +91 -21
  6. package/dist/cjs/f/fields/QueryCombobox/styles.scss +52 -39
  7. package/dist/cjs/f/fields/index.js +9 -1
  8. package/dist/es/f/FormInput/FormInput.js +9 -2
  9. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +53 -43
  10. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +73 -17
  11. package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
  12. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +91 -22
  13. package/dist/es/f/fields/QueryCombobox/styles.scss +52 -39
  14. package/dist/es/f/fields/index.js +2 -1
  15. package/package.json +3 -2
  16. package/src/__snapshots__/Storyshots.test.js.snap +508 -0
  17. package/src/local.scss +3 -3
  18. package/src/stories/f/FormInput.stories.jsx +115 -0
  19. package/src/stories/f/QueryCombobox.stories.jsx +267 -0
  20. package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
  21. package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
  22. package/src/stories/utils/generateNodeId.js +12 -0
  23. package/src/stories/utils/testData.js +63 -0
  24. package/src/ui/f/FormInput/FormInput.jsx +11 -0
  25. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +223 -0
  26. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +222 -0
  27. package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  28. package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
  29. package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  30. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +317 -0
  31. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  32. package/src/ui/f/fields/QueryCombobox/common/index.js +3 -0
  33. package/src/ui/f/fields/QueryCombobox/index.js +2 -0
  34. package/src/ui/f/fields/QueryCombobox/styles.scss +78 -0
  35. package/src/ui/f/fields/index.js +1 -0
@@ -5,61 +5,74 @@
5
5
  $default-input-padding: .75em .75em .55em;
6
6
  $default-padding: 1em;
7
7
  $default-margin: 1em;
8
+ $default-loading-circle-displacement: 1em;
8
9
 
9
- .#{bem.$base}.query-combobox {
10
- .input {
11
- background: var(--light-y);
12
- border: var(--theme-border-style) var(--dark-y);
13
- color: var(--on-y);
14
- padding: $default-input-padding;
15
- width: 100%;
10
+ .#{bem.$base}.combobox,
11
+ .#{bem.$base}.multiple-combobox {
12
+ position: relative;
16
13
 
17
- &::placeholder {
18
- color: var(--metadata);
19
- }
14
+ .#{bem.$base}.label {
15
+ margin-bottom: $default-margin
16
+ }
20
17
 
21
- &:not(:disabled):hover {
22
- border: var(--theme-border-style) var(--light-background4);
23
- }
18
+ .#{bem.$base}.popover {
19
+ width: 100%;
24
20
 
25
- &:disabled {
26
- background-color: var(--dark-y);
27
- }
21
+ >.menu {
22
+ list-style: none;
23
+ margin: 0;
24
+ outline: 0;
25
+ padding: 0;
28
26
 
29
- &:focus {
30
- background: var(--light-background4);
27
+ >.item {
28
+ padding: $default-padding / 2;
29
+
30
+ &.#{bem.$modifier-active} {
31
+ background-color: var(--background2);
32
+ }
33
+ }
31
34
  }
32
35
  }
33
36
 
34
- .menu {
35
- list-style: none;
36
- margin: 0;
37
- outline: 0;
38
- padding: 0;
37
+ >.input-wrapper {
38
+ position: relative;
39
39
 
40
- /* stylelint-disable selector-max-universal -- Allow */
41
- >* {
42
- padding-block: $default-padding / 2;
40
+ >.#{bem.$base}.loading-circle {
41
+ position: absolute;
42
+ top: $default-loading-circle-displacement;
43
+ right: $default-loading-circle-displacement;
43
44
  }
44
45
 
45
- /* stylelint-enable selector-max-universal */
46
- >.item {
47
- &.#{bem.$modifier-active} {
48
- background-color: var(--background2);
46
+ >.input {
47
+ background: var(--light-y);
48
+ border: var(--theme-border-style) var(--dark-y);
49
+ color: var(--on-y);
50
+ padding: $default-input-padding;
51
+ width: 100%;
52
+
53
+ &::placeholder {
54
+ color: var(--metadata);
49
55
  }
50
- }
51
- }
52
56
 
53
- .multiple-combobox {
54
- .selected-items {
55
- display: flex;
57
+ &:not(:disabled):hover {
58
+ border: var(--theme-border-style) var(--light-background4);
59
+ }
56
60
 
57
- /* stylelint-disable selector-max-universal -- Allow */
58
- >*:not(:first-child) {
59
- margin-left: $default-margin;
61
+ &:disabled {
62
+ background-color: var(--dark-y);
60
63
  }
61
64
 
62
- /* stylelint-enable selector-max-universal */
65
+ &:focus {
66
+ background: var(--light-background4);
67
+ }
63
68
  }
64
69
  }
70
+ }
71
+
72
+
73
+ .#{bem.$base}.multiple-combobox {
74
+ >.selected-items {
75
+ display: flex;
76
+ gap: var(--default-gap);
77
+ }
65
78
  }
@@ -2,4 +2,5 @@ export { TextInput } from "./TextInput";
2
2
  export { SelectInput } from "./SelectInput";
3
3
  export { ChoicesInput } from "./ChoicesInput";
4
4
  export { TextareaInput } from "./TextareaInput";
5
- export { RatingsInput } from "./RatingsInput";
5
+ export { RatingsInput } from "./RatingsInput";
6
+ export { QueryCombobox } from "./QueryCombobox";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.44",
3
+ "version": "2.0.0-alpha.47",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -88,10 +88,11 @@
88
88
  "stylelint-config-palantir": "^5.1.0"
89
89
  },
90
90
  "dependencies": {
91
- "@pareto-engineering/assets": "^2.0.0-alpha.18",
91
+ "@pareto-engineering/assets": "^2.0.0-alpha.21",
92
92
  "@pareto-engineering/bem": "^0.1.5",
93
93
  "@pareto-engineering/styles": "^2.0.0-alpha.8",
94
94
  "date-fns": "^2.22.1",
95
+ "downshift": "^6.1.7",
95
96
  "formik": "^2.2.9",
96
97
  "hamburgers": "^1.1.3",
97
98
  "lodash": "^4.17.21",
@@ -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"
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,359 @@ exports[`Storyshots f/fields/ChoicesInput Multiple With Grid 1`] = `
11198
11353
  </form>
11199
11354
  `;
11200
11355
 
11356
+ exports[`Storyshots f/fields/QueryCombobox Multiple Select 1`] = `
11357
+ <form
11358
+ action="#"
11359
+ onReset={[Function]}
11360
+ onSubmit={[Function]}
11361
+ >
11362
+ <div
11363
+ className="base multiple-combobox y-background2"
11364
+ >
11365
+ <label
11366
+ className="base label x-main2"
11367
+ htmlFor="teams"
11368
+ id="downshift-3-label"
11369
+ >
11370
+ Search for a team
11371
+ </label>
11372
+ <div
11373
+ className="selected-items"
11374
+ />
11375
+ <div
11376
+ aria-expanded={false}
11377
+ aria-haspopup="listbox"
11378
+ aria-owns="downshift-3-menu"
11379
+ className="input-wrapper"
11380
+ role="combobox"
11381
+ >
11382
+ <input
11383
+ aria-autocomplete="list"
11384
+ aria-controls="downshift-3-menu"
11385
+ aria-labelledby="downshift-3-label"
11386
+ autoComplete="off"
11387
+ className="input"
11388
+ id="downshift-3-input"
11389
+ onBlur={[Function]}
11390
+ onChange={[Function]}
11391
+ onClick={[Function]}
11392
+ onKeyDown={[Function]}
11393
+ value=""
11394
+ />
11395
+ </div>
11396
+ <div
11397
+ className="base popover x-background1 bottom left"
11398
+ >
11399
+ <ul
11400
+ aria-labelledby="downshift-3-label"
11401
+ className="base menu"
11402
+ id="downshift-3-menu"
11403
+ onMouseLeave={[Function]}
11404
+ role="listbox"
11405
+ />
11406
+ </div>
11407
+ </div>
11408
+ <div
11409
+ style={
11410
+ Object {
11411
+ "alignItems": "flex-end",
11412
+ "display": "flex",
11413
+ "flexDirection": "column",
11414
+ }
11415
+ }
11416
+ >
11417
+ <div
11418
+ className="debugger"
11419
+ >
11420
+ <button
11421
+ className="base button x-main2"
11422
+ onClick={[Function]}
11423
+ type="button"
11424
+ >
11425
+ Open FormDebugger
11426
+ </button>
11427
+ </div>
11428
+ <button
11429
+ className="base button x-main1"
11430
+ onClick={[Function]}
11431
+ type="button"
11432
+ >
11433
+ Add formik values
11434
+ </button>
11435
+ </div>
11436
+ </form>
11437
+ `;
11438
+
11439
+ exports[`Storyshots f/fields/QueryCombobox Multiple Select With Default Formik State 1`] = `
11440
+ <form
11441
+ action="#"
11442
+ onReset={[Function]}
11443
+ onSubmit={[Function]}
11444
+ >
11445
+ <div
11446
+ className="base multiple-combobox y-background2"
11447
+ >
11448
+ <label
11449
+ className="base label x-main2"
11450
+ htmlFor="teams"
11451
+ id="downshift-4-label"
11452
+ >
11453
+ Search for a team
11454
+ </label>
11455
+ <div
11456
+ className="selected-items"
11457
+ >
11458
+ <div
11459
+ onClick={[Function]}
11460
+ onKeyDown={[Function]}
11461
+ tabIndex={-1}
11462
+ >
11463
+ Apple
11464
+ <button
11465
+ className="base button f-icons x-main2 modifierCompact modifierSimple"
11466
+ onClick={[Function]}
11467
+ type="button"
11468
+ >
11469
+ X
11470
+ </button>
11471
+ </div>
11472
+ <div
11473
+ onClick={[Function]}
11474
+ onKeyDown={[Function]}
11475
+ tabIndex={-1}
11476
+ >
11477
+ Pear
11478
+ <button
11479
+ className="base button f-icons x-main2 modifierCompact modifierSimple"
11480
+ onClick={[Function]}
11481
+ type="button"
11482
+ >
11483
+ X
11484
+ </button>
11485
+ </div>
11486
+ </div>
11487
+ <div
11488
+ aria-expanded={false}
11489
+ aria-haspopup="listbox"
11490
+ aria-owns="downshift-4-menu"
11491
+ className="input-wrapper"
11492
+ role="combobox"
11493
+ >
11494
+ <input
11495
+ aria-autocomplete="list"
11496
+ aria-controls="downshift-4-menu"
11497
+ aria-labelledby="downshift-4-label"
11498
+ autoComplete="off"
11499
+ className="input"
11500
+ id="downshift-4-input"
11501
+ onBlur={[Function]}
11502
+ onChange={[Function]}
11503
+ onClick={[Function]}
11504
+ onKeyDown={[Function]}
11505
+ value=""
11506
+ />
11507
+ </div>
11508
+ <div
11509
+ className="base popover x-background1 bottom left"
11510
+ >
11511
+ <ul
11512
+ aria-labelledby="downshift-4-label"
11513
+ className="base menu"
11514
+ id="downshift-4-menu"
11515
+ onMouseLeave={[Function]}
11516
+ role="listbox"
11517
+ />
11518
+ </div>
11519
+ </div>
11520
+ <div
11521
+ style={
11522
+ Object {
11523
+ "alignItems": "flex-end",
11524
+ "display": "flex",
11525
+ "flexDirection": "column",
11526
+ }
11527
+ }
11528
+ >
11529
+ <div
11530
+ className="debugger"
11531
+ >
11532
+ <button
11533
+ className="base button x-main2"
11534
+ onClick={[Function]}
11535
+ type="button"
11536
+ >
11537
+ Open FormDebugger
11538
+ </button>
11539
+ </div>
11540
+ <button
11541
+ className="base button x-main1"
11542
+ onClick={[Function]}
11543
+ type="button"
11544
+ >
11545
+ Add formik values
11546
+ </button>
11547
+ </div>
11548
+ </form>
11549
+ `;
11550
+
11551
+ exports[`Storyshots f/fields/QueryCombobox Single Select 1`] = `
11552
+ <form
11553
+ action="#"
11554
+ onReset={[Function]}
11555
+ onSubmit={[Function]}
11556
+ >
11557
+ <div
11558
+ className="base combobox y-background2"
11559
+ >
11560
+ <label
11561
+ className="base label x-main2"
11562
+ htmlFor="team"
11563
+ id="downshift-1-label"
11564
+ >
11565
+ Search for a team
11566
+ </label>
11567
+ <div
11568
+ aria-expanded={false}
11569
+ aria-haspopup="listbox"
11570
+ aria-owns="downshift-1-menu"
11571
+ className="input-wrapper"
11572
+ role="combobox"
11573
+ >
11574
+ <input
11575
+ aria-autocomplete="list"
11576
+ aria-controls="downshift-1-menu"
11577
+ aria-labelledby="downshift-1-label"
11578
+ autoComplete="off"
11579
+ className="input"
11580
+ id="downshift-1-input"
11581
+ onBlur={[Function]}
11582
+ onChange={[Function]}
11583
+ onKeyDown={[Function]}
11584
+ value=""
11585
+ />
11586
+ </div>
11587
+ <div
11588
+ className="base popover x-background1 bottom left"
11589
+ >
11590
+ <ul
11591
+ aria-labelledby="downshift-1-label"
11592
+ className="base menu"
11593
+ id="downshift-1-menu"
11594
+ onMouseLeave={[Function]}
11595
+ role="listbox"
11596
+ />
11597
+ </div>
11598
+ </div>
11599
+ <div
11600
+ style={
11601
+ Object {
11602
+ "alignItems": "flex-end",
11603
+ "display": "flex",
11604
+ "flexDirection": "column",
11605
+ }
11606
+ }
11607
+ >
11608
+ <div
11609
+ className="debugger"
11610
+ >
11611
+ <button
11612
+ className="base button x-main2"
11613
+ onClick={[Function]}
11614
+ type="button"
11615
+ >
11616
+ Open FormDebugger
11617
+ </button>
11618
+ </div>
11619
+ <button
11620
+ className="base button x-main1"
11621
+ onClick={[Function]}
11622
+ type="button"
11623
+ >
11624
+ Replace formik value
11625
+ </button>
11626
+ </div>
11627
+ </form>
11628
+ `;
11629
+
11630
+ exports[`Storyshots f/fields/QueryCombobox Single Select With Default Formik State 1`] = `
11631
+ <form
11632
+ action="#"
11633
+ onReset={[Function]}
11634
+ onSubmit={[Function]}
11635
+ >
11636
+ <div
11637
+ className="base combobox y-background2"
11638
+ >
11639
+ <label
11640
+ className="base label x-main2"
11641
+ htmlFor="team"
11642
+ id="downshift-2-label"
11643
+ >
11644
+ Search for a team
11645
+ </label>
11646
+ <div
11647
+ aria-expanded={false}
11648
+ aria-haspopup="listbox"
11649
+ aria-owns="downshift-2-menu"
11650
+ className="input-wrapper"
11651
+ role="combobox"
11652
+ >
11653
+ <input
11654
+ aria-autocomplete="list"
11655
+ aria-controls="downshift-2-menu"
11656
+ aria-labelledby="downshift-2-label"
11657
+ autoComplete="off"
11658
+ className="input"
11659
+ id="downshift-2-input"
11660
+ onBlur={[Function]}
11661
+ onChange={[Function]}
11662
+ onKeyDown={[Function]}
11663
+ value="Apple"
11664
+ />
11665
+ </div>
11666
+ <div
11667
+ className="base popover x-background1 bottom left"
11668
+ >
11669
+ <ul
11670
+ aria-labelledby="downshift-2-label"
11671
+ className="base menu"
11672
+ id="downshift-2-menu"
11673
+ onMouseLeave={[Function]}
11674
+ role="listbox"
11675
+ />
11676
+ </div>
11677
+ </div>
11678
+ <div
11679
+ style={
11680
+ Object {
11681
+ "alignItems": "flex-end",
11682
+ "display": "flex",
11683
+ "flexDirection": "column",
11684
+ }
11685
+ }
11686
+ >
11687
+ <div
11688
+ className="debugger"
11689
+ >
11690
+ <button
11691
+ className="base button x-main2"
11692
+ onClick={[Function]}
11693
+ type="button"
11694
+ >
11695
+ Open FormDebugger
11696
+ </button>
11697
+ </div>
11698
+ <button
11699
+ className="base button x-main1"
11700
+ onClick={[Function]}
11701
+ type="button"
11702
+ >
11703
+ Replace formik value
11704
+ </button>
11705
+ </div>
11706
+ </form>
11707
+ `;
11708
+
11201
11709
  exports[`Storyshots f/fields/RatingsInput Base 1`] = `
11202
11710
  <form
11203
11711
  action="#"
package/src/local.scss CHANGED
@@ -5,12 +5,12 @@
5
5
  --theme-border-style: 1px solid;
6
6
  --theme-border-color: var(--paragraph);
7
7
  --theme-border: var(--theme-border-style) var(--theme-border-color);
8
+ --default-gap: 1em;
8
9
  }
9
10
 
10
11
  html {
11
12
  font-family: var(--font-default);
12
13
  font-size: 18px;
13
- font-feature-settings:'liga' on;
14
+ font-feature-settings: 'liga' on;
14
15
  scroll-behavior: smooth;
15
- }
16
-
16
+ }