@moda/om 17.14.2 → 18.0.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/CHANGELOG.md +12 -0
- package/dist/index.cjs.js +95 -135
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +95 -135
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/AspectRatioBox/AspectRatioBox.d.ts +1 -1
- package/dist/src/components/Badge/Badge.d.ts +2 -2
- package/dist/src/components/Breadcrumbs/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/src/components/Breakpoint/Breakpoint.d.ts +4 -4
- package/dist/src/components/Breakpoint/BreakpointProvider.d.ts +1 -1
- package/dist/src/components/Breakpoint/generateMediaQuery.d.ts +2 -2
- package/dist/src/components/Button/Button.d.ts +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/src/components/Clickable/Clickable.d.ts +3 -3
- package/dist/src/components/ColorSwatch/ColorSwatch.d.ts +2 -2
- package/dist/src/components/ColorSwatch/skuColors.d.ts +1 -1
- package/dist/src/components/Constrain/Constrain.d.ts +1 -1
- package/dist/src/components/Constrain/ExceedConstrain.d.ts +1 -1
- package/dist/src/components/ControlLink/ControlLink.d.ts +1 -1
- package/dist/src/components/CreditCardNumberInput/CreditCardNumberInput.d.ts +1 -1
- package/dist/src/components/CreditCardNumberInput/CreditCardNumberInputField.d.ts +1 -1
- package/dist/src/components/DefinitionList/DefinitionList.d.ts +1 -1
- package/dist/src/components/Divider/Divider.d.ts +1 -1
- package/dist/src/components/Expandable/Expandable.d.ts +1 -1
- package/dist/src/components/Field/Field.d.ts +1 -1
- package/dist/src/components/Label/Label.d.ts +1 -1
- package/dist/src/components/Loading/Loading.d.ts +1 -1
- package/dist/src/components/Modal/Modal.d.ts +1 -1
- package/dist/src/components/ModalOverlay/ModalOverlay.d.ts +1 -1
- package/dist/src/components/Overlay/Overlay.d.ts +1 -1
- package/dist/src/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/src/components/Popover/Popover.d.ts +1 -1
- package/dist/src/components/PromoBanner/PromoBanner.d.ts +1 -1
- package/dist/src/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/src/components/SearchInput/SearchInput.d.ts +1 -2
- package/dist/src/components/Select/MultiSelect.d.ts +1 -1
- package/dist/src/components/Select/Select.d.ts +2 -2
- package/dist/src/components/Select/SelectLabel.d.ts +1 -1
- package/dist/src/components/Select/SelectOption.d.ts +1 -1
- package/dist/src/components/Select/SelectOptions.d.ts +1 -1
- package/dist/src/components/Select/useSelect.d.ts +1 -1
- package/dist/src/components/SelectableButton/SelectableButton.d.ts +1 -1
- package/dist/src/components/Shape/Shape.d.ts +1 -1
- package/dist/src/components/SlidingPane/SlidingPane.d.ts +1 -1
- package/dist/src/components/Stack/Stack.d.ts +1 -1
- package/dist/src/components/Tabs/Tab.d.ts +2 -2
- package/dist/src/components/Tabs/TabList.d.ts +1 -1
- package/dist/src/components/Tabs/TabPanel.d.ts +1 -1
- package/dist/src/components/Tabs/TabPanels.d.ts +1 -1
- package/dist/src/components/Tabs/Tabs.d.ts +1 -1
- package/dist/src/components/Tag/Tag.d.ts +1 -1
- package/dist/src/components/Text/Text.d.ts +4 -4
- package/dist/src/components/TextInput/TextInput.d.ts +2 -2
- package/dist/src/components/Textarea/Textarea.d.ts +1 -1
- package/dist/src/components/Toast/Toast.d.ts +1 -1
- package/dist/src/components/VerticalDivider/VerticalDivider.d.ts +1 -1
- package/dist/src/hooks/useBreakpoint.d.ts +3 -3
- package/dist/src/hooks/useKeyboardListNavigation.d.ts +3 -3
- package/dist/src/utilities/States/isRenderProps.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/SearchInput/SearchInput.stories.tsx +2 -6
- package/src/components/SearchInput/SearchInput.test.tsx +14 -0
- package/src/components/SearchInput/SearchInput.tsx +6 -13
package/dist/index.esm.js
CHANGED
|
@@ -997,6 +997,33 @@ function hexDouble(num) {
|
|
|
997
997
|
__exportStar(helpers, exports);
|
|
998
998
|
})(dist$4);
|
|
999
999
|
|
|
1000
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1001
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1002
|
+
if (null != _i) {
|
|
1003
|
+
var _s,
|
|
1004
|
+
_e,
|
|
1005
|
+
_x,
|
|
1006
|
+
_r,
|
|
1007
|
+
_arr = [],
|
|
1008
|
+
_n = !0,
|
|
1009
|
+
_d = !1;
|
|
1010
|
+
try {
|
|
1011
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
1012
|
+
if (Object(_i) !== _i) return;
|
|
1013
|
+
_n = !1;
|
|
1014
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
1015
|
+
} catch (err) {
|
|
1016
|
+
_d = !0, _e = err;
|
|
1017
|
+
} finally {
|
|
1018
|
+
try {
|
|
1019
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
1020
|
+
} finally {
|
|
1021
|
+
if (_d) throw _e;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return _arr;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1000
1027
|
function ownKeys(object, enumerableOnly) {
|
|
1001
1028
|
var keys = Object.keys(object);
|
|
1002
1029
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1028,6 +1055,7 @@ function _typeof(obj) {
|
|
|
1028
1055
|
}, _typeof(obj);
|
|
1029
1056
|
}
|
|
1030
1057
|
function _defineProperty$1(obj, key, value) {
|
|
1058
|
+
key = _toPropertyKey(key);
|
|
1031
1059
|
if (key in obj) {
|
|
1032
1060
|
Object.defineProperty(obj, key, {
|
|
1033
1061
|
value: value,
|
|
@@ -1099,30 +1127,6 @@ function _arrayWithHoles(arr) {
|
|
|
1099
1127
|
function _iterableToArray(iter) {
|
|
1100
1128
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1101
1129
|
}
|
|
1102
|
-
function _iterableToArrayLimit(arr, i) {
|
|
1103
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1104
|
-
if (_i == null) return;
|
|
1105
|
-
var _arr = [];
|
|
1106
|
-
var _n = true;
|
|
1107
|
-
var _d = false;
|
|
1108
|
-
var _s, _e;
|
|
1109
|
-
try {
|
|
1110
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
1111
|
-
_arr.push(_s.value);
|
|
1112
|
-
if (i && _arr.length === i) break;
|
|
1113
|
-
}
|
|
1114
|
-
} catch (err) {
|
|
1115
|
-
_d = true;
|
|
1116
|
-
_e = err;
|
|
1117
|
-
} finally {
|
|
1118
|
-
try {
|
|
1119
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1120
|
-
} finally {
|
|
1121
|
-
if (_d) throw _e;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
return _arr;
|
|
1125
|
-
}
|
|
1126
1130
|
function _unsupportedIterableToArray(o, minLen) {
|
|
1127
1131
|
if (!o) return;
|
|
1128
1132
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -1142,6 +1146,20 @@ function _nonIterableSpread() {
|
|
|
1142
1146
|
function _nonIterableRest() {
|
|
1143
1147
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1144
1148
|
}
|
|
1149
|
+
function _toPrimitive(input, hint) {
|
|
1150
|
+
if (typeof input !== "object" || input === null) return input;
|
|
1151
|
+
var prim = input[Symbol.toPrimitive];
|
|
1152
|
+
if (prim !== undefined) {
|
|
1153
|
+
var res = prim.call(input, hint || "default");
|
|
1154
|
+
if (typeof res !== "object") return res;
|
|
1155
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1156
|
+
}
|
|
1157
|
+
return (hint === "string" ? String : Number)(input);
|
|
1158
|
+
}
|
|
1159
|
+
function _toPropertyKey(arg) {
|
|
1160
|
+
var key = _toPrimitive(arg, "string");
|
|
1161
|
+
return typeof key === "symbol" ? key : String(key);
|
|
1162
|
+
}
|
|
1145
1163
|
|
|
1146
1164
|
var isRenderProps = function isRenderProps(children) {
|
|
1147
1165
|
return typeof children === 'function';
|
|
@@ -3354,9 +3372,16 @@ var parentAutofocusables = function parentAutofocusables(topNode, visibilityCach
|
|
|
3354
3372
|
* Determines if element is contained in scope, including nested shadow DOMs
|
|
3355
3373
|
*/
|
|
3356
3374
|
var contains$1 = function contains(scope, element) {
|
|
3357
|
-
|
|
3358
|
-
return contains(
|
|
3359
|
-
}
|
|
3375
|
+
if (scope.shadowRoot) {
|
|
3376
|
+
return contains(scope.shadowRoot, element);
|
|
3377
|
+
} else {
|
|
3378
|
+
if (Object.getPrototypeOf(scope).contains !== undefined && Object.getPrototypeOf(scope).contains.call(scope, element)) {
|
|
3379
|
+
return true;
|
|
3380
|
+
}
|
|
3381
|
+
return toArray(scope.children).some(function (child) {
|
|
3382
|
+
return contains(child, element);
|
|
3383
|
+
});
|
|
3384
|
+
}
|
|
3360
3385
|
};
|
|
3361
3386
|
|
|
3362
3387
|
/**
|
|
@@ -3566,6 +3591,32 @@ var newFocus = function newFocus(innerNodes, outerNodes, activeElement, lastNode
|
|
|
3566
3591
|
return undefined;
|
|
3567
3592
|
};
|
|
3568
3593
|
|
|
3594
|
+
var findAutoFocused = function findAutoFocused(autoFocusables) {
|
|
3595
|
+
return function (node) {
|
|
3596
|
+
var _a;
|
|
3597
|
+
var autofocus = (_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.autofocus;
|
|
3598
|
+
return (
|
|
3599
|
+
// @ts-expect-error
|
|
3600
|
+
node.autofocus ||
|
|
3601
|
+
//
|
|
3602
|
+
autofocus !== undefined && autofocus !== 'false' ||
|
|
3603
|
+
//
|
|
3604
|
+
autoFocusables.indexOf(node) >= 0
|
|
3605
|
+
);
|
|
3606
|
+
};
|
|
3607
|
+
};
|
|
3608
|
+
var pickAutofocus = function pickAutofocus(nodesIndexes, orderedNodes, groups) {
|
|
3609
|
+
var nodes = nodesIndexes.map(function (_a) {
|
|
3610
|
+
var node = _a.node;
|
|
3611
|
+
return node;
|
|
3612
|
+
});
|
|
3613
|
+
var autoFocusable = filterAutoFocusable(nodes.filter(findAutoFocused(groups)));
|
|
3614
|
+
if (autoFocusable && autoFocusable.length) {
|
|
3615
|
+
return pickFirstFocus(autoFocusable);
|
|
3616
|
+
}
|
|
3617
|
+
return pickFirstFocus(filterAutoFocusable(orderedNodes));
|
|
3618
|
+
};
|
|
3619
|
+
|
|
3569
3620
|
var getParents = function getParents(node, parents) {
|
|
3570
3621
|
if (parents === void 0) {
|
|
3571
3622
|
parents = [];
|
|
@@ -3626,13 +3677,6 @@ var allParentAutofocusables = function allParentAutofocusables(entries, visibili
|
|
|
3626
3677
|
}, []);
|
|
3627
3678
|
};
|
|
3628
3679
|
|
|
3629
|
-
var findAutoFocused = function findAutoFocused(autoFocusables) {
|
|
3630
|
-
return function (node) {
|
|
3631
|
-
var _a;
|
|
3632
|
-
// @ts-expect-error
|
|
3633
|
-
return node.autofocus || !!((_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.autofocus) || autoFocusables.indexOf(node) >= 0;
|
|
3634
|
-
};
|
|
3635
|
-
};
|
|
3636
3680
|
var reorderNodes = function reorderNodes(srcNodes, dstNodes) {
|
|
3637
3681
|
var remap = new Map();
|
|
3638
3682
|
// no Set(dstNodes) for IE11 :(
|
|
@@ -3676,12 +3720,8 @@ var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
|
3676
3720
|
});
|
|
3677
3721
|
var newId = newFocus(innerNodes, outerNodes, activeElement, lastNode);
|
|
3678
3722
|
if (newId === NEW_FOCUS) {
|
|
3679
|
-
var autoFocusable = filterAutoFocusable(anyFocusable.map(function (_a) {
|
|
3680
|
-
var node = _a.node;
|
|
3681
|
-
return node;
|
|
3682
|
-
})).filter(findAutoFocused(allParentAutofocusables(entries, visibilityCache)));
|
|
3683
3723
|
return {
|
|
3684
|
-
node:
|
|
3724
|
+
node: pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache))
|
|
3685
3725
|
};
|
|
3686
3726
|
}
|
|
3687
3727
|
if (newId === undefined) {
|
|
@@ -4089,11 +4129,6 @@ var parse = function parse(x) {
|
|
|
4089
4129
|
};
|
|
4090
4130
|
var getOffset = function getOffset(gapMode) {
|
|
4091
4131
|
var cs = window.getComputedStyle(document.body);
|
|
4092
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4093
|
-
if (cs.overflowY === 'hidden') {
|
|
4094
|
-
console.error('react-remove-scroll-bar: cannot calculate scrollbar size because it is removed (overflow:hidden on body');
|
|
4095
|
-
}
|
|
4096
|
-
}
|
|
4097
4132
|
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
4098
4133
|
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
4099
4134
|
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
@@ -4139,6 +4174,11 @@ var RemoveScrollBar = function RemoveScrollBar(props) {
|
|
|
4139
4174
|
noImportant = props.noImportant,
|
|
4140
4175
|
_a = props.gapMode,
|
|
4141
4176
|
gapMode = _a === void 0 ? 'margin' : _a;
|
|
4177
|
+
/*
|
|
4178
|
+
gap will be measured on every component mount
|
|
4179
|
+
however it will be used only by the "first" invocation
|
|
4180
|
+
due to singleton nature of <Style
|
|
4181
|
+
*/
|
|
4142
4182
|
var gap = React.useMemo(function () {
|
|
4143
4183
|
return getGapWidth(gapMode);
|
|
4144
4184
|
}, [gapMode]);
|
|
@@ -9257,12 +9297,11 @@ var Search20 = function Search20(_a) {
|
|
|
9257
9297
|
};
|
|
9258
9298
|
Search20.displayName = 'Search20';
|
|
9259
9299
|
|
|
9260
|
-
var _excluded$o = ["className", "onChange", "
|
|
9300
|
+
var _excluded$o = ["className", "onChange", "onClear", "value"];
|
|
9261
9301
|
var DEFAULT_INPUT_VALUE = '';
|
|
9262
9302
|
var SearchInput = function SearchInput(_ref) {
|
|
9263
9303
|
var className = _ref.className,
|
|
9264
9304
|
onChange = _ref.onChange,
|
|
9265
|
-
onChangeValue = _ref.onChangeValue,
|
|
9266
9305
|
onClear = _ref.onClear,
|
|
9267
9306
|
_ref$value = _ref.value,
|
|
9268
9307
|
value = _ref$value === void 0 ? DEFAULT_INPUT_VALUE : _ref$value,
|
|
@@ -9272,13 +9311,13 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9272
9311
|
_useState2 = _slicedToArray(_useState, 2),
|
|
9273
9312
|
controlledValue = _useState2[0],
|
|
9274
9313
|
setValue = _useState2[1];
|
|
9275
|
-
var
|
|
9314
|
+
var handleClear = useCallback(function () {
|
|
9315
|
+
var _ref$current;
|
|
9276
9316
|
setValue(DEFAULT_INPUT_VALUE);
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
}, [onClear]);
|
|
9317
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(DEFAULT_INPUT_VALUE);
|
|
9318
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
9319
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
9320
|
+
}, [onClear, onChange]);
|
|
9282
9321
|
var handleChange = useCallback(function (value) {
|
|
9283
9322
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
9284
9323
|
setValue(value);
|
|
@@ -9286,9 +9325,6 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9286
9325
|
useEffect(function () {
|
|
9287
9326
|
return setValue(value);
|
|
9288
9327
|
}, [value]);
|
|
9289
|
-
useEffect(function () {
|
|
9290
|
-
onChangeValue && onChangeValue(controlledValue);
|
|
9291
|
-
}, [controlledValue, onChangeValue]);
|
|
9292
9328
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
9293
9329
|
className: classNames('SearchInput', className)
|
|
9294
9330
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -9300,88 +9336,12 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9300
9336
|
ref: ref
|
|
9301
9337
|
}, rest)), controlledValue && /*#__PURE__*/React__default.createElement(Clickable, {
|
|
9302
9338
|
className: "SearchInput__clear",
|
|
9303
|
-
onClick:
|
|
9339
|
+
onClick: handleClear,
|
|
9304
9340
|
type: "reset"
|
|
9305
9341
|
}, /*#__PURE__*/React__default.createElement(Exit20, null)));
|
|
9306
9342
|
};
|
|
9307
9343
|
|
|
9308
|
-
function t(t) {
|
|
9309
|
-
return "object" == _typeof(t) && null != t && 1 === t.nodeType;
|
|
9310
|
-
}
|
|
9311
|
-
function e(t, e) {
|
|
9312
|
-
return (!e || "hidden" !== t) && "visible" !== t && "clip" !== t;
|
|
9313
|
-
}
|
|
9314
|
-
function n(t, n) {
|
|
9315
|
-
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
|
|
9316
|
-
var r = getComputedStyle(t, null);
|
|
9317
|
-
return e(r.overflowY, n) || e(r.overflowX, n) || function (t) {
|
|
9318
|
-
var e = function (t) {
|
|
9319
|
-
if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
|
|
9320
|
-
try {
|
|
9321
|
-
return t.ownerDocument.defaultView.frameElement;
|
|
9322
|
-
} catch (t) {
|
|
9323
|
-
return null;
|
|
9324
|
-
}
|
|
9325
|
-
}(t);
|
|
9326
|
-
return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth);
|
|
9327
|
-
}(t);
|
|
9328
|
-
}
|
|
9329
|
-
return !1;
|
|
9330
|
-
}
|
|
9331
|
-
function r(t, e, n, r, i, o, l, d) {
|
|
9332
|
-
return o < t && l > e || o > t && l < e ? 0 : o <= t && d <= n || l >= e && d >= n ? o - t - r : l > e && d < n || o < t && d > n ? l - e + i : 0;
|
|
9333
|
-
}
|
|
9334
|
-
function compute (e, i) {
|
|
9335
|
-
var o = window,
|
|
9336
|
-
l = i.scrollMode,
|
|
9337
|
-
d = i.block,
|
|
9338
|
-
u = i.inline,
|
|
9339
|
-
h = i.boundary,
|
|
9340
|
-
a = i.skipOverflowHiddenElements,
|
|
9341
|
-
c = "function" == typeof h ? h : function (t) {
|
|
9342
|
-
return t !== h;
|
|
9343
|
-
};
|
|
9344
|
-
if (!t(e)) throw new TypeError("Invalid target");
|
|
9345
|
-
for (var f = document.scrollingElement || document.documentElement, s = [], p = e; t(p) && c(p);) {
|
|
9346
|
-
if ((p = p.parentElement) === f) {
|
|
9347
|
-
s.push(p);
|
|
9348
|
-
break;
|
|
9349
|
-
}
|
|
9350
|
-
null != p && p === document.body && n(p) && !n(document.documentElement) || null != p && n(p, a) && s.push(p);
|
|
9351
|
-
}
|
|
9352
|
-
for (var m = o.visualViewport ? o.visualViewport.width : innerWidth, g = o.visualViewport ? o.visualViewport.height : innerHeight, w = window.scrollX || pageXOffset, v = window.scrollY || pageYOffset, W = e.getBoundingClientRect(), b = W.height, H = W.width, y = W.top, E = W.right, M = W.bottom, V = W.left, x = "start" === d || "nearest" === d ? y : "end" === d ? M : y + b / 2, I = "center" === u ? V + H / 2 : "end" === u ? E : V, C = [], T = 0; T < s.length; T++) {
|
|
9353
|
-
var k = s[T],
|
|
9354
|
-
B = k.getBoundingClientRect(),
|
|
9355
|
-
D = B.height,
|
|
9356
|
-
O = B.width,
|
|
9357
|
-
R = B.top,
|
|
9358
|
-
X = B.right,
|
|
9359
|
-
Y = B.bottom,
|
|
9360
|
-
L = B.left;
|
|
9361
|
-
if ("if-needed" === l && y >= 0 && V >= 0 && M <= g && E <= m && y >= R && M <= Y && V >= L && E <= X) return C;
|
|
9362
|
-
var S = getComputedStyle(k),
|
|
9363
|
-
j = parseInt(S.borderLeftWidth, 10),
|
|
9364
|
-
q = parseInt(S.borderTopWidth, 10),
|
|
9365
|
-
z = parseInt(S.borderRightWidth, 10),
|
|
9366
|
-
A = parseInt(S.borderBottomWidth, 10),
|
|
9367
|
-
F = 0,
|
|
9368
|
-
G = 0,
|
|
9369
|
-
J = "offsetWidth" in k ? k.offsetWidth - k.clientWidth - j - z : 0,
|
|
9370
|
-
K = "offsetHeight" in k ? k.offsetHeight - k.clientHeight - q - A : 0;
|
|
9371
|
-
if (f === k) F = "start" === d ? x : "end" === d ? x - g : "nearest" === d ? r(v, v + g, g, q, A, v + x, v + x + b, b) : x - g / 2, G = "start" === u ? I : "center" === u ? I - m / 2 : "end" === u ? I - m : r(w, w + m, m, j, z, w + I, w + I + H, H), F = Math.max(0, F + v), G = Math.max(0, G + w);else {
|
|
9372
|
-
F = "start" === d ? x - R - q : "end" === d ? x - Y + A + K : "nearest" === d ? r(R, Y, D, q, A + K, x, x + b, b) : x - (R + D / 2) + K / 2, G = "start" === u ? I - L - j : "center" === u ? I - (L + O / 2) + J / 2 : "end" === u ? I - X + z + J : r(L, X, O, j, z + J, I, I + H, H);
|
|
9373
|
-
var N = k.scrollLeft,
|
|
9374
|
-
P = k.scrollTop;
|
|
9375
|
-
x += P - (F = Math.max(0, Math.min(P + F, k.scrollHeight - D + K))), I += N - (G = Math.max(0, Math.min(N + G, k.scrollWidth - O + J)));
|
|
9376
|
-
}
|
|
9377
|
-
C.push({
|
|
9378
|
-
el: k,
|
|
9379
|
-
top: F,
|
|
9380
|
-
left: G
|
|
9381
|
-
});
|
|
9382
|
-
}
|
|
9383
|
-
return C;
|
|
9384
|
-
}
|
|
9344
|
+
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m);}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else {G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)));}T.push({el:B,top:G,left:J});}return T};
|
|
9385
9345
|
|
|
9386
9346
|
function isOptionsObject(options) {
|
|
9387
9347
|
return options === Object(options) && Object.keys(options).length !== 0;
|
|
@@ -9425,13 +9385,13 @@ function getOptions(options) {
|
|
|
9425
9385
|
function scrollIntoView(target, options) {
|
|
9426
9386
|
var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);
|
|
9427
9387
|
if (isOptionsObject(options) && typeof options.behavior === 'function') {
|
|
9428
|
-
return options.behavior(isTargetAttached ?
|
|
9388
|
+
return options.behavior(isTargetAttached ? i(target, options) : []);
|
|
9429
9389
|
}
|
|
9430
9390
|
if (!isTargetAttached) {
|
|
9431
9391
|
return;
|
|
9432
9392
|
}
|
|
9433
9393
|
var computeOptions = getOptions(options);
|
|
9434
|
-
return defaultBehavior(
|
|
9394
|
+
return defaultBehavior(i(target, computeOptions), computeOptions.behavior);
|
|
9435
9395
|
}
|
|
9436
9396
|
|
|
9437
9397
|
var SelectOption = function SelectOption(_ref) {
|