@google-psat/design-system 0.14.1 → 1.2.1
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/dist/components/breadcrumbs/index.jsx +10 -15
- package/dist/components/breadcrumbs/index.jsx.map +1 -1
- package/dist/components/bulletList/index.jsx +6 -14
- package/dist/components/bulletList/index.jsx.map +1 -1
- package/dist/components/bulletList/listRow.jsx +19 -40
- package/dist/components/bulletList/listRow.jsx.map +1 -1
- package/dist/components/button/index.jsx +17 -16
- package/dist/components/button/index.jsx.map +1 -1
- package/dist/components/chipsBar/chip.jsx +5 -10
- package/dist/components/chipsBar/chip.jsx.map +1 -1
- package/dist/components/chipsBar/chipsList.jsx +4 -9
- package/dist/components/chipsBar/chipsList.jsx.map +1 -1
- package/dist/components/chipsBar/index.jsx +12 -14
- package/dist/components/chipsBar/index.jsx.map +1 -1
- package/dist/components/circle/circleEmpty.jsx +4 -9
- package/dist/components/circle/circleEmpty.jsx.map +1 -1
- package/dist/components/circle/index.jsx +3 -8
- package/dist/components/circle/index.jsx.map +1 -1
- package/dist/components/circlePieChart/emptyCirclePieChart.jsx +9 -12
- package/dist/components/circlePieChart/emptyCirclePieChart.jsx.map +1 -1
- package/dist/components/circlePieChart/index.jsx +18 -21
- package/dist/components/circlePieChart/index.jsx.map +1 -1
- package/dist/components/circlePieChart/tooltip.jsx +26 -0
- package/dist/components/circlePieChart/tooltip.jsx.map +1 -0
- package/dist/components/cookieDetails/details.jsx +76 -105
- package/dist/components/cookieDetails/details.jsx.map +1 -1
- package/dist/components/cookieDetails/index.jsx +8 -13
- package/dist/components/cookieDetails/index.jsx.map +1 -1
- package/dist/components/cookieTable/index.jsx +32 -57
- package/dist/components/cookieTable/index.jsx.map +1 -1
- package/dist/components/cookieTable/utils/conditionalTableRowClassesHandler.js +14 -19
- package/dist/components/cookieTable/utils/conditionalTableRowClassesHandler.js.map +1 -1
- package/dist/components/cookieTable/utils/exportCookies.js +6 -8
- package/dist/components/cookieTable/utils/exportCookies.js.map +1 -1
- package/dist/components/cookieTable/utils/index.js +2 -10
- package/dist/components/cookieTable/utils/index.js.map +1 -1
- package/dist/components/cookiesLanding/cookiesLandingWrapper.jsx +6 -11
- package/dist/components/cookiesLanding/cookiesLandingWrapper.jsx.map +1 -1
- package/dist/components/cookiesLanding/cookiesMatrix/index.jsx +19 -20
- package/dist/components/cookiesLanding/cookiesMatrix/index.jsx.map +1 -1
- package/dist/components/cookiesLanding/index.jsx +2 -7
- package/dist/components/cookiesLanding/index.jsx.map +1 -1
- package/dist/components/cookiesLanding/landingHeader/index.jsx +11 -18
- package/dist/components/cookiesLanding/landingHeader/index.jsx.map +1 -1
- package/dist/components/cookiesLanding/useFiltersMapping.jsx +13 -11
- package/dist/components/cookiesLanding/useFiltersMapping.jsx.map +1 -1
- package/dist/components/cookiesLanding/useGlobalFiltering.jsx +77 -83
- package/dist/components/cookiesLanding/useGlobalFiltering.jsx.map +1 -1
- package/dist/components/draggableTray/index.jsx +36 -52
- package/dist/components/draggableTray/index.jsx.map +1 -1
- package/dist/components/dropdown/index.jsx +30 -0
- package/dist/components/dropdown/index.jsx.map +1 -0
- package/dist/components/dropdown/options.jsx +41 -0
- package/dist/components/dropdown/options.jsx.map +1 -0
- package/dist/components/errorFallback/extensionReloadNotification.jsx +5 -11
- package/dist/components/errorFallback/extensionReloadNotification.jsx.map +1 -1
- package/dist/components/errorFallback/index.jsx +6 -11
- package/dist/components/errorFallback/index.jsx.map +1 -1
- package/dist/components/exportButton/index.jsx +7 -12
- package/dist/components/exportButton/index.jsx.map +1 -1
- package/dist/components/filtersSidebar/index.jsx +14 -42
- package/dist/components/filtersSidebar/index.jsx.map +1 -1
- package/dist/components/filtersSidebar/listItem.jsx +20 -50
- package/dist/components/filtersSidebar/listItem.jsx.map +1 -1
- package/dist/components/filtersSidebar/option.jsx +6 -34
- package/dist/components/filtersSidebar/option.jsx.map +1 -1
- package/dist/components/filtersSidebar/subList.jsx +9 -37
- package/dist/components/filtersSidebar/subList.jsx.map +1 -1
- package/dist/components/frameContent/index.jsx +5 -10
- package/dist/components/frameContent/index.jsx.map +1 -1
- package/dist/components/index.js +60 -119
- package/dist/components/index.js.map +1 -1
- package/dist/components/inspectButton/index.jsx +7 -12
- package/dist/components/inspectButton/index.jsx.map +1 -1
- package/dist/components/jsonView/index.js +1 -8
- package/dist/components/jsonView/index.js.map +1 -1
- package/dist/components/jsonView/jsonTheme.js +1 -5
- package/dist/components/jsonView/jsonTheme.js.map +1 -1
- package/dist/components/jsonView/jsonView.jsx +11 -41
- package/dist/components/jsonView/jsonView.jsx.map +1 -1
- package/dist/components/landingPage/LandingPage.jsx +32 -64
- package/dist/components/landingPage/LandingPage.jsx.map +1 -1
- package/dist/components/landingPage/cardsPanel.jsx +33 -44
- package/dist/components/landingPage/cardsPanel.jsx.map +1 -1
- package/dist/components/landingPage/constants.js +1 -4
- package/dist/components/landingPage/constants.js.map +1 -1
- package/dist/components/landingPage/contentPanel.jsx +27 -28
- package/dist/components/landingPage/contentPanel.jsx.map +1 -1
- package/dist/components/landingPage/getStoryPlayerMarkup.js +3 -8
- package/dist/components/landingPage/getStoryPlayerMarkup.js.map +1 -1
- package/dist/components/landingPage/index.jsx +23 -47
- package/dist/components/landingPage/index.jsx.map +1 -1
- package/dist/components/landingPage/infoCard/fetchPSInfo.js +7 -21
- package/dist/components/landingPage/infoCard/fetchPSInfo.js.map +1 -1
- package/dist/components/landingPage/infoCard/index.jsx +28 -58
- package/dist/components/landingPage/infoCard/index.jsx.map +1 -1
- package/dist/components/landingPage/infoCard/learnMoreDropdown.jsx +13 -17
- package/dist/components/landingPage/infoCard/learnMoreDropdown.jsx.map +1 -1
- package/dist/components/landingPage/infoCard/renderLink.jsx +5 -10
- package/dist/components/landingPage/infoCard/renderLink.jsx.map +1 -1
- package/dist/components/landingPage/quickLinksList.jsx +29 -64
- package/dist/components/landingPage/quickLinksList.jsx.map +1 -1
- package/dist/components/landingPage/supportLink.jsx +8 -13
- package/dist/components/landingPage/supportLink.jsx.map +1 -1
- package/dist/components/link/index.jsx +7 -41
- package/dist/components/link/index.jsx.map +1 -1
- package/dist/components/linkProcessor/index.jsx +13 -41
- package/dist/components/linkProcessor/index.jsx.map +1 -1
- package/dist/components/matrix/index.jsx +10 -13
- package/dist/components/matrix/index.jsx.map +1 -1
- package/dist/components/matrix/matrixComponent/index.jsx +6 -11
- package/dist/components/matrix/matrixComponent/index.jsx.map +1 -1
- package/dist/components/matrix/matrixComponent/matrixComponentHorizontal.jsx +4 -9
- package/dist/components/matrix/matrixComponent/matrixComponentHorizontal.jsx.map +1 -1
- package/dist/components/matrixContainer/index.jsx +15 -43
- package/dist/components/matrixContainer/index.jsx.map +1 -1
- package/dist/components/menuBar/index.jsx +31 -69
- package/dist/components/menuBar/index.jsx.map +1 -1
- package/dist/components/menuBar/utils/index.js +1 -8
- package/dist/components/menuBar/utils/index.js.map +1 -1
- package/dist/components/menuBar/utils/isElementInView.js +1 -4
- package/dist/components/menuBar/utils/isElementInView.js.map +1 -1
- package/dist/components/messageBox/index.jsx +8 -11
- package/dist/components/messageBox/index.jsx.map +1 -1
- package/dist/components/multiSelectDropDown/index.jsx +143 -0
- package/dist/components/multiSelectDropDown/index.jsx.map +1 -0
- package/dist/components/pill/index.jsx +2 -7
- package/dist/components/pill/index.jsx.map +1 -1
- package/dist/components/pillToggle/index.jsx +60 -24
- package/dist/components/pillToggle/index.jsx.map +1 -1
- package/dist/components/progressBar/borderProgressbar.jsx +2 -7
- package/dist/components/progressBar/borderProgressbar.jsx.map +1 -1
- package/dist/components/progressBar/index.jsx +2 -7
- package/dist/components/progressBar/index.jsx.map +1 -1
- package/dist/components/refreshButton/index.jsx +5 -10
- package/dist/components/refreshButton/index.jsx.map +1 -1
- package/dist/components/resizableTray/index.jsx +74 -0
- package/dist/components/resizableTray/index.jsx.map +1 -0
- package/dist/components/searchInput/index.jsx +20 -46
- package/dist/components/searchInput/index.jsx.map +1 -1
- package/dist/components/sidebar/collapsedSidebar.jsx +19 -47
- package/dist/components/sidebar/collapsedSidebar.jsx.map +1 -1
- package/dist/components/sidebar/expandedSidebar.jsx +19 -50
- package/dist/components/sidebar/expandedSidebar.jsx.map +1 -1
- package/dist/components/sidebar/index.js +3 -24
- package/dist/components/sidebar/index.js.map +1 -1
- package/dist/components/sidebar/sidebar.jsx +10 -15
- package/dist/components/sidebar/sidebar.jsx.map +1 -1
- package/dist/components/sidebar/sidebarChild.jsx +38 -53
- package/dist/components/sidebar/sidebarChild.jsx.map +1 -1
- package/dist/components/sidebar/useSidebar/constants.js +4 -5
- package/dist/components/sidebar/useSidebar/constants.js.map +1 -1
- package/dist/components/sidebar/useSidebar/context.js +9 -12
- package/dist/components/sidebar/useSidebar/context.js.map +1 -1
- package/dist/components/sidebar/useSidebar/index.js +3 -19
- package/dist/components/sidebar/useSidebar/index.js.map +1 -1
- package/dist/components/sidebar/useSidebar/provider.jsx +77 -100
- package/dist/components/sidebar/useSidebar/provider.jsx.map +1 -1
- package/dist/components/sidebar/useSidebar/types.js +1 -2
- package/dist/components/sidebar/useSidebar/types.js.map +1 -1
- package/dist/components/sidebar/useSidebar/useSidebar.jsx +4 -7
- package/dist/components/sidebar/useSidebar/useSidebar.jsx.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/createKeyPath.js +3 -8
- package/dist/components/sidebar/useSidebar/utils/createKeyPath.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/findItem.js +11 -9
- package/dist/components/sidebar/useSidebar/utils/findItem.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/findKeyParent.js +1 -3
- package/dist/components/sidebar/useSidebar/utils/findKeyParent.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/findNextItem.js +7 -12
- package/dist/components/sidebar/useSidebar/utils/findNextItem.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/findPrevItem.js +6 -11
- package/dist/components/sidebar/useSidebar/utils/findPrevItem.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/index.js +6 -18
- package/dist/components/sidebar/useSidebar/utils/index.js.map +1 -1
- package/dist/components/sidebar/useSidebar/utils/matchKey.js +1 -3
- package/dist/components/sidebar/useSidebar/utils/matchKey.js.map +1 -1
- package/dist/components/slider/index.jsx +29 -0
- package/dist/components/slider/index.jsx.map +1 -0
- package/dist/components/table/components/columnMenu/columnList.jsx +7 -35
- package/dist/components/table/components/columnMenu/columnList.jsx.map +1 -1
- package/dist/components/table/components/columnMenu/columnListItem.jsx +4 -9
- package/dist/components/table/components/columnMenu/columnListItem.jsx.map +1 -1
- package/dist/components/table/components/columnMenu/index.jsx +32 -46
- package/dist/components/table/components/columnMenu/index.jsx.map +1 -1
- package/dist/components/table/components/filtersSidebar/chips/index.jsx +4 -9
- package/dist/components/table/components/filtersSidebar/chips/index.jsx.map +1 -1
- package/dist/components/table/components/filtersSidebar/index.jsx +7 -35
- package/dist/components/table/components/filtersSidebar/index.jsx.map +1 -1
- package/dist/components/table/components/index.jsx +58 -71
- package/dist/components/table/components/index.jsx.map +1 -1
- package/dist/components/table/components/tableBody/bodyCell.jsx +22 -22
- package/dist/components/table/components/tableBody/bodyCell.jsx.map +1 -1
- package/dist/components/table/components/tableBody/bodyRow.jsx +33 -57
- package/dist/components/table/components/tableBody/bodyRow.jsx.map +1 -1
- package/dist/components/table/components/tableBody/index.jsx +39 -60
- package/dist/components/table/components/tableBody/index.jsx.map +1 -1
- package/dist/components/table/components/tableHeader/headerCell.jsx +25 -52
- package/dist/components/table/components/tableHeader/headerCell.jsx.map +1 -1
- package/dist/components/table/components/tableHeader/headerResizer.jsx +2 -7
- package/dist/components/table/components/tableHeader/headerResizer.jsx.map +1 -1
- package/dist/components/table/components/tableHeader/headerRow.jsx +8 -13
- package/dist/components/table/components/tableHeader/headerRow.jsx.map +1 -1
- package/dist/components/table/components/tableHeader/index.jsx +7 -35
- package/dist/components/table/components/tableHeader/index.jsx.map +1 -1
- package/dist/components/table/components/tableTopBar/index.jsx +10 -15
- package/dist/components/table/components/tableTopBar/index.jsx.map +1 -1
- package/dist/components/table/index.js +11 -38
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/table/persistentSettingsStore/index.jsx +28 -69
- package/dist/components/table/persistentSettingsStore/index.jsx.map +1 -1
- package/dist/components/table/persistentSettingsStore/utils/extractStorage.js +8 -19
- package/dist/components/table/persistentSettingsStore/utils/extractStorage.js.map +1 -1
- package/dist/components/table/persistentSettingsStore/utils/index.js +2 -10
- package/dist/components/table/persistentSettingsStore/utils/index.js.map +1 -1
- package/dist/components/table/persistentSettingsStore/utils/updateStorage.js +24 -32
- package/dist/components/table/persistentSettingsStore/utils/updateStorage.js.map +1 -1
- package/dist/components/table/useTable/context.js +19 -18
- package/dist/components/table/useTable/context.js.map +1 -1
- package/dist/components/table/useTable/index.js +3 -19
- package/dist/components/table/useTable/index.js.map +1 -1
- package/dist/components/table/useTable/provider.jsx +78 -62
- package/dist/components/table/useTable/provider.jsx.map +1 -1
- package/dist/components/table/useTable/types.js +1 -2
- package/dist/components/table/useTable/useColumnResizing/index.jsx +237 -125
- package/dist/components/table/useTable/useColumnResizing/index.jsx.map +1 -1
- package/dist/components/table/useTable/useColumnSorting/index.jsx +16 -20
- package/dist/components/table/useTable/useColumnSorting/index.jsx.map +1 -1
- package/dist/components/table/useTable/useColumnVisibility/index.jsx +22 -24
- package/dist/components/table/useTable/useColumnVisibility/index.jsx.map +1 -1
- package/dist/components/table/useTable/useFiltering/hooks/index.js +3 -12
- package/dist/components/table/useTable/useFiltering/hooks/index.js.map +1 -1
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersExtraction.jsx +44 -39
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersExtraction.jsx.map +1 -1
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersOptions.jsx +14 -16
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersOptions.jsx.map +1 -1
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersPersistence.jsx +39 -25
- package/dist/components/table/useTable/useFiltering/hooks/useFiltersPersistence.jsx.map +1 -1
- package/dist/components/table/useTable/useFiltering/index.jsx +58 -47
- package/dist/components/table/useTable/useFiltering/index.jsx.map +1 -1
- package/dist/components/table/useTable/useSearch/index.jsx +11 -13
- package/dist/components/table/useTable/useSearch/index.jsx.map +1 -1
- package/dist/components/table/useTable/useTable.jsx +4 -7
- package/dist/components/table/useTable/useTable.jsx.map +1 -1
- package/dist/components/table/utils/index.js +1 -17
- package/dist/components/table/utils/index.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateBlockedReasonsFilterValues.js +5 -7
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateBlockedReasonsFilterValues.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateDynamicFilterValues.js +6 -8
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateDynamicFilterValues.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateExemptionReasons.js +2 -4
- package/dist/components/table/utils/precalculatedFiltersUtils/calculateExemptionReasons.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/evaluateSelectAllOption.js +5 -8
- package/dist/components/table/utils/precalculatedFiltersUtils/evaluateSelectAllOption.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/evaluateStaticFilterValues.js +3 -6
- package/dist/components/table/utils/precalculatedFiltersUtils/evaluateStaticFilterValues.js.map +1 -1
- package/dist/components/table/utils/precalculatedFiltersUtils/index.js +5 -16
- package/dist/components/table/utils/precalculatedFiltersUtils/index.js.map +1 -1
- package/dist/components/tabs/index.jsx +132 -75
- package/dist/components/tabs/index.jsx.map +1 -1
- package/dist/components/tabs/useTabs/context.js +12 -9
- package/dist/components/tabs/useTabs/context.js.map +1 -1
- package/dist/components/tabs/useTabs/index.js +3 -19
- package/dist/components/tabs/useTabs/index.js.map +1 -1
- package/dist/components/tabs/useTabs/provider.jsx +144 -62
- package/dist/components/tabs/useTabs/provider.jsx.map +1 -1
- package/dist/components/tabs/useTabs/types.js +1 -2
- package/dist/components/tabs/useTabs/useTabs.jsx +4 -7
- package/dist/components/tabs/useTabs/useTabs.jsx.map +1 -1
- package/dist/components/timeline/bar.jsx +71 -0
- package/dist/components/timeline/bar.jsx.map +1 -0
- package/dist/components/timeline/constants.js +29 -0
- package/dist/components/timeline/constants.js.map +1 -0
- package/dist/components/timeline/index.jsx +195 -0
- package/dist/components/timeline/index.jsx.map +1 -0
- package/dist/components/toastMessage/index.jsx +2 -7
- package/dist/components/toastMessage/index.jsx.map +1 -1
- package/dist/components/toggleSwitch/index.jsx +2 -7
- package/dist/components/toggleSwitch/index.jsx.map +1 -1
- package/dist/components/topbar/index.jsx +13 -41
- package/dist/components/topbar/index.jsx.map +1 -1
- package/dist/constants.js +9 -12
- package/dist/constants.js.map +1 -1
- package/dist/icons/index.jsx +118 -225
- package/dist/icons/index.jsx.map +1 -1
- package/dist/icons/ps-icons/index.js +12 -30
- package/dist/icons/ps-icons/index.js.map +1 -1
- package/dist/index.js +5 -21
- package/dist/index.js.map +1 -1
- package/dist/test-data/cookieMockData.js +44 -22
- package/dist/test-data/cookieMockData.js.map +1 -1
- package/dist/test-data/cookieStats.js +1 -3
- package/dist/test-data/cookieStats.js.map +1 -1
- package/dist/test-data/cookieTableBody.js +9 -14
- package/dist/test-data/cookieTableBody.js.map +1 -1
- package/dist/test-data/cookieTableMockData.jsx +18 -24
- package/dist/test-data/cookieTableMockData.jsx.map +1 -1
- package/dist/test-data/cookiesStatsComponents.js +1 -3
- package/dist/test-data/cookiesStatsComponents.js.map +1 -1
- package/dist/theme/colors.js +1 -4
- package/dist/theme/colors.js.map +1 -1
- package/dist/utils/index.js +6 -18
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/noop.js +1 -5
- package/dist/utils/noop.js.map +1 -1
- package/dist/utils/prepareCookieDataMapping.js +7 -10
- package/dist/utils/prepareCookieDataMapping.js.map +1 -1
- package/dist/utils/prepareCookieStatsComponents.js +29 -33
- package/dist/utils/prepareCookieStatsComponents.js.map +1 -1
- package/dist/utils/prepareCookiesCount.js +12 -25
- package/dist/utils/prepareCookiesCount.js.map +1 -1
- package/dist/utils/prepareFrameStatsComponent.js +19 -24
- package/dist/utils/prepareFrameStatsComponent.js.map +1 -1
- package/dist/utils/prepareFrameStatsComponentForExtensionDashboard.js +16 -21
- package/dist/utils/prepareFrameStatsComponentForExtensionDashboard.js.map +1 -1
- package/dist-types/components/button/index.d.ts +2 -1
- package/dist-types/components/chipsBar/index.d.ts +1 -1
- package/dist-types/components/circlePieChart/emptyCirclePieChart.d.ts +4 -1
- package/dist-types/components/circlePieChart/index.d.ts +3 -1
- package/dist-types/components/circlePieChart/tooltip.d.ts +8 -0
- package/dist-types/components/draggableTray/index.d.ts +4 -0
- package/dist-types/components/dropdown/index.d.ts +18 -0
- package/dist-types/components/dropdown/options.d.ts +20 -0
- package/dist-types/components/index.d.ts +7 -0
- package/dist-types/components/landingPage/LandingPage.d.ts +2 -5
- package/dist-types/components/landingPage/cardsPanel.d.ts +7 -8
- package/dist-types/components/landingPage/contentPanel.d.ts +1 -1
- package/dist-types/components/landingPage/infoCard/fetchPSInfo.d.ts +2 -0
- package/dist-types/components/landingPage/infoCard/index.d.ts +2 -1
- package/dist-types/components/link/index.d.ts +2 -1
- package/dist-types/components/messageBox/index.d.ts +5 -1
- package/dist-types/components/multiSelectDropDown/index.d.ts +14 -0
- package/dist-types/components/pillToggle/index.d.ts +8 -5
- package/dist-types/components/resizableTray/index.d.ts +15 -0
- package/dist-types/components/searchInput/index.d.ts +4 -1
- package/dist-types/components/sidebar/expandedSidebar.d.ts +2 -1
- package/dist-types/components/sidebar/sidebar.d.ts +2 -1
- package/dist-types/components/sidebar/sidebarChild.d.ts +2 -1
- package/dist-types/components/sidebar/useSidebar/constants.d.ts +3 -1
- package/dist-types/components/sidebar/useSidebar/context.d.ts +6 -2
- package/dist-types/components/sidebar/useSidebar/types.d.ts +2 -0
- package/dist-types/components/sidebar/useSidebar/utils/findItem.d.ts +2 -1
- package/dist-types/components/slider/index.d.ts +14 -0
- package/dist-types/components/table/components/index.d.ts +4 -2
- package/dist-types/components/table/components/tableBody/bodyCell.d.ts +5 -2
- package/dist-types/components/table/components/tableBody/bodyRow.d.ts +3 -2
- package/dist-types/components/table/components/tableBody/index.d.ts +3 -2
- package/dist-types/components/table/components/tableHeader/headerCell.d.ts +4 -2
- package/dist-types/components/table/components/tableTopBar/index.d.ts +2 -1
- package/dist-types/components/table/persistentSettingsStore/index.d.ts +1 -1
- package/dist-types/components/table/useTable/context.d.ts +13 -5
- package/dist-types/components/table/useTable/provider.d.ts +1 -1
- package/dist-types/components/table/useTable/types.d.ts +47 -4
- package/dist-types/components/table/useTable/useColumnResizing/index.d.ts +11 -9
- package/dist-types/components/table/useTable/useFiltering/index.d.ts +1 -1
- package/dist-types/components/tabs/index.d.ts +1 -1
- package/dist-types/components/tabs/useTabs/context.d.ts +11 -1
- package/dist-types/components/tabs/useTabs/provider.d.ts +2 -2
- package/dist-types/components/tabs/useTabs/types.d.ts +8 -3
- package/dist-types/components/timeline/bar.d.ts +16 -0
- package/dist-types/components/timeline/constants.d.ts +8 -0
- package/dist-types/components/timeline/index.d.ts +12 -0
- package/dist-types/icons/index.d.ts +117 -101
- package/dist-types/icons/ps-icons/index.d.ts +12 -12
- package/package.json +12 -7
- package/tsconfig.json +5 -3
- package/dist/components/button/stories/Button.stories.jsx +0 -23
- package/dist/components/button/stories/Button.stories.jsx.map +0 -1
- package/dist/components/circle/stories/circle.stories.jsx +0 -26
- package/dist/components/circle/stories/circle.stories.jsx.map +0 -1
- package/dist/components/circle/stories/circleEmpty.stories.jsx +0 -18
- package/dist/components/circle/stories/circleEmpty.stories.jsx.map +0 -1
- package/dist/components/circlePieChart/stories/circlePieChart.stories.jsx +0 -91
- package/dist/components/circlePieChart/stories/circlePieChart.stories.jsx.map +0 -1
- package/dist/components/circlePieChart/stories/emptyCirclePieChart.stories.jsx +0 -48
- package/dist/components/circlePieChart/stories/emptyCirclePieChart.stories.jsx.map +0 -1
- package/dist/components/cookieDetails/stories/cookieDetails.stories.js +0 -30
- package/dist/components/cookieDetails/stories/cookieDetails.stories.js.map +0 -1
- package/dist/components/cookieDetails/stories/details.stories.js +0 -30
- package/dist/components/cookieDetails/stories/details.stories.js.map +0 -1
- package/dist/components/cookiesLanding/cookiesMatrix/stories/cookiesMatrix.stories.jsx +0 -59
- package/dist/components/cookiesLanding/cookiesMatrix/stories/cookiesMatrix.stories.jsx.map +0 -1
- package/dist/components/cookiesLanding/landingHeader/stories/LandingHeader.stories.jsx +0 -40
- package/dist/components/cookiesLanding/landingHeader/stories/LandingHeader.stories.jsx.map +0 -1
- package/dist/components/cookiesLanding/stories/cookiesLanding.stories.jsx +0 -20
- package/dist/components/cookiesLanding/stories/cookiesLanding.stories.jsx.map +0 -1
- package/dist/components/errorFallback/stories/errorFallback.stories.jsx +0 -31
- package/dist/components/errorFallback/stories/errorFallback.stories.jsx.map +0 -1
- package/dist/components/errorFallback/stories/extensionReloadNotification.stories.jsx +0 -20
- package/dist/components/errorFallback/stories/extensionReloadNotification.stories.jsx.map +0 -1
- package/dist/components/matrix/matrixComponent/stories/MatrixComponent.stories.jsx +0 -27
- package/dist/components/matrix/matrixComponent/stories/MatrixComponent.stories.jsx.map +0 -1
- package/dist/components/matrix/matrixComponent/stories/matrixComponentHorizontal.stories.jsx +0 -25
- package/dist/components/matrix/matrixComponent/stories/matrixComponentHorizontal.stories.jsx.map +0 -1
- package/dist/components/matrix/stories/matrix.stories.jsx +0 -59
- package/dist/components/matrix/stories/matrix.stories.jsx.map +0 -1
- package/dist/components/messageBox/stories/messageBox.stories.jsx +0 -23
- package/dist/components/messageBox/stories/messageBox.stories.jsx.map +0 -1
- package/dist/components/progressBar/stories/progressBar.stories.jsx +0 -22
- package/dist/components/progressBar/stories/progressBar.stories.jsx.map +0 -1
- package/dist/components/table/useTable/useColumnResizing/handleResizeOnColumnsVisibilityChange.js +0 -61
- package/dist/components/table/useTable/useColumnResizing/handleResizeOnColumnsVisibilityChange.js.map +0 -1
- package/dist/components/table/useTable/useColumnResizing/resizeColumns.js +0 -54
- package/dist/components/table/useTable/useColumnResizing/resizeColumns.js.map +0 -1
- package/dist-types/components/button/stories/Button.stories.d.ts +0 -11
- package/dist-types/components/circle/stories/circle.stories.d.ts +0 -11
- package/dist-types/components/circle/stories/circleEmpty.stories.d.ts +0 -11
- package/dist-types/components/circlePieChart/stories/circlePieChart.stories.d.ts +0 -9
- package/dist-types/components/circlePieChart/stories/emptyCirclePieChart.stories.d.ts +0 -9
- package/dist-types/components/cookieDetails/stories/cookieDetails.stories.d.ts +0 -12
- package/dist-types/components/cookieDetails/stories/details.stories.d.ts +0 -12
- package/dist-types/components/cookiesLanding/cookiesMatrix/stories/cookiesMatrix.stories.d.ts +0 -11
- package/dist-types/components/cookiesLanding/landingHeader/stories/LandingHeader.stories.d.ts +0 -11
- package/dist-types/components/cookiesLanding/stories/cookiesLanding.stories.d.ts +0 -11
- package/dist-types/components/errorFallback/stories/errorFallback.stories.d.ts +0 -12
- package/dist-types/components/errorFallback/stories/extensionReloadNotification.stories.d.ts +0 -11
- package/dist-types/components/matrix/matrixComponent/stories/MatrixComponent.stories.d.ts +0 -11
- package/dist-types/components/matrix/matrixComponent/stories/matrixComponentHorizontal.stories.d.ts +0 -11
- package/dist-types/components/matrix/stories/matrix.stories.d.ts +0 -11
- package/dist-types/components/messageBox/stories/messageBox.stories.d.ts +0 -11
- package/dist-types/components/progressBar/stories/progressBar.stories.d.ts +0 -11
- package/dist-types/components/table/useTable/useColumnResizing/handleResizeOnColumnsVisibilityChange.d.ts +0 -7
- package/dist-types/components/table/useTable/useColumnResizing/resizeColumns.d.ts +0 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,13 +13,11 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SidebarContext = exports.initialState = void 0;
|
|
19
16
|
/**
|
|
20
17
|
* External dependencies.
|
|
21
18
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
import { createContext, noop } from '@google-psat/common';
|
|
20
|
+
export const initialState = {
|
|
24
21
|
state: {
|
|
25
22
|
activePanel: {
|
|
26
23
|
panel: {
|
|
@@ -28,7 +25,7 @@ exports.initialState = {
|
|
|
28
25
|
props: {},
|
|
29
26
|
},
|
|
30
27
|
query: '',
|
|
31
|
-
clearQuery:
|
|
28
|
+
clearQuery: noop,
|
|
32
29
|
},
|
|
33
30
|
selectedItemKey: null,
|
|
34
31
|
currentItemKey: null,
|
|
@@ -39,15 +36,15 @@ exports.initialState = {
|
|
|
39
36
|
isCollapsed: false,
|
|
40
37
|
},
|
|
41
38
|
actions: {
|
|
42
|
-
setIsSidebarFocused:
|
|
43
|
-
updateSelectedItemKey:
|
|
44
|
-
onKeyNavigation:
|
|
45
|
-
toggleDropdown:
|
|
39
|
+
setIsSidebarFocused: noop,
|
|
40
|
+
updateSelectedItemKey: noop,
|
|
41
|
+
onKeyNavigation: noop,
|
|
42
|
+
toggleDropdown: noop,
|
|
46
43
|
isKeyAncestor: () => false,
|
|
47
44
|
isKeySelected: () => false,
|
|
48
|
-
toggleSidebarCollapse:
|
|
45
|
+
toggleSidebarCollapse: noop,
|
|
49
46
|
extractSelectedItemKeyTitles: () => [],
|
|
50
47
|
},
|
|
51
48
|
};
|
|
52
|
-
|
|
49
|
+
export const SidebarContext = createContext(initialState);
|
|
53
50
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAyCxE,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C,KAAK,EAAE;QACL,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,OAAO,EAAE,GAAG,EAAE,CAAC,EAAS;gBACxB,KAAK,EAAE,EAAE;aACV;YACD,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,IAAI;SACjB;QACD,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,IAAI;QACpB,YAAY,EAAE,EAAE;QAChB,qBAAqB,EAAE,SAAS;QAChC,gBAAgB,EAAE,IAAI;QACtB,oBAAoB,EAAE,KAAK;QAC3B,WAAW,EAAE,KAAK;KACnB;IACD,OAAO,EAAE;QACP,mBAAmB,EAAE,IAAI;QACzB,qBAAqB,EAAE,IAAI;QAC3B,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,qBAAqB,EAAE,IAAI;QAC3B,4BAA4B,EAAE,GAAG,EAAE,CAAC,EAAE;KACvC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GACzB,aAAa,CAAsB,YAAY,CAAC,CAAC"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
1
|
/*
|
|
18
2
|
* Copyright 2023 Google LLC
|
|
19
3
|
*
|
|
@@ -29,7 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
13
|
* See the License for the specific language governing permissions and
|
|
30
14
|
* limitations under the License.
|
|
31
15
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
export * from './provider';
|
|
17
|
+
export * from './types';
|
|
18
|
+
export * from './useSidebar';
|
|
35
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.SidebarProvider = void 0;
|
|
36
1
|
/*
|
|
37
2
|
* Copyright 2023 Google LLC
|
|
38
3
|
*
|
|
@@ -51,31 +16,25 @@ exports.SidebarProvider = void 0;
|
|
|
51
16
|
/**
|
|
52
17
|
* External dependencies.
|
|
53
18
|
*/
|
|
54
|
-
|
|
19
|
+
import React, { useCallback, useEffect, useMemo, useState, } from 'react';
|
|
55
20
|
/**
|
|
56
21
|
* Internal dependencies.
|
|
57
22
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, collapsedState = false, children, }) => {
|
|
61
|
-
const [selectedItemKey, setSelectedItemKey] =
|
|
62
|
-
const [activePanel, setActivePanel] =
|
|
63
|
-
const [query, setQuery] =
|
|
64
|
-
const [sidebarItems, setSidebarItems] =
|
|
65
|
-
const [isSidebarFocused, setIsSidebarFocused] =
|
|
66
|
-
const [isCollapsed, setIsCollapsed] =
|
|
67
|
-
/**
|
|
68
|
-
* Update the selected item key when the defaultSelectedItemKey loads.
|
|
69
|
-
*/
|
|
70
|
-
(0, react_1.useEffect)(() => {
|
|
71
|
-
setSelectedItemKey(defaultSelectedItemKey);
|
|
72
|
-
}, [defaultSelectedItemKey]);
|
|
23
|
+
import { createKeyPath, findItem, findNextItem, findPrevItem, matchKey, } from './utils';
|
|
24
|
+
import { SidebarContext, initialState } from './context';
|
|
25
|
+
export const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, collapsedState = false, children, }) => {
|
|
26
|
+
const [selectedItemKey, setSelectedItemKey] = useState(null);
|
|
27
|
+
const [activePanel, setActivePanel] = useState(initialState.state.activePanel);
|
|
28
|
+
const [query, setQuery] = useState('');
|
|
29
|
+
const [sidebarItems, setSidebarItems] = useState({});
|
|
30
|
+
const [isSidebarFocused, setIsSidebarFocused] = useState(true);
|
|
31
|
+
const [isCollapsed, setIsCollapsed] = useState(collapsedState);
|
|
73
32
|
/**
|
|
74
33
|
* Get the last sidebar item key in selectedItemKey chain.
|
|
75
34
|
* Eg: selectedItemKey = 'Privacy-Sandbox#cookies#frameUrl'
|
|
76
35
|
* currentItemKey = 'frameUrl'
|
|
77
36
|
*/
|
|
78
|
-
const currentItemKey =
|
|
37
|
+
const currentItemKey = useMemo(() => {
|
|
79
38
|
if (!selectedItemKey) {
|
|
80
39
|
return null;
|
|
81
40
|
}
|
|
@@ -86,13 +45,35 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
86
45
|
/**
|
|
87
46
|
* Update the sidebar items when the sidebar data changes.
|
|
88
47
|
*/
|
|
89
|
-
|
|
48
|
+
useEffect(() => {
|
|
90
49
|
setSidebarItems(data);
|
|
91
50
|
}, [data]);
|
|
51
|
+
/**
|
|
52
|
+
* Toggle the dropdown of the sidebar item.
|
|
53
|
+
* @param action Dropdown action.
|
|
54
|
+
* @param key Sidebar item key to toggle dropdown.
|
|
55
|
+
*/
|
|
56
|
+
const toggleDropdown = useCallback((action, key) => {
|
|
57
|
+
setSidebarItems((prev) => {
|
|
58
|
+
const items = { ...prev };
|
|
59
|
+
const item = findItem(items, key, action);
|
|
60
|
+
if (item && Object.keys(item.children).length) {
|
|
61
|
+
item.dropdownOpen = action;
|
|
62
|
+
}
|
|
63
|
+
return items;
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
/**
|
|
67
|
+
* Update the selected item key when the defaultSelectedItemKey loads.
|
|
68
|
+
*/
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
setSelectedItemKey(defaultSelectedItemKey);
|
|
71
|
+
toggleDropdown(true, defaultSelectedItemKey || '');
|
|
72
|
+
}, [defaultSelectedItemKey, toggleDropdown]);
|
|
92
73
|
/**
|
|
93
74
|
* Find the active panel when the selected item key changes.
|
|
94
75
|
*/
|
|
95
|
-
|
|
76
|
+
useEffect(() => {
|
|
96
77
|
let keyFound = false;
|
|
97
78
|
/**
|
|
98
79
|
* Find the active panel, if the selected item key is matched with the item key.
|
|
@@ -106,7 +87,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
106
87
|
if (keyFound) {
|
|
107
88
|
return;
|
|
108
89
|
}
|
|
109
|
-
if (
|
|
90
|
+
if (matchKey(key || '', itemKey)) {
|
|
110
91
|
if (item.panel) {
|
|
111
92
|
setActivePanel({
|
|
112
93
|
query,
|
|
@@ -128,11 +109,11 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
128
109
|
findActivePanel(sidebarItems, selectedItemKey);
|
|
129
110
|
}
|
|
130
111
|
if (!keyFound) {
|
|
131
|
-
const keys = selectedItemKey
|
|
132
|
-
keys
|
|
133
|
-
let key = keys
|
|
112
|
+
const keys = selectedItemKey?.split('#');
|
|
113
|
+
keys?.pop();
|
|
114
|
+
let key = keys?.join('#');
|
|
134
115
|
// eslint-disable-next-line no-unmodified-loop-condition -- findActivePanel callback updates value
|
|
135
|
-
while (
|
|
116
|
+
while (keys?.length && !keyFound) {
|
|
136
117
|
key = keys.join('#');
|
|
137
118
|
findActivePanel(sidebarItems, key);
|
|
138
119
|
keys.pop();
|
|
@@ -142,10 +123,10 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
142
123
|
}
|
|
143
124
|
}
|
|
144
125
|
}, [query, selectedItemKey, sidebarItems]);
|
|
145
|
-
|
|
126
|
+
useEffect(() => {
|
|
146
127
|
setSidebarItems((prev) => {
|
|
147
|
-
const items =
|
|
148
|
-
const keyPath = selectedItemKey
|
|
128
|
+
const items = { ...prev };
|
|
129
|
+
const keyPath = selectedItemKey?.split('#').slice(0, -1);
|
|
149
130
|
if (!keyPath || !keyPath.length) {
|
|
150
131
|
return items;
|
|
151
132
|
}
|
|
@@ -156,7 +137,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
156
137
|
if (item && Object.keys(item.children).length) {
|
|
157
138
|
item.dropdownOpen = true;
|
|
158
139
|
}
|
|
159
|
-
_items =
|
|
140
|
+
_items = item?.children || {};
|
|
160
141
|
});
|
|
161
142
|
return items;
|
|
162
143
|
});
|
|
@@ -166,18 +147,21 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
166
147
|
* @param key Selected item key.
|
|
167
148
|
* @param queryString Query string to pass to the new panel.
|
|
168
149
|
*/
|
|
169
|
-
const updateSelectedItemKey =
|
|
170
|
-
|
|
171
|
-
const keyPath = (0, utils_1.createKeyPath)(sidebarItems, key || '');
|
|
150
|
+
const updateSelectedItemKey = useCallback(async (key, queryString = '', skipPanelDisplay = false) => {
|
|
151
|
+
const keyPath = createKeyPath(sidebarItems, key || '');
|
|
172
152
|
if (!keyPath.length) {
|
|
173
153
|
setSelectedItemKey(null);
|
|
174
154
|
return;
|
|
175
155
|
}
|
|
176
|
-
const item =
|
|
177
|
-
if (
|
|
178
|
-
|
|
156
|
+
const item = findItem(sidebarItems, key);
|
|
157
|
+
if (skipPanelDisplay && item?.panel?.cta) {
|
|
158
|
+
item.panel.cta();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (item?.panel?.href || (skipPanelDisplay && item?.panel?.href)) {
|
|
162
|
+
const tab = await chrome.tabs.get(chrome.devtools.inspectedWindow.tabId);
|
|
179
163
|
if (tab) {
|
|
180
|
-
const url =
|
|
164
|
+
const url = tab.url?.split('#')[0].split('?')[0] || '';
|
|
181
165
|
const tabUrl = new URL(url);
|
|
182
166
|
const panelUrl = new URL(item.panel.href);
|
|
183
167
|
if (tabUrl.href !== panelUrl.href) {
|
|
@@ -192,38 +176,24 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
192
176
|
.then(() => console.log('injected a function'));
|
|
193
177
|
}
|
|
194
178
|
}
|
|
179
|
+
if (skipPanelDisplay) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
195
182
|
}
|
|
196
183
|
setSelectedItemKey(keyPath.join('#'));
|
|
197
184
|
setQuery(queryString);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Toggle the dropdown of the sidebar item.
|
|
201
|
-
* @param action Dropdown action.
|
|
202
|
-
* @param key Sidebar item key to toggle dropdown.
|
|
203
|
-
*/
|
|
204
|
-
const toggleDropdown = (0, react_1.useCallback)((action, key) => {
|
|
205
|
-
setSidebarItems((prev) => {
|
|
206
|
-
const items = Object.assign({}, prev);
|
|
207
|
-
const item = (0, utils_1.findItem)(items, key);
|
|
208
|
-
if (item && Object.keys(item.children).length) {
|
|
209
|
-
item.dropdownOpen = action;
|
|
210
|
-
}
|
|
211
|
-
return items;
|
|
212
|
-
});
|
|
213
|
-
}, []);
|
|
185
|
+
}, [sidebarItems]);
|
|
214
186
|
/**
|
|
215
187
|
* Handle keyboard navigation in the sidebar.
|
|
216
188
|
* @param event Keyboard event.
|
|
217
189
|
* @param key Sidebar item key to navigate.
|
|
218
190
|
*/
|
|
219
|
-
const onKeyNavigation =
|
|
220
|
-
event.preventDefault();
|
|
221
|
-
event.stopPropagation();
|
|
191
|
+
const onKeyNavigation = useCallback((event, key) => {
|
|
222
192
|
if (!key) {
|
|
223
193
|
return;
|
|
224
194
|
}
|
|
225
195
|
const navigationAction = event.key;
|
|
226
|
-
const keyPath =
|
|
196
|
+
const keyPath = createKeyPath(sidebarItems, key);
|
|
227
197
|
if (!keyPath.length) {
|
|
228
198
|
return;
|
|
229
199
|
}
|
|
@@ -231,27 +201,35 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
231
201
|
* Open or close the dropdown based on the navigation action.
|
|
232
202
|
*/
|
|
233
203
|
if (navigationAction === 'ArrowRight') {
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
event.stopPropagation();
|
|
234
206
|
toggleDropdown(true, key);
|
|
235
207
|
}
|
|
236
208
|
else if (navigationAction === 'ArrowLeft') {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
event.stopPropagation();
|
|
237
211
|
toggleDropdown(false, key);
|
|
238
212
|
}
|
|
239
213
|
/**
|
|
240
214
|
* Navigate to the previous or next sidebar item based on the navigation action.
|
|
241
215
|
*/
|
|
242
216
|
if (navigationAction === 'ArrowUp') {
|
|
243
|
-
const prevItem =
|
|
217
|
+
const prevItem = findPrevItem(sidebarItems, keyPath);
|
|
244
218
|
if (!prevItem) {
|
|
245
219
|
return;
|
|
246
220
|
}
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
event.stopPropagation();
|
|
247
223
|
// delay navigation as user can hold up arrow key which make useEffect to run multiple times unnecessarily.
|
|
248
224
|
setTimeout(() => updateSelectedItemKey(prevItem));
|
|
249
225
|
}
|
|
250
226
|
else if (navigationAction === 'ArrowDown') {
|
|
251
|
-
const nextItem =
|
|
227
|
+
const nextItem = findNextItem(sidebarItems, keyPath);
|
|
252
228
|
if (!nextItem) {
|
|
253
229
|
return;
|
|
254
230
|
}
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
event.stopPropagation();
|
|
255
233
|
// delay navigation as user can hold down arrow key which make useEffect to run multiple times unnecessarily.
|
|
256
234
|
setTimeout(() => updateSelectedItemKey(nextItem));
|
|
257
235
|
}
|
|
@@ -261,7 +239,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
261
239
|
* @param key Sidebar item key to check.
|
|
262
240
|
* @returns boolean
|
|
263
241
|
*/
|
|
264
|
-
const isKeyAncestor =
|
|
242
|
+
const isKeyAncestor = useCallback((key) => {
|
|
265
243
|
if (!selectedItemKey) {
|
|
266
244
|
return false;
|
|
267
245
|
}
|
|
@@ -276,7 +254,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
276
254
|
* @param key Sidebar item key to check.
|
|
277
255
|
* @returns boolean
|
|
278
256
|
*/
|
|
279
|
-
const isKeySelected =
|
|
257
|
+
const isKeySelected = useCallback((key) => {
|
|
280
258
|
if (!selectedItemKey) {
|
|
281
259
|
return false;
|
|
282
260
|
}
|
|
@@ -284,7 +262,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
284
262
|
const length = keys.length;
|
|
285
263
|
return keys[length - 1] === key;
|
|
286
264
|
}, [selectedItemKey]);
|
|
287
|
-
const toggleSidebarCollapse =
|
|
265
|
+
const toggleSidebarCollapse = useCallback(() => {
|
|
288
266
|
setIsCollapsed((prev) => !prev);
|
|
289
267
|
}, []);
|
|
290
268
|
/**
|
|
@@ -293,7 +271,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
293
271
|
* extractSelectedItemKeyTitles() => ['Privacy Sandbox', 'Cookies', 'Frame URL']
|
|
294
272
|
* @returns Array<{title: string, key: string}>
|
|
295
273
|
*/
|
|
296
|
-
const extractSelectedItemKeyTitles =
|
|
274
|
+
const extractSelectedItemKeyTitles = useCallback(() => {
|
|
297
275
|
if (!selectedItemKey) {
|
|
298
276
|
return [];
|
|
299
277
|
}
|
|
@@ -301,7 +279,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
301
279
|
const keys = selectedItemKey.split('#');
|
|
302
280
|
const titles = [];
|
|
303
281
|
for (const key of keys) {
|
|
304
|
-
const sidebarItem = _sidebarItems
|
|
282
|
+
const sidebarItem = _sidebarItems?.[key];
|
|
305
283
|
if (!sidebarItem) {
|
|
306
284
|
break;
|
|
307
285
|
}
|
|
@@ -315,7 +293,7 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
315
293
|
}
|
|
316
294
|
return titles;
|
|
317
295
|
}, [selectedItemKey, sidebarItems]);
|
|
318
|
-
return (<
|
|
296
|
+
return (<SidebarContext.Provider value={{
|
|
319
297
|
state: {
|
|
320
298
|
activePanel,
|
|
321
299
|
selectedItemKey,
|
|
@@ -338,7 +316,6 @@ const SidebarProvider = ({ data, defaultSelectedItemKey = null, collapsedData, c
|
|
|
338
316
|
},
|
|
339
317
|
}}>
|
|
340
318
|
{children}
|
|
341
|
-
</
|
|
319
|
+
</SidebarContext.Provider>);
|
|
342
320
|
};
|
|
343
|
-
exports.SidebarProvider = SidebarProvider;
|
|
344
321
|
//# sourceMappingURL=provider.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.jsx","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.jsx","sourceRoot":"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BAAoB,EAAE,OAAO,CAAC,aAAa,CAAC;aAC7C;YACD,OAAO,EAAE;gBACP,mBAAmB;gBACnB,qBAAqB;gBACrB,eAAe;gBACf,cAAc;gBACd,aAAa;gBACb,aAAa;gBACb,qBAAqB;gBACrB,4BAA4B;aAC7B;SACF,CAAC,CAEF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,cAAc,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,5 +13,5 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
export {};
|
|
18
17
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,16 +13,14 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const common_1 = require("@google-psat/common");
|
|
20
|
-
const context_1 = require("./context");
|
|
16
|
+
import { useContextSelector } from '@google-psat/common';
|
|
17
|
+
import { SidebarContext } from './context';
|
|
21
18
|
/**
|
|
22
19
|
* Hook to access the Sidebar context.
|
|
23
20
|
* @param selector Selector function to partially select state.
|
|
24
21
|
* @returns selected part of the state
|
|
25
22
|
*/
|
|
26
|
-
function useSidebar(selector = (state) => state) {
|
|
27
|
-
return
|
|
23
|
+
export function useSidebar(selector = (state) => state) {
|
|
24
|
+
return useContextSelector(SidebarContext, selector);
|
|
28
25
|
}
|
|
29
26
|
//# sourceMappingURL=useSidebar.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSidebar.jsx","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/useSidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSidebar.jsx","sourceRoot":"","sources":["../../../../src/components/sidebar/useSidebar/useSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAKhE;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,WAAoE,CAAC,KAAK,EAAE,EAAE,CAC5E,KAAK;IAEP,OAAO,kBAAkB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,11 +13,7 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const matchKey_1 = __importDefault(require("./matchKey"));
|
|
16
|
+
import matchKey from './matchKey';
|
|
22
17
|
/**
|
|
23
18
|
* Create a key path to the given key in the sidebar items.
|
|
24
19
|
* @param items Sidebar items.
|
|
@@ -33,7 +28,7 @@ const createKeyPath = (items, key, keyPath = []) => {
|
|
|
33
28
|
if (keyFound) {
|
|
34
29
|
return;
|
|
35
30
|
}
|
|
36
|
-
if ((
|
|
31
|
+
if (matchKey(key || '', itemKey)) {
|
|
37
32
|
_keyPath.push(itemKey);
|
|
38
33
|
keyFound = true;
|
|
39
34
|
return;
|
|
@@ -50,5 +45,5 @@ const createKeyPath = (items, key, keyPath = []) => {
|
|
|
50
45
|
};
|
|
51
46
|
return _createKeyPath(items, keyPath);
|
|
52
47
|
};
|
|
53
|
-
|
|
48
|
+
export default createKeyPath;
|
|
54
49
|
//# sourceMappingURL=createKeyPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKeyPath.js","sourceRoot":"","sources":["../../../../../src/components/sidebar/useSidebar/utils/createKeyPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createKeyPath.js","sourceRoot":"","sources":["../../../../../src/components/sidebar/useSidebar/utils/createKeyPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CACpB,KAAmB,EACnB,GAAW,EACX,UAAoB,EAAE,EACtB,EAAE;IACF,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,cAAc,GAAG,CAAC,MAAoB,EAAE,WAAqB,EAAE,EAAE,EAAE;QACvE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YACjD,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YAED,IAAI,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;gBACjC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEvB,QAAQ,GAAG,IAAI,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright 2023 Google LLC
|
|
4
3
|
*
|
|
@@ -14,20 +13,17 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const matchKey_1 = __importDefault(require("./matchKey"));
|
|
16
|
+
import matchKey from './matchKey';
|
|
22
17
|
/**
|
|
23
18
|
* Find an item in the sidebar items by key.
|
|
24
19
|
* The SidebarItems are assumed to be a tree structure.
|
|
25
20
|
* Tree traversal is done in a depth-first manner to find the item.
|
|
26
21
|
* @param items Sidebar items.
|
|
27
22
|
* @param key Key to find.
|
|
23
|
+
* @param dropdownOpen Optional parameter to indicate to open the dropdown across the tree.
|
|
28
24
|
* @returns Sidebar item.
|
|
29
25
|
*/
|
|
30
|
-
const findItem = (items, key) => {
|
|
26
|
+
const findItem = (items, key, dropdownOpen) => {
|
|
31
27
|
if (!key) {
|
|
32
28
|
return null;
|
|
33
29
|
}
|
|
@@ -37,18 +33,24 @@ const findItem = (items, key) => {
|
|
|
37
33
|
if (keyFound) {
|
|
38
34
|
return;
|
|
39
35
|
}
|
|
40
|
-
if ((
|
|
36
|
+
if (matchKey(key || '', itemKey)) {
|
|
41
37
|
keyFound = true;
|
|
42
38
|
item = _item;
|
|
39
|
+
if (dropdownOpen) {
|
|
40
|
+
_item.dropdownOpen = dropdownOpen;
|
|
41
|
+
}
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
if (_item.children) {
|
|
46
45
|
_findItem(_item.children);
|
|
46
|
+
if (keyFound && dropdownOpen) {
|
|
47
|
+
_item.dropdownOpen = true;
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
_findItem(items);
|
|
51
53
|
return item;
|
|
52
54
|
};
|
|
53
|
-
|
|
55
|
+
export default findItem;
|
|
54
56
|
//# sourceMappingURL=findItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findItem.js","sourceRoot":"","sources":["../../../../../src/components/sidebar/useSidebar/utils/findItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findItem.js","sourceRoot":"","sources":["../../../../../src/components/sidebar/useSidebar/utils/findItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,CACf,KAAmB,EACnB,GAAkB,EAClB,YAAsB,EACG,EAAE;IAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,GAAG,KAAK,EAClB,IAAI,GAA4B,IAAI,CAAC;IAEvC,MAAM,SAAS,GAAG,CAAC,MAAoB,EAAE,EAAE;QACzC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE;YAClD,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YAED,IAAI,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;gBACjC,QAAQ,GAAG,IAAI,CAAC;gBAChB,IAAI,GAAG,KAAK,CAAC;gBAEb,IAAI,YAAY,EAAE,CAAC;oBACjB,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;gBACpC,CAAC;gBAED,OAAO;YACT,CAAC;YAED,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAE1B,IAAI,QAAQ,IAAI,YAAY,EAAE,CAAC;oBAC7B,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,SAAS,CAAC,KAAK,CAAC,CAAC;IAEjB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|