@transferwise/components 46.130.1 → 46.130.3
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/alert/Alert.js +4 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +4 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +6 -4
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +6 -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 +99 -90
- 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 +9 -0
- 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 +99 -90
- package/build/types/alert/Alert.d.ts +2 -0
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +1 -0
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -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/package.json +1 -1
- package/src/alert/Alert.tsx +6 -1
- package/src/criticalBanner/CriticalCommsBanner.css +9 -0
- package/src/criticalBanner/CriticalCommsBanner.less +13 -0
- package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +15 -0
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +28 -2
- package/src/criticalBanner/CriticalCommsBanner.tsx +10 -1
- package/src/index.ts +0 -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 +99 -90
- package/src/main.less +1 -1
- 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,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Context for passing props to the SelectInputTriggerButton component.
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectInputTriggerButtonPropsContextValue {
|
|
6
|
+
ref?: React.ForwardedRef<HTMLButtonElement | null>;
|
|
7
|
+
id?: string;
|
|
8
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
9
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Context for passing props to the SelectInputTriggerButton component.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SelectInputTriggerButtonPropsContext: React.Context<SelectInputTriggerButtonPropsContextValue>;
|
|
17
|
+
/**
|
|
18
|
+
* Context for providing the total count of items in a SelectInput.
|
|
19
|
+
* Used for ARIA accessibility to inform screen readers about the total number of options.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SelectInputItemsCountContext: React.Context<number | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Context for providing the current item position in a SelectInput.
|
|
24
|
+
* Used for ARIA accessibility to inform screen readers about the position of the option.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SelectInputItemPositionContext: React.Context<number | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Context indicating whether an option's content is rendered within the trigger button.
|
|
29
|
+
* When true, certain styling adjustments are applied to make the content fit better in the trigger.
|
|
30
|
+
*/
|
|
31
|
+
export declare const SelectInputOptionContentWithinTriggerContext: React.Context<boolean>;
|
|
32
|
+
export type { WithInputAttributesProps } from '../contexts';
|
|
33
|
+
//# sourceMappingURL=SelectInput.contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.contexts.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/SelectInput.contexts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,yCAAyC;IACxD,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACnD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACjD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,oCAAoC,0DACa,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,mCAA+C,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,mCAA+C,CAAC;AAE3F;;;GAGG;AACH,eAAO,MAAM,4CAA4C,wBAAuB,CAAC;AAGjF,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SelectInputProps } from './SelectInput.types';
|
|
2
|
+
/**
|
|
3
|
+
* SelectInput component allows users to select an option from a dropdown list.
|
|
4
|
+
* Supports filtering, multiple selection, and customization.
|
|
5
|
+
*/
|
|
6
|
+
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;
|
|
7
|
+
export declare namespace SelectInput {
|
|
8
|
+
var sortByRelevance: typeof import("./SelectInput.utils").sortByRelevance;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=SelectInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/SelectInput.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,KAAK,EAAE,EACjE,EAAE,EAAE,MAAM,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,KAAK,EAAE,eAAe,EACtB,aAAa,EACb,WAAoB,EACpB,YAAY,EACZ,aAAoC,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,+BAwMxB;yBAnOe,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.messages.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/SelectInput.messages.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMG"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { WithInputAttributesProps } from './contexts';
|
|
4
|
-
import { ButtonProps } from '../button/Button.types';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../../button/Button.types';
|
|
3
|
+
import { WithInputAttributesProps } from './SelectInput.contexts';
|
|
5
4
|
export interface SelectInputOptionItem<T = string> {
|
|
6
5
|
type: 'option';
|
|
7
6
|
value: T;
|
|
@@ -21,22 +20,6 @@ export interface SelectInputSeparatorItem {
|
|
|
21
20
|
type: 'separator';
|
|
22
21
|
}
|
|
23
22
|
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;
|
|
40
23
|
export interface SelectInputProps<T = string, M extends boolean = false> {
|
|
41
24
|
id?: string;
|
|
42
25
|
/**
|
|
@@ -103,21 +86,12 @@ export interface SelectInputProps<T = string, M extends boolean = false> {
|
|
|
103
86
|
onClose?: () => void;
|
|
104
87
|
onClear?: () => void;
|
|
105
88
|
}
|
|
106
|
-
export
|
|
107
|
-
export
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
type
|
|
111
|
-
export type
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
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
|
|
89
|
+
export type { SelectInputTriggerButtonElementType, SelectInputTriggerButtonProps, } from './TriggerButton';
|
|
90
|
+
export type { SelectInputClearButtonProps } from './ClearButton';
|
|
91
|
+
export type { SelectInputOptionContentProps } from './OptionContent';
|
|
92
|
+
export type { SelectInputOptionProps } from './Option';
|
|
93
|
+
export type { SelectInputItemViewProps } from './ItemView';
|
|
94
|
+
export type { SelectInputGroupItemViewProps } from './ItemView/GroupItemView';
|
|
95
|
+
export type { SelectInputOptionsProps } from './Options';
|
|
96
|
+
export type { SelectInputOptionsContainerProps } from './Options/OptionsContainer';
|
|
97
|
+
//# sourceMappingURL=SelectInput.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.types.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/SelectInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;IACT,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,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9D,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACnF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,YAAY,EACV,mCAAmC,EACnC,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC9E,YAAY,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACzD,YAAY,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';
|
|
2
|
+
export declare const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to a normalized, searchable format by:
|
|
5
|
+
* - Trimming whitespace
|
|
6
|
+
* - Normalizing whitespace (convert multiple spaces to single space)
|
|
7
|
+
* - Converting to NFD normalization form to handle diacritics
|
|
8
|
+
* - Removing combining diacritical marks
|
|
9
|
+
* - Converting to lowercase
|
|
10
|
+
*/
|
|
11
|
+
export declare function searchableString(value: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts searchable strings from a value.
|
|
14
|
+
* - If the value is a string, returns a normalized version.
|
|
15
|
+
* - If the value is an object, extracts all string values and normalizes them.
|
|
16
|
+
* - Otherwise returns an empty array.
|
|
17
|
+
*/
|
|
18
|
+
export declare function inferSearchableStrings(value: unknown): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.
|
|
21
|
+
*/
|
|
22
|
+
export declare function dedupeSelectInputOptionItem<T>(item: SelectInputOptionItem<T>, existingValues: Set<T>, compareValues?: (a: T, b: T) => boolean): SelectInputOptionItem<T | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the `value` of duplicate option items to `undefined`, hiding them when
|
|
25
|
+
* rendered. Indexes are kept intact within groups to preserve the active item
|
|
26
|
+
* between filter changes when possible.
|
|
27
|
+
*/
|
|
28
|
+
export declare function dedupeSelectInputItems<T>(items: readonly SelectInputItem<T>[], compareValues?: (a: T, b: T) => boolean): SelectInputItem<T | undefined>[];
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a SelectInputOptionItem matches the search needle.
|
|
31
|
+
*/
|
|
32
|
+
export declare function selectInputOptionItemIncludesNeedle<T>(item: SelectInputOptionItem<T>, needle: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Filters SelectInputItems based on the provided predicate function.
|
|
35
|
+
* For group items, it checks if any of their options match the predicate.
|
|
36
|
+
*/
|
|
37
|
+
export declare function filterSelectInputItems<T>(items: readonly SelectInputItem<T>[], predicate: (item: SelectInputOptionItem<T>) => boolean): SelectInputItem<T>[];
|
|
38
|
+
/**
|
|
39
|
+
* Flattens and sorts filtered options using the provided comparator.
|
|
40
|
+
* Extracts all options from groups, filters out undefined values (deduplicated items),
|
|
41
|
+
* sorts them, and returns as a flat list of option items.
|
|
42
|
+
*/
|
|
43
|
+
export declare function sortSelectInputItems<T>(items: readonly SelectInputItem<T | undefined>[], compareFn: (a: SelectInputOptionItem<NonNullable<T>>, b: SelectInputOptionItem<NonNullable<T>>, searchQuery: string) => number, searchQuery: string): SelectInputItem<NonNullable<T>>[];
|
|
44
|
+
/**
|
|
45
|
+
* A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.
|
|
46
|
+
* Prioritizes: exact matches > starts with > contains > alphabetical.
|
|
47
|
+
*
|
|
48
|
+
* @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <SelectInput
|
|
53
|
+
* filterable
|
|
54
|
+
* sortFilteredOptions={sortByRelevance((value) => value.name)}
|
|
55
|
+
* // ...
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function sortByRelevance<T>(getLabel?: (value: T) => string): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number;
|
|
60
|
+
//# sourceMappingURL=SelectInput.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.utils.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/SelectInput.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAW7C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,YAYpD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EACtB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GACtC,qBAAqB,CAAC,CAAC,GAAG,SAAS,CAAC,CAUtC;AA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../../utils';
|
|
2
|
+
export type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
3
|
+
export type SelectInputTriggerButtonProps<T extends SelectInputTriggerButtonElementType = 'button'> = Merge<React.ComponentPropsWithoutRef<T>, {
|
|
4
|
+
as?: T;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* The trigger button component for SelectInput.
|
|
8
|
+
* Uses Headless UI's ListboxButton with polymorphic support to allow
|
|
9
|
+
* rendering as different element types.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({ as, ...restProps }: SelectInputTriggerButtonProps<T>): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SelectInputTriggerButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInputTriggerButton.d.ts","sourceRoot":"","sources":["../../../../../src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,MAAM,mCAAmC,GAAG,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC;AAEjF,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;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,EAAE,EACjG,EAAkB,EAClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+BAclC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/inputs/SelectInput/TriggerButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,mCAAmC,EACnC,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './ClearButton';
|
|
2
|
+
export * from './Option';
|
|
3
|
+
export * from './OptionContent';
|
|
4
|
+
export * from './TriggerButton';
|
|
5
|
+
export * from './ItemView';
|
|
6
|
+
export * from './Options';
|
|
7
|
+
export * from './BottomSheet';
|
|
8
|
+
export * from './Popover';
|
|
9
|
+
export * from './ButtonInput';
|
|
10
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/components.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './SelectInput';
|
|
2
|
+
export * from './SelectInput.types';
|
|
3
|
+
export * from './ClearButton';
|
|
4
|
+
export * from './Option';
|
|
5
|
+
export * from './OptionContent';
|
|
6
|
+
export * from './TriggerButton';
|
|
7
|
+
export * from './DefaultRenderTrigger';
|
|
8
|
+
export * from './ItemView';
|
|
9
|
+
export * from './Options';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/inputs/SelectInput/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
package/src/alert/Alert.tsx
CHANGED
|
@@ -28,6 +28,8 @@ export type AlertAction = {
|
|
|
28
28
|
target?: string;
|
|
29
29
|
text: React.ReactNode;
|
|
30
30
|
onClick?: () => void;
|
|
31
|
+
/** Controls the rendered element: `'link'` (default) renders a Link, `'button'` renders a Button. When `'button'` is used with `href`, renders an anchor styled as a button. */
|
|
32
|
+
as?: 'button' | 'link';
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
/** @deprecated Use `"top" | "bottom"` instead. */
|
|
@@ -231,7 +233,7 @@ export default function Alert({
|
|
|
231
233
|
</Body>
|
|
232
234
|
</div>
|
|
233
235
|
{action &&
|
|
234
|
-
('href' in action ? (
|
|
236
|
+
('href' in action && action.as !== 'button' ? (
|
|
235
237
|
<Link
|
|
236
238
|
href={action.href}
|
|
237
239
|
aria-label={action['aria-label']}
|
|
@@ -246,6 +248,9 @@ export default function Alert({
|
|
|
246
248
|
) : (
|
|
247
249
|
<Button
|
|
248
250
|
v2
|
|
251
|
+
as={action.href ? 'a' : 'button'}
|
|
252
|
+
href={action.href}
|
|
253
|
+
target={action.target}
|
|
249
254
|
size="sm"
|
|
250
255
|
sentiment="default"
|
|
251
256
|
aria-label={action['aria-label']}
|
|
@@ -31,6 +31,15 @@
|
|
|
31
31
|
--Button-background-hover: var(--color-sentiment-interactive-primary-hover);
|
|
32
32
|
--Button-background-active: var(--color-sentiment-interactive-primary-active);
|
|
33
33
|
}
|
|
34
|
+
.critical-comms .wds-Button[class] {
|
|
35
|
+
color: var(--Button-color);
|
|
36
|
+
}
|
|
37
|
+
.critical-comms .wds-Button[class]:hover {
|
|
38
|
+
color: var(--Button-color-hover);
|
|
39
|
+
}
|
|
40
|
+
.critical-comms .wds-Button[class]:active {
|
|
41
|
+
color: var(--Button-color-active);
|
|
42
|
+
}
|
|
34
43
|
.critical-comms .alert-warning .wds-Button {
|
|
35
44
|
--Button-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover);
|
|
36
45
|
--Button-background-active: var(--color-sentiment-interactive-secondary-neutral-active);
|
|
@@ -34,6 +34,19 @@
|
|
|
34
34
|
--Button-background: var(--color-background-screen);
|
|
35
35
|
--Button-background-hover: var(--color-sentiment-interactive-primary-hover);
|
|
36
36
|
--Button-background-active: var(--color-sentiment-interactive-primary-active);
|
|
37
|
+
|
|
38
|
+
// Override legacy neptune CSS selector `.np-theme-personal .alert-negative a`
|
|
39
|
+
&[class] {
|
|
40
|
+
color: var(--Button-color);
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
color: var(--Button-color-hover);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:active {
|
|
47
|
+
color: var(--Button-color-active);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
.alert-warning .wds-Button {
|
|
@@ -68,3 +68,18 @@ export const Zoom: Story = {
|
|
|
68
68
|
},
|
|
69
69
|
...withVariantConfig(['400%']),
|
|
70
70
|
};
|
|
71
|
+
|
|
72
|
+
export const WithoutAction: Story = {
|
|
73
|
+
render: (args) => (
|
|
74
|
+
<>
|
|
75
|
+
<CriticalCommsBanner {...args} sentiment="negative" />
|
|
76
|
+
<CriticalCommsBanner {...args} sentiment="warning" />
|
|
77
|
+
<CriticalCommsBanner {...args} sentiment="neutral" />
|
|
78
|
+
</>
|
|
79
|
+
),
|
|
80
|
+
args: {
|
|
81
|
+
subtitle: 'Add money within the next 30 days',
|
|
82
|
+
className: 'm-b-1',
|
|
83
|
+
},
|
|
84
|
+
...withVariantConfig(['default']),
|
|
85
|
+
};
|
|
@@ -19,10 +19,36 @@ describe('CriticalCommsBanner', () => {
|
|
|
19
19
|
expect(screen.getByTestId('alert')).toHaveClass('alert-negative');
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it('renders the action', () => {
|
|
22
|
+
it('renders the action as a link with correct href', () => {
|
|
23
23
|
render(<CriticalCommsBanner {...defaultProps} />);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const action = screen.getByText('Take action');
|
|
26
|
+
expect(action.closest('a')).toHaveAttribute('href', 'https://wise.com');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders the action as a button when only onClick is provided', () => {
|
|
30
|
+
const onClick = jest.fn();
|
|
31
|
+
render(<CriticalCommsBanner title="Test title" action={{ label: 'Take action', onClick }} />);
|
|
32
|
+
|
|
33
|
+
expect(screen.getByText('Take action').closest('button')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('passes target to the action link', () => {
|
|
37
|
+
render(
|
|
38
|
+
<CriticalCommsBanner
|
|
39
|
+
{...defaultProps}
|
|
40
|
+
action={{ label: 'Take action', href: 'https://wise.com', target: '_blank' }}
|
|
41
|
+
/>,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
expect(screen.getByText('Take action').closest('a')).toHaveAttribute('target', '_blank');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('does not render the action when action is undefined', () => {
|
|
48
|
+
render(<CriticalCommsBanner title="Test title" />);
|
|
49
|
+
|
|
50
|
+
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
51
|
+
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
26
52
|
});
|
|
27
53
|
|
|
28
54
|
describe('sentiment variants', () => {
|
|
@@ -18,6 +18,7 @@ export type CriticalCommsBannerProps = {
|
|
|
18
18
|
action?: {
|
|
19
19
|
label: string;
|
|
20
20
|
href?: string;
|
|
21
|
+
target?: HTMLAnchorElement['target'];
|
|
21
22
|
onClick?: () => void;
|
|
22
23
|
};
|
|
23
24
|
sentiment?: CriticalCommsBannerSentiment;
|
|
@@ -66,7 +67,15 @@ function CriticalCommsBanner({
|
|
|
66
67
|
<Alert
|
|
67
68
|
title={title}
|
|
68
69
|
message={subtitle}
|
|
69
|
-
action={
|
|
70
|
+
action={
|
|
71
|
+
action && {
|
|
72
|
+
onClick: action.onClick,
|
|
73
|
+
href: action.href,
|
|
74
|
+
target: action.target,
|
|
75
|
+
text: action.label,
|
|
76
|
+
as: 'button',
|
|
77
|
+
}
|
|
78
|
+
}
|
|
70
79
|
className={className}
|
|
71
80
|
type={sentiment}
|
|
72
81
|
icon={iconBySentiment[sentiment]}
|
package/src/index.ts
CHANGED
|
@@ -182,7 +182,6 @@ export {
|
|
|
182
182
|
SelectInput,
|
|
183
183
|
SelectInputOptionContent,
|
|
184
184
|
SelectInputTriggerButton,
|
|
185
|
-
sortByRelevance,
|
|
186
185
|
} from './inputs/SelectInput';
|
|
187
186
|
export { TextArea } from './inputs/TextArea';
|
|
188
187
|
export { default as InstructionsList } from './instructionsList';
|
|
@@ -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();
|