@chakra-ui/utils
Advanced tools
Comparing version 1.9.1 to 1.10.0
@@ -994,2 +994,31 @@ 'use strict'; | ||
function flatten(target, maxDepth) { | ||
if (maxDepth === void 0) { | ||
maxDepth = Infinity; | ||
} | ||
if (!isObject(target) && !Array.isArray(target) || !maxDepth) { | ||
return target; | ||
} | ||
return Object.entries(target).reduce(function (result, _ref) { | ||
var key = _ref[0], | ||
value = _ref[1]; | ||
if (isObject(value) || isArray(value)) { | ||
Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) { | ||
var childKey = _ref2[0], | ||
childValue = _ref2[1]; | ||
// e.g. gray.500 | ||
result[key + "." + childKey] = childValue; | ||
}); | ||
} else { | ||
// e.g. transparent | ||
result[key] = value; | ||
} | ||
return result; | ||
}, {}); | ||
} | ||
/** | ||
@@ -1719,2 +1748,3 @@ * Determines whether the children of a disclosure widget | ||
exports.filterUndefined = filterUndefined; | ||
exports.flatten = flatten; | ||
exports.focus = focus; | ||
@@ -1721,0 +1751,0 @@ exports.focusNextTabbable = focusNextTabbable; |
@@ -994,2 +994,31 @@ 'use strict'; | ||
function flatten(target, maxDepth) { | ||
if (maxDepth === void 0) { | ||
maxDepth = Infinity; | ||
} | ||
if (!isObject(target) && !Array.isArray(target) || !maxDepth) { | ||
return target; | ||
} | ||
return Object.entries(target).reduce(function (result, _ref) { | ||
var key = _ref[0], | ||
value = _ref[1]; | ||
if (isObject(value) || isArray(value)) { | ||
Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) { | ||
var childKey = _ref2[0], | ||
childValue = _ref2[1]; | ||
// e.g. gray.500 | ||
result[key + "." + childKey] = childValue; | ||
}); | ||
} else { | ||
// e.g. transparent | ||
result[key] = value; | ||
} | ||
return result; | ||
}, {}); | ||
} | ||
/** | ||
@@ -1719,2 +1748,3 @@ * Determines whether the children of a disclosure widget | ||
exports.filterUndefined = filterUndefined; | ||
exports.flatten = flatten; | ||
exports.focus = focus; | ||
@@ -1721,0 +1751,0 @@ exports.focusNextTabbable = focusNextTabbable; |
@@ -985,2 +985,31 @@ export * from 'css-box-model'; | ||
function flatten(target, maxDepth) { | ||
if (maxDepth === void 0) { | ||
maxDepth = Infinity; | ||
} | ||
if (!isObject(target) && !Array.isArray(target) || !maxDepth) { | ||
return target; | ||
} | ||
return Object.entries(target).reduce(function (result, _ref) { | ||
var key = _ref[0], | ||
value = _ref[1]; | ||
if (isObject(value) || isArray(value)) { | ||
Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) { | ||
var childKey = _ref2[0], | ||
childValue = _ref2[1]; | ||
// e.g. gray.500 | ||
result[key + "." + childKey] = childValue; | ||
}); | ||
} else { | ||
// e.g. transparent | ||
result[key] = value; | ||
} | ||
return result; | ||
}, {}); | ||
} | ||
/** | ||
@@ -1676,2 +1705,2 @@ * Determines whether the children of a disclosure widget | ||
export { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler }; | ||
export { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, flatten, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler }; |
@@ -8,2 +8,3 @@ export * from "css-box-model"; | ||
export * from "./focus"; | ||
export * from "./flatten"; | ||
export * from "./function"; | ||
@@ -10,0 +11,0 @@ export * from "./lazy"; |
{ | ||
"name": "@chakra-ui/utils", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "Common utilties and types for Chakra UI", | ||
@@ -5,0 +5,0 @@ "author": "Segun Adebayo <sage@adebayosegun.com>", |
@@ -8,2 +8,3 @@ export * from "css-box-model" | ||
export * from "./focus" | ||
export * from "./flatten" | ||
export * from "./function" | ||
@@ -10,0 +11,0 @@ export * from "./lazy" |
Sorry, the diff of this file is not supported yet
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
64
6657
240152