From 86d75a5b074c910ff67ad78c37ed484d4074827c Mon Sep 17 00:00:00 2001 From: Hrusikesh Panda Date: Thu, 9 Jan 2020 19:11:33 -0500 Subject: [PATCH 1/2] chore: Ignore mac crap --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f5c581e6..359f5895 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ dist # Webstorm cache .idea /webpack-stats.json + +# Mac crap +.DS_Store From 65c97273f45329f985b5522493d39322553a1a90 Mon Sep 17 00:00:00 2001 From: Hrusikesh Panda Date: Thu, 9 Jan 2020 21:20:39 -0500 Subject: [PATCH 2/2] feat: Reduce bundle size by removing classnames --- package.json | 1 - src/index.js | 17 +++++++---------- src/input/index.js | 17 +++++++++-------- src/tag/index.js | 9 +++------ src/tree-node/index.js | 35 ++++++++++++++++------------------- src/tree-node/node-label.js | 8 ++------ src/tree-node/toggle.js | 6 +----- src/trigger/index.js | 23 ++++++++++------------- yarn.lock | 2 +- 9 files changed, 49 insertions(+), 69 deletions(-) diff --git a/package.json b/package.json index e5384126..2daeb90d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ ], "dependencies": { "array.partial": "^1.0.5", - "classnames": "^2.2.6", "react-infinite-scroll-component": "^4.0.2" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index 65866816..be2c8979 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,6 @@ * license MIT * see https://github.com/dowjones/react-dropdown-tree-select */ -import cn from 'classnames/bind' import PropTypes from 'prop-types' import React, { Component } from 'react' @@ -17,11 +16,9 @@ import Tree from './tree' import TreeManager from './tree-manager' import keyboardNavigation from './tree-manager/keyboardNavigation' -import styles from './index.css' +import './index.css' import { getAriaLabel } from './a11y' -const cx = cn.bind(styles) - class DropdownTreeSelect extends Component { static propTypes = { data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, @@ -286,17 +283,17 @@ class DropdownTreeSelect extends Component { return (
{ this.node = node }} >
tags.map(tag => { const { _id, label, tagClassName, dataset } = tag return ( -
  • +
  • +
      {getTags(tags, onTagRemove, readOnly, disabled, texts.labelRemove)} -
    • +
    • `${id}_tag` @@ -44,11 +41,11 @@ class Tag extends PureComponent { const tagId = getTagId(id) const buttonId = `${id}_button` - const className = cx('tag-remove', { readOnly }, { disabled }) + const className = ['tag-remove', readOnly && 'readOnly', disabled && 'disabled'].filter(Boolean).join(' ') const isDisabled = readOnly || disabled return ( - + {label}