@transferwise/components 46.1.0 → 46.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/README.md +3 -5
  2. package/build/index.esm.js +44 -23
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +44 -23
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +5494 -1
  7. package/build/styles/accordion/Accordion.css +60 -1
  8. package/build/styles/actionButton/ActionButton.css +53 -1
  9. package/build/styles/avatar/Avatar.css +205 -1
  10. package/build/styles/badge/Badge.css +68 -1
  11. package/build/styles/button/Button.css +20 -1
  12. package/build/styles/card/Card.css +100 -1
  13. package/build/styles/checkboxButton/CheckboxButton.css +24 -1
  14. package/build/styles/chips/Chip.css +190 -1
  15. package/build/styles/circularButton/CircularButton.css +211 -1
  16. package/build/styles/common/Option/Option.css +100 -1
  17. package/build/styles/common/RadioButton/RadioButton.css +4 -1
  18. package/build/styles/common/bottomSheet/BottomSheet.css +53 -1
  19. package/build/styles/common/card/Card.css +49 -1
  20. package/build/styles/common/closeButton/CloseButton.css +79 -1
  21. package/build/styles/common/panel/Panel.css +73 -1
  22. package/build/styles/criticalBanner/CriticalCommsBanner.css +76 -1
  23. package/build/styles/dateInput/DateInput.css +3 -1
  24. package/build/styles/dateLookup/DateLookup.css +98 -1
  25. package/build/styles/dateLookup/dateTrigger/DateTrigger.css +68 -1
  26. package/build/styles/decision/Decision.css +93 -1
  27. package/build/styles/definitionList/DefinitionList.css +53 -1
  28. package/build/styles/dimmer/Dimmer.css +70 -1
  29. package/build/styles/drawer/Drawer.css +100 -1
  30. package/build/styles/dropFade/DropFade.css +19 -1
  31. package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +5 -1
  32. package/build/styles/emphasis/Emphasis.css +31 -1
  33. package/build/styles/flowNavigation/FlowNavigation.css +72 -1
  34. package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +21 -1
  35. package/build/styles/flowNavigation/backButton/BackButton.css +32 -1
  36. package/build/styles/header/Header.css +28 -1
  37. package/build/styles/image/Image.css +13 -1
  38. package/build/styles/info/Info.css +32 -1
  39. package/build/styles/inputs/Input.css +105 -1
  40. package/build/styles/inputs/InputGroup.css +62 -1
  41. package/build/styles/inputs/SelectInput.css +374 -1
  42. package/build/styles/inputs/TextArea.css +109 -1
  43. package/build/styles/instructionsList/InstructionsList.css +22 -1
  44. package/build/styles/link/Link.css +15 -1
  45. package/build/styles/listItem/ListItem.css +6 -1
  46. package/build/styles/loader/Loader.css +313 -1
  47. package/build/styles/logo/Logo.css +26 -1
  48. package/build/styles/main.css +5494 -1
  49. package/build/styles/modal/Modal.css +155 -1
  50. package/build/styles/moneyInput/MoneyInput.css +66 -1
  51. package/build/styles/navigationOption/NavigationOption.css +69 -1
  52. package/build/styles/navigationOptionsList/NavigationOptionsList.css +13 -1
  53. package/build/styles/nudge/Nudge.css +179 -1
  54. package/build/styles/overlayHeader/OverlayHeader.css +15 -1
  55. package/build/styles/phoneNumberInput/PhoneNumberInput.css +23 -1
  56. package/build/styles/popover/Popover.css +43 -1
  57. package/build/styles/progress/Progress.css +43 -1
  58. package/build/styles/progressBar/ProgressBar.css +14 -1
  59. package/build/styles/promoCard/PromoCard.css +186 -1
  60. package/build/styles/section/Section.css +10 -1
  61. package/build/styles/select/Select.css +309 -1
  62. package/build/styles/slidingPanel/SlidingPanel.css +105 -1
  63. package/build/styles/snackbar/Snackbar.css +93 -1
  64. package/build/styles/statusIcon/StatusIcon.css +78 -1
  65. package/build/styles/stepper/Stepper.css +108 -1
  66. package/build/styles/summary/Summary.css +81 -1
  67. package/build/styles/switch/Switch.css +68 -1
  68. package/build/styles/tabs/Tabs.css +121 -1
  69. package/build/styles/tile/Tile.css +55 -1
  70. package/build/styles/tooltip/Tooltip.css +50 -1
  71. package/build/styles/typeahead/Typeahead.css +183 -1
  72. package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +9 -1
  73. package/build/styles/upload/Upload.css +15 -1
  74. package/build/styles/uploadInput/UploadInput.css +71 -1
  75. package/build/styles/uploadInput/uploadButton/UploadButton.css +49 -1
  76. package/build/styles/uploadInput/uploadItem/UploadItem.css +74 -1
  77. package/build/types/accordion/Accordion.d.ts +1 -0
  78. package/build/types/accordion/Accordion.d.ts.map +1 -1
  79. package/build/types/accordion/AccordionItem/AccordionItem.d.ts +3 -0
  80. package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
  81. package/build/types/inputs/SelectInput.d.ts +6 -3
  82. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  83. package/build/types/inputs/_BottomSheet.d.ts +2 -1
  84. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  85. package/build/types/inputs/_Popover.d.ts +2 -1
  86. package/build/types/inputs/_Popover.d.ts.map +1 -1
  87. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  88. package/build/types/select/option/Option.d.ts.map +1 -1
  89. package/build/types/typeahead/util/highlight.d.ts +1 -1
  90. package/build/types/typeahead/util/highlight.d.ts.map +1 -1
  91. package/package.json +5 -11
  92. package/src/accordion/Accordion.css +60 -1
  93. package/src/accordion/Accordion.story.tsx +8 -0
  94. package/src/accordion/Accordion.tsx +2 -0
  95. package/src/accordion/AccordionItem/AccordionItem.tsx +5 -0
  96. package/src/actionButton/ActionButton.css +53 -1
  97. package/src/avatar/Avatar.css +205 -1
  98. package/src/badge/Badge.css +68 -1
  99. package/src/button/Button.css +20 -1
  100. package/src/card/Card.css +100 -1
  101. package/src/checkboxButton/CheckboxButton.css +24 -1
  102. package/src/chips/Chip.css +190 -1
  103. package/src/circularButton/CircularButton.css +211 -1
  104. package/src/common/Option/Option.css +100 -1
  105. package/src/common/RadioButton/RadioButton.css +4 -1
  106. package/src/common/bottomSheet/BottomSheet.css +53 -1
  107. package/src/common/card/Card.css +49 -1
  108. package/src/common/closeButton/CloseButton.css +79 -1
  109. package/src/common/panel/Panel.css +73 -1
  110. package/src/criticalBanner/CriticalCommsBanner.css +76 -1
  111. package/src/dateInput/DateInput.css +3 -1
  112. package/src/dateLookup/DateLookup.css +98 -1
  113. package/src/dateLookup/DateLookup.story.js +12 -8
  114. package/src/dateLookup/dateTrigger/DateTrigger.css +68 -1
  115. package/src/decision/Decision.css +93 -1
  116. package/src/definitionList/DefinitionList.css +53 -1
  117. package/src/dimmer/Dimmer.css +70 -1
  118. package/src/drawer/Drawer.css +100 -1
  119. package/src/dropFade/DropFade.css +19 -1
  120. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +5 -1
  121. package/src/emphasis/Emphasis.css +31 -1
  122. package/src/flowNavigation/FlowNavigation.css +72 -1
  123. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +21 -1
  124. package/src/flowNavigation/backButton/BackButton.css +32 -1
  125. package/src/header/Header.css +28 -1
  126. package/src/image/Image.css +13 -1
  127. package/src/info/Info.css +32 -1
  128. package/src/inputs/Input.css +105 -1
  129. package/src/inputs/InputGroup.css +62 -1
  130. package/src/inputs/SelectInput.css +374 -1
  131. package/src/inputs/SelectInput.spec.tsx +52 -3
  132. package/src/inputs/SelectInput.story.tsx +1 -1
  133. package/src/inputs/SelectInput.tsx +30 -15
  134. package/src/inputs/TextArea.css +109 -1
  135. package/src/inputs/_BottomSheet.tsx +3 -0
  136. package/src/inputs/_Popover.tsx +3 -0
  137. package/src/instructionsList/InstructionsList.css +22 -1
  138. package/src/link/Link.css +15 -1
  139. package/src/listItem/ListItem.css +6 -1
  140. package/src/loader/Loader.css +313 -1
  141. package/src/logo/Logo.css +26 -1
  142. package/src/main.css +5494 -1
  143. package/src/modal/Modal.css +155 -1
  144. package/src/moneyInput/MoneyInput.css +66 -1
  145. package/src/moneyInput/MoneyInput.js +3 -1
  146. package/src/moneyInput/MoneyInput.spec.js +4 -1
  147. package/src/navigationOption/NavigationOption.css +69 -1
  148. package/src/navigationOptionsList/NavigationOptionsList.css +13 -1
  149. package/src/nudge/Nudge.css +179 -1
  150. package/src/overlayHeader/OverlayHeader.css +15 -1
  151. package/src/phoneNumberInput/PhoneNumberInput.css +23 -1
  152. package/src/popover/Popover.css +43 -1
  153. package/src/progress/Progress.css +43 -1
  154. package/src/progressBar/ProgressBar.css +14 -1
  155. package/src/promoCard/PromoCard.css +186 -1
  156. package/src/section/Section.css +10 -1
  157. package/src/select/Select.css +309 -1
  158. package/src/select/Select.less +1 -8
  159. package/src/select/option/Option.spec.js +3 -21
  160. package/src/select/option/Option.tsx +2 -7
  161. package/src/slidingPanel/SlidingPanel.css +105 -1
  162. package/src/snackbar/Snackbar.css +93 -1
  163. package/src/statusIcon/StatusIcon.css +78 -1
  164. package/src/stepper/Stepper.css +108 -1
  165. package/src/summary/Summary.css +81 -1
  166. package/src/switch/Switch.css +68 -1
  167. package/src/tabs/Tabs.css +121 -1
  168. package/src/tile/Tile.css +55 -1
  169. package/src/tooltip/Tooltip.css +50 -1
  170. package/src/typeahead/Typeahead.css +183 -1
  171. package/src/typeahead/typeaheadOption/TypeaheadOption.css +9 -1
  172. package/src/typeahead/typeaheadOption/TypeaheadOption.js +3 -3
  173. package/src/typeahead/util/highlight.js +1 -1
  174. package/src/upload/Upload.css +15 -1
  175. package/src/uploadInput/UploadInput.css +71 -1
  176. package/src/uploadInput/uploadButton/UploadButton.css +49 -1
  177. package/src/uploadInput/uploadItem/UploadItem.css +74 -1
@@ -1 +1,374 @@
1
- .np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.3s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);overflow:hidden;width:var(--width);z-index:1060}.np-popover-v2-container--size-md{min-width:20rem}.np-popover-v2-container--size-lg{min-width:24rem}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-options-status{align-items:center;-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex;padding:8px 24px 0;padding:var(--size-8) var(--size-24) 0}.np-select-input-options-status-icon{color:#768e9c;color:var(--color-content-tertiary);padding:0 4px;padding:0 var(--size-4)}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8)}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{--ring-outline-offset:calc(var(--ring-outline-width)*-1);border-radius:10px;border-radius:var(--radius-small);padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-listbox:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color:var(--color-interactive-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);cursor:default;display:flex;padding:12px 16px;padding:var(--size-12) var(--size-16);-webkit-user-select:none;-moz-user-select:none;user-select:none}.np-select-input-option-container--active{box-shadow:inset 0 0 0 1px #c9cbce;box-shadow:inset 0 0 0 1px var(--color-interactive-secondary)}.np-select-input-option-container--disabled{opacity:.45}.np-select-input-option-check--not-selected{visibility:hidden}.np-select-input-option{flex:1}.np-select-input-option-content-container{align-items:center;color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex}.np-select-input-option-content-icon{display:flex}.np-select-input-option-content-icon--not-within-trigger{align-self:flex-start}.np-select-input-option-content-text{display:flex;flex:1;flex-direction:column;overflow:hidden}.np-select-input-option-content-text-primary{font:inherit}.np-select-input-option-content-text-secondary{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-option-content-text-within-trigger{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-option-content-text-line-1>:not([hidden])~:not([hidden]){margin-left:8px;margin-left:var(--size-8);margin-right:8px;margin-right:var(--size-8)}.np-select-input-footer{padding:4px 24px 16px;padding:var(--size-4) var(--size-24) var(--size-16)}.np-select-input-addon-container{align-items:center;display:inline-flex;pointer-events:none}.np-select-input-addon-container,.np-select-input-addon-container>:not([hidden])~:not([hidden]){margin-inline-start:4px;margin-inline-start:var(--size-4)}.np-select-input-addon{align-items:center;background:none;border-radius:.125rem;border-width:0;display:inline-flex;height:24px;height:var(--size-24);justify-content:center;width:24px;width:var(--size-24)}.np-select-input-addon--interactive{color:#c9cbce;color:var(--color-interactive-secondary);pointer-events:auto}.np-select-input-addon--interactive:hover{color:#b5b7ba;color:var(--color-interactive-secondary-hover)}.np-select-input-addon--interactive:focus{outline:none}.np-select-input-addon--interactive:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-addon-separator{border-inline-start:1px solid #0000001a;border-inline-start:1px solid var(--color-border-neutral);height:24px;height:var(--size-24)}
1
+ .np-bottom-sheet-v2-container {
2
+ position: relative;
3
+ z-index: 1060;
4
+ }
5
+ .np-bottom-sheet-v2-backdrop-container--enter,
6
+ .np-bottom-sheet-v2-backdrop-container--leave {
7
+ transition-property: opacity;
8
+ transition-timing-function: ease-out;
9
+ transition-duration: 300ms;
10
+ }
11
+ .np-bottom-sheet-v2-backdrop-container--enter-from,
12
+ .np-bottom-sheet-v2-backdrop-container--leave-to {
13
+ opacity: 0;
14
+ }
15
+ .np-bottom-sheet-v2-backdrop {
16
+ position: fixed;
17
+ inset: 0px;
18
+ background-color: #37517e;
19
+ background-color: var(--color-content-primary);
20
+ opacity: 0.4;
21
+ }
22
+ .np-bottom-sheet-v2 {
23
+ position: fixed;
24
+ inset: 0px;
25
+ display: flex;
26
+ flex-direction: column;
27
+ justify-content: flex-end;
28
+ padding-left: 8px;
29
+ padding-left: var(--size-8);
30
+ padding-right: 8px;
31
+ padding-right: var(--size-8);
32
+ padding-top: 64px;
33
+ padding-top: var(--size-64);
34
+ }
35
+ .np-bottom-sheet-v2-content {
36
+ max-height: 100%;
37
+ }
38
+ .np-bottom-sheet-v2-content--enter,
39
+ .np-bottom-sheet-v2-content--leave {
40
+ transition-property: transform;
41
+ transition-timing-function: ease-out;
42
+ transition-duration: 300ms;
43
+ }
44
+ @media (prefers-reduced-motion: reduce) {
45
+ .np-bottom-sheet-v2-content--enter,
46
+ .np-bottom-sheet-v2-content--leave {
47
+ transition-property: opacity;
48
+ }
49
+ }
50
+ @media (prefers-reduced-motion: no-preference) {
51
+ .np-bottom-sheet-v2-content--enter-from,
52
+ .np-bottom-sheet-v2-content--leave-to {
53
+ transform: translateY(100%);
54
+ }
55
+ }
56
+ @media (prefers-reduced-motion: reduce) {
57
+ .np-bottom-sheet-v2-content--enter-from,
58
+ .np-bottom-sheet-v2-content--leave-to {
59
+ opacity: 0;
60
+ }
61
+ }
62
+ .np-bottom-sheet-v2-content-inner-container {
63
+ display: flex;
64
+ height: 100%;
65
+ flex-direction: column;
66
+ border-top-left-radius: 32px;
67
+ /* TODO: Tokenize */
68
+ border-top-right-radius: 32px;
69
+ /* TODO: Tokenize */
70
+ background-color: #ffffff;
71
+ background-color: var(--color-background-elevated);
72
+ box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
73
+ }
74
+ .np-bottom-sheet-v2-content-inner-container:focus {
75
+ outline: none;
76
+ }
77
+ .np-bottom-sheet-v2-header {
78
+ align-self: flex-end;
79
+ padding: 16px;
80
+ padding: var(--size-16);
81
+ }
82
+ .np-bottom-sheet-v2-content-inner {
83
+ padding-top: 0px;
84
+ display: grid;
85
+ grid-row-gap: 8px;
86
+ grid-row-gap: var(--size-8);
87
+ row-gap: 8px;
88
+ row-gap: var(--size-8);
89
+ overflow-y: auto;
90
+ grid-template-rows: repeat(1, minmax(0, 1fr));
91
+ }
92
+ .np-bottom-sheet-v2-content-inner--has-title {
93
+ grid-template-rows: auto 1fr;
94
+ }
95
+ .np-bottom-sheet-v2-content-inner--padding-md {
96
+ padding: 16px;
97
+ padding: var(--size-16);
98
+ }
99
+ .np-bottom-sheet-v2-title {
100
+ color: #37517e;
101
+ color: var(--color-content-primary);
102
+ }
103
+ .np-bottom-sheet-v2-body {
104
+ color: #5d7079;
105
+ color: var(--color-content-secondary);
106
+ }
107
+ .np-button-input {
108
+ display: inline-grid;
109
+ grid-auto-columns: minmax(0, 1fr);
110
+ align-content: center;
111
+ border-radius: 10px;
112
+ border-radius: var(--size-10);
113
+ text-align: start;
114
+ }
115
+ .np-popover-v2-container {
116
+ z-index: 1060;
117
+ display: flex;
118
+ max-height: var(--max-height);
119
+ width: var(--width);
120
+ flex-direction: column;
121
+ overflow: hidden;
122
+ border-radius: 10px;
123
+ border-radius: var(--radius-small);
124
+ background-color: #ffffff;
125
+ background-color: var(--color-background-elevated);
126
+ box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
127
+ }
128
+ .np-popover-v2-container--size-md {
129
+ min-width: 20rem;
130
+ }
131
+ .np-popover-v2-container--size-lg {
132
+ min-width: 24rem;
133
+ }
134
+ .np-popover-v2-container:focus {
135
+ outline: none;
136
+ }
137
+ .np-popover-v2 {
138
+ display: grid;
139
+ grid-row-gap: 8px;
140
+ grid-row-gap: var(--size-8);
141
+ row-gap: 8px;
142
+ row-gap: var(--size-8);
143
+ overflow-y: auto;
144
+ grid-template-rows: repeat(1, minmax(0, 1fr));
145
+ }
146
+ .np-popover-v2--has-title {
147
+ grid-template-rows: auto 1fr;
148
+ }
149
+ .np-popover-v2--padding-md {
150
+ padding: 16px;
151
+ padding: var(--size-16);
152
+ }
153
+ .np-popover-v2-title {
154
+ color: #37517e;
155
+ color: var(--color-content-primary);
156
+ }
157
+ .np-popover-v2-content {
158
+ color: #5d7079;
159
+ color: var(--color-content-secondary);
160
+ }
161
+ .np-select-input-placeholder {
162
+ overflow: hidden;
163
+ text-overflow: ellipsis;
164
+ white-space: nowrap;
165
+ color: #768e9c;
166
+ color: var(--color-content-tertiary);
167
+ }
168
+ .np-select-input-options-container {
169
+ display: flex;
170
+ height: 100%;
171
+ flex-direction: column;
172
+ }
173
+ .np-select-input-options-container:focus {
174
+ outline: none;
175
+ }
176
+ @media (min-width: 576px) {
177
+ .np-select-input-options-container {
178
+ max-height: 28rem /* 448px */;
179
+ }
180
+ }
181
+ .np-select-input-options-status {
182
+ display: flex;
183
+ align-items: center;
184
+ -moz-column-gap: 8px;
185
+ column-gap: 8px;
186
+ -moz-column-gap: var(--size-8);
187
+ column-gap: var(--size-8);
188
+ padding: 8px 24px 0px;
189
+ padding: var(--size-8) var(--size-24) 0px;
190
+ }
191
+ .np-select-input-options-status-icon {
192
+ padding: 0 4px;
193
+ padding: 0 var(--size-4);
194
+ color: #768e9c;
195
+ color: var(--color-content-tertiary);
196
+ }
197
+ .np-select-input-query-container {
198
+ display: flex;
199
+ flex-direction: column;
200
+ padding: 8px;
201
+ padding: var(--size-8);
202
+ }
203
+ .np-select-input-listbox-container {
204
+ position: relative;
205
+ height: var(--initial-height);
206
+ scroll-padding-top: 8px;
207
+ scroll-padding-top: var(--size-8);
208
+ scroll-padding-bottom: 8px;
209
+ scroll-padding-bottom: var(--size-8);
210
+ overflow-y: auto;
211
+ }
212
+ @media (min-width: 576px) {
213
+ .np-select-input-listbox-container {
214
+ height: auto;
215
+ }
216
+ }
217
+ .np-select-input-listbox-container--has-group {
218
+ scroll-padding-top: 32px;
219
+ scroll-padding-top: var(--size-32);
220
+ }
221
+ .np-select-input-listbox {
222
+ border-radius: 10px;
223
+ border-radius: var(--radius-small);
224
+ padding: 8px;
225
+ padding: var(--size-8);
226
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
227
+ }
228
+ .np-select-input-listbox:focus {
229
+ outline: none;
230
+ }
231
+ .np-select-input-listbox:focus-visible {
232
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
233
+ outline-offset: var(--ring-outline-offset);
234
+ }
235
+ .np-select-input-separator-item {
236
+ margin: 8px;
237
+ margin: var(--size-8);
238
+ border-top-width: 1px;
239
+ }
240
+ .np-select-input-group-item--without-needle:first-child {
241
+ margin-top: calc(-1 * 8px);
242
+ margin-top: calc(-1 * var(--size-8));
243
+ }
244
+ .np-select-input-group-item-header {
245
+ position: sticky;
246
+ top: 0px;
247
+ z-index: 10;
248
+ background-color: #ffffff;
249
+ background-color: var(--color-background-elevated);
250
+ padding: 8px 16px 4px;
251
+ padding: var(--size-8) var(--size-16) var(--size-4);
252
+ color: #5d7079;
253
+ color: var(--color-content-secondary);
254
+ }
255
+ .np-select-input-option-container {
256
+ display: flex;
257
+ cursor: default;
258
+ -webkit-user-select: none;
259
+ -moz-user-select: none;
260
+ user-select: none;
261
+ align-items: center;
262
+ -moz-column-gap: 8px;
263
+ column-gap: 8px;
264
+ -moz-column-gap: var(--size-8);
265
+ column-gap: var(--size-8);
266
+ border-radius: 10px;
267
+ border-radius: var(--radius-small);
268
+ padding: 12px 16px;
269
+ padding: var(--size-12) var(--size-16);
270
+ color: var(--color-interactive-primary);
271
+ }
272
+ .np-select-input-option-container--active {
273
+ box-shadow: inset 0 0 0 1px #c9cbce;
274
+ box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
275
+ }
276
+ .np-select-input-option-container--disabled {
277
+ opacity: 0.45;
278
+ }
279
+ .np-select-input-option-check--not-selected {
280
+ visibility: hidden;
281
+ }
282
+ .np-select-input-option {
283
+ flex: 1;
284
+ }
285
+ .np-select-input-option-content-container {
286
+ display: flex;
287
+ align-items: center;
288
+ -moz-column-gap: 8px;
289
+ column-gap: 8px;
290
+ -moz-column-gap: var(--size-8);
291
+ column-gap: var(--size-8);
292
+ color: #37517e;
293
+ color: var(--color-content-primary);
294
+ }
295
+ .np-select-input-option-content-icon {
296
+ display: flex;
297
+ }
298
+ .np-select-input-option-content-icon--not-within-trigger {
299
+ align-self: flex-start;
300
+ }
301
+ .np-select-input-option-content-text {
302
+ display: flex;
303
+ flex: 1;
304
+ flex-direction: column;
305
+ overflow: hidden;
306
+ }
307
+ .np-select-input-option-content-text-primary {
308
+ font: inherit;
309
+ }
310
+ .np-select-input-option-content-text-secondary {
311
+ color: #5d7079;
312
+ color: var(--color-content-secondary);
313
+ }
314
+ .np-select-input-option-content-text-within-trigger {
315
+ overflow: hidden;
316
+ text-overflow: ellipsis;
317
+ white-space: nowrap;
318
+ }
319
+ .np-select-input-option-content-text-line-1 > :not([hidden]) ~ :not([hidden]) {
320
+ margin-right: 8px;
321
+ margin-right: var(--size-8);
322
+ margin-left: 8px;
323
+ margin-left: var(--size-8);
324
+ }
325
+ .np-select-input-footer {
326
+ padding: 4px 24px 16px;
327
+ padding: var(--size-4) var(--size-24) var(--size-16);
328
+ }
329
+ .np-select-input-addon-container {
330
+ pointer-events: none;
331
+ margin-inline-start: 4px;
332
+ margin-inline-start: var(--size-4);
333
+ display: inline-flex;
334
+ align-items: center;
335
+ }
336
+ .np-select-input-addon-container > :not([hidden]) ~ :not([hidden]) {
337
+ margin-inline-start: 4px;
338
+ margin-inline-start: var(--size-4);
339
+ }
340
+ .np-select-input-addon {
341
+ border-width: 0;
342
+ background: none;
343
+ display: inline-flex;
344
+ height: 24px;
345
+ height: var(--size-24);
346
+ width: 24px;
347
+ width: var(--size-24);
348
+ align-items: center;
349
+ justify-content: center;
350
+ border-radius: 0.125rem /* 2px */;
351
+ /* TODO: Tokenize */
352
+ }
353
+ .np-select-input-addon--interactive {
354
+ pointer-events: auto;
355
+ color: #c9cbce;
356
+ color: var(--color-interactive-secondary);
357
+ }
358
+ .np-select-input-addon--interactive:hover {
359
+ color: #b5b7ba;
360
+ color: var(--color-interactive-secondary-hover);
361
+ }
362
+ .np-select-input-addon--interactive:focus {
363
+ outline: none;
364
+ }
365
+ .np-select-input-addon--interactive:focus-visible {
366
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
367
+ outline-offset: var(--ring-outline-offset);
368
+ }
369
+ .np-select-input-addon-separator {
370
+ height: 24px;
371
+ height: var(--size-24);
372
+ border-inline-start: 1px solid rgba(0,0,0,0.10196);
373
+ border-inline-start: 1px solid var(--color-border-neutral);
374
+ }
@@ -1,4 +1,4 @@
1
- import { act, screen, within } from '@testing-library/react';
1
+ import { act, screen, waitFor, within } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
 
4
4
  import { render, mockMatchMedia, mockResizeObserver } from '../test-utils';
@@ -30,7 +30,7 @@ describe('SelectInput', () => {
30
30
  { type: 'option', value: 'USD' },
31
31
  { type: 'option', value: 'EUR' },
32
32
  ]}
33
- renderFooter={({ normalizedQuery }) =>
33
+ renderFooter={({ queryNormalized: normalizedQuery }) =>
34
34
  normalizedQuery != null ? (
35
35
  <>Showing results for ‘{normalizedQuery}’</>
36
36
  ) : (
@@ -129,8 +129,57 @@ describe('SelectInput', () => {
129
129
  expect(within(listbox).getByRole('option')).toBeInTheDocument();
130
130
 
131
131
  const option = within(listbox).getAllByRole('option')[0];
132
- userEvent.click(option);
132
+ // eslint-disable-next-line @typescript-eslint/require-await
133
+ await act(async () => {
134
+ userEvent.click(option);
135
+ });
133
136
 
134
137
  expect(trigger).toHaveTextContent('EUR');
135
138
  });
139
+
140
+ it('clears filter query on close', async () => {
141
+ const handleFilterChange = jest.fn();
142
+
143
+ render(
144
+ <SelectInput
145
+ items={[
146
+ { type: 'option', value: 'USD' },
147
+ { type: 'option', value: 'EUR' },
148
+ ]}
149
+ filterable
150
+ onFilterChange={handleFilterChange}
151
+ />,
152
+ );
153
+
154
+ const trigger = screen.getAllByRole('button')[0];
155
+ // eslint-disable-next-line @typescript-eslint/require-await
156
+ await act(async () => {
157
+ userEvent.tab();
158
+ userEvent.keyboard(' ');
159
+ });
160
+
161
+ expect(handleFilterChange).not.toHaveBeenCalled();
162
+
163
+ userEvent.keyboard(' x');
164
+ expect(handleFilterChange).toHaveBeenLastCalledWith({
165
+ query: ' x',
166
+ queryNormalized: 'x',
167
+ });
168
+
169
+ userEvent.keyboard('{Escape}');
170
+ await waitFor(() => {
171
+ expect(handleFilterChange).toHaveBeenLastCalledWith({
172
+ query: '',
173
+ queryNormalized: null,
174
+ });
175
+ });
176
+
177
+ // eslint-disable-next-line @typescript-eslint/require-await
178
+ await act(async () => {
179
+ userEvent.click(trigger);
180
+ });
181
+
182
+ const listbox = screen.getByRole('listbox');
183
+ expect(within(listbox).getAllByRole('option')).toHaveLength(2);
184
+ });
136
185
  });
@@ -266,7 +266,7 @@ export const Currencies: StoryObj<{
266
266
  icon={<Flag code={currency.code} intrinsicSize={24} />}
267
267
  />
268
268
  )}
269
- renderFooter={({ resultsEmpty, normalizedQuery }) =>
269
+ renderFooter={({ resultsEmpty, queryNormalized: normalizedQuery }) =>
270
270
  resultsEmpty && normalizedQuery != null && /^[a-z]{3}$/u.test(normalizedQuery) ? (
271
271
  <>
272
272
  It’s not possible use {normalizedQuery.toUpperCase()} yet.{' '}
@@ -138,7 +138,7 @@ export interface SelectInputProps<T = string> {
138
138
  renderValue?: (value: NonNullable<T>, withinTrigger: boolean) => React.ReactNode;
139
139
  renderFooter?: (args: {
140
140
  resultsEmpty: boolean;
141
- normalizedQuery: string | null | undefined;
141
+ queryNormalized: string | null | undefined;
142
142
  }) => React.ReactNode;
143
143
  renderTrigger?: (args: {
144
144
  content: React.ReactNode;
@@ -153,8 +153,8 @@ export interface SelectInputProps<T = string> {
153
153
  disabled?: boolean;
154
154
  size?: 'md' | 'lg';
155
155
  className?: string;
156
+ onFilterChange?: (args: { query: string; queryNormalized: string | null }) => void;
156
157
  onChange?: (value: T) => void;
157
- onSearchChange?: (query: string) => void;
158
158
  onClear?: () => void;
159
159
  }
160
160
 
@@ -209,6 +209,8 @@ function SelectInputClearButton({ className, onClick }: SelectInputClearButtonPr
209
209
  );
210
210
  }
211
211
 
212
+ const noop = () => {};
213
+
212
214
  export function SelectInput<T = string>({
213
215
  name,
214
216
  placeholder,
@@ -224,12 +226,21 @@ export function SelectInput<T = string>({
224
226
  disabled,
225
227
  size = 'md',
226
228
  className,
229
+ onFilterChange = noop,
227
230
  onChange,
228
- onSearchChange,
229
231
  onClear,
230
232
  }: SelectInputProps<T>) {
231
233
  const [open, setOpen] = useState(false);
232
234
 
235
+ const [filterQuery, _setFilterQuery] = useState('');
236
+ const setFilterQuery = useEffectEvent((query: string) => {
237
+ _setFilterQuery(query);
238
+ onFilterChange({
239
+ query,
240
+ queryNormalized: query ? searchableString(query) : null,
241
+ });
242
+ });
243
+
233
244
  const triggerRef = useRef<HTMLButtonElement>(null);
234
245
 
235
246
  const screenSm = useScreenSize(Breakpoint.SMALL);
@@ -311,6 +322,11 @@ export function SelectInput<T = string>({
311
322
  onClose={() => {
312
323
  setOpen(false);
313
324
  }}
325
+ onCloseEnd={() => {
326
+ if (filterQuery !== '') {
327
+ setFilterQuery('');
328
+ }
329
+ }}
314
330
  >
315
331
  <SelectInputOptions
316
332
  items={items}
@@ -320,7 +336,8 @@ export function SelectInput<T = string>({
320
336
  filterPlaceholder={filterPlaceholder}
321
337
  searchInputRef={searchInputRef}
322
338
  listboxRef={listboxRef}
323
- onSearchChange={onSearchChange}
339
+ filterQuery={filterQuery}
340
+ onFilterChange={setFilterQuery}
324
341
  />
325
342
  </OptionsOverlay>
326
343
  )}
@@ -407,7 +424,8 @@ interface SelectInputOptionsProps<T = string>
407
424
  > {
408
425
  searchInputRef: React.RefObject<HTMLInputElement>;
409
426
  listboxRef: React.RefObject<HTMLDivElement>;
410
- onSearchChange?: (query: string) => void;
427
+ filterQuery: string;
428
+ onFilterChange: (query: string) => void;
411
429
  }
412
430
 
413
431
  function SelectInputOptions<T = string>({
@@ -418,19 +436,19 @@ function SelectInputOptions<T = string>({
418
436
  filterPlaceholder,
419
437
  searchInputRef,
420
438
  listboxRef,
421
- onSearchChange,
439
+ filterQuery,
440
+ onFilterChange,
422
441
  }: SelectInputOptionsProps<T>) {
423
442
  const intl = useIntl();
424
443
 
425
444
  const controllerRef = filterable ? searchInputRef : listboxRef;
426
445
 
427
- const [query, setQuery] = useState('');
428
446
  const needle = useMemo(() => {
429
447
  if (filterable) {
430
- return query ? searchableString(query) : null;
448
+ return filterQuery ? searchableString(filterQuery) : null;
431
449
  }
432
450
  return undefined;
433
- }, [filterable, query]);
451
+ }, [filterQuery, filterable]);
434
452
  const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
435
453
 
436
454
  const listboxContainerRef = useRef<HTMLDivElement>(null);
@@ -468,7 +486,7 @@ function SelectInputOptions<T = string>({
468
486
  ref={searchInputRef}
469
487
  shape="rectangle"
470
488
  placeholder={filterPlaceholder}
471
- value={query}
489
+ value={filterQuery}
472
490
  aria-controls={listboxId}
473
491
  aria-describedby={showStatus ? statusId : undefined}
474
492
  onKeyDown={(event) => {
@@ -479,10 +497,7 @@ function SelectInputOptions<T = string>({
479
497
  }
480
498
  }}
481
499
  onChange={(event) => {
482
- setQuery(event.currentTarget.value);
483
- if (onSearchChange) {
484
- onSearchChange(event.currentTarget.value);
485
- }
500
+ onFilterChange(event.currentTarget.value);
486
501
  }}
487
502
  />
488
503
  </div>
@@ -535,7 +550,7 @@ function SelectInputOptions<T = string>({
535
550
  >
536
551
  {renderFooter({
537
552
  resultsEmpty,
538
- normalizedQuery: needle,
553
+ queryNormalized: needle,
539
554
  })}
540
555
  </div>
541
556
  </footer>