@transferwise/components 46.130.1 → 46.130.3

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 (255) hide show
  1. package/build/alert/Alert.js +4 -1
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +4 -1
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/criticalBanner/CriticalCommsBanner.js +6 -4
  6. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  7. package/build/criticalBanner/CriticalCommsBanner.mjs +6 -4
  8. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  9. package/build/dateInput/DateInput.js +12 -5
  10. package/build/dateInput/DateInput.js.map +1 -1
  11. package/build/dateInput/DateInput.mjs +11 -4
  12. package/build/dateInput/DateInput.mjs.map +1 -1
  13. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +16 -8
  14. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  15. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +14 -6
  16. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  17. package/build/index.js +12 -7
  18. package/build/index.js.map +1 -1
  19. package/build/index.mjs +9 -3
  20. package/build/index.mjs.map +1 -1
  21. package/build/inputs/{_BottomSheet.js → SelectInput/BottomSheet/SelectInputBottomSheet.js} +7 -7
  22. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +1 -0
  23. package/build/inputs/{_BottomSheet.mjs → SelectInput/BottomSheet/SelectInputBottomSheet.mjs} +7 -7
  24. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +1 -0
  25. package/build/inputs/{_ButtonInput.js → SelectInput/ButtonInput/SelectInputButtonInput.js} +5 -5
  26. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +1 -0
  27. package/build/inputs/{_ButtonInput.mjs → SelectInput/ButtonInput/SelectInputButtonInput.mjs} +5 -5
  28. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +1 -0
  29. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +26 -0
  30. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +1 -0
  31. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +24 -0
  32. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +1 -0
  33. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +59 -0
  34. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +1 -0
  35. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +56 -0
  36. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +1 -0
  37. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +50 -0
  38. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +1 -0
  39. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +48 -0
  40. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +1 -0
  41. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +47 -0
  42. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +1 -0
  43. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +45 -0
  44. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +1 -0
  45. package/build/inputs/SelectInput/Option/SelectInputOption.js +42 -0
  46. package/build/inputs/SelectInput/Option/SelectInputOption.js.map +1 -0
  47. package/build/inputs/SelectInput/Option/SelectInputOption.mjs +40 -0
  48. package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +1 -0
  49. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +40 -0
  50. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +1 -0
  51. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +38 -0
  52. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +1 -0
  53. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +48 -0
  54. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +1 -0
  55. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +46 -0
  56. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +1 -0
  57. package/build/inputs/SelectInput/Options/SelectInputOptions.js +300 -0
  58. package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +1 -0
  59. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +298 -0
  60. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +1 -0
  61. package/build/inputs/{_Popover.js → SelectInput/Popover/SelectInputPopover.js} +7 -7
  62. package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +1 -0
  63. package/build/inputs/{_Popover.mjs → SelectInput/Popover/SelectInputPopover.mjs} +7 -7
  64. package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +1 -0
  65. package/build/inputs/SelectInput/SelectInput.contexts.js +29 -0
  66. package/build/inputs/SelectInput/SelectInput.contexts.js.map +1 -0
  67. package/build/inputs/SelectInput/SelectInput.contexts.mjs +24 -0
  68. package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +1 -0
  69. package/build/inputs/SelectInput/SelectInput.js +222 -0
  70. package/build/inputs/SelectInput/SelectInput.js.map +1 -0
  71. package/build/inputs/SelectInput/SelectInput.messages.js.map +1 -0
  72. package/build/inputs/SelectInput/SelectInput.messages.mjs.map +1 -0
  73. package/build/inputs/SelectInput/SelectInput.mjs +216 -0
  74. package/build/inputs/SelectInput/SelectInput.mjs.map +1 -0
  75. package/build/inputs/SelectInput/SelectInput.utils.js +164 -0
  76. package/build/inputs/SelectInput/SelectInput.utils.js.map +1 -0
  77. package/build/inputs/SelectInput/SelectInput.utils.mjs +154 -0
  78. package/build/inputs/SelectInput/SelectInput.utils.mjs.map +1 -0
  79. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +42 -0
  80. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -0
  81. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +36 -0
  82. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -0
  83. package/build/main.css +99 -90
  84. package/build/moneyInput/MoneyInput.js +9 -2
  85. package/build/moneyInput/MoneyInput.js.map +1 -1
  86. package/build/moneyInput/MoneyInput.mjs +8 -1
  87. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  88. package/build/phoneNumberInput/PhoneNumberInput.js +10 -3
  89. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  90. package/build/phoneNumberInput/PhoneNumberInput.mjs +9 -2
  91. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  92. package/build/styles/criticalBanner/CriticalCommsBanner.css +9 -0
  93. package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
  94. package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
  95. package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
  96. package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
  97. package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +33 -0
  98. package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
  99. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
  100. package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
  101. package/build/styles/main.css +99 -90
  102. package/build/types/alert/Alert.d.ts +2 -0
  103. package/build/types/alert/Alert.d.ts.map +1 -1
  104. package/build/types/criticalBanner/CriticalCommsBanner.d.ts +1 -0
  105. package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
  106. package/build/types/index.d.ts +1 -1
  107. package/build/types/index.d.ts.map +1 -1
  108. package/build/types/inputs/{_BottomSheet.d.ts → SelectInput/BottomSheet/SelectInputBottomSheet.d.ts} +3 -3
  109. package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +1 -0
  110. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +3 -0
  111. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +1 -0
  112. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +5 -0
  113. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +1 -0
  114. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +3 -0
  115. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +1 -0
  116. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +7 -0
  117. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +1 -0
  118. package/build/types/inputs/SelectInput/ClearButton/index.d.ts +3 -0
  119. package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +1 -0
  120. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +16 -0
  121. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +1 -0
  122. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +2 -0
  123. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +1 -0
  124. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +9 -0
  125. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +1 -0
  126. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +3 -0
  127. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +1 -0
  128. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +11 -0
  129. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +1 -0
  130. package/build/types/inputs/SelectInput/ItemView/index.d.ts +4 -0
  131. package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +1 -0
  132. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +11 -0
  133. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +1 -0
  134. package/build/types/inputs/SelectInput/Option/index.d.ts +3 -0
  135. package/build/types/inputs/SelectInput/Option/index.d.ts.map +1 -0
  136. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +13 -0
  137. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +1 -0
  138. package/build/types/inputs/SelectInput/OptionContent/index.d.ts +3 -0
  139. package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +1 -0
  140. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +9 -0
  141. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +1 -0
  142. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +3 -0
  143. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +1 -0
  144. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +21 -0
  145. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +1 -0
  146. package/build/types/inputs/SelectInput/Options/index.d.ts +4 -0
  147. package/build/types/inputs/SelectInput/Options/index.d.ts.map +1 -0
  148. package/build/types/inputs/{_Popover.d.ts → SelectInput/Popover/SelectInputPopover.d.ts} +3 -3
  149. package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +1 -0
  150. package/build/types/inputs/SelectInput/Popover/index.d.ts +3 -0
  151. package/build/types/inputs/SelectInput/Popover/index.d.ts.map +1 -0
  152. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +33 -0
  153. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +1 -0
  154. package/build/types/inputs/SelectInput/SelectInput.d.ts +10 -0
  155. package/build/types/inputs/SelectInput/SelectInput.d.ts.map +1 -0
  156. package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +1 -0
  157. package/build/types/inputs/{SelectInput.d.ts → SelectInput/SelectInput.types.d.ts} +12 -38
  158. package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +1 -0
  159. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +60 -0
  160. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +1 -0
  161. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +12 -0
  162. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -0
  163. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +3 -0
  164. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +1 -0
  165. package/build/types/inputs/SelectInput/components.d.ts +10 -0
  166. package/build/types/inputs/SelectInput/components.d.ts.map +1 -0
  167. package/build/types/inputs/SelectInput/index.d.ts +10 -0
  168. package/build/types/inputs/SelectInput/index.d.ts.map +1 -0
  169. package/package.json +1 -1
  170. package/src/alert/Alert.tsx +6 -1
  171. package/src/criticalBanner/CriticalCommsBanner.css +9 -0
  172. package/src/criticalBanner/CriticalCommsBanner.less +13 -0
  173. package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +15 -0
  174. package/src/criticalBanner/CriticalCommsBanner.test.tsx +28 -2
  175. package/src/criticalBanner/CriticalCommsBanner.tsx +10 -1
  176. package/src/index.ts +0 -1
  177. package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
  178. package/src/inputs/{_BottomSheet.tsx → SelectInput/BottomSheet/SelectInputBottomSheet.tsx} +7 -7
  179. package/src/inputs/SelectInput/BottomSheet/index.ts +2 -0
  180. package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
  181. package/src/inputs/{_ButtonInput.tsx → SelectInput/ButtonInput/SelectInputButtonInput.tsx} +5 -5
  182. package/src/inputs/SelectInput/ButtonInput/index.ts +2 -0
  183. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
  184. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +39 -0
  185. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +27 -0
  186. package/src/inputs/SelectInput/ClearButton/index.ts +2 -0
  187. package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +74 -0
  188. package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +5 -0
  189. package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +61 -0
  190. package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +2 -0
  191. package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
  192. package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +17 -0
  193. package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +48 -0
  194. package/src/inputs/SelectInput/ItemView/index.ts +3 -0
  195. package/src/inputs/SelectInput/Option/SelectInputOption.css +33 -0
  196. package/src/inputs/SelectInput/Option/SelectInputOption.less +32 -0
  197. package/src/inputs/SelectInput/Option/SelectInputOption.tsx +57 -0
  198. package/src/inputs/SelectInput/Option/index.ts +2 -0
  199. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
  200. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +38 -0
  201. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +72 -0
  202. package/src/inputs/SelectInput/OptionContent/index.ts +2 -0
  203. package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +59 -0
  204. package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +2 -0
  205. package/src/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
  206. package/src/inputs/SelectInput/Options/SelectInputOptions.less +77 -0
  207. package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +411 -0
  208. package/src/inputs/SelectInput/Options/index.ts +3 -0
  209. package/src/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
  210. package/src/inputs/{_Popover.tsx → SelectInput/Popover/SelectInputPopover.tsx} +7 -7
  211. package/src/inputs/SelectInput/Popover/index.ts +2 -0
  212. package/src/inputs/SelectInput/SelectInput.contexts.tsx +40 -0
  213. package/src/inputs/SelectInput/SelectInput.less +22 -0
  214. package/src/inputs/{SelectInput.test.tsx → SelectInput/SelectInput.test.tsx} +9 -11
  215. package/src/inputs/SelectInput/SelectInput.tsx +257 -0
  216. package/src/inputs/SelectInput/SelectInput.types.ts +113 -0
  217. package/src/inputs/SelectInput/SelectInput.utils.ts +205 -0
  218. package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +36 -0
  219. package/src/inputs/SelectInput/TriggerButton/index.ts +5 -0
  220. package/src/inputs/{SelectInput.docs.mdx → SelectInput/_stories/SelectInput.docs.mdx} +0 -1
  221. package/src/inputs/{SelectInput.story.tsx → SelectInput/_stories/SelectInput.story.tsx} +11 -8
  222. package/src/inputs/{SelectInput.test.story.tsx → SelectInput/_stories/SelectInput.test.story.tsx} +6 -10
  223. package/src/inputs/SelectInput/components.ts +10 -0
  224. package/src/inputs/SelectInput/index.ts +12 -0
  225. package/src/main.css +99 -90
  226. package/src/main.less +1 -1
  227. package/build/inputs/SelectInput.js +0 -890
  228. package/build/inputs/SelectInput.js.map +0 -1
  229. package/build/inputs/SelectInput.messages.js.map +0 -1
  230. package/build/inputs/SelectInput.messages.mjs.map +0 -1
  231. package/build/inputs/SelectInput.mjs +0 -881
  232. package/build/inputs/SelectInput.mjs.map +0 -1
  233. package/build/inputs/_BottomSheet.js.map +0 -1
  234. package/build/inputs/_BottomSheet.mjs.map +0 -1
  235. package/build/inputs/_ButtonInput.js.map +0 -1
  236. package/build/inputs/_ButtonInput.mjs.map +0 -1
  237. package/build/inputs/_Popover.js.map +0 -1
  238. package/build/inputs/_Popover.mjs.map +0 -1
  239. package/build/types/inputs/SelectInput.d.ts.map +0 -1
  240. package/build/types/inputs/SelectInput.messages.d.ts.map +0 -1
  241. package/build/types/inputs/_BottomSheet.d.ts.map +0 -1
  242. package/build/types/inputs/_ButtonInput.d.ts +0 -5
  243. package/build/types/inputs/_ButtonInput.d.ts.map +0 -1
  244. package/build/types/inputs/_Popover.d.ts.map +0 -1
  245. package/src/inputs/SelectInput.less +0 -219
  246. package/src/inputs/SelectInput.tsx +0 -1269
  247. package/build/inputs/{SelectInput.messages.js → SelectInput/SelectInput.messages.js} +0 -0
  248. package/build/inputs/{SelectInput.messages.mjs → SelectInput/SelectInput.messages.mjs} +0 -0
  249. package/build/styles/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
  250. package/build/types/inputs/{SelectInput.messages.d.ts → SelectInput/SelectInput.messages.d.ts} +0 -0
  251. package/src/inputs/{_BottomSheet.less → SelectInput/BottomSheet/SelectInputBottomSheet.less} +0 -0
  252. package/src/inputs/{_ButtonInput.less → SelectInput/ButtonInput/SelectInputButtonInput.less} +0 -0
  253. package/src/inputs/{_Popover.less → SelectInput/Popover/SelectInputPopover.less} +0 -0
  254. package/src/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
  255. /package/src/inputs/{SelectInput.messages.ts → SelectInput/SelectInput.messages.ts} +0 -0
@@ -0,0 +1,38 @@
1
+ import { clsx } from 'clsx';
2
+ import { useContext } from 'react';
3
+ import { SelectInputOptionContentWithinTriggerContext } from '../SelectInput.contexts.mjs';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ function SelectInputOptionContent({
7
+ title,
8
+ note,
9
+ description,
10
+ icon
11
+ }) {
12
+ const withinTrigger = useContext(SelectInputOptionContentWithinTriggerContext);
13
+ return /*#__PURE__*/jsxs("div", {
14
+ className: clsx('np-select-input-option-content-container', (note || description) && 'np-text-body-large'),
15
+ children: [icon ? /*#__PURE__*/jsx("div", {
16
+ className: clsx('np-select-input-option-content-icon', !withinTrigger && 'np-select-input-option-content-icon--not-within-trigger'),
17
+ children: icon
18
+ }) : null, /*#__PURE__*/jsxs("div", {
19
+ className: "np-select-input-option-content-text",
20
+ children: [/*#__PURE__*/jsxs("div", {
21
+ className: clsx('np-select-input-option-content-text-line-1', withinTrigger && 'np-select-input-option-content-text-within-trigger'),
22
+ children: [/*#__PURE__*/jsx("div", {
23
+ className: "d-inline",
24
+ children: title
25
+ }), note ? /*#__PURE__*/jsx("span", {
26
+ className: "np-select-input-option-content-text-secondary np-text-body-default",
27
+ children: note
28
+ }) : null]
29
+ }), description ? /*#__PURE__*/jsx("div", {
30
+ className: clsx('np-select-input-option-content-text-secondary np-text-body-default', withinTrigger && 'np-select-input-option-content-text-within-trigger np-select-input-option-description-in-trigger'),
31
+ children: description
32
+ }) : null]
33
+ })]
34
+ });
35
+ }
36
+
37
+ export { SelectInputOptionContent };
38
+ //# sourceMappingURL=SelectInputOptionContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInputOptionContent.mjs","sources":["../../../../src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext } from 'react';\nimport { SelectInputOptionContentWithinTriggerContext } from '../SelectInput.contexts';\n\nexport interface SelectInputOptionContentProps {\n title: React.ReactNode;\n note?: string;\n description?: string;\n icon?: React.ReactNode;\n}\n\n/**\n * Component for rendering structured content within a SelectInput option.\n * Supports title, optional note, description, and icon with different styling\n * based on whether it's rendered within the trigger button or the dropdown.\n */\nexport function SelectInputOptionContent({\n title,\n note,\n description,\n icon,\n}: SelectInputOptionContentProps) {\n const withinTrigger = useContext(SelectInputOptionContentWithinTriggerContext);\n\n return (\n <div\n className={clsx(\n 'np-select-input-option-content-container',\n (note || description) && 'np-text-body-large',\n )}\n >\n {icon ? (\n <div\n className={clsx(\n 'np-select-input-option-content-icon',\n !withinTrigger && 'np-select-input-option-content-icon--not-within-trigger',\n )}\n >\n {icon}\n </div>\n ) : null}\n\n <div className=\"np-select-input-option-content-text\">\n <div\n className={clsx(\n 'np-select-input-option-content-text-line-1',\n withinTrigger && 'np-select-input-option-content-text-within-trigger',\n )}\n >\n <div className=\"d-inline\">{title}</div>\n {note ? (\n <span className=\"np-select-input-option-content-text-secondary np-text-body-default\">\n {note}\n </span>\n ) : null}\n </div>\n\n {description ? (\n <div\n className={clsx(\n 'np-select-input-option-content-text-secondary np-text-body-default',\n withinTrigger &&\n 'np-select-input-option-content-text-within-trigger np-select-input-option-description-in-trigger',\n )}\n >\n {description}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n"],"names":["SelectInputOptionContent","title","note","description","icon","withinTrigger","useContext","SelectInputOptionContentWithinTriggerContext","_jsxs","className","clsx","children","_jsx"],"mappings":";;;;;AAgBM,SAAUA,wBAAwBA,CAAC;EACvCC,KAAK;EACLC,IAAI;EACJC,WAAW;AACXC,EAAAA;AAAI,CAC0B,EAAA;AAC9B,EAAA,MAAMC,aAAa,GAAGC,UAAU,CAACC,4CAA4C,CAAC;AAE9E,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,IAAI,CACb,0CAA0C,EAC1C,CAACR,IAAI,IAAIC,WAAW,KAAK,oBAAoB,CAC7C;IAAAQ,QAAA,EAAA,CAEDP,IAAI,gBACHQ,GAAA,CAAA,KAAA,EAAA;MACEH,SAAS,EAAEC,IAAI,CACb,qCAAqC,EACrC,CAACL,aAAa,IAAI,yDAAyD,CAC3E;AAAAM,MAAAA,QAAA,EAEDP;AAAI,KACF,CAAC,GACJ,IAAI,eAERI,IAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,qCAAqC;AAAAE,MAAAA,QAAA,gBAClDH,IAAA,CAAA,KAAA,EAAA;QACEC,SAAS,EAAEC,IAAI,CACb,4CAA4C,EAC5CL,aAAa,IAAI,oDAAoD,CACrE;AAAAM,QAAAA,QAAA,gBAEFC,GAAA,CAAA,KAAA,EAAA;AAAKH,UAAAA,SAAS,EAAC,UAAU;AAAAE,UAAAA,QAAA,EAAEV;AAAK,SAAM,CACtC,EAACC,IAAI,gBACHU,GAAA,CAAA,MAAA,EAAA;AAAMH,UAAAA,SAAS,EAAC,oEAAoE;AAAAE,UAAAA,QAAA,EACjFT;SACG,CAAC,GACL,IAAI;AAAA,OACL,CAEL,EAACC,WAAW,gBACVS,GAAA,CAAA,KAAA,EAAA;QACEH,SAAS,EAAEC,IAAI,CACb,oEAAoE,EACpEL,aAAa,IACX,kGAAkG,CACpG;AAAAM,QAAAA,QAAA,EAEDR;OACE,CAAC,GACJ,IAAI;AAAA,KACL,CACP;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var useEffectEvent = require('../../../../common/hooks/useEffectEvent.js');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function SelectInputOptionsContainer({
8
+ 'aria-orientation': ariaOrientation,
9
+ 'aria-activedescendant': ariaActiveDescendant,
10
+ role,
11
+ tabIndex,
12
+ onAriaActiveDescendantChange,
13
+ onKeyDown,
14
+ ...restProps
15
+ }, ref) {
16
+ const handleAriaActiveDescendantChange = useEffectEvent.useEffectEvent(onAriaActiveDescendantChange);
17
+ React.useEffect(() => {
18
+ handleAriaActiveDescendantChange(ariaActiveDescendant);
19
+ }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
20
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
21
+ ref: ref,
22
+ role: "none",
23
+ onKeyDown: event => {
24
+ // Prevent confirmation close without an active item
25
+ if (event.key === 'Enter' && ariaActiveDescendant == null) {
26
+ return;
27
+ }
28
+ // Required to make ListBox focusable
29
+ if (event.key === 'Tab') {
30
+ return;
31
+ }
32
+ // Prevent absorbing Escape early
33
+ if (event.key === 'Escape') {
34
+ onKeyDown?.({
35
+ ...event,
36
+ preventDefault: () => {},
37
+ stopPropagation: () => {}
38
+ });
39
+ return;
40
+ }
41
+ onKeyDown?.(event);
42
+ },
43
+ ...restProps
44
+ });
45
+ });
46
+
47
+ exports.SelectInputOptionsContainer = SelectInputOptionsContainer;
48
+ //# sourceMappingURL=SelectInputOptionsContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInputOptionsContainer.js","sources":["../../../../../src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx"],"sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport { useEffectEvent } from '../../../../common/hooks/useEffectEvent';\n\nexport interface SelectInputOptionsContainerProps extends React.ComponentPropsWithRef<'div'> {\n onAriaActiveDescendantChange: (value: React.AriaAttributes['aria-activedescendant']) => void;\n}\n\n/**\n * Container component for SelectInput options.\n * Handles keyboard navigation and accessibility features.\n */\nexport const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContainer(\n {\n 'aria-orientation': ariaOrientation,\n 'aria-activedescendant': ariaActiveDescendant,\n role,\n tabIndex,\n onAriaActiveDescendantChange,\n onKeyDown,\n ...restProps\n }: SelectInputOptionsContainerProps,\n ref: React.ForwardedRef<HTMLDivElement | null>,\n) {\n const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);\n useEffect(() => {\n handleAriaActiveDescendantChange(ariaActiveDescendant);\n }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);\n\n return (\n <div\n ref={ref}\n role=\"none\"\n onKeyDown={(event) => {\n // Prevent confirmation close without an active item\n if (event.key === 'Enter' && ariaActiveDescendant == null) {\n return;\n }\n\n // Required to make ListBox focusable\n if (event.key === 'Tab') {\n return;\n }\n\n // Prevent absorbing Escape early\n if (event.key === 'Escape') {\n onKeyDown?.({\n ...event,\n preventDefault: () => {},\n stopPropagation: () => {},\n });\n return;\n }\n\n onKeyDown?.(event);\n }}\n {...restProps}\n />\n );\n});\n"],"names":["SelectInputOptionsContainer","forwardRef","ariaOrientation","ariaActiveDescendant","role","tabIndex","onAriaActiveDescendantChange","onKeyDown","restProps","ref","handleAriaActiveDescendantChange","useEffectEvent","useEffect","_jsx","event","key","preventDefault","stopPropagation"],"mappings":";;;;;;MAWaA,2BAA2B,gBAAGC,gBAAU,CAAC,SAASD,2BAA2BA,CACxF;AACE,EAAA,kBAAkB,EAAEE,eAAe;AACnC,EAAA,uBAAuB,EAAEC,oBAAoB;EAC7CC,IAAI;EACJC,QAAQ;EACRC,4BAA4B;EAC5BC,SAAS;EACT,GAAGC;AAAS,CACqB,EACnCC,GAA8C,EAAA;AAE9C,EAAA,MAAMC,gCAAgC,GAAGC,6BAAc,CAACL,4BAA4B,CAAC;AACrFM,EAAAA,eAAS,CAAC,MAAK;IACbF,gCAAgC,CAACP,oBAAoB,CAAC;AACxD,EAAA,CAAC,EAAE,CAACA,oBAAoB,EAAEO,gCAAgC,CAAC,CAAC;AAE5D,EAAA,oBACEG,cAAA,CAAA,KAAA,EAAA;AACEJ,IAAAA,GAAG,EAAEA,GAAI;AACTL,IAAAA,IAAI,EAAC,MAAM;IACXG,SAAS,EAAGO,KAAK,IAAI;AACnB;MACA,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,IAAIZ,oBAAoB,IAAI,IAAI,EAAE;AACzD,QAAA;AACF,MAAA;AAEA;AACA,MAAA,IAAIW,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;AACvB,QAAA;AACF,MAAA;AAEA;AACA,MAAA,IAAID,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;AAC1BR,QAAAA,SAAS,GAAG;AACV,UAAA,GAAGO,KAAK;AACRE,UAAAA,cAAc,EAAEA,MAAK,CAAE,CAAC;UACxBC,eAAe,EAAEA,MAAK,CAAE;AACzB,SAAA,CAAC;AACF,QAAA;AACF,MAAA;MAEAV,SAAS,GAAGO,KAAK,CAAC;IACpB,CAAE;IAAA,GACEN;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -0,0 +1,46 @@
1
+ import { forwardRef, useEffect } from 'react';
2
+ import { useEffectEvent } from '../../../../common/hooks/useEffectEvent.mjs';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const SelectInputOptionsContainer = /*#__PURE__*/forwardRef(function SelectInputOptionsContainer({
6
+ 'aria-orientation': ariaOrientation,
7
+ 'aria-activedescendant': ariaActiveDescendant,
8
+ role,
9
+ tabIndex,
10
+ onAriaActiveDescendantChange,
11
+ onKeyDown,
12
+ ...restProps
13
+ }, ref) {
14
+ const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
15
+ useEffect(() => {
16
+ handleAriaActiveDescendantChange(ariaActiveDescendant);
17
+ }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
18
+ return /*#__PURE__*/jsx("div", {
19
+ ref: ref,
20
+ role: "none",
21
+ onKeyDown: event => {
22
+ // Prevent confirmation close without an active item
23
+ if (event.key === 'Enter' && ariaActiveDescendant == null) {
24
+ return;
25
+ }
26
+ // Required to make ListBox focusable
27
+ if (event.key === 'Tab') {
28
+ return;
29
+ }
30
+ // Prevent absorbing Escape early
31
+ if (event.key === 'Escape') {
32
+ onKeyDown?.({
33
+ ...event,
34
+ preventDefault: () => {},
35
+ stopPropagation: () => {}
36
+ });
37
+ return;
38
+ }
39
+ onKeyDown?.(event);
40
+ },
41
+ ...restProps
42
+ });
43
+ });
44
+
45
+ export { SelectInputOptionsContainer };
46
+ //# sourceMappingURL=SelectInputOptionsContainer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInputOptionsContainer.mjs","sources":["../../../../../src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx"],"sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport { useEffectEvent } from '../../../../common/hooks/useEffectEvent';\n\nexport interface SelectInputOptionsContainerProps extends React.ComponentPropsWithRef<'div'> {\n onAriaActiveDescendantChange: (value: React.AriaAttributes['aria-activedescendant']) => void;\n}\n\n/**\n * Container component for SelectInput options.\n * Handles keyboard navigation and accessibility features.\n */\nexport const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContainer(\n {\n 'aria-orientation': ariaOrientation,\n 'aria-activedescendant': ariaActiveDescendant,\n role,\n tabIndex,\n onAriaActiveDescendantChange,\n onKeyDown,\n ...restProps\n }: SelectInputOptionsContainerProps,\n ref: React.ForwardedRef<HTMLDivElement | null>,\n) {\n const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);\n useEffect(() => {\n handleAriaActiveDescendantChange(ariaActiveDescendant);\n }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);\n\n return (\n <div\n ref={ref}\n role=\"none\"\n onKeyDown={(event) => {\n // Prevent confirmation close without an active item\n if (event.key === 'Enter' && ariaActiveDescendant == null) {\n return;\n }\n\n // Required to make ListBox focusable\n if (event.key === 'Tab') {\n return;\n }\n\n // Prevent absorbing Escape early\n if (event.key === 'Escape') {\n onKeyDown?.({\n ...event,\n preventDefault: () => {},\n stopPropagation: () => {},\n });\n return;\n }\n\n onKeyDown?.(event);\n }}\n {...restProps}\n />\n );\n});\n"],"names":["SelectInputOptionsContainer","forwardRef","ariaOrientation","ariaActiveDescendant","role","tabIndex","onAriaActiveDescendantChange","onKeyDown","restProps","ref","handleAriaActiveDescendantChange","useEffectEvent","useEffect","_jsx","event","key","preventDefault","stopPropagation"],"mappings":";;;;MAWaA,2BAA2B,gBAAGC,UAAU,CAAC,SAASD,2BAA2BA,CACxF;AACE,EAAA,kBAAkB,EAAEE,eAAe;AACnC,EAAA,uBAAuB,EAAEC,oBAAoB;EAC7CC,IAAI;EACJC,QAAQ;EACRC,4BAA4B;EAC5BC,SAAS;EACT,GAAGC;AAAS,CACqB,EACnCC,GAA8C,EAAA;AAE9C,EAAA,MAAMC,gCAAgC,GAAGC,cAAc,CAACL,4BAA4B,CAAC;AACrFM,EAAAA,SAAS,CAAC,MAAK;IACbF,gCAAgC,CAACP,oBAAoB,CAAC;AACxD,EAAA,CAAC,EAAE,CAACA,oBAAoB,EAAEO,gCAAgC,CAAC,CAAC;AAE5D,EAAA,oBACEG,GAAA,CAAA,KAAA,EAAA;AACEJ,IAAAA,GAAG,EAAEA,GAAI;AACTL,IAAAA,IAAI,EAAC,MAAM;IACXG,SAAS,EAAGO,KAAK,IAAI;AACnB;MACA,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,IAAIZ,oBAAoB,IAAI,IAAI,EAAE;AACzD,QAAA;AACF,MAAA;AAEA;AACA,MAAA,IAAIW,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;AACvB,QAAA;AACF,MAAA;AAEA;AACA,MAAA,IAAID,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;AAC1BR,QAAAA,SAAS,GAAG;AACV,UAAA,GAAGO,KAAK;AACRE,UAAAA,cAAc,EAAEA,MAAK,CAAE,CAAC;UACxBC,eAAe,EAAEA,MAAK,CAAE;AACzB,SAAA,CAAC;AACF,QAAA;AACF,MAAA;MAEAV,SAAS,GAAGO,KAAK,CAAC;IACpB,CAAE;IAAA,GACEN;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -0,0 +1,300 @@
1
+ 'use strict';
2
+
3
+ var icons = require('@transferwise/icons');
4
+ var react = require('@headlessui/react');
5
+ var clsx = require('clsx');
6
+ var React = require('react');
7
+ var reactIntl = require('react-intl');
8
+ var virtua = require('virtua');
9
+ var SearchInput = require('../../SearchInput.js');
10
+ var SelectInput_contexts = require('../SelectInput.contexts.js');
11
+ var SelectInput_utils = require('../SelectInput.utils.js');
12
+ var SelectInput_messages = require('../SelectInput.messages.js');
13
+ var SelectInputItemView = require('../ItemView/SelectInputItemView.js');
14
+ require('../../../header/Header.js');
15
+ var jsxRuntime = require('react/jsx-runtime');
16
+ var SelectInputOptionsContainer = require('./OptionsContainer/SelectInputOptionsContainer.js');
17
+
18
+ function SelectInputOptions({
19
+ id,
20
+ parentId,
21
+ items,
22
+ compareValues: compareValuesProp,
23
+ renderValue = String,
24
+ renderFooter,
25
+ filterable = false,
26
+ filterPlaceholder,
27
+ sortFilteredOptions,
28
+ searchInputRef,
29
+ listboxRef,
30
+ filterQuery,
31
+ onFilterChange,
32
+ listBoxLabel,
33
+ listBoxLabelledBy,
34
+ autocomplete,
35
+ name,
36
+ onAutocompleteSelect
37
+ }) {
38
+ const intl = reactIntl.useIntl();
39
+ const virtualiserHandlerRef = React.useRef(null);
40
+ const controllerRef = filterable ? searchInputRef : listboxRef;
41
+ const [initialRender, setInitialRender] = React.useState(true);
42
+ const needle = React.useMemo(() => {
43
+ if (filterable) {
44
+ return filterQuery ? SelectInput_utils.searchableString(filterQuery) : null;
45
+ }
46
+ return undefined;
47
+ }, [filterQuery, filterable]);
48
+ React.useEffect(() => {
49
+ if (needle) {
50
+ // Ensure having an active option while filtering.
51
+ // Without `requestAnimationFrame` upon which React depends for scheduling
52
+ // updates, the active status would only show for a split second and then
53
+ // disappear inadvertently.
54
+ requestAnimationFrame(() => {
55
+ if (controllerRef.current != null && !controllerRef.current.hasAttribute('aria-activedescendant')) {
56
+ // Activate first option via synthetic key press
57
+ controllerRef.current.dispatchEvent(new KeyboardEvent('keydown', {
58
+ key: 'Home',
59
+ bubbles: true
60
+ }));
61
+ }
62
+ });
63
+ }
64
+ }, [controllerRef, needle]);
65
+ const compareValues = React.useMemo(() => {
66
+ if (!compareValuesProp) {
67
+ return undefined;
68
+ }
69
+ if (typeof compareValuesProp === 'function') {
70
+ return (a, b) => compareValuesProp(a, b);
71
+ }
72
+ const key = compareValuesProp;
73
+ return (a, b) => {
74
+ if (typeof a === 'object' && a != null && typeof b === 'object' && b != null) {
75
+ return a[key] === b[key];
76
+ }
77
+ return a === b;
78
+ };
79
+ }, [compareValuesProp]);
80
+ const filteredItems = React.useMemo(() => {
81
+ if (needle == null) {
82
+ return items;
83
+ }
84
+ const dedupedItems = SelectInput_utils.dedupeSelectInputItems(items, compareValues);
85
+ if (sortFilteredOptions) {
86
+ // When sorting, filter out non-matching items completely to avoid ghost items
87
+ const filtered = dedupedItems.map(item => {
88
+ if (item.type === 'option') {
89
+ return SelectInput_utils.selectInputOptionItemIncludesNeedle(item, needle) ? item : {
90
+ ...item,
91
+ value: undefined
92
+ };
93
+ }
94
+ if (item.type === 'group') {
95
+ return {
96
+ ...item,
97
+ options: item.options.map(option => SelectInput_utils.selectInputOptionItemIncludesNeedle(option, needle) ? option : {
98
+ ...option,
99
+ value: undefined
100
+ })
101
+ };
102
+ }
103
+ return item;
104
+ });
105
+ return SelectInput_utils.sortSelectInputItems(filtered, sortFilteredOptions, filterQuery);
106
+ }
107
+ return SelectInput_utils.filterSelectInputItems(dedupedItems, item => SelectInput_utils.selectInputOptionItemIncludesNeedle(item, needle));
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
109
+ }, [needle, items, compareValues]);
110
+ const resultsEmpty = needle != null && filteredItems.length === 0;
111
+ const virtualized = filteredItems.length > SelectInput_utils.MAX_ITEMS_WITHOUT_VIRTUALIZATION;
112
+ // Items shown once shall be kept mounted until the needle changes, otherwise
113
+ // the scroll position may jump around inadvertently. Pattern adopted from:
114
+ // https://inokawa.github.io/virtua/?path=/story/advanced-keep-offscreen-items--append-only
115
+ const [mountedIndexes, setMountedIndexes] = React.useState([]);
116
+ const prevNeedleRef = React.useRef(needle);
117
+ React.useEffect(() => {
118
+ const needleChanged = prevNeedleRef.current !== needle;
119
+ prevNeedleRef.current = needle;
120
+ if (needleChanged) {
121
+ // Reset mounted indexes when search changes to avoid stale scroll positions
122
+ setMountedIndexes([]);
123
+ return;
124
+ }
125
+ // Ensure the 'End' key works as intended by keeping the last item mounted.
126
+ // Skipped on needle change to prevent auto-scrolling on search.
127
+ if (filteredItems.length > 0) {
128
+ setMountedIndexes(prevMountedIndexes => {
129
+ // Create a new array with existing indexes plus the last item index
130
+ return [...new Set([...prevMountedIndexes, filteredItems.length - 1])]; // Sorting is redundant by nature here
131
+ });
132
+ }
133
+ }, [needle, filteredItems.length]);
134
+ const listboxContainerRef = React.useRef(null);
135
+ React.useEffect(() => {
136
+ if (listboxContainerRef.current != null) {
137
+ listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
138
+ }
139
+ }, []);
140
+ React.useEffect(() => {
141
+ setInitialRender(false);
142
+ }, []);
143
+ const showStatus = resultsEmpty;
144
+ const statusId = React.useId();
145
+ const listboxId = React.useId();
146
+ const getItemNode = index => {
147
+ const item = filteredItems[index];
148
+ return /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView.SelectInputItemView, {
149
+ item: item,
150
+ renderValue: renderValue,
151
+ needle: needle
152
+ }, index);
153
+ };
154
+ const findMatchingItem = autocompleteValue => {
155
+ const flatOptions = items.flatMap(item => item.type === 'group' ? item.options : item.type === 'option' ? [item] : []).filter(item => item.type === 'option' && item.value != null);
156
+ const exactMatch = flatOptions.find(option => String(option.value) === autocompleteValue || option.filterMatchers?.some(matcher => matcher === autocompleteValue));
157
+ if (exactMatch) {
158
+ return exactMatch.value;
159
+ }
160
+ const fuzzyMatch = flatOptions.find(option => option.filterMatchers?.some(matcher => matcher.toLowerCase().includes(autocompleteValue.toLowerCase())));
161
+ return fuzzyMatch ? fuzzyMatch.value : null;
162
+ };
163
+ return /*#__PURE__*/jsxRuntime.jsxs(react.ListboxOptions, {
164
+ modal: true,
165
+ as: SelectInputOptionsContainer.SelectInputOptionsContainer,
166
+ static: true,
167
+ className: "np-select-input-options-container",
168
+ onAriaActiveDescendantChange: value => {
169
+ if (controllerRef.current != null) {
170
+ if (!initialRender && value != null) {
171
+ controllerRef.current.setAttribute('aria-activedescendant', value);
172
+ } else {
173
+ controllerRef.current.removeAttribute('aria-activedescendant');
174
+ }
175
+ }
176
+ },
177
+ children: [filterable ? /*#__PURE__*/jsxRuntime.jsx("div", {
178
+ className: "np-select-input-query-container",
179
+ children: /*#__PURE__*/jsxRuntime.jsx(SearchInput.SearchInput, {
180
+ ref: searchInputRef,
181
+ id: id,
182
+ name: name,
183
+ autoComplete: autocomplete,
184
+ role: "combobox",
185
+ shape: "rectangle",
186
+ placeholder: filterPlaceholder,
187
+ "aria-label": filterPlaceholder,
188
+ defaultValue: filterQuery,
189
+ "aria-autocomplete": "list",
190
+ "aria-expanded": true,
191
+ "aria-controls": listboxId,
192
+ "aria-describedby": showStatus ? statusId : undefined,
193
+ onKeyDown: event => {
194
+ // Prevent interfering with the matcher of Headless UI
195
+ // https://mathiasbynens.be/notes/javascript-unicode#regex
196
+ if (/^.$/u.test(event.key)) {
197
+ event.stopPropagation();
198
+ }
199
+ },
200
+ onChange: event => {
201
+ // Free up resources and ensure not to go out of bounds when the
202
+ // resulting item count is less than before
203
+ const inputValue = event.currentTarget.value;
204
+ // Free up resources and ensure not to go out of bounds
205
+ setMountedIndexes([]);
206
+ onFilterChange(inputValue);
207
+ },
208
+ onInput: event => {
209
+ const inputValue = event.currentTarget.value;
210
+ const inputElement = event.currentTarget;
211
+ if (autocomplete && onAutocompleteSelect && inputValue) {
212
+ setTimeout(() => {
213
+ if (inputElement.value === inputValue && inputValue.length > 2) {
214
+ const matchedValue = findMatchingItem(inputValue);
215
+ if (matchedValue !== null) {
216
+ onAutocompleteSelect(matchedValue);
217
+ }
218
+ }
219
+ }, 50);
220
+ }
221
+ }
222
+ })
223
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs("section", {
224
+ ref: listboxContainerRef,
225
+ tabIndex: -1,
226
+ className: clsx.clsx('np-select-input-listbox-container', virtualized && 'np-select-input-listbox-container--virtualized', needle == null &&
227
+ // Groups aren't shown when filtering
228
+ items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
229
+ "data-wds-parent": parentId ?? undefined,
230
+ children: [resultsEmpty ? /*#__PURE__*/jsxRuntime.jsxs("div", {
231
+ id: statusId,
232
+ className: "np-select-input-options-status",
233
+ children: [/*#__PURE__*/jsxRuntime.jsx(icons.CrossCircle, {
234
+ size: 16,
235
+ className: "np-select-input-options-status-icon"
236
+ }), intl.formatMessage(SelectInput_messages.default.noResultsFound)]
237
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
238
+ ref: listboxRef,
239
+ id: listboxId,
240
+ role: "listbox",
241
+ "aria-orientation": "vertical",
242
+ "aria-label": listBoxLabel,
243
+ "aria-labelledby": listBoxLabelledBy,
244
+ tabIndex: 0,
245
+ className: "np-select-input-listbox",
246
+ children: !virtualized ? filteredItems.map((_, index) => getItemNode(index)) : /*#__PURE__*/jsxRuntime.jsx(virtua.Virtualizer, {
247
+ ref: virtualiserHandlerRef,
248
+ data: filteredItems,
249
+ keepMounted: mountedIndexes,
250
+ scrollRef: listboxRef // `VList` doesn't expose this
251
+ ,
252
+ onScroll: async () => {
253
+ if (!virtualiserHandlerRef.current) return;
254
+ const startIndex = virtualiserHandlerRef.current.findItemIndex(virtualiserHandlerRef.current.scrollOffset);
255
+ const endIndex = virtualiserHandlerRef.current.findItemIndex(virtualiserHandlerRef.current.scrollOffset + virtualiserHandlerRef.current.viewportSize);
256
+ setMountedIndexes(prevMountedIndexes => {
257
+ // Create an array of all indexes that should be visible
258
+ const visibleIndexes = [];
259
+ for (let index = startIndex; index <= endIndex; index += 1) {
260
+ // eslint-disable-next-line functional/immutable-data
261
+ visibleIndexes.push(index);
262
+ }
263
+ // Combine with previous indexes and sort
264
+ return [...new Set([...prevMountedIndexes, ...visibleIndexes])].sort((a, b) => a - b);
265
+ });
266
+ },
267
+ children: (item, index) =>
268
+ /*#__PURE__*/
269
+ // The position of each item can't be inferred by browsers when
270
+ // virtualizing, as some of the items may not be in the DOM
271
+ jsxRuntime.jsx(SelectInput_contexts.SelectInputItemsCountContext.Provider, {
272
+ value: filteredItems.length,
273
+ children: /*#__PURE__*/jsxRuntime.jsx(SelectInput_contexts.SelectInputItemPositionContext.Provider, {
274
+ value: index + 1,
275
+ children: getItemNode(index)
276
+ })
277
+ })
278
+ })
279
+ }), renderFooter != null ? /*#__PURE__*/jsxRuntime.jsx("footer", {
280
+ className: "np-select-input-footer",
281
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
282
+ role: "none",
283
+ onKeyDown: event => {
284
+ // Prevent interfering with Headless UI
285
+ if (event.key !== 'Escape') {
286
+ event.stopPropagation();
287
+ }
288
+ },
289
+ children: renderFooter({
290
+ resultsEmpty,
291
+ queryNormalized: needle
292
+ })
293
+ })
294
+ }) : null]
295
+ })]
296
+ });
297
+ }
298
+
299
+ exports.SelectInputOptions = SelectInputOptions;
300
+ //# sourceMappingURL=SelectInputOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInputOptions.js","sources":["../../../../src/inputs/SelectInput/Options/SelectInputOptions.tsx"],"sourcesContent":["import { CrossCircle } from '@transferwise/icons';\nimport { ListboxOptions } from '@headlessui/react';\nimport { clsx } from 'clsx';\nimport { useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\nimport { Virtualizer, type VirtualizerHandle } from 'virtua';\n\nimport { SearchInput } from '../../SearchInput';\nimport {\n SelectInputItemsCountContext,\n SelectInputItemPositionContext,\n} from '../SelectInput.contexts';\nimport {\n dedupeSelectInputItems,\n filterSelectInputItems,\n MAX_ITEMS_WITHOUT_VIRTUALIZATION,\n searchableString,\n selectInputOptionItemIncludesNeedle,\n sortSelectInputItems,\n} from '../SelectInput.utils';\nimport { SelectInputOptionItem, SelectInputProps, SelectInputItem } from '../SelectInput.types';\nimport messages from '../SelectInput.messages';\n\nimport { SelectInputItemView } from '../ItemView';\nimport { SelectInputOptionsContainer } from './OptionsContainer';\n\n/**\n * Props for the SelectInputOptions component.\n */\nexport interface SelectInputOptionsProps<T = string> extends Pick<\n SelectInputProps<T>,\n | 'items'\n | 'renderValue'\n | 'renderFooter'\n | 'filterable'\n | 'filterPlaceholder'\n | 'id'\n | 'parentId'\n | 'compareValues'\n | 'sortFilteredOptions'\n> {\n searchInputRef: React.MutableRefObject<HTMLInputElement | null>;\n listboxRef: React.MutableRefObject<HTMLDivElement | null>;\n filterQuery: string;\n onFilterChange: (query: string) => void;\n listBoxLabel?: string;\n listBoxLabelledBy?: string;\n autocomplete?: string;\n name?: string;\n onAutocompleteSelect?: (value: T) => void;\n}\n\n/**\n * The main options container component for SelectInput.\n * Manages filtering, virtualisation, and rendering of options.\n */\nexport function SelectInputOptions<T = string>({\n id,\n parentId,\n items,\n compareValues: compareValuesProp,\n renderValue = String,\n renderFooter,\n filterable = false,\n filterPlaceholder,\n sortFilteredOptions,\n searchInputRef,\n listboxRef,\n filterQuery,\n onFilterChange,\n listBoxLabel,\n listBoxLabelledBy,\n autocomplete,\n name,\n onAutocompleteSelect,\n}: SelectInputOptionsProps<T>) {\n const intl = useIntl();\n const virtualiserHandlerRef = useRef<VirtualizerHandle>(null);\n const controllerRef = filterable ? searchInputRef : listboxRef;\n const [initialRender, setInitialRender] = useState(true);\n\n const needle = useMemo(() => {\n if (filterable) {\n return filterQuery ? searchableString(filterQuery) : null;\n }\n return undefined;\n }, [filterQuery, filterable]);\n useEffect(() => {\n if (needle) {\n // Ensure having an active option while filtering.\n // Without `requestAnimationFrame` upon which React depends for scheduling\n // updates, the active status would only show for a split second and then\n // disappear inadvertently.\n requestAnimationFrame(() => {\n if (\n controllerRef.current != null &&\n !controllerRef.current.hasAttribute('aria-activedescendant')\n ) {\n // Activate first option via synthetic key press\n controllerRef.current.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Home', bubbles: true }),\n );\n }\n });\n }\n }, [controllerRef, needle]);\n\n const compareValues = useMemo(() => {\n if (!compareValuesProp) {\n return undefined;\n }\n\n if (typeof compareValuesProp === 'function') {\n return (a: NonNullable<T>, b: NonNullable<T>) => compareValuesProp(a, b);\n }\n\n const key = compareValuesProp;\n return (a: NonNullable<T>, b: NonNullable<T>) => {\n if (typeof a === 'object' && a != null && typeof b === 'object' && b != null) {\n return (a as Record<string, unknown>)[key] === (b as Record<string, unknown>)[key];\n }\n return a === b;\n };\n }, [compareValuesProp]);\n\n const filteredItems: readonly SelectInputItem<NonNullable<T> | undefined>[] = useMemo(() => {\n if (needle == null) {\n return items;\n }\n\n const dedupedItems = dedupeSelectInputItems(items, compareValues);\n\n if (sortFilteredOptions) {\n // When sorting, filter out non-matching items completely to avoid ghost items\n const filtered = dedupedItems.map((item) => {\n if (item.type === 'option') {\n return selectInputOptionItemIncludesNeedle(item, needle)\n ? item\n : { ...item, value: undefined };\n }\n if (item.type === 'group') {\n return {\n ...item,\n options: item.options.map((option) =>\n selectInputOptionItemIncludesNeedle(option, needle)\n ? option\n : { ...option, value: undefined },\n ),\n };\n }\n return item;\n });\n\n return sortSelectInputItems(filtered, sortFilteredOptions, filterQuery);\n }\n\n return filterSelectInputItems(dedupedItems, (item) =>\n selectInputOptionItemIncludesNeedle(item, needle),\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [needle, items, compareValues]);\n const resultsEmpty = needle != null && filteredItems.length === 0;\n\n const virtualized = filteredItems.length > MAX_ITEMS_WITHOUT_VIRTUALIZATION;\n\n // Items shown once shall be kept mounted until the needle changes, otherwise\n // the scroll position may jump around inadvertently. Pattern adopted from:\n // https://inokawa.github.io/virtua/?path=/story/advanced-keep-offscreen-items--append-only\n const [mountedIndexes, setMountedIndexes] = useState<number[]>([]);\n const prevNeedleRef = useRef(needle);\n\n useEffect(() => {\n const needleChanged = prevNeedleRef.current !== needle;\n prevNeedleRef.current = needle;\n\n if (needleChanged) {\n // Reset mounted indexes when search changes to avoid stale scroll positions\n setMountedIndexes([]);\n return;\n }\n\n // Ensure the 'End' key works as intended by keeping the last item mounted.\n // Skipped on needle change to prevent auto-scrolling on search.\n if (filteredItems.length > 0) {\n setMountedIndexes((prevMountedIndexes) => {\n // Create a new array with existing indexes plus the last item index\n return [...new Set([...prevMountedIndexes, filteredItems.length - 1])]; // Sorting is redundant by nature here\n });\n }\n }, [needle, filteredItems.length]);\n\n const listboxContainerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (listboxContainerRef.current != null) {\n listboxContainerRef.current.style.setProperty(\n '--initial-height',\n `${listboxContainerRef.current.offsetHeight}px`,\n );\n }\n }, []);\n\n useEffect(() => {\n setInitialRender(false);\n }, []);\n\n const showStatus = resultsEmpty;\n const statusId = useId();\n const listboxId = useId();\n\n const getItemNode = (index: number) => {\n const item = filteredItems[index];\n return (\n <SelectInputItemView key={index} item={item} renderValue={renderValue} needle={needle} />\n );\n };\n\n const findMatchingItem = (autocompleteValue: string): T | null => {\n const flatOptions = items\n .flatMap((item) =>\n item.type === 'group' ? item.options : item.type === 'option' ? [item] : [],\n )\n .filter(\n (item): item is SelectInputOptionItem<NonNullable<T>> =>\n item.type === 'option' && item.value != null,\n );\n\n const exactMatch = flatOptions.find(\n (option) =>\n String(option.value) === autocompleteValue ||\n option.filterMatchers?.some((matcher) => matcher === autocompleteValue),\n );\n\n if (exactMatch) {\n return exactMatch.value;\n }\n\n const fuzzyMatch = flatOptions.find((option) =>\n option.filterMatchers?.some((matcher) =>\n matcher.toLowerCase().includes(autocompleteValue.toLowerCase()),\n ),\n );\n\n return fuzzyMatch ? fuzzyMatch.value : null;\n };\n\n return (\n <ListboxOptions\n modal\n as={SelectInputOptionsContainer}\n static\n className=\"np-select-input-options-container\"\n onAriaActiveDescendantChange={(value: React.AriaAttributes['aria-activedescendant']) => {\n if (controllerRef.current != null) {\n if (!initialRender && value != null) {\n controllerRef.current.setAttribute('aria-activedescendant', value);\n } else {\n controllerRef.current.removeAttribute('aria-activedescendant');\n }\n }\n }}\n >\n {filterable ? (\n <div className=\"np-select-input-query-container\">\n <SearchInput\n ref={searchInputRef}\n id={id}\n name={name}\n autoComplete={autocomplete}\n role=\"combobox\"\n shape=\"rectangle\"\n placeholder={filterPlaceholder}\n aria-label={filterPlaceholder}\n defaultValue={filterQuery}\n aria-autocomplete=\"list\"\n aria-expanded\n aria-controls={listboxId}\n aria-describedby={showStatus ? statusId : undefined}\n onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {\n // Prevent interfering with the matcher of Headless UI\n // https://mathiasbynens.be/notes/javascript-unicode#regex\n if (/^.$/u.test(event.key)) {\n event.stopPropagation();\n }\n }}\n onChange={(event) => {\n // Free up resources and ensure not to go out of bounds when the\n // resulting item count is less than before\n const inputValue = event.currentTarget.value;\n\n // Free up resources and ensure not to go out of bounds\n setMountedIndexes([]);\n onFilterChange(inputValue);\n }}\n onInput={(event) => {\n const inputValue = event.currentTarget.value;\n const inputElement = event.currentTarget;\n\n if (autocomplete && onAutocompleteSelect && inputValue) {\n setTimeout(() => {\n if (inputElement.value === inputValue && inputValue.length > 2) {\n const matchedValue = findMatchingItem(inputValue);\n if (matchedValue !== null) {\n onAutocompleteSelect(matchedValue);\n }\n }\n }, 50);\n }\n }}\n />\n </div>\n ) : null}\n\n <section\n ref={listboxContainerRef}\n tabIndex={-1}\n className={clsx(\n 'np-select-input-listbox-container',\n virtualized && 'np-select-input-listbox-container--virtualized',\n needle == null && // Groups aren't shown when filtering\n items.some((item) => item.type === 'group') &&\n 'np-select-input-listbox-container--has-group',\n )}\n data-wds-parent={parentId ?? undefined}\n >\n {resultsEmpty ? (\n <div id={statusId} className=\"np-select-input-options-status\">\n <CrossCircle size={16} className=\"np-select-input-options-status-icon\" />\n {intl.formatMessage(messages.noResultsFound)}\n </div>\n ) : null}\n\n <div\n ref={listboxRef}\n id={listboxId}\n role=\"listbox\"\n aria-orientation=\"vertical\"\n aria-label={listBoxLabel}\n aria-labelledby={listBoxLabelledBy}\n tabIndex={0}\n className=\"np-select-input-listbox\"\n >\n {!virtualized ? (\n filteredItems.map((_, index) => getItemNode(index))\n ) : (\n <Virtualizer\n ref={virtualiserHandlerRef}\n data={filteredItems}\n keepMounted={mountedIndexes}\n scrollRef={listboxRef} // `VList` doesn't expose this\n onScroll={async () => {\n if (!virtualiserHandlerRef.current) return;\n\n const startIndex = virtualiserHandlerRef.current.findItemIndex(\n virtualiserHandlerRef.current.scrollOffset,\n );\n const endIndex = virtualiserHandlerRef.current.findItemIndex(\n virtualiserHandlerRef.current.scrollOffset +\n virtualiserHandlerRef.current.viewportSize,\n );\n\n setMountedIndexes((prevMountedIndexes) => {\n // Create an array of all indexes that should be visible\n\n const visibleIndexes = [];\n for (let index = startIndex; index <= endIndex; index += 1) {\n // eslint-disable-next-line functional/immutable-data\n visibleIndexes.push(index);\n }\n\n // Combine with previous indexes and sort\n return [...new Set([...prevMountedIndexes, ...visibleIndexes])].sort(\n (a, b) => a - b,\n );\n });\n }}\n >\n {(item, index) => (\n // The position of each item can't be inferred by browsers when\n // virtualizing, as some of the items may not be in the DOM\n <SelectInputItemsCountContext.Provider value={filteredItems.length}>\n <SelectInputItemPositionContext.Provider value={index + 1}>\n {getItemNode(index)}\n </SelectInputItemPositionContext.Provider>\n </SelectInputItemsCountContext.Provider>\n )}\n </Virtualizer>\n )}\n </div>\n\n {renderFooter != null ? (\n <footer className=\"np-select-input-footer\">\n <div\n role=\"none\"\n onKeyDown={(event) => {\n // Prevent interfering with Headless UI\n if (event.key !== 'Escape') {\n event.stopPropagation();\n }\n }}\n >\n {renderFooter({\n resultsEmpty,\n queryNormalized: needle,\n })}\n </div>\n </footer>\n ) : null}\n </section>\n </ListboxOptions>\n );\n}\n"],"names":["SelectInputOptions","id","parentId","items","compareValues","compareValuesProp","renderValue","String","renderFooter","filterable","filterPlaceholder","sortFilteredOptions","searchInputRef","listboxRef","filterQuery","onFilterChange","listBoxLabel","listBoxLabelledBy","autocomplete","name","onAutocompleteSelect","intl","useIntl","virtualiserHandlerRef","useRef","controllerRef","initialRender","setInitialRender","useState","needle","useMemo","searchableString","undefined","useEffect","requestAnimationFrame","current","hasAttribute","dispatchEvent","KeyboardEvent","key","bubbles","a","b","filteredItems","dedupedItems","dedupeSelectInputItems","filtered","map","item","type","selectInputOptionItemIncludesNeedle","value","options","option","sortSelectInputItems","filterSelectInputItems","resultsEmpty","length","virtualized","MAX_ITEMS_WITHOUT_VIRTUALIZATION","mountedIndexes","setMountedIndexes","prevNeedleRef","needleChanged","prevMountedIndexes","Set","listboxContainerRef","style","setProperty","offsetHeight","showStatus","statusId","useId","listboxId","getItemNode","index","_jsx","SelectInputItemView","findMatchingItem","autocompleteValue","flatOptions","flatMap","filter","exactMatch","find","filterMatchers","some","matcher","fuzzyMatch","toLowerCase","includes","_jsxs","ListboxOptions","modal","as","SelectInputOptionsContainer","static","className","onAriaActiveDescendantChange","setAttribute","removeAttribute","children","SearchInput","ref","autoComplete","role","shape","placeholder","defaultValue","onKeyDown","event","test","stopPropagation","onChange","inputValue","currentTarget","onInput","inputElement","setTimeout","matchedValue","tabIndex","clsx","CrossCircle","size","formatMessage","messages","noResultsFound","_","Virtualizer","data","keepMounted","scrollRef","onScroll","startIndex","findItemIndex","scrollOffset","endIndex","viewportSize","visibleIndexes","push","sort","SelectInputItemsCountContext","Provider","SelectInputItemPositionContext","queryNormalized"],"mappings":";;;;;;;;;;;;;;;;;AAwDM,SAAUA,kBAAkBA,CAAa;EAC7CC,EAAE;EACFC,QAAQ;EACRC,KAAK;AACLC,EAAAA,aAAa,EAAEC,iBAAiB;AAChCC,EAAAA,WAAW,GAAGC,MAAM;EACpBC,YAAY;AACZC,EAAAA,UAAU,GAAG,KAAK;EAClBC,iBAAiB;EACjBC,mBAAmB;EACnBC,cAAc;EACdC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,YAAY;EACZC,iBAAiB;EACjBC,YAAY;EACZC,IAAI;AACJC,EAAAA;AAAoB,CACO,EAAA;AAC3B,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AACtB,EAAA,MAAMC,qBAAqB,GAAGC,YAAM,CAAoB,IAAI,CAAC;AAC7D,EAAA,MAAMC,aAAa,GAAGhB,UAAU,GAAGG,cAAc,GAAGC,UAAU;EAC9D,MAAM,CAACa,aAAa,EAAEC,gBAAgB,CAAC,GAAGC,cAAQ,CAAC,IAAI,CAAC;AAExD,EAAA,MAAMC,MAAM,GAAGC,aAAO,CAAC,MAAK;AAC1B,IAAA,IAAIrB,UAAU,EAAE;AACd,MAAA,OAAOK,WAAW,GAAGiB,kCAAgB,CAACjB,WAAW,CAAC,GAAG,IAA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