@propellerads/header 4.5.0 → 5.0.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ #### `5.0.0`
2
+ * Header item dropdown is moved from button
3
+
1
4
  #### `4.5.0`
2
5
  * HeaderTime EST without brackets
3
6
 
package/dist/index.esm.js CHANGED
@@ -218,7 +218,6 @@ var HeaderItem = function HeaderItem(_ref) {
218
218
  id: id,
219
219
  ref: ref
220
220
  }, /*#__PURE__*/React.createElement(StyledHeaderItemButton, {
221
- type: "button",
222
221
  onClick: function onClick() {
223
222
  if (_onClick && typeof _onClick === 'function') {
224
223
  _onClick();
@@ -228,12 +227,12 @@ var HeaderItem = function HeaderItem(_ref) {
228
227
 
229
228
  setDropdown(!isShowDropdown);
230
229
  }
231
- }, icon && icon, titleComponent, component && component, children && isShowDropdown && /*#__PURE__*/React.createElement(StyledHeaderItemDropdown, {
230
+ }, icon && icon, titleComponent, component && component), children && isShowDropdown && /*#__PURE__*/React.createElement(StyledHeaderItemDropdown, {
232
231
  isRightDropdown: isRightDropdown,
233
232
  onClick: function onClick() {
234
233
  return setDropdown(false);
235
234
  }
236
- }, children)));
235
+ }, children));
237
236
  };
238
237
 
239
238
  HeaderItem.propTypes = {
@@ -1 +1 @@
1
- import n,{useRef as e,useState as r,useEffect as t}from"react";import o from"prop-types";import i,{css as a,ThemeContext as u}from"styled-components";import{fontNormal as l,spacing as c,smallDevices as d,fontSmall as p,borderRadius as m,gray70 as s,white as f,gray50 as h,gray80 as g,black as v,gray95 as b,actionColor as y}from"@propellerads/stylevariables";import x from"@propellerads/currency";import C from"dayjs";import w from"dayjs/plugin/utc";import{showTooltip as k,TOOLTIP_POSITION as E,hideTooltip as H}from"@propellerads/smart-tooltip";function I(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function O(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,t)}return r}function j(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function B(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(n)))return;var r=[],t=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(t=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);t=!0);}catch(n){o=!0,i=n}finally{try{t||null==u.return||u.return()}finally{if(o)throw i}}return r}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return S(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(n,e)}(n,e)||function(){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 S(n,e){(null==e||e>n.length)&&(e=n.length);for(var r=0,t=new Array(e);r<e;r++)t[r]=n[r];return t}function P(){var n=j(["\n z-index: 99;\n padding: ","px;\n position: fixed;\n left: 0 !important;\n top: 56px;\n right: 0 !important;\n \n ",";\n\n @media (min-width: ","px) {\n width: initial;\n position: absolute;\n top: 100%;\n left: initial !important;\n }\n"]);return P=function(){return n},n}function D(){var n=j(["\n margin-left: ","px;\n"]);return D=function(){return n},n}function R(){var n=j(["\n background: transparent;\n border: 0;\n margin: 0;\n outline: none;\n font-size: ","px;\n display: flex;\n align-items: center;\n padding: 0 ","px;\n height: 100%;\n cursor: pointer;\n color: ",";\n \n &:hover {\n color: ",";\n\n & > svg{\n fill: ",";\n }\n }\n"]);return R=function(){return n},n}function T(){var n=j(["\n position: relative;\n display: flex;\n height: 100%;\n align-items: center;\n"]);return T=function(){return n},n}var q=i.div(T()),z=i.button(R(),l,4*c,(function(n){return n.theme.header.menuItemColor}),(function(n){return n.theme.header.menuItemColorHover}),(function(n){return n.theme.header.menuItemColorHover})),A=i.div(D(),c),L=i.div(P(),c,(function(n){return n.isRightDropdown&&"\n left: ".concat(n.isRightDropdown?"initial":0,";\n right: ").concat(n.isRightDropdown?0:"initial",";\n ")}),d);var M=function(o){var i=o.id,a=o.children,u=o.isRightDropdown,l=o.icon,c=o.title,d=o.onClick,p=o.component,m=e(),s=B(r(!1),2),f=s[0],h=s[1],g=c&&n.createElement(A,null,c);return function(n,e){t((function(){var r=function(r){n.current&&!n.current.contains(r.target)&&e(r)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),function(){document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}}),[n,e])}(m,(function(){return h(!1)})),n.createElement(q,{id:i,ref:m},n.createElement(z,{type:"button",onClick:function(){d&&"function"==typeof d?d():h(!f)}},l&&l,g,p&&p,a&&f&&n.createElement(L,{isRightDropdown:u,onClick:function(){return h(!1)}},a)))};function U(){var n=j(["\n position: absolute;\n left: 0;\n bottom: 0;\n right: 0;\n height: ",";\n background-color: ",";\n"]);return U=function(){return n},n}function $(){var n=j(["\n position: relative;\n flex: 0 0 7px;\n border: solid transparent;\n border-width: 0 1px;\n opacity: 0.3;\n\n &:hover {\n opacity: 1;\n "," {\n opacity: 1;\n }\n }\n"]);return $=function(){return n},n}function F(){var n=j(["\n opacity: 0;\n position: absolute;\n top: calc(-100% - 2px);\n left: 0;\n display: block;\n padding: 0 3px;\n font-size: ","px;\n line-height: 16px;\n border-radius: ","px;\n white-space: nowrap;\n pointer-events: none;\n color: ",";\n background-color: ",";\n"]);return F=function(){return n},n}function G(){var n=j(["\n margin-right: 8px;\n position: relative;\n display: flex;\n align-items: stretch;\n width: 49px;\n flex: 0 0 49px;\n height: 16px;\n cursor: default;\n\n @media (max-width: ","px) {\n display: none;\n }\n"]);return G=function(){return n},n}function J(){var n=j(["\n margin: 0 ","px;\n line-height: 1.14;\n letter-spacing: 0.3px;\n font-size: ","px;\n display: flex;\n font-weight: bold;\n color: ",";\n"]);return J=function(){return n},n}function K(){var n=j(["\n display: inline-flex;\n align-items: center;\n padding: ","px 0;\n z-index: 1;\n color: ",";\n background-color: ",";\n"]);return K=function(){return n},n}M.propTypes={id:o.string,children:o.node,onClick:o.func,component:o.element,icon:o.node,title:o.string,isRightDropdown:o.bool},M.defaultProps={id:void 0,children:void 0,onClick:void 0,component:void 0,title:void 0,icon:void 0,isRightDropdown:!1};var N=i.div(K(),2*c,(function(n){return n.theme.balance.textColor}),(function(n){return n.theme.header.backgroundColor})),Q=i.div(J(),2*c,l,(function(n){return n.theme.balance.textColor})),V=i.div(G(),d),W=i.span(F(),p,m,(function(n){return n.theme.balance.chartColor}),(function(n){return n.theme.balance.chartBackgroundColor})),X=i.div($(),W),Y=i.div(U(),(function(n){return n.percentage>1?"".concat(n.percentage,"%"):"1px"}),(function(n){return n.theme.balance.dailyEarnedColor})),Z=function(e){var r=e.day,t=r.date,o=r.value,i=r.percentage;return n.createElement(X,null,n.createElement(Y,{percentage:i}),n.createElement(W,null,t," ","-"," ",n.createElement(x,{value:o})))};Z.propTypes={day:o.shape({date:o.node,value:o.node,percentage:o.node}).isRequired};var _=function(e){var r=e.balance,t=e.dailyEarned,o=Boolean(t.length);return n.createElement(N,null,n.createElement(Q,null,n.createElement(x,{value:r,decimalPosition:2})),o&&n.createElement(V,null,t.map((function(e,r){var t=r;return n.createElement(Z,{key:t,day:e})}))))};function nn(){var n=j(["\n display: flex;\n padding: 0 ","px;\n cursor: default;\n color: ",";\n"]);return nn=function(){return n},n}_.propTypes={balance:o.number.isRequired,dailyEarned:o.arrayOf(o.shape({date:o.string.isRequired,value:o.number.isRequired,percentage:o.number.isRequired}))},_.defaultProps={dailyEarned:[]};var en=i.div(nn(),4*c,(function(n){return n.theme.header.menuItemColor}));function rn(){return C.utc().subtract(5,"hour")}C.extend(w);var tn=function(o){var i=o.tooltipContent,a=B(r(rn()),2),u=a[0],l=a[1],c=e();return c.current=function(){l(rn())},t((function(){var n=setInterval((function(){c.current()}),1e3);return function(){return clearInterval(n)}}),[]),n.createElement(en,{onMouseEnter:function(n){k(n.target,i(u),E.BOTTOM)},onMouseLeave:H},"".concat(u.format("HH:mm")," EST"))};function on(){var n=j(["\n width: 1px;\n height: 20px;\n background-color: ",";\n"]);return on=function(){return n},n}tn.propTypes={tooltipContent:o.func},tn.defaultProps={tooltipContent:function(n){return"System time: ".concat(n.format("HH:mm DD.MM")," (EST)")}};var an=i.div(on(),(function(n){return n.theme.header.dividerColor}));function un(){var n=j(["\n border-radius: ","px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);\n padding: ","px 0;\n width: 100%;\n background-color: ",";\n \n @media (min-width: ","px) {\n width: auto;\n min-width: 150px;\n }\n"]);return un=function(){return n},n}var ln=i.div(un(),m,2*c,(function(n){return n.theme.header.menuItemBackgroundColor}),d),cn=function(e){var r=e.id,t=e.children;return n.createElement(ln,{id:r},t)};function dn(){var n=j(["\n height: 48px;\n padding: 0 16px;\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-align: left;\n background-color: ",";\n color: ",";\n \n &:hover {\n background-color: ",";\n color: ",";\n }\n\n & > * {\n border: 0;\n margin: 0;\n color: inherit !important;\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n display: flex;\n align-items: center;\n padding: 0 ","px;\n outline: none;\n font-size: inherit;\n background: transparent;\n transition: color 200ms ease-out;\n text-decoration: none;\n }\n"]);return dn=function(){return n},n}cn.propTypes={children:o.node.isRequired,id:o.string},cn.defaultProps={id:void 0};var pn=i.div(dn(),(function(n){return n.theme.header.menuItemBackgroundColor}),(function(n){return n.theme.header.menuItemColor}),(function(n){return n.theme.header.menuItemBackgroundColorHover}),(function(n){return n.theme.header.menuItemColorHover}),4*c),mn=function(e){var r=e.item;return n.createElement(pn,null,r)};mn.propTypes={item:o.shape({})},mn.defaultProps={item:{}};var sn=function(e){return e.items.map((function(e,r){return n.createElement(mn,{key:r,idx:r,item:e})}))};function fn(){var n=j(["\n display: flex;\n align-items: center;\n height: 100%;\n"]);return fn=function(){return n},n}function hn(){var n=j(["\n display: flex;\n align-items: center;\n"]);return hn=function(){return n},n}function gn(){var n=j(["\n ",",\n "]);return gn=function(){return n},n}function vn(){var n=j(["\n display: flex;\n height: 56px;\n align-items: center;\n justify-content: space-between;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 2001;\n background-color: ",";\n box-shadow: ",";\n\n ","\n"]);return vn=function(){return n},n}sn.propTypes={items:o.arrayOf(o.shape({}))},sn.defaultProps={items:[]};var bn=function(n){return function(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach((function(e){I(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}({},n)},yn=i.div(vn(),(function(n){return n.theme.header.backgroundColor}),(function(n){return n.theme.header.boxShadow}),(function(n){return Boolean(Object.values(n.customHeaderStyle).length)&&a(gn(),bn(n.customHeaderStyle))})),xn=i.div(hn()),Cn=i.div(fn()),wn={dark:{name:"dark",header:{backgroundColor:"hsl(228, 16.9%, 17.5%)",color:s,colorHover:f,boxShadow:"0 2px 8px 0 hsla(0, 0%, 0%, 0.1)",dividerColor:h,menuItemColor:s,menuItemColorHover:f,menuItemBackgroundColor:"hsl(228, 16.9%, 17.5%)",menuItemBackgroundColorHover:"hsla(0, 0%, 0%, 0.3)"},balance:{borderColor:g,textColor:f,dailyEarnedColor:f,chartColor:v,chartBackgroundColor:f}},light:{name:"light",header:{backgroundColor:f,color:s,colorHover:v,boxShadow:"0 2px 8px 0 hsla(0, 0%, 0%, 0.1)",dividerColor:b,menuItemColor:s,menuItemColorHover:v,menuItemBackgroundColor:f,menuItemBackgroundColorHover:b},balance:{borderColor:g,textColor:y,dailyEarnedColor:y,chartColor:f,chartBackgroundColor:v}},transparent:{name:"transparent",header:{backgroundColor:"none",color:s,colorHover:v,dividerColor:h,menuItemColor:s,menuItemColorHover:f,menuItemBackgroundColor:"hsl(228, 16.9%, 17.5%)",menuItemBackgroundColorHover:"hsla(0, 0%, 0%, 0.3)"},balance:{borderColor:g,textColor:y,dailyEarnedColor:y,chartColor:f,chartBackgroundColor:v}}},kn=o.shape({name:o.string,header:o.shape({backgroundColor:o.string,color:o.string,colorHover:o.string,boxShadow:o.string,dividerColor:o.string,menuItemColor:o.string,menuItemColorHover:o.string,menuItemBackgroundColor:o.string,menuItemBackgroundColorHover:o.string}),balance:o.shape({borderColor:o.string,textColor:o.string,dailyEarnedColor:o.string,chartColor:o.string,chartBackgroundColor:o.string})}),En=function(e){var r=e.theme,t=e.children;return n.createElement(u.Provider,{value:r},t)};En.propTypes={children:o.node.isRequired,theme:kn},En.defaultProps={theme:wn.light};var Hn=wn,In=function(e){var r=e.logo,t=e.customHeaderStyle,o=e.sidebarButton,i=e.children,a=e.theme,u=e.id;return n.createElement(En,{theme:a},n.createElement(yn,{id:u,customHeaderStyle:t},n.createElement(xn,null,o,r),n.createElement(Cn,null,i)))};In.propTypes={logo:o.element.isRequired,customHeaderStyle:o.object,sidebarButton:o.element,children:o.node.isRequired,theme:kn,id:o.string},In.defaultProps={customHeaderStyle:{},sidebarButton:null,theme:Hn.light,id:"header-container"},In.HeaderItem=M,In.HeaderBalance=_,In.HeaderTime=tn,In.HeaderDivider=function(){return n.createElement(an,null)},In.HeaderDropdown=cn,In.HeaderDropdownList=sn;export default In;export{Hn as themes};
1
+ import n,{useRef as e,useState as r,useEffect as t}from"react";import o from"prop-types";import i,{css as a,ThemeContext as u}from"styled-components";import{fontNormal as l,spacing as c,smallDevices as d,fontSmall as p,borderRadius as m,gray70 as s,white as f,gray50 as h,gray80 as g,black as v,gray95 as b,actionColor as y}from"@propellerads/stylevariables";import x from"@propellerads/currency";import C from"dayjs";import w from"dayjs/plugin/utc";import{showTooltip as k,TOOLTIP_POSITION as E,hideTooltip as H}from"@propellerads/smart-tooltip";function I(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function O(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,t)}return r}function j(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function B(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(n)))return;var r=[],t=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(t=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);t=!0);}catch(n){o=!0,i=n}finally{try{t||null==u.return||u.return()}finally{if(o)throw i}}return r}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return S(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(n,e)}(n,e)||function(){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 S(n,e){(null==e||e>n.length)&&(e=n.length);for(var r=0,t=new Array(e);r<e;r++)t[r]=n[r];return t}function P(){var n=j(["\n z-index: 99;\n padding: ","px;\n position: fixed;\n left: 0 !important;\n top: 56px;\n right: 0 !important;\n \n ",";\n\n @media (min-width: ","px) {\n width: initial;\n position: absolute;\n top: 100%;\n left: initial !important;\n }\n"]);return P=function(){return n},n}function D(){var n=j(["\n margin-left: ","px;\n"]);return D=function(){return n},n}function R(){var n=j(["\n background: transparent;\n border: 0;\n margin: 0;\n outline: none;\n font-size: ","px;\n display: flex;\n align-items: center;\n padding: 0 ","px;\n height: 100%;\n cursor: pointer;\n color: ",";\n \n &:hover {\n color: ",";\n\n & > svg{\n fill: ",";\n }\n }\n"]);return R=function(){return n},n}function T(){var n=j(["\n position: relative;\n display: flex;\n height: 100%;\n align-items: center;\n"]);return T=function(){return n},n}var q=i.div(T()),z=i.button(R(),l,4*c,(function(n){return n.theme.header.menuItemColor}),(function(n){return n.theme.header.menuItemColorHover}),(function(n){return n.theme.header.menuItemColorHover})),A=i.div(D(),c),L=i.div(P(),c,(function(n){return n.isRightDropdown&&"\n left: ".concat(n.isRightDropdown?"initial":0,";\n right: ").concat(n.isRightDropdown?0:"initial",";\n ")}),d);var M=function(o){var i=o.id,a=o.children,u=o.isRightDropdown,l=o.icon,c=o.title,d=o.onClick,p=o.component,m=e(),s=B(r(!1),2),f=s[0],h=s[1],g=c&&n.createElement(A,null,c);return function(n,e){t((function(){var r=function(r){n.current&&!n.current.contains(r.target)&&e(r)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),function(){document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}}),[n,e])}(m,(function(){return h(!1)})),n.createElement(q,{id:i,ref:m},n.createElement(z,{onClick:function(){d&&"function"==typeof d?d():h(!f)}},l&&l,g,p&&p),a&&f&&n.createElement(L,{isRightDropdown:u,onClick:function(){return h(!1)}},a))};function U(){var n=j(["\n position: absolute;\n left: 0;\n bottom: 0;\n right: 0;\n height: ",";\n background-color: ",";\n"]);return U=function(){return n},n}function $(){var n=j(["\n position: relative;\n flex: 0 0 7px;\n border: solid transparent;\n border-width: 0 1px;\n opacity: 0.3;\n\n &:hover {\n opacity: 1;\n "," {\n opacity: 1;\n }\n }\n"]);return $=function(){return n},n}function F(){var n=j(["\n opacity: 0;\n position: absolute;\n top: calc(-100% - 2px);\n left: 0;\n display: block;\n padding: 0 3px;\n font-size: ","px;\n line-height: 16px;\n border-radius: ","px;\n white-space: nowrap;\n pointer-events: none;\n color: ",";\n background-color: ",";\n"]);return F=function(){return n},n}function G(){var n=j(["\n margin-right: 8px;\n position: relative;\n display: flex;\n align-items: stretch;\n width: 49px;\n flex: 0 0 49px;\n height: 16px;\n cursor: default;\n\n @media (max-width: ","px) {\n display: none;\n }\n"]);return G=function(){return n},n}function J(){var n=j(["\n margin: 0 ","px;\n line-height: 1.14;\n letter-spacing: 0.3px;\n font-size: ","px;\n display: flex;\n font-weight: bold;\n color: ",";\n"]);return J=function(){return n},n}function K(){var n=j(["\n display: inline-flex;\n align-items: center;\n padding: ","px 0;\n z-index: 1;\n color: ",";\n background-color: ",";\n"]);return K=function(){return n},n}M.propTypes={id:o.string,children:o.node,onClick:o.func,component:o.element,icon:o.node,title:o.string,isRightDropdown:o.bool},M.defaultProps={id:void 0,children:void 0,onClick:void 0,component:void 0,title:void 0,icon:void 0,isRightDropdown:!1};var N=i.div(K(),2*c,(function(n){return n.theme.balance.textColor}),(function(n){return n.theme.header.backgroundColor})),Q=i.div(J(),2*c,l,(function(n){return n.theme.balance.textColor})),V=i.div(G(),d),W=i.span(F(),p,m,(function(n){return n.theme.balance.chartColor}),(function(n){return n.theme.balance.chartBackgroundColor})),X=i.div($(),W),Y=i.div(U(),(function(n){return n.percentage>1?"".concat(n.percentage,"%"):"1px"}),(function(n){return n.theme.balance.dailyEarnedColor})),Z=function(e){var r=e.day,t=r.date,o=r.value,i=r.percentage;return n.createElement(X,null,n.createElement(Y,{percentage:i}),n.createElement(W,null,t," ","-"," ",n.createElement(x,{value:o})))};Z.propTypes={day:o.shape({date:o.node,value:o.node,percentage:o.node}).isRequired};var _=function(e){var r=e.balance,t=e.dailyEarned,o=Boolean(t.length);return n.createElement(N,null,n.createElement(Q,null,n.createElement(x,{value:r,decimalPosition:2})),o&&n.createElement(V,null,t.map((function(e,r){var t=r;return n.createElement(Z,{key:t,day:e})}))))};function nn(){var n=j(["\n display: flex;\n padding: 0 ","px;\n cursor: default;\n color: ",";\n"]);return nn=function(){return n},n}_.propTypes={balance:o.number.isRequired,dailyEarned:o.arrayOf(o.shape({date:o.string.isRequired,value:o.number.isRequired,percentage:o.number.isRequired}))},_.defaultProps={dailyEarned:[]};var en=i.div(nn(),4*c,(function(n){return n.theme.header.menuItemColor}));function rn(){return C.utc().subtract(5,"hour")}C.extend(w);var tn=function(o){var i=o.tooltipContent,a=B(r(rn()),2),u=a[0],l=a[1],c=e();return c.current=function(){l(rn())},t((function(){var n=setInterval((function(){c.current()}),1e3);return function(){return clearInterval(n)}}),[]),n.createElement(en,{onMouseEnter:function(n){k(n.target,i(u),E.BOTTOM)},onMouseLeave:H},"".concat(u.format("HH:mm")," EST"))};function on(){var n=j(["\n width: 1px;\n height: 20px;\n background-color: ",";\n"]);return on=function(){return n},n}tn.propTypes={tooltipContent:o.func},tn.defaultProps={tooltipContent:function(n){return"System time: ".concat(n.format("HH:mm DD.MM")," (EST)")}};var an=i.div(on(),(function(n){return n.theme.header.dividerColor}));function un(){var n=j(["\n border-radius: ","px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);\n padding: ","px 0;\n width: 100%;\n background-color: ",";\n \n @media (min-width: ","px) {\n width: auto;\n min-width: 150px;\n }\n"]);return un=function(){return n},n}var ln=i.div(un(),m,2*c,(function(n){return n.theme.header.menuItemBackgroundColor}),d),cn=function(e){var r=e.id,t=e.children;return n.createElement(ln,{id:r},t)};function dn(){var n=j(["\n height: 48px;\n padding: 0 16px;\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-align: left;\n background-color: ",";\n color: ",";\n \n &:hover {\n background-color: ",";\n color: ",";\n }\n\n & > * {\n border: 0;\n margin: 0;\n color: inherit !important;\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n display: flex;\n align-items: center;\n padding: 0 ","px;\n outline: none;\n font-size: inherit;\n background: transparent;\n transition: color 200ms ease-out;\n text-decoration: none;\n }\n"]);return dn=function(){return n},n}cn.propTypes={children:o.node.isRequired,id:o.string},cn.defaultProps={id:void 0};var pn=i.div(dn(),(function(n){return n.theme.header.menuItemBackgroundColor}),(function(n){return n.theme.header.menuItemColor}),(function(n){return n.theme.header.menuItemBackgroundColorHover}),(function(n){return n.theme.header.menuItemColorHover}),4*c),mn=function(e){var r=e.item;return n.createElement(pn,null,r)};mn.propTypes={item:o.shape({})},mn.defaultProps={item:{}};var sn=function(e){return e.items.map((function(e,r){return n.createElement(mn,{key:r,idx:r,item:e})}))};function fn(){var n=j(["\n display: flex;\n align-items: center;\n height: 100%;\n"]);return fn=function(){return n},n}function hn(){var n=j(["\n display: flex;\n align-items: center;\n"]);return hn=function(){return n},n}function gn(){var n=j(["\n ",",\n "]);return gn=function(){return n},n}function vn(){var n=j(["\n display: flex;\n height: 56px;\n align-items: center;\n justify-content: space-between;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 2001;\n background-color: ",";\n box-shadow: ",";\n\n ","\n"]);return vn=function(){return n},n}sn.propTypes={items:o.arrayOf(o.shape({}))},sn.defaultProps={items:[]};var bn=function(n){return function(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach((function(e){I(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}({},n)},yn=i.div(vn(),(function(n){return n.theme.header.backgroundColor}),(function(n){return n.theme.header.boxShadow}),(function(n){return Boolean(Object.values(n.customHeaderStyle).length)&&a(gn(),bn(n.customHeaderStyle))})),xn=i.div(hn()),Cn=i.div(fn()),wn={dark:{name:"dark",header:{backgroundColor:"hsl(228, 16.9%, 17.5%)",color:s,colorHover:f,boxShadow:"0 2px 8px 0 hsla(0, 0%, 0%, 0.1)",dividerColor:h,menuItemColor:s,menuItemColorHover:f,menuItemBackgroundColor:"hsl(228, 16.9%, 17.5%)",menuItemBackgroundColorHover:"hsla(0, 0%, 0%, 0.3)"},balance:{borderColor:g,textColor:f,dailyEarnedColor:f,chartColor:v,chartBackgroundColor:f}},light:{name:"light",header:{backgroundColor:f,color:s,colorHover:v,boxShadow:"0 2px 8px 0 hsla(0, 0%, 0%, 0.1)",dividerColor:b,menuItemColor:s,menuItemColorHover:v,menuItemBackgroundColor:f,menuItemBackgroundColorHover:b},balance:{borderColor:g,textColor:y,dailyEarnedColor:y,chartColor:f,chartBackgroundColor:v}},transparent:{name:"transparent",header:{backgroundColor:"none",color:s,colorHover:v,dividerColor:h,menuItemColor:s,menuItemColorHover:f,menuItemBackgroundColor:"hsl(228, 16.9%, 17.5%)",menuItemBackgroundColorHover:"hsla(0, 0%, 0%, 0.3)"},balance:{borderColor:g,textColor:y,dailyEarnedColor:y,chartColor:f,chartBackgroundColor:v}}},kn=o.shape({name:o.string,header:o.shape({backgroundColor:o.string,color:o.string,colorHover:o.string,boxShadow:o.string,dividerColor:o.string,menuItemColor:o.string,menuItemColorHover:o.string,menuItemBackgroundColor:o.string,menuItemBackgroundColorHover:o.string}),balance:o.shape({borderColor:o.string,textColor:o.string,dailyEarnedColor:o.string,chartColor:o.string,chartBackgroundColor:o.string})}),En=function(e){var r=e.theme,t=e.children;return n.createElement(u.Provider,{value:r},t)};En.propTypes={children:o.node.isRequired,theme:kn},En.defaultProps={theme:wn.light};var Hn=wn,In=function(e){var r=e.logo,t=e.customHeaderStyle,o=e.sidebarButton,i=e.children,a=e.theme,u=e.id;return n.createElement(En,{theme:a},n.createElement(yn,{id:u,customHeaderStyle:t},n.createElement(xn,null,o,r),n.createElement(Cn,null,i)))};In.propTypes={logo:o.element.isRequired,customHeaderStyle:o.object,sidebarButton:o.element,children:o.node.isRequired,theme:kn,id:o.string},In.defaultProps={customHeaderStyle:{},sidebarButton:null,theme:Hn.light,id:"header-container"},In.HeaderItem=M,In.HeaderBalance=_,In.HeaderTime=tn,In.HeaderDivider=function(){return n.createElement(an,null)},In.HeaderDropdown=cn,In.HeaderDropdownList=sn;export default In;export{Hn as themes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/header",
3
- "version": "4.5.0",
3
+ "version": "5.0.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "files": [
@@ -39,5 +39,5 @@
39
39
  "react": "^17.0.2",
40
40
  "styled-components": "5.1.1"
41
41
  },
42
- "gitHead": "f27ccdbd354f535289e5faba27245d991ec26fb6"
42
+ "gitHead": "ae73404e3c152b97200b40dc2a0f0a571c058162"
43
43
  }