@uva-glass/component-library 3.30.1 → 3.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Lexical.prod-UwAbgYpF.js → Lexical.prod-B84LhBo3.js} +1196 -1224
- package/dist/Lexical.prod-B84LhBo3.js.map +1 -0
- package/dist/{LexicalClipboard.prod-DHIGjydG.js → LexicalClipboard.prod-DLgWWXys.js} +4 -4
- package/dist/{LexicalClipboard.prod-DHIGjydG.js.map → LexicalClipboard.prod-DLgWWXys.js.map} +1 -1
- package/dist/{LexicalLink.prod-Bsa9J7L-.js → LexicalLink.prod-DoU9RL94.js} +3 -3
- package/dist/{LexicalLink.prod-Bsa9J7L-.js.map → LexicalLink.prod-DoU9RL94.js.map} +1 -1
- package/dist/{LexicalList.prod-jxGuZd4b.js → LexicalList.prod-Cw2TK1jY.js} +4 -4
- package/dist/{LexicalList.prod-jxGuZd4b.js.map → LexicalList.prod-Cw2TK1jY.js.map} +1 -1
- package/dist/{LexicalSelection.prod-xk5MiZnZ.js → LexicalSelection.prod-TB5pn9xc.js} +2 -2
- package/dist/{LexicalSelection.prod-xk5MiZnZ.js.map → LexicalSelection.prod-TB5pn9xc.js.map} +1 -1
- package/dist/{LexicalTable.prod-BSjs04iE.js → LexicalTable.prod-9xjyWB0C.js} +4 -4
- package/dist/{LexicalTable.prod-BSjs04iE.js.map → LexicalTable.prod-9xjyWB0C.js.map} +1 -1
- package/dist/{LexicalUtils.prod-cQutjKA3.js → LexicalUtils.prod-CD3xGFhm.js} +2 -2
- package/dist/{LexicalUtils.prod-cQutjKA3.js.map → LexicalUtils.prod-CD3xGFhm.js.map} +1 -1
- package/dist/Sortable.module--kgnzOjW.js +26 -0
- package/dist/Sortable.module--kgnzOjW.js.map +1 -0
- package/dist/SortableProvider-DisCfTTN.js +160 -0
- package/dist/SortableProvider-DisCfTTN.js.map +1 -0
- package/dist/{TablePlugin-NmJsn2fm.js → TablePlugin-oF-gInNx.js} +86 -91
- package/dist/{TablePlugin-NmJsn2fm.js.map → TablePlugin-oF-gInNx.js.map} +1 -1
- package/dist/assets/Backdrop.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/ClipboardButton.css +1 -1
- package/dist/assets/ExpandableInfoPanel.css +1 -1
- package/dist/assets/FormInput.css +1 -1
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/InputField.css +1 -1
- package/dist/assets/LinkContextMenu.css +1 -1
- package/dist/assets/Notification.css +1 -1
- package/dist/assets/OverlayCloseButton.css +1 -1
- package/dist/assets/OverlayStepBar.css +1 -1
- package/dist/assets/PageOverlay.css +1 -1
- package/dist/assets/Sortable.css +1 -1
- package/dist/assets/VarIndicator.css +1 -1
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.stories.js +5 -5
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.js +58 -59
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +58 -59
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Chip/Chip.stories.js +5 -5
- package/dist/components/ControlsButton/ControlsButton.stories.js +5 -5
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/FormInput/FormInput.js +3 -3
- package/dist/components/FormInput/FormInput.stories.js +1 -1
- package/dist/components/HorizontalList/HorizontalList.js +7 -7
- package/dist/components/HorizontalList/HorizontalList.js.map +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.stories.js +10 -10
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/ModalDialog/ModalDialog.stories.js +8 -8
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +8 -8
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -3
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.js +66 -70
- package/dist/components/MultiSelectBox/MultiSelectBox.js.map +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
- package/dist/components/Notification/Notification.stories.js +6 -6
- package/dist/components/Notification/Notification.test.js +2 -2
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +4 -4
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js +19 -20
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +33 -33
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +4 -4
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +3 -3
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js +3 -3
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +3 -3
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +51 -61
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +79 -89
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +19 -19
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +17 -18
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +31 -32
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +10 -10
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/components/SelectButton.js +31 -32
- package/dist/components/SelectListbox/components/SelectButton.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectOption.js +29 -30
- package/dist/components/SelectListbox/components/SelectOption.js.map +1 -1
- package/dist/components/Sortable/Sortable.d.ts +10 -3
- package/dist/components/Sortable/Sortable.js +38 -23
- package/dist/components/Sortable/Sortable.js.map +1 -1
- package/dist/components/Sortable/Sortable.stories.d.ts +3 -3
- package/dist/components/Sortable/Sortable.stories.js +28 -20
- package/dist/components/Sortable/Sortable.stories.js.map +1 -1
- package/dist/components/Sortable/SortableProvider.d.ts +10 -6
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.d.ts +2 -1
- package/dist/components/Sortable/components/SortableContainer.js +2 -2
- package/dist/components/Sortable/components/SortableHandle.js +1 -1
- package/dist/components/Sortable/components/SortableItem.d.ts +3 -1
- package/dist/components/Sortable/components/SortableItem.js +48 -47
- package/dist/components/Sortable/components/SortableItem.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +3 -3
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/components/hooks/usePositionedFloaters.js +39 -39
- package/dist/components/hooks/usePositionedFloaters.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-DZIm3MiJ.js → helpers-CMG0anwr.js} +4 -4
- package/dist/{helpers-DZIm3MiJ.js.map → helpers-CMG0anwr.js.map} +1 -1
- package/dist/{index-DV47hRzi.js → index-Br0QepD6.js} +8 -10
- package/dist/{index-DV47hRzi.js.map → index-Br0QepD6.js.map} +1 -1
- package/dist/{index-Di9WPZUe.js → index-C2E9FY6V.js} +9149 -9854
- package/dist/index-C2E9FY6V.js.map +1 -0
- package/dist/{index-PaHiqSUg.js → index-Ds1dMTvJ.js} +29 -29
- package/dist/{index-PaHiqSUg.js.map → index-Ds1dMTvJ.js.map} +1 -1
- package/dist/{index-BVAvx58-.js → index-KJPw-7za.js} +2209 -2280
- package/dist/{index-BVAvx58-.js.map → index-KJPw-7za.js.map} +1 -1
- package/dist/{index-DllfJcv4.js → index-nrPtQ1dv.js} +2 -2
- package/dist/{index-DllfJcv4.js.map → index-nrPtQ1dv.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{react.esm-CFMwGdo5.js → react.esm-BKjCIfbB.js} +373 -374
- package/dist/{react.esm-CFMwGdo5.js.map → react.esm-BKjCIfbB.js.map} +1 -1
- package/dist/setupTests.js +6 -9
- package/dist/setupTests.js.map +1 -1
- package/dist/storybook__react.d.js +2056 -2072
- package/dist/storybook__react.d.js.map +1 -1
- package/package.json +14 -14
- package/dist/Lexical.prod-UwAbgYpF.js.map +0 -1
- package/dist/Sortable.module-CekPNg54.js +0 -23
- package/dist/Sortable.module-CekPNg54.js.map +0 -1
- package/dist/SortableProvider-CwX1lFMa.js +0 -152
- package/dist/SortableProvider-CwX1lFMa.js.map +0 -1
- package/dist/index-Di9WPZUe.js.map +0 -1
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useSelect as
|
|
5
|
-
import { s as
|
|
6
|
-
const
|
|
7
|
-
const i =
|
|
8
|
-
p(
|
|
9
|
-
},
|
|
10
|
-
switch (
|
|
1
|
+
import { jsxs as k, Fragment as D, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { c as h } from "../../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { useRef as y, useEffect as m } from "react";
|
|
4
|
+
import { useSelect as O } from "../SelectProvider.js";
|
|
5
|
+
import { s as c } from "../../../SelectListbox.module-yzXaWwsm.js";
|
|
6
|
+
const E = ({ option: l, index: t, dividerAfter: u, children: d }) => {
|
|
7
|
+
const i = y(null), { isOpen: a, activeIndex: e, setActiveIndex: r, selectedValue: n, setSelectedValue: p, setIsOpen: f, options: o } = O(), v = (s) => {
|
|
8
|
+
p(o[s]), f(!1);
|
|
9
|
+
}, w = (s) => {
|
|
10
|
+
switch (s.key) {
|
|
11
11
|
case "Tab":
|
|
12
|
-
|
|
12
|
+
s.preventDefault(), a && f(!1);
|
|
13
13
|
break;
|
|
14
14
|
case "ArrowDown":
|
|
15
15
|
case "ArrowUp":
|
|
16
|
-
if (
|
|
16
|
+
if (s.preventDefault(), !a)
|
|
17
17
|
return;
|
|
18
|
-
|
|
18
|
+
s.key === "ArrowDown" && e < o.length - 1 && r(e + 1), s.key === "ArrowUp" && e > 0 && r(e - 1);
|
|
19
19
|
break;
|
|
20
20
|
case "Enter":
|
|
21
|
-
|
|
21
|
+
s.preventDefault(), o?.length && e > -1 && !o[e].disabled && v(e);
|
|
22
22
|
break;
|
|
23
23
|
case "Escape":
|
|
24
|
-
|
|
24
|
+
a && (s.stopPropagation(), f(!1));
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */ m(
|
|
28
|
+
return m(() => {
|
|
29
|
+
t === e && (a ? i.current?.focus() : i.current?.blur());
|
|
30
|
+
}, [e, t, a]), m(() => {
|
|
31
|
+
n.value === l.value && r(t);
|
|
32
|
+
}, [t, l.value, n.value, r]), /* @__PURE__ */ k(D, { children: [
|
|
33
|
+
/* @__PURE__ */ b(
|
|
35
34
|
"li",
|
|
36
35
|
{
|
|
37
|
-
className:
|
|
38
|
-
[
|
|
39
|
-
[
|
|
36
|
+
className: h(c["select-listbox-option"], {
|
|
37
|
+
[c["select-listbox-option--active"]]: t === e,
|
|
38
|
+
[c["select-listbox-option--divider"]]: t + 1 === u
|
|
40
39
|
}),
|
|
41
40
|
...!l.disabled && {
|
|
42
41
|
onClick: () => p(l),
|
|
43
|
-
onKeyDown:
|
|
42
|
+
onKeyDown: w,
|
|
44
43
|
tabIndex: 0,
|
|
45
44
|
role: "option",
|
|
46
|
-
"aria-selected":
|
|
45
|
+
"aria-selected": n.value === l.value
|
|
47
46
|
},
|
|
48
47
|
ref: i,
|
|
49
|
-
children:
|
|
48
|
+
children: d
|
|
50
49
|
},
|
|
51
50
|
`${l.value}`
|
|
52
51
|
),
|
|
53
|
-
t + 1 === u && /* @__PURE__ */
|
|
52
|
+
t + 1 === u && /* @__PURE__ */ b("div", { className: c["select-listbox-divider"], "aria-hidden": "true" })
|
|
54
53
|
] });
|
|
55
54
|
};
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
E as SelectOption
|
|
58
57
|
};
|
|
59
58
|
//# sourceMappingURL=SelectOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.js","sources":["../../../../src/components/SelectListbox/components/SelectOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef } from 'react';\n\nimport type { KeyboardEvent, ReactNode } from 'react';\nimport type { OptionValue } from 'components/SelectListbox/SelectProvider';\n\nimport { useSelect } from 'components/SelectListbox/SelectProvider';\nimport styles from 'components/SelectListbox/SelectListbox.module.css';\n\nexport interface SelectOptionProps {\n option: OptionValue;\n index: number;\n key: string | number;\n dividerAfter?: number;\n children: ReactNode;\n}\n\nexport const SelectOption = ({ option, index, dividerAfter, children }: SelectOptionProps) => {\n const selectOptionRef = useRef<HTMLLIElement>(null);\n const { isOpen, activeIndex, setActiveIndex, selectedValue, setSelectedValue, setIsOpen, options } = useSelect();\n\n const handleSelectOption = (aIndex: number) => {\n setSelectedValue(options[aIndex]);\n setIsOpen(false);\n };\n\n const onOptionKeyDown = (event: KeyboardEvent<HTMLLIElement>) => {\n switch (event.key) {\n case 'Tab':\n event.preventDefault();\n if (isOpen) {\n setIsOpen(false);\n }\n break;\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n if (!isOpen) {\n return;\n }\n if (event.key === 'ArrowDown' && activeIndex < options.length - 1) {\n setActiveIndex(activeIndex + 1);\n }\n if (event.key === 'ArrowUp' && activeIndex > 0) {\n setActiveIndex(activeIndex - 1);\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (options?.length && activeIndex > -1 && !options[activeIndex].disabled) {\n handleSelectOption(activeIndex);\n }\n break;\n case 'Escape':\n if (isOpen) {\n event.stopPropagation();\n setIsOpen(false);\n }\n break;\n }\n };\n\n useEffect(() => {\n if (index === activeIndex) {\n isOpen ? selectOptionRef.current?.focus() : selectOptionRef.current?.blur();\n }\n }, [activeIndex, index, isOpen]);\n\n useEffect(() => {\n if (selectedValue.value === option.value) {\n setActiveIndex(index);\n }\n }, [index, option.value, selectedValue.value, setActiveIndex]);\n\n return (\n <>\n <li\n className={clsx(styles['select-listbox-option'], {\n [styles['select-listbox-option--active']]: index === activeIndex,\n [styles['select-listbox-option--divider']]: index + 1 === dividerAfter,\n })}\n key={`${option.value}`}\n {...(!option.disabled && {\n onClick: () => setSelectedValue(option),\n onKeyDown: onOptionKeyDown,\n tabIndex: 0,\n role: 'option',\n 'aria-selected': selectedValue.value === option.value,\n })}\n ref={selectOptionRef}\n >\n {children}\n </li>\n {index + 1 === dividerAfter && <div className={styles['select-listbox-divider']} aria-hidden=\"true\" />}\n </>\n );\n};\n"],"names":["SelectOption","option","index","dividerAfter","children","selectOptionRef","useRef","isOpen","activeIndex","setActiveIndex","selectedValue","setSelectedValue","setIsOpen","options","useSelect","handleSelectOption","aIndex","onOptionKeyDown","event","useEffect","
|
|
1
|
+
{"version":3,"file":"SelectOption.js","sources":["../../../../src/components/SelectListbox/components/SelectOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef } from 'react';\n\nimport type { KeyboardEvent, ReactNode } from 'react';\nimport type { OptionValue } from 'components/SelectListbox/SelectProvider';\n\nimport { useSelect } from 'components/SelectListbox/SelectProvider';\nimport styles from 'components/SelectListbox/SelectListbox.module.css';\n\nexport interface SelectOptionProps {\n option: OptionValue;\n index: number;\n key: string | number;\n dividerAfter?: number;\n children: ReactNode;\n}\n\nexport const SelectOption = ({ option, index, dividerAfter, children }: SelectOptionProps) => {\n const selectOptionRef = useRef<HTMLLIElement>(null);\n const { isOpen, activeIndex, setActiveIndex, selectedValue, setSelectedValue, setIsOpen, options } = useSelect();\n\n const handleSelectOption = (aIndex: number) => {\n setSelectedValue(options[aIndex]);\n setIsOpen(false);\n };\n\n const onOptionKeyDown = (event: KeyboardEvent<HTMLLIElement>) => {\n switch (event.key) {\n case 'Tab':\n event.preventDefault();\n if (isOpen) {\n setIsOpen(false);\n }\n break;\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n if (!isOpen) {\n return;\n }\n if (event.key === 'ArrowDown' && activeIndex < options.length - 1) {\n setActiveIndex(activeIndex + 1);\n }\n if (event.key === 'ArrowUp' && activeIndex > 0) {\n setActiveIndex(activeIndex - 1);\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (options?.length && activeIndex > -1 && !options[activeIndex].disabled) {\n handleSelectOption(activeIndex);\n }\n break;\n case 'Escape':\n if (isOpen) {\n event.stopPropagation();\n setIsOpen(false);\n }\n break;\n }\n };\n\n useEffect(() => {\n if (index === activeIndex) {\n isOpen ? selectOptionRef.current?.focus() : selectOptionRef.current?.blur();\n }\n }, [activeIndex, index, isOpen]);\n\n useEffect(() => {\n if (selectedValue.value === option.value) {\n setActiveIndex(index);\n }\n }, [index, option.value, selectedValue.value, setActiveIndex]);\n\n return (\n <>\n <li\n className={clsx(styles['select-listbox-option'], {\n [styles['select-listbox-option--active']]: index === activeIndex,\n [styles['select-listbox-option--divider']]: index + 1 === dividerAfter,\n })}\n key={`${option.value}`}\n {...(!option.disabled && {\n onClick: () => setSelectedValue(option),\n onKeyDown: onOptionKeyDown,\n tabIndex: 0,\n role: 'option',\n 'aria-selected': selectedValue.value === option.value,\n })}\n ref={selectOptionRef}\n >\n {children}\n </li>\n {index + 1 === dividerAfter && <div className={styles['select-listbox-divider']} aria-hidden=\"true\" />}\n </>\n );\n};\n"],"names":["SelectOption","option","index","dividerAfter","children","selectOptionRef","useRef","isOpen","activeIndex","setActiveIndex","selectedValue","setSelectedValue","setIsOpen","options","useSelect","handleSelectOption","aIndex","onOptionKeyDown","event","useEffect","jsxs","Fragment","jsx","clsx","styles"],"mappings":";;;;;AAiBO,MAAMA,IAAe,CAAC,EAAE,QAAAC,GAAQ,OAAAC,GAAO,cAAAC,GAAc,UAAAC,QAAkC;AAC5F,QAAMC,IAAkBC,EAAsB,IAAI,GAC5C,EAAE,QAAAC,GAAQ,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,GAAe,kBAAAC,GAAkB,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA,GAE/FC,IAAqB,CAACC,MAAmB;AAC7C,IAAAL,EAAiBE,EAAQG,CAAM,CAAC,GAChCJ,EAAU,EAAK;AAAA,EAAA,GAGXK,IAAkB,CAACC,MAAwC;AAC/D,YAAQA,EAAM,KAAA;AAAA,MACZ,KAAK;AACH,QAAAA,EAAM,eAAA,GACFX,KACFK,EAAU,EAAK;AAEjB;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AAEH,YADAM,EAAM,eAAA,GACF,CAACX;AACH;AAEF,QAAIW,EAAM,QAAQ,eAAeV,IAAcK,EAAQ,SAAS,KAC9DJ,EAAeD,IAAc,CAAC,GAE5BU,EAAM,QAAQ,aAAaV,IAAc,KAC3CC,EAAeD,IAAc,CAAC;AAEhC;AAAA,MACF,KAAK;AACH,QAAAU,EAAM,eAAA,GACFL,GAAS,UAAUL,IAAc,MAAM,CAACK,EAAQL,CAAW,EAAE,YAC/DO,EAAmBP,CAAW;AAEhC;AAAA,MACF,KAAK;AACH,QAAID,MACFW,EAAM,gBAAA,GACNN,EAAU,EAAK;AAEjB;AAAA,IAAA;AAAA,EACJ;AAGF,SAAAO,EAAU,MAAM;AACd,IAAIjB,MAAUM,MACZD,IAASF,EAAgB,SAAS,MAAA,IAAUA,EAAgB,SAAS,KAAA;AAAA,EACvE,GACC,CAACG,GAAaN,GAAOK,CAAM,CAAC,GAE/BY,EAAU,MAAM;AACd,IAAIT,EAAc,UAAUT,EAAO,SACjCQ,EAAeP,CAAK;AAAA,EACtB,GACC,CAACA,GAAOD,EAAO,OAAOS,EAAc,OAAOD,CAAc,CAAC,GAG3D,gBAAAW,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAKC,EAAO,uBAAuB,GAAG;AAAA,UAC/C,CAACA,EAAO,+BAA+B,CAAC,GAAGtB,MAAUM;AAAA,UACrD,CAACgB,EAAO,gCAAgC,CAAC,GAAGtB,IAAQ,MAAMC;AAAA,QAAA,CAC3D;AAAA,QAEA,GAAI,CAACF,EAAO,YAAY;AAAA,UACvB,SAAS,MAAMU,EAAiBV,CAAM;AAAA,UACtC,WAAWgB;AAAA,UACX,UAAU;AAAA,UACV,MAAM;AAAA,UACN,iBAAiBP,EAAc,UAAUT,EAAO;AAAA,QAAA;AAAA,QAElD,KAAKI;AAAA,QAEJ,UAAAD;AAAA,MAAA;AAAA,MAVI,GAAGH,EAAO,KAAK;AAAA,IAAA;AAAA,IAYrBC,IAAQ,MAAMC,KAAgB,gBAAAmB,EAAC,OAAA,EAAI,WAAWE,EAAO,wBAAwB,GAAG,eAAY,OAAA,CAAO;AAAA,EAAA,GACtG;AAEJ;"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { SortableItemProps } from './components/SortableItem';
|
|
3
3
|
export type Index = string | number;
|
|
4
|
-
export
|
|
4
|
+
export type SortableItemColors = 'grey-200' | 'white';
|
|
5
|
+
export interface SortableProps<T = unknown> {
|
|
5
6
|
/** The elements to show inside the Sortable. */
|
|
6
7
|
children: ReactElement[] | string[];
|
|
8
|
+
/** The data objects that are actually being sorted. */
|
|
9
|
+
childrenData?: T[];
|
|
7
10
|
/** The placement of each item Handle (6 dots 2x3). */
|
|
8
11
|
ItemHandlePlacement?: SortableItemProps['handlePlacement'];
|
|
9
12
|
/** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */
|
|
10
13
|
scrollable?: boolean;
|
|
11
14
|
/** If true, the sorting will be disabled. */
|
|
12
15
|
disabled?: boolean;
|
|
16
|
+
/** Hide the numbers shown next to the sortable elements. */
|
|
17
|
+
hideNumbers?: boolean;
|
|
18
|
+
/** Change the color of the SortableItem wrapper. */
|
|
19
|
+
sortableItemColor?: SortableItemColors;
|
|
13
20
|
/** The callback function that is invoked when new sorting takes place. */
|
|
14
|
-
onSort?: (items:
|
|
21
|
+
onSort?: (items: T[]) => void;
|
|
15
22
|
}
|
|
16
|
-
export declare const Sortable: ({ children, ItemHandlePlacement, scrollable, disabled, onSort }: SortableProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Sortable: <T>({ children, childrenData, ItemHandlePlacement, scrollable, disabled, onSort, hideNumbers, sortableItemColor, }: SortableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Children as
|
|
3
|
-
import { SortableItem as
|
|
4
|
-
import { S as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
import { Children as a } from "react";
|
|
3
|
+
import { SortableItem as f } from "./components/SortableItem.js";
|
|
4
|
+
import { S as I } from "../../SortableProvider-DisCfTTN.js";
|
|
5
|
+
const P = ({
|
|
6
|
+
children: t,
|
|
7
|
+
childrenData: m,
|
|
8
|
+
ItemHandlePlacement: s = "left",
|
|
9
|
+
scrollable: l,
|
|
10
|
+
disabled: n,
|
|
11
|
+
onSort: i,
|
|
12
|
+
hideNumbers: p,
|
|
13
|
+
sortableItemColor: b = "grey-200"
|
|
14
|
+
}) => {
|
|
15
|
+
const d = m ?? t, r = t.map((c, e) => /* @__PURE__ */ o(
|
|
16
|
+
f,
|
|
17
|
+
{
|
|
18
|
+
handlePlacement: s,
|
|
19
|
+
disabled: n || a.count(t) <= 1,
|
|
20
|
+
sortableItemColor: b,
|
|
21
|
+
index: e,
|
|
22
|
+
children: c
|
|
23
|
+
},
|
|
24
|
+
`sortable-item-${e}`
|
|
25
|
+
));
|
|
26
|
+
return /* @__PURE__ */ o(
|
|
27
|
+
I,
|
|
28
|
+
{
|
|
29
|
+
renderItems: r,
|
|
30
|
+
dataItems: d,
|
|
31
|
+
scrollable: l,
|
|
32
|
+
hideNumbers: p,
|
|
33
|
+
onSort: i,
|
|
34
|
+
children: r
|
|
35
|
+
},
|
|
36
|
+
`sortable-with-children-${a.count(t)}`
|
|
37
|
+
);
|
|
38
|
+
};
|
|
24
39
|
export {
|
|
25
|
-
|
|
40
|
+
P as Sortable
|
|
26
41
|
};
|
|
27
42
|
//# sourceMappingURL=Sortable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\n\nexport interface SortableProps {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items:
|
|
1
|
+
{"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\nexport type SortableItemColors = 'grey-200' | 'white';\n\nexport interface SortableProps<T = unknown> {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The data objects that are actually being sorted. */\n childrenData?: T[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** Hide the numbers shown next to the sortable elements. */\n hideNumbers?: boolean;\n /** Change the color of the SortableItem wrapper. */\n sortableItemColor?: SortableItemColors;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items: T[]) => void;\n}\n\n// A component that renders a list of children that can be sorted with drag and drop.\nexport const Sortable = <T,>({\n children,\n childrenData,\n ItemHandlePlacement = 'left',\n scrollable,\n disabled,\n onSort,\n hideNumbers,\n sortableItemColor = 'grey-200',\n}: SortableProps<T>) => {\n const sortableData: T[] = childrenData ?? (children as unknown as T[]);\n\n const wrappedItems = children.map((child, index) => (\n <SortableItem\n handlePlacement={ItemHandlePlacement}\n disabled={disabled || Children.count(children) <= 1}\n sortableItemColor={sortableItemColor}\n index={index}\n key={`sortable-item-${index}`}\n >\n {child}\n </SortableItem>\n ));\n\n return (\n <SortableProvider\n renderItems={wrappedItems}\n dataItems={sortableData}\n scrollable={scrollable}\n hideNumbers={hideNumbers}\n onSort={onSort}\n key={`sortable-with-children-${Children.count(children)}`}\n >\n {wrappedItems}\n </SortableProvider>\n );\n};\n"],"names":["Sortable","children","childrenData","ItemHandlePlacement","scrollable","disabled","onSort","hideNumbers","sortableItemColor","sortableData","wrappedItems","child","index","jsx","SortableItem","Children","SortableProvider"],"mappings":";;;;AA+BO,MAAMA,IAAW,CAAK;AAAA,EAC3B,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,MAAwB;AACtB,QAAMC,IAAoBP,KAAiBD,GAErCS,IAAeT,EAAS,IAAI,CAACU,GAAOC,MACxC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,iBAAiBX;AAAA,MACjB,UAAUE,KAAYU,EAAS,MAAMd,CAAQ,KAAK;AAAA,MAClD,mBAAAO;AAAA,MACA,OAAAI;AAAA,MAGC,UAAAD;AAAA,IAAA;AAAA,IAFI,iBAAiBC,CAAK;AAAA,EAAA,CAI9B;AAED,SACE,gBAAAC;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,aAAaN;AAAA,MACb,WAAWD;AAAA,MACX,YAAAL;AAAA,MACA,aAAAG;AAAA,MACA,QAAAD;AAAA,MAGC,UAAAI;AAAA,IAAA;AAAA,IAFI,0BAA0BK,EAAS,MAAMd,CAAQ,CAAC;AAAA,EAAA;AAK7D;"}
|
|
@@ -2,6 +2,6 @@ import { Meta } from '@storybook/react';
|
|
|
2
2
|
import { SortableProps } from './Sortable';
|
|
3
3
|
declare const _default: Meta<SortableProps>;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
6
|
-
export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
7
|
-
export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps
|
|
5
|
+
export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
6
|
+
export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
7
|
+
export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { Sortable as
|
|
4
|
-
import { InputField as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Button as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { l as s } from "../../index-C2E9FY6V.js";
|
|
3
|
+
import { Sortable as l } from "./Sortable.js";
|
|
4
|
+
import { InputField as d } from "../InputField/InputField.js";
|
|
5
|
+
import { Icon as c } from "../Icon/Icon.js";
|
|
6
|
+
import { Button as b } from "../Buttons/Button.js";
|
|
7
7
|
import "../Buttons/LinkButton.js";
|
|
8
8
|
import "@react-aria/button";
|
|
9
|
-
const
|
|
9
|
+
const p = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable}
|
|
10
|
+
disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `, F = {
|
|
10
11
|
title: "Organisms/Sortable",
|
|
11
|
-
component:
|
|
12
|
+
component: l,
|
|
12
13
|
argTypes: {
|
|
13
14
|
children: {
|
|
14
15
|
table: {
|
|
@@ -22,32 +23,39 @@ const b = "<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlac
|
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
parameters: {
|
|
25
|
-
inspectComponent:
|
|
26
|
-
codeString:
|
|
26
|
+
inspectComponent: l,
|
|
27
|
+
codeString: p
|
|
27
28
|
}
|
|
28
29
|
}, r = {
|
|
29
30
|
ItemHandlePlacement: "left",
|
|
30
31
|
onSort: s()
|
|
31
|
-
},
|
|
32
|
+
}, a = ["Item-1", "Item-2", "Item-3", "Item-4", "Item-5"], n = (o) => /* @__PURE__ */ e(l, { ...o, children: a }), h = n.bind({});
|
|
32
33
|
h.args = {
|
|
33
34
|
...r
|
|
34
35
|
};
|
|
35
|
-
const I =
|
|
36
|
+
const I = n.bind({});
|
|
36
37
|
I.args = {
|
|
37
38
|
...r,
|
|
38
39
|
ItemHandlePlacement: "right"
|
|
39
40
|
};
|
|
40
|
-
const
|
|
41
|
-
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
42
|
-
/* @__PURE__ */ e(
|
|
43
|
-
] }, t)) }),
|
|
44
|
-
|
|
45
|
-
...r
|
|
41
|
+
const u = (o) => /* @__PURE__ */ e(l, { ...o, children: a.map((t) => /* @__PURE__ */ i(m, { children: [
|
|
42
|
+
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(d, { id: t, placeholder: t }, t) }),
|
|
43
|
+
/* @__PURE__ */ e(b, { variant: "blank-icon", children: /* @__PURE__ */ e(c, { name: "Trash", color: "#a0002aff" }) })
|
|
44
|
+
] }, t)) }), f = u.bind({});
|
|
45
|
+
f.args = {
|
|
46
|
+
...r,
|
|
47
|
+
childrenData: [
|
|
48
|
+
{ title: "item-1", value: 1 },
|
|
49
|
+
{ title: "item-2", value: 2 },
|
|
50
|
+
{ title: "item-3", value: 3 },
|
|
51
|
+
{ title: "item-4", value: 4 },
|
|
52
|
+
{ title: "item-5", value: 5 }
|
|
53
|
+
]
|
|
46
54
|
};
|
|
47
55
|
export {
|
|
48
56
|
h as SortableExample,
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
f as WithComplexChildren,
|
|
58
|
+
F as default,
|
|
51
59
|
I as withHandleRight
|
|
52
60
|
};
|
|
53
61
|
//# sourceMappingURL=Sortable.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString
|
|
1
|
+
{"version":3,"file":"Sortable.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable} \n disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/Sortable',\n component: Sortable,\n argTypes: {\n children: {\n table: {\n disable: true,\n },\n },\n ItemHandlePlacement: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Sortable,\n codeString: codeString,\n },\n} as Meta<SortableProps>;\n\nconst defaultArgs: Partial<SortableProps> = {\n ItemHandlePlacement: 'left',\n onSort: fn(),\n};\n\nconst mockItems = ['Item-1', 'Item-2', 'Item-3', 'Item-4', 'Item-5'];\n\nconst Template: StoryFn<SortableProps> = (args) => <Sortable {...args}>{mockItems}</Sortable>;\n\nexport const SortableExample = Template.bind({});\nSortableExample.args = {\n ...defaultArgs,\n};\n\nexport const withHandleRight = Template.bind({});\nwithHandleRight.args = {\n ...defaultArgs,\n ItemHandlePlacement: 'right',\n};\n\nconst TemplateComplex: StoryFn<SortableProps> = (args) => (\n <Sortable {...args}>\n {mockItems.map((item) => (\n <Fragment key={item}>\n <div style={{ width: '100%' }}>\n <InputField key={item} id={item} placeholder={item} />\n </div>\n <Button variant=\"blank-icon\">\n <Icon name=\"Trash\" color=\"#a0002aff\" />\n </Button>\n </Fragment>\n ))}\n </Sortable>\n);\n\nexport const WithComplexChildren = TemplateComplex.bind({});\nWithComplexChildren.args = {\n ...defaultArgs,\n childrenData: [\n { title: 'item-1', value: 1 },\n { title: 'item-2', value: 2 },\n { title: 'item-3', value: 3 },\n { title: 'item-4', value: 4 },\n { title: 'item-5', value: 5 },\n ],\n};\n"],"names":["codeString","Sortable_stories","Sortable","defaultArgs","fn","mockItems","Template","args","SortableExample","withHandleRight","TemplateComplex","jsx","item","jsxs","Fragment","InputField","Button","Icon","WithComplexChildren"],"mappings":";;;;;;;;AAYA,MAAMA,IAAa;AAAA,8HAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,qBAAqB;AAAA,MACnB,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AAAA,EAEF,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAsC;AAAA,EAC1C,qBAAqB;AAAA,EACrB,QAAQC,EAAA;AACV,GAEMC,IAAY,CAAC,UAAU,UAAU,UAAU,UAAU,QAAQ,GAE7DC,IAAmC,CAACC,wBAAUL,GAAA,EAAU,GAAGK,GAAO,UAAAF,GAAU,GAErEG,IAAkBF,EAAS,KAAK,CAAA,CAAE;AAC/CE,EAAgB,OAAO;AAAA,EACrB,GAAGL;AACL;AAEO,MAAMM,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,GAAGN;AAAA,EACH,qBAAqB;AACvB;AAEA,MAAMO,IAA0C,CAACH,MAC/C,gBAAAI,EAACT,GAAA,EAAU,GAAGK,GACX,UAAAF,EAAU,IAAI,CAACO,MACd,gBAAAC,EAACC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAH,EAAC,OAAA,EAAI,OAAO,EAAE,OAAO,OAAA,GACnB,UAAA,gBAAAA,EAACI,GAAA,EAAsB,IAAIH,GAAM,aAAaA,EAAA,GAA7BA,CAAmC,GACtD;AAAA,EACA,gBAAAD,EAACK,GAAA,EAAO,SAAQ,cACd,UAAA,gBAAAL,EAACM,KAAK,MAAK,SAAQ,OAAM,YAAA,CAAY,EAAA,CACvC;AAAA,KANaL,CAOf,CACD,GACH,GAGWM,IAAsBR,EAAgB,KAAK,CAAA,CAAE;AAC1DQ,EAAoB,OAAO;AAAA,EACzB,GAAGf;AAAA,EACH,cAAc;AAAA,IACZ,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,EAAE;AAEhC;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SortableStateType } from './sortableReducer';
|
|
3
|
+
import { SortableItem, SortableItemProps } from './components/SortableItem';
|
|
3
4
|
type SortableContextType = {
|
|
4
5
|
clearDraggingSource: () => void;
|
|
5
6
|
clearDraggingTarget: () => void;
|
|
@@ -12,12 +13,15 @@ type SortableContextType = {
|
|
|
12
13
|
setDraggingSource: (index: number) => void;
|
|
13
14
|
setDraggingTarget: (index: number) => void;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];
|
|
17
|
+
interface Props<T = unknown> {
|
|
18
|
+
renderItems: SortableItems;
|
|
19
|
+
dataItems: T[];
|
|
18
20
|
scrollable?: boolean;
|
|
19
|
-
|
|
21
|
+
hideNumbers?: boolean;
|
|
22
|
+
onSort?: (items: T[]) => void;
|
|
23
|
+
children?: ReactNode;
|
|
20
24
|
}
|
|
21
|
-
export declare function SortableProvider({
|
|
25
|
+
export declare function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
26
|
export declare function useSortable(): SortableContextType & SortableStateType;
|
|
23
27
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "./sortableReducer.js";
|
|
4
|
-
import { S as p, u as a } from "../../SortableProvider-
|
|
4
|
+
import { S as p, u as a } from "../../SortableProvider-DisCfTTN.js";
|
|
5
5
|
import "./actions.js";
|
|
6
6
|
export {
|
|
7
7
|
p as SortableProvider,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type OnSort = (indices: number[]) => void;
|
|
2
2
|
interface SortableContainerProps {
|
|
3
3
|
scrollable?: boolean;
|
|
4
|
+
hideNumbers?: boolean;
|
|
4
5
|
onSort?: OnSort;
|
|
5
6
|
}
|
|
6
|
-
export declare function SortableContainer({ scrollable, onSort }: SortableContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SortableContainer({ scrollable, hideNumbers, onSort }: SortableContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../../clsx-OuTLNxxd.js";
|
|
4
|
-
import "../../../Sortable.module
|
|
5
|
-
import { a } from "../../../SortableProvider-
|
|
4
|
+
import "../../../Sortable.module--kgnzOjW.js";
|
|
5
|
+
import { a } from "../../../SortableProvider-DisCfTTN.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
|
|
3
|
+
import { s as t } from "../../../Sortable.module--kgnzOjW.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" }) });
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SortableHandleProps } from './SortableHandle';
|
|
3
|
+
import { SortableItemColors } from 'components/Sortable/Sortable';
|
|
3
4
|
export interface SortableItemProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
handlePlacement: SortableHandleProps['placement'];
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
sortableItemColor: SortableItemColors;
|
|
7
9
|
index: number;
|
|
8
10
|
}
|
|
9
|
-
export declare function SortableItem({ children, handlePlacement, disabled, index }: SortableItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function SortableItem({ children, handlePlacement, disabled, sortableItemColor, index }: SortableItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +1,68 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r, Fragment as v } from "react/jsx-runtime";
|
|
2
|
-
import { useState as S, useRef as
|
|
2
|
+
import { useState as S, useRef as Q, useEffect as k } from "react";
|
|
3
|
+
import { c as G } from "../../../clsx-OuTLNxxd.js";
|
|
3
4
|
import { Icon as w } from "../../Icon/Icon.js";
|
|
4
5
|
import { SortableHandle as E } from "./SortableHandle.js";
|
|
5
|
-
import { s as
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
6
|
+
import { s as e } from "../../../Sortable.module--kgnzOjW.js";
|
|
7
|
+
import { u as J } from "../../../SortableProvider-DisCfTTN.js";
|
|
8
|
+
const j = ["Space", "ArrowDown", "ArrowUp"], F = "ontouchstart" in globalThis.document.documentElement, C = new Image(0, 0);
|
|
8
9
|
C.src = // 1px transparent png
|
|
9
10
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
|
|
10
|
-
function
|
|
11
|
+
function q({ children: D, handlePlacement: m, disabled: g, sortableItemColor: N, index: t }) {
|
|
11
12
|
const {
|
|
12
13
|
clone: h,
|
|
13
|
-
dragEnd:
|
|
14
|
+
dragEnd: u,
|
|
14
15
|
draggingSource: c,
|
|
15
16
|
draggingTarget: f,
|
|
16
|
-
dragStart:
|
|
17
|
-
drop:
|
|
17
|
+
dragStart: _,
|
|
18
|
+
drop: T,
|
|
18
19
|
maxIndex: p,
|
|
19
|
-
moveToPosition:
|
|
20
|
-
setClone:
|
|
21
|
-
setDraggingSource:
|
|
22
|
-
} =
|
|
23
|
-
|
|
24
|
-
n.current && globalThis.document.activeElement !== n.current && (
|
|
25
|
-
}, [
|
|
26
|
-
function
|
|
20
|
+
moveToPosition: I,
|
|
21
|
+
setClone: U,
|
|
22
|
+
setDraggingSource: $
|
|
23
|
+
} = J(), [y, A] = S(!1), [K, d] = S(!1), n = Q(null), s = t !== void 0 && t >= 0;
|
|
24
|
+
k(() => {
|
|
25
|
+
n.current && globalThis.document.activeElement !== n.current && (t === f && f === c ? (n.current.focus(), d(!0)) : d(!1));
|
|
26
|
+
}, [t, f, c, $]);
|
|
27
|
+
function R(a) {
|
|
27
28
|
if (a.stopPropagation(), a.dataTransfer.effectAllowed = "move", a.dataTransfer.setDragImage(C, 0, 0), n.current) {
|
|
28
29
|
const o = n.current.cloneNode(!0);
|
|
29
|
-
o.classList.add(
|
|
30
|
+
o.classList.add(e["sortable__sort-item--ghost"]), U(o);
|
|
30
31
|
}
|
|
31
|
-
s &&
|
|
32
|
+
s && _(t), A(!0);
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
34
|
+
function B() {
|
|
35
|
+
y || (h && document.body.removeChild(h), A(!1), u());
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function M(a) {
|
|
37
38
|
const { code: o } = a;
|
|
38
39
|
if (o === "Tab" && c !== void 0) {
|
|
39
|
-
|
|
40
|
+
u();
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
if (
|
|
43
|
+
if (j.includes(o) === !1 || !s) return;
|
|
43
44
|
if (o === "Space") {
|
|
44
|
-
|
|
45
|
+
K ? (d(!1), u()) : (d(!0), _(t));
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
if (c === void 0) return;
|
|
48
|
-
const l = o === "ArrowUp" ?
|
|
49
|
-
l < 0 || l > p ||
|
|
49
|
+
const l = o === "ArrowUp" ? t - 1 : t + 1;
|
|
50
|
+
l < 0 || l > p || I(l);
|
|
50
51
|
}
|
|
51
52
|
function b(a) {
|
|
52
53
|
if (a.preventDefault(), !s) return;
|
|
53
|
-
|
|
54
|
-
const { direction: o } = a.currentTarget.dataset, l = o === "up" ?
|
|
55
|
-
|
|
54
|
+
_(t);
|
|
55
|
+
const { direction: o } = a.currentTarget.dataset, l = o === "up" ? t - 1 : t + 1;
|
|
56
|
+
T(l);
|
|
56
57
|
}
|
|
57
58
|
return /* @__PURE__ */ i(
|
|
58
59
|
"div",
|
|
59
60
|
{
|
|
60
|
-
className:
|
|
61
|
-
draggable: !
|
|
62
|
-
onDragEnd:
|
|
63
|
-
onDragStart:
|
|
64
|
-
onKeyUpCapture:
|
|
61
|
+
className: G(e["sortable__sort-item"], e[`sortable__sort-item--${N}`]),
|
|
62
|
+
draggable: !g,
|
|
63
|
+
onDragEnd: B,
|
|
64
|
+
onDragStart: R,
|
|
65
|
+
onKeyUpCapture: M,
|
|
65
66
|
ref: n,
|
|
66
67
|
role: "presentation",
|
|
67
68
|
tabIndex: 0,
|
|
@@ -69,36 +70,36 @@ function L({ children: D, handlePlacement: u, disabled: _, index: e }) {
|
|
|
69
70
|
/* @__PURE__ */ i(
|
|
70
71
|
"div",
|
|
71
72
|
{
|
|
72
|
-
className: `${
|
|
73
|
+
className: `${e["sortable__sort-item__contents"]} ${e[`sortable__sort-item__contents--handle-${m}`]}`,
|
|
73
74
|
children: [
|
|
74
|
-
|
|
75
|
+
m === "left" && /* @__PURE__ */ r(E, { placement: "left" }),
|
|
75
76
|
D,
|
|
76
|
-
|
|
77
|
+
m === "right" && /* @__PURE__ */ r(E, { placement: "right" })
|
|
77
78
|
]
|
|
78
79
|
}
|
|
79
80
|
),
|
|
80
|
-
/* @__PURE__ */ r("div", { className:
|
|
81
|
-
|
|
81
|
+
/* @__PURE__ */ r("div", { className: e["sortable__sort-item__button-container"], "data-touch": F, children: !g && s && /* @__PURE__ */ r(v, { children: s && /* @__PURE__ */ i(v, { children: [
|
|
82
|
+
t > 0 && /* @__PURE__ */ i(
|
|
82
83
|
"button",
|
|
83
84
|
{
|
|
84
|
-
className: `${
|
|
85
|
+
className: `${e["sortable__sort-item__handle"]} ${e["sortable__sort-item__handle--up"]}`,
|
|
85
86
|
"data-direction": "up",
|
|
86
87
|
onClickCapture: b,
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */ r("div", { className:
|
|
89
|
-
/* @__PURE__ */ r("span", { className:
|
|
89
|
+
/* @__PURE__ */ r("div", { className: e["sortable__sort-item__handle--icon"], children: /* @__PURE__ */ r(w, { name: "CheveronDown" }) }),
|
|
90
|
+
/* @__PURE__ */ r("span", { className: e["sortable__visually-hidden"], children: "Move up" })
|
|
90
91
|
]
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
|
-
|
|
94
|
+
t < p && /* @__PURE__ */ i(
|
|
94
95
|
"button",
|
|
95
96
|
{
|
|
96
|
-
className: `${
|
|
97
|
+
className: `${e["sortable__sort-item__handle"]} ${e["sortable__sort-item__handle--down"]}`,
|
|
97
98
|
"data-direction": "down",
|
|
98
99
|
onClickCapture: b,
|
|
99
100
|
children: [
|
|
100
|
-
/* @__PURE__ */ r("div", { className:
|
|
101
|
-
/* @__PURE__ */ r("span", { className:
|
|
101
|
+
/* @__PURE__ */ r("div", { className: e["sortable__sort-item__handle--icon"], children: /* @__PURE__ */ r(w, { name: "CheveronDown" }) }),
|
|
102
|
+
/* @__PURE__ */ r("span", { className: e["sortable__visually-hidden"], children: "Move down" })
|
|
102
103
|
]
|
|
103
104
|
}
|
|
104
105
|
)
|
|
@@ -108,6 +109,6 @@ function L({ children: D, handlePlacement: u, disabled: _, index: e }) {
|
|
|
108
109
|
);
|
|
109
110
|
}
|
|
110
111
|
export {
|
|
111
|
-
|
|
112
|
+
q as SortableItem
|
|
112
113
|
};
|
|
113
114
|
//# sourceMappingURL=SortableItem.js.map
|