@transferwise/components 46.50.1 → 46.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/accordion/AccordionItem/AccordionItem.js +3 -7
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +3 -3
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +2 -6
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +2 -2
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +2 -6
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +2 -2
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +3 -7
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +3 -3
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatar/Avatar.js +2 -6
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +2 -2
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +2 -6
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +2 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/body/Body.js +2 -6
- package/build/body/Body.js.map +1 -1
- package/build/body/Body.mjs +2 -2
- package/build/body/Body.mjs.map +1 -1
- package/build/button/Button.js +2 -6
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +2 -2
- package/build/button/Button.mjs.map +1 -1
- package/build/card/Card.js +4 -8
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +4 -4
- package/build/card/Card.mjs.map +1 -1
- package/build/carousel/Carousel.js +5 -9
- package/build/carousel/Carousel.js.map +1 -1
- package/build/carousel/Carousel.mjs +5 -5
- package/build/carousel/Carousel.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +3 -7
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +3 -3
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/checkboxButton/CheckboxButton.js +2 -6
- package/build/checkboxButton/CheckboxButton.js.map +1 -1
- package/build/checkboxButton/CheckboxButton.mjs +2 -2
- package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
- package/build/chevron/Chevron.js +3 -7
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +3 -3
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +2 -6
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +2 -2
- package/build/chips/Chip.mjs.map +1 -1
- package/build/chips/Chips.js +3 -7
- package/build/chips/Chips.js.map +1 -1
- package/build/chips/Chips.mjs +3 -3
- package/build/chips/Chips.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +3 -7
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +3 -3
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/Option/Option.js +3 -7
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs +3 -3
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/common/RadioButton/RadioButton.js +2 -6
- package/build/common/RadioButton/RadioButton.js.map +1 -1
- package/build/common/RadioButton/RadioButton.mjs +2 -2
- package/build/common/RadioButton/RadioButton.mjs.map +1 -1
- package/build/common/action/Action.js +2 -6
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +2 -2
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +2 -6
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +2 -2
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/card/Card.js +2 -6
- package/build/common/card/Card.js.map +1 -1
- package/build/common/card/Card.mjs +2 -2
- package/build/common/card/Card.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.js +2 -6
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +2 -2
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/common/flowHeader/FlowHeader.js +3 -6
- package/build/common/flowHeader/FlowHeader.js.map +1 -1
- package/build/common/flowHeader/FlowHeader.mjs +3 -3
- package/build/common/flowHeader/FlowHeader.mjs.map +1 -1
- package/build/common/panel/Panel.js +4 -8
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +4 -4
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +4 -8
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +4 -4
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +2 -6
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +2 -2
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +2 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +2 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +2 -6
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +2 -2
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/dateLookup/tableLink/TableLink.js +15 -21
- package/build/dateLookup/tableLink/TableLink.js.map +1 -1
- package/build/dateLookup/tableLink/TableLink.mjs +16 -18
- package/build/dateLookup/tableLink/TableLink.mjs.map +1 -1
- package/build/decision/Decision.js +3 -7
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +3 -3
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +4 -8
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +4 -4
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +6 -10
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +6 -6
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +2 -6
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +2 -2
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +5 -9
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +5 -5
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/field/Field.js +2 -6
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +2 -2
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +4 -8
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +4 -4
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +3 -7
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +3 -3
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/flowNavigation/backButton/BackButton.js +2 -6
- package/build/flowNavigation/backButton/BackButton.js.map +1 -1
- package/build/flowNavigation/backButton/BackButton.mjs +2 -2
- package/build/flowNavigation/backButton/BackButton.mjs.map +1 -1
- package/build/header/Header.js +3 -7
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +3 -3
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/zh-HK.json +2 -0
- package/build/i18n/zh-HK.json.js +2 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +2 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/image/Image.js +2 -6
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +2 -2
- package/build/image/Image.mjs.map +1 -1
- package/build/info/Info.js +2 -6
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +2 -2
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +2 -6
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +2 -2
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/Input.js +2 -6
- package/build/inputs/Input.js.map +1 -1
- package/build/inputs/Input.mjs +2 -2
- package/build/inputs/Input.mjs.map +1 -1
- package/build/inputs/InputGroup.js +3 -7
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +3 -3
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/inputs/SelectInput.js +118 -48
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +120 -49
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/TextArea.js +2 -6
- package/build/inputs/TextArea.js.map +1 -1
- package/build/inputs/TextArea.mjs +2 -2
- package/build/inputs/TextArea.mjs.map +1 -1
- package/build/inputs/_BottomSheet.js +2 -6
- package/build/inputs/_BottomSheet.js.map +1 -1
- package/build/inputs/_BottomSheet.mjs +2 -2
- package/build/inputs/_BottomSheet.mjs.map +1 -1
- package/build/inputs/_ButtonInput.js +2 -6
- package/build/inputs/_ButtonInput.js.map +1 -1
- package/build/inputs/_ButtonInput.mjs +2 -2
- package/build/inputs/_ButtonInput.mjs.map +1 -1
- package/build/inputs/_Popover.js +3 -7
- package/build/inputs/_Popover.js.map +1 -1
- package/build/inputs/_Popover.mjs +3 -3
- package/build/inputs/_Popover.mjs.map +1 -1
- package/build/inputs/_common.js +2 -6
- package/build/inputs/_common.js.map +1 -1
- package/build/inputs/_common.mjs +2 -2
- package/build/inputs/_common.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +2 -6
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +2 -2
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/label/Label.js +2 -6
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +2 -2
- package/build/label/Label.mjs.map +1 -1
- package/build/link/Link.js +2 -6
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +2 -2
- package/build/link/Link.mjs.map +1 -1
- package/build/listItem/ListItem.js +3 -7
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +3 -3
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/loader/Loader.js +2 -6
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +4 -4
- package/build/loader/Loader.mjs.map +1 -1
- package/build/logo/Logo.js +2 -6
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs +2 -2
- package/build/logo/Logo.mjs.map +1 -1
- package/build/main.css +10 -0
- package/build/modal/Modal.js +7 -11
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +7 -7
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +17 -39
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +17 -35
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/navigationOption/NavigationOption.js +2 -6
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +2 -2
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +4 -8
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +4 -4
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +3 -7
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +3 -3
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/popover/Popover.js +2 -6
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +2 -2
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +2 -6
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +2 -2
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progress/Progress.js +2 -6
- package/build/progress/Progress.js.map +1 -1
- package/build/progress/Progress.mjs +2 -2
- package/build/progress/Progress.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +2 -6
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +2 -2
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +3 -4
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +3 -3
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardGroup.js +2 -3
- package/build/promoCard/PromoCardGroup.js.map +1 -1
- package/build/promoCard/PromoCardGroup.mjs +2 -2
- package/build/promoCard/PromoCardGroup.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +2 -6
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +2 -2
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/radio/Radio.js +5 -9
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +5 -5
- package/build/radio/Radio.mjs.map +1 -1
- package/build/section/Section.js +2 -6
- package/build/section/Section.js.map +1 -1
- package/build/section/Section.mjs +2 -2
- package/build/section/Section.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +5 -9
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +5 -5
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +9 -10
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +9 -9
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +2 -6
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +2 -2
- package/build/select/option/Option.mjs.map +1 -1
- package/build/select/searchBox/SearchBox.js +4 -8
- package/build/select/searchBox/SearchBox.js.map +1 -1
- package/build/select/searchBox/SearchBox.mjs +6 -6
- package/build/select/searchBox/SearchBox.mjs.map +1 -1
- package/build/selectOption/SelectOption.js +4 -8
- package/build/selectOption/SelectOption.js.map +1 -1
- package/build/selectOption/SelectOption.mjs +4 -4
- package/build/selectOption/SelectOption.mjs.map +1 -1
- package/build/slidingPanel/SlidingPanel.js +2 -6
- package/build/slidingPanel/SlidingPanel.js.map +1 -1
- package/build/slidingPanel/SlidingPanel.mjs +2 -2
- package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +3 -7
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +3 -3
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +3 -7
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +3 -3
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/styles/inputs/SelectInput.css +10 -0
- package/build/styles/main.css +10 -0
- package/build/summary/Summary.js +2 -6
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +2 -2
- package/build/summary/Summary.mjs.map +1 -1
- package/build/switch/Switch.js +2 -6
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +2 -2
- package/build/switch/Switch.mjs.map +1 -1
- package/build/tabs/Tab.js +6 -7
- package/build/tabs/Tab.js.map +1 -1
- package/build/tabs/Tab.mjs +6 -6
- package/build/tabs/Tab.mjs.map +1 -1
- package/build/tabs/Tabs.js +2 -3
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +2 -2
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +3 -7
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +3 -3
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +3 -7
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +3 -3
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +3 -7
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +3 -3
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +6 -7
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +6 -6
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +2 -6
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.js +2 -6
- package/build/typeahead/typeaheadOption/TypeaheadOption.js.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs +2 -2
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs.map +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/chevron/Chevron.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/build/types/tabs/Tab.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +2 -6
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +2 -2
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +2 -6
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +2 -2
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +5 -9
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +5 -5
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +3 -7
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +3 -3
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +2 -6
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs +2 -2
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
- package/package.json +6 -5
- package/src/accordion/AccordionItem/AccordionItem.tsx +5 -9
- package/src/actionButton/ActionButton.tsx +2 -2
- package/src/actionOption/ActionOption.tsx +2 -2
- package/src/alert/Alert.tsx +3 -3
- package/src/avatar/Avatar.tsx +2 -2
- package/src/badge/Badge.tsx +2 -2
- package/src/body/Body.tsx +2 -2
- package/src/button/Button.tsx +2 -2
- package/src/card/Card.tsx +4 -4
- package/src/carousel/Carousel.tsx +5 -5
- package/src/checkbox/Checkbox.tsx +3 -3
- package/src/checkboxButton/CheckboxButton.tsx +2 -2
- package/src/chevron/Chevron.tsx +3 -12
- package/src/chips/Chip.tsx +2 -2
- package/src/chips/Chips.tsx +3 -3
- package/src/circularButton/CircularButton.tsx +4 -7
- package/src/common/Option/Option.tsx +3 -3
- package/src/common/RadioButton/RadioButton.tsx +2 -2
- package/src/common/action/Action.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +2 -2
- package/src/common/card/Card.tsx +2 -2
- package/src/common/closeButton/CloseButton.tsx +2 -2
- package/src/common/flowHeader/FlowHeader.tsx +3 -3
- package/src/common/panel/Panel.tsx +4 -4
- package/src/criticalBanner/CriticalCommsBanner.tsx +4 -4
- package/src/dateInput/DateInput.tsx +2 -2
- package/src/dateLookup/DateLookup.tsx +2 -2
- package/src/dateLookup/dateHeader/DateHeader.tsx +2 -2
- package/src/dateLookup/tableLink/TableLink.tsx +3 -5
- package/src/decision/Decision.tsx +3 -3
- package/src/definitionList/DefinitionList.tsx +4 -4
- package/src/dimmer/Dimmer.tsx +6 -6
- package/src/display/Display.tsx +2 -2
- package/src/drawer/Drawer.tsx +5 -5
- package/src/field/Field.tsx +3 -3
- package/src/flowNavigation/FlowNavigation.tsx +6 -7
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +3 -3
- package/src/flowNavigation/backButton/BackButton.tsx +2 -2
- package/src/header/Header.tsx +3 -3
- package/src/i18n/zh-HK.json +2 -0
- package/src/image/Image.tsx +2 -2
- package/src/info/Info.tsx +2 -2
- package/src/inlineAlert/InlineAlert.tsx +2 -2
- package/src/inputs/Input.tsx +2 -2
- package/src/inputs/InputGroup.tsx +3 -3
- package/src/inputs/SelectInput.css +10 -0
- package/src/inputs/SelectInput.less +12 -0
- package/src/inputs/SelectInput.story.tsx +22 -2
- package/src/inputs/SelectInput.tsx +156 -58
- package/src/inputs/TextArea.tsx +2 -2
- package/src/inputs/_BottomSheet.tsx +2 -2
- package/src/inputs/_ButtonInput.tsx +2 -2
- package/src/inputs/_Popover.tsx +3 -3
- package/src/inputs/_common.ts +2 -2
- package/src/instructionsList/InstructionsList.tsx +3 -3
- package/src/label/Label.tsx +2 -2
- package/src/link/Link.tsx +2 -7
- package/src/listItem/ListItem.tsx +3 -3
- package/src/loader/Loader.tsx +2 -2
- package/src/logo/Logo.tsx +2 -2
- package/src/main.css +10 -0
- package/src/modal/Modal.tsx +9 -15
- package/src/moneyInput/MoneyInput.story.tsx +0 -34
- package/src/moneyInput/MoneyInput.tsx +6 -29
- package/src/navigationOption/NavigationOption.tsx +2 -2
- package/src/nudge/Nudge.tsx +4 -4
- package/src/overlayHeader/OverlayHeader.tsx +3 -3
- package/src/popover/Popover.tsx +2 -2
- package/src/processIndicator/ProcessIndicator.tsx +2 -2
- package/src/progress/Progress.tsx +2 -2
- package/src/progressBar/ProgressBar.tsx +2 -2
- package/src/promoCard/PromoCard.tsx +4 -4
- package/src/promoCard/PromoCardGroup.tsx +2 -2
- package/src/promoCard/PromoCardIndicator.tsx +2 -2
- package/src/radio/Radio.tsx +5 -5
- package/src/section/Section.tsx +2 -2
- package/src/segmentedControl/SegmentedControl.tsx +5 -5
- package/src/select/Select.js +9 -9
- package/src/select/option/Option.tsx +2 -2
- package/src/select/searchBox/SearchBox.tsx +4 -7
- package/src/selectOption/SelectOption.tsx +5 -5
- package/src/slidingPanel/SlidingPanel.tsx +2 -2
- package/src/statusIcon/StatusIcon.tsx +3 -3
- package/src/stepper/Stepper.tsx +3 -3
- package/src/summary/Summary.tsx +2 -2
- package/src/switch/Switch.tsx +2 -2
- package/src/tabs/Tab.js +8 -12
- package/src/tabs/Tabs.js +2 -2
- package/src/tile/Tile.tsx +3 -3
- package/src/title/Title.tsx +3 -3
- package/src/tooltip/Tooltip.tsx +3 -3
- package/src/typeahead/Typeahead.tsx +6 -6
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +2 -2
- package/src/typeahead/typeaheadOption/TypeaheadOption.tsx +2 -2
- package/src/upload/Upload.tsx +2 -2
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadButton/UploadButton.tsx +5 -9
- package/src/uploadInput/uploadItem/UploadItem.tsx +3 -3
- package/src/uploadInput/uploadItem/UploadItemLink.tsx +2 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Listbox as ListboxBase } from '@headlessui/react';
|
|
2
2
|
import { Check, ChevronDown, Cross, CrossCircle } from '@transferwise/icons';
|
|
3
|
-
import
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
4
|
import mergeProps from 'merge-props';
|
|
5
5
|
import {
|
|
6
6
|
createContext,
|
|
7
7
|
forwardRef,
|
|
8
8
|
useContext,
|
|
9
|
+
useDeferredValue,
|
|
9
10
|
useEffect,
|
|
10
11
|
useId,
|
|
11
12
|
useMemo,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
useState,
|
|
14
15
|
} from 'react';
|
|
15
16
|
import { useIntl } from 'react-intl';
|
|
17
|
+
import { Virtualizer } from 'virtua';
|
|
16
18
|
|
|
17
19
|
import { useEffectEvent } from '../common/hooks/useEffectEvent';
|
|
18
20
|
import { useScreenSize } from '../common/hooks/useScreenSize';
|
|
@@ -29,6 +31,8 @@ import { InputGroup } from './InputGroup';
|
|
|
29
31
|
import { SearchInput } from './SearchInput';
|
|
30
32
|
import messages from './SelectInput.messages';
|
|
31
33
|
|
|
34
|
+
const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
|
|
35
|
+
|
|
32
36
|
function searchableString(value: string) {
|
|
33
37
|
return value.trim().replace(/\s+/gu, ' ').normalize('NFKC').toLowerCase();
|
|
34
38
|
}
|
|
@@ -40,22 +44,13 @@ function inferSearchableStrings(value: unknown) {
|
|
|
40
44
|
|
|
41
45
|
if (typeof value === 'object' && value != null) {
|
|
42
46
|
return Object.values(value)
|
|
43
|
-
.filter((innerValue)
|
|
47
|
+
.filter((innerValue) => typeof innerValue === 'string')
|
|
44
48
|
.map((innerValue) => searchableString(innerValue));
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
return [];
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
const SelectInputTriggerButtonPropsContext = createContext<{
|
|
51
|
-
ref?: React.ForwardedRef<HTMLButtonElement | null>;
|
|
52
|
-
id?: string;
|
|
53
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
54
|
-
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
55
|
-
[key: string]: unknown;
|
|
56
|
-
}>({});
|
|
57
|
-
const SelectInputOptionContentWithinTriggerContext = createContext(false);
|
|
58
|
-
|
|
59
54
|
export interface SelectInputOptionItem<T = string> {
|
|
60
55
|
type: 'option';
|
|
61
56
|
value: T;
|
|
@@ -89,6 +84,11 @@ function dedupeSelectInputOptionItem<T>(
|
|
|
89
84
|
return { ...item, value: undefined };
|
|
90
85
|
}
|
|
91
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Sets the `value` of duplicate option items to `undefined`, hiding them when
|
|
89
|
+
* rendered. Indexes are kept intact within groups to preserve the active item
|
|
90
|
+
* between filter changes when possible.
|
|
91
|
+
*/
|
|
92
92
|
function dedupeSelectInputItems<T>(
|
|
93
93
|
items: readonly SelectInputItem<T>[],
|
|
94
94
|
): SelectInputItem<T | undefined>[] {
|
|
@@ -112,20 +112,23 @@ function dedupeSelectInputItems<T>(
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
function
|
|
115
|
+
function selectInputOptionItemIncludesNeedle<T>(item: SelectInputOptionItem<T>, needle: string) {
|
|
116
116
|
return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
|
|
117
117
|
haystack.includes(needle),
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
function filterSelectInputItems<T>(
|
|
121
|
+
function filterSelectInputItems<T>(
|
|
122
|
+
items: readonly SelectInputItem<T>[],
|
|
123
|
+
predicate: (item: SelectInputOptionItem<T>) => boolean,
|
|
124
|
+
) {
|
|
122
125
|
return items.filter((item) => {
|
|
123
126
|
switch (item.type) {
|
|
124
127
|
case 'option': {
|
|
125
|
-
return
|
|
128
|
+
return predicate(item);
|
|
126
129
|
}
|
|
127
130
|
case 'group': {
|
|
128
|
-
return item.options.some((option) =>
|
|
131
|
+
return item.options.some((option) => predicate(option));
|
|
129
132
|
}
|
|
130
133
|
default:
|
|
131
134
|
}
|
|
@@ -173,7 +176,7 @@ const defaultRenderTrigger = (({ content, placeholderShown, clear, disabled, siz
|
|
|
173
176
|
<InputGroup
|
|
174
177
|
addonEnd={{
|
|
175
178
|
content: (
|
|
176
|
-
<span className={
|
|
179
|
+
<span className={clsx('np-select-input-addon-container', disabled && 'disabled')}>
|
|
177
180
|
{clear != null && !placeholderShown ? (
|
|
178
181
|
<>
|
|
179
182
|
<SelectInputClearButton
|
|
@@ -199,7 +202,7 @@ const defaultRenderTrigger = (({ content, placeholderShown, clear, disabled, siz
|
|
|
199
202
|
>
|
|
200
203
|
<SelectInputTriggerButton as={ButtonInput} size={size}>
|
|
201
204
|
<span
|
|
202
|
-
className={
|
|
205
|
+
className={clsx(
|
|
203
206
|
'np-select-input-content',
|
|
204
207
|
placeholderShown && 'np-select-input-placeholder',
|
|
205
208
|
)}
|
|
@@ -220,7 +223,7 @@ function SelectInputClearButton({ className, onClick }: SelectInputClearButtonPr
|
|
|
220
223
|
<button
|
|
221
224
|
type="button"
|
|
222
225
|
aria-label={intl.formatMessage(dateTriggerMessages.ariaLabel)}
|
|
223
|
-
className={
|
|
226
|
+
className={clsx(className, 'np-select-input-addon np-select-input-addon--interactive')}
|
|
224
227
|
onClick={onClick}
|
|
225
228
|
>
|
|
226
229
|
<Cross size={16} />
|
|
@@ -271,12 +274,15 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
271
274
|
}, [handleClose, open]);
|
|
272
275
|
|
|
273
276
|
const [filterQuery, _setFilterQuery] = useState('');
|
|
277
|
+
const deferredFilterQuery = useDeferredValue(filterQuery);
|
|
274
278
|
const setFilterQuery = useEffectEvent((query: string) => {
|
|
275
279
|
_setFilterQuery(query);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
if (query !== filterQuery) {
|
|
281
|
+
onFilterChange({
|
|
282
|
+
query,
|
|
283
|
+
queryNormalized: query ? searchableString(query) : null,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
280
286
|
});
|
|
281
287
|
|
|
282
288
|
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
|
@@ -294,9 +300,7 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
294
300
|
multiple={multiple}
|
|
295
301
|
defaultValue={defaultValue}
|
|
296
302
|
value={controlledValue}
|
|
297
|
-
|
|
298
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
299
|
-
by={compareValues as any}
|
|
303
|
+
by={compareValues}
|
|
300
304
|
disabled={disabled}
|
|
301
305
|
onChange={
|
|
302
306
|
((value) => {
|
|
@@ -349,8 +353,8 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
349
353
|
content: !placeholderShown ? (
|
|
350
354
|
<SelectInputOptionContentWithinTriggerContext.Provider value>
|
|
351
355
|
{multiple && Array.isArray(value)
|
|
352
|
-
? value
|
|
353
|
-
.map((option
|
|
356
|
+
? (value as readonly NonNullable<T>[])
|
|
357
|
+
.map((option) => renderValue(option, true))
|
|
354
358
|
.filter((node) => node != null)
|
|
355
359
|
.join(', ')
|
|
356
360
|
: renderValue(value as NonNullable<T>, true)}
|
|
@@ -379,9 +383,7 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
379
383
|
setOpen(false);
|
|
380
384
|
}}
|
|
381
385
|
onCloseEnd={() => {
|
|
382
|
-
|
|
383
|
-
setFilterQuery('');
|
|
384
|
-
}
|
|
386
|
+
setFilterQuery('');
|
|
385
387
|
}}
|
|
386
388
|
>
|
|
387
389
|
<SelectInputOptions
|
|
@@ -392,7 +394,7 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
392
394
|
filterPlaceholder={filterPlaceholder}
|
|
393
395
|
searchInputRef={searchInputRef}
|
|
394
396
|
listboxRef={listboxRef}
|
|
395
|
-
filterQuery={
|
|
397
|
+
filterQuery={deferredFilterQuery}
|
|
396
398
|
onFilterChange={setFilterQuery}
|
|
397
399
|
/>
|
|
398
400
|
</OptionsOverlay>
|
|
@@ -402,6 +404,14 @@ export function SelectInput<T = string, M extends boolean = false>({
|
|
|
402
404
|
);
|
|
403
405
|
}
|
|
404
406
|
|
|
407
|
+
const SelectInputTriggerButtonPropsContext = createContext<{
|
|
408
|
+
ref?: React.ForwardedRef<HTMLButtonElement | null>;
|
|
409
|
+
id?: string;
|
|
410
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
411
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
412
|
+
[key: string]: unknown;
|
|
413
|
+
}>({});
|
|
414
|
+
|
|
405
415
|
type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
406
416
|
|
|
407
417
|
export type SelectInputTriggerButtonProps<
|
|
@@ -506,7 +516,51 @@ function SelectInputOptions<T = string>({
|
|
|
506
516
|
}
|
|
507
517
|
return undefined;
|
|
508
518
|
}, [filterQuery, filterable]);
|
|
509
|
-
|
|
519
|
+
useEffect(() => {
|
|
520
|
+
if (needle) {
|
|
521
|
+
// Ensure having an active option while filtering.
|
|
522
|
+
// Without `requestAnimationFrame` upon which React depends for scheduling
|
|
523
|
+
// updates, the active status would only show for a split second and then
|
|
524
|
+
// disappear inadvertently.
|
|
525
|
+
requestAnimationFrame(() => {
|
|
526
|
+
if (
|
|
527
|
+
controllerRef.current != null &&
|
|
528
|
+
!controllerRef.current.hasAttribute('aria-activedescendant')
|
|
529
|
+
) {
|
|
530
|
+
// Activate first option via synthetic key press
|
|
531
|
+
controllerRef.current.dispatchEvent(
|
|
532
|
+
new KeyboardEvent('keydown', { key: 'Home', bubbles: true }),
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}, [controllerRef, needle]);
|
|
538
|
+
|
|
539
|
+
const filteredItems: readonly SelectInputItem<NonNullable<T> | undefined>[] =
|
|
540
|
+
needle != null
|
|
541
|
+
? filterSelectInputItems(dedupeSelectInputItems(items), (item) =>
|
|
542
|
+
selectInputOptionItemIncludesNeedle(item, needle),
|
|
543
|
+
)
|
|
544
|
+
: items;
|
|
545
|
+
const resultsEmpty = needle != null && filteredItems.length === 0;
|
|
546
|
+
|
|
547
|
+
const virtualized = filteredItems.length > MAX_ITEMS_WITHOUT_VIRTUALIZATION;
|
|
548
|
+
|
|
549
|
+
// Items shown once shall be kept mounted until the needle changes, otherwise
|
|
550
|
+
// the scroll position may jump around inadvertently. Pattern adopted from:
|
|
551
|
+
// https://inokawa.github.io/virtua/?path=/story/advanced-keep-offscreen-items--append-only
|
|
552
|
+
const [mountedIndexes, setMountedIndexes] = useState<number[]>([]);
|
|
553
|
+
useEffect(() => {
|
|
554
|
+
// Ensure the 'End' key works as intended by keeping the last item mounted
|
|
555
|
+
setMountedIndexes((prevMountedIndexes) => {
|
|
556
|
+
const indexes = new Set(prevMountedIndexes);
|
|
557
|
+
indexes.add(filteredItems.length - 1);
|
|
558
|
+
return [...indexes]; // Sorting is redundant by nature here
|
|
559
|
+
});
|
|
560
|
+
}, [
|
|
561
|
+
needle, // Needed as `filteredItems.length` may be equal between two updates
|
|
562
|
+
filteredItems.length,
|
|
563
|
+
]);
|
|
510
564
|
|
|
511
565
|
const listboxContainerRef = useRef<HTMLDivElement>(null);
|
|
512
566
|
useEffect(() => {
|
|
@@ -522,6 +576,19 @@ function SelectInputOptions<T = string>({
|
|
|
522
576
|
const statusId = useId();
|
|
523
577
|
const listboxId = useId();
|
|
524
578
|
|
|
579
|
+
const getItemNode = (index: number) => {
|
|
580
|
+
const item = filteredItems[index];
|
|
581
|
+
return (
|
|
582
|
+
<SelectInputItemView
|
|
583
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
584
|
+
key={index}
|
|
585
|
+
item={item}
|
|
586
|
+
renderValue={renderValue}
|
|
587
|
+
needle={needle}
|
|
588
|
+
/>
|
|
589
|
+
);
|
|
590
|
+
};
|
|
591
|
+
|
|
525
592
|
return (
|
|
526
593
|
<ListboxBase.Options
|
|
527
594
|
as={SelectInputOptionsContainer}
|
|
@@ -533,12 +600,6 @@ function SelectInputOptions<T = string>({
|
|
|
533
600
|
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
534
601
|
} else {
|
|
535
602
|
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
536
|
-
if (filterQuery) {
|
|
537
|
-
// Ensure having an active option while filtering
|
|
538
|
-
controllerRef.current.dispatchEvent(
|
|
539
|
-
new KeyboardEvent('keydown', { key: 'Home', bubbles: true }),
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
603
|
}
|
|
543
604
|
}
|
|
544
605
|
}}
|
|
@@ -549,7 +610,7 @@ function SelectInputOptions<T = string>({
|
|
|
549
610
|
ref={searchInputRef}
|
|
550
611
|
shape="rectangle"
|
|
551
612
|
placeholder={filterPlaceholder}
|
|
552
|
-
|
|
613
|
+
defaultValue={filterQuery}
|
|
553
614
|
aria-controls={listboxId}
|
|
554
615
|
aria-describedby={showStatus ? statusId : undefined}
|
|
555
616
|
onKeyDown={(event) => {
|
|
@@ -560,6 +621,9 @@ function SelectInputOptions<T = string>({
|
|
|
560
621
|
}
|
|
561
622
|
}}
|
|
562
623
|
onChange={(event) => {
|
|
624
|
+
// Free up resources and ensure not to go out of bounds when the
|
|
625
|
+
// resulting item count is less than before
|
|
626
|
+
setMountedIndexes([]);
|
|
563
627
|
onFilterChange(event.currentTarget.value);
|
|
564
628
|
}}
|
|
565
629
|
/>
|
|
@@ -569,9 +633,11 @@ function SelectInputOptions<T = string>({
|
|
|
569
633
|
<section
|
|
570
634
|
ref={listboxContainerRef}
|
|
571
635
|
tabIndex={-1}
|
|
572
|
-
className={
|
|
636
|
+
className={clsx(
|
|
573
637
|
'np-select-input-listbox-container',
|
|
574
|
-
|
|
638
|
+
virtualized && 'np-select-input-listbox-container--virtualized',
|
|
639
|
+
needle == null && // Groups aren't shown when filtering
|
|
640
|
+
items.some((item) => item.type === 'group') &&
|
|
575
641
|
'np-select-input-listbox-container--has-group',
|
|
576
642
|
)}
|
|
577
643
|
>
|
|
@@ -590,15 +656,35 @@ function SelectInputOptions<T = string>({
|
|
|
590
656
|
tabIndex={0}
|
|
591
657
|
className="np-select-input-listbox"
|
|
592
658
|
>
|
|
593
|
-
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
659
|
+
{!virtualized ? (
|
|
660
|
+
filteredItems.map((_, index) => getItemNode(index))
|
|
661
|
+
) : (
|
|
662
|
+
<Virtualizer
|
|
663
|
+
key={needle}
|
|
664
|
+
count={filteredItems.length}
|
|
665
|
+
keepMounted={mountedIndexes}
|
|
666
|
+
scrollRef={listboxRef} // `VList` doesn't expose this
|
|
667
|
+
onRangeChange={(startIndex, endIndex) => {
|
|
668
|
+
setMountedIndexes((prevMountedIndexes) => {
|
|
669
|
+
const indexes = new Set(prevMountedIndexes);
|
|
670
|
+
for (let index = startIndex; index <= endIndex; index += 1) {
|
|
671
|
+
indexes.add(index);
|
|
672
|
+
}
|
|
673
|
+
return [...indexes].sort((a, b) => a - b);
|
|
674
|
+
});
|
|
675
|
+
}}
|
|
676
|
+
>
|
|
677
|
+
{(index) => (
|
|
678
|
+
// The position of each item can't be inferred by browsers when
|
|
679
|
+
// virtualizing, as some of the items may not be in the DOM
|
|
680
|
+
<SelectInputItemsCountContext.Provider value={filteredItems.length}>
|
|
681
|
+
<SelectInputItemPositionContext.Provider value={index + 1}>
|
|
682
|
+
{getItemNode(index)}
|
|
683
|
+
</SelectInputItemPositionContext.Provider>
|
|
684
|
+
</SelectInputItemsCountContext.Provider>
|
|
685
|
+
)}
|
|
686
|
+
</Virtualizer>
|
|
687
|
+
)}
|
|
602
688
|
</div>
|
|
603
689
|
|
|
604
690
|
{renderFooter != null ? (
|
|
@@ -639,7 +725,10 @@ function SelectInputItemView<T = string>({
|
|
|
639
725
|
}: SelectInputItemViewProps<T>) {
|
|
640
726
|
switch (item.type) {
|
|
641
727
|
case 'option': {
|
|
642
|
-
if (
|
|
728
|
+
if (
|
|
729
|
+
item.value != null &&
|
|
730
|
+
(needle == null || selectInputOptionItemIncludesNeedle(item, needle))
|
|
731
|
+
) {
|
|
643
732
|
return (
|
|
644
733
|
<SelectInputOption value={item.value} disabled={item.disabled}>
|
|
645
734
|
{renderValue(item.value, false)}
|
|
@@ -677,7 +766,7 @@ function SelectInputGroupItemView<T = string>({
|
|
|
677
766
|
<section
|
|
678
767
|
role="group"
|
|
679
768
|
aria-labelledby={headerId}
|
|
680
|
-
className={
|
|
769
|
+
className={clsx(needle === null && 'np-select-input-group-item--without-needle')}
|
|
681
770
|
>
|
|
682
771
|
{needle == null ? (
|
|
683
772
|
<header
|
|
@@ -701,6 +790,9 @@ function SelectInputGroupItemView<T = string>({
|
|
|
701
790
|
);
|
|
702
791
|
}
|
|
703
792
|
|
|
793
|
+
const SelectInputItemsCountContext = createContext<number | undefined>(undefined);
|
|
794
|
+
const SelectInputItemPositionContext = createContext<number | undefined>(undefined);
|
|
795
|
+
|
|
704
796
|
interface SelectInputOptionProps<T = string> {
|
|
705
797
|
value: T;
|
|
706
798
|
disabled?: boolean;
|
|
@@ -708,13 +800,17 @@ interface SelectInputOptionProps<T = string> {
|
|
|
708
800
|
}
|
|
709
801
|
|
|
710
802
|
function SelectInputOption<T = string>({ value, disabled, children }: SelectInputOptionProps<T>) {
|
|
803
|
+
const itemsCount = useContext(SelectInputItemsCountContext);
|
|
804
|
+
const itemPosition = useContext(SelectInputItemPositionContext);
|
|
711
805
|
return (
|
|
712
806
|
<ListboxBase.Option
|
|
713
807
|
as="div"
|
|
714
808
|
value={value}
|
|
809
|
+
aria-setsize={itemsCount}
|
|
810
|
+
aria-posinset={itemPosition}
|
|
715
811
|
disabled={disabled}
|
|
716
812
|
className={({ active, disabled: uiDisabled }) =>
|
|
717
|
-
|
|
813
|
+
clsx(
|
|
718
814
|
'np-select-input-option-container np-text-body-large',
|
|
719
815
|
active && 'np-select-input-option-container--active',
|
|
720
816
|
uiDisabled && 'np-select-input-option-container--disabled',
|
|
@@ -726,7 +822,7 @@ function SelectInputOption<T = string>({ value, disabled, children }: SelectInpu
|
|
|
726
822
|
<div className="np-select-input-option">{children}</div>
|
|
727
823
|
<Check
|
|
728
824
|
size={16}
|
|
729
|
-
className={
|
|
825
|
+
className={clsx(
|
|
730
826
|
'np-select-input-option-check',
|
|
731
827
|
!selected && 'np-select-input-option-check--not-selected',
|
|
732
828
|
)}
|
|
@@ -737,6 +833,8 @@ function SelectInputOption<T = string>({ value, disabled, children }: SelectInpu
|
|
|
737
833
|
);
|
|
738
834
|
}
|
|
739
835
|
|
|
836
|
+
const SelectInputOptionContentWithinTriggerContext = createContext(false);
|
|
837
|
+
|
|
740
838
|
export interface SelectInputOptionContentProps {
|
|
741
839
|
title: string;
|
|
742
840
|
note?: string;
|
|
@@ -754,14 +852,14 @@ export function SelectInputOptionContent({
|
|
|
754
852
|
|
|
755
853
|
return (
|
|
756
854
|
<div
|
|
757
|
-
className={
|
|
855
|
+
className={clsx(
|
|
758
856
|
'np-select-input-option-content-container',
|
|
759
857
|
(note || description) && 'np-text-body-large',
|
|
760
858
|
)}
|
|
761
859
|
>
|
|
762
860
|
{icon ? (
|
|
763
861
|
<div
|
|
764
|
-
className={
|
|
862
|
+
className={clsx(
|
|
765
863
|
'np-select-input-option-content-icon',
|
|
766
864
|
!withinTrigger && 'np-select-input-option-content-icon--not-within-trigger',
|
|
767
865
|
)}
|
|
@@ -772,7 +870,7 @@ export function SelectInputOptionContent({
|
|
|
772
870
|
|
|
773
871
|
<div className="np-select-input-option-content-text">
|
|
774
872
|
<div
|
|
775
|
-
className={
|
|
873
|
+
className={clsx(
|
|
776
874
|
'np-select-input-option-content-text-line-1',
|
|
777
875
|
withinTrigger && 'np-select-input-option-content-text-within-trigger',
|
|
778
876
|
)}
|
|
@@ -787,7 +885,7 @@ export function SelectInputOptionContent({
|
|
|
787
885
|
|
|
788
886
|
{description ? (
|
|
789
887
|
<div
|
|
790
|
-
className={
|
|
888
|
+
className={clsx(
|
|
791
889
|
'np-select-input-option-content-text-secondary np-text-body-default',
|
|
792
890
|
withinTrigger && 'np-select-input-option-content-text-within-trigger',
|
|
793
891
|
)}
|
package/src/inputs/TextArea.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Merge } from '../utils';
|
|
@@ -22,7 +22,7 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
22
22
|
return (
|
|
23
23
|
<textarea
|
|
24
24
|
ref={reference}
|
|
25
|
-
className={
|
|
25
|
+
className={clsx(className, inputClassNameBase(), 'np-text-area')}
|
|
26
26
|
{...inputAttributes}
|
|
27
27
|
{...restProps}
|
|
28
28
|
/>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { Transition } from '@headlessui/react';
|
|
10
10
|
import { FocusScope } from '@react-aria/focus';
|
|
11
11
|
import { ThemeProvider, useTheme } from '@wise/components-theming';
|
|
12
|
-
import
|
|
12
|
+
import { clsx } from 'clsx';
|
|
13
13
|
import { Fragment, useState } from 'react';
|
|
14
14
|
|
|
15
15
|
import { CloseButton } from '../common/closeButton';
|
|
@@ -112,7 +112,7 @@ export function BottomSheet({
|
|
|
112
112
|
/>
|
|
113
113
|
</div>
|
|
114
114
|
<div
|
|
115
|
-
className={
|
|
115
|
+
className={clsx(
|
|
116
116
|
'np-bottom-sheet-v2-content-inner',
|
|
117
117
|
title && 'np-bottom-sheet-v2-content-inner--has-title',
|
|
118
118
|
padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useInputPaddings } from './InputGroup';
|
|
@@ -18,7 +18,7 @@ export const ButtonInput = forwardRef(function ButtonInput(
|
|
|
18
18
|
<button
|
|
19
19
|
ref={ref}
|
|
20
20
|
type="button"
|
|
21
|
-
className={
|
|
21
|
+
className={clsx(className, inputClassNameBase({ size }), 'np-button-input')}
|
|
22
22
|
// eslint-disable-next-line react/forbid-dom-props
|
|
23
23
|
style={{ ...inputPaddings, ...style }}
|
|
24
24
|
{...restProps}
|
package/src/inputs/_Popover.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { Transition } from '@headlessui/react';
|
|
16
16
|
import { FocusScope } from '@react-aria/focus';
|
|
17
17
|
import { ThemeProvider, useTheme } from '@wise/components-theming';
|
|
18
|
-
import
|
|
18
|
+
import { clsx } from 'clsx';
|
|
19
19
|
import { useState } from 'react';
|
|
20
20
|
|
|
21
21
|
import { PreventScroll } from '../common/preventScroll/PreventScroll';
|
|
@@ -109,7 +109,7 @@ export function Popover({
|
|
|
109
109
|
<div
|
|
110
110
|
key={floatingKey} // Force inner state invalidation on open
|
|
111
111
|
ref={refs.setFloating}
|
|
112
|
-
className={
|
|
112
|
+
className={clsx('np-popover-v2-container', {
|
|
113
113
|
'np-popover-v2-container--size-md': size === 'md',
|
|
114
114
|
'np-popover-v2-container--size-lg': size === 'lg',
|
|
115
115
|
})}
|
|
@@ -118,7 +118,7 @@ export function Popover({
|
|
|
118
118
|
{...getFloatingProps()}
|
|
119
119
|
>
|
|
120
120
|
<div
|
|
121
|
-
className={
|
|
121
|
+
className={clsx('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
122
122
|
'np-popover-v2--padding-md': padding === 'md',
|
|
123
123
|
})}
|
|
124
124
|
>
|
package/src/inputs/_common.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
|
|
3
3
|
import { SizeLarge, SizeMedium, SizeSmall } from '../common';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export type InputPropsBase = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export function inputClassNameBase({ size = 'auto' }: InputPropsBase = {}) {
|
|
10
|
-
return
|
|
10
|
+
return clsx(
|
|
11
11
|
'form-control', // TODO: Deprecate
|
|
12
12
|
'np-form-control',
|
|
13
13
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
import Body from '../body/Body';
|
|
@@ -50,7 +50,7 @@ const InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: Instruct
|
|
|
50
50
|
</>
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
return <ul className={
|
|
53
|
+
return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
function Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {
|
|
@@ -59,7 +59,7 @@ function Instruction({ item, type }: { item: ReactNode | InstructionNode; type:
|
|
|
59
59
|
return (
|
|
60
60
|
<li
|
|
61
61
|
className="instruction"
|
|
62
|
-
aria-label={isInstructionNode ? (item['aria-label']
|
|
62
|
+
aria-label={isInstructionNode ? (item['aria-label']) : undefined}
|
|
63
63
|
>
|
|
64
64
|
{type === 'do' ? (
|
|
65
65
|
<DoIcon size={24} className={type} />
|
package/src/label/Label.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
|
|
3
3
|
export type LabelProps = {
|
|
4
4
|
id?: string;
|
|
@@ -12,7 +12,7 @@ export const Label = ({ id, htmlFor, className, children }: LabelProps) => {
|
|
|
12
12
|
<label
|
|
13
13
|
id={id}
|
|
14
14
|
htmlFor={htmlFor}
|
|
15
|
-
className={
|
|
15
|
+
className={clsx('control-label d-flex flex-column gap-y-1 m-b-0', className)}
|
|
16
16
|
>
|
|
17
17
|
{children}
|
|
18
18
|
</label>
|
package/src/link/Link.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import { AnchorHTMLAttributes } from 'react';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
|
|
@@ -32,12 +32,7 @@ const Link = ({
|
|
|
32
32
|
<a
|
|
33
33
|
href={href}
|
|
34
34
|
target={target}
|
|
35
|
-
className={
|
|
36
|
-
'np-link',
|
|
37
|
-
type ? `np-text-${type}` : undefined,
|
|
38
|
-
'd-inline-flex',
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
35
|
+
className={clsx('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className)}
|
|
41
36
|
aria-label={ariaLabel}
|
|
42
37
|
rel={isBlank ? 'noreferrer' : undefined}
|
|
43
38
|
onClick={onClick}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { ElementType, FC, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import Body from '../body/Body';
|
|
@@ -27,14 +27,14 @@ const ListItem: FC<ListItemProps> = ({
|
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<Element
|
|
30
|
-
className={
|
|
30
|
+
className={clsx('np-list-item d-flex align-items-center p-y-2', className, {
|
|
31
31
|
'p-x-2': !isContainerAligned,
|
|
32
32
|
})}
|
|
33
33
|
{...rest}
|
|
34
34
|
>
|
|
35
35
|
{media}
|
|
36
36
|
|
|
37
|
-
<div className={
|
|
37
|
+
<div className={clsx('d-flex flex-column', { 'p-l-2': !!media, 'p-r-2': !!action })}>
|
|
38
38
|
<Body type="body-default" className="text-secondary m-b-0">
|
|
39
39
|
{title}
|
|
40
40
|
</Body>
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTheme } from '@wise/components-theming';
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';
|
|
@@ -74,7 +74,7 @@ const Loader = ({
|
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
76
|
<div
|
|
77
|
-
className={
|
|
77
|
+
className={clsx(style('tw-loader'), style(`tw-loader--${supportedSize}`), {
|
|
78
78
|
'tw-loader--visible': hasDebounced,
|
|
79
79
|
})}
|
|
80
80
|
data-testid={restProps['data-testid']}
|
package/src/logo/Logo.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
|
|
3
3
|
import { ReactComponent as LogoFlagInverse } from './svg/flag-inverse.svg';
|
|
4
4
|
import { ReactComponent as LogoFlagPlatformInverse } from './svg/flag-platform-white.svg';
|
|
@@ -49,7 +49,7 @@ export default function Logo({ className, inverse, type = 'WISE' }: LogoProps) {
|
|
|
49
49
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<span aria-label={labelByType[type]} role="img" className={
|
|
52
|
+
<span aria-label={labelByType[type]} role="img" className={clsx(className, 'np-logo')}>
|
|
53
53
|
<LogoSm className="np-logo-svg np-logo-svg--size-sm" />
|
|
54
54
|
<LogoMd className="np-logo-svg np-logo-svg--size-md" />
|
|
55
55
|
</span>
|