@razorpay/blade 10.15.1 → 10.15.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/README.md CHANGED
@@ -1,39 +1,41 @@
1
- <h1 align="center">
2
- Blade
3
- </h1>
1
+ <br/>
4
2
  <p align="center">
5
- <a href="https://github.com/styled-components/styled-components">
6
- <img src="https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?colorB=daa357&colorA=db748e" alt="Blade is styled with styled-components" />
7
- </a>
8
- <a href="https://github.com/facebook/jest">
9
- <img src="https://jestjs.io/img/jest-badge.svg" alt="Blade is tested with jest" />
10
- </a>
11
- <a href="https://github.com/razorpay/blade/blob/master/LICENSE.md">
12
- <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Blade is released under the MIT license." />
13
- </a>
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="./branding/blade-original-dark-mode.min.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="./branding/blade-original.min.svg">
6
+ <img width="450px" alt="Blade Design System Logo" src="./branding/blade-original.min.svg">
7
+ </picture>
14
8
  </p>
15
9
 
10
+ <br/>
11
+
16
12
  <p align="center">
17
- The Design System that powers Razorpay
18
- <p align="center">
13
+ <a href="https://npmjs.org/package/@razorpay/blade"><img alt="Blade Latest Version" src="https://img.shields.io/github/package-json/v/razorpay/blade?style=for-the-badge&labelColor=322&logo=npm&label=@razorpay/Blade&color=darkred&filename=packages%2Fblade%2Fpackage.json"></a> &nbsp;<a href="https://blade.razorpay.com/"><img alt="Documentation blade.razorpay.com" src="https://img.shields.io/badge/Documentation-blade.razorpay.com-0648EF?style=for-the-badge&labelColor=0012AD&logo=readthedocs&logoColor=eee"/></a> &nbsp;<a href="https://github.com/razorpay/blade/tree/master/CONTRIBUTING.md"><img alt="Discord Join Chat" src="https://img.shields.io/badge/Contributions-Open-333333?style=for-the-badge&logo=github&logoColor=ffffff&labelColor=111111"/></a></p>
14
+
15
+ <h1 aria-hidden="true"></h1>
19
16
 
20
- ### [`@razorpay/blade`](https://github.com/razorpay/blade/tree/master/packages/blade)
17
+ <br/>
21
18
 
22
- This package is under active development.
19
+ Blade is the Design System that powers [Razorpay](https://razorpay.com/).
23
20
 
24
- - [Documentation](https://master--61c19ee8d3d282003ac1d81c.chromatic.com)
25
- - [Installation Guide](https://master--61c19ee8d3d282003ac1d81c.chromatic.com/?path=/docs/guides-installation--page)
26
- - [Contributing guidelines](https://github.com/razorpay/blade/blob/master/CONTRIBUTING.md)
21
+ ## 🔗 Links
27
22
 
28
- ---
23
+ - [Docs](https://blade.razorpay.com)
24
+ - [Installation](https://blade.razorpay.com/?path=/docs/guides-installation--page)
25
+ - [@razorpay/blade-old](https://github.com/razorpay/blade-old) (Deprecated, Private)
29
26
 
30
- > **Note**
31
- >
32
- > The blade-old package has been moved to it's own repo.
33
- > [github.com/razorpay/blade-old](https://github.com/razorpay/blade-old) (Only accessible to Razorpay employees)
34
- >
35
- > It is under **maintenance** and it won't have any major releases.
27
+ ## ✨ Features
28
+ - Cross-Platform (Works Natively on [React Web](https://blade.razorpay.com/?path=/docs/guides-installation--page#%EF%B8%8F-installation) and [React Native](https://blade.razorpay.com/?path=/docs/guides-installation--page#react-native-projects))
29
+ - [White Labelling](https://blade.razorpay.com/?path=/docs/guides-theming-theme-playground--page)
30
+ - [CSS Variables for non-React Projects](https://blade.razorpay.com/?path=/docs/tokens-css-variables--page)
31
+ - [Accessible](https://github.com/razorpay/blade/blob/master/rfcs/2022-04-09-accessibility.md#manual-testing)
32
+ - Documented [RFCs](https://github.com/razorpay/blade/tree/docs/make-docs-pretty/rfcs) and [API Decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Alert/_decisions/decisions.md)
36
33
 
37
34
  ## 📝 License
38
35
 
39
36
  Licensed under the [MIT License](https://github.com/razorpay/blade/blob/master/LICENSE.md).
37
+
38
+ <h1 aria-hidden="true"></h1>
39
+
40
+ <p align="center">Interested in working with us? Checkout our <a href="https://razorpay.com/jobs">Jobs Page</a> for open roles 🤗</p>
41
+
@@ -3122,10 +3122,11 @@ declare type ActionColors = `action.text.${DotNotationColorStringToken<Theme['co
3122
3122
  declare type BadgeTextColors = `badge.text.${DotNotationColorStringToken<Theme['colors']['badge']['text']>}`;
3123
3123
  declare type WhiteTextColors = `white.action.text.${DotNotationColorStringToken<Theme['colors']['white']['action']['text']>}`;
3124
3124
  declare type BrandPrimaryColors = `brand.primary.${keyof Theme['colors']['brand']['primary']}`;
3125
+ declare type BrandSecondaryColors = `brand.secondary.${keyof Theme['colors']['brand']['secondary']}`;
3125
3126
  declare type As = 'code' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'abbr' | 'q' | 'cite' | 'figcaption' | 'div';
3126
3127
  declare type BaseTextProps = {
3127
3128
  id?: string;
3128
- color?: BrandPrimaryColors | ActionColors | FeedbackColors | SurfaceColors | FeedbackActionColors | WhiteTextColors | BadgeTextColors;
3129
+ color?: BrandPrimaryColors | BrandSecondaryColors | ActionColors | FeedbackColors | SurfaceColors | FeedbackActionColors | WhiteTextColors | BadgeTextColors;
3129
3130
  fontFamily?: keyof Theme['typography']['fonts']['family'];
3130
3131
  fontSize?: keyof Theme['typography']['fonts']['size'];
3131
3132
  fontWeight?: keyof Theme['typography']['fonts']['weight'];
@@ -14525,6 +14525,7 @@ var getCheckboxIconWrapperStyles = function getCheckboxIconWrapperStyles(_ref) {
14525
14525
  display: 'flex',
14526
14526
  alignItems: 'center',
14527
14527
  justifyContent: 'center',
14528
+ flexShrink: 0,
14528
14529
  width: makeSpace(checkboxSizes.icon[size].width),
14529
14530
  height: makeSpace(checkboxSizes.icon[size].height),
14530
14531
  borderWidth: makeBorderSize(theme.border.width.thick),
@@ -15427,7 +15428,6 @@ var _Checkbox = function _Checkbox(_ref, ref) {
15427
15428
  flexDirection: "column",
15428
15429
  children: [/*#__PURE__*/jsxs(BaseBox, {
15429
15430
  display: "flex",
15430
- alignItems: "center",
15431
15431
  flexDirection: "row",
15432
15432
  children: [/*#__PURE__*/jsx(SelectorInput, {
15433
15433
  hoverTokens: checkboxHoverTokens,
@@ -15966,14 +15966,6 @@ var _ActionListItemText = function _ActionListItemText(_ref4) {
15966
15966
  var ActionListItemText = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemText, {
15967
15967
  componentId: componentIds.ActionListItemText
15968
15968
  });
15969
- var ActionListCheckboxWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
15970
- displayName: "ActionListItem__ActionListCheckboxWrapper",
15971
- componentId: "m6qdwa-1"
15972
- })(function (_props) {
15973
- return {
15974
- pointerEvents: 'none'
15975
- };
15976
- });
15977
15969
  var makeActionListItemClickable = function makeActionListItemClickable(clickHandler) {
15978
15970
  if (isReactNative$4()) {
15979
15971
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
@@ -16010,8 +16002,9 @@ var _ActionListItemBody = function _ActionListItemBody(_ref5) {
16010
16002
  children: selectionType === 'multiple' ?
16011
16003
  /*#__PURE__*/
16012
16004
  // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us
16013
- jsx(ActionListCheckboxWrapper, _objectSpread$1q(_objectSpread$1q({
16014
- hasDescription: Boolean(description)
16005
+ jsx(BaseBox, _objectSpread$1q(_objectSpread$1q({
16006
+ pointerEvents: "none",
16007
+ paddingRight: "spacing.2"
16015
16008
  }, makeAccessible({
16016
16009
  hidden: true
16017
16010
  })), {}, {
@@ -21699,7 +21692,7 @@ var _StyledBaseInput = function _StyledBaseInput(_ref, ref) {
21699
21692
  }, commonProps), props), accessibilityProps), {}, {
21700
21693
  value: props.value,
21701
21694
  children: /*#__PURE__*/jsx(Text, {
21702
- type: props.value ? 'subtle' : 'placeholder',
21695
+ type: props.value && !isDisabled ? 'subtle' : 'placeholder',
21703
21696
  truncateAfterLines: 1,
21704
21697
  textAlign: props.textAlign,
21705
21698
  children: props.value ? props.value : props.placeholder
@@ -21972,7 +21965,8 @@ var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
21972
21965
  handleOnInputClick = _ref3.handleOnInputClick,
21973
21966
  isDropdownTrigger = _ref3.isDropdownTrigger,
21974
21967
  visibleTagsCountRef = _ref3.visibleTagsCountRef,
21975
- labelPrefix = _ref3.labelPrefix;
21968
+ labelPrefix = _ref3.labelPrefix,
21969
+ isDisabled = _ref3.isDisabled;
21976
21970
  var hasTags = tags && tags.length > 0;
21977
21971
  var slotRef = React__default.useRef(null);
21978
21972
  var visibleTagsCount = useVisibleTagsCount({
@@ -22041,6 +22035,7 @@ var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
22041
22035
  setShouldIgnoreBlurAnimation === null || setShouldIgnoreBlurAnimation === void 0 ? void 0 : setShouldIgnoreBlurAnimation(false);
22042
22036
  },
22043
22037
  children: [visibleTags, tags && !showAllTags && invisibleTagsCount ? /*#__PURE__*/jsx(Text, {
22038
+ type: isDisabled ? 'placeholder' : 'normal',
22044
22039
  alignSelf: "center",
22045
22040
  marginY: "spacing.2",
22046
22041
  marginRight: "spacing.4",
@@ -22491,6 +22486,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
22491
22486
  }), /*#__PURE__*/jsx(BaseInputTagSlot, {
22492
22487
  renderAs: as,
22493
22488
  tags: tags,
22489
+ isDisabled: isDisabled,
22494
22490
  showAllTags: showAllTagsWithAnimation,
22495
22491
  setFocusOnInput: function setFocusOnInput() {
22496
22492
  if (ref && !isReactNative && 'current' in ref) {
@@ -23431,22 +23427,32 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
23431
23427
  };
23432
23428
  var OTPInput = /*#__PURE__*/React__default.forwardRef(_OTPInput);
23433
23429
 
23430
+ var Chevron = function Chevron(props) {
23431
+ var iconColor = "surface.text.".concat(props.isDisabled ? 'placeholder' : 'normal', ".lowContrast");
23432
+ return /*#__PURE__*/jsxs(Fragment, {
23433
+ children: [/*#__PURE__*/jsx(ChevronDownIcon, {
23434
+ display: props.isOpen ? 'none' : 'flex',
23435
+ size: "medium",
23436
+ color: iconColor
23437
+ }), /*#__PURE__*/jsx(ChevronUpIcon, {
23438
+ display: props.isOpen ? 'flex' : 'none',
23439
+ size: "medium",
23440
+ color: iconColor
23441
+ })]
23442
+ });
23443
+ };
23444
+
23434
23445
  var InputChevronIcon = function InputChevronIcon(props) {
23435
- return /*#__PURE__*/jsxs(BaseBox, {
23446
+ return /*#__PURE__*/jsx(BaseBox, {
23436
23447
  display: "flex",
23437
23448
  height: "100%",
23438
23449
  justifyContent: "center",
23439
23450
  alignItems: "center",
23440
23451
  onClick: props.onClick,
23441
- children: [/*#__PURE__*/jsx(ChevronDownIcon, {
23442
- display: props.isOpen ? 'none' : 'flex',
23443
- color: "surface.text.normal.lowContrast",
23444
- size: "medium"
23445
- }), /*#__PURE__*/jsx(ChevronUpIcon, {
23446
- display: props.isOpen ? 'flex' : 'none',
23447
- color: "surface.text.normal.lowContrast",
23448
- size: "medium"
23449
- })]
23452
+ children: /*#__PURE__*/jsx(Chevron, {
23453
+ isOpen: props.isOpen,
23454
+ isDisabled: props.isDisabled
23455
+ })
23450
23456
  });
23451
23457
  };
23452
23458
 
@@ -23596,6 +23602,7 @@ var AnimatedTagContainer = /*#__PURE__*/styled(BaseBox).withConfig({
23596
23602
  var AnimatedTag = function AnimatedTag(_ref) {
23597
23603
  var children = _ref.children,
23598
23604
  currentTagIndex = _ref.currentTagIndex,
23605
+ isDisabled = _ref.isDisabled,
23599
23606
  activeTagIndex = _ref.activeTagIndex,
23600
23607
  onDismiss = _ref.onDismiss;
23601
23608
  var _React$useState = React__default.useState(true),
@@ -23625,6 +23632,7 @@ var AnimatedTag = function AnimatedTag(_ref) {
23625
23632
  },
23626
23633
  marginRight: "spacing.3",
23627
23634
  marginY: "spacing.2",
23635
+ isDisabled: isDisabled,
23628
23636
  children: children
23629
23637
  })
23630
23638
  });
@@ -23633,6 +23641,7 @@ var AnimatedTag = function AnimatedTag(_ref) {
23633
23641
  var getTagsGroup = function getTagsGroup(_ref) {
23634
23642
  var tags = _ref.tags,
23635
23643
  activeTagIndex = _ref.activeTagIndex,
23644
+ isDisabled = _ref.isDisabled,
23636
23645
  onDismiss = _ref.onDismiss;
23637
23646
  return tags.map(function (tagName, tagIndex) {
23638
23647
  return /*#__PURE__*/jsx(AnimatedTag, {
@@ -23640,6 +23649,7 @@ var getTagsGroup = function getTagsGroup(_ref) {
23640
23649
  onDismiss: onDismiss,
23641
23650
  currentTagIndex: tagIndex,
23642
23651
  tagsLength: tags.length,
23652
+ isDisabled: isDisabled,
23643
23653
  children: tagName
23644
23654
  }, tagName);
23645
23655
  });
@@ -23819,9 +23829,11 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23819
23829
  }
23820
23830
  return getTagsGroup({
23821
23831
  tags: selectedIndices.map(function (selectedIndex) {
23822
- return options[selectedIndex].title;
23832
+ var _options$selectedInde;
23833
+ return (_options$selectedInde = options[selectedIndex]) === null || _options$selectedInde === void 0 ? void 0 : _options$selectedInde.title;
23823
23834
  }),
23824
23835
  activeTagIndex: activeTagIndex,
23836
+ isDisabled: props.isDisabled,
23825
23837
  onDismiss: function onDismiss(_ref) {
23826
23838
  var tagIndex = _ref.tagIndex;
23827
23839
  if (isTagDismissedRef.current) {
@@ -23887,7 +23899,13 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23887
23899
  autoFocus: props.autoFocus // eslint-disable-line jsx-a11y/no-autofocus
23888
23900
  ,
23889
23901
  value: getValue(),
23890
- onClick: props.onTriggerClick,
23902
+ onClick: function onClick(e) {
23903
+ var _props$onTriggerClick;
23904
+ if (props.isDisabled) {
23905
+ return;
23906
+ }
23907
+ (_props$onTriggerClick = props.onTriggerClick) === null || _props$onTriggerClick === void 0 ? void 0 : _props$onTriggerClick.call(props, e);
23908
+ },
23891
23909
  onFocus: props.onFocus,
23892
23910
  onBlur: function onBlur(_ref2) {
23893
23911
  var _props$onBlur;
@@ -23925,6 +23943,7 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23925
23943
  onTriggerClick();
23926
23944
  }
23927
23945
  },
23946
+ isDisabled: props.isDisabled,
23928
23947
  isOpen: isOpen
23929
23948
  })
23930
23949
  });
@@ -24126,7 +24145,10 @@ var useAutoComplete = function useAutoComplete(_ref) {
24126
24145
  name: props.name,
24127
24146
  value: displayText
24128
24147
  });
24129
- setInputValue(displayText !== null && displayText !== void 0 ? displayText : '');
24148
+ // Use displayText as inputValue only if its not controlled by user
24149
+ if (typeof props.value === 'undefined') {
24150
+ setInputValue(displayText !== null && displayText !== void 0 ? displayText : '');
24151
+ }
24130
24152
  }
24131
24153
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
24132
24154
  name: props.name,