@razorpay/blade 8.3.0 → 8.4.0

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.
@@ -2234,7 +2234,40 @@ declare type BoxVisualProps = MakeObjectResponsive<{
2234
2234
  }> & {
2235
2235
  as: BoxAsType;
2236
2236
  };
2237
- declare type BoxProps = Partial<PaddingProps & MarginProps & LayoutProps & FlexboxProps & PositionProps & GridProps & BoxVisualProps & {
2237
+ declare type BoxCallbackProps = Omit<Platform.Select<{
2238
+ web: {
2239
+ /**
2240
+ * **Warning**
2241
+ *
2242
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2243
+ * You would probably want to render it as `button` using `styled.button` instead.
2244
+ *
2245
+ * Use this for hoverable containers in cases like custom menus.
2246
+ */
2247
+ onMouseOver: React.MouseEventHandler<HTMLElement>;
2248
+ /**
2249
+ * **Warning**
2250
+ *
2251
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2252
+ * You would probably want to render it as `button` using `styled.button` instead.
2253
+ *
2254
+ * Use this for hoverable containers in cases like custom menus.
2255
+ */
2256
+ onMouseEnter: React.MouseEventHandler<HTMLElement>;
2257
+ /**
2258
+ * **Warning**
2259
+ *
2260
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2261
+ * You would probably want to render it as `button` using `styled.button` instead.
2262
+ *
2263
+ * Use this for hoverable containers in cases like custom menus.
2264
+ */
2265
+ onMouseLeave: React.MouseEventHandler<HTMLElement>;
2266
+ onScroll: React.UIEventHandler<HTMLElement>;
2267
+ };
2268
+ native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;
2269
+ }>, '__brand__'>;
2270
+ declare type BoxProps = Partial<PaddingProps & MarginProps & LayoutProps & FlexboxProps & PositionProps & GridProps & BoxCallbackProps & BoxVisualProps & {
2238
2271
  children?: React.ReactNode | React.ReactNode[];
2239
2272
  } & TestID>;
2240
2273
  declare type BoxRefType = Platform.Select<{
@@ -2281,7 +2314,12 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<MakeObjectRe
2281
2314
  left: SpacingValueType;
2282
2315
  } & PickIfExist$1<styled_components.CSSObject, "position" | "zIndex"> & {
2283
2316
  __brand__?: "platform-web" | undefined;
2284
- }> & MakeObjectResponsive<PickCSSByPlatform$1<"grid" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate">> & MakeObjectResponsive<{
2317
+ }> & MakeObjectResponsive<PickCSSByPlatform$1<"grid" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate">> & {
2318
+ onMouseOver: React__default.MouseEventHandler<HTMLElement>;
2319
+ onMouseEnter: React__default.MouseEventHandler<HTMLElement>;
2320
+ onMouseLeave: React__default.MouseEventHandler<HTMLElement>;
2321
+ onScroll: React__default.UIEventHandler<HTMLElement>;
2322
+ } & MakeObjectResponsive<{
2285
2323
  backgroundColor: "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast";
2286
2324
  borderWidth: "none" | "thin" | "thick";
2287
2325
  borderColor: "surface.border.normal.lowContrast" | "surface.border.normal.highContrast" | "surface.border.subtle.lowContrast" | "surface.border.subtle.highContrast";
@@ -2236,7 +2236,40 @@ declare type BoxVisualProps = MakeObjectResponsive<{
2236
2236
  }> & {
2237
2237
  as: BoxAsType;
2238
2238
  };
2239
- declare type BoxProps = Partial<PaddingProps & MarginProps & LayoutProps & FlexboxProps & PositionProps & GridProps & BoxVisualProps & {
2239
+ declare type BoxCallbackProps = Omit<Platform.Select<{
2240
+ web: {
2241
+ /**
2242
+ * **Warning**
2243
+ *
2244
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2245
+ * You would probably want to render it as `button` using `styled.button` instead.
2246
+ *
2247
+ * Use this for hoverable containers in cases like custom menus.
2248
+ */
2249
+ onMouseOver: React.MouseEventHandler<HTMLElement>;
2250
+ /**
2251
+ * **Warning**
2252
+ *
2253
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2254
+ * You would probably want to render it as `button` using `styled.button` instead.
2255
+ *
2256
+ * Use this for hoverable containers in cases like custom menus.
2257
+ */
2258
+ onMouseEnter: React.MouseEventHandler<HTMLElement>;
2259
+ /**
2260
+ * **Warning**
2261
+ *
2262
+ * Make sure to not use Box when you want to create a trigger that performs action on hover.
2263
+ * You would probably want to render it as `button` using `styled.button` instead.
2264
+ *
2265
+ * Use this for hoverable containers in cases like custom menus.
2266
+ */
2267
+ onMouseLeave: React.MouseEventHandler<HTMLElement>;
2268
+ onScroll: React.UIEventHandler<HTMLElement>;
2269
+ };
2270
+ native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;
2271
+ }>, '__brand__'>;
2272
+ declare type BoxProps = Partial<PaddingProps & MarginProps & LayoutProps & FlexboxProps & PositionProps & GridProps & BoxCallbackProps & BoxVisualProps & {
2240
2273
  children?: React.ReactNode | React.ReactNode[];
2241
2274
  } & TestID>;
2242
2275
  declare type BoxRefType = Platform.Select<{
@@ -2283,7 +2316,12 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<MakeObjectRe
2283
2316
  left: SpacingValueType;
2284
2317
  } & PickIfExist$1<react_native.ViewStyle, "position" | "zIndex"> & {
2285
2318
  __brand__?: "platform-native" | undefined;
2286
- }> & MakeObjectResponsive<PickCSSByPlatform$1<"grid" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate">> & MakeObjectResponsive<{
2319
+ }> & MakeObjectResponsive<PickCSSByPlatform$1<"grid" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate">> & {
2320
+ onMouseOver: undefined;
2321
+ onMouseEnter: undefined;
2322
+ onMouseLeave: undefined;
2323
+ onScroll: undefined;
2324
+ } & MakeObjectResponsive<{
2287
2325
  backgroundColor: "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast";
2288
2326
  borderWidth: "none" | "thin" | "thick";
2289
2327
  borderColor: "surface.border.normal.lowContrast" | "surface.border.normal.highContrast" | "surface.border.subtle.lowContrast" | "surface.border.subtle.highContrast";
@@ -3979,7 +3979,7 @@ var _excluded$m=["children","contrast","fontWeight","icon","size","variant","tes
3979
3979
 
3980
3980
  var validBoxAsValues=['div','section','footer','header','main','aside','nav','span'];
3981
3981
 
3982
- var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(!stringBackgroundColorValue.startsWith('surface.background')){throw new Error("[Blade - Box]: Oops! Currently you can only use `surface.background.*` 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");}};var validateBackgroundProp=function validateBackgroundProp(responsiveBackgroundColor){if(responsiveBackgroundColor){if(typeof responsiveBackgroundColor==='string'){validateBackgroundString(responsiveBackgroundColor);return;}Object.values(responsiveBackgroundColor).forEach(function(backgroundColor){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,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,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,children:props.children,as:isReactNative$4()?undefined:props.as};};var _Box=function _Box(props,ref){React__default.useEffect(function(){validateBackgroundProp(props.backgroundColor);},[props.backgroundColor]);React__default.useEffect(function(){if(props.as){if(isReactNative$4()){throw new Error('[Blade - Box]: `as` prop is not supported on React Native');}if(!validBoxAsValues.includes(props.as)){throw new Error("[Blade - Box]: Invalid `as` prop value - "+props.as+". Only "+validBoxAsValues.join(', ')+" are valid values");}}},[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'});
3982
+ var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(!stringBackgroundColorValue.startsWith('surface.background')){throw new Error("[Blade - Box]: Oops! Currently you can only use `surface.background.*` 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");}};var validateBackgroundProp=function validateBackgroundProp(responsiveBackgroundColor){if(responsiveBackgroundColor){if(typeof responsiveBackgroundColor==='string'){validateBackgroundString(responsiveBackgroundColor);return;}Object.values(responsiveBackgroundColor).forEach(function(backgroundColor){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,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,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,as:isReactNative$4()?undefined:props.as};};var _Box=function _Box(props,ref){React__default.useEffect(function(){validateBackgroundProp(props.backgroundColor);},[props.backgroundColor]);React__default.useEffect(function(){if(props.as){if(isReactNative$4()){throw new Error('[Blade - Box]: `as` prop is not supported on React Native');}if(!validBoxAsValues.includes(props.as)){throw new Error("[Blade - Box]: Invalid `as` prop value - "+props.as+". Only "+validBoxAsValues.join(', ')+" are valid values");}}},[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'});
3983
3983
 
3984
3984
  var _excluded$l=["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$l);var _useTheme=useTheme(),theme=_useTheme.theme;return jsx(CardSurfaceStyled,_extends({},props,{surfaceLevel:surfaceLevel,elevation:elevation,style:castNativeType(theme.elevation[elevation]),children:children}));};
3985
3985