@uva-glass/component-library 3.57.3 → 3.57.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddCatalogueLinkForm-Di0xm7Ep.js → AddCatalogueLinkForm-CvJoaUFz.js} +2 -2
- package/dist/{AddCatalogueLinkForm-Di0xm7Ep.js.map → AddCatalogueLinkForm-CvJoaUFz.js.map} +1 -1
- package/dist/{DataTable-Cgn_RKTA.js → DataTable-UslvEf3c.js} +54 -50
- package/dist/DataTable-UslvEf3c.js.map +1 -0
- package/dist/{FeedbackBar-DEDpoNy7.js → FeedbackBar-DsOWAAGt.js} +2 -2
- package/dist/{FeedbackBar-DEDpoNy7.js.map → FeedbackBar-DsOWAAGt.js.map} +1 -1
- package/dist/{Lexical.prod-Dy5aDppc.js → Lexical.prod-BlUfEvo-.js} +1461 -1476
- package/dist/{Lexical.prod-Dy5aDppc.js.map → Lexical.prod-BlUfEvo-.js.map} +1 -1
- package/dist/{LexicalClipboard.prod-CS8a49uL.js → LexicalClipboard.prod-DQbm50C_.js} +132 -131
- package/dist/LexicalClipboard.prod-DQbm50C_.js.map +1 -0
- package/dist/LexicalHtml.prod-Czkg35Fe.js +1129 -0
- package/dist/LexicalHtml.prod-Czkg35Fe.js.map +1 -0
- package/dist/{LexicalLink.prod-DzgwWhQM.js → LexicalLink.prod-6gI2ABQo.js} +141 -141
- package/dist/{LexicalLink.prod-DzgwWhQM.js.map → LexicalLink.prod-6gI2ABQo.js.map} +1 -1
- package/dist/{LexicalList.prod-icY8mpm6.js → LexicalList.prod-CMGvSM1c.js} +265 -265
- package/dist/{LexicalList.prod-icY8mpm6.js.map → LexicalList.prod-CMGvSM1c.js.map} +1 -1
- package/dist/LexicalSelection.prod-DS_R6Cl1.js +99 -0
- package/dist/LexicalSelection.prod-DS_R6Cl1.js.map +1 -0
- package/dist/{LexicalTable.prod-Bf0is-op.js → LexicalTable.prod-D3FUVxbr.js} +582 -582
- package/dist/LexicalTable.prod-D3FUVxbr.js.map +1 -0
- package/dist/LexicalUtils.prod-CNWf_0sq.js +164 -0
- package/dist/LexicalUtils.prod-CNWf_0sq.js.map +1 -0
- package/dist/{LinkContextMenu-C8ehPbP8.js → LinkContextMenu-59-rbxa2.js} +2 -2
- package/dist/{LinkContextMenu-C8ehPbP8.js.map → LinkContextMenu-59-rbxa2.js.map} +1 -1
- package/dist/{PasteHandlerPlugin-CSo_lOE8.js → PasteHandlerPlugin-CTzYRyAx.js} +9 -9
- package/dist/{PasteHandlerPlugin-CSo_lOE8.js.map → PasteHandlerPlugin-CTzYRyAx.js.map} +1 -1
- package/dist/Repeater-DUo13Mq6.js +23 -0
- package/dist/Repeater-DUo13Mq6.js.map +1 -0
- package/dist/{Slider-Czd2xAGf.js → Slider-CqYFsgRL.js} +3 -3
- package/dist/{Slider-Czd2xAGf.js.map → Slider-CqYFsgRL.js.map} +1 -1
- package/dist/{TableCellResizerPlugin-Bb2blXnq.js → TableCellResizerPlugin-D-fX5I3p.js} +12 -5
- package/dist/{TableCellResizerPlugin-Bb2blXnq.js.map → TableCellResizerPlugin-D-fX5I3p.js.map} +1 -1
- package/dist/assets/DataTable.css +1 -1
- package/dist/assets/Repeater.css +1 -1
- package/dist/{chunk-5WKL7XVT-CvOIS3NE.js → chunk-SNLGT2ZI--XVeLAcq.js} +2540 -2881
- package/dist/chunk-SNLGT2ZI--XVeLAcq.js.map +1 -0
- package/dist/{client-CXlG3hNo.js → client-CTHUtwUP.js} +4 -4
- package/dist/{client-CXlG3hNo.js.map → client-CTHUtwUP.js.map} +1 -1
- package/dist/components/Accordion/Accordion.test.js +15 -14
- package/dist/components/Accordion/Accordion.test.js.map +1 -1
- package/dist/components/AccordionCard/AccordionCard.test.js +20 -19
- package/dist/components/AccordionCard/AccordionCard.test.js.map +1 -1
- package/dist/components/ActionList/ActionList.test.js +26 -25
- package/dist/components/ActionList/ActionList.test.js.map +1 -1
- package/dist/components/AppStatusBar/AppStatusBar.test.js +6 -5
- package/dist/components/AppStatusBar/AppStatusBar.test.js.map +1 -1
- package/dist/components/Attention/Attention.test.js +5 -4
- package/dist/components/Attention/Attention.test.js.map +1 -1
- package/dist/components/Backdrop/Backdrop.test.js +5 -4
- package/dist/components/Backdrop/Backdrop.test.js.map +1 -1
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +20 -19
- package/dist/components/Buttons/Button.test.js.map +1 -1
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +22 -21
- package/dist/components/Buttons/LinkButton.test.js.map +1 -1
- package/dist/components/Buttons/MenuButton.stories.js +1 -1
- package/dist/components/Buttons/MenuButton.test.js +20 -19
- package/dist/components/Buttons/MenuButton.test.js.map +1 -1
- package/dist/components/Card/Card.test.js +5 -4
- package/dist/components/Card/Card.test.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +9 -8
- package/dist/components/Checkbox/Checkbox.test.js.map +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +16 -15
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +3 -3
- package/dist/components/CheckboxTree/index.js +1 -1
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/ControlsButton/ControlsButton.stories.js +1 -1
- package/dist/components/DataTable/DataTable.d.ts +3 -1
- package/dist/components/DataTable/DataTable.js +1 -1
- package/dist/components/DataTable/DataTable.stories.js +47 -56
- package/dist/components/DataTable/DataTable.stories.js.map +1 -1
- package/dist/components/DataTable/index.js +1 -1
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/ExpandableInfoPanel/ExpandableInfoPanel.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.stories.js +2 -2
- package/dist/components/FeedbackBar/FeedbackBar.test.js +8 -7
- package/dist/components/FeedbackBar/FeedbackBar.test.js.map +1 -1
- package/dist/components/FeedbackBar/index.js +1 -1
- package/dist/components/FeedbackBox/FeedbackBox.stories.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/FormInput/FormInput.stories.js +2 -2
- package/dist/components/FormInput/index.js +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/Label/Label.test.js +12 -11
- package/dist/components/Label/Label.test.js.map +1 -1
- package/dist/components/MetaDataBar/MetaDataBar.test.js +5 -4
- package/dist/components/MetaDataBar/MetaDataBar.test.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +12 -11
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js.map +1 -1
- package/dist/components/Notification/Notification.stories.js +1 -1
- package/dist/components/Notification/Notification.test.js +8 -7
- package/dist/components/Notification/Notification.test.js.map +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
- package/dist/components/PageOverlay/PageOverlay.stories.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +2 -2
- package/dist/components/PeriodSelector/index.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +10 -9
- package/dist/components/RadioGroup/Radiogroup.test.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +2 -2
- package/dist/components/RadioTabSelector/index.js +1 -1
- package/dist/components/Repeater/Repeater.d.ts +1 -1
- package/dist/components/Repeater/Repeater.js +1 -1
- package/dist/components/Repeater/Repeater.stories.js +1 -1
- package/dist/components/Repeater/index.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/EditorHeader/index.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/AddCatalogueLinkForm/AddCatalogueLinkForm.js +1 -1
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/AddCatalogueLinkForm/index.js +1 -1
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/CourseCataloguePlugin.js +21 -21
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +7 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +12 -12
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/index.js +3 -3
- package/dist/components/RteEditor/RteEditor.js +1 -1
- package/dist/components/RteEditor/RteEditor.stories.js +1 -1
- package/dist/components/RteEditor/helpers.js +5 -5
- package/dist/components/RteEditor/index.js +1 -1
- package/dist/components/RteEditor/nodes/CourseCatalogueNode/CourseCatalogueNode.js +14 -14
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +20 -19
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -1
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/SelectProvider.js +2 -1
- package/dist/components/SelectListbox/SelectProvider.js.map +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider.stories.js +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/Sortable/Sortable.stories.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js +2 -2
- package/dist/components/Sortable/components/SortableItem.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +7 -6
- package/dist/components/StatusBadge/StatusBadge.test.js.map +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +14 -13
- package/dist/components/TextArea/TextArea.test.js.map +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +26 -25
- package/dist/components/VarIndicator/VarIndicator.test.js.map +1 -1
- package/dist/components/hooks/useResponsive.js +1 -1
- package/dist/components/hooks/useResponsive.js.map +1 -1
- package/dist/components/index.js +5 -5
- package/dist/{components-CgBF6db6.js → components-D2rPfyIW.js} +438 -408
- package/dist/components-D2rPfyIW.js.map +1 -0
- package/dist/{dist-oLwM--0y.js → dist-CuwCMU7Y.js} +4 -4
- package/dist/{dist-oLwM--0y.js.map → dist-CuwCMU7Y.js.map} +1 -1
- package/dist/{react.esm-DwWzhs9e.js → dom.esm-S0SD0DBW.js} +938 -1029
- package/dist/dom.esm-S0SD0DBW.js.map +1 -0
- package/dist/{esm-BXzGXYWZ.js → esm-Bfz5h0_d.js} +5 -5
- package/dist/{esm-BXzGXYWZ.js.map → esm-Bfz5h0_d.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/{react-18-BwdnKC48.js → react-18-yf-KbRra.js} +3 -3
- package/dist/{react-18-BwdnKC48.js.map → react-18-yf-KbRra.js.map} +1 -1
- package/dist/react.esm-D50lAl1F.js +226 -0
- package/dist/react.esm-D50lAl1F.js.map +1 -0
- package/dist/setupTests.js +1 -1
- package/dist/storybook__react.d.js +22 -22
- package/dist/storybook__react.d.js.map +1 -1
- package/dist/{test-Gtly6H2f.js → test-BjtC-Q32.js} +3684 -6919
- package/dist/test-BjtC-Q32.js.map +1 -0
- package/package.json +16 -16
- package/dist/DataTable-Cgn_RKTA.js.map +0 -1
- package/dist/LexicalClipboard.prod-CS8a49uL.js.map +0 -1
- package/dist/LexicalHtml.prod-BtzosUOH.js +0 -1611
- package/dist/LexicalHtml.prod-BtzosUOH.js.map +0 -1
- package/dist/LexicalTable.prod-Bf0is-op.js.map +0 -1
- package/dist/LexicalUtils.prod-CjGUKarD.js +0 -259
- package/dist/LexicalUtils.prod-CjGUKarD.js.map +0 -1
- package/dist/Repeater-BAEfOMZI.js +0 -22
- package/dist/Repeater-BAEfOMZI.js.map +0 -1
- package/dist/chunk-5WKL7XVT-CvOIS3NE.js.map +0 -1
- package/dist/components-CgBF6db6.js.map +0 -1
- package/dist/helpers-MMNO9vlK.js +0 -34
- package/dist/helpers-MMNO9vlK.js.map +0 -1
- package/dist/react.esm-DwWzhs9e.js.map +0 -1
- package/dist/test-Gtly6H2f.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as e } from "../../../../clsx-C67XSbzZ.js";
|
|
2
2
|
import { t } from "../../../../LexicalComposerContext.prod-D4HOlWII.js";
|
|
3
|
-
import {
|
|
4
|
-
import { l as d } from "../../../../LexicalUtils.prod-
|
|
3
|
+
import { Bt as n, W as r, Xn as i, _t as a, gn as o, ht as s, ln as c, rn as l, s as u } from "../../../../Lexical.prod-BlUfEvo-.js";
|
|
4
|
+
import { l as d } from "../../../../LexicalUtils.prod-CNWf_0sq.js";
|
|
5
5
|
import { $getLinkTypeFromNode as f, CourseCatalogueNode as p, INSERT_COURSE_CATALOGUE_LINK as m, REMOVE_COURSE_CATALOGUE_LINK as h } from "../../nodes/CourseCatalogueNode/CourseCatalogueNode.js";
|
|
6
6
|
import { t as g } from "../../../../RteEditor.module-pWBasED2.js";
|
|
7
|
-
import { t as _ } from "../../../../AddCatalogueLinkForm-
|
|
7
|
+
import { t as _ } from "../../../../AddCatalogueLinkForm-CvJoaUFz.js";
|
|
8
8
|
import { useTranslation as v } from "../../hooks/useTranslation.js";
|
|
9
9
|
import { useOnClickOutside as y } from "../../../hooks/useOnClickOutside.js";
|
|
10
10
|
import { useEffect as b, useRef as x, useState as S } from "react";
|
|
@@ -22,12 +22,12 @@ var T = ({ onSearch: T, searchResponse: E, parentScrollPosition: D }) => {
|
|
|
22
22
|
T("", z), R(null);
|
|
23
23
|
};
|
|
24
24
|
b(() => {
|
|
25
|
-
let e = O.registerCommand(
|
|
25
|
+
let e = O.registerCommand(n, (e) => e.ctrlKey && e.shiftKey && e.altKey && e.key === "C" ? (e.preventDefault(), H("course"), !0) : e.ctrlKey && e.shiftKey && e.altKey && e.key === "P" ? (e.preventDefault(), H("programme"), !0) : !1, 4), t = O.registerUpdateListener(({ editorState: e }) => {
|
|
26
26
|
e.read(() => {
|
|
27
|
-
let e =
|
|
28
|
-
if (
|
|
27
|
+
let e = r();
|
|
28
|
+
if (c(e)) {
|
|
29
29
|
let t = e.anchor.getNode(), n = e.anchor.offset;
|
|
30
|
-
if (
|
|
30
|
+
if (o(t) && n === t.getTextContentSize() && t.getNextSibling() instanceof p) {
|
|
31
31
|
let e = t.getNextSibling();
|
|
32
32
|
if (e) {
|
|
33
33
|
let t = f(e);
|
|
@@ -44,28 +44,28 @@ var T = ({ onSearch: T, searchResponse: E, parentScrollPosition: D }) => {
|
|
|
44
44
|
j(!1), N(!1);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
}),
|
|
48
|
-
let t =
|
|
47
|
+
}), a = (e) => {
|
|
48
|
+
let t = u(), n = e.getTextContentSize();
|
|
49
49
|
t.setTextNodeRange(e, n, e, n), l(t);
|
|
50
|
-
}, m = (e, t) =>
|
|
51
|
-
let t =
|
|
52
|
-
if (
|
|
50
|
+
}, m = (e, t) => o(e) && t === e.getTextContentSize() && e.getNextSibling() instanceof p, g = O.registerCommand(n, (e) => {
|
|
51
|
+
let t = r();
|
|
52
|
+
if (c(t)) {
|
|
53
53
|
let n = e.key, r = t.anchor.getNode(), o = t.anchor.offset, s = d(r, p);
|
|
54
54
|
if (m(r, o) && (s = r.getNextSibling()), !s) return !1;
|
|
55
55
|
let c = s?.getTextContentSize();
|
|
56
56
|
if (s && e.key === "Enter") return e.preventDefault(), O.update(() => {
|
|
57
57
|
if (m(r, o)) {
|
|
58
|
-
let e =
|
|
58
|
+
let e = i("\n");
|
|
59
59
|
s.insertBefore(e);
|
|
60
60
|
}
|
|
61
61
|
if (o === c) {
|
|
62
|
-
let e =
|
|
63
|
-
s.insertAfter(e),
|
|
62
|
+
let e = i("\n");
|
|
63
|
+
s.insertAfter(e), a(e);
|
|
64
64
|
}
|
|
65
65
|
}), !0;
|
|
66
66
|
if (s && (n === " " || e.code === "Space")) return e.preventDefault(), O.update(() => {
|
|
67
|
-
let e =
|
|
68
|
-
m(r, o) && (s.insertBefore(e),
|
|
67
|
+
let e = i(" ");
|
|
68
|
+
m(r, o) && (s.insertBefore(e), a(e)), o === c && (s.insertAfter(e), a(e));
|
|
69
69
|
}), !0;
|
|
70
70
|
if (s && (n === "Backspace" || n === "Delete")) return e.preventDefault(), O.update(() => {
|
|
71
71
|
O.dispatchCommand(h, void 0);
|
|
@@ -73,9 +73,9 @@ var T = ({ onSearch: T, searchResponse: E, parentScrollPosition: D }) => {
|
|
|
73
73
|
if (s && n !== "ArrowLeft" && n !== "ArrowRight" && n !== "ArrowUp" && n !== "ArrowDown" && n !== "Home" && n !== "End" && !(e.ctrlKey && (n.toLowerCase() === "z" || n.toLowerCase() === "y")) && !(e.ctrlKey && n.toLowerCase() === "c")) return e.preventDefault(), !0;
|
|
74
74
|
}
|
|
75
75
|
return !1;
|
|
76
|
-
}, 4), _ = O.registerCommand(
|
|
77
|
-
let t =
|
|
78
|
-
if (
|
|
76
|
+
}, 4), _ = O.registerCommand(s, (e) => {
|
|
77
|
+
let t = r();
|
|
78
|
+
if (c(t)) {
|
|
79
79
|
let n = d(t.anchor.getNode(), p);
|
|
80
80
|
if (n) {
|
|
81
81
|
e.preventDefault();
|
|
@@ -92,7 +92,7 @@ var T = ({ onSearch: T, searchResponse: E, parentScrollPosition: D }) => {
|
|
|
92
92
|
let W = () => {
|
|
93
93
|
U();
|
|
94
94
|
};
|
|
95
|
-
return b(() =>
|
|
95
|
+
return b(() => a(O.registerCommand(n, (e) => e.key === "Escape" && V.current ? (e.preventDefault(), U(), !0) : !1, 1), O.registerRootListener((e, t) => {
|
|
96
96
|
t && t.removeEventListener("scroll", W), e && e.addEventListener("scroll", W);
|
|
97
97
|
})), [O]), b(() => {
|
|
98
98
|
L && U();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as e } from "../../../../components-
|
|
1
|
+
import { o as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as HistoryPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as e } from "../../../../components-
|
|
1
|
+
import { o as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as HistoryPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as e } from "../../../../../components-
|
|
1
|
+
import { c as e } from "../../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as AddLinkForm };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../../../LinkContextMenu-
|
|
1
|
+
import { t as e } from "../../../../../LinkContextMenu-59-rbxa2.js";
|
|
2
2
|
export { e as LinkContextMenu };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { s as e } from "../../../../components-
|
|
1
|
+
import { s as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as LinkPlugin };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import { i as e
|
|
2
|
-
|
|
1
|
+
import { i as e } from "../../../../LexicalLink.prod-6gI2ABQo.js";
|
|
2
|
+
//#region src/components/RteEditor/Plugins/LinkPlugin/helpers.ts
|
|
3
|
+
var t = /^(http|https):\/\//, n = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/, r = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/, i = /^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})?$/, a = (e) => e === "https://" || n.test(e), o = (e) => e === "https://" || i.test(e), s = [e(n, (e) => t.test(e) ? e : `//${e}`), e(r, (e) => `mailto:${e}`)], c = (e) => /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { s as MATCHERS, c as ensureHttps, a as validateUrl, o as validateUrlWithProtocol };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","names":[],"sources":["../../../../../src/components/RteEditor/Plugins/LinkPlugin/helpers.ts"],"sourcesContent":["import { createLinkMatcherWithRegExp } from '@lexical/react/LexicalAutoLinkPlugin';\n\nconst PROTOCOL_REGEX = /^(http|https):\\/\\//;\n\nconst URL_REGEX =\n /(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})/;\n\nconst EMAIL_REGEX =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))/;\n\nconst URL_REGEX_OR_BLANK =\n /^(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})?$/;\n\nexport const validateUrl = (url: string): boolean => {\n return url === 'https://' || URL_REGEX.test(url);\n};\n\nexport const validateUrlWithProtocol = (url: string): boolean => {\n return url === 'https://' || URL_REGEX_OR_BLANK.test(url);\n};\n\nexport const MATCHERS = [\n createLinkMatcherWithRegExp(URL_REGEX, (text: string): string => {\n return !PROTOCOL_REGEX.test(text) ? `//${text}` : text;\n }),\n createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => {\n return `mailto:${text}`;\n }),\n];\n\nexport const ensureHttps = (url: string) => {\n if (!/^https?:\\/\\//i.test(url)) {\n return `https://${url}`;\n }\n return url;\n};\n"],"mappings":";;AAEA,IAAM,IAAiB,sBAEjB,IACJ,qNAEI,IACJ,uJAEI,IACJ,wNAEW,KAAe,MACnB,MAAQ,cAAc,EAAU,KAAK,CAAG,GAGpC,KAA2B,MAC/B,MAAQ,cAAc,EAAmB,KAAK,CAAG,GAG7C,IAAW,CACtB,EAA4B,IAAY,MAC9B,EAAe,KAAK,CAAI,IAAkB,IAAd,KAAK,GAC1C,GACD,EAA4B,IAAc,MACjC,UAAU,GAClB,CACH,GAEa,KAAe,MACrB,gBAAgB,KAAK,CAAG,IAGtB,IAFE,WAAW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { s as e } from "../../../../components-
|
|
1
|
+
import { s as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as LinkPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "../../../../clsx-C67XSbzZ.js";
|
|
2
2
|
import { Icon as t } from "../../../Icon/Icon.js";
|
|
3
3
|
import { t as n } from "../../../../LexicalComposerContext.prod-D4HOlWII.js";
|
|
4
|
-
import {
|
|
5
|
-
import { l as s } from "../../../../LexicalUtils.prod-
|
|
6
|
-
import { i as c, n as l, o as u, r as d, s as f, t as p, u as m } from "../../../../LexicalList.prod-
|
|
4
|
+
import { Bt as r, W as i, ln as a, tn as o } from "../../../../Lexical.prod-BlUfEvo-.js";
|
|
5
|
+
import { l as s } from "../../../../LexicalUtils.prod-CNWf_0sq.js";
|
|
6
|
+
import { i as c, n as l, o as u, r as d, s as f, t as p, u as m } from "../../../../LexicalList.prod-CMGvSM1c.js";
|
|
7
7
|
import { t as h } from "../../../../RteEditor.module-pWBasED2.js";
|
|
8
8
|
import { useTranslation as g } from "../../hooks/useTranslation.js";
|
|
9
9
|
import { useEffect as _, useState as v } from "react";
|
|
@@ -17,7 +17,7 @@ var b = {
|
|
|
17
17
|
e === "number" && w !== "number" ? (C.dispatchCommand(u, void 0), T("number")) : e === "bullet" && w !== "bullet" ? (C.dispatchCommand(c, void 0), T("bullet")) : (C.dispatchCommand(f, void 0), T(null));
|
|
18
18
|
};
|
|
19
19
|
return _(() => {
|
|
20
|
-
let e = C.registerCommand(
|
|
20
|
+
let e = C.registerCommand(r, (e) => e.ctrlKey && e.shiftKey && e.code === "Digit7" ? (e.preventDefault(), O ? C.dispatchCommand(f, void 0) : C.dispatchCommand(u, void 0), !0) : e.ctrlKey && e.shiftKey && e.code === "Digit8" ? (e.preventDefault(), E ? C.dispatchCommand(f, void 0) : C.dispatchCommand(c, void 0), !0) : !1, 4);
|
|
21
21
|
return () => {
|
|
22
22
|
e();
|
|
23
23
|
};
|
|
@@ -26,20 +26,20 @@ var b = {
|
|
|
26
26
|
O,
|
|
27
27
|
E
|
|
28
28
|
]), _(() => {
|
|
29
|
-
let e = C.registerCommand(
|
|
30
|
-
let e =
|
|
31
|
-
if (!
|
|
29
|
+
let e = C.registerCommand(o, (e) => (e.preventDefault(), C.update(() => {
|
|
30
|
+
let e = i();
|
|
31
|
+
if (!a(e)) return;
|
|
32
32
|
let t = e.anchor.getNode(), n = t.getParent();
|
|
33
33
|
if (!d(n)) return;
|
|
34
|
-
let
|
|
35
|
-
if (l(
|
|
36
|
-
let e = m(l(
|
|
34
|
+
let r = n.getParent();
|
|
35
|
+
if (l(r)) {
|
|
36
|
+
let e = m(l(r) ? r.getListType() : "bullet");
|
|
37
37
|
n.append(e), e.append(t);
|
|
38
38
|
}
|
|
39
39
|
}), !0), 1), t = C.registerUpdateListener(({ editorState: e }) => {
|
|
40
40
|
e.read(() => {
|
|
41
|
-
let e =
|
|
42
|
-
if (
|
|
41
|
+
let e = i();
|
|
42
|
+
if (a(e)) {
|
|
43
43
|
let t = s(e.anchor.getNode(), p);
|
|
44
44
|
if (t) {
|
|
45
45
|
let e = t.getTag();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../../PasteHandlerPlugin-
|
|
1
|
+
import { t as e } from "../../../../PasteHandlerPlugin-CTzYRyAx.js";
|
|
2
2
|
export { e as PasteHandlerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../../PasteHandlerPlugin-
|
|
1
|
+
import { t as e } from "../../../../PasteHandlerPlugin-CTzYRyAx.js";
|
|
2
2
|
export { e as PasteHandlerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../../TableCellResizerPlugin-
|
|
1
|
+
import { t as e } from "../../../../TableCellResizerPlugin-D-fX5I3p.js";
|
|
2
2
|
export { e as TableCellResizerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../../TableCellResizerPlugin-
|
|
1
|
+
import { t as e } from "../../../../TableCellResizerPlugin-D-fX5I3p.js";
|
|
2
2
|
export { e as TableCellResizerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e } from "../../../../components-
|
|
1
|
+
import { a as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as AddTableForm };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e } from "../../../../components-
|
|
1
|
+
import { i as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as TablePlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as t, a as n, b as r, f as i, g as a, i as o, m as s, o as c, u as l, v as u, w as d, y as f } from "../../../../LexicalTable.prod-
|
|
1
|
+
import { sr as e } from "../../../../Lexical.prod-BlUfEvo-.js";
|
|
2
|
+
import { C as t, a as n, b as r, f as i, g as a, i as o, m as s, o as c, u as l, v as u, w as d, y as f } from "../../../../LexicalTable.prod-D3FUVxbr.js";
|
|
3
3
|
import { TableWrapperNode as p } from "../../nodes/TableWrapperNode/TableWrapperNode.js";
|
|
4
4
|
//#region src/components/RteEditor/Plugins/TablePlugin/helpers.ts
|
|
5
5
|
var m = 32, h = 48, g = 1, _ = 200, v = 320, y = (t, n) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { l as e } from "../../../../components-
|
|
1
|
+
import { l as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as ToolBarPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { l as e } from "../../../../components-
|
|
1
|
+
import { l as e } from "../../../../components-D2rPfyIW.js";
|
|
2
2
|
export { e as ToolBarPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as e, l as t, o as n, s as r } from "../../../components-
|
|
2
|
-
import { t as i } from "../../../TableCellResizerPlugin-
|
|
1
|
+
import { i as e, l as t, o as n, s as r } from "../../../components-D2rPfyIW.js";
|
|
2
|
+
import { t as i } from "../../../TableCellResizerPlugin-D-fX5I3p.js";
|
|
3
3
|
import { BlockFormatPlugin as a } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
4
4
|
import { ListPlugin as o } from "./ListPlugin/ListPlugin.js";
|
|
5
5
|
import { t as s } from "../../../TableCellContextMenu-Cu5iXYSJ.js";
|
|
6
|
-
import { t as c } from "../../../PasteHandlerPlugin-
|
|
6
|
+
import { t as c } from "../../../PasteHandlerPlugin-CTzYRyAx.js";
|
|
7
7
|
export { a as BlockFormatPlugin, n as HistoryPlugin, r as LinkPlugin, o as ListPlugin, c as PasteHandlerPlugin, s as TableCellContextMenu, i as TableCellResizerPlugin, e as TablePlugin, t as ToolBarPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../components-
|
|
1
|
+
import { n as e, t } from "../../components-D2rPfyIW.js";
|
|
2
2
|
export { t as Rte, e as RteEditor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "../../components-
|
|
1
|
+
import { n as e } from "../../components-D2rPfyIW.js";
|
|
2
2
|
import { t } from "../../Container-DOcrVe7u.js";
|
|
3
3
|
import "../../storyComponents/Container/index.js";
|
|
4
4
|
import { MOCK_RTE_CONTENT as n } from "./mockRteContent.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as n, t as r } from "../../LexicalList.prod-
|
|
3
|
-
import { c as i } from "../../LexicalLink.prod-
|
|
4
|
-
import { c as a } from "../../LexicalTable.prod-
|
|
1
|
+
import { Jn as e, dt as t } from "../../Lexical.prod-BlUfEvo-.js";
|
|
2
|
+
import { a as n, t as r } from "../../LexicalList.prod-CMGvSM1c.js";
|
|
3
|
+
import { c as i } from "../../LexicalLink.prod-6gI2ABQo.js";
|
|
4
|
+
import { c as a } from "../../LexicalTable.prod-D3FUVxbr.js";
|
|
5
5
|
import { CourseCatalogueNode as o } from "./nodes/CourseCatalogueNode/CourseCatalogueNode.js";
|
|
6
6
|
//#region src/components/RteEditor/helpers.ts
|
|
7
7
|
var s = (e) => {
|
|
@@ -12,8 +12,8 @@ var s = (e) => {
|
|
|
12
12
|
if (n && n.element instanceof HTMLElement) for (let e of [n.element, ...n.element.querySelectorAll("[style],[class],[dir=\"ltr\"]")]) e.removeAttribute("class"), e.getAttribute("style") && (e.setAttribute("style", ""), e.removeAttribute("style")), e.getAttribute("dir") === "ltr" && e.removeAttribute("dir");
|
|
13
13
|
return n;
|
|
14
14
|
}, u = /* @__PURE__ */ new Map([
|
|
15
|
-
[e, l],
|
|
16
15
|
[t, l],
|
|
16
|
+
[e, l],
|
|
17
17
|
[r, l],
|
|
18
18
|
[n, l],
|
|
19
19
|
[a, l],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../components-
|
|
1
|
+
import { n as e, t } from "../../components-D2rPfyIW.js";
|
|
2
2
|
export { t as Rte, e as RteEditor };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "../../../../LexicalComposerContext.prod-D4HOlWII.js";
|
|
2
|
-
import {
|
|
3
|
-
import { l as c } from "../../../../LexicalUtils.prod-
|
|
2
|
+
import { I as t, W as n, Xn as r, b as i, gn as a, ln as o, ot as s } from "../../../../Lexical.prod-BlUfEvo-.js";
|
|
3
|
+
import { l as c } from "../../../../LexicalUtils.prod-CNWf_0sq.js";
|
|
4
4
|
import { useEffect as l } from "react";
|
|
5
5
|
//#region src/components/RteEditor/nodes/CourseCatalogueNode/CourseCatalogueNode.tsx
|
|
6
|
-
var u = class e extends
|
|
6
|
+
var u = class e extends s {
|
|
7
7
|
__linkType;
|
|
8
8
|
__code;
|
|
9
9
|
__label;
|
|
@@ -72,19 +72,19 @@ function f(e) {
|
|
|
72
72
|
function p(e) {
|
|
73
73
|
return f(e) ? e.__linkType : null;
|
|
74
74
|
}
|
|
75
|
-
var m =
|
|
75
|
+
var m = i("insertCourseCatalogueLink"), h = i("removeCourseCatalogueLink");
|
|
76
76
|
function g() {
|
|
77
|
-
let [
|
|
78
|
-
if (!
|
|
77
|
+
let [i] = e();
|
|
78
|
+
if (!i.hasNodes([u])) throw Error("CourseCataloguePlugin: CourseCatalogueNode is not registered on editor");
|
|
79
79
|
return l(() => {
|
|
80
|
-
let e =
|
|
81
|
-
let
|
|
82
|
-
return
|
|
83
|
-
}, 2), s =
|
|
84
|
-
let e =
|
|
85
|
-
if (
|
|
80
|
+
let e = i.registerCommand(m, (e) => {
|
|
81
|
+
let n = d(e.linkType, e.code, e.label), i = r(e.label);
|
|
82
|
+
return n.append(i), t([n]), !0;
|
|
83
|
+
}, 2), s = i.registerCommand(h, () => {
|
|
84
|
+
let e = n();
|
|
85
|
+
if (o(e)) {
|
|
86
86
|
let t = e.anchor.getNode(), n = e.anchor.offset, i = c(t, u);
|
|
87
|
-
if (
|
|
87
|
+
if (a(t) && n === t.getTextContentSize() && t.getNextSibling() instanceof u && (i = t.getNextSibling()), i) {
|
|
88
88
|
let e = i.getParent();
|
|
89
89
|
i.remove(), e && e.append(r(" "));
|
|
90
90
|
}
|
|
@@ -94,7 +94,7 @@ function g() {
|
|
|
94
94
|
return () => {
|
|
95
95
|
e(), s();
|
|
96
96
|
};
|
|
97
|
-
}, [
|
|
97
|
+
}, [i]), null;
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
export { d as $createCourseCatalogueNode, p as $getLinkTypeFromNode, f as $isCourseCatalogueNode, g as CourseCatalogueLinkPlugin, u as CourseCatalogueNode, m as INSERT_COURSE_CATALOGUE_LINK, h as REMOVE_COURSE_CATALOGUE_LINK };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as e } from "../../../../LexicalComposerContext.prod-D4HOlWII.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { W as t, b as n, h as r, ln as i, ot as a, sr as o } from "../../../../Lexical.prod-BlUfEvo-.js";
|
|
3
|
+
import { t as s } from "../../../../LexicalSelection.prod-DS_R6Cl1.js";
|
|
4
|
+
import { l as c } from "../../../../LexicalUtils.prod-CNWf_0sq.js";
|
|
4
5
|
import { useEffect as l } from "react";
|
|
5
6
|
//#region src/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.tsx
|
|
6
7
|
var u = class e extends a {
|
|
@@ -18,7 +19,7 @@ var u = class e extends a {
|
|
|
18
19
|
return !1;
|
|
19
20
|
}
|
|
20
21
|
insertNewAfter(e, t) {
|
|
21
|
-
let n =
|
|
22
|
+
let n = o(), r = this.getDirection();
|
|
22
23
|
return n.setDirection(r), this.insertAfter(n, t), n;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
@@ -28,32 +29,32 @@ function d() {
|
|
|
28
29
|
function f(e) {
|
|
29
30
|
return e instanceof u;
|
|
30
31
|
}
|
|
31
|
-
var p =
|
|
32
|
+
var p = n("insertTableWrapperNode"), m = n("removeTableWrapperNode");
|
|
32
33
|
function h() {
|
|
33
|
-
let [
|
|
34
|
-
if (!
|
|
34
|
+
let [n] = e();
|
|
35
|
+
if (!n.hasNodes([u])) throw Error("TableWrapperPlugin: TableWrapperNode is not registered on editor");
|
|
35
36
|
return l(() => {
|
|
36
|
-
let e =
|
|
37
|
+
let e = n.registerCommand(p, () => {
|
|
37
38
|
let e = t();
|
|
38
|
-
return
|
|
39
|
-
}, 2),
|
|
39
|
+
return i(e) && s(e, d), !0;
|
|
40
|
+
}, 2), a = n.registerCommand(m, () => {
|
|
40
41
|
let e = t();
|
|
41
|
-
if (
|
|
42
|
+
if (i(e)) {
|
|
42
43
|
let t = e.anchor.getNode();
|
|
43
|
-
if (!
|
|
44
|
-
let
|
|
45
|
-
if (!
|
|
46
|
-
let
|
|
47
|
-
if (!
|
|
48
|
-
let
|
|
49
|
-
|
|
44
|
+
if (!r(t)) return !1;
|
|
45
|
+
let n = c(t, u);
|
|
46
|
+
if (!n) return !1;
|
|
47
|
+
let i = n?.getChildren();
|
|
48
|
+
if (!i) return !1;
|
|
49
|
+
let a = o();
|
|
50
|
+
i.forEach((e) => a.append(e)), n.replace(a);
|
|
50
51
|
}
|
|
51
52
|
return !0;
|
|
52
53
|
}, 2);
|
|
53
54
|
return () => {
|
|
54
|
-
e(),
|
|
55
|
+
e(), a();
|
|
55
56
|
};
|
|
56
|
-
}, [
|
|
57
|
+
}, [n]), null;
|
|
57
58
|
}
|
|
58
59
|
//#endregion
|
|
59
60
|
export { d as $createTableWrapperNode, f as $isTableWrapperNode, p as INSERT_TABLE_WRAPPER, m as REMOVE_TABLE_WRAPPER, u as TableWrapperNode, h as TableWrapperPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableWrapperNode.js","names":[],"sources":["../../../../../src/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport {\r\n $createParagraphNode,\r\n $getSelection,\r\n $isElementNode,\r\n $isRangeSelection,\r\n COMMAND_PRIORITY_NORMAL,\r\n createCommand,\r\n ElementNode,\r\n} from 'lexical';\r\nimport { $getNearestNodeOfType } from '@lexical/utils';\r\nimport { $setBlocksType } from '@lexical/selection';\r\nimport { useEffect } from 'react';\r\n\r\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';\r\nimport type { EditorConfig, LexicalNode, RangeSelection } from 'lexical';\r\n\r\nexport type SerializedTableWrapperNode = SerializedDecoratorBlockNode;\r\n\r\nexport class TableWrapperNode extends ElementNode {\r\n static getType(): string {\r\n return 'tableWrapper';\r\n }\r\n\r\n static clone(node: TableWrapperNode): TableWrapperNode {\r\n return new TableWrapperNode(node.__key);\r\n }\r\n\r\n createDOM(config: EditorConfig): HTMLElement {\r\n const element = document.createElement('div');\r\n element.className = config.theme.tableWrapper;\r\n return element;\r\n }\r\n\r\n updateDOM(): false {\r\n return false;\r\n }\r\n\r\n insertNewAfter(_selection: RangeSelection, restoreSelection?: boolean | undefined): LexicalNode | null {\r\n const newBlock = $createParagraphNode();\r\n const direction = this.getDirection();\r\n newBlock.setDirection(direction);\r\n this.insertAfter(newBlock, restoreSelection);\r\n return newBlock;\r\n }\r\n}\r\n\r\nexport function $createTableWrapperNode(): TableWrapperNode {\r\n return new TableWrapperNode();\r\n}\r\n\r\nexport function $isTableWrapperNode(node: LexicalNode): node is TableWrapperNode {\r\n return node instanceof TableWrapperNode;\r\n}\r\n\r\nexport const INSERT_TABLE_WRAPPER = createCommand('insertTableWrapperNode');\r\n\r\nexport const REMOVE_TABLE_WRAPPER = createCommand('removeTableWrapperNode');\r\n\r\nexport function TableWrapperPlugin(): null {\r\n const [editor] = useLexicalComposerContext();\r\n if (!editor.hasNodes([TableWrapperNode])) {\r\n throw new Error('TableWrapperPlugin: TableWrapperNode is not registered on editor');\r\n }\r\n useEffect(() => {\r\n const insertTableWrapper = editor.registerCommand(\r\n INSERT_TABLE_WRAPPER,\r\n () => {\r\n const selection = $getSelection();\r\n if ($isRangeSelection(selection)) {\r\n $setBlocksType(selection, $createTableWrapperNode);\r\n }\r\n return true;\r\n },\r\n COMMAND_PRIORITY_NORMAL\r\n );\r\n\r\n const removeTableWrapper = editor.registerCommand(\r\n REMOVE_TABLE_WRAPPER,\r\n () => {\r\n const selection = $getSelection();\r\n if ($isRangeSelection(selection)) {\r\n const node = selection.anchor.getNode();\r\n if (!$isElementNode(node)) return false;\r\n const tableWrapperNode = $getNearestNodeOfType(node, TableWrapperNode);\r\n if (!tableWrapperNode) return false;\r\n const childrenNodes = tableWrapperNode?.getChildren();\r\n if (!childrenNodes) return false;\r\n const paragraphNode = $createParagraphNode();\r\n childrenNodes.forEach((child) => paragraphNode.append(child));\r\n tableWrapperNode.replace(paragraphNode);\r\n }\r\n return true;\r\n },\r\n COMMAND_PRIORITY_NORMAL\r\n );\r\n\r\n return () => {\r\n insertTableWrapper();\r\n removeTableWrapper();\r\n };\r\n }, [editor]);\r\n return null;\r\n}\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableWrapperNode.js","names":[],"sources":["../../../../../src/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport {\r\n $createParagraphNode,\r\n $getSelection,\r\n $isElementNode,\r\n $isRangeSelection,\r\n COMMAND_PRIORITY_NORMAL,\r\n createCommand,\r\n ElementNode,\r\n} from 'lexical';\r\nimport { $getNearestNodeOfType } from '@lexical/utils';\r\nimport { $setBlocksType } from '@lexical/selection';\r\nimport { useEffect } from 'react';\r\n\r\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';\r\nimport type { EditorConfig, LexicalNode, RangeSelection } from 'lexical';\r\n\r\nexport type SerializedTableWrapperNode = SerializedDecoratorBlockNode;\r\n\r\nexport class TableWrapperNode extends ElementNode {\r\n static getType(): string {\r\n return 'tableWrapper';\r\n }\r\n\r\n static clone(node: TableWrapperNode): TableWrapperNode {\r\n return new TableWrapperNode(node.__key);\r\n }\r\n\r\n createDOM(config: EditorConfig): HTMLElement {\r\n const element = document.createElement('div');\r\n element.className = config.theme.tableWrapper;\r\n return element;\r\n }\r\n\r\n updateDOM(): false {\r\n return false;\r\n }\r\n\r\n insertNewAfter(_selection: RangeSelection, restoreSelection?: boolean | undefined): LexicalNode | null {\r\n const newBlock = $createParagraphNode();\r\n const direction = this.getDirection();\r\n newBlock.setDirection(direction);\r\n this.insertAfter(newBlock, restoreSelection);\r\n return newBlock;\r\n }\r\n}\r\n\r\nexport function $createTableWrapperNode(): TableWrapperNode {\r\n return new TableWrapperNode();\r\n}\r\n\r\nexport function $isTableWrapperNode(node: LexicalNode): node is TableWrapperNode {\r\n return node instanceof TableWrapperNode;\r\n}\r\n\r\nexport const INSERT_TABLE_WRAPPER = createCommand('insertTableWrapperNode');\r\n\r\nexport const REMOVE_TABLE_WRAPPER = createCommand('removeTableWrapperNode');\r\n\r\nexport function TableWrapperPlugin(): null {\r\n const [editor] = useLexicalComposerContext();\r\n if (!editor.hasNodes([TableWrapperNode])) {\r\n throw new Error('TableWrapperPlugin: TableWrapperNode is not registered on editor');\r\n }\r\n useEffect(() => {\r\n const insertTableWrapper = editor.registerCommand(\r\n INSERT_TABLE_WRAPPER,\r\n () => {\r\n const selection = $getSelection();\r\n if ($isRangeSelection(selection)) {\r\n $setBlocksType(selection, $createTableWrapperNode);\r\n }\r\n return true;\r\n },\r\n COMMAND_PRIORITY_NORMAL\r\n );\r\n\r\n const removeTableWrapper = editor.registerCommand(\r\n REMOVE_TABLE_WRAPPER,\r\n () => {\r\n const selection = $getSelection();\r\n if ($isRangeSelection(selection)) {\r\n const node = selection.anchor.getNode();\r\n if (!$isElementNode(node)) return false;\r\n const tableWrapperNode = $getNearestNodeOfType(node, TableWrapperNode);\r\n if (!tableWrapperNode) return false;\r\n const childrenNodes = tableWrapperNode?.getChildren();\r\n if (!childrenNodes) return false;\r\n const paragraphNode = $createParagraphNode();\r\n childrenNodes.forEach((child) => paragraphNode.append(child));\r\n tableWrapperNode.replace(paragraphNode);\r\n }\r\n return true;\r\n },\r\n COMMAND_PRIORITY_NORMAL\r\n );\r\n\r\n return () => {\r\n insertTableWrapper();\r\n removeTableWrapper();\r\n };\r\n }, [editor]);\r\n return null;\r\n}\r\n"],"mappings":";;;;;;AAmBA,IAAa,IAAb,MAAa,UAAyB,EAAY;CAChD,OAAO,UAAkB;EACvB,OAAO;CACT;CAEA,OAAO,MAAM,GAA0C;EACrD,OAAO,IAAI,EAAiB,EAAK,KAAK;CACxC;CAEA,UAAU,GAAmC;EAC3C,IAAM,IAAU,SAAS,cAAc,KAAK;EAE5C,OADA,EAAQ,YAAY,EAAO,MAAM,cAC1B;CACT;CAEA,YAAmB;EACjB,OAAO;CACT;CAEA,eAAe,GAA4B,GAA4D;EACrG,IAAM,IAAW,EAAqB,GAChC,IAAY,KAAK,aAAa;EAGpC,OAFA,EAAS,aAAa,CAAS,GAC/B,KAAK,YAAY,GAAU,CAAgB,GACpC;CACT;AACF;AAEA,SAAgB,IAA4C;CAC1D,OAAO,IAAI,EAAiB;AAC9B;AAEA,SAAgB,EAAoB,GAA6C;CAC/E,OAAO,aAAgB;AACzB;AAEA,IAAa,IAAuB,EAAc,wBAAwB,GAE7D,IAAuB,EAAc,wBAAwB;AAE1E,SAAgB,IAA2B;CACzC,IAAM,CAAC,KAAU,EAA0B;CAC3C,IAAI,CAAC,EAAO,SAAS,CAAC,CAAgB,CAAC,GACrC,MAAU,MAAM,kEAAkE;CAwCpF,OAtCA,QAAgB;EACd,IAAM,IAAqB,EAAO,gBAChC,SACM;GACJ,IAAM,IAAY,EAAc;GAIhC,OAHI,EAAkB,CAAS,KAC7B,EAAe,GAAW,CAAuB,GAE5C;EACT,GAAA,CAEF,GAEM,IAAqB,EAAO,gBAChC,SACM;GACJ,IAAM,IAAY,EAAc;GAChC,IAAI,EAAkB,CAAS,GAAG;IAChC,IAAM,IAAO,EAAU,OAAO,QAAQ;IACtC,IAAI,CAAC,EAAe,CAAI,GAAG,OAAO;IAClC,IAAM,IAAmB,EAAsB,GAAM,CAAgB;IACrE,IAAI,CAAC,GAAkB,OAAO;IAC9B,IAAM,IAAgB,GAAkB,YAAY;IACpD,IAAI,CAAC,GAAe,OAAO;IAC3B,IAAM,IAAgB,EAAqB;IAE3C,AADA,EAAc,SAAS,MAAU,EAAc,OAAO,CAAK,CAAC,GAC5D,EAAiB,QAAQ,CAAa;GACxC;GACA,OAAO;EACT,GAAA,CAEF;EAEA,aAAa;GAEX,AADA,EAAmB,GACnB,EAAmB;EACrB;CACF,GAAG,CAAC,CAAM,CAAC,GACJ;AACT"}
|
|
@@ -12,7 +12,8 @@ var s = e({}), c = ({ options: e, defaultValue: t, children: c }) => {
|
|
|
12
12
|
label: "",
|
|
13
13
|
selectedLabel: "-"
|
|
14
14
|
}, b = (t, n = !1) => {
|
|
15
|
-
|
|
15
|
+
let r = e.findIndex((e) => e.value === t.value);
|
|
16
|
+
m(r), u(t), f(!1), g(!n);
|
|
16
17
|
};
|
|
17
18
|
return t !== -1 && !l.value && b(y(t), !0), n(() => {
|
|
18
19
|
y(l.value || t).label !== l.label && b(y(l.value || t));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectProvider.js","names":[],"sources":["../../../src/components/SelectListbox/SelectProvider.tsx"],"sourcesContent":["import { createContext, useContext, useState, useId, useRef, useEffect } from 'react';\n\nimport type { PropsWithChildren } from 'react';\n\nexport type SelectValue = string | number | null;\n\nexport type OptionValue = {\n value: SelectValue;\n label: string;\n selectedLabel?: string;\n disabled?: boolean;\n};\nexport interface SelectListboxContext {\n options: OptionValue[];\n selectedValue: OptionValue;\n setSelectedValue: (v: OptionValue) => void;\n isOpen: boolean;\n setIsOpen: (v: boolean) => void;\n toggleListbox: () => void;\n getValue: (value: SelectValue) => OptionValue;\n activeIndex: number;\n setActiveIndex: (v: number) => void;\n listboxId: string;\n isDirty: boolean;\n}\n\nconst SelectContext = createContext<SelectListboxContext>({} as SelectListboxContext);\n\ninterface Props {\n options: OptionValue[];\n defaultValue: SelectValue;\n}\n\nexport const SelectProvider = ({ options, defaultValue, children }: PropsWithChildren<Props>) => {\n const [value, setValue] = useState<OptionValue>({ value: '', label: '' });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const [isDirty, setIsDirty] = useState(false);\n const listboxId = useRef<string>(useId());\n\n const toggleListbox = () => {\n setIsOpen((status) => !status);\n setIsDirty(false);\n };\n\n const getValue = (value: SelectValue) => {\n return (\n options.find((option) => option.value === value) || {\n value: -1,\n label: '',\n selectedLabel: '-',\n }\n );\n };\n\n const setSelectedValue = (value: OptionValue, isDefault = false) => {\n const selectedIndex = options.findIndex((option) => option.value === value.value);\n setActiveIndex(selectedIndex);\n setValue(value);\n setIsOpen(false);\n setIsDirty(!isDefault);\n };\n\n if (defaultValue !== -1 && !value.value) {\n setSelectedValue(getValue(defaultValue), true);\n }\n\n useEffect(() => {\n const newLabel = getValue(value.value || defaultValue).label;\n if (newLabel !== value.label) {\n setSelectedValue(getValue(value.value || defaultValue));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, defaultValue]);\n\n return (\n <SelectContext.Provider\n value={{\n options,\n selectedValue: value,\n setSelectedValue,\n isOpen,\n setIsOpen,\n toggleListbox,\n getValue,\n activeIndex,\n setActiveIndex,\n listboxId: listboxId.current,\n isDirty,\n }}\n >\n {children}\n </SelectContext.Provider>\n );\n};\n\nexport const useSelect = () => {\n const context = useContext(SelectContext);\n\n if (context === undefined) throw new Error('useSelect can only be used in an SelectProvider');\n\n return context;\n};\n"],"mappings":";;;AA0BA,IAAM,IAAgB,EAAoC,CAAC,CAAyB,GAOvE,KAAkB,EAAE,YAAS,iBAAc,kBAAyC;CAC/F,IAAM,CAAC,GAAO,KAAY,EAAsB;EAAE,OAAO;EAAI,OAAO;CAAG,CAAC,GAClE,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAa,KAAkB,EAAS,EAAE,GAC3C,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,IAAY,EAAe,EAAM,CAAC,GAElC,UAAsB;EAE1B,AADA,GAAW,MAAW,CAAC,CAAM,GAC7B,EAAW,EAAK;CAClB,GAEM,KAAY,MAEd,EAAQ,MAAM,MAAW,EAAO,UAAU,CAAK,KAAK;EAClD,OAAO;EACP,OAAO;EACP,eAAe;CACjB,GAIE,KAAoB,GAAoB,IAAY,OAAU;
|
|
1
|
+
{"version":3,"file":"SelectProvider.js","names":[],"sources":["../../../src/components/SelectListbox/SelectProvider.tsx"],"sourcesContent":["import { createContext, useContext, useState, useId, useRef, useEffect } from 'react';\n\nimport type { PropsWithChildren } from 'react';\n\nexport type SelectValue = string | number | null;\n\nexport type OptionValue = {\n value: SelectValue;\n label: string;\n selectedLabel?: string;\n disabled?: boolean;\n};\nexport interface SelectListboxContext {\n options: OptionValue[];\n selectedValue: OptionValue;\n setSelectedValue: (v: OptionValue) => void;\n isOpen: boolean;\n setIsOpen: (v: boolean) => void;\n toggleListbox: () => void;\n getValue: (value: SelectValue) => OptionValue;\n activeIndex: number;\n setActiveIndex: (v: number) => void;\n listboxId: string;\n isDirty: boolean;\n}\n\nconst SelectContext = createContext<SelectListboxContext>({} as SelectListboxContext);\n\ninterface Props {\n options: OptionValue[];\n defaultValue: SelectValue;\n}\n\nexport const SelectProvider = ({ options, defaultValue, children }: PropsWithChildren<Props>) => {\n const [value, setValue] = useState<OptionValue>({ value: '', label: '' });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const [isDirty, setIsDirty] = useState(false);\n const listboxId = useRef<string>(useId());\n\n const toggleListbox = () => {\n setIsOpen((status) => !status);\n setIsDirty(false);\n };\n\n const getValue = (value: SelectValue) => {\n return (\n options.find((option) => option.value === value) || {\n value: -1,\n label: '',\n selectedLabel: '-',\n }\n );\n };\n\n const setSelectedValue = (value: OptionValue, isDefault = false) => {\n const selectedIndex = options.findIndex((option) => option.value === value.value);\n setActiveIndex(selectedIndex);\n setValue(value);\n setIsOpen(false);\n setIsDirty(!isDefault);\n };\n\n if (defaultValue !== -1 && !value.value) {\n setSelectedValue(getValue(defaultValue), true);\n }\n\n useEffect(() => {\n const newLabel = getValue(value.value || defaultValue).label;\n if (newLabel !== value.label) {\n setSelectedValue(getValue(value.value || defaultValue));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, defaultValue]);\n\n return (\n <SelectContext.Provider\n value={{\n options,\n selectedValue: value,\n setSelectedValue,\n isOpen,\n setIsOpen,\n toggleListbox,\n getValue,\n activeIndex,\n setActiveIndex,\n listboxId: listboxId.current,\n isDirty,\n }}\n >\n {children}\n </SelectContext.Provider>\n );\n};\n\nexport const useSelect = () => {\n const context = useContext(SelectContext);\n\n if (context === undefined) throw new Error('useSelect can only be used in an SelectProvider');\n\n return context;\n};\n"],"mappings":";;;AA0BA,IAAM,IAAgB,EAAoC,CAAC,CAAyB,GAOvE,KAAkB,EAAE,YAAS,iBAAc,kBAAyC;CAC/F,IAAM,CAAC,GAAO,KAAY,EAAsB;EAAE,OAAO;EAAI,OAAO;CAAG,CAAC,GAClE,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAa,KAAkB,EAAS,EAAE,GAC3C,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,IAAY,EAAe,EAAM,CAAC,GAElC,UAAsB;EAE1B,AADA,GAAW,MAAW,CAAC,CAAM,GAC7B,EAAW,EAAK;CAClB,GAEM,KAAY,MAEd,EAAQ,MAAM,MAAW,EAAO,UAAU,CAAK,KAAK;EAClD,OAAO;EACP,OAAO;EACP,eAAe;CACjB,GAIE,KAAoB,GAAoB,IAAY,OAAU;EAClE,IAAM,IAAgB,EAAQ,WAAW,MAAW,EAAO,UAAU,EAAM,KAAK;EAIhF,AAHA,EAAe,CAAa,GAC5B,EAAS,CAAK,GACd,EAAU,EAAK,GACf,EAAW,CAAC,CAAS;CACvB;CAcA,OAZI,MAAiB,MAAM,CAAC,EAAM,SAChC,EAAiB,EAAS,CAAY,GAAG,EAAI,GAG/C,QAAgB;EAEd,AADiB,EAAS,EAAM,SAAS,CAAY,CAAC,CAAC,UACtC,EAAM,SACrB,EAAiB,EAAS,EAAM,SAAS,CAAY,CAAC;CAG1D,GAAG,CAAC,GAAS,CAAY,CAAC,GAGxB,kBAAC,EAAc,UAAf;EACE,OAAO;GACL;GACA,eAAe;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA,WAAW,EAAU;GACrB;EACF;EAEC;CACqB,CAAA;AAE5B,GAEa,UAAkB;CAC7B,IAAM,IAAU,EAAW,CAAa;CAExC,IAAI,MAAY,KAAA,GAAW,MAAU,MAAM,iDAAiD;CAE5F,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../Slider-
|
|
1
|
+
import { t as e } from "../../Slider-CqYFsgRL.js";
|
|
2
2
|
export { e as Slider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../Slider-
|
|
1
|
+
import { t as e } from "../../Slider-CqYFsgRL.js";
|
|
2
2
|
export { e as Slider };
|
|
@@ -50,8 +50,8 @@ function m({ children: m, handlePlacement: h, disabled: g, sortableItemColor: _,
|
|
|
50
50
|
function R(e) {
|
|
51
51
|
if (e.preventDefault(), !P) return;
|
|
52
52
|
C(v);
|
|
53
|
-
let { direction: t } = e.currentTarget.dataset;
|
|
54
|
-
w(
|
|
53
|
+
let { direction: t } = e.currentTarget.dataset, n = t === "up" ? v - 1 : v + 1;
|
|
54
|
+
w(n);
|
|
55
55
|
}
|
|
56
56
|
return /* @__PURE__ */ u("div", {
|
|
57
57
|
className: e(n["sortable__sort-item"], n[`sortable__sort-item--${_}`]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableItem.js","names":[],"sources":["../../../../src/components/Sortable/components/SortableItem.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { DragEvent, MouseEvent, KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';\nimport type { SortableHandleProps } from './SortableHandle';\nimport type { SortableItemColors } from 'components/Sortable/Sortable';\n\nimport { Icon } from 'components/Icon';\nimport { SortableHandle } from 'components/Sortable/components/SortableHandle';\nimport styles from 'components/Sortable/Sortable.module.css';\nimport { useSortable } from 'components/Sortable/SortableProvider';\n\nexport interface SortableItemProps {\n children: ReactNode;\n handlePlacement: SortableHandleProps['placement'];\n disabled?: boolean;\n sortableItemColor: SortableItemColors;\n index: number;\n}\n\nconst ACCESS_KEYS = ['Space', 'ArrowDown', 'ArrowUp'];\nconst noSupportTouch = 'ontouchstart' in globalThis.document.documentElement;\nconst dragImage = new Image(0, 0);\n\ndragImage.src =\n // 1px transparent png\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==';\n\nexport function SortableItem({ children, handlePlacement, disabled, sortableItemColor, index }: SortableItemProps) {\n const {\n clone,\n dragEnd,\n draggingSource,\n draggingTarget,\n dragStart,\n drop,\n maxIndex,\n moveToPosition,\n setClone,\n setDraggingSource,\n } = useSortable();\n const [grabbing, setGrabbing] = useState(false);\n const [moving, setmoving] = useState(false);\n const itemRef = useRef<HTMLDivElement>(null);\n const hasIndex = index !== undefined && index >= 0;\n\n useEffect(() => {\n if (!itemRef.current) return;\n if (globalThis.document.activeElement === itemRef.current) return;\n\n if (index === draggingTarget && draggingTarget === draggingSource) {\n // Manually setting focus after an item has been moved with the keyboard; focus is lost after rerender\n itemRef.current.focus();\n setmoving(true);\n } else {\n setmoving(false);\n }\n }, [index, draggingTarget, draggingSource, setDraggingSource]);\n\n function handleDragStart(event: DragEvent<HTMLDivElement>) {\n event.stopPropagation();\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n\n if (itemRef.current) {\n const cloned = itemRef.current.cloneNode(true) as Element;\n\n cloned.classList.add(styles['sortable__sort-item--ghost']);\n\n setClone(cloned);\n }\n\n if (hasIndex) dragStart(index);\n setGrabbing(true);\n }\n\n function handleDragEnd() {\n if (grabbing) return;\n\n if (clone) document.body.removeChild(clone);\n\n setGrabbing(false);\n dragEnd();\n }\n\n function handleKeyUp(event: ReactKeyboardEvent<HTMLDivElement>) {\n const { code } = event;\n\n if (code === 'Tab' && draggingSource !== undefined) {\n dragEnd();\n return;\n }\n\n if (ACCESS_KEYS.includes(code) === false) return;\n\n if (!hasIndex) return;\n\n if (code === 'Space') {\n if (moving) {\n setmoving(false);\n dragEnd();\n } else {\n setmoving(true);\n dragStart(index);\n }\n\n return;\n }\n\n if (draggingSource === undefined) return;\n\n const newTarget = code === 'ArrowUp' ? index - 1 : index + 1;\n\n if (newTarget < 0 || newTarget > maxIndex) return;\n\n moveToPosition(newTarget);\n }\n\n function handleMove(event: MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n\n if (!hasIndex) return;\n\n dragStart(index);\n\n const { direction } = event.currentTarget.dataset;\n const newTarget = direction === 'up' ? index - 1 : index + 1;\n\n drop(newTarget);\n }\n\n return (\n <div\n className={clsx(styles['sortable__sort-item'], styles[`sortable__sort-item--${sortableItemColor}`])}\n draggable={!disabled}\n onDragEnd={handleDragEnd}\n onDragStart={handleDragStart}\n onKeyUpCapture={handleKeyUp}\n ref={itemRef}\n role=\"presentation\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n >\n <div\n className={`${styles['sortable__sort-item__contents']} ${styles[`sortable__sort-item__contents--handle-${handlePlacement}`]}`}\n >\n {handlePlacement === 'left' && <SortableHandle placement=\"left\" />}\n {children}\n {handlePlacement === 'right' && <SortableHandle placement=\"right\" />}\n </div>\n\n <div className={styles['sortable__sort-item__button-container']} data-touch={noSupportTouch}>\n {!disabled && hasIndex && (\n <>\n {hasIndex && (\n <>\n {index > 0 && (\n <button\n className={`${styles['sortable__sort-item__handle']} ${styles['sortable__sort-item__handle--up']}`}\n data-direction=\"up\"\n onClickCapture={handleMove}\n >\n <div className={styles['sortable__sort-item__handle--icon']}>\n <Icon name=\"CheveronDown\" />\n </div>\n <span className={styles['sortable__visually-hidden']}>Move up</span>\n </button>\n )}\n\n {index < maxIndex && (\n <button\n className={`${styles['sortable__sort-item__handle']} ${styles['sortable__sort-item__handle--down']}`}\n data-direction=\"down\"\n onClickCapture={handleMove}\n >\n <div className={styles['sortable__sort-item__handle--icon']}>\n <Icon name=\"CheveronDown\" />\n </div>\n <span className={styles['sortable__visually-hidden']}>Move down</span>\n </button>\n )}\n </>\n )}\n </>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,IAAM,IAAc;CAAC;CAAS;CAAa;AAAS,GAC9C,IAAiB,kBAAkB,WAAW,SAAS,iBACvD,IAAY,IAAI,MAAM,GAAG,CAAC;AAEhC,EAAU,MAER;AAEF,SAAgB,EAAa,EAAE,aAAU,oBAAiB,aAAU,sBAAmB,YAA4B;CACjH,IAAM,EACJ,UACA,YACA,mBACA,mBACA,cACA,SACA,aACA,mBACA,aACA,yBACE,EAAY,GACV,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,IAAU,EAAuB,IAAI,GACrC,IAAW,MAAU,KAAA,KAAa,KAAS;CAEjD,QAAgB;EACT,EAAQ,WACT,WAAW,SAAS,kBAAkB,EAAQ,YAE9C,MAAU,KAAkB,MAAmB,KAEjD,EAAQ,QAAQ,MAAM,GACtB,EAAU,EAAI,KAEd,EAAU,EAAK;CAEnB,GAAG;EAAC;EAAO;EAAgB;EAAgB;CAAiB,CAAC;CAE7D,SAAS,EAAgB,GAAkC;EAMzD,IALA,EAAM,gBAAgB,GAEtB,EAAM,aAAa,gBAAgB,QACnC,EAAM,aAAa,aAAa,GAAW,GAAG,CAAC,GAE3C,EAAQ,SAAS;GACnB,IAAM,IAAS,EAAQ,QAAQ,UAAU,EAAI;GAI7C,AAFA,EAAO,UAAU,IAAI,EAAO,6BAA6B,GAEzD,EAAS,CAAM;EACjB;EAGA,AADI,KAAU,EAAU,CAAK,GAC7B,EAAY,EAAI;CAClB;CAEA,SAAS,IAAgB;EACnB,MAEA,KAAO,SAAS,KAAK,YAAY,CAAK,GAE1C,EAAY,EAAK,GACjB,EAAQ;CACV;CAEA,SAAS,EAAY,GAA2C;EAC9D,IAAM,EAAE,YAAS;EAEjB,IAAI,MAAS,SAAS,MAAmB,KAAA,GAAW;GAClD,EAAQ;GACR;EACF;EAIA,IAFI,EAAY,SAAS,CAAI,MAAM,MAE/B,CAAC,GAAU;EAEf,IAAI,MAAS,SAAS;GACpB,AAAI,KACF,EAAU,EAAK,GACf,EAAQ,MAER,EAAU,EAAI,GACd,EAAU,CAAK;GAGjB;EACF;EAEA,IAAI,MAAmB,KAAA,GAAW;EAElC,IAAM,IAAY,MAAS,YAAY,IAAQ,IAAI,IAAQ;EAEvD,IAAY,KAAK,IAAY,KAEjC,EAAe,CAAS;CAC1B;CAEA,SAAS,EAAW,GAAsC;EAGxD,IAFA,EAAM,eAAe,GAEjB,CAAC,GAAU;EAEf,EAAU,CAAK;EAEf,IAAM,EAAE,iBAAc,EAAM,cAAc
|
|
1
|
+
{"version":3,"file":"SortableItem.js","names":[],"sources":["../../../../src/components/Sortable/components/SortableItem.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { DragEvent, MouseEvent, KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';\nimport type { SortableHandleProps } from './SortableHandle';\nimport type { SortableItemColors } from 'components/Sortable/Sortable';\n\nimport { Icon } from 'components/Icon';\nimport { SortableHandle } from 'components/Sortable/components/SortableHandle';\nimport styles from 'components/Sortable/Sortable.module.css';\nimport { useSortable } from 'components/Sortable/SortableProvider';\n\nexport interface SortableItemProps {\n children: ReactNode;\n handlePlacement: SortableHandleProps['placement'];\n disabled?: boolean;\n sortableItemColor: SortableItemColors;\n index: number;\n}\n\nconst ACCESS_KEYS = ['Space', 'ArrowDown', 'ArrowUp'];\nconst noSupportTouch = 'ontouchstart' in globalThis.document.documentElement;\nconst dragImage = new Image(0, 0);\n\ndragImage.src =\n // 1px transparent png\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==';\n\nexport function SortableItem({ children, handlePlacement, disabled, sortableItemColor, index }: SortableItemProps) {\n const {\n clone,\n dragEnd,\n draggingSource,\n draggingTarget,\n dragStart,\n drop,\n maxIndex,\n moveToPosition,\n setClone,\n setDraggingSource,\n } = useSortable();\n const [grabbing, setGrabbing] = useState(false);\n const [moving, setmoving] = useState(false);\n const itemRef = useRef<HTMLDivElement>(null);\n const hasIndex = index !== undefined && index >= 0;\n\n useEffect(() => {\n if (!itemRef.current) return;\n if (globalThis.document.activeElement === itemRef.current) return;\n\n if (index === draggingTarget && draggingTarget === draggingSource) {\n // Manually setting focus after an item has been moved with the keyboard; focus is lost after rerender\n itemRef.current.focus();\n setmoving(true);\n } else {\n setmoving(false);\n }\n }, [index, draggingTarget, draggingSource, setDraggingSource]);\n\n function handleDragStart(event: DragEvent<HTMLDivElement>) {\n event.stopPropagation();\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n\n if (itemRef.current) {\n const cloned = itemRef.current.cloneNode(true) as Element;\n\n cloned.classList.add(styles['sortable__sort-item--ghost']);\n\n setClone(cloned);\n }\n\n if (hasIndex) dragStart(index);\n setGrabbing(true);\n }\n\n function handleDragEnd() {\n if (grabbing) return;\n\n if (clone) document.body.removeChild(clone);\n\n setGrabbing(false);\n dragEnd();\n }\n\n function handleKeyUp(event: ReactKeyboardEvent<HTMLDivElement>) {\n const { code } = event;\n\n if (code === 'Tab' && draggingSource !== undefined) {\n dragEnd();\n return;\n }\n\n if (ACCESS_KEYS.includes(code) === false) return;\n\n if (!hasIndex) return;\n\n if (code === 'Space') {\n if (moving) {\n setmoving(false);\n dragEnd();\n } else {\n setmoving(true);\n dragStart(index);\n }\n\n return;\n }\n\n if (draggingSource === undefined) return;\n\n const newTarget = code === 'ArrowUp' ? index - 1 : index + 1;\n\n if (newTarget < 0 || newTarget > maxIndex) return;\n\n moveToPosition(newTarget);\n }\n\n function handleMove(event: MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n\n if (!hasIndex) return;\n\n dragStart(index);\n\n const { direction } = event.currentTarget.dataset;\n const newTarget = direction === 'up' ? index - 1 : index + 1;\n\n drop(newTarget);\n }\n\n return (\n <div\n className={clsx(styles['sortable__sort-item'], styles[`sortable__sort-item--${sortableItemColor}`])}\n draggable={!disabled}\n onDragEnd={handleDragEnd}\n onDragStart={handleDragStart}\n onKeyUpCapture={handleKeyUp}\n ref={itemRef}\n role=\"presentation\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n >\n <div\n className={`${styles['sortable__sort-item__contents']} ${styles[`sortable__sort-item__contents--handle-${handlePlacement}`]}`}\n >\n {handlePlacement === 'left' && <SortableHandle placement=\"left\" />}\n {children}\n {handlePlacement === 'right' && <SortableHandle placement=\"right\" />}\n </div>\n\n <div className={styles['sortable__sort-item__button-container']} data-touch={noSupportTouch}>\n {!disabled && hasIndex && (\n <>\n {hasIndex && (\n <>\n {index > 0 && (\n <button\n className={`${styles['sortable__sort-item__handle']} ${styles['sortable__sort-item__handle--up']}`}\n data-direction=\"up\"\n onClickCapture={handleMove}\n >\n <div className={styles['sortable__sort-item__handle--icon']}>\n <Icon name=\"CheveronDown\" />\n </div>\n <span className={styles['sortable__visually-hidden']}>Move up</span>\n </button>\n )}\n\n {index < maxIndex && (\n <button\n className={`${styles['sortable__sort-item__handle']} ${styles['sortable__sort-item__handle--down']}`}\n data-direction=\"down\"\n onClickCapture={handleMove}\n >\n <div className={styles['sortable__sort-item__handle--icon']}>\n <Icon name=\"CheveronDown\" />\n </div>\n <span className={styles['sortable__visually-hidden']}>Move down</span>\n </button>\n )}\n </>\n )}\n </>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,IAAM,IAAc;CAAC;CAAS;CAAa;AAAS,GAC9C,IAAiB,kBAAkB,WAAW,SAAS,iBACvD,IAAY,IAAI,MAAM,GAAG,CAAC;AAEhC,EAAU,MAER;AAEF,SAAgB,EAAa,EAAE,aAAU,oBAAiB,aAAU,sBAAmB,YAA4B;CACjH,IAAM,EACJ,UACA,YACA,mBACA,mBACA,cACA,SACA,aACA,mBACA,aACA,yBACE,EAAY,GACV,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,IAAU,EAAuB,IAAI,GACrC,IAAW,MAAU,KAAA,KAAa,KAAS;CAEjD,QAAgB;EACT,EAAQ,WACT,WAAW,SAAS,kBAAkB,EAAQ,YAE9C,MAAU,KAAkB,MAAmB,KAEjD,EAAQ,QAAQ,MAAM,GACtB,EAAU,EAAI,KAEd,EAAU,EAAK;CAEnB,GAAG;EAAC;EAAO;EAAgB;EAAgB;CAAiB,CAAC;CAE7D,SAAS,EAAgB,GAAkC;EAMzD,IALA,EAAM,gBAAgB,GAEtB,EAAM,aAAa,gBAAgB,QACnC,EAAM,aAAa,aAAa,GAAW,GAAG,CAAC,GAE3C,EAAQ,SAAS;GACnB,IAAM,IAAS,EAAQ,QAAQ,UAAU,EAAI;GAI7C,AAFA,EAAO,UAAU,IAAI,EAAO,6BAA6B,GAEzD,EAAS,CAAM;EACjB;EAGA,AADI,KAAU,EAAU,CAAK,GAC7B,EAAY,EAAI;CAClB;CAEA,SAAS,IAAgB;EACnB,MAEA,KAAO,SAAS,KAAK,YAAY,CAAK,GAE1C,EAAY,EAAK,GACjB,EAAQ;CACV;CAEA,SAAS,EAAY,GAA2C;EAC9D,IAAM,EAAE,YAAS;EAEjB,IAAI,MAAS,SAAS,MAAmB,KAAA,GAAW;GAClD,EAAQ;GACR;EACF;EAIA,IAFI,EAAY,SAAS,CAAI,MAAM,MAE/B,CAAC,GAAU;EAEf,IAAI,MAAS,SAAS;GACpB,AAAI,KACF,EAAU,EAAK,GACf,EAAQ,MAER,EAAU,EAAI,GACd,EAAU,CAAK;GAGjB;EACF;EAEA,IAAI,MAAmB,KAAA,GAAW;EAElC,IAAM,IAAY,MAAS,YAAY,IAAQ,IAAI,IAAQ;EAEvD,IAAY,KAAK,IAAY,KAEjC,EAAe,CAAS;CAC1B;CAEA,SAAS,EAAW,GAAsC;EAGxD,IAFA,EAAM,eAAe,GAEjB,CAAC,GAAU;EAEf,EAAU,CAAK;EAEf,IAAM,EAAE,iBAAc,EAAM,cAAc,SACpC,IAAY,MAAc,OAAO,IAAQ,IAAI,IAAQ;EAE3D,EAAK,CAAS;CAChB;CAEA,OACE,kBAAC,OAAD;EACE,WAAW,EAAK,EAAO,wBAAwB,EAAO,wBAAwB,IAAoB;EAClG,WAAW,CAAC;EACZ,WAAW;EACX,aAAa;EACb,gBAAgB;EAChB,KAAK;EACL,MAAK;EAEL,UAAU;YATZ,CAWE,kBAAC,OAAD;GACE,WAAW,GAAG,EAAO,iCAAiC,GAAG,EAAO,yCAAyC;aAD3G;IAGG,MAAoB,UAAU,kBAAC,GAAD,EAAgB,WAAU,OAAQ,CAAA;IAChE;IACA,MAAoB,WAAW,kBAAC,GAAD,EAAgB,WAAU,QAAS,CAAA;GAChE;MAEL,kBAAC,OAAD;GAAK,WAAW,EAAO;GAA0C,cAAY;aAC1E,CAAC,KAAY,KACZ,kBAAA,GAAA,EAAA,UACG,KACC,kBAAA,GAAA,EAAA,UAAA,CACG,IAAQ,KACP,kBAAC,UAAD;IACE,WAAW,GAAG,EAAO,+BAA+B,GAAG,EAAO;IAC9D,kBAAe;IACf,gBAAgB;cAHlB,CAKE,kBAAC,OAAD;KAAK,WAAW,EAAO;eACrB,kBAAC,GAAD,EAAM,MAAK,eAAgB,CAAA;IACxB,CAAA,GACL,kBAAC,QAAD;KAAM,WAAW,EAAO;eAA8B;IAAa,CAAA,CAC7D;OAGT,IAAQ,KACP,kBAAC,UAAD;IACE,WAAW,GAAG,EAAO,+BAA+B,GAAG,EAAO;IAC9D,kBAAe;IACf,gBAAgB;cAHlB,CAKE,kBAAC,OAAD;KAAK,WAAW,EAAO;eACrB,kBAAC,GAAD,EAAM,MAAK,eAAgB,CAAA;IACxB,CAAA,GACL,kBAAC,QAAD;KAAM,WAAW,EAAO;eAA8B;IAAe,CAAA,CAC/D;KAEV,EAAA,CAAA,EAEJ,CAAA;EAED,CAAA,CACF;;AAET"}
|