@razorpay/blade 10.11.0 → 10.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
2
2
  import * as React from 'react';
3
- import React__default, { useMemo, useCallback, useState, useEffect, useRef, useContext, createContext, Fragment as Fragment$1, Children, cloneElement, forwardRef } from 'react';
3
+ import React__default, { useMemo, useCallback, useState, useEffect, useRef, useContext, createContext, Fragment as Fragment$1, useImperativeHandle, Children, cloneElement, forwardRef } from 'react';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import styled, { ThemeProvider, css, keyframes } from 'styled-components';
6
6
  import _objectWithoutProperties$1 from '@babel/runtime/helpers/objectWithoutProperties';
@@ -2844,8 +2844,12 @@ var getElevationValue = function getElevationValue(elevation, theme, breakpoint)
2844
2844
  };
2845
2845
  var getAllProps = function getAllProps(props, breakpoint) {
2846
2846
  var _props$paddingTop, _props$paddingBottom, _props$paddingRight, _props$paddingLeft, _props$marginBottom, _props$marginTop, _props$marginRight, _props$marginLeft;
2847
- var hasBorder = props.borderBottom || props.borderTop || props.borderLeft || props.borderRight || props.borderBottomColor || props.borderTopColor || props.borderLeftColor || props.borderRightColor || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth || props.borderWidth || props.borderColor;
2848
- return _objectSpread$6h({
2847
+ var hasBorder = props.borderWidth || props.borderColor;
2848
+ var hasBorderRight = props.borderRight || props.borderRightColor || props.borderRightWidth;
2849
+ var hasBorderLeft = props.borderLeft || props.borderLeftColor || props.borderLeftWidth;
2850
+ var hasBorderTop = props.borderTop || props.borderTopColor || props.borderTopWidth;
2851
+ var hasBorderBottom = props.borderBottom || props.borderBottomColor || props.borderBottomWidth;
2852
+ return _objectSpread$6h(_objectSpread$6h({
2849
2853
  display: getResponsiveValue(props.display, breakpoint),
2850
2854
  overflow: getResponsiveValue(props.overflow, breakpoint),
2851
2855
  overflowX: getResponsiveValue(props.overflowX, breakpoint),
@@ -2936,7 +2940,13 @@ var getAllProps = function getAllProps(props, breakpoint) {
2936
2940
  borderTopRightRadius: getBorderRadiusValue(props.borderTopRightRadius, props.theme, breakpoint),
2937
2941
  borderBottomRightRadius: getBorderRadiusValue(props.borderBottomRightRadius, props.theme, breakpoint),
2938
2942
  borderBottomLeftRadius: getBorderRadiusValue(props.borderBottomLeftRadius, props.theme, breakpoint),
2939
- borderStyle: hasBorder ? 'solid' : undefined,
2943
+ borderStyle: hasBorder ? 'solid' : undefined
2944
+ }, !hasBorder && {
2945
+ borderTopStyle: hasBorderTop ? 'solid' : undefined,
2946
+ borderBottomStyle: hasBorderBottom ? 'solid' : undefined,
2947
+ borderLeftStyle: hasBorderLeft ? 'solid' : undefined,
2948
+ borderRightStyle: hasBorderRight ? 'solid' : undefined
2949
+ }), {}, {
2940
2950
  touchAction: getResponsiveValue(props.touchAction, breakpoint),
2941
2951
  userSelect: getResponsiveValue(props.userSelect, breakpoint),
2942
2952
  pointerEvents: getResponsiveValue(props.pointerEvents),
@@ -15184,18 +15194,18 @@ var _Checkbox = function _Checkbox(_ref, ref) {
15184
15194
  isIndeterminate: isIndeterminate,
15185
15195
  isDisabled: _isDisabled,
15186
15196
  isNegative: _hasError
15187
- }), /*#__PURE__*/jsx(SelectorTitle, {
15197
+ }), children ? /*#__PURE__*/jsx(SelectorTitle, {
15188
15198
  size: _size,
15189
15199
  isDisabled: _isDisabled,
15190
15200
  children: children
15191
- })]
15192
- }), /*#__PURE__*/jsx(BaseBox, {
15201
+ }) : null]
15202
+ }), showSupportingText ? /*#__PURE__*/jsx(BaseBox, {
15193
15203
  marginLeft: isSmall ? 'spacing.6' : 'spacing.7',
15194
- children: showSupportingText && /*#__PURE__*/jsx(SelectorSupportText, {
15204
+ children: /*#__PURE__*/jsx(SelectorSupportText, {
15195
15205
  id: ids === null || ids === void 0 ? void 0 : ids.helpTextId,
15196
15206
  children: helpText
15197
15207
  })
15198
- })]
15208
+ }) : null]
15199
15209
  })
15200
15210
  }), /*#__PURE__*/jsx(FormHint, {
15201
15211
  errorText: errorText,
@@ -15390,14 +15400,14 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
15390
15400
  labelledBy: ids.labelId,
15391
15401
  componentName: "checkbox-group",
15392
15402
  testID: testID,
15393
- children: [/*#__PURE__*/jsx(FormLabel, {
15403
+ children: [label ? /*#__PURE__*/jsx(FormLabel, {
15394
15404
  as: "span",
15395
15405
  necessityIndicator: necessityIndicator,
15396
15406
  position: labelPosition,
15397
15407
  id: ids.labelId,
15398
15408
  accessibilityText: accessibilityText,
15399
15409
  children: label
15400
- }), /*#__PURE__*/jsxs(BaseBox, {
15410
+ }) : null, /*#__PURE__*/jsxs(BaseBox, {
15401
15411
  children: [/*#__PURE__*/jsx(BaseBox, {
15402
15412
  display: "flex",
15403
15413
  flexDirection: "column",
@@ -17552,11 +17562,12 @@ var Card = function Card(_ref) {
17552
17562
  return /*#__PURE__*/jsx(CardProvider, {
17553
17563
  children: /*#__PURE__*/jsx(CardRoot, _objectSpread$1h(_objectSpread$1h(_objectSpread$1h({
17554
17564
  as: as,
17565
+ display: 'block',
17566
+ borderRadius: "medium",
17555
17567
  onMouseEnter: onHover,
17556
17568
  shouldScaleOnHover: shouldScaleOnHover,
17557
17569
  isSelected: isSelected,
17558
- isFocused: isFocused,
17559
- borderRadius: "medium"
17570
+ isFocused: isFocused
17560
17571
  // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN
17561
17572
  ,
17562
17573
  onClick: isReactNative$4() ? onClick : undefined,
@@ -22660,7 +22671,7 @@ var otpToArray = function otpToArray(code) {
22660
22671
  * />
22661
22672
  * ```
22662
22673
  */
22663
- var OTPInput = function OTPInput(_ref) {
22674
+ var _OTPInput = function _OTPInput(_ref, incomingRef) {
22664
22675
  var autoFocus = _ref.autoFocus,
22665
22676
  errorText = _ref.errorText,
22666
22677
  helpText = _ref.helpText,
@@ -22702,6 +22713,11 @@ var OTPInput = function OTPInput(_ref) {
22702
22713
  helpTextId = _useFormId.helpTextId,
22703
22714
  errorTextId = _useFormId.errorTextId,
22704
22715
  successTextId = _useFormId.successTextId;
22716
+ useImperativeHandle(incomingRef, function () {
22717
+ return inputRefs.map(function (ref) {
22718
+ return ref.current;
22719
+ });
22720
+ }, [inputRefs]);
22705
22721
  useEffect(function () {
22706
22722
  // Effect for calling `onOTPFilled` callback
22707
22723
  if (inputValue && inputValue.length >= otpLength) {
@@ -22964,6 +22980,7 @@ var OTPInput = function OTPInput(_ref) {
22964
22980
  })]
22965
22981
  }));
22966
22982
  };
22983
+ var OTPInput = /*#__PURE__*/React__default.forwardRef(_OTPInput);
22967
22984
 
22968
22985
  var InputChevronIcon = function InputChevronIcon(props) {
22969
22986
  return /*#__PURE__*/jsxs(BaseBox, {
@@ -25421,14 +25438,14 @@ var _Radio = function _Radio(_ref, ref) {
25421
25438
  isChecked: state.isChecked,
25422
25439
  isDisabled: _isDisabled,
25423
25440
  isNegative: hasError
25424
- }), /*#__PURE__*/jsx(SelectorTitle, {
25441
+ }), children ? /*#__PURE__*/jsx(SelectorTitle, {
25425
25442
  size: _size,
25426
25443
  isDisabled: _isDisabled,
25427
25444
  children: children
25428
- })]
25429
- }), /*#__PURE__*/jsx(BaseBox, {
25445
+ }) : null]
25446
+ }), showHelpText && /*#__PURE__*/jsx(BaseBox, {
25430
25447
  marginLeft: isSmall ? 'spacing.6' : 'spacing.7',
25431
- children: showHelpText && /*#__PURE__*/jsx(SelectorSupportText, {
25448
+ children: /*#__PURE__*/jsx(SelectorSupportText, {
25432
25449
  id: ids === null || ids === void 0 ? void 0 : ids.helpTextId,
25433
25450
  children: helpText
25434
25451
  })
@@ -25582,14 +25599,14 @@ var RadioGroup = function RadioGroup(_ref) {
25582
25599
  accessibilityRole: "radiogroup",
25583
25600
  componentName: "radio-group",
25584
25601
  testID: testID,
25585
- children: [/*#__PURE__*/jsx(FormLabel, {
25602
+ children: [label ? /*#__PURE__*/jsx(FormLabel, {
25586
25603
  as: "span",
25587
25604
  necessityIndicator: necessityIndicator,
25588
25605
  position: labelPosition,
25589
25606
  id: ids.labelId,
25590
25607
  accessibilityText: accessibilityText && ",".concat(accessibilityText),
25591
25608
  children: label
25592
- }), /*#__PURE__*/jsxs(BaseBox, {
25609
+ }) : null, /*#__PURE__*/jsxs(BaseBox, {
25593
25610
  children: [/*#__PURE__*/jsx(BaseBox, {
25594
25611
  display: "flex",
25595
25612
  flexDirection: "column",