@okam/stack-ui 1.43.0 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/index180.js +1 -1
- package/index180.mjs +3 -3
- package/index181.js +1 -1
- package/index181.mjs +1 -1
- package/index182.js +1 -1
- package/index182.mjs +1 -1
- package/index183.js +1 -1
- package/index183.mjs +2 -2
- package/index282.js +1 -1
- package/index282.mjs +9 -31
- package/index283.js +1 -1
- package/index283.mjs +133 -9
- package/index284.js +1 -1
- package/index284.mjs +43 -133
- package/index285.js +1 -1
- package/index285.mjs +231 -43
- package/index286.js +1 -1
- package/index286.mjs +27 -227
- package/index341.js +1 -1
- package/index341.mjs +20 -65
- package/index342.js +1 -1
- package/index342.mjs +29 -54
- package/index343.js +1 -1
- package/index343.mjs +63 -51
- package/index344.js +1 -1
- package/index344.mjs +44 -271
- package/index345.js +1 -1
- package/index345.mjs +52 -18
- package/index346.js +1 -1
- package/index346.mjs +281 -21
- package/index347.js +1 -1
- package/index347.mjs +20 -29
- package/index8.js +1 -1
- package/index8.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## 1.44.0 (2026-01-14)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **stack-ui:** listbox react hook form integration ([f79cffc](https://github.com/OKAMca/stack/commit/f79cffc))
|
|
6
|
+
- ⚠️ React 19 + Next.js 15 upgrade for all @okam/* packages ([#369](https://github.com/OKAMca/stack/pull/369))
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- **stack-ui:** props order fix ([b129ebe](https://github.com/OKAMca/stack/commit/b129ebe))
|
|
11
|
+
- **stack-ui:** add icon + error icon to text input ([485cd9e](https://github.com/OKAMca/stack/commit/485cd9e))
|
|
12
|
+
- **stack-ui:** typing fixes ([dc7b453](https://github.com/OKAMca/stack/commit/dc7b453))
|
|
13
|
+
|
|
14
|
+
### ⚠️ Breaking Changes
|
|
15
|
+
|
|
16
|
+
- Consumers must now have react and react-dom in their own
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Marie-Maxime Tanguay @marie-maxime
|
|
21
|
+
- Max Hilland
|
|
22
|
+
- Pierre-Olivier Clerson @poclerson
|
|
23
|
+
|
|
1
24
|
# 1.43.0 (2026-01-13)
|
|
2
25
|
|
|
3
26
|
### 🚀 Features
|
package/index180.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index282.js"),y=require("./index284.js"),m=require("./index185.js"),q=require("./index158.js"),p=require("./index253.js"),L=require("@react-aria/i18n"),P=require("react"),f=require("./index285.js");function I(t,o,i){let{orientation:e="horizontal",keyboardActivation:n="automatic"}=t,{collection:l,selectionManager:c,disabledKeys:a}=o,{direction:r}=L.useLocale(),u=P.useMemo(()=>new y.TabsKeyboardDelegate(l,r,e,a),[l,a,e,r]),{collectionProps:b}=f.useSelectableCollection({ref:i,selectionManager:c,keyboardDelegate:u,selectOnFocus:n==="automatic",disallowEmptySelection:!0,scrollRef:i,linkBehavior:"selection"}),s=m.useId();g.tabsIds.set(o,s);let d=p.useLabels({...t,id:s});return{tabListProps:{...q.mergeProps(b,d),role:"tablist","aria-orientation":e,tabIndex:void 0}}}exports.useTabList=I;
|
package/index180.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { tabsIds as m } from "./
|
|
2
|
-
import { TabsKeyboardDelegate as $ } from "./
|
|
1
|
+
import { tabsIds as m } from "./index282.mjs";
|
|
2
|
+
import { TabsKeyboardDelegate as $ } from "./index284.mjs";
|
|
3
3
|
import { useId as p } from "./index185.mjs";
|
|
4
4
|
import { mergeProps as u } from "./index158.mjs";
|
|
5
5
|
import { useLabels as x } from "./index253.mjs";
|
|
6
6
|
import { useLocale as g } from "@react-aria/i18n";
|
|
7
7
|
import { useMemo as y } from "react";
|
|
8
|
-
import { useSelectableCollection as L } from "./
|
|
8
|
+
import { useSelectableCollection as L } from "./index285.mjs";
|
|
9
9
|
function A(o, t, a) {
|
|
10
10
|
let { orientation: e = "horizontal", keyboardActivation: s = "automatic" } = o, { collection: r, selectionManager: d, disabledKeys: i } = t, { direction: c } = g(), n = y(() => new $(r, c, e, i), [
|
|
11
11
|
r,
|
package/index181.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index286.js"),r=require("react");function K(e){var u,l;let a=S.useSingleSelectListState({...e,onSelectionChange:e.onSelectionChange?t=>{var s;t!=null&&((s=e.onSelectionChange)===null||s===void 0||s.call(e,t))}:void 0,suppressTextValueWarning:!0,defaultSelectedKey:(l=(u=e.defaultSelectedKey)!==null&&u!==void 0?u:y(e.collection,e.disabledKeys?new Set(e.disabledKeys):new Set))!==null&&l!==void 0?l:void 0}),{selectionManager:d,collection:n,selectedKey:i}=a,f=r.useRef(i);return r.useEffect(()=>{let t=i;e.selectedKey==null&&(d.isEmpty||t==null||!n.getItem(t))&&(t=y(n,a.disabledKeys),t!=null&&d.setSelectedKeys([t])),(t!=null&&d.focusedKey==null||!d.isFocused&&t!==f.current)&&d.setFocusedKey(t),f.current=t}),{...a,isDisabled:e.isDisabled||!1}}function y(e,u){let l=null;if(e){var a,d,n,i;for(l=e.getFirstKey();l!=null&&(u.has(l)||!((d=e.getItem(l))===null||d===void 0||(a=d.props)===null||a===void 0)&&a.isDisabled)&&l!==e.getLastKey();)l=e.getKeyAfter(l);l!=null&&(u.has(l)||!((i=e.getItem(l))===null||i===void 0||(n=i.props)===null||n===void 0)&&n.isDisabled)&&l===e.getLastKey()&&(l=e.getFirstKey())}return l}exports.useTabListState=K;
|
package/index181.mjs
CHANGED
package/index182.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index282.js"),o=require("./index158.js"),u=require("./index253.js"),s=require("@react-aria/focus");function c(a,e,d){let l=s.useHasTabbableChild(d)?void 0:0;var r;const n=i.generateId(e,(r=a.id)!==null&&r!==void 0?r:e==null?void 0:e.selectedKey,"tabpanel"),b=u.useLabels({...a,id:n,"aria-labelledby":i.generateId(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:o.mergeProps(b,{tabIndex:l,role:"tabpanel","aria-describedby":a["aria-describedby"],"aria-details":a["aria-details"]})}}exports.useTabPanel=c;
|
package/index182.mjs
CHANGED
package/index183.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index282.js"),S=require("./index158.js"),k=require("./index184.js"),y=require("./index249.js"),q=require("@react-aria/focus"),v=require("./index283.js");function M(n,e,t){let{key:s,isDisabled:c,shouldSelectOnPressUp:b}=n,{selectionManager:u,selectedKey:p}=e,r=s===p,i=c||e.isDisabled||e.selectionManager.isDisabled(s),{itemProps:o,isPressed:P}=v.useSelectableItem({selectionManager:u,key:s,ref:t,isDisabled:i,shouldSelectOnPressUp:b,linkBehavior:"selection"}),f=a.generateId(e,s,"tab"),g=a.generateId(e,s,"tabpanel"),{tabIndex:m}=o,l=e.collection.getItem(s),d=k.filterDOMProps(l==null?void 0:l.props,{labelable:!0});delete d.id;let D=y.useLinkProps(l==null?void 0:l.props),{focusableProps:I}=q.useFocusable({isDisabled:i},t);return{tabProps:S.mergeProps(d,I,D,o,{id:f,"aria-selected":r,"aria-disabled":i||void 0,"aria-controls":r?g:void 0,tabIndex:i?void 0:m,role:"tab"}),isSelected:r,isDisabled:i,isPressed:P}}exports.useTab=M;
|
package/index183.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { generateId as t } from "./
|
|
1
|
+
import { generateId as t } from "./index282.mjs";
|
|
2
2
|
import { mergeProps as I } from "./index158.mjs";
|
|
3
3
|
import { filterDOMProps as g } from "./index184.mjs";
|
|
4
4
|
import { useLinkProps as k } from "./index249.mjs";
|
|
5
5
|
import { useFocusable as S } from "@react-aria/focus";
|
|
6
|
-
import { useSelectableItem as v } from "./
|
|
6
|
+
import { useSelectableItem as v } from "./index283.mjs";
|
|
7
7
|
function B(b, e, d) {
|
|
8
8
|
let { key: s, isDisabled: c, shouldSelectOnPressUp: n } = b, { selectionManager: p, selectedKey: f } = e, r = s === f, o = c || e.isDisabled || e.selectionManager.isDisabled(s), { itemProps: i, isPressed: m } = v({
|
|
9
9
|
selectionManager: p,
|
package/index282.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=new WeakMap;function a(t,e,n){if(!t)return"";typeof e=="string"&&(e=e.replace(/\s+/g,""));let r=o.get(t);return process.env.NODE_ENV!=="production"&&!r&&console.error("There is no tab id, please check if you have rendered the tab panel before the tab list."),`${r}-${n}-${e}`}exports.generateId=a;exports.tabsIds=o;
|
package/index282.mjs
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
] : [], [
|
|
9
|
-
e
|
|
10
|
-
]), { collection: o, disabledKeys: d, selectionManager: u } = f({
|
|
11
|
-
...l,
|
|
12
|
-
selectionMode: "single",
|
|
13
|
-
disallowEmptySelection: !0,
|
|
14
|
-
allowDuplicateSelectionEvents: !0,
|
|
15
|
-
selectedKeys: i,
|
|
16
|
-
onSelectionChange: (s) => {
|
|
17
|
-
if (s === "all") return;
|
|
18
|
-
var n;
|
|
19
|
-
let a = (n = s.values().next().value) !== null && n !== void 0 ? n : null;
|
|
20
|
-
a === e && l.onSelectionChange && l.onSelectionChange(a), c(a);
|
|
21
|
-
}
|
|
22
|
-
}), r = e != null ? o.getItem(e) : null;
|
|
23
|
-
return {
|
|
24
|
-
collection: o,
|
|
25
|
-
disabledKeys: d,
|
|
26
|
-
selectionManager: u,
|
|
27
|
-
selectedKey: e,
|
|
28
|
-
setSelectedKey: c,
|
|
29
|
-
selectedItem: r
|
|
30
|
-
};
|
|
1
|
+
const o = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
function n(r, e, a) {
|
|
3
|
+
if (!r)
|
|
4
|
+
return "";
|
|
5
|
+
typeof e == "string" && (e = e.replace(/\s+/g, ""));
|
|
6
|
+
let t = o.get(r);
|
|
7
|
+
return process.env.NODE_ENV !== "production" && !t && console.error("There is no tab id, please check if you have rendered the tab panel before the tab list."), `${t}-${a}-${e}`;
|
|
31
8
|
}
|
|
32
9
|
export {
|
|
33
|
-
|
|
10
|
+
n as generateId,
|
|
11
|
+
o as tabsIds
|
|
34
12
|
};
|
package/index283.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./index341.js"),z=require("./index185.js"),G=require("./index243.js"),C=require("./index158.js"),L=require("./index249.js"),H=require("./index267.js"),J=require("./index238.js"),Q=require("./index338.js"),W=require("./index340.js"),X=require("@react-aria/focus"),m=require("react");function Y(s){let{id:h,selectionManager:t,key:o,ref:r,shouldSelectOnPressUp:$,shouldUseVirtualFocus:c,focus:F,isDisabled:l,onAction:v,allowsDifferentPressOrigin:I,linkBehavior:u="action"}=s,w=L.useRouter();h=z.useId(h);let a=e=>{if(e.pointerType==="keyboard"&&O.isNonContiguousSelectionModifier(e))t.toggleSelection(o);else{if(t.selectionMode==="none")return;if(t.isLink(o)){if(u==="selection"&&r.current){let d=t.getItemProps(o);w.open(r.current,e,d.href,d.routerOptions),t.setSelectedKeys(t.selectedKeys);return}else if(u==="override"||u==="none")return}t.selectionMode==="single"?t.isSelected(o)&&!t.disallowEmptySelection?t.toggleSelection(o):t.replaceSelection(o):e&&e.shiftKey?t.extendSelection(o):t.selectionBehavior==="toggle"||e&&(H.isCtrlKeyPressed(e)||e.pointerType==="touch"||e.pointerType==="virtual")?t.toggleSelection(o):t.replaceSelection(o)}};m.useEffect(()=>{o===t.focusedKey&&t.isFocused&&(c?X.moveVirtualFocus(r.current):F?F():document.activeElement!==r.current&&r.current&&W.focusSafely(r.current))},[r,o,t.focusedKey,t.childFocusStrategy,t.isFocused,c]),l=l||t.isDisabled(o);let f={};!c&&!l?f={tabIndex:o===t.focusedKey?0:-1,onFocus(e){e.target===r.current&&t.setFocusedKey(o)}}:l&&(f.onMouseDown=e=>{e.preventDefault()});let B=t.isLink(o)&&u==="override",M=v&&s.UNSTABLE_itemBehavior==="action",A=t.isLink(o)&&u!=="selection"&&u!=="none",n=!l&&t.canSelectItem(o)&&!B&&!M,k=(v||A)&&!l,p=k&&(t.selectionBehavior==="replace"?!n:!n||t.isEmpty),T=k&&n&&t.selectionBehavior==="replace",y=p||T,g=m.useRef(null),S=y&&n,D=m.useRef(!1),K=m.useRef(!1),P=t.getItemProps(o),b=e=>{if(v){var d;v(),(d=r.current)===null||d===void 0||d.dispatchEvent(new CustomEvent("react-aria-item-action",{bubbles:!0}))}A&&r.current&&w.open(r.current,e,P.href,P.routerOptions)},i={ref:r};if($?(i.onPressStart=e=>{g.current=e.pointerType,D.current=S,e.pointerType==="keyboard"&&(!y||E())&&a(e)},I?(i.onPressUp=p?void 0:e=>{e.pointerType==="mouse"&&n&&a(e)},i.onPress=p?b:e=>{e.pointerType!=="keyboard"&&e.pointerType!=="mouse"&&n&&a(e)}):i.onPress=e=>{if(p||T&&e.pointerType!=="mouse"){if(e.pointerType==="keyboard"&&!q())return;b(e)}else e.pointerType!=="keyboard"&&n&&a(e)}):(i.onPressStart=e=>{g.current=e.pointerType,D.current=S,K.current=p,n&&(e.pointerType==="mouse"&&!p||e.pointerType==="keyboard"&&(!k||E()))&&a(e)},i.onPress=e=>{(e.pointerType==="touch"||e.pointerType==="pen"||e.pointerType==="virtual"||e.pointerType==="keyboard"&&y&&q()||e.pointerType==="mouse"&&K.current)&&(y?b(e):n&&a(e))}),f["data-collection"]=O.getCollectionId(t.collection),f["data-key"]=o,i.preventFocusOnPress=c,c&&(i=C.mergeProps(i,{onPressStart(e){e.pointerType!=="touch"&&(t.setFocused(!0),t.setFocusedKey(o))},onPress(e){e.pointerType==="touch"&&(t.setFocused(!0),t.setFocusedKey(o))}})),P)for(let e of["onPressStart","onPressEnd","onPressChange","onPress","onPressUp","onClick"])P[e]&&(i[e]=G.chain(i[e],P[e]));let{pressProps:U,isPressed:R}=J.usePress(i),x=T?e=>{g.current==="mouse"&&(e.stopPropagation(),e.preventDefault(),b(e))}:void 0,{longPressProps:V}=Q.useLongPress({isDisabled:!S,onLongPress(e){e.pointerType==="touch"&&(a(e),t.setSelectionBehavior("toggle"))}}),N=e=>{g.current==="touch"&&D.current&&e.preventDefault()},j=u!=="none"&&t.isLink(o)?e=>{L.openLink.isOpening||e.preventDefault()}:void 0;return{itemProps:C.mergeProps(f,n||p||c&&!l?U:{},S?V:{},{onDoubleClick:x,onDragStartCapture:N,onClick:j,id:h},c?{onMouseDown:e=>e.preventDefault()}:void 0),isPressed:R,isSelected:t.isSelected(o),isFocused:t.isFocused&&t.focusedKey===o,isDisabled:l,allowsSelection:n,hasAction:y}}function q(){let s=window.event;return(s==null?void 0:s.key)==="Enter"}function E(){let s=window.event;return(s==null?void 0:s.key)===" "||(s==null?void 0:s.code)==="Space"}exports.useSelectableItem=Y;
|
package/index283.mjs
CHANGED
|
@@ -1,12 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { getCollectionId as j, isNonContiguousSelectionModifier as q } from "./index341.mjs";
|
|
2
|
+
import { useId as z } from "./index185.mjs";
|
|
3
|
+
import { chain as G } from "./index243.mjs";
|
|
4
|
+
import { mergeProps as A } from "./index158.mjs";
|
|
5
|
+
import { useRouter as H, openLink as J } from "./index249.mjs";
|
|
6
|
+
import { isCtrlKeyPressed as Q } from "./index267.mjs";
|
|
7
|
+
import { usePress as W } from "./index238.mjs";
|
|
8
|
+
import { useLongPress as X } from "./index338.mjs";
|
|
9
|
+
import { focusSafely as Y } from "./index340.mjs";
|
|
10
|
+
import { moveVirtualFocus as Z } from "@react-aria/focus";
|
|
11
|
+
import { useEffect as _, useRef as T } from "react";
|
|
12
|
+
function pe(r) {
|
|
13
|
+
let { id: S, selectionManager: o, key: t, ref: i, shouldSelectOnPressUp: O, shouldUseVirtualFocus: c, focus: D, isDisabled: l, onAction: m, allowsDifferentPressOrigin: E, linkBehavior: a = "action" } = r, F = H();
|
|
14
|
+
S = z(S);
|
|
15
|
+
let f = (e) => {
|
|
16
|
+
if (e.pointerType === "keyboard" && q(e)) o.toggleSelection(t);
|
|
17
|
+
else {
|
|
18
|
+
if (o.selectionMode === "none") return;
|
|
19
|
+
if (o.isLink(t)) {
|
|
20
|
+
if (a === "selection" && i.current) {
|
|
21
|
+
let u = o.getItemProps(t);
|
|
22
|
+
F.open(i.current, e, u.href, u.routerOptions), o.setSelectedKeys(o.selectedKeys);
|
|
23
|
+
return;
|
|
24
|
+
} else if (a === "override" || a === "none") return;
|
|
25
|
+
}
|
|
26
|
+
o.selectionMode === "single" ? o.isSelected(t) && !o.disallowEmptySelection ? o.toggleSelection(t) : o.replaceSelection(t) : e && e.shiftKey ? o.extendSelection(t) : o.selectionBehavior === "toggle" || e && (Q(e) || e.pointerType === "touch" || e.pointerType === "virtual") ? o.toggleSelection(t) : o.replaceSelection(t);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
_(() => {
|
|
30
|
+
t === o.focusedKey && o.isFocused && (c ? Z(i.current) : D ? D() : document.activeElement !== i.current && i.current && Y(i.current));
|
|
31
|
+
}, [
|
|
32
|
+
i,
|
|
33
|
+
t,
|
|
34
|
+
o.focusedKey,
|
|
35
|
+
o.childFocusStrategy,
|
|
36
|
+
o.isFocused,
|
|
37
|
+
c
|
|
38
|
+
]), l = l || o.isDisabled(t);
|
|
39
|
+
let d = {};
|
|
40
|
+
!c && !l ? d = {
|
|
41
|
+
tabIndex: t === o.focusedKey ? 0 : -1,
|
|
42
|
+
onFocus(e) {
|
|
43
|
+
e.target === i.current && o.setFocusedKey(t);
|
|
44
|
+
}
|
|
45
|
+
} : l && (d.onMouseDown = (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
});
|
|
48
|
+
let L = o.isLink(t) && a === "override", B = m && r.UNSTABLE_itemBehavior === "action", x = o.isLink(t) && a !== "selection" && a !== "none", n = !l && o.canSelectItem(t) && !L && !B, g = (m || x) && !l, p = g && (o.selectionBehavior === "replace" ? !n : !n || o.isEmpty), h = g && n && o.selectionBehavior === "replace", y = p || h, P = T(null), $ = y && n, k = T(!1), w = T(!1), b = o.getItemProps(t), v = (e) => {
|
|
49
|
+
if (m) {
|
|
50
|
+
var u;
|
|
51
|
+
m(), (u = i.current) === null || u === void 0 || u.dispatchEvent(new CustomEvent("react-aria-item-action", {
|
|
52
|
+
bubbles: !0
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
x && i.current && F.open(i.current, e, b.href, b.routerOptions);
|
|
56
|
+
}, s = {
|
|
57
|
+
ref: i
|
|
58
|
+
};
|
|
59
|
+
if (O ? (s.onPressStart = (e) => {
|
|
60
|
+
P.current = e.pointerType, k.current = $, e.pointerType === "keyboard" && (!y || C()) && f(e);
|
|
61
|
+
}, E ? (s.onPressUp = p ? void 0 : (e) => {
|
|
62
|
+
e.pointerType === "mouse" && n && f(e);
|
|
63
|
+
}, s.onPress = p ? v : (e) => {
|
|
64
|
+
e.pointerType !== "keyboard" && e.pointerType !== "mouse" && n && f(e);
|
|
65
|
+
}) : s.onPress = (e) => {
|
|
66
|
+
if (p || h && e.pointerType !== "mouse") {
|
|
67
|
+
if (e.pointerType === "keyboard" && !K()) return;
|
|
68
|
+
v(e);
|
|
69
|
+
} else e.pointerType !== "keyboard" && n && f(e);
|
|
70
|
+
}) : (s.onPressStart = (e) => {
|
|
71
|
+
P.current = e.pointerType, k.current = $, w.current = p, n && (e.pointerType === "mouse" && !p || e.pointerType === "keyboard" && (!g || C())) && f(e);
|
|
72
|
+
}, s.onPress = (e) => {
|
|
73
|
+
(e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && y && K() || e.pointerType === "mouse" && w.current) && (y ? v(e) : n && f(e));
|
|
74
|
+
}), d["data-collection"] = j(o.collection), d["data-key"] = t, s.preventFocusOnPress = c, c && (s = A(s, {
|
|
75
|
+
onPressStart(e) {
|
|
76
|
+
e.pointerType !== "touch" && (o.setFocused(!0), o.setFocusedKey(t));
|
|
77
|
+
},
|
|
78
|
+
onPress(e) {
|
|
79
|
+
e.pointerType === "touch" && (o.setFocused(!0), o.setFocusedKey(t));
|
|
80
|
+
}
|
|
81
|
+
})), b)
|
|
82
|
+
for (let e of [
|
|
83
|
+
"onPressStart",
|
|
84
|
+
"onPressEnd",
|
|
85
|
+
"onPressChange",
|
|
86
|
+
"onPress",
|
|
87
|
+
"onPressUp",
|
|
88
|
+
"onClick"
|
|
89
|
+
]) b[e] && (s[e] = G(s[e], b[e]));
|
|
90
|
+
let { pressProps: I, isPressed: U } = W(s), M = h ? (e) => {
|
|
91
|
+
P.current === "mouse" && (e.stopPropagation(), e.preventDefault(), v(e));
|
|
92
|
+
} : void 0, { longPressProps: V } = X({
|
|
93
|
+
isDisabled: !$,
|
|
94
|
+
onLongPress(e) {
|
|
95
|
+
e.pointerType === "touch" && (f(e), o.setSelectionBehavior("toggle"));
|
|
96
|
+
}
|
|
97
|
+
}), N = (e) => {
|
|
98
|
+
P.current === "touch" && k.current && e.preventDefault();
|
|
99
|
+
}, R = a !== "none" && o.isLink(t) ? (e) => {
|
|
100
|
+
J.isOpening || e.preventDefault();
|
|
101
|
+
} : void 0;
|
|
102
|
+
return {
|
|
103
|
+
itemProps: A(
|
|
104
|
+
d,
|
|
105
|
+
n || p || c && !l ? I : {},
|
|
106
|
+
$ ? V : {},
|
|
107
|
+
{
|
|
108
|
+
onDoubleClick: M,
|
|
109
|
+
onDragStartCapture: N,
|
|
110
|
+
onClick: R,
|
|
111
|
+
id: S
|
|
112
|
+
},
|
|
113
|
+
// Prevent DOM focus from moving on mouse down when using virtual focus
|
|
114
|
+
c ? {
|
|
115
|
+
onMouseDown: (e) => e.preventDefault()
|
|
116
|
+
} : void 0
|
|
117
|
+
),
|
|
118
|
+
isPressed: U,
|
|
119
|
+
isSelected: o.isSelected(t),
|
|
120
|
+
isFocused: o.isFocused && o.focusedKey === t,
|
|
121
|
+
isDisabled: l,
|
|
122
|
+
allowsSelection: n,
|
|
123
|
+
hasAction: y
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function K() {
|
|
127
|
+
let r = window.event;
|
|
128
|
+
return (r == null ? void 0 : r.key) === "Enter";
|
|
129
|
+
}
|
|
130
|
+
function C() {
|
|
131
|
+
let r = window.event;
|
|
132
|
+
return (r == null ? void 0 : r.key) === " " || (r == null ? void 0 : r.code) === "Space";
|
|
8
133
|
}
|
|
9
134
|
export {
|
|
10
|
-
|
|
11
|
-
o as tabsIds
|
|
135
|
+
pe as useSelectableItem
|
|
12
136
|
};
|
package/index284.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}isDisabled(e){var t,i;return this.disabledKeys.has(e)||!!(!((i=this.collection.getItem(e))===null||i===void 0||(t=i.props)===null||t===void 0)&&t.isDisabled)}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getKeyAbove(e){return this.tabDirection?null:this.getPreviousKey(e)}getKeyBelow(e){return this.tabDirection?null:this.getNextKey(e)}getNextKey(e){let t=e;do t=this.collection.getKeyAfter(t),t==null&&(t=this.collection.getFirstKey());while(t!=null&&this.isDisabled(t));return t}getPreviousKey(e){let t=e;do t=this.collection.getKeyBefore(t),t==null&&(t=this.collection.getLastKey());while(t!=null&&this.isDisabled(t));return t}constructor(e,t,i,l=new Set){this.collection=e,this.flipDirection=t==="rtl"&&i==="horizontal",this.disabledKeys=l,this.tabDirection=i==="horizontal"}}exports.TabsKeyboardDelegate=s;
|
package/index284.mjs
CHANGED
|
@@ -1,136 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
e.target === i.current && o.setFocusedKey(t);
|
|
44
|
-
}
|
|
45
|
-
} : l && (d.onMouseDown = (e) => {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
});
|
|
48
|
-
let L = o.isLink(t) && a === "override", B = m && r.UNSTABLE_itemBehavior === "action", x = o.isLink(t) && a !== "selection" && a !== "none", n = !l && o.canSelectItem(t) && !L && !B, g = (m || x) && !l, p = g && (o.selectionBehavior === "replace" ? !n : !n || o.isEmpty), h = g && n && o.selectionBehavior === "replace", y = p || h, P = T(null), $ = y && n, k = T(!1), w = T(!1), b = o.getItemProps(t), v = (e) => {
|
|
49
|
-
if (m) {
|
|
50
|
-
var u;
|
|
51
|
-
m(), (u = i.current) === null || u === void 0 || u.dispatchEvent(new CustomEvent("react-aria-item-action", {
|
|
52
|
-
bubbles: !0
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
x && i.current && F.open(i.current, e, b.href, b.routerOptions);
|
|
56
|
-
}, s = {
|
|
57
|
-
ref: i
|
|
58
|
-
};
|
|
59
|
-
if (O ? (s.onPressStart = (e) => {
|
|
60
|
-
P.current = e.pointerType, k.current = $, e.pointerType === "keyboard" && (!y || C()) && f(e);
|
|
61
|
-
}, E ? (s.onPressUp = p ? void 0 : (e) => {
|
|
62
|
-
e.pointerType === "mouse" && n && f(e);
|
|
63
|
-
}, s.onPress = p ? v : (e) => {
|
|
64
|
-
e.pointerType !== "keyboard" && e.pointerType !== "mouse" && n && f(e);
|
|
65
|
-
}) : s.onPress = (e) => {
|
|
66
|
-
if (p || h && e.pointerType !== "mouse") {
|
|
67
|
-
if (e.pointerType === "keyboard" && !K()) return;
|
|
68
|
-
v(e);
|
|
69
|
-
} else e.pointerType !== "keyboard" && n && f(e);
|
|
70
|
-
}) : (s.onPressStart = (e) => {
|
|
71
|
-
P.current = e.pointerType, k.current = $, w.current = p, n && (e.pointerType === "mouse" && !p || e.pointerType === "keyboard" && (!g || C())) && f(e);
|
|
72
|
-
}, s.onPress = (e) => {
|
|
73
|
-
(e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && y && K() || e.pointerType === "mouse" && w.current) && (y ? v(e) : n && f(e));
|
|
74
|
-
}), d["data-collection"] = j(o.collection), d["data-key"] = t, s.preventFocusOnPress = c, c && (s = A(s, {
|
|
75
|
-
onPressStart(e) {
|
|
76
|
-
e.pointerType !== "touch" && (o.setFocused(!0), o.setFocusedKey(t));
|
|
77
|
-
},
|
|
78
|
-
onPress(e) {
|
|
79
|
-
e.pointerType === "touch" && (o.setFocused(!0), o.setFocusedKey(t));
|
|
80
|
-
}
|
|
81
|
-
})), b)
|
|
82
|
-
for (let e of [
|
|
83
|
-
"onPressStart",
|
|
84
|
-
"onPressEnd",
|
|
85
|
-
"onPressChange",
|
|
86
|
-
"onPress",
|
|
87
|
-
"onPressUp",
|
|
88
|
-
"onClick"
|
|
89
|
-
]) b[e] && (s[e] = G(s[e], b[e]));
|
|
90
|
-
let { pressProps: I, isPressed: U } = W(s), M = h ? (e) => {
|
|
91
|
-
P.current === "mouse" && (e.stopPropagation(), e.preventDefault(), v(e));
|
|
92
|
-
} : void 0, { longPressProps: V } = X({
|
|
93
|
-
isDisabled: !$,
|
|
94
|
-
onLongPress(e) {
|
|
95
|
-
e.pointerType === "touch" && (f(e), o.setSelectionBehavior("toggle"));
|
|
96
|
-
}
|
|
97
|
-
}), N = (e) => {
|
|
98
|
-
P.current === "touch" && k.current && e.preventDefault();
|
|
99
|
-
}, R = a !== "none" && o.isLink(t) ? (e) => {
|
|
100
|
-
J.isOpening || e.preventDefault();
|
|
101
|
-
} : void 0;
|
|
102
|
-
return {
|
|
103
|
-
itemProps: A(
|
|
104
|
-
d,
|
|
105
|
-
n || p || c && !l ? I : {},
|
|
106
|
-
$ ? V : {},
|
|
107
|
-
{
|
|
108
|
-
onDoubleClick: M,
|
|
109
|
-
onDragStartCapture: N,
|
|
110
|
-
onClick: R,
|
|
111
|
-
id: S
|
|
112
|
-
},
|
|
113
|
-
// Prevent DOM focus from moving on mouse down when using virtual focus
|
|
114
|
-
c ? {
|
|
115
|
-
onMouseDown: (e) => e.preventDefault()
|
|
116
|
-
} : void 0
|
|
117
|
-
),
|
|
118
|
-
isPressed: U,
|
|
119
|
-
isSelected: o.isSelected(t),
|
|
120
|
-
isFocused: o.isFocused && o.focusedKey === t,
|
|
121
|
-
isDisabled: l,
|
|
122
|
-
allowsSelection: n,
|
|
123
|
-
hasAction: y
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function K() {
|
|
127
|
-
let r = window.event;
|
|
128
|
-
return (r == null ? void 0 : r.key) === "Enter";
|
|
129
|
-
}
|
|
130
|
-
function C() {
|
|
131
|
-
let r = window.event;
|
|
132
|
-
return (r == null ? void 0 : r.key) === " " || (r == null ? void 0 : r.code) === "Space";
|
|
1
|
+
class r {
|
|
2
|
+
getKeyLeftOf(e) {
|
|
3
|
+
return this.flipDirection ? this.getNextKey(e) : this.getPreviousKey(e);
|
|
4
|
+
}
|
|
5
|
+
getKeyRightOf(e) {
|
|
6
|
+
return this.flipDirection ? this.getPreviousKey(e) : this.getNextKey(e);
|
|
7
|
+
}
|
|
8
|
+
isDisabled(e) {
|
|
9
|
+
var t, i;
|
|
10
|
+
return this.disabledKeys.has(e) || !!(!((i = this.collection.getItem(e)) === null || i === void 0 || (t = i.props) === null || t === void 0) && t.isDisabled);
|
|
11
|
+
}
|
|
12
|
+
getFirstKey() {
|
|
13
|
+
let e = this.collection.getFirstKey();
|
|
14
|
+
return e != null && this.isDisabled(e) && (e = this.getNextKey(e)), e;
|
|
15
|
+
}
|
|
16
|
+
getLastKey() {
|
|
17
|
+
let e = this.collection.getLastKey();
|
|
18
|
+
return e != null && this.isDisabled(e) && (e = this.getPreviousKey(e)), e;
|
|
19
|
+
}
|
|
20
|
+
getKeyAbove(e) {
|
|
21
|
+
return this.tabDirection ? null : this.getPreviousKey(e);
|
|
22
|
+
}
|
|
23
|
+
getKeyBelow(e) {
|
|
24
|
+
return this.tabDirection ? null : this.getNextKey(e);
|
|
25
|
+
}
|
|
26
|
+
getNextKey(e) {
|
|
27
|
+
let t = e;
|
|
28
|
+
do
|
|
29
|
+
t = this.collection.getKeyAfter(t), t == null && (t = this.collection.getFirstKey());
|
|
30
|
+
while (t != null && this.isDisabled(t));
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
getPreviousKey(e) {
|
|
34
|
+
let t = e;
|
|
35
|
+
do
|
|
36
|
+
t = this.collection.getKeyBefore(t), t == null && (t = this.collection.getLastKey());
|
|
37
|
+
while (t != null && this.isDisabled(t));
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
constructor(e, t, i, s = /* @__PURE__ */ new Set()) {
|
|
41
|
+
this.collection = e, this.flipDirection = t === "rtl" && i === "horizontal", this.disabledKeys = s, this.tabDirection = i === "horizontal";
|
|
42
|
+
}
|
|
133
43
|
}
|
|
134
44
|
export {
|
|
135
|
-
|
|
45
|
+
r as TabsKeyboardDelegate
|
|
136
46
|
};
|
package/index285.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index341.js"),ce=require("./index342.js"),se=require("./index244.js"),H=require("./index158.js"),j=require("./index248.js"),fe=require("./index249.js"),G=require("./index254.js"),P=require("./index262.js"),L=require("./index263.js"),J=require("./index266.js"),S=require("./index267.js"),ae=require("./index268.js"),N=require("@react-aria/focus"),de=require("react-dom"),d=require("react"),Q=require("./index329.js"),X=require("./index340.js"),ve=require("@react-aria/i18n");function ye(Y){let{selectionManager:e,keyboardDelegate:t,ref:u,autoFocus:D=!1,shouldFocusWrap:T=!1,disallowEmptySelection:Z=!1,disallowSelectAll:g=!1,escapeKeyBehavior:_="clearSelection",selectOnFocus:b=e.selectionBehavior==="replace",disallowTypeAhead:ee=!1,shouldUseVirtualFocus:K,allowsTabNavigation:le=!1,isVirtualized:U,scrollRef:f=u,linkBehavior:B="action"}=Y,{direction:h}=ve.useLocale(),te=fe.useRouter(),oe=l=>{var r;if(l.altKey&&l.key==="Tab"&&l.preventDefault(),!(!((r=u.current)===null||r===void 0)&&r.contains(l.target)))return;const n=(o,y)=>{if(o!=null){if(e.isLink(o)&&B==="selection"&&b&&!m.isNonContiguousSelectionModifier(l)){de.flushSync(()=>{e.setFocusedKey(o,y)});let p=m.getItemElement(u,o),$=e.getItemProps(o);p&&te.open(p,l,$.href,$.routerOptions);return}if(e.setFocusedKey(o,y),e.isLink(o)&&B==="override")return;l.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(o):b&&!m.isNonContiguousSelectionModifier(l)&&e.replaceSelection(o)}};switch(l.key){case"ArrowDown":if(t.getKeyBelow){var i,s,c;let o=e.focusedKey!=null?(i=t.getKeyBelow)===null||i===void 0?void 0:i.call(t,e.focusedKey):(s=t.getFirstKey)===null||s===void 0?void 0:s.call(t);o==null&&T&&(o=(c=t.getFirstKey)===null||c===void 0?void 0:c.call(t,e.focusedKey)),o!=null&&(l.preventDefault(),n(o))}break;case"ArrowUp":if(t.getKeyAbove){var a,v,I;let o=e.focusedKey!=null?(a=t.getKeyAbove)===null||a===void 0?void 0:a.call(t,e.focusedKey):(v=t.getLastKey)===null||v===void 0?void 0:v.call(t);o==null&&T&&(o=(I=t.getLastKey)===null||I===void 0?void 0:I.call(t,e.focusedKey)),o!=null&&(l.preventDefault(),n(o))}break;case"ArrowLeft":if(t.getKeyLeftOf){var k,M,C;let o=e.focusedKey!=null?(k=t.getKeyLeftOf)===null||k===void 0?void 0:k.call(t,e.focusedKey):null;o==null&&T&&(o=h==="rtl"?(M=t.getFirstKey)===null||M===void 0?void 0:M.call(t,e.focusedKey):(C=t.getLastKey)===null||C===void 0?void 0:C.call(t,e.focusedKey)),o!=null&&(l.preventDefault(),n(o,h==="rtl"?"first":"last"))}break;case"ArrowRight":if(t.getKeyRightOf){var V,x,O;let o=e.focusedKey!=null?(V=t.getKeyRightOf)===null||V===void 0?void 0:V.call(t,e.focusedKey):null;o==null&&T&&(o=h==="rtl"?(x=t.getLastKey)===null||x===void 0?void 0:x.call(t,e.focusedKey):(O=t.getFirstKey)===null||O===void 0?void 0:O.call(t,e.focusedKey)),o!=null&&(l.preventDefault(),n(o,h==="rtl"?"last":"first"))}break;case"Home":if(t.getFirstKey){if(e.focusedKey===null&&l.shiftKey)return;l.preventDefault();let o=t.getFirstKey(e.focusedKey,S.isCtrlKeyPressed(l));e.setFocusedKey(o),o!=null&&(S.isCtrlKeyPressed(l)&&l.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(o):b&&e.replaceSelection(o))}break;case"End":if(t.getLastKey){if(e.focusedKey===null&&l.shiftKey)return;l.preventDefault();let o=t.getLastKey(e.focusedKey,S.isCtrlKeyPressed(l));e.setFocusedKey(o),o!=null&&(S.isCtrlKeyPressed(l)&&l.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(o):b&&e.replaceSelection(o))}break;case"PageDown":if(t.getKeyPageBelow&&e.focusedKey!=null){let o=t.getKeyPageBelow(e.focusedKey);o!=null&&(l.preventDefault(),n(o))}break;case"PageUp":if(t.getKeyPageAbove&&e.focusedKey!=null){let o=t.getKeyPageAbove(e.focusedKey);o!=null&&(l.preventDefault(),n(o))}break;case"a":S.isCtrlKeyPressed(l)&&e.selectionMode==="multiple"&&g!==!0&&(l.preventDefault(),e.selectAll());break;case"Escape":_==="clearSelection"&&!Z&&e.selectedKeys.size!==0&&(l.stopPropagation(),l.preventDefault(),e.clearSelection());break;case"Tab":if(!le){if(l.shiftKey)u.current.focus();else{let o=N.getFocusableTreeWalker(u.current,{tabbable:!0}),y,p;do p=o.lastChild(),p&&(y=p);while(p);y&&(!y.contains(document.activeElement)||document.activeElement&&!ae.isTabbable(document.activeElement))&&j.focusWithoutScrolling(y)}break}}},q=d.useRef({top:0,left:0});P.useEvent(f,"scroll",U?void 0:()=>{var l,r,n,i;q.current={top:(n=(l=f.current)===null||l===void 0?void 0:l.scrollTop)!==null&&n!==void 0?n:0,left:(i=(r=f.current)===null||r===void 0?void 0:r.scrollLeft)!==null&&i!==void 0?i:0}});let re=l=>{if(e.isFocused){l.currentTarget.contains(l.target)||e.setFocused(!1);return}if(l.currentTarget.contains(l.target)){if(e.setFocused(!0),e.focusedKey==null){var r,n;let c=v=>{v!=null&&(e.setFocusedKey(v),b&&!e.isSelected(v)&&e.replaceSelection(v))},a=l.relatedTarget;var i,s;a&&l.currentTarget.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING?c((i=e.lastSelectedKey)!==null&&i!==void 0?i:(r=t.getLastKey)===null||r===void 0?void 0:r.call(t)):c((s=e.firstSelectedKey)!==null&&s!==void 0?s:(n=t.getFirstKey)===null||n===void 0?void 0:n.call(t))}else!U&&f.current&&(f.current.scrollTop=q.current.top,f.current.scrollLeft=q.current.left);if(e.focusedKey!=null&&f.current){let c=m.getItemElement(u,e.focusedKey);c instanceof HTMLElement&&(!c.contains(document.activeElement)&&!K&&j.focusWithoutScrolling(c),Q.getInteractionModality()==="keyboard"&&L.scrollIntoViewport(c,{containingElement:u.current}))}}},ne=l=>{l.currentTarget.contains(l.relatedTarget)||e.setFocused(!1)},F=d.useRef(!1);P.useEvent(u,J.FOCUS_EVENT,K?l=>{let{detail:r}=l;l.stopPropagation(),e.setFocused(!0),(r==null?void 0:r.focusStrategy)==="first"&&(F.current=!0)}:void 0),G.useUpdateLayoutEffect(()=>{if(F.current){var l,r;let n=(r=(l=t.getFirstKey)===null||l===void 0?void 0:l.call(t))!==null&&r!==void 0?r:null;if(n==null){let i=se.getActiveElement();N.moveVirtualFocus(u.current),N.dispatchVirtualFocus(i,null),e.collection.size>0&&(F.current=!1)}else e.setFocusedKey(n),F.current=!1}},[e.collection]),G.useUpdateLayoutEffect(()=>{e.collection.size>0&&(F.current=!1)},[e.focusedKey]),P.useEvent(u,J.CLEAR_FOCUS_EVENT,K?l=>{var r;l.stopPropagation(),e.setFocused(!1),!((r=l.detail)===null||r===void 0)&&r.clearFocusKey&&e.setFocusedKey(null)}:void 0);const z=d.useRef(D),w=d.useRef(!1);d.useEffect(()=>{if(z.current){var l,r;let s=null;var n;D==="first"&&(s=(n=(l=t.getFirstKey)===null||l===void 0?void 0:l.call(t))!==null&&n!==void 0?n:null);var i;D==="last"&&(s=(i=(r=t.getLastKey)===null||r===void 0?void 0:r.call(t))!==null&&i!==void 0?i:null);let c=e.selectedKeys;if(c.size){for(let a of c)if(e.canSelectItem(a)){s=a;break}}e.setFocused(!0),e.setFocusedKey(s),s==null&&!K&&u.current&&X.focusSafely(u.current),e.collection.size>0&&(z.current=!1,w.current=!0)}});let A=d.useRef(e.focusedKey),E=d.useRef(null);d.useEffect(()=>{if(e.isFocused&&e.focusedKey!=null&&(e.focusedKey!==A.current||w.current)&&f.current&&u.current){let l=Q.getInteractionModality(),r=m.getItemElement(u,e.focusedKey);if(!(r instanceof HTMLElement))return;(l==="keyboard"||w.current)&&(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{f.current&&(L.scrollIntoView(f.current,r),l!=="virtual"&&L.scrollIntoViewport(r,{containingElement:u.current}))}))}!K&&e.isFocused&&e.focusedKey==null&&A.current!=null&&u.current&&X.focusSafely(u.current),A.current=e.focusedKey,w.current=!1}),d.useEffect(()=>()=>{E.current&&cancelAnimationFrame(E.current)},[]),P.useEvent(u,"react-aria-focus-scope-restore",l=>{l.preventDefault(),e.setFocused(!0)});let R={onKeyDown:oe,onFocus:re,onBlur:ne,onMouseDown(l){f.current===l.target&&l.preventDefault()}},{typeSelectProps:ue}=ce.useTypeSelect({keyboardDelegate:t,selectionManager:e});ee||(R=H.mergeProps(ue,R));let W;K||(W=e.focusedKey==null?0:-1);let ie=m.useCollectionId(e.collection);return{collectionProps:H.mergeProps(R,{tabIndex:W,"data-collection":ie})}}exports.useSelectableCollection=ye;
|