@foxford/ui 2.1.0 → 2.3.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/components/Arrow/Arrow.js +1 -1
- package/components/Arrow/Arrow.js.map +1 -1
- package/components/Arrow/images/arrow.module.svg.js +1 -1
- package/components/Arrow/images/arrow.module.svg.js.map +1 -1
- package/components/Arrow/images/chevron.module.svg.js +2 -0
- package/components/Arrow/images/chevron.module.svg.js.map +1 -0
- package/components/Arrow/style.js +1 -1
- package/components/Arrow/style.js.map +1 -1
- package/components/Arrow/utils.js +2 -0
- package/components/Arrow/utils.js.map +1 -0
- package/components/ContextMenu/ContextMenu.js.map +1 -1
- package/components/Paper/Paper.js.map +1 -1
- package/dts/index.d.ts +65 -57
- package/hooks/use-theme.js +2 -0
- package/hooks/use-theme.js.map +1 -0
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/index.js +1 -1
- package/mixins/responsive-property.js.map +1 -1
- package/mixins/screen.js +1 -1
- package/mixins/screen.js.map +1 -1
- package/package.json +1 -1
- package/shared/utils/inject-theme.js +2 -0
- package/shared/utils/inject-theme.js.map +1 -0
- package/theme/colors-dark.js +2 -0
- package/theme/colors-dark.js.map +1 -0
- package/theme/colors-light.js +2 -0
- package/theme/colors-light.js.map +1 -0
- package/theme/theme-provider.js +1 -1
- package/theme/theme-provider.js.map +1 -1
- package/theme/themes.js +2 -0
- package/theme/themes.js.map +1 -0
- package/theme/index.js +0 -2
- package/theme/index.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from'@babel/runtime/helpers/objectSpread2';import{forwardRef as o}from'react';import{useUiTheme as e}from'../../hooks/use-theme.js';import s from'./images/arrow.module.svg.js';import a from'./images/chevron.module.svg.js';import{getArrowRotation as i}from'./utils.js';import{Root as t}from'./style.js';import{jsx as m}from'react/jsx-runtime';var n=o(((o,n)=>{var l,p,v,d;var u=e();var f='brand'===o.preset||'brand'===u.preset;var c=i(o);var b='l';var j='50%';var w=null===(l=u.components)||void 0===l||null===(p=l.Arrow)||void 0===p?void 0:p.size;var h=null===(v=u.components)||void 0===v||null===(d=v.Arrow)||void 0===d?void 0:d.square;return w&&(b=w),o.size&&(b=o.size),f&&(h&&(j='8px'),o.square&&(j='8px')),m(t,r(r({ref:n,type:"button"},o),{},{size:b,borderRadius:j,onClick:r=>{r.preventDefault(),o.disabled||'function'!=typeof o.onClick||o.onClick(r)},children:m("span",{children:m(f?s:a,{style:c})})}))}));var l='Arrow';n.displayName="Arrow";export{n as Arrow,l as COMPONENT_NAME};
|
|
2
2
|
//# sourceMappingURL=Arrow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arrow.js","sources":["../../../../src/components/Arrow/Arrow.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Arrow.js","sources":["../../../../src/components/Arrow/Arrow.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useUiTheme } from 'hooks/use-theme'\nimport ArrowSvg from './images/arrow.module.svg'\nimport ChevronSvg from './images/chevron.module.svg'\nimport type { ArrowProps, ArrowSize } from './types'\nimport { getArrowRotation } from './utils'\n\nimport * as Styled from './style'\n\n/**\n * Button with arrow icon\n */\nconst Arrow = forwardRef<HTMLButtonElement, ArrowProps>((props, ref) => {\n const theme = useUiTheme()\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n\n if (!props.disabled && typeof props.onClick === 'function') {\n props.onClick(event)\n }\n }\n\n const brandPresetUsed = props.preset === 'brand' || theme.preset === 'brand'\n const rotationStyles = getArrowRotation(props)\n\n let size: ArrowSize = 'l'\n let borderRadius = '50%'\n\n const contextSize = theme.components?.Arrow?.size\n const contextSquare = theme.components?.Arrow?.square\n\n if (contextSize) size = contextSize\n if (props.size) size = props.size\n\n if (brandPresetUsed) {\n if (contextSquare) borderRadius = '8px'\n if (props.square) borderRadius = '8px'\n }\n\n return (\n <Styled.Root ref={ref} type='button' {...props} size={size} borderRadius={borderRadius} onClick={handleClick}>\n <span>{brandPresetUsed ? <ArrowSvg style={rotationStyles} /> : <ChevronSvg style={rotationStyles} />}</span>\n </Styled.Root>\n )\n})\n\nconst COMPONENT_NAME = 'Arrow'\n\nArrow.displayName = COMPONENT_NAME\n\nexport { Arrow, COMPONENT_NAME }\n\nexport type { ArrowProps }\n"],"names":["Arrow","forwardRef","props","ref","_theme$components","_theme$components$Arr","_theme$components2","_theme$components2$Ar","theme","useUiTheme","brandPresetUsed","preset","rotationStyles","getArrowRotation","size","borderRadius","contextSize","components","contextSquare","square","_jsx","Styled.Root","_objectSpread","type","onClick","event","preventDefault","disabled","children","ArrowSvg","ChevronSvg","style","COMPONENT_NAME","displayName"],"mappings":"+VAYMA,IAAAA,EAAQC,GAAAA,CAA2CC,EAAOC,KAAQ,IAAAC,EAAAC,EAAAC,EAAAC,EACtE,IAAMC,EAAQC,IAUd,IAAMC,EAAmC,UAAjBR,EAAMS,QAAuC,UAAjBH,EAAMG,OAC1D,IAAMC,EAAiBC,EAAiBX,GAExC,IAAIY,EAAkB,IACtB,IAAIC,EAAe,MAEnB,IAAMC,UAAcR,EAAAA,EAAMS,kBAAAA,OAAN,UAAAb,EAAkBJ,aAAAA,IAAlBK,SAAAA,EAAyBS,KAC7C,IAAMI,UAAgBV,EAAAA,EAAMS,yBAAN,UAAAX,EAAkBN,aAAAA,IAAlBO,OAAAA,EAAAA,EAAyBY,OAU/C,OARIH,IAAaF,EAAOE,GACpBd,EAAMY,OAAMA,EAAOZ,EAAMY,MAEzBJ,IACEQ,IAAeH,EAAe,OAC9Bb,EAAMiB,SAAQJ,EAAe,QAIjCK,EAACC,EAADC,EAAAA,EAAA,CAAanB,IAAKA,EAAKoB,KAAK,UAAarB,GAAzC,GAAA,CAAgDY,KAAMA,EAAMC,aAAcA,EAAcS,QA1BrEC,IACnBA,EAAMC,iBAEDxB,EAAMyB,UAAqC,mBAAlBzB,EAAMsB,SAClCtB,EAAMsB,QAAQC,IAsBhBG,SACER,EAAA,OAAA,CAAAQ,SAAyBR,EAAlBV,EAAmBmB,EAAsCC,EAAvC,CAAUC,MAAOnB,YAK1CoB,IAAAA,EAAiB,QAEvBhC,EAAMiC,YAFiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as r from'react';var t;function e(){return e=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)({}).hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},e.apply(this,arguments)}var n=n=>r.createElement("svg",e({width:14,height:16,fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),t||(t=r.createElement("path",{d:"M7 1v14M7 1l6 6M7 1 1 7",stroke:"currentcolor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})));export{n as default};
|
|
2
2
|
//# sourceMappingURL=arrow.module.svg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.module.svg.js","sources":["../../../../../src/components/Arrow/images/arrow.module.svg"],"sourcesContent":["<svg
|
|
1
|
+
{"version":3,"file":"arrow.module.svg.js","sources":["../../../../../src/components/Arrow/images/arrow.module.svg"],"sourcesContent":["<svg width=\"14\" height=\"16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7 1v14M7 1l6 6M7 1 1 7\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>"],"names":["_path","_extends","Object","assign","target","i","arguments","length","source","key","hasOwnProperty","call","apply","this","SvgArrowmodule","props","React","createElement","width","height","fill","xmlns","d","stroke","strokeWidth","strokeLinecap","strokeLinejoin"],"mappings":"wBAAA,IAAIA,EAEJ,SAASC,IAA2Q,OAA9PA,EAAWC,OAAOC,QAAU,SAAUC,GAAU,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CAAE,IAAIG,EAASF,UAAUD,GAAI,IAAK,IAAII,KAAOD,GAAcN,IAAiBQ,eAAeC,KAAKH,EAAQC,KAAQL,EAAOK,GAAOD,EAAOC,IAAY,OAAOL,GAAkBH,EAASW,MAAMC,KAAMP,WAI7S,IAACQ,EAAyCC,GACvBC,EAAMC,cAAc,MAAOhB,EAAS,CACtDiB,MAAO,GACPC,OAAQ,GACRC,KAAM,OACNC,MAAO,8BACNN,GAAQf,IAAUA,EAAqBgB,EAAMC,cAAc,OAAQ,CACpEK,EAAG,0BACHC,OAAQ,eACRC,YAAa,IACbC,cAAe,QACfC,eAAgB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as t from'react';var r;function e(){return e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var a in e)({}).hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},e.apply(this,arguments)}var a=a=>t.createElement("svg",e({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 4.233 4.233"},a),r||(r=t.createElement("path",{d:"m.76 3.175-.363-.369 1.72-1.748 1.72 1.748-.363.369-1.357-1.38z"})));export{a as default};
|
|
2
|
+
//# sourceMappingURL=chevron.module.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chevron.module.svg.js","sources":["../../../../../src/components/Arrow/images/chevron.module.svg"],"sourcesContent":["<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 4.233 4.233\"><path d=\"M.76 3.175l-.363-.369 1.72-1.748 1.72 1.748-.363.369-1.357-1.38z\" /></svg>\n"],"names":["_path","_extends","Object","assign","target","i","arguments","length","source","key","hasOwnProperty","call","apply","this","SvgChevronmodule","props","React","createElement","xmlns","width","height","viewBox","d"],"mappings":"wBAAA,IAAIA,EAEJ,SAASC,IAA2Q,OAA9PA,EAAWC,OAAOC,QAAU,SAAUC,GAAU,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CAAE,IAAIG,EAASF,UAAUD,GAAI,IAAK,IAAII,KAAOD,GAAAA,IAA+BE,eAAeC,KAAKH,EAAQC,KAAQL,EAAOK,GAAOD,EAAOC,IAAY,OAAOL,GAAkBH,EAASW,MAAMC,KAAMP,WAI7S,IAACQ,EAA6CC,GAC3BC,EAAMC,cAAc,MAAOhB,EAAS,CACtDiB,MAAO,6BACPC,MAAO,GACPC,OAAQ,GACRC,QAAS,mBACRN,GAAQf,IAAUA,EAAqBgB,EAAMC,cAAc,OAAQ,CACpEK,EAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{css as n}from'styled-components';import{injectDefaultTheme as r}from'../../shared/utils/inject-theme.js';import{responsiveProperty as c}from'../../mixins/responsive-property.js';var e={l:48,m:44,xs:40};var t={l:40,m:28,xs:20};var a=['preset','square','onColored','size','top','right','bottom','left','inverse','outline','borderRadius'];var l="\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n";var i="\n cursor: not-allowed;\n -webkit-filter: grayscale(100%);\n -moz-filter: grayscale(100%);\n -ms-filter: grayscale(100%);\n -o-filter: grayscale(100%);\n filter: grayscale(100%);\n";var s={filled:{default:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: ".concat(r?n.colors['bg-disabled-large']:n.colors['bg-onmain-tertiary'],";\n color: ").concat(r?n.colors['content-disabled']:n.colors['content-onmain-primary'],";\n &::before {\n ").concat(l,"\n opacity: 0;\n background-color: ").concat(n.colors['bg-oncolor-hover'],";\n \n }\n &::after {\n ").concat(l,"\n opacity: 0;\n box-shadow: inset 0 4px ").concat(n.colors['bg-oncolor-hover'],";\n }\n ").concat(r?'cursor: default;':"\n &:hover::before {\n opacity: 1;\n }\n &:active::before {\n opacity: 0;\n }\n &:active::after {\n opacity: 1;\n }\n &:active {\n background-color: ".concat(n.colors['bg-brand-primary-basic-active'],";\n color: ").concat(n.colors['content-oncolor-primary'],";\n }\n "),"\n ")})),onColored:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: ".concat(n.colors['bg-oncolor-primary'],";\n color: ").concat(r?n.colors['content-disabled']:n.colors['content-oncolor-constant'],";\n &::before {\n ").concat(l,"\n opacity: 0;\n background-color: ").concat(n.colors['bg-oncolor-hover'],";\n }\n &::after {\n ").concat(l,"\n opacity: 0;\n box-shadow: inset 0 4px ").concat(n.colors['bg-oncolor-hover'],";\n }\n ").concat(r?'cursor: default;':"\n &:hover::before {\n opacity: 1;\n }\n &:active::after {\n opacity: 1;\n }\n ","\n ")}))},outline:{default:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: transparent; \n color: ".concat(r?n.colors['border-disabled']:n.colors['content-onmain-primary'],";\n &::before {\n ").concat(l,"\n opacity: 1;\n box-shadow: inset 0 0 0 1px ").concat(r?n.colors['border-disabled']:n.colors['border-onmain-contrast'],";\n }\n &::after {\n ").concat(l,"\n opacity: 0;\n box-shadow: inset 0 4px ").concat(n.colors['bg-oncolor-hover'],";\n }\n ").concat(r?'cursor: default;':"\n &:hover::before {\n opacity: 0;\n }\n &:hover {\n background-color: ".concat(n.colors['bg-onmain-tertiary'],";\n }\n &:active::after {\n opacity: 1;\n }\n &:active {\n background-color: ").concat(n.colors['bg-brand-primary-basic-active'],";\n color: ").concat(n.colors['content-oncolor-primary'],";\n }\n "),"\n ")})),onColored:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: transparent; \n color: ".concat(r?n.colors['border-oncolor-disabled']:n.colors['content-oncolor-primary'],";\n &::before {\n ").concat(l,"\n opacity: 1;\n box-shadow: inset 0 0 0 1px ").concat(r?n.colors['border-oncolor-disabled']:n.colors['border-oncolor-default'],";\n }\n &::after {\n ").concat(l,"\n opacity: 0;\n box-shadow: inset 0 4px ").concat(n.colors['bg-oncolor-hover'],";\n }\n ").concat(r?'cursor: default;':"\n &:hover::before {\n opacity: 0;\n }\n &:hover {\n background-color: ".concat(n.colors['bg-oncolor-primary'],";\n color: ").concat(n.colors['content-oncolor-constant'],";\n }\n &:active::after {\n opacity: 1;\n }\n "),"\n ")}))}};var d={filled:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: ".concat(n.colors.white,";\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);\n & svg {\n fill: ").concat(n.colors.accent,";\n }\n &:hover {\n background-color: ").concat(n.colors.accent,";\n box-shadow: none;\n svg {\n fill: ").concat(n.colors.white,";\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 rgba(5, 108, 188, 0.5);\n }\n ").concat(r?i:'',"\n ")})),outline:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: transparent;\n box-shadow: inset 0 0 0 2px ".concat(n.colors.alto,";\n & svg {\n fill: ").concat(n.colors.alto,";\n }\n &:hover {\n background-color: ").concat(n.colors.accent,";\n box-shadow: none;\n svg {\n fill: ").concat(n.colors.white,";\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 rgba(5, 108, 188, 0.5);\n }\n ").concat(r?i:'',"\n ")})),inverse:n(["",""],(o=>{var{theme:n,disabled:r}=o;return"\n background-color: transparent;\n box-shadow: inset 0 0 0 2px ".concat(n.colors.white,";\n & svg {\n fill: ").concat(n.colors.white,";\n }\n &:hover {\n background-color: ").concat(n.colors.white,";\n box-shadow: none;\n svg {\n fill: ").concat(n.colors.accent,";\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 #eaecf3;\n }\n ").concat(r?i:'',"\n ")}))};var b=(o,n)=>{var r='brand'===o.preset||'brand'===o.theme.preset?e:t;return['l','m','xs'].includes(o.size)?"".concat(n,": ").concat(r[o.size],"px;"):c('size',n)};var p=o.button.withConfig({shouldForwardProp:o=>!a.includes(o)}).attrs(r).withConfig({componentId:"fox-ui__sc-1xgj0m4-0"})([""," "," "," "," ",""],"\n &,\n & > span {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n position: relative;\n flex-shrink: 0;\n padding: 0;\n border: 0;\n line-height: 1;\n cursor: pointer;\n overflow: hidden;\n transition-property: background-color, box-shadow;\n &::before, \n &::after {\n transition-property: opacity;\n }\n &,\n &::before,\n &::after {\n transition-duration: 200ms;\n }\n",(o=>'brand'===o.preset||'brand'===o.theme.preset?o.outline&&o.onColored?s.outline.onColored:o.outline&&!o.onColored?s.outline.default:!o.outline&&o.onColored?s.filled.onColored:s.filled.default:o.inverse?d.inverse:o.outline?d.outline:d.filled),(o=>b(o,'height')),(o=>b(o,'width')),(o=>"border-radius: ".concat(o.borderRadius,";")));export{p as Root};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Arrow/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { ArrowProps } from './Arrow'\n\nconst outline = css`\n box-shadow: inset 0 0 0 2px ${(props) => props.theme.colors.alto};\n background: transparent;\n\n svg {\n fill: ${(props) => props.theme.colors.alto};\n }\n`\n\nconst inverse = css`\n box-shadow: inset 0 0 0 2px ${(props) => props.theme.colors.white};\n background: transparent;\n &:hover,\n &:active {\n background: ${(props) => props.theme.colors.white};\n svg {\n fill: ${(props) => props.theme.colors.accent};\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 #eaecf3;\n }\n\n svg {\n fill: ${(props) => props.theme.colors.white};\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n -webkit-filter: grayscale(100%);\n -moz-filter: grayscale(100%);\n -ms-filter: grayscale(100%);\n -o-filter: grayscale(100%);\n filter: grayscale(100%);\n`\n\nconst size = (size: ArrowProps['size']) => {\n let radius\n switch (size) {\n case 'l':\n radius = 40\n break\n case 'm':\n radius = 28\n break\n case 'xs':\n radius = 20\n break\n default:\n radius = 28\n }\n return css`\n border-radius: ${radius}px;\n width: ${radius}px;\n height: ${radius}px;\n `\n}\n\nexport const Root = styled.button<ArrowProps>`\n outline: 0;\n border: 0;\n background: #fff;\n border-radius: 99em;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 0;\n line-height: 0;\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);\n transition: all 0.2s ease;\n margin: 0;\n padding: 0;\n cursor: pointer;\n ${(props) => (props.size ? size(props.size) : null)}\n\n &:hover {\n background: ${(props) => props.theme.colors.accent};\n box-shadow: none;\n svg {\n fill: white;\n }\n }\n\n &:active {\n background: darken($accent, 13);\n box-shadow: inset 0 4px 0 rgba(5, 108, 188, 0.5);\n }\n\n svg {\n transition: all 0.2s ease;\n fill: ${(props) => props.theme.colors.accent};\n }\n\n ${(props) => (props.outline ? outline : null)}\n ${(props) => (props.inverse ? inverse : null)}\n ${(props) => (props.disabled ? disabled : null)}\n`\n"],"names":["outline","css","props","theme","colors","alto","inverse","white","accent","disabled","Root","styled","button","withConfig","componentId","size","radius"],"mappings":"2CAGA,IAAMA,EAAUC,EAAH,CAAA,8BAAA,oCAAA,OACoBC,GAAUA,EAAMC,MAAMC,OAAOC,OAIjDH,GAAUA,EAAMC,MAAMC,OAAOC,OAI1C,IAAMC,EAAUL,sKACiBC,GAAUA,EAAMC,MAAMC,OAAOG,QAI3CL,GAAUA,EAAMC,MAAMC,OAAOG,QAEjCL,GAAUA,EAAMC,MAAMC,OAAOI,SAQ/BN,GAAUA,EAAMC,MAAMC,OAAOG,QAI1C,IAAME,EAAWR,EAAjB,CAAA,+JA+BaS,IAAAA,EAAOC,EAAOC,OAAVC,WAAA,CAAAC,YAAA,wBAAGH,CAAH,CAAA,kPAAA,uBAAA,4JAAA,KAAA,IAAA,IAAA,KAeZT,GAAWA,EAAMa,KArCRA,CAAAA,IACZ,IAAIC,EACJ,OAAQD,GACN,IAAK,IACHC,EAAS,GACT,MACF,IAAK,IAML,QACEA,EAAS,GAJX,MAAA,IAAK,KACHA,EAAS,GAKb,OAAOf,EACYe,CAAAA,iBAAAA,YAAAA,aAAAA,OAAAA,EACRA,EACCA,IAlBAD,CAqCoBb,EAAMa,MAAQ,OAG7Bb,GAAUA,EAAMC,MAAMC,OAAOI,SAcnCN,GAAUA,EAAMC,MAAMC,OAAOI,SAGrCN,GAAWA,EAAMF,QAAUA,EAAU,OACrCE,GAAWA,EAAMI,QAAUA,EAAU,OACrCJ,GAAWA,EAAMO,SAAWA,EAAW"}
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Arrow/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { DefaultTheme } from 'styled-components'\nimport { injectDefaultTheme } from 'shared/utils/inject-theme'\nimport { responsiveProperty } from 'mixins/responsive-property'\nimport type { ArrowRootProps, ArrowStaticSize, ArrowTransientProp } from './types'\n\nconst SIZES: Record<ArrowStaticSize, number> = { l: 48, m: 44, xs: 40 }\n\nconst DEFAULT_SIZES: Record<ArrowStaticSize, number> = { l: 40, m: 28, xs: 20 }\n\nconst TRANSIENT_PROPS: ArrowTransientProp[] = [\n 'preset',\n 'square',\n 'onColored',\n 'size',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'inverse',\n 'outline',\n 'borderRadius',\n]\n\nconst baseStyles = `\n &,\n & > span {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n position: relative;\n flex-shrink: 0;\n padding: 0;\n border: 0;\n line-height: 1;\n cursor: pointer;\n overflow: hidden;\n transition-property: background-color, box-shadow;\n &::before, \n &::after {\n transition-property: opacity;\n }\n &,\n &::before,\n &::after {\n transition-duration: 200ms;\n }\n`\n\nconst pseudoBaseStyles = `\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n`\n\nconst defaultDisabledStyles = `\n cursor: not-allowed;\n -webkit-filter: grayscale(100%);\n -moz-filter: grayscale(100%);\n -ms-filter: grayscale(100%);\n -o-filter: grayscale(100%);\n filter: grayscale(100%);\n`\n\nconst PRESET = {\n filled: {\n default: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: ${disabled ? theme.colors['bg-disabled-large'] : theme.colors['bg-onmain-tertiary']};\n color: ${disabled ? theme.colors['content-disabled'] : theme.colors['content-onmain-primary']};\n &::before {\n ${pseudoBaseStyles}\n opacity: 0;\n background-color: ${theme.colors['bg-oncolor-hover']};\n \n }\n &::after {\n ${pseudoBaseStyles}\n opacity: 0;\n box-shadow: inset 0 4px ${theme.colors['bg-oncolor-hover']};\n }\n ${\n disabled\n ? 'cursor: default;'\n : `\n &:hover::before {\n opacity: 1;\n }\n &:active::before {\n opacity: 0;\n }\n &:active::after {\n opacity: 1;\n }\n &:active {\n background-color: ${theme.colors['bg-brand-primary-basic-active']};\n color: ${theme.colors['content-oncolor-primary']};\n }\n `\n }\n `}\n `,\n onColored: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: ${theme.colors['bg-oncolor-primary']};\n color: ${disabled ? theme.colors['content-disabled'] : theme.colors['content-oncolor-constant']};\n &::before {\n ${pseudoBaseStyles}\n opacity: 0;\n background-color: ${theme.colors['bg-oncolor-hover']};\n }\n &::after {\n ${pseudoBaseStyles}\n opacity: 0;\n box-shadow: inset 0 4px ${theme.colors['bg-oncolor-hover']};\n }\n ${\n disabled\n ? 'cursor: default;'\n : `\n &:hover::before {\n opacity: 1;\n }\n &:active::after {\n opacity: 1;\n }\n `\n }\n `}\n `,\n },\n outline: {\n default: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: transparent; \n color: ${disabled ? theme.colors['border-disabled'] : theme.colors['content-onmain-primary']};\n &::before {\n ${pseudoBaseStyles}\n opacity: 1;\n box-shadow: inset 0 0 0 1px ${\n disabled ? theme.colors['border-disabled'] : theme.colors['border-onmain-contrast']\n };\n }\n &::after {\n ${pseudoBaseStyles}\n opacity: 0;\n box-shadow: inset 0 4px ${theme.colors['bg-oncolor-hover']};\n }\n ${\n disabled\n ? 'cursor: default;'\n : `\n &:hover::before {\n opacity: 0;\n }\n &:hover {\n background-color: ${theme.colors['bg-onmain-tertiary']};\n }\n &:active::after {\n opacity: 1;\n }\n &:active {\n background-color: ${theme.colors['bg-brand-primary-basic-active']};\n color: ${theme.colors['content-oncolor-primary']};\n }\n `\n }\n `}\n `,\n onColored: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: transparent; \n color: ${disabled ? theme.colors['border-oncolor-disabled'] : theme.colors['content-oncolor-primary']};\n &::before {\n ${pseudoBaseStyles}\n opacity: 1;\n box-shadow: inset 0 0 0 1px ${\n disabled ? theme.colors['border-oncolor-disabled'] : theme.colors['border-oncolor-default']\n };\n }\n &::after {\n ${pseudoBaseStyles}\n opacity: 0;\n box-shadow: inset 0 4px ${theme.colors['bg-oncolor-hover']};\n }\n ${\n disabled\n ? 'cursor: default;'\n : `\n &:hover::before {\n opacity: 0;\n }\n &:hover {\n background-color: ${theme.colors['bg-oncolor-primary']};\n color: ${theme.colors['content-oncolor-constant']};\n }\n &:active::after {\n opacity: 1;\n }\n `\n }\n `}\n `,\n },\n}\n\nconst PRESET_DEFAULT = {\n filled: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: ${theme.colors.white};\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);\n & svg {\n fill: ${theme.colors.accent};\n }\n &:hover {\n background-color: ${theme.colors.accent};\n box-shadow: none;\n svg {\n fill: ${theme.colors.white};\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 rgba(5, 108, 188, 0.5);\n }\n ${disabled ? defaultDisabledStyles : ''}\n `}\n `,\n outline: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: transparent;\n box-shadow: inset 0 0 0 2px ${theme.colors.alto};\n & svg {\n fill: ${theme.colors.alto};\n }\n &:hover {\n background-color: ${theme.colors.accent};\n box-shadow: none;\n svg {\n fill: ${theme.colors.white};\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 rgba(5, 108, 188, 0.5);\n }\n ${disabled ? defaultDisabledStyles : ''}\n `}\n `,\n inverse: css<ArrowRootProps>`\n ${({ theme, disabled }) => `\n background-color: transparent;\n box-shadow: inset 0 0 0 2px ${theme.colors.white};\n & svg {\n fill: ${theme.colors.white};\n }\n &:hover {\n background-color: ${theme.colors.white};\n box-shadow: none;\n svg {\n fill: ${theme.colors.accent};\n }\n }\n &:active {\n box-shadow: inset 0 4px 0 #eaecf3;\n }\n ${disabled ? defaultDisabledStyles : ''}\n `}\n `,\n}\n\nconst extractSize = (props: ArrowRootProps & { theme: DefaultTheme }, cssProperty: 'height' | 'width') => {\n const brandPresetUsed = props.preset === 'brand' || props.theme.preset === 'brand'\n const config = brandPresetUsed ? SIZES : DEFAULT_SIZES\n\n return ['l', 'm', 'xs'].includes(<ArrowStaticSize>props.size)\n ? `${cssProperty}: ${config[<ArrowStaticSize>props.size]}px;`\n : responsiveProperty('size', cssProperty)\n}\n\nconst extractStyles = (props: ArrowRootProps & { theme: DefaultTheme }) => {\n const brandPresetUsed = props.preset === 'brand' || props.theme.preset === 'brand'\n\n if (brandPresetUsed) {\n if (props.outline && props.onColored) return PRESET.outline.onColored\n if (props.outline && !props.onColored) return PRESET.outline.default\n if (!props.outline && props.onColored) return PRESET.filled.onColored\n\n return PRESET.filled.default\n }\n\n if (props.inverse) return PRESET_DEFAULT.inverse\n if (props.outline) return PRESET_DEFAULT.outline\n\n return PRESET_DEFAULT.filled\n}\n\nexport const Root = styled.button\n .withConfig({\n shouldForwardProp: (prop) => {\n return !TRANSIENT_PROPS.includes(<ArrowTransientProp>prop)\n },\n })\n .attrs(injectDefaultTheme)<ArrowRootProps>`\n ${baseStyles}\n ${extractStyles}\n ${(props) => extractSize(props, 'height')}\n ${(props) => extractSize(props, 'width')}\n ${(props) => `border-radius: ${props.borderRadius};`}\n`\n"],"names":["SIZES","l","m","xs","DEFAULT_SIZES","TRANSIENT_PROPS","pseudoBaseStyles","defaultDisabledStyles","PRESET","filled","default","css","_ref","theme","disabled","concat","colors","onColored","_ref2","outline","_ref3","_ref4","PRESET_DEFAULT","_ref5","white","accent","_ref6","alto","inverse","_ref7","extractSize","props","cssProperty","config","preset","includes","size","responsiveProperty","Root","styled","button","withConfig","shouldForwardProp","prop","attrs","injectDefaultTheme","component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hB,OAA6BgB,EAAMgB,aAAnC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var t={top:0,right:90,bottom:180,left:270};function r(r){var{top:o,right:e,bottom:a,left:n}=r;var c={top:o&&!a,right:e&&!n,bottom:a&&!o,left:n&&!e};var l=Object.values(c).filter((t=>!0===t)).length>1;var f=Object.keys(c).reduce(((r,o)=>c[o]?r+t[o]:r),0)/(l?2:1);return{transform:"rotate(".concat(f,"deg)").concat(l?' translateY(-3px)':'')}}export{t as DIR_MAP,r as getArrowRotation};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/Arrow/utils.ts"],"sourcesContent":["import type { ArrowProps } from './types'\n\nexport const DIR_MAP = {\n top: 0,\n right: 90,\n bottom: 180,\n left: 270,\n}\n\nexport function getArrowRotation({ top, right, bottom, left }: ArrowProps): React.CSSProperties {\n const arrowDir = {\n top: top && !bottom,\n right: right && !left,\n bottom: bottom && !top,\n left: left && !right,\n }\n\n const isMultiDir = Object.values(arrowDir).filter((value) => value === true).length > 1\n\n const rotateDeg =\n Object.keys(arrowDir).reduce((acc, key) => (arrowDir[key] ? acc + DIR_MAP[key] : acc), 0) / (isMultiDir ? 2 : 1)\n\n return {\n transform: `rotate(${rotateDeg}deg)${isMultiDir ? ' translateY(-3px)' : ''}`,\n }\n}\n"],"names":["DIR_MAP","top","right","bottom","left","getArrowRotation","_ref","arrowDir","isMultiDir","Object","values","filter","value","length","rotateDeg","keys","reduce","acc","key","transform","concat"],"mappings":"AAEO,IAAMA,EAAU,CACrBC,IAAK,EACLC,MAAO,GACPC,OAAQ,IACRC,KAAM,KAGD,SAASC,EAAgFC,GAAA,IAA/DL,IAAEA,EAAFC,MAAOA,EAAPC,OAAcA,EAAdC,KAAsBA,GAAyCE,EAC9F,IAAMC,EAAW,CACfN,IAAKA,IAAQE,EACbD,MAAOA,IAAUE,EACjBD,OAAQA,IAAWF,EACnBG,KAAMA,IAASF,GAGjB,IAAMM,EAAaC,OAAOC,OAAOH,GAAUI,QAAQC,IAAoB,IAAVA,IAAgBC,OAAS,EAEtF,IAAMC,EACJL,OAAOM,KAAKR,GAAUS,SAAQC,EAAKC,IAASX,EAASW,GAAOD,EAAMjB,EAAQkB,GAAOD,GAAM,IAAMT,EAAa,EAAI,GAEhH,MAAO,CACLW,2BAAqBL,EAAZ,QAAAM,OAA4BZ,EAAa,oBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sources":["../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { cloneElement, PureComponent } from 'react'\nimport { ContextMenuMultiLevel } from '../../components/ContextMenu.Multilevel'\nimport { BaseProps } from '../../shared/interfaces'\nimport { Tooltip } from './../Tooltip'\nimport { ContextMenuItem } from './Item'\nimport * as Styled from './style'\nimport { tooltipStyles } from './tooltip-styles'\n\nexport interface ContextMenuProps extends BaseProps {\n /**\n * Children react node\n */\n children: React.ReactNode\n /** Indicates if button is active (e.g. when context menu is open) */\n onClick?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** Manually controled state */\n isOpen?: boolean\n /** On open menu callback */\n onOpen?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** On close menu callback */\n onClose?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** Content */\n trigger?: React.ReactNode\n /** Properties for inner Tooltip component */\n tooltipProps?: Partial<Parameters<typeof Tooltip>[0]>\n /** Hide overlay for debug */\n hideOverlay?: boolean\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n */\nexport class ContextMenu extends PureComponent<ContextMenuProps, { isOpen: boolean }> {\n static Item = ContextMenuItem\n static MultiLevel = ContextMenuMultiLevel\n static displayName = 'ContextMenu'\n\n static defaultProps = {\n tooltipProps: {\n event: 'click',\n placement: 'left-start',\n offset: 2,\n showCloseButton: false,\n styles: tooltipStyles,\n },\n hideOverlay: false,\n }\n\n constructor(props: ContextMenuProps) {\n super(props)\n\n this.state = {\n isOpen: this.props.isOpen || false,\n }\n }\n\n getOpen = () => {\n const { isOpen } = this.props\n\n if (isOpen !== undefined) return isOpen\n\n return this.state.isOpen || false\n }\n\n openMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n this.setState({ isOpen: true })\n\n const { onOpen } = this.props\n\n onOpen && onOpen(e)\n }\n\n closeMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n this.setState({ isOpen: false })\n\n const { onClose } = this.props\n\n onClose && onClose(e)\n }\n\n toggleMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n const { openMenu, closeMenu } = this\n const isOpen = this.getOpen()\n\n e.persist()\n e.preventDefault()\n e.stopPropagation()\n\n isOpen ? closeMenu(e) : openMenu(e)\n\n return false\n }\n\n render() {\n const { className, tooltipProps = {}, trigger, children, hideOverlay } = this.props\n const isOpen = this.getOpen()\n\n if (children) tooltipProps.content = children\n\n return (\n <Styled.Root className={className} isOpen={isOpen} onClick={this.toggleMenu} hideOverlay={hideOverlay}>\n <Tooltip {...tooltipProps} open={isOpen}>\n <div onClick={this.closeMenu}>{trigger && cloneElement(trigger as any, { active: isOpen })}</div>\n </Tooltip>\n </Styled.Root>\n )\n }\n}\n"],"names":["ContextMenu","PureComponent","constructor","props","super","this","getOpen","isOpen","state","openMenu","e","setState","onOpen","closeMenu","onClose","toggleMenu","persist","preventDefault","stopPropagation","render","className","tooltipProps","trigger","children","hideOverlay","content","_jsx","Styled.Root","onClick","Tooltip","_objectSpread","open","cloneElement","active","Item","ContextMenuItem","MultiLevel","ContextMenuMultiLevel","displayName","defaultProps","event","placement","offset","showCloseButton","styles","tooltipStyles"],"mappings":"kaAkCO,MAAMA,UAAoBC,EAgB/BC,YAAYC,GACVC,MAAMD,GAD6BE,KAQrCC,QAAU,KACR,IAAMC,OAAEA,GAAWF,KAAKF,MAExB,gBAAII,EAA6BA,EAE1BF,KAAKG,MAAMD,YAbiBF,KAgBrCI,SAAYC,IACVL,KAAKM,SAAS,CAAEJ,QAAAA,IAEhB,IAAMK,OAAEA,GAAWP,KAAKF,MAExBS,GAAUA,EAAOF,IArBkBL,KAwBrCQ,UAAaH,IACXL,KAAKM,SAAS,CAAEJ,YAEhB,IAAMO,QAAEA,GAAYT,KAAKF,MAEzBW,GAAWA,EAAQJ,IA7BgBL,KAgCrCU,WAAcL,IACZ,IAAMD,SAAEA,EAAFI,UAAYA,GAAcR,KAChC,IAAME,EAASF,KAAKC,UAQpB,OANAI,EAAEM,UACFN,EAAEO,iBACFP,EAAEQ,kBAEFX,EAASM,EAAUH,GAAKD,EAASC,OArCjCL,KAAKG,MAAQ,CACXD,OAAQF,KAAKF,MAAMI,SAAAA,GAyCvBY,SACE,IAAMC,UAAEA,EAAFC,aAAaA,EAAe,GAA5BC,QAAgCA,EAAhCC,SAAyCA,EAAzCC,YAAmDA,GAAgBnB,KAAKF,MAC9E,IAAMI,EAASF,KAAKC,UAIpB,OAFIiB,IAAUF,EAAaI,QAAUF,GAGnCG,EAACC,EAAD,CAAaP,UAAWA,EAAWb,OAAQA,EAAQqB,QAASvB,KAAKU,WAAYS,YAAaA,EAA1FD,SACEG,EAACG,EAADC,EAAAA,EAAA,GAAaT,GAAb,GAAA,CAA2BU,KAAMxB,EAAjCgB,
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","sources":["../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { cloneElement, PureComponent } from 'react'\nimport { ContextMenuMultiLevel } from '../../components/ContextMenu.Multilevel'\nimport { BaseProps } from '../../shared/interfaces'\nimport { Tooltip } from './../Tooltip'\nimport { ContextMenuItem } from './Item'\nimport * as Styled from './style'\nimport { tooltipStyles } from './tooltip-styles'\n\nexport interface ContextMenuProps extends BaseProps {\n /**\n * Children react node\n */\n children: React.ReactNode\n /** Indicates if button is active (e.g. when context menu is open) */\n onClick?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** Manually controled state */\n isOpen?: boolean\n /** On open menu callback */\n onOpen?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** On close menu callback */\n onClose?: (_e: React.MouseEvent<HTMLDivElement>) => void\n /** Content */\n trigger?: React.ReactNode\n /** Properties for inner Tooltip component */\n tooltipProps?: Partial<Parameters<typeof Tooltip>[0]>\n /** Hide overlay for debug */\n hideOverlay?: boolean\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n */\nexport class ContextMenu extends PureComponent<ContextMenuProps, { isOpen: boolean }> {\n static Item = ContextMenuItem\n static MultiLevel = ContextMenuMultiLevel\n static displayName = 'ContextMenu'\n\n static defaultProps = {\n tooltipProps: {\n event: 'click',\n placement: 'left-start',\n offset: 2,\n showCloseButton: false,\n styles: tooltipStyles,\n },\n hideOverlay: false,\n }\n\n constructor(props: ContextMenuProps) {\n super(props)\n\n this.state = {\n isOpen: this.props.isOpen || false,\n }\n }\n\n getOpen = () => {\n const { isOpen } = this.props\n\n if (isOpen !== undefined) return isOpen\n\n return this.state.isOpen || false\n }\n\n openMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n this.setState({ isOpen: true })\n\n const { onOpen } = this.props\n\n onOpen && onOpen(e)\n }\n\n closeMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n this.setState({ isOpen: false })\n\n const { onClose } = this.props\n\n onClose && onClose(e)\n }\n\n toggleMenu = (e: React.MouseEvent<HTMLDivElement>) => {\n const { openMenu, closeMenu } = this\n const isOpen = this.getOpen()\n\n e.persist()\n e.preventDefault()\n e.stopPropagation()\n\n isOpen ? closeMenu(e) : openMenu(e)\n\n return false\n }\n\n render() {\n const { className, tooltipProps = {}, trigger, children, hideOverlay } = this.props\n const isOpen = this.getOpen()\n\n if (children) tooltipProps.content = children\n\n return (\n <Styled.Root className={className} isOpen={isOpen} onClick={this.toggleMenu} hideOverlay={hideOverlay}>\n <Tooltip {...tooltipProps} open={isOpen}>\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n <div onClick={this.closeMenu}>{trigger && cloneElement(trigger as any, { active: isOpen })}</div>\n </Tooltip>\n </Styled.Root>\n )\n }\n}\n"],"names":["ContextMenu","PureComponent","constructor","props","super","this","getOpen","isOpen","state","openMenu","e","setState","onOpen","closeMenu","onClose","toggleMenu","persist","preventDefault","stopPropagation","render","className","tooltipProps","trigger","children","hideOverlay","content","_jsx","Styled.Root","onClick","Tooltip","_objectSpread","open","cloneElement","active","Item","ContextMenuItem","MultiLevel","ContextMenuMultiLevel","displayName","defaultProps","event","placement","offset","showCloseButton","styles","tooltipStyles"],"mappings":"kaAkCO,MAAMA,UAAoBC,EAgB/BC,YAAYC,GACVC,MAAMD,GAD6BE,KAQrCC,QAAU,KACR,IAAMC,OAAEA,GAAWF,KAAKF,MAExB,gBAAII,EAA6BA,EAE1BF,KAAKG,MAAMD,YAbiBF,KAgBrCI,SAAYC,IACVL,KAAKM,SAAS,CAAEJ,QAAAA,IAEhB,IAAMK,OAAEA,GAAWP,KAAKF,MAExBS,GAAUA,EAAOF,IArBkBL,KAwBrCQ,UAAaH,IACXL,KAAKM,SAAS,CAAEJ,YAEhB,IAAMO,QAAEA,GAAYT,KAAKF,MAEzBW,GAAWA,EAAQJ,IA7BgBL,KAgCrCU,WAAcL,IACZ,IAAMD,SAAEA,EAAFI,UAAYA,GAAcR,KAChC,IAAME,EAASF,KAAKC,UAQpB,OANAI,EAAEM,UACFN,EAAEO,iBACFP,EAAEQ,kBAEFX,EAASM,EAAUH,GAAKD,EAASC,OArCjCL,KAAKG,MAAQ,CACXD,OAAQF,KAAKF,MAAMI,SAAAA,GAyCvBY,SACE,IAAMC,UAAEA,EAAFC,aAAaA,EAAe,GAA5BC,QAAgCA,EAAhCC,SAAyCA,EAAzCC,YAAmDA,GAAgBnB,KAAKF,MAC9E,IAAMI,EAASF,KAAKC,UAIpB,OAFIiB,IAAUF,EAAaI,QAAUF,GAGnCG,EAACC,EAAD,CAAaP,UAAWA,EAAWb,OAAQA,EAAQqB,QAASvB,KAAKU,WAAYS,YAAaA,EAA1FD,SACEG,EAACG,EAADC,EAAAA,EAAA,GAAaT,GAAb,GAAA,CAA2BU,KAAMxB,EAAjCgB,SAEEG,EAAA,MAAA,CAAKE,QAASvB,KAAKQ,UAAnBU,SAA+BD,GAAWU,EAAaV,EAAgB,CAAEW,OAAQ1B,YAvE9EP,EACJkC,KAAOC,EADHnC,EAEJoC,WAAaC,EAFTrC,EAGJsC,YAAc,cAHVtC,EAKJuC,aAAe,CACpBlB,aAAc,CACZmB,MAAO,QACPC,UAAW,aACXC,OAAQ,EACRC,mBACAC,OAAQC,GAEVrB,aAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paper.js","sources":["../../../../src/components/Paper/Paper.tsx"],"sourcesContent":["import { useClassname } from 'hooks/useClassname'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport
|
|
1
|
+
{"version":3,"file":"Paper.js","sources":["../../../../src/components/Paper/Paper.tsx"],"sourcesContent":["import { useClassname } from 'hooks/useClassname'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport { SpacerProps } from '../../components/Spacer'\nimport * as Styled from './style'\n\nexport interface PaperProps extends SpacerProps, Color, ResponsiveNamedProperty<'padding'> {\n /**\n * Set to true to generate a circlular paper container\n */\n circle?: boolean\n /**\n * Paper with rounded corners\n */\n rounded?: boolean\n /**\n * Paper with shadow\n */\n shadow?: boolean\n /**\n * This number represents the zDepth of the paper shadow\n */\n zDepth?: false | 0 | 1 | 2 | 3 | 4\n /**\n * Text align\n */\n textAlign?: 'left' | 'center' | 'right'\n}\n\nPaper.displayName = 'Paper'\n\n/**\n * Расширен:\n * - [`SpacerProps`](#/Разметка%20и%20позиционирование/Spacer)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveNamedProperty<'padding'>`](#/Миксины)\n */\nexport function Paper({ padding = 'm', rounded = true, shadow = true, className, ...props }: PaperProps) {\n const _className = useClassname(Paper.displayName, className)\n\n return <Styled.Root padding={padding} rounded={rounded} shadow={shadow} className={_className} {...props} />\n}\n"],"names":["Paper","_ref","padding","rounded","shadow","className","props","_objectWithoutProperties","_excluded","_className","useClassname","displayName","_jsx","Styled.Root","_objectSpread"],"mappings":"wSAqCO,SAASA,EAAyFC,GAAA,IAAnFC,QAAEA,EAAU,IAAZC,QAAiBA,GAAAA,EAAjBC,OAAiCA,GAAS,EAA1CC,UAAgDA,GAAmCJ,EAArBK,EAAqBC,EAAAN,EAAAO,GACvG,IAAMC,EAAaC,EAAaV,EAAMW,YAAaN,GAEnD,OAAOO,EAACC,EAADC,EAAA,CAAaZ,QAASA,EAASC,QAASA,EAASC,OAAQA,EAAQC,UAAWI,GAAgBH,IAXrGN,EAAMW,YAAc"}
|
package/dts/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as styled_components from 'styled-components';
|
|
3
3
|
import { DefaultTheme, FlattenSimpleInterpolation, CSSObject, SimpleInterpolation, css } from 'styled-components';
|
|
4
|
+
import { ResponsiveProperty as ResponsiveProperty$1 } from 'mixins/responsive-property';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { PureComponent, Component } from 'react';
|
|
6
7
|
import { Link, NavLink } from 'react-router-dom';
|
|
@@ -14,6 +15,22 @@ import Floater from 'react-floater';
|
|
|
14
15
|
import { InputState, MaskOptions } from 'react-input-mask';
|
|
15
16
|
import { ReactSelectProps } from 'react-select';
|
|
16
17
|
|
|
18
|
+
interface ThemeProviderProps {
|
|
19
|
+
theme: Partial<DefaultTheme> | ((topLevelTheme: DefaultTheme) => DefaultTheme);
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare function ThemeProvider(props: ThemeProviderProps): JSX.Element;
|
|
23
|
+
|
|
24
|
+
declare const defaultTheme: DefaultTheme;
|
|
25
|
+
declare const motherLightTheme: DefaultTheme;
|
|
26
|
+
declare const motherDarkTheme: DefaultTheme;
|
|
27
|
+
declare const babyLightTheme: DefaultTheme;
|
|
28
|
+
declare const babyDarkTheme: DefaultTheme;
|
|
29
|
+
declare const teenLightTheme: DefaultTheme;
|
|
30
|
+
declare const teenDarkTheme: DefaultTheme;
|
|
31
|
+
declare const adultLightTheme: DefaultTheme;
|
|
32
|
+
declare const adultDarkTheme: DefaultTheme;
|
|
33
|
+
|
|
17
34
|
declare enum ColorNames {
|
|
18
35
|
facebook = "facebook",
|
|
19
36
|
twitter = "twitter",
|
|
@@ -188,14 +205,6 @@ declare enum ColorNames {
|
|
|
188
205
|
superlightgrey = "superlightgrey"
|
|
189
206
|
}
|
|
190
207
|
|
|
191
|
-
interface Props {
|
|
192
|
-
theme: DefaultTheme;
|
|
193
|
-
children: React.ReactNode;
|
|
194
|
-
}
|
|
195
|
-
declare function ThemeProvider(props: Props): JSX.Element;
|
|
196
|
-
|
|
197
|
-
declare const theme: Theme;
|
|
198
|
-
|
|
199
208
|
declare type ColorPropsProperties = 'color' | 'fontColor' | `${string}Color` | `color${string}`;
|
|
200
209
|
declare type ColorValue = keyof typeof ColorNames | RGB | RGBA | HEX;
|
|
201
210
|
declare type ColorCalcProperty = (_color: ColorValue) => FlattenSimpleInterpolation | null;
|
|
@@ -273,6 +282,44 @@ declare const responsiveNamedProperty: <T extends PropsProperties>({ sizes, cssP
|
|
|
273
282
|
*/
|
|
274
283
|
declare const responsiveProperty: (propName: string, cssProperty?: string | null, sizing?: null | string) => () => (props: any) => styled_components.FlattenInterpolation<styled_components.ThemeProps<styled_components.DefaultTheme>> | null;
|
|
275
284
|
|
|
285
|
+
declare type ArrowStaticSize = 'l' | 'm' | 'xs';
|
|
286
|
+
declare type ArrowSize = ArrowStaticSize | ResponsiveProperty$1<`${number}rem` | number>;
|
|
287
|
+
declare type ArrowProps = {
|
|
288
|
+
/** Appearance preset */
|
|
289
|
+
preset?: 'default' | 'brand';
|
|
290
|
+
/** Square shape */
|
|
291
|
+
square?: boolean;
|
|
292
|
+
/** Used on colored background */
|
|
293
|
+
onColored?: boolean;
|
|
294
|
+
/** Size of button */
|
|
295
|
+
size?: ArrowSize;
|
|
296
|
+
/** Arrow points top */
|
|
297
|
+
top?: boolean;
|
|
298
|
+
/** Arrow points right */
|
|
299
|
+
right?: boolean;
|
|
300
|
+
/** Arrow points bottom */
|
|
301
|
+
bottom?: boolean;
|
|
302
|
+
/** Arrow points left */
|
|
303
|
+
left?: boolean;
|
|
304
|
+
/** Inverted colors */
|
|
305
|
+
inverse?: boolean;
|
|
306
|
+
/** Outlined appearance */
|
|
307
|
+
outline?: boolean;
|
|
308
|
+
/** Button disabled */
|
|
309
|
+
disabled?: boolean;
|
|
310
|
+
/** Click handler */
|
|
311
|
+
onClick?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
312
|
+
/** CSS classname */
|
|
313
|
+
className?: string;
|
|
314
|
+
/** Style object */
|
|
315
|
+
style?: React.CSSProperties;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Button with arrow icon
|
|
320
|
+
*/
|
|
321
|
+
declare const Arrow: react.ForwardRefExoticComponent<ArrowProps & react.RefAttributes<HTMLButtonElement>>;
|
|
322
|
+
|
|
276
323
|
declare enum SizeInput {
|
|
277
324
|
l = 380,
|
|
278
325
|
m = 300,
|
|
@@ -283,6 +330,9 @@ declare enum SizeInput {
|
|
|
283
330
|
declare type HEX = `#${string}`;
|
|
284
331
|
declare type RGB = `rgb(${number}, ${number}, ${number})`;
|
|
285
332
|
declare type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`;
|
|
333
|
+
declare type ThemePreset = 'default' | 'brand';
|
|
334
|
+
declare type ThemeMode = 'light' | 'dark';
|
|
335
|
+
declare type ComponentConfig<P> = Omit<Partial<P>, 'className' | 'style'>;
|
|
286
336
|
interface Tooltiped {
|
|
287
337
|
innerRef?: React.LegacyRef<HTMLElement>;
|
|
288
338
|
onMouseEnter?: () => void;
|
|
@@ -361,11 +411,16 @@ interface Theme {
|
|
|
361
411
|
utils?: {
|
|
362
412
|
relBuilder?: (_link?: string, _target?: string) => undefined | string;
|
|
363
413
|
};
|
|
414
|
+
mode: ThemeMode;
|
|
415
|
+
preset: ThemePreset;
|
|
416
|
+
components?: {
|
|
417
|
+
Arrow?: ComponentConfig<ArrowProps>;
|
|
418
|
+
};
|
|
364
419
|
}
|
|
365
420
|
|
|
366
421
|
declare type StyledComponentProps = {
|
|
367
422
|
theme?: {
|
|
368
|
-
breakpoints?: typeof
|
|
423
|
+
breakpoints?: typeof defaultTheme.breakpoints;
|
|
369
424
|
};
|
|
370
425
|
};
|
|
371
426
|
declare type MediaQueryParams = {
|
|
@@ -826,53 +881,6 @@ declare namespace Anchor {
|
|
|
826
881
|
};
|
|
827
882
|
}
|
|
828
883
|
|
|
829
|
-
interface ArrowProps extends BaseProps {
|
|
830
|
-
/**
|
|
831
|
-
* Size of icon
|
|
832
|
-
*/
|
|
833
|
-
size?: 'xs' | 'm' | 'l';
|
|
834
|
-
/**
|
|
835
|
-
* Direction arrow
|
|
836
|
-
*/
|
|
837
|
-
top?: boolean;
|
|
838
|
-
/**
|
|
839
|
-
* Direction arrow
|
|
840
|
-
*/
|
|
841
|
-
right?: boolean;
|
|
842
|
-
/**
|
|
843
|
-
* Direction arrow
|
|
844
|
-
*/
|
|
845
|
-
bottom?: boolean;
|
|
846
|
-
/**
|
|
847
|
-
* Direction arrow
|
|
848
|
-
*/
|
|
849
|
-
left?: boolean;
|
|
850
|
-
inverse?: boolean;
|
|
851
|
-
outline?: boolean;
|
|
852
|
-
disabled?: boolean;
|
|
853
|
-
onClick?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
854
|
-
}
|
|
855
|
-
/**
|
|
856
|
-
* Расширен:
|
|
857
|
-
* - [`BaseProps`](#/Миксины)
|
|
858
|
-
*/
|
|
859
|
-
declare class Arrow extends PureComponent<ArrowProps> {
|
|
860
|
-
static displayName: string;
|
|
861
|
-
static defaultProps: {
|
|
862
|
-
size: string;
|
|
863
|
-
top: boolean;
|
|
864
|
-
right: boolean;
|
|
865
|
-
bottom: boolean;
|
|
866
|
-
left: boolean;
|
|
867
|
-
inverse: boolean;
|
|
868
|
-
outline: boolean;
|
|
869
|
-
disabled: boolean;
|
|
870
|
-
onClick: () => void;
|
|
871
|
-
};
|
|
872
|
-
onClickHandler: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
873
|
-
render(): JSX.Element;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
884
|
interface AvatarProps extends BaseProps, Color {
|
|
877
885
|
/**
|
|
878
886
|
* Children react node
|
|
@@ -2570,4 +2578,4 @@ declare namespace Select {
|
|
|
2570
2578
|
var displayName: string;
|
|
2571
2579
|
}
|
|
2572
2580
|
|
|
2573
|
-
export { ActionBtn, Amount, Anchor, Arrow, Avatar, Badge, BaseProps, Button, COUNTRY_DATA, CURRENCY_MAP, Checkbox, ColorNames, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, HEX, INITIAL_MASK, Icon, Input, InputField, Modal, Paper, Progress, RGB, RGBA, Radio, withThemeScrollable as Scrollable, Section, Select, Separator, Spacer, Spinner, Switcher, Tabs, Tag, Text, Textarea, Theme, ThemeProvider, Tooltip, Tooltiped, baseInputStyle, buildMediaQuery, color, defaultIcons, desktopFirst, mobileFirst, property, responsiveNamedProperty, responsiveProperty, screenL, screenM, screenMaxL, screenMaxM, screenMaxS, screenMaxXl, screenMaxXs, screenMaxXxs, screenMinL, screenMinM, screenMinS, screenMinXl, screenMinXs, screenRetina, screenS, screenXl, screenXs, theme, vAlign };
|
|
2581
|
+
export { ActionBtn, Amount, Anchor, Arrow, Avatar, Badge, BaseProps, Button, COUNTRY_DATA, CURRENCY_MAP, Checkbox, ColorNames, ComponentConfig, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, HEX, INITIAL_MASK, Icon, Input, InputField, Modal, Paper, Progress, RGB, RGBA, Radio, withThemeScrollable as Scrollable, Section, Select, Separator, Spacer, Spinner, Switcher, Tabs, Tag, Text, Textarea, Theme, ThemeMode, ThemePreset, ThemeProvider, Tooltip, Tooltiped, adultDarkTheme, adultLightTheme, babyDarkTheme, babyLightTheme, baseInputStyle, buildMediaQuery, color, defaultIcons, desktopFirst, mobileFirst, motherDarkTheme, motherLightTheme, property, responsiveNamedProperty, responsiveProperty, screenL, screenM, screenMaxL, screenMaxM, screenMaxS, screenMaxXl, screenMaxXs, screenMaxXxs, screenMinL, screenMinM, screenMinS, screenMinXl, screenMinXs, screenRetina, screenS, screenXl, screenXs, teenDarkTheme, teenLightTheme, defaultTheme as theme, vAlign };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme.js","sources":["../../../src/hooks/use-theme.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport type { DefaultTheme } from 'styled-components'\nimport { defaultTheme } from '../theme/themes'\n\nexport function useUiTheme(): DefaultTheme {\n const theme = useTheme()\n const shouldForwardTheme = typeof theme === 'object' && Object.keys(theme).length\n\n return shouldForwardTheme ? theme : defaultTheme\n}\n"],"names":["useUiTheme","theme","useTheme","Object","keys","length","defaultTheme"],"mappings":"+FAIO,SAASA,IACd,IAAMC,EAAQC,IAGd,MAF4C,iBAAVD,GAAsBE,OAAOC,KAAKH,GAAOI,OAE/CJ,EAAQK"}
|