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

@highlight-ui/dialog

Package Overview
Dependencies
Maintainers
9
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highlight-ui/dialog - npm Package Compare versions

Comparing version 8.4.11 to 8.4.12

503

dist/cjs/index.js

@@ -6,19 +6,10 @@ 'use strict';

});
var React = require('react');
var classnames = require('classnames');
var utilsHooks = require('@highlight-ui/utils-hooks');
var utilsCommons = require('@highlight-ui/utils-commons');
var button = require('@highlight-ui/button');
var tooltip = require('@highlight-ui/tooltip');
var typography = require('@highlight-ui/typography');
var utilsPortalManager = require('@highlight-ui/utils-portal-manager');
function _interopDefaultLegacy(e) {

@@ -29,7 +20,6 @@ return e && typeof e === 'object' && 'default' in e ? e : {

}
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -49,3 +39,2 @@

var __assign = function () {

@@ -55,33 +44,28 @@ __assign = Object.assign || function __assign(t) {

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 styles$1 = {
"dialog": "Dialog-module__2icvnh15__v8-4-11",
"size-small": "Dialog-module__3spVEVua__v8-4-11",
"size-medium": "Dialog-module__-zWxw4HX__v8-4-11",
"size-large": "Dialog-module__3wZ2NPV0__v8-4-11",
"header": "Dialog-module__2wAUH40a__v8-4-11",
"headerShadowed": "Dialog-module__xODFOi1M__v8-4-11",
"headerTitle": "Dialog-module__1lxoaZF6__v8-4-11",
"closeButton": "Dialog-module__2l9SSdo___v8-4-11",
"body": "Dialog-module__1bPY4avA__v8-4-11",
"footer": "Dialog-module__3o8NTS6m__v8-4-11",
"footerShadowed": "Dialog-module__1s03rY8s__v8-4-11",
"disabled": "Dialog-module__1TM_UCZw__v8-4-11"
"dialog": "Dialog-module__QT4OG-LI__v8-4-12",
"size-small": "Dialog-module__mLhhxvim__v8-4-12",
"size-medium": "Dialog-module__YSc4N9fm__v8-4-12",
"size-large": "Dialog-module__Vnnq2R4U__v8-4-12",
"header": "Dialog-module__u7ppcJcZ__v8-4-12",
"headerShadowed": "Dialog-module__vgIqlm3C__v8-4-12",
"headerTitle": "Dialog-module__FBO9JaKV__v8-4-12",
"closeButton": "Dialog-module__4I99Gqr4__v8-4-12",
"body": "Dialog-module__PE94udd0__v8-4-12",
"footer": "Dialog-module__w2q5B9My__v8-4-12",
"footerShadowed": "Dialog-module__4StcUX8W__v8-4-12",
"disabled": "Dialog-module__U1jN9tzY__v8-4-12"
};
function useEventListener(t, r, i, o) {
void 0 === i && (i = global), void 0 === o && (o = {});
var c = React.useRef(),
u = o.capture,
a = o.passive,
v = o.once;
u = o.capture,
a = o.passive,
v = o.once;
React.useEffect(function () {

@@ -92,10 +76,9 @@ c.current = r;

var e = function (e) {
return c.current(e);
},
n = {
capture: u,
passive: a,
once: v
};
return c.current(e);
},
n = {
capture: u,
passive: a,
once: v
};
return i.addEventListener(t, e, n), function () {

@@ -107,6 +90,4 @@ i.removeEventListener(t, e, n);

}
const TABBABLE_NODES = /input|select|textarea|button|object/;
const FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
function hidden(element) {

@@ -116,15 +97,10 @@ if (process.env.NODE_ENV === "test") {

}
return element.style.display === "none";
}
function visible(element) {
const isHidden = element.getAttribute("aria-hidden") || element.getAttribute("hidden") || element.getAttribute("type") === "hidden";
if (isHidden) {
return false;
}
let parentElement = element;
while (parentElement) {

@@ -134,23 +110,16 @@ if (parentElement === document.body || parentElement.nodeType === 11) {

}
if (hidden(parentElement)) {
return false;
}
parentElement = parentElement.parentNode;
}
return true;
}
function getElementTabIndex(element) {
let tabIndex = element.getAttribute("tabindex");
if (tabIndex === null) {
tabIndex = void 0;
}
return parseInt(tabIndex, 10);
}
function focusable(element) {

@@ -162,3 +131,2 @@ const nodeName = element.nodeName.toLowerCase();

}
function tabbable(element) {

@@ -169,10 +137,7 @@ const tabIndex = getElementTabIndex(element);

}
function findTabbableDescendants(element) {
return Array.from(element.querySelectorAll(FOCUS_SELECTOR)).filter(tabbable);
}
function scopeTab(node, event) {
const tabbable = findTabbableDescendants(node);
if (!tabbable.length) {

@@ -182,14 +147,10 @@ event.preventDefault();

}
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
const root = node.getRootNode();
const leavingFinalTabbable = finalTabbable === root.activeElement || node === root.activeElement;
if (!leavingFinalTabbable) {
return;
}
event.preventDefault();
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
if (target) {

@@ -199,17 +160,12 @@ target.focus();

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

@@ -225,3 +181,2 @@ node,

}
if (item.ariaHidden === null) {

@@ -235,3 +190,2 @@ item.node.removeAttribute("aria-hidden");

}
function useFocusTrap(active = true) {

@@ -244,17 +198,12 @@ const ref = React.useRef();

}
if (node === null) {
return;
}
restoreAria.current = createAriaHider(node);
if (ref.current === node) {
return;
}
if (node) {
const processNode = () => {
let focusElement = node.querySelector("[data-autofocus]");
if (!focusElement) {

@@ -265,3 +214,2 @@ const children = Array.from(node.querySelectorAll(FOCUS_SELECTOR));

}
if (focusElement) {

@@ -275,3 +223,2 @@ focusElement.focus({

};
setTimeout(() => {

@@ -293,3 +240,2 @@ if (node.getRootNode()) {

}
const handleKeyDown = event => {

@@ -300,7 +246,5 @@ if (event.key === "Tab" && ref.current) {

};
document.addEventListener("keydown", handleKeyDown);
return () => {
document.removeEventListener("keydown", handleKeyDown);
if (restoreAria.current) {

@@ -313,4 +257,4 @@ restoreAria.current();

}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/**

@@ -326,21 +270,21 @@ * lodash (Custom Build) <https://lodash.com/>

/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**

@@ -350,19 +294,19 @@ * Used to match `RegExp`

*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
var root = freeGlobal || freeSelf || Function('return this')();
/**

@@ -378,3 +322,2 @@ * A faster alternative to `Function#apply`, this function invokes `func`

*/
function apply(func, thisArg, args) {

@@ -384,15 +327,12 @@ switch (args.length) {

return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**

@@ -406,7 +346,6 @@ * Gets the value at `key` of `object`.

*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**

@@ -419,4 +358,2 @@ * Checks if `value` is a host object in IE < 9.

*/
function isHostObject(value) {

@@ -426,3 +363,2 @@ // Many host objects are `Object` objects that can coerce to strings

var result = false;
if (value != null && typeof value.toString != 'function') {

@@ -433,16 +369,14 @@ try {

}
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = function () {

@@ -452,9 +386,9 @@ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');

}();
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
var hasOwnProperty = objectProto.hasOwnProperty;
/**

@@ -465,22 +399,22 @@ * Used to resolve the

*/
var objectToString = objectProto.toString;
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
/** Built-in value references. */
var Symbol = root.Symbol,
splice = arrayProto.splice;
var Symbol = root.Symbol,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
var nativeMax = Math.max;
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**

@@ -493,8 +427,6 @@ * Creates a hash object.

*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -505,2 +437,3 @@ var entry = entries[index];

}
/**

@@ -513,7 +446,6 @@ * Removes all key-value entries from the hash.

*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**

@@ -529,7 +461,6 @@ * Removes `key` and its value from the hash.

*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**

@@ -544,7 +475,4 @@ * Gets the hash value for `key`.

*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {

@@ -554,5 +482,5 @@ var result = data[key];

}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**

@@ -567,4 +495,2 @@ * Checks if a hash value for `key` exists.

*/
function hashHas(key) {

@@ -574,2 +500,3 @@ var data = this.__data__;

}
/**

@@ -585,4 +512,2 @@ * Sets the hash `key` to `value`.

*/
function hashSet(key, value) {

@@ -592,5 +517,5 @@ var data = this.__data__;

return this;
} // Add methods to `Hash`.
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;

@@ -601,2 +526,3 @@ Hash.prototype['delete'] = hashDelete;

Hash.prototype.set = hashSet;
/**

@@ -609,8 +535,6 @@ * Creates an list cache object.

*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -621,2 +545,3 @@ var entry = entries[index];

}
/**

@@ -629,7 +554,6 @@ * Removes all key-value entries from the list cache.

*/
function listCacheClear() {
this.__data__ = [];
}
/**

@@ -644,14 +568,9 @@ * Removes `key` and its value from the list cache.

*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {

@@ -662,5 +581,5 @@ data.pop();

}
return true;
}
/**

@@ -675,9 +594,8 @@ * Gets the list cache value for `key`.

*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**

@@ -692,7 +610,6 @@ * Checks if a list cache value for `key` exists.

*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**

@@ -708,8 +625,5 @@ * Sets the list cache `key` to `value`.

*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
if (index < 0) {

@@ -720,7 +634,6 @@ data.push([key, value]);

}
return this;
} // Add methods to `ListCache`.
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;

@@ -731,2 +644,3 @@ ListCache.prototype['delete'] = listCacheDelete;

ListCache.prototype.set = listCacheSet;
/**

@@ -739,8 +653,6 @@ * Creates a map cache object to store key-value pairs.

*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -751,2 +663,3 @@ var entry = entries[index];

}
/**

@@ -759,4 +672,2 @@ * Removes all key-value entries from the map.

*/
function mapCacheClear() {

@@ -769,2 +680,3 @@ this.__data__ = {

}
/**

@@ -779,7 +691,6 @@ * Removes `key` and its value from the map.

*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**

@@ -794,7 +705,6 @@ * Gets the map value for `key`.

*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**

@@ -809,7 +719,6 @@ * Checks if a map value for `key` exists.

*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**

@@ -825,10 +734,8 @@ * Sets the map `key` to `value`.

*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
} // Add methods to `MapCache`.
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;

@@ -839,2 +746,3 @@ MapCache.prototype['delete'] = mapCacheDelete;

MapCache.prototype.set = mapCacheSet;
/**

@@ -848,6 +756,4 @@ * Gets the index at which the `key` is found in `array` of key-value pairs.

*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {

@@ -858,5 +764,5 @@ if (eq(array[length][0], key)) {

}
return -1;
}
/**

@@ -870,15 +776,12 @@ * The base implementation of `_.get` without support for default values.

*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined;
}
/**

@@ -894,4 +797,2 @@ * The base implementation of `_.invoke` without support for individual

*/
function baseInvoke(object, path, args) {

@@ -903,6 +804,6 @@ if (!isKey(path, object)) {

}
var func = object == null ? object : object[toKey(path)];
return func == null ? undefined : apply(func, object, args);
}
/**

@@ -916,4 +817,2 @@ * The base implementation of `_.isNative` without bad shim checks.

*/
function baseIsNative(value) {

@@ -923,6 +822,6 @@ if (!isObject(value) || isMasked(value)) {

}
var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**

@@ -936,4 +835,2 @@ * The base implementation of `_.rest` which doesn't validate or coerce arguments.

*/
function baseRest(func, start) {

@@ -943,17 +840,13 @@ start = nativeMax(start === undefined ? func.length - 1 : start, 0);

var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;

@@ -963,2 +856,3 @@ return apply(func, this, otherArgs);

}
/**

@@ -973,28 +867,21 @@ * The base implementation of `_.slice` without an iteratee call guard.

*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**

@@ -1008,4 +895,2 @@ * The base implementation of `_.toString` which doesn't convert nullish

*/
function baseToString(value) {

@@ -1016,10 +901,9 @@ // Exit early for strings to avoid a performance hit in some environments.

}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
/**

@@ -1032,7 +916,6 @@ * Casts `value` to a path array if it's not one.

*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**

@@ -1046,4 +929,2 @@ * Gets the data for `map`.

*/
function getMapData(map, key) {

@@ -1053,2 +934,3 @@ var data = map.__data__;

}
/**

@@ -1062,4 +944,2 @@ * Gets the native function at `key` of `object`.

*/
function getNative(object, key) {

@@ -1069,2 +949,3 @@ var value = getValue(object, key);

}
/**

@@ -1078,4 +959,2 @@ * Checks if `value` is a property name and not a property path.

*/
function isKey(value, object) {

@@ -1085,11 +964,9 @@ if (isArray(value)) {

}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
/**

@@ -1102,4 +979,2 @@ * Checks if `value` is suitable for use as unique object key.

*/
function isKeyable(value) {

@@ -1109,2 +984,3 @@ var type = typeof value;

}
/**

@@ -1117,7 +993,6 @@ * Checks if `func` has its source masked.

*/
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
/**

@@ -1131,7 +1006,6 @@ * Gets the parent value at `path` of `object`.

*/
function parent(object, path) {
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**

@@ -1144,12 +1018,8 @@ * Converts `string` to a property path array.

*/
var stringToPath = memoize(function (string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function (match, number, quote, string) {

@@ -1160,2 +1030,3 @@ result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);

});
/**

@@ -1168,3 +1039,2 @@ * Converts `value` to a string key if it's not a string or symbol.

*/
function toKey(value) {

@@ -1174,6 +1044,6 @@ if (typeof value == 'string' || isSymbol(value)) {

}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
/**

@@ -1186,4 +1056,2 @@ * Converts `func` to its source code.

*/
function toSource(func) {

@@ -1194,3 +1062,2 @@ if (func != null) {

} catch (e) {}
try {

@@ -1200,5 +1067,5 @@ return func + '';

}
return '';
}
/**

@@ -1218,4 +1085,2 @@ * Gets the last element of `array`.

*/
function last(array) {

@@ -1225,2 +1090,3 @@ var length = array ? array.length : 0;

}
/**

@@ -1270,4 +1136,2 @@ * Creates a function that memoizes the result of `func`. If `resolver` is

*/
function memoize(func, resolver) {

@@ -1277,12 +1141,9 @@ if (typeof func != 'function' || resolver && typeof resolver != 'function') {

}
var memoized = function () {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);

@@ -1292,9 +1153,9 @@ memoized.cache = cache.set(key, result);

};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
} // Assign cache to `_.memoize`.
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
memoize.Cache = MapCache;
/**

@@ -1332,6 +1193,6 @@ * Performs a

*/
function eq(value, other) {
return value === other || value !== value && other !== other;
}
/**

@@ -1360,5 +1221,4 @@ * Checks if `value` is classified as an `Array` object.

*/
var isArray = Array.isArray;
var isArray = Array.isArray;
/**

@@ -1381,3 +1241,2 @@ * Checks if `value` is classified as a `Function` object.

*/
function isFunction(value) {

@@ -1389,2 +1248,3 @@ // The use of `Object#toString` avoids issues with the `typeof` operator

}
/**

@@ -1415,4 +1275,2 @@ * Checks if `value` is the

*/
function isObject(value) {

@@ -1422,2 +1280,3 @@ var type = typeof value;

}
/**

@@ -1447,7 +1306,6 @@ * Checks if `value` is object-like. A value is object-like if it's not `null`

*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**

@@ -1470,7 +1328,6 @@ * Checks if `value` is classified as a `Symbol` primitive or object.

*/
function isSymbol(value) {
return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
}
/**

@@ -1497,7 +1354,6 @@ * Converts `value` to a string. An empty string is returned for `null`

*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**

@@ -1521,23 +1377,20 @@ * Invokes the method at `path` of `object`.

*/
var invoke = baseRest(baseInvoke);
var lodash_invoke = invoke;
var styles = {
"modal": "Modal-module__i5Pbh60m__v8-4-11",
"modalBackdrop": "Modal-module__ZVIwEMrU__v8-4-11",
"modalContent": "Modal-module__3UHa_kcB__v8-4-11",
"scrollLocked": "Modal-module__1T2Qjbem__v8-4-11"
"modal": "Modal-module__fBTelkwv__v8-4-12",
"modalBackdrop": "Modal-module__SnXcT4vC__v8-4-12",
"modalContent": "Modal-module__n3eZk6iN__v8-4-12",
"scrollLocked": "Modal-module__IDCbrhr-__v8-4-12"
};
var Modal = function (_a) {
var metadata = _a.metadata,
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
_b = _a.onClose,
onClose = _b === void 0 ? utilsCommons.noop : _b,
_c = _a.onOpen,
onOpen = _c === void 0 ? utilsCommons.noop : _c,
open = _a.open;
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
_b = _a.onClose,
onClose = _b === void 0 ? utilsCommons.noop : _b,
_c = _a.onOpen,
onOpen = _c === void 0 ? utilsCommons.noop : _c,
open = _a.open;
var ref = useFocusTrap();

@@ -1553,3 +1406,2 @@ var firstRender = React.useRef(true);

}
if (open) {

@@ -1562,6 +1414,6 @@ onOpen();

}
return function () {
lodash_invoke(document, 'body.classList.remove', styles.scrollLocked);
}; // eslint-disable-next-line react-hooks/exhaustive-deps
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);

@@ -1578,5 +1430,3 @@ if (!open) return null;

};
var DEFAULT_LABEL_ID = 'dialog-title';
var getButtonVariant = function (isPrimaryButton, dialogVariant) {

@@ -1586,39 +1436,32 @@ if (!isPrimaryButton) {

}
return dialogVariant === 'destructive' ? 'critical' : 'primary';
};
var Dialog = function (_a) {
var _b, _c;
var metadata = _a.metadata,
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
onClose = _a.onClose,
onOpen = _a.onOpen,
open = _a.open,
title = _a.title,
_d = _a.labelledBy,
labelledBy = _d === void 0 ? DEFAULT_LABEL_ID : _d,
describedBy = _a.describedBy,
primaryButton = _a.primaryButton,
secondaryButtons = _a.secondaryButtons,
_e = _a.variant,
variant = _e === void 0 ? 'default' : _e,
_f = _a.size,
size = _f === void 0 ? 'small' : _f;
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
onClose = _a.onClose,
onOpen = _a.onOpen,
open = _a.open,
title = _a.title,
_d = _a.labelledBy,
labelledBy = _d === void 0 ? DEFAULT_LABEL_ID : _d,
describedBy = _a.describedBy,
primaryButton = _a.primaryButton,
secondaryButtons = _a.secondaryButtons,
_e = _a.variant,
variant = _e === void 0 ? 'default' : _e,
_f = _a.size,
size = _f === void 0 ? 'small' : _f;
var _g = React.useState(),
closeButtonElement = _g[0],
setCloseButtonElement = _g[1];
closeButtonElement = _g[0],
setCloseButtonElement = _g[1];
var _h = React.useState(false),
topShadow = _h[0],
setTopShadow = _h[1];
topShadow = _h[0],
setTopShadow = _h[1];
var _j = React.useState(false),
bottomShadow = _j[0],
setBottomShadow = _j[1];
bottomShadow = _j[0],
setBottomShadow = _j[1];
var setElement = utilsHooks.useScrollObserver(function (percent) {

@@ -1628,3 +1471,2 @@ setTopShadow(percent > 0);

}).setElement;
var getDialogButtons = function () {

@@ -1641,3 +1483,2 @@ var primaryButtonArray = primaryButton ? [__assign(__assign({}, primaryButton), {

};
return React__default["default"].createElement(Modal, {

@@ -1678,17 +1519,15 @@ metadata: metadata,

var _a;
var isPrimary = button$1.isPrimary,
buttonState = button$1.buttonState,
buttonType = button$1.buttonType,
buttonForm = button$1.buttonForm,
buttonLabel = button$1.buttonLabel,
onClick = button$1.onClick,
buttonIcon = button$1.buttonIcon,
buttonAriaLabel = button$1.buttonAriaLabel,
buttonMetadata = button$1.metadata,
tooltip$1 = button$1.tooltip;
buttonState = button$1.buttonState,
buttonType = button$1.buttonType,
buttonForm = button$1.buttonForm,
buttonLabel = button$1.buttonLabel,
onClick = button$1.onClick,
buttonIcon = button$1.buttonIcon,
buttonAriaLabel = button$1.buttonAriaLabel,
buttonMetadata = button$1.metadata,
tooltip$1 = button$1.tooltip;
var buttonVariant = getButtonVariant(isPrimary, variant);
var key = (buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : buttonIcon) + "-" + index;
var buttonClassName = classnames__default["default"](styles$1.footerAction, (_a = {}, _a[styles$1.disabled] = buttonState === 'disabled', _a['dialog-danger'] = isPrimary && variant === 'destructive', _a['dialog-primary'] = isPrimary && variant !== 'destructive', _a));
var onButtonFocus = function () {

@@ -1699,3 +1538,2 @@ if (closeButtonElement) {

};
var buttonNode = buttonIcon ? React__default["default"].createElement(button.IconButton, __assign({

@@ -1729,5 +1567,4 @@ key: key,

};
exports.Dialog = Dialog;
exports.Modal = Modal;
//# sourceMappingURL=index.js.map

@@ -9,3 +9,4 @@ import React, { useRef, useEffect, useCallback, useState } from 'react';

import { GroupedPortal } from '@highlight-ui/utils-portal-manager';
/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -29,33 +30,28 @@

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 styles$1 = {
"dialog": "Dialog-module__2icvnh15__v8-4-11",
"size-small": "Dialog-module__3spVEVua__v8-4-11",
"size-medium": "Dialog-module__-zWxw4HX__v8-4-11",
"size-large": "Dialog-module__3wZ2NPV0__v8-4-11",
"header": "Dialog-module__2wAUH40a__v8-4-11",
"headerShadowed": "Dialog-module__xODFOi1M__v8-4-11",
"headerTitle": "Dialog-module__1lxoaZF6__v8-4-11",
"closeButton": "Dialog-module__2l9SSdo___v8-4-11",
"body": "Dialog-module__1bPY4avA__v8-4-11",
"footer": "Dialog-module__3o8NTS6m__v8-4-11",
"footerShadowed": "Dialog-module__1s03rY8s__v8-4-11",
"disabled": "Dialog-module__1TM_UCZw__v8-4-11"
"dialog": "Dialog-module__QT4OG-LI__v8-4-12",
"size-small": "Dialog-module__mLhhxvim__v8-4-12",
"size-medium": "Dialog-module__YSc4N9fm__v8-4-12",
"size-large": "Dialog-module__Vnnq2R4U__v8-4-12",
"header": "Dialog-module__u7ppcJcZ__v8-4-12",
"headerShadowed": "Dialog-module__vgIqlm3C__v8-4-12",
"headerTitle": "Dialog-module__FBO9JaKV__v8-4-12",
"closeButton": "Dialog-module__4I99Gqr4__v8-4-12",
"body": "Dialog-module__PE94udd0__v8-4-12",
"footer": "Dialog-module__w2q5B9My__v8-4-12",
"footerShadowed": "Dialog-module__4StcUX8W__v8-4-12",
"disabled": "Dialog-module__U1jN9tzY__v8-4-12"
};
function useEventListener(t, r, i, o) {
void 0 === i && (i = global), void 0 === o && (o = {});
var c = useRef(),
u = o.capture,
a = o.passive,
v = o.once;
u = o.capture,
a = o.passive,
v = o.once;
useEffect(function () {

@@ -66,10 +62,9 @@ c.current = r;

var e = function (e) {
return c.current(e);
},
n = {
capture: u,
passive: a,
once: v
};
return c.current(e);
},
n = {
capture: u,
passive: a,
once: v
};
return i.addEventListener(t, e, n), function () {

@@ -81,6 +76,4 @@ i.removeEventListener(t, e, n);

}
const TABBABLE_NODES = /input|select|textarea|button|object/;
const FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
function hidden(element) {

@@ -90,15 +83,10 @@ if (process.env.NODE_ENV === "test") {

}
return element.style.display === "none";
}
function visible(element) {
const isHidden = element.getAttribute("aria-hidden") || element.getAttribute("hidden") || element.getAttribute("type") === "hidden";
if (isHidden) {
return false;
}
let parentElement = element;
while (parentElement) {

@@ -108,23 +96,16 @@ if (parentElement === document.body || parentElement.nodeType === 11) {

}
if (hidden(parentElement)) {
return false;
}
parentElement = parentElement.parentNode;
}
return true;
}
function getElementTabIndex(element) {
let tabIndex = element.getAttribute("tabindex");
if (tabIndex === null) {
tabIndex = void 0;
}
return parseInt(tabIndex, 10);
}
function focusable(element) {

@@ -136,3 +117,2 @@ const nodeName = element.nodeName.toLowerCase();

}
function tabbable(element) {

@@ -143,10 +123,7 @@ const tabIndex = getElementTabIndex(element);

}
function findTabbableDescendants(element) {
return Array.from(element.querySelectorAll(FOCUS_SELECTOR)).filter(tabbable);
}
function scopeTab(node, event) {
const tabbable = findTabbableDescendants(node);
if (!tabbable.length) {

@@ -156,14 +133,10 @@ event.preventDefault();

}
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
const root = node.getRootNode();
const leavingFinalTabbable = finalTabbable === root.activeElement || node === root.activeElement;
if (!leavingFinalTabbable) {
return;
}
event.preventDefault();
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
if (target) {

@@ -173,17 +146,12 @@ target.focus();

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

@@ -199,3 +167,2 @@ node,

}
if (item.ariaHidden === null) {

@@ -209,3 +176,2 @@ item.node.removeAttribute("aria-hidden");

}
function useFocusTrap(active = true) {

@@ -218,17 +184,12 @@ const ref = useRef();

}
if (node === null) {
return;
}
restoreAria.current = createAriaHider(node);
if (ref.current === node) {
return;
}
if (node) {
const processNode = () => {
let focusElement = node.querySelector("[data-autofocus]");
if (!focusElement) {

@@ -239,3 +200,2 @@ const children = Array.from(node.querySelectorAll(FOCUS_SELECTOR));

}
if (focusElement) {

@@ -249,3 +209,2 @@ focusElement.focus({

};
setTimeout(() => {

@@ -267,3 +226,2 @@ if (node.getRootNode()) {

}
const handleKeyDown = event => {

@@ -274,7 +232,5 @@ if (event.key === "Tab" && ref.current) {

};
document.addEventListener("keydown", handleKeyDown);
return () => {
document.removeEventListener("keydown", handleKeyDown);
if (restoreAria.current) {

@@ -287,4 +243,4 @@ restoreAria.current();

}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/**

@@ -300,21 +256,21 @@ * lodash (Custom Build) <https://lodash.com/>

/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**

@@ -324,19 +280,19 @@ * Used to match `RegExp`

*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
var root = freeGlobal || freeSelf || Function('return this')();
/**

@@ -352,3 +308,2 @@ * A faster alternative to `Function#apply`, this function invokes `func`

*/
function apply(func, thisArg, args) {

@@ -358,15 +313,12 @@ switch (args.length) {

return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**

@@ -380,7 +332,6 @@ * Gets the value at `key` of `object`.

*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**

@@ -393,4 +344,2 @@ * Checks if `value` is a host object in IE < 9.

*/
function isHostObject(value) {

@@ -400,3 +349,2 @@ // Many host objects are `Object` objects that can coerce to strings

var result = false;
if (value != null && typeof value.toString != 'function') {

@@ -407,16 +355,14 @@ try {

}
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = function () {

@@ -426,9 +372,9 @@ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');

}();
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
var hasOwnProperty = objectProto.hasOwnProperty;
/**

@@ -439,22 +385,22 @@ * Used to resolve the

*/
var objectToString = objectProto.toString;
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
/** Built-in value references. */
var Symbol = root.Symbol,
splice = arrayProto.splice;
var Symbol = root.Symbol,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
var nativeMax = Math.max;
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**

@@ -467,8 +413,6 @@ * Creates a hash object.

*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -479,2 +423,3 @@ var entry = entries[index];

}
/**

@@ -487,7 +432,6 @@ * Removes all key-value entries from the hash.

*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**

@@ -503,7 +447,6 @@ * Removes `key` and its value from the hash.

*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**

@@ -518,7 +461,4 @@ * Gets the hash value for `key`.

*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {

@@ -528,5 +468,5 @@ var result = data[key];

}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**

@@ -541,4 +481,2 @@ * Checks if a hash value for `key` exists.

*/
function hashHas(key) {

@@ -548,2 +486,3 @@ var data = this.__data__;

}
/**

@@ -559,4 +498,2 @@ * Sets the hash `key` to `value`.

*/
function hashSet(key, value) {

@@ -566,5 +503,5 @@ var data = this.__data__;

return this;
} // Add methods to `Hash`.
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;

@@ -575,2 +512,3 @@ Hash.prototype['delete'] = hashDelete;

Hash.prototype.set = hashSet;
/**

@@ -583,8 +521,6 @@ * Creates an list cache object.

*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -595,2 +531,3 @@ var entry = entries[index];

}
/**

@@ -603,7 +540,6 @@ * Removes all key-value entries from the list cache.

*/
function listCacheClear() {
this.__data__ = [];
}
/**

@@ -618,14 +554,9 @@ * Removes `key` and its value from the list cache.

*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {

@@ -636,5 +567,5 @@ data.pop();

}
return true;
}
/**

@@ -649,9 +580,8 @@ * Gets the list cache value for `key`.

*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**

@@ -666,7 +596,6 @@ * Checks if a list cache value for `key` exists.

*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**

@@ -682,8 +611,5 @@ * Sets the list cache `key` to `value`.

*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
index = assocIndexOf(data, key);
if (index < 0) {

@@ -694,7 +620,6 @@ data.push([key, value]);

}
return this;
} // Add methods to `ListCache`.
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;

@@ -705,2 +630,3 @@ ListCache.prototype['delete'] = listCacheDelete;

ListCache.prototype.set = listCacheSet;
/**

@@ -713,8 +639,6 @@ * Creates a map cache object to store key-value pairs.

*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {

@@ -725,2 +649,3 @@ var entry = entries[index];

}
/**

@@ -733,4 +658,2 @@ * Removes all key-value entries from the map.

*/
function mapCacheClear() {

@@ -743,2 +666,3 @@ this.__data__ = {

}
/**

@@ -753,7 +677,6 @@ * Removes `key` and its value from the map.

*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**

@@ -768,7 +691,6 @@ * Gets the map value for `key`.

*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**

@@ -783,7 +705,6 @@ * Checks if a map value for `key` exists.

*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**

@@ -799,10 +720,8 @@ * Sets the map `key` to `value`.

*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
} // Add methods to `MapCache`.
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;

@@ -813,2 +732,3 @@ MapCache.prototype['delete'] = mapCacheDelete;

MapCache.prototype.set = mapCacheSet;
/**

@@ -822,6 +742,4 @@ * Gets the index at which the `key` is found in `array` of key-value pairs.

*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {

@@ -832,5 +750,5 @@ if (eq(array[length][0], key)) {

}
return -1;
}
/**

@@ -844,15 +762,12 @@ * The base implementation of `_.get` without support for default values.

*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined;
}
/**

@@ -868,4 +783,2 @@ * The base implementation of `_.invoke` without support for individual

*/
function baseInvoke(object, path, args) {

@@ -877,6 +790,6 @@ if (!isKey(path, object)) {

}
var func = object == null ? object : object[toKey(path)];
return func == null ? undefined : apply(func, object, args);
}
/**

@@ -890,4 +803,2 @@ * The base implementation of `_.isNative` without bad shim checks.

*/
function baseIsNative(value) {

@@ -897,6 +808,6 @@ if (!isObject(value) || isMasked(value)) {

}
var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**

@@ -910,4 +821,2 @@ * The base implementation of `_.rest` which doesn't validate or coerce arguments.

*/
function baseRest(func, start) {

@@ -917,17 +826,13 @@ start = nativeMax(start === undefined ? func.length - 1 : start, 0);

var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;

@@ -937,2 +842,3 @@ return apply(func, this, otherArgs);

}
/**

@@ -947,28 +853,21 @@ * The base implementation of `_.slice` without an iteratee call guard.

*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**

@@ -982,4 +881,2 @@ * The base implementation of `_.toString` which doesn't convert nullish

*/
function baseToString(value) {

@@ -990,10 +887,9 @@ // Exit early for strings to avoid a performance hit in some environments.

}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
/**

@@ -1006,7 +902,6 @@ * Casts `value` to a path array if it's not one.

*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**

@@ -1020,4 +915,2 @@ * Gets the data for `map`.

*/
function getMapData(map, key) {

@@ -1027,2 +920,3 @@ var data = map.__data__;

}
/**

@@ -1036,4 +930,2 @@ * Gets the native function at `key` of `object`.

*/
function getNative(object, key) {

@@ -1043,2 +935,3 @@ var value = getValue(object, key);

}
/**

@@ -1052,4 +945,2 @@ * Checks if `value` is a property name and not a property path.

*/
function isKey(value, object) {

@@ -1059,11 +950,9 @@ if (isArray(value)) {

}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
/**

@@ -1076,4 +965,2 @@ * Checks if `value` is suitable for use as unique object key.

*/
function isKeyable(value) {

@@ -1083,2 +970,3 @@ var type = typeof value;

}
/**

@@ -1091,7 +979,6 @@ * Checks if `func` has its source masked.

*/
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
/**

@@ -1105,7 +992,6 @@ * Gets the parent value at `path` of `object`.

*/
function parent(object, path) {
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**

@@ -1118,12 +1004,8 @@ * Converts `string` to a property path array.

*/
var stringToPath = memoize(function (string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function (match, number, quote, string) {

@@ -1134,2 +1016,3 @@ result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);

});
/**

@@ -1142,3 +1025,2 @@ * Converts `value` to a string key if it's not a string or symbol.

*/
function toKey(value) {

@@ -1148,6 +1030,6 @@ if (typeof value == 'string' || isSymbol(value)) {

}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
/**

@@ -1160,4 +1042,2 @@ * Converts `func` to its source code.

*/
function toSource(func) {

@@ -1168,3 +1048,2 @@ if (func != null) {

} catch (e) {}
try {

@@ -1174,5 +1053,5 @@ return func + '';

}
return '';
}
/**

@@ -1192,4 +1071,2 @@ * Gets the last element of `array`.

*/
function last(array) {

@@ -1199,2 +1076,3 @@ var length = array ? array.length : 0;

}
/**

@@ -1244,4 +1122,2 @@ * Creates a function that memoizes the result of `func`. If `resolver` is

*/
function memoize(func, resolver) {

@@ -1251,12 +1127,9 @@ if (typeof func != 'function' || resolver && typeof resolver != 'function') {

}
var memoized = function () {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);

@@ -1266,9 +1139,9 @@ memoized.cache = cache.set(key, result);

};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
} // Assign cache to `_.memoize`.
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
memoize.Cache = MapCache;
/**

@@ -1306,6 +1179,6 @@ * Performs a

*/
function eq(value, other) {
return value === other || value !== value && other !== other;
}
/**

@@ -1334,5 +1207,4 @@ * Checks if `value` is classified as an `Array` object.

*/
var isArray = Array.isArray;
var isArray = Array.isArray;
/**

@@ -1355,3 +1227,2 @@ * Checks if `value` is classified as a `Function` object.

*/
function isFunction(value) {

@@ -1363,2 +1234,3 @@ // The use of `Object#toString` avoids issues with the `typeof` operator

}
/**

@@ -1389,4 +1261,2 @@ * Checks if `value` is the

*/
function isObject(value) {

@@ -1396,2 +1266,3 @@ var type = typeof value;

}
/**

@@ -1421,7 +1292,6 @@ * Checks if `value` is object-like. A value is object-like if it's not `null`

*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**

@@ -1444,7 +1314,6 @@ * Checks if `value` is classified as a `Symbol` primitive or object.

*/
function isSymbol(value) {
return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
}
/**

@@ -1471,7 +1340,6 @@ * Converts `value` to a string. An empty string is returned for `null`

*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**

@@ -1495,23 +1363,20 @@ * Invokes the method at `path` of `object`.

*/
var invoke = baseRest(baseInvoke);
var lodash_invoke = invoke;
var styles = {
"modal": "Modal-module__i5Pbh60m__v8-4-11",
"modalBackdrop": "Modal-module__ZVIwEMrU__v8-4-11",
"modalContent": "Modal-module__3UHa_kcB__v8-4-11",
"scrollLocked": "Modal-module__1T2Qjbem__v8-4-11"
"modal": "Modal-module__fBTelkwv__v8-4-12",
"modalBackdrop": "Modal-module__SnXcT4vC__v8-4-12",
"modalContent": "Modal-module__n3eZk6iN__v8-4-12",
"scrollLocked": "Modal-module__IDCbrhr-__v8-4-12"
};
var Modal = function (_a) {
var metadata = _a.metadata,
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
_b = _a.onClose,
onClose = _b === void 0 ? noop : _b,
_c = _a.onOpen,
onOpen = _c === void 0 ? noop : _c,
open = _a.open;
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
_b = _a.onClose,
onClose = _b === void 0 ? noop : _b,
_c = _a.onOpen,
onOpen = _c === void 0 ? noop : _c,
open = _a.open;
var ref = useFocusTrap();

@@ -1527,3 +1392,2 @@ var firstRender = useRef(true);

}
if (open) {

@@ -1536,6 +1400,6 @@ onOpen();

}
return function () {
lodash_invoke(document, 'body.classList.remove', styles.scrollLocked);
}; // eslint-disable-next-line react-hooks/exhaustive-deps
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);

@@ -1552,5 +1416,3 @@ if (!open) return null;

};
var DEFAULT_LABEL_ID = 'dialog-title';
var getButtonVariant = function (isPrimaryButton, dialogVariant) {

@@ -1560,39 +1422,32 @@ if (!isPrimaryButton) {

}
return dialogVariant === 'destructive' ? 'critical' : 'primary';
};
var Dialog = function (_a) {
var _b, _c;
var metadata = _a.metadata,
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
onClose = _a.onClose,
onOpen = _a.onOpen,
open = _a.open,
title = _a.title,
_d = _a.labelledBy,
labelledBy = _d === void 0 ? DEFAULT_LABEL_ID : _d,
describedBy = _a.describedBy,
primaryButton = _a.primaryButton,
secondaryButtons = _a.secondaryButtons,
_e = _a.variant,
variant = _e === void 0 ? 'default' : _e,
_f = _a.size,
size = _f === void 0 ? 'small' : _f;
children = _a.children,
className = _a.className,
onRequestToClose = _a.onRequestToClose,
onClose = _a.onClose,
onOpen = _a.onOpen,
open = _a.open,
title = _a.title,
_d = _a.labelledBy,
labelledBy = _d === void 0 ? DEFAULT_LABEL_ID : _d,
describedBy = _a.describedBy,
primaryButton = _a.primaryButton,
secondaryButtons = _a.secondaryButtons,
_e = _a.variant,
variant = _e === void 0 ? 'default' : _e,
_f = _a.size,
size = _f === void 0 ? 'small' : _f;
var _g = useState(),
closeButtonElement = _g[0],
setCloseButtonElement = _g[1];
closeButtonElement = _g[0],
setCloseButtonElement = _g[1];
var _h = useState(false),
topShadow = _h[0],
setTopShadow = _h[1];
topShadow = _h[0],
setTopShadow = _h[1];
var _j = useState(false),
bottomShadow = _j[0],
setBottomShadow = _j[1];
bottomShadow = _j[0],
setBottomShadow = _j[1];
var setElement = useScrollObserver(function (percent) {

@@ -1602,3 +1457,2 @@ setTopShadow(percent > 0);

}).setElement;
var getDialogButtons = function () {

@@ -1615,3 +1469,2 @@ var primaryButtonArray = primaryButton ? [__assign(__assign({}, primaryButton), {

};
return /*#__PURE__*/React.createElement(Modal, {

@@ -1652,17 +1505,15 @@ metadata: metadata,

var _a;
var isPrimary = button.isPrimary,
buttonState = button.buttonState,
buttonType = button.buttonType,
buttonForm = button.buttonForm,
buttonLabel = button.buttonLabel,
onClick = button.onClick,
buttonIcon = button.buttonIcon,
buttonAriaLabel = button.buttonAriaLabel,
buttonMetadata = button.metadata,
tooltip = button.tooltip;
buttonState = button.buttonState,
buttonType = button.buttonType,
buttonForm = button.buttonForm,
buttonLabel = button.buttonLabel,
onClick = button.onClick,
buttonIcon = button.buttonIcon,
buttonAriaLabel = button.buttonAriaLabel,
buttonMetadata = button.metadata,
tooltip = button.tooltip;
var buttonVariant = getButtonVariant(isPrimary, variant);
var key = (buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : buttonIcon) + "-" + index;
var buttonClassName = classnames(styles$1.footerAction, (_a = {}, _a[styles$1.disabled] = buttonState === 'disabled', _a['dialog-danger'] = isPrimary && variant === 'destructive', _a['dialog-primary'] = isPrimary && variant !== 'destructive', _a));
var onButtonFocus = function () {

@@ -1673,3 +1524,2 @@ if (closeButtonElement) {

};
var buttonNode = buttonIcon ? /*#__PURE__*/React.createElement(IconButton, __assign({

@@ -1703,4 +1553,3 @@ key: key,

};
export { Dialog, Modal };
//# sourceMappingURL=index.js.map
{
"name": "@highlight-ui/dialog",
"version": "8.4.11",
"version": "8.4.12",
"author": "Personio GmbH & Co. KG",

@@ -29,7 +29,7 @@ "main": "dist/cjs/index.js",

"devDependencies": {
"@highlight-ui/configs-base-jest": "^3.1.1",
"@highlight-ui/configs-base-tsconfig": "^3.2.0",
"@highlight-ui/configs-scripts": "^3.2.2",
"@highlight-ui/theme": "^9.3.3",
"@highlight-ui/tokens": "^2.3.0",
"@highlight-ui/configs-base-jest": "^3.1.2",
"@highlight-ui/configs-base-tsconfig": "^3.2.1",
"@highlight-ui/configs-scripts": "^3.2.3",
"@highlight-ui/theme": "^9.3.4",
"@highlight-ui/tokens": "^2.3.1",
"@testing-library/dom": "8.19.0",

@@ -39,24 +39,24 @@ "@testing-library/react": "12.1.5",

"@types/lodash.invoke": "4.5.7",
"classnames": "^2.3.1",
"jest": "^27.2.3",
"react": "^17.0.2",
"rimraf": "^3.0.2"
"classnames": "~2.3.1",
"jest": "~27.2.3",
"react": "17.0.2",
"rimraf": "~3.0.2"
},
"dependencies": {
"@highlight-ui/button": "^11.5.7",
"@highlight-ui/icon": "^4.1.6",
"@highlight-ui/tooltip": "^3.3.28",
"@highlight-ui/typography": "^5.2.15",
"@highlight-ui/utils-commons": "^2.3.5",
"@highlight-ui/utils-hooks": "^3.2.18",
"@highlight-ui/utils-portal-manager": "^3.1.7",
"@highlight-ui/button": "^11.5.8",
"@highlight-ui/icon": "^4.1.7",
"@highlight-ui/tooltip": "^3.3.29",
"@highlight-ui/typography": "^5.2.16",
"@highlight-ui/utils-commons": "^2.3.6",
"@highlight-ui/utils-hooks": "^3.2.19",
"@highlight-ui/utils-portal-manager": "^3.1.8",
"@mantine/hooks": "5.10.2",
"@use-it/event-listener": "^0.1.6",
"@use-it/event-listener": "~0.1.6",
"lodash.invoke": "4.5.2"
},
"peerDependencies": {
"classnames": "^2.3.1",
"react": "^17.0.2"
"classnames": "~2.3.1",
"react": "17.0.2"
},
"gitHead": "a540be61e44ed5ba75c7f5788e35af65cca4f188"
"gitHead": "3758f5f987510edb100f5a22ebe829b7cee4573f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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