@databiosphere/findable-ui 46.1.2 → 47.0.2
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/.eslintrc.json +2 -1
- package/.github/copilot-instructions.md +176 -0
- package/.github/workflows/release-please.yml +8 -4
- package/.github/workflows/run-checks.yml +2 -2
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +33 -0
- package/README.md +4 -10
- package/docs/TRUSTED_PUBLISHING.md +133 -0
- package/lib/common/utils.js +1 -1
- package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +6 -0
- package/lib/components/DataDictionary/components/Table/columns/columnDef.js +33 -0
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +5 -0
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +5 -0
- package/lib/components/DataDictionary/components/Table/columns/types.d.ts +2 -0
- package/lib/components/DataDictionary/components/Table/columns/types.js +1 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +4 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +1 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.d.ts +4 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +23 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +8 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionary/types.js +1 -0
- package/lib/components/DataDictionary/hooks/UseLayoutSpacing/hook.d.ts +2 -0
- package/lib/components/DataDictionary/hooks/UseLayoutSpacing/hook.js +10 -0
- package/lib/components/DataDictionary/hooks/UseLayoutSpacing/types.d.ts +7 -0
- package/lib/components/DataDictionary/hooks/UseLayoutSpacing/types.js +1 -0
- 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/Filter/components/Filter/filter.stories.d.ts +25 -0
- package/lib/components/Filter/components/Filter/filter.stories.js +42 -0
- package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +16 -0
- package/lib/components/Filter/components/FilterTag/filterTag.stories.js +17 -0
- package/lib/components/Filter/components/Filters/filters.stories.d.ts +6 -0
- package/lib/components/Filter/components/Filters/filters.stories.js +91 -0
- package/lib/components/Filter/components/SearchAllFilters/components/AutocompletePopper/autocompletePopper.styles.d.ts +3 -0
- package/lib/components/Filter/components/SearchAllFilters/components/AutocompletePopper/autocompletePopper.styles.js +15 -0
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.stories.d.ts +6 -0
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.stories.js +82 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.d.ts +1 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.js +14 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.d.ts +2 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.js +12 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.d.ts +5 -0
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.js +34 -0
- package/lib/components/Index/components/Cell/cell.d.ts +7 -0
- package/lib/components/Index/components/Cell/cell.js +10 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.js +20 -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 +10 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.js +10 -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 +91 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.d.ts +132 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.js +230 -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 +18 -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 +97 -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 +15 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/types.d.ts +8 -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 +23 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.js +14 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.d.ts +6 -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 +15 -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/Hero/components/ExportButton/exportButton.d.ts +1 -0
- package/lib/components/Index/components/Hero/components/ExportButton/exportButton.js +13 -0
- package/lib/components/Index/components/Hero/components/ExportButton/exportButton.styles.d.ts +3 -0
- package/lib/components/Index/components/Hero/components/ExportButton/exportButton.styles.js +13 -0
- package/lib/components/Index/components/Hero/components/Summaries/stories/summaries.stories.d.ts +6 -0
- package/lib/components/Index/components/Hero/components/Summaries/stories/summaries.stories.js +14 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.d.ts +9 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.js +12 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +13 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +18 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.styles.d.ts +7 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.styles.js +26 -0
- package/lib/components/Index/components/Hero/hero.d.ts +11 -0
- package/lib/components/Index/components/Hero/hero.js +12 -0
- package/lib/components/Index/components/Hero/hero.stories.d.ts +23 -0
- package/lib/components/Index/components/Hero/hero.stories.js +22 -0
- package/lib/components/Index/components/Hero/hero.styles.d.ts +16 -0
- package/lib/components/Index/components/Hero/hero.styles.js +44 -0
- package/lib/components/Index/components/Hero/stories/hero.stories.d.ts +6 -0
- package/lib/components/Index/components/Hero/stories/hero.stories.js +16 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +8 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +57 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +4 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +10 -0
- package/lib/components/Index/components/NTag/nTag.d.ts +10 -0
- package/lib/components/Index/components/NTag/nTag.js +8 -0
- package/lib/components/Index/components/NTagCell/nTagCell.d.ts +11 -0
- package/lib/components/Index/components/NTagCell/nTagCell.js +29 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.js +16 -0
- package/lib/components/Index/components/Tabs/common/utils.d.ts +8 -0
- package/lib/components/Index/components/Tabs/common/utils.js +19 -0
- package/lib/components/Index/components/Tabs/tabs.d.ts +1 -0
- package/lib/components/Index/components/Tabs/tabs.js +20 -0
- 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.stories.d.ts +6 -0
- package/lib/components/Index/index.stories.js +26 -0
- package/lib/components/Index/stories/index.stories.d.ts +6 -0
- package/lib/components/Index/stories/index.stories.js +17 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +6 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +10 -0
- 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/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/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/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/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +1 -1
- package/lib/components/Login/login.stories.d.ts +6 -0
- package/lib/components/Login/login.stories.js +31 -0
- package/lib/components/Redirect/redirect.js +6 -1
- 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/DownloadEntityResults/downloadEntityResults.d.ts +6 -0
- package/lib/components/Table/components/DownloadEntityResults/downloadEntityResults.js +17 -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.d.ts +9 -0
- package/lib/components/Table/components/Pagination/pagination.js +19 -0
- package/lib/components/Table/components/Pagination/pagination.stories.d.ts +28 -0
- package/lib/components/Table/components/Pagination/pagination.stories.js +24 -0
- package/lib/components/Table/components/Pagination/pagination.styles.d.ts +4 -0
- package/lib/components/Table/components/Pagination/pagination.styles.js +15 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.d.ts +3 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.js +3 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.d.ts +8 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.js +18 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/types.d.ts +4 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/types.js +1 -0
- package/lib/components/Table/components/TableBody/utils.d.ts +12 -0
- package/lib/components/Table/components/TableBody/utils.js +17 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.js +1 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/types.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/types.js +1 -0
- 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.styles.d.ts +4 -0
- package/lib/components/TableCreator/tableCreator.styles.js +4 -0
- 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/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/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/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/ToggleButtonGroup/toggleButtonGroup.js +2 -1
- 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/useEntityListRelatedView.d.ts +15 -0
- package/lib/hooks/useEntityListRelatedView.js +62 -0
- package/lib/hooks/useExploreMode.d.ts +14 -0
- package/lib/hooks/useExploreMode.js +20 -0
- package/lib/hooks/useFileLocation.js +1 -1
- 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/useScroll.d.ts +10 -0
- package/lib/hooks/useScroll.js +12 -0
- 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/styles/common/mixins/colors.d.ts +25 -0
- package/lib/styles/common/mixins/colors.js +32 -0
- package/lib/styles/common/mixins/fonts.d.ts +16 -0
- package/lib/styles/common/mixins/fonts.js +30 -0
- package/lib/styles/common/mixins/shadows.d.ts +3 -0
- package/lib/styles/common/mixins/shadows.js +4 -0
- package/lib/styles/common/mui/palette.d.ts +47 -0
- package/lib/styles/common/mui/palette.js +47 -0
- package/lib/theme/common/entities.d.ts +6 -0
- package/lib/theme/common/entities.js +1 -0
- package/package.json +15 -13
- package/src/common/utils.ts +1 -1
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +1 -1
- package/src/components/Redirect/redirect.tsx +5 -1
- package/src/components/common/ToggleButtonGroup/toggleButtonGroup.tsx +1 -1
- package/src/hooks/useFileLocation.ts +1 -1
- package/types/data-explorer-ui.d.ts +7 -6
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ChannelValues, Context, Dimensions, RenderFunction, ScaleFunctions } from "@observablehq/plot";
|
|
2
|
+
import { SelectCategoryValueView } from "../../../../../../../../../common/entities";
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the total count of all category values from the provided array of category value views.
|
|
5
|
+
* @param selectCategoryValueViews - An array of objects representing category values, where each object contains a count property.
|
|
6
|
+
* @returns The total sum of the count property from all category value objects in the array.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCategoryTotalCount(selectCategoryValueViews: SelectCategoryValueView[]): number;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the text for the category value point.
|
|
11
|
+
* @param d - Data point.
|
|
12
|
+
* @returns Formatted text string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCategoryValueText(d: SelectCategoryValueView): string;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the fill color for the category value point.
|
|
17
|
+
* @param d - Data point.
|
|
18
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
19
|
+
* @returns Fill color string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCategoryValueTextFill(d: SelectCategoryValueView, isCategorySelected: boolean): string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the color range value for "false" (unselected).
|
|
24
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
25
|
+
* @returns Color range value.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getColorRangeValue(isCategorySelected: boolean): string;
|
|
28
|
+
/**
|
|
29
|
+
* Calculates the percentage representation of a count value relative to a total.
|
|
30
|
+
* @param d - Data point containing the count value to calculate the percentage for.
|
|
31
|
+
* @param total - The total value used as the denominator to compute the percentage.
|
|
32
|
+
* @returns The calculated percentage value, rounded to one decimal place.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getCountPercentage(d: SelectCategoryValueView, total: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the text for the count point.
|
|
37
|
+
* Includes the count and its percentage of the total.
|
|
38
|
+
* @param d - Data point.
|
|
39
|
+
* @param total - Total count.
|
|
40
|
+
* @returns Text string.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getCountText(d: SelectCategoryValueView, total: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the fill color for the count point.
|
|
45
|
+
* @param d - Data point.
|
|
46
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
47
|
+
* @returns Fill color string.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getCountTextFill(d: SelectCategoryValueView, isCategorySelected: boolean): string;
|
|
50
|
+
/**
|
|
51
|
+
* Calculates the total SVG height required to render a horizontal bar chart (barX).
|
|
52
|
+
* The computed height includes:
|
|
53
|
+
* - Padding space equivalent to one bar above the first and below the last bar,
|
|
54
|
+
* - Vertical gaps between bars,
|
|
55
|
+
* - A fixed bottom margin.
|
|
56
|
+
* @param numberOfBars - Number of bars to display.
|
|
57
|
+
* @returns Height.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getPlotHeight(numberOfBars: number): number;
|
|
60
|
+
/**
|
|
61
|
+
* Rounds up a number to the next "nice" stop value for axis scaling.
|
|
62
|
+
* This function returns an upper bound based on the input value's
|
|
63
|
+
* order of magnitude. It calculates axis limits or tick maximums
|
|
64
|
+
* for consistent and readable chart scales.
|
|
65
|
+
* The function applies standard magnitude-based steps:
|
|
66
|
+
* - Rounds up to 2.5×, 5×, 7.5×, or 10× the base magnitude
|
|
67
|
+
* - Ensures minimum stop of 10
|
|
68
|
+
* @param n - Number.
|
|
69
|
+
* @returns A rounded "nice" stop value suitable for axis ticks.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getStop(n: number): number;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the ticks for the x-axis.
|
|
74
|
+
* @param data - Data.
|
|
75
|
+
* @returns Ticks.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getTicks(data: SelectCategoryValueView[]): number[];
|
|
78
|
+
/**
|
|
79
|
+
* Returns the `x` domain.
|
|
80
|
+
* @param data - Data.
|
|
81
|
+
* @returns Domain.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getXDomain(data: SelectCategoryValueView[]): [number, number];
|
|
84
|
+
/**
|
|
85
|
+
* Generates an evenly spaced numeric range between a start and stop value.
|
|
86
|
+
* The range includes a fixed number of steps (6), where each value is spaced
|
|
87
|
+
* by a step size derived from the adjusted stop value via `getStop`.
|
|
88
|
+
* Used for grid lines along the x-axis.
|
|
89
|
+
* @param start - Start value.
|
|
90
|
+
* @param stop - Stop value.
|
|
91
|
+
* @returns Range.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getXRange(start: number, stop: number): number[];
|
|
94
|
+
/**
|
|
95
|
+
* Calculates the inner padding ratio for a band scale's y-axis.
|
|
96
|
+
* This determines the proportional spacing between adjacent bars in a bar chart.
|
|
97
|
+
* @returns The inner padding value as a fraction (between 0 and 1).
|
|
98
|
+
*/
|
|
99
|
+
export declare function getYPaddingInner(): number;
|
|
100
|
+
/**
|
|
101
|
+
* Calculates the outer padding ratio for a band scale's y-axis.
|
|
102
|
+
* This represents the proportional space above the first bar and below the last bar
|
|
103
|
+
* in a vertical layout. It ensures that the outer margins are visually balanced and
|
|
104
|
+
* match the bar height, so the chart breathes evenly at the top and bottom.
|
|
105
|
+
* @returns The outer padding value as a fraction (between 0 and 1).
|
|
106
|
+
*/
|
|
107
|
+
export declare function getYPaddingOuter(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Checks if any value in the data array is selected.
|
|
110
|
+
* @param data - Data.
|
|
111
|
+
* @returns True if any value is selected, false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isAnyValueSelected(data: SelectCategoryValueView[]): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Parses a transform `translate` string and returns the x and y coordinates.
|
|
116
|
+
* @param translate - The transform `translate` string.
|
|
117
|
+
* @returns A tuple of the x and y coordinates.
|
|
118
|
+
*/
|
|
119
|
+
export declare function parseTranslate(translate: string | null): [number, number];
|
|
120
|
+
/**
|
|
121
|
+
* Renders text elements for count values, positioning them either inside or outside bars
|
|
122
|
+
* based on available space. If text doesn't fit inside a bar, it's repositioned outside
|
|
123
|
+
* with adjusted styling.
|
|
124
|
+
* @param index - The mark's (filtered and transformed) index.
|
|
125
|
+
* @param scales - The plot's scale functions.
|
|
126
|
+
* @param values - The mark's (possibly scaled and transformed) channel values.
|
|
127
|
+
* @param dimensions - The plot's dimensions.
|
|
128
|
+
* @param context - The plot's context.
|
|
129
|
+
* @param next - The next render function in the chain.
|
|
130
|
+
* @returns SVG element or null
|
|
131
|
+
*/
|
|
132
|
+
export declare function renderText(index: number[], scales: ScaleFunctions, values: ChannelValues, dimensions: Dimensions, context: Context, next?: RenderFunction): SVGElement | null;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { PALETTE } from "../../../../../../../../../styles/common/constants/palette";
|
|
2
|
+
import { BAR_GAP, BAR_HEIGHT, MARGIN_LEFT, TEXT_PADDING, TICKS, } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the total count of all category values from the provided array of category value views.
|
|
5
|
+
* @param selectCategoryValueViews - An array of objects representing category values, where each object contains a count property.
|
|
6
|
+
* @returns The total sum of the count property from all category value objects in the array.
|
|
7
|
+
*/
|
|
8
|
+
export function getCategoryTotalCount(selectCategoryValueViews) {
|
|
9
|
+
return selectCategoryValueViews.reduce((acc, { count }) => acc + count, 0);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns the text for the category value point.
|
|
13
|
+
* @param d - Data point.
|
|
14
|
+
* @returns Formatted text string.
|
|
15
|
+
*/
|
|
16
|
+
export function getCategoryValueText(d) {
|
|
17
|
+
if (d.selected)
|
|
18
|
+
return `${d.label} (selected)`;
|
|
19
|
+
return d.label;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns the fill color for the category value point.
|
|
23
|
+
* @param d - Data point.
|
|
24
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
25
|
+
* @returns Fill color string.
|
|
26
|
+
*/
|
|
27
|
+
export function getCategoryValueTextFill(d, isCategorySelected) {
|
|
28
|
+
if (d.selected)
|
|
29
|
+
return PALETTE.INK_MAIN;
|
|
30
|
+
if (isCategorySelected)
|
|
31
|
+
return PALETTE.INK_LIGHT;
|
|
32
|
+
return PALETTE.INK_MAIN;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the color range value for "false" (unselected).
|
|
36
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
37
|
+
* @returns Color range value.
|
|
38
|
+
*/
|
|
39
|
+
export function getColorRangeValue(isCategorySelected) {
|
|
40
|
+
return isCategorySelected ? PALETTE.SMOKE_LIGHT : "#C5E3FC";
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Calculates the percentage representation of a count value relative to a total.
|
|
44
|
+
* @param d - Data point containing the count value to calculate the percentage for.
|
|
45
|
+
* @param total - The total value used as the denominator to compute the percentage.
|
|
46
|
+
* @returns The calculated percentage value, rounded to one decimal place.
|
|
47
|
+
*/
|
|
48
|
+
export function getCountPercentage(d, total) {
|
|
49
|
+
if (total === 0)
|
|
50
|
+
return "0";
|
|
51
|
+
const percentage = (d.count / total) * 100;
|
|
52
|
+
const roundedPercentage = Math.round(percentage * 10) / 10;
|
|
53
|
+
if (roundedPercentage < 0.1)
|
|
54
|
+
return "< 0.1";
|
|
55
|
+
// Round to one decimal place.
|
|
56
|
+
return roundedPercentage.toFixed(1);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the text for the count point.
|
|
60
|
+
* Includes the count and its percentage of the total.
|
|
61
|
+
* @param d - Data point.
|
|
62
|
+
* @param total - Total count.
|
|
63
|
+
* @returns Text string.
|
|
64
|
+
*/
|
|
65
|
+
export function getCountText(d, total) {
|
|
66
|
+
return `${d.count.toLocaleString()} (${getCountPercentage(d, total)}%)`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns the fill color for the count point.
|
|
70
|
+
* @param d - Data point.
|
|
71
|
+
* @param isCategorySelected - Flag indicating if any value is selected.
|
|
72
|
+
* @returns Fill color string.
|
|
73
|
+
*/
|
|
74
|
+
export function getCountTextFill(d, isCategorySelected) {
|
|
75
|
+
if (d.selected)
|
|
76
|
+
return PALETTE.COMMON_WHITE;
|
|
77
|
+
if (isCategorySelected)
|
|
78
|
+
return PALETTE.SMOKE_DARK;
|
|
79
|
+
return PALETTE.INK_MAIN;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Calculates the total SVG height required to render a horizontal bar chart (barX).
|
|
83
|
+
* The computed height includes:
|
|
84
|
+
* - Padding space equivalent to one bar above the first and below the last bar,
|
|
85
|
+
* - Vertical gaps between bars,
|
|
86
|
+
* - A fixed bottom margin.
|
|
87
|
+
* @param numberOfBars - Number of bars to display.
|
|
88
|
+
* @returns Height.
|
|
89
|
+
*/
|
|
90
|
+
export function getPlotHeight(numberOfBars) {
|
|
91
|
+
return (numberOfBars + 2) * BAR_HEIGHT + (numberOfBars - 1) * BAR_GAP + 32;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Rounds up a number to the next "nice" stop value for axis scaling.
|
|
95
|
+
* This function returns an upper bound based on the input value's
|
|
96
|
+
* order of magnitude. It calculates axis limits or tick maximums
|
|
97
|
+
* for consistent and readable chart scales.
|
|
98
|
+
* The function applies standard magnitude-based steps:
|
|
99
|
+
* - Rounds up to 2.5×, 5×, 7.5×, or 10× the base magnitude
|
|
100
|
+
* - Ensures minimum stop of 10
|
|
101
|
+
* @param n - Number.
|
|
102
|
+
* @returns A rounded "nice" stop value suitable for axis ticks.
|
|
103
|
+
*/
|
|
104
|
+
export function getStop(n) {
|
|
105
|
+
if (n <= 10)
|
|
106
|
+
return 10;
|
|
107
|
+
// Calculate the magnitude e.g. 10, 100, 1000
|
|
108
|
+
const magnitude = Math.pow(10, Math.floor(Math.log10(n)));
|
|
109
|
+
for (const multiplier of [1, 2.5, 5, 7.5, 10]) {
|
|
110
|
+
if (n <= magnitude * multiplier) {
|
|
111
|
+
return magnitude * multiplier;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return magnitude * 10;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Returns the ticks for the x-axis.
|
|
118
|
+
* @param data - Data.
|
|
119
|
+
* @returns Ticks.
|
|
120
|
+
*/
|
|
121
|
+
export function getTicks(data) {
|
|
122
|
+
const domain = getXDomain(data);
|
|
123
|
+
return getXRange(domain[0], domain[1]);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns the `x` domain.
|
|
127
|
+
* @param data - Data.
|
|
128
|
+
* @returns Domain.
|
|
129
|
+
*/
|
|
130
|
+
export function getXDomain(data) {
|
|
131
|
+
const max = Math.max(...data.map((d) => d.count));
|
|
132
|
+
return [0, getStop(max)];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Generates an evenly spaced numeric range between a start and stop value.
|
|
136
|
+
* The range includes a fixed number of steps (6), where each value is spaced
|
|
137
|
+
* by a step size derived from the adjusted stop value via `getStop`.
|
|
138
|
+
* Used for grid lines along the x-axis.
|
|
139
|
+
* @param start - Start value.
|
|
140
|
+
* @param stop - Stop value.
|
|
141
|
+
* @returns Range.
|
|
142
|
+
*/
|
|
143
|
+
export function getXRange(start, stop) {
|
|
144
|
+
const ticks = [];
|
|
145
|
+
const steps = TICKS;
|
|
146
|
+
const step = getStop(stop) / (steps - 1);
|
|
147
|
+
for (let i = 0; i < steps; i++) {
|
|
148
|
+
ticks.push(start + i * step);
|
|
149
|
+
}
|
|
150
|
+
return ticks;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Calculates the inner padding ratio for a band scale's y-axis.
|
|
154
|
+
* This determines the proportional spacing between adjacent bars in a bar chart.
|
|
155
|
+
* @returns The inner padding value as a fraction (between 0 and 1).
|
|
156
|
+
*/
|
|
157
|
+
export function getYPaddingInner() {
|
|
158
|
+
return BAR_GAP / (BAR_HEIGHT + BAR_GAP);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Calculates the outer padding ratio for a band scale's y-axis.
|
|
162
|
+
* This represents the proportional space above the first bar and below the last bar
|
|
163
|
+
* in a vertical layout. It ensures that the outer margins are visually balanced and
|
|
164
|
+
* match the bar height, so the chart breathes evenly at the top and bottom.
|
|
165
|
+
* @returns The outer padding value as a fraction (between 0 and 1).
|
|
166
|
+
*/
|
|
167
|
+
export function getYPaddingOuter() {
|
|
168
|
+
return BAR_HEIGHT / (BAR_HEIGHT + BAR_GAP);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Checks if any value in the data array is selected.
|
|
172
|
+
* @param data - Data.
|
|
173
|
+
* @returns True if any value is selected, false otherwise.
|
|
174
|
+
*/
|
|
175
|
+
export function isAnyValueSelected(data) {
|
|
176
|
+
return data.some(({ selected }) => selected);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Parses a transform `translate` string and returns the x and y coordinates.
|
|
180
|
+
* @param translate - The transform `translate` string.
|
|
181
|
+
* @returns A tuple of the x and y coordinates.
|
|
182
|
+
*/
|
|
183
|
+
export function parseTranslate(translate) {
|
|
184
|
+
const match = translate?.match(/translate\(\s*([-\d.]+)[,\s]+([-\d.]+)\s*\)/);
|
|
185
|
+
let tx = 0;
|
|
186
|
+
let ty = 0;
|
|
187
|
+
if (match) {
|
|
188
|
+
tx = parseFloat(match[1]);
|
|
189
|
+
ty = parseFloat(match[2]);
|
|
190
|
+
}
|
|
191
|
+
return [tx, ty];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Renders text elements for count values, positioning them either inside or outside bars
|
|
195
|
+
* based on available space. If text doesn't fit inside a bar, it's repositioned outside
|
|
196
|
+
* with adjusted styling.
|
|
197
|
+
* @param index - The mark's (filtered and transformed) index.
|
|
198
|
+
* @param scales - The plot's scale functions.
|
|
199
|
+
* @param values - The mark's (possibly scaled and transformed) channel values.
|
|
200
|
+
* @param dimensions - The plot's dimensions.
|
|
201
|
+
* @param context - The plot's context.
|
|
202
|
+
* @param next - The next render function in the chain.
|
|
203
|
+
* @returns SVG element or null
|
|
204
|
+
*/
|
|
205
|
+
export function renderText(index, scales, values, dimensions, context, next) {
|
|
206
|
+
const g = next?.(index, scales, values, dimensions, context);
|
|
207
|
+
if (!g)
|
|
208
|
+
return null;
|
|
209
|
+
requestAnimationFrame(() => {
|
|
210
|
+
const textEls = g.querySelectorAll("text");
|
|
211
|
+
for (const textEl of textEls) {
|
|
212
|
+
const ctm = textEl.getCTM();
|
|
213
|
+
const bBox = textEl.getBBox();
|
|
214
|
+
if (!ctm || !bBox)
|
|
215
|
+
continue;
|
|
216
|
+
// If the text doesn't fit inside the bar, reposition it outside.
|
|
217
|
+
if (ctm.e - bBox.width - TEXT_PADDING < MARGIN_LEFT) {
|
|
218
|
+
const [tx, ty] = parseTranslate(textEl.getAttribute("transform"));
|
|
219
|
+
// Translate by the width of the bar plus padding on each side.
|
|
220
|
+
textEl.setAttribute("transform", `translate(${tx + bBox.width + TEXT_PADDING * 2}, ${ty})`);
|
|
221
|
+
// If the text fill is white, change it to ink.
|
|
222
|
+
const fill = textEl.getAttribute("fill");
|
|
223
|
+
if (fill === PALETTE.COMMON_WHITE) {
|
|
224
|
+
textEl.setAttribute("fill", PALETTE.INK_MAIN);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return g;
|
|
230
|
+
}
|
package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { getPlotOptions } from "./barX/plot";
|
|
3
|
+
import { StyledBarX } from "./chart.styles";
|
|
4
|
+
export const Chart = ({ selectCategoryValueViews, testId, width, }) => {
|
|
5
|
+
const options = useMemo(() => getPlotOptions(selectCategoryValueViews, width), [selectCategoryValueViews, width]);
|
|
6
|
+
return React.createElement(StyledBarX, { options: options, testId: testId });
|
|
7
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { mediaTabletDown } from "../../../../../../../../styles/common/mixins/breakpoints";
|
|
3
|
+
import { textBodySmall400 } from "../../../../../../../../styles/common/mixins/fonts";
|
|
4
|
+
import { BarX } from "../../../../../../../Plot/components/BarX/barX";
|
|
5
|
+
export const StyledBarX = styled(BarX) `
|
|
6
|
+
${textBodySmall400};
|
|
7
|
+
|
|
8
|
+
svg {
|
|
9
|
+
g.x-axis {
|
|
10
|
+
text {
|
|
11
|
+
&:nth-of-type(1) {
|
|
12
|
+
text-anchor: start;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:nth-last-of-type(1) {
|
|
16
|
+
text-anchor: end;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
${mediaTabletDown} {
|
|
20
|
+
display: none;
|
|
21
|
+
&:nth-of-type(1),
|
|
22
|
+
&:nth-last-of-type(1) {
|
|
23
|
+
display: block;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CHART_TEST_ID = "chart";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHART_TEST_ID = "chart";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export const CHART_ARGS = {
|
|
2
|
+
selectCategoryValueViews: [
|
|
3
|
+
{
|
|
4
|
+
count: 248890,
|
|
5
|
+
key: "female",
|
|
6
|
+
label: "female",
|
|
7
|
+
selected: false,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
count: 204935,
|
|
11
|
+
key: "male",
|
|
12
|
+
label: "male",
|
|
13
|
+
selected: false,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
count: 240,
|
|
17
|
+
key: "mixed",
|
|
18
|
+
label: "mixed",
|
|
19
|
+
selected: false,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
count: 78715,
|
|
23
|
+
key: "unknown",
|
|
24
|
+
label: "unknown",
|
|
25
|
+
selected: false,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
count: 1561,
|
|
29
|
+
key: null,
|
|
30
|
+
label: "Unspecified",
|
|
31
|
+
selected: false,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
width: 800,
|
|
35
|
+
};
|
|
36
|
+
export const SELECT_CHART_ARGS = {
|
|
37
|
+
selectCategoryValueViews: [
|
|
38
|
+
{
|
|
39
|
+
count: 248890,
|
|
40
|
+
key: "female",
|
|
41
|
+
label: "female",
|
|
42
|
+
selected: false,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
count: 204935,
|
|
46
|
+
key: "male",
|
|
47
|
+
label: "male",
|
|
48
|
+
selected: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
count: 240,
|
|
52
|
+
key: "mixed",
|
|
53
|
+
label: "mixed",
|
|
54
|
+
selected: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
count: 78715,
|
|
58
|
+
key: "unknown",
|
|
59
|
+
label: "unknown",
|
|
60
|
+
selected: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
count: 1561,
|
|
64
|
+
key: null,
|
|
65
|
+
label: "Unspecified",
|
|
66
|
+
selected: true,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
width: 800,
|
|
70
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Chart } from "../chart";
|
|
3
|
+
declare const meta: Meta<typeof Chart>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Selected: Story;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PALETTE } from "../../../../../../../../../styles/common/constants/palette";
|
|
4
|
+
import { Chart } from "../chart";
|
|
5
|
+
import { CHART_ARGS, SELECT_CHART_ARGS } from "./args";
|
|
6
|
+
const meta = {
|
|
7
|
+
args: CHART_ARGS,
|
|
8
|
+
component: Chart,
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story, context) => (React.createElement(Box, { sx: { backgroundColor: PALETTE.COMMON_WHITE, padding: 5 } },
|
|
11
|
+
React.createElement(Story, { ...context }))),
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export const Default = {};
|
|
16
|
+
export const Selected = {
|
|
17
|
+
args: SELECT_CHART_ARGS,
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlotOptions } from "@observablehq/plot";
|
|
2
|
+
import { SelectCategoryValueView } from "../../../../../../../../common/entities";
|
|
3
|
+
import { TestIdProps } from "../../../../../../../types";
|
|
4
|
+
export interface ChartProps extends Required<Pick<PlotOptions, "width">>, TestIdProps {
|
|
5
|
+
selectCategoryValueViews: SelectCategoryValueView[];
|
|
6
|
+
}
|
package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CHART_VIEW_TEST_ID = "chart-view";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHART_VIEW_TEST_ID = "chart-view";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMemo, useRef } from "react";
|
|
2
|
+
import { getBorderBoxSize, useResizeObserver, } from "../../../../../../../../hooks/useResizeObserver";
|
|
3
|
+
import { getSelectCategoryViews, getSVGWidth } from "../../utils";
|
|
4
|
+
export const useChartView = (categoryFilters) => {
|
|
5
|
+
const chartViewRef = useRef(null);
|
|
6
|
+
const selectCategoryViews = useMemo(() => getSelectCategoryViews(categoryFilters), [categoryFilters]);
|
|
7
|
+
const shouldObserve = useMemo(() => selectCategoryViews.length > 0, [selectCategoryViews]);
|
|
8
|
+
const chartViewRect = useResizeObserver(chartViewRef, getBorderBoxSize, shouldObserve);
|
|
9
|
+
const width = getSVGWidth(chartViewRect?.width);
|
|
10
|
+
return { chartViewRef, selectCategoryViews, width };
|
|
11
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export const CHART_VIEW_ARGS = {
|
|
2
|
+
categoryFilters: [
|
|
3
|
+
{
|
|
4
|
+
categoryViews: [
|
|
5
|
+
{
|
|
6
|
+
enableChartView: true,
|
|
7
|
+
key: "biological-sex",
|
|
8
|
+
label: "Biological Sex",
|
|
9
|
+
values: [
|
|
10
|
+
{
|
|
11
|
+
count: 248890,
|
|
12
|
+
key: "female",
|
|
13
|
+
label: "female",
|
|
14
|
+
selected: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
count: 204935,
|
|
18
|
+
key: "male",
|
|
19
|
+
label: "male",
|
|
20
|
+
selected: false,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
count: 240,
|
|
24
|
+
key: "mixed",
|
|
25
|
+
label: "mixed",
|
|
26
|
+
selected: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
count: 78715,
|
|
30
|
+
key: "unknown",
|
|
31
|
+
label: "unknown",
|
|
32
|
+
selected: false,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
count: 1561,
|
|
36
|
+
key: null,
|
|
37
|
+
label: "Unspecified",
|
|
38
|
+
selected: false,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
enableChartView: true,
|
|
44
|
+
key: "genusSpecies",
|
|
45
|
+
label: "Genus Species",
|
|
46
|
+
values: [
|
|
47
|
+
{
|
|
48
|
+
count: 824,
|
|
49
|
+
key: "canis lupus familiaris",
|
|
50
|
+
label: "canis lupus familiaris",
|
|
51
|
+
selected: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
count: 243550,
|
|
55
|
+
key: "Homo sapiens",
|
|
56
|
+
label: "Homo sapiens",
|
|
57
|
+
selected: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
count: 277513,
|
|
61
|
+
key: "Mus musculus",
|
|
62
|
+
label: "Mus musculus",
|
|
63
|
+
selected: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
count: 1292,
|
|
67
|
+
key: null,
|
|
68
|
+
label: "Unspecified",
|
|
69
|
+
selected: false,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
enableChartView: false,
|
|
75
|
+
key: "pairedEnd",
|
|
76
|
+
label: "Paired End",
|
|
77
|
+
values: [
|
|
78
|
+
{
|
|
79
|
+
count: 148558,
|
|
80
|
+
key: "false",
|
|
81
|
+
label: "false",
|
|
82
|
+
selected: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
count: 366376,
|
|
86
|
+
key: "true",
|
|
87
|
+
label: "true",
|
|
88
|
+
selected: false,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
entityName: "Projects",
|
|
96
|
+
loading: false,
|
|
97
|
+
};
|