@razorpay/blade 11.7.0 → 11.8.1
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/AnimatedButtonContent.native.js +16 -0
- package/build/lib/native/components/Button/BaseButton/AnimatedButtonContent.native.js.map +1 -0
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +7 -5
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.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/ButtonGroup/ButtonGroup.native.js +7 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroup.native.js.map +1 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js +6 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/native/components/index.js +1 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
- package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +127 -71
- 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/ButtonGroup.web.js +158 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js +11 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js +46 -0
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/index.js +2 -0
- package/build/lib/web/development/components/ButtonGroup/index.js.map +1 -0
- 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/development/components/index.js +2 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +1 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
- package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +127 -71
- 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/ButtonGroup.web.js +158 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js +11 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js +46 -0
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/index.js +2 -0
- package/build/lib/web/production/components/ButtonGroup/index.js.map +1 -0
- package/build/lib/web/production/components/Dropdown/useDropdown.js +3 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/index.js +2 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +1 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +68 -1
- package/build/types/components/index.native.d.ts +42 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated';
|
|
2
|
+
import 'react';
|
|
3
|
+
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
4
|
+
import 'styled-components/native';
|
|
5
|
+
import '@gorhom/portal';
|
|
6
|
+
import 'react-native-gesture-handler';
|
|
7
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
8
|
+
import 'react-native';
|
|
9
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
10
|
+
import '../../BottomSheet/BottomSheetStack.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var AnimatedButtonContent=function AnimatedButtonContent(_ref){var motionDuration=_ref.motionDuration,motionEasing=_ref.motionEasing,children=_ref.children,isPressed=_ref.isPressed;var _useTheme=useTheme(),theme=_useTheme.theme;var duration=getIn(theme.motion,motionDuration);var easing=getIn(theme.motion,motionEasing);var animatedStyles=useAnimatedStyle(function(){return {transform:[{scale:withTiming(isPressed?0.95:1,{duration:duration,easing:easing})}]};},[isPressed]);return jsx(Animated.View,{style:animatedStyles,children:children});};
|
|
14
|
+
|
|
15
|
+
export { AnimatedButtonContent as default };
|
|
16
|
+
//# sourceMappingURL=AnimatedButtonContent.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedButtonContent.native.js","sources":["../../../../../../src/components/Button/BaseButton/AnimatedButtonContent.native.tsx"],"sourcesContent":["import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated';\nimport React from 'react';\nimport type { TextInput } from 'react-native';\nimport type { AnimatedButtonContentProps } from './types';\nimport getIn from '~utils/lodashButBetter/get';\nimport { useTheme } from '~components/BladeProvider';\n\nconst AnimatedButtonContent: React.ForwardRefRenderFunction<\n TextInput,\n AnimatedButtonContentProps\n> = ({ motionDuration, motionEasing, children, isPressed }) => {\n const { theme } = useTheme();\n const duration = getIn(theme.motion, motionDuration);\n const easing = getIn(theme.motion, motionEasing);\n\n const animatedStyles = useAnimatedStyle(() => {\n return {\n transform: [\n {\n scale: withTiming(isPressed ? 0.95 : 1, {\n duration,\n easing,\n }),\n },\n ],\n };\n }, [isPressed]);\n\n return <Animated.View style={animatedStyles}>{children}</Animated.View>;\n};\n\nexport default AnimatedButtonContent;\n"],"names":["AnimatedButtonContent","_ref","motionDuration","motionEasing","children","isPressed","_useTheme","useTheme","theme","duration","getIn","motion","easing","animatedStyles","useAnimatedStyle","transform","scale","withTiming","_jsx","Animated","View","style"],"mappings":";;;;;;;;;;;;AAOM,IAAAA,qBAGL,CAAG,SAHEA,qBAGLA,CAAAC,IAAA,CAA8D,CAAA,IAAxDC,cAAc,CAAAD,IAAA,CAAdC,cAAc,CAAEC,YAAY,CAAAF,IAAA,CAAZE,YAAY,CAAEC,QAAQ,CAAAH,IAAA,CAARG,QAAQ,CAAEC,SAAS,CAAAJ,IAAA,CAATI,SAAS,CACtD,IAAAC,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CACb,IAAMC,QAAQ,CAAGC,KAAK,CAACF,KAAK,CAACG,MAAM,CAAET,cAAc,CAAC,CACpD,IAAMU,MAAM,CAAGF,KAAK,CAACF,KAAK,CAACG,MAAM,CAAER,YAAY,CAAC,CAEhD,IAAMU,cAAc,CAAGC,gBAAgB,CAAC,UAAM,CAC5C,OAAO,CACLC,SAAS,CAAE,CACT,CACEC,KAAK,CAAEC,UAAU,CAACZ,SAAS,CAAG,IAAI,CAAG,CAAC,CAAE,CACtCI,QAAQ,CAARA,QAAQ,CACRG,MAAM,CAANA,MACF,CAAC,CACH,CAAC,CAEL,CAAC,CACH,CAAC,CAAE,CAACP,SAAS,CAAC,CAAC,CAEf,OAAOa,GAAA,CAACC,QAAQ,CAACC,IAAI,EAACC,KAAK,CAAER,cAAe,CAAAT,QAAA,CAAEA,QAAQ,CAAgB,CAAC,CACzE;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
1
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import React__default from 'react';
|
|
3
4
|
import styled from 'styled-components/native';
|
|
4
5
|
import StyledBaseButton from './StyledBaseButton.native.js';
|
|
5
|
-
import { buttonIconOnlySizeToIconSizeMap, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight,
|
|
6
|
+
import { typography, buttonIconOnlySizeToIconSizeMap, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight, buttonIconOnlyHeightWidth, buttonIconPadding, buttonPadding, backgroundColor, textColor } from './buttonTokens.js';
|
|
7
|
+
import AnimatedButtonContent from './AnimatedButtonContent.native.js';
|
|
6
8
|
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
7
9
|
import 'react-native';
|
|
8
|
-
import '@babel/runtime/helpers/slicedToArray';
|
|
9
10
|
import { throwBladeError } from '../../../utils/logger/logger.js';
|
|
10
11
|
import { isReactNative } from '../../../utils/platform/isReactNative.js';
|
|
11
12
|
import { makeBorderSize } from '../../../utils/makeBorderSize/makeBorderSize.js';
|
|
@@ -13,6 +14,7 @@ import { makeSpace } from '../../../utils/makeSpace/makeSpace.js';
|
|
|
13
14
|
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
14
15
|
import { usePrevious } from '../../../utils/usePrevious/usePrevious.js';
|
|
15
16
|
import useTheme from '../../BladeProvider/useTheme.js';
|
|
17
|
+
import { useButtonGroupContext } from '../../ButtonGroup/ButtonGroupContext.js';
|
|
16
18
|
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
|
|
17
19
|
import '../../../tokens/global/typography.js';
|
|
18
20
|
import '../../../tokens/global/motion.js';
|
|
@@ -20,7 +22,7 @@ import { BaseText } from '../../Typography/BaseText/BaseText.native.js';
|
|
|
20
22
|
import '@gorhom/portal';
|
|
21
23
|
import 'react-native-gesture-handler';
|
|
22
24
|
import '../../BottomSheet/BottomSheetStack.js';
|
|
23
|
-
import {
|
|
25
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
24
26
|
import { announce } from '../../LiveAnnouncer/LiveAnnouncer.native.js';
|
|
25
27
|
import { BaseSpinner } from '../../Spinner/BaseSpinner/BaseSpinner.js';
|
|
26
28
|
import { BaseBox } from '../../Box/BaseBox/BaseBox.native.js';
|
|
@@ -30,7 +32,7 @@ import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.native
|
|
|
30
32
|
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
31
33
|
import { getStringFromReactText } from '../../../utils/getStringChildren/getStringChildren.js';
|
|
32
34
|
|
|
33
|
-
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: "default" 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 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 isLink=Boolean(href);var childrenString=getStringFromReactText(children);var disabled=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:size,variant:variant,theme:theme,color: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;return jsxs(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:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:onKeyDown,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),{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'});
|
|
34
36
|
|
|
35
|
-
export { BaseButton as default };
|
|
37
|
+
export { BaseButton as default, getBackgroundColorToken };
|
|
36
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 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 { 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\nconst 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: \"default\" 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 isLink = Boolean(href);\n const childrenString = getStringFromReactText(children);\n // Button cannot be disabled when its rendered as Link\n const disabled = 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,\n variant,\n theme,\n 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 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={isFullWidth}\n onClick={onClick}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onKeyDown={onKeyDown}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n type={type}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n {...metaAttribute({ name: MetaConstants.Button, testID })}\n {...getStyledProps(rest)}\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 </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","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","isLink","Boolean","childrenString","getStringFromReactText","disabled","__DEV__","prevLoading","usePrevious","React","useEffect","announce","_getProps","buttonTypography","renderElement","useMemo","defaultRel","_jsxs","StyledBaseButton","Object","assign","as","makeAccessible","role","metaAttribute","name","MetaConstants","Button","getStyledProps","_jsx","display","justifyContent","alignItems","position","zIndex","BaseSpinner","accessibilityLabel","flexDirection","flex","paddingRight","BaseText","fontWeight","textAlign","paddingLeft","BaseButton","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA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,CACvBC,UAAU,CAAC,QAAQ,CAAAvI,QAAA,CAEnBoI,GAAA,CAACxD,IAAI,CAAC1E,CAAAA,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAEuC,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CAAA,CACK,CAAC,CACA,CAAA,CAAA,CAAC,CAEvB,CAAC,CAEK,IAAAyH,UAAU,CAAGC,wBAAwB,CAACpC,cAAK,CAACqC,UAAU,CAACjF,WAAW,CAAC,CAAE,CACzEkF,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,oBAAA,CAAA,YAAA,CAAA,cAAA,CAAA,CAoGA,IAAMA,gBAAgB,CAAG,SAAnBA,gBAAgBA,CAAIC,IAAa,CAAiC,CACtE,GAAIC,aAAa,EAAE,CAAE,CACnB,OAAOC,SAAS,CAClB,CAEA,GAAIF,IAAI,CAAE,CACR,OAAO,GAAG,CACZ,CAEA,OAAO,QAAQ,CACjB,CAAC,CAEY,IAAAG,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,CAOK,CANvC,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CACPC,KAAK,CAAAH,IAAA,CAALG,KAAK,CACLC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CAIL,IAAMC,MAAM,CAAGF,KAAK,GAAK,OAAO,EAAIA,KAAK,GAAK,OAAO,CAAG,aAAa,CAAGA,KAAK,CAC7E,IAAMG,MAAM,CAAGC,eAAe,CAACN,QAAQ,CAAC,CAExC,GAAIG,KAA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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;;;;"}
|
|
@@ -17,7 +17,7 @@ import '../../BottomSheet/BottomSheetStack.js';
|
|
|
17
17
|
import { jsx } from 'react/jsx-runtime';
|
|
18
18
|
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
19
19
|
|
|
20
|
-
var _excluded=["onClick","href","onBlur","onKeyDown","children","variant","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID","onTouchStart","onTouchEnd","onPointerEnter","onPointerDown","onFocus"];var StyledPressable=styled(Animated.createAnimatedComponent(Pressable))(function(props){var styledPropsCSSObject=useStyledProps(props);return Object.assign({},getBaseButtonStyles(props),{alignSelf:'center',display:'flex'},styledPropsCSSObject);});var openURL=function(){var _ref=_asyncToGenerator(function*(href){try{var canOpen=yield Linking.canOpenURL(href);if(canOpen){yield Linking.openURL(href);}}catch(_unused){if(__DEV__){logger({type:'warn',message:`Could not open the link "href=${href}"`,moduleName:'BaseButton'});}}});return function openURL(_x){return _ref.apply(this,arguments);};}();var _StyledBaseButton=function _StyledBaseButton(_ref2,ref){var onClick=_ref2.onClick,href=_ref2.href;_ref2.onBlur;_ref2.onKeyDown;var _children=_ref2.children,variant=_ref2.variant,minHeight=_ref2.minHeight,buttonPaddingTop=_ref2.buttonPaddingTop,buttonPaddingBottom=_ref2.buttonPaddingBottom,buttonPaddingLeft=_ref2.buttonPaddingLeft,buttonPaddingRight=_ref2.buttonPaddingRight,isFullWidth=_ref2.isFullWidth,disabled=_ref2.disabled,defaultBackgroundColor=_ref2.defaultBackgroundColor,defaultBorderColor=_ref2.defaultBorderColor,hoverBackgroundColor=_ref2.hoverBackgroundColor,focusBackgroundColor=_ref2.focusBackgroundColor,focusRingColor=_ref2.focusRingColor,hoverBorderColor=_ref2.hoverBorderColor,focusBorderColor=_ref2.focusBorderColor,borderWidth=_ref2.borderWidth,borderRadius=_ref2.borderRadius,motionDuration=_ref2.motionDuration,motionEasing=_ref2.motionEasing,isLoading=_ref2.isLoading,accessibilityProps=_ref2.accessibilityProps,testID=_ref2.testID,onTouchStart=_ref2.onTouchStart,onTouchEnd=_ref2.onTouchEnd,onPointerEnter=_ref2.onPointerEnter,onPointerDown=_ref2.onPointerDown,onFocus=_ref2.onFocus,styledProps=_objectWithoutProperties(_ref2,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var isPressed=useSharedValue(false);var duration=getIn(theme.motion,motionDuration);var easing=getIn(theme.motion,motionEasing);var animatedStyles=useAnimatedStyle(function(){return Object.assign({backgroundColor:withTiming(isPressed.value?focusBackgroundColor:defaultBackgroundColor,{duration:duration,easing:easing})},variant!=='tertiary'&&{borderColor:withTiming(isPressed.value?focusBorderColor:defaultBorderColor,{duration:duration,easing:easing})});});var handleOnPress=function handleOnPress(event){if(href){void openURL(href);}if(onClick){onClick(event);}};return jsx(StyledPressable,Object.assign({},styledProps,accessibilityProps,{ref:ref,role:"button",onTouchStart:castNativeType(onTouchStart),onTouchEnd:castNativeType(onTouchEnd),onPointerEnter:castNativeType(onPointerEnter),onPointerDown:castNativeType(onPointerDown),onFocus:castNativeType(onFocus),isLoading:isLoading,onPress:handleOnPress,style:animatedStyles,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,isFullWidth:isFullWidth,disabled:disabled,defaultBackgroundColor:defaultBackgroundColor,defaultBorderColor:defaultBorderColor,hoverBackgroundColor:hoverBackgroundColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,focusBorderColor:focusBorderColor,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,testID:testID,children:function children(_ref3){var pressed=_ref3.pressed;isPressed.value=pressed;return _children;}}));};var StyledBaseButton=assignWithoutSideEffects(React__default.forwardRef(_StyledBaseButton),{displayName:'StyledBaseButton'});
|
|
20
|
+
var _excluded=["onClick","href","onBlur","onKeyDown","children","variant","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID","onTouchStart","onTouchEnd","onPointerEnter","onPointerDown","onFocus"];var StyledPressable=styled(Animated.createAnimatedComponent(Pressable))(function(props){var styledPropsCSSObject=useStyledProps(props);return Object.assign({},getBaseButtonStyles(props),{alignSelf:'center',display:'flex',flexDirection:'row'},styledPropsCSSObject);});var openURL=function(){var _ref=_asyncToGenerator(function*(href){try{var canOpen=yield Linking.canOpenURL(href);if(canOpen){yield Linking.openURL(href);}}catch(_unused){if(__DEV__){logger({type:'warn',message:`Could not open the link "href=${href}"`,moduleName:'BaseButton'});}}});return function openURL(_x){return _ref.apply(this,arguments);};}();var _StyledBaseButton=function _StyledBaseButton(_ref2,ref){var onClick=_ref2.onClick,href=_ref2.href;_ref2.onBlur;_ref2.onKeyDown;var _children=_ref2.children,variant=_ref2.variant,minHeight=_ref2.minHeight,buttonPaddingTop=_ref2.buttonPaddingTop,buttonPaddingBottom=_ref2.buttonPaddingBottom,buttonPaddingLeft=_ref2.buttonPaddingLeft,buttonPaddingRight=_ref2.buttonPaddingRight,isFullWidth=_ref2.isFullWidth,disabled=_ref2.disabled,defaultBackgroundColor=_ref2.defaultBackgroundColor,defaultBorderColor=_ref2.defaultBorderColor,hoverBackgroundColor=_ref2.hoverBackgroundColor,focusBackgroundColor=_ref2.focusBackgroundColor,focusRingColor=_ref2.focusRingColor,hoverBorderColor=_ref2.hoverBorderColor,focusBorderColor=_ref2.focusBorderColor,borderWidth=_ref2.borderWidth,borderRadius=_ref2.borderRadius,motionDuration=_ref2.motionDuration,motionEasing=_ref2.motionEasing,isLoading=_ref2.isLoading,accessibilityProps=_ref2.accessibilityProps,testID=_ref2.testID,onTouchStart=_ref2.onTouchStart,onTouchEnd=_ref2.onTouchEnd,onPointerEnter=_ref2.onPointerEnter,onPointerDown=_ref2.onPointerDown,onFocus=_ref2.onFocus,styledProps=_objectWithoutProperties(_ref2,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var isPressed=useSharedValue(false);var duration=getIn(theme.motion,motionDuration);var easing=getIn(theme.motion,motionEasing);var animatedStyles=useAnimatedStyle(function(){return Object.assign({backgroundColor:withTiming(isPressed.value?focusBackgroundColor:defaultBackgroundColor,{duration:duration,easing:easing})},variant!=='tertiary'&&{borderColor:withTiming(isPressed.value?focusBorderColor:defaultBorderColor,{duration:duration,easing:easing})});});var handleOnPress=function handleOnPress(event){if(href){void openURL(href);}if(onClick){onClick(event);}};return jsx(StyledPressable,Object.assign({},styledProps,accessibilityProps,{ref:ref,role:"button",onTouchStart:castNativeType(onTouchStart),onTouchEnd:castNativeType(onTouchEnd),onPointerEnter:castNativeType(onPointerEnter),onPointerDown:castNativeType(onPointerDown),onFocus:castNativeType(onFocus),isLoading:isLoading,onPress:handleOnPress,style:animatedStyles,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,isFullWidth:isFullWidth,disabled:disabled,defaultBackgroundColor:defaultBackgroundColor,defaultBorderColor:defaultBorderColor,hoverBackgroundColor:hoverBackgroundColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,focusBorderColor:focusBorderColor,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,testID:testID,children:function children(_ref3){var pressed=_ref3.pressed;isPressed.value=pressed;return _children;}}));};var StyledBaseButton=assignWithoutSideEffects(React__default.forwardRef(_StyledBaseButton),{displayName:'StyledBaseButton'});
|
|
21
21
|
|
|
22
22
|
export { StyledBaseButton as default };
|
|
23
23
|
//# sourceMappingURL=StyledBaseButton.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledBaseButton.native.js","sources":["../../../../../../src/components/Button/BaseButton/StyledBaseButton.native.tsx"],"sourcesContent":["import { Linking, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport styled from 'styled-components/native';\nimport React from 'react';\nimport type { TextInput, GestureResponderEvent } from 'react-native';\nimport getStyledBaseButtonStyles from './getStyledBaseButtonStyles';\nimport type { StyledBaseButtonProps } from './types';\nimport getIn from '~utils/lodashButBetter/get';\nimport { useStyledProps } from '~components/Box/styledProps';\nimport { useTheme } from '~components/BladeProvider';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { logger } from '~utils/logger';\nimport { castNativeType } from '~utils';\n\nconst StyledPressable = styled(Animated.createAnimatedComponent(Pressable))<\n Omit<StyledBaseButtonProps, 'accessibilityProps'>\n>((props) => {\n const styledPropsCSSObject = useStyledProps(props);\n\n return {\n ...getStyledBaseButtonStyles(props),\n alignSelf: 'center',\n display: 'flex',\n ...styledPropsCSSObject,\n };\n});\n\nconst openURL = async (href: string): Promise<void> => {\n try {\n const canOpen = await Linking.canOpenURL(href);\n if (canOpen) {\n await Linking.openURL(href);\n }\n } catch {\n if (__DEV__) {\n logger({\n type: 'warn',\n message: `Could not open the link \"href=${href}\"`,\n moduleName: 'BaseButton',\n });\n }\n }\n};\n\nconst _StyledBaseButton: React.ForwardRefRenderFunction<TextInput, StyledBaseButtonProps> = (\n {\n onClick,\n href,\n onBlur,\n onKeyDown,\n children,\n variant,\n minHeight,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n isFullWidth,\n disabled,\n defaultBackgroundColor,\n defaultBorderColor,\n hoverBackgroundColor,\n focusBackgroundColor,\n focusRingColor,\n hoverBorderColor,\n focusBorderColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n isLoading,\n accessibilityProps,\n testID,\n onTouchStart,\n onTouchEnd,\n onPointerEnter,\n onPointerDown,\n onFocus,\n ...styledProps\n },\n ref,\n) => {\n const { theme } = useTheme();\n const isPressed = useSharedValue(false);\n const duration = getIn(theme.motion, motionDuration);\n const easing = getIn(theme.motion, motionEasing);\n\n const animatedStyles = useAnimatedStyle(() => {\n return {\n backgroundColor: withTiming(isPressed.value ? focusBackgroundColor : defaultBackgroundColor, {\n duration,\n easing,\n }),\n ...(variant !== 'tertiary' && {\n borderColor: withTiming(isPressed.value ? focusBorderColor : defaultBorderColor, {\n duration,\n easing,\n }),\n }),\n };\n });\n\n const handleOnPress = (event: GestureResponderEvent): void => {\n if (href) {\n void openURL(href);\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <StyledPressable\n {...styledProps}\n {...accessibilityProps}\n ref={ref}\n role=\"button\"\n onTouchStart={castNativeType(onTouchStart)}\n onTouchEnd={castNativeType(onTouchEnd)}\n onPointerEnter={castNativeType(onPointerEnter)}\n onPointerDown={castNativeType(onPointerDown)}\n onFocus={castNativeType(onFocus)}\n isLoading={isLoading}\n onPress={handleOnPress}\n style={animatedStyles}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n isFullWidth={isFullWidth}\n disabled={disabled}\n defaultBackgroundColor={defaultBackgroundColor}\n defaultBorderColor={defaultBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n focusBorderColor={focusBorderColor}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n testID={testID}\n >\n {({ pressed }): React.ReactNode => {\n isPressed.value = pressed;\n return children;\n }}\n </StyledPressable>\n );\n};\n\nconst StyledBaseButton = assignWithoutSideEffects(React.forwardRef(_StyledBaseButton), {\n displayName: 'StyledBaseButton',\n});\n\nexport default StyledBaseButton;\n"],"names":["StyledPressable","styled","Animated","createAnimatedComponent","Pressable","props","styledPropsCSSObject","useStyledProps","Object","assign","getStyledBaseButtonStyles","alignSelf","display","openURL","_ref","_asyncToGenerator","href","canOpen","Linking","canOpenURL","_unused","__DEV__","logger","type","message","moduleName","_x","apply","arguments","_StyledBaseButton","_ref2","ref","onClick","onBlur","onKeyDown","children","variant","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID","onTouchStart","onTouchEnd","onPointerEnter","onPointerDown","onFocus","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","isPressed","useSharedValue","duration","getIn","motion","easing","animatedStyles","useAnimatedStyle","backgroundColor","withTiming","value","borderColor","handleOnPress","event","_jsx","role","castNativeType","onPress","style","_ref3","pressed","StyledBaseButton","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,SAAA,CAAA,MAAA,CAAA,QAAA,CAAA,WAAA,CAAA,UAAA,CAAA,SAAA,CAAA,WAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,UAAA,CAAA,wBAAA,CAAA,oBAAA,CAAA,sBAAA,CAAA,sBAAA,CAAA,gBAAA,CAAA,kBAAA,CAAA,kBAAA,CAAA,aAAA,CAAA,cAAA,CAAA,gBAAA,CAAA,cAAA,CAAA,WAAA,CAAA,oBAAA,CAAA,QAAA,CAAA,cAAA,CAAA,YAAA,CAAA,gBAAA,CAAA,eAAA,CAAA,SAAA,CAAA,CAcA,IAAMA,eAAe,CAAGC,MAAM,CAACC,QAAQ,CAACC,uBAAuB,CAACC,SAAS,CAAC,CAAC,CAEzE,SAACC,KAAK,CAAK,CACX,IAAMC,oBAAoB,CAAGC,cAAc,CAACF,KAAK,CAAC,CAElD,OAAAG,MAAA,CAAAC,MAAA,IACKC,mBAAyB,CAACL,KAAK,CAAC,EACnCM,SAAS,CAAE,QAAQ,CACnBC,OAAO,CAAE,MAAM,CAAA,CACZN,oBAAoB,CAE3B,CAAA,CAAC,CAAC,CAEF,IAAMO,OAAO,CAAA,UAAA,CAAA,IAAAC,IAAA,CAAAC,iBAAA,CAAG,UAAOC,IAAY,CAAoB,CACrD,GAAI,CACF,IAAMC,OAAO,CAAS,MAAAC,OAAO,CAACC,UAAU,CAACH,IAAI,CAAC,CAC9C,GAAIC,OAAO,CAAE,CACX,MAAMC,OAAO,CAACL,OAAO,CAACG,IAAI,CAAC,CAC7B,CACF,CAAE,MAAAI,OAAA,CAAM,CACN,GAAIC,OAAO,CAAE,CACXC,MAAM,CAAC,CACLC,IAAI,CAAE,MAAM,CACZC,OAAO,CAAG,iCAAgCR,IA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CAEd,SAAAA,SAAAqD,KAAA,CAAkC,KAA/BC,OAAO,CAAAD,KAAA,CAAPC,OAAO,CACTpB,SAAS,CAACU,KAAK,CAAGU,OAAO,CACzB,OAAOtD,SAAQ,CACjB,CAAC,CACc,CAAA,CAAC,CAEtB,CAAC,CAEK,IAAAuD,gBAAgB,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAChE,iBAAiB,CAAC,CAAE,CACrFiE,WAAW,CAAE,kBACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"StyledBaseButton.native.js","sources":["../../../../../../src/components/Button/BaseButton/StyledBaseButton.native.tsx"],"sourcesContent":["import { Linking, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport styled from 'styled-components/native';\nimport React from 'react';\nimport type { TextInput, GestureResponderEvent } from 'react-native';\nimport getStyledBaseButtonStyles from './getStyledBaseButtonStyles';\nimport type { StyledBaseButtonProps } from './types';\nimport getIn from '~utils/lodashButBetter/get';\nimport { useStyledProps } from '~components/Box/styledProps';\nimport { useTheme } from '~components/BladeProvider';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { logger } from '~utils/logger';\nimport { castNativeType } from '~utils';\n\nconst StyledPressable = styled(Animated.createAnimatedComponent(Pressable))<\n Omit<StyledBaseButtonProps, 'accessibilityProps'>\n>((props) => {\n const styledPropsCSSObject = useStyledProps(props);\n\n return {\n ...getStyledBaseButtonStyles(props),\n alignSelf: 'center',\n display: 'flex',\n flexDirection: 'row',\n ...styledPropsCSSObject,\n };\n});\n\nconst openURL = async (href: string): Promise<void> => {\n try {\n const canOpen = await Linking.canOpenURL(href);\n if (canOpen) {\n await Linking.openURL(href);\n }\n } catch {\n if (__DEV__) {\n logger({\n type: 'warn',\n message: `Could not open the link \"href=${href}\"`,\n moduleName: 'BaseButton',\n });\n }\n }\n};\n\nconst _StyledBaseButton: React.ForwardRefRenderFunction<TextInput, StyledBaseButtonProps> = (\n {\n onClick,\n href,\n onBlur,\n onKeyDown,\n children,\n variant,\n minHeight,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n isFullWidth,\n disabled,\n defaultBackgroundColor,\n defaultBorderColor,\n hoverBackgroundColor,\n focusBackgroundColor,\n focusRingColor,\n hoverBorderColor,\n focusBorderColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n isLoading,\n accessibilityProps,\n testID,\n onTouchStart,\n onTouchEnd,\n onPointerEnter,\n onPointerDown,\n onFocus,\n ...styledProps\n },\n ref,\n) => {\n const { theme } = useTheme();\n const isPressed = useSharedValue(false);\n const duration = getIn(theme.motion, motionDuration);\n const easing = getIn(theme.motion, motionEasing);\n\n const animatedStyles = useAnimatedStyle(() => {\n return {\n backgroundColor: withTiming(isPressed.value ? focusBackgroundColor : defaultBackgroundColor, {\n duration,\n easing,\n }),\n ...(variant !== 'tertiary' && {\n borderColor: withTiming(isPressed.value ? focusBorderColor : defaultBorderColor, {\n duration,\n easing,\n }),\n }),\n };\n });\n\n const handleOnPress = (event: GestureResponderEvent): void => {\n if (href) {\n void openURL(href);\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <StyledPressable\n {...styledProps}\n {...accessibilityProps}\n ref={ref}\n role=\"button\"\n onTouchStart={castNativeType(onTouchStart)}\n onTouchEnd={castNativeType(onTouchEnd)}\n onPointerEnter={castNativeType(onPointerEnter)}\n onPointerDown={castNativeType(onPointerDown)}\n onFocus={castNativeType(onFocus)}\n isLoading={isLoading}\n onPress={handleOnPress}\n style={animatedStyles}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n isFullWidth={isFullWidth}\n disabled={disabled}\n defaultBackgroundColor={defaultBackgroundColor}\n defaultBorderColor={defaultBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n focusBorderColor={focusBorderColor}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n testID={testID}\n >\n {({ pressed }): React.ReactNode => {\n isPressed.value = pressed;\n return children;\n }}\n </StyledPressable>\n );\n};\n\nconst StyledBaseButton = assignWithoutSideEffects(React.forwardRef(_StyledBaseButton), {\n displayName: 'StyledBaseButton',\n});\n\nexport default StyledBaseButton;\n"],"names":["StyledPressable","styled","Animated","createAnimatedComponent","Pressable","props","styledPropsCSSObject","useStyledProps","Object","assign","getStyledBaseButtonStyles","alignSelf","display","flexDirection","openURL","_ref","_asyncToGenerator","href","canOpen","Linking","canOpenURL","_unused","__DEV__","logger","type","message","moduleName","_x","apply","arguments","_StyledBaseButton","_ref2","ref","onClick","onBlur","onKeyDown","children","variant","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID","onTouchStart","onTouchEnd","onPointerEnter","onPointerDown","onFocus","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","isPressed","useSharedValue","duration","getIn","motion","easing","animatedStyles","useAnimatedStyle","backgroundColor","withTiming","value","borderColor","handleOnPress","event","_jsx","role","castNativeType","onPress","style","_ref3","pressed","StyledBaseButton","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,SAAA,CAAA,MAAA,CAAA,QAAA,CAAA,WAAA,CAAA,UAAA,CAAA,SAAA,CAAA,WAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,UA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AK,CAACC,UAAU,CAAChE,iBAAiB,CAAC,CAAE,CACrFiE,WAAW,CAAE,kBACf,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,eAAeA,CAAIC,QAAiC,CAAK,CAC7D,IAAMC,QAAQ,CAAGD,QAAQ,GAAK,QAAQ,CACtC,OAAO,CACLE,IAAI,CAAE,CACJC,OAAO,CAAE,CACPC,OAAO,CAAG,CAAcJ,YAAAA,EAAAA,QAAS,CAAiB,gBAAA,CAAA,CAClDK,WAAW,CAAG,eAAcL,QAAS,CAAA,oBAAA,CAAqB,CAC1DM,QAAQ,CAAG,eAAcN,QAAS,CAAA,iBAAA,CACpC,CAAC,CACDO,SAAS,CAAE,CACTH,OAAO,CAAEH,QAAQ,CAAG,oCAAoC,CAAG,aAAa,CACxEI,WAAW,CAAEJ,QAAQ,CAChB,oCAAmC,CACnC,CAAA,oCAAA,CAAqC,CAC1CK,QAAQ,CAAEL,QAAQ,CAAI,CAAA,mCAAA,CAAoC,CAAI,CAAA,WAAA,CAChE,CAAC,CACDO,QAAQ,CAAE,CACRJ,OAAO,CAAG,CAAA,YAAA,EAAcJ,QAAS,CAAc,aAAA,CAAA,CAC/CK,WAAW,CAAG,CAAcL,YAAAA,EAAAA,QAAS,mBAAkB,CACvDM,QAAQ,CAAG,CAAcN,YAAAA,EAAAA,QAAS,gBACpC,CACF,CAAC,CACDS,KAAK,CAAE,CACLN,OAAO,CAAE,CACPC,OAAO,CAAG,CAAA,YAAA,EAAcJ,QAAS,CAAqB,oBAAA,CAAA,CACtDK,WAAW,CAAG,CAAcL,YAAAA,EAAAA,QAAS,0BAAyB,CAC9DM,QAAQ,CAAG,CAAcN,YAAAA,EAAAA,QAAS,uBACpC,CAAC,CACDO,SAAS,CAAE,CACTH,OAAO,CAAEH,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":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","buttonSizeToSpinnerSizeMap","buttonIconPadding"],"mappings":";;;;;;;;;AAsBM,IAAAA,eAAe,CAAG,SAAlBA,eAAeA,CAAIC,QAAiC,CAAK,CAC7D,IAAMC,QAAQ,CAAGD,QAAQ,GAAK,QAAQ,CACtC,OAAO,CACLE,IAAI,CAAE,CACJC,OAAO,CAAE,CACPC,OAAO,CAAG,eAAcJ,QAAS,CAAA,gBAAA,CAAiB,CAClDK,WAAW,CAAG,eAAcL,QAAS,CAAA,oBAAA,CAAqB,CAC1DM,QAAQ,CAAG,CAAA,YAAA,EAAcN,QAAS,CACpC,iBAAA,CAAA,CAAC,CACDO,SAAS,CAAE,CACTH,OAAO,CAAEH,QAAQ,CAAG,oCAAoC,CAAG,aAAa,CACxEI,WAAW,CAAEJ,QAAQ,CAChB,CAAmC,kCAAA,CAAA,CACnC,CAAqC,oCAAA,CAAA,CAC1CK,QAAQ,CAAEL,QAAQ,CAAI,CAAA,mCAAA,CAAoC,CAAI,CAChE,WAAA,CAAA,CAAC,CACDO,QAAQ,CAAE,CACRJ,OAAO,CAAG,eAAcJ,QAAS,CAAA,aAAA,CAAc,CAC/CK,WAAW,CAAG,eAAcL,QAAS,CAAA,iBAAA,CAAkB,CACvDM,QAAQ,CAAG,CAAA,YAAA,EAAcN,QAAS,CACpC,cAAA,CAAA,CACF,CAAC,CACDS,KAAK,CAAE,CACLN,OAAO,CAAE,CACPC,OAAO,CAAG,CAAcJ,YAAAA,EAAAA,QAAS,sBAAqB,CACtDK,WAAW,CAAG,CAAcL,YAAAA,EAAAA,QAAS,CAAyB,wBAAA,CAAA,CAC9DM,QAAQ,CAAG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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,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,S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tonGroup(_props){throwBladeError({message:'ButtonGroup is not yet implemented for React Native',moduleName:'ButtonGroup'});return jsx(Fragment,{});};
|
|
5
|
+
|
|
6
|
+
export { ButtonGroup };
|
|
7
|
+
//# sourceMappingURL=ButtonGroup.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonGroup.native.js","sources":["../../../../../src/components/ButtonGroup/ButtonGroup.native.tsx"],"sourcesContent":["import type { ButtonGroupProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\nconst ButtonGroup = (_props: ButtonGroupProps): React.ReactElement => {\n throwBladeError({\n message: 'ButtonGroup is not yet implemented for React Native',\n moduleName: 'ButtonGroup',\n });\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <></>;\n};\n\nexport { ButtonGroup };\n"],"names":["ButtonGroup","_props","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAGM,IAAAA,WAAW,CAAG,SAAdA,WAAWA,CAAIC,MAAwB,CAAyB,CACpEC,eAAe,CAAC,CACdC,OAAO,CAAE,qDAAqD,CAC9DC,UAAU,CAAE,aACd,CAAC,CAAC,CAGF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
var ButtonGroupContext=React__default.createContext({});ButtonGroupContext.Provider;var useButtonGroupContext=function useButtonGroupContext(){var context=React__default.useContext(ButtonGroupContext);return context;};
|
|
4
|
+
|
|
5
|
+
export { useButtonGroupContext };
|
|
6
|
+
//# sourceMappingURL=ButtonGroupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonGroupContext.js","sources":["../../../../../src/components/ButtonGroup/ButtonGroupContext.tsx"],"sourcesContent":["import React from 'react';\nimport type { ButtonGroupContextType } from './types';\n\nconst ButtonGroupContext = React.createContext<ButtonGroupContextType>({});\nconst ButtonGroupProvider = ButtonGroupContext.Provider;\n\nconst useButtonGroupContext = (): ButtonGroupContextType => {\n const context = React.useContext(ButtonGroupContext);\n return context;\n};\n\nexport { useButtonGroupContext, ButtonGroupProvider };\n"],"names":["ButtonGroupContext","React","createContext","Provider","useButtonGroupContext","context","useContext"],"mappings":";;AAGA,IAAMA,kBAAkB,CAAGC,cAAK,CAACC,aAAa,CAAyB,EAAE,CAAC,CAC9CF,kBAAkB,CAACG,SAEzC,IAAAC,qBAAqB,CAAG,SAAxBA,qBAAqBA,EAAiC,CAC1D,IAAMC,OAAO,CAAGJ,cAAK,CAACK,UAAU,CAACN,kBAAkB,CAAC,CACpD,OAAOK,OAAO,CAChB;;;;"}
|