freemium-ui 2.0.91 → 2.1.0-alpha.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/lib/Accordion-Ccv-p2G6.js +134 -0
- package/lib/Accordion.d.ts +56 -0
- package/lib/Accordion.js +7 -0
- package/lib/Alert-BtEbkVK1.js +52 -0
- package/lib/Alert.d.ts +66 -0
- package/lib/Alert.js +6 -0
- package/lib/AutoComplete-DF33_uur.js +608 -0
- package/lib/AutoComplete.d.ts +105 -0
- package/lib/AutoComplete.js +14 -0
- package/lib/BoxedRadio-D5Kiintm.js +75 -0
- package/lib/BoxedRadio.d.ts +61 -0
- package/lib/BoxedRadio.js +10 -0
- package/lib/Button-Bd1O8_k7.js +34 -0
- package/lib/Button.d.ts +34 -0
- package/lib/Button.js +2 -0
- package/lib/ButtonDropdown-BZvCwUDe.js +37 -0
- package/lib/ButtonDropdown.d.ts +82 -0
- package/lib/ButtonDropdown.js +11 -0
- package/lib/Calendar-C0xW_pPO.js +32 -0
- package/lib/Calendar.d.ts +25 -0
- package/lib/Calendar.js +2 -0
- package/lib/Checkbox-By1CgFUJ.js +66 -0
- package/lib/Checkbox.d.ts +28 -0
- package/lib/Checkbox.js +7 -0
- package/lib/ChevronUp-BWiG3XYd.js +7 -0
- package/lib/Combination-AmN1Cqrf.js +210 -0
- package/lib/Confirmation-49GhlyzQ.js +66 -0
- package/lib/Confirmation.d.ts +72 -0
- package/lib/Confirmation.js +8 -0
- package/lib/Cross-CIeKwtq6.js +7 -0
- package/lib/CustomizeColumns-BSF8e_we.js +865 -0
- package/lib/Drawer-CnmXL5_B.js +33 -0
- package/lib/Drawer.d.ts +50 -0
- package/lib/Drawer.js +8 -0
- package/lib/Dropdown-D59u6zOt.js +89 -0
- package/lib/Dropdown.d.ts +162 -0
- package/lib/Dropdown.js +15 -0
- package/lib/ErrorText-Uvye7uop.js +8 -0
- package/lib/Info-BsILbpCG.js +9 -0
- package/lib/Input.d.ts +66 -0
- package/lib/Input.js +5 -0
- package/lib/Loader-b8lHCp4N.js +13 -0
- package/lib/Loader.d.ts +21 -0
- package/lib/Loader.js +3 -0
- package/lib/Menu-DoE00Mg-.js +19 -0
- package/lib/Menu.d.ts +80 -0
- package/lib/Menu.js +11 -0
- package/lib/Modal-D5RJHnbn.js +51 -0
- package/lib/Modal.d.ts +51 -0
- package/lib/Modal.js +7 -0
- package/lib/MultiSelectDropdown-DblSkVpv.js +84 -0
- package/lib/MultiSelectDropdown.d.ts +116 -0
- package/lib/MultiSelectDropdown.js +14 -0
- package/lib/Pickers.d.ts +94 -0
- package/lib/Pickers.js +16 -0
- package/lib/Popover-BU73-g73.js +90 -0
- package/lib/Popover.d.ts +94 -0
- package/lib/Popover.js +8 -0
- package/lib/QuillEditor.d.ts +29 -0
- package/lib/QuillEditor.js +3369 -0
- package/lib/Radio.d.ts +69 -0
- package/lib/Radio.js +10 -0
- package/lib/RadioGroup-DM_Y48_b.js +42 -0
- package/lib/Reorder-DUSHsq7i.js +697 -0
- package/lib/Reorder.d.ts +36 -0
- package/lib/Reorder.js +5 -0
- package/lib/SortDropdown-B0SSCJX6.js +17 -0
- package/lib/SortDropdown.d.ts +47 -0
- package/lib/SortDropdown.js +10 -0
- package/lib/Table-cidceyn5.js +117 -0
- package/lib/Table.d.ts +95 -0
- package/lib/Table.js +18 -0
- package/lib/Tabs-j1c7ybY-.js +50 -0
- package/lib/Tabs.d.ts +68 -0
- package/lib/Tabs.js +6 -0
- package/lib/Tag-Cu75ReQP.js +49 -0
- package/lib/Tag.d.ts +50 -0
- package/lib/Tag.js +4 -0
- package/lib/TextArea--fiwZ_QM.js +98 -0
- package/lib/ThemeProvider-bWL8hyYA.js +7 -0
- package/lib/ThemeProvider.d.ts +158 -0
- package/lib/ThemeProvider.js +9 -0
- package/lib/TickIcon-BJqSAG4_.js +7 -0
- package/lib/TimePicker-7Uqb3xJn.js +6598 -0
- package/lib/Toast.d.ts +61 -0
- package/lib/Toast.js +10 -0
- package/lib/ToastProvider-CMk1PSzB.js +264 -0
- package/lib/Toggle-BGV7Nc6t.js +59 -0
- package/lib/Toggle.d.ts +35 -0
- package/lib/Toggle.js +6 -0
- package/lib/Tooltip-DU_ATFRB.js +127 -0
- package/lib/Tooltip.d.ts +53 -0
- package/lib/Tooltip.js +8 -0
- package/lib/Typography-BcAppjDF.js +11 -0
- package/lib/Typography.d.ts +20 -0
- package/lib/Typography.js +2 -0
- package/lib/WorkspaceTable-BV5zccyt.js +100 -0
- package/lib/WorkspaceTable.d.ts +85 -0
- package/lib/WorkspaceTable.js +18 -0
- package/lib/_commonjsHelpers-fGXyuM93.js +4 -0
- package/lib/allPaths-DKtiSqHL.js +19 -0
- package/lib/allPathsLoader-Drb6xO2O.js +5 -0
- package/lib/index-B9EcTy5B.js +46 -0
- package/lib/index-BPxkexqj.js +60 -0
- package/lib/index-BROhcSiX.js +8 -0
- package/lib/index-BT1o947S.js +8 -0
- package/lib/index-BY9lf-do.js +2 -0
- package/lib/index-BdTXfGkV.js +24 -0
- package/lib/index-BnDw8kbT.js +135 -0
- package/lib/index-BrF1HKA1.js +338 -0
- package/lib/index-BxNZ3C71.js +4 -0
- package/lib/index-ByHJlnsx.js +26 -0
- package/lib/index-COoRg_pp.js +55 -0
- package/lib/index-CeIB4COQ.js +10 -0
- package/lib/index-Cjkk7z9c.js +19 -0
- package/lib/index-D6iTv28r.js +607 -0
- package/lib/index-D8E8s0tV.js +60 -0
- package/lib/index-DtILdK5l.js +48 -0
- package/lib/index-DtzckyT3.js +4 -0
- package/lib/index-Dy5ztCxm.js +27 -0
- package/lib/index-KMLwCm58.js +607 -0
- package/lib/index-_WvIFKTM.js +6 -0
- package/lib/index.d.ts +1826 -1842
- package/lib/index.js +54 -17049
- package/lib/isTypedArray-DN-UDJh5.js +89 -0
- package/lib/keyframes-PnzFl0I5.js +20 -0
- package/lib/package.json +133 -3
- package/lib/rollup.config.d.ts.map +1 -0
- package/lib/splitPathsBySizeLoader-Cm_vHo5k.js +23 -0
- package/lib/styled-components.browser.esm-Bq2p-e5F.js +479 -0
- package/lib/styles-BbwNLGy3.js +177 -0
- package/lib/styles-BlCCKAZq.js +1192 -0
- package/lib/use-toasts-GqvPVmSy.js +5 -0
- package/package.json +148 -12
- package/buildspec.yml +0 -22
- package/freemium-ui-2.0.91.tgz +0 -0
- package/lib/index.cjs.js +0 -17225
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
import{u as e,_ as t,b as n,e as r,c as o}from"./styled-components.browser.esm-Bq2p-e5F.js"
|
|
2
|
+
|
|
3
|
+
;import i,{useMemo as a,useLayoutEffect as l,useEffect as c,useRef as s,useCallback as d,useState as u,createContext as f,memo as h,useReducer as g,useContext as v}from"react"
|
|
4
|
+
;import{unstable_batchedUpdates as p,createPortal as b}from"react-dom"
|
|
5
|
+
;import{g as m}from"./index-BT1o947S.js";import{a as y}from"./index-D8E8s0tV.js"
|
|
6
|
+
;const w="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement
|
|
7
|
+
;function x(e){const t=Object.prototype.toString.call(e)
|
|
8
|
+
;return"[object Window]"===t||"[object global]"===t}function D(e){
|
|
9
|
+
return"nodeType"in e}function C(e){var t,n
|
|
10
|
+
;return e?x(e)?e:D(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window
|
|
11
|
+
}function R(e){const{Document:t}=C(e);return e instanceof t}function E(e){
|
|
12
|
+
return!x(e)&&e instanceof C(e).HTMLElement}function S(e){
|
|
13
|
+
return e instanceof C(e).SVGElement}function I(e){
|
|
14
|
+
return e?x(e)?e.document:D(e)?R(e)?e:E(e)||S(e)?e.ownerDocument:document:document:document
|
|
15
|
+
}const N=w?l:c;function M(e){const t=s(e);return N((()=>{t.current=e
|
|
16
|
+
})),d((function(){
|
|
17
|
+
for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r]
|
|
18
|
+
;return null==t.current?void 0:t.current(...n)}),[])}function T(e,t){
|
|
19
|
+
void 0===t&&(t=[e]);const n=s(e);return N((()=>{n.current!==e&&(n.current=e)
|
|
20
|
+
}),t),n}function O(e,t){const n=s();return a((()=>{const t=e(n.current)
|
|
21
|
+
;return n.current=t,t}),[...t])}function A(e){const t=M(e),n=s(null),r=d((e=>{
|
|
22
|
+
e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}
|
|
23
|
+
function k(e){const t=s();return c((()=>{t.current=e}),[e]),t.current}let L={}
|
|
24
|
+
;function B(e,t){return a((()=>{if(t)return t;const n=null==L[e]?0:L[e]+1
|
|
25
|
+
;return L[e]=n,e+"-"+n}),[e,t])}function z(e){return function(t){
|
|
26
|
+
for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o]
|
|
27
|
+
;return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){
|
|
28
|
+
const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const F=z(1),j=z(-1)
|
|
29
|
+
;function P(e){if(!e)return!1;const{KeyboardEvent:t}=C(e.target)
|
|
30
|
+
;return t&&e instanceof t}function X(e){if(function(e){if(!e)return!1
|
|
31
|
+
;const{TouchEvent:t}=C(e.target);return t&&e instanceof t}(e)){
|
|
32
|
+
if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{
|
|
33
|
+
x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){
|
|
34
|
+
const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}
|
|
35
|
+
return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,
|
|
36
|
+
y:e.clientY}:null}const Y=Object.freeze({Translate:{toString(e){if(!e)return
|
|
37
|
+
;const{x:t,y:n}=e
|
|
38
|
+
;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},
|
|
39
|
+
Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e
|
|
40
|
+
;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){
|
|
41
|
+
if(e)return[Y.Translate.toString(e),Y.Scale.toString(e)].join(" ")}},
|
|
42
|
+
Transition:{toString(e){let{property:t,duration:n,easing:r}=e
|
|
43
|
+
;return t+" "+n+"ms "+r}}
|
|
44
|
+
}),K="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"
|
|
45
|
+
;function U(e){return e.matches(K)?e:e.querySelector(K)}const W={display:"none"}
|
|
46
|
+
;function H(e){let{id:t,value:n}=e;return i.createElement("div",{id:t,style:W
|
|
47
|
+
},n)}function q(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e
|
|
48
|
+
;return i.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,
|
|
49
|
+
margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",
|
|
50
|
+
clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,
|
|
51
|
+
"aria-atomic":!0},n)}const J=f(null);const V={
|
|
52
|
+
draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "
|
|
53
|
+
},Z={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},
|
|
54
|
+
onDragOver(e){let{active:t,over:n}=e
|
|
55
|
+
;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."
|
|
56
|
+
},onDragEnd(e){let{active:t,over:n}=e
|
|
57
|
+
;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."
|
|
58
|
+
},onDragCancel(e){let{active:t}=e
|
|
59
|
+
;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}}
|
|
60
|
+
;function G(e){
|
|
61
|
+
let{announcements:t=Z,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=V}=e
|
|
62
|
+
;const{announce:l,announcement:s}=function(){const[e,t]=u("");return{
|
|
63
|
+
announce:d((e=>{null!=e&&t(e)}),[]),announcement:e}
|
|
64
|
+
}(),f=B("DndLiveRegion"),[h,g]=u(!1);if(c((()=>{g(!0)}),[]),function(e){
|
|
65
|
+
const t=v(J);c((()=>{
|
|
66
|
+
if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>")
|
|
67
|
+
;return t(e)}),[e,t])}(a((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({
|
|
68
|
+
active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({
|
|
69
|
+
active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({
|
|
70
|
+
active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,
|
|
71
|
+
over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,
|
|
72
|
+
over:r}))}})),[l,t])),!h)return null
|
|
73
|
+
;const p=i.createElement(i.Fragment,null,i.createElement(H,{id:r,
|
|
74
|
+
value:o.draggable}),i.createElement(q,{id:f,announcement:s}));return n?b(p,n):p}
|
|
75
|
+
var _;function Q(){}function $(e,t){return a((()=>({sensor:e,
|
|
76
|
+
options:null!=t?t:{}})),[e,t])}!function(e){
|
|
77
|
+
e.DragStart="dragStart",e.DragMove="dragMove",
|
|
78
|
+
e.DragEnd="dragEnd",e.DragCancel="dragCancel",
|
|
79
|
+
e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",
|
|
80
|
+
e.SetDroppableDisabled="setDroppableDisabled",
|
|
81
|
+
e.UnregisterDroppable="unregisterDroppable"}(_||(_={}));const ee=Object.freeze({
|
|
82
|
+
x:0,y:0});function te(e,t){
|
|
83
|
+
return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ne(e,t){
|
|
84
|
+
let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function re(e,t){
|
|
85
|
+
let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function oe(e){
|
|
86
|
+
let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{
|
|
87
|
+
x:t+o,y:n+r}]}function ie(e,t){if(!e||0===e.length)return null;const[n]=e
|
|
88
|
+
;return n[t]}function ae(e,t,n){
|
|
89
|
+
return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,
|
|
90
|
+
y:n+.5*e.height}}const le=e=>{
|
|
91
|
+
let{collisionRect:t,droppableRects:n,droppableContainers:r}=e
|
|
92
|
+
;const o=ae(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t)
|
|
93
|
+
;if(r){const n=te(ae(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}
|
|
94
|
+
return i.sort(ne)};function ce(e,t){
|
|
95
|
+
const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n
|
|
96
|
+
;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l
|
|
97
|
+
;return Number((o/(n+r-o)).toFixed(4))}return 0}const se=e=>{
|
|
98
|
+
let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[]
|
|
99
|
+
;for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=ce(i,t);n>0&&o.push({
|
|
100
|
+
id:r,data:{droppableContainer:e,value:n}})}}return o.sort(re)};function de(e,t){
|
|
101
|
+
return e&&t?{x:e.left-t.left,y:e.top-t.top}:ee}function ue(e){
|
|
102
|
+
return function(t){
|
|
103
|
+
for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o]
|
|
104
|
+
;return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,
|
|
105
|
+
left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const fe=ue(1);const he={
|
|
106
|
+
ignoreTransform:!1};function ge(e,t){void 0===t&&(t=he)
|
|
107
|
+
;let n=e.getBoundingClientRect();if(t.ignoreTransform){
|
|
108
|
+
const{transform:t,transformOrigin:r}=C(e).getComputedStyle(e)
|
|
109
|
+
;t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){
|
|
110
|
+
const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],
|
|
111
|
+
scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /)
|
|
112
|
+
;return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t)
|
|
113
|
+
;if(!r)return e
|
|
114
|
+
;const{scaleX:o,scaleY:i,x:a,y:l}=r,c=e.left-a-(1-o)*parseFloat(n),s=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height
|
|
115
|
+
;return{width:d,height:u,top:s,right:c+d,bottom:s+u,left:c}}(n,t,r))}
|
|
116
|
+
const{top:r,left:o,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:o,
|
|
117
|
+
width:i,height:a,bottom:l,right:c}}function ve(e){return ge(e,{
|
|
118
|
+
ignoreTransform:!0})}function pe(e,t){const n=[];return e?function r(o){
|
|
119
|
+
if(null!=t&&n.length>=t)return n;if(!o)return n
|
|
120
|
+
;if(R(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),
|
|
121
|
+
n;if(!E(o)||S(o))return n;if(n.includes(o))return n
|
|
122
|
+
;const i=C(e).getComputedStyle(o);return o!==e&&function(e,t){
|
|
123
|
+
void 0===t&&(t=C(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/
|
|
124
|
+
;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e]
|
|
125
|
+
;return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){
|
|
126
|
+
return void 0===t&&(t=C(e).getComputedStyle(e)),"fixed"===t.position
|
|
127
|
+
}(o,i)?n:r(o.parentNode)}(e):n}function be(e){const[t]=pe(e,1)
|
|
128
|
+
;return null!=t?t:null}function me(e){
|
|
129
|
+
return w&&e?x(e)?e:D(e)?R(e)||e===I(e).scrollingElement?window:E(e)?e:null:null:null
|
|
130
|
+
}function ye(e){return x(e)?e.scrollX:e.scrollLeft}function we(e){
|
|
131
|
+
return x(e)?e.scrollY:e.scrollTop}function xe(e){return{x:ye(e),y:we(e)}}var De
|
|
132
|
+
;function Ce(e){return!(!w||!e)&&e===document.scrollingElement}function Re(e){
|
|
133
|
+
const t={x:0,y:0},n=Ce(e)?{height:window.innerHeight,width:window.innerWidth}:{
|
|
134
|
+
height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,
|
|
135
|
+
y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,
|
|
136
|
+
isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,
|
|
137
|
+
maxScroll:r,minScroll:t}}!function(e){
|
|
138
|
+
e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(De||(De={}));const Ee={
|
|
139
|
+
x:.2,y:.2};function Se(e,t,n,r,o){let{top:i,left:a,right:l,bottom:c}=n
|
|
140
|
+
;void 0===r&&(r=10),void 0===o&&(o=Ee)
|
|
141
|
+
;const{isTop:s,isBottom:d,isLeft:u,isRight:f}=Re(e),h={x:0,y:0},g={x:0,y:0
|
|
142
|
+
},v=t.height*o.y,p=t.width*o.x
|
|
143
|
+
;return!s&&i<=t.top+v?(h.y=De.Backward,g.y=r*Math.abs((t.top+v-i)/v)):!d&&c>=t.bottom-v&&(h.y=De.Forward,
|
|
144
|
+
g.y=r*Math.abs((t.bottom-v-c)/v)),
|
|
145
|
+
!f&&l>=t.right-p?(h.x=De.Forward,g.x=r*Math.abs((t.right-p-l)/p)):!u&&a<=t.left+p&&(h.x=De.Backward,
|
|
146
|
+
g.x=r*Math.abs((t.left+p-a)/p)),{direction:h,speed:g}}function Ie(e){
|
|
147
|
+
if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window
|
|
148
|
+
;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}
|
|
149
|
+
const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,
|
|
150
|
+
left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}
|
|
151
|
+
function Ne(e){return e.reduce(((e,t)=>F(e,xe(t))),ee)}
|
|
152
|
+
const Me=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+ye(t)),0)
|
|
153
|
+
}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+we(t)),0)}]]
|
|
154
|
+
;class Te{constructor(e,t){
|
|
155
|
+
this.rect=void 0,this.width=void 0,this.height=void 0,
|
|
156
|
+
this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0
|
|
157
|
+
;const n=pe(t),r=Ne(n);this.rect={...e},this.width=e.width,this.height=e.height
|
|
158
|
+
;for(const[e,t,o]of Me)for(const i of t)Object.defineProperty(this,i,{get:()=>{
|
|
159
|
+
const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0})
|
|
160
|
+
;Object.defineProperty(this,"rect",{enumerable:!1})}}class Oe{constructor(e){
|
|
161
|
+
this.target=void 0,this.listeners=[],this.removeAll=()=>{
|
|
162
|
+
this.listeners.forEach((e=>{var t
|
|
163
|
+
;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))
|
|
164
|
+
},this.target=e}add(e,t,n){var r
|
|
165
|
+
;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}
|
|
166
|
+
function Ae(e,t){const n=Math.abs(e.x),r=Math.abs(e.y)
|
|
167
|
+
;return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y
|
|
168
|
+
}var ke,Le;function Be(e){e.preventDefault()}function ze(e){e.stopPropagation()}
|
|
169
|
+
!function(e){
|
|
170
|
+
e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",
|
|
171
|
+
e.Resize="resize",
|
|
172
|
+
e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"
|
|
173
|
+
}(ke||(ke={})),function(e){
|
|
174
|
+
e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",
|
|
175
|
+
e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(Le||(Le={}))
|
|
176
|
+
;const Fe={start:[Le.Space,Le.Enter],cancel:[Le.Esc],end:[Le.Space,Le.Enter]
|
|
177
|
+
},je=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Le.Right:return{
|
|
178
|
+
...n,x:n.x+25};case Le.Left:return{...n,x:n.x-25};case Le.Down:return{...n,
|
|
179
|
+
y:n.y+25};case Le.Up:return{...n,y:n.y-25}}};class Pe{constructor(e){
|
|
180
|
+
this.props=void 0,
|
|
181
|
+
this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,
|
|
182
|
+
this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,
|
|
183
|
+
this.listeners=new Oe(I(t)),
|
|
184
|
+
this.windowListeners=new Oe(C(t)),this.handleKeyDown=this.handleKeyDown.bind(this),
|
|
185
|
+
this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){
|
|
186
|
+
this.handleStart(),
|
|
187
|
+
this.windowListeners.add(ke.Resize,this.handleCancel),this.windowListeners.add(ke.VisibilityChange,this.handleCancel),
|
|
188
|
+
setTimeout((()=>this.listeners.add(ke.Keydown,this.handleKeyDown)))}
|
|
189
|
+
handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current
|
|
190
|
+
;n&&function(e,t){if(void 0===t&&(t=ge),!e)return
|
|
191
|
+
;const{top:n,left:r,bottom:o,right:i}=t(e)
|
|
192
|
+
;be(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({
|
|
193
|
+
block:"center",inline:"center"})}(n),t(ee)}handleKeyDown(e){if(P(e)){
|
|
194
|
+
const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Fe,coordinateGetter:i=je,scrollBehavior:a="smooth"}=r,{code:l}=e
|
|
195
|
+
;if(o.end.includes(l))return void this.handleEnd(e)
|
|
196
|
+
;if(o.cancel.includes(l))return void this.handleCancel(e)
|
|
197
|
+
;const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.top}:ee
|
|
198
|
+
;this.referenceCoordinates||(this.referenceCoordinates=s);const d=i(e,{active:t,
|
|
199
|
+
context:n.current,currentCoordinates:s});if(d){const t=j(d,s),r={x:0,y:0
|
|
200
|
+
},{scrollableAncestors:o}=n.current;for(const n of o){
|
|
201
|
+
const o=e.code,{isTop:i,isRight:l,isLeft:c,isBottom:s,maxScroll:u,minScroll:f}=Re(n),h=Ie(n),g={
|
|
202
|
+
x:Math.min(o===Le.Right?h.right-h.width/2:h.right,Math.max(o===Le.Right?h.left:h.left+h.width/2,d.x)),
|
|
203
|
+
y:Math.min(o===Le.Down?h.bottom-h.height/2:h.bottom,Math.max(o===Le.Down?h.top:h.top+h.height/2,d.y))
|
|
204
|
+
},v=o===Le.Right&&!l||o===Le.Left&&!c,p=o===Le.Down&&!s||o===Le.Up&&!i
|
|
205
|
+
;if(v&&g.x!==d.x){
|
|
206
|
+
const e=n.scrollLeft+t.x,i=o===Le.Right&&e<=u.x||o===Le.Left&&e>=f.x
|
|
207
|
+
;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a})
|
|
208
|
+
;r.x=i?n.scrollLeft-e:o===Le.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,
|
|
209
|
+
r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(p&&g.y!==d.y){
|
|
210
|
+
const e=n.scrollTop+t.y,i=o===Le.Down&&e<=u.y||o===Le.Up&&e>=f.y
|
|
211
|
+
;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a})
|
|
212
|
+
;r.y=i?n.scrollTop-e:o===Le.Down?n.scrollTop-u.y:n.scrollTop-f.y,
|
|
213
|
+
r.y&&n.scrollBy({top:-r.y,behavior:a});break}}
|
|
214
|
+
this.handleMove(e,F(j(d,this.referenceCoordinates),r))}}}handleMove(e,t){
|
|
215
|
+
const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){
|
|
216
|
+
const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){
|
|
217
|
+
const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){
|
|
218
|
+
this.listeners.removeAll(),this.windowListeners.removeAll()}}function Xe(e){
|
|
219
|
+
return Boolean(e&&"distance"in e)}function Ye(e){return Boolean(e&&"delay"in e)}
|
|
220
|
+
Pe.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{
|
|
221
|
+
let{keyboardCodes:r=Fe,onActivation:o}=t,{active:i}=n
|
|
222
|
+
;const{code:a}=e.nativeEvent;if(r.start.includes(a)){
|
|
223
|
+
const t=i.activatorNode.current
|
|
224
|
+
;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent
|
|
225
|
+
}),!0)}return!1}}];class Ke{constructor(e,t,n){var r;void 0===n&&(n=function(e){
|
|
226
|
+
const{EventTarget:t}=C(e);return e instanceof t?e:I(e)
|
|
227
|
+
}(e.event.target)),this.props=void 0,
|
|
228
|
+
this.events=void 0,this.autoScrollEnabled=!0,
|
|
229
|
+
this.document=void 0,this.activated=!1,
|
|
230
|
+
this.initialCoordinates=void 0,this.timeoutId=null,
|
|
231
|
+
this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,
|
|
232
|
+
this.props=e,this.events=t;const{event:o}=e,{target:i}=o
|
|
233
|
+
;this.props=e,this.events=t,
|
|
234
|
+
this.document=I(i),this.documentListeners=new Oe(this.document),
|
|
235
|
+
this.listeners=new Oe(n),
|
|
236
|
+
this.windowListeners=new Oe(C(i)),this.initialCoordinates=null!=(r=X(o))?r:ee,
|
|
237
|
+
this.handleStart=this.handleStart.bind(this),
|
|
238
|
+
this.handleMove=this.handleMove.bind(this),
|
|
239
|
+
this.handleEnd=this.handleEnd.bind(this),
|
|
240
|
+
this.handleCancel=this.handleCancel.bind(this),
|
|
241
|
+
this.handleKeydown=this.handleKeydown.bind(this),
|
|
242
|
+
this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}
|
|
243
|
+
attach(){
|
|
244
|
+
const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this
|
|
245
|
+
;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1
|
|
246
|
+
}),this.listeners.add(e.end.name,this.handleEnd),
|
|
247
|
+
this.windowListeners.add(ke.Resize,this.handleCancel),
|
|
248
|
+
this.windowListeners.add(ke.DragStart,Be),
|
|
249
|
+
this.windowListeners.add(ke.VisibilityChange,this.handleCancel),
|
|
250
|
+
this.windowListeners.add(ke.ContextMenu,Be),
|
|
251
|
+
this.documentListeners.add(ke.Keydown,this.handleKeydown),t){if(null!=n&&n({
|
|
252
|
+
event:this.props.event,activeNode:this.props.activeNode,
|
|
253
|
+
options:this.props.options}))return this.handleStart()
|
|
254
|
+
;if(Ye(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))
|
|
255
|
+
;if(Xe(t))return}this.handleStart()}detach(){
|
|
256
|
+
this.listeners.removeAll(),this.windowListeners.removeAll(),
|
|
257
|
+
setTimeout(this.documentListeners.removeAll,50),
|
|
258
|
+
null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}
|
|
259
|
+
handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props
|
|
260
|
+
;e&&(this.activated=!0,this.documentListeners.add(ke.Click,ze,{capture:!0
|
|
261
|
+
}),this.removeTextSelection(),
|
|
262
|
+
this.documentListeners.add(ke.SelectionChange,this.removeTextSelection),t(e))}
|
|
263
|
+
handleMove(e){var t
|
|
264
|
+
;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o
|
|
265
|
+
;if(!r)return;const l=null!=(t=X(e))?t:ee,c=j(r,l);if(!n&&a){if(Xe(a)){
|
|
266
|
+
if(null!=a.tolerance&&Ae(c,a.tolerance))return this.handleCancel()
|
|
267
|
+
;if(Ae(c,a.distance))return this.handleStart()}
|
|
268
|
+
return Ye(a)&&Ae(c,a.tolerance)?this.handleCancel():void 0}
|
|
269
|
+
e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props
|
|
270
|
+
;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()
|
|
271
|
+
}handleKeydown(e){e.code===Le.Esc&&this.handleCancel()}removeTextSelection(){
|
|
272
|
+
var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ue={
|
|
273
|
+
move:{name:"pointermove"},end:{name:"pointerup"}};class We extends Ke{
|
|
274
|
+
constructor(e){const{event:t}=e,n=I(t.target);super(e,Ue,n)}}We.activators=[{
|
|
275
|
+
eventName:"onPointerDown",handler:(e,t)=>{
|
|
276
|
+
let{nativeEvent:n}=e,{onActivation:r}=t
|
|
277
|
+
;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const He={
|
|
278
|
+
move:{name:"mousemove"},end:{name:"mouseup"}};var qe;!function(e){
|
|
279
|
+
e[e.RightClick=2]="RightClick"}(qe||(qe={}));class Je extends Ke{constructor(e){
|
|
280
|
+
super(e,He,I(e.event.target))}}Je.activators=[{eventName:"onMouseDown",
|
|
281
|
+
handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t
|
|
282
|
+
;return n.button!==qe.RightClick&&(null==r||r({event:n}),!0)}}];const Ve={move:{
|
|
283
|
+
name:"touchmove"},end:{name:"touchend"}};class Ze extends Ke{constructor(e){
|
|
284
|
+
super(e,Ve)}static setup(){return window.addEventListener(Ve.move.name,e,{
|
|
285
|
+
capture:!1,passive:!1}),function(){window.removeEventListener(Ve.move.name,e)}
|
|
286
|
+
;function e(){}}}var Ge,_e;function Qe(e){
|
|
287
|
+
let{acceleration:t,activator:n=Ge.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:u=_e.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:g,delta:v,threshold:p}=e
|
|
288
|
+
;const b=function(e){let{delta:t,disabled:n}=e;const r=k(t);return O((e=>{
|
|
289
|
+
if(n||!r||!e)return $e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)}
|
|
290
|
+
;return{x:{[De.Backward]:e.x[De.Backward]||-1===o.x,
|
|
291
|
+
[De.Forward]:e.x[De.Forward]||1===o.x},y:{
|
|
292
|
+
[De.Backward]:e.y[De.Backward]||-1===o.y,[De.Forward]:e.y[De.Forward]||1===o.y}}
|
|
293
|
+
}),[n,t,r])}({delta:v,disabled:!i}),[m,y]=function(){const e=s(null)
|
|
294
|
+
;return[d(((t,n)=>{e.current=setInterval(t,n)}),[]),d((()=>{
|
|
295
|
+
null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=s({x:0,
|
|
296
|
+
y:0}),x=s({x:0,y:0}),D=a((()=>{switch(n){case Ge.Pointer:return f?{top:f.y,
|
|
297
|
+
bottom:f.y,left:f.x,right:f.x}:null;case Ge.DraggableRect:return o}
|
|
298
|
+
}),[n,o,f]),C=s(null),R=d((()=>{const e=C.current;if(!e)return
|
|
299
|
+
;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)
|
|
300
|
+
}),[]),E=a((()=>u===_e.TreeOrder?[...h].reverse():h),[u,h]);c((()=>{
|
|
301
|
+
if(i&&h.length&&D){for(const e of E){if(!1===(null==r?void 0:r(e)))continue
|
|
302
|
+
;const n=h.indexOf(e),o=g[n];if(!o)continue
|
|
303
|
+
;const{direction:i,speed:a}=Se(e,o,D,t,p)
|
|
304
|
+
;for(const e of["x","y"])b[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return y(),
|
|
305
|
+
C.current=e,m(R,l),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={
|
|
306
|
+
x:0,y:0},y()}else y()
|
|
307
|
+
}),[t,R,r,y,i,l,JSON.stringify(D),JSON.stringify(b),m,h,E,g,JSON.stringify(p)])}
|
|
308
|
+
Ze.activators=[{eventName:"onTouchStart",handler:(e,t)=>{
|
|
309
|
+
let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n
|
|
310
|
+
;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){
|
|
311
|
+
e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"
|
|
312
|
+
}(Ge||(Ge={})),function(e){
|
|
313
|
+
e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"
|
|
314
|
+
}(_e||(_e={}));const $e={x:{[De.Backward]:!1,[De.Forward]:!1},y:{
|
|
315
|
+
[De.Backward]:!1,[De.Forward]:!1}};var et,tt;!function(e){
|
|
316
|
+
e[e.Always=0]="Always",
|
|
317
|
+
e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"
|
|
318
|
+
}(et||(et={})),function(e){e.Optimized="optimized"}(tt||(tt={}))
|
|
319
|
+
;const nt=new Map;function rt(e,t){
|
|
320
|
+
return O((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function ot(e){
|
|
321
|
+
let{callback:t,disabled:n}=e;const r=M(t),o=a((()=>{
|
|
322
|
+
if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return
|
|
323
|
+
;const{ResizeObserver:e}=window;return new e(r)}),[n])
|
|
324
|
+
;return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function it(e){
|
|
325
|
+
return new Te(ge(e),e)}function at(e,t,n){void 0===t&&(t=it)
|
|
326
|
+
;const[r,o]=g((function(r){if(!e)return null;var o
|
|
327
|
+
;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e)
|
|
328
|
+
;if(JSON.stringify(r)===JSON.stringify(i))return r;return i
|
|
329
|
+
}),null),i=function(e){let{callback:t,disabled:n}=e;const r=M(t),o=a((()=>{
|
|
330
|
+
if(n||"undefined"==typeof window||void 0===window.MutationObserver)return
|
|
331
|
+
;const{MutationObserver:e}=window;return new e(r)}),[r,n])
|
|
332
|
+
;return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){
|
|
333
|
+
if(e)for(const n of t){const{type:t,target:r}=n
|
|
334
|
+
;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}
|
|
335
|
+
}),l=ot({callback:o});return N((()=>{
|
|
336
|
+
o(),e?(null==l||l.observe(e),null==i||i.observe(document.body,{childList:!0,
|
|
337
|
+
subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[e]),r}
|
|
338
|
+
const lt=[];function ct(e,t){void 0===t&&(t=[]);const n=s(null);return c((()=>{
|
|
339
|
+
n.current=null}),t),c((()=>{const t=e!==ee
|
|
340
|
+
;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)
|
|
341
|
+
}),[e]),n.current?j(e,n.current):ee}function st(e){return a((()=>e?function(e){
|
|
342
|
+
const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,
|
|
343
|
+
width:t,height:n}}(e):null),[e])}const dt=[];function ut(e){let{measure:t}=e
|
|
344
|
+
;const[n,r]=u(null),o=d((e=>{for(const{target:n}of e)if(E(n)){r((e=>{
|
|
345
|
+
const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}
|
|
346
|
+
}),[t]),i=ot({callback:o}),l=d((e=>{const n=function(e){if(!e)return null
|
|
347
|
+
;if(e.children.length>1)return e;const t=e.children[0];return E(t)?t:e}(e)
|
|
348
|
+
;null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)
|
|
349
|
+
}),[t,i]),[c,s]=A(l);return a((()=>({nodeRef:c,rect:n,setRef:s})),[n,c,s])}
|
|
350
|
+
const ft=[{sensor:We,options:{}},{sensor:Pe,options:{}}],ht={current:{}},gt={
|
|
351
|
+
draggable:{measure:ve},droppable:{measure:ve,strategy:et.WhileDragging,
|
|
352
|
+
frequency:tt.Optimized},dragOverlay:{measure:ge}};class vt extends Map{get(e){
|
|
353
|
+
var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){
|
|
354
|
+
return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{
|
|
355
|
+
let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n
|
|
356
|
+
;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}
|
|
357
|
+
const pt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,
|
|
358
|
+
collisions:null,containerNodeRect:null,draggableNodes:new Map,
|
|
359
|
+
droppableRects:new Map,droppableContainers:new vt,over:null,dragOverlay:{
|
|
360
|
+
nodeRef:{current:null},rect:null,setRef:Q},scrollableAncestors:[],
|
|
361
|
+
scrollableAncestorRects:[],measuringConfiguration:gt,
|
|
362
|
+
measureDroppableContainers:Q,windowRect:null,measuringScheduled:!1},bt=f({
|
|
363
|
+
activatorEvent:null,activators:[],active:null,activeNodeRect:null,
|
|
364
|
+
ariaDescribedById:{draggable:""},dispatch:Q,draggableNodes:new Map,over:null,
|
|
365
|
+
measureDroppableContainers:Q}),mt=f(pt);function yt(){return{draggable:{
|
|
366
|
+
active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},
|
|
367
|
+
droppable:{containers:new vt}}}function wt(e,t){switch(t.type){case _.DragStart:
|
|
368
|
+
return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,
|
|
369
|
+
active:t.active}};case _.DragMove:return e.draggable.active?{...e,draggable:{
|
|
370
|
+
...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,
|
|
371
|
+
y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case _.DragEnd:
|
|
372
|
+
case _.DragCancel:return{...e,draggable:{...e.draggable,active:null,
|
|
373
|
+
initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _.RegisterDroppable:{
|
|
374
|
+
const{element:n}=t,{id:r}=n,o=new vt(e.droppable.containers);return o.set(r,n),{
|
|
375
|
+
...e,droppable:{...e.droppable,containers:o}}}case _.SetDroppableDisabled:{
|
|
376
|
+
const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n)
|
|
377
|
+
;if(!i||r!==i.key)return e;const a=new vt(e.droppable.containers)
|
|
378
|
+
;return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}
|
|
379
|
+
}}case _.UnregisterDroppable:{
|
|
380
|
+
const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e
|
|
381
|
+
;const i=new vt(e.droppable.containers);return i.delete(n),{...e,droppable:{
|
|
382
|
+
...e.droppable,containers:i}}}default:return e}}function xt(e){let{disabled:t}=e
|
|
383
|
+
;const{active:n,activatorEvent:r,draggableNodes:o}=v(bt),i=k(r),a=k(null==n?void 0:n.id)
|
|
384
|
+
;return c((()=>{if(!t&&!r&&i&&null!=a){if(!P(i))return
|
|
385
|
+
;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return
|
|
386
|
+
;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return
|
|
387
|
+
;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue
|
|
388
|
+
;const t=U(e);if(t){t.focus();break}}}))}}),[r,t,o,a,i]),null}const Dt=f({...ee,
|
|
389
|
+
scaleX:1,scaleY:1});var Ct;!function(e){
|
|
390
|
+
e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",
|
|
391
|
+
e[e.Initialized=2]="Initialized"}(Ct||(Ct={}));const Rt=h((function(e){
|
|
392
|
+
var t,n,r,o
|
|
393
|
+
;let{id:l,accessibility:f,autoScroll:h=!0,children:v,sensors:b=ft,collisionDetection:m=se,measuring:y,modifiers:x,...D}=e
|
|
394
|
+
;const R=g(wt,void 0,yt),[E,S]=R,[I,M]=function(){
|
|
395
|
+
const[e]=u((()=>new Set)),t=d((t=>(e.add(t),()=>e.delete(t))),[e])
|
|
396
|
+
;return[d((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t
|
|
397
|
+
;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]
|
|
398
|
+
}(),[A,k]=u(Ct.Uninitialized),L=A===Ct.Initialized,{draggable:{active:z,nodes:j,translate:P},droppable:{containers:Y}}=E,K=z?j.get(z):null,U=s({
|
|
399
|
+
initial:null,translated:null}),W=a((()=>{var e;return null!=z?{id:z,
|
|
400
|
+
data:null!=(e=null==K?void 0:K.data)?e:ht,rect:U}:null
|
|
401
|
+
}),[z,K]),H=s(null),[q,V]=u(null),[Z,Q]=u(null),$=T(D,Object.values(D)),te=B("DndDescribedBy",l),ne=a((()=>Y.getEnabled()),[Y]),re=a((()=>({
|
|
402
|
+
draggable:{...gt.draggable,...null==oe?void 0:oe.draggable},droppable:{
|
|
403
|
+
...gt.droppable,...null==oe?void 0:oe.droppable},dragOverlay:{...gt.dragOverlay,
|
|
404
|
+
...null==oe?void 0:oe.dragOverlay}
|
|
405
|
+
})),[null==(oe=y)?void 0:oe.draggable,null==oe?void 0:oe.droppable,null==oe?void 0:oe.dragOverlay])
|
|
406
|
+
;var oe
|
|
407
|
+
;const{droppableRects:ae,measureDroppableContainers:le,measuringScheduled:ce}=function(e,t){
|
|
408
|
+
let{dragging:n,dependencies:r,config:o}=t
|
|
409
|
+
;const[i,a]=u(null),{frequency:l,measure:f,strategy:h}=o,g=s(e),v=function(){
|
|
410
|
+
switch(h){case et.Always:return!1;case et.BeforeDragging:return n;default:
|
|
411
|
+
return!n}}(),p=T(v),b=d((function(e){
|
|
412
|
+
void 0===e&&(e=[]),p.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))
|
|
413
|
+
}),[p]),m=s(null),y=O((t=>{if(v&&!n)return nt
|
|
414
|
+
;if(!t||t===nt||g.current!==e||null!=i){const t=new Map;for(let n of e){
|
|
415
|
+
if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){
|
|
416
|
+
t.set(n.id,n.rect.current);continue}
|
|
417
|
+
const e=n.node.current,r=e?new Te(f(e),e):null;n.rect.current=r,r&&t.set(n.id,r)
|
|
418
|
+
}return t}return t}),[e,i,n,v,f]);return c((()=>{g.current=e}),[e]),c((()=>{
|
|
419
|
+
v||b()}),[n,v]),c((()=>{i&&i.length>0&&a(null)}),[JSON.stringify(i)]),c((()=>{
|
|
420
|
+
v||"number"!=typeof l||null!==m.current||(m.current=setTimeout((()=>{
|
|
421
|
+
b(),m.current=null}),l))}),[l,v,b,...r]),{droppableRects:y,
|
|
422
|
+
measureDroppableContainers:b,measuringScheduled:null!=i}}(ne,{dragging:L,
|
|
423
|
+
dependencies:[P.x,P.y],config:re.droppable}),ue=function(e,t){
|
|
424
|
+
const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return O((e=>{var n
|
|
425
|
+
;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])
|
|
426
|
+
}(j,z),he=a((()=>Z?X(Z):null),[Z]),ve=function(){
|
|
427
|
+
const e=!1===(null==q?void 0:q.autoScrollEnabled),t="object"==typeof h?!1===h.enabled:!1===h,n=L&&!e&&!t
|
|
428
|
+
;if("object"==typeof h)return{...h,enabled:n};return{enabled:n}
|
|
429
|
+
}(),ye=function(e,t){return rt(e,t)}(ue,re.draggable.measure);!function(e){
|
|
430
|
+
let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e
|
|
431
|
+
;const i=s(!1),{x:a,y:l}="boolean"==typeof o?{x:o,y:o}:o;N((()=>{
|
|
432
|
+
if(!a&&!l||!t)return void(i.current=!1);if(i.current||!r)return
|
|
433
|
+
;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return
|
|
434
|
+
;const o=de(n(e),r)
|
|
435
|
+
;if(a||(o.x=0),l||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){
|
|
436
|
+
const t=be(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,l,r,n])}({
|
|
437
|
+
activeNode:z?j.get(z):null,config:ve.layoutShiftCompensation,initialRect:ye,
|
|
438
|
+
measure:re.draggable.measure})
|
|
439
|
+
;const we=at(ue,re.draggable.measure,ye),De=at(ue?ue.parentElement:null),Re=s({
|
|
440
|
+
activatorEvent:null,active:null,activeNode:ue,collisionRect:null,
|
|
441
|
+
collisions:null,droppableRects:ae,draggableNodes:j,draggingNode:null,
|
|
442
|
+
draggingNodeRect:null,droppableContainers:Y,over:null,scrollableAncestors:[],
|
|
443
|
+
scrollAdjustedTranslate:null
|
|
444
|
+
}),Ee=Y.getNodeFor(null==(t=Re.current.over)?void 0:t.id),Se=ut({
|
|
445
|
+
measure:re.dragOverlay.measure
|
|
446
|
+
}),Ie=null!=(n=Se.nodeRef.current)?n:ue,Me=L?null!=(r=Se.rect)?r:we:null,Oe=Boolean(Se.nodeRef.current&&Se.rect),Ae=de(ke=Oe?null:we,rt(ke))
|
|
447
|
+
;var ke;const Le=st(Ie?C(Ie):null),Be=function(e){
|
|
448
|
+
const t=s(e),n=O((n=>e?n&&n!==lt&&e&&t.current&&e.parentNode===t.current.parentNode?n:pe(e):lt),[e])
|
|
449
|
+
;return c((()=>{t.current=e}),[e]),n}(L?null!=Ee?Ee:ue:null),ze=function(e,t){
|
|
450
|
+
void 0===t&&(t=ge);const[n]=e,r=st(n?C(n):null),[o,i]=g((function(){
|
|
451
|
+
return e.length?e.map((e=>Ce(e)?r:new Te(t(e),e))):dt}),dt),a=ot({callback:i})
|
|
452
|
+
;return e.length>0&&o===dt&&i(),N((()=>{
|
|
453
|
+
e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),
|
|
454
|
+
i())}),[e]),o}(Be),Fe=function(e,t){let{transform:n,...r}=t
|
|
455
|
+
;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(x,{
|
|
456
|
+
transform:{x:P.x-Ae.x,y:P.y-Ae.y,scaleX:1,scaleY:1},activatorEvent:Z,active:W,
|
|
457
|
+
activeNodeRect:we,containerNodeRect:De,draggingNodeRect:Me,over:Re.current.over,
|
|
458
|
+
overlayNodeRect:Se.rect,scrollableAncestors:Be,scrollableAncestorRects:ze,
|
|
459
|
+
windowRect:Le}),je=he?F(he,P):null,Pe=function(e){
|
|
460
|
+
const[t,n]=u(null),r=s(e),o=d((e=>{const t=me(e.target)
|
|
461
|
+
;t&&n((e=>e?(e.set(t,xe(t)),new Map(e)):null))}),[]);return c((()=>{
|
|
462
|
+
const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=me(e)
|
|
463
|
+
;return t?(t.addEventListener("scroll",o,{passive:!0}),[t,xe(t)]):null
|
|
464
|
+
})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{
|
|
465
|
+
i(e),i(t)};function i(e){e.forEach((e=>{const t=me(e)
|
|
466
|
+
;null==t||t.removeEventListener("scroll",o)}))}
|
|
467
|
+
}),[o,e]),a((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>F(e,t)),ee):Ne(e):ee),[e,t])
|
|
468
|
+
}(Be),Xe=ct(Pe),Ye=ct(Pe,[we]),Ke=F(Fe,Xe),Ue=Me?fe(Me,Fe):null,We=W&&Ue?m({
|
|
469
|
+
active:W,collisionRect:Ue,droppableRects:ae,droppableContainers:ne,
|
|
470
|
+
pointerCoordinates:je}):null,He=ie(We,"id"),[qe,Je]=u(null),Ve=function(e,t,n){
|
|
471
|
+
return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}
|
|
472
|
+
}(Oe?Fe:F(Fe,Ye),null!=(o=null==qe?void 0:qe.rect)?o:null,we),Ze=d(((e,t)=>{
|
|
473
|
+
let{sensor:n,options:r}=t;if(null==H.current)return;const o=j.get(H.current)
|
|
474
|
+
;if(!o)return;const i=e.nativeEvent,a=new n({active:H.current,activeNode:o,
|
|
475
|
+
event:i,options:r,context:Re,onStart(e){const t=H.current;if(null==t)return
|
|
476
|
+
;const n=j.get(t);if(!n)return;const{onDragStart:r}=$.current,o={active:{id:t,
|
|
477
|
+
data:n.data,rect:U}};p((()=>{null==r||r(o),k(Ct.Initializing),S({
|
|
478
|
+
type:_.DragStart,initialCoordinates:e,active:t}),I({type:"onDragStart",event:o})
|
|
479
|
+
}))},onMove(e){S({type:_.DragMove,coordinates:e})},onEnd:l(_.DragEnd),
|
|
480
|
+
onCancel:l(_.DragCancel)});function l(e){return async function(){
|
|
481
|
+
const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=Re.current
|
|
482
|
+
;let a=null;if(t&&o){const{cancelDrop:l}=$.current;if(a={activatorEvent:i,
|
|
483
|
+
active:t,collisions:n,delta:o,over:r},e===_.DragEnd&&"function"==typeof l){
|
|
484
|
+
await Promise.resolve(l(a))&&(e=_.DragCancel)}}H.current=null,p((()=>{S({type:e
|
|
485
|
+
}),k(Ct.Uninitialized),Je(null),V(null),Q(null)
|
|
486
|
+
;const t=e===_.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=$.current[t]
|
|
487
|
+
;null==e||e(a),I({type:t,event:a})}}))}}p((()=>{V(a),Q(e.nativeEvent)}))
|
|
488
|
+
}),[j]),Ge=d(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=j.get(r)
|
|
489
|
+
;if(null!==H.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i}
|
|
490
|
+
;!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},H.current=r,Ze(n,t))
|
|
491
|
+
}),[j,Ze]),_e=function(e,t){return a((()=>e.reduce(((e,n)=>{const{sensor:r}=n
|
|
492
|
+
;return[...e,...r.activators.map((e=>({eventName:e.eventName,
|
|
493
|
+
handler:t(e.handler,n)})))]}),[])),[e,t])}(b,Ge);!function(e){c((()=>{
|
|
494
|
+
if(!w)return;const t=e.map((e=>{let{sensor:t}=e
|
|
495
|
+
;return null==t.setup?void 0:t.setup()}));return()=>{
|
|
496
|
+
for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))
|
|
497
|
+
}(b),N((()=>{we&&A===Ct.Initializing&&k(Ct.Initialized)}),[we,A]),c((()=>{
|
|
498
|
+
const{onDragMove:e}=$.current,{active:t,activatorEvent:n,collisions:r,over:o}=Re.current
|
|
499
|
+
;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:Ke.x,
|
|
500
|
+
y:Ke.y},over:o};p((()=>{null==e||e(i),I({type:"onDragMove",event:i})}))
|
|
501
|
+
}),[Ke.x,Ke.y]),c((()=>{
|
|
502
|
+
const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=Re.current
|
|
503
|
+
;if(!e||null==H.current||!t||!o)return
|
|
504
|
+
;const{onDragOver:i}=$.current,a=r.get(He),l=a&&a.rect.current?{id:a.id,
|
|
505
|
+
rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,
|
|
506
|
+
activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};p((()=>{
|
|
507
|
+
Je(l),null==i||i(c),I({type:"onDragOver",event:c})}))}),[He]),N((()=>{
|
|
508
|
+
Re.current={activatorEvent:Z,active:W,activeNode:ue,collisionRect:Ue,
|
|
509
|
+
collisions:We,droppableRects:ae,draggableNodes:j,draggingNode:Ie,
|
|
510
|
+
draggingNodeRect:Me,droppableContainers:Y,over:qe,scrollableAncestors:Be,
|
|
511
|
+
scrollAdjustedTranslate:Ke},U.current={initial:Me,translated:Ue}
|
|
512
|
+
}),[W,ue,We,Ue,j,Ie,Me,ae,Y,qe,Be,Ke]),Qe({...ve,delta:P,draggingRect:Ue,
|
|
513
|
+
pointerCoordinates:je,scrollableAncestors:Be,scrollableAncestorRects:ze})
|
|
514
|
+
;const $e=a((()=>({active:W,activeNode:ue,activeNodeRect:we,activatorEvent:Z,
|
|
515
|
+
collisions:We,containerNodeRect:De,dragOverlay:Se,draggableNodes:j,
|
|
516
|
+
droppableContainers:Y,droppableRects:ae,over:qe,measureDroppableContainers:le,
|
|
517
|
+
scrollableAncestors:Be,scrollableAncestorRects:ze,measuringConfiguration:re,
|
|
518
|
+
measuringScheduled:ce,windowRect:Le
|
|
519
|
+
})),[W,ue,we,Z,We,De,Se,j,Y,ae,qe,le,Be,ze,re,ce,Le]),tt=a((()=>({
|
|
520
|
+
activatorEvent:Z,activators:_e,active:W,activeNodeRect:we,ariaDescribedById:{
|
|
521
|
+
draggable:te},dispatch:S,draggableNodes:j,over:qe,measureDroppableContainers:le
|
|
522
|
+
})),[Z,_e,W,we,S,te,j,qe,le]);return i.createElement(J.Provider,{value:M
|
|
523
|
+
},i.createElement(bt.Provider,{value:tt},i.createElement(mt.Provider,{value:$e
|
|
524
|
+
},i.createElement(Dt.Provider,{value:Ve},v)),i.createElement(xt,{
|
|
525
|
+
disabled:!1===(null==f?void 0:f.restoreFocus)})),i.createElement(G,{...f,
|
|
526
|
+
hiddenTextDescribedById:te}))})),Et=f(null),St="button",It="Droppable"
|
|
527
|
+
;function Nt(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e
|
|
528
|
+
;const i=B(It),{activators:l,activatorEvent:c,active:s,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:h}=v(bt),{role:g=St,roleDescription:p="draggable",tabIndex:b=0}=null!=o?o:{},m=(null==s?void 0:s.id)===t,y=v(m?Dt:Et),[w,x]=A(),[D,C]=A(),R=function(e,t){
|
|
529
|
+
return a((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{
|
|
530
|
+
o(e,t)},e}),{})),[e,t])}(l,t),E=T(n);N((()=>(f.set(t,{id:t,key:i,node:w,
|
|
531
|
+
activatorNode:D,data:E}),()=>{const e=f.get(t);e&&e.key===i&&f.delete(t)
|
|
532
|
+
})),[f,t]);return{active:s,activatorEvent:c,activeNodeRect:d,
|
|
533
|
+
attributes:a((()=>({role:g,tabIndex:b,"aria-disabled":r,
|
|
534
|
+
"aria-pressed":!(!m||g!==St)||void 0,"aria-roledescription":p,
|
|
535
|
+
"aria-describedby":u.draggable})),[r,g,b,m,p,u.draggable]),isDragging:m,
|
|
536
|
+
listeners:r?void 0:R,node:w,over:h,setNodeRef:x,setActivatorNodeRef:C,
|
|
537
|
+
transform:y}}const Mt="Droppable",Tt={timeout:25};function Ot(e,t,n){const r={
|
|
538
|
+
...e}
|
|
539
|
+
;return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),
|
|
540
|
+
t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),
|
|
541
|
+
r}const At=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e
|
|
542
|
+
;const o=r[0];return t&&o?Ot(n,t,o):n},kt=e=>{let{transform:t}=e;return{...t,x:0
|
|
543
|
+
}},Lt=e=>{let{transform:t,draggingNodeRect:n,windowRect:r}=e
|
|
544
|
+
;return n&&r?Ot(t,n,r):t};function Bt(e,t,n){const r=e.slice()
|
|
545
|
+
;return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function zt(e,t){
|
|
546
|
+
return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e
|
|
547
|
+
}),Array(e.length))}function Ft(e){return null!==e&&e>=0}const jt=e=>{
|
|
548
|
+
let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Bt(t,r,n),a=t[o],l=i[o]
|
|
549
|
+
;return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,
|
|
550
|
+
scaleY:l.height/a.height}:null},Pt={scaleX:1,scaleY:1},Xt=e=>{var t
|
|
551
|
+
;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e
|
|
552
|
+
;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{
|
|
553
|
+
x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...Pt}:null}
|
|
554
|
+
const c=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0
|
|
555
|
+
;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0
|
|
556
|
+
;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n)
|
|
557
|
+
;return o>n&&o<=a?{x:0,y:-l.height-c,...Pt}:o<n&&o>=a?{x:0,y:l.height+c,...Pt}:{
|
|
558
|
+
x:0,y:0,...Pt}};const Yt="Sortable",Kt=i.createContext({activeIndex:-1,
|
|
559
|
+
containerId:Yt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,
|
|
560
|
+
sortedRects:[],strategy:jt,disabled:{draggable:!1,droppable:!1}})
|
|
561
|
+
;function Ut(e){let{children:t,id:n,items:r,strategy:o=jt,disabled:l=!1}=e
|
|
562
|
+
;const{active:d,dragOverlay:u,droppableRects:f,over:h,measureDroppableContainers:g}=v(mt),p=B(Yt,n),b=Boolean(null!==u.rect),m=a((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),y=null!=d,w=d?m.indexOf(d.id):-1,x=h?m.indexOf(h.id):-1,D=s(m),C=!function(e,t){
|
|
563
|
+
if(e===t)return!0;if(e.length!==t.length)return!1
|
|
564
|
+
;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0
|
|
565
|
+
}(m,D.current),R=-1!==x&&-1===w||C,E=function(e){return"boolean"==typeof e?{
|
|
566
|
+
draggable:e,droppable:e}:e}(l);N((()=>{C&&y&&g(m)}),[C,m,y,g]),c((()=>{
|
|
567
|
+
D.current=m}),[m]);const S=a((()=>({activeIndex:w,containerId:p,disabled:E,
|
|
568
|
+
disableTransforms:R,items:m,overIndex:x,useDragOverlay:b,sortedRects:zt(m,f),
|
|
569
|
+
strategy:o})),[w,p,E.draggable,E.droppable,R,m,x,f,b,o])
|
|
570
|
+
;return i.createElement(Kt.Provider,{value:S},t)}const Wt=e=>{
|
|
571
|
+
let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Bt(n,r,o).indexOf(t)
|
|
572
|
+
},Ht=e=>{
|
|
573
|
+
let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:s}=e
|
|
574
|
+
;return!(!s||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===c))},qt={duration:200,
|
|
575
|
+
easing:"ease"},Jt="transform",Vt=Y.Transition.toString({property:Jt,duration:0,
|
|
576
|
+
easing:"linear"}),Zt={roleDescription:"sortable"};function Gt(e){
|
|
577
|
+
let{animateLayoutChanges:t=Ht,attributes:n,disabled:r,data:o,getNewIndex:i=Wt,id:l,strategy:f,resizeObserverConfig:h,transition:g=qt}=e
|
|
578
|
+
;const{items:p,containerId:b,activeIndex:m,disabled:y,disableTransforms:w,sortedRects:x,overIndex:D,useDragOverlay:C,strategy:R}=v(Kt),E=function(e,t){
|
|
579
|
+
var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{
|
|
580
|
+
draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,
|
|
581
|
+
droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}
|
|
582
|
+
}(r,y),S=p.indexOf(l),I=a((()=>({sortable:{containerId:b,index:S,items:p},...o
|
|
583
|
+
})),[b,o,S,p]),M=a((()=>p.slice(p.indexOf(l))),[p,l]),{rect:O,node:k,isOver:L,setNodeRef:z}=function(e){
|
|
584
|
+
let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e
|
|
585
|
+
;const i=B(Mt),{active:a,dispatch:l,over:u,measureDroppableContainers:f}=v(bt),h=s({
|
|
586
|
+
disabled:n
|
|
587
|
+
}),g=s(!1),p=s(null),b=s(null),{disabled:m,updateMeasurementsFor:y,timeout:w}={
|
|
588
|
+
...Tt,...o},x=T(null!=y?y:r),D=ot({callback:d((()=>{
|
|
589
|
+
g.current?(null!=b.current&&clearTimeout(b.current),b.current=setTimeout((()=>{
|
|
590
|
+
f(Array.isArray(x.current)?x.current:[x.current]),b.current=null
|
|
591
|
+
}),w)):g.current=!0}),[w]),disabled:m||!a}),C=d(((e,t)=>{D&&(t&&(D.unobserve(t),
|
|
592
|
+
g.current=!1),e&&D.observe(e))}),[D]),[R,E]=A(C),S=T(t);return c((()=>{
|
|
593
|
+
D&&R.current&&(D.disconnect(),g.current=!1,D.observe(R.current))
|
|
594
|
+
}),[R,D]),N((()=>(l({type:_.RegisterDroppable,element:{id:r,key:i,disabled:n,
|
|
595
|
+
node:R,rect:p,data:S}}),()=>l({type:_.UnregisterDroppable,key:i,id:r
|
|
596
|
+
}))),[r]),c((()=>{n!==h.current.disabled&&(l({type:_.SetDroppableDisabled,id:r,
|
|
597
|
+
key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,l]),{active:a,rect:p,
|
|
598
|
+
isOver:(null==u?void 0:u.id)===r,node:R,over:u,setNodeRef:E}}({id:l,data:I,
|
|
599
|
+
disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...h}
|
|
600
|
+
}),{active:F,activatorEvent:j,activeNodeRect:X,attributes:K,setNodeRef:U,listeners:W,isDragging:H,over:q,setActivatorNodeRef:J,transform:V}=Nt({
|
|
601
|
+
id:l,data:I,attributes:{...Zt,...n},disabled:E.draggable}),Z=function(){
|
|
602
|
+
for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n]
|
|
603
|
+
;return a((()=>e=>{t.forEach((t=>t(e)))}),t)
|
|
604
|
+
}(z,U),G=Boolean(F),Q=G&&!w&&Ft(m)&&Ft(D),$=!C&&H,ee=$&&Q?V:null,te=Q?null!=ee?ee:(null!=f?f:R)({
|
|
605
|
+
rects:x,activeNodeRect:X,activeIndex:m,overIndex:D,index:S
|
|
606
|
+
}):null,ne=Ft(m)&&Ft(D)?i({id:l,items:p,activeIndex:m,overIndex:D
|
|
607
|
+
}):S,re=null==F?void 0:F.id,oe=s({activeId:re,items:p,newIndex:ne,containerId:b
|
|
608
|
+
}),ie=p!==oe.current.items,ae=t({active:F,containerId:b,isDragging:H,
|
|
609
|
+
isSorting:G,id:l,index:S,items:p,newIndex:oe.current.newIndex,
|
|
610
|
+
previousItems:oe.current.items,previousContainerId:oe.current.containerId,
|
|
611
|
+
transition:g,wasDragging:null!=oe.current.activeId}),le=function(e){
|
|
612
|
+
let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=u(null),l=s(n)
|
|
613
|
+
;return N((()=>{if(!t&&n!==l.current&&r.current){const e=o.current;if(e){
|
|
614
|
+
const t=ge(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,
|
|
615
|
+
scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}
|
|
616
|
+
n!==l.current&&(l.current=n)}),[t,n,r,o]),c((()=>{i&&a(null)}),[i]),i}({
|
|
617
|
+
disabled:!ae,index:S,node:k,rect:O});return c((()=>{
|
|
618
|
+
G&&oe.current.newIndex!==ne&&(oe.current.newIndex=ne),
|
|
619
|
+
b!==oe.current.containerId&&(oe.current.containerId=b),
|
|
620
|
+
p!==oe.current.items&&(oe.current.items=p)}),[G,ne,b,p]),c((()=>{
|
|
621
|
+
if(re===oe.current.activeId)return
|
|
622
|
+
;if(re&&!oe.current.activeId)return void(oe.current.activeId=re)
|
|
623
|
+
;const e=setTimeout((()=>{oe.current.activeId=re}),50);return()=>clearTimeout(e)
|
|
624
|
+
}),[re]),{active:F,activeIndex:m,attributes:K,data:I,rect:O,index:S,newIndex:ne,
|
|
625
|
+
items:p,isOver:L,isSorting:G,isDragging:H,listeners:W,node:k,overIndex:D,over:q,
|
|
626
|
+
setNodeRef:Z,setActivatorNodeRef:J,setDroppableNodeRef:z,setDraggableNodeRef:U,
|
|
627
|
+
transform:null!=le?le:te,transition:function(){
|
|
628
|
+
if(le||ie&&oe.current.newIndex===S)return Vt;if($&&!P(j)||!g)return
|
|
629
|
+
;if(G||ae)return Y.Transition.toString({...g,property:Jt});return}()}}
|
|
630
|
+
function _t(e){if(!e)return!1;const t=e.data.current
|
|
631
|
+
;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)
|
|
632
|
+
}const Qt=[Le.Down,Le.Right,Le.Up,Le.Left],$t=(e,t)=>{
|
|
633
|
+
let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t
|
|
634
|
+
;if(Qt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[]
|
|
635
|
+
;i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return
|
|
636
|
+
;const i=o.get(n.id);if(i)switch(e.code){case Le.Down:r.top<i.top&&t.push(n)
|
|
637
|
+
;break;case Le.Up:r.top>i.top&&t.push(n);break;case Le.Left:
|
|
638
|
+
r.left>i.left&&t.push(n);break;case Le.Right:r.left<i.left&&t.push(n)}}))
|
|
639
|
+
;const c=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e
|
|
640
|
+
;const o=oe(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){
|
|
641
|
+
const n=oe(r),a=o.reduce(((e,t,r)=>e+te(n[r],t)),0),l=Number((a/4).toFixed(4))
|
|
642
|
+
;i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(ne)})({
|
|
643
|
+
active:n,collisionRect:r,droppableRects:o,droppableContainers:t,
|
|
644
|
+
pointerCoordinates:null});let s=ie(c,"id")
|
|
645
|
+
;if(s===(null==a?void 0:a.id)&&c.length>1&&(s=c[1].id),null!=s){
|
|
646
|
+
const e=i.get(n.id),t=i.get(s),a=t?o.get(t.id):null,c=null==t?void 0:t.node.current
|
|
647
|
+
;if(c&&a&&e&&t){const n=pe(c).some(((e,t)=>l[t]!==e)),o=en(e,t),i=function(e,t){
|
|
648
|
+
if(!_t(e)||!_t(t))return!1;if(!en(e,t))return!1
|
|
649
|
+
;return e.data.current.sortable.index<t.data.current.sortable.index
|
|
650
|
+
}(e,t),s=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={
|
|
651
|
+
x:a.left,y:a.top};return s.x&&s.y?d:j(d,s)}}}};function en(e,t){
|
|
652
|
+
return!(!_t(e)||!_t(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId
|
|
653
|
+
}
|
|
654
|
+
var tn,nn,rn=e.div(tn||(tn=t(["\n direction: ",";\n"],["\n direction: ",";\n"])),(function(e){
|
|
655
|
+
return e.theme.direction
|
|
656
|
+
})),on=e.div(nn||(nn=t(["\n display: flex;\n align-items: center;\n border-radius: 4px;\n &:not(:last-child) {\n margin-bottom: 12px;\n }\n button.ItemDragger {\n margin: auto 4px;\n cursor: ",";\n }\n div.CustomItem {\n flex: 1;\n }\n opacity: ",";\n"],["\n display: flex;\n align-items: center;\n border-radius: 4px;\n &:not(:last-child) {\n margin-bottom: 12px;\n }\n button.ItemDragger {\n margin: auto 4px;\n cursor: ",";\n }\n div.CustomItem {\n flex: 1;\n }\n opacity: ",";\n"])),(function(e){
|
|
657
|
+
return e.disabled?"not-allowed":"grab"}),(function(e){return e.disabled?.5:1
|
|
658
|
+
})),an=i.forwardRef((function(e,t){var r,o,a,l,c,s
|
|
659
|
+
;return i.createElement("svg",n({width:"16",height:"16",viewBox:"0 0 16 16",
|
|
660
|
+
fill:"none",xmlns:"http://www.w3.org/2000/svg"},e,{ref:t
|
|
661
|
+
}),i.createElement("path",{
|
|
662
|
+
d:"M4.83981 4.47195C4.33683 4.47519 3.88173 4.17426 3.68775 3.71019C3.49378 3.24611 3.59936 2.71083 3.95502 2.35517C4.31068 1.9995 4.84597 1.89392 5.31004 2.0879C5.77412 2.28188 6.07504 2.73698 6.07181 3.23995C6.07181 3.92037 5.52022 4.47195 4.83981 4.47195Z",
|
|
663
|
+
fill:null!==(r=e.fill)&&void 0!==r?r:"currentcolor"}),i.createElement("path",{
|
|
664
|
+
d:"M11.2397 4.47195C10.7367 4.47519 10.2816 4.17426 10.0877 3.71019C9.89368 3.24611 9.99926 2.71083 10.3549 2.35517C10.7106 1.9995 11.2459 1.89392 11.7099 2.0879C12.174 2.28188 12.4749 2.73698 12.4717 3.23995C12.4717 3.92037 11.9201 4.47195 11.2397 4.47195Z",
|
|
665
|
+
fill:null!==(o=e.fill)&&void 0!==o?o:"currentcolor"}),i.createElement("path",{
|
|
666
|
+
d:"M4.83981 9.272C4.33683 9.27524 3.88173 8.97431 3.68775 8.51024C3.49378 8.04616 3.59936 7.51088 3.95502 7.15522C4.31068 6.79955 4.84597 6.69397 5.31004 6.88795C5.77412 7.08193 6.07504 7.53703 6.07181 8.04C6.07181 8.72042 5.52022 9.272 4.83981 9.272Z",
|
|
667
|
+
fill:null!==(a=e.fill)&&void 0!==a?a:"currentcolor"}),i.createElement("path",{
|
|
668
|
+
d:"M11.2397 9.272C10.7367 9.27524 10.2816 8.97431 10.0877 8.51024C9.89368 8.04616 9.99926 7.51088 10.3549 7.15522C10.7106 6.79955 11.2459 6.69397 11.7099 6.88795C12.174 7.08193 12.4749 7.53703 12.4717 8.04C12.4717 8.72042 11.9201 9.272 11.2397 9.272Z",
|
|
669
|
+
fill:null!==(l=e.fill)&&void 0!==l?l:"currentcolor"}),i.createElement("path",{
|
|
670
|
+
d:"M4.83981 14.0719C4.33683 14.0752 3.88173 13.7742 3.68775 13.3102C3.49378 12.8461 3.59936 12.3108 3.95502 11.9551C4.31068 11.5995 4.84597 11.4939 5.31004 11.6879C5.77412 11.8819 6.07504 12.337 6.07181 12.8399C6.07181 13.5203 5.52022 14.0719 4.83981 14.0719Z",
|
|
671
|
+
fill:null!==(c=e.fill)&&void 0!==c?c:"currentcolor"}),i.createElement("path",{
|
|
672
|
+
d:"M11.2397 14.0719C10.7367 14.0752 10.2816 13.7742 10.0877 13.3102C9.89368 12.8461 9.99926 12.3108 10.3549 11.9551C10.7106 11.5995 11.2459 11.4939 11.7099 11.6879C12.174 11.8819 12.4749 12.337 12.4717 12.8399C12.4717 13.5203 11.9201 14.0719 11.2397 14.0719Z",
|
|
673
|
+
fill:null!==(s=e.fill)&&void 0!==s?s:"currentcolor"}))})),ln=function(e){
|
|
674
|
+
var t=e.items,n=e.customRender,r=e.onReorder,l=e.customFilter,c=void 0===l?function(){
|
|
675
|
+
return!0
|
|
676
|
+
}:l,s=e.className,d=e.showDragger,u=void 0===d||d,f=e.disabled,h=void 0!==f&&f,g=i.useState([]),v=g[0],p=g[1],b=function(){
|
|
677
|
+
for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n]
|
|
678
|
+
;return a((()=>[...t].filter((e=>null!=e))),[...t])}($(Je),$(Ze),$(Pe,{
|
|
679
|
+
coordinateGetter:$t}));return i.useEffect((function(){
|
|
680
|
+
t&&Array.isArray(t)&&p(t.map((function(e){return{id:m(),data:e}})))
|
|
681
|
+
}),[t]),i.createElement(rn,{className:s||""},i.createElement(Rt,{sensors:b,
|
|
682
|
+
collisionDetection:le,onDragEnd:function(e){var n=e.active,i=e.over
|
|
683
|
+
;if(n.id!==(null==i?void 0:i.id)){var a=v.map((function(e){return e.id
|
|
684
|
+
})),l=a.indexOf(n.id.toString()),c=a.indexOf((null==i?void 0:i.id.toString())||""),s=Bt(v,l,c),d=Bt(t,l,c)
|
|
685
|
+
;p(s),r&&r(o([],d,!0))}},modifiers:[kt,Lt,At]},i.createElement(Ut,{items:v,
|
|
686
|
+
strategy:Xt},v.filter((function(e){return c(e.data)})).map((function(e,t){
|
|
687
|
+
return i.createElement(cn,{customRender:n,item:e.data,disabled:h,itemIndex:t,
|
|
688
|
+
showDragger:u,key:e.data.id.toString(),id:e.id})})))))},cn=function(e){
|
|
689
|
+
var t=r(),o=e.id,a=e.item,l=e.itemIndex,c=e.customRender,s=e.showDragger,d=e.disabled,u=e.key,f=Gt({
|
|
690
|
+
id:o
|
|
691
|
+
}),h=f.attributes,g=f.listeners,v=f.setNodeRef,p=f.transform,b=f.transition,m={
|
|
692
|
+
transform:Y.Translate.toString(p),transition:b};return i.createElement(on,n({
|
|
693
|
+
disabled:d,className:"ReorderItemContainer",ref:v,style:m},h,{key:u
|
|
694
|
+
}),s&&i.createElement(y,n({className:"ItemDragger",disabled:d
|
|
695
|
+
},d?{}:g),i.createElement(an,{fill:t.colors.text.primary
|
|
696
|
+
})),i.createElement("div",n({className:"CustomItem"},s?{}:g),c(a,l,g)))}
|
|
697
|
+
;export{ln as R};
|