@transferwise/components 0.0.0-experimental-d6b038b → 0.0.0-experimental-c84454a
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/Accordion.js.map +1 -1
- package/build/accordion/Accordion.mjs.map +1 -1
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +1 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/body/Body.js.map +1 -1
- package/build/body/Body.mjs.map +1 -1
- package/build/button/LegacyButton.js.map +1 -1
- package/build/button/LegacyButton.mjs.map +1 -1
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs.map +1 -1
- package/build/checkboxButton/CheckboxButton.js.map +1 -1
- package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
- package/build/checkboxOption/CheckboxOption.js.map +1 -1
- package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/propsValues/type.js +1 -1
- package/build/common/propsValues/type.js.map +1 -1
- package/build/common/propsValues/type.mjs +1 -1
- package/build/common/propsValues/type.mjs.map +1 -1
- package/build/common/propsValues/typography.js +1 -1
- package/build/common/propsValues/typography.js.map +1 -1
- package/build/common/propsValues/typography.mjs +1 -1
- package/build/common/propsValues/typography.mjs.map +1 -1
- package/build/dateInput/DateInput.js +5 -12
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -11
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +8 -16
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +6 -14
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs.map +1 -1
- package/build/iconButton/IconButton.js.map +1 -1
- package/build/iconButton/IconButton.mjs.map +1 -1
- package/build/index.js +7 -14
- package/build/index.js.map +1 -1
- package/build/index.mjs +3 -10
- package/build/index.mjs.map +1 -1
- package/build/inputs/SelectInput.js +890 -0
- package/build/inputs/SelectInput.js.map +1 -0
- package/build/inputs/SelectInput.messages.js.map +1 -0
- package/build/inputs/SelectInput.messages.mjs.map +1 -0
- package/build/inputs/SelectInput.mjs +881 -0
- package/build/inputs/SelectInput.mjs.map +1 -0
- package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.js → _BottomSheet.js} +7 -7
- package/build/inputs/_BottomSheet.js.map +1 -0
- package/build/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.mjs → _BottomSheet.mjs} +7 -7
- package/build/inputs/_BottomSheet.mjs.map +1 -0
- package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.js → _ButtonInput.js} +5 -5
- package/build/inputs/_ButtonInput.js.map +1 -0
- package/build/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.mjs → _ButtonInput.mjs} +5 -5
- package/build/inputs/_ButtonInput.mjs.map +1 -0
- package/build/inputs/{SelectInput/Popover/SelectInputPopover.js → _Popover.js} +7 -7
- package/build/inputs/_Popover.js.map +1 -0
- package/build/inputs/{SelectInput/Popover/SelectInputPopover.mjs → _Popover.mjs} +7 -7
- package/build/inputs/_Popover.mjs.map +1 -0
- package/build/legacylistItem/LegacyListItem.js.map +1 -1
- package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
- package/build/list/List.js.map +1 -1
- package/build/list/List.mjs.map +1 -1
- package/build/listItem/Button/ListItemButton.js.map +1 -1
- package/build/listItem/Button/ListItemButton.mjs.map +1 -1
- package/build/listItem/IconButton/ListItemIconButton.js.map +1 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -1
- package/build/listItem/Image/ListItemImage.js.map +1 -1
- package/build/listItem/Image/ListItemImage.mjs.map +1 -1
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs.map +1 -1
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs.map +1 -1
- package/build/main.css +126 -126
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +2 -9
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -8
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +3 -10
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +2 -9
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/radioOption/RadioOption.js.map +1 -1
- package/build/radioOption/RadioOption.mjs.map +1 -1
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/main.css +126 -126
- package/build/styles/sentimentSurface/SentimentSurface.css +36 -36
- package/build/summary/Summary.js +1 -1
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +1 -1
- package/build/summary/Summary.mjs.map +1 -1
- package/build/switchOption/SwitchOption.js +1 -1
- package/build/switchOption/SwitchOption.js.map +1 -1
- package/build/switchOption/SwitchOption.mjs +1 -1
- package/build/switchOption/SwitchOption.mjs.map +1 -1
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/accordion/Accordion.d.ts +8 -2
- package/build/types/accordion/Accordion.d.ts.map +1 -1
- package/build/types/actionButton/ActionButton.d.ts +6 -4
- package/build/types/actionButton/ActionButton.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +1 -1
- package/build/types/alert/Alert.d.ts +5 -2
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatar/Avatar.d.ts +4 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts +5 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -0
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/body/Body.d.ts +2 -6
- package/build/types/body/Body.d.ts.map +1 -1
- package/build/types/button/Button.types.d.ts +4 -1
- package/build/types/button/Button.types.d.ts.map +1 -1
- package/build/types/button/LegacyButton.d.ts +4 -4
- package/build/types/card/Card.d.ts +1 -0
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/checkboxButton/CheckboxButton.d.ts +2 -0
- package/build/types/checkboxButton/CheckboxButton.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +1 -1
- package/build/types/circularButton/CircularButton.d.ts +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/propsValues/type.d.ts +1 -1
- package/build/types/common/propsValues/typography.d.ts +2 -2
- package/build/types/dateInput/DateInput.d.ts +5 -0
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts +6 -0
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +8 -2
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +5 -2
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +3 -0
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/header/Header.d.ts +5 -1
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +6 -0
- package/build/types/iconButton/IconButton.d.ts.map +1 -1
- package/build/types/inputs/{SelectInput/SelectInput.types.d.ts → SelectInput.d.ts} +38 -12
- package/build/types/inputs/SelectInput.d.ts.map +1 -0
- package/build/types/inputs/SelectInput.messages.d.ts.map +1 -0
- package/build/types/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.d.ts → _BottomSheet.d.ts} +3 -3
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
- package/build/types/inputs/_ButtonInput.d.ts +5 -0
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
- package/build/types/inputs/{SelectInput/Popover/SelectInputPopover.d.ts → _Popover.d.ts} +3 -3
- package/build/types/inputs/_Popover.d.ts.map +1 -0
- package/build/types/legacylistItem/LegacyListItem.d.ts +1 -1
- package/build/types/list/List.d.ts +1 -0
- package/build/types/list/List.d.ts.map +1 -1
- package/build/types/listItem/Button/ListItemButton.d.ts +4 -0
- package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -1
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts +3 -1
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -1
- package/build/types/listItem/Image/ListItemImage.d.ts +2 -0
- package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts +3 -0
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts +5 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +4 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts +6 -0
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/navigationOption/NavigationOption.d.ts +1 -1
- package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +1 -1
- package/build/types/nudge/Nudge.d.ts +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +7 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +1 -0
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +2 -0
- package/build/types/processIndicator/ProcessIndicator.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +8 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +1 -0
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/radioOption/RadioOption.d.ts +1 -1
- package/build/types/select/Select.d.ts +4 -0
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +3 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +7 -4
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +1 -1
- package/build/types/tabs/Tabs.d.ts +2 -0
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts +14 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +6 -0
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +10 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +3 -0
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.tsx +8 -2
- package/src/actionButton/ActionButton.tsx +4 -3
- package/src/actionOption/ActionOption.tsx +1 -1
- package/src/alert/Alert.tsx +5 -2
- package/src/avatar/Avatar.tsx +4 -0
- package/src/avatarLayout/AvatarLayout.tsx +5 -1
- package/src/badge/Badge.tsx +2 -0
- package/src/body/Body.tsx +2 -6
- package/src/button/Button.types.ts +4 -1
- package/src/button/LegacyButton.tsx +4 -4
- package/src/card/Card.tsx +1 -0
- package/src/checkboxButton/CheckboxButton.tsx +1 -0
- package/src/checkboxOption/CheckboxOption.tsx +1 -1
- package/src/circularButton/CircularButton.tsx +1 -2
- package/src/common/propsValues/type.ts +1 -1
- package/src/common/propsValues/typography.ts +2 -2
- package/src/dateInput/DateInput.tsx +5 -0
- package/src/dimmer/Dimmer.tsx +6 -0
- package/src/drawer/Drawer.tsx +8 -2
- package/src/field/Field.tsx +5 -2
- package/src/flowNavigation/FlowNavigation.tsx +3 -0
- package/src/header/Header.tsx +5 -1
- package/src/iconButton/IconButton.tsx +3 -0
- package/src/inputs/{SelectInput/_stories/SelectInput.docs.mdx → SelectInput.docs.mdx} +1 -0
- package/src/inputs/SelectInput.less +219 -0
- package/src/inputs/{SelectInput/_stories/SelectInput.story.tsx → SelectInput.story.tsx} +8 -11
- package/src/inputs/{SelectInput/_stories/SelectInput.test.story.tsx → SelectInput.test.story.tsx} +10 -5
- package/src/inputs/{SelectInput/SelectInput.test.tsx → SelectInput.test.tsx} +11 -9
- package/src/inputs/SelectInput.tsx +1269 -0
- package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.tsx → _BottomSheet.tsx} +7 -7
- package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.tsx → _ButtonInput.tsx} +5 -5
- package/src/inputs/{SelectInput/Popover/SelectInputPopover.tsx → _Popover.tsx} +7 -7
- package/src/legacylistItem/LegacyListItem.tsx +1 -1
- package/src/list/List.tsx +1 -0
- package/src/listItem/Button/ListItemButton.tsx +2 -0
- package/src/listItem/IconButton/ListItemIconButton.tsx +3 -1
- package/src/listItem/Image/ListItemImage.tsx +2 -0
- package/src/listItem/ListItem.tsx +2 -0
- package/src/loader/Loader.tsx +6 -2
- package/src/logo/Logo.tsx +4 -1
- package/src/main.css +126 -126
- package/src/main.less +1 -1
- package/src/modal/Modal.tsx +6 -0
- package/src/navigationOption/NavigationOption.tsx +1 -1
- package/src/navigationOptionsList/NavigationOptionsList.tsx +1 -1
- package/src/nudge/Nudge.tsx +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.tsx +7 -1
- package/src/popover/Popover.tsx +1 -0
- package/src/processIndicator/ProcessIndicator.tsx +2 -0
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +8 -1
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +1 -0
- package/src/radioOption/RadioOption.tsx +1 -1
- package/src/select/Select.tsx +4 -0
- package/src/sentimentSurface/SentimentSurface.css +36 -36
- package/src/sentimentSurface/SentimentSurface.less +12 -12
- package/src/statusIcon/StatusIcon.tsx +3 -1
- package/src/summary/Summary.tsx +7 -4
- package/src/switchOption/SwitchOption.tsx +1 -1
- package/src/tabs/Tabs.tsx +2 -0
- package/src/typeahead/Typeahead.tsx +14 -2
- package/src/upload/Upload.tsx +6 -0
- package/src/uploadInput/UploadInput.tsx +12 -4
- package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -0
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +0 -1
- package/build/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +0 -1
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +0 -1
- package/build/inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +0 -1
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js +0 -27
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +0 -1
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs +0 -25
- package/build/inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +0 -1
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js +0 -59
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +0 -1
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs +0 -56
- package/build/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +0 -1
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js +0 -50
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +0 -1
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs +0 -48
- package/build/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +0 -1
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js +0 -47
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.js.map +0 -1
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs +0 -45
- package/build/inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +0 -1
- package/build/inputs/SelectInput/Option/SelectInputOption.js +0 -42
- package/build/inputs/SelectInput/Option/SelectInputOption.js.map +0 -1
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs +0 -40
- package/build/inputs/SelectInput/Option/SelectInputOption.mjs.map +0 -1
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js +0 -40
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +0 -1
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +0 -38
- package/build/inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +0 -1
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js +0 -48
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +0 -1
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs +0 -46
- package/build/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +0 -1
- package/build/inputs/SelectInput/Options/SelectInputOptions.js +0 -300
- package/build/inputs/SelectInput/Options/SelectInputOptions.js.map +0 -1
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs +0 -298
- package/build/inputs/SelectInput/Options/SelectInputOptions.mjs.map +0 -1
- package/build/inputs/SelectInput/Popover/SelectInputPopover.js.map +0 -1
- package/build/inputs/SelectInput/Popover/SelectInputPopover.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.contexts.js +0 -29
- package/build/inputs/SelectInput/SelectInput.contexts.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.contexts.mjs +0 -24
- package/build/inputs/SelectInput/SelectInput.contexts.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.js +0 -222
- package/build/inputs/SelectInput/SelectInput.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.messages.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.messages.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.mjs +0 -216
- package/build/inputs/SelectInput/SelectInput.mjs.map +0 -1
- package/build/inputs/SelectInput/SelectInput.utils.js +0 -164
- package/build/inputs/SelectInput/SelectInput.utils.js.map +0 -1
- package/build/inputs/SelectInput/SelectInput.utils.mjs +0 -154
- package/build/inputs/SelectInput/SelectInput.utils.mjs.map +0 -1
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +0 -42
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +0 -1
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +0 -36
- package/build/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +0 -1
- package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
- package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
- package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
- package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
- package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +0 -33
- package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
- package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
- package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
- package/build/types/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/BottomSheet/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts +0 -5
- package/build/types/inputs/SelectInput/ButtonInput/SelectInputButtonInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ButtonInput/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts +0 -7
- package/build/types/inputs/SelectInput/ClearButton/SelectInputClearButton.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ClearButton/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts +0 -16
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts +0 -2
- package/build/types/inputs/SelectInput/DefaultRenderTrigger/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts +0 -9
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/ItemView/GroupItemView/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts +0 -11
- package/build/types/inputs/SelectInput/ItemView/SelectInputItemView.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/ItemView/index.d.ts +0 -4
- package/build/types/inputs/SelectInput/ItemView/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts +0 -11
- package/build/types/inputs/SelectInput/Option/SelectInputOption.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Option/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Option/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts +0 -13
- package/build/types/inputs/SelectInput/OptionContent/SelectInputOptionContent.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/OptionContent/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts +0 -9
- package/build/types/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Options/OptionsContainer/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts +0 -21
- package/build/types/inputs/SelectInput/Options/SelectInputOptions.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Options/index.d.ts +0 -4
- package/build/types/inputs/SelectInput/Options/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Popover/SelectInputPopover.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/Popover/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/Popover/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts +0 -33
- package/build/types/inputs/SelectInput/SelectInput.contexts.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.d.ts +0 -10
- package/build/types/inputs/SelectInput/SelectInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.messages.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.types.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts +0 -61
- package/build/types/inputs/SelectInput/SelectInput.utils.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +0 -12
- package/build/types/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts +0 -3
- package/build/types/inputs/SelectInput/TriggerButton/index.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/components.d.ts +0 -10
- package/build/types/inputs/SelectInput/components.d.ts.map +0 -1
- package/build/types/inputs/SelectInput/index.d.ts +0 -12
- package/build/types/inputs/SelectInput/index.d.ts.map +0 -1
- package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +0 -96
- package/src/inputs/SelectInput/BottomSheet/index.ts +0 -2
- package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +0 -16
- package/src/inputs/SelectInput/ButtonInput/index.ts +0 -2
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +0 -46
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.less +0 -40
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.tsx +0 -29
- package/src/inputs/SelectInput/ClearButton/index.ts +0 -2
- package/src/inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.tsx +0 -74
- package/src/inputs/SelectInput/DefaultRenderTrigger/index.ts +0 -5
- package/src/inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.tsx +0 -61
- package/src/inputs/SelectInput/ItemView/GroupItemView/index.ts +0 -2
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +0 -16
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.less +0 -17
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.tsx +0 -48
- package/src/inputs/SelectInput/ItemView/index.ts +0 -3
- package/src/inputs/SelectInput/Option/SelectInputOption.css +0 -33
- package/src/inputs/SelectInput/Option/SelectInputOption.less +0 -32
- package/src/inputs/SelectInput/Option/SelectInputOption.tsx +0 -57
- package/src/inputs/SelectInput/Option/index.ts +0 -2
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +0 -37
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.less +0 -38
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +0 -72
- package/src/inputs/SelectInput/OptionContent/index.ts +0 -2
- package/src/inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.tsx +0 -59
- package/src/inputs/SelectInput/Options/OptionsContainer/index.ts +0 -2
- package/src/inputs/SelectInput/Options/SelectInputOptions.css +0 -81
- package/src/inputs/SelectInput/Options/SelectInputOptions.less +0 -77
- package/src/inputs/SelectInput/Options/SelectInputOptions.tsx +0 -411
- package/src/inputs/SelectInput/Options/index.ts +0 -3
- package/src/inputs/SelectInput/Popover/SelectInputPopover.css +0 -46
- package/src/inputs/SelectInput/Popover/index.ts +0 -2
- package/src/inputs/SelectInput/SelectInput.contexts.tsx +0 -40
- package/src/inputs/SelectInput/SelectInput.less +0 -22
- package/src/inputs/SelectInput/SelectInput.tsx +0 -257
- package/src/inputs/SelectInput/SelectInput.types.ts +0 -113
- package/src/inputs/SelectInput/SelectInput.utils.ts +0 -206
- package/src/inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +0 -36
- package/src/inputs/SelectInput/TriggerButton/index.ts +0 -5
- package/src/inputs/SelectInput/components.ts +0 -10
- package/src/inputs/SelectInput/index.ts +0 -14
- package/build/inputs/{SelectInput/SelectInput.messages.js → SelectInput.messages.js} +0 -0
- package/build/inputs/{SelectInput/SelectInput.messages.mjs → SelectInput.messages.mjs} +0 -0
- package/build/styles/inputs/{SelectInput/SelectInput.css → SelectInput.css} +90 -90
- package/build/types/inputs/{SelectInput/SelectInput.messages.d.ts → SelectInput.messages.d.ts} +0 -0
- package/src/inputs/{SelectInput/SelectInput.css → SelectInput.css} +90 -90
- /package/src/inputs/{SelectInput/SelectInput.messages.ts → SelectInput.messages.ts} +0 -0
- /package/src/inputs/{SelectInput/BottomSheet/SelectInputBottomSheet.less → _BottomSheet.less} +0 -0
- /package/src/inputs/{SelectInput/ButtonInput/SelectInputButtonInput.less → _ButtonInput.less} +0 -0
- /package/src/inputs/{SelectInput/Popover/SelectInputPopover.less → _Popover.less} +0 -0
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import mergeProps from 'merge-props';
|
|
2
|
-
import { useEffect, useRef, useState, useDeferredValue } from 'react';
|
|
3
|
-
import { Listbox as ListboxBase } from '@headlessui/react';
|
|
4
|
-
import { useScreenSize } from '../../common/hooks/useScreenSize';
|
|
5
|
-
import { Breakpoint } from '../../common/propsValues/breakpoint';
|
|
6
|
-
import { useEffectEvent } from '../../common/hooks/useEffectEvent';
|
|
7
|
-
import { useInputAttributes } from '../contexts';
|
|
8
|
-
|
|
9
|
-
import { SelectInputBottomSheet } from './BottomSheet';
|
|
10
|
-
import { SelectInputPopover } from './Popover';
|
|
11
|
-
import { SelectInputOptions } from './Options';
|
|
12
|
-
import { DefaultRenderTrigger } from './DefaultRenderTrigger';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
SelectInputOptionContentWithinTriggerContext,
|
|
16
|
-
SelectInputTriggerButtonPropsContext,
|
|
17
|
-
} from './SelectInput.contexts';
|
|
18
|
-
import { searchableString, sortByRelevance } from './SelectInput.utils';
|
|
19
|
-
import { SelectInputProps } from './SelectInput.types';
|
|
20
|
-
|
|
21
|
-
const noop = () => {};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* SelectInput component allows users to select an option from a dropdown list.
|
|
25
|
-
* Supports filtering, multiple selection, and customization.
|
|
26
|
-
*/
|
|
27
|
-
export function SelectInput<T = string, M extends boolean = false>({
|
|
28
|
-
id: idProp,
|
|
29
|
-
parentId,
|
|
30
|
-
name,
|
|
31
|
-
multiple,
|
|
32
|
-
placeholder,
|
|
33
|
-
autocomplete,
|
|
34
|
-
items,
|
|
35
|
-
defaultValue,
|
|
36
|
-
value: controlledValue,
|
|
37
|
-
compareValues,
|
|
38
|
-
renderValue = String,
|
|
39
|
-
renderFooter,
|
|
40
|
-
renderTrigger = DefaultRenderTrigger,
|
|
41
|
-
filterable,
|
|
42
|
-
filterPlaceholder,
|
|
43
|
-
sortFilteredOptions,
|
|
44
|
-
disabled,
|
|
45
|
-
size = 'md',
|
|
46
|
-
className,
|
|
47
|
-
UNSAFE_triggerButtonProps,
|
|
48
|
-
triggerRef: externalTriggerRef,
|
|
49
|
-
onFilterChange = noop,
|
|
50
|
-
onChange,
|
|
51
|
-
onOpen,
|
|
52
|
-
onClose,
|
|
53
|
-
onClear,
|
|
54
|
-
}: SelectInputProps<T, M>) {
|
|
55
|
-
const inputAttributes = useInputAttributes({ nonLabelable: true });
|
|
56
|
-
const id = idProp ?? inputAttributes.id;
|
|
57
|
-
|
|
58
|
-
const [open, setOpen] = useState(false);
|
|
59
|
-
|
|
60
|
-
const initialized = useRef(false);
|
|
61
|
-
const handleClose = useEffectEvent(onClose ?? (() => {}));
|
|
62
|
-
const handleOpen = useEffectEvent(onOpen ?? (() => {}));
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (initialized.current) {
|
|
65
|
-
if (open) {
|
|
66
|
-
handleOpen?.();
|
|
67
|
-
} else {
|
|
68
|
-
handleClose?.();
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
initialized.current = true;
|
|
72
|
-
}
|
|
73
|
-
}, [handleClose, handleOpen, open]);
|
|
74
|
-
|
|
75
|
-
const [filterQuery, _setFilterQuery] = useState('');
|
|
76
|
-
const deferredFilterQuery = useDeferredValue(filterQuery);
|
|
77
|
-
const setFilterQuery = useEffectEvent((query: string) => {
|
|
78
|
-
_setFilterQuery(query);
|
|
79
|
-
if (query !== filterQuery) {
|
|
80
|
-
onFilterChange({
|
|
81
|
-
query,
|
|
82
|
-
queryNormalized: query ? searchableString(query) : null,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const internalTriggerRef = useRef<HTMLButtonElement | null>(null);
|
|
88
|
-
|
|
89
|
-
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
90
|
-
const OptionsOverlay = screenSm ? SelectInputPopover : SelectInputBottomSheet;
|
|
91
|
-
|
|
92
|
-
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
93
|
-
const listboxRef = useRef<HTMLDivElement>(null);
|
|
94
|
-
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Attempts to resolve the `listbox` label
|
|
98
|
-
* @see https://storybook.wise.design/?path=/docs/forms-selectinput-accessibility--docs#labelling
|
|
99
|
-
*/
|
|
100
|
-
const getListBoxLabelProps = (): {
|
|
101
|
-
listBoxLabel?: string;
|
|
102
|
-
listBoxLabelledBy?: string;
|
|
103
|
-
} => {
|
|
104
|
-
if (UNSAFE_triggerButtonProps?.['aria-label']) {
|
|
105
|
-
return {
|
|
106
|
-
listBoxLabel: UNSAFE_triggerButtonProps['aria-label'],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (UNSAFE_triggerButtonProps?.['aria-labelledby']) {
|
|
111
|
-
return {
|
|
112
|
-
listBoxLabelledBy: UNSAFE_triggerButtonProps['aria-labelledby'],
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (inputAttributes['aria-labelledby']) {
|
|
117
|
-
return {
|
|
118
|
-
listBoxLabelledBy: inputAttributes['aria-labelledby'],
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return {};
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<ListboxBase
|
|
127
|
-
name={name}
|
|
128
|
-
multiple={multiple}
|
|
129
|
-
defaultValue={defaultValue as M extends true ? T[] : T}
|
|
130
|
-
value={controlledValue as M extends true ? T[] : T}
|
|
131
|
-
by={compareValues}
|
|
132
|
-
disabled={disabled}
|
|
133
|
-
onChange={
|
|
134
|
-
((value) => {
|
|
135
|
-
if (!multiple) {
|
|
136
|
-
setOpen(false);
|
|
137
|
-
}
|
|
138
|
-
onChange?.(value);
|
|
139
|
-
}) satisfies SelectInputProps<T, M>['onChange']
|
|
140
|
-
}
|
|
141
|
-
>
|
|
142
|
-
{({ disabled: uiDisabled, value }) => {
|
|
143
|
-
const placeholderShown =
|
|
144
|
-
multiple && Array.isArray(value) ? value.length === 0 : value == null;
|
|
145
|
-
return (
|
|
146
|
-
<OptionsOverlay
|
|
147
|
-
placement="bottom-start"
|
|
148
|
-
open={open}
|
|
149
|
-
renderTrigger={({ ref, getInteractionProps }) => (
|
|
150
|
-
<SelectInputTriggerButtonPropsContext.Provider
|
|
151
|
-
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
152
|
-
value={{
|
|
153
|
-
ref: (node) => {
|
|
154
|
-
ref(node);
|
|
155
|
-
if (externalTriggerRef) {
|
|
156
|
-
// eslint-disable-next-line no-param-reassign
|
|
157
|
-
externalTriggerRef.current = node;
|
|
158
|
-
} else {
|
|
159
|
-
internalTriggerRef.current = node;
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
size,
|
|
163
|
-
...inputAttributes,
|
|
164
|
-
...UNSAFE_triggerButtonProps,
|
|
165
|
-
id,
|
|
166
|
-
...mergeProps(
|
|
167
|
-
{
|
|
168
|
-
onClick: () => {
|
|
169
|
-
setOpen((prev) => !prev);
|
|
170
|
-
},
|
|
171
|
-
onKeyDown: (event: React.KeyboardEvent) => {
|
|
172
|
-
if (
|
|
173
|
-
event.key === ' ' ||
|
|
174
|
-
event.key === 'Enter' ||
|
|
175
|
-
event.key === 'ArrowDown' ||
|
|
176
|
-
event.key === 'ArrowUp'
|
|
177
|
-
) {
|
|
178
|
-
setOpen((prev) => !prev);
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
getInteractionProps(),
|
|
183
|
-
),
|
|
184
|
-
}}
|
|
185
|
-
>
|
|
186
|
-
{renderTrigger({
|
|
187
|
-
content: !placeholderShown ? (
|
|
188
|
-
<SelectInputOptionContentWithinTriggerContext.Provider value>
|
|
189
|
-
{multiple && Array.isArray(value)
|
|
190
|
-
? (value as readonly NonNullable<T>[])
|
|
191
|
-
.map((option) => renderValue(option, true))
|
|
192
|
-
.filter((node) => node != null)
|
|
193
|
-
.join(', ')
|
|
194
|
-
: renderValue(value as NonNullable<T>, true)}
|
|
195
|
-
</SelectInputOptionContentWithinTriggerContext.Provider>
|
|
196
|
-
) : (
|
|
197
|
-
placeholder
|
|
198
|
-
),
|
|
199
|
-
placeholderShown,
|
|
200
|
-
clear:
|
|
201
|
-
onClear != null
|
|
202
|
-
? () => {
|
|
203
|
-
onClear();
|
|
204
|
-
(externalTriggerRef?.current ?? internalTriggerRef.current)?.focus({
|
|
205
|
-
preventScroll: true,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
: undefined,
|
|
209
|
-
disabled: uiDisabled,
|
|
210
|
-
size,
|
|
211
|
-
className,
|
|
212
|
-
})}
|
|
213
|
-
</SelectInputTriggerButtonPropsContext.Provider>
|
|
214
|
-
)}
|
|
215
|
-
initialFocusRef={controllerRef}
|
|
216
|
-
size={filterable ? 'lg' : 'md'}
|
|
217
|
-
padding="none"
|
|
218
|
-
onClose={() => {
|
|
219
|
-
setOpen(false);
|
|
220
|
-
}}
|
|
221
|
-
onCloseEnd={() => {
|
|
222
|
-
setFilterQuery('');
|
|
223
|
-
}}
|
|
224
|
-
>
|
|
225
|
-
<SelectInputOptions
|
|
226
|
-
id={id ? `${id}Search` : undefined}
|
|
227
|
-
parentId={parentId}
|
|
228
|
-
items={items}
|
|
229
|
-
compareValues={compareValues}
|
|
230
|
-
renderValue={renderValue}
|
|
231
|
-
renderFooter={renderFooter}
|
|
232
|
-
filterable={filterable}
|
|
233
|
-
filterPlaceholder={filterPlaceholder}
|
|
234
|
-
sortFilteredOptions={sortFilteredOptions}
|
|
235
|
-
searchInputRef={searchInputRef}
|
|
236
|
-
listboxRef={listboxRef}
|
|
237
|
-
filterQuery={deferredFilterQuery}
|
|
238
|
-
autocomplete={autocomplete}
|
|
239
|
-
name={name}
|
|
240
|
-
onFilterChange={setFilterQuery}
|
|
241
|
-
onAutocompleteSelect={(matchedValue) => {
|
|
242
|
-
onChange?.(matchedValue as M extends true ? T[] : T);
|
|
243
|
-
if (!multiple) {
|
|
244
|
-
setOpen(false);
|
|
245
|
-
}
|
|
246
|
-
}}
|
|
247
|
-
{...getListBoxLabelProps()}
|
|
248
|
-
/>
|
|
249
|
-
</OptionsOverlay>
|
|
250
|
-
);
|
|
251
|
-
}}
|
|
252
|
-
</ListboxBase>
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Attach sortByRelevance to the component for convenience
|
|
257
|
-
SelectInput.sortByRelevance = sortByRelevance;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ButtonProps } from '../../button/Button.types';
|
|
3
|
-
import { WithInputAttributesProps } from './SelectInput.contexts';
|
|
4
|
-
|
|
5
|
-
// Item interfaces
|
|
6
|
-
export interface SelectInputOptionItem<T = string> {
|
|
7
|
-
type: 'option';
|
|
8
|
-
value: T;
|
|
9
|
-
filterMatchers?: readonly string[];
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface SelectInputGroupItem<T = string> {
|
|
14
|
-
type: 'group';
|
|
15
|
-
label: ReactNode;
|
|
16
|
-
options: readonly SelectInputOptionItem<T>[];
|
|
17
|
-
action?: {
|
|
18
|
-
label: string;
|
|
19
|
-
onClick: ButtonProps['onClick'];
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface SelectInputSeparatorItem {
|
|
24
|
-
type: 'separator';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type SelectInputItem<T = string> =
|
|
28
|
-
| SelectInputOptionItem<T>
|
|
29
|
-
| SelectInputGroupItem<T>
|
|
30
|
-
| SelectInputSeparatorItem;
|
|
31
|
-
|
|
32
|
-
// Main component props
|
|
33
|
-
export interface SelectInputProps<T = string, M extends boolean = false> {
|
|
34
|
-
id?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Sets the `data-wds-parent` attribute on the listbox container, which is needed for complex components like DateInput to correctly manage event handling.
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
parentId?: string;
|
|
40
|
-
name?: string;
|
|
41
|
-
multiple?: M;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
items: readonly SelectInputItem<NonNullable<T>>[];
|
|
44
|
-
/**
|
|
45
|
-
* Enables browser autocomplete integration through the search input.
|
|
46
|
-
* Accepts standard HTML autocomplete values (e.g., "country-name", "address-level1").
|
|
47
|
-
*
|
|
48
|
-
* Requires `filterable={true}` to enable the search input.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* <SelectInput
|
|
52
|
-
* name="country"
|
|
53
|
-
* autocomplete="country-name"
|
|
54
|
-
* filterable={true}
|
|
55
|
-
* items={[{
|
|
56
|
-
* type: 'option',
|
|
57
|
-
* value: 'GB',
|
|
58
|
-
* filterMatchers: ['United Kingdom', 'UK']
|
|
59
|
-
* }]}
|
|
60
|
-
* />
|
|
61
|
-
*/
|
|
62
|
-
autocomplete?: string;
|
|
63
|
-
defaultValue?: M extends true ? readonly T[] : T;
|
|
64
|
-
value?: M extends true ? readonly T[] : T;
|
|
65
|
-
compareValues?:
|
|
66
|
-
| (keyof NonNullable<T> & string)
|
|
67
|
-
| ((a: T | undefined, b: T | undefined) => boolean);
|
|
68
|
-
renderValue?: (value: NonNullable<T>, withinTrigger: boolean) => React.ReactNode;
|
|
69
|
-
renderFooter?: (args: {
|
|
70
|
-
resultsEmpty: boolean;
|
|
71
|
-
queryNormalized: string | null | undefined;
|
|
72
|
-
}) => React.ReactNode;
|
|
73
|
-
renderTrigger?: (args: {
|
|
74
|
-
content: React.ReactNode;
|
|
75
|
-
placeholderShown: boolean;
|
|
76
|
-
clear: (() => void) | undefined;
|
|
77
|
-
disabled: boolean;
|
|
78
|
-
size: 'sm' | 'md' | 'lg';
|
|
79
|
-
className: string | undefined;
|
|
80
|
-
}) => React.ReactNode;
|
|
81
|
-
filterable?: boolean;
|
|
82
|
-
filterPlaceholder?: string;
|
|
83
|
-
sortFilteredOptions?: (
|
|
84
|
-
a: SelectInputOptionItem<NonNullable<T>>,
|
|
85
|
-
b: SelectInputOptionItem<NonNullable<T>>,
|
|
86
|
-
searchQuery: string,
|
|
87
|
-
) => number;
|
|
88
|
-
disabled?: boolean;
|
|
89
|
-
size?: 'sm' | 'md' | 'lg';
|
|
90
|
-
className?: string;
|
|
91
|
-
UNSAFE_triggerButtonProps?: WithInputAttributesProps['inputAttributes'] & {
|
|
92
|
-
'aria-label'?: string;
|
|
93
|
-
};
|
|
94
|
-
/** Ref to the select trigger button element. */
|
|
95
|
-
triggerRef?: React.MutableRefObject<HTMLButtonElement | null>;
|
|
96
|
-
onFilterChange?: (args: { query: string; queryNormalized: string | null }) => void;
|
|
97
|
-
onChange?: (value: M extends true ? T[] : T) => void;
|
|
98
|
-
onOpen?: () => void;
|
|
99
|
-
onClose?: () => void;
|
|
100
|
-
onClear?: () => void;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export type {
|
|
104
|
-
SelectInputTriggerButtonElementType,
|
|
105
|
-
SelectInputTriggerButtonProps,
|
|
106
|
-
} from './TriggerButton';
|
|
107
|
-
export type { SelectInputClearButtonProps } from './ClearButton';
|
|
108
|
-
export type { SelectInputOptionContentProps } from './OptionContent';
|
|
109
|
-
export type { SelectInputOptionProps } from './Option';
|
|
110
|
-
export type { SelectInputItemViewProps } from './ItemView';
|
|
111
|
-
export type { SelectInputGroupItemViewProps } from './ItemView/GroupItemView';
|
|
112
|
-
export type { SelectInputOptionsProps } from './Options';
|
|
113
|
-
export type { SelectInputOptionsContainerProps } from './Options/OptionsContainer';
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';
|
|
2
|
-
|
|
3
|
-
const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
|
|
4
|
-
export { MAX_ITEMS_WITHOUT_VIRTUALIZATION };
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Converts a string to a normalized, searchable format by:
|
|
8
|
-
* - Trimming whitespace
|
|
9
|
-
* - Normalizing whitespace (convert multiple spaces to single space)
|
|
10
|
-
* - Converting to NFD normalization form to handle diacritics
|
|
11
|
-
* - Removing combining diacritical marks
|
|
12
|
-
* - Converting to lowercase
|
|
13
|
-
*/
|
|
14
|
-
export function searchableString(value: string) {
|
|
15
|
-
return (
|
|
16
|
-
value
|
|
17
|
-
.trim()
|
|
18
|
-
.replace(/\s+/gu, ' ')
|
|
19
|
-
// NFD converts an Å to A + ̊ (and other special characters)
|
|
20
|
-
.normalize('NFD')
|
|
21
|
-
// and then this replaces the ̊ with nothing (and other special characters)
|
|
22
|
-
.replace(/[\u0300-\u036f]/g, '')
|
|
23
|
-
.toLowerCase()
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Extracts searchable strings from a value.
|
|
29
|
-
* - If the value is a string, returns a normalized version.
|
|
30
|
-
* - If the value is an object, extracts all string values and normalizes them.
|
|
31
|
-
* - Otherwise returns an empty array.
|
|
32
|
-
*/
|
|
33
|
-
export function inferSearchableStrings(value: unknown) {
|
|
34
|
-
if (typeof value === 'string') {
|
|
35
|
-
return [searchableString(value)];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (typeof value === 'object' && value != null) {
|
|
39
|
-
return Object.values(value)
|
|
40
|
-
.filter((innerValue) => typeof innerValue === 'string')
|
|
41
|
-
.map((innerValue) => searchableString(innerValue));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.
|
|
49
|
-
*/
|
|
50
|
-
export function dedupeSelectInputOptionItem<T>(
|
|
51
|
-
item: SelectInputOptionItem<T>,
|
|
52
|
-
existingValues: Set<T>,
|
|
53
|
-
compareValues?: (a: T, b: T) => boolean,
|
|
54
|
-
): SelectInputOptionItem<T | undefined> {
|
|
55
|
-
const isDuplicate = compareValues
|
|
56
|
-
? Array.from(existingValues).some((existingValue) => compareValues(item.value, existingValue))
|
|
57
|
-
: existingValues.has(item.value);
|
|
58
|
-
|
|
59
|
-
if (!isDuplicate) {
|
|
60
|
-
existingValues.add(item.value);
|
|
61
|
-
return item;
|
|
62
|
-
}
|
|
63
|
-
return { ...item, value: undefined };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Sets the `value` of duplicate option items to `undefined`, hiding them when
|
|
68
|
-
* rendered. Indexes are kept intact within groups to preserve the active item
|
|
69
|
-
* between filter changes when possible.
|
|
70
|
-
*/
|
|
71
|
-
export function dedupeSelectInputItems<T>(
|
|
72
|
-
items: readonly SelectInputItem<T>[],
|
|
73
|
-
compareValues?: (a: T, b: T) => boolean,
|
|
74
|
-
): SelectInputItem<T | undefined>[] {
|
|
75
|
-
const existingValues = new Set<T>();
|
|
76
|
-
|
|
77
|
-
return items.map((item) => {
|
|
78
|
-
switch (item.type) {
|
|
79
|
-
case 'option': {
|
|
80
|
-
return dedupeSelectInputOptionItem(item, existingValues, compareValues);
|
|
81
|
-
}
|
|
82
|
-
case 'group': {
|
|
83
|
-
return {
|
|
84
|
-
...item,
|
|
85
|
-
options: item.options.map((option) =>
|
|
86
|
-
dedupeSelectInputOptionItem(option, existingValues, compareValues),
|
|
87
|
-
),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
default:
|
|
91
|
-
}
|
|
92
|
-
return item;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Checks if a SelectInputOptionItem matches the search needle.
|
|
98
|
-
*/
|
|
99
|
-
export function selectInputOptionItemIncludesNeedle<T>(
|
|
100
|
-
item: SelectInputOptionItem<T>,
|
|
101
|
-
needle: string,
|
|
102
|
-
) {
|
|
103
|
-
return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
|
|
104
|
-
haystack.includes(needle),
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Filters SelectInputItems based on the provided predicate function.
|
|
110
|
-
* For group items, it checks if any of their options match the predicate.
|
|
111
|
-
*/
|
|
112
|
-
export function filterSelectInputItems<T>(
|
|
113
|
-
items: readonly SelectInputItem<T>[],
|
|
114
|
-
predicate: (item: SelectInputOptionItem<T>) => boolean,
|
|
115
|
-
) {
|
|
116
|
-
return items.filter((item) => {
|
|
117
|
-
switch (item.type) {
|
|
118
|
-
case 'option': {
|
|
119
|
-
return predicate(item);
|
|
120
|
-
}
|
|
121
|
-
case 'group': {
|
|
122
|
-
return item.options.some((option) => predicate(option));
|
|
123
|
-
}
|
|
124
|
-
default:
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Flattens and sorts filtered options using the provided comparator.
|
|
132
|
-
* Extracts all options from groups, filters out undefined values (deduplicated items),
|
|
133
|
-
* sorts them, and returns as a flat list of option items.
|
|
134
|
-
*/
|
|
135
|
-
export function sortSelectInputItems<T>(
|
|
136
|
-
items: readonly SelectInputItem<T | undefined>[],
|
|
137
|
-
compareFn: (
|
|
138
|
-
a: SelectInputOptionItem<NonNullable<T>>,
|
|
139
|
-
b: SelectInputOptionItem<NonNullable<T>>,
|
|
140
|
-
searchQuery: string,
|
|
141
|
-
) => number,
|
|
142
|
-
searchQuery: string,
|
|
143
|
-
): SelectInputItem<NonNullable<T>>[] {
|
|
144
|
-
const flattenedOption = items.flatMap((item) => {
|
|
145
|
-
if (item.type === 'option') {
|
|
146
|
-
return item.value !== undefined ? [item as SelectInputOptionItem<NonNullable<T>>] : [];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (item.type === 'group') {
|
|
150
|
-
return item.options.filter(
|
|
151
|
-
(option): option is SelectInputOptionItem<NonNullable<T>> => option.value !== undefined,
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return [];
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// eslint-disable-next-line functional/immutable-data
|
|
159
|
-
return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.
|
|
164
|
-
* Prioritizes: exact matches > starts with > contains > alphabetical.
|
|
165
|
-
*
|
|
166
|
-
* @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```tsx
|
|
170
|
-
* <SelectInput
|
|
171
|
-
* filterable
|
|
172
|
-
* sortFilteredOptions={sortByRelevance((value) => value.name)}
|
|
173
|
-
* // ...
|
|
174
|
-
* />
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
export function sortByRelevance<T>(
|
|
178
|
-
getLabel: (value: T) => string = (value) => (value as { title: string }).title,
|
|
179
|
-
): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number {
|
|
180
|
-
return (a, b, searchQuery) => {
|
|
181
|
-
const normalizedQuery = searchQuery.toLowerCase();
|
|
182
|
-
const labelA = getLabel(a.value).toLowerCase();
|
|
183
|
-
const labelB = getLabel(b.value).toLowerCase();
|
|
184
|
-
|
|
185
|
-
// Prioritize exact matches
|
|
186
|
-
const aExactMatch = labelA === normalizedQuery;
|
|
187
|
-
const bExactMatch = labelB === normalizedQuery;
|
|
188
|
-
if (aExactMatch && !bExactMatch) return -1;
|
|
189
|
-
if (!aExactMatch && bExactMatch) return 1;
|
|
190
|
-
|
|
191
|
-
// Then prioritize options where label starts with the search query
|
|
192
|
-
const aStartsWith = labelA.startsWith(normalizedQuery);
|
|
193
|
-
const bStartsWith = labelB.startsWith(normalizedQuery);
|
|
194
|
-
if (aStartsWith && !bStartsWith) return -1;
|
|
195
|
-
if (!aStartsWith && bStartsWith) return 1;
|
|
196
|
-
|
|
197
|
-
// Then prioritize options where label contains the search query
|
|
198
|
-
const aContains = labelA.includes(normalizedQuery);
|
|
199
|
-
const bContains = labelB.includes(normalizedQuery);
|
|
200
|
-
if (aContains && !bContains) return -1;
|
|
201
|
-
if (!aContains && bContains) return 1;
|
|
202
|
-
|
|
203
|
-
// Finally sort alphabetically
|
|
204
|
-
return labelA.localeCompare(labelB);
|
|
205
|
-
};
|
|
206
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ListboxButton } from '@headlessui/react';
|
|
2
|
-
import mergeProps from 'merge-props';
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { PolymorphicWithOverrides } from '../../../common/polymorphicWithOverrides/PolymorphicWithOverrides';
|
|
5
|
-
import { Merge } from '../../../utils';
|
|
6
|
-
import { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';
|
|
7
|
-
|
|
8
|
-
export type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
9
|
-
|
|
10
|
-
export type SelectInputTriggerButtonProps<
|
|
11
|
-
T extends SelectInputTriggerButtonElementType = 'button',
|
|
12
|
-
> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The trigger button component for SelectInput.
|
|
16
|
-
* Uses Headless UI's ListboxButton with polymorphic support to allow
|
|
17
|
-
* rendering as different element types.
|
|
18
|
-
*/
|
|
19
|
-
export function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({
|
|
20
|
-
as = 'button' as T,
|
|
21
|
-
...restProps
|
|
22
|
-
}: SelectInputTriggerButtonProps<T>) {
|
|
23
|
-
const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(
|
|
24
|
-
SelectInputTriggerButtonPropsContext,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<ListboxButton
|
|
29
|
-
ref={ref}
|
|
30
|
-
as={PolymorphicWithOverrides}
|
|
31
|
-
role="combobox"
|
|
32
|
-
__overrides={{ as, size, ...interactionProps } as Record<string, unknown>}
|
|
33
|
-
{...mergeProps({ onClick, onKeyDown }, restProps)}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Re-export all components from their new locations
|
|
2
|
-
export * from './ClearButton';
|
|
3
|
-
export * from './Option';
|
|
4
|
-
export * from './OptionContent';
|
|
5
|
-
export * from './TriggerButton';
|
|
6
|
-
export * from './ItemView';
|
|
7
|
-
export * from './Options';
|
|
8
|
-
export * from './BottomSheet';
|
|
9
|
-
export * from './Popover';
|
|
10
|
-
export * from './ButtonInput';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Export from the new structure
|
|
2
|
-
export * from './SelectInput';
|
|
3
|
-
export * from './SelectInput.types';
|
|
4
|
-
export * from './SelectInput.utils';
|
|
5
|
-
export * from './SelectInput.contexts';
|
|
6
|
-
|
|
7
|
-
// Export components directly
|
|
8
|
-
export * from './ClearButton';
|
|
9
|
-
export * from './Option';
|
|
10
|
-
export * from './OptionContent';
|
|
11
|
-
export * from './TriggerButton';
|
|
12
|
-
export * from './DefaultRenderTrigger';
|
|
13
|
-
export * from './ItemView';
|
|
14
|
-
export * from './Options';
|
|
File without changes
|
|
File without changes
|