@storybook/components 6.5.9-alpha.1 → 6.5.9-alpha.2
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/cjs/{Color-d3116a31.js → Color-a62ba7e9.js} +3 -1
- package/dist/cjs/{OverlayScrollbars-b655a091.js → OverlayScrollbars-c574dc71.js} +3 -1
- package/dist/cjs/{WithTooltip-aa7ec521.js → WithTooltip-f49e8812.js} +6 -2
- package/dist/cjs/{formatter-42139f42.js → formatter-e9350ac6.js} +2 -2
- package/dist/cjs/{index-82acc4b4.js → index-967d55af.js} +9 -22
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/{syntaxhighlighter-3f6db113.js → syntaxhighlighter-9522fde9.js} +6 -2
- package/dist/esm/{Color-e9687cd5.js → Color-3c22bb81.js} +2 -1
- package/dist/esm/{OverlayScrollbars-d54f9566.js → OverlayScrollbars-26c4a78d.js} +2 -1
- package/dist/esm/{WithTooltip-5d9955be.js → WithTooltip-508b8277.js} +3 -2
- package/dist/esm/{formatter-c2d2643c.js → formatter-9dc562d4.js} +2 -2
- package/dist/esm/{index-f6d446d8.js → index-b45716e8.js} +9 -22
- package/dist/esm/index.js +2 -1
- package/dist/esm/{syntaxhighlighter-75381027.js → syntaxhighlighter-82dea71a.js} +3 -2
- package/dist/modern/{Color-31c3091f.js → Color-f9ce6f57.js} +2 -1
- package/dist/modern/{OverlayScrollbars-0d0d9ac6.js → OverlayScrollbars-119b80c2.js} +2 -1
- package/dist/modern/{WithTooltip-c478b6c7.js → WithTooltip-040f3a83.js} +3 -2
- package/dist/modern/{formatter-781ca345.js → formatter-12a1a8d1.js} +2 -2
- package/dist/modern/{index-4e034b71.js → index-9ef3b84b.js} +9 -22
- package/dist/modern/index.js +2 -1
- package/dist/modern/{syntaxhighlighter-848db87b.js → syntaxhighlighter-5c1fdb3d.js} +3 -2
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"core-js/modules/es.object.freeze.js";var _templateObject,_templateObject2,_templateObject3,_templateObject4;function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf2(subClass,superClass);}function _setPrototypeOf2(o,p){_setPrototypeOf2=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf2(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct2();return function _createSuperInternal(){var Super=_getPrototypeOf2(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf2(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized2(self);}function _assertThisInitialized2(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct2(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf2(o){_getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf2(o);}function _defineProperty2(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;}import"regenerator-runtime/runtime.js";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import"core-js/modules/es.symbol.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.object.assign.js";import"core-js/modules/es.object.get-prototype-of.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.map.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.string.match.js";import"core-js/modules/es.number.to-fixed.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.string.bold.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.number.constructor.js";import"core-js/modules/esnext.global-this.js";import"core-js/modules/es.string.small.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.
|
|
1
|
+
import"core-js/modules/es.object.freeze.js";var _templateObject,_templateObject2,_templateObject3,_templateObject4;function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf2(subClass,superClass);}function _setPrototypeOf2(o,p){_setPrototypeOf2=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf2(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct2();return function _createSuperInternal(){var Super=_getPrototypeOf2(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf2(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized2(self);}function _assertThisInitialized2(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct2(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf2(o){_getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf2(o);}function _defineProperty2(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;}import"regenerator-runtime/runtime.js";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import"core-js/modules/es.symbol.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.object.assign.js";import"core-js/modules/es.object.get-prototype-of.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.map.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.string.match.js";import"core-js/modules/es.number.to-fixed.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.string.bold.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.number.constructor.js";import"core-js/modules/esnext.global-this.js";import"core-js/modules/es.string.small.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.string.trim.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.string.ends-with.js";import"core-js/modules/es.string.trim-end.js";import"core-js/modules/es.array.sort.js";import"core-js/modules/es.array.splice.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.number.is-nan.js";import"core-js/modules/es.array.from.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.array.find.js";import"core-js/modules/es.object.entries.js";import"core-js/modules/es.symbol.iterator.js";import"core-js/modules/es.string.repeat.js";import"core-js/modules/es.object.get-own-property-names.js";import"core-js/modules/es.string.starts-with.js";import"core-js/modules/web.url.js";import"core-js/modules/web.url-search-params.js";import"core-js/modules/es.object.values.js";import React__default,{lazy,Suspense,Children,memo,useRef,useState,useEffect,Component,forwardRef,useLayoutEffect,useCallback,createElement,Fragment,createContext,cloneElement,useMemo}from'react';import{styled,themes,ThemeProvider,convert,isPropValid,keyframes,useTheme}from'@storybook/theming';import memoize$2 from'memoizerific';import{sanitize,includeConditionalArg}from'@storybook/csf';import qs from'qs';import{logger,once}from'@storybook/client-logger';/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -294,7 +294,7 @@ var curriedOpacify=/*#__PURE__*/curry/* ::<number | string, string, string> */(o
|
|
|
294
294
|
* background: "rgba(255,0,0,0.3)";
|
|
295
295
|
* }
|
|
296
296
|
*/function transparentize(amount,color){if(color==='transparent')return color;var parsedColor=parseToRgb(color);var alpha=typeof parsedColor.alpha==='number'?parsedColor.alpha:1;var colorWithAlpha=_extends$1({},parsedColor,{alpha:guard(0,1,+(alpha*100-parseFloat(amount)*100).toFixed(2)/100)});return rgba(colorWithAlpha);}// prettier-ignore
|
|
297
|
-
var curriedTransparentize=/*#__PURE__*/curry/* ::<number | string, string, string> */(transparentize);var curriedTransparentize$1=curriedTransparentize;var headerCommon=function headerCommon(_ref2){var theme=_ref2.theme;return{margin:'20px 0 8px',padding:0,cursor:'text',position:'relative',color:theme.color.defaultText,'&:first-of-type':{marginTop:0,paddingTop:0},'&:hover a.anchor':{textDecoration:'none'},'& tt, & code':{fontSize:'inherit'}};};var codeCommon=function codeCommon(_ref3){var theme=_ref3.theme;return{lineHeight:1,margin:'0 2px',padding:'3px 5px',whiteSpace:'nowrap',borderRadius:3,fontSize:theme.typography.size.s2-1,border:theme.base==='light'?"1px solid ".concat(theme.color.mediumlight):"1px solid ".concat(theme.color.darker),color:theme.base==='light'?curriedTransparentize$1(0.1,theme.color.defaultText):curriedTransparentize$1(0.3,theme.color.defaultText),backgroundColor:theme.base==='light'?theme.color.lighter:theme.color.border};};var withReset=function withReset(_ref4){var theme=_ref4.theme;return{fontFamily:theme.typography.fonts.base,fontSize:theme.typography.size.s3,margin:0,WebkitFontSmoothing:'antialiased',MozOsxFontSmoothing:'grayscale',WebkitTapHighlightColor:'rgba(0, 0, 0, 0)',WebkitOverflowScrolling:'touch'};};var withMargin={margin:'16px 0'};var Link$1=function Link$1(_a){var input=_a.href,children=_a.children,props=__rest(_a,["href","children"]);var isStorybookPath=/^\//.test(input);var isAnchorUrl=/^#.*/.test(input);var href=isStorybookPath?"?path=".concat(input):input;var target=isAnchorUrl?'_self':'_top';return React__default.createElement("a",Object.assign({href:href,target:target},props),children);};var A$2=styled(Link$1)(withReset,function(_ref5){var theme=_ref5.theme;return{fontSize:'inherit',lineHeight:'24px',color:theme.color.secondary,textDecoration:'none','&.absent':{color:'#cc0000'},'&.anchor':{display:'block',paddingLeft:30,marginLeft:-30,cursor:'pointer',position:'absolute',top:0,left:0,bottom:0}};});var Blockquote=styled.blockquote(withReset,withMargin,function(_ref6){var theme=_ref6.theme;return{borderLeft:"4px solid ".concat(theme.color.medium),padding:'0 15px',color:theme.color.dark,'& > :first-of-type':{marginTop:0},'& > :last-child':{marginBottom:0}};});var Wrapper$8=styled.div(withReset,function(_ref7){var theme=_ref7.theme;return{backgroundColor:theme.base==='light'?'rgba(0,0,0,.01)':'rgba(255,255,255,.01)',borderRadius:theme.appBorderRadius,border:"1px dashed ".concat(theme.appBorderColor),display:'flex',alignItems:'center',justifyContent:'center',padding:20,margin:'25px 0 40px',color:curriedTransparentize$1(0.3,theme.color.defaultText),fontSize:theme.typography.size.s2};});var EmptyBlock=function EmptyBlock(props){return React__default.createElement(Wrapper$8,Object.assign({},props,{className:"docblock-emptyblock"}));};var LazySyntaxHighlighter=lazy(function(){return import('./syntaxhighlighter-
|
|
297
|
+
var curriedTransparentize=/*#__PURE__*/curry/* ::<number | string, string, string> */(transparentize);var curriedTransparentize$1=curriedTransparentize;var headerCommon=function headerCommon(_ref2){var theme=_ref2.theme;return{margin:'20px 0 8px',padding:0,cursor:'text',position:'relative',color:theme.color.defaultText,'&:first-of-type':{marginTop:0,paddingTop:0},'&:hover a.anchor':{textDecoration:'none'},'& tt, & code':{fontSize:'inherit'}};};var codeCommon=function codeCommon(_ref3){var theme=_ref3.theme;return{lineHeight:1,margin:'0 2px',padding:'3px 5px',whiteSpace:'nowrap',borderRadius:3,fontSize:theme.typography.size.s2-1,border:theme.base==='light'?"1px solid ".concat(theme.color.mediumlight):"1px solid ".concat(theme.color.darker),color:theme.base==='light'?curriedTransparentize$1(0.1,theme.color.defaultText):curriedTransparentize$1(0.3,theme.color.defaultText),backgroundColor:theme.base==='light'?theme.color.lighter:theme.color.border};};var withReset=function withReset(_ref4){var theme=_ref4.theme;return{fontFamily:theme.typography.fonts.base,fontSize:theme.typography.size.s3,margin:0,WebkitFontSmoothing:'antialiased',MozOsxFontSmoothing:'grayscale',WebkitTapHighlightColor:'rgba(0, 0, 0, 0)',WebkitOverflowScrolling:'touch'};};var withMargin={margin:'16px 0'};var Link$1=function Link$1(_a){var input=_a.href,children=_a.children,props=__rest(_a,["href","children"]);var isStorybookPath=/^\//.test(input);var isAnchorUrl=/^#.*/.test(input);var href=isStorybookPath?"?path=".concat(input):input;var target=isAnchorUrl?'_self':'_top';return React__default.createElement("a",Object.assign({href:href,target:target},props),children);};var A$2=styled(Link$1)(withReset,function(_ref5){var theme=_ref5.theme;return{fontSize:'inherit',lineHeight:'24px',color:theme.color.secondary,textDecoration:'none','&.absent':{color:'#cc0000'},'&.anchor':{display:'block',paddingLeft:30,marginLeft:-30,cursor:'pointer',position:'absolute',top:0,left:0,bottom:0}};});var Blockquote=styled.blockquote(withReset,withMargin,function(_ref6){var theme=_ref6.theme;return{borderLeft:"4px solid ".concat(theme.color.medium),padding:'0 15px',color:theme.color.dark,'& > :first-of-type':{marginTop:0},'& > :last-child':{marginBottom:0}};});var Wrapper$8=styled.div(withReset,function(_ref7){var theme=_ref7.theme;return{backgroundColor:theme.base==='light'?'rgba(0,0,0,.01)':'rgba(255,255,255,.01)',borderRadius:theme.appBorderRadius,border:"1px dashed ".concat(theme.appBorderColor),display:'flex',alignItems:'center',justifyContent:'center',padding:20,margin:'25px 0 40px',color:curriedTransparentize$1(0.3,theme.color.defaultText),fontSize:theme.typography.size.s2};});var EmptyBlock=function EmptyBlock(props){return React__default.createElement(Wrapper$8,Object.assign({},props,{className:"docblock-emptyblock"}));};var LazySyntaxHighlighter=lazy(function(){return import('./syntaxhighlighter-82dea71a.js');});var LazySyntaxHighlighterWithFormatter=lazy(function(){return __awaiter(void 0,void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _yield$Promise$all,_yield$Promise$all2,SyntaxHighlighter,formatter;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return Promise.all([import('./syntaxhighlighter-82dea71a.js'),import('./formatter-9dc562d4.js')]);case 2:_yield$Promise$all=_context.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);SyntaxHighlighter=_yield$Promise$all2[0].SyntaxHighlighter;formatter=_yield$Promise$all2[1].formatter;return _context.abrupt("return",{default:function _default(props){return React__default.createElement(SyntaxHighlighter,Object.assign({},props,{formatter:formatter}));}});case 7:case"end":return _context.stop();}}},_callee);}));});var SyntaxHighlighter=function SyntaxHighlighter(props){return React__default.createElement(Suspense,{fallback:React__default.createElement("div",null)},props.format!==false?React__default.createElement(LazySyntaxHighlighterWithFormatter,Object.assign({},props)):React__default.createElement(LazySyntaxHighlighter,Object.assign({},props)));};var StyledSyntaxHighlighter=styled(SyntaxHighlighter)(function(_ref8){var theme=_ref8.theme;return{// DocBlocks-specific styling and overrides
|
|
298
298
|
fontSize:"".concat(theme.typography.size.s2-1,"px"),lineHeight:'19px',margin:'25px 0 40px',borderRadius:theme.appBorderRadius,boxShadow:theme.base==='light'?'rgba(0, 0, 0, 0.10) 0 1px 3px 0':'rgba(0, 0, 0, 0.20) 0 2px 5px 0','pre.prismjs':{padding:20,background:'inherit'}};});var SourceError;(function(SourceError){SourceError["NO_STORY"]="There\u2019s no story here.";SourceError["SOURCE_UNAVAILABLE"]="Oh no! The source is not available.";})(SourceError||(SourceError={}));var SourceSkeletonWrapper=styled.div(function(_ref9){var theme=_ref9.theme;return{background:theme.background.content,borderRadius:theme.appBorderRadius,border:"1px solid ".concat(theme.appBorderColor),boxShadow:theme.base==='light'?'rgba(0, 0, 0, 0.10) 0 1px 3px 0':'rgba(0, 0, 0, 0.20) 0 2px 5px 0',margin:'25px 0 40px',padding:'20px 20px 20px 22px'};});var SourceSkeletonPlaceholder=styled.div(function(_ref10){var theme=_ref10.theme;return _defineProperty2({animation:"".concat(theme.animation.glow," 1.5s ease-in-out infinite"),background:theme.appBorderColor,height:17,marginTop:1,width:'60%'},"&:first-child",{margin:0});});var SourceSkeleton=function SourceSkeleton(){return React__default.createElement(SourceSkeletonWrapper,null,React__default.createElement(SourceSkeletonPlaceholder,null),React__default.createElement(SourceSkeletonPlaceholder,{style:{width:'80%'}}),React__default.createElement(SourceSkeletonPlaceholder,{style:{width:'30%'}}),React__default.createElement(SourceSkeletonPlaceholder,{style:{width:'80%'}}));};/**
|
|
299
299
|
* Syntax-highlighted source code for a component (or anything!)
|
|
300
300
|
*/var Source=function Source(props){var isLoading=props.isLoading,error=props.error;if(isLoading){return React__default.createElement(SourceSkeleton,null);}if(error){return React__default.createElement(EmptyBlock,null,error);}var _a=props,language=_a.language,code=_a.code,dark=_a.dark,format=_a.format,rest=__rest(_a,["language","code","dark","format"]);var syntaxHighlighter=React__default.createElement(StyledSyntaxHighlighter,Object.assign({bordered:true,copyable:true,format:format,language:language,className:"docblock-source"},rest),code);if(typeof dark==='undefined'){return syntaxHighlighter;}var overrideTheme=dark?themes.dark:themes.light;return React__default.createElement(ThemeProvider,{theme:convert(overrideTheme)},syntaxHighlighter);};Source.defaultProps={format:false};var isReactChildString=function isReactChildString(child){return typeof child==='string';};var isInlineCodeRegex=/[\n\r]/g;var DefaultCodeBlock=styled.code(function(_ref12){var theme=_ref12.theme;return{// from reset
|
|
@@ -310,7 +310,7 @@ var icons={mobile:'M648 64h-272c-66.274 0-120 53.726-120 120v656c0 66.274 53.726
|
|
|
310
310
|
shapeRendering:'inherit',transform:'translate3d(0,0,0)'},function(_ref27){var inline=_ref27.inline;return inline?{display:'inline-block'}:{display:'block'};});Svg.displayName='Svg';var Path=styled.path({fill:'currentColor'});// TODO: if we can resize the 1024 to 20, we can remove the size attributes
|
|
311
311
|
var Icons=memo(function(_a){var icon=_a.icon,symbol=_a.symbol,props=__rest(_a,["icon","symbol"]);return React__default.createElement(Svg,Object.assign({viewBox:"0 0 1024 1024"},props),symbol?React__default.createElement("use",{xlinkHref:"#icon--".concat(symbol)}):React__default.createElement(Path,{d:icons[icon]}));});var Symbols=memo(function(_ref28){var _ref28$icons=_ref28.icons,keys=_ref28$icons===void 0?Object.keys(icons):_ref28$icons;return React__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{position:'absolute',width:0,height:0},"data-chromatic":"ignore"},keys.map(function(key){return React__default.createElement("symbol",{id:"icon--".concat(key),key:key},React__default.createElement(Path,{d:icons[key]}));}));});// Cmd/Ctrl/Shift/Alt + Click should trigger default browser behavior. Same applies to non-left clicks
|
|
312
312
|
var LEFT_BUTTON=0;var isPlainLeftClick=function isPlainLeftClick(e){return e.button===LEFT_BUTTON&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;};var cancelled=function cancelled(e,cb){if(isPlainLeftClick(e)){e.preventDefault();cb(e);}};var LinkInner=styled.span(function(_ref29){var withArrow=_ref29.withArrow;return withArrow?{'> svg:last-of-type':{height:'0.7em',width:'0.7em',marginRight:0,marginLeft:'0.25em',bottom:'auto',verticalAlign:'inherit'}}:{};},function(_ref30){var containsIcon=_ref30.containsIcon;return containsIcon?{svg:{height:'1em',width:'1em',verticalAlign:'middle',position:'relative',bottom:0,marginRight:0}}:{};});var A$1=styled.a(function(_ref31){var theme=_ref31.theme;return{display:'inline-block',transition:'all 150ms ease-out',textDecoration:'none',color:theme.color.secondary,'&:hover, &:focus':{cursor:'pointer',color:curriedDarken$1(0.07,theme.color.secondary),'svg path':{fill:curriedDarken$1(0.07,theme.color.secondary)}},'&:active':{color:curriedDarken$1(0.1,theme.color.secondary),'svg path':{fill:curriedDarken$1(0.1,theme.color.secondary)}},svg:{display:'inline-block',height:'1em',width:'1em',verticalAlign:'text-top',position:'relative',bottom:'-0.125em',marginRight:'0.4em','& path':{fill:theme.color.secondary}}};},function(_ref32){var theme=_ref32.theme,secondary=_ref32.secondary,tertiary=_ref32.tertiary;var colors;if(secondary){colors=[theme.color.mediumdark,theme.color.dark,theme.color.darker];}if(tertiary){colors=[theme.color.dark,theme.color.darkest,theme.color.mediumdark];}return colors?{color:colors[0],'svg path':{fill:colors[0]},'&:hover':{color:colors[1],'svg path':{fill:colors[1]}},'&:active':{color:colors[2],'svg path':{fill:colors[2]}}}:{};},function(_ref33){var nochrome=_ref33.nochrome;return nochrome?{color:'inherit','&:hover, &:active':{color:'inherit',textDecoration:'underline'}}:{};},function(_ref34){var theme=_ref34.theme,inverse=_ref34.inverse;return inverse?{color:theme.color.lightest,'svg path':{fill:theme.color.lightest},'&:hover':{color:theme.color.lighter,'svg path':{fill:theme.color.lighter}},'&:active':{color:theme.color.light,'svg path':{fill:theme.color.light}}}:{};},function(_ref35){var isButton=_ref35.isButton;return isButton?{border:0,borderRadius:0,background:'none',padding:0,fontSize:'inherit'}:{};});var Link=function Link(_a){var cancel=_a.cancel,children=_a.children,onClick=_a.onClick,withArrow=_a.withArrow,containsIcon=_a.containsIcon,className=_a.className,rest=__rest(_a,["cancel","children","onClick","withArrow","containsIcon","className"]);return React__default.createElement(A$1,Object.assign({},rest,{onClick:onClick&&cancel?function(e){return cancelled(e,onClick);}:onClick,className:className}),React__default.createElement(LinkInner,{withArrow:withArrow,containsIcon:containsIcon},children,withArrow&&React__default.createElement(Icons,{icon:"arrowright"})));};Link.defaultProps={cancel:true,className:undefined,style:undefined,onClick:undefined,withArrow:false,containsIcon:false};var DocumentWrapper=styled.div(function(_ref36){var theme=_ref36.theme;return{fontSize:"".concat(theme.typography.size.s2,"px"),lineHeight:'1.6',h1:{fontSize:"".concat(theme.typography.size.l1,"px"),fontWeight:theme.typography.weight.black},h2:{fontSize:"".concat(theme.typography.size.m2,"px"),borderBottom:"1px solid ".concat(theme.appBorderColor)},h3:{fontSize:"".concat(theme.typography.size.m1,"px")},h4:{fontSize:"".concat(theme.typography.size.s3,"px")},h5:{fontSize:"".concat(theme.typography.size.s2,"px")},h6:{fontSize:"".concat(theme.typography.size.s2,"px"),color:theme.color.dark},'pre:not(.prismjs)':{background:'transparent',border:'none',borderRadius:0,padding:0,margin:0},'pre pre, pre.prismjs':{padding:15,margin:0,whiteSpace:'pre-wrap',color:'inherit',fontSize:'13px',lineHeight:'19px'},'pre pre code, pre.prismjs code':{color:'inherit',fontSize:'inherit'},'pre code':{margin:0,padding:0,whiteSpace:'pre',border:'none',background:'transparent'},'pre code, pre tt':{backgroundColor:'transparent',border:'none'},/* GitHub inspired Markdown styles loosely from https://gist.github.com/tuzz/3331384 */'body > *:first-of-type':{marginTop:'0 !important'},'body > *:last-child':{marginBottom:'0 !important'},a:{color:theme.color.secondary,textDecoration:'none'},'a.absent':{color:'#cc0000'},'a.anchor':{display:'block',paddingLeft:30,marginLeft:-30,cursor:'pointer',position:'absolute',top:0,left:0,bottom:0},'h1, h2, h3, h4, h5, h6':{margin:'20px 0 10px',padding:0,cursor:'text',position:'relative','&:first-of-type':{marginTop:0,paddingTop:0},'&:hover a.anchor':{textDecoration:'none'},'& tt, & code':{fontSize:'inherit'}},'h1:first-of-type + h2':{marginTop:0,paddingTop:0},'p, blockquote, ul, ol, dl, li, table, pre':{margin:'15px 0'},hr:{border:'0 none',borderTop:"1px solid ".concat(theme.appBorderColor),height:4,padding:0},'body > h1:first-of-type, body > h2:first-of-type, body > h3:first-of-type, body > h4:first-of-type, body > h5:first-of-type, body > h6:first-of-type':{marginTop:0,paddingTop:0},'body > h1:first-of-type + h2':{marginTop:0,paddingTop:0},'a:first-of-type h1, a:first-of-type h2, a:first-of-type h3, a:first-of-type h4, a:first-of-type h5, a:first-of-type h6':{marginTop:0,paddingTop:0},'h1 p, h2 p, h3 p, h4 p, h5 p, h6 p':{marginTop:0},'li p.first':{display:'inline-block'},'ul, ol':{paddingLeft:30,'& :first-of-type':{marginTop:0},'& :last-child':{marginBottom:0}},dl:{padding:0},'dl dt':{fontSize:'14px',fontWeight:'bold',fontStyle:'italic',margin:'0 0 15px',padding:'0 15px','&:first-of-type':{padding:0},'& > :first-of-type':{marginTop:0},'& > :last-child':{marginBottom:0}},blockquote:{borderLeft:"4px solid ".concat(theme.color.medium),padding:'0 15px',color:theme.color.dark,'& > :first-of-type':{marginTop:0},'& > :last-child':{marginBottom:0}},table:{padding:0,borderCollapse:'collapse','& tr':{borderTop:"1px solid ".concat(theme.appBorderColor),backgroundColor:'white',margin:0,padding:0,'& th':{fontWeight:'bold',border:"1px solid ".concat(theme.appBorderColor),textAlign:'left',margin:0,padding:'6px 13px'},'& td':{border:"1px solid ".concat(theme.appBorderColor),textAlign:'left',margin:0,padding:'6px 13px'},'&:nth-of-type(2n)':{backgroundColor:theme.color.lighter},'& th :first-of-type, & td :first-of-type':{marginTop:0},'& th :last-child, & td :last-child':{marginBottom:0}}},img:{maxWidth:'100%'},'span.frame':{display:'block',overflow:'hidden','& > span':{border:"1px solid ".concat(theme.color.medium),display:'block',float:'left',overflow:'hidden',margin:'13px 0 0',padding:7,width:'auto'},'& span img':{display:'block',float:'left'},'& span span':{clear:'both',color:theme.color.darkest,display:'block',padding:'5px 0 0'}},'span.align-center':{display:'block',overflow:'hidden',clear:'both','& > span':{display:'block',overflow:'hidden',margin:'13px auto 0',textAlign:'center'},'& span img':{margin:'0 auto',textAlign:'center'}},'span.align-right':{display:'block',overflow:'hidden',clear:'both','& > span':{display:'block',overflow:'hidden',margin:'13px 0 0',textAlign:'right'},'& span img':{margin:0,textAlign:'right'}},'span.float-left':{display:'block',marginRight:13,overflow:'hidden',float:'left','& span':{margin:'13px 0 0'}},'span.float-right':{display:'block',marginLeft:13,overflow:'hidden',float:'right','& > span':{display:'block',overflow:'hidden',margin:'13px auto 0',textAlign:'right'}},'code, tt':{margin:'0 2px',padding:'0 5px',whiteSpace:'nowrap',border:"1px solid ".concat(theme.color.mediumlight),backgroundColor:theme.color.lighter,borderRadius:3,color:theme.base==='dark'&&theme.color.darkest}};});var Container$1=styled.div(function(_ref37){var theme=_ref37.theme;return{position:'absolute',bottom:0,right:0,maxWidth:'100%',display:'flex',background:theme.background.content,zIndex:1};});var ActionButton=styled.button(function(_ref38){var theme=_ref38.theme;return{margin:0,border:'0 none',padding:'4px 10px',cursor:'pointer',display:'flex',alignItems:'center',color:theme.color.defaultText,background:theme.background.content,fontSize:12,lineHeight:'16px',fontFamily:theme.typography.fonts.base,fontWeight:theme.typography.weight.bold,borderTop:"1px solid ".concat(theme.appBorderColor),borderLeft:"1px solid ".concat(theme.appBorderColor),marginLeft:-1,borderRadius:"4px 0 0 0",'&:not(:last-child)':{borderRight:"1px solid ".concat(theme.appBorderColor)},'& + *':{borderLeft:"1px solid ".concat(theme.appBorderColor),borderRadius:0},'&:focus':{boxShadow:"".concat(theme.color.secondary," 0 -3px 0 0 inset"),outline:'0 none'}};},function(_ref39){var disabled=_ref39.disabled;return disabled&&{cursor:'not-allowed',opacity:0.5};});ActionButton.displayName='ActionButton';var ActionBar=function ActionBar(_a){var actionItems=_a.actionItems,props=__rest(_a,["actionItems"]);return React__default.createElement(Container$1,Object.assign({},props),actionItems.map(function(_ref40,index){var title=_ref40.title,className=_ref40.className,onClick=_ref40.onClick,disabled=_ref40.disabled;return(// eslint-disable-next-line react/no-array-index-key
|
|
313
|
-
React__default.createElement(ActionButton,{key:index,className:className,onClick:onClick,disabled:disabled},title));}));};var toNumber=function toNumber(input){return typeof input==='number'?input:Number(input);};var Container=styled.div(function(_ref41){var theme=_ref41.theme,col=_ref41.col,_ref41$row=_ref41.row,row=_ref41$row===void 0?1:_ref41$row;return col?_defineProperty2({display:'inline-block',verticalAlign:'inherit','& > *':{marginLeft:col*theme.layoutMargin,verticalAlign:'inherit'}},"& > *:first-child",{marginLeft:0}):_defineProperty2({'& > *':{marginTop:row*theme.layoutMargin}},"& > *:first-child",{marginTop:0});},function(_ref44){var theme=_ref44.theme,outer=_ref44.outer,col=_ref44.col,row=_ref44.row;switch(true){case!!(outer&&col):{return{marginLeft:outer*theme.layoutMargin,marginRight:outer*theme.layoutMargin};}case!!(outer&&row):{return{marginTop:outer*theme.layoutMargin,marginBottom:outer*theme.layoutMargin};}default:{return{};}}});var Spaced=function Spaced(_a){var col=_a.col,row=_a.row,outer=_a.outer,children=_a.children,rest=__rest(_a,["col","row","outer","children"]);var outerAmount=toNumber(typeof outer==='number'||!outer?outer:col||row);return React__default.createElement(Container,Object.assign({col:col,row:row,outer:outerAmount},rest),children);};var Title$3=styled.div(function(_ref45){var theme=_ref45.theme;return{fontWeight:theme.typography.weight.bold};});var Desc$1=styled.div();var Message$1=styled.div(function(_ref46){var theme=_ref46.theme;return{padding:30,textAlign:'center',color:theme.color.defaultText,fontSize:theme.typography.size.s2-1};});var Placeholder=function Placeholder(_a){var children=_a.children,props=__rest(_a,["children"]);var _Children$toArray=Children.toArray(children),_Children$toArray2=_slicedToArray(_Children$toArray,2),title=_Children$toArray2[0],desc=_Children$toArray2[1];return React__default.createElement(Message$1,Object.assign({},props),React__default.createElement(Title$3,null,title),desc&&React__default.createElement(Desc$1,null,desc));};var GlobalScrollAreaStyles=lazy(function(){return import('./GlobalScrollAreaStyles-8793ce4a.js');});var OverlayScrollbars=lazy(function(){return import('./OverlayScrollbars-
|
|
313
|
+
React__default.createElement(ActionButton,{key:index,className:className,onClick:onClick,disabled:disabled},title));}));};var toNumber=function toNumber(input){return typeof input==='number'?input:Number(input);};var Container=styled.div(function(_ref41){var theme=_ref41.theme,col=_ref41.col,_ref41$row=_ref41.row,row=_ref41$row===void 0?1:_ref41$row;return col?_defineProperty2({display:'inline-block',verticalAlign:'inherit','& > *':{marginLeft:col*theme.layoutMargin,verticalAlign:'inherit'}},"& > *:first-child",{marginLeft:0}):_defineProperty2({'& > *':{marginTop:row*theme.layoutMargin}},"& > *:first-child",{marginTop:0});},function(_ref44){var theme=_ref44.theme,outer=_ref44.outer,col=_ref44.col,row=_ref44.row;switch(true){case!!(outer&&col):{return{marginLeft:outer*theme.layoutMargin,marginRight:outer*theme.layoutMargin};}case!!(outer&&row):{return{marginTop:outer*theme.layoutMargin,marginBottom:outer*theme.layoutMargin};}default:{return{};}}});var Spaced=function Spaced(_a){var col=_a.col,row=_a.row,outer=_a.outer,children=_a.children,rest=__rest(_a,["col","row","outer","children"]);var outerAmount=toNumber(typeof outer==='number'||!outer?outer:col||row);return React__default.createElement(Container,Object.assign({col:col,row:row,outer:outerAmount},rest),children);};var Title$3=styled.div(function(_ref45){var theme=_ref45.theme;return{fontWeight:theme.typography.weight.bold};});var Desc$1=styled.div();var Message$1=styled.div(function(_ref46){var theme=_ref46.theme;return{padding:30,textAlign:'center',color:theme.color.defaultText,fontSize:theme.typography.size.s2-1};});var Placeholder=function Placeholder(_a){var children=_a.children,props=__rest(_a,["children"]);var _Children$toArray=Children.toArray(children),_Children$toArray2=_slicedToArray(_Children$toArray,2),title=_Children$toArray2[0],desc=_Children$toArray2[1];return React__default.createElement(Message$1,Object.assign({},props),React__default.createElement(Title$3,null,title),desc&&React__default.createElement(Desc$1,null,desc));};var GlobalScrollAreaStyles=lazy(function(){return import('./GlobalScrollAreaStyles-8793ce4a.js');});var OverlayScrollbars=lazy(function(){return import('./OverlayScrollbars-26c4a78d.js');});var Scroller=function Scroller(_a){var props=__rest(_a,["horizontal","vertical"]);return React__default.createElement(Suspense,{fallback:React__default.createElement("div",Object.assign({},props))},React__default.createElement(GlobalScrollAreaStyles,null),React__default.createElement(OverlayScrollbars,Object.assign({options:{scrollbars:{autoHide:'leave'}}},props)));};var ScrollArea=styled(Scroller)(function(_ref47){var vertical=_ref47.vertical;return!vertical?{overflowY:'hidden'}:{overflowY:'auto',height:'100%'};},function(_ref48){var horizontal=_ref48.horizontal;return!horizontal?{overflowX:'hidden'}:{overflowX:'auto',width:'100%'};});ScrollArea.defaultProps={horizontal:false,vertical:false};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 win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else{win={};}var window_1=win;var globalWindow$2=window_1.window;function browserSupportsCssZoom(){try{return globalWindow$2.document.implementation.createHTMLDocument('').body.style.zoom!==undefined;}catch(error){return false;}}var ZoomElementWrapper=styled.div(function(_ref49){var _ref49$scale=_ref49.scale,scale=_ref49$scale===void 0?1:_ref49$scale,height=_ref49.height;return browserSupportsCssZoom()?{'> *':{zoom:1/scale}}:{height:height+50,transformOrigin:'top left',transform:"scale(".concat(1/scale,")")};});function ZoomElement(_ref50){var scale=_ref50.scale,children=_ref50.children;var componentWrapperRef=useRef(null);var _useState=useState(0),_useState2=_slicedToArray(_useState,2),height=_useState2[0],setHeight=_useState2[1];useEffect(function(){if(componentWrapperRef.current){setHeight(componentWrapperRef.current.getBoundingClientRect().height);}},[scale,componentWrapperRef.current]);return React__default.createElement(ZoomElementWrapper,{scale:scale,height:height},React__default.createElement("div",{ref:componentWrapperRef,className:"innerZoomElementWrapper"},children));}var ZoomIFrame=/*#__PURE__*/function(_Component){_inherits(ZoomIFrame,_Component);var _super=_createSuper(ZoomIFrame);function ZoomIFrame(){var _this2;_classCallCheck(this,ZoomIFrame);_this2=_super.apply(this,arguments);_this2.iframe=null;return _this2;}_createClass(ZoomIFrame,[{key:"componentDidMount",value:function componentDidMount(){var iFrameRef=this.props.iFrameRef;this.iframe=iFrameRef.current;}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){var _this$props=this.props,scale=_this$props.scale,active=_this$props.active;if(scale!==nextProps.scale){this.setIframeInnerZoom(nextProps.scale);}if(active!==nextProps.active){this.iframe.setAttribute('data-is-storybook',nextProps.active?'true':'false');}// this component renders an iframe, which gets updates via post-messages
|
|
314
314
|
// never update this component, it will cause the iframe to refresh
|
|
315
315
|
// the only exception is when the url changes, which happens when the version changes
|
|
316
316
|
return nextProps.children.props.src!==this.props.children.props.src;}},{key:"setIframeInnerZoom",value:function setIframeInnerZoom(scale){try{if(browserSupportsCssZoom()){Object.assign(this.iframe.contentDocument.body.style,{zoom:1/scale});}else{Object.assign(this.iframe.contentDocument.body.style,{width:"".concat(scale*100,"%"),height:"".concat(scale*100,"%"),transform:"scale(".concat(1/scale,")"),transformOrigin:'top left'});}}catch(e){this.setIframeZoom(scale);}}},{key:"setIframeZoom",value:function setIframeZoom(scale){Object.assign(this.iframe.style,{width:"".concat(scale*100,"%"),height:"".concat(scale*100,"%"),transform:"scale(".concat(1/scale,")"),transformOrigin:'top left'});}},{key:"render",value:function render(){var children=this.props.children;return children;}}]);return ZoomIFrame;}(Component);var Zoom$1={Element:ZoomElement,IFrame:ZoomIFrame};var ButtonWrapper=styled.button(function(_ref51){var small=_ref51.small,theme=_ref51.theme;return{border:0,borderRadius:'3em',cursor:'pointer',display:'inline-block',overflow:'hidden',padding:small?'8px 16px':'13px 20px',position:'relative',textAlign:'center',textDecoration:'none',transition:'all 150ms ease-out',transform:'translate3d(0,0,0)',verticalAlign:'top',whiteSpace:'nowrap',userSelect:'none',opacity:1,margin:0,background:'transparent',fontSize:"".concat(small?theme.typography.size.s1:theme.typography.size.s2-1,"px"),fontWeight:theme.typography.weight.bold,lineHeight:'1',svg:{display:'inline-block',height:small?14:16,width:small?14:16,verticalAlign:'top',marginRight:small?4:6,marginTop:small?-1:-2,marginBottom:small?-1:-2,/* Necessary for js mouse events to not glitch out when hovering on svgs */pointerEvents:'none',path:{fill:'currentColor'}}};},function(_ref52){var disabled=_ref52.disabled;return disabled?{cursor:'not-allowed !important',opacity:0.5,'&:hover':{transform:'none'}}:{};},function(_ref53){var containsIcon=_ref53.containsIcon,small=_ref53.small;return containsIcon?Object.assign({svg:{display:'block',margin:0}},small?{padding:9}:{padding:12}):{};},function(_ref54){var theme=_ref54.theme,primary=_ref54.primary,secondary=_ref54.secondary,gray=_ref54.gray;var color;if(gray){color=theme.color.medium;}else if(secondary){color=theme.color.secondary;}else if(primary){color=theme.color.primary;}return color?{background:color,color:gray?theme.color.darkest:theme.color.lightest,'&:hover':{background:curriedDarken$1(0.05,color)},'&:active':{boxShadow:'rgba(0, 0, 0, 0.1) 0 0 0 3em inset'},'&:focus':{boxShadow:"".concat(rgba(color,1)," 0 1px 9px 2px"),outline:'none'},'&:focus:hover':{boxShadow:"".concat(rgba(color,0.2)," 0 8px 18px 0px")}}:{};},function(_ref55){var theme=_ref55.theme,tertiary=_ref55.tertiary,inForm=_ref55.inForm,small=_ref55.small;return tertiary?Object.assign(Object.assign({background:theme.base==='light'?curriedDarken$1(0.02,theme.input.background):curriedLighten$1(0.02,theme.input.background),color:theme.input.color,boxShadow:"".concat(theme.input.border," 0 0 0 1px inset"),borderRadius:theme.input.borderRadius},inForm&&small?{padding:'10px 16px'}:{}),{'&:hover':Object.assign({background:theme.base==='light'?curriedDarken$1(0.05,theme.input.background):curriedLighten$1(0.05,theme.input.background)},inForm?{}:{boxShadow:'rgba(0,0,0,.2) 0 2px 6px 0, rgba(0,0,0,.1) 0 0 0 1px inset'}),'&:active':{background:theme.input.background},'&:focus':{boxShadow:"".concat(rgba(theme.color.secondary,1)," 0 0 0 1px inset"),outline:'none'}}):{};},function(_ref56){var theme=_ref56.theme,outline=_ref56.outline;return outline?{boxShadow:"".concat(curriedTransparentize$1(0.8,theme.color.defaultText)," 0 0 0 1px inset"),color:curriedTransparentize$1(0.3,theme.color.defaultText),background:'transparent','&:hover, &:focus':{boxShadow:"".concat(curriedTransparentize$1(0.5,theme.color.defaultText)," 0 0 0 1px inset"),outline:'none'},'&:active':{boxShadow:"".concat(curriedTransparentize$1(0.5,theme.color.defaultText)," 0 0 0 2px inset"),color:curriedTransparentize$1(0,theme.color.defaultText)}}:{};},function(_ref57){var theme=_ref57.theme,outline=_ref57.outline,primary=_ref57.primary;var color=theme.color.primary;return outline&&primary?{boxShadow:"".concat(color," 0 0 0 1px inset"),color:color,'svg path':{fill:color},'&:hover':{boxShadow:"".concat(color," 0 0 0 1px inset"),background:'transparent'},'&:active':{background:color,boxShadow:"".concat(color," 0 0 0 1px inset"),color:theme.color.tertiary},'&:focus':{boxShadow:"".concat(color," 0 0 0 1px inset, ").concat(rgba(color,0.4)," 0 1px 9px 2px"),outline:'none'},'&:focus:hover':{boxShadow:"".concat(color," 0 0 0 1px inset, ").concat(rgba(color,0.2)," 0 8px 18px 0px")}}:{};},function(_ref58){var theme=_ref58.theme,outline=_ref58.outline,primary=_ref58.primary,secondary=_ref58.secondary;var color;if(secondary){color=theme.color.secondary;}else if(primary){color=theme.color.primary;}return outline&&color?{boxShadow:"".concat(color," 0 0 0 1px inset"),color:color,'svg path':{fill:color},'&:hover':{boxShadow:"".concat(color," 0 0 0 1px inset"),background:'transparent'},'&:active':{background:color,boxShadow:"".concat(color," 0 0 0 1px inset"),color:theme.color.tertiary},'&:focus':{boxShadow:"".concat(color," 0 0 0 1px inset, ").concat(rgba(color,0.4)," 0 1px 9px 2px"),outline:'none'},'&:focus:hover':{boxShadow:"".concat(color," 0 0 0 1px inset, ").concat(rgba(color,0.2)," 0 8px 18px 0px")}}:{};});var ButtonLink=ButtonWrapper.withComponent('a');var Button$2=Object.assign(forwardRef(function(_a,ref){var isLink=_a.isLink,children=_a.children,props=__rest(_a,["isLink","children"]);if(isLink){return React__default.createElement(ButtonLink,Object.assign({},props,{ref:ref}),children);}return React__default.createElement(ButtonWrapper,Object.assign({},props,{ref:ref}),children);}),{defaultProps:{isLink:false}});var Wrapper$7=styled.label(function(_ref59){var theme=_ref59.theme;return{display:'flex',borderBottom:"1px solid ".concat(theme.appBorderColor),margin:'0 15px',padding:'8px 0','&:last-child':{marginBottom:'3rem'}};});var Label$4=styled.span(function(_ref60){var theme=_ref60.theme;return{minWidth:100,fontWeight:theme.typography.weight.bold,marginRight:15,display:'flex',justifyContent:'flex-start',alignItems:'center',lineHeight:'16px'};});var Field=function Field(_a){var label=_a.label,children=_a.children,props=__rest(_a,["label","children"]);return React__default.createElement(Wrapper$7,Object.assign({},props),label?React__default.createElement(Label$4,null,React__default.createElement("span",null,label)):null,children);};Field.defaultProps={label:undefined};function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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;}var index$1=typeof document!=='undefined'?useLayoutEffect:useEffect;var useLatest=function useLatest(value){var ref=useRef(value);index$1(function(){ref.current=value;});return ref;};var updateRef=function updateRef(ref,value){if(typeof ref==='function'){ref(value);return;}ref.current=value;};var useComposedRef=function useComposedRef(libRef,userRef){var prevUserRef=useRef();return useCallback(function(instance){libRef.current=instance;if(prevUserRef.current){updateRef(prevUserRef.current,null);}prevUserRef.current=userRef;if(!userRef){return;}updateRef(userRef,instance);},[userRef]);};var HIDDEN_TEXTAREA_STYLE={'min-height':'0','max-height':'none',height:'0',visibility:'hidden',overflow:'hidden',position:'absolute','z-index':'-1000',top:'0',right:'0'};var forceHiddenStyles=function forceHiddenStyles(node){Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function(key){node.style.setProperty(key,HIDDEN_TEXTAREA_STYLE[key],'important');});};// export type CalculatedNodeHeights = [height: number, rowHeight: number];
|
|
@@ -326,21 +326,8 @@ if(boxSizing===''){return null;}// IE (Edge has already correct behaviour) retur
|
|
|
326
326
|
if(isIE&&boxSizing==='border-box'){sizingStyle.width=parseFloat(sizingStyle.width)+parseFloat(sizingStyle.borderRightWidth)+parseFloat(sizingStyle.borderLeftWidth)+parseFloat(sizingStyle.paddingRight)+parseFloat(sizingStyle.paddingLeft)+'px';}var paddingSize=parseFloat(sizingStyle.paddingBottom)+parseFloat(sizingStyle.paddingTop);var borderSize=parseFloat(sizingStyle.borderBottomWidth)+parseFloat(sizingStyle.borderTopWidth);return{sizingStyle:sizingStyle,paddingSize:paddingSize,borderSize:borderSize};};var useWindowResizeListener=function useWindowResizeListener(listener){var latestListener=useLatest(listener);useLayoutEffect(function(){var handler=function handler(event){latestListener.current(event);};window.addEventListener('resize',handler);return function(){window.removeEventListener('resize',handler);};},[]);};var TextareaAutosize=function TextareaAutosize(_ref,userRef){var cacheMeasurements=_ref.cacheMeasurements,maxRows=_ref.maxRows,minRows=_ref.minRows,_ref$onChange=_ref.onChange,onChange=_ref$onChange===void 0?noop$2:_ref$onChange,_ref$onHeightChange=_ref.onHeightChange,onHeightChange=_ref$onHeightChange===void 0?noop$2:_ref$onHeightChange,props=_objectWithoutPropertiesLoose(_ref,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]);if(process.env.NODE_ENV!=='production'&&props.style){if('maxHeight'in props.style){throw new Error('Using `style.maxHeight` for <TextareaAutosize/> is not supported. Please use `maxRows`.');}if('minHeight'in props.style){throw new Error('Using `style.minHeight` for <TextareaAutosize/> is not supported. Please use `minRows`.');}}var isControlled=props.value!==undefined;var libRef=useRef(null);var ref=useComposedRef(libRef,userRef);var heightRef=useRef(0);var measurementsCacheRef=useRef();var resizeTextarea=function resizeTextarea(){var node=libRef.current;var nodeSizingData=cacheMeasurements&&measurementsCacheRef.current?measurementsCacheRef.current:getSizingData(node);if(!nodeSizingData){return;}measurementsCacheRef.current=nodeSizingData;var _calculateNodeHeight=calculateNodeHeight(nodeSizingData,node.value||node.placeholder||'x',minRows,maxRows),height=_calculateNodeHeight[0],rowHeight=_calculateNodeHeight[1];if(heightRef.current!==height){heightRef.current=height;node.style.setProperty('height',height+"px",'important');onHeightChange(height,{rowHeight:rowHeight});}};var handleChange=function handleChange(event){if(!isControlled){resizeTextarea();}onChange(event);};if(typeof document!=='undefined'){useLayoutEffect(resizeTextarea);useWindowResizeListener(resizeTextarea);}return/*#__PURE__*/createElement("textarea",_extends({},props,{onChange:handleChange,ref:ref}));};var index=/* #__PURE__ */forwardRef(TextareaAutosize);var TextareaAutoResize=index;var styleResets$1={// resets
|
|
327
327
|
appearance:'none',border:'0 none',boxSizing:'inherit',display:' block',margin:' 0',background:'transparent',padding:0,fontSize:'inherit',position:'relative'};var styles=function styles(_ref61){var theme=_ref61.theme;return Object.assign(Object.assign({},styleResets$1),{transition:'box-shadow 200ms ease-out, opacity 200ms ease-out',color:theme.input.color||'inherit',background:theme.input.background,boxShadow:"".concat(theme.input.border," 0 0 0 1px inset"),borderRadius:theme.input.borderRadius,fontSize:theme.typography.size.s2-1,lineHeight:'20px',padding:'6px 10px','&:focus':{boxShadow:"".concat(theme.color.secondary," 0 0 0 1px inset"),outline:'none'},'&[disabled]':{cursor:'not-allowed',opacity:0.5},'&:-webkit-autofill':{WebkitBoxShadow:"0 0 0 3em ".concat(theme.color.lightest," inset")},'::placeholder':{color:theme.color.mediumdark}});};var sizes=function sizes(_ref62){var size=_ref62.size;switch(size){case'100%':{return{width:'100%'};}case'flex':{return{flex:1};}case'auto':default:{return{display:'inline'};}}};var alignment=function alignment(_ref63){var align=_ref63.align;switch(align){case'end':{return{textAlign:'right'};}case'center':{return{textAlign:'center'};}case'start':default:{return{textAlign:'left'};}}};var validation=function validation(_ref64){var valid=_ref64.valid,theme=_ref64.theme;switch(valid){case'valid':{return{boxShadow:"".concat(theme.color.positive," 0 0 0 1px inset !important")};}case'error':{return{boxShadow:"".concat(theme.color.negative," 0 0 0 1px inset !important")};}case'warn':{return{boxShadow:"".concat(theme.color.warning," 0 0 0 1px inset")};}case undefined:case null:default:{return{};}}};var Input$1=Object.assign(styled(forwardRef(function(_a,ref){var props=__rest(_a,["size","valid","align"]);return React__default.createElement("input",Object.assign({},props,{ref:ref}));}))(styles,sizes,alignment,validation,{minHeight:32}),{displayName:'Input'});var Select=Object.assign(styled(forwardRef(function(_a,ref){var props=__rest(_a,["size","valid","align"]);return React__default.createElement("select",Object.assign({},props,{ref:ref}));}))(styles,sizes,validation,{height:32,userSelect:'none',paddingRight:20,appearance:'menulist'}),{displayName:'Select'});var Textarea=Object.assign(styled(forwardRef(function(_a,ref){var props=__rest(_a,["size","valid","align"]);return React__default.createElement(TextareaAutoResize,Object.assign({},props,{ref:ref}));}))(styles,sizes,alignment,validation,function(_ref65){var _ref65$height=_ref65.height,height=_ref65$height===void 0?400:_ref65$height;return{overflow:'visible',maxHeight:height};}),{displayName:'Textarea'});var ButtonStyled=styled(forwardRef(function(_a,ref){var props=__rest(_a,["size","valid","align"]);return React__default.createElement(Button$2,Object.assign({},props,{ref:ref}));}))(sizes,validation,{// Custom styling for color widget nested in buttons
|
|
328
328
|
userSelect:'none',overflow:'visible',zIndex:2,// overrides the default hover from Button
|
|
329
|
-
'&:hover':{transform:'none'}});var Button$1=Object.assign(forwardRef(function(props,ref){return React__default.createElement(ButtonStyled,Object.assign({},props,{tertiary:true,small:true,inForm:true},{ref:ref}));}),{displayName:'Button'});var Form=Object.assign(styled.form({boxSizing:'border-box',width:'100%'}),{Field:Field,Input:Input$1,Select:Select,Textarea:Textarea,Button:Button$1});var LazyWithTooltip=lazy(function(){return import('./WithTooltip-
|
|
330
|
-
|
|
331
|
-
Similar.prototype.isEqual=function(val1,val2){return val1===val2||val1!==val1&&val2!==val2;};var similar=Similar;var mapOrSimilar=function mapOrSimilar(forceSimilar){if(typeof Map!=='function'||forceSimilar){var Similar=similar;return new Similar();}else{return new Map();}};var MapOrSimilar=mapOrSimilar;var memoizerific=function memoizerific(limit){var cache=new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP==='true'),lru=[];return function(fn){var memoizerific=function memoizerific(){var currentCache=cache,newMap,fnResult,argsLengthMinusOne=arguments.length-1,lruPath=Array(argsLengthMinusOne+1),isMemoized=true,i;if((memoizerific.numArgs||memoizerific.numArgs===0)&&memoizerific.numArgs!==argsLengthMinusOne+1){throw new Error('Memoizerific functions should always be called with the same number of arguments');}// loop through each argument to traverse the map tree
|
|
332
|
-
for(i=0;i<argsLengthMinusOne;i++){lruPath[i]={cacheItem:currentCache,arg:arguments[i]};// climb through the hierarchical map tree until the second-last argument has been found, or an argument is missing.
|
|
333
|
-
// if all arguments up to the second-last have been found, this will potentially be a cache hit (determined later)
|
|
334
|
-
if(currentCache.has(arguments[i])){currentCache=currentCache.get(arguments[i]);continue;}isMemoized=false;// make maps until last value
|
|
335
|
-
newMap=new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP==='true');currentCache.set(arguments[i],newMap);currentCache=newMap;}// we are at the last arg, check if it is really memoized
|
|
336
|
-
if(isMemoized){if(currentCache.has(arguments[argsLengthMinusOne])){fnResult=currentCache.get(arguments[argsLengthMinusOne]);}else{isMemoized=false;}}// if the result wasn't memoized, compute it and cache it
|
|
337
|
-
if(!isMemoized){fnResult=fn.apply(null,arguments);currentCache.set(arguments[argsLengthMinusOne],fnResult);}// if there is a cache limit, purge any extra results
|
|
338
|
-
if(limit>0){lruPath[argsLengthMinusOne]={cacheItem:currentCache,arg:arguments[argsLengthMinusOne]};if(isMemoized){moveToMostRecentLru(lru,lruPath);}else{lru.push(lruPath);}if(lru.length>limit){removeCachedResult(lru.shift());}}memoizerific.wasMemoized=isMemoized;memoizerific.numArgs=argsLengthMinusOne+1;return fnResult;};memoizerific.limit=limit;memoizerific.wasMemoized=false;memoizerific.cache=cache;memoizerific.lru=lru;return memoizerific;};};// move current args to most recent position
|
|
339
|
-
function moveToMostRecentLru(lru,lruPath){var lruLen=lru.length,lruPathLen=lruPath.length,isMatch,i,ii;for(i=0;i<lruLen;i++){isMatch=true;for(ii=0;ii<lruPathLen;ii++){if(!isEqual(lru[i][ii].arg,lruPath[ii].arg)){isMatch=false;break;}}if(isMatch){break;}}lru.push(lru.splice(i,1)[0]);}// remove least recently used cache item and all dead branches
|
|
340
|
-
function removeCachedResult(removedLru){var removedLruLen=removedLru.length,currentLru=removedLru[removedLruLen-1],tmp,i;currentLru.cacheItem.delete(currentLru.arg);// walk down the tree removing dead branches (size 0) along the way
|
|
341
|
-
for(i=removedLruLen-2;i>=0;i--){currentLru=removedLru[i];tmp=currentLru.cacheItem.get(currentLru.arg);if(!tmp||!tmp.size){currentLru.cacheItem.delete(currentLru.arg);}else{break;}}}// check if the numbers are equal, or whether they are both precisely NaN (isNaN returns true for all non-numbers)
|
|
342
|
-
function isEqual(val1,val2){return val1===val2||val1!==val1&&val2!==val2;}var Title$1=styled(function(_a){var rest=__rest(_a,["active","loading","disabled"]);return React__default.createElement("span",Object.assign({},rest));})(function(_ref71){var theme=_ref71.theme;return{color:theme.color.defaultText,// Previously was theme.typography.weight.normal but this weight does not exists in Theme
|
|
343
|
-
fontWeight:theme.typography.weight.regular};},function(_ref72){var active=_ref72.active,theme=_ref72.theme;return active?{color:theme.color.primary,fontWeight:theme.typography.weight.bold}:{};},function(_ref73){var loading=_ref73.loading,theme=_ref73.theme;return loading?Object.assign({display:'inline-block',flex:'none'},theme.animation.inlineGlow):{};},function(_ref74){var disabled=_ref74.disabled,theme=_ref74.theme;return disabled?{color:curriedTransparentize$1(0.7,theme.color.defaultText)}:{};});var Right=styled.span({'& svg':{transition:'all 200ms ease-out',opacity:0,height:12,width:12,margin:'3px 0',verticalAlign:'top'},'& path':{fill:'inherit'}},function(_ref75){var active=_ref75.active,theme=_ref75.theme;return active?{'& svg':{opacity:1},'& path':{fill:theme.color.primary}}:{};});var Center=styled.span({flex:1,textAlign:'left',display:'inline-flex','& > * + *':{paddingLeft:10}});var CenterText=styled.span({flex:1,textAlign:'center'},function(_ref76){var active=_ref76.active,theme=_ref76.theme;return active?{color:theme.color.primary}:{};},function(_ref77){var theme=_ref77.theme,disabled=_ref77.disabled;return disabled?{color:theme.color.mediumdark}:{};});var Left=styled.span(function(_ref78){var active=_ref78.active,theme=_ref78.theme;return active?{'& svg':{opacity:1},'& path':{fill:theme.color.primary}}:{};});var Item$3=styled.a(function(_ref79){var theme=_ref79.theme;return{fontSize:theme.typography.size.s1,transition:'all 150ms ease-out',color:curriedTransparentize$1(0.5,theme.color.defaultText),textDecoration:'none',cursor:'pointer',justifyContent:'space-between',lineHeight:'18px',padding:'7px 15px',display:'flex',alignItems:'center','& > * + *':{paddingLeft:10},'&:hover':{background:theme.background.hoverable},'&:hover svg':{opacity:1}};},function(_ref80){var disabled=_ref80.disabled;return disabled?{cursor:'not-allowed'}:{};});var getItemProps=memoizerific(100)(function(onClick,href,LinkWrapper){var result={};if(onClick){Object.assign(result,{onClick:onClick});}if(href){Object.assign(result,{href:href});}if(LinkWrapper&&href){Object.assign(result,{to:href,as:LinkWrapper});}return result;});var ListItem=function ListItem(_a){var loading=_a.loading,left=_a.left,title=_a.title,center=_a.center,right=_a.right,active=_a.active,disabled=_a.disabled,href=_a.href,onClick=_a.onClick,LinkWrapper=_a.LinkWrapper,rest=__rest(_a,["loading","left","title","center","right","active","disabled","href","onClick","LinkWrapper"]);var itemProps=getItemProps(onClick,href,LinkWrapper);var commonProps={active:active,disabled:disabled};return React__default.createElement(Item$3,Object.assign({},commonProps,rest,itemProps),left&&React__default.createElement(Left,Object.assign({},commonProps),left),title||center?React__default.createElement(Center,null,title&&React__default.createElement(Title$1,Object.assign({},commonProps,{loading:loading}),title),center&&React__default.createElement(CenterText,Object.assign({},commonProps),center)):null,right&&React__default.createElement(Right,Object.assign({},commonProps),right));};ListItem.defaultProps={loading:false,left:null,title:React__default.createElement("span",null,"Loading state"),center:null,right:null,active:false,disabled:false,href:null,LinkWrapper:null,onClick:null};var List$2=styled.div({minWidth:180,overflow:'hidden',overflowY:'auto',maxHeight:13.5*32},function(_ref81){var theme=_ref81.theme;return{borderRadius:theme.appBorderRadius*2};});var Item$2=function Item$2(props){var LinkWrapper=props.LinkWrapper,onClickFromProps=props.onClick,rest=__rest(props,["LinkWrapper","onClick"]);var title=rest.title,href=rest.href,active=rest.active;var onClick=useCallback(function(event){onClickFromProps(event,rest);},[onClickFromProps]);var hasOnClick=!!onClickFromProps;return React__default.createElement(ListItem,Object.assign({title:title,active:active,href:href,LinkWrapper:LinkWrapper},rest,hasOnClick?{onClick:onClick}:{}));};var TooltipLinkList=function TooltipLinkList(_ref82){var links=_ref82.links,LinkWrapper=_ref82.LinkWrapper;return React__default.createElement(List$2,null,links.map(function(_a){var isGatsby=_a.isGatsby,p=__rest(_a,["isGatsby"]);return React__default.createElement(Item$2,Object.assign({key:p.id,LinkWrapper:isGatsby?LinkWrapper:null},p));}));};TooltipLinkList.defaultProps={LinkWrapper:ListItem.defaultProps.LinkWrapper};var Side=styled.div({display:'flex',whiteSpace:'nowrap',flexBasis:'auto',flexShrink:0,marginLeft:3,marginRight:3},function(_ref83){var left=_ref83.left;return left?{'& > *':{marginLeft:4}}:{};},function(_ref84){var right=_ref84.right;return right?{marginLeft:30,'& > *':{marginRight:4}}:{};});Side.displayName='Side';var Bar$1=styled(function(_ref85){var children=_ref85.children,className=_ref85.className;return React__default.createElement(ScrollArea,{horizontal:true,vertical:false,className:className},children);})(function(_ref86){var theme=_ref86.theme;return{color:theme.barTextColor,width:'100%',height:40,flexShrink:0,overflow:'auto',overflowY:'hidden'};},function(_ref87){var theme=_ref87.theme,border=_ref87.border;return border?{boxShadow:"".concat(theme.appBorderColor," 0 -1px 0 0 inset"),background:theme.barBg}:{};});Bar$1.displayName='Bar';var BarInner=styled.div(function(_ref88){var bgColor=_ref88.bgColor;return{display:'flex',justifyContent:'space-between',position:'relative',flexWrap:'nowrap',flexShrink:0,height:40,backgroundColor:bgColor||''};});var FlexBar=function FlexBar(_a){var children=_a.children,backgroundColor=_a.backgroundColor,rest=__rest(_a,["children","backgroundColor"]);var _Children$toArray3=Children.toArray(children),_Children$toArray4=_slicedToArray(_Children$toArray3,2),left=_Children$toArray4[0],right=_Children$toArray4[1];return React__default.createElement(Bar$1,Object.assign({},rest),React__default.createElement(BarInner,{bgColor:backgroundColor},React__default.createElement(Side,{left:true},left),right?React__default.createElement(Side,{right:true},right):null));};FlexBar.displayName='FlexBar';var top='top';var bottom='bottom';var right='right';var left='left';var auto='auto';var basePlacements=[top,bottom,right,left];var start='start';var end='end';var clippingParents='clippingParents';var viewport='viewport';var popper='popper';var reference='reference';var variationPlacements=/*#__PURE__*/basePlacements.reduce(function(acc,placement){return acc.concat([placement+"-"+start,placement+"-"+end]);},[]);var placements=/*#__PURE__*/[].concat(basePlacements,[auto]).reduce(function(acc,placement){return acc.concat([placement,placement+"-"+start,placement+"-"+end]);},[]);// modifiers that need to read the DOM
|
|
329
|
+
'&:hover':{transform:'none'}});var Button$1=Object.assign(forwardRef(function(props,ref){return React__default.createElement(ButtonStyled,Object.assign({},props,{tertiary:true,small:true,inForm:true},{ref:ref}));}),{displayName:'Button'});var Form=Object.assign(styled.form({boxSizing:'border-box',width:'100%'}),{Field:Field,Input:Input$1,Select:Select,Textarea:Textarea,Button:Button$1});var LazyWithTooltip=lazy(function(){return import('./WithTooltip-508b8277.js').then(function(mod){return{default:mod.WithTooltip};});});var WithTooltip=function WithTooltip(props){return React__default.createElement(Suspense,{fallback:React__default.createElement("div",null)},React__default.createElement(LazyWithTooltip,Object.assign({},props)));};var LazyWithTooltipPure=lazy(function(){return import('./WithTooltip-508b8277.js').then(function(mod){return{default:mod.WithTooltipPure};});});var WithTooltipPure=function WithTooltipPure(props){return React__default.createElement(Suspense,{fallback:React__default.createElement("div",null)},React__default.createElement(LazyWithTooltipPure,Object.assign({},props)));};var Title$2=styled.div(function(_ref66){var theme=_ref66.theme;return{fontWeight:theme.typography.weight.black};});var Desc=styled.span();var Links=styled.div(function(_ref67){var theme=_ref67.theme;return{marginTop:8,textAlign:'center','> *':{margin:'0 8px',fontWeight:theme.typography.weight.black}};});var Message=styled.div(function(_ref68){var theme=_ref68.theme;return{color:theme.textColor,lineHeight:'18px'};});var MessageWrapper=styled.div({padding:15,width:280,boxSizing:'border-box'});var TooltipMessage=function TooltipMessage(_ref69){var title=_ref69.title,desc=_ref69.desc,links=_ref69.links;return React__default.createElement(MessageWrapper,null,React__default.createElement(Message,null,title&&React__default.createElement(Title$2,null,title),desc&&React__default.createElement(Desc,null,desc)),links&&React__default.createElement(Links,null,links.map(function(_a){var linkTitle=_a.title,other=__rest(_a,["title"]);return React__default.createElement(Link,Object.assign({},other,{key:linkTitle}),linkTitle);})));};TooltipMessage.defaultProps={title:null,desc:null,links:null};var Note=styled.div(function(_ref70){var theme=_ref70.theme;return{padding:'2px 6px',lineHeight:'16px',fontSize:10,fontWeight:theme.typography.weight.bold,color:theme.color.lightest,boxShadow:'0 0 5px 0 rgba(0, 0, 0, 0.3)',borderRadius:4,whiteSpace:'nowrap',pointerEvents:'none',zIndex:-1,background:theme.base==='light'?'rgba(60, 60, 60, 0.9)':'rgba(20, 20, 20, 0.85)',margin:6};});var TooltipNote=function TooltipNote(_a){var note=_a.note,props=__rest(_a,["note"]);return React__default.createElement(Note,Object.assign({},props),note);};var Title$1=styled(function(_a){var rest=__rest(_a,["active","loading","disabled"]);return React__default.createElement("span",Object.assign({},rest));})(function(_ref71){var theme=_ref71.theme;return{color:theme.color.defaultText,// Previously was theme.typography.weight.normal but this weight does not exists in Theme
|
|
330
|
+
fontWeight:theme.typography.weight.regular};},function(_ref72){var active=_ref72.active,theme=_ref72.theme;return active?{color:theme.color.primary,fontWeight:theme.typography.weight.bold}:{};},function(_ref73){var loading=_ref73.loading,theme=_ref73.theme;return loading?Object.assign({display:'inline-block',flex:'none'},theme.animation.inlineGlow):{};},function(_ref74){var disabled=_ref74.disabled,theme=_ref74.theme;return disabled?{color:curriedTransparentize$1(0.7,theme.color.defaultText)}:{};});var Right=styled.span({'& svg':{transition:'all 200ms ease-out',opacity:0,height:12,width:12,margin:'3px 0',verticalAlign:'top'},'& path':{fill:'inherit'}},function(_ref75){var active=_ref75.active,theme=_ref75.theme;return active?{'& svg':{opacity:1},'& path':{fill:theme.color.primary}}:{};});var Center=styled.span({flex:1,textAlign:'left',display:'inline-flex','& > * + *':{paddingLeft:10}});var CenterText=styled.span({flex:1,textAlign:'center'},function(_ref76){var active=_ref76.active,theme=_ref76.theme;return active?{color:theme.color.primary}:{};},function(_ref77){var theme=_ref77.theme,disabled=_ref77.disabled;return disabled?{color:theme.color.mediumdark}:{};});var Left=styled.span(function(_ref78){var active=_ref78.active,theme=_ref78.theme;return active?{'& svg':{opacity:1},'& path':{fill:theme.color.primary}}:{};});var Item$3=styled.a(function(_ref79){var theme=_ref79.theme;return{fontSize:theme.typography.size.s1,transition:'all 150ms ease-out',color:curriedTransparentize$1(0.5,theme.color.defaultText),textDecoration:'none',cursor:'pointer',justifyContent:'space-between',lineHeight:'18px',padding:'7px 15px',display:'flex',alignItems:'center','& > * + *':{paddingLeft:10},'&:hover':{background:theme.background.hoverable},'&:hover svg':{opacity:1}};},function(_ref80){var disabled=_ref80.disabled;return disabled?{cursor:'not-allowed'}:{};});var getItemProps=memoize$2(100)(function(onClick,href,LinkWrapper){var result={};if(onClick){Object.assign(result,{onClick:onClick});}if(href){Object.assign(result,{href:href});}if(LinkWrapper&&href){Object.assign(result,{to:href,as:LinkWrapper});}return result;});var ListItem=function ListItem(_a){var loading=_a.loading,left=_a.left,title=_a.title,center=_a.center,right=_a.right,active=_a.active,disabled=_a.disabled,href=_a.href,onClick=_a.onClick,LinkWrapper=_a.LinkWrapper,rest=__rest(_a,["loading","left","title","center","right","active","disabled","href","onClick","LinkWrapper"]);var itemProps=getItemProps(onClick,href,LinkWrapper);var commonProps={active:active,disabled:disabled};return React__default.createElement(Item$3,Object.assign({},commonProps,rest,itemProps),left&&React__default.createElement(Left,Object.assign({},commonProps),left),title||center?React__default.createElement(Center,null,title&&React__default.createElement(Title$1,Object.assign({},commonProps,{loading:loading}),title),center&&React__default.createElement(CenterText,Object.assign({},commonProps),center)):null,right&&React__default.createElement(Right,Object.assign({},commonProps),right));};ListItem.defaultProps={loading:false,left:null,title:React__default.createElement("span",null,"Loading state"),center:null,right:null,active:false,disabled:false,href:null,LinkWrapper:null,onClick:null};var List$2=styled.div({minWidth:180,overflow:'hidden',overflowY:'auto',maxHeight:13.5*32},function(_ref81){var theme=_ref81.theme;return{borderRadius:theme.appBorderRadius*2};});var Item$2=function Item$2(props){var LinkWrapper=props.LinkWrapper,onClickFromProps=props.onClick,rest=__rest(props,["LinkWrapper","onClick"]);var title=rest.title,href=rest.href,active=rest.active;var onClick=useCallback(function(event){onClickFromProps(event,rest);},[onClickFromProps]);var hasOnClick=!!onClickFromProps;return React__default.createElement(ListItem,Object.assign({title:title,active:active,href:href,LinkWrapper:LinkWrapper},rest,hasOnClick?{onClick:onClick}:{}));};var TooltipLinkList=function TooltipLinkList(_ref82){var links=_ref82.links,LinkWrapper=_ref82.LinkWrapper;return React__default.createElement(List$2,null,links.map(function(_a){var isGatsby=_a.isGatsby,p=__rest(_a,["isGatsby"]);return React__default.createElement(Item$2,Object.assign({key:p.id,LinkWrapper:isGatsby?LinkWrapper:null},p));}));};TooltipLinkList.defaultProps={LinkWrapper:ListItem.defaultProps.LinkWrapper};var Side=styled.div({display:'flex',whiteSpace:'nowrap',flexBasis:'auto',flexShrink:0,marginLeft:3,marginRight:3},function(_ref83){var left=_ref83.left;return left?{'& > *':{marginLeft:4}}:{};},function(_ref84){var right=_ref84.right;return right?{marginLeft:30,'& > *':{marginRight:4}}:{};});Side.displayName='Side';var Bar$1=styled(function(_ref85){var children=_ref85.children,className=_ref85.className;return React__default.createElement(ScrollArea,{horizontal:true,vertical:false,className:className},children);})(function(_ref86){var theme=_ref86.theme;return{color:theme.barTextColor,width:'100%',height:40,flexShrink:0,overflow:'auto',overflowY:'hidden'};},function(_ref87){var theme=_ref87.theme,border=_ref87.border;return border?{boxShadow:"".concat(theme.appBorderColor," 0 -1px 0 0 inset"),background:theme.barBg}:{};});Bar$1.displayName='Bar';var BarInner=styled.div(function(_ref88){var bgColor=_ref88.bgColor;return{display:'flex',justifyContent:'space-between',position:'relative',flexWrap:'nowrap',flexShrink:0,height:40,backgroundColor:bgColor||''};});var FlexBar=function FlexBar(_a){var children=_a.children,backgroundColor=_a.backgroundColor,rest=__rest(_a,["children","backgroundColor"]);var _Children$toArray3=Children.toArray(children),_Children$toArray4=_slicedToArray(_Children$toArray3,2),left=_Children$toArray4[0],right=_Children$toArray4[1];return React__default.createElement(Bar$1,Object.assign({},rest),React__default.createElement(BarInner,{bgColor:backgroundColor},React__default.createElement(Side,{left:true},left),right?React__default.createElement(Side,{right:true},right):null));};FlexBar.displayName='FlexBar';var top='top';var bottom='bottom';var right='right';var left='left';var auto='auto';var basePlacements=[top,bottom,right,left];var start='start';var end='end';var clippingParents='clippingParents';var viewport='viewport';var popper='popper';var reference='reference';var variationPlacements=/*#__PURE__*/basePlacements.reduce(function(acc,placement){return acc.concat([placement+"-"+start,placement+"-"+end]);},[]);var placements=/*#__PURE__*/[].concat(basePlacements,[auto]).reduce(function(acc,placement){return acc.concat([placement,placement+"-"+start,placement+"-"+end]);},[]);// modifiers that need to read the DOM
|
|
344
331
|
var beforeRead='beforeRead';var read='read';var afterRead='afterRead';// pure-logic modifiers
|
|
345
332
|
var beforeMain='beforeMain';var main='main';var afterMain='afterMain';// modifier with the purpose to write to the DOM (or write into a framework state)
|
|
346
333
|
var beforeWrite='beforeWrite';var write='write';var afterWrite='afterWrite';var modifierPhases=[beforeRead,read,afterRead,beforeMain,main,afterMain,beforeWrite,write,afterWrite];var ButtonOrLink=function ButtonOrLink(_a){var children=_a.children,restProps=__rest(_a,["children"]);return restProps.href!=null?React__default.createElement("a",Object.assign({},restProps),children):React__default.createElement("button",Object.assign({type:"button"},restProps),children);};var TabButton=styled(ButtonOrLink,{shouldForwardProp:isPropValid})({whiteSpace:'normal',display:'inline-flex',overflow:'hidden',verticalAlign:'top',justifyContent:'center',alignItems:'center',textAlign:'center',textDecoration:'none','&:empty':{display:'none'}},function(_ref89){var theme=_ref89.theme;return{padding:'0 15px',transition:'color 0.2s linear, border-bottom-color 0.2s linear',height:40,lineHeight:'12px',cursor:'pointer',background:'transparent',border:'0 solid transparent',borderTop:'3px solid transparent',borderBottom:'3px solid transparent',fontWeight:'bold',fontSize:13,'&:focus':{outline:'0 none',borderBottomColor:theme.color.secondary}};},function(_ref90){var active=_ref90.active,textColor=_ref90.textColor,theme=_ref90.theme;return active?{color:textColor||theme.barSelectedColor,borderBottomColor:theme.barSelectedColor}:{color:textColor||theme.barTextColor,borderBottomColor:'transparent'};});TabButton.displayName='TabButton';var IconButton=styled(ButtonOrLink,{shouldForwardProp:isPropValid})(function(){return{alignItems:'center',background:'transparent',border:'none',borderRadius:4,color:'inherit',cursor:'pointer',display:'inline-flex',fontSize:13,fontWeight:'bold',height:28,justifyContent:'center',marginTop:6,padding:'8px 7px','& > svg':{width:14}};},function(_ref91){var active=_ref91.active,theme=_ref91.theme;return active?{backgroundColor:theme.background.hoverable,color:theme.color.secondary}:{};},function(_ref92){var disabled=_ref92.disabled,theme=_ref92.theme;return disabled?{opacity:0.5,cursor:'not-allowed'}:{'&:hover, &:focus-visible':{background:curriedTransparentize$1(0.88,theme.color.secondary),color:theme.color.secondary},'&:focus-visible':{outline:auto},'&:focus:not(:focus-visible)':{outline:'none'}};});IconButton.displayName='IconButton';var IconPlaceholder=styled.div(function(_ref93){var theme=_ref93.theme;return{width:14,height:14,backgroundColor:theme.appBorderColor,animation:"".concat(theme.animation.glow," 1.5s ease-in-out infinite")};});var IconButtonSkeletonWrapper=styled.div(function(){return{marginTop:6,padding:7,height:28};});var IconButtonSkeleton=function IconButtonSkeleton(){return React__default.createElement(IconButtonSkeletonWrapper,null,React__default.createElement(IconPlaceholder,null));};var Wrapper$6=styled.div(function(_ref94){var theme=_ref94.theme,bordered=_ref94.bordered;return bordered?{backgroundClip:'padding-box',border:"1px solid ".concat(theme.appBorderColor),borderRadius:theme.appBorderRadius,overflow:'hidden',boxSizing:'border-box'}:{};},function(_ref95){var absolute=_ref95.absolute;return absolute?{width:'100%',height:'100%',boxSizing:'border-box',display:'flex',flexDirection:'column'}:{display:'block'};});var TabBar=styled.div({overflow:'hidden','&:first-of-type':{marginLeft:-3}});var Content=styled.div({display:'block',position:'relative'},function(_ref96){var theme=_ref96.theme;return{fontSize:theme.typography.size.s2-1,background:theme.background.content};},function(_ref97){var bordered=_ref97.bordered,theme=_ref97.theme;return bordered?{borderRadius:"0 0 ".concat(theme.appBorderRadius-1,"px ").concat(theme.appBorderRadius-1,"px")}:{};},function(_ref98){var absolute=_ref98.absolute,bordered=_ref98.bordered;return absolute?_defineProperty2({height:"calc(100% - ".concat(bordered?42:40,"px)"),position:'absolute',left:0+(bordered?1:0),right:0+(bordered?1:0),bottom:0+(bordered?1:0),top:40+(bordered?1:0),overflow:'auto'},"& > *:first-child",{position:'absolute',left:0+(bordered?1:0),right:0+(bordered?1:0),bottom:0+(bordered?1:0),top:0+(bordered?1:0),height:"calc(100% - ".concat(bordered?2:0,"px)"),overflow:'auto'}):{};});var VisuallyHidden=styled.div(function(_ref100){var active=_ref100.active;return active?{display:'block'}:{display:'none'};});var TabWrapper=function TabWrapper(_ref101){var active=_ref101.active,render=_ref101.render,children=_ref101.children;return React__default.createElement(VisuallyHidden,{active:active},render?render():children);};var childrenToList=function childrenToList(children,selected){return Children.toArray(children).map(function(_ref102,index){var _ref102$props=_ref102.props,title=_ref102$props.title,id=_ref102$props.id,color=_ref102$props.color,childrenOfChild=_ref102$props.children;var content=Array.isArray(childrenOfChild)?childrenOfChild[0]:childrenOfChild;return{active:selected?id===selected:index===0,title:title,id:id,color:color,render:typeof content==='function'?content:function(_ref103){var active=_ref103.active,key=_ref103.key;return React__default.createElement(VisuallyHidden,{key:key,active:active,role:"tabpanel"},content);}};});};var Tabs=memo(function(_ref104){var children=_ref104.children,selected=_ref104.selected,actions=_ref104.actions,absolute=_ref104.absolute,bordered=_ref104.bordered,tools=_ref104.tools,backgroundColor=_ref104.backgroundColor,htmlId=_ref104.id;var list=childrenToList(children,selected);return list.length?React__default.createElement(Wrapper$6,{absolute:absolute,bordered:bordered,id:htmlId},React__default.createElement(FlexBar,{border:true,backgroundColor:backgroundColor},React__default.createElement(TabBar,{role:"tablist"},list.map(function(_ref105){var title=_ref105.title,id=_ref105.id,active=_ref105.active,color=_ref105.color;var tabTitle=typeof title==='function'?title():title;return React__default.createElement(TabButton,{id:"tabbutton-".concat(sanitize(tabTitle)),className:"tabbutton ".concat(active?'tabbutton-active':''),type:"button",key:id,active:active,textColor:color,onClick:function onClick(e){e.preventDefault();actions.onSelect(id);},role:"tab"},tabTitle);})),tools?React__default.createElement(Fragment,null,tools):null),React__default.createElement(Content,{id:"panel-tab-content",bordered:bordered,absolute:absolute},list.map(function(_ref106){var id=_ref106.id,active=_ref106.active,render=_ref106.render;return render({key:id,active:active});}))):React__default.createElement(Placeholder,null,React__default.createElement(Fragment,{key:"title"},"Nothing found"));});Tabs.displayName='Tabs';Tabs.defaultProps={id:null,children:null,tools:null,selected:null,absolute:false,bordered:false};var TabsState=/*#__PURE__*/function(_Component2){_inherits(TabsState,_Component2);var _super2=_createSuper(TabsState);function TabsState(props){var _this3;_classCallCheck(this,TabsState);_this3=_super2.call(this,props);_this3.handlers={onSelect:function onSelect(id){return _this3.setState({selected:id});}};_this3.state={selected:props.initial};return _this3;}_createClass(TabsState,[{key:"render",value:function render(){var _this$props2=this.props,_this$props2$bordered=_this$props2.bordered,bordered=_this$props2$bordered===void 0?false:_this$props2$bordered,_this$props2$absolute=_this$props2.absolute,absolute=_this$props2$absolute===void 0?false:_this$props2$absolute,children=_this$props2.children,backgroundColor=_this$props2.backgroundColor;var selected=this.state.selected;return React__default.createElement(Tabs,{bordered:bordered,absolute:absolute,selected:selected,backgroundColor:backgroundColor,actions:this.handlers},children);}}]);return TabsState;}(Component);TabsState.defaultProps={children:[],initial:null,absolute:false,bordered:false,backgroundColor:''};var Separator=styled.span(function(_ref107){var theme=_ref107.theme;return{width:1,height:20,background:theme.appBorderColor,marginTop:10,marginLeft:6,marginRight:2};},function(_ref108){var force=_ref108.force;return force?{}:{'& + &':{display:'none'}};});Separator.displayName='Separator';var interleaveSeparators=function interleaveSeparators(list){return list.reduce(function(acc,item,index){return item?React__default.createElement(Fragment,{key:item.id||item.key||"f-".concat(index)},acc,index>0?React__default.createElement(Separator,{key:"s-".concat(index)}):null,item.render()||item):acc;},null);};var usePrevious=function usePrevious(value){var ref=useRef();useEffect(function(){// happens after return
|
|
@@ -364,7 +351,7 @@ if(CONFIG_TYPE!=='DEVELOPMENT'||!EventSource)return undefined;var eventSource=ne
|
|
|
364
351
|
* items. The preview also shows the source for the component
|
|
365
352
|
* as a drop-down.
|
|
366
353
|
*/var Preview=function Preview(_a){var isLoading=_a.isLoading,isColumn=_a.isColumn,columns=_a.columns,children=_a.children,withSource=_a.withSource,_a$withToolbar=_a.withToolbar,withToolbar=_a$withToolbar===void 0?false:_a$withToolbar,_a$isExpanded=_a.isExpanded,isExpanded=_a$isExpanded===void 0?false:_a$isExpanded,additionalActions=_a.additionalActions,className=_a.className,props=__rest(_a,["isLoading","isColumn","columns","children","withSource","withToolbar","isExpanded","additionalActions","className"]);var _useState7=useState(isExpanded),_useState8=_slicedToArray(_useState7,2),expanded=_useState8[0],setExpanded=_useState8[1];var _getSource=getSource(withSource,expanded,setExpanded),source=_getSource.source,actionItem=_getSource.actionItem;var _useState9=useState(1),_useState10=_slicedToArray(_useState9,2),scale=_useState10[0],setScale=_useState10[1];var previewClasses=[className].concat(['sbdocs','sbdocs-preview']);var defaultActionItems=withSource?[actionItem]:[];var _useState11=useState(additionalActions?_toConsumableArray(additionalActions):[]),_useState12=_slicedToArray(_useState11,2),additionalActionItems=_useState12[0],setAdditionalActionItems=_useState12[1];var actionItems=[].concat(defaultActionItems,_toConsumableArray(additionalActionItems));// @ts-ignore
|
|
367
|
-
var layout=getLayout(Children.count(children)===1?[children]:children);var globalWindow=window_1.window;var copyToClipboard=useCallback(function(text){return __awaiter(void 0,void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _yield$import,createCopyToClipboardFunction;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return import('./syntaxhighlighter-
|
|
354
|
+
var layout=getLayout(Children.count(children)===1?[children]:children);var globalWindow=window_1.window;var copyToClipboard=useCallback(function(text){return __awaiter(void 0,void 0,void 0,/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _yield$import,createCopyToClipboardFunction;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return import('./syntaxhighlighter-82dea71a.js');case 2:_yield$import=_context2.sent;createCopyToClipboardFunction=_yield$import.createCopyToClipboardFunction;createCopyToClipboardFunction();case 5:case"end":return _context2.stop();}}},_callee2);}));},[]);var onCopyCapture=function onCopyCapture(e){e.preventDefault();if(additionalActionItems.filter(function(item){return item.title==='Copied';}).length===0){copyToClipboard(source.props.code).then(function(){setAdditionalActionItems([].concat(_toConsumableArray(additionalActionItems),[{title:'Copied',onClick:function onClick(){}}]));globalWindow.setTimeout(function(){return setAdditionalActionItems(additionalActionItems.filter(function(item){return item.title!=='Copied';}));},1500);});}};return React__default.createElement(PreviewContainer,Object.assign({},{withSource:withSource,withToolbar:withToolbar},props,{className:previewClasses.join(' ')}),withToolbar&&React__default.createElement(PositionedToolbar,{isLoading:isLoading,border:true,zoom:function zoom(z){return setScale(scale*z);},resetZoom:function resetZoom(){return setScale(1);},storyId:getStoryId(children),baseUrl:"./iframe.html"}),React__default.createElement(ZoomContext.Provider,{value:{scale:scale}},React__default.createElement(Relative,{className:"docs-story",onCopyCapture:withSource&&onCopyCapture},React__default.createElement(ChildrenContainer,{isColumn:isColumn||!Array.isArray(children),columns:columns,layout:layout},React__default.createElement(Zoom$1.Element,{scale:scale},Array.isArray(children)?// eslint-disable-next-line react/no-array-index-key
|
|
368
355
|
children.map(function(child,i){return React__default.createElement("div",{key:i},child);}):React__default.createElement("div",null,children))),React__default.createElement(ActionBar,{actionItems:actionItems}))),withSource&&expanded&&source);};var StyledPreview=styled(Preview)(function(){return{'.docs-story':{paddingTop:32,paddingBottom:40}};});var PreviewSkeleton=function PreviewSkeleton(){return React__default.createElement(StyledPreview,{isLoading:true,withToolbar:true},React__default.createElement(StorySkeleton,null));};/**
|
|
369
356
|
* A specialized version of `_.map` for arrays without support for iteratee
|
|
370
357
|
* shorthands.
|
|
@@ -1641,7 +1628,7 @@ marginTop:0,marginBottom:0,'th:first-of-type, td:first-of-type':{paddingLeft:0},
|
|
|
1641
1628
|
* // => [2, 1]
|
|
1642
1629
|
*/function uniq(array){return array&&array.length?baseUniq(array):[];}var uniq_1=uniq;var ITEMS_BEFORE_EXPANSION=8;var Summary=styled.div(function(_ref137){var isExpanded=_ref137.isExpanded;return{display:'flex',flexDirection:isExpanded?'column':'row',flexWrap:'wrap',alignItems:'flex-start',marginBottom:'-4px',minWidth:100};});var Text$2=styled.span(codeCommon,function(_ref138){var theme=_ref138.theme,_ref138$simple=_ref138.simple,simple=_ref138$simple===void 0?false:_ref138$simple;return Object.assign({flex:'0 0 auto',fontFamily:theme.typography.fonts.mono,fontSize:theme.typography.size.s1,wordBreak:'break-word',whiteSpace:'normal',maxWidth:'100%',margin:0,marginRight:'4px',marginBottom:'4px',paddingTop:'2px',paddingBottom:'2px',lineHeight:'13px'},simple&&{background:'transparent',border:'0 none',paddingLeft:0});});var ExpandButton=styled.button(function(_ref139){var theme=_ref139.theme;return{fontFamily:theme.typography.fonts.mono,color:theme.color.secondary,marginBottom:'4px',background:'none',border:'none'};});var Expandable=styled.div(codeCommon,function(_ref140){var theme=_ref140.theme;return{fontFamily:theme.typography.fonts.mono,color:theme.color.secondary,fontSize:theme.typography.size.s1,margin:0,whiteSpace:'nowrap',display:'flex',alignItems:'center'};});var Detail=styled.div(function(_ref141){var theme=_ref141.theme,width=_ref141.width;return{width:width,minWidth:200,maxWidth:800,padding:15,// Don't remove the mono fontFamily here even if it seems useless, this is used by the browser to calculate the length of a "ch" unit.
|
|
1643
1630
|
fontFamily:theme.typography.fonts.mono,fontSize:theme.typography.size.s1,// Most custom stylesheet will reset the box-sizing to "border-box" and will break the tooltip.
|
|
1644
|
-
boxSizing:'content-box','& code':{padding:'0 !important'}};});var ArrowIcon=styled(Icons)({height:10,width:10,minWidth:10,marginLeft:4});var EmptyArg=function EmptyArg(){return React__default.createElement("span",null,"-");};var ArgText=function ArgText(_ref142){var text=_ref142.text,simple=_ref142.simple;return React__default.createElement(Text$2,{simple:simple},text);};var calculateDetailWidth=
|
|
1631
|
+
boxSizing:'content-box','& code':{padding:'0 !important'}};});var ArrowIcon=styled(Icons)({height:10,width:10,minWidth:10,marginLeft:4});var EmptyArg=function EmptyArg(){return React__default.createElement("span",null,"-");};var ArgText=function ArgText(_ref142){var text=_ref142.text,simple=_ref142.simple;return React__default.createElement(Text$2,{simple:simple},text);};var calculateDetailWidth=memoize$2(1000)(function(detail){var lines=detail.split(/\r?\n/);return"".concat(Math.max.apply(Math,_toConsumableArray(lines.map(function(x){return x.length;}))),"ch");});var getSummaryItems=function getSummaryItems(summary){if(!summary)return[summary];var splittedItems=summary.split('|');var summaryItems=splittedItems.map(function(value){return value.trim();});return uniq_1(summaryItems);};var renderSummaryItems=function renderSummaryItems(summaryItems){var isExpanded=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var items=summaryItems;if(!isExpanded){items=summaryItems.slice(0,ITEMS_BEFORE_EXPANSION);}return items.map(function(item){return React__default.createElement(ArgText,{key:item,text:item===''?'""':item});});};var ArgSummary=function ArgSummary(_ref143){var value=_ref143.value,initialExpandedArgs=_ref143.initialExpandedArgs;var summary=value.summary,detail=value.detail;var _useState13=useState(false),_useState14=_slicedToArray(_useState13,2),isOpen=_useState14[0],setIsOpen=_useState14[1];var _useState15=useState(initialExpandedArgs||false),_useState16=_slicedToArray(_useState15,2),isExpanded=_useState16[0],setIsExpanded=_useState16[1];if(summary===undefined||summary===null)return null;// summary is used for the default value
|
|
1645
1632
|
// below check fixes not displaying default values for boolean typescript vars
|
|
1646
1633
|
var summaryAsString=typeof summary.toString==='function'?summary.toString():summary;if(detail==null){var cannotBeSafelySplitted=/[(){}[\]<>]/.test(summaryAsString);if(cannotBeSafelySplitted){return React__default.createElement(ArgText,{text:summaryAsString});}var summaryItems=getSummaryItems(summaryAsString);var itemsCount=summaryItems.length;var hasManyItems=itemsCount>ITEMS_BEFORE_EXPANSION;return hasManyItems?React__default.createElement(Summary,{isExpanded:isExpanded},renderSummaryItems(summaryItems,isExpanded),React__default.createElement(ExpandButton,{onClick:function onClick(){return setIsExpanded(!isExpanded);}},isExpanded?'Show less...':"Show ".concat(itemsCount-ITEMS_BEFORE_EXPANSION," more..."))):React__default.createElement(Summary,null,renderSummaryItems(summaryItems));}return React__default.createElement(WithTooltipPure,{closeOnClick:true,trigger:"click",placement:"bottom",tooltipShown:isOpen,onVisibilityChange:function onVisibilityChange(isVisible){setIsOpen(isVisible);},tooltip:React__default.createElement(Detail,{width:calculateDetailWidth(detail)},React__default.createElement(SyntaxHighlighter,{language:"jsx",format:false},detail))},React__default.createElement(Expandable,{className:"sbdocs-expandable"},React__default.createElement("span",null,summaryAsString),React__default.createElement(ArrowIcon,{icon:isOpen?'arrowup':'arrowdown'})));};var ArgValue=function ArgValue(_ref144){var value=_ref144.value,initialExpandedArgs=_ref144.initialExpandedArgs;return value==null?React__default.createElement(EmptyArg,null):React__default.createElement(ArgSummary,{value:value,initialExpandedArgs:initialExpandedArgs});};/**
|
|
1647
1634
|
* Adds `control` prefix to make ID attribute more specific.
|
|
@@ -1955,7 +1942,7 @@ textareaElementFunction=function textareaElementFunction(){return textareaElemen
|
|
|
1955
1942
|
JsonTree.defaultProps={rootName:'root',isCollapsed:function isCollapsed(keyPath,deep){return deep!==-1;},getStyle:function getStyle(keyName,data,keyPath,deep,dataType){switch(dataType){case'Object':case'Error':return object;case'Array':return array;default:return value;}},readOnly:function readOnly(){return false;},onFullyUpdate:function onFullyUpdate(){},onDeltaUpdate:function onDeltaUpdate(){},beforeRemoveAction:function beforeRemoveAction(){return Promise.resolve();},beforeAddAction:function beforeAddAction(){return Promise.resolve();},beforeUpdateAction:function beforeUpdateAction(){return Promise.resolve();},logger:{error:function error(){}},onSubmitValueParser:function onSubmitValueParser(isEditMode,keyPath,deep,name,rawValue){return parse(rawValue);},inputElement:function inputElement(){return React__default.createElement("input",null);},textareaElement:function textareaElement(){return React__default.createElement("textarea",null);},fallback:null};var globalWindow=window_1.window;var Wrapper$2=styled.div(function(_ref163){var theme=_ref163.theme;return{position:'relative',display:'flex','.rejt-tree':{marginLeft:'1rem',fontSize:'13px'},'.rejt-value-node, .rejt-object-node > .rejt-collapsed, .rejt-array-node > .rejt-collapsed, .rejt-object-node > .rejt-not-collapsed, .rejt-array-node > .rejt-not-collapsed':{'& > svg':{opacity:0,transition:'opacity 0.2s'}},'.rejt-value-node:hover, .rejt-object-node:hover > .rejt-collapsed, .rejt-array-node:hover > .rejt-collapsed, .rejt-object-node:hover > .rejt-not-collapsed, .rejt-array-node:hover > .rejt-not-collapsed':{'& > svg':{opacity:1}},'.rejt-edit-form button':{display:'none'},'.rejt-add-form':{marginLeft:10},'.rejt-add-value-node':{display:'inline-flex',alignItems:'center'},'.rejt-name':{lineHeight:'22px'},'.rejt-not-collapsed-delimiter':{lineHeight:'22px'},'.rejt-plus-menu':{marginLeft:5},'.rejt-object-node > span > *':{position:'relative',zIndex:2},'.rejt-object-node, .rejt-array-node':{position:'relative'},'.rejt-object-node > span:first-of-type::after, .rejt-array-node > span:first-of-type::after, .rejt-collapsed::before, .rejt-not-collapsed::before':{content:'""',position:'absolute',top:0,display:'block',width:'100%',marginLeft:'-1rem',padding:'0 4px 0 1rem',height:22},'.rejt-collapsed::before, .rejt-not-collapsed::before':{zIndex:1,background:'transparent',borderRadius:4,transition:'background 0.2s',pointerEvents:'none',opacity:0.1},'.rejt-object-node:hover, .rejt-array-node:hover':{'& > .rejt-collapsed::before, & > .rejt-not-collapsed::before':{background:theme.color.secondary}},'.rejt-collapsed::after, .rejt-not-collapsed::after':{content:'""',position:'absolute',display:'inline-block',pointerEvents:'none',width:0,height:0},'.rejt-collapsed::after':{left:-8,top:8,borderTop:'3px solid transparent',borderBottom:'3px solid transparent',borderLeft:'3px solid rgba(153,153,153,0.6)'},'.rejt-not-collapsed::after':{left:-10,top:10,borderTop:'3px solid rgba(153,153,153,0.6)',borderLeft:'3px solid transparent',borderRight:'3px solid transparent'},'.rejt-value':{display:'inline-block',border:'1px solid transparent',borderRadius:4,margin:'1px 0',padding:'0 4px',cursor:'text',color:theme.color.defaultText},'.rejt-value-node:hover > .rejt-value':{background:theme.background.app,borderColor:theme.color.border}};});var Button=styled.button(function(_ref164){var theme=_ref164.theme,primary=_ref164.primary;return{border:0,height:20,margin:1,borderRadius:4,background:primary?theme.color.secondary:'transparent',color:primary?theme.color.lightest:theme.color.dark,fontWeight:primary?'bold':'normal',cursor:'pointer',order:primary?'initial':9};});var ActionIcon=styled(Icons)(function(_ref165){var theme=_ref165.theme,icon=_ref165.icon,disabled=_ref165.disabled;return{display:'inline-block',verticalAlign:'middle',width:15,height:15,padding:3,marginLeft:5,cursor:disabled?'not-allowed':'pointer',color:theme.color.mediumdark,'&:hover':disabled?{}:{color:icon==='subtract'?theme.color.negative:theme.color.ancillary},'svg + &':{marginLeft:0}};});var Input=styled.input(function(_ref166){var theme=_ref166.theme,placeholder=_ref166.placeholder;return{outline:0,margin:placeholder?1:'1px 0',padding:'3px 4px',color:theme.color.defaultText,background:theme.background.app,border:"1px solid ".concat(theme.color.border),borderRadius:4,lineHeight:'14px',width:placeholder==='Key'?80:120,'&:focus':{border:"1px solid ".concat(theme.color.secondary)}};});var RawButton=styled(IconButton)(function(_ref167){var theme=_ref167.theme;return{position:'absolute',zIndex:2,top:2,right:2,height:21,padding:'0 3px',background:theme.background.bar,border:"1px solid ".concat(theme.color.border),borderRadius:3,color:theme.color.mediumdark,fontSize:'9px',fontWeight:'bold',span:{marginLeft:3,marginTop:1}};});var RawInput=styled(Form.Textarea)(function(_ref168){var theme=_ref168.theme;return{flex:1,padding:'7px 6px',fontFamily:theme.typography.fonts.mono,fontSize:'12px',lineHeight:'18px','&::placeholder':{fontFamily:theme.typography.fonts.base,fontSize:'13px'},'&:placeholder-shown':{padding:'7px 10px'}};});var ENTER_EVENT={bubbles:true,cancelable:true,key:'Enter',code:'Enter',keyCode:13};var dispatchEnterKey=function dispatchEnterKey(event){event.currentTarget.dispatchEvent(new globalWindow.KeyboardEvent('keydown',ENTER_EVENT));};var selectValue=function selectValue(event){event.currentTarget.select();};var getCustomStyleFunction=function getCustomStyleFunction(theme){return function(){return{name:{color:theme.color.secondary},collapsed:{color:theme.color.dark},ul:{listStyle:'none',margin:'0 0 0 1rem',padding:0},li:{outline:0}};};};var ObjectControl=function ObjectControl(_ref169){var name=_ref169.name,value=_ref169.value,onChange=_ref169.onChange;var theme=useTheme();var data=useMemo(function(){return value&&cloneDeep_1(value);},[value]);var hasData=data!==null&&data!==undefined;var _useState27=useState(!hasData),_useState28=_slicedToArray(_useState27,2),showRaw=_useState28[0],setShowRaw=_useState28[1];var _useState29=useState(null),_useState30=_slicedToArray(_useState29,2),parseError=_useState30[0],setParseError=_useState30[1];var updateRaw=useCallback(function(raw){try{if(raw)onChange(JSON.parse(raw));setParseError(undefined);}catch(e){setParseError(e);}},[onChange]);var _useState31=useState(false),_useState32=_slicedToArray(_useState31,2),forceVisible=_useState32[0],setForceVisible=_useState32[1];var onForceVisible=useCallback(function(){onChange({});setForceVisible(true);},[setForceVisible]);var htmlElRef=useRef(null);useEffect(function(){if(forceVisible&&htmlElRef.current)htmlElRef.current.select();},[forceVisible]);if(!hasData){return React__default.createElement(Form.Button,{id:getControlSetterButtonId(name),onClick:onForceVisible},"Set object");}var rawJSONForm=React__default.createElement(RawInput,{ref:htmlElRef,id:getControlId(name),name:name,defaultValue:value===null?'':JSON.stringify(value,null,2),onBlur:function onBlur(event){return updateRaw(event.target.value);},placeholder:"Edit JSON string...",autoFocus:forceVisible,valid:parseError?'error':null});return React__default.createElement(Wrapper$2,null,['Object','Array'].includes(getObjectType(data))&&React__default.createElement(RawButton,{onClick:function onClick(){return setShowRaw(function(v){return!v;});}},React__default.createElement(Icons,{icon:showRaw?'eyeclose':'eye'}),React__default.createElement("span",null,"RAW")),!showRaw?React__default.createElement(JsonTree,{data:data,rootName:name,onFullyUpdate:onChange,getStyle:getCustomStyleFunction(theme),cancelButtonElement:React__default.createElement(Button,{type:"button"},"Cancel"),editButtonElement:React__default.createElement(Button,{type:"submit"},"Save"),addButtonElement:React__default.createElement(Button,{type:"submit",primary:true},"Save"),plusMenuElement:React__default.createElement(ActionIcon,{icon:"add"}),minusMenuElement:React__default.createElement(ActionIcon,{icon:"subtract"}),inputElement:function inputElement(_,__,___,key){return key?React__default.createElement(Input,{onFocus:selectValue,onBlur:dispatchEnterKey}):React__default.createElement(Input,null);},fallback:rawJSONForm}):rawJSONForm);};var RangeInput=styled.input(function(_ref170){var theme=_ref170.theme,min=_ref170.min,max=_ref170.max,value=_ref170.value;return{// Resytled using http://danielstern.ca/range.css/#/
|
|
1956
1943
|
'&':{width:'100%',backgroundColor:'transparent',appearance:'none'},'&::-webkit-slider-runnable-track':{background:theme.base==='light'?"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," 100%)"):"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," 100%)"),boxShadow:"".concat(theme.appBorderColor," 0 0 0 1px inset"),borderRadius:6,width:'100%',height:6,cursor:'pointer'},'&::-webkit-slider-thumb':{marginTop:'-6px',width:16,height:16,border:"1px solid ".concat(rgba(theme.appBorderColor,0.2)),borderRadius:'50px',boxShadow:"0 1px 3px 0px ".concat(rgba(theme.appBorderColor,0.2)),cursor:'grab',appearance:'none',background:"".concat(theme.input.background),transition:'all 150ms ease-out','&:hover':{background:"".concat(curriedDarken$1(0.05,theme.input.background)),transform:'scale3d(1.1, 1.1, 1.1) translateY(-1px)',transition:'all 50ms ease-out'},'&:active':{background:"".concat(theme.input.background),transform:'scale3d(1, 1, 1) translateY(0px)',cursor:'grabbing'}},'&:focus':{outline:'none','&::-webkit-slider-runnable-track':{borderColor:rgba(theme.color.secondary,0.4)},'&::-webkit-slider-thumb':{borderColor:theme.color.secondary,boxShadow:"0 0px 5px 0px ".concat(theme.color.secondary)}},'&::-moz-range-track':{background:theme.base==='light'?"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," 100%)"):"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," 100%)"),boxShadow:"".concat(theme.appBorderColor," 0 0 0 1px inset"),borderRadius:6,width:'100%',height:6,cursor:'pointer',outline:'none'},'&::-moz-range-thumb':{width:16,height:16,border:"1px solid ".concat(rgba(theme.color.border,0.2)),borderRadius:'50px',boxShadow:"0 1px 3px 0px ".concat(rgba(theme.color.border,0.2)),cursor:'grab',background:"".concat(theme.input.background),transition:'all 150ms ease-out','&:hover':{background:"".concat(curriedDarken$1(0.05,theme.input.background)),transform:'scale3d(1.1, 1.1, 1.1) translateY(-1px)',transition:'all 50ms ease-out'},'&:active':{background:"".concat(theme.input.background),transform:'scale3d(1, 1, 1) translateY(0px)',cursor:'grabbing'}},'&::-ms-track':{background:theme.base==='light'?"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedDarken$1(0.02,theme.input.background)," 100%)"):"linear-gradient(to right, \n ".concat(theme.color.green," 0%, ").concat(theme.color.green," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," ").concat((value-min)/(max-min)*100,"%, \n ").concat(curriedLighten$1(0.02,theme.input.background)," 100%)"),boxShadow:"".concat(theme.appBorderColor," 0 0 0 1px inset"),color:'transparent',width:'100%',height:'6px',cursor:'pointer'},'&::-ms-fill-lower':{borderRadius:6},'&::-ms-fill-upper':{borderRadius:6},'&::-ms-thumb':{width:16,height:16,background:"".concat(theme.input.background),border:"1px solid ".concat(rgba(theme.appBorderColor,0.2)),borderRadius:50,cursor:'grab',marginTop:0},'@supports (-ms-ime-align:auto)':{'input[type=range]':{margin:'0'}}};});var RangeLabel=styled.span({paddingLeft:5,paddingRight:5,fontSize:12,whiteSpace:'nowrap',fontFeatureSettings:'tnum',fontVariantNumeric:'tabular-nums'});var RangeWrapper=styled.div({display:'flex',alignItems:'center',width:'100%'});function getNumberOfDecimalPlaces(number){var match=number.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return!match?0:Math.max(0,// Number of digits right of decimal point.
|
|
1957
1944
|
(match[1]?match[1].length:0)-(// Adjust for scientific notation.
|
|
1958
|
-
match[2]?+match[2]:0));}var RangeControl=function RangeControl(_ref171){var name=_ref171.name,value=_ref171.value,onChange=_ref171.onChange,_ref171$min=_ref171.min,min=_ref171$min===void 0?0:_ref171$min,_ref171$max=_ref171.max,max=_ref171$max===void 0?100:_ref171$max,_ref171$step=_ref171.step,step=_ref171$step===void 0?1:_ref171$step,onBlur=_ref171.onBlur,onFocus=_ref171.onFocus;var handleChange=function handleChange(event){onChange(parse$1(event.target.value));};var hasValue=value!==undefined;var numberOFDecimalsPlaces=useMemo(function(){return getNumberOfDecimalPlaces(step);},[step]);return React__default.createElement(RangeWrapper,null,React__default.createElement(RangeLabel,null,min),React__default.createElement(RangeInput,Object.assign({id:getControlId(name),type:"range",onChange:handleChange},{name:name,value:value,min:min,max:max,step:step,onFocus:onFocus,onBlur:onBlur})),React__default.createElement(RangeLabel,null,"".concat(hasValue?value.toFixed(numberOFDecimalsPlaces):'--')," / ",max));};var Wrapper$1=styled.label({display:'flex'});var TextControl=function TextControl(_ref172){var name=_ref172.name,value=_ref172.value,onChange=_ref172.onChange,onFocus=_ref172.onFocus,onBlur=_ref172.onBlur;var handleChange=function handleChange(event){onChange(event.target.value);};var _useState33=useState(false),_useState34=_slicedToArray(_useState33,2),forceVisible=_useState34[0],setForceVisible=_useState34[1];var onForceVisible=useCallback(function(){onChange('');setForceVisible(true);},[setForceVisible]);if(value===undefined){return React__default.createElement(Form.Button,{id:getControlSetterButtonId(name),onClick:onForceVisible},"Set string");}var isValid=typeof value==='string';return React__default.createElement(Wrapper$1,null,React__default.createElement(Form.Textarea,Object.assign({id:getControlId(name),onChange:handleChange,size:"flex",placeholder:"Edit string...",autoFocus:forceVisible,valid:isValid?null:'error'},{name:name,value:isValid?value:'',onFocus:onFocus,onBlur:onBlur})));};var FileInput=styled(Form.Input)({padding:10});function revokeOldUrls(urls){urls.forEach(function(url){if(url.startsWith('blob:')){URL.revokeObjectURL(url);}});}var FilesControl=function FilesControl(_ref173){var onChange=_ref173.onChange,name=_ref173.name,_ref173$accept=_ref173.accept,accept=_ref173$accept===void 0?'image/*':_ref173$accept,value=_ref173.value;function handleFileChange(e){if(!e.target.files){return;}var fileUrls=Array.from(e.target.files).map(function(file){return URL.createObjectURL(file);});onChange(fileUrls);revokeOldUrls(value);}return React__default.createElement(FileInput,{id:getControlId(name),type:"file",name:name,multiple:true,onChange:handleFileChange,accept:accept,size:"flex"});};var LazyColorControl=lazy(function(){return import('./Color-
|
|
1945
|
+
match[2]?+match[2]:0));}var RangeControl=function RangeControl(_ref171){var name=_ref171.name,value=_ref171.value,onChange=_ref171.onChange,_ref171$min=_ref171.min,min=_ref171$min===void 0?0:_ref171$min,_ref171$max=_ref171.max,max=_ref171$max===void 0?100:_ref171$max,_ref171$step=_ref171.step,step=_ref171$step===void 0?1:_ref171$step,onBlur=_ref171.onBlur,onFocus=_ref171.onFocus;var handleChange=function handleChange(event){onChange(parse$1(event.target.value));};var hasValue=value!==undefined;var numberOFDecimalsPlaces=useMemo(function(){return getNumberOfDecimalPlaces(step);},[step]);return React__default.createElement(RangeWrapper,null,React__default.createElement(RangeLabel,null,min),React__default.createElement(RangeInput,Object.assign({id:getControlId(name),type:"range",onChange:handleChange},{name:name,value:value,min:min,max:max,step:step,onFocus:onFocus,onBlur:onBlur})),React__default.createElement(RangeLabel,null,"".concat(hasValue?value.toFixed(numberOFDecimalsPlaces):'--')," / ",max));};var Wrapper$1=styled.label({display:'flex'});var TextControl=function TextControl(_ref172){var name=_ref172.name,value=_ref172.value,onChange=_ref172.onChange,onFocus=_ref172.onFocus,onBlur=_ref172.onBlur;var handleChange=function handleChange(event){onChange(event.target.value);};var _useState33=useState(false),_useState34=_slicedToArray(_useState33,2),forceVisible=_useState34[0],setForceVisible=_useState34[1];var onForceVisible=useCallback(function(){onChange('');setForceVisible(true);},[setForceVisible]);if(value===undefined){return React__default.createElement(Form.Button,{id:getControlSetterButtonId(name),onClick:onForceVisible},"Set string");}var isValid=typeof value==='string';return React__default.createElement(Wrapper$1,null,React__default.createElement(Form.Textarea,Object.assign({id:getControlId(name),onChange:handleChange,size:"flex",placeholder:"Edit string...",autoFocus:forceVisible,valid:isValid?null:'error'},{name:name,value:isValid?value:'',onFocus:onFocus,onBlur:onBlur})));};var FileInput=styled(Form.Input)({padding:10});function revokeOldUrls(urls){urls.forEach(function(url){if(url.startsWith('blob:')){URL.revokeObjectURL(url);}});}var FilesControl=function FilesControl(_ref173){var onChange=_ref173.onChange,name=_ref173.name,_ref173$accept=_ref173.accept,accept=_ref173$accept===void 0?'image/*':_ref173$accept,value=_ref173.value;function handleFileChange(e){if(!e.target.files){return;}var fileUrls=Array.from(e.target.files).map(function(file){return URL.createObjectURL(file);});onChange(fileUrls);revokeOldUrls(value);}return React__default.createElement(FileInput,{id:getControlId(name),type:"file",name:name,multiple:true,onChange:handleFileChange,accept:accept,size:"flex"});};var LazyColorControl=lazy(function(){return import('./Color-3c22bb81.js');});var ColorControl=function ColorControl(props){return React__default.createElement(Suspense,{fallback:React__default.createElement("div",null)},React__default.createElement(LazyColorControl,Object.assign({},props)));};var Controls={array:ObjectControl,object:ObjectControl,boolean:BooleanControl,color:ColorControl,date:DateControl,number:NumberControl,check:OptionsControl,'inline-check':OptionsControl,radio:OptionsControl,'inline-radio':OptionsControl,select:OptionsControl,'multi-select':OptionsControl,range:RangeControl,text:TextControl,file:FilesControl};var NoControl=function NoControl(){return React__default.createElement(React__default.Fragment,null,"-");};var ArgControl=function ArgControl(_ref174){var row=_ref174.row,arg=_ref174.arg,updateArgs=_ref174.updateArgs;var key=row.key,control=row.control;var _useState35=useState(false),_useState36=_slicedToArray(_useState35,2),isFocused=_useState36[0],setFocused=_useState36[1];// box because arg can be a fn (e.g. actions) and useState calls fn's
|
|
1959
1946
|
var _useState37=useState({value:arg}),_useState38=_slicedToArray(_useState37,2),boxedValue=_useState38[0],setBoxedValue=_useState38[1];useEffect(function(){if(!isFocused)setBoxedValue({value:arg});},[isFocused,arg]);var onChange=useCallback(function(argVal){setBoxedValue({value:argVal});updateArgs(_defineProperty2({},key,argVal));return argVal;},[updateArgs,key]);var onBlur=useCallback(function(){return setFocused(false);},[]);var onFocus=useCallback(function(){return setFocused(true);},[]);if(!control||control.disable)return React__default.createElement(NoControl,null);// row.name is a display name and not a suitable DOM input id or name - i might contain whitespace etc.
|
|
1960
1947
|
// row.key is a hash key and therefore a much safer choice
|
|
1961
1948
|
var props={name:key,argType:row,value:boxedValue.value,onChange:onChange,onBlur:onBlur,onFocus:onFocus};var Control=Controls[control.type]||NoControl;return React__default.createElement(Control,Object.assign({},props,control,{controlType:control.type}));};var Name=styled.span({fontWeight:'bold'});var Required=styled.span(function(_ref175){var theme=_ref175.theme;return{color:theme.color.negative,fontFamily:theme.typography.fonts.mono,cursor:'help'};});var Description=styled.div(function(_ref176){var theme=_ref176.theme;return{'&&':{p:{margin:'0 0 10px 0'},a:{color:theme.color.secondary}},code:Object.assign(Object.assign({},codeCommon({theme:theme})),{fontSize:12,fontFamily:theme.typography.fonts.mono}),'& code':{margin:0,display:'inline-block'},'& pre > code':{whiteSpace:'pre-wrap'}};});var Type=styled.div(function(_ref177){var theme=_ref177.theme,hasDescription=_ref177.hasDescription;return{color:theme.base==='light'?curriedTransparentize$1(0.1,theme.color.defaultText):curriedTransparentize$1(0.2,theme.color.defaultText),marginTop:hasDescription?4:0};});var TypeWithJsDoc=styled.div(function(_ref178){var theme=_ref178.theme,hasDescription=_ref178.hasDescription;return{color:theme.base==='light'?curriedTransparentize$1(0.1,theme.color.defaultText):curriedTransparentize$1(0.2,theme.color.defaultText),marginTop:hasDescription?12:0,marginBottom:12};});var StyledTd$1=styled.td(function(_ref179){var theme=_ref179.theme,expandable=_ref179.expandable;return{paddingLeft:expandable?'40px !important':'20px !important'};});var ArgRow=function ArgRow(props){var _a;var row=props.row,updateArgs=props.updateArgs,compact=props.compact,expandable=props.expandable,initialExpandedArgs=props.initialExpandedArgs;var name=row.name,description=row.description;var table=row.table||{};var type=table.type||row.type;var defaultValue=table.defaultValue||row.defaultValue;var required=(_a=row.type)===null||_a===void 0?void 0:_a.required;var hasDescription=description!=null&&description!=='';return React__default.createElement("tr",null,React__default.createElement(StyledTd$1,{expandable:expandable},React__default.createElement(Name,null,name),required?React__default.createElement(Required,{title:"Required"},"*"):null),compact?null:React__default.createElement("td",null,hasDescription&&React__default.createElement(Description,null,React__default.createElement(Markdown,null,description)),table.jsDocTags!=null?React__default.createElement(React__default.Fragment,null,React__default.createElement(TypeWithJsDoc,{hasDescription:hasDescription},React__default.createElement(ArgValue,{value:type,initialExpandedArgs:initialExpandedArgs})),React__default.createElement(ArgJsDoc,{tags:table.jsDocTags})):React__default.createElement(Type,{hasDescription:hasDescription},React__default.createElement(ArgValue,{value:type,initialExpandedArgs:initialExpandedArgs}))),compact?null:React__default.createElement("td",null,React__default.createElement(ArgValue,{value:defaultValue,initialExpandedArgs:initialExpandedArgs})),updateArgs?React__default.createElement("td",null,React__default.createElement(ArgControl,Object.assign({},props))):null);};var ExpanderIcon=styled(Icons)(function(_ref180){var theme=_ref180.theme;return{marginRight:8,marginLeft:-10,marginTop:-2,height:12,width:12,color:theme.base==='light'?curriedTransparentize$1(0.25,theme.color.defaultText):curriedTransparentize$1(0.3,theme.color.defaultText),border:'none',display:'inline-block'};});var FlexWrapper=styled.span(function(_ref181){var theme=_ref181.theme;return{display:'flex',lineHeight:'20px',alignItems:'center'};});var Section=styled.td(function(_ref182){var theme=_ref182.theme;return{position:'relative',letterSpacing:'0.35em',textTransform:'uppercase',fontWeight:theme.typography.weight.black,fontSize:theme.typography.size.s1-1,color:theme.base==='light'?curriedTransparentize$1(0.4,theme.color.defaultText):curriedTransparentize$1(0.6,theme.color.defaultText),background:"".concat(theme.background.app," !important"),'& ~ td':{background:"".concat(theme.background.app," !important")}};});var Subsection=styled.td(function(_ref183){var theme=_ref183.theme;return{position:'relative',fontWeight:theme.typography.weight.bold,fontSize:theme.typography.size.s2-1,background:theme.background.content};});var StyledTd=styled.td(function(_ref184){var theme=_ref184.theme;return{position:'relative'};});var StyledTr=styled.tr(function(_ref185){var theme=_ref185.theme;return{'&:hover > td':{backgroundColor:"".concat(theme.background.hoverable," !important"),boxShadow:"".concat(theme.color.mediumlight," 0 - 1px 0 0 inset"),cursor:'row-resize'}};});var ClickIntercept=styled.button(function(){return{// reset button style
|
|
@@ -2000,4 +1987,4 @@ var sortFn=sortFns[sort];var sortSubsection=function sortSubsection(record){if(!
|
|
|
2000
1987
|
* Show a grid of icons, as specified by `IconItem`.
|
|
2001
1988
|
*/var IconGallery=function IconGallery(_a){var children=_a.children,props=__rest(_a,["children"]);return React__default.createElement(ResetWrapper,null,React__default.createElement(List,Object.assign({},props,{className:"docblock-icongallery"}),children));};// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
2002
1989
|
// eslint-disable-next-line prefer-destructuring
|
|
2003
|
-
var components=components$1;var resetComponents={};Object.keys(components$1).forEach(function(key){resetComponents[key]=forwardRef(function(props,ref){return createElement(key,Object.assign(Object.assign({},props),{ref:ref}));});});export{
|
|
1990
|
+
var components=components$1;var resetComponents={};Object.keys(components$1).forEach(function(key){resetComponents[key]=forwardRef(function(props,ref){return createElement(key,Object.assign(Object.assign({},props),{ref:ref}));});});export{Table$1 as $,ActionBar as A,components as B,resetComponents as C,A$2 as D,Blockquote as E,Form as F,Code as G,Div as H,Icons as I,DL as J,H1 as K,H2 as L,H3 as M,H4 as N,H5 as O,H6 as P,HR as Q,Img as R,ScrollArea as S,TooltipNote as T,LI as U,OL as V,WithTooltip as W,P$1 as X,Pre as Y,Span as Z,__awaiter as _,__rest as a,format as a$,TT as a0,UL as a1,Badge as a2,Link as a3,DocumentWrapper as a4,SyntaxHighlighter as a5,Spaced as a6,Placeholder as a7,Zoom$1 as a8,Button$2 as a9,PreviewSkeleton as aA,TableWrapper as aB,ArgsTableError as aC,argsTableLoadingData as aD,ArgsTable as aE,TabbedArgsTable as aF,NoControlsWarning as aG,SourceError as aH,Source as aI,StyledSyntaxHighlighter as aJ,StoryError as aK,Story as aL,StorySkeleton as aM,IFrame as aN,Typeset as aO,ColorItem as aP,ColorPalette as aQ,IconItem as aR,IconGallery as aS,ColorControl as aT,BooleanControl as aU,parseDate as aV,parseTime as aW,formatDate as aX,formatTime as aY,DateControl as aZ,parse$1 as a_,WithTooltipPure as aa,TooltipMessage as ab,TooltipLinkList as ac,Tabs as ad,TabsState as ae,TabBar as af,TabWrapper as ag,IconButton as ah,TabButton as ai,Separator as aj,interleaveSeparators as ak,Bar$1 as al,FlexBar as am,AddonPanel as an,Symbols as ao,StorybookLogo as ap,StorybookIcon as aq,Loader as ar,getStoryHref as as,Description$1 as at,Title as au,Subtitle as av,DocsContent as aw,DocsWrapper as ax,DocsPageWrapper as ay,Preview as az,basePlacements as b,NumberControl as b0,OptionsControl as b1,ObjectControl as b2,RangeControl as b3,TextControl as b4,FilesControl as b5,nameSpaceClassNames as b6,commonjsGlobal as c,dedent as d,bottom as e,end as f,getDefaultExportFromCjs as g,clippingParents as h,reference as i,variationPlacements as j,placements as k,left as l,auto as m,modifierPhases as n,_extends as o,popper as p,_objectWithoutPropertiesLoose as q,right as r,start as s,top as t,_root as u,viewport as v,window_1 as w,isObject_1 as x,isSymbol_1 as y,getControlId as z};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export {
|
|
2
|
+
export { D as A, A as ActionBar, an as AddonPanel, aE as ArgsTable, aC as ArgsTableError, a2 as Badge, al as Bar, E as Blockquote, aU as BooleanControl, a9 as Button, G as Code, aT as ColorControl, aP as ColorItem, aQ as ColorPalette, J as DL, aZ as DateControl, at as Description, H as Div, aw as DocsContent, ay as DocsPageWrapper, ax as DocsWrapper, a4 as DocumentWrapper, b5 as FilesControl, am as FlexBar, F as Form, K as H1, L as H2, M as H3, N as H4, O as H5, P as H6, Q as HR, aN as IFrame, ah as IconButton, aS as IconGallery, aR as IconItem, I as Icons, R as Img, U as LI, a3 as Link, ar as Loader, aG as NoControlsWarning, b0 as NumberControl, V as OL, b2 as ObjectControl, b1 as OptionsControl, X as P, a7 as Placeholder, Y as Pre, az as Preview, aA as PreviewSkeleton, b3 as RangeControl, S as ScrollArea, aj as Separator, aI as Source, aH as SourceError, a6 as Spaced, Z as Span, aL as Story, aK as StoryError, aM as StorySkeleton, aq as StorybookIcon, ap as StorybookLogo, aJ as StyledSyntaxHighlighter, av as Subtitle, ao as Symbols, a5 as SyntaxHighlighter, a0 as TT, af as TabBar, ai as TabButton, ag as TabWrapper, aF as TabbedArgsTable, $ as Table, aB as TableWrapper, ad as Tabs, ae as TabsState, b4 as TextControl, au as Title, ac as TooltipLinkList, ab as TooltipMessage, T as TooltipNote, aO as Typeset, a1 as UL, W as WithTooltip, aa as WithTooltipPure, a8 as Zoom, aD as argsTableLoadingData, B as components, a$ as format, aX as formatDate, aY as formatTime, as as getStoryHref, ak as interleaveSeparators, b6 as nameSpaceClassNames, a_ as parse, aV as parseDate, aW as parseTime, C as resetComponents } from './index-b45716e8.js';
|
|
3
3
|
import '@storybook/theming';
|
|
4
|
+
import 'memoizerific';
|
|
4
5
|
import '@storybook/csf';
|
|
5
6
|
import 'qs';
|
|
6
7
|
import '@storybook/client-logger';
|
|
@@ -29,10 +29,11 @@ import "core-js/modules/es.array.slice.js";
|
|
|
29
29
|
import "core-js/modules/es.function.name.js";
|
|
30
30
|
import "core-js/modules/es.array.from.js";
|
|
31
31
|
import "core-js/modules/es.regexp.exec.js";
|
|
32
|
-
import {
|
|
32
|
+
import { _ as __awaiter, S as ScrollArea, a as __rest, A as ActionBar, w as window_1 } from './index-b45716e8.js';
|
|
33
33
|
import React__default, { useState, useCallback } from 'react';
|
|
34
34
|
import { logger } from '@storybook/client-logger';
|
|
35
35
|
import { styled } from '@storybook/theming';
|
|
36
|
+
import memoize from 'memoizerific';
|
|
36
37
|
import jsx from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
|
|
37
38
|
import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
|
|
38
39
|
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
|
|
@@ -61,7 +62,7 @@ ReactSyntaxHighlighter.registerLanguage('html', html);
|
|
|
61
62
|
ReactSyntaxHighlighter.registerLanguage('tsx', tsx);
|
|
62
63
|
ReactSyntaxHighlighter.registerLanguage('typescript', typescript);
|
|
63
64
|
ReactSyntaxHighlighter.registerLanguage('graphql', graphql);
|
|
64
|
-
var themedSyntax =
|
|
65
|
+
var themedSyntax = memoize(2)(function (theme) {
|
|
65
66
|
return Object.entries(theme.code || {}).reduce(function (acc, _ref) {
|
|
66
67
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
67
68
|
key = _ref2[0],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as _root, x as isObject_1, y as isSymbol_1, W as WithTooltip, T as TooltipNote, F as Form, I as Icons, z as getControlId, a as __rest } from './index-9ef3b84b.js';
|
|
2
2
|
import React__default, { useRef, useMemo, useEffect, useState, useCallback, useLayoutEffect } from 'react';
|
|
3
3
|
import { styled } from '@storybook/theming';
|
|
4
|
+
import 'memoizerific';
|
|
4
5
|
import '@storybook/csf';
|
|
5
6
|
import 'qs';
|
|
6
7
|
import '@storybook/client-logger';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { c as commonjsGlobal, a as __rest } from './index-
|
|
1
|
+
import { c as commonjsGlobal, a as __rest } from './index-9ef3b84b.js';
|
|
2
2
|
import React__default, { useRef, useEffect } from 'react';
|
|
3
3
|
import '@storybook/theming';
|
|
4
|
+
import 'memoizerific';
|
|
4
5
|
import '@storybook/csf';
|
|
5
6
|
import 'qs';
|
|
6
7
|
import '@storybook/client-logger';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { b as basePlacements, t as top, l as left, e as bottom, r as right, f as end, v as viewport, s as start, p as popper, h as clippingParents, i as reference, j as variationPlacements, k as placements,
|
|
1
|
+
import { b as basePlacements, t as top, l as left, e as bottom, r as right, f as end, v as viewport, s as start, p as popper, h as clippingParents, i as reference, j as variationPlacements, k as placements, m as auto, n as modifierPhases, o as _extends, q as _objectWithoutPropertiesLoose, a as __rest, w as window_1 } from './index-9ef3b84b.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { Component, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { styled, lighten, darken } from '@storybook/theming';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
|
+
import memoize from 'memoizerific';
|
|
6
7
|
import '@storybook/csf';
|
|
7
8
|
import 'qs';
|
|
8
9
|
import '@storybook/client-logger';
|
|
@@ -2884,7 +2885,7 @@ TooltipTrigger.defaultProps = {
|
|
|
2884
2885
|
modifiers: []
|
|
2885
2886
|
};
|
|
2886
2887
|
const TooltipTrigger$1 = TooltipTrigger;
|
|
2887
|
-
const match =
|
|
2888
|
+
const match = memoize(1000)((requests, actual, value, fallback = 0) => actual.split('-')[0] === requests ? value : fallback);
|
|
2888
2889
|
const ArrowSpacing = 8;
|
|
2889
2890
|
const Arrow = styled.div({
|
|
2890
2891
|
position: 'absolute',
|