@nestio/pam 2.0.9 → 2.0.10-beta.1

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 (130) hide show
  1. package/.buildkite/docker-compose-ci.yml +1 -1
  2. package/.buildkite/pipeline.yaml +12 -0
  3. package/.buildkite/security/configs/trivy-main-scan.yaml +25 -0
  4. package/.buildkite/security/envs/env.conf +25 -0
  5. package/.buildkite/security/securitychecks.sh +18 -0
  6. package/.buildkite/steps/scan-repo.sh +4 -0
  7. package/.buildkite/{test.sh → steps/test.sh} +1 -1
  8. package/.github/workflows/publish.yaml +69 -0
  9. package/.nvmrc +1 -1
  10. package/.zed/settings.json +10 -0
  11. package/README.md +28 -5
  12. package/lib/components/AsyncSelect.js +13 -12
  13. package/lib/components/CalendarInput.js +10 -7
  14. package/lib/components/CalendarRangeSelectMenu.js +1 -1
  15. package/lib/components/CalendarSelect.js +6 -11
  16. package/lib/components/MultiSelect.js +8 -7
  17. package/lib/components/MultiSelectOption.js +7 -9
  18. package/lib/components/MultiSelectValue.js +18 -8
  19. package/lib/components/PriceSelect.js +26 -20
  20. package/lib/components/SingleSelect.js +15 -12
  21. package/lib/components/SingleSelectOption.js +7 -9
  22. package/lib/components/SingleSelectValue.js +16 -5
  23. package/lib/components/TabbedSelect.js +18 -16
  24. package/lib/components/TagBox.js +1 -1
  25. package/lib/components/TagBoxMenuSelect.js +8 -7
  26. package/lib/components/TagBoxValueSelect.js +8 -7
  27. package/package.json +6 -3
  28. package/src/components/AsyncSelect.jsx +11 -11
  29. package/src/components/CalendarInput.jsx +13 -11
  30. package/src/components/CalendarRangeSelectMenu.jsx +1 -1
  31. package/src/components/CalendarSelect.jsx +4 -8
  32. package/src/components/MultiSelect.jsx +8 -8
  33. package/src/components/MultiSelectOption.jsx +13 -12
  34. package/src/components/MultiSelectValue.jsx +10 -8
  35. package/src/components/PriceSelect.jsx +25 -24
  36. package/src/components/SingleSelect.jsx +13 -13
  37. package/src/components/SingleSelectOption.jsx +7 -13
  38. package/src/components/SingleSelectValue.jsx +7 -6
  39. package/src/components/TabbedSelect.jsx +10 -10
  40. package/src/components/TagBox.jsx +1 -1
  41. package/src/components/TagBoxMenuSelect.jsx +8 -8
  42. package/src/components/TagBoxValueSelect.jsx +9 -8
  43. package/.buildkite/pipeline.yml +0 -5
  44. package/jest_0/haste-map-7e9d9c62c6a662023c5d70c339d0ced6-7cc69482edc7eb47bffb62d943e851b2 +0 -1
  45. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/06/CalendarSelectMenu_0679a734fd26e8140710c91a2af73fdc +0 -67
  46. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/0a/MultiSelect.spec_0aefd16b0f09b26294e82fb93fe1e4b0 +0 -56
  47. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/0e/CalendarRangeSelectValueAdapter_0e2460820b4c7f3bc73311146b33d735 +0 -38
  48. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/10/styleMock_1054df670b2b25a407717710ad14248e +0 -2
  49. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/17/BaseValueAdapter_17511db398391484fe4506f5fb9bd5e1 +0 -34
  50. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/1b/SingleSelectInputValue_1b0040997a8e46813a394be3df8d4902 +0 -21
  51. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/1e/SingleSelectOption.spec_1e96cdf77f96dbcb3c3e99ccf1e6162e +0 -48
  52. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/21/SingleSelectValue_21803244102691ca5021420840c10377 +0 -14
  53. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/23/Collapse_233c7ec28f5b68acaeb91eb3fe6ab4a8 +0 -29
  54. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/23/TabbedSelect.spec_23d563a9f085b056db12caf92bdf3a6b +0 -132
  55. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/26/BasicMenu.spec_267a046ea90c9e11ba1060c8d4296399 +0 -41
  56. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/28/comparators_28f44e6dd602b9cf338ddf679330692a +0 -15
  57. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/2a/TagBox.spec_2aab3c34fb4bedfb663e01ed8860b92d +0 -125
  58. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/2c/MultiSelectOption.spec_2ce3fc75e1b935ca998f2de22a5fa1e2 +0 -100
  59. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/30/BadgeValue_3086cf0362fc10cf60860d93d22c44e0 +0 -54
  60. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/32/TagBoxValue_320444b52aab3fde04dd463ac15d98fe +0 -36
  61. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/35/CalendarInput.spec_354c6add6b94157fdd3a7285d6095b54 +0 -149
  62. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/36/CalendarRangeSelectValueAdapter.spec_3626d6dbf2a83120d5a5d862e175d843 +0 -59
  63. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/38/SelectOption.spec_3840fafef6784d17cf7e40b17ecce88e +0 -96
  64. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/45/TabbedMenu.spec_45955bd4d417a673c51fb3a53eaabdb2 +0 -259
  65. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/4d/BaseValueAdapter.spec_4d1d47358891a347e7bf833a6d040ea7 +0 -30
  66. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/4d/SelectValue.spec_4d42c95a61ecede772952464d21833e7 +0 -106
  67. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/4d/TagBoxMenu_4d2e828a6ff7c4a9a4cc2198963a9b70 +0 -34
  68. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/4e/CalendarInput_4ef2298695da3980204ea452b7fdb0a4 +0 -160
  69. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/56/Collapse.spec_560240621f26d92bd3369c0d14e933f0 +0 -26
  70. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/5a/MultiSelectValueAdapter.spec_5a0adb43772ad6bb7389179241874a84 +0 -104
  71. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/5f/InputValue_5fa5b4c2a24f25c31f10553db3eca2a7 +0 -102
  72. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/61/PriceMenu.spec_614afe08ff89b9d73123f4f3fb02a1e5 +0 -214
  73. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/64/InputValueMenu_647f6d09be204b353c37fb7f7ae83528 +0 -30
  74. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/65/CalendarRangeSelect_65dfcee5434a980da3608f757e45331d +0 -91
  75. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/66/CalendarRangeSelect.spec_66a914f5794d15aee1f09b02b6196f3b +0 -93
  76. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/68/CalendarRangeSelectMenu_68b72bc98b1ca2af1002082e02937a3a +0 -94
  77. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/6d/MenuContainer_6d38ef91176713e8764a565c842288be +0 -20
  78. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/74/MenuContainer.spec_743a8c2e8e0fa76429d3bd6f978bd662 +0 -14
  79. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/75/PriceMenu_75405250d3e4f5e03f03595b38367c74 +0 -169
  80. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/78/SingleSelectValueAdapter.spec_78efc1145a6c7b878b73046dd6c377e3 +0 -26
  81. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/7a/MomentValueAdapter.spec_7a902fadac5ab558e9eab31c2efe7e62 +0 -34
  82. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/7d/constants_7d77953ab3aab9177392ca1253527944 +0 -2
  83. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/80/CalendarSelectMenu.spec_802d520df5723c56c5a8c3324b7481da +0 -30
  84. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/83/setupShims_83b5988778590bd57241b8324efa72ca +0 -1
  85. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/86/BadgeValue.spec_8672a63efcfee7da91fa15ba5a35cd01 +0 -68
  86. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/86/PriceSelect.spec_8673730442271be421a9829646d05ce2 +0 -119
  87. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8a/LoadingIcon_8a35f5a59768201d2879ace3aa9523a7 +0 -10
  88. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8a/enhanceWithInputEl.spec_8a7b3d4d0425819c272ab4059e697379 +0 -95
  89. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8b/KeyInterceptingInput.spec_8b687c9b90b903499eaf8f91d9f994b3 +0 -63
  90. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8e/AsyncSelect_8ea6fa986adeff02b70d417e1a15218c +0 -134
  91. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8e/keys_8e4410378373c7787da90cac9d9d60af +0 -21
  92. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8f/PropTypes_8f855737e91f1a2770253b10397ac8ee +0 -10
  93. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/8f/SelectValue_8ff517c39801f6615c73b22975b6447a +0 -119
  94. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/91/SingleSelect_91b44d0827c7f15e26bc4e887823c206 +0 -83
  95. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/93/setupEnzyme_933f67f8c39c258b9d2335cbe4e95364 +0 -4
  96. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/97/PriceSelect_979c59a0e85681717c67156c65f9f809 +0 -109
  97. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/98/BasicMinLengthComponent_98bb21df3528956f5cbb019301e14b94 +0 -15
  98. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/9b/AsyncSelect.spec_9baf86a23020df3259e4fb6df8431f1d +0 -51
  99. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/9c/TagBoxMenu.spec_9cb3bee05b20c81208feb0572bf2bd04 +0 -26
  100. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/9e/TabbedSelect_9e04df7b8be41cc32cc8c50f7f5b7a48 +0 -58
  101. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/a9/InputValueMenu.spec_a9acf02a3913b35fe24e9d3bae4089e5 +0 -26
  102. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/a9/SingleSelectValueAdapter_a9bc352946e0fe578ce65f0c505bda44 +0 -41
  103. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/ae/TagBoxValue.spec_ae6486a049d279c74e941ea760764a14 +0 -34
  104. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/af/MultiSelectValueAdapter_af678a8270b3e04d8f158e8ac9505ca7 +0 -68
  105. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/b0/InputValue.spec_b073e3e2e5dbce98021066a66b122b2c +0 -60
  106. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/b5/OptionsList_b52e9f2995c75ea418697ae4f06db4f5 +0 -45
  107. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/bc/SingleSelectOption_bcf8a7eb60900c59cc157ac55fcfb723 +0 -38
  108. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/c0/MultiSelect_c0cfb2897119c1114c5fd6f7fd7d2e62 +0 -67
  109. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/c4/MomentValueAdapter_c4c276e31cbde7d1dc1dc1d77a594c55 +0 -20
  110. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/c5/StaticOption_c5f2d27b6d481b908294b6f5e0592fc2 +0 -19
  111. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/ce/BadgeMultiSelect.spec_cec7790f84a802fb2c18c54b9a4a921a +0 -54
  112. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/cf/OptionListSet.spec_cfb367e294a0aae3bb664eef88eb623d +0 -228
  113. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/d3/KeyInterceptingInput_d3d304879a1492b66561fce4c7416045 +0 -82
  114. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/d5/BasicEmptyOptionComponent_d58e7bb15fc2c2e13e6a757d28b199ac +0 -9
  115. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/d5/SelectCore.spec_d5e3246996684e4fba29e3631f8aefac +0 -607
  116. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/d6/BadgeMultiSelect_d6bd228b127952f6048b92c9abd3b57b +0 -53
  117. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/de/BasicMenu_de0cecbf6799211a8fe532411d3cc873 +0 -30
  118. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/e0/SelectOption_e0dc8f19358a9abd1be87aa601087b01 +0 -94
  119. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/e4/TabbedMenu_e43d45a4f7ac8251d7ef028ada2db057 +0 -179
  120. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/e6/enzyme-utils_e690f31d3397a9c58160a842e4841fc6 +0 -28
  121. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/ee/MultiSelectValue_eed682d3f60fcaefe5dfb72897e40bc7 +0 -15
  122. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f2/SingleSelect.spec_f2793726a47820587f4b6f4150a1b24a +0 -61
  123. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f3/OptionListSet_f3b8e87c2a3458f2b438026d738fc523 +0 -283
  124. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f3/SingleSelectBadgeValue_f3e3c5ab7337817ca6db6d4fcb5121f8 +0 -26
  125. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f5/SelectCore_f567e49d18b5a7ff59d0ff5fe63a70e3 +0 -813
  126. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f6/MultiSelectOption_f608cb6868889a67fc5dac232a6b8ec7 +0 -62
  127. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/f9/enhanceWithInputEl_f9a5a0417082d5840b0e596275f4ee20 +0 -68
  128. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/fa/OptionsList.spec_fa9ff971f8b2b9c2677afe983a25ee14 +0 -26
  129. package/jest_0/jest-transform-cache-7e9d9c62c6a662023c5d70c339d0ced6-cdaa23008ea48aa7daacfe6b1614ac51/fa/TagBox_fa0d3141352322432b32d7aa9686e96e +0 -151
  130. package/jest_0/perf-cache-7e9d9c62c6a662023c5d70c339d0ced6-1f0ac540392d6926145e8e0c6fdddd0b +0 -1
@@ -1,813 +0,0 @@
1
- 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.PureSelectCore = undefined;var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _react = require('react');var _react2 = _interopRequireDefault(_react);
2
- var _propTypes = require('prop-types');var _propTypes2 = _interopRequireDefault(_propTypes);
3
-
4
- var _assign = require('lodash/assign');var _assign2 = _interopRequireDefault(_assign);
5
- var _debounce = require('lodash/debounce');var _debounce2 = _interopRequireDefault(_debounce);
6
- var _isUndefined = require('lodash/isUndefined');var _isUndefined2 = _interopRequireDefault(_isUndefined);
7
- var _omit = require('lodash/omit');var _omit2 = _interopRequireDefault(_omit);
8
- var _reactOnclickoutside = require('react-onclickoutside');var _reactOnclickoutside2 = _interopRequireDefault(_reactOnclickoutside);
9
- var _uniqueId = require('lodash/uniqueId');var _uniqueId2 = _interopRequireDefault(_uniqueId);
10
-
11
- var _SelectCore = require('./styles/SelectCore.scss');var _SelectCore2 = _interopRequireDefault(_SelectCore);
12
-
13
- var _constants = require('../constants');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self, call) {if (!self) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call && (typeof call === "object" || typeof call === "function") ? call : self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;}
14
-
15
- /**
16
- The primary Select component which manages the state for the entire select and renders subcomponents. It controls
17
- whether the dropdown is opened/closed, which option is currently selected, which open has focus, filtering options
18
- and fetching async options.
19
-
20
- SelectCore is used by passing it three subcomponents as props: ValueComponent, MenuComponent and OptionComponent.
21
- SelectCore then renders these components and passes its public methods as props to them, so they can manipulate
22
- SelectCore's state based on user action. Any additional props are also passed to the subcomponents so additional
23
- functionality can be added for specific selects.
24
- */var
25
- SelectCore = function (_Component) {_inherits(SelectCore, _Component);
26
- function SelectCore(props) {_classCallCheck(this, SelectCore);var _this = _possibleConstructorReturn(this, (SelectCore.__proto__ || Object.getPrototypeOf(SelectCore)).call(this,
27
- props));
28
-
29
- _this.changeText = _this.changeText.bind(_this);
30
- _this.changeValue = _this.changeValue.bind(_this);
31
- _this.clearValue = _this.clearValue.bind(_this);
32
- _this.closeMenu = _this.closeMenu.bind(_this);
33
- _this.getCollapsibleState = _this.getCollapsibleState.bind(_this);
34
- _this.onBackspace = _this.onBackspace.bind(_this);
35
- _this.onDown = _this.onDown.bind(_this);
36
- _this.onEnter = _this.onEnter.bind(_this);
37
- _this.onUp = _this.onUp.bind(_this);
38
- _this.onSpace = _this.onSpace.bind(_this);
39
- _this.onTab = _this.onTab.bind(_this);
40
- _this.onEscape = _this.onEscape.bind(_this);
41
- _this.openMenu = _this.openMenu.bind(_this);
42
- _this.setIndex = _this.setIndex.bind(_this);
43
- _this.toggleCollapsedValue = _this.toggleCollapsedValue.bind(_this);
44
- _this.toggleValue = _this.toggleValue.bind(_this);
45
- _this.valueIsSelected = _this.valueIsSelected.bind(_this);
46
-
47
- _this.loadOptions = (0, _debounce2.default)(_this.loadOptions, 400);
48
-
49
- _this.state = {
50
- currentText: '',
51
- currentValue: _this._getInitialValue(props),
52
- isOpen: false,
53
- optionIndex: _this._getInitialOptionIndex(props),
54
- options: props.options || null,
55
- loading: false,
56
- collapsedOptions: {} };
57
-
58
-
59
- _this.menuRef = _react2.default.createRef();
60
- _this.menuId = 'select-menu-' + (0, _uniqueId2.default)();return _this;
61
- }
62
-
63
- // Lifecycle Functions
64
- _createClass(SelectCore, [{ key: 'componentDidMount', value: function componentDidMount() {var _props =
65
- this.props,loadFromValue = _props.loadFromValue,valueAdapter = _props.valueAdapter,value = _props.value,loadOptions = _props.loadOptions,minLength = _props.minLength;
66
-
67
- if (loadFromValue && !valueAdapter.valueIsEqualToProp(valueAdapter.emptyValue, value)) {
68
- this.loadFromValue(value);
69
- }
70
-
71
- if (loadOptions && !minLength) {
72
- this.loadOptions();
73
- }
74
- } }, { key: 'UNSAFE_componentWillReceiveProps', value: function UNSAFE_componentWillReceiveProps(
75
-
76
- nextProps) {var
77
- value = nextProps.value,valueAdapter = nextProps.valueAdapter,loadFromValue = nextProps.loadFromValue,loadOptions = nextProps.loadOptions;
78
-
79
- // This line prevents the reconciliation of props.value for uncontrolled components
80
- if ((0, _isUndefined2.default)(this.props.value) && (0, _isUndefined2.default)(value)) return;
81
-
82
- var newValueProp = (0, _isUndefined2.default)(value) ? valueAdapter.emptyValue : value;
83
-
84
- // This is to reconcile props.value with internal state of currentValue. If a prop different from the currentValue
85
- // of the select is passed in, it attempts to parse it accordingly and set the state
86
- if (loadFromValue) {
87
- if (!valueAdapter.valueIsEqualToProp(this.state.currentValue, newValueProp)) {
88
- if (!valueAdapter.valueIsEqualToProp(valueAdapter.emptyValue, newValueProp)) {
89
- this.loadFromValue(newValueProp);
90
- } else {
91
- this.changeValue(newValueProp, false);
92
- }
93
- }
94
- } else if (loadOptions) {
95
- if (!valueAdapter.valuesAreEqual(this.state.currentValue, newValueProp)) {
96
- this.changeValue(newValueProp, false);
97
- }
98
- } else {
99
- var newValue = valueAdapter.getOptionsForValueProp(nextProps.options, newValueProp);
100
-
101
- if (!valueAdapter.valuesAreEqual(this.state.currentValue, newValue)) {
102
- this.setState({ currentValue: newValue, options: nextProps.options });
103
- } else {
104
- this.setState({ options: nextProps.options });
105
- }
106
- }
107
- } }, { key: 'componentDidUpdate', value: function componentDidUpdate(
108
-
109
- prevProps, prevState) {var _props2 =
110
- this.props,onOptionsFiltered = _props2.onOptionsFiltered,onChangeText = _props2.onChangeText;
111
-
112
- if (prevState.currentText !== this.state.currentText) {
113
- if (onOptionsFiltered) {
114
- onOptionsFiltered(this._getFilteredOptions());
115
- }
116
-
117
- if (onChangeText) {
118
- onChangeText(this.state.currentText);
119
- }
120
- }
121
- }
122
-
123
- // Toggle Menu Functions
124
- /**
125
- * Triggered by onClickOutside HOC
126
- */ }, { key: 'handleClickOutside', value: function handleClickOutside()
127
- {
128
- if (this.state.isOpen) {
129
- return this.closeMenu();
130
- }
131
- }
132
-
133
- /**
134
- * Closes menu and triggers on onOpen handler
135
- * @param {boolean} whether onClose triggered with select from a dropdown
136
- * @public
137
- */ }, { key: 'closeMenu', value: function closeMenu()
138
- {var _props3 =
139
- this.props,alwaysOpen = _props3.alwaysOpen,disableOnClickOutside = _props3.disableOnClickOutside,onClose = _props3.onClose;
140
-
141
- if (alwaysOpen) return;
142
-
143
- if (disableOnClickOutside) {
144
- disableOnClickOutside();
145
- }
146
-
147
- this.setState({ isOpen: false, currentText: '' }, function () {
148
- onClose && onClose();
149
- });
150
- }
151
-
152
- /**
153
- * opensMenu menu and triggers onOpen handlers
154
- * @public
155
- */ }, { key: 'openMenu', value: function openMenu()
156
- {var _this2 = this;var _props4 =
157
- this.props,alwaysOpen = _props4.alwaysOpen,enableOnClickOutside = _props4.enableOnClickOutside,onOpen = _props4.onOpen,disabled = _props4.disabled;
158
-
159
- if (disabled) return;
160
-
161
- if (alwaysOpen) return;
162
-
163
- if (enableOnClickOutside) {
164
- enableOnClickOutside();
165
- }
166
-
167
- this.setState({ isOpen: true }, function () {
168
- // Filterable components should focus on the input field first
169
- if (!_this2.props.filterable) {
170
- _this2.menuRef.current && _this2.menuRef.current.focus();
171
- }
172
- onOpen && onOpen();
173
- });
174
- }
175
-
176
- // Keyboard Functions
177
- /**
178
- * Should be called when a backspace event is detected by a lowerlevel component. If it is a multi-select and there
179
- * are multiple options selected, it deletes the last one.
180
- * @public
181
- */ }, { key: 'onBackspace', value: function onBackspace(
182
- e) {
183
- var currentValue = this.state.currentValue;
184
- if (this.props.multiple && currentValue.length > 0 && this.state.currentText.length === 0) {
185
- e.preventDefault();
186
- this.changeValue(currentValue.slice(0, -1));
187
- }
188
- }
189
-
190
- // Keyboard Functions
191
- /**
192
- * Should be called when a down event is detected by a lowerlevel component. Increments the option with focus by one.
193
- * @public
194
- */ }, { key: 'onDown', value: function onDown()
195
- {
196
- var options = this._getFilteredOptions();
197
-
198
- if (!options || !options.length) {
199
- return;
200
- }
201
-
202
- var newIndex = void 0;
203
- if (this.state.optionIndex === null) {
204
- newIndex = 0;
205
- } else {
206
- newIndex = (this.state.optionIndex + 1) % options.length;
207
- }
208
-
209
- this.setIndex(newIndex);
210
- }
211
-
212
- /**
213
- * Should be called when an enter event is detected by a lowerlevel component. Selects an option with focus.
214
- * @public
215
- */ }, { key: 'onEnter', value: function onEnter()
216
- {
217
- var options = this._getFilteredOptions();
218
-
219
- if (this.props.optionSets && this.props.optionSets.length > 1) {
220
- options = options.sort(function (a, b) {return a.groupIndex - b.groupIndex;});
221
- }
222
-
223
- if (options && options.length && this.state.optionIndex !== null) {
224
- var option = options[this.state.optionIndex];
225
- this.toggleValue(option);
226
- this.changeText('');
227
- }
228
- }
229
-
230
- /**
231
- * Should be called when an up event is detected by a lowerlevel component. Either selects an option with focus or
232
- * closes dropdown if no options have focus
233
- * @public
234
- */ }, { key: 'onUp', value: function onUp()
235
- {
236
- var options = this._getFilteredOptions();
237
-
238
- if (!options || !options.length) {
239
- return;
240
- }
241
-
242
- var newIndex = void 0;
243
- if (this.state.optionIndex === null) {
244
- newIndex = 0;
245
- } else {
246
- newIndex = (this.state.optionIndex || options.length) - 1;
247
- }
248
-
249
- this.setIndex(newIndex);
250
- }
251
-
252
-
253
- /**
254
- * Should be called when an up event is detected by a lowerlevel component. Opens the menu.
255
- * @public
256
- */ }, { key: 'onSpace', value: function onSpace()
257
- {
258
- this.openMenu();
259
- }
260
-
261
- /**
262
- * Should be called when an up event is detected by a lowerlevel component. Closes the menu.
263
- * @public
264
- */ }, { key: 'onEscape', value: function onEscape()
265
- {
266
- this.closeMenu();
267
- }
268
-
269
- /**
270
- * Should be called when an up event is detected by a lowerlevel component.
271
- * Prevents tabbing away when the menu is open.
272
- * @public
273
- */ }, { key: 'onTab', value: function onTab()
274
- {
275
- if (this.state.isOpen) {
276
- this.closeMenu();
277
- }
278
- }
279
-
280
- /**
281
- * Changes the index of the option with focus
282
- * @param {number} idx new index
283
- * @public
284
- */ }, { key: 'setIndex', value: function setIndex(
285
- idx) {
286
- this.setState({ optionIndex: idx });
287
- }
288
-
289
- // Changing currentValue functions
290
- /**
291
- * Resets the value to the emptyValue of the valueAdapter
292
- * @public
293
- */ }, { key: 'clearValue', value: function clearValue()
294
- {
295
- this.changeValue(this.props.valueAdapter.emptyValue);
296
- }
297
-
298
- /**
299
- * Changes the currentValue of the select and then triggers onChange handlers
300
- * @param {any} newValue
301
- * @param {boolean} broadcast whether to trigger the onChange or not
302
- * @public
303
- */ }, { key: 'changeValue', value: function changeValue(
304
- newValue) {var _this3 = this;var broadcast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
305
- if (!this.props.valueAdapter.valuesAreEqual(this.state.currentValue, newValue)) {
306
- this.setState({ currentValue: newValue }, function () {
307
- if (broadcast && _this3.props.onChange) {
308
- var valueToBroadcast = newValue;
309
- if (_this3.state.options || _this3.props.loadOptions) {
310
- if (_this3.props.multiple) {
311
- valueToBroadcast = valueToBroadcast.map(function (item) {return item.value;});
312
- } else {
313
- valueToBroadcast = valueToBroadcast && valueToBroadcast.value;
314
- }
315
- }
316
-
317
- _this3.props.onChange(valueToBroadcast);
318
- }
319
- });
320
- }
321
- }
322
-
323
- /**
324
- * Toggles the value according to logic in ValueAdapter. also triggers onChange handlers and closes the menu if
325
- * props.closeOnSelect is true
326
- * @param {any} value
327
- * @public
328
- */ }, { key: 'toggleValue', value: function toggleValue(
329
- value) {
330
- var newValue = this.props.valueAdapter.toggleValue(this.state.currentValue, value);
331
-
332
- // change value
333
- this.changeValue(newValue);
334
-
335
- // and close
336
- if (this.props.closeOnSelect) {
337
- this.closeMenu();
338
- }
339
- }
340
-
341
- // Text functions
342
-
343
- /**
344
- * Changes the currentText of the select. If it is an async select, this triggers loadOptions. If it is a filterable
345
- * select this will cause the options to filter
346
- * @param {string} text
347
- * @public
348
- */ }, { key: 'changeText', value: function changeText(
349
- text) {var _this4 = this;
350
- var newOptions = this._getFilteredOptions(text);
351
- var newOptionIndex = this._getNewOptionIndex(newOptions);
352
-
353
- this.setState({ currentText: text, optionIndex: newOptionIndex }, function () {
354
- if (_this4.props.loadOptions) {
355
- if (_this4._isBelowMinLength()) {
356
- _this4.setState({ loading: false, options: null, optionIndex: null });
357
- _this4.loadOptions.cancel();
358
- } else {
359
- _this4.loadOptions();
360
- }
361
- }
362
- });
363
- } }, { key: 'toggleCollapsedValue', value: function toggleCollapsedValue(
364
-
365
- value) {
366
- this.setState(function (currentState) {
367
- var currentCollapsedState = !!currentState.collapsedOptions[value];
368
- var newValue = Object.assign({}, currentState.collapsedOptions, _defineProperty({}, value, !currentCollapsedState));
369
-
370
- return {
371
- collapsedOptions: newValue };
372
-
373
- });
374
- }
375
-
376
- // Async functions
377
- /**
378
- * This is typically triggered when the select gets passed a new value and is used to populate the select with the
379
- * correct value/label pair.
380
- * @param {string} text
381
- */ }, { key: 'loadFromValue', value: function loadFromValue(
382
- value) {var _this5 = this;
383
- this.setState({ loading: true });
384
- return this.props.loadFromValue(value).then(function (result) {
385
- if (_this5.props.value !== value) {
386
- return;
387
- }
388
-
389
- _this5.setState({ loading: false });
390
- var options = _this5.props.processLoadFromValue(result);
391
- var newValue = _this5.props.valueAdapter.getOptionsForValueProp(options, value);
392
- _this5.changeValue(newValue, false);
393
- });
394
- }
395
-
396
- /**
397
- * This is typically triggered when the select's currentText gets changed and loads new async options for the select.
398
- */ }, { key: 'loadOptions', value: function loadOptions()
399
- {var _this6 = this;
400
- this.setState({ loading: true });
401
- var currentText = this.state.currentText;
402
- return this.props.loadOptions(currentText).then(function (result) {
403
- if (currentText !== _this6.state.currentText) {
404
- return;
405
- }
406
-
407
- var options = _this6.props.processLoadOptions(result);
408
- var newOptionIndex = _this6._getNewOptionIndex(options);
409
-
410
- _this6.setState({ options: options, loading: false, optionIndex: newOptionIndex });
411
- });
412
- }
413
-
414
- // Public Utility Functions
415
- /**
416
- * Checks if the value is currently selected. Used as a utility method when rendering option components to simplify
417
- * logic of figuring out if they are selected or not.
418
- * @param {any} newValue
419
- * @public
420
- */ }, { key: 'valueIsSelected', value: function valueIsSelected(
421
- newValue) {
422
- return this.props.valueAdapter.valueIsSelected(this.state.currentValue, newValue);
423
- } }, { key: 'getCollapsibleState', value: function getCollapsibleState(
424
-
425
- value) {
426
- if (!this.props.collapsibleOptions) {
427
- return null;
428
- }
429
-
430
- if (this.state.currentText) {
431
- return null;
432
- }
433
-
434
- var isCollapsible = this.props.collapsibleOptions.indexOf(value) > -1;
435
-
436
- if (!isCollapsible) {
437
- return null;
438
- }
439
-
440
-
441
- if (this.state.collapsedOptions[value]) {
442
- return _constants.OPTION_COLLAPSED;
443
- }
444
-
445
- return _constants.OPTION_NOT_COLLAPSED;
446
- }
447
-
448
- // Private methods and helpers
449
- /**
450
- * Returns options filtered by props.filterOption and currentText. Is memoized to reduce repeating same computation
451
- * repeatedly. Can also optionally take a text argument, so that it can be used for determining filtered options
452
- * before currentText is flushed to state
453
- */ }, { key: '_getFilteredOptions', value: function _getFilteredOptions(
454
- text) {var _this7 = this;
455
- if (typeof text === 'undefined') {
456
- text = this.state.currentText;
457
- }
458
-
459
- if (!this.state.options) {
460
- return this.state.options;
461
- }
462
-
463
- var args = [this.state.options, this.props.filterOption, text, this.state.collapsedOptions];
464
- if (this._cachedArgs && this._cachedArgs.every(function (arg, i) {return args[i] === arg;})) {
465
- return this._cachedResult;
466
- }
467
-
468
- this._cachedArgs = args;
469
- this._cachedResult = this.state.options.filter(function (option) {
470
- if (!text && option.hasOwnProperty('collapsedBy')) {
471
- var isHidden = _this7.getCollapsibleState(option.collapsedBy) === _constants.OPTION_COLLAPSED;
472
- if (isHidden) {
473
- return false;
474
- }
475
- }
476
- return _this7.props.filterOption(option, text);
477
- });
478
-
479
- return this._cachedResult;
480
- } }, { key: '_getInitialValue', value: function _getInitialValue(
481
-
482
- props) {
483
- if ((0, _isUndefined2.default)(props.value)) {
484
- return props.valueAdapter.emptyValue;
485
- }
486
-
487
- if (this.props.loadFromValue) {
488
- return props.valueAdapter.emptyValue;
489
- }
490
-
491
- if (this.props.loadOptions) {
492
- return props.value || props.valueAdapter.emptyValue;
493
- }
494
-
495
- return this.props.valueAdapter.getOptionsForValueProp(props.options, props.value);
496
- }
497
-
498
- /**
499
- * This returns an index of an option that should be highlighted at start.
500
- */ }, { key: '_getInitialOptionIndex', value: function _getInitialOptionIndex(
501
- props) {
502
- if (props.options && props.options.length > 0) {
503
- return 0;
504
- } else {
505
- return null;
506
- }
507
- }
508
-
509
- /**
510
- * Figures out what the selected optionIndex should be after the options change
511
- */ }, { key: '_getNewOptionIndex', value: function _getNewOptionIndex(
512
- newOptions) {
513
- var newOptionIndex = void 0;
514
-
515
- if (this.state.optionIndex == null) {
516
- newOptionIndex = null;
517
- } else if (this.state.optionIndex >= newOptions.length) {
518
- newOptionIndex = newOptions.length - 1;
519
- } else {
520
- newOptionIndex = this.state.optionIndex;
521
- }
522
-
523
- return newOptionIndex;
524
- }
525
-
526
- /**
527
- * Determines if the currentText is below the minLength requirement. Passed as a boolean to child components
528
- */ }, { key: '_isBelowMinLength', value: function _isBelowMinLength()
529
- {
530
- if (!this.props.minLength) {
531
- return false;
532
- }
533
-
534
- return this.props.minLength > this.state.currentText.length;
535
- }
536
-
537
- /**
538
- * Determines if the child components should render the menu at all. Passed as a boolean to child components
539
- */ }, { key: '_shouldShowOptionList', value: function _shouldShowOptionList()
540
- {
541
- if (this.state.options && this.state.options.length) {
542
- return true;
543
- } else if (this._isBelowMinLength()) {
544
- return true;
545
- } else if (this.state.options && this.state.options.length === 0 && !this.state.loading) {
546
- return true;
547
- }
548
-
549
- return false;
550
- }
551
-
552
- /**
553
- * Determines if the currentValue is equiavlent to the valueAdapter.emptyValue. Passed as a boolean to child components
554
- */ }, { key: '_isEmpty', value: function _isEmpty()
555
- {
556
- return this.props.valueAdapter.valuesAreEqual(this.state.currentValue, this.props.valueAdapter.emptyValue);
557
- }
558
-
559
- // Rendering functions
560
- /**
561
- * Creates an object of the props to pass to child components. Takes props passed in, adds in public methods, current
562
- * state and also calculates some values based on current state
563
- */ }, { key: 'generateChildProps', value: function generateChildProps()
564
- {
565
- var omitProps = [
566
- 'closeOnSelect', 'MenuComponent', 'OptionComponent', 'onChange', 'onClose', 'onOpen', 'renderValueLabel',
567
- 'renderOptionLabel', 'ValueComponent', 'options'];
568
-
569
-
570
- var customProps = _omit2.default.apply(undefined, [this.props].concat(omitProps));
571
-
572
- return (0, _assign2.default)(customProps, {
573
- ariaLabel: this.props.ariaLabel,
574
- clearValue: this.clearValue,
575
- changeValue: this.changeValue,
576
- currentValue: this.state.currentValue,
577
- currentText: this.state.currentText,
578
- changeText: this.changeText,
579
- closeMenu: this.closeMenu,
580
- isBelowMinLength: this._isBelowMinLength(),
581
- isEmpty: this._isEmpty(),
582
- isOpen: this.props.alwaysOpen ? true : this.state.isOpen,
583
- loading: this.state.loading,
584
- multiple: this.props.multiple,
585
- onBackspace: this.onBackspace,
586
- onDown: this.onDown,
587
- onEnter: this.onEnter,
588
- onUp: this.onUp,
589
- openMenu: this.openMenu,
590
- optionIndex: this.state.optionIndex,
591
- setIndex: this.setIndex,
592
- shouldShowOptionList: this._shouldShowOptionList(),
593
- toggleValue: this.toggleValue,
594
- toggleCollapsedValue: this.toggleCollapsedValue });
595
-
596
- } }, { key: 'renderMenu', value: function renderMenu()
597
-
598
- {var _props5 =
599
- this.props,MenuComponent = _props5.MenuComponent,OptionComponent = _props5.OptionComponent,renderOptionLabel = _props5.renderOptionLabel;
600
- var options = this._getFilteredOptions();
601
- var props = this.generateChildProps();
602
-
603
- return (
604
- _react2.default.createElement(MenuComponent, _extends({
605
- options: options,
606
- valueIsSelected: this.valueIsSelected,
607
- getCollapsibleState: this.getCollapsibleState,
608
- OptionComponent: OptionComponent,
609
- renderOptionLabel: renderOptionLabel,
610
- onUp: this.onUp,
611
- onDown: this.onDown,
612
- onEnter: this.onEnter,
613
- onSpace: this.onSpace,
614
- onEscape: this.onEscape,
615
- onTab: this.onTab,
616
- reference: this.menuRef,
617
- menuId: this.menuId },
618
- props)));
619
-
620
-
621
- } }, { key: 'renderValue', value: function renderValue()
622
-
623
- {var
624
- ValueComponent = this.props.ValueComponent;
625
- var childProps = this.generateChildProps();
626
-
627
- return (
628
- _react2.default.createElement(ValueComponent, _extends({
629
- renderValueLabel: this.props.renderValueLabel,
630
- onSpace: this.onSpace,
631
- onUp: this.onUp,
632
- onDown: this.onDown,
633
- onEnter: this.onEnter,
634
- onEscape: this.onEscape,
635
- onTab: this.onTab,
636
- menuId: this.menuId },
637
- childProps)));
638
-
639
-
640
- } }, { key: 'render', value: function render()
641
-
642
- {
643
- return (
644
- _react2.default.createElement('div', { className: _SelectCore2.default.select, id: this.props.id },
645
- this.renderValue(),
646
- (this.state.isOpen || this.props.alwaysOpen) && this.renderMenu()));
647
-
648
-
649
- } }]);return SelectCore;}(_react.Component);
650
-
651
-
652
- SelectCore.propTypes = {
653
- // public props
654
- /**
655
- Should always render the MenuComponent
656
- */
657
- alwaysOpen: _propTypes2.default.bool,
658
- /**
659
- * Label to be read out by assistive devices
660
- */
661
- ariaLabel: _propTypes2.default.string,
662
- /**
663
- Should the select close when an option is selected
664
- */
665
- closeOnSelect: _propTypes2.default.bool,
666
- /**
667
- Component rendered when there are no options (i.e. if Async loadOptions returns no options)
668
- */
669
- /**
670
- Current state of input
671
- */
672
- currentText: _propTypes2.default.string,
673
- EmptyOptionComponent: _propTypes2.default.func,
674
- /**
675
- Function used to determine which options should show when options are being filtered. Called once with each
676
- option.
677
- * @param {object} option
678
- * @param {string} currentText
679
- */
680
- filterOption: _propTypes2.default.func,
681
- /**
682
- Function used to fetch async options. Is invoked with currentText and should return a promise with the options
683
- * @param {string} str
684
- * @returns {Promise}
685
- */
686
- loadOptions: _propTypes2.default.func,
687
- /**
688
- * Function used to fetch options based on a value prop passed into the Select, so the label can be loaded
689
- * asynchronously. Should return a promise with the options
690
- * @param {any} value
691
- * @returns {Promise}
692
- */
693
- loadFromValue: _propTypes2.default.func,
694
- /**
695
- * Component representing the dropdown menu
696
- */
697
- MenuComponent: _propTypes2.default.func.isRequired,
698
- /**
699
- * Class passed to MenuContainer
700
- */
701
- menuContainerClassName: _propTypes2.default.string,
702
- /**
703
- * Minimum length of text input needed fetch async options
704
- */
705
- minLength: _propTypes2.default.number,
706
- /**
707
- * Whether or not it is a single or a multi select
708
- */
709
- multiple: _propTypes2.default.bool,
710
- /**
711
- * Callback triggered with the currentValue of the select when it is changed. If selects uses options, it is triggered
712
- * with the value attr of the options. If it does not use options, it triggers it with the entire currentValue
713
- */
714
- onChange: _propTypes2.default.func,
715
- /**
716
- * Callback triggered when the dropdown closes
717
- */
718
- onClose: _propTypes2.default.func,
719
- /**
720
- * Callback triggered when the dropdown ups
721
- */
722
- onOpen: _propTypes2.default.func,
723
- /**
724
- * Component representing an individual option in the dropdown menu
725
- */
726
- OptionComponent: _propTypes2.default.func,
727
- /**
728
- * List of options to render. Should be format {value: 'Value', label: 'Label'}
729
- */
730
- options: _propTypes2.default.array,
731
- /**
732
- * List of groups of options, which will be displayed in the UI as separate sublists, typically with the label at the top.
733
- * If a string is provided, it defaults all the options to be in that optionSet.
734
- * This is useful for including a label at the beginning of the options.
735
- */
736
- optionSets: _propTypes2.default.oneOfType([_propTypes2.default.array, _propTypes2.default.string]),
737
- /**
738
- * Callback called on the result of loadOptions so it can be coerced to the proper format
739
- */
740
- processLoadOptions: _propTypes2.default.func,
741
- /**
742
- * Callback called on the result of processLoadFromValue so it can be coerced to the proper format
743
- */
744
- processLoadFromValue: _propTypes2.default.func,
745
- /**
746
- * Function used by OptionComponent to render the label, so that it can be customized without adding a new
747
- * OptionComponent
748
- *
749
- * @param {object} option
750
- */
751
- renderOptionLabel: _propTypes2.default.func,
752
- /**
753
- * Function used by ValueComponent to render the label, so that it can be customized without adding a new
754
- * ValueComponent
755
- *
756
- * @param {object} option
757
- */
758
- renderValueLabel: _propTypes2.default.func,
759
- /**
760
- * Whether or not an option should unselect itself when it is clicked again. Allows us to have a more sticky "required"
761
- * UX
762
- */
763
- unselectOnClick: _propTypes2.default.bool,
764
- /**
765
- * Object implementing the ValueAdapter interface which is used for comparing and manipulating the currentValue of
766
- * the SelectCore
767
- */
768
- valueAdapter: _propTypes2.default.object,
769
- /**
770
- Populates the currentValue of SelectCore
771
- */
772
- value: _propTypes2.default.any,
773
- /**
774
- * Component representing the selected value of the selected
775
- */
776
- ValueComponent: _propTypes2.default.func.isRequired,
777
-
778
- // onClickOutside props
779
- enableOnClickOutside: _propTypes2.default.func,
780
- disableOnClickOutside: _propTypes2.default.func,
781
- disabled: _propTypes2.default.bool,
782
- filterable: _propTypes2.default.bool,
783
- onOptionsFiltered: _propTypes2.default.func,
784
- onChangeText: _propTypes2.default.func,
785
- collapsibleOptions: _propTypes2.default.array,
786
-
787
- // add a unique id for testing purposes and accessibility
788
- id: _propTypes2.default.string };
789
-
790
-
791
-
792
- SelectCore.defaultProps = {
793
- alwaysOpen: false,
794
- closeOnSelect: true,
795
- filterOption: function filterOption(option, currentText) {
796
- if (!currentText) {
797
- return true;
798
- } else {
799
- var lowercase = currentText.toLowerCase();
800
- return option.label.toLowerCase().indexOf(lowercase) > -1;
801
- }
802
- },
803
- isOpen: false,
804
- multiple: false,
805
- processLoadOptions: function processLoadOptions(resp) {return resp;},
806
- processLoadFromValue: function processLoadFromValue(resp) {return resp;},
807
- unselectOnClick: true };
808
-
809
-
810
- var WrappedSelectCore = (0, _reactOnclickoutside2.default)(SelectCore);exports.default =
811
-
812
- WrappedSelectCore;exports.
813
- PureSelectCore = SelectCore; // for testing with shallow rendering