@redocly/theme 0.18.1 → 0.18.3-patch.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/I18n/LanguagePicker.d.ts +7 -2
- package/lib/I18n/LanguagePicker.js +11 -3
- package/lib/I18n/index.d.ts +1 -0
- package/lib/I18n/index.js +15 -0
- package/lib/I18n/styledVariables.d.ts +1 -0
- package/lib/I18n/styledVariables.js +39 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +2 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/lib/components/Breadcrumbs/index.d.ts +1 -0
- package/lib/components/Breadcrumbs/index.js +1 -0
- package/lib/components/Breadcrumbs/styledVariables.d.ts +1 -0
- package/lib/components/Breadcrumbs/styledVariables.js +19 -0
- package/lib/components/Button/Button.d.ts +6 -3
- package/lib/components/Button/Button.js +40 -42
- package/lib/components/Button/index.d.ts +1 -0
- package/lib/components/Button/index.js +1 -0
- package/lib/components/Button/styledVariables.d.ts +1 -0
- package/lib/components/Button/styledVariables.js +94 -0
- package/lib/components/Catalog/Catalog.d.ts +1 -0
- package/lib/components/Catalog/Catalog.js +99 -96
- package/lib/components/Catalog/CatalogCard.js +61 -56
- package/lib/components/Catalog/index.d.ts +4 -3
- package/lib/components/Catalog/index.js +4 -3
- package/lib/components/Catalog/styledVariables.d.ts +1 -0
- package/lib/components/Catalog/styledVariables.js +94 -0
- package/lib/components/CodeBlock/CodeBlockContainer.js +35 -8
- package/lib/components/CodeBlock/CodeBlockControlButton.d.ts +3 -4
- package/lib/components/CodeBlock/CodeBlockControlButton.js +5 -19
- package/lib/components/CodeBlock/CodeBlockControls.js +8 -5
- package/lib/components/CodeBlock/index.d.ts +1 -0
- package/lib/components/CodeBlock/index.js +1 -0
- package/lib/components/CodeBlock/styledVariables.d.ts +1 -0
- package/lib/components/CodeBlock/styledVariables.js +90 -0
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +0 -1
- package/lib/components/Dropdown/Dropdown.d.ts +7 -2
- package/lib/components/Dropdown/Dropdown.js +6 -4
- package/lib/components/Dropdown/index.d.ts +1 -0
- package/lib/components/Dropdown/index.js +1 -0
- package/lib/components/Dropdown/styledVariables.d.ts +1 -0
- package/lib/components/Dropdown/styledVariables.js +30 -0
- package/lib/components/Feedback/Reasons.js +1 -1
- package/lib/components/Feedback/Thumbs.js +4 -4
- package/lib/components/Filter/Filter.js +101 -78
- package/lib/components/Filter/FilterContent.d.ts +11 -0
- package/lib/components/Filter/FilterContent.js +50 -0
- package/lib/components/Filter/FilterPopover.d.ts +11 -0
- package/lib/components/Filter/FilterPopover.js +99 -0
- package/lib/components/Filter/FilterTag.d.ts +7 -0
- package/lib/components/Filter/FilterTag.js +33 -0
- package/lib/components/Filter/FilterTags.d.ts +7 -0
- package/lib/components/Filter/FilterTags.js +29 -0
- package/lib/components/Filter/index.d.ts +2 -0
- package/lib/components/Filter/index.js +2 -0
- package/lib/components/Filter/styledVariables.d.ts +1 -0
- package/lib/components/Filter/styledVariables.js +112 -0
- package/lib/components/Footer/CustomFooterNavItem.js +1 -1
- package/lib/components/Footer/Footer.d.ts +4 -3
- package/lib/components/Footer/Footer.js +27 -10
- package/lib/components/Footer/FooterColumn.d.ts +3 -3
- package/lib/components/Footer/FooterColumn.js +53 -63
- package/lib/components/Footer/FooterColumns.js +6 -4
- package/lib/components/Footer/FooterCopyright.js +11 -6
- package/lib/components/Footer/index.d.ts +1 -0
- package/lib/components/Footer/index.js +1 -0
- package/lib/components/Footer/styledVariables.d.ts +1 -0
- package/lib/components/Footer/styledVariables.js +61 -0
- package/lib/components/Image/Image.d.ts +9 -0
- package/lib/components/Image/Image.js +31 -0
- package/lib/components/Image/index.d.ts +1 -0
- package/lib/components/{Tags → Image}/index.js +1 -1
- package/lib/components/JsonViewer/JsonViewer.js +2 -2
- package/lib/components/Markdown/MarkdownWrapper.js +2 -4
- package/lib/components/Markdown/Mermaid.js +1 -1
- package/lib/components/Markdown/index.d.ts +1 -0
- package/lib/components/Markdown/index.js +1 -0
- package/lib/components/Markdown/styledVariables.d.ts +2 -0
- package/lib/components/Markdown/styledVariables.js +221 -0
- package/lib/components/Menu/Menu.js +5 -7
- package/lib/components/Menu/MenuGroup.js +12 -7
- package/lib/components/Menu/MenuItemLabel.js +7 -13
- package/lib/components/Menu/MobileMenu.js +20 -25
- package/lib/components/Menu/MobileMenuGroup.js +1 -1
- package/lib/components/Menu/index.d.ts +1 -0
- package/lib/components/Menu/index.js +1 -0
- package/lib/components/Menu/styledVariables.d.ts +2 -0
- package/lib/components/Menu/styledVariables.js +90 -0
- package/lib/components/Navbar/Navbar.js +10 -11
- package/lib/components/Navbar/NavbarItem.d.ts +1 -1
- package/lib/components/Navbar/NavbarItem.js +5 -3
- package/lib/components/Navbar/NavbarMenu.js +2 -2
- package/lib/components/Navbar/index.d.ts +1 -0
- package/lib/components/Navbar/index.js +1 -0
- package/lib/components/Navbar/styledVariables.d.ts +1 -0
- package/lib/components/Navbar/styledVariables.js +40 -0
- package/lib/components/NavbarLogo/NavbarLogo.d.ts +4 -1
- package/lib/components/NavbarLogo/NavbarLogo.js +13 -5
- package/lib/components/OpenApiDocs/DevOnboardingTryItSecurity.js +2 -2
- package/lib/components/OpenApiDocs/Dropdown.js +3 -3
- package/lib/components/Panel/PanelHeader.js +1 -0
- package/lib/components/Panel/PanelHeaderTitle.js +0 -4
- package/lib/components/Panel/index.d.ts +1 -0
- package/lib/components/Panel/index.js +1 -0
- package/lib/components/Panel/styledVariables.d.ts +2 -0
- package/lib/components/Panel/styledVariables.js +489 -0
- package/lib/components/Product/index.d.ts +1 -0
- package/lib/components/Product/index.js +1 -0
- package/lib/components/Product/styledVariables.d.ts +2 -0
- package/lib/components/Product/styledVariables.js +41 -0
- package/lib/components/Profile/LoginLink.js +1 -2
- package/lib/components/{Navbar → Profile}/MobileUserProfile.js +3 -22
- package/lib/components/Profile/Profile.js +3 -22
- package/lib/components/Profile/UserProfile.js +21 -9
- package/lib/components/Profile/UserProfileData.d.ts +9 -0
- package/lib/components/Profile/UserProfileData.js +35 -0
- package/lib/components/Profile/index.d.ts +1 -0
- package/lib/components/Profile/index.js +15 -0
- package/lib/components/Profile/styledVariables.d.ts +2 -0
- package/lib/components/Profile/styledVariables.js +55 -0
- package/lib/components/Search/CancelSearch.js +2 -14
- package/lib/components/Search/ProductTag.js +7 -7
- package/lib/components/Search/RecentSearches.js +5 -5
- package/lib/components/Search/Search.js +10 -4
- package/lib/components/Search/SearchIcon.js +2 -2
- package/lib/components/Search/SearchItem.js +14 -17
- package/lib/components/Search/SearchTrigger.js +4 -5
- package/lib/components/Search/ShortcutKey.js +1 -5
- package/lib/components/Search/SuggestedPages.js +3 -3
- package/lib/components/Search/index.d.ts +1 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Search/styledVariables.d.ts +1 -0
- package/lib/components/Search/styledVariables.js +98 -0
- package/lib/components/Select/Select.d.ts +10 -3
- package/lib/components/Select/Select.js +9 -6
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/index.js +1 -0
- package/lib/components/Select/styledVariables.d.ts +1 -0
- package/lib/components/Select/styledVariables.js +33 -0
- package/lib/components/Separator/SeparatorItem.js +7 -5
- package/lib/components/Sidebar/ApiCallItem.d.ts +2 -6
- package/lib/components/Sidebar/ApiCallItem.js +13 -11
- package/lib/components/Sidebar/FooterWrapper.js +3 -4
- package/lib/components/Sidebar/HeaderWrapper.js +2 -2
- package/lib/components/Sidebar/VersionPicker.d.ts +1 -1
- package/lib/components/Sidebar/index.d.ts +1 -0
- package/lib/components/Sidebar/index.js +1 -0
- package/lib/components/Sidebar/styledVariables.d.ts +2 -0
- package/lib/components/Sidebar/styledVariables.js +210 -0
- package/lib/components/SidebarActions/CollapseSidebarButton.js +37 -1
- package/lib/components/SidebarActions/styled.js +16 -14
- package/lib/components/TableOfContent/TableOfContent.js +2 -3
- package/lib/components/TableOfContent/index.d.ts +1 -0
- package/lib/components/TableOfContent/index.js +1 -0
- package/lib/components/TableOfContent/styledVariables.d.ts +1 -0
- package/lib/components/TableOfContent/styledVariables.js +46 -0
- package/lib/components/Tabs/Tab.js +1 -1
- package/lib/components/Tabs/Tabs.d.ts +1 -0
- package/lib/components/Tabs/Tabs.js +4 -4
- package/lib/components/Tag/Tag.d.ts +16 -0
- package/lib/components/Tag/Tag.js +39 -0
- package/lib/components/Tag/index.d.ts +2 -0
- package/lib/components/Tag/index.js +19 -0
- package/lib/components/Tag/styledVariables.d.ts +1 -0
- package/lib/components/Tag/styledVariables.js +130 -0
- package/lib/components/Tiles/TileText.js +1 -1
- package/lib/components/Tooltip/index.d.ts +1 -0
- package/lib/components/Tooltip/index.js +1 -0
- package/lib/components/Tooltip/styledVariables.d.ts +1 -0
- package/lib/components/Tooltip/styledVariables.js +21 -0
- package/lib/components/Typography/Typography.js +1 -1
- package/lib/components/index.d.ts +1 -2
- package/lib/components/index.js +1 -2
- package/lib/config.d.ts +8 -2
- package/lib/config.js +2 -1
- package/lib/globalStyle.js +597 -1967
- package/lib/icons/ArrowIcon/ArrowIcon.js +1 -1
- package/lib/icons/CheckboxIcon/CheckboxIcon.d.ts +6 -0
- package/lib/icons/CheckboxIcon/CheckboxIcon.js +28 -0
- package/lib/icons/CheckboxIcon/index.d.ts +1 -0
- package/lib/icons/CheckboxIcon/index.js +6 -0
- package/lib/icons/CollapseIcon/CollapseIcon.d.ts +1 -1
- package/lib/icons/CollapseIcon/CollapseIcon.js +5 -5
- package/lib/icons/ColorModeIcon/ColorModeIcon.js +1 -1
- package/lib/icons/CopyIcon/CopyIcon.d.ts +1 -2
- package/lib/icons/CopyIcon/CopyIcon.js +4 -4
- package/lib/icons/DeselectIcon/DeselectIcon.d.ts +1 -1
- package/lib/icons/DeselectIcon/DeselectIcon.js +5 -5
- package/lib/icons/ErrorIcon/ErrorIcon.d.ts +4 -0
- package/lib/icons/ErrorIcon/ErrorIcon.js +14 -0
- package/lib/icons/ErrorIcon/index.d.ts +1 -0
- package/lib/{components/OperationBadge → icons/ErrorIcon}/index.js +1 -1
- package/lib/icons/ExpandIcon/ExpandIcon.d.ts +1 -2
- package/lib/icons/ExpandIcon/ExpandIcon.js +5 -5
- package/lib/icons/FileIcon/FileIcon.d.ts +1 -2
- package/lib/icons/FileIcon/FileIcon.js +2 -2
- package/lib/icons/LanguageIcon/LanguageIcon.d.ts +4 -0
- package/lib/icons/LanguageIcon/LanguageIcon.js +14 -0
- package/lib/icons/LanguageIcon/index.d.ts +1 -0
- package/lib/icons/LanguageIcon/index.js +18 -0
- package/lib/icons/PlusIcon/PlusIcon.d.ts +5 -0
- package/lib/icons/PlusIcon/PlusIcon.js +16 -0
- package/lib/icons/PlusIcon/index.d.ts +1 -0
- package/lib/icons/PlusIcon/index.js +18 -0
- package/lib/icons/PointingArrowIcon/PointingArrowIcon.d.ts +4 -0
- package/lib/icons/PointingArrowIcon/PointingArrowIcon.js +15 -0
- package/lib/icons/PointingArrowIcon/index.d.ts +1 -0
- package/lib/icons/PointingArrowIcon/index.js +18 -0
- package/lib/icons/ReportIcon/ReportIcon.d.ts +1 -2
- package/lib/icons/ReportIcon/ReportIcon.js +3 -3
- package/lib/icons/SelectIcon/SelectIcon.d.ts +1 -2
- package/lib/icons/SelectIcon/SelectIcon.js +5 -5
- package/lib/icons/index.d.ts +4 -0
- package/lib/icons/index.js +4 -0
- package/lib/layouts/Forbidden.js +4 -0
- package/lib/layouts/NotFound.js +4 -0
- package/lib/mocks/telemetry.d.ts +2 -0
- package/lib/mocks/telemetry.js +7 -0
- package/lib/types/portal/src/shared/types/nav.d.ts +5 -0
- package/lib/ui/Burger.js +1 -1
- package/lib/ui/Dropdown.js +7 -7
- package/lib/ui/Jumbotron.js +1 -1
- package/lib/ui/darkColors.js +216 -84
- package/package.json +3 -2
- package/src/I18n/LanguagePicker.tsx +29 -4
- package/src/I18n/index.ts +1 -0
- package/src/I18n/styledVariables.ts +36 -0
- package/src/components/Breadcrumbs/Breadcrumb.tsx +2 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Breadcrumbs/index.ts +1 -0
- package/src/components/Breadcrumbs/styledVariables.ts +16 -0
- package/src/components/Button/Button.tsx +52 -48
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/styledVariables.ts +91 -0
- package/src/components/Catalog/Catalog.tsx +127 -115
- package/src/components/Catalog/CatalogCard.tsx +74 -59
- package/src/components/Catalog/index.ts +4 -0
- package/src/components/Catalog/styledVariables.ts +91 -0
- package/src/components/CodeBlock/CodeBlockContainer.tsx +14 -7
- package/src/components/CodeBlock/CodeBlockControlButton.tsx +6 -19
- package/src/components/CodeBlock/CodeBlockControls.tsx +8 -5
- package/src/components/CodeBlock/index.ts +1 -0
- package/src/components/CodeBlock/styledVariables.ts +87 -0
- package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +0 -1
- package/src/components/Dropdown/Dropdown.tsx +10 -4
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Dropdown/styledVariables.ts +27 -0
- package/src/components/Feedback/Reasons.tsx +1 -1
- package/src/components/Feedback/Thumbs.tsx +4 -4
- package/src/components/Filter/Filter.tsx +127 -94
- package/src/components/Filter/FilterContent.tsx +75 -0
- package/src/components/Filter/FilterPopover.tsx +132 -0
- package/src/components/Filter/FilterTag.tsx +37 -0
- package/src/components/Filter/FilterTags.tsx +39 -0
- package/src/components/Filter/index.ts +2 -0
- package/src/components/Filter/styledVariables.ts +109 -0
- package/src/components/Footer/CustomFooterNavItem.tsx +1 -1
- package/src/components/Footer/Footer.tsx +32 -10
- package/src/components/Footer/FooterColumn.tsx +79 -62
- package/src/components/Footer/FooterColumns.tsx +6 -4
- package/src/components/Footer/FooterCopyright.tsx +13 -7
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Footer/styledVariables.ts +58 -0
- package/src/components/Image/Image.tsx +47 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/JsonViewer/JsonViewer.tsx +2 -2
- package/src/components/Markdown/MarkdownWrapper.tsx +2 -4
- package/src/components/Markdown/Mermaid.tsx +1 -1
- package/src/components/Markdown/index.ts +1 -0
- package/src/components/Markdown/styledVariables.ts +219 -0
- package/src/components/Menu/Menu.tsx +5 -7
- package/src/components/Menu/MenuGroup.tsx +15 -7
- package/src/components/Menu/MenuItemLabel.tsx +7 -13
- package/src/components/Menu/MobileMenu.tsx +20 -25
- package/src/components/Menu/MobileMenuGroup.tsx +1 -1
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Menu/styledVariables.ts +88 -0
- package/src/components/Navbar/Navbar.tsx +10 -11
- package/src/components/Navbar/NavbarItem.tsx +6 -3
- package/src/components/Navbar/NavbarMenu.tsx +2 -2
- package/src/components/Navbar/index.ts +1 -0
- package/src/components/Navbar/styledVariables.ts +37 -0
- package/src/components/NavbarLogo/NavbarLogo.tsx +14 -10
- package/src/components/OpenApiDocs/DevOnboardingTryItSecurity.tsx +1 -2
- package/src/components/OpenApiDocs/Dropdown.tsx +3 -3
- package/src/components/Panel/PanelHeader.ts +1 -0
- package/src/components/Panel/PanelHeaderTitle.ts +0 -4
- package/src/components/Panel/index.ts +1 -0
- package/src/components/Panel/styledVariables.ts +487 -0
- package/src/components/Product/index.ts +1 -0
- package/src/components/Product/styledVariables.ts +39 -0
- package/src/components/Profile/LoginLink.tsx +1 -2
- package/src/components/{Navbar → Profile}/MobileUserProfile.tsx +3 -27
- package/src/components/Profile/Profile.tsx +1 -24
- package/src/components/Profile/UserProfile.tsx +20 -8
- package/src/components/Profile/UserProfileData.tsx +40 -0
- package/src/components/Profile/index.ts +1 -0
- package/src/components/Profile/styledVariables.ts +53 -0
- package/src/components/Search/CancelSearch.tsx +2 -15
- package/src/components/Search/ProductTag.tsx +7 -7
- package/src/components/Search/RecentSearches.tsx +5 -5
- package/src/components/Search/Search.tsx +14 -4
- package/src/components/Search/SearchIcon.tsx +10 -5
- package/src/components/Search/SearchItem.tsx +26 -31
- package/src/components/Search/SearchTrigger.tsx +4 -5
- package/src/components/Search/ShortcutKey.tsx +1 -5
- package/src/components/Search/SuggestedPages.tsx +3 -3
- package/src/components/Search/index.ts +1 -0
- package/src/components/Search/styledVariables.ts +95 -0
- package/src/components/Select/Select.tsx +20 -7
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/styledVariables.ts +30 -0
- package/src/components/Separator/SeparatorItem.tsx +7 -5
- package/src/components/Sidebar/ApiCallItem.tsx +13 -11
- package/src/components/Sidebar/FooterWrapper.tsx +3 -4
- package/src/components/Sidebar/HeaderWrapper.tsx +2 -2
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/Sidebar/styledVariables.ts +208 -0
- package/src/components/SidebarActions/CollapseSidebarButton.tsx +18 -2
- package/src/components/SidebarActions/styled.tsx +16 -23
- package/src/components/TableOfContent/TableOfContent.tsx +2 -3
- package/src/components/TableOfContent/index.ts +1 -0
- package/src/components/TableOfContent/styledVariables.ts +43 -0
- package/src/components/Tabs/Tab.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +12 -5
- package/src/components/Tag/Tag.tsx +62 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/Tag/styledVariables.ts +127 -0
- package/src/components/Tiles/TileText.tsx +1 -1
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/styledVariables.ts +18 -0
- package/src/components/Typography/Typography.ts +1 -1
- package/src/components/index.ts +1 -2
- package/src/config.ts +2 -1
- package/src/globalStyle.ts +591 -1979
- package/src/icons/ArrowIcon/ArrowIcon.tsx +1 -1
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +64 -0
- package/src/icons/CheckboxIcon/index.ts +1 -0
- package/src/icons/CollapseIcon/CollapseIcon.tsx +5 -5
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +1 -1
- package/src/icons/CopyIcon/CopyIcon.tsx +4 -5
- package/src/icons/DeselectIcon/DeselectIcon.tsx +5 -5
- package/src/icons/ErrorIcon/ErrorIcon.tsx +15 -0
- package/src/icons/ErrorIcon/index.ts +1 -0
- package/src/icons/ExpandIcon/ExpandIcon.tsx +5 -6
- package/src/icons/FileIcon/FileIcon.tsx +2 -3
- package/src/icons/LanguageIcon/LanguageIcon.tsx +15 -0
- package/src/icons/LanguageIcon/index.ts +1 -0
- package/src/icons/PlusIcon/PlusIcon.tsx +19 -0
- package/src/icons/PlusIcon/index.ts +1 -0
- package/src/icons/PointingArrowIcon/PointingArrowIcon.tsx +16 -0
- package/src/icons/PointingArrowIcon/index.ts +1 -0
- package/src/icons/ReportIcon/ReportIcon.tsx +3 -4
- package/src/icons/SelectIcon/SelectIcon.tsx +5 -6
- package/src/icons/index.ts +4 -0
- package/src/layouts/Forbidden.tsx +4 -0
- package/src/layouts/NotFound.tsx +4 -0
- package/src/mocks/telemetry.ts +5 -0
- package/src/types/portal/src/shared/types/nav.ts +5 -0
- package/src/ui/Burger.tsx +1 -1
- package/src/ui/Dropdown.tsx +7 -7
- package/src/ui/Jumbotron.tsx +1 -1
- package/src/ui/darkColors.tsx +216 -84
- package/lib/components/OperationBadge/OperationBadge.d.ts +0 -6
- package/lib/components/OperationBadge/OperationBadge.js +0 -68
- package/lib/components/OperationBadge/index.d.ts +0 -1
- package/lib/components/Tags/Tags.d.ts +0 -5
- package/lib/components/Tags/Tags.js +0 -32
- package/lib/components/Tags/index.d.ts +0 -1
- package/src/components/Catalog/index.tsx +0 -3
- package/src/components/OperationBadge/OperationBadge.ts +0 -62
- package/src/components/OperationBadge/index.ts +0 -1
- package/src/components/Tags/Tags.tsx +0 -36
- package/src/components/Tags/index.ts +0 -1
- /package/lib/components/{Navbar → Profile}/MobileUserProfile.d.ts +0 -0
|
@@ -2,9 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { DatePicker } from 'react-date-picker';
|
|
4
4
|
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
|
|
5
7
|
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
6
|
-
import { Checkbox } from '@theme/ui/Checkbox';
|
|
7
8
|
import { useTranslate } from '@portal/hooks';
|
|
9
|
+
import { CheckboxIcon } from '@theme/icons';
|
|
10
|
+
import { Select } from '@theme/components/Select';
|
|
8
11
|
|
|
9
12
|
export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions: any } }) {
|
|
10
13
|
const { translate } = useTranslate();
|
|
@@ -14,32 +17,57 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
if (!filter.parentUsed) return null;
|
|
20
|
+
|
|
21
|
+
let selectOptions: { value: string; component: React.ReactNode }[] = [];
|
|
22
|
+
if (filter.type === 'select') {
|
|
23
|
+
const defaultOptionCount = filter.filteredOptions.reduce(
|
|
24
|
+
(acc, option) => acc + option.count,
|
|
25
|
+
0,
|
|
26
|
+
);
|
|
27
|
+
selectOptions = [
|
|
28
|
+
{
|
|
29
|
+
value: '',
|
|
30
|
+
component: (
|
|
31
|
+
<FilterOption key="all" role="link" onClick={() => filter.selectOption('')}>
|
|
32
|
+
<FilterOptionLabel>{translate(translationKeys.selectAll, 'All')}</FilterOptionLabel>
|
|
33
|
+
<FilterOptionCount>{defaultOptionCount}</FilterOptionCount>
|
|
34
|
+
</FilterOption>
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
selectOptions.push(
|
|
39
|
+
...filter.filteredOptions.map((option) => ({
|
|
40
|
+
value: option.value,
|
|
41
|
+
component: (
|
|
42
|
+
<FilterOption
|
|
43
|
+
key={option.value}
|
|
44
|
+
role="link"
|
|
45
|
+
onClick={() => filter.selectOption(option.value)}
|
|
46
|
+
>
|
|
47
|
+
<FilterOptionLabel>{translate(option.value)}</FilterOptionLabel>
|
|
48
|
+
<FilterOptionCount>{option.count}</FilterOptionCount>
|
|
49
|
+
</FilterOption>
|
|
50
|
+
),
|
|
51
|
+
})),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let selectedOptionComponent: ReactNode;
|
|
56
|
+
if (filter.type === 'select') {
|
|
57
|
+
const selectedOption = (filter.selectedOptions as Set<any>).values().next()?.value;
|
|
58
|
+
selectedOptionComponent =
|
|
59
|
+
selectOptions.find((option) => option.value === selectedOption)?.component ||
|
|
60
|
+
selectOptions[0].component;
|
|
61
|
+
}
|
|
62
|
+
|
|
17
63
|
return (
|
|
18
64
|
<FilterGroup key={filter.property + filter.title}>
|
|
19
|
-
<FilterTitle>
|
|
20
|
-
{translate(filter.titleTranslationKey, filter.title)}{' '}
|
|
21
|
-
{filter.selectedOptions?.size ? (
|
|
22
|
-
<a data-translation-key={translationKeys.clear} onClick={() => filter.selectOption('')}>
|
|
23
|
-
{translate(translationKeys.clear, 'Clear')}
|
|
24
|
-
</a>
|
|
25
|
-
) : null}
|
|
26
|
-
</FilterTitle>
|
|
65
|
+
<FilterTitle>{translate(filter.titleTranslationKey, filter.title)} </FilterTitle>
|
|
27
66
|
{filter.type === 'select' ? (
|
|
28
67
|
<StyledSelect
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<option key="none" value="" data-translation-key={translationKeys.selectAll}>
|
|
33
|
-
{translate(translationKeys.selectAll, 'All')}
|
|
34
|
-
</option>
|
|
35
|
-
{filter.filteredOptions.map((value: any) => {
|
|
36
|
-
return (
|
|
37
|
-
<option key={value.value} value={value.value}>
|
|
38
|
-
{translate(value.value)} ({value.count})
|
|
39
|
-
</option>
|
|
40
|
-
);
|
|
41
|
-
})}
|
|
42
|
-
</StyledSelect>
|
|
68
|
+
selected={selectedOptionComponent}
|
|
69
|
+
options={selectOptions.map((option) => option.component)}
|
|
70
|
+
/>
|
|
43
71
|
) : filter.type === 'date-range' ? (
|
|
44
72
|
<>
|
|
45
73
|
<DatePickerWrapper>
|
|
@@ -89,17 +117,11 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
89
117
|
filter.filteredOptions.map((value: any) => {
|
|
90
118
|
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
91
119
|
return (
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
onChange={() => filter.toggleOption(value.value)}
|
|
98
|
-
/>
|
|
99
|
-
<label htmlFor={id}>
|
|
100
|
-
{translate(value.value)} ({value.count})
|
|
101
|
-
</label>
|
|
102
|
-
</FilterValue>
|
|
120
|
+
<FilterOption key={id} role="link" onClick={() => filter.toggleOption(value.value)}>
|
|
121
|
+
<CheckboxIcon checked={filter.selectedOptions.has(value.value)} />
|
|
122
|
+
<FilterOptionLabel>{translate(value.value)}</FilterOptionLabel>
|
|
123
|
+
<FilterOptionCount>{value.count}</FilterOptionCount>
|
|
124
|
+
</FilterOption>
|
|
103
125
|
);
|
|
104
126
|
})
|
|
105
127
|
)}
|
|
@@ -108,61 +130,65 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
108
130
|
}
|
|
109
131
|
|
|
110
132
|
const FilterGroup = styled.div`
|
|
111
|
-
padding:
|
|
112
|
-
|
|
133
|
+
padding: var(--filter-group-padding);
|
|
134
|
+
`;
|
|
113
135
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
136
|
+
const FilterOptionLabel = styled.label`
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
font-size: var(--filter-option-label-font-size);
|
|
139
|
+
font-weight: var(--filter-option-label-font-weight);
|
|
140
|
+
margin: var(--filter-option-label-margin);
|
|
141
|
+
color: var(--filter-option-label-color);
|
|
117
142
|
`;
|
|
118
143
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
const FilterOptionCount = styled.label`
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
height: var(--filter-option-count-height);
|
|
149
|
+
color: var(--filter-option-count-color);
|
|
150
|
+
text-align: center;
|
|
151
|
+
font-size: var(--filter-option-count-font-size);
|
|
152
|
+
font-weight: var(--filter-option-count-font-weight);
|
|
153
|
+
padding: var(--filter-option-count-padding);
|
|
154
|
+
border-radius: var(--filter-option-count-border-radius);
|
|
155
|
+
border: 1px solid var(--filter-option-count-border-color);
|
|
156
|
+
background-color: var(--filter-option-count-background-color);
|
|
157
|
+
`;
|
|
124
158
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
159
|
+
const FilterTitle = styled.h4`
|
|
160
|
+
font-weight: var(--filter-title-font-weight);
|
|
161
|
+
font-size: var(--filter-title-font-size);
|
|
162
|
+
margin: var(--filter-title-margin);
|
|
129
163
|
`;
|
|
130
164
|
|
|
131
|
-
const
|
|
132
|
-
display:
|
|
165
|
+
const FilterOption = styled.label`
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
133
168
|
cursor: pointer;
|
|
134
|
-
font-
|
|
135
|
-
|
|
169
|
+
font-weight: var(--filter-option-font-weight);
|
|
170
|
+
font-size: var(--filter-option-font-size);
|
|
171
|
+
margin: var(--filter-option-margin);
|
|
136
172
|
|
|
137
173
|
input {
|
|
138
174
|
cursor: pointer;
|
|
139
175
|
}
|
|
140
176
|
`;
|
|
141
177
|
|
|
142
|
-
const StyledSelect = styled
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
border-radius: var(--
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
display: inline-block;
|
|
157
|
-
text-align: left;
|
|
158
|
-
appearance: none;
|
|
159
|
-
|
|
160
|
-
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
161
|
-
background-repeat: no-repeat;
|
|
162
|
-
background-position: right 10px center;
|
|
163
|
-
background-size: 1em;
|
|
164
|
-
width: 100%;
|
|
165
|
-
padding-right: 25px;
|
|
178
|
+
const StyledSelect = styled(Select)`
|
|
179
|
+
min-height: var(--filter-select-min-height);
|
|
180
|
+
color: var(--filter-select-color);
|
|
181
|
+
border: 1px solid var(--filter-select-border-color);
|
|
182
|
+
border-radius: var(--filter-select-border-radius);
|
|
183
|
+
padding: var(--filter-select-padding);
|
|
184
|
+
|
|
185
|
+
:hover {
|
|
186
|
+
border-color: var(--filter-select-hover-border-color);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
${FilterOption} {
|
|
190
|
+
margin: var(--filter-select-option-margin);
|
|
191
|
+
}
|
|
166
192
|
`;
|
|
167
193
|
|
|
168
194
|
// TODO: import from portal
|
|
@@ -171,15 +197,16 @@ function slug(str: string): string {
|
|
|
171
197
|
}
|
|
172
198
|
|
|
173
199
|
const DatePickerWrapper = styled.div`
|
|
200
|
+
color: var(--filter-date-picker-color);
|
|
174
201
|
display: flex;
|
|
175
202
|
flex-direction: row;
|
|
176
|
-
margin
|
|
203
|
+
margin: var(--filter-date-picker-margin);
|
|
177
204
|
|
|
178
205
|
align-items: center;
|
|
179
|
-
gap:
|
|
206
|
+
gap: var(--filter-date-picker-gap);
|
|
180
207
|
|
|
181
208
|
> span {
|
|
182
|
-
width:
|
|
209
|
+
width: var(--filter-date-picker-width);
|
|
183
210
|
}
|
|
184
211
|
|
|
185
212
|
.react-date-picker {
|
|
@@ -187,35 +214,41 @@ const DatePickerWrapper = styled.div`
|
|
|
187
214
|
}
|
|
188
215
|
|
|
189
216
|
.react-calendar__tile--now {
|
|
190
|
-
background:
|
|
191
|
-
color:
|
|
217
|
+
background: var(--filter-date-picker-tile-background);
|
|
218
|
+
color: var(--filter-date-picker-tile-color);
|
|
192
219
|
|
|
193
220
|
&:enabled:hover,
|
|
194
221
|
&:enabled:focus {
|
|
195
|
-
background:
|
|
196
|
-
color:
|
|
222
|
+
background: var(--filter-date-picker-tile-hover-background);
|
|
223
|
+
color: var(--filter-date-picker-tile-hover-color);
|
|
197
224
|
}
|
|
198
225
|
}
|
|
199
226
|
|
|
200
|
-
.react-date-picker__inputGroup__input
|
|
201
|
-
|
|
227
|
+
.react-date-picker__inputGroup__input {
|
|
228
|
+
width: var(--filter-date-picker-input-width);
|
|
229
|
+
|
|
230
|
+
&:invalid {
|
|
231
|
+
background: var(--filter-date-picker-invalid-input-background);
|
|
232
|
+
}
|
|
202
233
|
}
|
|
203
234
|
|
|
204
235
|
.react-date-picker__button {
|
|
205
|
-
padding:
|
|
236
|
+
padding: var(--filter-date-picker-button-padding);
|
|
237
|
+
|
|
206
238
|
svg {
|
|
207
|
-
|
|
239
|
+
stroke: var(--filter-date-picker-icon-stroke);
|
|
240
|
+
width: var(--filter-date-picker-icon-width);
|
|
208
241
|
}
|
|
209
|
-
}
|
|
210
242
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
padding: var(--input-padding);
|
|
243
|
+
&:enabled:hover .react-date-picker__button__icon {
|
|
244
|
+
stroke: var(--filter-date-picker-hover-icon-stroke);
|
|
245
|
+
}
|
|
215
246
|
}
|
|
216
247
|
|
|
217
|
-
.react-date-
|
|
218
|
-
|
|
248
|
+
.react-date-picker__wrapper {
|
|
249
|
+
border: 1px solid var(--filter-date-picker-wrapper-border-color);
|
|
250
|
+
border-radius: var(--filter-date-picker-wrapper-radius);
|
|
251
|
+
padding: var(--filter-date-picker-wrapper-padding);
|
|
219
252
|
}
|
|
220
253
|
`;
|
|
221
254
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button } from '@theme';
|
|
4
|
+
|
|
5
|
+
import { useTranslate } from '@portal/hooks';
|
|
6
|
+
import { FilterControls } from '@theme/components/Catalog';
|
|
7
|
+
import { Filter } from '@theme/components/Filter/index';
|
|
8
|
+
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
9
|
+
import { StyledInput } from '@theme/components/Filter/FilterPopover';
|
|
10
|
+
|
|
11
|
+
interface FilterContentProps {
|
|
12
|
+
setFilterTerm: (value: string) => void;
|
|
13
|
+
filters: ResolvedFilter[];
|
|
14
|
+
filterTerm: string;
|
|
15
|
+
isMobile: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function FilterContent({
|
|
19
|
+
setFilterTerm,
|
|
20
|
+
filters,
|
|
21
|
+
filterTerm,
|
|
22
|
+
isMobile,
|
|
23
|
+
}: FilterContentProps) {
|
|
24
|
+
const { translate } = useTranslate();
|
|
25
|
+
const translationKeys = {
|
|
26
|
+
placeholder: 'theme.catalog.filters.placeholder',
|
|
27
|
+
clearAll: 'theme.catalog.filters.clearAll',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleClearAll = () => {
|
|
31
|
+
filters.forEach((filter) => filter.selectOption(''));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FilterContentWrapper isMobile={isMobile}>
|
|
36
|
+
<FilterControls>
|
|
37
|
+
<StyledInput
|
|
38
|
+
placeholder={translate(translationKeys.placeholder, 'Type to filter...')}
|
|
39
|
+
value={filterTerm}
|
|
40
|
+
onChange={(e) => setFilterTerm(e.target.value)}
|
|
41
|
+
/>
|
|
42
|
+
</FilterControls>
|
|
43
|
+
<FilterItems>
|
|
44
|
+
{filters.map((filter, idx) => (
|
|
45
|
+
<Filter filter={filter} key={filter.property + '-' + idx} />
|
|
46
|
+
))}
|
|
47
|
+
</FilterItems>
|
|
48
|
+
<Button size="small" onClick={handleClearAll}>
|
|
49
|
+
{translate(translationKeys.placeholder, 'Clear all filters')}
|
|
50
|
+
</Button>
|
|
51
|
+
</FilterContentWrapper>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const FilterContentWrapper = styled.div<{ isMobile?: boolean }>`
|
|
56
|
+
display: none;
|
|
57
|
+
|
|
58
|
+
${Button} {
|
|
59
|
+
width: var(--filter-content-clear-button-width);
|
|
60
|
+
margin: var(--filter-content-clear-button-margin);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
${({ theme, isMobile }) => !isMobile && theme.mediaQueries.small} {
|
|
64
|
+
display: block;
|
|
65
|
+
border-right: 1px solid var(--filter-content-border-color);
|
|
66
|
+
|
|
67
|
+
${FilterControls} {
|
|
68
|
+
background: var(--filter-controls-background-color);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export const FilterItems = styled.div`
|
|
74
|
+
padding: var(--filter-content-items-padding);
|
|
75
|
+
`;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Filter, FilterControls } from '@theme';
|
|
4
|
+
|
|
5
|
+
import { FilterContent, FilterItems } from '@theme/components/Filter/FilterContent';
|
|
6
|
+
import { useTranslate } from '@portal/hooks';
|
|
7
|
+
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
8
|
+
|
|
9
|
+
interface FilterPopoverProps {
|
|
10
|
+
setIsAddingFilter: (value: boolean) => void;
|
|
11
|
+
setFilterTerm: (value: string) => void;
|
|
12
|
+
filters: ResolvedFilter[];
|
|
13
|
+
filterTerm: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function FilterPopover({
|
|
17
|
+
setIsAddingFilter,
|
|
18
|
+
setFilterTerm,
|
|
19
|
+
filters,
|
|
20
|
+
filterTerm,
|
|
21
|
+
}: FilterPopoverProps) {
|
|
22
|
+
const translationKeys = {
|
|
23
|
+
placeholder: 'theme.catalog.filters.placeholder',
|
|
24
|
+
done: 'theme.catalog.filters.done',
|
|
25
|
+
};
|
|
26
|
+
const { translate } = useTranslate();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<FilterPopoverWrapper>
|
|
30
|
+
<FilterPopoverHeader>
|
|
31
|
+
<FilterPopoverHeaderLabel>Add Filter</FilterPopoverHeaderLabel>
|
|
32
|
+
<FilterPopoverHeaderButton onClick={() => setIsAddingFilter(false)}>
|
|
33
|
+
{translate(translationKeys.placeholder, 'Done')}
|
|
34
|
+
</FilterPopoverHeaderButton>
|
|
35
|
+
</FilterPopoverHeader>
|
|
36
|
+
<FilterContent
|
|
37
|
+
setFilterTerm={setFilterTerm}
|
|
38
|
+
filters={filters}
|
|
39
|
+
filterTerm={filterTerm}
|
|
40
|
+
isMobile
|
|
41
|
+
/>
|
|
42
|
+
<FilterControls>
|
|
43
|
+
<StyledInput
|
|
44
|
+
placeholder={translate(translationKeys.placeholder, 'Type to filter...')}
|
|
45
|
+
value={filterTerm}
|
|
46
|
+
onChange={(e) => setFilterTerm(e.target.value)}
|
|
47
|
+
/>
|
|
48
|
+
</FilterControls>
|
|
49
|
+
<FilterItems>
|
|
50
|
+
{filters.map((filter, idx) => (
|
|
51
|
+
<Filter filter={filter} key={filter.property + '-' + idx} />
|
|
52
|
+
))}
|
|
53
|
+
</FilterItems>
|
|
54
|
+
</FilterPopoverWrapper>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const FilterPopoverWrapper = styled.aside<{ isActiveInMobileMode?: boolean }>`
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
z-index: var(--z-index-popover);
|
|
62
|
+
height: 100vh;
|
|
63
|
+
overflow: auto;
|
|
64
|
+
transition: height 0.2s ease-in-out;
|
|
65
|
+
width: 100%;
|
|
66
|
+
background-color: var(--filter-popover-background-color);
|
|
67
|
+
display: block;
|
|
68
|
+
|
|
69
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const FilterPopoverHeader = styled.div`
|
|
75
|
+
height: var(--navbar-height);
|
|
76
|
+
padding: var(--filter-popover-header-padding);
|
|
77
|
+
display: grid;
|
|
78
|
+
align-items: center;
|
|
79
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
80
|
+
border-bottom: 1px solid var(--filter-popover-header-border-color);
|
|
81
|
+
background-color: var(--filter-popover-header-background-color);
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
const FilterPopoverHeaderLabel = styled.div`
|
|
85
|
+
color: var(--filter-popover-header-label-color);
|
|
86
|
+
justify-self: center;
|
|
87
|
+
grid-column-start: 2;
|
|
88
|
+
font-size: var(--filter-popover-header-label-font-size);
|
|
89
|
+
font-weight: var(--filter-popover-header-label-font-weight);
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
const FilterPopoverHeaderButton = styled.div`
|
|
93
|
+
color: var(--filter-popover-header-button-color);
|
|
94
|
+
justify-self: end;
|
|
95
|
+
font-size: var(--filter-popover-header-button-font-size);
|
|
96
|
+
font-weight: var(--filter-popover-header-button-font-weight);
|
|
97
|
+
height: var(--filter-popover-header-button-height);
|
|
98
|
+
line-height: var(--filter-popover-header-button-height);
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
export const StyledInput = styled.input`
|
|
102
|
+
border: var(--filter-input-border);
|
|
103
|
+
min-width: var(--filter-input-min-width);
|
|
104
|
+
width: 100%;
|
|
105
|
+
outline: none;
|
|
106
|
+
padding: var(--filter-input-padding);
|
|
107
|
+
border-radius: var(--filter-input-border-radius);
|
|
108
|
+
background-color: var(--filter-input-background-color);
|
|
109
|
+
color: var(--filter-input-color);
|
|
110
|
+
font-family: var(--filter-input-font-family);
|
|
111
|
+
font-size: var(--filter-input-font-size);
|
|
112
|
+
line-height: var(--filter-input-line-height);
|
|
113
|
+
|
|
114
|
+
&::placeholder {
|
|
115
|
+
opacity: var(--filter-input-placeholder-opacity);
|
|
116
|
+
color: var(--filter-input-placeholder-color);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
color: var(--filter-input-hover-color);
|
|
121
|
+
border: var(--filter-input-hover-border);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&:focus {
|
|
125
|
+
color: var(--filter-input-focus-color);
|
|
126
|
+
border: var(--filter-input-focus-border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:-webkit-autofill {
|
|
130
|
+
background-color: var(--filter-input-background-color);
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { ClearIcon } from '@theme/components/Search/ClearIcon';
|
|
5
|
+
|
|
6
|
+
interface FilterTagProps {
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FilterTag({ label, onClick }: FilterTagProps) {
|
|
12
|
+
return (
|
|
13
|
+
<TagWrapper onClick={onClick}>
|
|
14
|
+
<TagLabel>{label}</TagLabel>
|
|
15
|
+
<ClearIcon />
|
|
16
|
+
</TagWrapper>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TagWrapper = styled.div`
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
color: var(--filter-tag-color);
|
|
26
|
+
border-radius: var(--filter-tag-border-radius);
|
|
27
|
+
border: 1px solid var(--filter-tag-border-color);
|
|
28
|
+
background-color: var(--filter-tag-background-color);
|
|
29
|
+
padding: var(--filter-tag-padding);
|
|
30
|
+
font-size: var(--filter-tag-font-size);
|
|
31
|
+
font-weight: var(--filter-tag-font-weight);
|
|
32
|
+
margin: var(--filter-tag-margin);
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const TagLabel = styled.div`
|
|
36
|
+
margin: var(--filter-tag-label-margin);
|
|
37
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
5
|
+
import { FilterTag } from '@theme/components/Filter/FilterTag';
|
|
6
|
+
|
|
7
|
+
interface FilterTagsProps {
|
|
8
|
+
filters: ResolvedFilter[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FilterTags({ filters }: FilterTagsProps) {
|
|
12
|
+
const selectedFilters: { filter: ResolvedFilter; selectedOption: string }[] = [];
|
|
13
|
+
filters.forEach((filter: ResolvedFilter & { selectedOptions: any }) => {
|
|
14
|
+
if (filter.selectedOptions?.size) {
|
|
15
|
+
for (let selectedOption of filter.selectedOptions) {
|
|
16
|
+
selectedFilters.push({
|
|
17
|
+
filter,
|
|
18
|
+
selectedOption,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<FilterTagsWrapper>
|
|
26
|
+
{selectedFilters.map(({ filter, selectedOption }) => (
|
|
27
|
+
<FilterTag
|
|
28
|
+
key={`${filter.title}: ${selectedOption}`}
|
|
29
|
+
onClick={() => filter.toggleOption(selectedOption)}
|
|
30
|
+
label={`${filter.title}: ${selectedOption}`}
|
|
31
|
+
/>
|
|
32
|
+
))}
|
|
33
|
+
</FilterTagsWrapper>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const FilterTagsWrapper = styled.div`
|
|
38
|
+
display: flex;
|
|
39
|
+
`;
|