Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use change event instead of click
dominik-zeglen48f0b42dfa0d
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsxindex f53623ff09..232509160f 100644--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx@@ -144,10 +144,7 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(category.id);- event.stopPropagation();- }}+ onChange={() => toggle(category.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsxindex 3f6622e1e0..ce8b61550d 100644--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx@@ -116,10 +116,7 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(collection.id);- event.stopPropagation();- }}+ onChange={() => toggle(collection.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsxindex 5731eb3814..fc8a420df8 100644--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx@@ -132,10 +132,7 @@ const CollectionProducts = withStyles(styles, { name: "CollectionProducts" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(product.id);- event.stopPropagation();- }}+ onChange={() => toggle(product.id)}/></TableCell><TableCellAvatardiff --git a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsxindex e11ec990ef..a82a63d7c7 100644--- a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx+++ b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx@@ -9,6 +9,7 @@ import {} from "@material-ui/core/styles";import classNames from "classnames";import * as React from "react";+import { stopPropagation } from "../../misc";export type CheckboxProps = Omit<MuiCheckboxProps,@@ -19,7 +20,7 @@ export type CheckboxProps = Omit<| "classes"| "onChange"> & {- onChange?: () => void;+ onChange?: (event: React.ChangeEvent<any>) => void;};const styles = (theme: Theme) =>@@ -97,7 +98,7 @@ const Checkbox = withStyles(styles, { name: "Checkbox" })(centerRippleclassName={classNames(classes.root, className)}disabled={disabled}- onClick={() => inputRef.current.click()}+ onClick={stopPropagation(() => inputRef.current.click())}><inputclassName={classNames(classes.box, {diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsxindex 2128078563..4b760b0d56 100644--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx@@ -136,10 +136,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- event.stopPropagation();- toggle(product.id);- }}+ onChange={() => toggle(product.id)}/></TableCell><TableCellAvatardiff --git a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx b/saleor/static/dashboard-next/components/TableHead/TableHead.tsxindex 5591605e64..5e65c6a5d5 100644--- a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx+++ b/saleor/static/dashboard-next/components/TableHead/TableHead.tsx@@ -101,10 +101,7 @@ const TableHead = withStyles(styles, {})}checked={selected === 0 ? false : true}disabled={disabled}- onClick={event => {- toggleAll(items, selected);- event.stopPropagation();- }}+ onChange={() => toggleAll(items, selected)}/>) : null}</TableCell>diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsxindex a86ca4b410..2dfb350218 100644--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx@@ -112,10 +112,7 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(customer.id);- event.stopPropagation();- }}+ onChange={() => toggle(customer.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsxindex 3f74665607..a608481f51 100644--- a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx+++ b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx@@ -130,10 +130,7 @@ const DiscountCategories = withStyles(styles, {<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(category.id);- event.stopPropagation();- }}+ onChange={() => toggle(category.id)}/></TableCell><TableCell>diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsxindex 5ac7d8b74b..ec1f7900ec 100644--- a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx+++ b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx@@ -125,10 +125,7 @@ const DiscountCollections = withStyles(styles, {<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(collection.id);- event.stopPropagation();- }}+ onChange={() => toggle(collection.id)}/></TableCell><TableCell>diff --git a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsxindex 7ebd7bd657..3df6478f19 100644--- a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx+++ b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx@@ -139,10 +139,7 @@ const DiscountProducts = withStyles(styles, {<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(product.id);- event.stopPropagation();- }}+ onChange={() => toggle(product.id)}/></TableCell><TableCellAvatardiff --git a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsxindex 9a5c14fe6e..80a174b366 100644--- a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx+++ b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx@@ -138,10 +138,7 @@ const SaleList = withStyles(styles, {<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(sale.id);- event.stopPropagation();- }}+ onChange={() => toggle(sale.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsxindex 8358552d2b..f18df8d5a2 100644--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx@@ -163,10 +163,7 @@ const VoucherList = withStyles(styles, {<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(voucher.id);- event.stopPropagation();- }}+ onChange={() => toggle(voucher.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsxindex 1b0b278714..51e6fc570d 100644--- a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx+++ b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx@@ -105,8 +105,9 @@ const MenuList = withStyles(styles, { name: "MenuList" })(><TableCell padding="checkbox"><Checkbox+ checked={isSelected}disabled={disabled}- onClick={stopPropagation(() => toggle(menu.id))}+ onChange={() => toggle(menu.id)}/></TableCell><TableCell className={classes.colTitle}>diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsxindex a7feaaaf55..b0c25797da 100644--- a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx@@ -134,10 +134,7 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(order.id);- event.stopPropagation();- }}+ onChange={() => toggle(order.id)}/></TableCell><TableCell padding="dense" className={classes.colNumber}>diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsxindex 7770828331..67b0e01b51 100644--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx@@ -147,10 +147,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(order.id);- event.stopPropagation();- }}+ onChange={() => toggle(order.id)}/></TableCell><TableCell padding="dense" className={classes.colNumber}>diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsxindex 90b66809e2..ad77e8d68c 100644--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx@@ -109,10 +109,7 @@ const PageList = withStyles(styles, { name: "PageList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(page.id);- event.stopPropagation();- }}+ onChange={() => toggle(page.id)}/></TableCell><TableCell className={classes.colTitle}>diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsxindex 4067a80e6d..6ad65504f0 100644--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx@@ -114,10 +114,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(productType.id);- event.stopPropagation();- }}+ onChange={() => toggle(productType.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsxindex ec6d271454..389834ac22 100644--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx@@ -145,10 +145,7 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(variant.id);- event.stopPropagation();- }}+ onChange={() => toggle(variant.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsxindex 01bcd3c432..29974968eb 100644--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx@@ -127,10 +127,7 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(<Checkboxchecked={isSelected}disabled={disabled}- onClick={event => {- toggle(shippingZone.id);- event.stopPropagation();- }}+ onChange={() => toggle(shippingZone.id)}/></TableCell><TableCell className={classes.colName}>diff --git a/saleor/static/dashboard-next/storybook/stories/components/Checkbox.tsx b/saleor/static/dashboard-next/storybook/stories/components/Checkbox.tsxindex f1929833ae..b3d813f4f1 100644--- a/saleor/static/dashboard-next/storybook/stories/components/Checkbox.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/Checkbox.tsx@@ -25,7 +25,7 @@ storiesOf("Generics / Checkbox", module){...props}checked={data.data}// Omit second argument- onClick={() =>+ onChange={() =>change({target: {name: "data",