@transferwise/components 0.0.0-experimental-c1f5b0b → 0.0.0-experimental-fe160ab
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Calendar/Calendar.constants.js +10 -0
- package/build/Calendar/Calendar.constants.js.map +1 -0
- package/build/Calendar/Calendar.constants.mjs +8 -0
- package/build/Calendar/Calendar.constants.mjs.map +1 -0
- package/build/Calendar/Calendar.js +116 -16
- package/build/Calendar/Calendar.js.map +1 -1
- package/build/Calendar/Calendar.messages.js +12 -0
- package/build/Calendar/Calendar.messages.js.map +1 -1
- package/build/Calendar/Calendar.messages.mjs +12 -0
- package/build/Calendar/Calendar.messages.mjs.map +1 -1
- package/build/Calendar/Calendar.mjs +117 -17
- package/build/Calendar/Calendar.mjs.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.js +5 -1
- package/build/Calendar/DateHeader/DateHeader.js.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.mjs +5 -1
- package/build/Calendar/DateHeader/DateHeader.mjs.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.js +20 -2
- package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.mjs +20 -2
- package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +60 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +60 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.js +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.js.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
- package/build/Calendar/TableLink/TableLink.js +91 -0
- package/build/Calendar/TableLink/TableLink.js.map +1 -0
- package/build/Calendar/TableLink/TableLink.mjs +87 -0
- package/build/Calendar/TableLink/TableLink.mjs.map +1 -0
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.js +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.js.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.mjs +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.mjs.map +1 -1
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
- package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js +40 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js.map +1 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs +38 -0
- package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs.map +1 -0
- package/build/DateLookup/DateLookup.js +20 -9
- package/build/DateLookup/DateLookup.js.map +1 -1
- package/build/DateLookup/DateLookup.mjs +20 -9
- package/build/DateLookup/DateLookup.mjs.map +1 -1
- package/build/i18n/en.json +4 -0
- package/build/i18n/en.json.js +4 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +4 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/main.css +8798 -4478
- package/build/styles/Accordion/Accordion.css +21 -23
- package/build/styles/AvatarLayout/AvatarLayout.css +11 -11
- package/build/styles/AvatarView/AvatarView.css +3 -3
- package/build/styles/AvatarView/Dot/Dot.css +3 -3
- package/build/styles/Button/Button.css +6 -6
- package/build/styles/Button/LegacyButton/LegacyButton.css +9 -3
- package/build/styles/Calendar/Calendar.css +119 -45
- package/build/styles/Calendar/TableLink/TableLink.css +115 -0
- package/build/styles/Carousel/Carousel.css +27 -28
- package/build/styles/CheckboxButton/CheckboxButton.css +15 -10
- package/build/styles/Chips/Chip/Chip.css +29 -26
- package/build/styles/Container/Container.css +5 -5
- package/build/styles/DateInput/DateInput.css +4 -4
- package/build/styles/DateLookup/DateLookup.css +1 -1
- package/build/styles/DateLookup/DateTrigger/DateTrigger.css +15 -9
- package/build/styles/DefinitionList/DefinitionList.css +83 -0
- package/build/styles/Dimmer/Dimmer.css +19 -9
- package/build/styles/Divider/Divider.css +7 -8
- package/build/styles/Drawer/Drawer.css +15 -16
- package/build/styles/DropFade/DropFade.css +2 -2
- package/build/styles/ExpressiveMoneyInput/AmountInput/AmountInput.css +4 -4
- package/build/styles/ExpressiveMoneyInput/Chevron/Chevron.css +5 -5
- package/build/styles/ExpressiveMoneyInput/ExpressiveMoneyInput.css +11 -11
- package/build/styles/Field/Field.css +12 -13
- package/build/styles/FlowNavigation/AnimatedLabel/AnimatedLabel.css +5 -5
- package/build/styles/FlowNavigation/FlowNavigation.css +46 -25
- package/build/styles/Header/Header.css +9 -11
- package/build/styles/Image/Image.css +7 -7
- package/build/styles/Info/Info.css +1 -1
- package/build/styles/Inputs/Input/Input.css +25 -24
- package/build/styles/Inputs/InputGroup/InputGroup.css +13 -13
- package/build/styles/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +10 -10
- package/build/styles/Inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +7 -7
- package/build/styles/Inputs/SelectInput/ClearButton/SelectInputClearButton.css +6 -6
- package/build/styles/Inputs/SelectInput/ItemView/SelectInputItemView.css +4 -4
- package/build/styles/Inputs/SelectInput/Option/SelectInputOption.css +2 -4
- package/build/styles/Inputs/SelectInput/OptionContent/SelectInputOptionContent.css +4 -4
- package/build/styles/Inputs/SelectInput/Options/SelectInputOptions.css +12 -17
- package/build/styles/Inputs/SelectInput/Popover/SelectInputPopover.css +4 -4
- package/build/styles/Inputs/SelectInput/SelectInput.css +49 -56
- package/build/styles/Inputs/TextArea/TextArea.css +27 -26
- package/build/styles/InstructionsList/InstructionsList.css +5 -5
- package/build/styles/Link/Link.css +8 -2
- package/build/styles/ListItem/ListItem.css +35 -38
- package/build/styles/ListItem/ListItem.grid.css +7 -7
- package/build/styles/Loader/Loader.css +31 -31
- package/build/styles/Logo/Logo.css +2 -2
- package/build/styles/Modal/Modal.css +14 -15
- package/build/styles/MoneyInput/MoneyInput.css +20 -10
- package/build/styles/Nudge/Nudge.css +77 -49
- package/build/styles/PhoneNumberInput/PhoneNumberInput.css +9 -3
- package/build/styles/Popover/Popover.css +10 -13
- package/build/styles/Progress/Progress.css +3 -3
- package/build/styles/ProgressBar/ProgressBar.css +4 -4
- package/build/styles/PromoCard/PromoCard.css +42 -28
- package/build/styles/Prompt/ActionPrompt/ActionPrompt.css +9 -9
- package/build/styles/Prompt/CriticalBanner/CriticalBanner.css +23 -23
- package/build/styles/Prompt/InfoPrompt/InfoPrompt.css +15 -15
- package/build/styles/Prompt/InlinePrompt/InlinePrompt.css +6 -5
- package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.css +8 -10
- package/build/styles/RadioGroup/RadioGroup.css +1 -1
- package/build/styles/Section/Section.css +6 -6
- package/build/styles/SegmentedControl/SegmentedControl.css +15 -18
- package/build/styles/SlidingPanel/SlidingPanel.css +40 -9
- package/build/styles/Snackbar/Snackbar.css +35 -21
- package/build/styles/Stepper/Stepper.css +15 -9
- package/build/styles/Sticky/Sticky.css +2 -2
- package/build/styles/Switch/Switch.css +7 -5
- package/build/styles/Table/Table.css +57 -60
- package/build/styles/Tabs/Tabs.css +14 -18
- package/build/styles/Tile/Tile.css +12 -12
- package/build/styles/Tooltip/Tooltip.css +2 -2
- package/build/styles/Typeahead/Typeahead.css +52 -40
- package/build/styles/Upload/Upload.css +10 -11
- package/build/styles/UploadInput/UploadButton/UploadButton.css +19 -20
- package/build/styles/UploadInput/UploadInput.css +4 -4
- package/build/styles/UploadInput/UploadItem/UploadItem.css +44 -45
- package/build/styles/_deprecated/ActionButton/ActionButton.css +6 -8
- package/build/styles/_deprecated/Alert/Alert.css +2 -2
- package/build/styles/_deprecated/Avatar/Avatar.css +65 -65
- package/build/styles/_deprecated/Badge/Badge.css +12 -8
- package/build/styles/_deprecated/Card/Card.css +18 -27
- package/build/styles/_deprecated/CriticalBanner/CriticalCommsBanner.css +7 -7
- package/build/styles/_deprecated/LegacyListItem/LegacyListItem.css +1 -1
- package/build/styles/_deprecated/NavigationOption/NavigationOption.css +19 -6
- package/build/styles/_deprecated/NavigationOptionsList/NavigationOptionsList.css +8 -3
- package/build/styles/_deprecated/OverlayHeader/OverlayHeader.css +6 -7
- package/build/styles/_deprecated/Select/Select.css +104 -57
- package/build/styles/_deprecated/Summary/Summary.css +30 -19
- package/build/styles/common/BaseCard/BaseCard.css +7 -3
- package/build/styles/common/BottomSheet/BottomSheet.css +18 -30
- package/build/styles/common/Circle/Circle.css +10 -10
- package/build/styles/common/CloseButton/CloseButton.css +36 -36
- package/build/styles/common/LiveRegion/LiveRegion.css +1 -1
- package/build/styles/common/Option/Option.css +44 -42
- package/build/styles/common/Panel/Panel.css +7 -7
- package/build/styles/css/accordion.css +52 -24
- package/build/styles/css/alerts.css +124 -56
- package/build/styles/css/badge.css +30 -20
- package/build/styles/css/breadcrumbs.css +4 -6
- package/build/styles/css/button-groups.css +258 -114
- package/build/styles/css/buttons.css +94 -49
- package/build/styles/css/chevron.css +6 -0
- package/build/styles/css/circles.css +76 -38
- package/build/styles/css/close.css +4 -1
- package/build/styles/css/column-layout.css +59 -37
- package/build/styles/css/currency-flags.css +17 -4
- package/build/styles/css/decision.css +12 -14
- package/build/styles/css/dropdowns.css +209 -58
- package/build/styles/css/droppable.css +38 -43
- package/build/styles/css/flex.css +136 -40
- package/build/styles/css/footer.css +14 -15
- package/build/styles/css/grid.css +1434 -381
- package/build/styles/css/input-groups.css +546 -252
- package/build/styles/css/link-callout.css +8 -2
- package/build/styles/css/list-group.css +92 -57
- package/build/styles/css/loaders.css +11 -11
- package/build/styles/css/media.css +34 -10
- package/build/styles/css/modals.css +59 -49
- package/build/styles/css/navbar.css +811 -371
- package/build/styles/css/navs.css +124 -59
- package/build/styles/css/neptune-social-media.css +44 -4
- package/build/styles/css/neptune.css +7118 -3155
- package/build/styles/css/panels.css +243 -143
- package/build/styles/css/popovers.css +295 -114
- package/build/styles/css/process.css +77 -64
- package/build/styles/css/progress-bars.css +21 -11
- package/build/styles/css/select.css +52 -20
- package/build/styles/css/sequences.css +219 -99
- package/build/styles/css/table.css +43 -48
- package/build/styles/css/tick.css +10 -10
- package/build/styles/css/tooltip.css +82 -49
- package/build/styles/css/utilities.css +40 -12
- package/build/styles/css/wells.css +16 -16
- package/build/styles/main.css +8798 -4478
- package/build/styles/styles/less/accordion.css +52 -24
- package/build/styles/styles/less/alerts.css +124 -56
- package/build/styles/styles/less/badge.css +30 -20
- package/build/styles/styles/less/breadcrumbs.css +4 -6
- package/build/styles/styles/less/button-groups.css +258 -114
- package/build/styles/styles/less/buttons.css +94 -49
- package/build/styles/styles/less/chevron.css +6 -0
- package/build/styles/styles/less/circles.css +76 -38
- package/build/styles/styles/less/close.css +4 -1
- package/build/styles/styles/less/column-layout.css +59 -37
- package/build/styles/styles/less/currency-flags.css +17 -4
- package/build/styles/styles/less/decision.css +12 -14
- package/build/styles/styles/less/dropdowns.css +209 -58
- package/build/styles/styles/less/droppable.css +38 -43
- package/build/styles/styles/less/flex.css +136 -40
- package/build/styles/styles/less/footer.css +14 -15
- package/build/styles/styles/less/forms/bootstrap-forms.css +348 -178
- package/build/styles/styles/less/forms/checkbox-radio.css +56 -29
- package/build/styles/styles/less/grid.css +1434 -381
- package/build/styles/styles/less/input-groups.css +546 -252
- package/build/styles/styles/less/link-callout.css +8 -2
- package/build/styles/styles/less/list-group.css +92 -57
- package/build/styles/styles/less/loaders.css +11 -11
- package/build/styles/styles/less/media.css +34 -10
- package/build/styles/styles/less/modals.css +59 -49
- package/build/styles/styles/less/navbar.css +811 -371
- package/build/styles/styles/less/navs.css +124 -59
- package/build/styles/styles/less/neptune-social-media.css +44 -4
- package/build/styles/styles/less/neptune.css +7118 -3155
- package/build/styles/styles/less/panels.css +243 -143
- package/build/styles/styles/less/popovers.css +295 -114
- package/build/styles/styles/less/process.css +77 -64
- package/build/styles/styles/less/progress-bars.css +21 -11
- package/build/styles/styles/less/select.css +52 -20
- package/build/styles/styles/less/sequences.css +219 -99
- package/build/styles/styles/less/table.css +43 -48
- package/build/styles/styles/less/tick.css +10 -10
- package/build/styles/styles/less/tooltip.css +82 -49
- package/build/styles/styles/less/utilities.css +40 -12
- package/build/styles/styles/less/wells.css +16 -16
- package/build/types/Calendar/Calendar.constants.d.ts +2 -0
- package/build/types/Calendar/Calendar.constants.d.ts.map +1 -0
- package/build/types/Calendar/Calendar.d.ts +16 -3
- package/build/types/Calendar/Calendar.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.messages.d.ts +20 -0
- package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.types.d.ts +32 -0
- package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts +2 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +7 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +6 -0
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts +1 -0
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts +2 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +5 -1
- package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
- package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts +2 -1
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts +1 -0
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
- package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
- package/build/types/Calendar/_helpers/index.d.ts +3 -0
- package/build/types/Calendar/_helpers/index.d.ts.map +1 -0
- package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts +3 -0
- package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts.map +1 -0
- package/build/types/Calendar/index.d.ts +1 -0
- package/build/types/Calendar/index.d.ts.map +1 -1
- package/build/types/DateLookup/DateLookup.d.ts +24 -5
- package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/DateLookup/index.d.ts +1 -0
- package/build/types/DateLookup/index.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +8 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Accordion/Accordion.css +21 -23
- package/src/Accordion/Accordion.less +4 -3
- package/src/AvatarLayout/AvatarLayout.css +11 -11
- package/src/AvatarView/AvatarView.css +3 -3
- package/src/AvatarView/Dot/Dot.css +3 -3
- package/src/Button/Button.css +6 -6
- package/src/Button/LegacyButton/LegacyButton.css +9 -3
- package/src/Button/LegacyButton/LegacyButton.less +3 -1
- package/src/Calendar/Calendar.constants.ts +5 -0
- package/src/Calendar/Calendar.css +119 -45
- package/src/Calendar/Calendar.disabledDates.test.tsx +593 -0
- package/src/Calendar/Calendar.less +5 -35
- package/src/Calendar/Calendar.messages.ts +21 -0
- package/src/Calendar/Calendar.test.tsx +310 -28
- package/src/Calendar/Calendar.tsx +159 -18
- package/src/Calendar/Calendar.types.ts +35 -0
- package/src/Calendar/DateHeader/DateHeader.tsx +6 -0
- package/src/Calendar/DayCalendar/DayCalendar.tsx +39 -1
- package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +67 -27
- package/src/Calendar/MonthCalendar/MonthCalendar.tsx +8 -0
- package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +15 -3
- package/src/Calendar/TableLink/TableLink.css +115 -0
- package/src/Calendar/TableLink/TableLink.less +68 -0
- package/src/Calendar/TableLink/TableLink.tsx +112 -0
- package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +15 -3
- package/src/Calendar/YearCalendar/YearCalendar.tsx +9 -0
- package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
- package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
- package/src/Calendar/_helpers/index.ts +2 -0
- package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.test.ts +169 -0
- package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.ts +59 -0
- package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +118 -0
- package/src/Calendar/_stories/Calendar.story.tsx +138 -4
- package/src/Calendar/_stories/Calendar.test.story.tsx +114 -0
- package/src/Calendar/index.ts +7 -0
- package/src/Carousel/Carousel.css +27 -28
- package/src/CheckboxButton/CheckboxButton.css +15 -10
- package/src/CheckboxButton/CheckboxButton.less +4 -4
- package/src/Chips/Chip/Chip.css +29 -26
- package/src/Chips/Chip/Chip.less +3 -5
- package/src/Container/Container.css +5 -5
- package/src/DateInput/DateInput.css +4 -4
- package/src/DateLookup/DateLookup.css +1 -1
- package/src/DateLookup/DateLookup.disabledDates.test.tsx +293 -0
- package/src/DateLookup/DateLookup.test.tsx +34 -37
- package/src/DateLookup/DateLookup.tsx +37 -13
- package/src/DateLookup/DateTrigger/DateTrigger.css +15 -9
- package/src/DateLookup/DateTrigger/DateTrigger.less +2 -1
- package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +108 -0
- package/src/DateLookup/_stories/DateLookup.story.tsx +124 -2
- package/src/DateLookup/index.ts +6 -0
- package/src/Decision/Decision.less +2 -0
- package/src/DefinitionList/DefinitionList.css +83 -0
- package/src/DefinitionList/DefinitionList.less +3 -1
- package/src/Dimmer/Dimmer.css +19 -9
- package/src/Dimmer/Dimmer.less +3 -2
- package/src/Divider/Divider.css +7 -8
- package/src/Drawer/Drawer.css +15 -16
- package/src/DropFade/DropFade.css +2 -2
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.css +4 -4
- package/src/ExpressiveMoneyInput/Chevron/Chevron.css +5 -5
- package/src/ExpressiveMoneyInput/ExpressiveMoneyInput.css +11 -11
- package/src/Field/Field.css +12 -13
- package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.css +5 -5
- package/src/FlowNavigation/FlowNavigation.css +46 -25
- package/src/Header/Header.css +9 -11
- package/src/Image/Image.css +7 -7
- package/src/Info/Info.css +1 -1
- package/src/Inputs/Input/Input.css +25 -24
- package/src/Inputs/InputGroup/InputGroup.css +13 -13
- package/src/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +10 -10
- package/src/Inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +7 -7
- package/src/Inputs/SelectInput/ClearButton/SelectInputClearButton.css +6 -6
- package/src/Inputs/SelectInput/ItemView/SelectInputItemView.css +4 -4
- package/src/Inputs/SelectInput/Option/SelectInputOption.css +2 -4
- package/src/Inputs/SelectInput/OptionContent/SelectInputOptionContent.css +4 -4
- package/src/Inputs/SelectInput/Options/SelectInputOptions.css +12 -17
- package/src/Inputs/SelectInput/Popover/SelectInputPopover.css +4 -4
- package/src/Inputs/SelectInput/SelectInput.css +49 -56
- package/src/Inputs/TextArea/TextArea.css +27 -26
- package/src/InstructionsList/InstructionsList.css +5 -5
- package/src/Link/Link.css +8 -2
- package/src/Link/Link.less +3 -3
- package/src/ListItem/ListItem.css +35 -38
- package/src/ListItem/ListItem.grid.css +7 -7
- package/src/Loader/Loader.css +31 -31
- package/src/Logo/Logo.css +2 -2
- package/src/Modal/Modal.css +14 -15
- package/src/MoneyInput/MoneyInput.css +20 -10
- package/src/MoneyInput/MoneyInput.less +3 -2
- package/src/Nudge/Nudge.css +77 -49
- package/src/Nudge/Nudge.less +8 -0
- package/src/PhoneNumberInput/PhoneNumberInput.css +9 -3
- package/src/PhoneNumberInput/PhoneNumberInput.less +3 -1
- package/src/Popover/Popover.css +10 -13
- package/src/Progress/Progress.css +3 -3
- package/src/ProgressBar/ProgressBar.css +4 -4
- package/src/PromoCard/PromoCard.css +42 -28
- package/src/PromoCard/PromoCard.less +32 -24
- package/src/Prompt/ActionPrompt/ActionPrompt.css +9 -9
- package/src/Prompt/CriticalBanner/CriticalBanner.css +23 -23
- package/src/Prompt/InfoPrompt/InfoPrompt.css +15 -15
- package/src/Prompt/InlinePrompt/InlinePrompt.css +6 -5
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.css +8 -10
- package/src/RadioGroup/RadioGroup.css +1 -1
- package/src/Section/Section.css +6 -6
- package/src/SegmentedControl/SegmentedControl.css +15 -18
- package/src/SlidingPanel/SlidingPanel.css +40 -9
- package/src/SlidingPanel/SlidingPanel.less +4 -4
- package/src/Snackbar/Snackbar.css +35 -21
- package/src/Snackbar/Snackbar.less +9 -3
- package/src/Stepper/Stepper.css +15 -9
- package/src/Stepper/Stepper.less +1 -1
- package/src/Sticky/Sticky.css +2 -2
- package/src/Sticky/Sticky.less +4 -1
- package/src/Switch/Switch.css +7 -5
- package/src/Table/Table.css +57 -60
- package/src/Tabs/Tabs.css +14 -18
- package/src/Tabs/Tabs.less +1 -0
- package/src/Tile/Tile.css +12 -12
- package/src/Tooltip/Tooltip.css +2 -2
- package/src/Typeahead/Typeahead.css +52 -40
- package/src/Typeahead/Typeahead.less +3 -2
- package/src/Upload/Upload.css +10 -11
- package/src/UploadInput/UploadButton/UploadButton.css +19 -20
- package/src/UploadInput/UploadInput.css +4 -4
- package/src/UploadInput/UploadItem/UploadItem.css +44 -45
- package/src/_deprecated/ActionButton/ActionButton.css +6 -8
- package/src/_deprecated/Alert/Alert.css +2 -2
- package/src/_deprecated/Avatar/Avatar.css +65 -65
- package/src/_deprecated/Avatar/Avatar.less +1 -0
- package/src/_deprecated/Badge/Badge.css +12 -8
- package/src/_deprecated/Badge/Badge.less +13 -13
- package/src/_deprecated/Card/Card.css +18 -27
- package/src/_deprecated/Card/Card.less +2 -1
- package/src/_deprecated/CriticalBanner/CriticalCommsBanner.css +7 -7
- package/src/_deprecated/LegacyListItem/LegacyListItem.css +1 -1
- package/src/_deprecated/NavigationOption/NavigationOption.css +19 -6
- package/src/_deprecated/NavigationOption/NavigationOption.less +4 -3
- package/src/_deprecated/NavigationOptionsList/NavigationOptionsList.css +8 -3
- package/src/_deprecated/NavigationOptionsList/NavigationOptionsList.less +3 -1
- package/src/_deprecated/OverlayHeader/OverlayHeader.css +6 -7
- package/src/_deprecated/Select/Select.css +104 -57
- package/src/_deprecated/Select/Select.less +11 -10
- package/src/_deprecated/Summary/Summary.css +30 -19
- package/src/_deprecated/Summary/Summary.less +8 -1
- package/src/common/BaseCard/BaseCard.css +7 -3
- package/src/common/BaseCard/BaseCard.less +5 -0
- package/src/common/BottomSheet/BottomSheet.css +18 -30
- package/src/common/Circle/Circle.css +10 -10
- package/src/common/CloseButton/CloseButton.css +36 -36
- package/src/common/LiveRegion/LiveRegion.css +1 -1
- package/src/common/Option/Option.css +44 -42
- package/src/common/Option/Option.less +10 -8
- package/src/common/Panel/Panel.css +7 -7
- package/src/i18n/en.json +4 -0
- package/src/index.ts +3 -2
- package/src/main.css +8798 -4478
- package/src/styles/less/accordion.css +52 -24
- package/src/styles/less/alerts.css +124 -56
- package/src/styles/less/badge.css +30 -20
- package/src/styles/less/breadcrumbs.css +4 -6
- package/src/styles/less/button-groups.css +258 -114
- package/src/styles/less/buttons.css +94 -49
- package/src/styles/less/buttons.less +10 -2
- package/src/styles/less/chevron.css +6 -0
- package/src/styles/less/circles.css +76 -38
- package/src/styles/less/close.css +4 -1
- package/src/styles/less/column-layout.css +59 -37
- package/src/styles/less/currency-flags.css +17 -4
- package/src/styles/less/decision.css +12 -14
- package/src/styles/less/dropdowns.css +209 -58
- package/src/styles/less/droppable.css +38 -43
- package/src/styles/less/flex.css +136 -40
- package/src/styles/less/footer.css +14 -15
- package/src/styles/less/forms/bootstrap-forms.css +348 -178
- package/src/styles/less/forms/checkbox-radio.css +56 -29
- package/src/styles/less/grid.css +1434 -381
- package/src/styles/less/input-groups.css +546 -252
- package/src/styles/less/link-callout.css +8 -2
- package/src/styles/less/list-group.css +92 -57
- package/src/styles/less/loaders.css +11 -11
- package/src/styles/less/media.css +34 -10
- package/src/styles/less/mixins/_logical-properties.less +2 -2
- package/src/styles/less/mixins/_physical-properties.less +5 -77
- package/src/styles/less/modals.css +59 -49
- package/src/styles/less/navbar.css +811 -371
- package/src/styles/less/navs.css +124 -59
- package/src/styles/less/neptune-social-media.css +44 -4
- package/src/styles/less/neptune-social-media.less +18 -4
- package/src/styles/less/neptune.css +7118 -3155
- package/src/styles/less/panels.css +243 -143
- package/src/styles/less/popovers.css +295 -114
- package/src/styles/less/process.css +77 -64
- package/src/styles/less/progress-bars.css +21 -11
- package/src/styles/less/progress-bars.less +6 -1
- package/src/styles/less/select.css +52 -20
- package/src/styles/less/sequences.css +219 -99
- package/src/styles/less/table.css +43 -48
- package/src/styles/less/tick.css +10 -10
- package/src/styles/less/tooltip.css +82 -49
- package/src/styles/less/utilities.css +40 -12
- package/src/styles/less/wells.css +16 -16
- package/build/Calendar/tableLink/TableLink.js +0 -61
- package/build/Calendar/tableLink/TableLink.js.map +0 -1
- package/build/Calendar/tableLink/TableLink.mjs +0 -57
- package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
- package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
- package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
- package/src/Calendar/tableLink/TableLink.tsx +0 -77
- /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
- /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
|
@@ -2,10 +2,11 @@ import { formatDate } from '@transferwise/formatting';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
|
|
4
4
|
import { getFocusableTime } from '../../GetFocusableTime/GetFocusableTime';
|
|
5
|
-
import TableLink from '../../
|
|
5
|
+
import TableLink from '../../TableLink';
|
|
6
6
|
|
|
7
7
|
interface MonthCalendarTableProps {
|
|
8
8
|
selectedDate: Date | null;
|
|
9
|
+
focusedDate?: Date | null;
|
|
9
10
|
min: Date | null;
|
|
10
11
|
max: Date | null;
|
|
11
12
|
viewYear: number;
|
|
@@ -19,6 +20,7 @@ const MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };
|
|
|
19
20
|
|
|
20
21
|
const MonthCalendarTable = ({
|
|
21
22
|
selectedDate,
|
|
23
|
+
focusedDate,
|
|
22
24
|
min,
|
|
23
25
|
max,
|
|
24
26
|
viewYear,
|
|
@@ -34,7 +36,8 @@ const MonthCalendarTable = ({
|
|
|
34
36
|
type="month"
|
|
35
37
|
title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}
|
|
36
38
|
active={isActive(month)}
|
|
37
|
-
|
|
39
|
+
outOfRange={isDisabled(month)}
|
|
40
|
+
disabled={false}
|
|
38
41
|
today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}
|
|
39
42
|
autofocus={autofocusMonth === month}
|
|
40
43
|
onClick={onSelect}
|
|
@@ -46,6 +49,10 @@ const MonthCalendarTable = ({
|
|
|
46
49
|
return !!(month === selectedDate?.getMonth() && viewYear === selectedDate?.getFullYear());
|
|
47
50
|
};
|
|
48
51
|
|
|
52
|
+
const isFocused = (month: number) => {
|
|
53
|
+
return !!(month === focusedDate?.getMonth() && viewYear === focusedDate?.getFullYear());
|
|
54
|
+
};
|
|
55
|
+
|
|
49
56
|
const isThisMonth = (month: number) => {
|
|
50
57
|
return viewYear === new Date().getFullYear() && month === new Date().getMonth();
|
|
51
58
|
};
|
|
@@ -60,7 +67,12 @@ const MonthCalendarTable = ({
|
|
|
60
67
|
|
|
61
68
|
const autofocusMonth = (() => {
|
|
62
69
|
const months = Array.from({ length: ROWS * COLS }, (_, index) => index);
|
|
63
|
-
return getFocusableTime({
|
|
70
|
+
return getFocusableTime({
|
|
71
|
+
isActive: isFocused,
|
|
72
|
+
isNow: isThisMonth,
|
|
73
|
+
isDisabled,
|
|
74
|
+
timeSpan: months,
|
|
75
|
+
});
|
|
64
76
|
})();
|
|
65
77
|
|
|
66
78
|
return (
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
.wds-Calendar__option--day,
|
|
2
|
+
.wds-Calendar__option--month,
|
|
3
|
+
.wds-Calendar__option--year {
|
|
4
|
+
width: 100%;
|
|
5
|
+
padding: 4px 0;
|
|
6
|
+
padding: var(--size-4) 0;
|
|
7
|
+
border: transparent;
|
|
8
|
+
border-radius: 10px;
|
|
9
|
+
border-radius: var(--radius-small);
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
font-weight: var(--font-weight-semi-bold);
|
|
13
|
+
color: #37517e;
|
|
14
|
+
color: var(--color-content-primary);
|
|
15
|
+
}
|
|
16
|
+
@media (max-width: 320px) {
|
|
17
|
+
.wds-Calendar__option--day,
|
|
18
|
+
.wds-Calendar__option--month,
|
|
19
|
+
.wds-Calendar__option--year {
|
|
20
|
+
padding: 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.wds-Calendar__option--day:focus,
|
|
24
|
+
.wds-Calendar__option--month:focus,
|
|
25
|
+
.wds-Calendar__option--year:focus {
|
|
26
|
+
background-color: var(--color-background-screen-hover);
|
|
27
|
+
}
|
|
28
|
+
.wds-Calendar__option--day.disabled,
|
|
29
|
+
.wds-Calendar__option--month.disabled,
|
|
30
|
+
.wds-Calendar__option--year.disabled,
|
|
31
|
+
.wds-Calendar__option--day[aria-disabled="true"],
|
|
32
|
+
.wds-Calendar__option--month[aria-disabled="true"],
|
|
33
|
+
.wds-Calendar__option--year[aria-disabled="true"] {
|
|
34
|
+
--ring-outline-color: var(--color-sentiment-content-primary);
|
|
35
|
+
color: #768e9c;
|
|
36
|
+
color: var(--color-content-tertiary);
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
.wds-Calendar__option--day.disabled:hover,
|
|
40
|
+
.wds-Calendar__option--month.disabled:hover,
|
|
41
|
+
.wds-Calendar__option--year.disabled:hover,
|
|
42
|
+
.wds-Calendar__option--day[aria-disabled="true"]:hover,
|
|
43
|
+
.wds-Calendar__option--month[aria-disabled="true"]:hover,
|
|
44
|
+
.wds-Calendar__option--year[aria-disabled="true"]:hover,
|
|
45
|
+
.wds-Calendar__option--day.disabled:focus,
|
|
46
|
+
.wds-Calendar__option--month.disabled:focus,
|
|
47
|
+
.wds-Calendar__option--year.disabled:focus,
|
|
48
|
+
.wds-Calendar__option--day[aria-disabled="true"]:focus,
|
|
49
|
+
.wds-Calendar__option--month[aria-disabled="true"]:focus,
|
|
50
|
+
.wds-Calendar__option--year[aria-disabled="true"]:focus {
|
|
51
|
+
filter: initial;
|
|
52
|
+
opacity: 1;
|
|
53
|
+
opacity: initial;
|
|
54
|
+
background-color: var(--color-sentiment-background-surface);
|
|
55
|
+
color: var(--color-sentiment-content-primary);
|
|
56
|
+
}
|
|
57
|
+
.wds-Calendar__option--day.disabled.active,
|
|
58
|
+
.wds-Calendar__option--month.disabled.active,
|
|
59
|
+
.wds-Calendar__option--year.disabled.active,
|
|
60
|
+
.wds-Calendar__option--day[aria-disabled="true"].active,
|
|
61
|
+
.wds-Calendar__option--month[aria-disabled="true"].active,
|
|
62
|
+
.wds-Calendar__option--year[aria-disabled="true"].active,
|
|
63
|
+
.wds-Calendar__option--day.disabled.active:hover,
|
|
64
|
+
.wds-Calendar__option--month.disabled.active:hover,
|
|
65
|
+
.wds-Calendar__option--year.disabled.active:hover,
|
|
66
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:hover,
|
|
67
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:hover,
|
|
68
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:hover,
|
|
69
|
+
.wds-Calendar__option--day.disabled.active:active,
|
|
70
|
+
.wds-Calendar__option--month.disabled.active:active,
|
|
71
|
+
.wds-Calendar__option--year.disabled.active:active,
|
|
72
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:active,
|
|
73
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:active,
|
|
74
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:active,
|
|
75
|
+
.wds-Calendar__option--day.disabled.active:focus,
|
|
76
|
+
.wds-Calendar__option--month.disabled.active:focus,
|
|
77
|
+
.wds-Calendar__option--year.disabled.active:focus,
|
|
78
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:focus,
|
|
79
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:focus,
|
|
80
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:focus {
|
|
81
|
+
filter: initial;
|
|
82
|
+
opacity: 1;
|
|
83
|
+
opacity: initial;
|
|
84
|
+
background-color: var(--color-sentiment-interactive-primary);
|
|
85
|
+
color: var(--color-sentiment-interactive-secondary);
|
|
86
|
+
}
|
|
87
|
+
.wds-Calendar__option--day.disabled.today,
|
|
88
|
+
.wds-Calendar__option--month.disabled.today,
|
|
89
|
+
.wds-Calendar__option--year.disabled.today,
|
|
90
|
+
.wds-Calendar__option--day[aria-disabled="true"].today,
|
|
91
|
+
.wds-Calendar__option--month[aria-disabled="true"].today,
|
|
92
|
+
.wds-Calendar__option--year[aria-disabled="true"].today {
|
|
93
|
+
text-decoration-color: #768e9c;
|
|
94
|
+
text-decoration-color: var(--color-content-tertiary);
|
|
95
|
+
}
|
|
96
|
+
.wds-Calendar__option--day {
|
|
97
|
+
height: 40px;
|
|
98
|
+
height: var(--size-40);
|
|
99
|
+
border-radius: 9999px;
|
|
100
|
+
border-radius: var(--radius-full);
|
|
101
|
+
line-height: 40px;
|
|
102
|
+
line-height: var(--size-40);
|
|
103
|
+
width: 40px;
|
|
104
|
+
width: var(--size-40);
|
|
105
|
+
padding: 0;
|
|
106
|
+
display: inline-flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
}
|
|
110
|
+
.wds-Calendar__option--day.today {
|
|
111
|
+
-webkit-text-decoration: underline;
|
|
112
|
+
text-decoration: underline;
|
|
113
|
+
text-decoration-thickness: 2px;
|
|
114
|
+
text-underline-offset: 4px;
|
|
115
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@import (reference) "./../../styles/variables/neptune-tokens.less";
|
|
2
|
+
|
|
3
|
+
.wds-Calendar__option--day,
|
|
4
|
+
.wds-Calendar__option--month,
|
|
5
|
+
.wds-Calendar__option--year {
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: var(--size-4) 0;
|
|
8
|
+
@media (--screen-400-zoom) {
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
border: transparent;
|
|
12
|
+
border-radius: var(--radius-small);
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
font-weight: var(--font-weight-semi-bold);
|
|
15
|
+
color: var(--color-content-primary);
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
background-color: var(--color-background-screen-hover);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.disabled,
|
|
22
|
+
&[aria-disabled="true"] {
|
|
23
|
+
--ring-outline-color: var(--color-sentiment-content-primary);
|
|
24
|
+
color: var(--color-content-tertiary);
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
|
|
27
|
+
&:hover,
|
|
28
|
+
&:focus {
|
|
29
|
+
filter: unset;
|
|
30
|
+
opacity: unset;
|
|
31
|
+
background-color: var(--color-sentiment-background-surface);
|
|
32
|
+
color: var(--color-sentiment-content-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.active {
|
|
36
|
+
&,
|
|
37
|
+
&:hover,
|
|
38
|
+
&:active,
|
|
39
|
+
&:focus {
|
|
40
|
+
filter: unset;
|
|
41
|
+
opacity: unset;
|
|
42
|
+
background-color: var(--color-sentiment-interactive-primary);
|
|
43
|
+
color: var(--color-sentiment-interactive-secondary);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.today {
|
|
48
|
+
text-decoration-color: var(--color-content-tertiary);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.wds-Calendar__option--day {
|
|
54
|
+
height: var(--size-40);
|
|
55
|
+
border-radius: var(--radius-full);
|
|
56
|
+
line-height: var(--size-40);
|
|
57
|
+
width: var(--size-40);
|
|
58
|
+
padding: 0;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
|
|
63
|
+
&.today {
|
|
64
|
+
text-decoration: underline;
|
|
65
|
+
text-decoration-thickness: 2px;
|
|
66
|
+
text-underline-offset: 4px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import messages from '../Calendar.messages';
|
|
6
|
+
import SentimentSurface from '../../SentimentSurface';
|
|
7
|
+
|
|
8
|
+
interface TableLinkProps {
|
|
9
|
+
item: number;
|
|
10
|
+
type: 'day' | 'month' | 'year';
|
|
11
|
+
title?: string;
|
|
12
|
+
longTitle?: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
outOfRange: boolean;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
today: boolean;
|
|
17
|
+
autofocus?: boolean;
|
|
18
|
+
disabledReasonId?: string;
|
|
19
|
+
announceReasonOnFocus?: boolean;
|
|
20
|
+
onClick: (item: number) => void;
|
|
21
|
+
onFocus?: (item: number) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const TableLink = ({
|
|
25
|
+
item,
|
|
26
|
+
type,
|
|
27
|
+
title,
|
|
28
|
+
longTitle,
|
|
29
|
+
active,
|
|
30
|
+
outOfRange,
|
|
31
|
+
disabled,
|
|
32
|
+
today,
|
|
33
|
+
autofocus,
|
|
34
|
+
disabledReasonId,
|
|
35
|
+
announceReasonOnFocus,
|
|
36
|
+
onClick,
|
|
37
|
+
onFocus,
|
|
38
|
+
}: TableLinkProps) => {
|
|
39
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
40
|
+
// Distinguishes keyboard-driven .focus() (arrow keys) from screen-reader-initiated focus (VoiceOver cursor).
|
|
41
|
+
// Without this, the onFocus callback would re-trigger state updates that conflict with the already-committed focusedDate.
|
|
42
|
+
const isProgrammaticFocus = useRef(false);
|
|
43
|
+
const intl = useIntl();
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (autofocus) {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
isProgrammaticFocus.current = true;
|
|
49
|
+
buttonRef.current?.focus();
|
|
50
|
+
isProgrammaticFocus.current = false;
|
|
51
|
+
}, 0);
|
|
52
|
+
}
|
|
53
|
+
}, [autofocus]);
|
|
54
|
+
|
|
55
|
+
const isUnavailable = outOfRange || disabled;
|
|
56
|
+
|
|
57
|
+
const onCalendarClick = (event: React.MouseEvent) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
if (!isUnavailable) {
|
|
60
|
+
onClick(item);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onCalendarFocus = () => {
|
|
65
|
+
if (!isProgrammaticFocus.current) {
|
|
66
|
+
onFocus?.(item);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const calculateAriaLabel = () => {
|
|
71
|
+
let label = longTitle || title || '';
|
|
72
|
+
if (active) {
|
|
73
|
+
label += `, ${intl.formatMessage(messages.selected)} ${intl.formatMessage(messages[type])}`;
|
|
74
|
+
}
|
|
75
|
+
if (isUnavailable) {
|
|
76
|
+
label += `, ${intl.formatMessage(messages.notAvailable)}`;
|
|
77
|
+
}
|
|
78
|
+
return label;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<SentimentSurface
|
|
83
|
+
// @ts-expect-error - Generic forwardRef limitation in SentimentSurface
|
|
84
|
+
ref={buttonRef}
|
|
85
|
+
as="button"
|
|
86
|
+
data-calendar-cell
|
|
87
|
+
aria-describedby={
|
|
88
|
+
isUnavailable || (autofocus && announceReasonOnFocus) ? disabledReasonId : undefined
|
|
89
|
+
}
|
|
90
|
+
aria-disabled={isUnavailable || undefined}
|
|
91
|
+
aria-label={calculateAriaLabel()}
|
|
92
|
+
aria-pressed={active}
|
|
93
|
+
className={clsx(
|
|
94
|
+
`wds-Calendar__option--${type}`,
|
|
95
|
+
`tw-date-lookup-${type}-option np-text-body-default-bold`,
|
|
96
|
+
{ active: !!active },
|
|
97
|
+
{ today: !!today },
|
|
98
|
+
{ disabled: !!isUnavailable },
|
|
99
|
+
)}
|
|
100
|
+
hasBaseStyles={false}
|
|
101
|
+
sentiment={isUnavailable ? 'negative' : 'neutral'}
|
|
102
|
+
tabIndex={autofocus ? 0 : -1}
|
|
103
|
+
type="button"
|
|
104
|
+
onClick={onCalendarClick}
|
|
105
|
+
onFocus={onCalendarFocus}
|
|
106
|
+
>
|
|
107
|
+
{title || item}
|
|
108
|
+
</SentimentSurface>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default TableLink;
|
|
@@ -2,10 +2,11 @@ import { formatDate } from '@transferwise/formatting';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
|
|
4
4
|
import { getFocusableTime } from '../../GetFocusableTime/GetFocusableTime';
|
|
5
|
-
import TableLink from '../../
|
|
5
|
+
import TableLink from '../../TableLink';
|
|
6
6
|
|
|
7
7
|
interface YearCalendarTableProps {
|
|
8
8
|
selectedDate: Date | null;
|
|
9
|
+
focusedDate?: Date | null;
|
|
9
10
|
min: Date | null;
|
|
10
11
|
max: Date | null;
|
|
11
12
|
viewYear: number;
|
|
@@ -19,6 +20,7 @@ const YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };
|
|
|
19
20
|
|
|
20
21
|
const YearCalendarTable = ({
|
|
21
22
|
selectedDate,
|
|
23
|
+
focusedDate,
|
|
22
24
|
min,
|
|
23
25
|
max,
|
|
24
26
|
viewYear,
|
|
@@ -34,7 +36,8 @@ const YearCalendarTable = ({
|
|
|
34
36
|
type="year"
|
|
35
37
|
title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}
|
|
36
38
|
active={isActive(year)}
|
|
37
|
-
|
|
39
|
+
outOfRange={isDisabled(year)}
|
|
40
|
+
disabled={false}
|
|
38
41
|
today={isThisYear(year)}
|
|
39
42
|
autofocus={autofocusYear === year}
|
|
40
43
|
onClick={onSelect}
|
|
@@ -46,6 +49,10 @@ const YearCalendarTable = ({
|
|
|
46
49
|
return !!(year === selectedDate?.getFullYear());
|
|
47
50
|
};
|
|
48
51
|
|
|
52
|
+
const isFocused = (year: number) => {
|
|
53
|
+
return !!(year === focusedDate?.getFullYear());
|
|
54
|
+
};
|
|
55
|
+
|
|
49
56
|
const isThisYear = (year: number) => {
|
|
50
57
|
return year === new Date().getFullYear();
|
|
51
58
|
};
|
|
@@ -56,7 +63,12 @@ const YearCalendarTable = ({
|
|
|
56
63
|
|
|
57
64
|
const autofocusYear = (() => {
|
|
58
65
|
const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);
|
|
59
|
-
return getFocusableTime({
|
|
66
|
+
return getFocusableTime({
|
|
67
|
+
isActive: isFocused,
|
|
68
|
+
isNow: isThisYear,
|
|
69
|
+
isDisabled,
|
|
70
|
+
timeSpan: years,
|
|
71
|
+
});
|
|
60
72
|
})();
|
|
61
73
|
|
|
62
74
|
return (
|
|
@@ -8,6 +8,7 @@ import YearCalendarTable from './Table';
|
|
|
8
8
|
|
|
9
9
|
interface YearCalendarProps extends WrappedComponentProps {
|
|
10
10
|
selectedDate: Date | null;
|
|
11
|
+
focusedDate?: Date | null;
|
|
11
12
|
min: Date | null;
|
|
12
13
|
max: Date | null;
|
|
13
14
|
viewYear: number;
|
|
@@ -33,21 +34,29 @@ class YearCalendar extends PureComponent<YearCalendarProps> {
|
|
|
33
34
|
render() {
|
|
34
35
|
const {
|
|
35
36
|
selectedDate,
|
|
37
|
+
focusedDate,
|
|
36
38
|
min,
|
|
37
39
|
max,
|
|
38
40
|
viewYear,
|
|
39
41
|
placeholder,
|
|
40
42
|
intl: { formatMessage },
|
|
41
43
|
} = this.props;
|
|
44
|
+
const startYear = viewYear - (viewYear % 20);
|
|
45
|
+
const isPreviousDisabled = !!(min && startYear - 1 < min.getFullYear());
|
|
46
|
+
const isNextDisabled = !!(max && startYear + 20 > max.getFullYear());
|
|
47
|
+
|
|
42
48
|
return (
|
|
43
49
|
<>
|
|
44
50
|
<DateHeader
|
|
45
51
|
dateMode={formatMessage(messages.twentyYears)}
|
|
52
|
+
isPreviousDisabled={isPreviousDisabled}
|
|
53
|
+
isNextDisabled={isNextDisabled}
|
|
46
54
|
onPreviousClick={this.selectPreviousYears}
|
|
47
55
|
onNextClick={this.selectNextYears}
|
|
48
56
|
/>
|
|
49
57
|
<YearCalendarTable
|
|
50
58
|
selectedDate={selectedDate}
|
|
59
|
+
focusedDate={focusedDate}
|
|
51
60
|
min={min}
|
|
52
61
|
max={max}
|
|
53
62
|
viewYear={viewYear}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { hasDisabledDatesInMonth } from './hasDisabledDatesInMonth';
|
|
2
|
+
import type { DisabledRules } from '../../Calendar.types';
|
|
3
|
+
|
|
4
|
+
describe('hasDisabledDatesInMonth', () => {
|
|
5
|
+
describe('weekdays', () => {
|
|
6
|
+
it('returns true when weekday rules exist (every month has all weekdays)', () => {
|
|
7
|
+
const rules: DisabledRules = { weekdays: ['sat', 'sun'], reason: 'Closed' };
|
|
8
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules)).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('returns true for any month when weekday rules exist', () => {
|
|
12
|
+
const rules: DisabledRules = { weekdays: ['mon'], reason: 'Closed' };
|
|
13
|
+
expect(hasDisabledDatesInMonth(0, 2024, rules)).toBe(true);
|
|
14
|
+
expect(hasDisabledDatesInMonth(11, 2024, rules)).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('returns false when weekdays array is empty', () => {
|
|
18
|
+
const rules: DisabledRules = { weekdays: [], reason: 'None' };
|
|
19
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules)).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('specific dates', () => {
|
|
24
|
+
const rules: DisabledRules = {
|
|
25
|
+
dates: [new Date(2024, 6, 11), new Date(2024, 6, 25), new Date(2025, 0, 1)],
|
|
26
|
+
reason: 'Bank holidays',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
it('returns true when month contains a disabled date', () => {
|
|
30
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules)).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('returns false when month has no disabled dates', () => {
|
|
34
|
+
expect(hasDisabledDatesInMonth(5, 2024, rules)).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('returns true for another year with disabled date', () => {
|
|
38
|
+
expect(hasDisabledDatesInMonth(0, 2025, rules)).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('ranges', () => {
|
|
43
|
+
const rules: DisabledRules = {
|
|
44
|
+
ranges: [{ start: new Date(2024, 2, 29), end: new Date(2024, 3, 3) }],
|
|
45
|
+
reason: 'Maintenance',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
it('returns true when range starts in the month', () => {
|
|
49
|
+
expect(hasDisabledDatesInMonth(2, 2024, rules)).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('returns true when range ends in the month', () => {
|
|
53
|
+
expect(hasDisabledDatesInMonth(3, 2024, rules)).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('returns true when range spans the entire month', () => {
|
|
57
|
+
const spanRules: DisabledRules = {
|
|
58
|
+
ranges: [{ start: new Date(2024, 0, 1), end: new Date(2024, 11, 31) }],
|
|
59
|
+
reason: 'Year-long',
|
|
60
|
+
};
|
|
61
|
+
expect(hasDisabledDatesInMonth(6, 2024, spanRules)).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('returns false when range does not overlap the month', () => {
|
|
65
|
+
expect(hasDisabledDatesInMonth(4, 2024, rules)).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('min/max constraints', () => {
|
|
70
|
+
it('returns false when all disabled dates in month are outside min/max', () => {
|
|
71
|
+
const rules: DisabledRules = {
|
|
72
|
+
dates: [new Date(2024, 6, 1), new Date(2024, 6, 2)],
|
|
73
|
+
reason: 'Early',
|
|
74
|
+
};
|
|
75
|
+
const min = new Date(2024, 6, 10);
|
|
76
|
+
const max = new Date(2024, 6, 31);
|
|
77
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules, min, max)).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('returns true when weekdays exist regardless of min/max', () => {
|
|
81
|
+
const rules: DisabledRules = { weekdays: ['sat'], reason: 'Closed' };
|
|
82
|
+
const min = new Date(2024, 6, 10);
|
|
83
|
+
const max = new Date(2024, 6, 20);
|
|
84
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules, min, max)).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('no rules', () => {
|
|
89
|
+
it('returns false when disabledRules is undefined', () => {
|
|
90
|
+
expect(hasDisabledDatesInMonth(6, 2024, undefined)).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('returns false when only reason is provided', () => {
|
|
94
|
+
const rules: DisabledRules = { reason: 'Reason only' };
|
|
95
|
+
expect(hasDisabledDatesInMonth(6, 2024, rules)).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DisabledRules } from '../../Calendar.types';
|
|
2
|
+
|
|
3
|
+
export function hasDisabledDatesInMonth(
|
|
4
|
+
month: number,
|
|
5
|
+
year: number,
|
|
6
|
+
disabledRules?: DisabledRules,
|
|
7
|
+
min?: Date | null,
|
|
8
|
+
max?: Date | null,
|
|
9
|
+
): boolean {
|
|
10
|
+
if (!disabledRules) return false;
|
|
11
|
+
|
|
12
|
+
if (disabledRules.weekdays?.length) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const monthStart = new Date(year, month, 1);
|
|
17
|
+
const monthEnd = new Date(year, month + 1, 0);
|
|
18
|
+
|
|
19
|
+
if (disabledRules.dates?.length) {
|
|
20
|
+
const hasDateInMonth = disabledRules.dates.some((date) => {
|
|
21
|
+
if (date.getFullYear() !== year || date.getMonth() !== month) return false;
|
|
22
|
+
if (min && date < min) return false;
|
|
23
|
+
if (max && date > max) return false;
|
|
24
|
+
return true;
|
|
25
|
+
});
|
|
26
|
+
if (hasDateInMonth) return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (disabledRules.ranges?.length) {
|
|
30
|
+
const hasOverlap = disabledRules.ranges.some((range) => {
|
|
31
|
+
const rangeStart = new Date(
|
|
32
|
+
range.start.getFullYear(),
|
|
33
|
+
range.start.getMonth(),
|
|
34
|
+
range.start.getDate(),
|
|
35
|
+
);
|
|
36
|
+
const rangeEnd = new Date(range.end.getFullYear(), range.end.getMonth(), range.end.getDate());
|
|
37
|
+
if (max && rangeStart > max) return false;
|
|
38
|
+
if (min && rangeEnd < min) return false;
|
|
39
|
+
return rangeStart <= monthEnd && rangeEnd >= monthStart;
|
|
40
|
+
});
|
|
41
|
+
if (hasOverlap) return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return false;
|
|
45
|
+
}
|