Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uxf/core

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uxf/core - npm Package Compare versions

Comparing version 4.5.1 to 10.0.0-beta.8

1

constants/classes.js

@@ -24,2 +24,1 @@ "use strict";

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdGFudHMvY2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx3REFBd0Q7QUFDM0MsUUFBQSxPQUFPLEdBQUc7SUFDbkIsYUFBYSxFQUFFLGVBQWU7SUFDOUIsU0FBUyxFQUFFLFdBQVc7SUFDdEIsV0FBVyxFQUFFLGFBQWE7SUFDMUIsUUFBUSxFQUFFLFVBQVU7SUFDcEIsVUFBVSxFQUFFLFlBQVk7SUFDeEIsWUFBWSxFQUFFLGNBQWM7SUFDNUIsVUFBVSxFQUFFLFlBQVk7SUFDeEIsZ0JBQWdCLEVBQUUsa0JBQWtCO0lBQ3BDLFVBQVUsRUFBRSxZQUFZO0lBQ3hCLFVBQVUsRUFBRSxZQUFZO0lBQ3hCLFlBQVksRUFBRSxjQUFjO0lBQzVCLGdCQUFnQixFQUFFLGtCQUFrQjtJQUNwQyxXQUFXLEVBQUUsYUFBYTtJQUMxQixPQUFPLEVBQUUsU0FBUztJQUNsQixXQUFXLEVBQUUsYUFBYTtJQUMxQixXQUFXLEVBQUUsYUFBYTtJQUMxQixXQUFXLEVBQUUsYUFBYTtDQUNwQixDQUFDIn0=

89

cookie/index.js
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cookie = void 0;
var Cookie = /** @class */ (function () {
function Cookie(ctx) {
if (ctx === void 0) { ctx = null; }
class Cookie {
constructor(ctx = null) {
this.ctx = ctx;
}
Cookie.create = function (ctx) {
if (ctx === void 0) { ctx = null; }
static create(ctx = null) {
return new Cookie(ctx);
};
Cookie.prototype.has = function (name) {
}
has(name) {
return !!this.get(name);
};
Cookie.prototype.set = function (name, value, ttl, options) {
if (ttl === void 0) { ttl = 3600; }
if (options === void 0) { options = {}; }
var date = new Date();
}
set(name, value, ttl = 3600, options = {}) {
const date = new Date();
date.setTime(date.getTime() + ttl * 1000);
var cookieParts = ["".concat(name, "=").concat(encodeURIComponent(value)), "expires=".concat(date.toUTCString())];
const cookieParts = [`${name}=${encodeURIComponent(value)}`, `expires=${date.toUTCString()}`];
if (options.httpOnly) {

@@ -39,4 +24,4 @@ cookieParts.push("httponly");

}
cookieParts.push("path=".concat(options.path || "/"));
var cookie = cookieParts.join("; ");
cookieParts.push(`path=${options.path || "/"}`);
const cookie = cookieParts.join("; ");
if (typeof document !== "undefined") {

@@ -46,3 +31,3 @@ document.cookie = cookie;

else {
var existsCookies = (this.ctx.res.getHeader("Set-Cookie") || []).slice(0);
const existsCookies = (this.ctx.res.getHeader("Set-Cookie") || []).slice(0);
existsCookies.push(cookie);

@@ -52,41 +37,27 @@ this.ctx.res.setHeader("Set-Cookie", existsCookies);

return this;
};
Cookie.prototype.get = function (cookieName) {
var e_1, _a;
var _b, _c, _d, _e;
var decodedCookie = typeof document !== "undefined"
}
get(cookieName) {
var _a, _b, _c, _d;
const decodedCookie = typeof document !== "undefined"
? decodeURIComponent(document.cookie)
: decodeURIComponent((_e = (_d = (_c = (_b = this.ctx) === null || _b === void 0 ? void 0 : _b.req) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? void 0 : _d.cookie) !== null && _e !== void 0 ? _e : "");
var name = cookieName + "=";
var cookies = decodedCookie.split(";");
try {
for (var cookies_1 = __values(cookies), cookies_1_1 = cookies_1.next(); !cookies_1_1.done; cookies_1_1 = cookies_1.next()) {
var cookie = cookies_1_1.value;
// eslint-disable-next-line eqeqeq
while (cookie.charAt(0) == " ") {
cookie = cookie.substring(1);
}
// eslint-disable-next-line eqeqeq
if (cookie.indexOf(name) == 0) {
return cookie.substring(name.length, cookie.length);
}
: decodeURIComponent((_d = (_c = (_b = (_a = this.ctx) === null || _a === void 0 ? void 0 : _a.req) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.cookie) !== null && _d !== void 0 ? _d : "");
const name = cookieName + "=";
const cookies = decodedCookie.split(";");
for (let cookie of cookies) {
// eslint-disable-next-line eqeqeq
while (cookie.charAt(0) == " ") {
cookie = cookie.substring(1);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (cookies_1_1 && !cookies_1_1.done && (_a = cookies_1.return)) _a.call(cookies_1);
// eslint-disable-next-line eqeqeq
if (cookie.indexOf(name) == 0) {
return cookie.substring(name.length, cookie.length);
}
finally { if (e_1) throw e_1.error; }
}
return "";
};
Cookie.prototype.delete = function (name, options) {
if (options === void 0) { options = {}; }
}
delete(name, options = {}) {
this.set(name, "", -1, options);
return this;
};
return Cookie;
}());
}
}
exports.Cookie = Cookie;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29va2llL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBTUE7SUFHSSxnQkFBWSxHQUFzQjtRQUF0QixvQkFBQSxFQUFBLFVBQXNCO1FBQzlCLElBQUksQ0FBQyxHQUFH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FEQUFFO2dCQUF2QixJQUFJLE1BQU0sb0JBQUE7Z0JBQ1gsa0NBQWtDO2dCQUNsQyxPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksR0FBRyxFQUFFO29CQUM1QixNQUFNLEdBQUcsTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQztpQkFDaEM7Z0JBQ0Qsa0NBQWtDO2dCQUNsQyxJQUFJLE1BQU0sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFO29CQUMzQixPQUFPLE1BQU0sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUM7aUJBQ3ZEO2FBQ0o7Ozs7Ozs7OztRQUVELE9BQU8sRUFBRSxDQUFDO0lBQ2QsQ0FBQztJQUVNLHVCQUFNLEdBQWIsVUFBYyxJQUFZLEVBQUUsT0FBMkI7UUFBM0Isd0JBQUEsRUFBQSxZQUEyQjtRQUNuRCxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQUFDLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFDaEMsT0FBTyxJQUFJLENBQUM7SUFDaEIsQ0FBQztJQUNMLGFBQUM7QUFBRCxDQUFDLEFBbEVELElBa0VDO0FBbEVZLHdCQUFNIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._useSimulatedButton = void 0;
var react_1 = require("react");
function _useSimulatedButton(_a) {
var analyticsCallback = _a.analyticsCallback, isClickable = _a.isClickable, isHyperlink = _a.isHyperlink, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, submit = _a.submit;
var _onClick = (0, react_1.useCallback)(function (e) {
const react_1 = require("react");
function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp, submit, }) {
const _onClick = (0, react_1.useCallback)((e) => {
var _a;

@@ -14,3 +13,3 @@ if ((isClickable || isHyperlink) && analyticsCallback) {

if (submit) {
var closestForm = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest("form");
const closestForm = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest("form");
if (closestForm) {

@@ -28,3 +27,3 @@ closestForm.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));

}, [analyticsCallback, isClickable, isHyperlink, onClick, submit]);
var _onKeyUp = (0, react_1.useCallback)(function (e) {
const _onKeyUp = (0, react_1.useCallback)((e) => {
if (isClickable && (e.key === "Enter" || e.key === " ")) {

@@ -42,3 +41,3 @@ e.target.dispatchEvent(new MouseEvent("click", {

}, [isClickable, onKeyUp]);
var _onKeyDown = (0, react_1.useCallback)(function (e) {
const _onKeyDown = (0, react_1.useCallback)((e) => {
if (isClickable && e.key === " ") {

@@ -54,2 +53,1 @@ e.preventDefault();

exports._useSimulatedButton = _useSimulatedButton;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiX3VzZVNpbXVsYXRlZEJ1dHRvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy9fdXNlU2ltdWxhdGVkQnV0dG9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUE2RTtBQVk3RSxTQUFnQixtQkFBbUIsQ0FBd0IsRUFRaEQ7UUFQUCxpQkFBaUIsdUJBQUEsRUFDakIsV0FBVyxpQkFBQSxFQUNYLFdBQVcsaUJBQUEsRUFDWCxPQUFPLGFBQUEsRUFDUCxTQUFTLGVBQUEsRUFDVCxPQUFPLGFBQUEsRUFDUCxNQUFNLFlBQUE7SUFFTixJQUFNLFFBQVEsR0FBRyxJQUFBLG1CQUFXLEVBQ3hCLFVBQUEsQ0FBQzs7UUFDRyxJQUFJLENBQUMsV0FBVyxJQUFJ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2FBQ2YsQ0FBQyxDQUNMLENBQUM7WUFFRixJQUFJLE9BQU8sRUFBRTtnQkFDVCxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7YUFDZDtTQUNKO0lBQ0wsQ0FBQyxFQUNELENBQUMsV0FBVyxFQUFFLE9BQU8sQ0FBQyxDQUN6QixDQUFDO0lBRUYsSUFBTSxVQUFVLEdBQUcsSUFBQSxtQkFBVyxFQUMxQixVQUFBLENBQUM7UUFDRyxJQUFJLFdBQVcsSUFBSSxDQUFDLENBQUMsR0FBRyxLQUFLLEdBQUcsRUFBRTtZQUM5QixDQUFDLENBQUMsY0FBYyxFQUFFLENBQUM7WUFFbkIsSUFBSSxTQUFTLEVBQUU7Z0JBQ1gsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDO2FBQ2hCO1NBQ0o7SUFDTCxDQUFDLEVBQ0QsQ0FBQyxXQUFXLEVBQUUsU0FBUyxDQUFDLENBQzNCLENBQUM7SUFFRixPQUFPLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsQ0FBQztBQUMzRSxDQUFDO0FBakVELGtEQWlFQyJ9
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAnchorProps = void 0;
var classes_1 = require("../constants/classes");
var cx_1 = require("../utils/cx");
var _useSimulatedButton_1 = require("./_useSimulatedButton");
function useAnchorProps(_a) {
var ariaBusy = _a["aria-busy"], ariaDisabled = _a["aria-disabled"], analyticsCallback = _a.analyticsCallback, className = _a.className, disabled = _a.disabled, download = _a.download, href = _a.href, hrefLang = _a.hrefLang, loading = _a.loading, media = _a.media, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, ping = _a.ping, referrerPolicy = _a.referrerPolicy, rel = _a.rel, role = _a.role, tabIndex = _a.tabIndex, target = _a.target, type = _a.type, restProps = __rest(_a, ["aria-busy", "aria-disabled", "analyticsCallback", "className", "disabled", "download", "href", "hrefLang", "loading", "media", "onClick", "onKeyDown", "onKeyUp", "ping", "referrerPolicy", "rel", "role", "tabIndex", "target", "type"]);
var isBusy = loading ? loading : Boolean(ariaBusy);
var isDisabled = disabled ? disabled : Boolean(ariaDisabled);
var isBusyOrDisabled = isBusy || isDisabled;
var submit = type === "submit";
var isButton = submit || !!onClick;
var tabIndexInteractive = isBusyOrDisabled ? -1 : tabIndex;
var _className = [isBusy && classes_1.CLASSES.IS_LOADING, disabled && classes_1.CLASSES.IS_DISABLED, className];
var simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
analyticsCallback: analyticsCallback,
const classes_1 = require("../constants/classes");
const cx_1 = require("../utils/cx");
const _useSimulatedButton_1 = require("./_useSimulatedButton");
function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, download, href, hrefLang, loading, media, onClick, onKeyDown, onKeyUp, ping, referrerPolicy, rel, role, tabIndex, target, type, ...restProps }) {
const isBusy = loading ? loading : Boolean(ariaBusy);
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
const isBusyOrDisabled = isBusy || isDisabled;
const submit = type === "submit";
const isButton = submit || !!onClick;
const tabIndexInteractive = isBusyOrDisabled ? -1 : tabIndex;
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, disabled && classes_1.CLASSES.IS_DISABLED, className];
const simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
analyticsCallback,
isClickable: !isBusyOrDisabled || isButton,
isHyperlink: !isBusyOrDisabled || !!href,
onClick: onClick,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp,
submit: submit,
onClick,
onKeyDown,
onKeyUp,
submit,
});
if (href) {
return __assign({ "aria-busy": isBusy, "aria-disabled": isDisabled, className: cx_1.cx.apply(void 0, __spreadArray([classes_1.CLASSES.IS_HOVERABLE], __read(_className), false)), download: download, href: href, hrefLang: hrefLang, media: media, onClick: simulatedButton.onClick, onKeyDown: simulatedButton.onKeyDown, onKeyUp: simulatedButton.onKeyUp, ping: ping, referrerPolicy: referrerPolicy, rel: target === "_blank" ? (rel ? "noopener noreferrer ".concat(rel) : "noopener noreferrer") : rel, role: role || (isButton ? "button" : undefined), tabIndex: tabIndexInteractive, target: target }, restProps);
return {
"aria-busy": isBusy,
"aria-disabled": isDisabled,
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
download,
href,
hrefLang,
media,
onClick: simulatedButton.onClick,
onKeyDown: simulatedButton.onKeyDown,
onKeyUp: simulatedButton.onKeyUp,
ping,
referrerPolicy,
rel: target === "_blank" ? (rel ? `noopener noreferrer ${rel}` : "noopener noreferrer") : rel,
role: role || (isButton ? "button" : undefined),
tabIndex: tabIndexInteractive,
target,
...restProps,
};
}
if (isButton) {
return __assign({ "aria-busy": isBusy, "aria-disabled": isDisabled, className: cx_1.cx.apply(void 0, __spreadArray([classes_1.CLASSES.IS_HOVERABLE], __read(_className), false)), onClick: simulatedButton.onClick, onKeyDown: simulatedButton.onKeyDown, onKeyUp: simulatedButton.onKeyUp, role: role || "button", tabIndex: tabIndexInteractive !== null && tabIndexInteractive !== void 0 ? tabIndexInteractive : 0 }, restProps);
return {
"aria-busy": isBusy,
"aria-disabled": isDisabled,
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
onClick: simulatedButton.onClick,
onKeyDown: simulatedButton.onKeyDown,
onKeyUp: simulatedButton.onKeyUp,
role: role || "button",
tabIndex: tabIndexInteractive !== null && tabIndexInteractive !== void 0 ? tabIndexInteractive : 0,
...restProps,
};
}
return __assign({ className: cx_1.cx.apply(void 0, __spreadArray([], __read(_className), false)), role: role || "none", tabIndex: tabIndex }, restProps);
return {
className: (0, cx_1.cx)(..._className),
role: role || "none",
tabIndex,
...restProps,
};
}
exports.useAnchorProps = useAnchorProps;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQW5jaG9yUHJvcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlQW5jaG9yUHJvcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFDQSxnREFBK0M7QUFDL0Msa0NBQWlDO0FBQ2pDLDZEQUE0RDtBQVM1RCxTQUFnQixjQUFjLENBQW9ELEVBc0I3RDtJQXJCakIsSUFBZSxRQUFRLGtCQUFB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FDLEVBQy9DLFFBQVEsRUFBRSxtQkFBbUIsRUFDN0IsTUFBTSxRQUFBLElBQ0gsU0FBUyxDQUNWLENBQUM7S0FDVjtJQUVELElBQUksUUFBUSxFQUFFO1FBQ1YsT0FBTyxXQUNILFdBQVcsRUFBRSxNQUFNLEVBQ25CLGVBQWUsRUFBRSxVQUFVLEVBQzNCLFNBQVMsRUFBRSxPQUFFLDhCQUFDLGlCQUFPLENBQUMsWUFBWSxVQUFLLFVBQVUsWUFDakQsT0FBTyxFQUFFLGVBQWUsQ0FBQyxPQUFPLEVBQ2hDLFNBQVMsRUFBRSxlQUFlLENBQUMsU0FBUyxFQUNwQyxPQUFPLEVBQUUsZUFBZSxDQUFDLE9BQU8sRUFDaEMsSUFBSSxFQUFFLElBQUksSUFBSSxRQUFRLEVBQ3RCLFFBQVEsRUFBRSxtQkFBbUIsYUFBbkIsbUJBQW1CLGNBQW5CLG1CQUFtQixHQUFJLENBQUMsSUFDL0IsU0FBUyxDQUNWLENBQUM7S0FDVjtJQUVELE9BQU8sV0FDSCxTQUFTLEVBQUUsT0FBRSx3Q0FBSSxVQUFVLFlBQzNCLElBQUksRUFBRSxJQUFJLElBQUksTUFBTSxFQUNwQixRQUFRLFVBQUEsSUFDTCxTQUFTLENBQ1YsQ0FBQztBQUNYLENBQUM7QUFuRkQsd0NBbUZDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useBodyScrollLock = void 0;
var body_scroll_lock_1 = require("body-scroll-lock");
var react_1 = require("react");
function useBodyScrollLock(containerRef, isOpen, _a) {
var _b = _a === void 0 ? {} : _a, allowTouchMove = _b.allowTouchMove, clearAllOnClose = _b.clearAllOnClose, reserveScrollBarGap = _b.reserveScrollBarGap;
(0, react_1.useEffect)(function () {
var node = containerRef.current;
const body_scroll_lock_1 = require("body-scroll-lock");
const react_1 = require("react");
function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClose, reserveScrollBarGap } = {}) {
(0, react_1.useEffect)(() => {
const node = containerRef.current;
if (isOpen && node) {
(0, body_scroll_lock_1.disableBodyScroll)(node, {
allowTouchMove: allowTouchMove ||
(function (element) {
((element) => {
var _a;

@@ -23,6 +22,6 @@ while (element !== document.body) {

}),
reserveScrollBarGap: reserveScrollBarGap,
reserveScrollBarGap,
});
}
return function () {
return () => {
if (node) {

@@ -38,2 +37,1 @@ (0, body_scroll_lock_1.enableBodyScroll)(node);

exports.useBodyScrollLock = useBodyScrollLock;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQm9keVNjcm9sbExvY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlQm9keVNjcm9sbExvY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscURBQW1IO0FBQ25ILCtCQUE2QztBQU03QyxTQUFnQixpQkFBaUIsQ0FDN0IsWUFBMEIsRUFDMUIsTUFBZSxFQUNmLEVBQWdHO1FBQWhHLHFCQUE4RixFQUFFLEtBQUEsRUFBOUYsY0FBYyxvQkFBQSxFQUFFLGVBQWUscUJBQUEsRUFBRSxtQkFBbUIseUJBQUE7SUFFdEQsSUFBQSxpQkFBUyxFQUFDO1FBQ04sSUFBTSxJQUFJLEdBQUcsWUFBWSxDQUFDLE9BQU8sQ0FBQztRQUNsQyxJQUFJLE1BQU0sSUFBSSxJQUFJLEVBQUU7WUFDaEIsSUFBQSxvQ0FBaUIsRUFBQyxJQUFJLEVBQUU7Z0JBQ3BCLGNBQWMsRUFDVixjQUFjO29CQUNkLENBQUMsVUFBQSxPQUFPOzt3QkFDSixPQUFPLE9BQU8sS0FBSyxRQUFRLENBQUMsSUFBSSxFQUFFOzRCQUM5QixJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsOEJBQThCLENBQUMsS0FBSyxJQUFJLEVBQUU7Z0NBQy9ELE9BQU8sSUFBSSxDQUFDOzZCQUNmOzRCQUNELE9BQU8sR0FBRyxNQUFBLE9BQU8sQ0FBQyxhQUFhLG1DQUFJLE9BQU8sQ0FBQzt5QkFDOUM7d0JBQ0QsT0FBTyxLQUFLLENBQUM7b0JBQ2pCLENBQUMsQ0FBQztnQkFDTixtQkFBbUIscUJBQUE7YUFDdEIsQ0FBQyxDQUFDO1NBQ047UUFDRCxPQUFPO1lBQ0gsSUFBSSxJQUFJLEVBQUU7Z0JBQ04sSUFBQSxtQ0FBZ0IsRUFBQyxJQUFJLENBQUMsQ0FBQzthQUMxQjtZQUNELElBQUksZUFBZSxFQUFFO2dCQUNqQixJQUFBLDBDQUF1QixHQUFFLENBQUM7YUFDN0I7UUFDTCxDQUFDLENBQUM7SUFDTixDQUFDLEVBQUUsQ0FBQyxjQUFjLEVBQUUsZUFBZSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsbUJBQW1CLENBQUMsQ0FBQyxDQUFDO0FBQ3JGLENBQUM7QUFoQ0QsOENBZ0NDIn0=
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useButtonProps = void 0;
var react_1 = require("react");
var classes_1 = require("../constants/classes");
var cx_1 = require("../utils/cx");
function useButtonProps(_a) {
var ariaBusy = _a["aria-busy"], ariaDisabled = _a["aria-disabled"], autoFocus = _a.autoFocus, analyticsCallback = _a.analyticsCallback, className = _a.className, disabled = _a.disabled, formAction = _a.formAction, formEncType = _a.formEncType, formMethod = _a.formMethod, formNoValidate = _a.formNoValidate, formTarget = _a.formTarget, loading = _a.loading, name = _a.name, onClick = _a.onClick, role = _a.role, tabIndex = _a.tabIndex, type = _a.type, value = _a.value, restProps = __rest(_a, ["aria-busy", "aria-disabled", "autoFocus", "analyticsCallback", "className", "disabled", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "loading", "name", "onClick", "role", "tabIndex", "type", "value"]);
var isBusy = loading ? loading : Boolean(ariaBusy);
var isDisabled = disabled ? disabled : Boolean(ariaDisabled);
var isBusyOrDisabled = isBusy || isDisabled;
var _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabled && classes_1.CLASSES.IS_DISABLED, className];
var _onClick = (0, react_1.useCallback)(function (e) {
const react_1 = require("react");
const classes_1 = require("../constants/classes");
const cx_1 = require("../utils/cx");
function useButtonProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, autoFocus, analyticsCallback, className, disabled, formAction, formEncType, formMethod, formNoValidate, formTarget, loading, name, onClick, role, tabIndex, type, value, ...restProps }) {
const isBusy = loading ? loading : Boolean(ariaBusy);
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
const isBusyOrDisabled = isBusy || isDisabled;
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabled && classes_1.CLASSES.IS_DISABLED, className];
const _onClick = (0, react_1.useCallback)((e) => {
if (isBusyOrDisabled) {

@@ -74,19 +26,35 @@ e.preventDefault();

if (onClick || type === "reset" || type === "submit") {
var submitProps = {};
let submitProps = {};
if (type === "submit") {
submitProps = {
formAction: formAction,
formEncType: formEncType,
formMethod: formMethod,
formNoValidate: formNoValidate,
formTarget: formTarget,
name: name,
value: value,
formAction,
formEncType,
formMethod,
formNoValidate,
formTarget,
name,
value,
};
}
return __assign(__assign({ "aria-busy": isBusy, "aria-disabled": ariaDisabled, autoFocus: autoFocus, className: cx_1.cx.apply(void 0, __spreadArray([classes_1.CLASSES.IS_HOVERABLE], __read(_className), false)), disabled: disabled, onClick: _onClick, role: role, tabIndex: isBusyOrDisabled ? -1 : tabIndex, type: type }, submitProps), restProps);
return {
"aria-busy": isBusy,
"aria-disabled": ariaDisabled,
autoFocus,
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
disabled,
onClick: _onClick,
role,
tabIndex: isBusyOrDisabled ? -1 : tabIndex,
type,
...submitProps,
...restProps,
};
}
return __assign({ className: cx_1.cx.apply(void 0, __spreadArray([], __read(_className), false)), role: role, tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : -1 }, restProps);
return {
className: (0, cx_1.cx)(..._className),
role,
tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : -1,
...restProps,
};
}
exports.useButtonProps = useButtonProps;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQnV0dG9uUHJvcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlQnV0dG9uUHJvcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Oz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1gsU0FBUyxDQUNWLENBQUM7S0FDVjtJQUVELE9BQU8sV0FDSCxTQUFTLEVBQUUsT0FBRSx3Q0FBSSxVQUFVLFlBQzNCLElBQUksTUFBQSxFQUNKLFFBQVEsRUFBRSxRQUFRLGFBQVIsUUFBUSxjQUFSLFFBQVEsR0FBSSxDQUFDLENBQUMsSUFDckIsU0FBUyxDQUNWLENBQUM7QUFDWCxDQUFDO0FBN0VELHdDQTZFQyJ9
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useClickableProps = void 0;
var classes_1 = require("../constants/classes");
var cx_1 = require("../utils/cx");
var _useSimulatedButton_1 = require("./_useSimulatedButton");
function useClickableProps(_a) {
var ariaBusy = _a["aria-busy"], ariaDisabled = _a["aria-disabled"], analyticsCallback = _a.analyticsCallback, className = _a.className, disabled = _a.disabled, loading = _a.loading, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, role = _a.role, tabIndex = _a.tabIndex, type = _a.type, restProps = __rest(_a, ["aria-busy", "aria-disabled", "analyticsCallback", "className", "disabled", "loading", "onClick", "onKeyDown", "onKeyUp", "role", "tabIndex", "type"]);
var isBusy = loading ? loading : Boolean(ariaBusy);
var isDisabled = disabled ? disabled : Boolean(ariaDisabled);
var isBusyOrDisabled = isBusy || isDisabled;
var submit = type === "submit";
var isButton = submit || !!onClick;
var _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabled && classes_1.CLASSES.IS_DISABLED, className];
var simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
analyticsCallback: analyticsCallback,
const classes_1 = require("../constants/classes");
const cx_1 = require("../utils/cx");
const _useSimulatedButton_1 = require("./_useSimulatedButton");
function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, loading, onClick, onKeyDown, onKeyUp, role, tabIndex, type, ...restProps }) {
const isBusy = loading ? loading : Boolean(ariaBusy);
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
const isBusyOrDisabled = isBusy || isDisabled;
const submit = type === "submit";
const isButton = submit || !!onClick;
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabled && classes_1.CLASSES.IS_DISABLED, className];
const simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
analyticsCallback,
isClickable: !isBusyOrDisabled || isButton,
isHyperlink: false,
onClick: onClick,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp,
submit: submit,
onClick,
onKeyDown,
onKeyUp,
submit,
});
if (isButton) {
return __assign({ "aria-busy": isBusy, "aria-disabled": isDisabled, className: cx_1.cx.apply(void 0, __spreadArray([classes_1.CLASSES.IS_HOVERABLE], __read(_className), false)), onClick: simulatedButton.onClick, onKeyDown: simulatedButton.onKeyDown, onKeyUp: simulatedButton.onKeyUp, role: role || "button", tabIndex: isBusyOrDisabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0 }, restProps);
return {
"aria-busy": isBusy,
"aria-disabled": isDisabled,
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
onClick: simulatedButton.onClick,
onKeyDown: simulatedButton.onKeyDown,
onKeyUp: simulatedButton.onKeyUp,
role: role || "button",
tabIndex: isBusyOrDisabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0,
...restProps,
};
}
return __assign({ className: cx_1.cx.apply(void 0, __spreadArray([], __read(_className), false)), role: role, tabIndex: tabIndex }, restProps);
return {
className: (0, cx_1.cx)(..._className),
role,
tabIndex,
...restProps,
};
}
exports.useClickableProps = useClickableProps;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQ2xpY2thYmxlUHJvcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlQ2xpY2thYmxlUHJvcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFDQSxnREFBK0M7QUFDL0Msa0NBQWlDO0FBQ2pDLDZEQUE0RDtBQVM1RCxTQUFnQixpQkFBaUIsQ0FBd0MsRUFjakQ7SUFicEIsSUFBZSxRQUFRLGtCQUFBLEVBQ0osWUFBWSxzQkFBQSxFQUMvQixpQkFBaUIsdUJBQUEsRUFDakIsU0FBUyxlQUFBLEVBQ1QsUUFBUSxjQUFBLEVBQ1IsT0FBTyxhQUFBLEVBQ1AsT0FBTyxhQUFBLEVBQ1AsU0F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FTLEVBQUUsT0FBRSw4QkFBQyxpQkFBTyxDQUFDLFlBQVksVUFBSyxVQUFVLFlBQ2pELE9BQU8sRUFBRSxlQUFlLENBQUMsT0FBTyxFQUNoQyxTQUFTLEVBQUUsZUFBZSxDQUFDLFNBQVMsRUFDcEMsT0FBTyxFQUFFLGVBQWUsQ0FBQyxPQUFPLEVBQ2hDLElBQUksRUFBRSxJQUFJLElBQUksUUFBUSxFQUN0QixRQUFRLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLGFBQVIsUUFBUSxjQUFSLFFBQVEsR0FBSSxDQUFDLElBQzVDLFNBQVMsQ0FDVixDQUFDO0tBQ1Y7SUFFRCxPQUFPLFdBQ0gsU0FBUyxFQUFFLE9BQUUsd0NBQUksVUFBVSxZQUMzQixJQUFJLE1BQUEsRUFDSixRQUFRLFVBQUEsSUFDTCxTQUFTLENBQ1YsQ0FBQztBQUNYLENBQUM7QUFwREQsOENBb0RDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFocusReturn = void 0;
var react_1 = require("react");
var useOnUpdate_1 = require("./useOnUpdate");
function useFocusReturn(opened, transitionDuration, shouldReturnFocus) {
if (transitionDuration === void 0) { transitionDuration = 0; }
if (shouldReturnFocus === void 0) { shouldReturnFocus = true; }
var lastActiveElement = (0, react_1.useRef)();
var returnFocus = function () {
var node = lastActiveElement.current;
const react_1 = require("react");
const useOnUpdate_1 = require("./useOnUpdate");
function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true) {
const lastActiveElement = (0, react_1.useRef)();
const returnFocus = () => {
const node = lastActiveElement.current;
if (node && "focus" in node && typeof node.focus === "function") {

@@ -16,5 +14,5 @@ node.focus();

};
(0, useOnUpdate_1.useOnUpdate)(function () {
var timeout = -1;
var clearFocusTimeout = function (e) {
(0, useOnUpdate_1.useOnUpdate)(() => {
let timeout = -1;
const clearFocusTimeout = (e) => {
if (e.key === "Tab") {

@@ -31,3 +29,3 @@ clearTimeout(timeout);

}
return function () {
return () => {
clearTimeout(timeout);

@@ -40,2 +38,1 @@ document.removeEventListener("keydown", clearFocusTimeout);

exports.useFocusReturn = useFocusReturn;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlRm9jdXNSZXR1cm4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlRm9jdXNSZXR1cm4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQStCO0FBQy9CLDZDQUE0QztBQUU1QyxTQUFnQixjQUFjLENBQUMsTUFBZSxFQUFFLGtCQUFzQixFQUFFLGlCQUF3QjtJQUFoRCxtQ0FBQSxFQUFBLHNCQUFzQjtJQUFFLGtDQUFBLEVBQUEsd0JBQXdCO0lBQzVGLElBQU0saUJBQWlCLEdBQUcsSUFBQSxjQUFNLEdBQWUsQ0FBQztJQUNoRCxJQUFNLFdBQVcsR0FBRztRQUNoQixJQUFNLElBQUksR0FBRyxpQkFBaUIsQ0FBQyxPQUFPLENBQUM7UUFDdkMsSUFBSSxJQUFJLElBQUksT0FBTyxJQUFJLElBQUksSUFBSSxPQUFPLElBQUksQ0FBQyxLQUFLLEtBQUssVUFBVSxFQUFFO1lBQzdELElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQztTQUNoQjtJQUNMLENBQUMsQ0FBQztJQUVGLElBQUEseUJBQVcsRUFBQztRQUNSLElBQUksT0FBTyxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBRWpCLElBQU0saUJBQWlCLEdBQUcsVUFBQyxDQUFnQjtZQUN2QyxJQUFJLENBQUMsQ0FBQyxHQUFHLEtBQUssS0FBSyxFQUFFO2dCQUNqQixZQUFZLENBQUMsT0FBTyxDQUFDLENBQUM7YUFDekI7UUFDTCxDQUFDLENBQUM7UUFFRixRQUFRLENBQUMsZ0JBQWdCLENBQUMsU0FBUyxFQUFFLGlCQUFpQixDQUFDLENBQUM7UUFFeEQsSUFBSSxNQUFNLEVBQUU7WUFDUixpQkFBaUIsQ0FBQyxPQUFPLEdBQUcsUUFBUSxDQUFDLGFBQTRCLENBQUM7U0FDckU7YUFBTSxJQUFJLGlCQUFpQixFQUFFO1lBQzFCLE9BQU8sR0FBRyxNQUFNLENBQUMsVUFBVSxDQUFDLFdBQVcsRUFBRSxrQkFBa0IsR0FBRyxFQUFFLENBQUMsQ0FBQztTQUNyRTtRQUVELE9BQU87WUFDSCxZQUFZLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDdEIsUUFBUSxDQUFDLG1CQUFtQixDQUFDLFNBQVMsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO1FBQy9ELENBQUMsQ0FBQztJQUNOLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7SUFFYixPQUFPLFdBQVcsQ0FBQztBQUN2QixDQUFDO0FBakNELHdDQWlDQyJ9

@@ -1,1 +0,2 @@

export declare function useFocusTrap<T extends HTMLElement>(active?: boolean): (instance: T | null) => void;
import { RefCallback } from "react";
export declare function useFocusTrap<T extends HTMLElement>(active?: boolean): RefCallback<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFocusTrap = void 0;
var react_1 = require("react");
var useOnUnmount_1 = require("./useOnUnmount");
var TABBABLE_NODES = /input|select|textarea|button|object/;
var FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
const react_1 = require("react");
const useOnUnmount_1 = require("./useOnUnmount");
const TABBABLE_NODES = /input|select|textarea|button|object/;
const FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
function hidden(element) {

@@ -12,3 +12,3 @@ return element.style.display === "none";

function visible(element) {
var parentElement = element;
let parentElement = element;
while (parentElement) {

@@ -26,3 +26,3 @@ if (parentElement === document.body) {

function getElementTabIndex(element) {
var tabIndex = element.getAttribute("tabindex");
const tabIndex = element.getAttribute("tabindex");
if (tabIndex === null) {

@@ -34,5 +34,5 @@ return NaN;

function focusable(element) {
var nodeName = element.nodeName.toLowerCase();
var isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element));
var res = (TABBABLE_NODES.test(nodeName) && !element.disabled) ||
const nodeName = element.nodeName.toLowerCase();
const isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element));
const res = (TABBABLE_NODES.test(nodeName) && !element.disabled) ||
(element instanceof HTMLAnchorElement ? Boolean(element.href) || isTabIndexNotNaN : isTabIndexNotNaN);

@@ -42,4 +42,4 @@ return res && visible(element);

function tabbable(element) {
var tabIndex = getElementTabIndex(element);
var isTabIndexNaN = Number.isNaN(tabIndex);
const tabIndex = getElementTabIndex(element);
const isTabIndexNaN = Number.isNaN(tabIndex);
return (isTabIndexNaN || tabIndex >= 0) && focusable(element);

@@ -51,3 +51,3 @@ }

function scopeTab(node, event) {
var _tabbable = findTabbableDescendants(node);
const _tabbable = findTabbableDescendants(node);
if (!_tabbable.length) {

@@ -57,4 +57,4 @@ event.preventDefault();

}
var finalTabbable = _tabbable[event.shiftKey ? 0 : _tabbable.length - 1];
var leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
const finalTabbable = _tabbable[event.shiftKey ? 0 : _tabbable.length - 1];
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
if (!leavingFinalTabbable) {

@@ -64,3 +64,3 @@ return;

event.preventDefault();
var target = _tabbable[event.shiftKey ? _tabbable.length - 1 : 0];
const target = _tabbable[event.shiftKey ? _tabbable.length - 1 : 0];
if (target) {

@@ -70,16 +70,15 @@ target.focus();

}
function createAriaHider(containerNode, selector) {
if (selector === void 0) { selector = "body > :not(script)"; }
var rootNodes = Array.from(document.querySelectorAll(selector)).map(function (node) {
function createAriaHider(containerNode, selector = "body > :not(script)") {
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
if (node.contains(containerNode)) {
return;
}
var ariaHidden = node.getAttribute("aria-hidden");
const ariaHidden = node.getAttribute("aria-hidden");
if (ariaHidden === null || ariaHidden === "false") {
node.setAttribute("aria-hidden", "true");
}
return { node: node, ariaHidden: ariaHidden };
return { node, ariaHidden };
});
return function () {
rootNodes.forEach(function (item) {
return () => {
rootNodes.forEach((item) => {
if (!item) {

@@ -97,8 +96,7 @@ return;

}
function useFocusTrap(active) {
if (active === void 0) { active = true; }
var ref = (0, react_1.useRef)();
var restoreAria = (0, react_1.useRef)();
var timer = (0, react_1.useRef)();
var setRef = (0, react_1.useCallback)(function (node) {
function useFocusTrap(active = true) {
const ref = (0, react_1.useRef)();
const restoreAria = (0, react_1.useRef)();
const timer = (0, react_1.useRef)();
const setRef = (0, react_1.useCallback)((node) => {
if (!active) {

@@ -112,7 +110,7 @@ ref.current = null;

if (node) {
var processNode_1 = function (_node) {
const processNode = (_node) => {
restoreAria.current = createAriaHider(_node);
var focusElement = node.querySelector("[data-autofocus]");
let focusElement = node.querySelector("[data-autofocus]");
if (!focusElement) {
var children = Array.from(node.querySelectorAll(FOCUS_SELECTOR));
const children = Array.from(node.querySelectorAll(FOCUS_SELECTOR));
focusElement = children.find(tabbable) || children.find(focusable) || null;

@@ -128,6 +126,6 @@ if (!focusElement && focusable(node)) {

// Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
timer.current = window.setTimeout(function () {
timer.current = window.setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (node.ownerDocument) {
processNode_1(node);
processNode(node);
}

@@ -141,8 +139,8 @@ });

}, [active]);
(0, react_1.useEffect)(function () {
(0, react_1.useEffect)(() => {
if (!active) {
return;
}
var handler = function (e) {
var node = ref.current;
const handler = (e) => {
const node = ref.current;
if (e.key === "Tab" && node) {

@@ -153,10 +151,9 @@ scopeTab(node, e);

document.addEventListener("keydown", handler);
return function () {
return () => {
document.removeEventListener("keydown", handler);
};
}, [active]);
(0, useOnUnmount_1.useOnUnmount)(function () { return clearTimeout(timer.current); });
(0, useOnUnmount_1.useOnUn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E1BQU0sQ0FBQztBQUNsQixDQUFDO0FBeEVELG9DQXdFQyJ9
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useInputFocus = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useInputFocus(focusRef, onBlur, onFocus) {
var _a = __read((0, react_1.useState)(false), 2), focused = _a[0], setFocused = _a[1];
var focus = (0, react_1.useCallback)(function () {
var node = focusRef.current;
const [focused, setFocused] = (0, react_1.useState)(false);
const focus = (0, react_1.useCallback)(() => {
const node = focusRef.current;
if (node) {

@@ -29,3 +13,3 @@ node.focus();

}, [focusRef]);
var _onFocus = (0, react_1.useCallback)(function (e) {
const _onFocus = (0, react_1.useCallback)((e) => {
setFocused(true);

@@ -36,3 +20,3 @@ if (onFocus) {

}, [onFocus]);
var _onBlur = (0, react_1.useCallback)(function (e) {
const _onBlur = (0, react_1.useCallback)((e) => {
setFocused(false);

@@ -43,5 +27,4 @@ if (onBlur) {

}, [onBlur]);
return { focused: focused, focus: focus, onBlur: _onBlur, onFocus: _onFocus };
return { focused, focus, onBlur: _onBlur, onFocus: _onFocus };
}
exports.useInputFocus = useInputFocus;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlSW5wdXRGb2N1cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VJbnB1dEZvY3VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwrQkFBK0Y7QUFFL0YsU0FBZ0I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__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIsMounted = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useIsMounted() {
var _a = __read((0, react_1.useState)(false), 2), isMounted = _a[0], setIsMounted = _a[1];
(0, react_1.useEffect)(function () { return setIsMounted(true); }, []);
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
(0, react_1.useEffect)(() => setIsMounted(true), []);
return isMounted;
}
exports.useIsMounted = useIsMounted;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlSXNNb3VudGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3VzZUlzTW91bnRlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsK0JBQTRDO0FBRTVDLFNBQWdCLFlBQVk7SUFDbEIsSUFBQSxLQUFBLE9BQTRCLElBQUEsZ0JBQVEsRUFBQyxLQUFLLENBQUMsSUFBQSxFQUExQyxTQUFTLFFBQUEsRUFBRSxZQUFZLFFBQW1CLENBQUM7SUFFbEQsSUFBQSxpQkFBUyxFQUFDLGNBQU0sT0FBQSxZQUFZLENBQUMsSUFBSSxDQUFDLEVBQWxCLENBQWtCLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFFeEMsT0FBTyxTQUFTLENBQUM7QUFDckIsQ0FBQztBQU5ELG9DQU1DIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIsomorphicLayoutEffect = void 0;
var react_1 = require("react");
var isBrowser_1 = require("../utils/isBrowser");
const react_1 = require("react");
const isBrowser_1 = require("../utils/isBrowser");
exports.useIsomorphicLayoutEffect = isBrowser_1.isBrowser ? react_1.useLayoutEffect : react_1.useEffect;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlSXNvbW9ycGhpY0xheW91dEVmZmVjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VJc29tb3JwaGljTGF5b3V0RWZmZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFtRDtBQUNuRCxnREFBK0M7QUFFbEMsUUFBQSx5QkFBeUIsR0FBRyxxQkFBUyxDQUFDLENBQUMsQ0FBQyx1QkFBZSxDQUFDLENBQUMsQ0FBQyxpQkFBUyxDQUFDIn0=
import { RefObject } from "react";
declare type KeyPredicate = (e: KeyboardEvent) => boolean;
export declare type KeyFilter = null | undefined | string | KeyPredicate;
type KeyPredicate = (e: KeyboardEvent) => boolean;
export type KeyFilter = null | undefined | string | KeyPredicate;
export interface UseKeyOptions<T extends HTMLElement> {

@@ -5,0 +5,0 @@ disabled?: boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useKey = void 0;
var react_1 = require("react");
var createKeyPredicate = function (keyFilter) {
return typeof keyFilter === "function"
? keyFilter
: typeof keyFilter === "string"
? function (e) { return e.key === keyFilter; }
: function () { return false; };
};
function useKey(keyFilter, callback, _a) {
var _b = _a === void 0 ? {} : _a, disabled = _b.disabled, targetRef = _b.targetRef, _c = _b.type, type = _c === void 0 ? "keydown" : _c;
(0, react_1.useEffect)(function () {
const react_1 = require("react");
const createKeyPredicate = (keyFilter) => typeof keyFilter === "function"
? keyFilter
: typeof keyFilter === "string"
? (e) => e.key === keyFilter
: () => false;
function useKey(keyFilter, callback, { disabled, targetRef, type = "keydown" } = {}) {
(0, react_1.useEffect)(() => {
if (disabled) {
return;
}
var thisNode = (targetRef ? targetRef.current : document);
var predicate = createKeyPredicate(keyFilter);
var handler = function (e) {
const thisNode = (targetRef ? targetRef.current : document);
const predicate = createKeyPredicate(keyFilter);
const handler = (e) => {
if (predicate(e)) {

@@ -26,3 +23,3 @@ callback(e);

thisNode === null || thisNode === void 0 ? void 0 : thisNode.addEventListener(type, handler);
return function () {
return () => {
thisNode === null || thisNode === void 0 ? void 0 : thisNode.removeEventListener(type, handler);

@@ -33,2 +30,1 @@ };

exports.useKey = useKey;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlS2V5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3VzZUtleS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBNkM7QUFLN0MsSUFBTSxrQkFBa0IsR0FBRyxVQUFDLFNBQW9CO0lBQzVDLE9BQUEsT0FBTyxTQUFTLEtBQUssVUFBVTtRQUMzQixDQUFDLENBQUMsU0FBUztRQUNYLENBQUMsQ0FBQyxPQUFPLFNBQVMsS0FBSyxRQUFRO1lBQy9CLENBQUMsQ0FBQyxVQUFDLENBQWdCLElBQUssT0FBQSxDQUFDLENBQUMsR0FBRyxLQUFLLFNBQVMsRUFBbkIsQ0FBbUI7WUFDM0MsQ0FBQyxDQUFDLGNBQU0sT0FBQSxLQUFLLEVBQUwsQ0FBSztBQUpqQixDQUlpQixDQUFDO0FBUXRCLFNBQWdCLE1BQU0sQ0FDbEIsU0FBb0IsRUFDcEIsUUFBb0MsRUFDcEMsRUFBeUU7UUFBekUscUJBQXVFLEVBQUUsS0FBQSxFQUF2RSxRQUFRLGNBQUEsRUFBRSxTQUFTLGVBQUEsRUFBRSxZQUFnQixFQUFoQixJQUFJLG1CQUFHLFNBQVMsS0FBQTtJQUV2QyxJQUFBLGlCQUFTLEVBQUM7UUFDTixJQUFJLFFBQVEsRUFBRTtZQUNWLE9BQU87U0FDVjtRQUNELElBQU0sUUFBUSxHQUFHLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQXVCLENBQUM7UUFDbEYsSUFBTSxTQUFTLEdBQUcsa0JBQWtCLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDaEQsSUFBTSxPQUFPLEdBQUcsVUFBQyxDQUFnQjtZQUM3QixJQUFJLFNBQVMsQ0FBQyxDQUFDLENBQUMsRUFBRTtnQkFDZCxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUM7YUFDZjtRQUNMLENBQUMsQ0FBQztRQUNGLFFBQVEsYUFBUixRQUFRLHVCQUFSLFFBQVEsQ0FBRSxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFDMUMsT0FBTztZQUNILFFBQVEsYUFBUixRQUFRLHVCQUFSLFFBQVEsQ0FBRSxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFDakQsQ0FBQyxDQUFDO0lBQ04sQ0FBQyxFQUFFLENBQUMsUUFBUSxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsU0FBUyxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUM7QUFDekQsQ0FBQztBQXJCRCx3QkFxQkMifQ==

@@ -0,1 +1,2 @@

/// <reference types="react" />
export declare function useLatest<T>(current: T): import("react").MutableRefObject<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLatest = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useLatest(current) {
var storedValue = (0, react_1.useRef)(current);
const storedValue = (0, react_1.useRef)(current);
storedValue.current = current;

@@ -11,2 +11,1 @@ return storedValue;

exports.useLatest = useLatest;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTGF0ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3VzZUxhdGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFFL0IsU0FBZ0IsU0FBUyxDQUFJLE9BQVU7SUFDbkMsSUFBTSxXQUFXLEdBQUcsSUFBQSxjQUFNLEVBQUMsT0FBTyxDQUFDLENBQUM7SUFFcEMsV0FBVyxDQUFDLE9BQU8sR0FBRyxPQUFPLENBQUM7SUFFOUIsT0FBTyxXQUFXLENBQUM7QUFDdkIsQ0FBQztBQU5ELDhCQU1DIn0=
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useMinWindowWidth = void 0;
var react_1 = require("react");
var useRafState_1 = require("./useRafState");
function useMinWindowWidth(minWidth, debounce) {
if (debounce === void 0) { debounce = 0; }
var _a = __read((0, useRafState_1.useRafState)(), 2), state = _a[0], setState = _a[1];
(0, react_1.useEffect)(function () {
var stateHandler = function () { return setState(window.innerWidth >= minWidth); };
var timer;
var handler = function () {
const react_1 = require("react");
const useRafState_1 = require("./useRafState");
function useMinWindowWidth(minWidth, debounce = 0) {
const [state, setState] = (0, useRafState_1.useRafState)();
(0, react_1.useEffect)(() => {
const stateHandler = () => setState(window.innerWidth >= minWidth);
let timer;
const handler = () => {
if (debounce > 0) {

@@ -39,3 +22,3 @@ window.clearTimeout(timer);

window.addEventListener("resize", handler);
return function () {
return () => {
window.removeEventListener("resize", handler);

@@ -48,2 +31,1 @@ window.clearTimeout(timer);

exports.useMinWindowWidth = useMinWindowWidth;
//# sourceMappingURL=data:application/json;base64,eyJ2ZX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UFDOUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUMvQixDQUFDLENBQUM7SUFDTixDQUFDLEVBQUUsQ0FBQyxRQUFRLEVBQUUsUUFBUSxFQUFFLFFBQVEsQ0FBQyxDQUFDLENBQUM7SUFFbkMsT0FBTyxLQUFLLENBQUM7QUFDakIsQ0FBQztBQXhCRCw4Q0F3QkMifQ==
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useMouseDragToScroll = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useMouseDragToScroll(containerRef) {
var position = (0, react_1.useRef)({ left: 0, top: 0, x: 0, y: 0 });
var _a = __read((0, react_1.useState)(), 2), style = _a[0], setStyle = _a[1];
(0, react_1.useEffect)(function () {
var node = containerRef.current;
const position = (0, react_1.useRef)({ left: 0, top: 0, x: 0, y: 0 });
const [style, setStyle] = (0, react_1.useState)();
(0, react_1.useEffect)(() => {
const node = containerRef.current;
if (!node) {
return;
}
var mouseMoveHandler = function (e) {
var dx = e.clientX - position.current.x;
var dy = e.clientY - position.current.y;
const mouseMoveHandler = (e) => {
const dx = e.clientX - position.current.x;
const dy = e.clientY - position.current.y;
node.scrollLeft = position.current.left - dx;
node.scrollTop = position.current.top - dy;
};
var mouseUpHandler = function () {
setStyle(function (prev) { return (__assign(__assign({}, prev), { cursor: "grab", userSelect: "unset" })); });
const mouseUpHandler = () => {
setStyle((prev) => ({ ...prev, cursor: "grab", userSelect: "unset" }));
document.removeEventListener("mousemove", mouseMoveHandler);
document.removeEventListener("mouseup", mouseUpHandler);
};
var mouseDownHandler = function (e) {
const mouseDownHandler = (e) => {
position.current = { left: node.scrollLeft, top: node.scrollTop, x: e.clientX, y: e.clientY };
setStyle(function (prev) { return (__assign(__assign({}, prev), { cursor: "grabbing", userSelect: "none" })); });
setStyle((prev) => ({ ...prev, cursor: "grabbing", userSelect: "none" }));
document.addEventListener("mousemove", mouseMoveHandler);

@@ -58,3 +31,3 @@ document.addEventListener("mouseup", mouseUpHandler);

node.addEventListener("mousedown", mouseDownHandler);
return function () {
return () => {
node.removeEventListener("mousedown", mouseDownHandler);

@@ -68,2 +41,1 @@ document.removeEventListener("mousedown", mouseMoveHandler);

exports.useMouseDragToScroll = useMouseDragToScroll;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTW91c2VEcmFnVG9TY3JvbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlTW91c2VEcmFnVG9TY3JvbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsK0JBQThFO0FBRTlFLFNBQWdCLG9CQUFvQixDQUF3QixZQUEwQjtJQUNsRixJQUFNLFFBQVEsR0FBRyxJQUFBLGNBQU0sRUFBQyxFQUFFLElBQUksRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQ25ELElBQUEsS0FBQSxPQUFvQixJQUFBLGdCQUFRLEdBQWlCLElBQUEsRUFBNUMsS0FBSyxRQUFBLEVBQUU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FBRyxFQUFFLElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQztZQUM5RixRQUFRLENBQUMsVUFBQSxJQUFJLElBQUksT0FBQSx1QkFBTSxJQUFJLEtBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxVQUFVLEVBQUUsTUFBTSxJQUFHLEVBQXJELENBQXFELENBQUMsQ0FBQztZQUV4RSxRQUFRLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLGdCQUFnQixDQUFDLENBQUM7WUFDekQsUUFBUSxDQUFDLGdCQUFnQixDQUFDLFNBQVMsRUFBRSxjQUFjLENBQUMsQ0FBQztRQUN6RCxDQUFDLENBQUM7UUFFRixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLGdCQUFnQixDQUFDLENBQUM7UUFDckQsT0FBTztZQUNILElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxXQUFXLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztZQUN4RCxRQUFRLENBQUMsbUJBQW1CLENBQUMsV0FBVyxFQUFFLGdCQUFnQixDQUFDLENBQUM7WUFDNUQsUUFBUSxDQUFDLG1CQUFtQixDQUFDLFdBQVcsRUFBRSxjQUFjLENBQUMsQ0FBQztRQUM5RCxDQUFDLENBQUM7SUFDTixDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDO0lBRW5CLE9BQU8sS0FBSyxDQUFDO0FBQ2pCLENBQUM7QUExQ0Qsb0RBMENDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useOnMount = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useOnMount(effect) {
(0, react_1.useEffect)(function () {
(0, react_1.useEffect)(() => {
return effect();

@@ -11,2 +11,1 @@ }, []); // eslint-disable-line react-hooks/exhaustive-deps

exports.useOnMount = useOnMount;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlT25Nb3VudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VPbk1vdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFrRDtBQUVsRCxTQUFnQixVQUFVLENBQUMsTUFBc0I7SUFDN0MsSUFBQSxpQkFBUyxFQUFDO1FBQ04sT0FBTyxNQUFNLEVBQUUsQ0FBQztJQUNwQixDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQyxrREFBa0Q7QUFDOUQsQ0FBQztBQUpELGdDQUlDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useOnUnmount = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useOnUnmount(effect) {
var effectRef = (0, react_1.useRef)(effect);
const effectRef = (0, react_1.useRef)(effect);
// update the ref each render so if it changed the newest callback will be invoked
effectRef.current = effect;
(0, react_1.useEffect)(function () {
return function () {
(0, react_1.useEffect)(() => {
return () => {
effectRef.current();

@@ -16,2 +16,1 @@ };

exports.useOnUnmount = useOnUnmount;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlT25Vbm1vdW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3VzZU9uVW5tb3VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBMEQ7QUFFMUQsU0FBZ0IsWUFBWSxDQUFDLE1BQXNCO0lBQy9DLElBQU0sU0FBUyxHQUFHLElBQUEsY0FBTSxFQUFDLE1BQU0sQ0FBQyxDQUFDO0lBRWpDLGtGQUFrRjtJQUNsRixTQUFTLENBQUMsT0FBTyxHQUFHLE1BQU0sQ0FBQztJQUUzQixJQUFBLGlCQUFTLEVBQUM7UUFDTixPQUFPO1lBQ0gsU0FBUyxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ3hCLENBQUMsQ0FBQztJQUNOLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztBQUNYLENBQUM7QUFYRCxvQ0FXQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useOnUpdate = void 0;
var react_1 = require("react");
const react_1 = require("react");
function useOnUpdate(effect, deps) {
var firstRun = (0, react_1.useRef)(true);
(0, react_1.useEffect)(function () {
const firstRun = (0, react_1.useRef)(true);
(0, react_1.useEffect)(() => {
if (firstRun.current) {

@@ -16,2 +16,1 @@ firstRun.current = false;

exports.useOnUpdate = useOnUpdate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlT25VcGRhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlT25VcGRhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQTBFO0FBRTFFLFNBQWdCLFdBQVcsQ0FBQyxNQUFzQixFQUFFLElBQW9CO0lBQ3BFLElBQU0sUUFBUSxHQUFHLElBQUEsY0FBTSxFQUFDLElBQUksQ0FBQyxDQUFDO0lBRTlCLElBQUEsaUJBQVMsRUFBQztRQUNOLElBQUksUUFBUSxDQUFDLE9BQU8sRUFBRTtZQUNsQixRQUFRLENBQUMsT0FBTyxHQUFHLEtBQUssQ0FBQztZQUN6QixPQUFPO1NBQ1Y7UUFDRCxPQUFPLE1BQU0sRUFBRSxDQUFDO0lBQ3BCLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQyxDQUFDLGtEQUFrRDtBQUNoRSxDQUFDO0FBVkQsa0NBVUMifQ==
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePagination = void 0;
var react_1 = require("react");
var pagination_1 = require("../utils/pagination");
var usePagination = function (config) {
return (0, react_1.useMemo)(function () { return (0, pagination_1.paginationGenerate)(config); },
const react_1 = require("react");
const pagination_1 = require("../utils/pagination");
const usePagination = (config) => {
return (0, react_1.useMemo)(() => (0, pagination_1.paginationGenerate)(config),
// eslint-disable-next-line react-hooks/exhaustive-deps

@@ -21,2 +21,1 @@ [

exports.usePagination = usePagination;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlUGFnaW5hdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VQYWdpbmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFnQztBQUNoQyxrREFBMkY7QUFFcEYsSUFBTSxhQUFhLEdBQUcsVUFBQyxNQUF3QjtJQUNsRCxPQUFPLElBQUEsZUFBTyxFQUNWLGNBQU0sT0FBQSxJQUFBLCtCQUFrQixFQUFDLE1BQU0sQ0FBQyxFQUExQixDQUEwQjtJQUNoQyx1REFBdUQ7SUFDdkQ7UUFDSSxNQUFNLENBQUMsYUFBYTtRQUNwQixNQUFNLENBQUMsWUFBWTtRQUNuQixNQUFNLENBQUMsS0FBSztRQUNaLE1BQU0sQ0FBQyxJQUFJO1FBQ1gsTUFBTSxDQUFDLGNBQWM7UUFDckIsTUFBTSxDQUFDLGNBQWM7UUFDckIsTUFBTSxDQUFDLGVBQWU7UUFDdEIsTUFBTSxDQUFDLGNBQWM7S0FDeEIsQ0FDSixDQUFDO0FBQ04sQ0FBQyxDQUFDO0FBZlcsUUFBQSxhQUFhLGlCQWV4QiJ9

@@ -0,1 +1,2 @@

/// <reference types="react" />
export declare function usePrevious<T>(current: T): import("react").MutableRefObject<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePrevious = void 0;
var react_1 = require("react");
const react_1 = require("react");
function usePrevious(current) {
var storedValue = (0, react_1.useRef)(current);
(0, react_1.useEffect)(function () {
const storedValue = (0, react_1.useRef)(current);
(0, react_1.useEffect)(() => {
storedValue.current = current;

@@ -13,2 +13,1 @@ });

exports.usePrevious = usePrevious;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlUHJldmlvdXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlUHJldmlvdXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQTBDO0FBRTFDLFNBQWdCLFdBQVcsQ0FBSSxPQUFVO0lBQ3JDLElBQU0sV0FBVyxHQUFHLElBQUEsY0FBTSxFQUFDLE9BQU8sQ0FBQyxDQUFDO0lBRXBDLElBQUEsaUJBQVMsRUFBQztRQUNOLFdBQVcsQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO0lBQ2xDLENBQUMsQ0FBQyxDQUFDO0lBRUgsT0FBTyxXQUFXLENBQUM7QUFDdkIsQ0FBQztBQVJELGtDQVFDIn0=
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useRafState = void 0;
var react_1 = require("react");
var useOnUnmount_1 = require("./useOnUnmount");
const react_1 = require("react");
const useOnUnmount_1 = require("./useOnUnmount");
function useRafState(initialState) {
var frame = (0, react_1.useRef)(0);
var _a = __read((0, react_1.useState)(initialState), 2), state = _a[0], setState = _a[1];
var setRafState = (0, react_1.useCallback)(function (value) {
const frame = (0, react_1.useRef)(0);
const [state, setState] = (0, react_1.useState)(initialState);
const setRafState = (0, react_1.useCallback)((value) => {
cancelAnimationFrame(frame.current);
frame.current = requestAnimationFrame(function () {
frame.current = requestAnimationFrame(() => {
setState(value);
});
}, []);
(0, useOnUnmount_1.useOnUnmount)(function () { return cancelAnimationFrame(frame.current); });
(0, useOnUnmount_1.useOnUnmount)(() => cancelAnimationFrame(frame.current));
return [state, setRafState];
}
exports.useRafState = useRafState;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlUmFmU3RhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlUmFmU3RhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLCtCQUFnRjtBQUNoRiwrQ0FBOEM7QUFFOUMsU0FBZ0IsV0FBVyxDQUN2QixZQUE0QjtJQUU1QixJQUFNLEtBQUssR0FBRyxJQUFBLGNBQU0sRUFBQyxDQUFDLENBQUMsQ0FBQztJQUNsQixJQUFBLEtBQUEsT0FBb0IsSUFBQSxnQkFBUSxFQUFDLFlBQVksQ0FBQyxJQUFBLEVBQXpDLEtBQUssUUFBQSxFQUFFLFFBQVEsUUFBMEIsQ0FBQztJQUVqRCxJQUFNLFdBQVcsR0FBRyxJQUFBLG1CQUFXLEVBQUMsVUFBQyxLQUFvQztRQUNqRSxvQkFBb0IsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFcEMsS0FBSyxDQUFDLE9BQU8sR0FBRyxxQkFBcUIsQ0FBQztZQUNsQyxRQUFRLENBQUMsS0FBSyxDQUFDLENBQUM7UUFDcEIsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFFUCxJQUFBLDJCQUFZLEVBQUMsY0FBTSxPQUFBLG9CQUFvQixDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsRUFBbkMsQ0FBbUMsQ0FBQyxDQUFDO0lBRXhELE9BQU8sQ0FBQyxLQUFLLEVBQUUsV0FBVyxDQUFDLENBQUM7QUFDaEMsQ0FBQztBQWpCRCxrQ0FpQkMifQ==
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useTabs = void 0;
var react_1 = require("react");
var useKey_1 = require("./useKey");
var useOnUpdate_1 = require("./useOnUpdate");
var LEFT_RIGHT_ARROW_KEYS = function (e) { return e.key === "ArrowRight" || e.key === "ArrowLeft"; };
const react_1 = require("react");
const useKey_1 = require("./useKey");
const useOnUpdate_1 = require("./useOnUpdate");
const LEFT_RIGHT_ARROW_KEYS = (e) => e.key === "ArrowRight" || e.key === "ArrowLeft";
/** @deprecated Will be removed from @uxf/core package in future versions.
* Use 'import { Tab } from "@headlessui/react";' instead */
function useTabs(_a) {
var activeTab = _a.activeTab, id = _a.id, tabListRef = _a.tabListRef, tabsCount = _a.tabsCount;
var _b = __read((0, react_1.useState)(activeTab || 0), 2), activeTabIndex = _b[0], setActiveTabIndex = _b[1];
var idPrefix = "".concat(id, "__tabs");
var tabTitleIdPrefix = "".concat(idPrefix, "__title");
var tabContentIdPrefix = "".concat(idPrefix, "__content");
var onTabTitleClick = (0, react_1.useCallback)(function (index) { return function () { return setActiveTabIndex(index); }; }, []);
(0, useOnUpdate_1.useOnUpdate)(function () {
function useTabs({ activeTab, id, tabListRef, tabsCount }) {
const [activeTabIndex, setActiveTabIndex] = (0, react_1.useState)(activeTab || 0);
const idPrefix = `${id}__tabs`;
const tabTitleIdPrefix = `${idPrefix}__title`;
const tabContentIdPrefix = `${idPrefix}__content`;
const onTabTitleClick = (0, react_1.useCallback)((index) => () => setActiveTabIndex(index), []);
(0, useOnUpdate_1.useOnUpdate)(() => {
if (activeTab) {

@@ -38,7 +21,7 @@ setActiveTabIndex(activeTab);

}, [activeTab]);
var handleArrowKeysNavigation = (0, react_1.useCallback)(function (e) {
const handleArrowKeysNavigation = (0, react_1.useCallback)((e) => {
e.preventDefault();
setActiveTabIndex(function (current) {
var first = 0;
var last = tabsCount - 1;
setActiveTabIndex((current) => {
const first = 0;
const last = tabsCount - 1;
if (e.key === "ArrowRight") {

@@ -55,10 +38,9 @@ return current < last ? current + 1 : first;

return {
activeTabIndex: activeTabIndex,
idPrefix: idPrefix,
onTabTitleClick: onTabTitleClick,
tabContentIdPrefix: tabContentIdPrefix,
tabTitleIdPrefix: tabTitleIdPrefix,
activeTabIndex,
idPrefix,
onTabTitleClick,
tabContentIdPrefix,
tabTitleIdPrefix,
};
}
exports.useTabs = useTabs;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVGFicy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VUYWJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwrQkFBeUQ7QUFDekQsbUNBQWtDO0FBQ2xDLDZDQUE0QztBQUU1QyxJQUFNLHFCQUFxQixHQUFHLFVBQUMsQ0FBZ0IsSUFBSyxPQUFBLENBQUMsQ0FBQyxHQUFHLEtBQUssWUFBWSxJQUFJLENBQUMsQ0FBQyxHQUFHLEtBQUssV0FBVyxFQUEvQyxDQUErQyxDQUFDO0FBU3BHOzREQUM0RDtBQUM1RCxTQUFnQixPQUFPLENBQXdCLEVBQW9EO1FBQWxELFNBQVMsZUFBQSxFQUFFLEVBQUUsUUFBQSxFQUFFLFVBQVUsZ0JBQUEsRUFBRSxTQUFTLGVBQUE7SUFDM0UsSUFBQSxLQUFBLE9BQXNDLElBQUEsZ0JBQVEs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FHLEtBQUssV0FBVyxFQUFFO2dCQUN2QixPQUFPLE9BQU8sR0FBRyxLQUFLLENBQUMsQ0FBQyxDQUFDLE9BQU8sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQzthQUMvQztZQUNELE9BQU8sT0FBTyxDQUFDO1FBQ25CLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxFQUNELENBQUMsU0FBUyxDQUFDLENBQ2QsQ0FBQztJQUVGLElBQUEsZUFBTSxFQUFJLHFCQUFxQixFQUFFLHlCQUF5QixFQUFFLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxDQUFDLENBQUM7SUFFdkYsT0FBTztRQUNILGNBQWMsZ0JBQUE7UUFDZCxRQUFRLFVBQUE7UUFDUixlQUFlLGlCQUFBO1FBQ2Ysa0JBQWtCLG9CQUFBO1FBQ2xCLGdCQUFnQixrQkFBQTtLQUNuQixDQUFDO0FBQ04sQ0FBQztBQTFDRCwwQkEwQ0MifQ==
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWindowScroll = void 0;
var react_1 = require("react");
var useRafState_1 = require("./useRafState");
const react_1 = require("react");
const useRafState_1 = require("./useRafState");
function useWindowScroll() {
var _a = __read((0, useRafState_1.useRafState)(), 2), state = _a[0], setState = _a[1];
(0, react_1.useEffect)(function () {
var handler = function () {
return setState({
x: window.scrollX,
y: window.scrollY,
});
};
const [state, setState] = (0, useRafState_1.useRafState)();
(0, react_1.useEffect)(() => {
const handler = () => setState({
x: window.scrollX,
y: window.scrollY,
});
handler();

@@ -36,3 +18,3 @@ window.addEventListener("scroll", handler, {

});
return function () { return window.removeEventListener("scroll", handler); };
return () => window.removeEventListener("scroll", handler);
}, [setState]);

@@ -42,2 +24,1 @@ return state;

exports.useWindowScroll = useWindowScroll;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlV2luZG93U2Nyb2xsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3VzZVdpbmRvd1Njcm9sbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsK0JBQWtDO0FBQ2xDLDZDQUE0QztBQUU1QyxTQUFnQixlQUFlO0lBQ3JCLElBQUEsS0FBQSxPQUFvQixJQUFBLHlCQUFXLEdBQTRCLElBQUEsRUFBMUQsS0FBSyxRQUFBLEVBQUUsUUFBUSxRQUEyQyxDQUFDO0lBRWxFLElBQUEsaUJBQVMsRUFBQztRQUNOLElBQU0sT0FBTyxHQUFHO1lBQ1osT0FBQSxRQUFRLENBQUM7Z0JBQ0wsQ0FBQyxFQUFFLE1BQU0sQ0FBQyxPQUFPO2dCQUNqQixDQUFDLEVBQUUsTUFBTSxDQUFDLE9BQU87YUFDcEIsQ0FBQztRQUhGLENBR0UsQ0FBQztRQUVQLE9BQU8sRUFBRSxDQUFDO1FBQ1YsTUFBTSxDQUFDLGdCQUFnQixDQUFDLFFBQVEsRUFBRSxPQUFPLEVBQUU7WUFDdkMsT0FBTyxFQUFFLEtBQUs7WUFDZCxPQUFPLEVBQUUsSUFBSTtTQUNoQixDQUFDLENBQUM7UUFDSCxPQUFPLGNBQU0sT0FBQSxNQUFNLENBQUMsbUJBQW1CLENBQUMsUUFBUSxFQUFFLE9BQU8sQ0FBQyxFQUE3QyxDQUE2QyxDQUFDO0lBQy9ELENBQUMsRUFBRSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUM7SUFFZixPQUFPLEtBQUssQ0FBQztBQUNqQixDQUFDO0FBbkJELDBDQW1CQyJ9
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWindowSize = void 0;
var react_1 = require("react");
var useRafState_1 = require("./useRafState");
const react_1 = require("react");
const useRafState_1 = require("./useRafState");
function useWindowSize() {
var _a = __read((0, useRafState_1.useRafState)(), 2), state = _a[0], setState = _a[1];
(0, react_1.useEffect)(function () {
var handler = function () {
return setState({
width: window.innerWidth,
height: window.innerHeight,
});
};
const [state, setState] = (0, useRafState_1.useRafState)();
(0, react_1.useEffect)(() => {
const handler = () => setState({
width: window.innerWidth,
height: window.innerHeight,
});
handler();
window.addEventListener("resize", handler);
return function () { return window.removeEventListener("resize", handler); };
return () => window.removeEventListener("resize", handler);
}, [setState]);

@@ -38,2 +20,1 @@ return state;

exports.useWindowSize = useWindowSize;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlV2luZG93U2l6ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy91c2VXaW5kb3dTaXplLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwrQkFBa0M7QUFDbEMsNkNBQTRDO0FBRTVDLFNBQWdCLGFBQWE7SUFDbkIsSUFBQSxLQUFBLE9BQW9CLElBQUEseUJBQVcsR0FBcUMsSUFBQSxFQUFuRSxLQUFLLFFBQUEsRUFBRSxRQUFRLFFBQW9ELENBQUM7SUFFM0UsSUFBQSxpQkFBUyxFQUFDO1FBQ04sSUFBTSxPQUFPLEdBQUc7WUFDWixPQUFBLFFBQVEsQ0FBQztnQkFDTCxLQUFLLEVBQUUsTUFBTSxDQUFDLFVBQVU7Z0JBQ3hCLE1BQU0sRUFBRSxNQUFNLENBQUMsV0FBVzthQUM3QixDQUFDO1FBSEYsQ0FHRSxDQUFDO1FBRVAsT0FBTyxFQUFFLENBQUM7UUFDVixNQUFNLENBQUMsZ0JBQWdCLENBQUMsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQzNDLE9BQU8sY0FBTSxPQUFBLE1BQU0sQ0FBQyxtQkFBbUIsQ0FBQyxRQUFRLEVBQUUsT0FBTyxDQUFDLEVBQTdDLENBQTZDLENBQUM7SUFDL0QsQ0FBQyxFQUFFLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztJQUVmLE9BQU8sS0FBSyxDQUFDO0FBQ2pCLENBQUM7QUFoQkQsc0NBZ0JDIn0=
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -16,2 +20,1 @@ if (k2 === undefined) k2 = k;

__exportStar(require("./Validators/FormValidator"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsMkJBQTJCO0FBQzNCLHlEQUF1QztBQUN2Qyw2REFBMkMifQ==

@@ -1,2 +0,2 @@

export declare const queryParamToString: (param?: string | string[] | undefined) => string;
export declare const queryParamToNumber: (param?: string | string[] | undefined) => number;
export declare const queryParamToString: (param?: string | string[]) => string;
export declare const queryParamToNumber: (param?: string | string[]) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.queryParamToNumber = exports.queryParamToString = void 0;
var queryParamToString = function (param) { return (typeof param === "string" ? param : ""); };
const queryParamToString = (param) => (typeof param === "string" ? param : "");
exports.queryParamToString = queryParamToString;
var queryParamToNumber = function (param) {
return typeof param === "string" ? parseInt(param, 10) : 0;
};
const queryParamToNumber = (param) => typeof param === "string" ? parseInt(param, 10) : 0;
exports.queryParamToNumber = queryParamToNumber;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbmV4dC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBTyxJQUFNLGtCQUFrQixHQUFHLFVBQUMsS0FBeUIsSUFBYSxPQUFBLENBQUMsT0FBTyxLQUFLLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUF4QyxDQUF3QyxDQUFDO0FBQXJHLFFBQUEsa0JBQWtCLHNCQUFtRjtBQUUzRyxJQUFNLGtCQUFrQixHQUFHLFVBQUMsS0FBeUI7SUFDeEQsT0FBQSxPQUFPLEtBQUssS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFBbkQsQ0FBbUQsQ0FBQztBQUQzQyxRQUFBLGtCQUFrQixzQkFDeUIifQ==
{
"name": "@uxf/core",
"version": "4.5.1",
"version": "10.0.0-beta.8",
"description": "UXF Core",

@@ -19,8 +19,5 @@ "author": "Petr Vejvoda <vejvoda@uxf.cz>",

"scripts": {
"build": "npm run-script clean && npm run-script compile",
"clean": "rm -rf ./dist",
"compile": "tsc -P tsconfig.build.json",
"build": "tsc -P tsconfig.json",
"jest": "jest",
"lint": "eslint -c .eslintrc.js \"./**/*.ts*\"",
"test": "npm run-script lint && npm run-script typecheck && npm run-script jest",
"test": "npm run jest",
"typecheck": "tsc --noEmit --skipLibCheck"

@@ -34,12 +31,7 @@ },

"@types/jest": "^27.4.0",
"@types/node": "^16.11.18",
"@types/react": "^17.0.2",
"@uxf/eslint-config": "^1.2.3",
"body-scroll-lock": "^4.0.0-beta.0",
"eslint": "^8.8.0",
"jest": "^27.4.5",
"prettier": "^2.5.1",
"react": "^17.0.2",
"ts-jest": "^27.1.2",
"typescript": "^4.5.4"
"ts-jest": "^27.1.2"
},

@@ -51,2 +43,2 @@ "peerDependencies": {

"gitHead": "a2dee6aa67621f6eda17e63e88d0edf14f88455a"
}
}

@@ -12,3 +12,7 @@ export declare function buildArray<T>(): {

when: (condition: boolean, data: T) => {
add: any;
add: (data: T) => {
add: any;
when: any;
get: () => T[];
};
when: any;

@@ -15,0 +19,0 @@ get: () => T[];

@@ -5,3 +5,3 @@ "use strict";

function get(array) {
return function () {
return () => {
return array;

@@ -11,3 +11,3 @@ };

function add(array) {
return function (data) {
return (data) => {
array.push(data);

@@ -19,3 +19,3 @@ // eslint-disable-next-line @typescript-eslint/no-use-before-define

function when(array) {
return function (condition, data) {
return (condition, data) => {
if (condition) {

@@ -28,6 +28,5 @@ array.push(data);

function buildArray() {
var array = [];
const array = [];
return { add: add(array), when: when(array), get: get(array) };
}
exports.buildArray = buildArray;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRBcnJheS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9idWlsZEFycmF5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLFNBQVMsR0FBRy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lDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var buildArray_1 = require("./buildArray");
test("buildArray", function () {
const buildArray_1 = require("./buildArray");
test("buildArray", () => {
expect((0, buildArray_1.buildArray)().get()).toStrictEqual([]);

@@ -11,2 +11,1 @@ expect((0, buildArray_1.buildArray)().add("uxf").get()).toStrictEqual(["uxf"]);

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRBcnJheS50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2J1aWxkQXJyYXkudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEwQztBQUUxQyxJQUFJLENBQUMsWUFBWSxFQUFFO0lBQ2YsTUFBTSxDQUFDLElBQUEsdUJBQVUsR0FBRSxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQzdDLE1BQU0sQ0FBQyxJQUFBLHVCQUFVLEdBQVUsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO0lBQ3JFLE1BQU0sQ0FBQyxJQUFBLHVCQUFVLEdBQVUsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7SUFDdkYsTUFBTSxDQUFDLElBQUEsdUJBQVUsR0FBVSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7SUFDOUYsTUFBTSxDQUFDLElBQUEsdUJBQVUsR0FBVSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztBQUMzRixDQUFDLENBQUMsQ0FBQyJ9

@@ -8,2 +8,1 @@ "use strict";

exports.camelCaseToDash = camelCaseToDash;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FtZWxDYXNlVG9EYXNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2NhbWVsQ2FzZVRvRGFzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxTQUFnQixlQUFlLENBQUMsT0FBZTtJQUMzQyxPQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsaUJBQWlCLEVBQUUsT0FBTyxDQUFDLENBQUMsV0FBVyxFQUFFLENBQUM7QUFDckUsQ0FBQztBQUZELDBDQUVDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var camelCaseToDash_1 = require("./camelCaseToDash");
test("camelCaseToDash", function () {
const camelCaseToDash_1 = require("./camelCaseToDash");
test("camelCaseToDash", () => {
expect((0, camelCaseToDash_1.camelCaseToDash)("someName")).toBe("some-name");

@@ -9,2 +9,1 @@ expect((0, camelCaseToDash_1.camelCaseToDash)("camelCaseString")).toBe("camel-case-string");

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FtZWxDYXNlVG9EYXNoLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY2FtZWxDYXNlVG9EYXNoLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBb0Q7QUFFcEQsSUFBSSxDQUFDLGlCQUFpQixFQUFFO0lBQ3BCLE1BQU0sQ0FBQyxJQUFBLGlDQUFlLEVBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUM7SUFDdEQsTUFBTSxDQUFDLElBQUEsaUNBQWUsRUFBQyxpQkFBaUIsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLENBQUM7SUFDckUsTUFBTSxDQUFDLElBQUEsaUNBQWUsRUFBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQztBQUMvQyxDQUFDLENBQUMsQ0FBQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeRefs = void 0;
function composeRefs() {
var refs = [];
for (var _i = 0; _i < arguments.length; _i++) {
refs[_i] = arguments[_i];
}
return function (value) {
return refs.forEach(function (ref) {
if (!ref) {
return;
}
if (typeof ref === "function") {
ref(value);
return;
}
ref.current = value;
});
};
function composeRefs(...refs) {
return (value) => refs.forEach((ref) => {
if (!ref) {
return;
}
if (typeof ref === "function") {
ref(value);
return;
}
ref.current = value;
});
}
exports.composeRefs = composeRefs;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9zZVJlZnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY29tcG9zZVJlZnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsU0FBZ0IsV0FBVztJQUFJLGNBQStCO1NBQS9CLFVBQStCLEVBQS9CLHFCQUErQixFQUEvQixJQUErQjtRQUEvQix5QkFBK0I7O0lBQzFELE9BQU8sVUFBQyxLQUFRO1FBQ1osT0FBQSxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQUEsR0FBRztZQUNaLElBQUksQ0FBQyxHQUFHLEVBQUU7Z0JBQ04sT0FBTzthQUNWO1lBQ0QsSUFBSSxPQUFPLEdBQUcsS0FBSyxVQUFVLEVBQUU7Z0JBQzFCLEdBQXNCLENBQUMsS0FBSyxDQUFDLENBQUM7Z0JBQy9CLE9BQU87YUFDVjtZQUNBLEdBQTJCLENBQUMsT0FBTyxHQUFHLEtBQUssQ0FBQztRQUNqRCxDQUFDLENBQUM7SUFURixDQVNFLENBQUM7QUFDWCxDQUFDO0FBWkQsa0NBWUMifQ==
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyToClipboard = void 0;
function copyToClipboardFallback(text) {
var textArea = document.createElement("textarea");
const textArea = document.createElement("textarea");
textArea.value = text;

@@ -53,34 +17,14 @@ // Avoid scrolling to bottom

}
function copyToClipboard(text) {
return __awaiter(this, void 0, void 0, function () {
var isSupported, _a, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
isSupported = typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.writeText === "function";
_b.label = 1;
case 1:
_b.trys.push([1, 5, , 6]);
if (!isSupported) return [3 /*break*/, 3];
return [4 /*yield*/, navigator.clipboard.writeText(text)];
case 2:
_a = _b.sent();
return [3 /*break*/, 4];
case 3:
_a = copyToClipboardFallback(text);
_b.label = 4;
case 4:
_a;
return [2 /*return*/, true];
case 5:
e_1 = _b.sent();
// eslint-disable-next-line
console.error(e_1);
return [2 /*return*/, false];
case 6: return [2 /*return*/];
}
});
});
async function copyToClipboard(text) {
const isSupported = typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.writeText === "function";
try {
isSupported ? await navigator.clipboard.writeText(text) : copyToClipboardFallback(text);
return true;
}
catch (e) {
// eslint-disable-next-line
console.error(e);
return false;
}
}
exports.copyToClipboard = copyToClipboard;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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dBQVcsRUFBWCx3QkFBVztvQkFDTCxxQkFBTSxTQUFTLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBQTs7b0JBQXpDLEtBQUEsU0FBeUMsQ0FBQTs7O29CQUN6QyxLQUFBLHVCQUF1QixDQUFDLElBQUksQ0FBQyxDQUFBOzs7b0JBRm5DLEdBRW9DO29CQUNwQyxzQkFBTyxJQUFJLEVBQUM7OztvQkFFWiwyQkFBMkI7b0JBQzNCLE9BQU8sQ0FBQyxLQUFLLENBQUMsR0FBQyxDQUFDLENBQUM7b0JBQ2pCLHNCQUFPLEtBQUssRUFBQzs7Ozs7Q0FFcEI7QUFaRCwwQ0FZQyJ9

@@ -1,3 +0,3 @@

export declare type ClassArray = ClassValue[];
export declare type ClassValue = ClassArray | Record<string, any> | string | number | null | boolean | undefined;
export type ClassArray = ClassValue[];
export type ClassValue = ClassArray | Record<string, any> | string | number | null | boolean | undefined;
export declare function cx(...classes: ClassValue[]): string;

@@ -5,5 +5,5 @@ "use strict";

function toVal(mix) {
var k;
var y;
var str = "";
let k;
let y;
let str = "";
if (typeof mix === "string" || typeof mix === "number") {

@@ -38,11 +38,7 @@ str += mix;

}
function cx() {
var classes = [];
for (var _i = 0; _i < arguments.length; _i++) {
classes[_i] = arguments[_i];
}
var i = 0;
var tmp;
var x;
var str = "";
function cx(...classes) {
let i = 0;
let tmp;
let x;
let str = "";
while (i < classes.length) {

@@ -61,2 +57,1 @@ if ((tmp = classes[i++])) {

exports.cx = cx;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY3gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EsU0FBUyxLQUFLLENBQUMsR0FBZTtJQUMxQixJQUFJLENBQUMsQ0FBQztJQUNOLElBQUksQ0FBQyxDQUFDO0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QkFBd0I7O0lBQ3ZDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNWLElBQUksR0FBRyxDQUFDO0lBQ1IsSUFBSSxDQUFDLENBQUM7SUFDTixJQUFJLEdBQUcsR0FBRyxFQUFFLENBQUM7SUFFYixPQUFPLENBQUMsR0FBRyxPQUFPLENBQUMsTUFBTSxFQUFFO1FBQ3ZCLElBQUksQ0FBQyxHQUFHLEdBQUcsT0FBTyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRTtZQUN0QixJQUFJLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUFFO2dCQUNsQixJQUFJLEdBQUcsRUFBRTtvQkFDTCxHQUFHLElBQUksR0FBRyxDQUFDO2lCQUNkO2dCQUNELEdBQUcsSUFBSSxDQUFDLENBQUM7YUFDWjtTQUNKO0tBQ0o7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNmLENBQUM7QUFsQkQsZ0JBa0JDIn0=

@@ -5,9 +5,8 @@ "use strict";

function getFileUrl(file) {
var ch1 = file.uuid.charAt(0);
var ch2 = file.uuid.charAt(1);
const ch1 = file.uuid.charAt(0);
const ch2 = file.uuid.charAt(1);
return file.namespace
? "/upload/".concat(file.namespace, "/").concat(ch1, "/").concat(ch2, "/").concat(file.uuid, ".").concat(file.extension)
: "/upload/".concat(ch1, "/").concat(ch2, "/").concat(file.uuid, ".").concat(file.extension);
? `/upload/${file.namespace}/${ch1}/${ch2}/${file.uuid}.${file.extension}`
: `/upload/${ch1}/${ch2}/${file.uuid}.${file.extension}`;
}
exports.getFileUrl = getFileUrl;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQVFBLFNBQWdCLFVBQVUsQ0FBQyxJQUFrQztJQUN6RCxJQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUNoQyxJQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUVoQyxPQUFPLElBQUksQ0FBQyxTQUFTO1FBQ2pCLENBQUMsQ0FBQyxrQkFBVyxJQUFJLENBQUMsU0FBUyxjQUFJLEdBQUcsY0FBSSxHQUFHLGNBQUksSUFBSSxDQUFDLElBQUksY0FBSSxJQUFJLENBQUMsU0FBUyxDQUFFO1FBQzFFLENBQUMsQ0FBQyxrQkFBVyxHQUFHLGNBQUksR0FBRyxjQUFJLElBQUksQ0FBQyxJQUFJLGNBQUksSUFBSSxDQUFDLFNBQVMsQ0FBRSxDQUFDO0FBQ2pFLENBQUM7QUFQRCxnQ0FPQyJ9
import { ForwardedRef, ForwardRefExoticComponent, PropsWithoutRef, ReactElement, RefAttributes } from "react";
export declare type ForwardRefRenderFunction<T, P> = {
export type ForwardRefRenderFunction<T, P> = {
(props: P, ref: ForwardedRef<T>): ReactElement | null;

@@ -4,0 +4,0 @@ displayName?: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.forwardRef = void 0;
var react_1 = require("react");
var forwardRef = function (name, render) {
var Component = (0, react_1.forwardRef)(render);
const react_1 = require("react");
const forwardRef = (name, render) => {
const Component = (0, react_1.forwardRef)(render);
Component.displayName = name;

@@ -11,2 +11,1 @@ return Component;

exports.forwardRef = forwardRef;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9yd2FyZFJlZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9mb3J3YXJkUmVmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQU9lO0FBYVIsSUFBTSxVQUFVLEdBQUcsVUFDdEIsSUFBWSxFQUNaLE1BQXNDO0lBRXRDLElBQU0sU0FBUyxHQUFHLElBQUEsa0JBQWUsRUFBQyxNQUFNLENBQUMsQ0FBQztJQUMxQyxTQUFTLENBQUMsV0FBVyxHQUFHLElBQUksQ0FBQztJQUM3QixPQUFPLFNBQVMsQ0FBQztBQUNyQixDQUFDLENBQUM7QUFQVyxRQUFBLFVBQVUsY0FPckIifQ==
import { ImageSource, ResizerImageProps } from "./resizer";
import { FC } from "react";
export declare type Dimension = number | "auto";
export declare type Format = "avif" | "webp" | "original";
export declare type Quality = number | Record<Format, number>;
export type Dimension = number | "auto";
export type Format = "avif" | "webp" | "original";
export type Quality = number | Record<Format, number>;
export declare function getSvgImgUrl(src: ImageSource): string | undefined;

@@ -7,0 +7,0 @@ export declare function getImgQuality(quality: Quality | undefined, format: Format): number | undefined;

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -18,5 +7,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

exports.ImgSources = exports.getImgSrcSet = exports.getImgUniqueIdentifier = exports.getImgQuality = exports.getSvgImgUrl = void 0;
var file_1 = require("./file");
var resizer_1 = require("./resizer");
var react_1 = __importDefault(require("react"));
const file_1 = require("./file");
const resizer_1 = require("./resizer");
const react_1 = __importDefault(require("react"));
function toImageResponse(src) {

@@ -29,3 +18,3 @@ return typeof src !== "string" && "uuid" in src ? src : undefined;

function parseImgExtension(src) {
var ext = src.slice(src.lastIndexOf(".") + 1);
const ext = src.slice(src.lastIndexOf(".") + 1);
return ext.length > 1 ? ext : undefined;

@@ -37,7 +26,7 @@ }

}
var imageResponse = toImageResponse(src);
const imageResponse = toImageResponse(src);
if (imageResponse && parseImgExtension(imageResponse.extension) === "svg") {
return (0, file_1.getFileUrl)(imageResponse);
}
var staticImageData = toStaticImageData(src);
const staticImageData = toStaticImageData(src);
if (staticImageData && parseImgExtension(staticImageData.src) === "svg") {

@@ -58,16 +47,15 @@ return staticImageData.src;

exports.getImgUniqueIdentifier = getImgUniqueIdentifier;
var HIDPI_SIZES = [3, 2, 1];
function getImgSrcSet(src, width, height, options) {
const HIDPI_SIZES = [3, 2, 1];
function getImgSrcSet(src, width, height, options = {}) {
var _a, _b;
if (options === void 0) { options = {}; }
if (!src) {
return undefined;
}
var toFormat;
var h = height !== null && height !== void 0 ? height : "auto";
var w = width !== null && width !== void 0 ? width : "auto";
let toFormat;
let h = height !== null && height !== void 0 ? height : "auto";
let w = width !== null && width !== void 0 ? width : "auto";
if (typeof src === "string") {
toFormat = parseImgExtension(src);
}
var imageResponse = toImageResponse(src);
const imageResponse = toImageResponse(src);
if (imageResponse) {

@@ -81,3 +69,3 @@ if (!imageResponse.uuid) {

}
var staticImageData = toStaticImageData(src);
const staticImageData = toStaticImageData(src);
if (staticImageData) {

@@ -92,10 +80,11 @@ if (!staticImageData.src) {

if (typeof h === "number" || typeof w === "number") {
return HIDPI_SIZES.map(function (size) {
return (0, resizer_1.resizerImageUrl)(src, w * size, h * size, __assign({ toFormat: toFormat }, options)) + (size > 1 ? " ".concat(size, "x") : "");
}).join(", ");
return HIDPI_SIZES.map((size) => (0, resizer_1.resizerImageUrl)(src, w * size, h * size, {
toFormat,
...options,
}) + (size > 1 ? ` ${size}x` : "")).join(", ");
}
return (0, resizer_1.resizerImageUrl)(src, w, h, __assign({ toFormat: toFormat }, options));
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...options });
}
exports.getImgSrcSet = getImgSrcSet;
var ImgSources = function (props) {
const ImgSources = (props) => {
var _a, _b, _c;

@@ -105,20 +94,30 @@ if (!props.src) {

}
var imageResponse = toImageResponse(props.src);
const imageResponse = toImageResponse(props.src);
if (imageResponse && !imageResponse.uuid) {
return null;
}
var staticImageData = toStaticImageData(props.src);
const staticImageData = toStaticImageData(props.src);
if (staticImageData && !staticImageData.src) {
return null;
}
var media;
let media;
if (props.breakpoints && props.breakpointIndex) {
media = "(min-width: ".concat(props.breakpoints[props.breakpointIndex], ")");
media = `(min-width: ${props.breakpoints[props.breakpointIndex]})`;
}
return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, __assign(__assign({}, ((_a = props.options) !== null && _a !== void 0 ? _a : {})), { quality: getImgQuality(props.quality, "avif"), toFormat: "avif" })), type: "image/avif" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, __assign(__assign({}, ((_b = props.options) !== null && _b !== void 0 ? _b : {})), { quality: getImgQuality(props.quality, "webp"), toFormat: "webp" })), type: "image/webp" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, __assign(__assign({}, ((_c = props.options) !== null && _c !== void 0 ? _c : {})), { quality: getImgQuality(props.quality, "original") })) })));
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_a = props.options) !== null && _a !== void 0 ? _a : {}),
quality: getImgQuality(props.quality, "avif"),
toFormat: "avif",
}), type: "image/avif" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_b = props.options) !== null && _b !== void 0 ? _b : {}),
quality: getImgQuality(props.quality, "webp"),
toFormat: "webp",
}), type: "image/webp" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_c = props.options) !== null && _c !== void 0 ? _c : {}),
quality: getImgQuality(props.quality, "original"),
}) })));
};
exports.ImgSources = ImgSources;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1hZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic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0FBQyxLQUFLLENBQUMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxFQUM3QyxRQUFRLEVBQUUsTUFBTSxJQUNsQixFQUNGLElBQUksRUFBQyxZQUFZLEdBQ25CO1FBQ0YsMENBQ0ksS0FBSyxFQUFFLEtBQUssRUFDWixNQUFNLEVBQUUsWUFBWSxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsS0FBSyxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsTUFBTSx3QkFDbEQsQ0FBQyxNQUFBLEtBQUssQ0FBQyxPQUFPLG1DQUFJLEVBQUUsQ0FBQyxLQUN4QixPQUFPLEVBQUUsYUFBYSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQUUsVUFBVSxDQUFDLElBQ25ELEdBQ0osQ0FDSCxDQUNOLENBQUM7QUFDTixDQUFDLENBQUM7QUFwRFcsUUFBQSxVQUFVLGNBb0RyQiJ9

@@ -6,2 +6,1 @@ "use strict";

exports.isBrowser = !!(typeof window !== "undefined" && window.document && window.document.createElement);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNCcm93c2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2lzQnJvd3Nlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx1RUFBdUU7QUFDMUQsUUFBQSxTQUFTLEdBQUcsQ0FBQyxDQUFDLENBQUMsT0FBTyxNQUFNLEtBQUssV0FBVyxJQUFJLE1BQU0sQ0FBQyxRQUFRLElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsQ0FBQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isServer = void 0;
var isBrowser_1 = require("./isBrowser");
const isBrowser_1 = require("./isBrowser");
exports.isServer = !isBrowser_1.isBrowser;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNTZXJ2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvaXNTZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEseUNBQXdDO0FBRTNCLFFBQUEsUUFBUSxHQUFHLENBQUMscUJBQVMsQ0FBQyJ9

@@ -1,2 +0,2 @@

export declare type PaginationConfig = {
export type PaginationConfig = {
showFirstButton?: boolean;

@@ -11,3 +11,3 @@ hidePrevButton?: boolean;

};
export declare type PaginationItem = "first" | "previous" | "next" | "last" | "start-ellipsis" | "end-ellipsis" | number;
export type PaginationItem = "first" | "previous" | "next" | "last" | "start-ellipsis" | "end-ellipsis" | number;
export declare const paginationGenerate: (config: PaginationConfig) => PaginationItem[];
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.paginationGenerate = void 0;
var FIRST = ["first"];
var LAST = ["last"];
var PREVIOUS = ["previous"];
var NEXT = ["next"];
var START_ELLIPSIS = ["start-ellipsis"];
var END_ELLIPSIS = ["end-ellipsis"];
const FIRST = ["first"];
const LAST = ["last"];
const PREVIOUS = ["previous"];
const NEXT = ["next"];
const START_ELLIPSIS = ["start-ellipsis"];
const END_ELLIPSIS = ["end-ellipsis"];
// @see https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/usePagination/usePagination.js
var paginationGenerate = function (config) {
var _a = config.showFirstButton, showFirstButton = _a === void 0 ? false : _a, _b = config.hidePrevButton, hidePrevButton = _b === void 0 ? false : _b, _c = config.boundaryCount, boundaryCount = _c === void 0 ? 1 : _c, _d = config.siblingCount, siblingCount = _d === void 0 ? 1 : _d, _e = config.showLastButton, showLastButton = _e === void 0 ? false : _e, _f = config.hideNextButton, hideNextButton = _f === void 0 ? false : _f, _g = config.count, count = _g === void 0 ? 1 : _g, _h = config.page, page = _h === void 0 ? 1 : _h;
const paginationGenerate = (config) => {
const { showFirstButton = false, hidePrevButton = false, boundaryCount = 1, siblingCount = 1, showLastButton = false, hideNextButton = false, count = 1, page = 1, } = config;
// https://dev.to/namirsab/comment/2050
var range = function (start, end) {
var length = end - start + 1;
return Array.from({ length: length }, function (_, i) { return start + i; });
const range = (start, end) => {
const length = end - start + 1;
return Array.from({ length }, (_, i) => start + i);
};
var startPages = range(1, Math.min(boundaryCount, count));
var endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
var siblingsStart = Math.max(Math.min(
const startPages = range(1, Math.min(boundaryCount, count));
const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
const siblingsStart = Math.max(Math.min(
// Natural start

@@ -52,3 +27,3 @@ page - siblingCount,

boundaryCount + 2);
var siblingsEnd = Math.min(Math.max(
const siblingsEnd = Math.min(Math.max(
// Natural end

@@ -62,13 +37,27 @@ page + siblingCount,

// e.g. itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((showFirstButton ? FIRST : [])), false), __read((hidePrevButton ? [] : PREVIOUS)), false), __read(startPages), false), __read((siblingsStart > boundaryCount + 2
? START_ELLIPSIS
: boundaryCount + 1 < count - boundaryCount
? [boundaryCount + 1]
: [])), false), __read(range(siblingsStart, siblingsEnd)), false), __read((siblingsEnd < count - boundaryCount - 1
? END_ELLIPSIS
: count - boundaryCount > boundaryCount
? [count - boundaryCount]
: [])), false), __read(endPages), false), __read((hideNextButton ? [] : NEXT)), false), __read((showLastButton ? LAST : [])), false);
return [
...(showFirstButton ? FIRST : []),
...(hidePrevButton ? [] : PREVIOUS),
...startPages,
// Start ellipsis
// eslint-disable-next-line no-nested-ternary
...(siblingsStart > boundaryCount + 2
? START_ELLIPSIS
: boundaryCount + 1 < count - boundaryCount
? [boundaryCount + 1]
: []),
// Sibling pages
...range(siblingsStart, siblingsEnd),
// End ellipsis
// eslint-disable-next-line no-nested-ternary
...(siblingsEnd < count - boundaryCount - 1
? END_ELLIPSIS
: count - boundaryCount > boundaryCount
? [count - boundaryCount]
: []),
...endPages,
...(hideNextButton ? [] : NEXT),
...(showLastButton ? LAST : []),
];
};
exports.paginationGenerate = paginationGenerate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9wYWdpbmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFZQSxJQUFNLEtBQUssR0FBcUIsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUMxQyxJQUFNLElBQUksR0FBcUIsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN4QyxJQUFNLFFBQVEsR0FBcUIsQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUNoRCxJQUFNLElBQUksR0FBcUIsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN4QyxJQUFNLGNBQWMsR0FBcUIsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBQzVELElBQU0sWUFBWSxHQUFxQixDQUFDLGNBQ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kFJVixDQUFDLGFBQWEsR0FBRyxhQUFhLEdBQUcsQ0FBQztRQUNqQyxDQUFDLENBQUMsY0FBYztRQUNoQixDQUFDLENBQUMsYUFBYSxHQUFHLENBQUMsR0FBRyxLQUFLLEdBQUcsYUFBYTtZQUMzQyxDQUFDLENBQUMsQ0FBQyxhQUFhLEdBQUcsQ0FBQyxDQUFDO1lBQ3JCLENBQUMsQ0FBQyxFQUFFLENBQUMsa0JBR04sS0FBSyxDQUFDLGFBQWEsRUFBRSxXQUFXLENBQUMsa0JBSWpDLENBQUMsV0FBVyxHQUFHLEtBQUssR0FBRyxhQUFhLEdBQUcsQ0FBQztRQUN2QyxDQUFDLENBQUMsWUFBWTtRQUNkLENBQUMsQ0FBQyxLQUFLLEdBQUcsYUFBYSxHQUFHLGFBQWE7WUFDdkMsQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLGFBQWEsQ0FBQztZQUN6QixDQUFDLENBQUMsRUFBRSxDQUFDLGtCQUVOLFFBQVEsa0JBQ1IsQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLGtCQUM1QixDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsVUFDakM7QUFDTixDQUFDLENBQUM7QUF6RVcsUUFBQSxrQkFBa0Isc0JBeUU3QiJ9
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var pagination_1 = require("./pagination");
var DATA = [
const pagination_1 = require("./pagination");
const DATA = [
[{ page: 1, count: 10 }, "previous 1 2 3 4 5 end-ellipsis 10 next"],

@@ -43,18 +16,6 @@ [{ page: 2, count: 10 }, "previous 1 2 3 4 5 end-ellipsis 10 next"],

];
test("Pagination", function () {
var e_1, _a;
try {
for (var DATA_1 = __values(DATA), DATA_1_1 = DATA_1.next(); !DATA_1_1.done; DATA_1_1 = DATA_1.next()) {
var _b = __read(DATA_1_1.value, 2), config = _b[0], expected = _b[1];
expect((0, pagination_1.paginationGenerate)(config).join(" ")).toBe(expected);
}
test("Pagination", () => {
for (const [config, expected] of DATA) {
expect((0, pagination_1.paginationGenerate)(config).join(" ")).toBe(expected);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (DATA_1_1 && !DATA_1_1.done && (_a = DATA_1.return)) _a.call(DATA_1);
}
finally { if (e_1) throw e_1.error; }
}
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdGlvbi50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3BhZ2luYXRpb24udGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDJDQUFvRTtBQUVwRSxJQUFNLElBQUksR0FBc0M7SUFDNUMsQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLEVBQUUsS0FBSyxFQUFFLEVBQUUsRUFBRSxFQUFFLHlDQUF5QyxDQUFDO0lBQ25FLENBQUMsRUFBRSxJQUFJLEVBQUUsQ0FBQyxFQUFFLEtBQUssRUFB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UMsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1NBQy9EOzs7Ozs7Ozs7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9

@@ -8,3 +8,3 @@ export interface ImageResponse {

}
export declare type StaticImageData = {
export type StaticImageData = {
src: string;

@@ -15,3 +15,3 @@ height: number;

};
export declare type ImageSource = ImageResponse | StaticImageData | string;
export type ImageSource = ImageResponse | StaticImageData | string;
declare const fitMapper: {

@@ -18,0 +18,0 @@ cover: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resizerGetDefaultConfig = exports.resizerImageUrl = void 0;
var fitMapper = {
const fitMapper = {
cover: "cv",

@@ -11,3 +11,3 @@ fill: "f",

};
var positionMapper = {
const positionMapper = {
attention: "a",

@@ -26,20 +26,16 @@ bottom: "b",

};
var backgroundMapper = {
const backgroundMapper = {
transparent: "t",
};
var trimMapper = {
const trimMapper = {
"not-trim": "nt",
};
var resizerStaticImageUrl = function (src, width, height, props, version) {
const resizerStaticImageUrl = (src, width = "auto", height = "auto", props = {}, version = 1) => {
var _a;
if (width === void 0) { width = "auto"; }
if (height === void 0) { height = "auto"; }
if (props === void 0) { props = {}; }
if (version === void 0) { version = 1; }
var _b = props.fit, fit = _b === void 0 ? "cover" : _b, _c = props.position, position = _c === void 0 ? "center" : _c, _d = props.toFormat, toFormat = _d === void 0 ? undefined : _d, _e = props.trim, trim = _e === void 0 ? "not-trim" : _e, _f = props.background, background = _f === void 0 ? "FFF" : _f;
var filepath = typeof src === "string" ? src : src.src;
var dotIndex = filepath.lastIndexOf(".");
var filename = filepath.slice(0, dotIndex);
var extension = filepath.slice(dotIndex + 1);
var directory = [
const { fit = "cover", position = "center", toFormat = undefined, trim = "not-trim", background = "FFF" } = props;
const filepath = typeof src === "string" ? src : src.src;
const dotIndex = filepath.lastIndexOf(".");
const filename = filepath.slice(0, dotIndex);
const extension = filepath.slice(dotIndex + 1);
const directory = [
width === "auto" ? "x" : width,

@@ -53,10 +49,6 @@ height === "auto" ? "x" : height,

].join("_");
return "/generated/static/".concat(directory, "/").concat(version).concat(filename, ".").concat(extension, ".").concat(toFormat !== null && toFormat !== void 0 ? toFormat : extension);
return `/generated/static/${directory}/${version}${filename}.${extension}.${toFormat !== null && toFormat !== void 0 ? toFormat : extension}`;
};
var resizerImageUrl = function (source, width, height, props, version) {
const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, version = 1) => {
var _a, _b;
if (width === void 0) { width = "auto"; }
if (height === void 0) { height = "auto"; }
if (props === void 0) { props = {}; }
if (version === void 0) { version = 1; }
if (source === null || source === undefined) {

@@ -68,4 +60,4 @@ return undefined;

}
var _c = props.fit, fit = _c === void 0 ? "cover" : _c, _d = props.position, position = _d === void 0 ? "center" : _d, _e = props.toFormat, toFormat = _e === void 0 ? (_a = props.toFormat) !== null && _a !== void 0 ? _a : source.extension : _e, _f = props.trim, trim = _f === void 0 ? "not-trim" : _f, _g = props.background, background = _g === void 0 ? "FFF" : _g;
var filename = [
const { fit = "cover", position = "center", toFormat = (_a = props.toFormat) !== null && _a !== void 0 ? _a : source.extension, trim = "not-trim", background = "FFF", } = props;
const filename = [
source.uuid,

@@ -79,5 +71,5 @@ width === "auto" ? "x" : width,

(_b = props.quality) !== null && _b !== void 0 ? _b : "x",
"".concat(source.extension, ".").concat(toFormat),
`${source.extension}.${toFormat}`,
].join("_");
return "/generated/".concat(source.namespace, "/").concat(source.uuid.charAt(0), "/").concat(source.uuid.charAt(1), "/").concat(filename);
return `/generated/${source.namespace}/${source.uuid.charAt(0)}/${source.uuid.charAt(1)}/${filename}`;
};

@@ -89,7 +81,7 @@ exports.resizerImageUrl = resizerImageUrl;

route: "/generated/static/:width(\\d+|x)_:height(\\d+|x)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d+|x)/:version/:filename(*).:extension.:toFormat",
source: "".concat(generatedFilesUrl, "/:filename+.:extension"),
source: `${generatedFilesUrl}/:filename+.:extension`,
},
{
route: "/generated/:namespace/:p1/:p2/:filename([a-f0-9\\-]+)_:width(\\d+|x)_:height(\\d+|x)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d+|x)_:extension.:toFormat",
source: "".concat(staticFilesUrl, "/upload/:namespace/:p1/:p2/:filename.:extension"),
source: `${staticFilesUrl}/upload/:namespace/:p1/:p2/:filename.:extension`,
},

@@ -99,2 +91,1 @@ ];

exports.resizerGetDefaultConfig = resizerGetDefaultConfig;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzaXplci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9yZXNpemVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxJQUFNLFNBQVMsR0FBRztJQUNkLEtBQUssRUFBRSxJQUFJO0lBQ1gsSUFBSSxFQUFFLEdBQUc7SUFDVCxPQUFPLEVBQUUsSUFBSTtJQUNiLE1BQU0sRUFBRSxJQUFJO0lBQ1osT0FBTyxFQUFFLEtBQUs7Q0FDakIsQ0FBQztBQUVGLElBQU0sY0FBYyxHQUFHO0lBQ25CLFNBQVMsRUFBRSxHQUFHO0lBQ2QsTUFBTSxFQUFFLEdBQUc7SUFDWCxNQUFNLEVBQUUsR0FBRztJQUNYLE1BQU0sRUFBRSxHQUFHO0lBQ1gsT0FBTyxFQUFFLEdBQUc7SUFDWixJQUFJLEVBQUUsR0FBRztJQUNULGFBQWEsRUFBRSxJQUFJO0lBQ25CLFVBQVUsRUFBRSxJQUFJO0lBQ2hCLEtBQUssRUFBRSxHQUFHO0lBQ1YsY0FBYyxFQUFFLElBQUk7SUFDcEIsV0FBVyxFQUFFLElBQUk7SUFDakIsR0FBRyxFQUFFLEdBQUc7Q0FDWCxDQUFDO0FBRUYsSU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LENBQUMsQ0FBQyxJQUFJO1FBQzdDLE1BQUEsS0FBSyxDQUFDLE9BQU8sbUNBQUksR0FBRztRQUNwQixVQUFHLE1BQU0sQ0FBQyxTQUFTLGNBQUksUUFBUSxDQUFFO0tBQ3BDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRVosT0FBTyxxQkFBYyxNQUFNLENBQUMsU0FBUyxjQUFJLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxjQUFJLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxjQUFJLFFBQVEsQ0FBRSxDQUFDO0FBQzFHLENBQUMsQ0FBQztBQXBDVyxRQUFBLGVBQWUsbUJBb0MxQjtBQUVGLFNBQWdCLHVCQUF1QixDQUFDLGlCQUF5QixFQUFFLGNBQXNCO0lBQ3JGLE9BQU87UUFDSDtZQUNJLEtBQUssRUFBRSwrS0FBK0s7WUFDdEwsTUFBTSxFQUFFLFVBQUcsaUJBQWlCLDJCQUF3QjtTQUN2RDtRQUNEO1lBQ0ksS0FBSyxFQUFFLDZMQUE2TDtZQUNwTSxNQUFNLEVBQUUsVUFBRyxjQUFjLG9EQUFpRDtTQUM3RTtLQUNKLENBQUM7QUFDTixDQUFDO0FBWEQsMERBV0MifQ==

@@ -5,5 +5,5 @@ "use strict";

function slugify(content) {
var a = "àáäâãåăæąçćčđďèéěėëêęǵḧìíïîįłḿǹńňñòóöôœøṕŕřßśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;";
var b = "aaaaaaaaacccddeeeeeeeghiiiiilmnnnnooooooprrssssttuuuuuuuuuwxyyzzz------";
var p = new RegExp(a.split("").join("|"), "g");
const a = "àáäâãåăæąçćčđďèéěėëêęǵḧìíïîįłḿǹńňñòóöôœøṕŕřßśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;";
const b = "aaaaaaaaacccddeeeeeeeghiiiiilmnnnnooooooprrssssttuuuuuuuuuwxyyzzz------";
const p = new RegExp(a.split("").join("|"), "g");
return content

@@ -13,3 +13,3 @@ .toString()

.replace(/\s+/g, "-") // Replace spaces with -
.replace(p, function (c) { return b.charAt(a.indexOf(c)); }) // Replace special characters
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, "-and-") // Replace & with 'and'

@@ -22,2 +22,1 @@ .replace(/[^\w-]+/g, "") // Remove all non-word characters

exports.slugify = slugify;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2x1Z2lmeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9zbHVnaWZ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLFNBQWdCLE9BQU8sQ0FBQyxPQUFlO0lBQ25DLElBQU0sQ0FBQyxHQUFHLHlFQUF5RSxDQUFDO0lBQ3BGLElBQU0sQ0FBQyxHQUFHLHlFQUF5RSxDQUFDO0lBQ3BGLElBQU0sQ0FBQyxHQUFHLElBQUksTUFBTSxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0lBRWpELE9BQU8sT0FBTztTQUNULFFBQVEsRUFBRTtTQUNWLFdBQVcsRUFBRTtTQUNiLE9BQU8sQ0FBQyxNQUFNLEVBQUUsR0FBRyxDQUFDLENBQUMsd0JBQXdCO1NBQzdDLE9BQU8sQ0FBQyxDQUFDLEVBQUUsVUFBQSxDQUFDLElBQUksT0FBQSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBdEIsQ0FBc0IsQ0FBQyxDQUFDLDZCQUE2QjtTQUNyRSxPQUFPLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxDQUFDLHVCQUF1QjtTQUM5QyxPQUFPLENBQUMsVUFBVSxFQUFFLEVBQUUsQ0FBQyxDQUFDLGlDQUFpQztTQUN6RCxPQUFPLENBQUMsTUFBTSxFQUFFLEdBQUcsQ0FBQyxDQUFDLG1DQUFtQztTQUN4RCxPQUFPLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDLDRCQUE0QjtTQUMvQyxPQUFPLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUMsMEJBQTBCO0FBQ3ZELENBQUM7QUFmRCwwQkFlQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var slugify_1 = require("./slugify");
test("slugify", function () {
const slugify_1 = require("./slugify");
test("slugify", () => {
expect((0, slugify_1.slugify)("Nějaký název")).toBe("nejaky-nazev");

@@ -9,2 +9,1 @@ expect((0, slugify_1.slugify)("8 hrozných")).toBe("8-hroznych");

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2x1Z2lmeS50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3NsdWdpZnkudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFDQUFvQztBQUVwQyxJQUFJLENBQUMsU0FBUyxFQUFFO0lBQ2QsTUFBTSxDQUFDLElBQUEsaUJBQU8sRUFBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNyRCxNQUFNLENBQUMsSUFBQSxpQkFBTyxFQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ2pELE1BQU0sQ0FBQyxJQUFBLGlCQUFPLEVBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUM7QUFDdkQsQ0FBQyxDQUFDLENBQUMifQ==

@@ -8,2 +8,1 @@ "use strict";

exports.trimTrailingZeros = trimTrailingZeros;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJpbVRyYWlsaW5nWmVyb3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHJpbVRyYWlsaW5nWmVyb3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsU0FBZ0IsaUJBQWlCLENBQUMsS0FBYTtJQUMzQyxPQUFPLEtBQUssQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0FBQ3ZDLENBQUM7QUFGRCw4Q0FFQyJ9
export declare const FormValidator: {
isEmail: (errorMessage?: string | undefined) => (value: string) => string | undefined;
isGreaterOrEqualThan: (minValue: number, errorMessage?: string | undefined) => (value: string) => string | undefined;
isGreaterThan: (minValue: number, errorMessage?: string | undefined) => (value: string) => string | undefined;
isLessOrEqualThan: (maxValue: number, errorMessage?: string | undefined) => (value: string) => string | undefined;
isLessThan: (maxValue: number, errorMessage?: string | undefined) => (value: string) => string | undefined;
isPhone: (errorMessage?: string | undefined) => (value: string) => string | undefined;
required: (errorMessage?: string | undefined) => (value: any) => string | undefined;
isEmail: (errorMessage?: string) => (value: string) => string | undefined;
isGreaterOrEqualThan: (minValue: number, errorMessage?: string) => (value: string) => string | undefined;
isGreaterThan: (minValue: number, errorMessage?: string) => (value: string) => string | undefined;
isLessOrEqualThan: (maxValue: number, errorMessage?: string) => (value: string) => string | undefined;
isLessThan: (maxValue: number, errorMessage?: string) => (value: string) => string | undefined;
isPhone: (errorMessage?: string) => (value: string) => string | undefined;
required: (errorMessage?: string) => (value: any) => string | undefined;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormValidator = void 0;
var Validator_1 = require("./Validator");
var emptyValue = function (value) { return value === null || value === undefined || value === ""; };
const Validator_1 = require("./Validator");
const emptyValue = (value) => value === null || value === undefined || value === "";
// required
var required = function (errorMessage) { return function (value) {
return emptyValue(value) ? errorMessage || "Vyplňte." : undefined;
}; };
const required = (errorMessage) => (value) => emptyValue(value) ? errorMessage || "Vyplňte." : undefined;
// email
var isEmail = function (errorMessage) { return function (value) {
return !emptyValue(value) && !Validator_1.Validator.isEmail(value) ? errorMessage || "E-mail není validní" : undefined;
}; };
const isEmail = (errorMessage) => (value) => !emptyValue(value) && !Validator_1.Validator.isEmail(value) ? errorMessage || "E-mail není validní" : undefined;
// phone
var isPhone = function (errorMessage) { return function (value) {
return !emptyValue(value) && !Validator_1.Validator.isPhone(value) ? errorMessage || "Telefon není validní" : undefined;
}; };
var isLessThan = function (maxValue, errorMessage) { return function (value) {
const isPhone = (errorMessage) => (value) => !emptyValue(value) && !Validator_1.Validator.isPhone(value) ? errorMessage || "Telefon není validní" : undefined;
const isLessThan = (maxValue, errorMessage) => (value) => {
if (value === "") {
return undefined;
}
var numberValue = Number.parseFloat(value);
const numberValue = Number.parseFloat(value);
return numberValue >= maxValue ? errorMessage || "Tohle je nějak moc – jste si jisti?" : undefined;
}; };
};
// less or equal
var isLessOrEqualThan = function (maxValue, errorMessage) { return function (value) {
const isLessOrEqualThan = (maxValue, errorMessage) => (value) => {
if (value === "") {
return undefined;
}
var numberValue = Number.parseFloat(value);
const numberValue = Number.parseFloat(value);
return numberValue > maxValue ? errorMessage || "Tohle je nějak moc – jste si jisti?" : undefined;
}; };
};
// greater
var isGreaterThan = function (minValue, errorMessage) { return function (value) {
const isGreaterThan = (minValue, errorMessage) => (value) => {
if (emptyValue(value)) {
return undefined;
}
var numberValue = Number.parseFloat(value);
const numberValue = Number.parseFloat(value);
return numberValue <= minValue ? errorMessage || "Tohle je nějak moc – jste si jisti?" : undefined;
}; };
};
// greater or equal
var isGreaterOrEqualThan = function (minValue, errorMessage) { return function (value) {
const isGreaterOrEqualThan = (minValue, errorMessage) => (value) => {
if (emptyValue(value)) {
return undefined;
}
var numberValue = Number.parseFloat(value);
const numberValue = Number.parseFloat(value);
return numberValue < minValue ? errorMessage || "Tohle je nějak moc – jste si jisti?" : undefined;
}; };
};
exports.FormValidator = {
isEmail: isEmail,
isGreaterOrEqualThan: isGreaterOrEqualThan,
isGreaterThan: isGreaterThan,
isLessOrEqualThan: isLessOrEqualThan,
isLessThan: isLessThan,
isPhone: isPhone,
required: required,
isEmail,
isGreaterOrEqualThan,
isGreaterThan,
isLessOrEqualThan,
isLessThan,
isPhone,
required,
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRm9ybVZhbGlkYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9WYWxpZGF0b3JzL0Zvcm1WYWxpZGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEseUNBQXdDO0FBRXhDLElBQU0sVUFBVSxHQUFHLFVBQUMsS0FBVSxJQUFLLE9BQUEsS0FBSyxLQUFLLElBQUksSUFBSSxLQUFLLEtBQUssU0FBUyxJQUFJLEtBQUssS0FBSyxFQUFFLEVBQXJELENBQXFELENBQUM7QUFFekYsV0FBVztBQUNYLElBQU0sUUFBUSxHQUFHLFVBQUMsWUFBcUIsSUFBSyxPQUFBLFVBQUMsS0FBVTtJQUNuRCxPQUFBLFVBQVUsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsWUFBWSxJQUFJLFVBQVUsQ0FBQyxDQUFDLENBQUMsU0FBUztBQUExRCxDQUEwRCxFQURsQixDQUNrQixDQUFDO0FBRS9ELFFBQVE7QUFDUixJQUFNLE9BQU8sR0FBRyxVQUFDLFlBQXFCLElBQUssT0FBQSxVQUFDLEtBQWE7SUFDckQsT0FBQSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLHFCQUFTLENBQUMsT0FBTyxDQUFDLE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zQkFBQTtJQUNwQixhQUFhLGVBQUE7SUFDYixpQkFBaUIsbUJBQUE7SUFDakIsVUFBVSxZQUFBO0lBQ1YsT0FBTyxTQUFBO0lBQ1AsUUFBUSxVQUFBO0NBQ1gsQ0FBQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FormValidator_1 = require("./FormValidator");
test("required", function () {
const FormValidator_1 = require("./FormValidator");
test("required", () => {
expect(FormValidator_1.FormValidator.required("error")("not empty")).toBeUndefined();

@@ -12,3 +12,3 @@ expect(FormValidator_1.FormValidator.required("error")(0)).toBeUndefined();

});
test("isEmail", function () {
test("isEmail", () => {
expect(FormValidator_1.FormValidator.isEmail("error")("")).toBeUndefined();

@@ -18,3 +18,3 @@ expect(FormValidator_1.FormValidator.isEmail("error")("dev@uxf.cz")).toBeUndefined();

});
test("isPhone", function () {
test("isPhone", () => {
expect(FormValidator_1.FormValidator.isPhone("error")("")).toBeUndefined();

@@ -24,3 +24,3 @@ expect(FormValidator_1.FormValidator.isPhone("error")("777888999")).toBeUndefined();

});
test("isLessThan", function () {
test("isLessThan", () => {
expect(FormValidator_1.FormValidator.isLessThan(10, "error")("")).toBeUndefined();

@@ -31,3 +31,3 @@ expect(FormValidator_1.FormValidator.isLessThan(10, "error")("9.9")).toBeUndefined();

});
test("isLessOrEqualThan", function () {
test("isLessOrEqualThan", () => {
expect(FormValidator_1.FormValidator.isLessOrEqualThan(10, "error")("")).toBeUndefined();

@@ -38,3 +38,3 @@ expect(FormValidator_1.FormValidator.isLessOrEqualThan(10, "error")("9.9")).toBeUndefined();

});
test("isGreaterThan", function () {
test("isGreaterThan", () => {
expect(FormValidator_1.FormValidator.isGreaterThan(10, "error")("")).toBeUndefined();

@@ -45,3 +45,3 @@ expect(FormValidator_1.FormValidator.isGreaterThan(10, "error")("9")).toBe("error");

});
test("isGreaterOrEqualThan", function () {
test("isGreaterOrEqualThan", () => {
expect(FormValidator_1.FormValidator.isGreaterOrEqualThan(10, "error")("")).toBeUndefined();

@@ -52,2 +52,1 @@ expect(FormValidator_1.FormValidator.isGreaterOrEqualThan(10, "error")("9")).toBe("error");

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRm9ybVZhbGlkYXRvci50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL1ZhbGlkYXRvcnMvRm9ybVZhbGlkYXRvci50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWdEO0FBRWhELElBQUksQ0FBQyxVQUFVLEVBQUU7SUFDYixNQUFNLENBQUMsNkJBQWEsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxhQUFhLEVBQUUsQ0FBQztJQUNyRSxNQUFNLENBQUMsNkJBQWEsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxhQUFhLEVBQUUsQ0FBQztJQUMzRCxNQUFNLENBQUMsNkJBQWEsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxhQUFhLEVBQUUsQ0FBQztJQUUvRCxNQUFNLENBQUMsNkJBQWEsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDMUQsTUFBTSxDQUFDLDZCQUFhLENBQUMsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQzVELE1BQU0sQ0FBQyw2QkFBYSxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxPQ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UFJLENBQUMsQ0FBQyxDQUFDLGFBQWEsRUFBRSxDQUFDO0lBQzlFLE1BQU0sQ0FBQyw2QkFBYSxDQUFDLG9CQUFvQixDQUFDLEVBQUUsRUFBRSxPQUFPLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLGFBQWEsRUFBRSxDQUFDO0FBQ3RGLENBQUMsQ0FBQyxDQUFDIn0=

@@ -5,11 +5,10 @@ "use strict";

// Email
var EMAIL_REGEXP = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
var isEmail = function (email) { return EMAIL_REGEXP.test(email); };
const EMAIL_REGEXP = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const isEmail = (email) => EMAIL_REGEXP.test(email);
// Phone
var PHONE_REGEXP = /^(\+\d{1,3}|00\d{1,3})? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/;
var isPhone = function (phone) { return PHONE_REGEXP.test(phone); };
const PHONE_REGEXP = /^(\+\d{1,3}|00\d{1,3})? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/;
const isPhone = (phone) => PHONE_REGEXP.test(phone);
exports.Validator = {
isEmail: isEmail,
isPhone: isPhone,
isEmail,
isPhone,
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVmFsaWRhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL1ZhbGlkYXRvcnMvVmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLFFBQVE7QUFDUixJQUFNLFlBQVksR0FBRyx1SkFBdUosQ0FBQztBQUM3SyxJQUFNLE9BQU8sR0FBRyxVQUFDLEtBQWEsSUFBYyxPQUFBLFlBQVksQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEVBQXhCLENBQXdCLENBQUM7QUFFckUsUUFBUTtBQUNSLElBQU0sWUFBWSxHQUFHLDZEQUE2RCxDQUFDO0FBQ25GLElBQU0sT0FBTyxHQUFHLFVBQUMsS0FBYSxJQUFjLE9BQUEsWUFBWSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBeEIsQ0FBd0IsQ0FBQztBQUV4RCxRQUFBLFNBQVMsR0FBRztJQUNyQixPQUFPLFNBQUE7SUFDUCxPQUFPLFNBQUE7Q0FDVixDQUFDIn0=
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Validator_1 = require("./Validator");
test("isEmail", function () {
const Validator_1 = require("./Validator");
test("isEmail", () => {
expect(Validator_1.Validator.isEmail("dev@uxf.cz")).toBe(true);

@@ -9,3 +9,3 @@ expect(Validator_1.Validator.isEmail("dev@uxf.c")).toBe(false);

});
test("isPhone", function () {
test("isPhone", () => {
expect(Validator_1.Validator.isPhone("+420777000111")).toBe(true);

@@ -19,2 +19,1 @@ expect(Validator_1.Validator.isPhone("00420777000111")).toBe(true);

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVmFsaWRhdG9yLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvVmFsaWRhdG9ycy9WYWxpZGF0b3IudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF3QztBQUV4QyxJQUFJLENBQUMsU0FBUyxFQUFFO0lBQ1osTUFBTSxDQUFDLHFCQUFTLENBQUMsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUF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UFDLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDMUQsQ0FBQyxDQUFDLENBQUMifQ==
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc