@razorpay/blade 9.6.1 → 9.7.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.
@@ -3,244 +3,24 @@ import * as React from 'react';
3
3
  import React__default, { useMemo, useCallback, useState, useEffect, useRef, useContext, createContext, Fragment as Fragment$1, Children, cloneElement, forwardRef } from 'react';
4
4
  import _toConsumableArray$1 from '@babel/runtime/helpers/toConsumableArray';
5
5
  import _objectWithoutProperties$1 from '@babel/runtime/helpers/objectWithoutProperties';
6
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
7
- import _regeneratorRuntime from '@babel/runtime/regenerator';
8
- import { detectOverflow, FloatingDelayGroup, useFloating, autoUpdate, FloatingOverlay, FloatingPortal, FloatingFocusManager, shift, flip, offset, arrow, useTransitionStyles, useDelayGroup, useDelayGroupContext, useHover, useFocus, useRole, useInteractions, FloatingArrow } from '@floating-ui/react';
9
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
10
7
  import styled, { ThemeProvider, css, keyframes } from 'styled-components';
8
+ import { FloatingDelayGroup, useFloating, detectOverflow, autoUpdate, FloatingOverlay, FloatingPortal, FloatingFocusManager, shift, flip, offset, arrow, useTransitionStyles, useDelayGroup, useDelayGroupContext, useHover, useFocus, useRole, useInteractions, FloatingArrow } from '@floating-ui/react';
11
9
  import _typeof from '@babel/runtime/helpers/typeof';
12
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
11
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
14
12
  import _createClass from '@babel/runtime/helpers/createClass';
13
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
14
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
15
15
 
16
- var breakpoints = {
17
- base: 0,
18
- xs: 320,
19
- s: 480,
20
- m: 768,
21
- l: 1024,
22
- xl: 1200
23
- };
24
-
25
- var fontFamily = {
26
- text: 'Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
27
- code: 'monospace'
28
- };
29
-
30
- function ownKeys$62(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
- function _objectSpread$61(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$62(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$62(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
- var fontWeight = {
34
- regular: 400,
35
- bold: 700
36
- };
37
- ({
38
- onDesktop: {
39
- fonts: {
40
- family: _objectSpread$61({}, fontFamily),
41
- size: {
42
- 10: 9,
43
- 25: 10,
44
- 50: 11,
45
- 75: 12,
46
- 100: 14,
47
- 200: 16,
48
- 300: 18,
49
- 400: 20,
50
- 500: 22,
51
- 600: 24,
52
- 700: 28,
53
- 800: 32,
54
- 900: 36,
55
- 1000: 40
56
- },
57
- weight: _objectSpread$61({}, fontWeight)
58
- },
59
- lineHeights: {
60
- 0: 0,
61
- 25: 14,
62
- 50: 16,
63
- 75: 18,
64
- 100: 20,
65
- 200: 24,
66
- 300: 24,
67
- 400: 28,
68
- 500: 32,
69
- 600: 40,
70
- 700: 40,
71
- 800: 48
72
- } // letterSpacings: {},
73
-
74
- },
75
- onMobile: {
76
- fonts: {
77
- family: _objectSpread$61({}, fontFamily),
78
- size: {
79
- 10: 9,
80
- 25: 10,
81
- 50: 11,
82
- 75: 12,
83
- 100: 14,
84
- 200: 16,
85
- 300: 16,
86
- 400: 18,
87
- 500: 20,
88
- 600: 20,
89
- 700: 24,
90
- 800: 28,
91
- 900: 32,
92
- 1000: 32
93
- },
94
- weight: _objectSpread$61({}, fontWeight)
95
- },
96
- lineHeights: {
97
- 0: 0,
98
- 25: 14,
99
- 50: 16,
100
- 75: 18,
101
- 100: 20,
102
- 200: 20,
103
- 300: 24,
104
- 400: 24,
105
- 500: 28,
106
- 600: 32,
107
- 700: 40,
108
- 800: 40
109
- } // letterSpacings: {},
110
-
111
- }
112
- });
113
-
114
- /**
115
- * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
16
+ /*
17
+ * This content is licensed according to the W3C Software License at
18
+ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
116
19
  *
117
- * {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
118
- */
119
- var spacing = {
120
- 0: 0,
121
- 1: 2,
122
- 2: 4,
123
- 3: 8,
124
- 4: 12,
125
- 5: 16,
126
- 6: 20,
127
- 7: 24,
128
- 8: 32,
129
- 9: 40,
130
- 10: 48,
131
- 11: 56
132
- };
133
-
134
- /**
135
- * Size tokens are currently not exposed for users (therefore not available in theme)
20
+ * This software or document includes material copied from or derived from
21
+ * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html.
22
+ * Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang)
136
23
  */
137
- var size = {
138
- /** 0 px */
139
- 0: 0,
140
-
141
- /** 1 px */
142
- 1: 1,
143
-
144
- /** 2 px */
145
- 2: 2,
146
-
147
- /** 3 px */
148
- 3: 3,
149
-
150
- /** 4 px */
151
- 4: 4,
152
-
153
- /** 5 px */
154
- 5: 5,
155
-
156
- /** 6 px */
157
- 6: 6,
158
-
159
- /** 8 px */
160
- 8: 8,
161
-
162
- /** 10 px */
163
- 10: 10,
164
-
165
- /** 12 px */
166
- 12: 12,
167
-
168
- /** 16 px */
169
- 16: 16,
170
-
171
- /** 18 px */
172
- 18: 18,
173
-
174
- /** 20 px */
175
- 20: 20,
176
-
177
- /** 24 px */
178
- 24: 24,
179
-
180
- /** 28 px */
181
- 28: 28,
182
-
183
- /** 32 px */
184
- 32: 32,
185
-
186
- /** 36 px */
187
- 36: 36,
188
-
189
- /** 40 px */
190
- 40: 40,
191
-
192
- /** 44 px */
193
- 44: 44,
194
-
195
- /** 48 px */
196
- 48: 48,
197
-
198
- /** 60 px */
199
- 56: 56,
200
-
201
- /** 100 px */
202
- 100: 100,
203
-
204
- /** 120 px */
205
- 120: 120,
206
-
207
- /** 140 px */
208
- 140: 140,
209
-
210
- /** 160 px */
211
- 160: 160,
212
-
213
- /** 200 px */
214
- 200: 200,
215
-
216
- /** 300 px */
217
- 300: 300,
218
-
219
- /** 360 px */
220
- 360: 360,
221
-
222
- /** 400 px */
223
- 400: 400,
224
-
225
- /** 584 px */
226
- 584: 584,
227
-
228
- /** 640 px */
229
- 640: 640,
230
-
231
- /** 760 px */
232
- 760: 760,
233
-
234
- /** 800 px */
235
- 800: 800,
236
-
237
- /** 1024 px */
238
- 1024: 1024,
239
-
240
- /** 1136 px */
241
- 1136: 1136
242
- };
243
-
244
24
  var componentIds$1 = {
245
25
  DropdownOverlay: 'DropdownOverlay',
246
26
  Dropdown: 'Dropdown',
@@ -527,117 +307,15 @@ var makeInputDisplayValue = function makeInputDisplayValue(selectedIndices, opti
527
307
  return "".concat(selectedIndices.length, " items selected");
528
308
  };
529
309
 
530
- /**
531
- * This function calculates the position of dropdown overlay with respect to dropdown trigger element.
532
- * For non-menus (e.g SelectInput), position is flipped if overflow is on bottom.
533
- * For menus (e.g. DropdownButton), position is flipped if overflow is on right or bottom.
534
- * Additional spacing is added to clientHeight to provide spacing above the dropdown trigger.
535
- */
536
- var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
537
- var position = _ref.overflow,
538
- isMenu = _ref.isMenu,
539
- triggererEl = _ref.triggererEl,
540
- actionListItemEl = _ref.actionListItemEl;
541
- var zeroSpacing = 'spacing.0';
542
- var top = position.top,
543
- bottom = position.bottom,
544
- right = position.right;
545
- var newPosition = {
546
- left: zeroSpacing
310
+ var getColorScheme = function getColorScheme() {
311
+ var colorScheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
312
+ // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there
313
+ var colorSchemeMediaQueryMap = {
314
+ light: '(prefers-color-scheme: light)',
315
+ dark: '(prefers-color-scheme: dark)',
316
+ system: 'default'
547
317
  };
548
- /**
549
- * Calculating thresholds using the height & width of action list element with offset of 16px
550
- */
551
-
552
- var WIDTH_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientWidth) + Number(size[16])) * -1;
553
- var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
554
-
555
- if (!isMenu) {
556
- // In SelectInput, we set position wrt to right so that leftLabel position can be accomodated
557
- // without additional offset calculation from left
558
- newPosition.left = undefined;
559
- newPosition.right = zeroSpacing;
560
-
561
- if (bottom > HEIGHT_THRESHOLD) {
562
- newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
563
- newPosition.top = undefined;
564
- }
565
-
566
- if (top > HEIGHT_THRESHOLD) {
567
- newPosition.top = zeroSpacing;
568
- newPosition.bottom = undefined;
569
- }
570
-
571
- return newPosition;
572
- }
573
-
574
- if (right > WIDTH_THRESHOLD) {
575
- newPosition.right = zeroSpacing;
576
- newPosition.left = undefined;
577
- }
578
-
579
- if (bottom > HEIGHT_THRESHOLD) {
580
- newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[20]), "px");
581
- newPosition.top = undefined;
582
- }
583
-
584
- if (top > HEIGHT_THRESHOLD) {
585
- newPosition.top = zeroSpacing;
586
- newPosition.bottom = undefined;
587
- }
588
-
589
- return newPosition;
590
- };
591
- var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2) {
592
- var isMenu = _ref2.isMenu,
593
- triggererRef = _ref2.triggererRef,
594
- actionListItemRef = _ref2.actionListItemRef,
595
- setDropdownPosition = _ref2.setDropdownPosition;
596
- return {
597
- name: 'detectOverflowMiddleware',
598
- fn: function fn(state) {
599
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
600
- var overflow, position;
601
- return _regeneratorRuntime.wrap(function _callee$(_context) {
602
- while (1) {
603
- switch (_context.prev = _context.next) {
604
- case 0:
605
- _context.next = 2;
606
- return detectOverflow(state, {
607
- elementContext: 'reference'
608
- });
609
-
610
- case 2:
611
- overflow = _context.sent;
612
- position = getDropdownOverlayPosition({
613
- overflow: overflow,
614
- isMenu: isMenu,
615
- triggererEl: triggererRef.current,
616
- actionListItemEl: actionListItemRef.current
617
- });
618
- setDropdownPosition(position);
619
- return _context.abrupt("return", {});
620
-
621
- case 6:
622
- case "end":
623
- return _context.stop();
624
- }
625
- }
626
- }, _callee);
627
- }))();
628
- }
629
- };
630
- };
631
-
632
- var getColorScheme = function getColorScheme() {
633
- var colorScheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
634
- // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there
635
- var colorSchemeMediaQueryMap = {
636
- light: '(prefers-color-scheme: light)',
637
- dark: '(prefers-color-scheme: dark)',
638
- system: 'default'
639
- };
640
- var supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
318
+ var supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
641
319
 
642
320
  if (colorScheme === 'light' || colorScheme === 'dark') {
643
321
  return colorScheme;
@@ -1045,9 +723,9 @@ var useBottomSheetAndDropdownGlue = function useBottomSheetAndDropdownGlue() {
1045
723
 
1046
724
  var _excluded$4Y = ["isOpen", "setIsOpen", "close", "selectedIndices", "setSelectedIndices", "activeIndex", "setActiveIndex", "shouldIgnoreBlur", "setShouldIgnoreBlur", "isKeydownPressed", "setIsKeydownPressed", "options", "selectionType", "changeCallbackTriggerer", "setChangeCallbackTriggerer", "isControlled", "setControlledValueIndices"];
1047
725
 
1048
- function ownKeys$61(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
726
+ function ownKeys$62(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1049
727
 
1050
- function _objectSpread$60(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$61(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$61(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
728
+ function _objectSpread$61(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$62(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$62(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1051
729
 
1052
730
  var noop$1 = function noop() {};
1053
731
 
@@ -1343,7 +1021,7 @@ var useDropdown = function useDropdown() {
1343
1021
  }
1344
1022
  };
1345
1023
 
1346
- return _objectSpread$60({
1024
+ return _objectSpread$61({
1347
1025
  isOpen: isOpen,
1348
1026
  setIsOpen: setIsOpen,
1349
1027
  close: close,
@@ -1474,9 +1152,9 @@ var isValidAllowedChildren = function isValidAllowedChildren(component, id) {
1474
1152
  return getComponentId(component) === id;
1475
1153
  };
1476
1154
 
1477
- function ownKeys$60(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1155
+ function ownKeys$61(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1478
1156
 
1479
- function _objectSpread$5$(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$60(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$60(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1157
+ function _objectSpread$60(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$61(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$61(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1480
1158
  /**
1481
1159
  * Returns if there is ActionListItem after ActionListSection
1482
1160
  * and an index of last ActionListSection
@@ -1540,124 +1218,352 @@ var getActionListProperties = function getActionListProperties(children) {
1540
1218
  return v.title === currentSection;
1541
1219
  }); // push the item in the appropriate bucket
1542
1220
 
1543
- if (foundSection) {
1544
- foundSection === null || foundSection === void 0 ? void 0 : foundSection.data.push(_objectSpread$5$(_objectSpread$5$({}, child.props), {}, {
1545
- _index: currentIndex
1546
- }));
1547
- } else {
1548
- // create a new bucket
1549
- sectionData.push({
1550
- title: currentSection,
1551
- hideDivider: hideDivider,
1552
- data: [_objectSpread$5$(_objectSpread$5$({}, child.props), {}, {
1553
- _index: currentIndex
1554
- })]
1555
- });
1556
- }
1221
+ if (foundSection) {
1222
+ foundSection === null || foundSection === void 0 ? void 0 : foundSection.data.push(_objectSpread$60(_objectSpread$60({}, child.props), {}, {
1223
+ _index: currentIndex
1224
+ }));
1225
+ } else {
1226
+ // create a new bucket
1227
+ sectionData.push({
1228
+ title: currentSection,
1229
+ hideDivider: hideDivider,
1230
+ data: [_objectSpread$60(_objectSpread$60({}, child.props), {}, {
1231
+ _index: currentIndex
1232
+ })]
1233
+ });
1234
+ }
1235
+
1236
+ var clonedChild = /*#__PURE__*/React__default.cloneElement(child, {
1237
+ // @ts-expect-error: TS doesn't understand the child's props
1238
+ _index: currentIndex
1239
+ });
1240
+ return clonedChild;
1241
+ }
1242
+
1243
+ return child;
1244
+ };
1245
+
1246
+ var isActionListItemPresentAfterSection; // eslint-disable-next-line one-var
1247
+
1248
+ var lastActionListSectionIndex;
1249
+
1250
+ if (isReactNative$4()) {
1251
+ // We're reading this so that we can decide whether to show the divider or not.
1252
+ // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider
1253
+ // On web, we do it using descendant styling
1254
+ var _getActionListSection = getActionListSectionPosition(children);
1255
+
1256
+ isActionListItemPresentAfterSection = _getActionListSection.isActionListItemPresentAfterSection;
1257
+ lastActionListSectionIndex = _getActionListSection.lastActionListSectionIndex;
1258
+ } // Looping through ActionListItems to add index to them and get an options array for moving focus between items
1259
+
1260
+
1261
+ var childrenWithId = React__default.Children.map(children, function (child, index) {
1262
+ if ( /*#__PURE__*/React__default.isValidElement(child)) {
1263
+ if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
1264
+ var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
1265
+ return /*#__PURE__*/React__default.cloneElement(child, {
1266
+ // @ts-expect-error: TS doesn't understand the child's props
1267
+ children: React__default.Children.map(child.props.children, function (childInSection) {
1268
+ currentSection = child.props.title;
1269
+
1270
+ if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
1271
+ return getActionListItemWithId(childInSection, shouldHideDivider);
1272
+ }
1273
+
1274
+ return childInSection;
1275
+ }),
1276
+ // On web, we handle it with descendant styling in css so no need of JS there
1277
+ _hideDivider: isReactNative$4() ? shouldHideDivider : undefined
1278
+ });
1279
+ }
1280
+
1281
+ if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
1282
+ return getActionListItemWithId(child, true);
1283
+ }
1284
+
1285
+ {
1286
+ throwBladeError({
1287
+ message: "Only ".concat(actionListAllowedChildren.join(', '), " supported inside ActionList"),
1288
+ moduleName: 'ActionList'
1289
+ });
1290
+ }
1291
+ }
1292
+
1293
+ return child;
1294
+ });
1295
+ return {
1296
+ sectionData: sectionData,
1297
+ childrenWithId: childrenWithId,
1298
+ actionListOptions: actionListOptions
1299
+ };
1300
+ };
1301
+
1302
+ var validateActionListItemProps = function validateActionListItemProps(_ref) {
1303
+ var leading = _ref.leading,
1304
+ trailing = _ref.trailing;
1305
+
1306
+ {
1307
+ React__default.Children.map(trailing, function (child) {
1308
+ if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText)) {
1309
+ throwBladeError({
1310
+ message: "Only ".concat(componentIds.ActionListItemIcon, " and ").concat(componentIds.ActionListItemText, " are allowed in trailing prop"),
1311
+ moduleName: 'ActionListItem'
1312
+ });
1313
+ }
1314
+ });
1315
+ React__default.Children.map(leading, function (child) {
1316
+ if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText) && !isValidAllowedChildren(child, componentIds.ActionListItemAsset)) {
1317
+ throwBladeError({
1318
+ message: "Only ".concat(componentIds.ActionListItemIcon, ", ").concat(componentIds.ActionListItemAsset, ", and ").concat(componentIds.ActionListItemText, " are allowed in leading prop"),
1319
+ moduleName: 'ActionListItem'
1320
+ });
1321
+ }
1322
+ });
1323
+ }
1324
+ };
1325
+
1326
+ var getNormalTextColor = function getNormalTextColor(isDisabled) {
1327
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1328
+ isMuted = _ref2.isMuted;
1329
+
1330
+ if (isDisabled) {
1331
+ return 'surface.text.placeholder.lowContrast';
1332
+ }
1333
+
1334
+ if (isMuted) {
1335
+ return 'surface.text.muted.lowContrast';
1336
+ }
1337
+
1338
+ return 'surface.text.normal.lowContrast';
1339
+ };
1340
+
1341
+ var breakpoints = {
1342
+ base: 0,
1343
+ xs: 320,
1344
+ s: 480,
1345
+ m: 768,
1346
+ l: 1024,
1347
+ xl: 1200
1348
+ };
1349
+
1350
+ var fontFamily = {
1351
+ text: 'Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
1352
+ code: 'monospace'
1353
+ };
1354
+
1355
+ function ownKeys$60(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1356
+
1357
+ function _objectSpread$5$(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$60(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$60(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1358
+ var fontWeight = {
1359
+ regular: 400,
1360
+ bold: 700
1361
+ };
1362
+ ({
1363
+ onDesktop: {
1364
+ fonts: {
1365
+ family: _objectSpread$5$({}, fontFamily),
1366
+ size: {
1367
+ 10: 9,
1368
+ 25: 10,
1369
+ 50: 11,
1370
+ 75: 12,
1371
+ 100: 14,
1372
+ 200: 16,
1373
+ 300: 18,
1374
+ 400: 20,
1375
+ 500: 22,
1376
+ 600: 24,
1377
+ 700: 28,
1378
+ 800: 32,
1379
+ 900: 36,
1380
+ 1000: 40
1381
+ },
1382
+ weight: _objectSpread$5$({}, fontWeight)
1383
+ },
1384
+ lineHeights: {
1385
+ 0: 0,
1386
+ 25: 14,
1387
+ 50: 16,
1388
+ 75: 18,
1389
+ 100: 20,
1390
+ 200: 24,
1391
+ 300: 24,
1392
+ 400: 28,
1393
+ 500: 32,
1394
+ 600: 40,
1395
+ 700: 40,
1396
+ 800: 48
1397
+ } // letterSpacings: {},
1398
+
1399
+ },
1400
+ onMobile: {
1401
+ fonts: {
1402
+ family: _objectSpread$5$({}, fontFamily),
1403
+ size: {
1404
+ 10: 9,
1405
+ 25: 10,
1406
+ 50: 11,
1407
+ 75: 12,
1408
+ 100: 14,
1409
+ 200: 16,
1410
+ 300: 16,
1411
+ 400: 18,
1412
+ 500: 20,
1413
+ 600: 20,
1414
+ 700: 24,
1415
+ 800: 28,
1416
+ 900: 32,
1417
+ 1000: 32
1418
+ },
1419
+ weight: _objectSpread$5$({}, fontWeight)
1420
+ },
1421
+ lineHeights: {
1422
+ 0: 0,
1423
+ 25: 14,
1424
+ 50: 16,
1425
+ 75: 18,
1426
+ 100: 20,
1427
+ 200: 20,
1428
+ 300: 24,
1429
+ 400: 24,
1430
+ 500: 28,
1431
+ 600: 32,
1432
+ 700: 40,
1433
+ 800: 40
1434
+ } // letterSpacings: {},
1435
+
1436
+ }
1437
+ });
1438
+
1439
+ /**
1440
+ * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
1441
+ *
1442
+ * {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
1443
+ */
1444
+ var spacing = {
1445
+ 0: 0,
1446
+ 1: 2,
1447
+ 2: 4,
1448
+ 3: 8,
1449
+ 4: 12,
1450
+ 5: 16,
1451
+ 6: 20,
1452
+ 7: 24,
1453
+ 8: 32,
1454
+ 9: 40,
1455
+ 10: 48,
1456
+ 11: 56
1457
+ };
1458
+
1459
+ /**
1460
+ * Size tokens are currently not exposed for users (therefore not available in theme)
1461
+ */
1462
+ var size = {
1463
+ /** 0 px */
1464
+ 0: 0,
1465
+
1466
+ /** 1 px */
1467
+ 1: 1,
1468
+
1469
+ /** 2 px */
1470
+ 2: 2,
1471
+
1472
+ /** 3 px */
1473
+ 3: 3,
1474
+
1475
+ /** 4 px */
1476
+ 4: 4,
1477
+
1478
+ /** 5 px */
1479
+ 5: 5,
1480
+
1481
+ /** 6 px */
1482
+ 6: 6,
1483
+
1484
+ /** 8 px */
1485
+ 8: 8,
1486
+
1487
+ /** 10 px */
1488
+ 10: 10,
1489
+
1490
+ /** 12 px */
1491
+ 12: 12,
1492
+
1493
+ /** 16 px */
1494
+ 16: 16,
1495
+
1496
+ /** 18 px */
1497
+ 18: 18,
1498
+
1499
+ /** 20 px */
1500
+ 20: 20,
1501
+
1502
+ /** 24 px */
1503
+ 24: 24,
1557
1504
 
1558
- var clonedChild = /*#__PURE__*/React__default.cloneElement(child, {
1559
- // @ts-expect-error: TS doesn't understand the child's props
1560
- _index: currentIndex
1561
- });
1562
- return clonedChild;
1563
- }
1505
+ /** 28 px */
1506
+ 28: 28,
1564
1507
 
1565
- return child;
1566
- };
1508
+ /** 32 px */
1509
+ 32: 32,
1567
1510
 
1568
- var isActionListItemPresentAfterSection; // eslint-disable-next-line one-var
1511
+ /** 36 px */
1512
+ 36: 36,
1569
1513
 
1570
- var lastActionListSectionIndex;
1514
+ /** 40 px */
1515
+ 40: 40,
1571
1516
 
1572
- if (isReactNative$4()) {
1573
- // We're reading this so that we can decide whether to show the divider or not.
1574
- // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider
1575
- // On web, we do it using descendant styling
1576
- var _getActionListSection = getActionListSectionPosition(children);
1517
+ /** 44 px */
1518
+ 44: 44,
1577
1519
 
1578
- isActionListItemPresentAfterSection = _getActionListSection.isActionListItemPresentAfterSection;
1579
- lastActionListSectionIndex = _getActionListSection.lastActionListSectionIndex;
1580
- } // Looping through ActionListItems to add index to them and get an options array for moving focus between items
1520
+ /** 48 px */
1521
+ 48: 48,
1581
1522
 
1523
+ /** 60 px */
1524
+ 56: 56,
1582
1525
 
1583
- var childrenWithId = React__default.Children.map(children, function (child, index) {
1584
- if ( /*#__PURE__*/React__default.isValidElement(child)) {
1585
- if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
1586
- var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
1587
- return /*#__PURE__*/React__default.cloneElement(child, {
1588
- // @ts-expect-error: TS doesn't understand the child's props
1589
- children: React__default.Children.map(child.props.children, function (childInSection) {
1590
- currentSection = child.props.title;
1526
+ /** 100 px */
1527
+ 100: 100,
1591
1528
 
1592
- if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
1593
- return getActionListItemWithId(childInSection, shouldHideDivider);
1594
- }
1529
+ /** 120 px */
1530
+ 120: 120,
1595
1531
 
1596
- return childInSection;
1597
- }),
1598
- // On web, we handle it with descendant styling in css so no need of JS there
1599
- _hideDivider: isReactNative$4() ? shouldHideDivider : undefined
1600
- });
1601
- }
1532
+ /** 140 px */
1533
+ 140: 140,
1602
1534
 
1603
- if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
1604
- return getActionListItemWithId(child, true);
1605
- }
1535
+ /** 160 px */
1536
+ 160: 160,
1606
1537
 
1607
- {
1608
- throwBladeError({
1609
- message: "Only ".concat(actionListAllowedChildren.join(', '), " supported inside ActionList"),
1610
- moduleName: 'ActionList'
1611
- });
1612
- }
1613
- }
1538
+ /** 200 px */
1539
+ 200: 200,
1614
1540
 
1615
- return child;
1616
- });
1617
- return {
1618
- sectionData: sectionData,
1619
- childrenWithId: childrenWithId,
1620
- actionListOptions: actionListOptions
1621
- };
1622
- };
1541
+ /** 300 px */
1542
+ 300: 300,
1623
1543
 
1624
- var validateActionListItemProps = function validateActionListItemProps(_ref) {
1625
- var leading = _ref.leading,
1626
- trailing = _ref.trailing;
1544
+ /** 360 px */
1545
+ 360: 360,
1627
1546
 
1628
- {
1629
- React__default.Children.map(trailing, function (child) {
1630
- if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText)) {
1631
- throwBladeError({
1632
- message: "Only ".concat(componentIds.ActionListItemIcon, " and ").concat(componentIds.ActionListItemText, " are allowed in trailing prop"),
1633
- moduleName: 'ActionListItem'
1634
- });
1635
- }
1636
- });
1637
- React__default.Children.map(leading, function (child) {
1638
- if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText) && !isValidAllowedChildren(child, componentIds.ActionListItemAsset)) {
1639
- throwBladeError({
1640
- message: "Only ".concat(componentIds.ActionListItemIcon, ", ").concat(componentIds.ActionListItemAsset, ", and ").concat(componentIds.ActionListItemText, " are allowed in leading prop"),
1641
- moduleName: 'ActionListItem'
1642
- });
1643
- }
1644
- });
1645
- }
1646
- };
1547
+ /** 400 px */
1548
+ 400: 400,
1647
1549
 
1648
- var getNormalTextColor = function getNormalTextColor(isDisabled) {
1649
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1650
- isMuted = _ref2.isMuted;
1550
+ /** 584 px */
1551
+ 584: 584,
1651
1552
 
1652
- if (isDisabled) {
1653
- return 'surface.text.placeholder.lowContrast';
1654
- }
1553
+ /** 640 px */
1554
+ 640: 640,
1655
1555
 
1656
- if (isMuted) {
1657
- return 'surface.text.muted.lowContrast';
1658
- }
1556
+ /** 760 px */
1557
+ 760: 760,
1659
1558
 
1660
- return 'surface.text.normal.lowContrast';
1559
+ /** 800 px */
1560
+ 800: 800,
1561
+
1562
+ /** 1024 px */
1563
+ 1024: 1024,
1564
+
1565
+ /** 1136 px */
1566
+ 1136: 1136
1661
1567
  };
1662
1568
 
1663
1569
  var getBaseListBoxWrapperStyles = function getBaseListBoxWrapperStyles(props) {
@@ -4503,9 +4409,9 @@ function _objectSpread$5Q(target) { for (var i = 1; i < arguments.length; i++) {
4503
4409
 
4504
4410
  var validateBackgroundString = function validateBackgroundString(stringBackgroundColorValue) {
4505
4411
  {
4506
- if (!stringBackgroundColorValue.startsWith('surface.background') && !stringBackgroundColorValue.startsWith('brand.')) {
4412
+ if (!stringBackgroundColorValue.startsWith('surface.background') && !stringBackgroundColorValue.startsWith('brand.') && stringBackgroundColorValue !== 'transparent') {
4507
4413
  throwBladeError({
4508
- message: "Oops! Currently you can only use `surface.background.*` and `brand.*` tokens with backgroundColor property but we received `".concat(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"),
4414
+ message: "Oops! Currently you can only use `transparent`, `surface.background.*`, and `brand.*` tokens with backgroundColor property but we received `".concat(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"),
4509
4415
  moduleName: 'Box'
4510
4416
  });
4511
4417
  }
@@ -19258,7 +19164,7 @@ var _Badge = function _Badge(_ref2) {
19258
19164
  }
19259
19165
  };
19260
19166
  return /*#__PURE__*/jsx(BaseBox, _objectSpread$12(_objectSpread$12(_objectSpread$12({
19261
- display: "flex"
19167
+ display: isReactNative$4() ? 'flex' : 'inline-flex'
19262
19168
  }, metaAttribute({
19263
19169
  name: MetaConstants.Badge,
19264
19170
  testID: testID
@@ -19272,7 +19178,7 @@ var _Badge = function _Badge(_ref2) {
19272
19178
  paddingLeft: horizontalPadding$1[size],
19273
19179
  paddingTop: verticalPadding$1[size],
19274
19180
  paddingBottom: verticalPadding$1[size],
19275
- display: isReactNative$4() ? 'flex' : 'inline-flex',
19181
+ display: "flex",
19276
19182
  flexDirection: "row",
19277
19183
  justifyContent: "center",
19278
19184
  alignItems: "center",
@@ -19712,7 +19618,7 @@ var Counter = function Counter(_ref2) {
19712
19618
  }
19713
19619
  };
19714
19620
  return /*#__PURE__*/jsx(BaseBox, _objectSpread$Z(_objectSpread$Z(_objectSpread$Z({
19715
- display: "flex"
19621
+ display: isReactNative$4() ? 'flex' : 'inline-flex'
19716
19622
  }, metaAttribute({
19717
19623
  name: MetaConstants.Counter,
19718
19624
  testID: testID
@@ -19726,7 +19632,7 @@ var Counter = function Counter(_ref2) {
19726
19632
  paddingLeft: horizontalPadding[size],
19727
19633
  paddingTop: verticalPadding[size],
19728
19634
  paddingBottom: verticalPadding[size],
19729
- display: isReactNative$4() ? 'flex' : 'inline-flex',
19635
+ display: "flex",
19730
19636
  flexDirection: "row",
19731
19637
  justifyContent: "center",
19732
19638
  alignItems: "center",
@@ -20697,15 +20603,119 @@ var AnimatedOverlay = /*#__PURE__*/styled(StyledDropdownOverlay).withConfig({
20697
20603
  })(function (props) {
20698
20604
  return css(["", " transform:translateY(", ");opacity:0;z-index:99;pointer-events:", ";"], props.transition, makeSize(props.theme.spacing[3]), props.isOpen ? 'all' : 'none');
20699
20605
  });
20606
+ /**
20607
+ * This function calculates the position of dropdown overlay with respect to dropdown trigger element.
20608
+ * For non-menus (e.g SelectInput), position is flipped if overflow is on bottom.
20609
+ * For menus (e.g. DropdownButton), position is flipped if overflow is on right or bottom.
20610
+ * Additional spacing is added to clientHeight to provide spacing above the dropdown trigger.
20611
+ */
20612
+
20613
+ var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
20614
+ var position = _ref.overflow,
20615
+ isMenu = _ref.isMenu,
20616
+ triggererEl = _ref.triggererEl,
20617
+ actionListItemEl = _ref.actionListItemEl;
20618
+ var zeroSpacing = 'spacing.0';
20619
+ var top = position.top,
20620
+ bottom = position.bottom,
20621
+ right = position.right;
20622
+ var newPosition = {
20623
+ left: zeroSpacing
20624
+ };
20625
+ /**
20626
+ * Calculating thresholds using the height & width of action list element with offset of 16px
20627
+ */
20628
+
20629
+ var WIDTH_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientWidth) + Number(size[16])) * -1;
20630
+ var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
20631
+
20632
+ if (!isMenu) {
20633
+ // In SelectInput, we set position wrt to right so that leftLabel position can be accomodated
20634
+ // without additional offset calculation from left
20635
+ newPosition.left = undefined;
20636
+ newPosition.right = zeroSpacing;
20637
+
20638
+ if (bottom > HEIGHT_THRESHOLD) {
20639
+ newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
20640
+ newPosition.top = undefined;
20641
+ }
20642
+
20643
+ if (top > HEIGHT_THRESHOLD) {
20644
+ newPosition.top = zeroSpacing;
20645
+ newPosition.bottom = undefined;
20646
+ }
20647
+
20648
+ return newPosition;
20649
+ }
20650
+
20651
+ if (right > WIDTH_THRESHOLD) {
20652
+ newPosition.right = zeroSpacing;
20653
+ newPosition.left = undefined;
20654
+ }
20655
+
20656
+ if (bottom > HEIGHT_THRESHOLD) {
20657
+ newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[20]), "px");
20658
+ newPosition.top = undefined;
20659
+ }
20660
+
20661
+ if (top > HEIGHT_THRESHOLD) {
20662
+ newPosition.top = zeroSpacing;
20663
+ newPosition.bottom = undefined;
20664
+ }
20665
+
20666
+ return newPosition;
20667
+ };
20668
+
20669
+ var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2) {
20670
+ var isMenu = _ref2.isMenu,
20671
+ triggererRef = _ref2.triggererRef,
20672
+ actionListItemRef = _ref2.actionListItemRef,
20673
+ setDropdownPosition = _ref2.setDropdownPosition;
20674
+ return {
20675
+ name: 'detectOverflowMiddleware',
20676
+ fn: function fn(state) {
20677
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20678
+ var overflow, position;
20679
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
20680
+ while (1) {
20681
+ switch (_context.prev = _context.next) {
20682
+ case 0:
20683
+ _context.next = 2;
20684
+ return detectOverflow(state, {
20685
+ elementContext: 'reference'
20686
+ });
20687
+
20688
+ case 2:
20689
+ overflow = _context.sent;
20690
+ position = getDropdownOverlayPosition({
20691
+ overflow: overflow,
20692
+ isMenu: isMenu,
20693
+ triggererEl: triggererRef.current,
20694
+ actionListItemEl: actionListItemRef.current
20695
+ });
20696
+ setDropdownPosition(position);
20697
+ return _context.abrupt("return", {});
20698
+
20699
+ case 6:
20700
+ case "end":
20701
+ return _context.stop();
20702
+ }
20703
+ }
20704
+ }, _callee);
20705
+ }))();
20706
+ }
20707
+ };
20708
+ };
20700
20709
  /**
20701
20710
  * Overlay of dropdown
20702
20711
  *
20703
20712
  * Wrap your ActionList within this component
20704
20713
  */
20705
20714
 
20706
- var _DropdownOverlay = function _DropdownOverlay(_ref) {
20707
- var children = _ref.children,
20708
- testID = _ref.testID;
20715
+
20716
+ var _DropdownOverlay = function _DropdownOverlay(_ref3) {
20717
+ var children = _ref3.children,
20718
+ testID = _ref3.testID;
20709
20719
 
20710
20720
  var _useDropdown = useDropdown(),
20711
20721
  isOpen = _useDropdown.isOpen,
@@ -23619,15 +23629,14 @@ var Indicator = function Indicator(_ref) {
23619
23629
  }
23620
23630
  }, [size$1]);
23621
23631
  var dimensions = getDimension();
23622
- var isReactNative = getPlatformType() === 'react-native';
23623
- var isWeb = !isReactNative;
23632
+ var isWeb = !isReactNative$4();
23624
23633
  var a11yProps = makeAccessible(_objectSpread$D({
23625
23634
  label: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : childrenString
23626
23635
  }, isWeb && {
23627
23636
  role: 'status'
23628
23637
  }));
23629
23638
  return /*#__PURE__*/jsx(BaseBox, _objectSpread$D(_objectSpread$D(_objectSpread$D(_objectSpread$D({
23630
- display: "flex"
23639
+ display: isWeb ? 'inline-flex' : 'flex'
23631
23640
  }, a11yProps), metaAttribute({
23632
23641
  name: MetaConstants.Indicator,
23633
23642
  testID: testID