Comparing version 0.3.0 to 0.4.0
import memoize from 'lodash.memoize'; | ||
import { cx } from 'emotion'; | ||
@@ -105,4 +106,18 @@ /** | ||
/** | ||
* Returns a css className that combines what the user passes down and a string. | ||
* Ideally the string would map to the element's js style object's name. | ||
* @param {string} className | ||
* @param {string} appendedString | ||
* @returns {string} A string that looks like className__appendedString | ||
*/ | ||
function createCustomClassNames(className, appendedString) { | ||
return className && className.split(" ").reduce(function (acc, cur) { | ||
return cx(acc, cur.trim() + "__" + appendedString); | ||
}, ""); | ||
} | ||
/* eslint-disable import/prefer-default-export */ | ||
export { combineEventHandlers, memoizeCombineEventHandlers, createButtonEventHandlers, memoizeCreateButtonEventHandlers, generateId }; | ||
export { combineEventHandlers, memoizeCombineEventHandlers, createButtonEventHandlers, memoizeCreateButtonEventHandlers, generateId, createCustomClassNames }; |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var memoize = _interopDefault(require('lodash.memoize')); | ||
var emotion = require('emotion'); | ||
@@ -112,2 +113,16 @@ /** | ||
/** | ||
* Returns a css className that combines what the user passes down and a string. | ||
* Ideally the string would map to the element's js style object's name. | ||
* @param {string} className | ||
* @param {string} appendedString | ||
* @returns {string} A string that looks like className__appendedString | ||
*/ | ||
function createCustomClassNames(className, appendedString) { | ||
return className && className.split(" ").reduce(function (acc, cur) { | ||
return emotion.cx(acc, cur.trim() + "__" + appendedString); | ||
}, ""); | ||
} | ||
/* eslint-disable import/prefer-default-export */ | ||
@@ -120,1 +135,2 @@ | ||
exports.generateId = generateId; | ||
exports.createCustomClassNames = createCustomClassNames; |
@@ -0,1 +1,8 @@ | ||
# [@hig/utils-v0.4.0](https://github.com/Autodesk/hig/compare/@hig/utils@0.3.0...@hig/utils@0.4.0) (2019-08-02) | ||
### Features | ||
* add createCustomClassNames ([8b41973](https://github.com/Autodesk/hig/commit/8b41973)) | ||
# [@hig/utils-v0.3.0](https://github.com/Autodesk/hig/compare/@hig/utils@0.2.1...@hig/utils@0.3.0) (2018-09-26) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@hig/utils", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Non-component specific utility functions for HIG components", | ||
@@ -20,6 +20,7 @@ "author": "Autodesk Inc.", | ||
"dependencies": { | ||
"emotion": "^10.0.0", | ||
"lodash.memoize": "^4.1.2" | ||
}, | ||
"devDependencies": { | ||
"@hig/babel-preset": "^0.1.0", | ||
"@hig/babel-preset": "^0.1.1", | ||
"@hig/eslint-config": "^0.1.0", | ||
@@ -26,0 +27,0 @@ "@hig/jest-preset": "^0.1.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10640
204
2
+ Addedemotion@^10.0.0
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/generator@7.26.2(transitive)
+ Added@babel/helper-module-imports@7.25.9(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.2(transitive)
+ Added@babel/runtime@7.26.0(transitive)
+ Added@babel/template@7.25.9(transitive)
+ Added@babel/traverse@7.25.9(transitive)
+ Added@babel/types@7.26.0(transitive)
+ Added@emotion/cache@10.0.29(transitive)
+ Added@emotion/hash@0.8.0(transitive)
+ Added@emotion/memoize@0.7.4(transitive)
+ Added@emotion/serialize@0.11.16(transitive)
+ Added@emotion/sheet@0.9.4(transitive)
+ Added@emotion/stylis@0.8.5(transitive)
+ Added@emotion/unitless@0.7.5(transitive)
+ Added@emotion/utils@0.11.3(transitive)
+ Added@emotion/weak-memoize@0.2.5(transitive)
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@types/parse-json@4.0.2(transitive)
+ Addedbabel-plugin-emotion@10.2.2(transitive)
+ Addedbabel-plugin-macros@2.8.0(transitive)
+ Addedbabel-plugin-syntax-jsx@6.18.0(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcosmiconfig@6.0.0(transitive)
+ Addedcreate-emotion@10.0.27(transitive)
+ Addedcsstype@2.6.21(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedemotion@10.0.27(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfind-root@1.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsesc@3.0.2(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedms@2.1.3(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedyaml@1.10.2(transitive)