@transferwise/components 46.130.2 → 46.131.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.
Files changed (610) hide show
  1. package/build/dateInput/DateInput.js +12 -5
  2. package/build/dateInput/DateInput.js.map +1 -1
  3. package/build/dateInput/DateInput.mjs +11 -4
  4. package/build/dateInput/DateInput.mjs.map +1 -1
  5. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +16 -8
  6. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  7. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +14 -6
  8. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  9. package/build/index.js +12 -7
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +9 -3
  12. package/build/index.mjs.map +1 -1
  13. package/build/inputs/{_BottomSheet.js → SelectInput/BottomSheet/SelectInputBottomSheet.js} +7 -7
  14. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +1 -0
  15. package/build/inputs/{_BottomSheet.mjs → SelectInput/BottomSheet/SelectInputBottomSheet.mjs} +7 -7
  16. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +1 -0
  17. package/build/inputs/{_ButtonInput.js → SelectInput/ButtonInput/SelectInputButtonInput.js} +5 -5
  18. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +1 -0
  19. package/build/inputs/{_ButtonInput.mjs → SelectInput/ButtonInput/SelectInputButtonInput.mjs} +5 -5
  20. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +1 -0
  21. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +26 -0
  22. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +1 -0
  23. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +24 -0
  24. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +1 -0
  25. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +59 -0
  26. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +1 -0
  27. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +56 -0
  28. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +1 -0
  29. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +50 -0
  30. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +1 -0
  31. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +48 -0
  32. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +1 -0
  33. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +47 -0
  34. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +1 -0
  35. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +45 -0
  36. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +1 -0
  37. package/build/inputs/SelectInput/Option/SelectInputOption.js +42 -0
  38. package/build/inputs/SelectInput/Option/SelectInputOption.js.map +1 -0
  39. package/build/inputs/SelectInput/Option/SelectInputOption.mjs +40 -0
  40. package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +1 -0
  41. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +40 -0
  42. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +1 -0
  43. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +38 -0
  44. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +1 -0
  45. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +48 -0
  46. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +1 -0
  47. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +46 -0
  48. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +1 -0
  49. package/build/inputs/SelectInput/Options/SelectInputOptions.js +300 -0
  50. package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +1 -0
  51. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +298 -0
  52. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +1 -0
  53. package/build/inputs/{_Popover.js → SelectInput/Popover/SelectInputPopover.js} +7 -7
  54. package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +1 -0
  55. package/build/inputs/{_Popover.mjs → SelectInput/Popover/SelectInputPopover.mjs} +7 -7
  56. package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +1 -0
  57. package/build/inputs/SelectInput/SelectInput.contexts.js +29 -0
  58. package/build/inputs/SelectInput/SelectInput.contexts.js.map +1 -0
  59. package/build/inputs/SelectInput/SelectInput.contexts.mjs +24 -0
  60. package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +1 -0
  61. package/build/inputs/SelectInput/SelectInput.js +222 -0
  62. package/build/inputs/SelectInput/SelectInput.js.map +1 -0
  63. package/build/inputs/SelectInput/SelectInput.messages.js.map +1 -0
  64. package/build/inputs/SelectInput/SelectInput.messages.mjs.map +1 -0
  65. package/build/inputs/SelectInput/SelectInput.mjs +216 -0
  66. package/build/inputs/SelectInput/SelectInput.mjs.map +1 -0
  67. package/build/inputs/SelectInput/SelectInput.utils.js +164 -0
  68. package/build/inputs/SelectInput/SelectInput.utils.js.map +1 -0
  69. package/build/inputs/SelectInput/SelectInput.utils.mjs +154 -0
  70. package/build/inputs/SelectInput/SelectInput.utils.mjs.map +1 -0
  71. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +42 -0
  72. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -0
  73. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +36 -0
  74. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -0
  75. package/build/main.css +27094 -97
  76. package/build/moneyInput/MoneyInput.js +9 -2
  77. package/build/moneyInput/MoneyInput.js.map +1 -1
  78. package/build/moneyInput/MoneyInput.mjs +8 -1
  79. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  80. package/build/phoneNumberInput/PhoneNumberInput.js +10 -3
  81. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  82. package/build/phoneNumberInput/PhoneNumberInput.mjs +9 -2
  83. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  84. package/build/styles/css/accordion.css +255 -0
  85. package/build/styles/css/alerts.css +751 -0
  86. package/build/styles/css/background.css +20 -0
  87. package/build/styles/css/badge.css +90 -0
  88. package/build/styles/css/border-radius.css +3 -0
  89. package/build/styles/css/breadcrumbs.css +20 -0
  90. package/build/styles/css/button-groups.css +495 -0
  91. package/build/styles/css/buttons.css +1390 -0
  92. package/build/styles/css/chevron.css +35 -0
  93. package/build/styles/css/circles.css +248 -0
  94. package/build/styles/css/close.css +47 -0
  95. package/build/styles/css/column-layout.css +164 -0
  96. package/build/styles/css/currency-flags.css +46 -0
  97. package/build/styles/css/decision.css +136 -0
  98. package/build/styles/css/dropdowns.css +472 -0
  99. package/build/styles/css/droppable.css +221 -0
  100. package/build/styles/css/flex.css +598 -0
  101. package/build/styles/css/footer.css +129 -0
  102. package/build/styles/css/grid.css +2369 -0
  103. package/build/styles/css/input-groups.css +2740 -0
  104. package/build/styles/css/link-callout.css +20 -0
  105. package/build/styles/css/list-group.css +350 -0
  106. package/build/styles/css/loaders.css +76 -0
  107. package/build/styles/css/media.css +74 -0
  108. package/build/styles/css/modals.css +185 -0
  109. package/build/styles/css/navbar.css +2406 -0
  110. package/build/styles/css/navs.css +296 -0
  111. package/build/styles/css/neptune-social-media.css +144 -0
  112. package/build/styles/css/neptune.css +25724 -0
  113. package/build/styles/css/panels.css +528 -0
  114. package/build/styles/css/popovers.css +661 -0
  115. package/build/styles/css/process.css +483 -0
  116. package/build/styles/css/progress-bars.css +64 -0
  117. package/build/styles/css/ring.css +55 -0
  118. package/build/styles/css/select.css +99 -0
  119. package/build/styles/css/sequences.css +855 -0
  120. package/build/styles/css/table.css +446 -0
  121. package/build/styles/css/tick.css +32 -0
  122. package/build/styles/css/tooltip.css +160 -0
  123. package/build/styles/css/utilities.css +145 -0
  124. package/build/styles/css/wells.css +74 -0
  125. package/build/styles/fonts/TW-Averta-Bold.woff +0 -0
  126. package/build/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  127. package/build/styles/fonts/TW-Averta-Regular.woff +0 -0
  128. package/build/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  129. package/build/styles/fonts/TW-Averta-Semibold.woff +0 -0
  130. package/build/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  131. package/build/styles/fonts/TransferWise-IconFont.svg +81 -0
  132. package/build/styles/fonts/TransferWise-IconFont.woff +0 -0
  133. package/build/styles/fonts/WiseSans-Heavy.woff2 +0 -0
  134. package/build/styles/fonts/inter-cyrillic-ext-variable-wghtOnly-normal.woff2 +0 -0
  135. package/build/styles/fonts/inter-cyrillic-variable-wghtOnly-normal.woff2 +0 -0
  136. package/build/styles/fonts/inter-greek-ext-variable-wghtOnly-normal.woff2 +0 -0
  137. package/build/styles/fonts/inter-greek-variable-wghtOnly-normal.woff2 +0 -0
  138. package/build/styles/fonts/inter-latin-ext-variable-wghtOnly-normal.woff2 +0 -0
  139. package/build/styles/fonts/inter-latin-variable-wghtOnly-normal.woff2 +0 -0
  140. package/build/styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2 +0 -0
  141. package/build/styles/img/bg-dark.svg +31 -0
  142. package/build/styles/img/bg-light.svg +26 -0
  143. package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
  144. package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
  145. package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
  146. package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
  147. package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +33 -0
  148. package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
  149. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
  150. package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
  151. package/build/styles/less/legacy-variables.css +0 -0
  152. package/build/styles/less/legacy-variables.less +1299 -0
  153. package/build/styles/less/neptune-tokens.css +0 -0
  154. package/build/styles/less/neptune-tokens.less +275 -0
  155. package/build/styles/less/zindex.css +0 -0
  156. package/build/styles/less/zindex.less +17 -0
  157. package/build/styles/main.css +27094 -97
  158. package/build/styles/props/custom-media.css +11 -0
  159. package/build/styles/props/legacy-custom-props.css +69 -0
  160. package/build/styles/props/neptune-tokens.css +152 -0
  161. package/build/styles/styles/less/accordion.css +255 -0
  162. package/build/styles/styles/less/alerts.css +751 -0
  163. package/build/styles/styles/less/background.css +20 -0
  164. package/build/styles/styles/less/badge.css +90 -0
  165. package/build/styles/styles/less/border-radius.css +3 -0
  166. package/build/styles/styles/less/breadcrumbs.css +20 -0
  167. package/build/styles/styles/less/button-groups.css +495 -0
  168. package/build/styles/styles/less/buttons.css +1390 -0
  169. package/build/styles/styles/less/chevron.css +35 -0
  170. package/build/styles/styles/less/circles.css +248 -0
  171. package/build/styles/styles/less/close.css +47 -0
  172. package/build/styles/styles/less/column-layout.css +164 -0
  173. package/build/styles/styles/less/core/viewport-themes.css +59 -0
  174. package/build/styles/styles/less/currency-flags.css +46 -0
  175. package/build/styles/styles/less/decision.css +136 -0
  176. package/build/styles/styles/less/dropdowns.css +472 -0
  177. package/build/styles/styles/less/droppable.css +221 -0
  178. package/build/styles/styles/less/flex.css +598 -0
  179. package/build/styles/styles/less/footer.css +129 -0
  180. package/build/styles/styles/less/forms/bootstrap-forms.css +2277 -0
  181. package/build/styles/styles/less/forms/checkbox-radio.css +367 -0
  182. package/build/styles/styles/less/grid.css +2369 -0
  183. package/build/styles/styles/less/input-groups.css +2740 -0
  184. package/build/styles/styles/less/link-callout.css +20 -0
  185. package/build/styles/styles/less/list-group.css +350 -0
  186. package/build/styles/styles/less/loaders.css +76 -0
  187. package/build/styles/styles/less/media.css +74 -0
  188. package/build/styles/styles/less/modals.css +185 -0
  189. package/build/styles/styles/less/navbar.css +2406 -0
  190. package/build/styles/styles/less/navs.css +296 -0
  191. package/build/styles/styles/less/neptune-social-media.css +144 -0
  192. package/build/styles/styles/less/neptune.css +25724 -0
  193. package/build/styles/styles/less/panels.css +528 -0
  194. package/build/styles/styles/less/popovers.css +661 -0
  195. package/build/styles/styles/less/process.css +483 -0
  196. package/build/styles/styles/less/progress-bars.css +64 -0
  197. package/build/styles/styles/less/ring.css +55 -0
  198. package/build/styles/styles/less/select.css +99 -0
  199. package/build/styles/styles/less/sequences.css +855 -0
  200. package/build/styles/styles/less/table.css +446 -0
  201. package/build/styles/styles/less/tick.css +32 -0
  202. package/build/styles/styles/less/tooltip.css +160 -0
  203. package/build/styles/styles/less/utilities.css +145 -0
  204. package/build/styles/styles/less/wells.css +74 -0
  205. package/build/styles/styles/props/custom-media.css +11 -0
  206. package/build/styles/styles/props/legacy-custom-props.css +69 -0
  207. package/build/styles/styles/props/neptune-tokens.css +11 -0
  208. package/build/styles/styles/variables/legacy-variables.css +0 -0
  209. package/build/styles/styles/variables/neptune-tokens.css +0 -0
  210. package/build/styles/styles/variables/zindex.css +0 -0
  211. package/build/types/index.d.ts +1 -1
  212. package/build/types/index.d.ts.map +1 -1
  213. package/build/types/inputs/{_BottomSheet.d.ts → SelectInput/BottomSheet/SelectInputBottomSheet.d.ts} +3 -3
  214. package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +1 -0
  215. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +3 -0
  216. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +1 -0
  217. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +5 -0
  218. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +1 -0
  219. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +3 -0
  220. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +1 -0
  221. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +7 -0
  222. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +1 -0
  223. package/build/types/inputs/SelectInput/ClearButton/index.d.ts +3 -0
  224. package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +1 -0
  225. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +16 -0
  226. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +1 -0
  227. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +2 -0
  228. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +1 -0
  229. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +9 -0
  230. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +1 -0
  231. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +3 -0
  232. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +1 -0
  233. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +11 -0
  234. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +1 -0
  235. package/build/types/inputs/SelectInput/ItemView/index.d.ts +4 -0
  236. package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +1 -0
  237. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +11 -0
  238. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +1 -0
  239. package/build/types/inputs/SelectInput/Option/index.d.ts +3 -0
  240. package/build/types/inputs/SelectInput/Option/index.d.ts.map +1 -0
  241. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +13 -0
  242. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +1 -0
  243. package/build/types/inputs/SelectInput/OptionContent/index.d.ts +3 -0
  244. package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +1 -0
  245. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +9 -0
  246. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +1 -0
  247. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +3 -0
  248. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +1 -0
  249. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +21 -0
  250. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +1 -0
  251. package/build/types/inputs/SelectInput/Options/index.d.ts +4 -0
  252. package/build/types/inputs/SelectInput/Options/index.d.ts.map +1 -0
  253. package/build/types/inputs/{_Popover.d.ts → SelectInput/Popover/SelectInputPopover.d.ts} +3 -3
  254. package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +1 -0
  255. package/build/types/inputs/SelectInput/Popover/index.d.ts +3 -0
  256. package/build/types/inputs/SelectInput/Popover/index.d.ts.map +1 -0
  257. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +33 -0
  258. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +1 -0
  259. package/build/types/inputs/SelectInput/SelectInput.d.ts +10 -0
  260. package/build/types/inputs/SelectInput/SelectInput.d.ts.map +1 -0
  261. package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +1 -0
  262. package/build/types/inputs/{SelectInput.d.ts → SelectInput/SelectInput.types.d.ts} +12 -38
  263. package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +1 -0
  264. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +60 -0
  265. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +1 -0
  266. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +12 -0
  267. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -0
  268. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +3 -0
  269. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +1 -0
  270. package/build/types/inputs/SelectInput/components.d.ts +10 -0
  271. package/build/types/inputs/SelectInput/components.d.ts.map +1 -0
  272. package/build/types/inputs/SelectInput/index.d.ts +10 -0
  273. package/build/types/inputs/SelectInput/index.d.ts.map +1 -0
  274. package/package.json +9 -5
  275. package/src/{DisabledComponents.story.tsx → DisabledComponents.test.story.tsx} +1 -1
  276. package/src/accordion/Accordion.less +3 -3
  277. package/src/actionButton/ActionButton.less +1 -1
  278. package/src/actionButton/ActionButton.story.tsx +11 -7
  279. package/src/actionButton/ActionButton.test.story.tsx +49 -0
  280. package/src/avatar/Avatar.less +3 -3
  281. package/src/avatarLayout/AvatarLayout.story.tsx +1 -105
  282. package/src/avatarLayout/AvatarLayout.test.story.tsx +117 -0
  283. package/src/avatarView/AvatarView.story.tsx +1 -104
  284. package/src/avatarView/AvatarView.test.story.tsx +114 -0
  285. package/src/badge/Badge.less +1 -1
  286. package/src/button/LegacyButton.less +1 -1
  287. package/src/button/LegacyButton.story.tsx +1 -26
  288. package/src/button/LegacyButton.test.story.tsx +37 -0
  289. package/src/button/_stories/Button.story.tsx +17 -41
  290. package/src/button/_stories/Button.test.story.tsx +30 -0
  291. package/src/card/Card.less +3 -3
  292. package/src/checkbox/Checkbox.story.tsx +1 -6
  293. package/src/checkbox/Checkbox.test.story.tsx +33 -0
  294. package/src/checkboxButton/CheckboxButton.less +2 -2
  295. package/src/chips/Chip.less +3 -3
  296. package/src/circularButton/CircularButton.story.tsx +0 -6
  297. package/src/circularButton/CircularButton.test.story.tsx +62 -1
  298. package/src/common/Option/Option.less +2 -2
  299. package/src/common/bottomSheet/BottomSheet.less +1 -1
  300. package/src/common/bottomSheet/BottomSheet.story.tsx +0 -55
  301. package/src/common/bottomSheet/BottomSheet.test.story.tsx +118 -2
  302. package/src/common/closeButton/CloseButton.less +1 -1
  303. package/src/common/panel/Panel.less +1 -1
  304. package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +1 -1
  305. package/src/dateLookup/DateLookup.less +1 -1
  306. package/src/dateLookup/DateLookup.story.tsx +0 -18
  307. package/src/dateLookup/DateLookup.test.story.tsx +51 -1
  308. package/src/dateLookup/dateTrigger/DateTrigger.less +2 -2
  309. package/src/decision/Decision.less +1 -1
  310. package/src/definitionList/DefinitionList.less +1 -1
  311. package/src/dimmer/Dimmer.less +2 -2
  312. package/src/divider/Divider.story.tsx +0 -1
  313. package/src/expressiveMoneyInput/ExpressiveMoneyInput.autofocus.docs.mdx +1 -1
  314. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +0 -9
  315. package/src/expressiveMoneyInput/ExpressiveMoneyInput.test.story.tsx +23 -0
  316. package/src/field/Field.story.tsx +1 -34
  317. package/src/field/Field.test.story.tsx +56 -0
  318. package/src/flowNavigation/FlowNavigation.less +1 -1
  319. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +2 -2
  320. package/src/header/Header.test.story.tsx +1 -1
  321. package/src/index.ts +0 -1
  322. package/src/info/Info.less +1 -1
  323. package/src/info/Info.story.tsx +1 -34
  324. package/src/info/Info.test.story.tsx +53 -0
  325. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +0 -12
  326. package/src/inputWithDisplayFormat/InputWithDisplayFormat.test.story.tsx +33 -0
  327. package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
  328. package/src/inputs/{_BottomSheet.tsx → SelectInput/BottomSheet/SelectInputBottomSheet.tsx} +7 -7
  329. package/src/inputs/SelectInput/BottomSheet/index.ts +2 -0
  330. package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
  331. package/src/inputs/{_ButtonInput.tsx → SelectInput/ButtonInput/SelectInputButtonInput.tsx} +5 -5
  332. package/src/inputs/SelectInput/ButtonInput/index.ts +2 -0
  333. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
  334. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +39 -0
  335. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +27 -0
  336. package/src/inputs/SelectInput/ClearButton/index.ts +2 -0
  337. package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +74 -0
  338. package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +5 -0
  339. package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +61 -0
  340. package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +2 -0
  341. package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
  342. package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +17 -0
  343. package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +48 -0
  344. package/src/inputs/SelectInput/ItemView/index.ts +3 -0
  345. package/src/inputs/SelectInput/Option/SelectInputOption.css +33 -0
  346. package/src/inputs/SelectInput/Option/SelectInputOption.less +32 -0
  347. package/src/inputs/SelectInput/Option/SelectInputOption.tsx +57 -0
  348. package/src/inputs/SelectInput/Option/index.ts +2 -0
  349. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
  350. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +38 -0
  351. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +72 -0
  352. package/src/inputs/SelectInput/OptionContent/index.ts +2 -0
  353. package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +59 -0
  354. package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +2 -0
  355. package/src/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
  356. package/src/inputs/SelectInput/Options/SelectInputOptions.less +77 -0
  357. package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +411 -0
  358. package/src/inputs/SelectInput/Options/index.ts +3 -0
  359. package/src/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
  360. package/src/inputs/{_Popover.tsx → SelectInput/Popover/SelectInputPopover.tsx} +7 -7
  361. package/src/inputs/SelectInput/Popover/index.ts +2 -0
  362. package/src/inputs/SelectInput/SelectInput.contexts.tsx +40 -0
  363. package/src/inputs/SelectInput/SelectInput.less +22 -0
  364. package/src/inputs/{SelectInput.test.tsx → SelectInput/SelectInput.test.tsx} +9 -11
  365. package/src/inputs/SelectInput/SelectInput.tsx +257 -0
  366. package/src/inputs/SelectInput/SelectInput.types.ts +113 -0
  367. package/src/inputs/SelectInput/SelectInput.utils.ts +205 -0
  368. package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +36 -0
  369. package/src/inputs/SelectInput/TriggerButton/index.ts +5 -0
  370. package/src/inputs/{SelectInput.docs.mdx → SelectInput/_stories/SelectInput.docs.mdx} +0 -1
  371. package/src/inputs/{SelectInput.story.tsx → SelectInput/_stories/SelectInput.story.tsx} +11 -8
  372. package/src/inputs/{SelectInput.test.story.tsx → SelectInput/_stories/SelectInput.test.story.tsx} +6 -10
  373. package/src/inputs/SelectInput/components.ts +10 -0
  374. package/src/inputs/SelectInput/index.ts +12 -0
  375. package/src/inputs/_common.less +1 -1
  376. package/src/legacylistItem/LegacyListItem.test.story.tsx +1 -1
  377. package/src/link/Link.less +2 -2
  378. package/src/listItem/ListItem.less +1 -1
  379. package/src/listItem/_stories/Breakpoints/ListItem.noMedia.test.story.tsx +1 -1
  380. package/src/listItem/_stories/Breakpoints/ListItem.sideMedia.test.story.tsx +1 -1
  381. package/src/listItem/_stories/Breakpoints/ListItem.stackedMedia.test.story.tsx +1 -1
  382. package/src/listItem/_stories/ListItem.focus.test.story.tsx +1 -1
  383. package/src/listItem/_stories/ListItem.layout.test.story.tsx +1 -1
  384. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +1 -1
  385. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +1 -1
  386. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +1 -1
  387. package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +1 -1
  388. package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +1 -1
  389. package/src/listItem/_stories/variants/ListItem.personal.test.story.tsx +1 -1
  390. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +1 -1
  391. package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +1 -1
  392. package/src/logo/Logo.story.tsx +0 -6
  393. package/src/logo/Logo.test.story.tsx +20 -0
  394. package/src/main.css +27094 -97
  395. package/src/main.less +3 -1
  396. package/src/modal/Modal.story.tsx +0 -26
  397. package/src/modal/Modal.test.story.tsx +125 -0
  398. package/src/moneyInput/MoneyInput.less +2 -2
  399. package/src/moneyInput/MoneyInput.test.story.tsx +1 -1
  400. package/src/navigationOption/NavigationOption.less +3 -3
  401. package/src/navigationOptionsList/NavigationOptionsList.less +1 -1
  402. package/src/overlayHeader/OverlayHeader.less +1 -1
  403. package/src/phoneNumberInput/PhoneNumberInput.less +1 -1
  404. package/src/popover/Popover.less +1 -1
  405. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +0 -43
  406. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +45 -1
  407. package/src/radioGroup/RadioGroup.test.story.tsx +1 -1
  408. package/src/select/Select.less +5 -5
  409. package/src/slidingPanel/SlidingPanel.less +2 -2
  410. package/src/snackbar/Snackbar.less +3 -3
  411. package/src/stepper/Stepper.less +3 -3
  412. package/src/stepper/Stepper.test.story.tsx +1 -1
  413. package/src/styles/fonts/TW-Averta-Bold.woff +0 -0
  414. package/src/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  415. package/src/styles/fonts/TW-Averta-Regular.woff +0 -0
  416. package/src/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  417. package/src/styles/fonts/TW-Averta-Semibold.woff +0 -0
  418. package/src/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  419. package/src/styles/fonts/TransferWise-IconFont.svg +81 -0
  420. package/src/styles/fonts/TransferWise-IconFont.woff +0 -0
  421. package/src/styles/fonts/WiseSans-Heavy.woff2 +0 -0
  422. package/src/styles/fonts/inter-cyrillic-ext-variable-wghtOnly-normal.woff2 +0 -0
  423. package/src/styles/fonts/inter-cyrillic-variable-wghtOnly-normal.woff2 +0 -0
  424. package/src/styles/fonts/inter-greek-ext-variable-wghtOnly-normal.woff2 +0 -0
  425. package/src/styles/fonts/inter-greek-variable-wghtOnly-normal.woff2 +0 -0
  426. package/src/styles/fonts/inter-latin-ext-variable-wghtOnly-normal.woff2 +0 -0
  427. package/src/styles/fonts/inter-latin-variable-wghtOnly-normal.woff2 +0 -0
  428. package/src/styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2 +0 -0
  429. package/src/styles/img/bg-dark.svg +31 -0
  430. package/src/styles/img/bg-light.svg +26 -0
  431. package/src/styles/less/accordion.css +255 -0
  432. package/src/styles/less/accordion.less +15 -0
  433. package/src/styles/less/addons/_background-utilities.less +82 -0
  434. package/src/styles/less/addons/_border.less +3 -0
  435. package/src/styles/less/addons/_display-utilities.less +159 -0
  436. package/src/styles/less/addons/_spacing-utilities.less +73 -0
  437. package/src/styles/less/addons/_utilities.less +147 -0
  438. package/src/styles/less/alerts.css +751 -0
  439. package/src/styles/less/alerts.less +252 -0
  440. package/src/styles/less/background.css +20 -0
  441. package/src/styles/less/background.less +24 -0
  442. package/src/styles/less/badge.css +90 -0
  443. package/src/styles/less/badge.less +85 -0
  444. package/src/styles/less/border-radius.css +3 -0
  445. package/src/styles/less/border-radius.less +3 -0
  446. package/src/styles/less/breadcrumbs.css +20 -0
  447. package/src/styles/less/breadcrumbs.less +27 -0
  448. package/src/styles/less/button-groups.css +495 -0
  449. package/src/styles/less/button-groups.less +424 -0
  450. package/src/styles/less/buttons.css +1390 -0
  451. package/src/styles/less/buttons.less +738 -0
  452. package/src/styles/less/chevron.css +35 -0
  453. package/src/styles/less/chevron.less +39 -0
  454. package/src/styles/less/circles.css +248 -0
  455. package/src/styles/less/circles.less +233 -0
  456. package/src/styles/less/close.css +47 -0
  457. package/src/styles/less/close.less +48 -0
  458. package/src/styles/less/column-layout.css +164 -0
  459. package/src/styles/less/column-layout.less +167 -0
  460. package/src/styles/less/components/_component-animations.less +43 -0
  461. package/src/styles/less/core/_fonts.less +97 -0
  462. package/src/styles/less/core/_scaffolding.less +380 -0
  463. package/src/styles/less/core/_typography-utilities.less +255 -0
  464. package/src/styles/less/core/_typography.less +575 -0
  465. package/src/styles/less/core/viewport-themes.css +59 -0
  466. package/src/styles/less/core/viewport-themes.less +65 -0
  467. package/src/styles/less/currency-flags.css +46 -0
  468. package/src/styles/less/currency-flags.less +42 -0
  469. package/src/styles/less/decision.css +136 -0
  470. package/src/styles/less/decision.less +98 -0
  471. package/src/styles/less/dropdowns.css +472 -0
  472. package/src/styles/less/dropdowns.less +365 -0
  473. package/src/styles/less/droppable.css +221 -0
  474. package/src/styles/less/droppable.less +213 -0
  475. package/src/styles/less/flex.css +598 -0
  476. package/src/styles/less/flex.less +113 -0
  477. package/src/styles/less/footer.css +129 -0
  478. package/src/styles/less/footer.less +113 -0
  479. package/src/styles/less/forms/bootstrap-forms.css +2277 -0
  480. package/src/styles/less/forms/bootstrap-forms.less +1218 -0
  481. package/src/styles/less/forms/checkbox-radio.css +367 -0
  482. package/src/styles/less/forms/checkbox-radio.less +330 -0
  483. package/src/styles/less/grid.css +2369 -0
  484. package/src/styles/less/grid.less +187 -0
  485. package/src/styles/less/input-groups.css +2740 -0
  486. package/src/styles/less/input-groups.less +298 -0
  487. package/src/styles/less/link-callout.css +20 -0
  488. package/src/styles/less/link-callout.less +17 -0
  489. package/src/styles/less/list-group.css +350 -0
  490. package/src/styles/less/list-group.less +260 -0
  491. package/src/styles/less/loaders.css +76 -0
  492. package/src/styles/less/loaders.less +91 -0
  493. package/src/styles/less/media.css +74 -0
  494. package/src/styles/less/media.less +68 -0
  495. package/src/styles/less/mixins/_alerts.less +39 -0
  496. package/src/styles/less/mixins/_arrows.less +52 -0
  497. package/src/styles/less/mixins/_border-radius.less +11 -0
  498. package/src/styles/less/mixins/_buttons.less +82 -0
  499. package/src/styles/less/mixins/_center-block.less +7 -0
  500. package/src/styles/less/mixins/_clearfix.less +23 -0
  501. package/src/styles/less/mixins/_flex.less +105 -0
  502. package/src/styles/less/mixins/_forms.less +130 -0
  503. package/src/styles/less/mixins/_grid-framework.less +104 -0
  504. package/src/styles/less/mixins/_grid.less +158 -0
  505. package/src/styles/less/mixins/_hide-text.less +20 -0
  506. package/src/styles/less/mixins/_links.less +7 -0
  507. package/src/styles/less/mixins/_list-group.less +23 -0
  508. package/src/styles/less/mixins/_logical-properties-IE-friendly.less +381 -0
  509. package/src/styles/less/mixins/_logical-properties-modern-browsers.less +226 -0
  510. package/src/styles/less/mixins/_logical-properties.less +5 -0
  511. package/src/styles/less/mixins/_nav-divider.less +10 -0
  512. package/src/styles/less/mixins/_nav-vertical-align.less +10 -0
  513. package/src/styles/less/mixins/_panels.less +23 -0
  514. package/src/styles/less/mixins/_physical-properties.less +110 -0
  515. package/src/styles/less/mixins/_reset-text.less +22 -0
  516. package/src/styles/less/mixins/_sequence.less +203 -0
  517. package/src/styles/less/mixins/_spacing.less +122 -0
  518. package/src/styles/less/mixins/_tab-focus.less +5 -0
  519. package/src/styles/less/mixins/_table-row.less +47 -0
  520. package/src/styles/less/mixins/_text-emphasis.less +39 -0
  521. package/src/styles/less/mixins/_text-overflow.less +8 -0
  522. package/src/styles/less/mixins/_theming.less +7 -0
  523. package/src/styles/less/modals.css +185 -0
  524. package/src/styles/less/modals.less +239 -0
  525. package/src/styles/less/navbar.css +2406 -0
  526. package/src/styles/less/navbar.less +1442 -0
  527. package/src/styles/less/navs.css +296 -0
  528. package/src/styles/less/navs.less +339 -0
  529. package/src/styles/less/neptune-social-media.css +144 -0
  530. package/src/styles/less/neptune-social-media.less +84 -0
  531. package/src/styles/less/neptune.bundle.less +63 -0
  532. package/src/styles/less/neptune.css +25724 -0
  533. package/src/styles/less/panels.css +528 -0
  534. package/src/styles/less/panels.less +410 -0
  535. package/src/styles/less/popovers.css +661 -0
  536. package/src/styles/less/popovers.less +379 -0
  537. package/src/styles/less/process.css +483 -0
  538. package/src/styles/less/process.less +426 -0
  539. package/src/styles/less/progress-bars.css +64 -0
  540. package/src/styles/less/progress-bars.less +55 -0
  541. package/src/styles/less/ring.css +55 -0
  542. package/src/styles/less/ring.less +51 -0
  543. package/src/styles/less/select.css +99 -0
  544. package/src/styles/less/select.less +88 -0
  545. package/src/styles/less/sequences.css +855 -0
  546. package/src/styles/less/sequences.less +511 -0
  547. package/src/styles/less/table.css +446 -0
  548. package/src/styles/less/table.less +385 -0
  549. package/src/styles/less/tick.css +32 -0
  550. package/src/styles/less/tick.less +37 -0
  551. package/src/styles/less/tooltip.css +160 -0
  552. package/src/styles/less/tooltip.less +130 -0
  553. package/src/styles/less/utilities.css +145 -0
  554. package/src/styles/less/utilities.less +153 -0
  555. package/src/styles/less/wells.css +74 -0
  556. package/src/styles/less/wells.less +37 -0
  557. package/src/styles/props/custom-media.css +11 -0
  558. package/src/styles/props/legacy-custom-props.css +69 -0
  559. package/src/styles/props/neptune-tokens.css +11 -0
  560. package/src/styles/variables/legacy-variables.css +0 -0
  561. package/src/styles/variables/legacy-variables.less +1299 -0
  562. package/src/styles/variables/neptune-tokens.css +0 -0
  563. package/src/styles/variables/neptune-tokens.less +12 -0
  564. package/src/styles/variables/zindex.css +0 -0
  565. package/src/styles/variables/zindex.less +17 -0
  566. package/src/summary/Summary.less +1 -1
  567. package/src/summary/Summary.test.story.tsx +1 -1
  568. package/src/switch/Switch.less +4 -4
  569. package/src/table/Table.less +1 -1
  570. package/src/tabs/Tabs.less +4 -4
  571. package/src/tile/Tile.less +1 -1
  572. package/src/tooltip/Tooltip.less +1 -1
  573. package/src/tooltip/Tooltip.story.tsx +0 -21
  574. package/src/tooltip/Tooltip.test.story.tsx +42 -0
  575. package/src/typeahead/Typeahead.less +2 -2
  576. package/src/typeahead/Typeahead.story.tsx +0 -52
  577. package/src/typeahead/Typeahead.test.story.tsx +73 -0
  578. package/src/typeahead/typeaheadOption/TypeaheadOption.less +1 -1
  579. package/src/upload/Upload.less +1 -1
  580. package/src/uploadInput/UploadInput.less +2 -2
  581. package/src/uploadInput/uploadItem/UploadItem.less +1 -1
  582. package/build/inputs/SelectInput.js +0 -890
  583. package/build/inputs/SelectInput.js.map +0 -1
  584. package/build/inputs/SelectInput.messages.js.map +0 -1
  585. package/build/inputs/SelectInput.messages.mjs.map +0 -1
  586. package/build/inputs/SelectInput.mjs +0 -881
  587. package/build/inputs/SelectInput.mjs.map +0 -1
  588. package/build/inputs/_BottomSheet.js.map +0 -1
  589. package/build/inputs/_BottomSheet.mjs.map +0 -1
  590. package/build/inputs/_ButtonInput.js.map +0 -1
  591. package/build/inputs/_ButtonInput.mjs.map +0 -1
  592. package/build/inputs/_Popover.js.map +0 -1
  593. package/build/inputs/_Popover.mjs.map +0 -1
  594. package/build/types/inputs/SelectInput.d.ts.map +0 -1
  595. package/build/types/inputs/SelectInput.messages.d.ts.map +0 -1
  596. package/build/types/inputs/_BottomSheet.d.ts.map +0 -1
  597. package/build/types/inputs/_ButtonInput.d.ts +0 -5
  598. package/build/types/inputs/_ButtonInput.d.ts.map +0 -1
  599. package/build/types/inputs/_Popover.d.ts.map +0 -1
  600. package/src/inputs/SelectInput.less +0 -219
  601. package/src/inputs/SelectInput.tsx +0 -1269
  602. package/build/inputs/{SelectInput.messages.js → SelectInput/SelectInput.messages.js} +0 -0
  603. package/build/inputs/{SelectInput.messages.mjs → SelectInput/SelectInput.messages.mjs} +0 -0
  604. package/build/styles/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
  605. package/build/types/inputs/{SelectInput.messages.d.ts → SelectInput/SelectInput.messages.d.ts} +0 -0
  606. package/src/inputs/{_BottomSheet.less → SelectInput/BottomSheet/SelectInputBottomSheet.less} +0 -0
  607. package/src/inputs/{_ButtonInput.less → SelectInput/ButtonInput/SelectInputButtonInput.less} +0 -0
  608. package/src/inputs/{_Popover.less → SelectInput/Popover/SelectInputPopover.less} +0 -0
  609. package/src/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
  610. /package/src/inputs/{SelectInput.messages.ts → SelectInput/SelectInput.messages.ts} +0 -0
@@ -0,0 +1,216 @@
1
+ import mergeProps from 'merge-props';
2
+ import { useState, useRef, useEffect, useDeferredValue } from 'react';
3
+ import { Listbox } from '@headlessui/react';
4
+ import { useScreenSize } from '../../common/hooks/useScreenSize.mjs';
5
+ import { Breakpoint } from '../../common/propsValues/breakpoint.mjs';
6
+ import { useEffectEvent } from '../../common/hooks/useEffectEvent.mjs';
7
+ import { useInputAttributes } from '../contexts.mjs';
8
+ import { SelectInputBottomSheet } from './BottomSheet/SelectInputBottomSheet.mjs';
9
+ import { SelectInputPopover } from './Popover/SelectInputPopover.mjs';
10
+ import { SelectInputOptions } from './Options/SelectInputOptions.mjs';
11
+ import { jsx } from 'react/jsx-runtime';
12
+ import { DefaultRenderTrigger } from './DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs';
13
+ import { SelectInputTriggerButtonPropsContext, SelectInputOptionContentWithinTriggerContext } from './SelectInput.contexts.mjs';
14
+ import { searchableString, sortByRelevance } from './SelectInput.utils.mjs';
15
+
16
+ const noop = () => {};
17
+ /**
18
+ * SelectInput component allows users to select an option from a dropdown list.
19
+ * Supports filtering, multiple selection, and customization.
20
+ */
21
+ function SelectInput({
22
+ id: idProp,
23
+ parentId,
24
+ name,
25
+ multiple,
26
+ placeholder,
27
+ autocomplete,
28
+ items,
29
+ defaultValue,
30
+ value: controlledValue,
31
+ compareValues,
32
+ renderValue = String,
33
+ renderFooter,
34
+ renderTrigger = DefaultRenderTrigger,
35
+ filterable,
36
+ filterPlaceholder,
37
+ sortFilteredOptions,
38
+ disabled,
39
+ size = 'md',
40
+ className,
41
+ UNSAFE_triggerButtonProps,
42
+ triggerRef: externalTriggerRef,
43
+ onFilterChange = noop,
44
+ onChange,
45
+ onOpen,
46
+ onClose,
47
+ onClear
48
+ }) {
49
+ const inputAttributes = useInputAttributes({
50
+ nonLabelable: true
51
+ });
52
+ const id = idProp ?? inputAttributes.id;
53
+ const [open, setOpen] = useState(false);
54
+ const initialized = useRef(false);
55
+ const handleClose = useEffectEvent(onClose ?? (() => {}));
56
+ const handleOpen = useEffectEvent(onOpen ?? (() => {}));
57
+ useEffect(() => {
58
+ if (initialized.current) {
59
+ if (open) {
60
+ handleOpen?.();
61
+ } else {
62
+ handleClose?.();
63
+ }
64
+ } else {
65
+ initialized.current = true;
66
+ }
67
+ }, [handleClose, handleOpen, open]);
68
+ const [filterQuery, _setFilterQuery] = useState('');
69
+ const deferredFilterQuery = useDeferredValue(filterQuery);
70
+ const setFilterQuery = useEffectEvent(query => {
71
+ _setFilterQuery(query);
72
+ if (query !== filterQuery) {
73
+ onFilterChange({
74
+ query,
75
+ queryNormalized: query ? searchableString(query) : null
76
+ });
77
+ }
78
+ });
79
+ const internalTriggerRef = useRef(null);
80
+ const screenSm = useScreenSize(Breakpoint.SMALL);
81
+ const OptionsOverlay = screenSm ? SelectInputPopover : SelectInputBottomSheet;
82
+ const searchInputRef = useRef(null);
83
+ const listboxRef = useRef(null);
84
+ const controllerRef = filterable ? searchInputRef : listboxRef;
85
+ /**
86
+ * Attempts to resolve the `listbox` label
87
+ * @see https://storybook.wise.design/?path=/docs/forms-selectinput-accessibility--docs#labelling
88
+ */
89
+ const getListBoxLabelProps = () => {
90
+ if (UNSAFE_triggerButtonProps?.['aria-label']) {
91
+ return {
92
+ listBoxLabel: UNSAFE_triggerButtonProps['aria-label']
93
+ };
94
+ }
95
+ if (UNSAFE_triggerButtonProps?.['aria-labelledby']) {
96
+ return {
97
+ listBoxLabelledBy: UNSAFE_triggerButtonProps['aria-labelledby']
98
+ };
99
+ }
100
+ if (inputAttributes['aria-labelledby']) {
101
+ return {
102
+ listBoxLabelledBy: inputAttributes['aria-labelledby']
103
+ };
104
+ }
105
+ return {};
106
+ };
107
+ return /*#__PURE__*/jsx(Listbox, {
108
+ name: name,
109
+ multiple: multiple,
110
+ defaultValue: defaultValue,
111
+ value: controlledValue,
112
+ by: compareValues,
113
+ disabled: disabled,
114
+ onChange: value => {
115
+ if (!multiple) {
116
+ setOpen(false);
117
+ }
118
+ onChange?.(value);
119
+ },
120
+ children: ({
121
+ disabled: uiDisabled,
122
+ value
123
+ }) => {
124
+ const placeholderShown = multiple && Array.isArray(value) ? value.length === 0 : value == null;
125
+ return /*#__PURE__*/jsx(OptionsOverlay, {
126
+ placement: "bottom-start",
127
+ open: open,
128
+ renderTrigger: ({
129
+ ref,
130
+ getInteractionProps
131
+ }) => /*#__PURE__*/jsx(SelectInputTriggerButtonPropsContext.Provider, {
132
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
133
+ value: {
134
+ ref: node => {
135
+ ref(node);
136
+ if (externalTriggerRef) {
137
+ // eslint-disable-next-line no-param-reassign
138
+ externalTriggerRef.current = node;
139
+ } else {
140
+ internalTriggerRef.current = node;
141
+ }
142
+ },
143
+ size,
144
+ ...inputAttributes,
145
+ ...UNSAFE_triggerButtonProps,
146
+ id,
147
+ ...mergeProps({
148
+ onClick: () => {
149
+ setOpen(prev => !prev);
150
+ },
151
+ onKeyDown: event => {
152
+ if (event.key === ' ' || event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
153
+ setOpen(prev => !prev);
154
+ }
155
+ }
156
+ }, getInteractionProps())
157
+ },
158
+ children: renderTrigger({
159
+ content: !placeholderShown ? /*#__PURE__*/jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
160
+ value: true,
161
+ children: multiple && Array.isArray(value) ? value.map(option => renderValue(option, true)).filter(node => node != null).join(', ') : renderValue(value, true)
162
+ }) : placeholder,
163
+ placeholderShown,
164
+ clear: onClear != null ? () => {
165
+ onClear();
166
+ (externalTriggerRef?.current ?? internalTriggerRef.current)?.focus({
167
+ preventScroll: true
168
+ });
169
+ } : undefined,
170
+ disabled: uiDisabled,
171
+ size,
172
+ className
173
+ })
174
+ }),
175
+ initialFocusRef: controllerRef,
176
+ size: filterable ? 'lg' : 'md',
177
+ padding: "none",
178
+ onClose: () => {
179
+ setOpen(false);
180
+ },
181
+ onCloseEnd: () => {
182
+ setFilterQuery('');
183
+ },
184
+ children: /*#__PURE__*/jsx(SelectInputOptions, {
185
+ id: id ? `${id}Search` : undefined,
186
+ parentId: parentId,
187
+ items: items,
188
+ compareValues: compareValues,
189
+ renderValue: renderValue,
190
+ renderFooter: renderFooter,
191
+ filterable: filterable,
192
+ filterPlaceholder: filterPlaceholder,
193
+ sortFilteredOptions: sortFilteredOptions,
194
+ searchInputRef: searchInputRef,
195
+ listboxRef: listboxRef,
196
+ filterQuery: deferredFilterQuery,
197
+ autocomplete: autocomplete,
198
+ name: name,
199
+ onFilterChange: setFilterQuery,
200
+ onAutocompleteSelect: matchedValue => {
201
+ onChange?.(matchedValue);
202
+ if (!multiple) {
203
+ setOpen(false);
204
+ }
205
+ },
206
+ ...getListBoxLabelProps()
207
+ })
208
+ });
209
+ }
210
+ });
211
+ }
212
+ // Attach sortByRelevance to the component for convenience
213
+ SelectInput.sortByRelevance = sortByRelevance;
214
+
215
+ export { SelectInput };
216
+ //# sourceMappingURL=SelectInput.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInput.mjs","sources":["../../../src/inputs/SelectInput/SelectInput.tsx"],"sourcesContent":["import mergeProps from 'merge-props';\nimport { useEffect, useRef, useState, useDeferredValue } from 'react';\nimport { Listbox as ListboxBase } from '@headlessui/react';\nimport { useScreenSize } from '../../common/hooks/useScreenSize';\nimport { Breakpoint } from '../../common/propsValues/breakpoint';\nimport { useEffectEvent } from '../../common/hooks/useEffectEvent';\nimport { useInputAttributes } from '../contexts';\n\nimport { SelectInputBottomSheet } from './BottomSheet';\nimport { SelectInputPopover } from './Popover';\nimport { SelectInputOptions } from './Options';\nimport { DefaultRenderTrigger } from './DefaultRenderTrigger';\n\nimport {\n SelectInputOptionContentWithinTriggerContext,\n SelectInputTriggerButtonPropsContext,\n} from './SelectInput.contexts';\nimport { searchableString, sortByRelevance } from './SelectInput.utils';\nimport { SelectInputProps } from './SelectInput.types';\n\nconst noop = () => {};\n\n/**\n * SelectInput component allows users to select an option from a dropdown list.\n * Supports filtering, multiple selection, and customization.\n */\nexport function SelectInput<T = string, M extends boolean = false>({\n id: idProp,\n parentId,\n name,\n multiple,\n placeholder,\n autocomplete,\n items,\n defaultValue,\n value: controlledValue,\n compareValues,\n renderValue = String,\n renderFooter,\n renderTrigger = DefaultRenderTrigger,\n filterable,\n filterPlaceholder,\n sortFilteredOptions,\n disabled,\n size = 'md',\n className,\n UNSAFE_triggerButtonProps,\n triggerRef: externalTriggerRef,\n onFilterChange = noop,\n onChange,\n onOpen,\n onClose,\n onClear,\n}: SelectInputProps<T, M>) {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n const id = idProp ?? inputAttributes.id;\n\n const [open, setOpen] = useState(false);\n\n const initialized = useRef(false);\n const handleClose = useEffectEvent(onClose ?? (() => {}));\n const handleOpen = useEffectEvent(onOpen ?? (() => {}));\n useEffect(() => {\n if (initialized.current) {\n if (open) {\n handleOpen?.();\n } else {\n handleClose?.();\n }\n } else {\n initialized.current = true;\n }\n }, [handleClose, handleOpen, open]);\n\n const [filterQuery, _setFilterQuery] = useState('');\n const deferredFilterQuery = useDeferredValue(filterQuery);\n const setFilterQuery = useEffectEvent((query: string) => {\n _setFilterQuery(query);\n if (query !== filterQuery) {\n onFilterChange({\n query,\n queryNormalized: query ? searchableString(query) : null,\n });\n }\n });\n\n const internalTriggerRef = useRef<HTMLButtonElement | null>(null);\n\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const OptionsOverlay = screenSm ? SelectInputPopover : SelectInputBottomSheet;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n const listboxRef = useRef<HTMLDivElement>(null);\n const controllerRef = filterable ? searchInputRef : listboxRef;\n\n /**\n * Attempts to resolve the `listbox` label\n * @see https://storybook.wise.design/?path=/docs/forms-selectinput-accessibility--docs#labelling\n */\n const getListBoxLabelProps = (): {\n listBoxLabel?: string;\n listBoxLabelledBy?: string;\n } => {\n if (UNSAFE_triggerButtonProps?.['aria-label']) {\n return {\n listBoxLabel: UNSAFE_triggerButtonProps['aria-label'],\n };\n }\n\n if (UNSAFE_triggerButtonProps?.['aria-labelledby']) {\n return {\n listBoxLabelledBy: UNSAFE_triggerButtonProps['aria-labelledby'],\n };\n }\n\n if (inputAttributes['aria-labelledby']) {\n return {\n listBoxLabelledBy: inputAttributes['aria-labelledby'],\n };\n }\n\n return {};\n };\n\n return (\n <ListboxBase\n name={name}\n multiple={multiple}\n defaultValue={defaultValue as M extends true ? T[] : T}\n value={controlledValue as M extends true ? T[] : T}\n by={compareValues}\n disabled={disabled}\n onChange={\n ((value) => {\n if (!multiple) {\n setOpen(false);\n }\n onChange?.(value);\n }) satisfies SelectInputProps<T, M>['onChange']\n }\n >\n {({ disabled: uiDisabled, value }) => {\n const placeholderShown =\n multiple && Array.isArray(value) ? value.length === 0 : value == null;\n return (\n <OptionsOverlay\n placement=\"bottom-start\"\n open={open}\n renderTrigger={({ ref, getInteractionProps }) => (\n <SelectInputTriggerButtonPropsContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n ref: (node) => {\n ref(node);\n if (externalTriggerRef) {\n // eslint-disable-next-line no-param-reassign\n externalTriggerRef.current = node;\n } else {\n internalTriggerRef.current = node;\n }\n },\n size,\n ...inputAttributes,\n ...UNSAFE_triggerButtonProps,\n id,\n ...mergeProps(\n {\n onClick: () => {\n setOpen((prev) => !prev);\n },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (\n event.key === ' ' ||\n event.key === 'Enter' ||\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp'\n ) {\n setOpen((prev) => !prev);\n }\n },\n },\n getInteractionProps(),\n ),\n }}\n >\n {renderTrigger({\n content: !placeholderShown ? (\n <SelectInputOptionContentWithinTriggerContext.Provider value>\n {multiple && Array.isArray(value)\n ? (value as readonly NonNullable<T>[])\n .map((option) => renderValue(option, true))\n .filter((node) => node != null)\n .join(', ')\n : renderValue(value as NonNullable<T>, true)}\n </SelectInputOptionContentWithinTriggerContext.Provider>\n ) : (\n placeholder\n ),\n placeholderShown,\n clear:\n onClear != null\n ? () => {\n onClear();\n (externalTriggerRef?.current ?? internalTriggerRef.current)?.focus({\n preventScroll: true,\n });\n }\n : undefined,\n disabled: uiDisabled,\n size,\n className,\n })}\n </SelectInputTriggerButtonPropsContext.Provider>\n )}\n initialFocusRef={controllerRef}\n size={filterable ? 'lg' : 'md'}\n padding=\"none\"\n onClose={() => {\n setOpen(false);\n }}\n onCloseEnd={() => {\n setFilterQuery('');\n }}\n >\n <SelectInputOptions\n id={id ? `${id}Search` : undefined}\n parentId={parentId}\n items={items}\n compareValues={compareValues}\n renderValue={renderValue}\n renderFooter={renderFooter}\n filterable={filterable}\n filterPlaceholder={filterPlaceholder}\n sortFilteredOptions={sortFilteredOptions}\n searchInputRef={searchInputRef}\n listboxRef={listboxRef}\n filterQuery={deferredFilterQuery}\n autocomplete={autocomplete}\n name={name}\n onFilterChange={setFilterQuery}\n onAutocompleteSelect={(matchedValue) => {\n onChange?.(matchedValue as M extends true ? T[] : T);\n if (!multiple) {\n setOpen(false);\n }\n }}\n {...getListBoxLabelProps()}\n />\n </OptionsOverlay>\n );\n }}\n </ListboxBase>\n );\n}\n\n// Attach sortByRelevance to the component for convenience\nSelectInput.sortByRelevance = sortByRelevance;\n"],"names":["noop","SelectInput","id","idProp","parentId","name","multiple","placeholder","autocomplete","items","defaultValue","value","controlledValue","compareValues","renderValue","String","renderFooter","renderTrigger","DefaultRenderTrigger","filterable","filterPlaceholder","sortFilteredOptions","disabled","size","className","UNSAFE_triggerButtonProps","triggerRef","externalTriggerRef","onFilterChange","onChange","onOpen","onClose","onClear","inputAttributes","useInputAttributes","nonLabelable","open","setOpen","useState","initialized","useRef","handleClose","useEffectEvent","handleOpen","useEffect","current","filterQuery","_setFilterQuery","deferredFilterQuery","useDeferredValue","setFilterQuery","query","queryNormalized","searchableString","internalTriggerRef","screenSm","useScreenSize","Breakpoint","SMALL","OptionsOverlay","SelectInputPopover","SelectInputBottomSheet","searchInputRef","listboxRef","controllerRef","getListBoxLabelProps","listBoxLabel","listBoxLabelledBy","_jsx","ListboxBase","by","children","uiDisabled","placeholderShown","Array","isArray","length","placement","ref","getInteractionProps","SelectInputTriggerButtonPropsContext","Provider","node","mergeProps","onClick","prev","onKeyDown","event","key","content","SelectInputOptionContentWithinTriggerContext","map","option","filter","join","clear","focus","preventScroll","undefined","initialFocusRef","padding","onCloseEnd","SelectInputOptions","onAutocompleteSelect","matchedValue","sortByRelevance"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAMA,IAAI,GAAGA,MAAK,CAAE,CAAC;AAErB;;;AAGG;AACG,SAAUC,WAAWA,CAAwC;AACjEC,EAAAA,EAAE,EAAEC,MAAM;EACVC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,WAAW;EACXC,YAAY;EACZC,KAAK;EACLC,YAAY;AACZC,EAAAA,KAAK,EAAEC,eAAe;EACtBC,aAAa;AACbC,EAAAA,WAAW,GAAGC,MAAM;EACpBC,YAAY;AACZC,EAAAA,aAAa,GAAGC,oBAAoB;EACpCC,UAAU;EACVC,iBAAiB;EACjBC,mBAAmB;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,IAAI;EACXC,SAAS;EACTC,yBAAyB;AACzBC,EAAAA,UAAU,EAAEC,kBAAkB;AAC9BC,EAAAA,cAAc,GAAG5B,IAAI;EACrB6B,QAAQ;EACRC,MAAM;EACNC,OAAO;AACPC,EAAAA;AAAO,CACgB,EAAA;EACvB,MAAMC,eA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AE,CAAA,MAAA,CAAQ,GAAGgG,SAAU;AACnC9F,UAAAA,QAAQ,EAAEA,QAAS;AACnBK,UAAAA,KAAK,EAAEA,KAAM;AACbI,UAAAA,aAAa,EAAEA,aAAc;AAC7BC,UAAAA,WAAW,EAAEA,WAAY;AACzBE,UAAAA,YAAY,EAAEA,YAAa;AAC3BG,UAAAA,UAAU,EAAEA,UAAW;AACvBC,UAAAA,iBAAiB,EAAEA,iBAAkB;AACrCC,UAAAA,mBAAmB,EAAEA,mBAAoB;AACzCyC,UAAAA,cAAc,EAAEA,cAAe;AAC/BC,UAAAA,UAAU,EAAEA,UAAW;AACvBjB,UAAAA,WAAW,EAAEE,mBAAoB;AACjCxC,UAAAA,YAAY,EAAEA,YAAa;AAC3BH,UAAAA,IAAI,EAAEA,IAAK;AACXuB,UAAAA,cAAc,EAAEsB,cAAe;UAC/BqD,oBAAoB,EAAGC,YAAY,IAAI;YACrC3E,QAAQ,GAAG2E,YAAwC,CAAC;YACpD,IAAI,CAAClG,QAAQ,EAAE;cACb+B,OAAO,CAAC,KAAK,CAAC;AAChB,YAAA;UACF,CAAE;AAAA,UAAA,GACE4B,oBAAoB;SAAG;AAE/B,OAAgB,CAAC;AAErB,IAAA;AAAC,GACU,CAAC;AAElB;AAEA;AACAhE,WAAW,CAACwG,eAAe,GAAGA,eAAe;;;;"}
@@ -0,0 +1,164 @@
1
+ 'use strict';
2
+
3
+ const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
4
+ /**
5
+ * Converts a string to a normalized, searchable format by:
6
+ * - Trimming whitespace
7
+ * - Normalizing whitespace (convert multiple spaces to single space)
8
+ * - Converting to NFD normalization form to handle diacritics
9
+ * - Removing combining diacritical marks
10
+ * - Converting to lowercase
11
+ */
12
+ function searchableString(value) {
13
+ return value.trim().replace(/\s+/gu, ' ')
14
+ // NFD converts an Å to A + ̊ (and other special characters)
15
+ .normalize('NFD')
16
+ // and then this replaces the ̊ with nothing (and other special characters)
17
+ .replace(/[\u0300-\u036f]/g, '').toLowerCase();
18
+ }
19
+ /**
20
+ * Extracts searchable strings from a value.
21
+ * - If the value is a string, returns a normalized version.
22
+ * - If the value is an object, extracts all string values and normalizes them.
23
+ * - Otherwise returns an empty array.
24
+ */
25
+ function inferSearchableStrings(value) {
26
+ if (typeof value === 'string') {
27
+ return [searchableString(value)];
28
+ }
29
+ if (typeof value === 'object' && value != null) {
30
+ return Object.values(value).filter(innerValue => typeof innerValue === 'string').map(innerValue => searchableString(innerValue));
31
+ }
32
+ return [];
33
+ }
34
+ /**
35
+ * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.
36
+ */
37
+ function dedupeSelectInputOptionItem(item, existingValues, compareValues) {
38
+ const isDuplicate = compareValues ? Array.from(existingValues).some(existingValue => compareValues(item.value, existingValue)) : existingValues.has(item.value);
39
+ if (!isDuplicate) {
40
+ existingValues.add(item.value);
41
+ return item;
42
+ }
43
+ return {
44
+ ...item,
45
+ value: undefined
46
+ };
47
+ }
48
+ /**
49
+ * Sets the `value` of duplicate option items to `undefined`, hiding them when
50
+ * rendered. Indexes are kept intact within groups to preserve the active item
51
+ * between filter changes when possible.
52
+ */
53
+ function dedupeSelectInputItems(items, compareValues) {
54
+ const existingValues = new Set();
55
+ return items.map(item => {
56
+ switch (item.type) {
57
+ case 'option':
58
+ {
59
+ return dedupeSelectInputOptionItem(item, existingValues, compareValues);
60
+ }
61
+ case 'group':
62
+ {
63
+ return {
64
+ ...item,
65
+ options: item.options.map(option => dedupeSelectInputOptionItem(option, existingValues, compareValues))
66
+ };
67
+ }
68
+ }
69
+ return item;
70
+ });
71
+ }
72
+ /**
73
+ * Checks if a SelectInputOptionItem matches the search needle.
74
+ */
75
+ function selectInputOptionItemIncludesNeedle(item, needle) {
76
+ return inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle));
77
+ }
78
+ /**
79
+ * Filters SelectInputItems based on the provided predicate function.
80
+ * For group items, it checks if any of their options match the predicate.
81
+ */
82
+ function filterSelectInputItems(items, predicate) {
83
+ return items.filter(item => {
84
+ switch (item.type) {
85
+ case 'option':
86
+ {
87
+ return predicate(item);
88
+ }
89
+ case 'group':
90
+ {
91
+ return item.options.some(option => predicate(option));
92
+ }
93
+ }
94
+ return false;
95
+ });
96
+ }
97
+ /**
98
+ * Flattens and sorts filtered options using the provided comparator.
99
+ * Extracts all options from groups, filters out undefined values (deduplicated items),
100
+ * sorts them, and returns as a flat list of option items.
101
+ */
102
+ function sortSelectInputItems(items, compareFn, searchQuery) {
103
+ const flattenedOption = items.flatMap(item => {
104
+ if (item.type === 'option') {
105
+ return item.value !== undefined ? [item] : [];
106
+ }
107
+ if (item.type === 'group') {
108
+ return item.options.filter(option => option.value !== undefined);
109
+ }
110
+ return [];
111
+ });
112
+ // eslint-disable-next-line functional/immutable-data
113
+ return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));
114
+ }
115
+ /**
116
+ * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.
117
+ * Prioritizes: exact matches > starts with > contains > alphabetical.
118
+ *
119
+ * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * <SelectInput
124
+ * filterable
125
+ * sortFilteredOptions={sortByRelevance((value) => value.name)}
126
+ * // ...
127
+ * />
128
+ * ```
129
+ */
130
+ function sortByRelevance(getLabel = value => value.title) {
131
+ return (a, b, searchQuery) => {
132
+ const normalizedQuery = searchQuery.toLowerCase();
133
+ const labelA = getLabel(a.value).toLowerCase();
134
+ const labelB = getLabel(b.value).toLowerCase();
135
+ // Prioritize exact matches
136
+ const aExactMatch = labelA === normalizedQuery;
137
+ const bExactMatch = labelB === normalizedQuery;
138
+ if (aExactMatch && !bExactMatch) return -1;
139
+ if (!aExactMatch && bExactMatch) return 1;
140
+ // Then prioritize options where label starts with the search query
141
+ const aStartsWith = labelA.startsWith(normalizedQuery);
142
+ const bStartsWith = labelB.startsWith(normalizedQuery);
143
+ if (aStartsWith && !bStartsWith) return -1;
144
+ if (!aStartsWith && bStartsWith) return 1;
145
+ // Then prioritize options where label contains the search query
146
+ const aContains = labelA.includes(normalizedQuery);
147
+ const bContains = labelB.includes(normalizedQuery);
148
+ if (aContains && !bContains) return -1;
149
+ if (!aContains && bContains) return 1;
150
+ // Finally sort alphabetically
151
+ return labelA.localeCompare(labelB);
152
+ };
153
+ }
154
+
155
+ exports.MAX_ITEMS_WITHOUT_VIRTUALIZATION = MAX_ITEMS_WITHOUT_VIRTUALIZATION;
156
+ exports.dedupeSelectInputItems = dedupeSelectInputItems;
157
+ exports.dedupeSelectInputOptionItem = dedupeSelectInputOptionItem;
158
+ exports.filterSelectInputItems = filterSelectInputItems;
159
+ exports.inferSearchableStrings = inferSearchableStrings;
160
+ exports.searchableString = searchableString;
161
+ exports.selectInputOptionItemIncludesNeedle = selectInputOptionItemIncludesNeedle;
162
+ exports.sortByRelevance = sortByRelevance;
163
+ exports.sortSelectInputItems = sortSelectInputItems;
164
+ //# sourceMappingURL=SelectInput.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInput.utils.js","sources":["../../../src/inputs/SelectInput/SelectInput.utils.ts"],"sourcesContent":["import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';\n\nexport const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;\n\n/**\n * Converts a string to a normalized, searchable format by:\n * - Trimming whitespace\n * - Normalizing whitespace (convert multiple spaces to single space)\n * - Converting to NFD normalization form to handle diacritics\n * - Removing combining diacritical marks\n * - Converting to lowercase\n */\nexport function searchableString(value: string) {\n return (\n value\n .trim()\n .replace(/\\s+/gu, ' ')\n // NFD converts an Å to A + ̊ (and other special characters)\n .normalize('NFD')\n // and then this replaces the ̊ with nothing (and other special characters)\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n );\n}\n\n/**\n * Extracts searchable strings from a value.\n * - If the value is a string, returns a normalized version.\n * - If the value is an object, extracts all string values and normalizes them.\n * - Otherwise returns an empty array.\n */\nexport function inferSearchableStrings(value: unknown) {\n if (typeof value === 'string') {\n return [searchableString(value)];\n }\n\n if (typeof value === 'object' && value != null) {\n return Object.values(value)\n .filter((innerValue) => typeof innerValue === 'string')\n .map((innerValue) => searchableString(innerValue));\n }\n\n return [];\n}\n\n/**\n * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.\n */\nexport function dedupeSelectInputOptionItem<T>(\n item: SelectInputOptionItem<T>,\n existingValues: Set<T>,\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputOptionItem<T | undefined> {\n const isDuplicate = compareValues\n ? Array.from(existingValues).some((existingValue) => compareValues(item.value, existingValue))\n : existingValues.has(item.value);\n\n if (!isDuplicate) {\n existingValues.add(item.value);\n return item;\n }\n return { ...item, value: undefined };\n}\n\n/**\n * Sets the `value` of duplicate option items to `undefined`, hiding them when\n * rendered. Indexes are kept intact within groups to preserve the active item\n * between filter changes when possible.\n */\nexport function dedupeSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputItem<T | undefined>[] {\n const existingValues = new Set<T>();\n\n return items.map((item) => {\n switch (item.type) {\n case 'option': {\n return dedupeSelectInputOptionItem(item, existingValues, compareValues);\n }\n case 'group': {\n return {\n ...item,\n options: item.options.map((option) =>\n dedupeSelectInputOptionItem(option, existingValues, compareValues),\n ),\n };\n }\n default:\n }\n return item;\n });\n}\n\n/**\n * Checks if a SelectInputOptionItem matches the search needle.\n */\nexport function selectInputOptionItemIncludesNeedle<T>(\n item: SelectInputOptionItem<T>,\n needle: string,\n) {\n return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>\n haystack.includes(needle),\n );\n}\n\n/**\n * Filters SelectInputItems based on the provided predicate function.\n * For group items, it checks if any of their options match the predicate.\n */\nexport function filterSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n predicate: (item: SelectInputOptionItem<T>) => boolean,\n) {\n return items.filter((item) => {\n switch (item.type) {\n case 'option': {\n return predicate(item);\n }\n case 'group': {\n return item.options.some((option) => predicate(option));\n }\n default:\n }\n return false;\n });\n}\n\n/**\n * Flattens and sorts filtered options using the provided comparator.\n * Extracts all options from groups, filters out undefined values (deduplicated items),\n * sorts them, and returns as a flat list of option items.\n */\nexport function sortSelectInputItems<T>(\n items: readonly SelectInputItem<T | undefined>[],\n compareFn: (\n a: SelectInputOptionItem<NonNullable<T>>,\n b: SelectInputOptionItem<NonNullable<T>>,\n searchQuery: string,\n ) => number,\n searchQuery: string,\n): SelectInputItem<NonNullable<T>>[] {\n const flattenedOption = items.flatMap((item) => {\n if (item.type === 'option') {\n return item.value !== undefined ? [item as SelectInputOptionItem<NonNullable<T>>] : [];\n }\n\n if (item.type === 'group') {\n return item.options.filter(\n (option): option is SelectInputOptionItem<NonNullable<T>> => option.value !== undefined,\n );\n }\n\n return [];\n });\n\n // eslint-disable-next-line functional/immutable-data\n return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));\n}\n\n/**\n * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.\n * Prioritizes: exact matches > starts with > contains > alphabetical.\n *\n * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.\n *\n * @example\n * ```tsx\n * <SelectInput\n * filterable\n * sortFilteredOptions={sortByRelevance((value) => value.name)}\n * // ...\n * />\n * ```\n */\nexport function sortByRelevance<T>(\n getLabel: (value: T) => string = (value) => (value as { title: string }).title,\n): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number {\n return (a, b, searchQuery) => {\n const normalizedQuery = searchQuery.toLowerCase();\n const labelA = getLabel(a.value).toLowerCase();\n const labelB = getLabel(b.value).toLowerCase();\n\n // Prioritize exact matches\n const aExactMatch = labelA === normalizedQuery;\n const bExactMatch = labelB === normalizedQuery;\n if (aExactMatch && !bExactMatch) return -1;\n if (!aExactMatch && bExactMatch) return 1;\n\n // Then prioritize options where label starts with the search query\n const aStartsWith = labelA.startsWith(normalizedQuery);\n const bStartsWith = labelB.startsWith(normalizedQuery);\n if (aStartsWith && !bStartsWith) return -1;\n if (!aStartsWith && bStartsWith) return 1;\n\n // Then prioritize options where label contains the search query\n const aContains = labelA.includes(normalizedQuery);\n const bContains = labelB.includes(normalizedQuery);\n if (aContains && !bContains) return -1;\n if (!aContains && bContains) return 1;\n\n // Finally sort alphabetically\n return labelA.localeCompare(labelB);\n };\n}\n"],"names":["MAX_ITEMS_WITHOUT_VIRTUALIZATION","searchableString","value","trim","replace","normalize","toLowerCase","inferSearchableStrings","Object","values","filter","innerValue","map","dedupeSelectInputOptionItem","item","existingValues","compareValues","isDuplicate","Array","from","some","existingValue","has","add","undefined","dedupeSelectInputItems","items","Set","type","options","option","selectInputOptionItemIncludesNeedle","needle","filterMatchers","haystack","includes","filterSelectInputItems","predicate","sortSelectInputItems","compareFn","searchQuery","flattenedOption","flatMap","sort","a","b","sortByRelevance","getLabel","title","normalizedQuery","labelA","labelB","aExactMatch","bExactMatch","aStartsWith","startsWith","bStartsWith","aContains","bContains","localeCompare"],"mappings":";;AAEO,MAAMA,gCAAgC,GAAG;AAEhD;;;;;;;AAOG;AACG,SAAUC,gBAAgBA,CAACC,KAAa,EAAA;EAC5C,OACEA,KAAK,CACFC,IAAI,EAAE,CACNC,OAAO,CAAC,OAAO,EAAE,GAAG;AACrB;GACCC,SAAS,CAAC,KAAK;AAChB;GACCD,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAC/BE,WAAW,EAAE;AAEpB;AAEA;;;;;AAKG;AACG,SAAUC,sBAAsBA,CAACL,KAAc,EAAA;AACnD,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7B,IAAA,OAAO,CAACD,gBAAgB,CAACC,KAAK,CAAC,CAAC;AAClC,EAAA;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,IAAI,IAAI,EAAE;IAC9C,OAAOM,MAAM,CAACC,MAAM,CAACP,KAAK,CAAC,CACxBQ,MAAM,CAA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AAChB,QAAQ,CAACc,eAAe,CAAC;AAClD,IAAA,IAAIQ,SAAS,IAAI,CAACC,SAAS,EAAE,OAAO,EAAE;AACtC,IAAA,IAAI,CAACD,SAAS,IAAIC,SAAS,EAAE,OAAO,CAAC;AAErC;AACA,IAAA,OAAOR,MAAM,CAACS,aAAa,CAACR,MAAM,CAAC;EACrC,CAAC;AACH;;;;;;;;;;;;"}
@@ -0,0 +1,154 @@
1
+ const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
2
+ /**
3
+ * Converts a string to a normalized, searchable format by:
4
+ * - Trimming whitespace
5
+ * - Normalizing whitespace (convert multiple spaces to single space)
6
+ * - Converting to NFD normalization form to handle diacritics
7
+ * - Removing combining diacritical marks
8
+ * - Converting to lowercase
9
+ */
10
+ function searchableString(value) {
11
+ return value.trim().replace(/\s+/gu, ' ')
12
+ // NFD converts an Å to A + ̊ (and other special characters)
13
+ .normalize('NFD')
14
+ // and then this replaces the ̊ with nothing (and other special characters)
15
+ .replace(/[\u0300-\u036f]/g, '').toLowerCase();
16
+ }
17
+ /**
18
+ * Extracts searchable strings from a value.
19
+ * - If the value is a string, returns a normalized version.
20
+ * - If the value is an object, extracts all string values and normalizes them.
21
+ * - Otherwise returns an empty array.
22
+ */
23
+ function inferSearchableStrings(value) {
24
+ if (typeof value === 'string') {
25
+ return [searchableString(value)];
26
+ }
27
+ if (typeof value === 'object' && value != null) {
28
+ return Object.values(value).filter(innerValue => typeof innerValue === 'string').map(innerValue => searchableString(innerValue));
29
+ }
30
+ return [];
31
+ }
32
+ /**
33
+ * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.
34
+ */
35
+ function dedupeSelectInputOptionItem(item, existingValues, compareValues) {
36
+ const isDuplicate = compareValues ? Array.from(existingValues).some(existingValue => compareValues(item.value, existingValue)) : existingValues.has(item.value);
37
+ if (!isDuplicate) {
38
+ existingValues.add(item.value);
39
+ return item;
40
+ }
41
+ return {
42
+ ...item,
43
+ value: undefined
44
+ };
45
+ }
46
+ /**
47
+ * Sets the `value` of duplicate option items to `undefined`, hiding them when
48
+ * rendered. Indexes are kept intact within groups to preserve the active item
49
+ * between filter changes when possible.
50
+ */
51
+ function dedupeSelectInputItems(items, compareValues) {
52
+ const existingValues = new Set();
53
+ return items.map(item => {
54
+ switch (item.type) {
55
+ case 'option':
56
+ {
57
+ return dedupeSelectInputOptionItem(item, existingValues, compareValues);
58
+ }
59
+ case 'group':
60
+ {
61
+ return {
62
+ ...item,
63
+ options: item.options.map(option => dedupeSelectInputOptionItem(option, existingValues, compareValues))
64
+ };
65
+ }
66
+ }
67
+ return item;
68
+ });
69
+ }
70
+ /**
71
+ * Checks if a SelectInputOptionItem matches the search needle.
72
+ */
73
+ function selectInputOptionItemIncludesNeedle(item, needle) {
74
+ return inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle));
75
+ }
76
+ /**
77
+ * Filters SelectInputItems based on the provided predicate function.
78
+ * For group items, it checks if any of their options match the predicate.
79
+ */
80
+ function filterSelectInputItems(items, predicate) {
81
+ return items.filter(item => {
82
+ switch (item.type) {
83
+ case 'option':
84
+ {
85
+ return predicate(item);
86
+ }
87
+ case 'group':
88
+ {
89
+ return item.options.some(option => predicate(option));
90
+ }
91
+ }
92
+ return false;
93
+ });
94
+ }
95
+ /**
96
+ * Flattens and sorts filtered options using the provided comparator.
97
+ * Extracts all options from groups, filters out undefined values (deduplicated items),
98
+ * sorts them, and returns as a flat list of option items.
99
+ */
100
+ function sortSelectInputItems(items, compareFn, searchQuery) {
101
+ const flattenedOption = items.flatMap(item => {
102
+ if (item.type === 'option') {
103
+ return item.value !== undefined ? [item] : [];
104
+ }
105
+ if (item.type === 'group') {
106
+ return item.options.filter(option => option.value !== undefined);
107
+ }
108
+ return [];
109
+ });
110
+ // eslint-disable-next-line functional/immutable-data
111
+ return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));
112
+ }
113
+ /**
114
+ * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.
115
+ * Prioritizes: exact matches > starts with > contains > alphabetical.
116
+ *
117
+ * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.
118
+ *
119
+ * @example
120
+ * ```tsx
121
+ * <SelectInput
122
+ * filterable
123
+ * sortFilteredOptions={sortByRelevance((value) => value.name)}
124
+ * // ...
125
+ * />
126
+ * ```
127
+ */
128
+ function sortByRelevance(getLabel = value => value.title) {
129
+ return (a, b, searchQuery) => {
130
+ const normalizedQuery = searchQuery.toLowerCase();
131
+ const labelA = getLabel(a.value).toLowerCase();
132
+ const labelB = getLabel(b.value).toLowerCase();
133
+ // Prioritize exact matches
134
+ const aExactMatch = labelA === normalizedQuery;
135
+ const bExactMatch = labelB === normalizedQuery;
136
+ if (aExactMatch && !bExactMatch) return -1;
137
+ if (!aExactMatch && bExactMatch) return 1;
138
+ // Then prioritize options where label starts with the search query
139
+ const aStartsWith = labelA.startsWith(normalizedQuery);
140
+ const bStartsWith = labelB.startsWith(normalizedQuery);
141
+ if (aStartsWith && !bStartsWith) return -1;
142
+ if (!aStartsWith && bStartsWith) return 1;
143
+ // Then prioritize options where label contains the search query
144
+ const aContains = labelA.includes(normalizedQuery);
145
+ const bContains = labelB.includes(normalizedQuery);
146
+ if (aContains && !bContains) return -1;
147
+ if (!aContains && bContains) return 1;
148
+ // Finally sort alphabetically
149
+ return labelA.localeCompare(labelB);
150
+ };
151
+ }
152
+
153
+ export { MAX_ITEMS_WITHOUT_VIRTUALIZATION, dedupeSelectInputItems, dedupeSelectInputOptionItem, filterSelectInputItems, inferSearchableStrings, searchableString, selectInputOptionItemIncludesNeedle, sortByRelevance, sortSelectInputItems };
154
+ //# sourceMappingURL=SelectInput.utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInput.utils.mjs","sources":["../../../src/inputs/SelectInput/SelectInput.utils.ts"],"sourcesContent":["import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';\n\nexport const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;\n\n/**\n * Converts a string to a normalized, searchable format by:\n * - Trimming whitespace\n * - Normalizing whitespace (convert multiple spaces to single space)\n * - Converting to NFD normalization form to handle diacritics\n * - Removing combining diacritical marks\n * - Converting to lowercase\n */\nexport function searchableString(value: string) {\n return (\n value\n .trim()\n .replace(/\\s+/gu, ' ')\n // NFD converts an Å to A + ̊ (and other special characters)\n .normalize('NFD')\n // and then this replaces the ̊ with nothing (and other special characters)\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n );\n}\n\n/**\n * Extracts searchable strings from a value.\n * - If the value is a string, returns a normalized version.\n * - If the value is an object, extracts all string values and normalizes them.\n * - Otherwise returns an empty array.\n */\nexport function inferSearchableStrings(value: unknown) {\n if (typeof value === 'string') {\n return [searchableString(value)];\n }\n\n if (typeof value === 'object' && value != null) {\n return Object.values(value)\n .filter((innerValue) => typeof innerValue === 'string')\n .map((innerValue) => searchableString(innerValue));\n }\n\n return [];\n}\n\n/**\n * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.\n */\nexport function dedupeSelectInputOptionItem<T>(\n item: SelectInputOptionItem<T>,\n existingValues: Set<T>,\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputOptionItem<T | undefined> {\n const isDuplicate = compareValues\n ? Array.from(existingValues).some((existingValue) => compareValues(item.value, existingValue))\n : existingValues.has(item.value);\n\n if (!isDuplicate) {\n existingValues.add(item.value);\n return item;\n }\n return { ...item, value: undefined };\n}\n\n/**\n * Sets the `value` of duplicate option items to `undefined`, hiding them when\n * rendered. Indexes are kept intact within groups to preserve the active item\n * between filter changes when possible.\n */\nexport function dedupeSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputItem<T | undefined>[] {\n const existingValues = new Set<T>();\n\n return items.map((item) => {\n switch (item.type) {\n case 'option': {\n return dedupeSelectInputOptionItem(item, existingValues, compareValues);\n }\n case 'group': {\n return {\n ...item,\n options: item.options.map((option) =>\n dedupeSelectInputOptionItem(option, existingValues, compareValues),\n ),\n };\n }\n default:\n }\n return item;\n });\n}\n\n/**\n * Checks if a SelectInputOptionItem matches the search needle.\n */\nexport function selectInputOptionItemIncludesNeedle<T>(\n item: SelectInputOptionItem<T>,\n needle: string,\n) {\n return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>\n haystack.includes(needle),\n );\n}\n\n/**\n * Filters SelectInputItems based on the provided predicate function.\n * For group items, it checks if any of their options match the predicate.\n */\nexport function filterSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n predicate: (item: SelectInputOptionItem<T>) => boolean,\n) {\n return items.filter((item) => {\n switch (item.type) {\n case 'option': {\n return predicate(item);\n }\n case 'group': {\n return item.options.some((option) => predicate(option));\n }\n default:\n }\n return false;\n });\n}\n\n/**\n * Flattens and sorts filtered options using the provided comparator.\n * Extracts all options from groups, filters out undefined values (deduplicated items),\n * sorts them, and returns as a flat list of option items.\n */\nexport function sortSelectInputItems<T>(\n items: readonly SelectInputItem<T | undefined>[],\n compareFn: (\n a: SelectInputOptionItem<NonNullable<T>>,\n b: SelectInputOptionItem<NonNullable<T>>,\n searchQuery: string,\n ) => number,\n searchQuery: string,\n): SelectInputItem<NonNullable<T>>[] {\n const flattenedOption = items.flatMap((item) => {\n if (item.type === 'option') {\n return item.value !== undefined ? [item as SelectInputOptionItem<NonNullable<T>>] : [];\n }\n\n if (item.type === 'group') {\n return item.options.filter(\n (option): option is SelectInputOptionItem<NonNullable<T>> => option.value !== undefined,\n );\n }\n\n return [];\n });\n\n // eslint-disable-next-line functional/immutable-data\n return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));\n}\n\n/**\n * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.\n * Prioritizes: exact matches > starts with > contains > alphabetical.\n *\n * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.\n *\n * @example\n * ```tsx\n * <SelectInput\n * filterable\n * sortFilteredOptions={sortByRelevance((value) => value.name)}\n * // ...\n * />\n * ```\n */\nexport function sortByRelevance<T>(\n getLabel: (value: T) => string = (value) => (value as { title: string }).title,\n): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number {\n return (a, b, searchQuery) => {\n const normalizedQuery = searchQuery.toLowerCase();\n const labelA = getLabel(a.value).toLowerCase();\n const labelB = getLabel(b.value).toLowerCase();\n\n // Prioritize exact matches\n const aExactMatch = labelA === normalizedQuery;\n const bExactMatch = labelB === normalizedQuery;\n if (aExactMatch && !bExactMatch) return -1;\n if (!aExactMatch && bExactMatch) return 1;\n\n // Then prioritize options where label starts with the search query\n const aStartsWith = labelA.startsWith(normalizedQuery);\n const bStartsWith = labelB.startsWith(normalizedQuery);\n if (aStartsWith && !bStartsWith) return -1;\n if (!aStartsWith && bStartsWith) return 1;\n\n // Then prioritize options where label contains the search query\n const aContains = labelA.includes(normalizedQuery);\n const bContains = labelB.includes(normalizedQuery);\n if (aContains && !bContains) return -1;\n if (!aContains && bContains) return 1;\n\n // Finally sort alphabetically\n return labelA.localeCompare(labelB);\n };\n}\n"],"names":["MAX_ITEMS_WITHOUT_VIRTUALIZATION","searchableString","value","trim","replace","normalize","toLowerCase","inferSearchableStrings","Object","values","filter","innerValue","map","dedupeSelectInputOptionItem","item","existingValues","compareValues","isDuplicate","Array","from","some","existingValue","has","add","undefined","dedupeSelectInputItems","items","Set","type","options","option","selectInputOptionItemIncludesNeedle","needle","filterMatchers","haystack","includes","filterSelectInputItems","predicate","sortSelectInputItems","compareFn","searchQuery","flattenedOption","flatMap","sort","a","b","sortByRelevance","getLabel","title","normalizedQuery","labelA","labelB","aExactMatch","bExactMatch","aStartsWith","startsWith","bStartsWith","aContains","bContains","localeCompare"],"mappings":"AAEO,MAAMA,gCAAgC,GAAG;AAEhD;;;;;;;AAOG;AACG,SAAUC,gBAAgBA,CAACC,KAAa,EAAA;EAC5C,OACEA,KAAK,CACFC,IAAI,EAAE,CACNC,OAAO,CAAC,OAAO,EAAE,GAAG;AACrB;GACC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