react-styled-tree-checkbox

react-styled-tree-checkbox ============


Keywords
javascript, react, styled-components, tree, checkbox, css-modules, component, css, form, html, reactjs
License
Unlicense
Install
npm install react-styled-tree-checkbox@1.0.7

Documentation

react-styled-tree-checkbox

Up to date with react/react-dom 16.7.0 and styled-components 4.1.3

ATTENTION: Work in Progress (sorry about that!)

Installation

npm install react-styled-tree-checkbox --save

Demo

http://agutoli.github.io/react-styled-tree-checkbox/

Screenshot Example

CSS Vanilla Themes

/** Example css **/
.red-theme {
  --styled-input-checkbox-checkmark__border-color--after: red;
  --styled-input-checkbox-checkmark__border-color--checked-hover: red;
}

.blue-theme {
  --styled-input-checkbox-checkmark__border-color--after: blue;
  --styled-input-checkbox-checkmark__border-color--checked-hover: blue;
}

.green-theme {
  --styled-input-checkbox-checkmark__border-color--after: green;
  --styled-input-checkbox-checkmark__border-color--checked-hover: green;
}
<!-- JSX example -->
<div>
  <TreeCheckbox nodes={nodes} showToggleText={true} className="blue-theme" />
  <TreeCheckbox nodes={nodes} showToggleText={true} className="green-theme" />
  <TreeCheckbox nodes={nodes} showToggleText={true} className="red-theme" />
</div>

Example Usage

import React from 'react'
import TreeCheckbox from 'react-styled-tree-checkbox'

const nodes = [
  {
    "value": 11,
    "label": "Facebook",
    "icon": "<YourIcon/>",
    "children": [
      {
        "value": 111,
        "label": "Child node 1.1"
      },
      ...
    ]
  },
  ...
]

const YourReactApp = () => (
  <TreeCheckbox nodes={nodes} showToggleText={true} />
)

Available CSS variables

--styled-child-node-label__font-family: "Open Sans", Helvetica, Arial, sans-serif;
--styled-child-node-label__font-size: 14px;
--styled-child-node-label__line-height: 12px;
--styled-child-node-label__user-select: none;

--styled-child-node-wrapper__margin-bottom: 5px;
--styled-child-node-wrapper__margin-left: 4px;

--styled-children-node-wrapper__margin-bottom: 10px;
--styled-children-node-wrapper__margin-left: 20px;

--styled-collapse-expand-label__color: #3C5A96;
--styled-collapse-expand-label__font-family: "Open Sans", Helvetica, Arial, sans-serif;
--styled-collapse-expand-label__font-size: 12px;
--styled-collapse-expand-label__margin-left: 5px;
--styled-collapse-expand-label__width: 50px;

--styled-input-checkbox-checkmark__background-color: white;
--styled-input-checkbox-checkmark__background-color--checked: white;
--styled-input-checkbox-checkmark__background-color--hover: white;
--styled-input-checkbox-checkmark__border-color: #DFE3EE;
--styled-input-checkbox-checkmark__border-color--after: #3e8ab4;
--styled-input-checkbox-checkmark__border-color--checked: #CBCBCB;
--styled-input-checkbox-checkmark__border-color--checked-hover: #3e8ab4;
--styled-input-checkbox-checkmark__border-color--hover: #CBCBCB;
--styled-input-checkbox-checkmark__border-radius: 0;
--styled-input-checkbox-checkmark__border-style: solid;
--styled-input-checkbox-checkmark__border-style--after: solid;
--styled-input-checkbox-checkmark__border-width: 1px;
--styled-input-checkbox-checkmark__border-width--after: 0 2px 2px 0;
--styled-input-checkbox-checkmark__height: 14px;
--styled-input-checkbox-checkmark__height--after: 6px;
--styled-input-checkbox-checkmark__left: 0;
--styled-input-checkbox-checkmark__left--after: 5px;
--styled-input-checkbox-checkmark__top: 0;
--styled-input-checkbox-checkmark__top--after: 2px;
--styled-input-checkbox-checkmark__width: 14px;
--styled-input-checkbox-checkmark__width--after: 3px;

--styled-input-checkbox-wrapper__font-size: 22px;
--styled-input-checkbox-wrapper__margin-bottom: 16px;
--styled-input-checkbox-wrapper__padding-left: 24px;
--styled-input-checkbox-wrapper__user-select: none;

--styled-root-node-label-children-len__color: #ccc;
--styled-root-node-label-children-len__font-size: 12px;
--styled-root-node-label-children-len__font-weight: normal;

--styled-root-node-label__font-family: Tahoma, Helvetica, Arial, sans-serif;
--styled-root-node-label__font-size: 14px;
--styled-root-node-label__font-weight: normal;
--styled-root-node-label__line-height: 16px;

--styled-root-node-wrapper-svg__height: 18px;
--styled-root-node-wrapper-svg__width: 18px;

--styled-root-node-wrapper__margin-bottom: 12px;

--styled-tree-checkbox-wrapper__color: #999FAC;
--styled-tree-checkbox-wrapper__margin-bottom: 24px;
--styled-tree-checkbox-wrapper__margin-left: 22px;

License

The MIT License (MIT)

Copyright (c) 2017-2018 Bruno Agutoli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.