@uva-glass/component-library 3.30.0 → 3.31.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/dist/{Lexical.prod-UwAbgYpF.js → Lexical.prod-B84LhBo3.js} +1196 -1224
- package/dist/Lexical.prod-B84LhBo3.js.map +1 -0
- package/dist/{LexicalClipboard.prod-DHIGjydG.js → LexicalClipboard.prod-DLgWWXys.js} +4 -4
- package/dist/{LexicalClipboard.prod-DHIGjydG.js.map → LexicalClipboard.prod-DLgWWXys.js.map} +1 -1
- package/dist/{LexicalLink.prod-Bsa9J7L-.js → LexicalLink.prod-DoU9RL94.js} +3 -3
- package/dist/{LexicalLink.prod-Bsa9J7L-.js.map → LexicalLink.prod-DoU9RL94.js.map} +1 -1
- package/dist/{LexicalList.prod-jxGuZd4b.js → LexicalList.prod-Cw2TK1jY.js} +4 -4
- package/dist/{LexicalList.prod-jxGuZd4b.js.map → LexicalList.prod-Cw2TK1jY.js.map} +1 -1
- package/dist/{LexicalSelection.prod-xk5MiZnZ.js → LexicalSelection.prod-TB5pn9xc.js} +2 -2
- package/dist/{LexicalSelection.prod-xk5MiZnZ.js.map → LexicalSelection.prod-TB5pn9xc.js.map} +1 -1
- package/dist/{LexicalTable.prod-BSjs04iE.js → LexicalTable.prod-9xjyWB0C.js} +4 -4
- package/dist/{LexicalTable.prod-BSjs04iE.js.map → LexicalTable.prod-9xjyWB0C.js.map} +1 -1
- package/dist/{LexicalUtils.prod-cQutjKA3.js → LexicalUtils.prod-CD3xGFhm.js} +2 -2
- package/dist/{LexicalUtils.prod-cQutjKA3.js.map → LexicalUtils.prod-CD3xGFhm.js.map} +1 -1
- package/dist/Sortable.module--kgnzOjW.js +26 -0
- package/dist/Sortable.module--kgnzOjW.js.map +1 -0
- package/dist/SortableProvider-C2T7b-pm.js +153 -0
- package/dist/SortableProvider-C2T7b-pm.js.map +1 -0
- package/dist/{TablePlugin-NmJsn2fm.js → TablePlugin-Dmy98Epb.js} +86 -91
- package/dist/{TablePlugin-NmJsn2fm.js.map → TablePlugin-Dmy98Epb.js.map} +1 -1
- package/dist/assets/Backdrop.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/ClipboardButton.css +1 -1
- package/dist/assets/ExpandableInfoPanel.css +1 -1
- package/dist/assets/FormInput.css +1 -1
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/InputField.css +1 -1
- package/dist/assets/LinkContextMenu.css +1 -1
- package/dist/assets/Notification.css +1 -1
- package/dist/assets/OverlayCloseButton.css +1 -1
- package/dist/assets/OverlayStepBar.css +1 -1
- package/dist/assets/PageOverlay.css +1 -1
- package/dist/assets/Sortable.css +1 -1
- package/dist/assets/VarIndicator.css +1 -1
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.stories.js +5 -5
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.js +58 -59
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +58 -59
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Chip/Chip.stories.js +5 -5
- package/dist/components/ControlsButton/ControlsButton.stories.js +5 -5
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/FormInput/FormInput.js +3 -3
- package/dist/components/FormInput/FormInput.stories.js +1 -1
- package/dist/components/HorizontalList/HorizontalList.js +7 -7
- package/dist/components/HorizontalList/HorizontalList.js.map +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.stories.js +10 -10
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/ModalDialog/ModalDialog.stories.js +8 -8
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +8 -8
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -3
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.js +66 -70
- package/dist/components/MultiSelectBox/MultiSelectBox.js.map +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
- package/dist/components/Notification/Notification.js +41 -41
- package/dist/components/Notification/Notification.stories.js +6 -6
- package/dist/components/Notification/Notification.test.js +2 -2
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +4 -4
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js +19 -20
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +33 -33
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +4 -4
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +3 -3
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js +3 -3
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +3 -3
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +51 -61
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +79 -89
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +19 -19
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +17 -18
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +31 -32
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +10 -10
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/components/SelectButton.js +31 -32
- package/dist/components/SelectListbox/components/SelectButton.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectOption.js +29 -30
- package/dist/components/SelectListbox/components/SelectOption.js.map +1 -1
- package/dist/components/Sortable/Sortable.d.ts +6 -1
- package/dist/components/Sortable/Sortable.js +23 -13
- package/dist/components/Sortable/Sortable.js.map +1 -1
- package/dist/components/Sortable/Sortable.stories.js +13 -12
- package/dist/components/Sortable/Sortable.stories.js.map +1 -1
- package/dist/components/Sortable/SortableProvider.d.ts +2 -1
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.d.ts +2 -1
- package/dist/components/Sortable/components/SortableContainer.js +2 -2
- package/dist/components/Sortable/components/SortableHandle.js +1 -1
- package/dist/components/Sortable/components/SortableItem.d.ts +3 -1
- package/dist/components/Sortable/components/SortableItem.js +48 -47
- package/dist/components/Sortable/components/SortableItem.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +3 -3
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/components/hooks/usePositionedFloaters.js +39 -39
- package/dist/components/hooks/usePositionedFloaters.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-DZIm3MiJ.js → helpers-CMG0anwr.js} +4 -4
- package/dist/{helpers-DZIm3MiJ.js.map → helpers-CMG0anwr.js.map} +1 -1
- package/dist/{index-DV47hRzi.js → index-Br0QepD6.js} +8 -10
- package/dist/{index-DV47hRzi.js.map → index-Br0QepD6.js.map} +1 -1
- package/dist/{index-Di9WPZUe.js → index-C2E9FY6V.js} +9149 -9854
- package/dist/index-C2E9FY6V.js.map +1 -0
- package/dist/{index-PaHiqSUg.js → index-Ds1dMTvJ.js} +29 -29
- package/dist/{index-PaHiqSUg.js.map → index-Ds1dMTvJ.js.map} +1 -1
- package/dist/{index-BVAvx58-.js → index-KJPw-7za.js} +2209 -2280
- package/dist/{index-BVAvx58-.js.map → index-KJPw-7za.js.map} +1 -1
- package/dist/{index-DllfJcv4.js → index-nrPtQ1dv.js} +2 -2
- package/dist/{index-DllfJcv4.js.map → index-nrPtQ1dv.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{react.esm-CFMwGdo5.js → react.esm-BKjCIfbB.js} +373 -374
- package/dist/{react.esm-CFMwGdo5.js.map → react.esm-BKjCIfbB.js.map} +1 -1
- package/dist/setupTests.js +6 -9
- package/dist/setupTests.js.map +1 -1
- package/dist/storybook__react.d.js +2056 -2072
- package/dist/storybook__react.d.js.map +1 -1
- package/package.json +16 -16
- package/dist/Lexical.prod-UwAbgYpF.js.map +0 -1
- package/dist/Sortable.module-CekPNg54.js +0 -23
- package/dist/Sortable.module-CekPNg54.js.map +0 -1
- package/dist/SortableProvider-CwX1lFMa.js +0 -152
- package/dist/SortableProvider-CwX1lFMa.js.map +0 -1
- package/dist/index-Di9WPZUe.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { af as f, d as a, V as i, ag as L, a7 as x, N as y, w as P, c as A, a4 as N, a9 as d, P as p, aa as S, a8 as j, p as I, ah as E, ai as M, aj as c, ak as R, al as T } from "./Lexical.prod-
|
|
1
|
+
import { af as f, d as a, V as i, ag as L, a7 as x, N as y, w as P, c as A, a4 as N, a9 as d, P as p, aa as S, a8 as j, p as I, ah as E, ai as M, aj as c, ak as R, al as T } from "./Lexical.prod-B84LhBo3.js";
|
|
2
2
|
function g(t, ...e) {
|
|
3
3
|
const n = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
|
|
4
4
|
r.append("code", t);
|
|
@@ -104,4 +104,4 @@ export {
|
|
|
104
104
|
k as w,
|
|
105
105
|
b as y
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=LexicalUtils.prod-
|
|
107
|
+
//# sourceMappingURL=LexicalUtils.prod-CD3xGFhm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalUtils.prod-cQutjKA3.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{isHTMLElement as t,$getSelection as e,$isRangeSelection as n,$isElementNode as o,getDOMTextNode as r,$getRoot as i,$getChildCaret as l,$getSiblingCaret as u,$getAdjacentChildCaret as s,$getChildCaretOrSelf as c,makeStepwiseIterator as f,$isChildCaret as a,$cloneWithProperties as d,$setSelection as g,$getPreviousSelection as p,$caretFromPoint as m,$createParagraphNode as h,$normalizeCaret as v,$setSelectionFromCaretRange as y,$getCollapsedCaretRange as w,$getCaretInDirection as x,$splitAtPointCaretNext as E,$isTextPointCaret as S,$isSiblingCaret as A,$rewindSiblingCaret as C,$getState as L,$setState as b}from\"lexical\";export{$splitNode,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode}from\"lexical\";import{createRectsFromDOMRange as N}from\"@lexical/selection\";function P(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&\"documentMode\"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!(\"InputEvent\"in window)||R)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),k=M&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&!O;function I(...t){const e=[];for(const n of t)if(n&&\"string\"==typeof n)for(const[t]of n.matchAll(/\\S+/g))e.push(t);return e}function j(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function F(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement(\"div\");function c(){null===r&&P(182),null===i&&P(183);const{left:t,top:l}=i.getBoundingClientRect(),c=N(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o}for(;u.length>c.length;)u.pop();d&&o(u)}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[]}s.style.position=\"relative\";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!t(u))return f();f(),r=o,i=u,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!s.contains(e.target))return c()})),l.observe(u,U),c()}));return()=>{a(),f()}}function V(t,e,n){if(\"text\"!==t.type&&o(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[r(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=e();if(!n(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const{anchor:d,focus:g}=a,p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return i.isBefore(n)?(u.setStart(...V(r,i,l)),u.setEnd(...V(e,n,o))):(u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l))),u}(t,d,p,x,g,v,E);f(),f=z(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0))}else o(t)}))}r=p,i=x,l=h,u=v,s=E,c=w}))}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f()}))}function G(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=W(t))};return document.addEventListener(\"selectionchange\",n),()=>{null!==e&&e(),document.removeEventListener(\"selectionchange\",n)}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n)}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n)}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener(\"error\",o),s.addEventListener(\"load\",(()=>{const t=s.result;\"string\"==typeof t&&r.push({file:u,result:t}),i()})),lt(u,e)?s.readAsDataURL(u):i()};i()}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function dt(t,e,n){const r=i(),d=e||r,g=o(d)?l(d,t):u(d,t),p=pt(d),m=n?s(c(u(n,t))):function(t,e){const n=$t(u(t,e));return n&&n[0]}(d,t);let h=p;return f({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;a(t)&&h++;const e=$t(t);return!e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t(u(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t(c(u(t,\"previous\")),\"root\");return e&&e[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=wt(t,(t=>o(t)&&!t.isInline()));return o(e)||P(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==i()&&null!=n;){if(e(n))return n;n=n.getParent()}return null};function xt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}}))}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,d(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;g(null===r?null:r.clone())}function St(t){const o=e()||p();let r;if(n(o))r=m(o.focus,\"next\");else{if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=u(e,\"next\"))}r=r||l(i(),\"previous\").getFlipped().insert(h())}const c=At(t,r),f=s(c),d=a(f)?v(f):c;return y(w(d)),t.getLatest()}function At(t,e,n){let o=x(e,\"next\");for(let t=o;t;t=E(t,n))o=t;return S(o)&&P(283),o.insert(t.isInline()?h().append(t):t),x(u(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function bt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function Nt(t,e){l(t,\"next\").insert(e)}let Pt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Pt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Pt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Pt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,o(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if(o(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht(l(t,\"next\"))}function Kt(t){return Ht(l(t,\"previous\"))}function Ht(t){return f({hasNext:A,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){C(u(t,\"next\")).splice(1,t.getChildren())}function $t(t,e=\"root\"){let n=0,o=t,r=s(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=s(o)}return r&&[r,n]}function Dt(t){const e=e=>L(e,t),n=(e,n)=>b(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,bt as $filter,wt as $findMatchingParent,kt as $firstToLastIterator,ct as $getAdjacentCaret,$t as $getAdjacentSiblingOrParentSiblingCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,Nt as $insertFirst,St as $insertNodeToNearestRoot,At as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,Kt as $lastToFirstIterator,Et as $restoreEditorState,ft as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,Ot as $unwrapNode,Ct as $wrapNodeInElement,q as CAN_USE_BEFORE_INPUT,J as CAN_USE_DOM,Q as IS_ANDROID,X as IS_ANDROID_CHROME,Y as IS_APPLE,Z as IS_APPLE_WEBKIT,tt as IS_CHROME,et as IS_FIREFOX,nt as IS_IOS,ot as IS_SAFARI,rt as addClassNamesToElement,Mt as calculateZoomLevel,lt as isMimeType,Dt as makeStateWrapper,W as markSelection,ut as mediaFileReader,j as mergeRegister,Lt as objectKlassEquals,z as positionNodeOnRange,xt as registerNestedElementResolver,it as removeClassNamesFromElement,G as selectionAlwaysOnDisplay};\n"],"names":["P","o","t","M","R","I","j","rt","it","vt","yt","wt","i","St","e","p","r","n","m","u","l","h","c","At","f","s","d","a","v","y","w","x","E","S","Lt","Nt","Tt","Bt","Kt","_t","Ht","A"],"mappings":";AAQsxB,SAASA,EAAE,MAAK,GA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AAC;AAAC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"LexicalUtils.prod-CD3xGFhm.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{isHTMLElement as t,$getSelection as e,$isRangeSelection as n,$isElementNode as o,getDOMTextNode as r,$getRoot as i,$getChildCaret as l,$getSiblingCaret as u,$getAdjacentChildCaret as s,$getChildCaretOrSelf as c,makeStepwiseIterator as f,$isChildCaret as a,$cloneWithProperties as d,$setSelection as g,$getPreviousSelection as p,$caretFromPoint as m,$createParagraphNode as h,$normalizeCaret as v,$setSelectionFromCaretRange as y,$getCollapsedCaretRange as w,$getCaretInDirection as x,$splitAtPointCaretNext as E,$isTextPointCaret as S,$isSiblingCaret as A,$rewindSiblingCaret as C,$getState as L,$setState as b}from\"lexical\";export{$splitNode,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode}from\"lexical\";import{createRectsFromDOMRange as N}from\"@lexical/selection\";function P(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&\"documentMode\"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!(\"InputEvent\"in window)||R)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),k=M&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&!O;function I(...t){const e=[];for(const n of t)if(n&&\"string\"==typeof n)for(const[t]of n.matchAll(/\\S+/g))e.push(t);return e}function j(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function F(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement(\"div\");function c(){null===r&&P(182),null===i&&P(183);const{left:t,top:l}=i.getBoundingClientRect(),c=N(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o}for(;u.length>c.length;)u.pop();d&&o(u)}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[]}s.style.position=\"relative\";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!t(u))return f();f(),r=o,i=u,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!s.contains(e.target))return c()})),l.observe(u,U),c()}));return()=>{a(),f()}}function V(t,e,n){if(\"text\"!==t.type&&o(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[r(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=e();if(!n(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const{anchor:d,focus:g}=a,p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return i.isBefore(n)?(u.setStart(...V(r,i,l)),u.setEnd(...V(e,n,o))):(u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l))),u}(t,d,p,x,g,v,E);f(),f=z(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0))}else o(t)}))}r=p,i=x,l=h,u=v,s=E,c=w}))}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f()}))}function G(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=W(t))};return document.addEventListener(\"selectionchange\",n),()=>{null!==e&&e(),document.removeEventListener(\"selectionchange\",n)}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n)}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n)}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener(\"error\",o),s.addEventListener(\"load\",(()=>{const t=s.result;\"string\"==typeof t&&r.push({file:u,result:t}),i()})),lt(u,e)?s.readAsDataURL(u):i()};i()}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function dt(t,e,n){const r=i(),d=e||r,g=o(d)?l(d,t):u(d,t),p=pt(d),m=n?s(c(u(n,t))):function(t,e){const n=$t(u(t,e));return n&&n[0]}(d,t);let h=p;return f({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;a(t)&&h++;const e=$t(t);return!e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t(u(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t(c(u(t,\"previous\")),\"root\");return e&&e[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=wt(t,(t=>o(t)&&!t.isInline()));return o(e)||P(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==i()&&null!=n;){if(e(n))return n;n=n.getParent()}return null};function xt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}}))}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,d(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;g(null===r?null:r.clone())}function St(t){const o=e()||p();let r;if(n(o))r=m(o.focus,\"next\");else{if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=u(e,\"next\"))}r=r||l(i(),\"previous\").getFlipped().insert(h())}const c=At(t,r),f=s(c),d=a(f)?v(f):c;return y(w(d)),t.getLatest()}function At(t,e,n){let o=x(e,\"next\");for(let t=o;t;t=E(t,n))o=t;return S(o)&&P(283),o.insert(t.isInline()?h().append(t):t),x(u(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function bt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function Nt(t,e){l(t,\"next\").insert(e)}let Pt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Pt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Pt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Pt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,o(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if(o(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht(l(t,\"next\"))}function Kt(t){return Ht(l(t,\"previous\"))}function Ht(t){return f({hasNext:A,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){C(u(t,\"next\")).splice(1,t.getChildren())}function $t(t,e=\"root\"){let n=0,o=t,r=s(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=s(o)}return r&&[r,n]}function Dt(t){const e=e=>L(e,t),n=(e,n)=>b(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,bt as $filter,wt as $findMatchingParent,kt as $firstToLastIterator,ct as $getAdjacentCaret,$t as $getAdjacentSiblingOrParentSiblingCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,Nt as $insertFirst,St as $insertNodeToNearestRoot,At as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,Kt as $lastToFirstIterator,Et as $restoreEditorState,ft as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,Ot as $unwrapNode,Ct as $wrapNodeInElement,q as CAN_USE_BEFORE_INPUT,J as CAN_USE_DOM,Q as IS_ANDROID,X as IS_ANDROID_CHROME,Y as IS_APPLE,Z as IS_APPLE_WEBKIT,tt as IS_CHROME,et as IS_FIREFOX,nt as IS_IOS,ot as IS_SAFARI,rt as addClassNamesToElement,Mt as calculateZoomLevel,lt as isMimeType,Dt as makeStateWrapper,W as markSelection,ut as mediaFileReader,j as mergeRegister,Lt as objectKlassEquals,z as positionNodeOnRange,xt as registerNestedElementResolver,it as removeClassNamesFromElement,G as selectionAlwaysOnDisplay};\n"],"names":["P","o","t","M","R","I","j","rt","it","vt","yt","wt","i","St","e","p","r","n","m","u","l","h","c","At","f","s","d","a","v","y","w","x","E","S","Lt","Nt","Tt","Bt","Kt","_t","Ht","A"],"mappings":";AAQsxB,SAASA,EAAE,MAAK,GAAE;AAAC,QAAM,IAAE,IAAI,IAAI,gCAAgC,GAAEC,IAAE,IAAI;AAAgB,EAAAA,EAAE,O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const _ = "_sortable__wrapper_v5kts_1", t = "_sortable__container_v5kts_13", e = "_sortable__handle_v5kts_160", s = {
|
|
2
|
+
sortable__wrapper: _,
|
|
3
|
+
"sortable__wrapper--scrollable": "_sortable__wrapper--scrollable_v5kts_5",
|
|
4
|
+
sortable__container: t,
|
|
5
|
+
"sortable__drop-target": "_sortable__drop-target_v5kts_25",
|
|
6
|
+
"sortable__drop-target--no-number": "_sortable__drop-target--no-number_v5kts_42",
|
|
7
|
+
"sortable__sort-item": "_sortable__sort-item_v5kts_60",
|
|
8
|
+
"sortable__sort-item--grey-200": "_sortable__sort-item--grey-200_v5kts_71",
|
|
9
|
+
"sortable__sort-item--white": "_sortable__sort-item--white_v5kts_75",
|
|
10
|
+
"sortable__sort-item--ghost": "_sortable__sort-item--ghost_v5kts_83",
|
|
11
|
+
"sortable__sort-item__handle": "_sortable__sort-item__handle_v5kts_94",
|
|
12
|
+
"sortable__sort-item__button-container": "_sortable__sort-item__button-container_v5kts_104",
|
|
13
|
+
"sortable__sort-item__handle--icon": "_sortable__sort-item__handle--icon_v5kts_123",
|
|
14
|
+
"sortable__sort-item__handle--up": "_sortable__sort-item__handle--up_v5kts_130",
|
|
15
|
+
"sortable__sort-item__handle--down": "_sortable__sort-item__handle--down_v5kts_131",
|
|
16
|
+
"sortable__sort-item--dragging": "_sortable__sort-item--dragging_v5kts_142",
|
|
17
|
+
"sortable__sort-item__contents": "_sortable__sort-item__contents_v5kts_146",
|
|
18
|
+
"sortable__sort-item__contents--handle-right": "_sortable__sort-item__contents--handle-right_v5kts_155",
|
|
19
|
+
sortable__handle: e,
|
|
20
|
+
"sortable__handle--right": "_sortable__handle--right_v5kts_166",
|
|
21
|
+
"sortable__visually-hidden": "_sortable__visually-hidden_v5kts_185"
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
s
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=Sortable.module--kgnzOjW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sortable.module--kgnzOjW.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as x, useEffect as N, cloneElement as O, createContext as A, useReducer as L, Children as E, useContext as j } from "react";
|
|
3
|
+
import { sortableReducer as q, initialState as B } from "./components/Sortable/sortableReducer.js";
|
|
4
|
+
import { c as _ } from "./clsx-OuTLNxxd.js";
|
|
5
|
+
import { s as c } from "./Sortable.module--kgnzOjW.js";
|
|
6
|
+
import { setDraggingTarget as H, setDraggingSource as X, setClone as Y, reset as k, moveToPosition as z, drop as F, dragStart as G, dragEnd as J, clearDraggingTarget as K, clearDraggingSource as M } from "./components/Sortable/actions.js";
|
|
7
|
+
function Q({ scrollable: i, hideNumbers: g, onSort: l }) {
|
|
8
|
+
const { clone: n, draggingTarget: p, drop: D, sortableItems: S, setDraggingTarget: o, reset: T, indices: a } = V(), d = x(null), s = x(null), u = x(a);
|
|
9
|
+
function m(r) {
|
|
10
|
+
const t = d.current;
|
|
11
|
+
if (!t?.hasChildNodes()) return;
|
|
12
|
+
const e = r.currentTarget;
|
|
13
|
+
return Array.from(t.childNodes).findIndex((v) => v.isEqualNode(e));
|
|
14
|
+
}
|
|
15
|
+
function C(r) {
|
|
16
|
+
const t = m(r);
|
|
17
|
+
t !== void 0 && (n && s.current && s.current.removeChild(n), D(t));
|
|
18
|
+
}
|
|
19
|
+
function $(r) {
|
|
20
|
+
if (r.preventDefault(), r.dataTransfer.dropEffect = "move", n) {
|
|
21
|
+
const { clientX: e, clientY: b } = r, { x: h, y: v, width: P, height: w } = r.currentTarget.getBoundingClientRect(), R = w / 2 - (b - v);
|
|
22
|
+
n.setAttribute(
|
|
23
|
+
"style",
|
|
24
|
+
`
|
|
25
|
+
left: ${e - (e - h)}px;
|
|
26
|
+
top: ${v - R}px;
|
|
27
|
+
height: ${w}px;
|
|
28
|
+
width: ${P}px;
|
|
29
|
+
visibility: visible;
|
|
30
|
+
`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const t = m(r);
|
|
34
|
+
t === void 0 || t === p || o(t);
|
|
35
|
+
}
|
|
36
|
+
function I(r) {
|
|
37
|
+
const { relatedTarget: t } = r;
|
|
38
|
+
t !== null && d.current?.contains(t) || (T(), n && n.setAttribute("style", "visibility: hidden;"));
|
|
39
|
+
}
|
|
40
|
+
return N(() => {
|
|
41
|
+
if (!(!n || !s.current))
|
|
42
|
+
return s.current.appendChild(n), function() {
|
|
43
|
+
n.remove();
|
|
44
|
+
};
|
|
45
|
+
}, [n]), N(() => {
|
|
46
|
+
l && a.valueOf() !== u.current.valueOf() && (l(a), u.current = a);
|
|
47
|
+
}, [a, u, l]), /* @__PURE__ */ f(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: _(c.sortable__wrapper, { [c["sortable__wrapper--scrollable"]]: i }),
|
|
51
|
+
ref: s,
|
|
52
|
+
children: /* @__PURE__ */ f(
|
|
53
|
+
"ul",
|
|
54
|
+
{
|
|
55
|
+
className: _(c.sortable__container, {
|
|
56
|
+
[c["sortable__container--drag-over"]]: n !== void 0
|
|
57
|
+
}),
|
|
58
|
+
onDragLeave: I,
|
|
59
|
+
ref: d,
|
|
60
|
+
role: "presentation",
|
|
61
|
+
children: S.map((r, t) => /* @__PURE__ */ f(
|
|
62
|
+
"li",
|
|
63
|
+
{
|
|
64
|
+
className: _(c["sortable__drop-target"], {
|
|
65
|
+
[c["sortable__drop-target--no-number"]]: g
|
|
66
|
+
}),
|
|
67
|
+
draggable: !1,
|
|
68
|
+
onDragOver: $,
|
|
69
|
+
onDrop: C,
|
|
70
|
+
role: "presentation",
|
|
71
|
+
children: O(r, { index: t })
|
|
72
|
+
},
|
|
73
|
+
t
|
|
74
|
+
))
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const y = A(void 0), U = (i) => ({
|
|
81
|
+
...B,
|
|
82
|
+
indices: E.map(i, ({ props: g }) => g.index),
|
|
83
|
+
maxIndex: E.count(i) - 1,
|
|
84
|
+
sortableItems: i
|
|
85
|
+
});
|
|
86
|
+
function oe({ children: i, items: g, scrollable: l, hideNumbers: n, onSort: p }) {
|
|
87
|
+
const D = x(g), [S, o] = L(q, i, U);
|
|
88
|
+
function T(e) {
|
|
89
|
+
o(X(e));
|
|
90
|
+
}
|
|
91
|
+
function a(e) {
|
|
92
|
+
o(H(e));
|
|
93
|
+
}
|
|
94
|
+
function d(e) {
|
|
95
|
+
o(z(e));
|
|
96
|
+
}
|
|
97
|
+
function s() {
|
|
98
|
+
o(K());
|
|
99
|
+
}
|
|
100
|
+
function u() {
|
|
101
|
+
o(M());
|
|
102
|
+
}
|
|
103
|
+
function m(e) {
|
|
104
|
+
o(F(e));
|
|
105
|
+
}
|
|
106
|
+
function C(e) {
|
|
107
|
+
o(G(e));
|
|
108
|
+
}
|
|
109
|
+
function $() {
|
|
110
|
+
o(J());
|
|
111
|
+
}
|
|
112
|
+
function I() {
|
|
113
|
+
o(k());
|
|
114
|
+
}
|
|
115
|
+
function r(e) {
|
|
116
|
+
o(Y(e));
|
|
117
|
+
}
|
|
118
|
+
function t(e) {
|
|
119
|
+
const b = e.map((h) => D.current[h]);
|
|
120
|
+
p && p(b);
|
|
121
|
+
}
|
|
122
|
+
return /* @__PURE__ */ f(
|
|
123
|
+
y.Provider,
|
|
124
|
+
{
|
|
125
|
+
value: {
|
|
126
|
+
...S,
|
|
127
|
+
clearDraggingSource: u,
|
|
128
|
+
clearDraggingTarget: s,
|
|
129
|
+
dragEnd: $,
|
|
130
|
+
dragStart: C,
|
|
131
|
+
drop: m,
|
|
132
|
+
moveToPosition: d,
|
|
133
|
+
reset: I,
|
|
134
|
+
setClone: r,
|
|
135
|
+
setDraggingSource: T,
|
|
136
|
+
setDraggingTarget: a
|
|
137
|
+
},
|
|
138
|
+
children: /* @__PURE__ */ f(Q, { scrollable: l, hideNumbers: n, onSort: t })
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
function V() {
|
|
143
|
+
const i = j(y);
|
|
144
|
+
if (i === void 0)
|
|
145
|
+
throw new Error("useSortable must be used within a SortableProvider");
|
|
146
|
+
return i;
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
oe as S,
|
|
150
|
+
Q as a,
|
|
151
|
+
V as u
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=SortableProvider-C2T7b-pm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortableProvider-C2T7b-pm.js","sources":["../src/components/Sortable/components/SortableContainer.tsx","../src/components/Sortable/SortableProvider.tsx"],"sourcesContent":["import { cloneElement, useEffect, useRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { DragEvent } from 'react';\n\nimport styles from 'components/Sortable/Sortable.module.css';\nimport { useSortable } from 'components/Sortable/SortableProvider';\n\nexport type OnSort = (indices: number[]) => void;\n\ninterface SortableContainerProps {\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: OnSort;\n}\n\nexport function SortableContainer({ scrollable, hideNumbers, onSort }: SortableContainerProps) {\n const { clone, draggingTarget, drop, sortableItems, setDraggingTarget, reset, indices } = useSortable();\n const containerRef = useRef<HTMLUListElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const indicesRef = useRef<number[]>(indices);\n\n function getTargetIndex(event: DragEvent<HTMLLIElement>) {\n const sortableContainer = containerRef.current;\n\n if (!sortableContainer?.hasChildNodes()) return;\n\n const listItemNode = event.currentTarget;\n const childNodes = Array.from(sortableContainer.childNodes);\n const targetIndex = childNodes.findIndex((node) => node.isEqualNode(listItemNode));\n\n return targetIndex;\n }\n\n function handleDrop(event: DragEvent<HTMLLIElement>) {\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined) return;\n\n if (clone && wrapperRef.current) wrapperRef.current.removeChild(clone);\n\n drop(targetIndex);\n }\n\n function handleDragOver(event: DragEvent<HTMLLIElement>) {\n // Prevent default to allow drop\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n\n if (clone) {\n const { clientX, clientY } = event;\n const { x, y, width, height } = event.currentTarget.getBoundingClientRect();\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const grabPosition = height / 2 - (clientY - y);\n\n // lock drag image movement to x-axis and mouse pointer\n clone.setAttribute(\n 'style',\n `\n left: ${clientX - (clientX - x)}px;\n top: ${y - grabPosition}px;\n height: ${height}px;\n width: ${width}px;\n visibility: visible;\n `\n );\n }\n\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined || targetIndex === draggingTarget) return;\n\n setDraggingTarget(targetIndex);\n }\n\n function handleContainerDragLeave(event: DragEvent<HTMLUListElement>) {\n const { relatedTarget } = event;\n\n const within = relatedTarget !== null && containerRef.current?.contains(relatedTarget as Node);\n\n if (!within) {\n reset();\n\n if (clone) {\n clone.setAttribute('style', 'visibility: hidden;');\n }\n }\n }\n\n useEffect(() => {\n if (!clone || !wrapperRef.current) return;\n\n wrapperRef.current.appendChild(clone);\n\n return function () {\n clone.remove();\n };\n }, [clone]);\n\n useEffect(() => {\n if (!onSort) return;\n\n if (indices.valueOf() !== indicesRef.current.valueOf()) {\n onSort(indices);\n\n indicesRef.current = indices;\n }\n }, [indices, indicesRef, onSort]);\n\n return (\n <div\n className={clsx(styles['sortable__wrapper'], { [styles['sortable__wrapper--scrollable']]: scrollable })}\n ref={wrapperRef}\n >\n <ul\n className={clsx(styles['sortable__container'], {\n [styles['sortable__container--drag-over']]: clone !== undefined,\n })}\n onDragLeave={handleContainerDragLeave}\n ref={containerRef}\n role=\"presentation\"\n >\n {sortableItems.map((child, index) => (\n <li\n className={clsx(styles['sortable__drop-target'], {\n [styles['sortable__drop-target--no-number']]: hideNumbers,\n })}\n draggable={false}\n key={index}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n role=\"presentation\"\n >\n {cloneElement(child, { index })}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","import { Children, createContext, useContext, useReducer, useRef } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableStateType } from './sortableReducer';\n\nimport { sortableReducer, initialState } from './sortableReducer';\nimport { SortableContainer } from './components/SortableContainer';\nimport * as actions from './actions';\n\ntype SortableContextType = {\n clearDraggingSource: () => void;\n clearDraggingTarget: () => void;\n dragEnd: () => void;\n dragStart: (index: number) => void;\n drop: (index: number) => void;\n moveToPosition: (index: number) => void;\n reset: () => void;\n setClone: (node: Element) => void;\n setDraggingSource: (index: number) => void;\n setDraggingTarget: (index: number) => void;\n};\n\nconst SortableContext = createContext<(SortableContextType & SortableStateType) | undefined>(undefined);\n\ninterface Props {\n children: SortableStateType['sortableItems'];\n items: ReactElement[] | string[];\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: (items: (string | ReactElement)[]) => void;\n}\n\nconst init = (children: Props['children']): SortableStateType => ({\n ...initialState,\n indices: Children.map(children, ({ props }) => props.index),\n maxIndex: Children.count(children) - 1,\n sortableItems: children,\n});\n\nexport function SortableProvider({ children, items, scrollable, hideNumbers, onSort }: Props) {\n const persistentItems = useRef(items);\n\n const [state, dispatch] = useReducer(sortableReducer, children, init);\n\n function setDraggingSource(index: number) {\n dispatch(actions.setDraggingSource(index));\n }\n\n function setDraggingTarget(index: number) {\n dispatch(actions.setDraggingTarget(index));\n }\n\n function moveToPosition(index: number) {\n dispatch(actions.moveToPosition(index));\n }\n\n function clearDraggingTarget() {\n dispatch(actions.clearDraggingTarget());\n }\n\n function clearDraggingSource() {\n dispatch(actions.clearDraggingSource());\n }\n\n function drop(index: number) {\n dispatch(actions.drop(index));\n }\n\n function dragStart(index: number) {\n dispatch(actions.dragStart(index));\n }\n\n function dragEnd() {\n dispatch(actions.dragEnd());\n }\n\n function reset() {\n dispatch(actions.reset());\n }\n\n function setClone(node: Element) {\n dispatch(actions.setClone(node));\n }\n\n function onHandleSort(sortedIndices: number[]) {\n const sortedItems = sortedIndices.map((index) => persistentItems.current[index]);\n onSort && onSort(sortedItems);\n }\n\n return (\n <SortableContext.Provider\n value={{\n ...state,\n clearDraggingSource,\n clearDraggingTarget,\n dragEnd,\n dragStart,\n drop,\n moveToPosition,\n reset,\n setClone,\n setDraggingSource,\n setDraggingTarget,\n }}\n >\n <SortableContainer scrollable={scrollable} hideNumbers={hideNumbers} onSort={onHandleSort} />\n </SortableContext.Provider>\n );\n}\n\nexport function useSortable() {\n const context = useContext(SortableContext);\n\n if (context === undefined) {\n throw new Error('useSortable must be used within a SortableProvider');\n }\n\n return context;\n}\n"],"names":["SortableContainer","scrollable","hideNumbers","onSort","clone","draggingTarget","drop","sortableItems","setDraggingTarget","reset","indices","useSortable","containerRef","useRef","wrapperRef","indicesRef","getTargetIndex","event","sortableContainer","listItemNode","node","handleDrop","targetIndex","handleDragOver","clientX","clientY","x","y","width","height","grabPosition","handleContainerDragLeave","relatedTarget","useEffect","jsx","clsx","styles","child","index","cloneElement","SortableContext","createContext","init","children","initialState","Children","props","SortableProvider","items","persistentItems","state","dispatch","useReducer","sortableReducer","setDraggingSource","actions.setDraggingSource","actions.setDraggingTarget","moveToPosition","actions.moveToPosition","clearDraggingTarget","actions.clearDraggingTarget","clearDraggingSource","actions.clearDraggingSource","actions.drop","dragStart","actions.dragStart","dragEnd","actions.dragEnd","actions.reset","setClone","actions.setClone","onHandleSort","sortedIndices","sortedItems","context","useContext"],"mappings":";;;;;;AAgBO,SAASA,EAAkB,EAAE,YAAAC,GAAY,aAAAC,GAAa,QAAAC,KAAkC;AAC7F,QAAM,EAAE,OAAAC,GAAO,gBAAAC,GAAgB,MAAAC,GAAM,eAAAC,GAAe,mBAAAC,GAAmB,OAAAC,GAAO,SAAAC,EAAA,IAAYC,EAAA,GACpFC,IAAeC,EAAyB,IAAI,GAC5CC,IAAaD,EAAuB,IAAI,GACxCE,IAAaF,EAAiBH,CAAO;AAE3C,WAASM,EAA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