Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ewc-lib/ewc-icon-button

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ewc-lib/ewc-icon-button

![Screenshot](./screenshot.png)

  • 0.1.0-alpha
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
20
decreased by-61.54%
Maintainers
0
Weekly downloads
 
Created
Source

Screenshot

Screenshot

API

NOTE: this component is not fully implemented yet - only info and share are available atm.

The following attributes are available and can be modified at runtime:

  • icon - one of: [close, lineChart, barChart, dotPlot, star, share, info, download]. no default, is mandatory.
  • background - on which kind of background the button is used. one of: [light, dark]. default is light.
  • state - tristate, one of [true,false,disabled]. default is true.
  • size - the width and height. default is 40.

Note that the temporary state when mouse is being clicked but not yet released, is not considered.

Events:

  • action - keyborad-Enter and mouse-click are captured, prevented and instead one event "action" is dispatched.

Details

There are 96 possibilities (8 * 2 * 3 * 2), 24 for each icon to consider. In order to reduce this complexity, the implementation of this component makes a few assumptions while staying open to overruling assumptions for any specific combination.

The assumptions are:

  • focus: border; white on light bg or black on dark bg
    • depends only on background, nothing else
  • mouse hover: swap colors on dark bg (square), lighter color on light bg
    • exception for close icon on light bg: white X, blue circle, not square
  • state: TODO. this also includes the behaviour - i.e. within a button-group, only buttons w/ state false/off can be focussed.

Usage with WebPack

package.json

"dependencies": {
  "@ewc-lib/ewc-icon-button": "latest"
},

webpack.config.js

index.html

<body>

  <script src="bundle.js"></script>

  <div style="display:flex; gap:3px; margin-bottom: 5px;">
    <ewc-icon-button icon="info"></ewc-icon-button>
    <ewc-icon-button icon="share"></ewc-icon-button>
  </div>

  <div style="display:flex; gap:3px; padding:2px; align-items: center; background-color: var(--c-p-140);">
    <ewc-icon-button background="dark" icon="info"></ewc-icon-button>
    <ewc-icon-button background="dark" icon="share"></ewc-icon-button>
  </div>


</body>

main.js

import "@ewc-lib/ewc-icon-button"

FAQs

Package last updated on 05 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc