You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.2 KiB
63 lines
2.2 KiB
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports["default"] = textInputs;
|
|
|
|
var _statefulSelectors = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("../internalHelpers/_statefulSelectors"));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
|
|
var stateMap = [undefined, null, 'active', 'focus', 'hover'];
|
|
|
|
function template(state) {
|
|
return "input[type=\"color\"]" + state + ",\n input[type=\"date\"]" + state + ",\n input[type=\"datetime\"]" + state + ",\n input[type=\"datetime-local\"]" + state + ",\n input[type=\"email\"]" + state + ",\n input[type=\"month\"]" + state + ",\n input[type=\"number\"]" + state + ",\n input[type=\"password\"]" + state + ",\n input[type=\"search\"]" + state + ",\n input[type=\"tel\"]" + state + ",\n input[type=\"text\"]" + state + ",\n input[type=\"time\"]" + state + ",\n input[type=\"url\"]" + state + ",\n input[type=\"week\"]" + state + ",\n input:not([type])" + state + ",\n textarea" + state;
|
|
}
|
|
/**
|
|
* Populates selectors that target all text inputs. You can pass optional states to append to the selectors.
|
|
* @example
|
|
* // Styles as object usage
|
|
* const styles = {
|
|
* [textInputs('active')]: {
|
|
* 'border': 'none'
|
|
* }
|
|
* }
|
|
*
|
|
* // styled-components usage
|
|
* const div = styled.div`
|
|
* > ${textInputs('active')} {
|
|
* border: none;
|
|
* }
|
|
* `
|
|
*
|
|
* // CSS in JS Output
|
|
*
|
|
* 'input[type="color"]:active,
|
|
* input[type="date"]:active,
|
|
* input[type="datetime"]:active,
|
|
* input[type="datetime-local"]:active,
|
|
* input[type="email"]:active,
|
|
* input[type="month"]:active,
|
|
* input[type="number"]:active,
|
|
* input[type="password"]:active,
|
|
* input[type="search"]:active,
|
|
* input[type="tel"]:active,
|
|
* input[type="text"]:active,
|
|
* input[type="time"]:active,
|
|
* input[type="url"]:active,
|
|
* input[type="week"]:active,
|
|
* input:not([type]):active,
|
|
* textarea:active': {
|
|
* 'border': 'none'
|
|
* }
|
|
*/
|
|
|
|
|
|
function textInputs() {
|
|
for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
states[_key] = arguments[_key];
|
|
}
|
|
|
|
return (0, _statefulSelectors["default"])(states, template, stateMap);
|
|
}
|
|
|
|
module.exports = exports.default; |