@jpmorganchase/mosaic-components 0.1.0-beta.10
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/.turbo/turbo-build.log +6 -0
- package/CHANGELOG.md +31 -0
- package/README.md +22 -0
- package/dist/Accordion/index.css +1 -0
- package/dist/Accordion/index.d.ts +46 -0
- package/dist/Accordion/index.js +1 -0
- package/dist/Accordion/styles.css.css +1 -0
- package/dist/Accordion/styles.css.d.ts +5 -0
- package/dist/Accordion/styles.css.js +1 -0
- package/dist/AudioPlayer/index.css +1 -0
- package/dist/AudioPlayer/index.d.ts +7 -0
- package/dist/AudioPlayer/index.js +1 -0
- package/dist/AudioPlayer/styles.css.css +1 -0
- package/dist/AudioPlayer/styles.css.d.ts +9 -0
- package/dist/AudioPlayer/styles.css.js +1 -0
- package/dist/BrowserOnly.d.ts +5 -0
- package/dist/BrowserOnly.js +1 -0
- package/dist/Button.d.ts +6 -0
- package/dist/Button.js +1 -0
- package/dist/Callout/index.css +1 -0
- package/dist/Callout/index.d.ts +33 -0
- package/dist/Callout/index.js +1 -0
- package/dist/Callout/styles.css.css +1 -0
- package/dist/Callout/styles.css.d.ts +17 -0
- package/dist/Callout/styles.css.js +1 -0
- package/dist/Card/index.css +1 -0
- package/dist/Card/index.d.ts +25 -0
- package/dist/Card/index.js +1 -0
- package/dist/Card/styles.css.css +1 -0
- package/dist/Card/styles.css.d.ts +6 -0
- package/dist/Card/styles.css.js +1 -0
- package/dist/Cards.css +1 -0
- package/dist/Cards.d.ts +7 -0
- package/dist/Cards.js +1 -0
- package/dist/ColorModeProvider.d.ts +16 -0
- package/dist/ColorModeProvider.js +1 -0
- package/dist/ComponentExample/index.css +1 -0
- package/dist/ComponentExample/index.d.ts +8 -0
- package/dist/ComponentExample/index.js +1 -0
- package/dist/ComponentExample/styles.css.css +1 -0
- package/dist/ComponentExample/styles.css.d.ts +6 -0
- package/dist/ComponentExample/styles.css.js +1 -0
- package/dist/DataTable.d.ts +19 -0
- package/dist/DataTable.js +1 -0
- package/dist/EditionFilterView/index.css +1 -0
- package/dist/EditionFilterView/index.d.ts +27 -0
- package/dist/EditionFilterView/index.js +1 -0
- package/dist/EditionFilterView/styles.css.d.ts +4 -0
- package/dist/EditionFilterView/styles.css.js +1 -0
- package/dist/EditionTileLink/index.css +1 -0
- package/dist/EditionTileLink/index.d.ts +18 -0
- package/dist/EditionTileLink/index.js +1 -0
- package/dist/EditionTileLink/styles.css.css +1 -0
- package/dist/EditionTileLink/styles.css.d.ts +30 -0
- package/dist/EditionTileLink/styles.css.js +1 -0
- package/dist/Feature/Feature.css +1 -0
- package/dist/Feature/Feature.d.ts +44 -0
- package/dist/Feature/Feature.js +1 -0
- package/dist/Feature/FeatureActions/index.css +1 -0
- package/dist/Feature/FeatureActions/index.d.ts +11 -0
- package/dist/Feature/FeatureActions/index.js +1 -0
- package/dist/Feature/FeatureActions/styles.css.css +1 -0
- package/dist/Feature/FeatureActions/styles.css.d.ts +4 -0
- package/dist/Feature/FeatureActions/styles.css.js +1 -0
- package/dist/Feature/FeatureContent/index.css +1 -0
- package/dist/Feature/FeatureContent/index.d.ts +11 -0
- package/dist/Feature/FeatureContent/index.js +1 -0
- package/dist/Feature/FeatureContent/styles.css.css +1 -0
- package/dist/Feature/FeatureContent/styles.css.d.ts +4 -0
- package/dist/Feature/FeatureContent/styles.css.js +1 -0
- package/dist/Feature/FeatureEyebrow/index.css +1 -0
- package/dist/Feature/FeatureEyebrow/index.d.ts +11 -0
- package/dist/Feature/FeatureEyebrow/index.js +1 -0
- package/dist/Feature/FeatureEyebrow/styles.css.css +1 -0
- package/dist/Feature/FeatureEyebrow/styles.css.d.ts +4 -0
- package/dist/Feature/FeatureEyebrow/styles.css.js +1 -0
- package/dist/Feature/FeatureTitle/index.d.ts +11 -0
- package/dist/Feature/FeatureTitle/index.js +1 -0
- package/dist/Feature/FeatureTitle/styles.css.d.ts +4 -0
- package/dist/Feature/FeatureTitle/styles.css.js +1 -0
- package/dist/Feature/index.css +1 -0
- package/dist/Feature/index.d.ts +10 -0
- package/dist/Feature/index.js +1 -0
- package/dist/Feature/styles.css.css +1 -0
- package/dist/Feature/styles.css.d.ts +13 -0
- package/dist/Feature/styles.css.js +1 -0
- package/dist/Features/index.css +1 -0
- package/dist/Features/index.d.ts +15 -0
- package/dist/Features/index.js +1 -0
- package/dist/Features/styles.css.css +1 -0
- package/dist/Features/styles.css.d.ts +4 -0
- package/dist/Features/styles.css.js +1 -0
- package/dist/FilterToolbar/ContentArea/index.css +1 -0
- package/dist/FilterToolbar/ContentArea/index.d.ts +2 -0
- package/dist/FilterToolbar/ContentArea/index.js +1 -0
- package/dist/FilterToolbar/ContentArea/styles.css.css +1 -0
- package/dist/FilterToolbar/ContentArea/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/ContentArea/styles.css.js +1 -0
- package/dist/FilterToolbar/FilterDropdown/index.css +1 -0
- package/dist/FilterToolbar/FilterDropdown/index.d.ts +7 -0
- package/dist/FilterToolbar/FilterDropdown/index.js +1 -0
- package/dist/FilterToolbar/FilterDropdown/styles.css.css +1 -0
- package/dist/FilterToolbar/FilterDropdown/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/FilterDropdown/styles.css.js +1 -0
- package/dist/FilterToolbar/PillGroup/index.css +1 -0
- package/dist/FilterToolbar/PillGroup/index.d.ts +6 -0
- package/dist/FilterToolbar/PillGroup/index.js +1 -0
- package/dist/FilterToolbar/PillGroup/styles.css.css +1 -0
- package/dist/FilterToolbar/PillGroup/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/PillGroup/styles.css.js +1 -0
- package/dist/FilterToolbar/Search/index.css +1 -0
- package/dist/FilterToolbar/Search/index.d.ts +5 -0
- package/dist/FilterToolbar/Search/index.js +1 -0
- package/dist/FilterToolbar/Search/styles.css.css +1 -0
- package/dist/FilterToolbar/Search/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/Search/styles.css.js +1 -0
- package/dist/FilterToolbar/SortDropdown/index.css +1 -0
- package/dist/FilterToolbar/SortDropdown/index.d.ts +11 -0
- package/dist/FilterToolbar/SortDropdown/index.js +1 -0
- package/dist/FilterToolbar/SortDropdown/styles.css.css +1 -0
- package/dist/FilterToolbar/SortDropdown/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/SortDropdown/styles.css.js +1 -0
- package/dist/FilterToolbar/Toolbar.css +1 -0
- package/dist/FilterToolbar/Toolbar.d.ts +20 -0
- package/dist/FilterToolbar/Toolbar.js +1 -0
- package/dist/FilterToolbar/ToolbarProvider.d.ts +33 -0
- package/dist/FilterToolbar/ToolbarProvider.js +1 -0
- package/dist/FilterToolbar/index.css +1 -0
- package/dist/FilterToolbar/index.d.ts +9 -0
- package/dist/FilterToolbar/index.js +1 -0
- package/dist/FilterToolbar/styles.css.css +1 -0
- package/dist/FilterToolbar/styles.css.d.ts +4 -0
- package/dist/FilterToolbar/styles.css.js +1 -0
- package/dist/FilterView/ContentArea/index.css +1 -0
- package/dist/FilterView/ContentArea/index.d.ts +9 -0
- package/dist/FilterView/ContentArea/index.js +1 -0
- package/dist/FilterView/ContentArea/styles.css.d.ts +5 -0
- package/dist/FilterView/ContentArea/styles.css.js +1 -0
- package/dist/FilterView/FilterView.css +1 -0
- package/dist/FilterView/FilterView.d.ts +54 -0
- package/dist/FilterView/FilterView.js +1 -0
- package/dist/FilterView/FilterViewProvider.d.ts +12 -0
- package/dist/FilterView/FilterViewProvider.js +1 -0
- package/dist/FilterView/NoResults/index.css +1 -0
- package/dist/FilterView/NoResults/index.d.ts +7 -0
- package/dist/FilterView/NoResults/index.js +1 -0
- package/dist/FilterView/NoResults/styles.css.css +1 -0
- package/dist/FilterView/NoResults/styles.css.d.ts +4 -0
- package/dist/FilterView/NoResults/styles.css.js +1 -0
- package/dist/FilterView/Pagination/index.css +1 -0
- package/dist/FilterView/Pagination/index.d.ts +18 -0
- package/dist/FilterView/Pagination/index.js +1 -0
- package/dist/FilterView/Pagination/styles.css.css +1 -0
- package/dist/FilterView/Pagination/styles.css.d.ts +4 -0
- package/dist/FilterView/Pagination/styles.css.js +1 -0
- package/dist/FilterView/Pagination/usePagination.d.ts +12 -0
- package/dist/FilterView/Pagination/usePagination.js +1 -0
- package/dist/FilterView/ResultCount/index.css +1 -0
- package/dist/FilterView/ResultCount/index.d.ts +6 -0
- package/dist/FilterView/ResultCount/index.js +1 -0
- package/dist/FilterView/ResultCount/styles.css.css +1 -0
- package/dist/FilterView/ResultCount/styles.css.d.ts +4 -0
- package/dist/FilterView/ResultCount/styles.css.js +1 -0
- package/dist/FilterView/index.css +1 -0
- package/dist/FilterView/index.d.ts +4 -0
- package/dist/FilterView/index.js +1 -0
- package/dist/FilterView/useResultCount.d.ts +2 -0
- package/dist/FilterView/useResultCount.js +1 -0
- package/dist/FormattedContent.css +1 -0
- package/dist/FormattedContent.d.ts +21 -0
- package/dist/FormattedContent.js +1 -0
- package/dist/Grid/index.css +1 -0
- package/dist/Grid/index.d.ts +11 -0
- package/dist/Grid/index.js +1 -0
- package/dist/Grid/styles.css.css +1 -0
- package/dist/Grid/styles.css.d.ts +9 -0
- package/dist/Grid/styles.css.js +1 -0
- package/dist/GridBase/index.css +1 -0
- package/dist/GridBase/index.d.ts +16 -0
- package/dist/GridBase/index.js +1 -0
- package/dist/GridBase/styles.css.css +1 -0
- package/dist/GridBase/styles.css.d.ts +7 -0
- package/dist/GridBase/styles.css.js +1 -0
- package/dist/HelpLinks/index.css +1 -0
- package/dist/HelpLinks/index.d.ts +34 -0
- package/dist/HelpLinks/index.js +1 -0
- package/dist/HelpLinks/styles.css.css +1 -0
- package/dist/HelpLinks/styles.css.d.ts +8 -0
- package/dist/HelpLinks/styles.css.js +1 -0
- package/dist/Hero/index.css +1 -0
- package/dist/Hero/index.d.ts +42 -0
- package/dist/Hero/index.js +1 -0
- package/dist/Hero/styles.css.css +1 -0
- package/dist/Hero/styles.css.d.ts +22 -0
- package/dist/Hero/styles.css.js +1 -0
- package/dist/Icon/index.d.ts +11 -0
- package/dist/Icon/index.js +1 -0
- package/dist/Icon/styles.css.d.ts +6 -0
- package/dist/Icon/styles.css.js +1 -0
- package/dist/ImageProvider.d.ts +4 -0
- package/dist/ImageProvider.js +1 -0
- package/dist/Impact/index.css +1 -0
- package/dist/Impact/index.d.ts +9 -0
- package/dist/Impact/index.js +1 -0
- package/dist/Impact/styles.css.css +1 -0
- package/dist/Impact/styles.css.d.ts +8 -0
- package/dist/Impact/styles.css.js +1 -0
- package/dist/Impacts.css +1 -0
- package/dist/Impacts.d.ts +7 -0
- package/dist/Impacts.js +1 -0
- package/dist/IsomorphicSuspense.d.ts +4 -0
- package/dist/IsomorphicSuspense.js +1 -0
- package/dist/Label/index.css +1 -0
- package/dist/Label/index.d.ts +12 -0
- package/dist/Label/index.js +1 -0
- package/dist/Label/styles.css.css +1 -0
- package/dist/Label/styles.css.d.ts +6 -0
- package/dist/Label/styles.css.js +1 -0
- package/dist/Link/index.css +1 -0
- package/dist/Link/index.d.ts +9 -0
- package/dist/Link/index.js +1 -0
- package/dist/Link/styles.css.css +1 -0
- package/dist/Link/styles.css.d.ts +9 -0
- package/dist/Link/styles.css.js +1 -0
- package/dist/LinkBase/index.d.ts +8 -0
- package/dist/LinkBase/index.js +1 -0
- package/dist/LinkButton.d.ts +7 -0
- package/dist/LinkButton.js +1 -0
- package/dist/LinkProvider.d.ts +4 -0
- package/dist/LinkProvider.js +1 -0
- package/dist/LinkText/index.css +1 -0
- package/dist/LinkText/index.d.ts +22 -0
- package/dist/LinkText/index.js +1 -0
- package/dist/LinkText/styles.css.css +1 -0
- package/dist/LinkText/styles.css.d.ts +8 -0
- package/dist/LinkText/styles.css.js +1 -0
- package/dist/Links/index.css +1 -0
- package/dist/Links/index.d.ts +6 -0
- package/dist/Links/index.js +1 -0
- package/dist/Links/styles.css.css +1 -0
- package/dist/Links/styles.css.d.ts +4 -0
- package/dist/Links/styles.css.js +1 -0
- package/dist/List/ListItem.d.ts +8 -0
- package/dist/List/ListItem.js +1 -0
- package/dist/List/OrderedList.d.ts +4 -0
- package/dist/List/OrderedList.js +1 -0
- package/dist/List/UnorderedList.d.ts +7 -0
- package/dist/List/UnorderedList.js +1 -0
- package/dist/List/index.d.ts +3 -0
- package/dist/List/index.js +1 -0
- package/dist/Markdown/AnchorHeading/index.css +1 -0
- package/dist/Markdown/AnchorHeading/index.css.css +1 -0
- package/dist/Markdown/AnchorHeading/index.css.d.ts +17 -0
- package/dist/Markdown/AnchorHeading/index.css.js +1 -0
- package/dist/Markdown/AnchorHeading/index.d.ts +10 -0
- package/dist/Markdown/AnchorHeading/index.js +1 -0
- package/dist/Markdown/BlockQuote/index.css.d.ts +5 -0
- package/dist/Markdown/BlockQuote/index.css.js +1 -0
- package/dist/Markdown/BlockQuote/index.d.ts +4 -0
- package/dist/Markdown/BlockQuote/index.js +1 -0
- package/dist/Markdown/Heading.d.ts +8 -0
- package/dist/Markdown/Heading.js +1 -0
- package/dist/Markdown/InlineCode.d.ts +4 -0
- package/dist/Markdown/InlineCode.js +1 -0
- package/dist/Markdown/Link.css +1 -0
- package/dist/Markdown/Link.d.ts +6 -0
- package/dist/Markdown/Link.js +1 -0
- package/dist/Markdown/Pre/index.css +1 -0
- package/dist/Markdown/Pre/index.css.css +1 -0
- package/dist/Markdown/Pre/index.css.d.ts +7 -0
- package/dist/Markdown/Pre/index.css.js +1 -0
- package/dist/Markdown/Pre/index.d.ts +22 -0
- package/dist/Markdown/Pre/index.js +1 -0
- package/dist/Markdown/Table.d.ts +4 -0
- package/dist/Markdown/Table.js +1 -0
- package/dist/Markdown/Tbody.d.ts +4 -0
- package/dist/Markdown/Tbody.js +1 -0
- package/dist/Markdown/Td.d.ts +4 -0
- package/dist/Markdown/Td.js +1 -0
- package/dist/Markdown/Th.d.ts +4 -0
- package/dist/Markdown/Th.js +1 -0
- package/dist/Markdown/Thead.d.ts +4 -0
- package/dist/Markdown/Thead.js +1 -0
- package/dist/Markdown/ThematicBreak/index.css.d.ts +4 -0
- package/dist/Markdown/ThematicBreak/index.css.js +1 -0
- package/dist/Markdown/ThematicBreak/index.d.ts +4 -0
- package/dist/Markdown/ThematicBreak/index.js +1 -0
- package/dist/Markdown/Tr.d.ts +4 -0
- package/dist/Markdown/Tr.js +1 -0
- package/dist/Markdown/index.css +1 -0
- package/dist/Markdown/index.d.ts +172 -0
- package/dist/Markdown/index.js +1 -0
- package/dist/Markdown/markdownElements.css +1 -0
- package/dist/Markdown/markdownElements.d.ts +33 -0
- package/dist/Markdown/markdownElements.js +1 -0
- package/dist/Markdown/withMarkdownSpacing/index.d.ts +10 -0
- package/dist/Markdown/withMarkdownSpacing/index.js +1 -0
- package/dist/Markdown/withMarkdownSpacing/styles.css.d.ts +6 -0
- package/dist/Markdown/withMarkdownSpacing/styles.css.js +1 -0
- package/dist/PageFilterView/index.css +1 -0
- package/dist/PageFilterView/index.d.ts +12 -0
- package/dist/PageFilterView/index.js +1 -0
- package/dist/PageFilterView/styles.css.d.ts +4 -0
- package/dist/PageFilterView/styles.css.js +1 -0
- package/dist/ReactLive/index.css +1 -0
- package/dist/ReactLive/index.d.ts +11 -0
- package/dist/ReactLive/index.js +1 -0
- package/dist/ReactLive/styles.css.css +1 -0
- package/dist/ReactLive/styles.css.d.ts +8 -0
- package/dist/ReactLive/styles.css.js +1 -0
- package/dist/SecondaryNavbar/index.css +1 -0
- package/dist/SecondaryNavbar/index.d.ts +11 -0
- package/dist/SecondaryNavbar/index.js +1 -0
- package/dist/SecondaryNavbar/styles.css.css +1 -0
- package/dist/SecondaryNavbar/styles.css.d.ts +9 -0
- package/dist/SecondaryNavbar/styles.css.js +1 -0
- package/dist/SectionHeading/index.d.ts +10 -0
- package/dist/SectionHeading/index.js +1 -0
- package/dist/SectionHeading/styles.css.d.ts +4 -0
- package/dist/SectionHeading/styles.css.js +1 -0
- package/dist/StickyHeader/index.css +1 -0
- package/dist/StickyHeader/index.d.ts +8 -0
- package/dist/StickyHeader/index.js +1 -0
- package/dist/StickyHeader/styles.css.css +1 -0
- package/dist/StickyHeader/styles.css.d.ts +5 -0
- package/dist/StickyHeader/styles.css.js +1 -0
- package/dist/Story/index.css +1 -0
- package/dist/Story/index.d.ts +12 -0
- package/dist/Story/index.js +1 -0
- package/dist/Story/styles.css.css +1 -0
- package/dist/Story/styles.css.d.ts +10 -0
- package/dist/Story/styles.css.js +1 -0
- package/dist/Tabs/index.css +1 -0
- package/dist/Tabs/index.d.ts +9 -0
- package/dist/Tabs/index.js +1 -0
- package/dist/Tabs/styles.css.d.ts +4 -0
- package/dist/Tabs/styles.css.js +1 -0
- package/dist/TabsBase/TabsBase.css +1 -0
- package/dist/TabsBase/TabsBase.d.ts +19 -0
- package/dist/TabsBase/TabsBase.js +1 -0
- package/dist/TabsBase/TabsButton.css +1 -0
- package/dist/TabsBase/TabsButton.d.ts +15 -0
- package/dist/TabsBase/TabsButton.js +1 -0
- package/dist/TabsBase/TabsLink.css +1 -0
- package/dist/TabsBase/TabsLink.d.ts +15 -0
- package/dist/TabsBase/TabsLink.js +1 -0
- package/dist/TabsBase/TabsMenuButton.css +1 -0
- package/dist/TabsBase/TabsMenuButton.d.ts +20 -0
- package/dist/TabsBase/TabsMenuButton.js +1 -0
- package/dist/TabsBase/index.css +1 -0
- package/dist/TabsBase/index.d.ts +4 -0
- package/dist/TabsBase/index.js +1 -0
- package/dist/TabsBase/styles.css.css +1 -0
- package/dist/TabsBase/styles.css.d.ts +11 -0
- package/dist/TabsBase/styles.css.js +1 -0
- package/dist/TabsBase/tabsMenuButton.css.css +1 -0
- package/dist/TabsBase/tabsMenuButton.css.d.ts +4 -0
- package/dist/TabsBase/tabsMenuButton.css.js +1 -0
- package/dist/Tag/index.css +1 -0
- package/dist/Tag/index.d.ts +27 -0
- package/dist/Tag/index.js +1 -0
- package/dist/Tag/styles.css.css +1 -0
- package/dist/Tag/styles.css.d.ts +23 -0
- package/dist/Tag/styles.css.js +1 -0
- package/dist/ThemeProvider.d.ts +4 -0
- package/dist/ThemeProvider.js +1 -0
- package/dist/TileBase/TileBase.css +1 -0
- package/dist/TileBase/TileBase.d.ts +42 -0
- package/dist/TileBase/TileBase.js +1 -0
- package/dist/TileBase/TileStateProvider.d.ts +13 -0
- package/dist/TileBase/TileStateProvider.js +1 -0
- package/dist/TileBase/index.css +1 -0
- package/dist/TileBase/index.d.ts +2 -0
- package/dist/TileBase/index.js +1 -0
- package/dist/TileBase/styles.css.css +1 -0
- package/dist/TileBase/styles.css.d.ts +8 -0
- package/dist/TileBase/styles.css.js +1 -0
- package/dist/TileButton/index.css +1 -0
- package/dist/TileButton/index.d.ts +6 -0
- package/dist/TileButton/index.js +1 -0
- package/dist/TileContent/index.css +1 -0
- package/dist/TileContent/index.d.ts +38 -0
- package/dist/TileContent/index.js +1 -0
- package/dist/TileContent/styles.css.css +1 -0
- package/dist/TileContent/styles.css.d.ts +75 -0
- package/dist/TileContent/styles.css.js +1 -0
- package/dist/TileContentLabel/index.css +1 -0
- package/dist/TileContentLabel/index.d.ts +11 -0
- package/dist/TileContentLabel/index.js +1 -0
- package/dist/TileContentLabel/styles.css.css +1 -0
- package/dist/TileContentLabel/styles.css.d.ts +7 -0
- package/dist/TileContentLabel/styles.css.js +1 -0
- package/dist/TileLink/index.css +1 -0
- package/dist/TileLink/index.d.ts +8 -0
- package/dist/TileLink/index.js +1 -0
- package/dist/TileLink/styles.css.css +1 -0
- package/dist/TileLink/styles.css.d.ts +4 -0
- package/dist/TileLink/styles.css.js +1 -0
- package/dist/Tiles.css +1 -0
- package/dist/Tiles.d.ts +8 -0
- package/dist/Tiles.js +1 -0
- package/dist/Typography/Typography.d.ts +14 -0
- package/dist/Typography/Typography.js +1 -0
- package/dist/Typography/index.d.ts +40 -0
- package/dist/Typography/index.js +1 -0
- package/dist/Typography/withStyledTypography.d.ts +3 -0
- package/dist/Typography/withStyledTypography.js +1 -0
- package/dist/VideoPlayer/index.css +1 -0
- package/dist/VideoPlayer/index.d.ts +6 -0
- package/dist/VideoPlayer/index.js +1 -0
- package/dist/VideoPlayer/styles.css.css +1 -0
- package/dist/VideoPlayer/styles.css.d.ts +10 -0
- package/dist/VideoPlayer/styles.css.js +1 -0
- package/dist/ViewStack/View.d.ts +14 -0
- package/dist/ViewStack/View.js +1 -0
- package/dist/ViewStack/ViewStack.d.ts +11 -0
- package/dist/ViewStack/ViewStack.js +1 -0
- package/dist/ViewStack/index.d.ts +2 -0
- package/dist/ViewStack/index.js +1 -0
- package/dist/canUseDOM.d.ts +1 -0
- package/dist/canUseDOM.js +1 -0
- package/dist/chunk-25XBJ4GK.js +1 -0
- package/dist/chunk-2NB3GP4B.js +1 -0
- package/dist/chunk-2O36BNKY.js +1 -0
- package/dist/chunk-2U6FNIPR.js +1 -0
- package/dist/chunk-32QG4S7S.js +1 -0
- package/dist/chunk-335WBXRV.js +1 -0
- package/dist/chunk-3DFTW2GM.js +1 -0
- package/dist/chunk-3EEX4X6D.js +1 -0
- package/dist/chunk-3G3LBCJD.js +1 -0
- package/dist/chunk-3I6IJ7AC.js +1 -0
- package/dist/chunk-3R4QYYQ4.js +1 -0
- package/dist/chunk-42WFLOC6.js +1 -0
- package/dist/chunk-44RW6ETD.js +1 -0
- package/dist/chunk-4FUNGARO.js +1 -0
- package/dist/chunk-4TSVFJ7M.js +1 -0
- package/dist/chunk-4W6HT3B4.js +1 -0
- package/dist/chunk-4YSU7BCU.js +1 -0
- package/dist/chunk-5KK5475X.js +1 -0
- package/dist/chunk-5NKWGBQZ.js +1 -0
- package/dist/chunk-5YW35QBU.js +1 -0
- package/dist/chunk-6464SWDK.js +1 -0
- package/dist/chunk-6AIEZTB5.js +1 -0
- package/dist/chunk-6CR2UHLM.js +1 -0
- package/dist/chunk-6CXFXGTP.js +1 -0
- package/dist/chunk-7AKIGM4A.js +1 -0
- package/dist/chunk-7I7I5ZGV.js +1 -0
- package/dist/chunk-7IOACAEU.js +1 -0
- package/dist/chunk-7OWUJHAN.js +1 -0
- package/dist/chunk-7W3FVLQG.js +1 -0
- package/dist/chunk-A2A5KLET.js +1 -0
- package/dist/chunk-A4KE4JRL.js +1 -0
- package/dist/chunk-A62MVD3W.js +1 -0
- package/dist/chunk-APRWJQYV.js +1 -0
- package/dist/chunk-AU72IVSS.js +1 -0
- package/dist/chunk-AUVYPVBP.js +1 -0
- package/dist/chunk-AZUFJ6VU.js +1 -0
- package/dist/chunk-BKMMLJQN.js +1 -0
- package/dist/chunk-BUHTZKLI.js +1 -0
- package/dist/chunk-BUSQA7KE.js +0 -0
- package/dist/chunk-BX52WGFN.js +1 -0
- package/dist/chunk-BZH4QVWW.js +1 -0
- package/dist/chunk-C252LIKT.js +1 -0
- package/dist/chunk-C3QGODZV.js +1 -0
- package/dist/chunk-C4ELYUSC.js +1 -0
- package/dist/chunk-CBP5ZGTJ.js +1 -0
- package/dist/chunk-CFOEPTHY.js +1 -0
- package/dist/chunk-CIOSZ7JO.js +1 -0
- package/dist/chunk-CK3NOI7N.js +1 -0
- package/dist/chunk-CQEDEYK6.js +2 -0
- package/dist/chunk-CUOEKXWQ.js +1 -0
- package/dist/chunk-CV3R74GK.js +1 -0
- package/dist/chunk-CXU4OJZ3.js +1 -0
- package/dist/chunk-DCD762X4.js +1 -0
- package/dist/chunk-DHXA4PUS.js +1 -0
- package/dist/chunk-ERIQ6SXC.js +1 -0
- package/dist/chunk-ESKTX4WM.js +1 -0
- package/dist/chunk-ETW7NOZJ.js +1 -0
- package/dist/chunk-F6WIBZNK.js +1 -0
- package/dist/chunk-FABGH4NH.js +1 -0
- package/dist/chunk-FFDB7JSZ.js +1 -0
- package/dist/chunk-FLVGGPW5.js +1 -0
- package/dist/chunk-FRUOJ2YQ.js +0 -0
- package/dist/chunk-FUUUTGVL.js +1 -0
- package/dist/chunk-G34NQQSQ.js +1 -0
- package/dist/chunk-GHEBJRO3.js +1 -0
- package/dist/chunk-GMHXY34G.js +1 -0
- package/dist/chunk-GPRXLXR2.js +1 -0
- package/dist/chunk-GTXJRRSA.js +1 -0
- package/dist/chunk-GVHGTOUS.js +1 -0
- package/dist/chunk-H5M4JDKA.js +1 -0
- package/dist/chunk-HAMMUBE7.js +1 -0
- package/dist/chunk-HF7NXOFI.js +1 -0
- package/dist/chunk-HJSXLVTZ.js +1 -0
- package/dist/chunk-HLJ5MAIP.js +1 -0
- package/dist/chunk-HNI5K3YJ.js +1 -0
- package/dist/chunk-HOA24BWP.js +1 -0
- package/dist/chunk-HQWNNYBM.js +1 -0
- package/dist/chunk-I3NDLK5N.js +1 -0
- package/dist/chunk-ICZ6LXV7.js +1 -0
- package/dist/chunk-IK3UKYGT.js +1 -0
- package/dist/chunk-IZFGOF3C.js +1 -0
- package/dist/chunk-JHZOWA4W.js +1 -0
- package/dist/chunk-JRWXQ7TA.js +1 -0
- package/dist/chunk-JS3RLRUL.js +1 -0
- package/dist/chunk-JUKXV3LK.js +1 -0
- package/dist/chunk-KD2IHEOH.js +1 -0
- package/dist/chunk-KOETTUXE.js +1 -0
- package/dist/chunk-L6NJFBPJ.js +1 -0
- package/dist/chunk-L7XSP7BP.js +1 -0
- package/dist/chunk-LBEE3FLI.js +1 -0
- package/dist/chunk-LOTVJGGJ.js +1 -0
- package/dist/chunk-LTWUYEB2.js +1 -0
- package/dist/chunk-M3BQLI4H.js +1 -0
- package/dist/chunk-NOS6FYP4.js +1 -0
- package/dist/chunk-NOY2XYXH.js +1 -0
- package/dist/chunk-NYQMI5LM.js +1 -0
- package/dist/chunk-O5II25ZN.js +1 -0
- package/dist/chunk-OK36TZP7.js +1 -0
- package/dist/chunk-OUSBK7KV.js +1 -0
- package/dist/chunk-PLGWF3DG.js +0 -0
- package/dist/chunk-PWDUR2QJ.js +1 -0
- package/dist/chunk-PY55ZUDE.js +1 -0
- package/dist/chunk-QBWO3SO2.js +1 -0
- package/dist/chunk-QHVCEJD6.js +0 -0
- package/dist/chunk-QMVHSNCH.js +1 -0
- package/dist/chunk-QQRJOQDC.js +1 -0
- package/dist/chunk-QRA62OWQ.js +1 -0
- package/dist/chunk-QYR5BEHF.js +1 -0
- package/dist/chunk-R7XNHFZS.js +1 -0
- package/dist/chunk-RNOFZ325.js +1 -0
- package/dist/chunk-ROI2EB7Y.js +1 -0
- package/dist/chunk-RRJ67KJR.js +0 -0
- package/dist/chunk-RRPJQPHW.js +1 -0
- package/dist/chunk-RRVEX5DC.js +1 -0
- package/dist/chunk-SF7SQKVF.js +1 -0
- package/dist/chunk-SMWRJVC7.js +1 -0
- package/dist/chunk-SS3XUXOS.js +1 -0
- package/dist/chunk-ST4P6AN6.js +0 -0
- package/dist/chunk-T4DAKHDZ.js +1 -0
- package/dist/chunk-TBLQRXJC.js +1 -0
- package/dist/chunk-THZHIJBQ.js +1 -0
- package/dist/chunk-TIPUHCNI.js +1 -0
- package/dist/chunk-U2VVI5ES.js +1 -0
- package/dist/chunk-U3L7YGSF.js +1 -0
- package/dist/chunk-UBSU7YCQ.js +1 -0
- package/dist/chunk-UKE34O57.js +1 -0
- package/dist/chunk-UOERMLXJ.js +1 -0
- package/dist/chunk-UP2CLMRV.js +1 -0
- package/dist/chunk-US5YZNOL.js +1 -0
- package/dist/chunk-UTPSJF3Y.js +1 -0
- package/dist/chunk-V7R4OTS2.js +1 -0
- package/dist/chunk-VBJRZIXT.js +1 -0
- package/dist/chunk-VCZHUY2M.js +1 -0
- package/dist/chunk-VIQKAFRZ.js +1 -0
- package/dist/chunk-VROQRL3K.js +1 -0
- package/dist/chunk-VSQXG6EA.js +1 -0
- package/dist/chunk-WRJSODGW.js +1 -0
- package/dist/chunk-WWCF4CKB.js +1 -0
- package/dist/chunk-XKXLMQA4.js +1 -0
- package/dist/chunk-XTLNI7GW.js +1 -0
- package/dist/chunk-XYZBCTIZ.js +1 -0
- package/dist/chunk-Y3XHSJV3.js +1 -0
- package/dist/chunk-Y5JERV2O.js +1 -0
- package/dist/chunk-Y7KOFQIK.js +1 -0
- package/dist/chunk-YHDUTISD.js +1 -0
- package/dist/chunk-YKXHKTDJ.js +1 -0
- package/dist/chunk-YQLFGUES.js +1 -0
- package/dist/chunk-YS422YJI.js +1 -0
- package/dist/chunk-YTOBFDVN.js +1 -0
- package/dist/chunk-YX3L5Z7J.js +1 -0
- package/dist/chunk-Z4OMWKVB.js +1 -0
- package/dist/chunk-Z5AJM7RV.js +0 -0
- package/dist/chunk-ZAUKECSD.js +1 -0
- package/dist/chunk-ZBHN343P.js +0 -0
- package/dist/chunk-ZEDS62HY.js +1 -0
- package/dist/chunk-ZMAGNUVU.js +1 -0
- package/dist/common/types/index.d.ts +8 -0
- package/dist/common/types/index.js +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +1 -0
- package/dist/labs/Diagram.d.ts +6 -0
- package/dist/labs/Sitemap/drawTree.d.ts +74 -0
- package/dist/labs/Sitemap/index.d.ts +10 -0
- package/dist/labs/Sitemap/styles.css.d.ts +6 -0
- package/dist/labs/index.d.ts +9 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +47 -0
- package/dist/styles.js +1 -0
- package/dist/useBreakpoint.d.ts +1 -0
- package/dist/useBreakpoint.js +1 -0
- package/dist/useLockBodyScroll.d.ts +1 -0
- package/dist/useLockBodyScroll.js +1 -0
- package/dist/useSize.d.ts +4 -0
- package/dist/useSize.js +1 -0
- package/dist/useSpacing.d.ts +2 -0
- package/dist/useSpacing.js +1 -0
- package/dist/utils/hasProtocol.d.ts +1 -0
- package/dist/utils/hasProtocol.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist-labs/Diagram.js +1 -0
- package/dist-labs/Sitemap/drawTree.js +1 -0
- package/dist-labs/Sitemap/index.css +1 -0
- package/dist-labs/Sitemap/index.js +1 -0
- package/dist-labs/Sitemap/styles.css.css +1 -0
- package/dist-labs/Sitemap/styles.css.js +1 -0
- package/dist-labs/index.css +1 -0
- package/dist-labs/index.js +1 -0
- package/package.json +58 -0
- package/src/Accordion/__tests__/index.test.tsx +82 -0
- package/src/Accordion/index.tsx +75 -0
- package/src/Accordion/styles.css.ts +16 -0
- package/src/AudioPlayer/__tests__/index.test.tsx +19 -0
- package/src/AudioPlayer/index.tsx +167 -0
- package/src/AudioPlayer/styles.css.ts +64 -0
- package/src/BrowserOnly.tsx +17 -0
- package/src/Button.tsx +18 -0
- package/src/Callout/__tests__/index.test.tsx +102 -0
- package/src/Callout/index.tsx +62 -0
- package/src/Callout/styles.css.ts +77 -0
- package/src/Card/index.tsx +35 -0
- package/src/Card/styles.css.ts +23 -0
- package/src/Cards.tsx +25 -0
- package/src/ColorModeProvider.tsx +70 -0
- package/src/ComponentExample/index.tsx +23 -0
- package/src/ComponentExample/styles.css.ts +25 -0
- package/src/DataTable.tsx +114 -0
- package/src/EditionFilterView/__tests__/index.test.tsx +49 -0
- package/src/EditionFilterView/index.tsx +113 -0
- package/src/EditionFilterView/styles.css.ts +8 -0
- package/src/EditionTileLink/index.tsx +85 -0
- package/src/EditionTileLink/styles.css.ts +95 -0
- package/src/Feature/Feature.tsx +92 -0
- package/src/Feature/FeatureActions/index.tsx +30 -0
- package/src/Feature/FeatureActions/styles.css.ts +15 -0
- package/src/Feature/FeatureContent/index.tsx +30 -0
- package/src/Feature/FeatureContent/styles.css.ts +13 -0
- package/src/Feature/FeatureEyebrow/index.tsx +19 -0
- package/src/Feature/FeatureEyebrow/styles.css.ts +11 -0
- package/src/Feature/FeatureTitle/index.tsx +18 -0
- package/src/Feature/FeatureTitle/styles.css.ts +9 -0
- package/src/Feature/index.tsx +10 -0
- package/src/Feature/styles.css.ts +58 -0
- package/src/Features/index.tsx +33 -0
- package/src/Features/styles.css.ts +10 -0
- package/src/FilterToolbar/ContentArea/index.tsx +14 -0
- package/src/FilterToolbar/ContentArea/styles.css.ts +16 -0
- package/src/FilterToolbar/FilterDropdown/__tests__/index.test.tsx +22 -0
- package/src/FilterToolbar/FilterDropdown/index.tsx +62 -0
- package/src/FilterToolbar/FilterDropdown/styles.css.ts +9 -0
- package/src/FilterToolbar/PillGroup/__tests__/index.test.tsx +26 -0
- package/src/FilterToolbar/PillGroup/index.tsx +33 -0
- package/src/FilterToolbar/PillGroup/styles.css.ts +17 -0
- package/src/FilterToolbar/Search/__tests__/index.test.tsx +34 -0
- package/src/FilterToolbar/Search/index.tsx +33 -0
- package/src/FilterToolbar/Search/styles.css.ts +9 -0
- package/src/FilterToolbar/SortDropdown/__tests__/index.test.tsx +22 -0
- package/src/FilterToolbar/SortDropdown/defaultSort.js +8 -0
- package/src/FilterToolbar/SortDropdown/index.tsx +55 -0
- package/src/FilterToolbar/SortDropdown/styles.css.ts +9 -0
- package/src/FilterToolbar/Toolbar.tsx +41 -0
- package/src/FilterToolbar/ToolbarProvider.tsx +94 -0
- package/src/FilterToolbar/__tests__/Toolbar.test.tsx +127 -0
- package/src/FilterToolbar/__tests__/ToolbarProvider.test.tsx +85 -0
- package/src/FilterToolbar/index.tsx +9 -0
- package/src/FilterToolbar/styles.css.ts +19 -0
- package/src/FilterView/ContentArea/index.tsx +27 -0
- package/src/FilterView/ContentArea/styles.css.ts +16 -0
- package/src/FilterView/FilterView.tsx +205 -0
- package/src/FilterView/FilterViewProvider.tsx +23 -0
- package/src/FilterView/NoResults/index.tsx +19 -0
- package/src/FilterView/NoResults/styles.css.ts +13 -0
- package/src/FilterView/Pagination/index.tsx +38 -0
- package/src/FilterView/Pagination/styles.css.ts +15 -0
- package/src/FilterView/Pagination/usePagination.ts +31 -0
- package/src/FilterView/ResultCount/index.tsx +21 -0
- package/src/FilterView/ResultCount/styles.css.ts +11 -0
- package/src/FilterView/__tests__/index.test.tsx +109 -0
- package/src/FilterView/index.tsx +4 -0
- package/src/FilterView/useResultCount.tsx +8 -0
- package/src/FormattedContent.tsx +75 -0
- package/src/Grid/index.tsx +29 -0
- package/src/Grid/styles.css.ts +13 -0
- package/src/GridBase/index.tsx +60 -0
- package/src/GridBase/styles.css.ts +19 -0
- package/src/HelpLinks/index.tsx +80 -0
- package/src/HelpLinks/styles.css.ts +32 -0
- package/src/Hero/__tests__/index.test.tsx +19 -0
- package/src/Hero/index.tsx +179 -0
- package/src/Hero/styles.css.ts +111 -0
- package/src/Icon/index.tsx +40 -0
- package/src/Icon/styles.css.ts +9 -0
- package/src/ImageProvider.ts +9 -0
- package/src/Impact/index.tsx +36 -0
- package/src/Impact/styles.css.ts +72 -0
- package/src/Impacts.tsx +25 -0
- package/src/IsomorphicSuspense.tsx +9 -0
- package/src/Label/__tests__/index.test.tsx +27 -0
- package/src/Label/index.tsx +52 -0
- package/src/Label/styles.css.ts +14 -0
- package/src/Link/index.tsx +83 -0
- package/src/Link/styles.css.ts +15 -0
- package/src/LinkBase/index.tsx +32 -0
- package/src/LinkButton.tsx +20 -0
- package/src/LinkProvider.ts +9 -0
- package/src/LinkText/index.tsx +121 -0
- package/src/LinkText/styles.css.ts +21 -0
- package/src/Links/index.tsx +18 -0
- package/src/Links/styles.css.ts +13 -0
- package/src/List/ListItem.tsx +31 -0
- package/src/List/OrderedList.tsx +19 -0
- package/src/List/UnorderedList.tsx +35 -0
- package/src/List/index.tsx +3 -0
- package/src/Markdown/AnchorHeading/__tests__/index.test.tsx +56 -0
- package/src/Markdown/AnchorHeading/index.css.ts +64 -0
- package/src/Markdown/AnchorHeading/index.tsx +97 -0
- package/src/Markdown/BlockQuote/index.css.ts +6 -0
- package/src/Markdown/BlockQuote/index.tsx +18 -0
- package/src/Markdown/Heading.tsx +39 -0
- package/src/Markdown/InlineCode.tsx +9 -0
- package/src/Markdown/Link.tsx +11 -0
- package/src/Markdown/Pre/index.css.ts +35 -0
- package/src/Markdown/Pre/index.tsx +148 -0
- package/src/Markdown/Table.tsx +11 -0
- package/src/Markdown/Tbody.tsx +9 -0
- package/src/Markdown/Td.tsx +9 -0
- package/src/Markdown/Th.tsx +9 -0
- package/src/Markdown/Thead.tsx +9 -0
- package/src/Markdown/ThematicBreak/index.css.ts +5 -0
- package/src/Markdown/ThematicBreak/index.tsx +10 -0
- package/src/Markdown/Tr.tsx +9 -0
- package/src/Markdown/__tests__/Heading.test.tsx +56 -0
- package/src/Markdown/index.tsx +208 -0
- package/src/Markdown/markdownElements.tsx +51 -0
- package/src/Markdown/withMarkdownSpacing/index.tsx +33 -0
- package/src/Markdown/withMarkdownSpacing/styles.css.ts +7 -0
- package/src/PageFilterView/index.tsx +86 -0
- package/src/PageFilterView/styles.css.ts +8 -0
- package/src/ReactLive/index.tsx +71 -0
- package/src/ReactLive/styles.css.ts +28 -0
- package/src/SecondaryNavbar/index.tsx +55 -0
- package/src/SecondaryNavbar/styles.css.ts +27 -0
- package/src/SectionHeading/__tests__/index.test.tsx +20 -0
- package/src/SectionHeading/index.tsx +33 -0
- package/src/SectionHeading/styles.css.ts +15 -0
- package/src/StickyHeader/index.tsx +52 -0
- package/src/StickyHeader/styles.css.ts +17 -0
- package/src/Story/index.tsx +70 -0
- package/src/Story/styles.css.ts +37 -0
- package/src/Tabs/index.tsx +65 -0
- package/src/Tabs/styles.css.ts +7 -0
- package/src/TabsBase/TabsBase.tsx +89 -0
- package/src/TabsBase/TabsButton.tsx +26 -0
- package/src/TabsBase/TabsLink.tsx +26 -0
- package/src/TabsBase/TabsMenuButton.tsx +37 -0
- package/src/TabsBase/index.ts +4 -0
- package/src/TabsBase/styles.css.ts +64 -0
- package/src/TabsBase/tabsMenuButton.css.ts +25 -0
- package/src/Tag/__tests__/index.test.tsx +58 -0
- package/src/Tag/index.tsx +62 -0
- package/src/Tag/styles.css.ts +48 -0
- package/src/ThemeProvider.tsx +21 -0
- package/src/TileBase/TileBase.tsx +159 -0
- package/src/TileBase/TileStateProvider.tsx +52 -0
- package/src/TileBase/index.ts +2 -0
- package/src/TileBase/styles.css.ts +15 -0
- package/src/TileButton/index.tsx +68 -0
- package/src/TileContent/index.tsx +153 -0
- package/src/TileContent/styles.css.ts +229 -0
- package/src/TileContentLabel/index.tsx +74 -0
- package/src/TileContentLabel/styles.css.ts +22 -0
- package/src/TileLink/index.tsx +83 -0
- package/src/TileLink/styles.css.ts +9 -0
- package/src/Tiles.tsx +17 -0
- package/src/Typography/Typography.tsx +22 -0
- package/src/Typography/index.tsx +54 -0
- package/src/Typography/withStyledTypography.tsx +22 -0
- package/src/VideoPlayer/__tests__/index.test.tsx +13 -0
- package/src/VideoPlayer/index.tsx +176 -0
- package/src/VideoPlayer/styles.css.ts +82 -0
- package/src/ViewStack/View.tsx +19 -0
- package/src/ViewStack/ViewStack.tsx +50 -0
- package/src/ViewStack/__tests__/index.test.tsx +86 -0
- package/src/ViewStack/index.tsx +2 -0
- package/src/__tests__/Button.test.tsx +13 -0
- package/src/__tests__/LinkButton.test.tsx +16 -0
- package/src/__tests__/ReactLive.test.tsx +20 -0
- package/src/canUseDOM.ts +5 -0
- package/src/common/types/index.ts +52 -0
- package/src/index.tsx +59 -0
- package/src/labs/Diagram.tsx +26 -0
- package/src/labs/Sitemap/drawTree.ts +163 -0
- package/src/labs/Sitemap/index.tsx +223 -0
- package/src/labs/Sitemap/styles.css.ts +24 -0
- package/src/labs/index.ts +13 -0
- package/src/styles.ts +47 -0
- package/src/useBreakpoint.ts +28 -0
- package/src/useLockBodyScroll.ts +16 -0
- package/src/useSize.ts +32 -0
- package/src/useSpacing.ts +17 -0
- package/src/utils/hasProtocol.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Context } from 'react';
|
|
3
|
+
|
|
4
|
+
type Action =
|
|
5
|
+
| { type: 'addFilter'; value: string }
|
|
6
|
+
| { type: 'removeFilter'; value: string }
|
|
7
|
+
| { type: 'setFilters'; value: string[] }
|
|
8
|
+
| { type: 'setSort'; value: string };
|
|
9
|
+
type Dispatch = (action: Action) => void | undefined;
|
|
10
|
+
export type State = { filters?: string[]; sort?: string; hasStateChanged?: boolean };
|
|
11
|
+
export type OnStateChangeCallback = (state: State | undefined) => void;
|
|
12
|
+
|
|
13
|
+
export interface ToolbarProviderProps {
|
|
14
|
+
/** Children of the Toolbar */
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/** Initial filter/sort state of the view */
|
|
17
|
+
initialState?: State;
|
|
18
|
+
/** Callback called when the filter/sort state changes */
|
|
19
|
+
onStateChange?: OnStateChangeCallback;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ToolbarStateContext: Context<State | undefined> = React.createContext<State | undefined>(
|
|
23
|
+
undefined
|
|
24
|
+
);
|
|
25
|
+
const ToolbarDispatchContext: Context<Dispatch | undefined> = React.createContext<
|
|
26
|
+
Dispatch | undefined
|
|
27
|
+
>(undefined);
|
|
28
|
+
|
|
29
|
+
function toolbarReducer(state: State, action: Action): State {
|
|
30
|
+
const { filters } = state;
|
|
31
|
+
switch (action.type) {
|
|
32
|
+
case 'setFilters': {
|
|
33
|
+
return { ...state, filters: action.value, hasStateChanged: true };
|
|
34
|
+
}
|
|
35
|
+
case 'addFilter': {
|
|
36
|
+
if (filters && filters.indexOf(action.value) === -1) {
|
|
37
|
+
return { ...state, filters: [...filters, action.value], hasStateChanged: true };
|
|
38
|
+
}
|
|
39
|
+
return state;
|
|
40
|
+
}
|
|
41
|
+
case 'removeFilter': {
|
|
42
|
+
const newFilters = filters && filters.filter(value => value !== action.value);
|
|
43
|
+
return { ...state, filters: newFilters, hasStateChanged: true };
|
|
44
|
+
}
|
|
45
|
+
case 'setSort': {
|
|
46
|
+
return { ...state, sort: action.value, hasStateChanged: true };
|
|
47
|
+
}
|
|
48
|
+
default: {
|
|
49
|
+
throw new Error(`Unhandled action type: ${action}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ToolbarProvider = ({ children, initialState = {}, onStateChange }: ToolbarProviderProps) => {
|
|
55
|
+
const previousStateRef = React.useRef<State>();
|
|
56
|
+
const nextStateRef = React.useRef<State>();
|
|
57
|
+
const [state, dispatch] = React.useReducer(toolbarReducer, initialState);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (
|
|
60
|
+
onStateChange &&
|
|
61
|
+
previousStateRef.current &&
|
|
62
|
+
previousStateRef.current !== nextStateRef.current
|
|
63
|
+
) {
|
|
64
|
+
onStateChange(nextStateRef.current);
|
|
65
|
+
}
|
|
66
|
+
previousStateRef.current = nextStateRef.current;
|
|
67
|
+
});
|
|
68
|
+
if (state) {
|
|
69
|
+
nextStateRef.current = state;
|
|
70
|
+
}
|
|
71
|
+
return (
|
|
72
|
+
<ToolbarStateContext.Provider value={state}>
|
|
73
|
+
<ToolbarDispatchContext.Provider value={dispatch}>{children}</ToolbarDispatchContext.Provider>
|
|
74
|
+
</ToolbarStateContext.Provider>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
function useToolbarState(): State {
|
|
79
|
+
const context = React.useContext(ToolbarStateContext);
|
|
80
|
+
if (context === undefined) {
|
|
81
|
+
throw new Error('useToolbarState must be used within a ToolbarProvider');
|
|
82
|
+
}
|
|
83
|
+
return context;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function useToolbarDispatch(): Dispatch {
|
|
87
|
+
const context = React.useContext(ToolbarDispatchContext);
|
|
88
|
+
if (context === undefined) {
|
|
89
|
+
throw new Error('useToolbarDispatch must be used within a ToolbarProvider');
|
|
90
|
+
}
|
|
91
|
+
return context;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { ToolbarProvider, useToolbarState, useToolbarDispatch };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, within } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { FilterToolbar } from '../Toolbar';
|
|
5
|
+
|
|
6
|
+
function renderToolbar(initialState, onStateChange) {
|
|
7
|
+
return render(
|
|
8
|
+
<FilterToolbar initialState={initialState} onStateChange={onStateChange}>
|
|
9
|
+
<label>Another component</label>
|
|
10
|
+
<FilterToolbar.PillGroup />
|
|
11
|
+
<FilterToolbar.SortDropdown
|
|
12
|
+
ListProps={{ 'data-mosaic-testid': 'sort-dropdown' }}
|
|
13
|
+
itemToString={item => `Item ${item}`}
|
|
14
|
+
source={['Sort 1', 'Sort 2', 'Sort 3']}
|
|
15
|
+
/>
|
|
16
|
+
<FilterToolbar.FilterDropdown
|
|
17
|
+
ListProps={{ 'data-mosaic-testid': 'filter-dropdown' }}
|
|
18
|
+
itemToString={item => `Item ${item}`}
|
|
19
|
+
source={['Filter 1', 'Filter 2', 'Filter 3']}
|
|
20
|
+
/>
|
|
21
|
+
</FilterToolbar>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test('updates the toolbar sort state', async () => {
|
|
26
|
+
// arrange
|
|
27
|
+
const handleStateChangeMock = jest.fn();
|
|
28
|
+
const { getByText } = renderToolbar({ filters: [], sort: 'Sort 3' }, handleStateChangeMock);
|
|
29
|
+
const dropdownSortButton = getByText('Sort 3');
|
|
30
|
+
// action
|
|
31
|
+
await userEvent.click(dropdownSortButton);
|
|
32
|
+
// assert
|
|
33
|
+
expect(within(screen.getByTestId('sort-dropdown')).getAllByRole('option').length).toEqual(3);
|
|
34
|
+
const sort2 = within(screen.getByTestId('sort-dropdown')).getByText('Item Sort 2');
|
|
35
|
+
// action
|
|
36
|
+
await userEvent.click(sort2);
|
|
37
|
+
// assert
|
|
38
|
+
expect(handleStateChangeMock).toHaveBeenLastCalledWith({
|
|
39
|
+
filters: [],
|
|
40
|
+
sort: 'Sort 2',
|
|
41
|
+
hasStateChanged: true
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('updates the toolbar filter state', async () => {
|
|
46
|
+
// arrange
|
|
47
|
+
const handleStateChangeMock = jest.fn();
|
|
48
|
+
const { getByText } = renderToolbar({ filters: [], sort: 'Sort 3' }, handleStateChangeMock);
|
|
49
|
+
// action
|
|
50
|
+
const dropdownFilterButton = getByText('All');
|
|
51
|
+
await userEvent.click(dropdownFilterButton);
|
|
52
|
+
// assert
|
|
53
|
+
expect(within(screen.getByTestId('filter-dropdown')).getAllByRole('option').length).toEqual(4);
|
|
54
|
+
// action
|
|
55
|
+
const option2 = within(screen.getByTestId('filter-dropdown')).getByText('Item Filter 2');
|
|
56
|
+
await userEvent.click(option2);
|
|
57
|
+
// assert
|
|
58
|
+
expect(handleStateChangeMock).toHaveBeenCalledWith({
|
|
59
|
+
filters: ['Filter 2'],
|
|
60
|
+
sort: 'Sort 3',
|
|
61
|
+
hasStateChanged: true
|
|
62
|
+
});
|
|
63
|
+
// action
|
|
64
|
+
const option3 = within(screen.getByTestId('filter-dropdown')).getByText('Item Filter 3');
|
|
65
|
+
await userEvent.click(option3);
|
|
66
|
+
// assert
|
|
67
|
+
expect(handleStateChangeMock).toHaveBeenLastCalledWith({
|
|
68
|
+
filters: ['Filter 2', 'Filter 3'],
|
|
69
|
+
sort: 'Sort 3',
|
|
70
|
+
hasStateChanged: true
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('remove a filter with the dropdown', async () => {
|
|
75
|
+
// arrange
|
|
76
|
+
const handleStateChangeMock = jest.fn();
|
|
77
|
+
const { getByText } = renderToolbar(
|
|
78
|
+
{ filters: ['Filter 2', 'Filter 3'], sort: 'Sort 3' },
|
|
79
|
+
handleStateChangeMock
|
|
80
|
+
);
|
|
81
|
+
// action
|
|
82
|
+
const dropdownFilterButton = getByText('2 Items Selected');
|
|
83
|
+
await userEvent.click(dropdownFilterButton);
|
|
84
|
+
const option2 = within(screen.getByTestId('filter-dropdown')).getByText('Item Filter 2');
|
|
85
|
+
await userEvent.click(option2);
|
|
86
|
+
// assert
|
|
87
|
+
expect(handleStateChangeMock).toHaveBeenCalledWith({
|
|
88
|
+
filters: ['Filter 3'],
|
|
89
|
+
sort: 'Sort 3',
|
|
90
|
+
hasStateChanged: true
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('clears all filters', async () => {
|
|
95
|
+
// arrange
|
|
96
|
+
const handleStateChangeMock = jest.fn();
|
|
97
|
+
const { getByText } = renderToolbar(
|
|
98
|
+
{ filters: ['Filter 2', 'Filter 3'], sort: 'Sort 3' },
|
|
99
|
+
handleStateChangeMock
|
|
100
|
+
);
|
|
101
|
+
// action
|
|
102
|
+
const dropdownFilterButton = getByText('2 Items Selected');
|
|
103
|
+
await userEvent.click(dropdownFilterButton);
|
|
104
|
+
const clearAllOption = within(screen.getByTestId('filter-dropdown')).getByText('Item Clear all');
|
|
105
|
+
await userEvent.click(clearAllOption);
|
|
106
|
+
// assert
|
|
107
|
+
expect(handleStateChangeMock).toHaveBeenCalledWith({
|
|
108
|
+
filters: [],
|
|
109
|
+
sort: 'Sort 3',
|
|
110
|
+
hasStateChanged: true
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('remove a filter with the pills', async () => {
|
|
115
|
+
// arrange
|
|
116
|
+
const handleStateChangeMock = jest.fn();
|
|
117
|
+
renderToolbar({ filters: ['Filter 2', 'Filter 3'], sort: 'Sort 3' }, handleStateChangeMock);
|
|
118
|
+
// action
|
|
119
|
+
const pills = screen.getAllByTestId('pill');
|
|
120
|
+
await userEvent.click(pills[0].querySelector('button'));
|
|
121
|
+
// assert
|
|
122
|
+
expect(handleStateChangeMock).toHaveBeenCalledWith({
|
|
123
|
+
filters: ['Filter 3'],
|
|
124
|
+
sort: 'Sort 3',
|
|
125
|
+
hasStateChanged: true
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { useToolbarState, useToolbarDispatch, ToolbarProvider } from '../ToolbarProvider';
|
|
5
|
+
|
|
6
|
+
function TestUseToolbarDispatch({ action }) {
|
|
7
|
+
const dispatch = useToolbarDispatch();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
dispatch(action);
|
|
10
|
+
});
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function TestUseToolbarState({ validate }) {
|
|
15
|
+
const state = useToolbarState();
|
|
16
|
+
validate(state);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
test('can add filters', async () => {
|
|
21
|
+
const props = {
|
|
22
|
+
handleStateChange: state => {
|
|
23
|
+
expect(state).toEqual({ filters: ['Filter 3'], sort: undefined });
|
|
24
|
+
},
|
|
25
|
+
initialState: { filters: [], sort: undefined }
|
|
26
|
+
};
|
|
27
|
+
render(
|
|
28
|
+
<ToolbarProvider {...props}>
|
|
29
|
+
<TestUseToolbarDispatch action={{ type: 'addFilter', value: 'Filter 3' }} />
|
|
30
|
+
</ToolbarProvider>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('can set filters', async () => {
|
|
35
|
+
const props = {
|
|
36
|
+
handleStateChange: state => {
|
|
37
|
+
expect(state).toEqual({ filters: ['Filter 3'], sort: undefined });
|
|
38
|
+
},
|
|
39
|
+
initialState: { filters: [], sort: undefined }
|
|
40
|
+
};
|
|
41
|
+
render(
|
|
42
|
+
<ToolbarProvider {...props}>
|
|
43
|
+
<TestUseToolbarDispatch action={{ type: 'setFilters', value: 'Filter 3' }} />
|
|
44
|
+
</ToolbarProvider>
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('can remove filters', async () => {
|
|
49
|
+
const props = {
|
|
50
|
+
handleStateChange: state => {
|
|
51
|
+
expect(state).toEqual({ filters: ['Filter 1'], sort: undefined });
|
|
52
|
+
},
|
|
53
|
+
initialState: { filters: ['Filter 1', 'Filter 3'], sort: undefined }
|
|
54
|
+
};
|
|
55
|
+
render(
|
|
56
|
+
<ToolbarProvider {...props}>
|
|
57
|
+
<TestUseToolbarDispatch action={{ type: 'removeFilter', value: 'Filter 3' }} />
|
|
58
|
+
</ToolbarProvider>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('can set sort', async () => {
|
|
63
|
+
const props = {
|
|
64
|
+
handleStateChange: state => {
|
|
65
|
+
expect(state).toEqual({ filters: undefined, sort: 'Sort 1' });
|
|
66
|
+
},
|
|
67
|
+
initialState: { filters: undefined, sort: undefined }
|
|
68
|
+
};
|
|
69
|
+
render(
|
|
70
|
+
<ToolbarProvider {...props}>
|
|
71
|
+
<TestUseToolbarDispatch action={{ type: 'setSort', value: 'Sort 1' }} />
|
|
72
|
+
</ToolbarProvider>
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('can read the state', async () => {
|
|
77
|
+
const validate = state => {
|
|
78
|
+
expect(state).toEqual({ filters: ['Filter 1'], sort: 'Sort 1' });
|
|
79
|
+
};
|
|
80
|
+
render(
|
|
81
|
+
<ToolbarProvider initialState={{ filters: ['Filter 1'], sort: 'Sort 1' }}>
|
|
82
|
+
<TestUseToolbarState validate={validate} />
|
|
83
|
+
</ToolbarProvider>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './FilterDropdown';
|
|
2
|
+
export * from './PillGroup';
|
|
3
|
+
export * from './SortDropdown';
|
|
4
|
+
export * from './ToolbarProvider';
|
|
5
|
+
export * from './ContentArea';
|
|
6
|
+
export * from './Toolbar';
|
|
7
|
+
export * from './PillGroup';
|
|
8
|
+
export * from './Search';
|
|
9
|
+
export * from './SortDropdown';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { caption, responsiveSprinkles, neutralBorder } from '@jpmorganchase/mosaic-theme';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
root: style([
|
|
6
|
+
{
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexWrap: 'nowrap',
|
|
9
|
+
justifyContent: 'flex-end',
|
|
10
|
+
alignItems: 'center'
|
|
11
|
+
},
|
|
12
|
+
caption({ variant: 'caption2' }),
|
|
13
|
+
responsiveSprinkles({
|
|
14
|
+
columnGap: ['x2', 'x2', 'x2', 'x2'],
|
|
15
|
+
paddingX: ['x2', 'x2', 'x2', 'x2']
|
|
16
|
+
}),
|
|
17
|
+
neutralBorder({ variant: 'low', borderBottomWidth: 'thin' })
|
|
18
|
+
])
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Grid, GridItemSize } from '../../Grid';
|
|
5
|
+
import styles from './styles.css';
|
|
6
|
+
|
|
7
|
+
export interface FilterViewContentAreaProps {
|
|
8
|
+
/** Additional class name for root class override */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Tile size */
|
|
11
|
+
size?: GridItemSize;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const FilterViewContentArea: React.FC<FilterViewContentAreaProps> = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
size = 'small',
|
|
18
|
+
...rest
|
|
19
|
+
}) => (
|
|
20
|
+
<Grid
|
|
21
|
+
className={classnames(className, styles.root, { [styles.gutter]: size !== 'fullWidth' })}
|
|
22
|
+
size={size}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</Grid>
|
|
27
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
root: style([
|
|
6
|
+
responsiveSprinkles({
|
|
7
|
+
paddingTop: ['x8', 'x8', 'x8', 'x8']
|
|
8
|
+
})
|
|
9
|
+
]),
|
|
10
|
+
gutter: style([
|
|
11
|
+
responsiveSprinkles({
|
|
12
|
+
marginLeft: ['gutter', 'gutter', 'gutter', 'gutter'],
|
|
13
|
+
marginRight: ['gutter', 'gutter', 'gutter', 'gutter']
|
|
14
|
+
})
|
|
15
|
+
])
|
|
16
|
+
};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import React, { cloneElement, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { FilterResultCount } from './ResultCount';
|
|
4
|
+
import { FilterNoResults, DefaultNoResults } from './NoResults';
|
|
5
|
+
import {
|
|
6
|
+
FilterToolbar,
|
|
7
|
+
FilterToolbarContentArea,
|
|
8
|
+
OnStateChangeCallback,
|
|
9
|
+
State
|
|
10
|
+
} from '../FilterToolbar';
|
|
11
|
+
import { FilterViewProvider } from './FilterViewProvider';
|
|
12
|
+
import { FilterViewContentArea } from './ContentArea';
|
|
13
|
+
import { Pagination } from './Pagination';
|
|
14
|
+
import { usePagination } from './Pagination/usePagination';
|
|
15
|
+
import { GridItemSize } from '../Grid';
|
|
16
|
+
|
|
17
|
+
export type FilterFn<T> = (filterable: T[], filters: string[]) => T[] | [];
|
|
18
|
+
export type SortFn<T> = (sortable: T[], sort: string) => T[] | [];
|
|
19
|
+
|
|
20
|
+
export interface FilterViewProps<T> {
|
|
21
|
+
/** Children of the FilterToolbar */
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
/** Additional class name for root class override */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** View uses pagination when true */
|
|
26
|
+
enablePagination?: boolean;
|
|
27
|
+
/** Number of items to display per page */
|
|
28
|
+
itemsPerPage?: number;
|
|
29
|
+
/** Filter function, called when the view has a filter applied */
|
|
30
|
+
filter?: FilterFn<T>;
|
|
31
|
+
/** Initial state of filter/sort */
|
|
32
|
+
initialState?: State;
|
|
33
|
+
/** Item renderer for view */
|
|
34
|
+
itemRenderer: (item: T, itemIndex: number) => JSX.Element;
|
|
35
|
+
/** Callback called when the filter/sort state changes */
|
|
36
|
+
onStateChange?: OnStateChangeCallback;
|
|
37
|
+
/** Tile size */
|
|
38
|
+
size?: GridItemSize;
|
|
39
|
+
/** Sort function, creates a sort callback, which is called when a view is sorted */
|
|
40
|
+
sort?: SortFn<T>;
|
|
41
|
+
/** Date view to sort and filter */
|
|
42
|
+
view: T[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function createDefaultSort<T>(sortKey: string): SortFn<T> {
|
|
46
|
+
function defaultSort(view: T[], sort: string): T[] {
|
|
47
|
+
if (sort === 'A-Z') {
|
|
48
|
+
return view.sort((sortableA, sortableB) => {
|
|
49
|
+
const hasSortableA = Object.prototype.hasOwnProperty.call(sortableA, sortKey);
|
|
50
|
+
const hasSortableB = Object.prototype.hasOwnProperty.call(sortableB, sortKey);
|
|
51
|
+
if (hasSortableA && hasSortableB) {
|
|
52
|
+
return sortableA[sortKey].localeCompare(sortableB[sortKey]);
|
|
53
|
+
}
|
|
54
|
+
console.warn(`sort key "${sortKey}" not found in FilterView data view`);
|
|
55
|
+
if (hasSortableA) {
|
|
56
|
+
return -1;
|
|
57
|
+
}
|
|
58
|
+
if (hasSortableB) {
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return view.sort((sortableA, sortableB) =>
|
|
65
|
+
sortableB[sortKey].localeCompare(sortableA[sortKey])
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return defaultSort;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface FilterViewComposition {
|
|
72
|
+
ContentArea?: typeof FilterViewContentArea;
|
|
73
|
+
FilterDropdown?: typeof FilterToolbar.FilterDropdown;
|
|
74
|
+
NoResults?: typeof FilterNoResults;
|
|
75
|
+
PillGroup?: typeof FilterToolbar.PillGroup;
|
|
76
|
+
ResultCount?: typeof FilterResultCount;
|
|
77
|
+
Search?: typeof FilterToolbar.Search;
|
|
78
|
+
SortDropdown?: typeof FilterToolbar.SortDropdown;
|
|
79
|
+
ToolbarContentArea?: typeof FilterToolbarContentArea;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const defaultNoResultsElement = (
|
|
83
|
+
<FilterNoResults>
|
|
84
|
+
<DefaultNoResults />
|
|
85
|
+
</FilterNoResults>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export function FilterView<T>({
|
|
89
|
+
children,
|
|
90
|
+
className,
|
|
91
|
+
enablePagination = false,
|
|
92
|
+
filter: filterProp,
|
|
93
|
+
initialState = {
|
|
94
|
+
sort: 'A-Z'
|
|
95
|
+
},
|
|
96
|
+
itemRenderer,
|
|
97
|
+
itemsPerPage = 20,
|
|
98
|
+
onStateChange,
|
|
99
|
+
size = 'small',
|
|
100
|
+
sort: sortProp = createDefaultSort('title'),
|
|
101
|
+
view
|
|
102
|
+
}: FilterViewProps<T> & FilterViewComposition): React.ReactElement {
|
|
103
|
+
const [viewState, setViewState] = useState({ ...initialState });
|
|
104
|
+
const { filters, sort } = viewState;
|
|
105
|
+
|
|
106
|
+
const handleStateChange = state => {
|
|
107
|
+
setViewState(state);
|
|
108
|
+
if (onStateChange) {
|
|
109
|
+
onStateChange(state);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
let filteredView = view;
|
|
114
|
+
filteredView = useMemo(() => {
|
|
115
|
+
if (!filterProp || !filters || filters.length === 0) {
|
|
116
|
+
return filteredView;
|
|
117
|
+
}
|
|
118
|
+
return filterProp(filteredView, filters);
|
|
119
|
+
}, [filterProp, filters, filteredView]);
|
|
120
|
+
|
|
121
|
+
filteredView = useMemo(() => {
|
|
122
|
+
if (!sortProp || !sort) {
|
|
123
|
+
return filteredView;
|
|
124
|
+
}
|
|
125
|
+
return sortProp([...filteredView], sort);
|
|
126
|
+
}, [filteredView, sortProp, sort]);
|
|
127
|
+
|
|
128
|
+
const counts = {
|
|
129
|
+
displayedCount: filteredView.length,
|
|
130
|
+
totalItemCount: view.length
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const toolbarChildren: NonNullable<React.ReactElement>[] = [];
|
|
134
|
+
let noResultsElement = defaultNoResultsElement;
|
|
135
|
+
let contentAreaElement;
|
|
136
|
+
const childElements = React.Children.toArray(children);
|
|
137
|
+
childElements.forEach((item, index) => {
|
|
138
|
+
const child = item as React.ReactElement;
|
|
139
|
+
if (child.type === FilterViewContentArea) {
|
|
140
|
+
contentAreaElement = child;
|
|
141
|
+
} else if (child.type === FilterNoResults) {
|
|
142
|
+
noResultsElement = React.cloneElement(child, { key: `noresult-${index}` });
|
|
143
|
+
} else {
|
|
144
|
+
toolbarChildren.push(React.cloneElement(child, { key: `toolbar-control-${index}` }));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// pagination
|
|
149
|
+
const { startIndex, endIndex, onPageChange, page, pageCount } = usePagination({
|
|
150
|
+
itemsPerPage,
|
|
151
|
+
...counts
|
|
152
|
+
});
|
|
153
|
+
const items = enablePagination ? filteredView.slice(startIndex, endIndex) : filteredView;
|
|
154
|
+
|
|
155
|
+
let contentAreaChildren: React.ReactElement[] = [];
|
|
156
|
+
if (items.length > 0) {
|
|
157
|
+
contentAreaChildren = items.map((item, itemIndex) => {
|
|
158
|
+
const renderer = itemRenderer(item, itemIndex);
|
|
159
|
+
return cloneElement(renderer, { size });
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (contentAreaChildren.length) {
|
|
164
|
+
const contentAreaProps = {
|
|
165
|
+
children: contentAreaChildren,
|
|
166
|
+
key: 'contentArea',
|
|
167
|
+
size
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
if (contentAreaElement && contentAreaElement.props.children) {
|
|
171
|
+
contentAreaProps.children = [contentAreaElement.props.children, ...contentAreaProps.children];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (contentAreaElement) {
|
|
175
|
+
contentAreaElement = React.cloneElement(contentAreaElement, contentAreaProps);
|
|
176
|
+
} else {
|
|
177
|
+
contentAreaElement = <FilterViewContentArea {...contentAreaProps} />;
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
contentAreaElement = noResultsElement;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<FilterViewProvider state={counts}>
|
|
185
|
+
<div className={className}>
|
|
186
|
+
<FilterToolbar initialState={viewState} onStateChange={handleStateChange}>
|
|
187
|
+
{toolbarChildren}
|
|
188
|
+
</FilterToolbar>
|
|
189
|
+
{contentAreaElement}
|
|
190
|
+
{enablePagination && items.length > 0 ? (
|
|
191
|
+
<Pagination onPageChange={onPageChange} page={page} pageCount={pageCount} />
|
|
192
|
+
) : null}
|
|
193
|
+
</div>
|
|
194
|
+
</FilterViewProvider>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
FilterView.ResultCount = FilterResultCount;
|
|
199
|
+
FilterView.ToolbarContentArea = FilterToolbar.ContentArea;
|
|
200
|
+
FilterView.PillGroup = FilterToolbar.PillGroup;
|
|
201
|
+
FilterView.Search = FilterToolbar.Search;
|
|
202
|
+
FilterView.SortDropdown = FilterToolbar.SortDropdown;
|
|
203
|
+
FilterView.FilterDropdown = FilterToolbar.FilterDropdown;
|
|
204
|
+
FilterView.NoResults = FilterNoResults;
|
|
205
|
+
FilterView.ContentArea = FilterViewContentArea;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface State {
|
|
4
|
+
/** Number of visible items */
|
|
5
|
+
displayedCount: number;
|
|
6
|
+
/** Number of items in the data view */
|
|
7
|
+
totalItemCount: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const FilterViewContext: React.Context<State> = React.createContext<State>({
|
|
11
|
+
displayedCount: 0,
|
|
12
|
+
totalItemCount: 0
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export function FilterViewProvider({
|
|
16
|
+
children,
|
|
17
|
+
state
|
|
18
|
+
}: {
|
|
19
|
+
children: React.ReactElement;
|
|
20
|
+
state: State;
|
|
21
|
+
}): React.ReactElement {
|
|
22
|
+
return <FilterViewContext.Provider value={state}>{children}</FilterViewContext.Provider>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { ContentStatus } from '@salt-ds/lab';
|
|
4
|
+
|
|
5
|
+
import styles from './styles.css';
|
|
6
|
+
|
|
7
|
+
export interface FilterNoResultsProps {
|
|
8
|
+
/** Additional class name for root class override */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function DefaultNoResults() {
|
|
13
|
+
return <ContentStatus message="No Results Found" status="info" />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const FilterNoResults: React.FC<FilterNoResultsProps> = ({
|
|
17
|
+
children,
|
|
18
|
+
className
|
|
19
|
+
}): React.ReactElement => <div className={classnames(className, styles.root)}>{children}</div>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
root: style([
|
|
6
|
+
responsiveSprinkles({
|
|
7
|
+
paddingTop: ['x8', 'x8', 'x8', 'x8']
|
|
8
|
+
}),
|
|
9
|
+
{
|
|
10
|
+
flexGrow: 1
|
|
11
|
+
}
|
|
12
|
+
])
|
|
13
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import {
|
|
4
|
+
Paginator,
|
|
5
|
+
Pagination as SaltPagination,
|
|
6
|
+
PaginationProps as SaltPaginationProps
|
|
7
|
+
} from '@salt-ds/lab';
|
|
8
|
+
|
|
9
|
+
import styles from './styles.css';
|
|
10
|
+
|
|
11
|
+
export interface PaginationProps {
|
|
12
|
+
/** Additional class name for root class override */
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Callback fired when the page is changed.
|
|
16
|
+
*
|
|
17
|
+
* @param {object} event The event source of the callback.
|
|
18
|
+
* @param {number} page The page selected.
|
|
19
|
+
*/
|
|
20
|
+
onPageChange?: SaltPaginationProps['onPageChange'];
|
|
21
|
+
/** The current page */
|
|
22
|
+
page?: SaltPaginationProps['page'];
|
|
23
|
+
/** Number of pages */
|
|
24
|
+
pageCount: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Pagination: React.FC<PaginationProps> = ({
|
|
28
|
+
className,
|
|
29
|
+
pageCount,
|
|
30
|
+
page,
|
|
31
|
+
onPageChange
|
|
32
|
+
}) => (
|
|
33
|
+
<div className={classnames(styles.root, className)}>
|
|
34
|
+
<SaltPagination count={pageCount} onPageChange={onPageChange} page={page}>
|
|
35
|
+
<Paginator />
|
|
36
|
+
</SaltPagination>
|
|
37
|
+
</div>
|
|
38
|
+
);
|