@idea-fragments/react-components-zendesk 0.1.82 → 0.1.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendars.js +1 -1
- package/dist/chats.js +1 -1
- package/dist/forms.js +1 -1
- package/dist/layouts.js +1 -1
- package/dist/loaders.js +1 -1
- package/dist/tables.js +1 -1
- package/dist/tooltips.js +172 -32
- package/dist/tooltips.js.map +1 -1
- package/dist/types/tooltips.d.ts +38 -4
- package/dist/utilities.js +1 -1
- package/package.json +1 -1
package/dist/tooltips.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,'__esModule',{value:true});var React=require('react');var reactDom=require('react-dom');var styled=require('styled-components');var jsxRuntime=require('react/jsx-runtime');var MIcon=require('@mdi/react');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e};}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k];}});}});}n["default"]=e;return Object.freeze(n);}var React__namespace=/*#__PURE__*/_interopNamespace(React);var React__default=/*#__PURE__*/_interopDefaultLegacy(React);var styled__default=/*#__PURE__*/_interopDefaultLegacy(styled);var MIcon__default=/*#__PURE__*/_interopDefaultLegacy(MIcon);/******************************************************************************
|
|
1
|
+
Object.defineProperty(exports,'__esModule',{value:true});var React=require('react');var reactDom=require('react-dom');var styled=require('styled-components');var jsxRuntime=require('react/jsx-runtime');var MIcon=require('@mdi/react');var js=require('@mdi/js');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e};}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k];}});}});}n["default"]=e;return Object.freeze(n);}var React__namespace=/*#__PURE__*/_interopNamespace(React);var React__default=/*#__PURE__*/_interopDefaultLegacy(React);var styled__default=/*#__PURE__*/_interopDefaultLegacy(styled);var MIcon__default=/*#__PURE__*/_interopDefaultLegacy(MIcon);/******************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,7 +11,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var __assign=function(){__assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p];}return t;};return __assign.apply(this,arguments);};function __rest(s,e){var t={};for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++){if(e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i]))t[p[i]]=s[p[i]];}return t;}function __makeTemplateObject(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw});}else{cooked.raw=raw;}return cooked;}typeof SuppressedError==="function"?SuppressedError:function(error,suppressed,message){var e=new Error(message);return e.name="SuppressedError",e.error=error,e.suppressed=suppressed,e;};var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global!=='undefined'?global:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}var propTypes={exports:{}};var reactIs={exports:{}};var reactIs_production_min={};/** @license React v16.13.1
|
|
14
|
+
***************************************************************************** */var __assign=function(){__assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p];}return t;};return __assign.apply(this,arguments);};function __rest(s,e){var t={};for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++){if(e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i]))t[p[i]]=s[p[i]];}return t;}function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}step((generator=generator.apply(thisArg,_arguments||[])).next());});}function __generator(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break;}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;}if(t[2])_.ops.pop();_.trys.pop();continue;}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}}function __read(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-->0)&&!(r=i.next()).done)ar.push(r.value);}catch(error){e={error:error};}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i);}finally{if(e)throw e.error;}}return ar;}function __makeTemplateObject(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw});}else{cooked.raw=raw;}return cooked;}typeof SuppressedError==="function"?SuppressedError:function(error,suppressed,message){var e=new Error(message);return e.name="SuppressedError",e.error=error,e.suppressed=suppressed,e;};var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global!=='undefined'?global:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}var propTypes={exports:{}};var reactIs={exports:{}};var reactIs_production_min={};/** @license React v16.13.1
|
|
15
15
|
* react-is.production.min.js
|
|
16
16
|
*
|
|
17
17
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -241,16 +241,16 @@ var prefixId=function(id,prefix,name){var uid=prefix+id;return String(name?name(
|
|
|
241
241
|
*
|
|
242
242
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
243
243
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
244
|
-
*/function composeEventHandlers(){for(var _len=arguments.length,fns=new Array(_len),_key=0;_key<_len;_key++){fns[_key]=arguments[_key];}return function(event){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}return fns.some(fn=>{fn&&fn(event,...args);return event&&event.defaultPrevented;});};}function getControlledValue(){for(var _len=arguments.length,values=new Array(_len),_key=0;_key<_len;_key++){values[_key]=arguments[_key];}for(const value of values){if(value!==undefined){return value;}}return undefined;}const KEY_CODES={ALT:18,ASTERISK:170,BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38};var DocumentPosition;(function(DocumentPosition){DocumentPosition[DocumentPosition["DISCONNECTED"]=1]="DISCONNECTED";DocumentPosition[DocumentPosition["PRECEDING"]=2]="PRECEDING";DocumentPosition[DocumentPosition["FOLLOWING"]=4]="FOLLOWING";DocumentPosition[DocumentPosition["CONTAINS"]=8]="CONTAINS";DocumentPosition[DocumentPosition["CONTAINED_BY"]=16]="CONTAINED_BY";DocumentPosition[DocumentPosition["IMPLEMENTATION_SPECIFIC"]=32]="IMPLEMENTATION_SPECIFIC";})(DocumentPosition||(DocumentPosition={}));/**
|
|
244
|
+
*/function composeEventHandlers(){for(var _len=arguments.length,fns=new Array(_len),_key=0;_key<_len;_key++){fns[_key]=arguments[_key];}return function(event){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}return fns.some(fn=>{fn&&fn(event,...args);return event&&event.defaultPrevented;});};}function getControlledValue(){for(var _len=arguments.length,values=new Array(_len),_key=0;_key<_len;_key++){values[_key]=arguments[_key];}for(const value of values){if(value!==undefined){return value;}}return undefined;}const KEY_CODES={ALT:18,ASTERISK:170,BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38};const KEYS={ALT:'Alt',ASTERISK:'*',BACKSPACE:'Backspace',COMMA:',',DELETE:'Delete',DOWN:'ArrowDown',END:'End',ENTER:'Enter',ESCAPE:'Escape',HOME:'Home',LEFT:'ArrowLeft',NUMPAD_ADD:'Add',NUMPAD_DECIMAL:'Decimal',NUMPAD_DIVIDE:'Divide',NUMPAD_ENTER:'Enter',NUMPAD_MULTIPLY:'Multiply',NUMPAD_SUBTRACT:'Subtract',PAGE_DOWN:'PageDown',PAGE_UP:'PageUp',PERIOD:'.',RIGHT:'ArrowRight',SHIFT:'Shift',SPACE:' ',TAB:'Tab',UNIDENTIFIED:'Unidentified',UP:'ArrowUp'};var DocumentPosition;(function(DocumentPosition){DocumentPosition[DocumentPosition["DISCONNECTED"]=1]="DISCONNECTED";DocumentPosition[DocumentPosition["PRECEDING"]=2]="PRECEDING";DocumentPosition[DocumentPosition["FOLLOWING"]=4]="FOLLOWING";DocumentPosition[DocumentPosition["CONTAINS"]=8]="CONTAINS";DocumentPosition[DocumentPosition["CONTAINED_BY"]=16]="CONTAINED_BY";DocumentPosition[DocumentPosition["IMPLEMENTATION_SPECIFIC"]=32]="IMPLEMENTATION_SPECIFIC";})(DocumentPosition||(DocumentPosition={}));/**
|
|
245
245
|
* Copyright Zendesk, Inc.
|
|
246
246
|
*
|
|
247
247
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
248
248
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
249
|
-
*/const useTooltip=function(_temp){let{delayMilliseconds=500,id,isVisible}=_temp===void 0?{}:_temp;const[visibility,setVisibility]=React.useState(isVisible);const seed=useUIDSeed();const _id=React.useMemo(()=>id||seed(`tooltip_${'1.0.10'}`),[id,seed]);const isMounted=React.useRef(false);const openTooltipTimeoutId=React.useRef();const closeTooltipTimeoutId=React.useRef();const openTooltip=function(delayMs){if(delayMs===void 0){delayMs=delayMilliseconds;}clearTimeout(closeTooltipTimeoutId.current);const timerId=setTimeout(()=>{if(isMounted.current){setVisibility(true);}},delayMs);openTooltipTimeoutId.current=Number(timerId);};const closeTooltip=function(delayMs){if(delayMs===void 0){delayMs=delayMilliseconds;}clearTimeout(openTooltipTimeoutId.current);const timerId=setTimeout(()=>{if(isMounted.current){setVisibility(false);}},delayMs);closeTooltipTimeoutId.current=Number(timerId);};React.useEffect(()=>{isMounted.current=true;return()=>{isMounted.current=false;};},[]);React.useEffect(()=>{return()=>{clearTimeout(openTooltipTimeoutId.current);clearTimeout(closeTooltipTimeoutId.current);};},[closeTooltipTimeoutId,openTooltipTimeoutId]);const getTriggerProps=function(_temp2){let{tabIndex=0,onMouseEnter,onMouseLeave,onFocus,onBlur,onKeyDown,...other}=_temp2===void 0?{}:_temp2;return{tabIndex,onMouseEnter:composeEventHandlers(onMouseEnter,()=>openTooltip()),onMouseLeave:composeEventHandlers(onMouseLeave,()=>closeTooltip()),onFocus:composeEventHandlers(onFocus,()=>openTooltip()),onBlur:composeEventHandlers(onBlur,()=>closeTooltip(0)),onKeyDown:composeEventHandlers(onKeyDown,event=>{if(event.keyCode===KEY_CODES.ESCAPE&&visibility){closeTooltip(0);}}),'aria-describedby':_id,'data-garden-container-id':'containers.tooltip','data-garden-container-version':'1.0.10',...other};};const getTooltipProps=function(_temp3){let{role='tooltip',onMouseEnter,onMouseLeave,...other}=_temp3===void 0?{}:_temp3;return{role,onMouseEnter:composeEventHandlers(onMouseEnter,()=>openTooltip()),onMouseLeave:composeEventHandlers(onMouseLeave,()=>closeTooltip()),'aria-hidden':!visibility,id:_id,...other};};return{isVisible:visibility,getTooltipProps,getTriggerProps,openTooltip,closeTooltip};};({children:propTypes.exports.func,render:propTypes.exports.func,delayMilliseconds:propTypes.exports.number,isVisible:propTypes.exports.bool});function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends$
|
|
249
|
+
*/const useTooltip=function(_temp){let{delayMilliseconds=500,id,isVisible}=_temp===void 0?{}:_temp;const[visibility,setVisibility]=React.useState(isVisible);const seed=useUIDSeed();const _id=React.useMemo(()=>id||seed(`tooltip_${'1.0.10'}`),[id,seed]);const isMounted=React.useRef(false);const openTooltipTimeoutId=React.useRef();const closeTooltipTimeoutId=React.useRef();const openTooltip=function(delayMs){if(delayMs===void 0){delayMs=delayMilliseconds;}clearTimeout(closeTooltipTimeoutId.current);const timerId=setTimeout(()=>{if(isMounted.current){setVisibility(true);}},delayMs);openTooltipTimeoutId.current=Number(timerId);};const closeTooltip=function(delayMs){if(delayMs===void 0){delayMs=delayMilliseconds;}clearTimeout(openTooltipTimeoutId.current);const timerId=setTimeout(()=>{if(isMounted.current){setVisibility(false);}},delayMs);closeTooltipTimeoutId.current=Number(timerId);};React.useEffect(()=>{isMounted.current=true;return()=>{isMounted.current=false;};},[]);React.useEffect(()=>{return()=>{clearTimeout(openTooltipTimeoutId.current);clearTimeout(closeTooltipTimeoutId.current);};},[closeTooltipTimeoutId,openTooltipTimeoutId]);const getTriggerProps=function(_temp2){let{tabIndex=0,onMouseEnter,onMouseLeave,onFocus,onBlur,onKeyDown,...other}=_temp2===void 0?{}:_temp2;return{tabIndex,onMouseEnter:composeEventHandlers(onMouseEnter,()=>openTooltip()),onMouseLeave:composeEventHandlers(onMouseLeave,()=>closeTooltip()),onFocus:composeEventHandlers(onFocus,()=>openTooltip()),onBlur:composeEventHandlers(onBlur,()=>closeTooltip(0)),onKeyDown:composeEventHandlers(onKeyDown,event=>{if(event.keyCode===KEY_CODES.ESCAPE&&visibility){closeTooltip(0);}}),'aria-describedby':_id,'data-garden-container-id':'containers.tooltip','data-garden-container-version':'1.0.10',...other};};const getTooltipProps=function(_temp3){let{role='tooltip',onMouseEnter,onMouseLeave,...other}=_temp3===void 0?{}:_temp3;return{role,onMouseEnter:composeEventHandlers(onMouseEnter,()=>openTooltip()),onMouseLeave:composeEventHandlers(onMouseLeave,()=>closeTooltip()),'aria-hidden':!visibility,id:_id,...other};};return{isVisible:visibility,getTooltipProps,getTriggerProps,openTooltip,closeTooltip};};({children:propTypes.exports.func,render:propTypes.exports.func,delayMilliseconds:propTypes.exports.number,isVisible:propTypes.exports.bool});function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends$6(){_extends$6=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends$6.apply(this,arguments);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf(subClass,superClass);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var toStr$3=Object.prototype.toString;var isArguments$2=function isArguments(value){var str=toStr$3.call(value);var isArgs=str==='[object Arguments]';if(!isArgs){isArgs=str!=='[object Array]'&&value!==null&&typeof value==='object'&&typeof value.length==='number'&&value.length>=0&&toStr$3.call(value.callee)==='[object Function]';}return isArgs;};var implementation$9;var hasRequiredImplementation;function requireImplementation(){if(hasRequiredImplementation)return implementation$9;hasRequiredImplementation=1;var keysShim;if(!Object.keys){// modified from https://github.com/es-shims/es5-shim
|
|
250
250
|
var has=Object.prototype.hasOwnProperty;var toStr=Object.prototype.toString;var isArgs=isArguments$2;// eslint-disable-line global-require
|
|
251
|
-
var isEnumerable=Object.prototype.propertyIsEnumerable;var hasDontEnumBug=!isEnumerable.call({toString:null},'toString');var hasProtoEnumBug=isEnumerable.call(function(){},'prototype');var dontEnums=['toString','toLocaleString','valueOf','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','constructor'];var equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o;};var excludedKeys={$applicationCache:true,$console:true,$external:true,$frame:true,$frameElement:true,$frames:true,$innerHeight:true,$innerWidth:true,$onmozfullscreenchange:true,$onmozfullscreenerror:true,$outerHeight:true,$outerWidth:true,$pageXOffset:true,$pageYOffset:true,$parent:true,$scrollLeft:true,$scrollTop:true,$scrollX:true,$scrollY:true,$self:true,$webkitIndexedDB:true,$webkitStorageInfo:true,$window:true};var hasAutomationEqualityBug=function(){/* global window */if(typeof window==='undefined'){return false;}for(var k in window){try{if(!excludedKeys['$'+k]&&has.call(window,k)&&window[k]!==null&&typeof window[k]==='object'){try{equalsConstructorPrototype(window[k]);}catch(e){return true;}}}catch(e){return true;}}return false;}();var equalsConstructorPrototypeIfNotBuggy=function(o){/* global window */if(typeof window==='undefined'||!hasAutomationEqualityBug){return equalsConstructorPrototype(o);}try{return equalsConstructorPrototype(o);}catch(e){return false;}};keysShim=function keys(object){var isObject=object!==null&&typeof object==='object';var isFunction=toStr.call(object)==='[object Function]';var isArguments=isArgs(object);var isString=isObject&&toStr.call(object)==='[object String]';var theKeys=[];if(!isObject&&!isFunction&&!isArguments){throw new TypeError('Object.keys called on a non-object');}var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0)){for(var i=0;i<object.length;++i){theKeys.push(String(i));}}if(isArguments&&object.length>0){for(var j=0;j<object.length;++j){theKeys.push(String(j));}}else{for(var name in object){if(!(skipProto&&name==='prototype')&&has.call(object,name)){theKeys.push(String(name));}}}if(hasDontEnumBug){var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object);for(var k=0;k<dontEnums.length;++k){if(!(skipConstructor&&dontEnums[k]==='constructor')&&has.call(object,dontEnums[k])){theKeys.push(dontEnums[k]);}}}return theKeys;};}implementation$9=keysShim;return implementation$9;}var slice=Array.prototype.slice;var isArgs=isArguments$2;var origKeys=Object.keys;var keysShim=origKeys?function keys(o){return origKeys(o);}:requireImplementation();var originalKeys=Object.keys;keysShim.shim=function shimObjectKeys(){if(Object.keys){var keysWorksWithArguments=function(){// Safari 5.0 bug
|
|
251
|
+
var isEnumerable=Object.prototype.propertyIsEnumerable;var hasDontEnumBug=!isEnumerable.call({toString:null},'toString');var hasProtoEnumBug=isEnumerable.call(function(){},'prototype');var dontEnums=['toString','toLocaleString','valueOf','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','constructor'];var equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o;};var excludedKeys={$applicationCache:true,$console:true,$external:true,$frame:true,$frameElement:true,$frames:true,$innerHeight:true,$innerWidth:true,$onmozfullscreenchange:true,$onmozfullscreenerror:true,$outerHeight:true,$outerWidth:true,$pageXOffset:true,$pageYOffset:true,$parent:true,$scrollLeft:true,$scrollTop:true,$scrollX:true,$scrollY:true,$self:true,$webkitIndexedDB:true,$webkitStorageInfo:true,$window:true};var hasAutomationEqualityBug=function(){/* global window */if(typeof window==='undefined'){return false;}for(var k in window){try{if(!excludedKeys['$'+k]&&has.call(window,k)&&window[k]!==null&&typeof window[k]==='object'){try{equalsConstructorPrototype(window[k]);}catch(e){return true;}}}catch(e){return true;}}return false;}();var equalsConstructorPrototypeIfNotBuggy=function(o){/* global window */if(typeof window==='undefined'||!hasAutomationEqualityBug){return equalsConstructorPrototype(o);}try{return equalsConstructorPrototype(o);}catch(e){return false;}};keysShim=function keys(object){var isObject=object!==null&&typeof object==='object';var isFunction=toStr.call(object)==='[object Function]';var isArguments=isArgs(object);var isString=isObject&&toStr.call(object)==='[object String]';var theKeys=[];if(!isObject&&!isFunction&&!isArguments){throw new TypeError('Object.keys called on a non-object');}var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0)){for(var i=0;i<object.length;++i){theKeys.push(String(i));}}if(isArguments&&object.length>0){for(var j=0;j<object.length;++j){theKeys.push(String(j));}}else{for(var name in object){if(!(skipProto&&name==='prototype')&&has.call(object,name)){theKeys.push(String(name));}}}if(hasDontEnumBug){var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object);for(var k=0;k<dontEnums.length;++k){if(!(skipConstructor&&dontEnums[k]==='constructor')&&has.call(object,dontEnums[k])){theKeys.push(dontEnums[k]);}}}return theKeys;};}implementation$9=keysShim;return implementation$9;}var slice$1=Array.prototype.slice;var isArgs=isArguments$2;var origKeys=Object.keys;var keysShim=origKeys?function keys(o){return origKeys(o);}:requireImplementation();var originalKeys=Object.keys;keysShim.shim=function shimObjectKeys(){if(Object.keys){var keysWorksWithArguments=function(){// Safari 5.0 bug
|
|
252
252
|
var args=Object.keys(arguments);return args&&args.length===arguments.length;}(1,2);if(!keysWorksWithArguments){Object.keys=function keys(object){// eslint-disable-line func-name-matching
|
|
253
|
-
if(isArgs(object)){return originalKeys(slice.call(object));}return originalKeys(object);};}}else{Object.keys=keysShim;}return Object.keys||keysShim;};var objectKeys$1=keysShim;/** @type {import('./shams')} */ /* eslint complexity: [2, 18], max-statements: [2, 33] */var shams$1=function hasSymbols(){if(typeof Symbol!=='function'||typeof Object.getOwnPropertySymbols!=='function'){return false;}if(typeof Symbol.iterator==='symbol'){return true;}/** @type {{ [k in symbol]?: unknown }} */var obj={};var sym=Symbol('test');var symObj=Object(sym);if(typeof sym==='string'){return false;}if(Object.prototype.toString.call(sym)!=='[object Symbol]'){return false;}if(Object.prototype.toString.call(symObj)!=='[object Symbol]'){return false;}// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
253
|
+
if(isArgs(object)){return originalKeys(slice$1.call(object));}return originalKeys(object);};}}else{Object.keys=keysShim;}return Object.keys||keysShim;};var objectKeys$1=keysShim;/** @type {import('./shams')} */ /* eslint complexity: [2, 18], max-statements: [2, 33] */var shams$1=function hasSymbols(){if(typeof Symbol!=='function'||typeof Object.getOwnPropertySymbols!=='function'){return false;}if(typeof Symbol.iterator==='symbol'){return true;}/** @type {{ [k in symbol]?: unknown }} */var obj={};var sym=Symbol('test');var symObj=Object(sym);if(typeof sym==='string'){return false;}if(Object.prototype.toString.call(sym)!=='[object Symbol]'){return false;}if(Object.prototype.toString.call(symObj)!=='[object Symbol]'){return false;}// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
254
254
|
// if (sym instanceof Symbol) { return false; }
|
|
255
255
|
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
256
256
|
// if (!(symObj instanceof Symbol)) { return false; }
|
|
@@ -285,8 +285,8 @@ obj[property]=value;// eslint-disable-line no-param-reassign
|
|
|
285
285
|
}else{throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');}};var $defineProperty=esDefineProperty;var hasPropertyDescriptors$1=function hasPropertyDescriptors(){return!!$defineProperty;};hasPropertyDescriptors$1.hasArrayLengthDefineBug=function hasArrayLengthDefineBug(){// node v0.6 has a bug where array lengths can be Set but not Defined
|
|
286
286
|
if(!$defineProperty){return null;}try{return $defineProperty([],'length',{value:1}).length!==1;}catch(e){// In Firefox 4-22, defining length on an array throws an exception.
|
|
287
287
|
return true;}};var hasPropertyDescriptors_1=hasPropertyDescriptors$1;var GetIntrinsic$1=getIntrinsic;var define$3=defineDataProperty;var hasDescriptors=hasPropertyDescriptors_1();var gOPD$3=gopd$1;var $TypeError=type;var $floor=GetIntrinsic$1('%Math.floor%');/** @type {import('.')} */var setFunctionLength=function setFunctionLength(fn,length){if(typeof fn!=='function'){throw new $TypeError('`fn` is not a function');}if(typeof length!=='number'||length<0||length>0xFFFFFFFF||$floor(length)!==length){throw new $TypeError('`length` must be a positive 32-bit integer');}var loose=arguments.length>2&&!!arguments[2];var functionLengthIsConfigurable=true;var functionLengthIsWritable=true;if('length'in fn&&gOPD$3){var desc=gOPD$3(fn,'length');if(desc&&!desc.configurable){functionLengthIsConfigurable=false;}if(desc&&!desc.writable){functionLengthIsWritable=false;}}if(functionLengthIsConfigurable||functionLengthIsWritable||!loose){if(hasDescriptors){define$3(/** @type {Parameters<define>[0]} */fn,'length',length,true,true);}else{define$3(/** @type {Parameters<define>[0]} */fn,'length',length);}}return fn;};var bind=functionBind;var $apply=functionApply;var actualApply=actualApply$1;/** @type {import('./applyBind')} */var applyBind=function applyBind(){return actualApply(bind,$apply,arguments);};(function(module){var setFunctionLength$1=setFunctionLength;var $defineProperty=esDefineProperty;var callBindBasic=callBindApplyHelpers;var applyBind$1=applyBind;module.exports=function callBind(originalFunction){var func=callBindBasic(arguments);var adjustedLength=originalFunction.length-(arguments.length-1);return setFunctionLength$1(func,1+(adjustedLength>0?adjustedLength:0),true);};if($defineProperty){$defineProperty(module.exports,'apply',{value:applyBind$1});}else{module.exports.apply=applyBind$1;}})(callBind$3);var GetIntrinsic=getIntrinsic;var callBind$2=callBind$3.exports;var $indexOf=callBind$2(GetIntrinsic('String.prototype.indexOf'));var callBound$2=function callBoundIntrinsic(name,allowMissing){var intrinsic=GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBind$2(intrinsic);}return intrinsic;};var hasToStringTag$2=shams();var callBound$1=callBound$2;var $toString$1=callBound$1('Object.prototype.toString');var isStandardArguments=function isArguments(value){if(hasToStringTag$2&&value&&typeof value==='object'&&Symbol.toStringTag in value){return false;}return $toString$1(value)==='[object Arguments]';};var isLegacyArguments=function isArguments(value){if(isStandardArguments(value)){return true;}return value!==null&&typeof value==='object'&&typeof value.length==='number'&&value.length>=0&&$toString$1(value)!=='[object Array]'&&$toString$1(value.callee)==='[object Function]';};var supportsStandardArguments=function(){return isStandardArguments(arguments);}();isStandardArguments.isLegacyArguments=isLegacyArguments;// for tests
|
|
288
|
-
var isArguments$1=supportsStandardArguments?isStandardArguments:isLegacyArguments;var keys=objectKeys$1;var hasSymbols=typeof Symbol==='function'&&typeof Symbol('foo')==='symbol';var toStr$1=Object.prototype.toString;var concat=Array.prototype.concat;var origDefineProperty=Object.defineProperty;var isFunction$2=function(fn){return typeof fn==='function'&&toStr$1.call(fn)==='[object Function]';};var hasPropertyDescriptors=hasPropertyDescriptors_1();var supportsDescriptors$2=origDefineProperty&&hasPropertyDescriptors;var defineProperty$2=function(object,name,value,predicate){if(name in object){if(predicate===true){if(object[name]===value){return;}}else if(!isFunction$2(predicate)||!predicate()){return;}}if(supportsDescriptors$2){origDefineProperty(object,name,{configurable:true,enumerable:false,value:value,writable:true});}else{object[name]=value;// eslint-disable-line no-param-reassign
|
|
289
|
-
}};var defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{};var props=keys(map);if(hasSymbols){props=concat.call(props,Object.getOwnPropertySymbols(map));}for(var i=0;i<props.length;i+=1){defineProperty$2(object,props[i],map[props[i]],predicates[props[i]]);}};defineProperties.supportsDescriptors=!!supportsDescriptors$2;var defineProperties_1=defineProperties;var numberIsNaN=function(value){return value!==value;};var implementation$6=function is(a,b){if(a===0&&b===0){return 1/a===1/b;}if(a===b){return true;}if(numberIsNaN(a)&&numberIsNaN(b)){return true;}return false;};var implementation$5=implementation$6;var polyfill$2=function getPolyfill(){return typeof Object.is==='function'?Object.is:implementation$5;};var getPolyfill$3=polyfill$2;var define$2=defineProperties_1;var shim$3=function shimObjectIs(){var polyfill=getPolyfill$3();define$2(Object,{is:polyfill},{is:function testObjectIs(){return Object.is!==polyfill;}});return polyfill;};var define$1=defineProperties_1;var callBind$1=callBind$3.exports;var implementation$4=implementation$6;var getPolyfill$2=polyfill$2;var shim$2=shim$3;var polyfill$1=callBind$1(getPolyfill$2(),Object);define$1(polyfill$1,{getPolyfill:getPolyfill$2,implementation:implementation$4,shim:shim$2});var objectIs=polyfill$1;var callBound=callBound$2;var hasToStringTag$1=shams();var has;var $exec;var isRegexMarker;var badStringifier;if(hasToStringTag$1){has=callBound('Object.prototype.hasOwnProperty');$exec=callBound('RegExp.prototype.exec');isRegexMarker={};var throwRegexMarker=function(){throw isRegexMarker;};badStringifier={toString:throwRegexMarker,valueOf:throwRegexMarker};if(typeof Symbol.toPrimitive==='symbol'){badStringifier[Symbol.toPrimitive]=throwRegexMarker;}}var $toString=callBound('Object.prototype.toString');var gOPD$2=Object.getOwnPropertyDescriptor;var regexClass='[object RegExp]';var isRegex$1=hasToStringTag$1// eslint-disable-next-line consistent-return
|
|
288
|
+
var isArguments$1=supportsStandardArguments?isStandardArguments:isLegacyArguments;var keys=objectKeys$1;var hasSymbols=typeof Symbol==='function'&&typeof Symbol('foo')==='symbol';var toStr$1=Object.prototype.toString;var concat$1=Array.prototype.concat;var origDefineProperty=Object.defineProperty;var isFunction$2=function(fn){return typeof fn==='function'&&toStr$1.call(fn)==='[object Function]';};var hasPropertyDescriptors=hasPropertyDescriptors_1();var supportsDescriptors$2=origDefineProperty&&hasPropertyDescriptors;var defineProperty$2=function(object,name,value,predicate){if(name in object){if(predicate===true){if(object[name]===value){return;}}else if(!isFunction$2(predicate)||!predicate()){return;}}if(supportsDescriptors$2){origDefineProperty(object,name,{configurable:true,enumerable:false,value:value,writable:true});}else{object[name]=value;// eslint-disable-line no-param-reassign
|
|
289
|
+
}};var defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{};var props=keys(map);if(hasSymbols){props=concat$1.call(props,Object.getOwnPropertySymbols(map));}for(var i=0;i<props.length;i+=1){defineProperty$2(object,props[i],map[props[i]],predicates[props[i]]);}};defineProperties.supportsDescriptors=!!supportsDescriptors$2;var defineProperties_1=defineProperties;var numberIsNaN=function(value){return value!==value;};var implementation$6=function is(a,b){if(a===0&&b===0){return 1/a===1/b;}if(a===b){return true;}if(numberIsNaN(a)&&numberIsNaN(b)){return true;}return false;};var implementation$5=implementation$6;var polyfill$2=function getPolyfill(){return typeof Object.is==='function'?Object.is:implementation$5;};var getPolyfill$3=polyfill$2;var define$2=defineProperties_1;var shim$3=function shimObjectIs(){var polyfill=getPolyfill$3();define$2(Object,{is:polyfill},{is:function testObjectIs(){return Object.is!==polyfill;}});return polyfill;};var define$1=defineProperties_1;var callBind$1=callBind$3.exports;var implementation$4=implementation$6;var getPolyfill$2=polyfill$2;var shim$2=shim$3;var polyfill$1=callBind$1(getPolyfill$2(),Object);define$1(polyfill$1,{getPolyfill:getPolyfill$2,implementation:implementation$4,shim:shim$2});var objectIs=polyfill$1;var callBound=callBound$2;var hasToStringTag$1=shams();var has;var $exec;var isRegexMarker;var badStringifier;if(hasToStringTag$1){has=callBound('Object.prototype.hasOwnProperty');$exec=callBound('RegExp.prototype.exec');isRegexMarker={};var throwRegexMarker=function(){throw isRegexMarker;};badStringifier={toString:throwRegexMarker,valueOf:throwRegexMarker};if(typeof Symbol.toPrimitive==='symbol'){badStringifier[Symbol.toPrimitive]=throwRegexMarker;}}var $toString=callBound('Object.prototype.toString');var gOPD$2=Object.getOwnPropertyDescriptor;var regexClass='[object RegExp]';var isRegex$1=hasToStringTag$1// eslint-disable-next-line consistent-return
|
|
290
290
|
?function isRegex(value){if(!value||typeof value!=='object'){return false;}var descriptor=gOPD$2(value,'lastIndex');var hasLastIndexDataProperty=descriptor&&has(descriptor,'value');if(!hasLastIndexDataProperty){return false;}try{$exec(value,badStringifier);}catch(e){return e===isRegexMarker;}}:function isRegex(value){// In older browsers, typeof regex incorrectly returns 'function'
|
|
291
291
|
if(!value||typeof value!=='object'&&typeof value!=='function'){return false;}return $toString(value)===regexClass;};var implementation$3={exports:{}};var functionsHaveNames=function functionsHaveNames(){return typeof function f(){}.name==='string';};var gOPD$1=Object.getOwnPropertyDescriptor;if(gOPD$1){try{gOPD$1([],'length');}catch(e){// IE 8 has a broken gOPD
|
|
292
292
|
gOPD$1=null;}}functionsHaveNames.functionsHaveConfigurableNames=function functionsHaveConfigurableNames(){if(!functionsHaveNames()||!gOPD$1){return false;}var desc=gOPD$1(function(){},'name');return!!desc&&!!desc.configurable;};var $bind=Function.prototype.bind;functionsHaveNames.boundFunctionsHaveNames=function boundFunctionsHaveNames(){return functionsHaveNames()&&typeof $bind==='function'&&function f(){}.bind().name!=='';};var functionsHaveNames_1=functionsHaveNames;(function(module){var functionsHaveConfigurableNames=functionsHaveNames_1.functionsHaveConfigurableNames();var $Object=Object;var $TypeError=TypeError;module.exports=function flags(){if(this!=null&&this!==$Object(this)){throw new $TypeError('RegExp.prototype.flags getter called on non-object');}var result='';if(this.hasIndices){result+='d';}if(this.global){result+='g';}if(this.ignoreCase){result+='i';}if(this.multiline){result+='m';}if(this.dotAll){result+='s';}if(this.unicode){result+='u';}if(this.unicodeSets){result+='v';}if(this.sticky){result+='y';}return result;};if(functionsHaveConfigurableNames&&Object.defineProperty){Object.defineProperty(module.exports,'name',{value:'get flags'});}})(implementation$3);var implementation$2=implementation$3.exports;var supportsDescriptors$1=defineProperties_1.supportsDescriptors;var $gOPD=Object.getOwnPropertyDescriptor;var polyfill=function getPolyfill(){if(supportsDescriptors$1&&/a/mig.flags==='gim'){var descriptor=$gOPD(RegExp.prototype,'flags');if(descriptor&&typeof descriptor.get==='function'&&typeof RegExp.prototype.dotAll==='boolean'&&typeof RegExp.prototype.hasIndices==='boolean'){/* eslint getter-return: 0 */var calls='';var o={};Object.defineProperty(o,'hasIndices',{get:function(){calls+='d';}});Object.defineProperty(o,'sticky',{get:function(){calls+='y';}});if(calls==='dy'){return descriptor.get;}}}return implementation$2;};var supportsDescriptors=defineProperties_1.supportsDescriptors;var getPolyfill$1=polyfill;var gOPD=Object.getOwnPropertyDescriptor;var defineProperty$1=Object.defineProperty;var TypeErr=TypeError;var getProto=Object.getPrototypeOf;var regex=/a/;var shim$1=function shimFlags(){if(!supportsDescriptors||!getProto){throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');}var polyfill=getPolyfill$1();var proto=getProto(regex);var descriptor=gOPD(proto,'flags');if(!descriptor||descriptor.get!==polyfill){defineProperty$1(proto,'flags',{configurable:true,enumerable:false,get:polyfill});}return polyfill;};var define=defineProperties_1;var callBind=callBind$3.exports;var implementation$1=implementation$3.exports;var getPolyfill=polyfill;var shim=shim$1;var flagsBound=callBind(getPolyfill());define(flagsBound,{getPolyfill:getPolyfill,implementation:implementation$1,shim:shim});var regexp_prototype_flags=flagsBound;var getDay=Date.prototype.getDay;var tryDateObject=function tryDateGetDayCall(value){try{getDay.call(value);return true;}catch(e){return false;}};var toStr=Object.prototype.toString;var dateClass='[object Date]';var hasToStringTag=shams();var isDateObject=function isDateObject(value){if(typeof value!=='object'||value===null){return false;}return hasToStringTag?tryDateObject(value):toStr.call(value)===dateClass;};var objectKeys=objectKeys$1;var isArguments=isArguments$1;var is=objectIs;var isRegex=isRegex$1;var flags=regexp_prototype_flags;var isDate=isDateObject;var getTime=Date.prototype.getTime;function deepEqual(actual,expected,options){var opts=options||{};// 7.1. All identical values are equivalent, as determined by ===.
|
|
@@ -427,13 +427,13 @@ var element1root=getRoot(element1);if(element1root.host){return findCommonOffset
|
|
|
427
427
|
* Result of `getStyleComputedProperty` on the given element
|
|
428
428
|
* @param {String} axis - `x` or `y`
|
|
429
429
|
* @return {number} borders - The borders size of the given axis
|
|
430
|
-
*/function getBordersSize(styles,axis){var sideA=axis==='x'?'Left':'Top';var sideB=sideA==='Left'?'Right':'Bottom';return parseFloat(styles['border'+sideA+'Width'])+parseFloat(styles['border'+sideB+'Width']);}function getSize(axis,body,html,computedStyle){return Math.max(body['offset'+axis],body['scroll'+axis],html['client'+axis],html['offset'+axis],html['scroll'+axis],isIE(10)?parseInt(html['offset'+axis])+parseInt(computedStyle['margin'+(axis==='Height'?'Top':'Left')])+parseInt(computedStyle['margin'+(axis==='Height'?'Bottom':'Right')]):0);}function getWindowSizes(document){var body=document.body;var html=document.documentElement;var computedStyle=isIE(10)&&getComputedStyle(html);return{height:getSize('Height',body,html,computedStyle),width:getSize('Width',body,html,computedStyle)};}var classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}};var createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var defineProperty=function(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;};var _extends$
|
|
430
|
+
*/function getBordersSize(styles,axis){var sideA=axis==='x'?'Left':'Top';var sideB=sideA==='Left'?'Right':'Bottom';return parseFloat(styles['border'+sideA+'Width'])+parseFloat(styles['border'+sideB+'Width']);}function getSize(axis,body,html,computedStyle){return Math.max(body['offset'+axis],body['scroll'+axis],html['client'+axis],html['offset'+axis],html['scroll'+axis],isIE(10)?parseInt(html['offset'+axis])+parseInt(computedStyle['margin'+(axis==='Height'?'Top':'Left')])+parseInt(computedStyle['margin'+(axis==='Height'?'Bottom':'Right')]):0);}function getWindowSizes(document){var body=document.body;var html=document.documentElement;var computedStyle=isIE(10)&&getComputedStyle(html);return{height:getSize('Height',body,html,computedStyle),width:getSize('Width',body,html,computedStyle)};}var classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}};var createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var defineProperty=function(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;};var _extends$5=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};/**
|
|
431
431
|
* Given element offsets, generate an output similar to getBoundingClientRect
|
|
432
432
|
* @method
|
|
433
433
|
* @memberof Popper.Utils
|
|
434
434
|
* @argument {Object} offsets
|
|
435
435
|
* @returns {Object} ClientRect like output
|
|
436
|
-
*/function getClientRect(offsets){return _extends$
|
|
436
|
+
*/function getClientRect(offsets){return _extends$5({},offsets,{right:offsets.left+offsets.width,bottom:offsets.top+offsets.height});}/**
|
|
437
437
|
* Get bounding client rect of given element
|
|
438
438
|
* @method
|
|
439
439
|
* @memberof Popper.Utils
|
|
@@ -489,7 +489,7 @@ padding=padding||0;var isPaddingNumber=typeof padding==='number';boundaries.left
|
|
|
489
489
|
* @argument {Object} data - The data object generated by update method
|
|
490
490
|
* @argument {Object} options - Modifiers configuration and options
|
|
491
491
|
* @returns {Object} The data object, properly modified
|
|
492
|
-
*/function computeAutoPlacement(placement,refRect,popper,reference,boundariesElement){var padding=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;if(placement.indexOf('auto')===-1){return placement;}var boundaries=getBoundaries(popper,reference,padding,boundariesElement);var rects={top:{width:boundaries.width,height:refRect.top-boundaries.top},right:{width:boundaries.right-refRect.right,height:boundaries.height},bottom:{width:boundaries.width,height:boundaries.bottom-refRect.bottom},left:{width:refRect.left-boundaries.left,height:boundaries.height}};var sortedAreas=Object.keys(rects).map(function(key){return _extends$
|
|
492
|
+
*/function computeAutoPlacement(placement,refRect,popper,reference,boundariesElement){var padding=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;if(placement.indexOf('auto')===-1){return placement;}var boundaries=getBoundaries(popper,reference,padding,boundariesElement);var rects={top:{width:boundaries.width,height:refRect.top-boundaries.top},right:{width:boundaries.right-refRect.right,height:boundaries.height},bottom:{width:boundaries.width,height:boundaries.bottom-refRect.bottom},left:{width:refRect.left-boundaries.left,height:boundaries.height}};var sortedAreas=Object.keys(rects).map(function(key){return _extends$5({key:key},rects[key],{area:getArea(rects[key])});}).sort(function(a,b){return b.area-a.area;});var filteredAreas=sortedAreas.filter(function(_ref2){var width=_ref2.width,height=_ref2.height;return width>=popper.clientWidth&&height>=popper.clientHeight;});var computedPlacement=filteredAreas.length>0?filteredAreas[0].key:sortedAreas[0].key;var variation=placement.split('-')[1];return computedPlacement+(variation?'-'+variation:'');}/**
|
|
493
493
|
* Get offsets to the reference element
|
|
494
494
|
* @method
|
|
495
495
|
* @memberof Popper.Utils
|
|
@@ -714,7 +714,7 @@ var left=void 0,top=void 0;if(sideA==='bottom'){// when offsetParent is <html> t
|
|
|
714
714
|
if(offsetParent.nodeName==='HTML'){top=-offsetParent.clientHeight+offsets.bottom;}else{top=-offsetParentRect.height+offsets.bottom;}}else{top=offsets.top;}if(sideB==='right'){if(offsetParent.nodeName==='HTML'){left=-offsetParent.clientWidth+offsets.right;}else{left=-offsetParentRect.width+offsets.right;}}else{left=offsets.left;}if(gpuAcceleration&&prefixedProperty){styles[prefixedProperty]='translate3d('+left+'px, '+top+'px, 0)';styles[sideA]=0;styles[sideB]=0;styles.willChange='transform';}else{// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
|
|
715
715
|
var invertTop=sideA==='bottom'?-1:1;var invertLeft=sideB==='right'?-1:1;styles[sideA]=top*invertTop;styles[sideB]=left*invertLeft;styles.willChange=sideA+', '+sideB;}// Attributes
|
|
716
716
|
var attributes={'x-placement':data.placement};// Update `data` attributes, styles and arrowStyles
|
|
717
|
-
data.attributes=_extends$
|
|
717
|
+
data.attributes=_extends$5({},attributes,data.attributes);data.styles=_extends$5({},styles,data.styles);data.arrowStyles=_extends$5({},data.offsets.arrow,data.arrowStyles);return data;}/**
|
|
718
718
|
* Helper used to know if the given modifier depends from another one.<br />
|
|
719
719
|
* It checks if the needed modifier is listed and enabled.
|
|
720
720
|
* @method
|
|
@@ -805,7 +805,7 @@ var flippedVariationByRef=!!options.flipVariations&&(isVertical&&variation==='st
|
|
|
805
805
|
var flippedVariationByContent=!!options.flipVariationsByContent&&(isVertical&&variation==='start'&&overflowsRight||isVertical&&variation==='end'&&overflowsLeft||!isVertical&&variation==='start'&&overflowsBottom||!isVertical&&variation==='end'&&overflowsTop);var flippedVariation=flippedVariationByRef||flippedVariationByContent;if(overlapsRef||overflowsBoundaries||flippedVariation){// this boolean to detect any flip loop
|
|
806
806
|
data.flipped=true;if(overlapsRef||overflowsBoundaries){placement=flipOrder[index+1];}if(flippedVariation){variation=getOppositeVariation(variation);}data.placement=placement+(variation?'-'+variation:'');// this object contains `position`, we want to preserve it along with
|
|
807
807
|
// any additional property we may add in the future
|
|
808
|
-
data.offsets.popper=_extends$
|
|
808
|
+
data.offsets.popper=_extends$5({},data.offsets.popper,getPopperOffsets(data.instance.popper,data.offsets.reference,data.placement));data=runModifiers(data.instance.modifiers,data,'flip');}});return data;}/**
|
|
809
809
|
* @function
|
|
810
810
|
* @memberof Modifiers
|
|
811
811
|
* @argument {Object} data - The data object generated by update method
|
|
@@ -875,14 +875,14 @@ if(data.instance.reference===boundariesElement){boundariesElement=getOffsetParen
|
|
|
875
875
|
var transformProp=getSupportedPropertyName('transform');var popperStyles=data.instance.popper.style;// assignment to help minification
|
|
876
876
|
var top=popperStyles.top,left=popperStyles.left,transform=popperStyles[transformProp];popperStyles.top='';popperStyles.left='';popperStyles[transformProp]='';var boundaries=getBoundaries(data.instance.popper,data.instance.reference,options.padding,boundariesElement,data.positionFixed);// NOTE: DOM access here
|
|
877
877
|
// restores the original style properties after the offsets have been computed
|
|
878
|
-
popperStyles.top=top;popperStyles.left=left;popperStyles[transformProp]=transform;options.boundaries=boundaries;var order=options.priority;var popper=data.offsets.popper;var check={primary:function primary(placement){var value=popper[placement];if(popper[placement]<boundaries[placement]&&!options.escapeWithReference){value=Math.max(popper[placement],boundaries[placement]);}return defineProperty({},placement,value);},secondary:function secondary(placement){var mainSide=placement==='right'?'left':'top';var value=popper[mainSide];if(popper[placement]>boundaries[placement]&&!options.escapeWithReference){value=Math.min(popper[mainSide],boundaries[placement]-(placement==='right'?popper.width:popper.height));}return defineProperty({},mainSide,value);}};order.forEach(function(placement){var side=['left','top'].indexOf(placement)!==-1?'primary':'secondary';popper=_extends$
|
|
878
|
+
popperStyles.top=top;popperStyles.left=left;popperStyles[transformProp]=transform;options.boundaries=boundaries;var order=options.priority;var popper=data.offsets.popper;var check={primary:function primary(placement){var value=popper[placement];if(popper[placement]<boundaries[placement]&&!options.escapeWithReference){value=Math.max(popper[placement],boundaries[placement]);}return defineProperty({},placement,value);},secondary:function secondary(placement){var mainSide=placement==='right'?'left':'top';var value=popper[mainSide];if(popper[placement]>boundaries[placement]&&!options.escapeWithReference){value=Math.min(popper[mainSide],boundaries[placement]-(placement==='right'?popper.width:popper.height));}return defineProperty({},mainSide,value);}};order.forEach(function(placement){var side=['left','top'].indexOf(placement)!==-1?'primary':'secondary';popper=_extends$5({},popper,check[side](placement));});data.offsets.popper=popper;return data;}/**
|
|
879
879
|
* @function
|
|
880
880
|
* @memberof Modifiers
|
|
881
881
|
* @argument {Object} data - The data object generated by `update` method
|
|
882
882
|
* @argument {Object} options - Modifiers configuration and options
|
|
883
883
|
* @returns {Object} The data object, properly modified
|
|
884
884
|
*/function shift(data){var placement=data.placement;var basePlacement=placement.split('-')[0];var shiftvariation=placement.split('-')[1];// if shift shiftvariation is specified, run the modifier
|
|
885
|
-
if(shiftvariation){var _data$offsets=data.offsets,reference=_data$offsets.reference,popper=_data$offsets.popper;var isVertical=['bottom','top'].indexOf(basePlacement)!==-1;var side=isVertical?'left':'top';var measurement=isVertical?'width':'height';var shiftOffsets={start:defineProperty({},side,reference[side]),end:defineProperty({},side,reference[side]+reference[measurement]-popper[measurement])};data.offsets.popper=_extends$
|
|
885
|
+
if(shiftvariation){var _data$offsets=data.offsets,reference=_data$offsets.reference,popper=_data$offsets.popper;var isVertical=['bottom','top'].indexOf(basePlacement)!==-1;var side=isVertical?'left':'top';var measurement=isVertical?'width':'height';var shiftOffsets={start:defineProperty({},side,reference[side]),end:defineProperty({},side,reference[side]+reference[measurement]-popper[measurement])};data.offsets.popper=_extends$5({},popper,shiftOffsets[shiftvariation]);}return data;}/**
|
|
886
886
|
* @function
|
|
887
887
|
* @memberof Modifiers
|
|
888
888
|
* @argument {Object} data - The data object generated by update method
|
|
@@ -1179,11 +1179,11 @@ var Popper$1=function(){/**
|
|
|
1179
1179
|
* @return {Object} instance - The generated Popper.js instance
|
|
1180
1180
|
*/function Popper(reference,popper){var _this=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};classCallCheck(this,Popper);this.scheduleUpdate=function(){return requestAnimationFrame(_this.update);};// make update() debounced, so that it only runs at most once-per-tick
|
|
1181
1181
|
this.update=debounce(this.update.bind(this));// with {} we create a new object with the options inside it
|
|
1182
|
-
this.options=_extends$
|
|
1182
|
+
this.options=_extends$5({},Popper.Defaults,options);// init state
|
|
1183
1183
|
this.state={isDestroyed:false,isCreated:false,scrollParents:[]};// get reference and popper elements (allow jQuery wrappers)
|
|
1184
1184
|
this.reference=reference&&reference.jquery?reference[0]:reference;this.popper=popper&&popper.jquery?popper[0]:popper;// Deep merge modifiers options
|
|
1185
|
-
this.options.modifiers={};Object.keys(_extends$
|
|
1186
|
-
this.modifiers=Object.keys(this.options.modifiers).map(function(name){return _extends$
|
|
1185
|
+
this.options.modifiers={};Object.keys(_extends$5({},Popper.Defaults.modifiers,options.modifiers)).forEach(function(name){_this.options.modifiers[name]=_extends$5({},Popper.Defaults.modifiers[name]||{},options.modifiers?options.modifiers[name]:{});});// Refactoring modifiers' list (Object => Array)
|
|
1186
|
+
this.modifiers=Object.keys(this.options.modifiers).map(function(name){return _extends$5({name:name},_this.options.modifiers[name]);})// sort the modifiers by order
|
|
1187
1187
|
.sort(function(a,b){return a.order-b.order;});// modifiers have the ability to execute arbitrary code when Popper.js get inited
|
|
1188
1188
|
// such code is executed in the same order of its modifier
|
|
1189
1189
|
// they could add new properties to their options configuration
|
|
@@ -1260,13 +1260,13 @@ function objectIs(x,y){if(x===y){return x!==0||1/x===1/y;}else{return x!==x&&y!=
|
|
|
1260
1260
|
* Sets a ref using either a ref callback or a ref object
|
|
1261
1261
|
*/var setRef=function setRef(ref,node){// if its a function call it
|
|
1262
1262
|
if(typeof ref==="function"){return safeInvoke(ref,node);}// otherwise we should treat it as a ref object
|
|
1263
|
-
else if(ref!=null){ref.current=node;}};var initialStyle={position:'absolute',top:0,left:0,opacity:0,pointerEvents:'none'};var initialArrowStyle={};var InnerPopper=/*#__PURE__*/function(_React$Component){_inheritsLoose(InnerPopper,_React$Component);function InnerPopper(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_React$Component.call.apply(_React$Component,[this].concat(args))||this;_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"state",{data:undefined,placement:undefined});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"popperInstance",void 0);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"popperNode",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"arrowNode",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"setPopperNode",function(popperNode){if(!popperNode||_this.popperNode===popperNode)return;setRef(_this.props.innerRef,popperNode);_this.popperNode=popperNode;_this.updatePopperInstance();});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"setArrowNode",function(arrowNode){_this.arrowNode=arrowNode;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"updateStateModifier",{enabled:true,order:900,fn:function fn(data){var placement=data.placement;_this.setState({data:data,placement:placement});return data;}});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getOptions",function(){return{placement:_this.props.placement,eventsEnabled:_this.props.eventsEnabled,positionFixed:_this.props.positionFixed,modifiers:_extends$
|
|
1263
|
+
else if(ref!=null){ref.current=node;}};var initialStyle={position:'absolute',top:0,left:0,opacity:0,pointerEvents:'none'};var initialArrowStyle={};var InnerPopper=/*#__PURE__*/function(_React$Component){_inheritsLoose(InnerPopper,_React$Component);function InnerPopper(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_React$Component.call.apply(_React$Component,[this].concat(args))||this;_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"state",{data:undefined,placement:undefined});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"popperInstance",void 0);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"popperNode",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"arrowNode",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"setPopperNode",function(popperNode){if(!popperNode||_this.popperNode===popperNode)return;setRef(_this.props.innerRef,popperNode);_this.popperNode=popperNode;_this.updatePopperInstance();});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"setArrowNode",function(arrowNode){_this.arrowNode=arrowNode;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"updateStateModifier",{enabled:true,order:900,fn:function fn(data){var placement=data.placement;_this.setState({data:data,placement:placement});return data;}});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getOptions",function(){return{placement:_this.props.placement,eventsEnabled:_this.props.eventsEnabled,positionFixed:_this.props.positionFixed,modifiers:_extends$6({},_this.props.modifiers,{arrow:_extends$6({},_this.props.modifiers&&_this.props.modifiers.arrow,{enabled:!!_this.arrowNode,element:_this.arrowNode}),applyStyle:{enabled:false},updateStateModifier:_this.updateStateModifier})};});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getPopperStyle",function(){return!_this.popperNode||!_this.state.data?initialStyle:_extends$6({position:_this.state.data.offsets.popper.position},_this.state.data.styles);});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getPopperPlacement",function(){return!_this.state.data?undefined:_this.state.placement;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getArrowStyle",function(){return!_this.arrowNode||!_this.state.data?initialArrowStyle:_this.state.data.arrowStyles;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"getOutOfBoundariesState",function(){return _this.state.data?_this.state.data.hide:undefined;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"destroyPopperInstance",function(){if(!_this.popperInstance)return;_this.popperInstance.destroy();_this.popperInstance=null;});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"updatePopperInstance",function(){_this.destroyPopperInstance();var _assertThisInitialize=_assertThisInitialized(_assertThisInitialized(_this)),popperNode=_assertThisInitialize.popperNode;var referenceElement=_this.props.referenceElement;if(!referenceElement||!popperNode)return;_this.popperInstance=new Popper$1(referenceElement,popperNode,_this.getOptions());});_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"scheduleUpdate",function(){if(_this.popperInstance){_this.popperInstance.scheduleUpdate();}});return _this;}var _proto=InnerPopper.prototype;_proto.componentDidUpdate=function componentDidUpdate(prevProps,prevState){// If the Popper.js options have changed, update the instance (destroy + create)
|
|
1264
1264
|
if(this.props.placement!==prevProps.placement||this.props.referenceElement!==prevProps.referenceElement||this.props.positionFixed!==prevProps.positionFixed||!deepEqual_1(this.props.modifiers,prevProps.modifiers,{strict:true})){// develop only check that modifiers isn't being updated needlessly
|
|
1265
1265
|
if(process.env.NODE_ENV==="development"){if(this.props.modifiers!==prevProps.modifiers&&this.props.modifiers!=null&&prevProps.modifiers!=null&&shallowEqual(this.props.modifiers,prevProps.modifiers)){console.warn("'modifiers' prop reference updated even though all values appear the same.\nConsider memoizing the 'modifiers' object to avoid needless rendering.");}}this.updatePopperInstance();}else if(this.props.eventsEnabled!==prevProps.eventsEnabled&&this.popperInstance){this.props.eventsEnabled?this.popperInstance.enableEventListeners():this.popperInstance.disableEventListeners();}// A placement difference in state means popper determined a new placement
|
|
1266
1266
|
// apart from the props value. By the time the popper element is rendered with
|
|
1267
1267
|
// the new position Popper has already measured it, if the place change triggers
|
|
1268
1268
|
// a size change it will result in a misaligned popper. So we schedule an update to be sure.
|
|
1269
|
-
if(prevState.placement!==this.state.placement){this.scheduleUpdate();}};_proto.componentWillUnmount=function componentWillUnmount(){setRef(this.props.innerRef,null);this.destroyPopperInstance();};_proto.render=function render(){return unwrapArray(this.props.children)({ref:this.setPopperNode,style:this.getPopperStyle(),placement:this.getPopperPlacement(),outOfBoundaries:this.getOutOfBoundariesState(),scheduleUpdate:this.scheduleUpdate,arrowProps:{ref:this.setArrowNode,style:this.getArrowStyle()}});};return InnerPopper;}(React__namespace.Component);_defineProperty(InnerPopper,"defaultProps",{placement:'bottom',eventsEnabled:true,referenceElement:undefined,positionFixed:false});Popper$1.placements;function Popper(_ref){var referenceElement=_ref.referenceElement,props=_objectWithoutPropertiesLoose(_ref,["referenceElement"]);return React__namespace.createElement(ManagerReferenceNodeContext.Consumer,null,function(referenceNode){return React__namespace.createElement(InnerPopper,_extends$
|
|
1269
|
+
if(prevState.placement!==this.state.placement){this.scheduleUpdate();}};_proto.componentWillUnmount=function componentWillUnmount(){setRef(this.props.innerRef,null);this.destroyPopperInstance();};_proto.render=function render(){return unwrapArray(this.props.children)({ref:this.setPopperNode,style:this.getPopperStyle(),placement:this.getPopperPlacement(),outOfBoundaries:this.getOutOfBoundariesState(),scheduleUpdate:this.scheduleUpdate,arrowProps:{ref:this.setArrowNode,style:this.getArrowStyle()}});};return InnerPopper;}(React__namespace.Component);_defineProperty(InnerPopper,"defaultProps",{placement:'bottom',eventsEnabled:true,referenceElement:undefined,positionFixed:false});Popper$1.placements;function Popper(_ref){var referenceElement=_ref.referenceElement,props=_objectWithoutPropertiesLoose(_ref,["referenceElement"]);return React__namespace.createElement(ManagerReferenceNodeContext.Consumer,null,function(referenceNode){return React__namespace.createElement(InnerPopper,_extends$6({referenceElement:referenceElement!==undefined?referenceElement:referenceNode},props));});}var InnerReference=/*#__PURE__*/function(_React$Component){_inheritsLoose(InnerReference,_React$Component);function InnerReference(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_React$Component.call.apply(_React$Component,[this].concat(args))||this;_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"refHandler",function(node){setRef(_this.props.innerRef,node);safeInvoke(_this.props.setReferenceNode,node);});return _this;}var _proto=InnerReference.prototype;_proto.componentWillUnmount=function componentWillUnmount(){setRef(this.props.innerRef,null);};_proto.render=function render(){warning_1(Boolean(this.props.setReferenceNode),'`Reference` should not be used outside of a `Manager` component.');return unwrapArray(this.props.children)({ref:this.refHandler});};return InnerReference;}(React__namespace.Component);function Reference(props){return React__namespace.createElement(ManagerReferenceNodeSetterContext.Consumer,null,function(setReferenceNode){return React__namespace.createElement(InnerReference,_extends$6({setReferenceNode:setReferenceNode},props));});}/**
|
|
1270
1270
|
* Copyright Zendesk, Inc.
|
|
1271
1271
|
*
|
|
1272
1272
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
@@ -1283,7 +1283,7 @@ if(prevState.placement!==this.state.placement){this.scheduleUpdate();}};_proto.c
|
|
|
1283
1283
|
* in production mode.
|
|
1284
1284
|
* @private
|
|
1285
1285
|
*/var PolishedError=/*#__PURE__*/function(_Error){_inheritsLoose(PolishedError,_Error);function PolishedError(code){var _this;if(process.env.NODE_ENV==='production'){_this=_Error.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+code+" for more information.")||this;}else{for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}_this=_Error.call(this,format.apply(void 0,[ERRORS[code]].concat(args)))||this;}return _assertThisInitialized(_this);}return PolishedError;}(/*#__PURE__*/_wrapNativeSuper(Error));var unitRegExp=/((?!\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\D|$)|ged|darg?|nrut)/g;// Merges additional math functionality into the defaults.
|
|
1286
|
-
function mergeSymbolMaps(additionalSymbols){var symbolMap={};symbolMap.symbols=additionalSymbols?_extends$
|
|
1286
|
+
function mergeSymbolMaps(additionalSymbols){var symbolMap={};symbolMap.symbols=additionalSymbols?_extends$6({},defaultSymbolMap.symbols,additionalSymbols.symbols):_extends$6({},defaultSymbolMap.symbols);return symbolMap;}function exec(operators,values){var _ref;var op=operators.pop();values.push(op.f.apply(op,(_ref=[]).concat.apply(_ref,values.splice(-op.argCount))));return op.precedence;}function calculate(expression,additionalSymbols){var symbolMap=mergeSymbolMaps(additionalSymbols);var match;var operators=[symbolMap.symbols['('].prefix];var values=[];var pattern=new RegExp(// Pattern for numbers
|
|
1287
1287
|
"\\d+(?:\\.\\d+)?|"+// ...and patterns for individual operators/function names
|
|
1288
1288
|
Object.keys(symbolMap.symbols).map(function(key){return symbolMap.symbols[key];})// longer symbols should be listed first
|
|
1289
1289
|
// $FlowFixMe
|
|
@@ -1326,7 +1326,54 @@ values.push(+token);afterValue=true;}}while(match&&operators.length);if(operator
|
|
|
1326
1326
|
* fontSize: '11px',
|
|
1327
1327
|
* }
|
|
1328
1328
|
*/function math(formula,additionalSymbols){var reversedFormula=reverseString(formula);var formulaMatch=reversedFormula.match(unitRegExp);// Check that all units are the same
|
|
1329
|
-
if(formulaMatch&&!formulaMatch.every(function(unit){return unit===formulaMatch[0];})){throw new PolishedError(41);}var cleanFormula=reverseString(reversedFormula.replace(unitRegExp,''));return""+calculate(cleanFormula,additionalSymbols)+(formulaMatch?reverseString(formulaMatch[0]):'');}
|
|
1329
|
+
if(formulaMatch&&!formulaMatch.every(function(unit){return unit===formulaMatch[0];})){throw new PolishedError(41);}var cleanFormula=reverseString(reversedFormula.replace(unitRegExp,''));return""+calculate(cleanFormula,additionalSymbols)+(formulaMatch?reverseString(formulaMatch[0]):'');}/**
|
|
1330
|
+
* Check if a string ends with something
|
|
1331
|
+
* @private
|
|
1332
|
+
*/function endsWith(string,suffix){return string.substr(-suffix.length)===suffix;}var cssRegex$1=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;/**
|
|
1333
|
+
* Returns a given CSS value minus its unit of measure.
|
|
1334
|
+
*
|
|
1335
|
+
* @example
|
|
1336
|
+
* // Styles as object usage
|
|
1337
|
+
* const styles = {
|
|
1338
|
+
* '--dimension': stripUnit('100px')
|
|
1339
|
+
* }
|
|
1340
|
+
*
|
|
1341
|
+
* // styled-components usage
|
|
1342
|
+
* const div = styled.div`
|
|
1343
|
+
* --dimension: ${stripUnit('100px')};
|
|
1344
|
+
* `
|
|
1345
|
+
*
|
|
1346
|
+
* // CSS in JS Output
|
|
1347
|
+
*
|
|
1348
|
+
* element {
|
|
1349
|
+
* '--dimension': 100
|
|
1350
|
+
* }
|
|
1351
|
+
*/function stripUnit(value){if(typeof value!=='string')return value;var matchedValue=value.match(cssRegex$1);return matchedValue?parseFloat(value):value;}/**
|
|
1352
|
+
* Factory function that creates pixel-to-x converters
|
|
1353
|
+
* @private
|
|
1354
|
+
*/var pxtoFactory=function pxtoFactory(to){return function(pxval,base){if(base===void 0){base='16px';}var newPxval=pxval;var newBase=base;if(typeof pxval==='string'){if(!endsWith(pxval,'px')){throw new PolishedError(69,to,pxval);}newPxval=stripUnit(pxval);}if(typeof base==='string'){if(!endsWith(base,'px')){throw new PolishedError(70,to,base);}newBase=stripUnit(base);}if(typeof newPxval==='string'){throw new PolishedError(71,pxval,to);}if(typeof newBase==='string'){throw new PolishedError(72,base,to);}return""+newPxval/newBase+to;};};var pixelsto=pxtoFactory;/**
|
|
1355
|
+
* Convert pixel value to ems. The default base value is 16px, but can be changed by passing a
|
|
1356
|
+
* second argument to the function.
|
|
1357
|
+
* @function
|
|
1358
|
+
* @param {string|number} pxval
|
|
1359
|
+
* @param {string|number} [base='16px']
|
|
1360
|
+
* @example
|
|
1361
|
+
* // Styles as object usage
|
|
1362
|
+
* const styles = {
|
|
1363
|
+
* 'height': em('16px')
|
|
1364
|
+
* }
|
|
1365
|
+
*
|
|
1366
|
+
* // styled-components usage
|
|
1367
|
+
* const div = styled.div`
|
|
1368
|
+
* height: ${em('16px')}
|
|
1369
|
+
* `
|
|
1370
|
+
*
|
|
1371
|
+
* // CSS in JS Output
|
|
1372
|
+
*
|
|
1373
|
+
* element {
|
|
1374
|
+
* 'height': '1em'
|
|
1375
|
+
* }
|
|
1376
|
+
*/var em=/*#__PURE__*/pixelsto('em');var em$1=em;var cssRegex=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;/**
|
|
1330
1377
|
* Returns a given CSS value and its unit as elements of an array.
|
|
1331
1378
|
*
|
|
1332
1379
|
* @example
|
|
@@ -1541,7 +1588,7 @@ return curried(f,f.length,[]);}function guard(lowerBoundary,upperBoundary,value)
|
|
|
1541
1588
|
* background: "#ffbd31";
|
|
1542
1589
|
* background: "rgba(255,189,49,0.7)";
|
|
1543
1590
|
* }
|
|
1544
|
-
*/function darken(amount,color){if(color==='transparent')return color;var hslColor=parseToHsl(color);return toColorString(_extends$
|
|
1591
|
+
*/function darken(amount,color){if(color==='transparent')return color;var hslColor=parseToHsl(color);return toColorString(_extends$6({},hslColor,{lightness:guard(0,1,hslColor.lightness-parseFloat(amount))}));}// prettier-ignore
|
|
1545
1592
|
var curriedDarken=/*#__PURE__*/curry/* ::<number | string, string, string> */(darken);var curriedDarken$1=curriedDarken;/**
|
|
1546
1593
|
* Returns a string value for the lightened color.
|
|
1547
1594
|
*
|
|
@@ -1564,7 +1611,7 @@ var curriedDarken=/*#__PURE__*/curry/* ::<number | string, string, string> */(da
|
|
|
1564
1611
|
* background: "#e5e6b1";
|
|
1565
1612
|
* background: "rgba(229,230,177,0.7)";
|
|
1566
1613
|
* }
|
|
1567
|
-
*/function lighten(amount,color){if(color==='transparent')return color;var hslColor=parseToHsl(color);return toColorString(_extends$
|
|
1614
|
+
*/function lighten(amount,color){if(color==='transparent')return color;var hslColor=parseToHsl(color);return toColorString(_extends$6({},hslColor,{lightness:guard(0,1,hslColor.lightness+parseFloat(amount))}));}// prettier-ignore
|
|
1568
1615
|
var curriedLighten=/*#__PURE__*/curry/* ::<number | string, string, string> */(lighten);var curriedLighten$1=curriedLighten;/**
|
|
1569
1616
|
* lodash (Custom Build) <https://lodash.com/>
|
|
1570
1617
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
@@ -1590,11 +1637,11 @@ var curriedLighten=/*#__PURE__*/curry/* ::<number | string, string, string> */(l
|
|
|
1590
1637
|
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
1591
1638
|
*/function isHostObject(value){// Many host objects are `Object` objects that can coerce to strings
|
|
1592
1639
|
// despite having improperly defined `toString` methods.
|
|
1593
|
-
var result=false;if(value!=null&&typeof value.toString!='function'){try{result=!!(value+'');}catch(e){}}return result;}/** Used for built-in method references. */var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;/** Used to detect overreaching core-js shims. */var coreJsData=root['__core-js_shared__'];/** Used to detect methods masquerading as native. */var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||'');return uid?'Symbol(src)_1.'+uid:'';}();/** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString;/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty;/**
|
|
1640
|
+
var result=false;if(value!=null&&typeof value.toString!='function'){try{result=!!(value+'');}catch(e){}}return result;}/** Used for built-in method references. */var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;/** Used to detect overreaching core-js shims. */var coreJsData=root['__core-js_shared__'];/** Used to detect methods masquerading as native. */var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||'');return uid?'Symbol(src)_1.'+uid:'';}();/** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString;/** Used to check objects for own properties. */var hasOwnProperty$1=objectProto.hasOwnProperty;/**
|
|
1594
1641
|
* Used to resolve the
|
|
1595
1642
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1596
1643
|
* of values.
|
|
1597
|
-
*/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.*?')+'$');/** Built-in value references. */var splice=arrayProto.splice;/* Built-in method references that are verified to be native. */var Map$1=getNative(root,'Map'),nativeCreate=getNative(Object,'create');/**
|
|
1644
|
+
*/var objectToString=objectProto.toString;/** Used to detect if a method is native. */var reIsNative=RegExp('^'+funcToString.call(hasOwnProperty$1).replace(reRegExpChar,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');/** Built-in value references. */var splice=arrayProto.splice;/* Built-in method references that are verified to be native. */var Map$1=getNative(root,'Map'),nativeCreate=getNative(Object,'create');/**
|
|
1598
1645
|
* Creates a hash object.
|
|
1599
1646
|
*
|
|
1600
1647
|
* @private
|
|
@@ -1623,7 +1670,7 @@ var result=false;if(value!=null&&typeof value.toString!='function'){try{result=!
|
|
|
1623
1670
|
* @memberOf Hash
|
|
1624
1671
|
* @param {string} key The key of the value to get.
|
|
1625
1672
|
* @returns {*} Returns the entry value.
|
|
1626
|
-
*/function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result;}return hasOwnProperty.call(data,key)?data[key]:undefined;}/**
|
|
1673
|
+
*/function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result;}return hasOwnProperty$1.call(data,key)?data[key]:undefined;}/**
|
|
1627
1674
|
* Checks if a hash value for `key` exists.
|
|
1628
1675
|
*
|
|
1629
1676
|
* @private
|
|
@@ -1631,7 +1678,7 @@ var result=false;if(value!=null&&typeof value.toString!='function'){try{result=!
|
|
|
1631
1678
|
* @memberOf Hash
|
|
1632
1679
|
* @param {string} key The key of the entry to check.
|
|
1633
1680
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1634
|
-
*/function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key);}/**
|
|
1681
|
+
*/function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty$1.call(data,key);}/**
|
|
1635
1682
|
* Sets the hash `key` to `value`.
|
|
1636
1683
|
*
|
|
1637
1684
|
* @private
|
|
@@ -1901,12 +1948,14 @@ var tag=isObject(value)?objectToString.call(value):'';return tag==funcTag||tag==
|
|
|
1901
1948
|
*
|
|
1902
1949
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
1903
1950
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
1904
|
-
*/const PALETTE={black:'#000',white:'#fff',product:{support:'#00a656',message:'#37b8af',explore:'#30aabc',gather:'#f6c8be',guide:'#eb4962',connect:'#ff6224',chat:'#f79a3e',talk:'#efc93d',sell:'#c38f00'},grey:{100:'#f8f9f9',200:'#e9ebed',300:'#d8dcde',400:'#c2c8cc',500:'#87929d',600:'#68737d',700:'#49545c',800:'#2f3941'},blue:{100:'#edf7ff',200:'#cee2f2',300:'#adcce4',400:'#5293c7',500:'#337fbd',600:'#1f73b7',700:'#144a75',800:'#0f3554'},red:{100:'#fff0f1',200:'#f5d5d8',300:'#f5b5ba',400:'#e35b66',500:'#d93f4c',600:'#cc3340',700:'#8c232c',800:'#681219'},yellow:{100:'#fff7ed',200:'#ffeedb',300:'#fed6a8',400:'#ffb057',500:'#f79a3e',600:'#ed8f1c',700:'#ad5918',800:'#703815'},green:{100:'#edf8f4',200:'#d1e8df',300:'#aecfc2',400:'#5eae91',500:'#228f67',600:'#038153',700:'#186146',800:'#0b3b29'},kale:{100:'#f5fcfc',200:'#daeded',300:'#bdd9d7',400:'#90bbbb',500:'#498283',600:'#17494d',700:'#03363d',800:'#012b30'},fuschia:{400:'#d653c2',600:'#a81897',M400:'#cf62a8',M600:'#a8458c'},pink:{400:'#ec4d63',600:'#d42054',M400:'#d57287',M600:'#b23a5d'},crimson:{400:'#e34f32',600:'#c72a1c',M400:'#cc6c5b',M600:'#b24a3c'},orange:{400:'#de701d',600:'#bf5000',M400:'#d4772c',M600:'#b35827'},lemon:{400:'#ffd424',600:'#ffbb10',M400:'#e7a500',M600:'#c38f00'},lime:{400:'#43b324',600:'#2e8200',M400:'#519e2d',M600:'#47782c'},mint:{400:'#00a656',600:'#058541',M400:'#299c66',M600:'#2e8057'},teal:{400:'#02a191',600:'#028079',M400:'#2d9e8f',M600:'#3c7873'},azure:{400:'#3091ec',600:'#1371d6',M400:'#5f8dcf',M600:'#3a70b2'},royal:{400:'#5d7df5',600:'#3353e2',M400:'#7986d8',M600:'#4b61c3'},purple:{400:'#b552e2',600:'#6a27b8',M400:'#b072cc',M600:'#9358b0'}};const BASE=4;const borderRadii={sm:`${BASE/2}px`,md:`${BASE}px`};const borderStyles={solid:'solid'};const borderWidths={sm:'1px',md:'3px'};const borders={sm:`${borderWidths.sm} ${borderStyles.solid}`,md:`${borderWidths.md} ${borderStyles.solid}`};const breakpoints={xs:'0px',sm:`${BASE*144}px`,md:`${BASE*192}px`,lg:`${BASE*248}px`,xl:`${BASE*300}px`};const colors={background:PALETTE.white,foreground:PALETTE.grey[800],primaryHue:'blue',dangerHue:'red',warningHue:'yellow',successHue:'green',neutralHue:'grey',chromeHue:'kale'};const fonts={mono:['SFMono-Regular','Consolas','"Liberation Mono"','Menlo','Courier','monospace'].join(','),system:['system-ui','-apple-system','BlinkMacSystemFont','"Segoe UI"','Roboto','Oxygen-Sans','Ubuntu','Cantarell','"Helvetica Neue"','Arial','sans-serif'].join(',')};const fontSizes={xs:'10px',sm:'12px',md:'14px',lg:'18px',xl:'22px',xxl:'26px',xxxl:'36px'};const fontWeights={thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,black:900};const iconSizes={sm:'12px',md:'16px',lg:'26px'};const lineHeights={sm:`${BASE*4}px`,md:`${BASE*5}px`,lg:`${BASE*6}px`,xl:`${BASE*7}px`,xxl:`${BASE*8}px`,xxxl:`${BASE*11}px`};const palette={...PALETTE};delete palette.product;const shadowWidths={xs:'1px',sm:'2px',md:'3px'};const shadows={xs:color=>`0 0 0 ${shadowWidths.xs} ${color}`,sm:color=>`0 0 0 ${shadowWidths.sm} ${color}`,md:color=>`0 0 0 ${shadowWidths.md} ${color}`,lg:(offsetY,blurRadius,color)=>`0 ${offsetY} ${blurRadius} 0 ${color}`};const space={base:BASE,xxs:`${BASE}px`,xs:`${BASE*2}px`,sm:`${BASE*3}px`,md:`${BASE*5}px`,lg:`${BASE*8}px`,xl:`${BASE*10}px`,xxl:`${BASE*12}px`};const DEFAULT_THEME={borders,borderRadii,borderStyles,borderWidths,breakpoints,colors:{base:'light',...colors},components:{},fonts,fontSizes,fontWeights,iconSizes,lineHeights,palette,rtl:false,shadowWidths,shadows,space};function retrieveComponentStyles(componentId,props){const components=props.theme&&props.theme.components;if(!components){return undefined;}const componentStyles=components[componentId];if(typeof componentStyles==='function'){return componentStyles(props);}return componentStyles;}const DEFAULT_SHADE=600;const adjust=(color,expected,actual)=>{if(expected!==actual){const amount=Math.abs(expected-actual)/100*0.05;return expected>actual?curriedDarken$1(amount,color):curriedLighten$1(amount,color);}return color;};const getColor=lodash_memoize(function(hue){let shade=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DEFAULT_SHADE;let theme=arguments.length>2?arguments[2]:undefined;let transparency=arguments.length>3?arguments[3]:undefined;let retVal;if(isNaN(shade)){return undefined;}const palette=theme&&theme.palette?theme.palette:DEFAULT_THEME.palette;const colors=theme&&theme.colors?theme.colors:DEFAULT_THEME.colors;let _hue;if(typeof hue==='string'){_hue=colors[hue]||hue;}else{_hue=hue;}if(Object.prototype.hasOwnProperty.call(palette,_hue)){_hue=palette[_hue];}if(typeof _hue==='object'){retVal=_hue[shade];if(!retVal){const _shade=Object.keys(_hue).map(hueKey=>parseInt(hueKey,10)).reduce((previous,current)=>{return Math.abs(current-shade)<Math.abs(previous-shade)?current:previous;});retVal=adjust(_hue[_shade],shade,_shade);}}else{retVal=adjust(_hue,shade,DEFAULT_SHADE);}if(transparency){retVal=rgba(retVal,transparency);}return retVal;},(hue,shade,theme,transparency)=>JSON.stringify({hue,shade,palette:theme?.palette,colors:theme?.colors,transparency}));
|
|
1951
|
+
*/const PALETTE={black:'#000',white:'#fff',product:{support:'#00a656',message:'#37b8af',explore:'#30aabc',gather:'#f6c8be',guide:'#eb4962',connect:'#ff6224',chat:'#f79a3e',talk:'#efc93d',sell:'#c38f00'},grey:{100:'#f8f9f9',200:'#e9ebed',300:'#d8dcde',400:'#c2c8cc',500:'#87929d',600:'#68737d',700:'#49545c',800:'#2f3941'},blue:{100:'#edf7ff',200:'#cee2f2',300:'#adcce4',400:'#5293c7',500:'#337fbd',600:'#1f73b7',700:'#144a75',800:'#0f3554'},red:{100:'#fff0f1',200:'#f5d5d8',300:'#f5b5ba',400:'#e35b66',500:'#d93f4c',600:'#cc3340',700:'#8c232c',800:'#681219'},yellow:{100:'#fff7ed',200:'#ffeedb',300:'#fed6a8',400:'#ffb057',500:'#f79a3e',600:'#ed8f1c',700:'#ad5918',800:'#703815'},green:{100:'#edf8f4',200:'#d1e8df',300:'#aecfc2',400:'#5eae91',500:'#228f67',600:'#038153',700:'#186146',800:'#0b3b29'},kale:{100:'#f5fcfc',200:'#daeded',300:'#bdd9d7',400:'#90bbbb',500:'#498283',600:'#17494d',700:'#03363d',800:'#012b30'},fuschia:{400:'#d653c2',600:'#a81897',M400:'#cf62a8',M600:'#a8458c'},pink:{400:'#ec4d63',600:'#d42054',M400:'#d57287',M600:'#b23a5d'},crimson:{400:'#e34f32',600:'#c72a1c',M400:'#cc6c5b',M600:'#b24a3c'},orange:{400:'#de701d',600:'#bf5000',M400:'#d4772c',M600:'#b35827'},lemon:{400:'#ffd424',600:'#ffbb10',M400:'#e7a500',M600:'#c38f00'},lime:{400:'#43b324',600:'#2e8200',M400:'#519e2d',M600:'#47782c'},mint:{400:'#00a656',600:'#058541',M400:'#299c66',M600:'#2e8057'},teal:{400:'#02a191',600:'#028079',M400:'#2d9e8f',M600:'#3c7873'},azure:{400:'#3091ec',600:'#1371d6',M400:'#5f8dcf',M600:'#3a70b2'},royal:{400:'#5d7df5',600:'#3353e2',M400:'#7986d8',M600:'#4b61c3'},purple:{400:'#b552e2',600:'#6a27b8',M400:'#b072cc',M600:'#9358b0'}};const BASE=4;const borderRadii={sm:`${BASE/2}px`,md:`${BASE}px`};const borderStyles={solid:'solid'};const borderWidths={sm:'1px',md:'3px'};const borders={sm:`${borderWidths.sm} ${borderStyles.solid}`,md:`${borderWidths.md} ${borderStyles.solid}`};const breakpoints={xs:'0px',sm:`${BASE*144}px`,md:`${BASE*192}px`,lg:`${BASE*248}px`,xl:`${BASE*300}px`};const colors$1={background:PALETTE.white,foreground:PALETTE.grey[800],primaryHue:'blue',dangerHue:'red',warningHue:'yellow',successHue:'green',neutralHue:'grey',chromeHue:'kale'};const fonts={mono:['SFMono-Regular','Consolas','"Liberation Mono"','Menlo','Courier','monospace'].join(','),system:['system-ui','-apple-system','BlinkMacSystemFont','"Segoe UI"','Roboto','Oxygen-Sans','Ubuntu','Cantarell','"Helvetica Neue"','Arial','sans-serif'].join(',')};const fontSizes={xs:'10px',sm:'12px',md:'14px',lg:'18px',xl:'22px',xxl:'26px',xxxl:'36px'};const fontWeights={thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,black:900};const iconSizes={sm:'12px',md:'16px',lg:'26px'};const lineHeights={sm:`${BASE*4}px`,md:`${BASE*5}px`,lg:`${BASE*6}px`,xl:`${BASE*7}px`,xxl:`${BASE*8}px`,xxxl:`${BASE*11}px`};const palette={...PALETTE};delete palette.product;const shadowWidths={xs:'1px',sm:'2px',md:'3px'};const shadows={xs:color=>`0 0 0 ${shadowWidths.xs} ${color}`,sm:color=>`0 0 0 ${shadowWidths.sm} ${color}`,md:color=>`0 0 0 ${shadowWidths.md} ${color}`,lg:(offsetY,blurRadius,color)=>`0 ${offsetY} ${blurRadius} 0 ${color}`};const space={base:BASE,xxs:`${BASE}px`,xs:`${BASE*2}px`,sm:`${BASE*3}px`,md:`${BASE*5}px`,lg:`${BASE*8}px`,xl:`${BASE*10}px`,xxl:`${BASE*12}px`};const DEFAULT_THEME={borders,borderRadii,borderStyles,borderWidths,breakpoints,colors:{base:'light',...colors$1},components:{},fonts,fontSizes,fontWeights,iconSizes,lineHeights,palette,rtl:false,shadowWidths,shadows,space};const useDocument=theme=>{const[controlledDocument,setControlledDocument]=React.useState();React.useEffect(()=>{if(theme&&theme.document){setControlledDocument(theme.document);}else{setControlledDocument(document);}},[theme]);return controlledDocument;};function retrieveComponentStyles(componentId,props){const components=props.theme&&props.theme.components;if(!components){return undefined;}const componentStyles=components[componentId];if(typeof componentStyles==='function'){return componentStyles(props);}return componentStyles;}const DEFAULT_SHADE=600;const adjust=(color,expected,actual)=>{if(expected!==actual){const amount=Math.abs(expected-actual)/100*0.05;return expected>actual?curriedDarken$1(amount,color):curriedLighten$1(amount,color);}return color;};const getColor=lodash_memoize(function(hue){let shade=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DEFAULT_SHADE;let theme=arguments.length>2?arguments[2]:undefined;let transparency=arguments.length>3?arguments[3]:undefined;let retVal;if(isNaN(shade)){return undefined;}const palette=theme&&theme.palette?theme.palette:DEFAULT_THEME.palette;const colors=theme&&theme.colors?theme.colors:DEFAULT_THEME.colors;let _hue;if(typeof hue==='string'){_hue=colors[hue]||hue;}else{_hue=hue;}if(Object.prototype.hasOwnProperty.call(palette,_hue)){_hue=palette[_hue];}if(typeof _hue==='object'){retVal=_hue[shade];if(!retVal){const _shade=Object.keys(_hue).map(hueKey=>parseInt(hueKey,10)).reduce((previous,current)=>{return Math.abs(current-shade)<Math.abs(previous-shade)?current:previous;});retVal=adjust(_hue[_shade],shade,_shade);}}else{retVal=adjust(_hue,shade,DEFAULT_SHADE);}if(transparency){retVal=rgba(retVal,transparency);}return retVal;},(hue,shade,theme,transparency)=>JSON.stringify({hue,shade,palette:theme?.palette,colors:theme?.colors,transparency}));const getFocusBoxShadow=_ref=>{let{boxShadow,inset=false,hue='primaryHue',shade=DEFAULT_SHADE,shadowWidth='md',spacerHue='background',spacerShade=DEFAULT_SHADE,spacerWidth='xs',theme=DEFAULT_THEME}=_ref;const color=getColor(hue,shade,theme);const shadow=theme.shadows[shadowWidth](color);if(spacerWidth===null){return`${inset?'inset':''} ${shadow}`;}const spacerColor=getColor(spacerHue,spacerShade,theme);const retVal=`
|
|
1952
|
+
${inset?'inset':''} ${theme.shadows[spacerWidth](spacerColor)},
|
|
1953
|
+
${inset?'inset':''} ${shadow}`;return boxShadow?`${retVal}, ${boxShadow}`:retVal;};function getLineHeight(height,fontSize){const[heightValue,heightUnit]=getValueAndUnit(height.toString());const[fontSizeValue,fontSizeUnit]=getValueAndUnit(fontSize.toString());const PIXELS='px';if(heightUnit&&heightUnit!==PIXELS){throw new Error(`Unexpected \`height\` with '${heightUnit}' units.`);}if(fontSizeUnit&&fontSizeUnit!==PIXELS){throw new Error(`Unexpected \`fontSize\` with '${fontSizeUnit}' units.`);}return heightValue/fontSizeValue;}const exponentialSymbols={symbols:{sqrt:{func:{symbol:'sqrt',f:a=>Math.sqrt(a),notation:'func',precedence:0,rightToLeft:0,argCount:1},symbol:'sqrt',regSymbol:'sqrt\\b'}}};const animationStyles$1=(position,modifier)=>{const property=position.split('-')[0];const animationName=styled.keyframes(["0%,66%{",":2px;border:transparent;}"],property);return styled.css(["&","::before,&","::after{animation:0.3s ease-in-out ",";}"],modifier,modifier,animationName);};const positionStyles=(position,size,inset)=>{const margin=math(`${size} / -2`);const placement=math(`${margin} + ${inset}`);let clipPath;let positionCss;let propertyRadius;if(position.startsWith('top')){propertyRadius='border-bottom-right-radius';clipPath='polygon(100% 0, 100% 1px, 1px 100%, 0 100%, 0 0)';positionCss=styled.css(["top:",";right:",";left:",";margin-left:",";"],placement,position==='top-right'&&size,position==='top'?'50%':position==='top-left'&&size,position==='top'&&margin);}else if(position.startsWith('right')){propertyRadius='border-bottom-left-radius';clipPath='polygon(100% 0, 100% 100%, calc(100% - 1px) 100%, 0 1px, 0 0)';positionCss=styled.css(["top:",";right:",";bottom:",";margin-top:",";"],position==='right'?'50%':position==='right-top'&&size,placement,position==='right-bottom'&&size,position==='right'&&margin);}else if(position.startsWith('bottom')){propertyRadius='border-top-left-radius';clipPath='polygon(100% 0, calc(100% - 1px) 0, 0 calc(100% - 1px), 0 100%, 100% 100%)';positionCss=styled.css(["right:",";bottom:",";left:",";margin-left:",";"],position==='bottom-right'&&size,placement,position==='bottom'?'50%':position==='bottom-left'&&size,position==='bottom'&&margin);}else if(position.startsWith('left')){propertyRadius='border-top-right-radius';clipPath='polygon(0 100%, 100% 100%, 100% calc(100% - 1px), 1px 0, 0 0)';positionCss=styled.css(["top:",";bottom:",";left:",";margin-top:",";"],position==='left'?'50%':position==='left-top'&&size,size,placement,position==='left'&&margin);}return styled.css(["&::before{",":100%;clip-path:",";}&::before,&::after{","}"],propertyRadius,clipPath,positionCss);};function arrowStyles(position){let options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};const size=options.size||'6px';const inset=options.inset||'0';const squareSize=math(`${size} * 2 / sqrt(2)`,exponentialSymbols);return styled.css(["position:relative;&::before{border-width:inherit;border-style:inherit;border-color:transparent;background-clip:content-box;}&::after{z-index:-1;border:inherit;box-shadow:inherit;}&::before,&::after{position:absolute;transform:rotate(45deg);background-color:inherit;box-sizing:inherit;width:",";height:",";content:'';}",";",";"],squareSize,squareSize,positionStyles(position,squareSize,inset),options.animationModifier&&animationStyles$1(position,options.animationModifier));}const useText=function(component,props,name,text){let condition=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;const value=condition?props[name]:undefined;return React.useMemo(()=>{if(condition){if(name==='children'){throw new Error('Error: `children` is not a valid `useText` prop.');}else if(value===null||value===''){throw new Error(component.displayName?`Error: you must provide a valid \`${name}\` text value for <${component.displayName}>.`:`Error: you must provide a valid \`${name}\` text value.`);}else if(value===undefined){if(process.env.NODE_ENV==='development'){console.warn(component.displayName?`Warning: you did not provide a customized/translated \`${name}\` text value for <${component.displayName}>. Zendesk Garden is rendering <${component.displayName} ${name}="${text}"> by default.`:`Warning: you did not provide a customized/translated \`${name}\` text value. Zendesk Garden is rendering ${name}="${text}" by default.`);}return text;}}return value;},[component.displayName,value,name,text,condition]);};const SELECTOR_FOCUS_VISIBLE='&:focus-visible, &[data-garden-focus-visible="true"]';const focusStyles=_ref=>{let{condition=true,selector=SELECTOR_FOCUS_VISIBLE,shadowWidth='md',spacerWidth='xs',styles:{boxShadow,...styles}={},theme,...options}=_ref;const _boxShadow=condition?getFocusBoxShadow({boxShadow,shadowWidth,spacerWidth,theme,...options}):boxShadow;let outline;let outlineOffset;if(spacerWidth===null){outline=theme.shadowWidths[shadowWidth];}else{outline=`${math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;outlineOffset=theme.shadowWidths[spacerWidth];}return styled.css(["&:focus{outline:none;}","{outline:",";outline-offset:",";box-shadow:",";","}"],selector,outline,outlineOffset,_boxShadow,styles);};/**
|
|
1905
1954
|
* Copyright Zendesk, Inc.
|
|
1906
1955
|
*
|
|
1907
1956
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
1908
1957
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
1909
|
-
*/function getPopperPlacement(gardenPlacement){const gardenToPopperMapping={auto:'auto',top:'top','top-start':'top-start','top-end':'top-end',bottom:'bottom','bottom-start':'bottom-start','bottom-end':'bottom-end',end:'right','end-top':'right-start','end-bottom':'right-end',start:'left','start-top':'left-start','start-bottom':'left-end'};return gardenToPopperMapping[gardenPlacement];}function getRtlPopperPlacement(gardenPlacement){const rtlPlacementMappings={left:'right','left-start':'right-start','left-end':'right-end','top-start':'top-end','top-end':'top-start',right:'left','right-start':'left-start','right-end':'left-end','bottom-start':'bottom-end','bottom-end':'bottom-start'};const popperPlacement=getPopperPlacement(gardenPlacement);return rtlPlacementMappings[popperPlacement]||popperPlacement;}function getArrowPosition(popperPlacement){const arrowPositionMappings={top:'bottom','top-start':'bottom-left','top-end':'bottom-right',right:'left','right-start':'left-top','right-end':'left-bottom',bottom:'top','bottom-start':'top-left','bottom-end':'top-right',left:'right','left-start':'right-top','left-end':'right-bottom'};return arrowPositionMappings[popperPlacement]||'top';}const COMPONENT_ID$2='tooltip.paragraph';const StyledParagraph=styled__default["default"].p.attrs({'data-garden-id':COMPONENT_ID$2,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledParagraph",componentId:"sc-wuqkfc-0"})(["margin:0;",";"],props=>retrieveComponentStyles(COMPONENT_ID$2,props));StyledParagraph.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$1='tooltip.title';const StyledTitle=styled__default["default"].strong.attrs({'data-garden-id':COMPONENT_ID$1,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledTitle",componentId:"sc-vnjcvz-0"})(["display:none;margin:0;font-weight:",";",";"],props=>props.theme.fontWeights.semibold,props=>retrieveComponentStyles(COMPONENT_ID$1,props));StyledTitle.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID='tooltip.tooltip';const sizeStyles=_ref=>{let{theme,size,type,placement,hasArrow}=_ref;let margin=`${theme.space.base*1.5}px`;let borderRadius=theme.borderRadii.sm;let padding='0 1em';let maxWidth;let overflowWrap;let whiteSpace='nowrap';let lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.sm);let fontSize=theme.fontSizes.sm;let titleDisplay;let paragraphMarginTop;let wordWrap;if(size!=='small'){borderRadius=theme.borderRadii.md;overflowWrap='break-word';whiteSpace='normal';wordWrap='break-word';}if(size==='extra-large'){padding=`${theme.space.base*10}px`;maxWidth=`460px`;lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.md);paragraphMarginTop=`${theme.space.base*2.5}px`;}else if(size==='large'){padding=`${theme.space.base*5}px`;maxWidth=`270px`;lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.md);paragraphMarginTop=`${theme.space.base*2}px`;}else if(size==='medium'){padding='1em';maxWidth=`140px`;lineHeight=getLineHeight(theme.space.base*4,theme.fontSizes.sm);}if(size==='extra-large'||size==='large'){fontSize=theme.fontSizes.md;titleDisplay='block';}let arrowSize;let arrowInset;if(hasArrow){if(size==='small'||size==='medium'){arrowSize=margin;arrowInset=type==='dark'?'1px':'0';}else{arrowInset=type==='dark'?'2px':'1px';if(size==='large'){margin=`${theme.space.base*2}px`;arrowSize=margin;}else if(size==='extra-large'){margin=`${theme.space.base*3}px`;arrowSize=`${theme.space.base*2.5}px`;}}}return styled.css(["margin:",";border-radius:",";padding:",";max-width:",";line-height:",";word-wrap:",";white-space:",";font-size:",";overflow-wrap:",";",";","{margin-top:",";}","{display:",";}"],margin,borderRadius,padding,maxWidth,lineHeight,wordWrap,whiteSpace,fontSize,overflowWrap,hasArrow&&arrowStyles(getArrowPosition(placement),{size:arrowSize,inset:arrowInset}),StyledParagraph,paragraphMarginTop,StyledTitle,titleDisplay);};const colorStyles=_ref2=>{let{theme,type}=_ref2;let border;let boxShadow=theme.shadows.lg(`${theme.space.base}px`,`${theme.space.base*2}px`,getColor('chromeHue',600,theme,0.15));let backgroundColor=getColor('chromeHue',700,theme);let color=theme.colors.background;let titleColor;if(type==='light'){boxShadow=theme.shadows.lg(`${theme.space.base*3}px`,`${theme.space.base*5}px`,getColor('chromeHue',600,theme,0.15));border=`${theme.borders.sm} ${getColor('neutralHue',300,theme)}`;backgroundColor=theme.colors.background;color=getColor('neutralHue',700,theme);titleColor=theme.colors.foreground;}return styled.css(["border:",";box-shadow:",";background-color:",";color:",";","{color:",";}"],border,boxShadow,backgroundColor,color,StyledTitle,titleColor);};const StyledTooltip=styled__default["default"].div.attrs({'data-garden-id':COMPONENT_ID,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledTooltip",componentId:"sc-gzzjq4-0"})(["display:inline-block;box-sizing:border-box;direction:",";text-align:",";font-weight:",";",";&[aria-hidden='true']{display:none;}",";",";"],props=>props.theme.rtl&&'rtl',props=>props.theme.rtl?'right':'left',props=>props.theme.fontWeights.regular,props=>sizeStyles(props),colorStyles,props=>retrieveComponentStyles(COMPONENT_ID,props));StyledTooltip.defaultProps={theme:DEFAULT_THEME};const StyledTooltipWrapper=styled__default["default"].div.withConfig({displayName:"StyledTooltipWrapper",componentId:"sc-1b7q9q6-0"})(["transition:opacity 10ms;opacity:1;z-index:",";&[aria-hidden='true']{visibility:hidden;opacity:0;}"],props=>props.zIndex);StyledTooltipWrapper.defaultProps={theme:DEFAULT_THEME};const SHARED_PLACEMENT=['auto','top','top-start','top-end','bottom','bottom-start','bottom-end'];const PLACEMENT=[...SHARED_PLACEMENT,'end','end-top','end-bottom','start','start-top','start-bottom'];const SIZE=['small','medium','large','extra-large'];const TYPE=['light','dark'];const Tooltip$1=_ref=>{let{id,delayMS,isInitialVisible,content,refKey,placement,eventsEnabled,popperModifiers,children,hasArrow,size,type,appendToNode,zIndex,isVisible:externalIsVisible,...otherProps}=_ref;const{rtl}=React.useContext(styled.ThemeContext);const scheduleUpdateRef=React.useRef();const{isVisible,getTooltipProps,getTriggerProps,openTooltip,closeTooltip}=useTooltip({id,delayMilliseconds:delayMS,isVisible:isInitialVisible});const controlledIsVisible=getControlledValue(externalIsVisible,isVisible);React.useEffect(()=>{if(controlledIsVisible&&scheduleUpdateRef.current){scheduleUpdateRef.current();}},[controlledIsVisible,content]);const popperPlacement=rtl?getRtlPopperPlacement(placement):getPopperPlacement(placement);const singleChild=React__default["default"].Children.only(children);const modifiers={preventOverflow:{boundariesElement:'window'},...popperModifiers};return React__default["default"].createElement(Manager,null,React__default["default"].createElement(Reference,null,_ref2=>{let{ref}=_ref2;return React.cloneElement(singleChild,getTriggerProps({...singleChild.props,[refKey]:mergeRefs([ref,singleChild.ref?singleChild.ref:null])}));}),React__default["default"].createElement(Popper,{placement:popperPlacement,eventsEnabled:controlledIsVisible&&eventsEnabled,modifiers:modifiers},_ref3=>{let{ref,style,scheduleUpdate,placement:currentPlacement}=_ref3;scheduleUpdateRef.current=scheduleUpdate;const{onFocus,onBlur,...otherTooltipProps}=otherProps;let computedSize=size;if(computedSize===undefined){if(type==='dark'){computedSize='small';}else{computedSize='large';}}const tooltipProps={hasArrow,placement:currentPlacement,size:computedSize,onFocus:composeEventHandlers(onFocus,()=>{openTooltip();}),onBlur:composeEventHandlers(onBlur,()=>{closeTooltip(0);}),'aria-hidden':!controlledIsVisible,type,...otherTooltipProps};const tooltip=React__default["default"].createElement(StyledTooltipWrapper,{ref:controlledIsVisible?ref:null,style:style,zIndex:zIndex,"aria-hidden":!controlledIsVisible},React__default["default"].createElement(StyledTooltip,getTooltipProps(tooltipProps),content));if(appendToNode){return reactDom.createPortal(tooltip,appendToNode);}return tooltip;}));};Tooltip$1.displayName='Tooltip';Tooltip$1.propTypes={appendToNode:propTypes.exports.any,hasArrow:propTypes.exports.bool,delayMS:propTypes.exports.number,eventsEnabled:propTypes.exports.bool,id:propTypes.exports.string,content:propTypes.exports.node.isRequired,placement:propTypes.exports.oneOf(PLACEMENT),popperModifiers:propTypes.exports.any,size:propTypes.exports.oneOf(SIZE),type:propTypes.exports.oneOf(TYPE),zIndex:propTypes.exports.oneOfType([propTypes.exports.number,propTypes.exports.string]),isInitialVisible:propTypes.exports.bool,refKey:propTypes.exports.string};Tooltip$1.defaultProps={hasArrow:true,eventsEnabled:true,type:'dark',placement:'top',delayMS:500,refKey:'ref'};function _extends(){_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}const Paragraph=React.forwardRef((props,ref)=>React__default["default"].createElement(StyledParagraph,_extends({ref:ref},props)));Paragraph.displayName='Paragraph';const Title=React.forwardRef((props,ref)=>React__default["default"].createElement(StyledTitle,_extends({ref:ref},props)));Title.displayName='Title';var darkMode=styled.css(templateObject_1$1||(templateObject_1$1=__makeTemplateObject(["\n background: ",";\n"],["\n background: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.tooltip.darkBackground;});var Tooltip=styled__default["default"](Tooltip$1).attrs(function(_a){var appendToNode=_a.appendToNode,_b=_a.arrow,arrow=_b===void 0?false:_b,_c=_a.maxWidth,maxWidth=_c===void 0?"300px":_c,_d=_a.placement,placement=_d===void 0?"auto":_d,props=__rest(_a,["appendToNode","arrow","maxWidth","placement"]);return __assign({appendToNode:appendToNode!==null&&appendToNode!==void 0?appendToNode:document.body,delayMS:0,hasArrow:arrow,maxWidth:maxWidth,placement:placement,zIndex:999},props);})(templateObject_2$1||(templateObject_2$1=__makeTemplateObject(["\n && {\n max-width: ",";\n white-space: unset;\n ","\n }\n"],["\n && {\n max-width: ",";\n white-space: unset;\n ","\n }\n"])),function(_a){var maxWidth=_a.maxWidth;return"min(100vw, ".concat(maxWidth,")");},function(_a){var type=_a.type;return type!=="light"?darkMode:"";});var templateObject_1$1,templateObject_2$1;var lodash={exports:{}};/**
|
|
1958
|
+
*/function getPopperPlacement(gardenPlacement){const gardenToPopperMapping={auto:'auto',top:'top','top-start':'top-start','top-end':'top-end',bottom:'bottom','bottom-start':'bottom-start','bottom-end':'bottom-end',end:'right','end-top':'right-start','end-bottom':'right-end',start:'left','start-top':'left-start','start-bottom':'left-end'};return gardenToPopperMapping[gardenPlacement];}function getRtlPopperPlacement(gardenPlacement){const rtlPlacementMappings={left:'right','left-start':'right-start','left-end':'right-end','top-start':'top-end','top-end':'top-start',right:'left','right-start':'left-start','right-end':'left-end','bottom-start':'bottom-end','bottom-end':'bottom-start'};const popperPlacement=getPopperPlacement(gardenPlacement);return rtlPlacementMappings[popperPlacement]||popperPlacement;}function getArrowPosition(popperPlacement){const arrowPositionMappings={top:'bottom','top-start':'bottom-left','top-end':'bottom-right',right:'left','right-start':'left-top','right-end':'left-bottom',bottom:'top','bottom-start':'top-left','bottom-end':'top-right',left:'right','left-start':'right-top','left-end':'right-bottom'};return arrowPositionMappings[popperPlacement]||'top';}const COMPONENT_ID$2$2='tooltip.paragraph';const StyledParagraph=styled__default["default"].p.attrs({'data-garden-id':COMPONENT_ID$2$2,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledParagraph",componentId:"sc-wuqkfc-0"})(["margin:0;",";"],props=>retrieveComponentStyles(COMPONENT_ID$2$2,props));StyledParagraph.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$1$2='tooltip.title';const StyledTitle=styled__default["default"].strong.attrs({'data-garden-id':COMPONENT_ID$1$2,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledTitle",componentId:"sc-vnjcvz-0"})(["display:none;margin:0;font-weight:",";",";"],props=>props.theme.fontWeights.semibold,props=>retrieveComponentStyles(COMPONENT_ID$1$2,props));StyledTitle.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$7='tooltip.tooltip';const sizeStyles$2=_ref=>{let{theme,size,type,placement,hasArrow}=_ref;let margin=`${theme.space.base*1.5}px`;let borderRadius=theme.borderRadii.sm;let padding='0 1em';let maxWidth;let overflowWrap;let whiteSpace='nowrap';let lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.sm);let fontSize=theme.fontSizes.sm;let titleDisplay;let paragraphMarginTop;let wordWrap;if(size!=='small'){borderRadius=theme.borderRadii.md;overflowWrap='break-word';whiteSpace='normal';wordWrap='break-word';}if(size==='extra-large'){padding=`${theme.space.base*10}px`;maxWidth=`460px`;lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.md);paragraphMarginTop=`${theme.space.base*2.5}px`;}else if(size==='large'){padding=`${theme.space.base*5}px`;maxWidth=`270px`;lineHeight=getLineHeight(theme.space.base*5,theme.fontSizes.md);paragraphMarginTop=`${theme.space.base*2}px`;}else if(size==='medium'){padding='1em';maxWidth=`140px`;lineHeight=getLineHeight(theme.space.base*4,theme.fontSizes.sm);}if(size==='extra-large'||size==='large'){fontSize=theme.fontSizes.md;titleDisplay='block';}let arrowSize;let arrowInset;if(hasArrow){if(size==='small'||size==='medium'){arrowSize=margin;arrowInset=type==='dark'?'1px':'0';}else{arrowInset=type==='dark'?'2px':'1px';if(size==='large'){margin=`${theme.space.base*2}px`;arrowSize=margin;}else if(size==='extra-large'){margin=`${theme.space.base*3}px`;arrowSize=`${theme.space.base*2.5}px`;}}}return styled.css(["margin:",";border-radius:",";padding:",";max-width:",";line-height:",";word-wrap:",";white-space:",";font-size:",";overflow-wrap:",";",";","{margin-top:",";}","{display:",";}"],margin,borderRadius,padding,maxWidth,lineHeight,wordWrap,whiteSpace,fontSize,overflowWrap,hasArrow&&arrowStyles(getArrowPosition(placement),{size:arrowSize,inset:arrowInset}),StyledParagraph,paragraphMarginTop,StyledTitle,titleDisplay);};const colorStyles$1=_ref2=>{let{theme,type}=_ref2;let border;let boxShadow=theme.shadows.lg(`${theme.space.base}px`,`${theme.space.base*2}px`,getColor('chromeHue',600,theme,0.15));let backgroundColor=getColor('chromeHue',700,theme);let color=theme.colors.background;let titleColor;if(type==='light'){boxShadow=theme.shadows.lg(`${theme.space.base*3}px`,`${theme.space.base*5}px`,getColor('chromeHue',600,theme,0.15));border=`${theme.borders.sm} ${getColor('neutralHue',300,theme)}`;backgroundColor=theme.colors.background;color=getColor('neutralHue',700,theme);titleColor=theme.colors.foreground;}return styled.css(["border:",";box-shadow:",";background-color:",";color:",";","{color:",";}"],border,boxShadow,backgroundColor,color,StyledTitle,titleColor);};const StyledTooltip=styled__default["default"].div.attrs({'data-garden-id':COMPONENT_ID$7,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledTooltip",componentId:"sc-gzzjq4-0"})(["display:inline-block;box-sizing:border-box;direction:",";text-align:",";font-weight:",";",";&[aria-hidden='true']{display:none;}",";",";"],props=>props.theme.rtl&&'rtl',props=>props.theme.rtl?'right':'left',props=>props.theme.fontWeights.regular,props=>sizeStyles$2(props),colorStyles$1,props=>retrieveComponentStyles(COMPONENT_ID$7,props));StyledTooltip.defaultProps={theme:DEFAULT_THEME};const StyledTooltipWrapper=styled__default["default"].div.withConfig({displayName:"StyledTooltipWrapper",componentId:"sc-1b7q9q6-0"})(["transition:opacity 10ms;opacity:1;z-index:",";&[aria-hidden='true']{visibility:hidden;opacity:0;}"],props=>props.zIndex);StyledTooltipWrapper.defaultProps={theme:DEFAULT_THEME};const SHARED_PLACEMENT=['auto','top','top-start','top-end','bottom','bottom-start','bottom-end'];const PLACEMENT=[...SHARED_PLACEMENT,'end','end-top','end-bottom','start','start-top','start-bottom'];const SIZE$2=['small','medium','large','extra-large'];const TYPE=['light','dark'];const Tooltip$1=_ref=>{let{id,delayMS,isInitialVisible,content,refKey,placement,eventsEnabled,popperModifiers,children,hasArrow,size,type,appendToNode,zIndex,isVisible:externalIsVisible,...otherProps}=_ref;const{rtl}=React.useContext(styled.ThemeContext);const scheduleUpdateRef=React.useRef();const{isVisible,getTooltipProps,getTriggerProps,openTooltip,closeTooltip}=useTooltip({id,delayMilliseconds:delayMS,isVisible:isInitialVisible});const controlledIsVisible=getControlledValue(externalIsVisible,isVisible);React.useEffect(()=>{if(controlledIsVisible&&scheduleUpdateRef.current){scheduleUpdateRef.current();}},[controlledIsVisible,content]);const popperPlacement=rtl?getRtlPopperPlacement(placement):getPopperPlacement(placement);const singleChild=React__default["default"].Children.only(children);const modifiers={preventOverflow:{boundariesElement:'window'},...popperModifiers};return React__default["default"].createElement(Manager,null,React__default["default"].createElement(Reference,null,_ref2=>{let{ref}=_ref2;return React.cloneElement(singleChild,getTriggerProps({...singleChild.props,[refKey]:mergeRefs([ref,singleChild.ref?singleChild.ref:null])}));}),React__default["default"].createElement(Popper,{placement:popperPlacement,eventsEnabled:controlledIsVisible&&eventsEnabled,modifiers:modifiers},_ref3=>{let{ref,style,scheduleUpdate,placement:currentPlacement}=_ref3;scheduleUpdateRef.current=scheduleUpdate;const{onFocus,onBlur,...otherTooltipProps}=otherProps;let computedSize=size;if(computedSize===undefined){if(type==='dark'){computedSize='small';}else{computedSize='large';}}const tooltipProps={hasArrow,placement:currentPlacement,size:computedSize,onFocus:composeEventHandlers(onFocus,()=>{openTooltip();}),onBlur:composeEventHandlers(onBlur,()=>{closeTooltip(0);}),'aria-hidden':!controlledIsVisible,type,...otherTooltipProps};const tooltip=React__default["default"].createElement(StyledTooltipWrapper,{ref:controlledIsVisible?ref:null,style:style,zIndex:zIndex,"aria-hidden":!controlledIsVisible},React__default["default"].createElement(StyledTooltip,getTooltipProps(tooltipProps),content));if(appendToNode){return reactDom.createPortal(tooltip,appendToNode);}return tooltip;}));};Tooltip$1.displayName='Tooltip';Tooltip$1.propTypes={appendToNode:propTypes.exports.any,hasArrow:propTypes.exports.bool,delayMS:propTypes.exports.number,eventsEnabled:propTypes.exports.bool,id:propTypes.exports.string,content:propTypes.exports.node.isRequired,placement:propTypes.exports.oneOf(PLACEMENT),popperModifiers:propTypes.exports.any,size:propTypes.exports.oneOf(SIZE$2),type:propTypes.exports.oneOf(TYPE),zIndex:propTypes.exports.oneOfType([propTypes.exports.number,propTypes.exports.string]),isInitialVisible:propTypes.exports.bool,refKey:propTypes.exports.string};Tooltip$1.defaultProps={hasArrow:true,eventsEnabled:true,type:'dark',placement:'top',delayMS:500,refKey:'ref'};function _extends$4(){_extends$4=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends$4.apply(this,arguments);}const Paragraph=React.forwardRef((props,ref)=>React__default["default"].createElement(StyledParagraph,_extends$4({ref:ref},props)));Paragraph.displayName='Paragraph';const Title$1=React.forwardRef((props,ref)=>React__default["default"].createElement(StyledTitle,_extends$4({ref:ref},props)));Title$1.displayName='Title';var darkMode=styled.css(templateObject_1$6||(templateObject_1$6=__makeTemplateObject(["\n background: ",";\n"],["\n background: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.tooltip.darkBackground;});var Tooltip=styled__default["default"](Tooltip$1).attrs(function(_a){var appendToNode=_a.appendToNode,_b=_a.arrow,arrow=_b===void 0?false:_b,_c=_a.maxWidth,maxWidth=_c===void 0?"300px":_c,_d=_a.placement,placement=_d===void 0?"auto":_d,props=__rest(_a,["appendToNode","arrow","maxWidth","placement"]);return __assign({appendToNode:appendToNode!==null&&appendToNode!==void 0?appendToNode:document.body,delayMS:0,hasArrow:arrow,maxWidth:maxWidth,placement:placement,zIndex:999},props);})(templateObject_2$6||(templateObject_2$6=__makeTemplateObject(["\n && {\n max-width: ",";\n white-space: unset;\n ","\n }\n"],["\n && {\n max-width: ",";\n white-space: unset;\n ","\n }\n"])),function(_a){var maxWidth=_a.maxWidth;return"min(100vw, ".concat(maxWidth,")");},function(_a){var type=_a.type;return type!=="light"?darkMode:"";});var templateObject_1$6,templateObject_2$6;var lodash={exports:{}};/**
|
|
1910
1959
|
* @license
|
|
1911
1960
|
* Lodash <https://lodash.com/>
|
|
1912
1961
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -11381,6 +11430,97 @@ if(freeModule){// Export for Node.js.
|
|
|
11381
11430
|
(freeModule.exports=_)._=_;// Export for CommonJS support.
|
|
11382
11431
|
freeExports._=_;}else{// Export to the global object.
|
|
11383
11432
|
root._=_;}}).call(commonjsGlobal);})(lodash,lodash.exports);var DO_NOTHING=function(){};// @flow
|
|
11384
|
-
var isArray=function(o){return o instanceof Array;};var isString=function(o){return typeof o==="string";};var COMPONENT_NAME="Icon";var Icon=function(_a){var color=_a.color,_b=_a.size,size=_b===void 0?1:_b,svg=_a.svg,title=_a.title,_c=_a.onClick,onClick=_c===void 0?DO_NOTHING:_c;var svgString=svg;var svgStringList=svg;var SVGComp=svg;return isArray(svg)?jsxRuntime.jsx(MIcon.Stack,__assign({size:size,title:title,color:color||"currentColor","data-component-name":COMPONENT_NAME},{children:svgStringList.map(function(s,i){return jsxRuntime.jsx(MIcon__default["default"],{path:s},i);})})):isString(svg)?jsxRuntime.jsx(MIcon__default["default"],{path:svgString,size:size,title:title,color:color||"currentColor","data-component-name":COMPONENT_NAME}):jsxRuntime.jsx(SVGComp,{fill:color||"currentColor","data-component-name":COMPONENT_NAME,height:size,onClick:onClick,width:size});};Icon.COMPONENT_NAME=COMPONENT_NAME;var XXS=".3rem";var XS=".5rem";var SM="1rem";var MD="1.5rem";var LG="2rem";var XL="2.5rem";var XXL="3rem";var XXXL="4rem";var XXXXL="5rem";var SPACINGS=Object.freeze({XXS:XXS,XS:XS,SM:SM,MD:MD,LG:LG,XL:XL,XXL:XXL,XXXL:XXXL,XXXXL:XXXXL});Object.freeze({DOWN:"down",RIGHT:"right"});var getFlexDirection=function(_a){var reversed=_a.reversed,withRows=_a.withRows;var base=withRows?"column":"row";return reversed?"".concat(base,"-reverse"):base;};var FlexBox=styled__default["default"].div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n align-items: ",";\n display: ",";\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n ","\n ","\n ","\n"],["\n align-items: ",";\n display: ",";\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n ","\n ","\n ","\n"])),function(_a){var alignItems=_a.alignItems;return alignItems?alignItems:"initial";},function(p){return p.inline?"inline-flex":"flex";},getFlexDirection,function(p){return p.gap?p.gap:SPACINGS.SM;},function(p){return p.justifyContent||"initial";},function(p){return p.wrapped?wrappedStyling:"";},function(p){return p.fluid?"flex: 1;":"";},function(p){return p.responsivePropsList?responsiveStyles(p):"";},function(p){return p._css;});var responsiveStyles=function(_a){var responsivePropsList=_a.responsivePropsList,originalProps=__rest(_a,["responsivePropsList"]);return responsivePropsList===null||responsivePropsList===void 0?void 0:responsivePropsList.map(function(_a){var mediaQueryFunc=_a.mediaQueryFunc,rProps=_a.props;var props=__assign(__assign({},originalProps),rProps);var alignItems=props.alignItems,gap=props.gap,inline=props.inline,justifyContent=props.justifyContent,fluid=props.fluid,wrapped=props.wrapped;return mediaQueryFunc(styled.css(templateObject_2||(templateObject_2=__makeTemplateObject(["\n align-items: ",";\n display: ",";\n ","\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n "],["\n align-items: ",";\n display: ",";\n ","\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n "])),alignItems?alignItems:"initial",inline?"inline-flex":"flex",fluid?"flex: 1;":"",getFlexDirection(props),gap?gap:SPACINGS.SM,justifyContent||"initial",wrapped?wrappedStyling:"")).join("");});};var wrappedStyling=styled.css(templateObject_3||(templateObject_3=__makeTemplateObject(["\n flex-wrap: wrap;\n"],["\n flex-wrap: wrap;\n"])));var templateObject_1,templateObject_2,templateObject_3;var IconTooltip=function(_a){var children=_a.children,icon=_a.icon,iconProps=_a.iconProps,props=__rest(_a,["children","icon","iconProps"]);// @ts-ignore
|
|
11385
|
-
return jsxRuntime.jsx(Tooltip,__assign({},props,{content:children},{children:jsxRuntime.jsx(FlexBox,__assign({inline:true,css:"\n cursor: help;\n "},{children:jsxRuntime.jsx(Icon,__assign({size:"1.2rem"},iconProps,{svg:icon}))}))}));}
|
|
11433
|
+
var isArray=function(o){return o instanceof Array;};var isString=function(o){return typeof o==="string";};var COMPONENT_NAME="Icon";var Icon=function(_a){var color=_a.color,_b=_a.size,size=_b===void 0?1:_b,svg=_a.svg,title=_a.title,_c=_a.onClick,onClick=_c===void 0?DO_NOTHING:_c;var svgString=svg;var svgStringList=svg;var SVGComp=svg;return isArray(svg)?jsxRuntime.jsx(MIcon.Stack,__assign({size:size,title:title,color:color||"currentColor","data-component-name":COMPONENT_NAME},{children:svgStringList.map(function(s,i){return jsxRuntime.jsx(MIcon__default["default"],{path:s},i);})})):isString(svg)?jsxRuntime.jsx(MIcon__default["default"],{path:svgString,size:size,title:title,color:color||"currentColor","data-component-name":COMPONENT_NAME}):jsxRuntime.jsx(SVGComp,{fill:color||"currentColor","data-component-name":COMPONENT_NAME,height:size,onClick:onClick,width:size});};Icon.COMPONENT_NAME=COMPONENT_NAME;var XXS$1=".3rem";var XS$1=".5rem";var SM$1="1rem";var MD$1="1.5rem";var LG$1="2rem";var XL$1="2.5rem";var XXL$1="3rem";var XXXL$1="4rem";var XXXXL$1="5rem";var SPACINGS=Object.freeze({XXS:XXS$1,XS:XS$1,SM:SM$1,MD:MD$1,LG:LG$1,XL:XL$1,XXL:XXL$1,XXXL:XXXL$1,XXXXL:XXXXL$1});Object.freeze({DOWN:"down",RIGHT:"right"});var getFlexDirection=function(_a){var reversed=_a.reversed,withRows=_a.withRows;var base=withRows?"column":"row";return reversed?"".concat(base,"-reverse"):base;};var FlexBox=styled__default["default"].div(templateObject_1$5||(templateObject_1$5=__makeTemplateObject(["\n align-items: ",";\n display: ",";\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n ","\n ","\n ","\n"],["\n align-items: ",";\n display: ",";\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n ","\n ","\n ","\n"])),function(_a){var alignItems=_a.alignItems;return alignItems?alignItems:"initial";},function(p){return p.inline?"inline-flex":"flex";},getFlexDirection,function(p){return p.gap?p.gap:SPACINGS.SM;},function(p){return p.justifyContent||"initial";},function(p){return p.wrapped?wrappedStyling:"";},function(p){return p.fluid?"flex: 1;":"";},function(p){return p.responsivePropsList?responsiveStyles(p):"";},function(p){return p._css;});var responsiveStyles=function(_a){var responsivePropsList=_a.responsivePropsList,originalProps=__rest(_a,["responsivePropsList"]);return responsivePropsList===null||responsivePropsList===void 0?void 0:responsivePropsList.map(function(_a){var mediaQueryFunc=_a.mediaQueryFunc,rProps=_a.props;var props=__assign(__assign({},originalProps),rProps);var alignItems=props.alignItems,gap=props.gap,inline=props.inline,justifyContent=props.justifyContent,fluid=props.fluid,wrapped=props.wrapped;return mediaQueryFunc(styled.css(templateObject_2$5||(templateObject_2$5=__makeTemplateObject(["\n align-items: ",";\n display: ",";\n ","\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n "],["\n align-items: ",";\n display: ",";\n ","\n flex-direction: ",";\n gap: ",";\n justify-content: ",";\n ","\n "])),alignItems?alignItems:"initial",inline?"inline-flex":"flex",fluid?"flex: 1;":"",getFlexDirection(props),gap?gap:SPACINGS.SM,justifyContent||"initial",wrapped?wrappedStyling:"")).join("");});};var wrappedStyling=styled.css(templateObject_3$4||(templateObject_3$4=__makeTemplateObject(["\n flex-wrap: wrap;\n"],["\n flex-wrap: wrap;\n"])));var templateObject_1$5,templateObject_2$5,templateObject_3$4;var IconTooltip=function(_a){var children=_a.children,icon=_a.icon,iconProps=_a.iconProps,props=__rest(_a,["children","icon","iconProps"]);// @ts-ignore
|
|
11434
|
+
return jsxRuntime.jsx(Tooltip,__assign({},props,{content:children},{children:jsxRuntime.jsx(FlexBox,__assign({inline:true,css:"\n cursor: help;\n "},{children:jsxRuntime.jsx(Icon,__assign({size:"1.2rem"},iconProps,{svg:icon}))}))}));};/**
|
|
11435
|
+
* Copyright Zendesk, Inc.
|
|
11436
|
+
*
|
|
11437
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
11438
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
11439
|
+
*/const stateReducer=(state,action)=>{switch(action.type){case'END':case'HOME':case'FOCUS':case'INCREMENT':case'DECREMENT':{return{...state,focusedValue:action.payload};}case'MOUSE_SELECT':{return{...state,selectedValue:action.payload,focusedValue:undefined};}case'KEYBOARD_SELECT':{return{...state,selectedValue:action.payload};}case'EXIT_WIDGET':{return{...state,focusedValue:undefined};}default:return state;}};const useSelection=_ref=>{let{values,direction='horizontal',defaultFocusedValue=values[0],defaultSelectedValue,rtl,selectedValue,focusedValue,onSelect,onFocus}=_ref;const isSelectedValueControlled=selectedValue!==undefined;const isFocusedValueControlled=focusedValue!==undefined;const refs=React.useMemo(()=>values.reduce((all,value)=>{all[value]=React.createRef();return all;},{}),[values]);const[state,dispatch]=React.useReducer(stateReducer,{selectedValue,focusedValue});const controlledFocusedValue=getControlledValue(focusedValue,state.focusedValue);const controlledSelectedValue=getControlledValue(selectedValue,state.selectedValue);React.useEffect(()=>{if(controlledFocusedValue!==undefined){const targetRef=refs[controlledFocusedValue];targetRef?.current&&targetRef.current.focus();}},[controlledFocusedValue]);React.useEffect(()=>{if(selectedValue===undefined&&defaultSelectedValue!==undefined){onSelect&&onSelect(defaultSelectedValue);if(!isSelectedValueControlled){dispatch({type:'KEYBOARD_SELECT',payload:defaultSelectedValue});}}},[]);const getGroupProps=React.useCallback(function(_temp){let{role='group',...other}=_temp===void 0?{}:_temp;return{role:role===null?undefined:role,'data-garden-container-id':'containers.selection','data-garden-container-version':'3.0.4',...other};},[]);const getElementProps=_ref2=>{let{selectedAriaKey='aria-selected',onFocus:onFocusCallback,onKeyDown,onClick,value,...other}=_ref2;const isSelected=controlledSelectedValue===value;const isFocused=controlledFocusedValue===undefined?isSelected:controlledFocusedValue===value;const tabIndex=isFocused||controlledSelectedValue===undefined&&controlledFocusedValue===undefined&&value===defaultFocusedValue?0:-1;const verticalDirection=direction==='vertical'||direction==='both';const horizontalDirection=direction==='horizontal'||direction==='both';const handleFocus=()=>{onFocus&&onFocus(value);!isFocusedValueControlled&&dispatch({type:'FOCUS',payload:value});};const handleClick=()=>{onSelect&&onSelect(value);onFocus&&onFocus(value);!isSelectedValueControlled&&dispatch({type:'MOUSE_SELECT',payload:value});};const handleKeyDown=event=>{let nextItem;let currentItem;if(isFocusedValueControlled){currentItem=values.find(id=>focusedValue===id);}else{currentItem=values.find(id=>state.focusedValue===id);}const onIncrement=()=>{const nextItemIndex=values.indexOf(currentItem)+1;nextItem=values[nextItemIndex];if(!nextItem){nextItem=values[0];}!isFocusedValueControlled&&dispatch({type:'INCREMENT',payload:nextItem});onFocus&&onFocus(nextItem);};const onDecrement=()=>{const nextItemIndex=values.indexOf(currentItem)-1;nextItem=values[nextItemIndex];if(!nextItem){nextItem=values[values.length-1];}!isFocusedValueControlled&&dispatch({type:'DECREMENT',payload:nextItem});onFocus&&onFocus(nextItem);};const hasModifierKeyPressed=event.ctrlKey||event.metaKey||event.shiftKey||event.altKey;if(!hasModifierKeyPressed){if(event.key===KEYS.UP&&verticalDirection||event.key===KEYS.LEFT&&horizontalDirection){if(rtl&&horizontalDirection){onIncrement();}else{onDecrement();}event.preventDefault();}else if(event.key===KEYS.DOWN&&verticalDirection||event.key===KEYS.RIGHT&&horizontalDirection){if(rtl&&horizontalDirection){onDecrement();}else{onIncrement();}event.preventDefault();}else if(event.key===KEYS.HOME){const firstItem=values[0];!isFocusedValueControlled&&dispatch({type:'HOME',payload:firstItem});onFocus&&onFocus(firstItem);event.preventDefault();}else if(event.key===KEYS.END){const lastItem=values[values.length-1];!isFocusedValueControlled&&dispatch({type:'END',payload:lastItem});onFocus&&onFocus(lastItem);event.preventDefault();}else if(event.key===KEYS.SPACE||event.key===KEYS.ENTER){onSelect&&onSelect(value);!isSelectedValueControlled&&dispatch({type:'KEYBOARD_SELECT',payload:value});event.preventDefault();}}};const onBlur=event=>{if(event.target.tabIndex===0){dispatch({type:'EXIT_WIDGET'});onFocus&&onFocus();}};return{tabIndex,[selectedAriaKey]:selectedAriaKey?isSelected:undefined,ref:refs[value],onFocus:composeEventHandlers(onFocusCallback,handleFocus),onClick:composeEventHandlers(onClick,handleClick),onKeyDown:composeEventHandlers(onKeyDown,handleKeyDown),onBlur,...other};};return{focusedValue:controlledFocusedValue,selectedValue:controlledSelectedValue,getElementProps,getGroupProps};};({children:propTypes.exports.func,render:propTypes.exports.func,values:propTypes.exports.arrayOf(propTypes.exports.any).isRequired,rtl:propTypes.exports.bool,direction:propTypes.exports.oneOf(['horizontal','vertical','both']),defaultFocusedValue:propTypes.exports.string,defaultSelectedValue:propTypes.exports.string,focusedValue:propTypes.exports.any,selectedValue:propTypes.exports.any,onSelect:propTypes.exports.func,onFocus:propTypes.exports.func});/**
|
|
11440
|
+
* Copyright Zendesk, Inc.
|
|
11441
|
+
*
|
|
11442
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
11443
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
11444
|
+
*/function _extends$2(){_extends$2=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends$2.apply(this,arguments);}const SIZE$1=['small','medium','large'];const COMPONENT_ID$5$1='buttons.button_group_view';const StyledButtonGroup=styled__default["default"].div.attrs({'data-garden-id':COMPONENT_ID$5$1,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledButtonGroup",componentId:"sc-1fbpzef-0"})(["display:inline-flex;position:relative;z-index:0;direction:",";white-space:nowrap;",";"],props=>props.theme.rtl&&'rtl',props=>retrieveComponentStyles(COMPONENT_ID$5$1,props));StyledButtonGroup.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$4$1='buttons.icon';const sizeStyles$1=props=>{let marginProperty;if(props.position==='start'){marginProperty=`margin-${props.theme.rtl?'left':'right'}`;}else if(props.position==='end'){marginProperty=`margin-${props.theme.rtl?'right':'left'}`;}return marginProperty&&styled.css(["",":","px;"],marginProperty,props.theme.space.base*2);};const StyledIcon=styled__default["default"](_ref=>{let{children,isRotated,theme,...props}=_ref;return React__default["default"].cloneElement(React.Children.only(children),props);}).attrs({'data-garden-id':COMPONENT_ID$4$1,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledIcon",componentId:"sc-19meqgg-0"})(["transform:",";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;",";",";"],props=>props.isRotated&&`rotate(${props.theme.rtl?'-':'+'}180deg)`,props=>sizeStyles$1(props),props=>retrieveComponentStyles(COMPONENT_ID$4$1,props));StyledIcon.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$3$1='buttons.button';const getBorderRadius=props=>{if(props.isPill){return'100px';}return props.theme.borderRadii.md;};const getDisabledBackgroundColor=props=>{return getColor('neutralHue',200,props.theme);};const getHeight$1=props=>{if(props.size==='small'){return`${props.theme.space.base*8}px`;}else if(props.size==='large'){return`${props.theme.space.base*12}px`;}return`${props.theme.space.base*10}px`;};const colorStyles=props=>{let retVal;let hue;if(props.disabled||props.isNeutral&&(props.isPrimary||props.isSelected)&&!props.isDanger){hue='neutralHue';}else if(props.isDanger){hue='dangerHue';}else{hue='primaryHue';}const shade=600;const baseColor=getColor(hue,shade,props.theme);const hoverColor=getColor(hue,shade+100,props.theme);const activeColor=getColor(hue,shade+200,props.theme);const focusColor=getColor('primaryHue',shade,props.theme);const disabledBackgroundColor=getDisabledBackgroundColor(props);const disabledForegroundColor=getColor(hue,shade-200,props.theme);if(props.isLink){retVal=styled.css(["outline-color:transparent;background-color:transparent;color:",";"," &:hover{color:",";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:",";}&:disabled{color:",";}"],baseColor,focusStyles({theme:props.theme,condition:false,styles:{color:baseColor,outlineColor:focusColor}}),hoverColor,activeColor,disabledForegroundColor);}else if(props.isPrimary||props.isSelected){retVal=styled.css(["outline-color:transparent;background-color:",";color:",";&:hover{background-color:",";}"," &:active{background-color:",";}&[aria-pressed='true'],&[aria-pressed='mixed']{background-color:",";}&:disabled{background-color:",";color:",";}"],props.isPrimary&&props.isSelected?activeColor:baseColor,props.theme.palette.white,hoverColor,focusStyles({theme:props.theme,inset:props.focusInset,shadowWidth:props.focusInset?'sm':'md',spacerWidth:props.focusInset?'sm':'xs',styles:props.isDanger&&props.focusInset?{borderColor:focusColor}:undefined}),activeColor,props.isPrimary&&activeColor,disabledBackgroundColor,disabledForegroundColor);}else{const borderColor=props.isNeutral&&!props.isDanger?getColor('neutralHue',300,props.theme):baseColor;const foregroundColor=props.isNeutral?props.theme.colors.foreground:baseColor;const hoverBorderColor=props.isNeutral&&!props.isDanger?baseColor:hoverColor;const hoverForegroundColor=props.isNeutral?foregroundColor:hoverColor;retVal=styled.css(["outline-color:transparent;border-color:",";background-color:transparent;color:",";&:hover{border-color:",";background-color:",";color:",";}"," &:active,&[aria-pressed='true'],&[aria-pressed='mixed']{border-color:",";background-color:",";color:",";}&:disabled{border-color:transparent;background-color:",";color:",";}& ","{color:",";}&:hover ",",&:focus-visible ",",&[data-garden-focus-visible] ","{color:",";}&:active ","{color:",";}&:disabled ","{color:",";}"],!props.isBasic&&borderColor,foregroundColor,!props.isBasic&&hoverBorderColor,rgba(baseColor,0.08),hoverForegroundColor,focusStyles({theme:props.theme,inset:props.focusInset,styles:props.isNeutral?{borderColor:baseColor}:undefined}),!props.isBasic&&activeColor,rgba(baseColor,0.2),!props.isNeutral&&activeColor,disabledBackgroundColor,disabledForegroundColor,StyledIcon,props.isNeutral&&getColor('neutralHue',shade,props.theme),StyledIcon,StyledIcon,StyledIcon,props.isNeutral&&getColor('neutralHue',shade+100,props.theme),StyledIcon,props.isNeutral&&foregroundColor,StyledIcon,disabledForegroundColor);}return retVal;};const groupStyles=props=>{const{theme,isPrimary,isBasic,isSelected,isPill,focusInset}=props;const{rtl,borderWidths,borders}=theme;const startPosition=rtl?'right':'left';const endPosition=rtl?'left':'right';const marginOffset=borderWidths.sm;const marginDisplacement=`${isPrimary||isBasic?'':'-'}${marginOffset}`;const iconMarginDisplacement=isPill&&'-2px';const disabledBackgroundColor=!isPrimary&&getDisabledBackgroundColor(props);const borderColor=isBasic?'transparent':'revert';const focusColor=getColor('primaryHue',600,theme);const focusBoxShadow=isBasic&&!isSelected&&!isPrimary&&getFocusBoxShadow({theme,inset:focusInset,spacerHue:focusColor,hue:'transparent'});return styled.css(["position:relative;transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,margin-"," 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;border:"," ",";","{border-color:",";box-shadow:",";}&:hover,&:active,","{z-index:1;}&:disabled{z-index:-1;background-color:",";}&:not(:first-of-type){margin-",":",";}&:not(:first-of-type):disabled{margin-",":",";}&:not(:first-of-type):not(:last-of-type){border-radius:0;}&:first-of-type:not(:last-of-type){border-top-","-radius:0;border-bottom-","-radius:0;}&:last-of-type:not(:first-of-type){border-top-","-radius:0;border-bottom-","-radius:0;}&:first-of-type:not(:last-of-type) ","{margin-",":",";}&:last-of-type:not(:first-of-type) ","{margin-",":",";}"],startPosition,borders.sm,borderColor,SELECTOR_FOCUS_VISIBLE,focusColor,focusBoxShadow,SELECTOR_FOCUS_VISIBLE,disabledBackgroundColor,startPosition,marginDisplacement,startPosition,marginOffset,endPosition,endPosition,startPosition,startPosition,StyledIcon,endPosition,iconMarginDisplacement,StyledIcon,startPosition,iconMarginDisplacement);};const iconStyles$1=props=>{const size=props.size==='small'?props.theme.iconSizes.sm:props.theme.iconSizes.md;return styled.css(["width:",";min-width:",";height:",";vertical-align:",";"],size,size,size,props.isLink&&'middle');};const sizeStyles=props=>{let retVal;if(props.isLink){retVal=styled.css(["padding:0;font-size:inherit;"]);}else{const height=getHeight$1(props);const lineHeight=math(`${height} - (${props.theme.borderWidths.sm} * 2)`);let padding;let fontSize;if(props.size==='small'){fontSize=props.theme.fontSizes.sm;padding=`${props.theme.space.base*3}px`;}else{fontSize=props.theme.fontSizes.md;if(props.size==='large'){padding=`${props.theme.space.base*5}px`;}else{padding=`${props.theme.space.base*4}px`;}}retVal=styled.css(["padding:0 ",";height:",";line-height:",";font-size:",";"],em$1(math(`${padding} - ${props.theme.borderWidths.sm}`),fontSize),height,lineHeight,fontSize);}return retVal;};const StyledButton=styled__default["default"].button.attrs(props=>({'data-garden-id':COMPONENT_ID$3$1,'data-garden-version':'8.70.0',type:props.type||'button'})).withConfig({displayName:"StyledButton",componentId:"sc-qe3ace-0"})(["display:",";align-items:",";justify-content:",";transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;margin:0;border:",";border-radius:",";cursor:pointer;width:",";overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:",";font-family:inherit;font-weight:",";-webkit-font-smoothing:subpixel-antialiased;box-sizing:border-box;user-select:",";-webkit-touch-callout:none;",";&::-moz-focus-inner{border:0;padding:0;}","{text-decoration:none;}&:hover{text-decoration:",";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;text-decoration:",";}",";&:disabled{cursor:default;text-decoration:",";}& ","{","}"," &&{","}",""],props=>props.isLink?'inline':'inline-flex',props=>!props.isLink&&'center',props=>!props.isLink&&'center',props=>`${props.isLink?`0px solid`:props.theme.borders.sm} transparent`,props=>getBorderRadius(props),props=>props.isStretched?'100%':'',props=>!props.isLink&&'nowrap',props=>props.isLink?'inherit':props.theme.fontWeights.regular,props=>!props.isLink&&'none',props=>sizeStyles(props),SELECTOR_FOCUS_VISIBLE,props=>props.isLink?'underline':'none',props=>props.isLink?'underline':'none',props=>colorStyles(props),props=>props.isLink&&'none',StyledIcon,props=>iconStyles$1(props),StyledButtonGroup,props=>groupStyles(props),props=>retrieveComponentStyles(COMPONENT_ID$3$1,props));StyledButton.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$2$1='buttons.anchor';const StyledAnchor=styled__default["default"](StyledButton).attrs(props=>({'data-garden-id':COMPONENT_ID$2$1,'data-garden-version':'8.70.0',as:'a',dir:props.theme.rtl?'rtl':undefined,isLink:true,type:undefined})).withConfig({displayName:"StyledAnchor",componentId:"sc-xshgmo-0"})(["direction:",";",";"],props=>props.theme.rtl&&'rtl',props=>retrieveComponentStyles(COMPONENT_ID$2$1,props));StyledAnchor.defaultProps={theme:DEFAULT_THEME};var _path$1;function _extends$1(){_extends$1=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends$1.apply(this,arguments);}var SvgNewWindowStroke=function SvgNewWindowStroke(props){return/*#__PURE__*/React__namespace.createElement("svg",_extends$1({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,focusable:"false",viewBox:"0 0 12 12","aria-hidden":"true"},props),_path$1||(_path$1=/*#__PURE__*/React__namespace.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",d:"M10.5 8.5V10c0 .3-.2.5-.5.5H2c-.3 0-.5-.2-.5-.5V2c0-.3.2-.5.5-.5h1.5M6 6l4-4m-3.5-.5H10c.3 0 .5.2.5.5v3.5"})));};const COMPONENT_ID$1$1='buttons.external_icon';const StyledExternalIcon=styled__default["default"](SvgNewWindowStroke).attrs({'data-garden-id':COMPONENT_ID$1$1,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledExternalIcon",componentId:"sc-16oz07e-0"})(["transform:",";margin-bottom:-0.085em;padding-left:0.25em;box-sizing:content-box;width:0.85em;height:0.85em;",";"],props=>props.theme.rtl&&'scaleX(-1)',props=>retrieveComponentStyles(COMPONENT_ID$1$1,props));StyledExternalIcon.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$6='buttons.icon_button';const iconColorStyles=props=>{const shade=600;const baseColor=getColor('neutralHue',shade,props.theme);const hoverColor=getColor('neutralHue',shade+100,props.theme);const activeColor=getColor('neutralHue',shade+200,props.theme);return styled.css(["color:",";&:hover{color:",";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:",";}"],baseColor,hoverColor,activeColor);};const iconButtonStyles=props=>{const width=getHeight$1(props);return styled.css(["border:",";padding:0;width:",";min-width:",";",";&:disabled{background-color:",";}"],props.isBasic&&'none',width,width,props.isBasic&&!(props.isPrimary||props.isDanger||props.disabled)&&iconColorStyles(props),!props.isPrimary&&'transparent');};const iconStyles=props=>{const size=props.theme.iconSizes.md;return styled.css(["width:",";height:",";& > svg{transition:opacity 0.15s ease-in-out;}"],size,size);};const StyledIconButton=styled__default["default"](StyledButton).attrs({'data-garden-id':COMPONENT_ID$6,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledIconButton",componentId:"sc-1t0ughp-0"})(["",";& ","{","}",";"],props=>iconButtonStyles(props),StyledIcon,props=>iconStyles(props),props=>retrieveComponentStyles(COMPONENT_ID$6,props));StyledIconButton.defaultProps={theme:DEFAULT_THEME};const ButtonGroupContext=React.createContext(undefined);const useButtonGroupContext=()=>{return React.useContext(ButtonGroupContext);};const SplitButtonContext=React.createContext(undefined);const useSplitButtonContext=()=>{return React.useContext(SplitButtonContext);};const StartIconComponent=props=>React__default["default"].createElement(StyledIcon,_extends$2({position:"start"},props));StartIconComponent.displayName='Button.StartIcon';const StartIcon=StartIconComponent;const EndIconComponent=props=>React__default["default"].createElement(StyledIcon,_extends$2({position:"end"},props));EndIconComponent.displayName='Button.EndIcon';const EndIcon=EndIconComponent;const ButtonComponent=React.forwardRef((props,ref)=>{const buttonGroupContext=useButtonGroupContext();const splitButtonContext=useSplitButtonContext();let computedRef=ref;let computedProps={...props,focusInset:props.focusInset||buttonGroupContext!==undefined||splitButtonContext};if(buttonGroupContext&&!props.disabled){if(!props.value){throw new Error('"value" prop must be provided to Button when used within a ButtonGroup');}computedProps=buttonGroupContext.getButtonProps({isSelected:props.value===buttonGroupContext.selectedItem,...computedProps});computedRef=mergeRefs([computedProps.ref,ref]);}return React__default["default"].createElement(StyledButton,_extends$2({},computedProps,{ref:computedRef}));});ButtonComponent.displayName='Button';ButtonComponent.propTypes={isNeutral:propTypes.exports.bool,isPrimary:propTypes.exports.bool,isDanger:propTypes.exports.bool,isPill:propTypes.exports.bool,isBasic:propTypes.exports.bool,focusInset:propTypes.exports.bool,isLink:propTypes.exports.bool,isStretched:propTypes.exports.bool,isSelected:propTypes.exports.bool,size:propTypes.exports.oneOf(SIZE$1)};ButtonComponent.defaultProps={size:'medium'};const Button$1=ButtonComponent;Button$1.EndIcon=EndIcon;Button$1.StartIcon=StartIcon;const Anchor=React.forwardRef((_ref,ref)=>{let{children,isExternal,externalIconLabel,...otherProps}=_ref;let anchorProps=otherProps;if(isExternal){anchorProps={target:'_blank',rel:'noopener noreferrer',...anchorProps};}const checkProps=isExternal?{externalIconLabel}:{noIconLabel:'true'};const iconAriaLabel=useText(Anchor,checkProps,isExternal?'externalIconLabel':'noIconLabel','(opens in a new tab)');return React__default["default"].createElement(StyledAnchor,_extends$2({ref:ref},anchorProps),children,isExternal&&React__default["default"].createElement(StyledExternalIcon,{role:"img","aria-label":iconAriaLabel,"aria-hidden":undefined}));});Anchor.displayName='Anchor';Anchor.propTypes={isExternal:propTypes.exports.bool,isDanger:propTypes.exports.bool,externalIconLabel:propTypes.exports.string};const ButtonGroup=React.forwardRef((_ref,ref)=>{let{children,onSelect,selectedItem:controlledSelectedValue,...otherProps}=_ref;const{rtl}=React.useContext(styled.ThemeContext)||DEFAULT_THEME;const[internalSelectedValue,setInternalSelectedValue]=React.useState();const selectedValue=getControlledValue(controlledSelectedValue,internalSelectedValue);const values=React.useMemo(()=>React.Children.toArray(children).reduce((buttons,child)=>{if(React.isValidElement(child)&&child.type!=='string'&&!child.props.disabled){buttons.push(child.props.value);}return buttons;},[]),[children]);const{selectedValue:selectedItem,getElementProps,getGroupProps}=useSelection({rtl,values,defaultSelectedValue:values[0],selectedValue,onSelect:React.useCallback(value=>{onSelect&&onSelect(value);setInternalSelectedValue(value);},[onSelect])});const contextValue=React.useMemo(()=>({selectedItem,getButtonProps:props=>getElementProps({role:'button',selectedAriaKey:'aria-pressed',...props})}),[selectedItem,getElementProps]);return React__default["default"].createElement(ButtonGroupContext.Provider,{value:contextValue},React__default["default"].createElement(StyledButtonGroup,_extends$2({ref:ref},getGroupProps(otherProps)),children));});ButtonGroup.displayName='ButtonGroup';ButtonGroup.propTypes={selectedItem:propTypes.exports.any,onSelect:propTypes.exports.func};const IconButton=React.forwardRef((_ref,ref)=>{let{children,isRotated,...otherProps}=_ref;const focusInset=useSplitButtonContext();return React__default["default"].createElement(StyledIconButton,_extends$2({ref:ref},otherProps,{focusInset:otherProps.focusInset||focusInset}),React__default["default"].createElement(StyledIcon,{isRotated:isRotated},children));});IconButton.displayName='IconButton';IconButton.propTypes={isDanger:propTypes.exports.bool,size:propTypes.exports.oneOf(SIZE$1),isNeutral:propTypes.exports.bool,isPrimary:propTypes.exports.bool,isBasic:propTypes.exports.bool,isPill:propTypes.exports.bool,focusInset:propTypes.exports.bool,isRotated:propTypes.exports.bool};IconButton.defaultProps={isPill:true,isBasic:true,size:'medium'};var _path;function _extends$3(){_extends$3=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends$3.apply(this,arguments);}var SvgChevronDownStroke=function SvgChevronDownStroke(props){return/*#__PURE__*/React__namespace.createElement("svg",_extends$3({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,focusable:"false",viewBox:"0 0 16 16","aria-hidden":"true"},props),_path||(_path=/*#__PURE__*/React__namespace.createElement("path",{fill:"currentColor",d:"M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"})));};const ChevronButton=React.forwardRef((_ref,ref)=>{let{...buttonProps}=_ref;return React__default["default"].createElement(IconButton,_extends$2({ref:ref},buttonProps),React__default["default"].createElement(SvgChevronDownStroke,null));});ChevronButton.displayName='ChevronButton';ChevronButton.propTypes=IconButton.propTypes;ChevronButton.defaultProps={isBasic:false,isPill:false,size:'medium'};const SplitButton=React.forwardRef((_ref,ref)=>{let{children,...other}=_ref;return React__default["default"].createElement(SplitButtonContext.Provider,{value:true},React__default["default"].createElement(StyledButtonGroup,_extends$2({ref:ref},other),children));});SplitButton.displayName='SplitButton';const ToggleButton=React.forwardRef((_ref,ref)=>{let{isPressed,...otherProps}=_ref;return React__default["default"].createElement(Button$1,_extends$2({"aria-pressed":isPressed,ref:ref},otherProps));});ToggleButton.displayName='ToggleButton';ToggleButton.propTypes={...Button$1.propTypes,isPressed:propTypes.exports.oneOf([true,false,'mixed'])};ToggleButton.defaultProps={size:'medium'};const ToggleIconButton=React.forwardRef((_ref,ref)=>{let{isPressed,...otherProps}=_ref;return React__default["default"].createElement(IconButton,_extends$2({"aria-pressed":isPressed,ref:ref},otherProps));});ToggleIconButton.displayName='ToggleIconButton';ToggleIconButton.propTypes={...IconButton.propTypes,isPressed:propTypes.exports.oneOf([true,false,'mixed'])};ToggleIconButton.defaultProps={isPill:true,isBasic:true,size:'medium'};var colorString$1={exports:{}};var colorName$1={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};var simpleSwizzle={exports:{}};var isArrayish$1=function isArrayish(obj){if(!obj||typeof obj==='string'){return false;}return obj instanceof Array||Array.isArray(obj)||obj.length>=0&&(obj.splice instanceof Function||Object.getOwnPropertyDescriptor(obj,obj.length-1)&&obj.constructor.name!=='String');};var isArrayish=isArrayish$1;var concat=Array.prototype.concat;var slice=Array.prototype.slice;var swizzle$1=simpleSwizzle.exports=function swizzle(args){var results=[];for(var i=0,len=args.length;i<len;i++){var arg=args[i];if(isArrayish(arg)){// http://jsperf.com/javascript-array-concat-vs-push/98
|
|
11445
|
+
results=concat.call(results,slice.call(arg));}else{results.push(arg);}}return results;};swizzle$1.wrap=function(fn){return function(){return fn(swizzle$1(arguments));};};/* MIT license */var colorNames=colorName$1;var swizzle=simpleSwizzle.exports;var hasOwnProperty=Object.hasOwnProperty;var reverseNames=Object.create(null);// create a list of reverse color names
|
|
11446
|
+
for(var name in colorNames){if(hasOwnProperty.call(colorNames,name)){reverseNames[colorNames[name]]=name;}}var cs=colorString$1.exports={to:{},get:{}};cs.get=function(string){var prefix=string.substring(0,3).toLowerCase();var val;var model;switch(prefix){case'hsl':val=cs.get.hsl(string);model='hsl';break;case'hwb':val=cs.get.hwb(string);model='hwb';break;default:val=cs.get.rgb(string);model='rgb';break;}if(!val){return null;}return{model:model,value:val};};cs.get.rgb=function(string){if(!string){return null;}var abbr=/^#([a-f0-9]{3,4})$/i;var hex=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i;var rgba=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;var per=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;var keyword=/^(\w+)$/;var rgb=[0,0,0,1];var match;var i;var hexAlpha;if(match=string.match(hex)){hexAlpha=match[2];match=match[1];for(i=0;i<3;i++){// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
11447
|
+
var i2=i*2;rgb[i]=parseInt(match.slice(i2,i2+2),16);}if(hexAlpha){rgb[3]=parseInt(hexAlpha,16)/255;}}else if(match=string.match(abbr)){match=match[1];hexAlpha=match[3];for(i=0;i<3;i++){rgb[i]=parseInt(match[i]+match[i],16);}if(hexAlpha){rgb[3]=parseInt(hexAlpha+hexAlpha,16)/255;}}else if(match=string.match(rgba)){for(i=0;i<3;i++){rgb[i]=parseInt(match[i+1],0);}if(match[4]){if(match[5]){rgb[3]=parseFloat(match[4])*0.01;}else{rgb[3]=parseFloat(match[4]);}}}else if(match=string.match(per)){for(i=0;i<3;i++){rgb[i]=Math.round(parseFloat(match[i+1])*2.55);}if(match[4]){if(match[5]){rgb[3]=parseFloat(match[4])*0.01;}else{rgb[3]=parseFloat(match[4]);}}}else if(match=string.match(keyword)){if(match[1]==='transparent'){return[0,0,0,0];}if(!hasOwnProperty.call(colorNames,match[1])){return null;}rgb=colorNames[match[1]];rgb[3]=1;return rgb;}else{return null;}for(i=0;i<3;i++){rgb[i]=clamp(rgb[i],0,255);}rgb[3]=clamp(rgb[3],0,1);return rgb;};cs.get.hsl=function(string){if(!string){return null;}var hsl=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;var match=string.match(hsl);if(match){var alpha=parseFloat(match[4]);var h=(parseFloat(match[1])%360+360)%360;var s=clamp(parseFloat(match[2]),0,100);var l=clamp(parseFloat(match[3]),0,100);var a=clamp(isNaN(alpha)?1:alpha,0,1);return[h,s,l,a];}return null;};cs.get.hwb=function(string){if(!string){return null;}var hwb=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;var match=string.match(hwb);if(match){var alpha=parseFloat(match[4]);var h=(parseFloat(match[1])%360+360)%360;var w=clamp(parseFloat(match[2]),0,100);var b=clamp(parseFloat(match[3]),0,100);var a=clamp(isNaN(alpha)?1:alpha,0,1);return[h,w,b,a];}return null;};cs.to.hex=function(){var rgba=swizzle(arguments);return'#'+hexDouble(rgba[0])+hexDouble(rgba[1])+hexDouble(rgba[2])+(rgba[3]<1?hexDouble(Math.round(rgba[3]*255)):'');};cs.to.rgb=function(){var rgba=swizzle(arguments);return rgba.length<4||rgba[3]===1?'rgb('+Math.round(rgba[0])+', '+Math.round(rgba[1])+', '+Math.round(rgba[2])+')':'rgba('+Math.round(rgba[0])+', '+Math.round(rgba[1])+', '+Math.round(rgba[2])+', '+rgba[3]+')';};cs.to.rgb.percent=function(){var rgba=swizzle(arguments);var r=Math.round(rgba[0]/255*100);var g=Math.round(rgba[1]/255*100);var b=Math.round(rgba[2]/255*100);return rgba.length<4||rgba[3]===1?'rgb('+r+'%, '+g+'%, '+b+'%)':'rgba('+r+'%, '+g+'%, '+b+'%, '+rgba[3]+')';};cs.to.hsl=function(){var hsla=swizzle(arguments);return hsla.length<4||hsla[3]===1?'hsl('+hsla[0]+', '+hsla[1]+'%, '+hsla[2]+'%)':'hsla('+hsla[0]+', '+hsla[1]+'%, '+hsla[2]+'%, '+hsla[3]+')';};// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
11448
|
+
// (hwb have alpha optional & 1 is default value)
|
|
11449
|
+
cs.to.hwb=function(){var hwba=swizzle(arguments);var a='';if(hwba.length>=4&&hwba[3]!==1){a=', '+hwba[3];}return'hwb('+hwba[0]+', '+hwba[1]+'%, '+hwba[2]+'%'+a+')';};cs.to.keyword=function(rgb){return reverseNames[rgb.slice(0,3)];};// helpers
|
|
11450
|
+
function clamp(num,min,max){return Math.min(Math.max(min,num),max);}function hexDouble(num){var str=Math.round(num).toString(16).toUpperCase();return str.length<2?'0'+str:str;}var colorName={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};/* MIT license */ /* eslint-disable no-mixed-operators */const cssKeywords=colorName;// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
11451
|
+
// values that give correct `typeof` results).
|
|
11452
|
+
// do not use box values types (i.e. Number(), String(), etc.)
|
|
11453
|
+
const reverseKeywords={};for(const key of Object.keys(cssKeywords)){reverseKeywords[cssKeywords[key]]=key;}const convert$2={rgb:{channels:3,labels:'rgb'},hsl:{channels:3,labels:'hsl'},hsv:{channels:3,labels:'hsv'},hwb:{channels:3,labels:'hwb'},cmyk:{channels:4,labels:'cmyk'},xyz:{channels:3,labels:'xyz'},lab:{channels:3,labels:'lab'},lch:{channels:3,labels:'lch'},hex:{channels:1,labels:['hex']},keyword:{channels:1,labels:['keyword']},ansi16:{channels:1,labels:['ansi16']},ansi256:{channels:1,labels:['ansi256']},hcg:{channels:3,labels:['h','c','g']},apple:{channels:3,labels:['r16','g16','b16']},gray:{channels:1,labels:['gray']}};var conversions$2=convert$2;// Hide .channels and .labels properties
|
|
11454
|
+
for(const model of Object.keys(convert$2)){if(!('channels'in convert$2[model])){throw new Error('missing channels property: '+model);}if(!('labels'in convert$2[model])){throw new Error('missing channel labels property: '+model);}if(convert$2[model].labels.length!==convert$2[model].channels){throw new Error('channel and label counts mismatch: '+model);}const{channels,labels}=convert$2[model];delete convert$2[model].channels;delete convert$2[model].labels;Object.defineProperty(convert$2[model],'channels',{value:channels});Object.defineProperty(convert$2[model],'labels',{value:labels});}convert$2.rgb.hsl=function(rgb){const r=rgb[0]/255;const g=rgb[1]/255;const b=rgb[2]/255;const min=Math.min(r,g,b);const max=Math.max(r,g,b);const delta=max-min;let h;let s;if(max===min){h=0;}else if(r===max){h=(g-b)/delta;}else if(g===max){h=2+(b-r)/delta;}else if(b===max){h=4+(r-g)/delta;}h=Math.min(h*60,360);if(h<0){h+=360;}const l=(min+max)/2;if(max===min){s=0;}else if(l<=0.5){s=delta/(max+min);}else{s=delta/(2-max-min);}return[h,s*100,l*100];};convert$2.rgb.hsv=function(rgb){let rdif;let gdif;let bdif;let h;let s;const r=rgb[0]/255;const g=rgb[1]/255;const b=rgb[2]/255;const v=Math.max(r,g,b);const diff=v-Math.min(r,g,b);const diffc=function(c){return(v-c)/6/diff+1/2;};if(diff===0){h=0;s=0;}else{s=diff/v;rdif=diffc(r);gdif=diffc(g);bdif=diffc(b);if(r===v){h=bdif-gdif;}else if(g===v){h=1/3+rdif-bdif;}else if(b===v){h=2/3+gdif-rdif;}if(h<0){h+=1;}else if(h>1){h-=1;}}return[h*360,s*100,v*100];};convert$2.rgb.hwb=function(rgb){const r=rgb[0];const g=rgb[1];let b=rgb[2];const h=convert$2.rgb.hsl(rgb)[0];const w=1/255*Math.min(r,Math.min(g,b));b=1-1/255*Math.max(r,Math.max(g,b));return[h,w*100,b*100];};convert$2.rgb.cmyk=function(rgb){const r=rgb[0]/255;const g=rgb[1]/255;const b=rgb[2]/255;const k=Math.min(1-r,1-g,1-b);const c=(1-r-k)/(1-k)||0;const m=(1-g-k)/(1-k)||0;const y=(1-b-k)/(1-k)||0;return[c*100,m*100,y*100,k*100];};function comparativeDistance(x,y){/*
|
|
11455
|
+
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
11456
|
+
*/return(x[0]-y[0])**2+(x[1]-y[1])**2+(x[2]-y[2])**2;}convert$2.rgb.keyword=function(rgb){const reversed=reverseKeywords[rgb];if(reversed){return reversed;}let currentClosestDistance=Infinity;let currentClosestKeyword;for(const keyword of Object.keys(cssKeywords)){const value=cssKeywords[keyword];// Compute comparative distance
|
|
11457
|
+
const distance=comparativeDistance(rgb,value);// Check if its less, if so set as closest
|
|
11458
|
+
if(distance<currentClosestDistance){currentClosestDistance=distance;currentClosestKeyword=keyword;}}return currentClosestKeyword;};convert$2.keyword.rgb=function(keyword){return cssKeywords[keyword];};convert$2.rgb.xyz=function(rgb){let r=rgb[0]/255;let g=rgb[1]/255;let b=rgb[2]/255;// Assume sRGB
|
|
11459
|
+
r=r>0.04045?((r+0.055)/1.055)**2.4:r/12.92;g=g>0.04045?((g+0.055)/1.055)**2.4:g/12.92;b=b>0.04045?((b+0.055)/1.055)**2.4:b/12.92;const x=r*0.4124+g*0.3576+b*0.1805;const y=r*0.2126+g*0.7152+b*0.0722;const z=r*0.0193+g*0.1192+b*0.9505;return[x*100,y*100,z*100];};convert$2.rgb.lab=function(rgb){const xyz=convert$2.rgb.xyz(rgb);let x=xyz[0];let y=xyz[1];let z=xyz[2];x/=95.047;y/=100;z/=108.883;x=x>0.008856?x**(1/3):7.787*x+16/116;y=y>0.008856?y**(1/3):7.787*y+16/116;z=z>0.008856?z**(1/3):7.787*z+16/116;const l=116*y-16;const a=500*(x-y);const b=200*(y-z);return[l,a,b];};convert$2.hsl.rgb=function(hsl){const h=hsl[0]/360;const s=hsl[1]/100;const l=hsl[2]/100;let t2;let t3;let val;if(s===0){val=l*255;return[val,val,val];}if(l<0.5){t2=l*(1+s);}else{t2=l+s-l*s;}const t1=2*l-t2;const rgb=[0,0,0];for(let i=0;i<3;i++){t3=h+1/3*-(i-1);if(t3<0){t3++;}if(t3>1){t3--;}if(6*t3<1){val=t1+(t2-t1)*6*t3;}else if(2*t3<1){val=t2;}else if(3*t3<2){val=t1+(t2-t1)*(2/3-t3)*6;}else{val=t1;}rgb[i]=val*255;}return rgb;};convert$2.hsl.hsv=function(hsl){const h=hsl[0];let s=hsl[1]/100;let l=hsl[2]/100;let smin=s;const lmin=Math.max(l,0.01);l*=2;s*=l<=1?l:2-l;smin*=lmin<=1?lmin:2-lmin;const v=(l+s)/2;const sv=l===0?2*smin/(lmin+smin):2*s/(l+s);return[h,sv*100,v*100];};convert$2.hsv.rgb=function(hsv){const h=hsv[0]/60;const s=hsv[1]/100;let v=hsv[2]/100;const hi=Math.floor(h)%6;const f=h-Math.floor(h);const p=255*v*(1-s);const q=255*v*(1-s*f);const t=255*v*(1-s*(1-f));v*=255;switch(hi){case 0:return[v,t,p];case 1:return[q,v,p];case 2:return[p,v,t];case 3:return[p,q,v];case 4:return[t,p,v];case 5:return[v,p,q];}};convert$2.hsv.hsl=function(hsv){const h=hsv[0];const s=hsv[1]/100;const v=hsv[2]/100;const vmin=Math.max(v,0.01);let sl;let l;l=(2-s)*v;const lmin=(2-s)*vmin;sl=s*vmin;sl/=lmin<=1?lmin:2-lmin;sl=sl||0;l/=2;return[h,sl*100,l*100];};// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
11460
|
+
convert$2.hwb.rgb=function(hwb){const h=hwb[0]/360;let wh=hwb[1]/100;let bl=hwb[2]/100;const ratio=wh+bl;let f;// Wh + bl cant be > 1
|
|
11461
|
+
if(ratio>1){wh/=ratio;bl/=ratio;}const i=Math.floor(6*h);const v=1-bl;f=6*h-i;if((i&0x01)!==0){f=1-f;}const n=wh+f*(v-wh);// Linear interpolation
|
|
11462
|
+
let r;let g;let b;/* eslint-disable max-statements-per-line,no-multi-spaces */switch(i){default:case 6:case 0:r=v;g=n;b=wh;break;case 1:r=n;g=v;b=wh;break;case 2:r=wh;g=v;b=n;break;case 3:r=wh;g=n;b=v;break;case 4:r=n;g=wh;b=v;break;case 5:r=v;g=wh;b=n;break;}/* eslint-enable max-statements-per-line,no-multi-spaces */return[r*255,g*255,b*255];};convert$2.cmyk.rgb=function(cmyk){const c=cmyk[0]/100;const m=cmyk[1]/100;const y=cmyk[2]/100;const k=cmyk[3]/100;const r=1-Math.min(1,c*(1-k)+k);const g=1-Math.min(1,m*(1-k)+k);const b=1-Math.min(1,y*(1-k)+k);return[r*255,g*255,b*255];};convert$2.xyz.rgb=function(xyz){const x=xyz[0]/100;const y=xyz[1]/100;const z=xyz[2]/100;let r;let g;let b;r=x*3.2406+y*-1.5372+z*-0.4986;g=x*-0.9689+y*1.8758+z*0.0415;b=x*0.0557+y*-0.2040+z*1.0570;// Assume sRGB
|
|
11463
|
+
r=r>0.0031308?1.055*r**(1.0/2.4)-0.055:r*12.92;g=g>0.0031308?1.055*g**(1.0/2.4)-0.055:g*12.92;b=b>0.0031308?1.055*b**(1.0/2.4)-0.055:b*12.92;r=Math.min(Math.max(0,r),1);g=Math.min(Math.max(0,g),1);b=Math.min(Math.max(0,b),1);return[r*255,g*255,b*255];};convert$2.xyz.lab=function(xyz){let x=xyz[0];let y=xyz[1];let z=xyz[2];x/=95.047;y/=100;z/=108.883;x=x>0.008856?x**(1/3):7.787*x+16/116;y=y>0.008856?y**(1/3):7.787*y+16/116;z=z>0.008856?z**(1/3):7.787*z+16/116;const l=116*y-16;const a=500*(x-y);const b=200*(y-z);return[l,a,b];};convert$2.lab.xyz=function(lab){const l=lab[0];const a=lab[1];const b=lab[2];let x;let y;let z;y=(l+16)/116;x=a/500+y;z=y-b/200;const y2=y**3;const x2=x**3;const z2=z**3;y=y2>0.008856?y2:(y-16/116)/7.787;x=x2>0.008856?x2:(x-16/116)/7.787;z=z2>0.008856?z2:(z-16/116)/7.787;x*=95.047;y*=100;z*=108.883;return[x,y,z];};convert$2.lab.lch=function(lab){const l=lab[0];const a=lab[1];const b=lab[2];let h;const hr=Math.atan2(b,a);h=hr*360/2/Math.PI;if(h<0){h+=360;}const c=Math.sqrt(a*a+b*b);return[l,c,h];};convert$2.lch.lab=function(lch){const l=lch[0];const c=lch[1];const h=lch[2];const hr=h/360*2*Math.PI;const a=c*Math.cos(hr);const b=c*Math.sin(hr);return[l,a,b];};convert$2.rgb.ansi16=function(args,saturation=null){const[r,g,b]=args;let value=saturation===null?convert$2.rgb.hsv(args)[2]:saturation;// Hsv -> ansi16 optimization
|
|
11464
|
+
value=Math.round(value/50);if(value===0){return 30;}let ansi=30+(Math.round(b/255)<<2|Math.round(g/255)<<1|Math.round(r/255));if(value===2){ansi+=60;}return ansi;};convert$2.hsv.ansi16=function(args){// Optimization here; we already know the value and don't need to get
|
|
11465
|
+
// it converted for us.
|
|
11466
|
+
return convert$2.rgb.ansi16(convert$2.hsv.rgb(args),args[2]);};convert$2.rgb.ansi256=function(args){const r=args[0];const g=args[1];const b=args[2];// We use the extended greyscale palette here, with the exception of
|
|
11467
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
11468
|
+
if(r===g&&g===b){if(r<8){return 16;}if(r>248){return 231;}return Math.round((r-8)/247*24)+232;}const ansi=16+36*Math.round(r/255*5)+6*Math.round(g/255*5)+Math.round(b/255*5);return ansi;};convert$2.ansi16.rgb=function(args){let color=args%10;// Handle greyscale
|
|
11469
|
+
if(color===0||color===7){if(args>50){color+=3.5;}color=color/10.5*255;return[color,color,color];}const mult=(~~(args>50)+1)*0.5;const r=(color&1)*mult*255;const g=(color>>1&1)*mult*255;const b=(color>>2&1)*mult*255;return[r,g,b];};convert$2.ansi256.rgb=function(args){// Handle greyscale
|
|
11470
|
+
if(args>=232){const c=(args-232)*10+8;return[c,c,c];}args-=16;let rem;const r=Math.floor(args/36)/5*255;const g=Math.floor((rem=args%36)/6)/5*255;const b=rem%6/5*255;return[r,g,b];};convert$2.rgb.hex=function(args){const integer=((Math.round(args[0])&0xFF)<<16)+((Math.round(args[1])&0xFF)<<8)+(Math.round(args[2])&0xFF);const string=integer.toString(16).toUpperCase();return'000000'.substring(string.length)+string;};convert$2.hex.rgb=function(args){const match=args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!match){return[0,0,0];}let colorString=match[0];if(match[0].length===3){colorString=colorString.split('').map(char=>{return char+char;}).join('');}const integer=parseInt(colorString,16);const r=integer>>16&0xFF;const g=integer>>8&0xFF;const b=integer&0xFF;return[r,g,b];};convert$2.rgb.hcg=function(rgb){const r=rgb[0]/255;const g=rgb[1]/255;const b=rgb[2]/255;const max=Math.max(Math.max(r,g),b);const min=Math.min(Math.min(r,g),b);const chroma=max-min;let grayscale;let hue;if(chroma<1){grayscale=min/(1-chroma);}else{grayscale=0;}if(chroma<=0){hue=0;}else if(max===r){hue=(g-b)/chroma%6;}else if(max===g){hue=2+(b-r)/chroma;}else{hue=4+(r-g)/chroma;}hue/=6;hue%=1;return[hue*360,chroma*100,grayscale*100];};convert$2.hsl.hcg=function(hsl){const s=hsl[1]/100;const l=hsl[2]/100;const c=l<0.5?2.0*s*l:2.0*s*(1.0-l);let f=0;if(c<1.0){f=(l-0.5*c)/(1.0-c);}return[hsl[0],c*100,f*100];};convert$2.hsv.hcg=function(hsv){const s=hsv[1]/100;const v=hsv[2]/100;const c=s*v;let f=0;if(c<1.0){f=(v-c)/(1-c);}return[hsv[0],c*100,f*100];};convert$2.hcg.rgb=function(hcg){const h=hcg[0]/360;const c=hcg[1]/100;const g=hcg[2]/100;if(c===0.0){return[g*255,g*255,g*255];}const pure=[0,0,0];const hi=h%1*6;const v=hi%1;const w=1-v;let mg=0;/* eslint-disable max-statements-per-line */switch(Math.floor(hi)){case 0:pure[0]=1;pure[1]=v;pure[2]=0;break;case 1:pure[0]=w;pure[1]=1;pure[2]=0;break;case 2:pure[0]=0;pure[1]=1;pure[2]=v;break;case 3:pure[0]=0;pure[1]=w;pure[2]=1;break;case 4:pure[0]=v;pure[1]=0;pure[2]=1;break;default:pure[0]=1;pure[1]=0;pure[2]=w;}/* eslint-enable max-statements-per-line */mg=(1.0-c)*g;return[(c*pure[0]+mg)*255,(c*pure[1]+mg)*255,(c*pure[2]+mg)*255];};convert$2.hcg.hsv=function(hcg){const c=hcg[1]/100;const g=hcg[2]/100;const v=c+g*(1.0-c);let f=0;if(v>0.0){f=c/v;}return[hcg[0],f*100,v*100];};convert$2.hcg.hsl=function(hcg){const c=hcg[1]/100;const g=hcg[2]/100;const l=g*(1.0-c)+0.5*c;let s=0;if(l>0.0&&l<0.5){s=c/(2*l);}else if(l>=0.5&&l<1.0){s=c/(2*(1-l));}return[hcg[0],s*100,l*100];};convert$2.hcg.hwb=function(hcg){const c=hcg[1]/100;const g=hcg[2]/100;const v=c+g*(1.0-c);return[hcg[0],(v-c)*100,(1-v)*100];};convert$2.hwb.hcg=function(hwb){const w=hwb[1]/100;const b=hwb[2]/100;const v=1-b;const c=v-w;let g=0;if(c<1){g=(v-c)/(1-c);}return[hwb[0],c*100,g*100];};convert$2.apple.rgb=function(apple){return[apple[0]/65535*255,apple[1]/65535*255,apple[2]/65535*255];};convert$2.rgb.apple=function(rgb){return[rgb[0]/255*65535,rgb[1]/255*65535,rgb[2]/255*65535];};convert$2.gray.rgb=function(args){return[args[0]/100*255,args[0]/100*255,args[0]/100*255];};convert$2.gray.hsl=function(args){return[0,0,args[0]];};convert$2.gray.hsv=convert$2.gray.hsl;convert$2.gray.hwb=function(gray){return[0,100,gray[0]];};convert$2.gray.cmyk=function(gray){return[0,0,0,gray[0]];};convert$2.gray.lab=function(gray){return[gray[0],0,0];};convert$2.gray.hex=function(gray){const val=Math.round(gray[0]/100*255)&0xFF;const integer=(val<<16)+(val<<8)+val;const string=integer.toString(16).toUpperCase();return'000000'.substring(string.length)+string;};convert$2.rgb.gray=function(rgb){const val=(rgb[0]+rgb[1]+rgb[2])/3;return[val/255*100];};const conversions$1=conversions$2;/*
|
|
11471
|
+
This function routes a model to all other models.
|
|
11472
|
+
|
|
11473
|
+
all functions that are routed have a property `.conversion` attached
|
|
11474
|
+
to the returned synthetic function. This property is an array
|
|
11475
|
+
of strings, each with the steps in between the 'from' and 'to'
|
|
11476
|
+
color models (inclusive).
|
|
11477
|
+
|
|
11478
|
+
conversions that are not possible simply are not included.
|
|
11479
|
+
*/function buildGraph(){const graph={};// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
11480
|
+
const models=Object.keys(conversions$1);for(let len=models.length,i=0;i<len;i++){graph[models[i]]={// http://jsperf.com/1-vs-infinity
|
|
11481
|
+
// micro-opt, but this is simple.
|
|
11482
|
+
distance:-1,parent:null};}return graph;}// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
11483
|
+
function deriveBFS(fromModel){const graph=buildGraph();const queue=[fromModel];// Unshift -> queue -> pop
|
|
11484
|
+
graph[fromModel].distance=0;while(queue.length){const current=queue.pop();const adjacents=Object.keys(conversions$1[current]);for(let len=adjacents.length,i=0;i<len;i++){const adjacent=adjacents[i];const node=graph[adjacent];if(node.distance===-1){node.distance=graph[current].distance+1;node.parent=current;queue.unshift(adjacent);}}}return graph;}function link(from,to){return function(args){return to(from(args));};}function wrapConversion(toModel,graph){const path=[graph[toModel].parent,toModel];let fn=conversions$1[graph[toModel].parent][toModel];let cur=graph[toModel].parent;while(graph[cur].parent){path.unshift(graph[cur].parent);fn=link(conversions$1[graph[cur].parent][cur],fn);cur=graph[cur].parent;}fn.conversion=path;return fn;}var route$1=function(fromModel){const graph=deriveBFS(fromModel);const conversion={};const models=Object.keys(graph);for(let len=models.length,i=0;i<len;i++){const toModel=models[i];const node=graph[toModel];if(node.parent===null){// No possible conversion, or this node is the source model.
|
|
11485
|
+
continue;}conversion[toModel]=wrapConversion(toModel,graph);}return conversion;};const conversions=conversions$2;const route=route$1;const convert$1={};const models=Object.keys(conversions);function wrapRaw(fn){const wrappedFn=function(...args){const arg0=args[0];if(arg0===undefined||arg0===null){return arg0;}if(arg0.length>1){args=arg0;}return fn(args);};// Preserve .conversion property if there is one
|
|
11486
|
+
if('conversion'in fn){wrappedFn.conversion=fn.conversion;}return wrappedFn;}function wrapRounded(fn){const wrappedFn=function(...args){const arg0=args[0];if(arg0===undefined||arg0===null){return arg0;}if(arg0.length>1){args=arg0;}const result=fn(args);// We're assuming the result is an array here.
|
|
11487
|
+
// see notice in conversions.js; don't use box types
|
|
11488
|
+
// in conversion functions.
|
|
11489
|
+
if(typeof result==='object'){for(let len=result.length,i=0;i<len;i++){result[i]=Math.round(result[i]);}}return result;};// Preserve .conversion property if there is one
|
|
11490
|
+
if('conversion'in fn){wrappedFn.conversion=fn.conversion;}return wrappedFn;}models.forEach(fromModel=>{convert$1[fromModel]={};Object.defineProperty(convert$1[fromModel],'channels',{value:conversions[fromModel].channels});Object.defineProperty(convert$1[fromModel],'labels',{value:conversions[fromModel].labels});const routes=route(fromModel);const routeModels=Object.keys(routes);routeModels.forEach(toModel=>{const fn=routes[toModel];convert$1[fromModel][toModel]=wrapRounded(fn);convert$1[fromModel][toModel].raw=wrapRaw(fn);});});var colorConvert=convert$1;const colorString=colorString$1.exports;const convert=colorConvert;const skippedModels=[// To be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
11491
|
+
'keyword',// Gray conflicts with some method names, and has its own method defined.
|
|
11492
|
+
'gray',// Shouldn't really be in color-convert either...
|
|
11493
|
+
'hex'];const hashedModelKeys={};for(const model of Object.keys(convert)){hashedModelKeys[[...convert[model].labels].sort().join('')]=model;}const limiters={};function Color(object,model){if(!(this instanceof Color)){return new Color(object,model);}if(model&&model in skippedModels){model=null;}if(model&&!(model in convert)){throw new Error('Unknown model: '+model);}let i;let channels;if(object==null){// eslint-disable-line no-eq-null,eqeqeq
|
|
11494
|
+
this.model='rgb';this.color=[0,0,0];this.valpha=1;}else if(object instanceof Color){this.model=object.model;this.color=[...object.color];this.valpha=object.valpha;}else if(typeof object==='string'){const result=colorString.get(object);if(result===null){throw new Error('Unable to parse color from string: '+object);}this.model=result.model;channels=convert[this.model].channels;this.color=result.value.slice(0,channels);this.valpha=typeof result.value[channels]==='number'?result.value[channels]:1;}else if(object.length>0){this.model=model||'rgb';channels=convert[this.model].channels;const newArray=Array.prototype.slice.call(object,0,channels);this.color=zeroArray(newArray,channels);this.valpha=typeof object[channels]==='number'?object[channels]:1;}else if(typeof object==='number'){// This is always RGB - can be converted later on.
|
|
11495
|
+
this.model='rgb';this.color=[object>>16&0xFF,object>>8&0xFF,object&0xFF];this.valpha=1;}else{this.valpha=1;const keys=Object.keys(object);if('alpha'in object){keys.splice(keys.indexOf('alpha'),1);this.valpha=typeof object.alpha==='number'?object.alpha:0;}const hashedKeys=keys.sort().join('');if(!(hashedKeys in hashedModelKeys)){throw new Error('Unable to parse color from object: '+JSON.stringify(object));}this.model=hashedModelKeys[hashedKeys];const{labels}=convert[this.model];const color=[];for(i=0;i<labels.length;i++){color.push(object[labels[i]]);}this.color=zeroArray(color);}// Perform limitations (clamping, etc.)
|
|
11496
|
+
if(limiters[this.model]){channels=convert[this.model].channels;for(i=0;i<channels;i++){const limit=limiters[this.model][i];if(limit){this.color[i]=limit(this.color[i]);}}}this.valpha=Math.max(0,Math.min(1,this.valpha));if(Object.freeze){Object.freeze(this);}}Color.prototype={toString(){return this.string();},toJSON(){return this[this.model]();},string(places){let self=this.model in colorString.to?this:this.rgb();self=self.round(typeof places==='number'?places:1);const args=self.valpha===1?self.color:[...self.color,this.valpha];return colorString.to[self.model](args);},percentString(places){const self=this.rgb().round(typeof places==='number'?places:1);const args=self.valpha===1?self.color:[...self.color,this.valpha];return colorString.to.rgb.percent(args);},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha];},object(){const result={};const{channels}=convert[this.model];const{labels}=convert[this.model];for(let i=0;i<channels;i++){result[labels[i]]=this.color[i];}if(this.valpha!==1){result.alpha=this.valpha;}return result;},unitArray(){const rgb=this.rgb().color;rgb[0]/=255;rgb[1]/=255;rgb[2]/=255;if(this.valpha!==1){rgb.push(this.valpha);}return rgb;},unitObject(){const rgb=this.rgb().object();rgb.r/=255;rgb.g/=255;rgb.b/=255;if(this.valpha!==1){rgb.alpha=this.valpha;}return rgb;},round(places){places=Math.max(places||0,0);return new Color([...this.color.map(roundToPlace(places)),this.valpha],this.model);},alpha(value){if(value!==undefined){return new Color([...this.color,Math.max(0,Math.min(1,value))],this.model);}return this.valpha;},// Rgb
|
|
11497
|
+
red:getset('rgb',0,maxfn(255)),green:getset('rgb',1,maxfn(255)),blue:getset('rgb',2,maxfn(255)),hue:getset(['hsl','hsv','hsl','hwb','hcg'],0,value=>(value%360+360)%360),saturationl:getset('hsl',1,maxfn(100)),lightness:getset('hsl',2,maxfn(100)),saturationv:getset('hsv',1,maxfn(100)),value:getset('hsv',2,maxfn(100)),chroma:getset('hcg',1,maxfn(100)),gray:getset('hcg',2,maxfn(100)),white:getset('hwb',1,maxfn(100)),wblack:getset('hwb',2,maxfn(100)),cyan:getset('cmyk',0,maxfn(100)),magenta:getset('cmyk',1,maxfn(100)),yellow:getset('cmyk',2,maxfn(100)),black:getset('cmyk',3,maxfn(100)),x:getset('xyz',0,maxfn(95.047)),y:getset('xyz',1,maxfn(100)),z:getset('xyz',2,maxfn(108.833)),l:getset('lab',0,maxfn(100)),a:getset('lab',1),b:getset('lab',2),keyword(value){if(value!==undefined){return new Color(value);}return convert[this.model].keyword(this.color);},hex(value){if(value!==undefined){return new Color(value);}return colorString.to.hex(this.rgb().round().color);},hexa(value){if(value!==undefined){return new Color(value);}const rgbArray=this.rgb().round().color;let alphaHex=Math.round(this.valpha*255).toString(16).toUpperCase();if(alphaHex.length===1){alphaHex='0'+alphaHex;}return colorString.to.hex(rgbArray)+alphaHex;},rgbNumber(){const rgb=this.rgb().color;return(rgb[0]&0xFF)<<16|(rgb[1]&0xFF)<<8|rgb[2]&0xFF;},luminosity(){// http://www.w3.org/TR/WCAG20/#relativeluminancedef
|
|
11498
|
+
const rgb=this.rgb().color;const lum=[];for(const[i,element]of rgb.entries()){const chan=element/255;lum[i]=chan<=0.04045?chan/12.92:((chan+0.055)/1.055)**2.4;}return 0.2126*lum[0]+0.7152*lum[1]+0.0722*lum[2];},contrast(color2){// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
|
|
11499
|
+
const lum1=this.luminosity();const lum2=color2.luminosity();if(lum1>lum2){return(lum1+0.05)/(lum2+0.05);}return(lum2+0.05)/(lum1+0.05);},level(color2){// https://www.w3.org/TR/WCAG/#contrast-enhanced
|
|
11500
|
+
const contrastRatio=this.contrast(color2);if(contrastRatio>=7){return'AAA';}return contrastRatio>=4.5?'AA':'';},isDark(){// YIQ equation from http://24ways.org/2010/calculating-color-contrast
|
|
11501
|
+
const rgb=this.rgb().color;const yiq=(rgb[0]*2126+rgb[1]*7152+rgb[2]*722)/10000;return yiq<128;},isLight(){return!this.isDark();},negate(){const rgb=this.rgb();for(let i=0;i<3;i++){rgb.color[i]=255-rgb.color[i];}return rgb;},lighten(ratio){const hsl=this.hsl();hsl.color[2]+=hsl.color[2]*ratio;return hsl;},darken(ratio){const hsl=this.hsl();hsl.color[2]-=hsl.color[2]*ratio;return hsl;},saturate(ratio){const hsl=this.hsl();hsl.color[1]+=hsl.color[1]*ratio;return hsl;},desaturate(ratio){const hsl=this.hsl();hsl.color[1]-=hsl.color[1]*ratio;return hsl;},whiten(ratio){const hwb=this.hwb();hwb.color[1]+=hwb.color[1]*ratio;return hwb;},blacken(ratio){const hwb=this.hwb();hwb.color[2]+=hwb.color[2]*ratio;return hwb;},grayscale(){// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
|
11502
|
+
const rgb=this.rgb().color;const value=rgb[0]*0.3+rgb[1]*0.59+rgb[2]*0.11;return Color.rgb(value,value,value);},fade(ratio){return this.alpha(this.valpha-this.valpha*ratio);},opaquer(ratio){return this.alpha(this.valpha+this.valpha*ratio);},rotate(degrees){const hsl=this.hsl();let hue=hsl.color[0];hue=(hue+degrees)%360;hue=hue<0?360+hue:hue;hsl.color[0]=hue;return hsl;},mix(mixinColor,weight){// Ported from sass implementation in C
|
|
11503
|
+
// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
|
11504
|
+
if(!mixinColor||!mixinColor.rgb){throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof mixinColor);}const color1=mixinColor.rgb();const color2=this.rgb();const p=weight===undefined?0.5:weight;const w=2*p-1;const a=color1.alpha()-color2.alpha();const w1=((w*a===-1?w:(w+a)/(1+w*a))+1)/2;const w2=1-w1;return Color.rgb(w1*color1.red()+w2*color2.red(),w1*color1.green()+w2*color2.green(),w1*color1.blue()+w2*color2.blue(),color1.alpha()*p+color2.alpha()*(1-p));}};// Model conversion methods and static constructors
|
|
11505
|
+
for(const model of Object.keys(convert)){if(skippedModels.includes(model)){continue;}const{channels}=convert[model];// Conversion methods
|
|
11506
|
+
Color.prototype[model]=function(...args){if(this.model===model){return new Color(this);}if(args.length>0){return new Color(args,model);}return new Color([...assertArray(convert[this.model][model].raw(this.color)),this.valpha],model);};// 'static' construction methods
|
|
11507
|
+
Color[model]=function(...args){let color=args[0];if(typeof color==='number'){color=zeroArray(args,channels);}return new Color(color,model);};}function roundTo(number,places){return Number(number.toFixed(places));}function roundToPlace(places){return function(number){return roundTo(number,places);};}function getset(model,channel,modifier){model=Array.isArray(model)?model:[model];for(const m of model){(limiters[m]||(limiters[m]=[]))[channel]=modifier;}model=model[0];return function(value){let result;if(value!==undefined){if(modifier){value=modifier(value);}result=this[model]();result.color[channel]=value;return result;}result=this[model]().color[channel];if(modifier){result=modifier(result);}return result;};}function maxfn(max){return function(v){return Math.max(0,Math.min(max,v));};}function assertArray(value){return Array.isArray(value)?value:[value];}function zeroArray(array,length){for(let i=0;i<length;i++){if(typeof array[i]!=='number'){array[i]=0;}}return array;}var color=Color;var light=function(c,amount){if(amount===void 0){amount=0.15;}var newColor=color(c).lighten(amount).hex();// console.log("lightening to:", newColor)
|
|
11508
|
+
// console.log("luminosity old:", Color(c).luminosity())
|
|
11509
|
+
// console.log("luminosity new:", Color(newColor).luminosity())
|
|
11510
|
+
return newColor;};var lighter=function(c){return light(c,0.25);};var lightness=function(c,amount){if(amount===void 0){amount=95;}return color(c).lightness(amount).hex();};var lightnessDelta=function(c,delta){var currentColor=color(c);var currentLightness=currentColor.lightness();var newLightness=currentLightness+delta;var isTooBlackOrWhite=newLightness===0||newLightness===100;if(isTooBlackOrWhite)newLightness=currentLightness+delta/2;return currentColor.lightness(newLightness).hex();};var dark=function(c,amount){if(amount===void 0){amount=0.2;}return color(c).darken(amount).hex();};styled.css(templateObject_1$4||(templateObject_1$4=__makeTemplateObject(["\n background: ",";\n color: ",";\n"],["\n background: ",";\n color: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.colorPrimary;},function(_a){var theme=_a.theme;var _b=theme.styles,getTextColorForBackground=_b.getTextColorForBackground,colorPrimary=_b.colorPrimary;return getTextColorForBackground({color:colorPrimary,theme:theme});});var textColorForBackground=styled.css(templateObject_2$4||(templateObject_2$4=__makeTemplateObject(["\n ",";\n"],["\n ",";\n"])),function(props){return props.color?"color: ".concat(props.theme.styles.getTextColorForBackground({color:props.color,theme:props.theme}),";"):"";});styled.css(templateObject_3$3||(templateObject_3$3=__makeTemplateObject(["\n color: ",";\n"],["\n color: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.textColorPrimary;});var textWithColor=styled.css(templateObject_4$3||(templateObject_4$3=__makeTemplateObject(["\n color: ",";\n"],["\n color: ",";\n"])),function(_a){var color=_a.color;return color;});var templateObject_1$4,templateObject_2$4,templateObject_3$3,templateObject_4$3;var getInlineStyling=styled.css(templateObject_1$3||(templateObject_1$3=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),function(_a){var inline=_a.inline;return inline?inlineWithText:"";});var inlineWithText=styled.css(templateObject_2$3||(templateObject_2$3=__makeTemplateObject(["\n padding: 0;\n //width: unset;\n min-width: auto;\n line-height: normal;\n"],["\n padding: 0;\n //width: unset;\n min-width: auto;\n line-height: normal;\n"])));var textColorForButton=styled.css(templateObject_3$2||(templateObject_3$2=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),function(_a){var flat=_a.flat,inline=_a.inline,primary=_a.primary;return flat||inline||!primary?textColorForFlatButton:textColorForBackground;});var textColorForFlatButton=styled.css(templateObject_4$2||(templateObject_4$2=__makeTemplateObject(["\n ","\n ","\n"],["\n ","\n ","\n"])),textWithColor,function(_a){var inline=_a.inline;return inline?inlineButtonStates:flatButtonStates;});var buttonLikeHoverable=styled.css(templateObject_5$2||(templateObject_5$2=__makeTemplateObject(["\n cursor: pointer;\n background: ",";\n\n @media (hover: hover) {\n &:hover {\n background: ",";\n }\n }\n\n :active {\n background: ",";\n }\n\n transition: border-color 0.25s ease-in-out, box-shadow 0.1s ease-in-out,\n background-color 0.25s ease-in-out, color 0.25s ease-in-out,\n outline-color 0.1s ease-in-out, z-index 0.25s ease-in-out;\n\n ","\n"],["\n cursor: pointer;\n background: ",";\n\n @media (hover: hover) {\n &:hover {\n background: ",";\n }\n }\n\n :active {\n background: ",";\n }\n\n transition: border-color 0.25s ease-in-out, box-shadow 0.1s ease-in-out,\n background-color 0.25s ease-in-out, color 0.25s ease-in-out,\n outline-color 0.1s ease-in-out, z-index 0.25s ease-in-out;\n\n ","\n"])),function(_a){var flat=_a.flat,primary=_a.primary,inline=_a.inline,color=_a.color;return flat||!primary||inline?"transparent":color;},function(_a){var primary=_a.primary,color=_a.color;return primary?lightnessDelta(color,10):lightness(color,95);},function(_a){var primary=_a.primary,color=_a.color;return primary?dark(color):lightness(color,85);},textColorForButton);var flatButtonStates=styled.css(templateObject_6$2||(templateObject_6$2=__makeTemplateObject(["\n @media (hover: hover) {\n &:hover {\n color: ",";\n }\n }\n\n :active {\n color: ",";\n }\n"],["\n @media (hover: hover) {\n &:hover {\n color: ",";\n }\n }\n\n :active {\n color: ",";\n }\n"])),function(_a){var color=_a.color;return dark(color);},function(_a){var color=_a.color;return dark(color);});var inlineButtonStates=styled.css(templateObject_7$2||(templateObject_7$2=__makeTemplateObject(["\n @media (hover: hover) {\n &:hover:hover {\n color: ",";\n background-color: unset;\n }\n }\n\n :focus:focus {\n color: ",";\n background-color: unset;\n }\n\n :active:active {\n color: ",";\n background-color: unset;\n }\n"],["\n @media (hover: hover) {\n &:hover:hover {\n color: ",";\n background-color: unset;\n }\n }\n\n :focus:focus {\n color: ",";\n background-color: unset;\n }\n\n :active:active {\n color: ",";\n background-color: unset;\n }\n"])),function(props){return lighter(props.color);},function(props){return lighter(props.color);},function(props){return dark(props.color);});var templateObject_1$3,templateObject_2$3,templateObject_3$2,templateObject_4$2,templateObject_5$2,templateObject_6$2,templateObject_7$2;/**
|
|
11511
|
+
* Copyright Zendesk, Inc.
|
|
11512
|
+
*
|
|
11513
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
11514
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
11515
|
+
*/const useSchedule=function(_temp){let{duration=1250,delayMS=750,loop=true}=_temp===void 0?{}:_temp;const[elapsed,setElapsed]=React.useState(0);const[delayComplete,setDelayComplete]=React.useState(false);React.useLayoutEffect(()=>{let raf;let start;let loopTimeout;let destroyed=false;const tick=()=>{if(destroyed){return;}raf=requestAnimationFrame(performAnimationFrame);};const performAnimationFrame=()=>{setElapsed(Date.now()-start);tick();};const onStart=()=>{if(destroyed){return;}loopTimeout=setTimeout(()=>{cancelAnimationFrame(raf);setElapsed(Date.now()-start);if(loop)onStart();},duration);start=Date.now();setDelayComplete(true);tick();};const renderingDelayTimeout=setTimeout(onStart,delayMS);return()=>{destroyed=true;clearTimeout(renderingDelayTimeout);clearTimeout(loopTimeout);cancelAnimationFrame(raf);};},[duration,delayMS,loop]);return{elapsed:Math.min(1,elapsed/duration),delayMS,delayComplete};};({children:propTypes.exports.func,render:propTypes.exports.func,duration:propTypes.exports.number,loop:propTypes.exports.bool,delayMS:propTypes.exports.number});/**
|
|
11516
|
+
* Copyright Zendesk, Inc.
|
|
11517
|
+
*
|
|
11518
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
11519
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
11520
|
+
*/function _extends(){_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}const dotOneKeyframes=styled.keyframes(["0%{transform:translate(0,5px);}3%{transform:translate(1px,-5px);}6%{transform:translate(3px,-15px);}8%{transform:translate(5px,-18px);}9%{transform:translate(7px,-21px);}11%{transform:translate(8px,-22px);}13%{transform:translate(9px,-23px);}16%{transform:translate(12px,-25px);}18%{transform:translate(13px,-26px);}23%{transform:translate(18px,-26px);}24%{transform:translate(19px,-25px);}28%{transform:translate(22px,-23px);}31%{transform:translate(24px,-21px);}33%{transform:translate(26px,-18px);}34%{transform:translate(28px,-14px);}36%{transform:translate(29px,-12px);}38%{transform:translate(30px,-5px);}39%{transform:translate(31px,5px);}54%{transform:translate(31px,3px);}59%{transform:translate(33px);}61%{transform:translate(43px);}63%{transform:translate(48px);}64%{transform:translate(51px);}66%{transform:translate(53px);}68%{transform:translate(55px);}69%{transform:translate(57px);}76%{transform:translate(60px);}81%{transform:translate(61px);}83%,100%{transform:translate(62px);}"]);const dotTwoKeyframes=styled.keyframes(["4%{transform:translate(0);}6%{transform:translate(-1px);}8%{transform:translate(-2px);}9%{transform:translate(-5px);}11%{transform:translate(-7px);}13%{transform:translate(-12px);}14%{transform:translate(-17px);}16%{transform:translate(-19px);}18%{transform:translate(-22px);}19%{transform:translate(-25px);}21%{transform:translate(-26px);}23%{transform:translate(-27px);}24%{transform:translate(-28px);}26%{transform:translate(-29px);}29%{transform:translate(-30px);}33%,89%{transform:translate(-31px);}91%{transform:translate(-31px,1px);}94%{transform:translate(-31px,2px);}98%{transform:translate(-31px,3px);}99%{transform:translate(-31px,4px);}100%{transform:translate(-31px,5px);}"]);const dotThreeKeyframes=styled.keyframes(["39%{transform:translate(0);}44%{transform:translate(0,1px);}46%{transform:translate(0,2px);}48%{transform:translate(0,3px);}49%{transform:translate(0,4px);}51%{transform:translate(0,5px);}53%{transform:translate(-1px,-6px);}54%{transform:translate(-2px,-13px);}56%{transform:translate(-3px,-15px);}58%{transform:translate(-5px,-19px);}59%{transform:translate(-7px,-21px);}61%{transform:translate(-8px,-22px);}63%{transform:translate(-9px,-24px);}64%{transform:translate(-11px,-25px);}66%{transform:translate(-12px,-26px);}74%{transform:translate(-19px,-26px);}76%{transform:translate(-20px,-25px);}78%{transform:translate(-22px,-24px);}81%{transform:translate(-24px,-21px);}83%{transform:translate(-26px,-19px);}84%{transform:translate(-28px,-15px);}86%{transform:translate(-29px,-13px);}88%{transform:translate(-30px,-6px);}89%{transform:translate(-31px,5px);}91%{transform:translate(-31px,4px);}93%{transform:translate(-31px,3px);}94%{transform:translate(-31px,2px);}98%{transform:translate(-31px,1px);}100%{transform:translate(-31px);}"]);const StyledDotsCircle=styled__default["default"].circle.attrs({cy:36,r:9}).withConfig({displayName:"StyledDots__StyledDotsCircle",componentId:"sc-1ltah7e-0"})([""]);StyledDotsCircle.defaultProps={theme:DEFAULT_THEME};const animationStyles=(animationName,props)=>{return styled.css(["animation:"," ","ms linear infinite;"],animationName,props.duration);};const StyledDotsCircleOne=styled__default["default"](StyledDotsCircle).attrs({cx:9}).withConfig({displayName:"StyledDots__StyledDotsCircleOne",componentId:"sc-1ltah7e-1"})(["",";"],props=>animationStyles(dotOneKeyframes,props));StyledDotsCircleOne.defaultProps={theme:DEFAULT_THEME};const StyledDotsCircleTwo=styled__default["default"](StyledDotsCircle).attrs(()=>({cx:40})).withConfig({displayName:"StyledDots__StyledDotsCircleTwo",componentId:"sc-1ltah7e-2"})(["",";"],props=>animationStyles(dotTwoKeyframes,props));StyledDotsCircleTwo.defaultProps={theme:DEFAULT_THEME};const StyledDotsCircleThree=styled__default["default"](StyledDotsCircle).attrs(()=>({cx:71})).withConfig({displayName:"StyledDots__StyledDotsCircleThree",componentId:"sc-1ltah7e-3"})(["",";"],props=>animationStyles(dotThreeKeyframes,props));StyledDotsCircleThree.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$5='loaders.loading_placeholder';const StyledLoadingPlaceholder=styled__default["default"].div.attrs({'data-garden-id':COMPONENT_ID$5,'data-garden-version':'8.70.0',role:'progressbar'}).withConfig({displayName:"StyledLoadingPlaceholder",componentId:"sc-x3bwsx-0"})(["display:inline-block;width:",";height:",";font-size:",";",""],props=>props.width||'1em',props=>props.height||'0.9em',props=>props.fontSize,props=>retrieveComponentStyles(COMPONENT_ID$5,props));StyledLoadingPlaceholder.defaultProps={theme:DEFAULT_THEME};const sizeToHeight=(size,theme)=>{switch(size){case'small':return theme.space.base/2;case'medium':return theme.space.base*1.5;default:return theme.space.base*3;}};const sizeToBorderRadius=(size,theme)=>sizeToHeight(size,theme)/2;const PROGRESS_BACKGROUND_COMPONENT_ID='loaders.progress_background';const StyledProgressBackground=styled__default["default"].div.attrs(props=>({'data-garden-id':PROGRESS_BACKGROUND_COMPONENT_ID,'data-garden-version':'8.70.0',borderRadius:props.borderRadius||sizeToBorderRadius(props.size,props.theme)})).withConfig({displayName:"StyledProgress__StyledProgressBackground",componentId:"sc-2g8w4s-0"})(["margin:","px 0;border-radius:","px;background-color:",";color:",";",""],props=>props.theme.space.base*2,props=>props.borderRadius,props=>getColor('neutralHue',200,props.theme),props=>props.color||getColor('successHue',600,props.theme),props=>retrieveComponentStyles(PROGRESS_BACKGROUND_COMPONENT_ID,props));StyledProgressBackground.defaultProps={theme:DEFAULT_THEME};const PROGESS_INDICATOR_COMPONENT_ID='loaders.progress_indicator';const StyledProgressIndicator=styled__default["default"].div.attrs(props=>({'data-garden-id':PROGESS_INDICATOR_COMPONENT_ID,'data-garden-version':'8.70.0',height:props.height||sizeToHeight(props.size,props.theme),borderRadius:props.borderRadius||sizeToBorderRadius(props.size,props.theme)})).withConfig({displayName:"StyledProgress__StyledProgressIndicator",componentId:"sc-2g8w4s-1"})(["transition:width 0.1s ease-in-out;border-radius:","px;background:currentcolor;width:","%;height:","px;",""],props=>props.borderRadius,props=>props.value,props=>props.height,props=>retrieveComponentStyles(PROGESS_INDICATOR_COMPONENT_ID,props));StyledProgressIndicator.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$4='loaders.skeleton';const fadeInAnimation=styled.keyframes(["0%,60%{opacity:0;}100%{opacity:1;}"]);const skeletonAnimation=styled.keyframes(["0%{transform:translateX(-100%);}100%{transform:translateX(100%);}"]);const skeletonRtlAnimation=styled.keyframes(["0%{transform:translateX(100%);}100%{transform:translateX(-100%)}"]);const retrieveSkeletonBackgroundColor=_ref=>{let{theme,isLight}=_ref;if(isLight){return styled.css(["background-color:",";"],rgba(theme.colors.background,0.2));}return styled.css(["background-color:",";"],getColor('neutralHue',800,theme,0.1));};const retrieveSkeletonAnimation=_ref2=>{let{theme}=_ref2;if(theme.rtl){return styled.css(["animation:"," 1.5s ease-in-out 300ms infinite;"],skeletonRtlAnimation);}return styled.css(["animation:"," 1.5s ease-in-out 300ms infinite;"],skeletonAnimation);};const retrieveSkeletonGradient=_ref3=>{let{theme,isLight}=_ref3;return styled.css(["background-image:linear-gradient( ",",transparent,",",transparent );"],theme.rtl?'-45deg':'45deg',isLight?getColor('chromeHue',700,theme,0.4):rgba(theme.colors.background,0.6));};const StyledSkeleton=styled__default["default"].div.attrs({'data-garden-id':COMPONENT_ID$4,'data-garden-version':'8.70.0'}).withConfig({displayName:"StyledSkeleton",componentId:"sc-1raozze-0"})(["display:inline-block;position:relative;animation:"," 750ms linear;border-radius:",";width:",";height:",";overflow:hidden;line-height:",";"," &::before{position:absolute;top:0;width:1000px;height:100%;content:'';"," ","}",";"],fadeInAnimation,props=>props.theme.borderRadii.md,props=>props.customWidth,props=>props.customHeight,props=>getLineHeight(props.theme.fontSizes.sm,props.theme.space.base*5),retrieveSkeletonBackgroundColor,retrieveSkeletonAnimation,retrieveSkeletonGradient,props=>retrieveComponentStyles(COMPONENT_ID$4,props));StyledSkeleton.defaultProps={theme:DEFAULT_THEME};const StyledSpinnerCircle=styled__default["default"].circle.attrs(props=>({cx:40,cy:40,r:34,fill:'none',stroke:'currentColor',strokeLinecap:'round',strokeWidth:props.strokeWidthValue,strokeDasharray:`${props.dasharrayValue} 250`,transform:props.transform})).withConfig({displayName:"StyledSpinnerCircle",componentId:"sc-o4kd70-0"})([""]);StyledSpinnerCircle.defaultProps={theme:DEFAULT_THEME};const StyledSVG=styled__default["default"].svg.attrs(props=>({'data-garden-version':'8.70.0',xmlns:'http://www.w3.org/2000/svg',width:props.width,height:props.height,focusable:'false',viewBox:`0 0 ${props.width} ${props.height}`,role:'img'})).withConfig({displayName:"StyledSVG",componentId:"sc-1xtc3kx-0"})(["width:",";height:",";color:",";font-size:",";",";"],props=>props.containerWidth||'1em',props=>props.containerHeight||'0.9em',props=>props.color||'inherit',props=>props.fontSize||'inherit',props=>retrieveComponentStyles(props.dataGardenId,props));StyledSVG.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$3='loaders.inline';const PULSE_ANIMATION=styled.keyframes(["0%,100%{opacity:.2;}50%{opacity:.8;}"]);const StyledCircle=styled__default["default"].circle.attrs({fill:'currentColor',cy:2,r:2}).withConfig({displayName:"StyledInline__StyledCircle",componentId:"sc-fxsb9l-0"})([""]);StyledCircle.defaultProps={theme:DEFAULT_THEME};const StyledInline=styled__default["default"].svg.attrs(props=>({'data-garden-id':COMPONENT_ID$3,'data-garden-version':'8.70.0',viewBox:'0 0 16 4',width:props.size,height:props.size*0.25})).withConfig({displayName:"StyledInline",componentId:"sc-fxsb9l-1"})(["color:",";","{opacity:0.2;&:nth-child(1){animation:"," 1s infinite;animation-delay:",";}&:nth-child(2){animation:"," 1s infinite;animation-delay:0.2s;}&:nth-child(3){animation:"," 1s infinite;animation-delay:",";}}",""],props=>props.color,StyledCircle,PULSE_ANIMATION,props=>props.theme.rtl?'unset':'0.4s',PULSE_ANIMATION,PULSE_ANIMATION,props=>props.theme.rtl?'0.4s':'unset',props=>retrieveComponentStyles(COMPONENT_ID$3,props));StyledInline.defaultProps={theme:DEFAULT_THEME};const COMPONENT_ID$2='loaders.dots';const Dots$1=React.forwardRef((_ref,ref)=>{let{size,color,duration,delayMS,...other}=_ref;const theme=React.useContext(styled.ThemeContext);const environment=useDocument(theme);const canTransformSVG=React.useRef(null);if(environment&&canTransformSVG.current===null){const svg=environment.createElementNS('http://www.w3.org/2000/svg','svg');canTransformSVG.current='transform'in svg;}const{delayComplete}=useSchedule({duration,delayMS,loop:true});const dotOne=React.useRef(null);const dotTwo=React.useRef(null);const dotThree=React.useRef(null);React.useEffect(()=>{if(!canTransformSVG.current&&delayComplete){const transforms=[window.getComputedStyle(dotOne.current).getPropertyValue('transform'),window.getComputedStyle(dotTwo.current).getPropertyValue('transform'),window.getComputedStyle(dotThree.current).getPropertyValue('transform')];dotOne.current.setAttribute('transform',transforms[0]);dotTwo.current.setAttribute('transform',transforms[1]);dotThree.current.setAttribute('transform',transforms[2]);}});if(!delayComplete&&delayMS!==0){return React__default["default"].createElement(StyledLoadingPlaceholder,{fontSize:size},"\xA0");}return React__default["default"].createElement(StyledSVG,_extends({ref:ref,fontSize:size,color:color,width:"80",height:"72",dataGardenId:COMPONENT_ID$2},other),React__default["default"].createElement("g",{fill:"currentColor"},React__default["default"].createElement(StyledDotsCircleOne,{duration:duration,ref:dotOne}),React__default["default"].createElement(StyledDotsCircleTwo,{duration:duration,ref:dotTwo}),React__default["default"].createElement(StyledDotsCircleThree,{duration:duration,ref:dotThree})));});Dots$1.displayName='Dots';Dots$1.propTypes={size:propTypes.exports.any,duration:propTypes.exports.number,color:propTypes.exports.string,delayMS:propTypes.exports.number};Dots$1.defaultProps={size:'inherit',color:'inherit',duration:1250,delayMS:750};const SIZE=['small','medium','large'];const COMPONENT_ID$1='loaders.progress';const Progress=React__default["default"].forwardRef((_ref,ref)=>{let{value,size,'aria-label':label,...other}=_ref;const percentage=Math.max(0,Math.min(100,value));const ariaLabel=useText(Progress,{'aria-label':label},'aria-label','Progress');return React__default["default"].createElement(StyledProgressBackground,_extends({"data-garden-id":COMPONENT_ID$1,"data-garden-version":'8.70.0',"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":percentage,role:"progressbar",size:size,ref:ref,"aria-label":ariaLabel},other),React__default["default"].createElement(StyledProgressIndicator,{value:percentage,size:size}));});Progress.displayName='Progress';Progress.propTypes={color:propTypes.exports.string,value:propTypes.exports.number.isRequired,size:propTypes.exports.oneOf(SIZE)};Progress.defaultProps={value:0,size:'medium'};const Skeleton=React.forwardRef((_ref,ref)=>{let{width,height,isLight,...other}=_ref;return React__default["default"].createElement(StyledSkeleton,_extends({ref:ref,isLight:isLight,customWidth:width,customHeight:height},other),"\xA0");});Skeleton.displayName='Skeleton';Skeleton.propTypes={width:propTypes.exports.string,height:propTypes.exports.string,isLight:propTypes.exports.bool};Skeleton.defaultProps={width:'100%',height:'100%'};const STROKE_WIDTH_FRAMES={0:6,14:5,26:4,36:3,46:2,58:3,70:4,80:5,91:6};const ROTATION_FRAMES={0:-90,8:-81,36:-30,41:-18,44:-8,48:0,55:22,63:53,64:62,66:67,68:78,69:90,71:99,73:112,74:129,76:138,78:159,79:180,81:190,83:207,84:221,86:226,88:235,90:243,99:270};const DASHARRAY_FRAMES={0:0,13:2,26:13,53:86,58:90,63:89,64:88,66:86,68:83,69:81,71:76,73:70,74:62,76:58,78:47,79:37,81:31,83:23,84:16,88:10,89:7,98:1,99:0};const COMPONENT_ID='loaders.spinner';const TOTAL_FRAMES=100;const computeFrames=(frames,duration)=>{return Object.entries(frames).reduce((acc,item,index,arr)=>{const[frame,value]=item;const[nextFrame,nextValue]=arr[index+1]||[TOTAL_FRAMES,arr[0][1]];const diff=parseInt(nextFrame,10)-parseInt(frame,10);const frameHz=1000/60;let subDuration=duration/(TOTAL_FRAMES-1)*diff;let lastValue=value;acc[frame]=value;for(let idx=0;idx<diff;idx++){lastValue=lastValue+(nextValue-lastValue)*(frameHz/subDuration);subDuration=duration/(TOTAL_FRAMES-1)*(diff-idx);acc[parseInt(frame,10)+idx+1]=lastValue;}acc[nextFrame]=nextValue;return acc;},{});};const Spinner=React.forwardRef((_ref,ref)=>{let{size,duration,color,delayMS,...other}=_ref;const strokeWidthValues=computeFrames(STROKE_WIDTH_FRAMES,duration);const rotationValues=computeFrames(ROTATION_FRAMES,duration);const dasharrayValues=computeFrames(DASHARRAY_FRAMES,duration);const{elapsed,delayComplete}=useSchedule({duration,delayMS});const frame=(elapsed*100).toFixed(0);const strokeWidthValue=strokeWidthValues[frame];const rotationValue=rotationValues[frame];const dasharrayValue=dasharrayValues[frame];const WIDTH=80;const HEIGHT=80;if(!delayComplete&&delayMS!==0){return React__default["default"].createElement(StyledLoadingPlaceholder,{width:"1em",height:"1em",fontSize:size},"\xA0");}return React__default["default"].createElement(StyledSVG,_extends({ref:ref,fontSize:size,color:color,width:WIDTH,height:HEIGHT,dataGardenId:COMPONENT_ID,containerHeight:"1em",containerWidth:"1em"},other),React__default["default"].createElement(StyledSpinnerCircle,{dasharrayValue:dasharrayValue,strokeWidthValue:strokeWidthValue,transform:`rotate(${rotationValue}, ${WIDTH/2}, ${HEIGHT/2})`}));});Spinner.displayName='Spinner';Spinner.propTypes={size:propTypes.exports.any,duration:propTypes.exports.number,color:propTypes.exports.string,delayMS:propTypes.exports.number};Spinner.defaultProps={size:'inherit',duration:1250,color:'inherit',delayMS:750};const Inline=React.forwardRef((_ref,ref)=>{let{size,color,...other}=_ref;const ariaLabel=useText(Inline,other,'aria-label','loading');return React__default["default"].createElement(StyledInline,_extends({ref:ref,size:size,color:color,"aria-label":ariaLabel,role:"img"},other),React__default["default"].createElement(StyledCircle,{cx:"14"}),React__default["default"].createElement(StyledCircle,{cx:"8"}),React__default["default"].createElement(StyledCircle,{cx:"2"}));});Inline.displayName='Inline';Inline.propTypes={size:propTypes.exports.number,color:propTypes.exports.string};Inline.defaultProps={size:16,color:'inherit'};var XXS=".8rem";var XS=".9rem";var SM="1rem";var MD="1.3rem";var LG="1.7rem";var XL="2.3rem";var XXL="3.3rem";// h1
|
|
11521
|
+
var XXXL="4rem";var XXXXL="5rem";var XXXXXL="6rem";var THIN="100";var LIGHT="300";var REGULAR="400";var MEDIUM="500";var SEMI_BOLD="600";var BOLD="700";var BLACK="800";var FONT_SIZES={XXS:XXS,XS:XS,SM:SM,MD:MD,LG:LG,XL:XL,XXL:XXL,XXXL:XXXL,XXXXL:XXXXL,XXXXXL:XXXXXL};Object.freeze({XXS:XXS.replace("r",""),XS:XS.replace("r",""),SM:SM.replace("r",""),MD:MD.replace("r",""),LG:LG.replace("r",""),XL:XL.replace("r",""),XXL:XXL.replace("r",""),XXXL:XXXL.replace("r",""),XXXXL:XXXXL.replace("r",""),XXXXXL:XXXXXL.replace("r","")});var FONT_WEIGHTS={THIN:THIN,LIGHT:LIGHT,REGULAR:REGULAR,MEDIUM:MEDIUM,BOLD:BOLD,SEMI_BOLD:SEMI_BOLD,BLACK:BLACK};var Dots=function(_a){var color=_a.color,_b=_a.size,size=_b===void 0?FONT_SIZES.XXL:_b;return jsxRuntime.jsx(Dots$1,{color:color,size:size,delayMS:100,duration:1000});};var useIsMounted=function(){var isMounted=React.useRef();React.useEffect(function(){isMounted.current=true;return function(){isMounted.current=false;};},[]);return function(){return!!isMounted.current;};};var getFontSize=function(size){switch(size){case BUTTON_SIZES.X_SMALL:return FONT_SIZES.XS;default:return"inherit";}};var getHeight=function(size){switch(size){case BUTTON_SIZES.LARGE:return"48px";case BUTTON_SIZES.SMALL:return"32px";case BUTTON_SIZES.X_SMALL:return"24px";default:return"40px";}};var getPaddingSize=function(size){switch(size){case BUTTON_SIZES.SMALL:return".5em";case BUTTON_SIZES.X_SMALL:return".25em";default:return"1em";}};var fitContent=styled.css(templateObject_2$2||(templateObject_2$2=__makeTemplateObject(["\n width: fit-content;\n ","\n"],["\n width: fit-content;\n ","\n"])),function(_a){var children=_a.children,compact=_a.compact,size=_a.size;var paddingSize=getPaddingSize(size);var topPadding=!children?paddingSize:"0";return compact?styled.css(templateObject_1$2||(templateObject_1$2=__makeTemplateObject(["\n min-width: fit-content;\n padding: "," ",";\n ","\n "],["\n min-width: fit-content;\n padding: "," ",";\n ","\n "])),topPadding,paddingSize,!children?"height: unset;":""):"";});var fitContainer=styled.css(templateObject_3$1||(templateObject_3$1=__makeTemplateObject(["\n width: 100%;\n"],["\n width: 100%;\n"])));var colors=styled.css(templateObject_4$1||(templateObject_4$1=__makeTemplateObject(["\n ",";\n border-color: ",";\n\n ",";\n\n @media (hover: hover) {\n &:hover {\n border-color: transparent;\n }\n }\n\n :active {\n border-color: transparent;\n }\n"],["\n ",";\n border-color: ",";\n\n ",";\n\n @media (hover: hover) {\n &:hover {\n border-color: transparent;\n }\n }\n\n :active {\n border-color: transparent;\n }\n"])),buttonLikeHoverable,function(_a){var flat=_a.flat,primary=_a.primary,inline=_a.inline,color=_a.color;return!flat&&!primary&&!inline?color:"transparent";},getInlineStyling);var alignment=function(_a){var alignSelf=_a.alignSelf;return alignSelf?styled.css(templateObject_5$1||(templateObject_5$1=__makeTemplateObject(["\n align-self: ",";\n "],["\n align-self: ",";\n "])),alignSelf):"";};var casing=function(_a){var theme=_a.theme;var casing=theme.styles.buttons.textTransform;return casing?styled.css(templateObject_6$1||(templateObject_6$1=__makeTemplateObject(["\n text-transform: ",";\n "],["\n text-transform: ",";\n "])),casing):"";};var baseColor=function(_a){var color=_a.color,danger=_a.danger,neutral=_a.neutral,success=_a.success,theme=_a.theme,warning=_a.warning;if(color)return color;if(danger)return theme.styles.colorDanger;if(neutral)return theme.styles.colors.grey["300"];if(success)return theme.styles.colorSuccess;if(warning)return theme.styles.colorWarning;return theme.styles.colorPrimary;};var inlineWrapping=styled.css(templateObject_7$1||(templateObject_7$1=__makeTemplateObject(["\n white-space: normal;\n text-align: left;\n height: auto;\n"],["\n white-space: normal;\n text-align: left;\n height: auto;\n"])));var BUTTON_SIZES={LARGE:"large",MEDIUM:"medium",SMALL:"small",X_SMALL:"x_small"};var ButtonBase=styled__default["default"](function(_a){var alignItems=_a.alignItems,children=_a.children,disabled=_a.disabled;_a.groupKey;var icon=_a.icon,iconSize=_a.iconSize,innerAs=_a.innerAs,innerRef=_a.innerRef,iconPosition=_a.iconPosition,loading=_a.loading,onClick=_a.onClick;_a.pill;_a.size;var props=__rest(_a,["alignItems","children","disabled","groupKey","icon","iconSize","innerAs","innerRef","iconPosition","loading","onClick","pill","size"]);return jsxRuntime.jsx(Button$1// @ts-ignore
|
|
11522
|
+
,__assign({// @ts-ignore
|
|
11523
|
+
as:innerAs,disabled:disabled,// isPill={pill}
|
|
11524
|
+
ref:innerRef,onClick:onClick},props,{children:loading?jsxRuntime.jsx(LoaderContainer,__assign({alignItems:"center",justifyContent:"center"},{children:jsxRuntime.jsx(Dots,{size:FONT_SIZES.MD})})):icon?jsxRuntime.jsxs(FlexBox,__assign({alignItems:alignItems!==null&&alignItems!==void 0?alignItems:"center",gap:SPACINGS.XS,justifyContent:"center"},{children:[iconPosition==="left"&&jsxRuntime.jsx(Icon,{color:"currentColor",svg:icon,size:iconSize}),children?jsxRuntime.jsx(IconButtonTextContainer,{children:children}):undefined,iconPosition==="right"&&jsxRuntime.jsx(Icon,{color:"currentColor",svg:icon,size:iconSize})]})):jsxRuntime.jsx("span",{children:children})}));}).attrs(function(props){return __assign(__assign({},props),{color:baseColor(props),primary:props.flat?false:props.primary});})(templateObject_8$1||(templateObject_8$1=__makeTemplateObject(["\n &&&& {\n font-size: ",";\n font-weight: bold;\n height: ",";\n ","\n ","\n border-radius: ",";\n ","\n ","\n ","\n ","\n }\n"],["\n &&&& {\n font-size: ",";\n font-weight: bold;\n height: ",";\n ","\n ","\n border-radius: ",";\n ","\n ","\n ","\n ","\n }\n"])),function(_a){var size=_a.size;return getFontSize(size);},function(_a){var size=_a.size;return getHeight(size);},function(_a){var wrapInlineText=_a.wrapInlineText;return wrapInlineText?inlineWrapping:"";},function(_a){var fluid=_a.fluid;return!fluid?fitContent:fitContainer;},function(_a){var pill=_a.pill,theme=_a.theme;if(pill)return"500px";return theme.styles.buttons.borderRadius;},alignment,casing,function(_a){var disabled=_a.disabled;return!disabled?colors:"";},function(_a){var _css=_a._css;return _css;});var Button=styled__default["default"](React.forwardRef(function(_a,ref){var _b=_a.autoLoadable,autoLoadable=_b===void 0?false:_b,_c=_a.disabled,disabled=_c===void 0?false:_c,_d=_a.flat,flat=_d===void 0?false:_d,_e=_a.fluid,fluid=_e===void 0?false:_e,_f=_a.iconPosition,iconPosition=_f===void 0?"left":_f,_g=_a.loading,loadingProp=_g===void 0?false:_g,onClick=_a.onClick,_h=_a.primary,primary=_h===void 0?true:_h,props=__rest(_a,["autoLoadable","disabled","flat","fluid","iconPosition","loading","onClick","primary"]);var _j=__read(React.useState(false),2),isLoading=_j[0],setIsLoadingTo=_j[1];var isMounted=useIsMounted();var computedIsLoading=React.useCallback(function(){return autoLoadable?isLoading:loadingProp;},[autoLoadable,isLoading,loadingProp]);var processClick=function(e){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_b){switch(_b.label){case 0:setIsLoadingTo(true);_b.label=1;case 1:_b.trys.push([1,3,,4]);return[4/*yield*/,onClick(e)];case 2:_b.sent();return[3/*break*/,4];case 3:_b.sent();return[3/*break*/,4];case 4:if(isMounted())setIsLoadingTo(false);return[2/*return*/];}});});};return jsxRuntime.jsx(ButtonBase,__assign({},props,{disabled:disabled||computedIsLoading(),fluid:fluid,flat:flat,iconPosition:iconPosition,innerRef:ref,loading:computedIsLoading(),// @ts-ignore
|
|
11525
|
+
onClick:autoLoadable?processClick:onClick,primary:primary}));}))(templateObject_9$1||(templateObject_9$1=__makeTemplateObject([""],[""])));var LoaderContainer=styled__default["default"](FlexBox)(templateObject_10$1||(templateObject_10$1=__makeTemplateObject(["\n min-height: 30px;\n"],["\n min-height: 30px;\n"])));var IconButtonTextContainer=styled__default["default"].span(templateObject_11$1||(templateObject_11$1=__makeTemplateObject(["\n flex: 1;\n"],["\n flex: 1;\n"])));var templateObject_1$2,templateObject_2$2,templateObject_3$1,templateObject_4$1,templateObject_5$1,templateObject_6$1,templateObject_7$1,templateObject_8$1,templateObject_9$1,templateObject_10$1,templateObject_11$1;var CardTooltip=styled__default["default"](Tooltip)(templateObject_1$1||(templateObject_1$1=__makeTemplateObject(["\n && {\n background: ",";\n border: none;\n border-radius: 16px;\n box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);\n padding: ",";\n }\n"],["\n && {\n background: ",";\n border: none;\n border-radius: 16px;\n box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);\n padding: ",";\n }\n"])),function(_a){var theme=_a.theme;return theme.styles.colors.white;},SPACINGS.SM);var ExitBtnWrap=styled__default["default"].div(templateObject_2$1||(templateObject_2$1=__makeTemplateObject(["\n position: absolute;\n right: ",";\n top: ",";\n"],["\n position: absolute;\n right: ",";\n top: ",";\n"])),SPACINGS.SM,SPACINGS.SM);var HeaderRow=styled__default["default"].div(templateObject_3||(templateObject_3=__makeTemplateObject(["\n align-items: center;\n display: flex;\n gap: ",";\n margin-bottom: ",";\n"],["\n align-items: center;\n display: flex;\n gap: ",";\n margin-bottom: ",";\n"])),SPACINGS.XS,SPACINGS.XS);var StepLabel=styled__default["default"].div(templateObject_4||(templateObject_4=__makeTemplateObject(["\n color: ",";\n font-size: ",";\n font-weight: ",";\n letter-spacing: 0.08em;\n text-transform: uppercase;\n"],["\n color: ",";\n font-size: ",";\n font-weight: ",";\n letter-spacing: 0.08em;\n text-transform: uppercase;\n"])),function(_a){var theme=_a.theme;return theme.styles.colors.primary[700];},FONT_SIZES.XXS,FONT_WEIGHTS.BOLD);var ActionBadge=styled__default["default"].div(templateObject_5||(templateObject_5=__makeTemplateObject(["\n background: ",";\n border-radius: 20px;\n color: ",";\n flex-shrink: 0;\n font-size: ",";\n font-weight: ",";\n padding: "," ",";\n"],["\n background: ",";\n border-radius: 20px;\n color: ",";\n flex-shrink: 0;\n font-size: ",";\n font-weight: ",";\n padding: "," ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.colors.amber[100];},function(_a){var theme=_a.theme;return theme.styles.colors.amber[800];},FONT_SIZES.XXS,FONT_WEIGHTS.BOLD,SPACINGS.XXS,SPACINGS.XS);var Title=styled__default["default"].div(templateObject_6||(templateObject_6=__makeTemplateObject(["\n color: ",";\n font-size: ",";\n font-weight: ",";\n margin-bottom: ",";\n"],["\n color: ",";\n font-size: ",";\n font-weight: ",";\n margin-bottom: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.textColorDark;},FONT_SIZES.SM,FONT_WEIGHTS.BLACK,SPACINGS.XXS);var Body=styled__default["default"].div(templateObject_7||(templateObject_7=__makeTemplateObject(["\n color: ",";\n font-size: ",";\n line-height: 1.52;\n"],["\n color: ",";\n font-size: ",";\n line-height: 1.52;\n"])),function(_a){var theme=_a.theme;return theme.styles.textColorPrimary;},FONT_SIZES.SM);var ActionHint=styled__default["default"].div(templateObject_8||(templateObject_8=__makeTemplateObject(["\n background: ",";\n border-radius: 10px;\n color: ",";\n font-size: ",";\n font-weight: ",";\n margin-top: ",";\n padding: ",";\n"],["\n background: ",";\n border-radius: 10px;\n color: ",";\n font-size: ",";\n font-weight: ",";\n margin-top: ",";\n padding: ",";\n"])),function(_a){var theme=_a.theme;return theme.styles.colors.primary[100];},function(_a){var theme=_a.theme;return theme.styles.colors.primary[800];},FONT_SIZES.XS,FONT_WEIGHTS.BOLD,SPACINGS.SM,SPACINGS.XS);var FooterRow=styled__default["default"].div(templateObject_9||(templateObject_9=__makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-top: ",";\n"],["\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-top: ",";\n"])),SPACINGS.SM);var FooterRight=styled__default["default"].div(templateObject_10||(templateObject_10=__makeTemplateObject(["\n align-items: center;\n display: flex;\n gap: ",";\n"],["\n align-items: center;\n display: flex;\n gap: ",";\n"])),SPACINGS.SM);var DotsRow=styled__default["default"].div(templateObject_11||(templateObject_11=__makeTemplateObject(["\n align-items: center;\n display: flex;\n gap: ",";\n"],["\n align-items: center;\n display: flex;\n gap: ",";\n"])),SPACINGS.XXS);var Dot=styled__default["default"].span(templateObject_12||(templateObject_12=__makeTemplateObject(["\n background: ",";\n border-radius: 4px;\n display: inline-block;\n flex-shrink: 0;\n height: 7px;\n width: 7px;\n"],["\n background: ",";\n border-radius: 4px;\n display: inline-block;\n flex-shrink: 0;\n height: 7px;\n width: 7px;\n"])),function(_a){var $active=_a.$active,theme=_a.theme;return $active?theme.styles.colorPrimary:theme.styles.colors.grey[300];});var ExitBtn=function(_a){var onClick=_a.onClick;return jsxRuntime.jsx(ExitBtnWrap,{children:jsxRuntime.jsx(Button,{compact:true,flat:true,icon:js.mdiClose,iconSize:FONT_SIZES.SM,onClick:onClick,size:BUTTON_SIZES.X_SMALL})});};var CardFooter=function(_a){var dotCount=_a.dotCount,activeDotIndex=_a.activeDotIndex,isAction=_a.isAction,isFinish=_a.isFinish,onBack=_a.onBack,onNext=_a.onNext;var showNext=Boolean(onNext)&&!isAction;if(!onBack&&dotCount===0&&!showNext)return null;return jsxRuntime.jsxs(FooterRow,{children:[onBack?jsxRuntime.jsx(Button,__assign({inline:true,onClick:onBack,size:BUTTON_SIZES.SMALL},{children:"Back"})):jsxRuntime.jsx("span",{}),jsxRuntime.jsxs(FooterRight,{children:[dotCount>0?jsxRuntime.jsx(DotsRow,{children:Array.from({length:dotCount},function(_,i){return jsxRuntime.jsx(Dot,{"$active":i===activeDotIndex},i);})}):null,showNext?jsxRuntime.jsx(Button,__assign({onClick:onNext,size:BUTTON_SIZES.SMALL},{children:isFinish?"Finish":"Next"})):null]})]});};var SteppedTooltip=function(_a){var children=_a.children,step=_a.step,_b=_a.placement,placement=_b===void 0?"bottom":_b,_c=_a.width,width=_c===void 0?290:_c,_d=_a.dotCount,dotCount=_d===void 0?0:_d,_e=_a.activeDotIndex,activeDotIndex=_e===void 0?0:_e,onBack=_a.onBack,onNext=_a.onNext,isFinish=_a.isFinish,onExit=_a.onExit,offset=_a.offset;if(!step)return children;var content=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[onExit?jsxRuntime.jsx(ExitBtn,{onClick:onExit}):null,step.label||step.isAction?jsxRuntime.jsxs(HeaderRow,{children:[step.label?jsxRuntime.jsx(StepLabel,{children:step.label}):null,step.isAction?jsxRuntime.jsx(ActionBadge,{children:"Action"}):null]}):null,jsxRuntime.jsx(Title,{children:step.title}),jsxRuntime.jsx(Body,{children:step.body}),step.actionHint?jsxRuntime.jsx(ActionHint,{children:step.actionHint}):null,jsxRuntime.jsx(CardFooter,{activeDotIndex:activeDotIndex,dotCount:dotCount,isAction:step.isAction,isFinish:isFinish,onBack:onBack,onNext:onNext})]});return jsxRuntime.jsx(CardTooltip,__assign({arrow:true,content:content,isVisible:true,maxWidth:"".concat(width,"px"),placement:placement,popperModifiers:offset!=null?{offset:{offset:"0, ".concat(offset)}}:undefined,type:"light"},{children:children}));};var templateObject_1$1,templateObject_2$1,templateObject_3,templateObject_4,templateObject_5,templateObject_6,templateObject_7,templateObject_8,templateObject_9,templateObject_10,templateObject_11,templateObject_12;var PaddedAnchor=styled__default["default"].div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n display: inline-flex;\n ","\n"],["\n display: inline-flex;\n ","\n"])),function(_a){var $padding=_a.$padding,$active=_a.$active;return $active?"\n margin: -".concat($padding,"px;\n padding: ").concat($padding,"px;\n "):"";});var Ring=styled__default["default"].div(templateObject_2||(templateObject_2=__makeTemplateObject(["\n border-radius: ",";\n box-shadow: 0 0 0 9999px\n ",";\n height: ","px;\n left: ","px;\n pointer-events: none;\n position: fixed;\n top: ","px;\n width: ","px;\n z-index: ",";\n"],["\n border-radius: ",";\n box-shadow: 0 0 0 9999px\n ",";\n height: ","px;\n left: ","px;\n pointer-events: none;\n position: fixed;\n top: ","px;\n width: ","px;\n z-index: ",";\n"])),function(_a){var $borderRadius=_a.$borderRadius;return $borderRadius;},function(_a){var theme=_a.theme;return theme.styles.modal.backdrop.background;},function(_a){var $height=_a.$height;return $height;},function(_a){var $left=_a.$left;return $left;},function(_a){var $top=_a.$top;return $top;},function(_a){var $width=_a.$width;return $width;},function(_a){var $zIndex=_a.$zIndex;return $zIndex;});var FocusedHelper=function(_a){var children=_a.children,active=_a.active,_b=_a.zIndex,zIndex=_b===void 0?400:_b,_c=_a.ringPadding,ringPadding=_c===void 0?8:_c,_d=_a.ringBorderRadius,ringBorderRadius=_d===void 0?8:_d,renderTooltip=_a.renderTooltip;var anchorRef=React.useRef(null);var _e=__read(React.useState(null),2),rect=_e[0],setRect=_e[1];var updateRect=function(){var _a,_b;setRect((_b=(_a=anchorRef.current)===null||_a===void 0?void 0:_a.getBoundingClientRect())!==null&&_b!==void 0?_b:null);};React.useEffect(function(){if(!active){setRect(null);return;}updateRect();window.addEventListener("resize",updateRect);window.addEventListener("scroll",updateRect,true);return function(){window.removeEventListener("resize",updateRect);window.removeEventListener("scroll",updateRect,true);};},[active]);var borderRadius=typeof ringBorderRadius==="number"?"".concat(ringBorderRadius,"px"):ringBorderRadius;var anchor=jsxRuntime.jsx(PaddedAnchor,__assign({ref:anchorRef,"$active":active,"$padding":ringPadding},{children:children}));var rendered=renderTooltip?renderTooltip(anchor):anchor;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[rendered,active&&rect?jsxRuntime.jsx(Ring,{"$borderRadius":borderRadius,"$height":rect.height,"$left":rect.left,"$top":rect.top,"$width":rect.width,"$zIndex":zIndex}):null]});};var templateObject_1,templateObject_2;exports.FocusedHelper=FocusedHelper;exports.IconTooltip=IconTooltip;exports.SteppedTooltip=SteppedTooltip;exports.Tooltip=Tooltip;
|
|
11386
11526
|
//# sourceMappingURL=tooltips.js.map
|