@foxford/ui 2.8.0-beta-956b546-20230822 → 2.8.0-beta-7814470-20230824
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/ArrowBadge/ArrowBadge.js +2 -0
- package/components/ArrowBadge/ArrowBadge.js.map +1 -0
- package/components/ArrowBadge/Shape.js +2 -0
- package/components/ArrowBadge/Shape.js.map +1 -0
- package/components/ArrowBadge/images/arrow.module.svg.js +2 -0
- package/components/ArrowBadge/images/arrow.module.svg.js.map +1 -0
- package/components/ArrowBadge/images/tail.module.svg.js +2 -0
- package/components/ArrowBadge/images/tail.module.svg.js.map +1 -0
- package/components/ArrowBadge/style.js +2 -0
- package/components/ArrowBadge/style.js.map +1 -0
- package/components/Switcher/Switcher.js +1 -1
- package/components/Switcher/Switcher.js.map +1 -1
- package/components/Switcher/style.js +1 -1
- package/components/Switcher/style.js.map +1 -1
- package/dts/index.d.ts +93 -12
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/shared/utils/colors.js +2 -0
- package/shared/utils/colors.js.map +1 -0
- package/components/Switcher/constants.js +0 -2
- package/components/Switcher/constants.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from'@babel/runtime/helpers/objectSpread2';import s from'@babel/runtime/helpers/objectWithoutProperties';import{useClassname as r}from'../../hooks/useClassname.js';import{Root as a,Inner as o,Text as i}from'./style.js';import{Shape as t}from'./Shape.js';import{jsx as l,jsxs as m}from'react/jsx-runtime';var n=["children","content","className","display"];function p(c){var{children:d,content:h,className:j,display:u="inline-block"}=c,b=s(c,n);var f=r(p.displayName,j);return l(a,e(e({className:f,display:u},b),{},{children:m(o,e(e({},b),{},{children:[l(t,e({},b)),l(i,e(e({},b),{},{children:d||h})),l(t,e(e({},b),{},{isRight:!0}))]}))}))}p.displayName='ArrowBadge';export{p as ArrowBadge};
|
|
2
|
+
//# sourceMappingURL=ArrowBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowBadge.js","sources":["../../../../src/components/ArrowBadge/ArrowBadge.tsx"],"sourcesContent":["import { useClassname } from 'hooks/useClassname'\nimport * as Styled from './style'\nimport { ArrowBadgeProps } from './types'\nimport { Shape } from './Shape'\n\nArrowBadge.displayName = 'ArrowBadge'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n */\nexport function ArrowBadge({ children, content, className, display = 'inline-block', ...restProps }: ArrowBadgeProps) {\n const _className = useClassname(ArrowBadge.displayName, className)\n\n return (\n <Styled.Root className={_className} display={display} {...restProps}>\n <Styled.Inner {...restProps}>\n <Shape {...restProps} />\n <Styled.Text {...restProps}>{children || content}</Styled.Text>\n <Shape {...restProps} isRight />\n </Styled.Inner>\n </Styled.Root>\n )\n}\n"],"names":["ArrowBadge","_ref","children","content","className","display","restProps","_objectWithoutProperties","_excluded","_className","useClassname","displayName","_jsx","Styled.Root","_objectSpread","_jsxs","Styled.Inner","Shape","Styled.Text","isRight"],"mappings":"4WAaO,SAASA,EAAsGC,GAAA,IAA3FC,SAAEA,EAAFC,QAAYA,EAAZC,UAAqBA,EAArBC,QAAgCA,EAAU,gBAAiDJ,EAA9BK,EAA8BC,EAAAN,EAAAO,GACpH,IAAMC,EAAaC,EAAaV,EAAWW,YAAaP,GAExD,OACEQ,EAACC,EAADC,EAAAA,EAAA,CAAaV,UAAWK,EAAYJ,QAASA,GAAaC,GAA1D,GAAA,CAAAJ,SACEa,EAACC,SAAiBV,GAAlB,GAAA,CAAAJ,SACE,CAAAU,EAACK,EAADH,EAAA,GAAWR,IACXM,EAACM,EAADJ,EAAAA,EAAA,GAAiBR,GAAjB,GAAA,CAAAJ,SAA6BA,GAAYC,KACzCS,EAACK,EAADH,EAAAA,EAAA,GAAWR,GAAX,GAAA,CAAsBa,SAAO,YAhBrCnB,EAAWW,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import{SquareShape as a,RightTailShape as t,RightArrowShape as i,LeftTailShape as s,LeftArrowShape as h}from'./style.js';import{jsx as p}from'react/jsx-runtime';var o=["isRight","leftShape","rightShape"];function u(u){var{isRight:l=!1,leftShape:f="square",rightShape:S="square"}=u,m=r(u,o);if(l)switch(S){case'arrow':return p(i,e({},m));case'tail':return p(t,e({},m));default:return p(a,e({},m))}switch(f){case'arrow':return p(h,e({},m));case'tail':return p(s,e({},m));default:return p(a,e({},m))}}export{u as Shape};
|
|
2
|
+
//# sourceMappingURL=Shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shape.js","sources":["../../../../src/components/ArrowBadge/Shape.tsx"],"sourcesContent":["import * as Styled from './style'\nimport { ShapeProps } from './types'\n\nexport function Shape({ isRight = false, leftShape = 'square', rightShape = 'square', ...restProps }: ShapeProps) {\n if (isRight) {\n switch (rightShape) {\n case 'arrow':\n return <Styled.RightArrowShape {...restProps} />\n case 'tail':\n return <Styled.RightTailShape {...restProps} />\n\n default:\n return <Styled.SquareShape {...restProps} />\n }\n }\n\n switch (leftShape) {\n case 'arrow':\n return <Styled.LeftArrowShape {...restProps} />\n case 'tail':\n return <Styled.LeftTailShape {...restProps} />\n\n default:\n return <Styled.SquareShape {...restProps} />\n }\n}\n"],"names":["Shape","_ref","isRight","leftShape","rightShape","restProps","_objectWithoutProperties","_excluded","_jsx","Styled.RightArrowShape","_objectSpread","Styled.RightTailShape","Styled.SquareShape","Styled.LeftArrowShape","Styled.LeftTailShape"],"mappings":"8TAGO,SAASA,EAAkGC,GAAA,IAA5FC,QAAEA,KAAFC,UAAmBA,EAAY,SAA/BC,WAAyCA,EAAa,UAAsCH,EAAzBI,EAAyBC,EAAAL,EAAAM,GAChH,GAAIL,EACF,OAAQE,GACN,IAAK,QACH,OAAOI,EAACC,EAADC,EAAA,GAA4BL,IACrC,IAAK,OACH,OAAOG,EAACG,EAADD,EAAA,GAA2BL,IAEpC,QACE,OAAOG,EAACI,EAADF,EAAA,GAAwBL,IAIrC,OAAQF,GACN,IAAK,QACH,OAAOK,EAACK,EAADH,EAAA,GAA2BL,IACpC,IAAK,OACH,OAAOG,EAACM,EAADJ,EAAA,GAA0BL,IAEnC,QACE,OAAOG,EAACI,EAADF,EAAA,GAAwBL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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 a in e)({}).hasOwnProperty.call(e,a)&&(r[a]=e[a])}return r},e.apply(this,arguments)}var a=a=>r.createElement("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 48",fill:"none"},a),t||(t=r.createElement("path",{fill:"currentColor",d:"M20 0h9v48h-9ZM0 24l20 24V0Z"})));export{a as default};
|
|
2
|
+
//# sourceMappingURL=arrow.module.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow.module.svg.js","sources":["../../../../../src/components/ArrowBadge/images/arrow.module.svg"],"sourcesContent":["<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 29 48\" fill=\"none\"><path fill=\"currentColor\" d=\"M20 0h9v48h-9ZM0 24l20 24V0Z\"/></svg>\n"],"names":["_path","_extends","Object","assign","target","i","arguments","length","source","key","hasOwnProperty","call","apply","this","SvgArrowmodule","props","React","createElement","xmlns","viewBox","fill","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,EAAyCC,GACvBC,EAAMC,cAAc,MAAOhB,EAAS,CACtDiB,MAAO,6BACPC,QAAS,YACTC,KAAM,QACLL,GAAQf,IAAUA,EAAqBgB,EAAMC,cAAc,OAAQ,CACpEG,KAAM,eACNC,EAAG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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 a in e)({}).hasOwnProperty.call(e,a)&&(r[a]=e[a])}return r},e.apply(this,arguments)}var a=a=>r.createElement("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 48",fill:"none"},a),t||(t=r.createElement("path",{fill:"currentColor",d:"M0 48h32V0H0l16 24L0 48Z"})));export{a as default};
|
|
2
|
+
//# sourceMappingURL=tail.module.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.module.svg.js","sources":["../../../../../src/components/ArrowBadge/images/tail.module.svg"],"sourcesContent":["<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 48\" fill=\"none\"><path fill=\"currentColor\" d=\"M0 48h32V0H0l16 24L0 48Z\"/></svg>\n"],"names":["_path","_extends","Object","assign","target","i","arguments","length","source","key","hasOwnProperty","call","apply","this","SvgTailmodule","props","React","createElement","xmlns","viewBox","fill","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,EAAuCC,GACrBC,EAAMC,cAAc,MAAOhB,EAAS,CACtDiB,MAAO,6BACPC,QAAS,YACTC,KAAM,QACLL,GAAQf,IAAUA,EAAqBgB,EAAMC,cAAc,OAAQ,CACpEG,KAAM,eACNC,EAAG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o,{css as r}from'styled-components';import{display as a}from'../../mixins/display.js';import n from'./images/arrow.module.svg.js';import t from'./images/tail.module.svg.js';var i='xl';var e={s:24,m:20,l:40,xl:48};var s={s:10,m:14,l:22,xl:28};var c={s:6,m:8,l:13,xl:16};var d=r(["",""],(o=>{var{theme:r,secondary:a,third:n,fourth:t,small:i=!1}=o;return i?r.colors['content-onmain-primary']:a?r.colors['mother'===r.name?'content-brand-secondary':'content-onmain-primary']:n||t?r.colors['content-onmain-primary']:r.colors['content-brand-primary']}));var l=r(["",""],(o=>{var{theme:r,secondary:a,third:n,fourth:t}=o;return a?r.colors['bg-brand-secondary-100']:n?r.colors['bg-brand-tertiary-200']:t?r.colors['bg-brand-quaternary-200']:r.colors['bg-brand-primary-200']}));var m=o.div.withConfig({shouldForwardProp:o=>['children','className','style'].includes(o)}).withConfig({componentId:"fox-ui__sc-gzccd8-0"})(["",";"],(o=>o.display?a(o.display):null));var p=o.div.withConfig({componentId:"fox-ui__sc-gzccd8-1"})(["",""],(o=>{var{size:a=i,small:n=!1}=o;return r(["display:flex;height:","px;"],n?32:e[a])}));var f=o.div.withConfig({componentId:"fox-ui__sc-gzccd8-2"})(["",""],(o=>{var{size:a=i}=o;return r(["width:","px;background-color:",";"],c[a],l)}));var g=o(n).withConfig({componentId:"fox-ui__sc-gzccd8-3"})(["color:",";"],l);var h=o(g).withConfig({componentId:"fox-ui__sc-gzccd8-4"})(["transform:rotate(-180deg);"]);var u=o(t).withConfig({componentId:"fox-ui__sc-gzccd8-5"})(["color:",";"],l);var v=o(u).withConfig({componentId:"fox-ui__sc-gzccd8-6"})(["transform:rotate(-180deg);"]);var x=o.div.withConfig({componentId:"fox-ui__sc-gzccd8-7"})(["",""],(o=>{var{size:a=i,small:n=!1}=o;return r(["color:",";background-color:",";font-size:","px;line-height:","px;",";"],d,l,n?14:s[a],n?32:e[a],n?null:"\n font-family: 'TT Foxford';\n text-transform: uppercase;\n font-weight: 800;\n ")}));export{p as Inner,g as LeftArrowShape,u as LeftTailShape,h as RightArrowShape,v as RightTailShape,m as Root,f as SquareShape,x as Text};
|
|
2
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/ArrowBadge/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { display } from '../../mixins/display'\nimport { ArrowBadgeProps, ArrowBadgeSize, ShapeProps } from './types'\nimport Arrow from './images/arrow.module.svg'\nimport Tail from './images/tail.module.svg'\n\nconst DEFAULT_SIZE: ArrowBadgeSize = 'xl'\n\nconst HEIGHT: Record<ArrowBadgeSize, number> = {\n s: 24,\n m: 20,\n l: 40,\n xl: 48,\n}\n\nconst SMALL_HEIGHT = 32\n\nconst TEXT_SIZES: Record<ArrowBadgeSize, number> = {\n s: 10,\n m: 14,\n l: 22,\n xl: 28,\n}\n\nconst SMALL_TEXT_SIZE = 14\n\nconst SQUARE_SHAPE_SIZES: Record<ArrowBadgeSize, number> = {\n s: 6,\n m: 8,\n l: 13,\n xl: 16,\n}\n\nconst textColor = css<ArrowBadgeProps>`\n ${({ theme, secondary, third, fourth, small = false }) => {\n const isMotherTheme = theme.name === 'mother'\n\n if (small) return theme.colors['content-onmain-primary']\n if (secondary) return theme.colors[isMotherTheme ? 'content-brand-secondary' : 'content-onmain-primary']\n if (third) return theme.colors['content-onmain-primary']\n if (fourth) return theme.colors['content-onmain-primary']\n\n return theme.colors['content-brand-primary']\n }}\n`\n\nconst backgroundColor = css<ArrowBadgeProps>`\n ${({ theme, secondary, third, fourth }) => {\n if (secondary) return theme.colors['bg-brand-secondary-100']\n if (third) return theme.colors['bg-brand-tertiary-200']\n if (fourth) return theme.colors['bg-brand-quaternary-200']\n\n return theme.colors['bg-brand-primary-200']\n }}\n`\n\nexport const Root = styled.div.withConfig<ArrowBadgeProps>({\n shouldForwardProp: (prop) => ['children', 'className', 'style'].includes(prop),\n})`\n ${(props) => (props.display ? display(props.display) : null)};\n`\n\nexport const Inner = styled.div<ArrowBadgeProps>`\n ${({ size = DEFAULT_SIZE, small = false }) => {\n const height = small ? SMALL_HEIGHT : HEIGHT[size]\n\n return css`\n display: flex;\n height: ${height}px;\n `\n }}\n`\n\nexport const SquareShape = styled.div<ShapeProps>`\n ${({ size = DEFAULT_SIZE }) => {\n const currentSize = SQUARE_SHAPE_SIZES[size]\n\n return css`\n width: ${currentSize}px;\n background-color: ${backgroundColor};\n `\n }}\n`\n\nexport const LeftArrowShape = styled(Arrow)<ShapeProps>`\n color: ${backgroundColor};\n`\n\nexport const RightArrowShape = styled(LeftArrowShape)<ShapeProps>`\n transform: rotate(-180deg);\n`\n\nexport const LeftTailShape = styled(Tail)<ShapeProps>`\n color: ${backgroundColor};\n`\n\nexport const RightTailShape = styled(LeftTailShape)<ShapeProps>`\n transform: rotate(-180deg);\n`\n\nexport const Text = styled.div<ArrowBadgeProps>`\n ${({ size = DEFAULT_SIZE, small = false }) => {\n const fontSize: number = small ? SMALL_TEXT_SIZE : TEXT_SIZES[size]\n const lineHeight: number = small ? SMALL_HEIGHT : HEIGHT[size]\n\n return css`\n color: ${textColor};\n background-color: ${backgroundColor};\n font-size: ${fontSize}px;\n line-height: ${lineHeight}px;\n\n ${!small\n ? `\n font-family: 'TT Foxford';\n text-transform: uppercase;\n font-weight: 800;\n `\n : null};\n `\n }}\n`\n"],"names":["DEFAULT_SIZE","HEIGHT","s","m","l","xl","TEXT_SIZES","SQUARE_SHAPE_SIZES","textColor","css","_ref","theme","secondary","third","fourth","small","colors","name","backgroundColor","_ref2","Root","styled","div","withConfig","shouldForwardProp","prop","includes","componentId","props","display","Inner","_ref3","size","SquareShape","_ref4","LeftArrowShape","Arrow","RightArrowShape","LeftTailShape","Tail","RightTailShape","Text","_ref5"],"mappings":"oLAMA,IAAMA,EAA+B,KAErC,IAAMC,EAAyC,CAC7CC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,IAKN,IAAMC,EAA6C,CACjDJ,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,IAKN,IAAME,EAAqD,CACzDL,EAAG,EACHC,EAAG,EACHC,EAAG,GACHC,GAAI,IAGN,IAAMG,EAAYC,EAAH,CAAA,GAAA,KACXC,IAAwD,IAAvDC,MAAEA,EAAFC,UAASA,EAATC,MAAoBA,EAApBC,OAA2BA,EAA3BC,MAAmCA,MAAoBL,EAGxD,OAAIK,EAAcJ,EAAMK,OAAO,0BAC3BJ,EAAkBD,EAAMK,OAHS,WAAfL,EAAMM,KAGuB,0BAA4B,0BAC3EJ,GACAC,EADcH,EAAMK,OAAO,0BAGxBL,EAAMK,OAAO,4BAIxB,IAAME,EAAkBT,EAAH,CAAA,GAAA,KACjBU,IAAyC,IAAxCR,MAAEA,EAAFC,UAASA,EAATC,MAAoBA,EAApBC,OAA2BA,GAAaK,EACzC,OAAIP,EAAkBD,EAAMK,OAAO,0BAC/BH,EAAcF,EAAMK,OAAO,yBAC3BF,EAAeH,EAAMK,OAAO,2BAEzBL,EAAMK,OAAO,2BAIjB,IAAMI,EAAOC,EAAOC,IAAIC,WAA4B,CACzDC,kBAAoBC,GAAS,CAAC,WAAY,YAAa,SAASC,SAASD,KAD1DF,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,GAAA,MAGZO,GAAWA,EAAMC,QAAUA,EAAQD,EAAMC,SAAW,OAG5CC,IAAAA,EAAQT,EAAOC,IAAVC,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,GAAA,KACdU,IAA4C,IAA3CC,KAAEA,EAAOhC,EAATe,MAAuBA,GAAAA,GAAoBgB,EAG5C,OAAOtB,iCAFQM,EAjDE,GAiDqBd,EAAO+B,OASpCC,IAAAA,EAAcZ,EAAOC,IAAVC,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,GAAA,KACpBa,IAA6B,IAA5BF,KAAEA,EAAOhC,GAAmBkC,EAG7B,OAAOzB,EAAP,CAAA,SAAA,uBAAA,KAFoBF,EAAmByB,GAIjBd,UAKbiB,EAAiBd,EAAOe,GAAVb,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,SAAA,KAChBH,OAGEmB,EAAkBhB,EAAOc,GAAVZ,WAAA,CAAAI,YAAA,uBAAGN,CAAxB,CAAA,mCAIMiB,EAAgBjB,EAAOkB,GAAVhB,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,SAAA,KACfH,OAGEsB,EAAiBnB,EAAOiB,GAAVf,WAAA,CAAAI,YAAA,uBAAGN,CAAvB,CAAA,+BAIMoB,IAAAA,EAAOpB,EAAOC,IAAVC,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,GAAA,KACbqB,IAA4C,IAA3CV,KAAEA,EAAOhC,EAATe,MAAuBA,MAAoB2B,EAI5C,OAAOjC,EAAP,CAAA,SAAA,qBAAA,cAAA,kBAAA,MAAA,KACWD,EACWU,EALGH,EA9EL,GA8E+BT,EAAW0B,GACnCjB,EAxFV,GAwFiCd,EAAO+B,GAQpDjB,EAMC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import{
|
|
1
|
+
import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import{createRef as a}from'react';import{Root as t,Input as o,Switcher as n,Label as i}from'./style.js';import{jsxs as l,jsx as s}from'react/jsx-runtime';var c=["id","value","name","children","tabIndex","onChange"];function d(d){var m=a();var{id:h,value:p,name:u,children:b,tabIndex:f,onChange:x}=d,v=r(d,c);return l(t,e(e({value:p},v),{},{children:[s(o,{id:h,name:u,checked:p,type:"checkbox",tabIndex:f,ref:m,onChange:e=>{d.disabled||'function'!=typeof x||x(e.target.checked,e)}}),s(n,{htmlFor:h}),b?s(i,{htmlFor:h,children:b}):null]}))}d.defaultProps={value:!1,disabled:!1,color:'atlantis'},d.displayName='Switcher';export{d as Switcher};
|
|
2
2
|
//# sourceMappingURL=Switcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switcher.js","sources":["../../../../src/components/Switcher/Switcher.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Switcher.js","sources":["../../../../src/components/Switcher/Switcher.tsx"],"sourcesContent":["import { createRef } from 'react'\nimport { Color } from '../../mixins/color'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SwitcherProps extends BaseProps, Color<'color'>, Color<'inactiveColor'> {\n /**\n * Id for swithcer\n */\n id?: string\n /**\n * Name of input\n */\n name?: string\n /**\n * Value of input\n */\n value?: boolean\n /**\n * Switcher is disabled\n */\n disabled?: boolean\n /**\n * Tabindex\n */\n tabIndex?: number\n /**\n * Label of switcher\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * onChange function\n */\n onChange?(_checked: boolean, _event: React.ChangeEvent<HTMLInputElement>): void\n}\n\nSwitcher.defaultProps = {\n value: false,\n disabled: false,\n color: 'atlantis',\n}\n\nSwitcher.displayName = 'Switcher'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'inactiveColor'>`](#/Миксины)\n */\nexport function Switcher(props: typeof Switcher.defaultProps & SwitcherProps) {\n const inputRef = createRef<HTMLInputElement>()\n const { id, value, name, children, tabIndex, onChange, ...restProps } = props\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n if (!props.disabled && typeof onChange === 'function') {\n onChange(event.target.checked, event)\n }\n }\n\n return (\n <Styled.Root value={value} {...restProps}>\n <Styled.Input\n id={id}\n name={name}\n checked={value}\n type='checkbox'\n tabIndex={tabIndex}\n ref={inputRef}\n onChange={handleChange}\n />\n <Styled.Switcher htmlFor={id} />\n {children ? <Styled.Label htmlFor={id}>{children}</Styled.Label> : null}\n </Styled.Root>\n )\n}\n"],"names":["Switcher","props","inputRef","createRef","id","value","name","children","tabIndex","onChange","restProps","_excluded","_jsxs","Styled.Root","_objectSpread","_jsx","Styled.Input","checked","type","ref","event","disabled","target","Styled.Switcher","htmlFor","Styled.Label","defaultProps","color","displayName"],"mappings":"yUAqDO,SAASA,EAASC,GACvB,IAAMC,EAAWC,IACjB,IAAMC,GAAEA,EAAFC,MAAMA,EAANC,KAAaA,EAAbC,SAAmBA,EAAnBC,SAA6BA,EAA7BC,SAAuCA,GAA2BR,EAAdS,IAAcT,EAAxEU,GAQA,OACEC,EAACC,EAADC,EAAAA,EAAA,CAAaT,MAAOA,GAAWK,GAA/B,GAAA,CAAAH,SACE,CAAAQ,EAACC,EAAD,CACEZ,GAAIA,EACJE,KAAMA,EACNW,QAASZ,EACTa,KAAK,WACLV,SAAUA,EACVW,IAAKjB,EACLO,SAf4DW,IAC3DnB,EAAMoB,UAAgC,mBAAbZ,GAC5BA,EAASW,EAAME,OAAOL,QAASG,MAe/BL,EAACQ,EAAD,CAAiBC,QAASpB,IACzBG,EAAWQ,EAACU,EAAD,CAAcD,QAASpB,EAAvBG,SAA4BA,IAA2B,SApCzEP,EAAS0B,aAAe,CACtBrB,OAAO,EACPgB,UAAU,EACVM,MAAO,YAGT3B,EAAS4B,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{css as e}from'styled-components';import i from'tinycolor2';import{getColor as r}from'../../mixins/color.js';var t=o.input.withConfig({componentId:"fox-ui__sc-w14piw-0"})(["position:absolute;overflow:visible;z-index:-1;opacity:0;width:0;height:0;margin:0;"]);var n=o.label.withConfig({componentId:"fox-ui__sc-w14piw-1"})(["display:inline;padding-left:14px;cursor:pointer;user-select:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);var a=o.label.withConfig({componentId:"fox-ui__sc-w14piw-2"})(["position:relative;display:block;box-sizing:border-box;width:","px;height:","px;cursor:pointer;user-select:none;transition:background 0.3s ease,background-image 0.3s ease;border-radius:","px;box-shadow:inset 0 2px 2px 0 rgba(0,0,0,0.08);background-color:",";flex:0 0 auto;&:before{position:absolute;top:","px;left:","px;display:block;width:","px;height:","px;content:'';transition:background 0.3s ease,left 0.3s ease;transform:translateZ(0);border-radius:100%;background-color:",";box-shadow:0 0 6px 0 rgba(0,0,0,0.16);}&:active{&::before{box-shadow:0 0 1px 1px rgba(0,0,0,0.2);}}"],60,32,40,"#eaecf3",4,4,24,24,(o=>o.theme.colors.white));var l=e(["cursor:not-allowed;opacity:0.7;& ","{cursor:not-allowed;background-color:",";box-shadow:none;&:before{background-color:",";box-shadow:none;}}& ","{cursor:not-allowed;}"],a,"#eaecf3",(o=>o.theme.colors.white),n);var s=e(["& ","{&:before{left:","px;}}"],a,32);var c=o.div.withConfig({shouldForwardProp:o=>['className','style','children'].includes(o)}).withConfig({componentId:"fox-ui__sc-w14piw-3"})(["line-height:","px;position:relative;display:inline-flex;flex-direction:row;box-sizing:border-box;height:","px;vertical-align:middle;justify-content:flex-start;align-content:center;align-items:center;max-width:100%;color:inherit;"," "," ",""],32,32,(o=>o.disabled?l:null),(o=>o.value?s:null),(o=>o.value&&o.color?e(["& ","{background-image:linear-gradient( to right,",","," );}"],a,i(r(o.color,o)).lighten(10).toString(),r(o.color,o)):o.inactiveColor?e(["& ","{background-image:linear-gradient( to right,",","," );}"],a,i(r(o.inactiveColor,o)).lighten(10).toString(),r(o.inactiveColor,o)):null));export{t as Input,n as Label,c as Root,a as Switcher};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Switcher/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport {
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Switcher/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { getColor } from 'mixins/color'\nimport { SwitcherProps } from './Switcher'\n\nconst switcherWidth = 60\nconst switcherHeight = 32\nconst borderRadius = 40\nconst dotSize = 24\nconst defaultBackground = '#eaecf3'\n\nexport const Input = styled.input`\n position: absolute;\n overflow: visible;\n z-index: -1;\n opacity: 0;\n width: 0;\n height: 0;\n margin: 0;\n`\n\nexport const Label = styled.label`\n display: inline;\n padding-left: 14px;\n cursor: pointer;\n user-select: none;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n`\n\nexport const Switcher = styled.label`\n position: relative;\n display: block;\n box-sizing: border-box;\n width: ${switcherWidth}px;\n height: ${switcherHeight}px;\n cursor: pointer;\n user-select: none;\n transition: background 0.3s ease, background-image 0.3s ease;\n border-radius: ${borderRadius}px;\n box-shadow: inset 0 2px 2px 0 rgba(0, 0, 0, 0.08);\n background-color: ${defaultBackground};\n flex: 0 0 auto;\n &:before {\n position: absolute;\n top: ${(switcherHeight - dotSize) / 2}px;\n left: ${(switcherHeight - dotSize) / 2}px;\n display: block;\n width: ${dotSize}px;\n height: ${dotSize}px;\n content: '';\n transition: background 0.3s ease, left 0.3s ease;\n transform: translateZ(0);\n border-radius: 100%;\n background-color: ${(props) => props.theme.colors.white};\n box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.16);\n }\n\n &:active {\n &::before {\n box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.2);\n }\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n opacity: 0.7;\n\n & ${Switcher} {\n cursor: not-allowed;\n background-color: ${defaultBackground};\n box-shadow: none;\n &:before {\n background-color: ${(props) => props.theme.colors.white};\n box-shadow: none;\n }\n }\n & ${Label} {\n cursor: not-allowed;\n }\n`\n\nconst checked = css`\n & ${Switcher} {\n &:before {\n left: ${switcherWidth - dotSize - (switcherHeight - dotSize) / 2}px;\n }\n }\n`\n\nexport const Root = styled.div.withConfig<Omit<SwitcherProps, 'onChange'>>({\n shouldForwardProp: (prop) => ['className', 'style', 'children'].includes(prop),\n})`\n line-height: ${switcherHeight}px;\n position: relative;\n display: inline-flex;\n flex-direction: row;\n box-sizing: border-box;\n height: ${switcherHeight}px;\n vertical-align: middle;\n justify-content: flex-start;\n align-content: center;\n align-items: center;\n max-width: 100%;\n color: inherit;\n ${(props) => (props.disabled ? disabled : null)}\n ${(props) => (props.value ? checked : null)}\n ${(props) =>\n props.value && props.color\n ? css`\n & ${Switcher} {\n background-image: linear-gradient(\n to right,\n ${tinycolor(getColor(props.color, props)).lighten(10).toString()},\n ${getColor(props.color, props)}\n );\n }\n `\n : props.inactiveColor\n ? css`\n & ${Switcher} {\n background-image: linear-gradient(\n to right,\n ${tinycolor(getColor(props.inactiveColor, props)).lighten(10).toString()},\n ${getColor(props.inactiveColor, props)}\n );\n }\n `\n : null}\n`\n"],"names":["Input","styled","input","withConfig","componentId","Label","label","Switcher","props","theme","colors","white","disabled","css","checked","switcherWidth","Root","div","shouldForwardProp","prop","includes","switcherHeight","value","color","tinycolor","getColor","lighten","toString","inactiveColor"],"mappings":"sHAWaA,IAAAA,EAAQC,EAAOC,MAAVC,WAAA,CAAAC,YAAA,uBAAGH,CAAd,CAAA,uFAUMI,IAAAA,EAAQJ,EAAOK,MAAVH,WAAA,CAAAC,YAAA,uBAAGH,CAAd,CAAA,gIAUMM,IAAAA,EAAWN,EAAOK,MAAVH,WAAA,CAAAC,YAAA,uBAAGH,CAAH,CAAA,+DAAA,aAAA,+GAAA,qEAAA,iDAAA,WAAA,0BAAA,aAAA,4HAAA,wGA1BC,GACC,GACF,GAEK,UAqCf,EACC,EAvCI,GAAA,IA+CSO,GAAUA,EAAMC,MAAMC,OAAOC,QAWtD,IAAMC,EAAWC,8KAIXN,EA7DoB,WAkECC,GAAUA,EAAMC,MAAMC,OAAOC,OAIlDN,GAKN,IAAMS,EAAUD,EACVN,CAAAA,KAAAA,kBAAAA,SAAAA,EAEQQ,IAKP,IAAMC,EAAOf,EAAOgB,IAAId,WAA4C,CACzEe,kBAAoBC,GAAS,CAAC,YAAa,QAAS,YAAYC,SAASD,KAD1DhB,WAAA,CAAAC,YAAA,uBAAGH,CAGHoB,CAAAA,eAAAA,4FAAAA,4HAAAA,IAAAA,IAAAA,IAzFM,GAAA,IAqGlBb,GAAWA,EAAMI,SAAWA,EAAW,OACvCJ,GAAWA,EAAMc,MAAQR,EAAU,OACnCN,GACDA,EAAMc,OAASd,EAAMe,MACjBV,EACMN,CAAAA,KAAAA,+CAAAA,IAAAA,QAAAA,EAGEiB,EAAUC,EAASjB,EAAMe,MAAOf,IAAQkB,QAAQ,IAAIC,WACpDF,EAASjB,EAAMe,MAAOf,IAI9BA,EAAMoB,cACNf,mEACMN,EAGEiB,EAAUC,EAASjB,EAAMoB,cAAepB,IAAQkB,QAAQ,IAAIC,WAC5DF,EAASjB,EAAMoB,cAAepB,IAItC"}
|
package/dts/index.d.ts
CHANGED
|
@@ -349,6 +349,24 @@ interface InputField extends Color, Color<'placeholderColor'>, ResponsiveNamedPr
|
|
|
349
349
|
required?: boolean | undefined;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Converts HEX color code to RGB(A) string
|
|
354
|
+
*
|
|
355
|
+
* @export
|
|
356
|
+
* @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)
|
|
357
|
+
* @param {Number} alpha channel which specifies the opacity of the color
|
|
358
|
+
* @returns {String} RGB(A) string
|
|
359
|
+
*/
|
|
360
|
+
declare function hexToRgbA(hex: string, alpha?: number): string;
|
|
361
|
+
/**
|
|
362
|
+
* Checks if value is HEX color
|
|
363
|
+
*
|
|
364
|
+
* @export
|
|
365
|
+
* @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)
|
|
366
|
+
* @returns {boolean}
|
|
367
|
+
*/
|
|
368
|
+
declare function isHex(hex: string): boolean;
|
|
369
|
+
|
|
352
370
|
declare type StyledComponentProps = {
|
|
353
371
|
theme?: {
|
|
354
372
|
breakpoints?: typeof defaultTheme.breakpoints;
|
|
@@ -1019,6 +1037,39 @@ interface ArrowProps extends BaseProps$1 {
|
|
|
1019
1037
|
*/
|
|
1020
1038
|
declare const Arrow: react.ForwardRefExoticComponent<ArrowProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1021
1039
|
|
|
1040
|
+
declare type ArrowBadgeSideShape = 'square' | 'tail' | 'arrow';
|
|
1041
|
+
declare type ArrowBadgeSize = 'xl' | 'l' | 'm' | 's';
|
|
1042
|
+
interface ArrowBadgeProps extends BaseProps, Color, Display {
|
|
1043
|
+
/** Children react node */
|
|
1044
|
+
children?: React.ReactNode;
|
|
1045
|
+
content?: React.ReactNode;
|
|
1046
|
+
/** Secondary appearance */
|
|
1047
|
+
secondary?: boolean;
|
|
1048
|
+
/** Third appearance */
|
|
1049
|
+
third?: boolean;
|
|
1050
|
+
/** Fourth appearance */
|
|
1051
|
+
fourth?: boolean;
|
|
1052
|
+
/** Small view */
|
|
1053
|
+
small?: boolean;
|
|
1054
|
+
/** Size */
|
|
1055
|
+
size?: ArrowBadgeSize;
|
|
1056
|
+
/** Left side shape */
|
|
1057
|
+
leftShape?: ArrowBadgeSideShape;
|
|
1058
|
+
/** Right side shape */
|
|
1059
|
+
rightShape?: ArrowBadgeSideShape;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Расширен:
|
|
1064
|
+
* - [`BaseProps`](#/Миксины)
|
|
1065
|
+
* - [`Color`](#/Миксины)
|
|
1066
|
+
* - [`Display`](#/Миксины)
|
|
1067
|
+
*/
|
|
1068
|
+
declare function ArrowBadge({ children, content, className, display, ...restProps }: ArrowBadgeProps): JSX.Element;
|
|
1069
|
+
declare namespace ArrowBadge {
|
|
1070
|
+
var displayName: string;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1022
1073
|
interface AvatarProps extends BaseProps, Color {
|
|
1023
1074
|
/**
|
|
1024
1075
|
* Children react node
|
|
@@ -1714,24 +1765,54 @@ declare namespace Spinner {
|
|
|
1714
1765
|
var displayName: string;
|
|
1715
1766
|
}
|
|
1716
1767
|
|
|
1717
|
-
interface SwitcherProps extends BaseProps
|
|
1718
|
-
/**
|
|
1768
|
+
interface SwitcherProps extends BaseProps, Color<'color'>, Color<'inactiveColor'> {
|
|
1769
|
+
/**
|
|
1770
|
+
* Id for swithcer
|
|
1771
|
+
*/
|
|
1719
1772
|
id?: string;
|
|
1720
|
-
/**
|
|
1773
|
+
/**
|
|
1774
|
+
* Name of input
|
|
1775
|
+
*/
|
|
1721
1776
|
name?: string;
|
|
1722
|
-
/**
|
|
1777
|
+
/**
|
|
1778
|
+
* Value of input
|
|
1779
|
+
*/
|
|
1723
1780
|
value?: boolean;
|
|
1724
|
-
/**
|
|
1781
|
+
/**
|
|
1782
|
+
* Switcher is disabled
|
|
1783
|
+
*/
|
|
1725
1784
|
disabled?: boolean;
|
|
1726
|
-
/**
|
|
1785
|
+
/**
|
|
1786
|
+
* Tabindex
|
|
1787
|
+
*/
|
|
1727
1788
|
tabIndex?: number;
|
|
1728
|
-
/**
|
|
1789
|
+
/**
|
|
1790
|
+
* Label of switcher
|
|
1791
|
+
*/
|
|
1792
|
+
/**
|
|
1793
|
+
* Children react node
|
|
1794
|
+
*/
|
|
1729
1795
|
children?: React.ReactNode;
|
|
1730
|
-
/**
|
|
1731
|
-
|
|
1796
|
+
/**
|
|
1797
|
+
* onChange function
|
|
1798
|
+
*/
|
|
1799
|
+
onChange?(_checked: boolean, _event: React.ChangeEvent<HTMLInputElement>): void;
|
|
1800
|
+
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Расширен:
|
|
1803
|
+
* - [`BaseProps`](#/Миксины)
|
|
1804
|
+
* - [`Color`](#/Миксины)
|
|
1805
|
+
* - [`Color<'inactiveColor'>`](#/Миксины)
|
|
1806
|
+
*/
|
|
1807
|
+
declare function Switcher(props: typeof Switcher.defaultProps & SwitcherProps): JSX.Element;
|
|
1808
|
+
declare namespace Switcher {
|
|
1809
|
+
var defaultProps: {
|
|
1810
|
+
value: boolean;
|
|
1811
|
+
disabled: boolean;
|
|
1812
|
+
color: string;
|
|
1813
|
+
};
|
|
1814
|
+
var displayName: string;
|
|
1732
1815
|
}
|
|
1733
|
-
|
|
1734
|
-
declare const Switcher: react.ForwardRefExoticComponent<SwitcherProps & react.RefAttributes<HTMLDivElement>>;
|
|
1735
1816
|
|
|
1736
1817
|
interface TabProps extends Color, Color<'borderColor'> {
|
|
1737
1818
|
/**
|
|
@@ -2395,4 +2476,4 @@ declare namespace Select {
|
|
|
2395
2476
|
var displayName: string;
|
|
2396
2477
|
}
|
|
2397
2478
|
|
|
2398
|
-
export { ActionBtn, Alert, Amount, Anchor, Arrow, Avatar, Badge, BaseProps, Button, COUNTRY_DATA, CURRENCY_MAP, Checkbox, ColorNames, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, FontWeight, HEX, INITIAL_MASK, Icon, Input, InputField, Modal, Nullable, Paper, Progress, RGB, RGBA, Radio, withThemeScrollable as Scrollable, Section, Select, Separator, Spacer, Spinner, Switcher, Tabs, Tag, Text, Textarea, ThemeMode, ThemeName, ThemePreset, ThemeProvider, Tooltip, 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 };
|
|
2479
|
+
export { ActionBtn, Alert, Amount, Anchor, Arrow, ArrowBadge, Avatar, Badge, BaseProps, Button, COUNTRY_DATA, CURRENCY_MAP, Checkbox, ColorNames, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, FontWeight, HEX, INITIAL_MASK, Icon, Input, InputField, Modal, Nullable, Paper, Progress, RGB, RGBA, Radio, withThemeScrollable as Scrollable, Section, Select, Separator, Spacer, Spinner, Switcher, Tabs, Tag, Text, Textarea, ThemeMode, ThemeName, ThemePreset, ThemeProvider, Tooltip, adultDarkTheme, adultLightTheme, babyDarkTheme, babyLightTheme, baseInputStyle, buildMediaQuery, color, defaultIcons, desktopFirst, hexToRgbA, isHex, 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 };
|