@transferwise/components 0.0.0-experimental-a9ab536 → 0.0.0-experimental-74c86e4

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 (233) hide show
  1. package/build/dateInput/DateInput.js +5 -12
  2. package/build/dateInput/DateInput.js.map +1 -1
  3. package/build/dateInput/DateInput.mjs +4 -11
  4. package/build/dateInput/DateInput.mjs.map +1 -1
  5. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +8 -16
  6. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  7. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +6 -14
  8. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  9. package/build/index.js +7 -14
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +3 -10
  12. package/build/index.mjs.map +1 -1
  13. package/build/inputs/SelectInput.js +890 -0
  14. package/build/inputs/SelectInput.js.map +1 -0
  15. package/build/inputs/SelectInput.messages.js.map +1 -0
  16. package/build/inputs/SelectInput.messages.mjs.map +1 -0
  17. package/build/inputs/SelectInput.mjs +881 -0
  18. package/build/inputs/SelectInput.mjs.map +1 -0
  19. package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.js → _BottomSheet.js} +7 -7
  20. package/build/inputs/_BottomSheet.js.map +1 -0
  21. package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.mjs → _BottomSheet.mjs} +7 -7
  22. package/build/inputs/_BottomSheet.mjs.map +1 -0
  23. package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.js → _ButtonInput.js} +5 -5
  24. package/build/inputs/_ButtonInput.js.map +1 -0
  25. package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.mjs → _ButtonInput.mjs} +5 -5
  26. package/build/inputs/_ButtonInput.mjs.map +1 -0
  27. package/build/inputs/{SelectInput/Popover/SelectInputPopover.js → _Popover.js} +4 -4
  28. package/build/inputs/_Popover.js.map +1 -0
  29. package/build/inputs/{SelectInput/Popover/SelectInputPopover.mjs → _Popover.mjs} +4 -4
  30. package/build/inputs/_Popover.mjs.map +1 -0
  31. package/build/main.css +90 -90
  32. package/build/moneyInput/MoneyInput.js +2 -9
  33. package/build/moneyInput/MoneyInput.js.map +1 -1
  34. package/build/moneyInput/MoneyInput.mjs +1 -8
  35. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  36. package/build/phoneNumberInput/PhoneNumberInput.js +3 -10
  37. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  38. package/build/phoneNumberInput/PhoneNumberInput.mjs +2 -9
  39. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  40. package/build/styles/main.css +90 -90
  41. package/build/types/inputs/{SelectInput/SelectInput.types.d.ts → SelectInput.d.ts} +38 -12
  42. package/build/types/inputs/SelectInput.d.ts.map +1 -0
  43. package/build/types/inputs/SelectInput.messages.d.ts.map +1 -0
  44. package/build/types/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.d.ts → _BottomSheet.d.ts} +3 -3
  45. package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
  46. package/build/types/inputs/_ButtonInput.d.ts +5 -0
  47. package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
  48. package/build/types/inputs/{SelectInput/Popover/SelectInputPopover.d.ts → _Popover.d.ts} +3 -3
  49. package/build/types/inputs/_Popover.d.ts.map +1 -0
  50. package/package.json +1 -1
  51. package/src/inputs/{SelectInput/_stories/SelectInput.docs.mdx → SelectInput.docs.mdx} +1 -0
  52. package/src/inputs/SelectInput.less +219 -0
  53. package/src/inputs/{SelectInput/_stories/SelectInput.story.tsx → SelectInput.story.tsx} +8 -11
  54. package/src/inputs/{SelectInput/_stories/SelectInput.test.story.tsx → SelectInput.test.story.tsx} +10 -5
  55. package/src/inputs/{SelectInput/SelectInput.test.tsx → SelectInput.test.tsx} +11 -9
  56. package/src/inputs/SelectInput.tsx +1269 -0
  57. package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.tsx → _BottomSheet.tsx} +7 -7
  58. package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.tsx → _ButtonInput.tsx} +5 -5
  59. package/src/inputs/{SelectInput/Popover/SelectInputPopover.tsx → _Popover.tsx} +4 -4
  60. package/src/main.css +90 -90
  61. package/src/main.less +1 -1
  62. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +0 -1
  63. package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +0 -1
  64. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +0 -1
  65. package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +0 -1
  66. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +0 -27
  67. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +0 -1
  68. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +0 -25
  69. package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +0 -1
  70. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +0 -59
  71. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +0 -1
  72. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +0 -56
  73. package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +0 -1
  74. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +0 -50
  75. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +0 -1
  76. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +0 -48
  77. package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +0 -1
  78. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +0 -47
  79. package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +0 -1
  80. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +0 -45
  81. package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +0 -1
  82. package/build/inputs/SelectInput/Option/SelectInputOption.js +0 -42
  83. package/build/inputs/SelectInput/Option/SelectInputOption.js.map +0 -1
  84. package/build/inputs/SelectInput/Option/SelectInputOption.mjs +0 -40
  85. package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +0 -1
  86. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +0 -40
  87. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +0 -1
  88. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +0 -38
  89. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +0 -1
  90. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +0 -48
  91. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +0 -1
  92. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +0 -46
  93. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +0 -1
  94. package/build/inputs/SelectInput/Options/SelectInputOptions.js +0 -300
  95. package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +0 -1
  96. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +0 -298
  97. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +0 -1
  98. package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +0 -1
  99. package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +0 -1
  100. package/build/inputs/SelectInput/SelectInput.contexts.js +0 -29
  101. package/build/inputs/SelectInput/SelectInput.contexts.js.map +0 -1
  102. package/build/inputs/SelectInput/SelectInput.contexts.mjs +0 -24
  103. package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +0 -1
  104. package/build/inputs/SelectInput/SelectInput.js +0 -222
  105. package/build/inputs/SelectInput/SelectInput.js.map +0 -1
  106. package/build/inputs/SelectInput/SelectInput.messages.js.map +0 -1
  107. package/build/inputs/SelectInput/SelectInput.messages.mjs.map +0 -1
  108. package/build/inputs/SelectInput/SelectInput.mjs +0 -216
  109. package/build/inputs/SelectInput/SelectInput.mjs.map +0 -1
  110. package/build/inputs/SelectInput/SelectInput.utils.js +0 -164
  111. package/build/inputs/SelectInput/SelectInput.utils.js.map +0 -1
  112. package/build/inputs/SelectInput/SelectInput.utils.mjs +0 -154
  113. package/build/inputs/SelectInput/SelectInput.utils.mjs.map +0 -1
  114. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +0 -43
  115. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +0 -1
  116. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +0 -37
  117. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +0 -1
  118. package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
  119. package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
  120. package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
  121. package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
  122. package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +0 -33
  123. package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
  124. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
  125. package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
  126. package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +0 -1
  127. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +0 -3
  128. package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +0 -1
  129. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +0 -5
  130. package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +0 -1
  131. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +0 -3
  132. package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +0 -1
  133. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +0 -7
  134. package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +0 -1
  135. package/build/types/inputs/SelectInput/ClearButton/index.d.ts +0 -3
  136. package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +0 -1
  137. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +0 -16
  138. package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +0 -1
  139. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +0 -2
  140. package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +0 -1
  141. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +0 -12
  142. package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +0 -1
  143. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +0 -3
  144. package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +0 -1
  145. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +0 -14
  146. package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +0 -1
  147. package/build/types/inputs/SelectInput/ItemView/index.d.ts +0 -4
  148. package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +0 -1
  149. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +0 -14
  150. package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +0 -1
  151. package/build/types/inputs/SelectInput/Option/index.d.ts +0 -3
  152. package/build/types/inputs/SelectInput/Option/index.d.ts.map +0 -1
  153. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +0 -16
  154. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +0 -1
  155. package/build/types/inputs/SelectInput/OptionContent/index.d.ts +0 -3
  156. package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +0 -1
  157. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +0 -12
  158. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +0 -1
  159. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +0 -3
  160. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +0 -1
  161. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +0 -21
  162. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +0 -1
  163. package/build/types/inputs/SelectInput/Options/index.d.ts +0 -4
  164. package/build/types/inputs/SelectInput/Options/index.d.ts.map +0 -1
  165. package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +0 -1
  166. package/build/types/inputs/SelectInput/Popover/index.d.ts +0 -3
  167. package/build/types/inputs/SelectInput/Popover/index.d.ts.map +0 -1
  168. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +0 -33
  169. package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +0 -1
  170. package/build/types/inputs/SelectInput/SelectInput.d.ts +0 -10
  171. package/build/types/inputs/SelectInput/SelectInput.d.ts.map +0 -1
  172. package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +0 -1
  173. package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +0 -1
  174. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +0 -61
  175. package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +0 -1
  176. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +0 -18
  177. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +0 -1
  178. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +0 -3
  179. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +0 -1
  180. package/build/types/inputs/SelectInput/components.d.ts +0 -10
  181. package/build/types/inputs/SelectInput/components.d.ts.map +0 -1
  182. package/build/types/inputs/SelectInput/index.d.ts +0 -12
  183. package/build/types/inputs/SelectInput/index.d.ts.map +0 -1
  184. package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
  185. package/src/inputs/SelectInput/BottomSheet/index.ts +0 -2
  186. package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
  187. package/src/inputs/SelectInput/ButtonInput/index.ts +0 -2
  188. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
  189. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +0 -40
  190. package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +0 -29
  191. package/src/inputs/SelectInput/ClearButton/index.ts +0 -2
  192. package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +0 -74
  193. package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +0 -5
  194. package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +0 -64
  195. package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +0 -2
  196. package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
  197. package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +0 -17
  198. package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +0 -51
  199. package/src/inputs/SelectInput/ItemView/index.ts +0 -3
  200. package/src/inputs/SelectInput/Option/SelectInputOption.css +0 -33
  201. package/src/inputs/SelectInput/Option/SelectInputOption.less +0 -32
  202. package/src/inputs/SelectInput/Option/SelectInputOption.tsx +0 -60
  203. package/src/inputs/SelectInput/Option/index.ts +0 -2
  204. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
  205. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +0 -38
  206. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +0 -75
  207. package/src/inputs/SelectInput/OptionContent/index.ts +0 -2
  208. package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +0 -62
  209. package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +0 -2
  210. package/src/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
  211. package/src/inputs/SelectInput/Options/SelectInputOptions.less +0 -77
  212. package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +0 -418
  213. package/src/inputs/SelectInput/Options/index.ts +0 -3
  214. package/src/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
  215. package/src/inputs/SelectInput/Popover/index.ts +0 -2
  216. package/src/inputs/SelectInput/SelectInput.contexts.tsx +0 -40
  217. package/src/inputs/SelectInput/SelectInput.less +0 -22
  218. package/src/inputs/SelectInput/SelectInput.tsx +0 -258
  219. package/src/inputs/SelectInput/SelectInput.types.ts +0 -113
  220. package/src/inputs/SelectInput/SelectInput.utils.ts +0 -206
  221. package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +0 -44
  222. package/src/inputs/SelectInput/TriggerButton/index.ts +0 -5
  223. package/src/inputs/SelectInput/components.ts +0 -10
  224. package/src/inputs/SelectInput/index.ts +0 -14
  225. package/build/inputs/{SelectInput/SelectInput.messages.js → SelectInput.messages.js} +0 -0
  226. package/build/inputs/{SelectInput/SelectInput.messages.mjs → SelectInput.messages.mjs} +0 -0
  227. package/{src/inputs/SelectInput → build/styles/inputs}/SelectInput.css +90 -90
  228. package/build/types/inputs/{SelectInput/SelectInput.messages.d.ts → SelectInput.messages.d.ts} +0 -0
  229. package/{build/styles/inputs/SelectInput → src/inputs}/SelectInput.css +90 -90
  230. /package/src/inputs/{SelectInput/SelectInput.messages.ts → SelectInput.messages.ts} +0 -0
  231. /package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.less → _BottomSheet.less} +0 -0
  232. /package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.less → _ButtonInput.less} +0 -0
  233. /package/src/inputs/{SelectInput/Popover/SelectInputPopover.less → _Popover.less} +0 -0
@@ -1,64 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { useId } from 'react';
3
- import Header from '../../../../header';
4
- import Section from '../../../../section';
5
- import { SelectInputGroupItem } from '../../SelectInput.types';
6
- import { SelectInputItemView, SelectInputItemViewProps } from '..';
7
-
8
- /**
9
- * Props for the SelectInputGroupItemView component.
10
- */
11
- export interface SelectInputGroupItemViewProps<T = string> extends SelectInputItemViewProps<
12
- T,
13
- SelectInputGroupItem<T | undefined>
14
- > {}
15
-
16
- /**
17
- * Component that renders a group of SelectInput options with a header.
18
- */
19
- export function SelectInputGroupItemView<T = string>({
20
- item,
21
- renderValue,
22
- needle,
23
- }: SelectInputGroupItemViewProps<T>) {
24
- const headerId = useId();
25
-
26
- const header = (
27
- <Header
28
- as="header"
29
- role="none"
30
- id={headerId}
31
- title={item.label}
32
- // @ts-expect-error when we migrate ActionButton to new Button this should be sorted
33
- action={
34
- item.action && {
35
- text: item.action.label,
36
- onClick: item.action.onClick,
37
- }
38
- }
39
- className="np-select-input-group-item-header p-x-1"
40
- />
41
- );
42
-
43
- return (
44
- // An empty container may be rendered when no options match `needle`
45
- // However, pre-filtering would result in worse performance overall
46
- <Section
47
- as="section"
48
- role="group"
49
- aria-labelledby={headerId}
50
- className={clsx('m-y-0', needle === null && 'np-select-input-group-item--without-needle')}
51
- >
52
- {needle == null ? header : null}
53
- {item.options.map((option, index) => (
54
- <SelectInputItemView
55
- // eslint-disable-next-line react/no-array-index-key
56
- key={index}
57
- item={option}
58
- renderValue={renderValue}
59
- needle={needle}
60
- />
61
- ))}
62
- </Section>
63
- );
64
- }
@@ -1,2 +0,0 @@
1
- export { SelectInputGroupItemView } from './SelectInputGroupItemView';
2
- export type { SelectInputGroupItemViewProps } from './SelectInputGroupItemView';
@@ -1,16 +0,0 @@
1
- .np-select-input-group-item--without-needle:first-child {
2
- margin-top: calc(-1 * 8px);
3
- margin-top: calc(-1 * var(--size-8));
4
- }
5
- .np-select-input-group-item-header {
6
- position: sticky;
7
- top: 0px;
8
- z-index: 10;
9
- background-color: #ffffff;
10
- background-color: var(--color-background-elevated);
11
- }
12
- .np-select-input-separator-item {
13
- margin: 8px;
14
- margin: var(--size-8);
15
- border-top-width: 1px;
16
- }
@@ -1,17 +0,0 @@
1
- .np-select-input-group-item {
2
- &--without-needle:first-child {
3
- margin-top: calc(-1 * var(--size-8));
4
- }
5
- }
6
-
7
- .np-select-input-group-item-header {
8
- position: sticky;
9
- top: 0px;
10
- z-index: 10;
11
- background-color: var(--color-background-elevated);
12
- }
13
-
14
- .np-select-input-separator-item {
15
- margin: var(--size-8);
16
- border-top-width: 1px;
17
- }
@@ -1,51 +0,0 @@
1
- import { selectInputOptionItemIncludesNeedle } from '../SelectInput.utils';
2
- import { SelectInputItem, SelectInputProps } from '../SelectInput.types';
3
- import { SelectInputOption } from '../Option';
4
- import { SelectInputGroupItemView } from './GroupItemView';
5
-
6
- /**
7
- * Props for the SelectInputItemView component.
8
- */
9
- export interface SelectInputItemViewProps<
10
- T = string,
11
- I extends SelectInputItem<T | undefined> = SelectInputItem<T | undefined>,
12
- > extends Required<Pick<SelectInputProps<T>, 'renderValue'>> {
13
- item: I;
14
- needle: string | null | undefined;
15
- }
16
-
17
- /**
18
- * Component that renders different types of SelectInput items:
19
- * options, groups, or separators.
20
- */
21
- export function SelectInputItemView<T = string>({
22
- item,
23
- renderValue,
24
- needle,
25
- }: SelectInputItemViewProps<T>) {
26
- switch (item.type) {
27
- case 'option': {
28
- if (
29
- item.value != null &&
30
- (needle == null || selectInputOptionItemIncludesNeedle(item, needle))
31
- ) {
32
- return (
33
- <SelectInputOption value={item.value} disabled={item.disabled}>
34
- {renderValue(item.value, false)}
35
- </SelectInputOption>
36
- );
37
- }
38
- break;
39
- }
40
- case 'group': {
41
- return <SelectInputGroupItemView item={item} renderValue={renderValue} needle={needle} />;
42
- }
43
- case 'separator': {
44
- if (needle == null) {
45
- return <hr className="np-select-input-separator-item" />;
46
- }
47
- break;
48
- }
49
- }
50
- return null;
51
- }
@@ -1,3 +0,0 @@
1
- export { SelectInputItemView } from './SelectInputItemView';
2
- export type { SelectInputItemViewProps } from './SelectInputItemView';
3
- export * from './GroupItemView';
@@ -1,33 +0,0 @@
1
- .np-select-input-option-container {
2
- display: flex;
3
- cursor: default;
4
- -webkit-user-select: none;
5
- -moz-user-select: none;
6
- user-select: none;
7
- align-items: center;
8
- -moz-column-gap: 8px;
9
- column-gap: 8px;
10
- -moz-column-gap: var(--size-8);
11
- column-gap: var(--size-8);
12
- border-radius: 10px;
13
- border-radius: var(--radius-small);
14
- padding: 12px 16px;
15
- padding: var(--size-12) var(--size-16);
16
- color: var(--color-interactive-primary);
17
- }
18
- .np-select-input-option-container:focus {
19
- outline: none;
20
- }
21
- .np-select-input-option-container--active {
22
- box-shadow: inset 0 0 0 1px #c9cbce;
23
- box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
24
- }
25
- .np-select-input-option-container--disabled {
26
- opacity: 0.45;
27
- }
28
- .np-select-input-option-check--not-selected {
29
- visibility: hidden;
30
- }
31
- .np-select-input-option {
32
- flex: 1;
33
- }
@@ -1,32 +0,0 @@
1
- .np-select-input-option-container {
2
- display: flex;
3
- cursor: default;
4
- user-select: none;
5
- align-items: center;
6
- column-gap: var(--size-8);
7
- border-radius: var(--radius-small);
8
- padding: var(--size-12) var(--size-16);
9
- color: var(--color-interactive-primary);
10
-
11
- &:focus {
12
- outline: none;
13
- }
14
-
15
- &--active {
16
- box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
17
- }
18
-
19
- &--disabled {
20
- opacity: 0.45;
21
- }
22
- }
23
-
24
- .np-select-input-option-check {
25
- &--not-selected {
26
- visibility: hidden;
27
- }
28
- }
29
-
30
- .np-select-input-option {
31
- flex: 1;
32
- }
@@ -1,60 +0,0 @@
1
- import { Check } from '@transferwise/icons';
2
- import { clsx } from 'clsx';
3
- import { useContext } from 'react';
4
- import { ListboxOption } from '@headlessui/react';
5
- import {
6
- SelectInputItemsCountContext,
7
- SelectInputItemPositionContext,
8
- } from '../SelectInput.contexts';
9
-
10
- /**
11
- * Props for the SelectInputOption component.
12
- */
13
- export interface SelectInputOptionProps<T = string> {
14
- value: T;
15
- disabled?: boolean;
16
- children?: React.ReactNode;
17
- }
18
-
19
- /**
20
- * A selectable option in a SelectInput dropdown.
21
- * Includes accessibility support and styling for selected, active, and disabled states.
22
- */
23
- export function SelectInputOption<T = string>({
24
- value,
25
- disabled,
26
- children,
27
- }: SelectInputOptionProps<T>) {
28
- const itemsCount = useContext(SelectInputItemsCountContext);
29
- const itemPosition = useContext(SelectInputItemPositionContext);
30
-
31
- return (
32
- <ListboxOption
33
- as="div"
34
- value={value}
35
- aria-setsize={itemsCount}
36
- aria-posinset={itemPosition}
37
- disabled={disabled}
38
- className={({ active, disabled: uiDisabled }) =>
39
- clsx(
40
- 'np-select-input-option-container np-text-body-large',
41
- active && 'np-select-input-option-container--active',
42
- uiDisabled && 'np-select-input-option-container--disabled',
43
- )
44
- }
45
- >
46
- {({ selected }) => (
47
- <>
48
- <div className="np-select-input-option">{children}</div>
49
- <Check
50
- size={16}
51
- className={clsx(
52
- 'np-select-input-option-check',
53
- !selected && 'np-select-input-option-check--not-selected',
54
- )}
55
- />
56
- </>
57
- )}
58
- </ListboxOption>
59
- );
60
- }
@@ -1,2 +0,0 @@
1
- export { SelectInputOption } from './SelectInputOption';
2
- export type { SelectInputOptionProps } from './SelectInputOption';
@@ -1,37 +0,0 @@
1
- .np-select-input-option-content-container {
2
- display: flex;
3
- align-items: center;
4
- -moz-column-gap: 8px;
5
- column-gap: 8px;
6
- -moz-column-gap: var(--size-8);
7
- column-gap: var(--size-8);
8
- color: #37517e;
9
- color: var(--color-content-primary);
10
- }
11
- .np-select-input-option-content-icon {
12
- display: flex;
13
- }
14
- .np-select-input-option-content-icon--not-within-trigger {
15
- align-self: flex-start;
16
- }
17
- .np-select-input-option-content-text {
18
- display: flex;
19
- flex: 1;
20
- flex-direction: column;
21
- overflow: hidden;
22
- }
23
- .np-select-input-option-content-text-secondary {
24
- color: #5d7079;
25
- color: var(--color-content-secondary);
26
- }
27
- .np-select-input-option-content-text-within-trigger {
28
- overflow: hidden;
29
- text-overflow: ellipsis;
30
- white-space: nowrap;
31
- }
32
- .np-select-input-option-content-text-line-1 > :not([hidden]) ~ :not([hidden]) {
33
- margin-right: 8px;
34
- margin-right: var(--size-8);
35
- margin-left: 8px;
36
- margin-left: var(--size-8);
37
- }
@@ -1,38 +0,0 @@
1
- .np-select-input-option-content-container {
2
- display: flex;
3
- align-items: center;
4
- column-gap: var(--size-8);
5
- color: var(--color-content-primary);
6
- }
7
-
8
- .np-select-input-option-content-icon {
9
- display: flex;
10
-
11
- &--not-within-trigger {
12
- align-self: flex-start;
13
- }
14
- }
15
-
16
- .np-select-input-option-content-text {
17
- display: flex;
18
- flex: 1;
19
- flex-direction: column;
20
- overflow: hidden;
21
- }
22
-
23
- .np-select-input-option-content-text-secondary {
24
- color: var(--color-content-secondary);
25
- }
26
-
27
- .np-select-input-option-content-text-within-trigger {
28
- overflow: hidden;
29
- text-overflow: ellipsis;
30
- white-space: nowrap;
31
- }
32
-
33
- .np-select-input-option-content-text-line-1 {
34
- > :not([hidden]) ~ :not([hidden]) {
35
- margin-right: var(--size-8);
36
- margin-left: var(--size-8);
37
- }
38
- }
@@ -1,75 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { useContext } from 'react';
3
- import { SelectInputOptionContentWithinTriggerContext } from '../SelectInput.contexts';
4
-
5
- /**
6
- * Props for the SelectInputOptionContent component.
7
- */
8
- export interface SelectInputOptionContentProps {
9
- title: React.ReactNode;
10
- note?: string;
11
- description?: string;
12
- icon?: React.ReactNode;
13
- }
14
-
15
- /**
16
- * Component for rendering structured content within a SelectInput option.
17
- * Supports title, optional note, description, and icon with different styling
18
- * based on whether it's rendered within the trigger button or the dropdown.
19
- */
20
- export function SelectInputOptionContent({
21
- title,
22
- note,
23
- description,
24
- icon,
25
- }: SelectInputOptionContentProps) {
26
- const withinTrigger = useContext(SelectInputOptionContentWithinTriggerContext);
27
-
28
- return (
29
- <div
30
- className={clsx(
31
- 'np-select-input-option-content-container',
32
- (note || description) && 'np-text-body-large',
33
- )}
34
- >
35
- {icon ? (
36
- <div
37
- className={clsx(
38
- 'np-select-input-option-content-icon',
39
- !withinTrigger && 'np-select-input-option-content-icon--not-within-trigger',
40
- )}
41
- >
42
- {icon}
43
- </div>
44
- ) : null}
45
-
46
- <div className="np-select-input-option-content-text">
47
- <div
48
- className={clsx(
49
- 'np-select-input-option-content-text-line-1',
50
- withinTrigger && 'np-select-input-option-content-text-within-trigger',
51
- )}
52
- >
53
- <div className="d-inline">{title}</div>
54
- {note ? (
55
- <span className="np-select-input-option-content-text-secondary np-text-body-default">
56
- {note}
57
- </span>
58
- ) : null}
59
- </div>
60
-
61
- {description ? (
62
- <div
63
- className={clsx(
64
- 'np-select-input-option-content-text-secondary np-text-body-default',
65
- withinTrigger &&
66
- 'np-select-input-option-content-text-within-trigger np-select-input-option-description-in-trigger',
67
- )}
68
- >
69
- {description}
70
- </div>
71
- ) : null}
72
- </div>
73
- </div>
74
- );
75
- }
@@ -1,2 +0,0 @@
1
- export { SelectInputOptionContent } from './SelectInputOptionContent';
2
- export type { SelectInputOptionContentProps } from './SelectInputOptionContent';
@@ -1,62 +0,0 @@
1
- import { forwardRef, useEffect } from 'react';
2
- import { useEffectEvent } from '../../../../common/hooks/useEffectEvent';
3
-
4
- /**
5
- * Props for the SelectInputOptionsContainer component.
6
- */
7
- export interface SelectInputOptionsContainerProps extends React.ComponentPropsWithRef<'div'> {
8
- onAriaActiveDescendantChange: (value: React.AriaAttributes['aria-activedescendant']) => void;
9
- }
10
-
11
- /**
12
- * Container component for SelectInput options.
13
- * Handles keyboard navigation and accessibility features.
14
- */
15
- export const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContainer(
16
- {
17
- 'aria-orientation': ariaOrientation,
18
- 'aria-activedescendant': ariaActiveDescendant,
19
- role,
20
- tabIndex,
21
- onAriaActiveDescendantChange,
22
- onKeyDown,
23
- ...restProps
24
- }: SelectInputOptionsContainerProps,
25
- ref: React.ForwardedRef<HTMLDivElement | null>,
26
- ) {
27
- const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
28
- useEffect(() => {
29
- handleAriaActiveDescendantChange(ariaActiveDescendant);
30
- }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
31
-
32
- return (
33
- <div
34
- ref={ref}
35
- role="none"
36
- onKeyDown={(event) => {
37
- // Prevent confirmation close without an active item
38
- if (event.key === 'Enter' && ariaActiveDescendant == null) {
39
- return;
40
- }
41
-
42
- // Required to make ListBox focusable
43
- if (event.key === 'Tab') {
44
- return;
45
- }
46
-
47
- // Prevent absorbing Escape early
48
- if (event.key === 'Escape') {
49
- onKeyDown?.({
50
- ...event,
51
- preventDefault: () => {},
52
- stopPropagation: () => {},
53
- });
54
- return;
55
- }
56
-
57
- onKeyDown?.(event);
58
- }}
59
- {...restProps}
60
- />
61
- );
62
- });
@@ -1,2 +0,0 @@
1
- export { SelectInputOptionsContainer } from './SelectInputOptionsContainer';
2
- export type { SelectInputOptionsContainerProps } from './SelectInputOptionsContainer';
@@ -1,81 +0,0 @@
1
- .np-select-input-options-container {
2
- display: flex;
3
- height: 100%;
4
- flex-direction: column;
5
- }
6
- .np-select-input-options-container:focus {
7
- outline: none;
8
- }
9
- @media (min-width: 576px) {
10
- .np-select-input-options-container {
11
- max-height: 28rem /* 448px */;
12
- }
13
- }
14
- .np-select-input-options-status {
15
- display: flex;
16
- align-items: center;
17
- -moz-column-gap: 8px;
18
- column-gap: 8px;
19
- -moz-column-gap: var(--size-8);
20
- column-gap: var(--size-8);
21
- padding: 8px 24px 0px;
22
- padding: var(--size-8) var(--size-24) 0px;
23
- }
24
- .np-select-input-options-status-icon {
25
- padding: 0 4px;
26
- padding: 0 var(--size-4);
27
- color: #768e9c;
28
- color: var(--color-content-tertiary);
29
- }
30
- .np-select-input-query-container {
31
- display: flex;
32
- flex-direction: column;
33
- padding: 8px;
34
- padding: var(--size-8);
35
- }
36
- .np-select-input-listbox-container {
37
- position: relative;
38
- height: var(--initial-height);
39
- scroll-padding-top: 8px;
40
- scroll-padding-top: var(--size-8);
41
- scroll-padding-bottom: 8px;
42
- scroll-padding-bottom: var(--size-8);
43
- overflow-y: auto;
44
- }
45
- @media (min-width: 576px) {
46
- .np-select-input-listbox-container {
47
- height: auto;
48
- }
49
- }
50
- .np-select-input-listbox-container--virtualized {
51
- /* The wrapping element shrinks this as needed */
52
- height: 100vh;
53
- }
54
- .np-select-input-listbox-container--has-group {
55
- scroll-padding-top: 32px;
56
- scroll-padding-top: var(--size-32);
57
- }
58
- .np-select-input-listbox {
59
- border-radius: 10px;
60
- border-radius: var(--radius-small);
61
- padding: 8px;
62
- padding: var(--size-8);
63
- --ring-outline-offset: calc(-1 * var(--ring-outline-width));
64
- }
65
- .np-select-input-listbox:focus {
66
- outline: none;
67
- }
68
- .np-select-input-listbox:focus-visible {
69
- outline: var(--ring-outline-color) solid var(--ring-outline-width);
70
- outline-offset: var(--ring-outline-offset);
71
- }
72
- .np-select-input-listbox-container--virtualized .np-select-input-listbox {
73
- /* Adopted from `VList` in virtua: https://github.com/inokawa/virtua/blob/7f6ed5b37df6b480d4ff350f3960067c5b3519d2/src/react/VList.tsx#L113-L116 */
74
- overflow-y: auto;
75
- contain: strict;
76
- height: 100%;
77
- }
78
- .np-select-input-footer {
79
- padding: 4px 24px 16px;
80
- padding: var(--size-4) var(--size-24) var(--size-16);
81
- }
@@ -1,77 +0,0 @@
1
- @import (reference) "../../../../node_modules/@transferwise/neptune-css/src/less/ring.less";
2
-
3
- .np-select-input-options-container {
4
- display: flex;
5
- height: 100%;
6
- flex-direction: column;
7
-
8
- &:focus {
9
- outline: none;
10
- }
11
-
12
- @media (--screen-sm) {
13
- & {
14
- max-height: 28rem /* 448px */;
15
- }
16
- }
17
- }
18
-
19
- .np-select-input-options-status {
20
- display: flex;
21
- align-items: center;
22
- column-gap: var(--size-8);
23
- padding: var(--size-8) var(--size-24) 0px;
24
- }
25
-
26
- .np-select-input-options-status-icon {
27
- padding: 0 var(--size-4);
28
- color: var(--color-content-tertiary);
29
- }
30
-
31
- .np-select-input-query-container {
32
- display: flex;
33
- flex-direction: column;
34
- padding: var(--size-8);
35
- }
36
-
37
- .np-select-input-listbox-container {
38
- position: relative;
39
- height: var(--initial-height);
40
- scroll-padding-top: var(--size-8);
41
- scroll-padding-bottom: var(--size-8);
42
- overflow-y: auto;
43
-
44
- @media (--screen-sm) {
45
- & {
46
- height: auto;
47
- }
48
- }
49
-
50
- &--virtualized {
51
- /* The wrapping element shrinks this as needed */
52
- height: 100vh;
53
- }
54
-
55
- &--has-group {
56
- scroll-padding-top: var(--size-32);
57
- }
58
- }
59
-
60
- .np-select-input-listbox {
61
- border-radius: var(--radius-small);
62
- padding: var(--size-8);
63
-
64
- .focus-ring();
65
- --ring-outline-offset: calc(-1 * var(--ring-outline-width));
66
-
67
- .np-select-input-listbox-container--virtualized & {
68
- /* Adopted from `VList` in virtua: https://github.com/inokawa/virtua/blob/7f6ed5b37df6b480d4ff350f3960067c5b3519d2/src/react/VList.tsx#L113-L116 */
69
- overflow-y: auto;
70
- contain: strict;
71
- height: 100%;
72
- }
73
- }
74
-
75
- .np-select-input-footer {
76
- padding: var(--size-4) var(--size-24) var(--size-16);
77
- }