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.
		
		
		
		
		
			
		
			
				
					40 lines
				
				1022 B
			
		
		
			
		
	
	
					40 lines
				
				1022 B
			| 
											3 years ago
										 | "use strict"; | ||
|  | // eslint-disable-next-line import/prefer-default-export
 | ||
|  | Object.defineProperty(exports, "__esModule", { value: true }); | ||
|  | exports.cssClass = exports.default = void 0; | ||
|  | /** | ||
|  |  * | ||
|  |  * Generates class name for given component. It is used by AdminJS core to append namespaced | ||
|  |  * classes. | ||
|  |  * | ||
|  |  * ### example | ||
|  |  * | ||
|  |  * ```javascript
 | ||
|  |  * import { cssClass } from '@adminjs/design-system' | ||
|  |  * | ||
|  |  * cssClass('Icon', 'my-regular-class-name') | ||
|  |  * // returns: 'adminjs_Icon my-regular-class-name'
 | ||
|  |  * ```
 | ||
|  |  * | ||
|  |  * | ||
|  |  * @param {string | Array<string>} className | ||
|  |  * @param {string}                [regularClass] | ||
|  |  * @memberof module:@adminjs/design-system | ||
|  |  */ | ||
|  | const cssClass = (className, regularClass) => { | ||
|  |     let names = []; | ||
|  |     if (className.join) { | ||
|  |         names = className; | ||
|  |     } | ||
|  |     else { | ||
|  |         names = [className]; | ||
|  |     } | ||
|  |     const parsed = names.map((name) => `adminjs_${name}`); | ||
|  |     if (regularClass) { | ||
|  |         parsed.push(regularClass); | ||
|  |     } | ||
|  |     return parsed.join(' '); | ||
|  | }; | ||
|  | exports.default = cssClass; | ||
|  | exports.cssClass = cssClass; |