UNPKG

1.31 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = buttons;
5var _statefulSelectors = _interopRequireDefault(require("../internalHelpers/_statefulSelectors"));
6function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7var stateMap = [undefined, null, 'active', 'focus', 'hover'];
8function template(state) {
9 return "button" + state + ",\n input[type=\"button\"]" + state + ",\n input[type=\"reset\"]" + state + ",\n input[type=\"submit\"]" + state;
10}
11
12/**
13 * Populates selectors that target all buttons. You can pass optional states to append to the selectors.
14 * @example
15 * // Styles as object usage
16 * const styles = {
17 * [buttons('active')]: {
18 * 'border': 'none'
19 * }
20 * }
21 *
22 * // styled-components usage
23 * const div = styled.div`
24 * > ${buttons('active')} {
25 * border: none;
26 * }
27 * `
28 *
29 * // CSS in JS Output
30 *
31 * 'button:active,
32 * 'input[type="button"]:active,
33 * 'input[type=\"reset\"]:active,
34 * 'input[type=\"submit\"]:active: {
35 * 'border': 'none'
36 * }
37 */
38function buttons() {
39 for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
40 states[_key] = arguments[_key];
41 }
42 return (0, _statefulSelectors["default"])(states, template, stateMap);
43}
44module.exports = exports.default;
\No newline at end of file