Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
makeup-expander
Advanced tools
Creates the basic interactivity for an element that expands and collapses another element.
Creates the basic interactivity for an element that expands and collapses another element, e.g. a fly-out or fly-in.
This module is still in an experimental state, until it reaches v1.0.0 you must consider all minor releases as breaking changes. Patch releases may introduce new features, but will be backwards compatible.
// via npm
npm install makeup-expander
// via yarn
yarn add makeup-expander
<div class="expander expander--click">
<button class="expander__host">Click for Flyout</button>
<div class="expander__content">
<p>Any kind of HTML control can go inside...</p>
<p>A link: <a id="foo" href="http://www.ebay.com">www.ebay.com</a></p>
<p>A button: <button>Click Me</button></p>
<p>An input: <input type="text" aria-label="Dummy textbox"></p>
<p>A checkbox: <input type="checkbox" aria-label="Dummy checkbox"></p>
</div>
</div>
// import the module
const Expander = require('makeup-expander');
// get an element reference
const widgetEl = document.querySelector('.expander--click');
// default options
const options = {
autoCollapse: true,
click: false,
contentSelector: '.expander__content',
focus: false,
focusManagement: null,
hostSelector: '.expander__host',
hover: false
};
// get widget instance
const widget = new Expander(widgetEl, options);
Clicking the button will now toggle it's aria-expanded state. CSS can be used to display the content accordingly, for example:
.expander__content {
display: none;
}
.expander__host[aria-expanded=true] ~ .expander__content {
display: block;
}
el
: the root widget eloptions.autoCollapse
: whether click-activated expander should collapse when keyboard or mouse leaves the content or widget (default: false)options.click
: whether the host should be click activated (default: false)options.contentSelector
: the query selector for the expandee element in relation to the widget (default: '.expander__content')options.focus
: whether the host should be focus activated (default: false)options.focusManagement
: where focus should go (null, 'content', 'focusable', 'interactive', or ID reference) when click expander is activated with keyboard (default: null)options.hostSelector
: the query selector for the host element in relation to the widget (default: '.expander__host')options.hover
: whether the host should be hover activated (default: false)expander-collapse
expander-expand
npm start
npm test
npm run lint
npm run fix
npm run build
npm run clean
The following hooks exist, and do not need to be invoked manually:
npm prepublish
cleans, lints, tests and builds on every npm publish
commandpre-commit
cleans, lints, tests and builds on every git commit
commandEach test run will generate the following reports:
/reports/coverage
contains Istanbul code coverage report/reports/html
contains HTML test reporthttps://travis-ci.org/makeup-js/makeup-expander
FAQs
Creates the basic interactivity for an element that expands and collapses another element.
The npm package makeup-expander receives a total of 261 weekly downloads. As such, makeup-expander popularity was classified as not popular.
We found that makeup-expander demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.