@uva-glass/component-library 1.58.0 → 1.59.1

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.
Files changed (39) hide show
  1. package/dist/Sortable.module-DDhRFD1T.js +23 -0
  2. package/dist/Sortable.module-DDhRFD1T.js.map +1 -0
  3. package/dist/{SortableProvider-i4PDjRS_.js → SortableProvider-BUsvniX7.js} +2 -2
  4. package/dist/{SortableProvider-i4PDjRS_.js.map → SortableProvider-BUsvniX7.js.map} +1 -1
  5. package/dist/{TablePlugin-1L5UZfDH.js → TablePlugin-Cj6IBz2k.js} +2 -2
  6. package/dist/{TablePlugin-1L5UZfDH.js.map → TablePlugin-Cj6IBz2k.js.map} +1 -1
  7. package/dist/assets/Sortable.css +1 -1
  8. package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
  9. package/dist/components/InputField/InputField.stories.js +2 -2
  10. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  11. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  12. package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
  13. package/dist/components/MultiSelect/index.js +1 -1
  14. package/dist/components/Periods/Periods.d.ts +8 -3
  15. package/dist/components/Periods/Periods.js +36 -29
  16. package/dist/components/Periods/Periods.js.map +1 -1
  17. package/dist/components/Periods/Periods.stories.js +16 -11
  18. package/dist/components/Periods/Periods.stories.js.map +1 -1
  19. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
  20. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
  21. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
  22. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +2 -2
  23. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +2 -2
  24. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
  25. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +2 -2
  26. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  27. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +1 -1
  28. package/dist/components/RteEditor/Plugins/index.js +1 -1
  29. package/dist/components/RteEditor/RteEditor.js +2 -2
  30. package/dist/components/Sortable/Sortable.js +1 -1
  31. package/dist/components/Sortable/SortableProvider.js +1 -1
  32. package/dist/components/Sortable/components/SortableContainer.js +2 -2
  33. package/dist/components/Sortable/components/SortableHandle.js +1 -1
  34. package/dist/components/Sortable/components/SortableItem.js +2 -2
  35. package/dist/components/index.js +1 -1
  36. package/dist/index.js +1 -1
  37. package/package.json +6 -6
  38. package/dist/Sortable.module-uk_YuFs1.js +0 -24
  39. package/dist/Sortable.module-uk_YuFs1.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ import './assets/Sortable.css';const _ = "_sortable__wrapper_pdpg0_1", t = "_sortable__container_pdpg0_13", e = "_sortable__handle_pdpg0_149", r = {
2
+ sortable__wrapper: _,
3
+ "sortable__wrapper--scrollable": "_sortable__wrapper--scrollable_pdpg0_5",
4
+ sortable__container: t,
5
+ "sortable__drop-target": "_sortable__drop-target_pdpg0_25",
6
+ "sortable__sort-item": "_sortable__sort-item_pdpg0_56",
7
+ "sortable__sort-item--ghost": "_sortable__sort-item--ghost_pdpg0_72",
8
+ "sortable__sort-item__handle": "_sortable__sort-item__handle_pdpg0_83",
9
+ "sortable__sort-item__button-container": "_sortable__sort-item__button-container_pdpg0_93",
10
+ "sortable__sort-item__handle--icon": "_sortable__sort-item__handle--icon_pdpg0_112",
11
+ "sortable__sort-item__handle--up": "_sortable__sort-item__handle--up_pdpg0_119",
12
+ "sortable__sort-item__handle--down": "_sortable__sort-item__handle--down_pdpg0_120",
13
+ "sortable__sort-item--dragging": "_sortable__sort-item--dragging_pdpg0_131",
14
+ "sortable__sort-item__contents": "_sortable__sort-item__contents_pdpg0_135",
15
+ "sortable__sort-item__contents--handle-right": "_sortable__sort-item__contents--handle-right_pdpg0_144",
16
+ sortable__handle: e,
17
+ "sortable__handle--right": "_sortable__handle--right_pdpg0_155",
18
+ "sortable__visually-hidden": "_sortable__visually-hidden_pdpg0_173"
19
+ };
20
+ export {
21
+ r as s
22
+ };
23
+ //# sourceMappingURL=Sortable.module-DDhRFD1T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sortable.module-DDhRFD1T.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import { jsx as f } from "react/jsx-runtime";
2
2
  import { useRef as b, useEffect as w, cloneElement as R, createContext as O, useReducer as A, useContext as L, Children as _ } from "react";
3
3
  import { sortableReducer as j, initialState as q } from "./components/Sortable/sortableReducer.js";
4
4
  import { c as N } from "./clsx-OuTLNxxd.js";
5
- import { s as u } from "./Sortable.module-uk_YuFs1.js";
5
+ import { s as u } from "./Sortable.module-DDhRFD1T.js";
6
6
  import { setDraggingSource as B, setDraggingTarget as H, moveToPosition as X, clearDraggingTarget as Y, clearDraggingSource as k, drop as z, dragStart as F, dragEnd as G, reset as J, setClone as K } from "./components/Sortable/actions.js";
7
7
  function M({ scrollable: i, onSort: a }) {
8
8
  const { clone: n, draggingTarget: p, drop: x, sortableItems: D, setDraggingTarget: o, reset: S, indices: s } = U(), l = b(null), c = b(null), d = b(s);
@@ -149,4 +149,4 @@ export {
149
149
  M as a,
150
150
  U as u
151
151
  };
152
- //# sourceMappingURL=SortableProvider-i4PDjRS_.js.map
152
+ //# sourceMappingURL=SortableProvider-BUsvniX7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SortableProvider-i4PDjRS_.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 onSort?: OnSort;\n}\n\nexport function SortableContainer({ scrollable, 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={styles['sortable__drop-target']}\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 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, 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} 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","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","_a","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":";;;;;;AAeO,SAASA,EAAkB,EAAE,YAAAC,GAAY,QAAAC,KAAkC;AAC1E,QAAA,EAAE,OAAAC,GAAO,gBAAAC,GAAgB,MAAAC,GAAM,eAAAC,GAAe,mBAAAC,GAAmB,OAAAC,GAAO,SAAAC,MAAYC,KACpFC,IAAeC,EAAyB,IAAI,GAC5CC,IAAaD,EAAuB,IAAI,GACxCE,IAAaF,EAAiBH,CAAO;AAE3C,WAASM,EAAeC,GAAiC;AACvD,UAAMC,IAAoBN,EAAa;AAEnC,QAAA,EAACM,KAAA,QAAAA,EAAmB,iBAAiB;AAEzC,UAAMC,IAAeF,EAAM;AAIpB,WAHY,MAAM,KAAKC,EAAkB,UAAU,EAC3B,UAAU,CAACE,MAASA,EAAK,YAAYD,CAAY,CAAC;AAAA,EAGnF;AAEA,WAASE,EAAWJ,GAAiC;AAC7C,UAAAK,IAAcN,EAAeC,CAAK;AAExC,IAAIK,MAAgB,WAEhBlB,KAASU,EAAW,WAAoBA,EAAA,QAAQ,YAAYV,CAAK,GAErEE,EAAKgB,CAAW;AAAA,EAClB;AAEA,WAASC,EAAeN,GAAiC;AAKvD,QAHAA,EAAM,eAAe,GACrBA,EAAM,aAAa,aAAa,QAE5Bb,GAAO;AACH,YAAA,EAAE,SAAAoB,GAAS,SAAAC,EAAY,IAAAR,GACvB,EAAE,GAAAS,GAAG,GAAAC,GAAG,OAAAC,GAAO,QAAAC,MAAWZ,EAAM,cAAc,yBAE9Ca,IAAeD,IAAS,KAAKJ,IAAUE;AAGvC,MAAAvB,EAAA;AAAA,QACJ;AAAA,QACA;AAAA,gBACQoB,KAAWA,IAAUE,EAAE;AAAA,eACxBC,IAAIG,CAAY;AAAA,kBACbD,CAAM;AAAA,iBACP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;AACN,IAAA2C,EAAAiB,GAAe;AAAA,EAC1B;AAEA,WAASC,EAASlD,GAAe;AACtB,IAAAgC,EAAAmB,EAAiBnD,CAAI,CAAC;AAAA,EACjC;AAEA,WAASoD,EAAaC,GAAyB;AACvC,UAAAC,IAAcD,EAAc,IAAI,CAAClC,MAAUW,EAAgB,QAAQX,CAAK,CAAC;AAC/E,IAAApC,KAAUA,EAAOuE,CAAW;AAAA,EAC9B;AAGE,SAAA,gBAAAvC;AAAA,IAACM,EAAgB;AAAA,IAAhB;AAAA,MACC,OAAO;AAAA,QACL,GAAGU;AAAA,QAAA,qBACHW;AAAAA,QAAA,qBACAF;AAAAA,QAAA,SACAO;AAAAA,QAAA,WACAF;AAAAA,QAAA,MACA3D;AAAAA,QAAA,gBACAoD;AAAAA,QAAA,OACAjD;AAAAA,QAAA,UACA6D;AAAAA,QAAA,mBACAf;AAAAA,QAAA,mBACA/C;AAAAA,MACF;AAAA,MAEA,UAAC,gBAAA2B,EAAAlC,GAAA,EAAkB,YAAAC,GAAwB,QAAQsE,GAAc;AAAA,IAAA;AAAA,EAAA;AAGvE;AAEO,SAAS7D,IAAc;AACtB,QAAAgE,IAAUC,EAAWnC,CAAe;AAE1C,MAAIkC,MAAY;AACR,UAAA,IAAI,MAAM,oDAAoD;AAG/D,SAAAA;AACT;"}
1
+ {"version":3,"file":"SortableProvider-BUsvniX7.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 onSort?: OnSort;\n}\n\nexport function SortableContainer({ scrollable, 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={styles['sortable__drop-target']}\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 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, 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} 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","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","_a","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":";;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C,IAAcD,EAAc,IAAI,CAAClC,MAAUW,EAAgB,QAAQX,CAAK,CAAC;AAC/E,IAAApC,KAAUA,EAAOuE,CAAW;AAAA,EAC9B;AAGE,SAAA,gBAAAvC;AAAA,IAACM,EAAgB;AAAA,IAAhB;AAAA,MACC,OAAO;AAAA,QACL,GAAGU;AAAA,QAAA,qBACHW;AAAAA,QAAA,qBACAF;AAAAA,QAAA,SACAO;AAAAA,QAAA,WACAF;AAAAA,QAAA,MACA3D;AAAAA,QAAA,gBACAoD;AAAAA,QAAA,OACAjD;AAAAA,QAAA,UACA6D;AAAAA,QAAA,mBACAf;AAAAA,QAAA,mBACA/C;AAAAA,MACF;AAAA,MAEA,UAAC,gBAAA2B,EAAAlC,GAAA,EAAkB,YAAAC,GAAwB,QAAQsE,GAAc;AAAA,IAAA;AAAA,EAAA;AAGvE;AAEO,SAAS7D,IAAc;AACtB,QAAAgE,IAAUC,EAAWnC,CAAe;AAE1C,MAAIkC,MAAY;AACR,UAAA,IAAI,MAAM,oDAAoD;AAG/D,SAAAA;AACT;"}
@@ -30,7 +30,7 @@ import "./components/RteEditor/Providers/LanguageProvider.js";
30
30
  import "./components/SelectListbox/SelectListbox.js";
31
31
  import "./components/SelectListbox/SelectProvider.js";
32
32
  import "./components/Sortable/components/SortableItem.js";
33
- import "./SortableProvider-i4PDjRS_.js";
33
+ import "./SortableProvider-BUsvniX7.js";
34
34
  import { useTranslation as A } from "./components/RteEditor/hooks/useTranslation.js";
35
35
  import './assets/TablePlugin.css';function se({ label: p, clearTrigger: d, onClear: s }) {
36
36
  return /* @__PURE__ */ m("header", { className: F["multi-select__header"], children: [
@@ -246,4 +246,4 @@ export {
246
246
  se as a,
247
247
  de as b
248
248
  };
249
- //# sourceMappingURL=TablePlugin-1L5UZfDH.js.map
249
+ //# sourceMappingURL=TablePlugin-Cj6IBz2k.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TablePlugin-1L5UZfDH.js","sources":["../src/components/MultiSelect/components/MultiSelectHeader.tsx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/RteEditor/Plugins/LinkPlugin/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 } from 'react';\n\nimport type { ChangeEvent } from 'react';\nimport type { LinkType } from 'components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin';\n\nimport { validateUrlWithProtocol } from './helpers';\nimport styles from './AddLinkForm.module.css';\n\nimport { Button, Checkbox, FeedbackBox, FormField, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ninterface AddLinkFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (url: string, target: string) => void;\n onRemoveHandler?: () => void;\n isLink: LinkType;\n}\n\nexport interface addLinkFormMethods {\n clearForm: () => void;\n focusFirstField: () => void;\n setDefaults: (url: string, target: boolean) => void;\n}\n\nexport const AddLinkForm = forwardRef(\n (\n {\n onCloseHandler,\n onSaveHandler,\n onRemoveHandler,\n isLink = { active: false, url: '', target: '_self' },\n }: AddLinkFormProps,\n ref\n ): JSX.Element => {\n const t = useTranslation();\n const [target, setTarget] = useState<boolean>(isLink.target === '_blank');\n const [url, setUrl] = useState<string>(isLink.url);\n const [urlError, setUrlError] = useState<string | null>(null);\n const firstField = useRef<HTMLInputElement>(null);\n\n const handleUrl = (event: ChangeEvent<HTMLInputElement>) => {\n setUrl(event.target.value);\n };\n\n const handleTargetChange = () => {\n setTarget((prev) => !prev);\n };\n\n const validateUrl = (url: string): boolean => {\n if ((!url && url.trim() === '') || validateUrlWithProtocol(url) === false) {\n setUrlError(t.errortext.urlNotValid);\n return false;\n }\n setUrlError(null);\n return true;\n };\n\n const handleSave = () => {\n if (!validateUrl(url)) {\n return;\n }\n onSaveHandler(url, target ? '_blank' : '_self');\n resetForm();\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setUrl('');\n setUrlError(null);\n };\n\n const handleRemoveHandler = () => {\n if (onRemoveHandler) {\n onRemoveHandler();\n resetForm();\n }\n };\n\n const setDefaults = (url: string, target: boolean) => {\n setUrl(url);\n setTarget(target);\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=\"linkUrl\">{t.links.linkLabel}</Label>\n <InputField\n id=\"linkUrl\"\n placeholder=\"http(s)://\"\n value={url ? url : ''}\n onChange={(event) => handleUrl(event)}\n onFocus={() => setUrlError(null)}\n ref={firstField}\n />\n {urlError && <FeedbackBox level=\"error\" feedback={urlError} />}\n </FormField>\n <FormField inline>\n <Checkbox id=\"linkTarget\" onChange={handleTargetChange} checked={target} />\n <Label htmlFor=\"linkTarget\">{t.links.linkTarget}</Label>\n </FormField>\n <div className={styles['linkform__footer']}>\n <Button variant={'secondary'} onClick={handleClose}>\n {t.common.cancel}\n </Button>\n {url && (\n <Button variant={'secondary'} onClick={handleRemoveHandler}>\n {t.links.deleteLink}\n </Button>\n )}\n <Button variant={'primary'} onClick={handleSave}>\n {url ? t.links.changeLink : t.links.addLink}\n </Button>\n </div>\n </div>\n );\n }\n);\n","import { useState, forwardRef, useImperativeHandle, useRef } 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';\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\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 return (\n <div className={styles['tableform']}>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor=\"nrOfRows\">{t.table.nrofRows}</Label>\n <InputField\n id=\"nrOfRows\"\n placeholder={t.table.nrofRowsPlaceholder}\n value={rowCount ? rowCount : ''}\n onChange={(event) => handleDimentionChange(event, 'row')}\n ref={firstField}\n />\n </FormField>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor=\"nrOfColumns\">{t.table.nrofColumns}</Label>\n <InputField\n id=\"nrOfColumns\"\n placeholder={t.table.nrofColumnsPlaceholder}\n value={columnCount ? columnCount : ''}\n onChange={(event) => handleDimentionChange(event, 'column')}\n />\n </FormField>\n <div className={styles['tableform__footer']}>\n <Button variant={'secondary'} onClick={handleClose}>\n {t.common.cancel}\n </Button>\n <Button variant={'primary'} onClick={handleSave} disabled={!rowCount || !columnCount}>\n {t.common.add}\n </Button>\n </div>\n </div>\n );\n});\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport clsx from 'clsx';\nimport { $isTableCellNode } from '@lexical/table';\nimport { $getSelection, $isRangeSelection, $getRoot } from 'lexical';\nimport { useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\n\nimport type { TextNode, ElementNode } 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';\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 [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, closeFlyout, isVisible } = useFlyout();\n const addTableForm = useRef<addTableForm>();\n const buttonRef = useRef<HTMLButtonElement>(null);\n const preventOpen = useRef(false);\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 let currentNode: TextNode | ElementNode | null = anchorNode;\n\n while (currentNode !== null) {\n if ($isRangeSelection(selection)) {\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 currentNode = currentNode.getParent();\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 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={() => !preventOpen.current && showFlyout(flyoutOptions)}\n className={clsx(styles['editor__toolbar-button'], isActive && styles[`editor__toolbar-button--active`])}\n aria-label={`Table`}\n ref={buttonRef}\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","onRemoveHandler","isLink","ref","t","useTranslation","target","setTarget","useState","url","setUrl","urlError","setUrlError","firstField","useRef","handleUrl","event","handleTargetChange","prev","validateUrl","validateUrlWithProtocol","handleSave","resetForm","handleClose","handleRemoveHandler","setDefaults","focusFirstField","useImperativeHandle","FormField","InputField","FeedbackBox","Checkbox","AddTableForm","rowCount","setRowCount","columnCount","setColumnCount","handleDimentionChange","type","value","_a","PREVENT_OPEN_DELAY","TablePlugin","isActive","editor","useLexicalComposerContext","flyout","showFlyout","closeFlyout","isVisible","useFlyout","addTableForm","buttonRef","preventOpen","insertTable","nrOfRows","nrOfColumns","selection","$getSelection","tableNode","createTable","$isRangeSelection","$getRoot","firstDescendant","mutateTable","action","currentNode","$isTableCellNode","insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","flyoutOptions","rows","columns","useEffect","_b","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,GAAkB,EAAE,OAAAC,GAAO,cAAAC,GAAc,SAAAC,KAAmC;AAC1F,SACG,gBAAAC,EAAA,UAAA,EAAO,WAAWC,EAAO,sBAAsB,GAC9C,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAM,SAAQ,qB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sx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/RteEditor/Plugins/LinkPlugin/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 } from 'react';\n\nimport type { ChangeEvent } from 'react';\nimport type { LinkType } from 'components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin';\n\nimport { validateUrlWithProtocol } from './helpers';\nimport styles from './AddLinkForm.module.css';\n\nimport { Button, Checkbox, FeedbackBox, FormField, InputField, Label } from 'components';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ninterface AddLinkFormProps {\n onCloseHandler: () => void;\n onSaveHandler: (url: string, target: string) => void;\n onRemoveHandler?: () => void;\n isLink: LinkType;\n}\n\nexport interface addLinkFormMethods {\n clearForm: () => void;\n focusFirstField: () => void;\n setDefaults: (url: string, target: boolean) => void;\n}\n\nexport const AddLinkForm = forwardRef(\n (\n {\n onCloseHandler,\n onSaveHandler,\n onRemoveHandler,\n isLink = { active: false, url: '', target: '_self' },\n }: AddLinkFormProps,\n ref\n ): JSX.Element => {\n const t = useTranslation();\n const [target, setTarget] = useState<boolean>(isLink.target === '_blank');\n const [url, setUrl] = useState<string>(isLink.url);\n const [urlError, setUrlError] = useState<string | null>(null);\n const firstField = useRef<HTMLInputElement>(null);\n\n const handleUrl = (event: ChangeEvent<HTMLInputElement>) => {\n setUrl(event.target.value);\n };\n\n const handleTargetChange = () => {\n setTarget((prev) => !prev);\n };\n\n const validateUrl = (url: string): boolean => {\n if ((!url && url.trim() === '') || validateUrlWithProtocol(url) === false) {\n setUrlError(t.errortext.urlNotValid);\n return false;\n }\n setUrlError(null);\n return true;\n };\n\n const handleSave = () => {\n if (!validateUrl(url)) {\n return;\n }\n onSaveHandler(url, target ? '_blank' : '_self');\n resetForm();\n };\n\n const handleClose = () => {\n onCloseHandler();\n resetForm();\n };\n\n const resetForm = () => {\n setUrl('');\n setUrlError(null);\n };\n\n const handleRemoveHandler = () => {\n if (onRemoveHandler) {\n onRemoveHandler();\n resetForm();\n }\n };\n\n const setDefaults = (url: string, target: boolean) => {\n setUrl(url);\n setTarget(target);\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=\"linkUrl\">{t.links.linkLabel}</Label>\n <InputField\n id=\"linkUrl\"\n placeholder=\"http(s)://\"\n value={url ? url : ''}\n onChange={(event) => handleUrl(event)}\n onFocus={() => setUrlError(null)}\n ref={firstField}\n />\n {urlError && <FeedbackBox level=\"error\" feedback={urlError} />}\n </FormField>\n <FormField inline>\n <Checkbox id=\"linkTarget\" onChange={handleTargetChange} checked={target} />\n <Label htmlFor=\"linkTarget\">{t.links.linkTarget}</Label>\n </FormField>\n <div className={styles['linkform__footer']}>\n <Button variant={'secondary'} onClick={handleClose}>\n {t.common.cancel}\n </Button>\n {url && (\n <Button variant={'secondary'} onClick={handleRemoveHandler}>\n {t.links.deleteLink}\n </Button>\n )}\n <Button variant={'primary'} onClick={handleSave}>\n {url ? t.links.changeLink : t.links.addLink}\n </Button>\n </div>\n </div>\n );\n }\n);\n","import { useState, forwardRef, useImperativeHandle, useRef } 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';\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\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 return (\n <div className={styles['tableform']}>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor=\"nrOfRows\">{t.table.nrofRows}</Label>\n <InputField\n id=\"nrOfRows\"\n placeholder={t.table.nrofRowsPlaceholder}\n value={rowCount ? rowCount : ''}\n onChange={(event) => handleDimentionChange(event, 'row')}\n ref={firstField}\n />\n </FormField>\n <FormField className={styles['tableform__input-field']}>\n <Label htmlFor=\"nrOfColumns\">{t.table.nrofColumns}</Label>\n <InputField\n id=\"nrOfColumns\"\n placeholder={t.table.nrofColumnsPlaceholder}\n value={columnCount ? columnCount : ''}\n onChange={(event) => handleDimentionChange(event, 'column')}\n />\n </FormField>\n <div className={styles['tableform__footer']}>\n <Button variant={'secondary'} onClick={handleClose}>\n {t.common.cancel}\n </Button>\n <Button variant={'primary'} onClick={handleSave} disabled={!rowCount || !columnCount}>\n {t.common.add}\n </Button>\n </div>\n </div>\n );\n});\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport clsx from 'clsx';\nimport { $isTableCellNode } from '@lexical/table';\nimport { $getSelection, $isRangeSelection, $getRoot } from 'lexical';\nimport { useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\n\nimport type { TextNode, ElementNode } 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';\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 [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, closeFlyout, isVisible } = useFlyout();\n const addTableForm = useRef<addTableForm>();\n const buttonRef = useRef<HTMLButtonElement>(null);\n const preventOpen = useRef(false);\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 let currentNode: TextNode | ElementNode | null = anchorNode;\n\n while (currentNode !== null) {\n if ($isRangeSelection(selection)) {\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 currentNode = currentNode.getParent();\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 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={() => !preventOpen.current && showFlyout(flyoutOptions)}\n className={clsx(styles['editor__toolbar-button'], isActive && styles[`editor__toolbar-button--active`])}\n aria-label={`Table`}\n ref={buttonRef}\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","onRemoveHandler","isLink","ref","t","useTranslation","target","setTarget","useState","url","setUrl","urlError","setUrlError","firstField","useRef","handleUrl","event","handleTargetChange","prev","validateUrl","validateUrlWithProtocol","handleSave","resetForm","handleClose","handleRemoveHandler","setDefaults","focusFirstField","useImperativeHandle","FormField","InputField","FeedbackBox","Checkbox","AddTableForm","rowCount","setRowCount","columnCount","setColumnCount","handleDimentionChange","type","value","_a","PREVENT_OPEN_DELAY","TablePlugin","isActive","editor","useLexicalComposerContext","flyout","showFlyout","closeFlyout","isVisible","useFlyout","addTableForm","buttonRef","preventOpen","insertTable","nrOfRows","nrOfColumns","selection","$getSelection","tableNode","createTable","$isRangeSelection","$getRoot","firstDescendant","mutateTable","action","currentNode","$isTableCellNode","insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","flyoutOptions","rows","columns","useEffect","_b","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,GAAkB,EAAE,OAAAC,GAAO,cAAAC,GAAc,SAAAC,KAAmC;AAC1F,SACG,gBAAAC,EAAA,UAAA,EAAO,WAAWC,EAAO,sBAAsB,GAC9C,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAM,SAAQ,qBAAqB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var(--color-pattens-blue);border-top:1px solid var(--color-pattens-blue);margin-bottom:1rem;max-height:21rem;overflow-y:auto}._sortable__container_td575_13{--item-min-height: 3.75rem;counter-reset:container;display:flex;flex-direction:column;gap:1rem;list-style:none;margin:1rem 1rem 1rem 0;padding:0}._sortable__drop-target_td575_25{display:flex;gap:1rem;min-height:var(--item-min-height);position:relative}._sortable__drop-target_td575_25:before{align-items:center;content:counter(container);counter-increment:container;display:flex;opacity:1;position:relative;transition:opacity .25s}._sortable__drop-target_td575_25:after{content:"";display:block;height:1px;left:0;position:absolute;width:100%;z-index:1}._sortable__drop-target_td575_25:last-child:after{display:inline}._sortable__sort-item_td575_56{align-items:center;background-color:var(--color-grey-50);border-radius:.5rem;display:flex;gap:1rem;min-height:var(--item-min-height);position:relative;width:100%;z-index:0}._sortable__sort-item_td575_56:focus{z-index:2}._sortable__sort-item--ghost_td575_72{margin:0 1rem;opacity:.5;padding:.5rem 0;pointer-events:none;position:fixed;-webkit-user-drag:none;visibility:hidden;z-index:2}._sortable__container--drag-over_td575_83 ._sortable__drop-target_td575_25:before,._sortable__sort-item--ghost_td575_72:before{opacity:0}._sortable__sort-item__handle_td575_88{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;background-color:var(--color-white);border:0;cursor:grab;height:2.625rem;width:2.625rem}._sortable__sort-item__button-container_td575_98{align-items:center;background-color:var(--color-pattens-blue);border-left:1px solid var(--color-pattens-blue);border-radius:0 .5rem .5rem 0;display:flex;flex-direction:column;inset:0 0 0 auto;margin-right:1px;overflow:hidden;position:absolute;width:2.625rem;z-index:20}._sortable__sort-item__button-container_td575_98[data-touch=false]{display:none}._sortable__sort-item__handle--icon_td575_117{align-items:center;display:flex;height:1rem;width:1rem}._sortable__sort-item__handle--up_td575_124,._sortable__sort-item__handle--down_td575_125{color:#000;display:none;height:100%;right:.5rem}._sortable__sort-item__handle--up_td575_124{transform:rotate(180deg)}._sortable__sort-item--dragging_td575_136 ._sortable__sort-item__handle_td575_88{cursor:grabbing}._sortable__sort-item__contents_td575_140{align-items:center;color:var(--color-uva-black);display:flex;gap:.5rem;padding:.5rem;width:100%}._sortable__sort-item__contents--handle-right_td575_149{padding-left:1rem;padding-right:2.5rem}._sortable__handle_td575_154{color:var(--color-grey-500);cursor:grab;display:flex}._sortable__handle--right_td575_160{position:absolute;right:.5rem}._sortable__sort-item__button-container_td575_98[data-touch=true]{gap:1px;justify-content:center}._sortable__sort-item__button-container_td575_98[data-touch=true] ._sortable__sort-item__handle--up_td575_124,._sortable__sort-item__button-container_td575_98[data-touch=true] ._sortable__sort-item__handle--down_td575_125{align-items:center;display:flex;justify-content:center}._sortable__visually-hidden_td575_178{border:0;clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
1
+ ._sortable__wrapper_pdpg0_1{position:relative}._sortable__wrapper--scrollable_pdpg0_5{border-bottom:1px solid var(--color-pattens-blue);border-top:1px solid var(--color-pattens-blue);margin-bottom:1rem;max-height:21rem;overflow-y:auto}._sortable__container_pdpg0_13{--item-min-height: 3.75rem;counter-reset:container;display:flex;flex-direction:column;gap:1rem;list-style:none;margin:1rem 1rem 1rem 0;padding:0}._sortable__drop-target_pdpg0_25{display:flex;gap:1rem;min-height:var(--item-min-height);position:relative}._sortable__drop-target_pdpg0_25:before{align-items:center;content:counter(container);counter-increment:container;display:flex;opacity:1;position:relative;transition:opacity .25s}._sortable__drop-target_pdpg0_25:after{content:"";display:block;height:1px;left:0;position:absolute;width:100%;z-index:1}._sortable__drop-target_pdpg0_25:last-child:after{display:inline}._sortable__sort-item_pdpg0_56{align-items:center;background-color:var(--color-grey-50);border-radius:.5rem;display:flex;gap:1rem;min-height:var(--item-min-height);position:relative;width:100%;z-index:0}._sortable__sort-item_pdpg0_56:focus{z-index:2}._sortable__sort-item--ghost_pdpg0_72{margin:0 1rem;opacity:.5;padding:.5rem 0;pointer-events:none;position:fixed;-webkit-user-drag:none;visibility:hidden;z-index:2}._sortable__sort-item__handle_pdpg0_83{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;background-color:var(--color-white);border:0;cursor:grab;height:2.625rem;width:2.625rem}._sortable__sort-item__button-container_pdpg0_93{align-items:center;background-color:var(--color-pattens-blue);border-left:1px solid var(--color-pattens-blue);border-radius:0 .5rem .5rem 0;display:flex;flex-direction:column;inset:0 0 0 auto;margin-right:1px;overflow:hidden;position:absolute;width:2.625rem;z-index:20}._sortable__sort-item__button-container_pdpg0_93[data-touch=false]{display:none}._sortable__sort-item__handle--icon_pdpg0_112{align-items:center;display:flex;height:1rem;width:1rem}._sortable__sort-item__handle--up_pdpg0_119,._sortable__sort-item__handle--down_pdpg0_120{color:#000;display:none;height:100%;right:.5rem}._sortable__sort-item__handle--up_pdpg0_119{transform:rotate(180deg)}._sortable__sort-item--dragging_pdpg0_131 ._sortable__sort-item__handle_pdpg0_83{cursor:grabbing}._sortable__sort-item__contents_pdpg0_135{align-items:center;color:var(--color-uva-black);display:flex;gap:.5rem;padding:.5rem;width:100%}._sortable__sort-item__contents--handle-right_pdpg0_144{padding-left:1rem;padding-right:2.5rem}._sortable__handle_pdpg0_149{color:var(--color-grey-500);cursor:grab;display:flex}._sortable__handle--right_pdpg0_155{position:absolute;right:.5rem}._sortable__sort-item__button-container_pdpg0_93[data-touch=true]{gap:1px;justify-content:center}._sortable__sort-item__button-container_pdpg0_93[data-touch=true] ._sortable__sort-item__handle--up_pdpg0_119,._sortable__sort-item__button-container_pdpg0_93[data-touch=true] ._sortable__sort-item__handle--down_pdpg0_120{align-items:center;display:flex;justify-content:center}._sortable__visually-hidden_pdpg0_173{border:0;clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
@@ -17,13 +17,13 @@ import "../IconButton/IconButton.js";
17
17
  import "../Input/Input.js";
18
18
  import "../InputField/InputField.js";
19
19
  import "react-router-dom";
20
- import "../../TablePlugin-1L5UZfDH.js";
20
+ import "../../TablePlugin-Cj6IBz2k.js";
21
21
  import "../RteEditor/hooks/components/Flyout.js";
22
22
  import "../RteEditor/Providers/LanguageProvider.js";
23
23
  import "../SelectListbox/SelectListbox.js";
24
24
  import "../SelectListbox/SelectProvider.js";
25
25
  import "../Sortable/components/SortableItem.js";
26
- import "../../SortableProvider-i4PDjRS_.js";
26
+ import "../../SortableProvider-BUsvniX7.js";
27
27
  import { useResponsive as j } from "../hooks/useResponsive.js";
28
28
  import '../../assets/CheckboxTree.css';const o = {
29
29
  "checkbox-tree__header": "_checkbox-tree__header_xbe4e_1",
@@ -15,13 +15,13 @@ import "../GridRow/GridRow.js";
15
15
  import "../IconButton/IconButton.js";
16
16
  import "../Input/Input.js";
17
17
  import "react-router-dom";
18
- import "../../TablePlugin-1L5UZfDH.js";
18
+ import "../../TablePlugin-Cj6IBz2k.js";
19
19
  import "../RteEditor/hooks/components/Flyout.js";
20
20
  import "../RteEditor/Providers/LanguageProvider.js";
21
21
  import "../SelectListbox/SelectListbox.js";
22
22
  import "../SelectListbox/SelectProvider.js";
23
23
  import "../Sortable/components/SortableItem.js";
24
- import "../../SortableProvider-i4PDjRS_.js";
24
+ import "../../SortableProvider-BUsvniX7.js";
25
25
  const C = `
26
26
  // Has all HTMLInputElement props available except "className" and "style"
27
27
  <InputField aria-labelledby={aria-labelledby} id={id} onChange={onChangeFunction}
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../clsx-OuTLNxxd.js";
3
3
  import "../../MultiSelectItem-D9PxdX43.js";
4
- import { M as p } from "../../TablePlugin-1L5UZfDH.js";
4
+ import { M as p } from "../../TablePlugin-Cj6IBz2k.js";
5
5
  export {
6
6
  p as MultiSelect
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as S, jsx as r } from "react/jsx-runtime";
2
2
  import { fn as d } from "../../index-MQ0yPLdl.js";
3
3
  import { useState as p } from "react";
4
- import { M as e } from "../../TablePlugin-1L5UZfDH.js";
4
+ import { M as e } from "../../TablePlugin-Cj6IBz2k.js";
5
5
  import { Container as M } from "../../storyComponents/Container/Container.js";
6
6
  const C = `
7
7
  // MultiSelectHeader can be added optionally
@@ -14,13 +14,13 @@ import "../../IconButton/IconButton.js";
14
14
  import "../../Input/Input.js";
15
15
  import "../../InputField/InputField.js";
16
16
  import "react-router-dom";
17
- import { a as q } from "../../../TablePlugin-1L5UZfDH.js";
17
+ import { a as q } from "../../../TablePlugin-Cj6IBz2k.js";
18
18
  import "../../RteEditor/hooks/components/Flyout.js";
19
19
  import "../../RteEditor/Providers/LanguageProvider.js";
20
20
  import "../../SelectListbox/SelectListbox.js";
21
21
  import "../../SelectListbox/SelectProvider.js";
22
22
  import "../../Sortable/components/SortableItem.js";
23
- import "../../../SortableProvider-i4PDjRS_.js";
23
+ import "../../../SortableProvider-BUsvniX7.js";
24
24
  export {
25
25
  q as MultiSelectHeader
26
26
  };
@@ -1,4 +1,4 @@
1
- import { M as l } from "../../TablePlugin-1L5UZfDH.js";
1
+ import { M as l } from "../../TablePlugin-Cj6IBz2k.js";
2
2
  export {
3
3
  l as MultiSelect
4
4
  };
@@ -4,14 +4,19 @@ interface Period {
4
4
  semesterNumber: number;
5
5
  periodInSemester: number;
6
6
  }
7
+ interface TooltipTranslations {
8
+ period: string;
9
+ periods: string;
10
+ and: string;
11
+ }
7
12
  export interface PeriodsProps {
8
13
  /** Indicates which periods are selected. */
9
14
  periods: Period[] | number[];
10
15
  /** Indicates the maximum number of periods to show in the selector. */
11
16
  maxPeriods?: 6 | 7;
12
- /** A mapping for the tooltips of each period indicator. */
13
- titlePeriods?: Record<string, Record<string, string>>;
17
+ /** A object of translations for the tooltip. */
18
+ tooltipTranslations?: TooltipTranslations;
14
19
  }
15
20
  /** Represents a component for a period indicator. */
16
- export declare const Periods: ({ periods, titlePeriods, maxPeriods }: PeriodsProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const Periods: ({ periods, tooltipTranslations, maxPeriods }: PeriodsProps) => import("react/jsx-runtime").JSX.Element;
17
22
  export {};
@@ -1,35 +1,42 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { c as N } from "../../clsx-OuTLNxxd.js";
3
- import { useId as v } from "react";
4
- import '../../assets/Periods.css';const j = "_period__container_1ilj5_1", y = "_period__item_1ilj5_6", n = {
5
- period__container: j,
6
- period__item: y,
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { c as P } from "../../clsx-OuTLNxxd.js";
3
+ import { useId as j } from "react";
4
+ import '../../assets/Periods.css';const N = "_period__container_1ilj5_1", g = "_period__item_1ilj5_6", _ = {
5
+ period__container: N,
6
+ period__item: g,
7
7
  "period__item--active": "_period__item--active_1ilj5_19"
8
- }, A = 6, x = ({ periods: r, titlePeriods: l, maxPeriods: a = A }) => {
9
- const p = Array.from({ length: a }, (e, t) => t + 1), u = v(), _ = r.some((e) => typeof e == "number"), d = (e) => {
10
- let t = 0;
11
- return r.reduce(($, b, m) => {
12
- const { semesterNumber: s, periodInSemester: o } = b;
13
- let i = "";
14
- return s !== t ? i = ` ${e.periods["period-title"].replace("{{ semester }}", s.toString())} ${o}` : r[m + 1] && r[m + 1].semesterNumber === t ? i = `, ${o}` : i = ` ${e.periods["last-separator"]} ${o}`, t = s, `${$}${i}`;
15
- }, "").trim();
16
- }, f = (e) => _ ? r.includes(e) : !!r.find((t) => t.number === e);
17
- return /* @__PURE__ */ c(
18
- "div",
8
+ }, v = 6, O = ({ periods: s, tooltipTranslations: u, maxPeriods: p = v }) => {
9
+ const f = Array.from({ length: p }, (e, t) => t + 1), $ = j(), a = s.some((e) => typeof e == "number"), b = (e) => {
10
+ const t = {};
11
+ return a ? s.forEach((i) => {
12
+ if (typeof i == "number") {
13
+ const r = Math.ceil(i / 3), o = (i - 1) % 3 + 1;
14
+ t[r] || (t[r] = []), t[r].push(o);
15
+ }
16
+ }) : s.forEach((i) => {
17
+ const { semesterNumber: r, periodInSemester: o } = i;
18
+ t[r] || (t[r] = []), t[r].push(o);
19
+ }), Object.keys(t).reduce((i, r, o) => {
20
+ const c = Number(r), n = t[c];
21
+ let m = "";
22
+ const d = n.length > 1 ? e.periods : e.period;
23
+ if (n.length > 1) {
24
+ const y = n.pop();
25
+ m = `Semester ${c} ${d} ${n.join(", ")} ${e.and} ${y}`;
26
+ } else
27
+ m = `Semester ${c} ${d} ${n[0]}`;
28
+ return `${i}${o > 0 ? ". " : ""}${m}`;
29
+ }, "").trim() + ".";
30
+ }, h = (e) => a ? s.includes(e) : !!s.find((t) => t.number === e);
31
+ return /* @__PURE__ */ l("div", { className: _.period__container, title: u ? b(u) : "", children: f.map((e) => /* @__PURE__ */ l(
32
+ "span",
19
33
  {
20
- className: n.period__container,
21
- title: _ ? "" : d(l),
22
- children: p.map((e) => /* @__PURE__ */ c(
23
- "span",
24
- {
25
- className: N(n.period__item, f(e) ? n["period__item--active"] : "")
26
- },
27
- `${u}-${e}`
28
- ))
29
- }
30
- );
34
+ className: P(_.period__item, h(e) ? _["period__item--active"] : "")
35
+ },
36
+ `${$}-${e}`
37
+ )) });
31
38
  };
32
39
  export {
33
- x as Periods
40
+ O as Periods
34
41
  };
35
42
  //# sourceMappingURL=Periods.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Periods.js","sources":["../../../src/components/Periods/Periods.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId } from 'react';\n\nimport styles from './Periods.module.css';\n\ninterface Period {\n id: string;\n number: number;\n semesterNumber: number;\n periodInSemester: number;\n}\n\nexport interface PeriodsProps {\n /** Indicates which periods are selected. */\n periods: Period[] | number[];\n /** Indicates the maximum number of periods to show in the selector. */\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n maxPeriods?: 6 | 7;\n /** A mapping for the tooltips of each period indicator. */\n titlePeriods?: Record<string, Record<string, string>>;\n}\n\nconst MAX_PERIODS = 6;\n\n/** Represents a component for a period indicator. */\nexport const Periods = ({ periods, titlePeriods, maxPeriods = MAX_PERIODS }: PeriodsProps) => {\n const maxPeriodsList = Array.from({ length: maxPeriods }, (_, index) => index + 1);\n const idPrefix = useId();\n\n const isArrayOfNumbers = periods.some((value) => {\n return typeof value === 'number';\n });\n\n const getTitles = (titlePeriods: Record<string, Record<string, string>>): string => {\n let currentSemesterNumber = 0;\n\n const title = periods.reduce((acc, period, index) => {\n const { semesterNumber, periodInSemester } = period as Period;\n let periodTitle = '';\n if (semesterNumber !== currentSemesterNumber) {\n periodTitle = ` ${titlePeriods.periods['period-title'].replace('{{ semester }}', semesterNumber.toString())} ${periodInSemester}`;\n } else if (periods[index + 1] && (periods[index + 1] as Period).semesterNumber === currentSemesterNumber) {\n periodTitle = `, ${periodInSemester}`;\n } else {\n periodTitle = ` ${titlePeriods.periods['last-separator']} ${periodInSemester}`;\n }\n\n currentSemesterNumber = semesterNumber;\n return `${acc}${periodTitle}`;\n }, '');\n\n return title.trim();\n };\n\n const isPeriodActive = (periodIndex: number): boolean => {\n if (isArrayOfNumbers) {\n return (periods as number[]).includes(periodIndex);\n } else {\n return periods.find((period) => (period as Period).number === periodIndex) ? true : false;\n }\n };\n\n return (\n <div\n className={styles['period__container']}\n title={isArrayOfNumbers ? '' : getTitles(titlePeriods as Record<string, Record<string, string>>)}\n >\n {maxPeriodsList.map((periodIndex) => {\n return (\n <span\n className={clsx(styles['period__item'], isPeriodActive(periodIndex) ? styles['period__item--active'] : '')}\n key={`${idPrefix}-${periodIndex}`}\n />\n );\n })}\n </div>\n );\n};\n"],"names":["MAX_PERIODS","Periods","periods","titlePeriods","maxPeriods","maxPeriodsList","_","index","idPrefix","useId","isArrayOfNumbers","value","getTitles","currentSemesterNumber","acc","period","semesterNumber","periodInSemester","periodTitle","isPeriodActive","periodIndex","jsx","styles","clsx"],"mappings":";;;;;;;GAsBMA,IAAc,GAGPC,IAAU,CAAC,EAAE,SAAAC,GAAS,cAAAC,GAAc,YAAAC,IAAaJ,QAAgC;AACtF,QAAAK,IAAiB,MAAM,KAAK,EAAE,QAAQD,KAAc,CAACE,GAAG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port { useId } from 'react';\n\nimport styles from './Periods.module.css';\n\ninterface Period {\n id: string;\n number: number;\n semesterNumber: number;\n periodInSemester: number;\n}\n\ninterface TooltipTranslations {\n period: string;\n periods: string;\n and: string;\n}\n\nexport interface PeriodsProps {\n /** Indicates which periods are selected. */\n periods: Period[] | number[];\n /** Indicates the maximum number of periods to show in the selector. */\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n maxPeriods?: 6 | 7;\n /** A object of translations for the tooltip. */\n tooltipTranslations?: TooltipTranslations;\n}\n\nconst MAX_PERIODS = 6;\n\n/** Represents a component for a period indicator. */\nexport const Periods = ({ periods, tooltipTranslations, maxPeriods = MAX_PERIODS }: PeriodsProps) => {\n const maxPeriodsList = Array.from({ length: maxPeriods }, (_, index) => index + 1);\n const idPrefix = useId();\n\n const isArrayOfNumbers = periods.some((value) => {\n return typeof value === 'number';\n });\n\n const getTitles = (tooltipTranslations: TooltipTranslations): string => {\n const semesterPeriods: Record<number, number[]> = {};\n\n // Group periods by semester\n isArrayOfNumbers\n ? periods.forEach((period) => {\n if (typeof period === 'number') {\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const groupKey = Math.ceil(period / 3); // Determine the semester (1, 2, or 3)\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const mappedValue = ((period - 1) % 3) + 1; // Map period to semester\n\n if (!semesterPeriods[groupKey]) {\n semesterPeriods[groupKey] = [];\n }\n semesterPeriods[groupKey].push(mappedValue);\n }\n })\n : periods.forEach((period) => {\n const { semesterNumber, periodInSemester } = period as Period;\n\n if (!semesterPeriods[semesterNumber]) {\n semesterPeriods[semesterNumber] = [];\n }\n semesterPeriods[semesterNumber].push(periodInSemester);\n });\n\n // Build the title string\n const title = Object.keys(semesterPeriods).reduce((acc, semesterKey, index) => {\n const semesterNumber = Number(semesterKey);\n const periodsInSemester = semesterPeriods[semesterNumber];\n let periodTitle = '';\n\n // Determine if we need singular or plural form for \"period\"\n const blokLabel = periodsInSemester.length > 1 ? tooltipTranslations.periods : tooltipTranslations.period;\n\n // Build period sequence for the current semester\n if (periodsInSemester.length > 1) {\n const lastPeriod = periodsInSemester.pop();\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester.join(', ')} ${tooltipTranslations.and} ${lastPeriod}`;\n } else {\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester[0]}`;\n }\n\n // Add proper spacing and periods\n return `${acc}${index > 0 ? '. ' : ''}${periodTitle}`;\n }, '');\n\n return title.trim() + '.';\n };\n\n const isPeriodActive = (periodIndex: number): boolean => {\n if (isArrayOfNumbers) {\n return (periods as number[]).includes(periodIndex);\n } else {\n return periods.find((period) => (period as Period).number === periodIndex) ? true : false;\n }\n };\n\n return (\n <div className={styles['period__container']} title={tooltipTranslations ? getTitles(tooltipTranslations) : ''}>\n {maxPeriodsList.map((periodIndex) => {\n return (\n <span\n className={clsx(styles['period__item'], isPeriodActive(periodIndex) ? styles['period__item--active'] : '')}\n key={`${idPrefix}-${periodIndex}`}\n />\n );\n })}\n </div>\n );\n};\n"],"names":["MAX_PERIODS","Periods","periods","tooltipTranslations","maxPeriods","maxPeriodsList","_","index","idPrefix","useId","isArrayOfNumbers","value","getTitles","semesterPeriods","period","groupKey","mappedValue","semesterNumber","periodInSemester","acc","semesterKey","periodsInSemester","periodTitle","blokLabel","lastPeriod","isPeriodActive","periodIndex","jsx","styles","clsx"],"mappings":";;;;;;;GA4BMA,IAAc,GAGPC,IAAU,CAAC,EAAE,SAAAC,GAAS,qBAAAC,GAAqB,YAAAC,IAAaJ,QAAgC;AAC7F,QAAAK,IAAiB,MAAM,KAAK,EAAE,QAAQD,KAAc,CAACE,GAAGC,MAAUA,IAAQ,CAAC,GAC3EC,IAAWC,KAEXC,IAAmBR,EAAQ,KAAK,CAACS,MAC9B,OAAOA,KAAU,QACzB,GAEKC,IAAY,CAACT,MAAqD;AACtE,UAAMU,IAA4C,CAAA;AAI9C,WAAAH,IAAAR,EAAQ,QAAQ,CAACY,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B,IAAsBS,EAAUT,CAAmB,IAAI,IACxG,UAAeE,EAAA,IAAI,CAACqB,MAEjB,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWE,EAAKD,EAAO,cAAiBH,EAAeC,CAAW,IAAIE,EAAO,sBAAsB,IAAI,EAAE;AAAA,IAAA;AAAA,IACpG,GAAGpB,CAAQ,IAAIkB,CAAW;AAAA,EAAA,CAGpC,EACH,CAAA;AAEJ;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import { Periods as e } from "./Periods.js";
3
- const t = "<Periods periods={periods} />", o = [
3
+ const o = "<Periods periods={periods} />", t = [
4
4
  {
5
5
  id: "2023P1",
6
6
  number: 1,
@@ -13,6 +13,12 @@ const t = "<Periods periods={periods} />", o = [
13
13
  semesterNumber: 1,
14
14
  periodInSemester: 2
15
15
  },
16
+ {
17
+ id: "2023P3",
18
+ number: 3,
19
+ semesterNumber: 1,
20
+ periodInSemester: 3
21
+ },
16
22
  {
17
23
  id: "2023P5",
18
24
  number: 5,
@@ -26,10 +32,9 @@ const t = "<Periods periods={periods} />", o = [
26
32
  periodInSemester: 1
27
33
  }
28
34
  ], i = {
29
- periods: {
30
- "period-title": "Semester {{ semester }} block",
31
- "last-separator": "en"
32
- }
35
+ period: "blok",
36
+ periods: "blokken",
37
+ and: "en"
33
38
  }, a = {
34
39
  title: "Atoms/Periods",
35
40
  component: e,
@@ -43,16 +48,16 @@ const t = "<Periods periods={periods} />", o = [
43
48
  },
44
49
  parameters: {
45
50
  inspectComponent: e,
46
- codeString: t
51
+ codeString: o
47
52
  }
48
- }, m = (r) => /* @__PURE__ */ s(e, { ...r }), d = m.bind({});
49
- d.args = {
50
- periods: o,
53
+ }, m = (r) => /* @__PURE__ */ s(e, { ...r }), n = m.bind({});
54
+ n.args = {
55
+ periods: t,
51
56
  maxPeriods: 7,
52
- titlePeriods: i
57
+ tooltipTranslations: i
53
58
  };
54
59
  export {
55
- d as PeriodsExample,
60
+ n as PeriodsExample,
56
61
  a as default
57
62
  };
58
63
  //# sourceMappingURL=Periods.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Periods.stories.js","sources":["../../../src/components/Periods/Periods.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { PeriodsProps } from './Periods';\n\nimport { Periods } from './Periods';\n\nconst codeString = '<Periods periods={periods} />';\n\nconst PERIODS = [\n {\n id: '2023P1',\n number: 1,\n semesterNumber: 1,\n periodInSemester: 1,\n },\n {\n id: '2023P2',\n number: 2,\n semesterNumber: 1,\n periodInSemester: 2,\n },\n {\n id: '2023P5',\n number: 5,\n semesterNumber: 2,\n periodInSemester: 2,\n },\n {\n id: '2023P7',\n number: 7,\n semesterNumber: 3,\n periodInSemester: 1,\n },\n];\n\nconst TITLE_PERIODS = {\n periods: {\n 'period-title': 'Semester {{ semester }} block',\n 'last-separator': 'en',\n },\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Periods',\n component: Periods,\n argTypes: {\n expanded: {\n // Hide the expanded prop. Changing the value in Storybook doesn't update the state of the component.\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Periods,\n codeString: codeString,\n },\n} as Meta<PeriodsProps>;\n\nconst Template: StoryFn<PeriodsProps> = (args) => <Periods {...args} />;\n\nexport const PeriodsExample = Template.bind({});\n\nPeriodsExample.args = {\n periods: PERIODS,\n maxPeriods: 7,\n titlePeriods: TITLE_PERIODS,\n};\n"],"names":["codeString","PERIODS","TITLE_PERIODS","Periods_stories","Periods","Template","args","jsx","PeriodsExample"],"mappings":";;AAKA,MAAMA,IAAa,iCAEbC,IAAU;AAAA,EACd;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AACF,GAEMC,IAAgB;AAAA,EACpB,SAAS;AAAA,IACP,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AACF,GAGeC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA;AAAA,MAER,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAJ;AAAA,EACF;AACF,GAEMK,IAAkC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAS,GAAGE,EAAM,CAAA,GAExDE,IAAiBH,EAAS,KAAK,EAAE;AAE9CG,EAAe,OAAO;AAAA,EACpB,SAASP;AAAA,EACT,YAAY;AAAA,EACZ,cAAcC;AAChB;"}
1
+ {"version":3,"file":"Periods.stories.js","sources":["../../../src/components/Periods/Periods.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { PeriodsProps } from './Periods';\n\nimport { Periods } from './Periods';\n\nconst codeString = '<Periods periods={periods} />';\n\nconst PERIODS = [\n {\n id: '2023P1',\n number: 1,\n semesterNumber: 1,\n periodInSemester: 1,\n },\n {\n id: '2023P2',\n number: 2,\n semesterNumber: 1,\n periodInSemester: 2,\n },\n {\n id: '2023P3',\n number: 3,\n semesterNumber: 1,\n periodInSemester: 3,\n },\n {\n id: '2023P5',\n number: 5,\n semesterNumber: 2,\n periodInSemester: 2,\n },\n {\n id: '2023P7',\n number: 7,\n semesterNumber: 3,\n periodInSemester: 1,\n },\n];\n\nconst TOOLTIP_PERIODS = {\n period: 'blok',\n periods: 'blokken',\n and: 'en',\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Periods',\n component: Periods,\n argTypes: {\n expanded: {\n // Hide the expanded prop. Changing the value in Storybook doesn't update the state of the component.\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Periods,\n codeString: codeString,\n },\n} as Meta<PeriodsProps>;\n\nconst Template: StoryFn<PeriodsProps> = (args) => <Periods {...args} />;\n\nexport const PeriodsExample = Template.bind({});\n\nPeriodsExample.args = {\n periods: PERIODS,\n maxPeriods: 7,\n tooltipTranslations: TOOLTIP_PERIODS,\n};\n"],"names":["codeString","PERIODS","TOOLTIP_PERIODS","Periods_stories","Periods","Template","args","jsx","PeriodsExample"],"mappings":";;AAKA,MAAMA,IAAa,iCAEbC,IAAU;AAAA,EACd;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,EACpB;AACF,GAEMC,IAAkB;AAAA,EACtB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,KAAK;AACP,GAGeC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA;AAAA,MAER,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAJ;AAAA,EACF;AACF,GAEMK,IAAkC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAS,GAAGE,EAAM,CAAA,GAExDE,IAAiBH,EAAS,KAAK,EAAE;AAE9CG,EAAe,OAAO;AAAA,EACpB,SAASP;AAAA,EACT,YAAY;AAAA,EACZ,qBAAqBC;AACvB;"}
@@ -16,14 +16,14 @@ import "../IconButton/IconButton.js";
16
16
  import "../Input/Input.js";
17
17
  import "../InputField/InputField.js";
18
18
  import "react-router-dom";
19
- import "../../TablePlugin-1L5UZfDH.js";
19
+ import "../../TablePlugin-Cj6IBz2k.js";
20
20
  import { Repeater as i } from "../Repeater/Repeater.js";
21
21
  import "../RteEditor/hooks/components/Flyout.js";
22
22
  import "../RteEditor/Providers/LanguageProvider.js";
23
23
  import "../SelectListbox/SelectListbox.js";
24
24
  import "../SelectListbox/SelectProvider.js";
25
25
  import "../Sortable/components/SortableItem.js";
26
- import "../../SortableProvider-i4PDjRS_.js";
26
+ import "../../SortableProvider-BUsvniX7.js";
27
27
  const l = "<ProgrammeCard key={key} header={header} details={details} onClick={onClickFunction} />", B = {
28
28
  title: "Atoms/ProgrammeCard",
29
29
  component: o,
@@ -15,13 +15,13 @@ import "../../IconButton/IconButton.js";
15
15
  import "../../Input/Input.js";
16
16
  import "../../InputField/InputField.js";
17
17
  import "react-router-dom";
18
- import "../../../TablePlugin-1L5UZfDH.js";
18
+ import "../../../TablePlugin-Cj6IBz2k.js";
19
19
  import "../hooks/components/Flyout.js";
20
20
  import "../Providers/LanguageProvider.js";
21
21
  import "../../SelectListbox/SelectListbox.js";
22
22
  import "../../SelectListbox/SelectProvider.js";
23
23
  import "../../Sortable/components/SortableItem.js";
24
- import "../../../SortableProvider-i4PDjRS_.js";
24
+ import "../../../SortableProvider-BUsvniX7.js";
25
25
  import '../../../assets/EditorHeader.css';const o = {
26
26
  "editor-header__container": "_editor-header__container_1kv3n_1",
27
27
  "editor-header__info-icon": "_editor-header__info-icon_1kv3n_10",
@@ -16,14 +16,14 @@ import "../../../IconButton/IconButton.js";
16
16
  import "../../../Input/Input.js";
17
17
  import "../../../InputField/InputField.js";
18
18
  import "react-router-dom";
19
- import "../../../../TablePlugin-1L5UZfDH.js";
19
+ import "../../../../TablePlugin-Cj6IBz2k.js";
20
20
  import { s as t } from "../../../../RteEditor.module-Dz9a8vaK.js";
21
21
  import "../../hooks/components/Flyout.js";
22
22
  import "../../Providers/LanguageProvider.js";
23
23
  import "../../../SelectListbox/SelectListbox.js";
24
24
  import "../../../SelectListbox/SelectProvider.js";
25
25
  import "../../../Sortable/components/SortableItem.js";
26
- import "../../../../SortableProvider-i4PDjRS_.js";
26
+ import "../../../../SortableProvider-BUsvniX7.js";
27
27
  const O = () => {
28
28
  const [o] = f(), [s, d] = m(!1), [p, l] = m(!1), c = () => {
29
29
  o.dispatchCommand(C, void 0);
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../../../helpers-Ec7CfNnA.js";
4
- import { A as z } from "../../../../TablePlugin-1L5UZfDH.js";
4
+ import { A as z } from "../../../../TablePlugin-Cj6IBz2k.js";
5
5
  import "../../../Buttons/Button.js";
6
6
  import "../../../Buttons/LinkButton.js";
7
7
  import "@react-aria/button";
@@ -24,7 +24,7 @@ import "../../Providers/LanguageProvider.js";
24
24
  import "../../../SelectListbox/SelectListbox.js";
25
25
  import "../../../SelectListbox/SelectProvider.js";
26
26
  import "../../../Sortable/components/SortableItem.js";
27
- import "../../../../SortableProvider-i4PDjRS_.js";
27
+ import "../../../../SortableProvider-BUsvniX7.js";
28
28
  export {
29
29
  z as AddLinkForm
30
30
  };
@@ -4,7 +4,7 @@ import { c as L } from "../../../../clsx-OuTLNxxd.js";
4
4
  import { g as N, U as b } from "../../../../helpers-Ec7CfNnA.js";
5
5
  import { useRef as _, useEffect as g } from "react";
6
6
  import { r as C, I as E, m as P } from "../../../../Lexical.prod-CO0gPAfo.js";
7
- import { A as x } from "../../../../TablePlugin-1L5UZfDH.js";
7
+ import { A as x } from "../../../../TablePlugin-Cj6IBz2k.js";
8
8
  import { useFlyout as I } from "../../hooks/useFlyout.js";
9
9
  import { Icon as T } from "../../../Icon/Icon.js";
10
10
  import "../../../Buttons/Button.js";
@@ -24,7 +24,7 @@ import "../../Providers/LanguageProvider.js";
24
24
  import "../../../SelectListbox/SelectListbox.js";
25
25
  import "../../../SelectListbox/SelectProvider.js";
26
26
  import "../../../Sortable/components/SortableItem.js";
27
- import "../../../../SortableProvider-i4PDjRS_.js";
27
+ import "../../../../SortableProvider-BUsvniX7.js";
28
28
  const A = 200, st = ({
29
29
  isLink: l = { active: !1, url: "", target: "_self" },
30
30
  isLinkable: k = !1
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { b as v } from "../../../../TablePlugin-1L5UZfDH.js";
3
+ import { b as v } from "../../../../TablePlugin-Cj6IBz2k.js";
4
4
  import "../../../Buttons/Button.js";
5
5
  import "../../../Buttons/LinkButton.js";
6
6
  import "@react-aria/button";
@@ -21,7 +21,7 @@ import "../../Providers/LanguageProvider.js";
21
21
  import "../../../SelectListbox/SelectListbox.js";
22
22
  import "../../../SelectListbox/SelectProvider.js";
23
23
  import "../../../Sortable/components/SortableItem.js";
24
- import "../../../../SortableProvider-i4PDjRS_.js";
24
+ import "../../../../SortableProvider-BUsvniX7.js";
25
25
  export {
26
26
  v as AddTableForm
27
27
  };
@@ -4,7 +4,7 @@ import "../../../../clsx-OuTLNxxd.js";
4
4
  import "../../../../helpers-BewZrn6E.js";
5
5
  import "../../../../Lexical.prod-CO0gPAfo.js";
6
6
  import "react";
7
- import { T as A } from "../../../../TablePlugin-1L5UZfDH.js";
7
+ import { T as A } from "../../../../TablePlugin-Cj6IBz2k.js";
8
8
  import "../../hooks/useFlyout.js";
9
9
  import "../../../Icon/Icon.js";
10
10
  import "../../../Buttons/Button.js";
@@ -24,7 +24,7 @@ import "../../Providers/LanguageProvider.js";
24
24
  import "../../../SelectListbox/SelectListbox.js";
25
25
  import "../../../SelectListbox/SelectProvider.js";
26
26
  import "../../../Sortable/components/SortableItem.js";
27
- import "../../../../SortableProvider-i4PDjRS_.js";
27
+ import "../../../../SortableProvider-BUsvniX7.js";
28
28
  export {
29
29
  A as TablePlugin
30
30
  };
@@ -1,4 +1,4 @@
1
- import { T as o } from "../../../../TablePlugin-1L5UZfDH.js";
1
+ import { T as o } from "../../../../TablePlugin-Cj6IBz2k.js";
2
2
  import { TableCellContextMenu as t } from "./TableCellContextMenu/TableCellContextMenu.js";
3
3
  export {
4
4
  t as TableCellContextMenu,
@@ -8,7 +8,7 @@ import { BlockFormatPlugin as U } from "../BlockFormatPlugin/BlockFormatPlugin.j
8
8
  import { ListPlugin as _ } from "../ListPlugin/ListPlugin.js";
9
9
  import { LinkPlugin as j } from "../LinkPlugin/LinkPlugin.js";
10
10
  import { HistoryPlugin as E } from "../HistoryPlugin/HistoryPlugin.js";
11
- import { T as K } from "../../../../TablePlugin-1L5UZfDH.js";
11
+ import { T as K } from "../../../../TablePlugin-Cj6IBz2k.js";
12
12
  import { TableCellContextMenu as M } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
13
13
  import { s as O } from "../../../../RteEditor.module-Dz9a8vaK.js";
14
14
  const w = (s, l) => {
@@ -3,7 +3,7 @@ import { BlockFormatPlugin as t } from "./BlockFormatPlugin/BlockFormatPlugin.js
3
3
  import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
4
4
  import { LinkPlugin as x } from "./LinkPlugin/LinkPlugin.js";
5
5
  import { HistoryPlugin as p } from "./HistoryPlugin/HistoryPlugin.js";
6
- import { T as g } from "../../../TablePlugin-1L5UZfDH.js";
6
+ import { T as g } from "../../../TablePlugin-Cj6IBz2k.js";
7
7
  import { TableCellContextMenu as a } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
8
8
  export {
9
9
  t as BlockFormatPlugin,
@@ -12,7 +12,7 @@ import { c as nn } from "../../clsx-OuTLNxxd.js";
12
12
  import { s as L } from "../../RteEditor.module-Dz9a8vaK.js";
13
13
  import { ToolBarPlugin as rn } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
14
14
  import { Icon as on } from "../Icon/Icon.js";
15
- import "../../TablePlugin-1L5UZfDH.js";
15
+ import "../../TablePlugin-Cj6IBz2k.js";
16
16
  import "./hooks/components/Flyout.js";
17
17
  import "../Buttons/Button.js";
18
18
  import "../Buttons/LinkButton.js";
@@ -29,7 +29,7 @@ import "react-router-dom";
29
29
  import "../SelectListbox/SelectListbox.js";
30
30
  import "../SelectListbox/SelectProvider.js";
31
31
  import "../Sortable/components/SortableItem.js";
32
- import "../../SortableProvider-i4PDjRS_.js";
32
+ import "../../SortableProvider-BUsvniX7.js";
33
33
  import { useTranslation as sn } from "./hooks/useTranslation.js";
34
34
  import { UvaTheme as an } from "./UvaTheme/UvaTheme.js";
35
35
  import { EditorHeader as ln } from "./EditorHeader/EditorHeader.js";
@@ -1,7 +1,7 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { Children as e } from "react";
3
3
  import { SortableItem as b } from "./components/SortableItem.js";
4
- import { S as n } from "../../SortableProvider-i4PDjRS_.js";
4
+ import { S as n } from "../../SortableProvider-BUsvniX7.js";
5
5
  const S = ({ children: t, ItemHandlePlacement: m = "left", scrollable: a, disabled: l, onSort: i }) => /* @__PURE__ */ o(
6
6
  n,
7
7
  {
@@ -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-i4PDjRS_.js";
4
+ import { S as p, u as a } from "../../SortableProvider-BUsvniX7.js";
5
5
  import "./actions.js";
6
6
  export {
7
7
  p as SortableProvider,
@@ -1,8 +1,8 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../../clsx-OuTLNxxd.js";
4
- import "../../../Sortable.module-uk_YuFs1.js";
5
- import { a } from "../../../SortableProvider-i4PDjRS_.js";
4
+ import "../../../Sortable.module-DDhRFD1T.js";
5
+ import { a } from "../../../SortableProvider-BUsvniX7.js";
6
6
  export {
7
7
  a as SortableContainer
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { Icon as e } from "../../Icon/Icon.js";
3
- import { s as t } from "../../../Sortable.module-uk_YuFs1.js";
3
+ import { s as t } from "../../../Sortable.module-DDhRFD1T.js";
4
4
  const r = "ontouchstart" in globalThis.document.documentElement;
5
5
  function m({ placement: n }) {
6
6
  return r ? null : /* @__PURE__ */ o("div", { className: `${t.sortable__handle} ${t[`sortable__handle--${n}`]}`, children: /* @__PURE__ */ o(e, { name: "Dots" }) });
@@ -2,8 +2,8 @@ import { jsxs as i, jsx as r, Fragment as v } from "react/jsx-runtime";
2
2
  import { useState as S, useRef as M, useEffect as Q } from "react";
3
3
  import { Icon as w } from "../../Icon/Icon.js";
4
4
  import { SortableHandle as E } from "./SortableHandle.js";
5
- import { s as t } from "../../../Sortable.module-uk_YuFs1.js";
6
- import { u as k } from "../../../SortableProvider-i4PDjRS_.js";
5
+ import { s as t } from "../../../Sortable.module-DDhRFD1T.js";
6
+ import { u as k } from "../../../SortableProvider-BUsvniX7.js";
7
7
  const G = ["Space", "ArrowDown", "ArrowUp"], J = "ontouchstart" in globalThis.document.documentElement, C = new Image(0, 0);
8
8
  C.src = // 1px transparent png
9
9
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
@@ -29,7 +29,7 @@ import { Label as to } from "./Label/Label.js";
29
29
  import { MenuLink as po } from "./MenuLink/MenuLink.js";
30
30
  import { MetaDataList as mo } from "./MetaDataList/MetaDataList.js";
31
31
  import { ModalDialog as io } from "./ModalDialog/ModalDialog.js";
32
- import { M as no } from "../TablePlugin-1L5UZfDH.js";
32
+ import { M as no } from "../TablePlugin-Cj6IBz2k.js";
33
33
  import { OverlayCloseButton as co } from "./OverlayCloseButton/OverlayCloseButton.js";
34
34
  import { PageOverlay as so } from "./PageOverlay/PageOverlay.js";
35
35
  import { Periods as So } from "./Periods/Periods.js";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import { Label as to } from "./components/Label/Label.js";
29
29
  import { MenuLink as po } from "./components/MenuLink/MenuLink.js";
30
30
  import { MetaDataList as mo } from "./components/MetaDataList/MetaDataList.js";
31
31
  import { ModalDialog as io } from "./components/ModalDialog/ModalDialog.js";
32
- import { M as no } from "./TablePlugin-1L5UZfDH.js";
32
+ import { M as no } from "./TablePlugin-Cj6IBz2k.js";
33
33
  import { OverlayCloseButton as co } from "./components/OverlayCloseButton/OverlayCloseButton.js";
34
34
  import { PageOverlay as so } from "./components/PageOverlay/PageOverlay.js";
35
35
  import { Periods as So } from "./components/Periods/Periods.js";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uva-glass/component-library",
3
3
  "author": "Team Glass - Frontend vrienden",
4
4
  "private": false,
5
- "version": "1.58.0",
5
+ "version": "1.59.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -57,8 +57,8 @@
57
57
  "@storybook/react": "^8.3.6",
58
58
  "@storybook/react-vite": "^8.3.6",
59
59
  "@storybook/test": "^8.3.6",
60
- "@types/node": "^20.16.14",
61
- "@types/react": "^18.3.11",
60
+ "@types/node": "^20.16.15",
61
+ "@types/react": "^18.3.12",
62
62
  "@types/react-dom": "^18.3.1",
63
63
  "@uva-glass/eslint-config": "^1.3.1",
64
64
  "@uva-glass/stylelint-config": "^1.1.0",
@@ -67,7 +67,7 @@
67
67
  "eslint": "^8.57.1",
68
68
  "eslint-config-prettier": "^9.1.0",
69
69
  "eslint-plugin-prettier": "^5.2.1",
70
- "eslint-plugin-react": "^7.37.1",
70
+ "eslint-plugin-react": "^7.37.2",
71
71
  "eslint-plugin-react-hooks": "^5.0.0",
72
72
  "eslint-plugin-react-refresh": "^0.4.13",
73
73
  "eslint-plugin-storybook": "^0.10.1",
@@ -88,8 +88,8 @@
88
88
  "stylelint-config-standard": "^36.0.1",
89
89
  "stylelint-order": "^6.0.4",
90
90
  "typescript": "^5.6.3",
91
- "vite": "^5.4.9",
92
- "vite-plugin-dts": "^4.2.4",
91
+ "vite": "^5.4.10",
92
+ "vite-plugin-dts": "^4.3.0",
93
93
  "vite-plugin-lib-inject-css": "^2.1.1",
94
94
  "vite-plugin-static-copy": "^2.0.0",
95
95
  "vite-plugin-svgr": "^4.2.0",
@@ -1,24 +0,0 @@
1
- import './assets/Sortable.css';const _ = "_sortable__wrapper_td575_1", t = "_sortable__container_td575_13", e = "_sortable__handle_td575_154", r = {
2
- sortable__wrapper: _,
3
- "sortable__wrapper--scrollable": "_sortable__wrapper--scrollable_td575_5",
4
- sortable__container: t,
5
- "sortable__drop-target": "_sortable__drop-target_td575_25",
6
- "sortable__sort-item": "_sortable__sort-item_td575_56",
7
- "sortable__sort-item--ghost": "_sortable__sort-item--ghost_td575_72",
8
- "sortable__container--drag-over": "_sortable__container--drag-over_td575_83",
9
- "sortable__sort-item__handle": "_sortable__sort-item__handle_td575_88",
10
- "sortable__sort-item__button-container": "_sortable__sort-item__button-container_td575_98",
11
- "sortable__sort-item__handle--icon": "_sortable__sort-item__handle--icon_td575_117",
12
- "sortable__sort-item__handle--up": "_sortable__sort-item__handle--up_td575_124",
13
- "sortable__sort-item__handle--down": "_sortable__sort-item__handle--down_td575_125",
14
- "sortable__sort-item--dragging": "_sortable__sort-item--dragging_td575_136",
15
- "sortable__sort-item__contents": "_sortable__sort-item__contents_td575_140",
16
- "sortable__sort-item__contents--handle-right": "_sortable__sort-item__contents--handle-right_td575_149",
17
- sortable__handle: e,
18
- "sortable__handle--right": "_sortable__handle--right_td575_160",
19
- "sortable__visually-hidden": "_sortable__visually-hidden_td575_178"
20
- };
21
- export {
22
- r as s
23
- };
24
- //# sourceMappingURL=Sortable.module-uk_YuFs1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sortable.module-uk_YuFs1.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}