@box/combobox-with-api 2.1.36 → 2.1.38
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/chunks/combobox-with-api-error.js +1 -18
- package/dist/chunks/combobox-with-api-pagination.js +1 -167
- package/dist/chunks/combobox-with-api-pagination2.js +1 -229
- package/dist/chunks/combobox-with-api-tree-view.js +1 -423
- package/dist/chunks/dynamic-loading-tree.js +1 -293
- package/dist/chunks/treeReducer.js +1 -60
- package/dist/esm/index.js +1 -6
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-container.js +1 -48
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-error.js +1 -2
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api.js +1 -17
- package/dist/esm/lib/components/combobox-with-api/messages.js +1 -6
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +1 -3
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +1 -32
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +1 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +1 -118
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +1 -11
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +1 -35
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +1 -75
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +1 -134
- package/dist/esm/lib/components/combobox-with-api-tree-view/dynamic-loading-tree.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-tree-view/index.js +1 -3
- package/dist/esm/lib/components/combobox-with-api-tree-view/tree-utils.js +1 -18
- package/dist/esm/lib/components/combobox-with-api-tree-view/treeReducer.js +1 -2
- package/package.json +7 -7
package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
function t(t) {
|
|
3
|
-
let n = e.useRef(t);
|
|
4
|
-
return e.useEffect(() => {
|
|
5
|
-
n.current = t;
|
|
6
|
-
}), e.useMemo(() => ((...e) => n.current?.(...e)), []);
|
|
7
|
-
}
|
|
8
|
-
function n({ prop: n, defaultProp: i, onChange: a = () => {} }) {
|
|
9
|
-
let [o, s] = r({
|
|
10
|
-
defaultProp: i,
|
|
11
|
-
onChange: a
|
|
12
|
-
}), c = n !== void 0, l = c ? n : o, u = t(a);
|
|
13
|
-
return [l, e.useCallback((e) => {
|
|
14
|
-
if (c) {
|
|
15
|
-
let t = typeof e == "function" ? e(n) : e;
|
|
16
|
-
t !== n && u(t);
|
|
17
|
-
} else s(e);
|
|
18
|
-
}, [
|
|
19
|
-
c,
|
|
20
|
-
n,
|
|
21
|
-
s,
|
|
22
|
-
u
|
|
23
|
-
])];
|
|
24
|
-
}
|
|
25
|
-
function r({ defaultProp: n, onChange: r }) {
|
|
26
|
-
let i = e.useState(n), [a] = i, o = e.useRef(a), s = t(r);
|
|
27
|
-
return e.useEffect(() => {
|
|
28
|
-
o.current !== a && (s(a), o.current = a);
|
|
29
|
-
}, [
|
|
30
|
-
a,
|
|
31
|
-
o,
|
|
32
|
-
s
|
|
33
|
-
]), i;
|
|
34
|
-
}
|
|
35
|
-
export { n as useControllableState };
|
|
1
|
+
import*as React from"react";function useCallbackRef(callback){let callbackRef=React.useRef(callback);return React.useEffect(()=>{callbackRef.current=callback}),React.useMemo(()=>((...args)=>callbackRef.current?.(...args)),[])}function useControllableState({prop,defaultProp,onChange=()=>{}}){let[uncontrolledProp,setUncontrolledProp]=useUncontrolledState({defaultProp,onChange}),isControlled=prop!==void 0,value=isControlled?prop:uncontrolledProp,handleChange=useCallbackRef(onChange);return[value,React.useCallback(nextValue=>{if(isControlled){let internalValue=typeof nextValue==`function`?nextValue(prop):nextValue;internalValue!==prop&&handleChange(internalValue)}else setUncontrolledProp(nextValue)},[isControlled,prop,setUncontrolledProp,handleChange])]}function useUncontrolledState({defaultProp,onChange}){let uncontrolledState=React.useState(defaultProp),[value]=uncontrolledState,prevValueRef=React.useRef(value),handleChange=useCallbackRef(onChange);return React.useEffect(()=>{prevValueRef.current!==value&&(handleChange(value),prevValueRef.current=value)},[value,prevValueRef,handleChange]),uncontrolledState}export{useControllableState};
|
package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var r = "0px", i = [0];
|
|
3
|
-
function a() {
|
|
4
|
-
let e = /* @__PURE__ */ new Map();
|
|
5
|
-
function t({ root: t, rootMargin: n, threshold: r }) {
|
|
6
|
-
let i = e.get(t);
|
|
7
|
-
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
8
|
-
let a = JSON.stringify({
|
|
9
|
-
rootMargin: n,
|
|
10
|
-
threshold: r
|
|
11
|
-
}), o = i.get(a);
|
|
12
|
-
if (!o) {
|
|
13
|
-
let e = /* @__PURE__ */ new Map();
|
|
14
|
-
o = {
|
|
15
|
-
observer: new IntersectionObserver((t) => {
|
|
16
|
-
t.forEach((t) => {
|
|
17
|
-
e.get(t.target)?.(t);
|
|
18
|
-
});
|
|
19
|
-
}, {
|
|
20
|
-
root: t,
|
|
21
|
-
rootMargin: n,
|
|
22
|
-
threshold: r
|
|
23
|
-
}),
|
|
24
|
-
entryCallbacks: e
|
|
25
|
-
}, i.set(a, o);
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
observe: (e, t) => {
|
|
29
|
-
o?.entryCallbacks.set(e, t), o?.observer.observe(e);
|
|
30
|
-
},
|
|
31
|
-
unobserve: (e) => {
|
|
32
|
-
o?.entryCallbacks.delete(e), o?.observer.unobserve(e);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return { getObserver: t };
|
|
37
|
-
}
|
|
38
|
-
var o = a();
|
|
39
|
-
function s(a) {
|
|
40
|
-
let s = a?.rootMargin ?? r, c = a?.threshold ?? i, l = t(null), u = t(null), d = t(null), [f, p] = n(), m = e(() => {
|
|
41
|
-
let e = l.current;
|
|
42
|
-
if (!e) {
|
|
43
|
-
p(void 0);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
let t = o.getObserver({
|
|
47
|
-
root: u.current,
|
|
48
|
-
rootMargin: s,
|
|
49
|
-
threshold: c
|
|
50
|
-
});
|
|
51
|
-
t.observe(e, (e) => {
|
|
52
|
-
p(e);
|
|
53
|
-
}), d.current = t;
|
|
54
|
-
}, [s, c]), h = e(() => {
|
|
55
|
-
let e = d.current, t = l.current;
|
|
56
|
-
t && e?.unobserve(t), d.current = null;
|
|
57
|
-
}, []);
|
|
58
|
-
return [e((e) => {
|
|
59
|
-
h(), l.current = e, m();
|
|
60
|
-
}, [m, h]), {
|
|
61
|
-
entry: f,
|
|
62
|
-
rootRef: e((e) => {
|
|
63
|
-
h(), u.current = e, m();
|
|
64
|
-
}, [m, h])
|
|
65
|
-
}];
|
|
66
|
-
}
|
|
67
|
-
function c(e) {
|
|
68
|
-
let [t, r] = s(e), i = !!r.entry?.isIntersecting, [a, o] = n(i);
|
|
69
|
-
return i && !a && o(!0), [t, {
|
|
70
|
-
...r,
|
|
71
|
-
isVisible: i,
|
|
72
|
-
wasEverVisible: a
|
|
73
|
-
}];
|
|
74
|
-
}
|
|
75
|
-
export { a as createObserverCache, c as useTrackVisibility };
|
|
1
|
+
import{useCallback,useRef,useState}from"react";var DEFAULT_ROOT_MARGIN=`0px`,DEFAULT_THRESHOLD=[0];function createObserverCache(){let cachesByRoot=new Map;function getObserver({root,rootMargin,threshold}){let cacheByRoot=cachesByRoot.get(root);cacheByRoot||(cacheByRoot=new Map,cachesByRoot.set(root,cacheByRoot));let cacheKey=JSON.stringify({rootMargin,threshold}),cachedObserver=cacheByRoot.get(cacheKey);if(!cachedObserver){let entryCallbacks=new Map;cachedObserver={observer:new IntersectionObserver(entries=>{entries.forEach(entry=>{entryCallbacks.get(entry.target)?.(entry)})},{root,rootMargin,threshold}),entryCallbacks},cacheByRoot.set(cacheKey,cachedObserver)}return{observe:(node,callback)=>{cachedObserver?.entryCallbacks.set(node,callback),cachedObserver?.observer.observe(node)},unobserve:node=>{cachedObserver?.entryCallbacks.delete(node),cachedObserver?.observer.unobserve(node)}}}return{getObserver}}var observerCache=createObserverCache();function useIntersectionObserver(args){let rootMargin=args?.rootMargin??DEFAULT_ROOT_MARGIN,threshold=args?.threshold??DEFAULT_THRESHOLD,nodeRef=useRef(null),rootRef=useRef(null),observerRef=useRef(null),[entry,setEntry]=useState(),observe=useCallback(()=>{let node=nodeRef.current;if(!node){setEntry(void 0);return}let observer=observerCache.getObserver({root:rootRef.current,rootMargin,threshold});observer.observe(node,observedEntry=>{setEntry(observedEntry)}),observerRef.current=observer},[rootMargin,threshold]),unobserve=useCallback(()=>{let currentObserver=observerRef.current,node=nodeRef.current;node&¤tObserver?.unobserve(node),observerRef.current=null},[]);return[useCallback(node=>{unobserve(),nodeRef.current=node,observe()},[observe,unobserve]),{entry,rootRef:useCallback(rootNode=>{unobserve(),rootRef.current=rootNode,observe()},[observe,unobserve])}]}function useTrackVisibility(args){let[ref,result]=useIntersectionObserver(args),isVisible=!!result.entry?.isIntersecting,[wasEverVisible,setWasEverVisible]=useState(isVisible);return isVisible&&!wasEverVisible&&setWasEverVisible(!0),[ref,{...result,isVisible,wasEverVisible}]}export{createObserverCache,useTrackVisibility};
|
|
@@ -1,134 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useControllableState as t } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
|
|
3
|
-
import { n, t as r } from "../../../../chunks/dynamic-loading-tree.js";
|
|
4
|
-
import { Combobox as i, ComboboxCancel as a, ComboboxItem as ee, ComboboxPopover as o, ComboboxProvider as s, PopoverAnchor as c, useComboboxStore as l } from "@ariakit/react";
|
|
5
|
-
import { ChipsGroup as te, IconButton as ne, InputChip as re, useLabelable as ie } from "@box/blueprint-web";
|
|
6
|
-
import { Search as u, XMark as d } from "@box/blueprint-web-assets/icons/Fill";
|
|
7
|
-
import { IconIconOnLightSecondary as f, Size1 as p, Size6 as m } from "@box/blueprint-web-assets/tokens/tokens";
|
|
8
|
-
import h from "clsx";
|
|
9
|
-
import { forwardRef as g, useCallback as _, useId as v, useRef as y, useState as b } from "react";
|
|
10
|
-
import { useIntl as ae } from "react-intl";
|
|
11
|
-
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
12
|
-
var oe = () => /* @__PURE__ */ x(u, {
|
|
13
|
-
color: f,
|
|
14
|
-
height: m,
|
|
15
|
-
role: "presentation",
|
|
16
|
-
style: {
|
|
17
|
-
padding: p,
|
|
18
|
-
boxSizing: "border-box"
|
|
19
|
-
},
|
|
20
|
-
width: m
|
|
21
|
-
}), C = /*#__PURE__*/ g(function(u, f) {
|
|
22
|
-
let { className: p, closeOnSelection: m = !1, dataTargetId: g, defaultFetcher: C, defaultValue: se = [], disabled: w, hideLabel: T, initialOpen: E = !1, label: D, levels: O, loadingAriaLabel: k, multiselect: A = !1, noResultMessage: j, onValueChange: M, onOpenChange: N, placeholder: P, portalElement: F, selectableLevels: I, treeAriaLabel: L, value: R } = u, { formatMessage: z } = ae(), B = v(), [V, H] = b(E), [U, W] = t({
|
|
23
|
-
prop: R,
|
|
24
|
-
defaultProp: se,
|
|
25
|
-
onChange: M
|
|
26
|
-
}), [G, K] = b(""), q = y(null), [ce, J] = b(!1), le = _(() => J(!0), []), ue = _(() => J(!1), []), Y = y("");
|
|
27
|
-
ce || (Y.current = G.trimStart());
|
|
28
|
-
let X = l({
|
|
29
|
-
includesBaseElement: !0,
|
|
30
|
-
virtualFocus: !1,
|
|
31
|
-
value: G,
|
|
32
|
-
setValue: (e) => {
|
|
33
|
-
K(e);
|
|
34
|
-
},
|
|
35
|
-
open: V,
|
|
36
|
-
setOpen: (e) => {
|
|
37
|
-
H(e), N?.(e);
|
|
38
|
-
}
|
|
39
|
-
}), Z = U.length > 0, Q = U.length > 0, de = ie(D, B), $ = y(null);
|
|
40
|
-
return /* @__PURE__ */ S(s, {
|
|
41
|
-
store: X,
|
|
42
|
-
children: [/* @__PURE__ */ x(c, { children: /* @__PURE__ */ S("div", {
|
|
43
|
-
className: h(n.container, p, { [n.disabled]: w }),
|
|
44
|
-
children: [/* @__PURE__ */ x(de, {
|
|
45
|
-
className: h(n.label, { [n.hiddenLabel]: T }),
|
|
46
|
-
hideLabel: T
|
|
47
|
-
}), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S("div", {
|
|
48
|
-
className: h(n.comboboxContainer, {
|
|
49
|
-
[n.withChips]: Q,
|
|
50
|
-
[n.withComboboxButtons]: Z
|
|
51
|
-
}),
|
|
52
|
-
children: [Q && /* @__PURE__ */ x(te, { children: U.map((e) => /* @__PURE__ */ x(re, {
|
|
53
|
-
label: e.displayValue,
|
|
54
|
-
onDelete: () => {
|
|
55
|
-
w || W(U.filter((t) => t.value !== e.value));
|
|
56
|
-
},
|
|
57
|
-
tooltip: e.displayValue
|
|
58
|
-
}, e.value)) }), /* @__PURE__ */ S("div", {
|
|
59
|
-
className: n.textInputWrapper,
|
|
60
|
-
children: [/* @__PURE__ */ x(i, {
|
|
61
|
-
ref: q,
|
|
62
|
-
"aria-haspopup": "tree",
|
|
63
|
-
className: n.textInput,
|
|
64
|
-
"data-target-id": g,
|
|
65
|
-
disabled: w,
|
|
66
|
-
id: B,
|
|
67
|
-
onCompositionEnd: ue,
|
|
68
|
-
onCompositionStart: le,
|
|
69
|
-
placeholder: P,
|
|
70
|
-
store: X
|
|
71
|
-
}), /* @__PURE__ */ x("div", {
|
|
72
|
-
className: n.comboboxButtons,
|
|
73
|
-
children: Z ? /* @__PURE__ */ x(a, {
|
|
74
|
-
disabled: w,
|
|
75
|
-
onClick: () => {
|
|
76
|
-
W([]);
|
|
77
|
-
},
|
|
78
|
-
render: (e) => /* @__PURE__ */ x(ne, {
|
|
79
|
-
...e,
|
|
80
|
-
"aria-label": "Clear selection",
|
|
81
|
-
icon: d,
|
|
82
|
-
size: "x-small"
|
|
83
|
-
}),
|
|
84
|
-
store: X
|
|
85
|
-
}) : /* @__PURE__ */ x(oe, {})
|
|
86
|
-
})]
|
|
87
|
-
})]
|
|
88
|
-
}) })]
|
|
89
|
-
}) }), /* @__PURE__ */ x(o, {
|
|
90
|
-
"aria-labelledby": B,
|
|
91
|
-
className: n.popover,
|
|
92
|
-
fitViewport: !0,
|
|
93
|
-
gutter: 8,
|
|
94
|
-
portal: !0,
|
|
95
|
-
portalElement: F,
|
|
96
|
-
sameWidth: !0,
|
|
97
|
-
children: /* @__PURE__ */ x(ee, {
|
|
98
|
-
onFocusVisible: (e) => {
|
|
99
|
-
($.current?.firstChild)?.focus();
|
|
100
|
-
},
|
|
101
|
-
onKeyDown: (e) => {
|
|
102
|
-
if (e.key === "ArrowUp") {
|
|
103
|
-
let e = $.current?.firstChild;
|
|
104
|
-
document.activeElement === e && (e.blur(), q.current?.focus());
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
children: /* @__PURE__ */ x(r, {
|
|
108
|
-
ref: $,
|
|
109
|
-
ariaLabel: L,
|
|
110
|
-
defaultFetcher: C,
|
|
111
|
-
levels: O,
|
|
112
|
-
loadingAriaLabel: k || z(e.loadingAriaLabel),
|
|
113
|
-
multiselect: A,
|
|
114
|
-
noResultMessage: j || z(e.noResults),
|
|
115
|
-
onSelect: (e) => {
|
|
116
|
-
let { metadata: t } = e.element, n = [];
|
|
117
|
-
e.isSelected ? (A && (n = U.filter((t) => t.value !== e.element.id)), n.push({
|
|
118
|
-
value: e.element.id,
|
|
119
|
-
displayValue: t.displayValue,
|
|
120
|
-
level: t.level,
|
|
121
|
-
selectable: t.selectable,
|
|
122
|
-
ancestors: t.ancestors
|
|
123
|
-
}), m && n.length > U.length && H(!1)) : n = U.filter((t) => t.value !== e.element.id), W(n), K("");
|
|
124
|
-
},
|
|
125
|
-
open: V,
|
|
126
|
-
searchInput: Y.current,
|
|
127
|
-
selectableLevels: I,
|
|
128
|
-
selectedNodes: U.map((e) => e.value)
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
})]
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
export { C as ComboboxWithApiTreeView };
|
|
1
|
+
import messages from"../combobox-with-api-pagination/messages.js";import{useControllableState}from"../combobox-with-api-pagination/utils/use-controllable-state.js";import{n as combobox_with_api_tree_module_default,t as DynamicLoadingTree}from"../../../../chunks/dynamic-loading-tree.js";import{Combobox,ComboboxCancel,ComboboxItem,ComboboxPopover,ComboboxProvider,PopoverAnchor,useComboboxStore}from"@ariakit/react";import{ChipsGroup,IconButton,InputChip,useLabelable}from"@box/blueprint-web";import{Search,XMark}from"@box/blueprint-web-assets/icons/Fill";import{IconIconOnLightSecondary,Size1,Size6}from"@box/blueprint-web-assets/tokens/tokens";import clsx from"clsx";import{forwardRef,useCallback,useId,useRef,useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";var SearchIcon=()=>jsx(Search,{color:IconIconOnLightSecondary,height:Size6,role:`presentation`,style:{padding:Size1,boxSizing:`border-box`},width:Size6}),ComboboxWithApiTreeView=forwardRef(function(props,forwardedRef){let{className,closeOnSelection=!1,dataTargetId,defaultFetcher,defaultValue=[],disabled,hideLabel,initialOpen=!1,label,levels,loadingAriaLabel,multiselect=!1,noResultMessage,onValueChange,onOpenChange,placeholder,portalElement,selectableLevels,treeAriaLabel,value}=props,{formatMessage}=useIntl(),comboboxId=useId(),[isOpen,setIsOpen]=useState(initialOpen),[selectedNodes,setSelectedNodes]=useControllableState({prop:value,defaultProp:defaultValue,onChange:onValueChange}),[inputValue,setInputValue]=useState(``),comboboxRef=useRef(null),[isComposing,setIsComposing]=useState(!1),handleCompositionStart=useCallback(()=>setIsComposing(!0),[]),handleCompositionEnd=useCallback(()=>setIsComposing(!1),[]),lastCommittedSearchRef=useRef(``);isComposing||(lastCommittedSearchRef.current=inputValue.trimStart());let comboboxStore=useComboboxStore({includesBaseElement:!0,virtualFocus:!1,value:inputValue,setValue:newValue=>{setInputValue(newValue)},open:isOpen,setOpen:newIsOpen=>{setIsOpen(newIsOpen),onOpenChange?.(newIsOpen)}}),showComboboxCancelButton=selectedNodes.length>0,showChipsGroup=selectedNodes.length>0,Label=useLabelable(label,comboboxId),treeRef=useRef(null);return jsxs(ComboboxProvider,{store:comboboxStore,children:[jsx(PopoverAnchor,{children:jsxs(`div`,{className:clsx(combobox_with_api_tree_module_default.container,className,{[combobox_with_api_tree_module_default.disabled]:disabled}),children:[jsx(Label,{className:clsx(combobox_with_api_tree_module_default.label,{[combobox_with_api_tree_module_default.hiddenLabel]:hideLabel}),hideLabel}),jsx(`div`,{children:jsxs(`div`,{className:clsx(combobox_with_api_tree_module_default.comboboxContainer,{[combobox_with_api_tree_module_default.withChips]:showChipsGroup,[combobox_with_api_tree_module_default.withComboboxButtons]:showComboboxCancelButton}),children:[showChipsGroup&&jsx(ChipsGroup,{children:selectedNodes.map(selected=>jsx(InputChip,{label:selected.displayValue,onDelete:()=>{disabled||setSelectedNodes(selectedNodes.filter(n=>n.value!==selected.value))},tooltip:selected.displayValue},selected.value))}),jsxs(`div`,{className:combobox_with_api_tree_module_default.textInputWrapper,children:[jsx(Combobox,{ref:comboboxRef,"aria-haspopup":`tree`,className:combobox_with_api_tree_module_default.textInput,"data-target-id":dataTargetId,disabled,id:comboboxId,onCompositionEnd:handleCompositionEnd,onCompositionStart:handleCompositionStart,placeholder,store:comboboxStore}),jsx(`div`,{className:combobox_with_api_tree_module_default.comboboxButtons,children:showComboboxCancelButton?jsx(ComboboxCancel,{disabled,onClick:()=>{setSelectedNodes([])},render:cancelProps=>jsx(IconButton,{...cancelProps,"aria-label":`Clear selection`,icon:XMark,size:`x-small`}),store:comboboxStore}):jsx(SearchIcon,{})})]})]})})]})}),jsx(ComboboxPopover,{"aria-labelledby":comboboxId,className:combobox_with_api_tree_module_default.popover,fitViewport:!0,gutter:8,portal:!0,portalElement,sameWidth:!0,children:jsx(ComboboxItem,{onFocusVisible:e=>{(treeRef.current?.firstChild)?.focus()},onKeyDown:e=>{if(e.key===`ArrowUp`){let firstTreeItem=treeRef.current?.firstChild;document.activeElement===firstTreeItem&&(firstTreeItem.blur(),comboboxRef.current?.focus())}},children:jsx(DynamicLoadingTree,{ref:treeRef,ariaLabel:treeAriaLabel,defaultFetcher,levels,loadingAriaLabel:loadingAriaLabel||formatMessage(messages.loadingAriaLabel),multiselect,noResultMessage:noResultMessage||formatMessage(messages.noResults),onSelect:node=>{let{metadata}=node.element,newValue=[];node.isSelected?(multiselect&&(newValue=selectedNodes.filter(n=>n.value!==node.element.id)),newValue.push({value:node.element.id,displayValue:metadata.displayValue,level:metadata.level,selectable:metadata.selectable,ancestors:metadata.ancestors}),closeOnSelection&&newValue.length>selectedNodes.length&&setIsOpen(!1)):newValue=selectedNodes.filter(n=>n.value!==node.element.id),setSelectedNodes(newValue),setInputValue(``)},open:isOpen,searchInput:lastCommittedSearchRef.current,selectableLevels,selectedNodes:selectedNodes.map(n=>n.value)})})})]})});export{ComboboxWithApiTreeView};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as DynamicLoadingTree };
|
|
1
|
+
import{t as DynamicLoadingTree}from"../../../../chunks/dynamic-loading-tree.js";export{DynamicLoadingTree};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { n as t, r as n, t as r } from "../../../../chunks/combobox-with-api-tree-view.js";
|
|
3
|
-
export { e as ComboboxWithApiTreeView, n as apiResponse, r as findNode, t as mockTreeFetcher };
|
|
1
|
+
import{ComboboxWithApiTreeView}from"./combobox-with-api-tree-view.js";import{n as mockTreeFetcher,r as apiResponse,t as findNode}from"../../../../chunks/combobox-with-api-tree-view.js";export{ComboboxWithApiTreeView,apiResponse,findNode,mockTreeFetcher};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
name: t,
|
|
3
|
-
id: `${e}_${n}`,
|
|
4
|
-
parent: e,
|
|
5
|
-
children: [],
|
|
6
|
-
metadata: { variant: n }
|
|
7
|
-
}), t = (e) => e && typeof e.level == "number", n = {
|
|
8
|
-
name: "Root",
|
|
9
|
-
id: "root",
|
|
10
|
-
parent: null,
|
|
11
|
-
children: [],
|
|
12
|
-
metadata: {
|
|
13
|
-
variant: "content",
|
|
14
|
-
level: 0,
|
|
15
|
-
displayValue: "Root"
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export { n as RootTreeNode, e as getServiceNode, t as hasValidLevel };
|
|
1
|
+
var getServiceNode=(parentId,parentName,variant)=>({name:parentName,id:`${parentId}_${variant}`,parent:parentId,children:[],metadata:{variant}}),hasValidLevel=metadata=>metadata&&typeof metadata.level==`number`,RootTreeNode={name:`Root`,id:`root`,parent:null,children:[],metadata:{variant:`content`,level:0,displayValue:`Root`}};export{RootTreeNode,getServiceNode,hasValidLevel};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { t as initialTreeState, e as treeReducer };
|
|
1
|
+
import{n as treeReducer,t as initialTreeState}from"../../../../chunks/treeReducer.js";export{initialTreeState,treeReducer};
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.38",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.21",
|
|
6
|
-
"@box/blueprint-web": "^16.13.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.5.
|
|
6
|
+
"@box/blueprint-web": "^16.13.2",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.5.11",
|
|
8
8
|
"lodash": "^4.17.15",
|
|
9
9
|
"react": "^17.0.0 || ^18.0.0",
|
|
10
10
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
11
11
|
"react-intl": "^6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@box/tree": "^2.1.
|
|
14
|
+
"@box/tree": "^2.1.38",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@box/blueprint-web": "^16.13.
|
|
19
|
-
"@box/blueprint-web-assets": "^5.5.
|
|
20
|
-
"@box/storybook-utils": "^1.1.
|
|
18
|
+
"@box/blueprint-web": "^16.13.2",
|
|
19
|
+
"@box/blueprint-web-assets": "^5.5.11",
|
|
20
|
+
"@box/storybook-utils": "^1.1.35",
|
|
21
21
|
"react": "^18.3.0",
|
|
22
22
|
"react-dom": "^18.3.0"
|
|
23
23
|
},
|