@databiosphere/findable-ui 23.0.0 → 25.0.0
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/.release-please-manifest.json +1 -1
- package/.storybook/preview.js +4 -37
- package/CHANGELOG.md +64 -0
- package/jest.config.js +1 -0
- package/lib/common/entities.d.ts +1 -0
- package/lib/components/DataDictionary/components/Entities/constants.d.ts +2 -2
- package/lib/components/DataDictionary/components/Entities/constants.js +1 -1
- package/lib/components/DataDictionary/components/Entities/entities.js +3 -3
- package/lib/components/DataDictionary/components/Entity/constants.d.ts +2 -2
- package/lib/components/DataDictionary/components/Entity/constants.js +1 -1
- package/lib/components/DataDictionary/components/Entity/entity.js +4 -4
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +8 -0
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +36 -0
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +1 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.js +2 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.js +2 -2
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.js +17 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.styles.d.ts +13 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.styles.js +12 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.d.ts +9 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.js +9 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.js +86 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.d.ts +105 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.js +196 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.js +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.js +29 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.d.ts +4 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.js +70 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.d.ts +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.js +19 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.d.ts +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.js +11 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/args.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/args.js +96 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.js +16 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/types.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/utils.d.ts +14 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/utils.js +21 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.js +16 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.js +14 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.styles.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.styles.js +20 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.js +14 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.d.ts +13 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.js +5 -0
- package/lib/components/Index/components/EntitiesView/stories/entitiesView.stories.d.ts +8 -0
- package/lib/components/Index/components/EntitiesView/stories/entitiesView.stories.js +50 -0
- package/lib/components/Index/components/EntitiesView/types.d.ts +8 -0
- package/lib/components/Index/components/EntitiesView/types.js +1 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -16
- package/lib/components/Index/components/NTagCell/nTagCell.stories.js +8 -8
- package/lib/components/Index/components/TitleCell/titleCell.d.ts +6 -0
- package/lib/components/Index/components/TitleCell/titleCell.js +10 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +3 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.js +6 -0
- package/lib/components/Index/index.d.ts +2 -13
- package/lib/components/Index/index.js +6 -2
- package/lib/components/Index/index.stories.js +3 -2
- package/lib/components/Index/types.d.ts +12 -0
- package/lib/components/Index/types.js +1 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.d.ts +1 -1
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.js +5 -4
- package/lib/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.d.ts +6 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.js +18 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.js +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +29 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +6 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +13 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +9 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.js +5 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.d.ts +5 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.js +4 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +10 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +9 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +2 -2
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +5 -0
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +19 -0
- package/lib/components/Layout/components/Outline/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Outline/common/constants.js +1 -0
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Layout/components/Sidebar/components/SidebarButton/sidebarButton.js +2 -2
- package/lib/components/Loading/loading.d.ts +2 -1
- package/lib/components/Loading/loading.js +2 -2
- package/lib/components/Loading/loading.stories.d.ts +3 -31
- package/lib/components/Login/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Login/components/Section/components/Consent/consent.js +3 -3
- package/lib/components/Login/components/Section/components/Consent/consent.styles.d.ts +1 -1
- package/lib/components/Login/components/Section/components/Consent/consent.styles.js +2 -2
- package/lib/components/Login/components/Section/components/Consent/types.d.ts +2 -2
- package/lib/components/Login/login.stories.d.ts +6 -0
- package/lib/components/Login/login.stories.js +31 -0
- package/lib/components/NoResults/noResults.d.ts +1 -8
- package/lib/components/NoResults/noResults.js +9 -8
- package/lib/components/NoResults/noResults.styles.d.ts +2 -2
- package/lib/components/NoResults/noResults.styles.js +4 -2
- package/lib/components/NoResults/types.d.ts +8 -0
- package/lib/components/NoResults/types.js +1 -0
- package/lib/components/Plot/components/BarX/barX.d.ts +2 -0
- package/lib/components/Plot/components/BarX/barX.js +13 -0
- package/lib/components/Plot/components/BarX/types.d.ts +5 -0
- package/lib/components/Plot/components/BarX/types.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.js +17 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.js +4 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.d.ts +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.js +27 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.d.ts +9 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.js +38 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.js +11 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.js +9 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.js +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.d.ts +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.js +20 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.js +21 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.js +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.js +12 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.js +37 -0
- package/lib/components/Stepper/components/Step/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/constants.js +4 -0
- package/lib/components/Stepper/components/Step/step.d.ts +3 -0
- package/lib/components/Stepper/components/Step/step.js +6 -0
- package/lib/components/Stepper/components/Step/step.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/step.styles.js +31 -0
- package/lib/components/Stepper/components/Step/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/stories/contants.js +14 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.js +62 -0
- package/lib/components/Support/components/SupportRequest/components/Dialog/dialog.js +2 -2
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +16 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +28 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +5 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +46 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +3 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +21 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +2 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +37 -0
- package/lib/components/Table/components/Pagination/pagination.js +3 -4
- package/lib/components/Table/components/TableHead/tableHead.js +2 -2
- package/lib/components/Table/table.js +11 -11
- package/lib/components/TableCreator/common/constants.d.ts +6 -0
- package/lib/components/TableCreator/common/constants.js +19 -0
- package/lib/components/TableCreator/common/entities.d.ts +5 -0
- package/lib/components/TableCreator/common/entities.js +1 -0
- package/lib/components/TableCreator/tableCreator.js +1 -6
- package/lib/components/common/Alert/alert.stories.d.ts +6 -0
- package/lib/components/common/Alert/alert.stories.js +36 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +4 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +19 -0
- package/lib/components/common/AnchorLink/anchorLink.js +2 -2
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +7 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +5 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +19 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +10 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +16 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +21 -0
- package/lib/components/common/Breadcrumbs/breadcrumbs.js +2 -2
- package/lib/components/common/Breadcrumbs/typeGuard.d.ts +13 -0
- package/lib/components/common/Breadcrumbs/typeGuard.js +23 -0
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.js +2 -2
- package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +3 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.js +6 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +7 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +11 -0
- package/lib/components/common/Button/components/NavigationButton/navigationButton.js +2 -2
- package/lib/components/common/CopyToClipboard/copyToClipboard.js +2 -2
- package/lib/components/common/Dialog/components/DialogTitle/dialogTitle.js +2 -2
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.js +2 -2
- package/lib/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.d.ts +2 -3
- package/lib/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.js +3 -3
- package/lib/components/common/Form/components/UploadFile/uploadFile.js +2 -2
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +5 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +10 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +3 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +9 -0
- package/lib/components/common/IconButton/iconButton.styles.d.ts +1 -1
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.js +6 -2
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.js +6 -2
- package/lib/components/common/LoginDialog/loginDialog.styles.js +1 -1
- package/lib/components/common/Paper/paper.d.ts +2 -1
- package/lib/components/common/Paper/paper.js +2 -2
- package/lib/components/common/Section/components/CollapsableSection/collapsableSection.js +2 -3
- package/lib/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.d.ts +2 -0
- package/lib/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.js +10 -0
- package/lib/components/types.d.ts +3 -0
- package/lib/config/entities.d.ts +2 -0
- package/lib/hooks/useAuthentication/common/constants.d.ts +4 -0
- package/lib/hooks/useAuthentication/common/constants.js +19 -0
- package/lib/hooks/useAuthentication/common/entities.d.ts +25 -0
- package/lib/hooks/useAuthentication/common/entities.js +11 -0
- package/lib/hooks/useAuthentication/common/utils.d.ts +15 -0
- package/lib/hooks/useAuthentication/common/utils.js +25 -0
- package/lib/hooks/useAuthentication/useAuthentication.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthentication.js +9 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.js +55 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.js +88 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +18 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +50 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.js +32 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +21 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +41 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +18 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +24 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +15 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +62 -0
- package/lib/hooks/useAuthentication/useTokenClient.d.ts +11 -0
- package/lib/hooks/useAuthentication/useTokenClient.js +29 -0
- package/lib/hooks/useAuthenticationConfig.d.ts +6 -0
- package/lib/hooks/useAuthenticationConfig.js +14 -0
- package/lib/hooks/useCategoryConfigs.d.ts +6 -0
- package/lib/hooks/useCategoryConfigs.js +17 -0
- package/lib/hooks/useCategoryFilter.js +1 -0
- package/lib/hooks/useEntityListRelatedView.d.ts +15 -0
- package/lib/hooks/useEntityListRelatedView.js +62 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +15 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +27 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +5 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.js +11 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +9 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.js +37 -0
- package/lib/hooks/useLayoutState.d.ts +6 -0
- package/lib/hooks/useLayoutState.js +9 -0
- package/lib/hooks/useMenu.d.ts +10 -0
- package/lib/hooks/useMenu.js +17 -0
- package/lib/hooks/useMenuWithPosition.d.ts +14 -0
- package/lib/hooks/useMenuWithPosition.js +33 -0
- package/lib/hooks/useResizeObserver.d.ts +2 -1
- package/lib/hooks/useResizeObserver.js +5 -2
- package/lib/hooks/useSessionTimeout.d.ts +11 -0
- package/lib/hooks/useSessionTimeout.js +28 -0
- package/lib/providers/authentication.d.ts +51 -0
- package/lib/providers/authentication.js +110 -0
- package/lib/providers/layoutState.d.ts +40 -0
- package/lib/providers/layoutState.js +47 -0
- package/lib/storybook/controls/constants.d.ts +4 -0
- package/lib/storybook/controls/constants.js +6 -0
- package/lib/storybook/controls/types.d.ts +4 -0
- package/lib/storybook/controls/types.js +5 -0
- package/lib/storybook/controls/utils.d.ts +9 -0
- package/lib/storybook/controls/utils.js +10 -0
- package/lib/storybook/decorators.d.ts +2 -0
- package/lib/storybook/decorators.js +11 -0
- package/lib/storybook/loremIpsum.d.ts +4 -0
- package/lib/storybook/loremIpsum.js +4 -0
- package/lib/storybook/parameters.d.ts +2 -0
- package/lib/storybook/parameters.js +12 -0
- package/lib/styles/common/mui/palette.d.ts +47 -0
- package/lib/styles/common/mui/palette.js +47 -0
- package/lib/styles/common/mui/stepper.d.ts +7 -0
- package/lib/styles/common/mui/stepper.js +7 -0
- package/lib/styles/common/mui/svgIcon.d.ts +9 -0
- package/lib/styles/common/mui/svgIcon.js +26 -0
- package/lib/styles/common/mui/typography.js +1 -0
- package/lib/tests/mui/constants.d.ts +4 -0
- package/lib/tests/mui/constants.js +4 -0
- package/lib/theme/common/typography.d.ts +6 -2
- package/lib/theme/common/typography.js +10 -1
- package/lib/theme/theme.js +2 -0
- package/lib/utils/tests.d.ts +12 -0
- package/lib/utils/tests.js +20 -0
- package/lib/views/ExploreView/exploreView.js +4 -24
- package/package.json +6 -4
- package/src/common/entities.ts +1 -0
- package/src/components/DataDictionary/components/Entities/constants.ts +2 -2
- package/src/components/DataDictionary/components/Entities/entities.tsx +4 -4
- package/src/components/DataDictionary/components/Entity/constants.ts +2 -2
- package/src/components/DataDictionary/components/Entity/entity.tsx +6 -6
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +1 -1
- package/src/components/Filter/components/FilterLabel/filterLabel.tsx +2 -2
- package/src/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.tsx +2 -2
- package/src/components/Index/components/EntitiesView/components/ChartView/chartView.styles.ts +14 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/chartView.tsx +38 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.ts +13 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.ts +104 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.ts +229 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.ts +30 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.tsx +16 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.ts +74 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.tsx +29 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.ts +9 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.ts +8 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.ts +29 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/stories/args.ts +99 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.tsx +25 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/types.ts +7 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/utils.ts +26 -0
- package/src/components/Index/components/EntitiesView/components/EntityList/entityList.tsx +29 -0
- package/src/components/Index/components/EntitiesView/components/EntityList/types.ts +3 -0
- package/src/components/Index/components/EntitiesView/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/entitiesView.styles.ts +21 -0
- package/src/components/Index/components/EntitiesView/entitiesView.tsx +30 -0
- package/src/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.ts +15 -0
- package/src/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.ts +16 -0
- package/src/components/Index/components/EntitiesView/stories/entitiesView.stories.tsx +76 -0
- package/src/components/Index/components/EntitiesView/types.ts +9 -0
- package/src/components/Index/index.stories.tsx +3 -2
- package/src/components/Index/index.tsx +15 -15
- package/src/components/Index/types.ts +13 -0
- package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.tsx +19 -14
- package/src/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.tsx +24 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.tsx +3 -3
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.ts +8 -3
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.tsx +5 -2
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +2 -2
- package/src/components/Layout/components/Sidebar/components/SidebarButton/sidebarButton.tsx +2 -2
- package/src/components/Loading/loading.stories.tsx +2 -2
- package/src/components/Loading/loading.tsx +11 -3
- package/src/components/Login/components/Section/components/Consent/consent.styles.ts +2 -2
- package/src/components/Login/components/Section/components/Consent/consent.tsx +4 -4
- package/src/components/Login/components/Section/components/Consent/types.ts +2 -2
- package/src/components/NoResults/noResults.styles.ts +4 -2
- package/src/components/NoResults/noResults.tsx +16 -22
- package/src/components/NoResults/types.ts +13 -0
- package/src/components/Plot/components/BarX/barX.tsx +20 -0
- package/src/components/Plot/components/BarX/types.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.styles.ts +18 -0
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.tsx +16 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.tsx +20 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepIcon/constants.ts +1 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.ts +32 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.tsx +21 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.tsx +52 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.ts +14 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.tsx +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.tsx +30 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/constants.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.tsx +31 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.ts +7 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.tsx +9 -0
- package/src/components/Stepper/components/Step/components/StepLabel/constants.ts +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.ts +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/contants.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.tsx +48 -0
- package/src/components/Stepper/components/Step/constants.ts +6 -0
- package/src/components/Stepper/components/Step/step.styles.ts +33 -0
- package/src/components/Stepper/components/Step/step.tsx +12 -0
- package/src/components/Stepper/components/Step/stories/contants.ts +18 -0
- package/src/components/Stepper/components/Step/stories/step.stories.tsx +87 -0
- package/src/components/Support/components/SupportRequest/components/Dialog/dialog.tsx +2 -2
- package/src/components/Table/components/Pagination/pagination.tsx +3 -4
- package/src/components/Table/components/TableHead/tableHead.tsx +2 -2
- package/src/components/Table/table.tsx +42 -38
- package/src/components/TableCreator/tableCreator.tsx +8 -18
- package/src/components/common/AnchorLink/anchorLink.tsx +2 -2
- package/src/components/common/Breadcrumbs/breadcrumbs.tsx +2 -2
- package/src/components/common/Breadcrumbs/typeGuard.ts +24 -0
- package/src/components/common/Button/components/DropdownButton/dropdownButton.tsx +2 -2
- package/src/components/common/Button/components/NavigationButton/navigationButton.tsx +2 -2
- package/src/components/common/CopyToClipboard/copyToClipboard.tsx +2 -2
- package/src/components/common/Dialog/components/DialogTitle/dialogTitle.tsx +2 -2
- package/src/components/common/Drawer/components/DrawerTitle/drawerTitle.tsx +2 -2
- package/src/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.tsx +5 -6
- package/src/components/common/Form/components/UploadFile/uploadFile.tsx +2 -2
- package/src/components/common/KeyValuePairs/components/KeyElType/keyElType.tsx +14 -9
- package/src/components/common/KeyValuePairs/components/ValueElType/valueElType.tsx +8 -9
- package/src/components/common/LoginDialog/loginDialog.styles.ts +1 -1
- package/src/components/common/Paper/paper.tsx +9 -3
- package/src/components/common/Section/components/CollapsableSection/collapsableSection.tsx +2 -3
- package/src/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.ts +17 -0
- package/src/components/types.ts +4 -0
- package/src/config/entities.ts +2 -0
- package/src/hooks/useCategoryFilter.ts +1 -0
- package/src/hooks/useResizeObserver.ts +5 -2
- package/src/storybook/controls/constants.ts +12 -0
- package/src/storybook/controls/types.ts +4 -0
- package/src/storybook/controls/utils.ts +18 -0
- package/src/storybook/decorators.tsx +17 -0
- package/src/storybook/loremIpsum.ts +5 -0
- package/src/storybook/parameters.ts +14 -0
- package/src/styles/common/mui/palette.ts +47 -0
- package/src/styles/common/mui/stepper.ts +14 -0
- package/src/styles/common/mui/svgIcon.ts +35 -0
- package/src/styles/common/mui/typography.ts +1 -0
- package/src/tests/mui/constants.ts +4 -0
- package/src/theme/common/typography.ts +12 -1
- package/src/theme/theme.ts +2 -0
- package/src/utils/tests.ts +20 -0
- package/src/views/ExploreView/exploreView.tsx +8 -42
- package/tests/chart.test.tsx +170 -0
- package/tests/chartView.test.tsx +36 -0
- package/tests/entitiesView.test.tsx +36 -0
- package/tests/setup.ts +19 -0
- package/tests/stepIcon.test.tsx +42 -0
- package/types/data-explorer-ui.d.ts +39 -80
- package/src/components/Index/components/Cell/cell.tsx +0 -22
- package/src/components/Index/components/NTag/components/Tooltip/tooltip.styles.ts +0 -11
- package/src/components/Index/components/NTag/components/Tooltip/tooltip.tsx +0 -90
- package/src/components/Index/components/NTag/nTag.tsx +0 -25
- package/src/components/Index/components/NTagCell/nTagCell.stories.tsx +0 -22
- package/src/components/Index/components/NTagCell/nTagCell.tsx +0 -74
- package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.tsx +0 -16
- package/src/components/TableCreator/tableCreator.styles.ts +0 -5
|
@@ -15,11 +15,13 @@ export type ElementRect = {
|
|
|
15
15
|
* Element resizing and repositioning observer.
|
|
16
16
|
* @param ref - element to be observed for changes to its size or position.
|
|
17
17
|
* @param onResizeFn - action to be performed when the observed element is resized or repositioned.
|
|
18
|
+
* @param shouldObserve - boolean flag to determine if the observer should be active.
|
|
18
19
|
* @returns Element size and position properties for the given element.
|
|
19
20
|
*/
|
|
20
21
|
export function useResizeObserver(
|
|
21
22
|
ref: RefObject<HTMLElement>,
|
|
22
|
-
onResizeFn: (entries: ResizeObserverEntry[]) => Partial<ElementRect
|
|
23
|
+
onResizeFn: (entries: ResizeObserverEntry[]) => Partial<ElementRect>,
|
|
24
|
+
shouldObserve: boolean = true
|
|
23
25
|
): Partial<ElementRect> | undefined {
|
|
24
26
|
const [elementRect, setElementRect] = useState<Partial<ElementRect>>();
|
|
25
27
|
const observerRef = useRef<ResizeObserver>();
|
|
@@ -38,6 +40,7 @@ export function useResizeObserver(
|
|
|
38
40
|
// Creates a new ResizeObserver object which can be used to report changes to an "observed" element's dimensions or position.
|
|
39
41
|
useEffect(() => {
|
|
40
42
|
if (!ref.current) return;
|
|
43
|
+
if (!shouldObserve) return;
|
|
41
44
|
observerRef.current = new ResizeObserver(onResize);
|
|
42
45
|
const observer = observerRef.current;
|
|
43
46
|
const observedEl = ref.current;
|
|
@@ -45,7 +48,7 @@ export function useResizeObserver(
|
|
|
45
48
|
return (): void => {
|
|
46
49
|
observer.unobserve(observedEl);
|
|
47
50
|
};
|
|
48
|
-
}, [onResize, ref]);
|
|
51
|
+
}, [onResize, ref, shouldObserve]);
|
|
49
52
|
|
|
50
53
|
return elementRect;
|
|
51
54
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArgTypes } from "@storybook/react";
|
|
2
|
+
import { CONTROL_TYPE } from "./types";
|
|
3
|
+
|
|
4
|
+
export const CONTROL_CONFIG_MAP: Record<
|
|
5
|
+
CONTROL_TYPE,
|
|
6
|
+
ArgTypes[keyof ArgTypes]["control"]
|
|
7
|
+
> = {
|
|
8
|
+
[CONTROL_TYPE.BOOLEAN]: { type: "boolean" },
|
|
9
|
+
[CONTROL_TYPE.DISABLED]: false,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const MUI_CONTROLS = ["classes", "className", "ref", "sx"] as const;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args, ArgTypes } from "@storybook/react";
|
|
2
|
+
import { CONTROL_CONFIG_MAP } from "./constants";
|
|
3
|
+
import { CONTROL_TYPE } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configures controls for specified keys with the given control type.
|
|
7
|
+
* @param keys - ArgType keys.
|
|
8
|
+
* @param controlType - The type of control to apply (from CONTROL_TYPE enum).
|
|
9
|
+
* @returns An object of ArgTypes with the specified control configuration.
|
|
10
|
+
*/
|
|
11
|
+
export function configureControls<TArg = Args>(
|
|
12
|
+
keys: (keyof TArg)[],
|
|
13
|
+
controlType: CONTROL_TYPE
|
|
14
|
+
): Partial<ArgTypes<TArg>> {
|
|
15
|
+
return Object.fromEntries(
|
|
16
|
+
keys.map((key) => [key, { control: CONTROL_CONFIG_MAP[controlType] }])
|
|
17
|
+
) as Partial<ArgTypes<TArg>>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
2
|
+
import { CssBaseline, ThemeProvider } from "@mui/material";
|
|
3
|
+
import { Preview } from "@storybook/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { createAppTheme } from "../theme/theme";
|
|
6
|
+
|
|
7
|
+
export const decorators: Preview["decorators"] = (Story, context) => {
|
|
8
|
+
const theme = createAppTheme();
|
|
9
|
+
return (
|
|
10
|
+
<EmotionThemeProvider theme={theme}>
|
|
11
|
+
<ThemeProvider theme={theme}>
|
|
12
|
+
<CssBaseline />
|
|
13
|
+
<Story {...context} />
|
|
14
|
+
</ThemeProvider>
|
|
15
|
+
</EmotionThemeProvider>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const LOREM_IPSUM = {
|
|
2
|
+
LONG: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
|
3
|
+
SHORT:
|
|
4
|
+
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.",
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Preview } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
export const parameters: Preview["parameters"] = {
|
|
4
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
5
|
+
controls: {
|
|
6
|
+
expanded: true,
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/,
|
|
10
|
+
},
|
|
11
|
+
sort: "alpha",
|
|
12
|
+
},
|
|
13
|
+
layout: "centered",
|
|
14
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const PALETTE = {
|
|
2
|
+
ALERT_LIGHT: `var(--mui-palette-alert-light)`,
|
|
3
|
+
ALERT_LIGHTEST: `var(--mui-palette-alert-lightest)`,
|
|
4
|
+
ALERT_MAIN: `var(--mui-palette-alert-main)`,
|
|
5
|
+
BACKGROUND_DEFAULT: `var(--mui-palette-background-default)`,
|
|
6
|
+
BACKGROUND_PAPER: `var(--mui-palette-background-paper)`,
|
|
7
|
+
COMMON_BACKGROUND: `var(--mui-palette-common-background)`,
|
|
8
|
+
COMMON_BLACK: `var(--mui-palette-common-black)`,
|
|
9
|
+
COMMON_WHITE: `var(--mui-palette-common-white)`,
|
|
10
|
+
ERROR_CONTRAST_TEXT: `var(--mui-palette-error-contrastText)`,
|
|
11
|
+
ERROR_DARK: `var(--mui-palette-error-dark)`,
|
|
12
|
+
ERROR_LIGHT: `var(--mui-palette-error-light)`,
|
|
13
|
+
ERROR_MAIN: `var(--mui-palette-error-main)`,
|
|
14
|
+
INFO_CONTRAST_TEXT: `var(--mui-palette-info-contrastText)`,
|
|
15
|
+
INFO_DARK: `var(--mui-palette-info-dark)`,
|
|
16
|
+
INFO_LIGHT: `var(--mui-palette-info-light)`,
|
|
17
|
+
INFO_LIGHTEST: `var(--mui-palette-info-lightest)`,
|
|
18
|
+
INFO_MAIN: `var(--mui-palette-info-main)`,
|
|
19
|
+
INK_LIGHT: `var(--mui-palette-ink-light)`,
|
|
20
|
+
INK_MAIN: `var(--mui-palette-ink-main)`,
|
|
21
|
+
PRIMARY_CONTRAST_TEXT: `var(--mui-palette-primary-contrastText)`,
|
|
22
|
+
PRIMARY_DARK: `var(--mui-palette-primary-dark)`,
|
|
23
|
+
PRIMARY_LIGHT: `var(--mui-palette-primary-light)`,
|
|
24
|
+
PRIMARY_LIGHTEST: `var(--mui-palette-primary-lightest)`,
|
|
25
|
+
PRIMARY_MAIN: `var(--mui-palette-primary-main)`,
|
|
26
|
+
SECONDARY_CONTRAST_TEXT: `var(--mui-palette-secondary-contrastText)`,
|
|
27
|
+
SECONDARY_DARK: `var(--mui-palette-secondary-dark)`,
|
|
28
|
+
SECONDARY_LIGHT: `var(--mui-palette-secondary-light)`,
|
|
29
|
+
SECONDARY_MAIN: `var(--mui-palette-secondary-main)`,
|
|
30
|
+
SMOKE_DARK: `var(--mui-palette-smoke-dark)`,
|
|
31
|
+
SMOKE_LIGHT: `var(--mui-palette-smoke-light)`,
|
|
32
|
+
SMOKE_LIGHTEST: `var(--mui-palette-smoke-lightest)`,
|
|
33
|
+
SMOKE_MAIN: `var(--mui-palette-smoke-main)`,
|
|
34
|
+
SUCCESS_CONTRAST_TEXT: `var(--mui-palette-success-contrastText)`,
|
|
35
|
+
SUCCESS_DARK: `var(--mui-palette-success-dark)`,
|
|
36
|
+
SUCCESS_LIGHT: `var(--mui-palette-success-light)`,
|
|
37
|
+
SUCCESS_LIGHTEST: `var(--mui-palette-success-lightest)`,
|
|
38
|
+
SUCCESS_MAIN: `var(--mui-palette-success-main)`,
|
|
39
|
+
TEXT_DISABLED: `var(--mui-palette-text-disabled)`,
|
|
40
|
+
TEXT_PRIMARY: `var(--mui-palette-text-primary)`,
|
|
41
|
+
TEXT_SECONDARY: `var(--mui-palette-text-secondary)`,
|
|
42
|
+
WARNING_CONTRAST_TEXT: `var(--mui-palette-warning-contrastText)`,
|
|
43
|
+
WARNING_DARK: `var(--mui-palette-warning-dark)`,
|
|
44
|
+
WARNING_LIGHT: `var(--mui-palette-warning-light)`,
|
|
45
|
+
WARNING_LIGHTEST: `var(--mui-palette-warning-lightest)`,
|
|
46
|
+
WARNING_MAIN: `var(--mui-palette-warning-main)`,
|
|
47
|
+
} as const;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StepperProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type StepperPropsOptions = {
|
|
4
|
+
ORIENTATION: typeof ORIENTATION;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const ORIENTATION: Record<string, StepperProps["orientation"]> = {
|
|
8
|
+
HORIZONTAL: "horizontal",
|
|
9
|
+
VERTICAL: "vertical",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const STEPPER_PROPS: StepperPropsOptions = {
|
|
13
|
+
ORIENTATION,
|
|
14
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvgIconProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type SvgIconPropsOptions = {
|
|
4
|
+
COLOR: typeof COLOR;
|
|
5
|
+
FONT_SIZE: typeof FONT_SIZE;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const COLOR: Record<string, SvgIconProps["color"]> = {
|
|
9
|
+
ACTION: "action",
|
|
10
|
+
DISABLED: "disabled",
|
|
11
|
+
ERROR: "error",
|
|
12
|
+
INFO: "info",
|
|
13
|
+
INHERIT: "inherit",
|
|
14
|
+
INK_LIGHT: "inkLight",
|
|
15
|
+
INK_MAIN: "inkMain",
|
|
16
|
+
PRIMARY: "primary",
|
|
17
|
+
SECONDARY: "secondary",
|
|
18
|
+
SUCCESS: "success",
|
|
19
|
+
WARNING: "warning",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const FONT_SIZE: Record<string, SvgIconProps["fontSize"]> = {
|
|
23
|
+
INHERIT: "inherit",
|
|
24
|
+
LARGE: "large",
|
|
25
|
+
MEDIUM: "medium",
|
|
26
|
+
SMALL: "small",
|
|
27
|
+
XSMALL: "xsmall",
|
|
28
|
+
XXLARGE: "xxlarge",
|
|
29
|
+
XXSMALL: "xxsmall",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const SVG_ICON_PROPS: SvgIconPropsOptions = {
|
|
33
|
+
COLOR,
|
|
34
|
+
FONT_SIZE,
|
|
35
|
+
};
|
|
@@ -18,6 +18,7 @@ const VARIANT: Record<string, TypographyOwnProps["variant"]> = {
|
|
|
18
18
|
TEXT_BODY_SMALL_400: "text-body-small-400",
|
|
19
19
|
TEXT_HEADING_LARGE: "text-heading-large",
|
|
20
20
|
TEXT_HEADING_SMALL: "text-heading-small",
|
|
21
|
+
TEXT_HEADING_XSMALL: "text-heading-xsmall",
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export const TYPOGRAPHY_PROPS: TypographyPropsOptions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties } from "@mui/material
|
|
1
|
+
import { CSSProperties } from "@mui/material";
|
|
2
2
|
import { tabletUp } from "./breakpoints";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -20,6 +20,7 @@ const TYPOGRAPHY = {
|
|
|
20
20
|
TEXT_HEADING_LARGE: "text-heading-large",
|
|
21
21
|
TEXT_HEADING_SMALL: "text-heading-small",
|
|
22
22
|
TEXT_HEADING_XLARGE: "text-heading-xlarge",
|
|
23
|
+
TEXT_HEADING_XSMALL: "text-heading-xsmall",
|
|
23
24
|
TEXT_UPPERCASE_500: "text-uppercase-500",
|
|
24
25
|
} as const;
|
|
25
26
|
export const {
|
|
@@ -37,6 +38,7 @@ export const {
|
|
|
37
38
|
TEXT_HEADING_LARGE,
|
|
38
39
|
TEXT_HEADING_SMALL,
|
|
39
40
|
TEXT_HEADING_XLARGE,
|
|
41
|
+
TEXT_HEADING_XSMALL,
|
|
40
42
|
TEXT_UPPERCASE_500,
|
|
41
43
|
} = TYPOGRAPHY;
|
|
42
44
|
|
|
@@ -189,6 +191,15 @@ export const textHeadingXLarge: CSSProperties = {
|
|
|
189
191
|
},
|
|
190
192
|
};
|
|
191
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Typography Option "text-heading-xsmall"
|
|
196
|
+
*/
|
|
197
|
+
export const textHeadingXSmall: CSSProperties = {
|
|
198
|
+
fontSize: 16,
|
|
199
|
+
fontWeight: 500,
|
|
200
|
+
lineHeight: "24px",
|
|
201
|
+
};
|
|
202
|
+
|
|
192
203
|
/**
|
|
193
204
|
* Typography Option "text-uppercase-500"
|
|
194
205
|
*/
|
package/src/theme/theme.ts
CHANGED
|
@@ -27,6 +27,7 @@ export function createAppTheme(customOptions?: ThemeOptions): Theme {
|
|
|
27
27
|
xs: B.mobile,
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
|
+
cssVariables: true,
|
|
30
31
|
palette: {
|
|
31
32
|
alert: P.alert,
|
|
32
33
|
background: P.background,
|
|
@@ -55,6 +56,7 @@ export function createAppTheme(customOptions?: ThemeOptions): Theme {
|
|
|
55
56
|
[T.TEXT_HEADING_LARGE]: T.textHeadingLarge,
|
|
56
57
|
[T.TEXT_HEADING_SMALL]: T.textHeadingSmall,
|
|
57
58
|
[T.TEXT_HEADING_XLARGE]: T.textHeadingXLarge,
|
|
59
|
+
[T.TEXT_HEADING_XSMALL]: T.textHeadingXSmall,
|
|
58
60
|
[T.TEXT_UPPERCASE_500]: T.textUppercase500,
|
|
59
61
|
fontFamily: T.fontFamily,
|
|
60
62
|
},
|
package/src/utils/tests.ts
CHANGED
|
@@ -17,3 +17,23 @@ export function getAnchorEl(id: string): HTMLAnchorElement {
|
|
|
17
17
|
export function getButtonById(id: string): HTMLButtonElement {
|
|
18
18
|
return screen.getByTestId(id);
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns class names of the given element.
|
|
23
|
+
* @param element - Element.
|
|
24
|
+
* @returns element class names.
|
|
25
|
+
*/
|
|
26
|
+
export function getClassNames(element?: Element | null): string | null {
|
|
27
|
+
if (!element) return null;
|
|
28
|
+
return element.getAttribute("class");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns tag name of the given element.
|
|
33
|
+
* @param element - Element.
|
|
34
|
+
* @returns element tag name.
|
|
35
|
+
*/
|
|
36
|
+
export function getTagName(element?: Element | null): string | null {
|
|
37
|
+
if (!element) return null;
|
|
38
|
+
return element.tagName.toLowerCase();
|
|
39
|
+
}
|
|
@@ -17,17 +17,17 @@ import {
|
|
|
17
17
|
Filters,
|
|
18
18
|
} from "../../components/Filter/components/Filters/filters";
|
|
19
19
|
import { SearchAllFilters } from "../../components/Filter/components/SearchAllFilters/searchAllFilters";
|
|
20
|
+
import { ChartView } from "../../components/Index/components/EntitiesView/components/ChartView/chartView";
|
|
21
|
+
import { EntityList } from "../../components/Index/components/EntitiesView/components/EntityList/entityList";
|
|
20
22
|
import { Tabs } from "../../components/Index/components/Tabs/tabs";
|
|
21
23
|
import { Index as IndexView } from "../../components/Index/index";
|
|
22
24
|
import { SidebarButton } from "../../components/Layout/components/Sidebar/components/SidebarButton/sidebarButton";
|
|
23
25
|
import { SidebarLabel } from "../../components/Layout/components/Sidebar/components/SidebarLabel/sidebarLabel";
|
|
24
26
|
import { SidebarTools } from "../../components/Layout/components/Sidebar/components/SidebarTools/sidebarTools.styles";
|
|
25
27
|
import { Sidebar } from "../../components/Layout/components/Sidebar/sidebar";
|
|
26
|
-
import { TableCreator } from "../../components/TableCreator/tableCreator";
|
|
27
28
|
import {
|
|
28
29
|
CategoryGroup,
|
|
29
30
|
ComponentsConfig,
|
|
30
|
-
EntityConfig,
|
|
31
31
|
SummaryConfig,
|
|
32
32
|
} from "../../config/entities";
|
|
33
33
|
import {
|
|
@@ -38,7 +38,7 @@ import { useConfig } from "../../hooks/useConfig";
|
|
|
38
38
|
import { useEntityList } from "../../hooks/useEntityList";
|
|
39
39
|
import { useExploreState } from "../../hooks/useExploreState";
|
|
40
40
|
import { useSummary } from "../../hooks/useSummary";
|
|
41
|
-
import { ExploreActionKind
|
|
41
|
+
import { ExploreActionKind } from "../../providers/exploreState";
|
|
42
42
|
import { SELECT_CATEGORY_KEY } from "../../providers/exploreState/constants";
|
|
43
43
|
import { DESKTOP_SM } from "../../theme/common/breakpoints";
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
54
54
|
const { explorerTitle, summaryConfig, trackingConfig } = config;
|
|
55
55
|
const { listView } = entityConfig;
|
|
56
56
|
const { listHero, subTitleHero } = listView || {};
|
|
57
|
-
const { categoryGroups, categoryViews, filterCount } = exploreState;
|
|
57
|
+
const { categoryGroups, categoryViews, filterCount, loading } = exploreState;
|
|
58
58
|
const { response: summaryResponse } = useSummary(); // Fetch summary.
|
|
59
59
|
useEntityList(props); // Fetch entities.
|
|
60
60
|
const { entityListType } = props;
|
|
@@ -164,7 +164,10 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
164
164
|
)}
|
|
165
165
|
<IndexView
|
|
166
166
|
className={props.className}
|
|
167
|
-
|
|
167
|
+
chart={
|
|
168
|
+
<ChartView categoryFilters={categoryFilters} loading={loading} />
|
|
169
|
+
}
|
|
170
|
+
list={<EntityList entityListType={entityListType} />}
|
|
168
171
|
ListHero={renderComponent(listHero)}
|
|
169
172
|
SideBarButton={
|
|
170
173
|
tabletDown ? (
|
|
@@ -234,43 +237,6 @@ function renderComponent<T>(
|
|
|
234
237
|
return <ComponentCreator components={componentsConfig} response={response} />;
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
/**
|
|
238
|
-
* Render either a loading view, empty result set notification or the table itself.
|
|
239
|
-
* @param exploreState - ExploreView responses from Azul, such as projects (index/projects), samples (index/samples) and files (index/files).
|
|
240
|
-
* @param entityConfig - Entity configuration.
|
|
241
|
-
* @param entityListType - Entity list type.
|
|
242
|
-
* @returns rendered Table component.
|
|
243
|
-
*/
|
|
244
|
-
function renderList(
|
|
245
|
-
exploreState: ExploreState,
|
|
246
|
-
entityConfig: EntityConfig,
|
|
247
|
-
entityListType: string
|
|
248
|
-
): JSX.Element {
|
|
249
|
-
const { listItems, loading, tabValue } = exploreState;
|
|
250
|
-
const { getId: getRowId, list, listView } = entityConfig;
|
|
251
|
-
const { columns: columnsConfig } = list;
|
|
252
|
-
|
|
253
|
-
if (!exploreState || !tabValue) {
|
|
254
|
-
return <></>; //TODO: return the loading UI component
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (entityListType !== tabValue) {
|
|
258
|
-
// required currently for client-side fetching as the pre-rendered page
|
|
259
|
-
// loads with the previous tabs data on the first render after switching tabs. (or similar)
|
|
260
|
-
return <></>;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return (
|
|
264
|
-
<TableCreator
|
|
265
|
-
columns={columnsConfig}
|
|
266
|
-
getRowId={getRowId}
|
|
267
|
-
items={listItems ?? []}
|
|
268
|
-
listView={listView}
|
|
269
|
-
loading={loading}
|
|
270
|
-
/>
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
240
|
/**
|
|
275
241
|
* Renders Summaries component when all the following requirements are fulfilled:
|
|
276
242
|
* - defined summary config,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { composeStories } from "@storybook/react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { SelectCategoryValueView } from "../src/common/entities";
|
|
5
|
+
import { CHART_TEST_ID } from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants";
|
|
6
|
+
import * as stories from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories";
|
|
7
|
+
import { PALETTE } from "../src/styles/common/mui/palette";
|
|
8
|
+
|
|
9
|
+
const { Default, Selected } = composeStories(stories);
|
|
10
|
+
|
|
11
|
+
const DATA = Default.args.selectCategoryValueViews || [];
|
|
12
|
+
const SELECTED_DATA = Selected.args.selectCategoryValueViews || [];
|
|
13
|
+
|
|
14
|
+
describe("Chart", () => {
|
|
15
|
+
describe("basic rendering", () => {
|
|
16
|
+
let chartEl: HTMLElement;
|
|
17
|
+
let svgEl: Element | null;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
render(<Default testId={CHART_TEST_ID} />);
|
|
21
|
+
chartEl = screen.getByTestId(CHART_TEST_ID);
|
|
22
|
+
svgEl = chartEl.querySelector("svg");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("renders correctly with default data", () => {
|
|
26
|
+
expect(chartEl).toBeDefined();
|
|
27
|
+
expect(svgEl).toBeDefined();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("category labels and counts", () => {
|
|
32
|
+
const countSet = new Set(DATA.map(mapCount));
|
|
33
|
+
const labelSet = new Set(DATA.map(mapLabel));
|
|
34
|
+
let countTextEls: NodeListOf<SVGElement>;
|
|
35
|
+
let labelTextEls: NodeListOf<SVGElement>;
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
render(<Default testId={CHART_TEST_ID} />);
|
|
39
|
+
countTextEls = getEls("text-count", "text");
|
|
40
|
+
labelTextEls = getEls("text-category-label", "text");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("renders category labels", () => {
|
|
44
|
+
expect(labelTextEls.length).toEqual(labelSet.size);
|
|
45
|
+
labelTextEls.forEach(({ textContent }) => {
|
|
46
|
+
expect(textContent).toBeDefined();
|
|
47
|
+
expect(labelSet.has(textContent || "")).toBeTruthy();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("renders category counts", () => {
|
|
52
|
+
expect(countTextEls.length).toEqual(countSet.size);
|
|
53
|
+
countTextEls.forEach(({ textContent }) => {
|
|
54
|
+
expect(textContent).toBeDefined();
|
|
55
|
+
expect(countSet.has(textContent || "")).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe("category labels with selected values", () => {
|
|
61
|
+
it("renders selected category labels with '(selected)'", () => {
|
|
62
|
+
render(<Selected testId={CHART_TEST_ID} />);
|
|
63
|
+
const textEls = getEls("text-category-label", "text");
|
|
64
|
+
for (let i = 0; i < SELECTED_DATA.length; i++) {
|
|
65
|
+
const selectedData = SELECTED_DATA[i];
|
|
66
|
+
const textEl = textEls[i];
|
|
67
|
+
if (selectedData.selected) {
|
|
68
|
+
expect(textEl.textContent).toEqual(
|
|
69
|
+
`${selectedData.label} (selected)`
|
|
70
|
+
);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
expect(textEl.textContent).toEqual(selectedData.label);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("bars with unselected values", () => {
|
|
79
|
+
let barEls: NodeListOf<SVGElement>;
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
render(<Default testId={CHART_TEST_ID} />);
|
|
83
|
+
barEls = getEls("x-bar", "path");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("renders correct number of bars", () => {
|
|
87
|
+
expect(barEls.length).toEqual(DATA.length);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("renders all bars in #C5E3FC", () => {
|
|
91
|
+
expect([...barEls].every(isFillDefault)).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("bars with selected values", () => {
|
|
96
|
+
let barEls: NodeListOf<SVGElement>;
|
|
97
|
+
|
|
98
|
+
beforeEach(() => {
|
|
99
|
+
render(<Selected testId={CHART_TEST_ID} />);
|
|
100
|
+
barEls = getEls("x-bar", "path");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("renders no bars in #C5E3FC", () => {
|
|
104
|
+
expect([...barEls].some(isFillDefault)).toBeFalsy();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("renders at least one bar in PRIMARY_MAIN", () => {
|
|
108
|
+
expect([...barEls].some(isFillPrimaryMain)).toBeTruthy();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get the SVG group element for a given class name.
|
|
115
|
+
* @param className - Class name.
|
|
116
|
+
* @returns SVG group element.
|
|
117
|
+
*/
|
|
118
|
+
function getGroupEls(className: string): HTMLCollectionOf<Element> {
|
|
119
|
+
const chartEl = screen.getByTestId(CHART_TEST_ID);
|
|
120
|
+
const gEls = chartEl.getElementsByClassName(className);
|
|
121
|
+
expect(gEls.length).toEqual(1);
|
|
122
|
+
return gEls;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get the SVG elements for a given class name and selectors.
|
|
127
|
+
* @param className - Class name.
|
|
128
|
+
* @param selectors - Selectors.
|
|
129
|
+
* @returns SVG elements.
|
|
130
|
+
*/
|
|
131
|
+
function getEls(className: string, selectors: string): NodeListOf<SVGElement> {
|
|
132
|
+
const gEls = getGroupEls(className);
|
|
133
|
+
return gEls[0].querySelectorAll(selectors);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Check if the fill attribute of the element is #C5E3FC.
|
|
138
|
+
* @param element - Element to check.
|
|
139
|
+
* @returns True if the fill attribute is #C5E3FC, false otherwise.
|
|
140
|
+
*/
|
|
141
|
+
function isFillDefault(element: Element): boolean {
|
|
142
|
+
return element.getAttribute("fill") === "#C5E3FC";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Check if the fill attribute of the element is PRIMARY_MAIN.
|
|
147
|
+
* @param element - Element.
|
|
148
|
+
* @returns True if the fill attribute is PRIMARY_MAIN, false otherwise.
|
|
149
|
+
*/
|
|
150
|
+
function isFillPrimaryMain(element: Element): boolean {
|
|
151
|
+
return element.getAttribute("fill") === PALETTE.PRIMARY_MAIN;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Maps the count of a category value view to a string.
|
|
156
|
+
* @param categoryValueView - Category value view.
|
|
157
|
+
* @returns Count as a string.
|
|
158
|
+
*/
|
|
159
|
+
function mapCount(categoryValueView: SelectCategoryValueView): string {
|
|
160
|
+
return categoryValueView.count.toLocaleString();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Maps the label of a category value view to a string.
|
|
165
|
+
* @param categoryValueView - Category value view.
|
|
166
|
+
* @returns Label as a string.
|
|
167
|
+
*/
|
|
168
|
+
function mapLabel(categoryValueView: SelectCategoryValueView): string {
|
|
169
|
+
return categoryValueView.label;
|
|
170
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { composeStories } from "@storybook/react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { CHART_VIEW_TEST_ID } from "../src/components/Index/components/EntitiesView/components/ChartView/constants";
|
|
5
|
+
import * as stories from "../src/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories";
|
|
6
|
+
|
|
7
|
+
const { Default } = composeStories(stories);
|
|
8
|
+
|
|
9
|
+
describe("ChartView", () => {
|
|
10
|
+
it("renders correctly", () => {
|
|
11
|
+
render(<Default testId={CHART_VIEW_TEST_ID} />);
|
|
12
|
+
const chartEl = screen.getByTestId(CHART_VIEW_TEST_ID);
|
|
13
|
+
expect(chartEl).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("renders nothing when no categories are available", () => {
|
|
17
|
+
render(<Default categoryFilters={[]} testId={CHART_VIEW_TEST_ID} />);
|
|
18
|
+
expect(screen.queryByTestId(CHART_VIEW_TEST_ID)).toBeNull();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders correct number of chart sections", () => {
|
|
22
|
+
render(<Default />);
|
|
23
|
+
// Mocks include the facets `Biological Sex`, `Genus Species` and `Paired End`.
|
|
24
|
+
const categoryLabels = screen.getAllByText(
|
|
25
|
+
/Biological Sex|Genus Species|Paired End}/
|
|
26
|
+
);
|
|
27
|
+
// `Paired End` is not included in the chart view, `enableChartView` is false.
|
|
28
|
+
expect(categoryLabels.length).toBe(2);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("renders charts for each category", () => {
|
|
32
|
+
render(<Default />);
|
|
33
|
+
const svgEls = document.querySelectorAll("svg");
|
|
34
|
+
expect(svgEls.length).toBe(2);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { composeStories } from "@storybook/react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ENTITIES_VIEW_TEST_ID } from "../src/components/Index/components/EntitiesView/constants";
|
|
5
|
+
import { VIEW_MODE } from "../src/components/Index/components/EntitiesView/hooks/UseEntitiesView/types";
|
|
6
|
+
import * as stories from "../src/components/Index/components/EntitiesView/stories/entitiesView.stories";
|
|
7
|
+
|
|
8
|
+
const { Default } = composeStories(stories);
|
|
9
|
+
|
|
10
|
+
describe("EntitiesView", () => {
|
|
11
|
+
it("renders correctly", () => {
|
|
12
|
+
render(<Default testId={ENTITIES_VIEW_TEST_ID} />);
|
|
13
|
+
const viewEl = screen.getByTestId(ENTITIES_VIEW_TEST_ID);
|
|
14
|
+
expect(viewEl).not.toBeNull();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("does not render toggle buttons when disabled", () => {
|
|
18
|
+
render(<Default testId={ENTITIES_VIEW_TEST_ID} />);
|
|
19
|
+
const viewEl = screen.getByTestId(ENTITIES_VIEW_TEST_ID);
|
|
20
|
+
const buttonsEl = viewEl.getElementsByClassName("MuiToggleButton-root");
|
|
21
|
+
expect(buttonsEl.length).toEqual(0);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("renders toggle buttons when enabled", () => {
|
|
25
|
+
render(
|
|
26
|
+
<Default
|
|
27
|
+
testId={ENTITIES_VIEW_TEST_ID}
|
|
28
|
+
viewMode={VIEW_MODE.TABLE}
|
|
29
|
+
viewStatus={{ disabled: false }}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
const viewEl = screen.getByTestId(ENTITIES_VIEW_TEST_ID);
|
|
33
|
+
const buttonsEl = viewEl.getElementsByClassName("MuiToggleButton-root");
|
|
34
|
+
expect(buttonsEl.length).toEqual(2);
|
|
35
|
+
});
|
|
36
|
+
});
|
package/tests/setup.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jest } from "@jest/globals";
|
|
2
|
+
import { setProjectAnnotations } from "@storybook/react";
|
|
3
|
+
import { TextDecoder, TextEncoder } from "util";
|
|
4
|
+
import { decorators } from "../src/storybook/decorators";
|
|
5
|
+
import { parameters } from "../src/storybook/parameters";
|
|
6
|
+
|
|
7
|
+
// Set project annotations once before all tests
|
|
8
|
+
setProjectAnnotations({ decorators, parameters });
|
|
9
|
+
|
|
10
|
+
// Polyfill ResizeObserver for environments (like Jest) where it's not globally available
|
|
11
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
12
|
+
disconnect: jest.fn(),
|
|
13
|
+
observe: jest.fn(),
|
|
14
|
+
unobserve: jest.fn(),
|
|
15
|
+
})) as unknown as typeof ResizeObserver;
|
|
16
|
+
|
|
17
|
+
// Polyfill TextEncoder/TextDecoder for environments (like Jest) where they're not globally available
|
|
18
|
+
global.TextEncoder = global.TextEncoder || TextEncoder;
|
|
19
|
+
global.TextDecoder = global.TextDecoder || TextDecoder;
|