@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.
- package/build/components/index.d.ts +13 -12
- package/build/components/index.development.web.js +464 -455
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +5 -4
- package/build/components/index.native.js +19 -20
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +457 -448
- 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/package.json +1 -1
|
@@ -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 '@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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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;
|
|
@@ -981,9 +659,9 @@ var useBottomSheetAndDropdownGlue = function useBottomSheetAndDropdownGlue() {
|
|
|
981
659
|
|
|
982
660
|
var _excluded$4Y = ["isOpen", "setIsOpen", "close", "selectedIndices", "setSelectedIndices", "activeIndex", "setActiveIndex", "shouldIgnoreBlur", "setShouldIgnoreBlur", "isKeydownPressed", "setIsKeydownPressed", "options", "selectionType", "changeCallbackTriggerer", "setChangeCallbackTriggerer", "isControlled", "setControlledValueIndices"];
|
|
983
661
|
|
|
984
|
-
function ownKeys$
|
|
662
|
+
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; }
|
|
985
663
|
|
|
986
|
-
function _objectSpread$
|
|
664
|
+
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; }
|
|
987
665
|
|
|
988
666
|
var noop$1 = function noop() {};
|
|
989
667
|
|
|
@@ -1279,7 +957,7 @@ var useDropdown = function useDropdown() {
|
|
|
1279
957
|
}
|
|
1280
958
|
};
|
|
1281
959
|
|
|
1282
|
-
return _objectSpread$
|
|
960
|
+
return _objectSpread$61({
|
|
1283
961
|
isOpen: isOpen,
|
|
1284
962
|
setIsOpen: setIsOpen,
|
|
1285
963
|
close: close,
|
|
@@ -1410,9 +1088,9 @@ var isValidAllowedChildren = function isValidAllowedChildren(component, id) {
|
|
|
1410
1088
|
return getComponentId(component) === id;
|
|
1411
1089
|
};
|
|
1412
1090
|
|
|
1413
|
-
function ownKeys$
|
|
1091
|
+
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; }
|
|
1414
1092
|
|
|
1415
|
-
function _objectSpread$
|
|
1093
|
+
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; }
|
|
1416
1094
|
/**
|
|
1417
1095
|
* Returns if there is ActionListItem after ActionListSection
|
|
1418
1096
|
* and an index of last ActionListSection
|
|
@@ -1451,121 +1129,349 @@ var getActionListProperties = function getActionListProperties(children) {
|
|
|
1451
1129
|
onClickTrigger: function onClickTrigger(value) {
|
|
1452
1130
|
var _child$props$onClick, _child$props, _child$props$isSelect;
|
|
1453
1131
|
|
|
1454
|
-
var anchorLink = child.props.href;
|
|
1455
|
-
(_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 ? void 0 : _child$props$onClick.call(_child$props, {
|
|
1456
|
-
name: child.props.value,
|
|
1457
|
-
value: (_child$props$isSelect = child.props.isSelected) !== null && _child$props$isSelect !== void 0 ? _child$props$isSelect : value
|
|
1458
|
-
});
|
|
1132
|
+
var anchorLink = child.props.href;
|
|
1133
|
+
(_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 ? void 0 : _child$props$onClick.call(_child$props, {
|
|
1134
|
+
name: child.props.value,
|
|
1135
|
+
value: (_child$props$isSelect = child.props.isSelected) !== null && _child$props$isSelect !== void 0 ? _child$props$isSelect : value
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
if (anchorLink && !isReactNative$4()) {
|
|
1139
|
+
var _child$props$target;
|
|
1140
|
+
|
|
1141
|
+
var target = (_child$props$target = child.props.target) !== null && _child$props$target !== void 0 ? _child$props$target : '_self';
|
|
1142
|
+
window.open(anchorLink, target);
|
|
1143
|
+
|
|
1144
|
+
if (window.top) {
|
|
1145
|
+
window.top.open(anchorLink, target);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
var currentIndex = actionListOptions.length - 1;
|
|
1151
|
+
var foundSection = sectionData.find(function (v) {
|
|
1152
|
+
return v.title === currentSection;
|
|
1153
|
+
}); // push the item in the appropriate bucket
|
|
1154
|
+
|
|
1155
|
+
if (foundSection) {
|
|
1156
|
+
foundSection === null || foundSection === void 0 ? void 0 : foundSection.data.push(_objectSpread$60(_objectSpread$60({}, child.props), {}, {
|
|
1157
|
+
_index: currentIndex
|
|
1158
|
+
}));
|
|
1159
|
+
} else {
|
|
1160
|
+
// create a new bucket
|
|
1161
|
+
sectionData.push({
|
|
1162
|
+
title: currentSection,
|
|
1163
|
+
hideDivider: hideDivider,
|
|
1164
|
+
data: [_objectSpread$60(_objectSpread$60({}, child.props), {}, {
|
|
1165
|
+
_index: currentIndex
|
|
1166
|
+
})]
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
var clonedChild = /*#__PURE__*/React__default.cloneElement(child, {
|
|
1171
|
+
// @ts-expect-error: TS doesn't understand the child's props
|
|
1172
|
+
_index: currentIndex
|
|
1173
|
+
});
|
|
1174
|
+
return clonedChild;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
return child;
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
var isActionListItemPresentAfterSection; // eslint-disable-next-line one-var
|
|
1181
|
+
|
|
1182
|
+
var lastActionListSectionIndex;
|
|
1183
|
+
|
|
1184
|
+
if (isReactNative$4()) {
|
|
1185
|
+
// We're reading this so that we can decide whether to show the divider or not.
|
|
1186
|
+
// If ActionListSection is final item and no ActionListItem is present after that, we hide the divider
|
|
1187
|
+
// On web, we do it using descendant styling
|
|
1188
|
+
var _getActionListSection = getActionListSectionPosition(children);
|
|
1189
|
+
|
|
1190
|
+
isActionListItemPresentAfterSection = _getActionListSection.isActionListItemPresentAfterSection;
|
|
1191
|
+
lastActionListSectionIndex = _getActionListSection.lastActionListSectionIndex;
|
|
1192
|
+
} // Looping through ActionListItems to add index to them and get an options array for moving focus between items
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
var childrenWithId = React__default.Children.map(children, function (child, index) {
|
|
1196
|
+
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
1197
|
+
if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
|
|
1198
|
+
var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
|
|
1199
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
1200
|
+
// @ts-expect-error: TS doesn't understand the child's props
|
|
1201
|
+
children: React__default.Children.map(child.props.children, function (childInSection) {
|
|
1202
|
+
currentSection = child.props.title;
|
|
1203
|
+
|
|
1204
|
+
if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {
|
|
1205
|
+
return getActionListItemWithId(childInSection, shouldHideDivider);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
return childInSection;
|
|
1209
|
+
}),
|
|
1210
|
+
// On web, we handle it with descendant styling in css so no need of JS there
|
|
1211
|
+
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
if (isValidAllowedChildren(child, componentIds.ActionListItem)) {
|
|
1216
|
+
return getActionListItemWithId(child, true);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
return child;
|
|
1221
|
+
});
|
|
1222
|
+
return {
|
|
1223
|
+
sectionData: sectionData,
|
|
1224
|
+
childrenWithId: childrenWithId,
|
|
1225
|
+
actionListOptions: actionListOptions
|
|
1226
|
+
};
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
var validateActionListItemProps = function validateActionListItemProps(_ref) {
|
|
1230
|
+
_ref.leading;
|
|
1231
|
+
_ref.trailing;
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
var getNormalTextColor = function getNormalTextColor(isDisabled) {
|
|
1235
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1236
|
+
isMuted = _ref2.isMuted;
|
|
1237
|
+
|
|
1238
|
+
if (isDisabled) {
|
|
1239
|
+
return 'surface.text.placeholder.lowContrast';
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
if (isMuted) {
|
|
1243
|
+
return 'surface.text.muted.lowContrast';
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
return 'surface.text.normal.lowContrast';
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
var breakpoints = {
|
|
1250
|
+
base: 0,
|
|
1251
|
+
xs: 320,
|
|
1252
|
+
s: 480,
|
|
1253
|
+
m: 768,
|
|
1254
|
+
l: 1024,
|
|
1255
|
+
xl: 1200
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
var fontFamily = {
|
|
1259
|
+
text: 'Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
1260
|
+
code: 'monospace'
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
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; }
|
|
1264
|
+
|
|
1265
|
+
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; }
|
|
1266
|
+
var fontWeight = {
|
|
1267
|
+
regular: 400,
|
|
1268
|
+
bold: 700
|
|
1269
|
+
};
|
|
1270
|
+
({
|
|
1271
|
+
onDesktop: {
|
|
1272
|
+
fonts: {
|
|
1273
|
+
family: _objectSpread$5$({}, fontFamily),
|
|
1274
|
+
size: {
|
|
1275
|
+
10: 9,
|
|
1276
|
+
25: 10,
|
|
1277
|
+
50: 11,
|
|
1278
|
+
75: 12,
|
|
1279
|
+
100: 14,
|
|
1280
|
+
200: 16,
|
|
1281
|
+
300: 18,
|
|
1282
|
+
400: 20,
|
|
1283
|
+
500: 22,
|
|
1284
|
+
600: 24,
|
|
1285
|
+
700: 28,
|
|
1286
|
+
800: 32,
|
|
1287
|
+
900: 36,
|
|
1288
|
+
1000: 40
|
|
1289
|
+
},
|
|
1290
|
+
weight: _objectSpread$5$({}, fontWeight)
|
|
1291
|
+
},
|
|
1292
|
+
lineHeights: {
|
|
1293
|
+
0: 0,
|
|
1294
|
+
25: 14,
|
|
1295
|
+
50: 16,
|
|
1296
|
+
75: 18,
|
|
1297
|
+
100: 20,
|
|
1298
|
+
200: 24,
|
|
1299
|
+
300: 24,
|
|
1300
|
+
400: 28,
|
|
1301
|
+
500: 32,
|
|
1302
|
+
600: 40,
|
|
1303
|
+
700: 40,
|
|
1304
|
+
800: 48
|
|
1305
|
+
} // letterSpacings: {},
|
|
1306
|
+
|
|
1307
|
+
},
|
|
1308
|
+
onMobile: {
|
|
1309
|
+
fonts: {
|
|
1310
|
+
family: _objectSpread$5$({}, fontFamily),
|
|
1311
|
+
size: {
|
|
1312
|
+
10: 9,
|
|
1313
|
+
25: 10,
|
|
1314
|
+
50: 11,
|
|
1315
|
+
75: 12,
|
|
1316
|
+
100: 14,
|
|
1317
|
+
200: 16,
|
|
1318
|
+
300: 16,
|
|
1319
|
+
400: 18,
|
|
1320
|
+
500: 20,
|
|
1321
|
+
600: 20,
|
|
1322
|
+
700: 24,
|
|
1323
|
+
800: 28,
|
|
1324
|
+
900: 32,
|
|
1325
|
+
1000: 32
|
|
1326
|
+
},
|
|
1327
|
+
weight: _objectSpread$5$({}, fontWeight)
|
|
1328
|
+
},
|
|
1329
|
+
lineHeights: {
|
|
1330
|
+
0: 0,
|
|
1331
|
+
25: 14,
|
|
1332
|
+
50: 16,
|
|
1333
|
+
75: 18,
|
|
1334
|
+
100: 20,
|
|
1335
|
+
200: 20,
|
|
1336
|
+
300: 24,
|
|
1337
|
+
400: 24,
|
|
1338
|
+
500: 28,
|
|
1339
|
+
600: 32,
|
|
1340
|
+
700: 40,
|
|
1341
|
+
800: 40
|
|
1342
|
+
} // letterSpacings: {},
|
|
1343
|
+
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
|
|
1349
|
+
*
|
|
1350
|
+
* {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
|
|
1351
|
+
*/
|
|
1352
|
+
var spacing = {
|
|
1353
|
+
0: 0,
|
|
1354
|
+
1: 2,
|
|
1355
|
+
2: 4,
|
|
1356
|
+
3: 8,
|
|
1357
|
+
4: 12,
|
|
1358
|
+
5: 16,
|
|
1359
|
+
6: 20,
|
|
1360
|
+
7: 24,
|
|
1361
|
+
8: 32,
|
|
1362
|
+
9: 40,
|
|
1363
|
+
10: 48,
|
|
1364
|
+
11: 56
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Size tokens are currently not exposed for users (therefore not available in theme)
|
|
1369
|
+
*/
|
|
1370
|
+
var size = {
|
|
1371
|
+
/** 0 px */
|
|
1372
|
+
0: 0,
|
|
1373
|
+
|
|
1374
|
+
/** 1 px */
|
|
1375
|
+
1: 1,
|
|
1376
|
+
|
|
1377
|
+
/** 2 px */
|
|
1378
|
+
2: 2,
|
|
1379
|
+
|
|
1380
|
+
/** 3 px */
|
|
1381
|
+
3: 3,
|
|
1382
|
+
|
|
1383
|
+
/** 4 px */
|
|
1384
|
+
4: 4,
|
|
1385
|
+
|
|
1386
|
+
/** 5 px */
|
|
1387
|
+
5: 5,
|
|
1388
|
+
|
|
1389
|
+
/** 6 px */
|
|
1390
|
+
6: 6,
|
|
1391
|
+
|
|
1392
|
+
/** 8 px */
|
|
1393
|
+
8: 8,
|
|
1394
|
+
|
|
1395
|
+
/** 10 px */
|
|
1396
|
+
10: 10,
|
|
1397
|
+
|
|
1398
|
+
/** 12 px */
|
|
1399
|
+
12: 12,
|
|
1400
|
+
|
|
1401
|
+
/** 16 px */
|
|
1402
|
+
16: 16,
|
|
1403
|
+
|
|
1404
|
+
/** 18 px */
|
|
1405
|
+
18: 18,
|
|
1459
1406
|
|
|
1460
|
-
|
|
1461
|
-
|
|
1407
|
+
/** 20 px */
|
|
1408
|
+
20: 20,
|
|
1462
1409
|
|
|
1463
|
-
|
|
1464
|
-
|
|
1410
|
+
/** 24 px */
|
|
1411
|
+
24: 24,
|
|
1465
1412
|
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
});
|
|
1472
|
-
var currentIndex = actionListOptions.length - 1;
|
|
1473
|
-
var foundSection = sectionData.find(function (v) {
|
|
1474
|
-
return v.title === currentSection;
|
|
1475
|
-
}); // push the item in the appropriate bucket
|
|
1413
|
+
/** 28 px */
|
|
1414
|
+
28: 28,
|
|
1476
1415
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
_index: currentIndex
|
|
1480
|
-
}));
|
|
1481
|
-
} else {
|
|
1482
|
-
// create a new bucket
|
|
1483
|
-
sectionData.push({
|
|
1484
|
-
title: currentSection,
|
|
1485
|
-
hideDivider: hideDivider,
|
|
1486
|
-
data: [_objectSpread$5$(_objectSpread$5$({}, child.props), {}, {
|
|
1487
|
-
_index: currentIndex
|
|
1488
|
-
})]
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1416
|
+
/** 32 px */
|
|
1417
|
+
32: 32,
|
|
1491
1418
|
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
_index: currentIndex
|
|
1495
|
-
});
|
|
1496
|
-
return clonedChild;
|
|
1497
|
-
}
|
|
1419
|
+
/** 36 px */
|
|
1420
|
+
36: 36,
|
|
1498
1421
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1422
|
+
/** 40 px */
|
|
1423
|
+
40: 40,
|
|
1501
1424
|
|
|
1502
|
-
|
|
1425
|
+
/** 44 px */
|
|
1426
|
+
44: 44,
|
|
1503
1427
|
|
|
1504
|
-
|
|
1428
|
+
/** 48 px */
|
|
1429
|
+
48: 48,
|
|
1505
1430
|
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
// If ActionListSection is final item and no ActionListItem is present after that, we hide the divider
|
|
1509
|
-
// On web, we do it using descendant styling
|
|
1510
|
-
var _getActionListSection = getActionListSectionPosition(children);
|
|
1431
|
+
/** 60 px */
|
|
1432
|
+
56: 56,
|
|
1511
1433
|
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
} // Looping through ActionListItems to add index to them and get an options array for moving focus between items
|
|
1434
|
+
/** 100 px */
|
|
1435
|
+
100: 100,
|
|
1515
1436
|
|
|
1437
|
+
/** 120 px */
|
|
1438
|
+
120: 120,
|
|
1516
1439
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
if (isValidAllowedChildren(child, componentIds.ActionListSection)) {
|
|
1520
|
-
var shouldHideDivider = index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;
|
|
1521
|
-
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
1522
|
-
// @ts-expect-error: TS doesn't understand the child's props
|
|
1523
|
-
children: React__default.Children.map(child.props.children, function (childInSection) {
|
|
1524
|
-
currentSection = child.props.title;
|
|
1440
|
+
/** 140 px */
|
|
1441
|
+
140: 140,
|
|
1525
1442
|
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1443
|
+
/** 160 px */
|
|
1444
|
+
160: 160,
|
|
1529
1445
|
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
// On web, we handle it with descendant styling in css so no need of JS there
|
|
1533
|
-
_hideDivider: isReactNative$4() ? shouldHideDivider : undefined
|
|
1534
|
-
});
|
|
1535
|
-
}
|
|
1446
|
+
/** 200 px */
|
|
1447
|
+
200: 200,
|
|
1536
1448
|
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1449
|
+
/** 300 px */
|
|
1450
|
+
300: 300,
|
|
1541
1451
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
return {
|
|
1545
|
-
sectionData: sectionData,
|
|
1546
|
-
childrenWithId: childrenWithId,
|
|
1547
|
-
actionListOptions: actionListOptions
|
|
1548
|
-
};
|
|
1549
|
-
};
|
|
1452
|
+
/** 360 px */
|
|
1453
|
+
360: 360,
|
|
1550
1454
|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
_ref.trailing;
|
|
1554
|
-
};
|
|
1455
|
+
/** 400 px */
|
|
1456
|
+
400: 400,
|
|
1555
1457
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
isMuted = _ref2.isMuted;
|
|
1458
|
+
/** 584 px */
|
|
1459
|
+
584: 584,
|
|
1559
1460
|
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
}
|
|
1461
|
+
/** 640 px */
|
|
1462
|
+
640: 640,
|
|
1563
1463
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1464
|
+
/** 760 px */
|
|
1465
|
+
760: 760,
|
|
1567
1466
|
|
|
1568
|
-
|
|
1467
|
+
/** 800 px */
|
|
1468
|
+
800: 800,
|
|
1469
|
+
|
|
1470
|
+
/** 1024 px */
|
|
1471
|
+
1024: 1024,
|
|
1472
|
+
|
|
1473
|
+
/** 1136 px */
|
|
1474
|
+
1136: 1136
|
|
1569
1475
|
};
|
|
1570
1476
|
|
|
1571
1477
|
var getBaseListBoxWrapperStyles = function getBaseListBoxWrapperStyles(props) {
|
|
@@ -18961,7 +18867,7 @@ var _Badge = function _Badge(_ref2) {
|
|
|
18961
18867
|
}
|
|
18962
18868
|
};
|
|
18963
18869
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread$12(_objectSpread$12(_objectSpread$12({
|
|
18964
|
-
display:
|
|
18870
|
+
display: isReactNative$4() ? 'flex' : 'inline-flex'
|
|
18965
18871
|
}, metaAttribute({
|
|
18966
18872
|
name: MetaConstants.Badge,
|
|
18967
18873
|
testID: testID
|
|
@@ -18975,7 +18881,7 @@ var _Badge = function _Badge(_ref2) {
|
|
|
18975
18881
|
paddingLeft: horizontalPadding$1[size],
|
|
18976
18882
|
paddingTop: verticalPadding$1[size],
|
|
18977
18883
|
paddingBottom: verticalPadding$1[size],
|
|
18978
|
-
display:
|
|
18884
|
+
display: "flex",
|
|
18979
18885
|
flexDirection: "row",
|
|
18980
18886
|
justifyContent: "center",
|
|
18981
18887
|
alignItems: "center",
|
|
@@ -19387,7 +19293,7 @@ var Counter = function Counter(_ref2) {
|
|
|
19387
19293
|
}
|
|
19388
19294
|
};
|
|
19389
19295
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread$Z(_objectSpread$Z(_objectSpread$Z({
|
|
19390
|
-
display:
|
|
19296
|
+
display: isReactNative$4() ? 'flex' : 'inline-flex'
|
|
19391
19297
|
}, metaAttribute({
|
|
19392
19298
|
name: MetaConstants.Counter,
|
|
19393
19299
|
testID: testID
|
|
@@ -19401,7 +19307,7 @@ var Counter = function Counter(_ref2) {
|
|
|
19401
19307
|
paddingLeft: horizontalPadding[size],
|
|
19402
19308
|
paddingTop: verticalPadding[size],
|
|
19403
19309
|
paddingBottom: verticalPadding[size],
|
|
19404
|
-
display:
|
|
19310
|
+
display: "flex",
|
|
19405
19311
|
flexDirection: "row",
|
|
19406
19312
|
justifyContent: "center",
|
|
19407
19313
|
alignItems: "center",
|
|
@@ -20327,15 +20233,119 @@ var AnimatedOverlay = /*#__PURE__*/styled(StyledDropdownOverlay).withConfig({
|
|
|
20327
20233
|
})(function (props) {
|
|
20328
20234
|
return css(["", " transform:translateY(", ");opacity:0;z-index:99;pointer-events:", ";"], props.transition, makeSize(props.theme.spacing[3]), props.isOpen ? 'all' : 'none');
|
|
20329
20235
|
});
|
|
20236
|
+
/**
|
|
20237
|
+
* This function calculates the position of dropdown overlay with respect to dropdown trigger element.
|
|
20238
|
+
* For non-menus (e.g SelectInput), position is flipped if overflow is on bottom.
|
|
20239
|
+
* For menus (e.g. DropdownButton), position is flipped if overflow is on right or bottom.
|
|
20240
|
+
* Additional spacing is added to clientHeight to provide spacing above the dropdown trigger.
|
|
20241
|
+
*/
|
|
20242
|
+
|
|
20243
|
+
var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
|
|
20244
|
+
var position = _ref.overflow,
|
|
20245
|
+
isMenu = _ref.isMenu,
|
|
20246
|
+
triggererEl = _ref.triggererEl,
|
|
20247
|
+
actionListItemEl = _ref.actionListItemEl;
|
|
20248
|
+
var zeroSpacing = 'spacing.0';
|
|
20249
|
+
var top = position.top,
|
|
20250
|
+
bottom = position.bottom,
|
|
20251
|
+
right = position.right;
|
|
20252
|
+
var newPosition = {
|
|
20253
|
+
left: zeroSpacing
|
|
20254
|
+
};
|
|
20255
|
+
/**
|
|
20256
|
+
* Calculating thresholds using the height & width of action list element with offset of 16px
|
|
20257
|
+
*/
|
|
20258
|
+
|
|
20259
|
+
var WIDTH_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientWidth) + Number(size[16])) * -1;
|
|
20260
|
+
var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
|
|
20261
|
+
|
|
20262
|
+
if (!isMenu) {
|
|
20263
|
+
// In SelectInput, we set position wrt to right so that leftLabel position can be accomodated
|
|
20264
|
+
// without additional offset calculation from left
|
|
20265
|
+
newPosition.left = undefined;
|
|
20266
|
+
newPosition.right = zeroSpacing;
|
|
20267
|
+
|
|
20268
|
+
if (bottom > HEIGHT_THRESHOLD) {
|
|
20269
|
+
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
|
|
20270
|
+
newPosition.top = undefined;
|
|
20271
|
+
}
|
|
20272
|
+
|
|
20273
|
+
if (top > HEIGHT_THRESHOLD) {
|
|
20274
|
+
newPosition.top = zeroSpacing;
|
|
20275
|
+
newPosition.bottom = undefined;
|
|
20276
|
+
}
|
|
20277
|
+
|
|
20278
|
+
return newPosition;
|
|
20279
|
+
}
|
|
20280
|
+
|
|
20281
|
+
if (right > WIDTH_THRESHOLD) {
|
|
20282
|
+
newPosition.right = zeroSpacing;
|
|
20283
|
+
newPosition.left = undefined;
|
|
20284
|
+
}
|
|
20285
|
+
|
|
20286
|
+
if (bottom > HEIGHT_THRESHOLD) {
|
|
20287
|
+
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[20]), "px");
|
|
20288
|
+
newPosition.top = undefined;
|
|
20289
|
+
}
|
|
20290
|
+
|
|
20291
|
+
if (top > HEIGHT_THRESHOLD) {
|
|
20292
|
+
newPosition.top = zeroSpacing;
|
|
20293
|
+
newPosition.bottom = undefined;
|
|
20294
|
+
}
|
|
20295
|
+
|
|
20296
|
+
return newPosition;
|
|
20297
|
+
};
|
|
20298
|
+
|
|
20299
|
+
var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2) {
|
|
20300
|
+
var isMenu = _ref2.isMenu,
|
|
20301
|
+
triggererRef = _ref2.triggererRef,
|
|
20302
|
+
actionListItemRef = _ref2.actionListItemRef,
|
|
20303
|
+
setDropdownPosition = _ref2.setDropdownPosition;
|
|
20304
|
+
return {
|
|
20305
|
+
name: 'detectOverflowMiddleware',
|
|
20306
|
+
fn: function fn(state) {
|
|
20307
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20308
|
+
var overflow, position;
|
|
20309
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20310
|
+
while (1) {
|
|
20311
|
+
switch (_context.prev = _context.next) {
|
|
20312
|
+
case 0:
|
|
20313
|
+
_context.next = 2;
|
|
20314
|
+
return detectOverflow(state, {
|
|
20315
|
+
elementContext: 'reference'
|
|
20316
|
+
});
|
|
20317
|
+
|
|
20318
|
+
case 2:
|
|
20319
|
+
overflow = _context.sent;
|
|
20320
|
+
position = getDropdownOverlayPosition({
|
|
20321
|
+
overflow: overflow,
|
|
20322
|
+
isMenu: isMenu,
|
|
20323
|
+
triggererEl: triggererRef.current,
|
|
20324
|
+
actionListItemEl: actionListItemRef.current
|
|
20325
|
+
});
|
|
20326
|
+
setDropdownPosition(position);
|
|
20327
|
+
return _context.abrupt("return", {});
|
|
20328
|
+
|
|
20329
|
+
case 6:
|
|
20330
|
+
case "end":
|
|
20331
|
+
return _context.stop();
|
|
20332
|
+
}
|
|
20333
|
+
}
|
|
20334
|
+
}, _callee);
|
|
20335
|
+
}))();
|
|
20336
|
+
}
|
|
20337
|
+
};
|
|
20338
|
+
};
|
|
20330
20339
|
/**
|
|
20331
20340
|
* Overlay of dropdown
|
|
20332
20341
|
*
|
|
20333
20342
|
* Wrap your ActionList within this component
|
|
20334
20343
|
*/
|
|
20335
20344
|
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20345
|
+
|
|
20346
|
+
var _DropdownOverlay = function _DropdownOverlay(_ref3) {
|
|
20347
|
+
var children = _ref3.children,
|
|
20348
|
+
testID = _ref3.testID;
|
|
20339
20349
|
|
|
20340
20350
|
var _useDropdown = useDropdown(),
|
|
20341
20351
|
isOpen = _useDropdown.isOpen,
|
|
@@ -23220,15 +23230,14 @@ var Indicator = function Indicator(_ref) {
|
|
|
23220
23230
|
}
|
|
23221
23231
|
}, [size$1]);
|
|
23222
23232
|
var dimensions = getDimension();
|
|
23223
|
-
var
|
|
23224
|
-
var isWeb = !isReactNative;
|
|
23233
|
+
var isWeb = !isReactNative$4();
|
|
23225
23234
|
var a11yProps = makeAccessible(_objectSpread$D({
|
|
23226
23235
|
label: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : childrenString
|
|
23227
23236
|
}, isWeb && {
|
|
23228
23237
|
role: 'status'
|
|
23229
23238
|
}));
|
|
23230
23239
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread$D(_objectSpread$D(_objectSpread$D(_objectSpread$D({
|
|
23231
|
-
display:
|
|
23240
|
+
display: isWeb ? 'inline-flex' : 'flex'
|
|
23232
23241
|
}, a11yProps), metaAttribute({
|
|
23233
23242
|
name: MetaConstants.Indicator,
|
|
23234
23243
|
testID: testID
|