@razorpay/blade 10.3.0 → 10.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/index.d.ts +8 -1
- package/build/components/index.development.web.js +90 -237
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +7 -0
- package/build/components/index.native.js +6 -6
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +91 -238
- 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/build/tokens/index.d.ts +2 -0
- package/build/tokens/index.development.web.js +2 -0
- package/build/tokens/index.development.web.js.map +1 -1
- package/build/tokens/index.native.d.ts +2 -0
- package/build/tokens/index.native.js +1 -1
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.production.web.js +2 -0
- package/build/tokens/index.production.web.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,11 @@ import _toConsumableArray$1 from '@babel/runtime/helpers/toConsumableArray';
|
|
|
5
5
|
import _objectWithoutProperties$1 from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
6
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
7
|
import styled, { ThemeProvider, css, keyframes } from 'styled-components';
|
|
8
|
-
import { FloatingDelayGroup, useFloating,
|
|
9
|
-
import
|
|
8
|
+
import { FloatingDelayGroup, useFloating, offset, flip, size as size$1, autoUpdate, useTransitionStyles, FloatingOverlay, FloatingPortal, FloatingFocusManager, shift, arrow, useDelayGroup, useDelayGroupContext, useHover, useFocus, useRole, useInteractions, FloatingArrow } from '@floating-ui/react';
|
|
9
|
+
import '@babel/runtime/helpers/typeof';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
12
12
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
13
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
14
13
|
|
|
15
14
|
/*
|
|
16
15
|
* This content is licensed according to the W3C Software License at
|
|
@@ -688,6 +687,9 @@ var DropdownContext = /*#__PURE__*/React__default.createContext({
|
|
|
688
687
|
},
|
|
689
688
|
triggererRef: {
|
|
690
689
|
current: null
|
|
690
|
+
},
|
|
691
|
+
triggererWrapperRef: {
|
|
692
|
+
current: null
|
|
691
693
|
}
|
|
692
694
|
});
|
|
693
695
|
var searchTimeout;
|
|
@@ -1278,27 +1280,6 @@ var fontWeight = {
|
|
|
1278
1280
|
}
|
|
1279
1281
|
});
|
|
1280
1282
|
|
|
1281
|
-
/**
|
|
1282
|
-
* When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
|
|
1283
|
-
*
|
|
1284
|
-
* {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
|
|
1285
|
-
*/
|
|
1286
|
-
|
|
1287
|
-
var spacing = {
|
|
1288
|
-
0: 0,
|
|
1289
|
-
1: 2,
|
|
1290
|
-
2: 4,
|
|
1291
|
-
3: 8,
|
|
1292
|
-
4: 12,
|
|
1293
|
-
5: 16,
|
|
1294
|
-
6: 20,
|
|
1295
|
-
7: 24,
|
|
1296
|
-
8: 32,
|
|
1297
|
-
9: 40,
|
|
1298
|
-
10: 48,
|
|
1299
|
-
11: 56
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
1283
|
/**
|
|
1303
1284
|
* Size tokens are currently not exposed for users (therefore not available in theme)
|
|
1304
1285
|
*/
|
|
@@ -1355,6 +1336,8 @@ var size = {
|
|
|
1355
1336
|
160: 160,
|
|
1356
1337
|
/** 200 px */
|
|
1357
1338
|
200: 200,
|
|
1339
|
+
/** 240 px */
|
|
1340
|
+
240: 240,
|
|
1358
1341
|
/** 300 px */
|
|
1359
1342
|
300: 300,
|
|
1360
1343
|
/** 360 px */
|
|
@@ -18971,6 +18954,11 @@ var _Dropdown = function _Dropdown(_ref) {
|
|
|
18971
18954
|
shouldIgnoreBlurAnimation = _React$useState14[0],
|
|
18972
18955
|
setShouldIgnoreBlurAnimation = _React$useState14[1];
|
|
18973
18956
|
var triggererRef = React__default.useRef(null);
|
|
18957
|
+
/**
|
|
18958
|
+
* In inputs, actual input is smaller than the visible input wrapper.
|
|
18959
|
+
* You can set this reference in such cases so floating ui calculations happen correctly
|
|
18960
|
+
* */
|
|
18961
|
+
var triggererWrapperRef = React__default.useRef(null);
|
|
18974
18962
|
var actionListItemRef = React__default.useRef(null);
|
|
18975
18963
|
var _React$useState15 = React__default.useState(false),
|
|
18976
18964
|
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
@@ -19046,6 +19034,7 @@ var _Dropdown = function _Dropdown(_ref) {
|
|
|
19046
19034
|
setIsKeydownPressed: setIsKeydownPressed,
|
|
19047
19035
|
dropdownBaseId: dropdownBaseId,
|
|
19048
19036
|
triggererRef: triggererRef,
|
|
19037
|
+
triggererWrapperRef: triggererWrapperRef,
|
|
19049
19038
|
actionListItemRef: actionListItemRef,
|
|
19050
19039
|
selectionType: selectionType,
|
|
19051
19040
|
hasFooterAction: hasFooterAction,
|
|
@@ -19110,157 +19099,75 @@ var StyledDropdownOverlay = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
19110
19099
|
|
|
19111
19100
|
function ownKeys$W(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; }
|
|
19112
19101
|
function _objectSpread$V(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$W(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$W(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19113
|
-
function _regeneratorRuntime() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
19114
|
-
var
|
|
19115
|
-
var
|
|
19116
|
-
var AnimatedOverlay = /*#__PURE__*/styled(StyledDropdownOverlay).withConfig({
|
|
19117
|
-
displayName: "DropdownOverlayweb__AnimatedOverlay",
|
|
19118
|
-
componentId: "sc-9pwxtx-0"
|
|
19119
|
-
})(function (props) {
|
|
19120
|
-
return css(["", " transform:translateY(", ");opacity:0;z-index:99;pointer-events:", ";"], props.transition, makeSize(props.theme.spacing[3]), props.isOpen ? 'all' : 'none');
|
|
19121
|
-
});
|
|
19122
|
-
|
|
19123
|
-
/**
|
|
19124
|
-
* This function calculates the position of dropdown overlay with respect to dropdown trigger element.
|
|
19125
|
-
* For non-menus (e.g SelectInput), position is flipped if overflow is on bottom.
|
|
19126
|
-
* For menus (e.g. DropdownButton), position is flipped if overflow is on right or bottom.
|
|
19127
|
-
* Additional spacing is added to clientHeight to provide spacing above the dropdown trigger.
|
|
19128
|
-
*/
|
|
19129
|
-
var getDropdownOverlayPosition = function getDropdownOverlayPosition(_ref) {
|
|
19130
|
-
var position = _ref.overflow,
|
|
19131
|
-
isMenu = _ref.isMenu,
|
|
19132
|
-
triggererEl = _ref.triggererEl,
|
|
19133
|
-
actionListItemEl = _ref.actionListItemEl;
|
|
19134
|
-
var zeroSpacing = 'spacing.0';
|
|
19135
|
-
var top = position.top,
|
|
19136
|
-
bottom = position.bottom,
|
|
19137
|
-
right = position.right;
|
|
19138
|
-
var newPosition = {
|
|
19139
|
-
left: zeroSpacing
|
|
19140
|
-
};
|
|
19141
|
-
|
|
19142
|
-
/**
|
|
19143
|
-
* Calculating thresholds using the height & width of action list element with offset of 16px
|
|
19144
|
-
*/
|
|
19145
|
-
var WIDTH_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientWidth) + Number(size[16])) * -1;
|
|
19146
|
-
var HEIGHT_THRESHOLD = (Number(actionListItemEl === null || actionListItemEl === void 0 ? void 0 : actionListItemEl.clientHeight) + Number(size[16])) * -1;
|
|
19147
|
-
if (!isMenu) {
|
|
19148
|
-
// In SelectInput, we set position wrt to right so that leftLabel position can be accomodated
|
|
19149
|
-
// without additional offset calculation from left
|
|
19150
|
-
newPosition.left = undefined;
|
|
19151
|
-
newPosition.right = zeroSpacing;
|
|
19152
|
-
if (bottom > HEIGHT_THRESHOLD) {
|
|
19153
|
-
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[32]), "px");
|
|
19154
|
-
newPosition.top = undefined;
|
|
19155
|
-
}
|
|
19156
|
-
if (top > HEIGHT_THRESHOLD) {
|
|
19157
|
-
newPosition.top = zeroSpacing;
|
|
19158
|
-
newPosition.bottom = undefined;
|
|
19159
|
-
}
|
|
19160
|
-
return newPosition;
|
|
19161
|
-
}
|
|
19162
|
-
if (right > WIDTH_THRESHOLD) {
|
|
19163
|
-
newPosition.right = zeroSpacing;
|
|
19164
|
-
newPosition.left = undefined;
|
|
19165
|
-
}
|
|
19166
|
-
if (bottom > HEIGHT_THRESHOLD) {
|
|
19167
|
-
newPosition.bottom = "".concat(Number(triggererEl === null || triggererEl === void 0 ? void 0 : triggererEl.clientHeight) + Number(size[20]), "px");
|
|
19168
|
-
newPosition.top = undefined;
|
|
19169
|
-
}
|
|
19170
|
-
if (top > HEIGHT_THRESHOLD) {
|
|
19171
|
-
newPosition.top = zeroSpacing;
|
|
19172
|
-
newPosition.bottom = undefined;
|
|
19173
|
-
}
|
|
19174
|
-
return newPosition;
|
|
19175
|
-
};
|
|
19176
|
-
var getDropdownOverflowMiddleware = function getDropdownOverflowMiddleware(_ref2) {
|
|
19177
|
-
var isMenu = _ref2.isMenu,
|
|
19178
|
-
triggererRef = _ref2.triggererRef,
|
|
19179
|
-
actionListItemRef = _ref2.actionListItemRef,
|
|
19180
|
-
setDropdownPosition = _ref2.setDropdownPosition;
|
|
19181
|
-
return {
|
|
19182
|
-
name: 'detectOverflowMiddleware',
|
|
19183
|
-
fn: function fn(state) {
|
|
19184
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
19185
|
-
var overflow, position;
|
|
19186
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19187
|
-
while (1) switch (_context.prev = _context.next) {
|
|
19188
|
-
case 0:
|
|
19189
|
-
_context.next = 2;
|
|
19190
|
-
return detectOverflow(state, {
|
|
19191
|
-
elementContext: 'reference'
|
|
19192
|
-
});
|
|
19193
|
-
case 2:
|
|
19194
|
-
overflow = _context.sent;
|
|
19195
|
-
position = getDropdownOverlayPosition({
|
|
19196
|
-
overflow: overflow,
|
|
19197
|
-
isMenu: isMenu,
|
|
19198
|
-
triggererEl: triggererRef.current,
|
|
19199
|
-
actionListItemEl: actionListItemRef.current
|
|
19200
|
-
});
|
|
19201
|
-
setDropdownPosition(position);
|
|
19202
|
-
return _context.abrupt("return", {});
|
|
19203
|
-
case 6:
|
|
19204
|
-
case "end":
|
|
19205
|
-
return _context.stop();
|
|
19206
|
-
}
|
|
19207
|
-
}, _callee);
|
|
19208
|
-
}))();
|
|
19209
|
-
}
|
|
19210
|
-
};
|
|
19211
|
-
};
|
|
19102
|
+
var OVERLAY_OFFSET = size['8'];
|
|
19103
|
+
var OVERLAY_PADDING = size['12']; // doesn't have to be exact. Just rough padding for floating ui to decide to show overlay on top or bottom
|
|
19104
|
+
var OVERLAY_ZINDEX = 1001;
|
|
19212
19105
|
|
|
19213
19106
|
/**
|
|
19214
19107
|
* Overlay of dropdown
|
|
19215
19108
|
*
|
|
19216
19109
|
* Wrap your ActionList within this component
|
|
19217
19110
|
*/
|
|
19218
|
-
var _DropdownOverlay = function _DropdownOverlay(
|
|
19219
|
-
var
|
|
19220
|
-
|
|
19111
|
+
var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
19112
|
+
var _triggererWrapperRef$;
|
|
19113
|
+
var children = _ref.children,
|
|
19114
|
+
testID = _ref.testID,
|
|
19115
|
+
_ref$zIndex = _ref.zIndex,
|
|
19116
|
+
zIndex = _ref$zIndex === void 0 ? OVERLAY_ZINDEX : _ref$zIndex;
|
|
19221
19117
|
var _useDropdown = useDropdown(),
|
|
19222
19118
|
isOpen = _useDropdown.isOpen,
|
|
19223
19119
|
triggererRef = _useDropdown.triggererRef,
|
|
19224
|
-
|
|
19120
|
+
triggererWrapperRef = _useDropdown.triggererWrapperRef,
|
|
19225
19121
|
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
19226
|
-
setIsOpen = _useDropdown.setIsOpen
|
|
19227
|
-
actionListItemRef = _useDropdown.actionListItemRef;
|
|
19122
|
+
setIsOpen = _useDropdown.setIsOpen;
|
|
19228
19123
|
var _useTheme = useTheme(),
|
|
19229
19124
|
theme = _useTheme.theme;
|
|
19230
19125
|
var bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();
|
|
19231
|
-
var _React$useState = React__default.useState(false),
|
|
19232
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19233
|
-
showFadeOutAnimation = _React$useState2[0],
|
|
19234
|
-
setShowFadeOutAnimation = _React$useState2[1];
|
|
19235
|
-
var _React$useState3 = React__default.useState('100%'),
|
|
19236
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
19237
|
-
width = _React$useState4[0],
|
|
19238
|
-
setWidth = _React$useState4[1];
|
|
19239
|
-
var _React$useState5 = React__default.useState({}),
|
|
19240
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
19241
|
-
dropdownPosition = _React$useState6[0],
|
|
19242
|
-
setDropdownPosition = _React$useState6[1];
|
|
19243
19126
|
var isMenu = dropdownTriggerer !== 'SelectInput';
|
|
19244
19127
|
var _useFloating = useFloating({
|
|
19245
19128
|
open: isOpen,
|
|
19246
19129
|
onOpenChange: setIsOpen,
|
|
19247
|
-
strategy: '
|
|
19130
|
+
strategy: 'fixed',
|
|
19248
19131
|
placement: 'bottom-start',
|
|
19249
19132
|
elements: {
|
|
19250
|
-
|
|
19133
|
+
// Input triggers have their ref on internal input element but we want width height of overall visible input hence wrapperRef is needed
|
|
19134
|
+
// We fallback to use `triggererRef` for triggers like button and link where wrapper is not needed
|
|
19135
|
+
// Checkout: https://github.com/razorpay/blade/pull/1559#discussion_r1305438920
|
|
19136
|
+
reference: (_triggererWrapperRef$ = triggererWrapperRef.current) !== null && _triggererWrapperRef$ !== void 0 ? _triggererWrapperRef$ : triggererRef.current
|
|
19251
19137
|
},
|
|
19252
|
-
middleware: [
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19138
|
+
middleware: [offset({
|
|
19139
|
+
mainAxis: OVERLAY_OFFSET
|
|
19140
|
+
}), flip({
|
|
19141
|
+
padding: OVERLAY_OFFSET + OVERLAY_PADDING
|
|
19142
|
+
}), size$1({
|
|
19143
|
+
apply: function apply(_ref2) {
|
|
19144
|
+
var rects = _ref2.rects,
|
|
19145
|
+
elements = _ref2.elements;
|
|
19146
|
+
Object.assign(elements.floating.style, {
|
|
19147
|
+
// in menu, we have flexible width between min and max
|
|
19148
|
+
// in input triggers, we just take width of trigger
|
|
19149
|
+
width: isMenu ? undefined : makeSize(rects.reference.width),
|
|
19150
|
+
minWidth: isMenu ? makeSize(size['240']) : undefined,
|
|
19151
|
+
maxWidth: isMenu ? makeSize(size['400']) : undefined
|
|
19152
|
+
});
|
|
19153
|
+
}
|
|
19257
19154
|
})],
|
|
19258
19155
|
whileElementsMounted: autoUpdate
|
|
19259
19156
|
}),
|
|
19260
|
-
refs = _useFloating.refs
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
var
|
|
19157
|
+
refs = _useFloating.refs,
|
|
19158
|
+
floatingStyles = _useFloating.floatingStyles,
|
|
19159
|
+
context = _useFloating.context;
|
|
19160
|
+
var _useTransitionStyles = useTransitionStyles(context, {
|
|
19161
|
+
duration: theme.motion.duration.quick,
|
|
19162
|
+
initial: function initial() {
|
|
19163
|
+
return {
|
|
19164
|
+
transform: "translateY(-".concat(makeSize(size['8']), ")"),
|
|
19165
|
+
opacity: 0
|
|
19166
|
+
};
|
|
19167
|
+
}
|
|
19168
|
+
}),
|
|
19169
|
+
isMounted = _useTransitionStyles.isMounted,
|
|
19170
|
+
styles = _useTransitionStyles.styles;
|
|
19264
19171
|
React__default.useEffect(function () {
|
|
19265
19172
|
if (isOpen) {
|
|
19266
19173
|
var _triggererRef$current;
|
|
@@ -19269,88 +19176,24 @@ var _DropdownOverlay = function _DropdownOverlay(_ref3) {
|
|
|
19269
19176
|
}
|
|
19270
19177
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19271
19178
|
}, [isOpen]);
|
|
19272
|
-
|
|
19273
|
-
//
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
// We don't have to worry about setting the custom width when label is on top since we can just 100% width of parent div
|
|
19291
|
-
setWidth('100%');
|
|
19292
|
-
window.removeEventListener('resize', setOverlayWidth);
|
|
19293
|
-
}
|
|
19294
|
-
}, 1000);
|
|
19295
|
-
setOverlayWidth();
|
|
19296
|
-
window.addEventListener('resize', setOverlayWidth);
|
|
19297
|
-
return function () {
|
|
19298
|
-
window.removeEventListener('resize', setOverlayWidth);
|
|
19299
|
-
};
|
|
19300
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19301
|
-
}, [setWidth, triggererRef, hasLabelOnLeft]);
|
|
19302
|
-
var onAnimationEnd = React__default.useCallback(function () {
|
|
19303
|
-
if (isOpen) {
|
|
19304
|
-
setShowFadeOutAnimation(true);
|
|
19305
|
-
} else {
|
|
19306
|
-
setShowFadeOutAnimation(false);
|
|
19307
|
-
}
|
|
19308
|
-
}, [isOpen]);
|
|
19309
|
-
var styles = React__default.useMemo(function () {
|
|
19310
|
-
return {
|
|
19311
|
-
opacity: isOpen ? 1 : 0
|
|
19312
|
-
};
|
|
19313
|
-
}, [isOpen]);
|
|
19314
|
-
return (
|
|
19315
|
-
/*#__PURE__*/
|
|
19316
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19317
|
-
jsxs(BaseBox, {
|
|
19318
|
-
position: "relative",
|
|
19319
|
-
ref: refs.setFloating,
|
|
19320
|
-
children: [isOpen ? /*#__PURE__*/jsx(BaseBox, {
|
|
19321
|
-
position: 'fixed',
|
|
19322
|
-
top: "spacing.0",
|
|
19323
|
-
left: "spacing.0",
|
|
19324
|
-
height: "100%",
|
|
19325
|
-
width: "100%",
|
|
19326
|
-
onClick: function onClick() {
|
|
19327
|
-
return setIsOpen(false);
|
|
19328
|
-
}
|
|
19329
|
-
}) : null, /*#__PURE__*/jsx(AnimatedOverlay, _objectSpread$V(_objectSpread$V({
|
|
19330
|
-
isInBottomSheet: bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.dropdownHasBottomSheet,
|
|
19331
|
-
width: isMenu ? 'max-content' : width
|
|
19332
|
-
// In SelectInput, Overlay should always take width of Input
|
|
19333
|
-
,
|
|
19334
|
-
minWidth: isMenu ? '240px' : undefined
|
|
19335
|
-
// in SelectInput, we don't want to set maxWidth because it takes width according to the trigger
|
|
19336
|
-
,
|
|
19337
|
-
maxWidth: isMenu ? '400px' : undefined,
|
|
19338
|
-
left: dropdownPosition.left,
|
|
19339
|
-
right: dropdownPosition.right,
|
|
19340
|
-
bottom: dropdownPosition.bottom,
|
|
19341
|
-
style: styles,
|
|
19342
|
-
isOpen: isOpen,
|
|
19343
|
-
position: "absolute",
|
|
19344
|
-
transition: isOpen ? fadeIn : showFadeOutAnimation ? fadeOut : noAnimation,
|
|
19345
|
-
onAnimationEnd: onAnimationEnd
|
|
19346
|
-
}, metaAttribute({
|
|
19347
|
-
name: MetaConstants.DropdownOverlay,
|
|
19348
|
-
testID: testID
|
|
19349
|
-
})), {}, {
|
|
19350
|
-
children: children
|
|
19351
|
-
}))]
|
|
19352
|
-
})
|
|
19353
|
-
);
|
|
19179
|
+
return /*#__PURE__*/jsx(BaseBox
|
|
19180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19181
|
+
, {
|
|
19182
|
+
ref: refs.setFloating,
|
|
19183
|
+
style: floatingStyles,
|
|
19184
|
+
zIndex: zIndex,
|
|
19185
|
+
display: isMounted ? 'flex' : 'none',
|
|
19186
|
+
children: /*#__PURE__*/jsx(StyledDropdownOverlay, _objectSpread$V(_objectSpread$V({
|
|
19187
|
+
isInBottomSheet: bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.dropdownHasBottomSheet,
|
|
19188
|
+
style: _objectSpread$V({}, styles),
|
|
19189
|
+
width: "100%"
|
|
19190
|
+
}, metaAttribute({
|
|
19191
|
+
name: MetaConstants.DropdownOverlay,
|
|
19192
|
+
testID: testID
|
|
19193
|
+
})), {}, {
|
|
19194
|
+
children: children
|
|
19195
|
+
}))
|
|
19196
|
+
});
|
|
19354
19197
|
};
|
|
19355
19198
|
var DropdownOverlay = /*#__PURE__*/assignWithoutSideEffects(_DropdownOverlay, {
|
|
19356
19199
|
componentId: componentIds$1.DropdownOverlay
|
|
@@ -20322,7 +20165,7 @@ var BaseInputAnimatedBorder = function BaseInputAnimatedBorder(_ref2) {
|
|
|
20322
20165
|
});
|
|
20323
20166
|
};
|
|
20324
20167
|
|
|
20325
|
-
var _excluded$k = ["children", "validationState", "currentInteraction", "isLabelLeftPositioned", "isTextArea"];
|
|
20168
|
+
var _excluded$k = ["children", "validationState", "currentInteraction", "isLabelLeftPositioned", "isTextArea", "setInputWrapperRef"];
|
|
20326
20169
|
function ownKeys$M(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; }
|
|
20327
20170
|
function _objectSpread$L(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$M(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$M(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20328
20171
|
var StyledBaseInputWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
@@ -20360,8 +20203,12 @@ var BaseInputWrapper = function BaseInputWrapper(_ref) {
|
|
|
20360
20203
|
currentInteraction = _ref.currentInteraction;
|
|
20361
20204
|
_ref.isLabelLeftPositioned;
|
|
20362
20205
|
var isTextArea = _ref.isTextArea,
|
|
20206
|
+
setInputWrapperRef = _ref.setInputWrapperRef,
|
|
20363
20207
|
props = _objectWithoutProperties$1(_ref, _excluded$k);
|
|
20364
|
-
return /*#__PURE__*/jsxs(StyledBaseInputWrapper
|
|
20208
|
+
return /*#__PURE__*/jsxs(StyledBaseInputWrapper
|
|
20209
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any
|
|
20210
|
+
, _objectSpread$L(_objectSpread$L({
|
|
20211
|
+
ref: setInputWrapperRef,
|
|
20365
20212
|
display: "flex",
|
|
20366
20213
|
flexDirection: "row",
|
|
20367
20214
|
width: "100%",
|
|
@@ -20377,7 +20224,7 @@ var BaseInputWrapper = function BaseInputWrapper(_ref) {
|
|
|
20377
20224
|
}));
|
|
20378
20225
|
};
|
|
20379
20226
|
|
|
20380
|
-
var _excluded$j = ["as", "label", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "onFocus", "onChange", "onInput", "onBlur", "onSubmit", "onClick", "onKeyDown", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "leadingIcon", "prefix", "interactionElement", "suffix", "trailingIcon", "maxCharacters", "textAlign", "autoFocus", "keyboardReturnKeyType", "keyboardType", "autoCompleteSuggestionType", "trailingHeaderSlot", "trailingFooterSlot", "numberOfLines", "id", "componentName", "accessibilityLabel", "labelId", "activeDescendant", "hideLabelText", "hideFormHint", "hasPopup", "popupId", "isPopupExpanded", "shouldIgnoreBlurAnimation", "autoCapitalize", "testID"];
|
|
20227
|
+
var _excluded$j = ["as", "label", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "onFocus", "onChange", "onInput", "onBlur", "onSubmit", "onClick", "onKeyDown", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "leadingIcon", "prefix", "interactionElement", "suffix", "trailingIcon", "maxCharacters", "textAlign", "autoFocus", "keyboardReturnKeyType", "keyboardType", "autoCompleteSuggestionType", "trailingHeaderSlot", "trailingFooterSlot", "numberOfLines", "id", "componentName", "accessibilityLabel", "labelId", "activeDescendant", "hideLabelText", "hideFormHint", "hasPopup", "popupId", "isPopupExpanded", "shouldIgnoreBlurAnimation", "autoCapitalize", "setInputWrapperRef", "testID"];
|
|
20381
20228
|
function ownKeys$L(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; }
|
|
20382
20229
|
function _objectSpread$K(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$L(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$L(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20383
20230
|
var useInput = function useInput(_ref) {
|
|
@@ -20603,6 +20450,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
20603
20450
|
isPopupExpanded = _ref11.isPopupExpanded,
|
|
20604
20451
|
shouldIgnoreBlurAnimation = _ref11.shouldIgnoreBlurAnimation,
|
|
20605
20452
|
autoCapitalize = _ref11.autoCapitalize,
|
|
20453
|
+
setInputWrapperRef = _ref11.setInputWrapperRef,
|
|
20606
20454
|
testID = _ref11.testID,
|
|
20607
20455
|
styledProps = _objectWithoutProperties$1(_ref11, _excluded$j);
|
|
20608
20456
|
var _useTheme = useTheme(),
|
|
@@ -20695,6 +20543,7 @@ var BaseInput = /*#__PURE__*/React__default.forwardRef(function (_ref11, ref) {
|
|
|
20695
20543
|
validationState: validationState,
|
|
20696
20544
|
currentInteraction: currentInteraction,
|
|
20697
20545
|
isLabelLeftPositioned: isLabelLeftPositioned,
|
|
20546
|
+
setInputWrapperRef: setInputWrapperRef,
|
|
20698
20547
|
children: [/*#__PURE__*/jsx(BaseInputVisuals, {
|
|
20699
20548
|
leadingIcon: leadingIcon,
|
|
20700
20549
|
prefix: prefix,
|
|
@@ -21648,7 +21497,8 @@ var _SelectInput = function _SelectInput(props, ref) {
|
|
|
21648
21497
|
isControlled = _useDropdown.isControlled,
|
|
21649
21498
|
setIsControlled = _useDropdown.setIsControlled,
|
|
21650
21499
|
selectionType = _useDropdown.selectionType,
|
|
21651
|
-
selectedIndices = _useDropdown.selectedIndices
|
|
21500
|
+
selectedIndices = _useDropdown.selectedIndices,
|
|
21501
|
+
triggererWrapperRef = _useDropdown.triggererWrapperRef;
|
|
21652
21502
|
var icon = props.icon;
|
|
21653
21503
|
props.onChange;
|
|
21654
21504
|
props.defaultValue;
|
|
@@ -21762,6 +21612,9 @@ var _SelectInput = function _SelectInput(props, ref) {
|
|
|
21762
21612
|
hideLabelText: ((_props$label = props.label) === null || _props$label === void 0 ? void 0 : _props$label.length) === 0,
|
|
21763
21613
|
componentName: MetaConstants.SelectInput,
|
|
21764
21614
|
ref: !isReactNative$4() ? triggererRef : null,
|
|
21615
|
+
setInputWrapperRef: function setInputWrapperRef(wrapperNode) {
|
|
21616
|
+
triggererWrapperRef.current = wrapperNode;
|
|
21617
|
+
},
|
|
21765
21618
|
textAlign: "left",
|
|
21766
21619
|
value: displayValue,
|
|
21767
21620
|
placeholder: placeholder,
|