@razorpay/blade 9.5.1 → 9.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/index.d.ts +95 -78
- package/build/components/index.development.web.js +1555 -1331
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +118 -77
- package/build/components/index.native.js +50 -48
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +1289 -1285
- package/build/components/index.production.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/build/tokens/index.development.web.js +55 -4
- package/build/tokens/index.development.web.js.map +1 -1
- package/build/tokens/index.native.js +4 -2
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.production.web.js.map +1 -1
- package/build/utils/index.d.ts +8 -4
- package/build/utils/index.development.web.js +24 -3
- package/build/utils/index.development.web.js.map +1 -1
- package/build/utils/index.native.d.ts +8 -4
- package/build/utils/index.native.js +4 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.production.web.js.map +1 -1
- package/package.json +1 -1
|
@@ -41,7 +41,9 @@ var deviceType={desktop:'desktop',mobile:'mobile'};var useBreakpoint=function us
|
|
|
41
41
|
|
|
42
42
|
var colorSchemeNamesInput=['light','dark','system'];
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var PREFIX='[Blade]:';var throwBladeError=function throwBladeError(_ref){var message=_ref.message,moduleName=_ref.moduleName;if(__DEV__){var prefix=moduleName?"[Blade: "+moduleName+"]:":PREFIX;throw new Error(prefix+" "+message);}};var getCommonLogger=function getCommonLogger(type){switch(type){case'error':return console.error;case'warn':return console.warn;case'log':default:return console.log;}};var logger=function logger(_ref2){var message=_ref2.message,moduleName=_ref2.moduleName,type=_ref2.type;if(__DEV__){var prefix=moduleName?"[Blade: "+moduleName+"]:":PREFIX;getCommonLogger(type)(prefix+" "+message);}};
|
|
45
|
+
|
|
46
|
+
var useColorScheme=function useColorScheme(){var initialColorScheme=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'light';var _useState=useState(function(){return getColorScheme(initialColorScheme);}),_useState2=_slicedToArray(_useState,2),colorSchemeState=_useState2[0],setColorSchemeState=_useState2[1];var setColorScheme=useCallback(function setThemeMode(colorScheme){if(__DEV__){if(!colorSchemeNamesInput.includes(colorScheme)){throwBladeError({message:"Expected color scheme to be one of ["+colorSchemeNamesInput.toString()+"] but received "+colorScheme,moduleName:'useColorScheme'});}}setColorSchemeState(getColorScheme(colorScheme));},[]);return {colorScheme:colorSchemeState,setColorScheme:setColorScheme};};
|
|
45
47
|
|
|
46
48
|
var isReactNative$4=function isReactNative(){return getPlatformType()==='react-native';};
|
|
47
49
|
|
|
@@ -61,7 +63,7 @@ var toTitleCase=function toTitleCase(inputString){return inputString.toLowerCase
|
|
|
61
63
|
|
|
62
64
|
function usePrevious(value){var ref=useRef();useEffect(function(){ref.current=value;},[value]);return ref.current;}
|
|
63
65
|
|
|
64
|
-
var ThemeContext=createContext({theme:null,colorScheme:'light',platform:'onDesktop',setColorScheme:function setColorScheme(){return null;}});var useTheme=function useTheme(){var themeContext=useContext(ThemeContext);if(__DEV__){if(!themeContext.theme){
|
|
66
|
+
var ThemeContext=createContext({theme:null,colorScheme:'light',platform:'onDesktop',setColorScheme:function setColorScheme(){return null;}});var useTheme=function useTheme(){var themeContext=useContext(ThemeContext);if(__DEV__){if(!themeContext.theme){throwBladeError({message:'BladeProvider is missing theme',moduleName:'BladeProvider'});}if(themeContext===undefined){throwBladeError({message:'useTheme must be used within BladeProvider',moduleName:'BladeProvider'});}}return themeContext;};
|
|
65
67
|
|
|
66
68
|
var BottomSheetContext=React__default.createContext({headerHeight:0,contentHeight:0,footerHeight:0,isHeaderFloating:false,setContentHeight:function setContentHeight(){},setHeaderHeight:function setHeaderHeight(){},setFooterHeight:function setFooterHeight(){},setHasBodyPadding:function setHasBodyPadding(){},setIsHeaderEmpty:function setIsHeaderEmpty(){},close:function close(){},scrollRef:null,bind:null,isOpen:false,positionY:0,isInBottomSheet:false,defaultInitialFocusRef:{current:null}});var useBottomSheetContext=function useBottomSheetContext(){var state=React__default.useContext(BottomSheetContext);return state;};var BottomSheetAndDropdownGlueContext=React__default.createContext(null);var useBottomSheetAndDropdownGlue=function useBottomSheetAndDropdownGlue(){var state=React__default.useContext(BottomSheetAndDropdownGlueContext);return state;};
|
|
67
69
|
|
|
@@ -73,7 +75,7 @@ var componentIds={ActionList:'ActionList',ActionListItem:'ActionListItem',Action
|
|
|
73
75
|
|
|
74
76
|
var getComponentId=function getComponentId(component){var _component$props,_component$props2,_component$props2$ori,_component$type;if(!React__default.isValidElement(component))return null;if(component!=null&&(_component$props=component.props)!=null&&_component$props.mdxType&&component!=null&&(_component$props2=component.props)!=null&&(_component$props2$ori=_component$props2.originalType)!=null&&_component$props2$ori.componentId){return component.props.originalType.componentId;}return (_component$type=component.type)==null?void 0:_component$type.componentId;};var isValidAllowedChildren=function isValidAllowedChildren(component,id){return getComponentId(component)===id;};
|
|
75
77
|
|
|
76
|
-
var getActionListSectionPosition=function getActionListSectionPosition(children){var childComponentIdArray=React__default.Children.toArray(children).map(function(child){return getComponentId(child);});var lastActionListSectionIndex=childComponentIdArray.lastIndexOf(componentIds.ActionListSection);var isActionListItemPresentAfterSection=childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds.ActionListItem);return {isActionListItemPresentAfterSection:isActionListItemPresentAfterSection,lastActionListSectionIndex:lastActionListSectionIndex};};var actionListAllowedChildren=[componentIds.ActionListItem,componentIds.ActionListSection];var getActionListProperties=function getActionListProperties(children){var sectionData=[];var currentSection=null;var actionListOptions=[];var getActionListItemWithId=function getActionListItemWithId(child,hideDivider){if(React__default.isValidElement(child)&&!child.props.isDisabled){actionListOptions.push({title:child.props.title,value:child.props.value,onClickTrigger:function onClickTrigger(value){var _child$props$isSelect;var anchorLink=child.props.href;child.props.onClick==null?void 0:child.props.onClick({name:child.props.value,value:(_child$props$isSelect=child.props.isSelected)!=null?_child$props$isSelect:value});if(anchorLink&&!isReactNative$4()){var _child$props$target;var target=(_child$props$target=child.props.target)!=null?_child$props$target:'_self';window.open(anchorLink,target);if(window.top){window.top.open(anchorLink,target);}}}});var currentIndex=actionListOptions.length-1;var foundSection=sectionData.find(function(v){return v.title===currentSection;});if(foundSection){foundSection==null?void 0:foundSection.data.push(_extends({},child.props,{_index:currentIndex}));}else {sectionData.push({title:currentSection,hideDivider:hideDivider,data:[_extends({},child.props,{_index:currentIndex})]});}var clonedChild=React__default.cloneElement(child,{_index:currentIndex});return clonedChild;}return child;};var isActionListItemPresentAfterSection;var lastActionListSectionIndex;if(isReactNative$4()){var _getActionListSection=getActionListSectionPosition(children);isActionListItemPresentAfterSection=_getActionListSection.isActionListItemPresentAfterSection;lastActionListSectionIndex=_getActionListSection.lastActionListSectionIndex;}var childrenWithId=React__default.Children.map(children,function(child,index){if(React__default.isValidElement(child)){if(isValidAllowedChildren(child,componentIds.ActionListSection)){var shouldHideDivider=index===lastActionListSectionIndex&&!isActionListItemPresentAfterSection;return React__default.cloneElement(child,{children:React__default.Children.map(child.props.children,function(childInSection){currentSection=child.props.title;if(isValidAllowedChildren(childInSection,componentIds.ActionListItem)){return getActionListItemWithId(childInSection,shouldHideDivider);}return childInSection;}),_hideDivider:isReactNative$4()?shouldHideDivider:undefined});}if(isValidAllowedChildren(child,componentIds.ActionListItem)){return getActionListItemWithId(child,true);}if(__DEV__){
|
|
78
|
+
var getActionListSectionPosition=function getActionListSectionPosition(children){var childComponentIdArray=React__default.Children.toArray(children).map(function(child){return getComponentId(child);});var lastActionListSectionIndex=childComponentIdArray.lastIndexOf(componentIds.ActionListSection);var isActionListItemPresentAfterSection=childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds.ActionListItem);return {isActionListItemPresentAfterSection:isActionListItemPresentAfterSection,lastActionListSectionIndex:lastActionListSectionIndex};};var actionListAllowedChildren=[componentIds.ActionListItem,componentIds.ActionListSection];var getActionListProperties=function getActionListProperties(children){var sectionData=[];var currentSection=null;var actionListOptions=[];var getActionListItemWithId=function getActionListItemWithId(child,hideDivider){if(React__default.isValidElement(child)&&!child.props.isDisabled){actionListOptions.push({title:child.props.title,value:child.props.value,onClickTrigger:function onClickTrigger(value){var _child$props$isSelect;var anchorLink=child.props.href;child.props.onClick==null?void 0:child.props.onClick({name:child.props.value,value:(_child$props$isSelect=child.props.isSelected)!=null?_child$props$isSelect:value});if(anchorLink&&!isReactNative$4()){var _child$props$target;var target=(_child$props$target=child.props.target)!=null?_child$props$target:'_self';window.open(anchorLink,target);if(window.top){window.top.open(anchorLink,target);}}}});var currentIndex=actionListOptions.length-1;var foundSection=sectionData.find(function(v){return v.title===currentSection;});if(foundSection){foundSection==null?void 0:foundSection.data.push(_extends({},child.props,{_index:currentIndex}));}else {sectionData.push({title:currentSection,hideDivider:hideDivider,data:[_extends({},child.props,{_index:currentIndex})]});}var clonedChild=React__default.cloneElement(child,{_index:currentIndex});return clonedChild;}return child;};var isActionListItemPresentAfterSection;var lastActionListSectionIndex;if(isReactNative$4()){var _getActionListSection=getActionListSectionPosition(children);isActionListItemPresentAfterSection=_getActionListSection.isActionListItemPresentAfterSection;lastActionListSectionIndex=_getActionListSection.lastActionListSectionIndex;}var childrenWithId=React__default.Children.map(children,function(child,index){if(React__default.isValidElement(child)){if(isValidAllowedChildren(child,componentIds.ActionListSection)){var shouldHideDivider=index===lastActionListSectionIndex&&!isActionListItemPresentAfterSection;return React__default.cloneElement(child,{children:React__default.Children.map(child.props.children,function(childInSection){currentSection=child.props.title;if(isValidAllowedChildren(childInSection,componentIds.ActionListItem)){return getActionListItemWithId(childInSection,shouldHideDivider);}return childInSection;}),_hideDivider:isReactNative$4()?shouldHideDivider:undefined});}if(isValidAllowedChildren(child,componentIds.ActionListItem)){return getActionListItemWithId(child,true);}if(__DEV__){throwBladeError({message:"Only "+actionListAllowedChildren.join(', ')+" supported inside ActionList",moduleName:'ActionList'});}}return child;});return {sectionData:sectionData,childrenWithId:childrenWithId,actionListOptions:actionListOptions};};var validateActionListItemProps=function validateActionListItemProps(_ref){var leading=_ref.leading,trailing=_ref.trailing;if(__DEV__){React__default.Children.map(trailing,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)){throwBladeError({message:"Only "+componentIds.ActionListItemIcon+" and "+componentIds.ActionListItemText+" are allowed in trailing prop",moduleName:'ActionListItem'});}});React__default.Children.map(leading,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)&&!isValidAllowedChildren(child,componentIds.ActionListItemAsset)){throwBladeError({message:"Only "+componentIds.ActionListItemIcon+", "+componentIds.ActionListItemAsset+", and "+componentIds.ActionListItemText+" are allowed in leading prop",moduleName:'ActionListItem'});}});}};var getNormalTextColor=function getNormalTextColor(isDisabled){var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},isMuted=_ref2.isMuted;if(isDisabled){return 'surface.text.placeholder.lowContrast';}if(isMuted){return 'surface.text.muted.lowContrast';}return 'surface.text.normal.lowContrast';};
|
|
77
79
|
|
|
78
80
|
var getBaseListBoxWrapperStyles=function getBaseListBoxWrapperStyles(props){return {maxHeight:props.isInBottomSheet?undefined:makeSize(size[300]),padding:props.isInBottomSheet?undefined:makeSize(props.theme.spacing[3])};};
|
|
79
81
|
|
|
@@ -1975,7 +1977,7 @@ var MetaConstants={Accordion:'accordion',AccordionButton:'accordion-button',Acco
|
|
|
1975
1977
|
|
|
1976
1978
|
var metaAttribute=function metaAttribute(_ref){var testID=_ref.testID,name=_ref.name;return _extends({},name?_defineProperty({},"data-"+MetaConstants.Component,name):{},testID?{testID:testID}:{});};
|
|
1977
1979
|
|
|
1978
|
-
var useBladeProvider=function useBladeProvider(_ref){var themeTokens=_ref.themeTokens,initialColorScheme=_ref.initialColorScheme;if(__DEV__){if(!themeTokens){
|
|
1980
|
+
var useBladeProvider=function useBladeProvider(_ref){var themeTokens=_ref.themeTokens,initialColorScheme=_ref.initialColorScheme;if(__DEV__){if(!themeTokens){throwBladeError({message:"Expected valid themeTokens of type ThemeTokens to be passed but found "+typeof themeTokens,moduleName:'BladeProvider'});}if(initialColorScheme&&!colorSchemeNamesInput.includes(initialColorScheme)){throwBladeError({message:"Expected color scheme to be one of ["+colorSchemeNamesInput.toString()+"] but received "+initialColorScheme,moduleName:'BladeProvider'});}}var _useColorScheme=useColorScheme(initialColorScheme),colorScheme=_useColorScheme.colorScheme,setColorScheme=_useColorScheme.setColorScheme;var _useBreakpoint=useBreakpoint({breakpoints:themeTokens.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var onColorMode="on"+toTitleCase(colorScheme);var onDeviceType="on"+toTitleCase(matchedDeviceType);var theme=_extends({},themeTokens,{colors:themeTokens.colors[onColorMode],elevation:themeTokens.elevation[onColorMode],typography:themeTokens.typography[onDeviceType]});var themeContextValue={theme:theme,colorScheme:colorScheme,setColorScheme:setColorScheme,platform:onDeviceType};return {themeContextValue:themeContextValue,theme:theme};};
|
|
1979
1981
|
|
|
1980
1982
|
var BottomSheetStackContext=React__default.createContext({stack:[],addBottomSheetToStack:function addBottomSheetToStack(){},removeBottomSheetFromStack:function removeBottomSheetFromStack(){},getTopOfTheStack:function getTopOfTheStack(){return null;},getCurrentStackIndexById:function getCurrentStackIndexById(){return -1;}});var BottomSheetStackProvider=function BottomSheetStackProvider(_ref){var children=_ref.children;var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),stack=_React$useState2[0],setStack=_React$useState2[1];var getTopOfTheStack=React__default.useCallback(function(){return stack[0]||null;},[stack]);var addBottomSheetToStack=React__default.useCallback(function(id){setStack(function(prev){return [id].concat(_toConsumableArray(prev));});},[]);var removeBottomSheetFromStack=React__default.useCallback(function(id){setStack(function(prev){var newStack=_toConsumableArray(prev);var popped=newStack.shift();if(popped===id)return newStack;return newStack;});},[]);var getCurrentStackIndexById=React__default.useCallback(function(id){return stack.findIndex(function(stackId){return stackId===id;});},[stack]);var value=React__default.useMemo(function(){return {stack:stack,addBottomSheetToStack:addBottomSheetToStack,removeBottomSheetFromStack:removeBottomSheetFromStack,getTopOfTheStack:getTopOfTheStack,getCurrentStackIndexById:getCurrentStackIndexById};},[addBottomSheetToStack,getCurrentStackIndexById,getTopOfTheStack,removeBottomSheetFromStack,stack]);return jsx(BottomSheetStackContext.Provider,{value:value,children:children});};var useBottomSheetStack=function useBottomSheetStack(){var context=React__default.useContext(BottomSheetStackContext);return context;};
|
|
1981
1983
|
|
|
@@ -1987,7 +1989,7 @@ var isSupportedOnReactNativeElement=function isSupportedOnReactNativeElement(pro
|
|
|
1987
1989
|
|
|
1988
1990
|
var validBoxAsValues=['div','section','footer','header','main','aside','nav','span','label'];
|
|
1989
1991
|
|
|
1990
|
-
var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(__DEV__){if(!stringBackgroundColorValue.startsWith('surface.background')&&!stringBackgroundColorValue.startsWith('brand.')){
|
|
1992
|
+
var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(__DEV__){if(!stringBackgroundColorValue.startsWith('surface.background')&&!stringBackgroundColorValue.startsWith('brand.')){throwBladeError({message:"Oops! Currently you can only use `surface.background.*` and `brand.*` tokens with backgroundColor property but we received `"+stringBackgroundColorValue+"` instead.\n\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss \u2728",moduleName:'Box'});}}};var validateBackgroundProp=function validateBackgroundProp(responsiveBackgroundColor){if(__DEV__){if(responsiveBackgroundColor){if(typeof responsiveBackgroundColor==='string'){validateBackgroundString(responsiveBackgroundColor);return;}Object.values(responsiveBackgroundColor).forEach(function(backgroundColor){if(typeof backgroundColor==='string'){validateBackgroundString(backgroundColor);}});}}};var makeBoxProps=function makeBoxProps(props){return {display:props.display,overflow:props.overflow,overflowX:props.overflowX,overflowY:props.overflowY,height:props.height,minHeight:props.minHeight,maxHeight:props.maxHeight,width:props.width,minWidth:props.minWidth,maxWidth:props.maxWidth,textAlign:props.textAlign,flex:props.flex,flexWrap:props.flexWrap,flexDirection:props.flexDirection,flexGrow:props.flexGrow,flexShrink:props.flexShrink,flexBasis:props.flexBasis,alignItems:props.alignItems,alignContent:props.alignContent,alignSelf:props.alignSelf,justifyItems:props.justifyItems,justifyContent:props.justifyContent,justifySelf:props.justifySelf,placeSelf:props.placeSelf,order:props.order,grid:props.grid,gridColumn:props.gridColumn,gridRow:props.gridRow,gridRowStart:props.gridRowStart,gridRowEnd:props.gridRowEnd,gridColumnStart:props.gridColumnStart,gridColumnEnd:props.gridColumnEnd,gridArea:props.gridArea,gridAutoFlow:props.gridAutoFlow,gridAutoRows:props.gridAutoRows,gridAutoColumns:props.gridAutoColumns,gridTemplate:props.gridTemplate,gridTemplateAreas:props.gridTemplateAreas,gridTemplateColumns:props.gridTemplateColumns,gridTemplateRows:props.gridTemplateRows,padding:props.padding,paddingTop:props.paddingTop,paddingBottom:props.paddingBottom,paddingRight:props.paddingRight,paddingLeft:props.paddingLeft,paddingX:props.paddingX,paddingY:props.paddingY,margin:props.margin,marginBottom:props.marginBottom,marginTop:props.marginTop,marginRight:props.marginRight,marginLeft:props.marginLeft,marginX:props.marginX,marginY:props.marginY,gap:props.gap,rowGap:props.rowGap,columnGap:props.columnGap,position:props.position,zIndex:props.zIndex,top:props.top,right:props.right,bottom:props.bottom,left:props.left,backgroundColor:props.backgroundColor,backgroundImage:props.backgroundImage,backgroundSize:props.backgroundSize,backgroundPosition:props.backgroundPosition,backgroundOrigin:props.backgroundOrigin,backgroundRepeat:props.backgroundRepeat,elevation:props.elevation,borderWidth:props.borderWidth,borderColor:props.borderColor,borderTopWidth:props.borderTopWidth,borderTopColor:props.borderTopColor,borderRightWidth:props.borderRightWidth,borderRightColor:props.borderRightColor,borderBottomWidth:props.borderBottomWidth,borderBottomColor:props.borderBottomColor,borderLeftWidth:props.borderLeftWidth,borderLeftColor:props.borderLeftColor,borderRadius:props.borderRadius,borderTopLeftRadius:props.borderTopLeftRadius,borderTopRightRadius:props.borderTopRightRadius,borderBottomRightRadius:props.borderBottomRightRadius,borderBottomLeftRadius:props.borderBottomLeftRadius,onMouseEnter:props.onMouseEnter,onMouseLeave:props.onMouseLeave,onMouseOver:props.onMouseOver,onScroll:props.onScroll,children:props.children,tabIndex:props.tabIndex,as:isReactNative$4()?undefined:props.as};};var _Box=function _Box(props,ref){React__default.useEffect(function(){if(__DEV__){validateBackgroundProp(props.backgroundColor);}},[props.backgroundColor]);React__default.useEffect(function(){if(__DEV__){if(props.as){if(isReactNative$4()){throwBladeError({message:'`as` prop is not supported on React Native',moduleName:'Box'});}if(!validBoxAsValues.includes(props.as)){throwBladeError({message:"Invalid `as` prop value - "+props.as+". Only "+validBoxAsValues.join(', ')+" are valid values",moduleName:'Box'});}}}},[props.as]);return jsx(BaseBox,_extends({ref:ref},metaAttribute({name:MetaConstants.Box,testID:props.testID}),makeBoxProps(props)));};var Box=assignWithoutSideEffects(React__default.forwardRef(_Box),{displayName:'Box'});
|
|
1991
1993
|
|
|
1992
1994
|
var removeUndefinedStyledProps=function removeUndefinedStyledProps(obj){var onlyDefinedStyledProps={};for(var key in obj){if(obj[key]!==undefined){onlyDefinedStyledProps[key]=obj[key];}}return onlyDefinedStyledProps;};var makeStyledProps=function makeStyledProps(props){return {alignSelf:props.alignSelf,display:props.display,justifySelf:props.justifySelf,placeSelf:props.placeSelf,order:props.order,position:props.position,zIndex:props.zIndex,gridColumn:props.gridColumn,gridColumnStart:props.gridColumnStart,gridColumnEnd:props.gridColumnEnd,gridRow:props.gridRow,gridRowStart:props.gridRowStart,gridRowEnd:props.gridRowEnd,gridArea:props.gridArea,margin:props.margin,marginX:props.marginX,marginY:props.marginY,marginBottom:props.marginBottom,marginTop:props.marginTop,marginRight:props.marginRight,marginLeft:props.marginLeft,top:props.top,right:props.right,bottom:props.bottom,left:props.left};};var getStyledProps=function getStyledProps(props){return removeUndefinedStyledProps(makeStyledProps(props));};
|
|
1993
1995
|
|
|
@@ -2001,19 +2003,19 @@ var getBaseTextStyles=function getBaseTextStyles(_ref){var _ref$color=_ref.color
|
|
|
2001
2003
|
|
|
2002
2004
|
var accessibilityValue={valueMax:'max',valueMin:'min',valueNow:'now',valueText:'text'};var accessibilityState={selected:'selected',disabled:'disabled',expanded:'expanded',busy:'busy',checked:'checked'};var accessibilityValueKeys=Object.keys(accessibilityValue);var accessibilityStateKeys=Object.keys(accessibilityState);var accessibilityMap=_extends({},accessibilityState,accessibilityValue,{activeDescendant:'accessibilityActiveDescendant',atomic:'accessibilityAtomic',autoComplete:'accessibilityAutoComplete',colCount:'accessibilityColCount',colIndex:'accessibilityColIndex',colSpan:'accessibilityColSpan',controls:'accessibilityControls',describedBy:'accessibilityDescribedBy',details:'accessibilityDetails',errorMessage:'accessibilityErrorMessage',flowTo:'accessibilityFlowTo',hasPopup:'accessibilityHasPopup',hidden:'accessibilityHidden',invalid:'accessibilityInvalid',keyShortcuts:'accessibilityKeyShortcuts',label:'accessibilityLabel',labelledBy:'accessibilityLabelledBy',liveRegion:'accessibilityLiveRegion',modal:'accessibilityModal',multiline:'accessibilityMultiline',multiSelectable:'accessibilityMultiSelectable',orientation:'accessibilityOrientation',owns:'accessibilityOwns',placeholder:'accessibilityPlaceholder',posInSet:'accessibilityPosInSet',pressed:'accessibilityPressed',readOnly:'accessibilityReadOnly',required:'accessibilityRequired',role:'accessibilityRole',roleDescription:'accessibilityRoleDescription',rowCount:'accessibilityRowCount',rowIndex:'accessibilityRowIndex',rowSpan:'accessibilityRowSpan',setSize:'accessibilitySetSize',sort:'accessibilitySort',current:'accessibilityCurrent',dropEffect:'accessibilityDropEffect',grabbed:'accessibilityGrabbed',level:'accessibilityLevel',relevant:'accessibilityRelevant'});var accessibilityRoleMap={alert:'alert',button:'button',checkbox:'checkbox',combobox:'combobox',image:'image',link:'link',list:'list',menu:'menu',menubar:'menubar',menuitem:'menuitem',progressbar:'progressbar',radio:'radio',radiogroup:'radiogroup',scrollbar:'scrollbar',search:'search',spinbutton:'spinbutton',switch:'switch',tab:'tab',tablist:'tablist',timer:'timer',togglebutton:'togglebutton',toolbar:'toolbar',heading:'header',slider:'adjustable',img:'image',presentation:'none',region:'summary',imagebutton:'imagebutton',keyboardkey:'keyboardkey',label:'label',text:'text',meter:'progressbar'};
|
|
2003
2005
|
|
|
2004
|
-
var makeAccessible=function makeAccessible(props){var newProps={};for(var key in props){var propKey=key;var propValue=props[propKey];var accessibilityAttribute=accessibilityMap[propKey];if(accessibilityStateKeys.includes(propKey)){newProps.accessibilityState=_extends({},newProps.accessibilityState,_defineProperty({},accessibilityAttribute,propValue));continue;}if(accessibilityValueKeys.includes(propKey)){newProps.accessibilityValue=_extends({},newProps.accessibilityValue,_defineProperty({},accessibilityAttribute,propValue));continue;}if(propKey==='hidden'){if(propValue===true){newProps.accessibilityElementsHidden=true;newProps.importantForAccessibility='no-hide-descendants';}delete newProps.accessibilityHidden;continue;}if(accessibilityAttribute){newProps[accessibilityAttribute]=propValue;}else {
|
|
2006
|
+
var makeAccessible=function makeAccessible(props){var newProps={};for(var key in props){var propKey=key;var propValue=props[propKey];var accessibilityAttribute=accessibilityMap[propKey];if(accessibilityStateKeys.includes(propKey)){newProps.accessibilityState=_extends({},newProps.accessibilityState,_defineProperty({},accessibilityAttribute,propValue));continue;}if(accessibilityValueKeys.includes(propKey)){newProps.accessibilityValue=_extends({},newProps.accessibilityValue,_defineProperty({},accessibilityAttribute,propValue));continue;}if(propKey==='hidden'){if(propValue===true){newProps.accessibilityElementsHidden=true;newProps.importantForAccessibility='no-hide-descendants';}delete newProps.accessibilityHidden;continue;}if(accessibilityAttribute){newProps[accessibilityAttribute]=propValue;}else if(__DEV__){logger({message:"No mapping found for "+propKey+". Make sure you have entered valid key",moduleName:'makeAccessible',type:'warn'});}}if(newProps.accessibilityRole){var role=accessibilityRoleMap[newProps.accessibilityRole];newProps.accessibilityRole=role;if(!role){var validRoles=Object.keys(accessibilityRoleMap).join(', ');console.log("[Blade: makeAccessible]: Unsupported accessibility role for react-native. Expected one of "+validRoles+" but found "+props.role);delete newProps.accessibilityRole;}}return newProps;};
|
|
2005
2007
|
|
|
2006
|
-
var _excluded$4Y=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","numberOfLines","lineHeight","textAlign","as"],_excluded2$1=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","children","truncateAfterLines","className","style","accessibilityProps","componentName","testID"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,numberOfLines=_ref.numberOfLines,lineHeight=_ref.lineHeight,textAlign=_ref.textAlign;_ref.as;var props=_objectWithoutProperties(_ref,_excluded$4Y);var styledPropsCSSObject=useStyledProps(props);return _extends({},getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,numberOfLines:numberOfLines,lineHeight:lineHeight,textAlign:textAlign,theme:props.theme}),styledPropsCSSObject);});var BaseText=function BaseText(_ref2){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr,_ref2$componentName=_ref2.componentName,componentName=_ref2$componentName===void 0?MetaConstants.BaseText:_ref2$componentName,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded2$1);return jsx(StyledBaseText,_extends({},styledProps,{color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:undefined,textAlign:textAlign,numberOfLines:truncateAfterLines,className:className,style:style,id:id},makeAccessible(accessibilityProps),metaAttribute({name:componentName,testID:testID}),{children:children}));};
|
|
2008
|
+
var _excluded$4Y=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","numberOfLines","lineHeight","textAlign","as"],_excluded2$1=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","children","truncateAfterLines","className","style","accessibilityProps","componentName","testID"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,numberOfLines=_ref.numberOfLines,lineHeight=_ref.lineHeight,textAlign=_ref.textAlign;_ref.as;var props=_objectWithoutProperties(_ref,_excluded$4Y);var styledPropsCSSObject=useStyledProps(props);return _extends({},getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,numberOfLines:numberOfLines,lineHeight:lineHeight,textAlign:textAlign,theme:props.theme}),styledPropsCSSObject);});var BaseText=function BaseText(_ref2){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr,_ref2$componentName=_ref2.componentName,componentName=_ref2$componentName===void 0?MetaConstants.BaseText:_ref2$componentName,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded2$1);return jsx(StyledBaseText,_extends({},getStyledProps(styledProps),{color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:undefined,textAlign:textAlign,numberOfLines:truncateAfterLines,className:className,style:style,id:id},makeAccessible(accessibilityProps),metaAttribute({name:componentName,testID:testID}),{children:children}));};
|
|
2007
2009
|
|
|
2008
|
-
var useValidateAsProp=function useValidateAsProp(_ref){var as=_ref.as,componentName=_ref.componentName,validAsValues=_ref.validAsValues;React__default.useEffect(function(){if(__DEV__){if(as&&!validAsValues.includes(as)){
|
|
2010
|
+
var useValidateAsProp=function useValidateAsProp(_ref){var as=_ref.as,componentName=_ref.componentName,validAsValues=_ref.validAsValues;React__default.useEffect(function(){if(__DEV__){if(as&&!validAsValues.includes(as)){throwBladeError({message:"Invalid `as` prop value - "+as+". Only "+validAsValues.join(', ')+" are accepted",moduleName:componentName});}}},[as,componentName,validAsValues]);};
|
|
2009
2011
|
|
|
2010
2012
|
var _excluded$4X=["as","size","type","contrast","color","children","testID","textAlign","textDecorationLine"];var validAsValues$2=['span','h1','h2','h3','h4','h5','h6'];var getProps$3=function getProps(_ref){var as=_ref.as,size=_ref.size,type=_ref.type,contrast=_ref.contrast,color=_ref.color,testID=_ref.testID;var isPlatformWeb=getPlatformType()==='browser'||getPlatformType()==='node';var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:600,fontWeight:'bold',fontStyle:'normal',lineHeight:700,fontFamily:'text',accessibilityProps:isPlatformWeb?{}:{role:'heading'},componentName:'title',testID:testID};if(size==='small'){props.fontSize=600;props.lineHeight=500;props.as=isPlatformWeb?'h3':undefined;}else if(size==='medium'){props.fontSize=700;props.lineHeight=600;props.as=isPlatformWeb?'h2':undefined;}else if(size==='large'){props.fontSize=800;props.lineHeight=700;props.as=isPlatformWeb?'h1':undefined;}else if(size==='xlarge'){props.fontSize=1000;props.lineHeight=800;props.as=isPlatformWeb?'h1':undefined;}props.as=as||props.as;return props;};var Title=function Title(_ref2){var as=_ref2.as,_ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,color=_ref2.color,children=_ref2.children,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,styledProps=_objectWithoutProperties(_ref2,_excluded$4X);useValidateAsProp({componentName:'Title',as:as,validAsValues:validAsValues$2});var props=getProps$3({as:as,size:size,type:type,contrast:contrast,color:color,testID:testID});return jsx(BaseText,_extends({},props,{textAlign:textAlign,textDecorationLine:textDecorationLine},getStyledProps(styledProps),{children:children}));};
|
|
2011
2013
|
|
|
2012
|
-
var _excluded$4W=["as","variant","size","type","weight","contrast","color","children","testID","textAlign","textDecorationLine"];var validAsValues$1=['span','h1','h2','h3','h4','h5','h6'];var getProps$2=function getProps(_ref){var as=_ref.as,variant=_ref.variant,size=_ref.size,type=_ref.type,weight=_ref.weight,contrast=_ref.contrast,color=_ref.color,testID=_ref.testID;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:200,fontWeight:weight!=null?weight:'bold',fontStyle:'normal',lineHeight:300,fontFamily:'text',accessibilityProps:isReactNative$4()?{role:'heading'}:{},componentName:'heading',testID:testID};if(variant==='regular'){if(!size||size==='small'){props.fontSize=200;props.lineHeight=300;props.as='h6';}else if(size==='medium'){props.fontSize=300;props.lineHeight=200;props.as='h5';}else if(size==='large'){props.fontSize=400;props.lineHeight=400;props.as='h4';}}else if(variant==='subheading'){if(__DEV__){if(weight==='regular'){
|
|
2014
|
+
var _excluded$4W=["as","variant","size","type","weight","contrast","color","children","testID","textAlign","textDecorationLine"];var validAsValues$1=['span','h1','h2','h3','h4','h5','h6'];var getProps$2=function getProps(_ref){var as=_ref.as,variant=_ref.variant,size=_ref.size,type=_ref.type,weight=_ref.weight,contrast=_ref.contrast,color=_ref.color,testID=_ref.testID;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:200,fontWeight:weight!=null?weight:'bold',fontStyle:'normal',lineHeight:300,fontFamily:'text',accessibilityProps:isReactNative$4()?{role:'heading'}:{},componentName:'heading',testID:testID};if(variant==='regular'){if(!size||size==='small'){props.fontSize=200;props.lineHeight=300;props.as='h6';}else if(size==='medium'){props.fontSize=300;props.lineHeight=200;props.as='h5';}else if(size==='large'){props.fontSize=400;props.lineHeight=400;props.as='h4';}}else if(variant==='subheading'){if(__DEV__){if(weight==='regular'){throwBladeError({moduleName:'Heading',message:"weight cannot be 'regular' when variant is 'subheading'"});}if(size){throwBladeError({moduleName:'Heading',message:"size prop cannot be added when variant is 'subheading'. Use variant 'regular' or remove size prop"});}}props.fontSize=75;props.lineHeight=50;props.as='p';}props.as=as||props.as;return props;};var Heading=function Heading(_ref2){var as=_ref2.as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'regular':_ref2$variant,size=_ref2.size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'bold':_ref2$weight,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,color=_ref2.color,children=_ref2.children,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,styledProps=_objectWithoutProperties(_ref2,_excluded$4W);useValidateAsProp({componentName:'Heading',as:as,validAsValues:validAsValues$1});var props=getProps$2({as:as,variant:variant,size:size,type:type,weight:weight,color:color,contrast:contrast,testID:testID});return jsx(BaseText,_extends({},props,{textAlign:textAlign,textDecorationLine:textDecorationLine},getStyledProps(styledProps),{children:children}));};
|
|
2013
2015
|
|
|
2014
|
-
var _excluded$4V=["as","variant","weight","size","type","contrast","truncateAfterLines","children","color","testID","textAlign","textDecorationLine"];var validAsValues=['p','span','div','abbr','figcaption','cite','q'];var getTextProps=function getTextProps(_ref){var variant=_ref.variant,type=_ref.type,weight=_ref.weight,size=_ref.size,color=_ref.color,contrast=_ref.contrast,testID=_ref.testID,textAlign=_ref.textAlign,textDecorationLine=_ref.textDecorationLine;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:100,fontFamily:'text',componentName:'text',testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine};if(variant==='body'){if(size==='xsmall'){props.fontSize=25;props.lineHeight=50;}if(size==='small'){props.fontSize=75;props.lineHeight=50;}if(size==='medium'){props.fontSize=100;props.lineHeight=100;}if(size==='large'){props.fontSize=200;props.lineHeight=300;}}if(variant==='caption'){if(size==='medium'){props.fontSize=50;props.lineHeight=50;}else if(__DEV__){
|
|
2016
|
+
var _excluded$4V=["as","variant","weight","size","type","contrast","truncateAfterLines","children","color","testID","textAlign","textDecorationLine"];var validAsValues=['p','span','div','abbr','figcaption','cite','q'];var getTextProps=function getTextProps(_ref){var variant=_ref.variant,type=_ref.type,weight=_ref.weight,size=_ref.size,color=_ref.color,contrast=_ref.contrast,testID=_ref.testID,textAlign=_ref.textAlign,textDecorationLine=_ref.textDecorationLine;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:100,fontFamily:'text',componentName:'text',testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine};if(variant==='body'){if(size==='xsmall'){props.fontSize=25;props.lineHeight=50;}if(size==='small'){props.fontSize=75;props.lineHeight=50;}if(size==='medium'){props.fontSize=100;props.lineHeight=100;}if(size==='large'){props.fontSize=200;props.lineHeight=300;}}if(variant==='caption'){if(size==='medium'){props.fontSize=50;props.lineHeight=50;}else if(__DEV__){throwBladeError({moduleName:'Text',message:"size cannot be '"+size+"' when variant is 'caption'"});}props.fontStyle='italic';}return props;};var _Text=function _Text(_ref2){var _ref2$as=_ref2.as,as=_ref2$as===void 0?'p':_ref2$as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'body':_ref2$variant,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,truncateAfterLines=_ref2.truncateAfterLines,children=_ref2.children,color=_ref2.color,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,styledProps=_objectWithoutProperties(_ref2,_excluded$4V);var props=_extends({as:as,truncateAfterLines:truncateAfterLines},getTextProps({variant:variant,type:type,weight:weight,color:color,size:size,contrast:contrast,testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine}));useValidateAsProp({componentName:'Text',as:as,validAsValues:validAsValues});return jsx(BaseText,_extends({},props,getStyledProps(styledProps),{children:children}));};var Text=assignWithoutSideEffects(_Text,{displayName:'Text',componentId:'Text'});
|
|
2015
2017
|
|
|
2016
|
-
var _excluded$4U=["children","size","weight","isHighlighted","color","testID"];var platformType=getPlatformType();var isPlatformWeb=platformType==='browser'||platformType==='node';var getCodeFontSizeAndLineHeight=function getCodeFontSizeAndLineHeight(size){switch(size){case'medium':return {fontSize:75,lineHeight:75};case'small':return {fontSize:25,lineHeight:25};default:if(__DEV__){
|
|
2018
|
+
var _excluded$4U=["children","size","weight","isHighlighted","color","testID"];var platformType=getPlatformType();var isPlatformWeb=platformType==='browser'||platformType==='node';var getCodeFontSizeAndLineHeight=function getCodeFontSizeAndLineHeight(size){switch(size){case'medium':return {fontSize:75,lineHeight:75};case'small':return {fontSize:25,lineHeight:25};default:if(__DEV__){throwBladeError({moduleName:'Code',message:"Unexpected size: "+size});}return undefined;}};var CodeContainer=styled(BaseBox)(function(props){var padding=makeSpace(props.theme.spacing[0])+" "+makeSpace(props.theme.spacing[2]);return {padding:padding,backgroundColor:props.isHighlighted?props.theme.colors.brand.gray.a100.lowContrast:undefined,borderRadius:props.theme.border.radius.medium,display:isPlatformWeb?'inline-block':'flex',alignSelf:isPlatformWeb?undefined:'center',verticalAlign:'middle',lineHeight:makeTypographySize(props.theme.typography.lineHeights[0])};});var getCodeColor=function getCodeColor(_ref){var isHighlighted=_ref.isHighlighted,color=_ref.color;if(isHighlighted){if(__DEV__){if(color){throwBladeError({moduleName:'Code',message:'`color` prop cannot be used without `isHighlighted={false}`'});}}return 'surface.text.subtle.lowContrast';}if(color){return color;}return 'surface.text.normal.lowContrast';};var Code=function Code(_ref2){var children=_ref2.children,_ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,_ref2$isHighlighted=_ref2.isHighlighted,isHighlighted=_ref2$isHighlighted===void 0?true:_ref2$isHighlighted,color=_ref2.color,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$4U);var _ref3=getCodeFontSizeAndLineHeight(size),fontSize=_ref3.fontSize,lineHeight=_ref3.lineHeight;var codeTextColor=React__default.useMemo(function(){return getCodeColor({isHighlighted:isHighlighted,color:color});},[isHighlighted,color]);return jsx(CodeContainer,_extends({size:size,isHighlighted:isHighlighted,as:isPlatformWeb?'span':undefined},metaAttribute({name:MetaConstants.Code,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseText,{color:codeTextColor,fontFamily:"code",fontSize:fontSize,fontWeight:weight,as:isPlatformWeb?'code':undefined,lineHeight:lineHeight,children:children})}));};
|
|
2017
2019
|
|
|
2018
2020
|
/**
|
|
2019
2021
|
* Checks if `value` is `undefined`.
|
|
@@ -2073,7 +2075,7 @@ var useFormId=function useFormId(prefix){var baseId=useId(prefix);var inputId=us
|
|
|
2073
2075
|
|
|
2074
2076
|
function useControllableState(props){var valueProp=props.value,defaultValue=props.defaultValue,onChange=props.onChange;var _React$useState=React.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),valueState=_React$useState2[0],setValue=_React$useState2[1];var _React$useRef=React.useRef(valueProp!==undefined),isControlled=_React$useRef.current;var value=isControlled&&typeof valueProp!=='undefined'?valueProp:valueState;var updateValue=React.useCallback(function(next){var nextValue=next(value);if(!isControlled)setValue(nextValue);onChange==null?void 0:onChange(nextValue);},[onChange,value]);return [value,updateValue];}
|
|
2075
2077
|
|
|
2076
|
-
function setMixed(element,mixed){if(mixed){element.indeterminate=true;}else if(element.indeterminate){element.indeterminate=false;}}var useCheckbox=function useCheckbox(_ref){var _ref$role=_ref.role,role=_ref$role===void 0?'checkbox':_ref$role,isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isIndeterminate=_ref.isIndeterminate,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,hasHelperText=_ref.hasHelperText,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(__DEV__){if(isChecked&&defaultChecked){
|
|
2078
|
+
function setMixed(element,mixed){if(mixed){element.indeterminate=true;}else if(element.indeterminate){element.indeterminate=false;}}var useCheckbox=function useCheckbox(_ref){var _ref$role=_ref.role,role=_ref$role===void 0?'checkbox':_ref$role,isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isIndeterminate=_ref.isIndeterminate,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,hasHelperText=_ref.hasHelperText,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(__DEV__){if(isChecked&&defaultChecked){throwBladeError({message:"Do not provide both 'isChecked' and 'defaultChecked' to useCheckbox. Consider if you want this component to be controlled or uncontrolled.",moduleName:'useCheckbox'});}}var _useControllableState=useControllableState({value:isChecked,defaultValue:defaultChecked!=null?defaultChecked:false}),_useControllableState2=_slicedToArray(_useControllableState,2),checkboxState=_useControllableState2[0],setCheckboxStateChange=_useControllableState2[1];var handleOnChange=function handleOnChange(event){if(isDisabled){event.stopPropagation();event.preventDefault();return;}setCheckboxStateChange(function(checked){onChange==null?void 0:onChange({isChecked:!checked,event:event,value:value});return !checked;});};React__default.useEffect(function(){var element=inputRef.current;if(!element)return;setMixed(element,isIndeterminate);},[isIndeterminate]);var state={isReactNative:isReactNative,isChecked:checkboxState,setChecked:setCheckboxStateChange};var _useFormId=useFormId('checkbox'),inputId=_useFormId.inputId,errorTextId=_useFormId.errorTextId,helpTextId=_useFormId.helpTextId;var accessibilityProps=makeAccessible(_extends({role:role,required:Boolean(isRequired),invalid:Boolean(hasError),disabled:Boolean(isDisabled),checked:checkboxState},hasError?{errorMessage:errorTextId}:{},hasHelperText?{describedBy:helpTextId}:{}));if(isReactNative){return {state:state,inputProps:_extends({onPress:handleOnChange,name:name,value:value},accessibilityProps)};}return {state:state,ids:{inputId:inputId,errorTextId:errorTextId,helpTextId:helpTextId},inputProps:_extends({ref:inputRef,onChange:handleOnChange,type:'checkbox',name:name,value:value,checked:checkboxState,disabled:isDisabled,required:isRequired},accessibilityProps)};};
|
|
2077
2079
|
|
|
2078
2080
|
var FormHintWrapper=function FormHintWrapper(_ref){var children=_ref.children;return jsx(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",children:children});};
|
|
2079
2081
|
|
|
@@ -2637,7 +2639,7 @@ var SelectorSupportText=function SelectorSupportText(_ref){var children=_ref.chi
|
|
|
2637
2639
|
|
|
2638
2640
|
var _SelectorInput=function _SelectorInput(_props,_ref){return jsx(Fragment,{});};var SelectorInput=React__default.forwardRef(_SelectorInput);
|
|
2639
2641
|
|
|
2640
|
-
var _excluded$D=["defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","size","tabIndex","testID"];var _Checkbox=function _Checkbox(_ref,ref){var _groupProps$state,_groupProps$size;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,tabIndex=_ref.tabIndex,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$D);var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined_1(validationState);var hasName=!isUndefined_1(name);var hasDefaultChecked=!isUndefined_1(defaultChecked);var hasIsChecked=!isUndefined_1(isChecked);var hasOnChange=!isUndefined_1(onChange);if(__DEV__){if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty_1(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');
|
|
2642
|
+
var _excluded$D=["defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","size","tabIndex","testID"];var _Checkbox=function _Checkbox(_ref,ref){var _groupProps$state,_groupProps$size;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,tabIndex=_ref.tabIndex,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$D);var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined_1(validationState);var hasName=!isUndefined_1(name);var hasDefaultChecked=!isUndefined_1(defaultChecked);var hasIsChecked=!isUndefined_1(isChecked);var hasOnChange=!isUndefined_1(onChange);if(__DEV__){if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty_1(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');throwBladeError({message:"Cannot set `"+props+"` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself",moduleName:'Checkbox'});}if(!value&&!isEmpty_1(groupProps)){throw new Error("[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n ");}}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=Boolean(isRequired||(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required');var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var isSmall=_size==='small';var showSupportingText=validationState!=='error'&&helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:_isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;return jsxs(BaseBox,_extends({},metaAttribute({name:MetaConstants.Checkbox,testID:testID}),getStyledProps(styledProps),{children:[jsx(SelectorLabel,{componentName:MetaConstants.CheckboxLabel,inputProps:state.isReactNative?inputProps:{},children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:checkboxHoverTokens,isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,hasError:_hasError,inputProps:inputProps,tabIndex:tabIndex,ref:ref}),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children})]}),jsx(BaseBox,{marginLeft:isSmall?'spacing.6':'spacing.7',children:showSupportingText&&jsx(SelectorSupportText,{id:ids==null?void 0:ids.helpTextId,children:helpText})})]})}),jsx(FormHint,{errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]}));};var Checkbox=assignWithoutSideEffects(React__default.forwardRef(_Checkbox),{displayName:'Checkbox'});
|
|
2641
2643
|
|
|
2642
2644
|
var useCheckboxGroup=function useCheckboxGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,name=_ref.name,necessityIndicator=_ref.necessityIndicator,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var _useFormId=useFormId('checkbox-group'),labelId=_useFormId.labelId;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue||[],onChange:function onChange(values){return _onChange==null?void 0:_onChange({values:values,name:name});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValues=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValues,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(value){if(isDisabled){return;}setValue(function(){return value;});}),isChecked:function isChecked(value){return checkedValues.includes(value);},addValue:function addValue(value){if(isDisabled){return;}if(!checkedValues.includes(value)){setValue(function(){return checkedValues.concat(value);});}},removeValue:function removeValue(value){if(isDisabled){return;}if(checkedValues.includes(value)){setValue(function(){return checkedValues.filter(function(existingValue){return existingValue!==value;});});}}};},[checkedValues,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,labelPosition:platform==='onMobile'?'top':labelPosition,name:name,necessityIndicator:necessityIndicator,state:state,size:size};},[validationState,isDisabled,isRequired,platform,labelPosition,name,necessityIndicator,state,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
2643
2645
|
|
|
@@ -2645,11 +2647,11 @@ var SelectorGroupField=function SelectorGroupField(_ref){var children=_ref.child
|
|
|
2645
2647
|
|
|
2646
2648
|
var _excluded$C=["children","label","helpText","isDisabled","isRequired","necessityIndicator","labelPosition","validationState","errorText","name","defaultValue","onChange","value","size","testID"];var CheckboxGroup=function CheckboxGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isRequired=_ref.isRequired,isRequired=_ref$isRequired===void 0?false:_ref$isRequired,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,validationState=_ref.validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$C);var _useCheckboxGroup=useCheckboxGroup({defaultValue:defaultValue,onChange:onChange,value:value,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,name:name,labelPosition:labelPosition,validationState:validationState,size:size}),contextValue=_useCheckboxGroup.contextValue,ids=_useCheckboxGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=","+(showError?errorText:'')+" "+(showHelpText?helpText:'');var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var gap=checkboxSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(CheckboxGroupProvider,{value:contextValue,children:jsx(BaseBox,_extends({},getStyledProps(styledProps),{children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,componentName:"checkbox-group",testID:testID,children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,children:label}),jsxs(BaseBox,{children:[jsx(BaseBox,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(BaseBox,{marginBottom:index===childCount-1?makeSize(0):gap,children:child},index);})}),jsx(FormHint,{errorText:errorText,helpText:helpText,type:validationState==='error'?'error':'help'})]})]})}))});};
|
|
2647
2649
|
|
|
2648
|
-
var ActionListItemContext=React__default.createContext({});var ActionListSectionDivider=function ActionListSectionDivider(){return jsx(Divider,_extends({},makeAccessible({role:getSeparatorRole()})));};var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSection=function _ActionListSection(_ref){var title=_ref.title,children=_ref.children,testID=_ref.testID,_hideDivider=_ref._hideDivider;var _useActionListContext=useActionListContext(),surfaceLevel=_useActionListContext.surfaceLevel;return jsxs(BaseBox,_extends({},makeAccessible({role:getActionListSectionRole(),label:title}),{backgroundColor:"surface.background.level"+surfaceLevel+".lowContrast"},metaAttribute({name:MetaConstants.ActionListSection,testID:testID}),{children:[jsx(StyledActionListSectionTitle,_extends({},makeAccessible({hidden:true}),{children:jsx(Text,{color:"surface.text.muted.lowContrast",size:"small",weight:"bold",children:title})})),jsx(BaseBox,_extends({},makeAccessible({role:isReactNative$4()?undefined:'listbox'}),{children:children})),_hideDivider&&isReactNative$4()?null:jsx(Box,{marginX:"spacing.3",marginY:"spacing.1",children:jsx(ActionListSectionDivider,{})})]}));};var ActionListSection=assignWithoutSideEffects(_ActionListSection,{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref2){var icon=_ref2.icon;var Icon=icon;var _React$useContext=React__default.useContext(ActionListItemContext),intent=_React$useContext.intent,isDisabled=_React$useContext.isDisabled;return jsx(Icon,{color:intent==='negative'?'feedback.icon.negative.lowContrast':getNormalTextColor(isDisabled,{isMuted:true}),size:"medium"});};var ActionListItemIcon=assignWithoutSideEffects(_ActionListItemIcon,{componentId:componentIds.ActionListItemIcon});var _ActionListItemText=function _ActionListItemText(_ref3){var children=_ref3.children;var _React$useContext2=React__default.useContext(ActionListItemContext),isDisabled=_React$useContext2.isDisabled;return jsx(Text,{variant:"caption",color:getNormalTextColor(isDisabled,{isMuted:true}),children:children});};var ActionListItemText=assignWithoutSideEffects(_ActionListItemText,{componentId:componentIds.ActionListItemText});var ActionListCheckboxWrapper=styled(BaseBox)(function(_props){return {pointerEvents:'none'};});var makeActionListItemClickable=function makeActionListItemClickable(clickHandler){if(isReactNative$4()){return {onPress:clickHandler};}return {onClick:clickHandler};};var _ActionListItemBody=function _ActionListItemBody(_ref4){var selectionType=_ref4.selectionType,intent=_ref4.intent,description=_ref4.description,isDisabled=_ref4.isDisabled,leading=_ref4.leading,trailing=_ref4.trailing,title=_ref4.title,isSelected=_ref4.isSelected;return jsxs(Fragment,{children:[jsxs(BaseBox,{display:"flex",justifyContent:"center",flexDirection:"row",alignItems:"center",maxHeight:isReactNative$4()?undefined:makeSize(size[20]),children:[jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",children:selectionType==='multiple'?jsx(ActionListCheckboxWrapper,_extends({hasDescription:Boolean(description)},makeAccessible({hidden:true}),{children:jsx(Checkbox,{isChecked:isSelected,tabIndex:-1,isDisabled:isDisabled,children:null})})):leading}),jsx(BaseBox,{paddingLeft:selectionType==='multiple'||!leading?'spacing.0':'spacing.3',paddingRight:"spacing.3",children:jsx(Text,{truncateAfterLines:1,color:intent==='negative'?'feedback.text.negative.lowContrast':getNormalTextColor(isDisabled),children:title})}),jsx(BaseBox,{marginLeft:"auto",children:trailing})]}),jsx(BaseBox,{paddingLeft:leading||selectionType==='multiple'?'spacing.7':undefined,children:description?jsx(Text,{color:getNormalTextColor(isDisabled,{isMuted:true}),size:"small",children:description}):null})]});};var ActionListItemBody=React__default.memo(_ActionListItemBody);var _ActionListItem=function _ActionListItem(props){var _useDropdown=useDropdown(),activeIndex=_useDropdown.activeIndex,dropdownBaseId=_useDropdown.dropdownBaseId,onOptionClick=_useDropdown.onOptionClick,selectedIndices=_useDropdown.selectedIndices,setShouldIgnoreBlur=_useDropdown.setShouldIgnoreBlur,setShouldIgnoreBlurAnimation=_useDropdown.setShouldIgnoreBlurAnimation,selectionType=_useDropdown.selectionType,dropdownTriggerer=_useDropdown.dropdownTriggerer,isKeydownPressed=_useDropdown.isKeydownPressed;var _useTheme=useTheme(),platform=_useTheme.platform;var isMobile=platform==='onMobile';var renderOnWebAs=props.href?'a':'button';var getIsSelected=function getIsSelected(){if(dropdownTriggerer==='SelectInput'){if(typeof props._index==='number'){return selectedIndices.includes(props._index);}return undefined;}return props.isSelected;};var isSelected=getIsSelected();React__default.useEffect(function(){validateActionListItemProps({leading:props.leading,trailing:props.trailing});},[props.leading,props.trailing]);React__default.useEffect(function(){if(__DEV__){if(dropdownTriggerer==='SelectInput'&&props.intent==='negative'){
|
|
2650
|
+
var ActionListItemContext=React__default.createContext({});var ActionListSectionDivider=function ActionListSectionDivider(){return jsx(Divider,_extends({},makeAccessible({role:getSeparatorRole()})));};var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSection=function _ActionListSection(_ref){var title=_ref.title,children=_ref.children,testID=_ref.testID,_hideDivider=_ref._hideDivider;var _useActionListContext=useActionListContext(),surfaceLevel=_useActionListContext.surfaceLevel;return jsxs(BaseBox,_extends({},makeAccessible({role:getActionListSectionRole(),label:title}),{backgroundColor:"surface.background.level"+surfaceLevel+".lowContrast"},metaAttribute({name:MetaConstants.ActionListSection,testID:testID}),{children:[jsx(StyledActionListSectionTitle,_extends({},makeAccessible({hidden:true}),{children:jsx(Text,{color:"surface.text.muted.lowContrast",size:"small",weight:"bold",children:title})})),jsx(BaseBox,_extends({},makeAccessible({role:isReactNative$4()?undefined:'listbox'}),{children:children})),_hideDivider&&isReactNative$4()?null:jsx(Box,{marginX:"spacing.3",marginY:"spacing.1",children:jsx(ActionListSectionDivider,{})})]}));};var ActionListSection=assignWithoutSideEffects(_ActionListSection,{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref2){var icon=_ref2.icon;var Icon=icon;var _React$useContext=React__default.useContext(ActionListItemContext),intent=_React$useContext.intent,isDisabled=_React$useContext.isDisabled;return jsx(Icon,{color:intent==='negative'?'feedback.icon.negative.lowContrast':getNormalTextColor(isDisabled,{isMuted:true}),size:"medium"});};var ActionListItemIcon=assignWithoutSideEffects(_ActionListItemIcon,{componentId:componentIds.ActionListItemIcon});var _ActionListItemText=function _ActionListItemText(_ref3){var children=_ref3.children;var _React$useContext2=React__default.useContext(ActionListItemContext),isDisabled=_React$useContext2.isDisabled;return jsx(Text,{variant:"caption",color:getNormalTextColor(isDisabled,{isMuted:true}),children:children});};var ActionListItemText=assignWithoutSideEffects(_ActionListItemText,{componentId:componentIds.ActionListItemText});var ActionListCheckboxWrapper=styled(BaseBox)(function(_props){return {pointerEvents:'none'};});var makeActionListItemClickable=function makeActionListItemClickable(clickHandler){if(isReactNative$4()){return {onPress:clickHandler};}return {onClick:clickHandler};};var _ActionListItemBody=function _ActionListItemBody(_ref4){var selectionType=_ref4.selectionType,intent=_ref4.intent,description=_ref4.description,isDisabled=_ref4.isDisabled,leading=_ref4.leading,trailing=_ref4.trailing,title=_ref4.title,isSelected=_ref4.isSelected;return jsxs(Fragment,{children:[jsxs(BaseBox,{display:"flex",justifyContent:"center",flexDirection:"row",alignItems:"center",maxHeight:isReactNative$4()?undefined:makeSize(size[20]),children:[jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",children:selectionType==='multiple'?jsx(ActionListCheckboxWrapper,_extends({hasDescription:Boolean(description)},makeAccessible({hidden:true}),{children:jsx(Checkbox,{isChecked:isSelected,tabIndex:-1,isDisabled:isDisabled,children:null})})):leading}),jsx(BaseBox,{paddingLeft:selectionType==='multiple'||!leading?'spacing.0':'spacing.3',paddingRight:"spacing.3",children:jsx(Text,{truncateAfterLines:1,color:intent==='negative'?'feedback.text.negative.lowContrast':getNormalTextColor(isDisabled),children:title})}),jsx(BaseBox,{marginLeft:"auto",children:trailing})]}),jsx(BaseBox,{paddingLeft:leading||selectionType==='multiple'?'spacing.7':undefined,children:description?jsx(Text,{color:getNormalTextColor(isDisabled,{isMuted:true}),size:"small",children:description}):null})]});};var ActionListItemBody=React__default.memo(_ActionListItemBody);var _ActionListItem=function _ActionListItem(props){var _useDropdown=useDropdown(),activeIndex=_useDropdown.activeIndex,dropdownBaseId=_useDropdown.dropdownBaseId,onOptionClick=_useDropdown.onOptionClick,selectedIndices=_useDropdown.selectedIndices,setShouldIgnoreBlur=_useDropdown.setShouldIgnoreBlur,setShouldIgnoreBlurAnimation=_useDropdown.setShouldIgnoreBlurAnimation,selectionType=_useDropdown.selectionType,dropdownTriggerer=_useDropdown.dropdownTriggerer,isKeydownPressed=_useDropdown.isKeydownPressed;var _useTheme=useTheme(),platform=_useTheme.platform;var isMobile=platform==='onMobile';var renderOnWebAs=props.href?'a':'button';var getIsSelected=function getIsSelected(){if(dropdownTriggerer==='SelectInput'){if(typeof props._index==='number'){return selectedIndices.includes(props._index);}return undefined;}return props.isSelected;};var isSelected=getIsSelected();React__default.useEffect(function(){validateActionListItemProps({leading:props.leading,trailing:props.trailing});},[props.leading,props.trailing]);React__default.useEffect(function(){if(__DEV__){if(dropdownTriggerer==='SelectInput'&&props.intent==='negative'){throwBladeError({message:'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',moduleName:'ActionListItem'});}}},[props.intent,dropdownTriggerer]);return jsx(ActionListItemContext.Provider,{value:{intent:props.intent,isDisabled:props.isDisabled},children:jsx(StyledActionListItem,_extends({as:!isReactNative$4()?renderOnWebAs:undefined,id:dropdownBaseId+"-"+props._index,type:"button",tabIndex:-1,href:props.href,target:props.target,className:activeIndex===props._index?'active-focus':''},makeAccessible({selected:isSelected,current:isRoleMenu(dropdownTriggerer)?isSelected:undefined,role:getActionListItemRole(dropdownTriggerer,props.href),disabled:props.isDisabled}),makeActionListItemClickable(function(e){if(typeof props._index==='number'){onOptionClick(e,props._index);props.onClick==null?void 0:props.onClick({name:props.value,value:isSelected});}}),metaAttribute({name:MetaConstants.ActionListItem,testID:props.testID}),{onMouseDown:function onMouseDown(){setShouldIgnoreBlur(true);setShouldIgnoreBlurAnimation(true);},onMouseUp:function onMouseUp(){setShouldIgnoreBlurAnimation(false);},"data-value":props.value,"data-index":props._index,selectionType:selectionType,hasDescription:Boolean(props.description),intent:props.intent,isSelected:isSelected,isKeydownPressed:isKeydownPressed,isMobile:isMobile,children:jsx(ActionListItemBody,{selectionType:selectionType,intent:props.intent,description:props.description,isDisabled:props.isDisabled,leading:props.leading,trailing:props.trailing,title:props.title,isSelected:isSelected})}))});};var ActionListItem=assignWithoutSideEffects(React__default.memo(_ActionListItem),{componentId:componentIds.ActionListItem,displayName:componentIds.ActionListItem});
|
|
2649
2651
|
|
|
2650
2652
|
var _ActionListBox=React__default.forwardRef(function(_ref,ref){var sectionData=_ref.sectionData,actionListItemWrapperRole=_ref.actionListItemWrapperRole,isMultiSelectable=_ref.isMultiSelectable,isInBottomSheet=_ref.isInBottomSheet;var _useBottomSheetContex=useBottomSheetContext(),footerHeight=_useBottomSheetContex.footerHeight,setContentHeight=_useBottomSheetContex.setContentHeight;var renderActionListItem=React__default.useCallback(function(_ref2){var item=_ref2.item;return jsx(ActionListItem,_extends({},item));},[]);var renderActionListSectionHeader=React__default.useCallback(function(_ref3){var title=_ref3.section.title;if(!title)return null;return jsx(ActionListSection,{title:title,_hideDivider:true,children:undefined});},[]);var renderActionListSectionDivider=React__default.useCallback(function(_ref4){var _ref4$section=_ref4.section,title=_ref4$section.title,hideDivider=_ref4$section.hideDivider;if(!title)return null;if(hideDivider)return null;return jsx(ActionListSectionDivider,{});},[]);return jsx(StyledListBoxWrapper,_extends({as:isInBottomSheet?BottomSheetSectionList:SectionList,isInBottomSheet:Boolean(isInBottomSheet),marginBottom:footerHeight,sections:sectionData,windowSize:5,keyExtractor:function keyExtractor(item){return item.value;},stickySectionHeadersEnabled:false,renderSectionHeader:renderActionListSectionHeader,renderSectionFooter:renderActionListSectionDivider,renderItem:renderActionListItem,ref:ref,onContentSizeChange:function onContentSizeChange(_width,height){setContentHeight(height);}},makeAccessible({role:actionListItemWrapperRole,multiSelectable:actionListItemWrapperRole==='listbox'?isMultiSelectable:undefined})));});var ActionListBox=assignWithoutSideEffects(_ActionListBox,{displayName:'ActionListBox'});
|
|
2651
2653
|
|
|
2652
|
-
var ActionListContext=React__default.createContext({surfaceLevel:2});var useActionListContext=function useActionListContext(){var context=React__default.useContext(ActionListContext);if(__DEV__){if(!context){
|
|
2654
|
+
var ActionListContext=React__default.createContext({surfaceLevel:2});var useActionListContext=function useActionListContext(){var context=React__default.useContext(ActionListContext);if(__DEV__){if(!context){throwBladeError({message:'useActionListContext has to be called inside ActionListContext.Provider',moduleName:'ActionList'});}}return context;};var _ActionList=function _ActionList(_ref){var children=_ref.children,_ref$surfaceLevel=_ref.surfaceLevel,surfaceLevel=_ref$surfaceLevel===void 0?2:_ref$surfaceLevel,testID=_ref.testID;var _useDropdown=useDropdown(),setOptions=_useDropdown.setOptions,actionListItemRef=_useDropdown.actionListItemRef,selectionType=_useDropdown.selectionType,dropdownBaseId=_useDropdown.dropdownBaseId,dropdownTriggerer=_useDropdown.dropdownTriggerer,hasFooterAction=_useDropdown.hasFooterAction;var _useBottomSheetContex=useBottomSheetContext(),isInBottomSheet=_useBottomSheetContex.isInBottomSheet;var _React$useMemo=React__default.useMemo(function(){return getActionListProperties(children);},[children]),sectionData=_React$useMemo.sectionData,childrenWithId=_React$useMemo.childrenWithId,actionListOptions=_React$useMemo.actionListOptions;React__default.useEffect(function(){setOptions(actionListOptions);},[actionListOptions]);var actionListContainerRole=getActionListContainerRole(hasFooterAction,dropdownTriggerer);var actionListItemWrapperRole=getActionListItemWrapperRole(hasFooterAction,dropdownTriggerer);var isMultiSelectable=selectionType==='multiple';var actionListContextValue=React__default.useMemo(function(){return {surfaceLevel:surfaceLevel};},[surfaceLevel]);return jsx(ActionListContext.Provider,{value:actionListContextValue,children:isInBottomSheet?jsx(ActionListBox,{isInBottomSheet:isInBottomSheet,actionListItemWrapperRole:actionListItemWrapperRole,childrenWithId:childrenWithId,sectionData:sectionData,isMultiSelectable:isMultiSelectable,ref:actionListItemRef}):jsx(BaseBox,_extends({id:dropdownBaseId+"-actionlist"},makeAccessible({role:actionListContainerRole,multiSelectable:actionListContainerRole==='listbox'?isMultiSelectable:undefined,labelledBy:dropdownBaseId+"-label"}),metaAttribute({name:MetaConstants.ActionList,testID:testID}),{children:jsx(ActionListBox,{isInBottomSheet:isInBottomSheet,actionListItemWrapperRole:actionListItemWrapperRole,childrenWithId:childrenWithId,sectionData:sectionData,isMultiSelectable:isMultiSelectable,ref:actionListItemRef})}))});};var ActionList=assignWithoutSideEffects(React__default.memo(_ActionList),{displayName:componentIds.ActionList,componentId:componentIds.ActionList});
|
|
2653
2655
|
|
|
2654
2656
|
var _ActionListItemAsset=function _ActionListItemAsset(props){var source=typeof props.src==='string'?{uri:props.src}:props.src;return jsx(Image,{source:source,style:{width:size[16],height:size[12]},accessibilityIgnoresInvertColors:true,alt:props.alt});};var ActionListItemAsset=assignWithoutSideEffects(_ActionListItemAsset,{componentId:componentIds.ActionListItemAsset});
|
|
2655
2657
|
|
|
@@ -2663,11 +2665,11 @@ var _IconButton=function _IconButton(_ref,ref){var icon=_ref.icon,onClick=_ref.o
|
|
|
2663
2665
|
|
|
2664
2666
|
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%':'auto',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'};};
|
|
2665
2667
|
|
|
2666
|
-
var _excluded$B=["onClick","href","onBlur","onKeyDown","children","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","activeBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","activeBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID"];var StyledPressable$1=styled(Animated.createAnimatedComponent(Pressable))(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getBaseButtonStyles(props),{alignSelf:'center',display:'flex'},styledPropsCSSObject);});var openURL$1=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);
|
|
2668
|
+
var _excluded$B=["onClick","href","onBlur","onKeyDown","children","minHeight","buttonPaddingTop","buttonPaddingBottom","buttonPaddingLeft","buttonPaddingRight","isFullWidth","disabled","defaultBackgroundColor","defaultBorderColor","hoverBackgroundColor","activeBackgroundColor","focusBackgroundColor","focusRingColor","hoverBorderColor","activeBorderColor","focusBorderColor","borderWidth","borderRadius","motionDuration","motionEasing","isLoading","accessibilityProps","testID"];var StyledPressable$1=styled(Animated.createAnimatedComponent(Pressable))(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getBaseButtonStyles(props),{alignSelf:'center',display:'flex'},styledPropsCSSObject);});var openURL$1=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);if(__DEV__){logger({type:'warn',message:"Could not open the link \"href="+href+"\"",moduleName:'BaseButton'});}case 12:case"end":return _context.stop();}}},null,null,[[0,9]],Promise);};var _StyledBaseButton=function _StyledBaseButton(_ref,ref){var onClick=_ref.onClick,href=_ref.href;_ref.onBlur;_ref.onKeyDown;var _children=_ref.children,minHeight=_ref.minHeight,buttonPaddingTop=_ref.buttonPaddingTop,buttonPaddingBottom=_ref.buttonPaddingBottom,buttonPaddingLeft=_ref.buttonPaddingLeft,buttonPaddingRight=_ref.buttonPaddingRight,isFullWidth=_ref.isFullWidth,disabled=_ref.disabled,defaultBackgroundColor=_ref.defaultBackgroundColor,defaultBorderColor=_ref.defaultBorderColor,hoverBackgroundColor=_ref.hoverBackgroundColor,activeBackgroundColor=_ref.activeBackgroundColor,focusBackgroundColor=_ref.focusBackgroundColor,focusRingColor=_ref.focusRingColor,hoverBorderColor=_ref.hoverBorderColor,activeBorderColor=_ref.activeBorderColor,focusBorderColor=_ref.focusBorderColor,borderWidth=_ref.borderWidth,borderRadius=_ref.borderRadius,motionDuration=_ref.motionDuration,motionEasing=_ref.motionEasing,isLoading=_ref.isLoading,accessibilityProps=_ref.accessibilityProps,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$B);var _useTheme=useTheme(),theme=_useTheme.theme;var isPressed=useSharedValue(false);var duration=get_1(theme.motion,motionDuration);var easing=get_1(theme.motion,motionEasing);var animatedStyles=useAnimatedStyle(function(){var _f=function _f(){return {backgroundColor:withTiming(isPressed.value?activeBackgroundColor:defaultBackgroundColor,{duration:duration,easing:easing}),borderColor:withTiming(isPressed.value?activeBorderColor:defaultBorderColor,{duration:duration,easing:easing})};};_f._closure={withTiming:withTiming,isPressed:isPressed,activeBackgroundColor:activeBackgroundColor,defaultBackgroundColor:defaultBackgroundColor,duration:duration,easing:easing,activeBorderColor:activeBorderColor,defaultBorderColor:defaultBorderColor};_f.asString="function _f(){const{withTiming,isPressed,activeBackgroundColor,defaultBackgroundColor,duration,easing,activeBorderColor,defaultBorderColor}=jsThis._closure;{return{backgroundColor:withTiming(isPressed.value?activeBackgroundColor:defaultBackgroundColor,{duration:duration,easing:easing}),borderColor:withTiming(isPressed.value?activeBorderColor:defaultBorderColor,{duration:duration,easing:easing})};}}";_f.__workletHash=6870832376373;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Button/BaseButton/StyledBaseButton.native.tsx (82:42)";_f.__optimalization=2;return _f;}());var handleOnPress=function handleOnPress(event){if(href){void openURL$1(href);}if(onClick){onClick(event);}};return jsx(StyledPressable$1,_extends({},styledProps,accessibilityProps,{ref:ref,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,activeBackgroundColor:activeBackgroundColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,activeBorderColor:activeBorderColor,focusBorderColor:focusBorderColor,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,testID:testID,children:function children(_ref2){var pressed=_ref2.pressed;isPressed.value=pressed;return _children;}}));};var StyledBaseButton=assignWithoutSideEffects(React__default.forwardRef(_StyledBaseButton),{displayName:'StyledBaseButton'});
|
|
2667
2669
|
|
|
2668
2670
|
var typography={fonts:{size:{xsmall:75,small:75,medium:100,large:200}},lineHeights:{xsmall:50,small:50,medium:100,large:300}};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 buttonIconOnlyPadding={xsmall:{top:0,bottom:0,left:4,right:4},small:{top:0,bottom:0,left:3,right:3},medium:{top:0,bottom:0,left:3,right:3},large:{top:0,bottom:0,left:4,right:4}};var buttonSizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonIconOnlySizeToIconSizeMap={xsmall:'medium',small:'medium',medium:'large',large:'xlarge'};var buttonSizeToSpinnerSizeMap={xsmall:'medium',small:'large',medium:'large',large:'xlarge'};var textPadding={xsmall:2,small:2,medium:3,large:3};
|
|
2669
2671
|
|
|
2670
|
-
function announce(message){AccessibilityInfo.announceForAccessibility(message);}function clearAnnouncer(_assertiveness){
|
|
2672
|
+
function announce(message){AccessibilityInfo.announceForAccessibility(message);}function clearAnnouncer(_assertiveness){if(__DEV__){logger({type:'warn',message:'clearAnnouncer is not needed in react-native',moduleName:'LiveAnnouncer'});}}function destroyAnnouncer(){if(__DEV__){logger({type:'warn',message:'destroyAnnouncer is not needed in react-native',moduleName:'LiveAnnouncer'});}}
|
|
2671
2673
|
|
|
2672
2674
|
var dimensions={medium:16,large:20,xlarge:24};var motion={duration:'duration.2xgentle',easing:'easing.standard.attentive'};
|
|
2673
2675
|
|
|
@@ -2679,17 +2681,17 @@ var _excluded$A=["label","labelPosition","accessibilityLabel","contrast","intent
|
|
|
2679
2681
|
|
|
2680
2682
|
var getStringFromReactText=function getStringFromReactText(childReactText){if(isEmpty_1(childReactText)){return undefined;}if(Array.isArray(childReactText)){return childReactText.join('');}return String(childReactText);};
|
|
2681
2683
|
|
|
2682
|
-
var _excluded$z=["href","target","rel","variant","intent","contrast","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","accessibilityLabel","testID","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter"];var getRenderElement=function getRenderElement(href){if(isReactNative$4()){return undefined;}if(href){return 'a';}return 'button';};var getColorToken$1=function getColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,contrast=_ref.contrast,intent=_ref.intent;if(intent&&contrast){return "feedback."+intent+".action."+property+".primary."+state+"."+contrast+"Contrast";}return "action."+property+"."+variant+"."+state;};var getProps$1=function getProps(_ref2){var buttonTypographyTokens=_ref2.buttonTypographyTokens,children=_ref2.children,isDisabled=_ref2.isDisabled,size=_ref2.size,theme=_ref2.theme,variant=_ref2.variant,intent=_ref2.intent,contrast=_ref2.contrast,hasIcon=_ref2.hasIcon;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."+textPadding[size]:undefined,iconColor:getColorToken$1({property:'icon',variant:variant,contrast:contrast,intent:intent,state:'default'}),textColor:getColorToken$1({property:'text',variant:variant,contrast:contrast,intent:intent,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:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'default'})),defaultBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'default'})),hoverBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'hover'})),hoverBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'hover'})),activeBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'active'})),activeBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'active'})),focusBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'focus'})),focusBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'focus'})),focusRingColor:get_1(theme.colors,'brand.primary.400'),borderWidth:makeBorderSize(theme.border.width.thin),borderRadius:makeBorderSize(theme.border.radius.small),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'disabled'}));var disabledBorderColor=get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'disabled'}));props.iconColor=getColorToken$1({property:'icon',variant:variant,contrast:contrast,intent:intent,state:'disabled'});props.textColor=getColorToken$1({property:'text',variant:variant,contrast:contrast,intent:intent,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.activeBackgroundColor=disabledBackgroundColor;props.activeBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref3){var isHidden=_ref3.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref4,ref){var href=_ref4.href,target=_ref4.target,rel=_ref4.rel,_ref4$variant=_ref4.variant,variant=_ref4$variant===void 0?'primary':_ref4$variant,intent=_ref4.intent,_ref4$contrast=_ref4.contrast,contrast=_ref4$contrast===void 0?'low':_ref4$contrast,_ref4$size=_ref4.size,size=_ref4$size===void 0?'medium':_ref4$size,Icon=_ref4.icon,_ref4$iconPosition=_ref4.iconPosition,iconPosition=_ref4$iconPosition===void 0?'left':_ref4$iconPosition,_ref4$isDisabled=_ref4.isDisabled,isDisabled=_ref4$isDisabled===void 0?false:_ref4$isDisabled,_ref4$isFullWidth=_ref4.isFullWidth,isFullWidth=_ref4$isFullWidth===void 0?false:_ref4$isFullWidth,_ref4$isLoading=_ref4.isLoading,isLoading=_ref4$isLoading===void 0?false:_ref4$isLoading,onClick=_ref4.onClick,onBlur=_ref4.onBlur,onKeyDown=_ref4.onKeyDown,_ref4$type=_ref4.type,type=_ref4$type===void 0?'button':_ref4$type,children=_ref4.children,accessibilityLabel=_ref4.accessibilityLabel,testID=_ref4.testID,onFocus=_ref4.onFocus,onMouseLeave=_ref4.onMouseLeave,onMouseMove=_ref4.onMouseMove,onPointerDown=_ref4.onPointerDown,onPointerEnter=_ref4.onPointerEnter,styledProps=_objectWithoutProperties(_ref4,_excluded$z);var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var disabled=isLoading||isDisabled&&!isLink;var _useTheme=useTheme(),theme=_useTheme.theme;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throw new Error("[Blade: BaseButton]: At least one of icon or text is required to render a button.");}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps$1({buttonTypographyTokens:typography,children:childrenString,isDisabled:disabled,size:size,variant:variant,theme:theme,intent:intent,contrast:contrast,hasIcon:Boolean(Icon)}),activeBorderColor=_getProps.activeBorderColor,activeBackgroundColor=_getProps.activeBackgroundColor,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,_extends({ref:ref,as:renderElement,href:href,target:target,rel:rel!=null?rel:defaultRel,accessibilityProps:_extends({},makeAccessible({role:isLink?'link':'button',label:accessibilityLabel})),isLoading:isLoading,disabled:disabled,activeBorderColor:activeBorderColor,activeBackgroundColor:activeBackgroundColor,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,type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing},metaAttribute({name:MetaConstants.Button,testID:testID}),styledProps,{children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,intent:intent,contrast:contrast})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,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:"bold",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'});
|
|
2684
|
+
var _excluded$z=["href","target","rel","variant","intent","contrast","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$4()){return undefined;}if(href){return 'a';}return 'button';};var getColorToken$1=function getColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,contrast=_ref.contrast,intent=_ref.intent;if(intent&&contrast){return "feedback."+intent+".action."+property+".primary."+state+"."+contrast+"Contrast";}return "action."+property+"."+variant+"."+state;};var getProps$1=function getProps(_ref2){var buttonTypographyTokens=_ref2.buttonTypographyTokens,children=_ref2.children,isDisabled=_ref2.isDisabled,size=_ref2.size,theme=_ref2.theme,variant=_ref2.variant,intent=_ref2.intent,contrast=_ref2.contrast,hasIcon=_ref2.hasIcon;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."+textPadding[size]:undefined,iconColor:getColorToken$1({property:'icon',variant:variant,contrast:contrast,intent:intent,state:'default'}),textColor:getColorToken$1({property:'text',variant:variant,contrast:contrast,intent:intent,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:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'default'})),defaultBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'default'})),hoverBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'hover'})),hoverBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'hover'})),activeBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'active'})),activeBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'active'})),focusBackgroundColor:get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'focus'})),focusBorderColor:get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'focus'})),focusRingColor:get_1(theme.colors,'brand.primary.400'),borderWidth:makeBorderSize(theme.border.width.thin),borderRadius:makeBorderSize(theme.border.radius.small),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=get_1(theme.colors,getColorToken$1({property:'background',variant:variant,contrast:contrast,intent:intent,state:'disabled'}));var disabledBorderColor=get_1(theme.colors,getColorToken$1({property:'border',variant:variant,contrast:contrast,intent:intent,state:'disabled'}));props.iconColor=getColorToken$1({property:'icon',variant:variant,contrast:contrast,intent:intent,state:'disabled'});props.textColor=getColorToken$1({property:'text',variant:variant,contrast:contrast,intent:intent,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.activeBackgroundColor=disabledBackgroundColor;props.activeBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref3){var isHidden=_ref3.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref4,ref){var href=_ref4.href,target=_ref4.target,rel=_ref4.rel,_ref4$variant=_ref4.variant,variant=_ref4$variant===void 0?'primary':_ref4$variant,intent=_ref4.intent,_ref4$contrast=_ref4.contrast,contrast=_ref4$contrast===void 0?'low':_ref4$contrast,_ref4$size=_ref4.size,size=_ref4$size===void 0?'medium':_ref4$size,Icon=_ref4.icon,_ref4$iconPosition=_ref4.iconPosition,iconPosition=_ref4$iconPosition===void 0?'left':_ref4$iconPosition,_ref4$isDisabled=_ref4.isDisabled,isDisabled=_ref4$isDisabled===void 0?false:_ref4$isDisabled,_ref4$isFullWidth=_ref4.isFullWidth,isFullWidth=_ref4$isFullWidth===void 0?false:_ref4$isFullWidth,_ref4$isLoading=_ref4.isLoading,isLoading=_ref4$isLoading===void 0?false:_ref4$isLoading,onClick=_ref4.onClick,onBlur=_ref4.onBlur,onKeyDown=_ref4.onKeyDown,_ref4$type=_ref4.type,type=_ref4$type===void 0?'button':_ref4$type,children=_ref4.children,testID=_ref4.testID,onFocus=_ref4.onFocus,onMouseLeave=_ref4.onMouseLeave,onMouseMove=_ref4.onMouseMove,onPointerDown=_ref4.onPointerDown,onPointerEnter=_ref4.onPointerEnter,accessibilityProps=_ref4.accessibilityProps,onTouchEnd=_ref4.onTouchEnd,onTouchStart=_ref4.onTouchStart,rest=_objectWithoutProperties(_ref4,_excluded$z);var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var disabled=isLoading||isDisabled&&!isLink;var _useTheme=useTheme(),theme=_useTheme.theme;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$1({buttonTypographyTokens:typography,children:childrenString,isDisabled:disabled,size:size,variant:variant,theme:theme,intent:intent,contrast:contrast,hasIcon:Boolean(Icon)}),activeBorderColor=_getProps.activeBorderColor,activeBackgroundColor=_getProps.activeBackgroundColor,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,_extends({ref:ref,as:renderElement,href:href,target:target,rel:rel!=null?rel:defaultRel,accessibilityProps:_extends({},makeAccessible(_extends({role:isLink?'link':'button'},accessibilityProps))),isLoading:isLoading,disabled:disabled,activeBorderColor:activeBorderColor,activeBackgroundColor:activeBackgroundColor,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",children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,intent:intent,contrast:contrast})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,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:"bold",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'});
|
|
2683
2685
|
|
|
2684
2686
|
var getStyledLinkStyles=function getStyledLinkStyles(_ref){var cursor=_ref.cursor;return {padding:0,backgroundColor:'transparent',outline:'none',textDecoration:'none',border:'none',cursor:cursor};};
|
|
2685
2687
|
|
|
2686
|
-
var StyledNativeLink=styled.Pressable(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getStyledLinkStyles({}),{alignSelf:'flex-start'},styledPropsCSSObject);});var openURL=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);
|
|
2688
|
+
var StyledNativeLink=styled.Pressable(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getStyledLinkStyles({}),{alignSelf:'flex-start'},styledPropsCSSObject);});var openURL=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);if(__DEV__){logger({message:"Could not open the link \"href="+href+"\"",moduleName:'BaseLink',type:'warn'});}case 12:case"end":return _context.stop();}}},null,null,[[0,9]],Promise);};var _StyledLink=function _StyledLink(_ref,ref){var variant=_ref.variant,disabled=_ref.disabled,href=_ref.href,onClick=_ref.onClick,children=_ref.children,setCurrentInteraction=_ref.setCurrentInteraction,accessibilityProps=_ref.accessibilityProps,style=_ref.style,testID=_ref.testID,hitSlop=_ref.hitSlop,onTouchStart=_ref.onTouchStart,onTouchEnd=_ref.onTouchEnd;var handleOnPress=function handleOnPress(event){if(href&&variant==='anchor'){void openURL(href);}if(onClick){onClick(event);}};return jsx(StyledNativeLink,_extends({ref:ref},accessibilityProps,{disabled:disabled,onPress:handleOnPress,onPressIn:function onPressIn(){return setCurrentInteraction('active');},onPressOut:function onPressOut(){return setCurrentInteraction('default');},onTouchStart:castNativeType(onTouchStart),onTouchEnd:castNativeType(onTouchEnd),style:style,testID:testID,hitSlop:hitSlop,children:children}));};var StyledLink=React__default.forwardRef(_StyledLink);
|
|
2687
2689
|
|
|
2688
2690
|
var useInteraction=function useInteraction(){var _useState=useState('default'),_useState2=_slicedToArray(_useState,2),currentInteraction=_useState2[0],setCurrentInteraction=_useState2[1];var onMouseEnter=function onMouseEnter(){if(currentInteraction!=='active')setCurrentInteraction('hover');};var onMouseLeave=function onMouseLeave(){if(currentInteraction!=='active')setCurrentInteraction('default');};var onFocus=function onFocus(){setCurrentInteraction('active');};var onBlur=function onBlur(){setCurrentInteraction('default');};return {onMouseEnter:onMouseEnter,onMouseLeave:onMouseLeave,onFocus:onFocus,onBlur:onBlur,currentInteraction:currentInteraction,setCurrentInteraction:setCurrentInteraction};};
|
|
2689
2691
|
|
|
2690
|
-
var _excluded$y=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","intent","contrast","
|
|
2692
|
+
var _excluded$y=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","intent","contrast","accessibilityProps","className","style","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"],_excluded2=["currentInteraction","setCurrentInteraction"];var getColorToken=function getColorToken(_ref){var variant=_ref.variant,intent=_ref.intent,contrast=_ref.contrast,element=_ref.element,currentInteraction=_ref.currentInteraction,isDisabled=_ref.isDisabled,isVisited=_ref.isVisited;var state=currentInteraction;if(isDisabled&&variant=='button'){state='disabled';}if(isVisited&&variant=='anchor'&&!intent){state='visited';}if(intent&&state!=='visited'){return "feedback."+intent+".action."+element+".link."+state+"."+contrast+"Contrast";}return "action."+element+".link."+state;};var getProps=function getProps(_ref2){var theme=_ref2.theme,variant=_ref2.variant,currentInteraction=_ref2.currentInteraction,children=_ref2.children,isDisabled=_ref2.isDisabled,intent=_ref2.intent,contrast=_ref2.contrast,isVisited=_ref2.isVisited,target=_ref2.target,size=_ref2.size;var isButton=variant==='button';var textSizes={fontSize:{xsmall:25,small:75,medium:100,large:200},lineHeight:{xsmall:50,small:50,medium:100,large:300}};var props={as:isButton?'button':'a',textDecorationLine:!isButton&¤tInteraction!=='default'?'underline':'none',iconColor:getColorToken({variant:variant,intent:intent,contrast:contrast,element:'icon',currentInteraction:currentInteraction,isDisabled:isDisabled,isVisited:isVisited}),fontSize:textSizes.fontSize[size],lineHeight:textSizes.lineHeight[size],iconSize:size,iconPadding:children!=null&&children.trim()?'spacing.2':'spacing.0',textColor:getColorToken({variant:variant,intent:intent,contrast:contrast,element:'text',currentInteraction:currentInteraction,isDisabled:isDisabled,isVisited:isVisited}),focusRingColor:get_1(theme.colors,'brand.primary.400'),motionDuration:'duration.2xquick',motionEasing:'easing.standard.effective',cursor:isButton&&isDisabled?'not-allowed':'pointer',disabled:isButton&&isDisabled,role:isButton?'button':'link',defaultRel:target&&target==='_blank'?'noreferrer noopener':undefined,type:isButton?'button':undefined};return props;};var _BaseLink=function _BaseLink(_ref3,ref){var children=_ref3.children,Icon=_ref3.icon,_ref3$iconPosition=_ref3.iconPosition,iconPosition=_ref3$iconPosition===void 0?'left':_ref3$iconPosition,_ref3$isDisabled=_ref3.isDisabled,isDisabled=_ref3$isDisabled===void 0?false:_ref3$isDisabled,onClick=_ref3.onClick,onKeyDown=_ref3.onKeyDown,_ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'anchor':_ref3$variant,href=_ref3.href,target=_ref3.target,rel=_ref3.rel,intent=_ref3.intent,_ref3$contrast=_ref3.contrast,contrast=_ref3$contrast===void 0?'low':_ref3$contrast,accessibilityProps=_ref3.accessibilityProps,className=_ref3.className,style=_ref3.style,_ref3$size=_ref3.size,size=_ref3$size===void 0?'medium':_ref3$size,testID=_ref3.testID,hitSlop=_ref3.hitSlop,htmlTitle=_ref3.htmlTitle,_onBlur=_ref3.onBlur,_onFocus=_ref3.onFocus,_onMouseLeave=_ref3.onMouseLeave,onMouseMove=_ref3.onMouseMove,onPointerDown=_ref3.onPointerDown,onPointerEnter=_ref3.onPointerEnter,onTouchStart=_ref3.onTouchStart,onTouchEnd=_ref3.onTouchEnd,styledProps=_objectWithoutProperties(_ref3,_excluded$y);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isVisited=_useState2[0],setIsVisited=_useState2[1];var childrenString=getStringFromReactText(children);var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded2);var _useTheme=useTheme(),theme=_useTheme.theme;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:"At least one of icon or text is required to render a link.",moduleName:'BaseLink'});}}var _getProps=getProps({theme:theme,variant:variant,currentInteraction:currentInteraction,children:childrenString,isDisabled:isDisabled,intent:intent,contrast:contrast,isVisited:isVisited,target:target,size:size}),as=_getProps.as,textDecorationLine=_getProps.textDecorationLine,iconColor=_getProps.iconColor,iconPadding=_getProps.iconPadding,iconSize=_getProps.iconSize,fontSize=_getProps.fontSize,textColor=_getProps.textColor,focusRingColor=_getProps.focusRingColor,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing,cursor=_getProps.cursor,disabled=_getProps.disabled,role=_getProps.role,defaultRel=_getProps.defaultRel,type=_getProps.type,lineHeight=_getProps.lineHeight;var handleOnClick=function handleOnClick(event){if(!isVisited&&!intent&&variant==='anchor'){setIsVisited(true);}if(onClick){onClick(event);}};var asProp=isReactNative$4()?undefined:'span';return jsx(StyledLink,_extends({ref:ref},metaAttribute({name:MetaConstants.Link,testID:testID}),{accessibilityProps:_extends({},makeAccessible(_extends({role:role,disabled:disabled},accessibilityProps))),variant:variant,as:as,href:href,target:target,rel:rel!=null?rel:defaultRel,onClick:handleOnClick},syntheticEvents,{onBlur:function onBlur(event){_onBlur==null?void 0:_onBlur(event);syntheticEvents.onBlur();},onFocus:function onFocus(event){_onFocus==null?void 0:_onFocus(event);syntheticEvents.onFocus();},onMouseLeave:function onMouseLeave(event){if(_onMouseLeave){_onMouseLeave(event);}syntheticEvents.onMouseLeave();},onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,onKeyDown:onKeyDown,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction},getStyledProps(styledProps),{className:className,style:style,hitSlop:hitSlop,title:htmlTitle,children:jsxs(BaseBox,{as:asProp,display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(BaseBox,{as:asProp,paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{as:asProp,textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"bold",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{as:asProp,paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};var BaseLink=assignWithoutSideEffects(React__default.forwardRef(_BaseLink),{displayName:'BaseLink',componentId:'BaseLink'});
|
|
2691
2693
|
|
|
2692
|
-
var _excluded$x=["description","title","isDismissible","onDismiss","contrast","isFullWidth","intent","actions","testID"];var isReactNative$3=getPlatformType()==='react-native';var CloseButtonWrapper=isReactNative$3?BaseBox:Fragment$1;var intentIconMap={positive:CheckCircleIcon,negative:AlertTriangleIcon,information:InfoIcon,neutral:InfoIcon,notice:AlertTriangleIcon$1};var Alert=function Alert(_ref){var description=_ref.description,title=_ref.title,_ref$isDismissible=_ref.isDismissible,isDismissible=_ref$isDismissible===void 0?true:_ref$isDismissible,onDismiss=_ref.onDismiss,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent,actions=_ref.actions,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$x);if(__DEV__){if(!(actions!=null&&actions.primary)&&actions!=null&&actions.secondary){
|
|
2694
|
+
var _excluded$x=["description","title","isDismissible","onDismiss","contrast","isFullWidth","intent","actions","testID"];var isReactNative$3=getPlatformType()==='react-native';var CloseButtonWrapper=isReactNative$3?BaseBox:Fragment$1;var intentIconMap={positive:CheckCircleIcon,negative:AlertTriangleIcon,information:InfoIcon,neutral:InfoIcon,notice:AlertTriangleIcon$1};var Alert=function Alert(_ref){var description=_ref.description,title=_ref.title,_ref$isDismissible=_ref.isDismissible,isDismissible=_ref$isDismissible===void 0?true:_ref$isDismissible,onDismiss=_ref.onDismiss,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent,actions=_ref.actions,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$x);if(__DEV__){if(!(actions!=null&&actions.primary)&&actions!=null&&actions.secondary){throwBladeError({message:'SecondaryAction is allowed only when PrimaryAction is defined.',moduleName:'Alert'});}}var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isDesktop=matchedDeviceType==='desktop';var isMobile=!isDesktop;var _useState=useState(true),_useState2=_slicedToArray(_useState,2),isVisible=_useState2[0],setIsVisible=_useState2[1];var contrastType=contrast+"Contrast";var iconSize=isFullWidth?'large':'medium';var textSize=isFullWidth?'medium':'small';var Icon=intentIconMap[intent];var iconOffset='spacing.1';if(isReactNative$3){if(isFullWidth&&!title){iconOffset='spacing.1';}else if(!isFullWidth&&!title){iconOffset='spacing.0';}else if(!isFullWidth&&title){iconOffset='spacing.2';}}else if(isMobile){if(!isFullWidth&&title){iconOffset='spacing.2';}else if(isFullWidth&&!title){iconOffset='spacing.2';}}else if(isFullWidth){iconOffset='spacing.0';}var icon=jsx(BaseBox,{marginTop:iconOffset,display:"flex",children:jsx(Icon,{color:"feedback.icon."+intent+"."+contrastType,size:iconSize})});var _title=title?jsx(BaseBox,{marginBottom:"spacing.2",children:isFullWidth?jsx(Heading,{type:"subtle",size:"small",contrast:contrast,children:title}):jsx(Text,{type:"subtle",weight:"bold",contrast:contrast,children:title})}):null;var _description=jsx(BaseBox,{marginTop:title||isReactNative$3?'spacing.0':'spacing.1',children:jsx(Text,{type:"subtle",size:textSize,contrast:contrast,children:description})});var primaryAction=actions!=null&&actions.primary?jsx(BaseBox,{marginRight:"spacing.5",display:isReactNative$3?castNativeType('flex'):castWebType('inline-flex'),children:jsx(BaseButton,{size:textSize,onClick:actions.primary.onClick,intent:intent,contrast:contrast,children:actions.primary.text})}):null;var secondaryActionParams=actions!=null&&actions.secondary?{onClick:actions.secondary.onClick}:null;if(actions!=null&&actions.secondary&&secondaryActionParams&&'href'in actions.secondary){secondaryActionParams.href=actions.secondary.href;secondaryActionParams.target=actions.secondary.target;secondaryActionParams.rel=actions.secondary.rel;}var secondaryAction=actions!=null&&actions.secondary?jsx(BaseBox,{marginRight:"spacing.4",display:isReactNative$3?castNativeType('flex'):castWebType('inline-flex'),children:jsx(BaseLink,_extends({size:textSize,contrast:contrast,intent:intent},secondaryActionParams,{children:actions.secondary.text}))}):null;var showActionsHorizontal=isFullWidth&&isDesktop;var actionsHorizontal=showActionsHorizontal&&(primaryAction||secondaryAction)?jsxs(BaseBox,{flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var actionsVertical=!showActionsHorizontal&&(primaryAction||secondaryAction)?jsxs(BaseBox,{marginTop:"spacing.4",flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var onClickDismiss=function onClickDismiss(){if(onDismiss){onDismiss();}setIsVisible(false);};var closeButton=isDismissible?jsx(CloseButtonWrapper,{children:jsx(IconButton,{accessibilityLabel:"Dismiss alert",onClick:onClickDismiss,contrast:contrast,size:iconSize,icon:CloseIcon})}):null;var a11yProps=makeAccessible(_extends({role:isReactNative$3||intent==='negative'||intent==='notice'?'alert':'status'},intent==='notice'&&{liveRegion:'polite'}));if(!isVisible){return null;}return jsx(BaseBox,_extends({},a11yProps,metaAttribute({name:MetaConstants.Alert,testID:testID}),getStyledProps(styledProps),{children:jsxs(StyledAlert,{intent:intent,contrastType:contrastType,isFullWidth:isFullWidth,isDesktop:isDesktop,textAlign:'left',children:[icon,jsxs(BaseBox,{flex:1,paddingLeft:isFullWidth?'spacing.4':'spacing.3',paddingRight:showActionsHorizontal?'spacing.4':'spacing.2',children:[_title,_description,actionsVertical]}),actionsHorizontal,closeButton]})}));};
|
|
2693
2695
|
|
|
2694
2696
|
var getStyledBadgeStyles=function getStyledBadgeStyles(_ref){var theme=_ref.theme,backgroundColor=_ref.backgroundColor;return {backgroundColor:get_1(theme.colors,backgroundColor),borderRadius:makeBorderSize(theme.border.radius.max),display:'flex',flexWrap:'nowrap'};};
|
|
2695
2697
|
|
|
@@ -2697,17 +2699,17 @@ var StyledBadge=styled(BaseBox)(function(props){return _extends({},getStyledBadg
|
|
|
2697
2699
|
|
|
2698
2700
|
var verticalPadding$1={small:'spacing.0',medium:'spacing.1',large:'spacing.2'};var horizontalPadding$1={small:'spacing.3',medium:'spacing.3',large:'spacing.4'};var iconPadding={small:'spacing.1',medium:'spacing.2',large:'spacing.2'};var iconSize={small:'xsmall',medium:'small',large:'small'};
|
|
2699
2701
|
|
|
2700
|
-
var _excluded$w=["children","contrast","fontWeight","icon","size","variant","testID"];var isFeedbackVariant$1=function isFeedbackVariant(variant){var feedbackVariants=['information','negative','neutral','notice','positive'];return feedbackVariants.includes(variant);};var getColorProps$1=function getColorProps(_ref){var variant=_ref.variant,contrast=_ref.contrast;var props={iconColor:'feedback.icon.neutral.lowContrast',textColor:'feedback.text.neutral.lowContrast',backgroundColor:'feedback.background.neutral.lowContrast'};if(isFeedbackVariant$1(variant)){props.iconColor="feedback.icon."+variant+"."+contrast+"Contrast";props.textColor="feedback.text."+variant+"."+contrast+"Contrast";props.backgroundColor="feedback.background."+variant+"."+contrast+"Contrast";}else {props.iconColor="badge.icon."+variant+"."+contrast+"Contrast";props.textColor="badge.text."+variant+"."+contrast+"Contrast";props.backgroundColor="badge.background."+variant+"."+contrast+"Contrast";}return props;};var _Badge=function _Badge(_ref2){var children=_ref2.children,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$fontWeight=_ref2.fontWeight,fontWeight=_ref2$fontWeight===void 0?'regular':_ref2$fontWeight,Icon=_ref2.icon,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'neutral':_ref2$variant,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$w);var childrenString=getStringFromReactText(children);if(__DEV__){if(!(childrenString!=null&&childrenString.trim())){
|
|
2702
|
+
var _excluded$w=["children","contrast","fontWeight","icon","size","variant","testID"];var isFeedbackVariant$1=function isFeedbackVariant(variant){var feedbackVariants=['information','negative','neutral','notice','positive'];return feedbackVariants.includes(variant);};var getColorProps$1=function getColorProps(_ref){var variant=_ref.variant,contrast=_ref.contrast;var props={iconColor:'feedback.icon.neutral.lowContrast',textColor:'feedback.text.neutral.lowContrast',backgroundColor:'feedback.background.neutral.lowContrast'};if(isFeedbackVariant$1(variant)){props.iconColor="feedback.icon."+variant+"."+contrast+"Contrast";props.textColor="feedback.text."+variant+"."+contrast+"Contrast";props.backgroundColor="feedback.background."+variant+"."+contrast+"Contrast";}else {props.iconColor="badge.icon."+variant+"."+contrast+"Contrast";props.textColor="badge.text."+variant+"."+contrast+"Contrast";props.backgroundColor="badge.background."+variant+"."+contrast+"Contrast";}return props;};var _Badge=function _Badge(_ref2){var children=_ref2.children,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$fontWeight=_ref2.fontWeight,fontWeight=_ref2$fontWeight===void 0?'regular':_ref2$fontWeight,Icon=_ref2.icon,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'neutral':_ref2$variant,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$w);var childrenString=getStringFromReactText(children);if(__DEV__){if(!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'Text as children is required for Badge.',moduleName:'Badge'});}}var _getColorProps=getColorProps$1({variant:variant,contrast:contrast}),backgroundColor=_getColorProps.backgroundColor,iconColor=_getColorProps.iconColor,textColor=_getColorProps.textColor;var badgeTextSizes={small:{variant:'body',size:'xsmall'},medium:{variant:'body',size:'small'},large:{variant:'body',size:'small'}};return jsx(BaseBox,_extends({display:"flex"},metaAttribute({name:MetaConstants.Badge,testID:testID}),getStyledProps(styledProps),{children:jsx(StyledBadge,{backgroundColor:backgroundColor,size:size,textAlign:'left',children:jsxs(BaseBox,{paddingRight:horizontalPadding$1[size],paddingLeft:horizontalPadding$1[size],paddingTop:verticalPadding$1[size],paddingBottom:verticalPadding$1[size],display:isReactNative$4()?'flex':'inline-flex',flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden",children:[Icon?jsx(BaseBox,{paddingRight:Boolean(Icon)?iconPadding[size]:'spacing.0',display:"flex",children:jsx(Icon,{color:iconColor,size:iconSize[size]})}):null,jsx(Text,_extends({},badgeTextSizes[size],{type:"normal",weight:fontWeight,truncateAfterLines:1,color:textColor,children:children}))]})})}));};var Badge=assignWithoutSideEffects(_Badge,{displayName:'Badge',componentId:'Badge'});
|
|
2701
2703
|
|
|
2702
2704
|
var _excluded$v=["children","surfaceLevel","elevation"];var CardSurfaceStyled=styled(BaseBox)(function(_ref){var surfaceLevel=_ref.surfaceLevel,elevation=_ref.elevation,theme=_ref.theme;var backgroundColor=theme.colors.surface.background["level"+surfaceLevel].lowContrast;return {width:'100%',display:'flex',flexDirection:'column',borderWidth:elevation==='none'?""+theme.border.width.thin:undefined,borderStyle:elevation==='none'?'solid':undefined,borderColor:elevation==='none'?""+theme.colors.surface.border.normal.lowContrast:undefined,backgroundColor:backgroundColor};});var CardSurface=function CardSurface(_ref2){var children=_ref2.children,surfaceLevel=_ref2.surfaceLevel,elevation=_ref2.elevation,props=_objectWithoutProperties(_ref2,_excluded$v);return jsx(CardSurfaceStyled,_extends({},props,{surfaceLevel:surfaceLevel,elevation:elevation,children:children}));};
|
|
2703
2705
|
|
|
2704
|
-
var CardContext=React__default.createContext(null);var useVerifyInsideCard=function useVerifyInsideCard(componentName){var context=React__default.useContext(CardContext);if(__DEV__){if(!context){
|
|
2706
|
+
var CardContext=React__default.createContext(null);var useVerifyInsideCard=function useVerifyInsideCard(componentName){var context=React__default.useContext(CardContext);if(__DEV__){if(!context){throwBladeError({message:componentName+" cannot be used outside of Card component",moduleName:'Card'});}}return true;};var useVerifyAllowedComponents=function useVerifyAllowedComponents(children,componentName,allowedComponents){React__default.Children.forEach(children,function(child){var isValidChild=child&&allowedComponents.includes(getComponentId(child));if(__DEV__){if(!isValidChild){throwBladeError({message:"Only one of `"+allowedComponents.join(', ')+"` component is accepted as "+componentName+" children",moduleName:'Card'});}}});};var CardProvider=function CardProvider(_ref){var children=_ref.children;return jsx(CardContext.Provider,{value:true,children:children});};
|
|
2705
2707
|
|
|
2706
2708
|
var _excluded$u=["children","surfaceLevel","elevation","testID","padding"];var ComponentIds$1={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var Card=function Card(_ref){var children=_ref.children,_ref$surfaceLevel=_ref.surfaceLevel,surfaceLevel=_ref$surfaceLevel===void 0?2:_ref$surfaceLevel,_ref$elevation=_ref.elevation,elevation=_ref$elevation===void 0?'lowRaised':_ref$elevation,testID=_ref.testID,_ref$padding=_ref.padding,padding=_ref$padding===void 0?'spacing.7':_ref$padding,styledProps=_objectWithoutProperties(_ref,_excluded$u);useVerifyAllowedComponents(children,'Card',[ComponentIds$1.CardHeader,ComponentIds$1.CardBody,ComponentIds$1.CardFooter]);return jsx(CardProvider,{children:jsx(BaseBox,_extends({},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(styledProps),{children:jsx(CardSurface,{padding:padding,borderRadius:"medium",surfaceLevel:surfaceLevel,elevation:elevation,textAlign:'left',children:children})}))});};var _CardBody=function _CardBody(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardBody');return jsx(BaseBox,_extends({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),{children:children}));};var CardBody=assignWithoutSideEffects(_CardBody,{componentId:ComponentIds$1.CardBody});
|
|
2707
2709
|
|
|
2708
|
-
var _excluded$t=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","accessibilityLabel","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"];var _Link=function _Link(_ref,ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,onClick=_ref.onClick,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'anchor':_ref$variant,href=_ref.href,target=_ref.target,rel=_ref.rel,accessibilityLabel=_ref.accessibilityLabel,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,hitSlop=_ref.hitSlop,htmlTitle=_ref.htmlTitle,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchStart=_ref.onTouchStart,onTouchEnd=_ref.onTouchEnd,
|
|
2710
|
+
var _excluded$t=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","accessibilityLabel","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"];var _Link=function _Link(_ref,ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,onClick=_ref.onClick,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'anchor':_ref$variant,href=_ref.href,target=_ref.target,rel=_ref.rel,accessibilityLabel=_ref.accessibilityLabel,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,hitSlop=_ref.hitSlop,htmlTitle=_ref.htmlTitle,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchStart=_ref.onTouchStart,onTouchEnd=_ref.onTouchEnd,rest=_objectWithoutProperties(_ref,_excluded$t);return jsx(BaseLink,_extends({},icon?{icon:icon,children:children}:{children:children},variant==='anchor'?{variant:variant,href:href,target:target,rel:rel}:{variant:variant,isDisabled:isDisabled},{ref:ref,iconPosition:iconPosition,onClick:onClick,accessibilityProps:{label:accessibilityLabel,describedBy:rest['aria-describedby']},size:size,testID:testID,hitSlop:hitSlop,htmlTitle:htmlTitle,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd},getStyledProps(rest)));};var Link=assignWithoutSideEffects(React__default.forwardRef(_Link),{displayName:'Link',componentId:'Link'});
|
|
2709
2711
|
|
|
2710
|
-
var _excluded$s=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","href","target","rel","onClick","size","type","variant","accessibilityLabel","testID","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter"];var _Button=function _Button(_ref,ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,href=_ref.href,target=_ref.target,rel=_ref.rel,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,
|
|
2712
|
+
var _excluded$s=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","href","target","rel","onClick","size","type","variant","accessibilityLabel","testID","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"];var _Button=function _Button(_ref,ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,href=_ref.href,target=_ref.target,rel=_ref.rel,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchStart=_ref.onTouchStart,onTouchEnd=_ref.onTouchEnd,rest=_objectWithoutProperties(_ref,_excluded$s);return jsx(BaseButton,_extends({},icon?{icon:icon,children:children}:{children:children},getStyledProps(rest),{ref:ref,href:href,target:target,rel:rel,accessibilityProps:{label:accessibilityLabel,describedBy:rest['aria-describedby']},iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,onClick:onClick,size:size,type:type,variant:variant,isLoading:isLoading,testID:testID,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd}));};var Button=assignWithoutSideEffects(React__default.forwardRef(_Button),{displayName:'Button',componentId:'Button'});
|
|
2711
2713
|
|
|
2712
2714
|
var verticalPadding={small:'spacing.0',medium:'spacing.1',large:'spacing.1'};var horizontalPadding={small:'spacing.2',medium:'spacing.3',large:'spacing.3'};var maxWidth={onMobile:size[100],onDesktop:size[120]};
|
|
2713
2715
|
|
|
@@ -2715,29 +2717,29 @@ var getStyledCounterStyles=function getStyledCounterStyles(_ref){var theme=_ref.
|
|
|
2715
2717
|
|
|
2716
2718
|
var StyledCounter=styled(BaseBox)(function(props){return _extends({},getStyledCounterStyles(props),{alignSelf:'center'});});
|
|
2717
2719
|
|
|
2718
|
-
var _excluded$r=["value","max","intent","variant","contrast","size","testID"];var isFeedbackVariant=function isFeedbackVariant(variant){var feedbackVariants=['information','negative','neutral','notice','positive'];return feedbackVariants.includes(variant);};var getColorProps=function getColorProps(_ref){var _ref$variant=_ref.variant,variant=_ref$variant===void 0?'neutral':_ref$variant,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast;var props={textColor:'feedback.text.neutral.lowContrast',backgroundColor:'feedback.background.neutral.lowContrast'};if(isFeedbackVariant(variant)){props.textColor="feedback.text."+variant+"."+contrast+"Contrast";props.backgroundColor="feedback.background."+variant+"."+contrast+"Contrast";}else {props.textColor="badge.text."+variant+"."+contrast+"Contrast";props.backgroundColor="badge.background."+variant+"."+contrast+"Contrast";}return props;};var Counter=function Counter(_ref2){var value=_ref2.value,max=_ref2.max,intent=_ref2.intent,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'neutral':_ref2$variant,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$r);var content=""+value;if(max&&value>max){content=max+"+";}var _useTheme=useTheme(),platform=_useTheme.platform;var _getColorProps=getColorProps({variant:intent!=null?intent:variant,contrast:contrast}),backgroundColor=_getColorProps.backgroundColor,textColor=_getColorProps.textColor;if(intent){
|
|
2720
|
+
var _excluded$r=["value","max","intent","variant","contrast","size","testID"];var isFeedbackVariant=function isFeedbackVariant(variant){var feedbackVariants=['information','negative','neutral','notice','positive'];return feedbackVariants.includes(variant);};var getColorProps=function getColorProps(_ref){var _ref$variant=_ref.variant,variant=_ref$variant===void 0?'neutral':_ref$variant,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast;var props={textColor:'feedback.text.neutral.lowContrast',backgroundColor:'feedback.background.neutral.lowContrast'};if(isFeedbackVariant(variant)){props.textColor="feedback.text."+variant+"."+contrast+"Contrast";props.backgroundColor="feedback.background."+variant+"."+contrast+"Contrast";}else {props.textColor="badge.text."+variant+"."+contrast+"Contrast";props.backgroundColor="badge.background."+variant+"."+contrast+"Contrast";}return props;};var Counter=function Counter(_ref2){var value=_ref2.value,max=_ref2.max,intent=_ref2.intent,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'neutral':_ref2$variant,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$r);var content=""+value;if(max&&value>max){content=max+"+";}var _useTheme=useTheme(),platform=_useTheme.platform;var _getColorProps=getColorProps({variant:intent!=null?intent:variant,contrast:contrast}),backgroundColor=_getColorProps.backgroundColor,textColor=_getColorProps.textColor;if(__DEV__){if(intent){logger({type:'warn',message:'The prop `intent` is deprecated and will be removed in a future release. Please use `variant` instead.',moduleName:'Counter'});}}var counterTextSizes={small:{variant:'body',size:'xsmall'},medium:{variant:'body',size:'small'},large:{variant:'body',size:'medium'}};return jsx(BaseBox,_extends({display:"flex"},metaAttribute({name:MetaConstants.Counter,testID:testID}),getStyledProps(styledProps),{children:jsx(StyledCounter,{backgroundColor:backgroundColor,size:size,platform:platform,children:jsx(BaseBox,{paddingRight:horizontalPadding[size],paddingLeft:horizontalPadding[size],paddingTop:verticalPadding[size],paddingBottom:verticalPadding[size],display:isReactNative$4()?'flex':'inline-flex',flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden",children:jsx(Text,_extends({},counterTextSizes[size],{textAlign:"center",type:"normal",weight:"regular",truncateAfterLines:1,color:textColor,children:content}))})})}));};
|
|
2719
2721
|
|
|
2720
|
-
var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.text.normal.lowContrast",size:"xlarge"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds$1.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,_extends({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds$1.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,_extends({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds$1.CardHeaderBadge});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,_extends({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds$1.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,_extends({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds$1.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,_extends({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds$1.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardHeader');useVerifyAllowedComponents(children,'CardHeader',[ComponentIds$1.CardHeaderLeading,ComponentIds$1.CardHeaderTrailing]);return jsxs(BaseBox,_extends({marginBottom:"spacing.7"},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),{children:[jsx(BaseBox,{marginBottom:"spacing.7",display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),jsx(Divider,{})]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds$1.CardHeader});var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix;useVerifyInsideCard('CardHeaderLeading');if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds$1.CardHeaderIcon)){
|
|
2722
|
+
var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.text.normal.lowContrast",size:"xlarge"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds$1.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,_extends({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds$1.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,_extends({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds$1.CardHeaderBadge});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,_extends({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds$1.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,_extends({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds$1.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,_extends({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds$1.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardHeader');useVerifyAllowedComponents(children,'CardHeader',[ComponentIds$1.CardHeaderLeading,ComponentIds$1.CardHeaderTrailing]);return jsxs(BaseBox,_extends({marginBottom:"spacing.7"},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),{children:[jsx(BaseBox,{marginBottom:"spacing.7",display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),jsx(Divider,{})]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds$1.CardHeader});var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix;useVerifyInsideCard('CardHeaderLeading');if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds$1.CardHeaderIcon)){throwBladeError({message:"Only `"+ComponentIds$1.CardHeaderIcon+"` component is accepted in prefix",moduleName:'CardHeaderLeading'});}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds$1.CardHeaderCounter)){throwBladeError({message:"Only `"+ComponentIds$1.CardHeaderCounter+"` component is accepted in prefix",moduleName:'CardHeaderLeading'});}}return jsxs(BaseBox,{flex:1,display:"flex",flexDirection:"row",children:[jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{marginRight:"spacing.5",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Heading,{size:"small",variant:"regular",type:"normal",children:title}),jsx(BaseBox,{marginLeft:"spacing.3",children:suffix})]}),subtitle&&jsx(Text,{textAlign:"left",variant:"body",size:"small",weight:"regular",children:subtitle})]})]});};var CardHeaderLeading=assignWithoutSideEffects(_CardHeaderLeading,{componentId:ComponentIds$1.CardHeaderLeading});var headerTrailingAllowedComponents=[ComponentIds$1.CardHeaderLink,ComponentIds$1.CardHeaderText,ComponentIds$1.CardHeaderIconButton,ComponentIds$1.CardHeaderBadge];var _CardHeaderTrailing=function _CardHeaderTrailing(_ref4){var visual=_ref4.visual;useVerifyInsideCard('CardHeaderTrailing');if(__DEV__){if(visual&&!headerTrailingAllowedComponents.includes(getComponentId(visual))){throwBladeError({message:"Only one of `"+headerTrailingAllowedComponents.join(', ')+"` component is accepted in visual",moduleName:'CardHeaderTrailing'});}}return jsx(BaseBox,{alignSelf:"center",children:visual});};var CardHeaderTrailing=assignWithoutSideEffects(_CardHeaderTrailing,{componentId:ComponentIds$1.CardHeaderTrailing});
|
|
2721
2723
|
|
|
2722
2724
|
var useIsMobile=function useIsMobile(){var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;return matchedDeviceType==='mobile';};
|
|
2723
2725
|
|
|
2724
|
-
var _CardFooter=function _CardFooter(_ref){var _footerChildrensArray,_footerChildrensArray2;var children=_ref.children,testID=_ref.testID;var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');useVerifyAllowedComponents(children,'CardFooter',[ComponentIds$1.CardFooterLeading,ComponentIds$1.CardFooterTrailing]);var footerChildrensArray=React__default.Children.toArray(children);if(__DEV__){if(!React__default.isValidElement(footerChildrensArray[0])){
|
|
2726
|
+
var _CardFooter=function _CardFooter(_ref){var _footerChildrensArray,_footerChildrensArray2;var children=_ref.children,testID=_ref.testID;var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');useVerifyAllowedComponents(children,'CardFooter',[ComponentIds$1.CardFooterLeading,ComponentIds$1.CardFooterTrailing]);var footerChildrensArray=React__default.Children.toArray(children);if(__DEV__){if(!React__default.isValidElement(footerChildrensArray[0])){throwBladeError({message:"Invalid React Element "+footerChildrensArray,moduleName:'CardFooter'});}}var baseBoxJustifyContent=footerChildrensArray.length===2||!((_footerChildrensArray=footerChildrensArray[0])!=null&&(_footerChildrensArray2=_footerChildrensArray.props)!=null&&_footerChildrensArray2.actions)?'space-between':'flex-end';return jsxs(BaseBox,_extends({marginTop:"auto"},metaAttribute({name:MetaConstants.CardFooter,testID:testID}),{children:[jsx(BaseBox,{marginTop:"spacing.7"}),jsx(Divider,{}),jsx(BaseBox,{marginTop:"spacing.7",display:"flex",flexDirection:isMobile?'column':'row',justifyContent:baseBoxJustifyContent,alignItems:isMobile?'stretch':'center',children:children})]}));};var CardFooter=assignWithoutSideEffects(_CardFooter,{componentId:ComponentIds$1.CardFooter});var _CardFooterLeading=function _CardFooterLeading(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle;useVerifyInsideCard('CardFooterLeading');return jsxs(BaseBox,{textAlign:'left',children:[title&&jsx(Text,{variant:"body",size:"medium",weight:"bold",children:title}),subtitle&&jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]});};var CardFooterLeading=assignWithoutSideEffects(_CardFooterLeading,{componentId:ComponentIds$1.CardFooterLeading});var _CardFooterTrailing=function _CardFooterTrailing(_ref3){var actions=_ref3.actions;var isMobile=useIsMobile();useVerifyInsideCard('CardFooterTrailing');return jsxs(BaseBox,{display:"flex",flexDirection:"row",alignSelf:isMobile?'auto':'center',marginTop:isMobile?'spacing.5':'spacing.0',marginLeft:isMobile?'spacing.0':'spacing.5',children:[jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.secondary?jsx(Button,_extends({isFullWidth:true,size:"medium",variant:"secondary"},actions.secondary,{children:actions.secondary.text})):null}),jsx(BaseBox,{marginLeft:"spacing.5"}),jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.primary?jsx(Button,_extends({isFullWidth:true,size:"medium"},actions.primary,{children:actions.primary.text})):null})]});};var CardFooterTrailing=assignWithoutSideEffects(_CardFooterTrailing,{componentId:ComponentIds$1.CardFooterTrailing});
|
|
2725
2727
|
|
|
2726
2728
|
var ComponentIds={BottomSheet:'BottomSheet',BottomSheetHeader:'BottomSheetHeader',BottomSheetFooter:'BottomSheetFooter',BottomSheetBody:'BottomSheetBody',BottomSheetGrabHandle:'BottomSheetGrabHandle'};
|
|
2727
2729
|
|
|
2728
|
-
var _excluded$q=["children","selectionType","onDismiss","testID"];var validDropdownChildren=[componentIds$1.triggers.SelectInput,componentIds$1.triggers.DropdownButton,componentIds$1.triggers.DropdownLink,componentIds$1.DropdownOverlay,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,onDismiss=_ref.onDismiss,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$q);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isOpen=_React$useState2[0],setIsOpen=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),options=_React$useState4[0],setOptions=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(false),_React$useState12=_slicedToArray(_React$useState11,2),shouldIgnoreBlur=_React$useState12[0],setShouldIgnoreBlur=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasLabelOnLeft=_React$useState18[0],setHasLabelOnLeft=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var dropdownBaseId=useId('dropdown');var dropdownTriggerer=React__default.useRef();var isFirstRenderRef=React__default.useRef(true);React__default.useEffect(function(){if(isFirstRenderRef.current){isFirstRenderRef.current=false;return;}if(!isOpen&&onDismiss){onDismiss();}},[isOpen]);var close=React__default.useCallback(function(){setIsOpen(false);onDismiss==null?void 0:onDismiss();},[onDismiss]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){
|
|
2730
|
+
var _excluded$q=["children","selectionType","onDismiss","testID"];var validDropdownChildren=[componentIds$1.triggers.SelectInput,componentIds$1.triggers.DropdownButton,componentIds$1.triggers.DropdownLink,componentIds$1.DropdownOverlay,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,onDismiss=_ref.onDismiss,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$q);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isOpen=_React$useState2[0],setIsOpen=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),options=_React$useState4[0],setOptions=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(false),_React$useState12=_slicedToArray(_React$useState11,2),shouldIgnoreBlur=_React$useState12[0],setShouldIgnoreBlur=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasLabelOnLeft=_React$useState18[0],setHasLabelOnLeft=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var dropdownBaseId=useId('dropdown');var dropdownTriggerer=React__default.useRef();var isFirstRenderRef=React__default.useRef(true);React__default.useEffect(function(){if(isFirstRenderRef.current){isFirstRenderRef.current=false;return;}if(!isOpen&&onDismiss){onDismiss();}},[isOpen]);var close=React__default.useCallback(function(){setIsOpen(false);onDismiss==null?void 0:onDismiss();},[onDismiss]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:"Dropdown can only have one of following elements as children - \n\n "+validDropdownChildren.join(', ')+" \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown",moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,componentIds$1.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,componentIds$1.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,activeIndex:activeIndex,setActiveIndex:setActiveIndex,shouldIgnoreBlur:shouldIgnoreBlur,setShouldIgnoreBlur:setShouldIgnoreBlur,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasLabelOnLeft:hasLabelOnLeft,setHasLabelOnLeft:setHasLabelOnLeft,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled};},[isOpen,selectedIndices,controlledValueIndices,options,activeIndex,shouldIgnoreBlur,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,hasLabelOnLeft,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,isOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,_extends({},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:componentIds$1.Dropdown});
|
|
2729
2731
|
|
|
2730
2732
|
var StyledDropdownOverlay=styled(BaseBox)(function(props){var theme=props.theme,isInBottomSheet=props.isInBottomSheet;return {backgroundColor:theme.colors.surface.background.level2.lowContrast,borderWidth:isInBottomSheet?undefined:theme.border.width.thin,borderColor:theme.colors.surface.border.normal.lowContrast,borderStyle:isInBottomSheet?undefined:'solid',borderRadius:makeSize(theme.border.radius.medium),boxShadow:isInBottomSheet||isReactNative$4()?undefined:castWebType(theme.elevation.midRaised)};});
|
|
2731
2733
|
|
|
2732
2734
|
var AnimatedDropdownOverlay=styled(StyledDropdownOverlay)(function(props){return {transform:"translateY("+makeSize(props.theme.spacing[3])+")"};});var StyledCloseableArea=styled(Pressable)(function(props){return {position:'static',height:'100%',width:'100%',display:props.display};});var _DropdownOverlay=function _DropdownOverlay(_ref){var children=_ref.children,testID=_ref.testID;var _useDropdown=useDropdown(),isOpen=_useDropdown.isOpen,close=_useDropdown.close;var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();return jsx(BaseBox,{position:"relative",children:jsx(StyledCloseableArea,{display:isOpen?'flex':'none',onPress:function onPress(){close();},testID:"closeable-area",children:jsx(AnimatedDropdownOverlay,_extends({isInBottomSheet:bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.dropdownHasBottomSheet,display:isOpen?'flex':'none',position:"absolute",width:"100%",testID:"dropdown-overlay"},metaAttribute({name:MetaConstants.DropdownOverlay,testID:testID}),{children:children}))})});};var DropdownOverlay=assignWithoutSideEffects(_DropdownOverlay,{componentId:componentIds$1.DropdownOverlay});
|
|
2733
2735
|
|
|
2734
|
-
var _excluded$p=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","size","type","variant","accessibilityLabel","testID"];var _DropdownButton=function _DropdownButton(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$p);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerBlur=_useDropdown.onTriggerBlur,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseButton,_extends({},styledProps,icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,isLoading:isLoading,size:size,type:type,variant:variant,
|
|
2736
|
+
var _excluded$p=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","size","type","variant","accessibilityLabel","testID"];var _DropdownButton=function _DropdownButton(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$p);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerBlur=_useDropdown.onTriggerBlur,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseButton,_extends({},styledProps,icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,isLoading:isLoading,size:size,type:type,variant:variant,testID:testID,ref:triggererRef,accessibilityProps:{label:accessibilityLabel,hasPopup:getActionListContainerRole(hasFooterAction,'DropdownButton'),expanded:isOpen,controls:dropdownBaseId+"-actionlist",activeDescendant:activeIndex>=0?dropdownBaseId+"-"+activeIndex:undefined},onClick:function onClick(e){onTriggerClick();_onClick==null?void 0:_onClick(e);},onBlur:function onBlur(e){onTriggerBlur==null?void 0:onTriggerBlur({name:undefined,value:undefined});_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e});_onKeyDown==null?void 0:_onKeyDown(e);}}));};var DropdownButton=assignWithoutSideEffects(_DropdownButton,{componentId:componentIds$1.triggers.DropdownButton});
|
|
2735
2737
|
|
|
2736
|
-
var _excluded$o=["children","icon","iconPosition","onClick","onBlur","onKeyDown","isDisabled","href","target","rel","accessibilityLabel","size","testID","hitSlop","htmlTitle"];var _DropdownLink=function _DropdownLink(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,isDisabled=_ref.isDisabled;_ref.href;_ref.target;_ref.rel;var accessibilityLabel=_ref.accessibilityLabel,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,hitSlop=_ref.hitSlop,htmlTitle=_ref.htmlTitle,styledProps=_objectWithoutProperties(_ref,_excluded$o);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerBlur=_useDropdown.onTriggerBlur,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseLink,_extends({variant:"button"},icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,
|
|
2738
|
+
var _excluded$o=["children","icon","iconPosition","onClick","onBlur","onKeyDown","isDisabled","href","target","rel","accessibilityLabel","size","testID","hitSlop","htmlTitle"];var _DropdownLink=function _DropdownLink(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,isDisabled=_ref.isDisabled;_ref.href;_ref.target;_ref.rel;var accessibilityLabel=_ref.accessibilityLabel,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,hitSlop=_ref.hitSlop,htmlTitle=_ref.htmlTitle,styledProps=_objectWithoutProperties(_ref,_excluded$o);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerBlur=_useDropdown.onTriggerBlur,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseLink,_extends({variant:"button"},icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,size:size,testID:testID,hitSlop:hitSlop,htmlTitle:htmlTitle,isDisabled:isDisabled},styledProps,{ref:triggererRef,accessibilityProps:{label:accessibilityLabel,hasPopup:getActionListContainerRole(hasFooterAction,'DropdownButton'),expanded:isOpen,controls:dropdownBaseId+"-actionlist",activeDescendant:activeIndex>=0?dropdownBaseId+"-"+activeIndex:undefined},onClick:function onClick(e){onTriggerClick();_onClick==null?void 0:_onClick(e);},onBlur:function onBlur(e){onTriggerBlur==null?void 0:onTriggerBlur({name:undefined,value:undefined});_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e});_onKeyDown==null?void 0:_onKeyDown(e);}}));};var DropdownLink=assignWithoutSideEffects(_DropdownLink,{componentId:componentIds$1.triggers.DropdownLink});
|
|
2737
2739
|
|
|
2738
2740
|
var _BaseFooter=function _BaseFooter(_ref){var children=_ref.children,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,metaComponentName=_ref.metaComponentName,testID=_ref.testID;return jsxs(Fragment,{children:[showDivider&&jsx(Divider,{}),jsx(BaseBox,_extends({},metaAttribute({name:metaComponentName,testID:testID}),{padding:{base:'spacing.5',m:'spacing.6'},children:children}))]});};var BaseFooter=assignWithoutSideEffects(_BaseFooter,{componentId:'BaseFooter'});
|
|
2739
2741
|
|
|
2740
|
-
var centerBoxProps={display:'flex',alignItems:'center',justifyContent:'center',height:'28px'};var propRestrictionMap={Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{size:'body-medium'}};var useTrailingRestriction=function useTrailingRestriction(trailing){var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap);if(__DEV__){if(!restrictedProps){
|
|
2742
|
+
var centerBoxProps={display:'flex',alignItems:'center',justifyContent:'center',height:'28px'};var propRestrictionMap={Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{size:'body-medium'}};var useTrailingRestriction=function useTrailingRestriction(trailing){var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap);if(__DEV__){if(!restrictedProps){throwBladeError({message:"Only one of `"+allowedComponents.join(', ')+"` component is accepted as trailing",moduleName:'Header'});}}var restrictedPropKeys=Object.keys(propRestrictionMap[trailingComponentType]);for(var _i=0,_restrictedPropKeys=restrictedPropKeys;_i<_restrictedPropKeys.length;_i++){var _trailing$props;var prop=_restrictedPropKeys[_i];if(trailing!=null&&(_trailing$props=trailing.props)!=null&&_trailing$props.hasOwnProperty(prop)){logger({message:"Do not pass \""+prop+"\" to \""+trailingComponentType+"\" while inside Header trailing, because we override it.",moduleName:'Header',type:'warn'});}}setValidatedTrailingComponent(React__default.cloneElement(trailing,restrictedProps));}},[trailing]);return validatedTrailingComponent;};var _BaseHeader=function _BaseHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,_ref$showCloseButton=_ref.showCloseButton,showCloseButton=_ref$showCloseButton===void 0?true:_ref$showCloseButton,onBackButtonClick=_ref.onBackButtonClick,onCloseButtonClick=_ref.onCloseButtonClick,closeButtonRef=_ref.closeButtonRef,testID=_ref.testID,onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp,metaComponentName=_ref.metaComponentName;var validatedTrailingComponent=useTrailingRestriction(trailing);var shouldWrapTitle=titleSuffix&&trailing&&showBackButton&&showCloseButton;var webOnlyEventHandlers=isReactNative$4()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};return jsxs(BaseBox,_extends({},metaAttribute({name:metaComponentName,testID:testID}),{children:[jsx(BaseBox,_extends({marginY:{base:'spacing.5',m:'spacing.6'},paddingX:{base:'spacing.5',m:'spacing.6'},touchAction:"none"},webOnlyEventHandlers,{children:jsxs(BaseBox,{display:"flex",flexDirection:"row",userSelect:"none",children:[showBackButton?jsx(BaseBox,{overflow:"visible",marginRight:"spacing.5",children:jsx(Box,_extends({},centerBoxProps,{children:jsx(IconButton,{size:"large",icon:ChevronLeftIcon,onClick:function onClick(){return onBackButtonClick==null?void 0:onBackButtonClick();},accessibilityLabel:"Back"})}))}):null,jsxs(BaseBox,{paddingRight:"spacing.5",marginRight:"auto",flex:"auto",display:"flex",flexDirection:"row",alignItems:"flex-start",children:[leading?jsx(BaseBox,_extends({width:"spacing.8",height:"spacing.8",marginRight:"spacing.3"},centerBoxProps,{children:leading})):null,jsxs(BaseBox,{flex:"auto",children:[jsxs(BaseBox,{maxWidth:isReactNative$4()&&shouldWrapTitle?'100px':undefined,flexShrink:0,display:"flex",flexDirection:"row",children:[title?jsx(Heading,{size:"small",variant:"regular",type:"normal",children:title}):null,titleSuffix&&jsx(BaseBox,{marginLeft:"spacing.3",children:jsx(Box,_extends({},centerBoxProps,{children:titleSuffix}))})]}),subtitle?jsx(Text,{variant:"body",size:"small",weight:"regular",type:"muted",children:subtitle}):null]})]}),validatedTrailingComponent?jsx(BaseBox,{marginRight:"spacing.5",children:jsx(Box,_extends({},centerBoxProps,{children:validatedTrailingComponent}))}):null,showCloseButton?jsx(Box,_extends({},centerBoxProps,{children:jsx(IconButton,{ref:closeButtonRef,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return onCloseButtonClick==null?void 0:onCloseButtonClick();}})})):null]})})),showDivider?jsx(Divider,{}):null]}));};var BaseHeader=assignWithoutSideEffects(_BaseHeader,{componentId:'BaseHeader'});
|
|
2741
2743
|
|
|
2742
2744
|
var _DropdownHeader=function _DropdownHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,testID=_ref.testID;return jsx(BaseBox,_extends({overflow:'auto',flexShrink:0},isReactNative$4()?{}:{onMouseDown:function onMouseDown(e){e.preventDefault();}},{children:jsx(BaseHeader,{title:title,subtitle:subtitle,leading:leading,trailing:trailing,titleSuffix:titleSuffix,metaComponentName:MetaConstants.DropdownHeader,testID:testID,showBackButton:false,showCloseButton:false})}));};var DropdownHeader=assignWithoutSideEffects(_DropdownHeader,{componentId:'DropdownHeader'});var _DropdownFooter=function _DropdownFooter(_ref2){var children=_ref2.children,testID=_ref2.testID;var _useDropdown=useDropdown(),setHasFooterAction=_useDropdown.setHasFooterAction,setShouldIgnoreBlur=_useDropdown.setShouldIgnoreBlur,activeIndex=_useDropdown.activeIndex,onTriggerKeydown=_useDropdown.onTriggerKeydown,close=_useDropdown.close;var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();var footerRef=React__default.useRef(null);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isClickedInsideFooter=_React$useState2[0],setIsClickedInsideFooter=_React$useState2[1];React__default.useEffect(function(){setHasFooterAction(true);},[]);return jsx(BaseBox,_extends({ref:footerRef},isReactNative$4()?{}:{onMouseDown:function onMouseDown(){setShouldIgnoreBlur(true);setIsClickedInsideFooter(true);},onMouseUp:function onMouseUp(){setIsClickedInsideFooter(false);},onKeyDown:function onKeyDown(e){var nativeEvent=e.nativeEvent;var shouldIgnoreDropdownKeydown=(nativeEvent.key===' '||nativeEvent.key==='Enter')&&activeIndex<0;if(!shouldIgnoreDropdownKeydown){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e.nativeEvent});}},onBlur:function onBlur(){if(!isClickedInsideFooter&&!(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.dropdownHasBottomSheet)){close();}}},makeAccessible({role:'group'}),{children:jsx(BaseFooter,{metaComponentName:MetaConstants.DropdownFooter,testID:testID,children:children})}));};var DropdownFooter=assignWithoutSideEffects(_DropdownFooter,{componentId:'DropdownFooter'});
|
|
2743
2745
|
|
|
@@ -2753,7 +2755,7 @@ var BaseInputStyledAnimatedBorder=styled(Animated.View)(function(_ref){var theme
|
|
|
2753
2755
|
|
|
2754
2756
|
var _excluded$m=["children","validationState","currentInteraction","isLabelLeftPositioned","isTextArea"];var StyledBaseInputWrapper=styled(BaseBox)(function(props){return _extends({},getInputBackgroundAndBorderStyles({theme:props.theme,isFocused:props.currentInteraction==='active',isDisabled:props.isDisabled,validationState:props.validationState}),{'&:hover':getPlatformType()==='react-native'?undefined:_extends({},getInputBackgroundAndBorderStyles({theme:props.theme,isHovered:true,isFocused:props.currentInteraction==='active',isDisabled:props.isDisabled,validationState:props.validationState}),{transitionProperty:'background-color',transitionDuration:castWebType(makeMotionTime(props.theme.motion.duration.xquick)),transitionTimingFunction:castWebType(props.theme.motion.easing.standard.effective)}),':focus-within':getPlatformType()==='react-native'?undefined:_extends({},getInputBackgroundAndBorderStyles({theme:props.theme,isFocused:props.currentInteraction==='active',isDisabled:props.isDisabled,validationState:props.validationState}))});});var BaseInputWrapper=function BaseInputWrapper(_ref){var children=_ref.children,validationState=_ref.validationState,currentInteraction=_ref.currentInteraction;_ref.isLabelLeftPositioned;var isTextArea=_ref.isTextArea,props=_objectWithoutProperties(_ref,_excluded$m);return jsxs(StyledBaseInputWrapper,_extends({display:"flex",flexDirection:"row",width:"100%",alignItems:isTextArea?'flex-start':undefined,validationState:validationState,currentInteraction:currentInteraction,position:"relative"},props,{children:[children,jsx(BaseInputAnimatedBorder,{currentInteraction:currentInteraction,validationState:validationState})]}));};
|
|
2755
2757
|
|
|
2756
|
-
var _excluded$l=["as","label","labelPosition","placeholder","type","defaultValue","name","value","onFocus","onChange","onInput","onBlur","onSubmit","onClick","onKeyDown","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","leadingIcon","prefix","interactionElement","suffix","trailingIcon","maxCharacters","textAlign","autoFocus","keyboardReturnKeyType","keyboardType","autoCompleteSuggestionType","trailingHeaderSlot","trailingFooterSlot","numberOfLines","id","componentName","accessibilityLabel","labelId","activeDescendant","hideLabelText","hideFormHint","hasPopup","popupId","isPopupExpanded","shouldIgnoreBlurAnimation","autoCapitalize","testID"];var autoCompleteSuggestionTypeValues=['none','on','name','email','username','password','newPassword','oneTimeCode','telephone','postalCode','countryName','creditCardNumber','creditCardCSC','creditCardExpiry','creditCardExpiryMonth','creditCardExpiryYear'];var useInput=function useInput(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,onClick=_ref.onClick,onFocus=_ref.onFocus,onChange=_ref.onChange,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,onInput=_ref.onInput,onKeyDown=_ref.onKeyDown;if(__DEV__){if(value&&defaultValue){throw new Error("[Blade: Input]: Either 'value' or 'defaultValue' shall be passed. This decides if the input field is controlled or uncontrolled");}}var _React$useState=React__default.useState(defaultValue!=null?defaultValue:value),_React$useState2=_slicedToArray(_React$useState,2),inputValue=_React$useState2[0],setInputValue=_React$useState2[1];var handleOnFocus=React__default.useCallback(function(_ref2){var name=_ref2.name,value=_ref2.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value;_value=(_value$target$value=value==null?void 0:value.target.value)!=null?_value$target$value:'';}onFocus==null?void 0:onFocus({name:name,value:_value});},[onFocus]);var handleOnClick=React__default.useCallback(function(_ref3){var name=_ref3.name,value=_ref3.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$currentTarget$;_value=(_value$currentTarget$=value==null?void 0:value.currentTarget.value)!=null?_value$currentTarget$:'';}onClick==null?void 0:onClick({name:name,value:_value});},[onClick]);var handleOnSubmit=React__default.useCallback(function(_ref4){var name=_ref4.name,value=_ref4.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value2;_value=(_value$target$value2=value==null?void 0:value.target.value)!=null?_value$target$value2:'';}if(isReactNative$4()){onSubmit==null?void 0:onSubmit({name:name,value:_value});}},[onSubmit]);var handleOnBlur=React__default.useCallback(function(_ref5){var name=_ref5.name,value=_ref5.value;var _value='';if(getPlatformType()==='react-native'&&typeof value=='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value3;_value=(_value$target$value3=value==null?void 0:value.target.value)!=null?_value$target$value3:'';}onBlur==null?void 0:onBlur({name:name,value:_value});},[onBlur]);var handleOnChange=React__default.useCallback(function(_ref6){var name=_ref6.name,value=_ref6.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value4;_value=(_value$target$value4=value==null?void 0:value.target.value)!=null?_value$target$value4:'';}onChange==null?void 0:onChange({name:name,value:_value});setInputValue(_value);},[onChange]);var handleOnInput=React__default.useCallback(function(_ref7){var name=_ref7.name,value=_ref7.value;var _value='';if(getPlatformType()==='react-native'&&typeof value=='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value5;_value=(_value$target$value5=value==null?void 0:value.target.value)!=null?_value$target$value5:'';}onInput==null?void 0:onInput({name:name,value:_value});},[onInput]);var handleOnKeyDown=React__default.useCallback(function(_ref8){var name=_ref8.name,key=_ref8.key,code=_ref8.code,event=_ref8.event;onKeyDown==null?void 0:onKeyDown({name:name,key:key,code:code,event:event});},[onKeyDown]);return {handleOnFocus:handleOnFocus,handleOnClick:handleOnClick,handleOnChange:handleOnChange,handleOnBlur:handleOnBlur,handleOnSubmit:handleOnSubmit,handleOnInput:handleOnInput,handleOnKeyDown:handleOnKeyDown,inputValue:inputValue};};var getHintType=function getHintType(_ref9){var validationState=_ref9.validationState,hasHelpText=_ref9.hasHelpText;if(validationState==='error'){return 'error';}if(validationState==='success'){return 'success';}if(hasHelpText){return 'help';}return 'help';};var getDescribedByElementId=function getDescribedByElementId(_ref10){var validationState=_ref10.validationState,hasErrorText=_ref10.hasErrorText,hasSuccessText=_ref10.hasSuccessText,hasHelpText=_ref10.hasHelpText,errorTextId=_ref10.errorTextId,successTextId=_ref10.successTextId,helpTextId=_ref10.helpTextId;if(validationState==='error'&&hasErrorText){return errorTextId;}if(validationState==='success'&&hasSuccessText){return successTextId;}if(hasHelpText){return helpTextId;}return '';};var BaseInput=React__default.forwardRef(function(_ref11,ref){var _ref11$as=_ref11.as,as=_ref11$as===void 0?'input':_ref11$as,label=_ref11.label,_ref11$labelPosition=_ref11.labelPosition,labelPosition=_ref11$labelPosition===void 0?'top':_ref11$labelPosition,placeholder=_ref11.placeholder,_ref11$type=_ref11.type,type=_ref11$type===void 0?'text':_ref11$type,defaultValue=_ref11.defaultValue,name=_ref11.name,value=_ref11.value,onFocus=_ref11.onFocus,onChange=_ref11.onChange,onInput=_ref11.onInput,onBlur=_ref11.onBlur,onSubmit=_ref11.onSubmit,onClick=_ref11.onClick,onKeyDown=_ref11.onKeyDown,isDisabled=_ref11.isDisabled,necessityIndicator=_ref11.necessityIndicator,validationState=_ref11.validationState,errorText=_ref11.errorText,helpText=_ref11.helpText,successText=_ref11.successText,isRequired=_ref11.isRequired,leadingIcon=_ref11.leadingIcon,prefix=_ref11.prefix,interactionElement=_ref11.interactionElement,suffix=_ref11.suffix,trailingIcon=_ref11.trailingIcon,maxCharacters=_ref11.maxCharacters,textAlign=_ref11.textAlign,autoFocus=_ref11.autoFocus,keyboardReturnKeyType=_ref11.keyboardReturnKeyType,keyboardType=_ref11.keyboardType,autoCompleteSuggestionType=_ref11.autoCompleteSuggestionType,trailingHeaderSlot=_ref11.trailingHeaderSlot,trailingFooterSlot=_ref11.trailingFooterSlot,numberOfLines=_ref11.numberOfLines,id=_ref11.id,componentName=_ref11.componentName,accessibilityLabel=_ref11.accessibilityLabel,labelId=_ref11.labelId,activeDescendant=_ref11.activeDescendant,hideLabelText=_ref11.hideLabelText,hideFormHint=_ref11.hideFormHint,hasPopup=_ref11.hasPopup,popupId=_ref11.popupId,isPopupExpanded=_ref11.isPopupExpanded,shouldIgnoreBlurAnimation=_ref11.shouldIgnoreBlurAnimation,autoCapitalize=_ref11.autoCapitalize,testID=_ref11.testID,styledProps=_objectWithoutProperties(_ref11,_excluded$l);var _useTheme=useTheme(),theme=_useTheme.theme;var _useInput=useInput({defaultValue:defaultValue,value:value,onFocus:onFocus,onClick:onClick,onChange:onChange,onBlur:onBlur,onSubmit:onSubmit,onInput:onInput,onKeyDown:onKeyDown}),handleOnFocus=_useInput.handleOnFocus,handleOnChange=_useInput.handleOnChange,handleOnClick=_useInput.handleOnClick,handleOnBlur=_useInput.handleOnBlur,handleOnSubmit=_useInput.handleOnSubmit,handleOnInput=_useInput.handleOnInput,handleOnKeyDown=_useInput.handleOnKeyDown,inputValue=_useInput.inputValue;var _useFormId=useFormId(id),inputId=_useFormId.inputId,helpTextId=_useFormId.helpTextId,errorTextId=_useFormId.errorTextId,successTextId=_useFormId.successTextId;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isLabelLeftPositioned=labelPosition==='left'&&matchedDeviceType==='desktop';var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction;var _isRequired=isRequired||necessityIndicator==='required';var accessibilityProps=makeAccessible({required:Boolean(_isRequired),disabled:Boolean(isDisabled),invalid:Boolean(validationState==='error'),describedBy:getDescribedByElementId({validationState:validationState,hasErrorText:Boolean(errorText),hasSuccessText:Boolean(successText),hasHelpText:Boolean(helpText),errorTextId:errorTextId,successTextId:successTextId,helpTextId:helpTextId}),label:accessibilityLabel,hasPopup:hasPopup,expanded:hasPopup?isPopupExpanded:undefined,controls:hasPopup?popupId:undefined,role:hasPopup?'combobox':undefined,activeDescendant:activeDescendant});var willRenderHintText=Boolean(helpText)||Boolean(successText)||Boolean(errorText);if(__DEV__){if(autoCompleteSuggestionType&&!autoCompleteSuggestionTypeValues.includes(autoCompleteSuggestionType)){throw new Error("[Blade: Input]: Expected autoCompleteSuggestionType to be one of "+autoCompleteSuggestionTypeValues.join(', ')+" but received "+autoCompleteSuggestionType);}}var isTextArea=as==='textarea';var isReactNative=getPlatformType()==='react-native';return jsxs(BaseBox,_extends({},metaAttribute({name:componentName,testID:testID}),getStyledProps(styledProps),{children:[jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',justifyContent:isLabelLeftPositioned?'center':undefined,alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",width:"100%",children:[!hideLabelText&&jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'column':'row',justifyContent:"space-between",alignSelf:isTextArea?'flex-start':undefined,marginTop:isTextArea&&isLabelLeftPositioned?'spacing.3':'spacing.0',marginBottom:isTextArea&&isLabelLeftPositioned?'spacing.3':'spacing.0',children:[jsx(FormLabel,{as:"label",necessityIndicator:necessityIndicator,position:labelPosition,id:labelId,htmlFor:inputId,children:label}),trailingHeaderSlot==null?void 0:trailingHeaderSlot(inputValue)]}),jsxs(BaseInputWrapper,{isTextArea:isTextArea,isDisabled:isDisabled,validationState:validationState,currentInteraction:currentInteraction,isLabelLeftPositioned:isLabelLeftPositioned,children:[jsx(BaseInputVisuals,{leadingIcon:leadingIcon,prefix:prefix,isDisabled:isDisabled}),jsx(StyledBaseInput,_extends({as:isReactNative?undefined:as,id:inputId,ref:ref,name:name,type:type,defaultValue:defaultValue,value:value,placeholder:placeholder,isDisabled:isDisabled,validationState:validationState,isRequired:_isRequired,handleOnFocus:handleOnFocus,handleOnChange:handleOnChange,handleOnBlur:handleOnBlur,handleOnSubmit:handleOnSubmit,handleOnInput:handleOnInput,handleOnKeyDown:handleOnKeyDown,handleOnClick:handleOnClick,leadingIcon:leadingIcon,prefix:prefix,interactionElement:interactionElement,suffix:suffix,trailingIcon:trailingIcon,maxCharacters:maxCharacters,textAlign:textAlign,autoFocus:autoFocus,keyboardReturnKeyType:keyboardReturnKeyType,keyboardType:keyboardType,autoCompleteSuggestionType:autoCompleteSuggestionType,accessibilityProps:accessibilityProps,currentInteraction:currentInteraction,setCurrentInteraction:setCurrentInteraction,numberOfLines:numberOfLines,isTextArea:isTextArea,hasPopup:hasPopup,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,autoCapitalize:autoCapitalize},metaAttribute({name:MetaConstants.StyledBaseInput}))),jsx(BaseInputVisuals,{interactionElement:interactionElement,suffix:suffix,trailingIcon:trailingIcon,isDisabled:isDisabled})]})]}),!hideFormHint&&jsx(BaseBox,{marginLeft:makeSize(isLabelLeftPositioned&&!hideLabelText?136:0),children:jsxs(BaseBox,{display:"flex",flexDirection:"row",justifyContent:willRenderHintText?'space-between':'flex-end',children:[jsx(FormHint,{type:getHintType({validationState:validationState,hasHelpText:Boolean(helpText)}),helpText:helpText,errorText:errorText,successText:successText,helpTextId:helpTextId,errorTextId:errorTextId,successTextId:successTextId}),trailingFooterSlot==null?void 0:trailingFooterSlot(inputValue)]})})]}));});
|
|
2758
|
+
var _excluded$l=["as","label","labelPosition","placeholder","type","defaultValue","name","value","onFocus","onChange","onInput","onBlur","onSubmit","onClick","onKeyDown","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","leadingIcon","prefix","interactionElement","suffix","trailingIcon","maxCharacters","textAlign","autoFocus","keyboardReturnKeyType","keyboardType","autoCompleteSuggestionType","trailingHeaderSlot","trailingFooterSlot","numberOfLines","id","componentName","accessibilityLabel","labelId","activeDescendant","hideLabelText","hideFormHint","hasPopup","popupId","isPopupExpanded","shouldIgnoreBlurAnimation","autoCapitalize","testID"];var autoCompleteSuggestionTypeValues=['none','on','name','email','username','password','newPassword','oneTimeCode','telephone','postalCode','countryName','creditCardNumber','creditCardCSC','creditCardExpiry','creditCardExpiryMonth','creditCardExpiryYear'];var useInput=function useInput(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,onClick=_ref.onClick,onFocus=_ref.onFocus,onChange=_ref.onChange,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,onInput=_ref.onInput,onKeyDown=_ref.onKeyDown;if(__DEV__){if(value&&defaultValue){throwBladeError({message:"Either 'value' or 'defaultValue' shall be passed. This decides if the input field is controlled or uncontrolled",moduleName:'Input'});}}var _React$useState=React__default.useState(defaultValue!=null?defaultValue:value),_React$useState2=_slicedToArray(_React$useState,2),inputValue=_React$useState2[0],setInputValue=_React$useState2[1];var handleOnFocus=React__default.useCallback(function(_ref2){var name=_ref2.name,value=_ref2.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value;_value=(_value$target$value=value==null?void 0:value.target.value)!=null?_value$target$value:'';}onFocus==null?void 0:onFocus({name:name,value:_value});},[onFocus]);var handleOnClick=React__default.useCallback(function(_ref3){var name=_ref3.name,value=_ref3.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$currentTarget$;_value=(_value$currentTarget$=value==null?void 0:value.currentTarget.value)!=null?_value$currentTarget$:'';}onClick==null?void 0:onClick({name:name,value:_value});},[onClick]);var handleOnSubmit=React__default.useCallback(function(_ref4){var name=_ref4.name,value=_ref4.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value2;_value=(_value$target$value2=value==null?void 0:value.target.value)!=null?_value$target$value2:'';}if(isReactNative$4()){onSubmit==null?void 0:onSubmit({name:name,value:_value});}},[onSubmit]);var handleOnBlur=React__default.useCallback(function(_ref5){var name=_ref5.name,value=_ref5.value;var _value='';if(getPlatformType()==='react-native'&&typeof value=='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value3;_value=(_value$target$value3=value==null?void 0:value.target.value)!=null?_value$target$value3:'';}onBlur==null?void 0:onBlur({name:name,value:_value});},[onBlur]);var handleOnChange=React__default.useCallback(function(_ref6){var name=_ref6.name,value=_ref6.value;var _value='';if(getPlatformType()==='react-native'&&typeof value==='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value4;_value=(_value$target$value4=value==null?void 0:value.target.value)!=null?_value$target$value4:'';}onChange==null?void 0:onChange({name:name,value:_value});setInputValue(_value);},[onChange]);var handleOnInput=React__default.useCallback(function(_ref7){var name=_ref7.name,value=_ref7.value;var _value='';if(getPlatformType()==='react-native'&&typeof value=='string'){_value=value;}else if(typeof value!=='string'){var _value$target$value5;_value=(_value$target$value5=value==null?void 0:value.target.value)!=null?_value$target$value5:'';}onInput==null?void 0:onInput({name:name,value:_value});},[onInput]);var handleOnKeyDown=React__default.useCallback(function(_ref8){var name=_ref8.name,key=_ref8.key,code=_ref8.code,event=_ref8.event;onKeyDown==null?void 0:onKeyDown({name:name,key:key,code:code,event:event});},[onKeyDown]);return {handleOnFocus:handleOnFocus,handleOnClick:handleOnClick,handleOnChange:handleOnChange,handleOnBlur:handleOnBlur,handleOnSubmit:handleOnSubmit,handleOnInput:handleOnInput,handleOnKeyDown:handleOnKeyDown,inputValue:inputValue};};var getHintType=function getHintType(_ref9){var validationState=_ref9.validationState,hasHelpText=_ref9.hasHelpText;if(validationState==='error'){return 'error';}if(validationState==='success'){return 'success';}if(hasHelpText){return 'help';}return 'help';};var getDescribedByElementId=function getDescribedByElementId(_ref10){var validationState=_ref10.validationState,hasErrorText=_ref10.hasErrorText,hasSuccessText=_ref10.hasSuccessText,hasHelpText=_ref10.hasHelpText,errorTextId=_ref10.errorTextId,successTextId=_ref10.successTextId,helpTextId=_ref10.helpTextId;if(validationState==='error'&&hasErrorText){return errorTextId;}if(validationState==='success'&&hasSuccessText){return successTextId;}if(hasHelpText){return helpTextId;}return '';};var BaseInput=React__default.forwardRef(function(_ref11,ref){var _ref11$as=_ref11.as,as=_ref11$as===void 0?'input':_ref11$as,label=_ref11.label,_ref11$labelPosition=_ref11.labelPosition,labelPosition=_ref11$labelPosition===void 0?'top':_ref11$labelPosition,placeholder=_ref11.placeholder,_ref11$type=_ref11.type,type=_ref11$type===void 0?'text':_ref11$type,defaultValue=_ref11.defaultValue,name=_ref11.name,value=_ref11.value,onFocus=_ref11.onFocus,onChange=_ref11.onChange,onInput=_ref11.onInput,onBlur=_ref11.onBlur,onSubmit=_ref11.onSubmit,onClick=_ref11.onClick,onKeyDown=_ref11.onKeyDown,isDisabled=_ref11.isDisabled,necessityIndicator=_ref11.necessityIndicator,validationState=_ref11.validationState,errorText=_ref11.errorText,helpText=_ref11.helpText,successText=_ref11.successText,isRequired=_ref11.isRequired,leadingIcon=_ref11.leadingIcon,prefix=_ref11.prefix,interactionElement=_ref11.interactionElement,suffix=_ref11.suffix,trailingIcon=_ref11.trailingIcon,maxCharacters=_ref11.maxCharacters,textAlign=_ref11.textAlign,autoFocus=_ref11.autoFocus,keyboardReturnKeyType=_ref11.keyboardReturnKeyType,keyboardType=_ref11.keyboardType,autoCompleteSuggestionType=_ref11.autoCompleteSuggestionType,trailingHeaderSlot=_ref11.trailingHeaderSlot,trailingFooterSlot=_ref11.trailingFooterSlot,numberOfLines=_ref11.numberOfLines,id=_ref11.id,componentName=_ref11.componentName,accessibilityLabel=_ref11.accessibilityLabel,labelId=_ref11.labelId,activeDescendant=_ref11.activeDescendant,hideLabelText=_ref11.hideLabelText,hideFormHint=_ref11.hideFormHint,hasPopup=_ref11.hasPopup,popupId=_ref11.popupId,isPopupExpanded=_ref11.isPopupExpanded,shouldIgnoreBlurAnimation=_ref11.shouldIgnoreBlurAnimation,autoCapitalize=_ref11.autoCapitalize,testID=_ref11.testID,styledProps=_objectWithoutProperties(_ref11,_excluded$l);var _useTheme=useTheme(),theme=_useTheme.theme;var _useInput=useInput({defaultValue:defaultValue,value:value,onFocus:onFocus,onClick:onClick,onChange:onChange,onBlur:onBlur,onSubmit:onSubmit,onInput:onInput,onKeyDown:onKeyDown}),handleOnFocus=_useInput.handleOnFocus,handleOnChange=_useInput.handleOnChange,handleOnClick=_useInput.handleOnClick,handleOnBlur=_useInput.handleOnBlur,handleOnSubmit=_useInput.handleOnSubmit,handleOnInput=_useInput.handleOnInput,handleOnKeyDown=_useInput.handleOnKeyDown,inputValue=_useInput.inputValue;var _useFormId=useFormId(id),inputId=_useFormId.inputId,helpTextId=_useFormId.helpTextId,errorTextId=_useFormId.errorTextId,successTextId=_useFormId.successTextId;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isLabelLeftPositioned=labelPosition==='left'&&matchedDeviceType==='desktop';var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction;var _isRequired=isRequired||necessityIndicator==='required';var accessibilityProps=makeAccessible({required:Boolean(_isRequired),disabled:Boolean(isDisabled),invalid:Boolean(validationState==='error'),describedBy:getDescribedByElementId({validationState:validationState,hasErrorText:Boolean(errorText),hasSuccessText:Boolean(successText),hasHelpText:Boolean(helpText),errorTextId:errorTextId,successTextId:successTextId,helpTextId:helpTextId}),label:accessibilityLabel,hasPopup:hasPopup,expanded:hasPopup?isPopupExpanded:undefined,controls:hasPopup?popupId:undefined,role:hasPopup?'combobox':undefined,activeDescendant:activeDescendant});var willRenderHintText=Boolean(helpText)||Boolean(successText)||Boolean(errorText);if(__DEV__){if(autoCompleteSuggestionType&&!autoCompleteSuggestionTypeValues.includes(autoCompleteSuggestionType)){throwBladeError({message:"Expected autoCompleteSuggestionType to be one of "+autoCompleteSuggestionTypeValues.join(', ')+" but received "+autoCompleteSuggestionType,moduleName:'Input'});}}var isTextArea=as==='textarea';var isReactNative=getPlatformType()==='react-native';return jsxs(BaseBox,_extends({},metaAttribute({name:componentName,testID:testID}),getStyledProps(styledProps),{children:[jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',justifyContent:isLabelLeftPositioned?'center':undefined,alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",width:"100%",children:[!hideLabelText&&jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'column':'row',justifyContent:"space-between",alignSelf:isTextArea?'flex-start':undefined,marginTop:isTextArea&&isLabelLeftPositioned?'spacing.3':'spacing.0',marginBottom:isTextArea&&isLabelLeftPositioned?'spacing.3':'spacing.0',children:[jsx(FormLabel,{as:"label",necessityIndicator:necessityIndicator,position:labelPosition,id:labelId,htmlFor:inputId,children:label}),trailingHeaderSlot==null?void 0:trailingHeaderSlot(inputValue)]}),jsxs(BaseInputWrapper,{isTextArea:isTextArea,isDisabled:isDisabled,validationState:validationState,currentInteraction:currentInteraction,isLabelLeftPositioned:isLabelLeftPositioned,children:[jsx(BaseInputVisuals,{leadingIcon:leadingIcon,prefix:prefix,isDisabled:isDisabled}),jsx(StyledBaseInput,_extends({as:isReactNative?undefined:as,id:inputId,ref:ref,name:name,type:type,defaultValue:defaultValue,value:value,placeholder:placeholder,isDisabled:isDisabled,validationState:validationState,isRequired:_isRequired,handleOnFocus:handleOnFocus,handleOnChange:handleOnChange,handleOnBlur:handleOnBlur,handleOnSubmit:handleOnSubmit,handleOnInput:handleOnInput,handleOnKeyDown:handleOnKeyDown,handleOnClick:handleOnClick,leadingIcon:leadingIcon,prefix:prefix,interactionElement:interactionElement,suffix:suffix,trailingIcon:trailingIcon,maxCharacters:maxCharacters,textAlign:textAlign,autoFocus:autoFocus,keyboardReturnKeyType:keyboardReturnKeyType,keyboardType:keyboardType,autoCompleteSuggestionType:autoCompleteSuggestionType,accessibilityProps:accessibilityProps,currentInteraction:currentInteraction,setCurrentInteraction:setCurrentInteraction,numberOfLines:numberOfLines,isTextArea:isTextArea,hasPopup:hasPopup,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,autoCapitalize:autoCapitalize},metaAttribute({name:MetaConstants.StyledBaseInput}))),jsx(BaseInputVisuals,{interactionElement:interactionElement,suffix:suffix,trailingIcon:trailingIcon,isDisabled:isDisabled})]})]}),!hideFormHint&&jsx(BaseBox,{marginLeft:makeSize(isLabelLeftPositioned&&!hideLabelText?136:0),children:jsxs(BaseBox,{display:"flex",flexDirection:"row",justifyContent:willRenderHintText?'space-between':'flex-end',children:[jsx(FormHint,{type:getHintType({validationState:validationState,hasHelpText:Boolean(helpText)}),helpText:helpText,errorText:errorText,successText:successText,helpTextId:helpTextId,errorTextId:errorTextId,successTextId:successTextId}),trailingFooterSlot==null?void 0:trailingFooterSlot(inputValue)]})})]}));});
|
|
2757
2759
|
|
|
2758
2760
|
var CharacterCounter=function CharacterCounter(_ref){var currentCount=_ref.currentCount,maxCount=_ref.maxCount;return jsxs(Text,{variant:"caption",weight:"regular",type:"muted",children:[currentCount,"/",maxCount]});};
|
|
2759
2761
|
|
|
@@ -2781,7 +2783,7 @@ var UnorderedList=View;
|
|
|
2781
2783
|
|
|
2782
2784
|
var OrderedList=View;
|
|
2783
2785
|
|
|
2784
|
-
var _excluded$d=["variant","size","children","icon","testID"];var StyledOrderedList=styled(OrderedList)(function(_ref){var marginTop=_ref.marginTop,theme=_ref.theme;return {marginTop:marginTop?makeSpace(get_1(theme,marginTop)):undefined};});var StyledUnorderedList=styled(UnorderedList)(function(_ref2){var marginTop=_ref2.marginTop,theme=_ref2.theme;return {marginTop:marginTop?makeSpace(get_1(theme,marginTop)):undefined};});var _List=function _List(_ref3){var _ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'unordered':_ref3$variant,size=_ref3.size,children=_ref3.children,icon=_ref3.icon,testID=_ref3.testID,styledProps=_objectWithoutProperties(_ref3,_excluded$d);var ListElement=variant==='unordered'?StyledUnorderedList:StyledOrderedList;var _useListContext=useListContext(),level=_useListContext.level,listContextSize=_useListContext.size;var listContextValue=useMemo(function(){return {level:level?level+1:1,size:size!=null?size:listContextSize,icon:icon,variant:variant};},[icon,level,listContextSize,size,variant]);var childrenArray=React__default.Children.toArray(children);var childListItems=childrenArray.filter(function(child){if(isValidAllowedChildren(child,MetaConstants.ListItem)){return child;}if(__DEV__){
|
|
2786
|
+
var _excluded$d=["variant","size","children","icon","testID"];var StyledOrderedList=styled(OrderedList)(function(_ref){var marginTop=_ref.marginTop,theme=_ref.theme;return {marginTop:marginTop?makeSpace(get_1(theme,marginTop)):undefined};});var StyledUnorderedList=styled(UnorderedList)(function(_ref2){var marginTop=_ref2.marginTop,theme=_ref2.theme;return {marginTop:marginTop?makeSpace(get_1(theme,marginTop)):undefined};});var _List=function _List(_ref3){var _ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'unordered':_ref3$variant,size=_ref3.size,children=_ref3.children,icon=_ref3.icon,testID=_ref3.testID,styledProps=_objectWithoutProperties(_ref3,_excluded$d);var ListElement=variant==='unordered'?StyledUnorderedList:StyledOrderedList;var _useListContext=useListContext(),level=_useListContext.level,listContextSize=_useListContext.size;var listContextValue=useMemo(function(){return {level:level?level+1:1,size:size!=null?size:listContextSize,icon:icon,variant:variant};},[icon,level,listContextSize,size,variant]);var childrenArray=React__default.Children.toArray(children);var childListItems=childrenArray.filter(function(child){if(isValidAllowedChildren(child,MetaConstants.ListItem)){return child;}if(__DEV__){throwBladeError({message:'You can only pass a ListItem as a child to List.',moduleName:'List'});}return null;});return jsx(ListProvider,{value:listContextValue,children:jsx(BaseBox,_extends({},getStyledProps(styledProps),{children:jsx(ListElement,_extends({marginTop:level?undefined:'spacing.3'},metaAttribute({name:MetaConstants.List,testID:testID}),makeAccessible({role:'list'}),{children:variant==='unordered'?childListItems:childListItems.map(function(child,index){return React__default.cloneElement(child,{_itemNumber:index+1});})}))}))});};var List=assignWithoutSideEffects(_List,{componentId:MetaConstants.List});
|
|
2785
2787
|
|
|
2786
2788
|
var listItemMarginLeft={unordered:{1:'spacing.2',2:'spacing.5',3:'spacing.5'},unorderedWithIcon:{1:'spacing.0',2:'spacing.5',3:'spacing.5'},ordered:{1:'spacing.0',2:'spacing.6',3:'spacing.6'},'ordered-filled':{1:'spacing.0',2:'spacing.6',3:'spacing.6'}};var listItemBulletMarginRight={unordered:'spacing.3',ordered:'spacing.2','ordered-filled':'spacing.3'};var listItemBulletMarginTop={unordered:{onDesktop:{small:makeSize(6),medium:makeSize(7)},onMobile:{small:makeSize(6),medium:makeSize(7)}},unorderedWithIcon:{onDesktop:{small:'spacing.2',medium:'spacing.1'},onMobile:{small:'spacing.2',medium:'spacing.1'}},ordered:{onDesktop:{small:makeSize(0),medium:makeSize(0)},onMobile:{small:makeSize(0),medium:makeSize(0)}},'ordered-filled':{onDesktop:{small:makeSize(0),medium:makeSize(0)},onMobile:{small:makeSize(0),medium:makeSize(0)}}};var listItemUnorderedBulletSize={onDesktop:{small:makeSize(size[6]),medium:makeSize(size[6])},onMobile:{small:makeSize(size[5]),medium:makeSize(size[6])}};var listItemMarginBottom='spacing.3';var listItemOrderedBulletBoxSize={ordered:{onDesktop:{small:makeSize(size[16]),medium:makeSize(size[20])},onMobile:{small:makeSize(size[16]),medium:makeSize(size[24])}},'ordered-filled':{onDesktop:{small:makeSize(size[18]),medium:makeSize(size[20])},onMobile:{small:makeSize(size[16]),medium:makeSize(size[20])}}};var listItemCodeSize={small:'small',medium:'small'};
|
|
2787
2789
|
|
|
@@ -2791,7 +2793,7 @@ var ListItemElement=View;
|
|
|
2791
2793
|
|
|
2792
2794
|
var romanize=function romanize(number){var romanKeys={m:1000,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};var result='';Object.keys(romanKeys).forEach(function(key){result+=key.repeat(Math.floor(number/romanKeys[key]));number%=romanKeys[key];});return result;};var alphabetize=function alphabetize(number){var indexedNumber=--number;var alphabets='abcdefghijklmnopqrstuvwxyz';var firstAlphabets=indexedNumber>=26?alphabetize(Math.floor(indexedNumber/26)-1):'';var lastAlphabet=alphabets[indexedNumber%26];return ""+firstAlphabets+lastAlphabet;};var getOrderedListItemBullet=function getOrderedListItemBullet(_ref){var itemNumber=_ref.itemNumber,level=_ref.level;if(isNaN(itemNumber))return '';switch(level){case 1:return ""+itemNumber;case 2:return ""+alphabetize(itemNumber);case 3:return ""+romanize(itemNumber);default:return ""+itemNumber;}};
|
|
2793
2795
|
|
|
2794
|
-
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?get_1(theme,listItemMarginLeft[""+variant+(variant==='unordered'&&hasIcon?'WithIcon':'')][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var children=_ref3.children,Icon=_ref3.icon,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;if(__DEV__){if(level&&level>3){
|
|
2796
|
+
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?get_1(theme,listItemMarginLeft[""+variant+(variant==='unordered'&&hasIcon?'WithIcon':'')][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var children=_ref3.children,Icon=_ref3.icon,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;if(__DEV__){if(level&&level>3){throwBladeError({message:'List Nesting is allowed only upto 3 levels.',moduleName:'List'});}}var childrenArray=React__default.Children.toArray(children);var validChildItem=childrenArray.filter(function(child){if(getComponentId(child)===MetaConstants.List)return null;if(typeof child==='string'||isValidAllowedChildren(child,MetaConstants.ListItemLink)||isValidAllowedChildren(child,MetaConstants.ListItemText)||isValidAllowedChildren(child,MetaConstants.ListItemCode)){return child;}else if(__DEV__){throwBladeError({message:"You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.",moduleName:'ListItem'});}return null;});var childList=childrenArray.filter(function(child){return getComponentId(child)===MetaConstants.List?child:null;});var hasIcon=Boolean(ItemIcon);return jsxs(StyledListItem,_extends({level:level,variant:variant,hasIcon:hasIcon},metaAttribute({name:MetaConstants.ListItem,testID:testID}),{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:listItemMarginBottom,children:[variant==='unordered'?jsx(BaseBox,{marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[""+variant+(hasIcon?'WithIcon':'')][platform][size],display:"flex",alignSelf:"flex-start",children:ItemIcon?jsx(ItemIcon,{size:size,color:"surface.text.subdued.lowContrast"}):jsx(UnorderedItemIcon,{level:level})}):jsx(BaseBox,{width:listItemOrderedBulletBoxSize[variant][platform][size],height:listItemOrderedBulletBoxSize[variant][platform][size],marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[variant][platform][size],display:"flex",flexShrink:0,justifyContent:"center",alignSelf:"flex-start",alignItems:"center",borderRadius:variant==='ordered-filled'?'max':undefined,backgroundColor:variant==='ordered-filled'?get_1(theme,'colors.brand.gray.a100.lowContrast'):undefined,children:jsx(Text,{variant:"body",type:"subtle",size:variant==='ordered'?size:'xsmall',children:""+getOrderedListItemBullet({itemNumber:_itemNumber!=null?_itemNumber:1,level:level!=null?level:1})+(variant==='ordered'?'.':'')})}),jsx(ListItemContentChildren,{size:size,children:validChildItem})]}),childList]}));};var ListItem=assignWithoutSideEffects(_ListItem,{componentId:MetaConstants.ListItem});
|
|
2795
2797
|
|
|
2796
2798
|
var _ListItemLink=function _ListItemLink(_ref){var accessibilityLabel=_ref.accessibilityLabel,children=_ref.children,href=_ref.href,icon=_ref.icon,iconPosition=_ref.iconPosition,onClick=_ref.onClick,rel=_ref.rel,target=_ref.target,testID=_ref.testID;var _useListContext=useListContext(),size=_useListContext.size;return jsx(Link,_extends({size:size,variant:"anchor"},icon?{icon:icon,children:children}:{children:children},{href:href,target:target,rel:rel,iconPosition:iconPosition,onClick:onClick,accessibilityLabel:accessibilityLabel,testID:testID}));};var ListItemLink=assignWithoutSideEffects(_ListItemLink,{componentId:MetaConstants.ListItemLink});
|
|
2797
2799
|
|
|
@@ -2805,7 +2807,7 @@ var ModalFooter=function ModalFooter(){return jsx(Text,{children:"Modal Componen
|
|
|
2805
2807
|
|
|
2806
2808
|
var ModalBody=function ModalBody(props){return jsx(Text,{children:"Modal Component is not available for Native mobile apps and we should use BottomSheet component instead for all use-cases of Modal on Native mobile apps."});};
|
|
2807
2809
|
|
|
2808
|
-
var Modal=function Modal(props){
|
|
2810
|
+
var Modal=function Modal(props){if(__DEV__){logger({type:'warn',moduleName:'Modal',message:'Modal is not supported on mobile devices. Please use BottomSheet instead.'});}return jsx(Text,{children:"Modal Component is not available for Native mobile apps and we should use BottomSheet component instead for all use-cases of Modal on Native mobile apps."});};
|
|
2809
2811
|
|
|
2810
2812
|
/**
|
|
2811
2813
|
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
|
@@ -2981,9 +2983,9 @@ var indeterminateAnimation={scaleXInitial:1,scaleXMid:5,scaleXFinal:1,leftInitia
|
|
|
2981
2983
|
|
|
2982
2984
|
var ProgressBarIndeterminateFilledContainer=styled(Animated.View)(function(_ref){var backgroundColor=_ref.backgroundColor;return {backgroundColor:backgroundColor,height:'100%',width:indeterminateAnimation.fillWidth,position:'absolute'};});var ProgressBarDeterminateFilledContainer=styled(Animated.View)(function(_ref2){var backgroundColor=_ref2.backgroundColor,progress=_ref2.progress;return {backgroundColor:backgroundColor,height:'100%',width:progress+"%"};});var ProgressBarPulseAnimation=styled(Animated.View)({backgroundColor:pulseAnimation.backgroundColor,opacity:pulseAnimation.opacityInitial,width:'100%',height:'100%'});var ProgressBarFilled=function ProgressBarFilled(_ref3){var backgroundColor=_ref3.backgroundColor,progress=_ref3.progress,fillMotionDuration=_ref3.fillMotionDuration,motionEasing=_ref3.motionEasing,pulseMotionDuration=_ref3.pulseMotionDuration,pulseMotionDelay=_ref3.pulseMotionDelay,variant=_ref3.variant,isIndeterminate=_ref3.isIndeterminate,indeterminateMotionDuration=_ref3.indeterminateMotionDuration;var animatedWidth=useSharedValue(progress);var animatedOpacity=useSharedValue(pulseAnimation.opacityInitial);var animatedScaleX=useSharedValue(indeterminateAnimation.scaleXInitial);var animatedLeft=useSharedValue(indeterminateAnimation.leftInitial);var _useTheme=useTheme(),theme=_useTheme.theme;var fillAndPulseEasing=get_1(theme.motion,motionEasing);var pulseDuration=castNativeType(makeMotionTime(get_1(theme.motion,pulseMotionDuration)))/2;useEffect(function(){var fillDuration=castNativeType(makeMotionTime(get_1(theme.motion,fillMotionDuration)));animatedWidth.value=withTiming(progress,{duration:fillDuration,easing:fillAndPulseEasing});return function(){cancelAnimation(animatedWidth);};},[progress,animatedWidth,fillMotionDuration,theme,fillAndPulseEasing]);var progressFillAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {width:animatedWidth.value+"%"};};_f._closure={animatedWidth:animatedWidth};_f.asString="function _f(){const{animatedWidth}=jsThis._closure;{return{width:animatedWidth.value+\"%\"};}}";_f.__workletHash=1064279234695;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (78:53)";_f.__optimalization=3;return _f;}());useEffect(function(){if(variant==='progress'&&isIndeterminate){var indeterminateDuration=castNativeType(makeMotionTime(get_1(theme.motion,indeterminateMotionDuration)));var indeterminateEasing=Easing.linear;animatedLeft.value=withRepeat(withTiming(indeterminateAnimation.leftFinal,{duration:indeterminateDuration,easing:indeterminateEasing}),-1);animatedScaleX.value=withRepeat(withSequence(withTiming(indeterminateAnimation.scaleXMid,{duration:indeterminateDuration/2,easing:indeterminateEasing}),withTiming(indeterminateAnimation.scaleXFinal,{duration:indeterminateDuration/2,easing:indeterminateEasing})),-1);}return function(){cancelAnimation(animatedLeft);cancelAnimation(animatedScaleX);};},[animatedLeft,animatedScaleX,indeterminateMotionDuration,isIndeterminate,theme,variant]);var indeterminateAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {left:animatedLeft.value,transform:[{scaleX:animatedScaleX.value}]};};_f._closure={animatedLeft:animatedLeft,animatedScaleX:animatedScaleX};_f.asString="function _f(){const{animatedLeft,animatedScaleX}=jsThis._closure;{return{left:animatedLeft.value,transform:[{scaleX:animatedScaleX.value}]};}}";_f.__workletHash=2119202994717;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (124:54)";_f.__optimalization=3;return _f;}());useEffect(function(){var pulsatingAnimationTimingConfig={duration:pulseDuration,easing:fillAndPulseEasing};if(variant==='progress'){animatedOpacity.value=withDelay(castNativeType(makeMotionTime(get_1(theme.motion,pulseMotionDelay))),withRepeat(withSequence(withTiming(pulseAnimation.opacityMid,pulsatingAnimationTimingConfig),withTiming(pulseAnimation.opacityFinal,pulsatingAnimationTimingConfig)),-1));}return function(){cancelAnimation(animatedOpacity);};},[animatedOpacity,fillAndPulseEasing,pulseDuration,pulseMotionDelay,theme,variant]);var pulseAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {opacity:animatedOpacity.value};};_f._closure={animatedOpacity:animatedOpacity};_f.asString="function _f(){const{animatedOpacity}=jsThis._closure;{return{opacity:animatedOpacity.value};}}";_f.__workletHash=3015944804182;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (156:46)";_f.__optimalization=3;return _f;}());var ProgressBarFilledContainer=isIndeterminate?ProgressBarIndeterminateFilledContainer:ProgressBarDeterminateFilledContainer;return jsx(ProgressBarFilledContainer,{style:isIndeterminate?indeterminateAnimatedStyle:progressFillAnimatedStyle,backgroundColor:backgroundColor,progress:progress,children:jsx(ProgressBarPulseAnimation,{style:pulseAnimatedStyle})});};
|
|
2983
2985
|
|
|
2984
|
-
var _excluded$b=["accessibilityLabel","contrast","intent","isIndeterminate","label","showPercentage","size","value","variant","min","max","testID"];var progressBarHeight={small:size[2],medium:size[4]};var ProgressBar=function ProgressBar(_ref){var _label$trim;var accessibilityLabel=_ref.accessibilityLabel,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,intent=_ref.intent,_ref$isIndeterminate=_ref.isIndeterminate,isIndeterminate=_ref$isIndeterminate===void 0?false:_ref$isIndeterminate,label=_ref.label,_ref$showPercentage=_ref.showPercentage,showPercentage=_ref$showPercentage===void 0?true:_ref$showPercentage,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size,_ref$value=_ref.value,value=_ref$value===void 0?0:_ref$value,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'progress':_ref$variant,_ref$min=_ref.min,min=_ref$min===void 0?0:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?100:_ref$max,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$b);var _useTheme=useTheme(),theme=_useTheme.theme;var id=useId(variant);if(__DEV__){if(variant==='meter'&&isIndeterminate){
|
|
2986
|
+
var _excluded$b=["accessibilityLabel","contrast","intent","isIndeterminate","label","showPercentage","size","value","variant","min","max","testID"];var progressBarHeight={small:size[2],medium:size[4]};var ProgressBar=function ProgressBar(_ref){var _label$trim;var accessibilityLabel=_ref.accessibilityLabel,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,intent=_ref.intent,_ref$isIndeterminate=_ref.isIndeterminate,isIndeterminate=_ref$isIndeterminate===void 0?false:_ref$isIndeterminate,label=_ref.label,_ref$showPercentage=_ref.showPercentage,showPercentage=_ref$showPercentage===void 0?true:_ref$showPercentage,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size,_ref$value=_ref.value,value=_ref$value===void 0?0:_ref$value,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'progress':_ref$variant,_ref$min=_ref.min,min=_ref$min===void 0?0:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?100:_ref$max,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$b);var _useTheme=useTheme(),theme=_useTheme.theme;var id=useId(variant);if(__DEV__){if(variant==='meter'&&isIndeterminate){throwBladeError({moduleName:'ProgressBar',message:"Cannot set 'isIndeterminate' when 'variant' is 'meter'."});}}var unfilledBackgroundColor=theme.colors.brand.gray.a100[contrast+"Contrast"];var filledBackgroundColor=intent?theme.colors.feedback.background[intent].highContrast:theme.colors.brand.primary[500];var hasLabel=label&&((_label$trim=label.trim())==null?void 0:_label$trim.length)>0;var isMeter=variant==='meter';var progressValue=clamp_1(value,min,max);var percentageProgressValue=Math.floor((progressValue-min)*100/(max-min));var shouldShowPercentage=showPercentage&&!isMeter&&!isIndeterminate;var accessibilityProps={role:'progressbar',label:accessibilityLabel!=null?accessibilityLabel:label,valueNow:percentageProgressValue,valueText:percentageProgressValue+"%",valueMin:min,valueMax:max};if(isMeter){accessibilityProps.role='meter';accessibilityProps.valueNow=progressValue;accessibilityProps.valueText=""+progressValue;}if(isIndeterminate){accessibilityProps.valueNow=undefined;accessibilityProps.valueMin=undefined;accessibilityProps.valueMax=undefined;accessibilityProps.valueText=undefined;}return jsx(BaseBox,_extends({},getStyledProps(styledProps),metaAttribute({name:MetaConstants.ProgressBar,testID:testID}),{children:jsxs(BaseBox,{display:"flex",flexDirection:"column",width:"100%",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",justifyContent:hasLabel?'space-between':'flex-end',children:[hasLabel?jsx(FormLabel,{as:"label",htmlFor:id,contrast:contrast,children:label}):null,shouldShowPercentage?jsx(BaseBox,{marginBottom:"spacing.2",children:jsx(Text,{type:"subdued",variant:"body",contrast:contrast,size:"small",children:percentageProgressValue+"%"})}):null]}),jsx(BaseBox,_extends({id:id},makeAccessible({role:accessibilityProps.role,label:accessibilityProps.label,valueNow:accessibilityProps.valueNow,valueText:accessibilityProps.valueText,valueMin:accessibilityProps.valueMin,valueMax:accessibilityProps.valueMax}),{children:jsx(BaseBox,{backgroundColor:unfilledBackgroundColor,height:makeSize(progressBarHeight[size]),overflow:"hidden",position:"relative",children:jsx(ProgressBarFilled,{backgroundColor:filledBackgroundColor,progress:percentageProgressValue,fillMotionDuration:"duration.2xgentle",pulseMotionDuration:"duration.2xgentle",indeterminateMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing",variant:variant,isIndeterminate:isIndeterminate})})}))]})}));};
|
|
2985
2987
|
|
|
2986
|
-
var useRadio=function useRadio(_ref){var isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(__DEV__){if(isChecked&&defaultChecked){
|
|
2988
|
+
var useRadio=function useRadio(_ref){var isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(__DEV__){if(isChecked&&defaultChecked){throwBladeError({message:"Do not provide both 'isChecked' and 'defaultChecked' to useRadio. Consider if you want this component to be controlled or uncontrolled.",moduleName:'Radio'});}}var _useControllableState=useControllableState({value:isChecked,defaultValue:defaultChecked!=null?defaultChecked:false}),_useControllableState2=_slicedToArray(_useControllableState,2),radioState=_useControllableState2[0],setRadioState=_useControllableState2[1];var handleOnChange=function handleOnChange(event){if(isDisabled){event.stopPropagation();event.preventDefault();return;}setRadioState(function(checked){if(checked===false){onChange==null?void 0:onChange({isChecked:true,event:event,value:value});return true;}return checked;});};var state={isChecked:radioState,setChecked:setRadioState};var idBase=useId('radio');var helpTextId=useId(idBase+"-helptext");var accessibilityProps=makeAccessible({role:'radio',required:Boolean(isRequired),invalid:Boolean(hasError),disabled:Boolean(isDisabled),checked:radioState,describedBy:helpTextId});if(isReactNative){return {state:state,inputProps:_extends({onPress:handleOnChange,name:name,value:value},accessibilityProps)};}return {state:state,ids:{helpTextId:helpTextId},inputProps:_extends({ref:inputRef,onChange:handleOnChange,type:'radio',name:name,value:value,checked:radioState,disabled:isDisabled,required:isRequired},accessibilityProps)};};
|
|
2987
2989
|
|
|
2988
2990
|
var radioSizes={group:{gap:{small:{mobile:'spacing.2',desktop:'spacing.0'},medium:{mobile:'spacing.3',desktop:'spacing.2'}}},icon:{small:{width:size[12],height:size[12],dotRadius:size[2]},medium:{width:size[16],height:size[16],dotRadius:size[3]}}};var radioIconColors={variants:{default:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'colors.brand.primary.500',unchecked:'colors.brand.gray.500.lowContrast'},background:{checked:'colors.brand.primary.500',unchecked:'transparent'}},disabled:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'transparent',unchecked:'colors.brand.gray.a100.lowContrast'},background:{checked:'colors.brand.gray.a100.lowContrast',unchecked:'transparent'}},negative:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'colors.feedback.border.negative.highContrast',unchecked:'colors.feedback.border.negative.highContrast'},background:{checked:'colors.feedback.background.negative.highContrast',unchecked:'colors.feedback.background.negative.lowContrast'}}}};var radioHoverTokens={default:{background:{checked:'colors.brand.primary.600',unchecked:'colors.brand.gray.a50.lowContrast'},border:{checked:'colors.brand.primary.600',unchecked:'colors.brand.gray.500.lowContrast'}}};
|
|
2989
2991
|
|
|
@@ -2997,7 +2999,7 @@ var CheckedIcon=function CheckedIcon(_ref){var color=_ref.color,size=_ref.size;v
|
|
|
2997
2999
|
|
|
2998
3000
|
var RadioGroupContext=React__default.createContext({});var RadioGroupProvider=RadioGroupContext.Provider;var useRadioGroupContext=function useRadioGroupContext(){var context=React__default.useContext(RadioGroupContext);return context;};
|
|
2999
3001
|
|
|
3000
|
-
var _excluded$a=["value","children","helpText","isDisabled","size","testID"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$a);var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty_1(groupProps);if(__DEV__){if(!isInsideGroup){
|
|
3002
|
+
var _excluded$a=["value","children","helpText","isDisabled","size","testID"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$a);var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty_1(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=!hasError&&helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var isSmall=_size==='small';var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;return jsx(BaseBox,_extends({},getStyledProps(styledProps),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:ref}),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children})]}),jsx(BaseBox,{marginLeft:isSmall?'spacing.6':'spacing.7',children:showHelpText&&jsx(SelectorSupportText,{id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
|
|
3001
3003
|
|
|
3002
3004
|
var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=idBase+"-label";var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v){return _onChange==null?void 0:_onChange({value:v,name:fallbackName});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v){if(isDisabled){return;}setValue(function(){return v;});}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined_1(v)||isUndefined_1(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state,size:size};},[validationState,isDisabled,isRequired,platform,labelPosition,state,fallbackName,necessityIndicator,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3003
3005
|
|
|
@@ -3068,7 +3070,7 @@ var _excluded$4=["contrast","width","maxWidth","minWidth","height","maxHeight","
|
|
|
3068
3070
|
|
|
3069
3071
|
var affixFontSizes={'body-small':75,'body-small-bold':75,'body-medium':75,'body-medium-bold':75,'heading-small':75,'heading-small-bold':75,'heading-large':100,'heading-large-bold':100,'title-small':300,'title-medium':400};var amountFontSizes={'body-small':75,'body-small-bold':75,'body-medium':100,'body-medium-bold':100,'heading-small':200,'heading-small-bold':200,'heading-large':400,'heading-large-bold':400,'title-small':600,'title-medium':700};var amountLineHeights={'body-small':50,'body-small-bold':50,'body-medium':100,'body-medium-bold':100,'heading-small':300,'heading-small-bold':300,'heading-large':400,'heading-large-bold':400,'title-small':500,'title-medium':600};var currencyPrefixMapping={INR:{'currency-symbol':'₹','currency-code':'INR'},MYR:{'currency-symbol':'RM','currency-code':'MYR'}};var currencyLocaleMapping={INR:'en-IN',MYR:'en-MY'};var currencyAbbreviationsMapping={INR:[{value:1e7,symbol:'Cr'},{value:1e5,symbol:'L'},{value:1e3,symbol:'k'}],MYR:[{value:1e9,symbol:'B'},{value:1e6,symbol:'M'},{value:1e3,symbol:'K'}]};
|
|
3070
3072
|
|
|
3071
|
-
var _excluded$3=["value","suffix","size","isAffixSubtle","intent","prefix","testID","currency"];var getTextColorProps=function getTextColorProps(_ref){var intent=_ref.intent;var props={amountValueColor:'surface.text.normal.lowContrast',affixColor:'surface.text.muted.lowContrast'};if(!intent)return props;props.amountValueColor="feedback.text."+intent+".lowContrast";props.affixColor="feedback.text."+intent+".lowContrast";return props;};var AmountValue=function AmountValue(_ref2){var value=_ref2.value,size=_ref2.size,amountValueColor=_ref2.amountValueColor,isAffixSubtle=_ref2.isAffixSubtle,suffix=_ref2.suffix,affixColor=_ref2.affixColor;var affixFontWeight=isAffixSubtle?'regular':'bold';var isReactNative=getPlatformType()==='react-native';var affixFontSize=isAffixSubtle?affixFontSizes[size]:amountFontSizes[size];var valueForWeight=size.includes('bold')||size.startsWith('title')?'bold':'regular';if(suffix==='decimals'&&isAffixSubtle){var integer=value.split('.')[0];var decimal=value.split('.')[1];var AmountWrapper=getPlatformType()==='react-native'?BaseText:React__default.Fragment;return jsxs(AmountWrapper,{children:[jsxs(BaseText,{fontSize:amountFontSizes[size],fontWeight:valueForWeight,lineHeight:amountLineHeights[size],color:amountValueColor,as:isReactNative?undefined:'span',children:[integer,"."]}),jsx(BaseText,{marginLeft:"spacing.1",fontWeight:affixFontWeight,fontSize:affixFontSize,color:affixColor,as:isReactNative?undefined:'span',children:decimal||'00'})]});}return jsx(BaseText,{fontSize:amountFontSizes[size],fontWeight:valueForWeight,color:amountValueColor,lineHeight:amountLineHeights[size],children:value});};var getFlooredFixed=function getFlooredFixed(value,decimalPlaces){var factor=Math.pow(10,decimalPlaces);var roundedValue=Math.floor(value*factor)/factor;return Number(roundedValue.toFixed(decimalPlaces));};var addCommas=function addCommas(amountValue,currency){var decimalPlaces=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var locale=currencyLocaleMapping[currency];return amountValue.toLocaleString(locale,{minimumFractionDigits:decimalPlaces});};var getHumanizedAmount=function getHumanizedAmount(amountValue,currency){var abbreviations=currencyAbbreviationsMapping[currency];var abbreviation=abbreviations.find(function(abbr){return amountValue>=abbr.value;});if(abbreviation){amountValue=amountValue/abbreviation.value;var formattedAmountValue=getFlooredFixed(amountValue,2);return addCommas(formattedAmountValue,currency)+abbreviation.symbol;}else {return amountValue.toString();}};var formatAmountWithSuffix=function formatAmountWithSuffix(_ref3){var suffix=_ref3.suffix,value=_ref3.value,currency=_ref3.currency;switch(suffix){case'decimals':{var decimalNumber=getFlooredFixed(value,2);return addCommas(decimalNumber,currency,2);}case'humanize':{return getHumanizedAmount(value,currency);}case'none':{return addCommas(getFlooredFixed(value,0),currency);}default:return addCommas(getFlooredFixed(value,0),currency);}};var getCurrencyWeight=function getCurrencyWeight(isAffixSubtle,size){if(isAffixSubtle||size.startsWith('bold'))return 'bold';return 'regular';};var _Amount=function _Amount(_ref4){var value=_ref4.value,_ref4$suffix=_ref4.suffix,suffix=_ref4$suffix===void 0?'decimals':_ref4$suffix,_ref4$size=_ref4.size,size=_ref4$size===void 0?'body-medium':_ref4$size,_ref4$isAffixSubtle=_ref4.isAffixSubtle,isAffixSubtle=_ref4$isAffixSubtle===void 0?true:_ref4$isAffixSubtle,intent=_ref4.intent,_ref4$prefix=_ref4.prefix,prefix=_ref4$prefix===void 0?'currency-symbol':_ref4$prefix,testID=_ref4.testID,_ref4$currency=_ref4.currency,currency=_ref4$currency===void 0?'INR':_ref4$currency,styledProps=_objectWithoutProperties(_ref4,_excluded$3);if(__DEV__){if(typeof value!=='number'){
|
|
3073
|
+
var _excluded$3=["value","suffix","size","isAffixSubtle","intent","prefix","testID","currency"];var getTextColorProps=function getTextColorProps(_ref){var intent=_ref.intent;var props={amountValueColor:'surface.text.normal.lowContrast',affixColor:'surface.text.muted.lowContrast'};if(!intent)return props;props.amountValueColor="feedback.text."+intent+".lowContrast";props.affixColor="feedback.text."+intent+".lowContrast";return props;};var AmountValue=function AmountValue(_ref2){var value=_ref2.value,size=_ref2.size,amountValueColor=_ref2.amountValueColor,isAffixSubtle=_ref2.isAffixSubtle,suffix=_ref2.suffix,affixColor=_ref2.affixColor;var affixFontWeight=isAffixSubtle?'regular':'bold';var isReactNative=getPlatformType()==='react-native';var affixFontSize=isAffixSubtle?affixFontSizes[size]:amountFontSizes[size];var valueForWeight=size.includes('bold')||size.startsWith('title')?'bold':'regular';if(suffix==='decimals'&&isAffixSubtle){var integer=value.split('.')[0];var decimal=value.split('.')[1];var AmountWrapper=getPlatformType()==='react-native'?BaseText:React__default.Fragment;return jsxs(AmountWrapper,{children:[jsxs(BaseText,{fontSize:amountFontSizes[size],fontWeight:valueForWeight,lineHeight:amountLineHeights[size],color:amountValueColor,as:isReactNative?undefined:'span',children:[integer,"."]}),jsx(BaseText,{marginLeft:"spacing.1",fontWeight:affixFontWeight,fontSize:affixFontSize,color:affixColor,as:isReactNative?undefined:'span',children:decimal||'00'})]});}return jsx(BaseText,{fontSize:amountFontSizes[size],fontWeight:valueForWeight,color:amountValueColor,lineHeight:amountLineHeights[size],children:value});};var getFlooredFixed=function getFlooredFixed(value,decimalPlaces){var factor=Math.pow(10,decimalPlaces);var roundedValue=Math.floor(value*factor)/factor;return Number(roundedValue.toFixed(decimalPlaces));};var addCommas=function addCommas(amountValue,currency){var decimalPlaces=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var locale=currencyLocaleMapping[currency];return amountValue.toLocaleString(locale,{minimumFractionDigits:decimalPlaces});};var getHumanizedAmount=function getHumanizedAmount(amountValue,currency){var abbreviations=currencyAbbreviationsMapping[currency];var abbreviation=abbreviations.find(function(abbr){return amountValue>=abbr.value;});if(abbreviation){amountValue=amountValue/abbreviation.value;var formattedAmountValue=getFlooredFixed(amountValue,2);return addCommas(formattedAmountValue,currency)+abbreviation.symbol;}else {return amountValue.toString();}};var formatAmountWithSuffix=function formatAmountWithSuffix(_ref3){var suffix=_ref3.suffix,value=_ref3.value,currency=_ref3.currency;switch(suffix){case'decimals':{var decimalNumber=getFlooredFixed(value,2);return addCommas(decimalNumber,currency,2);}case'humanize':{return getHumanizedAmount(value,currency);}case'none':{return addCommas(getFlooredFixed(value,0),currency);}default:return addCommas(getFlooredFixed(value,0),currency);}};var getCurrencyWeight=function getCurrencyWeight(isAffixSubtle,size){if(isAffixSubtle||size.startsWith('bold'))return 'bold';return 'regular';};var _Amount=function _Amount(_ref4){var value=_ref4.value,_ref4$suffix=_ref4.suffix,suffix=_ref4$suffix===void 0?'decimals':_ref4$suffix,_ref4$size=_ref4.size,size=_ref4$size===void 0?'body-medium':_ref4$size,_ref4$isAffixSubtle=_ref4.isAffixSubtle,isAffixSubtle=_ref4$isAffixSubtle===void 0?true:_ref4$isAffixSubtle,intent=_ref4.intent,_ref4$prefix=_ref4.prefix,prefix=_ref4$prefix===void 0?'currency-symbol':_ref4$prefix,testID=_ref4.testID,_ref4$currency=_ref4.currency,currency=_ref4$currency===void 0?'INR':_ref4$currency,styledProps=_objectWithoutProperties(_ref4,_excluded$3);if(__DEV__){if(typeof value!=='number'){throwBladeError({message:'`value` prop must be of type `number` for Amount.',moduleName:'Amount'});}if(intent==='neutral'){throwBladeError({message:'`neutral` intent is not supported.',moduleName:'Amount'});}}var currencyPrefix=currencyPrefixMapping[currency][prefix];var renderedValue=formatAmountWithSuffix({suffix:suffix,value:value,currency:currency});var _getTextColorProps=getTextColorProps({intent:intent}),amountValueColor=_getTextColorProps.amountValueColor,affixColor=_getTextColorProps.affixColor;var currencyColor=isAffixSubtle?affixColor:amountValueColor;var currencyFontSize=isAffixSubtle?affixFontSizes[size]:amountFontSizes[size];var currencyWeight=getCurrencyWeight(isAffixSubtle,size);var isReactNative=getPlatformType()==='react-native';return jsx(BaseBox,_extends({display:isReactNative?castNativeType('flex'):castWebType('inline-flex')},metaAttribute({name:MetaConstants.Amount,testID:testID}),getStyledProps(styledProps),{children:jsxs(BaseBox,{paddingLeft:"spacing.2",paddingRight:"spacing.2",display:isReactNative?castNativeType('flex'):castWebType('inline-flex'),alignItems:"baseline",flexDirection:"row",children:[jsx(BaseText,{marginRight:"spacing.1",fontWeight:currencyWeight,fontSize:currencyFontSize,color:currencyColor,as:isReactNative?undefined:'span',children:currencyPrefix}),jsx(AmountValue,{value:renderedValue,amountValueColor:amountValueColor,size:size,isAffixSubtle:isAffixSubtle,suffix:suffix,affixColor:affixColor})]})}));};var Amount=assignWithoutSideEffects(_Amount,{displayName:'Amount',componentId:'Amount'});
|
|
3072
3074
|
|
|
3073
3075
|
var BottomSheetEmptyHeader=React__default.forwardRef(function(_ref,ref){var onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp;var _useBottomSheetContex=useBottomSheetContext(),close=_useBottomSheetContex.close,isHeaderFloating=_useBottomSheetContex.isHeaderFloating;var _useTheme=useTheme(),theme=_useTheme.theme;var webOnlyEventHandlers=isReactNative$4()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};var topOffset=isHeaderFloating?'spacing.5':undefined;if(isReactNative$4()){topOffset='spacing.0';}return jsx(BaseBox,_extends({position:isHeaderFloating?'absolute':'relative',height:makeSize(size[8]),touchAction:"none",top:topOffset,right:"spacing.0"},webOnlyEventHandlers,{children:jsx(BaseBox,{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:isHeaderFloating?'spacing.0':makeSpace(-size[4]),right:"spacing.5",width:makeSize(size[28]),height:makeSize(size[28]),flexShrink:0,backgroundColor:theme.colors.surface.background.level2.lowContrast,borderRadius:"max",zIndex:100,children:jsx(IconButton,{ref:ref,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:close})})}));});
|
|
3074
3076
|
|
|
@@ -3086,7 +3088,7 @@ var BottomSheetBackdrop=function BottomSheetBackdrop(props){var _useTheme=useThe
|
|
|
3086
3088
|
|
|
3087
3089
|
var BottomSheetSurface=styled(BaseBox)(function(_ref){var theme=_ref.theme;return {borderTopLeftRadius:makeSpace(theme.spacing[5]),borderTopRightRadius:makeSpace(theme.spacing[5]),backgroundColor:theme.colors.surface.background.level2.lowContrast,justifyContent:'center',alignItems:'center',position:'relative'};});var focusOnElement=function focusOnElement(element){var reactTag=findNodeHandle(element);if(reactTag){AccessibilityInfo.setAccessibilityFocus(reactTag);}};var _BottomSheet=function _BottomSheet(_ref2){var children=_ref2.children,_ref2$snapPoints=_ref2.snapPoints,snapPoints=_ref2$snapPoints===void 0?[0.35,0.5,0.85]:_ref2$snapPoints,isOpen=_ref2.isOpen,onDismiss=_ref2.onDismiss,initialFocusRef=_ref2.initialFocusRef;var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();var defaultInitialFocusRef=React__default.useRef(null);var sheetRef=React__default.useRef(null);var header=React__default.useRef();var footer=React__default.useRef();var body=React__default.useRef();var _isOpen=isOpen!=null?isOpen:bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.isOpen;var _React$useState=React__default.useState(0),_React$useState2=_slicedToArray(_React$useState,2),headerHeight=_React$useState2[0],setHeaderHeight=_React$useState2[1];var _React$useState3=React__default.useState(0),_React$useState4=_slicedToArray(_React$useState3,2),footerHeight=_React$useState4[0],setFooterHeight=_React$useState4[1];var _React$useState5=React__default.useState(0),_React$useState6=_slicedToArray(_React$useState5,2),contentHeight=_React$useState6[0],setContentHeight=_React$useState6[1];var _React$useState7=React__default.useState(true),_React$useState8=_slicedToArray(_React$useState7,2),hasBodyPadding=_React$useState8[0],setHasBodyPadding=_React$useState8[1];var _React$useState9=React__default.useState(false),_React$useState10=_slicedToArray(_React$useState9,2),isHeaderEmpty=_React$useState10[0],setIsHeaderEmpty=_React$useState10[1];var initialSnapPoint=React__default.useRef(0);var totalHeight=React__default.useMemo(function(){return headerHeight+footerHeight+contentHeight;},[contentHeight,footerHeight,headerHeight]);var id=useId();var _useBottomSheetStack=useBottomSheetStack(),addBottomSheetToStack=_useBottomSheetStack.addBottomSheetToStack,removeBottomSheetFromStack=_useBottomSheetStack.removeBottomSheetFromStack,getCurrentStackIndexById=_useBottomSheetStack.getCurrentStackIndexById,getTopOfTheStack=_useBottomSheetStack.getTopOfTheStack;var currentStackIndex=getCurrentStackIndexById(id);var zIndex=100-currentStackIndex;useIsomorphicLayoutEffect(function(){var height=Dimensions.get('window').height;var middleSnapPoint=snapPoints[1]*height;if(totalHeight>middleSnapPoint){initialSnapPoint.current=1;}},[snapPoints,totalHeight]);var _snapPoints=React__default.useMemo(function(){return snapPoints.map(function(point){return point*100+"%";});},[snapPoints]);var close=React__default.useCallback(function(){onDismiss==null?void 0:onDismiss();bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.onBottomSheetDismiss();},[bottomSheetAndDropdownGlue,onDismiss]);var handleOnOpen=React__default.useCallback(function(){var _sheetRef$current;(_sheetRef$current=sheetRef.current)==null?void 0:_sheetRef$current.snapToIndex(initialSnapPoint.current);},[]);var handleOnClose=React__default.useCallback(function(){var _sheetRef$current2;(_sheetRef$current2=sheetRef.current)==null?void 0:_sheetRef$current2.close();Keyboard.dismiss();},[sheetRef]);React__default.useEffect(function(){if(_isOpen){handleOnOpen();if(!initialFocusRef){focusOnElement(defaultInitialFocusRef.current);}else {focusOnElement(initialFocusRef.current);}}else {handleOnClose();}},[_isOpen,handleOnClose,handleOnOpen,initialFocusRef]);React__default.useEffect(function(){if(!bottomSheetAndDropdownGlue)return;bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);},[bottomSheetAndDropdownGlue]);React__default.useEffect(function(){React__default.Children.forEach(children,function(child){if(getComponentId(child)===ComponentIds.BottomSheetHeader){header.current=child;}if(getComponentId(child)===ComponentIds.BottomSheetFooter){footer.current=child;}if(getComponentId(child)===ComponentIds.BottomSheetBody){body.current=child;}});},[children]);var renderFooter=React__default.useCallback(function(props){return jsx(BottomSheetFooter$1,_extends({},props,{children:jsx(View,{onLayout:function onLayout(event){setFooterHeight(event.nativeEvent.layout.height);},children:footer.current})}));},[]);var renderBackdrop=React__default.useCallback(function(props){return jsx(BottomSheetBackdrop,_extends({},props,{zIndex:zIndex}));},[zIndex]);var renderHandle=React__default.useCallback(function(){return jsxs(BaseBox,{position:isHeaderEmpty?'absolute':'relative',top:"spacing.0",left:"spacing.0",right:"spacing.0",onLayout:function onLayout(_ref3){var nativeEvent=_ref3.nativeEvent;setHeaderHeight(nativeEvent.layout.height);},children:[jsx(BaseBox,{zIndex:zIndex,children:jsx(BottomSheetGrabHandle,{})}),header.current]});},[isHeaderEmpty,zIndex]);var isHeaderFloating=!hasBodyPadding&&isHeaderEmpty;var contextValue=React__default.useMemo(function(){return {isInBottomSheet:true,isOpen:Boolean(_isOpen),close:handleOnClose,positionY:0,headerHeight:headerHeight,contentHeight:contentHeight,footerHeight:footerHeight,setContentHeight:setContentHeight,setFooterHeight:setFooterHeight,setHeaderHeight:setHeaderHeight,scrollRef:function scrollRef(){},bind:{},defaultInitialFocusRef:defaultInitialFocusRef,isHeaderFloating:isHeaderFloating,setHasBodyPadding:setHasBodyPadding,setIsHeaderEmpty:setIsHeaderEmpty};},[_isOpen,contentHeight,footerHeight,handleOnClose,headerHeight,isHeaderFloating]);var dropdownProps=useDropdown();React__default.useEffect(function(){if(_isOpen){addBottomSheetToStack(id);}else {removeBottomSheetFromStack(id);}},[addBottomSheetToStack,_isOpen,id,removeBottomSheetFromStack]);React__default.useEffect(function(){var showSubscription=Keyboard.addListener('keyboardDidShow',function(){if(id&&id===getTopOfTheStack()){var _sheetRef$current3;(_sheetRef$current3=sheetRef.current)==null?void 0:_sheetRef$current3.expand();}});return function(){showSubscription.remove();};},[getTopOfTheStack,id]);return jsx(Portal,{hostName:"BladeBottomSheetPortal",children:jsx(DropdownContext.Provider,{value:dropdownProps,children:jsx(BottomSheetContext.Provider,{value:contextValue,children:jsx(GorhomBottomSheet,{style:isOpen?{shadowColor:'hsla(217,56%,17%,0.64)',shadowOffset:{width:0,height:-18},shadowOpacity:0.2,shadowRadius:12}:{},enablePanDownToClose:true,enableOverDrag:true,enableContentPanningGesture:true,ref:sheetRef,index:-1,containerStyle:{zIndex:zIndex},animateOnMount:false,handleComponent:renderHandle,backgroundComponent:BottomSheetSurface,footerComponent:renderFooter,backdropComponent:renderBackdrop,onClose:close,snapPoints:_snapPoints,children:body.current})})})});};var BottomSheet=assignWithoutSideEffects(_BottomSheet,{componentId:ComponentIds.BottomSheet});
|
|
3088
3090
|
|
|
3089
|
-
var AccordionContext=createContext(null);var useAccordion=function useAccordion(){var accordionContext=useContext(AccordionContext);if(__DEV__){if(!accordionContext){
|
|
3091
|
+
var AccordionContext=createContext(null);var useAccordion=function useAccordion(){var accordionContext=useContext(AccordionContext);if(__DEV__){if(!accordionContext){throwBladeError({message:'useAccordion should be only used within AccordionContext',moduleName:'AccordionContext'});}}return accordionContext;};
|
|
3090
3092
|
|
|
3091
3093
|
var MAX_WIDTH$1={s:makeSize(Dimensions.get('window').width-size[40]),m:makeSize(size[640]),l:makeSize(size[800])};
|
|
3092
3094
|
|
|
@@ -3096,21 +3098,21 @@ var getTransitionDuration$1=function getTransitionDuration(theme){return makeMot
|
|
|
3096
3098
|
|
|
3097
3099
|
var StyledAccordionButton=styled(Animated.createAnimatedComponent(Pressable))(getCommonAccordionButtonStyles);
|
|
3098
3100
|
|
|
3099
|
-
var CollapsibleContext=createContext(null);var useCollapsible=function useCollapsible(){var collapsibleContext=useContext(CollapsibleContext);if(__DEV__){if(!collapsibleContext){
|
|
3101
|
+
var CollapsibleContext=createContext(null);var useCollapsible=function useCollapsible(){var collapsibleContext=useContext(CollapsibleContext);if(__DEV__){if(!collapsibleContext){throwBladeError({message:"You're trying to use Collapsible sub-components without Collapsible. useCollapsible should only be used within CollapsibleContext",moduleName:'CollapsibleContext'});}}return collapsibleContext;};
|
|
3100
3102
|
|
|
3101
3103
|
var getCollapsibleBodyContentBoxProps=function getCollapsibleBodyContentBoxProps(_ref){var direction=_ref.direction;return {marginTop:direction==='bottom'?'spacing.5':'spacing.0',marginBottom:direction==='top'?'spacing.5':'spacing.0'};};var getOpacity=function getOpacity(_ref2){var isExpanded=_ref2.isExpanded;return isExpanded?1:0.8;};var getTransitionDuration=function getTransitionDuration(theme){return makeMotionTime(theme.motion.duration.xmoderate);};var getTransitionEasing=function getTransitionEasing(theme){return theme.motion.easing.standard.effective;};var getCollapsibleChevronIconTransforms=function getCollapsibleChevronIconTransforms(){return {transformExpanded:-180,transformCollapsed:0};};
|
|
3102
3104
|
|
|
3103
3105
|
var CollapsibleChevronIcon=function CollapsibleChevronIcon(props){var _useCollapsible=useCollapsible(),isExpanded=_useCollapsible.isExpanded;var _useTheme=useTheme(),theme=_useTheme.theme;var _getCollapsibleChevro=getCollapsibleChevronIconTransforms(),transformExpanded=_getCollapsibleChevro.transformExpanded,transformCollapsed=_getCollapsibleChevro.transformCollapsed;var duration=castNativeType(getTransitionDuration(theme));var easing=castNativeType(getTransitionEasing(theme));var rotateZ=useDerivedValue(function(){var _f=function _f(){return withTiming(isExpanded?transformExpanded:transformCollapsed,{duration:duration,easing:easing});};_f._closure={withTiming:withTiming,isExpanded:isExpanded,transformExpanded:transformExpanded,transformCollapsed:transformCollapsed,duration:duration,easing:easing};_f.asString="function _f(){const{withTiming,isExpanded,transformExpanded,transformCollapsed,duration,easing}=jsThis._closure;{return withTiming(isExpanded?transformExpanded:transformCollapsed,{duration:duration,easing:easing});}}";_f.__workletHash=6055948545361;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Collapsible/CollapsibleChevronIcon.native.tsx (23:34)";return _f;}());var animatedStyles=useAnimatedStyle(function(){var _f=function _f(){return {transform:[{rotateZ:rotateZ.value+"deg"}]};};_f._closure={rotateZ:rotateZ};_f.asString="function _f(){const{rotateZ}=jsThis._closure;{return{transform:[{rotateZ:rotateZ.value+\"deg\"}]};}}";_f.__workletHash=15898834984503;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Collapsible/CollapsibleChevronIcon.native.tsx (26:42)";_f.__optimalization=3;return _f;}());return jsx(Animated.View,_extends({style:animatedStyles},makeAccessible({hidden:true}),{children:jsx(ChevronDownIcon,_extends({},props))}));};
|
|
3104
3106
|
|
|
3105
|
-
var _AccordionButton=function _AccordionButton(_ref){var index=_ref.index,Icon=_ref.icon,children=_ref.children;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var _useAccordion=useAccordion(),showNumberPrefix=_useAccordion.showNumberPrefix,expandedIndex=_useAccordion.expandedIndex;var _useTheme=useTheme(),theme=_useTheme.theme;var toggleCollapse=function toggleCollapse(){return onExpandChange(!isExpanded);};var isItemExpanded=expandedIndex===index;var isPressed=useSharedValue(false);var duration=castNativeType(getTransitionDuration$1(theme));var easing=castNativeType(getTransitionEasing$1(theme));var activeBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true}));var inActiveBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false}));useEffect(function(){activeBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true});inActiveBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false});},[isExpanded,activeBackgroundColor,inActiveBackgroundColor,theme]);var animatedStyles=useAnimatedStyle(function(){var _f=function _f(){return {backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};};_f._closure={withTiming:withTiming,isPressed:isPressed,activeBackgroundColor:activeBackgroundColor,inActiveBackgroundColor:inActiveBackgroundColor,duration:duration,easing:easing};_f.asString="function _f(){const{withTiming,isPressed,activeBackgroundColor,inActiveBackgroundColor,duration,easing}=jsThis._closure;{return{backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};}}";_f.__workletHash=12210880793787;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Accordion/AccordionButton.native.tsx (
|
|
3107
|
+
var _AccordionButton=function _AccordionButton(_ref){var index=_ref.index,Icon=_ref.icon,children=_ref.children;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var _useAccordion=useAccordion(),showNumberPrefix=_useAccordion.showNumberPrefix,expandedIndex=_useAccordion.expandedIndex;var _useTheme=useTheme(),theme=_useTheme.theme;var toggleCollapse=function toggleCollapse(){return onExpandChange(!isExpanded);};var isItemExpanded=expandedIndex===index;var isPressed=useSharedValue(false);var duration=castNativeType(getTransitionDuration$1(theme));var easing=castNativeType(getTransitionEasing$1(theme));var activeBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true}));var inActiveBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false}));useEffect(function(){activeBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true});inActiveBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false});},[isExpanded,activeBackgroundColor,inActiveBackgroundColor,theme]);var animatedStyles=useAnimatedStyle(function(){var _f=function _f(){return {backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};};_f._closure={withTiming:withTiming,isPressed:isPressed,activeBackgroundColor:activeBackgroundColor,inActiveBackgroundColor:inActiveBackgroundColor,duration:duration,easing:easing};_f.asString="function _f(){const{withTiming,isPressed,activeBackgroundColor,inActiveBackgroundColor,duration,easing}=jsThis._closure;{return{backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};}}";_f.__workletHash=12210880793787;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Accordion/AccordionButton.native.tsx (52:42)";_f.__optimalization=2;return _f;}());var _showNumberPrefix=typeof index==='number'&&showNumberPrefix;var _index=_showNumberPrefix?jsxs(Heading,{size:"small",marginRight:"spacing.2",children:[index+1,"."]}):null;var a11yLabel=_showNumberPrefix?index+1+". "+children:children;var renderChildren=function renderChildren(_ref2){var pressed=_ref2.pressed;isPressed.value=pressed;var iconColor=pressed?'surface.action.icon.focus.lowContrast':'surface.action.icon.default.lowContrast';var _icon=Icon&&jsx(Icon,{size:"medium",color:iconColor,marginRight:"spacing.3",marginY:"spacing.2"});if(__DEV__){if(_index&&_icon){throwBladeError({message:"showNumberPrefix and icon shouldn't be used together",moduleName:'Accordion'});}}return jsxs(BaseBox,{display:"flex",flexDirection:"row",flex:1,justifyContent:"space-between",alignItems:"center",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"flex-start",marginRight:"spacing.5",flexShrink:1,children:[_index,_icon,jsx(Heading,{size:"small",children:children})]}),jsx(BaseBox,{children:jsx(CollapsibleChevronIcon,{color:iconColor,size:"large"})})]});};return jsx(StyledAccordionButton,_extends({isExpanded:isExpanded,onPress:toggleCollapse,style:animatedStyles},makeAccessible({role:'button',expanded:isItemExpanded,controls:collapsibleBodyId,label:a11yLabel}),metaAttribute({name:MetaConstants.AccordionButton}),{children:renderChildren}));};var AccordionButton=assignWithoutSideEffects(_AccordionButton,{componentId:MetaConstants.AccordionButton});
|
|
3106
3108
|
|
|
3107
3109
|
var MAX_WIDTH={s:makeSize(Dimensions.get('window').width-size[40]),m:makeSize(size[640]),l:makeSize(size[1136])};var nativeStyles=StyleSheet.create({collapsibleBodyExpanded:{position:'relative'},collapsibleBodyCollapsed:{position:'absolute'}});var MAX_WIDTH_NO_RESTRICTIONS=undefined;
|
|
3108
3110
|
|
|
3109
|
-
var _excluded$1=["children","direction","defaultIsExpanded","isExpanded","onExpandChange","testID","_shouldApplyWidthRestrictions"];var MIN_WIDTH=makeSize(size[200]);var Collapsible=function Collapsible(_ref){var children=_ref.children,_ref$direction=_ref.direction,direction=_ref$direction===void 0?'bottom':_ref$direction,_ref$defaultIsExpande=_ref.defaultIsExpanded,defaultIsExpanded=_ref$defaultIsExpande===void 0?false:_ref$defaultIsExpande,isExpanded=_ref.isExpanded,onExpandChange=_ref.onExpandChange,testID=_ref.testID,_ref$_shouldApplyWidt=_ref._shouldApplyWidthRestrictions,_shouldApplyWidthRestrictions=_ref$_shouldApplyWidt===void 0?true:_ref$_shouldApplyWidt,styledProps=_objectWithoutProperties(_ref,_excluded$1);var _useState=useState(isExpanded!=null?isExpanded:defaultIsExpanded),_useState2=_slicedToArray(_useState,2),isBodyExpanded=_useState2[0],setIsBodyExpanded=_useState2[1];var collapsibleBodyId=useId(MetaConstants.CollapsibleBody);var initialDefaultExpanded=useRef(Boolean(defaultIsExpanded||isExpanded));var handleExpandChange=useCallback(function(nextIsExpanded){if(typeof isExpanded!=='undefined'){onExpandChange==null?void 0:onExpandChange({isExpanded:nextIsExpanded});}else {setIsBodyExpanded(nextIsExpanded);onExpandChange==null?void 0:onExpandChange({isExpanded:nextIsExpanded});}},[onExpandChange,isExpanded]);var contextValue=useMemo(function(){return {isExpanded:isExpanded!=null?isExpanded:isBodyExpanded,onExpandChange:handleExpandChange,defaultIsExpanded:initialDefaultExpanded.current,direction:direction,collapsibleBodyId:collapsibleBodyId};},[isBodyExpanded,direction,handleExpandChange,isExpanded,collapsibleBodyId]);if(__DEV__){Children.forEach(children,function(child){if(!(isValidAllowedChildren(child,MetaConstants.CollapsibleBody)||isValidAllowedChildren(child,MetaConstants.CollapsibleButton)||isValidAllowedChildren(child,MetaConstants.CollapsibleLink)||isValidAllowedChildren(child,MetaConstants.AccordionButton))){
|
|
3111
|
+
var _excluded$1=["children","direction","defaultIsExpanded","isExpanded","onExpandChange","testID","_shouldApplyWidthRestrictions"];var MIN_WIDTH=makeSize(size[200]);var Collapsible=function Collapsible(_ref){var children=_ref.children,_ref$direction=_ref.direction,direction=_ref$direction===void 0?'bottom':_ref$direction,_ref$defaultIsExpande=_ref.defaultIsExpanded,defaultIsExpanded=_ref$defaultIsExpande===void 0?false:_ref$defaultIsExpande,isExpanded=_ref.isExpanded,onExpandChange=_ref.onExpandChange,testID=_ref.testID,_ref$_shouldApplyWidt=_ref._shouldApplyWidthRestrictions,_shouldApplyWidthRestrictions=_ref$_shouldApplyWidt===void 0?true:_ref$_shouldApplyWidt,styledProps=_objectWithoutProperties(_ref,_excluded$1);var _useState=useState(isExpanded!=null?isExpanded:defaultIsExpanded),_useState2=_slicedToArray(_useState,2),isBodyExpanded=_useState2[0],setIsBodyExpanded=_useState2[1];var collapsibleBodyId=useId(MetaConstants.CollapsibleBody);var initialDefaultExpanded=useRef(Boolean(defaultIsExpanded||isExpanded));var handleExpandChange=useCallback(function(nextIsExpanded){if(typeof isExpanded!=='undefined'){onExpandChange==null?void 0:onExpandChange({isExpanded:nextIsExpanded});}else {setIsBodyExpanded(nextIsExpanded);onExpandChange==null?void 0:onExpandChange({isExpanded:nextIsExpanded});}},[onExpandChange,isExpanded]);var contextValue=useMemo(function(){return {isExpanded:isExpanded!=null?isExpanded:isBodyExpanded,onExpandChange:handleExpandChange,defaultIsExpanded:initialDefaultExpanded.current,direction:direction,collapsibleBodyId:collapsibleBodyId};},[isBodyExpanded,direction,handleExpandChange,isExpanded,collapsibleBodyId]);if(__DEV__){Children.forEach(children,function(child){if(!(isValidAllowedChildren(child,MetaConstants.CollapsibleBody)||isValidAllowedChildren(child,MetaConstants.CollapsibleButton)||isValidAllowedChildren(child,MetaConstants.CollapsibleLink)||isValidAllowedChildren(child,MetaConstants.AccordionButton))){throwBladeError({message:"only the following are supported as valid children: CollapsibleBody, CollapsibleButton, CollapsibleLink",moduleName:'Collapsible'});}});}return jsx(CollapsibleContext.Provider,{value:contextValue,children:jsx(BaseBox,_extends({},metaAttribute({name:MetaConstants.Collapsible,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{display:"flex",flexDirection:direction==='bottom'?'column':'column-reverse',alignItems:"flex-start",minWidth:_shouldApplyWidthRestrictions?MIN_WIDTH:makeSize(size[0]),maxWidth:_shouldApplyWidthRestrictions?MAX_WIDTH:MAX_WIDTH_NO_RESTRICTIONS,children:children})}))});};
|
|
3110
3112
|
|
|
3111
|
-
var _CollapsibleLink=function _CollapsibleLink(_ref){var children=_ref.children,size=_ref.size,isDisabled=_ref.isDisabled,testID=_ref.testID,accessibilityLabel=_ref.accessibilityLabel;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var toggleIsExpanded=useCallback(function(){return onExpandChange(!isExpanded);},[onExpandChange,isExpanded]);return jsx(BaseLink,
|
|
3113
|
+
var _CollapsibleLink=function _CollapsibleLink(_ref){var children=_ref.children,size=_ref.size,isDisabled=_ref.isDisabled,testID=_ref.testID,accessibilityLabel=_ref.accessibilityLabel;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var toggleIsExpanded=useCallback(function(){return onExpandChange(!isExpanded);},[onExpandChange,isExpanded]);return jsx(BaseLink,{variant:"button",size:size,icon:CollapsibleChevronIcon,iconPosition:"right",isDisabled:isDisabled,testID:testID,onClick:toggleIsExpanded,accessibilityProps:{label:accessibilityLabel,controls:collapsibleBodyId,expanded:isExpanded},children:children});};var CollapsibleLink=assignWithoutSideEffects(_CollapsibleLink,{componentId:MetaConstants.CollapsibleLink});
|
|
3112
3114
|
|
|
3113
|
-
var _CollapsibleButton=function _CollapsibleButton(_ref,ref){var children=_ref.children,variant=_ref.variant,size=_ref.size,icon=_ref.icon,iconPosition=_ref.iconPosition,isDisabled=_ref.isDisabled,testID=_ref.testID,accessibilityLabel=_ref.accessibilityLabel;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var toggleIsExpanded=useCallback(function(){return onExpandChange(!isExpanded);},[onExpandChange,isExpanded]);return jsx(BaseButton,
|
|
3115
|
+
var _CollapsibleButton=function _CollapsibleButton(_ref,ref){var children=_ref.children,variant=_ref.variant,size=_ref.size,icon=_ref.icon,iconPosition=_ref.iconPosition,isDisabled=_ref.isDisabled,testID=_ref.testID,accessibilityLabel=_ref.accessibilityLabel;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var toggleIsExpanded=useCallback(function(){return onExpandChange(!isExpanded);},[onExpandChange,isExpanded]);return jsx(BaseButton,{variant:variant,size:size,icon:icon,iconPosition:iconPosition,isDisabled:isDisabled,testID:testID,ref:ref,onClick:toggleIsExpanded,alignSelf:isReactNative$4()?'flex-start':undefined,accessibilityProps:{label:accessibilityLabel,controls:collapsibleBodyId,expanded:isExpanded},children:children});};var CollapsibleButton=assignWithoutSideEffects(forwardRef(_CollapsibleButton),{displayName:'CollapsibleButton',componentId:MetaConstants.CollapsibleButton});
|
|
3114
3116
|
|
|
3115
3117
|
var AnimatedStyledCollapsibleBodyContent=styled(Animated.View)(function(){return {overflow:'hidden'};});var CollapsibleBodyContent=function CollapsibleBodyContent(_ref){var children=_ref.children;var _useCollapsible=useCollapsible(),isExpanded=_useCollapsible.isExpanded,direction=_useCollapsible.direction;var _useTheme=useTheme(),theme=_useTheme.theme;var opacity=useSharedValue(getOpacity({isExpanded:isExpanded}));var height=useSharedValue(isExpanded?undefined:0);var _useState=useState(0),_useState2=_slicedToArray(_useState,2),layoutHeight=_useState2[0],setLayoutHeight=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isAnimating=_useState4[0],setIsAnimating=_useState4[1];var onAnimationComplete=useCallback(function(){requestAnimationFrame(function(){return setIsAnimating(false);});},[]);var duration=castNativeType(getTransitionDuration(theme));var easing=castNativeType(getTransitionEasing(theme));useEffect(function(){setIsAnimating(true);opacity.value=withTiming(getOpacity({isExpanded:isExpanded}),{duration:duration,easing:easing});height.value=withTiming(isExpanded&&layoutHeight?layoutHeight:0,{duration:duration,easing:easing},function(){var _f=function _f(isComplete){if(isComplete){runOnJS(onAnimationComplete)();}};_f._closure={runOnJS:runOnJS,onAnimationComplete:onAnimationComplete};_f.asString="function _f(isComplete){const{runOnJS,onAnimationComplete}=jsThis._closure;{if(isComplete){runOnJS(onAnimationComplete)();}}}";_f.__workletHash=4406217461016;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Collapsible/CollapsibleBodyContent.native.tsx (65:6)";return _f;}());},[isExpanded,opacity,duration,easing,height,layoutHeight,onAnimationComplete]);var animatedStyles=useAnimatedStyle(function(){var _f=function _f(){return {opacity:opacity.value,height:height.value};};_f._closure={opacity:opacity,height:height};_f.asString="function _f(){const{opacity,height}=jsThis._closure;{return{opacity:opacity.value,height:height.value};}}";_f.__workletHash=2328932565878;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/Collapsible/CollapsibleBodyContent.native.tsx (75:42)";_f.__optimalization=3;return _f;}());var onLayout=useCallback(function(event){if(isAnimating){if(event.nativeEvent.layout.height>layoutHeight){setLayoutHeight(event.nativeEvent.layout.height);}}else if(event.nativeEvent.layout.height!==layoutHeight){setLayoutHeight(event.nativeEvent.layout.height);}},[layoutHeight,isAnimating]);return jsx(AnimatedStyledCollapsibleBodyContent,{isExpanded:isExpanded,style:animatedStyles,children:jsx(View,{onLayout:onLayout,style:isExpanded||isAnimating?nativeStyles.collapsibleBodyExpanded:nativeStyles.collapsibleBodyCollapsed,children:jsx(Box,_extends({},getCollapsibleBodyContentBoxProps({direction:direction}),{children:children}))})});};
|
|
3116
3118
|
|
|
@@ -3122,7 +3124,7 @@ var ARROW_WIDTH=14;var ARROW_HEIGHT=7;var tooltipZIndex=1100;
|
|
|
3122
3124
|
|
|
3123
3125
|
var getPlacementParts=function getPlacementParts(placement){var _ref=placement.split('-'),_ref2=_slicedToArray(_ref,2),side=_ref2[0],alignment=_ref2[1];return [side,alignment];};var mergeProps=function mergeProps(base,overrides){var props=_extends({},base);var _loop=function _loop(key){if(!overrides.hasOwnProperty(key))return "continue";var overrideValue=overrides[key];if(typeof overrideValue==='function'){var baseValue=base[key];if(typeof baseValue==='function'){props[key]=function(){overrideValue.apply(void 0,arguments);baseValue.apply(void 0,arguments);};return "continue";}}props[key]=overrideValue;};for(var key in overrides){var _ret=_loop(key);if(_ret==="continue")continue;}return props;};
|
|
3124
3126
|
|
|
3125
|
-
var StyledSvg=styled(Svg)(function(_ref){var styles=_ref.styles;return styles;});var TooltipArrow=React.forwardRef(function(_ref2,ref){var context=_ref2.context;var _useTheme=useTheme(),theme=_useTheme.theme;var placement=context.placement,floating=context.elements.floating,arrow=context.middlewareData.arrow;var width=ARROW_WIDTH;var height=ARROW_HEIGHT;var strokeWidth=theme.border.width.thin*2;if(!ref){
|
|
3127
|
+
var StyledSvg=styled(Svg)(function(_ref){var styles=_ref.styles;return styles;});var TooltipArrow=React.forwardRef(function(_ref2,ref){var context=_ref2.context;var _useTheme=useTheme(),theme=_useTheme.theme;var placement=context.placement,floating=context.elements.floating,arrow=context.middlewareData.arrow;var width=ARROW_WIDTH;var height=ARROW_HEIGHT;var strokeWidth=theme.border.width.thin*2;if(__DEV__){if(!ref){logger({type:'warn',moduleName:'TooltipArrow',message:'Floating UI: The `ref` prop is required for the `FloatingArrow` component.'});}}if(!floating){return jsx(Fragment,{});}var _getPlacementParts=getPlacementParts(placement),_getPlacementParts2=_slicedToArray(_getPlacementParts,1),side=_getPlacementParts2[0];var svgX=width/2;var svgY=0;var dValue='M0,0'+(" H"+width)+(" L"+(width-svgX)+","+(height-svgY))+(" Q"+width/2+","+height+" "+svgX+","+(height-svgY))+' Z';var staticSide={top:'bottom',right:'left',bottom:'top',left:'right'}[side];var rotation={top:0,bottom:180,left:-90,right:90}[side];var newStyles={};if(arrow){var _newStyles;var x=arrow.x,y=arrow.y;newStyles=(_newStyles={width:makeSize(size[20]),height:makeSize(size[20]),position:'absolute',left:x!=null?x+"px":undefined,top:y!=null?y+"px":undefined,right:undefined,bottom:undefined},_defineProperty(_newStyles,staticSide,-width+"px"),_defineProperty(_newStyles,"transform","rotate("+rotation+"deg)"),_newStyles);}var strokeColor=theme.colors.brand.gray[300].highContrast;return jsx(View,{collapsable:false,style:{position:'absolute',left:0,right:0,top:0,bottom:0},children:jsxs(StyledSvg,{ref:ref,width:width+"px",height:width+"px",viewBox:"0 0 "+width+" "+width,styles:newStyles,children:[jsx(Path,{fill:"none",stroke:strokeColor,strokeWidth:strokeWidth+"px",d:dValue}),jsx(Path,{fill:theme.colors.brand.gray[200].highContrast,stroke:"none",d:dValue})]})});});
|
|
3126
3128
|
|
|
3127
3129
|
var getTooltipContentWrapperStyles=function getTooltipContentWrapperStyles(_ref){var theme=_ref.theme,styles=_ref.styles;return _extends({backgroundColor:theme.colors.brand.gray[200].highContrast,borderWidth:makeBorderSize(theme.border.width.thin),borderRadius:makeBorderSize(theme.border.radius.medium),borderColor:theme.colors.brand.gray[300].highContrast,borderStyle:'solid',boxShadow:isReactNative$4()?undefined:castWebType(theme.elevation.lowRaised)},styles);};
|
|
3128
3130
|
|
|
@@ -3130,7 +3132,7 @@ var _excluded=["children","styles","side","isVisible"];var StyledTooltipContentW
|
|
|
3130
3132
|
|
|
3131
3133
|
var TooltipContent=React__default.forwardRef(function(_ref,ref){var children=_ref.children,arrow=_ref.arrow,side=_ref.side,style=_ref.style,isVisible=_ref.isVisible;return jsxs(TooltipContentWrapper,{position:isReactNative$4()?'absolute':'relative',paddingTop:"spacing.3",paddingBottom:"spacing.3",paddingLeft:"spacing.4",paddingRight:"spacing.4",maxWidth:makeSize(size[200]),ref:ref,styles:style,side:side,isVisible:isVisible,children:[jsx(Text,{variant:"body",size:"small",weight:"regular",contrast:"high",color:"feedback.text.neutral.highContrast",children:children}),arrow]});});
|
|
3132
3134
|
|
|
3133
|
-
var TooltipContext=React__default.createContext(null);var useTooltipContext=function useTooltipContext(){var context=React__default.useContext(TooltipContext);if(__DEV__){if(!context){
|
|
3135
|
+
var TooltipContext=React__default.createContext(null);var useTooltipContext=function useTooltipContext(){var context=React__default.useContext(TooltipContext);if(__DEV__){if(!context){throwBladeError({message:"TooltipInteractiveWrapper must be used within Tooltip",moduleName:'Tooltip'});}}return context;};
|
|
3134
3136
|
|
|
3135
3137
|
var Tooltip=function Tooltip(_ref){var content=_ref.content,children=_ref.children,_ref$placement=_ref.placement,placement=_ref$placement===void 0?'left':_ref$placement,onOpenChange=_ref.onOpenChange,_ref$zIndex=_ref.zIndex,zIndex=_ref$zIndex===void 0?tooltipZIndex:_ref$zIndex;var _useTheme=useTheme(),theme=_useTheme.theme;var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isOpen=_React$useState2[0],setIsOpen=_React$useState2[1];var gap=theme.spacing[2];var _getPlacementParts=getPlacementParts(placement),_getPlacementParts2=_slicedToArray(_getPlacementParts,1),side=_getPlacementParts2[0];var isHorizontal=side==='left'||side==='right';var arrowRef=React__default.useRef();var context=useFloating({sameScrollView:false,placement:placement,middleware:[shift({crossAxis:false,padding:gap}),flip({padding:gap}),offset(gap+ARROW_HEIGHT),arrow({element:arrowRef,padding:isHorizontal?0:ARROW_WIDTH})]});var refs=context.refs,floatingStyles=context.floatingStyles;var handleOpen=React__default.useCallback(function(){setIsOpen(true);onOpenChange==null?void 0:onOpenChange({isOpen:true});},[onOpenChange]);var handleClose=React__default.useCallback(function(){setIsOpen(false);onOpenChange==null?void 0:onOpenChange({isOpen:false});},[onOpenChange]);var _React$useState3=React__default.useState(function(){return isOpen;}),_React$useState4=_slicedToArray(_React$useState3,2),isVisible=_React$useState4[0],setIsVisible=_React$useState4[1];React__default.useEffect(function(){var id=setTimeout(function(){if(!isOpen){setIsVisible(false);}},theme.motion.duration.gentle);if(isOpen){setIsVisible(true);}return function(){return clearTimeout(id);};},[isOpen]);return jsxs(TooltipContext.Provider,{value:true,children:[React__default.cloneElement(children,_extends({},mergeProps({onTouchEnd:children.props.onTouchEnd},{onTouchEnd:handleOpen}),{ref:refs.setReference})),jsx(Modal$1,{accessibilityLabel:content,collapsable:false,transparent:true,visible:isVisible,children:jsx(TouchableOpacity,_extends({style:{flexShrink:0,flex:1},onPress:handleClose,activeOpacity:1,testID:"tooltip-modal-backdrop"},metaAttribute({name:MetaConstants.Tooltip}),{children:jsx(TooltipContent,{isVisible:isOpen,ref:refs.setFloating,side:side,style:_extends({},floatingStyles,{left:floatingStyles.left||-200,top:floatingStyles.top||-200,zIndex:zIndex}),arrow:jsx(TooltipArrow,{context:context,ref:arrowRef}),children:content})}))})]});};
|
|
3136
3138
|
|