@pedidopago/ui 1.13.32 → 1.13.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Carousel/contexts/carousel-context/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,OAAO,CAAC;AAUtF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKtE,eAAO,MAAM,eAAe,+CAAkE,CAAC;AAE/F,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,aAAa,EACb,SAAS,EAAE,UAAkB,GAC9B,EAAE,iBAAiB,GAAG,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Carousel/contexts/carousel-context/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,OAAO,CAAC;AAUtF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKtE,eAAO,MAAM,eAAe,+CAAkE,CAAC;AAE/F,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,aAAa,EACb,SAAS,EAAE,UAAkB,GAC9B,EAAE,iBAAiB,GAAG,qBAAqB,2CAoX3C"}
|
|
@@ -3,6 +3,4 @@
|
|
|
3
3
|
// Utils
|
|
4
4
|
// Types
|
|
5
5
|
// Constants
|
|
6
|
-
var CarouselContext=/*#__PURE__*/(0,_react.createContext)({});exports.CarouselContext=CarouselContext;function CarouselProvider(_ref){function getSliderInfo(){var container=sliderRef.current,arrayOfChildren=Array.from(container.childNodes),positions=arrayOfChildren.map(function(data,index){return{offsetPosition:data.offsetLeft,offsetPositionPercent:data.offsetLeft-.3*data.offsetLeft,position:index+1}});return{container:container,positions:positions}}function navigateToScroll(scrollPosition){var sliderInfo=getSliderInfo();sliderInfo.container&&sliderInfo.container.scrollTo({behavior:"smooth",left:scrollPosition})}function hideRightButton(hide){rightButtonRef.current&&(hide?rightButtonRef.current.classList.add("hide"):rightButtonRef.current.classList.remove("hide"))}function hideLeftButton(hide){leftButtonRef.current&&(hide?leftButtonRef.current.classList.add("hide"):leftButtonRef.current.classList.remove("hide"))}function handleHideButtons(){var sliderInfo=getSliderInfo();if(sliderInfo.container){var maxScroll=sliderInfo.container.scrollWidth-sliderInfo.container.clientWidth,isEndOfScroll=sliderInfo.container.scrollLeft>=maxScroll;isMaxScroll.current=isEndOfScroll,hideRightButton(currentActive===sliderInfo.positions.length),hideLeftButton(0===sliderInfo.container.scrollLeft)}}function beginMomentumTracking(){cancelMomentumTracking(),momentumID=requestAnimationFrame(momentumLoop),delayAutoExec&&setDelay(delayAutoExec)}function cancelMomentumTracking(){cancelAnimationFrame(momentumID)}function onMomentumEnd(){if(autoAdjust){var sliderInfo=getSliderInfo()
|
|
7
|
-
// is a little bit less than the offset position in some cases
|
|
8
|
-
setCurrentActive(active+1)},100);return(0,_interval.useInterval)(function(){var sliderInfo=getSliderInfo();return currentActive===sliderInfo.positions.length?void changeCurrent(1):void changeCurrent(currentActive+1)},delay),(0,_react.useEffect)(function(){return function(){autoAdjust&&clearTimeout(scrollEndTimer.current)}},[]),/*#__PURE__*/(0,_jsxRuntime.jsx)(CarouselContext.Provider,{value:{currentActive:currentActive,leftButtonRef:leftButtonRef,rightButtonRef:rightButtonRef,itemsHasNoOverflow:itemsHasNoOverflow,sliderRef:sliderRef,changeCurrent:changeCurrent,handleScroll:function(event){var _document$activeEleme,_document$activeEleme2;autoAdjust&&(lastScrollPosition.current=event.currentTarget.scrollLeft,setScrollEndTimer());var element=event.currentTarget,maxScroll=element.scrollWidth-element.clientWidth,isEndOfScroll=element.scrollLeft>=maxScroll;isMaxScroll.current=!1;var isActiveLeftButton=leftButtonRef.current!==(null===(_document$activeEleme=document.activeElement)||void 0===_document$activeEleme?void 0:_document$activeEleme.parentElement),isActiveRightButton=rightButtonRef.current!==(null===(_document$activeEleme2=document.activeElement)||void 0===_document$activeEleme2?void 0:_document$activeEleme2.parentElement);setItemsHasNoOverflow(!!isEndOfScroll),activeControlByScroll(),isEndOfScroll?(isMaxScroll.current=!0,setTimeout(function(){return hideRightButton(isActiveRightButton)},1e3)):setTimeout(function(){return hideRightButton(!1)},1e3),0===element.scrollLeft?hideLeftButton(isActiveLeftButton):hideLeftButton(!1)},handleMouseUp:function(event){var sliderInfo=getSliderInfo();isDragging.current=!1;var targets=event.currentTarget.childNodes;if(targets.forEach(function(item){item.style.userSelect="auto",item.style.pointerEvents="auto"}),sliderInfo.container){hideLeftButton(!1),beginMomentumTracking(),hideRightButton(isMaxScroll.current);var isStartOfScroll=0===sliderInfo.container.scrollLeft;hideLeftButton(isStartOfScroll)}},handleEnter:function(){setDelay(0)},handleMouseMove:function(e){var sliderInfo=getSliderInfo(),mousePosition=e.pageX-sliderInfo.container.offsetLeft,differenceBetweenInitialAndCurrentMousePosition=mousePosition-startX.current,shouldScroll=Math.abs(differenceBetweenInitialAndCurrentMousePosition)>_constants.MIN_OFFSET_TO_BEGIN_DRAG;if(isDragging.current&&shouldScroll){e.preventDefault();var targets=e.currentTarget.childNodes;if(targets.forEach(function(item){var node=item;node.style.pointerEvents="none",node.style.userSelect="none",node.draggable=!1}),sliderInfo.container){hideRightButton(!0),hideLeftButton(!0);var x=e.pageX-sliderInfo.container.offsetLeft,walk=x-startX.current,prevScrollLeft=sliderInfo.container.scrollLeft;sliderInfo.container.scrollLeft=initialScrollLeft.current-walk,velX=sliderInfo.container.scrollLeft-prevScrollLeft}}},handleWheel:function(){cancelMomentumTracking()},handleMouseDown:function(event){var sliderInfo=getSliderInfo();mousePositionWhenMouseDown.current=event.pageX,isDragging.current=!0,sliderInfo.container&&(startX.current=event.pageX-sliderInfo.container.offsetLeft,initialScrollLeft.current=sliderInfo.container.scrollLeft,cancelMomentumTracking())},moveCarousel:function(direction){var sliderInfo=getSliderInfo();if(sliderInfo.container){var nextPosition=currentActive+1;switch(hideRightButton(!1),hideLeftButton(!1),direction){case"left":changeCurrent(currentActive-1||1);break;case"right":changeCurrent(nextPosition),nextPosition===sliderInfo.positions.length&&hideRightButton(!0);break;default:throw new Error("Invalid direction");}}},handleMouseLeave:function(){isDragging.current=!1,setDelay(delayAutoExec),handleHideButtons()},beginMomentumTracking:beginMomentumTracking,hideLeftButton:hideLeftButton,hideRightButton:hideRightButton},children:children})}
|
|
6
|
+
var CarouselContext=/*#__PURE__*/(0,_react.createContext)({});exports.CarouselContext=CarouselContext;function CarouselProvider(_ref){function getSliderInfo(){var container=sliderRef.current;if(!container)return{container:null,positions:[]};var arrayOfChildren=Array.from(container.childNodes),positions=arrayOfChildren.map(function(data,index){return{offsetPosition:data.offsetLeft,offsetPositionPercent:data.offsetLeft-.3*data.offsetLeft,position:index+1}});return{container:container,positions:positions}}function navigateToScroll(scrollPosition){var sliderInfo=getSliderInfo();sliderInfo.container&&sliderInfo.container.scrollTo({behavior:"smooth",left:scrollPosition})}function hideRightButton(hide){rightButtonRef.current&&(hide?rightButtonRef.current.classList.add("hide"):rightButtonRef.current.classList.remove("hide"))}function hideLeftButton(hide){leftButtonRef.current&&(hide?leftButtonRef.current.classList.add("hide"):leftButtonRef.current.classList.remove("hide"))}function handleHideButtons(){var sliderInfo=getSliderInfo();if(sliderInfo.container){var maxScroll=sliderInfo.container.scrollWidth-sliderInfo.container.clientWidth,isEndOfScroll=sliderInfo.container.scrollLeft>=maxScroll;isMaxScroll.current=isEndOfScroll,hideRightButton(currentActive===sliderInfo.positions.length),hideLeftButton(0===sliderInfo.container.scrollLeft)}}function beginMomentumTracking(){cancelMomentumTracking(),momentumID=requestAnimationFrame(momentumLoop),delayAutoExec&&setDelay(delayAutoExec)}function cancelMomentumTracking(){cancelAnimationFrame(momentumID)}function onMomentumEnd(){if(autoAdjust){var sliderInfo=getSliderInfo();if(!sliderInfo.container)return;var scrollLeft=sliderInfo.container.scrollLeft,containerWidth=sliderInfo.container.offsetWidth,maxVisibleWidth=0,activeIndex=-1;sliderInfo.positions.forEach(function(position,index){var start=position.offsetPosition,end=index<sliderInfo.positions.length-1?sliderInfo.positions[index+1].offsetPosition:sliderInfo.container.scrollWidth,visibleWidth=Math.min(end,scrollLeft+containerWidth)-Math.max(start,scrollLeft);visibleWidth>maxVisibleWidth&&(maxVisibleWidth=visibleWidth,activeIndex=index)}),-1!==activeIndex&&changeCurrent(activeIndex+1)}handleHideButtons()}function checkForScrollEnd(){if(sliderRef.current){var currentScrollPosition=sliderRef.current.scrollLeft;currentScrollPosition===lastScrollPosition.current?onMomentumEnd():lastScrollPosition.current=currentScrollPosition}}function setScrollEndTimer(){clearTimeout(scrollEndTimer.current),scrollEndTimer.current=setTimeout(checkForScrollEnd,150)}function momentumLoop(){var sliderInfo=getSliderInfo();if(!sliderInfo.container)return null;sliderInfo.container.scrollLeft+=2*velX,velX*=.95;var disableMomentum=isMaxScroll.current||0===sliderInfo.container.scrollLeft;.75<Math.abs(velX)&&!disableMomentum?(hideLeftButton(!0),hideRightButton(!0),momentumID=requestAnimationFrame(momentumLoop)):onMomentumEnd()}function scrollByIndex(index){var position=getSliderInfo().positions.find(function(data){return data.position===index});position&&navigateToScroll(position.offsetPosition)}function changeCurrent(index){var sliderInfo=getSliderInfo();0>=index||index>sliderInfo.positions.length||scrollByIndex(index)}var momentumID,children=_ref.children,delayAutoExec=_ref.delayAutoExec,_ref$autoAlign=_ref.autoAlign,autoAdjust=void 0!==_ref$autoAlign&&_ref$autoAlign,isDragging=(0,_react.useRef)(!1),startX=(0,_react.useRef)(0),initialScrollLeft=(0,_react.useRef)(0),velX=0,mousePositionWhenMouseDown=(0,_react.useRef)(0),sliderRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(1),_useState2=_slicedToArray(_useState,2),currentActive=_useState2[0],setCurrentActive=_useState2[1],_useState3=(0,_react.useState)(!1),_useState4=_slicedToArray(_useState3,2),itemsHasNoOverflow=_useState4[0],setItemsHasNoOverflow=_useState4[1],_useState5=(0,_react.useState)(delayAutoExec),_useState6=_slicedToArray(_useState5,2),delay=_useState6[0],setDelay=_useState6[1],rightButtonRef=(0,_react.useRef)(null),leftButtonRef=(0,_react.useRef)(null),isMaxScroll=(0,_react.useRef)(!1),lastScrollPosition=(0,_react.useRef)(0),scrollEndTimer=(0,_react.useRef)(),activeControlByScroll=(0,_useDebounce.useDebounce)(function(){var sliderInfo=getSliderInfo();if(sliderInfo.container){var active=(0,_arrays.findLastIndex)(sliderInfo.positions,function(position){return position.offsetPosition<=sliderInfo.container.scrollLeft+20});setCurrentActive(active+1)}},100);return(0,_interval.useInterval)(function(){var sliderInfo=getSliderInfo();return currentActive===sliderInfo.positions.length?void changeCurrent(1):void changeCurrent(currentActive+1)},delay),(0,_react.useEffect)(function(){return function(){autoAdjust&&clearTimeout(scrollEndTimer.current)}},[]),/*#__PURE__*/(0,_jsxRuntime.jsx)(CarouselContext.Provider,{value:{currentActive:currentActive,leftButtonRef:leftButtonRef,rightButtonRef:rightButtonRef,itemsHasNoOverflow:itemsHasNoOverflow,sliderRef:sliderRef,changeCurrent:changeCurrent,handleScroll:function(event){var _document$activeEleme,_document$activeEleme2,sliderInfo=getSliderInfo();if(sliderInfo.container){autoAdjust&&(lastScrollPosition.current=event.currentTarget.scrollLeft,setScrollEndTimer());var element=event.currentTarget,maxScroll=element.scrollWidth-element.clientWidth,isEndOfScroll=element.scrollLeft>=maxScroll;isMaxScroll.current=!1;var isActiveLeftButton=leftButtonRef.current!==(null===(_document$activeEleme=document.activeElement)||void 0===_document$activeEleme?void 0:_document$activeEleme.parentElement),isActiveRightButton=rightButtonRef.current!==(null===(_document$activeEleme2=document.activeElement)||void 0===_document$activeEleme2?void 0:_document$activeEleme2.parentElement);setItemsHasNoOverflow(!!isEndOfScroll),activeControlByScroll(),isEndOfScroll?(isMaxScroll.current=!0,setTimeout(function(){return hideRightButton(isActiveRightButton)},1e3)):setTimeout(function(){return hideRightButton(!1)},1e3),0===element.scrollLeft?hideLeftButton(isActiveLeftButton):hideLeftButton(!1)}},handleMouseUp:function(event){var sliderInfo=getSliderInfo();if(sliderInfo.container){isDragging.current=!1;var targets=event.currentTarget.childNodes;targets.forEach(function(item){item.style.userSelect="auto",item.style.pointerEvents="auto"}),hideLeftButton(!1),beginMomentumTracking(),hideRightButton(isMaxScroll.current);var isStartOfScroll=0===sliderInfo.container.scrollLeft;hideLeftButton(isStartOfScroll)}},handleEnter:function(){setDelay(0)},handleMouseMove:function(e){var sliderInfo=getSliderInfo();if(sliderInfo.container){var mousePosition=e.pageX-sliderInfo.container.offsetLeft,differenceBetweenInitialAndCurrentMousePosition=mousePosition-startX.current,shouldScroll=Math.abs(differenceBetweenInitialAndCurrentMousePosition)>_constants.MIN_OFFSET_TO_BEGIN_DRAG;if(isDragging.current&&shouldScroll){e.preventDefault();var targets=e.currentTarget.childNodes;targets.forEach(function(item){var node=item;node.style.pointerEvents="none",node.style.userSelect="none",node.draggable=!1}),hideRightButton(!0),hideLeftButton(!0);var x=e.pageX-sliderInfo.container.offsetLeft,walk=x-startX.current,prevScrollLeft=sliderInfo.container.scrollLeft;sliderInfo.container.scrollLeft=initialScrollLeft.current-walk,velX=sliderInfo.container.scrollLeft-prevScrollLeft}}},handleWheel:function(){cancelMomentumTracking()},handleMouseDown:function(event){var sliderInfo=getSliderInfo();sliderInfo.container&&(mousePositionWhenMouseDown.current=event.pageX,isDragging.current=!0,startX.current=event.pageX-sliderInfo.container.offsetLeft,initialScrollLeft.current=sliderInfo.container.scrollLeft,cancelMomentumTracking())},moveCarousel:function(direction){var sliderInfo=getSliderInfo();if(sliderInfo.container){var nextPosition=currentActive+1;switch(hideRightButton(!1),hideLeftButton(!1),direction){case"left":changeCurrent(currentActive-1||1);break;case"right":changeCurrent(nextPosition),nextPosition===sliderInfo.positions.length&&hideRightButton(!0);break;default:throw new Error("Invalid direction");}}},handleMouseLeave:function(){isDragging.current=!1,setDelay(delayAutoExec),handleHideButtons()},beginMomentumTracking:beginMomentumTracking,hideLeftButton:hideLeftButton,hideRightButton:hideRightButton},children:children})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LegendText=exports.Legend=exports.InputLabel=exports.InputIcon=exports.InputGroupElement=exports.InputContentRow=exports.InputContent=exports.InputColumn=exports.Input=exports.HelperText=exports.Fieldset=exports.AddonElement=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_styled=_interopRequireDefault(require("@emotion/styled")),_react=require("@emotion/react"),_invertColor=require("../../utils//invertColor");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var InputGroupElement=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n width: 100%;\n border-radius: ",";\n font-weight: ",";\n transition: all 0.2s ease-in-out;\n\n &:hover fieldset {\n border-color: ",";\n }\n\n &:hover > div > div:first-of-type {\n border-color: ",";\n &:hover label {\n color: ",";\n }\n }\n\n &:focus-within > div > div:first-of-type {\n background: ",";\n border-color: ",";\n }\n\n > div > div:first-of-type span {\n color: ",";\n }\n\n &:focus-within {\n border-radius: 2px solid ",";\n }\n &:focus-within label {\n color: ",";\n }\n\n &:focus-within > div {\n box-shadow: 0 0 0 2px\n ",";\n }\n\n &:focus-within label {\n transform: translate(19px, -11px) scale(0.8);\n\n background-color: ",";\n\n height: 20px;\n }\n\n &:focus-within fieldset {\n border-width: 2px;\n border-color: ",";\n }\n\n ","\n\n & label {\n transform: ",";\n height: ",";\n background: ",";\n }\n"])),function(props){return props.theme.borderRadius.default},function(props){return props.theme.fontWeight[400]},function(_ref){var theme=_ref.theme,alert=_ref.alert,hasDisabled=_ref.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref2){var theme=_ref2.theme,alert=_ref2.alert,hasDisabled=_ref2.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref3){var theme=_ref3.theme,hasDisabled=_ref3.hasDisabled;return!hasDisabled&&theme.colors.neutral.neutral5},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.disabled},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.hover},function(props){return props.alert?(0,_invertColor.invertColor)(props.theme.colors[props.alert].default,!0):props.theme.colors.neutral.black},function(props){return props.theme.colors.primary.disabled},function(_ref4){var theme=_ref4.theme;return theme.colors.neutral.neutral5},function(props){return props.alert?"".concat(props.theme.colors[props.alert].blurred,"33"):props.theme.colors.primary.disabled},function(_ref5){var theme=_ref5.theme;return theme.colors.neutral.white},function(props){return!props.alert&&props.theme.colors.primary.hover},function(props){return props.addonContent&&(0,_react.css)(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n &:focus-within > div > div:first-of-type {\n border-color: ",";\n background-color: ",";\n }\n "])),props.alert?"transparent":props.theme.colors.primary.focus,props.alert&&"success"===props.alert?props.theme.colors.primary.focus:"")},function(_ref6){var hasValueOnInput=_ref6.hasValueOnInput,withIcon=_ref6.withIcon;return hasValueOnInput?"translate(19px, -11px) scale(0.8) !important":withIcon?"translate(60px, calc(100% - 10px))":"translate(20px, calc(100% - 10px))"},function(_ref7){var hasValueOnInput=_ref7.hasValueOnInput;return hasValueOnInput?"20px":"unset"},function(_ref8){var hasValueOnInput=_ref8.hasValueOnInput,theme=_ref8.theme;return hasValueOnInput?theme.colors.neutral.white:"transparent"});exports.InputGroupElement=InputGroupElement;var InputColumn=_styled.default.div(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n position: relative;\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n align-items: center;\n border-radius: ",";\n width: 100%;\n min-height: 56px;\n"])),function(props){return props.theme.borderRadius.default});exports.InputColumn=InputColumn;var InputContent=_styled.default.div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n width: 100%;\n position: relative;\n grid-column: ",";\n height: 100%;\n"])),function(props){return props.withAddon?"2 / end":"1 / end"});exports.InputContent=InputContent;var InputContentRow=_styled.default.div(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n height: 100%;\n"])));exports.InputContentRow=InputContentRow;var InputIcon=_styled.default.div(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n position: relative;\n z-index: ",";\n display: flex;\n margin: auto;\n padding: 0 20px;\n align-items: center;\n justify-content: center;\n cursor: ",";\n color: ",";\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.clickable?"pointer":"default"},function(props){return props.theme.colors.neutral.neutral5});exports.InputIcon=InputIcon;function inputPadding(props){var leftIcon=props.leftIcon,withIcon=props.withIcon;return leftIcon||withIcon?"0 0":"0 20px"}var Input=_styled.default.input(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n width: 100%;\n padding: ",";\n flex: 1;\n height: 100%;\n border: none;\n color: ",";\n &:disabled {\n color: ",";\n }\n\n &::placeholder {\n color: ",";\n }\n\n font-family: inherit;\n outline: none;\n font-size: ",";\n background-color: transparent;\n position: relative;\n font-weight: 500;\n\n &:-webkit-autofill {\n height: calc(100% - 4px);\n margin-right: 2px;\n border-top-right-radius: 0.35rem;\n border-bottom-right-radius: 0.35rem;\n -webkit-box-shadow: 0 0 0 100px "," inset;\n -webkit-text-fill-color: ",";\n }\n"])),inputPadding,function(props){return props.theme.colors.neutral.black},function(_ref9){var theme=_ref9.theme;return theme.colors.neutral.neutral5},function(_ref10){var theme=_ref10.theme;return theme.colors.neutral.neutral5},function(props){return props.theme.fontSizes.xs},function(_ref11){var theme=_ref11.theme;return theme.colorByTheme("#f8faf9","#465953")},function(_ref12){var theme=_ref12.theme;return theme.colors.neutral.black});exports.Input=Input;var InputLabel=_styled.default.label(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n top: 0;\n left: 0;\n height: auto;\n padding: 0 6px;\n position: absolute;\n z-index: ",";\n pointer-events: none;\n color: ",";\n background-color: transparent;\n transform-origin: left;\n transition: all ease 0.2s;\n font-weight: 500;\n\n white-space: nowrap;\n max-width: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.theme.colors.neutral.neutral3},function(_ref13){var withIcon=_ref13.withIcon;return withIcon?"65%":"85%"});exports.InputLabel=InputLabel;var Fieldset=_styled.default.fieldset(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n top: 0;\n pointer-events: none;\n padding: 0 17px;\n overflow: hidden;\n\n background-color: ",";\n\n border-radius: ",";\n border: 2px solid\n ",";\n border-left: ",";\n\n transition: all 0.2s ease;\n"])),function(_ref14){var alert=_ref14.alert,theme=_ref14.theme,hasDisabled=_ref14.hasDisabled;return alert&&!hasDisabled?"".concat(theme.colors[alert].blurred,"33"):hasDisabled?theme.colors.neutral.neutral1:"transparent"},function(props){return props.withAddon?"0 ".concat(props.theme.borderRadius.default," ").concat(props.theme.borderRadius.default," 0"):props.theme.borderRadius.default},function(_ref15){var theme=_ref15.theme,hasDisabled=_ref15.hasDisabled,alert=_ref15.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.withAddon?"none !important":"auto"});exports.Fieldset=Fieldset;var Legend=_styled.default.legend(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n padding: 0;\n width: auto;\n max-width: 0.01px;\n font-size: 14px;\n height: 0px;\n visibility: hidden;\n transition: all 0.1s;\n"])));exports.Legend=Legend;var LegendText=_styled.default.span(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n padding: 0 2px;\n display: inline-block;\n visibility: hidden;\n"])));exports.LegendText=LegendText;var HelperText=_styled.default.span(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n font-size: ",";\n\n color: ",";\n padding: 0 20px;\n"])),function(props){return props.theme.fontSizes.xxs},function(props){return props.alert&&"success"!==props.alert?props.theme.colors[props.alert].default:props.theme.colors.neutral.neutral4});exports.HelperText=HelperText;var AddonElement=_styled.default.div(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n padding: 0 20px;\n height: 100%;\n\n background-color: ",";\n\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n border: 2px solid\n ",";\n border-right: none;\n\n border-radius: "," 0 0\n ",";\n"])),function(props){return props.alert&&!props.hasDisabled?props.theme.colors[props.alert].default:props.hasDisabled?props.theme.colors.neutral.neutral2:props.theme.colors.neutral.neutral1},function(_ref16){var theme=_ref16.theme,hasDisabled=_ref16.hasDisabled,alert=_ref16.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.theme.borderRadius.default},function(props){return props.theme.borderRadius.default});exports.AddonElement=AddonElement;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LegendText=exports.Legend=exports.InputLabel=exports.InputIcon=exports.InputGroupElement=exports.InputContentRow=exports.InputContent=exports.InputColumn=exports.Input=exports.HelperText=exports.Fieldset=exports.AddonElement=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_styled=_interopRequireDefault(require("@emotion/styled")),_react=require("@emotion/react"),_invertColor=require("../../utils//invertColor");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var InputGroupElement=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n width: 100%;\n border-radius: ",";\n font-weight: ",";\n transition: all 0.2s ease-in-out;\n\n &:hover fieldset {\n border-color: ",";\n }\n\n &:hover > div > div:first-of-type {\n border-color: ",";\n &:hover label {\n color: ",";\n }\n }\n\n &:focus-within > div > div:first-of-type {\n background: ",";\n border-color: ",";\n }\n\n > div > div:first-of-type span {\n color: ",";\n }\n\n &:focus-within {\n border-radius: 2px solid ",";\n }\n &:focus-within label {\n color: ",";\n }\n\n &:focus-within > div {\n box-shadow: 0 0 0 2px\n ",";\n }\n\n &:focus-within label {\n transform: translate(19px, -11px) scale(0.8);\n\n background-color: ",";\n\n height: 20px;\n }\n\n &:focus-within fieldset {\n border-width: 2px;\n border-color: ",";\n }\n\n ","\n\n & label {\n transform: ",";\n height: ",";\n background: ",";\n }\n"])),function(props){return props.theme.borderRadius.default},function(props){return props.theme.fontWeight[400]},function(_ref){var theme=_ref.theme,alert=_ref.alert,hasDisabled=_ref.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref2){var theme=_ref2.theme,alert=_ref2.alert,hasDisabled=_ref2.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref3){var theme=_ref3.theme,hasDisabled=_ref3.hasDisabled;return!hasDisabled&&theme.colors.neutral.neutral5},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.disabled},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.hover},function(props){return props.alert?(0,_invertColor.invertColor)(props.theme.colors[props.alert].default,!0):props.theme.colors.neutral.black},function(props){return props.theme.colors.primary.disabled},function(_ref4){var theme=_ref4.theme;return theme.colors.neutral.neutral5},function(props){return props.alert?"".concat(props.theme.colors[props.alert].blurred,"33"):props.theme.colors.primary.disabled},function(_ref5){var theme=_ref5.theme;return theme.colors.neutral.white},function(props){return!props.alert&&props.theme.colors.primary.hover},function(props){return props.addonContent&&(0,_react.css)(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n &:focus-within > div > div:first-of-type {\n border-color: ",";\n background-color: ",";\n }\n "])),props.alert?"transparent":props.theme.colors.primary.focus,props.alert&&"success"===props.alert?props.theme.colors.primary.focus:"")},function(_ref6){var hasValueOnInput=_ref6.hasValueOnInput,withIcon=_ref6.withIcon;return hasValueOnInput?"translate(19px, -11px) scale(0.8) !important":withIcon?"translate(60px, calc(100% - 10px))":"translate(20px, calc(100% - 10px))"},function(_ref7){var hasValueOnInput=_ref7.hasValueOnInput;return hasValueOnInput?"20px":"unset"},function(_ref8){var hasValueOnInput=_ref8.hasValueOnInput,theme=_ref8.theme;return hasValueOnInput?theme.colors.neutral.white:"transparent"});exports.InputGroupElement=InputGroupElement;var InputColumn=_styled.default.div(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n position: relative;\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n align-items: center;\n border-radius: ",";\n width: 100%;\n min-height: 56px;\n"])),function(props){return props.theme.borderRadius.default});exports.InputColumn=InputColumn;var InputContent=_styled.default.div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n width: 100%;\n position: relative;\n grid-column: ",";\n height: 100%;\n"])),function(props){return props.withAddon?"2 / end":"1 / end"});exports.InputContent=InputContent;var InputContentRow=_styled.default.div(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n height: 100%;\n"])));exports.InputContentRow=InputContentRow;var InputIcon=_styled.default.div(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n position: relative;\n z-index: ",";\n display: flex;\n margin: auto;\n padding: 0 20px;\n align-items: center;\n justify-content: center;\n cursor: ",";\n color: ",";\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.clickable?"pointer":"default"},function(props){return props.theme.colors.neutral.neutral5});exports.InputIcon=InputIcon;function inputPadding(props){var leftIcon=props.leftIcon,withIcon=props.withIcon;return leftIcon||withIcon?"0 0":"0 20px"}var Input=_styled.default.input(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n width: 100%;\n padding: ",";\n flex: 1;\n height: 100%;\n border: none;\n color: ",";\n &:disabled {\n color: ",";\n }\n\n &::placeholder {\n color: ",";\n }\n\n font-family: inherit;\n outline: none;\n font-size: ",";\n background-color: transparent;\n position: relative;\n font-weight: 500;\n\n &:-webkit-autofill {\n height: calc(100% - 4px);\n margin-right: 2px;\n border-top-right-radius: 0.35rem;\n border-bottom-right-radius: 0.35rem;\n -webkit-box-shadow: 0 0 0 100px "," inset;\n -webkit-text-fill-color: ",";\n }\n"])),inputPadding,function(props){return props.theme.colors.neutral.black},function(_ref9){var theme=_ref9.theme;return theme.colors.neutral.neutral5},function(_ref10){var theme=_ref10.theme;return theme.colors.neutral.neutral4},function(props){return props.theme.fontSizes.xs},function(_ref11){var theme=_ref11.theme;return theme.colorByTheme("#f8faf9","#465953")},function(_ref12){var theme=_ref12.theme;return theme.colors.neutral.black});exports.Input=Input;var InputLabel=_styled.default.label(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n top: 0;\n left: 0;\n height: auto;\n padding: 0 6px;\n position: absolute;\n z-index: ",";\n pointer-events: none;\n color: ",";\n background-color: transparent;\n transform-origin: left;\n transition: all ease 0.2s;\n font-weight: 500;\n\n white-space: nowrap;\n max-width: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.theme.colors.neutral.neutral3},function(_ref13){var withIcon=_ref13.withIcon;return withIcon?"65%":"85%"});exports.InputLabel=InputLabel;var Fieldset=_styled.default.fieldset(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n top: 0;\n pointer-events: none;\n padding: 0 17px;\n overflow: hidden;\n\n background-color: ",";\n\n border-radius: ",";\n border: 2px solid\n ",";\n border-left: ",";\n\n transition: all 0.2s ease;\n"])),function(_ref14){var alert=_ref14.alert,theme=_ref14.theme,hasDisabled=_ref14.hasDisabled;return alert&&!hasDisabled?"".concat(theme.colors[alert].blurred,"33"):hasDisabled?theme.colors.neutral.neutral1:"transparent"},function(props){return props.withAddon?"0 ".concat(props.theme.borderRadius.default," ").concat(props.theme.borderRadius.default," 0"):props.theme.borderRadius.default},function(_ref15){var theme=_ref15.theme,hasDisabled=_ref15.hasDisabled,alert=_ref15.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.withAddon?"none !important":"auto"});exports.Fieldset=Fieldset;var Legend=_styled.default.legend(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n padding: 0;\n width: auto;\n max-width: 0.01px;\n font-size: 14px;\n height: 0px;\n visibility: hidden;\n transition: all 0.1s;\n"])));exports.Legend=Legend;var LegendText=_styled.default.span(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n padding: 0 2px;\n display: inline-block;\n visibility: hidden;\n"])));exports.LegendText=LegendText;var HelperText=_styled.default.span(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n font-size: ",";\n\n color: ",";\n padding: 0 20px;\n"])),function(props){return props.theme.fontSizes.xxs},function(props){return props.alert&&"success"!==props.alert?props.theme.colors[props.alert].default:props.theme.colors.neutral.neutral4});exports.HelperText=HelperText;var AddonElement=_styled.default.div(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n padding: 0 20px;\n height: 100%;\n\n background-color: ",";\n\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n border: 2px solid\n ",";\n border-right: none;\n\n border-radius: "," 0 0\n ",";\n"])),function(props){return props.alert&&!props.hasDisabled?props.theme.colors[props.alert].default:props.hasDisabled?props.theme.colors.neutral.neutral2:props.theme.colors.neutral.neutral1},function(_ref16){var theme=_ref16.theme,hasDisabled=_ref16.hasDisabled,alert=_ref16.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.theme.borderRadius.default},function(props){return props.theme.borderRadius.default});exports.AddonElement=AddonElement;
|