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.
		
		
		
		
		
			
		
			
				
					51 lines
				
				1.3 KiB
			
		
		
			
		
	
	
					51 lines
				
				1.3 KiB
			| 
											3 years ago
										 | "use strict"; | ||
|  | 
 | ||
|  | exports.__esModule = true; | ||
|  | exports["default"] = buttons; | ||
|  | 
 | ||
|  | 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 "button" + state + ",\n  input[type=\"button\"]" + state + ",\n  input[type=\"reset\"]" + state + ",\n  input[type=\"submit\"]" + state; | ||
|  | } | ||
|  | /** | ||
|  |  * Populates selectors that target all buttons. You can pass optional states to append to the selectors. | ||
|  |  * @example | ||
|  |  * // Styles as object usage
 | ||
|  |  * const styles = { | ||
|  |  *   [buttons('active')]: { | ||
|  |  *     'border': 'none' | ||
|  |  *   } | ||
|  |  * } | ||
|  |  * | ||
|  |  * // styled-components usage
 | ||
|  |  * const div = styled.div`
 | ||
|  |  *   > ${buttons('active')} { | ||
|  |  *     border: none; | ||
|  |  *   } | ||
|  |  * `
 | ||
|  |  * | ||
|  |  * // CSS in JS Output
 | ||
|  |  * | ||
|  |  *  'button:active, | ||
|  |  *  'input[type="button"]:active, | ||
|  |  *  'input[type=\"reset\"]:active, | ||
|  |  *  'input[type=\"submit\"]:active: { | ||
|  |  *   'border': 'none' | ||
|  |  * } | ||
|  |  */ | ||
|  | 
 | ||
|  | 
 | ||
|  | function buttons() { | ||
|  |   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; |