UNPKG

@kelvininc/ui-components

Version:
1,351 lines (1,246 loc) 101 kB
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, F as Fragment } from './index-D-JVwta2.js'; import { E as EIconName } from './icon.types-SVedE_O8.js'; import { o as offset, f as flip, s as size } from './floating-ui.dom-CJTtq_QG.js'; import { b as EValidationState, a as EInputFieldType, E as EIllustrationName, c as EToggleState } from './absolute-time-picker-dropdown.types-CojoW2Y2.js'; import { a as EComponentSize } from './components-DzZLIMy0.js'; import './lib-config-DwRzddFC.js'; import { E as EActionButtonType } from './action-button.types-DVds6a5Z.js'; import './summary-card.types-BcMhjKoS.js'; import './toaster.types-vhHhaF4Q.js'; import './tree-item.types-CBuzk8fR.js'; import './tag-alarm.types-DHk26cGe.js'; import './wizard.types-7ioMFMb5.js'; import { a as DEFAULT_DROPDOWN_Z_INDEX } from './config-CJMopqu5.js'; import { m as merge } from './merge-uvn7Q6Uf.js'; import { b as baseKeys, g as getTag, i as isEmpty } from './isEmpty-BAGi1PqI.js'; import { i as isNil } from './isNil-DjSNdVAB.js'; import { d as arrayLikeKeys, g as getPrototype, k as keysIn, U as Uint8Array, S as Stack, e as isIndex, f as assignValue } from './_baseMerge-CgbDsiSj.js'; import { a as arrayPush, S as SetCache, c as cacheHas, s as setToArray } from './_setToArray-Dlhbjm-M.js'; import { S as Symbol, a as isObjectLike, i as isObject } from './isObject-Dkd2PDJ-.js'; import { e as eq } from './_MapCache-nTWrGhJJ.js'; import { i as isArray } from './_Map-B6Xd0L4K.js'; import { b as isArrayLike, c as isBuffer, d as isTypedArray, e as isLength, i as isArguments } from './_Set-B7Zkvu4X.js'; import { c as castPath, t as toKey, i as isKey, g as get, b as baseGet, a as arrayMap } from './get-CQN4erwW.js'; import { i as identity } from './identity-CK4jS9_E.js'; import { c as getNextHightlightableOption, d as getPreviousHightlightableOption, e as buildAllOptionsSelected, f as getSelectableOptions, b as getFlattenSelectOptions } from './select.helper-D_nHTFPl.js'; import './date.helper-D0D1COyq.js'; import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js'; import { g as getClassMap } from './css-class.helper-DKOxy79t.js'; import { d as debounce, t as throttle } from './throttle-CI91gV45.js'; import './isSymbol-CfrylQep.js'; import './string.helper-BMAMF_sW.js'; /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /** Used for built-in method references. */ var objectProto$2 = Object.prototype; /** Built-in value references. */ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols$1 = Object.getOwnPropertySymbols; /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols$1(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2; /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Check that cyclic values are equal. var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2; /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]'; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG$2; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG$3 = 1; /** Used for built-in method references. */ var objectProto$1 = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty$1 = objectProto$1.hasOwnProperty; /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) { return false; } } // Check that cyclic values are equal. var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG$2 = 1; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', objectTag = '[object Object]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2; /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; var result; if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result )) { return false; } } } return true; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new negated function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = baseIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } /** * The opposite of `_.pickBy`; this method creates an object composed of * the own and inherited enumerable string keyed properties of `object` that * `predicate` doesn't return truthy for. The predicate is invoked with two * arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { return pickBy(object, negate(baseIteratee(predicate))); } const checkboxCss = ":host{--checkbox-size:16px;--checkbox-icon-size:16px;width:var(--checkbox-size);height:var(--checkbox-size);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;user-select:none}:host kv-icon{--icon-width:var(--checkbox-icon-size);--icon-height:var(--checkbox-icon-size)}:host(:hover:not(.disabled)){opacity:0.8}:host(.disabled){opacity:0.4;cursor:not-allowed}"; const KvCheckbox = class { constructor(hostRef) { registerInstance(this, hostRef); this.clickCheckbox = createEvent(this, "clickCheckbox", 7); /** @inheritdoc */ this.checked = false; /** @inheritdoc */ this.disabled = false; /** @inheritdoc */ this.indeterminate = false; this.getIconName = () => { if (this.indeterminate) { return EIconName.IndeterminateState; } if (this.checked) { return EIconName.CheckState; } return EIconName.UncheckState; }; this.onClick = () => { if (!this.disabled) { this.clickCheckbox.emit(); } }; } render() { return (h(Host, { key: '2b2b58401e21f92a5512831b442141d7f441f195', onClick: this.onClick, class: { disabled: this.disabled } }, h("kv-icon", { key: '86c54b844519ccb8e64d0b966c2fc84f49e7ed46', name: this.getIconName(), part: "icon" }))); } }; KvCheckbox.style = checkboxCss; const DEFAULT_INPUT_CONFIG = { placeholder: 'Select an option', type: EInputFieldType.Text, state: EValidationState.None, size: EComponentSize.Large }; const DEFAULT_DROPDOWN_OFFSET = 8; const DEFAULT_DROPDOWN_POSITION_CONFIG = { placement: 'bottom', middleware: [ offset(DEFAULT_DROPDOWN_OFFSET), flip({ padding: 16, fallbackPlacements: ['top-end', 'bottom-end', 'top-start', 'bottom-start'] }), size({ apply({ rects, elements }) { Object.assign(elements.floating.style, { width: `${rects.reference.width}px` }); } }) ] }; const dropdownCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}.dropdown-container{user-select:none}.dropdown-container kv-text-field{--action-icon-size:20px}"; const KvDropdown = class { constructor(hostRef) { registerInstance(this, hostRef); this.openStateChange = createEvent(this, "openStateChange", 3); this.clickOutside = createEvent(this, "clickOutside", 7); /** @inheritdoc */ this.inputConfig = {}; /** @inheritdoc */ this.isOpen = false; /** @inheritdoc */ this.options = DEFAULT_DROPDOWN_POSITION_CONFIG; /** @inheritdoc */ this.actionElement = null; /** @inheritdoc */ this.listElement = null; /** @inheritdoc */ this.disabled = false; /** @inheritdoc */ this.clickOutsideClose = true; /** @inheritdoc */ this.zIndex = DEFAULT_DROPDOWN_Z_INDEX; this.getInputConfig = () => { return merge({}, DEFAULT_INPUT_CONFIG, { disabled: this.disabled }, this.inputConfig); }; } /** Toggles the dropdown open state */ async onToggleOpenState() { if (!this.disabled) { this.openStateChange.emit(!this.isOpen); } } componentDidRender() { var _a; this._actionElement = (_a = this.actionElement) !== null && _a !== void 0 ? _a : this.el.querySelector('#dropdown-input').shadowRoot.querySelector('#dropdown-input'); } render() { return (h(Host, { key: '3d7e19268935ae45c7180a634e6f5ce8d1a7611a' }, h("div", { key: 'd718a943fbdca2ed3929550437a31e571c5b4836', class: "dropdown-container" }, h("kv-dropdown-base", { key: '7c9daf293f7f79f153add1f2f04a8e08f24259b0', isOpen: this.isOpen, options: this.options, actionElement: this._actionElement, listElement: this.listElement, clickOutsideClose: this.clickOutsideClose, zIndex: this.zIndex }, h("slot", { key: 'ff77d8996a68418af2bf03ed6dc65305d391dd76', name: "dropdown-action", slot: "action" }, h("div", { key: '2600cc143459895cf4ccdf99540ad3f6e7118a14' }, h("kv-text-field", Object.assign({ key: '9627f5d413ebef6abc7177a6d4ec00dc7a6982bf' }, this.getInputConfig(), { id: "dropdown-input", forcedFocus: this.isOpen, onFieldClick: this.onToggleOpenState.bind(this), inputReadonly: true, actionIcon: this.isOpen ? EIconName.ArrowDropUp : EIconName.ArrowDropDown }), h("slot", { key: 'c927d5d65699389e20e6b2ec461af4f68cfaedf3', name: "right-slot", slot: "right-slot" }), h("slot", { key: '8ab71ee8dbcb935a1b44c7eff7eb1bb3912033dc', name: "left-slot", slot: "left-slot" })))), h("div", { key: '45b410efd27534b722ff0734fba601803646e119', slot: "list" }, h("div", { key: 'a6b03a114ee472af0b0a72cc2c1aaaccde940101', id: "select", class: "select" }, h("slot", { key: 'a233e261b1e36a198dacdca423b99151cc9c1804' }))))))); } get el() { return getElement(this); } }; KvDropdown.style = dropdownCss; const illustrationCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}:host{--illustration-height:200px;--illustration-width:200px;max-width:100%;max-height:100%;display:flex}"; const KvIllustration = class { constructor(hostRef) { registerInstance(this, hostRef); /** @inheritdoc */ this.customClass = ''; } render() { const Tag = this.name; return (h(Host, { key: '47909f5918ae32f8b878b411e1832bd82b2099ca' }, h(Tag, { key: '16901b4c761f86ba8ce3bea806d097c6bfbaa588', customClass: this.customClass }))); } }; KvIllustration.style = illustrationCss; const illustrationMessageCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}:host{--image-width:60px;--image-height:auto;--header-color:var(--kv-neutral-2, #e5e5e5);--description-color:var(--kv-neutral-4, #bebebe)}.illustration-message{display:flex;flex-direction:column;justify-content:center;align-items:center}.image{margin-bottom:var(--kv-spacing-3x, 12px);--illustration-width:var(--image-width);--illustration-height:var(--image-height)}.header{color:var(--header-color);text-align:center;font-family:var(--kv-primary-font, \"proxima-nova\", sans-serif, \"Arial\");font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;line-height:21px;letter-spacing:normal;text-transform:none}.description{color:var(--description-color);text-align:center;font-family:var(--kv-primary-font, \"proxima-nova\", sans-serif, \"Arial\");font-size:12px;font-weight:400;font-stretch:normal;font-style:normal;line-height:18px;letter-spacing:normal;text-transform:none;white-space:break-spaces;margin-top:var(--kv-spacing, 4px)}"; const KvIllustrationMessage = class { constructor(hostRef) { registerInstance(this, hostRef); } render() { return (h("div", { key: '2769430393c3c0f35ca876a563282059278fa8e6', class: "illustration-message" }, h("kv-illustration", { key: '3dd0de941aae90af94c32c7c3df806a54e69b6bc', name: this.illustration, class: "image", part: "illustration" }), h("div", { key: '87fec4adca889bf9c2056b039fb214a21f55bbde', class: "header", part: "header" }, this.header), this.description && (h("div", { key: 'd9c7958fb1ef327597062ef7e79b1359599a4449', class: "description", part: "description" }, this.description)))); } }; KvIllustrationMessage.style = illustrationMessageCss; const KvSearch = class { constructor(hostRef) { registerInstance(this, hostRef); this.textChange = createEvent(this, "textChange", 7); this.textFieldBlur = createEvent(this, "textFieldBlur", 7); this.clickResetButton = createEvent(this, "clickResetButton", 7); this.rightActionClick = createEvent(this, "rightActionClick", 7); this.fieldClick = createEvent(this, "fieldClick", 7); /** @inheritdoc */ this.type = EInputFieldType.Text; /** @inheritdoc */ this.placeholder = 'Search'; /** @inheritdoc */ this.size = EComponentSize.Large; /** @inheritdoc */ this.inputDisabled = false; /** @inheritdoc */ this.inputRequired = false; /** @inheritdoc */ this.loading = false; /** @inheritdoc */ this.state = EValidationState.None; /** @inheritdoc */ this.inputReadonly = false; /** @inheritdoc */ this.helpText = []; /** @inheritdoc */ this.forcedFocus = false; /** @inheritdoc */ this.value = ''; /** @inheritdoc */ this.useInputMask = false; /** @inheritdoc */ this.inputMaskRegex = ''; this.onTextChange = (event) => { event.stopPropagation(); this.textChange.emit(event.detail); }; this.onResetClick = (event) => { event.stopPropagation(); this.clickResetButton.emit(event.detail); this.textChange.emit(); }; } /** Focus input */ async focusInput() { this.inputRef.focusInput(); } render() { const shouldShowResetIcon = !isEmpty(this.value) && !this.inputDisabled; return (h(Host, { key: '695c53a55e9f86e9354df2903497a6718f55c548' }, h("kv-text-field", { key: '09bf7c96d9f826f14c1de065ab60431d209c4595', ref: el => (this.inputRef = el), actionIcon: shouldShowResetIcon ? EIconName.Close : undefined, onTextChange: this.onTextChange, onRightActionClick: this.onResetClick, type: this.type, label: this.label, examples: this.examples, icon: EIconName.Search, inputName: this.inputName, placeholder: this.placeholder, maxLength: this.maxLength, minLength: this.minLength, max: this.max, min: this.min, step: this.step, size: this.size, inputDisabled: this.inputDisabled, inputRequired: this.inputRequired, loading: this.loading, state: this.state, inputReadonly: this.inputReadonly, helpText: this.helpText, forcedFocus: this.forcedFocus, tooltipConfig: this.tooltipConfig, value: this.value, useInputMask: this.useInputMask, inputMaskRegex: this.inputMaskRegex, fitContent: false }))); } }; const SELECT_ALL_LABEL = 'Select all'; const CLEAR_SELECTION_LABEL = 'Clear all'; const isElementVisible = (element, selector) => { const foundElement = element.querySelector(selector); return !isNil(foundElement) && foundElement.clientHeight > 0 && foundElement.clientWidth > 0; }; const selectCss = "@charset \"UTF-8\";@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}:host{--select-max-height:400px;--select-min-height:auto;--select-max-width:auto;--select-min-width:max-content;--select-background-color:var(--kv-neutral-7, #2a2a2a);--select-border:1px solid var(--kv-neutral-6, #3f3f3f);--select-inner-border:1px solid var(--kv-neutral-6, #3f3f3f);--select-border-radius:var(--kv-spacing, 4px)}.select-container{max-width:var(--select-max-width);min-width:var(--select-min-width);border:var(--select-border);border-radius:var(--select-border-radius);overflow:hidden;background-color:var(--select-background-color)}.select-options-container{max-height:var(--select-max-height);min-height:var(--select-min-height)}.select-options-container ::slotted(kv-virtualized-list){--virtualized-list-max-height:calc(var(--select-max-height) - var(--kv-spacing-3x, 12px) * 2);--virtualized-list-min-height:var(--select-min-height)}.select-header-container{display:flex;flex-direction:column;gap:var(--kv-spacing-3x, 12px);padding:var(--kv-spacing-3x, 12px) var(--kv-spacing-4x, 16px);border-bottom:var(--select-inner-border)}.search-footer{display:flex;flex-direction:row;justify-content:space-between;gap:var(--kv-spacing-3x, 12px)}.search-footer .footer-actions{font-family:var(--kv-primary-font, \"proxima-nova\", sans-serif, \"Arial\");font-size:12px;font-weight:400;font-stretch:normal;font-style:normal;line-height:18px;letter-spacing:normal;text-transform:none;display:flex;flex-direction:row;align-items:center;gap:calc(var(--kv-spacing-2x, 8px));color:var(--kv-neutral-4, #bebebe)}.search-footer .action{user-select:none;cursor:pointer;position:relative;text-wrap:nowrap}.search-footer .action--disabled{pointer-events:none;color:var(--kv-neutral-5, #707070)}.search-footer .divider{height:12px;width:1px;background-color:var(--kv-neutral-6, #3f3f3f)}"; const KvSelect = class { constructor(hostRef) { registerInstance(this, hostRef); this.searchChange = createEvent(this, "searchChange", 7); this.clearSelection = createEvent(this, "clearSelection", 7); this.selectAll = createEvent(this, "selectAll", 7); /** @inheritdoc */ this.searchable = false; /** @inheritdoc */ this.selectionClearable = false; /** @inheritdoc */ this.clearSelectionLabel = CLEAR_SELECTION_LABEL; /** @inheritdoc */ this.selectionAll = false; /** @inheritdoc */ this.selectAllLabel = SELECT_ALL_LABEL; this.onSearchChange = (event) => { event.stopPropagation(); this.searchChange.emit(event.detail); }; this.onClearSelection = () => { this.clearSelection.emit(); }; this.onSelectAll = () => { this.selectAll.emit(); }; } /** Focuses the search text field */ async focusSearch() { var _a; (_a = this.searchRef) === null || _a === void 0 ? void 0 : _a.focusInput(); } get customStyle() { return omitBy({ '--select-max-height': this.maxHeight, '--select-min-height': this.minHeight, '--select-max-width': this.maxWidth, '--select-min-width': this.minWidth }, isNil); } get hasActionsSlot() { return isElementVisible(this.el, '[slot="select-header-actions"]'); } get hasLabelSlot() { return isElementVisible(this.el, '[slot="select-header-label"]'); } render() { const hasLabels = this.selectionAll || this.selectionClearable || this.hasActionsSlot || this.hasLabelSlot; const hasHeader = this.searchable || hasLabels; return (h(Host, { key: '10b617e5029cfb5e8011c8571a9fd729009905d2', style: this.customStyle }, h("div", { key: 'f9dd9673d31faa686ab711a0dc0a31b8c919ae7a', class: "select-container", part: "select" }, hasHeader && (h("div", { key: '440ac25a7ec08a5a96e98746c405359c5bf4613f', class: "select-header-container" }, this.searchable && (h("kv-search", { key: '18d2e4e748ba5d12f657d03e655034f456d4a3a8', ref: element => (this.searchRef = element), size: EComponentSize.Small, value: this.searchValue, placeholder: this.searchPlaceholder, onTextChange: this.onSearchChange })), hasLabels && (h("div", { key: 'd12adbbb46e86104463a3ef17e3845292caa31db', class: "search-footer" }, h("div", { key: '116af362d27d9309e93d823d6cd83d9012cc9e4c', class: "footer-actions" }, this.selectionAll && (h("div", { key: '5542e17308d8262c4ca474cd4754bee7d76a06bc', class: { 'action': true, 'action--disabled': !this.selectionAllEnabled }, onClick: this.onSelectAll }, this.selectAllLabel)), this.selectionClearable && (h(Fragment, { key: '93919f533503e8ce9083fefacf4f03e219599dc9' }, this.selectionAll && h("div", { key: '43fe0acaee60048cffb8d3c53ed98f78f73154a8', class: "divider" }), h("div", { key: 'fb57dd7d02e729bf7223ca9c952486c37771c167', class: { 'action': true, 'action--disabled': !this.selectionClearEnabled }, onClick: this.onClearSelection }, this.clearSelectionLabel), this.hasActionsSlot && h("div", { key: 'b55d7ba874248959de2504f97b3e1f1557d76655', class: "divider" }))), h("slot", { key: 'ac10224687f331395f10ed0969b613fe90a4af67', name: "select-header-actions" })), h("slot", { key: 'b27e47ce27ff034ce266e2c42855cc384b55dd24', name: "select-header-label" }))))), h("div", { key: 'efe2c477a174106fcc5260d4b1bf8389f6659a69', class: "select-options-container" }, h("slot", { key: '89ca7b3abad94d1639ce78271b151b63d56dfb84' })), h("slot", { key: 'f2705fe488d52cc8fe923141bbbb0203a87b0fdc', name: "select-footer" })))); } get el() { return getElement(this); } }; KvSelect.style = selectCss; const selectCreateOptionCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}.select-create-option{display:flex;align-items:flex-start;gap:var(--kv-spacing-3x, 12px)}.form{flex:1;overflow:auto}.actions{display:flex;align-items:center;gap:var(--kv-spacing, 4px)}"; const KvSelectCreateOption = class { constructor(hostRef) { registerInstance(this, hostRef); this.clickCreate = createEvent(this, "clickCreate", 7); this.clickCancel = createEvent(this, "clickCancel", 7); this.valueChanged = createEvent(this, "valueChanged", 7); /** @inheritdoc */ this.value = ''; /** @inheritdoc */ this.disabled = false; /** @inheritdoc */ this.size = EComponentSize.Small; /** @inheritdoc */ this.inputConfig = {}; this.onKeyPress = (event) => { if (event.key === 'Enter') { this.onCreate(); } }; this.onCreate = () => { if (!this.canSubmit) { return; } this.clickCreate.emit(); }; this.onCancel = () => { this.clickCancel.emit(); }; } /** Focus the input */ async focusInput() { this.input.focus(); } /** B