@uva-glass/component-library 3.31.0 → 3.32.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/SortableProvider-DisCfTTN.js +160 -0
- package/dist/SortableProvider-DisCfTTN.js.map +1 -0
- package/dist/{TablePlugin-Dmy98Epb.js → TablePlugin-oF-gInNx.js} +2 -2
- package/dist/{TablePlugin-Dmy98Epb.js.map → TablePlugin-oF-gInNx.js.map} +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/FormInput/FormInput.js +2 -2
- package/dist/components/InputField/InputField.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +2 -2
- package/dist/components/Sortable/Sortable.d.ts +5 -3
- package/dist/components/Sortable/Sortable.js +36 -31
- package/dist/components/Sortable/Sortable.js.map +1 -1
- package/dist/components/Sortable/Sortable.stories.d.ts +3 -3
- package/dist/components/Sortable/Sortable.stories.js +19 -12
- package/dist/components/Sortable/Sortable.stories.js.map +1 -1
- package/dist/components/Sortable/SortableProvider.d.ts +9 -6
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/SortableProvider-C2T7b-pm.js +0 -153
- package/dist/SortableProvider-C2T7b-pm.js.map +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as x, useEffect as E, cloneElement as P, createContext as O, useReducer as A, useContext as L } from "react";
|
|
3
|
+
import { sortableReducer as j, initialState as q } from "./components/Sortable/sortableReducer.js";
|
|
4
|
+
import { c as _ } from "./clsx-OuTLNxxd.js";
|
|
5
|
+
import { s as g } from "./Sortable.module--kgnzOjW.js";
|
|
6
|
+
import { setDraggingTarget as B, setDraggingSource as H, setClone as W, reset as X, moveToPosition as Y, drop as k, dragStart as z, dragEnd as F, clearDraggingTarget as G, clearDraggingSource as J } from "./components/Sortable/actions.js";
|
|
7
|
+
function K({ scrollable: i, hideNumbers: a, onSort: s }) {
|
|
8
|
+
const { clone: n, draggingTarget: p, drop: D, sortableItems: S, setDraggingTarget: o, reset: T, indices: c } = U(), d = x(null), l = x(null), u = x(c);
|
|
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 && l.current && l.current.removeChild(n), D(t));
|
|
18
|
+
}
|
|
19
|
+
function $(r) {
|
|
20
|
+
if (r.preventDefault(), r.dataTransfer.dropEffect = "move", n) {
|
|
21
|
+
const { clientX: e, clientY: h } = r, { x: b, y: v, width: y, height: w } = r.currentTarget.getBoundingClientRect(), R = w / 2 - (h - v);
|
|
22
|
+
n.setAttribute(
|
|
23
|
+
"style",
|
|
24
|
+
`
|
|
25
|
+
left: ${e - (e - b)}px;
|
|
26
|
+
top: ${v - R}px;
|
|
27
|
+
height: ${w}px;
|
|
28
|
+
width: ${y}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 E(() => {
|
|
41
|
+
if (!(!n || !l.current))
|
|
42
|
+
return l.current.appendChild(n), function() {
|
|
43
|
+
n.remove();
|
|
44
|
+
};
|
|
45
|
+
}, [n]), E(() => {
|
|
46
|
+
s && c.valueOf() !== u.current.valueOf() && (s(c), u.current = c);
|
|
47
|
+
}, [c, u, s]), /* @__PURE__ */ f(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: _(g.sortable__wrapper, { [g["sortable__wrapper--scrollable"]]: i }),
|
|
51
|
+
ref: l,
|
|
52
|
+
children: /* @__PURE__ */ f(
|
|
53
|
+
"ul",
|
|
54
|
+
{
|
|
55
|
+
className: _(g.sortable__container, {
|
|
56
|
+
[g["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: _(g["sortable__drop-target"], {
|
|
65
|
+
[g["sortable__drop-target--no-number"]]: a
|
|
66
|
+
}),
|
|
67
|
+
draggable: !1,
|
|
68
|
+
onDragOver: $,
|
|
69
|
+
onDrop: C,
|
|
70
|
+
role: "presentation",
|
|
71
|
+
children: P(r, { index: t })
|
|
72
|
+
},
|
|
73
|
+
t
|
|
74
|
+
))
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const N = O(void 0);
|
|
81
|
+
function M(i) {
|
|
82
|
+
return typeof i != "string";
|
|
83
|
+
}
|
|
84
|
+
const Q = (i) => {
|
|
85
|
+
const a = i.filter(M);
|
|
86
|
+
return {
|
|
87
|
+
...q,
|
|
88
|
+
indices: a.map(({ props: s }) => s.index),
|
|
89
|
+
maxIndex: a.length - 1,
|
|
90
|
+
sortableItems: a
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
function oe({ renderItems: i, dataItems: a, scrollable: s, hideNumbers: n, onSort: p }) {
|
|
94
|
+
const D = x(a), [S, o] = A(j, i, Q);
|
|
95
|
+
function T(e) {
|
|
96
|
+
o(H(e));
|
|
97
|
+
}
|
|
98
|
+
function c(e) {
|
|
99
|
+
o(B(e));
|
|
100
|
+
}
|
|
101
|
+
function d(e) {
|
|
102
|
+
o(Y(e));
|
|
103
|
+
}
|
|
104
|
+
function l() {
|
|
105
|
+
o(G());
|
|
106
|
+
}
|
|
107
|
+
function u() {
|
|
108
|
+
o(J());
|
|
109
|
+
}
|
|
110
|
+
function m(e) {
|
|
111
|
+
o(k(e));
|
|
112
|
+
}
|
|
113
|
+
function C(e) {
|
|
114
|
+
o(z(e));
|
|
115
|
+
}
|
|
116
|
+
function $() {
|
|
117
|
+
o(F());
|
|
118
|
+
}
|
|
119
|
+
function I() {
|
|
120
|
+
o(X());
|
|
121
|
+
}
|
|
122
|
+
function r(e) {
|
|
123
|
+
o(W(e));
|
|
124
|
+
}
|
|
125
|
+
function t(e) {
|
|
126
|
+
const h = e.map((b) => D.current[b]);
|
|
127
|
+
p && p(h);
|
|
128
|
+
}
|
|
129
|
+
return /* @__PURE__ */ f(
|
|
130
|
+
N.Provider,
|
|
131
|
+
{
|
|
132
|
+
value: {
|
|
133
|
+
...S,
|
|
134
|
+
clearDraggingSource: u,
|
|
135
|
+
clearDraggingTarget: l,
|
|
136
|
+
dragEnd: $,
|
|
137
|
+
dragStart: C,
|
|
138
|
+
drop: m,
|
|
139
|
+
moveToPosition: d,
|
|
140
|
+
reset: I,
|
|
141
|
+
setClone: r,
|
|
142
|
+
setDraggingSource: T,
|
|
143
|
+
setDraggingTarget: c
|
|
144
|
+
},
|
|
145
|
+
children: /* @__PURE__ */ f(K, { scrollable: s, hideNumbers: n, onSort: t })
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
function U() {
|
|
150
|
+
const i = L(N);
|
|
151
|
+
if (i === void 0)
|
|
152
|
+
throw new Error("useSortable must be used within a SortableProvider");
|
|
153
|
+
return i;
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
oe as S,
|
|
157
|
+
K as a,
|
|
158
|
+
U as u
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=SortableProvider-DisCfTTN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortableProvider-DisCfTTN.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 { createContext, useContext, useReducer, useRef } from 'react';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport type { SortableStateType } from './sortableReducer';\nimport type { SortableItem, SortableItemProps } from './components/SortableItem';\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\ntype SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];\n\ninterface Props<T = unknown> {\n renderItems: SortableItems;\n dataItems: T[];\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: (items: T[]) => void;\n children?: ReactNode;\n}\n\nfunction isReactElementWithIndex(value: string | ReactElement): value is ReactElement<{ index: number }> {\n return typeof value !== 'string';\n}\n\nconst init = (renderItems: SortableItems): SortableStateType => {\n const reactChildren = renderItems.filter(isReactElementWithIndex);\n\n return {\n ...initialState,\n indices: reactChildren.map(({ props }) => props.index),\n maxIndex: reactChildren.length - 1,\n sortableItems: reactChildren,\n };\n};\n\nexport function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>) {\n const persistentItems = useRef(dataItems);\n\n const [state, dispatch] = useReducer(sortableReducer, renderItems, 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 sortedData = sortedIndices.map((index) => persistentItems.current[index]);\n onSort && onSort(sortedData);\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","isReactElementWithIndex","value","init","renderItems","reactChildren","initialState","props","SortableProvider","dataItems","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","sortedData","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,EAAeC,GAAiC;AACvD,UAAMC,IAAoBN,EAAa;AAEvC,QAAI,CAACM,GAAmB,gBAAiB;AAEzC,UAAMC,IAAeF,EAAM;AAI3B,WAHmB,MAAM,KAAKC,EAAkB,UAAU,EAC3B,UAAU,CAACE,MAASA,EAAK,YAAYD,CAAY,CAAC;AAAA,EAE1E;AAGT,WAASE,EAAWJ,GAAiC;AACnD,UAAMK,IAAcN,EAAeC,CAAK;AAExC,IAAIK,MAAgB,WAEhBlB,KAASU,EAAW,WAASA,EAAW,QAAQ,YAAYV,CAAK,GAErEE,EAAKgB,CAAW;AAAA,EAAA;AAGlB,WAASC,EAAeN,GAAiC;AAKvD,QAHAA,EAAM,eAAA,GACNA,EAAM,aAAa,aAAa,QAE5Bb,GAAO;AACT,YAAM,EAAE,SAAAoB,GAAS,SAAAC,EAAA,IAAYR,GACvB,EAAE,GAAAS,GAAG,GAAAC,GAAG,OAAAC,GAAO,QAAAC,MAAWZ,E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,7 +34,7 @@ import "./index-nrPtQ1dv.js";
|
|
|
34
34
|
import "./components/SelectListbox/SelectListbox.js";
|
|
35
35
|
import "./components/SelectListbox/SelectProvider.js";
|
|
36
36
|
import "./components/Sortable/components/SortableItem.js";
|
|
37
|
-
import "./SortableProvider-
|
|
37
|
+
import "./SortableProvider-DisCfTTN.js";
|
|
38
38
|
import { setScrollableContainers as _e, removeScrollableContainers as ke } from "./components/RteEditor/helpers.js";
|
|
39
39
|
import './assets/TablePlugin.css';function he({ label: b, clearTrigger: d, onClear: a }) {
|
|
40
40
|
return /* @__PURE__ */ m("header", { className: L["multi-select__header"], children: [
|
|
@@ -297,4 +297,4 @@ export {
|
|
|
297
297
|
he as a,
|
|
298
298
|
ye as b
|
|
299
299
|
};
|
|
300
|
-
//# sourceMappingURL=TablePlugin-
|
|
300
|
+
//# sourceMappingURL=TablePlugin-oF-gInNx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePlugin-Dmy98Epb.js","sources":["../src/components/MultiSelect/components/MultiSelectHeader.tsx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.tsx","../src/components/RteEditor/Plugins/TablePlugin/AddTableFrom.tsx","../src/components/RteEditor/Plugins/TablePlugin/TablePlugin.tsx"],"sourcesContent":["import styles from 'components/MultiSelect/MultiSelect.module.css';\nimport { Label } from 'components/Label';\nimport { Button } from 'components';\n\nexport interface MultiSelectHeaderProps {\n label: string;\n clearTrigger?: string;\n onClear?: () => void;\n}\n\nexport function MultiSelectHeader({ label, clearTrigger, onClear }: MultiSelectHeaderProps) {\n return (\n <header className={styles['multi-select__header']}>\n <Label htmlFor=\"multi-select-list\">{label}</Label>\n {clearTrigger && (\n <Button variant={'blank'} onClick={onClear}>\n {clearTrigger}\n </Button>\n )}\n </header>\n );\n}\n","import { clsx } from 'clsx';\n\nimport type { PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './MultiSelect.module.css';\n\nimport { MultiSelectItem } from 'components/MultiSelect/components/MultiSelectItem';\nimport { MultiSelectHeader } from 'components/MultiSelect/components/MultiSelectHeader';\n\nexport interface MultiSelectProps {\n /** `true` if the container should scroll on overflow; otherwise, `false` to resize the container to its contents. The default is `true`. */\n scrollable?: boolean;\n /** `true` to disable the border around the container; otherwise, `false`. The default is `false`. */\n noBorder?: boolean;\n /** The header contents. */\n header?: ReactNode;\n}\n\n/** Represents a component to list a number of checkboxes. */\nexport const MultiSelect = ({ scrollable = true, noBorder, header, children }: PropsWithChildren<MultiSelectProps>) => (\n <>\n {header}\n <div\n className={clsx(styles['multi-select'], {\n [styles['multi-select--no-border']]: noBorder,\n })}\n >\n <ul\n className={clsx(styles['multi-select__list'], {\n [styles['multi-select__list--scrollable']]: scrollable,\n })}\n id=\"multi-select-list\"\n >\n {children}\n </ul>\n </div>\n </>\n);\n\nMultiSelect.MultiSelectHeader = MultiSelectHeader;\nMultiSelect.MultiSelectItem = MultiSelectItem;\n","import { useState, forwardRef, useImperativeHandle, useRef, useId } from 'react';\n\nimport type { ChangeEvent, JSX } from 'react';\nimport type { LinkType } from 'components/RteEditor/Plugins/LinkPlugin';\n\nimport styles from './AddLinkForm.module.css';\n\nimport { ensureHttps, validateUrlWithProtocol } from 'components/RteEditor/Plugins/LinkPlugin/helpers';\nimport { Button, FeedbackBox, FormField, Icon, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ninterface AddLinkFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (url: string, linktext: string) => void;\n isLink: LinkType;\n}\n\nexport interface addLinkFormMethods {\n clearForm: () => void;\n focusFirstField: () => void;\n setDefaults: (url: string, linktext: string) => void;\n}\n\nexport const AddLinkForm = forwardRef(\n (\n { onCloseHandler, onSaveHandler, isLink = { active: false, url: '', linktext: '' } }: AddLinkFormProps,\n ref\n ): JSX.Element => {\n const t = useTranslation();\n const [url, setUrl] = useState<string>(isLink.url || '');\n const [linkText, setLinkText] = useState<string>(isLink.linktext || '');\n const [showLinktextField, setShowLinktextField] = useState<boolean>(false);\n const [urlError, setUrlError] = useState<string | null>(null);\n const [linkTextError, setLinkTextError] = useState<string | null>(null);\n const firstField = useRef<HTMLInputElement>(null);\n const linkId = `link_${useId()}`;\n const textId = `text_${useId()}`;\n\n const handleOpenUrl = () => {\n window.open(ensureHttps(url), '_blank');\n };\n\n const handleUrl = (event: ChangeEvent<HTMLInputElement>) => {\n setUrl(event.target.value);\n };\n\n const handleLinkText = (event: ChangeEvent<HTMLInputElement>) => {\n setLinkText(event.target.value);\n };\n\n const validateUrl = (url: string): boolean => {\n if (validateUrlWithProtocol(url) === false || url.trim() === '') {\n setUrlError(t.errortext.urlNotValid);\n return false;\n }\n setUrlError(null);\n return true;\n };\n\n const validateLinkText = (linkText: string): boolean => {\n if (linkText.trim() === '') {\n setLinkTextError(t.errortext.linkTextNotValid);\n return false;\n }\n setLinkTextError(null);\n return true;\n };\n\n const handleSave = () => {\n if (!validateUrl(url) || (showLinktextField && !validateLinkText(linkText))) {\n return;\n }\n\n onSaveHandler(url, linkText);\n resetForm();\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setUrl('');\n setShowLinktextField(false);\n setUrlError(null);\n setLinkTextError(null);\n };\n\n const setDefaults = (url: string, linktext: string) => {\n setUrl(url);\n if (!linktext && !url) {\n setShowLinktextField(true);\n }\n };\n\n const focusFirstField = () => {\n if (firstField.current) {\n firstField.current.focus();\n }\n };\n\n useImperativeHandle(ref, () => ({\n clearForm: resetForm,\n focusFirstField,\n setDefaults,\n }));\n\n return (\n <div className={styles['linkform']}>\n <FormField className={styles['linkform__input-field']}>\n <Label htmlFor={linkId}>{t.links.linkLabel}</Label>\n <div className={styles['linkform__input-url-wrapper']}>\n <InputField\n id={linkId}\n placeholder={t.links.linkPlaceholder}\n value={url}\n onChange={(event) => handleUrl(event)}\n onFocus={() => setUrlError(null)}\n ref={firstField}\n aria-label={t.aria.labels.linkField}\n />\n {url && (\n <button type=\"button\" onClick={handleOpenUrl} className={styles['linkform__open-url-button']}>\n <Icon name=\"ArrowTopRightOnSquare\" size={20} />\n </button>\n )}\n </div>\n {urlError && <FeedbackBox level=\"error\" feedback={urlError} />}\n </FormField>\n {showLinktextField && (\n <FormField className={styles['linkform__input-field']}>\n <Label htmlFor={textId}>{t.links.linkText}</Label>\n <InputField\n id={textId}\n value={linkText}\n onChange={(event) => handleLinkText(event)}\n onFocus={() => setLinkTextError(null)}\n aria-label={t.aria.labels.linkTextfield}\n />\n {linkTextError && <FeedbackBox level=\"error\" feedback={linkTextError} />}\n </FormField>\n )}\n <div className={styles['linkform__footer']}>\n <Button variant={'secondary'} onClick={handleClose} aria-label={t.common.cancel} type=\"button\">\n {t.common.cancel}\n </Button>\n <Button variant={'primary'} onClick={handleSave} aria-label={t.aria.labels.linkOkButton} type=\"button\">\n {t.links.addLink}\n </Button>\n </div>\n </div>\n );\n }\n);\n","import { useState, forwardRef, useImperativeHandle, useRef, useId, useEffect } from 'react';\n\nimport type { ChangeEvent } from 'react';\n\nimport styles from './AddTableFrom.module.css';\n\nimport { Button, FormField, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\nimport { removeScrollableContainers, setScrollableContainers } from 'components/RteEditor/helpers';\n\ninterface AddTableFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (nrfOfRows: number, nrOfColumns: number) => void;\n}\n\nexport interface addTableForm {\n clearForm: () => void;\n focusFirstField: () => void;\n}\n\nexport const AddTableForm = forwardRef(({ onCloseHandler, onSaveHandler }: AddTableFormProps, ref) => {\n const t = useTranslation();\n const [rowCount, setRowCount] = useState<number>();\n const [columnCount, setColumnCount] = useState<number>();\n const firstField = useRef<HTMLInputElement>(null);\n const rowId = `row_${useId()}`;\n const columnId = `column_${useId()}`;\n\n const handleDimentionChange = (event: ChangeEvent<HTMLInputElement>, type: string) => {\n const value = event.target.value;\n type === 'row' ? setRowCount(parseInt(value)) : setColumnCount(parseInt(value));\n };\n\n const handleSave = () => {\n if (rowCount !== undefined && columnCount !== undefined) {\n onSaveHandler(rowCount, columnCount);\n resetForm();\n }\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setRowCount(undefined);\n setColumnCount(undefined);\n };\n\n useImperativeHandle(ref, () => ({\n clearForm: resetForm,\n focusFirstField: () => firstField.current?.focus(),\n }));\n\n useEffect(() => {\n const handleResizeScroll = () => {\n handleClose();\n };\n\n setScrollableContainers(handleResizeScroll);\n\n window.addEventListener('scroll', handleResizeScroll);\n window.addEventListener('resize', handleResizeScroll);\n\n return () => {\n window.removeEventListener('scroll', handleResizeScroll);\n window.removeEventListener('resize', handleResizeScroll);\n removeScrollableContainers(handleResizeScroll);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <div className={styles['tableform']}>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor={rowId}>{t.table.nrofRows}</Label>\n <InputField\n id={rowId}\n placeholder={t.table.nrofRowsPlaceholder}\n value={rowCount ? rowCount : ''}\n onChange={(event) => handleDimentionChange(event, 'row')}\n aria-label={t.aria.labels.tableRowfield}\n ref={firstField}\n />\n </FormField>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor={columnId}>{t.table.nrofColumns}</Label>\n <InputField\n id={columnId}\n placeholder={t.table.nrofColumnsPlaceholder}\n value={columnCount ? columnCount : ''}\n onChange={(event) => handleDimentionChange(event, 'column')}\n aria-label={t.aria.labels.tableColumnfield}\n />\n </FormField>\n <div className={styles['tableform__footer']}>\n <Button variant={'secondary'} onClick={handleClose} aria-label={t.common.cancel}>\n {t.common.cancel}\n </Button>\n <Button\n variant={'primary'}\n onClick={handleSave}\n disabled={!rowCount || !columnCount}\n aria-label={t.aria.labels.tableOkButton}\n >\n {t.common.add}\n </Button>\n </div>\n </div>\n );\n});\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { clsx } from 'clsx';\nimport { $getTableCellNodeFromLexicalNode, $isTableCellNode } from '@lexical/table';\nimport { $getSelection, $isRangeSelection, $getRoot, KEY_DOWN_COMMAND, COMMAND_PRIORITY_EDITOR } from 'lexical';\nimport { useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\n\nimport type { JSX } from 'react';\nimport type { TextNode } from 'lexical';\nimport type { addTableForm } from './AddTableFrom';\nimport type { Actions } from './TableCellContextMenu';\n\nimport { AddTableForm } from './AddTableFrom';\nimport { createTable, deleteColumn, deleteRow, deleteTable, insertColumn, insertRow } from './helpers';\n\nimport { useFlyout } from 'components/RteEditor/hooks/useFlyout';\nimport { Icon } from 'components';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\nconst PREVENT_OPEN_DELAY = 200;\n\ninterface TablePluginProps {\n isActive: boolean;\n}\n\nexport interface TableMutation {\n mutateTable: (type: Actions) => void;\n}\n\nexport const TablePlugin = forwardRef(({ isActive }: TablePluginProps, ref): JSX.Element => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, hideFlyout, isVisible } = useFlyout();\n const addTableForm = useRef<addTableForm>(undefined);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const preventOpen = useRef(false);\n const isVisibleRef = useRef(isVisible);\n\n const openFlyout = () => {\n const rect = buttonRef.current?.getBoundingClientRect();\n if (!preventOpen.current && rect) {\n showFlyout({ position: { top: rect.bottom, left: rect.left }, ...flyoutOptions });\n }\n };\n\n const closeFlyout = () => {\n hideFlyout();\n };\n\n const insertTable = (nrOfRows: number, nrOfColumns: number) => {\n editor.update(() => {\n const selection = $getSelection();\n const tableNode = createTable(nrOfRows, nrOfColumns);\n if ($isRangeSelection(selection)) {\n selection.insertNodes([tableNode]);\n } else {\n $getRoot().append(tableNode);\n }\n const firstDescendant = tableNode.getFirstDescendant();\n if (firstDescendant) {\n (firstDescendant as TextNode).select();\n }\n });\n\n closeFlyout();\n };\n\n const mutateTable = (action: Actions) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode();\n const currentNode = $getTableCellNodeFromLexicalNode(anchorNode);\n\n if ($isTableCellNode(currentNode)) {\n switch (action) {\n case 'insertRowAbove':\n case 'insertRowBelow':\n insertRow(currentNode, action);\n break;\n case 'deleteRow':\n deleteRow(currentNode);\n break;\n case 'insertColumnLeft':\n case 'insertColumnRight':\n insertColumn(currentNode, action);\n break;\n case 'deleteColumn':\n deleteColumn(currentNode);\n break;\n case 'deleteTable':\n deleteTable(currentNode);\n break;\n }\n }\n }\n });\n };\n\n const flyoutOptions = {\n children: (\n <AddTableForm\n onCloseHandler={closeFlyout}\n onSaveHandler={(rows, columns) => insertTable(rows, columns)}\n ref={addTableForm}\n />\n ),\n };\n\n useEffect(() => {\n if (!isVisible) {\n addTableForm.current?.clearForm();\n setTimeout(() => (preventOpen.current = false), PREVENT_OPEN_DELAY);\n } else {\n preventOpen.current = true;\n addTableForm.current?.focusFirstField();\n }\n }, [addTableForm, isVisible]);\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit9') {\n event.preventDefault();\n openFlyout();\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n return () => {\n removeKeyboardShortcut();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n isVisibleRef.current = isVisible;\n }, [isVisible]);\n\n useEffect(() => {\n const removeKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && isVisibleRef.current) {\n event.preventDefault();\n event.stopPropagation();\n closeFlyout();\n }\n };\n\n document.addEventListener('keydown', removeKeydown, { capture: true });\n\n return () => {\n document.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useImperativeHandle(ref, () => ({\n mutateTable,\n }));\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n <div className={styles['editor__toolbar-button-flyoutwrapper']}>\n <button\n onClick={openFlyout}\n title={t.table.tableTooltip}\n className={clsx(styles['editor__toolbar-button'], isActive && styles[`editor__toolbar-button--active`])}\n aria-label={t.aria.labels.table}\n aria-keyshortcuts={t.aria.keyshortcuts.table}\n ref={buttonRef}\n type=\"button\"\n >\n <Icon name=\"Table\" size={24} />\n </button>\n {flyout}\n </div>\n </div>\n );\n});\n"],"names":["MultiSelectHeader","label","clearTrigger","onClear","jsxs","styles","jsx","Label","Button","MultiSelect","scrollable","noBorder","header","children","Fragment","clsx","MultiSelectItem","AddLinkForm","forwardRef","onCloseHandler","onSaveHandler","isLink","ref","t","useTranslation","url","setUrl","useState","linkText","setLinkText","showLinktextField","setShowLinktextField","urlError","setUrlError","linkTextError","setLinkTextError","firstField","useRef","linkId","useId","textId","handleOpenUrl","ensureHttps","handleUrl","event","handleLinkText","validateUrl","validateUrlWithProtocol","validateLinkText","handleSave","resetForm","handleClose","setDefaults","linktext","focusFirstField","useImperativeHandle","FormField","InputField","Icon","FeedbackBox","AddTableForm","rowCount","setRowCount","columnCount","setColumnCount","rowId","columnId","handleDimentionChange","type","value","useEffect","handleResizeScroll","setScrollableContainers","removeScrollableContainers","PREVENT_OPEN_DELAY","TablePlugin","isActive","editor","useLexicalComposerContext","flyout","showFlyout","hideFlyout","isVisible","useFlyout","addTableForm","buttonRef","preventOpen","isVisibleRef","openFlyout","rect","flyoutOptions","closeFlyout","insertTable","nrOfRows","nrOfColumns","selection","$getSelection","tableNode","createTable","$isRangeSelection","$getRoot","firstDescendant","mutateTable","action","anchorNode","currentNode","$getTableCellNodeFromLexicalNode","$isTableCellNode","insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","rows","columns","removeKeyboardShortcut","KEY_DOWN_COMMAND","COMMAND_PRIORITY_EDITOR","removeKeydown"],"mappings":";;;;;;;;;;;;;;;;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AAK,OAAO;AAAA,QAC1B,qBAAmBA,EAAE,KAAK,aAAa;AAAA,QACvC,KAAK8D;AAAA,QACL,MAAK;AAAA,QAEL,UAAA,gBAAA/E,EAACoD,GAAA,EAAK,MAAK,SAAQ,MAAM,GAAA,CAAI;AAAA,MAAA;AAAA,IAAA;AAAA,IAE9BqB;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"TablePlugin-oF-gInNx.js","sources":["../src/components/MultiSelect/components/MultiSelectHeader.tsx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.tsx","../src/components/RteEditor/Plugins/TablePlugin/AddTableFrom.tsx","../src/components/RteEditor/Plugins/TablePlugin/TablePlugin.tsx"],"sourcesContent":["import styles from 'components/MultiSelect/MultiSelect.module.css';\nimport { Label } from 'components/Label';\nimport { Button } from 'components';\n\nexport interface MultiSelectHeaderProps {\n label: string;\n clearTrigger?: string;\n onClear?: () => void;\n}\n\nexport function MultiSelectHeader({ label, clearTrigger, onClear }: MultiSelectHeaderProps) {\n return (\n <header className={styles['multi-select__header']}>\n <Label htmlFor=\"multi-select-list\">{label}</Label>\n {clearTrigger && (\n <Button variant={'blank'} onClick={onClear}>\n {clearTrigger}\n </Button>\n )}\n </header>\n );\n}\n","import { clsx } from 'clsx';\n\nimport type { PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './MultiSelect.module.css';\n\nimport { MultiSelectItem } from 'components/MultiSelect/components/MultiSelectItem';\nimport { MultiSelectHeader } from 'components/MultiSelect/components/MultiSelectHeader';\n\nexport interface MultiSelectProps {\n /** `true` if the container should scroll on overflow; otherwise, `false` to resize the container to its contents. The default is `true`. */\n scrollable?: boolean;\n /** `true` to disable the border around the container; otherwise, `false`. The default is `false`. */\n noBorder?: boolean;\n /** The header contents. */\n header?: ReactNode;\n}\n\n/** Represents a component to list a number of checkboxes. */\nexport const MultiSelect = ({ scrollable = true, noBorder, header, children }: PropsWithChildren<MultiSelectProps>) => (\n <>\n {header}\n <div\n className={clsx(styles['multi-select'], {\n [styles['multi-select--no-border']]: noBorder,\n })}\n >\n <ul\n className={clsx(styles['multi-select__list'], {\n [styles['multi-select__list--scrollable']]: scrollable,\n })}\n id=\"multi-select-list\"\n >\n {children}\n </ul>\n </div>\n </>\n);\n\nMultiSelect.MultiSelectHeader = MultiSelectHeader;\nMultiSelect.MultiSelectItem = MultiSelectItem;\n","import { useState, forwardRef, useImperativeHandle, useRef, useId } from 'react';\n\nimport type { ChangeEvent, JSX } from 'react';\nimport type { LinkType } from 'components/RteEditor/Plugins/LinkPlugin';\n\nimport styles from './AddLinkForm.module.css';\n\nimport { ensureHttps, validateUrlWithProtocol } from 'components/RteEditor/Plugins/LinkPlugin/helpers';\nimport { Button, FeedbackBox, FormField, Icon, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ninterface AddLinkFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (url: string, linktext: string) => void;\n isLink: LinkType;\n}\n\nexport interface addLinkFormMethods {\n clearForm: () => void;\n focusFirstField: () => void;\n setDefaults: (url: string, linktext: string) => void;\n}\n\nexport const AddLinkForm = forwardRef(\n (\n { onCloseHandler, onSaveHandler, isLink = { active: false, url: '', linktext: '' } }: AddLinkFormProps,\n ref\n ): JSX.Element => {\n const t = useTranslation();\n const [url, setUrl] = useState<string>(isLink.url || '');\n const [linkText, setLinkText] = useState<string>(isLink.linktext || '');\n const [showLinktextField, setShowLinktextField] = useState<boolean>(false);\n const [urlError, setUrlError] = useState<string | null>(null);\n const [linkTextError, setLinkTextError] = useState<string | null>(null);\n const firstField = useRef<HTMLInputElement>(null);\n const linkId = `link_${useId()}`;\n const textId = `text_${useId()}`;\n\n const handleOpenUrl = () => {\n window.open(ensureHttps(url), '_blank');\n };\n\n const handleUrl = (event: ChangeEvent<HTMLInputElement>) => {\n setUrl(event.target.value);\n };\n\n const handleLinkText = (event: ChangeEvent<HTMLInputElement>) => {\n setLinkText(event.target.value);\n };\n\n const validateUrl = (url: string): boolean => {\n if (validateUrlWithProtocol(url) === false || url.trim() === '') {\n setUrlError(t.errortext.urlNotValid);\n return false;\n }\n setUrlError(null);\n return true;\n };\n\n const validateLinkText = (linkText: string): boolean => {\n if (linkText.trim() === '') {\n setLinkTextError(t.errortext.linkTextNotValid);\n return false;\n }\n setLinkTextError(null);\n return true;\n };\n\n const handleSave = () => {\n if (!validateUrl(url) || (showLinktextField && !validateLinkText(linkText))) {\n return;\n }\n\n onSaveHandler(url, linkText);\n resetForm();\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setUrl('');\n setShowLinktextField(false);\n setUrlError(null);\n setLinkTextError(null);\n };\n\n const setDefaults = (url: string, linktext: string) => {\n setUrl(url);\n if (!linktext && !url) {\n setShowLinktextField(true);\n }\n };\n\n const focusFirstField = () => {\n if (firstField.current) {\n firstField.current.focus();\n }\n };\n\n useImperativeHandle(ref, () => ({\n clearForm: resetForm,\n focusFirstField,\n setDefaults,\n }));\n\n return (\n <div className={styles['linkform']}>\n <FormField className={styles['linkform__input-field']}>\n <Label htmlFor={linkId}>{t.links.linkLabel}</Label>\n <div className={styles['linkform__input-url-wrapper']}>\n <InputField\n id={linkId}\n placeholder={t.links.linkPlaceholder}\n value={url}\n onChange={(event) => handleUrl(event)}\n onFocus={() => setUrlError(null)}\n ref={firstField}\n aria-label={t.aria.labels.linkField}\n />\n {url && (\n <button type=\"button\" onClick={handleOpenUrl} className={styles['linkform__open-url-button']}>\n <Icon name=\"ArrowTopRightOnSquare\" size={20} />\n </button>\n )}\n </div>\n {urlError && <FeedbackBox level=\"error\" feedback={urlError} />}\n </FormField>\n {showLinktextField && (\n <FormField className={styles['linkform__input-field']}>\n <Label htmlFor={textId}>{t.links.linkText}</Label>\n <InputField\n id={textId}\n value={linkText}\n onChange={(event) => handleLinkText(event)}\n onFocus={() => setLinkTextError(null)}\n aria-label={t.aria.labels.linkTextfield}\n />\n {linkTextError && <FeedbackBox level=\"error\" feedback={linkTextError} />}\n </FormField>\n )}\n <div className={styles['linkform__footer']}>\n <Button variant={'secondary'} onClick={handleClose} aria-label={t.common.cancel} type=\"button\">\n {t.common.cancel}\n </Button>\n <Button variant={'primary'} onClick={handleSave} aria-label={t.aria.labels.linkOkButton} type=\"button\">\n {t.links.addLink}\n </Button>\n </div>\n </div>\n );\n }\n);\n","import { useState, forwardRef, useImperativeHandle, useRef, useId, useEffect } from 'react';\n\nimport type { ChangeEvent } from 'react';\n\nimport styles from './AddTableFrom.module.css';\n\nimport { Button, FormField, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\nimport { removeScrollableContainers, setScrollableContainers } from 'components/RteEditor/helpers';\n\ninterface AddTableFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (nrfOfRows: number, nrOfColumns: number) => void;\n}\n\nexport interface addTableForm {\n clearForm: () => void;\n focusFirstField: () => void;\n}\n\nexport const AddTableForm = forwardRef(({ onCloseHandler, onSaveHandler }: AddTableFormProps, ref) => {\n const t = useTranslation();\n const [rowCount, setRowCount] = useState<number>();\n const [columnCount, setColumnCount] = useState<number>();\n const firstField = useRef<HTMLInputElement>(null);\n const rowId = `row_${useId()}`;\n const columnId = `column_${useId()}`;\n\n const handleDimentionChange = (event: ChangeEvent<HTMLInputElement>, type: string) => {\n const value = event.target.value;\n type === 'row' ? setRowCount(parseInt(value)) : setColumnCount(parseInt(value));\n };\n\n const handleSave = () => {\n if (rowCount !== undefined && columnCount !== undefined) {\n onSaveHandler(rowCount, columnCount);\n resetForm();\n }\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setRowCount(undefined);\n setColumnCount(undefined);\n };\n\n useImperativeHandle(ref, () => ({\n clearForm: resetForm,\n focusFirstField: () => firstField.current?.focus(),\n }));\n\n useEffect(() => {\n const handleResizeScroll = () => {\n handleClose();\n };\n\n setScrollableContainers(handleResizeScroll);\n\n window.addEventListener('scroll', handleResizeScroll);\n window.addEventListener('resize', handleResizeScroll);\n\n return () => {\n window.removeEventListener('scroll', handleResizeScroll);\n window.removeEventListener('resize', handleResizeScroll);\n removeScrollableContainers(handleResizeScroll);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <div className={styles['tableform']}>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor={rowId}>{t.table.nrofRows}</Label>\n <InputField\n id={rowId}\n placeholder={t.table.nrofRowsPlaceholder}\n value={rowCount ? rowCount : ''}\n onChange={(event) => handleDimentionChange(event, 'row')}\n aria-label={t.aria.labels.tableRowfield}\n ref={firstField}\n />\n </FormField>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor={columnId}>{t.table.nrofColumns}</Label>\n <InputField\n id={columnId}\n placeholder={t.table.nrofColumnsPlaceholder}\n value={columnCount ? columnCount : ''}\n onChange={(event) => handleDimentionChange(event, 'column')}\n aria-label={t.aria.labels.tableColumnfield}\n />\n </FormField>\n <div className={styles['tableform__footer']}>\n <Button variant={'secondary'} onClick={handleClose} aria-label={t.common.cancel}>\n {t.common.cancel}\n </Button>\n <Button\n variant={'primary'}\n onClick={handleSave}\n disabled={!rowCount || !columnCount}\n aria-label={t.aria.labels.tableOkButton}\n >\n {t.common.add}\n </Button>\n </div>\n </div>\n );\n});\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { clsx } from 'clsx';\nimport { $getTableCellNodeFromLexicalNode, $isTableCellNode } from '@lexical/table';\nimport { $getSelection, $isRangeSelection, $getRoot, KEY_DOWN_COMMAND, COMMAND_PRIORITY_EDITOR } from 'lexical';\nimport { useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\n\nimport type { JSX } from 'react';\nimport type { TextNode } from 'lexical';\nimport type { addTableForm } from './AddTableFrom';\nimport type { Actions } from './TableCellContextMenu';\n\nimport { AddTableForm } from './AddTableFrom';\nimport { createTable, deleteColumn, deleteRow, deleteTable, insertColumn, insertRow } from './helpers';\n\nimport { useFlyout } from 'components/RteEditor/hooks/useFlyout';\nimport { Icon } from 'components';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\nconst PREVENT_OPEN_DELAY = 200;\n\ninterface TablePluginProps {\n isActive: boolean;\n}\n\nexport interface TableMutation {\n mutateTable: (type: Actions) => void;\n}\n\nexport const TablePlugin = forwardRef(({ isActive }: TablePluginProps, ref): JSX.Element => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, hideFlyout, isVisible } = useFlyout();\n const addTableForm = useRef<addTableForm>(undefined);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const preventOpen = useRef(false);\n const isVisibleRef = useRef(isVisible);\n\n const openFlyout = () => {\n const rect = buttonRef.current?.getBoundingClientRect();\n if (!preventOpen.current && rect) {\n showFlyout({ position: { top: rect.bottom, left: rect.left }, ...flyoutOptions });\n }\n };\n\n const closeFlyout = () => {\n hideFlyout();\n };\n\n const insertTable = (nrOfRows: number, nrOfColumns: number) => {\n editor.update(() => {\n const selection = $getSelection();\n const tableNode = createTable(nrOfRows, nrOfColumns);\n if ($isRangeSelection(selection)) {\n selection.insertNodes([tableNode]);\n } else {\n $getRoot().append(tableNode);\n }\n const firstDescendant = tableNode.getFirstDescendant();\n if (firstDescendant) {\n (firstDescendant as TextNode).select();\n }\n });\n\n closeFlyout();\n };\n\n const mutateTable = (action: Actions) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode();\n const currentNode = $getTableCellNodeFromLexicalNode(anchorNode);\n\n if ($isTableCellNode(currentNode)) {\n switch (action) {\n case 'insertRowAbove':\n case 'insertRowBelow':\n insertRow(currentNode, action);\n break;\n case 'deleteRow':\n deleteRow(currentNode);\n break;\n case 'insertColumnLeft':\n case 'insertColumnRight':\n insertColumn(currentNode, action);\n break;\n case 'deleteColumn':\n deleteColumn(currentNode);\n break;\n case 'deleteTable':\n deleteTable(currentNode);\n break;\n }\n }\n }\n });\n };\n\n const flyoutOptions = {\n children: (\n <AddTableForm\n onCloseHandler={closeFlyout}\n onSaveHandler={(rows, columns) => insertTable(rows, columns)}\n ref={addTableForm}\n />\n ),\n };\n\n useEffect(() => {\n if (!isVisible) {\n addTableForm.current?.clearForm();\n setTimeout(() => (preventOpen.current = false), PREVENT_OPEN_DELAY);\n } else {\n preventOpen.current = true;\n addTableForm.current?.focusFirstField();\n }\n }, [addTableForm, isVisible]);\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit9') {\n event.preventDefault();\n openFlyout();\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n return () => {\n removeKeyboardShortcut();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n isVisibleRef.current = isVisible;\n }, [isVisible]);\n\n useEffect(() => {\n const removeKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && isVisibleRef.current) {\n event.preventDefault();\n event.stopPropagation();\n closeFlyout();\n }\n };\n\n document.addEventListener('keydown', removeKeydown, { capture: true });\n\n return () => {\n document.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useImperativeHandle(ref, () => ({\n mutateTable,\n }));\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n <div className={styles['editor__toolbar-button-flyoutwrapper']}>\n <button\n onClick={openFlyout}\n title={t.table.tableTooltip}\n className={clsx(styles['editor__toolbar-button'], isActive && styles[`editor__toolbar-button--active`])}\n aria-label={t.aria.labels.table}\n aria-keyshortcuts={t.aria.keyshortcuts.table}\n ref={buttonRef}\n type=\"button\"\n >\n <Icon name=\"Table\" size={24} />\n </button>\n {flyout}\n </div>\n </div>\n );\n});\n"],"names":["MultiSelectHeader","label","clearTrigger","onClear","jsxs","styles","jsx","Label","Button","MultiSelect","scrollable","noBorder","header","children","Fragment","clsx","MultiSelectItem","AddLinkForm","forwardRef","onCloseHandler","onSaveHandler","isLink","ref","t","useTranslation","url","setUrl","useState","linkText","setLinkText","showLinktextField","setShowLinktextField","urlError","setUrlError","linkTextError","setLinkTextError","firstField","useRef","linkId","useId","textId","handleOpenUrl","ensureHttps","handleUrl","event","handleLinkText","validateUrl","validateUrlWithProtocol","validateLinkText","handleSave","resetForm","handleClose","setDefaults","linktext","focusFirstField","useImperativeHandle","FormField","InputField","Icon","FeedbackBox","AddTableForm","rowCount","setRowCount","columnCount","setColumnCount","rowId","columnId","handleDimentionChange","type","value","useEffect","handleResizeScroll","setScrollableContainers","removeScrollableContainers","PREVENT_OPEN_DELAY","TablePlugin","isActive","editor","useLexicalComposerContext","flyout","showFlyout","hideFlyout","isVisible","useFlyout","addTableForm","buttonRef","preventOpen","isVisibleRef","openFlyout","rect","flyoutOptions","closeFlyout","insertTable","nrOfRows","nrOfColumns","selection","$getSelection","tableNode","createTable","$isRangeSelection","$getRoot","firstDescendant","mutateTable","action","anchorNode","currentNode","$getTableCellNodeFromLexicalNode","$isTableCellNode","insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","rows","columns","removeKeyboardShortcut","KEY_DOWN_COMMAND","COMMAND_PRIORITY_EDITOR","removeKeydown"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,GAAkB,EAAE,OAAAC,GAAO,cAAAC,GAAc,SAAAC,KAAmC;AAC1F,SACE,gBAAAC,EAAC,UAAA,EAAO,WAAWC,EAAO,sBAAsB,GAC9C,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,SAAQ,qBAAqB,UAAAN,GAAM;AAAA,IACzCC,KACC,gBAAAI,EAACE,GAAA,EAAO,SAAS,SAAS,SAASL,GAChC,UAAAD,EAAA,CACH;A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/Input.js";
|
|
18
18
|
import "../InputField/InputField.js";
|
|
19
19
|
import "react-router";
|
|
20
|
-
import "../../TablePlugin-
|
|
20
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
21
21
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
22
22
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
23
23
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -25,7 +25,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
25
25
|
import "../SelectListbox/SelectListbox.js";
|
|
26
26
|
import "../SelectListbox/SelectProvider.js";
|
|
27
27
|
import "../Sortable/components/SortableItem.js";
|
|
28
|
-
import "../../SortableProvider-
|
|
28
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
29
29
|
import { useResponsive as N } from "../hooks/useResponsive.js";
|
|
30
30
|
import '../../assets/CheckboxTree.css';const a = {
|
|
31
31
|
"checkbox-tree__header": "_checkbox-tree__header_l338d_1",
|
|
@@ -16,7 +16,7 @@ import "../IconButton/IconButton.js";
|
|
|
16
16
|
import "../Input/Input.js";
|
|
17
17
|
import "../InputField/InputField.js";
|
|
18
18
|
import "react-router";
|
|
19
|
-
import "../../TablePlugin-
|
|
19
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
20
20
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
21
21
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
22
22
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -24,7 +24,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
24
24
|
import "../SelectListbox/SelectListbox.js";
|
|
25
25
|
import "../SelectListbox/SelectProvider.js";
|
|
26
26
|
import "../Sortable/components/SortableItem.js";
|
|
27
|
-
import "../../SortableProvider-
|
|
27
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
28
28
|
import '../../assets/FormInput.css';const o = {
|
|
29
29
|
"form-input__container": "_form-input__container_c0vpz_1",
|
|
30
30
|
"form-input__container--label-left": "_form-input__container--label-left_c0vpz_7",
|
|
@@ -16,7 +16,7 @@ import "../GridRow/GridRow.js";
|
|
|
16
16
|
import "../IconButton/IconButton.js";
|
|
17
17
|
import "../Input/Input.js";
|
|
18
18
|
import "react-router";
|
|
19
|
-
import "../../TablePlugin-
|
|
19
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
20
20
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
21
21
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
22
22
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -24,7 +24,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
24
24
|
import "../SelectListbox/SelectListbox.js";
|
|
25
25
|
import "../SelectListbox/SelectProvider.js";
|
|
26
26
|
import "../Sortable/components/SortableItem.js";
|
|
27
|
-
import "../../SortableProvider-
|
|
27
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
28
28
|
const C = `
|
|
29
29
|
// Has all HTMLInputElement props available except "className" and "style"
|
|
30
30
|
<InputField aria-labelledby={aria-labelledby} id={id} onChange={onChangeFunction}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as S, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { l as d } from "../../index-C2E9FY6V.js";
|
|
3
3
|
import { useState as p } from "react";
|
|
4
|
-
import { M as e } from "../../TablePlugin-
|
|
4
|
+
import { M as e } from "../../TablePlugin-oF-gInNx.js";
|
|
5
5
|
import { Container as M } from "../../storyComponents/Container/Container.js";
|
|
6
6
|
const C = `
|
|
7
7
|
// MultiSelectHeader can be added optionally
|
|
@@ -15,7 +15,7 @@ import "../../IconButton/IconButton.js";
|
|
|
15
15
|
import "../../Input/Input.js";
|
|
16
16
|
import "../../InputField/InputField.js";
|
|
17
17
|
import "react-router";
|
|
18
|
-
import { a as y } from "../../../TablePlugin-
|
|
18
|
+
import { a as y } from "../../../TablePlugin-oF-gInNx.js";
|
|
19
19
|
import "../../RteEditor/Providers/LanguageProvider.js";
|
|
20
20
|
import "../../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
21
21
|
import "../../RteEditor/hooks/components/Flyout.js";
|
|
@@ -23,7 +23,7 @@ import "../../../index-nrPtQ1dv.js";
|
|
|
23
23
|
import "../../SelectListbox/SelectListbox.js";
|
|
24
24
|
import "../../SelectListbox/SelectProvider.js";
|
|
25
25
|
import "../../Sortable/components/SortableItem.js";
|
|
26
|
-
import "../../../SortableProvider-
|
|
26
|
+
import "../../../SortableProvider-DisCfTTN.js";
|
|
27
27
|
export {
|
|
28
28
|
y as MultiSelectHeader
|
|
29
29
|
};
|
|
@@ -17,7 +17,7 @@ import "../Input/Input.js";
|
|
|
17
17
|
import "../InputField/InputField.js";
|
|
18
18
|
import { Label as B } from "../Label/Label.js";
|
|
19
19
|
import "react-router";
|
|
20
|
-
import "../../TablePlugin-
|
|
20
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
21
21
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
22
22
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
23
23
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -25,7 +25,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
25
25
|
import "../SelectListbox/SelectListbox.js";
|
|
26
26
|
import "../SelectListbox/SelectProvider.js";
|
|
27
27
|
import "../Sortable/components/SortableItem.js";
|
|
28
|
-
import "../../SortableProvider-
|
|
28
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
29
29
|
import '../../assets/PeriodSelector.css';const s = {
|
|
30
30
|
"period-selector__container": "_period-selector__container_d1p0j_1",
|
|
31
31
|
"period-selector__container--label-left": "_period-selector__container--label-left_d1p0j_6",
|
|
@@ -17,7 +17,7 @@ import "../GridRow/GridRow.js";
|
|
|
17
17
|
import "../IconButton/IconButton.js";
|
|
18
18
|
import "../Input/Input.js";
|
|
19
19
|
import "../InputField/InputField.js";
|
|
20
|
-
import "../../TablePlugin-
|
|
20
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
21
21
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
22
22
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
23
23
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -25,7 +25,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
25
25
|
import "../SelectListbox/SelectListbox.js";
|
|
26
26
|
import "../SelectListbox/SelectProvider.js";
|
|
27
27
|
import "../Sortable/components/SortableItem.js";
|
|
28
|
-
import "../../SortableProvider-
|
|
28
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
29
29
|
const p = "<ProgrammeCard key={key} header={header} details={details} href={href} />", J = {
|
|
30
30
|
title: "Atoms/ProgrammeCard",
|
|
31
31
|
component: o,
|
|
@@ -17,7 +17,7 @@ import "../IconButton/IconButton.js";
|
|
|
17
17
|
import "../Input/Input.js";
|
|
18
18
|
import "../InputField/InputField.js";
|
|
19
19
|
import "react-router";
|
|
20
|
-
import "../../TablePlugin-
|
|
20
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
21
21
|
import "../RteEditor/Providers/LanguageProvider.js";
|
|
22
22
|
import "../RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
23
23
|
import "../RteEditor/hooks/components/Flyout.js";
|
|
@@ -25,7 +25,7 @@ import "../../index-nrPtQ1dv.js";
|
|
|
25
25
|
import "../SelectListbox/SelectListbox.js";
|
|
26
26
|
import "../SelectListbox/SelectProvider.js";
|
|
27
27
|
import "../Sortable/components/SortableItem.js";
|
|
28
|
-
import "../../SortableProvider-
|
|
28
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
29
29
|
import '../../assets/RadioTabSelector.css';const t = {
|
|
30
30
|
"radio-tab-selector-button-bar__container": "_radio-tab-selector-button-bar__container_a4wnc_1",
|
|
31
31
|
"radio-tab-selector-button-bar__container--label-left": "_radio-tab-selector-button-bar__container--label-left_a4wnc_6",
|
|
@@ -14,7 +14,7 @@ import "../../IconButton/IconButton.js";
|
|
|
14
14
|
import "../../Input/Input.js";
|
|
15
15
|
import "../../InputField/InputField.js";
|
|
16
16
|
import "react-router";
|
|
17
|
-
import "../../../TablePlugin-
|
|
17
|
+
import "../../../TablePlugin-oF-gInNx.js";
|
|
18
18
|
import "../Providers/LanguageProvider.js";
|
|
19
19
|
import "../Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
20
20
|
import "../hooks/components/Flyout.js";
|
|
@@ -22,7 +22,7 @@ import "../../../index-nrPtQ1dv.js";
|
|
|
22
22
|
import "../../SelectListbox/SelectListbox.js";
|
|
23
23
|
import "../../SelectListbox/SelectProvider.js";
|
|
24
24
|
import "../../Sortable/components/SortableItem.js";
|
|
25
|
-
import "../../../SortableProvider-
|
|
25
|
+
import "../../../SortableProvider-DisCfTTN.js";
|
|
26
26
|
import '../../../assets/EditorHeader.css';const t = {
|
|
27
27
|
"editor-header__container": "_editor-header__container_9khdz_1",
|
|
28
28
|
"editor-header__info": "_editor-header__info_9khdz_10"
|
|
@@ -17,7 +17,7 @@ import "../../../IconButton/IconButton.js";
|
|
|
17
17
|
import "../../../Input/Input.js";
|
|
18
18
|
import "../../../InputField/InputField.js";
|
|
19
19
|
import "react-router";
|
|
20
|
-
import "../../../../TablePlugin-
|
|
20
|
+
import "../../../../TablePlugin-oF-gInNx.js";
|
|
21
21
|
import { s as r } from "../../../../RteEditor.module-B_3uFnFu.js";
|
|
22
22
|
import { useTranslation as x } from "../../hooks/useTranslation.js";
|
|
23
23
|
import "../LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
@@ -27,7 +27,7 @@ import "../../../../index-nrPtQ1dv.js";
|
|
|
27
27
|
import "../../../SelectListbox/SelectListbox.js";
|
|
28
28
|
import "../../../SelectListbox/SelectProvider.js";
|
|
29
29
|
import "../../../Sortable/components/SortableItem.js";
|
|
30
|
-
import "../../../../SortableProvider-
|
|
30
|
+
import "../../../../SortableProvider-DisCfTTN.js";
|
|
31
31
|
const Z = () => {
|
|
32
32
|
const o = x(), [t] = h(), [p, d] = s(!1), [l, c] = s(!1), u = () => {
|
|
33
33
|
t.dispatchCommand(y, void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { A as D } from "../../../../../TablePlugin-
|
|
3
|
+
import { A as D } from "../../../../../TablePlugin-oF-gInNx.js";
|
|
4
4
|
import "../../../../../helpers-CMG0anwr.js";
|
|
5
5
|
import "../../../../Icon/Icon.js";
|
|
6
6
|
import "../../../../Buttons/Button.js";
|
|
@@ -27,7 +27,7 @@ import "../../../../../index-nrPtQ1dv.js";
|
|
|
27
27
|
import "../../../../SelectListbox/SelectListbox.js";
|
|
28
28
|
import "../../../../SelectListbox/SelectProvider.js";
|
|
29
29
|
import "../../../../Sortable/components/SortableItem.js";
|
|
30
|
-
import "../../../../../SortableProvider-
|
|
30
|
+
import "../../../../../SortableProvider-DisCfTTN.js";
|
|
31
31
|
export {
|
|
32
32
|
D as AddLinkForm
|
|
33
33
|
};
|
|
@@ -4,7 +4,7 @@ import { c as W } from "../../../../clsx-OuTLNxxd.js";
|
|
|
4
4
|
import { p as O, k as Y, v as G } from "../../../../LexicalLink.prod-DoU9RL94.js";
|
|
5
5
|
import { useRef as a, useState as J, useEffect as m } from "react";
|
|
6
6
|
import { _ as Q, N as f, q as Z, aq as $, c as N, L as tt, m as et, X as ot } from "../../../../Lexical.prod-B84LhBo3.js";
|
|
7
|
-
import { A as rt } from "../../../../TablePlugin-
|
|
7
|
+
import { A as rt } from "../../../../TablePlugin-oF-gInNx.js";
|
|
8
8
|
import { e as nt } from "../../../../helpers-CMG0anwr.js";
|
|
9
9
|
import { LinkContextMenu as it } from "./LinkContextMenu/LinkContextMenu.js";
|
|
10
10
|
import { useFlyout as st } from "../../hooks/useFlyout.js";
|
|
@@ -30,7 +30,7 @@ import "../../../../index-nrPtQ1dv.js";
|
|
|
30
30
|
import "../../../SelectListbox/SelectListbox.js";
|
|
31
31
|
import "../../../SelectListbox/SelectProvider.js";
|
|
32
32
|
import "../../../Sortable/components/SortableItem.js";
|
|
33
|
-
import "../../../../SortableProvider-
|
|
33
|
+
import "../../../../SortableProvider-DisCfTTN.js";
|
|
34
34
|
const ut = 200, z = (p) => {
|
|
35
35
|
let n = p;
|
|
36
36
|
for (; n; ) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { b as B } from "../../../../TablePlugin-
|
|
3
|
+
import { b as B } from "../../../../TablePlugin-oF-gInNx.js";
|
|
4
4
|
import "../../../Buttons/Button.js";
|
|
5
5
|
import "../../../Buttons/LinkButton.js";
|
|
6
6
|
import "@react-aria/button";
|
|
@@ -25,7 +25,7 @@ import "../../../../index-nrPtQ1dv.js";
|
|
|
25
25
|
import "../../../SelectListbox/SelectListbox.js";
|
|
26
26
|
import "../../../SelectListbox/SelectProvider.js";
|
|
27
27
|
import "../../../Sortable/components/SortableItem.js";
|
|
28
|
-
import "../../../../SortableProvider-
|
|
28
|
+
import "../../../../SortableProvider-DisCfTTN.js";
|
|
29
29
|
export {
|
|
30
30
|
B as AddTableForm
|
|
31
31
|
};
|
|
@@ -4,7 +4,7 @@ import "../../../../clsx-OuTLNxxd.js";
|
|
|
4
4
|
import "../../../../LexicalTable.prod-9xjyWB0C.js";
|
|
5
5
|
import "../../../../Lexical.prod-B84LhBo3.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { T as F } from "../../../../TablePlugin-
|
|
7
|
+
import { T as F } from "../../../../TablePlugin-oF-gInNx.js";
|
|
8
8
|
import "./helpers.js";
|
|
9
9
|
import "../../hooks/useFlyout.js";
|
|
10
10
|
import "../../../Icon/Icon.js";
|
|
@@ -29,7 +29,7 @@ import "../../../../index-nrPtQ1dv.js";
|
|
|
29
29
|
import "../../../SelectListbox/SelectListbox.js";
|
|
30
30
|
import "../../../SelectListbox/SelectProvider.js";
|
|
31
31
|
import "../../../Sortable/components/SortableItem.js";
|
|
32
|
-
import "../../../../SortableProvider-
|
|
32
|
+
import "../../../../SortableProvider-DisCfTTN.js";
|
|
33
33
|
export {
|
|
34
34
|
F as TablePlugin
|
|
35
35
|
};
|
|
@@ -7,7 +7,7 @@ import { BlockFormatPlugin as T } from "../BlockFormatPlugin/BlockFormatPlugin.j
|
|
|
7
7
|
import { ListPlugin as k } from "../ListPlugin/ListPlugin.js";
|
|
8
8
|
import { LinkPlugin as x } from "../LinkPlugin/LinkPlugin.js";
|
|
9
9
|
import { HistoryPlugin as B } from "../HistoryPlugin/HistoryPlugin.js";
|
|
10
|
-
import { T as S } from "../../../../TablePlugin-
|
|
10
|
+
import { T as S } from "../../../../TablePlugin-oF-gInNx.js";
|
|
11
11
|
import { TableCellContextMenu as z } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
12
12
|
import { s as A } from "../../../../RteEditor.module-B_3uFnFu.js";
|
|
13
13
|
import { setScrollableContainers as b, removeScrollableContainers as K } from "../../helpers.js";
|
|
@@ -3,7 +3,7 @@ import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js
|
|
|
3
3
|
import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
|
|
4
4
|
import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
|
|
5
5
|
import { HistoryPlugin as p } from "./HistoryPlugin/HistoryPlugin.js";
|
|
6
|
-
import { T as a } from "../../../TablePlugin-
|
|
6
|
+
import { T as a } from "../../../TablePlugin-oF-gInNx.js";
|
|
7
7
|
import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
8
8
|
export {
|
|
9
9
|
l as BlockFormatPlugin,
|
|
@@ -16,7 +16,7 @@ import { exportMap as ir, isStartingWithHtmlTag as lr, mergeBoldStrongTags as ur
|
|
|
16
16
|
import { s as I } from "../../RteEditor.module-B_3uFnFu.js";
|
|
17
17
|
import { ToolBarPlugin as cr } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
18
18
|
import { useTranslation as dr } from "./hooks/useTranslation.js";
|
|
19
|
-
import "../../TablePlugin-
|
|
19
|
+
import "../../TablePlugin-oF-gInNx.js";
|
|
20
20
|
import "./Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
21
21
|
import "./hooks/components/Flyout.js";
|
|
22
22
|
import "../Buttons/Button.js";
|
|
@@ -36,7 +36,7 @@ import "react-router";
|
|
|
36
36
|
import "../SelectListbox/SelectListbox.js";
|
|
37
37
|
import "../SelectListbox/SelectProvider.js";
|
|
38
38
|
import "../Sortable/components/SortableItem.js";
|
|
39
|
-
import "../../SortableProvider-
|
|
39
|
+
import "../../SortableProvider-DisCfTTN.js";
|
|
40
40
|
import { UvaTheme as mr } from "./UvaTheme/UvaTheme.js";
|
|
41
41
|
import { EditorHeader as pr } from "./EditorHeader/EditorHeader.js";
|
|
42
42
|
import { LanguageProvider as gr, useLanguage as hr } from "./Providers/LanguageProvider.js";
|
|
@@ -2,9 +2,11 @@ import { ReactElement } from 'react';
|
|
|
2
2
|
import { SortableItemProps } from './components/SortableItem';
|
|
3
3
|
export type Index = string | number;
|
|
4
4
|
export type SortableItemColors = 'grey-200' | 'white';
|
|
5
|
-
export interface SortableProps {
|
|
5
|
+
export interface SortableProps<T = unknown> {
|
|
6
6
|
/** The elements to show inside the Sortable. */
|
|
7
7
|
children: ReactElement[] | string[];
|
|
8
|
+
/** The data objects that are actually being sorted. */
|
|
9
|
+
childrenData?: T[];
|
|
8
10
|
/** The placement of each item Handle (6 dots 2x3). */
|
|
9
11
|
ItemHandlePlacement?: SortableItemProps['handlePlacement'];
|
|
10
12
|
/** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */
|
|
@@ -16,6 +18,6 @@ export interface SortableProps {
|
|
|
16
18
|
/** Change the color of the SortableItem wrapper. */
|
|
17
19
|
sortableItemColor?: SortableItemColors;
|
|
18
20
|
/** The callback function that is invoked when new sorting takes place. */
|
|
19
|
-
onSort?: (items:
|
|
21
|
+
onSort?: (items: T[]) => void;
|
|
20
22
|
}
|
|
21
|
-
export declare const Sortable: ({ children, ItemHandlePlacement, scrollable, disabled, onSort, hideNumbers, sortableItemColor, }: SortableProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Sortable: <T>({ children, childrenData, ItemHandlePlacement, scrollable, disabled, onSort, hideNumbers, sortableItemColor, }: SortableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Children as
|
|
3
|
-
import { SortableItem as
|
|
4
|
-
import { S as
|
|
5
|
-
const
|
|
6
|
-
children:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { Children as a } from "react";
|
|
3
|
+
import { SortableItem as f } from "./components/SortableItem.js";
|
|
4
|
+
import { S as I } from "../../SortableProvider-DisCfTTN.js";
|
|
5
|
+
const P = ({
|
|
6
|
+
children: t,
|
|
7
|
+
childrenData: m,
|
|
8
|
+
ItemHandlePlacement: s = "left",
|
|
9
|
+
scrollable: l,
|
|
10
|
+
disabled: n,
|
|
10
11
|
onSort: i,
|
|
11
|
-
hideNumbers:
|
|
12
|
+
hideNumbers: p,
|
|
12
13
|
sortableItemColor: b = "grey-200"
|
|
13
|
-
}) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
}) => {
|
|
15
|
+
const d = m ?? t, r = t.map((c, e) => /* @__PURE__ */ o(
|
|
16
|
+
f,
|
|
17
|
+
{
|
|
18
|
+
handlePlacement: s,
|
|
19
|
+
disabled: n || a.count(t) <= 1,
|
|
20
|
+
sortableItemColor: b,
|
|
21
|
+
index: e,
|
|
22
|
+
children: c
|
|
23
|
+
},
|
|
24
|
+
`sortable-item-${e}`
|
|
25
|
+
));
|
|
26
|
+
return /* @__PURE__ */ o(
|
|
27
|
+
I,
|
|
28
|
+
{
|
|
29
|
+
renderItems: r,
|
|
30
|
+
dataItems: d,
|
|
31
|
+
scrollable: l,
|
|
32
|
+
hideNumbers: p,
|
|
33
|
+
onSort: i,
|
|
34
|
+
children: r
|
|
35
|
+
},
|
|
36
|
+
`sortable-with-children-${a.count(t)}`
|
|
37
|
+
);
|
|
38
|
+
};
|
|
34
39
|
export {
|
|
35
|
-
|
|
40
|
+
P as Sortable
|
|
36
41
|
};
|
|
37
42
|
//# sourceMappingURL=Sortable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\nexport type SortableItemColors = 'grey-200' | 'white';\n\nexport interface SortableProps {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** Hide the numbers shown next to the sortable elements. */\n hideNumbers?: boolean;\n /** Change the color of the SortableItem wrapper. */\n sortableItemColor?: SortableItemColors;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items:
|
|
1
|
+
{"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\nexport type SortableItemColors = 'grey-200' | 'white';\n\nexport interface SortableProps<T = unknown> {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The data objects that are actually being sorted. */\n childrenData?: T[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** Hide the numbers shown next to the sortable elements. */\n hideNumbers?: boolean;\n /** Change the color of the SortableItem wrapper. */\n sortableItemColor?: SortableItemColors;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items: T[]) => void;\n}\n\n// A component that renders a list of children that can be sorted with drag and drop.\nexport const Sortable = <T,>({\n children,\n childrenData,\n ItemHandlePlacement = 'left',\n scrollable,\n disabled,\n onSort,\n hideNumbers,\n sortableItemColor = 'grey-200',\n}: SortableProps<T>) => {\n const sortableData: T[] = childrenData ?? (children as unknown as T[]);\n\n const wrappedItems = children.map((child, index) => (\n <SortableItem\n handlePlacement={ItemHandlePlacement}\n disabled={disabled || Children.count(children) <= 1}\n sortableItemColor={sortableItemColor}\n index={index}\n key={`sortable-item-${index}`}\n >\n {child}\n </SortableItem>\n ));\n\n return (\n <SortableProvider\n renderItems={wrappedItems}\n dataItems={sortableData}\n scrollable={scrollable}\n hideNumbers={hideNumbers}\n onSort={onSort}\n key={`sortable-with-children-${Children.count(children)}`}\n >\n {wrappedItems}\n </SortableProvider>\n );\n};\n"],"names":["Sortable","children","childrenData","ItemHandlePlacement","scrollable","disabled","onSort","hideNumbers","sortableItemColor","sortableData","wrappedItems","child","index","jsx","SortableItem","Children","SortableProvider"],"mappings":";;;;AA+BO,MAAMA,IAAW,CAAK;AAAA,EAC3B,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,MAAwB;AACtB,QAAMC,IAAoBP,KAAiBD,GAErCS,IAAeT,EAAS,IAAI,CAACU,GAAOC,MACxC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,iBAAiBX;AAAA,MACjB,UAAUE,KAAYU,EAAS,MAAMd,CAAQ,KAAK;AAAA,MAClD,mBAAAO;AAAA,MACA,OAAAI;AAAA,MAGC,UAAAD;AAAA,IAAA;AAAA,IAFI,iBAAiBC,CAAK;AAAA,EAAA,CAI9B;AAED,SACE,gBAAAC;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,aAAaN;AAAA,MACb,WAAWD;AAAA,MACX,YAAAL;AAAA,MACA,aAAAG;AAAA,MACA,QAAAD;AAAA,MAGC,UAAAI;AAAA,IAAA;AAAA,IAFI,0BAA0BK,EAAS,MAAMd,CAAQ,CAAC;AAAA,EAAA;AAK7D;"}
|
|
@@ -2,6 +2,6 @@ import { Meta } from '@storybook/react';
|
|
|
2
2
|
import { SortableProps } from './Sortable';
|
|
3
3
|
declare const _default: Meta<SortableProps>;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
6
|
-
export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
7
|
-
export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
5
|
+
export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
6
|
+
export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
7
|
+
export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as m } from "react/jsx-runtime";
|
|
2
2
|
import { l as s } from "../../index-C2E9FY6V.js";
|
|
3
|
-
import { Sortable as
|
|
3
|
+
import { Sortable as l } from "./Sortable.js";
|
|
4
4
|
import { InputField as d } from "../InputField/InputField.js";
|
|
5
5
|
import { Icon as c } from "../Icon/Icon.js";
|
|
6
6
|
import { Button as b } from "../Buttons/Button.js";
|
|
7
7
|
import "../Buttons/LinkButton.js";
|
|
8
8
|
import "@react-aria/button";
|
|
9
9
|
const p = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable}
|
|
10
|
-
disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `,
|
|
10
|
+
disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `, F = {
|
|
11
11
|
title: "Organisms/Sortable",
|
|
12
|
-
component:
|
|
12
|
+
component: l,
|
|
13
13
|
argTypes: {
|
|
14
14
|
children: {
|
|
15
15
|
table: {
|
|
@@ -23,13 +23,13 @@ const p = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlac
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
parameters: {
|
|
26
|
-
inspectComponent:
|
|
26
|
+
inspectComponent: l,
|
|
27
27
|
codeString: p
|
|
28
28
|
}
|
|
29
29
|
}, r = {
|
|
30
30
|
ItemHandlePlacement: "left",
|
|
31
31
|
onSort: s()
|
|
32
|
-
}, a = ["Item-1", "Item-2", "Item-3", "Item-4", "Item-5"], n = (
|
|
32
|
+
}, a = ["Item-1", "Item-2", "Item-3", "Item-4", "Item-5"], n = (o) => /* @__PURE__ */ e(l, { ...o, children: a }), h = n.bind({});
|
|
33
33
|
h.args = {
|
|
34
34
|
...r
|
|
35
35
|
};
|
|
@@ -38,17 +38,24 @@ I.args = {
|
|
|
38
38
|
...r,
|
|
39
39
|
ItemHandlePlacement: "right"
|
|
40
40
|
};
|
|
41
|
-
const
|
|
41
|
+
const u = (o) => /* @__PURE__ */ e(l, { ...o, children: a.map((t) => /* @__PURE__ */ i(m, { children: [
|
|
42
42
|
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(d, { id: t, placeholder: t }, t) }),
|
|
43
43
|
/* @__PURE__ */ e(b, { variant: "blank-icon", children: /* @__PURE__ */ e(c, { name: "Trash", color: "#a0002aff" }) })
|
|
44
|
-
] }, t)) }),
|
|
45
|
-
|
|
46
|
-
...r
|
|
44
|
+
] }, t)) }), f = u.bind({});
|
|
45
|
+
f.args = {
|
|
46
|
+
...r,
|
|
47
|
+
childrenData: [
|
|
48
|
+
{ title: "item-1", value: 1 },
|
|
49
|
+
{ title: "item-2", value: 2 },
|
|
50
|
+
{ title: "item-3", value: 3 },
|
|
51
|
+
{ title: "item-4", value: 4 },
|
|
52
|
+
{ title: "item-5", value: 5 }
|
|
53
|
+
]
|
|
47
54
|
};
|
|
48
55
|
export {
|
|
49
56
|
h as SortableExample,
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
f as WithComplexChildren,
|
|
58
|
+
F as default,
|
|
52
59
|
I as withHandleRight
|
|
53
60
|
};
|
|
54
61
|
//# sourceMappingURL=Sortable.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable} \n disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/Sortable',\n component: Sortable,\n argTypes: {\n children: {\n table: {\n disable: true,\n },\n },\n ItemHandlePlacement: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Sortable,\n codeString: codeString,\n },\n} as Meta<SortableProps>;\n\nconst defaultArgs: Partial<SortableProps> = {\n ItemHandlePlacement: 'left',\n onSort: fn(),\n};\n\nconst mockItems = ['Item-1', 'Item-2', 'Item-3', 'Item-4', 'Item-5'];\n\nconst Template: StoryFn<SortableProps> = (args) => <Sortable {...args}>{mockItems}</Sortable>;\n\nexport const SortableExample = Template.bind({});\nSortableExample.args = {\n ...defaultArgs,\n};\n\nexport const withHandleRight = Template.bind({});\nwithHandleRight.args = {\n ...defaultArgs,\n ItemHandlePlacement: 'right',\n};\n\nconst TemplateComplex: StoryFn<SortableProps> = (args) => (\n <Sortable {...args}>\n {mockItems.map((item) => (\n <Fragment key={item}>\n <div style={{ width: '100%' }}>\n <InputField key={item} id={item} placeholder={item} />\n </div>\n <Button variant=\"blank-icon\">\n <Icon name=\"Trash\" color=\"#a0002aff\" />\n </Button>\n </Fragment>\n ))}\n </Sortable>\n);\n\nexport const WithComplexChildren = TemplateComplex.bind({});\nWithComplexChildren.args = {\n ...defaultArgs,\n};\n"],"names":["codeString","Sortable_stories","Sortable","defaultArgs","fn","mockItems","Template","args","SortableExample","withHandleRight","TemplateComplex","jsx","item","jsxs","Fragment","InputField","Button","Icon","WithComplexChildren"],"mappings":";;;;;;;;AAYA,MAAMA,IAAa;AAAA,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.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable} \n disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/Sortable',\n component: Sortable,\n argTypes: {\n children: {\n table: {\n disable: true,\n },\n },\n ItemHandlePlacement: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Sortable,\n codeString: codeString,\n },\n} as Meta<SortableProps>;\n\nconst defaultArgs: Partial<SortableProps> = {\n ItemHandlePlacement: 'left',\n onSort: fn(),\n};\n\nconst mockItems = ['Item-1', 'Item-2', 'Item-3', 'Item-4', 'Item-5'];\n\nconst Template: StoryFn<SortableProps> = (args) => <Sortable {...args}>{mockItems}</Sortable>;\n\nexport const SortableExample = Template.bind({});\nSortableExample.args = {\n ...defaultArgs,\n};\n\nexport const withHandleRight = Template.bind({});\nwithHandleRight.args = {\n ...defaultArgs,\n ItemHandlePlacement: 'right',\n};\n\nconst TemplateComplex: StoryFn<SortableProps> = (args) => (\n <Sortable {...args}>\n {mockItems.map((item) => (\n <Fragment key={item}>\n <div style={{ width: '100%' }}>\n <InputField key={item} id={item} placeholder={item} />\n </div>\n <Button variant=\"blank-icon\">\n <Icon name=\"Trash\" color=\"#a0002aff\" />\n </Button>\n </Fragment>\n ))}\n </Sortable>\n);\n\nexport const WithComplexChildren = TemplateComplex.bind({});\nWithComplexChildren.args = {\n ...defaultArgs,\n childrenData: [\n { title: 'item-1', value: 1 },\n { title: 'item-2', value: 2 },\n { title: 'item-3', value: 3 },\n { title: 'item-4', value: 4 },\n { title: 'item-5', value: 5 },\n ],\n};\n"],"names":["codeString","Sortable_stories","Sortable","defaultArgs","fn","mockItems","Template","args","SortableExample","withHandleRight","TemplateComplex","jsx","item","jsxs","Fragment","InputField","Button","Icon","WithComplexChildren"],"mappings":";;;;;;;;AAYA,MAAMA,IAAa;AAAA,8HAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,qBAAqB;AAAA,MACnB,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AAAA,EAEF,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAsC;AAAA,EAC1C,qBAAqB;AAAA,EACrB,QAAQC,EAAA;AACV,GAEMC,IAAY,CAAC,UAAU,UAAU,UAAU,UAAU,QAAQ,GAE7DC,IAAmC,CAACC,wBAAUL,GAAA,EAAU,GAAGK,GAAO,UAAAF,GAAU,GAErEG,IAAkBF,EAAS,KAAK,CAAA,CAAE;AAC/CE,EAAgB,OAAO;AAAA,EACrB,GAAGL;AACL;AAEO,MAAMM,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,GAAGN;AAAA,EACH,qBAAqB;AACvB;AAEA,MAAMO,IAA0C,CAACH,MAC/C,gBAAAI,EAACT,GAAA,EAAU,GAAGK,GACX,UAAAF,EAAU,IAAI,CAACO,MACd,gBAAAC,EAACC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAH,EAAC,OAAA,EAAI,OAAO,EAAE,OAAO,OAAA,GACnB,UAAA,gBAAAA,EAACI,GAAA,EAAsB,IAAIH,GAAM,aAAaA,EAAA,GAA7BA,CAAmC,GACtD;AAAA,EACA,gBAAAD,EAACK,GAAA,EAAO,SAAQ,cACd,UAAA,gBAAAL,EAACM,KAAK,MAAK,SAAQ,OAAM,YAAA,CAAY,EAAA,CACvC;AAAA,KANaL,CAOf,CACD,GACH,GAGWM,IAAsBR,EAAgB,KAAK,CAAA,CAAE;AAC1DQ,EAAoB,OAAO;AAAA,EACzB,GAAGf;AAAA,EACH,cAAc;AAAA,IACZ,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,EAAE;AAEhC;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SortableStateType } from './sortableReducer';
|
|
3
|
+
import { SortableItem, SortableItemProps } from './components/SortableItem';
|
|
3
4
|
type SortableContextType = {
|
|
4
5
|
clearDraggingSource: () => void;
|
|
5
6
|
clearDraggingTarget: () => void;
|
|
@@ -12,13 +13,15 @@ type SortableContextType = {
|
|
|
12
13
|
setDraggingSource: (index: number) => void;
|
|
13
14
|
setDraggingTarget: (index: number) => void;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];
|
|
17
|
+
interface Props<T = unknown> {
|
|
18
|
+
renderItems: SortableItems;
|
|
19
|
+
dataItems: T[];
|
|
18
20
|
scrollable?: boolean;
|
|
19
21
|
hideNumbers?: boolean;
|
|
20
|
-
onSort?: (items:
|
|
22
|
+
onSort?: (items: T[]) => void;
|
|
23
|
+
children?: ReactNode;
|
|
21
24
|
}
|
|
22
|
-
export declare function SortableProvider({
|
|
25
|
+
export declare function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
23
26
|
export declare function useSortable(): SortableContextType & SortableStateType;
|
|
24
27
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "./sortableReducer.js";
|
|
4
|
-
import { S as p, u as a } from "../../SortableProvider-
|
|
4
|
+
import { S as p, u as a } from "../../SortableProvider-DisCfTTN.js";
|
|
5
5
|
import "./actions.js";
|
|
6
6
|
export {
|
|
7
7
|
p as SortableProvider,
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../../clsx-OuTLNxxd.js";
|
|
4
4
|
import "../../../Sortable.module--kgnzOjW.js";
|
|
5
|
-
import { a } from "../../../SortableProvider-
|
|
5
|
+
import { a } from "../../../SortableProvider-DisCfTTN.js";
|
|
6
6
|
export {
|
|
7
7
|
a as SortableContainer
|
|
8
8
|
};
|
|
@@ -4,7 +4,7 @@ import { c as G } from "../../../clsx-OuTLNxxd.js";
|
|
|
4
4
|
import { Icon as w } from "../../Icon/Icon.js";
|
|
5
5
|
import { SortableHandle as E } from "./SortableHandle.js";
|
|
6
6
|
import { s as e } from "../../../Sortable.module--kgnzOjW.js";
|
|
7
|
-
import { u as J } from "../../../SortableProvider-
|
|
7
|
+
import { u as J } from "../../../SortableProvider-DisCfTTN.js";
|
|
8
8
|
const j = ["Space", "ArrowDown", "ArrowUp"], F = "ontouchstart" in globalThis.document.documentElement, C = new Image(0, 0);
|
|
9
9
|
C.src = // 1px transparent png
|
|
10
10
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
|
package/dist/components/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import { Label as Bo } from "./Label/Label.js";
|
|
|
35
35
|
import { MenuLink as So } from "./MenuLink/MenuLink.js";
|
|
36
36
|
import { MetaDataList as Co } from "./MetaDataList/MetaDataList.js";
|
|
37
37
|
import { ModalDialog as ko } from "./ModalDialog/ModalDialog.js";
|
|
38
|
-
import { M as Mo } from "../TablePlugin-
|
|
38
|
+
import { M as Mo } from "../TablePlugin-oF-gInNx.js";
|
|
39
39
|
import { MultiSelectBox as Lo } from "./MultiSelectBox/MultiSelectBox.js";
|
|
40
40
|
import { Notification as Ro } from "./Notification/Notification.js";
|
|
41
41
|
import { OverlayCloseButton as ho } from "./OverlayCloseButton/OverlayCloseButton.js";
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import { Label as Bo } from "./components/Label/Label.js";
|
|
|
35
35
|
import { MenuLink as So } from "./components/MenuLink/MenuLink.js";
|
|
36
36
|
import { MetaDataList as Co } from "./components/MetaDataList/MetaDataList.js";
|
|
37
37
|
import { ModalDialog as ko } from "./components/ModalDialog/ModalDialog.js";
|
|
38
|
-
import { M as Mo } from "./TablePlugin-
|
|
38
|
+
import { M as Mo } from "./TablePlugin-oF-gInNx.js";
|
|
39
39
|
import { MultiSelectBox as Lo } from "./components/MultiSelectBox/MultiSelectBox.js";
|
|
40
40
|
import { Notification as Ro } from "./components/Notification/Notification.js";
|
|
41
41
|
import { OverlayCloseButton as ho } from "./components/OverlayCloseButton/OverlayCloseButton.js";
|
package/package.json
CHANGED
|
@@ -1,153 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAeC,GAAiC;AACvD,UAAMC,IAAoBN,EAAa;AAEvC,QAAI,CAACM,GAAmB,gBAAiB;AAEzC,UAAMC,IAAeF,EAAM;AAI3B,WAHmB,MAAM,KAAKC,EAAkB,UAAU,EAC3B,UAAU,CAACE,MAASA,EAAK,YAAYD,CAAY,CAAC;AAAA,EAE1E;AAGT,WAASE,EAAWJ,GAAiC;AACnD,UAAMK,IAAcN,EAAeC,CAAK;AAExC,IAAIK,MAAgB,WAEhBlB,KAASU,EAAW,WAASA,EAAW,QAAQ,YAAYV,CAAK,GAErEE,EAAKgB,CAAW;AAAA,EAAA;AAGlB,WAASC,EAAeN,GAAiC;AAKvD,QAHAA,EAAM,eAAA,GACNA,EAAM,aAAa,aAAa,QAE5Bb,GAAO;AACT,Y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