@transferwise/components 46.142.0 → 46.143.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 +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +1 -1
- package/build/actionButton/ActionButton.js +1 -1
- package/build/actionButton/ActionButton.mjs +1 -1
- package/build/actionOption/ActionOption.js +1 -1
- package/build/actionOption/ActionOption.mjs +1 -1
- package/build/alert/Alert.js +1 -1
- package/build/alert/Alert.mjs +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs +1 -1
- package/build/avatar/Avatar.js +1 -1
- package/build/avatar/Avatar.mjs +1 -1
- package/build/avatarLayout/AvatarLayout.js +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +1 -1
- package/build/avatarView/AvatarView.js +1 -1
- package/build/avatarView/AvatarView.mjs +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +1 -1
- package/build/badge/Badge.js +1 -1
- package/build/badge/Badge.mjs +1 -1
- package/build/button/Button.js +1 -1
- package/build/button/Button.mjs +1 -1
- package/build/button/LegacyButton.js +1 -1
- package/build/button/LegacyButton.mjs +1 -1
- package/build/button/classMap.js +1 -1
- package/build/button/classMap.mjs +1 -1
- package/build/button/legacyUtils/legacyUtils.js +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +1 -1
- package/build/card/Card.js +1 -1
- package/build/card/Card.mjs +1 -1
- package/build/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/chevron/Chevron.js +1 -1
- package/build/chevron/Chevron.mjs +1 -1
- package/build/chips/Chip.js +1 -1
- package/build/chips/Chip.mjs +1 -1
- package/build/circularButton/CircularButton.js +2 -2
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +2 -2
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +2 -2
- 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/circle/Circle.js +2 -2
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +2 -2
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/hooks/useLayout/useLayout.js +6 -6
- package/build/common/hooks/useLayout/useLayout.js.map +1 -1
- package/build/common/hooks/useLayout/useLayout.mjs +1 -1
- package/build/common/hooks/useLayout/useLayout.mjs.map +1 -1
- package/build/common/hooks/useScreenSize.js.map +1 -1
- package/build/common/hooks/useScreenSize.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -1
- package/build/common/panel/Panel.mjs +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/dateInput/DateInput.js +1 -1
- package/build/dateInput/DateInput.mjs +1 -1
- package/build/dateLookup/DateLookup.js +2 -2
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +1 -1
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +1 -1
- package/build/decision/Decision.js +3 -3
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +1 -1
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +1 -1
- package/build/definitionList/DefinitionList.mjs +1 -1
- package/build/dimmer/Dimmer.js +1 -1
- package/build/dimmer/Dimmer.mjs +1 -1
- package/build/display/Display.js +1 -1
- package/build/display/Display.mjs +1 -1
- package/build/drawer/Drawer.js +1 -1
- package/build/drawer/Drawer.mjs +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +1 -1
- package/build/field/Field.js +1 -1
- package/build/field/Field.mjs +1 -1
- package/build/flowNavigation/FlowNavigation.js +3 -3
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +1 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/image/Image.js +1 -1
- package/build/image/Image.mjs +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/info/Info.js +1 -1
- package/build/info/Info.mjs +1 -1
- package/build/inlineAlert/InlineAlert.js +1 -1
- package/build/inlineAlert/InlineAlert.mjs +1 -1
- package/build/inputs/SearchInput.js +1 -1
- package/build/inputs/SearchInput.mjs +1 -1
- package/build/inputs/SelectInput/SelectInput.js +2 -2
- package/build/inputs/SelectInput/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput/SelectInput.mjs +1 -1
- package/build/inputs/SelectInput/SelectInput.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +1 -1
- package/build/instructionsList/InstructionsList.mjs +1 -1
- package/build/link/Link.js +1 -1
- package/build/link/Link.mjs +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +1 -1
- package/build/listItem/ListItem.js +1 -1
- package/build/listItem/ListItem.mjs +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
- package/build/loader/Loader.js +1 -1
- package/build/loader/Loader.mjs +1 -1
- package/build/logo/Logo.js +3 -3
- 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 +308 -394
- package/build/markdown/Markdown.js +1 -1
- package/build/markdown/Markdown.mjs +1 -1
- package/build/modal/Modal.js +3 -3
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +3 -3
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -1
- package/build/navigationOption/NavigationOption.js +1 -1
- package/build/navigationOption/NavigationOption.mjs +1 -1
- package/build/nudge/Nudge.js +1 -1
- package/build/nudge/Nudge.mjs +1 -1
- package/build/overlayHeader/OverlayHeader.js +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -1
- package/build/popover/Popover.js +1 -1
- package/build/popover/Popover.mjs +1 -1
- package/build/processIndicator/ProcessIndicator.js +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +1 -1
- package/build/progressBar/ProgressBar.js +1 -1
- package/build/progressBar/ProgressBar.mjs +1 -1
- package/build/promoCard/PromoCard.js +1 -1
- package/build/promoCard/PromoCard.mjs +1 -1
- package/build/promoCard/PromoCardIndicator.js +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js +2 -2
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +2 -2
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +2 -2
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -1
- package/build/provider/Provider.js +1 -1
- package/build/provider/Provider.mjs +1 -1
- package/build/radio/Radio.js +1 -1
- package/build/radio/Radio.mjs +1 -1
- package/build/segmentedControl/SegmentedControl.js +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +1 -1
- package/build/select/Select.js +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/select/option/Option.js +1 -1
- package/build/select/option/Option.mjs +1 -1
- package/build/statusIcon/StatusIcon.js +2 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +1 -1
- package/build/stepper/Stepper.mjs +1 -1
- package/build/sticky/Sticky.js +1 -1
- package/build/sticky/Sticky.mjs +1 -1
- package/build/styles/accordion/Accordion.css +1 -1
- package/build/styles/card/Card.css +2 -2
- package/build/styles/carousel/Carousel.css +5 -5
- package/build/styles/common/Option/Option.css +2 -4
- package/build/styles/common/baseCard/BaseCard.css +1 -1
- package/build/styles/container/Container.css +3 -3
- package/build/styles/criticalBanner/CriticalCommsBanner.css +1 -1
- package/build/styles/css/accordion.css +4 -4
- package/build/styles/css/button-groups.css +6 -6
- package/build/styles/css/buttons.css +1 -1
- package/build/styles/css/circles.css +1 -1
- package/build/styles/css/column-layout.css +4 -4
- package/build/styles/css/decision.css +4 -4
- package/build/styles/css/dropdowns.css +10 -10
- package/build/styles/css/droppable.css +8 -8
- package/build/styles/css/flex.css +13 -15
- package/build/styles/css/footer.css +3 -3
- package/build/styles/css/grid.css +19 -19
- package/build/styles/css/input-groups.css +12 -12
- package/build/styles/css/list-group.css +8 -8
- package/build/styles/css/modals.css +6 -6
- package/build/styles/css/navbar.css +62 -62
- package/build/styles/css/navs.css +2 -2
- package/build/styles/css/neptune.css +259 -327
- package/build/styles/css/panels.css +9 -9
- package/build/styles/css/popovers.css +13 -13
- package/build/styles/css/select.css +1 -1
- package/build/styles/css/sequences.css +6 -6
- package/build/styles/css/table.css +6 -6
- package/build/styles/css/utilities.css +8 -20
- package/build/styles/css/wells.css +4 -18
- package/build/styles/dateInput/DateInput.css +1 -1
- package/build/styles/definitionList/DefinitionList.css +2 -2
- package/build/styles/drawer/Drawer.css +2 -2
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/inputs/Input.css +3 -3
- package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
- package/build/styles/inputs/SelectInput/SelectInput.css +2 -2
- package/build/styles/inputs/TextArea.css +3 -3
- package/build/styles/less/legacy-variables.less +34 -47
- package/build/styles/main.css +308 -394
- package/build/styles/modal/Modal.css +7 -20
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/styles/popover/Popover.css +3 -3
- package/build/styles/promoCard/PromoCard.css +1 -1
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +1 -1
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +1 -1
- package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
- package/build/styles/props/custom-media.css +23 -11
- package/build/styles/snackbar/Snackbar.css +2 -2
- package/build/styles/stepper/Stepper.css +2 -2
- package/build/styles/styles/less/accordion.css +4 -4
- package/build/styles/styles/less/button-groups.css +6 -6
- package/build/styles/styles/less/buttons.css +1 -1
- package/build/styles/styles/less/circles.css +1 -1
- package/build/styles/styles/less/column-layout.css +4 -4
- package/build/styles/styles/less/decision.css +4 -4
- package/build/styles/styles/less/dropdowns.css +10 -10
- package/build/styles/styles/less/droppable.css +8 -8
- package/build/styles/styles/less/flex.css +13 -15
- package/build/styles/styles/less/footer.css +3 -3
- package/build/styles/styles/less/forms/bootstrap-forms.css +9 -9
- package/build/styles/styles/less/grid.css +19 -19
- package/build/styles/styles/less/input-groups.css +12 -12
- package/build/styles/styles/less/list-group.css +8 -8
- package/build/styles/styles/less/modals.css +6 -6
- package/build/styles/styles/less/navbar.css +62 -62
- package/build/styles/styles/less/navs.css +2 -2
- package/build/styles/styles/less/neptune.css +259 -327
- package/build/styles/styles/less/panels.css +9 -9
- package/build/styles/styles/less/popovers.css +13 -13
- package/build/styles/styles/less/select.css +1 -1
- package/build/styles/styles/less/sequences.css +6 -6
- package/build/styles/styles/less/table.css +6 -6
- package/build/styles/styles/less/utilities.css +8 -20
- package/build/styles/styles/less/wells.css +4 -18
- package/build/styles/styles/props/custom-media.css +1 -11
- package/build/styles/table/Table.css +1 -1
- package/build/styles/tabs/Tabs.css +2 -2
- package/build/styles/typeahead/Typeahead.css +1 -1
- package/build/summary/Summary.js +1 -1
- package/build/summary/Summary.mjs +1 -1
- package/build/table/Table.js +1 -1
- package/build/table/Table.mjs +1 -1
- package/build/table/TableRow.js +1 -1
- package/build/table/TableRow.mjs +1 -1
- package/build/table/TableStatusText.js +1 -1
- package/build/table/TableStatusText.mjs +1 -1
- package/build/tabs/Tabs.js +1 -1
- package/build/tabs/Tabs.mjs +1 -1
- package/build/tile/Tile.js +1 -1
- package/build/tile/Tile.mjs +1 -1
- package/build/title/Title.js +1 -1
- package/build/title/Title.mjs +1 -1
- package/build/tooltip/Tooltip.js +1 -1
- package/build/tooltip/Tooltip.mjs +1 -1
- package/build/typeahead/Typeahead.js +1 -1
- package/build/typeahead/Typeahead.mjs +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/hooks/useScreenSize.d.ts +1 -1
- package/build/types/common/hooks/useScreenSize.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -1
- package/build/types/common/index.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/upload/Upload.js +1 -1
- package/build/upload/Upload.mjs +1 -1
- package/build/upload/steps/completeStep/completeStep.js +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +1 -1
- package/build/uploadInput/uploadButton/defaults.js +1 -1
- package/build/uploadInput/uploadButton/defaults.mjs +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.css +1 -1
- package/src/card/Card.css +2 -2
- package/src/carousel/Carousel.css +5 -5
- package/src/carousel/Carousel.less +3 -3
- package/src/circularButton/CircularButton.tsx +3 -2
- package/src/common/Option/Option.css +2 -4
- package/src/common/Option/Option.less +2 -4
- package/src/common/baseCard/BaseCard.css +1 -1
- package/src/common/bottomSheet/BottomSheet.tsx +2 -2
- package/src/common/circle/Circle.tsx +2 -2
- package/src/common/hooks/useLayout/useLayout.ts +1 -1
- package/src/common/hooks/useScreenSize.ts +1 -1
- package/src/common/index.ts +1 -1
- package/src/common/responsivePanel/ResponsivePanel.test.js +3 -2
- package/src/container/Container.css +3 -3
- package/src/criticalBanner/CriticalCommsBanner.css +1 -1
- package/src/dateInput/DateInput.css +1 -1
- package/src/dateLookup/DateLookup.tsx +1 -1
- package/src/decision/Decision.test.tsx +2 -1
- package/src/decision/Decision.tsx +2 -1
- package/src/definitionList/DefinitionList.css +2 -2
- package/src/definitionList/DefinitionList.less +2 -2
- package/src/drawer/Drawer.css +2 -2
- package/src/drawer/Drawer.less +4 -3
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/flowNavigation/FlowNavigation.less +2 -1
- package/src/flowNavigation/FlowNavigation.story.tsx +6 -3
- package/src/flowNavigation/FlowNavigation.test.js +1 -1
- package/src/flowNavigation/FlowNavigation.tsx +2 -1
- package/src/index.ts +1 -1
- package/src/inputs/Input.css +3 -3
- package/src/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
- package/src/inputs/SelectInput/SelectInput.css +2 -2
- package/src/inputs/SelectInput/SelectInput.tsx +1 -1
- package/src/inputs/TextArea.css +3 -3
- package/src/logo/Logo.tsx +1 -1
- package/src/main.css +308 -394
- package/src/modal/Modal.css +7 -20
- package/src/modal/Modal.less +7 -19
- package/src/modal/Modal.tsx +2 -2
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.less +3 -2
- package/src/popover/Popover.css +3 -3
- package/src/popover/Popover.test.tsx +2 -1
- package/src/promoCard/PromoCard.css +1 -1
- package/src/prompt/ActionPrompt/ActionPrompt.css +1 -1
- package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
- package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +37 -6
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +3 -2
- package/src/prompt/CriticalBanner/CriticalBanner.css +1 -1
- package/src/prompt/CriticalBanner/CriticalBanner.less +2 -2
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
- package/src/select/Select.test.tsx +1 -1
- package/src/snackbar/Snackbar.css +2 -2
- package/src/statusIcon/StatusIcon.tsx +3 -2
- package/src/stepper/Stepper.css +2 -2
- package/src/styles/less/accordion.css +4 -4
- package/src/styles/less/addons/_display-utilities.less +13 -27
- package/src/styles/less/button-groups.css +6 -6
- package/src/styles/less/buttons.css +1 -1
- package/src/styles/less/circles.css +1 -1
- package/src/styles/less/column-layout.css +4 -4
- package/src/styles/less/core/_typography-utilities.less +10 -22
- package/src/styles/less/decision.css +4 -4
- package/src/styles/less/dropdowns.css +10 -10
- package/src/styles/less/droppable.css +8 -8
- package/src/styles/less/flex.css +13 -15
- package/src/styles/less/flex.less +1 -3
- package/src/styles/less/footer.css +3 -3
- package/src/styles/less/forms/bootstrap-forms.css +9 -9
- package/src/styles/less/forms/bootstrap-forms.less +1 -1
- package/src/styles/less/grid.css +19 -19
- package/src/styles/less/input-groups.css +12 -12
- package/src/styles/less/list-group.css +8 -8
- package/src/styles/less/modals.css +6 -6
- package/src/styles/less/modals.less +4 -4
- package/src/styles/less/navbar.css +62 -62
- package/src/styles/less/navbar.less +2 -2
- package/src/styles/less/navs.css +2 -2
- package/src/styles/less/neptune.bundle.less +1 -0
- package/src/styles/less/neptune.css +259 -327
- package/src/styles/less/panels.css +9 -9
- package/src/styles/less/popovers.css +13 -13
- package/src/styles/less/popovers.less +6 -6
- package/src/styles/less/select.css +1 -1
- package/src/styles/less/sequences.css +6 -6
- package/src/styles/less/table.css +6 -6
- package/src/styles/less/table.less +1 -1
- package/src/styles/less/utilities.css +8 -20
- package/src/styles/less/utilities.less +6 -14
- package/src/styles/less/wells.css +4 -18
- package/src/styles/less/wells.less +3 -5
- package/src/styles/props/custom-media.css +1 -11
- package/src/styles/variables/legacy-variables.less +4 -47
- package/src/table/Table.css +1 -1
- package/src/tabs/Tabs.css +2 -2
- package/src/typeahead/Typeahead.css +1 -1
- package/src/uploadInput/uploadItem/UploadItem.less +2 -2
- package/build/common/propsValues/breakpoint.js +0 -12
- package/build/common/propsValues/breakpoint.js.map +0 -1
- package/build/common/propsValues/breakpoint.mjs +0 -12
- package/build/common/propsValues/breakpoint.mjs.map +0 -1
- package/build/types/common/propsValues/breakpoint.d.ts +0 -9
- package/build/types/common/propsValues/breakpoint.d.ts.map +0 -1
- package/src/common/propsValues/breakpoint.ts +0 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { useRef, useState, useContext } from 'react';
|
|
3
|
+
import { Breakpoint } from '@transferwise/neptune-tokens';
|
|
3
4
|
import Dimmer from '../../dimmer/Dimmer.mjs';
|
|
4
5
|
import Drawer from '../../drawer/Drawer.mjs';
|
|
5
6
|
import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider.mjs';
|
|
@@ -8,7 +9,6 @@ import { CloseButton } from '../closeButton/CloseButton.mjs';
|
|
|
8
9
|
import { isServerSide } from '../domHelpers/documentIosClick.mjs';
|
|
9
10
|
import { useConditionalListener } from '../hooks/useConditionalListener/useConditionalListener.mjs';
|
|
10
11
|
import '../../provider/direction/DirectionProvider.mjs';
|
|
11
|
-
import { Breakpoint } from '../propsValues/breakpoint.mjs';
|
|
12
12
|
import { useMedia } from '../hooks/useMedia.mjs';
|
|
13
13
|
import { Position } from '../propsValues/position.mjs';
|
|
14
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -143,7 +143,7 @@ const BottomSheet = ({
|
|
|
143
143
|
maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
const is400Zoom = useMedia(`(max-width: ${Breakpoint.
|
|
146
|
+
const is400Zoom = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);
|
|
147
147
|
const overlayId = useContext(OverlayIdContext);
|
|
148
148
|
return is400Zoom ? /*#__PURE__*/jsx(Drawer, {
|
|
149
149
|
"aria-labelledby": props['aria-labelledby'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps &\n Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby' | 'aria-label'>\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer\n aria-labelledby={props['aria-labelledby']}\n aria-label={props['aria-label']}\n role={role}\n open={props.open}\n className={props.className}\n onClose={close}\n >\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n <div\n id={overlayId}\n aria-labelledby={props['aria-labelledby'] || undefined}\n aria-label={props['aria-label'] || undefined}\n role={role}\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","role","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAkB,GAAG,CAAC;AAE5B,MAAMC,wBAAwB,GAAG,CAAC;AAElC,MAAMC,qBAAqB,GAAG,EAAE;AAUhC;;;;;AAKG;AACH,MAAMC,WAAW,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAG,QAAQ;EAAE,GAAGC;AAAK,CAAoB,KAAI;AACtE,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC;EAErD,MAAM,CA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AAA;AAAKE,YAAAA,SAAS,EAAC;AAA0B,WAAA,CACzC,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAErD;AAAM,WAAA,CACvF;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D;AAAQ,SACZ,CACP;OAAK;KACO;AAChB,GAAQ,CACT;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps &\n Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby' | 'aria-label'>\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer\n aria-labelledby={props['aria-labelledby']}\n aria-label={props['aria-label']}\n role={role}\n open={props.open}\n className={props.className}\n onClose={close}\n >\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n <div\n id={overlayId}\n aria-labelledby={props['aria-labelledby'] || undefined}\n aria-label={props['aria-label'] || undefined}\n role={role}\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","role","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","EXTRA_SMALL","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAkB,GAAG,CAAC;AAE5B,MAAMC,wBAAwB,GAAG,CAAC;AAElC,MAAMC,qBAAqB,GAAG,EAAE;AAUhC;;;;;AAKG;AACH,MAAMC,WAAW,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAG,QAAQ;EAAE,GAAGC;AAAK,CAAoB,KAAI;AACtE,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC;EAErD,MAAM,CAACG,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAAU,KAAK,CAAC;AAEtD;;;;AAIG;AACH,EAAA,MAAMC,WAAW,GAAGN,MAAM,CAAS,CAAC,CAAC;AAErC;;;;;AAKG;AACH,EAAA,MAAMO,UAAU,GAAGP,MAAM,CAAS,CAAC,CAAC;AACpC,EAAA,MAAMQ,kBAAkB,GAAGR,MAAM,CAAS,CAAC,CAAC;AAE5C;AACAS,EAAAA,sBAAsB,CAAC;IACrBC,cAAc,EAAEZ,KAAK,CAACa,IAAI,IAAI,CAACC,YAAY,EAAE;IAC7CC,QAAQ,EAAEA,MAAK;AACb,MAAA,IAAIZ,eAAe,CAACa,OAAO,KAAK,IAAI,EAAE;QACpC,MAAM;AAAEC,UAAAA;SAAW,GAAGd,eAAe,CAACa,OAAO;AAC7C,QAAA,IAAI,CAACE,4BAA4B,EAAE,EAAE;AACnCD,UAAAA,SAAS,CAACE,GAAG,CAAC,kCAAkC,CAAC;AACnD,QAAA,CAAC,MAAM;AACLF,UAAAA,SAA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d,QAAA,iBAAA,EAAiBxD,KAAK,CAAC,iBAAiB,CAAC,IAAIuB,SAAU;AACvD,QAAA,YAAA,EAAYvB,KAAK,CAAC,YAAY,CAAC,IAAIuB,SAAU;AAC7CxB,QAAAA,IAAI,EAAEA,IAAK;QACX,YAAA,EAAA,IAAU;AACV2E,QAAAA,YAAY,EAAEzC,YAAa;AAC3B0C,QAAAA,WAAW,EAAEvC,WAAY;AACzBwC,QAAAA,UAAU,EAAEpC,UAAW;AACvBqC,QAAAA,WAAW,EAAE5C,YAAa;AAC1B6C,QAAAA,WAAW,EAAE1C,WAAY;AACzB2C,QAAAA,SAAS,EAAEvC,UAAW;AAAAsB,QAAAA,QAAA,gBAEtBU,IAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAEhE,eAAgB;AAAC0D,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC;AAA0B,WAAA,CACzC,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAErD;AAAM,WAAA,CACvF;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D;AAAQ,SACZ,CACP;OAAK;KACO;AAChB,GAAQ,CACT;AACH;;;;"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
|
+
var neptuneTokens = require('@transferwise/neptune-tokens');
|
|
7
8
|
var useMedia = require('../hooks/useMedia.js');
|
|
8
|
-
var breakpoint = require('../propsValues/breakpoint.js');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
11
11
|
const MAP_ICON_SIZE = {
|
|
@@ -45,7 +45,7 @@ const Circle = /*#__PURE__*/React.forwardRef(function Circle({
|
|
|
45
45
|
style,
|
|
46
46
|
...props
|
|
47
47
|
}, ref) {
|
|
48
|
-
const isTinyViewport = useMedia.useMedia(`(max-width: ${
|
|
48
|
+
const isTinyViewport = useMedia.useMedia(`(max-width: ${neptuneTokens.Breakpoint.EXTRA_SMALL}px)`);
|
|
49
49
|
return /*#__PURE__*/jsxRuntime.jsx(Element, {
|
|
50
50
|
...props,
|
|
51
51
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport {
|
|
1
|
+
{"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useMedia } from '../hooks/useMedia';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72 | 88 | 96;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n 88: 44,\n 96: 48,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n 88: 36,\n 96: 40,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","EXTRA_SMALL","_jsx","clsx"],"mappings":";;;;;;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED;;;;AAIG;AACH,MAAMC,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAA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1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { Breakpoint } from '@transferwise/neptune-tokens';
|
|
3
4
|
import { useMedia } from '../hooks/useMedia.mjs';
|
|
4
|
-
import { Breakpoint } from '../propsValues/breakpoint.mjs';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
const MAP_ICON_SIZE = {
|
|
@@ -41,7 +41,7 @@ const Circle = /*#__PURE__*/forwardRef(function Circle({
|
|
|
41
41
|
style,
|
|
42
42
|
...props
|
|
43
43
|
}, ref) {
|
|
44
|
-
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.
|
|
44
|
+
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);
|
|
45
45
|
return /*#__PURE__*/jsx(Element, {
|
|
46
46
|
...props,
|
|
47
47
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport {
|
|
1
|
+
{"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useMedia } from '../hooks/useMedia';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72 | 88 | 96;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n 88: 44,\n 96: 48,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n 88: 36,\n 96: 40,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.EXTRA_SMALL}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","EXTRA_SMALL","_jsx","clsx"],"mappings":";;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED;;;;AAIG;AACH,MAAMC,a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EAClDC,SAAS,CACT;AAAAJ,IAAAA,QAAA,EAEDA;AAAQ,GACF,CAAC;AAEd,CAAC;;;;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var neptuneTokens = require('@transferwise/neptune-tokens');
|
|
4
4
|
var useScreenSize = require('../useScreenSize.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Prefer `useScreenSize` instead.
|
|
8
8
|
*/
|
|
9
9
|
const useLayout = () => {
|
|
10
|
-
const screenXs = useScreenSize.useScreenSize(
|
|
11
|
-
const screenSm = useScreenSize.useScreenSize(
|
|
12
|
-
const screenMd = useScreenSize.useScreenSize(
|
|
13
|
-
const screenLg = useScreenSize.useScreenSize(
|
|
14
|
-
const screenXl = useScreenSize.useScreenSize(
|
|
10
|
+
const screenXs = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.EXTRA_SMALL);
|
|
11
|
+
const screenSm = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.SMALL);
|
|
12
|
+
const screenMd = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.MEDIUM);
|
|
13
|
+
const screenLg = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.LARGE);
|
|
14
|
+
const screenXl = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.EXTRA_LARGE);
|
|
15
15
|
return {
|
|
16
16
|
isMobile: screenSm != null ? !screenSm : undefined,
|
|
17
17
|
isExtraSmall: screenXs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayout.js","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '
|
|
1
|
+
{"version":3,"file":"useLayout.js","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,2BAAa,CAACC,wBAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,wBAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,2BAAa,CAACC,wBAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,2BAAa,CAACC,wBAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,2BAAa,CAACC,wBAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayout.mjs","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '
|
|
1
|
+
{"version":3,"file":"useLayout.mjs","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,aAAa,CAACC,UAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,aAAa,CAACC,UAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,aAAa,CAACC,UAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,aAAa,CAACC,UAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreenSize.js","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '
|
|
1
|
+
{"version":3,"file":"useScreenSize.js","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;;;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,iBAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreenSize.mjs","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '
|
|
1
|
+
{"version":3,"file":"useScreenSize.mjs","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,QAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
|
|
@@ -7,8 +7,8 @@ var clsx = require('clsx');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
require('../theme.js');
|
|
9
9
|
require('../direction.js');
|
|
10
|
+
require('@transferwise/neptune-tokens');
|
|
10
11
|
require('../propsValues/control.js');
|
|
11
|
-
require('../propsValues/breakpoint.js');
|
|
12
12
|
require('../propsValues/size.js');
|
|
13
13
|
require('../propsValues/typography.js');
|
|
14
14
|
require('../propsValues/width.js');
|
|
@@ -3,8 +3,8 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import { forwardRef, useRef, useContext } from 'react';
|
|
4
4
|
import '../theme.mjs';
|
|
5
5
|
import '../direction.mjs';
|
|
6
|
+
import '@transferwise/neptune-tokens';
|
|
6
7
|
import '../propsValues/control.mjs';
|
|
7
|
-
import '../propsValues/breakpoint.mjs';
|
|
8
8
|
import '../propsValues/size.mjs';
|
|
9
9
|
import '../propsValues/typography.mjs';
|
|
10
10
|
import '../propsValues/width.mjs';
|
|
@@ -6,8 +6,8 @@ var React = require('react');
|
|
|
6
6
|
var documentIosClick = require('../domHelpers/documentIosClick.js');
|
|
7
7
|
require('../theme.js');
|
|
8
8
|
require('../direction.js');
|
|
9
|
+
require('@transferwise/neptune-tokens');
|
|
9
10
|
require('../propsValues/control.js');
|
|
10
|
-
require('../propsValues/breakpoint.js');
|
|
11
11
|
require('../propsValues/size.js');
|
|
12
12
|
require('../propsValues/typography.js');
|
|
13
13
|
require('../propsValues/width.js');
|
|
@@ -2,8 +2,8 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import { isServerSide } from '../domHelpers/documentIosClick.mjs';
|
|
3
3
|
import '../theme.mjs';
|
|
4
4
|
import '../direction.mjs';
|
|
5
|
+
import '@transferwise/neptune-tokens';
|
|
5
6
|
import '../propsValues/control.mjs';
|
|
6
|
-
import '../propsValues/breakpoint.mjs';
|
|
7
7
|
import '../propsValues/size.mjs';
|
|
8
8
|
import '../propsValues/typography.mjs';
|
|
9
9
|
import '../propsValues/width.mjs';
|
|
@@ -7,8 +7,8 @@ var clsx = require('clsx');
|
|
|
7
7
|
var Alert = require('../alert/Alert.js');
|
|
8
8
|
require('../common/theme.js');
|
|
9
9
|
require('../common/direction.js');
|
|
10
|
+
require('@transferwise/neptune-tokens');
|
|
10
11
|
require('../common/propsValues/control.js');
|
|
11
|
-
require('../common/propsValues/breakpoint.js');
|
|
12
12
|
require('../common/propsValues/size.js');
|
|
13
13
|
require('../common/propsValues/typography.js');
|
|
14
14
|
require('../common/propsValues/width.js');
|
|
@@ -3,8 +3,8 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import Alert$1 from '../alert/Alert.mjs';
|
|
4
4
|
import '../common/theme.mjs';
|
|
5
5
|
import '../common/direction.mjs';
|
|
6
|
+
import '@transferwise/neptune-tokens';
|
|
6
7
|
import '../common/propsValues/control.mjs';
|
|
7
|
-
import '../common/propsValues/breakpoint.mjs';
|
|
8
8
|
import '../common/propsValues/size.mjs';
|
|
9
9
|
import '../common/propsValues/typography.mjs';
|
|
10
10
|
import '../common/propsValues/width.mjs';
|
|
@@ -19,8 +19,8 @@ require('../header/Header.js');
|
|
|
19
19
|
require('virtua');
|
|
20
20
|
require('../common/theme.js');
|
|
21
21
|
require('../common/direction.js');
|
|
22
|
+
require('@transferwise/neptune-tokens');
|
|
22
23
|
require('../common/propsValues/control.js');
|
|
23
|
-
require('../common/propsValues/breakpoint.js');
|
|
24
24
|
var size = require('../common/propsValues/size.js');
|
|
25
25
|
var typography = require('../common/propsValues/typography.js');
|
|
26
26
|
require('../common/propsValues/width.js');
|
|
@@ -15,8 +15,8 @@ import '../header/Header.mjs';
|
|
|
15
15
|
import 'virtua';
|
|
16
16
|
import '../common/theme.mjs';
|
|
17
17
|
import '../common/direction.mjs';
|
|
18
|
+
import '@transferwise/neptune-tokens';
|
|
18
19
|
import '../common/propsValues/control.mjs';
|
|
19
|
-
import '../common/propsValues/breakpoint.mjs';
|
|
20
20
|
import { Size } from '../common/propsValues/size.mjs';
|
|
21
21
|
import { Typography } from '../common/propsValues/typography.mjs';
|
|
22
22
|
import '../common/propsValues/width.mjs';
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var neptuneTokens = require('@transferwise/neptune-tokens');
|
|
7
8
|
require('../common/theme.js');
|
|
8
9
|
require('../common/direction.js');
|
|
9
10
|
require('../common/propsValues/control.js');
|
|
10
|
-
var breakpoint = require('../common/propsValues/breakpoint.js');
|
|
11
11
|
var size = require('../common/propsValues/size.js');
|
|
12
12
|
require('../common/propsValues/typography.js');
|
|
13
13
|
require('../common/propsValues/width.js');
|
|
@@ -101,7 +101,7 @@ class DateLookup extends React.PureComponent {
|
|
|
101
101
|
if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {
|
|
102
102
|
this.focusOn('.active');
|
|
103
103
|
}
|
|
104
|
-
const mediaQuery = window.matchMedia(`(max-width: ${
|
|
104
|
+
const mediaQuery = window.matchMedia(`(max-width: ${neptuneTokens.Breakpoint.SMALL}px)`);
|
|
105
105
|
this.setState({
|
|
106
106
|
isMobile: mediaQuery.matches
|
|
107
107
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateLookup.js","sources":["../../src/dateLookup/DateLookup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createRef, PureComponent, KeyboardEvent } from 'react';\n\nimport {\n Size,\n MonthFormat,\n Position,\n Breakpoint,\n type SizeSmall,\n type SizeMedium,\n type SizeLarge,\n} from '../common';\nimport { isWithinRange, moveToWithinRange, returnDateView } from '../common/dateUtils';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';\nimport { OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';\nimport DateTrigger from './dateTrigger';\nimport DayCalendar from './dayCalendar';\nimport { getStartOfDay } from './getStartOfDay';\nimport MonthCalendar from './monthCalendar';\nimport YearCalendar from './yearCalendar';\n\nexport interface DateLookupProps {\n id?: string;\n value: Date | null;\n min?: Date | null;\n max?: Date | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n label?: string;\n 'aria-labelledby'?: string;\n monthFormat?: `${MonthFormat}`;\n disabled?: boolean;\n clearable?: boolean;\n onChange: (date: Date | null) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\ntype DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;\n\ninterface DateLookupState {\n selectedDate: Date | null;\n originalDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n open: boolean;\n mode: 'day' | 'month' | 'year';\n isMobile: boolean;\n}\n\nclass DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateLookupState> {\n declare props: DateLookupPropsWithInputAttributes &\n Required<Pick<DateLookupPropsWithInputAttributes, keyof typeof DateLookup.defaultProps>>;\n\n static defaultProps = {\n value: null,\n min: null,\n max: null,\n size: Size.MEDIUM,\n placeholder: '',\n label: '',\n monthFormat: MonthFormat.LONG,\n disabled: false,\n clearable: false,\n } satisfies Partial<DateLookupPropsWithInputAttributes>;\n\n element = createRef<HTMLDivElement>();\n dropdown = createRef<HTMLDivElement>();\n\n constructor(props: DateLookup['props']) {\n super(props);\n const dateView = returnDateView(props.value, props.min, props.max);\n this.state = {\n selectedDate: getStartOfDay(props.value),\n originalDate: null,\n min: getStartOfDay(props.min),\n max: getStartOfDay(props.max),\n viewMonth: dateView.getMonth(),\n viewYear: dateView.getFullYear(),\n open: false,\n mode: 'day',\n isMobile: false,\n };\n }\n\n static getDerivedStateFromProps(props: DateLookup['props'], state: DateLookupState) {\n const propsSelected = getStartOfDay(props.value);\n const propsMin = getStartOfDay(props.min);\n const propsMax = getStartOfDay(props.max);\n const hasSelectedChanged = state.selectedDate?.getTime() !== propsSelected?.getTime();\n const hasMinChanged = state.min?.getTime() !== propsMin?.getTime();\n const hasMaxChanged = state.max?.getTime() !== propsMax?.getTime();\n if (hasSelectedChanged || hasMinChanged || hasMaxChanged) {\n const selectedDate = hasSelectedChanged ? propsSelected : state.selectedDate;\n const min = hasMinChanged ? propsMin : state.min;\n const max = hasMaxChanged ? propsMax : state.max;\n if (selectedDate && !isWithinRange(selectedDate, min, max)) {\n props.onChange(moveToWithinRange(selectedDate, min, max));\n return null;\n }\n const viewDateThatIsWithinRange: Date = returnDateView(selectedDate, min, max);\n const viewMonth = viewDateThatIsWithinRange.getMonth();\n const viewYear = viewDateThatIsWithinRange.getFullYear();\n return { selectedDate, min, max, viewMonth, viewYear };\n }\n return null;\n }\n\n componentDidUpdate(previousProps: DateLookupPropsWithInputAttributes) {\n if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {\n this.focusOn('.active');\n }\n const mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);\n this.setState({ isMobile: mediaQuery.matches });\n }\n\n componentWillUnmount() {\n // Prevents memory leak by cleaning state.\n this.setState = () => {};\n }\n\n open = () => {\n const { onFocus } = this.props;\n\n this.setState({ open: true, mode: 'day' });\n if (onFocus) {\n onFocus();\n }\n };\n\n discard = () => {\n const { originalDate } = this.state;\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n };\n\n close = () => {\n const { onBlur } = this.props;\n this.setState({ open: false, originalDate: null });\n if (onBlur) {\n onBlur();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const { open, originalDate } = this.state;\n switch (event.key) {\n case 'ArrowLeft':\n if (open) {\n this.adjustDate(-1, -1, -1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowUp':\n if (open) {\n this.adjustDate(-7, -4, -4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowRight':\n if (open) {\n this.adjustDate(1, 1, 1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowDown':\n if (open) {\n this.adjustDate(7, 4, 4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'Escape':\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n event.preventDefault();\n break;\n default:\n break;\n }\n };\n\n adjustDate = (daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {\n const { selectedDate, min, max, mode, originalDate } = this.state;\n if (originalDate === null) {\n this.setState({ originalDate: selectedDate });\n }\n let date: Date | null;\n if (selectedDate) {\n date = new Date(\n mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(),\n mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(),\n mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate(),\n );\n } else {\n date = getStartOfDay(new Date());\n }\n date &&= moveToWithinRange(date, min, max);\n if (date?.getTime() !== selectedDate?.getTime()) {\n this.props.onChange(date);\n }\n };\n\n focusOn = (preferredElement: string, fallbackElement?: string) => {\n const element = this.element.current?.querySelector(preferredElement) as HTMLElement | null;\n if (element) {\n element.focus();\n } else if (fallbackElement) {\n this.focusOn(fallbackElement);\n }\n };\n\n switchMode = (mode: 'day' | 'month' | 'year') => {\n this.setState({ mode }, () => {\n this.focusOn('.active', '.today');\n });\n };\n\n switchToDays = () => this.switchMode('day');\n\n switchToMonths = () => this.switchMode('month');\n\n switchToYears = () => this.switchMode('year');\n\n handleSelectedDateUpdate = (selectedDate: Date) => {\n this.setState({ selectedDate }, () => {\n this.props.onChange(selectedDate);\n this.close();\n this.focusOn('.btn');\n });\n };\n\n handleViewDateUpdate = ({ month = this.state.viewMonth, year = this.state.viewYear }) => {\n this.setState({ viewMonth: month, viewYear: year });\n };\n\n getCalendar = () => {\n const { selectedDate, min, max, viewMonth, viewYear, mode, isMobile } = this.state;\n const { placeholder, monthFormat } = this.props;\n return (\n <div className={clsx({ 'p-a-1': !isMobile })}>\n {mode === 'day' && (\n <DayCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewMonth={viewMonth}\n viewYear={viewYear}\n monthFormat={monthFormat}\n onSelect={this.handleSelectedDateUpdate}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'month' && (\n <MonthCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToDays}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'year' && (\n <YearCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToMonths}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n </div>\n );\n };\n\n handleClear = () => {\n this.props.onChange(null);\n this.focusOn('.np-date-trigger');\n };\n\n render() {\n const { selectedDate, open } = this.state;\n\n const {\n inputAttributes,\n id: idProp,\n 'aria-labelledby': ariaLabelledByProp,\n size,\n placeholder,\n label,\n monthFormat,\n disabled,\n clearable,\n value,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n\n return (\n <div\n ref={this.element}\n aria-labelledby={id}\n aria-invalid={inputAttributes?.['aria-invalid']}\n aria-describedby={inputAttributes?.['aria-describedby']}\n className={clsx('input-group', disabled && 'disabled')}\n onKeyDown={this.handleKeyDown}\n >\n <OverlayIdProvider open={open}>\n <DateTrigger\n id={id}\n ariaLabelledBy={ariaLabelledBy}\n selectedDate={selectedDate}\n size={size}\n placeholder={placeholder}\n label={label}\n monthFormat={monthFormat}\n disabled={disabled || false}\n onClick={this.open}\n onClear={!disabled && clearable && value ? this.handleClear : undefined}\n />\n <ResponsivePanel\n anchorRef={this.element}\n open={open}\n className=\"tw-date-lookup-menu\"\n position={Position.BOTTOM}\n considerHeight\n onClose={this.discard}\n >\n {this.getCalendar()}\n </ResponsivePanel>\n </OverlayIdProvider>\n </div>\n );\n }\n}\n\nexport const DateLookupWithoutInputAttributes = DateLookup;\n\nconst WrappedDateLookup = withInputAttributes(\n DateLookup as React.ComponentType<DateLookupPropsWithInputAttributes>,\n { nonLabelable: true },\n);\nWrappedDateLookup.displayName = 'DateLookup';\n\nexport default WrappedDateLookup;\n"],"names":["DateLookup","PureComponent","defaultProps","value","min","max","size","Size","MEDIUM","placeholder","label","monthFormat","MonthFormat","LONG","disabled","clearable","element","createRef","dropdown","constructor","props","dateView","returnDateView","state","selectedDate","getStartOfDay","originalDate","viewMonth","getMonth","viewYear","getFullYear","open","mode","isMobile","getDerivedStateFromProps","propsSelected","propsMin","propsMax","hasSelectedChanged","getTime","hasMinChanged","hasMaxChanged","isWithinRange","onChange","moveToWithinRange","viewDateThatIsWithinRange","componentDidUpdate","previousProps","focusOn","mediaQuery","window","matchMedia","Breakpoint","SMALL","setState","matches","componentWillUnmount","onFocus","discard","close","onBlur","handleKeyDown","event","key","adjustDate","preventDefault","daysToAdd","monthsToAdd","yearsToAdd","date","Date","getDate","preferredElement","fallbackElement","current","querySelector","focus","switchMode","switchToDays","switchToMonths","switchToYears","handleSelectedDateUpdate","handleViewDateUpdate","month","year","getCalendar","_jsxs","className","clsx","children","_jsx","DayCalendar","onSelect","onLabelClick","onViewDateUpdate","MonthCalendar","YearCalendar","handleClear","render","inputAttributes","id","idProp","ariaLabelledByProp","ariaLabelledBy","ref","onKeyDown","OverlayIdProvider","DateTrigger","onClick","onClear","undefined","ResponsivePanel","anchorRef","position","Position","BOTTOM","considerHeight","onClose","WrappedDateLookup","withInputAttributes","nonLabelable","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,UAAW,SAAQC,mBAAkE,CAAA;AAIzF,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,IAAI;AACX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DateLookup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createRef, PureComponent, KeyboardEvent } from 'react';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport {\n Size,\n MonthFormat,\n Position,\n type SizeSmall,\n type SizeMedium,\n type SizeLarge,\n} from '../common';\nimport { isWithinRange, moveToWithinRange, returnDateView } from '../common/dateUtils';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';\nimport { OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';\nimport DateTrigger from './dateTrigger';\nimport DayCalendar from './dayCalendar';\nimport { getStartOfDay } from './getStartOfDay';\nimport MonthCalendar from './monthCalendar';\nimport YearCalendar from './yearCalendar';\n\nexport interface DateLookupProps {\n id?: string;\n value: Date | null;\n min?: Date | null;\n max?: Date | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n label?: string;\n 'aria-labelledby'?: string;\n monthFormat?: `${MonthFormat}`;\n disabled?: boolean;\n clearable?: boolean;\n onChange: (date: Date | null) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\ntype DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;\n\ninterface DateLookupState {\n selectedDate: Date | null;\n originalDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n open: boolean;\n mode: 'day' | 'month' | 'year';\n isMobile: boolean;\n}\n\nclass DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateLookupState> {\n declare props: DateLookupPropsWithInputAttributes &\n Required<Pick<DateLookupPropsWithInputAttributes, keyof typeof DateLookup.defaultProps>>;\n\n static defaultProps = {\n value: null,\n min: null,\n max: null,\n size: Size.MEDIUM,\n placeholder: '',\n label: '',\n monthFormat: MonthFormat.LONG,\n disabled: false,\n clearable: false,\n } satisfies Partial<DateLookupPropsWithInputAttributes>;\n\n element = createRef<HTMLDivElement>();\n dropdown = createRef<HTMLDivElement>();\n\n constructor(props: DateLookup['props']) {\n super(props);\n const dateView = returnDateView(props.value, props.min, props.max);\n this.state = {\n selectedDate: getStartOfDay(props.value),\n originalDate: null,\n min: getStartOfDay(props.min),\n max: getStartOfDay(props.max),\n viewMonth: dateView.getMonth(),\n viewYear: dateView.getFullYear(),\n open: false,\n mode: 'day',\n isMobile: false,\n };\n }\n\n static getDerivedStateFromProps(props: DateLookup['props'], state: DateLookupState) {\n const propsSelected = getStartOfDay(props.value);\n const propsMin = getStartOfDay(props.min);\n const propsMax = getStartOfDay(props.max);\n const hasSelectedChanged = state.selectedDate?.getTime() !== propsSelected?.getTime();\n const hasMinChanged = state.min?.getTime() !== propsMin?.getTime();\n const hasMaxChanged = state.max?.getTime() !== propsMax?.getTime();\n if (hasSelectedChanged || hasMinChanged || hasMaxChanged) {\n const selectedDate = hasSelectedChanged ? propsSelected : state.selectedDate;\n const min = hasMinChanged ? propsMin : state.min;\n const max = hasMaxChanged ? propsMax : state.max;\n if (selectedDate && !isWithinRange(selectedDate, min, max)) {\n props.onChange(moveToWithinRange(selectedDate, min, max));\n return null;\n }\n const viewDateThatIsWithinRange: Date = returnDateView(selectedDate, min, max);\n const viewMonth = viewDateThatIsWithinRange.getMonth();\n const viewYear = viewDateThatIsWithinRange.getFullYear();\n return { selectedDate, min, max, viewMonth, viewYear };\n }\n return null;\n }\n\n componentDidUpdate(previousProps: DateLookupPropsWithInputAttributes) {\n if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {\n this.focusOn('.active');\n }\n const mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);\n this.setState({ isMobile: mediaQuery.matches });\n }\n\n componentWillUnmount() {\n // Prevents memory leak by cleaning state.\n this.setState = () => {};\n }\n\n open = () => {\n const { onFocus } = this.props;\n\n this.setState({ open: true, mode: 'day' });\n if (onFocus) {\n onFocus();\n }\n };\n\n discard = () => {\n const { originalDate } = this.state;\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n };\n\n close = () => {\n const { onBlur } = this.props;\n this.setState({ open: false, originalDate: null });\n if (onBlur) {\n onBlur();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const { open, originalDate } = this.state;\n switch (event.key) {\n case 'ArrowLeft':\n if (open) {\n this.adjustDate(-1, -1, -1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowUp':\n if (open) {\n this.adjustDate(-7, -4, -4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowRight':\n if (open) {\n this.adjustDate(1, 1, 1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowDown':\n if (open) {\n this.adjustDate(7, 4, 4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'Escape':\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n event.preventDefault();\n break;\n default:\n break;\n }\n };\n\n adjustDate = (daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {\n const { selectedDate, min, max, mode, originalDate } = this.state;\n if (originalDate === null) {\n this.setState({ originalDate: selectedDate });\n }\n let date: Date | null;\n if (selectedDate) {\n date = new Date(\n mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(),\n mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(),\n mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate(),\n );\n } else {\n date = getStartOfDay(new Date());\n }\n date &&= moveToWithinRange(date, min, max);\n if (date?.getTime() !== selectedDate?.getTime()) {\n this.props.onChange(date);\n }\n };\n\n focusOn = (preferredElement: string, fallbackElement?: string) => {\n const element = this.element.current?.querySelector(preferredElement) as HTMLElement | null;\n if (element) {\n element.focus();\n } else if (fallbackElement) {\n this.focusOn(fallbackElement);\n }\n };\n\n switchMode = (mode: 'day' | 'month' | 'year') => {\n this.setState({ mode }, () => {\n this.focusOn('.active', '.today');\n });\n };\n\n switchToDays = () => this.switchMode('day');\n\n switchToMonths = () => this.switchMode('month');\n\n switchToYears = () => this.switchMode('year');\n\n handleSelectedDateUpdate = (selectedDate: Date) => {\n this.setState({ selectedDate }, () => {\n this.props.onChange(selectedDate);\n this.close();\n this.focusOn('.btn');\n });\n };\n\n handleViewDateUpdate = ({ month = this.state.viewMonth, year = this.state.viewYear }) => {\n this.setState({ viewMonth: month, viewYear: year });\n };\n\n getCalendar = () => {\n const { selectedDate, min, max, viewMonth, viewYear, mode, isMobile } = this.state;\n const { placeholder, monthFormat } = this.props;\n return (\n <div className={clsx({ 'p-a-1': !isMobile })}>\n {mode === 'day' && (\n <DayCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewMonth={viewMonth}\n viewYear={viewYear}\n monthFormat={monthFormat}\n onSelect={this.handleSelectedDateUpdate}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'month' && (\n <MonthCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToDays}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'year' && (\n <YearCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToMonths}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n </div>\n );\n };\n\n handleClear = () => {\n this.props.onChange(null);\n this.focusOn('.np-date-trigger');\n };\n\n render() {\n const { selectedDate, open } = this.state;\n\n const {\n inputAttributes,\n id: idProp,\n 'aria-labelledby': ariaLabelledByProp,\n size,\n placeholder,\n label,\n monthFormat,\n disabled,\n clearable,\n value,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n\n return (\n <div\n ref={this.element}\n aria-labelledby={id}\n aria-invalid={inputAttributes?.['aria-invalid']}\n aria-describedby={inputAttributes?.['aria-describedby']}\n className={clsx('input-group', disabled && 'disabled')}\n onKeyDown={this.handleKeyDown}\n >\n <OverlayIdProvider open={open}>\n <DateTrigger\n id={id}\n ariaLabelledBy={ariaLabelledBy}\n selectedDate={selectedDate}\n size={size}\n placeholder={placeholder}\n label={label}\n monthFormat={monthFormat}\n disabled={disabled || false}\n onClick={this.open}\n onClear={!disabled && clearable && value ? this.handleClear : undefined}\n />\n <ResponsivePanel\n anchorRef={this.element}\n open={open}\n className=\"tw-date-lookup-menu\"\n position={Position.BOTTOM}\n considerHeight\n onClose={this.discard}\n >\n {this.getCalendar()}\n </ResponsivePanel>\n </OverlayIdProvider>\n </div>\n );\n }\n}\n\nexport const DateLookupWithoutInputAttributes = DateLookup;\n\nconst WrappedDateLookup = withInputAttributes(\n DateLookup as React.ComponentType<DateLookupPropsWithInputAttributes>,\n { nonLabelable: true },\n);\nWrappedDateLookup.displayName = 'DateLookup';\n\nexport default WrappedDateLookup;\n"],"names":["DateLookup","PureComponent","defaultProps","value","min","max","size","Size","MEDIUM","placeholder","label","monthFormat","MonthFormat","LONG","disabled","clearable","element","createRef","dropdown","constructor","props","dateView","returnDateView","state","selectedDate","getStartOfDay","originalDate","viewMonth","getMonth","viewYear","getFullYear","open","mode","isMobile","getDerivedStateFromProps","propsSelected","propsMin","propsMax","hasSelectedChanged","getTime","hasMinChanged","hasMaxChanged","isWithinRange","onChange","moveToWithinRange","viewDateThatIsWithinRange","componentDidUpdate","previousProps","focusOn","mediaQuery","window","matchMedia","Breakpoint","SMALL","setState","matches","componentWillUnmount","onFocus","discard","close","onBlur","handleKeyDown","event","key","adjustDate","preventDefault","daysToAdd","monthsToAdd","yearsToAdd","date","Date","getDate","preferredElement","fallbackElement","current","querySelector","focus","switchMode","switchToDays","switchToMonths","switchToYears","handleSelectedDateUpdate","handleViewDateUpdate","month","year","getCalendar","_jsxs","className","clsx","children","_jsx","DayCalendar","onSelect","onLabelClick","onViewDateUpdate","MonthCalendar","YearCalendar","handleClear","render","inputAttributes","id","idProp","ariaLabelledByProp","ariaLabelledBy","ref","onKeyDown","OverlayIdProvider","DateTrigger","onClick","onClear","undefined","ResponsivePanel","anchorRef","position","Position","BOTTOM","considerHeight","onClose","WrappedDateLookup","withInputAttributes","nonLabelable","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,UAAW,SAAQC,mBAAkE,CAAA;AAIzF,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,IAAI;AACXC,IAAAA,GAAG,EAAE,IAAI;AACTC,IAAAA,GAAG,EAAE,IAAI;IACTC,IAAI,EAAEC,SAAI,CAACC,MAAM;AACjBC,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,KAAK,EAAE,EAAE;IACTC,WAAW,EAAEC,uBAAW,CAACC,IAAI;AAC7BC,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,SAAS,EAAE;GAC0C;EAEvDC,OAAO,gBAAGC,eAAS,EAAkB;EACrCC,QAAQ,gBAAGD,eAAS,EAAkB;EAEtCE,WAAAA,CAAYC,KAA0B,EAAA;IACpC,KAAK,CAACA,KAAK,CAAC;AACZ,IAAA,MAAMC,QAAQ,GAAGC,0BAAc,CAACF,KAAK,CAACjB,KAAK,EAAEiB,KAAK,CAAChB,GAAG,EAAEgB,KAAK,CAACf,GAAG,CAAC;IAClE,IAAI,CAACkB,KAAK,GAAG;AACXC,MAAAA,YAAY,EAAEC,2BAAa,CAACL,KAAK,CAACjB,KAAK,CAAC;AACxCuB,MAAAA,YAAY,EAAE,IAAI;AAClBtB,MAAAA,GAAG,EAAEqB,2BAAa,CAACL,KAAK,CAAChB,GAAG,CAAC;AAC7BC,MAAAA,GAAG,EAAEoB,2BAAa,CAACL,KAAK,CAACf,GAAG,CAAC;AAC7BsB,MAAAA,SAAS,EAAEN,QAAQ,CAACO,QAAQ,EAAE;AAC9BC,MAAAA,QAAQ,EAAER,QAAQ,CAACS,WA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AAO,EAAE,IAAI,CAAC3D,OAAQ;AAAA+B,UAAAA,QAAA,EAErB,IAAI,CAACJ,WAAW;AAAE,SACJ,CACnB;OAAmB;AACrB,KAAK,CAAC;AAEV,EAAA;;AAKF,MAAMiC,iBAAiB,GAAGC,4BAAmB,CAC3CvH,UAAqE,EACrE;AAAEwH,EAAAA,YAAY,EAAE;AAAI,CAAE;AAExBF,iBAAiB,CAACG,WAAW,GAAG,YAAY;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { PureComponent, createRef } from 'react';
|
|
3
|
+
import { Breakpoint } from '@transferwise/neptune-tokens';
|
|
3
4
|
import '../common/theme.mjs';
|
|
4
5
|
import '../common/direction.mjs';
|
|
5
6
|
import '../common/propsValues/control.mjs';
|
|
6
|
-
import { Breakpoint } from '../common/propsValues/breakpoint.mjs';
|
|
7
7
|
import { Size } from '../common/propsValues/size.mjs';
|
|
8
8
|
import '../common/propsValues/typography.mjs';
|
|
9
9
|
import '../common/propsValues/width.mjs';
|