From 77fcbca04d9aebed34f96991bd40616aac40c747 Mon Sep 17 00:00:00 2001 From: Matt Lein Date: Mon, 11 Jun 2018 14:18:41 -0500 Subject: [PATCH] pass data-* aria-* and role props --- components/_util/getDataAttributes.ts | 8 ++++++++ package.json | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 components/_util/getDataAttributes.ts diff --git a/components/_util/getDataAttributes.ts b/components/_util/getDataAttributes.ts new file mode 100644 index 0000000000..23fd9fe31d --- /dev/null +++ b/components/_util/getDataAttributes.ts @@ -0,0 +1,8 @@ +export default function getDataAttributes(props: any) { + return Object.keys(props).reduce((prev: any, key: string) => { + if (key.substr(0, 5) === 'data-') { + prev[key] = props[key]; + } + return prev; + }, {}); +} diff --git a/package.json b/package.json index d9aa7db821..c5925e96af 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "react-lifecycles-compat": "^3.0.4", "react-slick": "~0.23.1", "shallowequal": "^1.0.1", + "tslint": "^5.10.0", "warning": "~4.0.1" }, "devDependencies": { @@ -168,6 +169,7 @@ "scrollama": "^1.4.1", "stylelint": "9.3.0", "stylelint-config-standard": "^18.0.0", + "ts-jest": "^22.4.6", "typescript": "~2.9.1", "unified": "^7.0.0", "values.js": "^1.0.3",