@razorpay/blade 11.8.0 → 11.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +2 -2
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js +7 -2
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/getStyledBaseButtonStyles.js +1 -1
- package/build/lib/native/components/Button/BaseButton/getStyledBaseButtonStyles.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +11 -5
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +11 -31
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/getStyledBaseButtonStyles.js +6 -2
- package/build/lib/web/development/components/Button/BaseButton/getStyledBaseButtonStyles.js.map +1 -1
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js +7 -13
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js +3 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +11 -5
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +11 -31
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/getStyledBaseButtonStyles.js +6 -2
- package/build/lib/web/production/components/Button/BaseButton/getStyledBaseButtonStyles.js.map +1 -1
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js +7 -13
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js +3 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import styled from 'styled-components/native';
|
|
5
5
|
import StyledBaseButton from './StyledBaseButton.native.js';
|
|
6
|
-
import { typography, buttonIconOnlySizeToIconSizeMap, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight,
|
|
6
|
+
import { typography, buttonIconOnlySizeToIconSizeMap, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight, buttonIconOnlyHeightWidth, buttonIconPadding, buttonPadding, backgroundColor, textColor } from './buttonTokens.js';
|
|
7
7
|
import AnimatedButtonContent from './AnimatedButtonContent.native.js';
|
|
8
8
|
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
9
9
|
import 'react-native';
|
|
@@ -32,7 +32,7 @@ import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.native
|
|
|
32
32
|
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
33
33
|
import { getStringFromReactText } from '../../../utils/getStringChildren/getStringChildren.js';
|
|
34
34
|
|
|
35
|
-
var _excluded=["href","target","rel","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,children=_ref3.children,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!children||(children==null?void 0:children.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),iconPadding:hasIcon&&children!=null&&children.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(theme.spacing[buttonIconOnlyPadding[size].top]):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(theme.spacing[buttonIconOnlyPadding[size].bottom]):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(theme.spacing[buttonIconOnlyPadding[size].left]):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(theme.spacing[buttonIconOnlyPadding[size].right]):makeSpace(theme.spacing[buttonPadding[size].right]),text:size==='xsmall'?children==null?void 0:children.trim().toUpperCase():children==null?void 0:children.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,children:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRel=target==='_blank'?'noreferrer noopener':undefined;var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,as:renderElement,href:href,target:target,rel:rel!=null?rel:defaultRel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({role:isLink?'link':'button'},accessibilityProps))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,onMouseDown:handlePointerPressedIn,onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
|
|
35
|
+
var _excluded=["href","target","rel","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,children=_ref3.children,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!children||(children==null?void 0:children.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),height:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,width:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,iconPadding:hasIcon&&children!=null&&children.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].right]),text:size==='xsmall'?children==null?void 0:children.trim().toUpperCase():children==null?void 0:children.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,children:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,height=_getProps.height,width=_getProps.width,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRel=target==='_blank'?'noreferrer noopener':undefined;var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,as:renderElement,href:href,target:target,rel:rel!=null?rel:defaultRel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({role:isLink?'link':'button'},accessibilityProps))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,height:height,width:width,isPressed:isPressed,onMouseDown:handlePointerPressedIn,onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
|
|
36
36
|
|
|
37
37
|
export { BaseButton as default, getBackgroundColorToken };
|
|
38
38
|
//# sourceMappingURL=BaseButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.js","sources":["../../../../../../src/components/Button/BaseButton/BaseButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseButton from './StyledBaseButton';\nimport type { ButtonTypography, ButtonMinHeight } from './buttonTokens';\nimport {\n textColor,\n backgroundColor,\n buttonIconOnlyPadding,\n buttonIconOnlySizeToIconSizeMap,\n typography as buttonTypography,\n minHeight as buttonMinHeight,\n buttonSizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n} from './buttonTokens';\nimport AnimatedButtonContent from './AnimatedButtonContent';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BaseLinkProps } from '~components/Link/BaseLink';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconComponent, IconProps, IconSize } from '~components/Icons';\nimport type { DurationString, EasingString } from '~tokens/global';\nimport type { BorderRadiusValues, BorderWidthValues, SpacingValues } from '~tokens/theme/theme';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useButtonGroupContext } from '~components/ButtonGroup/ButtonGroupContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTheme } from '~components/BladeProvider';\nimport { announce } from '~components/LiveAnnouncer';\nimport type { BaseSpinnerProps } from '~components/Spinner/BaseSpinner';\nimport { BaseSpinner } from '~components/Spinner/BaseSpinner';\nimport BaseBox from '~components/Box/BaseBox';\nimport type {\n BladeElementRef,\n DotNotationSpacingStringToken,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { usePrevious } from '~utils/usePrevious';\nimport { makeSize } from '~utils/makeSize';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeSpace } from '~utils/makeSpace';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { BladeCommonEvents } from '~components/types';\nimport { throwBladeError } from '~utils/logger';\n\ntype BaseButtonCommonProps = {\n href?: BaseLinkProps['href'];\n target?: BaseLinkProps['target'];\n rel?: BaseLinkProps['rel'];\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n isFullWidth?: boolean;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n onClick?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n type?: 'button' | 'reset' | 'submit';\n isLoading?: boolean;\n accessibilityProps?: Partial<AccessibilityProps>;\n variant?: 'primary' | 'secondary' | 'tertiary';\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents;\n\n/*\nMandatory children prop when icon is not provided\n*/\ntype BaseButtonWithoutIconProps = BaseButtonCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseButtonWithIconProps = BaseButtonCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n With or without icon prop. We need at least an icon or a children prop present.\n*/\nexport type BaseButtonProps = BaseButtonWithIconProps | BaseButtonWithoutIconProps;\n\ntype BaseButtonColorTokenModifiers = {\n variant: NonNullable<BaseButtonProps['variant']>;\n state: 'default' | 'hover' | 'focus' | 'disabled';\n color: BaseButtonProps['color'];\n};\n\n/**\n * All possible icon colors, derived from `IconProps` minus `currentColor` because possible values should only be from tokens\n */\ntype IconColor = Exclude<IconProps['color'], 'currentColor'>;\n\nconst getRenderElement = (href?: string): 'a' | 'button' | undefined => {\n if (isReactNative()) {\n return undefined; // as property doesn't work with react native\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n};\n\nexport const getBackgroundColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'background' | 'border';\n}): DotNotationToken<Theme['colors']> => {\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n const tokens = backgroundColor(property);\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nconst getTextColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'icon' | 'text';\n}): DotNotationToken<Theme['colors']> => {\n const tokens = textColor(property);\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\ntype BaseButtonStyleProps = {\n iconSize: IconSize;\n spinnerSize: BaseSpinnerProps['size'];\n fontSize: keyof Theme['typography']['fonts']['size'];\n lineHeight: keyof Theme['typography']['lineHeights'];\n minHeight: `${ButtonMinHeight}px`;\n iconPadding?: DotNotationSpacingStringToken;\n iconColor: IconColor;\n textColor: BaseTextProps['color'];\n buttonPaddingTop: SpacingValues;\n buttonPaddingBottom: SpacingValues;\n buttonPaddingLeft: SpacingValues;\n buttonPaddingRight: SpacingValues;\n text?: string;\n defaultBackgroundColor: string;\n defaultBorderColor: string;\n hoverBackgroundColor: string;\n hoverBorderColor: string;\n focusBackgroundColor: string;\n focusBorderColor: string;\n focusRingColor: string;\n motionDuration: DurationString;\n motionEasing: EasingString;\n borderWidth: BorderWidthValues;\n borderRadius: BorderRadiusValues;\n};\n\nconst getProps = ({\n buttonTypographyTokens,\n children,\n isDisabled,\n size,\n theme,\n variant,\n color,\n hasIcon,\n}: {\n buttonTypographyTokens: ButtonTypography;\n children?: string;\n isDisabled: boolean;\n hasIcon: boolean;\n theme: Theme;\n size: NonNullable<BaseButtonProps['size']>;\n variant: NonNullable<BaseButtonProps['variant']>;\n color: BaseButtonProps['color'];\n}): BaseButtonStyleProps => {\n if (variant === 'tertiary' && color !== 'primary' && color !== 'white') {\n throwBladeError({\n moduleName: 'BaseButton',\n message: `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n });\n }\n\n const isIconOnly = hasIcon && (!children || children?.trim().length === 0);\n const props: BaseButtonStyleProps = {\n iconSize: isIconOnly ? buttonIconOnlySizeToIconSizeMap[size] : buttonSizeToIconSizeMap[size],\n spinnerSize: buttonSizeToSpinnerSizeMap[size],\n fontSize: buttonTypographyTokens.fonts.size[size],\n lineHeight: buttonTypographyTokens.lineHeights[size],\n minHeight: makeSize(buttonMinHeight[size]),\n iconPadding: hasIcon && children?.trim() ? `spacing.${buttonIconPadding[size]}` : undefined,\n iconColor: getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'default',\n }) as IconColor,\n textColor: getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'default',\n }) as BaseTextProps['color'],\n buttonPaddingTop: isIconOnly\n ? makeSpace(theme.spacing[buttonIconOnlyPadding[size].top])\n : makeSpace(theme.spacing[buttonPadding[size].top]),\n buttonPaddingBottom: isIconOnly\n ? makeSpace(theme.spacing[buttonIconOnlyPadding[size].bottom])\n : makeSpace(theme.spacing[buttonPadding[size].bottom]),\n buttonPaddingLeft: isIconOnly\n ? makeSpace(theme.spacing[buttonIconOnlyPadding[size].left])\n : makeSpace(theme.spacing[buttonPadding[size].left]),\n buttonPaddingRight: isIconOnly\n ? makeSpace(theme.spacing[buttonIconOnlyPadding[size].right])\n : makeSpace(theme.spacing[buttonPadding[size].right]),\n text: size === 'xsmall' ? children?.trim().toUpperCase() : children?.trim(),\n defaultBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'default' }),\n ),\n defaultBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'default' }),\n ),\n hoverBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'hover' }),\n ),\n hoverBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'hover' }),\n ),\n focusBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'focus' }),\n ),\n focusBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'focus' }),\n ),\n focusRingColor: getIn(theme.colors, 'surface.border.primary.muted'),\n borderWidth: variant == 'secondary' ? makeBorderSize(theme.border.width.thin) : '0px',\n borderRadius: makeBorderSize(theme.border.radius.medium),\n motionDuration: 'duration.xquick',\n motionEasing: 'easing.standard.effective',\n };\n\n if (isDisabled) {\n const disabledBackgroundColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'disabled' }),\n );\n const disabledBorderColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'disabled' }),\n );\n props.iconColor = getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'disabled',\n }) as IconColor;\n props.textColor = getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'disabled',\n }) as BaseTextProps['color'];\n props.defaultBackgroundColor = disabledBackgroundColor;\n props.defaultBorderColor = disabledBorderColor;\n props.hoverBackgroundColor = disabledBackgroundColor;\n props.hoverBorderColor = disabledBorderColor;\n props.focusBackgroundColor = disabledBackgroundColor;\n props.focusBorderColor = disabledBorderColor;\n }\n\n return props;\n};\n\nconst ButtonContent = styled(BaseBox)<{ isHidden: boolean }>(({ isHidden }) => ({\n opacity: isHidden ? 0 : 1,\n}));\n\nconst _BaseButton: React.ForwardRefRenderFunction<BladeElementRef, BaseButtonProps> = (\n {\n href,\n target,\n rel,\n variant = 'primary',\n color = 'primary',\n size = 'medium',\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n type = 'button',\n children,\n testID,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n accessibilityProps,\n onTouchEnd,\n onTouchStart,\n ...rest\n },\n ref,\n) => {\n const { theme } = useTheme();\n const buttonGroupProps = useButtonGroupContext();\n const [isPressed, setIsPressed] = React.useState(false);\n const isLink = Boolean(href);\n const childrenString = getStringFromReactText(children);\n // Button cannot be disabled when its rendered as Link\n const disabled = buttonGroupProps.isDisabled ?? (isLoading || (isDisabled && !isLink));\n\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: 'At least one of icon or text is required to render a button.',\n moduleName: 'BaseButton',\n });\n }\n }\n\n const prevLoading = usePrevious(isLoading);\n\n React.useEffect(() => {\n if (isLoading) announce('Started loading');\n\n if (!isLoading && prevLoading) announce('Stopped loading');\n }, [isLoading, prevLoading]);\n\n const {\n defaultBorderColor,\n defaultBackgroundColor,\n minHeight,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n focusBorderColor,\n focusBackgroundColor,\n focusRingColor,\n fontSize,\n hoverBorderColor,\n hoverBackgroundColor,\n iconColor,\n iconSize,\n iconPadding,\n spinnerSize,\n lineHeight,\n text,\n textColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n } = getProps({\n buttonTypographyTokens: buttonTypography,\n children: childrenString,\n isDisabled: disabled,\n size: buttonGroupProps.size ?? size,\n variant: buttonGroupProps.variant ?? variant,\n theme,\n color: buttonGroupProps.color ?? color,\n hasIcon: Boolean(Icon),\n });\n\n const renderElement = React.useMemo(() => getRenderElement(href), [href]);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n\n const handlePointerPressedIn = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(true);\n }, [disabled]);\n\n const handlePointerPressedOut = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(false);\n }, [disabled]);\n\n const handleKeyboardPressedIn = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(true);\n }\n },\n [disabled],\n );\n\n const handleKeyboardPressedOut = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(false);\n }\n },\n [disabled],\n );\n\n return (\n <StyledBaseButton\n ref={ref as any}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: On React Native it will always be undefined but TS doesn't understand that\n as={renderElement}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n role: isLink ? 'link' : 'button',\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n isLoading={isLoading}\n disabled={disabled}\n defaultBorderColor={defaultBorderColor}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n defaultBackgroundColor={defaultBackgroundColor}\n focusBorderColor={focusBorderColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n isFullWidth={buttonGroupProps.isFullWidth ?? isFullWidth}\n onClick={onClick}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n // Setting type for web fails it on native typecheck and vice versa\n onKeyDown={(event: any) => {\n handleKeyboardPressedIn(event);\n onKeyDown?.(event);\n }}\n onTouchStart={(event: React.TouchEvent) => {\n handlePointerPressedIn();\n onTouchStart?.(event);\n }}\n onTouchEnd={(event: React.TouchEvent) => {\n handlePointerPressedOut();\n onTouchEnd?.(event);\n }}\n type={type}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n isPressed={isPressed}\n onMouseDown={handlePointerPressedIn}\n onMouseUp={handlePointerPressedOut}\n onMouseOut={handlePointerPressedOut}\n onKeyUp={handleKeyboardPressedOut}\n {...metaAttribute({ name: MetaConstants.Button, testID })}\n {...getStyledProps(rest)}\n >\n <AnimatedButtonContent\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n isPressed={isPressed}\n >\n {isLoading ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n position=\"absolute\"\n top=\"0px\"\n left=\"0px\"\n bottom=\"0px\"\n right=\"0px\"\n zIndex={1}\n >\n <BaseSpinner accessibilityLabel=\"Loading\" size={spinnerSize} color={color} />\n </BaseBox>\n ) : null}\n <ButtonContent\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flex={1}\n isHidden={isLoading}\n zIndex={1}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox\n paddingRight={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n {text ? (\n <BaseText\n lineHeight={lineHeight}\n fontSize={fontSize}\n // figma and web have different font-smoothing properties\n // which causes web version of button text to look much bolder\n // than figma version. To fix this we are changing font-weight from 600 to 500\n // https://forum.figma.com/t/why-does-a-font-weight-in-figma-seem-lighter-than-the-same-weight-in-the-browser/2207\n fontWeight=\"medium\"\n textAlign=\"center\"\n color={textColor}\n >\n {text}\n </BaseText>\n ) : null}\n {Icon && iconPosition == 'right' ? (\n <BaseBox\n paddingLeft={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n </ButtonContent>\n </AnimatedButtonContent>\n </StyledBaseButton>\n );\n};\n\nconst BaseButton = assignWithoutSideEffects(React.forwardRef(_BaseButton), {\n displayName: 'BaseButton',\n});\n\nexport default BaseButton;\n"],"names":["getRenderElement","href","isReactNative","undefined","getBackgroundColorToken","_ref","property","variant","state","color","_state","tokens","backgroundColor","white","Error","base","getTextColorToken","_ref2","textColor","getProps","_ref3","buttonTypographyTokens","children","isDisabled","size","theme","hasIcon","throwBladeError","moduleName","message","isIconOnly","trim","length","props","iconSize","buttonIconOnlySizeToIconSizeMap","buttonSizeToIconSizeMap","spinnerSize","buttonSizeToSpinnerSizeMap","fontSize","fonts","lineHeight","lineHeights","minHeight","makeSize","buttonMinHeight","iconPadding","buttonIconPadding","iconColor","buttonPaddingTop","makeSpace","spacing","buttonIconOnlyPadding","top","buttonPadding","buttonPaddingBottom","bottom","buttonPaddingLeft","left","buttonPaddingRight","right","text","toUpperCase","defaultBackgroundColor","getIn","colors","defaultBorderColor","hoverBackgroundColor","hoverBorderColor","focusBackgroundColor","focusBorderColor","focusRingColor","borderWidth","makeBorderSize","border","width","thin","borderRadius","radius","medium","motionDuration","motionEasing","disabledBackgroundColor","disabledBorderColor","ButtonContent","styled","BaseBox","_ref4","isHidden","opacity","_BaseButton","_ref5","ref","_buttonGroupProps$isD","_buttonGroupProps$siz","_buttonGroupProps$var","_buttonGroupProps$col","_buttonGroupProps$isF","target","rel","_ref5$variant","_ref5$color","_ref5$size","Icon","icon","_ref5$iconPosition","iconPosition","_ref5$isDisabled","_ref5$isFullWidth","isFullWidth","_ref5$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref5$type","type","testID","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","buttonGroupProps","useButtonGroupContext","_React$useState","React","useState","_React$useState2","_slicedToArray","isPressed","setIsPressed","isLink","Boolean","childrenString","getStringFromReactText","disabled","__DEV__","prevLoading","usePrevious","useEffect","announce","_getProps","buttonTypography","renderElement","useMemo","defaultRel","handlePointerPressedIn","useCallback","handlePointerPressedOut","handleKeyboardPressedIn","e","key","handleKeyboardPressedOut","_jsx","StyledBaseButton","Object","assign","as","makeAccessible","role","event","onMouseDown","onMouseUp","onMouseOut","onKeyUp","metaAttribute","name","MetaConstants","Button","getStyledProps","_jsxs","AnimatedButtonContent","display","justifyContent","alignItems","position","zIndex","BaseSpinner","accessibilityLabel","flexDirection","flex","paddingRight","BaseText","fontWeight","textAlign","paddingLeft","BaseButton","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,QAAA,CAAA,KAAA,CAAA,SAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,YAAA,CAAA,aAAA,CAAA,WAAA,CAAA,SAAA,CAAA,QAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,SAAA,CAAA,cAAA,CAAA,aAAA,CAAA,eAAA,CAAA,gBAAA,CAAA,oBAAA,CAAA,YAAA,CAAA,cAAA,CAA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AEhJ,WAAY,CAC1BuI,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAAjK,QAAA,CAEnB4I,GAAA,CAAC3D,IAAI,CAAC/E,CAAAA,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAEuC,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CACPa,IAAI,CACHqG,GAAA,CAAC6B,QAAQ,CACPtJ,CAAAA,UAAU,CAAEA,UAAW,CACvBF,QAAQ,CAAEA,QAAS,CAKnByJ,UAAU,CAAC,QAAQ,CACnBC,SAAS,CAAC,QAAQ,CAClBxL,KAAK,CAAES,SAAU,CAAAI,QAAA,CAEhBuC,IAAI,CACG,CAAC,CACT,IAAI,CACP0C,IAAI,EAAIG,YAAY,EAAI,OAAO,CAC9BwD,GAAA,CAAC5E,OAAO,EACN4G,WAAW,CAAEpJ,WAAY,CACzBuI,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAAjK,QAAA,CAEnB4I,GAAA,CAAC3D,IAAI,CAAA,CAAC/E,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAEuC,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CACK,CAAA,CAAC,CACK,CAAA,CAAC,EACR,CAAC,CAEvB,CAAC,CAEK,IAAAmJ,UAAU,CAAGC,wBAAwB,CAAC9D,cAAK,CAAC+D,UAAU,CAAC3G,WAAW,CAAC,CAAE,CACzE4G,WAAW,CAAE,YACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseButton.js","sources":["../../../../../../src/components/Button/BaseButton/BaseButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseButton from './StyledBaseButton';\nimport type { ButtonTypography } from './buttonTokens';\nimport {\n textColor,\n backgroundColor,\n buttonIconOnlySizeToIconSizeMap,\n typography as buttonTypography,\n minHeight as buttonMinHeight,\n buttonSizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyHeightWidth,\n} from './buttonTokens';\nimport type { BaseButtonStyleProps, IconColor } from './types';\nimport AnimatedButtonContent from './AnimatedButtonContent';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BaseLinkProps } from '~components/Link/BaseLink';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconComponent } from '~components/Icons';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useButtonGroupContext } from '~components/ButtonGroup/ButtonGroupContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTheme } from '~components/BladeProvider';\nimport { announce } from '~components/LiveAnnouncer';\nimport { BaseSpinner } from '~components/Spinner/BaseSpinner';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef, StringChildrenType, TestID } from '~utils/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { usePrevious } from '~utils/usePrevious';\nimport { makeSize } from '~utils/makeSize';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeSpace } from '~utils/makeSpace';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { BladeCommonEvents } from '~components/types';\nimport { throwBladeError } from '~utils/logger';\n\ntype BaseButtonCommonProps = {\n href?: BaseLinkProps['href'];\n target?: BaseLinkProps['target'];\n rel?: BaseLinkProps['rel'];\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n isFullWidth?: boolean;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n onClick?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n type?: 'button' | 'reset' | 'submit';\n isLoading?: boolean;\n accessibilityProps?: Partial<AccessibilityProps>;\n variant?: 'primary' | 'secondary' | 'tertiary';\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents;\n\n/*\nMandatory children prop when icon is not provided\n*/\ntype BaseButtonWithoutIconProps = BaseButtonCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseButtonWithIconProps = BaseButtonCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n With or without icon prop. We need at least an icon or a children prop present.\n*/\nexport type BaseButtonProps = BaseButtonWithIconProps | BaseButtonWithoutIconProps;\n\ntype BaseButtonColorTokenModifiers = {\n variant: NonNullable<BaseButtonProps['variant']>;\n state: 'default' | 'hover' | 'focus' | 'disabled';\n color: BaseButtonProps['color'];\n};\n\nconst getRenderElement = (href?: string): 'a' | 'button' | undefined => {\n if (isReactNative()) {\n return undefined; // as property doesn't work with react native\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n};\n\nexport const getBackgroundColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'background' | 'border';\n}): DotNotationToken<Theme['colors']> => {\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n const tokens = backgroundColor(property);\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nconst getTextColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'icon' | 'text';\n}): DotNotationToken<Theme['colors']> => {\n const tokens = textColor(property);\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nconst getProps = ({\n buttonTypographyTokens,\n children,\n isDisabled,\n size,\n theme,\n variant,\n color,\n hasIcon,\n}: {\n buttonTypographyTokens: ButtonTypography;\n children?: string;\n isDisabled: boolean;\n hasIcon: boolean;\n theme: Theme;\n size: NonNullable<BaseButtonProps['size']>;\n variant: NonNullable<BaseButtonProps['variant']>;\n color: BaseButtonProps['color'];\n}): BaseButtonStyleProps => {\n if (variant === 'tertiary' && color !== 'primary' && color !== 'white') {\n throwBladeError({\n moduleName: 'BaseButton',\n message: `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n });\n }\n\n const isIconOnly = hasIcon && (!children || children?.trim().length === 0);\n const props: BaseButtonStyleProps = {\n iconSize: isIconOnly ? buttonIconOnlySizeToIconSizeMap[size] : buttonSizeToIconSizeMap[size],\n spinnerSize: buttonSizeToSpinnerSizeMap[size],\n fontSize: buttonTypographyTokens.fonts.size[size],\n lineHeight: buttonTypographyTokens.lineHeights[size],\n minHeight: makeSize(buttonMinHeight[size]),\n height: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n width: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n iconPadding: hasIcon && children?.trim() ? `spacing.${buttonIconPadding[size]}` : undefined,\n iconColor: getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'default',\n }) as IconColor,\n textColor: getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'default',\n }) as BaseTextProps['color'],\n buttonPaddingTop: isIconOnly ? makeSpace(0) : makeSpace(theme.spacing[buttonPadding[size].top]),\n buttonPaddingBottom: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].bottom]),\n buttonPaddingLeft: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].left]),\n buttonPaddingRight: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].right]),\n text: size === 'xsmall' ? children?.trim().toUpperCase() : children?.trim(),\n defaultBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'default' }),\n ),\n defaultBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'default' }),\n ),\n hoverBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'hover' }),\n ),\n hoverBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'hover' }),\n ),\n focusBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'focus' }),\n ),\n focusBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'focus' }),\n ),\n focusRingColor: getIn(theme.colors, 'surface.border.primary.muted'),\n borderWidth: variant == 'secondary' ? makeBorderSize(theme.border.width.thin) : '0px',\n borderRadius: makeBorderSize(theme.border.radius.medium),\n motionDuration: 'duration.xquick',\n motionEasing: 'easing.standard.effective',\n };\n\n if (isDisabled) {\n const disabledBackgroundColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'disabled' }),\n );\n const disabledBorderColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'disabled' }),\n );\n props.iconColor = getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'disabled',\n }) as IconColor;\n props.textColor = getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'disabled',\n }) as BaseTextProps['color'];\n props.defaultBackgroundColor = disabledBackgroundColor;\n props.defaultBorderColor = disabledBorderColor;\n props.hoverBackgroundColor = disabledBackgroundColor;\n props.hoverBorderColor = disabledBorderColor;\n props.focusBackgroundColor = disabledBackgroundColor;\n props.focusBorderColor = disabledBorderColor;\n }\n\n return props;\n};\n\nconst ButtonContent = styled(BaseBox)<{ isHidden: boolean }>(({ isHidden }) => ({\n opacity: isHidden ? 0 : 1,\n}));\n\nconst _BaseButton: React.ForwardRefRenderFunction<BladeElementRef, BaseButtonProps> = (\n {\n href,\n target,\n rel,\n variant = 'primary',\n color = 'primary',\n size = 'medium',\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n type = 'button',\n children,\n testID,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n accessibilityProps,\n onTouchEnd,\n onTouchStart,\n ...rest\n },\n ref,\n) => {\n const { theme } = useTheme();\n const buttonGroupProps = useButtonGroupContext();\n const [isPressed, setIsPressed] = React.useState(false);\n const isLink = Boolean(href);\n const childrenString = getStringFromReactText(children);\n // Button cannot be disabled when its rendered as Link\n const disabled = buttonGroupProps.isDisabled ?? (isLoading || (isDisabled && !isLink));\n\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: 'At least one of icon or text is required to render a button.',\n moduleName: 'BaseButton',\n });\n }\n }\n\n const prevLoading = usePrevious(isLoading);\n\n React.useEffect(() => {\n if (isLoading) announce('Started loading');\n\n if (!isLoading && prevLoading) announce('Stopped loading');\n }, [isLoading, prevLoading]);\n\n const {\n defaultBorderColor,\n defaultBackgroundColor,\n minHeight,\n height,\n width,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n focusBorderColor,\n focusBackgroundColor,\n focusRingColor,\n fontSize,\n hoverBorderColor,\n hoverBackgroundColor,\n iconColor,\n iconSize,\n iconPadding,\n spinnerSize,\n lineHeight,\n text,\n textColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n } = getProps({\n buttonTypographyTokens: buttonTypography,\n children: childrenString,\n isDisabled: disabled,\n size: buttonGroupProps.size ?? size,\n variant: buttonGroupProps.variant ?? variant,\n theme,\n color: buttonGroupProps.color ?? color,\n hasIcon: Boolean(Icon),\n });\n\n const renderElement = React.useMemo(() => getRenderElement(href), [href]);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n\n const handlePointerPressedIn = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(true);\n }, [disabled]);\n\n const handlePointerPressedOut = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(false);\n }, [disabled]);\n\n const handleKeyboardPressedIn = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(true);\n }\n },\n [disabled],\n );\n\n const handleKeyboardPressedOut = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(false);\n }\n },\n [disabled],\n );\n\n return (\n <StyledBaseButton\n ref={ref as any}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: On React Native it will always be undefined but TS doesn't understand that\n as={renderElement}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n role: isLink ? 'link' : 'button',\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n isLoading={isLoading}\n disabled={disabled}\n defaultBorderColor={defaultBorderColor}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n defaultBackgroundColor={defaultBackgroundColor}\n focusBorderColor={focusBorderColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n isFullWidth={buttonGroupProps.isFullWidth ?? isFullWidth}\n onClick={onClick}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n // Setting type for web fails it on native typecheck and vice versa\n onKeyDown={(event: any) => {\n handleKeyboardPressedIn(event);\n onKeyDown?.(event);\n }}\n onTouchStart={(event: React.TouchEvent) => {\n handlePointerPressedIn();\n onTouchStart?.(event);\n }}\n onTouchEnd={(event: React.TouchEvent) => {\n handlePointerPressedOut();\n onTouchEnd?.(event);\n }}\n type={type}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n height={height}\n width={width}\n isPressed={isPressed}\n onMouseDown={handlePointerPressedIn}\n onMouseUp={handlePointerPressedOut}\n onMouseOut={handlePointerPressedOut}\n onKeyUp={handleKeyboardPressedOut}\n {...metaAttribute({ name: MetaConstants.Button, testID })}\n {...getStyledProps(rest)}\n >\n <AnimatedButtonContent\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n isPressed={isPressed}\n >\n {isLoading ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n position=\"absolute\"\n top=\"0px\"\n left=\"0px\"\n bottom=\"0px\"\n right=\"0px\"\n zIndex={1}\n >\n <BaseSpinner accessibilityLabel=\"Loading\" size={spinnerSize} color={color} />\n </BaseBox>\n ) : null}\n <ButtonContent\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flex={1}\n isHidden={isLoading}\n zIndex={1}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox\n paddingRight={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n {text ? (\n <BaseText\n lineHeight={lineHeight}\n fontSize={fontSize}\n // figma and web have different font-smoothing properties\n // which causes web version of button text to look much bolder\n // than figma version. To fix this we are changing font-weight from 600 to 500\n // https://forum.figma.com/t/why-does-a-font-weight-in-figma-seem-lighter-than-the-same-weight-in-the-browser/2207\n fontWeight=\"medium\"\n textAlign=\"center\"\n color={textColor}\n >\n {text}\n </BaseText>\n ) : null}\n {Icon && iconPosition == 'right' ? (\n <BaseBox\n paddingLeft={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n </ButtonContent>\n </AnimatedButtonContent>\n </StyledBaseButton>\n );\n};\n\nconst BaseButton = assignWithoutSideEffects(React.forwardRef(_BaseButton), {\n displayName: 'BaseButton',\n});\n\nexport default BaseButton;\n"],"names":["getRenderElement","href","isReactNative","undefined","getBackgroundColorToken","_ref","property","variant","state","color","_state","tokens","backgroundColor","white","Error","base","getTextColorToken","_ref2","textColor","getProps","_ref3","buttonTypographyTokens","children","isDisabled","size","theme","hasIcon","throwBladeError","moduleName","message","isIconOnly","trim","length","props","iconSize","buttonIconOnlySizeToIconSizeMap","buttonSizeToIconSizeMap","spinnerSize","buttonSizeToSpinnerSizeMap","fontSize","fonts","lineHeight","lineHeights","minHeight","makeSize","buttonMinHeight","height","buttonIconOnlyHeightWidth","width","iconPadding","buttonIconPadding","iconColor","buttonPaddingTop","makeSpace","spacing","buttonPadding","top","buttonPaddingBottom","bottom","buttonPaddingLeft","left","buttonPaddingRight","right","text","toUpperCase","defaultBackgroundColor","getIn","colors","defaultBorderColor","hoverBackgroundColor","hoverBorderColor","focusBackgroundColor","focusBorderColor","focusRingColor","borderWidth","makeBorderSize","border","thin","borderRadius","radius","medium","motionDuration","motionEasing","disabledBackgroundColor","disabledBorderColor","ButtonContent","styled","BaseBox","_ref4","isHidden","opacity","_BaseButton","_ref5","ref","_buttonGroupProps$isD","_buttonGroupProps$siz","_buttonGroupProps$var","_buttonGroupProps$col","_buttonGroupProps$isF","target","rel","_ref5$variant","_ref5$color","_ref5$size","Icon","icon","_ref5$iconPosition","iconPosition","_ref5$isDisabled","_ref5$isFullWidth","isFullWidth","_ref5$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref5$type","type","testID","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","buttonGroupProps","useButtonGroupContext","_React$useState","React","useState","_React$useState2","_slicedToArray","isPressed","setIsPressed","isLink","Boolean","childrenString","getStringFromReactText","disabled","__DEV__","prevLoading","usePrevious","useEffect","announce","_getProps","buttonTypography","renderElement","useMemo","defaultRel","handlePointerPressedIn","useCallback","handlePointerPressedOut","handleKeyboardPressedIn","e","key","handleKeyboardPressedOut","_jsx","StyledBaseButton","Object","assign","as","makeAccessible","role","event","onMouseDown","onMouseUp","onMouseOut","onKeyUp","metaAttribute","name","MetaConstants","Button","getStyledProps","_jsxs","AnimatedButtonContent","display","justifyContent","alignItems","position","zIndex","BaseSpinner","accessibilityLabel","flexDirection","flex","paddingRight","BaseText","fontWeight","textAlign","paddingLeft","BaseButton","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,QAAA,CAAA,KAAA,CAAA,SAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,YAAA,CAAA,aAAA,CAAA,WAAA,CAAA,SAAA,CAAA,QAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,SAAA,CAAA,cAAA,CAAA,aAAA,CAAA,eAAA,CAAA,gBAAA,CAAA,oBAA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,QAAA,CAETkF,CAAAA,IAAI,EAAIG,YAAY,EAAI,MAAM,CAC7BwD,GAAA,CAAC5E,OAAO,CACNwG,CAAAA,YAAY,CAAE9I,WAAY,CAC1BqI,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAAlK,QAAA,CAEnB6I,GAAA,CAAC3D,IAAI,CAAChF,CAAAA,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAE0C,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CACPY,IAAI,CACHoG,GAAA,CAAC6B,QAAQ,CACPvJ,CAAAA,UAAU,CAAEA,UAAW,CACvBF,QAAQ,CAAEA,QAAS,CAKnB0J,UAAU,CAAC,QAAQ,CACnBC,SAAS,CAAC,QAAQ,CAClBzL,KAAK,CAAES,SAAU,CAAAI,QAAA,CAEhByC,IAAI,CACG,CAAC,CACT,IAAI,CACPyC,IAAI,EAAIG,YAAY,EAAI,OAAO,CAC9BwD,GAAA,CAAC5E,OAAO,EACN4G,WAAW,CAAElJ,WAAY,CACzBqI,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAAlK,QAAA,CAEnB6I,GAAA,CAAC3D,IAAI,CAAA,CAAChF,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAE0C,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CACK,CAAA,CAAC,CACK,CAAA,CAAC,EACR,CAAC,CAEvB,CAAC,CAEK,IAAAiJ,UAAU,CAAGC,wBAAwB,CAAC9D,cAAK,CAAC+D,UAAU,CAAC3G,WAAW,CAAC,CAAE,CACzE4G,WAAW,CAAE,YACf,CAAC;;;;"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import '../../../tokens/global/typography.js';
|
|
2
2
|
import '../../../tokens/global/motion.js';
|
|
3
3
|
import { size } from '../../../tokens/global/size.js';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
6
|
+
import 'react';
|
|
7
|
+
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
8
|
+
import '../../BladeProvider/useTheme.js';
|
|
4
9
|
|
|
5
|
-
var backgroundColor=function backgroundColor(property){var isBorder=property==='border';return {base:{primary:{default:`interactive.${property}.primary.default`,highlighted:`interactive.${property}.primary.highlighted`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:isBorder?'interactive.border.primary.default':'transparent',highlighted:isBorder?`interactive.border.primary.default`:`interactive.background.primary.faded`,disabled:isBorder?`interactive.border.primary.disabled`:`transparent`},tertiary:{default:`interactive.${property}.gray.default`,highlighted:`interactive.${property}.gray.highlighted`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticWhite.default`,highlighted:`interactive.${property}.staticWhite.highlighted`,disabled:`interactive.${property}.staticWhite.disabled`},secondary:{default:isBorder?'interactive.border.staticWhite.highlighted':'transparent',highlighted:isBorder?'interactive.border.staticWhite.highlighted':'interactive.background.staticWhite.faded',disabled:isBorder?`interactive.border.staticWhite.disabled`:'transparent'},tertiary:{default:`interactive.background.staticWhite.faded`,highlighted:`interactive.background.staticWhite.fadedHighlighted`,disabled:`interactive.background.staticWhite.disabled`}},color:function color(_color){return {primary:{default:`interactive.${property}.${_color}.default`,highlighted:`interactive.${property}.${_color}.highlighted`,disabled:`interactive.${property}.${_color}.disabled`},secondary:{default:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.faded`,highlighted:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.fadedHighlighted`,disabled:`interactive.${property}.${_color}.disabled`}};}};};var textColor=function textColor(property){return {base:{primary:{default:`interactive.${property}.onPrimary.normal`,highlighted:`interactive.${property}.onPrimary.normal`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:`interactive.${property}.primary.subtle`,highlighted:`interactive.${property}.primary.subtle`,disabled:`interactive.${property}.primary.disabled`},tertiary:{default:`interactive.${property}.gray.normal`,highlighted:`interactive.${property}.gray.normal`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticBlack.muted`,highlighted:`interactive.${property}.staticBlack.muted`,disabled:`interactive.${property}.staticBlack.disabled`},secondary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`},tertiary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`}},color:function color(_color2){return {primary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.${_color2}.disabled`},secondary:{default:`interactive.${property}.${_color2}.normal`,highlighted:`interactive.${property}.${_color2}.normal`,disabled:`interactive.${property}.${_color2}.disabled`}};}};};var typography={fonts:{size:{xsmall:50,small:50,medium:100,large:200}},lineHeights:{xsmall:75,small:75,medium:100,large:200}};var minHeight={xsmall:size[28],small:size[32],medium:size[36],large:size[48]};var buttonPadding={xsmall:{top:0,bottom:0,left:3,right:3},small:{top:0,bottom:0,left:4,right:4},medium:{top:0,bottom:0,left:6,right:6},large:{top:0,bottom:0,left:6,right:6}};var
|
|
10
|
+
var backgroundColor=function backgroundColor(property){var isBorder=property==='border';return {base:{primary:{default:`interactive.${property}.primary.default`,highlighted:`interactive.${property}.primary.highlighted`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:isBorder?'interactive.border.primary.default':'transparent',highlighted:isBorder?`interactive.border.primary.default`:`interactive.background.primary.faded`,disabled:isBorder?`interactive.border.primary.disabled`:`transparent`},tertiary:{default:`interactive.${property}.gray.default`,highlighted:`interactive.${property}.gray.highlighted`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticWhite.default`,highlighted:`interactive.${property}.staticWhite.highlighted`,disabled:`interactive.${property}.staticWhite.disabled`},secondary:{default:isBorder?'interactive.border.staticWhite.highlighted':'transparent',highlighted:isBorder?'interactive.border.staticWhite.highlighted':'interactive.background.staticWhite.faded',disabled:isBorder?`interactive.border.staticWhite.disabled`:'transparent'},tertiary:{default:`interactive.background.staticWhite.faded`,highlighted:`interactive.background.staticWhite.fadedHighlighted`,disabled:`interactive.background.staticWhite.disabled`}},color:function color(_color){return {primary:{default:`interactive.${property}.${_color}.default`,highlighted:`interactive.${property}.${_color}.highlighted`,disabled:`interactive.${property}.${_color}.disabled`},secondary:{default:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.faded`,highlighted:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.fadedHighlighted`,disabled:`interactive.${property}.${_color}.disabled`}};}};};var textColor=function textColor(property){return {base:{primary:{default:`interactive.${property}.onPrimary.normal`,highlighted:`interactive.${property}.onPrimary.normal`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:`interactive.${property}.primary.subtle`,highlighted:`interactive.${property}.primary.subtle`,disabled:`interactive.${property}.primary.disabled`},tertiary:{default:`interactive.${property}.gray.normal`,highlighted:`interactive.${property}.gray.normal`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticBlack.muted`,highlighted:`interactive.${property}.staticBlack.muted`,disabled:`interactive.${property}.staticBlack.disabled`},secondary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`},tertiary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`}},color:function color(_color2){return {primary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.${_color2}.disabled`},secondary:{default:`interactive.${property}.${_color2}.normal`,highlighted:`interactive.${property}.${_color2}.normal`,disabled:`interactive.${property}.${_color2}.disabled`}};}};};var typography={fonts:{size:{xsmall:50,small:50,medium:100,large:200}},lineHeights:{xsmall:75,small:75,medium:100,large:200}};var minHeight={xsmall:size[28],small:size[32],medium:size[36],large:size[48]};var buttonPadding={xsmall:{top:0,bottom:0,left:3,right:3},small:{top:0,bottom:0,left:4,right:4},medium:{top:0,bottom:0,left:6,right:6},large:{top:0,bottom:0,left:6,right:6}};var buttonIconOnlyHeightWidth={xsmall:makeSize(size['28']),small:makeSize(size['32']),medium:makeSize(size['36']),large:makeSize(size['48'])};var buttonSizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonIconOnlySizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonSizeToSpinnerSizeMap={xsmall:'medium',small:'large',medium:'large',large:'xlarge'};var buttonIconPadding={xsmall:1,small:2,medium:3,large:3};
|
|
6
11
|
|
|
7
|
-
export { backgroundColor,
|
|
12
|
+
export { backgroundColor, buttonIconOnlyHeightWidth, buttonIconOnlySizeToIconSizeMap, buttonIconPadding, buttonPadding, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight, textColor, typography };
|
|
8
13
|
//# sourceMappingURL=buttonTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonTokens.js","sources":["../../../../../../src/components/Button/BaseButton/buttonTokens.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport type { BaseButtonProps } from './BaseButton';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconSize } from '~components/Icons';\nimport type { SpinnerProps } from '~components/Spinner';\nimport type { Size } from '~tokens/global';\nimport { size } from '~tokens/global';\nimport type { FeedbackColors } from '~tokens/theme/theme';\n\nexport type ButtonMinHeight = Size[28] | Size[32] | Size[36] | Size[48];\n\nexport type ButtonTypography = {\n fonts: {\n size: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['typography']['fonts']['size']>;\n };\n lineHeights: Record<\n NonNullable<BaseButtonProps['size']>,\n keyof Theme['typography']['lineHeights']\n >;\n};\n\nconst backgroundColor = (property: 'background' | 'border') => {\n const isBorder = property === 'border';\n return {\n base: {\n primary: {\n default: `interactive.${property}.primary.default`,\n highlighted: `interactive.${property}.primary.highlighted`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.primary.default' : 'transparent',\n highlighted: isBorder\n ? `interactive.border.primary.default`\n : `interactive.background.primary.faded`,\n disabled: isBorder ? `interactive.border.primary.disabled` : `transparent`,\n },\n tertiary: {\n default: `interactive.${property}.gray.default`,\n highlighted: `interactive.${property}.gray.highlighted`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticWhite.default`,\n highlighted: `interactive.${property}.staticWhite.highlighted`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.staticWhite.highlighted' : 'transparent',\n highlighted: isBorder\n ? 'interactive.border.staticWhite.highlighted'\n : 'interactive.background.staticWhite.faded',\n disabled: isBorder ? `interactive.border.staticWhite.disabled` : 'transparent',\n },\n tertiary: {\n default: `interactive.background.staticWhite.faded`,\n highlighted: `interactive.background.staticWhite.fadedHighlighted`,\n disabled: `interactive.background.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.${color}.default`,\n highlighted: `interactive.${property}.${color}.highlighted`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.faded` as const),\n highlighted: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.fadedHighlighted` as const),\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst textColor = (property: 'icon' | 'text') => {\n return {\n base: {\n primary: {\n default: `interactive.${property}.onPrimary.normal`,\n highlighted: `interactive.${property}.onPrimary.normal`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: `interactive.${property}.primary.subtle`,\n highlighted: `interactive.${property}.primary.subtle`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.gray.normal`,\n highlighted: `interactive.${property}.gray.normal`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticBlack.muted`,\n highlighted: `interactive.${property}.staticBlack.muted`,\n disabled: `interactive.${property}.staticBlack.disabled`,\n },\n secondary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: `interactive.${property}.${color}.normal`,\n highlighted: `interactive.${property}.${color}.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst typography: ButtonTypography = {\n fonts: {\n size: {\n xsmall: 50,\n small: 50,\n medium: 100,\n large: 200,\n },\n },\n lineHeights: {\n xsmall: 75,\n small: 75,\n medium: 100,\n large: 200,\n },\n};\n\nconst minHeight: Record<NonNullable<BaseButtonProps['size']>, ButtonMinHeight> = {\n xsmall: size[28],\n small: size[32],\n medium: size[36],\n large: size[48],\n};\n\nconst buttonPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n small: {\n top: 0,\n bottom: 0,\n left: 4,\n right: 4,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n};\n\nconst buttonIconOnlyPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n right: 3, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n },\n small: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 2,\n right: 2,\n },\n};\n\nconst buttonSizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonIconOnlySizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonSizeToSpinnerSizeMap: Record<\n NonNullable<BaseButtonProps['size']>,\n SpinnerProps['size']\n> = {\n xsmall: 'medium',\n small: 'large',\n medium: 'large',\n large: 'xlarge',\n};\n\nconst buttonIconPadding: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['spacing']> = {\n xsmall: 1,\n small: 1,\n medium: 2,\n large: 2,\n};\n\nexport {\n backgroundColor,\n textColor,\n typography,\n minHeight,\n buttonSizeToIconSizeMap,\n buttonIconOnlySizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyPadding,\n};\n"],"names":["backgroundColor","property","isBorder","base","primary","default","highlighted","disabled","secondary","tertiary","white","color","textColor","typography","fonts","size","xsmall","small","medium","large","lineHeights","minHeight","buttonPadding","top","bottom","left","right","buttonIconOnlyPadding","buttonSizeToIconSizeMap","buttonIconOnlySizeToIconSizeMap","buttonSizeToSpinnerSizeMap","buttonIconPadding"],"mappings":";;;;AAqBM,IAAAA,eAAe,CAAG,SAAlBA,eA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CAAE,CACNO,GAAG,CAAE,CAAC,CACNC,MAAM,CAAE,CAAC,CACTC,IAAI,CAAE,CAAC,CACPC,KAAK,CAAE,CACT,CAAC,CACDT,KAAK,CAAE,CACLM,GAAG,CAAE,CAAC,CACNC,MAAM,CAAE,CAAC,CACTC,IAAI,CAAE,CAAC,CACPC,KAAK,CAAE,CACT,CAAC,CACDR,MAAM,CAAE,CACNK,GAAG,CAAE,CAAC,CACNC,MAAM,CAAE,CAAC,CACTC,IAAI,CAAE,CAAC,CACPC,KAAK,CAAE,CACT,CAAC,CACDP,KAAK,CAAE,CACLI,GAAG,CAAE,CAAC,CACNC,MAAM,CAAE,CAAC,CACTC,IAAI,CAAE,CAAC,CACPC,KAAK,CAAE,CACT,CACF,EAEM,IAAAE,uBAA+E,CAAG,CACtFZ,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,QACT,EAEM,IAAAU,+BAAuF,CAAG,CAC9Fb,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,QACT,EAEM,IAAAW,0BAGL,CAAG,CACFd,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,QACT,EAEM,IAAAY,iBAAuF,CAAG,CAC9Ff,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CAAC,CACRC,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CACT;;;;"}
|
|
1
|
+
{"version":3,"file":"buttonTokens.js","sources":["../../../../../../src/components/Button/BaseButton/buttonTokens.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport type { BaseButtonProps } from './BaseButton';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconSize } from '~components/Icons';\nimport type { SpinnerProps } from '~components/Spinner';\nimport type { Size } from '~tokens/global';\nimport { size } from '~tokens/global';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { makeSize } from '~utils';\n\nexport type ButtonMinHeight = Size[28] | Size[32] | Size[36] | Size[48];\n\nexport type ButtonTypography = {\n fonts: {\n size: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['typography']['fonts']['size']>;\n };\n lineHeights: Record<\n NonNullable<BaseButtonProps['size']>,\n keyof Theme['typography']['lineHeights']\n >;\n};\n\nconst backgroundColor = (property: 'background' | 'border') => {\n const isBorder = property === 'border';\n return {\n base: {\n primary: {\n default: `interactive.${property}.primary.default`,\n highlighted: `interactive.${property}.primary.highlighted`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.primary.default' : 'transparent',\n highlighted: isBorder\n ? `interactive.border.primary.default`\n : `interactive.background.primary.faded`,\n disabled: isBorder ? `interactive.border.primary.disabled` : `transparent`,\n },\n tertiary: {\n default: `interactive.${property}.gray.default`,\n highlighted: `interactive.${property}.gray.highlighted`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticWhite.default`,\n highlighted: `interactive.${property}.staticWhite.highlighted`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.staticWhite.highlighted' : 'transparent',\n highlighted: isBorder\n ? 'interactive.border.staticWhite.highlighted'\n : 'interactive.background.staticWhite.faded',\n disabled: isBorder ? `interactive.border.staticWhite.disabled` : 'transparent',\n },\n tertiary: {\n default: `interactive.background.staticWhite.faded`,\n highlighted: `interactive.background.staticWhite.fadedHighlighted`,\n disabled: `interactive.background.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.${color}.default`,\n highlighted: `interactive.${property}.${color}.highlighted`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.faded` as const),\n highlighted: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.fadedHighlighted` as const),\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst textColor = (property: 'icon' | 'text') => {\n return {\n base: {\n primary: {\n default: `interactive.${property}.onPrimary.normal`,\n highlighted: `interactive.${property}.onPrimary.normal`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: `interactive.${property}.primary.subtle`,\n highlighted: `interactive.${property}.primary.subtle`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.gray.normal`,\n highlighted: `interactive.${property}.gray.normal`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticBlack.muted`,\n highlighted: `interactive.${property}.staticBlack.muted`,\n disabled: `interactive.${property}.staticBlack.disabled`,\n },\n secondary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: `interactive.${property}.${color}.normal`,\n highlighted: `interactive.${property}.${color}.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst typography: ButtonTypography = {\n fonts: {\n size: {\n xsmall: 50,\n small: 50,\n medium: 100,\n large: 200,\n },\n },\n lineHeights: {\n xsmall: 75,\n small: 75,\n medium: 100,\n large: 200,\n },\n};\n\nconst minHeight: Record<NonNullable<BaseButtonProps['size']>, ButtonMinHeight> = {\n xsmall: size[28],\n small: size[32],\n medium: size[36],\n large: size[48],\n};\n\nconst buttonPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n small: {\n top: 0,\n bottom: 0,\n left: 4,\n right: 4,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n};\n\nconst buttonIconOnlyHeightWidth = {\n xsmall: makeSize(size['28']),\n small: makeSize(size['32']),\n medium: makeSize(size['36']),\n large: makeSize(size['48']),\n} as const;\n\nconst buttonSizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonIconOnlySizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonSizeToSpinnerSizeMap: Record<\n NonNullable<BaseButtonProps['size']>,\n SpinnerProps['size']\n> = {\n xsmall: 'medium',\n small: 'large',\n medium: 'large',\n large: 'xlarge',\n};\n\nconst buttonIconPadding: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['spacing']> = {\n xsmall: 1,\n small: 2,\n medium: 3,\n large: 3,\n};\n\nexport {\n backgroundColor,\n textColor,\n typography,\n minHeight,\n buttonSizeToIconSizeMap,\n buttonIconOnlySizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyHeightWidth,\n};\n"],"names":["backgroundColor","property","isBorder","base","primary","default","highlighted","disabled","secondary","tertiary","white","color","textColor","typography","fonts","size","xsmall","small","medium","large","lineHeights","minHeight","buttonPadding","top","bottom","left","right","buttonIconOnlyHeightWidth","makeSize","buttonSizeToIconSizeMap","buttonIconOnlySizeToIconSizeMap","buttonSizeToSpinner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EM,IAAAC,yBAAyB,CAAG,CAChCX,MAAM,CAAEY,QAAQ,CAACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAC5BE,KAAK,CAAEW,QAAQ,CAACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAC3BG,MAAM,CAAEU,QAAQ,CAACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAC5BI,KAAK,CAAES,QAAQ,CAACb,IAAI,CAAC,IAAI,CAAC,CAC5B,EAEM,IAAAc,uBAA+E,CAAG,CACtFb,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,QACT,EAEM,IAAAW,+BAAuF,CAAG,CAC9Fd,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,QACT,EAEM,IAAAY,0BAGL,CAAG,CACFf,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,QACT,EAEM,IAAAa,iBAAuF,CAAG,CAC9FhB,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CAAC,CACRC,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CACT;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var getBaseButtonStyles=function getBaseButtonStyles(_ref){var defaultBorderColor=_ref.defaultBorderColor,minHeight=_ref.minHeight,buttonPaddingTop=_ref.buttonPaddingTop,buttonPaddingBottom=_ref.buttonPaddingBottom,buttonPaddingLeft=_ref.buttonPaddingLeft,buttonPaddingRight=_ref.buttonPaddingRight,defaultBackgroundColor=_ref.defaultBackgroundColor,disabled=_ref.disabled,isFullWidth=_ref.isFullWidth,borderWidth=_ref.borderWidth,borderRadius=_ref.borderRadius;return {minHeight:minHeight,width:isFullWidth?'100%':
|
|
1
|
+
var getBaseButtonStyles=function getBaseButtonStyles(_ref){var defaultBorderColor=_ref.defaultBorderColor,minHeight=_ref.minHeight,buttonPaddingTop=_ref.buttonPaddingTop,buttonPaddingBottom=_ref.buttonPaddingBottom,buttonPaddingLeft=_ref.buttonPaddingLeft,buttonPaddingRight=_ref.buttonPaddingRight,defaultBackgroundColor=_ref.defaultBackgroundColor,disabled=_ref.disabled,isFullWidth=_ref.isFullWidth,borderWidth=_ref.borderWidth,borderRadius=_ref.borderRadius,height=_ref.height,_ref$width=_ref.width,width=_ref$width===void 0?'auto':_ref$width;return {minHeight:minHeight,height:height,width:isFullWidth?'100%':width,cursor:disabled?'not-allowed':'pointer',backgroundColor:defaultBackgroundColor,borderColor:defaultBorderColor,borderWidth:borderWidth,borderRadius:borderRadius,borderStyle:'solid',paddingTop:buttonPaddingTop,paddingBottom:buttonPaddingBottom,paddingLeft:buttonPaddingLeft,paddingRight:buttonPaddingRight,justifyContent:'center',alignItems:'center',textDecoration:'none',overflow:'hidden'};};
|
|
2
2
|
|
|
3
3
|
export { getBaseButtonStyles as default };
|
|
4
4
|
//# sourceMappingURL=getStyledBaseButtonStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStyledBaseButtonStyles.js","sources":["../../../../../../src/components/Button/BaseButton/getStyledBaseButtonStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { StyledBaseButtonProps } from './types';\n\nconst getBaseButtonStyles = ({\n defaultBorderColor,\n minHeight,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n defaultBackgroundColor,\n disabled,\n isFullWidth,\n borderWidth,\n borderRadius,\n}: Omit<\n StyledBaseButtonProps,\n 'children' | 'onClick' | 'accessibilityProps' | 'accessibilityLabel'\n>): CSSObject => ({\n minHeight,\n width: isFullWidth ? '100%' :
|
|
1
|
+
{"version":3,"file":"getStyledBaseButtonStyles.js","sources":["../../../../../../src/components/Button/BaseButton/getStyledBaseButtonStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { StyledBaseButtonProps } from './types';\n\nconst getBaseButtonStyles = ({\n defaultBorderColor,\n minHeight,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n defaultBackgroundColor,\n disabled,\n isFullWidth,\n borderWidth,\n borderRadius,\n height,\n width = 'auto',\n}: Omit<\n StyledBaseButtonProps,\n 'children' | 'onClick' | 'accessibilityProps' | 'accessibilityLabel'\n>): CSSObject => ({\n minHeight,\n height,\n width: isFullWidth ? '100%' : width,\n cursor: disabled ? 'not-allowed' : 'pointer',\n backgroundColor: defaultBackgroundColor,\n borderColor: defaultBorderColor,\n borderWidth,\n borderRadius,\n borderStyle: 'solid',\n paddingTop: buttonPaddingTop,\n paddingBottom: buttonPaddingBottom,\n paddingLeft: buttonPaddingLeft,\n paddingRight: buttonPaddingRight,\n justifyContent: 'center',\n alignItems: 'center',\n textDecoration: 'none',\n overflow: 'hidden',\n});\n\nexport default getBaseButtonStyles;\n"],"names":["getBaseButtonStyles","_ref","defaultBorderColor","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","defaultBackgroundColor","disabled","isFullWidth","borderWidth","borderRadius","height","_ref$width","width","cursor","backgroundColor","borderColor","borderStyle","paddingTop","paddingBottom","paddingLeft","paddingRight","justifyContent","alignItems","textDecoration","overflow"],"mappings":"AAGM,IAAAA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,CAAA,CAAA,IACvBC,kBAAkB,CAAAD,IAAA,CAAlBC,kBAAkB,CAClBC,SAAS,CAAAF,IAAA,CAATE,SAAS,CACTC,gBAAgB,CAAAH,IAAA,CAAhBG,gBAAgB,CAChBC,mBAAmB,CAAAJ,IAAA,CAAnBI,mBAAmB,CACnBC,iBAAiB,CAAAL,IAAA,CAAjBK,iBAAiB,CACjBC,kBAAkB,CAAAN,IAAA,CAAlBM,kBAAkB,CAClBC,sBAAsB,CAAAP,IAAA,CAAtBO,sBAAsB,CACtBC,QAAQ,CAAAR,IAAA,CAARQ,QAAQ,CACRC,WAAW,CAAAT,IAAA,CAAXS,WAAW,CACXC,WAAW,CAAAV,IAAA,CAAXU,WAAW,CACXC,YAAY,CAAAX,IAAA,CAAZW,YAAY,CACZC,MAAM,CAAAZ,IAAA,CAANY,MAAM,CAAAC,UAAA,CAAAb,IAAA,CACNc,KAAK,CAALA,KAAK,CAAAD,UAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,UAAA,CAAA,OAIE,CAChBX,SAAS,CAATA,SAAS,CACTU,MAAM,CAANA,MAAM,CACNE,KAAK,CAAEL,WAAW,CAAG,MAAM,CAAGK,KAAK,CACnCC,MAAM,CAAEP,QAAQ,CAAG,aAAa,CAAG,SAAS,CAC5CQ,eAAe,CAAET,sBAAsB,CACvCU,WAAW,CAAEhB,kBAAkB,CAC/BS,WAAW,CAAXA,WAAW,CACXC,YAAY,CAAZA,YAAY,CACZO,WAAW,CAAE,OAAO,CACpBC,UAAU,CAAEhB,gBAAgB,CAC5BiB,aAAa,CAAEhB,mBAAmB,CAClCiB,WAAW,CAAEhB,iBAAiB,CAC9BiB,YAAY,CAAEhB,kBAAkB,CAChCiB,cAAc,CAAE,QAAQ,CACxBC,UAAU,CAAE,QAAQ,CACpBC,cAAc,CAAE,MAAM,CACtBC,QAAQ,CAAE,QACZ,CAAC;;;;"}
|
|
@@ -8,7 +8,7 @@ import '@babel/runtime/helpers/slicedToArray';
|
|
|
8
8
|
import { isReactNative } from '../../utils/platform/isReactNative.js';
|
|
9
9
|
import '../BladeProvider/useTheme.js';
|
|
10
10
|
|
|
11
|
-
var _excluded=["isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","visibleTagsCountRef","isKeydownPressed","setIsKeydownPressed","options","selectionType","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setControlledValueIndices","filteredValues","dropdownTriggerer"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,close:noop,selectedIndices:[],setSelectedIndices:noop,controlledValueIndices:[],setControlledValueIndices:noop,options:[],setOptions:noop,filteredValues:[],setFilteredValues:noop,activeIndex:-1,setActiveIndex:noop,activeTagIndex:-1,setActiveTagIndex:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasAutoCompleteInBottomSheetHeader:false,setHasAutoCompleteInBottomSheetHeader:noop,isKeydownPressed:false,setIsKeydownPressed:noop,changeCallbackTriggerer:0,setChangeCallbackTriggerer:noop,isControlled:false,setIsControlled:noop,dropdownBaseId:'',actionListItemRef:{current:null},triggererRef:{current:null},isTagDismissedRef:{current:null},visibleTagsCountRef:{current:null},triggererWrapperRef:{current:null}});var searchTimeout;var searchString='';var useDropdown=function useDropdown(){var _React$useContext=React__default.useContext(DropdownContext),isOpen=_React$useContext.isOpen,setIsOpen=_React$useContext.setIsOpen,close=_React$useContext.close,selectedIndices=_React$useContext.selectedIndices,setSelectedIndices=_React$useContext.setSelectedIndices,activeIndex=_React$useContext.activeIndex,setActiveIndex=_React$useContext.setActiveIndex,activeTagIndex=_React$useContext.activeTagIndex,setActiveTagIndex=_React$useContext.setActiveTagIndex,visibleTagsCountRef=_React$useContext.visibleTagsCountRef,isKeydownPressed=_React$useContext.isKeydownPressed,setIsKeydownPressed=_React$useContext.setIsKeydownPressed,options=_React$useContext.options,selectionType=_React$useContext.selectionType,changeCallbackTriggerer=_React$useContext.changeCallbackTriggerer,setChangeCallbackTriggerer=_React$useContext.setChangeCallbackTriggerer,isControlled=_React$useContext.isControlled,setControlledValueIndices=_React$useContext.setControlledValueIndices,filteredValues=_React$useContext.filteredValues,dropdownTriggerer=_React$useContext.dropdownTriggerer,rest=_objectWithoutProperties(_React$useContext,_excluded);var setIndices=function setIndices(indices){if(isControlled){setControlledValueIndices(indices);}else {setSelectedIndices(indices);}};var removeOption=function removeOption(index){var existingItemIndex=selectedIndices.indexOf(index);if(existingItemIndex<0){return;}setIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));};var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};var isSelected=false;if(index<0||index>options.length-1){return isSelected;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){removeOption(index);isSelected=false;}else {setIndices([].concat(_toConsumableArray(selectedIndices),[index]));isSelected=true;}}else {setIndices([index]);isSelected=true;}setChangeCallbackTriggerer(changeCallbackTriggerer+1);if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){close();}return isSelected;};var onTriggerClick=function onTriggerClick(){if(isOpen){close();}else {setIsOpen(true);}};var onOptionChange=function onOptionChange(actionType,index){setActiveTagIndex(-1);var newIndex=index!=null?index:activeIndex;var updatedIndex;var hasAutoComplete=rest.hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;if(hasAutoComplete&&filteredValues.length>0){var filteredIndexes=filteredValues.map(function(filteredValue){return options.findIndex(function(option){return option.value===filteredValue;});}).sort();updatedIndex=filteredIndexes[getUpdatedIndex({currentIndex:filteredIndexes.indexOf(newIndex),maxIndex:filteredIndexes.length-1,actionType:actionType})];}else {updatedIndex=getUpdatedIndex({currentIndex:newIndex,maxIndex:options.length-1,actionType:actionType});}setActiveIndex(updatedIndex);var optionValues=options.map(function(option){return option.value;});ensureScrollVisiblity(updatedIndex,rest.actionListItemRef.current,optionValues);};var onOptionClick=function onOptionClick(e,index){var actionType=getActionFromKey(e,isOpen,dropdownTriggerer);if(typeof actionType==='number'){onOptionChange(actionType,index);}selectOption(index);if(!isReactNative()){var _rest$triggererRef$cu;(_rest$triggererRef$cu=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu.focus();}};var onComboType=function onComboType(letter,actionType){setIsOpen(true);if(rest.hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete){return;}if(typeof searchTimeout==='number'){window.clearTimeout(searchTimeout);}searchTimeout=window.setTimeout(function(){searchString='';},500);searchString=searchString+letter;var optionTitles=options.map(function(option){return option.title;});var searchIndex=getIndexByLetter(optionTitles,searchString,activeIndex+1);if(searchIndex>=0){onOptionChange(actionType,searchIndex);}else {window.clearTimeout(searchTimeout);searchString='';}};var onTriggerKeydown=function onTriggerKeydown(e){if(!isKeydownPressed&&![' ','Enter','Escape','Meta'].includes(e.event.key)){setIsKeydownPressed(true);}var actionType=getActionFromKey(e.event,isOpen,dropdownTriggerer);if(actionType){performAction(actionType,e,{setIsOpen:setIsOpen,close:close,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex$,_options$activeIndex;if(activeIndex<0){return;}var isSelected=selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}(_options$activeIndex$=(_options$activeIndex=options[activeIndex]).onClickTrigger)==null?void 0:_options$activeIndex$.call(_options$activeIndex,isSelected);}});}};return Object.assign({isOpen:isOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,filteredValues:filteredValues,removeOption:removeOption,setControlledValueIndices:setControlledValueIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType,dropdownTriggerer:dropdownTriggerer},rest);};
|
|
11
|
+
var _excluded=["isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","visibleTagsCountRef","isKeydownPressed","setIsKeydownPressed","options","selectionType","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setControlledValueIndices","filteredValues","dropdownTriggerer"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,close:noop,selectedIndices:[],setSelectedIndices:noop,controlledValueIndices:[],setControlledValueIndices:noop,options:[],setOptions:noop,filteredValues:[],setFilteredValues:noop,activeIndex:-1,setActiveIndex:noop,activeTagIndex:-1,setActiveTagIndex:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasAutoCompleteInBottomSheetHeader:false,setHasAutoCompleteInBottomSheetHeader:noop,isKeydownPressed:false,setIsKeydownPressed:noop,changeCallbackTriggerer:0,setChangeCallbackTriggerer:noop,isControlled:false,setIsControlled:noop,dropdownBaseId:'',actionListItemRef:{current:null},triggererRef:{current:null},isTagDismissedRef:{current:null},visibleTagsCountRef:{current:null},triggererWrapperRef:{current:null}});var searchTimeout;var searchString='';var useDropdown=function useDropdown(){var _React$useContext=React__default.useContext(DropdownContext),isOpen=_React$useContext.isOpen,setIsOpen=_React$useContext.setIsOpen,close=_React$useContext.close,selectedIndices=_React$useContext.selectedIndices,setSelectedIndices=_React$useContext.setSelectedIndices,activeIndex=_React$useContext.activeIndex,setActiveIndex=_React$useContext.setActiveIndex,activeTagIndex=_React$useContext.activeTagIndex,setActiveTagIndex=_React$useContext.setActiveTagIndex,visibleTagsCountRef=_React$useContext.visibleTagsCountRef,isKeydownPressed=_React$useContext.isKeydownPressed,setIsKeydownPressed=_React$useContext.setIsKeydownPressed,options=_React$useContext.options,selectionType=_React$useContext.selectionType,changeCallbackTriggerer=_React$useContext.changeCallbackTriggerer,setChangeCallbackTriggerer=_React$useContext.setChangeCallbackTriggerer,isControlled=_React$useContext.isControlled,setControlledValueIndices=_React$useContext.setControlledValueIndices,filteredValues=_React$useContext.filteredValues,dropdownTriggerer=_React$useContext.dropdownTriggerer,rest=_objectWithoutProperties(_React$useContext,_excluded);var setIndices=function setIndices(indices){if(isControlled){setControlledValueIndices(indices);}else {setSelectedIndices(indices);}};var removeOption=function removeOption(index){var existingItemIndex=selectedIndices.indexOf(index);if(existingItemIndex<0){return;}setIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));};var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};var isSelected=false;if(index<0||index>options.length-1){return isSelected;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){removeOption(index);isSelected=false;}else {setIndices([].concat(_toConsumableArray(selectedIndices),[index]));isSelected=true;}}else {setIndices([index]);isSelected=true;}setChangeCallbackTriggerer(changeCallbackTriggerer+1);if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){close();}return isSelected;};var onTriggerClick=function onTriggerClick(){if(isOpen){close();}else {setIsOpen(true);}};var onOptionChange=function onOptionChange(actionType,index){setActiveTagIndex(-1);var newIndex=index!=null?index:activeIndex;var updatedIndex;var hasAutoComplete=rest.hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;if(hasAutoComplete&&filteredValues.length>0){var filteredIndexes=filteredValues.map(function(filteredValue){return options.findIndex(function(option){return option.value===filteredValue;});}).sort(function(a,b){return a-b;});updatedIndex=filteredIndexes[getUpdatedIndex({currentIndex:filteredIndexes.indexOf(newIndex),maxIndex:filteredIndexes.length-1,actionType:actionType})];}else {updatedIndex=getUpdatedIndex({currentIndex:newIndex,maxIndex:options.length-1,actionType:actionType});}setActiveIndex(updatedIndex);var optionValues=options.map(function(option){return option.value;});ensureScrollVisiblity(updatedIndex,rest.actionListItemRef.current,optionValues);};var onOptionClick=function onOptionClick(e,index){var actionType=getActionFromKey(e,isOpen,dropdownTriggerer);if(typeof actionType==='number'){onOptionChange(actionType,index);}selectOption(index);if(!isReactNative()){var _rest$triggererRef$cu;(_rest$triggererRef$cu=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu.focus();}};var onComboType=function onComboType(letter,actionType){setIsOpen(true);if(rest.hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete){return;}if(typeof searchTimeout==='number'){window.clearTimeout(searchTimeout);}searchTimeout=window.setTimeout(function(){searchString='';},500);searchString=searchString+letter;var optionTitles=options.map(function(option){return option.title;});var searchIndex=getIndexByLetter(optionTitles,searchString,activeIndex+1);if(searchIndex>=0){onOptionChange(actionType,searchIndex);}else {window.clearTimeout(searchTimeout);searchString='';}};var onTriggerKeydown=function onTriggerKeydown(e){if(!isKeydownPressed&&![' ','Enter','Escape','Meta'].includes(e.event.key)){setIsKeydownPressed(true);}var actionType=getActionFromKey(e.event,isOpen,dropdownTriggerer);if(actionType){performAction(actionType,e,{setIsOpen:setIsOpen,close:close,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex$,_options$activeIndex;if(activeIndex<0){return;}var isSelected=selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}(_options$activeIndex$=(_options$activeIndex=options[activeIndex]).onClickTrigger)==null?void 0:_options$activeIndex$.call(_options$activeIndex,isSelected);}});}};return Object.assign({isOpen:isOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,filteredValues:filteredValues,removeOption:removeOption,setControlledValueIndices:setControlledValueIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType,dropdownTriggerer:dropdownTriggerer},rest);};
|
|
12
12
|
|
|
13
13
|
export { DropdownContext, useDropdown };
|
|
14
14
|
//# sourceMappingURL=useDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?: 'SelectInput' | 'DropdownButton' | 'AutoComplete' | 'DropdownLink';\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort();\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,qBAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,4BAAA,CAAA,cAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,CAoBA,IAAMA,IAAI,CAAG,SAA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,iBAAiB,CAAA,CACdC,IAAI,CAEX,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?: 'SelectInput' | 'DropdownButton' | 'AutoComplete' | 'DropdownLink';\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,qBAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,4BAAA,CAAA,cAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,CAoBA,IAAMA,IAAI,CAAG,SAAPA,IAAIA,EAAe,EAAE,CAgGrB,IAAAC,eAAe,CAAGC,cAAK,CAACC,aAAa,CAAsB,CAC/DC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAEL,IAAI,CACfM,KAAK,CAAEN,IAAI,CACXO,eAAe,CAAE,EAAE,CACnBC,kBAAkB,CAAER,IAAI,CACxBS,sBAAsB,CAAE,EAAE,CAC1BC,yBAAyB,CAAEV,IAAI,CAC/BW,OAAO,CAAE,EAAE,CACXC,UAAU,CAAEZ,IAAI,CAChBa,cAAc,CAA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