@transferwise/components 0.0.0-experimental-db6cf60 → 0.0.0-experimental-4678400
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/Body/Body.js +1 -1
- package/build/Body/Body.js.map +1 -1
- package/build/Body/Body.mjs +1 -1
- package/build/Body/Body.mjs.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
- package/build/Calendar/TableLink/TableLink.js +1 -1
- package/build/Calendar/TableLink/TableLink.js.map +1 -1
- package/build/Calendar/TableLink/TableLink.mjs +1 -1
- package/build/Calendar/TableLink/TableLink.mjs.map +1 -1
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js +1 -1
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js.map +1 -1
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs +1 -1
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs.map +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.js +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.js.map +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.mjs +1 -1
- package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/Header/Header.js +8 -57
- package/build/Header/Header.js.map +1 -1
- package/build/Header/Header.mjs +9 -58
- package/build/Header/Header.mjs.map +1 -1
- package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js +2 -2
- package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +1 -1
- package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs +2 -2
- package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +1 -1
- package/build/Inputs/SelectInput/Option/SelectInputOption.js +1 -1
- package/build/Inputs/SelectInput/Option/SelectInputOption.js.map +1 -1
- package/build/Inputs/SelectInput/Option/SelectInputOption.mjs +1 -1
- package/build/Inputs/SelectInput/Option/SelectInputOption.mjs.map +1 -1
- package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.js +3 -3
- package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +1 -1
- package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs +3 -3
- package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +1 -1
- package/build/Inputs/SelectInput/Popover/SelectInputPopover.js +2 -2
- package/build/Inputs/SelectInput/Popover/SelectInputPopover.js.map +1 -1
- package/build/Inputs/SelectInput/Popover/SelectInputPopover.mjs +2 -2
- package/build/Inputs/SelectInput/Popover/SelectInputPopover.mjs.map +1 -1
- package/build/Label/Label.js +1 -1
- package/build/Label/Label.js.map +1 -1
- package/build/Label/Label.mjs +1 -1
- package/build/Label/Label.mjs.map +1 -1
- package/build/Stepper/Stepper.js +1 -1
- package/build/Stepper/Stepper.js.map +1 -1
- package/build/Stepper/Stepper.mjs +1 -1
- package/build/Stepper/Stepper.mjs.map +1 -1
- package/build/Table/Header/TableHeader.js +1 -1
- package/build/Table/Header/TableHeader.js.map +1 -1
- package/build/Table/Header/TableHeader.mjs +1 -1
- package/build/Table/Header/TableHeader.mjs.map +1 -1
- package/build/Tabs/Tab/Tab.js +1 -1
- package/build/Tabs/Tab/Tab.js.map +1 -1
- package/build/Tabs/Tab/Tab.mjs +1 -1
- package/build/Tabs/Tab/Tab.mjs.map +1 -1
- package/build/Tag/Tag.js +1 -1
- package/build/Tag/Tag.js.map +1 -1
- package/build/Tag/Tag.mjs +1 -1
- package/build/Tag/Tag.mjs.map +1 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.js +2 -2
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.js.map +1 -1
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs +2 -2
- package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs.map +1 -1
- package/build/Upload/Steps/UploadImageStep/UploadImageStep.js +2 -2
- package/build/Upload/Steps/UploadImageStep/UploadImageStep.js.map +1 -1
- package/build/Upload/Steps/UploadImageStep/UploadImageStep.mjs +2 -2
- package/build/Upload/Steps/UploadImageStep/UploadImageStep.mjs.map +1 -1
- package/build/_deprecated/ActionButton/ActionButton.js +1 -1
- package/build/_deprecated/ActionButton/ActionButton.js.map +1 -1
- package/build/_deprecated/ActionButton/ActionButton.mjs +1 -1
- package/build/_deprecated/ActionButton/ActionButton.mjs.map +1 -1
- package/build/_deprecated/Avatar/Avatar.js +1 -1
- package/build/_deprecated/Avatar/Avatar.js.map +1 -1
- package/build/_deprecated/Avatar/Avatar.mjs +1 -1
- package/build/_deprecated/Avatar/Avatar.mjs.map +1 -1
- package/build/_deprecated/Select/Select.js +2 -2
- package/build/_deprecated/Select/Select.js.map +1 -1
- package/build/_deprecated/Select/Select.mjs +2 -2
- package/build/_deprecated/Select/Select.mjs.map +1 -1
- package/build/common/PropsValues/typography.js +6 -0
- package/build/common/PropsValues/typography.js.map +1 -1
- package/build/common/PropsValues/typography.mjs +6 -0
- package/build/common/PropsValues/typography.mjs.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/main.css +8673 -2355
- package/build/styles/Accordion/Accordion.css +7 -6
- package/build/styles/Body/Body.css +1 -1
- package/build/styles/Calendar/Calendar.css +11 -4
- package/build/styles/Calendar/TableLink/TableLink.css +11 -4
- package/build/styles/Chips/Chip/Chip.css +5 -3
- package/build/styles/Decision/Decision.css +4 -3
- package/build/styles/Emphasis/Emphasis.css +1 -1
- package/build/styles/ExpressiveMoneyInput/AmountInput/AmountInput.css +2 -1
- package/build/styles/ExpressiveMoneyInput/ExpressiveMoneyInput.css +2 -1
- package/build/styles/Header/Header.css +0 -46
- package/build/styles/Inputs/Input/Input.css +69 -57
- package/build/styles/Inputs/TextArea/TextArea.css +69 -57
- package/build/styles/Label/Label.css +3 -0
- package/build/styles/Markup/Markup.css +2 -2
- package/build/styles/MoneyInput/MoneyInput.css +9 -6
- package/build/styles/Nudge/Nudge.css +3 -3
- package/build/styles/Popover/Popover.css +4 -43
- package/build/styles/ProgressBar/ProgressBar.css +3 -2
- package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.css +2 -1
- package/build/styles/Snackbar/Snackbar.css +1 -1
- package/build/styles/Table/Table.css +18 -8
- package/build/styles/Tabs/Tabs.css +3 -3
- package/build/styles/Tag/Tag.css +1 -1
- package/build/styles/Tile/Tile.css +4 -3
- package/build/styles/Typeahead/Typeahead.css +4 -2
- package/build/styles/UploadInput/UploadInput.css +1 -1
- package/build/styles/_deprecated/ActionButton/ActionButton.css +3 -4
- package/build/styles/_deprecated/Avatar/Avatar.css +2 -2
- package/build/styles/_deprecated/CriticalBanner/CriticalCommsBanner.css +2 -1
- package/build/styles/_deprecated/Select/Select.css +49 -14
- package/build/styles/_deprecated/Summary/Summary.css +2 -2
- package/build/styles/common/Circle/Circle.css +1 -1
- package/build/styles/common/Option/Option.css +4 -4
- package/build/styles/css/accordion.css +22 -44
- package/build/styles/css/badge.css +2 -2
- package/build/styles/css/button-groups.css +29 -6
- package/build/styles/css/buttons.css +35 -11
- package/build/styles/css/decision.css +22 -44
- package/build/styles/css/dropdowns.css +39 -54
- package/build/styles/css/droppable.css +28 -6
- package/build/styles/css/footer.css +41 -10
- package/build/styles/css/input-groups.css +205 -162
- package/build/styles/css/list-group.css +1 -42
- package/build/styles/css/modals.css +1 -1
- package/build/styles/css/navbar.css +66 -81
- package/build/styles/css/navs.css +8 -8
- package/build/styles/css/neptune-addons.css +15 -0
- package/build/styles/css/neptune-core.css +5887 -524
- package/build/styles/css/neptune.css +8348 -1945
- package/build/styles/css/panels.css +2 -2
- package/build/styles/css/popovers.css +39 -56
- package/build/styles/css/progress-bars.css +2 -2
- package/build/styles/css/sequences.css +14 -9
- package/build/styles/css/table.css +7 -7
- package/build/styles/css/tooltip.css +28 -6
- package/build/styles/less/legacy-variables.less +3 -3
- package/build/styles/less/neptune-tokens.less +0 -48
- package/build/styles/main.css +8673 -2355
- package/build/styles/props/neptune-tokens.css +805 -3
- package/build/styles/styles/less/accordion.css +22 -44
- package/build/styles/styles/less/badge.css +2 -2
- package/build/styles/styles/less/button-groups.css +29 -6
- package/build/styles/styles/less/buttons.css +35 -11
- package/build/styles/styles/less/decision.css +22 -44
- package/build/styles/styles/less/dropdowns.css +39 -54
- package/build/styles/styles/less/droppable.css +28 -6
- package/build/styles/styles/less/footer.css +41 -10
- package/build/styles/styles/less/forms/bootstrap-forms.css +153 -100
- package/build/styles/styles/less/forms/checkbox-radio.css +3 -3
- package/build/styles/styles/less/input-groups.css +205 -162
- package/build/styles/styles/less/list-group.css +1 -42
- package/build/styles/styles/less/modals.css +1 -1
- package/build/styles/styles/less/navbar.css +66 -81
- package/build/styles/styles/less/navs.css +8 -8
- package/build/styles/styles/less/neptune-addons.css +15 -0
- package/build/styles/styles/less/neptune-core.css +5887 -524
- package/build/styles/styles/less/neptune.css +8348 -1945
- package/build/styles/styles/less/panels.css +2 -2
- package/build/styles/styles/less/popovers.css +39 -56
- package/build/styles/styles/less/progress-bars.css +2 -2
- package/build/styles/styles/less/sequences.css +14 -9
- package/build/styles/styles/less/table.css +7 -7
- package/build/styles/styles/less/tooltip.css +28 -6
- package/build/types/ExpressiveMoneyInput/AmountInput/AmountInput.d.ts.map +1 -1
- package/build/types/Header/Header.d.ts +4 -31
- package/build/types/Header/Header.d.ts.map +1 -1
- package/build/types/Header/index.d.ts +1 -2
- package/build/types/Header/index.d.ts.map +1 -1
- package/build/types/common/PropsValues/typography.d.ts +13 -1
- package/build/types/common/PropsValues/typography.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -3
- package/build/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Accordion/Accordion.css +7 -6
- package/src/Accordion/Accordion.less +7 -6
- package/src/Body/Body.css +1 -1
- package/src/Body/Body.less +1 -1
- package/src/Body/Body.test.tsx +4 -4
- package/src/Body/Body.tsx +2 -2
- package/src/Calendar/Calendar.css +11 -4
- package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +2 -2
- package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +1 -1
- package/src/Calendar/TableLink/TableLink.css +11 -4
- package/src/Calendar/TableLink/TableLink.less +14 -4
- package/src/Calendar/TableLink/TableLink.tsx +1 -1
- package/src/Chips/Chip/Chip.css +5 -3
- package/src/Chips/Chip/Chip.less +3 -2
- package/src/CircularButton/_stories/CircularButton.story.tsx +6 -16
- package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +46 -0
- package/src/Decision/Decision.css +4 -3
- package/src/Decision/Decision.less +4 -3
- package/src/DefinitionList/_stories/DefinitionList.story.tsx +1 -1
- package/src/Display/_stories/Display.story.tsx +20 -6
- package/src/Emphasis/Emphasis.css +1 -1
- package/src/Emphasis/Emphasis.less +1 -1
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.css +2 -1
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.less +2 -1
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx +1 -4
- package/src/ExpressiveMoneyInput/ExpressiveMoneyInput.css +2 -1
- package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.tsx +1 -1
- package/src/Header/Header.css +0 -46
- package/src/Header/Header.less +1 -63
- package/src/Header/Header.test.tsx +1 -133
- package/src/Header/Header.tsx +11 -107
- package/src/Header/_stories/Header.story.tsx +2 -97
- package/src/Header/_stories/Header.test.story.tsx +0 -32
- package/src/Header/index.ts +1 -2
- package/src/Inputs/Input/Input.css +69 -57
- package/src/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.tsx +2 -2
- package/src/Inputs/SelectInput/Option/SelectInputOption.tsx +1 -1
- package/src/Inputs/SelectInput/OptionContent/SelectInputOptionContent.tsx +3 -3
- package/src/Inputs/SelectInput/Popover/SelectInputPopover.tsx +2 -2
- package/src/Inputs/SelectInput/_stories/SelectInput.story.tsx +1 -1
- package/src/Inputs/TextArea/TextArea.css +69 -57
- package/src/Inputs/_common.less +16 -10
- package/src/Label/Label.css +3 -0
- package/src/Label/Label.less +8 -0
- package/src/Label/Label.tsx +1 -1
- package/src/Markup/Markup.css +2 -2
- package/src/Markup/Markup.less +2 -2
- package/src/MoneyInput/MoneyInput.css +9 -6
- package/src/MoneyInput/MoneyInput.less +10 -7
- package/src/Nudge/Nudge.css +3 -3
- package/src/Nudge/Nudge.less +3 -3
- package/src/PocketSurface/_stories/PocketSurface.story.tsx +2 -2
- package/src/Popover/Popover.css +4 -43
- package/src/Popover/Popover.less +2 -2
- package/src/ProgressBar/ProgressBar.css +3 -2
- package/src/ProgressBar/ProgressBar.less +12 -11
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.css +2 -1
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.less +2 -1
- package/src/SentimentSurface/_stories/SentimentSurface.story.tsx +1 -1
- package/src/Snackbar/Snackbar.css +1 -1
- package/src/Snackbar/Snackbar.less +1 -1
- package/src/Stepper/Stepper.tsx +1 -1
- package/src/Table/Header/TableHeader.tsx +1 -1
- package/src/Table/StatusText/TableStatusText.test.tsx +5 -5
- package/src/Table/Table.css +18 -8
- package/src/Table/Table.less +20 -9
- package/src/Tabs/Tab/Tab.tsx +1 -1
- package/src/Tabs/Tabs.css +3 -3
- package/src/Tabs/Tabs.less +3 -3
- package/src/Tag/Tag.css +1 -1
- package/src/Tag/Tag.less +1 -1
- package/src/Tag/Tag.tsx +1 -1
- package/src/Tag/_stories/Tag.story.tsx +1 -1
- package/src/Tile/Tile.css +4 -3
- package/src/Tile/Tile.less +4 -3
- package/src/Typeahead/Typeahead.css +4 -2
- package/src/Typeahead/Typeahead.less +2 -1
- package/src/Typeahead/TypeaheadOption/TypeaheadOption.tsx +2 -2
- package/src/Upload/Steps/UploadImageStep/UploadImageStep.tsx +2 -2
- package/src/UploadInput/UploadInput.css +1 -1
- package/src/UploadInput/UploadInput.less +7 -4
- package/src/_deprecated/ActionButton/ActionButton.css +3 -4
- package/src/_deprecated/ActionButton/ActionButton.less +4 -5
- package/src/_deprecated/ActionButton/ActionButton.tsx +1 -1
- package/src/_deprecated/Avatar/Avatar.css +2 -2
- package/src/_deprecated/Avatar/Avatar.less +2 -2
- package/src/_deprecated/Avatar/Avatar.tsx +1 -1
- package/src/_deprecated/CriticalBanner/CriticalCommsBanner.css +2 -1
- package/src/_deprecated/CriticalBanner/CriticalCommsBanner.less +2 -1
- package/src/_deprecated/NavigationOption/_stories/NavigationOption.story.tsx +6 -6
- package/src/_deprecated/Select/Select.css +49 -14
- package/src/_deprecated/Select/Select.less +14 -10
- package/src/_deprecated/Select/Select.tsx +2 -2
- package/src/_deprecated/Summary/Summary.css +2 -2
- package/src/_deprecated/Summary/Summary.less +2 -2
- package/src/common/Circle/Circle.css +1 -1
- package/src/common/Circle/Circle.less +1 -1
- package/src/common/Option/Option.css +4 -4
- package/src/common/Option/Option.less +4 -4
- package/src/common/PropsValues/typography.ts +20 -1
- package/src/index.ts +1 -3
- package/src/main.css +8673 -2355
- package/src/main.less +3 -3
- package/src/styles/less/accordion.css +22 -44
- package/src/styles/less/addons/_background-utilities.less +5 -0
- package/src/styles/less/badge.css +2 -2
- package/src/styles/less/badge.less +2 -2
- package/src/styles/less/button-groups.css +29 -6
- package/src/styles/less/button-groups.less +3 -2
- package/src/styles/less/buttons.css +35 -11
- package/src/styles/less/buttons.less +7 -7
- package/src/styles/less/core/_fonts.less +7 -75
- package/src/styles/less/core/_scaffolding.less +4 -4
- package/src/styles/less/core/_typography-utilities.less +3 -3
- package/src/styles/less/core/_typography.less +81 -235
- package/src/styles/less/core/fonts/_fonts-ar.less +86 -0
- package/src/styles/less/core/fonts/_fonts-base.less +99 -0
- package/src/styles/less/core/fonts/_fonts-he.less +8 -0
- package/src/styles/less/core/fonts/_fonts-ja.less +4247 -0
- package/src/styles/less/core/fonts/_fonts-ko.less +1079 -0
- package/src/styles/less/core/fonts/_fonts-th.less +8 -0
- package/src/styles/less/core/fonts/_fonts-zh.less +872 -0
- package/src/styles/less/decision.css +22 -44
- package/src/styles/less/decision.less +2 -2
- package/src/styles/less/dropdowns.css +39 -54
- package/src/styles/less/dropdowns.less +8 -7
- package/src/styles/less/droppable.css +28 -6
- package/src/styles/less/droppable.less +4 -4
- package/src/styles/less/footer.css +41 -10
- package/src/styles/less/footer.less +4 -3
- package/src/styles/less/forms/bootstrap-forms.css +153 -100
- package/src/styles/less/forms/bootstrap-forms.less +85 -72
- package/src/styles/less/forms/checkbox-radio.css +3 -3
- package/src/styles/less/forms/checkbox-radio.less +3 -3
- package/src/styles/less/input-groups.css +205 -162
- package/src/styles/less/input-groups.less +23 -9
- package/src/styles/less/list-group.css +1 -42
- package/src/styles/less/list-group.less +8 -5
- package/src/styles/less/mixins/_reset-text.less +1 -1
- package/src/styles/less/mixins/_text-emphasis.less +7 -1
- package/src/styles/less/modals.css +1 -1
- package/src/styles/less/modals.less +1 -1
- package/src/styles/less/navbar.css +66 -81
- package/src/styles/less/navbar.less +19 -19
- package/src/styles/less/navs.css +8 -8
- package/src/styles/less/navs.less +8 -8
- package/src/styles/less/neptune-addons.css +15 -0
- package/src/styles/less/neptune-core.css +5887 -524
- package/src/styles/less/neptune.bundle.less +4 -0
- package/src/styles/less/neptune.css +8348 -1945
- package/src/styles/less/panels.css +2 -2
- package/src/styles/less/panels.less +2 -2
- package/src/styles/less/popovers.css +39 -56
- package/src/styles/less/popovers.less +7 -7
- package/src/styles/less/progress-bars.css +2 -2
- package/src/styles/less/progress-bars.less +2 -2
- package/src/styles/less/sequences.css +14 -9
- package/src/styles/less/sequences.less +15 -10
- package/src/styles/less/table.css +7 -7
- package/src/styles/less/table.less +7 -7
- package/src/styles/less/tooltip.css +28 -6
- package/src/styles/less/tooltip.less +1 -1
- package/src/styles/variables/legacy-variables.less +3 -3
- package/build/CardContainer/CardContainer.js +0 -30
- package/build/CardContainer/CardContainer.js.map +0 -1
- package/build/CardContainer/CardContainer.mjs +0 -26
- package/build/CardContainer/CardContainer.mjs.map +0 -1
- package/build/Header/HeaderActionButton.js +0 -70
- package/build/Header/HeaderActionButton.js.map +0 -1
- package/build/Header/HeaderActionButton.mjs +0 -65
- package/build/Header/HeaderActionButton.mjs.map +0 -1
- package/build/styles/CardContainer/CardContainer.css +0 -78
- package/build/styles/fonts/inter-cyrillic-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-cyrillic-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-greek-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-greek-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-latin-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-latin-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-body-cyrillic-330-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-body-cyrillic-600-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-body-cyrillic-ext-330-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-body-cyrillic-ext-600-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-cyrillic-900-normal.woff2 +0 -0
- package/build/styles/fonts/rubik/rubik-cyrillic-ext-900-normal.woff2 +0 -0
- package/build/types/CardContainer/CardContainer.d.ts +0 -8
- package/build/types/CardContainer/CardContainer.d.ts.map +0 -1
- package/build/types/CardContainer/CardContainer.types.d.ts +0 -32
- package/build/types/CardContainer/CardContainer.types.d.ts.map +0 -1
- package/build/types/CardContainer/_stories/helpers.d.ts +0 -3
- package/build/types/CardContainer/_stories/helpers.d.ts.map +0 -1
- package/build/types/CardContainer/index.d.ts +0 -3
- package/build/types/CardContainer/index.d.ts.map +0 -1
- package/build/types/Header/HeaderActionButton.d.ts +0 -53
- package/build/types/Header/HeaderActionButton.d.ts.map +0 -1
- package/src/CardContainer/CardContainer.css +0 -78
- package/src/CardContainer/CardContainer.less +0 -111
- package/src/CardContainer/CardContainer.test.tsx +0 -103
- package/src/CardContainer/CardContainer.tsx +0 -36
- package/src/CardContainer/CardContainer.types.ts +0 -36
- package/src/CardContainer/_stories/CardContainer.story.tsx +0 -99
- package/src/CardContainer/_stories/CardContainer.test.story.tsx +0 -375
- package/src/CardContainer/_stories/CardContainer.withHeader.story.tsx +0 -149
- package/src/CardContainer/_stories/helpers.tsx +0 -50
- package/src/CardContainer/index.ts +0 -2
- package/src/Header/HeaderActionButton.tsx +0 -125
- package/src/styles/fonts/inter-cyrillic-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-cyrillic-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-greek-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-greek-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-latin-ext-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-latin-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-body-cyrillic-330-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-body-cyrillic-600-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-body-cyrillic-ext-330-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-body-cyrillic-ext-600-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-cyrillic-900-normal.woff2 +0 -0
- package/src/styles/fonts/rubik/rubik-cyrillic-ext-900-normal.woff2 +0 -0
package/src/Header/Header.less
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
// Above this header width a long title wraps beside the action corner. At or below it, the title
|
|
2
|
-
// only shares a line with the actions while it fits on one line, so it keeps room to read.
|
|
3
|
-
@np-header-actions-stack-width: 360px;
|
|
4
|
-
|
|
5
1
|
.np-header {
|
|
6
2
|
display: grid;
|
|
7
3
|
grid-template-columns: 1fr auto;
|
|
@@ -17,7 +13,7 @@
|
|
|
17
13
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
18
14
|
|
|
19
15
|
&,
|
|
20
|
-
.np-header__title
|
|
16
|
+
.np-header__title{
|
|
21
17
|
color: var(--color-content-secondary);
|
|
22
18
|
}
|
|
23
19
|
}
|
|
@@ -28,62 +24,4 @@
|
|
|
28
24
|
display: flex;
|
|
29
25
|
align-items: center;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
|
-
// Button actions are taller than the title, so it centres on them rather than sitting low.
|
|
33
|
-
// The actions wrap under the title when they don't fit beside it.
|
|
34
|
-
&--with-actions {
|
|
35
|
-
--Header-actions-gap: var(--size-8);
|
|
36
|
-
|
|
37
|
-
align-items: center;
|
|
38
|
-
container-type: inline-size;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-wrap: wrap;
|
|
41
|
-
row-gap: var(--size-8);
|
|
42
|
-
|
|
43
|
-
> .np-header__title {
|
|
44
|
-
flex: 1 1 0;
|
|
45
|
-
|
|
46
|
-
@container (width <= @np-header-actions-stack-width) {
|
|
47
|
-
flex-basis: auto;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// The title is a `Link`, but keeps the title's typography and colour rather than the link
|
|
53
|
-
// text style, and flows inline so the chevron can follow its last word.
|
|
54
|
-
&__title-link.np-link {
|
|
55
|
-
color: inherit;
|
|
56
|
-
display: inline;
|
|
57
|
-
font: inherit;
|
|
58
|
-
letter-spacing: inherit;
|
|
59
|
-
// `Link` renders a button when there is no `href`, which would otherwise centre the title.
|
|
60
|
-
text-align: start;
|
|
61
|
-
text-decoration: none;
|
|
62
|
-
|
|
63
|
-
&:hover,
|
|
64
|
-
&:focus-visible {
|
|
65
|
-
text-decoration: underline;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.np-header__title-chevron {
|
|
69
|
-
white-space: nowrap;
|
|
70
|
-
|
|
71
|
-
.tw-icon {
|
|
72
|
-
display: inline-block;
|
|
73
|
-
margin: 0;
|
|
74
|
-
vertical-align: text-bottom;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&__actions {
|
|
80
|
-
// Stays in the top corner when a long title wraps onto more lines.
|
|
81
|
-
align-self: start;
|
|
82
|
-
align-items: center;
|
|
83
|
-
display: flex;
|
|
84
|
-
flex: none;
|
|
85
|
-
gap: var(--Header-actions-gap);
|
|
86
|
-
// Keeps the actions at the inline end once they wrap under the title.
|
|
87
|
-
margin-inline-start: auto;
|
|
88
|
-
}
|
|
89
27
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { mockMatchMedia, render, screen, userEvent } from '../test-utils';
|
|
1
|
+
import { render, screen, userEvent } from '../test-utils';
|
|
4
2
|
import Header, { HeaderProps } from '.';
|
|
5
3
|
|
|
6
|
-
mockMatchMedia();
|
|
7
|
-
|
|
8
4
|
describe('Header', () => {
|
|
9
5
|
const defaultProps: HeaderProps = {
|
|
10
6
|
title: 'Header title',
|
|
@@ -114,132 +110,4 @@ describe('Header', () => {
|
|
|
114
110
|
await userEvent.click(button);
|
|
115
111
|
expect(callback).toHaveBeenCalledTimes(1);
|
|
116
112
|
});
|
|
117
|
-
|
|
118
|
-
describe('titleAction', () => {
|
|
119
|
-
it('renders the title as a link inside the heading', () => {
|
|
120
|
-
renderHeader({ as: 'h3', titleAction: { href: '/cards' } });
|
|
121
|
-
const link = screen.getByRole('link', { name: 'Header title' });
|
|
122
|
-
expect(link).toHaveAttribute('href', '/cards');
|
|
123
|
-
expect(screen.getByRole('heading', { level: 3 })).toContainElement(link);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('calls the titleAction onClick handler', async () => {
|
|
127
|
-
const onClick = jest.fn();
|
|
128
|
-
renderHeader({ titleAction: { href: '/cards', onClick } });
|
|
129
|
-
await userEvent.click(screen.getByRole('link', { name: 'Header title' }));
|
|
130
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('renders the title as a button when titleAction has only onClick', async () => {
|
|
134
|
-
const onClick = jest.fn();
|
|
135
|
-
renderHeader({ titleAction: { onClick } });
|
|
136
|
-
await userEvent.click(screen.getByRole('button', { name: 'Header title' }));
|
|
137
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('marks a title link that opens in a new tab', () => {
|
|
141
|
-
renderHeader({ titleAction: { href: '/cards', target: '_blank' } });
|
|
142
|
-
expect(screen.getByRole('link', { name: /Header title/u })).toHaveAttribute(
|
|
143
|
-
'rel',
|
|
144
|
-
'noreferrer',
|
|
145
|
-
);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('keeps the title link alongside actions', () => {
|
|
149
|
-
renderHeader({ titleAction: { href: '/cards' }, action: { label: 'Order card' } });
|
|
150
|
-
expect(screen.getByRole('link', { name: 'Header title' })).toBeInTheDocument();
|
|
151
|
-
expect(screen.getByRole('button', { name: 'Order card' })).toBeInTheDocument();
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
describe('action buttons', () => {
|
|
156
|
-
it('still renders a text action as a link-styled action', () => {
|
|
157
|
-
renderHeader({ action: { text: 'View all', href: '#' } });
|
|
158
|
-
const link = screen.getByRole('link', { name: 'View all' });
|
|
159
|
-
expect(link).toHaveClass('np-header__action-button');
|
|
160
|
-
expect(link.closest('.np-header')).not.toHaveClass('np-header--with-actions');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('renders a labelled action as a button', () => {
|
|
164
|
-
renderHeader({ action: { label: 'Order card' } });
|
|
165
|
-
expect(screen.getByRole('button', { name: 'Order card' })).toBeInTheDocument();
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('renders a labelled action with an href as a link', () => {
|
|
169
|
-
renderHeader({ action: { label: 'Order card', href: '/cards/order' } });
|
|
170
|
-
expect(screen.getByRole('link', { name: 'Order card' })).toHaveAttribute(
|
|
171
|
-
'href',
|
|
172
|
-
'/cards/order',
|
|
173
|
-
);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('names an unlabelled action from its aria-label', () => {
|
|
177
|
-
renderHeader({ action: { 'aria-label': 'Card settings', icon: <Settings size={16} /> } });
|
|
178
|
-
expect(screen.getByRole('button', { name: 'Card settings' })).toBeInTheDocument();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('calls the action onClick handler', async () => {
|
|
182
|
-
const onClick = jest.fn();
|
|
183
|
-
renderHeader({ action: { label: 'Order card', onClick } });
|
|
184
|
-
await userEvent.click(screen.getByRole('button', { name: 'Order card' }));
|
|
185
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
it('does not call onClick when disabled', async () => {
|
|
189
|
-
const onClick = jest.fn();
|
|
190
|
-
renderHeader({ action: { label: 'Order card', disabled: true, onClick } });
|
|
191
|
-
await userEvent.click(screen.getByRole('button', { name: 'Order card' }));
|
|
192
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('renders actionSecondary before action in the DOM', () => {
|
|
196
|
-
renderHeader({ action: { label: 'Order card' }, actionSecondary: { label: 'Manage' } });
|
|
197
|
-
const [first, second] = screen.getAllByRole('button');
|
|
198
|
-
expect(first).toHaveAccessibleName('Manage');
|
|
199
|
-
expect(second).toHaveAccessibleName('Order card');
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('takes button priority from the slot the action is passed to', () => {
|
|
203
|
-
renderHeader({ action: { label: 'Order card' }, actionSecondary: { label: 'Manage' } });
|
|
204
|
-
expect(screen.getByRole('button', { name: 'Order card' })).toHaveClass(
|
|
205
|
-
'wds-Button--secondary',
|
|
206
|
-
);
|
|
207
|
-
expect(screen.getByRole('button', { name: 'Manage' })).toHaveClass(
|
|
208
|
-
'wds-Button--secondary-neutral',
|
|
209
|
-
);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it('takes icon button priority from the slot the action is passed to', () => {
|
|
213
|
-
renderHeader({
|
|
214
|
-
action: { 'aria-label': 'Add', icon: <Plus size={16} /> },
|
|
215
|
-
actionSecondary: { 'aria-label': 'Settings', icon: <Settings size={16} /> },
|
|
216
|
-
});
|
|
217
|
-
expect(screen.getByRole('button', { name: 'Add' })).toHaveClass(
|
|
218
|
-
'np-icon-button-secondary-default',
|
|
219
|
-
);
|
|
220
|
-
expect(screen.getByRole('button', { name: 'Settings' })).toHaveClass(
|
|
221
|
-
'np-icon-button-tertiary-default',
|
|
222
|
-
);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it('keeps the lower emphasis when actionSecondary is used on its own', () => {
|
|
226
|
-
renderHeader({ actionSecondary: { label: 'Manage' } });
|
|
227
|
-
expect(screen.getByRole('button', { name: 'Manage' })).toHaveClass(
|
|
228
|
-
'wds-Button--secondary-neutral',
|
|
229
|
-
);
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('renders an arbitrary node in place of the action buttons', () => {
|
|
233
|
-
renderHeader({ action: <span>Custom node</span> });
|
|
234
|
-
expect(screen.getByText('Custom node')).toBeInTheDocument();
|
|
235
|
-
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it('renders an element as given, even when it has a label prop', () => {
|
|
239
|
-
const CustomAction = ({ label }: { label: string }) => <span>{label}</span>;
|
|
240
|
-
renderHeader({ action: <CustomAction label="Custom action" /> });
|
|
241
|
-
expect(screen.getByText('Custom action')).toBeInTheDocument();
|
|
242
|
-
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
113
|
});
|
package/src/Header/Header.tsx
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { ChevronEnd } from '@transferwise/icons';
|
|
2
1
|
import { clsx } from 'clsx';
|
|
3
2
|
|
|
4
3
|
import { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';
|
|
5
|
-
import Link
|
|
4
|
+
import Link from '../Link';
|
|
6
5
|
import Title from '../Title';
|
|
7
|
-
import React, { useEffect, useRef, FunctionComponent, ReactNode
|
|
8
|
-
|
|
9
|
-
import HeaderActionButtonComponent, {
|
|
10
|
-
isHeaderActionButton,
|
|
11
|
-
type HeaderActionButton,
|
|
12
|
-
type HeaderActionSlot,
|
|
13
|
-
} from './HeaderActionButton';
|
|
6
|
+
import React, { useEffect, useRef, FunctionComponent, ReactNode } from 'react';
|
|
14
7
|
|
|
15
8
|
type ActionProps = AriaLabelProperty & {
|
|
16
9
|
text: string;
|
|
@@ -21,38 +14,12 @@ type ActionProps = AriaLabelProperty & {
|
|
|
21
14
|
type ButtonActionProps = ActionProps;
|
|
22
15
|
type LinkActionProps = ActionProps & LinkProps;
|
|
23
16
|
|
|
24
|
-
/**
|
|
25
|
-
* Props passed to the [Link](https://storybook.wise.design/?path=/docs/typography-link--docs)
|
|
26
|
-
* that the title is rendered as. A trailing chevron is rendered automatically, so do not put one
|
|
27
|
-
* in `title`.
|
|
28
|
-
*/
|
|
29
|
-
export type HeaderTitleAction = Pick<LinkComponentProps, 'href' | 'target' | 'onClick'>;
|
|
30
|
-
|
|
31
17
|
export interface HeaderProps extends CommonProps {
|
|
32
18
|
/**
|
|
33
|
-
* Optional prop to define the action for the header.
|
|
34
|
-
*
|
|
35
|
-
* - An object with `text` renders a `Link` (or a link-styled button without `href`).
|
|
36
|
-
* - A `HeaderActionButton` object (with a `label` or an `icon`) renders a small button that
|
|
37
|
-
* carries the visual emphasis, anchored to the inline end.
|
|
38
|
-
* - Any other node is rendered as given.
|
|
39
|
-
* @default undefined
|
|
40
|
-
*/
|
|
41
|
-
action?: ButtonActionProps | LinkActionProps | HeaderActionButton | ReactNode;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Second action, at a lower emphasis, rendered before `action`. Two is the maximum, to keep
|
|
45
|
-
* the title legible. Takes a `HeaderActionButton` object or any other node, and keeps its lower
|
|
46
|
-
* emphasis when used on its own.
|
|
47
|
-
* @default undefined
|
|
19
|
+
* Optional prop to define the action for the header. If the `href` property
|
|
20
|
+
* is provided, a `Link` will be rendered instead of a `Button`.
|
|
48
21
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Makes the title a link with a trailing chevron.
|
|
53
|
-
* @default undefined
|
|
54
|
-
*/
|
|
55
|
-
titleAction?: HeaderTitleAction;
|
|
22
|
+
action?: ButtonActionProps | LinkActionProps;
|
|
56
23
|
|
|
57
24
|
/**
|
|
58
25
|
* Option prop to specify DOM render element of the title
|
|
@@ -106,27 +73,8 @@ const HeaderAction = React.forwardRef<
|
|
|
106
73
|
|
|
107
74
|
HeaderAction.displayName = 'HeaderAction';
|
|
108
75
|
|
|
109
|
-
const isHeaderTextAction = (value: unknown): value is ButtonActionProps | LinkActionProps =>
|
|
110
|
-
typeof value === 'object' &&
|
|
111
|
-
value !== null &&
|
|
112
|
-
!isValidElement(value) &&
|
|
113
|
-
!Array.isArray(value) &&
|
|
114
|
-
'text' in value;
|
|
115
|
-
|
|
116
|
-
const renderAction = (action: HeaderProps['action'], slot: HeaderActionSlot) => {
|
|
117
|
-
if (isHeaderTextAction(action)) {
|
|
118
|
-
return <HeaderAction action={action} />;
|
|
119
|
-
}
|
|
120
|
-
if (isHeaderActionButton(action)) {
|
|
121
|
-
return <HeaderActionButtonComponent action={action} slot={slot} />;
|
|
122
|
-
}
|
|
123
|
-
return action;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
76
|
/**
|
|
127
|
-
* @param {ButtonActionProps | LinkActionProps
|
|
128
|
-
* @param {HeaderActionButton | ReactNode} [actionSecondary] - Optional second action, at a lower emphasis.
|
|
129
|
-
* @param {HeaderTitleAction} [titleAction] - Optional prop to make the title a link with a trailing chevron.
|
|
77
|
+
* @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.
|
|
130
78
|
* @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.
|
|
131
79
|
* @param {string} title - Required prop to set the title of the section header.
|
|
132
80
|
* @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.
|
|
@@ -138,26 +86,14 @@ const renderAction = (action: HeaderProps['action'], slot: HeaderActionSlot) =>
|
|
|
138
86
|
*/
|
|
139
87
|
const Header: FunctionComponent<HeaderProps> = React.forwardRef(
|
|
140
88
|
(
|
|
141
|
-
{
|
|
142
|
-
as = 'h5',
|
|
143
|
-
action,
|
|
144
|
-
actionSecondary,
|
|
145
|
-
titleAction,
|
|
146
|
-
className,
|
|
147
|
-
testId,
|
|
148
|
-
title,
|
|
149
|
-
level = 'group',
|
|
150
|
-
...props
|
|
151
|
-
},
|
|
89
|
+
{ as = 'h5', action, className, testId, title, level = 'group', ...props },
|
|
152
90
|
ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,
|
|
153
91
|
) => {
|
|
154
92
|
const internalRef = useRef<HTMLLegendElement>(null);
|
|
155
93
|
const levelTypography =
|
|
156
94
|
level === 'group' ? Typography.TITLE_GROUP : Typography.TITLE_SUBSECTION;
|
|
157
|
-
const hasActionCorner = Boolean(actionSecondary) || (!!action && !isHeaderTextAction(action));
|
|
158
95
|
const headerClasses = clsx('np-header', className, {
|
|
159
96
|
'np-header--group': level === 'group',
|
|
160
|
-
'np-header--with-actions': hasActionCorner,
|
|
161
97
|
});
|
|
162
98
|
|
|
163
99
|
const commonProps = {
|
|
@@ -176,52 +112,20 @@ const Header: FunctionComponent<HeaderProps> = React.forwardRef(
|
|
|
176
112
|
}
|
|
177
113
|
}, [as]);
|
|
178
114
|
|
|
179
|
-
|
|
180
|
-
<Link
|
|
181
|
-
href={titleAction.href}
|
|
182
|
-
target={titleAction.target}
|
|
183
|
-
className="np-header__title-link"
|
|
184
|
-
onClick={titleAction.onClick}
|
|
185
|
-
>
|
|
186
|
-
{title}
|
|
187
|
-
{/* The word joiner keeps the chevron on the title's last line instead of wrapping alone. */}
|
|
188
|
-
<span className="np-header__title-chevron" aria-hidden>
|
|
189
|
-
{'\u2060'}
|
|
190
|
-
<ChevronEnd size={16} />
|
|
191
|
-
</span>
|
|
192
|
-
</Link>
|
|
193
|
-
) : (
|
|
194
|
-
title
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
if (!action && !actionSecondary) {
|
|
115
|
+
if (!action) {
|
|
198
116
|
return (
|
|
199
117
|
<Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>
|
|
200
|
-
{
|
|
118
|
+
{title}
|
|
201
119
|
</Title>
|
|
202
120
|
);
|
|
203
121
|
}
|
|
204
122
|
|
|
205
|
-
if (!hasActionCorner) {
|
|
206
|
-
return (
|
|
207
|
-
<div {...commonProps} {...props} ref={ref}>
|
|
208
|
-
<Title as={as} type={levelTypography} className="np-header__title">
|
|
209
|
-
{titleContent}
|
|
210
|
-
</Title>
|
|
211
|
-
{renderAction(action, 'action')}
|
|
212
|
-
</div>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
123
|
return (
|
|
217
124
|
<div {...commonProps} {...props} ref={ref}>
|
|
218
125
|
<Title as={as} type={levelTypography} className="np-header__title">
|
|
219
|
-
{
|
|
126
|
+
{title}
|
|
220
127
|
</Title>
|
|
221
|
-
<
|
|
222
|
-
{actionSecondary && renderAction(actionSecondary, 'actionSecondary')}
|
|
223
|
-
{action && renderAction(action, 'action')}
|
|
224
|
-
</div>
|
|
128
|
+
<HeaderAction action={action} />
|
|
225
129
|
</div>
|
|
226
130
|
);
|
|
227
131
|
},
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { Plus, Settings } from '@transferwise/icons';
|
|
2
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
-
import Body from '../../Body';
|
|
4
|
-
import { Typography } from '../../common';
|
|
5
2
|
import Header, { HeaderProps } from '..';
|
|
6
3
|
import {
|
|
7
4
|
createSandboxStory,
|
|
@@ -56,29 +53,10 @@ const meta: Meta<typeof Header> = {
|
|
|
56
53
|
action: {
|
|
57
54
|
table: {
|
|
58
55
|
type: {
|
|
59
|
-
summary: 'HeaderAction
|
|
56
|
+
summary: 'HeaderAction',
|
|
60
57
|
},
|
|
61
58
|
},
|
|
62
|
-
description:
|
|
63
|
-
'Defines an optional action associated with the header: a `text` link, a `HeaderActionButton` (`label` or `icon`) rendered as a button, or any other node.',
|
|
64
|
-
},
|
|
65
|
-
actionSecondary: {
|
|
66
|
-
control: false,
|
|
67
|
-
table: {
|
|
68
|
-
type: {
|
|
69
|
-
summary: 'HeaderActionButton | ReactNode',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
description: 'A second action, at a lower emphasis, rendered before `action`.',
|
|
73
|
-
},
|
|
74
|
-
titleAction: {
|
|
75
|
-
control: false,
|
|
76
|
-
table: {
|
|
77
|
-
type: {
|
|
78
|
-
summary: 'HeaderTitleAction',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
description: 'Makes the title a link with a trailing chevron.',
|
|
59
|
+
description: 'Defines an optional action (e.g., button or link) associated with the header.',
|
|
82
60
|
},
|
|
83
61
|
},
|
|
84
62
|
args: {
|
|
@@ -192,76 +170,3 @@ export const SectionLevel: Story = {
|
|
|
192
170
|
},
|
|
193
171
|
argTypes: hideControls(['action', 'as', 'className', 'title', 'testId']),
|
|
194
172
|
};
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* `titleAction` turns the title into a link to its own screen and appends a chevron, which stays
|
|
198
|
-
* on the title's last line when it wraps.
|
|
199
|
-
*/
|
|
200
|
-
export const TitleAction: Story = {
|
|
201
|
-
args: {
|
|
202
|
-
title: 'Cards',
|
|
203
|
-
titleAction: { href: '#cards' },
|
|
204
|
-
},
|
|
205
|
-
argTypes: hideControls(['action', 'actionSecondary', 'as', 'className', 'testId']),
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* A `HeaderActionButton` (an object with a `label` or an `icon`) renders as a small button.
|
|
210
|
-
* Emphasis comes from the slot: `action` is the louder one, anchored to the inline end, and
|
|
211
|
-
* `actionSecondary` sits before it at a lower emphasis. An icon-only action requires an
|
|
212
|
-
* `aria-label`.
|
|
213
|
-
*/
|
|
214
|
-
export const ActionButtons: Story = {
|
|
215
|
-
render: (args) => (
|
|
216
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px', width: '480px' }}>
|
|
217
|
-
<Header
|
|
218
|
-
{...args}
|
|
219
|
-
title="Leading action"
|
|
220
|
-
action={{ label: 'Order card', icon: <Plus size={16} /> }}
|
|
221
|
-
/>
|
|
222
|
-
<Header {...args} title="Secondary action only" actionSecondary={{ label: 'Manage' }} />
|
|
223
|
-
<Header
|
|
224
|
-
{...args}
|
|
225
|
-
title="Both actions"
|
|
226
|
-
titleAction={{ href: '#cards' }}
|
|
227
|
-
action={{ label: 'Order card', icon: <Plus size={16} /> }}
|
|
228
|
-
actionSecondary={{ 'aria-label': 'Card settings', icon: <Settings size={16} /> }}
|
|
229
|
-
/>
|
|
230
|
-
</div>
|
|
231
|
-
),
|
|
232
|
-
argTypes: hideControls([
|
|
233
|
-
'action',
|
|
234
|
-
'actionSecondary',
|
|
235
|
-
'titleAction',
|
|
236
|
-
'title',
|
|
237
|
-
'className',
|
|
238
|
-
'testId',
|
|
239
|
-
]),
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Either action slot also takes any node, rendered as given in place of the action buttons.
|
|
244
|
-
*/
|
|
245
|
-
export const CustomAction: Story = {
|
|
246
|
-
render: (args) => (
|
|
247
|
-
<div style={{ width: '480px' }}>
|
|
248
|
-
<Header
|
|
249
|
-
{...args}
|
|
250
|
-
title="Balance"
|
|
251
|
-
action={
|
|
252
|
-
<Body as="span" type={Typography.BODY_DEFAULT_BOLD}>
|
|
253
|
-
£1,240.00
|
|
254
|
-
</Body>
|
|
255
|
-
}
|
|
256
|
-
/>
|
|
257
|
-
</div>
|
|
258
|
-
),
|
|
259
|
-
argTypes: hideControls([
|
|
260
|
-
'action',
|
|
261
|
-
'actionSecondary',
|
|
262
|
-
'titleAction',
|
|
263
|
-
'title',
|
|
264
|
-
'className',
|
|
265
|
-
'testId',
|
|
266
|
-
]),
|
|
267
|
-
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Plus, Settings } from '@transferwise/icons';
|
|
2
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
2
|
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
3
|
import Header, { type HeaderProps } from '../Header';
|
|
@@ -121,26 +120,6 @@ export const AllVariants: Story = {
|
|
|
121
120
|
href: 'https://wise.com',
|
|
122
121
|
}}
|
|
123
122
|
/>
|
|
124
|
-
{(['section', 'group'] as const).map((level) => (
|
|
125
|
-
<Header
|
|
126
|
-
key={`title-link-${level}`}
|
|
127
|
-
as="h2"
|
|
128
|
-
level={level}
|
|
129
|
-
title={`Header level ${level} with title link`}
|
|
130
|
-
titleAction={{ href: '#target' }}
|
|
131
|
-
/>
|
|
132
|
-
))}
|
|
133
|
-
{(['section', 'group'] as const).map((level) => (
|
|
134
|
-
<Header
|
|
135
|
-
key={`buttons-${level}`}
|
|
136
|
-
as="h2"
|
|
137
|
-
level={level}
|
|
138
|
-
title={`Header level ${level} with action buttons`}
|
|
139
|
-
titleAction={{ href: '#target' }}
|
|
140
|
-
action={{ label: 'Order card', icon: <Plus size={16} /> }}
|
|
141
|
-
actionSecondary={{ 'aria-label': 'Settings', icon: <Settings size={16} /> }}
|
|
142
|
-
/>
|
|
143
|
-
))}
|
|
144
123
|
</div>
|
|
145
124
|
),
|
|
146
125
|
};
|
|
@@ -168,13 +147,6 @@ export const RTLDiff: Story = {
|
|
|
168
147
|
level="section"
|
|
169
148
|
action={{ 'aria-label': i18n.learnMore, text: i18n.learnMore, href: '#' }}
|
|
170
149
|
/>
|
|
171
|
-
<Header
|
|
172
|
-
title={i18n.groupWithButtons}
|
|
173
|
-
level="group"
|
|
174
|
-
titleAction={{ href: '#' }}
|
|
175
|
-
action={{ label: i18n.viewAll, icon: <Plus size={16} /> }}
|
|
176
|
-
actionSecondary={{ 'aria-label': i18n.learnMore, icon: <Settings size={16} /> }}
|
|
177
|
-
/>
|
|
178
150
|
</div>
|
|
179
151
|
);
|
|
180
152
|
},
|
|
@@ -185,10 +157,6 @@ export const RTLDiff: Story = {
|
|
|
185
157
|
groupWithAction: { en: 'Group level with action', ar: 'مستوى المجموعة مع إجراء' },
|
|
186
158
|
sectionWithoutAction: { en: 'Section level without action', ar: 'مستوى القسم بدون إجراء' },
|
|
187
159
|
sectionWithAction: { en: 'Section level with action', ar: 'مستوى القسم مع إجراء' },
|
|
188
|
-
groupWithButtons: {
|
|
189
|
-
en: 'Group level with action buttons',
|
|
190
|
-
ar: 'مستوى المجموعة مع أزرار الإجراءات',
|
|
191
|
-
},
|
|
192
160
|
viewAll: { en: 'View all', ar: 'عرض الكل' },
|
|
193
161
|
learnMore: { en: 'Learn more', ar: 'اعرف المزيد' },
|
|
194
162
|
},
|
package/src/Header/index.ts
CHANGED