Socket
Socket
Sign inDemoInstall

@chakra-ui/utils

Package Overview
Dependencies
4
Maintainers
4
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.0 to 1.9.1

dist/declarations/src/array.d.ts.map

10

CHANGELOG.md
# Change Log
## 1.9.1
### Patch Changes
- [#5075](https://github.com/chakra-ui/chakra-ui/pull/5075)
[`b28142946`](https://github.com/chakra-ui/chakra-ui/commit/b281429462a099b7fd7f9352e837cd28d1a2da0e)
Thanks [@cschroeter](https://github.com/cschroeter)! - Update babel config to
transpile soruces for older browsers. This fixes issues with CRA and
Storybook.
## 1.9.0

@@ -4,0 +14,0 @@

897

dist/chakra-ui-utils.cjs.dev.js

@@ -18,21 +18,33 @@ 'use strict';

function getLastItem(array) {
const length = array == null ? 0 : array.length;
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
function getPrevItem(index, array, loop = true) {
const prevIndex = getPrevIndex(index, array.length, loop);
function getPrevItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var prevIndex = getPrevIndex(index, array.length, loop);
return array[prevIndex];
}
function getNextItem(index, array, loop = true) {
const nextIndex = getNextIndex(index, array.length, 1, loop);
function getNextItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var nextIndex = getNextIndex(index, array.length, 1, loop);
return array[nextIndex];
}
function removeIndex(array, index) {
return array.filter((_, idx) => idx !== index);
return array.filter(function (_, idx) {
return idx !== index;
});
}
function addItem(array, item) {
return [...array, item];
return [].concat(array, [item]);
}
function removeItem(array, item) {
return array.filter(eachItem => eachItem !== item);
return array.filter(function (eachItem) {
return eachItem !== item;
});
}

@@ -48,5 +60,13 @@ /**

function getNextIndex(currentIndex, length, step = 1, loop = true) {
const lastIndex = length - 1;
function getNextIndex(currentIndex, length, step, loop) {
if (step === void 0) {
step = 1;
}
if (loop === void 0) {
loop = true;
}
var lastIndex = length - 1;
if (currentIndex === -1) {

@@ -56,3 +76,3 @@ return step > 0 ? 0 : lastIndex;

const nextIndex = currentIndex + step;
var nextIndex = currentIndex + step;

@@ -80,3 +100,7 @@ if (nextIndex < 0) {

function getPrevIndex(index, count, loop = true) {
function getPrevIndex(index, count, loop) {
if (loop === void 0) {
loop = true;
}
return getNextIndex(index, count, -1, loop);

@@ -92,3 +116,3 @@ }

function chunk(array, size) {
return array.reduce((rows, currentValue, index) => {
return array.reduce(function (rows, currentValue, index) {
if (index % size === 0) {

@@ -119,3 +143,5 @@ rows.push([currentValue]);

if (!currentItem) {
const foundItem = items.find(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase()));
var foundItem = items.find(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
});
return foundItem;

@@ -125,9 +151,11 @@ } // Filter items for ones that match the search string (case insensitive)

const matchingItems = items.filter(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase())); // If there's a match, let's get the next item to select
var matchingItems = items.filter(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
}); // If there's a match, let's get the next item to select
if (matchingItems.length > 0) {
let nextIndex; // If the currentItem is in the available items, we move to the next available option
var nextIndex; // If the currentItem is in the available items, we move to the next available option
if (matchingItems.includes(currentItem)) {
const currentIndex = matchingItems.indexOf(currentItem);
var currentIndex = matchingItems.indexOf(currentItem);
nextIndex = currentIndex + 1;

@@ -181,3 +209,3 @@

function isObject(value) {
const type = typeof value;
var type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);

@@ -208,4 +236,4 @@ }

}
const __DEV__ = process.env.NODE_ENV !== "production";
const __TEST__ = process.env.NODE_ENV === "test";
var __DEV__ = process.env.NODE_ENV !== "production";
var __TEST__ = process.env.NODE_ENV === "test";
function isRefObject(val) {

@@ -219,4 +247,4 @@ return "current" in val;

function omit(object, keys) {
const result = {};
Object.keys(object).forEach(key => {
var result = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) return;

@@ -228,4 +256,4 @@ result[key] = object[key];

function pick(object, keys) {
const result = {};
keys.forEach(key => {
var result = {};
keys.forEach(function (key) {
if (key in object) {

@@ -238,5 +266,5 @@ result[key] = object[key];

function split(object, keys) {
const picked = {};
const omitted = {};
Object.keys(object).forEach(key => {
var picked = {};
var omitted = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) {

@@ -259,3 +287,3 @@ picked[key] = object[key];

function get(obj, path, fallback, index) {
const key = typeof path === "string" ? path.split(".") : [path];
var key = typeof path === "string" ? path.split(".") : [path];

@@ -269,6 +297,6 @@ for (index = 0; index < key.length; index += 1) {

}
const memoize = fn => {
const cache = new WeakMap();
var memoize = function memoize(fn) {
var cache = new WeakMap();
const memoizedFn = (obj, path, fallback, index) => {
var memoizedFn = function memoizedFn(obj, path, fallback, index) {
if (typeof obj === "undefined") {

@@ -282,3 +310,3 @@ return fn(obj, path, fallback);

const map = cache.get(obj);
var map = cache.get(obj);

@@ -289,3 +317,3 @@ if (map.has(path)) {

const value = fn(obj, path, fallback, index);
var value = fn(obj, path, fallback, index);
map.set(path, value);

@@ -297,3 +325,3 @@ return value;

};
const memoizedGet = memoize(get);
var memoizedGet = memoize(get);
/**

@@ -318,6 +346,6 @@ * Get value from deeply nested object, based on path

function objectFilter(object, fn) {
const result = {};
Object.keys(object).forEach(key => {
const value = object[key];
const shouldPass = fn(value, key, object);
var result = {};
Object.keys(object).forEach(function (key) {
var value = object[key];
var shouldPass = fn(value, key, object);

@@ -330,4 +358,10 @@ if (shouldPass) {

}
const filterUndefined = object => objectFilter(object, val => val !== null && val !== undefined);
const objectKeys = obj => Object.keys(obj);
var filterUndefined = function filterUndefined(object) {
return objectFilter(object, function (val) {
return val !== null && val !== undefined;
});
};
var objectKeys = function objectKeys(obj) {
return Object.keys(obj);
};
/**

@@ -337,6 +371,10 @@ * Object.entries polyfill for Nodev10 compatibility

const fromEntries = entries => entries.reduce((carry, [key, value]) => {
carry[key] = value;
return carry;
}, {});
var fromEntries = function fromEntries(entries) {
return entries.reduce(function (carry, _ref) {
var key = _ref[0],
value = _ref[1];
carry[key] = value;
return carry;
}, {});
};
/**

@@ -346,11 +384,15 @@ * Get the CSS variable ref stored in the theme

const getCSSVar = (theme, scale, value) => theme.__cssMap[`${scale}.${value}`]?.varRef ?? value;
var getCSSVar = function getCSSVar(theme, scale, value) {
var _theme$__cssMap$$varR, _theme$__cssMap$;
return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + "." + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;
};
function analyzeCSSValue(value) {
const num = parseFloat(value.toString());
const unit = value.toString().replace(String(num), "");
var num = parseFloat(value.toString());
var unit = value.toString().replace(String(num), "");
return {
unitless: !unit,
value: num,
unit
unit: unit
};

@@ -361,14 +403,19 @@ }

if (value == null) return value;
const {
unitless
} = analyzeCSSValue(value);
return unitless || isNumber(value) ? `${value}px` : value;
var _analyzeCSSValue = analyzeCSSValue(value),
unitless = _analyzeCSSValue.unitless;
return unitless || isNumber(value) ? value + "px" : value;
}
const sortByBreakpointValue = (a, b) => parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
var sortByBreakpointValue = function sortByBreakpointValue(a, b) {
return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
};
const sortBps = breakpoints => fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
var sortBps = function sortBps(breakpoints) {
return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
};
function normalize(breakpoints) {
const sorted = sortBps(breakpoints);
var sorted = sortBps(breakpoints);
return Object.assign(Object.values(sorted), sorted);

@@ -378,3 +425,3 @@ }

function keys(breakpoints) {
const value = Object.keys(sortBps(breakpoints));
var value = Object.keys(sortBps(breakpoints));
return new Set(value);

@@ -384,14 +431,18 @@ }

function subtract(value) {
var _px;
if (!value) return value;
value = px(value) ?? value;
const factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
value = (_px = px(value)) != null ? _px : value;
var factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
-0.0635;
return isNumber(value) ? `${value + factor}` : value.replace(/(\d+\.?\d*)/u, m => `${parseFloat(m) + factor}`);
return isNumber(value) ? "" + (value + factor) : value.replace(/([0-9]+\.?[0-9]*)/, function (m) {
return "" + (parseFloat(m) + factor);
});
}
function queryString(min, max) {
const query = [];
if (min) query.push(`@media screen and (min-width: ${px(min)})`);
var query = [];
if (min) query.push("@media screen and (min-width: " + px(min) + ")");
if (query.length > 0 && max) query.push("and");
if (max) query.push(`@media screen and (max-width: ${px(max)})`);
if (max) query.push("@media screen and (max-width: " + px(max) + ")");
return query.join(" ");

@@ -401,12 +452,21 @@ }

function analyzeBreakpoints(breakpoints) {
var _breakpoints$base;
if (!breakpoints) return null;
breakpoints.base = breakpoints.base ?? "0px";
const normalized = normalize(breakpoints);
const queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(([breakpoint, minW], index, entry) => {
let [, maxW] = entry[index + 1] ?? [];
breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : "0px";
var normalized = normalize(breakpoints);
var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {
var _entry;
var breakpoint = _ref[0],
minW = _ref[1];
var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],
maxW = _ref2[1];
maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;
return {
breakpoint,
minW,
maxW,
breakpoint: breakpoint,
minW: minW,
maxW: maxW,
maxWQuery: queryString(null, maxW),

@@ -418,21 +478,22 @@ minWQuery: queryString(minW),

const _keys = keys(breakpoints);
var _keys = keys(breakpoints);
const _keysArr = Array.from(_keys.values());
var _keysArr = Array.from(_keys.values());
return {
keys: _keys,
normalized,
isResponsive(test) {
const keys = Object.keys(test);
return keys.length > 0 && keys.every(key => _keys.has(key));
normalized: normalized,
isResponsive: function isResponsive(test) {
var keys = Object.keys(test);
return keys.length > 0 && keys.every(function (key) {
return _keys.has(key);
});
},
asObject: sortBps(breakpoints),
asArray: normalize(breakpoints),
details: queries,
media: [null, ...normalized.map(minW => queryString(minW)).slice(1)],
toArrayValue(test) {
media: [null].concat(normalized.map(function (minW) {
return queryString(minW);
}).slice(1)),
toArrayValue: function toArrayValue(test) {
if (!isObject(test)) {

@@ -442,4 +503,8 @@ throw new Error("toArrayValue: value must be an object");

const result = _keysArr.map(bp => test[bp] ?? null);
var result = _keysArr.map(function (bp) {
var _test$bp;
return (_test$bp = test[bp]) != null ? _test$bp : null;
});
while (getLastItem(result) === null) {

@@ -451,4 +516,3 @@ result.pop();

},
toObjectValue(test) {
toObjectValue: function toObjectValue(test) {
if (!Array.isArray(test)) {

@@ -458,4 +522,4 @@ throw new Error("toObjectValue: value must be an array");

return test.reduce((acc, value, index) => {
const key = _keysArr[index];
return test.reduce(function (acc, value, index) {
var key = _keysArr[index];
if (key != null && value != null) acc[key] = value;

@@ -465,3 +529,2 @@ return acc;

}
};

@@ -474,2 +537,4 @@ }

function isHTMLElement(el) {
var _el$ownerDocument$def;
if (!isElement(el)) {

@@ -479,13 +544,19 @@ return false;

const win = el.ownerDocument.defaultView ?? window;
var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;
return el instanceof win.HTMLElement;
}
function getOwnerWindow(node) {
return isElement(node) ? getOwnerDocument(node)?.defaultView ?? window : window;
var _getOwnerDocument$def, _getOwnerDocument;
return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
}
function getOwnerDocument(node) {
return isElement(node) ? node.ownerDocument ?? document : document;
var _node$ownerDocument;
return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
}
function getEventWindow(event) {
return event.view ?? window;
var _view;
return (_view = event.view) != null ? _view : window;
}

@@ -495,9 +566,19 @@ function canUseDOM() {

}
const isBrowser = canUseDOM();
const dataAttr = condition => condition ? "" : undefined;
const ariaAttr = condition => condition ? true : undefined;
const cx = (...classNames) => classNames.filter(Boolean).join(" ");
var isBrowser = canUseDOM();
var dataAttr = function dataAttr(condition) {
return condition ? "" : undefined;
};
var ariaAttr = function ariaAttr(condition) {
return condition ? true : undefined;
};
var cx = function cx() {
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
classNames[_key] = arguments[_key];
}
return classNames.filter(Boolean).join(" ");
};
function getActiveElement(node) {
const doc = getOwnerDocument(node);
return doc?.activeElement;
var doc = getOwnerDocument(node);
return doc == null ? void 0 : doc.activeElement;
}

@@ -510,3 +591,3 @@ function contains(parent, child) {

target.addEventListener(eventName, handler, options);
return () => {
return function () {
target.removeEventListener(eventName, handler, options);

@@ -521,14 +602,14 @@ };

function normalizeEventKey(event) {
const {
key,
keyCode
} = event;
const isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
const eventKey = isArrowKey ? `Arrow${key}` : key;
var key = event.key,
keyCode = event.keyCode;
var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
var eventKey = isArrowKey ? "Arrow" + key : key;
return eventKey;
}
function getRelatedTarget(event) {
const target = event.target ?? event.currentTarget;
const activeElement = getActiveElement(target);
return event.relatedTarget ?? activeElement;
var _event$target, _event$relatedTarget;
var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;
var activeElement = getActiveElement(target);
return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;
}

@@ -540,5 +621,11 @@ function isRightClick(event) {

// Really great work done by Diego Haz on this one
const hasDisplayNone = element => window.getComputedStyle(element).display === "none";
const hasTabIndex = element => element.hasAttribute("tabindex");
const hasNegativeTabIndex = element => hasTabIndex(element) && element.tabIndex === -1;
var hasDisplayNone = function hasDisplayNone(element) {
return window.getComputedStyle(element).display === "none";
};
var hasTabIndex = function hasTabIndex(element) {
return element.hasAttribute("tabindex");
};
var hasNegativeTabIndex = function hasNegativeTabIndex(element) {
return hasTabIndex(element) && element.tabIndex === -1;
};
function isDisabled(element) {

@@ -551,3 +638,3 @@ return Boolean(element.getAttribute("disabled")) === true || Boolean(element.getAttribute("aria-disabled")) === true;

function isActiveElement(element) {
const doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
return doc.activeElement === element;

@@ -564,3 +651,3 @@ }

function isContentEditable(element) {
const value = element.getAttribute("contenteditable");
var value = element.getAttribute("contenteditable");
return value !== "false" && value != null;

@@ -573,11 +660,15 @@ }

const {
localName
} = element;
const focusableTags = ["input", "select", "textarea", "button"];
var localName = element.localName;
var focusableTags = ["input", "select", "textarea", "button"];
if (focusableTags.indexOf(localName) >= 0) return true;
const others = {
a: () => element.hasAttribute("href"),
audio: () => element.hasAttribute("controls"),
video: () => element.hasAttribute("controls")
var others = {
a: function a() {
return element.hasAttribute("href");
},
audio: function audio() {
return element.hasAttribute("controls");
},
video: function video() {
return element.hasAttribute("controls");
}
};

@@ -597,16 +688,18 @@

const focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
const focusableElSelector = focusableElList.join();
var focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
var focusableElSelector = focusableElList.join();
function getAllFocusable(container) {
const focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
focusableEls.unshift(container);
return focusableEls.filter(isFocusable).filter(el => window.getComputedStyle(el).display !== "none");
return focusableEls.filter(isFocusable).filter(function (el) {
return window.getComputedStyle(el).display !== "none";
});
}
function getFirstFocusable(container) {
const allFocusable = getAllFocusable(container);
var allFocusable = getAllFocusable(container);
return allFocusable.length ? allFocusable[0] : null;
}
function getAllTabbable(container, fallbackToFocusable) {
const allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
const allTabbable = allFocusable.filter(isTabbable);
var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
var allTabbable = allFocusable.filter(isTabbable);

@@ -624,23 +717,25 @@ if (isTabbable(container)) {

function getFirstTabbableIn(container, fallbackToFocusable) {
const [first] = getAllTabbable(container, fallbackToFocusable);
var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),
first = _getAllTabbable[0];
return first || null;
}
function getLastTabbableIn(container, fallbackToFocusable) {
const allTabbable = getAllTabbable(container, fallbackToFocusable);
var allTabbable = getAllTabbable(container, fallbackToFocusable);
return allTabbable[allTabbable.length - 1] || null;
}
function getNextTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container);
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container);
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function getPreviousTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container).reverse();
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container).reverse();
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function focusNextTabbable(container, fallbackToFocusable) {
const nextTabbable = getNextTabbable(container, fallbackToFocusable);
var nextTabbable = getNextTabbable(container, fallbackToFocusable);

@@ -652,3 +747,3 @@ if (nextTabbable && isHTMLElement(nextTabbable)) {

function focusPreviousTabbable(container, fallbackToFocusable) {
const previousTabbable = getPreviousTabbable(container, fallbackToFocusable);
var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);

@@ -677,26 +772,90 @@ if (previousTabbable && isHTMLElement(previousTabbable)) {

function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
/* eslint-disable no-nested-ternary */
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
function runIfFn(valueOrFn) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;
}
function callAllHandlers(...fns) {
function callAllHandlers() {
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
return function func(event) {
fns.some(fn => {
fn?.(event);
return event?.defaultPrevented;
fns.some(function (fn) {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
function callAll(...fns) {
function callAll() {
for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
fns[_key3] = arguments[_key3];
}
return function mergedFn(arg) {
fns.forEach(fn => {
fn?.(arg);
fns.forEach(function (fn) {
fn == null ? void 0 : fn(arg);
});
};
}
const compose = (fn1, ...fns) => fns.reduce((f1, f2) => (...args) => f1(f2(...args)), fn1);
var compose = function compose(fn1) {
for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
fns[_key4 - 1] = arguments[_key4];
}
return fns.reduce(function (f1, f2) {
return function () {
return f1(f2.apply(void 0, arguments));
};
}, fn1);
};
function once(fn) {
let result;
return function func(...args) {
var result;
return function func() {
if (fn) {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
result = fn.apply(this, args);

@@ -709,29 +868,43 @@ fn = null;

}
const noop = () => {};
const warn = once(options => () => {
const {
condition,
message
} = options;
var noop = function noop() {};
var warn = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.warn(message);
}
if (condition && __DEV__) {
console.warn(message);
}
};
});
const error = once(options => () => {
const {
condition,
message
} = options;
var error = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.error(message);
if (condition && __DEV__) {
console.error(message);
}
};
});
var pipe = function pipe() {
for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
fns[_key6] = arguments[_key6];
}
});
const pipe = (...fns) => v => fns.reduce((a, b) => b(a), v);
const distance1D = (a, b) => Math.abs(a - b);
return function (v) {
return fns.reduce(function (a, b) {
return b(a);
}, v);
};
};
const isPoint = point => "x" in point && "y" in point;
var distance1D = function distance1D(a, b) {
return Math.abs(a - b);
};
var isPoint = function isPoint(point) {
return "x" in point && "y" in point;
};
function distance(a, b) {

@@ -743,5 +916,5 @@ if (isNumber(a) && isNumber(b)) {

if (isPoint(a) && isPoint(b)) {
const xDelta = distance1D(a.x, b.x);
const yDelta = distance1D(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
var xDelta = distance1D(a.x, b.x);
var yDelta = distance1D(a.y, b.y);
return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));
}

@@ -752,10 +925,15 @@

// Original licensing for the following methods can be found in the
function focus(element, options = {}) {
const {
isActive = isActiveElement,
nextTick,
preventScroll = true,
selectTextIfInput = true
} = options;
function focus(element, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$isActive = _options.isActive,
isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,
nextTick = _options.nextTick,
_options$preventScrol = _options.preventScroll,
preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,
_options$selectTextIf = _options.selectTextIfInput,
selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;
if (!element || isActive(element)) return -1;

@@ -774,3 +952,3 @@

element.focus({
preventScroll
preventScroll: preventScroll
});

@@ -781,3 +959,3 @@ } else {

if (preventScroll) {
const scrollableElements = getScrollableElements(element);
var scrollableElements = getScrollableElements(element);
restoreScrollPosition(scrollableElements);

@@ -799,3 +977,3 @@ }

}
let supportsPreventScrollCached = null;
var supportsPreventScrollCached = null;

@@ -807,3 +985,3 @@ function supportsPreventScroll() {

try {
const div = document.createElement("div");
var div = document.createElement("div");
div.focus({

@@ -824,8 +1002,10 @@ get preventScroll() {

function getScrollableElements(element) {
const doc = getOwnerDocument(element);
const win = doc.defaultView ?? window;
let parent = element.parentNode;
const scrollableElements = [];
const rootScrollingElement = doc.scrollingElement || doc.documentElement;
var _doc$defaultView;
var doc = getOwnerDocument(element);
var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;
var parent = element.parentNode;
var scrollableElements = [];
var rootScrollingElement = doc.scrollingElement || doc.documentElement;
while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {

@@ -855,7 +1035,7 @@ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {

function restoreScrollPosition(scrollableElements) {
for (const {
element,
scrollTop,
scrollLeft
} of scrollableElements) {
for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {
var _step$value = _step.value,
element = _step$value.element,
scrollTop = _step$value.scrollTop,
scrollLeft = _step$value.scrollLeft;
element.scrollTop = scrollTop;

@@ -874,8 +1054,7 @@ element.scrollLeft = scrollLeft;

function determineLazyBehavior(options) {
const {
hasBeenSelected,
isLazy,
isSelected,
lazyBehavior = "unmount"
} = options; // if not lazy, always render the disclosure's content
var hasBeenSelected = options.hasBeenSelected,
isLazy = options.isLazy,
isSelected = options.isSelected,
_options$lazyBehavior = options.lazyBehavior,
lazyBehavior = _options$lazyBehavior === void 0 ? "unmount" : _options$lazyBehavior; // if not lazy, always render the disclosure's content

@@ -890,7 +1069,7 @@ if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content

const minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
const maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
var minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
var maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
function toNumber(value) {
const num = parseFloat(value);
var num = parseFloat(value);
return isNotNumber(num) ? 0 : num;

@@ -909,4 +1088,4 @@ }

function toPrecision(value, precision) {
let nextValue = toNumber(value);
const scaleFactor = 10 ** (precision ?? 10);
var nextValue = toNumber(value);
var scaleFactor = Math.pow(10, precision != null ? precision : 10);
nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;

@@ -923,4 +1102,4 @@ return precision ? nextValue.toFixed(precision) : nextValue.toString();

if (!Number.isFinite(value)) return 0;
let e = 1;
let p = 0;
var e = 1;
var p = 0;

@@ -965,4 +1144,4 @@ while (Math.round(value * e) / e !== value) {

function roundValueToStep(value, from, step) {
const nextValue = Math.round((value - from) / step) * step + from;
const precision = countDecimalPlaces(step);
var nextValue = Math.round((value - from) / step) * step + from;
var precision = countDecimalPlaces(step);
return toPrecision(nextValue, precision);

@@ -987,2 +1166,20 @@ }

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**

@@ -993,3 +1190,3 @@ * Credit goes to `framer-motion` of this useful utilities.

function isMouseEvent(event) {
const win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.

@@ -1003,3 +1200,3 @@ if (typeof win.PointerEvent !== "undefined" && event instanceof win.PointerEvent) {

function isTouchEvent(event) {
const hasTouches = !!event.touches;
var hasTouches = !!event.touches;
return hasTouches;

@@ -1013,6 +1210,6 @@ }

function filterPrimaryPointer(eventHandler) {
return event => {
const win = getEventWindow(event);
const isMouseEvent = event instanceof win.MouseEvent;
const isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;
return function (event) {
var win = getEventWindow(event);
var isMouseEvent = event instanceof win.MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;

@@ -1025,3 +1222,3 @@ if (isPrimaryPointer) {

const defaultPagePoint = {
var defaultPagePoint = {
pageX: 0,

@@ -1031,19 +1228,31 @@ pageY: 0

function pointFromTouch(e, pointType = "page") {
const primaryTouch = e.touches[0] || e.changedTouches[0];
const point = primaryTouch || defaultPagePoint;
function pointFromTouch(e, pointType) {
if (pointType === void 0) {
pointType = "page";
}
var primaryTouch = e.touches[0] || e.changedTouches[0];
var point = primaryTouch || defaultPagePoint;
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function pointFromMouse(point, pointType = "page") {
function pointFromMouse(point, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function extractEventInfo(event, pointType = "page") {
function extractEventInfo(event, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {

@@ -1056,15 +1265,27 @@ point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)

}
const wrapPointerEventHandler = (handler, shouldFilterPrimaryPointer = false) => {
const listener = event => handler(event, extractEventInfo(event));
var wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {
if (shouldFilterPrimaryPointer === void 0) {
shouldFilterPrimaryPointer = false;
}
var listener = function listener(event) {
return handler(event, extractEventInfo(event));
};
return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;
}; // We check for event support via functions in case they've been mocked by a testing suite.
const supportsPointerEvents = () => isBrowser && window.onpointerdown === null;
var supportsPointerEvents = function supportsPointerEvents() {
return isBrowser && window.onpointerdown === null;
};
const supportsTouchEvents = () => isBrowser && window.ontouchstart === null;
var supportsTouchEvents = function supportsTouchEvents() {
return isBrowser && window.ontouchstart === null;
};
const supportsMouseEvents = () => isBrowser && window.onmousedown === null;
var supportsMouseEvents = function supportsMouseEvents() {
return isBrowser && window.onmousedown === null;
};
const mouseEventNames = {
var mouseEventNames = {
pointerdown: "mousedown",

@@ -1079,3 +1300,3 @@ pointermove: "mousemove",

};
const touchEventNames = {
var touchEventNames = {
pointerdown: "touchstart",

@@ -1109,8 +1330,2 @@ pointermove: "touchmove",

/**
* This is a modified version of `PanSession` from `framer-motion`.
*
* Credit goes to `framer-motion` of this useful utilities.
* License can be found here: https://github.com/framer/motion
*/
/**
* The event information passed to pan event handlers like `onPan`, `onPanStart`.

@@ -1128,3 +1343,3 @@ *

*/
class PanSession {
var PanSession = /*#__PURE__*/function () {
/**

@@ -1142,3 +1357,5 @@ * We use this to keep track of the `x` and `y` pan session history

*/
constructor(_event, handlers, threshold) {
function PanSession(_event, handlers, threshold) {
var _this = this;
this.history = [];

@@ -1153,36 +1370,40 @@ this.startEvent = null;

this.updatePoint = () => {
if (!(this.lastEvent && this.lastEventInfo)) return;
const info = getPanInfo(this.lastEventInfo, this.history);
const isPanStarted = this.startEvent !== null;
const isDistancePastThreshold = distance(info.offset, {
this.updatePoint = function () {
if (!(_this.lastEvent && _this.lastEventInfo)) return;
var info = getPanInfo(_this.lastEventInfo, _this.history);
var isPanStarted = _this.startEvent !== null;
var isDistancePastThreshold = distance(info.offset, {
x: 0,
y: 0
}) >= this.threshold;
}) >= _this.threshold;
if (!isPanStarted && !isDistancePastThreshold) return;
const {
timestamp
} = sync.getFrameData();
this.history.push({ ...info.point,
timestamp
});
const {
onStart,
onMove
} = this.handlers;
var _getFrameData = sync.getFrameData(),
timestamp = _getFrameData.timestamp;
_this.history.push(_extends({}, info.point, {
timestamp: timestamp
}));
var _this$handlers = _this.handlers,
onStart = _this$handlers.onStart,
onMove = _this$handlers.onMove;
if (!isPanStarted) {
onStart?.(this.lastEvent, info);
this.startEvent = this.lastEvent;
onStart == null ? void 0 : onStart(_this.lastEvent, info);
_this.startEvent = _this.lastEvent;
}
onMove?.(this.lastEvent, info);
onMove == null ? void 0 : onMove(_this.lastEvent, info);
};
this.onPointerMove = (event, info) => {
this.lastEvent = event;
this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
this.onPointerMove = function (event, info) {
_this.lastEvent = event;
_this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
if (isMouseEvent(event) && event.buttons === 0) {
this.onPointerUp(event, info);
_this.onPointerUp(event, info);
return;

@@ -1192,18 +1413,19 @@ } // Throttle mouse move event to once per frame

sync__default["default"].update(this.updatePoint, true);
sync__default["default"].update(_this.updatePoint, true);
};
this.onPointerUp = (event, info) => {
this.onPointerUp = function (event, info) {
// notify pan session ended
const panInfo = getPanInfo(info, this.history);
const {
onEnd,
onSessionEnd
} = this.handlers;
onSessionEnd?.(event, panInfo);
this.end(); // if panning never started, no need to call `onEnd`
var panInfo = getPanInfo(info, _this.history);
var _this$handlers2 = _this.handlers,
onEnd = _this$handlers2.onEnd,
onSessionEnd = _this$handlers2.onSessionEnd;
onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);
_this.end(); // if panning never started, no need to call `onEnd`
// panning requires a pointermove of at least 3px
if (!onEnd || !this.startEvent) return;
onEnd?.(event, panInfo);
if (!onEnd || !_this.startEvent) return;
onEnd == null ? void 0 : onEnd(event, panInfo);
};

@@ -1227,15 +1449,13 @@

const _info = extractEventInfo(_event);
var _info = extractEventInfo(_event);
const {
var _getFrameData2 = sync.getFrameData(),
_timestamp = _getFrameData2.timestamp;
this.history = [_extends({}, _info.point, {
timestamp: _timestamp
} = sync.getFrameData();
this.history = [{ ..._info.point,
timestamp: _timestamp
}]; // notify pan session start
})]; // notify pan session start
const {
onSessionStart
} = handlers;
onSessionStart?.(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all
var onSessionStart = handlers.onSessionStart;
onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all

@@ -1245,12 +1465,17 @@ this.removeListeners = pipe(addPointerEvent(this.win, "pointermove", this.onPointerMove), addPointerEvent(this.win, "pointerup", this.onPointerUp), addPointerEvent(this.win, "pointercancel", this.onPointerUp));

updateHandlers(handlers) {
var _proto = PanSession.prototype;
_proto.updateHandlers = function updateHandlers(handlers) {
this.handlers = handlers;
}
};
end() {
this.removeListeners?.();
_proto.end = function end() {
var _this$removeListeners;
(_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);
sync.cancelSync.update(this.updatePoint);
}
};
}
return PanSession;
}();

@@ -1285,3 +1510,5 @@ function subtractPoint(a, b) {

const toMilliseconds = seconds => seconds * 1000;
var toMilliseconds = function toMilliseconds(seconds) {
return seconds * 1000;
};

@@ -1296,5 +1523,5 @@ function getVelocity(history, timeDelta) {

let i = history.length - 1;
let timestampedPoint = null;
const lastPoint = lastDevicePoint(history);
var i = history.length - 1;
var timestampedPoint = null;
var lastPoint = lastDevicePoint(history);

@@ -1318,3 +1545,3 @@ while (i >= 0) {

const time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;

@@ -1328,3 +1555,3 @@ if (time === 0) {

const currentVelocity = {
var currentVelocity = {
x: (lastPoint.x - timestampedPoint.x) / time,

@@ -1345,6 +1572,6 @@ y: (lastPoint.y - timestampedPoint.y) / time

const breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
var breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
function mapResponsive(prop, mapper) {
if (isArray(prop)) {
return prop.map(item => {
return prop.map(function (item) {
if (item === null) {

@@ -1359,3 +1586,3 @@ return null;

if (isObject(prop)) {
return objectKeys(prop).reduce((result, key) => {
return objectKeys(prop).reduce(function (result, key) {
result[key] = mapper(prop[key]);

@@ -1372,5 +1599,13 @@ return result;

}
function objectToArrayNotation(obj, bps = breakpoints) {
const result = bps.map(br => obj[br] ?? null);
function objectToArrayNotation(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = bps.map(function (br) {
var _obj$br;
return (_obj$br = obj[br]) != null ? _obj$br : null;
});
while (getLastItem(result) === null) {

@@ -1382,6 +1617,10 @@ result.pop();

}
function arrayToObjectNotation(values, bps = breakpoints) {
const result = {};
values.forEach((value, index) => {
const key = bps[index];
function arrayToObjectNotation(values, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = {};
values.forEach(function (value, index) {
var key = bps[index];
if (value == null) return;

@@ -1392,5 +1631,11 @@ result[key] = value;

}
function isResponsiveObjectLike(obj, bps = breakpoints) {
const keys = Object.keys(obj);
return keys.length > 0 && keys.every(key => bps.includes(key));
function isResponsiveObjectLike(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var keys = Object.keys(obj);
return keys.length > 0 && keys.every(function (key) {
return bps.includes(key);
});
}

@@ -1405,10 +1650,10 @@ /**

const isCustomBreakpoint = maybeBreakpoint => Number.isNaN(Number(maybeBreakpoint));
var isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {
return Number.isNaN(Number(maybeBreakpoint));
};
function getUserAgentBrowser(navigator) {
const {
userAgent: ua,
vendor
} = navigator;
const android = /(android)/i.test(ua);
var ua = navigator.userAgent,
vendor = navigator.vendor;
var android = /(android)/i.test(ua);

@@ -1449,6 +1694,4 @@ switch (true) {

function getUserAgentOS(navigator) {
const {
userAgent: ua,
platform
} = navigator;
var ua = navigator.userAgent,
platform = navigator.platform;

@@ -1480,5 +1723,3 @@ switch (true) {

function detectDeviceType(navigator) {
const {
userAgent: ua
} = navigator;
var ua = navigator.userAgent;
if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return "tablet";

@@ -1502,9 +1743,19 @@ if (/(mobi)/i.test(ua)) return "phone";

function walkObject(target, predicate) {
function inner(value, path = []) {
function inner(value, path) {
if (path === void 0) {
path = [];
}
if (isArray(value)) {
return value.map((item, index) => inner(item, [...path, String(index)]));
return value.map(function (item, index) {
return inner(item, [].concat(path, [String(index)]));
});
}
if (isObject(value)) {
return fromEntries(Object.entries(value).map(([key, child]) => [key, inner(child, [...path, key])]));
return fromEntries(Object.entries(value).map(function (_ref) {
var key = _ref[0],
child = _ref[1];
return [key, inner(child, [].concat(path, [key]))];
}));
}

@@ -1511,0 +1762,0 @@

@@ -18,21 +18,33 @@ 'use strict';

function getLastItem(array) {
const length = array == null ? 0 : array.length;
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
function getPrevItem(index, array, loop = true) {
const prevIndex = getPrevIndex(index, array.length, loop);
function getPrevItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var prevIndex = getPrevIndex(index, array.length, loop);
return array[prevIndex];
}
function getNextItem(index, array, loop = true) {
const nextIndex = getNextIndex(index, array.length, 1, loop);
function getNextItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var nextIndex = getNextIndex(index, array.length, 1, loop);
return array[nextIndex];
}
function removeIndex(array, index) {
return array.filter((_, idx) => idx !== index);
return array.filter(function (_, idx) {
return idx !== index;
});
}
function addItem(array, item) {
return [...array, item];
return [].concat(array, [item]);
}
function removeItem(array, item) {
return array.filter(eachItem => eachItem !== item);
return array.filter(function (eachItem) {
return eachItem !== item;
});
}

@@ -48,5 +60,13 @@ /**

function getNextIndex(currentIndex, length, step = 1, loop = true) {
const lastIndex = length - 1;
function getNextIndex(currentIndex, length, step, loop) {
if (step === void 0) {
step = 1;
}
if (loop === void 0) {
loop = true;
}
var lastIndex = length - 1;
if (currentIndex === -1) {

@@ -56,3 +76,3 @@ return step > 0 ? 0 : lastIndex;

const nextIndex = currentIndex + step;
var nextIndex = currentIndex + step;

@@ -80,3 +100,7 @@ if (nextIndex < 0) {

function getPrevIndex(index, count, loop = true) {
function getPrevIndex(index, count, loop) {
if (loop === void 0) {
loop = true;
}
return getNextIndex(index, count, -1, loop);

@@ -92,3 +116,3 @@ }

function chunk(array, size) {
return array.reduce((rows, currentValue, index) => {
return array.reduce(function (rows, currentValue, index) {
if (index % size === 0) {

@@ -119,3 +143,5 @@ rows.push([currentValue]);

if (!currentItem) {
const foundItem = items.find(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase()));
var foundItem = items.find(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
});
return foundItem;

@@ -125,9 +151,11 @@ } // Filter items for ones that match the search string (case insensitive)

const matchingItems = items.filter(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase())); // If there's a match, let's get the next item to select
var matchingItems = items.filter(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
}); // If there's a match, let's get the next item to select
if (matchingItems.length > 0) {
let nextIndex; // If the currentItem is in the available items, we move to the next available option
var nextIndex; // If the currentItem is in the available items, we move to the next available option
if (matchingItems.includes(currentItem)) {
const currentIndex = matchingItems.indexOf(currentItem);
var currentIndex = matchingItems.indexOf(currentItem);
nextIndex = currentIndex + 1;

@@ -181,3 +209,3 @@

function isObject(value) {
const type = typeof value;
var type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);

@@ -208,4 +236,4 @@ }

}
const __DEV__ = "production" !== "production";
const __TEST__ = "production" === "test";
var __DEV__ = "production" !== "production";
var __TEST__ = "production" === "test";
function isRefObject(val) {

@@ -219,4 +247,4 @@ return "current" in val;

function omit(object, keys) {
const result = {};
Object.keys(object).forEach(key => {
var result = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) return;

@@ -228,4 +256,4 @@ result[key] = object[key];

function pick(object, keys) {
const result = {};
keys.forEach(key => {
var result = {};
keys.forEach(function (key) {
if (key in object) {

@@ -238,5 +266,5 @@ result[key] = object[key];

function split(object, keys) {
const picked = {};
const omitted = {};
Object.keys(object).forEach(key => {
var picked = {};
var omitted = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) {

@@ -259,3 +287,3 @@ picked[key] = object[key];

function get(obj, path, fallback, index) {
const key = typeof path === "string" ? path.split(".") : [path];
var key = typeof path === "string" ? path.split(".") : [path];

@@ -269,6 +297,6 @@ for (index = 0; index < key.length; index += 1) {

}
const memoize = fn => {
const cache = new WeakMap();
var memoize = function memoize(fn) {
var cache = new WeakMap();
const memoizedFn = (obj, path, fallback, index) => {
var memoizedFn = function memoizedFn(obj, path, fallback, index) {
if (typeof obj === "undefined") {

@@ -282,3 +310,3 @@ return fn(obj, path, fallback);

const map = cache.get(obj);
var map = cache.get(obj);

@@ -289,3 +317,3 @@ if (map.has(path)) {

const value = fn(obj, path, fallback, index);
var value = fn(obj, path, fallback, index);
map.set(path, value);

@@ -297,3 +325,3 @@ return value;

};
const memoizedGet = memoize(get);
var memoizedGet = memoize(get);
/**

@@ -318,6 +346,6 @@ * Get value from deeply nested object, based on path

function objectFilter(object, fn) {
const result = {};
Object.keys(object).forEach(key => {
const value = object[key];
const shouldPass = fn(value, key, object);
var result = {};
Object.keys(object).forEach(function (key) {
var value = object[key];
var shouldPass = fn(value, key, object);

@@ -330,4 +358,10 @@ if (shouldPass) {

}
const filterUndefined = object => objectFilter(object, val => val !== null && val !== undefined);
const objectKeys = obj => Object.keys(obj);
var filterUndefined = function filterUndefined(object) {
return objectFilter(object, function (val) {
return val !== null && val !== undefined;
});
};
var objectKeys = function objectKeys(obj) {
return Object.keys(obj);
};
/**

@@ -337,6 +371,10 @@ * Object.entries polyfill for Nodev10 compatibility

const fromEntries = entries => entries.reduce((carry, [key, value]) => {
carry[key] = value;
return carry;
}, {});
var fromEntries = function fromEntries(entries) {
return entries.reduce(function (carry, _ref) {
var key = _ref[0],
value = _ref[1];
carry[key] = value;
return carry;
}, {});
};
/**

@@ -346,11 +384,15 @@ * Get the CSS variable ref stored in the theme

const getCSSVar = (theme, scale, value) => theme.__cssMap[`${scale}.${value}`]?.varRef ?? value;
var getCSSVar = function getCSSVar(theme, scale, value) {
var _theme$__cssMap$$varR, _theme$__cssMap$;
return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + "." + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;
};
function analyzeCSSValue(value) {
const num = parseFloat(value.toString());
const unit = value.toString().replace(String(num), "");
var num = parseFloat(value.toString());
var unit = value.toString().replace(String(num), "");
return {
unitless: !unit,
value: num,
unit
unit: unit
};

@@ -361,14 +403,19 @@ }

if (value == null) return value;
const {
unitless
} = analyzeCSSValue(value);
return unitless || isNumber(value) ? `${value}px` : value;
var _analyzeCSSValue = analyzeCSSValue(value),
unitless = _analyzeCSSValue.unitless;
return unitless || isNumber(value) ? value + "px" : value;
}
const sortByBreakpointValue = (a, b) => parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
var sortByBreakpointValue = function sortByBreakpointValue(a, b) {
return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
};
const sortBps = breakpoints => fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
var sortBps = function sortBps(breakpoints) {
return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
};
function normalize(breakpoints) {
const sorted = sortBps(breakpoints);
var sorted = sortBps(breakpoints);
return Object.assign(Object.values(sorted), sorted);

@@ -378,3 +425,3 @@ }

function keys(breakpoints) {
const value = Object.keys(sortBps(breakpoints));
var value = Object.keys(sortBps(breakpoints));
return new Set(value);

@@ -384,14 +431,18 @@ }

function subtract(value) {
var _px;
if (!value) return value;
value = px(value) ?? value;
const factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
value = (_px = px(value)) != null ? _px : value;
var factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
-0.0635;
return isNumber(value) ? `${value + factor}` : value.replace(/(\d+\.?\d*)/u, m => `${parseFloat(m) + factor}`);
return isNumber(value) ? "" + (value + factor) : value.replace(/([0-9]+\.?[0-9]*)/, function (m) {
return "" + (parseFloat(m) + factor);
});
}
function queryString(min, max) {
const query = [];
if (min) query.push(`@media screen and (min-width: ${px(min)})`);
var query = [];
if (min) query.push("@media screen and (min-width: " + px(min) + ")");
if (query.length > 0 && max) query.push("and");
if (max) query.push(`@media screen and (max-width: ${px(max)})`);
if (max) query.push("@media screen and (max-width: " + px(max) + ")");
return query.join(" ");

@@ -401,12 +452,21 @@ }

function analyzeBreakpoints(breakpoints) {
var _breakpoints$base;
if (!breakpoints) return null;
breakpoints.base = breakpoints.base ?? "0px";
const normalized = normalize(breakpoints);
const queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(([breakpoint, minW], index, entry) => {
let [, maxW] = entry[index + 1] ?? [];
breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : "0px";
var normalized = normalize(breakpoints);
var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {
var _entry;
var breakpoint = _ref[0],
minW = _ref[1];
var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],
maxW = _ref2[1];
maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;
return {
breakpoint,
minW,
maxW,
breakpoint: breakpoint,
minW: minW,
maxW: maxW,
maxWQuery: queryString(null, maxW),

@@ -418,21 +478,22 @@ minWQuery: queryString(minW),

const _keys = keys(breakpoints);
var _keys = keys(breakpoints);
const _keysArr = Array.from(_keys.values());
var _keysArr = Array.from(_keys.values());
return {
keys: _keys,
normalized,
isResponsive(test) {
const keys = Object.keys(test);
return keys.length > 0 && keys.every(key => _keys.has(key));
normalized: normalized,
isResponsive: function isResponsive(test) {
var keys = Object.keys(test);
return keys.length > 0 && keys.every(function (key) {
return _keys.has(key);
});
},
asObject: sortBps(breakpoints),
asArray: normalize(breakpoints),
details: queries,
media: [null, ...normalized.map(minW => queryString(minW)).slice(1)],
toArrayValue(test) {
media: [null].concat(normalized.map(function (minW) {
return queryString(minW);
}).slice(1)),
toArrayValue: function toArrayValue(test) {
if (!isObject(test)) {

@@ -442,4 +503,8 @@ throw new Error("toArrayValue: value must be an object");

const result = _keysArr.map(bp => test[bp] ?? null);
var result = _keysArr.map(function (bp) {
var _test$bp;
return (_test$bp = test[bp]) != null ? _test$bp : null;
});
while (getLastItem(result) === null) {

@@ -451,4 +516,3 @@ result.pop();

},
toObjectValue(test) {
toObjectValue: function toObjectValue(test) {
if (!Array.isArray(test)) {

@@ -458,4 +522,4 @@ throw new Error("toObjectValue: value must be an array");

return test.reduce((acc, value, index) => {
const key = _keysArr[index];
return test.reduce(function (acc, value, index) {
var key = _keysArr[index];
if (key != null && value != null) acc[key] = value;

@@ -465,3 +529,2 @@ return acc;

}
};

@@ -474,2 +537,4 @@ }

function isHTMLElement(el) {
var _el$ownerDocument$def;
if (!isElement(el)) {

@@ -479,13 +544,19 @@ return false;

const win = el.ownerDocument.defaultView ?? window;
var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;
return el instanceof win.HTMLElement;
}
function getOwnerWindow(node) {
return isElement(node) ? getOwnerDocument(node)?.defaultView ?? window : window;
var _getOwnerDocument$def, _getOwnerDocument;
return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
}
function getOwnerDocument(node) {
return isElement(node) ? node.ownerDocument ?? document : document;
var _node$ownerDocument;
return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
}
function getEventWindow(event) {
return event.view ?? window;
var _view;
return (_view = event.view) != null ? _view : window;
}

@@ -495,9 +566,19 @@ function canUseDOM() {

}
const isBrowser = canUseDOM();
const dataAttr = condition => condition ? "" : undefined;
const ariaAttr = condition => condition ? true : undefined;
const cx = (...classNames) => classNames.filter(Boolean).join(" ");
var isBrowser = canUseDOM();
var dataAttr = function dataAttr(condition) {
return condition ? "" : undefined;
};
var ariaAttr = function ariaAttr(condition) {
return condition ? true : undefined;
};
var cx = function cx() {
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
classNames[_key] = arguments[_key];
}
return classNames.filter(Boolean).join(" ");
};
function getActiveElement(node) {
const doc = getOwnerDocument(node);
return doc?.activeElement;
var doc = getOwnerDocument(node);
return doc == null ? void 0 : doc.activeElement;
}

@@ -510,3 +591,3 @@ function contains(parent, child) {

target.addEventListener(eventName, handler, options);
return () => {
return function () {
target.removeEventListener(eventName, handler, options);

@@ -521,14 +602,14 @@ };

function normalizeEventKey(event) {
const {
key,
keyCode
} = event;
const isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
const eventKey = isArrowKey ? `Arrow${key}` : key;
var key = event.key,
keyCode = event.keyCode;
var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
var eventKey = isArrowKey ? "Arrow" + key : key;
return eventKey;
}
function getRelatedTarget(event) {
const target = event.target ?? event.currentTarget;
const activeElement = getActiveElement(target);
return event.relatedTarget ?? activeElement;
var _event$target, _event$relatedTarget;
var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;
var activeElement = getActiveElement(target);
return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;
}

@@ -540,5 +621,11 @@ function isRightClick(event) {

// Really great work done by Diego Haz on this one
const hasDisplayNone = element => window.getComputedStyle(element).display === "none";
const hasTabIndex = element => element.hasAttribute("tabindex");
const hasNegativeTabIndex = element => hasTabIndex(element) && element.tabIndex === -1;
var hasDisplayNone = function hasDisplayNone(element) {
return window.getComputedStyle(element).display === "none";
};
var hasTabIndex = function hasTabIndex(element) {
return element.hasAttribute("tabindex");
};
var hasNegativeTabIndex = function hasNegativeTabIndex(element) {
return hasTabIndex(element) && element.tabIndex === -1;
};
function isDisabled(element) {

@@ -551,3 +638,3 @@ return Boolean(element.getAttribute("disabled")) === true || Boolean(element.getAttribute("aria-disabled")) === true;

function isActiveElement(element) {
const doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
return doc.activeElement === element;

@@ -564,3 +651,3 @@ }

function isContentEditable(element) {
const value = element.getAttribute("contenteditable");
var value = element.getAttribute("contenteditable");
return value !== "false" && value != null;

@@ -573,11 +660,15 @@ }

const {
localName
} = element;
const focusableTags = ["input", "select", "textarea", "button"];
var localName = element.localName;
var focusableTags = ["input", "select", "textarea", "button"];
if (focusableTags.indexOf(localName) >= 0) return true;
const others = {
a: () => element.hasAttribute("href"),
audio: () => element.hasAttribute("controls"),
video: () => element.hasAttribute("controls")
var others = {
a: function a() {
return element.hasAttribute("href");
},
audio: function audio() {
return element.hasAttribute("controls");
},
video: function video() {
return element.hasAttribute("controls");
}
};

@@ -597,16 +688,18 @@

const focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
const focusableElSelector = focusableElList.join();
var focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
var focusableElSelector = focusableElList.join();
function getAllFocusable(container) {
const focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
focusableEls.unshift(container);
return focusableEls.filter(isFocusable).filter(el => window.getComputedStyle(el).display !== "none");
return focusableEls.filter(isFocusable).filter(function (el) {
return window.getComputedStyle(el).display !== "none";
});
}
function getFirstFocusable(container) {
const allFocusable = getAllFocusable(container);
var allFocusable = getAllFocusable(container);
return allFocusable.length ? allFocusable[0] : null;
}
function getAllTabbable(container, fallbackToFocusable) {
const allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
const allTabbable = allFocusable.filter(isTabbable);
var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
var allTabbable = allFocusable.filter(isTabbable);

@@ -624,23 +717,25 @@ if (isTabbable(container)) {

function getFirstTabbableIn(container, fallbackToFocusable) {
const [first] = getAllTabbable(container, fallbackToFocusable);
var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),
first = _getAllTabbable[0];
return first || null;
}
function getLastTabbableIn(container, fallbackToFocusable) {
const allTabbable = getAllTabbable(container, fallbackToFocusable);
var allTabbable = getAllTabbable(container, fallbackToFocusable);
return allTabbable[allTabbable.length - 1] || null;
}
function getNextTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container);
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container);
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function getPreviousTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container).reverse();
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container).reverse();
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function focusNextTabbable(container, fallbackToFocusable) {
const nextTabbable = getNextTabbable(container, fallbackToFocusable);
var nextTabbable = getNextTabbable(container, fallbackToFocusable);

@@ -652,3 +747,3 @@ if (nextTabbable && isHTMLElement(nextTabbable)) {

function focusPreviousTabbable(container, fallbackToFocusable) {
const previousTabbable = getPreviousTabbable(container, fallbackToFocusable);
var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);

@@ -677,26 +772,90 @@ if (previousTabbable && isHTMLElement(previousTabbable)) {

function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
/* eslint-disable no-nested-ternary */
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
function runIfFn(valueOrFn) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;
}
function callAllHandlers(...fns) {
function callAllHandlers() {
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
return function func(event) {
fns.some(fn => {
fn?.(event);
return event?.defaultPrevented;
fns.some(function (fn) {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
function callAll(...fns) {
function callAll() {
for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
fns[_key3] = arguments[_key3];
}
return function mergedFn(arg) {
fns.forEach(fn => {
fn?.(arg);
fns.forEach(function (fn) {
fn == null ? void 0 : fn(arg);
});
};
}
const compose = (fn1, ...fns) => fns.reduce((f1, f2) => (...args) => f1(f2(...args)), fn1);
var compose = function compose(fn1) {
for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
fns[_key4 - 1] = arguments[_key4];
}
return fns.reduce(function (f1, f2) {
return function () {
return f1(f2.apply(void 0, arguments));
};
}, fn1);
};
function once(fn) {
let result;
return function func(...args) {
var result;
return function func() {
if (fn) {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
result = fn.apply(this, args);

@@ -709,29 +868,43 @@ fn = null;

}
const noop = () => {};
const warn = once(options => () => {
const {
condition,
message
} = options;
var noop = function noop() {};
var warn = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.warn(message);
}
if (condition && __DEV__) {
console.warn(message);
}
};
});
const error = once(options => () => {
const {
condition,
message
} = options;
var error = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.error(message);
if (condition && __DEV__) {
console.error(message);
}
};
});
var pipe = function pipe() {
for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
fns[_key6] = arguments[_key6];
}
});
const pipe = (...fns) => v => fns.reduce((a, b) => b(a), v);
const distance1D = (a, b) => Math.abs(a - b);
return function (v) {
return fns.reduce(function (a, b) {
return b(a);
}, v);
};
};
const isPoint = point => "x" in point && "y" in point;
var distance1D = function distance1D(a, b) {
return Math.abs(a - b);
};
var isPoint = function isPoint(point) {
return "x" in point && "y" in point;
};
function distance(a, b) {

@@ -743,5 +916,5 @@ if (isNumber(a) && isNumber(b)) {

if (isPoint(a) && isPoint(b)) {
const xDelta = distance1D(a.x, b.x);
const yDelta = distance1D(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
var xDelta = distance1D(a.x, b.x);
var yDelta = distance1D(a.y, b.y);
return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));
}

@@ -752,10 +925,15 @@

// Original licensing for the following methods can be found in the
function focus(element, options = {}) {
const {
isActive = isActiveElement,
nextTick,
preventScroll = true,
selectTextIfInput = true
} = options;
function focus(element, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$isActive = _options.isActive,
isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,
nextTick = _options.nextTick,
_options$preventScrol = _options.preventScroll,
preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,
_options$selectTextIf = _options.selectTextIfInput,
selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;
if (!element || isActive(element)) return -1;

@@ -774,3 +952,3 @@

element.focus({
preventScroll
preventScroll: preventScroll
});

@@ -781,3 +959,3 @@ } else {

if (preventScroll) {
const scrollableElements = getScrollableElements(element);
var scrollableElements = getScrollableElements(element);
restoreScrollPosition(scrollableElements);

@@ -799,3 +977,3 @@ }

}
let supportsPreventScrollCached = null;
var supportsPreventScrollCached = null;

@@ -807,3 +985,3 @@ function supportsPreventScroll() {

try {
const div = document.createElement("div");
var div = document.createElement("div");
div.focus({

@@ -824,8 +1002,10 @@ get preventScroll() {

function getScrollableElements(element) {
const doc = getOwnerDocument(element);
const win = doc.defaultView ?? window;
let parent = element.parentNode;
const scrollableElements = [];
const rootScrollingElement = doc.scrollingElement || doc.documentElement;
var _doc$defaultView;
var doc = getOwnerDocument(element);
var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;
var parent = element.parentNode;
var scrollableElements = [];
var rootScrollingElement = doc.scrollingElement || doc.documentElement;
while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {

@@ -855,7 +1035,7 @@ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {

function restoreScrollPosition(scrollableElements) {
for (const {
element,
scrollTop,
scrollLeft
} of scrollableElements) {
for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {
var _step$value = _step.value,
element = _step$value.element,
scrollTop = _step$value.scrollTop,
scrollLeft = _step$value.scrollLeft;
element.scrollTop = scrollTop;

@@ -874,8 +1054,7 @@ element.scrollLeft = scrollLeft;

function determineLazyBehavior(options) {
const {
hasBeenSelected,
isLazy,
isSelected,
lazyBehavior = "unmount"
} = options; // if not lazy, always render the disclosure's content
var hasBeenSelected = options.hasBeenSelected,
isLazy = options.isLazy,
isSelected = options.isSelected,
_options$lazyBehavior = options.lazyBehavior,
lazyBehavior = _options$lazyBehavior === void 0 ? "unmount" : _options$lazyBehavior; // if not lazy, always render the disclosure's content

@@ -890,7 +1069,7 @@ if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content

const minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
const maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
var minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
var maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
function toNumber(value) {
const num = parseFloat(value);
var num = parseFloat(value);
return isNotNumber(num) ? 0 : num;

@@ -909,4 +1088,4 @@ }

function toPrecision(value, precision) {
let nextValue = toNumber(value);
const scaleFactor = 10 ** (precision ?? 10);
var nextValue = toNumber(value);
var scaleFactor = Math.pow(10, precision != null ? precision : 10);
nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;

@@ -923,4 +1102,4 @@ return precision ? nextValue.toFixed(precision) : nextValue.toString();

if (!Number.isFinite(value)) return 0;
let e = 1;
let p = 0;
var e = 1;
var p = 0;

@@ -965,4 +1144,4 @@ while (Math.round(value * e) / e !== value) {

function roundValueToStep(value, from, step) {
const nextValue = Math.round((value - from) / step) * step + from;
const precision = countDecimalPlaces(step);
var nextValue = Math.round((value - from) / step) * step + from;
var precision = countDecimalPlaces(step);
return toPrecision(nextValue, precision);

@@ -987,2 +1166,20 @@ }

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**

@@ -993,3 +1190,3 @@ * Credit goes to `framer-motion` of this useful utilities.

function isMouseEvent(event) {
const win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.

@@ -1003,3 +1200,3 @@ if (typeof win.PointerEvent !== "undefined" && event instanceof win.PointerEvent) {

function isTouchEvent(event) {
const hasTouches = !!event.touches;
var hasTouches = !!event.touches;
return hasTouches;

@@ -1013,6 +1210,6 @@ }

function filterPrimaryPointer(eventHandler) {
return event => {
const win = getEventWindow(event);
const isMouseEvent = event instanceof win.MouseEvent;
const isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;
return function (event) {
var win = getEventWindow(event);
var isMouseEvent = event instanceof win.MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;

@@ -1025,3 +1222,3 @@ if (isPrimaryPointer) {

const defaultPagePoint = {
var defaultPagePoint = {
pageX: 0,

@@ -1031,19 +1228,31 @@ pageY: 0

function pointFromTouch(e, pointType = "page") {
const primaryTouch = e.touches[0] || e.changedTouches[0];
const point = primaryTouch || defaultPagePoint;
function pointFromTouch(e, pointType) {
if (pointType === void 0) {
pointType = "page";
}
var primaryTouch = e.touches[0] || e.changedTouches[0];
var point = primaryTouch || defaultPagePoint;
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function pointFromMouse(point, pointType = "page") {
function pointFromMouse(point, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function extractEventInfo(event, pointType = "page") {
function extractEventInfo(event, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {

@@ -1056,15 +1265,27 @@ point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)

}
const wrapPointerEventHandler = (handler, shouldFilterPrimaryPointer = false) => {
const listener = event => handler(event, extractEventInfo(event));
var wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {
if (shouldFilterPrimaryPointer === void 0) {
shouldFilterPrimaryPointer = false;
}
var listener = function listener(event) {
return handler(event, extractEventInfo(event));
};
return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;
}; // We check for event support via functions in case they've been mocked by a testing suite.
const supportsPointerEvents = () => isBrowser && window.onpointerdown === null;
var supportsPointerEvents = function supportsPointerEvents() {
return isBrowser && window.onpointerdown === null;
};
const supportsTouchEvents = () => isBrowser && window.ontouchstart === null;
var supportsTouchEvents = function supportsTouchEvents() {
return isBrowser && window.ontouchstart === null;
};
const supportsMouseEvents = () => isBrowser && window.onmousedown === null;
var supportsMouseEvents = function supportsMouseEvents() {
return isBrowser && window.onmousedown === null;
};
const mouseEventNames = {
var mouseEventNames = {
pointerdown: "mousedown",

@@ -1079,3 +1300,3 @@ pointermove: "mousemove",

};
const touchEventNames = {
var touchEventNames = {
pointerdown: "touchstart",

@@ -1109,8 +1330,2 @@ pointermove: "touchmove",

/**
* This is a modified version of `PanSession` from `framer-motion`.
*
* Credit goes to `framer-motion` of this useful utilities.
* License can be found here: https://github.com/framer/motion
*/
/**
* The event information passed to pan event handlers like `onPan`, `onPanStart`.

@@ -1128,3 +1343,3 @@ *

*/
class PanSession {
var PanSession = /*#__PURE__*/function () {
/**

@@ -1142,3 +1357,5 @@ * We use this to keep track of the `x` and `y` pan session history

*/
constructor(_event, handlers, threshold) {
function PanSession(_event, handlers, threshold) {
var _this = this;
this.history = [];

@@ -1153,36 +1370,40 @@ this.startEvent = null;

this.updatePoint = () => {
if (!(this.lastEvent && this.lastEventInfo)) return;
const info = getPanInfo(this.lastEventInfo, this.history);
const isPanStarted = this.startEvent !== null;
const isDistancePastThreshold = distance(info.offset, {
this.updatePoint = function () {
if (!(_this.lastEvent && _this.lastEventInfo)) return;
var info = getPanInfo(_this.lastEventInfo, _this.history);
var isPanStarted = _this.startEvent !== null;
var isDistancePastThreshold = distance(info.offset, {
x: 0,
y: 0
}) >= this.threshold;
}) >= _this.threshold;
if (!isPanStarted && !isDistancePastThreshold) return;
const {
timestamp
} = sync.getFrameData();
this.history.push({ ...info.point,
timestamp
});
const {
onStart,
onMove
} = this.handlers;
var _getFrameData = sync.getFrameData(),
timestamp = _getFrameData.timestamp;
_this.history.push(_extends({}, info.point, {
timestamp: timestamp
}));
var _this$handlers = _this.handlers,
onStart = _this$handlers.onStart,
onMove = _this$handlers.onMove;
if (!isPanStarted) {
onStart?.(this.lastEvent, info);
this.startEvent = this.lastEvent;
onStart == null ? void 0 : onStart(_this.lastEvent, info);
_this.startEvent = _this.lastEvent;
}
onMove?.(this.lastEvent, info);
onMove == null ? void 0 : onMove(_this.lastEvent, info);
};
this.onPointerMove = (event, info) => {
this.lastEvent = event;
this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
this.onPointerMove = function (event, info) {
_this.lastEvent = event;
_this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
if (isMouseEvent(event) && event.buttons === 0) {
this.onPointerUp(event, info);
_this.onPointerUp(event, info);
return;

@@ -1192,18 +1413,19 @@ } // Throttle mouse move event to once per frame

sync__default["default"].update(this.updatePoint, true);
sync__default["default"].update(_this.updatePoint, true);
};
this.onPointerUp = (event, info) => {
this.onPointerUp = function (event, info) {
// notify pan session ended
const panInfo = getPanInfo(info, this.history);
const {
onEnd,
onSessionEnd
} = this.handlers;
onSessionEnd?.(event, panInfo);
this.end(); // if panning never started, no need to call `onEnd`
var panInfo = getPanInfo(info, _this.history);
var _this$handlers2 = _this.handlers,
onEnd = _this$handlers2.onEnd,
onSessionEnd = _this$handlers2.onSessionEnd;
onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);
_this.end(); // if panning never started, no need to call `onEnd`
// panning requires a pointermove of at least 3px
if (!onEnd || !this.startEvent) return;
onEnd?.(event, panInfo);
if (!onEnd || !_this.startEvent) return;
onEnd == null ? void 0 : onEnd(event, panInfo);
};

@@ -1227,15 +1449,13 @@

const _info = extractEventInfo(_event);
var _info = extractEventInfo(_event);
const {
var _getFrameData2 = sync.getFrameData(),
_timestamp = _getFrameData2.timestamp;
this.history = [_extends({}, _info.point, {
timestamp: _timestamp
} = sync.getFrameData();
this.history = [{ ..._info.point,
timestamp: _timestamp
}]; // notify pan session start
})]; // notify pan session start
const {
onSessionStart
} = handlers;
onSessionStart?.(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all
var onSessionStart = handlers.onSessionStart;
onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all

@@ -1245,12 +1465,17 @@ this.removeListeners = pipe(addPointerEvent(this.win, "pointermove", this.onPointerMove), addPointerEvent(this.win, "pointerup", this.onPointerUp), addPointerEvent(this.win, "pointercancel", this.onPointerUp));

updateHandlers(handlers) {
var _proto = PanSession.prototype;
_proto.updateHandlers = function updateHandlers(handlers) {
this.handlers = handlers;
}
};
end() {
this.removeListeners?.();
_proto.end = function end() {
var _this$removeListeners;
(_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);
sync.cancelSync.update(this.updatePoint);
}
};
}
return PanSession;
}();

@@ -1285,3 +1510,5 @@ function subtractPoint(a, b) {

const toMilliseconds = seconds => seconds * 1000;
var toMilliseconds = function toMilliseconds(seconds) {
return seconds * 1000;
};

@@ -1296,5 +1523,5 @@ function getVelocity(history, timeDelta) {

let i = history.length - 1;
let timestampedPoint = null;
const lastPoint = lastDevicePoint(history);
var i = history.length - 1;
var timestampedPoint = null;
var lastPoint = lastDevicePoint(history);

@@ -1318,3 +1545,3 @@ while (i >= 0) {

const time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;

@@ -1328,3 +1555,3 @@ if (time === 0) {

const currentVelocity = {
var currentVelocity = {
x: (lastPoint.x - timestampedPoint.x) / time,

@@ -1345,6 +1572,6 @@ y: (lastPoint.y - timestampedPoint.y) / time

const breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
var breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
function mapResponsive(prop, mapper) {
if (isArray(prop)) {
return prop.map(item => {
return prop.map(function (item) {
if (item === null) {

@@ -1359,3 +1586,3 @@ return null;

if (isObject(prop)) {
return objectKeys(prop).reduce((result, key) => {
return objectKeys(prop).reduce(function (result, key) {
result[key] = mapper(prop[key]);

@@ -1372,5 +1599,13 @@ return result;

}
function objectToArrayNotation(obj, bps = breakpoints) {
const result = bps.map(br => obj[br] ?? null);
function objectToArrayNotation(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = bps.map(function (br) {
var _obj$br;
return (_obj$br = obj[br]) != null ? _obj$br : null;
});
while (getLastItem(result) === null) {

@@ -1382,6 +1617,10 @@ result.pop();

}
function arrayToObjectNotation(values, bps = breakpoints) {
const result = {};
values.forEach((value, index) => {
const key = bps[index];
function arrayToObjectNotation(values, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = {};
values.forEach(function (value, index) {
var key = bps[index];
if (value == null) return;

@@ -1392,5 +1631,11 @@ result[key] = value;

}
function isResponsiveObjectLike(obj, bps = breakpoints) {
const keys = Object.keys(obj);
return keys.length > 0 && keys.every(key => bps.includes(key));
function isResponsiveObjectLike(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var keys = Object.keys(obj);
return keys.length > 0 && keys.every(function (key) {
return bps.includes(key);
});
}

@@ -1405,10 +1650,10 @@ /**

const isCustomBreakpoint = maybeBreakpoint => Number.isNaN(Number(maybeBreakpoint));
var isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {
return Number.isNaN(Number(maybeBreakpoint));
};
function getUserAgentBrowser(navigator) {
const {
userAgent: ua,
vendor
} = navigator;
const android = /(android)/i.test(ua);
var ua = navigator.userAgent,
vendor = navigator.vendor;
var android = /(android)/i.test(ua);

@@ -1449,6 +1694,4 @@ switch (true) {

function getUserAgentOS(navigator) {
const {
userAgent: ua,
platform
} = navigator;
var ua = navigator.userAgent,
platform = navigator.platform;

@@ -1480,5 +1723,3 @@ switch (true) {

function detectDeviceType(navigator) {
const {
userAgent: ua
} = navigator;
var ua = navigator.userAgent;
if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return "tablet";

@@ -1502,9 +1743,19 @@ if (/(mobi)/i.test(ua)) return "phone";

function walkObject(target, predicate) {
function inner(value, path = []) {
function inner(value, path) {
if (path === void 0) {
path = [];
}
if (isArray(value)) {
return value.map((item, index) => inner(item, [...path, String(index)]));
return value.map(function (item, index) {
return inner(item, [].concat(path, [String(index)]));
});
}
if (isObject(value)) {
return fromEntries(Object.entries(value).map(([key, child]) => [key, inner(child, [...path, key])]));
return fromEntries(Object.entries(value).map(function (_ref) {
var key = _ref[0],
child = _ref[1];
return [key, inner(child, [].concat(path, [key]))];
}));
}

@@ -1511,0 +1762,0 @@

export * from 'css-box-model';
export { default as mergeWith } from 'lodash.mergewith';
import sync, { getFrameData, cancelSync } from 'framesync';
import sync, { cancelSync, getFrameData } from 'framesync';

@@ -9,21 +9,33 @@ function getFirstItem(array) {

function getLastItem(array) {
const length = array == null ? 0 : array.length;
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
function getPrevItem(index, array, loop = true) {
const prevIndex = getPrevIndex(index, array.length, loop);
function getPrevItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var prevIndex = getPrevIndex(index, array.length, loop);
return array[prevIndex];
}
function getNextItem(index, array, loop = true) {
const nextIndex = getNextIndex(index, array.length, 1, loop);
function getNextItem(index, array, loop) {
if (loop === void 0) {
loop = true;
}
var nextIndex = getNextIndex(index, array.length, 1, loop);
return array[nextIndex];
}
function removeIndex(array, index) {
return array.filter((_, idx) => idx !== index);
return array.filter(function (_, idx) {
return idx !== index;
});
}
function addItem(array, item) {
return [...array, item];
return [].concat(array, [item]);
}
function removeItem(array, item) {
return array.filter(eachItem => eachItem !== item);
return array.filter(function (eachItem) {
return eachItem !== item;
});
}

@@ -39,5 +51,13 @@ /**

function getNextIndex(currentIndex, length, step = 1, loop = true) {
const lastIndex = length - 1;
function getNextIndex(currentIndex, length, step, loop) {
if (step === void 0) {
step = 1;
}
if (loop === void 0) {
loop = true;
}
var lastIndex = length - 1;
if (currentIndex === -1) {

@@ -47,3 +67,3 @@ return step > 0 ? 0 : lastIndex;

const nextIndex = currentIndex + step;
var nextIndex = currentIndex + step;

@@ -71,3 +91,7 @@ if (nextIndex < 0) {

function getPrevIndex(index, count, loop = true) {
function getPrevIndex(index, count, loop) {
if (loop === void 0) {
loop = true;
}
return getNextIndex(index, count, -1, loop);

@@ -83,3 +107,3 @@ }

function chunk(array, size) {
return array.reduce((rows, currentValue, index) => {
return array.reduce(function (rows, currentValue, index) {
if (index % size === 0) {

@@ -110,3 +134,5 @@ rows.push([currentValue]);

if (!currentItem) {
const foundItem = items.find(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase()));
var foundItem = items.find(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
});
return foundItem;

@@ -116,9 +142,11 @@ } // Filter items for ones that match the search string (case insensitive)

const matchingItems = items.filter(item => itemToString(item).toLowerCase().startsWith(searchString.toLowerCase())); // If there's a match, let's get the next item to select
var matchingItems = items.filter(function (item) {
return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());
}); // If there's a match, let's get the next item to select
if (matchingItems.length > 0) {
let nextIndex; // If the currentItem is in the available items, we move to the next available option
var nextIndex; // If the currentItem is in the available items, we move to the next available option
if (matchingItems.includes(currentItem)) {
const currentIndex = matchingItems.indexOf(currentItem);
var currentIndex = matchingItems.indexOf(currentItem);
nextIndex = currentIndex + 1;

@@ -172,3 +200,3 @@

function isObject(value) {
const type = typeof value;
var type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);

@@ -199,4 +227,4 @@ }

}
const __DEV__ = process.env.NODE_ENV !== "production";
const __TEST__ = process.env.NODE_ENV === "test";
var __DEV__ = process.env.NODE_ENV !== "production";
var __TEST__ = process.env.NODE_ENV === "test";
function isRefObject(val) {

@@ -210,4 +238,4 @@ return "current" in val;

function omit(object, keys) {
const result = {};
Object.keys(object).forEach(key => {
var result = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) return;

@@ -219,4 +247,4 @@ result[key] = object[key];

function pick(object, keys) {
const result = {};
keys.forEach(key => {
var result = {};
keys.forEach(function (key) {
if (key in object) {

@@ -229,5 +257,5 @@ result[key] = object[key];

function split(object, keys) {
const picked = {};
const omitted = {};
Object.keys(object).forEach(key => {
var picked = {};
var omitted = {};
Object.keys(object).forEach(function (key) {
if (keys.includes(key)) {

@@ -250,3 +278,3 @@ picked[key] = object[key];

function get(obj, path, fallback, index) {
const key = typeof path === "string" ? path.split(".") : [path];
var key = typeof path === "string" ? path.split(".") : [path];

@@ -260,6 +288,6 @@ for (index = 0; index < key.length; index += 1) {

}
const memoize = fn => {
const cache = new WeakMap();
var memoize = function memoize(fn) {
var cache = new WeakMap();
const memoizedFn = (obj, path, fallback, index) => {
var memoizedFn = function memoizedFn(obj, path, fallback, index) {
if (typeof obj === "undefined") {

@@ -273,3 +301,3 @@ return fn(obj, path, fallback);

const map = cache.get(obj);
var map = cache.get(obj);

@@ -280,3 +308,3 @@ if (map.has(path)) {

const value = fn(obj, path, fallback, index);
var value = fn(obj, path, fallback, index);
map.set(path, value);

@@ -288,3 +316,3 @@ return value;

};
const memoizedGet = memoize(get);
var memoizedGet = memoize(get);
/**

@@ -309,6 +337,6 @@ * Get value from deeply nested object, based on path

function objectFilter(object, fn) {
const result = {};
Object.keys(object).forEach(key => {
const value = object[key];
const shouldPass = fn(value, key, object);
var result = {};
Object.keys(object).forEach(function (key) {
var value = object[key];
var shouldPass = fn(value, key, object);

@@ -321,4 +349,10 @@ if (shouldPass) {

}
const filterUndefined = object => objectFilter(object, val => val !== null && val !== undefined);
const objectKeys = obj => Object.keys(obj);
var filterUndefined = function filterUndefined(object) {
return objectFilter(object, function (val) {
return val !== null && val !== undefined;
});
};
var objectKeys = function objectKeys(obj) {
return Object.keys(obj);
};
/**

@@ -328,6 +362,10 @@ * Object.entries polyfill for Nodev10 compatibility

const fromEntries = entries => entries.reduce((carry, [key, value]) => {
carry[key] = value;
return carry;
}, {});
var fromEntries = function fromEntries(entries) {
return entries.reduce(function (carry, _ref) {
var key = _ref[0],
value = _ref[1];
carry[key] = value;
return carry;
}, {});
};
/**

@@ -337,11 +375,15 @@ * Get the CSS variable ref stored in the theme

const getCSSVar = (theme, scale, value) => theme.__cssMap[`${scale}.${value}`]?.varRef ?? value;
var getCSSVar = function getCSSVar(theme, scale, value) {
var _theme$__cssMap$$varR, _theme$__cssMap$;
return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + "." + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;
};
function analyzeCSSValue(value) {
const num = parseFloat(value.toString());
const unit = value.toString().replace(String(num), "");
var num = parseFloat(value.toString());
var unit = value.toString().replace(String(num), "");
return {
unitless: !unit,
value: num,
unit
unit: unit
};

@@ -352,14 +394,19 @@ }

if (value == null) return value;
const {
unitless
} = analyzeCSSValue(value);
return unitless || isNumber(value) ? `${value}px` : value;
var _analyzeCSSValue = analyzeCSSValue(value),
unitless = _analyzeCSSValue.unitless;
return unitless || isNumber(value) ? value + "px" : value;
}
const sortByBreakpointValue = (a, b) => parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
var sortByBreakpointValue = function sortByBreakpointValue(a, b) {
return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;
};
const sortBps = breakpoints => fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
var sortBps = function sortBps(breakpoints) {
return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));
};
function normalize(breakpoints) {
const sorted = sortBps(breakpoints);
var sorted = sortBps(breakpoints);
return Object.assign(Object.values(sorted), sorted);

@@ -369,3 +416,3 @@ }

function keys(breakpoints) {
const value = Object.keys(sortBps(breakpoints));
var value = Object.keys(sortBps(breakpoints));
return new Set(value);

@@ -375,14 +422,18 @@ }

function subtract(value) {
var _px;
if (!value) return value;
value = px(value) ?? value;
const factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
value = (_px = px(value)) != null ? _px : value;
var factor = value.endsWith("px") ? -1 : // the equivalent of 1px in em using a 16px base
-0.0635;
return isNumber(value) ? `${value + factor}` : value.replace(/(\d+\.?\d*)/u, m => `${parseFloat(m) + factor}`);
return isNumber(value) ? "" + (value + factor) : value.replace(/([0-9]+\.?[0-9]*)/, function (m) {
return "" + (parseFloat(m) + factor);
});
}
function queryString(min, max) {
const query = [];
if (min) query.push(`@media screen and (min-width: ${px(min)})`);
var query = [];
if (min) query.push("@media screen and (min-width: " + px(min) + ")");
if (query.length > 0 && max) query.push("and");
if (max) query.push(`@media screen and (max-width: ${px(max)})`);
if (max) query.push("@media screen and (max-width: " + px(max) + ")");
return query.join(" ");

@@ -392,12 +443,21 @@ }

function analyzeBreakpoints(breakpoints) {
var _breakpoints$base;
if (!breakpoints) return null;
breakpoints.base = breakpoints.base ?? "0px";
const normalized = normalize(breakpoints);
const queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(([breakpoint, minW], index, entry) => {
let [, maxW] = entry[index + 1] ?? [];
breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : "0px";
var normalized = normalize(breakpoints);
var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {
var _entry;
var breakpoint = _ref[0],
minW = _ref[1];
var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],
maxW = _ref2[1];
maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;
return {
breakpoint,
minW,
maxW,
breakpoint: breakpoint,
minW: minW,
maxW: maxW,
maxWQuery: queryString(null, maxW),

@@ -409,21 +469,22 @@ minWQuery: queryString(minW),

const _keys = keys(breakpoints);
var _keys = keys(breakpoints);
const _keysArr = Array.from(_keys.values());
var _keysArr = Array.from(_keys.values());
return {
keys: _keys,
normalized,
isResponsive(test) {
const keys = Object.keys(test);
return keys.length > 0 && keys.every(key => _keys.has(key));
normalized: normalized,
isResponsive: function isResponsive(test) {
var keys = Object.keys(test);
return keys.length > 0 && keys.every(function (key) {
return _keys.has(key);
});
},
asObject: sortBps(breakpoints),
asArray: normalize(breakpoints),
details: queries,
media: [null, ...normalized.map(minW => queryString(minW)).slice(1)],
toArrayValue(test) {
media: [null].concat(normalized.map(function (minW) {
return queryString(minW);
}).slice(1)),
toArrayValue: function toArrayValue(test) {
if (!isObject(test)) {

@@ -433,4 +494,8 @@ throw new Error("toArrayValue: value must be an object");

const result = _keysArr.map(bp => test[bp] ?? null);
var result = _keysArr.map(function (bp) {
var _test$bp;
return (_test$bp = test[bp]) != null ? _test$bp : null;
});
while (getLastItem(result) === null) {

@@ -442,4 +507,3 @@ result.pop();

},
toObjectValue(test) {
toObjectValue: function toObjectValue(test) {
if (!Array.isArray(test)) {

@@ -449,4 +513,4 @@ throw new Error("toObjectValue: value must be an array");

return test.reduce((acc, value, index) => {
const key = _keysArr[index];
return test.reduce(function (acc, value, index) {
var key = _keysArr[index];
if (key != null && value != null) acc[key] = value;

@@ -456,3 +520,2 @@ return acc;

}
};

@@ -465,2 +528,4 @@ }

function isHTMLElement(el) {
var _el$ownerDocument$def;
if (!isElement(el)) {

@@ -470,13 +535,19 @@ return false;

const win = el.ownerDocument.defaultView ?? window;
var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;
return el instanceof win.HTMLElement;
}
function getOwnerWindow(node) {
return isElement(node) ? getOwnerDocument(node)?.defaultView ?? window : window;
var _getOwnerDocument$def, _getOwnerDocument;
return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;
}
function getOwnerDocument(node) {
return isElement(node) ? node.ownerDocument ?? document : document;
var _node$ownerDocument;
return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;
}
function getEventWindow(event) {
return event.view ?? window;
var _view;
return (_view = event.view) != null ? _view : window;
}

@@ -486,9 +557,19 @@ function canUseDOM() {

}
const isBrowser = canUseDOM();
const dataAttr = condition => condition ? "" : undefined;
const ariaAttr = condition => condition ? true : undefined;
const cx = (...classNames) => classNames.filter(Boolean).join(" ");
var isBrowser = canUseDOM();
var dataAttr = function dataAttr(condition) {
return condition ? "" : undefined;
};
var ariaAttr = function ariaAttr(condition) {
return condition ? true : undefined;
};
var cx = function cx() {
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
classNames[_key] = arguments[_key];
}
return classNames.filter(Boolean).join(" ");
};
function getActiveElement(node) {
const doc = getOwnerDocument(node);
return doc?.activeElement;
var doc = getOwnerDocument(node);
return doc == null ? void 0 : doc.activeElement;
}

@@ -501,3 +582,3 @@ function contains(parent, child) {

target.addEventListener(eventName, handler, options);
return () => {
return function () {
target.removeEventListener(eventName, handler, options);

@@ -512,14 +593,14 @@ };

function normalizeEventKey(event) {
const {
key,
keyCode
} = event;
const isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
const eventKey = isArrowKey ? `Arrow${key}` : key;
var key = event.key,
keyCode = event.keyCode;
var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0;
var eventKey = isArrowKey ? "Arrow" + key : key;
return eventKey;
}
function getRelatedTarget(event) {
const target = event.target ?? event.currentTarget;
const activeElement = getActiveElement(target);
return event.relatedTarget ?? activeElement;
var _event$target, _event$relatedTarget;
var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;
var activeElement = getActiveElement(target);
return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;
}

@@ -531,5 +612,11 @@ function isRightClick(event) {

// Really great work done by Diego Haz on this one
const hasDisplayNone = element => window.getComputedStyle(element).display === "none";
const hasTabIndex = element => element.hasAttribute("tabindex");
const hasNegativeTabIndex = element => hasTabIndex(element) && element.tabIndex === -1;
var hasDisplayNone = function hasDisplayNone(element) {
return window.getComputedStyle(element).display === "none";
};
var hasTabIndex = function hasTabIndex(element) {
return element.hasAttribute("tabindex");
};
var hasNegativeTabIndex = function hasNegativeTabIndex(element) {
return hasTabIndex(element) && element.tabIndex === -1;
};
function isDisabled(element) {

@@ -542,3 +629,3 @@ return Boolean(element.getAttribute("disabled")) === true || Boolean(element.getAttribute("aria-disabled")) === true;

function isActiveElement(element) {
const doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;
return doc.activeElement === element;

@@ -555,3 +642,3 @@ }

function isContentEditable(element) {
const value = element.getAttribute("contenteditable");
var value = element.getAttribute("contenteditable");
return value !== "false" && value != null;

@@ -564,11 +651,15 @@ }

const {
localName
} = element;
const focusableTags = ["input", "select", "textarea", "button"];
var localName = element.localName;
var focusableTags = ["input", "select", "textarea", "button"];
if (focusableTags.indexOf(localName) >= 0) return true;
const others = {
a: () => element.hasAttribute("href"),
audio: () => element.hasAttribute("controls"),
video: () => element.hasAttribute("controls")
var others = {
a: function a() {
return element.hasAttribute("href");
},
audio: function audio() {
return element.hasAttribute("controls");
},
video: function video() {
return element.hasAttribute("controls");
}
};

@@ -588,16 +679,18 @@

const focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
const focusableElSelector = focusableElList.join();
var focusableElList = ["input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "embed", "iframe", "object", "a[href]", "area[href]", "button:not([disabled])", "[tabindex]", "audio[controls]", "video[controls]", "*[tabindex]:not([aria-disabled])", "*[contenteditable]"];
var focusableElSelector = focusableElList.join();
function getAllFocusable(container) {
const focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
focusableEls.unshift(container);
return focusableEls.filter(isFocusable).filter(el => window.getComputedStyle(el).display !== "none");
return focusableEls.filter(isFocusable).filter(function (el) {
return window.getComputedStyle(el).display !== "none";
});
}
function getFirstFocusable(container) {
const allFocusable = getAllFocusable(container);
var allFocusable = getAllFocusable(container);
return allFocusable.length ? allFocusable[0] : null;
}
function getAllTabbable(container, fallbackToFocusable) {
const allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
const allTabbable = allFocusable.filter(isTabbable);
var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));
var allTabbable = allFocusable.filter(isTabbable);

@@ -615,23 +708,25 @@ if (isTabbable(container)) {

function getFirstTabbableIn(container, fallbackToFocusable) {
const [first] = getAllTabbable(container, fallbackToFocusable);
var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),
first = _getAllTabbable[0];
return first || null;
}
function getLastTabbableIn(container, fallbackToFocusable) {
const allTabbable = getAllTabbable(container, fallbackToFocusable);
var allTabbable = getAllTabbable(container, fallbackToFocusable);
return allTabbable[allTabbable.length - 1] || null;
}
function getNextTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container);
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container);
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function getPreviousTabbable(container, fallbackToFocusable) {
const allFocusable = getAllFocusable(container).reverse();
const index = allFocusable.indexOf(document.activeElement);
const slice = allFocusable.slice(index + 1);
var allFocusable = getAllFocusable(container).reverse();
var index = allFocusable.indexOf(document.activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
function focusNextTabbable(container, fallbackToFocusable) {
const nextTabbable = getNextTabbable(container, fallbackToFocusable);
var nextTabbable = getNextTabbable(container, fallbackToFocusable);

@@ -643,3 +738,3 @@ if (nextTabbable && isHTMLElement(nextTabbable)) {

function focusPreviousTabbable(container, fallbackToFocusable) {
const previousTabbable = getPreviousTabbable(container, fallbackToFocusable);
var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);

@@ -668,26 +763,90 @@ if (previousTabbable && isHTMLElement(previousTabbable)) {

function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
/* eslint-disable no-nested-ternary */
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
function runIfFn(valueOrFn) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;
}
function callAllHandlers(...fns) {
function callAllHandlers() {
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
return function func(event) {
fns.some(fn => {
fn?.(event);
return event?.defaultPrevented;
fns.some(function (fn) {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
function callAll(...fns) {
function callAll() {
for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
fns[_key3] = arguments[_key3];
}
return function mergedFn(arg) {
fns.forEach(fn => {
fn?.(arg);
fns.forEach(function (fn) {
fn == null ? void 0 : fn(arg);
});
};
}
const compose = (fn1, ...fns) => fns.reduce((f1, f2) => (...args) => f1(f2(...args)), fn1);
var compose = function compose(fn1) {
for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
fns[_key4 - 1] = arguments[_key4];
}
return fns.reduce(function (f1, f2) {
return function () {
return f1(f2.apply(void 0, arguments));
};
}, fn1);
};
function once(fn) {
let result;
return function func(...args) {
var result;
return function func() {
if (fn) {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
result = fn.apply(this, args);

@@ -700,29 +859,43 @@ fn = null;

}
const noop = () => {};
const warn = once(options => () => {
const {
condition,
message
} = options;
var noop = function noop() {};
var warn = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.warn(message);
}
if (condition && __DEV__) {
console.warn(message);
}
};
});
const error = once(options => () => {
const {
condition,
message
} = options;
var error = once(function (options) {
return function () {
var condition = options.condition,
message = options.message;
if (condition && __DEV__) {
console.error(message);
if (condition && __DEV__) {
console.error(message);
}
};
});
var pipe = function pipe() {
for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
fns[_key6] = arguments[_key6];
}
});
const pipe = (...fns) => v => fns.reduce((a, b) => b(a), v);
const distance1D = (a, b) => Math.abs(a - b);
return function (v) {
return fns.reduce(function (a, b) {
return b(a);
}, v);
};
};
const isPoint = point => "x" in point && "y" in point;
var distance1D = function distance1D(a, b) {
return Math.abs(a - b);
};
var isPoint = function isPoint(point) {
return "x" in point && "y" in point;
};
function distance(a, b) {

@@ -734,5 +907,5 @@ if (isNumber(a) && isNumber(b)) {

if (isPoint(a) && isPoint(b)) {
const xDelta = distance1D(a.x, b.x);
const yDelta = distance1D(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
var xDelta = distance1D(a.x, b.x);
var yDelta = distance1D(a.y, b.y);
return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));
}

@@ -743,10 +916,15 @@

// Original licensing for the following methods can be found in the
function focus(element, options = {}) {
const {
isActive = isActiveElement,
nextTick,
preventScroll = true,
selectTextIfInput = true
} = options;
function focus(element, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$isActive = _options.isActive,
isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,
nextTick = _options.nextTick,
_options$preventScrol = _options.preventScroll,
preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,
_options$selectTextIf = _options.selectTextIfInput,
selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;
if (!element || isActive(element)) return -1;

@@ -765,3 +943,3 @@

element.focus({
preventScroll
preventScroll: preventScroll
});

@@ -772,3 +950,3 @@ } else {

if (preventScroll) {
const scrollableElements = getScrollableElements(element);
var scrollableElements = getScrollableElements(element);
restoreScrollPosition(scrollableElements);

@@ -790,3 +968,3 @@ }

}
let supportsPreventScrollCached = null;
var supportsPreventScrollCached = null;

@@ -798,3 +976,3 @@ function supportsPreventScroll() {

try {
const div = document.createElement("div");
var div = document.createElement("div");
div.focus({

@@ -815,8 +993,10 @@ get preventScroll() {

function getScrollableElements(element) {
const doc = getOwnerDocument(element);
const win = doc.defaultView ?? window;
let parent = element.parentNode;
const scrollableElements = [];
const rootScrollingElement = doc.scrollingElement || doc.documentElement;
var _doc$defaultView;
var doc = getOwnerDocument(element);
var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;
var parent = element.parentNode;
var scrollableElements = [];
var rootScrollingElement = doc.scrollingElement || doc.documentElement;
while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {

@@ -846,7 +1026,7 @@ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {

function restoreScrollPosition(scrollableElements) {
for (const {
element,
scrollTop,
scrollLeft
} of scrollableElements) {
for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {
var _step$value = _step.value,
element = _step$value.element,
scrollTop = _step$value.scrollTop,
scrollLeft = _step$value.scrollLeft;
element.scrollTop = scrollTop;

@@ -865,8 +1045,7 @@ element.scrollLeft = scrollLeft;

function determineLazyBehavior(options) {
const {
hasBeenSelected,
isLazy,
isSelected,
lazyBehavior = "unmount"
} = options; // if not lazy, always render the disclosure's content
var hasBeenSelected = options.hasBeenSelected,
isLazy = options.isLazy,
isSelected = options.isSelected,
_options$lazyBehavior = options.lazyBehavior,
lazyBehavior = _options$lazyBehavior === void 0 ? "unmount" : _options$lazyBehavior; // if not lazy, always render the disclosure's content

@@ -881,7 +1060,7 @@ if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content

const minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
const maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
var minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;
var maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;
function toNumber(value) {
const num = parseFloat(value);
var num = parseFloat(value);
return isNotNumber(num) ? 0 : num;

@@ -900,4 +1079,4 @@ }

function toPrecision(value, precision) {
let nextValue = toNumber(value);
const scaleFactor = 10 ** (precision ?? 10);
var nextValue = toNumber(value);
var scaleFactor = Math.pow(10, precision != null ? precision : 10);
nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;

@@ -914,4 +1093,4 @@ return precision ? nextValue.toFixed(precision) : nextValue.toString();

if (!Number.isFinite(value)) return 0;
let e = 1;
let p = 0;
var e = 1;
var p = 0;

@@ -956,4 +1135,4 @@ while (Math.round(value * e) / e !== value) {

function roundValueToStep(value, from, step) {
const nextValue = Math.round((value - from) / step) * step + from;
const precision = countDecimalPlaces(step);
var nextValue = Math.round((value - from) / step) * step + from;
var precision = countDecimalPlaces(step);
return toPrecision(nextValue, precision);

@@ -978,2 +1157,20 @@ }

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**

@@ -984,3 +1181,3 @@ * Credit goes to `framer-motion` of this useful utilities.

function isMouseEvent(event) {
const win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.

@@ -994,3 +1191,3 @@ if (typeof win.PointerEvent !== "undefined" && event instanceof win.PointerEvent) {

function isTouchEvent(event) {
const hasTouches = !!event.touches;
var hasTouches = !!event.touches;
return hasTouches;

@@ -1004,6 +1201,6 @@ }

function filterPrimaryPointer(eventHandler) {
return event => {
const win = getEventWindow(event);
const isMouseEvent = event instanceof win.MouseEvent;
const isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;
return function (event) {
var win = getEventWindow(event);
var isMouseEvent = event instanceof win.MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;

@@ -1016,3 +1213,3 @@ if (isPrimaryPointer) {

const defaultPagePoint = {
var defaultPagePoint = {
pageX: 0,

@@ -1022,19 +1219,31 @@ pageY: 0

function pointFromTouch(e, pointType = "page") {
const primaryTouch = e.touches[0] || e.changedTouches[0];
const point = primaryTouch || defaultPagePoint;
function pointFromTouch(e, pointType) {
if (pointType === void 0) {
pointType = "page";
}
var primaryTouch = e.touches[0] || e.changedTouches[0];
var point = primaryTouch || defaultPagePoint;
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function pointFromMouse(point, pointType = "page") {
function pointFromMouse(point, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {
x: point[`${pointType}X`],
y: point[`${pointType}Y`]
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function extractEventInfo(event, pointType = "page") {
function extractEventInfo(event, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {

@@ -1047,15 +1256,27 @@ point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)

}
const wrapPointerEventHandler = (handler, shouldFilterPrimaryPointer = false) => {
const listener = event => handler(event, extractEventInfo(event));
var wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {
if (shouldFilterPrimaryPointer === void 0) {
shouldFilterPrimaryPointer = false;
}
var listener = function listener(event) {
return handler(event, extractEventInfo(event));
};
return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;
}; // We check for event support via functions in case they've been mocked by a testing suite.
const supportsPointerEvents = () => isBrowser && window.onpointerdown === null;
var supportsPointerEvents = function supportsPointerEvents() {
return isBrowser && window.onpointerdown === null;
};
const supportsTouchEvents = () => isBrowser && window.ontouchstart === null;
var supportsTouchEvents = function supportsTouchEvents() {
return isBrowser && window.ontouchstart === null;
};
const supportsMouseEvents = () => isBrowser && window.onmousedown === null;
var supportsMouseEvents = function supportsMouseEvents() {
return isBrowser && window.onmousedown === null;
};
const mouseEventNames = {
var mouseEventNames = {
pointerdown: "mousedown",

@@ -1070,3 +1291,3 @@ pointermove: "mousemove",

};
const touchEventNames = {
var touchEventNames = {
pointerdown: "touchstart",

@@ -1100,8 +1321,2 @@ pointermove: "touchmove",

/**
* This is a modified version of `PanSession` from `framer-motion`.
*
* Credit goes to `framer-motion` of this useful utilities.
* License can be found here: https://github.com/framer/motion
*/
/**
* The event information passed to pan event handlers like `onPan`, `onPanStart`.

@@ -1119,3 +1334,3 @@ *

*/
class PanSession {
var PanSession = /*#__PURE__*/function () {
/**

@@ -1133,3 +1348,5 @@ * We use this to keep track of the `x` and `y` pan session history

*/
constructor(_event, handlers, threshold) {
function PanSession(_event, handlers, threshold) {
var _this = this;
this.history = [];

@@ -1144,36 +1361,40 @@ this.startEvent = null;

this.updatePoint = () => {
if (!(this.lastEvent && this.lastEventInfo)) return;
const info = getPanInfo(this.lastEventInfo, this.history);
const isPanStarted = this.startEvent !== null;
const isDistancePastThreshold = distance(info.offset, {
this.updatePoint = function () {
if (!(_this.lastEvent && _this.lastEventInfo)) return;
var info = getPanInfo(_this.lastEventInfo, _this.history);
var isPanStarted = _this.startEvent !== null;
var isDistancePastThreshold = distance(info.offset, {
x: 0,
y: 0
}) >= this.threshold;
}) >= _this.threshold;
if (!isPanStarted && !isDistancePastThreshold) return;
const {
timestamp
} = getFrameData();
this.history.push({ ...info.point,
timestamp
});
const {
onStart,
onMove
} = this.handlers;
var _getFrameData = getFrameData(),
timestamp = _getFrameData.timestamp;
_this.history.push(_extends({}, info.point, {
timestamp: timestamp
}));
var _this$handlers = _this.handlers,
onStart = _this$handlers.onStart,
onMove = _this$handlers.onMove;
if (!isPanStarted) {
onStart?.(this.lastEvent, info);
this.startEvent = this.lastEvent;
onStart == null ? void 0 : onStart(_this.lastEvent, info);
_this.startEvent = _this.lastEvent;
}
onMove?.(this.lastEvent, info);
onMove == null ? void 0 : onMove(_this.lastEvent, info);
};
this.onPointerMove = (event, info) => {
this.lastEvent = event;
this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
this.onPointerMove = function (event, info) {
_this.lastEvent = event;
_this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`
if (isMouseEvent(event) && event.buttons === 0) {
this.onPointerUp(event, info);
_this.onPointerUp(event, info);
return;

@@ -1183,18 +1404,19 @@ } // Throttle mouse move event to once per frame

sync.update(this.updatePoint, true);
sync.update(_this.updatePoint, true);
};
this.onPointerUp = (event, info) => {
this.onPointerUp = function (event, info) {
// notify pan session ended
const panInfo = getPanInfo(info, this.history);
const {
onEnd,
onSessionEnd
} = this.handlers;
onSessionEnd?.(event, panInfo);
this.end(); // if panning never started, no need to call `onEnd`
var panInfo = getPanInfo(info, _this.history);
var _this$handlers2 = _this.handlers,
onEnd = _this$handlers2.onEnd,
onSessionEnd = _this$handlers2.onSessionEnd;
onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);
_this.end(); // if panning never started, no need to call `onEnd`
// panning requires a pointermove of at least 3px
if (!onEnd || !this.startEvent) return;
onEnd?.(event, panInfo);
if (!onEnd || !_this.startEvent) return;
onEnd == null ? void 0 : onEnd(event, panInfo);
};

@@ -1218,15 +1440,13 @@

const _info = extractEventInfo(_event);
var _info = extractEventInfo(_event);
const {
var _getFrameData2 = getFrameData(),
_timestamp = _getFrameData2.timestamp;
this.history = [_extends({}, _info.point, {
timestamp: _timestamp
} = getFrameData();
this.history = [{ ..._info.point,
timestamp: _timestamp
}]; // notify pan session start
})]; // notify pan session start
const {
onSessionStart
} = handlers;
onSessionStart?.(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all
var onSessionStart = handlers.onSessionStart;
onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all

@@ -1236,12 +1456,17 @@ this.removeListeners = pipe(addPointerEvent(this.win, "pointermove", this.onPointerMove), addPointerEvent(this.win, "pointerup", this.onPointerUp), addPointerEvent(this.win, "pointercancel", this.onPointerUp));

updateHandlers(handlers) {
var _proto = PanSession.prototype;
_proto.updateHandlers = function updateHandlers(handlers) {
this.handlers = handlers;
}
};
end() {
this.removeListeners?.();
_proto.end = function end() {
var _this$removeListeners;
(_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);
cancelSync.update(this.updatePoint);
}
};
}
return PanSession;
}();

@@ -1276,3 +1501,5 @@ function subtractPoint(a, b) {

const toMilliseconds = seconds => seconds * 1000;
var toMilliseconds = function toMilliseconds(seconds) {
return seconds * 1000;
};

@@ -1287,5 +1514,5 @@ function getVelocity(history, timeDelta) {

let i = history.length - 1;
let timestampedPoint = null;
const lastPoint = lastDevicePoint(history);
var i = history.length - 1;
var timestampedPoint = null;
var lastPoint = lastDevicePoint(history);

@@ -1309,3 +1536,3 @@ while (i >= 0) {

const time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;

@@ -1319,3 +1546,3 @@ if (time === 0) {

const currentVelocity = {
var currentVelocity = {
x: (lastPoint.x - timestampedPoint.x) / time,

@@ -1336,6 +1563,6 @@ y: (lastPoint.y - timestampedPoint.y) / time

const breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
var breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
function mapResponsive(prop, mapper) {
if (isArray(prop)) {
return prop.map(item => {
return prop.map(function (item) {
if (item === null) {

@@ -1350,3 +1577,3 @@ return null;

if (isObject(prop)) {
return objectKeys(prop).reduce((result, key) => {
return objectKeys(prop).reduce(function (result, key) {
result[key] = mapper(prop[key]);

@@ -1363,5 +1590,13 @@ return result;

}
function objectToArrayNotation(obj, bps = breakpoints) {
const result = bps.map(br => obj[br] ?? null);
function objectToArrayNotation(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = bps.map(function (br) {
var _obj$br;
return (_obj$br = obj[br]) != null ? _obj$br : null;
});
while (getLastItem(result) === null) {

@@ -1373,6 +1608,10 @@ result.pop();

}
function arrayToObjectNotation(values, bps = breakpoints) {
const result = {};
values.forEach((value, index) => {
const key = bps[index];
function arrayToObjectNotation(values, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var result = {};
values.forEach(function (value, index) {
var key = bps[index];
if (value == null) return;

@@ -1383,5 +1622,11 @@ result[key] = value;

}
function isResponsiveObjectLike(obj, bps = breakpoints) {
const keys = Object.keys(obj);
return keys.length > 0 && keys.every(key => bps.includes(key));
function isResponsiveObjectLike(obj, bps) {
if (bps === void 0) {
bps = breakpoints;
}
var keys = Object.keys(obj);
return keys.length > 0 && keys.every(function (key) {
return bps.includes(key);
});
}

@@ -1396,10 +1641,10 @@ /**

const isCustomBreakpoint = maybeBreakpoint => Number.isNaN(Number(maybeBreakpoint));
var isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {
return Number.isNaN(Number(maybeBreakpoint));
};
function getUserAgentBrowser(navigator) {
const {
userAgent: ua,
vendor
} = navigator;
const android = /(android)/i.test(ua);
var ua = navigator.userAgent,
vendor = navigator.vendor;
var android = /(android)/i.test(ua);

@@ -1440,6 +1685,4 @@ switch (true) {

function getUserAgentOS(navigator) {
const {
userAgent: ua,
platform
} = navigator;
var ua = navigator.userAgent,
platform = navigator.platform;

@@ -1471,5 +1714,3 @@ switch (true) {

function detectDeviceType(navigator) {
const {
userAgent: ua
} = navigator;
var ua = navigator.userAgent;
if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return "tablet";

@@ -1493,9 +1734,19 @@ if (/(mobi)/i.test(ua)) return "phone";

function walkObject(target, predicate) {
function inner(value, path = []) {
function inner(value, path) {
if (path === void 0) {
path = [];
}
if (isArray(value)) {
return value.map((item, index) => inner(item, [...path, String(index)]));
return value.map(function (item, index) {
return inner(item, [].concat(path, [String(index)]));
});
}
if (isObject(value)) {
return fromEntries(Object.entries(value).map(([key, child]) => [key, inner(child, [...path, key])]));
return fromEntries(Object.entries(value).map(function (_ref) {
var key = _ref[0],
child = _ref[1];
return [key, inner(child, [].concat(path, [key]))];
}));
}

@@ -1502,0 +1753,0 @@

@@ -43,1 +43,2 @@ export declare function getFirstItem<T>(array: T[]): T | undefined;

export declare function getNextItemFromSearch<T>(items: T[], searchString: string, itemToString: (item: T) => string, currentItem: T): T | undefined;
//# sourceMappingURL=array.d.ts.map

@@ -25,1 +25,2 @@ import { Dict } from "./types";

};
//# sourceMappingURL=assertion.d.ts.map

@@ -22,1 +22,2 @@ import { Dict } from "./types";

export declare type AnalyzeBreakpointsReturn = ReturnType<typeof analyzeBreakpoints>;
//# sourceMappingURL=breakpoint.d.ts.map

@@ -11,1 +11,2 @@ export declare function getAllFocusable<T extends HTMLElement>(container: T): T[];

export declare function closest<T extends HTMLElement>(element: T, selectors: string): Element | null;
//# sourceMappingURL=dom-query.d.ts.map

@@ -22,1 +22,2 @@ import { Booleanish, EventKeys } from "./types";

export declare function isRightClick(event: Pick<MouseEvent, "button">): boolean;
//# sourceMappingURL=dom.d.ts.map

@@ -17,1 +17,2 @@ import { FocusableElement, isActiveElement } from "./tabbable";

export declare function focus(element: FocusableElement | null, options?: ExtendedFocusOptions): number;
//# sourceMappingURL=focus.d.ts.map

@@ -21,1 +21,2 @@ import { AnyFunction, FunctionArguments } from "./types";

export {};
//# sourceMappingURL=function.d.ts.map

@@ -19,1 +19,2 @@ export * from "css-box-model";

export * from "./walk-object";
//# sourceMappingURL=index.d.ts.map

@@ -17,1 +17,2 @@ export declare type LazyBehavior = "unmount" | "keepMounted";

export {};
//# sourceMappingURL=lazy.d.ts.map

@@ -50,1 +50,2 @@ export declare const minSafeInteger: number;

export declare function clampValue(value: number, min: number, max: number): number;
//# sourceMappingURL=number.d.ts.map

@@ -43,1 +43,2 @@ import type { Dict, Omit } from "./types";

export declare const getCSSVar: (theme: Dict, scale: string, value: any) => any;
//# sourceMappingURL=object.d.ts.map

@@ -97,1 +97,2 @@ /**

}
//# sourceMappingURL=pan-event.d.ts.map

@@ -25,1 +25,2 @@ /**

export {};
//# sourceMappingURL=pointer-event.d.ts.map

@@ -15,1 +15,2 @@ import { Dict } from "./types";

export declare const isCustomBreakpoint: (maybeBreakpoint: string) => boolean;
//# sourceMappingURL=responsive.d.ts.map

@@ -15,1 +15,2 @@ export declare const hasDisplayNone: (element: HTMLElement) => boolean;

export declare function isTabbable(element?: HTMLElement | null): boolean;
//# sourceMappingURL=tabbable.d.ts.map

@@ -13,1 +13,2 @@ export declare type Merge<T, P> = P & Omit<T, keyof P>;

export declare type EventKeys = "ArrowDown" | "ArrowUp" | "ArrowLeft" | "ArrowRight" | "Enter" | "Space" | "Tab" | "Backspace" | "Control" | "Meta" | "Home" | "End" | "PageDown" | "PageUp" | "Delete" | "Escape" | " " | "Shift";
//# sourceMappingURL=types.d.ts.map

@@ -11,1 +11,2 @@ declare function getUserAgentBrowser(navigator: Navigator): "Chrome for iOS" | "Edge" | "Silk" | "Chrome" | "Firefox" | "AOSP" | "IE" | "Safari" | "WebKit" | null;

export {};
//# sourceMappingURL=user-agent.d.ts.map

@@ -6,1 +6,2 @@ export declare type WalkObjectPredicate<Leaf = unknown> = (value: unknown, path: string[]) => Leaf;

export declare function walkObject<Target, LeafType>(target: Target, predicate: WalkObjectPredicate<LeafType>): MappedLeavesObject<Target, ReturnType<WalkObjectPredicate<LeafType>>>;
//# sourceMappingURL=walk-object.d.ts.map
{
"name": "@chakra-ui/utils",
"version": "1.9.0",
"version": "1.9.1",
"description": "Common utilties and types for Chakra UI",

@@ -13,3 +13,4 @@ "author": "Segun Adebayo <sage@adebayosegun.com>",

"files": [
"dist"
"dist",
"src"
],

@@ -16,0 +17,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc