@transferwise/components 0.0.0-experimental-9f96230 → 0.0.0-experimental-9b505c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/accordion/AccordionItem/AccordionItem.js +22 -3
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +22 -3
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +22 -1
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +22 -1
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +24 -2
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +24 -2
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +21 -5
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +21 -5
- package/build/alert/Alert.mjs.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js +25 -2
- package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs +25 -2
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs.map +1 -1
- package/build/avatar/Avatar.js +25 -9
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +25 -9
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +23 -3
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +23 -3
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +24 -12
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +24 -12
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js +22 -3
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +22 -3
- package/build/button/Button.mjs.map +1 -1
- package/build/button/classMap.js +24 -0
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs +24 -0
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +24 -2
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +24 -2
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/card/Card.js +23 -3
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +23 -3
- package/build/card/Card.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +23 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +23 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/chevron/Chevron.js +21 -1
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +21 -1
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +19 -1
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +19 -1
- package/build/chips/Chip.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +24 -5
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +24 -5
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +3 -2
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +3 -2
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/circle/Circle.js +15 -2
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +15 -2
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/hooks/useHasIntersected/useHasIntersected.js +10 -10
- package/build/common/hooks/useHasIntersected/useHasIntersected.js.map +1 -1
- package/build/common/hooks/useHasIntersected/useHasIntersected.mjs +10 -10
- package/build/common/hooks/useHasIntersected/useHasIntersected.mjs.map +1 -1
- package/build/common/locale/index.js +24 -0
- package/build/common/locale/index.js.map +1 -1
- package/build/common/locale/index.mjs +24 -0
- package/build/common/locale/index.mjs.map +1 -1
- package/build/common/panel/Panel.js +23 -2
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +23 -2
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +27 -3
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +27 -3
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +22 -3
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +22 -3
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +22 -5
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +22 -5
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +24 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +24 -6
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +26 -5
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +26 -5
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +19 -3
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +19 -3
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/decision/Decision.js +24 -3
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +24 -3
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +23 -1
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +23 -1
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +24 -2
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +24 -2
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +23 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +23 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +22 -3
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +22 -3
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/field/Field.js +23 -2
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +23 -2
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +19 -2
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +19 -2
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js +24 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +24 -2
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/en.json +0 -5
- package/build/i18n/en.json.js +0 -5
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -5
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/image/Image.js +4 -1
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +4 -1
- package/build/image/Image.mjs.map +1 -1
- package/build/index.js +69 -62
- package/build/index.js.map +1 -1
- package/build/index.mjs +27 -20
- package/build/index.mjs.map +1 -1
- package/build/info/Info.js +21 -3
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +21 -3
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +24 -3
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +24 -3
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/SearchInput.js +23 -2
- package/build/inputs/SearchInput.js.map +1 -1
- package/build/inputs/SearchInput.mjs +23 -2
- package/build/inputs/SearchInput.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +22 -1
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +22 -1
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/loader/Loader.js +22 -1
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +22 -1
- package/build/loader/Loader.mjs.map +1 -1
- package/build/main.css +46 -322
- package/build/markdown/Markdown.js +24 -1
- package/build/markdown/Markdown.js.map +1 -1
- package/build/markdown/Markdown.mjs +24 -1
- package/build/markdown/Markdown.mjs.map +1 -1
- package/build/modal/Modal.js +22 -5
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +22 -5
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +22 -3
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +22 -3
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/navigationOption/NavigationOption.js +23 -2
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +23 -2
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +19 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +19 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +19 -1
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +19 -1
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +23 -2
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +23 -2
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/popover/Popover.js +24 -4
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +24 -4
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +22 -1
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +22 -1
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +24 -2
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +24 -2
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +22 -2
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +22 -2
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +22 -1
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +22 -1
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/provider/Provider.js +25 -2
- package/build/provider/Provider.js.map +1 -1
- package/build/provider/Provider.mjs +25 -2
- package/build/provider/Provider.mjs.map +1 -1
- package/build/radio/Radio.js +24 -2
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +24 -2
- package/build/radio/Radio.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +22 -1
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +22 -1
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +26 -4
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +26 -4
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +22 -1
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +22 -1
- package/build/select/option/Option.mjs.map +1 -1
- package/build/selectOption/SelectOption.js +24 -6
- package/build/selectOption/SelectOption.js.map +1 -1
- package/build/selectOption/SelectOption.mjs +24 -6
- package/build/selectOption/SelectOption.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +26 -8
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +26 -8
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +25 -3
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +25 -3
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/sticky/Sticky.js +25 -2
- package/build/sticky/Sticky.js.map +1 -1
- package/build/sticky/Sticky.mjs +25 -2
- package/build/sticky/Sticky.mjs.map +1 -1
- package/build/styles/avatar/Avatar.css +29 -0
- package/build/styles/badge/Badge.css +6 -0
- package/build/styles/circularButton/CircularButton.css +2 -2
- package/build/styles/common/circle/Circle.css +4 -0
- package/build/styles/main.css +46 -322
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/summary/Summary.js +21 -5
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +21 -5
- package/build/summary/Summary.mjs.map +1 -1
- package/build/tabs/Tabs.js +23 -3
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +23 -3
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +24 -2
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +24 -2
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +23 -1
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +23 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +22 -1
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +22 -1
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +22 -4
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +22 -4
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/fakeEvents.d.ts +23 -0
- package/build/types/common/fakeEvents.d.ts.map +1 -0
- package/build/types/common/hooks/index.d.ts +4 -4
- package/build/types/common/hooks/index.d.ts.map +1 -1
- package/build/types/common/hooks/useConditionalListener/index.d.ts +1 -1
- package/build/types/common/hooks/useConditionalListener/index.d.ts.map +1 -1
- package/build/types/common/hooks/useDirection/index.d.ts +1 -1
- package/build/types/common/hooks/useDirection/index.d.ts.map +1 -1
- package/build/types/common/hooks/useHasIntersected/index.d.ts +1 -1
- package/build/types/common/hooks/useHasIntersected/index.d.ts.map +1 -1
- package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts +15 -4
- package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts.map +1 -1
- package/build/types/common/index.d.ts +28 -28
- package/build/types/common/index.d.ts.map +1 -1
- package/build/types/common/responsivePanel/index.d.ts +1 -1
- package/build/types/common/responsivePanel/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/navigationOption/NavigationOption.d.ts +1 -0
- package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +7 -3
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/upload/Upload.js +21 -2
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +21 -2
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +25 -3
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +25 -3
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +23 -3
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +23 -3
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +22 -3
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +22 -3
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +21 -2
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +21 -2
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadButton/defaults.js +24 -0
- package/build/uploadInput/uploadButton/defaults.js.map +1 -1
- package/build/uploadInput/uploadButton/defaults.mjs +24 -0
- package/build/uploadInput/uploadButton/defaults.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +21 -4
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +21 -4
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +25 -1
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +25 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.css +29 -0
- package/src/avatar/Avatar.less +12 -0
- package/src/avatar/Avatar.tsx +4 -8
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -22
- package/src/badge/Badge.css +6 -0
- package/src/badge/Badge.less +6 -0
- package/src/badge/Badge.tsx +1 -11
- package/src/circularButton/CircularButton.css +2 -2
- package/src/circularButton/CircularButton.less +1 -1
- package/src/circularButton/CircularButton.story.tsx +3 -0
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
- package/src/common/circle/Circle.css +4 -0
- package/src/common/circle/Circle.less +6 -0
- package/src/common/circle/Circle.story.tsx +2 -2
- package/src/common/circle/Circle.tsx +25 -2
- package/src/common/{fakeEvents.js → fakeEvents.ts} +1 -1
- package/src/common/hooks/useHasIntersected/{useHasIntersected.js → useHasIntersected.ts} +20 -11
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -8
- package/src/i18n/en.json +0 -5
- package/src/index.ts +1 -0
- package/src/main.css +46 -322
- package/src/main.less +0 -1
- package/src/navigationOption/{NavigationOption.story.js → NavigationOption.story.tsx} +23 -5
- package/src/navigationOption/NavigationOption.tsx +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -4
- package/src/promoCard/PromoCard.spec.tsx +1 -1
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -4
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.spec.tsx +2 -21
- package/src/statusIcon/StatusIcon.story.tsx +32 -1
- package/src/statusIcon/StatusIcon.tsx +11 -10
- package/build/styles/table/Table.css +0 -300
- package/build/types/table/Table.d.ts +0 -24
- package/build/types/table/Table.d.ts.map +0 -1
- package/build/types/table/Table.messages.d.ts +0 -24
- package/build/types/table/Table.messages.d.ts.map +0 -1
- package/build/types/table/TableCell.d.ts +0 -44
- package/build/types/table/TableCell.d.ts.map +0 -1
- package/build/types/table/TableHeader.d.ts +0 -13
- package/build/types/table/TableHeader.d.ts.map +0 -1
- package/build/types/table/TableRow.d.ts +0 -17
- package/build/types/table/TableRow.d.ts.map +0 -1
- package/build/types/table/TableStatusText.d.ts +0 -9
- package/build/types/table/TableStatusText.d.ts.map +0 -1
- package/build/types/table/index.d.ts +0 -6
- package/build/types/table/index.d.ts.map +0 -1
- package/src/common/requirements.js +0 -440
- package/src/table/Table.css +0 -300
- package/src/table/Table.less +0 -361
- package/src/table/Table.messages.ts +0 -24
- package/src/table/Table.spec.tsx +0 -89
- package/src/table/Table.story.tsx +0 -364
- package/src/table/Table.tsx +0 -167
- package/src/table/TableCell.spec.tsx +0 -304
- package/src/table/TableCell.tsx +0 -170
- package/src/table/TableHeader.spec.tsx +0 -55
- package/src/table/TableHeader.tsx +0 -75
- package/src/table/TableRow.spec.tsx +0 -117
- package/src/table/TableRow.tsx +0 -67
- package/src/table/TableStatusText.spec.tsx +0 -53
- package/src/table/TableStatusText.tsx +0 -36
- package/src/table/index.ts +0 -11
- /package/src/common/hooks/{index.js → index.ts} +0 -0
- /package/src/common/hooks/useConditionalListener/{index.js → index.ts} +0 -0
- /package/src/common/hooks/useDirection/{index.js → index.ts} +0 -0
- /package/src/common/hooks/useHasIntersected/{index.js → index.ts} +0 -0
- /package/src/common/{index.js → index.ts} +0 -0
- /package/src/common/responsivePanel/{index.js → index.ts} +0 -0
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import TableCell, {
|
|
4
|
-
TableCellCurrency,
|
|
5
|
-
TableCellLeading,
|
|
6
|
-
TableCellStatus,
|
|
7
|
-
TableCellText,
|
|
8
|
-
} from './TableCell';
|
|
9
|
-
import { IntlProvider } from 'react-intl';
|
|
10
|
-
import { mockMatchMedia } from '../test-utils';
|
|
11
|
-
|
|
12
|
-
mockMatchMedia();
|
|
13
|
-
|
|
14
|
-
describe('TableCell Component', () => {
|
|
15
|
-
const cellContentMocks = {
|
|
16
|
-
leading: {
|
|
17
|
-
type: 'leading',
|
|
18
|
-
primaryText: 'Alice Johnson',
|
|
19
|
-
secondaryText: 'Frontend Developer',
|
|
20
|
-
avatar: {
|
|
21
|
-
fullName: 'Alice Johnson',
|
|
22
|
-
},
|
|
23
|
-
} satisfies TableCellLeading,
|
|
24
|
-
text: {
|
|
25
|
-
type: 'text',
|
|
26
|
-
text: 'JP, Tokyo',
|
|
27
|
-
} satisfies TableCellText,
|
|
28
|
-
currency: {
|
|
29
|
-
type: 'currency',
|
|
30
|
-
primaryCurrency: {
|
|
31
|
-
value: '56789.01',
|
|
32
|
-
currency: 'jpy',
|
|
33
|
-
},
|
|
34
|
-
secondaryCurrency: {
|
|
35
|
-
value: '51000.00',
|
|
36
|
-
currency: 'gbp',
|
|
37
|
-
},
|
|
38
|
-
} satisfies TableCellCurrency,
|
|
39
|
-
status: {
|
|
40
|
-
type: 'status',
|
|
41
|
-
primaryText: 'Overdue',
|
|
42
|
-
secondaryText: '6 days ago',
|
|
43
|
-
sentiment: 'pending',
|
|
44
|
-
} satisfies TableCellStatus,
|
|
45
|
-
custom: <div>Custom content</div>,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const renderWithIntl = (component: React.ReactElement) => {
|
|
49
|
-
return render(<IntlProvider locale="en">{component}</IntlProvider>);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
it('renders without content', () => {
|
|
53
|
-
renderWithIntl(<TableCell />);
|
|
54
|
-
expect(screen.getByRole('cell')).toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('applies `right` alignment class', () => {
|
|
58
|
-
renderWithIntl(<TableCell alignment="right" />);
|
|
59
|
-
expect(screen.getByRole('cell')).toHaveClass('np-table-cell--right');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('applies reversed class for cell with image and `right` alignment', () => {
|
|
63
|
-
renderWithIntl(<TableCell cell={cellContentMocks.currency} alignment="right" />);
|
|
64
|
-
expect(screen.getByTestId('np-table-content')).toHaveClass('np-table-content--reversed');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('applies custom class', () => {
|
|
68
|
-
renderWithIntl(<TableCell className="custom-class" />);
|
|
69
|
-
expect(screen.getByRole('cell')).toHaveClass('custom-class');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders with spanned columns', () => {
|
|
73
|
-
renderWithIntl(<TableCell colSpan={2} />);
|
|
74
|
-
expect(screen.getByRole('cell')).toHaveAttribute('colSpan', '2');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('renders with `children` as a content', () => {
|
|
78
|
-
renderWithIntl(<TableCell>{cellContentMocks.custom}</TableCell>);
|
|
79
|
-
expect(screen.getByText('Custom content')).toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders `text` cell type', () => {
|
|
83
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.text }} />);
|
|
84
|
-
expect(screen.getByText('JP, Tokyo')).toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('renders `text` cell type with error', () => {
|
|
88
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.text, status: 'error' }} />);
|
|
89
|
-
expect(screen.getByText('JP, Tokyo')).toHaveClass('np-table-content--error');
|
|
90
|
-
expect(screen.getByTestId('alert-icon')).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('renders `text` cell type with success', () => {
|
|
94
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.text, status: 'success' }} />);
|
|
95
|
-
expect(screen.getByText('JP, Tokyo')).toHaveClass('np-table-content--success');
|
|
96
|
-
expect(screen.getByTestId('check-icon')).toBeInTheDocument();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('renders `leading` cell type with initials avatar when `fullName` is provided', () => {
|
|
100
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.leading }} />);
|
|
101
|
-
expect(screen.getByText('AJ')).toBeInTheDocument();
|
|
102
|
-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
|
|
103
|
-
expect(screen.getByText('Frontend Developer')).toBeInTheDocument();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('renders `leading` cell type without media content when `fullName` is not provided', () => {
|
|
107
|
-
renderWithIntl(
|
|
108
|
-
<TableCell
|
|
109
|
-
cell={{
|
|
110
|
-
...cellContentMocks.leading,
|
|
111
|
-
avatar: { fullName: undefined },
|
|
112
|
-
}}
|
|
113
|
-
/>,
|
|
114
|
-
);
|
|
115
|
-
expect(screen.queryByText('AJ')).not.toBeInTheDocument();
|
|
116
|
-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
|
|
117
|
-
expect(screen.getByText('Frontend Developer')).toBeInTheDocument();
|
|
118
|
-
expect(screen.queryByTestId('np-table-content-media')).not.toBeInTheDocument();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('renders `leading` cell without primary text if is not provided', () => {
|
|
122
|
-
renderWithIntl(
|
|
123
|
-
<TableCell
|
|
124
|
-
cell={{
|
|
125
|
-
...cellContentMocks.leading,
|
|
126
|
-
primaryText: undefined,
|
|
127
|
-
}}
|
|
128
|
-
/>,
|
|
129
|
-
);
|
|
130
|
-
expect(screen.getByText('AJ')).toBeInTheDocument();
|
|
131
|
-
expect(screen.queryByText('Alice Johnson')).not.toBeInTheDocument();
|
|
132
|
-
expect(screen.getByText('Frontend Developer')).toBeInTheDocument();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('renders `leading` cell without secondary text if it is not provided', () => {
|
|
136
|
-
renderWithIntl(
|
|
137
|
-
<TableCell
|
|
138
|
-
cell={{
|
|
139
|
-
...cellContentMocks.leading,
|
|
140
|
-
secondaryText: undefined,
|
|
141
|
-
}}
|
|
142
|
-
/>,
|
|
143
|
-
);
|
|
144
|
-
expect(screen.getByText('AJ')).toBeInTheDocument();
|
|
145
|
-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
|
|
146
|
-
expect(screen.queryByText('Frontend Developer')).not.toBeInTheDocument();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('applies an `error` class, renders an `alert-icon` for `leading` cell type with `error` status', () => {
|
|
150
|
-
renderWithIntl(
|
|
151
|
-
<TableCell
|
|
152
|
-
cell={{
|
|
153
|
-
...cellContentMocks.leading,
|
|
154
|
-
status: 'error',
|
|
155
|
-
}}
|
|
156
|
-
/>,
|
|
157
|
-
);
|
|
158
|
-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
|
|
159
|
-
expect(screen.getByText('Alice Johnson')).toHaveClass('np-table-content--error');
|
|
160
|
-
expect(screen.getByTestId('alert-icon')).toBeInTheDocument();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('applies a `success` class, renders an `check-icon` for `leading` cell type with `success` status', () => {
|
|
164
|
-
renderWithIntl(
|
|
165
|
-
<TableCell
|
|
166
|
-
cell={{
|
|
167
|
-
...cellContentMocks.leading,
|
|
168
|
-
status: 'success',
|
|
169
|
-
}}
|
|
170
|
-
/>,
|
|
171
|
-
);
|
|
172
|
-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
|
|
173
|
-
expect(screen.getByText('Alice Johnson')).toHaveClass('np-table-content--success');
|
|
174
|
-
expect(screen.getByTestId('check-icon')).toBeInTheDocument();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('renders `currency` cell type', () => {
|
|
178
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.currency }} alignment="right" />);
|
|
179
|
-
expect(screen.getByTestId('np-table-content-media')).toBeInTheDocument();
|
|
180
|
-
expect(screen.getByText('56,789 JPY')).toBeInTheDocument();
|
|
181
|
-
expect(screen.getByText('51,000.00 GBP')).toBeInTheDocument();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('renders `currency` cell without media content when currency value of `primaryCurrency` is not provided', () => {
|
|
185
|
-
renderWithIntl(
|
|
186
|
-
<TableCell
|
|
187
|
-
cell={{
|
|
188
|
-
...cellContentMocks.currency,
|
|
189
|
-
primaryCurrency: {
|
|
190
|
-
value: cellContentMocks.currency.primaryCurrency.value,
|
|
191
|
-
currency: '',
|
|
192
|
-
},
|
|
193
|
-
}}
|
|
194
|
-
alignment="right"
|
|
195
|
-
/>,
|
|
196
|
-
);
|
|
197
|
-
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
|
198
|
-
expect(screen.getByText('56,789.01')).toBeInTheDocument();
|
|
199
|
-
expect(screen.getByText('51,000.00 GBP')).toBeInTheDocument();
|
|
200
|
-
expect(screen.queryByTestId('np-table-content-media')).not.toBeInTheDocument();
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it('renders `currency` cell without primary currency when it is not provided', () => {
|
|
204
|
-
renderWithIntl(
|
|
205
|
-
<TableCell
|
|
206
|
-
cell={{
|
|
207
|
-
...cellContentMocks.currency,
|
|
208
|
-
primaryCurrency: undefined,
|
|
209
|
-
}}
|
|
210
|
-
alignment="right"
|
|
211
|
-
/>,
|
|
212
|
-
);
|
|
213
|
-
expect(screen.queryByText('56,789 JPY')).not.toBeInTheDocument();
|
|
214
|
-
expect(screen.getByText('51,000.00 GBP')).toBeInTheDocument();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('renders `currency` cell without secondary currency when it is not provided', () => {
|
|
218
|
-
renderWithIntl(
|
|
219
|
-
<TableCell
|
|
220
|
-
cell={{
|
|
221
|
-
...cellContentMocks.currency,
|
|
222
|
-
secondaryCurrency: undefined,
|
|
223
|
-
}}
|
|
224
|
-
alignment="right"
|
|
225
|
-
/>,
|
|
226
|
-
);
|
|
227
|
-
expect(screen.getByText('56,789 JPY')).toBeInTheDocument();
|
|
228
|
-
expect(screen.queryByText('51,000.00 GBP')).not.toBeInTheDocument();
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('renders `currency` cell with error content', () => {
|
|
232
|
-
renderWithIntl(
|
|
233
|
-
<TableCell
|
|
234
|
-
cell={{
|
|
235
|
-
...cellContentMocks.currency,
|
|
236
|
-
status: 'error',
|
|
237
|
-
}}
|
|
238
|
-
alignment="right"
|
|
239
|
-
/>,
|
|
240
|
-
);
|
|
241
|
-
expect(screen.getByText('56,789 JPY')).toBeInTheDocument();
|
|
242
|
-
expect(screen.getByText('56,789 JPY')).toHaveClass('np-table-content--error');
|
|
243
|
-
expect(screen.getByTestId('alert-icon')).toBeInTheDocument();
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('renders `currency` cell with `success` content', () => {
|
|
247
|
-
renderWithIntl(
|
|
248
|
-
<TableCell
|
|
249
|
-
cell={{
|
|
250
|
-
...cellContentMocks.currency,
|
|
251
|
-
status: 'success',
|
|
252
|
-
}}
|
|
253
|
-
alignment="right"
|
|
254
|
-
/>,
|
|
255
|
-
);
|
|
256
|
-
expect(screen.getByText('56,789 JPY')).toBeInTheDocument();
|
|
257
|
-
expect(screen.getByText('56,789 JPY')).toHaveClass('np-table-content--success');
|
|
258
|
-
expect(screen.getByTestId('check-icon')).toBeInTheDocument();
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('renders a `status` cell type content', () => {
|
|
262
|
-
renderWithIntl(<TableCell cell={{ ...cellContentMocks.status }} />);
|
|
263
|
-
expect(screen.getByTestId('status-icon')).toBeInTheDocument();
|
|
264
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('pending');
|
|
265
|
-
expect(screen.getByText('Overdue')).toBeInTheDocument();
|
|
266
|
-
expect(screen.getByText('6 days ago')).toBeInTheDocument();
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('renders an `info-icon` for `status` cell type if `sentiment` is not provided', () => {
|
|
270
|
-
renderWithIntl(
|
|
271
|
-
<TableCell
|
|
272
|
-
cell={{
|
|
273
|
-
...cellContentMocks.status,
|
|
274
|
-
sentiment: undefined,
|
|
275
|
-
}}
|
|
276
|
-
/>,
|
|
277
|
-
);
|
|
278
|
-
expect(screen.getByTestId('info-icon')).toBeInTheDocument();
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it('renders `status` cell type without `primary` text if it is not provided', () => {
|
|
282
|
-
renderWithIntl(
|
|
283
|
-
<TableCell
|
|
284
|
-
cell={{
|
|
285
|
-
...cellContentMocks.status,
|
|
286
|
-
primaryText: undefined,
|
|
287
|
-
}}
|
|
288
|
-
/>,
|
|
289
|
-
);
|
|
290
|
-
expect(screen.queryByText('Overdue')).not.toBeInTheDocument();
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it('renders `status` cell type without `secondary` text if it is not provided', () => {
|
|
294
|
-
renderWithIntl(
|
|
295
|
-
<TableCell
|
|
296
|
-
cell={{
|
|
297
|
-
...cellContentMocks.status,
|
|
298
|
-
secondaryText: undefined,
|
|
299
|
-
}}
|
|
300
|
-
/>,
|
|
301
|
-
);
|
|
302
|
-
expect(screen.queryByText('6 days ago')).not.toBeInTheDocument();
|
|
303
|
-
});
|
|
304
|
-
});
|
package/src/table/TableCell.tsx
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import TableStatusText from './TableStatusText';
|
|
2
|
-
import Avatar, { AvatarType } from '../avatar';
|
|
3
|
-
import StatusIcon from '../statusIcon';
|
|
4
|
-
import { Flag } from '@wise/art';
|
|
5
|
-
import { formatMoney } from '@transferwise/formatting';
|
|
6
|
-
import { useIntl } from 'react-intl';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { clsx } from 'clsx';
|
|
9
|
-
import { getInitials } from '../common';
|
|
10
|
-
import Image from '../image';
|
|
11
|
-
|
|
12
|
-
interface TableCellTypeProp {
|
|
13
|
-
type: 'leading' | 'text' | 'currency' | 'status';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// `Leading` and `Status` cell types have 2 text fields: `primaryText` and `secondaryText`
|
|
17
|
-
interface TableCellTextProps {
|
|
18
|
-
primaryText?: string;
|
|
19
|
-
secondaryText?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// `Leading`, `Text` and `Currency` cells' types can have a status indicator with `error` or `success` values
|
|
23
|
-
interface TableCellStatusProp {
|
|
24
|
-
status?: 'error' | 'success';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TableCellLeading
|
|
28
|
-
extends TableCellTypeProp,
|
|
29
|
-
TableCellTextProps,
|
|
30
|
-
TableCellStatusProp {
|
|
31
|
-
avatar?: {
|
|
32
|
-
src?: string;
|
|
33
|
-
fullName?: string;
|
|
34
|
-
backgroundColorSeed?: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface TableCellText extends TableCellTypeProp, TableCellStatusProp {
|
|
39
|
-
text?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface Currency {
|
|
43
|
-
value: string | number;
|
|
44
|
-
currency: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface TableCellCurrency extends TableCellTypeProp, TableCellStatusProp {
|
|
48
|
-
primaryCurrency?: Currency;
|
|
49
|
-
secondaryCurrency?: Currency;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface TableCellStatus extends TableCellTypeProp, TableCellTextProps {
|
|
53
|
-
sentiment?: 'negative' | 'neutral' | 'positive' | 'warning' | 'pending';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface TableCellType {
|
|
57
|
-
cell?: TableCellLeading & TableCellText & TableCellCurrency & TableCellStatus;
|
|
58
|
-
alignment?: 'right';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// These properties should be exported only on the lib level to prevent visual issues because of incorrect usage.
|
|
62
|
-
export interface TableCellProps extends TableCellType {
|
|
63
|
-
className?: string;
|
|
64
|
-
colSpan?: number;
|
|
65
|
-
children?: React.ReactNode;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const TableCell = ({ cell, alignment, className, colSpan, children }: TableCellProps) => {
|
|
69
|
-
const { locale } = useIntl();
|
|
70
|
-
|
|
71
|
-
const getContentMedia = () => {
|
|
72
|
-
let mediaContent = null;
|
|
73
|
-
|
|
74
|
-
if (cell?.type === 'leading' && (cell?.avatar?.src || cell?.avatar?.fullName)) {
|
|
75
|
-
const avatarType = cell?.avatar?.src ? AvatarType.THUMBNAIL : AvatarType.INITIALS;
|
|
76
|
-
|
|
77
|
-
mediaContent = (
|
|
78
|
-
<Avatar size={40} type={avatarType} backgroundColorSeed={cell?.avatar?.backgroundColorSeed}>
|
|
79
|
-
{avatarType === AvatarType.INITIALS &&
|
|
80
|
-
cell?.avatar?.fullName &&
|
|
81
|
-
getInitials(cell?.avatar?.fullName)}
|
|
82
|
-
{cell?.avatar?.src && <Image src={cell?.avatar?.src} alt="" />}
|
|
83
|
-
</Avatar>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (cell?.type === 'currency' && cell?.primaryCurrency?.currency) {
|
|
88
|
-
mediaContent = (
|
|
89
|
-
<Flag code={cell?.primaryCurrency?.currency?.toLowerCase()} intrinsicSize={24} />
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (cell?.type === 'status') {
|
|
94
|
-
mediaContent = <StatusIcon size="md" sentiment={cell?.sentiment ?? 'neutral'} />;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (mediaContent) {
|
|
98
|
-
return (
|
|
99
|
-
<div
|
|
100
|
-
role="presentation"
|
|
101
|
-
className="np-table-content-media"
|
|
102
|
-
data-testid="np-table-content-media"
|
|
103
|
-
>
|
|
104
|
-
{mediaContent}
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const formatCurrencyValue = (currency?: Currency) => {
|
|
111
|
-
if (currency) {
|
|
112
|
-
return formatMoney(Number(currency.value), currency.currency, locale, {
|
|
113
|
-
alwaysShowDecimals: true,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return '';
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<td
|
|
122
|
-
className={clsx(
|
|
123
|
-
'np-table-cell',
|
|
124
|
-
cell?.type ? `np-table-cell--${cell?.type}` : '',
|
|
125
|
-
className,
|
|
126
|
-
{
|
|
127
|
-
'np-table-cell--right': alignment === 'right',
|
|
128
|
-
},
|
|
129
|
-
)}
|
|
130
|
-
colSpan={colSpan}
|
|
131
|
-
>
|
|
132
|
-
{cell?.type === 'text' && cell?.text && (
|
|
133
|
-
<TableStatusText text={cell?.text} status={cell?.status} />
|
|
134
|
-
)}
|
|
135
|
-
{cell?.type && ['leading', 'currency', 'status'].includes(cell?.type) && (
|
|
136
|
-
<div
|
|
137
|
-
className={clsx('np-table-content', {
|
|
138
|
-
'np-table-content--reversed': alignment === 'right',
|
|
139
|
-
})}
|
|
140
|
-
data-testid="np-table-content"
|
|
141
|
-
>
|
|
142
|
-
{getContentMedia()}
|
|
143
|
-
<div className="np-table-content-body">
|
|
144
|
-
{(cell?.primaryCurrency ?? cell?.primaryText) && (
|
|
145
|
-
<TableStatusText
|
|
146
|
-
text={
|
|
147
|
-
cell?.type === 'currency'
|
|
148
|
-
? formatCurrencyValue(cell?.primaryCurrency)
|
|
149
|
-
: (cell?.primaryText ?? '')
|
|
150
|
-
}
|
|
151
|
-
status={cell?.type !== 'status' ? cell?.status : undefined}
|
|
152
|
-
typography="default-bold"
|
|
153
|
-
/>
|
|
154
|
-
)}
|
|
155
|
-
{(cell?.secondaryCurrency ?? cell?.secondaryText) && (
|
|
156
|
-
<div className="np-table-text-secondary">
|
|
157
|
-
{cell?.type === 'currency'
|
|
158
|
-
? formatCurrencyValue(cell?.secondaryCurrency)
|
|
159
|
-
: cell?.secondaryText}
|
|
160
|
-
</div>
|
|
161
|
-
)}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
)}
|
|
165
|
-
{children}
|
|
166
|
-
</td>
|
|
167
|
-
);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export default TableCell;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import TableHeader, { TableHeaderProps } from './TableHeader';
|
|
3
|
-
import { IntlProvider } from 'react-intl';
|
|
4
|
-
|
|
5
|
-
describe('TableHeader Component', () => {
|
|
6
|
-
const renderComponent = (props: Partial<TableHeaderProps> = {}) => {
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
header: '',
|
|
9
|
-
} satisfies TableHeaderProps;
|
|
10
|
-
return render(
|
|
11
|
-
<IntlProvider locale="en">
|
|
12
|
-
<TableHeader {...defaultProps} {...props} />
|
|
13
|
-
</IntlProvider>,
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
it('should render header', () => {
|
|
18
|
-
const { container } = renderComponent();
|
|
19
|
-
expect(container).toBeInTheDocument();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should render header text when provided', () => {
|
|
23
|
-
const headerText = 'Test Header';
|
|
24
|
-
renderComponent({ header: headerText });
|
|
25
|
-
expect(screen.getByText(headerText)).toBeInTheDocument();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should apply custom className', () => {
|
|
29
|
-
const className = 'custom-class';
|
|
30
|
-
renderComponent({ className });
|
|
31
|
-
expect(screen.getByRole('columnheader')).toHaveClass(className);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should align text to the right when alignment is set to right', () => {
|
|
35
|
-
renderComponent({ alignment: 'right' });
|
|
36
|
-
expect(screen.getByRole('columnheader')).toHaveClass('np-table-header--right');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("should show error class when status equals 'error'", () => {
|
|
40
|
-
renderComponent({ status: 'error' });
|
|
41
|
-
expect(screen.getByRole('columnheader')).toHaveClass('np-table-header--error');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should render empty header content when header is not provided', () => {
|
|
45
|
-
renderComponent();
|
|
46
|
-
expect(screen.getByTestId('np-table-empty-header').innerHTML).toBe(' ');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should render header with error status when status is `error`', () => {
|
|
50
|
-
const headerText = 'Test Header';
|
|
51
|
-
renderComponent({ header: headerText, status: 'error' });
|
|
52
|
-
expect(screen.getByText(headerText)).toHaveClass('np-table-content--error');
|
|
53
|
-
expect(screen.getByTestId('alert-icon')).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useIntl } from 'react-intl';
|
|
2
|
-
import messages from './Table.messages';
|
|
3
|
-
import TableStatusText from './TableStatusText';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
|
|
6
|
-
export interface TableHeaderType {
|
|
7
|
-
header?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
alignment?: 'right';
|
|
10
|
-
status?: 'error';
|
|
11
|
-
width?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface TableHeaderProps extends TableHeaderType {
|
|
15
|
-
isActionHeader?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const TableHeader: React.FC<TableHeaderProps> = ({
|
|
19
|
-
header,
|
|
20
|
-
className,
|
|
21
|
-
alignment,
|
|
22
|
-
status,
|
|
23
|
-
width,
|
|
24
|
-
isActionHeader = false,
|
|
25
|
-
}: TableHeaderProps) => {
|
|
26
|
-
const { formatMessage } = useIntl();
|
|
27
|
-
|
|
28
|
-
const getHeaderContent = () => {
|
|
29
|
-
if (isActionHeader) {
|
|
30
|
-
// `Action` header doesn't have visual text content, but it has the header, which is visible for screen readers only
|
|
31
|
-
return (
|
|
32
|
-
<TableStatusText
|
|
33
|
-
text={formatMessage(messages.actionHeader)}
|
|
34
|
-
className={`np-table-header-content${isActionHeader ? ' sr-only' : ''}`}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (header) {
|
|
40
|
-
return (
|
|
41
|
-
<TableStatusText
|
|
42
|
-
text={header}
|
|
43
|
-
className={`np-table-header-content${isActionHeader ? ' sr-only' : ''}`}
|
|
44
|
-
status={status}
|
|
45
|
-
typography="default-bold"
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If headers are empty, we still should render empty headers to keep visual consistency
|
|
51
|
-
return (
|
|
52
|
-
<div
|
|
53
|
-
className="np-table-header-content np-text-body-default-bold"
|
|
54
|
-
data-testid="np-table-empty-header"
|
|
55
|
-
>
|
|
56
|
-
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<th
|
|
63
|
-
className={clsx('np-table-header', className, {
|
|
64
|
-
'np-table-header--right': alignment === 'right',
|
|
65
|
-
'np-table-header--error': status === 'error',
|
|
66
|
-
'np-table-header--action': isActionHeader,
|
|
67
|
-
})}
|
|
68
|
-
style={{ minWidth: width, width }}
|
|
69
|
-
>
|
|
70
|
-
{getHeaderContent()}
|
|
71
|
-
</th>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default TableHeader;
|