@transferwise/components 0.0.0-experimental-8a855e9 → 0.0.0-experimental-841c8df
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 +66 -2
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +68 -4
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +5 -12
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -11
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +8 -16
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +6 -14
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
- package/build/index.js +7 -14
- package/build/index.js.map +1 -1
- package/build/index.mjs +3 -10
- package/build/index.mjs.map +1 -1
- package/build/inputs/SelectInput.js +890 -0
- package/build/inputs/SelectInput.js.map +1 -0
- package/build/inputs/SelectInput.messages.js.map +1 -0
- package/build/inputs/SelectInput.messages.mjs.map +1 -0
- package/build/inputs/SelectInput.mjs +881 -0
- package/build/inputs/SelectInput.mjs.map +1 -0
- package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.js → _BottomSheet.js} +7 -7
- package/build/inputs/_BottomSheet.js.map +1 -0
- package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.mjs → _BottomSheet.mjs} +7 -7
- package/build/inputs/_BottomSheet.mjs.map +1 -0
- package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.js → _ButtonInput.js} +5 -5
- package/build/inputs/_ButtonInput.js.map +1 -0
- package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.mjs → _ButtonInput.mjs} +5 -5
- package/build/inputs/_ButtonInput.mjs.map +1 -0
- package/build/inputs/{SelectInput/Popover/SelectInputPopover.js → _Popover.js} +7 -7
- package/build/inputs/_Popover.js.map +1 -0
- package/build/inputs/{SelectInput/Popover/SelectInputPopover.mjs → _Popover.mjs} +7 -7
- package/build/inputs/_Popover.mjs.map +1 -0
- package/build/main.css +122 -105
- package/build/moneyInput/MoneyInput.js +2 -9
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -8
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +3 -10
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +2 -9
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/styles/criticalBanner/CriticalCommsBanner.css +32 -15
- package/build/styles/main.css +122 -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/inputs/{SelectInput/SelectInput.types.d.ts → SelectInput.d.ts} +38 -12
- package/build/types/inputs/SelectInput.d.ts.map +1 -0
- package/build/types/inputs/SelectInput.messages.d.ts.map +1 -0
- package/build/types/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.d.ts → _BottomSheet.d.ts} +3 -3
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
- package/build/types/inputs/_ButtonInput.d.ts +5 -0
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
- package/build/types/inputs/{SelectInput/Popover/SelectInputPopover.d.ts → _Popover.d.ts} +3 -3
- package/build/types/inputs/_Popover.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/criticalBanner/CriticalCommsBanner.css +32 -15
- package/src/criticalBanner/CriticalCommsBanner.less +45 -36
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +15 -0
- package/src/criticalBanner/CriticalCommsBanner.tsx +59 -4
- package/src/criticalBanner/index.ts +1 -0
- package/src/inputs/{SelectInput/_stories/SelectInput.docs.mdx → SelectInput.docs.mdx} +1 -0
- package/src/inputs/SelectInput.less +219 -0
- package/src/inputs/{SelectInput/_stories/SelectInput.story.tsx → SelectInput.story.tsx} +8 -11
- package/src/inputs/{SelectInput/_stories/SelectInput.test.story.tsx → SelectInput.test.story.tsx} +10 -5
- package/src/inputs/{SelectInput/SelectInput.test.tsx → SelectInput.test.tsx} +11 -9
- package/src/inputs/SelectInput.tsx +1269 -0
- package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.tsx → _BottomSheet.tsx} +7 -7
- package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.tsx → _ButtonInput.tsx} +5 -5
- package/src/inputs/{SelectInput/Popover/SelectInputPopover.tsx → _Popover.tsx} +7 -7
- package/src/main.css +122 -105
- package/src/main.less +1 -1
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +0 -1
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +0 -1
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +0 -1
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +0 -1
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +0 -27
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +0 -1
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +0 -25
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +0 -1
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +0 -59
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +0 -1
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +0 -56
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +0 -1
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +0 -50
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +0 -1
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +0 -48
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +0 -1
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +0 -47
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +0 -1
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +0 -45
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +0 -1
- package/build/inputs/SelectInput/Option/SelectInputOption.js +0 -42
- package/build/inputs/SelectInput/Option/SelectInputOption.js.map +0 -1
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs +0 -40
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +0 -1
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +0 -40
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +0 -1
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +0 -38
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +0 -1
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +0 -48
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +0 -1
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +0 -46
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +0 -1
- package/build/inputs/SelectInput/Options/SelectInputOptions.js +0 -300
- package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +0 -1
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +0 -298
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +0 -1
- package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +0 -1
- package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.contexts.js +0 -29
- package/build/inputs/SelectInput/SelectInput.contexts.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.contexts.mjs +0 -24
- package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.js +0 -222
- package/build/inputs/SelectInput/SelectInput.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.messages.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.messages.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.mjs +0 -216
- package/build/inputs/SelectInput/SelectInput.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.utils.js +0 -164
- package/build/inputs/SelectInput/SelectInput.utils.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.utils.mjs +0 -154
- package/build/inputs/SelectInput/SelectInput.utils.mjs.map +0 -1
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +0 -42
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +0 -1
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +0 -36
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +0 -1
- package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
- package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
- package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
- package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
- package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +0 -33
- package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
- package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
- package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
- package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +0 -5
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +0 -7
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +0 -16
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +0 -2
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +0 -9
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +0 -11
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/index.d.ts +0 -4
- package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +0 -11
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Option/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Option/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +0 -13
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +0 -9
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +0 -21
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/index.d.ts +0 -4
- package/build/types/inputs/SelectInput/Options/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Popover/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Popover/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +0 -33
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.d.ts +0 -10
- package/build/types/inputs/SelectInput/SelectInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +0 -61
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +0 -12
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/components.d.ts +0 -10
- package/build/types/inputs/SelectInput/components.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/index.d.ts +0 -12
- package/build/types/inputs/SelectInput/index.d.ts.map +0 -1
- package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
- package/src/inputs/SelectInput/BottomSheet/index.ts +0 -2
- package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
- package/src/inputs/SelectInput/ButtonInput/index.ts +0 -2
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +0 -40
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +0 -29
- package/src/inputs/SelectInput/ClearButton/index.ts +0 -2
- package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +0 -74
- package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +0 -5
- package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +0 -61
- package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +0 -2
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +0 -17
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +0 -48
- package/src/inputs/SelectInput/ItemView/index.ts +0 -3
- package/src/inputs/SelectInput/Option/SelectInputOption.css +0 -33
- package/src/inputs/SelectInput/Option/SelectInputOption.less +0 -32
- package/src/inputs/SelectInput/Option/SelectInputOption.tsx +0 -57
- package/src/inputs/SelectInput/Option/index.ts +0 -2
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +0 -38
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +0 -72
- package/src/inputs/SelectInput/OptionContent/index.ts +0 -2
- package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +0 -59
- package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +0 -2
- package/src/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
- package/src/inputs/SelectInput/Options/SelectInputOptions.less +0 -77
- package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +0 -411
- package/src/inputs/SelectInput/Options/index.ts +0 -3
- package/src/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
- package/src/inputs/SelectInput/Popover/index.ts +0 -2
- package/src/inputs/SelectInput/SelectInput.contexts.tsx +0 -40
- package/src/inputs/SelectInput/SelectInput.less +0 -22
- package/src/inputs/SelectInput/SelectInput.tsx +0 -257
- package/src/inputs/SelectInput/SelectInput.types.ts +0 -113
- package/src/inputs/SelectInput/SelectInput.utils.ts +0 -206
- package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +0 -36
- package/src/inputs/SelectInput/TriggerButton/index.ts +0 -5
- package/src/inputs/SelectInput/components.ts +0 -10
- package/src/inputs/SelectInput/index.ts +0 -14
- package/build/inputs/{SelectInput/SelectInput.messages.js → SelectInput.messages.js} +0 -0
- package/build/inputs/{SelectInput/SelectInput.messages.mjs → SelectInput.messages.mjs} +0 -0
- package/build/styles/inputs/{SelectInput/SelectInput.css → SelectInput.css} +90 -90
- package/build/types/inputs/{SelectInput/SelectInput.messages.d.ts → SelectInput.messages.d.ts} +0 -0
- package/src/inputs/{SelectInput/SelectInput.css → SelectInput.css} +90 -90
- /package/src/inputs/{SelectInput/SelectInput.messages.ts → SelectInput.messages.ts} +0 -0
- /package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.less → _BottomSheet.less} +0 -0
- /package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.less → _ButtonInput.less} +0 -0
- /package/src/inputs/{SelectInput/Popover/SelectInputPopover.less → _Popover.less} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { WithInputAttributesProps } from './
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Merge } from '../utils';
|
|
3
|
+
import { WithInputAttributesProps } from './contexts';
|
|
4
|
+
import { ButtonProps } from '../button/Button.types';
|
|
4
5
|
export interface SelectInputOptionItem<T = string> {
|
|
5
6
|
type: 'option';
|
|
6
7
|
value: T;
|
|
@@ -20,6 +21,22 @@ export interface SelectInputSeparatorItem {
|
|
|
20
21
|
type: 'separator';
|
|
21
22
|
}
|
|
22
23
|
export type SelectInputItem<T = string> = SelectInputOptionItem<T> | SelectInputGroupItem<T> | SelectInputSeparatorItem;
|
|
24
|
+
/**
|
|
25
|
+
* A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.
|
|
26
|
+
* Prioritizes: exact matches > starts with > contains > alphabetical.
|
|
27
|
+
*
|
|
28
|
+
* @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <SelectInput
|
|
33
|
+
* filterable
|
|
34
|
+
* sortFilteredOptions={sortByRelevance((value) => value.name)}
|
|
35
|
+
* // ...
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function sortByRelevance<T>(getLabel?: (value: T) => string): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number;
|
|
23
40
|
export interface SelectInputProps<T = string, M extends boolean = false> {
|
|
24
41
|
id?: string;
|
|
25
42
|
/**
|
|
@@ -86,12 +103,21 @@ export interface SelectInputProps<T = string, M extends boolean = false> {
|
|
|
86
103
|
onClose?: () => void;
|
|
87
104
|
onClear?: () => void;
|
|
88
105
|
}
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export type
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
export declare function SelectInput<T = string, M extends boolean = false>({ id: idProp, parentId, name, multiple, placeholder, autocomplete, items, defaultValue, value: controlledValue, compareValues, renderValue, renderFooter, renderTrigger, filterable, filterPlaceholder, sortFilteredOptions, disabled, size, className, UNSAFE_triggerButtonProps, triggerRef: externalTriggerRef, onFilterChange, onChange, onOpen, onClose, onClear, }: SelectInputProps<T, M>): import("react").JSX.Element;
|
|
107
|
+
export declare namespace SelectInput {
|
|
108
|
+
var sortByRelevance: typeof import("./SelectInput").sortByRelevance;
|
|
109
|
+
}
|
|
110
|
+
type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
111
|
+
export type SelectInputTriggerButtonProps<T extends SelectInputTriggerButtonElementType = 'button'> = Merge<React.ComponentPropsWithoutRef<T>, {
|
|
112
|
+
as?: T;
|
|
113
|
+
}>;
|
|
114
|
+
export declare function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({ as, ...restProps }: SelectInputTriggerButtonProps<T>): import("react").JSX.Element;
|
|
115
|
+
export interface SelectInputOptionContentProps {
|
|
116
|
+
title: React.ReactNode;
|
|
117
|
+
note?: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
icon?: React.ReactNode;
|
|
120
|
+
}
|
|
121
|
+
export declare function SelectInputOptionContent({ title, note, description, icon, }: SelectInputOptionContentProps): import("react").JSX.Element;
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=SelectInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,SAAS,EAQV,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,OAAO,EAAs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C,EACpC,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,IAAW,EACX,SAAS,EACT,yBAAyB,EACzB,UAAU,EAAE,kBAAkB,EAC9B,cAAqB,EACrB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,+BAuMxB;yBAlOe,WAAW;;;AA8O3B,KAAK,mCAAmC,GAAG,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC;AAE1E,MAAM,MAAM,6BAA6B,CACvC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,IACtD,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEzD,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,EAAE,EACjG,EAAkB,EAClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+BAclC;AAujBD,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GACL,EAAE,6BAA6B,+BAkD/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.messages.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.messages.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMG"}
|
package/build/types/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.d.ts → _BottomSheet.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface BottomSheetProps {
|
|
2
2
|
open: boolean;
|
|
3
3
|
renderTrigger?: (args: {
|
|
4
4
|
ref: React.RefCallback<Element>;
|
|
@@ -13,5 +13,5 @@ export interface SelectInputBottomSheetProps {
|
|
|
13
13
|
onClose?: () => void;
|
|
14
14
|
onCloseEnd?: () => void;
|
|
15
15
|
}
|
|
16
|
-
export declare function
|
|
17
|
-
//# sourceMappingURL=
|
|
16
|
+
export declare function BottomSheet({ open, renderTrigger, title, initialFocusRef, padding, children, onClose, onCloseEnd, }: BottomSheetProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=_BottomSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/inputs/_BottomSheet.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QACrB,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAChC,mBAAmB,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;YACvE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,KAAK,EACL,eAAe,EACf,OAAc,EACd,QAAQ,EACR,OAAO,EACP,UAAU,GACX,EAAE,gBAAgB,+BA4FlB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface ButtonInputProps extends React.ComponentPropsWithRef<'button'> {
|
|
2
|
+
size?: 'sm' | 'md' | 'lg';
|
|
3
|
+
}
|
|
4
|
+
export declare const ButtonInput: import("react").ForwardRefExoticComponent<Omit<ButtonInputProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | null>>;
|
|
5
|
+
//# sourceMappingURL=_ButtonInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_ButtonInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/_ButtonInput.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,qBAAqB,CAAC,QAAQ,CAAC;IAC7E,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,WAAW,oIAetB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Placement } from '@floating-ui/react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface PopoverProps {
|
|
3
3
|
placement?: Placement;
|
|
4
4
|
open: boolean;
|
|
5
5
|
renderTrigger: (args: {
|
|
@@ -15,5 +15,5 @@ export interface SelectInputPopoverProps {
|
|
|
15
15
|
onClose?: () => void;
|
|
16
16
|
onCloseEnd?: () => void;
|
|
17
17
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
//# sourceMappingURL=
|
|
18
|
+
export declare function Popover({ placement, open, renderTrigger, title, size, padding, children, onClose, onCloseEnd, }: PopoverProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=_Popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_Popover.d.ts","sourceRoot":"","sources":["../../../src/inputs/_Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EAOf,MAAM,oBAAoB,CAAC;AAS5B,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,CAAC,IAAI,EAAE;QACpB,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAChC,mBAAmB,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;YACvE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAID,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,IAAI,EACJ,aAAa,EACb,KAAK,EACL,IAAW,EACX,OAAc,EACd,QAAQ,EACR,OAAO,EACP,UAAU,GACX,EAAE,YAAY,+BAmFd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-841c8df",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
89
|
"@transferwise/less-config": "3.1.2",
|
|
90
90
|
"@transferwise/neptune-css": "14.26.3",
|
|
91
|
-
"@wise/
|
|
92
|
-
"@wise/
|
|
91
|
+
"@wise/wds-configs": "0.0.0",
|
|
92
|
+
"@wise/components-theming": "1.10.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.critical-comms {
|
|
2
|
+
border-radius: 16px;
|
|
3
|
+
border-radius: var(--radius-medium);
|
|
4
|
+
overflow: hidden;
|
|
4
5
|
}
|
|
5
|
-
.
|
|
6
|
-
color: var(--color-
|
|
6
|
+
.critical-comms .alert {
|
|
7
|
+
background-color: var(--color-sentiment-background-surface);
|
|
8
|
+
color: var(--color-sentiment-content-primary);
|
|
7
9
|
}
|
|
8
|
-
.
|
|
10
|
+
.critical-comms .alert .np-text-title-body {
|
|
11
|
+
color: var(--color-sentiment-content-primary);
|
|
12
|
+
}
|
|
13
|
+
.critical-comms .status-circle.negative {
|
|
9
14
|
background-color: #ffffff;
|
|
10
15
|
background-color: var(--color-background-screen);
|
|
11
16
|
}
|
|
12
|
-
.
|
|
13
|
-
color:
|
|
17
|
+
.critical-comms .status-circle.negative .status-icon {
|
|
18
|
+
color: #37517e;
|
|
19
|
+
color: var(--color-content-primary);
|
|
14
20
|
}
|
|
15
|
-
.
|
|
21
|
+
.critical-comms .alert__message .alert__action {
|
|
16
22
|
margin-top: 16px;
|
|
17
23
|
margin-top: var(--size-16);
|
|
18
24
|
}
|
|
19
|
-
.
|
|
20
|
-
--Button-
|
|
21
|
-
--Button-
|
|
22
|
-
--Button-
|
|
25
|
+
.critical-comms .wds-Button {
|
|
26
|
+
--Button-color: var(--color-content-primary);
|
|
27
|
+
--Button-color-hover: var(--color-content-primary);
|
|
28
|
+
--Button-color-active: var(--color-content-primary);
|
|
29
|
+
--Button-background: var(--color-background-screen);
|
|
30
|
+
--Button-background-hover: var(--color-sentiment-interactive-primary-hover);
|
|
31
|
+
--Button-background-active: var(--color-sentiment-interactive-primary-active);
|
|
32
|
+
}
|
|
33
|
+
.critical-comms .alert-warning .wds-Button {
|
|
34
|
+
--Button-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover);
|
|
35
|
+
--Button-background-active: var(--color-sentiment-interactive-secondary-neutral-active);
|
|
23
36
|
}
|
|
24
37
|
@media (min-width: 768px) {
|
|
25
|
-
.
|
|
38
|
+
.critical-comms .alert-warning .alert__message,
|
|
39
|
+
.critical-comms .alert-negative .alert__message,
|
|
40
|
+
.critical-comms .alert-neutral .alert__message {
|
|
26
41
|
flex-direction: row;
|
|
27
42
|
justify-content: space-between;
|
|
28
43
|
align-items: center;
|
|
29
44
|
width: 100%;
|
|
30
45
|
}
|
|
31
|
-
.
|
|
46
|
+
.critical-comms .alert-warning .alert__message .alert__action,
|
|
47
|
+
.critical-comms .alert-negative .alert__message .alert__action,
|
|
48
|
+
.critical-comms .alert-neutral .alert__message .alert__action {
|
|
32
49
|
margin-top: 0;
|
|
33
50
|
margin-left: 16px;
|
|
34
51
|
margin-left: var(--padding-small);
|
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
color: var(--color-contrast-overlay);
|
|
5
|
-
background-color: var(--color-sentiment-negative);
|
|
6
|
-
|
|
7
|
-
.np-text-title-body {
|
|
8
|
-
color: var(--color-contrast-overlay);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
.critical-comms {
|
|
2
|
+
border-radius: var(--radius-medium);
|
|
3
|
+
overflow: hidden;
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
.alert {
|
|
6
|
+
background-color: var(--color-sentiment-background-surface);
|
|
7
|
+
color: var(--color-sentiment-content-primary);
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
9
|
+
.np-text-title-body {
|
|
10
|
+
color: var(--color-sentiment-content-primary);
|
|
18
11
|
}
|
|
12
|
+
}
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
.status-circle.negative {
|
|
15
|
+
background-color: var(--color-background-screen);
|
|
16
|
+
|
|
17
|
+
.status-icon {
|
|
18
|
+
color: var(--color-content-primary);
|
|
24
19
|
}
|
|
20
|
+
}
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
--Button-background-active: var(--color-sentiment-negative-secondary-active);
|
|
22
|
+
.alert__message {
|
|
23
|
+
.alert__action {
|
|
24
|
+
margin-top: var(--size-16);
|
|
30
25
|
}
|
|
31
26
|
}
|
|
32
27
|
|
|
28
|
+
.wds-Button {
|
|
29
|
+
--Button-color: var(--color-content-primary);
|
|
30
|
+
--Button-color-hover: var(--color-content-primary);
|
|
31
|
+
--Button-color-active: var(--color-content-primary);
|
|
32
|
+
|
|
33
|
+
--Button-background: var(--color-background-screen);
|
|
34
|
+
--Button-background-hover: var(--color-sentiment-interactive-primary-hover);
|
|
35
|
+
--Button-background-active: var(--color-sentiment-interactive-primary-active);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.alert-warning .wds-Button {
|
|
39
|
+
--Button-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover);
|
|
40
|
+
--Button-background-active: var(--color-sentiment-interactive-secondary-neutral-active);
|
|
41
|
+
}
|
|
33
42
|
|
|
34
43
|
@media (--screen-md) {
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
.alert-warning,
|
|
45
|
+
.alert-negative,
|
|
46
|
+
.alert-neutral {
|
|
47
|
+
.alert__message {
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
align-items: center;
|
|
51
|
+
width: 100%;
|
|
52
|
+
|
|
53
|
+
.alert__action {
|
|
54
|
+
margin-top: 0;
|
|
55
|
+
margin-left: var(--padding-small);
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
|
-
}
|
|
60
|
+
}
|
|
@@ -18,6 +18,21 @@ export const Basic = {
|
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
export const Sentiments: Story = {
|
|
22
|
+
render: (args) => (
|
|
23
|
+
<>
|
|
24
|
+
<CriticalCommsBanner {...args} sentiment="negative" title="Your account is overdrawn" />
|
|
25
|
+
<CriticalCommsBanner {...args} sentiment="warning" title="Your account needs attention" />
|
|
26
|
+
<CriticalCommsBanner {...args} sentiment="neutral" title="Your transfer is being processed" />
|
|
27
|
+
</>
|
|
28
|
+
),
|
|
29
|
+
args: {
|
|
30
|
+
subtitle: 'Add money within the next 30 days',
|
|
31
|
+
action: { label: 'Take action', href: 'https://wise.com' },
|
|
32
|
+
className: 'm-b-1',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
21
36
|
export const Variants: Story = {
|
|
22
37
|
args: {
|
|
23
38
|
title: 'Your account is overdrawn',
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Alert as AlertIcon, ClockBorderless as ClockIcon } from '@transferwise/icons';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
1
4
|
import Alert from '../alert';
|
|
2
5
|
import { clsx } from 'clsx';
|
|
6
|
+
import { Sentiment } from '../common';
|
|
7
|
+
import Circle, { CircleProps } from '../common/circle';
|
|
8
|
+
import SentimentSurface from '../sentimentSurface';
|
|
9
|
+
|
|
10
|
+
export type CriticalCommsBannerSentiment =
|
|
11
|
+
| `${Sentiment.WARNING}`
|
|
12
|
+
| `${Sentiment.NEGATIVE}`
|
|
13
|
+
| `${Sentiment.NEUTRAL}`;
|
|
3
14
|
|
|
4
15
|
export type CriticalCommsBannerProps = {
|
|
5
16
|
title: string;
|
|
@@ -9,20 +20,64 @@ export type CriticalCommsBannerProps = {
|
|
|
9
20
|
href?: string;
|
|
10
21
|
onClick?: () => void;
|
|
11
22
|
};
|
|
23
|
+
sentiment?: CriticalCommsBannerSentiment;
|
|
12
24
|
className?: string;
|
|
13
25
|
};
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
const makeSurface = (sentiment: CriticalCommsBannerSentiment) => {
|
|
28
|
+
const Surface = (props: PropsWithChildren<Pick<CircleProps, 'className'>>) => (
|
|
29
|
+
<SentimentSurface as="span" emphasis="elevated" sentiment={sentiment} {...props} />
|
|
30
|
+
);
|
|
31
|
+
Surface.displayName = `CriticalCommsSurface(${sentiment})`;
|
|
32
|
+
return Surface;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const iconConfig: {
|
|
36
|
+
sentiment: CriticalCommsBannerSentiment;
|
|
37
|
+
Icon: React.ElementType;
|
|
38
|
+
iconColor: 'light' | 'dark';
|
|
39
|
+
}[] = [
|
|
40
|
+
{ sentiment: Sentiment.NEGATIVE, Icon: AlertIcon, iconColor: 'light' },
|
|
41
|
+
{ sentiment: Sentiment.WARNING, Icon: AlertIcon, iconColor: 'dark' },
|
|
42
|
+
{ sentiment: Sentiment.NEUTRAL, Icon: ClockIcon, iconColor: 'dark' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const iconBySentiment = Object.fromEntries(
|
|
46
|
+
iconConfig.map(({ sentiment, Icon, iconColor }) => [
|
|
47
|
+
sentiment,
|
|
48
|
+
<Circle
|
|
49
|
+
key={sentiment}
|
|
50
|
+
as={makeSurface(sentiment)}
|
|
51
|
+
size={32}
|
|
52
|
+
className={`status-circle ${sentiment}`}
|
|
53
|
+
>
|
|
54
|
+
<Icon className={`status-icon ${iconColor}`} />
|
|
55
|
+
</Circle>,
|
|
56
|
+
]),
|
|
57
|
+
) as Record<CriticalCommsBannerSentiment, React.ReactNode>;
|
|
58
|
+
|
|
59
|
+
function CriticalCommsBanner({
|
|
60
|
+
title,
|
|
61
|
+
subtitle,
|
|
62
|
+
action,
|
|
63
|
+
sentiment = Sentiment.NEGATIVE,
|
|
64
|
+
className,
|
|
65
|
+
}: CriticalCommsBannerProps) {
|
|
16
66
|
return (
|
|
17
|
-
<
|
|
67
|
+
<SentimentSurface
|
|
68
|
+
sentiment={sentiment}
|
|
69
|
+
emphasis="elevated"
|
|
70
|
+
className={clsx('critical-comms', className)}
|
|
71
|
+
>
|
|
18
72
|
<Alert
|
|
19
73
|
title={title}
|
|
20
74
|
message={subtitle}
|
|
21
75
|
action={{ onClick: action?.onClick, target: action?.href, text: action?.label }}
|
|
22
76
|
className={className}
|
|
23
|
-
type=
|
|
77
|
+
type={sentiment}
|
|
78
|
+
icon={iconBySentiment[sentiment]}
|
|
24
79
|
/>
|
|
25
|
-
</
|
|
80
|
+
</SentimentSurface>
|
|
26
81
|
);
|
|
27
82
|
}
|
|
28
83
|
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
@import "./_BottomSheet.less";
|
|
2
|
+
@import "./_ButtonInput.less";
|
|
3
|
+
@import "./_Popover.less";
|
|
4
|
+
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
5
|
+
|
|
6
|
+
.np-select-input-content {
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.np-select-input-placeholder {
|
|
13
|
+
color: var(--color-content-tertiary);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.np-select-input-options-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
height: 100%;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (--screen-sm) {
|
|
26
|
+
& {
|
|
27
|
+
max-height: 28rem /* 448px */;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.np-select-input-options-status {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
column-gap: var(--size-8);
|
|
36
|
+
padding: var(--size-8) var(--size-24) 0px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.np-select-input-options-status-icon {
|
|
40
|
+
padding: 0 var(--size-4);
|
|
41
|
+
color: var(--color-content-tertiary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.np-select-input-query-container {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
padding: var(--size-8);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.np-select-input-listbox-container {
|
|
51
|
+
position: relative;
|
|
52
|
+
height: var(--initial-height);
|
|
53
|
+
scroll-padding-top: var(--size-8);
|
|
54
|
+
scroll-padding-bottom: var(--size-8);
|
|
55
|
+
overflow-y: auto;
|
|
56
|
+
|
|
57
|
+
@media (--screen-sm) {
|
|
58
|
+
& {
|
|
59
|
+
height: auto;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&--virtualized {
|
|
64
|
+
/* The wrapping element shrinks this as needed */
|
|
65
|
+
height: 100vh;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--has-group {
|
|
69
|
+
scroll-padding-top: var(--size-32);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.np-select-input-listbox {
|
|
74
|
+
border-radius: var(--radius-small);
|
|
75
|
+
padding: var(--size-8);
|
|
76
|
+
|
|
77
|
+
.focus-ring();
|
|
78
|
+
--ring-outline-offset: calc(-1 * var(--ring-outline-width));
|
|
79
|
+
|
|
80
|
+
.np-select-input-listbox-container--virtualized & {
|
|
81
|
+
/* Adopted from `VList` in virtua: https://github.com/inokawa/virtua/blob/7f6ed5b37df6b480d4ff350f3960067c5b3519d2/src/react/VList.tsx#L113-L116 */
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
contain: strict;
|
|
84
|
+
height: 100%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.np-select-input-separator-item {
|
|
89
|
+
margin: var(--size-8);
|
|
90
|
+
border-top-width: 1px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.np-select-input-group-item {
|
|
94
|
+
&--without-needle:first-child {
|
|
95
|
+
margin-top: calc(-1 * var(--size-8));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.np-select-input-group-item-header {
|
|
100
|
+
position: sticky;
|
|
101
|
+
top: 0px;
|
|
102
|
+
z-index: 10;
|
|
103
|
+
background-color: var(--color-background-elevated);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.np-select-input-option-container {
|
|
107
|
+
display: flex;
|
|
108
|
+
cursor: default;
|
|
109
|
+
user-select: none;
|
|
110
|
+
align-items: center;
|
|
111
|
+
column-gap: var(--size-8);
|
|
112
|
+
border-radius: var(--radius-small);
|
|
113
|
+
padding: var(--size-12) var(--size-16);
|
|
114
|
+
color: var(--color-interactive-primary);
|
|
115
|
+
|
|
116
|
+
&:focus {
|
|
117
|
+
outline: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&--active {
|
|
121
|
+
box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&--disabled {
|
|
125
|
+
opacity: 0.45;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.np-select-input-option-check {
|
|
130
|
+
&--not-selected {
|
|
131
|
+
visibility: hidden;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.np-select-input-option {
|
|
136
|
+
flex: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.np-select-input-option-content-container {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
column-gap: var(--size-8);
|
|
143
|
+
color: var(--color-content-primary);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.np-select-input-option-content-icon {
|
|
147
|
+
display: flex;
|
|
148
|
+
|
|
149
|
+
&--not-within-trigger {
|
|
150
|
+
align-self: flex-start;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.np-select-input-option-content-text {
|
|
155
|
+
display: flex;
|
|
156
|
+
flex: 1;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.np-select-input-option-content-text-secondary {
|
|
162
|
+
color: var(--color-content-secondary);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.np-select-input-option-content-text-within-trigger {
|
|
166
|
+
overflow: hidden;
|
|
167
|
+
text-overflow: ellipsis;
|
|
168
|
+
white-space: nowrap;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.np-select-input-option-content-text-line-1 {
|
|
172
|
+
> :not([hidden]) ~ :not([hidden]) {
|
|
173
|
+
margin-right: var(--size-8);
|
|
174
|
+
margin-left: var(--size-8);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.np-select-input-footer {
|
|
179
|
+
padding: var(--size-4) var(--size-24) var(--size-16);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.np-select-input-addon-container {
|
|
183
|
+
pointer-events: none;
|
|
184
|
+
margin-inline-start: var(--size-4);
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
|
|
188
|
+
& > :not([hidden]) ~ :not([hidden]) {
|
|
189
|
+
margin-inline-start: var(--size-4);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.np-select-input-addon {
|
|
194
|
+
border-width: 0;
|
|
195
|
+
background: none;
|
|
196
|
+
|
|
197
|
+
display: inline-flex;
|
|
198
|
+
height: var(--size-24);
|
|
199
|
+
width: var(--size-24);
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
border-radius: 0.125rem /* 2px */; /* TODO: Tokenize */
|
|
203
|
+
|
|
204
|
+
&--interactive {
|
|
205
|
+
pointer-events: auto;
|
|
206
|
+
color: var(--color-interactive-secondary);
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
color: var(--color-interactive-secondary-hover);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.focus-ring();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.np-select-input-addon-separator {
|
|
217
|
+
height: var(--size-24);
|
|
218
|
+
border-inline-start: 1px solid var(--color-border-neutral);
|
|
219
|
+
}
|