Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make it visual
dominik-zeglen41b28798cc52
diff --git a/package-lock.json b/package-lock.jsonindex 64e2779134..d294e70d2a 100644--- a/package-lock.json+++ b/package-lock.json@@ -4467,6 +4467,77 @@}}},+ "@material-ui/styles": {+ "version": "3.0.0-alpha.10",+ "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-3.0.0-alpha.10.tgz",+ "integrity": "sha512-qJ5eiupBPRCNlMCDZ2G5h8auBtBtm8uT/oCUAJ/FqhO5oC7POLmmvDN1Cq1cgAmqQnaL6uN5mAM1Gc90GpKr9A==",+ "requires": {+ "@babel/runtime": "^7.2.0",+ "@emotion/hash": "^0.7.1",+ "@material-ui/utils": "^3.0.0-alpha.2",+ "classnames": "^2.2.5",+ "deepmerge": "^3.0.0",+ "hoist-non-react-statics": "^3.2.1",+ "jss": "^10.0.0-alpha.7",+ "jss-plugin-camel-case": "^10.0.0-alpha.7",+ "jss-plugin-default-unit": "^10.0.0-alpha.7",+ "jss-plugin-global": "^10.0.0-alpha.7",+ "jss-plugin-nested": "^10.0.0-alpha.7",+ "jss-plugin-props-sort": "^10.0.0-alpha.7",+ "jss-plugin-rule-value-function": "^10.0.0-alpha.7",+ "jss-plugin-vendor-prefixer": "^10.0.0-alpha.7",+ "prop-types": "^15.6.0",+ "warning": "^4.0.1"+ },+ "dependencies": {+ "@emotion/hash": {+ "version": "0.7.1",+ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.7.1.tgz",+ "integrity": "sha512-OYpa/Sg+2GDX+jibUfpZVn1YqSVRpYmTLF2eyAfrFTIJSbwyIrc+YscayoykvaOME/wV4BV0Sa0yqdMrgse6mA=="+ },+ "hoist-non-react-statics": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz",+ "integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==",+ "requires": {+ "react-is": "^16.7.0"+ }+ },+ "jss": {+ "version": "10.0.0-alpha.16",+ "resolved": "https://registry.npmjs.org/jss/-/jss-10.0.0-alpha.16.tgz",+ "integrity": "sha512-HmKNNnr82TR5jkWjBcbrx/uim2ief588pWp7zsf4GQpL125zRkEaWYL1SXv5bR6bBvAoTtvJsTAOxDIlLxUNZg==",+ "requires": {+ "@babel/runtime": "^7.3.1",+ "is-in-browser": "^1.1.3",+ "tiny-warning": "^1.0.2"+ },+ "dependencies": {+ "@babel/runtime": {+ "version": "7.4.5",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz",+ "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==",+ "requires": {+ "regenerator-runtime": "^0.13.2"+ }+ }+ }+ },+ "regenerator-runtime": {+ "version": "0.13.2",+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz",+ "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA=="+ },+ "warning": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",+ "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",+ "requires": {+ "loose-envify": "^1.0.0"+ }+ }+ }+ },"@material-ui/system": {"version": "3.0.0-alpha.2","resolved": "https://registry.npmjs.org/@material-ui/system/-/system-3.0.0-alpha.2.tgz",@@ -21705,6 +21776,91 @@"warning": "^3.0.0"}},+ "jss-plugin-camel-case": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.0.0-alpha.7.tgz",+ "integrity": "sha512-Bwrav1ZB0XywdJW6TaEuFhKe1ZpZvUlESh3jsFOvebA9aFTYNCkmHMEqjA5+u9VMxksl3u77nnZHtukpxkzrBA==",+ "requires": {+ "@babel/runtime": "^7.0.0",+ "hyphenate-style-name": "^1.0.2"+ }+ },+ "jss-plugin-default-unit": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.0.0-alpha.7.tgz",+ "integrity": "sha512-auuJUbQaWMxoHOVFPrfZNZpZm9ab8PZeDyvey8nMt2lbokkmZ53UyAnM/1kNsg5BdAXTItcLDxDB3I4gwNU84g==",+ "requires": {+ "@babel/runtime": "^7.0.0"+ }+ },+ "jss-plugin-global": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.0.0-alpha.7.tgz",+ "integrity": "sha512-OWeoW4szLDgRUKviST+xfilqa8O5uXJCW+O3YonheCRTRJg6rRzlE/b5pfYPoU9UtwvY9n7JvwBX5r3c1lMsEQ==",+ "requires": {+ "@babel/runtime": "^7.0.0"+ }+ },+ "jss-plugin-nested": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.0.0-alpha.7.tgz",+ "integrity": "sha512-wsRzuIZXAc6WMjc61mREW9cUrDxgSI7dK/fx5c7a06IDUfSn+83NJ30J/RB4oBnbQW9SijV/muujz7IJqpn9Gw==",+ "requires": {+ "@babel/runtime": "^7.0.0",+ "tiny-warning": "^1.0.2"+ }+ },+ "jss-plugin-props-sort": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.0.0-alpha.7.tgz",+ "integrity": "sha512-KXOCaHUk1+KXqE0z3q66/w1fDoy+VsZvI77gLxOqTsTrvIKFLX0jarwXogW3CDlaPQQFTZ6JykJJXtPRTBlstA==",+ "requires": {+ "@babel/runtime": "^7.0.0"+ }+ },+ "jss-plugin-rule-value-function": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.0.0-alpha.7.tgz",+ "integrity": "sha512-ett83hvIM69/LknmrWndrrdiDlfLfP+rneU5qP7gTOWJ7g1P9GuEL1Tc4CWdZUWBX+T58tgIBP0V1pzWCkP0QA==",+ "requires": {+ "@babel/runtime": "^7.0.0"+ }+ },+ "jss-plugin-vendor-prefixer": {+ "version": "10.0.0-alpha.7",+ "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.0.0-alpha.7.tgz",+ "integrity": "sha512-YbIVgqq+dLimOBOEYggho1Iuc0roz4PJSZYyaok9n8JnXVIqPnxYJbr8+bMbvzJ5CL3eeJij/e7L2IPCceRKrA==",+ "requires": {+ "@babel/runtime": "^7.0.0",+ "css-vendor": "^1.1.0"+ },+ "dependencies": {+ "css-vendor": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-1.2.1.tgz",+ "integrity": "sha512-ZpwiWxn5jWNJ7NF3DAb/Dc/+c2lRu+fnovej/adCv3VJsULJSjdXEpUwRcq4fnpAAh98Hi7b0GDnlyoNFcdv1g==",+ "requires": {+ "@babel/runtime": "^7.3.1",+ "is-in-browser": "^1.0.2"+ },+ "dependencies": {+ "@babel/runtime": {+ "version": "7.4.5",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz",+ "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==",+ "requires": {+ "regenerator-runtime": "^0.13.2"+ }+ }+ }+ },+ "regenerator-runtime": {+ "version": "0.13.2",+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz",+ "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA=="+ }+ }+ },"jss-preset-default": {"version": "4.5.0","resolved": "https://registry.npmjs.org/jss-preset-default/-/jss-preset-default-4.5.0.tgz",diff --git a/package.json b/package.jsonindex db238ee210..d2c005e1ed 100644--- a/package.json+++ b/package.json@@ -19,6 +19,7 @@"dependencies": {"@material-ui/core": "^3.9.3","@material-ui/icons": "^3.0.1",+ "@material-ui/styles": "^3.0.0-alpha.10","@types/classnames": "^2.2.6","@types/enzyme": "^3.1.15","@types/fuzzaldrin": "^2.1.1",diff --git a/saleor/static/dashboard-next/components/Filter/FilterContent.tsx b/saleor/static/dashboard-next/components/Filter/FilterContent.tsxindex 962761c112..3d13ff55de 100644--- a/saleor/static/dashboard-next/components/Filter/FilterContent.tsx+++ b/saleor/static/dashboard-next/components/Filter/FilterContent.tsx@@ -1,12 +1,7 @@import Button from "@material-ui/core/Button";-import {- createStyles,- Theme,- withStyles,- WithStyles-} from "@material-ui/core/styles";import * as React from "react";+import { makeStyles } from "@material-ui/styles";import i18n from "../../i18n";import { getMenuItemByValue, isLeaf, walkToRoot } from "../../utils/menu";import FormSpacer from "../FormSpacer";@@ -23,71 +18,90 @@ export interface FilterContentProps {onSubmit: (data: FilterContentSubmitData) => void;}-const styles = (theme: Theme) => createStyles({});-const FilterContent = withStyles(styles, { name: "FilterContent" })(- ({- classes,- filters,- onSubmit- }: FilterContentProps & WithStyles<typeof styles>) => {- const [menuValue, setMenuValue] = React.useState<string>("");- const [filterValue, setFilterValue] = React.useState<string | string[]>("");+function checkFilterValue(value: string | string[]): boolean {+ if (typeof value === "string") {+ return value !== "";+ }+ return value.every(v => !!v);+}++const useStyles = makeStyles({+ input: {+ padding: "20px 12px 17px"+ }+});++const FilterContent: React.FC<FilterContentProps> = ({ filters, onSubmit }) => {+ const [menuValue, setMenuValue] = React.useState<string>("");+ const [filterValue, setFilterValue] = React.useState<string | string[]>("");+ const classes = useStyles();- const activeMenu = menuValue- ? getMenuItemByValue(filters, menuValue)- : undefined;- const menus = menuValue- ? walkToRoot(filters, menuValue).slice(-1)- : undefined;+ const activeMenu = menuValue+ ? getMenuItemByValue(filters, menuValue)+ : undefined;+ const menus = menuValue+ ? walkToRoot(filters, menuValue).slice(-1)+ : undefined;- const onMenuChange = (event: React.ChangeEvent<any>) => {- setMenuValue(event.target.value);- setFilterValue("");- };+ const onMenuChange = (event: React.ChangeEvent<any>) => {+ setMenuValue(event.target.value);+ setFilterValue("");+ };- return (- <>- <SingleSelectField- choices={filters.map(filterItem => ({- label: filterItem.label,- value: filterItem.value- }))}- onChange={onMenuChange}- selectProps={{- placeholder: i18n.t("Select Filter...")- }}- value={menus ? menus[0].value : menuValue}- />- <FormSpacer />- {menus &&- menus.map((filterItem, filterItemIndex) => (+ return (+ <>+ <SingleSelectField+ choices={filters.map(filterItem => ({+ label: filterItem.label,+ value: filterItem.value+ }))}+ onChange={onMenuChange}+ selectProps={{+ classes: {+ selectMenu: classes.input+ }+ }}+ value={menus ? menus[0].value : menuValue}+ placeholder={i18n.t("Select Filter...")}+ />+ {menus &&+ menus.map(+ (filterItem, filterItemIndex) =>+ !isLeaf(filterItem) && (+ <>+ <FormSpacer />+ <SingleSelectField+ choices={filterItem.children.map(filterItem => ({+ label: filterItem.label,+ value: filterItem.value+ }))}+ onChange={onMenuChange}+ selectProps={{+ classes: {+ selectMenu: classes.input+ }+ }}+ value={+ filterItemIndex === menus.length - 1+ ? menuValue+ : menus[filterItemIndex - 1].label.toString()+ }+ placeholder={i18n.t("Select Filter...")}+ />+ </>+ )+ )}+ {activeMenu && isLeaf(activeMenu) && (+ <>+ <FormSpacer />+ <FilterElement+ filter={activeMenu}+ value={filterValue}+ onChange={value => setFilterValue(value)}+ />+ {checkFilterValue(filterValue) && (<>- <SingleSelectField- choices={filterItem.children.map(filterItem => ({- label: filterItem.label,- value: filterItem.value- }))}- onChange={onMenuChange}- selectProps={{- placeholder: i18n.t("Select Filter...")- }}- value={- filterItemIndex === menus.length - 1- ? menuValue- : menus[filterItemIndex - 1].label.toString()- }- /><FormSpacer />- </>- ))}- {activeMenu && isLeaf(activeMenu) && (- <>- <FilterElement- filter={activeMenu}- value={filterValue}- onChange={value => setFilterValue(value)}- />- {filterValue && (<Buttoncolor="primary"onClick={() =>@@ -99,12 +113,12 @@ const FilterContent = withStyles(styles, { name: "FilterContent" })(>{i18n.t("Add filter")}</Button>- )}- </>- )}- </>- );- }-);+ </>+ )}+ </>+ )}+ </>+ );+};FilterContent.displayName = "FilterContent";export default FilterContent;diff --git a/saleor/static/dashboard-next/components/Filter/FilterElement.tsx b/saleor/static/dashboard-next/components/Filter/FilterElement.tsxindex ac011fb126..8948444641 100644--- a/saleor/static/dashboard-next/components/Filter/FilterElement.tsx+++ b/saleor/static/dashboard-next/components/Filter/FilterElement.tsx@@ -1,7 +1,10 @@import TextField from "@material-ui/core/TextField";+import Typography from "@material-ui/core/Typography";+import { makeStyles } from "@material-ui/styles";import * as React from "react";import i18n from "../../i18n";+import Calendar from "../../icons/Calendar";import FormSpacer from "../FormSpacer";import SingleSelectField from "../SingleSelectField";import { FieldType, IFilterItem } from "./types";@@ -13,52 +16,105 @@ export interface FilterElementProps {onChange: (value: string | string[]) => void;}+const useStyles = makeStyles({+ calendar: {+ margin: 8+ },+ input: {+ padding: "20px 12px 17px"+ }+});++export interface FilterElementProps {+ className?: string;+ filter: IFilterItem;+ value: string | string[];+ onChange: (value: string | string[]) => void;+}+const FilterElement: React.FC<FilterElementProps> = ({className,filter,onChange,value}) => {+ const classes = useStyles();+if (filter.data.type === FieldType.date) {return (<TextFieldclassName={className}fullWidth- label={filter.label}type="date"onChange={event => onChange(event.target.value)}value={value}+ InputProps={{+ classes: {+ input: classes.input+ },+ startAdornment: <Calendar className={classes.calendar} />+ }}/>);} else if (filter.data.type === FieldType.rangeDate) {return (<>+ <Typography>{i18n.t("from")}</Typography><TextFieldclassName={className}fullWidth- label={i18n.t("From")}type="date"value={value[0]}onChange={event => onChange([event.target.value, value[1]])}+ InputProps={{+ startAdornment: <Calendar className={classes.calendar} />+ }}/><FormSpacer />+ <Typography>{i18n.t("to")}</Typography><TextFieldclassName={className}fullWidth- label={i18n.t("To")}type="date"value={value[1]}onChange={event => onChange([value[0], event.target.value])}+ InputProps={{+ startAdornment: <Calendar className={classes.calendar} />+ }}+ />+ </>+ );+ } else if (filter.data.type === FieldType.range) {+ return (+ <>+ <Typography>{i18n.t("from")}</Typography>+ <TextField+ className={className}+ fullWidth+ value={value[0]}+ onChange={event => onChange([event.target.value, value[1]])}+ type="number"+ />+ <FormSpacer />+ <Typography>{i18n.t("to")}</Typography>+ <TextField+ className={className}+ fullWidth+ value={value[1]}+ onChange={event => onChange([value[0], event.target.value])}+ type="number"/></>);} else if (filter.data.type === FieldType.select) {return (<SingleSelectField- choices={filter.children.map(filterItem => ({- label: filterItem.label,- value: filterItem.value+ choices={filter.data.options.map(option => ({+ ...option,+ value: option.value.toString()}))}+ value={value as string}+ placeholder={i18n.t("Select Filter...")}onChange={event => onChange(event.target.value)}/>);diff --git a/saleor/static/dashboard-next/components/Filter/types.ts b/saleor/static/dashboard-next/components/Filter/types.tsindex 449a9606b3..b2f21dd84b 100644--- a/saleor/static/dashboard-next/components/Filter/types.ts+++ b/saleor/static/dashboard-next/components/Filter/types.ts@@ -10,7 +10,13 @@ export enum FieldType {text}+export interface FilterChoice {+ label: string;+ value: string | boolean;+}+export interface FilterData {+ options?: FilterChoice[];type: FieldType;}diff --git a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsxindex f269b3a208..695c297840 100644--- a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx+++ b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx@@ -28,6 +28,7 @@ interface SingleSelectFieldProps extends WithStyles<typeof styles> {label?: string;name?: string;selectProps?: SelectProps;+ placeholder?: string;value?: string;onChange(event: any);}@@ -46,7 +47,8 @@ export const SingleSelectField = withStyles(styles, {onChange,name,hint,- selectProps+ selectProps,+ placeholder}: SingleSelectFieldProps) => {const choicesByKey: { [key: string]: string } =choices === undefined@@ -67,7 +69,7 @@ export const SingleSelectField = withStyles(styles, {variant="filled"fullWidthrenderValue={choiceValue =>- choiceValue ? choicesByKey[choiceValue.toString()] : ""+ choiceValue ? choicesByKey[choiceValue.toString()] : placeholder}value={value || ""}onChange={onChange}diff --git a/saleor/static/dashboard-next/components/TableFilter/FilterChips.tsx b/saleor/static/dashboard-next/components/TableFilter/FilterChips.tsxindex 6d94a08821..42cee20e0f 100644--- a/saleor/static/dashboard-next/components/TableFilter/FilterChips.tsx+++ b/saleor/static/dashboard-next/components/TableFilter/FilterChips.tsx@@ -1,100 +1,165 @@-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";+import ButtonBase from "@material-ui/core/ButtonBase";+import { Theme } from "@material-ui/core/styles";+import { fade } from "@material-ui/core/styles/colorManipulator";+import TextField, { TextFieldProps } from "@material-ui/core/TextField";import Typography from "@material-ui/core/Typography";-import AddIcon from "@material-ui/icons/Add";+import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown";import ClearIcon from "@material-ui/icons/Clear";+import { createStyles, makeStyles, useTheme } from "@material-ui/styles";import * as classNames from "classnames";import * as React from "react";import i18n from "../../i18n";+import Hr from "../Hr";export interface Filter {label: string;onClick: () => void;}-const styles = createStyles({- addFilterButtonPrimary: {- "&:hover": {- backgroundColor: "rgba(90, 179, 120, .25)"- },- backgroundColor: "#ffffff",- border: "2px dashed #5AB378",- width: "135px"+const useInputStyles = makeStyles({+ input: {+ padding: "10px 12px"},- addFilterButtonSecondary: {- "&:hover": {- backgroundColor: "rgba(3, 169, 244, .25)"- },- backgroundColor: "#ffffff",- border: "2px dashed #03A9F4",- width: "135px"- },- addFilterText: {- fontWeight: 600 as 600,- marginRight: "12px"- },- filterButton: {- alignItems: "center",- backgroundColor: "rgba(90, 179, 120, .25)",- borderRadius: "19px",- cursor: "pointer",- display: "flex",- height: "38px",- justifyContent: "space-around",- margin: "10px 0 0 12px",- minWidth: "160px",- padding: "0 8px 0 16px"- },- filterContainer: {- borderBottom: "1px solid #e8e8e8",- display: "flex",- flexWrap: "wrap",- paddingBottom: "10px",- paddingLeft: "12px"- },- filterIcon: {- color: "#616161",- height: "20px",- width: "20px"- },- filterText: {- fontWeight: 400 as 400,- marginRight: "12px"+ root: {+ flex: 1}});-interface FilterChipProps extends WithStyles<typeof styles> {+const Search: React.FC<TextFieldProps> = props => {+ const classes = useInputStyles();+ return (+ <TextField+ {...props}+ className={classes.root}+ inputProps={{+ className: classes.input+ }}+ />+ );+};++const useStyles = makeStyles(+ (theme: Theme) =>+ createStyles({+ actionContainer: {+ display: "flex",+ flexWrap: "wrap",+ padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`+ },+ addFilterButton: {+ "&$filterButton": {+ "&:hover, &:focus": {+ backgroundColor: fade(theme.palette.primary.main, 0.1)+ },+ backgroundColor: "#ffffff",+ border: `1px solid ${theme.palette.primary.main}`,+ cursor: "pointer",+ marginBottom: 0,+ marginRight: theme.spacing.unit * 2,+ marginTop: 0,+ transition: theme.transitions.duration.short + "ms"+ }+ },+ addFilterText: {+ color: theme.palette.primary.main,+ fontSize: 14,+ fontWeight: 600 as 600,+ marginRight: 4,+ textTransform: "uppercase"+ },+ filterButton: {+ alignItems: "center",+ backgroundColor: fade(theme.palette.primary.main, 0.6),+ borderRadius: "19px",+ display: "flex",+ height: "38px",+ justifyContent: "space-around",+ margin: `0 ${theme.spacing.unit * 2}px ${theme.spacing.unit}px`,+ marginLeft: 0,+ padding: "0 16px"+ },+ filterContainer: {+ borderBottom: "1px solid #e8e8e8",+ display: "flex",+ flexWrap: "wrap",+ marginTop: theme.spacing.unit,+ paddingBottom: theme.spacing.unit,+ paddingLeft: theme.spacing.unit * 3+ },+ filterIcon: {+ color: theme.palette.common.white,+ height: 16,+ width: 16+ },+ filterIconContainer: {+ WebkitAppearance: "none",+ background: "transparent",+ border: "none",+ borderRadius: "100%",+ cursor: "pointer",+ height: 32,+ marginRight: -13,+ padding: 8,+ width: 32+ },+ filterText: {+ color: theme.palette.common.white,+ fontSize: 12,+ fontWeight: 400 as 400+ }+ }),+ {+ name: "FilterChips"+ }+);++interface FilterChipProps {filtersList: Filter[];+ placeholder: string;}-export const FilterChips = withStyles(styles, { name: "FilterChips" })(- ({ classes, filtersList }: FilterChipProps) => (- <div className={classes.filterContainer}>- {filtersList.map(filter => (- <div- className={classes.filterButton}- onClick={filter.onClick}- key={filter.label}+export const FilterChips: React.FC<FilterChipProps> = ({+ filtersList,+ placeholder+}) => {+ const theme = useTheme();+ const classes = useStyles({ theme });++ return (+ <>+ <div className={classes.actionContainer}>+ <ButtonBase+ className={classNames(classes.filterButton, classes.addFilterButton)}>- <Typography className={classes.filterText}>{filter.label}</Typography>- <ClearIcon className={classes.filterIcon} />- </div>- ))}- <div- className={classNames({- [classes.filterButton]: true,- [filtersList.length > 0- ? classes.addFilterButtonPrimary- : classes.addFilterButtonSecondary]: true- })}- >- <AddIcon color={filtersList.length > 0 ? "primary" : "secondary"} />- <Typography className={classes.addFilterText}>- {i18n.t("Add Filter")}- </Typography>+ <Typography className={classes.addFilterText}>+ {i18n.t("Add Filter")}+ </Typography>+ <ArrowDropDownIcon color="primary" />+ </ButtonBase>+ <Search fullWidth placeholder={placeholder} /></div>- </div>- )-);+ {filtersList && filtersList.length > 0 ? (+ <div className={classes.filterContainer}>+ {filtersList.map(filter => (+ <div className={classes.filterButton} key={filter.label}>+ <Typography className={classes.filterText}>+ {filter.label}+ </Typography>+ <ButtonBase+ className={classes.filterIconContainer}+ onClick={filter.onClick}+ >+ <ClearIcon className={classes.filterIcon} />+ </ButtonBase>+ </div>+ ))}+ </div>+ ) : (+ <Hr />+ )}+ </>+ );+};export default FilterChips;diff --git a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsxindex f162d85b4e..71abbcc570 100644--- a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx+++ b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx@@ -1,4 +1,6 @@-import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";+// FIXME: https://github.com/mirumee/saleor/issues/4174+import OldMuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";+import MuiThemeProvider from "@material-ui/styles/ThemeProvider";import * as React from "react";import Baseline from "../../Baseline";@@ -82,10 +84,12 @@ const ThemeProvider: React.FC<ThemeProviderProps> = ({toggleTheme}}>- <MuiThemeProvider theme={createTheme(isDark ? dark : light)}>- <Baseline />- {children}- </MuiThemeProvider>+ <OldMuiThemeProvider theme={createTheme(isDark ? dark : light)}>+ <MuiThemeProvider theme={createTheme(isDark ? dark : light)}>+ <Baseline />+ {children}+ </MuiThemeProvider>+ </OldMuiThemeProvider></ThemeContext.Provider>);};diff --git a/saleor/static/dashboard-next/icons/Calendar.tsx b/saleor/static/dashboard-next/icons/Calendar.tsxnew file mode 100644index 0000000000..a67c5e60e5--- /dev/null+++ b/saleor/static/dashboard-next/icons/Calendar.tsx@@ -0,0 +1,28 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Calendar = createSvgIcon(+ <>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M5.00012 0V3H7.00012V0H5.00012ZM0.000244141 4.00049H22.0002V24.0005H0.000244141V4.00049ZM2.00024 6.00049V22.0005H20.0002V6.00049H2.00024ZM6.00024 10.0005H8.00024V12.0005H6.00024V10.0005ZM10 10.0005H12V12.0005H10V10.0005ZM16.0001 10.0005H14.0001V12.0005H16.0001V10.0005ZM6.00024 13.0005H8.00024V15.0005H6.00024V13.0005ZM12 13.0005H10V15.0005H12V13.0005ZM14.0001 13.0005H16.0001V15.0005H14.0001V13.0005ZM8.00024 16.0005H6.00024V18.0005H8.00024V16.0005ZM10 16.0005H12V18.0005H10V16.0005ZM16.0001 16.0005H14.0001V18.0005H16.0001V16.0005ZM10 3V0H12V3H10ZM15.0002 0V3H17.0002V0H15.0002Z"+ fill="url(#paint0_linear)"+ />+ <defs>+ <linearGradient+ id="paint0_linear"+ x1="0.000244141"+ y1="0"+ x2="25.8693"+ y2="25.7327"+ gradientUnits="userSpaceOnUse"+ >+ <stop stopColor="#13BEBB" />+ <stop offset="1" stopColor="#3EE7CD" />+ </linearGradient>+ </defs>+ </>+);+Calendar.displayName = "Calendar";+export default Calendar;diff --git a/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsxindex 6de5bd4052..dfb0b40a3b 100644--- a/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx+++ b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx@@ -48,9 +48,10 @@ const ProductListFilter: React.StatelessComponent<ProductListFilterProps> = ({/>)}</FilterTabs>- {currentTab === "custom" && filtersList && filtersList.length > 0 && (- <FilterChips filtersList={filtersList} />- )}+ <FilterChips+ filtersList={filtersList}+ placeholder={i18n.t("Search Products...")}+ /></>);ProductListFilter.displayName = "ProductListFilter";diff --git a/saleor/static/dashboard-next/storybook/stories/components/Filter.tsx b/saleor/static/dashboard-next/storybook/stories/components/Filter.tsxindex 58143d5820..c40078ff3a 100644--- a/saleor/static/dashboard-next/storybook/stories/components/Filter.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/Filter.tsx@@ -8,6 +8,48 @@ import Decorator from "../../Decorator";const props: FilterContentProps = {filters: [+ {+ children: [],+ data: {+ type: FieldType.text+ },+ label: "Category",+ value: "category"+ },+ {+ children: [],+ data: {+ type: FieldType.text+ },+ label: "Product Type",+ value: "product-type"+ },+ {+ children: [],+ data: {+ options: [+ {+ label: "Published",+ value: true+ },+ {+ label: "Hidden",+ value: false+ }+ ],+ type: FieldType.select+ },+ label: "Published",+ value: "published"+ },+ {+ children: [],+ data: {+ type: FieldType.range+ },+ label: "Stock",+ value: "stock"+ },{children: [{@@ -15,8 +57,8 @@ const props: FilterContentProps = {data: {type: FieldType.date},- label: "Exactly",- value: "date-exactly"+ label: "Equal to",+ value: "date-equal"},{children: [],@@ -59,7 +101,7 @@ const props: FilterContentProps = {value: "price"}],- onSubmit: data => console.log(data)+ onSubmit: () => undefined};storiesOf("Generics / Filter", module)diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsxindex 6c8e354ec6..3f7ea197c0 100644--- a/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx@@ -13,6 +13,54 @@ const products = categoryFixture(placeholderImage).products.edges.map();const filtersList: Filter[] = [+ {+ label: "Gardner-Schultz",+ onClick: () => undefined+ },+ {+ label: "Davis, Brown and Ray",+ onClick: () => undefined+ },+ {+ label: "Franklin Inc",+ onClick: () => undefined+ },+ {+ label: "Gardner-Schultz",+ onClick: () => undefined+ },+ {+ label: "Davis, Brown and Ray",+ onClick: () => undefined+ },+ {+ label: "Franklin Inc",+ onClick: () => undefined+ },+ {+ label: "Gardner-Schultz",+ onClick: () => undefined+ },+ {+ label: "Davis, Brown and Ray",+ onClick: () => undefined+ },+ {+ label: "Franklin Inc",+ onClick: () => undefined+ },+ {+ label: "Gardner-Schultz",+ onClick: () => undefined+ },+ {+ label: "Davis, Brown and Ray",+ onClick: () => undefined+ },+ {+ label: "Franklin Inc",+ onClick: () => undefined+ },{label: "Gardner-Schultz",onClick: () => undefined