@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
|
@@ -110,24 +110,13 @@ describe('DateLookup', () => {
|
|
|
110
110
|
['{ArrowRight}', +1],
|
|
111
111
|
['{ArrowUp}', -7],
|
|
112
112
|
['{ArrowDown}', +7],
|
|
113
|
-
])("handles '%s' to step %d day(s)", async (text: string
|
|
113
|
+
])("handles '%s' to step %d day(s) without changing value", async (text: string) => {
|
|
114
114
|
const handleChange = jest.fn();
|
|
115
115
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
116
116
|
|
|
117
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
118
|
-
|
|
119
117
|
await user.keyboard(text);
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
value.setDate(initialValue.getDate() + step);
|
|
123
|
-
expect(handleChange).toHaveBeenCalledWith(value);
|
|
124
|
-
|
|
125
|
-
await user.keyboard('{Escape}');
|
|
126
|
-
await act(async () => {
|
|
127
|
-
await jest.runOnlyPendingTimersAsync();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
expect(handleChange).toHaveBeenCalledWith(initialValue);
|
|
119
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
131
120
|
});
|
|
132
121
|
});
|
|
133
122
|
|
|
@@ -137,7 +126,7 @@ describe('DateLookup', () => {
|
|
|
137
126
|
['{ArrowRight}', +1],
|
|
138
127
|
['{ArrowUp}', -4],
|
|
139
128
|
['{ArrowDown}', +4],
|
|
140
|
-
])("handles '%s' to step %d year(s)", async (text: string
|
|
129
|
+
])("handles '%s' to step %d year(s) without changing value", async (text: string) => {
|
|
141
130
|
const handleChange = jest.fn();
|
|
142
131
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
143
132
|
|
|
@@ -146,20 +135,9 @@ describe('DateLookup', () => {
|
|
|
146
135
|
await jest.runOnlyPendingTimersAsync();
|
|
147
136
|
});
|
|
148
137
|
|
|
149
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
150
|
-
|
|
151
138
|
await user.keyboard(text);
|
|
152
139
|
|
|
153
|
-
|
|
154
|
-
value.setFullYear(initialValue.getFullYear() + step);
|
|
155
|
-
expect(handleChange).toHaveBeenCalledWith(value);
|
|
156
|
-
|
|
157
|
-
await user.keyboard('{Escape}');
|
|
158
|
-
await act(async () => {
|
|
159
|
-
await jest.runOnlyPendingTimersAsync();
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
expect(handleChange).toHaveBeenCalledWith(initialValue);
|
|
140
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
163
141
|
});
|
|
164
142
|
});
|
|
165
143
|
|
|
@@ -169,7 +147,7 @@ describe('DateLookup', () => {
|
|
|
169
147
|
['{ArrowRight}', +1],
|
|
170
148
|
['{ArrowUp}', -4],
|
|
171
149
|
['{ArrowDown}', +4],
|
|
172
|
-
])("handles '%s' to step %d month(s)", async (text: string
|
|
150
|
+
])("handles '%s' to step %d month(s) without changing value", async (text: string) => {
|
|
173
151
|
const handleChange = jest.fn();
|
|
174
152
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
175
153
|
|
|
@@ -182,20 +160,39 @@ describe('DateLookup', () => {
|
|
|
182
160
|
await jest.runOnlyPendingTimersAsync();
|
|
183
161
|
});
|
|
184
162
|
|
|
163
|
+
await user.keyboard(text);
|
|
164
|
+
|
|
185
165
|
expect(handleChange).not.toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
186
168
|
|
|
187
|
-
|
|
169
|
+
describe('focus vs selection separation', () => {
|
|
170
|
+
it('does not call onChange during arrow key navigation', async () => {
|
|
171
|
+
const handleChange = jest.fn();
|
|
172
|
+
render(<DateLookup value={new Date(2020, 0, 15)} onChange={handleChange} />);
|
|
188
173
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
expect(handleChange).
|
|
174
|
+
// Open the panel
|
|
175
|
+
await user.click(screen.getByRole('button'));
|
|
176
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
192
177
|
|
|
193
|
-
await user.keyboard('{
|
|
194
|
-
await act(async () => {
|
|
195
|
-
await jest.runOnlyPendingTimersAsync();
|
|
196
|
-
});
|
|
178
|
+
await user.keyboard('{ArrowRight}');
|
|
197
179
|
|
|
198
|
-
expect(handleChange).
|
|
180
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('calls onChange when Enter is pressed on a focused date', async () => {
|
|
184
|
+
const handleChange = jest.fn();
|
|
185
|
+
render(<DateLookup value={new Date(2020, 0, 15)} onChange={handleChange} />);
|
|
186
|
+
|
|
187
|
+
// Open the panel
|
|
188
|
+
await user.click(screen.getByRole('button'));
|
|
189
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
190
|
+
|
|
191
|
+
// Arrow to next date then confirm with Enter
|
|
192
|
+
await user.keyboard('{ArrowRight}');
|
|
193
|
+
await user.keyboard('{Enter}');
|
|
194
|
+
|
|
195
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2020, 0, 16));
|
|
199
196
|
});
|
|
200
197
|
});
|
|
201
198
|
});
|
|
@@ -229,7 +226,7 @@ describe('DateLookup (events)', () => {
|
|
|
229
226
|
const today = new Date();
|
|
230
227
|
const todayDateLabel = today.toLocaleDateString('en-GB', {
|
|
231
228
|
day: 'numeric',
|
|
232
|
-
month: '
|
|
229
|
+
month: 'long',
|
|
233
230
|
year: 'numeric',
|
|
234
231
|
});
|
|
235
232
|
const expectedHeaderText = today.toLocaleDateString('en-GB', {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { createRef, PureComponent, KeyboardEvent } from 'react';
|
|
3
3
|
import Calendar from '../Calendar';
|
|
4
|
+
import type { DateChangeMeta, DisabledRules, OnDateSelectParams } from '../Calendar/Calendar.types';
|
|
4
5
|
import {
|
|
5
6
|
Size,
|
|
6
7
|
MonthFormat,
|
|
@@ -15,19 +16,37 @@ import { OverlayIdProvider } from '../Provider/overlay/OverlayIdProvider';
|
|
|
15
16
|
import DateTrigger from './DateTrigger';
|
|
16
17
|
|
|
17
18
|
export interface DateLookupProps {
|
|
18
|
-
|
|
19
|
+
/** The currently selected date, or `null` for no selection. */
|
|
19
20
|
value: Date | null;
|
|
21
|
+
/** Called when an enabled date is confirmed. Receives `null` when the value is cleared. */
|
|
22
|
+
onChange: (date: Date | null) => void;
|
|
23
|
+
/** HTML `id` applied to the trigger button, used for label association. */
|
|
24
|
+
id?: string;
|
|
25
|
+
/** Earliest selectable date (inclusive). Dates before this are interactive but not selectable, and show a boundary prompt. */
|
|
20
26
|
min?: Date | null;
|
|
27
|
+
/** Latest selectable date (inclusive). Dates after this are interactive but not selectable, and show a boundary prompt. */
|
|
21
28
|
max?: Date | null;
|
|
29
|
+
/** Size of the trigger input. Defaults to `'md'`. */
|
|
22
30
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
23
|
-
|
|
31
|
+
/** Label text rendered above the trigger input. */
|
|
24
32
|
label?: string;
|
|
33
|
+
/** ID of an external element that labels the trigger, for use inside custom label contexts. */
|
|
25
34
|
'aria-labelledby'?: string;
|
|
35
|
+
/** Placeholder text shown in the trigger when no date is selected. */
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
/** Month name format in the calendar header. Defaults to `'long'` (e.g. "January"). */
|
|
26
38
|
monthFormat?: `${MonthFormat}`;
|
|
39
|
+
/** When `true`, the trigger and calendar are non-interactive. */
|
|
27
40
|
disabled?: boolean;
|
|
41
|
+
/** When `true`, a clear button is shown in the trigger to reset the value to `null`. */
|
|
28
42
|
clearable?: boolean;
|
|
29
|
-
|
|
43
|
+
/** Rules for disabling specific weekdays, individual dates, or date ranges. The required `reason` is shown in an inline prompt and linked to disabled cells via `aria-describedby` for screen reader accessibility. */
|
|
44
|
+
disabledRules?: DisabledRules;
|
|
45
|
+
/** Called whenever any date is focused or clicked, including disabled and out-of-range dates. `isEnabled` is `false` when the date is not selectable. */
|
|
46
|
+
onDateSelect?: (params: OnDateSelectParams) => void;
|
|
47
|
+
/** Called when the calendar panel opens. */
|
|
30
48
|
onFocus?: () => void;
|
|
49
|
+
/** Called when the calendar panel closes. */
|
|
31
50
|
onBlur?: () => void;
|
|
32
51
|
}
|
|
33
52
|
|
|
@@ -128,7 +147,15 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
128
147
|
}
|
|
129
148
|
};
|
|
130
149
|
|
|
131
|
-
handleDateChange = (date: Date | null) => {
|
|
150
|
+
handleDateChange = (date: Date | null, meta: DateChangeMeta) => {
|
|
151
|
+
const { onDateSelect } = this.props;
|
|
152
|
+
if (date && onDateSelect) {
|
|
153
|
+
onDateSelect({ date, isEnabled: meta.isEnabled });
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
handleDateSelect = (date: Date | null) => {
|
|
158
|
+
if (!date) return;
|
|
132
159
|
this.setState(
|
|
133
160
|
(state) => {
|
|
134
161
|
const originalDate = state.originalDate ?? this.props.value;
|
|
@@ -136,18 +163,14 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
136
163
|
},
|
|
137
164
|
() => {
|
|
138
165
|
this.props.onChange(date);
|
|
166
|
+
this.close();
|
|
167
|
+
this.focusOn('.btn');
|
|
139
168
|
},
|
|
140
169
|
);
|
|
141
170
|
};
|
|
142
171
|
|
|
143
|
-
handleDateSelect = (date: Date) => {
|
|
144
|
-
this.props.onChange(date);
|
|
145
|
-
this.close();
|
|
146
|
-
this.focusOn('.btn');
|
|
147
|
-
};
|
|
148
|
-
|
|
149
172
|
getCalendar = () => {
|
|
150
|
-
const { value, min, max, monthFormat, placeholder } = this.props;
|
|
173
|
+
const { value, min, max, monthFormat, placeholder, disabledRules } = this.props;
|
|
151
174
|
return (
|
|
152
175
|
<div className="p-a-1">
|
|
153
176
|
<Calendar
|
|
@@ -156,8 +179,9 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
156
179
|
max={max}
|
|
157
180
|
monthFormat={monthFormat}
|
|
158
181
|
placeholder={placeholder}
|
|
159
|
-
|
|
160
|
-
|
|
182
|
+
disabledRules={disabledRules}
|
|
183
|
+
onDateFocus={this.handleDateChange}
|
|
184
|
+
onChange={this.handleDateSelect}
|
|
161
185
|
/>
|
|
162
186
|
</div>
|
|
163
187
|
);
|
|
@@ -2,22 +2,28 @@
|
|
|
2
2
|
overflow: hidden;
|
|
3
3
|
text-overflow: ellipsis;
|
|
4
4
|
white-space: nowrap;
|
|
5
|
-
|
|
5
|
+
width: 100%;
|
|
6
6
|
}
|
|
7
7
|
.np-theme-personal .np-date-trigger {
|
|
8
|
-
padding-
|
|
9
|
-
padding-
|
|
8
|
+
padding-left: 16px;
|
|
9
|
+
padding-left: var(--size-16);
|
|
10
10
|
}
|
|
11
11
|
.clear-btn {
|
|
12
12
|
position: absolute;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
top: 8px;
|
|
14
|
+
top: var(--size-8);
|
|
15
|
+
right: 8px;
|
|
16
|
+
right: var(--size-8);
|
|
17
|
+
}
|
|
18
|
+
[dir="rtl"] .clear-btn {
|
|
19
|
+
left: 8px;
|
|
20
|
+
left: var(--size-8);
|
|
21
|
+
right: auto;
|
|
22
|
+
right: initial;
|
|
17
23
|
}
|
|
18
24
|
.clear-btn--sm {
|
|
19
|
-
|
|
25
|
+
top: 0;
|
|
20
26
|
}
|
|
21
27
|
.clear-btn--lg {
|
|
22
|
-
|
|
28
|
+
top: 20px;
|
|
23
29
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import (reference) "../../styles/variables/neptune-tokens.less";
|
|
2
|
+
@import (reference) "../../styles/less/mixins/_logical-properties.less";
|
|
2
3
|
|
|
3
4
|
.np-date-trigger {
|
|
4
5
|
overflow: hidden;
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
.clear-btn {
|
|
15
16
|
position: absolute;
|
|
16
17
|
top: var(--size-8);
|
|
17
|
-
right
|
|
18
|
+
.right(var(--size-8));
|
|
18
19
|
|
|
19
20
|
&--sm {
|
|
20
21
|
top: 0;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Forms/DateLookup/Accessibility" />
|
|
4
|
+
|
|
5
|
+
# Accessibility
|
|
6
|
+
|
|
7
|
+
DateLookup wraps the Calendar component inside a dropdown panel. It provides full keyboard accessibility for opening, navigating, selecting, and dismissing dates.
|
|
8
|
+
|
|
9
|
+
## Keyboard Support
|
|
10
|
+
|
|
11
|
+
<table>
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th>Key</th>
|
|
15
|
+
<th>Context</th>
|
|
16
|
+
<th>Action</th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody>
|
|
20
|
+
<tr>
|
|
21
|
+
<td>
|
|
22
|
+
<code>ArrowLeft/Right/Up/Down</code>
|
|
23
|
+
</td>
|
|
24
|
+
<td>Trigger focused, panel closed</td>
|
|
25
|
+
<td>Opens the panel</td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td>
|
|
29
|
+
<code>ArrowLeft/Right/Up/Down</code>
|
|
30
|
+
</td>
|
|
31
|
+
<td>Panel open</td>
|
|
32
|
+
<td>Navigates between dates (see Calendar)</td>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr>
|
|
35
|
+
<td>
|
|
36
|
+
<code>Enter</code> / <code>Space</code>
|
|
37
|
+
</td>
|
|
38
|
+
<td>Panel open, enabled date focused</td>
|
|
39
|
+
<td>Selects date, closes panel</td>
|
|
40
|
+
</tr>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>
|
|
43
|
+
<code>Enter</code> / <code>Space</code>
|
|
44
|
+
</td>
|
|
45
|
+
<td>Panel open, disabled date focused</td>
|
|
46
|
+
<td>No action (panel stays open)</td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<td>
|
|
50
|
+
<code>Escape</code>
|
|
51
|
+
</td>
|
|
52
|
+
<td>Panel open</td>
|
|
53
|
+
<td>Reverts to original value, closes panel</td>
|
|
54
|
+
</tr>
|
|
55
|
+
</tbody>
|
|
56
|
+
</table>
|
|
57
|
+
|
|
58
|
+
<br />
|
|
59
|
+
|
|
60
|
+
### Click Behaviour
|
|
61
|
+
|
|
62
|
+
- **Clicking an enabled date**: selects it, closes the panel, fires `onChange`
|
|
63
|
+
- **Clicking a disabled date**: does not select, panel stays open, focus remains in the calendar grid
|
|
64
|
+
|
|
65
|
+
## Screen Reader Announcements
|
|
66
|
+
|
|
67
|
+
DateLookup relies on the Calendar's built-in accessibility features for date announcements. See [Calendar
|
|
68
|
+
Accessibility](?path=/docs/forms-calendar-accessibility--docs) for details on how dates are labelled and described.
|
|
69
|
+
|
|
70
|
+
### Trigger Button
|
|
71
|
+
|
|
72
|
+
The trigger button announces the currently selected date (or placeholder text when no date is selected). It uses `aria-controls` to associate with the panel.
|
|
73
|
+
|
|
74
|
+
### Panel
|
|
75
|
+
|
|
76
|
+
The dropdown panel is rendered with `role="dialog"` and is connected to the trigger via `aria-controls`. When opened, focus moves into the calendar grid.
|
|
77
|
+
|
|
78
|
+
## Disabled Dates (via `disabledRules`)
|
|
79
|
+
|
|
80
|
+
When `disabledRules` is provided, disabled dates remain focusable and keyboard-navigable:
|
|
81
|
+
|
|
82
|
+
- `aria-disabled="true"` marks the cell as unavailable
|
|
83
|
+
- "not available" is appended to the aria-label
|
|
84
|
+
- `aria-describedby` links to the InlinePrompt reason text
|
|
85
|
+
- Keyboard navigation reaches disabled dates (they are not skipped)
|
|
86
|
+
- Clicking or pressing Enter on a disabled date does **not** close the panel
|
|
87
|
+
|
|
88
|
+
## Out-of-Range Dates (via `min`/`max`)
|
|
89
|
+
|
|
90
|
+
Dates outside `min`/`max` boundaries use `aria-disabled="true"` (not the native HTML `disabled` attribute). They are rendered as interactive buttons in the grid and can be clicked; the `aria-label` appends "not available". Arrow key navigation clamps at the boundary, so keyboard users cannot navigate into out-of-range cells.
|
|
91
|
+
|
|
92
|
+
This distinction is intentional: `min`/`max` defines a hard boundary, while `disabledRules` marks dates that exist but are unavailable (users can discover them and understand why via the InlinePrompt).
|
|
93
|
+
|
|
94
|
+
### InlinePrompt
|
|
95
|
+
|
|
96
|
+
An InlinePrompt renders below the day grid inside the panel when the visible month contains disabled dates. It displays the configured `disabledRules.reason` text.
|
|
97
|
+
|
|
98
|
+
The prompt is linked to disabled cells via `aria-describedby`, so screen readers announce the reason when a disabled
|
|
99
|
+
date receives focus. See [Calendar Accessibility](?path=/docs/forms-calendar-accessibility--docs) for full details on
|
|
100
|
+
the prompt's announcement behaviour.
|
|
101
|
+
|
|
102
|
+
## Consumer Callbacks
|
|
103
|
+
|
|
104
|
+
The `onDateSelect` callback fires with `{ date, isEnabled }` whenever the user navigates to or clicks on any date. Consumers can use this to:
|
|
105
|
+
|
|
106
|
+
- Display a custom message explaining why a specific date is disabled
|
|
107
|
+
- Track which dates users attempt to select
|
|
108
|
+
- Provide alternative actions for disabled dates
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react-webpack5';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
import { action } from 'storybook/actions';
|
|
3
5
|
import {
|
|
4
6
|
createSandboxStory,
|
|
5
7
|
globalScope,
|
|
6
8
|
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
9
|
+
import { storySourceWithoutNoise } from '../../../.storybook/helpers';
|
|
7
10
|
import { Size } from '../../common';
|
|
8
|
-
import DateLookup, { type DateLookupProps } from '..';
|
|
9
11
|
import Field from '../../Field';
|
|
12
|
+
import DateLookup, { type DateLookupProps } from '..';
|
|
10
13
|
|
|
11
14
|
export default {
|
|
12
15
|
component: DateLookup,
|
|
13
16
|
title: 'Forms/DateLookup',
|
|
17
|
+
args: {
|
|
18
|
+
onFocus: fn(),
|
|
19
|
+
onBlur: fn(),
|
|
20
|
+
},
|
|
14
21
|
argTypes: {
|
|
15
22
|
size: { control: 'select', options: [Size.SMALL, Size.MEDIUM, Size.LARGE] },
|
|
16
23
|
disabled: { control: 'boolean' },
|
|
@@ -34,7 +41,7 @@ thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
|
34
41
|
|
|
35
42
|
export const Sandbox = createSandboxStory({
|
|
36
43
|
code: `const App = () => {
|
|
37
|
-
const [value, setValue] = React.useState(new Date(
|
|
44
|
+
const [value, setValue] = React.useState(new Date(2024, 5, 14));
|
|
38
45
|
|
|
39
46
|
return (
|
|
40
47
|
<DateLookup
|
|
@@ -44,6 +51,11 @@ export const Sandbox = createSandboxStory({
|
|
|
44
51
|
placeholder="Choose date"
|
|
45
52
|
clearable
|
|
46
53
|
value={value}
|
|
54
|
+
disabledRules={{
|
|
55
|
+
weekdays: ['sat', 'sun'],
|
|
56
|
+
dates: [new Date(2024, 5, 19)],
|
|
57
|
+
reason: 'Weekends and holidays are unavailable.',
|
|
58
|
+
}}
|
|
47
59
|
onChange={(date) => setValue(date)}
|
|
48
60
|
/>
|
|
49
61
|
);
|
|
@@ -120,3 +132,113 @@ export const RightAligned: Story = {
|
|
|
120
132
|
);
|
|
121
133
|
},
|
|
122
134
|
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Use `disabledRules` to disable specific weekdays, individual dates, or date ranges.
|
|
138
|
+
* Disabled dates remain focusable and keyboard-navigable — clicking or focusing one
|
|
139
|
+
* keeps the panel open, fires `onDateSelect` with `isEnabled: false`, and shows a
|
|
140
|
+
* negative inline prompt with the `reason` text. `min`/`max` out-of-range dates show
|
|
141
|
+
* a built-in boundary prompt (e.g. "Please select a date between 9 December 2024 and
|
|
142
|
+
* 22 January 2025.").
|
|
143
|
+
*
|
|
144
|
+
* The `reason` field is **required for accessibility**: it renders as an InlinePrompt
|
|
145
|
+
* below the grid and is linked to every disabled cell via `aria-describedby`, so screen
|
|
146
|
+
* reader users understand why a date is unavailable. For per-date reason customisation
|
|
147
|
+
* see [DisabledDatesWithDynamicReason](#disabled-dates-with-dynamic-reason).
|
|
148
|
+
*/
|
|
149
|
+
export const DisabledDates: Story = storySourceWithoutNoise({
|
|
150
|
+
args: {
|
|
151
|
+
size: Size.MEDIUM,
|
|
152
|
+
label: 'Select a date',
|
|
153
|
+
placeholder: 'Choose date',
|
|
154
|
+
monthFormat: 'long',
|
|
155
|
+
},
|
|
156
|
+
render: function Render(args: DateLookupProps) {
|
|
157
|
+
const min = new Date(2024, 11, 9);
|
|
158
|
+
const max = new Date(2025, 0, 22);
|
|
159
|
+
const bankHolidays = [new Date(2024, 11, 25), new Date(2024, 11, 26), new Date(2025, 0, 1)];
|
|
160
|
+
const [value, setValue] = useState<Date | null>(null);
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<DateLookup
|
|
164
|
+
{...args}
|
|
165
|
+
min={min}
|
|
166
|
+
max={max}
|
|
167
|
+
value={value}
|
|
168
|
+
disabledRules={{
|
|
169
|
+
weekdays: ['sat', 'sun'],
|
|
170
|
+
dates: bankHolidays,
|
|
171
|
+
ranges: [{ start: new Date(2024, 11, 23), end: new Date(2024, 11, 24) }],
|
|
172
|
+
reason: 'Some dates are unavailable for this service.',
|
|
173
|
+
}}
|
|
174
|
+
onChange={(date) => {
|
|
175
|
+
action('onChange')(date);
|
|
176
|
+
setValue(date);
|
|
177
|
+
}}
|
|
178
|
+
onDateSelect={({ date, isEnabled }) => {
|
|
179
|
+
action('onDateSelect')({ date, isEnabled });
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* When different disabled dates warrant different explanations, drive the `reason`
|
|
188
|
+
* dynamically from `onDateSelect`. The `isEnabled` flag tells you whether the focused
|
|
189
|
+
* date is selectable; from there you can look up the specific reason and update state.
|
|
190
|
+
*
|
|
191
|
+
* `min`/`max` out-of-range dates are handled automatically — the component shows a
|
|
192
|
+
* built-in prompt with the boundary dates, so `determineReason` only needs to cover
|
|
193
|
+
* rule-disabled dates.
|
|
194
|
+
*/
|
|
195
|
+
export const DisabledDatesWithDynamicReason: Story = storySourceWithoutNoise({
|
|
196
|
+
args: {
|
|
197
|
+
size: Size.MEDIUM,
|
|
198
|
+
label: 'Select a date',
|
|
199
|
+
placeholder: 'Choose date',
|
|
200
|
+
monthFormat: 'long',
|
|
201
|
+
},
|
|
202
|
+
render: function Render(args: DateLookupProps) {
|
|
203
|
+
const DEFAULT_REASON = 'Some dates are unavailable for this service.';
|
|
204
|
+
const min = new Date(2024, 11, 9);
|
|
205
|
+
const max = new Date(2025, 0, 22);
|
|
206
|
+
const bankHolidays = [new Date(2024, 11, 25), new Date(2024, 11, 26), new Date(2025, 0, 1)];
|
|
207
|
+
const [value, setValue] = useState<Date | null>(null);
|
|
208
|
+
const [reason, setReason] = useState(DEFAULT_REASON);
|
|
209
|
+
|
|
210
|
+
function determineReason(date: Date, isEnabled: boolean): string {
|
|
211
|
+
if (isEnabled) return DEFAULT_REASON;
|
|
212
|
+
if (bankHolidays.some((holiday) => holiday.toDateString() === date.toDateString())) {
|
|
213
|
+
return 'This date is a bank holiday.';
|
|
214
|
+
}
|
|
215
|
+
if (date.getDay() === 0 || date.getDay() === 6) {
|
|
216
|
+
return 'We do not operate on weekends.';
|
|
217
|
+
}
|
|
218
|
+
return 'This date is unavailable due to scheduled maintenance.';
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<DateLookup
|
|
223
|
+
{...args}
|
|
224
|
+
min={min}
|
|
225
|
+
max={max}
|
|
226
|
+
value={value}
|
|
227
|
+
disabledRules={{
|
|
228
|
+
weekdays: ['sat', 'sun'],
|
|
229
|
+
dates: bankHolidays,
|
|
230
|
+
ranges: [{ start: new Date(2024, 11, 23), end: new Date(2024, 11, 24) }],
|
|
231
|
+
reason,
|
|
232
|
+
}}
|
|
233
|
+
onChange={(date) => {
|
|
234
|
+
action('onChange')(date);
|
|
235
|
+
setValue(date);
|
|
236
|
+
}}
|
|
237
|
+
onDateSelect={({ date, isEnabled }) => {
|
|
238
|
+
action('onDateSelect')({ date, isEnabled });
|
|
239
|
+
setReason(determineReason(date, isEnabled));
|
|
240
|
+
}}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
});
|
package/src/DateLookup/index.ts
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.tw-definition-list__item dd {
|
|
2
|
+
word-break: break-all;
|
|
3
|
+
word-break: break-word;
|
|
4
|
+
}
|
|
5
|
+
.tw-definition-list__action {
|
|
6
|
+
align-self: center;
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
.tw-definition-list__button {
|
|
10
|
+
margin-top: -50%;
|
|
11
|
+
}
|
|
12
|
+
@media (max-width: 599.98px) {
|
|
13
|
+
.tw-definition-list--right-aligned-desktop {
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
@media (min-width: 600px) {
|
|
18
|
+
.tw-definition-list--right-aligned-desktop {
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
}
|
|
21
|
+
.tw-definition-list.tw-definition-list--columns {
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
}
|
|
24
|
+
.tw-definition-list.tw-definition-list--columns .tw-definition-list__item {
|
|
25
|
+
width: 50%;
|
|
26
|
+
}
|
|
27
|
+
.tw-definition-list.tw-definition-list--horizontal .tw-definition-list__item {
|
|
28
|
+
display: flex;
|
|
29
|
+
}
|
|
30
|
+
.tw-definition-list.tw-definition-list--horizontal .tw-definition-list__item dt {
|
|
31
|
+
flex: 1;
|
|
32
|
+
min-width: 150px;
|
|
33
|
+
max-width: 30%;
|
|
34
|
+
margin-right: 8px;
|
|
35
|
+
margin-right: var(--size-8);
|
|
36
|
+
}
|
|
37
|
+
[dir="rtl"] .tw-definition-list.tw-definition-list--horizontal .tw-definition-list__item dt {
|
|
38
|
+
margin-left: 8px;
|
|
39
|
+
margin-left: var(--size-8);
|
|
40
|
+
margin-right: 0;
|
|
41
|
+
margin-right: initial;
|
|
42
|
+
}
|
|
43
|
+
.tw-definition-list.tw-definition-list--horizontal .tw-definition-list__item dd {
|
|
44
|
+
flex: 1;
|
|
45
|
+
align-items: center;
|
|
46
|
+
margin-bottom: 8px;
|
|
47
|
+
margin-bottom: var(--size-8);
|
|
48
|
+
}
|
|
49
|
+
.tw-definition-list.tw-definition-list--horizontal-right-aligned {
|
|
50
|
+
display: grid;
|
|
51
|
+
grid-template-columns: minmax(0, max-content) minmax(0, max-content);
|
|
52
|
+
grid-column-gap: 52px;
|
|
53
|
+
grid-column-gap: var(--size-52);
|
|
54
|
+
-moz-column-gap: 52px;
|
|
55
|
+
column-gap: 52px;
|
|
56
|
+
-moz-column-gap: var(--size-52);
|
|
57
|
+
column-gap: var(--size-52);
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
}
|
|
60
|
+
.tw-definition-list.tw-definition-list--horizontal-right-aligned .tw-definition-list__item {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-columns: subgrid;
|
|
63
|
+
grid-column: 1 / -1;
|
|
64
|
+
}
|
|
65
|
+
.tw-definition-list.tw-definition-list--horizontal-right-aligned .tw-definition-list__item dt {
|
|
66
|
+
max-width: none;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
word-wrap: anywhere;
|
|
69
|
+
margin-right: 0;
|
|
70
|
+
}
|
|
71
|
+
[dir="rtl"] .tw-definition-list.tw-definition-list--horizontal-right-aligned .tw-definition-list__item dt {
|
|
72
|
+
margin-left: 0;
|
|
73
|
+
margin-right: 0;
|
|
74
|
+
margin-right: initial;
|
|
75
|
+
}
|
|
76
|
+
.tw-definition-list.tw-definition-list--horizontal-right-aligned .tw-definition-list__item dd {
|
|
77
|
+
min-width: 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.np-theme-personal .tw-definition-list dt {
|
|
81
|
+
color: #5d7079;
|
|
82
|
+
color: var(--color-content-secondary);
|
|
83
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import (reference) "./../styles/less/mixins/_logical-properties.less";
|
|
2
|
+
|
|
1
3
|
.tw-definition-list {
|
|
2
4
|
&__item dd {
|
|
3
5
|
word-break: break-all;
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
flex: 1;
|
|
41
43
|
min-width: 150px;
|
|
42
44
|
max-width: 30%;
|
|
43
|
-
margin
|
|
45
|
+
.margin(right, var(--size-8));
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
dd {
|