@transferwise/components 0.0.0-experimental-bcfa03a → 0.0.0-experimental-5cd0315

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 (180) hide show
  1. package/build/dateInput/DateInput.js +3 -6
  2. package/build/dateInput/DateInput.js.map +1 -1
  3. package/build/dateInput/DateInput.mjs +2 -5
  4. package/build/dateInput/DateInput.mjs.map +1 -1
  5. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +3 -5
  6. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  7. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +1 -3
  8. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  9. package/build/index.js +3 -5
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +1 -3
  12. package/build/index.mjs.map +1 -1
  13. package/build/inputs/SelectInput.js +840 -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 +832 -0
  18. package/build/inputs/SelectInput.mjs.map +1 -0
  19. package/build/main.css +70 -65
  20. package/build/moneyInput/MoneyInput.js +2 -5
  21. package/build/moneyInput/MoneyInput.js.map +1 -1
  22. package/build/moneyInput/MoneyInput.mjs +1 -4
  23. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  24. package/build/phoneNumberInput/PhoneNumberInput.js +2 -5
  25. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  26. package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -4
  27. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  28. package/build/styles/inputs/{SelectInput/SelectInput.css → SelectInput.css} +70 -65
  29. package/build/styles/main.css +70 -65
  30. package/build/types/inputs/{SelectInput/SelectInput.types.d.ts → SelectInput.d.ts} +7 -10
  31. package/build/types/inputs/SelectInput.d.ts.map +1 -0
  32. package/build/types/inputs/SelectInput.messages.d.ts.map +1 -0
  33. package/package.json +2 -2
  34. package/src/inputs/{SelectInput/SelectInput.css → SelectInput.css} +70 -65
  35. package/src/inputs/{SelectInput/SelectInput.docs.mdx → SelectInput.docs.mdx} +1 -0
  36. package/src/inputs/SelectInput.less +219 -0
  37. package/src/inputs/{SelectInput/SelectInput.story.tsx → SelectInput.story.tsx} +7 -7
  38. package/src/inputs/SelectInput.tsx +1209 -0
  39. package/src/main.css +70 -65
  40. package/src/main.less +1 -1
  41. package/build/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.js +0 -26
  42. package/build/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.js.map +0 -1
  43. package/build/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.mjs +0 -24
  44. package/build/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.mjs.map +0 -1
  45. package/build/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.js +0 -54
  46. package/build/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.js.map +0 -1
  47. package/build/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.mjs +0 -52
  48. package/build/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.mjs.map +0 -1
  49. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +0 -41
  50. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +0 -1
  51. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +0 -38
  52. package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +0 -1
  53. package/build/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.js +0 -50
  54. package/build/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.js.map +0 -1
  55. package/build/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.mjs +0 -48
  56. package/build/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.mjs.map +0 -1
  57. package/build/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.js +0 -45
  58. package/build/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.js.map +0 -1
  59. package/build/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.mjs +0 -41
  60. package/build/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.mjs.map +0 -1
  61. package/build/inputs/SelectInput/Options/ItemView/SelectInputItemView.js +0 -50
  62. package/build/inputs/SelectInput/Options/ItemView/SelectInputItemView.js.map +0 -1
  63. package/build/inputs/SelectInput/Options/ItemView/SelectInputItemView.mjs +0 -48
  64. package/build/inputs/SelectInput/Options/ItemView/SelectInputItemView.mjs.map +0 -1
  65. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +0 -48
  66. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +0 -1
  67. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +0 -46
  68. package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +0 -1
  69. package/build/inputs/SelectInput/Options/SelectInputOptions.js +0 -270
  70. package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +0 -1
  71. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +0 -268
  72. package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +0 -1
  73. package/build/inputs/SelectInput/SelectInput.constants.js +0 -6
  74. package/build/inputs/SelectInput/SelectInput.constants.js.map +0 -1
  75. package/build/inputs/SelectInput/SelectInput.constants.mjs +0 -4
  76. package/build/inputs/SelectInput/SelectInput.constants.mjs.map +0 -1
  77. package/build/inputs/SelectInput/SelectInput.helpers.js +0 -115
  78. package/build/inputs/SelectInput/SelectInput.helpers.js.map +0 -1
  79. package/build/inputs/SelectInput/SelectInput.helpers.mjs +0 -109
  80. package/build/inputs/SelectInput/SelectInput.helpers.mjs.map +0 -1
  81. package/build/inputs/SelectInput/SelectInput.js +0 -216
  82. package/build/inputs/SelectInput/SelectInput.js.map +0 -1
  83. package/build/inputs/SelectInput/SelectInput.messages.js.map +0 -1
  84. package/build/inputs/SelectInput/SelectInput.messages.mjs.map +0 -1
  85. package/build/inputs/SelectInput/SelectInput.mjs +0 -210
  86. package/build/inputs/SelectInput/SelectInput.mjs.map +0 -1
  87. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +0 -41
  88. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +0 -1
  89. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +0 -34
  90. package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +0 -1
  91. package/build/styles/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.css +0 -17
  92. package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
  93. package/build/styles/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.css +0 -33
  94. package/build/styles/inputs/SelectInput/Options/ItemView/SelectInputItemView.css +0 -44
  95. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +0 -125
  96. package/build/types/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.d.ts +0 -5
  97. package/build/types/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.d.ts.map +0 -1
  98. package/build/types/inputs/SelectInput/DefaultTrigger/ClearButton/index.d.ts +0 -2
  99. package/build/types/inputs/SelectInput/DefaultTrigger/ClearButton/index.d.ts.map +0 -1
  100. package/build/types/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.d.ts +0 -9
  101. package/build/types/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.d.ts.map +0 -1
  102. package/build/types/inputs/SelectInput/DefaultTrigger/index.d.ts +0 -2
  103. package/build/types/inputs/SelectInput/DefaultTrigger/index.d.ts.map +0 -1
  104. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +0 -9
  105. package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +0 -1
  106. package/build/types/inputs/SelectInput/OptionContent/index.d.ts +0 -3
  107. package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +0 -1
  108. package/build/types/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.d.ts +0 -3
  109. package/build/types/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.d.ts.map +0 -1
  110. package/build/types/inputs/SelectInput/Options/GroupItemView/index.d.ts +0 -2
  111. package/build/types/inputs/SelectInput/Options/GroupItemView/index.d.ts.map +0 -1
  112. package/build/types/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.d.ts +0 -10
  113. package/build/types/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.d.ts.map +0 -1
  114. package/build/types/inputs/SelectInput/Options/ItemView/Option/index.d.ts +0 -2
  115. package/build/types/inputs/SelectInput/Options/ItemView/Option/index.d.ts.map +0 -1
  116. package/build/types/inputs/SelectInput/Options/ItemView/SelectInputItemView.d.ts +0 -3
  117. package/build/types/inputs/SelectInput/Options/ItemView/SelectInputItemView.d.ts.map +0 -1
  118. package/build/types/inputs/SelectInput/Options/ItemView/index.d.ts +0 -2
  119. package/build/types/inputs/SelectInput/Options/ItemView/index.d.ts.map +0 -1
  120. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +0 -6
  121. package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +0 -1
  122. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +0 -2
  123. package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +0 -1
  124. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +0 -15
  125. package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +0 -1
  126. package/build/types/inputs/SelectInput/Options/index.d.ts +0 -2
  127. package/build/types/inputs/SelectInput/Options/index.d.ts.map +0 -1
  128. package/build/types/inputs/SelectInput/SelectInput.constants.d.ts +0 -2
  129. package/build/types/inputs/SelectInput/SelectInput.constants.d.ts.map +0 -1
  130. package/build/types/inputs/SelectInput/SelectInput.d.ts +0 -3
  131. package/build/types/inputs/SelectInput/SelectInput.d.ts.map +0 -1
  132. package/build/types/inputs/SelectInput/SelectInput.helpers.d.ts +0 -28
  133. package/build/types/inputs/SelectInput/SelectInput.helpers.d.ts.map +0 -1
  134. package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +0 -1
  135. package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +0 -1
  136. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +0 -15
  137. package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +0 -1
  138. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +0 -3
  139. package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +0 -1
  140. package/build/types/inputs/SelectInput/index.d.ts +0 -5
  141. package/build/types/inputs/SelectInput/index.d.ts.map +0 -1
  142. package/src/inputs/SelectInput/DefaultTrigger/ClearButton/SelectInputClearButton.tsx +0 -25
  143. package/src/inputs/SelectInput/DefaultTrigger/ClearButton/index.ts +0 -1
  144. package/src/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.css +0 -17
  145. package/src/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.less +0 -15
  146. package/src/inputs/SelectInput/DefaultTrigger/SelectInputDefaultTrigger.tsx +0 -56
  147. package/src/inputs/SelectInput/DefaultTrigger/index.ts +0 -1
  148. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
  149. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +0 -38
  150. package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +0 -67
  151. package/src/inputs/SelectInput/OptionContent/index.ts +0 -5
  152. package/src/inputs/SelectInput/Options/GroupItemView/SelectInputGroupItemView.tsx +0 -53
  153. package/src/inputs/SelectInput/Options/GroupItemView/index.ts +0 -1
  154. package/src/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.css +0 -33
  155. package/src/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.less +0 -32
  156. package/src/inputs/SelectInput/Options/ItemView/Option/SelectInputOption.tsx +0 -51
  157. package/src/inputs/SelectInput/Options/ItemView/Option/index.ts +0 -5
  158. package/src/inputs/SelectInput/Options/ItemView/SelectInputItemView.css +0 -44
  159. package/src/inputs/SelectInput/Options/ItemView/SelectInputItemView.less +0 -14
  160. package/src/inputs/SelectInput/Options/ItemView/SelectInputItemView.tsx +0 -37
  161. package/src/inputs/SelectInput/Options/ItemView/index.ts +0 -1
  162. package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +0 -55
  163. package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +0 -1
  164. package/src/inputs/SelectInput/Options/SelectInputOptions.css +0 -125
  165. package/src/inputs/SelectInput/Options/SelectInputOptions.less +0 -78
  166. package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +0 -372
  167. package/src/inputs/SelectInput/Options/index.ts +0 -1
  168. package/src/inputs/SelectInput/SelectInput.constants.ts +0 -1
  169. package/src/inputs/SelectInput/SelectInput.helpers.ts +0 -152
  170. package/src/inputs/SelectInput/SelectInput.less +0 -40
  171. package/src/inputs/SelectInput/SelectInput.test.tsx +0 -606
  172. package/src/inputs/SelectInput/SelectInput.tsx +0 -247
  173. package/src/inputs/SelectInput/SelectInput.types.ts +0 -127
  174. package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +0 -39
  175. package/src/inputs/SelectInput/TriggerButton/index.ts +0 -5
  176. package/src/inputs/SelectInput/index.ts +0 -13
  177. /package/build/inputs/{SelectInput/SelectInput.messages.js → SelectInput.messages.js} +0 -0
  178. /package/build/inputs/{SelectInput/SelectInput.messages.mjs → SelectInput.messages.mjs} +0 -0
  179. /package/build/types/inputs/{SelectInput/SelectInput.messages.d.ts → SelectInput.messages.d.ts} +0 -0
  180. /package/src/inputs/{SelectInput/SelectInput.messages.ts → SelectInput.messages.ts} +0 -0
@@ -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,67 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { useContext, createContext } from 'react';
3
-
4
- export const SelectInputOptionContentWithinTriggerContext = createContext(false);
5
-
6
- export interface SelectInputOptionContentProps {
7
- title: string;
8
- note?: string;
9
- description?: string;
10
- icon?: React.ReactNode;
11
- }
12
-
13
- export function SelectInputOptionContent({
14
- title,
15
- note,
16
- description,
17
- icon,
18
- }: SelectInputOptionContentProps) {
19
- const withinTrigger = useContext(SelectInputOptionContentWithinTriggerContext);
20
-
21
- return (
22
- <div
23
- className={clsx(
24
- 'np-select-input-option-content-container',
25
- (note || description) && 'np-text-body-large',
26
- )}
27
- >
28
- {icon ? (
29
- <div
30
- className={clsx(
31
- 'np-select-input-option-content-icon',
32
- !withinTrigger && 'np-select-input-option-content-icon--not-within-trigger',
33
- )}
34
- >
35
- {icon}
36
- </div>
37
- ) : null}
38
-
39
- <div className="np-select-input-option-content-text">
40
- <div
41
- className={clsx(
42
- 'np-select-input-option-content-text-line-1',
43
- withinTrigger && 'np-select-input-option-content-text-within-trigger',
44
- )}
45
- >
46
- <div className="d-inline">{title}</div>
47
- {note ? (
48
- <span className="np-select-input-option-content-text-secondary np-text-body-default">
49
- {note}
50
- </span>
51
- ) : null}
52
- </div>
53
-
54
- {description ? (
55
- <div
56
- className={clsx(
57
- 'np-select-input-option-content-text-secondary np-text-body-default',
58
- withinTrigger && 'np-select-input-option-content-text-within-trigger',
59
- )}
60
- >
61
- {description}
62
- </div>
63
- ) : null}
64
- </div>
65
- </div>
66
- );
67
- }
@@ -1,5 +0,0 @@
1
- export {
2
- SelectInputOptionContent,
3
- SelectInputOptionContentWithinTriggerContext,
4
- } from './SelectInputOptionContent';
5
- export type { SelectInputOptionContentProps } from './SelectInputOptionContent';
@@ -1,53 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { useId } from 'react';
3
- import Header from '../../../../header';
4
- import Section from '../../../../section';
5
- import type { SelectInputGroupItemViewProps } from '../../SelectInput.types';
6
- import { SelectInputItemView } from '../ItemView';
7
-
8
- export function SelectInputGroupItemView<T = string>({
9
- item,
10
- renderValue,
11
- needle,
12
- }: SelectInputGroupItemViewProps<T>) {
13
- const headerId = useId();
14
-
15
- const header = (
16
- <Header
17
- as="header"
18
- role="none"
19
- id={headerId}
20
- title={item.label}
21
- // @ts-expect-error when we migrate ActionButton to new Button this should be sorted
22
- action={
23
- item.action && {
24
- text: item.action.label,
25
- onClick: item.action.onClick,
26
- }
27
- }
28
- className="np-select-input-group-item-header p-x-1"
29
- />
30
- );
31
-
32
- return (
33
- // An empty container may be rendered when no options match `needle`
34
- // However, pre-filtering would result in worse performance overall
35
- <Section
36
- as="section"
37
- role="group"
38
- aria-labelledby={headerId}
39
- className={clsx('m-y-0', needle === null && 'np-select-input-group-item--without-needle')}
40
- >
41
- {needle == null ? header : null}
42
- {item.options.map((option, index) => (
43
- <SelectInputItemView
44
- // eslint-disable-next-line react/no-array-index-key
45
- key={index}
46
- item={option}
47
- renderValue={renderValue}
48
- needle={needle}
49
- />
50
- ))}
51
- </Section>
52
- );
53
- }
@@ -1 +0,0 @@
1
- export { SelectInputGroupItemView } from './SelectInputGroupItemView';
@@ -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 {
29
- flex: 1;
30
- }
31
- .np-select-input-option-check--not-selected {
32
- visibility: hidden;
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 {
25
- flex: 1;
26
- }
27
-
28
- .np-select-input-option-check {
29
- &--not-selected {
30
- visibility: hidden;
31
- }
32
- }
@@ -1,51 +0,0 @@
1
- import { useContext, createContext } from 'react';
2
- import { ListboxOption } from '@headlessui/react';
3
- import { Check } from '@transferwise/icons';
4
- import { clsx } from 'clsx';
5
-
6
- export const SelectInputItemsCountContext = createContext<number | undefined>(undefined);
7
- export const SelectInputItemPositionContext = createContext<number | undefined>(undefined);
8
-
9
- interface SelectInputOptionProps<T = string> {
10
- value: T;
11
- disabled?: boolean;
12
- children?: React.ReactNode;
13
- }
14
-
15
- export function SelectInputOption<T = string>({
16
- value,
17
- disabled,
18
- children,
19
- }: SelectInputOptionProps<T>) {
20
- const itemsCount = useContext(SelectInputItemsCountContext);
21
- const itemPosition = useContext(SelectInputItemPositionContext);
22
- return (
23
- <ListboxOption
24
- as="div"
25
- value={value}
26
- aria-setsize={itemsCount}
27
- aria-posinset={itemPosition}
28
- disabled={disabled}
29
- className={({ active, disabled: uiDisabled }) =>
30
- clsx(
31
- 'np-select-input-option-container np-text-body-large',
32
- active && 'np-select-input-option-container--active',
33
- uiDisabled && 'np-select-input-option-container--disabled',
34
- )
35
- }
36
- >
37
- {({ selected }) => (
38
- <>
39
- <div className="np-select-input-option">{children}</div>
40
- <Check
41
- size={16}
42
- className={clsx(
43
- 'np-select-input-option-check',
44
- !selected && 'np-select-input-option-check--not-selected',
45
- )}
46
- />
47
- </>
48
- )}
49
- </ListboxOption>
50
- );
51
- }
@@ -1,5 +0,0 @@
1
- export {
2
- SelectInputOption,
3
- SelectInputItemsCountContext,
4
- SelectInputItemPositionContext,
5
- } from './SelectInputOption';
@@ -1,44 +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 {
29
- flex: 1;
30
- }
31
- .np-select-input-option-check--not-selected {
32
- visibility: hidden;
33
- }
34
- .np-select-input-group-item--without-needle:first-child {
35
- margin-top: calc(-1 * 8px);
36
- margin-top: calc(-1 * var(--size-8));
37
- }
38
- .np-select-input-group-item-header {
39
- position: sticky;
40
- top: 0px;
41
- z-index: 10;
42
- background-color: #ffffff;
43
- background-color: var(--color-background-elevated);
44
- }
@@ -1,14 +0,0 @@
1
- @import "./Option/SelectInputOption.less";
2
-
3
- .np-select-input-group-item {
4
- &--without-needle:first-child {
5
- margin-top: calc(-1 * var(--size-8));
6
- }
7
-
8
- &-header {
9
- position: sticky;
10
- top: 0px;
11
- z-index: 10;
12
- background-color: var(--color-background-elevated);
13
- }
14
- }
@@ -1,37 +0,0 @@
1
- import Divider from '../../../../divider';
2
- import { selectInputOptionItemIncludesNeedle } from '../../SelectInput.helpers';
3
- import type { SelectInputItemViewProps } from '../../SelectInput.types';
4
- import { SelectInputGroupItemView } from '../GroupItemView';
5
- import { SelectInputOption } from './Option';
6
-
7
- export function SelectInputItemView<T = string>({
8
- item,
9
- renderValue,
10
- needle,
11
- }: SelectInputItemViewProps<T>) {
12
- switch (item.type) {
13
- case 'option': {
14
- if (
15
- item.value != null &&
16
- (needle == null || selectInputOptionItemIncludesNeedle(item, needle))
17
- ) {
18
- return (
19
- <SelectInputOption value={item.value} disabled={item.disabled}>
20
- {renderValue(item.value, false)}
21
- </SelectInputOption>
22
- );
23
- }
24
- break;
25
- }
26
- case 'group': {
27
- return <SelectInputGroupItemView item={item} renderValue={renderValue} needle={needle} />;
28
- }
29
- case 'separator': {
30
- if (needle == null) {
31
- return <Divider isContent level="subsection" className="m-y-1" />;
32
- }
33
- break;
34
- }
35
- }
36
- return null;
37
- }
@@ -1 +0,0 @@
1
- export { SelectInputItemView } from './SelectInputItemView';
@@ -1,55 +0,0 @@
1
- import { forwardRef, useEffect } from 'react';
2
- import { useEffectEvent } from '../../../../common/hooks/useEffectEvent';
3
-
4
- interface SelectInputOptionsContainerProps extends React.ComponentPropsWithRef<'div'> {
5
- onAriaActiveDescendantChange: (value: React.AriaAttributes['aria-activedescendant']) => void;
6
- }
7
-
8
- export const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContainer(
9
- {
10
- 'aria-orientation': ariaOrientation,
11
- 'aria-activedescendant': ariaActiveDescendant,
12
- role,
13
- tabIndex,
14
- onAriaActiveDescendantChange,
15
- onKeyDown,
16
- ...restProps
17
- }: SelectInputOptionsContainerProps,
18
- ref: React.ForwardedRef<HTMLDivElement | null>,
19
- ) {
20
- const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
21
- useEffect(() => {
22
- handleAriaActiveDescendantChange(ariaActiveDescendant);
23
- }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
24
-
25
- return (
26
- <div
27
- ref={ref}
28
- role="none"
29
- onKeyDown={(event) => {
30
- // Prevent confirmation close without an active item
31
- if (event.key === 'Enter' && ariaActiveDescendant == null) {
32
- return;
33
- }
34
-
35
- // Required to make ListBox focusable
36
- if (event.key === 'Tab') {
37
- return;
38
- }
39
-
40
- // Prevent absorbing Escape early
41
- if (event.key === 'Escape') {
42
- onKeyDown?.({
43
- ...event,
44
- preventDefault: () => {},
45
- stopPropagation: () => {},
46
- });
47
- return;
48
- }
49
-
50
- onKeyDown?.(event);
51
- }}
52
- {...restProps}
53
- />
54
- );
55
- });
@@ -1 +0,0 @@
1
- export { SelectInputOptionsContainer } from './SelectInputOptionsContainer';
@@ -1,125 +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 {
29
- flex: 1;
30
- }
31
- .np-select-input-option-check--not-selected {
32
- visibility: hidden;
33
- }
34
- .np-select-input-group-item--without-needle:first-child {
35
- margin-top: calc(-1 * 8px);
36
- margin-top: calc(-1 * var(--size-8));
37
- }
38
- .np-select-input-group-item-header {
39
- position: sticky;
40
- top: 0px;
41
- z-index: 10;
42
- background-color: #ffffff;
43
- background-color: var(--color-background-elevated);
44
- }
45
- .np-select-input-options-status {
46
- display: flex;
47
- align-items: center;
48
- -moz-column-gap: 8px;
49
- column-gap: 8px;
50
- -moz-column-gap: var(--size-8);
51
- column-gap: var(--size-8);
52
- padding: 8px 24px 0px;
53
- padding: var(--size-8) var(--size-24) 0px;
54
- }
55
- .np-select-input-options-status-icon {
56
- padding: 0 4px;
57
- padding: 0 var(--size-4);
58
- color: #768e9c;
59
- color: var(--color-content-tertiary);
60
- }
61
- .np-select-input-query-container {
62
- display: flex;
63
- flex-direction: column;
64
- padding: 8px;
65
- padding: var(--size-8);
66
- }
67
- .np-select-input-listbox-container {
68
- position: relative;
69
- height: var(--initial-height);
70
- scroll-padding-top: 8px;
71
- scroll-padding-top: var(--size-8);
72
- scroll-padding-bottom: 8px;
73
- scroll-padding-bottom: var(--size-8);
74
- overflow-y: auto;
75
- }
76
- @media (min-width: 576px) {
77
- .np-select-input-listbox-container {
78
- height: auto;
79
- }
80
- }
81
- .np-select-input-listbox-container--virtualized {
82
- /* The wrapping element shrinks this as needed */
83
- height: 100vh;
84
- }
85
- .np-select-input-listbox-container--has-group {
86
- scroll-padding-top: 32px;
87
- scroll-padding-top: var(--size-32);
88
- }
89
- .np-select-input-listbox {
90
- border-radius: 10px;
91
- border-radius: var(--radius-small);
92
- padding: 8px;
93
- padding: var(--size-8);
94
- --ring-outline-offset: calc(-1 * var(--ring-outline-width));
95
- }
96
- .np-select-input-listbox:focus {
97
- outline: none;
98
- }
99
- .np-select-input-listbox:focus-visible {
100
- outline: var(--ring-outline-color) solid var(--ring-outline-width);
101
- outline-offset: var(--ring-outline-offset);
102
- }
103
- .np-select-input-listbox-container--virtualized .np-select-input-listbox {
104
- /* Adopted from `VList` in virtua: https://github.com/inokawa/virtua/blob/7f6ed5b37df6b480d4ff350f3960067c5b3519d2/src/react/VList.tsx#L113-L116 */
105
- overflow-y: auto;
106
- contain: strict;
107
- height: 100%;
108
- }
109
- .np-select-input-options-container {
110
- display: flex;
111
- height: 100%;
112
- flex-direction: column;
113
- }
114
- .np-select-input-options-container:focus {
115
- outline: none;
116
- }
117
- @media (min-width: 576px) {
118
- .np-select-input-options-container {
119
- max-height: 28rem /* 448px */;
120
- }
121
- }
122
- .np-select-input-footer {
123
- padding: 4px 24px 16px;
124
- padding: var(--size-4) var(--size-24) var(--size-16);
125
- }
@@ -1,78 +0,0 @@
1
- @import (reference) "../../../../node_modules/@transferwise/neptune-css/src/less/ring.less";
2
- @import "./ItemView/SelectInputItemView.less";
3
-
4
- .np-select-input-options-status {
5
- display: flex;
6
- align-items: center;
7
- column-gap: var(--size-8);
8
- padding: var(--size-8) var(--size-24) 0px;
9
- }
10
-
11
- .np-select-input-options-status-icon {
12
- padding: 0 var(--size-4);
13
- color: var(--color-content-tertiary);
14
- }
15
-
16
- .np-select-input-query-container {
17
- display: flex;
18
- flex-direction: column;
19
- padding: var(--size-8);
20
- }
21
-
22
- .np-select-input-listbox-container {
23
- position: relative;
24
- height: var(--initial-height);
25
- scroll-padding-top: var(--size-8);
26
- scroll-padding-bottom: var(--size-8);
27
- overflow-y: auto;
28
-
29
- @media (--screen-sm) {
30
- & {
31
- height: auto;
32
- }
33
- }
34
-
35
- &--virtualized {
36
- /* The wrapping element shrinks this as needed */
37
- height: 100vh;
38
- }
39
-
40
- &--has-group {
41
- scroll-padding-top: var(--size-32);
42
- }
43
- }
44
-
45
- .np-select-input-listbox {
46
- border-radius: var(--radius-small);
47
- padding: var(--size-8);
48
-
49
- .focus-ring();
50
- --ring-outline-offset: calc(-1 * var(--ring-outline-width));
51
-
52
- .np-select-input-listbox-container--virtualized & {
53
- /* Adopted from `VList` in virtua: https://github.com/inokawa/virtua/blob/7f6ed5b37df6b480d4ff350f3960067c5b3519d2/src/react/VList.tsx#L113-L116 */
54
- overflow-y: auto;
55
- contain: strict;
56
- height: 100%;
57
- }
58
- }
59
-
60
- .np-select-input-options-container {
61
- display: flex;
62
- height: 100%;
63
- flex-direction: column;
64
-
65
- &:focus {
66
- outline: none;
67
- }
68
-
69
- @media (--screen-sm) {
70
- & {
71
- max-height: 28rem /* 448px */;
72
- }
73
- }
74
- }
75
-
76
- .np-select-input-footer {
77
- padding: var(--size-4) var(--size-24) var(--size-16);
78
- }