From 79bf8c68308dfe7e8702a2b772f101f880c34c80 Mon Sep 17 00:00:00 2001 From: Arnau Sanchez Date: Fri, 20 Nov 2020 11:03:59 +0100 Subject: [PATCH 1/2] [ObjectsTable] Add standard className prop --- package.json | 3 ++- src/data-table/ObjectsTable.tsx | 19 +++++++++++-------- src/search-box/SearchBox.tsx | 4 ++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 67ec1dd..12f67f0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "git+https://github.com/eyeseetea/d2-ui-components.git" }, - "version": "2.2.0", + "version": "2.2.0-beta.3", "main": "index.js", "types": "index.d.ts", "peerDependencies": { @@ -27,6 +27,7 @@ "@dhis2/d2-i18n-extract": "^1.0.7", "@dhis2/d2-i18n-generate": "^1.0.18", "@material-ui/core": "4.9.4", + "@types/classnames": "^2.2.11", "@types/enzyme": "^3.1.17", "@types/jest": "^24.0.3", "@types/lodash": "^4.14.144", diff --git a/src/data-table/ObjectsTable.tsx b/src/data-table/ObjectsTable.tsx index 882cf63..f72669b 100644 --- a/src/data-table/ObjectsTable.tsx +++ b/src/data-table/ObjectsTable.tsx @@ -1,5 +1,6 @@ import React, { useState, ReactNode, MouseEvent, useCallback, useMemo } from "react"; import _ from "lodash"; +import classnames from "classnames"; import { createStyles, makeStyles, Theme } from "@material-ui/core/styles"; import DetailsIcon from "@material-ui/icons/Details"; import { SearchBox } from ".."; @@ -35,6 +36,7 @@ export interface ObjectsTableProps extends DataTableP searchBoxColumns?: (keyof T)[]; onActionButtonClick?(event: MouseEvent): void; actionButtonLabel?: ReactNode; + className?: string; } export function ObjectsTable(props: ObjectsTableProps) { @@ -52,6 +54,7 @@ export function ObjectsTable(props: Obj sideComponents: parentSideComponents, resetKey = "", childrenKeys = [], + className, ...rest } = props; const classes = useStyles(); @@ -96,13 +99,13 @@ export function ObjectsTable(props: Obj () => ( {showSearchBox && ( -
- -
+ )} {parentFilterComponents}
@@ -140,7 +143,7 @@ export function ObjectsTable(props: Obj : parentRows; return ( -
+
= ({ hintText = i18n.t("Search by name"), onChange, debounce: debounceTime = 400, + className, }) => { const [stateValue, updateStateValue] = useState(value); useEffect(() => updateStateValue(value), [value]); @@ -47,6 +50,7 @@ export const SearchBox: React.FC = ({ onChange={onKeyUp} placeholder={hintText} data-test="search" + className={className} /> ); }; From 3f0284cd616683c2e62a0c4dd1aefac9175cf19b Mon Sep 17 00:00:00 2001 From: Adrian Quintana Date: Tue, 15 Dec 2020 01:15:56 +0000 Subject: [PATCH 2/2] bump version and yarn.lock --- package.json | 2 +- yarn.lock | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 12f67f0..ad3eed4 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "git+https://github.com/eyeseetea/d2-ui-components.git" }, - "version": "2.2.0-beta.3", + "version": "2.3.0", "main": "index.js", "types": "index.d.ts", "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 4b2b95a..4e6c94b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1223,6 +1223,11 @@ dependencies: "@types/node" "*" +"@types/classnames@^2.2.11": + version "2.2.11" + resolved "https://registry.yarnpkg.com/@types/classnames/-/classnames-2.2.11.tgz#2521cc86f69d15c5b90664e4829d84566052c1cf" + integrity sha512-2koNhpWm3DgWRp5tpkiJ8JGc1xTn2q0l+jUNUE7oMKXUf5NpI9AIdC4kbjGNFBdHtcxBD18LAksoudAVhFKCjw== + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"