@bcgov/design-system-react-components 0.4.0-pr506 → 0.4.0-pr508
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/dist/cjs/index.cjs +1058 -742
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1058 -742
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -390,11 +390,8 @@ class $681cc3c98f569e39$export$dc064fe9e59310fd extends $681cc3c98f569e39$export
|
|
|
390
390
|
setAttributeNS() {}
|
|
391
391
|
removeAttribute() {}
|
|
392
392
|
constructor(type, ownerDocument){
|
|
393
|
-
super(ownerDocument)
|
|
394
|
-
this.
|
|
395
|
-
;
|
|
396
|
-
this._index = 0;
|
|
397
|
-
this.hasSetProps = false;
|
|
393
|
+
super(ownerDocument), this.nodeType = 8 // COMMENT_NODE (we'd use ELEMENT_NODE but React DevTools will fail to get its dimensions)
|
|
394
|
+
, this._index = 0, this.hasSetProps = false;
|
|
398
395
|
this.node = new ($23b9f4fcf0fe224b$export$d68d59712b04d9d1)(type, `react-aria-${++ownerDocument.nodeId}`);
|
|
399
396
|
// Start a transaction so that no updates are emitted from the collection
|
|
400
397
|
// until the props for this node are set. We don't know the real id for the
|
|
@@ -490,18 +487,8 @@ class $681cc3c98f569e39$export$b34a105447964f9f extends $681cc3c98f569e39$export
|
|
|
490
487
|
}
|
|
491
488
|
constructor(collection){
|
|
492
489
|
// @ts-ignore
|
|
493
|
-
super(null)
|
|
494
|
-
this.
|
|
495
|
-
;
|
|
496
|
-
this.ownerDocument = this;
|
|
497
|
-
this.dirtyNodes = new Set();
|
|
498
|
-
this.isSSR = false;
|
|
499
|
-
this.nodeId = 0;
|
|
500
|
-
this.nodesByProps = new WeakMap();
|
|
501
|
-
this.isMounted = true;
|
|
502
|
-
this.mutatedNodes = new Set();
|
|
503
|
-
this.subscriptions = new Set();
|
|
504
|
-
this.transactionCount = 0;
|
|
490
|
+
super(null), this.nodeType = 11 // DOCUMENT_FRAGMENT_NODE
|
|
491
|
+
, this.ownerDocument = this, this.dirtyNodes = new Set(), this.isSSR = false, this.nodeId = 0, this.nodesByProps = new WeakMap(), this.isMounted = true, this.mutatedNodes = new Set(), this.subscriptions = new Set(), this.transactionCount = 0;
|
|
505
492
|
this.collection = collection;
|
|
506
493
|
this.collectionMutated = true;
|
|
507
494
|
}
|
|
@@ -533,9 +520,7 @@ function $e948873055cbafe4$export$727c8fc270210f13(props) {
|
|
|
533
520
|
var _rendered_props_id, _ref;
|
|
534
521
|
// @ts-ignore
|
|
535
522
|
let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
|
|
536
|
-
// eslint-disable-next-line max-depth
|
|
537
523
|
if (key == null) throw new Error('Could not determine key for item');
|
|
538
|
-
// eslint-disable-next-line max-depth
|
|
539
524
|
if (idScope) key = idScope + ':' + key;
|
|
540
525
|
// Note: only works if wrapped Item passes through id...
|
|
541
526
|
rendered = (cloneElement)(rendered, addIdAndValue ? {
|
|
@@ -635,7 +620,6 @@ function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
|
|
635
620
|
return defaultId || `${prefix}-${counter}`;
|
|
636
621
|
}
|
|
637
622
|
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
|
638
|
-
// @ts-ignore
|
|
639
623
|
let id = ($dbSRa$react).useId();
|
|
640
624
|
let [didSSR] = (useState)($b5e257d569688ac6$export$535bd6ca7f90a273());
|
|
641
625
|
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
|
@@ -830,7 +814,16 @@ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
|
830
814
|
let updateValue = (useCallback)((val)=>{
|
|
831
815
|
nextId.current = val;
|
|
832
816
|
}, []);
|
|
833
|
-
if ($bdb11010cef70236$var$canUseDOM)
|
|
817
|
+
if ($bdb11010cef70236$var$canUseDOM) {
|
|
818
|
+
// TS not smart enough to know that `has` means the value exists
|
|
819
|
+
if ($bdb11010cef70236$var$idsUpdaterMap.has(res) && !$bdb11010cef70236$var$idsUpdaterMap.get(res).includes(updateValue)) $bdb11010cef70236$var$idsUpdaterMap.set(res, [
|
|
820
|
+
...$bdb11010cef70236$var$idsUpdaterMap.get(res),
|
|
821
|
+
updateValue
|
|
822
|
+
]);
|
|
823
|
+
else $bdb11010cef70236$var$idsUpdaterMap.set(res, [
|
|
824
|
+
updateValue
|
|
825
|
+
]);
|
|
826
|
+
}
|
|
834
827
|
($f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
835
828
|
let r = res;
|
|
836
829
|
return ()=>{
|
|
@@ -852,14 +845,14 @@ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
|
852
845
|
}
|
|
853
846
|
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
854
847
|
if (idA === idB) return idA;
|
|
855
|
-
let
|
|
856
|
-
if (
|
|
857
|
-
|
|
848
|
+
let setIdsA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
849
|
+
if (setIdsA) {
|
|
850
|
+
setIdsA.forEach((fn)=>fn(idB));
|
|
858
851
|
return idB;
|
|
859
852
|
}
|
|
860
|
-
let
|
|
861
|
-
if (
|
|
862
|
-
|
|
853
|
+
let setIdsB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
854
|
+
if (setIdsB) {
|
|
855
|
+
setIdsB.forEach((fn)=>fn(idA));
|
|
863
856
|
return idA;
|
|
864
857
|
}
|
|
865
858
|
return idB;
|
|
@@ -1038,7 +1031,7 @@ function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
|
1038
1031
|
return true;
|
|
1039
1032
|
}
|
|
1040
1033
|
});
|
|
1041
|
-
} catch
|
|
1034
|
+
} catch {
|
|
1042
1035
|
// Ignore
|
|
1043
1036
|
}
|
|
1044
1037
|
}
|
|
@@ -1200,8 +1193,10 @@ function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
|
1200
1193
|
}
|
|
1201
1194
|
function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
|
|
1202
1195
|
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
1196
|
+
var _props_href;
|
|
1197
|
+
const href = router.useHref((_props_href = props.href) !== null && _props_href !== void 0 ? _props_href : '');
|
|
1203
1198
|
return {
|
|
1204
|
-
'data-href': props.href ?
|
|
1199
|
+
'data-href': props.href ? href : undefined,
|
|
1205
1200
|
'data-target': props.target,
|
|
1206
1201
|
'data-rel': props.rel,
|
|
1207
1202
|
'data-download': props.download,
|
|
@@ -1211,8 +1206,10 @@ function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
|
|
|
1211
1206
|
}
|
|
1212
1207
|
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
|
|
1213
1208
|
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
1209
|
+
var _props_href;
|
|
1210
|
+
const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : '');
|
|
1214
1211
|
return {
|
|
1215
|
-
href: (props === null || props === void 0 ? void 0 : props.href) ?
|
|
1212
|
+
href: (props === null || props === void 0 ? void 0 : props.href) ? href : undefined,
|
|
1216
1213
|
target: props === null || props === void 0 ? void 0 : props.target,
|
|
1217
1214
|
rel: props === null || props === void 0 ? void 0 : props.rel,
|
|
1218
1215
|
download: props === null || props === void 0 ? void 0 : props.download,
|
|
@@ -1335,7 +1332,6 @@ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
|
|
|
1335
1332
|
}, [
|
|
1336
1333
|
removeGlobalListener
|
|
1337
1334
|
]);
|
|
1338
|
-
// eslint-disable-next-line arrow-body-style
|
|
1339
1335
|
(useEffect)(()=>{
|
|
1340
1336
|
return removeAllGlobalListeners;
|
|
1341
1337
|
}, [
|
|
@@ -1502,6 +1498,7 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
1502
1498
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1503
1499
|
* governing permissions and limitations under the License.
|
|
1504
1500
|
*/ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
1501
|
+
if (!node) return false;
|
|
1505
1502
|
let style = window.getComputedStyle(node);
|
|
1506
1503
|
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
1507
1504
|
if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
@@ -1558,7 +1555,6 @@ function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
|
1558
1555
|
* governing permissions and limitations under the License.
|
|
1559
1556
|
*/
|
|
1560
1557
|
|
|
1561
|
-
// @ts-ignore
|
|
1562
1558
|
let $5df64b3807dc15ee$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
1563
1559
|
function $5df64b3807dc15ee$export$d699905dd57c73ca() {
|
|
1564
1560
|
let isSSR = ($b5e257d569688ac6$export$535bd6ca7f90a273)();
|
|
@@ -1723,7 +1719,7 @@ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
|
1723
1719
|
return sum;
|
|
1724
1720
|
}
|
|
1725
1721
|
function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
|
|
1726
|
-
if (document.contains(targetElement)) {
|
|
1722
|
+
if (targetElement && document.contains(targetElement)) {
|
|
1727
1723
|
let root = document.scrollingElement || document.documentElement;
|
|
1728
1724
|
let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
|
|
1729
1725
|
// If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
|
|
@@ -2401,8 +2397,9 @@ function $e1995378a142960e$var$CollectionRoot({ children: children }) {
|
|
|
2401
2397
|
|
|
2402
2398
|
const $7135fc7d473fd974$export$d40e14dec8b060a8 = /*#__PURE__*/ (createContext)(null);
|
|
2403
2399
|
const $7135fc7d473fd974$export$6e2c8f0811a474ce = /*#__PURE__*/ ($e1995378a142960e$export$e953bb1cd0f19726)('section', (props, ref, section)=>{
|
|
2404
|
-
let { render: render } = (useContext)($7135fc7d473fd974$export$d40e14dec8b060a8);
|
|
2405
|
-
|
|
2400
|
+
let { name: name, render: render } = (useContext)($7135fc7d473fd974$export$d40e14dec8b060a8);
|
|
2401
|
+
console.warn(`<Section> is deprecated. Please use <${name}> instead.`);
|
|
2402
|
+
return render(props, ref, section, 'react-aria-Section');
|
|
2406
2403
|
});
|
|
2407
2404
|
const $7135fc7d473fd974$export$a164736487e3f0ae = {
|
|
2408
2405
|
CollectionRoot ({ collection: collection, renderDropIndicator: renderDropIndicator }) {
|
|
@@ -2662,7 +2659,6 @@ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
|
|
2662
2659
|
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
2663
2660
|
if (($c87311424ea30a05$export$fedb369cb70207f1)()) {
|
|
2664
2661
|
if ($14c0b72509d70225$var$state === 'default') {
|
|
2665
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2666
2662
|
const documentObject = ($431fbd86ca7dc216$export$b204af158042fbac)(target);
|
|
2667
2663
|
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
2668
2664
|
documentObject.documentElement.style.webkitUserSelect = 'none';
|
|
@@ -2689,7 +2685,6 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
2689
2685
|
($bbed8b41f857bcc0$export$24490316f764c430)(()=>{
|
|
2690
2686
|
// Avoid race conditions
|
|
2691
2687
|
if ($14c0b72509d70225$var$state === 'restoring') {
|
|
2692
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2693
2688
|
const documentObject = ($431fbd86ca7dc216$export$b204af158042fbac)(target);
|
|
2694
2689
|
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
|
2695
2690
|
$14c0b72509d70225$var$savedUserSelect = '';
|
|
@@ -3028,7 +3023,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
3028
3023
|
}
|
|
3029
3024
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
3030
3025
|
// default on pointer down and handle focusing the pressable element ourselves.
|
|
3031
|
-
if ($f6c31cce2adf654f$var$
|
|
3026
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultDown(e.currentTarget)) e.preventDefault();
|
|
3032
3027
|
state.pointerType = e.pointerType;
|
|
3033
3028
|
let shouldStopPropagation = true;
|
|
3034
3029
|
if (!state.isPressed) {
|
|
@@ -3051,7 +3046,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
3051
3046
|
// Chrome and Firefox on touch Windows devices require mouse down events
|
|
3052
3047
|
// to be canceled in addition to pointer events, or an extra asynchronous
|
|
3053
3048
|
// focus event will be fired.
|
|
3054
|
-
if ($f6c31cce2adf654f$var$
|
|
3049
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultDown(e.currentTarget)) e.preventDefault();
|
|
3055
3050
|
e.stopPropagation();
|
|
3056
3051
|
}
|
|
3057
3052
|
};
|
|
@@ -3089,8 +3084,23 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
3089
3084
|
state.pointerType = null;
|
|
3090
3085
|
removeAllGlobalListeners();
|
|
3091
3086
|
if (!allowTextSelectionOnPress) ($14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
|
3087
|
+
// Prevent subsequent touchend event from triggering onClick on unrelated elements on Android. See below.
|
|
3088
|
+
// Both 'touch' and 'pen' pointerTypes trigger onTouchEnd, but 'mouse' does not.
|
|
3089
|
+
if ('ontouchend' in state.target && e.pointerType !== 'mouse') addGlobalListener(state.target, 'touchend', onTouchEnd, {
|
|
3090
|
+
once: true
|
|
3091
|
+
});
|
|
3092
3092
|
}
|
|
3093
3093
|
};
|
|
3094
|
+
// This is a workaround for an Android Chrome/Firefox issue where click events are fired on an incorrect element
|
|
3095
|
+
// if the original target is removed during onPointerUp (before onClick).
|
|
3096
|
+
// https://github.com/adobe/react-spectrum/issues/1513
|
|
3097
|
+
// https://issues.chromium.org/issues/40732224
|
|
3098
|
+
// Note: this event must be registered directly on the element, not via React props in order to work.
|
|
3099
|
+
// https://github.com/facebook/react/issues/9809
|
|
3100
|
+
let onTouchEnd = (e)=>{
|
|
3101
|
+
// Don't preventDefault if we actually want the default (e.g. submit/link click).
|
|
3102
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultUp(e.currentTarget)) e.preventDefault();
|
|
3103
|
+
};
|
|
3094
3104
|
let onPointerCancel = (e)=>{
|
|
3095
3105
|
cancel(e);
|
|
3096
3106
|
};
|
|
@@ -3105,7 +3115,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
3105
3115
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
|
3106
3116
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
3107
3117
|
// default on mouse down and handle focusing the pressable element ourselves.
|
|
3108
|
-
if ($f6c31cce2adf654f$var$
|
|
3118
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultDown(e.currentTarget)) e.preventDefault();
|
|
3109
3119
|
if (state.ignoreEmulatedMouseEvents) {
|
|
3110
3120
|
e.stopPropagation();
|
|
3111
3121
|
return;
|
|
@@ -3246,7 +3256,6 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
3246
3256
|
triggerPressUp
|
|
3247
3257
|
]);
|
|
3248
3258
|
// Remove user-select: none in case component unmounts immediately after pressStart
|
|
3249
|
-
// eslint-disable-next-line arrow-body-style
|
|
3250
3259
|
(useEffect)(()=>{
|
|
3251
3260
|
return ()=>{
|
|
3252
3261
|
var _ref_current_target;
|
|
@@ -3342,16 +3351,20 @@ function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
|
3342
3351
|
let pointRect = $f6c31cce2adf654f$var$getPointClientRect(point);
|
|
3343
3352
|
return $f6c31cce2adf654f$var$areRectanglesOverlapping(rect, pointRect);
|
|
3344
3353
|
}
|
|
3345
|
-
function $f6c31cce2adf654f$var$
|
|
3354
|
+
function $f6c31cce2adf654f$var$shouldPreventDefaultDown(target) {
|
|
3346
3355
|
// We cannot prevent default if the target is a draggable element.
|
|
3347
3356
|
return !(target instanceof HTMLElement) || !target.hasAttribute('draggable');
|
|
3348
3357
|
}
|
|
3349
|
-
function $f6c31cce2adf654f$var$
|
|
3350
|
-
if (target instanceof HTMLInputElement) return
|
|
3358
|
+
function $f6c31cce2adf654f$var$shouldPreventDefaultUp(target) {
|
|
3359
|
+
if (target instanceof HTMLInputElement) return false;
|
|
3351
3360
|
if (target instanceof HTMLButtonElement) return target.type !== 'submit' && target.type !== 'reset';
|
|
3352
3361
|
if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target)) return false;
|
|
3353
3362
|
return true;
|
|
3354
3363
|
}
|
|
3364
|
+
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
3365
|
+
if (target instanceof HTMLInputElement) return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
3366
|
+
return $f6c31cce2adf654f$var$shouldPreventDefaultUp(target);
|
|
3367
|
+
}
|
|
3355
3368
|
const $f6c31cce2adf654f$var$nonTextInputTypes = new Set([
|
|
3356
3369
|
'checkbox',
|
|
3357
3370
|
'radio',
|
|
@@ -3461,7 +3474,6 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
|
3461
3474
|
observer: null
|
|
3462
3475
|
});
|
|
3463
3476
|
// Clean up MutationObserver on unmount. See below.
|
|
3464
|
-
// eslint-disable-next-line arrow-body-style
|
|
3465
3477
|
($f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
3466
3478
|
const state = stateRef.current;
|
|
3467
3479
|
return ()=>{
|
|
@@ -4559,7 +4571,6 @@ function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
|
4559
4571
|
contain
|
|
4560
4572
|
]);
|
|
4561
4573
|
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
|
|
4562
|
-
// eslint-disable-next-line arrow-body-style
|
|
4563
4574
|
($f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
4564
4575
|
return ()=>{
|
|
4565
4576
|
if (raf.current) cancelAnimationFrame(raf.current);
|
|
@@ -4601,12 +4612,12 @@ function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
|
|
4601
4612
|
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
|
|
4602
4613
|
if (element != null && !scroll) try {
|
|
4603
4614
|
(0, $6a99195332edec8b$export$80f3e147d781571c)(element);
|
|
4604
|
-
} catch
|
|
4615
|
+
} catch {
|
|
4605
4616
|
// ignore
|
|
4606
4617
|
}
|
|
4607
4618
|
else if (element != null) try {
|
|
4608
4619
|
element.focus();
|
|
4609
|
-
} catch
|
|
4620
|
+
} catch {
|
|
4610
4621
|
// ignore
|
|
4611
4622
|
}
|
|
4612
4623
|
}
|
|
@@ -4713,7 +4724,7 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
4713
4724
|
let onKeyDown = (e)=>{
|
|
4714
4725
|
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
|
4715
4726
|
let focusedElement = ownerDocument.activeElement;
|
|
4716
|
-
if (!$9bf71ea28793e738$var$
|
|
4727
|
+
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return;
|
|
4717
4728
|
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
4718
4729
|
if (!treeNode) return;
|
|
4719
4730
|
let nodeToRestore = treeNode.nodeToRestore;
|
|
@@ -4730,11 +4741,11 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
4730
4741
|
}
|
|
4731
4742
|
// If there is no next element, or it is outside the current scope, move focus to the
|
|
4732
4743
|
// next element after the node to restore to instead.
|
|
4733
|
-
if ((!nextElement || !$9bf71ea28793e738$var$
|
|
4744
|
+
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
|
4734
4745
|
walker.currentNode = nodeToRestore;
|
|
4735
4746
|
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
|
4736
4747
|
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
4737
|
-
while ($9bf71ea28793e738$var$
|
|
4748
|
+
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
|
|
4738
4749
|
e.preventDefault();
|
|
4739
4750
|
e.stopPropagation();
|
|
4740
4751
|
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
|
@@ -4767,8 +4778,7 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
4767
4778
|
if (!treeNode) return;
|
|
4768
4779
|
let nodeToRestore = treeNode.nodeToRestore;
|
|
4769
4780
|
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
|
4770
|
-
if (restoreFocus && nodeToRestore &&
|
|
4771
|
-
($9bf71ea28793e738$var$isElementInScope(ownerDocument.activeElement, scopeRef.current) || ownerDocument.activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
|
|
4781
|
+
if (restoreFocus && nodeToRestore && (ownerDocument.activeElement && $9bf71ea28793e738$var$isElementInChildScope(ownerDocument.activeElement, scopeRef) || ownerDocument.activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
|
|
4772
4782
|
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
|
|
4773
4783
|
let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
|
|
4774
4784
|
requestAnimationFrame(()=>{
|
|
@@ -5090,7 +5100,6 @@ const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
|
|
|
5090
5100
|
]);
|
|
5091
5101
|
function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
|
|
5092
5102
|
// If the Intl.Locale API is available, use it to get the locale's text direction.
|
|
5093
|
-
// @ts-ignore
|
|
5094
5103
|
if (Intl.Locale) {
|
|
5095
5104
|
let locale = new Intl.Locale(localeString).maximize();
|
|
5096
5105
|
// Use the text info object to get the direction if possible.
|
|
@@ -5125,11 +5134,10 @@ const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
|
|
|
5125
5134
|
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
|
|
5126
5135
|
let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
|
|
5127
5136
|
try {
|
|
5128
|
-
// @ts-ignore
|
|
5129
5137
|
Intl.DateTimeFormat.supportedLocalesOf([
|
|
5130
5138
|
locale
|
|
5131
5139
|
]);
|
|
5132
|
-
} catch
|
|
5140
|
+
} catch {
|
|
5133
5141
|
locale = 'en-US';
|
|
5134
5142
|
}
|
|
5135
5143
|
return {
|
|
@@ -5375,8 +5383,7 @@ function $325a3faab7a68acd$export$a16aca283550c30d(options) {
|
|
|
5375
5383
|
|
|
5376
5384
|
|
|
5377
5385
|
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
5378
|
-
let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: // @ts-ignore - undocumented
|
|
5379
|
-
preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented
|
|
5386
|
+
let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented
|
|
5380
5387
|
allowFocusWhenDisabled, // @ts-ignore
|
|
5381
5388
|
onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props;
|
|
5382
5389
|
let additionalProps;
|
|
@@ -5387,7 +5394,7 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
|
5387
5394
|
else additionalProps = {
|
|
5388
5395
|
role: 'button',
|
|
5389
5396
|
tabIndex: isDisabled ? undefined : 0,
|
|
5390
|
-
href: elementType === 'a' && isDisabled ?
|
|
5397
|
+
href: elementType === 'a' && !isDisabled ? href : undefined,
|
|
5391
5398
|
target: elementType === 'a' ? target : undefined,
|
|
5392
5399
|
type: elementType === 'input' ? type : undefined,
|
|
5393
5400
|
disabled: elementType === 'input' ? isDisabled : undefined,
|
|
@@ -5439,8 +5446,20 @@ function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
|
5439
5446
|
*/ /* Inspired by https://github.com/AlmeroSteyn/react-aria-live */ const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7000;
|
|
5440
5447
|
let $319e236875307eab$var$liveAnnouncer = null;
|
|
5441
5448
|
function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
|
|
5442
|
-
if (!$319e236875307eab$var$liveAnnouncer)
|
|
5443
|
-
|
|
5449
|
+
if (!$319e236875307eab$var$liveAnnouncer) {
|
|
5450
|
+
$319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
|
|
5451
|
+
// wait for the live announcer regions to be added to the dom, then announce
|
|
5452
|
+
// otherwise Safari won't announce the message if it's added too quickly
|
|
5453
|
+
// found most times less than 100ms were not consistent when announcing with Safari
|
|
5454
|
+
// IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.
|
|
5455
|
+
// https://github.com/reactwg/react-18/discussions/102
|
|
5456
|
+
// if we're in a test environment, announce without waiting
|
|
5457
|
+
// @ts-ignore
|
|
5458
|
+
if (!(typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined')) setTimeout(()=>{
|
|
5459
|
+
if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
5460
|
+
}, 100);
|
|
5461
|
+
else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
5462
|
+
} else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
5444
5463
|
}
|
|
5445
5464
|
// LiveAnnouncer is implemented using vanilla DOM, not React. That's because as of React 18
|
|
5446
5465
|
// ReactDOM.render is deprecated, and the replacement, ReactDOM.createRoot is moved into a
|
|
@@ -5449,6 +5468,10 @@ function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = 'ass
|
|
|
5449
5468
|
// is simple enough to implement without React, so that's what we do here.
|
|
5450
5469
|
// See this discussion for more details: https://github.com/reactwg/react-18/discussions/125#discussioncomment-2382638
|
|
5451
5470
|
class $319e236875307eab$var$LiveAnnouncer {
|
|
5471
|
+
isAttached() {
|
|
5472
|
+
var _this_node;
|
|
5473
|
+
return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
|
|
5474
|
+
}
|
|
5452
5475
|
createLog(ariaLive) {
|
|
5453
5476
|
let node = document.createElement('div');
|
|
5454
5477
|
node.setAttribute('role', 'log');
|
|
@@ -5462,146 +5485,52 @@ class $319e236875307eab$var$LiveAnnouncer {
|
|
|
5462
5485
|
this.node = null;
|
|
5463
5486
|
}
|
|
5464
5487
|
announce(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
|
|
5488
|
+
var _this_assertiveLog, _this_politeLog;
|
|
5465
5489
|
if (!this.node) return;
|
|
5466
5490
|
let node = document.createElement('div');
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5491
|
+
if (typeof message === 'object') {
|
|
5492
|
+
// To read an aria-labelledby, the element must have an appropriate role, such as img.
|
|
5493
|
+
node.setAttribute('role', 'img');
|
|
5494
|
+
node.setAttribute('aria-labelledby', message['aria-labelledby']);
|
|
5495
|
+
} else node.textContent = message;
|
|
5496
|
+
if (assertiveness === 'assertive') (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);
|
|
5497
|
+
else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);
|
|
5470
5498
|
if (message !== '') setTimeout(()=>{
|
|
5471
5499
|
node.remove();
|
|
5472
5500
|
}, timeout);
|
|
5473
5501
|
}
|
|
5474
5502
|
clear(assertiveness) {
|
|
5475
5503
|
if (!this.node) return;
|
|
5476
|
-
if (!assertiveness || assertiveness === 'assertive') this.assertiveLog.innerHTML = '';
|
|
5477
|
-
if (!assertiveness || assertiveness === 'polite') this.politeLog.innerHTML = '';
|
|
5504
|
+
if ((!assertiveness || assertiveness === 'assertive') && this.assertiveLog) this.assertiveLog.innerHTML = '';
|
|
5505
|
+
if ((!assertiveness || assertiveness === 'polite') && this.politeLog) this.politeLog.innerHTML = '';
|
|
5478
5506
|
}
|
|
5479
5507
|
constructor(){
|
|
5480
|
-
this.node =
|
|
5481
|
-
this.
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
5505
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
5506
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5507
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5508
|
-
*
|
|
5509
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
5510
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
5511
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
5512
|
-
* governing permissions and limitations under the License.
|
|
5513
|
-
*/
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
5517
|
-
let { validationBehavior: validationBehavior, focus: focus } = props;
|
|
5518
|
-
// This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.
|
|
5519
|
-
($f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
5520
|
-
if (validationBehavior === 'native' && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
5521
|
-
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : '';
|
|
5522
|
-
ref.current.setCustomValidity(errorMessage);
|
|
5523
|
-
// Prevent default tooltip for validation message.
|
|
5524
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=605277
|
|
5525
|
-
if (!ref.current.hasAttribute('title')) ref.current.title = '';
|
|
5526
|
-
if (!state.realtimeValidation.isInvalid) state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
|
|
5527
|
-
}
|
|
5528
|
-
});
|
|
5529
|
-
let onReset = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
5530
|
-
state.resetValidation();
|
|
5531
|
-
});
|
|
5532
|
-
let onInvalid = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)((e)=>{
|
|
5533
|
-
var _ref_current;
|
|
5534
|
-
// Only commit validation if we are not already displaying one.
|
|
5535
|
-
// This avoids clearing server errors that the user didn't actually fix.
|
|
5536
|
-
if (!state.displayValidation.isInvalid) state.commitValidation();
|
|
5537
|
-
// Auto focus the first invalid input in a form, unless the error already had its default prevented.
|
|
5538
|
-
let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
|
|
5539
|
-
if (!e.defaultPrevented && ref && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) {
|
|
5540
|
-
var _ref_current1;
|
|
5541
|
-
if (focus) focus();
|
|
5542
|
-
else (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
|
|
5543
|
-
// Always show focus ring.
|
|
5544
|
-
($507fabe10e71c6fb$export$8397ddfc504fdb9a)('keyboard');
|
|
5508
|
+
this.node = null;
|
|
5509
|
+
this.assertiveLog = null;
|
|
5510
|
+
this.politeLog = null;
|
|
5511
|
+
if (typeof document !== 'undefined') {
|
|
5512
|
+
this.node = document.createElement('div');
|
|
5513
|
+
this.node.dataset.liveAnnouncer = 'true';
|
|
5514
|
+
// copied from VisuallyHidden
|
|
5515
|
+
Object.assign(this.node.style, {
|
|
5516
|
+
border: 0,
|
|
5517
|
+
clip: 'rect(0 0 0 0)',
|
|
5518
|
+
clipPath: 'inset(50%)',
|
|
5519
|
+
height: '1px',
|
|
5520
|
+
margin: '-1px',
|
|
5521
|
+
overflow: 'hidden',
|
|
5522
|
+
padding: 0,
|
|
5523
|
+
position: 'absolute',
|
|
5524
|
+
width: '1px',
|
|
5525
|
+
whiteSpace: 'nowrap'
|
|
5526
|
+
});
|
|
5527
|
+
this.assertiveLog = this.createLog('assertive');
|
|
5528
|
+
this.node.appendChild(this.assertiveLog);
|
|
5529
|
+
this.politeLog = this.createLog('polite');
|
|
5530
|
+
this.node.appendChild(this.politeLog);
|
|
5531
|
+
document.body.prepend(this.node);
|
|
5545
5532
|
}
|
|
5546
|
-
// Prevent default browser error UI from appearing.
|
|
5547
|
-
e.preventDefault();
|
|
5548
|
-
});
|
|
5549
|
-
let onChange = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
5550
|
-
state.commitValidation();
|
|
5551
|
-
});
|
|
5552
|
-
(useEffect)(()=>{
|
|
5553
|
-
let input = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
5554
|
-
if (!input) return;
|
|
5555
|
-
let form = input.form;
|
|
5556
|
-
input.addEventListener('invalid', onInvalid);
|
|
5557
|
-
input.addEventListener('change', onChange);
|
|
5558
|
-
form === null || form === void 0 ? void 0 : form.addEventListener('reset', onReset);
|
|
5559
|
-
return ()=>{
|
|
5560
|
-
input.removeEventListener('invalid', onInvalid);
|
|
5561
|
-
input.removeEventListener('change', onChange);
|
|
5562
|
-
form === null || form === void 0 ? void 0 : form.removeEventListener('reset', onReset);
|
|
5563
|
-
};
|
|
5564
|
-
}, [
|
|
5565
|
-
ref,
|
|
5566
|
-
onInvalid,
|
|
5567
|
-
onChange,
|
|
5568
|
-
onReset,
|
|
5569
|
-
validationBehavior
|
|
5570
|
-
]);
|
|
5571
|
-
}
|
|
5572
|
-
function $e93e671b31057976$var$getValidity(input) {
|
|
5573
|
-
// The native ValidityState object is live, meaning each property is a getter that returns the current state.
|
|
5574
|
-
// We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.
|
|
5575
|
-
let validity = input.validity;
|
|
5576
|
-
return {
|
|
5577
|
-
badInput: validity.badInput,
|
|
5578
|
-
customError: validity.customError,
|
|
5579
|
-
patternMismatch: validity.patternMismatch,
|
|
5580
|
-
rangeOverflow: validity.rangeOverflow,
|
|
5581
|
-
rangeUnderflow: validity.rangeUnderflow,
|
|
5582
|
-
stepMismatch: validity.stepMismatch,
|
|
5583
|
-
tooLong: validity.tooLong,
|
|
5584
|
-
tooShort: validity.tooShort,
|
|
5585
|
-
typeMismatch: validity.typeMismatch,
|
|
5586
|
-
valueMissing: validity.valueMissing,
|
|
5587
|
-
valid: validity.valid
|
|
5588
|
-
};
|
|
5589
|
-
}
|
|
5590
|
-
function $e93e671b31057976$var$getNativeValidity(input) {
|
|
5591
|
-
return {
|
|
5592
|
-
isInvalid: !input.validity.valid,
|
|
5593
|
-
validationDetails: $e93e671b31057976$var$getValidity(input),
|
|
5594
|
-
validationErrors: input.validationMessage ? [
|
|
5595
|
-
input.validationMessage
|
|
5596
|
-
] : []
|
|
5597
|
-
};
|
|
5598
|
-
}
|
|
5599
|
-
function $e93e671b31057976$var$getFirstInvalidInput(form) {
|
|
5600
|
-
for(let i = 0; i < form.elements.length; i++){
|
|
5601
|
-
let element = form.elements[i];
|
|
5602
|
-
if (!element.validity.valid) return element;
|
|
5603
5533
|
}
|
|
5604
|
-
return null;
|
|
5605
5534
|
}
|
|
5606
5535
|
|
|
5607
5536
|
/*
|
|
@@ -5666,11 +5595,15 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
5666
5595
|
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
5667
5596
|
} : null;
|
|
5668
5597
|
// Perform custom client side validation.
|
|
5669
|
-
let clientError = (useMemo)(()
|
|
5598
|
+
let clientError = (useMemo)(()=>{
|
|
5599
|
+
if (!validate || value == null) return null;
|
|
5600
|
+
let validateErrors = $e5be200c675c3b3a$var$runValidate(validate, value);
|
|
5601
|
+
return $e5be200c675c3b3a$var$getValidationResult(validateErrors);
|
|
5602
|
+
}, [
|
|
5670
5603
|
validate,
|
|
5671
5604
|
value
|
|
5672
5605
|
]);
|
|
5673
|
-
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation =
|
|
5606
|
+
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = undefined;
|
|
5674
5607
|
// Get relevant server errors from the form.
|
|
5675
5608
|
let serverErrors = (useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
5676
5609
|
let serverErrorMessages = (useMemo)(()=>{
|
|
@@ -5762,7 +5695,7 @@ function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
|
5762
5695
|
}
|
|
5763
5696
|
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
5764
5697
|
if (a === b) return true;
|
|
5765
|
-
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v);
|
|
5698
|
+
return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v);
|
|
5766
5699
|
}
|
|
5767
5700
|
function $e5be200c675c3b3a$export$75ee7c75d68f5b0e(...results) {
|
|
5768
5701
|
let errors = new Set();
|
|
@@ -5787,6 +5720,110 @@ function $e5be200c675c3b3a$export$75ee7c75d68f5b0e(...results) {
|
|
|
5787
5720
|
};
|
|
5788
5721
|
}
|
|
5789
5722
|
|
|
5723
|
+
/*
|
|
5724
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
5725
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
5726
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5727
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5728
|
+
*
|
|
5729
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
5730
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
5731
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
5732
|
+
* governing permissions and limitations under the License.
|
|
5733
|
+
*/
|
|
5734
|
+
|
|
5735
|
+
|
|
5736
|
+
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
5737
|
+
let { validationBehavior: validationBehavior, focus: focus } = props;
|
|
5738
|
+
// This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.
|
|
5739
|
+
($f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
5740
|
+
if (validationBehavior === 'native' && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
5741
|
+
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : '';
|
|
5742
|
+
ref.current.setCustomValidity(errorMessage);
|
|
5743
|
+
// Prevent default tooltip for validation message.
|
|
5744
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=605277
|
|
5745
|
+
if (!ref.current.hasAttribute('title')) ref.current.title = '';
|
|
5746
|
+
if (!state.realtimeValidation.isInvalid) state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
|
|
5747
|
+
}
|
|
5748
|
+
});
|
|
5749
|
+
let onReset = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
5750
|
+
state.resetValidation();
|
|
5751
|
+
});
|
|
5752
|
+
let onInvalid = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)((e)=>{
|
|
5753
|
+
var _ref_current;
|
|
5754
|
+
// Only commit validation if we are not already displaying one.
|
|
5755
|
+
// This avoids clearing server errors that the user didn't actually fix.
|
|
5756
|
+
if (!state.displayValidation.isInvalid) state.commitValidation();
|
|
5757
|
+
// Auto focus the first invalid input in a form, unless the error already had its default prevented.
|
|
5758
|
+
let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
|
|
5759
|
+
if (!e.defaultPrevented && ref && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) {
|
|
5760
|
+
var _ref_current1;
|
|
5761
|
+
if (focus) focus();
|
|
5762
|
+
else (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
|
|
5763
|
+
// Always show focus ring.
|
|
5764
|
+
($507fabe10e71c6fb$export$8397ddfc504fdb9a)('keyboard');
|
|
5765
|
+
}
|
|
5766
|
+
// Prevent default browser error UI from appearing.
|
|
5767
|
+
e.preventDefault();
|
|
5768
|
+
});
|
|
5769
|
+
let onChange = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
5770
|
+
state.commitValidation();
|
|
5771
|
+
});
|
|
5772
|
+
(useEffect)(()=>{
|
|
5773
|
+
let input = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
5774
|
+
if (!input) return;
|
|
5775
|
+
let form = input.form;
|
|
5776
|
+
input.addEventListener('invalid', onInvalid);
|
|
5777
|
+
input.addEventListener('change', onChange);
|
|
5778
|
+
form === null || form === void 0 ? void 0 : form.addEventListener('reset', onReset);
|
|
5779
|
+
return ()=>{
|
|
5780
|
+
input.removeEventListener('invalid', onInvalid);
|
|
5781
|
+
input.removeEventListener('change', onChange);
|
|
5782
|
+
form === null || form === void 0 ? void 0 : form.removeEventListener('reset', onReset);
|
|
5783
|
+
};
|
|
5784
|
+
}, [
|
|
5785
|
+
ref,
|
|
5786
|
+
onInvalid,
|
|
5787
|
+
onChange,
|
|
5788
|
+
onReset,
|
|
5789
|
+
validationBehavior
|
|
5790
|
+
]);
|
|
5791
|
+
}
|
|
5792
|
+
function $e93e671b31057976$var$getValidity(input) {
|
|
5793
|
+
// The native ValidityState object is live, meaning each property is a getter that returns the current state.
|
|
5794
|
+
// We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.
|
|
5795
|
+
let validity = input.validity;
|
|
5796
|
+
return {
|
|
5797
|
+
badInput: validity.badInput,
|
|
5798
|
+
customError: validity.customError,
|
|
5799
|
+
patternMismatch: validity.patternMismatch,
|
|
5800
|
+
rangeOverflow: validity.rangeOverflow,
|
|
5801
|
+
rangeUnderflow: validity.rangeUnderflow,
|
|
5802
|
+
stepMismatch: validity.stepMismatch,
|
|
5803
|
+
tooLong: validity.tooLong,
|
|
5804
|
+
tooShort: validity.tooShort,
|
|
5805
|
+
typeMismatch: validity.typeMismatch,
|
|
5806
|
+
valueMissing: validity.valueMissing,
|
|
5807
|
+
valid: validity.valid
|
|
5808
|
+
};
|
|
5809
|
+
}
|
|
5810
|
+
function $e93e671b31057976$var$getNativeValidity(input) {
|
|
5811
|
+
return {
|
|
5812
|
+
isInvalid: !input.validity.valid,
|
|
5813
|
+
validationDetails: $e93e671b31057976$var$getValidity(input),
|
|
5814
|
+
validationErrors: input.validationMessage ? [
|
|
5815
|
+
input.validationMessage
|
|
5816
|
+
] : []
|
|
5817
|
+
};
|
|
5818
|
+
}
|
|
5819
|
+
function $e93e671b31057976$var$getFirstInvalidInput(form) {
|
|
5820
|
+
for(let i = 0; i < form.elements.length; i++){
|
|
5821
|
+
let element = form.elements[i];
|
|
5822
|
+
if (!element.validity.valid) return element;
|
|
5823
|
+
}
|
|
5824
|
+
return null;
|
|
5825
|
+
}
|
|
5826
|
+
|
|
5790
5827
|
/*
|
|
5791
5828
|
* Copyright 2020 Adobe. All rights reserved.
|
|
5792
5829
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -5868,6 +5905,8 @@ function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
|
|
|
5868
5905
|
|
|
5869
5906
|
|
|
5870
5907
|
|
|
5908
|
+
|
|
5909
|
+
|
|
5871
5910
|
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
5872
5911
|
// Create validation state here because it doesn't make sense to add to general useToggleState.
|
|
5873
5912
|
let validationState = ($e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
@@ -5886,8 +5925,18 @@ function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
|
5886
5925
|
// https://css-tricks.com/indeterminate-checkboxes/
|
|
5887
5926
|
if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
|
|
5888
5927
|
});
|
|
5928
|
+
// Reset validation state on label press for checkbox with a hidden input.
|
|
5929
|
+
let { pressProps: pressProps } = ($f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
5930
|
+
isDisabled: isDisabled || isReadOnly,
|
|
5931
|
+
onPress () {
|
|
5932
|
+
// @ts-expect-error
|
|
5933
|
+
let { [($e5be200c675c3b3a$export$a763b9476acd3eb)]: groupValidationState } = props;
|
|
5934
|
+
let { commitValidation: commitValidation } = groupValidationState ? groupValidationState : validationState;
|
|
5935
|
+
commitValidation();
|
|
5936
|
+
}
|
|
5937
|
+
});
|
|
5889
5938
|
return {
|
|
5890
|
-
labelProps: labelProps,
|
|
5939
|
+
labelProps: ($3ef42575df84b30b$export$9d1611c77c2fe928)(labelProps, pressProps),
|
|
5891
5940
|
inputProps: {
|
|
5892
5941
|
...inputProps,
|
|
5893
5942
|
checked: isSelected,
|
|
@@ -6169,13 +6218,175 @@ function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
|
|
|
6169
6218
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
6170
6219
|
* governing permissions and limitations under the License.
|
|
6171
6220
|
*/
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6221
|
+
|
|
6222
|
+
|
|
6223
|
+
const $5c3e21d68f1c4674$var$styles = {
|
|
6224
|
+
border: 0,
|
|
6225
|
+
clip: 'rect(0 0 0 0)',
|
|
6226
|
+
clipPath: 'inset(50%)',
|
|
6227
|
+
height: '1px',
|
|
6228
|
+
margin: '-1px',
|
|
6229
|
+
overflow: 'hidden',
|
|
6230
|
+
padding: 0,
|
|
6231
|
+
position: 'absolute',
|
|
6232
|
+
width: '1px',
|
|
6233
|
+
whiteSpace: 'nowrap'
|
|
6177
6234
|
};
|
|
6178
|
-
|
|
6235
|
+
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
|
|
6236
|
+
let { style: style, isFocusable: isFocusable } = props;
|
|
6237
|
+
let [isFocused, setFocused] = (useState)(false);
|
|
6238
|
+
let { focusWithinProps: focusWithinProps } = ($9ab94262bd0047c7$export$420e68273165f4ec)({
|
|
6239
|
+
isDisabled: !isFocusable,
|
|
6240
|
+
onFocusWithinChange: (val)=>setFocused(val)
|
|
6241
|
+
});
|
|
6242
|
+
// If focused, don't hide the element.
|
|
6243
|
+
let combinedStyles = (useMemo)(()=>{
|
|
6244
|
+
if (isFocused) return style;
|
|
6245
|
+
else if (style) return {
|
|
6246
|
+
...$5c3e21d68f1c4674$var$styles,
|
|
6247
|
+
...style
|
|
6248
|
+
};
|
|
6249
|
+
else return $5c3e21d68f1c4674$var$styles;
|
|
6250
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6251
|
+
}, [
|
|
6252
|
+
isFocused
|
|
6253
|
+
]);
|
|
6254
|
+
return {
|
|
6255
|
+
visuallyHiddenProps: {
|
|
6256
|
+
...focusWithinProps,
|
|
6257
|
+
style: combinedStyles
|
|
6258
|
+
}
|
|
6259
|
+
};
|
|
6260
|
+
}
|
|
6261
|
+
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
|
|
6262
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6263
|
+
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
|
|
6264
|
+
let { visuallyHiddenProps: visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
6265
|
+
return /*#__PURE__*/ ($dbSRa$react).createElement(Element, ($3ef42575df84b30b$export$9d1611c77c2fe928)(otherProps, visuallyHiddenProps), children);
|
|
6266
|
+
}
|
|
6267
|
+
|
|
6268
|
+
/*
|
|
6269
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6270
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6271
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
6272
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6273
|
+
*
|
|
6274
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
6275
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
6276
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
6277
|
+
* governing permissions and limitations under the License.
|
|
6278
|
+
*/
|
|
6279
|
+
|
|
6280
|
+
|
|
6281
|
+
|
|
6282
|
+
|
|
6283
|
+
|
|
6284
|
+
|
|
6285
|
+
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
|
|
6286
|
+
let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props;
|
|
6287
|
+
let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || '', props.onChange);
|
|
6288
|
+
let { focusableProps: focusableProps } = ($e6afbd83fe6ebbd2$export$4c014de7c8940b4c)(props, ref);
|
|
6289
|
+
let validationState = ($e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
6290
|
+
...props,
|
|
6291
|
+
value: value
|
|
6292
|
+
});
|
|
6293
|
+
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = validationState.displayValidation;
|
|
6294
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = ($2baaea4c71418dea$export$294aa081a6c6f55d)({
|
|
6295
|
+
...props,
|
|
6296
|
+
isInvalid: isInvalid,
|
|
6297
|
+
errorMessage: props.errorMessage || validationErrors
|
|
6298
|
+
});
|
|
6299
|
+
let domProps = ($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(props, {
|
|
6300
|
+
labelable: true
|
|
6301
|
+
});
|
|
6302
|
+
const inputOnlyProps = {
|
|
6303
|
+
type: type,
|
|
6304
|
+
pattern: props.pattern
|
|
6305
|
+
};
|
|
6306
|
+
($99facab73266f662$export$5add1d006293d136)(ref, value, setValue);
|
|
6307
|
+
($e93e671b31057976$export$b8473d3665f3a75a)(props, validationState, ref);
|
|
6308
|
+
(useEffect)(()=>{
|
|
6309
|
+
// This works around a React/Chrome bug that prevents textarea elements from validating when controlled.
|
|
6310
|
+
// We prevent React from updating defaultValue (i.e. children) of textarea when `value` changes,
|
|
6311
|
+
// which causes Chrome to skip validation. Only updating `value` is ok in our case since our
|
|
6312
|
+
// textareas are always controlled. React is planning on removing this synchronization in a
|
|
6313
|
+
// future major version.
|
|
6314
|
+
// https://github.com/facebook/react/issues/19474
|
|
6315
|
+
// https://github.com/facebook/react/issues/11896
|
|
6316
|
+
if (ref.current instanceof ($431fbd86ca7dc216$export$f21a1ffae260145a)(ref.current).HTMLTextAreaElement) {
|
|
6317
|
+
let input = ref.current;
|
|
6318
|
+
Object.defineProperty(input, 'defaultValue', {
|
|
6319
|
+
get: ()=>input.value,
|
|
6320
|
+
set: ()=>{},
|
|
6321
|
+
configurable: true
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
}, [
|
|
6325
|
+
ref
|
|
6326
|
+
]);
|
|
6327
|
+
return {
|
|
6328
|
+
labelProps: labelProps,
|
|
6329
|
+
inputProps: ($3ef42575df84b30b$export$9d1611c77c2fe928)(domProps, inputElementType === 'input' ? inputOnlyProps : undefined, {
|
|
6330
|
+
disabled: isDisabled,
|
|
6331
|
+
readOnly: isReadOnly,
|
|
6332
|
+
required: isRequired && validationBehavior === 'native',
|
|
6333
|
+
'aria-required': isRequired && validationBehavior === 'aria' || undefined,
|
|
6334
|
+
'aria-invalid': isInvalid || undefined,
|
|
6335
|
+
'aria-errormessage': props['aria-errormessage'],
|
|
6336
|
+
'aria-activedescendant': props['aria-activedescendant'],
|
|
6337
|
+
'aria-autocomplete': props['aria-autocomplete'],
|
|
6338
|
+
'aria-haspopup': props['aria-haspopup'],
|
|
6339
|
+
value: value,
|
|
6340
|
+
onChange: (e)=>setValue(e.target.value),
|
|
6341
|
+
autoComplete: props.autoComplete,
|
|
6342
|
+
autoCapitalize: props.autoCapitalize,
|
|
6343
|
+
maxLength: props.maxLength,
|
|
6344
|
+
minLength: props.minLength,
|
|
6345
|
+
name: props.name,
|
|
6346
|
+
placeholder: props.placeholder,
|
|
6347
|
+
inputMode: props.inputMode,
|
|
6348
|
+
// Clipboard events
|
|
6349
|
+
onCopy: props.onCopy,
|
|
6350
|
+
onCut: props.onCut,
|
|
6351
|
+
onPaste: props.onPaste,
|
|
6352
|
+
// Composition events
|
|
6353
|
+
onCompositionEnd: props.onCompositionEnd,
|
|
6354
|
+
onCompositionStart: props.onCompositionStart,
|
|
6355
|
+
onCompositionUpdate: props.onCompositionUpdate,
|
|
6356
|
+
// Selection events
|
|
6357
|
+
onSelect: props.onSelect,
|
|
6358
|
+
// Input events
|
|
6359
|
+
onBeforeInput: props.onBeforeInput,
|
|
6360
|
+
onInput: props.onInput,
|
|
6361
|
+
...focusableProps,
|
|
6362
|
+
...fieldProps
|
|
6363
|
+
}),
|
|
6364
|
+
descriptionProps: descriptionProps,
|
|
6365
|
+
errorMessageProps: errorMessageProps,
|
|
6366
|
+
isInvalid: isInvalid,
|
|
6367
|
+
validationErrors: validationErrors,
|
|
6368
|
+
validationDetails: validationDetails
|
|
6369
|
+
};
|
|
6370
|
+
}
|
|
6371
|
+
|
|
6372
|
+
/*
|
|
6373
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6374
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6375
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
6376
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6377
|
+
*
|
|
6378
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
6379
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
6380
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
6381
|
+
* governing permissions and limitations under the License.
|
|
6382
|
+
*/
|
|
6383
|
+
const $edcf132a9284368a$var$AXIS = {
|
|
6384
|
+
top: 'top',
|
|
6385
|
+
bottom: 'top',
|
|
6386
|
+
left: 'left',
|
|
6387
|
+
right: 'left'
|
|
6388
|
+
};
|
|
6389
|
+
const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
|
|
6179
6390
|
top: 'bottom',
|
|
6180
6391
|
bottom: 'top',
|
|
6181
6392
|
left: 'right',
|
|
@@ -6194,12 +6405,12 @@ const $edcf132a9284368a$var$TOTAL_SIZE = {
|
|
|
6194
6405
|
height: 'totalHeight'
|
|
6195
6406
|
};
|
|
6196
6407
|
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
|
|
6197
|
-
|
|
6198
|
-
let $edcf132a9284368a$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
6408
|
+
let $edcf132a9284368a$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
|
|
6199
6409
|
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
6200
6410
|
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
6201
6411
|
let scroll = {};
|
|
6202
|
-
|
|
6412
|
+
var _visualViewport_scale;
|
|
6413
|
+
let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
|
|
6203
6414
|
if (containerNode.tagName === 'BODY') {
|
|
6204
6415
|
let documentElement = document.documentElement;
|
|
6205
6416
|
totalWidth = documentElement.clientWidth;
|
|
@@ -6231,8 +6442,10 @@ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
|
6231
6442
|
// before pinch zoom happens
|
|
6232
6443
|
scroll.top = 0;
|
|
6233
6444
|
scroll.left = 0;
|
|
6234
|
-
|
|
6235
|
-
|
|
6445
|
+
var _visualViewport_pageTop;
|
|
6446
|
+
top = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
|
|
6447
|
+
var _visualViewport_pageLeft;
|
|
6448
|
+
left = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
|
|
6236
6449
|
}
|
|
6237
6450
|
return {
|
|
6238
6451
|
width: width,
|
|
@@ -6261,7 +6474,8 @@ boundaryDimensions, // The dimensions of the containing block element that the p
|
|
|
6261
6474
|
// is portaled somewhere other than the body and has an ancestor with
|
|
6262
6475
|
// position: relative/absolute, it will be different.
|
|
6263
6476
|
containerDimensions, padding, containerOffsetWithBoundary) {
|
|
6264
|
-
|
|
6477
|
+
var _containerDimensions_scroll_axis;
|
|
6478
|
+
let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0;
|
|
6265
6479
|
// The height/width of the boundary. Matches the axis along which we are adjusting the overlay position
|
|
6266
6480
|
let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
|
|
6267
6481
|
// Calculate the edges of the boundary (accomodating for the boundary padding) and the edges of the overlay.
|
|
@@ -6306,14 +6520,16 @@ function $edcf132a9284368a$var$parsePlacement(input) {
|
|
|
6306
6520
|
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
|
|
6307
6521
|
let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
|
|
6308
6522
|
let position = {};
|
|
6523
|
+
var _childOffset_crossAxis;
|
|
6309
6524
|
// button position
|
|
6310
|
-
position[crossAxis] = childOffset[crossAxis];
|
|
6525
|
+
position[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0;
|
|
6526
|
+
var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1;
|
|
6311
6527
|
if (crossPlacement === 'center') // + (button size / 2) - (overlay size / 2)
|
|
6312
6528
|
// at this point the overlay center should match the button center
|
|
6313
|
-
position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
|
|
6529
|
+
position[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2;
|
|
6314
6530
|
else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
|
|
6315
6531
|
// at this point the overlay bottom should match the button bottom
|
|
6316
|
-
position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
|
|
6532
|
+
position[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0);
|
|
6317
6533
|
/* else {
|
|
6318
6534
|
the overlay top should match the button top
|
|
6319
6535
|
} */
|
|
@@ -6336,23 +6552,26 @@ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions,
|
|
|
6336
6552
|
}
|
|
6337
6553
|
function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
|
|
6338
6554
|
const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
|
|
6555
|
+
var _position_bottom;
|
|
6339
6556
|
// For cases where position is set via "bottom" instead of "top", we need to calculate the true overlay top with respect to the boundary. Reverse calculate this with the same method
|
|
6340
6557
|
// used in computePosition.
|
|
6341
|
-
let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - position.bottom - overlayHeight);
|
|
6558
|
+
let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight);
|
|
6559
|
+
var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1;
|
|
6342
6560
|
let maxHeight = heightGrowthDirection !== 'top' ? // We want the distance between the top of the overlay to the bottom of the boundary
|
|
6343
|
-
Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the
|
|
6344
|
-
-
|
|
6345
|
-
- (margins.top + margins.bottom + padding // save additional space for margin and padding
|
|
6561
|
+
Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop // this is the top of the overlay
|
|
6562
|
+
- (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding // save additional space for margin and padding
|
|
6346
6563
|
)) : Math.max(0, overlayTop + overlayHeight // this is the bottom of the overlay
|
|
6347
|
-
- (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
|
|
6348
|
-
) - (margins.top + margins.bottom + padding // save additional space for margin and padding
|
|
6564
|
+
- (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0) // this is the top of the boundary
|
|
6565
|
+
) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding // save additional space for margin and padding
|
|
6349
6566
|
));
|
|
6350
6567
|
return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
|
|
6351
6568
|
}
|
|
6352
6569
|
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
6353
6570
|
let { placement: placement, axis: axis, size: size } = placementInfo;
|
|
6354
|
-
|
|
6355
|
-
return Math.max(0,
|
|
6571
|
+
var _boundaryDimensions_scroll_axis, _margins_axis;
|
|
6572
|
+
if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
6573
|
+
var _margins_axis1;
|
|
6574
|
+
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
6356
6575
|
}
|
|
6357
6576
|
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
6358
6577
|
let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
|
|
@@ -6398,8 +6617,9 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
6398
6617
|
let preferredArrowPosition = childOffset[crossAxis] + .5 * childOffset[crossSize] - position[crossAxis] - margins[$edcf132a9284368a$var$AXIS[crossAxis]];
|
|
6399
6618
|
// Min/Max position limits for the arrow with respect to the overlay
|
|
6400
6619
|
const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
|
|
6620
|
+
var _margins_left, _margins_right, _margins_top, _margins_bottom;
|
|
6401
6621
|
// overlaySize[crossSize] - margins = true size of the overlay
|
|
6402
|
-
const overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === 'left' ? margins.left + margins.right : margins.top + margins.bottom;
|
|
6622
|
+
const overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === 'left' ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
|
|
6403
6623
|
const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
|
|
6404
6624
|
// Min/Max position limits for the arrow with respect to the trigger/overlay anchor element
|
|
6405
6625
|
// Same margin accomodation done here as well as for the preferredArrowPosition
|
|
@@ -6430,8 +6650,10 @@ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
|
6430
6650
|
}
|
|
6431
6651
|
let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
|
|
6432
6652
|
let margins = $edcf132a9284368a$var$getMargins(overlayNode);
|
|
6433
|
-
|
|
6434
|
-
overlaySize.
|
|
6653
|
+
var _margins_left, _margins_right;
|
|
6654
|
+
overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0);
|
|
6655
|
+
var _margins_top, _margins_bottom;
|
|
6656
|
+
overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
|
|
6435
6657
|
let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
|
|
6436
6658
|
let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
|
|
6437
6659
|
let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
|
|
@@ -6504,9 +6726,7 @@ function $edcf132a9284368a$var$getContainingBlock(node) {
|
|
|
6504
6726
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
6505
6727
|
function $edcf132a9284368a$var$isContainingBlock(node) {
|
|
6506
6728
|
let style = window.getComputedStyle(node);
|
|
6507
|
-
return style.transform !== 'none' || /transform|perspective/.test(style.willChange) || style.filter !== 'none' || style.contain === 'paint' ||
|
|
6508
|
-
'backdropFilter' in style && style.backdropFilter !== 'none' || // @ts-ignore
|
|
6509
|
-
'WebkitBackdropFilter' in style && style.WebkitBackdropFilter !== 'none';
|
|
6729
|
+
return style.transform !== 'none' || /transform|perspective/.test(style.willChange) || style.filter !== 'none' || style.contain === 'paint' || 'backdropFilter' in style && style.backdropFilter !== 'none' || 'WebkitBackdropFilter' in style && style.WebkitBackdropFilter !== 'none';
|
|
6510
6730
|
}
|
|
6511
6731
|
|
|
6512
6732
|
/*
|
|
@@ -6563,18 +6783,11 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
|
6563
6783
|
|
|
6564
6784
|
|
|
6565
6785
|
|
|
6566
|
-
|
|
6567
|
-
let $2a41e45df1593e64$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
6786
|
+
let $2a41e45df1593e64$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
|
|
6568
6787
|
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
6569
6788
|
let { direction: direction } = ($18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
|
|
6570
6789
|
let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = 'bottom', containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== 'undefined' ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
|
|
6571
|
-
let [position, setPosition] = (useState)(
|
|
6572
|
-
position: {},
|
|
6573
|
-
arrowOffsetLeft: undefined,
|
|
6574
|
-
arrowOffsetTop: undefined,
|
|
6575
|
-
maxHeight: undefined,
|
|
6576
|
-
placement: undefined
|
|
6577
|
-
});
|
|
6790
|
+
let [position, setPosition] = (useState)(null);
|
|
6578
6791
|
let deps = [
|
|
6579
6792
|
shouldUpdatePosition,
|
|
6580
6793
|
placement,
|
|
@@ -6610,17 +6823,20 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
6610
6823
|
// changes, the focused element appears to stay in the same position.
|
|
6611
6824
|
let anchor = null;
|
|
6612
6825
|
if (scrollRef.current && scrollRef.current.contains(document.activeElement)) {
|
|
6613
|
-
|
|
6826
|
+
var _document_activeElement;
|
|
6827
|
+
let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect();
|
|
6614
6828
|
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
6829
|
+
var _anchorRect_top;
|
|
6615
6830
|
// Anchor from the top if the offset is in the top half of the scrollable element,
|
|
6616
6831
|
// otherwise anchor from the bottom.
|
|
6617
6832
|
anchor = {
|
|
6618
6833
|
type: 'top',
|
|
6619
|
-
offset: anchorRect.top - scrollRect.top
|
|
6834
|
+
offset: ((_anchorRect_top = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.top) !== null && _anchorRect_top !== void 0 ? _anchorRect_top : 0) - scrollRect.top
|
|
6620
6835
|
};
|
|
6621
6836
|
if (anchor.offset > scrollRect.height / 2) {
|
|
6622
6837
|
anchor.type = 'bottom';
|
|
6623
|
-
|
|
6838
|
+
var _anchorRect_bottom;
|
|
6839
|
+
anchor.offset = ((_anchorRect_bottom = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.bottom) !== null && _anchorRect_bottom !== void 0 ? _anchorRect_bottom : 0) - scrollRect.bottom;
|
|
6624
6840
|
}
|
|
6625
6841
|
}
|
|
6626
6842
|
// Always reset the overlay's previous max height if not defined by the user so that we can compensate for
|
|
@@ -6647,6 +6863,7 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
6647
6863
|
arrowSize: arrowSize,
|
|
6648
6864
|
arrowBoundaryOffset: arrowBoundaryOffset
|
|
6649
6865
|
});
|
|
6866
|
+
if (!position.position) return;
|
|
6650
6867
|
// Modify overlay styles directly so positioning happens immediately without the need of a second render
|
|
6651
6868
|
// This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
|
|
6652
6869
|
overlay.style.top = '';
|
|
@@ -6654,9 +6871,9 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
6654
6871
|
overlay.style.left = '';
|
|
6655
6872
|
overlay.style.right = '';
|
|
6656
6873
|
Object.keys(position.position).forEach((key)=>overlay.style[key] = position.position[key] + 'px');
|
|
6657
|
-
overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' :
|
|
6874
|
+
overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';
|
|
6658
6875
|
// Restore scroll position relative to anchor element.
|
|
6659
|
-
if (anchor) {
|
|
6876
|
+
if (anchor && document.activeElement && scrollRef.current) {
|
|
6660
6877
|
let anchorRect = document.activeElement.getBoundingClientRect();
|
|
6661
6878
|
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
6662
6879
|
let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
|
|
@@ -6709,7 +6926,7 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
6709
6926
|
updatePosition
|
|
6710
6927
|
]);
|
|
6711
6928
|
let close = (useCallback)(()=>{
|
|
6712
|
-
if (!isResizing.current) onClose();
|
|
6929
|
+
if (!isResizing.current) onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
6713
6930
|
}, [
|
|
6714
6931
|
onClose,
|
|
6715
6932
|
isResizing
|
|
@@ -6721,23 +6938,23 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
6721
6938
|
isOpen: isOpen,
|
|
6722
6939
|
onClose: onClose && close
|
|
6723
6940
|
});
|
|
6724
|
-
var _position_maxHeight;
|
|
6941
|
+
var _position_maxHeight, _position_placement;
|
|
6725
6942
|
return {
|
|
6726
6943
|
overlayProps: {
|
|
6727
6944
|
style: {
|
|
6728
6945
|
position: 'absolute',
|
|
6729
6946
|
zIndex: 100000,
|
|
6730
|
-
...position.position,
|
|
6731
|
-
maxHeight: (_position_maxHeight = position.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : '100vh'
|
|
6947
|
+
...position === null || position === void 0 ? void 0 : position.position,
|
|
6948
|
+
maxHeight: (_position_maxHeight = position === null || position === void 0 ? void 0 : position.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : '100vh'
|
|
6732
6949
|
}
|
|
6733
6950
|
},
|
|
6734
|
-
placement: position.placement,
|
|
6951
|
+
placement: (_position_placement = position === null || position === void 0 ? void 0 : position.placement) !== null && _position_placement !== void 0 ? _position_placement : null,
|
|
6735
6952
|
arrowProps: {
|
|
6736
6953
|
'aria-hidden': 'true',
|
|
6737
6954
|
role: 'presentation',
|
|
6738
6955
|
style: {
|
|
6739
|
-
left: position.arrowOffsetLeft,
|
|
6740
|
-
top: position.arrowOffsetTop
|
|
6956
|
+
left: position === null || position === void 0 ? void 0 : position.arrowOffsetLeft,
|
|
6957
|
+
top: position === null || position === void 0 ? void 0 : position.arrowOffsetTop
|
|
6741
6958
|
}
|
|
6742
6959
|
},
|
|
6743
6960
|
updatePosition: updatePosition
|
|
@@ -6817,7 +7034,7 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
6817
7034
|
// Handle clicking outside the overlay to close it
|
|
6818
7035
|
($e0b6e0b68ec7f50f$export$872b660ac5a1ff98)({
|
|
6819
7036
|
ref: ref,
|
|
6820
|
-
onInteractOutside: isDismissable && isOpen ? onInteractOutside :
|
|
7037
|
+
onInteractOutside: isDismissable && isOpen ? onInteractOutside : undefined,
|
|
6821
7038
|
onInteractOutsideStart: onInteractOutsideStart
|
|
6822
7039
|
});
|
|
6823
7040
|
let { focusWithinProps: focusWithinProps } = ($9ab94262bd0047c7$export$420e68273165f4ec)({
|
|
@@ -6833,7 +7050,7 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
6833
7050
|
// do not close the outer overlay. At this point, the active scope should
|
|
6834
7051
|
// still be the outer overlay, since blur events run before focus.
|
|
6835
7052
|
if (!e.relatedTarget || ($9bf71ea28793e738$export$1258395f99bf9cbf)(e.relatedTarget)) return;
|
|
6836
|
-
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
7053
|
+
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
6837
7054
|
}
|
|
6838
7055
|
});
|
|
6839
7056
|
let onPointerDownUnderlay = (e)=>{
|
|
@@ -6884,7 +7101,7 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
6884
7101
|
triggerProps: {
|
|
6885
7102
|
'aria-haspopup': ariaHasPopup,
|
|
6886
7103
|
'aria-expanded': isOpen,
|
|
6887
|
-
'aria-controls': isOpen ? overlayId :
|
|
7104
|
+
'aria-controls': isOpen ? overlayId : undefined,
|
|
6888
7105
|
onPress: state.toggle
|
|
6889
7106
|
},
|
|
6890
7107
|
overlayProps: {
|
|
@@ -6904,7 +7121,6 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
6904
7121
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
6905
7122
|
* governing permissions and limitations under the License.
|
|
6906
7123
|
*/
|
|
6907
|
-
// @ts-ignore
|
|
6908
7124
|
const $49c51c25361d4cd2$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
6909
7125
|
// HTML input types that do not cause the software keyboard to appear.
|
|
6910
7126
|
const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
|
|
@@ -7087,22 +7303,26 @@ function $49c51c25361d4cd2$var$setStyle(element, style, value) {
|
|
|
7087
7303
|
}
|
|
7088
7304
|
// Adds an event listener to an element, and returns a function to remove it.
|
|
7089
7305
|
function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
|
|
7306
|
+
// internal function, so it's ok to ignore the difficult to fix type error
|
|
7307
|
+
// @ts-ignore
|
|
7090
7308
|
target.addEventListener(event, handler, options);
|
|
7091
7309
|
return ()=>{
|
|
7310
|
+
// @ts-ignore
|
|
7092
7311
|
target.removeEventListener(event, handler, options);
|
|
7093
7312
|
};
|
|
7094
7313
|
}
|
|
7095
7314
|
function $49c51c25361d4cd2$var$scrollIntoView(target) {
|
|
7096
7315
|
let root = document.scrollingElement || document.documentElement;
|
|
7097
|
-
|
|
7316
|
+
let nextTarget = target;
|
|
7317
|
+
while(nextTarget && nextTarget !== root){
|
|
7098
7318
|
// Find the parent scrollable element and adjust the scroll position if the target is not already in view.
|
|
7099
|
-
let scrollable = ($62d8ded9296f3872$export$cfa2225e87938781)(
|
|
7100
|
-
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !==
|
|
7319
|
+
let scrollable = ($62d8ded9296f3872$export$cfa2225e87938781)(nextTarget);
|
|
7320
|
+
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
|
|
7101
7321
|
let scrollableTop = scrollable.getBoundingClientRect().top;
|
|
7102
|
-
let targetTop =
|
|
7103
|
-
if (targetTop > scrollableTop +
|
|
7322
|
+
let targetTop = nextTarget.getBoundingClientRect().top;
|
|
7323
|
+
if (targetTop > scrollableTop + nextTarget.clientHeight) scrollable.scrollTop += targetTop - scrollableTop;
|
|
7104
7324
|
}
|
|
7105
|
-
|
|
7325
|
+
nextTarget = scrollable.parentElement;
|
|
7106
7326
|
}
|
|
7107
7327
|
}
|
|
7108
7328
|
function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
|
|
@@ -7150,7 +7370,7 @@ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
|
|
|
7150
7370
|
let context = (useContext)($f57aed4a881a3485$var$Context);
|
|
7151
7371
|
return {
|
|
7152
7372
|
modalProviderProps: {
|
|
7153
|
-
'aria-hidden': context && context.modalCount > 0 ? true :
|
|
7373
|
+
'aria-hidden': context && context.modalCount > 0 ? true : undefined
|
|
7154
7374
|
}
|
|
7155
7375
|
};
|
|
7156
7376
|
}
|
|
@@ -7422,64 +7642,6 @@ $a2f21f5f14f60553$exports = {
|
|
|
7422
7642
|
"zh-TW": $2b2734393847c884$exports
|
|
7423
7643
|
};
|
|
7424
7644
|
|
|
7425
|
-
/*
|
|
7426
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
7427
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7428
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7429
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7430
|
-
*
|
|
7431
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
7432
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
7433
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
7434
|
-
* governing permissions and limitations under the License.
|
|
7435
|
-
*/
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
const $5c3e21d68f1c4674$var$styles = {
|
|
7439
|
-
border: 0,
|
|
7440
|
-
clip: 'rect(0 0 0 0)',
|
|
7441
|
-
clipPath: 'inset(50%)',
|
|
7442
|
-
height: '1px',
|
|
7443
|
-
margin: '-1px',
|
|
7444
|
-
overflow: 'hidden',
|
|
7445
|
-
padding: 0,
|
|
7446
|
-
position: 'absolute',
|
|
7447
|
-
width: '1px',
|
|
7448
|
-
whiteSpace: 'nowrap'
|
|
7449
|
-
};
|
|
7450
|
-
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
|
|
7451
|
-
let { style: style, isFocusable: isFocusable } = props;
|
|
7452
|
-
let [isFocused, setFocused] = (useState)(false);
|
|
7453
|
-
let { focusWithinProps: focusWithinProps } = ($9ab94262bd0047c7$export$420e68273165f4ec)({
|
|
7454
|
-
isDisabled: !isFocusable,
|
|
7455
|
-
onFocusWithinChange: (val)=>setFocused(val)
|
|
7456
|
-
});
|
|
7457
|
-
// If focused, don't hide the element.
|
|
7458
|
-
let combinedStyles = (useMemo)(()=>{
|
|
7459
|
-
if (isFocused) return style;
|
|
7460
|
-
else if (style) return {
|
|
7461
|
-
...$5c3e21d68f1c4674$var$styles,
|
|
7462
|
-
...style
|
|
7463
|
-
};
|
|
7464
|
-
else return $5c3e21d68f1c4674$var$styles;
|
|
7465
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7466
|
-
}, [
|
|
7467
|
-
isFocused
|
|
7468
|
-
]);
|
|
7469
|
-
return {
|
|
7470
|
-
visuallyHiddenProps: {
|
|
7471
|
-
...focusWithinProps,
|
|
7472
|
-
style: combinedStyles
|
|
7473
|
-
}
|
|
7474
|
-
};
|
|
7475
|
-
}
|
|
7476
|
-
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
|
|
7477
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7478
|
-
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
|
|
7479
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
7480
|
-
return /*#__PURE__*/ ($dbSRa$react).createElement(Element, ($3ef42575df84b30b$export$9d1611c77c2fe928)(otherProps, visuallyHiddenProps), children);
|
|
7481
|
-
}
|
|
7482
|
-
|
|
7483
7645
|
function $parcel$interopDefault$5(a) {
|
|
7484
7646
|
return a && a.__esModule ? a.default : a;
|
|
7485
7647
|
}
|
|
@@ -7541,7 +7703,7 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
7541
7703
|
// Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
|
|
7542
7704
|
// made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
|
|
7543
7705
|
// For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
|
|
7544
|
-
if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
|
|
7706
|
+
if (visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
|
|
7545
7707
|
// Skip this node but continue to children if one of the targets is inside the node.
|
|
7546
7708
|
for (let target of visibleNodes){
|
|
7547
7709
|
if (node.contains(target)) return NodeFilter.FILTER_SKIP;
|
|
@@ -7616,6 +7778,7 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
7616
7778
|
observer.disconnect();
|
|
7617
7779
|
for (let node of hiddenNodes){
|
|
7618
7780
|
let count = $5e3802645cc19319$var$refCountMap.get(node);
|
|
7781
|
+
if (count == null) continue;
|
|
7619
7782
|
if (count === 1) {
|
|
7620
7783
|
node.removeAttribute('aria-hidden');
|
|
7621
7784
|
$5e3802645cc19319$var$refCountMap.delete(node);
|
|
@@ -7647,7 +7810,8 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
7647
7810
|
function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
7648
7811
|
let { triggerRef: triggerRef, popoverRef: popoverRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, ...otherProps } = props;
|
|
7649
7812
|
let { overlayProps: overlayProps, underlayProps: underlayProps } = ($a11501f3d1d39e6c$export$ea8f71083e90600f)({
|
|
7650
|
-
|
|
7813
|
+
// If popover is in the top layer, it should not prevent other popovers from being dismissed.
|
|
7814
|
+
isOpen: state.isOpen && !otherProps['data-react-aria-top-layer'],
|
|
7651
7815
|
onClose: state.close,
|
|
7652
7816
|
shouldCloseOnBlur: true,
|
|
7653
7817
|
isDismissable: !isNonModal,
|
|
@@ -7659,7 +7823,7 @@ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
|
7659
7823
|
targetRef: triggerRef,
|
|
7660
7824
|
overlayRef: popoverRef,
|
|
7661
7825
|
isOpen: state.isOpen,
|
|
7662
|
-
onClose: isNonModal ? state.close :
|
|
7826
|
+
onClose: isNonModal ? state.close : undefined
|
|
7663
7827
|
});
|
|
7664
7828
|
($49c51c25361d4cd2$export$ee0f7cc6afcd1c18)({
|
|
7665
7829
|
isDisabled: isNonModal || !state.isOpen
|
|
@@ -7777,7 +7941,7 @@ function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
|
7777
7941
|
});
|
|
7778
7942
|
($337b884510726a0d$export$14c98a7594375490)();
|
|
7779
7943
|
(useEffect)(()=>{
|
|
7780
|
-
if (state.isOpen) return ($5e3802645cc19319$export$1c3ebcada18427bf)([
|
|
7944
|
+
if (state.isOpen && ref.current) return ($5e3802645cc19319$export$1c3ebcada18427bf)([
|
|
7781
7945
|
ref.current
|
|
7782
7946
|
]);
|
|
7783
7947
|
}, [
|
|
@@ -7850,7 +8014,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
7850
8014
|
let { keyboardDelegate: keyboardDelegate, selectionManager: selectionManager, onTypeSelect: onTypeSelect } = options;
|
|
7851
8015
|
let state = (useRef)({
|
|
7852
8016
|
search: '',
|
|
7853
|
-
timeout:
|
|
8017
|
+
timeout: undefined
|
|
7854
8018
|
}).current;
|
|
7855
8019
|
let onKeyDown = (e)=>{
|
|
7856
8020
|
let character = $fb3050f43d946246$var$getStringForKey(e.key);
|
|
@@ -7864,14 +8028,16 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
7864
8028
|
if (!('continuePropagation' in e)) e.stopPropagation();
|
|
7865
8029
|
}
|
|
7866
8030
|
state.search += character;
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
8031
|
+
if (keyboardDelegate.getKeyForSearch != null) {
|
|
8032
|
+
// Use the delegate to find a key to focus.
|
|
8033
|
+
// Prioritize items after the currently focused item, falling back to searching the whole list.
|
|
8034
|
+
let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
|
|
8035
|
+
// If no key found, search from the top.
|
|
8036
|
+
if (key == null) key = keyboardDelegate.getKeyForSearch(state.search);
|
|
8037
|
+
if (key != null) {
|
|
8038
|
+
selectionManager.setFocusedKey(key);
|
|
8039
|
+
if (onTypeSelect) onTypeSelect(key);
|
|
8040
|
+
}
|
|
7875
8041
|
}
|
|
7876
8042
|
clearTimeout(state.timeout);
|
|
7877
8043
|
state.timeout = setTimeout(()=>{
|
|
@@ -7882,7 +8048,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
7882
8048
|
typeSelectProps: {
|
|
7883
8049
|
// Using a capturing listener to catch the keydown event before
|
|
7884
8050
|
// other hooks in order to handle the Spacebar event.
|
|
7885
|
-
onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown :
|
|
8051
|
+
onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : undefined
|
|
7886
8052
|
}
|
|
7887
8053
|
};
|
|
7888
8054
|
}
|
|
@@ -7919,21 +8085,23 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
7919
8085
|
let { direction: direction } = ($18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
|
|
7920
8086
|
let router = ($ea8dcbcb9ea1b556$export$9a302a45f65d0572)();
|
|
7921
8087
|
let onKeyDown = (e)=>{
|
|
8088
|
+
var _ref_current;
|
|
7922
8089
|
// Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes
|
|
7923
8090
|
if (e.altKey && e.key === 'Tab') e.preventDefault();
|
|
7924
8091
|
// Keyboard events bubble through portals. Don't handle keyboard events
|
|
7925
8092
|
// for elements outside the collection (e.g. menus).
|
|
7926
|
-
if (!ref.current.contains(e.target)) return;
|
|
8093
|
+
if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e.target))) return;
|
|
7927
8094
|
const navigateToKey = (key, childFocus)=>{
|
|
7928
8095
|
if (key != null) {
|
|
7929
8096
|
if (manager.isLink(key) && linkBehavior === 'selection' && selectOnFocus && !($feb5ffebff200149$export$d3e3bd3e26688c04)(e)) {
|
|
8097
|
+
var _scrollRef_current;
|
|
7930
8098
|
// Set focused key and re-render synchronously to bring item into view if needed.
|
|
7931
8099
|
(flushSync)(()=>{
|
|
7932
8100
|
manager.setFocusedKey(key, childFocus);
|
|
7933
8101
|
});
|
|
7934
|
-
let item = scrollRef.current.querySelector(`[data-key="${CSS.escape(key.toString())}"]`);
|
|
8102
|
+
let item = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.querySelector(`[data-key="${CSS.escape(key.toString())}"]`);
|
|
7935
8103
|
let itemProps = manager.getItemProps(key);
|
|
7936
|
-
router.open(item, e, itemProps.href, itemProps.routerOptions);
|
|
8104
|
+
if (item) router.open(item, e, itemProps.href, itemProps.routerOptions);
|
|
7937
8105
|
return;
|
|
7938
8106
|
}
|
|
7939
8107
|
manager.setFocusedKey(key, childFocus);
|
|
@@ -7945,38 +8113,46 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
7945
8113
|
switch(e.key){
|
|
7946
8114
|
case 'ArrowDown':
|
|
7947
8115
|
if (delegate.getKeyBelow) {
|
|
7948
|
-
var _delegate_getFirstKey, _delegate_getFirstKey1;
|
|
7949
|
-
|
|
7950
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
|
|
8116
|
+
var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
|
|
8117
|
+
let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
|
|
7951
8118
|
if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
|
|
7952
|
-
|
|
8119
|
+
if (nextKey != null) {
|
|
8120
|
+
e.preventDefault();
|
|
8121
|
+
navigateToKey(nextKey);
|
|
8122
|
+
}
|
|
7953
8123
|
}
|
|
7954
8124
|
break;
|
|
7955
8125
|
case 'ArrowUp':
|
|
7956
8126
|
if (delegate.getKeyAbove) {
|
|
7957
|
-
var _delegate_getLastKey, _delegate_getLastKey1;
|
|
7958
|
-
|
|
7959
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
|
|
8127
|
+
var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
|
|
8128
|
+
let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
|
|
7960
8129
|
if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
|
|
7961
|
-
|
|
8130
|
+
if (nextKey != null) {
|
|
8131
|
+
e.preventDefault();
|
|
8132
|
+
navigateToKey(nextKey);
|
|
8133
|
+
}
|
|
7962
8134
|
}
|
|
7963
8135
|
break;
|
|
7964
8136
|
case 'ArrowLeft':
|
|
7965
8137
|
if (delegate.getKeyLeftOf) {
|
|
7966
|
-
var _delegate_getFirstKey2, _delegate_getLastKey2;
|
|
7967
|
-
|
|
7968
|
-
let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
|
|
8138
|
+
var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
|
|
8139
|
+
let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
|
|
7969
8140
|
if (nextKey == null && shouldFocusWrap) nextKey = direction === 'rtl' ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
|
|
7970
|
-
|
|
8141
|
+
if (nextKey != null) {
|
|
8142
|
+
e.preventDefault();
|
|
8143
|
+
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
|
|
8144
|
+
}
|
|
7971
8145
|
}
|
|
7972
8146
|
break;
|
|
7973
8147
|
case 'ArrowRight':
|
|
7974
8148
|
if (delegate.getKeyRightOf) {
|
|
7975
|
-
var _delegate_getLastKey3, _delegate_getFirstKey3;
|
|
7976
|
-
|
|
7977
|
-
let nextKey = delegate.getKeyRightOf(manager.focusedKey);
|
|
8149
|
+
var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
|
|
8150
|
+
let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
|
|
7978
8151
|
if (nextKey == null && shouldFocusWrap) nextKey = direction === 'rtl' ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
|
|
7979
|
-
|
|
8152
|
+
if (nextKey != null) {
|
|
8153
|
+
e.preventDefault();
|
|
8154
|
+
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
|
|
8155
|
+
}
|
|
7980
8156
|
}
|
|
7981
8157
|
break;
|
|
7982
8158
|
case 'Home':
|
|
@@ -7984,8 +8160,10 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
7984
8160
|
e.preventDefault();
|
|
7985
8161
|
let firstKey = delegate.getFirstKey(manager.focusedKey, ($feb5ffebff200149$export$16792effe837dba3)(e));
|
|
7986
8162
|
manager.setFocusedKey(firstKey);
|
|
7987
|
-
if (
|
|
7988
|
-
|
|
8163
|
+
if (firstKey != null) {
|
|
8164
|
+
if (($feb5ffebff200149$export$16792effe837dba3)(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(firstKey);
|
|
8165
|
+
else if (selectOnFocus) manager.replaceSelection(firstKey);
|
|
8166
|
+
}
|
|
7989
8167
|
}
|
|
7990
8168
|
break;
|
|
7991
8169
|
case 'End':
|
|
@@ -7993,22 +8171,28 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
7993
8171
|
e.preventDefault();
|
|
7994
8172
|
let lastKey = delegate.getLastKey(manager.focusedKey, ($feb5ffebff200149$export$16792effe837dba3)(e));
|
|
7995
8173
|
manager.setFocusedKey(lastKey);
|
|
7996
|
-
if (
|
|
7997
|
-
|
|
8174
|
+
if (lastKey != null) {
|
|
8175
|
+
if (($feb5ffebff200149$export$16792effe837dba3)(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(lastKey);
|
|
8176
|
+
else if (selectOnFocus) manager.replaceSelection(lastKey);
|
|
8177
|
+
}
|
|
7998
8178
|
}
|
|
7999
8179
|
break;
|
|
8000
8180
|
case 'PageDown':
|
|
8001
|
-
if (delegate.getKeyPageBelow) {
|
|
8002
|
-
e.preventDefault();
|
|
8181
|
+
if (delegate.getKeyPageBelow && manager.focusedKey != null) {
|
|
8003
8182
|
let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
|
|
8004
|
-
|
|
8183
|
+
if (nextKey != null) {
|
|
8184
|
+
e.preventDefault();
|
|
8185
|
+
navigateToKey(nextKey);
|
|
8186
|
+
}
|
|
8005
8187
|
}
|
|
8006
8188
|
break;
|
|
8007
8189
|
case 'PageUp':
|
|
8008
|
-
if (delegate.getKeyPageAbove) {
|
|
8009
|
-
e.preventDefault();
|
|
8190
|
+
if (delegate.getKeyPageAbove && manager.focusedKey != null) {
|
|
8010
8191
|
let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
|
|
8011
|
-
|
|
8192
|
+
if (nextKey != null) {
|
|
8193
|
+
e.preventDefault();
|
|
8194
|
+
navigateToKey(nextKey);
|
|
8195
|
+
}
|
|
8012
8196
|
}
|
|
8013
8197
|
break;
|
|
8014
8198
|
case 'a':
|
|
@@ -8037,7 +8221,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8037
8221
|
let walker = ($9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current, {
|
|
8038
8222
|
tabbable: true
|
|
8039
8223
|
});
|
|
8040
|
-
let next;
|
|
8224
|
+
let next = undefined;
|
|
8041
8225
|
let last;
|
|
8042
8226
|
do {
|
|
8043
8227
|
last = walker.lastChild();
|
|
@@ -8055,10 +8239,12 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8055
8239
|
top: 0,
|
|
8056
8240
|
left: 0
|
|
8057
8241
|
});
|
|
8058
|
-
($e9faafb641e167db$export$90fc3a17d93f704c)(scrollRef, 'scroll', isVirtualized ?
|
|
8242
|
+
($e9faafb641e167db$export$90fc3a17d93f704c)(scrollRef, 'scroll', isVirtualized ? undefined : ()=>{
|
|
8243
|
+
var _scrollRef_current, _scrollRef_current1;
|
|
8244
|
+
var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
|
|
8059
8245
|
scrollPos.current = {
|
|
8060
|
-
top: scrollRef.current.scrollTop,
|
|
8061
|
-
left: scrollRef.current.scrollLeft
|
|
8246
|
+
top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
|
|
8247
|
+
left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
|
|
8062
8248
|
};
|
|
8063
8249
|
});
|
|
8064
8250
|
let onFocus = (e)=>{
|
|
@@ -8071,6 +8257,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8071
8257
|
if (!e.currentTarget.contains(e.target)) return;
|
|
8072
8258
|
manager.setFocused(true);
|
|
8073
8259
|
if (manager.focusedKey == null) {
|
|
8260
|
+
var _delegate_getLastKey, _delegate_getFirstKey;
|
|
8074
8261
|
let navigateToFirstKey = (key)=>{
|
|
8075
8262
|
if (key != null) {
|
|
8076
8263
|
manager.setFocusedKey(key);
|
|
@@ -8082,14 +8269,14 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8082
8269
|
// and either focus the first or last item accordingly.
|
|
8083
8270
|
let relatedTarget = e.relatedTarget;
|
|
8084
8271
|
var _manager_lastSelectedKey, _manager_firstSelectedKey;
|
|
8085
|
-
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : delegate.getLastKey());
|
|
8086
|
-
else navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : delegate.getFirstKey());
|
|
8087
|
-
} else if (!isVirtualized) {
|
|
8272
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
|
|
8273
|
+
else navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
|
|
8274
|
+
} else if (!isVirtualized && scrollRef.current) {
|
|
8088
8275
|
// Restore the scroll position to what it was before.
|
|
8089
8276
|
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
8090
8277
|
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
8091
8278
|
}
|
|
8092
|
-
if (manager.focusedKey != null) {
|
|
8279
|
+
if (manager.focusedKey != null && scrollRef.current) {
|
|
8093
8280
|
// Refocus and scroll the focused item into view if it exists within the scrollable region.
|
|
8094
8281
|
let element = scrollRef.current.querySelector(`[data-key="${CSS.escape(manager.focusedKey.toString())}"]`);
|
|
8095
8282
|
if (element) {
|
|
@@ -8109,10 +8296,13 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8109
8296
|
const autoFocusRef = (useRef)(autoFocus);
|
|
8110
8297
|
(useEffect)(()=>{
|
|
8111
8298
|
if (autoFocusRef.current) {
|
|
8299
|
+
var _delegate_getFirstKey, _delegate_getLastKey;
|
|
8112
8300
|
let focusedKey = null;
|
|
8301
|
+
var _delegate_getFirstKey1;
|
|
8113
8302
|
// Check focus strategy to determine which item to focus
|
|
8114
|
-
if (autoFocus === 'first') focusedKey = delegate.getFirstKey();
|
|
8115
|
-
|
|
8303
|
+
if (autoFocus === 'first') focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
|
|
8304
|
+
var _delegate_getLastKey1;
|
|
8305
|
+
if (autoFocus === 'last') focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
|
|
8116
8306
|
// If there are any selected keys, make the first one the new focus target
|
|
8117
8307
|
let selectedKeys = manager.selectedKeys;
|
|
8118
8308
|
if (selectedKeys.size) {
|
|
@@ -8124,14 +8314,14 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8124
8314
|
manager.setFocused(true);
|
|
8125
8315
|
manager.setFocusedKey(focusedKey);
|
|
8126
8316
|
// If no default focus key is selected, focus the collection itself.
|
|
8127
|
-
if (focusedKey == null && !shouldUseVirtualFocus) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8317
|
+
if (focusedKey == null && !shouldUseVirtualFocus && ref.current) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8128
8318
|
}
|
|
8129
8319
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8130
8320
|
}, []);
|
|
8131
8321
|
// Scroll the focused element into view when the focusedKey changes.
|
|
8132
8322
|
let lastFocusedKey = (useRef)(manager.focusedKey);
|
|
8133
8323
|
(useEffect)(()=>{
|
|
8134
|
-
if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || autoFocusRef.current) &&
|
|
8324
|
+
if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || autoFocusRef.current) && scrollRef.current && ref.current) {
|
|
8135
8325
|
let modality = ($507fabe10e71c6fb$export$630ff653c5ada6a9)();
|
|
8136
8326
|
let element = ref.current.querySelector(`[data-key="${CSS.escape(manager.focusedKey.toString())}"]`);
|
|
8137
8327
|
if (!element) // If item element wasn't found, return early (don't update autoFocusRef and lastFocusedKey).
|
|
@@ -8146,7 +8336,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8146
8336
|
}
|
|
8147
8337
|
}
|
|
8148
8338
|
// If the focused key becomes null (e.g. the last item is deleted), focus the whole collection.
|
|
8149
|
-
if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8339
|
+
if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8150
8340
|
lastFocusedKey.current = manager.focusedKey;
|
|
8151
8341
|
autoFocusRef.current = false;
|
|
8152
8342
|
});
|
|
@@ -8174,7 +8364,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
8174
8364
|
// This will be marshalled to either the first or last item depending on where focus came from.
|
|
8175
8365
|
// If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try
|
|
8176
8366
|
// to move real DOM focus to the element anyway.
|
|
8177
|
-
let tabIndex;
|
|
8367
|
+
let tabIndex = undefined;
|
|
8178
8368
|
if (!shouldUseVirtualFocus) tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
8179
8369
|
return {
|
|
8180
8370
|
collectionProps: {
|
|
@@ -8207,7 +8397,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
8207
8397
|
else {
|
|
8208
8398
|
if (manager.selectionMode === 'none') return;
|
|
8209
8399
|
if (manager.isLink(key)) {
|
|
8210
|
-
if (linkBehavior === 'selection') {
|
|
8400
|
+
if (linkBehavior === 'selection' && ref.current) {
|
|
8211
8401
|
let itemProps = manager.getItemProps(key);
|
|
8212
8402
|
router.open(ref.current, e, itemProps.href, itemProps.routerOptions);
|
|
8213
8403
|
// Always set selected keys back to what they were so that select and combobox close.
|
|
@@ -8229,7 +8419,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
8229
8419
|
let isFocused = key === manager.focusedKey;
|
|
8230
8420
|
if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
|
|
8231
8421
|
if (focus) focus();
|
|
8232
|
-
else if (document.activeElement !== ref.current) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8422
|
+
else if (document.activeElement !== ref.current && ref.current) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
8233
8423
|
}
|
|
8234
8424
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8235
8425
|
}, [
|
|
@@ -8272,7 +8462,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
8272
8462
|
let hadPrimaryActionOnPressStart = (useRef)(false);
|
|
8273
8463
|
let performAction = (e)=>{
|
|
8274
8464
|
if (onAction) onAction();
|
|
8275
|
-
if (hasLinkAction) {
|
|
8465
|
+
if (hasLinkAction && ref.current) {
|
|
8276
8466
|
let itemProps = manager.getItemProps(key);
|
|
8277
8467
|
router.open(ref.current, e, itemProps.href, itemProps.routerOptions);
|
|
8278
8468
|
}
|
|
@@ -8300,10 +8490,10 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
8300
8490
|
} else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
8301
8491
|
};
|
|
8302
8492
|
else {
|
|
8303
|
-
itemPressProps.onPressUp = hasPrimaryAction ?
|
|
8493
|
+
itemPressProps.onPressUp = hasPrimaryAction ? undefined : (e)=>{
|
|
8304
8494
|
if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
8305
8495
|
};
|
|
8306
|
-
itemPressProps.onPress = hasPrimaryAction ? performAction :
|
|
8496
|
+
itemPressProps.onPress = hasPrimaryAction ? performAction : undefined;
|
|
8307
8497
|
}
|
|
8308
8498
|
} else {
|
|
8309
8499
|
itemPressProps.onPressStart = (e)=>{
|
|
@@ -8396,6 +8586,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
|
8396
8586
|
*/ class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
|
|
8397
8587
|
getItemRect(key) {
|
|
8398
8588
|
let container = this.ref.current;
|
|
8589
|
+
if (!container) return null;
|
|
8399
8590
|
let item = key != null ? container.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
|
|
8400
8591
|
if (!item) return null;
|
|
8401
8592
|
let containerRect = container.getBoundingClientRect();
|
|
@@ -8409,18 +8600,20 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
|
8409
8600
|
}
|
|
8410
8601
|
getContentSize() {
|
|
8411
8602
|
let container = this.ref.current;
|
|
8603
|
+
var _container_scrollWidth, _container_scrollHeight;
|
|
8412
8604
|
return {
|
|
8413
|
-
width: container.scrollWidth,
|
|
8414
|
-
height: container.scrollHeight
|
|
8605
|
+
width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
|
|
8606
|
+
height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
|
|
8415
8607
|
};
|
|
8416
8608
|
}
|
|
8417
8609
|
getVisibleRect() {
|
|
8418
8610
|
let container = this.ref.current;
|
|
8611
|
+
var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
|
|
8419
8612
|
return {
|
|
8420
|
-
x: container.scrollLeft,
|
|
8421
|
-
y: container.scrollTop,
|
|
8422
|
-
width: container.offsetWidth,
|
|
8423
|
-
height: container.offsetHeight
|
|
8613
|
+
x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
|
|
8614
|
+
y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
|
|
8615
|
+
width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
|
|
8616
|
+
height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
|
|
8424
8617
|
};
|
|
8425
8618
|
}
|
|
8426
8619
|
constructor(ref){
|
|
@@ -8445,34 +8638,37 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
|
|
|
8445
8638
|
var _item_props;
|
|
8446
8639
|
return this.disabledBehavior === 'all' && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
|
|
8447
8640
|
}
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
while(
|
|
8451
|
-
let item = this.collection.getItem(
|
|
8452
|
-
if (item.type === 'item' && !this.isDisabled(item)) return
|
|
8453
|
-
|
|
8641
|
+
findNextNonDisabled(key, getNext) {
|
|
8642
|
+
let nextKey = key;
|
|
8643
|
+
while(nextKey != null){
|
|
8644
|
+
let item = this.collection.getItem(nextKey);
|
|
8645
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return nextKey;
|
|
8646
|
+
nextKey = getNext(nextKey);
|
|
8454
8647
|
}
|
|
8455
8648
|
return null;
|
|
8456
8649
|
}
|
|
8650
|
+
getNextKey(key) {
|
|
8651
|
+
let nextKey = key;
|
|
8652
|
+
nextKey = this.collection.getKeyAfter(nextKey);
|
|
8653
|
+
return this.findNextNonDisabled(nextKey, (key)=>this.collection.getKeyAfter(key));
|
|
8654
|
+
}
|
|
8457
8655
|
getPreviousKey(key) {
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
if (item.type === 'item' && !this.isDisabled(item)) return key;
|
|
8462
|
-
key = this.collection.getKeyBefore(key);
|
|
8463
|
-
}
|
|
8464
|
-
return null;
|
|
8656
|
+
let nextKey = key;
|
|
8657
|
+
nextKey = this.collection.getKeyBefore(nextKey);
|
|
8658
|
+
return this.findNextNonDisabled(nextKey, (key)=>this.collection.getKeyBefore(key));
|
|
8465
8659
|
}
|
|
8466
8660
|
findKey(key, nextKey, shouldSkip) {
|
|
8467
|
-
let
|
|
8468
|
-
|
|
8661
|
+
let tempKey = key;
|
|
8662
|
+
let itemRect = this.layoutDelegate.getItemRect(tempKey);
|
|
8663
|
+
if (!itemRect || tempKey == null) return null;
|
|
8469
8664
|
// Find the item above or below in the same column.
|
|
8470
8665
|
let prevRect = itemRect;
|
|
8471
8666
|
do {
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8667
|
+
tempKey = nextKey(tempKey);
|
|
8668
|
+
if (tempKey == null) break;
|
|
8669
|
+
itemRect = this.layoutDelegate.getItemRect(tempKey);
|
|
8670
|
+
}while (itemRect && shouldSkip(prevRect, itemRect) && tempKey != null);
|
|
8671
|
+
return tempKey;
|
|
8476
8672
|
}
|
|
8477
8673
|
isSameRow(prevRect, itemRect) {
|
|
8478
8674
|
return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
|
|
@@ -8492,6 +8688,13 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
|
|
|
8492
8688
|
return right ? this.getPreviousKey(key) : this.getNextKey(key);
|
|
8493
8689
|
}
|
|
8494
8690
|
getKeyRightOf(key) {
|
|
8691
|
+
// This is a temporary solution for CardView until we refactor useSelectableCollection.
|
|
8692
|
+
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042
|
|
8693
|
+
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf';
|
|
8694
|
+
if (this.layoutDelegate[layoutDelegateMethod]) {
|
|
8695
|
+
key = this.layoutDelegate[layoutDelegateMethod](key);
|
|
8696
|
+
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
|
|
8697
|
+
}
|
|
8495
8698
|
if (this.layout === 'grid') {
|
|
8496
8699
|
if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'rtl');
|
|
8497
8700
|
else return this.findKey(key, (key)=>this.getNextColumn(key, this.direction === 'rtl'), this.isSameColumn);
|
|
@@ -8499,6 +8702,11 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
|
|
|
8499
8702
|
return null;
|
|
8500
8703
|
}
|
|
8501
8704
|
getKeyLeftOf(key) {
|
|
8705
|
+
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf';
|
|
8706
|
+
if (this.layoutDelegate[layoutDelegateMethod]) {
|
|
8707
|
+
key = this.layoutDelegate[layoutDelegateMethod](key);
|
|
8708
|
+
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
|
|
8709
|
+
}
|
|
8502
8710
|
if (this.layout === 'grid') {
|
|
8503
8711
|
if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'ltr');
|
|
8504
8712
|
else return this.findKey(key, (key)=>this.getNextColumn(key, this.direction === 'ltr'), this.isSameColumn);
|
|
@@ -8507,61 +8715,53 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
|
|
|
8507
8715
|
}
|
|
8508
8716
|
getFirstKey() {
|
|
8509
8717
|
let key = this.collection.getFirstKey();
|
|
8510
|
-
|
|
8511
|
-
let item = this.collection.getItem(key);
|
|
8512
|
-
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key;
|
|
8513
|
-
key = this.collection.getKeyAfter(key);
|
|
8514
|
-
}
|
|
8515
|
-
return null;
|
|
8718
|
+
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key));
|
|
8516
8719
|
}
|
|
8517
8720
|
getLastKey() {
|
|
8518
8721
|
let key = this.collection.getLastKey();
|
|
8519
|
-
|
|
8520
|
-
let item = this.collection.getItem(key);
|
|
8521
|
-
if (item.type === 'item' && !this.isDisabled(item)) return key;
|
|
8522
|
-
key = this.collection.getKeyBefore(key);
|
|
8523
|
-
}
|
|
8524
|
-
return null;
|
|
8722
|
+
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key));
|
|
8525
8723
|
}
|
|
8526
8724
|
getKeyPageAbove(key) {
|
|
8527
8725
|
let menu = this.ref.current;
|
|
8528
8726
|
let itemRect = this.layoutDelegate.getItemRect(key);
|
|
8529
8727
|
if (!itemRect) return null;
|
|
8530
|
-
if (!($cc38e7bd3fc7b213$export$2bb74740c4e19def)(menu)) return this.getFirstKey();
|
|
8728
|
+
if (menu && !($cc38e7bd3fc7b213$export$2bb74740c4e19def)(menu)) return this.getFirstKey();
|
|
8729
|
+
let nextKey = key;
|
|
8531
8730
|
if (this.orientation === 'horizontal') {
|
|
8532
8731
|
let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
|
|
8533
|
-
while(itemRect && itemRect.x > pageX){
|
|
8534
|
-
|
|
8535
|
-
itemRect =
|
|
8732
|
+
while(itemRect && itemRect.x > pageX && nextKey != null){
|
|
8733
|
+
nextKey = this.getKeyAbove(nextKey);
|
|
8734
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
8536
8735
|
}
|
|
8537
8736
|
} else {
|
|
8538
8737
|
let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
|
|
8539
|
-
while(itemRect && itemRect.y > pageY){
|
|
8540
|
-
|
|
8541
|
-
itemRect =
|
|
8738
|
+
while(itemRect && itemRect.y > pageY && nextKey != null){
|
|
8739
|
+
nextKey = this.getKeyAbove(nextKey);
|
|
8740
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
8542
8741
|
}
|
|
8543
8742
|
}
|
|
8544
|
-
return
|
|
8743
|
+
return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
|
|
8545
8744
|
}
|
|
8546
8745
|
getKeyPageBelow(key) {
|
|
8547
8746
|
let menu = this.ref.current;
|
|
8548
8747
|
let itemRect = this.layoutDelegate.getItemRect(key);
|
|
8549
8748
|
if (!itemRect) return null;
|
|
8550
|
-
if (!($cc38e7bd3fc7b213$export$2bb74740c4e19def)(menu)) return this.getLastKey();
|
|
8749
|
+
if (menu && !($cc38e7bd3fc7b213$export$2bb74740c4e19def)(menu)) return this.getLastKey();
|
|
8750
|
+
let nextKey = key;
|
|
8551
8751
|
if (this.orientation === 'horizontal') {
|
|
8552
8752
|
let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
|
|
8553
|
-
while(itemRect && itemRect.x < pageX){
|
|
8554
|
-
|
|
8555
|
-
itemRect =
|
|
8753
|
+
while(itemRect && itemRect.x < pageX && nextKey != null){
|
|
8754
|
+
nextKey = this.getKeyBelow(nextKey);
|
|
8755
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
8556
8756
|
}
|
|
8557
8757
|
} else {
|
|
8558
8758
|
let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
|
|
8559
|
-
while(itemRect && itemRect.y < pageY){
|
|
8560
|
-
|
|
8561
|
-
itemRect =
|
|
8759
|
+
while(itemRect && itemRect.y < pageY && nextKey != null){
|
|
8760
|
+
nextKey = this.getKeyBelow(nextKey);
|
|
8761
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
8562
8762
|
}
|
|
8563
8763
|
}
|
|
8564
|
-
return
|
|
8764
|
+
return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
|
|
8565
8765
|
}
|
|
8566
8766
|
getKeyForSearch(search, fromKey) {
|
|
8567
8767
|
if (!this.collator) return null;
|
|
@@ -8569,9 +8769,10 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
|
|
|
8569
8769
|
let key = fromKey || this.getFirstKey();
|
|
8570
8770
|
while(key != null){
|
|
8571
8771
|
let item = collection.getItem(key);
|
|
8772
|
+
if (!item) return null;
|
|
8572
8773
|
let substring = item.textValue.slice(0, search.length);
|
|
8573
8774
|
if (item.textValue && this.collator.compare(substring, search) === 0) return key;
|
|
8574
|
-
key = this.
|
|
8775
|
+
key = this.getNextKey(key);
|
|
8575
8776
|
}
|
|
8576
8777
|
return null;
|
|
8577
8778
|
}
|
|
@@ -8742,17 +8943,26 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8742
8943
|
}
|
|
8743
8944
|
*iterateCollection(props) {
|
|
8744
8945
|
let { children: children, items: items } = props;
|
|
8745
|
-
if (
|
|
8946
|
+
if (($dbSRa$react).isValidElement(children) && children.type === ($dbSRa$react).Fragment) yield* this.iterateCollection({
|
|
8947
|
+
children: children.props.children,
|
|
8948
|
+
items: items
|
|
8949
|
+
});
|
|
8950
|
+
else if (typeof children === 'function') {
|
|
8746
8951
|
if (!items) throw new Error('props.children was a function but props.items is missing');
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8952
|
+
let index = 0;
|
|
8953
|
+
for (let item of items){
|
|
8954
|
+
yield* this.getFullNode({
|
|
8955
|
+
value: item,
|
|
8956
|
+
index: index
|
|
8957
|
+
}, {
|
|
8958
|
+
renderer: children
|
|
8959
|
+
});
|
|
8960
|
+
index++;
|
|
8961
|
+
}
|
|
8752
8962
|
} else {
|
|
8753
8963
|
let items = [];
|
|
8754
8964
|
($dbSRa$react).Children.forEach(children, (child)=>{
|
|
8755
|
-
items.push(child);
|
|
8965
|
+
if (child) items.push(child);
|
|
8756
8966
|
});
|
|
8757
8967
|
let index = 0;
|
|
8758
8968
|
for (let item of items){
|
|
@@ -8785,6 +8995,19 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8785
8995
|
};
|
|
8786
8996
|
}
|
|
8787
8997
|
*getFullNode(partialNode, state, parentKey, parentNode) {
|
|
8998
|
+
if (($dbSRa$react).isValidElement(partialNode.element) && partialNode.element.type === ($dbSRa$react).Fragment) {
|
|
8999
|
+
let children = [];
|
|
9000
|
+
($dbSRa$react).Children.forEach(partialNode.element.props.children, (child)=>{
|
|
9001
|
+
children.push(child);
|
|
9002
|
+
});
|
|
9003
|
+
var _partialNode_index;
|
|
9004
|
+
let index = (_partialNode_index = partialNode.index) !== null && _partialNode_index !== void 0 ? _partialNode_index : 0;
|
|
9005
|
+
for (const child of children)yield* this.getFullNode({
|
|
9006
|
+
element: child,
|
|
9007
|
+
index: index++
|
|
9008
|
+
}, state, parentKey, parentNode);
|
|
9009
|
+
return;
|
|
9010
|
+
}
|
|
8788
9011
|
// If there's a value instead of an element on the node, and a parent renderer function is available,
|
|
8789
9012
|
// use it to render an element for the value.
|
|
8790
9013
|
let element = partialNode.element;
|
|
@@ -8803,17 +9026,19 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8803
9026
|
if (($dbSRa$react).isValidElement(element)) {
|
|
8804
9027
|
let type = element.type;
|
|
8805
9028
|
if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {
|
|
8806
|
-
let name =
|
|
9029
|
+
let name = element.type;
|
|
8807
9030
|
throw new Error(`Unknown element <${name}> in collection.`);
|
|
8808
9031
|
}
|
|
8809
9032
|
let childNodes = type.getCollectionNode(element.props, this.context);
|
|
8810
|
-
|
|
9033
|
+
var _partialNode_index1;
|
|
9034
|
+
let index = (_partialNode_index1 = partialNode.index) !== null && _partialNode_index1 !== void 0 ? _partialNode_index1 : 0;
|
|
8811
9035
|
let result = childNodes.next();
|
|
8812
9036
|
while(!result.done && result.value){
|
|
8813
9037
|
let childNode = result.value;
|
|
8814
9038
|
partialNode.index = index;
|
|
8815
|
-
|
|
8816
|
-
|
|
9039
|
+
var _childNode_key;
|
|
9040
|
+
let nodeKey = (_childNode_key = childNode.key) !== null && _childNode_key !== void 0 ? _childNode_key : null;
|
|
9041
|
+
if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
|
|
8817
9042
|
let nodes = this.getFullNode({
|
|
8818
9043
|
...childNode,
|
|
8819
9044
|
key: nodeKey,
|
|
@@ -8824,12 +9049,14 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8824
9049
|
...nodes
|
|
8825
9050
|
];
|
|
8826
9051
|
for (let node of children){
|
|
9052
|
+
var _childNode_value, _ref;
|
|
8827
9053
|
// Cache the node based on its value
|
|
8828
|
-
node.value = childNode.value
|
|
9054
|
+
node.value = (_ref = (_childNode_value = childNode.value) !== null && _childNode_value !== void 0 ? _childNode_value : partialNode.value) !== null && _ref !== void 0 ? _ref : null;
|
|
8829
9055
|
if (node.value) this.cache.set(node.value, node);
|
|
9056
|
+
var _parentNode_type;
|
|
8830
9057
|
// The partial node may have specified a type for the child in order to specify a constraint.
|
|
8831
9058
|
// Verify that the full node that was built recursively matches this type.
|
|
8832
|
-
if (partialNode.type && node.type !== partialNode.type) throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
|
|
9059
|
+
if (partialNode.type && node.type !== partialNode.type) throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node.type)}> in <${$eb2240fc39a57fa5$var$capitalize((_parentNode_type = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== null && _parentNode_type !== void 0 ? _parentNode_type : 'unknown parent type')}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
|
|
8833
9060
|
index++;
|
|
8834
9061
|
yield node;
|
|
8835
9062
|
}
|
|
@@ -8838,25 +9065,26 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8838
9065
|
return;
|
|
8839
9066
|
}
|
|
8840
9067
|
// Ignore invalid elements
|
|
8841
|
-
if (partialNode.key == null) return;
|
|
9068
|
+
if (partialNode.key == null || partialNode.type == null) return;
|
|
8842
9069
|
// Create full node
|
|
8843
9070
|
let builder = this;
|
|
9071
|
+
var _partialNode_value, _partialNode_textValue;
|
|
8844
9072
|
let node = {
|
|
8845
9073
|
type: partialNode.type,
|
|
8846
9074
|
props: partialNode.props,
|
|
8847
9075
|
key: partialNode.key,
|
|
8848
9076
|
parentKey: parentNode ? parentNode.key : null,
|
|
8849
|
-
value: partialNode.value,
|
|
9077
|
+
value: (_partialNode_value = partialNode.value) !== null && _partialNode_value !== void 0 ? _partialNode_value : null,
|
|
8850
9078
|
level: parentNode ? parentNode.level + 1 : 0,
|
|
8851
9079
|
index: partialNode.index,
|
|
8852
9080
|
rendered: partialNode.rendered,
|
|
8853
|
-
textValue: partialNode.textValue,
|
|
9081
|
+
textValue: (_partialNode_textValue = partialNode.textValue) !== null && _partialNode_textValue !== void 0 ? _partialNode_textValue : '',
|
|
8854
9082
|
'aria-label': partialNode['aria-label'],
|
|
8855
9083
|
wrapper: partialNode.wrapper,
|
|
8856
9084
|
shouldInvalidate: partialNode.shouldInvalidate,
|
|
8857
|
-
hasChildNodes: partialNode.hasChildNodes,
|
|
9085
|
+
hasChildNodes: partialNode.hasChildNodes || false,
|
|
8858
9086
|
childNodes: $eb2240fc39a57fa5$var$iterable(function*() {
|
|
8859
|
-
if (!partialNode.hasChildNodes) return;
|
|
9087
|
+
if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
|
|
8860
9088
|
let index = 0;
|
|
8861
9089
|
for (let child of partialNode.childNodes()){
|
|
8862
9090
|
// Ensure child keys are globally unique by prepending the parent node's key
|
|
@@ -8865,8 +9093,10 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
8865
9093
|
// but another parent has key `ab` and its child has a key `c`. The combined keys would result in both
|
|
8866
9094
|
// children having a key of `abc`.
|
|
8867
9095
|
child.key = `${node.key}${child.key}`;
|
|
8868
|
-
|
|
8869
|
-
|
|
9096
|
+
let nodes = builder.getFullNode({
|
|
9097
|
+
...child,
|
|
9098
|
+
index: index
|
|
9099
|
+
}, builder.getChildState(state, child), node.key, node);
|
|
8870
9100
|
for (let node of nodes){
|
|
8871
9101
|
index++;
|
|
8872
9102
|
yield node;
|
|
@@ -8995,9 +9225,10 @@ function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
|
|
|
8995
9225
|
}
|
|
8996
9226
|
function $c5a24bc478652b5f$var$getAncestors(collection, node) {
|
|
8997
9227
|
let parents = [];
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9228
|
+
let currNode = node;
|
|
9229
|
+
while((currNode === null || currNode === void 0 ? void 0 : currNode.parentKey) != null){
|
|
9230
|
+
currNode = collection.getItem(currNode.parentKey);
|
|
9231
|
+
if (currNode) parents.unshift(currNode);
|
|
9001
9232
|
}
|
|
9002
9233
|
return parents;
|
|
9003
9234
|
}
|
|
@@ -9017,14 +9248,15 @@ const $453cc9f0df89c0a5$var$cache = new WeakMap();
|
|
|
9017
9248
|
function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
|
|
9018
9249
|
let count = $453cc9f0df89c0a5$var$cache.get(collection);
|
|
9019
9250
|
if (count != null) return count;
|
|
9020
|
-
count
|
|
9251
|
+
// TS isn't smart enough to know we've ensured count is a number, so use a new variable
|
|
9252
|
+
let counter = 0;
|
|
9021
9253
|
let countItems = (items)=>{
|
|
9022
9254
|
for (let item of items)if (item.type === 'section') countItems(($c5a24bc478652b5f$export$1005530eda016c13)(item, collection));
|
|
9023
|
-
else
|
|
9255
|
+
else counter++;
|
|
9024
9256
|
};
|
|
9025
9257
|
countItems(collection);
|
|
9026
|
-
$453cc9f0df89c0a5$var$cache.set(collection,
|
|
9027
|
-
return
|
|
9258
|
+
$453cc9f0df89c0a5$var$cache.set(collection, counter);
|
|
9259
|
+
return counter;
|
|
9028
9260
|
}
|
|
9029
9261
|
|
|
9030
9262
|
/*
|
|
@@ -9458,141 +9690,38 @@ function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
|
|
|
9458
9690
|
accessibilityDescription: stringFormatter.format('longPressMessage'),
|
|
9459
9691
|
onLongPressStart () {
|
|
9460
9692
|
state.close();
|
|
9461
|
-
},
|
|
9462
|
-
onLongPress () {
|
|
9463
|
-
state.open('first');
|
|
9464
|
-
}
|
|
9465
|
-
});
|
|
9466
|
-
let pressProps = {
|
|
9467
|
-
onPressStart (e) {
|
|
9468
|
-
// For consistency with native, open the menu on mouse/key down, but touch up.
|
|
9469
|
-
if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) // If opened with a screen reader, auto focus the first item.
|
|
9470
|
-
// Otherwise, the menu itself will be focused.
|
|
9471
|
-
state.open(e.pointerType === 'virtual' ? 'first' : null);
|
|
9472
|
-
},
|
|
9473
|
-
onPress (e) {
|
|
9474
|
-
if (e.pointerType === 'touch' && !isDisabled) state.toggle();
|
|
9475
|
-
}
|
|
9476
|
-
};
|
|
9477
|
-
// omit onPress from triggerProps since we override it above.
|
|
9478
|
-
delete triggerProps.onPress;
|
|
9479
|
-
return {
|
|
9480
|
-
menuTriggerProps: {
|
|
9481
|
-
...triggerProps,
|
|
9482
|
-
...trigger === 'press' ? pressProps : longPressProps,
|
|
9483
|
-
id: menuTriggerId,
|
|
9484
|
-
onKeyDown: onKeyDown
|
|
9485
|
-
},
|
|
9486
|
-
menuProps: {
|
|
9487
|
-
...overlayProps,
|
|
9488
|
-
'aria-labelledby': menuTriggerId,
|
|
9489
|
-
autoFocus: state.focusStrategy || true,
|
|
9490
|
-
onClose: state.close
|
|
9491
|
-
}
|
|
9492
|
-
};
|
|
9493
|
-
}
|
|
9494
|
-
|
|
9495
|
-
/*
|
|
9496
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
9497
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9498
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9499
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9500
|
-
*
|
|
9501
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
9502
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9503
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
9504
|
-
* governing permissions and limitations under the License.
|
|
9505
|
-
*/
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
|
|
9513
|
-
let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props;
|
|
9514
|
-
let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || '', props.onChange);
|
|
9515
|
-
let { focusableProps: focusableProps } = ($e6afbd83fe6ebbd2$export$4c014de7c8940b4c)(props, ref);
|
|
9516
|
-
let validationState = ($e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
9517
|
-
...props,
|
|
9518
|
-
value: value
|
|
9519
|
-
});
|
|
9520
|
-
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = validationState.displayValidation;
|
|
9521
|
-
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = ($2baaea4c71418dea$export$294aa081a6c6f55d)({
|
|
9522
|
-
...props,
|
|
9523
|
-
isInvalid: isInvalid,
|
|
9524
|
-
errorMessage: props.errorMessage || validationErrors
|
|
9525
|
-
});
|
|
9526
|
-
let domProps = ($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(props, {
|
|
9527
|
-
labelable: true
|
|
9528
|
-
});
|
|
9529
|
-
const inputOnlyProps = {
|
|
9530
|
-
type: type,
|
|
9531
|
-
pattern: props.pattern
|
|
9532
|
-
};
|
|
9533
|
-
($99facab73266f662$export$5add1d006293d136)(ref, value, setValue);
|
|
9534
|
-
($e93e671b31057976$export$b8473d3665f3a75a)(props, validationState, ref);
|
|
9535
|
-
(useEffect)(()=>{
|
|
9536
|
-
// This works around a React/Chrome bug that prevents textarea elements from validating when controlled.
|
|
9537
|
-
// We prevent React from updating defaultValue (i.e. children) of textarea when `value` changes,
|
|
9538
|
-
// which causes Chrome to skip validation. Only updating `value` is ok in our case since our
|
|
9539
|
-
// textareas are always controlled. React is planning on removing this synchronization in a
|
|
9540
|
-
// future major version.
|
|
9541
|
-
// https://github.com/facebook/react/issues/19474
|
|
9542
|
-
// https://github.com/facebook/react/issues/11896
|
|
9543
|
-
if (ref.current instanceof ($431fbd86ca7dc216$export$f21a1ffae260145a)(ref.current).HTMLTextAreaElement) {
|
|
9544
|
-
let input = ref.current;
|
|
9545
|
-
Object.defineProperty(input, 'defaultValue', {
|
|
9546
|
-
get: ()=>input.value,
|
|
9547
|
-
set: ()=>{},
|
|
9548
|
-
configurable: true
|
|
9549
|
-
});
|
|
9693
|
+
},
|
|
9694
|
+
onLongPress () {
|
|
9695
|
+
state.open('first');
|
|
9550
9696
|
}
|
|
9551
|
-
}
|
|
9552
|
-
|
|
9553
|
-
|
|
9697
|
+
});
|
|
9698
|
+
let pressProps = {
|
|
9699
|
+
onPressStart (e) {
|
|
9700
|
+
// For consistency with native, open the menu on mouse/key down, but touch up.
|
|
9701
|
+
if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) // If opened with a screen reader, auto focus the first item.
|
|
9702
|
+
// Otherwise, the menu itself will be focused.
|
|
9703
|
+
state.open(e.pointerType === 'virtual' ? 'first' : null);
|
|
9704
|
+
},
|
|
9705
|
+
onPress (e) {
|
|
9706
|
+
if (e.pointerType === 'touch' && !isDisabled) state.toggle();
|
|
9707
|
+
}
|
|
9708
|
+
};
|
|
9709
|
+
// omit onPress from triggerProps since we override it above.
|
|
9710
|
+
delete triggerProps.onPress;
|
|
9554
9711
|
return {
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
'aria-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
autoComplete: props.autoComplete,
|
|
9569
|
-
autoCapitalize: props.autoCapitalize,
|
|
9570
|
-
maxLength: props.maxLength,
|
|
9571
|
-
minLength: props.minLength,
|
|
9572
|
-
name: props.name,
|
|
9573
|
-
placeholder: props.placeholder,
|
|
9574
|
-
inputMode: props.inputMode,
|
|
9575
|
-
// Clipboard events
|
|
9576
|
-
onCopy: props.onCopy,
|
|
9577
|
-
onCut: props.onCut,
|
|
9578
|
-
onPaste: props.onPaste,
|
|
9579
|
-
// Composition events
|
|
9580
|
-
onCompositionEnd: props.onCompositionEnd,
|
|
9581
|
-
onCompositionStart: props.onCompositionStart,
|
|
9582
|
-
onCompositionUpdate: props.onCompositionUpdate,
|
|
9583
|
-
// Selection events
|
|
9584
|
-
onSelect: props.onSelect,
|
|
9585
|
-
// Input events
|
|
9586
|
-
onBeforeInput: props.onBeforeInput,
|
|
9587
|
-
onInput: props.onInput,
|
|
9588
|
-
...focusableProps,
|
|
9589
|
-
...fieldProps
|
|
9590
|
-
}),
|
|
9591
|
-
descriptionProps: descriptionProps,
|
|
9592
|
-
errorMessageProps: errorMessageProps,
|
|
9593
|
-
isInvalid: isInvalid,
|
|
9594
|
-
validationErrors: validationErrors,
|
|
9595
|
-
validationDetails: validationDetails
|
|
9712
|
+
// @ts-ignore - TODO we pass out both DOMAttributes AND AriaButtonProps, but useButton will discard the longPress event handlers, it's only through PressResponder magic that this works for RSP and RAC. it does not work in aria examples
|
|
9713
|
+
menuTriggerProps: {
|
|
9714
|
+
...triggerProps,
|
|
9715
|
+
...trigger === 'press' ? pressProps : longPressProps,
|
|
9716
|
+
id: menuTriggerId,
|
|
9717
|
+
onKeyDown: onKeyDown
|
|
9718
|
+
},
|
|
9719
|
+
menuProps: {
|
|
9720
|
+
...overlayProps,
|
|
9721
|
+
'aria-labelledby': menuTriggerId,
|
|
9722
|
+
autoFocus: state.focusStrategy || true,
|
|
9723
|
+
onClose: state.close
|
|
9724
|
+
}
|
|
9596
9725
|
};
|
|
9597
9726
|
}
|
|
9598
9727
|
|
|
@@ -9678,7 +9807,8 @@ function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
|
|
|
9678
9807
|
* governing permissions and limitations under the License.
|
|
9679
9808
|
*/ const $ce9b18daab526bbd$export$5b9bb410392e3991 = new WeakMap();
|
|
9680
9809
|
function $ce9b18daab526bbd$export$f45c25170b9a99c2(state, key) {
|
|
9681
|
-
|
|
9810
|
+
var _listMap_get;
|
|
9811
|
+
let { id: id } = (_listMap_get = $ce9b18daab526bbd$export$5b9bb410392e3991.get(state)) !== null && _listMap_get !== void 0 ? _listMap_get : {};
|
|
9682
9812
|
if (!id) throw new Error('Unknown list');
|
|
9683
9813
|
return `${id}-${$ce9b18daab526bbd$export$e0c709538cb8ae18(key)}`;
|
|
9684
9814
|
}
|
|
@@ -10340,7 +10470,7 @@ function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
|
|
|
10340
10470
|
let interactionDescription = (useMemo)(()=>{
|
|
10341
10471
|
let selectionMode = props.selectionManager.selectionMode;
|
|
10342
10472
|
let selectionBehavior = props.selectionManager.selectionBehavior;
|
|
10343
|
-
let message
|
|
10473
|
+
let message;
|
|
10344
10474
|
if (shouldLongPress) message = stringFormatter.format('longPressToSelect');
|
|
10345
10475
|
return selectionBehavior === 'replace' && selectionMode !== 'none' && props.hasItemActions ? message : undefined;
|
|
10346
10476
|
}, [
|
|
@@ -10462,26 +10592,39 @@ function $4e8b0456ef72939f$export$9610e69494fadfd2(props, state, ref) {
|
|
|
10462
10592
|
var _ref_current;
|
|
10463
10593
|
// Don't shift focus to the row if the active element is a element within the row already
|
|
10464
10594
|
// (e.g. clicking on a row button)
|
|
10465
|
-
if (keyWhenFocused.current != null && node.key !== keyWhenFocused.current || !((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(document.activeElement))) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
10595
|
+
if (ref.current !== null && (keyWhenFocused.current != null && node.key !== keyWhenFocused.current || !((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(document.activeElement)))) ($6a99195332edec8b$export$80f3e147d781571c)(ref.current);
|
|
10466
10596
|
};
|
|
10467
10597
|
let treeGridRowProps = {};
|
|
10468
10598
|
let hasChildRows;
|
|
10469
10599
|
let hasLink = state.selectionManager.isLink(node.key);
|
|
10470
10600
|
if (node != null && 'expandedKeys' in state) {
|
|
10601
|
+
var _state_collection_getChildren, _state_collection, _filter_at;
|
|
10471
10602
|
// TODO: ideally node.hasChildNodes would be a way to tell if a row has child nodes, but the row's contents make it so that value is always
|
|
10472
10603
|
// true...
|
|
10604
|
+
let children = (_state_collection_getChildren = (_state_collection = state.collection).getChildren) === null || _state_collection_getChildren === void 0 ? void 0 : _state_collection_getChildren.call(_state_collection, node.key);
|
|
10473
10605
|
hasChildRows = [
|
|
10474
|
-
...
|
|
10606
|
+
...children !== null && children !== void 0 ? children : []
|
|
10475
10607
|
].length > 1;
|
|
10476
10608
|
if (onAction == null && !hasLink && state.selectionManager.selectionMode === 'none' && hasChildRows) onAction = ()=>state.toggleKey(node.key);
|
|
10477
10609
|
let isExpanded = hasChildRows ? state.expandedKeys.has(node.key) : undefined;
|
|
10610
|
+
let setSize = 1;
|
|
10611
|
+
var _filter_at_index;
|
|
10612
|
+
if (node.level > 0 && (node === null || node === void 0 ? void 0 : node.parentKey) != null) {
|
|
10613
|
+
let parent = state.collection.getItem(node.parentKey);
|
|
10614
|
+
if (parent) {
|
|
10615
|
+
var _state_collection_getChildren1, _state_collection1;
|
|
10616
|
+
// siblings must exist because our original node exists, same with lastItem
|
|
10617
|
+
let siblings = (_state_collection_getChildren1 = (_state_collection1 = state.collection).getChildren) === null || _state_collection_getChildren1 === void 0 ? void 0 : _state_collection_getChildren1.call(_state_collection1, parent.key);
|
|
10618
|
+
setSize = ($c5a24bc478652b5f$export$7475b2c64539e4cf)(siblings).index + 1;
|
|
10619
|
+
}
|
|
10620
|
+
} else setSize = ((_filter_at_index = (_filter_at = [
|
|
10621
|
+
...state.collection
|
|
10622
|
+
].filter((row)=>row.level === 0).at(-1)) === null || _filter_at === void 0 ? void 0 : _filter_at.index) !== null && _filter_at_index !== void 0 ? _filter_at_index : 0) + 1;
|
|
10478
10623
|
treeGridRowProps = {
|
|
10479
10624
|
'aria-expanded': isExpanded,
|
|
10480
10625
|
'aria-level': node.level + 1,
|
|
10481
10626
|
'aria-posinset': (node === null || node === void 0 ? void 0 : node.index) + 1,
|
|
10482
|
-
'aria-setsize':
|
|
10483
|
-
...state.collection
|
|
10484
|
-
].filter((row)=>row.level === 0).at(-1).index + 1
|
|
10627
|
+
'aria-setsize': setSize
|
|
10485
10628
|
};
|
|
10486
10629
|
}
|
|
10487
10630
|
let { itemProps: itemProps, ...itemStates } = ($880e95eb8b93ba9a$export$ecf600387e221c37)({
|
|
@@ -10495,7 +10638,7 @@ function $4e8b0456ef72939f$export$9610e69494fadfd2(props, state, ref) {
|
|
|
10495
10638
|
linkBehavior: linkBehavior
|
|
10496
10639
|
});
|
|
10497
10640
|
let onKeyDown = (e)=>{
|
|
10498
|
-
if (!e.currentTarget.contains(e.target)) return;
|
|
10641
|
+
if (!e.currentTarget.contains(e.target) || !ref.current || !document.activeElement) return;
|
|
10499
10642
|
let walker = ($9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current);
|
|
10500
10643
|
walker.currentNode = document.activeElement;
|
|
10501
10644
|
if ('expandedKeys' in state && document.activeElement === ref.current) {
|
|
@@ -10580,9 +10723,10 @@ function $4e8b0456ef72939f$export$9610e69494fadfd2(props, state, ref) {
|
|
|
10580
10723
|
// to the row above/below instead. We need to re-dispatch the event from a higher parent so it still
|
|
10581
10724
|
// bubbles and gets handled by useSelectableCollection.
|
|
10582
10725
|
if (!e.altKey && ref.current.contains(e.target)) {
|
|
10726
|
+
var _ref_current_parentElement;
|
|
10583
10727
|
e.stopPropagation();
|
|
10584
10728
|
e.preventDefault();
|
|
10585
|
-
ref.current.parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
10729
|
+
(_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
10586
10730
|
}
|
|
10587
10731
|
break;
|
|
10588
10732
|
case 'Tab':
|
|
@@ -10651,8 +10795,8 @@ function $4e8b0456ef72939f$export$9610e69494fadfd2(props, state, ref) {
|
|
|
10651
10795
|
};
|
|
10652
10796
|
}
|
|
10653
10797
|
function $4e8b0456ef72939f$var$last(walker) {
|
|
10654
|
-
let next;
|
|
10655
|
-
let last;
|
|
10798
|
+
let next = null;
|
|
10799
|
+
let last = null;
|
|
10656
10800
|
do {
|
|
10657
10801
|
last = walker.lastChild();
|
|
10658
10802
|
if (last) next = last;
|
|
@@ -10894,7 +11038,7 @@ function $58aed456727eb0f3$export$e64b2f635402ca43(props, state, ref) {
|
|
|
10894
11038
|
usage: 'search',
|
|
10895
11039
|
sensitivity: 'base'
|
|
10896
11040
|
});
|
|
10897
|
-
let delegate = (useMemo)(()=>keyboardDelegate || new ($2a25aae57d74318e$export$a05409b8bb224a5a)(state.collection, state.disabledKeys,
|
|
11041
|
+
let delegate = (useMemo)(()=>keyboardDelegate || new ($2a25aae57d74318e$export$a05409b8bb224a5a)(state.collection, state.disabledKeys, ref, collator), [
|
|
10898
11042
|
keyboardDelegate,
|
|
10899
11043
|
state.collection,
|
|
10900
11044
|
state.disabledKeys,
|
|
@@ -10908,17 +11052,19 @@ function $58aed456727eb0f3$export$e64b2f635402ca43(props, state, ref) {
|
|
|
10908
11052
|
switch(e.key){
|
|
10909
11053
|
case 'ArrowLeft':
|
|
10910
11054
|
{
|
|
11055
|
+
var _delegate_getKeyAbove, _delegate_getFirstKey;
|
|
10911
11056
|
// prevent scrolling containers
|
|
10912
11057
|
e.preventDefault();
|
|
10913
|
-
let key = state.selectedKey != null ? delegate.getKeyAbove(state.selectedKey) : delegate.getFirstKey();
|
|
11058
|
+
let key = state.selectedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, state.selectedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
|
|
10914
11059
|
if (key) state.setSelectedKey(key);
|
|
10915
11060
|
break;
|
|
10916
11061
|
}
|
|
10917
11062
|
case 'ArrowRight':
|
|
10918
11063
|
{
|
|
11064
|
+
var _delegate_getKeyBelow, _delegate_getFirstKey1;
|
|
10919
11065
|
// prevent scrolling containers
|
|
10920
11066
|
e.preventDefault();
|
|
10921
|
-
let key = state.selectedKey != null ? delegate.getKeyBelow(state.selectedKey) : delegate.getFirstKey();
|
|
11067
|
+
let key = state.selectedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, state.selectedKey) : (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate);
|
|
10922
11068
|
if (key) state.setSelectedKey(key);
|
|
10923
11069
|
break;
|
|
10924
11070
|
}
|
|
@@ -10956,7 +11102,8 @@ function $58aed456727eb0f3$export$e64b2f635402ca43(props, state, ref) {
|
|
|
10956
11102
|
...labelProps,
|
|
10957
11103
|
onClick: ()=>{
|
|
10958
11104
|
if (!props.isDisabled) {
|
|
10959
|
-
|
|
11105
|
+
var _ref_current;
|
|
11106
|
+
(_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
|
|
10960
11107
|
// Show the focus ring so the user knows where focus went
|
|
10961
11108
|
($507fabe10e71c6fb$export$8397ddfc504fdb9a)('keyboard');
|
|
10962
11109
|
}
|
|
@@ -11029,17 +11176,18 @@ function $58aed456727eb0f3$export$e64b2f635402ca43(props, state, ref) {
|
|
|
11029
11176
|
|
|
11030
11177
|
|
|
11031
11178
|
|
|
11032
|
-
|
|
11033
11179
|
function $bdd25dc72710631f$export$f809e80f58e251d1(props, state, triggerRef) {
|
|
11034
11180
|
let data = ($58aed456727eb0f3$export$703601b7e90536f8).get(state) || {};
|
|
11035
11181
|
let { autoComplete: autoComplete, name: name = data.name, isDisabled: isDisabled = data.isDisabled } = props;
|
|
11036
11182
|
let { validationBehavior: validationBehavior, isRequired: isRequired } = data;
|
|
11037
|
-
let modality = ($507fabe10e71c6fb$export$98e20ec92f614cfe)();
|
|
11038
11183
|
let { visuallyHiddenProps: visuallyHiddenProps } = ($5c3e21d68f1c4674$export$a966af930f325cab)();
|
|
11039
11184
|
($99facab73266f662$export$5add1d006293d136)(props.selectRef, state.selectedKey, state.setSelectedKey);
|
|
11040
11185
|
($e93e671b31057976$export$b8473d3665f3a75a)({
|
|
11041
11186
|
validationBehavior: validationBehavior,
|
|
11042
|
-
focus: ()=>
|
|
11187
|
+
focus: ()=>{
|
|
11188
|
+
var _triggerRef_current;
|
|
11189
|
+
return (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();
|
|
11190
|
+
}
|
|
11043
11191
|
}, state, props.selectRef);
|
|
11044
11192
|
var _state_selectedKey;
|
|
11045
11193
|
// In Safari, the <select> cannot have `display: none` or `hidden` for autofill to work.
|
|
@@ -11048,18 +11196,6 @@ function $bdd25dc72710631f$export$f809e80f58e251d1(props, state, triggerRef) {
|
|
|
11048
11196
|
// The solution is to use <VisuallyHidden> to hide the elements, which clips the elements to a
|
|
11049
11197
|
// 1px rectangle. In addition, we hide from screen readers with aria-hidden, and make the <select>
|
|
11050
11198
|
// non tabbable with tabIndex={-1}.
|
|
11051
|
-
//
|
|
11052
|
-
// In mobile browsers, there are next/previous buttons above the software keyboard for navigating
|
|
11053
|
-
// between fields in a form. These only support native form inputs that are tabbable. In order to
|
|
11054
|
-
// support those, an additional hidden input is used to marshall focus to the button. It is tabbable
|
|
11055
|
-
// except when the button is focused, so that shift tab works properly to go to the actual previous
|
|
11056
|
-
// input in the form. Using the <select> for this also works, but Safari on iOS briefly flashes
|
|
11057
|
-
// the native menu on focus, so this isn't ideal. A font-size of 16px or greater is required to
|
|
11058
|
-
// prevent Safari from zooming in on the input when it is focused.
|
|
11059
|
-
//
|
|
11060
|
-
// If the current interaction modality is null, then the user hasn't interacted with the page yet.
|
|
11061
|
-
// In this case, we set the tabIndex to -1 on the input element so that automated accessibility
|
|
11062
|
-
// checkers don't throw false-positives about focusable elements inside an aria-hidden parent.
|
|
11063
11199
|
return {
|
|
11064
11200
|
containerProps: {
|
|
11065
11201
|
...visuallyHiddenProps,
|
|
@@ -11070,13 +11206,9 @@ function $bdd25dc72710631f$export$f809e80f58e251d1(props, state, triggerRef) {
|
|
|
11070
11206
|
['data-a11y-ignore']: 'aria-hidden-focus'
|
|
11071
11207
|
},
|
|
11072
11208
|
inputProps: {
|
|
11073
|
-
type: 'text',
|
|
11074
|
-
tabIndex: modality == null || state.isFocused || state.isOpen ? -1 : 0,
|
|
11075
11209
|
style: {
|
|
11076
|
-
|
|
11077
|
-
}
|
|
11078
|
-
onFocus: ()=>triggerRef.current.focus(),
|
|
11079
|
-
disabled: isDisabled
|
|
11210
|
+
display: 'none'
|
|
11211
|
+
}
|
|
11080
11212
|
},
|
|
11081
11213
|
selectProps: {
|
|
11082
11214
|
tabIndex: -1,
|
|
@@ -11092,7 +11224,7 @@ function $bdd25dc72710631f$export$f809e80f58e251d1(props, state, triggerRef) {
|
|
|
11092
11224
|
function $bdd25dc72710631f$export$cbd84cdb2e668835(props) {
|
|
11093
11225
|
let { state: state, triggerRef: triggerRef, label: label, name: name, isDisabled: isDisabled } = props;
|
|
11094
11226
|
let selectRef = (useRef)(null);
|
|
11095
|
-
let { containerProps: containerProps,
|
|
11227
|
+
let { containerProps: containerProps, selectProps: selectProps } = $bdd25dc72710631f$export$f809e80f58e251d1({
|
|
11096
11228
|
...props,
|
|
11097
11229
|
selectRef: selectRef
|
|
11098
11230
|
}, state, triggerRef);
|
|
@@ -11103,14 +11235,14 @@ function $bdd25dc72710631f$export$cbd84cdb2e668835(props) {
|
|
|
11103
11235
|
if (state.collection.size <= 300) return /*#__PURE__*/ ($dbSRa$react).createElement("div", {
|
|
11104
11236
|
...containerProps,
|
|
11105
11237
|
"data-testid": "hidden-select-container"
|
|
11106
|
-
}, /*#__PURE__*/ ($dbSRa$react).createElement("
|
|
11238
|
+
}, /*#__PURE__*/ ($dbSRa$react).createElement("label", null, label, /*#__PURE__*/ ($dbSRa$react).createElement("select", {
|
|
11107
11239
|
...selectProps,
|
|
11108
11240
|
ref: selectRef
|
|
11109
11241
|
}, /*#__PURE__*/ ($dbSRa$react).createElement("option", null), [
|
|
11110
11242
|
...state.collection.getKeys()
|
|
11111
11243
|
].map((key)=>{
|
|
11112
11244
|
let item = state.collection.getItem(key);
|
|
11113
|
-
if (item.type === 'item') return /*#__PURE__*/ ($dbSRa$react).createElement("option", {
|
|
11245
|
+
if (item && item.type === 'item') return /*#__PURE__*/ ($dbSRa$react).createElement("option", {
|
|
11114
11246
|
key: item.key,
|
|
11115
11247
|
value: item.key
|
|
11116
11248
|
}, item.textValue);
|
|
@@ -11545,7 +11677,6 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
11545
11677
|
let description = onRemove && (modality === 'keyboard' || modality === 'virtual') ? stringFormatter.format('removeDescription') : '';
|
|
11546
11678
|
let descProps = ($ef06256079686ba0$export$f8aeda7b10753fa1)(description);
|
|
11547
11679
|
let isFocused = item.key === state.selectionManager.focusedKey;
|
|
11548
|
-
// @ts-ignore - data attributes are ok but TS doesn't know about them.
|
|
11549
11680
|
let domProps = ($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(item.props);
|
|
11550
11681
|
let linkProps = ($ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6)(item.props);
|
|
11551
11682
|
return {
|
|
@@ -11718,6 +11849,51 @@ function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
11718
11849
|
*/
|
|
11719
11850
|
|
|
11720
11851
|
|
|
11852
|
+
const $01b77f81d0f07f68$export$75b6ee27786ba447 = /*#__PURE__*/ (createContext)({});
|
|
11853
|
+
function $01b77f81d0f07f68$var$Label(props, ref) {
|
|
11854
|
+
[props, ref] = ($64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $01b77f81d0f07f68$export$75b6ee27786ba447);
|
|
11855
|
+
let { elementType: ElementType = 'label', ...labelProps } = props;
|
|
11856
|
+
// @ts-ignore
|
|
11857
|
+
return /*#__PURE__*/ ($dbSRa$react).createElement(ElementType, {
|
|
11858
|
+
className: "react-aria-Label",
|
|
11859
|
+
...labelProps,
|
|
11860
|
+
ref: ref
|
|
11861
|
+
});
|
|
11862
|
+
}
|
|
11863
|
+
const $01b77f81d0f07f68$export$b04be29aa201d4f5 = /*#__PURE__*/ ($f39a9eba43920ace$export$86427a43e3e48ebb)($01b77f81d0f07f68$var$Label);
|
|
11864
|
+
|
|
11865
|
+
/*
|
|
11866
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
11867
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11868
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11869
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11870
|
+
*
|
|
11871
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11872
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11873
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
11874
|
+
* governing permissions and limitations under the License.
|
|
11875
|
+
*/
|
|
11876
|
+
|
|
11877
|
+
|
|
11878
|
+
|
|
11879
|
+
|
|
11880
|
+
const $0393f8ab869a0f1a$export$e9f3bf65a26ce129 = /*#__PURE__*/ (createContext)(null);
|
|
11881
|
+
|
|
11882
|
+
/*
|
|
11883
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
11884
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11885
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11886
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11887
|
+
*
|
|
11888
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11889
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11890
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
11891
|
+
* governing permissions and limitations under the License.
|
|
11892
|
+
*/
|
|
11893
|
+
|
|
11894
|
+
|
|
11895
|
+
|
|
11896
|
+
|
|
11721
11897
|
|
|
11722
11898
|
|
|
11723
11899
|
const $d2b4bc8c273e7be6$var$additionalButtonHTMLAttributes = new Set([
|
|
@@ -11733,35 +11909,88 @@ const $d2b4bc8c273e7be6$var$additionalButtonHTMLAttributes = new Set([
|
|
|
11733
11909
|
const $d2b4bc8c273e7be6$export$24d547caef80ccd1 = /*#__PURE__*/ (createContext)({});
|
|
11734
11910
|
function $d2b4bc8c273e7be6$var$Button(props, ref) {
|
|
11735
11911
|
[props, ref] = ($64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $d2b4bc8c273e7be6$export$24d547caef80ccd1);
|
|
11912
|
+
props = $d2b4bc8c273e7be6$var$disablePendingProps(props);
|
|
11736
11913
|
let ctx = props;
|
|
11914
|
+
let { isPending: isPending } = ctx;
|
|
11737
11915
|
let { buttonProps: buttonProps, isPressed: isPressed } = ($701a24aa0da5b062$export$ea18c227d4417cc3)(props, ref);
|
|
11738
11916
|
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = ($f7dceffc5ad7768b$export$4e328f61c538687f)(props);
|
|
11739
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = ($6179b936705e76d3$export$ae780daf29e6d456)(
|
|
11917
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = ($6179b936705e76d3$export$ae780daf29e6d456)({
|
|
11918
|
+
...props,
|
|
11919
|
+
isDisabled: props.isDisabled || isPending
|
|
11920
|
+
});
|
|
11921
|
+
let renderValues = {
|
|
11922
|
+
isHovered: isHovered,
|
|
11923
|
+
isPressed: (ctx.isPressed || isPressed) && !isPending,
|
|
11924
|
+
isFocused: isFocused,
|
|
11925
|
+
isFocusVisible: isFocusVisible,
|
|
11926
|
+
isDisabled: props.isDisabled || false,
|
|
11927
|
+
isPending: isPending !== null && isPending !== void 0 ? isPending : false
|
|
11928
|
+
};
|
|
11740
11929
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
11741
11930
|
...props,
|
|
11742
|
-
values:
|
|
11743
|
-
isHovered: isHovered,
|
|
11744
|
-
isPressed: isPressed,
|
|
11745
|
-
isFocused: isFocused,
|
|
11746
|
-
isFocusVisible: isFocusVisible,
|
|
11747
|
-
isDisabled: props.isDisabled || false
|
|
11748
|
-
},
|
|
11931
|
+
values: renderValues,
|
|
11749
11932
|
defaultClassName: 'react-aria-Button'
|
|
11750
11933
|
});
|
|
11934
|
+
let buttonId = ($bdb11010cef70236$export$f680877a34711e37)(buttonProps.id);
|
|
11935
|
+
let progressId = ($bdb11010cef70236$export$f680877a34711e37)();
|
|
11936
|
+
let ariaLabelledby = buttonProps['aria-labelledby'];
|
|
11937
|
+
if (isPending) {
|
|
11938
|
+
// aria-labelledby wins over aria-label
|
|
11939
|
+
// https://www.w3.org/TR/accname-1.2/#computation-steps
|
|
11940
|
+
if (ariaLabelledby) ariaLabelledby = `${ariaLabelledby} ${progressId}`;
|
|
11941
|
+
else if (buttonProps['aria-label']) ariaLabelledby = `${buttonId} ${progressId}`;
|
|
11942
|
+
}
|
|
11943
|
+
let wasPending = (useRef)(isPending);
|
|
11944
|
+
(useEffect)(()=>{
|
|
11945
|
+
let message = {
|
|
11946
|
+
'aria-labelledby': ariaLabelledby || buttonId
|
|
11947
|
+
};
|
|
11948
|
+
if (!wasPending.current && isFocused && isPending) ($319e236875307eab$export$a9b970dcc4ae71a9)(message, 'assertive');
|
|
11949
|
+
else if (wasPending.current && isFocused && !isPending) ($319e236875307eab$export$a9b970dcc4ae71a9)(message, 'assertive');
|
|
11950
|
+
wasPending.current = isPending;
|
|
11951
|
+
}, [
|
|
11952
|
+
isPending,
|
|
11953
|
+
isFocused,
|
|
11954
|
+
ariaLabelledby,
|
|
11955
|
+
buttonId
|
|
11956
|
+
]);
|
|
11751
11957
|
return /*#__PURE__*/ ($dbSRa$react).createElement("button", {
|
|
11752
11958
|
...($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(props, {
|
|
11753
11959
|
propNames: $d2b4bc8c273e7be6$var$additionalButtonHTMLAttributes
|
|
11754
11960
|
}),
|
|
11755
11961
|
...($3ef42575df84b30b$export$9d1611c77c2fe928)(buttonProps, focusProps, hoverProps),
|
|
11756
11962
|
...renderProps,
|
|
11963
|
+
id: buttonId,
|
|
11757
11964
|
ref: ref,
|
|
11965
|
+
"aria-labelledby": ariaLabelledby,
|
|
11758
11966
|
slot: props.slot || undefined,
|
|
11967
|
+
"aria-disabled": isPending ? 'true' : buttonProps['aria-disabled'],
|
|
11759
11968
|
"data-disabled": props.isDisabled || undefined,
|
|
11760
|
-
"data-pressed":
|
|
11969
|
+
"data-pressed": renderValues.isPressed || undefined,
|
|
11761
11970
|
"data-hovered": isHovered || undefined,
|
|
11762
11971
|
"data-focused": isFocused || undefined,
|
|
11972
|
+
"data-pending": isPending || undefined,
|
|
11763
11973
|
"data-focus-visible": isFocusVisible || undefined
|
|
11764
|
-
})
|
|
11974
|
+
}, /*#__PURE__*/ ($dbSRa$react).createElement(($0393f8ab869a0f1a$export$e9f3bf65a26ce129).Provider, {
|
|
11975
|
+
value: {
|
|
11976
|
+
id: progressId
|
|
11977
|
+
}
|
|
11978
|
+
}, renderProps.children));
|
|
11979
|
+
}
|
|
11980
|
+
function $d2b4bc8c273e7be6$var$disablePendingProps(props) {
|
|
11981
|
+
// Don't allow interaction while isPending is true
|
|
11982
|
+
if (props.isPending) {
|
|
11983
|
+
props.onPress = undefined;
|
|
11984
|
+
props.onPressStart = undefined;
|
|
11985
|
+
props.onPressEnd = undefined;
|
|
11986
|
+
props.onPressChange = undefined;
|
|
11987
|
+
props.onPressUp = undefined;
|
|
11988
|
+
props.onKeyDown = undefined;
|
|
11989
|
+
props.onKeyUp = undefined;
|
|
11990
|
+
props.onClick = undefined;
|
|
11991
|
+
props.href = undefined;
|
|
11992
|
+
}
|
|
11993
|
+
return props;
|
|
11765
11994
|
}
|
|
11766
11995
|
/**
|
|
11767
11996
|
* A button allows a user to perform an action, with mouse, touch, and keyboard interactions.
|
|
@@ -11876,11 +12105,13 @@ function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
|
|
|
11876
12105
|
}
|
|
11877
12106
|
getKeyBefore(key) {
|
|
11878
12107
|
let node = this.keyMap.get(key);
|
|
11879
|
-
|
|
12108
|
+
var _node_prevKey;
|
|
12109
|
+
return node ? (_node_prevKey = node.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
|
|
11880
12110
|
}
|
|
11881
12111
|
getKeyAfter(key) {
|
|
11882
12112
|
let node = this.keyMap.get(key);
|
|
11883
|
-
|
|
12113
|
+
var _node_nextKey;
|
|
12114
|
+
return node ? (_node_nextKey = node.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
|
|
11884
12115
|
}
|
|
11885
12116
|
getFirstKey() {
|
|
11886
12117
|
return this.firstKey;
|
|
@@ -11889,7 +12120,8 @@ function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
|
|
|
11889
12120
|
return this.lastKey;
|
|
11890
12121
|
}
|
|
11891
12122
|
getItem(key) {
|
|
11892
|
-
|
|
12123
|
+
var _this_keyMap_get;
|
|
12124
|
+
return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
|
|
11893
12125
|
}
|
|
11894
12126
|
at(idx) {
|
|
11895
12127
|
const keys = [
|
|
@@ -11903,13 +12135,15 @@ function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
|
|
|
11903
12135
|
}
|
|
11904
12136
|
constructor(nodes){
|
|
11905
12137
|
this.keyMap = new Map();
|
|
12138
|
+
this.firstKey = null;
|
|
12139
|
+
this.lastKey = null;
|
|
11906
12140
|
this.iterable = nodes;
|
|
11907
12141
|
let visit = (node)=>{
|
|
11908
12142
|
this.keyMap.set(node.key, node);
|
|
11909
12143
|
if (node.childNodes && node.type === 'section') for (let child of node.childNodes)visit(child);
|
|
11910
12144
|
};
|
|
11911
12145
|
for (let node of nodes)visit(node);
|
|
11912
|
-
let last;
|
|
12146
|
+
let last = null;
|
|
11913
12147
|
let index = 0;
|
|
11914
12148
|
for (let [key, node] of this.keyMap){
|
|
11915
12149
|
if (last) {
|
|
@@ -11925,7 +12159,8 @@ function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
|
|
|
11925
12159
|
// If it isn't the last node, last.nextKey will properly set at start of new loop
|
|
11926
12160
|
last.nextKey = undefined;
|
|
11927
12161
|
}
|
|
11928
|
-
|
|
12162
|
+
var _last_key;
|
|
12163
|
+
this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
|
|
11929
12164
|
}
|
|
11930
12165
|
}
|
|
11931
12166
|
|
|
@@ -11943,11 +12178,11 @@ function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
|
|
|
11943
12178
|
constructor(keys, anchorKey, currentKey){
|
|
11944
12179
|
super(keys);
|
|
11945
12180
|
if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
|
|
11946
|
-
this.anchorKey = anchorKey
|
|
11947
|
-
this.currentKey = currentKey
|
|
12181
|
+
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys.anchorKey;
|
|
12182
|
+
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys.currentKey;
|
|
11948
12183
|
} else {
|
|
11949
|
-
this.anchorKey = anchorKey;
|
|
11950
|
-
this.currentKey = currentKey;
|
|
12184
|
+
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : null;
|
|
12185
|
+
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : null;
|
|
11951
12186
|
}
|
|
11952
12187
|
}
|
|
11953
12188
|
}
|
|
@@ -11973,7 +12208,7 @@ function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
|
|
|
11973
12208
|
return true;
|
|
11974
12209
|
}
|
|
11975
12210
|
function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
|
|
11976
|
-
let { selectionMode: selectionMode = 'none', disallowEmptySelection: disallowEmptySelection, allowDuplicateSelectionEvents: allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = 'toggle', disabledBehavior: disabledBehavior = 'all' } = props;
|
|
12211
|
+
let { selectionMode: selectionMode = 'none', disallowEmptySelection: disallowEmptySelection = false, allowDuplicateSelectionEvents: allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = 'toggle', disabledBehavior: disabledBehavior = 'all' } = props;
|
|
11977
12212
|
// We want synchronous updates to `isFocused` and `focusedKey` after their setters are called.
|
|
11978
12213
|
// But we also need to trigger a react re-render. So, we have both a ref (sync) and state (async).
|
|
11979
12214
|
let isFocusedRef = (useRef)(false);
|
|
@@ -12112,8 +12347,9 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12112
12347
|
* Returns whether a key is selected.
|
|
12113
12348
|
*/ isSelected(key) {
|
|
12114
12349
|
if (this.state.selectionMode === 'none') return false;
|
|
12115
|
-
|
|
12116
|
-
|
|
12350
|
+
let mappedKey = this.getKey(key);
|
|
12351
|
+
if (mappedKey == null) return false;
|
|
12352
|
+
return this.state.selectedKeys === 'all' ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
|
|
12117
12353
|
}
|
|
12118
12354
|
/**
|
|
12119
12355
|
* Whether the selection is empty.
|
|
@@ -12137,7 +12373,8 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12137
12373
|
let item = this.collection.getItem(key);
|
|
12138
12374
|
if (!first || item && ($c5a24bc478652b5f$export$8c434b3a7a4dad6)(this.collection, item, first) < 0) first = item;
|
|
12139
12375
|
}
|
|
12140
|
-
|
|
12376
|
+
var _first_key;
|
|
12377
|
+
return (_first_key = first === null || first === void 0 ? void 0 : first.key) !== null && _first_key !== void 0 ? _first_key : null;
|
|
12141
12378
|
}
|
|
12142
12379
|
get lastSelectedKey() {
|
|
12143
12380
|
let last = null;
|
|
@@ -12145,7 +12382,8 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12145
12382
|
let item = this.collection.getItem(key);
|
|
12146
12383
|
if (!last || item && ($c5a24bc478652b5f$export$8c434b3a7a4dad6)(this.collection, item, last) > 0) last = item;
|
|
12147
12384
|
}
|
|
12148
|
-
|
|
12385
|
+
var _last_key;
|
|
12386
|
+
return (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
|
|
12149
12387
|
}
|
|
12150
12388
|
get disabledKeys() {
|
|
12151
12389
|
return this.state.disabledKeys;
|
|
@@ -12161,18 +12399,21 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12161
12399
|
this.replaceSelection(toKey);
|
|
12162
12400
|
return;
|
|
12163
12401
|
}
|
|
12164
|
-
|
|
12402
|
+
let mappedToKey = this.getKey(toKey);
|
|
12403
|
+
if (mappedToKey == null) return;
|
|
12165
12404
|
let selection;
|
|
12166
12405
|
// Only select the one key if coming from a select all.
|
|
12167
12406
|
if (this.state.selectedKeys === 'all') selection = new ($e40ea825a81a3709$export$52baac22726c72bf)([
|
|
12168
|
-
|
|
12169
|
-
],
|
|
12407
|
+
mappedToKey
|
|
12408
|
+
], mappedToKey, mappedToKey);
|
|
12170
12409
|
else {
|
|
12171
12410
|
let selectedKeys = this.state.selectedKeys;
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12411
|
+
var _selectedKeys_anchorKey;
|
|
12412
|
+
let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : mappedToKey;
|
|
12413
|
+
selection = new ($e40ea825a81a3709$export$52baac22726c72bf)(selectedKeys, anchorKey, mappedToKey);
|
|
12414
|
+
var _selectedKeys_currentKey;
|
|
12415
|
+
for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : mappedToKey))selection.delete(key);
|
|
12416
|
+
for (let key of this.getKeyRange(mappedToKey, anchorKey))if (this.canSelectItem(key)) selection.add(key);
|
|
12176
12417
|
}
|
|
12177
12418
|
this.state.setSelectedKeys(selection);
|
|
12178
12419
|
}
|
|
@@ -12186,11 +12427,13 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12186
12427
|
return [];
|
|
12187
12428
|
}
|
|
12188
12429
|
getKeyRangeInternal(from, to) {
|
|
12430
|
+
var _this_layoutDelegate;
|
|
12431
|
+
if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
|
|
12189
12432
|
let keys = [];
|
|
12190
12433
|
let key = from;
|
|
12191
|
-
while(key){
|
|
12434
|
+
while(key != null){
|
|
12192
12435
|
let item = this.collection.getItem(key);
|
|
12193
|
-
if (item && item.type === 'item' || item.type === 'cell' && this.allowsCellSelection) keys.push(key);
|
|
12436
|
+
if (item && (item.type === 'item' || item.type === 'cell' && this.allowsCellSelection)) keys.push(key);
|
|
12194
12437
|
if (key === to) return keys;
|
|
12195
12438
|
key = this.collection.getKeyAfter(key);
|
|
12196
12439
|
}
|
|
@@ -12203,7 +12446,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12203
12446
|
// If cell selection is allowed, just return the key.
|
|
12204
12447
|
if (item.type === 'cell' && this.allowsCellSelection) return key;
|
|
12205
12448
|
// Find a parent item to select
|
|
12206
|
-
while(item.type !== 'item' && item.parentKey != null)item = this.collection.getItem(item.parentKey);
|
|
12449
|
+
while(item && item.type !== 'item' && item.parentKey != null)item = this.collection.getItem(item.parentKey);
|
|
12207
12450
|
if (!item || item.type !== 'item') return null;
|
|
12208
12451
|
return item.key;
|
|
12209
12452
|
}
|
|
@@ -12215,14 +12458,14 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12215
12458
|
this.replaceSelection(key);
|
|
12216
12459
|
return;
|
|
12217
12460
|
}
|
|
12218
|
-
|
|
12219
|
-
if (
|
|
12461
|
+
let mappedKey = this.getKey(key);
|
|
12462
|
+
if (mappedKey == null) return;
|
|
12220
12463
|
let keys = new ($e40ea825a81a3709$export$52baac22726c72bf)(this.state.selectedKeys === 'all' ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
12221
|
-
if (keys.has(
|
|
12222
|
-
else if (this.canSelectItem(
|
|
12223
|
-
keys.add(
|
|
12224
|
-
keys.anchorKey =
|
|
12225
|
-
keys.currentKey =
|
|
12464
|
+
if (keys.has(mappedKey)) keys.delete(mappedKey);
|
|
12465
|
+
else if (this.canSelectItem(mappedKey)) {
|
|
12466
|
+
keys.add(mappedKey);
|
|
12467
|
+
keys.anchorKey = mappedKey;
|
|
12468
|
+
keys.currentKey = mappedKey;
|
|
12226
12469
|
}
|
|
12227
12470
|
if (this.disallowEmptySelection && keys.size === 0) return;
|
|
12228
12471
|
this.state.setSelectedKeys(keys);
|
|
@@ -12231,11 +12474,11 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12231
12474
|
* Replaces the selection with only the given key.
|
|
12232
12475
|
*/ replaceSelection(key) {
|
|
12233
12476
|
if (this.selectionMode === 'none') return;
|
|
12234
|
-
|
|
12235
|
-
if (
|
|
12236
|
-
let selection = this.canSelectItem(
|
|
12237
|
-
|
|
12238
|
-
],
|
|
12477
|
+
let mappedKey = this.getKey(key);
|
|
12478
|
+
if (mappedKey == null) return;
|
|
12479
|
+
let selection = this.canSelectItem(mappedKey) ? new ($e40ea825a81a3709$export$52baac22726c72bf)([
|
|
12480
|
+
mappedKey
|
|
12481
|
+
], mappedKey, mappedKey) : new ($e40ea825a81a3709$export$52baac22726c72bf)();
|
|
12239
12482
|
this.state.setSelectedKeys(selection);
|
|
12240
12483
|
}
|
|
12241
12484
|
/**
|
|
@@ -12244,9 +12487,9 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12244
12487
|
if (this.selectionMode === 'none') return;
|
|
12245
12488
|
let selection = new ($e40ea825a81a3709$export$52baac22726c72bf)();
|
|
12246
12489
|
for (let key of keys){
|
|
12247
|
-
|
|
12248
|
-
if (
|
|
12249
|
-
selection.add(
|
|
12490
|
+
let mappedKey = this.getKey(key);
|
|
12491
|
+
if (mappedKey != null) {
|
|
12492
|
+
selection.add(mappedKey);
|
|
12250
12493
|
if (this.selectionMode === 'single') break;
|
|
12251
12494
|
}
|
|
12252
12495
|
}
|
|
@@ -12257,10 +12500,12 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12257
12500
|
let addKeys = (key)=>{
|
|
12258
12501
|
while(key != null){
|
|
12259
12502
|
if (this.canSelectItem(key)) {
|
|
12503
|
+
var _getFirstItem;
|
|
12260
12504
|
let item = this.collection.getItem(key);
|
|
12261
|
-
if (item.type === 'item') keys.push(key);
|
|
12505
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'item') keys.push(key);
|
|
12506
|
+
var _getFirstItem_key;
|
|
12262
12507
|
// Add child keys. If cell selection is allowed, then include item children too.
|
|
12263
|
-
if (item.hasChildNodes && (this.allowsCellSelection || item.type !== 'item')) addKeys(($c5a24bc478652b5f$export$fbdeaa6a76694f71)(($c5a24bc478652b5f$export$1005530eda016c13)(item, this.collection)).key);
|
|
12508
|
+
if ((item === null || item === void 0 ? void 0 : item.hasChildNodes) && (this.allowsCellSelection || item.type !== 'item')) addKeys((_getFirstItem_key = (_getFirstItem = ($c5a24bc478652b5f$export$fbdeaa6a76694f71)(($c5a24bc478652b5f$export$1005530eda016c13)(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null);
|
|
12264
12509
|
}
|
|
12265
12510
|
key = this.collection.getKeyAfter(key);
|
|
12266
12511
|
}
|
|
@@ -12333,6 +12578,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12333
12578
|
var _options_allowsCellSelection;
|
|
12334
12579
|
this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
|
|
12335
12580
|
this._isSelectAll = null;
|
|
12581
|
+
this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
|
|
12336
12582
|
}
|
|
12337
12583
|
}
|
|
12338
12584
|
|
|
@@ -12351,7 +12597,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
12351
12597
|
|
|
12352
12598
|
|
|
12353
12599
|
function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
12354
|
-
let { filter: filter } = props;
|
|
12600
|
+
let { filter: filter, layoutDelegate: layoutDelegate } = props;
|
|
12355
12601
|
let selectionState = ($7af3f5b51489e0b5$export$253fe78d46329472)(props);
|
|
12356
12602
|
let disabledKeys = (useMemo)(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set(), [
|
|
12357
12603
|
props.disabledKeys
|
|
@@ -12365,30 +12611,35 @@ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
|
12365
12611
|
props.suppressTextValueWarning
|
|
12366
12612
|
]);
|
|
12367
12613
|
let collection = ($7613b1592d41b092$export$6cd28814d92fa9c9)(props, factory, context);
|
|
12368
|
-
let selectionManager = (useMemo)(()=>new ($d496c0a20b6e58ec$export$6c8a5aaad13c9852)(collection, selectionState
|
|
12614
|
+
let selectionManager = (useMemo)(()=>new ($d496c0a20b6e58ec$export$6c8a5aaad13c9852)(collection, selectionState, {
|
|
12615
|
+
layoutDelegate: layoutDelegate
|
|
12616
|
+
}), [
|
|
12369
12617
|
collection,
|
|
12370
|
-
selectionState
|
|
12618
|
+
selectionState,
|
|
12619
|
+
layoutDelegate
|
|
12371
12620
|
]);
|
|
12372
12621
|
// Reset focused key if that item is deleted from the collection.
|
|
12373
12622
|
const cachedCollection = (useRef)(null);
|
|
12374
12623
|
(useEffect)(()=>{
|
|
12375
|
-
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) {
|
|
12624
|
+
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey) && cachedCollection.current) {
|
|
12376
12625
|
const startItem = cachedCollection.current.getItem(selectionState.focusedKey);
|
|
12377
12626
|
const cachedItemNodes = [
|
|
12378
12627
|
...cachedCollection.current.getKeys()
|
|
12379
12628
|
].map((key)=>{
|
|
12380
12629
|
const itemNode = cachedCollection.current.getItem(key);
|
|
12381
|
-
return itemNode.type === 'item' ? itemNode : null;
|
|
12630
|
+
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === 'item' ? itemNode : null;
|
|
12382
12631
|
}).filter((node)=>node !== null);
|
|
12383
12632
|
const itemNodes = [
|
|
12384
12633
|
...collection.getKeys()
|
|
12385
12634
|
].map((key)=>{
|
|
12386
12635
|
const itemNode = collection.getItem(key);
|
|
12387
|
-
return itemNode.type === 'item' ? itemNode : null;
|
|
12636
|
+
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === 'item' ? itemNode : null;
|
|
12388
12637
|
}).filter((node)=>node !== null);
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12638
|
+
var _cachedItemNodes_length, _itemNodes_length;
|
|
12639
|
+
const diff = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
|
|
12640
|
+
var _startItem_index, _startItem_index1, _itemNodes_length1;
|
|
12641
|
+
let index = Math.min(diff > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
|
|
12642
|
+
let newNode = null;
|
|
12392
12643
|
let isReverseSearching = false;
|
|
12393
12644
|
while(index >= 0){
|
|
12394
12645
|
if (!selectionManager.isDisabled(itemNodes[index].key)) {
|
|
@@ -12399,7 +12650,8 @@ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
|
12399
12650
|
if (index < itemNodes.length - 1 && !isReverseSearching) index++;
|
|
12400
12651
|
else {
|
|
12401
12652
|
isReverseSearching = true;
|
|
12402
|
-
|
|
12653
|
+
var _startItem_index2, _startItem_index3;
|
|
12654
|
+
if (index > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0)) index = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
|
|
12403
12655
|
index--;
|
|
12404
12656
|
}
|
|
12405
12657
|
}
|
|
@@ -12447,6 +12699,8 @@ function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
|
|
|
12447
12699
|
allowDuplicateSelectionEvents: true,
|
|
12448
12700
|
selectedKeys: selectedKeys,
|
|
12449
12701
|
onSelectionChange: (keys)=>{
|
|
12702
|
+
// impossible, but TS doesn't know that
|
|
12703
|
+
if (keys === 'all') return;
|
|
12450
12704
|
var _keys_values_next_value;
|
|
12451
12705
|
let key = (_keys_values_next_value = keys.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
|
|
12452
12706
|
// Always fire onSelectionChange, even if the key is the same
|
|
@@ -12505,6 +12759,62 @@ function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
|
|
12505
12759
|
};
|
|
12506
12760
|
}
|
|
12507
12761
|
|
|
12762
|
+
/*
|
|
12763
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12764
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12765
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12766
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12767
|
+
*
|
|
12768
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12769
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12770
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12771
|
+
* governing permissions and limitations under the License.
|
|
12772
|
+
*/
|
|
12773
|
+
|
|
12774
|
+
function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props) {
|
|
12775
|
+
let overlayTriggerState = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
|
|
12776
|
+
let [focusStrategy, setFocusStrategy] = (useState)(null);
|
|
12777
|
+
let [expandedKeysStack, setExpandedKeysStack] = (useState)([]);
|
|
12778
|
+
let closeAll = ()=>{
|
|
12779
|
+
setExpandedKeysStack([]);
|
|
12780
|
+
overlayTriggerState.close();
|
|
12781
|
+
};
|
|
12782
|
+
let openSubmenu = (triggerKey, level)=>{
|
|
12783
|
+
setExpandedKeysStack((oldStack)=>{
|
|
12784
|
+
if (level > oldStack.length) return oldStack;
|
|
12785
|
+
return [
|
|
12786
|
+
...oldStack.slice(0, level),
|
|
12787
|
+
triggerKey
|
|
12788
|
+
];
|
|
12789
|
+
});
|
|
12790
|
+
};
|
|
12791
|
+
let closeSubmenu = (triggerKey, level)=>{
|
|
12792
|
+
setExpandedKeysStack((oldStack)=>{
|
|
12793
|
+
let key = oldStack[level];
|
|
12794
|
+
if (key === triggerKey) return oldStack.slice(0, level);
|
|
12795
|
+
else return oldStack;
|
|
12796
|
+
});
|
|
12797
|
+
};
|
|
12798
|
+
return {
|
|
12799
|
+
focusStrategy: focusStrategy,
|
|
12800
|
+
...overlayTriggerState,
|
|
12801
|
+
open (focusStrategy = null) {
|
|
12802
|
+
setFocusStrategy(focusStrategy);
|
|
12803
|
+
overlayTriggerState.open();
|
|
12804
|
+
},
|
|
12805
|
+
toggle (focusStrategy = null) {
|
|
12806
|
+
setFocusStrategy(focusStrategy);
|
|
12807
|
+
overlayTriggerState.toggle();
|
|
12808
|
+
},
|
|
12809
|
+
close () {
|
|
12810
|
+
closeAll();
|
|
12811
|
+
},
|
|
12812
|
+
expandedKeysStack: expandedKeysStack,
|
|
12813
|
+
openSubmenu: openSubmenu,
|
|
12814
|
+
closeSubmenu: closeSubmenu
|
|
12815
|
+
};
|
|
12816
|
+
}
|
|
12817
|
+
|
|
12508
12818
|
/*
|
|
12509
12819
|
* Copyright 2020 Adobe. All rights reserved.
|
|
12510
12820
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -12630,7 +12940,7 @@ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
|
12630
12940
|
let { delay: delay = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay: closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
|
|
12631
12941
|
let { isOpen: isOpen, open: open, close: close } = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
|
|
12632
12942
|
let id = (useMemo)(()=>`${++$8796f90736e175cb$var$tooltipId}`, []);
|
|
12633
|
-
let closeTimeout = (useRef)(
|
|
12943
|
+
let closeTimeout = (useRef)(null);
|
|
12634
12944
|
let closeCallback = (useRef)(close);
|
|
12635
12945
|
let ensureTooltipEntry = ()=>{
|
|
12636
12946
|
$8796f90736e175cb$var$tooltips[id] = hideTooltip;
|
|
@@ -12642,7 +12952,7 @@ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
|
12642
12952
|
}
|
|
12643
12953
|
};
|
|
12644
12954
|
let showTooltip = ()=>{
|
|
12645
|
-
clearTimeout(closeTimeout.current);
|
|
12955
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
12646
12956
|
closeTimeout.current = null;
|
|
12647
12957
|
closeOpenTooltips();
|
|
12648
12958
|
ensureTooltipEntry();
|
|
@@ -12659,7 +12969,7 @@ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
|
12659
12969
|
};
|
|
12660
12970
|
let hideTooltip = (immediate)=>{
|
|
12661
12971
|
if (immediate || closeDelay <= 0) {
|
|
12662
|
-
clearTimeout(closeTimeout.current);
|
|
12972
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
12663
12973
|
closeTimeout.current = null;
|
|
12664
12974
|
closeCallback.current();
|
|
12665
12975
|
} else if (!closeTimeout.current) closeTimeout.current = setTimeout(()=>{
|
|
@@ -12694,10 +13004,9 @@ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
|
12694
13004
|
}, [
|
|
12695
13005
|
close
|
|
12696
13006
|
]);
|
|
12697
|
-
// eslint-disable-next-line arrow-body-style
|
|
12698
13007
|
(useEffect)(()=>{
|
|
12699
13008
|
return ()=>{
|
|
12700
|
-
clearTimeout(closeTimeout.current);
|
|
13009
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
12701
13010
|
let tooltip = $8796f90736e175cb$var$tooltips[id];
|
|
12702
13011
|
if (tooltip) delete $8796f90736e175cb$var$tooltips[id];
|
|
12703
13012
|
};
|
|
@@ -12727,6 +13036,7 @@ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
|
12727
13036
|
*/
|
|
12728
13037
|
|
|
12729
13038
|
|
|
13039
|
+
|
|
12730
13040
|
const $ee014567cb39d3f0$export$ff05c3ac10437e03 = /*#__PURE__*/ (createContext)(null);
|
|
12731
13041
|
function $ee014567cb39d3f0$var$FieldError(props, ref) {
|
|
12732
13042
|
let validation = (useContext)($ee014567cb39d3f0$export$ff05c3ac10437e03);
|
|
@@ -12741,6 +13051,7 @@ function $ee014567cb39d3f0$var$FieldError(props, ref) {
|
|
|
12741
13051
|
*/ const $ee014567cb39d3f0$export$f551688fc98f2e09 = /*#__PURE__*/ (forwardRef)($ee014567cb39d3f0$var$FieldError);
|
|
12742
13052
|
const $ee014567cb39d3f0$var$FieldErrorInner = /*#__PURE__*/ (forwardRef)((props, ref)=>{
|
|
12743
13053
|
let validation = (useContext)($ee014567cb39d3f0$export$ff05c3ac10437e03);
|
|
13054
|
+
let domProps = ($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(props);
|
|
12744
13055
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
12745
13056
|
...props,
|
|
12746
13057
|
defaultClassName: 'react-aria-FieldError',
|
|
@@ -12750,6 +13061,7 @@ const $ee014567cb39d3f0$var$FieldErrorInner = /*#__PURE__*/ (forwardRef)((props,
|
|
|
12750
13061
|
if (renderProps.children == null) return null;
|
|
12751
13062
|
return /*#__PURE__*/ ($dbSRa$react).createElement(($514c0188e459b4c0$export$5f1af8db9871e1d6), {
|
|
12752
13063
|
slot: "errorMessage",
|
|
13064
|
+
...domProps,
|
|
12753
13065
|
...renderProps,
|
|
12754
13066
|
ref: ref
|
|
12755
13067
|
});
|
|
@@ -12804,32 +13116,6 @@ function $d3e0e05bdfcf66bd$var$Form(props, ref) {
|
|
|
12804
13116
|
*/
|
|
12805
13117
|
|
|
12806
13118
|
|
|
12807
|
-
const $01b77f81d0f07f68$export$75b6ee27786ba447 = /*#__PURE__*/ (createContext)({});
|
|
12808
|
-
function $01b77f81d0f07f68$var$Label(props, ref) {
|
|
12809
|
-
[props, ref] = ($64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $01b77f81d0f07f68$export$75b6ee27786ba447);
|
|
12810
|
-
let { elementType: ElementType = 'label', ...labelProps } = props;
|
|
12811
|
-
// @ts-ignore
|
|
12812
|
-
return /*#__PURE__*/ ($dbSRa$react).createElement(ElementType, {
|
|
12813
|
-
className: "react-aria-Label",
|
|
12814
|
-
...labelProps,
|
|
12815
|
-
ref: ref
|
|
12816
|
-
});
|
|
12817
|
-
}
|
|
12818
|
-
const $01b77f81d0f07f68$export$b04be29aa201d4f5 = /*#__PURE__*/ ($f39a9eba43920ace$export$86427a43e3e48ebb)($01b77f81d0f07f68$var$Label);
|
|
12819
|
-
|
|
12820
|
-
/*
|
|
12821
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
12822
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12823
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12824
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12825
|
-
*
|
|
12826
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12827
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12828
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12829
|
-
* governing permissions and limitations under the License.
|
|
12830
|
-
*/
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
13119
|
|
|
12834
13120
|
|
|
12835
13121
|
|
|
@@ -12913,7 +13199,7 @@ function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
|
12913
13199
|
let groupState = (useContext)($bc237834342dbd75$export$139c5b8563afc1fc);
|
|
12914
13200
|
let inputRef = ($df56164dff5785e2$export$4338b53315abf666)(($5dc95899b306f630$export$c9058316764c140e)(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));
|
|
12915
13201
|
let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isPressed: isPressed, isInvalid: isInvalid } = groupState ? ($fba3e38d5ca8983f$export$353b32fc6898d37d)({
|
|
12916
|
-
...props,
|
|
13202
|
+
...($64fa3d84918910a7$export$ef03459518577ad4)(props),
|
|
12917
13203
|
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
12918
13204
|
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
12919
13205
|
// @ts-ignore
|
|
@@ -12921,7 +13207,7 @@ function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
|
12921
13207
|
// ReactNode type doesn't allow function children.
|
|
12922
13208
|
children: typeof props.children === 'function' ? true : props.children
|
|
12923
13209
|
}, groupState, inputRef) : ($406796ff087fe49b$export$e375f10ce42261c5)({
|
|
12924
|
-
...props,
|
|
13210
|
+
...($64fa3d84918910a7$export$ef03459518577ad4)(props),
|
|
12925
13211
|
children: typeof props.children === 'function' ? true : props.children,
|
|
12926
13212
|
validationBehavior: validationBehavior
|
|
12927
13213
|
}, ($3017fa7ffdddec74$export$8042c6c013fd5226)(props), inputRef);
|
|
@@ -12932,7 +13218,6 @@ function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
|
12932
13218
|
isDisabled: isInteractionDisabled
|
|
12933
13219
|
});
|
|
12934
13220
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
12935
|
-
// TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
|
|
12936
13221
|
...props,
|
|
12937
13222
|
defaultClassName: 'react-aria-Checkbox',
|
|
12938
13223
|
values: {
|
|
@@ -13430,7 +13715,7 @@ function $612b8eb6cb90e02d$export$d1e8e3fbb7461f6(selectionManager, dragAndDropH
|
|
|
13430
13715
|
return new Set([
|
|
13431
13716
|
focusedKey,
|
|
13432
13717
|
dropTargetKey
|
|
13433
|
-
].filter((k)=>k
|
|
13718
|
+
].filter((k)=>k != null));
|
|
13434
13719
|
}, [
|
|
13435
13720
|
focusedKey,
|
|
13436
13721
|
dropTargetKey
|
|
@@ -13528,7 +13813,11 @@ function $eed445e0843c11d0$var$StandaloneListBox({ props: props, listBoxRef: lis
|
|
|
13528
13813
|
children: null,
|
|
13529
13814
|
items: null
|
|
13530
13815
|
};
|
|
13531
|
-
let
|
|
13816
|
+
let { layoutDelegate: layoutDelegate } = (useContext)(($7135fc7d473fd974$export$4feb769f8ddf26c5));
|
|
13817
|
+
let state = ($e72dd72e1c76a225$export$2f645645f7bca764)({
|
|
13818
|
+
...props,
|
|
13819
|
+
layoutDelegate: layoutDelegate
|
|
13820
|
+
});
|
|
13532
13821
|
return /*#__PURE__*/ ($dbSRa$react).createElement($eed445e0843c11d0$var$ListBoxInner, {
|
|
13533
13822
|
state: state,
|
|
13534
13823
|
props: props,
|
|
@@ -13692,6 +13981,7 @@ function $eed445e0843c11d0$var$ListBoxInner({ state: state, props: props, listBo
|
|
|
13692
13981
|
[
|
|
13693
13982
|
($7135fc7d473fd974$export$d40e14dec8b060a8),
|
|
13694
13983
|
{
|
|
13984
|
+
name: 'ListBoxSection',
|
|
13695
13985
|
render: $eed445e0843c11d0$var$ListBoxSection
|
|
13696
13986
|
}
|
|
13697
13987
|
]
|
|
@@ -13703,7 +13993,7 @@ function $eed445e0843c11d0$var$ListBoxInner({ state: state, props: props, listBo
|
|
|
13703
13993
|
renderDropIndicator: ($612b8eb6cb90e02d$export$971707d8a129a1f7)(dragAndDropHooks, dropState)
|
|
13704
13994
|
})), emptyState, dragPreview));
|
|
13705
13995
|
}
|
|
13706
|
-
function $eed445e0843c11d0$var$ListBoxSection(props, ref, section) {
|
|
13996
|
+
function $eed445e0843c11d0$var$ListBoxSection(props, ref, section, className = 'react-aria-ListBoxSection') {
|
|
13707
13997
|
let state = (useContext)($eed445e0843c11d0$export$7c5906fe4f1f2af2);
|
|
13708
13998
|
let { dragAndDropHooks: dragAndDropHooks, dropState: dropState } = (useContext)(($612b8eb6cb90e02d$export$d188a835a7bc5783));
|
|
13709
13999
|
let { CollectionBranch: CollectionBranch } = (useContext)(($7135fc7d473fd974$export$4feb769f8ddf26c5));
|
|
@@ -13714,7 +14004,7 @@ function $eed445e0843c11d0$var$ListBoxSection(props, ref, section) {
|
|
|
13714
14004
|
'aria-label': (_props_arialabel = props['aria-label']) !== null && _props_arialabel !== void 0 ? _props_arialabel : undefined
|
|
13715
14005
|
});
|
|
13716
14006
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
13717
|
-
defaultClassName:
|
|
14007
|
+
defaultClassName: className,
|
|
13718
14008
|
className: props.className,
|
|
13719
14009
|
style: props.style,
|
|
13720
14010
|
values: {}
|
|
@@ -13863,9 +14153,9 @@ function $44f671af83e7d9e0$var$OverlayArrow(props, ref) {
|
|
|
13863
14153
|
let placement = props.placement;
|
|
13864
14154
|
let style = {
|
|
13865
14155
|
position: 'absolute',
|
|
13866
|
-
[placement]: '100%',
|
|
13867
14156
|
transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'
|
|
13868
14157
|
};
|
|
14158
|
+
if (placement != null) style[placement] = '100%';
|
|
13869
14159
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
13870
14160
|
...props,
|
|
13871
14161
|
defaultClassName: 'react-aria-OverlayArrow',
|
|
@@ -13976,6 +14266,7 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
13976
14266
|
...renderProps.style
|
|
13977
14267
|
};
|
|
13978
14268
|
return /*#__PURE__*/ ($dbSRa$react).createElement(($337b884510726a0d$export$c6fdb837b070b4ff), {
|
|
14269
|
+
...props,
|
|
13979
14270
|
isExiting: isExiting,
|
|
13980
14271
|
portalContainer: UNSTABLE_portalContainer
|
|
13981
14272
|
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ ($dbSRa$react).createElement("div", {
|
|
@@ -14008,6 +14299,8 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
14008
14299
|
})));
|
|
14009
14300
|
}
|
|
14010
14301
|
|
|
14302
|
+
const $3674c52c6b3c5bce$export$795aec4671cbae19 = /*#__PURE__*/ (createContext)(null);
|
|
14303
|
+
|
|
14011
14304
|
/*
|
|
14012
14305
|
* Copyright 2022 Adobe. All rights reserved.
|
|
14013
14306
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -14026,10 +14319,14 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
14026
14319
|
|
|
14027
14320
|
|
|
14028
14321
|
|
|
14322
|
+
|
|
14323
|
+
|
|
14029
14324
|
const $de32f1b87079253c$export$8b93a07348a7730c = /*#__PURE__*/ (createContext)(null);
|
|
14030
14325
|
const $de32f1b87079253c$export$d2f961adcb0afbe = /*#__PURE__*/ (createContext)(null);
|
|
14031
14326
|
function $de32f1b87079253c$export$2e1e1122cf0cba88(props) {
|
|
14032
|
-
|
|
14327
|
+
// Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.
|
|
14328
|
+
// This is needed to handle submenus.
|
|
14329
|
+
let state = ($a28c903ee9ad8dc5$export$79fefeb1c2091ac3)(props);
|
|
14033
14330
|
let buttonRef = (useRef)(null);
|
|
14034
14331
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = ($628037886ba31236$export$f9d5c8beee7d008d)({
|
|
14035
14332
|
type: 'dialog'
|
|
@@ -14046,6 +14343,10 @@ function $de32f1b87079253c$export$2e1e1122cf0cba88(props) {
|
|
|
14046
14343
|
$de32f1b87079253c$export$d2f961adcb0afbe,
|
|
14047
14344
|
state
|
|
14048
14345
|
],
|
|
14346
|
+
[
|
|
14347
|
+
($3674c52c6b3c5bce$export$795aec4671cbae19),
|
|
14348
|
+
state
|
|
14349
|
+
],
|
|
14049
14350
|
[
|
|
14050
14351
|
$de32f1b87079253c$export$8b93a07348a7730c,
|
|
14051
14352
|
overlayProps
|
|
@@ -14074,24 +14375,27 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
|
|
|
14074
14375
|
'aria-labelledby': originalAriaLabelledby
|
|
14075
14376
|
}, ref);
|
|
14076
14377
|
let state = (useContext)($de32f1b87079253c$export$d2f961adcb0afbe);
|
|
14077
|
-
let children = props.children;
|
|
14078
|
-
if (typeof children === 'function') children = children({
|
|
14079
|
-
close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
|
|
14080
|
-
});
|
|
14081
14378
|
if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {
|
|
14082
14379
|
// If aria-labelledby exists on props, we know it came from context.
|
|
14083
14380
|
// Use that as a fallback in case there is no title slot.
|
|
14084
14381
|
if (props['aria-labelledby']) dialogProps['aria-labelledby'] = props['aria-labelledby'];
|
|
14085
14382
|
else console.warn('If a Dialog does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.');
|
|
14086
14383
|
}
|
|
14087
|
-
|
|
14384
|
+
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
14385
|
+
defaultClassName: 'react-aria-Dialog',
|
|
14386
|
+
className: props.className,
|
|
14387
|
+
style: props.style,
|
|
14388
|
+
children: props.children,
|
|
14389
|
+
values: {
|
|
14390
|
+
close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
|
|
14391
|
+
}
|
|
14392
|
+
});
|
|
14088
14393
|
return /*#__PURE__*/ ($dbSRa$react).createElement("section", {
|
|
14089
14394
|
...($65484d02dcb7eb3e$export$457c3d6518dd4c6f)(props),
|
|
14090
14395
|
...dialogProps,
|
|
14396
|
+
...renderProps,
|
|
14091
14397
|
ref: ref,
|
|
14092
|
-
slot: props.slot || undefined
|
|
14093
|
-
style: props.style,
|
|
14094
|
-
className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-Dialog'
|
|
14398
|
+
slot: props.slot || undefined
|
|
14095
14399
|
}, /*#__PURE__*/ ($dbSRa$react).createElement(($64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
14096
14400
|
values: [
|
|
14097
14401
|
[
|
|
@@ -14105,9 +14409,20 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
|
|
|
14105
14409
|
}
|
|
14106
14410
|
}
|
|
14107
14411
|
}
|
|
14412
|
+
],
|
|
14413
|
+
[
|
|
14414
|
+
($d2b4bc8c273e7be6$export$24d547caef80ccd1),
|
|
14415
|
+
{
|
|
14416
|
+
slots: {
|
|
14417
|
+
[($64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
14418
|
+
close: {
|
|
14419
|
+
onPress: ()=>state === null || state === void 0 ? void 0 : state.close()
|
|
14420
|
+
}
|
|
14421
|
+
}
|
|
14422
|
+
}
|
|
14108
14423
|
]
|
|
14109
14424
|
]
|
|
14110
|
-
}, children));
|
|
14425
|
+
}, renderProps.children));
|
|
14111
14426
|
}
|
|
14112
14427
|
/**
|
|
14113
14428
|
* A dialog is an overlay shown above other content in an application.
|
|
@@ -14629,10 +14944,10 @@ function $82d7e5349645de74$var$SelectValue(props, ref) {
|
|
|
14629
14944
|
});
|
|
14630
14945
|
}
|
|
14631
14946
|
let stringFormatter = ($fca6afa0e843324b$export$f12b703ca79dfbb1)((($parcel$interopDefault($df39c1238ae2b5f3$exports))), 'react-aria-components');
|
|
14632
|
-
var _state_selectedItem_value, _state_selectedItem_textValue;
|
|
14947
|
+
var _ref, _state_selectedItem_value, _state_selectedItem_textValue;
|
|
14633
14948
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
14634
14949
|
...props,
|
|
14635
|
-
defaultChildren: rendered
|
|
14950
|
+
defaultChildren: (_ref = rendered !== null && rendered !== void 0 ? rendered : placeholder) !== null && _ref !== void 0 ? _ref : stringFormatter.format('selectPlaceholder'),
|
|
14636
14951
|
defaultClassName: 'react-aria-SelectValue',
|
|
14637
14952
|
values: {
|
|
14638
14953
|
selectedItem: (_state_selectedItem_value = (_state_selectedItem = state.selectedItem) === null || _state_selectedItem === void 0 ? void 0 : _state_selectedItem.value) !== null && _state_selectedItem_value !== void 0 ? _state_selectedItem_value : null,
|
|
@@ -15156,7 +15471,8 @@ function $4e3b923658d69c60$var$TooltipInner(props) {
|
|
|
15156
15471
|
isOpen: state.isOpen,
|
|
15157
15472
|
arrowSize: arrowWidth,
|
|
15158
15473
|
arrowBoundaryOffset: props.arrowBoundaryOffset,
|
|
15159
|
-
shouldFlip: props.shouldFlip
|
|
15474
|
+
shouldFlip: props.shouldFlip,
|
|
15475
|
+
onClose: ()=>state.close(true)
|
|
15160
15476
|
});
|
|
15161
15477
|
let isEntering = ($64fa3d84918910a7$export$6d3443f2c48bfc20)(props.tooltipRef, !!placement) || props.isEntering || false;
|
|
15162
15478
|
let renderProps = ($64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
@@ -15179,7 +15495,7 @@ function $4e3b923658d69c60$var$TooltipInner(props) {
|
|
|
15179
15495
|
...overlayProps.style,
|
|
15180
15496
|
...renderProps.style
|
|
15181
15497
|
},
|
|
15182
|
-
"data-placement": placement,
|
|
15498
|
+
"data-placement": placement !== null && placement !== void 0 ? placement : undefined,
|
|
15183
15499
|
"data-entering": isEntering || undefined,
|
|
15184
15500
|
"data-exiting": props.isExiting || undefined
|
|
15185
15501
|
}, /*#__PURE__*/ ($dbSRa$react).createElement(($44f671af83e7d9e0$export$2de4954e8ae13b9f).Provider, {
|