@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [18.0.0](https://github.com/ModaOperandi/om/compare/v17.14.2...v18.0.0) (2022-12-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **searchinput:** clean up props ([#3080](https://github.com/ModaOperandi/om/issues/3080)) ([3f3f645](https://github.com/ModaOperandi/om/commit/3f3f6451b258ff7563f1e9852c15920239566815))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **searchinput:** removed 'onChangeValue'
|
|
17
|
+
|
|
6
18
|
## [17.14.2](https://github.com/ModaOperandi/om/compare/v17.14.1...v17.14.2) (2022-11-17)
|
|
7
19
|
|
|
8
20
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1017,6 +1017,33 @@ function hexDouble(num) {
|
|
|
1017
1017
|
__exportStar(helpers, exports);
|
|
1018
1018
|
})(dist$4);
|
|
1019
1019
|
|
|
1020
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1021
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1022
|
+
if (null != _i) {
|
|
1023
|
+
var _s,
|
|
1024
|
+
_e,
|
|
1025
|
+
_x,
|
|
1026
|
+
_r,
|
|
1027
|
+
_arr = [],
|
|
1028
|
+
_n = !0,
|
|
1029
|
+
_d = !1;
|
|
1030
|
+
try {
|
|
1031
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
1032
|
+
if (Object(_i) !== _i) return;
|
|
1033
|
+
_n = !1;
|
|
1034
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
1035
|
+
} catch (err) {
|
|
1036
|
+
_d = !0, _e = err;
|
|
1037
|
+
} finally {
|
|
1038
|
+
try {
|
|
1039
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
1040
|
+
} finally {
|
|
1041
|
+
if (_d) throw _e;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return _arr;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1020
1047
|
function ownKeys(object, enumerableOnly) {
|
|
1021
1048
|
var keys = Object.keys(object);
|
|
1022
1049
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1048,6 +1075,7 @@ function _typeof(obj) {
|
|
|
1048
1075
|
}, _typeof(obj);
|
|
1049
1076
|
}
|
|
1050
1077
|
function _defineProperty$1(obj, key, value) {
|
|
1078
|
+
key = _toPropertyKey(key);
|
|
1051
1079
|
if (key in obj) {
|
|
1052
1080
|
Object.defineProperty(obj, key, {
|
|
1053
1081
|
value: value,
|
|
@@ -1119,30 +1147,6 @@ function _arrayWithHoles(arr) {
|
|
|
1119
1147
|
function _iterableToArray(iter) {
|
|
1120
1148
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1121
1149
|
}
|
|
1122
|
-
function _iterableToArrayLimit(arr, i) {
|
|
1123
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1124
|
-
if (_i == null) return;
|
|
1125
|
-
var _arr = [];
|
|
1126
|
-
var _n = true;
|
|
1127
|
-
var _d = false;
|
|
1128
|
-
var _s, _e;
|
|
1129
|
-
try {
|
|
1130
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
1131
|
-
_arr.push(_s.value);
|
|
1132
|
-
if (i && _arr.length === i) break;
|
|
1133
|
-
}
|
|
1134
|
-
} catch (err) {
|
|
1135
|
-
_d = true;
|
|
1136
|
-
_e = err;
|
|
1137
|
-
} finally {
|
|
1138
|
-
try {
|
|
1139
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1140
|
-
} finally {
|
|
1141
|
-
if (_d) throw _e;
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
return _arr;
|
|
1145
|
-
}
|
|
1146
1150
|
function _unsupportedIterableToArray(o, minLen) {
|
|
1147
1151
|
if (!o) return;
|
|
1148
1152
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -1162,6 +1166,20 @@ function _nonIterableSpread() {
|
|
|
1162
1166
|
function _nonIterableRest() {
|
|
1163
1167
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1164
1168
|
}
|
|
1169
|
+
function _toPrimitive(input, hint) {
|
|
1170
|
+
if (typeof input !== "object" || input === null) return input;
|
|
1171
|
+
var prim = input[Symbol.toPrimitive];
|
|
1172
|
+
if (prim !== undefined) {
|
|
1173
|
+
var res = prim.call(input, hint || "default");
|
|
1174
|
+
if (typeof res !== "object") return res;
|
|
1175
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1176
|
+
}
|
|
1177
|
+
return (hint === "string" ? String : Number)(input);
|
|
1178
|
+
}
|
|
1179
|
+
function _toPropertyKey(arg) {
|
|
1180
|
+
var key = _toPrimitive(arg, "string");
|
|
1181
|
+
return typeof key === "symbol" ? key : String(key);
|
|
1182
|
+
}
|
|
1165
1183
|
|
|
1166
1184
|
var isRenderProps = function isRenderProps(children) {
|
|
1167
1185
|
return typeof children === 'function';
|
|
@@ -3374,9 +3392,16 @@ var parentAutofocusables = function parentAutofocusables(topNode, visibilityCach
|
|
|
3374
3392
|
* Determines if element is contained in scope, including nested shadow DOMs
|
|
3375
3393
|
*/
|
|
3376
3394
|
var contains$1 = function contains(scope, element) {
|
|
3377
|
-
|
|
3378
|
-
return contains(
|
|
3379
|
-
}
|
|
3395
|
+
if (scope.shadowRoot) {
|
|
3396
|
+
return contains(scope.shadowRoot, element);
|
|
3397
|
+
} else {
|
|
3398
|
+
if (Object.getPrototypeOf(scope).contains !== undefined && Object.getPrototypeOf(scope).contains.call(scope, element)) {
|
|
3399
|
+
return true;
|
|
3400
|
+
}
|
|
3401
|
+
return toArray(scope.children).some(function (child) {
|
|
3402
|
+
return contains(child, element);
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3380
3405
|
};
|
|
3381
3406
|
|
|
3382
3407
|
/**
|
|
@@ -3586,6 +3611,32 @@ var newFocus = function newFocus(innerNodes, outerNodes, activeElement, lastNode
|
|
|
3586
3611
|
return undefined;
|
|
3587
3612
|
};
|
|
3588
3613
|
|
|
3614
|
+
var findAutoFocused = function findAutoFocused(autoFocusables) {
|
|
3615
|
+
return function (node) {
|
|
3616
|
+
var _a;
|
|
3617
|
+
var autofocus = (_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.autofocus;
|
|
3618
|
+
return (
|
|
3619
|
+
// @ts-expect-error
|
|
3620
|
+
node.autofocus ||
|
|
3621
|
+
//
|
|
3622
|
+
autofocus !== undefined && autofocus !== 'false' ||
|
|
3623
|
+
//
|
|
3624
|
+
autoFocusables.indexOf(node) >= 0
|
|
3625
|
+
);
|
|
3626
|
+
};
|
|
3627
|
+
};
|
|
3628
|
+
var pickAutofocus = function pickAutofocus(nodesIndexes, orderedNodes, groups) {
|
|
3629
|
+
var nodes = nodesIndexes.map(function (_a) {
|
|
3630
|
+
var node = _a.node;
|
|
3631
|
+
return node;
|
|
3632
|
+
});
|
|
3633
|
+
var autoFocusable = filterAutoFocusable(nodes.filter(findAutoFocused(groups)));
|
|
3634
|
+
if (autoFocusable && autoFocusable.length) {
|
|
3635
|
+
return pickFirstFocus(autoFocusable);
|
|
3636
|
+
}
|
|
3637
|
+
return pickFirstFocus(filterAutoFocusable(orderedNodes));
|
|
3638
|
+
};
|
|
3639
|
+
|
|
3589
3640
|
var getParents = function getParents(node, parents) {
|
|
3590
3641
|
if (parents === void 0) {
|
|
3591
3642
|
parents = [];
|
|
@@ -3646,13 +3697,6 @@ var allParentAutofocusables = function allParentAutofocusables(entries, visibili
|
|
|
3646
3697
|
}, []);
|
|
3647
3698
|
};
|
|
3648
3699
|
|
|
3649
|
-
var findAutoFocused = function findAutoFocused(autoFocusables) {
|
|
3650
|
-
return function (node) {
|
|
3651
|
-
var _a;
|
|
3652
|
-
// @ts-expect-error
|
|
3653
|
-
return node.autofocus || !!((_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.autofocus) || autoFocusables.indexOf(node) >= 0;
|
|
3654
|
-
};
|
|
3655
|
-
};
|
|
3656
3700
|
var reorderNodes = function reorderNodes(srcNodes, dstNodes) {
|
|
3657
3701
|
var remap = new Map();
|
|
3658
3702
|
// no Set(dstNodes) for IE11 :(
|
|
@@ -3696,12 +3740,8 @@ var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
|
3696
3740
|
});
|
|
3697
3741
|
var newId = newFocus(innerNodes, outerNodes, activeElement, lastNode);
|
|
3698
3742
|
if (newId === NEW_FOCUS) {
|
|
3699
|
-
var autoFocusable = filterAutoFocusable(anyFocusable.map(function (_a) {
|
|
3700
|
-
var node = _a.node;
|
|
3701
|
-
return node;
|
|
3702
|
-
})).filter(findAutoFocused(allParentAutofocusables(entries, visibilityCache)));
|
|
3703
3743
|
return {
|
|
3704
|
-
node:
|
|
3744
|
+
node: pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache))
|
|
3705
3745
|
};
|
|
3706
3746
|
}
|
|
3707
3747
|
if (newId === undefined) {
|
|
@@ -4109,11 +4149,6 @@ var parse = function parse(x) {
|
|
|
4109
4149
|
};
|
|
4110
4150
|
var getOffset = function getOffset(gapMode) {
|
|
4111
4151
|
var cs = window.getComputedStyle(document.body);
|
|
4112
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4113
|
-
if (cs.overflowY === 'hidden') {
|
|
4114
|
-
console.error('react-remove-scroll-bar: cannot calculate scrollbar size because it is removed (overflow:hidden on body');
|
|
4115
|
-
}
|
|
4116
|
-
}
|
|
4117
4152
|
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
4118
4153
|
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
4119
4154
|
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
@@ -4159,6 +4194,11 @@ var RemoveScrollBar = function RemoveScrollBar(props) {
|
|
|
4159
4194
|
noImportant = props.noImportant,
|
|
4160
4195
|
_a = props.gapMode,
|
|
4161
4196
|
gapMode = _a === void 0 ? 'margin' : _a;
|
|
4197
|
+
/*
|
|
4198
|
+
gap will be measured on every component mount
|
|
4199
|
+
however it will be used only by the "first" invocation
|
|
4200
|
+
due to singleton nature of <Style
|
|
4201
|
+
*/
|
|
4162
4202
|
var gap = React__namespace.useMemo(function () {
|
|
4163
4203
|
return getGapWidth(gapMode);
|
|
4164
4204
|
}, [gapMode]);
|
|
@@ -9277,12 +9317,11 @@ var Search20 = function Search20(_a) {
|
|
|
9277
9317
|
};
|
|
9278
9318
|
Search20.displayName = 'Search20';
|
|
9279
9319
|
|
|
9280
|
-
var _excluded$o = ["className", "onChange", "
|
|
9320
|
+
var _excluded$o = ["className", "onChange", "onClear", "value"];
|
|
9281
9321
|
var DEFAULT_INPUT_VALUE = '';
|
|
9282
9322
|
var SearchInput = function SearchInput(_ref) {
|
|
9283
9323
|
var className = _ref.className,
|
|
9284
9324
|
onChange = _ref.onChange,
|
|
9285
|
-
onChangeValue = _ref.onChangeValue,
|
|
9286
9325
|
onClear = _ref.onClear,
|
|
9287
9326
|
_ref$value = _ref.value,
|
|
9288
9327
|
value = _ref$value === void 0 ? DEFAULT_INPUT_VALUE : _ref$value,
|
|
@@ -9292,13 +9331,13 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9292
9331
|
_useState2 = _slicedToArray(_useState, 2),
|
|
9293
9332
|
controlledValue = _useState2[0],
|
|
9294
9333
|
setValue = _useState2[1];
|
|
9295
|
-
var
|
|
9334
|
+
var handleClear = React.useCallback(function () {
|
|
9335
|
+
var _ref$current;
|
|
9296
9336
|
setValue(DEFAULT_INPUT_VALUE);
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
}, [onClear]);
|
|
9337
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(DEFAULT_INPUT_VALUE);
|
|
9338
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
9339
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
9340
|
+
}, [onClear, onChange]);
|
|
9302
9341
|
var handleChange = React.useCallback(function (value) {
|
|
9303
9342
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
9304
9343
|
setValue(value);
|
|
@@ -9306,9 +9345,6 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9306
9345
|
React.useEffect(function () {
|
|
9307
9346
|
return setValue(value);
|
|
9308
9347
|
}, [value]);
|
|
9309
|
-
React.useEffect(function () {
|
|
9310
|
-
onChangeValue && onChangeValue(controlledValue);
|
|
9311
|
-
}, [controlledValue, onChangeValue]);
|
|
9312
9348
|
return /*#__PURE__*/React.createElement("div", {
|
|
9313
9349
|
className: classNames('SearchInput', className)
|
|
9314
9350
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -9320,88 +9356,12 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9320
9356
|
ref: ref
|
|
9321
9357
|
}, rest)), controlledValue && /*#__PURE__*/React.createElement(Clickable, {
|
|
9322
9358
|
className: "SearchInput__clear",
|
|
9323
|
-
onClick:
|
|
9359
|
+
onClick: handleClear,
|
|
9324
9360
|
type: "reset"
|
|
9325
9361
|
}, /*#__PURE__*/React.createElement(Exit20, null)));
|
|
9326
9362
|
};
|
|
9327
9363
|
|
|
9328
|
-
function t(t) {
|
|
9329
|
-
return "object" == _typeof(t) && null != t && 1 === t.nodeType;
|
|
9330
|
-
}
|
|
9331
|
-
function e(t, e) {
|
|
9332
|
-
return (!e || "hidden" !== t) && "visible" !== t && "clip" !== t;
|
|
9333
|
-
}
|
|
9334
|
-
function n(t, n) {
|
|
9335
|
-
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
|
|
9336
|
-
var r = getComputedStyle(t, null);
|
|
9337
|
-
return e(r.overflowY, n) || e(r.overflowX, n) || function (t) {
|
|
9338
|
-
var e = function (t) {
|
|
9339
|
-
if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
|
|
9340
|
-
try {
|
|
9341
|
-
return t.ownerDocument.defaultView.frameElement;
|
|
9342
|
-
} catch (t) {
|
|
9343
|
-
return null;
|
|
9344
|
-
}
|
|
9345
|
-
}(t);
|
|
9346
|
-
return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth);
|
|
9347
|
-
}(t);
|
|
9348
|
-
}
|
|
9349
|
-
return !1;
|
|
9350
|
-
}
|
|
9351
|
-
function r(t, e, n, r, i, o, l, d) {
|
|
9352
|
-
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;
|
|
9353
|
-
}
|
|
9354
|
-
function compute (e, i) {
|
|
9355
|
-
var o = window,
|
|
9356
|
-
l = i.scrollMode,
|
|
9357
|
-
d = i.block,
|
|
9358
|
-
u = i.inline,
|
|
9359
|
-
h = i.boundary,
|
|
9360
|
-
a = i.skipOverflowHiddenElements,
|
|
9361
|
-
c = "function" == typeof h ? h : function (t) {
|
|
9362
|
-
return t !== h;
|
|
9363
|
-
};
|
|
9364
|
-
if (!t(e)) throw new TypeError("Invalid target");
|
|
9365
|
-
for (var f = document.scrollingElement || document.documentElement, s = [], p = e; t(p) && c(p);) {
|
|
9366
|
-
if ((p = p.parentElement) === f) {
|
|
9367
|
-
s.push(p);
|
|
9368
|
-
break;
|
|
9369
|
-
}
|
|
9370
|
-
null != p && p === document.body && n(p) && !n(document.documentElement) || null != p && n(p, a) && s.push(p);
|
|
9371
|
-
}
|
|
9372
|
-
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++) {
|
|
9373
|
-
var k = s[T],
|
|
9374
|
-
B = k.getBoundingClientRect(),
|
|
9375
|
-
D = B.height,
|
|
9376
|
-
O = B.width,
|
|
9377
|
-
R = B.top,
|
|
9378
|
-
X = B.right,
|
|
9379
|
-
Y = B.bottom,
|
|
9380
|
-
L = B.left;
|
|
9381
|
-
if ("if-needed" === l && y >= 0 && V >= 0 && M <= g && E <= m && y >= R && M <= Y && V >= L && E <= X) return C;
|
|
9382
|
-
var S = getComputedStyle(k),
|
|
9383
|
-
j = parseInt(S.borderLeftWidth, 10),
|
|
9384
|
-
q = parseInt(S.borderTopWidth, 10),
|
|
9385
|
-
z = parseInt(S.borderRightWidth, 10),
|
|
9386
|
-
A = parseInt(S.borderBottomWidth, 10),
|
|
9387
|
-
F = 0,
|
|
9388
|
-
G = 0,
|
|
9389
|
-
J = "offsetWidth" in k ? k.offsetWidth - k.clientWidth - j - z : 0,
|
|
9390
|
-
K = "offsetHeight" in k ? k.offsetHeight - k.clientHeight - q - A : 0;
|
|
9391
|
-
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 {
|
|
9392
|
-
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);
|
|
9393
|
-
var N = k.scrollLeft,
|
|
9394
|
-
P = k.scrollTop;
|
|
9395
|
-
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)));
|
|
9396
|
-
}
|
|
9397
|
-
C.push({
|
|
9398
|
-
el: k,
|
|
9399
|
-
top: F,
|
|
9400
|
-
left: G
|
|
9401
|
-
});
|
|
9402
|
-
}
|
|
9403
|
-
return C;
|
|
9404
|
-
}
|
|
9364
|
+
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};
|
|
9405
9365
|
|
|
9406
9366
|
function isOptionsObject(options) {
|
|
9407
9367
|
return options === Object(options) && Object.keys(options).length !== 0;
|
|
@@ -9445,13 +9405,13 @@ function getOptions(options) {
|
|
|
9445
9405
|
function scrollIntoView(target, options) {
|
|
9446
9406
|
var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);
|
|
9447
9407
|
if (isOptionsObject(options) && typeof options.behavior === 'function') {
|
|
9448
|
-
return options.behavior(isTargetAttached ?
|
|
9408
|
+
return options.behavior(isTargetAttached ? i(target, options) : []);
|
|
9449
9409
|
}
|
|
9450
9410
|
if (!isTargetAttached) {
|
|
9451
9411
|
return;
|
|
9452
9412
|
}
|
|
9453
9413
|
var computeOptions = getOptions(options);
|
|
9454
|
-
return defaultBehavior(
|
|
9414
|
+
return defaultBehavior(i(target, computeOptions), computeOptions.behavior);
|
|
9455
9415
|
}
|
|
9456
9416
|
|
|
9457
9417
|
var SelectOption = function SelectOption(_ref) {
|