@asphalt-react/helper
Advanced tools
Comparing version 1.13.0 to 2.0.0-alpha.1
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.1](https://source.golabs.io/asphalt/asphalt-react/compare/v1.13.0...v2.0.0-alpha.1) (2022-03-31) | ||
**Note:** Version bump only for package @asphalt-react/helper | ||
# [1.13.0](https://source.golabs.io/asphalt/asphalt-react/compare/v1.12.2...v1.13.0) (2022-03-30) | ||
@@ -8,0 +16,0 @@ |
import { TextEncoderLite } from 'text-encoder-lite'; | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
/** | ||
* check if environment has native TextEncoder | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode=()=>typeof process!=="undefined";const supportsTextEncoder=()=>typeof TextEncoder!=="undefined"; | ||
const supportsTextEncoder = () => typeof TextEncoder !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
@@ -23,57 +11,4 @@ __proto__: null, | ||
/** | ||
* generates a random hash using Math.random() | ||
* | ||
* @returns {String} | ||
*/ | ||
const randomHash=()=>`${Math.random().toString(36).substring(2,15)}`;const paddedHexString=buffer=>{const byteArray=new Uint8Array(buffer);const hexCodes=Array.from(byteArray).map(value=>value.toString(16).padStart(2,"0"));return hexCodes.join("")};const sha256=async input=>{{const buffer=await window.crypto.subtle.digest("SHA-256",input);return paddedHexString(buffer)}};const hash=async data=>{const Encoder=supportsTextEncoder()?TextEncoder:TextEncoderLite;const encoder=new Encoder("utf-8");return await sha256(encoder.encode(data))}; | ||
const randomHash = () => `${Math.random().toString(36).substring(2, 15)}`; | ||
/** | ||
* creates hex string of the ArrayBuffer | ||
* | ||
* takes an ArrayBuffer and then converts it into Uint8Array | ||
* converts each element of Uint8Array and converts the value into Hex | ||
* pads the hex value with 0 to make it 2 character strings | ||
* returns the joined Array | ||
* | ||
* @param {ArrayBuffer} buffer | ||
* @returns {String} | ||
*/ | ||
const paddedHexString = buffer => { | ||
const byteArray = new Uint8Array(buffer); | ||
const hexCodes = Array.from(byteArray).map(value => value.toString(16).padStart(2, "0")); | ||
return hexCodes.join(""); | ||
}; | ||
/** | ||
* creates a sha256 of the given string | ||
* | ||
* based on the runtime environment, creates a sha256 hash of the string | ||
* before converting to hex | ||
* | ||
* @param {String} input | ||
* @returns {Promise} | ||
*/ | ||
const sha256 = async input => { | ||
{ | ||
const buffer = await window.crypto.subtle.digest("SHA-256", input); | ||
return paddedHexString(buffer); | ||
} | ||
}; | ||
/** | ||
* creates a sha256 of the given string | ||
* | ||
* creates a sha256 hash as hex value in browser or node | ||
* | ||
* @param {String} data | ||
* @returns {Promise} | ||
*/ | ||
const hash = async data => { | ||
const Encoder = supportsTextEncoder() ? TextEncoder : TextEncoderLite; | ||
const encoder = new Encoder("utf-8"); | ||
return await sha256(encoder.encode(data)); | ||
}; | ||
var hash$1 = /*#__PURE__*/Object.freeze({ | ||
@@ -87,148 +22,15 @@ __proto__: null, | ||
/** | ||
* validate custom size prop | ||
* | ||
* @param {Array} sizeArr array of sizes which the component accepts | ||
* @param {String} size size of component | ||
*/ | ||
const validateSize = (sizeArr, size) => { | ||
return sizeArr.includes(size); | ||
}; | ||
/** | ||
* validates that specific props occur only once | ||
* | ||
* takes an Enum of props to be validated and returns a function | ||
* the returned function then accepts props and checks that the | ||
* props which are in the Enum occur only once. | ||
* | ||
* @param {Enumerator} propsEnum Enum of props to be validated | ||
* | ||
* @returns {Function} | ||
*/ | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
const createPropOccurValidator = propsEnum => props => { | ||
const incomingProps = Object.keys(props).filter(key => !!props[key]); | ||
return propsEnum.filter(prop => incomingProps.includes(prop)).length <= 1; | ||
}; | ||
/** | ||
* returns function to determine support type | ||
* | ||
* @param {String} defaultType default support type | ||
* | ||
* @returns {Function} | ||
*/ | ||
const getPrefixedId=id=>id?`${ID_PREFIX}${id}`:"";const capitalise=(word="")=>word.substring(0,1).toUpperCase()+word.substring(1).toLowerCase();const camelCase=(...words)=>{return words.reduce((result,word,index)=>{word=word.toLowerCase();return result+(index?capitalise(word):word)},"")}; | ||
const getSupportType = defaultType => typeProps => { | ||
/** | ||
* determines support type for component | ||
* | ||
* example: | ||
* let's say `danger` is the default support type | ||
* _case 1_: pass `info` in prop, returns `info` | ||
* _case 2_: pass `info` and `danger`, returns `info` | ||
* _case 3_: pass `info`, `success` and `danger`, returns `danger` | ||
* | ||
* @param {Object} typeProps object of support types | ||
* | ||
* @return {string} | ||
*/ | ||
const { | ||
[defaultType]: removedProp, | ||
...restProps | ||
} = typeProps; | ||
const supportKeys = Object.keys(restProps); | ||
const doPropsConflict = !createPropOccurValidator(supportKeys)(restProps); | ||
var strings = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
getPrefixedId: getPrefixedId, | ||
capitalise: capitalise, | ||
camelCase: camelCase | ||
}); | ||
if (doPropsConflict) { | ||
return defaultType; | ||
} | ||
const validateSize=(sizeArr,size)=>{return sizeArr.includes(size)};const createPropOccurValidator=propsEnum=>props=>{const incomingProps=Object.keys(props).filter(key=>Boolean(props[key]));return propsEnum.filter(prop=>incomingProps.includes(prop)).length<=1};const getSupportType=defaultType=>typeProps=>{const{[defaultType]:removedProp,...restProps}=typeProps;const supportKeys=Object.keys(restProps);const doPropsConflict=!createPropOccurValidator(supportKeys)(restProps);if(doPropsConflict){return defaultType}return supportKeys.find(key=>Boolean(restProps[key]))||defaultType};const mergeRefs=(...refs)=>node=>{refs.forEach(ref=>{if(typeof ref==="function"){ref(node);}else if(ref!==null){ref.current=node;}});};const yieldPropsWithPrefix=(obj,prefix)=>Object.keys(obj).reduce((prefixedProps,key)=>({...prefixedProps,...(key.startsWith(prefix)&&{[key]:obj[key]})}),{});const filterPropsWithPrefix=(obj,prefix)=>Object.keys(obj).reduce((prefixedProps,key)=>({...prefixedProps,...(!key.startsWith(prefix)&&{[key]:obj[key]})}),{});const yieldDataAttrs=obj=>yieldPropsWithPrefix(obj,"data-");const excludeDataAttrs=obj=>filterPropsWithPrefix(obj,"data-");const yieldAriaAttrs=obj=>yieldPropsWithPrefix(obj,"aria-");const excludeAriaAttrs=obj=>filterPropsWithPrefix(obj,"aria-");const concatClasses=(...words)=>camelCase(...words); | ||
return supportKeys.find(key => !!restProps[key]) || defaultType; | ||
}; | ||
/** | ||
* Returns a function to merge refs | ||
* | ||
* @param {...any} refs React Ref to merge | ||
* @returns {Function} | ||
*/ | ||
const mergeRefs = (...refs) => node => { | ||
/** | ||
* Points all the refs to one element | ||
* | ||
* @param {Object} node element to which all refs will point | ||
*/ | ||
refs.forEach(ref => { | ||
if (typeof ref === "function") { | ||
ref(node); | ||
} else if (ref != null) { | ||
ref.current = node; | ||
} | ||
}); | ||
}; | ||
/** | ||
* Returns properties with desired prefix from an object | ||
* @private | ||
* | ||
* @param {object} obj Object to filter from | ||
* @param {string} prefix prefix of properties to return | ||
* | ||
* @return object | ||
*/ | ||
const yieldPropsWithPrefix = (obj, prefix) => Object.keys(obj).reduce((prefixedProps, key) => ({ ...prefixedProps, | ||
...(key.startsWith(prefix) && { | ||
[key]: obj[key] | ||
}) | ||
}), {}); | ||
/** | ||
* Filters out properties with undesired prefix from an object | ||
* @private | ||
* | ||
* @param {object} obj Object to filter from | ||
* @param {string} prefix prefix of properties to filter | ||
* | ||
* @return object | ||
*/ | ||
const filterPropsWithPrefix = (obj, prefix) => Object.keys(obj).reduce((prefixedProps, key) => ({ ...prefixedProps, | ||
...(!key.startsWith(prefix) && { | ||
[key]: obj[key] | ||
}) | ||
}), {}); | ||
/** | ||
* Returns properties with `data-` prefix from an object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const yieldDataAttrs = obj => yieldPropsWithPrefix(obj, "data-"); | ||
/** | ||
* Excludes properties with `data-` prefix from on object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const excludeDataAttrs = obj => filterPropsWithPrefix(obj, "data-"); | ||
/** | ||
* Returns properties with `aria-` prefix from an object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const yieldAriaAttrs = obj => yieldPropsWithPrefix(obj, "aria-"); | ||
/** | ||
* Excludes properties with `aria-` prefix from on object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const excludeAriaAttrs = obj => filterPropsWithPrefix(obj, "aria-"); | ||
var props = /*#__PURE__*/Object.freeze({ | ||
@@ -243,29 +45,8 @@ __proto__: null, | ||
yieldAriaAttrs: yieldAriaAttrs, | ||
excludeAriaAttrs: excludeAriaAttrs | ||
excludeAriaAttrs: excludeAriaAttrs, | ||
concatClasses: concatClasses | ||
}); | ||
/** | ||
* Checks if the value is of the type SVG | ||
* | ||
* @param {*} val | ||
* @returns {Boolean} | ||
*/ | ||
const isTypeSVG = val => { | ||
const type = typeof val === "function" ? val().type : val; | ||
return type === "svg"; | ||
}; | ||
/** | ||
* Checks if the the input is a SVG | ||
* | ||
* @param {Object} icon | ||
* @returns {Boolean} | ||
*/ | ||
const isTypeSVG=val=>{const type=typeof val==="function"?val().type:val;return type==="svg"};const isSVG=icon=>{if(!icon)return false;const type=icon.props&&icon.props.originalType||icon.type;return isTypeSVG(type)}; | ||
const isSVG = icon => { | ||
if (!icon) return false; | ||
const type = icon.props && icon.props.originalType || icon.type; | ||
return isTypeSVG(type); | ||
}; | ||
var svg = /*#__PURE__*/Object.freeze({ | ||
@@ -276,36 +57,2 @@ __proto__: null, | ||
const INFO = "info"; | ||
const SUCCESS = "success"; | ||
const WARNING = "warning"; | ||
const DANGER = "danger"; | ||
const KEYCODES = Object.freeze({ | ||
TAB: 9, | ||
RETURN: 13, | ||
ESC: 27, | ||
SPACE: 32, | ||
PAGEUP: 33, | ||
PAGEDOWN: 34, | ||
END: 35, | ||
HOME: 36, | ||
LEFT: 37, | ||
UP: 38, | ||
RIGHT: 39, | ||
DOWN: 40 | ||
}); | ||
const ID_PREFIX = "sphlt-"; | ||
/** | ||
* Prepends a constant prefix to an ID | ||
* | ||
* @param {string} id ID of an element | ||
* @returns {string} | ||
*/ | ||
const getPrefixedId = id => id ? `${ID_PREFIX}${id}` : ""; | ||
var strings = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
getPrefixedId: getPrefixedId | ||
}); | ||
export { DANGER, INFO, KEYCODES, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; |
import { TextEncoderLite } from 'text-encoder-lite'; | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
/** | ||
* check if environment has native TextEncoder | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode=()=>typeof process!=="undefined";const supportsTextEncoder=()=>typeof TextEncoder!=="undefined"; | ||
const supportsTextEncoder = () => typeof TextEncoder !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
@@ -23,62 +11,4 @@ __proto__: null, | ||
/** | ||
* generates a random hash using Math.random() | ||
* | ||
* @returns {String} | ||
*/ | ||
const randomHash=()=>`${Math.random().toString(36).substring(2,15)}`;const paddedHexString=buffer=>{const byteArray=new Uint8Array(buffer);const hexCodes=Array.from(byteArray).map(value=>value.toString(16).padStart(2,"0"));return hexCodes.join("")};const sha256=async input=>{{const{createHash}=require("crypto");const hash=createHash("sha256");hash.update(input);return hash.digest("hex")}};const hash=async data=>{const Encoder=supportsTextEncoder()?TextEncoder:TextEncoderLite;const encoder=new Encoder("utf-8");return await sha256(encoder.encode(data))}; | ||
const randomHash = () => `${Math.random().toString(36).substring(2, 15)}`; | ||
/** | ||
* creates hex string of the ArrayBuffer | ||
* | ||
* takes an ArrayBuffer and then converts it into Uint8Array | ||
* converts each element of Uint8Array and converts the value into Hex | ||
* pads the hex value with 0 to make it 2 character strings | ||
* returns the joined Array | ||
* | ||
* @param {ArrayBuffer} buffer | ||
* @returns {String} | ||
*/ | ||
const paddedHexString = buffer => { | ||
const byteArray = new Uint8Array(buffer); | ||
const hexCodes = Array.from(byteArray).map(value => value.toString(16).padStart(2, "0")); | ||
return hexCodes.join(""); | ||
}; | ||
/** | ||
* creates a sha256 of the given string | ||
* | ||
* based on the runtime environment, creates a sha256 hash of the string | ||
* before converting to hex | ||
* | ||
* @param {String} input | ||
* @returns {Promise} | ||
*/ | ||
const sha256 = async input => { | ||
{ | ||
const { | ||
createHash | ||
} = require("crypto"); | ||
const hash = createHash("sha256"); | ||
hash.update(input); | ||
return hash.digest("hex"); | ||
} | ||
}; | ||
/** | ||
* creates a sha256 of the given string | ||
* | ||
* creates a sha256 hash as hex value in browser or node | ||
* | ||
* @param {String} data | ||
* @returns {Promise} | ||
*/ | ||
const hash = async data => { | ||
const Encoder = supportsTextEncoder() ? TextEncoder : TextEncoderLite; | ||
const encoder = new Encoder("utf-8"); | ||
return await sha256(encoder.encode(data)); | ||
}; | ||
var hash$1 = /*#__PURE__*/Object.freeze({ | ||
@@ -92,148 +22,15 @@ __proto__: null, | ||
/** | ||
* validate custom size prop | ||
* | ||
* @param {Array} sizeArr array of sizes which the component accepts | ||
* @param {String} size size of component | ||
*/ | ||
const validateSize = (sizeArr, size) => { | ||
return sizeArr.includes(size); | ||
}; | ||
/** | ||
* validates that specific props occur only once | ||
* | ||
* takes an Enum of props to be validated and returns a function | ||
* the returned function then accepts props and checks that the | ||
* props which are in the Enum occur only once. | ||
* | ||
* @param {Enumerator} propsEnum Enum of props to be validated | ||
* | ||
* @returns {Function} | ||
*/ | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
const createPropOccurValidator = propsEnum => props => { | ||
const incomingProps = Object.keys(props).filter(key => !!props[key]); | ||
return propsEnum.filter(prop => incomingProps.includes(prop)).length <= 1; | ||
}; | ||
/** | ||
* returns function to determine support type | ||
* | ||
* @param {String} defaultType default support type | ||
* | ||
* @returns {Function} | ||
*/ | ||
const getPrefixedId=id=>id?`${ID_PREFIX}${id}`:"";const capitalise=(word="")=>word.substring(0,1).toUpperCase()+word.substring(1).toLowerCase();const camelCase=(...words)=>{return words.reduce((result,word,index)=>{word=word.toLowerCase();return result+(index?capitalise(word):word)},"")}; | ||
const getSupportType = defaultType => typeProps => { | ||
/** | ||
* determines support type for component | ||
* | ||
* example: | ||
* let's say `danger` is the default support type | ||
* _case 1_: pass `info` in prop, returns `info` | ||
* _case 2_: pass `info` and `danger`, returns `info` | ||
* _case 3_: pass `info`, `success` and `danger`, returns `danger` | ||
* | ||
* @param {Object} typeProps object of support types | ||
* | ||
* @return {string} | ||
*/ | ||
const { | ||
[defaultType]: removedProp, | ||
...restProps | ||
} = typeProps; | ||
const supportKeys = Object.keys(restProps); | ||
const doPropsConflict = !createPropOccurValidator(supportKeys)(restProps); | ||
var strings = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
getPrefixedId: getPrefixedId, | ||
capitalise: capitalise, | ||
camelCase: camelCase | ||
}); | ||
if (doPropsConflict) { | ||
return defaultType; | ||
} | ||
const validateSize=(sizeArr,size)=>{return sizeArr.includes(size)};const createPropOccurValidator=propsEnum=>props=>{const incomingProps=Object.keys(props).filter(key=>Boolean(props[key]));return propsEnum.filter(prop=>incomingProps.includes(prop)).length<=1};const getSupportType=defaultType=>typeProps=>{const{[defaultType]:removedProp,...restProps}=typeProps;const supportKeys=Object.keys(restProps);const doPropsConflict=!createPropOccurValidator(supportKeys)(restProps);if(doPropsConflict){return defaultType}return supportKeys.find(key=>Boolean(restProps[key]))||defaultType};const mergeRefs=(...refs)=>node=>{refs.forEach(ref=>{if(typeof ref==="function"){ref(node);}else if(ref!==null){ref.current=node;}});};const yieldPropsWithPrefix=(obj,prefix)=>Object.keys(obj).reduce((prefixedProps,key)=>({...prefixedProps,...(key.startsWith(prefix)&&{[key]:obj[key]})}),{});const filterPropsWithPrefix=(obj,prefix)=>Object.keys(obj).reduce((prefixedProps,key)=>({...prefixedProps,...(!key.startsWith(prefix)&&{[key]:obj[key]})}),{});const yieldDataAttrs=obj=>yieldPropsWithPrefix(obj,"data-");const excludeDataAttrs=obj=>filterPropsWithPrefix(obj,"data-");const yieldAriaAttrs=obj=>yieldPropsWithPrefix(obj,"aria-");const excludeAriaAttrs=obj=>filterPropsWithPrefix(obj,"aria-");const concatClasses=(...words)=>camelCase(...words); | ||
return supportKeys.find(key => !!restProps[key]) || defaultType; | ||
}; | ||
/** | ||
* Returns a function to merge refs | ||
* | ||
* @param {...any} refs React Ref to merge | ||
* @returns {Function} | ||
*/ | ||
const mergeRefs = (...refs) => node => { | ||
/** | ||
* Points all the refs to one element | ||
* | ||
* @param {Object} node element to which all refs will point | ||
*/ | ||
refs.forEach(ref => { | ||
if (typeof ref === "function") { | ||
ref(node); | ||
} else if (ref != null) { | ||
ref.current = node; | ||
} | ||
}); | ||
}; | ||
/** | ||
* Returns properties with desired prefix from an object | ||
* @private | ||
* | ||
* @param {object} obj Object to filter from | ||
* @param {string} prefix prefix of properties to return | ||
* | ||
* @return object | ||
*/ | ||
const yieldPropsWithPrefix = (obj, prefix) => Object.keys(obj).reduce((prefixedProps, key) => ({ ...prefixedProps, | ||
...(key.startsWith(prefix) && { | ||
[key]: obj[key] | ||
}) | ||
}), {}); | ||
/** | ||
* Filters out properties with undesired prefix from an object | ||
* @private | ||
* | ||
* @param {object} obj Object to filter from | ||
* @param {string} prefix prefix of properties to filter | ||
* | ||
* @return object | ||
*/ | ||
const filterPropsWithPrefix = (obj, prefix) => Object.keys(obj).reduce((prefixedProps, key) => ({ ...prefixedProps, | ||
...(!key.startsWith(prefix) && { | ||
[key]: obj[key] | ||
}) | ||
}), {}); | ||
/** | ||
* Returns properties with `data-` prefix from an object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const yieldDataAttrs = obj => yieldPropsWithPrefix(obj, "data-"); | ||
/** | ||
* Excludes properties with `data-` prefix from on object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const excludeDataAttrs = obj => filterPropsWithPrefix(obj, "data-"); | ||
/** | ||
* Returns properties with `aria-` prefix from an object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const yieldAriaAttrs = obj => yieldPropsWithPrefix(obj, "aria-"); | ||
/** | ||
* Excludes properties with `aria-` prefix from on object | ||
* | ||
* @param {object} obj Object to filter from | ||
* @returns {object} | ||
*/ | ||
const excludeAriaAttrs = obj => filterPropsWithPrefix(obj, "aria-"); | ||
var props = /*#__PURE__*/Object.freeze({ | ||
@@ -248,29 +45,8 @@ __proto__: null, | ||
yieldAriaAttrs: yieldAriaAttrs, | ||
excludeAriaAttrs: excludeAriaAttrs | ||
excludeAriaAttrs: excludeAriaAttrs, | ||
concatClasses: concatClasses | ||
}); | ||
/** | ||
* Checks if the value is of the type SVG | ||
* | ||
* @param {*} val | ||
* @returns {Boolean} | ||
*/ | ||
const isTypeSVG = val => { | ||
const type = typeof val === "function" ? val().type : val; | ||
return type === "svg"; | ||
}; | ||
/** | ||
* Checks if the the input is a SVG | ||
* | ||
* @param {Object} icon | ||
* @returns {Boolean} | ||
*/ | ||
const isTypeSVG=val=>{const type=typeof val==="function"?val().type:val;return type==="svg"};const isSVG=icon=>{if(!icon)return false;const type=icon.props&&icon.props.originalType||icon.type;return isTypeSVG(type)}; | ||
const isSVG = icon => { | ||
if (!icon) return false; | ||
const type = icon.props && icon.props.originalType || icon.type; | ||
return isTypeSVG(type); | ||
}; | ||
var svg = /*#__PURE__*/Object.freeze({ | ||
@@ -281,36 +57,2 @@ __proto__: null, | ||
const INFO = "info"; | ||
const SUCCESS = "success"; | ||
const WARNING = "warning"; | ||
const DANGER = "danger"; | ||
const KEYCODES = Object.freeze({ | ||
TAB: 9, | ||
RETURN: 13, | ||
ESC: 27, | ||
SPACE: 32, | ||
PAGEUP: 33, | ||
PAGEDOWN: 34, | ||
END: 35, | ||
HOME: 36, | ||
LEFT: 37, | ||
UP: 38, | ||
RIGHT: 39, | ||
DOWN: 40 | ||
}); | ||
const ID_PREFIX = "sphlt-"; | ||
/** | ||
* Prepends a constant prefix to an ID | ||
* | ||
* @param {string} id ID of an element | ||
* @returns {string} | ||
*/ | ||
const getPrefixedId = id => id ? `${ID_PREFIX}${id}` : ""; | ||
var strings = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
getPrefixedId: getPrefixedId | ||
}); | ||
export { DANGER, INFO, KEYCODES, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; |
{ | ||
"name": "@asphalt-react/helper", | ||
"version": "1.13.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "Common helper utilities for components", | ||
@@ -12,5 +12,9 @@ "keywords": [ | ||
"author": "UX Engineering - Web <uxe@gojek.com>", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/index.js", | ||
"browser": "dist/browser.js", | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"exports": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.js" | ||
}, | ||
"directories": { | ||
@@ -37,3 +41,7 @@ "test": "__tests__" | ||
}, | ||
"gitHead": "3f9cebe04eb753dc04819dd384e7b2c0bd6a74a9" | ||
"browser": { | ||
"dist/index.js": "./dist/browser.js", | ||
"crypto": false | ||
}, | ||
"gitHead": "3d38c37b17716bc5694b2d511f491a83b3073ef2" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Yes
18828
161
2
1