@transferwise/components 37.0.0 → 37.0.1-beta.23
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/CHANGELOG.md +264 -0
- package/build/es/no-polyfill/accordion/Accordion.js +1 -1
- package/build/es/no-polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
- package/build/es/no-polyfill/actionOption/ActionOption.js +1 -1
- package/build/es/no-polyfill/actionOption/ActionOption.story.js +1 -1
- package/build/es/no-polyfill/alert/Alert.js +1 -1
- package/build/es/no-polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
- package/build/es/no-polyfill/alert/withArrow/withArrow.js +1 -1
- package/build/es/no-polyfill/avatar/Avatar.js +1 -1
- package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.js +1 -1
- package/build/es/no-polyfill/badge/Badge.js +1 -1
- package/build/es/no-polyfill/button/Button.js +1 -2
- package/build/es/no-polyfill/card/Card.js +2 -5
- package/build/es/no-polyfill/checkbox/Checkbox.js +1 -1
- package/build/es/no-polyfill/checkboxButton/CheckboxButton.js +1 -1
- package/build/es/no-polyfill/checkboxOption/CheckboxOption.js +1 -1
- package/build/es/no-polyfill/chevron/Chevron.js +1 -1
- package/build/es/no-polyfill/chip/Chip.js +8 -2
- package/build/es/no-polyfill/circularButton/CircularButton.js +1 -1
- package/build/es/no-polyfill/common/Option/Option.js +1 -1
- package/build/es/no-polyfill/common/Option/OptionDocumentation.js +1 -0
- package/build/es/no-polyfill/common/RadioButton/RadioButton.js +1 -1
- package/build/es/no-polyfill/common/bottomSheet/BottomSheet.js +4 -6
- package/build/es/no-polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/no-polyfill/common/focusBoundary/FocusBoundary.js +1 -1
- package/build/es/no-polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
- package/build/es/no-polyfill/common/focusBoundary/utils/resetFocus.js +2 -2
- package/build/es/no-polyfill/common/historyNavigator/historyNavigator.js +1 -1
- package/build/es/no-polyfill/common/hooks/useClientWidth/useClientWidth.js +2 -1
- package/build/es/no-polyfill/common/hooks/useConditionalListener/useConditionalListener.js +3 -5
- package/build/es/no-polyfill/common/hooks/useHasIntersected/useHasIntersected.js +3 -2
- package/build/es/no-polyfill/common/keyCodes.js +1 -0
- package/build/es/no-polyfill/common/panel/Panel.js +2 -3
- package/build/es/no-polyfill/common/requirements.js +2 -2
- package/build/es/no-polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
- package/build/es/no-polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
- package/build/es/no-polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
- package/build/es/no-polyfill/dateInput/DateInput.js +3 -4
- package/build/es/no-polyfill/dateInput/DateInput.messages.js +1 -0
- package/build/es/no-polyfill/dateLookup/DateLookup.js +1 -1
- package/build/es/no-polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/build/es/no-polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
- package/build/es/no-polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
- package/build/es/no-polyfill/dateLookup/header/Header.js +1 -1
- package/build/es/no-polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
- package/build/es/no-polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
- package/build/es/no-polyfill/dateLookup/tableLink/TableLink.js +1 -1
- package/build/es/no-polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
- package/build/es/no-polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
- package/build/es/no-polyfill/decision/Decision.js +5 -5
- package/build/es/no-polyfill/definitionList/DefinitionList.js +1 -1
- package/build/es/no-polyfill/dimmer/Dimmer.js +3 -3
- package/build/es/no-polyfill/drawer/Drawer.js +1 -1
- package/build/es/no-polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
- package/build/es/no-polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +2 -4
- package/build/es/no-polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
- package/build/es/no-polyfill/emphasis/Emphasis.js +1 -1
- package/build/es/no-polyfill/flowNavigation/FlowNavigation.js +1 -1
- package/build/es/no-polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/es/no-polyfill/flowNavigation/backButton/BackButton.js +1 -1
- package/build/es/no-polyfill/header/Header.js +1 -1
- package/build/es/no-polyfill/i18n/en.json +3 -2
- package/build/es/no-polyfill/i18n/index.js +1 -1
- package/build/es/no-polyfill/image/Image.js +4 -5
- package/build/es/no-polyfill/info/Info.js +1 -1
- package/build/es/no-polyfill/inlineAlert/InlineAlert.js +1 -1
- package/build/es/no-polyfill/instructionsList/InstructionsList.js +1 -1
- package/build/es/no-polyfill/lab/mobileNav/MobileNav.js +2 -2
- package/build/es/no-polyfill/lab/pagination/Pagination.js +1 -1
- package/build/es/no-polyfill/lab/pagination/paginationLink/PaginationLink.js +1 -1
- package/build/es/no-polyfill/link/Link.js +4 -3
- package/build/es/no-polyfill/link/Link.spec.js +1 -0
- package/build/es/no-polyfill/link/Link.story.js +1 -0
- package/build/es/no-polyfill/loader/Loader.js +7 -3
- package/build/es/no-polyfill/logo/Logo.js +1 -1
- package/build/es/no-polyfill/markdown/Markdown.js +1 -1
- package/build/es/no-polyfill/modal/Modal.js +1 -1
- package/build/es/no-polyfill/money/Money.js +1 -1
- package/build/es/no-polyfill/moneyInput/MoneyInput.js +1 -2
- package/build/es/no-polyfill/navigationOption/NavigationOption.js +1 -1
- package/build/es/no-polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
- package/build/es/no-polyfill/nudge/Nudge.js +1 -1
- package/build/es/no-polyfill/overlayHeader/OverlayHeader.js +1 -1
- package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/es/no-polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +2 -1
- package/build/es/no-polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +1 -0
- package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
- package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
- package/build/es/no-polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +1 -0
- package/build/es/no-polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +2 -0
- package/build/es/no-polyfill/popover/Popover.js +1 -1
- package/build/es/no-polyfill/processIndicator/ProcessIndicator.js +4 -1
- package/build/es/no-polyfill/provider/Provider.js +1 -1
- package/build/es/no-polyfill/provider/direction/DirectionProvider.js +1 -1
- package/build/es/no-polyfill/radio/Radio.js +1 -1
- package/build/es/no-polyfill/radioGroup/RadioGroup.js +2 -2
- package/build/es/no-polyfill/radioOption/RadioOption.js +1 -1
- package/build/es/no-polyfill/select/Select.js +3 -5
- package/build/es/no-polyfill/select/option/Option.js +1 -1
- package/build/es/no-polyfill/select/searchBox/SearchBox.js +1 -1
- package/build/es/no-polyfill/sizeSwapper/SizeSwapper.js +4 -2
- package/build/es/no-polyfill/slidingPanel/SlidingPanel.js +2 -2
- package/build/es/no-polyfill/snackbar/Snackbar.js +1 -1
- package/build/es/no-polyfill/snackbar/SnackbarProvider.js +1 -1
- package/build/es/no-polyfill/stepper/Stepper.js +1 -1
- package/build/es/no-polyfill/stepper/deviceDetection.js +2 -1
- package/build/es/no-polyfill/summary/Summary.js +1 -4
- package/build/es/no-polyfill/switch/Switch.js +1 -1
- package/build/es/no-polyfill/switch/Switch.story.js +1 -1
- package/build/es/no-polyfill/switchOption/SwitchOption.js +1 -1
- package/build/es/no-polyfill/switchOption/SwitchOption.story.js +1 -1
- package/build/es/no-polyfill/tabs/Tab.js +1 -1
- package/build/es/no-polyfill/tabs/Tabs.js +1 -1
- package/build/es/no-polyfill/tile/Tile.js +1 -1
- package/build/es/no-polyfill/tooltip/Tooltip.js +1 -1
- package/build/es/no-polyfill/typeahead/Typeahead.js +1 -2
- package/build/es/no-polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
- package/build/es/no-polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/es/no-polyfill/typeahead/util/highlight.js +1 -1
- package/build/es/no-polyfill/upload/Upload.js +3 -5
- package/build/es/no-polyfill/upload/steps/completeStep/completeStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/processingStep/processingStep.js +1 -1
- package/build/es/no-polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/es/no-polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
- package/build/es/no-polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +1 -1
- package/build/es/no-polyfill/upload/utils/index.js +1 -1
- package/build/es/no-polyfill/uploadInput/UploadInput.js +4 -6
- package/build/es/no-polyfill/uploadInput/UploadInput.spec.js +1 -1
- package/build/es/no-polyfill/uploadInput/UploadInput.story.js +1 -1
- package/build/es/no-polyfill/uploadInput/types.js +1 -0
- package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
- package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -1
- package/build/es/no-polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
- package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
- package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
- package/build/es/no-polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
- package/build/es/no-polyfill/utilities/{deprecatedProp/deprecatedProp.js → deprecatedProperty/deprecatedProperty.js} +0 -0
- package/build/es/no-polyfill/utilities/deprecatedProperty/index.js +1 -0
- package/build/es/no-polyfill/utilities/index.js +1 -1
- package/build/es/no-polyfill/utilities/logActionRequired.js +1 -1
- package/build/es/no-polyfill/withDisplayFormat/WithDisplayFormat.js +2 -2
- package/build/es/no-polyfill/withNextPortal/withNextPortal.js +1 -1
- package/build/es/no-polyfill/withNormaliser/WithNormalizer.js +3 -0
- package/build/es/polyfill/accordion/Accordion.js +1 -1
- package/build/es/polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
- package/build/es/polyfill/actionOption/ActionOption.js +1 -1
- package/build/es/polyfill/actionOption/ActionOption.story.js +1 -1
- package/build/es/polyfill/alert/Alert.js +1 -1
- package/build/es/polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
- package/build/es/polyfill/alert/withArrow/withArrow.js +1 -1
- package/build/es/polyfill/avatar/Avatar.js +1 -1
- package/build/es/polyfill/avatarWrapper/AvatarWrapper.js +1 -1
- package/build/es/polyfill/badge/Badge.js +1 -1
- package/build/es/polyfill/button/Button.js +1 -2
- package/build/es/polyfill/card/Card.js +2 -5
- package/build/es/polyfill/checkbox/Checkbox.js +1 -1
- package/build/es/polyfill/checkboxButton/CheckboxButton.js +1 -1
- package/build/es/polyfill/checkboxOption/CheckboxOption.js +1 -1
- package/build/es/polyfill/chevron/Chevron.js +1 -1
- package/build/es/polyfill/chip/Chip.js +8 -2
- package/build/es/polyfill/circularButton/CircularButton.js +1 -1
- package/build/es/polyfill/common/Option/Option.js +1 -1
- package/build/es/polyfill/common/Option/OptionDocumentation.js +1 -0
- package/build/es/polyfill/common/RadioButton/RadioButton.js +1 -1
- package/build/es/polyfill/common/bottomSheet/BottomSheet.js +4 -6
- package/build/es/polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/polyfill/common/focusBoundary/FocusBoundary.js +1 -1
- package/build/es/polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
- package/build/es/polyfill/common/focusBoundary/utils/resetFocus.js +2 -2
- package/build/es/polyfill/common/historyNavigator/historyNavigator.js +1 -1
- package/build/es/polyfill/common/hooks/useClientWidth/useClientWidth.js +2 -1
- package/build/es/polyfill/common/hooks/useConditionalListener/useConditionalListener.js +3 -5
- package/build/es/polyfill/common/hooks/useHasIntersected/useHasIntersected.js +3 -2
- package/build/es/polyfill/common/keyCodes.js +1 -0
- package/build/es/polyfill/common/panel/Panel.js +2 -3
- package/build/es/polyfill/common/requirements.js +2 -2
- package/build/es/polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
- package/build/es/polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
- package/build/es/polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
- package/build/es/polyfill/dateInput/DateInput.js +3 -4
- package/build/es/polyfill/dateInput/DateInput.messages.js +1 -0
- package/build/es/polyfill/dateLookup/DateLookup.js +1 -1
- package/build/es/polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
- package/build/es/polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
- package/build/es/polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
- package/build/es/polyfill/dateLookup/header/Header.js +1 -1
- package/build/es/polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
- package/build/es/polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
- package/build/es/polyfill/dateLookup/tableLink/TableLink.js +1 -1
- package/build/es/polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
- package/build/es/polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
- package/build/es/polyfill/decision/Decision.js +5 -5
- package/build/es/polyfill/definitionList/DefinitionList.js +1 -1
- package/build/es/polyfill/dimmer/Dimmer.js +3 -3
- package/build/es/polyfill/drawer/Drawer.js +1 -1
- package/build/es/polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
- package/build/es/polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +2 -4
- package/build/es/polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
- package/build/es/polyfill/emphasis/Emphasis.js +1 -1
- package/build/es/polyfill/flowNavigation/FlowNavigation.js +1 -1
- package/build/es/polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/es/polyfill/flowNavigation/backButton/BackButton.js +1 -1
- package/build/es/polyfill/header/Header.js +1 -1
- package/build/es/polyfill/i18n/en.json +3 -2
- package/build/es/polyfill/i18n/index.js +1 -1
- package/build/es/polyfill/image/Image.js +4 -5
- package/build/es/polyfill/info/Info.js +1 -1
- package/build/es/polyfill/inlineAlert/InlineAlert.js +1 -1
- package/build/es/polyfill/instructionsList/InstructionsList.js +1 -1
- package/build/es/polyfill/lab/mobileNav/MobileNav.js +2 -2
- package/build/es/polyfill/lab/pagination/Pagination.js +1 -1
- package/build/es/polyfill/lab/pagination/paginationLink/PaginationLink.js +1 -1
- package/build/es/polyfill/link/Link.js +4 -3
- package/build/es/polyfill/link/Link.spec.js +1 -0
- package/build/es/polyfill/link/Link.story.js +1 -0
- package/build/es/polyfill/loader/Loader.js +7 -3
- package/build/es/polyfill/logo/Logo.js +1 -1
- package/build/es/polyfill/markdown/Markdown.js +1 -1
- package/build/es/polyfill/modal/Modal.js +1 -1
- package/build/es/polyfill/money/Money.js +1 -1
- package/build/es/polyfill/moneyInput/MoneyInput.js +1 -2
- package/build/es/polyfill/navigationOption/NavigationOption.js +1 -1
- package/build/es/polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
- package/build/es/polyfill/nudge/Nudge.js +1 -1
- package/build/es/polyfill/overlayHeader/OverlayHeader.js +1 -1
- package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/es/polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +3 -2
- package/build/es/polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +1 -0
- package/build/es/polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
- package/build/es/polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
- package/build/es/polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +1 -0
- package/build/es/polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +2 -0
- package/build/es/polyfill/popover/Popover.js +1 -1
- package/build/es/polyfill/processIndicator/ProcessIndicator.js +4 -1
- package/build/es/polyfill/provider/Provider.js +1 -1
- package/build/es/polyfill/provider/direction/DirectionProvider.js +1 -1
- package/build/es/polyfill/radio/Radio.js +1 -1
- package/build/es/polyfill/radioGroup/RadioGroup.js +2 -2
- package/build/es/polyfill/radioOption/RadioOption.js +1 -1
- package/build/es/polyfill/select/Select.js +3 -5
- package/build/es/polyfill/select/option/Option.js +1 -1
- package/build/es/polyfill/select/searchBox/SearchBox.js +1 -1
- package/build/es/polyfill/sizeSwapper/SizeSwapper.js +4 -2
- package/build/es/polyfill/slidingPanel/SlidingPanel.js +2 -2
- package/build/es/polyfill/snackbar/Snackbar.js +1 -1
- package/build/es/polyfill/snackbar/SnackbarProvider.js +1 -1
- package/build/es/polyfill/stepper/Stepper.js +1 -1
- package/build/es/polyfill/stepper/deviceDetection.js +2 -1
- package/build/es/polyfill/summary/Summary.js +1 -4
- package/build/es/polyfill/switch/Switch.js +1 -1
- package/build/es/polyfill/switch/Switch.story.js +1 -1
- package/build/es/polyfill/switchOption/SwitchOption.js +1 -1
- package/build/es/polyfill/switchOption/SwitchOption.story.js +1 -1
- package/build/es/polyfill/tabs/Tab.js +1 -1
- package/build/es/polyfill/tabs/Tabs.js +1 -1
- package/build/es/polyfill/tile/Tile.js +1 -1
- package/build/es/polyfill/tooltip/Tooltip.js +1 -1
- package/build/es/polyfill/typeahead/Typeahead.js +1 -2
- package/build/es/polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
- package/build/es/polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
- package/build/es/polyfill/typeahead/util/highlight.js +1 -1
- package/build/es/polyfill/upload/Upload.js +3 -5
- package/build/es/polyfill/upload/steps/completeStep/completeStep.js +1 -1
- package/build/es/polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
- package/build/es/polyfill/upload/steps/processingStep/processingStep.js +1 -1
- package/build/es/polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/es/polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
- package/build/es/polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +2 -2
- package/build/es/polyfill/upload/utils/index.js +1 -1
- package/build/es/polyfill/uploadInput/UploadInput.js +4 -6
- package/build/es/polyfill/uploadInput/UploadInput.spec.js +1 -1
- package/build/es/polyfill/uploadInput/UploadInput.story.js +1 -1
- package/build/es/polyfill/uploadInput/types.js +1 -0
- package/build/es/polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
- package/build/es/polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -1
- package/build/es/polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
- package/build/es/polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
- package/build/es/polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
- package/build/es/polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
- package/build/es/polyfill/utilities/{deprecatedProp/deprecatedProp.js → deprecatedProperty/deprecatedProperty.js} +0 -0
- package/build/es/polyfill/utilities/deprecatedProperty/index.js +1 -0
- package/build/es/polyfill/utilities/index.js +1 -1
- package/build/es/polyfill/utilities/logActionRequired.js +1 -1
- package/build/es/polyfill/withDisplayFormat/WithDisplayFormat.js +2 -2
- package/build/es/polyfill/withNextPortal/withNextPortal.js +1 -1
- package/build/es/polyfill/withNormaliser/WithNormalizer.js +3 -0
- package/build/i18n/en.json +3 -2
- package/build/main.css +1 -1
- package/build/styles/accordion/Accordion.css +1 -1
- package/build/styles/avatar/Avatar.css +1 -1
- package/build/styles/card/Card.css +1 -1
- package/build/styles/chip/Chip.css +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -1
- package/build/styles/common/RadioButton/RadioButton.css +1 -1
- package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +1 -1
- package/build/styles/drawer/Drawer.css +1 -1
- package/build/styles/emphasis/Emphasis.css +1 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/flowNavigation/backButton/BackButton.css +1 -1
- package/build/styles/info/Info.css +1 -1
- package/build/styles/instructionsList/InstructionsList.css +1 -1
- package/build/styles/lab/mobileNav/MobileNav.css +1 -1
- package/build/styles/lab/pagination/Pagination.css +1 -1
- package/build/styles/loader/Loader.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/moneyInput/MoneyInput.css +1 -1
- package/build/styles/navigationOption/NavigationOption.css +1 -1
- package/build/styles/nudge/Nudge.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/styles/popover/Popover.css +1 -1
- package/build/styles/snackbar/Snackbar.css +1 -1
- package/build/styles/stepper/Stepper.css +1 -1
- package/build/styles/summary/Summary.css +1 -1
- package/build/styles/switch/Switch.css +1 -1
- package/build/styles/tabs/Tabs.css +1 -1
- package/build/styles/tile/Tile.css +1 -1
- package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +1 -1
- package/build/styles/uploadInput/UploadInput.css +1 -1
- package/build/styles/uploadInput/uploadButton/UploadButton.css +1 -1
- package/build/styles/uploadInput/uploadItem/UploadItem.css +1 -1
- package/build/types/actionOption/ActionOption.story.d.ts +1 -1
- package/build/types/alert/Alert.d.ts +1 -1
- package/build/types/badge/Badge.d.ts +1 -1
- package/build/types/chip/Chip.d.ts +8 -2
- package/build/types/common/bottomSheet/BottomSheet.d.ts +3 -1
- package/build/types/common/commonProps.d.ts +1 -1
- package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +1 -1
- package/build/types/common/focusBoundary/utils/resetFocus.d.ts +1 -1
- package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts +4 -1
- package/build/types/{link/Link.messages.d.ts → dateInput/DateInput.messages.d.ts} +8 -5
- package/build/types/link/Link.d.ts +5 -4
- package/build/types/link/Link.spec.d.ts +1 -0
- package/build/types/link/Link.story.d.ts +9 -0
- package/build/types/loader/Loader.d.ts +6 -1
- package/build/types/modal/Modal.d.ts +0 -1
- package/build/types/nudge/Nudge.d.ts +1 -0
- package/build/types/switch/Switch.story.d.ts +2 -1
- package/build/types/switchOption/SwitchOption.story.d.ts +1 -1
- package/build/types/test-utils/index.d.ts +17 -5
- package/build/types/upload/Upload.d.ts +1 -1
- package/build/types/upload/utils/index.d.ts +0 -1
- package/build/types/uploadInput/UploadInput.d.ts +8 -4
- package/build/types/uploadInput/UploadInput.story.d.ts +11 -10
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -0
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +8 -1
- package/build/types/uploadInput/uploadItem/UploadItemBody.d.ts +3 -2
- package/build/types/utilities/{deprecatedProp/deprecatedProp.d.ts → deprecatedProperty/deprecatedProperty.d.ts} +2 -2
- package/build/types/utilities/deprecatedProperty/index.d.ts +1 -0
- package/build/types/utilities/index.d.ts +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +1 -1
- package/build/types/withNextPortal/withNextPortal.d.ts +1 -2
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +18 -18
- package/build/es/no-polyfill/common/Option/OptionDocs.js +0 -1
- package/build/es/no-polyfill/link/Link.messages.js +0 -1
- package/build/es/no-polyfill/upload/utils/generateErrorMessage/generateErrorMessage.js +0 -1
- package/build/es/no-polyfill/upload/utils/generateErrorMessage/index.js +0 -1
- package/build/es/no-polyfill/utilities/deprecatedProp/index.js +0 -1
- package/build/es/polyfill/common/Option/OptionDocs.js +0 -1
- package/build/es/polyfill/link/Link.messages.js +0 -1
- package/build/es/polyfill/upload/utils/generateErrorMessage/generateErrorMessage.js +0 -1
- package/build/es/polyfill/upload/utils/generateErrorMessage/index.js +0 -1
- package/build/es/polyfill/utilities/deprecatedProp/index.js +0 -1
- package/build/types/upload/utils/generateErrorMessage/generateErrorMessage.d.ts +0 -1
- package/build/types/upload/utils/generateErrorMessage/index.d.ts +0 -1
- package/build/types/utilities/deprecatedProp/index.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isKey,isUndefined}from"@transferwise/neptune-validation";import Types from"prop-types";import{useEffect,useRef}from"react";import{useConditionalListener}from"../hooks";import{Key}from"../key";import{getFocusableElements,resetFocus}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";var TAB=Key.TAB,FocusBoundary=function(a){var b=a.children,c=useRef(),d=isUndefined(document)?void 0:document,e={};return useEffect(function(){c.current.focus(),e=getFocusableElements(c.current)},[]),useConditionalListener({eventType:"keydown",callback:function callback(a){return isKey({keyType:TAB,event:a})&&resetFocus({event:a,focusableEls:e})},attachListener:!0,parent:d}),/*#__PURE__*/_jsx("span",{ref:c,tabIndex:-1,className:"np-focus-boundary outline-none",children:b})};FocusBoundary.propTypes={children:Types.node.isRequired};export default FocusBoundary;
|
|
@@ -2,5 +2,5 @@ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _toConsu
|
|
|
2
2
|
* This function returns the first and the last focusable elements within a node.
|
|
3
3
|
*
|
|
4
4
|
* @param {Node} focusBoundaryContainer - the area that contains focused elements.
|
|
5
|
-
* @returns {
|
|
6
|
-
*/export var getFocusableElements=function(a){var b={first:a,last:a};if(null!==a&&void 0!==a&&a.querySelectorAll){var d=_toConsumableArray(a.querySelectorAll("a, button, input, textarea, select, details,[tabindex]:not([tabindex=\"-1\"])")).filter(function(a){return!a.hasAttribute("disabled")});if(d.length){var c=_slicedToArray(d,1);b.first=c[0],b.last=d[d.length-1]}}return b};
|
|
5
|
+
* @returns {object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
|
|
6
|
+
*/export var getFocusableElements=function(a){var b={first:a,last:a};if(null!==a&&void 0!==a&&a.querySelectorAll){var d=_toConsumableArray(a.querySelectorAll("a, button, input, textarea, select, details,[tabindex]:not([tabindex=\"-1\"])")).filter(function(a){return!a.hasAttribute("disabled")});if(0<d.length){var c=_slicedToArray(d,1);b.first=c[0],b.last=d[d.length-1]}}return b};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This function resets the focus to either last of first focusable elements within a node.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
4
|
+
* @param {object} focusableEls - contains the first last of first focusable elements within a node.
|
|
5
|
+
* @param {object} event - the triggered event
|
|
6
6
|
*/export var resetFocus=function(a){var b=a.focusableEls,c=b.first,d=b.last,e=a.event,f=document,g=f.activeElement;e.shiftKey&&g===c&&(d&&d.focus(),e.preventDefault()),e.shiftKey||g!==d||(c&&c.focus(),e.preventDefault())};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _defineProperty from"@babel/runtime/helpers/defineProperty";var HistoryNavigator=function a(){var b=this,c=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[],d=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;_classCallCheck(this,a),_defineProperty(this,"reset",function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[""],c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:20;b.history=a,b.currIndex=0<a.length-1?a.length-1:0,b.historyLimit=c}),_defineProperty(this,"add",function(a){!b.historyLimit||b.history.length<=b.historyLimit?(b.history.push(a),b.currIndex=b.history.length-1):b.currIndex=b.history.length-1}),_defineProperty(this,"redo",function(){var a=b.history.length;return b.currIndex=b.currIndex+1<a?b.currIndex+1:a-1,b.history[b.currIndex]}),_defineProperty(this,"undo",function(){return b.currIndex=0<b.currIndex-1?b.currIndex-1:0,b.history[b.currIndex]}),this.history=c&&c.length?c:[""],this.currIndex=this.history.length-1,this.historyLimit=d};export default HistoryNavigator;
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _defineProperty from"@babel/runtime/helpers/defineProperty";var HistoryNavigator=function a(){var b=this,c=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[],d=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;_classCallCheck(this,a),_defineProperty(this,"reset",function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[""],c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:20;b.history=a,b.currIndex=0<a.length-1?a.length-1:0,b.historyLimit=c}),_defineProperty(this,"add",function(a){!b.historyLimit||b.history.length<=b.historyLimit?(b.history.push(a),b.currIndex=b.history.length-1):b.currIndex=b.history.length-1}),_defineProperty(this,"redo",function(){var a=b.history.length;return b.currIndex=b.currIndex+1<a?b.currIndex+1:a-1,b.history[b.currIndex]}),_defineProperty(this,"undo",function(){return b.currIndex=0<b.currIndex-1?b.currIndex-1:0,b.history[b.currIndex]}),this.history=c&&0<c.length?c:[""],this.currIndex=this.history.length-1,this.historyLimit=d};export default HistoryNavigator;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useLayoutEffect,useState,useEffect}from"react";
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import throttle from"lodash.throttle";import{useLayoutEffect,useState,useEffect}from"react";var THROTTLE_MS=100,useIsomorphicLayoutEffect="undefined"==typeof window?useEffect:useLayoutEffect;export var useClientWidth=function(a){var b=a.ref,c=a.throttleMs,d=void 0===c?THROTTLE_MS:c,e=useState(null),f=_slicedToArray(e,2),g=f[0],h=f[1];return useIsomorphicLayoutEffect(function(){// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
2
|
+
var a=function(){b&&(b.innerWidth?h(b.innerWidth):b.current&&h(b.current.clientWidth))},c=throttle(a,d);// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
2
3
|
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
3
4
|
// won't get removed even if the component is unmounted.
|
|
4
5
|
return window.addEventListener("resize",c,!0),window.requestAnimationFrame(a),function(){return window.removeEventListener("resize",c,!0)}},[]),[g]};useClientWidth.THROTTLE_MS=100;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isUndefined}from"@transferwise/neptune-validation";import{useEffect}from"react";/**
|
|
2
2
|
* useConditionalListener attaches an event to the document when a condition is met.
|
|
3
3
|
*
|
|
4
4
|
* @param {bool} attachListener - condition to be met for the listener to be attached
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {Function} callback - function registered with the event listener
|
|
6
6
|
* @param {string} eventType - type of event to attach to document
|
|
7
|
-
*
|
|
8
7
|
* @usage `useConditionalListener({
|
|
9
8
|
* eventType: 'click',
|
|
10
9
|
* callback,
|
|
11
10
|
* attachListener: condition,
|
|
12
11
|
* });`
|
|
13
|
-
|
|
14
|
-
* */export var useConditionalListener=function(a){var b=a.attachListener,c=a.callback,d=a.eventType,e=a.parent;useEffect(function(){return b&&!isUndefined(e)&&e.addEventListener(d,c,!0),function(){isUndefined(e)||e.removeEventListener(d,c,!0)}},[b])};
|
|
12
|
+
*/export var useConditionalListener=function(a){var b=a.attachListener,c=a.callback,d=a.eventType,e=a.parent;useEffect(function(){return b&&!isUndefined(e)&&e.addEventListener(d,c,!0),function(){isUndefined(e)||e.removeEventListener(d,c,!0)}},[b])};
|
|
@@ -3,8 +3,9 @@ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState
|
|
|
3
3
|
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
4
4
|
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
5
5
|
*
|
|
6
|
+
* @param elRef.elRef
|
|
6
7
|
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
7
8
|
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
8
|
-
*
|
|
9
|
+
* @param elRef.loading
|
|
9
10
|
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
10
|
-
|
|
11
|
+
*/export var useHasIntersected=function(a){var b=a.elRef,c=a.loading,d=useState(!1),e=_slicedToArray(d,2),f=e[0],g=e[1],h=function(){return b&&b.current},i=function(a,c){a.forEach(function(a){a.isIntersecting&&(g(!0),c.unobserve(b.current))})};return useEffect(function(){var a,c=!1;return"undefined"!=typeof window&&window.IntersectionObserver&&h()?!c&&(a=new IntersectionObserver(i,ObserverParams),a.observe(b.current)):g(!0),function(){c=!0,a&&a.unobserve(b.current)}},[b]),"eager"===c?[!1]:[f]};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _fallbackPlacements;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _fallbackPlacements;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classnames from"classnames";import PropTypes from"prop-types";import{useState,forwardRef,useEffect}from"react";import{usePopper}from"react-popper";import{Position}from"..";import Dimmer from"../../dimmer";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var POPOVER_OFFSET=[0,16],fallbackPlacements=(_fallbackPlacements={},_defineProperty(_fallbackPlacements,Position.TOP,[Position.BOTTOM,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.BOTTOM,[Position.TOP,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.LEFT,[Position.RIGHT,Position.TOP,Position.BOTTOM]),_defineProperty(_fallbackPlacements,Position.RIGHT,[Position.LEFT,Position.TOP,Position.BOTTOM]),_fallbackPlacements),Panel=/*#__PURE__*/forwardRef(function(a,b){var c=a.arrow,d=a.children,e=a.className,f=a.open,g=a.onClose,h=a.position,i=a.anchorRef,j=useState(null),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useState(null),o=_slicedToArray(n,2),p=o[0],q=o[1],r=[];c&&(r.push({name:"arrow",options:{element:l,options:{padding:8// 8px from the edges of the popper
|
|
2
2
|
}}}),r.push({name:"offset",options:{offset:POPOVER_OFFSET}})),fallbackPlacements[h]&&r.push({name:"flip",options:{fallbackPlacements:fallbackPlacements[h]}});var s=usePopper(i.current,p,{placement:h,modifiers:r}),t=s.styles,u=s.attributes,v=s.forceUpdate;// If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
|
|
3
3
|
// it is most simple just to always position before opening
|
|
4
|
-
return useEffect(function(){f&&v&&v()},[f]),/*#__PURE__*/_jsx(Dimmer,{open:f,
|
|
4
|
+
return useEffect(function(){f&&v&&v()},[f]),/*#__PURE__*/_jsx(Dimmer,{open:f,transparent:!0,fadeContentOnEnter:!0,fadeContentOnExit:!0,onClose:g,children:/*#__PURE__*/_jsx("div",_objectSpread(_objectSpread({ref:q,style:_objectSpread({},t.popper)},u.popper),{},{className:classnames("np-panel",{"np-panel--open":f},e),children:/*#__PURE__*/_jsxs("div",{ref:b,className:classnames("np-panel__content"),children:[d,c&&/*#__PURE__*/_jsx("div",{ref:m,className:classnames("np-panel__arrow"),style:t.arrow})]})}))})});// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
|
|
5
5
|
// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
|
|
6
6
|
// This mapping forces popover to try the four available positions before going back to the initial chosen one.
|
|
7
7
|
Panel.Position={BOTTOM:Position.BOTTOM,LEFT:Position.LEFT,RIGHT:Position.RIGHT,TOP:Position.TOP},Panel.defaultProps={arrow:!1,className:void 0,open:!1,position:Panel.Position.TOP},Panel.propTypes={arrow:PropTypes.bool,className:PropTypes.string,children:PropTypes.node.isRequired,open:PropTypes.bool,onClose:PropTypes.func.isRequired,position:PropTypes.oneOf([Panel.Position.BOTTOM,Panel.Position.LEFT,Panel.Position.RIGHT,Panel.Position.TOP]),// Ref currently doesn't have a clear defined propType
|
|
8
8
|
// https://github.com/facebook/prop-types/issues/240
|
|
9
|
-
// eslint-disable-next-line
|
|
10
9
|
anchorRef:PropTypes.shape({current:PropTypes.any}).isRequired};export default Panel;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */var prepRequirements=function(a){if(!a
|
|
2
|
-
var d=c.split("."),e=d[0];b[e]||(b[e]={type:"object",properties:{}}),b[e].properties[d[1]]=a[c]}else b[c]=a[c]}),b},prepType=function(a){var b=a.type&&a.type.toLowerCase&&a.type.toLowerCase();switch(b){case"text":a.type="string";break;case"date":a.type="string",a.format="date";break;case"password":a.type="string",a.control="password";break;case"checkbox":a.type="boolean";break;case"select":a.control||(a.control="select"),delete a.type;break;case"radio":a.control="radio",delete a.type;break;case"upload":a.type="string",a.format="base64url";break;case"tel":a.type="string",a.format="phone";break;case"textarea":a.type="string",a.control="textarea";break;default:}a.control||"object"===a.type||(a.control=getControlType(a))},prepLegacyAlternatives=function(a){!a.title&&a.label&&(a.title=a.label),a.title||(a.title=getNameFromType(a.type)),!a.type&&a.name&&(a.type=a.name),!a.description&&a.tooltip&&(a.description=a.tooltip),a.fieldGroups&&!a.fields&&(a.fields=flattenFieldsWithGroups(a.fieldGroups),delete a.fieldGroups)},prepLegacyProps=function(a){a.name&&!a.title&&(a.title=a.name,delete a.name),a.validationRegexp&&(a.pattern=a.validationRegexp,delete a.validationRegexp),a.min&&(a.minimum=a.min,delete a.min),a.max&&(a.maximum=a.max,delete a.max),a.example&&!a.placeholder&&(a.placeholder=a.example,delete a.example),a.tooltip&&!a.help&&(a.help={message:a.tooltip},delete a.tooltip),a.valuesAllowed&&!a.values&&(a.values=a.valuesAllowed,delete a.valuesAllowed),a.values&&a.values.map&&(a.values=prepLegacyValues(a.values)),a.value&&!a.default&&(a.default=a.value,delete a.value),a.values&&a.values&&a.values.length&&a.values[0]&&!a.values[0].value&&a.values[0].label&&!a.placeholder&&(a.placeholder=a.values[0].label,a.values=a.values.slice(1))},prepLegacyValues=function(a){return a.map(prepLegacyValue)},prepLegacyValue=function(a){return!a.label&&a.title&&(a.label=a.title,delete a.title),!a.label&&a.name&&(a.label=a.name,delete a.name),!a.value&&a.code&&(a.value=a.code,delete a.code),!a.value&&a.key&&(a.value=a.key,delete a.key),a},prepPattern=function(a){if(a.pattern)try{RegExp(a.pattern)}catch(b){console.warn("API regexp is invalid"),delete a.pattern}else delete a.pattern},prepValidationMessages=function(a,b){return a.validationMessages=a.validationMessages?a.validationMessages:b,a.validationMessages?void(a.validationMessages.minimum&&(a.validationMessages.min=a.validationMessages.minimum,delete a.validationMessages.minimum),a.validationMessages.maximum&&(a.validationMessages.max=a.validationMessages.maximum,delete a.validationMessages.maximum)):void delete a.validationMessages},getControlType=function(a){if(a.control)return a.control.toLowerCase();if(a.hidden)return"hidden";if(a.values&&a.values.length)return getSelectionType(a);switch(a.type){case"string":return getControlForStringFormat(a.format);case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text";}},getControlForStringFormat=function(a){return"date"===a?"date":"base64url"===a?"file":"password"===a?"password":"uri"===a?"text":"email"===a?"text":"phone"===a?"tel":"text"},getSelectionType=function(a){return a.control?a.control:"select"===a.type?"select":"radio"===a.type?"radio":a.values?3<a.values.length?"select":"radio":"select"},copyOf=function(a){return JSON.parse(JSON.stringify(a))},getNameFromType=function(a){if(a&&0<a.length){var b=a.toLowerCase().split("_").join(" ");// String.replace method only replaces first instance
|
|
1
|
+
/* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */var prepRequirements=function(a){if(!a||0===a.length)return[];var b=copyOf(a);return b.forEach(function(a){a.prepared||(prepLegacyAlternatives(a),a.properties=prepFields(a.properties||a.fields),a.type&&"object"!==a.type&&!a.types&&(a.properties.type={type:"string",enum:[a.type],required:!0,hidden:!0},a.type="object"),a.prepared=!0)}),b},prepFields=function(a,b,c){if(!a)return{};var d=copyOf(a);return d=flattenFieldsWithGroups(d),d=transformFieldArrayToMap(d),d=transformNestedKeysToNestedSpecs(d),Object.keys(d).forEach(function(a){d[a]=prepField(d[a],b,c)}),d},prepField=function(a,b,c){var d=copyOf(a);return prepLegacyProps(d),prepType(d),prepPattern(d),prepValidationMessages(d,c),d},flattenFieldsWithGroups=function(a){if(Array.isArray(a)){var b=[];return a.forEach(function(a){a.fields?b=b.concat(flattenFieldWithGroup(a,a.fields)):a.group?b=b.concat(flattenFieldWithGroup(a,a.group)):b.push(a)}),b}return a},flattenFieldWithGroup=function(a,b){return a.name&&0<b.length&&!b[0].name&&(b[0].name=a.name),a.width&&0<b.length&&!b[0].width&&(b[0].width=a.width),a.tooltip&&0<b.length&&!b[0].help&&(b[0].help={message:a.tooltip}),a.info&&0<b.length&&!b[0].help&&(b[0].help={message:a.info}),2===b.length&&b.forEach(function(a){a.width="md"}),3===b.length&&(b[0].width="md",b[1].width="md"),b},transformFieldArrayToMap=function(a){if(Array.isArray(a)){var b={};return a.forEach(function(a){var c=a.key||a.name;delete a.key,b[c]=copyOf(a)}),b}return a},transformNestedKeysToNestedSpecs=function(a){if(Array.isArray(a))throw new TypeError("Expecting a map of fields, not an array");var b={};return Object.keys(a).forEach(function(c){if(0<c.indexOf(".")){// If the key contains a period we need to nest the fields in another object
|
|
2
|
+
var d=c.split("."),e=d[0];b[e]||(b[e]={type:"object",properties:{}}),b[e].properties[d[1]]=a[c]}else b[c]=a[c]}),b},prepType=function(a){var b=a.type&&a.type.toLowerCase&&a.type.toLowerCase();switch(b){case"text":a.type="string";break;case"date":a.type="string",a.format="date";break;case"password":a.type="string",a.control="password";break;case"checkbox":a.type="boolean";break;case"select":a.control||(a.control="select"),delete a.type;break;case"radio":a.control="radio",delete a.type;break;case"upload":a.type="string",a.format="base64url";break;case"tel":a.type="string",a.format="phone";break;case"textarea":a.type="string",a.control="textarea";break;default:}a.control||"object"===a.type||(a.control=getControlType(a))},prepLegacyAlternatives=function(a){!a.title&&a.label&&(a.title=a.label),a.title||(a.title=getNameFromType(a.type)),!a.type&&a.name&&(a.type=a.name),!a.description&&a.tooltip&&(a.description=a.tooltip),a.fieldGroups&&!a.fields&&(a.fields=flattenFieldsWithGroups(a.fieldGroups),delete a.fieldGroups)},prepLegacyProps=function(a){a.name&&!a.title&&(a.title=a.name,delete a.name),a.validationRegexp&&(a.pattern=a.validationRegexp,delete a.validationRegexp),a.min&&(a.minimum=a.min,delete a.min),a.max&&(a.maximum=a.max,delete a.max),a.example&&!a.placeholder&&(a.placeholder=a.example,delete a.example),a.tooltip&&!a.help&&(a.help={message:a.tooltip},delete a.tooltip),a.valuesAllowed&&!a.values&&(a.values=a.valuesAllowed,delete a.valuesAllowed),a.values&&a.values.map&&(a.values=prepLegacyValues(a.values)),a.value&&!a.default&&(a.default=a.value,delete a.value),a.values&&a.values&&0<a.values.length&&a.values[0]&&!a.values[0].value&&a.values[0].label&&!a.placeholder&&(a.placeholder=a.values[0].label,a.values=a.values.slice(1))},prepLegacyValues=function(a){return a.map(prepLegacyValue)},prepLegacyValue=function(a){return!a.label&&a.title&&(a.label=a.title,delete a.title),!a.label&&a.name&&(a.label=a.name,delete a.name),!a.value&&a.code&&(a.value=a.code,delete a.code),!a.value&&a.key&&(a.value=a.key,delete a.key),a},prepPattern=function(a){if(a.pattern)try{new RegExp(a.pattern)}catch(b){console.warn("API regexp is invalid"),delete a.pattern}else delete a.pattern},prepValidationMessages=function(a,b){return a.validationMessages=a.validationMessages?a.validationMessages:b,a.validationMessages?void(a.validationMessages.minimum&&(a.validationMessages.min=a.validationMessages.minimum,delete a.validationMessages.minimum),a.validationMessages.maximum&&(a.validationMessages.max=a.validationMessages.maximum,delete a.validationMessages.maximum)):void delete a.validationMessages},getControlType=function(a){if(a.control)return a.control.toLowerCase();if(a.hidden)return"hidden";if(a.values&&0<a.values.length)return getSelectionType(a);switch(a.type){case"string":return getControlForStringFormat(a.format);case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text";}},getControlForStringFormat=function(a){return"date"===a?"date":"base64url"===a?"file":"password"===a?"password":"uri"===a?"text":"email"===a?"text":"phone"===a?"tel":"text"},getSelectionType=function(a){return a.control?a.control:"select"===a.type?"select":"radio"===a.type?"radio":a.values?3<a.values.length?"select":"radio":"select"},copyOf=function(a){return JSON.parse(JSON.stringify(a))},getNameFromType=function(a){if(a&&0<a.length){var b=a.toLowerCase().split("_").join(" ");// String.replace method only replaces first instance
|
|
3
3
|
return b.charAt(0).toUpperCase()+b.slice(1)}return""};export{prepFields,getControlType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import{Position,Breakpoint}from"..";import
|
|
1
|
+
import PropTypes from"prop-types";import{Position,Breakpoint}from"..";import SizeSwapper from"../../sizeSwapper";import BottomSheet from"../bottomSheet";import Panel from"../panel";import{jsx as _jsx}from"react/jsx-runtime";var ResponsivePanel=function(a){var b=a.anchorRef,c=a.arrow,d=a.children,e=a.className,f=a.onClose,g=a.open,h=a.position,i="undefined"==typeof window?void 0:window,j=[{items:[/*#__PURE__*/_jsx(BottomSheet,{open:g,className:e,onClose:f,children:d},"bottomSheet")]},{items:[/*#__PURE__*/_jsx(Panel,{arrow:c,open:g,position:h,anchorRef:b,className:e,onClose:f,children:d},"panel")],breakpoint:Breakpoint.SMALL}];return/*#__PURE__*/_jsx(SizeSwapper,{ref:i,items:j,inline:!0})};ResponsivePanel.defaultProps={arrow:!1,className:void 0,open:!1,position:Position.TOP},ResponsivePanel.propTypes={arrow:PropTypes.bool,children:PropTypes.node.isRequired,className:PropTypes.string,/** Function attached to document click and keydown. It gets called when a close condition provided is met. */onClose:PropTypes.func.isRequired,open:PropTypes.bool,anchorRef:PropTypes.shape({current:PropTypes.shape({})}).isRequired,position:PropTypes.oneOf(["top","right","left","bottom"])};export default ResponsivePanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getDistanceToNextSymbol,getDistanceToPreviousSymbol}from"../getDistanceToSymbol";
|
|
1
|
+
import getCountOfSymbolsInSelection from"../getCountOfSymbolsInSelection";import{getDistanceToNextSymbol,getDistanceToPreviousSymbol}from"../getDistanceToSymbol";var getCursorPositionAfteractionstroke=function(a,b,c,d,e){var f=b;switch(a){case"Backspace":b===c&&(f-=getDistanceToPreviousSymbol(b,d),f=0<f?f-1:0);break;case"Paste":f+=e+getCountOfSymbolsInSelection(b,b+e,d)+getDistanceToNextSymbol(b+e,d);break;case"Cut":case"Delete":break;default:f+=1+getDistanceToNextSymbol(b,d);}return f};export default getCursorPositionAfteractionstroke;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var unformatWithPattern=function(a,b){var c=[""];return a&&a.length&&(c=a.toString().split(""),c=c.filter(function(a){return
|
|
1
|
+
var unformatWithPattern=function(a,b){var c=[""];return a&&0<a.length&&(c=a.toString().split(""),c=c.filter(function(a){return!getSymbolsInPattern(b).includes(a)})),c.join("")},getSymbolsInPattern=function(a){return a.split("").filter(function(a){return"*"!==a})};export default unformatWithPattern;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import
|
|
2
|
-
|
|
3
|
-
var d=S(w,A,b),e=d.checkedDay;w&&e!==w&&x(e),F(c),N(e,A,c)}else F(c),N(w,A,null)},R=function(a){a!==I&&(J(a),j(K(a)||null))},S=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},T=i===DateMode.MONTH_YEAR,U=classNames({"col-sm-8":T,"col-sm-5":!T,"pull-right":p}),V=-1<MonthBeforeDay.indexOf(r);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:n,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?k&&k():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?l&&l():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[V&&/*#__PURE__*/_jsx("div",{className:U,children:L()}),!T&&/*#__PURE__*/_jsx("div",{className:classNames("col-sm-3",{"pull-right":p}),children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(c),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:e}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:w||"",onChange:function(a){return O(a)},placeholder:m.day,disabled:b})]})})}),!V&&/*#__PURE__*/_jsx("div",{className:U,children:L()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(c),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:g}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:m.year,value:E||"",onChange:function(a){return Q(a)},disabled:b})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import{useDirection}from"../common/hooks";import Select from"../select";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=useDirection(),s=r.isRTL,t=useIntl(),u=t.locale,v=t.formatMessage,w=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},x=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=w();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},y=useState(function(){return x("day")}),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(function(){return x("month")}),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(function(){return x("year")}),H=_slicedToArray(G,2),I=H[0],J=H[1],K=useState(w),L=_slicedToArray(K,2),M=L[0],N=L[1];h=h||v(messages.dayLabel),i=i||v(messages.monthLabel),j=j||v(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||v(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var O=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},P=function(){var a=getMonthNames(u,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,{name:"month",className:"form-control",disabled:e,placeholder:p.month,options:Q(),size:f,selected:null===E?null:{value:E,label:a[E]},onChange:function(a){return T(a)}})]})},Q=function(){var a=[],b=getMonthNames(u,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},R=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:A,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:E,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:I,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||V(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==E||c!==I)&&V(e):a&&0<=b&&c&&(a!==A||b!==E||c!==I)&&V(e)},S=function(a){var b=W(a.target.value,E,I),c=b.checkedDay;B(c),R(c,E,I)},T=function(a){if(!a)return F(null),void R(A,null,I);var b=a?a.value:0,c=W(A,b,I),d=c.checkedDay;F(b),A&&d!==A&&B(d),R(d,b,I)},U=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
|
|
2
|
+
var d=W(A,E,b),e=d.checkedDay;A&&e!==A&&B(e),J(c),R(e,E,c)}else J(c),R(A,E,null)},V=function(a){a!==M&&(N(a),m(O(a)||null))},W=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},X=l===DateMode.MONTH_YEAR,Y=classNames({"col-sm-8":X,"col-sm-5":!X,"pull-right":s}),Z=MonthBeforeDay.has(u);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Z&&/*#__PURE__*/_jsx("div",{className:Y,children:P()}),!X&&/*#__PURE__*/_jsx("div",{className:classNames("col-sm-3",{"pull-right":s}),children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:A||"",placeholder:p.day,disabled:e,onChange:function(a){return S(a)}})]})})}),!Z&&/*#__PURE__*/_jsx("div",{className:Y,children:P()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:p.year,value:I||"",disabled:e,onChange:function(a){return U(a)}})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
4
3
|
function shouldPropagateOnFocus(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c&&c.closest(".tw-date");return d!==e}// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
|
|
5
|
-
function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,
|
|
4
|
+
function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:""};export default DateInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineMessages}from"react-intl";export default defineMessages({monthLabel:{id:"neptune.DateInput.month.label"},dayLabel:{id:"neptune.DateInput.day.label"},yearLabel:{id:"neptune.DateInput.year.label"}});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,Breakpoint}from"../common";import BottomSheet from"../common/bottomSheet";import{isWithinRange,moveToWithinRange}from"../common/dateUtils";import KeyCodes from"../common/keyCodes";import DateTrigger from"./dateTrigger";import DayCalendar from"./dayCalendar";import{getStartOfDay}from"./getStartOfDay";import MonthCalendar from"./monthCalendar";import YearCalendar from"./yearCalendar";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MODE={DAY:"day",MONTH:"month",YEAR:"year"},DateLookup=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"element",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"dropdown",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"getWindowSize",function(){return"undefined"!=typeof window&&window.innerWidth||"undefined"!=typeof document&&document.documentElement.clientWidth}),_defineProperty(_assertThisInitialized(d),"open",function(){var a=d.props.onFocus;d.setState({open:!0,mode:MODE.DAY,isMobile:d.getWindowSize()<=Breakpoint.SMALL},function(){d.adjustIfOffscreen(),d.focusOn(".tw-date-lookup-header-current")}),a&&a(),window.addEventListener("resize",d.resizeHandler),document.addEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"resizeHandler",function(){return d.setState({isMobile:d.getWindowSize()<=Breakpoint.SMALL},d.adjustIfOffscreen())}),_defineProperty(_assertThisInitialized(d),"adjustIfOffscreen",function(){if(!d.state.isMobile&&d.open&&d.dropdown&&d.dropdown.current){var a=d.dropdown.current,b=a.getBoundingClientRect(),c=b.right>d.getWindowSize(),e=0>b.left;c&&a.classList[e?"remove":"add"]("dropdown-menu-xs-right")}}),_defineProperty(_assertThisInitialized(d),"close",function(){var a=d.props.onBlur;d.setState({open:!1}),a&&a(),window.removeEventListener("resize",d.adjustIfOffscreen),document.removeEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"handleOutsideClick",function(a){var b=d.state.isMobile;if(d.state.open&&!b){var c=d.element.current.querySelector(".dropdown-menu");c&&!c.contains(a.target)&&d.close()}}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){var b=d.state.open;switch(a.keyCode){case KeyCodes.LEFT:b?d.adjustDate(-1,-1,-1):d.open(),a.preventDefault();break;case KeyCodes.UP:b?d.adjustDate(-7,-4,-4):d.open(),a.preventDefault();break;case KeyCodes.RIGHT:b?d.adjustDate(1,1,1):d.open(),a.preventDefault();break;case KeyCodes.DOWN:b?d.adjustDate(7,4,4):d.open(),a.preventDefault();break;case KeyCodes.ESCAPE:d.close(),a.preventDefault();break;default:}}),_defineProperty(_assertThisInitialized(d),"adjustDate",function(a,b,c){var e,f=d.state,g=f.selectedDate,h=f.min,i=f.max,j=f.mode;e=g?new Date(j===MODE.YEAR?g.getFullYear()+c:g.getFullYear(),j===MODE.MONTH?g.getMonth()+b:g.getMonth(),j===MODE.DAY?g.getDate()+a:g.getDate()):getStartOfDay(new Date),e=moveToWithinRange(e,h,i),+e!=+g&&d.props.onChange(e)}),_defineProperty(_assertThisInitialized(d),"focusOn",function(a,b){var c=d.element.current.querySelector(a);c?c.focus():b&&d.focusOn(b)}),_defineProperty(_assertThisInitialized(d),"switchMode",function(a){d.setState({mode:a},function(){d.focusOn(".active",".today")})}),_defineProperty(_assertThisInitialized(d),"switchToDays",function(){return d.switchMode(MODE.DAY)}),_defineProperty(_assertThisInitialized(d),"switchToMonths",function(){return d.switchMode(MODE.MONTH)}),_defineProperty(_assertThisInitialized(d),"switchToYears",function(){return d.switchMode(MODE.YEAR)}),_defineProperty(_assertThisInitialized(d),"handleSelectedDateUpdate",function(a){d.setState({selectedDate:a},function(){d.props.onChange(a),d.close(),d.focusOn(".btn")})}),_defineProperty(_assertThisInitialized(d),"handleViewDateUpdate",function(a){var b=a.month,c=void 0===b?d.state.viewMonth:b,e=a.year,f=void 0===e?d.state.viewYear:e;d.setState({viewMonth:c,viewYear:f})}),_defineProperty(_assertThisInitialized(d),"getCalendar",function(){var a=d.state,b=a.selectedDate,c=a.min,e=a.max,f=a.viewMonth,g=a.viewYear,h=a.mode,i=d.props,j=i.placeholder,k=i.monthFormat;return/*#__PURE__*/_jsxs(_Fragment,{children:[h===MODE.DAY&&/*#__PURE__*/_jsx(DayCalendar,{selectedDate:b,min:c,max:e,viewMonth:f,viewYear:g,monthFormat:k,onSelect:d.handleSelectedDateUpdate,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.MONTH&&/*#__PURE__*/_jsx(MonthCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToDays,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.YEAR&&/*#__PURE__*/_jsx(YearCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToMonths,onViewDateUpdate:d.handleViewDateUpdate})]})}),_defineProperty(_assertThisInitialized(d),"handleClear",function(){d.props.onChange(null),d.focusOn(".np-date-trigger")}),d.state={selectedDate:getStartOfDay(a.value),min:getStartOfDay(a.min),max:getStartOfDay(a.max),viewMonth:(a.value||new Date).getMonth(),viewYear:(a.value||new Date).getFullYear(),open:!1,mode:MODE.DAY,isMobile:!1},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentDidUpdate",value:function componentDidUpdate(a){+this.props.value!=+a.value&&this.state.open&&this.focusOn(".active")}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState=function(){}}},{key:"render",value:function render(){var a=this.state,b=a.selectedDate,c=a.open,d=a.isMobile,e=this.props,f=e.size,g=e.placeholder,h=e.label,i=e.monthFormat,j=e.disabled,k=e.clearable,l=e.value;return/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
2
2
|
ref:this.element,className:"btn-group btn-block dropdown ".concat(c?"open":""),onKeyDown:this.handleKeyDown,children:[/*#__PURE__*/_jsx(DateTrigger,{selectedDate:b,size:f,placeholder:g,label:h,monthFormat:i,disabled:j,onClick:this.open,onClear:!j&&k&&l?this.handleClear:null}),d?/*#__PURE__*/_jsx(BottomSheet,{open:c,onClose:this.close,children:this.getCalendar()}):c&&/*#__PURE__*/_jsx("div",{ref:this.dropdown,className:"dropdown-menu tw-date-lookup-menu",children:this.getCalendar()})]})}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(a,b){var c=getStartOfDay(a.value),d=getStartOfDay(a.min),e=getStartOfDay(a.max),f=+b.selectedDate!=+c,g=+b.min!=+d,h=+b.max!=+e;if(f||g||h){var i=f?c:b.selectedDate,j=g?d:b.min,k=h?e:b.max;// make sure that selected date is within allowed range
|
|
3
3
|
if(!isWithinRange(i,j,k))return a.onChange(moveToWithinRange(i,j,k)),null;var l=(i||new Date).getMonth(),m=(i||new Date).getFullYear();return{selectedDate:i,min:j,max:k,viewMonth:l,viewYear:m}}return null}}]),b}(PureComponent);DateLookup.propTypes={value:PropTypes.instanceOf(Date).isRequired,min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string,label:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),disabled:PropTypes.bool,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,clearable:PropTypes.bool},DateLookup.defaultProps={min:null,max:null,size:Size.MEDIUM,placeholder:"",label:"",monthFormat:MonthFormat.LONG,disabled:!1,onFocus:null,onBlur:null,clearable:!1};export default DateLookup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{formatDate}from"@transferwise/formatting";import{CrossCircle}from"@transferwise/icons";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input dropdown-toggle np-date-trigger np-date-trigger--").concat(c),disabled:g,type:"button",onClick:h,children:[e&&/*#__PURE__*/_jsx("span",{className:"control-label small m-r-1",children:e}),b?/*#__PURE__*/_jsx("span",{children:formatDate(b,k,{day:"numeric",month:f,year:"numeric"})}):/*#__PURE__*/_jsx("span",{className:"form-control-placeholder visible-xs-inline visible-sm-inline visible-md-inline visible-lg-inline visible-xl-inline",children:d}),i?/*#__PURE__*/_jsx("span",{role:"button",tabIndex:0,className:"clear-btn d-flex align-items-center","aria-label":l(messages.ariaLabel),onClick:function(a){a.stopPropagation(),a.preventDefault(),i()},onKeyDown:function handleKeyDown(a){(isKey({keyType:"Space",event:a})||isKey({keyType:"Enter",event:a}))&&(a.stopPropagation(),a.preventDefault(),i())},children:/*#__PURE__*/_jsx(CrossCircle,{filled:!0,size:c===Size.SMALL?16:24})}):/*#__PURE__*/_jsx(Chevron,{orientation:Position.BOTTOM,disabled:g})]})};DateTrigger.propTypes={selectedDate:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string.isRequired,label:PropTypes.string.isRequired,monthFormat:PropTypes.oneOf(["short","long"]).isRequired,disabled:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired,onClear:PropTypes.func},DateTrigger.defaultProps={selectedDate:null,size:Size.MEDIUM,onClear:void 0};export default DateTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import Header from"../header";import DayCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(f,e),g,{month:h,year:"numeric"}),onLabelClick:i,onPreviousClick:this.selectPreviousMonth,onNextClick:this.selectNextMonth}),/*#__PURE__*/_jsx(DayCalendarTable,{selectedDate:b,min:c,max:d,viewMonth:e,viewYear:f,onSelect:j})]})}}]),b}(PureComponent);DayCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,monthFormat:PropTypes.oneOf([MonthFormat.LONG,MonthFormat.SHORT]).isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},DayCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendar);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{getDayNames,isWithinRange}from"../../../common/dateUtils";import{getStartOfDay}from"../../getStartOfDay";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SHORT_DAY_FORMAT={day:"numeric"},DayCalendarTable=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"getTableStructure",function(){var b=a.props,c=b.viewMonth,d=b.viewYear,e=new Date(d,c,1).getDay();0===e&&(e=7);var f,g=new Date(d,c+1,0).getDate(),h=[],j=[];// Pad first week
|
|
2
2
|
for(f=1;f<e;f+=1)h.push(!1);// Fill in days
|
|
3
|
-
for(f=1;f<=g;f+=1)h.push(f),0==(e+f-1)%7&&(j.push(h),h=[]);if(h.length){// Pad last week
|
|
4
|
-
for(f=h.length;7>f;f+=1)h.push(!1);j.push(h)}return j}),_defineProperty(_assertThisInitialized(a),"days",getDayNames(a.props.intl.locale,"short")),_defineProperty(_assertThisInitialized(a),"daysShort",getDayNames(a.props.intl.locale,"narrow")),_defineProperty(_assertThisInitialized(a),"selectDay",function(b){var c=a.props,d=c.viewMonth,e=c.viewYear,f=c.onSelect;f(new Date(e,d,b))}),_defineProperty(_assertThisInitialized(a),"isDisabled",function(b){var c=a.props,d=c.min,e=c.max,f=c.viewMonth,g=c.viewYear,h=new Date(g,f,b);return!isWithinRange(h,d,e)}),_defineProperty(_assertThisInitialized(a),"isActive",function(b){var c=a.props,d=c.selectedDate,e=c.viewMonth,f=c.viewYear;return!!(d&&+new Date(f,e,b)==+d)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.viewMonth,d=b.viewYear,e=b.intl.locale,f=this.getTableStructure();return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{children:/*#__PURE__*/_jsx("tr",{children:this.days.map(function(b,c){return/*#__PURE__*/_jsxs("th",{className:"text-xs-center",children:[/*#__PURE__*/_jsx("span",{className:"hidden-xs",children:b.
|
|
3
|
+
for(f=1;f<=g;f+=1)h.push(f),0==(e+f-1)%7&&(j.push(h),h=[]);if(0<h.length){// Pad last week
|
|
4
|
+
for(f=h.length;7>f;f+=1)h.push(!1);j.push(h)}return j}),_defineProperty(_assertThisInitialized(a),"days",getDayNames(a.props.intl.locale,"short")),_defineProperty(_assertThisInitialized(a),"daysShort",getDayNames(a.props.intl.locale,"narrow")),_defineProperty(_assertThisInitialized(a),"selectDay",function(b){var c=a.props,d=c.viewMonth,e=c.viewYear,f=c.onSelect;f(new Date(e,d,b))}),_defineProperty(_assertThisInitialized(a),"isDisabled",function(b){var c=a.props,d=c.min,e=c.max,f=c.viewMonth,g=c.viewYear,h=new Date(g,f,b);return!isWithinRange(h,d,e)}),_defineProperty(_assertThisInitialized(a),"isActive",function(b){var c=a.props,d=c.selectedDate,e=c.viewMonth,f=c.viewYear;return!!(d&&+new Date(f,e,b)==+d)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.viewMonth,d=b.viewYear,e=b.intl.locale,f=this.getTableStructure();return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{children:/*#__PURE__*/_jsx("tr",{children:this.days.map(function(b,c){return/*#__PURE__*/_jsxs("th",{className:"text-xs-center",children:[/*#__PURE__*/_jsx("span",{className:"hidden-xs",children:b.slice(0,3)}),/*#__PURE__*/_jsx("span",{className:"visible-xs-inline-block",children:a.daysShort[c].slice(0,2)})]},b)})})}),/*#__PURE__*/_jsx("tbody",{children:f.map(function(b,f){return/*#__PURE__*/_jsx("tr",{children:b.map(function(b,f){return/*#__PURE__*/_jsx("td",{className:4<f?"default":"",children:b&&/*#__PURE__*/_jsx(TableLink,{item:b,type:"day",title:formatDate(new Date(d,c,b),e,SHORT_DAY_FORMAT),longTitle:formatDate(new Date(d,c,b),e),active:a.isActive(b),disabled:a.isDisabled(b),today:+getStartOfDay(new Date)==+new Date(d,c,b),onClick:a.selectDay})},f)})},f)})})]})}}]),b}(PureComponent);DayCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,onSelect:PropTypes.func.isRequired},DayCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendarTable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import Chevron from"../../chevron";import{Position,Size}from"../../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var
|
|
1
|
+
import PropTypes from"prop-types";import Chevron from"../../chevron";import{Position,Size}from"../../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var buttonClasses="btn-link p-a-0 text-no-decoration font-weight-bold",Header=function(a){var b=a.label,c=a.onLabelClick,d=a.onPreviousClick,e=a.onNextClick;return/*#__PURE__*/_jsxs("div",{className:"text-xs-center p-t-1 p-b-2 clearfix",children:[/*#__PURE__*/_jsx("div",{className:"pull-xs-left",children:/*#__PURE__*/_jsx("button",{type:"button",className:buttonClasses,onClick:d,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.LEFT,size:Size.MEDIUM})})}),b&&/*#__PURE__*/_jsx("button",{type:"button",className:"tw-date-lookup-header-current ".concat(buttonClasses),onClick:c,children:b}),/*#__PURE__*/_jsx("div",{className:"pull-xs-right",children:/*#__PURE__*/_jsx("button",{type:"button",className:buttonClasses,onClick:e,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.RIGHT,size:Size.MEDIUM})})})]})};Header.propTypes={label:PropTypes.string,onLabelClick:PropTypes.func,onPreviousClick:PropTypes.func.isRequired,onNextClick:PropTypes.func.isRequired},Header.defaultProps={label:null,onLabelClick:function onLabelClick(){}};export default Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import Header from"../header";import MonthCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(e,0),f,{year:"numeric"}),onLabelClick:h,onPreviousClick:this.selectPreviousYear,onNextClick:this.selectNextYear}),/*#__PURE__*/_jsx(MonthCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:g,onSelect:this.onMonthSelect})]})}}]),b}(PureComponent);MonthCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},MonthCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(MonthCalendar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{useIntl}from"react-intl";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=3,COLS=4,MONTH_ONLY_FORMAY={month:"short"},MonthCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"month",title:formatDate(new Date(e,a),i,MONTH_ONLY_FORMAY),active:!!(b&&a===b.getMonth()&&e===b.getFullYear()),disabled:k(a),today:e===new Date().getFullYear()&&a===new Date().getMonth(),onClick:g})},k=function(a){var b=new Date(e,a);return!!(c&&b<new Date(c.getFullYear(),c.getMonth())||d&&b>new Date(d.getFullYear(),d.getMonth()))};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"3",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(b*COLS+c)},c)})},b)})})]})};MonthCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},MonthCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default MonthCalendarTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{PureComponent}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var TableLink=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onClick",function(b){b.preventDefault(),a.props.disabled||a.props.onClick(a.props.item)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.item,c=a.type,d=a.title,e=a.longTitle,f=a.active,g=a.disabled,h=a.today;return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx("button",{type:"button",className:"tw-date-lookup-".concat(c,"-option ").concat(f?"active":""," ").concat(h?"today":""),disabled:g,"aria-label":e,onClick:this.onClick,children:d||b})})}}]),b}(PureComponent);TableLink.propTypes={item:PropTypes.number.isRequired,// day (1-31), month (0-11) or year (2018 etc)
|
|
2
2
|
type:PropTypes.oneOf(["day","month","year"]).isRequired,title:PropTypes.string,longTitle:PropTypes.string,active:PropTypes.bool.isRequired,disabled:PropTypes.bool.isRequired,today:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired},TableLink.defaultProps={title:null,longTitle:null};export default TableLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import
|
|
1
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{PureComponent}from"react";import Header from"../header";import YearCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{onPreviousClick:this.selectPreviousYears,onNextClick:this.selectNextYears}),/*#__PURE__*/_jsx(YearCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:f,onSelect:this.onYearSelect})]})}}]),b}(PureComponent);YearCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},YearCalendar.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{useIntl}from"react-intl";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=5,COLS=4,YEAR_ONLY_FORMAT={year:"numeric"},YearCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"year",title:formatDate(new Date(a,0),i,YEAR_ONLY_FORMAT),active:!!(b&&a===b.getFullYear()),disabled:!!(c&&a<c.getFullYear()||d&&a>d.getFullYear()),today:a===new Date().getFullYear(),onClick:g})};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"4",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(e-e%20+b*COLS+c)},c)})},b)})})]})};YearCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},YearCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendarTable;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import requiredIf from"react-required-if";import
|
|
2
|
-
media:i,
|
|
3
|
-
media:h,
|
|
4
|
-
return b.map(function(a,b){var c=a.title,d=a.description,e=a.disabled,f=a.href,g=a.target,h=a.media.list,i=a.onClick;return/*#__PURE__*/_jsx(NavigationOption
|
|
5
|
-
media:h,
|
|
1
|
+
import classNames from"classnames";import PropTypes from"prop-types";import requiredIf from"react-required-if";import{Size,Breakpoint}from"../common";import{useDirection}from"../common/hooks";import NavigationOption from"../navigationOption";import SizeSwapper from"../sizeSwapper";import Tile from"../tile";import{Presentation,Type}from"./decisionEnums";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var Decision=function(a){var b=a.options,c=a.presentation,d=a.type,e=a.size,f=useDirection(),g=f.isRTL;if(d===Type.NAVIGATION){var h=Presentation.LIST_BLOCK,i=Presentation.LIST_BLOCK_GRID;if(c===h||c===i){var j=e===Size.SMALL,k=c===i,l=[{items:[],layout:SizeSwapper.Layout.COLUMN},{items:[],breakpoint:j?Breakpoint.EXTRA_SMALL:Breakpoint.SMALL,wrap:k}];return b.forEach(function(a,b){var c=a.description,d=a.disabled,e=a.href,f=a.target,g=a.media,h=g.block,i=g.list,m=a.onClick,n=a.title;l[0].items.push(/*#__PURE__*/_jsx(NavigationOption// eslint-disable-next-line react/no-array-index-key
|
|
2
|
+
,{complex:!1,content:c,disabled:d,href:e,target:f,media:i,showMediaAtAllSizes:!0,title:n,onClick:m},"nav-".concat(b))),l[1].items.push(/*#__PURE__*/_jsx(Tile// eslint-disable-next-line react/no-array-index-key
|
|
3
|
+
,{className:classNames("np-decision__tile".concat(j?"--small":""),{"np-decision__tile--fixed-width":k}),description:c,disabled:d,href:e,target:f,media:h,size:j?Size.SMALL:Size.MEDIUM,title:n,onClick:m},"tile-".concat(b)))}),/*#__PURE__*/_jsx("div",{className:classNames("np-decision",{"np-decision--small":j,"np-decision--grid":k,"np-decision--rtl":g}),children:/*#__PURE__*/_jsx(SizeSwapper,{items:l})})}// LIST
|
|
4
|
+
return b.map(function(a,b){var c=a.title,d=a.description,e=a.disabled,f=a.href,g=a.target,h=a.media.list,i=a.onClick;return/*#__PURE__*/_jsx(NavigationOption// eslint-disable-next-line react/no-array-index-key
|
|
5
|
+
,{complex:!1,content:d,disabled:e,href:f,target:g,media:h,showMediaAtAllSizes:!0,title:c,onClick:i},"nav-".concat(b))})}return/*#__PURE__*/_jsx(_Fragment,{})};Decision.propTypes={/** A list of elements to be rendered */options:PropTypes.arrayOf(PropTypes.shape({description:PropTypes.node,disabled:PropTypes.bool,href:requiredIf(PropTypes.string,function(a){return a.type===Type.NAVIGATION}),target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),media:PropTypes.shape({block:PropTypes.node.isRequired,list:PropTypes.node.isRequired}),onClick:PropTypes.func.isRequired,title:PropTypes.node.isRequired})).isRequired,/** Handles the display mode of the component */presentation:PropTypes.oneOf(["LIST","LIST_BLOCK","LIST_BLOCK_GRID"]),/** Size currently affects only Tile dimension */size:PropTypes.oneOf(["sm","md"]),/** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */type:PropTypes.oneOf(["NAVIGATION"])},Decision.defaultProps={presentation:Presentation.LIST,size:Size.MEDIUM,type:Type.NAVIGATION};export default Decision;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _alignmentClassMap;import
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _alignmentClassMap;import classNames from"classnames";import PropTypes from"prop-types";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var isLayoutHorizontal=function(a){return[Layout.HORIZONTAL_LEFT_ALIGNED,Layout.HORIZONTAL_RIGHT_ALIGNED,Layout.HORIZONTAL_JUSTIFIED].includes(a)},alignmentClassMap=(_alignmentClassMap={},_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_RIGHT_ALIGNED,"text-sm-right"),_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_JUSTIFIED,"text-sm-justify"),_alignmentClassMap),DefinitionList=function(a){var b=a.definitions,c=a.layout,d=a.muted;return/*#__PURE__*/_jsx("dl",{className:classNames("tw-definition-list d-flex ",{"text-muted":d,"flex-column":c===Layout.VERTICAL_ONE_COLUMN,"tw-definition-list--columns flex-column flex-row--sm":c===Layout.VERTICAL_TWO_COLUMN,"tw-definition-list--horizontal flex-column":isLayoutHorizontal(c)}),children:b.filter(function(a){return a}).map(function(a){var b=a.title,d=a.value,e=a.key;return/*#__PURE__*/_jsxs("div",{className:"tw-definition-list__item",children:[/*#__PURE__*/_jsx("dt",{children:b}),/*#__PURE__*/_jsx("dd",{className:alignmentClassMap[c]||"",children:d})]},e)})})};DefinitionList.propTypes={definitions:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.node.isRequired,value:PropTypes.node.isRequired,key:PropTypes.string.isRequired})),layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED","HORIZONTAL_RIGHT_ALIGNED"]),muted:PropTypes.bool},DefinitionList.defaultProps={definitions:[],layout:Layout.VERTICAL_TWO_COLUMN,muted:!1};export default DefinitionList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from"classnames";import PropTypes from"prop-types";import{useEffect,useRef}from"react";import CSSTransition from"react-transition-group/CSSTransition";import{addNoScrollBodyClass,removeNoScrollBodyClass}from"../common";import{isIosDevice}from"../common/deviceDetection";import FocusBoundary from"../common/focusBoundary";import withNextPortal from"../withNextPortal/withNextPortal";import DimmerManager from"./dimmerManager";import{jsx as _jsx}from"react/jsx-runtime";export var EXIT_ANIMATION=350;var dimmerManager=new DimmerManager,handleTouchMove=function(a){var b=a.target.className.startsWith("dimmer");// disable scroll on iOS devices for Dimmer area
|
|
2
2
|
// this is because of bug in WebKit https://bugs.webkit.org/show_bug.cgi?id=220908
|
|
3
3
|
// note: scrolling still works for children(s) as expected
|
|
4
|
-
isIosDevice()&&b&&(a.stopPropagation(),a.preventDefault())};return useEffect(function(){return i&&(document.addEventListener("keydown",m),k.current&&k.current.addEventListener("touchmove",
|
|
5
|
-
,timeout:{enter:0,exit:EXIT_ANIMATION},classNames:{enter:classNames({"dimmer--enter-fade":e}),enterDone:classNames("dimmer--enter-done",{"dimmer--enter-fade":e}),exit:classNames("dimmer--exit",{"dimmer--exit-fade":f})},onEnter:function onEnter(){return dimmerManager.add(k)},onExited:function onExited(){return dimmerManager.remove(k)},
|
|
4
|
+
isIosDevice()&&b&&(a.stopPropagation(),a.preventDefault())},Dimmer=function(a){var b=a.children,c=a.className,d=a.disableClickToClose,e=a.fadeContentOnEnter,f=a.fadeContentOnExit,g=a.transparent,h=a.onClose,i=a.open,j=a.scrollable,k=useRef(),l=!d&&h?function closeOnClick(a){a.target===k.current&&h(a)}:void 0,m=function(a){"Escape"!==a.key||(a.stopPropagation(),h&&dimmerManager.isTop(k)&&h(a))};return useEffect(function(){return i&&(document.addEventListener("keydown",m),k.current&&k.current.addEventListener("touchmove",handleTouchMove)),function(){document.removeEventListener("keydown",m),k.current&&k.current.removeEventListener("touchmove",handleTouchMove)}},[i]),/*#__PURE__*/_jsx(CSSTransition,{in:i,appear:!0// Wait for animation to finish before unmount.
|
|
5
|
+
,timeout:{enter:0,exit:EXIT_ANIMATION},classNames:{enter:classNames({"dimmer--enter-fade":e}),enterDone:classNames("dimmer--enter-done",{"dimmer--enter-fade":e}),exit:classNames("dimmer--exit",{"dimmer--exit-fade":f})},unmountOnExit:!0,onEnter:function onEnter(){return dimmerManager.add(k)},onExited:function onExited(){return dimmerManager.remove(k)},children:/*#__PURE__*/_jsx(DimmerContentWrapper,{scrollBody:!g,children:/*#__PURE__*/_jsx("div",{ref:k,className:classNames("dimmer",{"dimmer--scrollable":j,"dimmer--transparent":g},c),role:"presentation",onClick:l,children:/*#__PURE__*/_jsx(FocusBoundary,{children:b})})})})};export var DimmerContentWrapper=function(a){var b=a.children,c=a.scrollBody;return useEffect(function(){return c&&addNoScrollBodyClass(),function(){c&&removeNoScrollBodyClass()}},[]),b};Dimmer.propTypes={children:PropTypes.node,className:PropTypes.string,disableClickToClose:PropTypes.bool,fadeContentOnEnter:PropTypes.bool,fadeContentOnExit:PropTypes.bool,/** Sets the background to transparent and prevents body scroll locking */transparent:PropTypes.bool,onClose:PropTypes.func,open:PropTypes.bool,scrollable:PropTypes.bool},Dimmer.defaultProps={children:null,className:void 0,disableClickToClose:!1,fadeContentOnEnter:!1,fadeContentOnExit:!1,transparent:!1,onClose:void 0,open:!1,scrollable:!1};export{Dimmer};export default withNextPortal(Dimmer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from"classnames";import PropTypes from"prop-types";import CloseButton from"../common/closeButton";import{Position}from"../common/propsValues/position";import Dimmer from"../dimmer";import SlidingPanel from"../slidingPanel";import{logActionRequiredIf}from"../utilities";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Drawer=function(a){var b=a.children,c=a.footerContent,d=a.headerTitle,e=a.onClose,f=a.open,g=a.position;return logActionRequiredIf("Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.",!e),/*#__PURE__*/_jsx(Dimmer,{open:f,onClose:e,children:/*#__PURE__*/_jsx(SlidingPanel,{open:f,position:g,children:/*#__PURE__*/_jsxs("div",{className:"np-drawer",children:[/*#__PURE__*/_jsxs("div",{className:classNames("np-drawer-header",{"np-drawer-header--withborder":d}),children:[/*#__PURE__*/_jsx(CloseButton,{onClick:e}),d&&/*#__PURE__*/_jsx("div",{className:"np-drawer-header--title h3",children:d})]}),b&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-content"),children:b}),c&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-footer"),children:c})]})})})};Drawer.propTypes={/** The content to appear in the drawer body. */children:PropTypes.node,/** The content to appear in the drawer footer. */footerContent:PropTypes.node,/** The content to appear in the drawer header. */headerTitle:PropTypes.string,/** The action to perform on close click. */onClose:PropTypes.func,/** The status of Drawer either open or not. */open:PropTypes.bool,/** The placement of Drawer on the screen either left or right. */position:PropTypes.oneOf(["left","right"])},Drawer.defaultProps={children:null,footerContent:null,headerTitle:null,onClose:null,open:!1,position:Position.RIGHT};export default Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import
|
|
1
|
+
import PropTypes from"prop-types";import{Layout}from"../common";import{prepFields}from"../common/requirements";import DefinitionList from"../definitionList";import createDefinitions from"./utils/createDefinitions";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DynamicFieldDefinitionList=function(a){var b=a.model,c=a.title,d=a.layout,e=a.fields;return/*#__PURE__*/_jsxs(_Fragment,{children:[c&&/*#__PURE__*/_jsx("div",{className:"m-t-1",children:/*#__PURE__*/_jsx("div",{className:"p-t-3 h4",children:c})}),/*#__PURE__*/_jsx(DefinitionList,{layout:d,definitions:createDefinitions(prepFields(e),b)})]})};DynamicFieldDefinitionList.propTypes={model:PropTypes.shape({}).isRequired,fields:PropTypes.shape({}).isRequired,title:PropTypes.string,layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED"])},DynamicFieldDefinitionList.defaultProps={title:null,layout:Layout.VERTICAL_TWO_COLUMN};export default DynamicFieldDefinitionList;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{formatDate,formatNumber}from"@transferwise/formatting";import classNames from"classnames";import PropTypes from"prop-types";import{useIntl}from"react-intl";import{formatUsingPattern}from"../utils/text-format";/**
|
|
2
2
|
*
|
|
3
3
|
* @param {Array} options
|
|
4
4
|
* @param {string|number} value
|
|
5
5
|
*/import{jsx as _jsx}from"react/jsx-runtime";var getValueLabel=function(a,b){var c=a.find(function(a){return a.value===b});return c&&c.label?c.label:b},mask=function(a){return Array(a.length+1).join("*")},FormattedValue=function(a){var b=a.field,c=a.value,d=useIntl(),e=d.locale,f=[];switch(b.tagClassName&&b.tagClassName.h3&&(f.push("h3"),f.push("formatted-value__h3-custom-alignment")),b.control){case"select":case"radio":return/*#__PURE__*/_jsx("span",{children:getValueLabel(b.values,c)});case"date":return/*#__PURE__*/_jsx("span",{children:formatDate(c instanceof Date?c:new Date(c),e)});case"number":return/*#__PURE__*/_jsx("span",{children:formatNumber(c,e)});case"password":return/*#__PURE__*/_jsx("span",{children:mask(c)});case"file":return/*#__PURE__*/_jsx("div",{className:"thumbnail",children:/*#__PURE__*/_jsx("img",{alt:b.title,src:c})});case"checkbox":return/*#__PURE__*/_jsx("span",{children:JSON.stringify(c)});default:return/*#__PURE__*/_jsx("span",{className:classNames(f),children:formatUsingPattern(c,b.displayFormat)});}};/**
|
|
6
6
|
*
|
|
7
7
|
* @param {string} value
|
|
8
|
-
*/FormattedValue.propTypes={field:PropTypes.shape({control:PropTypes.string.isRequired,displayFormat:PropTypes.string,refreshRequirementsOnChange:PropTypes.bool,title:PropTypes.string.isRequired,type:PropTypes.string.isRequired,width:PropTypes.string,tagClassName:PropTypes.shape({h3:PropTypes.bool})
|
|
9
|
-
values:PropTypes.arrayOf(PropTypes.shape({value:PropTypes.any}))}).isRequired,// eslint-disable-next-line react/forbid-prop-types
|
|
10
|
-
value:PropTypes.any.isRequired};export default FormattedValue;
|
|
8
|
+
*/FormattedValue.propTypes={field:PropTypes.shape({control:PropTypes.string.isRequired,displayFormat:PropTypes.string,refreshRequirementsOnChange:PropTypes.bool,title:PropTypes.string.isRequired,type:PropTypes.string.isRequired,width:PropTypes.string,tagClassName:PropTypes.shape({h3:PropTypes.bool}),values:PropTypes.arrayOf(PropTypes.shape({value:PropTypes.any}))}).isRequired,value:PropTypes.any.isRequired};export default FormattedValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var formatUsingPattern=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",b=1<arguments.length?arguments[1]:void 0;if("string"!=typeof b)return a;var c=b;0<c.indexOf("||")&&(c=c.
|
|
1
|
+
var formatUsingPattern=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",b=1<arguments.length?arguments[1]:void 0;if("string"!=typeof b)return a;var c=b;0<c.indexOf("||")&&(c=c.slice(0,Math.max(0,b.indexOf("||"))));for(var d="",separators=0,e=a.length,f=0;e;)positionIsSeparator(c,f)?(d+=c[f],separators+=1):(d+=a[f-separators],e-=1),f+=1;var g=countSeparatorsAfterCursor(c,f);return g&&(d+=c.slice(f,g)),d},countSeparatorsAfterCursor=function(a,b){for(var separators=0;positionIsSeparator(a,b+separators);)separators+=1;return separators},positionIsSeparator=function(a,b){return a[b]&&"*"!==a[b]};export{formatUsingPattern};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import EmphasisHtmlTransformer from"./EmphasisHtmlTransformer";import{jsx as _jsx}from"react/jsx-runtime";var SUPPORTED_TAGS=["important","positive","negative","warning"],emphasisHtmlTransformer=new EmphasisHtmlTransformer(SUPPORTED_TAGS),Emphasis=function(a){var b=a.text,c=void 0===b?void 0:b;if(!c)return null;var d=emphasisHtmlTransformer.transform(c);// eslint-disable-next-line react/no-danger
|
|
2
|
-
return d?/*#__PURE__*/_jsx("
|
|
2
|
+
return d?/*#__PURE__*/_jsx("em",{dangerouslySetInnerHTML:{__html:d}}):null};export default Emphasis;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import classNames from"classnames";import PropTypes from"prop-types";import{useRef}from"react";import{Breakpoint,Layout}from"../common";import CloseButton from"../common/closeButton";import{useClientWidth}from"../common/hooks";import Header from"../header";import Logo from"../logo";import Stepper from"../stepper";import AnimatedLabel from"./animatedLabel";import BackButton from"./backButton";// Size switches on parent container which may or may not have the same size as the window.
|
|
2
2
|
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var containerBreakpoints={"np-flow-navigation--sm":Breakpoint.SMALL,"np-flow-navigation--lg":Breakpoint.LARGE},FlowNavigation=function(a){var b=a.activeStep,c=a.avatar,d=a.logo,e=a.onClose,f=a.onGoBack,g=a.done,h=a.steps,i=useRef(null),j=useClientWidth({ref:i}),k=_slicedToArray(j,1),l=k[0],m=e&&/*#__PURE__*/_jsx(CloseButton,{onClick:e}),n=l<Breakpoint.SMALL,o=g?null:c;return/*#__PURE__*/_jsx("div",{ref:i,className:classNames("np-flow-navigation d-flex align-items-center justify-content-center p-y-3",{"np-flow-navigation--border-bottom":!g}),children:/*#__PURE__*/_jsx(Header,{className:classNames("np-flow-navigation__content p-x-3",{"np-flow-navigation--hidden":!l,"np-flow-navigation--xs-max":n},Object.keys(containerBreakpoints).filter(function(a){return l>=containerBreakpoints[a]})),leftContent:n?function getLeftContentSmall(){var a=f&&0<b;return/*#__PURE__*/_jsxs(_Fragment,{children:[a&&/*#__PURE__*/_jsx(BackButton,{label:/*#__PURE__*/_jsx(AnimatedLabel,{className:"m-x-1",labels:h.map(function(a){return a.label}),activeLabel:b-1}),onClick:f}),/*#__PURE__*/_jsx("div",{className:classNames("np-flow-navigation--flag",{"np-flow-navigation--flag__hidden":a,"np-flow-navigation--flag__display":!a})})]})}():d,rightContent:/*#__PURE__*/_jsxs(_Fragment,{children:[o,o&&m&&/*#__PURE__*/_jsx("span",{className:"separator"}),m]}),bottomContent:!g&&/*#__PURE__*/_jsx(Stepper,{activeStep:b,steps:h,className:classNames("np-flow-navigation__stepper")}),layout:l<Breakpoint.LARGE?Layout.VERTICAL:Layout.HORIZONTAL})})};FlowNavigation.defaultProps={activeStep:0,avatar:void 0,logo:/*#__PURE__*/_jsx(Logo,{}),onGoBack:void 0,onClose:void 0,done:!1},FlowNavigation.propTypes={activeStep:PropTypes.number,/** An Avatar */avatar:PropTypes.element,logo:PropTypes.node,/** Called when the close button is clicked. If not provided the close button won't show */onClose:PropTypes.func,/** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */onGoBack:PropTypes.func,done:PropTypes.bool,/** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */steps:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,onClick:PropTypes.func,hoverLabel:PropTypes.node})).isRequired};export default FlowNavigation;
|