@transferwise/components 0.0.0-experimental-a18466a → 0.0.0-experimental-e789c10
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.
- package/build/criticalBanner/CriticalCommsBanner.js +68 -3
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +69 -4
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +12 -5
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +11 -4
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +16 -8
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +14 -6
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/index.mjs +9 -3
- package/build/index.mjs.map +1 -1
- package/build/inputs/{_BottomSheet.js → SelectInput/BottomSheet/SelectInputBottomSheet.js} +7 -7
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +1 -0
- package/build/inputs/{_BottomSheet.mjs → SelectInput/BottomSheet/SelectInputBottomSheet.mjs} +7 -7
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +1 -0
- package/build/inputs/{_ButtonInput.js → SelectInput/ButtonInput/SelectInputButtonInput.js} +5 -5
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +1 -0
- package/build/inputs/{_ButtonInput.mjs → SelectInput/ButtonInput/SelectInputButtonInput.mjs} +5 -5
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +1 -0
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +26 -0
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +1 -0
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +24 -0
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +1 -0
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +59 -0
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +1 -0
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +56 -0
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +1 -0
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +50 -0
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +1 -0
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +48 -0
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +1 -0
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +47 -0
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +1 -0
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +45 -0
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +1 -0
- package/build/inputs/SelectInput/Option/SelectInputOption.js +42 -0
- package/build/inputs/SelectInput/Option/SelectInputOption.js.map +1 -0
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs +40 -0
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +1 -0
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +40 -0
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +1 -0
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +38 -0
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +1 -0
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +48 -0
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +1 -0
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +46 -0
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +1 -0
- package/build/inputs/SelectInput/Options/SelectInputOptions.js +300 -0
- package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +1 -0
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +298 -0
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +1 -0
- package/build/inputs/{_Popover.js → SelectInput/Popover/SelectInputPopover.js} +7 -7
- package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +1 -0
- package/build/inputs/{_Popover.mjs → SelectInput/Popover/SelectInputPopover.mjs} +7 -7
- package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +1 -0
- package/build/inputs/SelectInput/SelectInput.contexts.js +29 -0
- package/build/inputs/SelectInput/SelectInput.contexts.js.map +1 -0
- package/build/inputs/SelectInput/SelectInput.contexts.mjs +24 -0
- package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +1 -0
- package/build/inputs/SelectInput/SelectInput.js +222 -0
- package/build/inputs/SelectInput/SelectInput.js.map +1 -0
- package/build/inputs/SelectInput/SelectInput.messages.js.map +1 -0
- package/build/inputs/SelectInput/SelectInput.messages.mjs.map +1 -0
- package/build/inputs/SelectInput/SelectInput.mjs +216 -0
- package/build/inputs/SelectInput/SelectInput.mjs.map +1 -0
- package/build/inputs/SelectInput/SelectInput.utils.js +164 -0
- package/build/inputs/SelectInput/SelectInput.utils.js.map +1 -0
- package/build/inputs/SelectInput/SelectInput.utils.mjs +154 -0
- package/build/inputs/SelectInput/SelectInput.utils.mjs.map +1 -0
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +42 -0
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -0
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +36 -0
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -0
- package/build/main.css +123 -105
- package/build/moneyInput/MoneyInput.js +9 -2
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +8 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +10 -3
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +9 -2
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/styles/criticalBanner/CriticalCommsBanner.css +33 -15
- package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
- package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
- package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
- package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
- package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +33 -0
- package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
- package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
- package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
- package/build/styles/main.css +123 -105
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +4 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/criticalBanner/index.d.ts +1 -0
- package/build/types/criticalBanner/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/{_BottomSheet.d.ts → SelectInput/BottomSheet/SelectInputBottomSheet.d.ts} +3 -3
- package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +5 -0
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +7 -0
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +16 -0
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +2 -0
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +9 -0
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +11 -0
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/ItemView/index.d.ts +4 -0
- package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +11 -0
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Option/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/Option/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +13 -0
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +9 -0
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +21 -0
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Options/index.d.ts +4 -0
- package/build/types/inputs/SelectInput/Options/index.d.ts.map +1 -0
- package/build/types/inputs/{_Popover.d.ts → SelectInput/Popover/SelectInputPopover.d.ts} +3 -3
- package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/Popover/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/Popover/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +33 -0
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/SelectInput.d.ts +10 -0
- package/build/types/inputs/SelectInput/SelectInput.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +1 -0
- package/build/types/inputs/{SelectInput.d.ts → SelectInput/SelectInput.types.d.ts} +12 -38
- package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +60 -0
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +12 -0
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +3 -0
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/components.d.ts +10 -0
- package/build/types/inputs/SelectInput/components.d.ts.map +1 -0
- package/build/types/inputs/SelectInput/index.d.ts +10 -0
- package/build/types/inputs/SelectInput/index.d.ts.map +1 -0
- package/build/types/uploadInput/UploadInput.d.ts +2 -2
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/package.json +1 -1
- package/src/criticalBanner/CriticalCommsBanner.css +33 -15
- package/src/criticalBanner/CriticalCommsBanner.less +46 -36
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +9 -15
- package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +70 -0
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +66 -0
- package/src/criticalBanner/CriticalCommsBanner.tsx +54 -5
- package/src/criticalBanner/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +96 -0
- package/src/inputs/{_BottomSheet.tsx → SelectInput/BottomSheet/SelectInputBottomSheet.tsx} +7 -7
- package/src/inputs/SelectInput/BottomSheet/index.ts +2 -0
- package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +16 -0
- package/src/inputs/{_ButtonInput.tsx → SelectInput/ButtonInput/SelectInputButtonInput.tsx} +5 -5
- package/src/inputs/SelectInput/ButtonInput/index.ts +2 -0
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +46 -0
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +39 -0
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +27 -0
- package/src/inputs/SelectInput/ClearButton/index.ts +2 -0
- package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +74 -0
- package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +5 -0
- package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +61 -0
- package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +2 -0
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +16 -0
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +17 -0
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +48 -0
- package/src/inputs/SelectInput/ItemView/index.ts +3 -0
- package/src/inputs/SelectInput/Option/SelectInputOption.css +33 -0
- package/src/inputs/SelectInput/Option/SelectInputOption.less +32 -0
- package/src/inputs/SelectInput/Option/SelectInputOption.tsx +57 -0
- package/src/inputs/SelectInput/Option/index.ts +2 -0
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +37 -0
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +38 -0
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +72 -0
- package/src/inputs/SelectInput/OptionContent/index.ts +2 -0
- package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +59 -0
- package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +2 -0
- package/src/inputs/SelectInput/Options/SelectInputOptions.css +81 -0
- package/src/inputs/SelectInput/Options/SelectInputOptions.less +77 -0
- package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +411 -0
- package/src/inputs/SelectInput/Options/index.ts +3 -0
- package/src/inputs/SelectInput/Popover/SelectInputPopover.css +46 -0
- package/src/inputs/{_Popover.tsx → SelectInput/Popover/SelectInputPopover.tsx} +7 -7
- package/src/inputs/SelectInput/Popover/index.ts +2 -0
- package/src/inputs/SelectInput/SelectInput.contexts.tsx +40 -0
- package/src/inputs/SelectInput/SelectInput.less +22 -0
- package/src/inputs/{SelectInput.test.tsx → SelectInput/SelectInput.test.tsx} +9 -11
- package/src/inputs/SelectInput/SelectInput.tsx +257 -0
- package/src/inputs/SelectInput/SelectInput.types.ts +113 -0
- package/src/inputs/SelectInput/SelectInput.utils.ts +205 -0
- package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +36 -0
- package/src/inputs/SelectInput/TriggerButton/index.ts +5 -0
- package/src/inputs/{SelectInput.docs.mdx → SelectInput/_stories/SelectInput.docs.mdx} +0 -1
- package/src/inputs/{SelectInput.story.tsx → SelectInput/_stories/SelectInput.story.tsx} +11 -8
- package/src/inputs/{SelectInput.test.story.tsx → SelectInput/_stories/SelectInput.test.story.tsx} +6 -10
- package/src/inputs/SelectInput/components.ts +10 -0
- package/src/inputs/SelectInput/index.ts +12 -0
- package/src/main.css +123 -105
- package/src/main.less +1 -1
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/build/inputs/SelectInput.js +0 -890
- package/build/inputs/SelectInput.js.map +0 -1
- package/build/inputs/SelectInput.messages.js.map +0 -1
- package/build/inputs/SelectInput.messages.mjs.map +0 -1
- package/build/inputs/SelectInput.mjs +0 -881
- package/build/inputs/SelectInput.mjs.map +0 -1
- package/build/inputs/_BottomSheet.js.map +0 -1
- package/build/inputs/_BottomSheet.mjs.map +0 -1
- package/build/inputs/_ButtonInput.js.map +0 -1
- package/build/inputs/_ButtonInput.mjs.map +0 -1
- package/build/inputs/_Popover.js.map +0 -1
- package/build/inputs/_Popover.mjs.map +0 -1
- package/build/types/inputs/SelectInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput.messages.d.ts.map +0 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +0 -1
- package/build/types/inputs/_ButtonInput.d.ts +0 -5
- package/build/types/inputs/_ButtonInput.d.ts.map +0 -1
- package/build/types/inputs/_Popover.d.ts.map +0 -1
- package/src/inputs/SelectInput.less +0 -219
- package/src/inputs/SelectInput.tsx +0 -1269
- package/build/inputs/{SelectInput.messages.js → SelectInput/SelectInput.messages.js} +0 -0
- package/build/inputs/{SelectInput.messages.mjs → SelectInput/SelectInput.messages.mjs} +0 -0
- package/build/styles/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
- package/build/types/inputs/{SelectInput.messages.d.ts → SelectInput/SelectInput.messages.d.ts} +0 -0
- package/src/inputs/{_BottomSheet.less → SelectInput/BottomSheet/SelectInputBottomSheet.less} +0 -0
- package/src/inputs/{_ButtonInput.less → SelectInput/ButtonInput/SelectInputButtonInput.less} +0 -0
- package/src/inputs/{_Popover.less → SelectInput/Popover/SelectInputPopover.less} +0 -0
- package/src/inputs/{SelectInput.css → SelectInput/SelectInput.css} +90 -90
- /package/src/inputs/{SelectInput.messages.ts → SelectInput/SelectInput.messages.ts} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.np-bottom-sheet-v2-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
z-index: 1060;
|
|
4
|
+
}
|
|
5
|
+
.np-bottom-sheet-v2-backdrop {
|
|
6
|
+
position: fixed;
|
|
7
|
+
inset: 0px;
|
|
8
|
+
background-color: #37517e;
|
|
9
|
+
background-color: var(--color-content-primary);
|
|
10
|
+
opacity: 0.4;
|
|
11
|
+
transition-property: opacity;
|
|
12
|
+
transition-timing-function: ease-out;
|
|
13
|
+
transition-duration: 300ms;
|
|
14
|
+
}
|
|
15
|
+
.np-bottom-sheet-v2-backdrop--closed {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
}
|
|
18
|
+
.np-bottom-sheet-v2 {
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0px;
|
|
21
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
22
|
+
margin-left: 8px;
|
|
23
|
+
margin-left: var(--size-8);
|
|
24
|
+
margin-right: 8px;
|
|
25
|
+
margin-right: var(--size-8);
|
|
26
|
+
margin-top: 64px;
|
|
27
|
+
margin-top: var(--size-64);
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
}
|
|
32
|
+
.np-bottom-sheet-v2-content {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
border-top-left-radius: 32px;
|
|
37
|
+
/* TODO: Tokenize */
|
|
38
|
+
border-top-right-radius: 32px;
|
|
39
|
+
/* TODO: Tokenize */
|
|
40
|
+
background-color: #ffffff;
|
|
41
|
+
background-color: var(--color-background-elevated);
|
|
42
|
+
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
43
|
+
}
|
|
44
|
+
.np-bottom-sheet-v2-content:focus {
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
48
|
+
.np-bottom-sheet-v2-content {
|
|
49
|
+
transition-property: transform;
|
|
50
|
+
transition-timing-function: ease-out;
|
|
51
|
+
transition-duration: 300ms;
|
|
52
|
+
}
|
|
53
|
+
.np-bottom-sheet-v2-content--closed {
|
|
54
|
+
transform: translateY(100%);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
.np-bottom-sheet-v2-content {
|
|
59
|
+
transition-property: opacity;
|
|
60
|
+
transition-timing-function: ease-out;
|
|
61
|
+
transition-duration: 300ms;
|
|
62
|
+
}
|
|
63
|
+
.np-bottom-sheet-v2-content--closed {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.np-bottom-sheet-v2-header {
|
|
68
|
+
align-self: flex-end;
|
|
69
|
+
padding: 16px;
|
|
70
|
+
padding: var(--size-16);
|
|
71
|
+
}
|
|
72
|
+
.np-bottom-sheet-v2-content-inner {
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template-rows: minmax(0, 1fr);
|
|
75
|
+
grid-row-gap: 8px;
|
|
76
|
+
grid-row-gap: var(--size-8);
|
|
77
|
+
row-gap: 8px;
|
|
78
|
+
row-gap: var(--size-8);
|
|
79
|
+
overflow: auto;
|
|
80
|
+
}
|
|
81
|
+
.np-bottom-sheet-v2-content-inner--has-title {
|
|
82
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
83
|
+
}
|
|
84
|
+
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
85
|
+
padding: 16px;
|
|
86
|
+
padding: var(--size-16);
|
|
87
|
+
padding-top: 0px;
|
|
88
|
+
}
|
|
89
|
+
.np-bottom-sheet-v2-title {
|
|
90
|
+
color: #37517e;
|
|
91
|
+
color: var(--color-content-primary);
|
|
92
|
+
}
|
|
93
|
+
.np-bottom-sheet-v2-body {
|
|
94
|
+
color: #5d7079;
|
|
95
|
+
color: var(--color-content-secondary);
|
|
96
|
+
}
|
|
@@ -12,12 +12,12 @@ import { ThemeProvider, useTheme } from '@wise/components-theming';
|
|
|
12
12
|
import { clsx } from 'clsx';
|
|
13
13
|
import { Fragment, useState } from 'react';
|
|
14
14
|
|
|
15
|
-
import { CloseButton } from '
|
|
16
|
-
import { useVirtualKeyboard } from '
|
|
17
|
-
import { PreventScroll } from '
|
|
18
|
-
import { Size } from '
|
|
15
|
+
import { CloseButton } from '../../../common/closeButton';
|
|
16
|
+
import { useVirtualKeyboard } from '../../../common/hooks/useVirtualKeyboard';
|
|
17
|
+
import { PreventScroll } from '../../../common/preventScroll/PreventScroll';
|
|
18
|
+
import { Size } from '../../../common/propsValues/size';
|
|
19
19
|
|
|
20
|
-
export interface
|
|
20
|
+
export interface SelectInputBottomSheetProps {
|
|
21
21
|
open: boolean;
|
|
22
22
|
renderTrigger?: (args: {
|
|
23
23
|
ref: React.RefCallback<Element>;
|
|
@@ -33,7 +33,7 @@ export interface BottomSheetProps {
|
|
|
33
33
|
onCloseEnd?: () => void;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function
|
|
36
|
+
export function SelectInputBottomSheet({
|
|
37
37
|
open,
|
|
38
38
|
renderTrigger,
|
|
39
39
|
title,
|
|
@@ -42,7 +42,7 @@ export function BottomSheet({
|
|
|
42
42
|
children,
|
|
43
43
|
onClose,
|
|
44
44
|
onCloseEnd,
|
|
45
|
-
}:
|
|
45
|
+
}: SelectInputBottomSheetProps) {
|
|
46
46
|
useVirtualKeyboard(open);
|
|
47
47
|
|
|
48
48
|
const { refs, context } = useFloating<Element>({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.np-button-input {
|
|
2
|
+
display: inline-grid;
|
|
3
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
4
|
+
align-content: center;
|
|
5
|
+
border-radius: 10px;
|
|
6
|
+
border-radius: var(--size-10);
|
|
7
|
+
text-align: start;
|
|
8
|
+
}
|
|
9
|
+
.np-button-input:has(.np-select-input-option-description-in-trigger) {
|
|
10
|
+
height: auto !important;
|
|
11
|
+
align-content: start;
|
|
12
|
+
padding-top: 12px !important;
|
|
13
|
+
padding-top: var(--size-12) !important;
|
|
14
|
+
padding-bottom: 12px !important;
|
|
15
|
+
padding-bottom: var(--size-12) !important;
|
|
16
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useInputPaddings } from '
|
|
5
|
-
import { inputClassNameBase } from '
|
|
4
|
+
import { useInputPaddings } from '../../InputGroup';
|
|
5
|
+
import { inputClassNameBase } from '../../_common';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface SelectInputButtonInputProps extends React.ComponentPropsWithRef<'button'> {
|
|
8
8
|
size?: 'sm' | 'md' | 'lg';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const
|
|
12
|
-
{ size = 'md', className, style, ...restProps }:
|
|
11
|
+
export const SelectInputButtonInput = forwardRef(function ButtonInput(
|
|
12
|
+
{ size = 'md', className, style, ...restProps }: SelectInputButtonInputProps,
|
|
13
13
|
ref: React.ForwardedRef<HTMLButtonElement | null>,
|
|
14
14
|
) {
|
|
15
15
|
const inputPaddings = useInputPaddings();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.np-select-input-addon-container {
|
|
2
|
+
pointer-events: none;
|
|
3
|
+
margin-inline-start: 4px;
|
|
4
|
+
margin-inline-start: var(--size-4);
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
.np-select-input-addon-container > :not([hidden]) ~ :not([hidden]) {
|
|
9
|
+
margin-inline-start: 4px;
|
|
10
|
+
margin-inline-start: var(--size-4);
|
|
11
|
+
}
|
|
12
|
+
.np-select-input-addon {
|
|
13
|
+
border-width: 0;
|
|
14
|
+
background: none;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
height: 24px;
|
|
17
|
+
height: var(--size-24);
|
|
18
|
+
width: 24px;
|
|
19
|
+
width: var(--size-24);
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
border-radius: 0.125rem /* 2px */;
|
|
23
|
+
/* TODO: Tokenize */
|
|
24
|
+
}
|
|
25
|
+
.np-select-input-addon--interactive {
|
|
26
|
+
pointer-events: auto;
|
|
27
|
+
color: #c9cbce;
|
|
28
|
+
color: var(--color-interactive-secondary);
|
|
29
|
+
}
|
|
30
|
+
.np-select-input-addon--interactive:hover {
|
|
31
|
+
color: #b5b7ba;
|
|
32
|
+
color: var(--color-interactive-secondary-hover);
|
|
33
|
+
}
|
|
34
|
+
.np-select-input-addon--interactive:focus {
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
|
+
.np-select-input-addon--interactive:focus-visible {
|
|
38
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
39
|
+
outline-offset: var(--ring-outline-offset);
|
|
40
|
+
}
|
|
41
|
+
.np-select-input-addon-separator {
|
|
42
|
+
height: 24px;
|
|
43
|
+
height: var(--size-24);
|
|
44
|
+
border-inline-start: 1px solid rgba(0,0,0,0.10196);
|
|
45
|
+
border-inline-start: 1px solid var(--color-border-neutral);
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import (reference) "../../../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
2
|
+
|
|
3
|
+
.np-select-input-addon-container {
|
|
4
|
+
pointer-events: none;
|
|
5
|
+
margin-inline-start: var(--size-4);
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
& > :not([hidden]) ~ :not([hidden]) {
|
|
10
|
+
margin-inline-start: var(--size-4);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.np-select-input-addon {
|
|
15
|
+
border-width: 0;
|
|
16
|
+
background: none;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
height: var(--size-24);
|
|
19
|
+
width: var(--size-24);
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
border-radius: 0.125rem /* 2px */; /* TODO: Tokenize */
|
|
23
|
+
|
|
24
|
+
&--interactive {
|
|
25
|
+
pointer-events: auto;
|
|
26
|
+
color: var(--color-interactive-secondary);
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
color: var(--color-interactive-secondary-hover);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.focus-ring();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.np-select-input-addon-separator {
|
|
37
|
+
height: var(--size-24);
|
|
38
|
+
border-inline-start: 1px solid var(--color-border-neutral);
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Cross } from '@transferwise/icons';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import dateTriggerMessages from '../../../dateLookup/dateTrigger/DateTrigger.messages';
|
|
5
|
+
|
|
6
|
+
export interface SelectInputClearButtonProps extends Pick<
|
|
7
|
+
React.ComponentPropsWithoutRef<'button'>,
|
|
8
|
+
'className' | 'onClick'
|
|
9
|
+
> {}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A button component used to clear the selected value in a SelectInput.
|
|
13
|
+
*/
|
|
14
|
+
export function SelectInputClearButton({ className, onClick }: SelectInputClearButtonProps) {
|
|
15
|
+
const intl = useIntl();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
aria-label={intl.formatMessage(dateTriggerMessages.ariaLabel)}
|
|
21
|
+
className={clsx(className, 'np-select-input-addon np-select-input-addon--interactive')}
|
|
22
|
+
onClick={onClick}
|
|
23
|
+
>
|
|
24
|
+
<Cross size={16} />
|
|
25
|
+
</button>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ChevronDown } from '@transferwise/icons';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { InputGroup } from '../../InputGroup';
|
|
6
|
+
import { SelectInputClearButton } from '../ClearButton';
|
|
7
|
+
import { SelectInputTriggerButton } from '../TriggerButton';
|
|
8
|
+
import { SelectInputProps } from '../SelectInput.types';
|
|
9
|
+
import { SelectInputButtonInput } from '../ButtonInput';
|
|
10
|
+
|
|
11
|
+
export interface SelectInputDefaultRenderTriggerProps {
|
|
12
|
+
content: React.ReactNode;
|
|
13
|
+
placeholderShown: boolean;
|
|
14
|
+
clear: (() => void) | undefined;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
size: 'sm' | 'md' | 'lg';
|
|
17
|
+
className: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default render function for the SelectInput trigger.
|
|
22
|
+
* Displays the selected value or placeholder with clear button and dropdown indicator.
|
|
23
|
+
*/
|
|
24
|
+
export function SelectInputDefaultRenderTrigger({
|
|
25
|
+
content,
|
|
26
|
+
placeholderShown,
|
|
27
|
+
clear,
|
|
28
|
+
disabled,
|
|
29
|
+
size,
|
|
30
|
+
className,
|
|
31
|
+
}: SelectInputDefaultRenderTriggerProps) {
|
|
32
|
+
return (
|
|
33
|
+
<InputGroup
|
|
34
|
+
addonEnd={{
|
|
35
|
+
content: (
|
|
36
|
+
<span className={clsx('np-select-input-addon-container', disabled && 'disabled')}>
|
|
37
|
+
{clear != null && !placeholderShown ? (
|
|
38
|
+
<>
|
|
39
|
+
<SelectInputClearButton
|
|
40
|
+
onClick={(event) => {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
clear();
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
<span className="np-select-input-addon-separator" />
|
|
46
|
+
</>
|
|
47
|
+
) : null}
|
|
48
|
+
<span className="np-select-input-addon">
|
|
49
|
+
<ChevronDown size={16} />
|
|
50
|
+
</span>
|
|
51
|
+
</span>
|
|
52
|
+
),
|
|
53
|
+
initialContentWidth: 24 + 4,
|
|
54
|
+
padding: 'sm',
|
|
55
|
+
}}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
className={className}
|
|
58
|
+
>
|
|
59
|
+
<SelectInputTriggerButton as={SelectInputButtonInput} size={size}>
|
|
60
|
+
<span
|
|
61
|
+
className={clsx(
|
|
62
|
+
'np-select-input-content',
|
|
63
|
+
placeholderShown && 'np-select-input-placeholder',
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{content}
|
|
67
|
+
</span>
|
|
68
|
+
</SelectInputTriggerButton>
|
|
69
|
+
</InputGroup>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const DefaultRenderTrigger =
|
|
74
|
+
SelectInputDefaultRenderTrigger satisfies SelectInputProps['renderTrigger'];
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
export interface SelectInputGroupItemViewProps<T = string> extends SelectInputItemViewProps<
|
|
9
|
+
T,
|
|
10
|
+
SelectInputGroupItem<T | undefined>
|
|
11
|
+
> {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component that renders a group of SelectInput options with a header.
|
|
15
|
+
*/
|
|
16
|
+
export function SelectInputGroupItemView<T = string>({
|
|
17
|
+
item,
|
|
18
|
+
renderValue,
|
|
19
|
+
needle,
|
|
20
|
+
}: SelectInputGroupItemViewProps<T>) {
|
|
21
|
+
const headerId = useId();
|
|
22
|
+
|
|
23
|
+
const header = (
|
|
24
|
+
<Header
|
|
25
|
+
as="header"
|
|
26
|
+
role="none"
|
|
27
|
+
id={headerId}
|
|
28
|
+
title={item.label}
|
|
29
|
+
// @ts-expect-error when we migrate ActionButton to new Button this should be sorted
|
|
30
|
+
action={
|
|
31
|
+
item.action && {
|
|
32
|
+
text: item.action.label,
|
|
33
|
+
onClick: item.action.onClick,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
className="np-select-input-group-item-header p-x-1"
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
// An empty container may be rendered when no options match `needle`
|
|
42
|
+
// However, pre-filtering would result in worse performance overall
|
|
43
|
+
<Section
|
|
44
|
+
as="section"
|
|
45
|
+
role="group"
|
|
46
|
+
aria-labelledby={headerId}
|
|
47
|
+
className={clsx('m-y-0', needle === null && 'np-select-input-group-item--without-needle')}
|
|
48
|
+
>
|
|
49
|
+
{needle == null ? header : null}
|
|
50
|
+
{item.options.map((option, index) => (
|
|
51
|
+
<SelectInputItemView
|
|
52
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
53
|
+
key={index}
|
|
54
|
+
item={option}
|
|
55
|
+
renderValue={renderValue}
|
|
56
|
+
needle={needle}
|
|
57
|
+
/>
|
|
58
|
+
))}
|
|
59
|
+
</Section>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
export interface SelectInputItemViewProps<
|
|
7
|
+
T = string,
|
|
8
|
+
I extends SelectInputItem<T | undefined> = SelectInputItem<T | undefined>,
|
|
9
|
+
> extends Required<Pick<SelectInputProps<T>, 'renderValue'>> {
|
|
10
|
+
item: I;
|
|
11
|
+
needle: string | null | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Component that renders different types of SelectInput items:
|
|
16
|
+
* options, groups, or separators.
|
|
17
|
+
*/
|
|
18
|
+
export function SelectInputItemView<T = string>({
|
|
19
|
+
item,
|
|
20
|
+
renderValue,
|
|
21
|
+
needle,
|
|
22
|
+
}: SelectInputItemViewProps<T>) {
|
|
23
|
+
switch (item.type) {
|
|
24
|
+
case 'option': {
|
|
25
|
+
if (
|
|
26
|
+
item.value != null &&
|
|
27
|
+
(needle == null || selectInputOptionItemIncludesNeedle(item, needle))
|
|
28
|
+
) {
|
|
29
|
+
return (
|
|
30
|
+
<SelectInputOption value={item.value} disabled={item.disabled}>
|
|
31
|
+
{renderValue(item.value, false)}
|
|
32
|
+
</SelectInputOption>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'group': {
|
|
38
|
+
return <SelectInputGroupItemView item={item} renderValue={renderValue} needle={needle} />;
|
|
39
|
+
}
|
|
40
|
+
case 'separator': {
|
|
41
|
+
if (needle == null) {
|
|
42
|
+
return <hr className="np-select-input-separator-item" />;
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
export interface SelectInputOptionProps<T = string> {
|
|
11
|
+
value: T;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A selectable option in a SelectInput dropdown.
|
|
18
|
+
* Includes accessibility support and styling for selected, active, and disabled states.
|
|
19
|
+
*/
|
|
20
|
+
export function SelectInputOption<T = string>({
|
|
21
|
+
value,
|
|
22
|
+
disabled,
|
|
23
|
+
children,
|
|
24
|
+
}: SelectInputOptionProps<T>) {
|
|
25
|
+
const itemsCount = useContext(SelectInputItemsCountContext);
|
|
26
|
+
const itemPosition = useContext(SelectInputItemPositionContext);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<ListboxOption
|
|
30
|
+
as="div"
|
|
31
|
+
value={value}
|
|
32
|
+
aria-setsize={itemsCount}
|
|
33
|
+
aria-posinset={itemPosition}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
className={({ active, disabled: uiDisabled }) =>
|
|
36
|
+
clsx(
|
|
37
|
+
'np-select-input-option-container np-text-body-large',
|
|
38
|
+
active && 'np-select-input-option-container--active',
|
|
39
|
+
uiDisabled && 'np-select-input-option-container--disabled',
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
{({ selected }) => (
|
|
44
|
+
<>
|
|
45
|
+
<div className="np-select-input-option">{children}</div>
|
|
46
|
+
<Check
|
|
47
|
+
size={16}
|
|
48
|
+
className={clsx(
|
|
49
|
+
'np-select-input-option-check',
|
|
50
|
+
!selected && 'np-select-input-option-check--not-selected',
|
|
51
|
+
)}
|
|
52
|
+
/>
|
|
53
|
+
</>
|
|
54
|
+
)}
|
|
55
|
+
</ListboxOption>
|
|
56
|
+
);
|
|
57
|
+
}
|