@lnco-ai/ui 1.0.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.
Files changed (288) hide show
  1. package/CHANGELOG.md +1323 -0
  2. package/LICENSE +661 -0
  3. package/README.md +60 -0
  4. package/dist/Authorization/PreventGuestWrapper.d.ts +19 -0
  5. package/dist/Authorization/PreventGuestWrapper.js +15 -0
  6. package/dist/Authorization/RedirectionContent.d.ts +9 -0
  7. package/dist/Authorization/RedirectionContent.js +24 -0
  8. package/dist/Authorization/SignedInWrapper.d.ts +10 -0
  9. package/dist/Authorization/SignedInWrapper.js +21 -0
  10. package/dist/Avatar/Avatar.d.ts +24 -0
  11. package/dist/Avatar/Avatar.js +22 -0
  12. package/dist/Avatar/stringToColor.d.ts +12 -0
  13. package/dist/Avatar/stringToColor.js +31 -0
  14. package/dist/Avatar/stringToColor.test.d.ts +1 -0
  15. package/dist/Avatar/stringToColor.test.js +8 -0
  16. package/dist/Card/Card.d.ts +39 -0
  17. package/dist/Card/Card.js +76 -0
  18. package/dist/Card/CardHeader.d.ts +12 -0
  19. package/dist/Card/CardHeader.js +8 -0
  20. package/dist/Card/CardThumbnail.d.ts +10 -0
  21. package/dist/Card/CardThumbnail.js +14 -0
  22. package/dist/Card/FolderCard.d.ts +14 -0
  23. package/dist/Card/FolderCard.js +44 -0
  24. package/dist/Card/LinkCard.d.ts +11 -0
  25. package/dist/Card/LinkCard.js +41 -0
  26. package/dist/Card/components/CardThumbnail.d.ts +8 -0
  27. package/dist/Card/components/CardThumbnail.js +15 -0
  28. package/dist/Card/constants.d.ts +1 -0
  29. package/dist/Card/constants.js +1 -0
  30. package/dist/Collapse/Collapse.d.ts +10 -0
  31. package/dist/Collapse/Collapse.js +48 -0
  32. package/dist/Collapse/withCollapse.d.ts +7 -0
  33. package/dist/Collapse/withCollapse.js +8 -0
  34. package/dist/CookiesBanner/CookiesBanner.d.ts +10 -0
  35. package/dist/CookiesBanner/CookiesBanner.js +60 -0
  36. package/dist/CreativeCommons/CreativeCommons.d.ts +14 -0
  37. package/dist/CreativeCommons/CreativeCommons.js +75 -0
  38. package/dist/CreativeCommons/icons/By.d.ts +3 -0
  39. package/dist/CreativeCommons/icons/By.js +3 -0
  40. package/dist/CreativeCommons/icons/CCIconsProps.d.ts +3 -0
  41. package/dist/CreativeCommons/icons/CCIconsProps.js +1 -0
  42. package/dist/CreativeCommons/icons/Cc.d.ts +3 -0
  43. package/dist/CreativeCommons/icons/Cc.js +3 -0
  44. package/dist/CreativeCommons/icons/Cc0.d.ts +3 -0
  45. package/dist/CreativeCommons/icons/Cc0.js +3 -0
  46. package/dist/CreativeCommons/icons/Nc.d.ts +3 -0
  47. package/dist/CreativeCommons/icons/Nc.js +3 -0
  48. package/dist/CreativeCommons/icons/Nd.d.ts +3 -0
  49. package/dist/CreativeCommons/icons/Nd.js +3 -0
  50. package/dist/CreativeCommons/icons/Sa.d.ts +3 -0
  51. package/dist/CreativeCommons/icons/Sa.js +3 -0
  52. package/dist/CustomInitialLoader/CustomInitialLoader.d.ts +5 -0
  53. package/dist/CustomInitialLoader/CustomInitialLoader.js +25 -0
  54. package/dist/DrawerHeader/DrawerHeader.d.ts +7 -0
  55. package/dist/DrawerHeader/DrawerHeader.js +16 -0
  56. package/dist/GraaspLogo/EpflLogo.d.ts +5 -0
  57. package/dist/GraaspLogo/EpflLogo.js +3 -0
  58. package/dist/GraaspLogo/GraaspLogo.d.ts +8 -0
  59. package/dist/GraaspLogo/GraaspLogo.js +5 -0
  60. package/dist/Header/Header.d.ts +21 -0
  61. package/dist/Header/Header.js +33 -0
  62. package/dist/HeaderUserInformation/HeaderUserInformation.d.ts +22 -0
  63. package/dist/HeaderUserInformation/HeaderUserInformation.js +23 -0
  64. package/dist/ItemBadges/ItemBadges.d.ts +17 -0
  65. package/dist/ItemBadges/ItemBadges.js +10 -0
  66. package/dist/ItemFlag/ItemFlagButton.d.ts +9 -0
  67. package/dist/ItemFlag/ItemFlagButton.js +11 -0
  68. package/dist/ItemFlag/ItemFlagDialog.d.ts +14 -0
  69. package/dist/ItemFlag/ItemFlagDialog.js +25 -0
  70. package/dist/Loader/Loader.d.ts +7 -0
  71. package/dist/Loader/Loader.js +4 -0
  72. package/dist/Main/LogoHeader.d.ts +2 -0
  73. package/dist/Main/LogoHeader.js +5 -0
  74. package/dist/Main/Main.d.ts +59 -0
  75. package/dist/Main/Main.js +82 -0
  76. package/dist/MainMenu/MainMenu.d.ts +10 -0
  77. package/dist/MainMenu/MainMenu.js +6 -0
  78. package/dist/MainMenu/MenuItem/MenuItem.d.ts +16 -0
  79. package/dist/MainMenu/MenuItem/MenuItem.js +16 -0
  80. package/dist/MainMenu/hooks.d.ts +10 -0
  81. package/dist/MainMenu/hooks.js +21 -0
  82. package/dist/Navigation/CurrentItemNavigation.d.ts +15 -0
  83. package/dist/Navigation/CurrentItemNavigation.js +12 -0
  84. package/dist/Navigation/ExtraItemsMenu.d.ts +10 -0
  85. package/dist/Navigation/ExtraItemsMenu.js +24 -0
  86. package/dist/Navigation/ExtraItemsNavigation.d.ts +11 -0
  87. package/dist/Navigation/ExtraItemsNavigation.js +11 -0
  88. package/dist/Navigation/HomeMenu.d.ts +17 -0
  89. package/dist/Navigation/HomeMenu.js +28 -0
  90. package/dist/Navigation/ItemMenu.d.ts +16 -0
  91. package/dist/Navigation/ItemMenu.js +32 -0
  92. package/dist/Navigation/Navigation.d.ts +26 -0
  93. package/dist/Navigation/Navigation.js +15 -0
  94. package/dist/Navigation/ParentsNavigation.d.ts +10 -0
  95. package/dist/Navigation/ParentsNavigation.js +8 -0
  96. package/dist/Navigation/common/CenterAlignWrapper.d.ts +3 -0
  97. package/dist/Navigation/common/CenterAlignWrapper.js +7 -0
  98. package/dist/Navigation/common/NavigationLink.d.ts +8 -0
  99. package/dist/Navigation/common/NavigationLink.js +7 -0
  100. package/dist/Navigation/common/constants.d.ts +1 -0
  101. package/dist/Navigation/common/constants.js +1 -0
  102. package/dist/PlatformSwitch/PlatformSwitch.d.ts +57 -0
  103. package/dist/PlatformSwitch/PlatformSwitch.js +66 -0
  104. package/dist/PlatformSwitch/hooks.d.ts +30 -0
  105. package/dist/PlatformSwitch/hooks.js +49 -0
  106. package/dist/SearchInput/SearchInput.d.ts +20 -0
  107. package/dist/SearchInput/SearchInput.js +14 -0
  108. package/dist/Select/Select.d.ts +24 -0
  109. package/dist/Select/Select.js +7 -0
  110. package/dist/Sidebar/Sidebar.d.ts +11 -0
  111. package/dist/Sidebar/Sidebar.js +25 -0
  112. package/dist/StyledComponents/StyledBaseComponents.d.ts +11 -0
  113. package/dist/StyledComponents/StyledBaseComponents.js +11 -0
  114. package/dist/TextDisplay/TextDisplay.d.ts +5 -0
  115. package/dist/TextDisplay/TextDisplay.js +24 -0
  116. package/dist/TextDisplay/fixtures.d.ts +3 -0
  117. package/dist/TextDisplay/fixtures.js +84 -0
  118. package/dist/TextDisplay/withFlavor.d.ts +8 -0
  119. package/dist/TextDisplay/withFlavor.js +25 -0
  120. package/dist/TextEditor/TextEditor.d.ts +16 -0
  121. package/dist/TextEditor/TextEditor.js +74 -0
  122. package/dist/ThemeContext/LanguageSelect.d.ts +15 -0
  123. package/dist/ThemeContext/LanguageSelect.js +19 -0
  124. package/dist/ThemeContext/ThemeContext.d.ts +22 -0
  125. package/dist/ThemeContext/ThemeContext.js +31 -0
  126. package/dist/Thumbnail/Thumbnail.d.ts +28 -0
  127. package/dist/Thumbnail/Thumbnail.js +27 -0
  128. package/dist/Tree/Breadcrumbs.d.ts +14 -0
  129. package/dist/Tree/Breadcrumbs.js +30 -0
  130. package/dist/Tree/RowMenu.d.ts +12 -0
  131. package/dist/Tree/RowMenu.js +37 -0
  132. package/dist/Tree/RowMenus.d.ts +18 -0
  133. package/dist/Tree/RowMenus.js +7 -0
  134. package/dist/Tree/types.d.ts +6 -0
  135. package/dist/Tree/types.js +1 -0
  136. package/dist/UserSwitch/UserSwitch.d.ts +17 -0
  137. package/dist/UserSwitch/UserSwitch.js +46 -0
  138. package/dist/UserSwitch/UserSwitchWrapper.d.ts +37 -0
  139. package/dist/UserSwitch/UserSwitchWrapper.js +74 -0
  140. package/dist/appComponents/ErrorFallback.d.ts +57 -0
  141. package/dist/appComponents/ErrorFallback.js +72 -0
  142. package/dist/appComponents/QuestionLabel.d.ts +9 -0
  143. package/dist/appComponents/QuestionLabel.js +4 -0
  144. package/dist/appComponents/index.d.ts +6 -0
  145. package/dist/appComponents/index.js +5 -0
  146. package/dist/appComponents/statusChips/RequiredChip.d.ts +3 -0
  147. package/dist/appComponents/statusChips/RequiredChip.js +5 -0
  148. package/dist/appComponents/statusChips/SavedChip.d.ts +3 -0
  149. package/dist/appComponents/statusChips/SavedChip.js +5 -0
  150. package/dist/appComponents/statusChips/SubmittedChip.d.ts +3 -0
  151. package/dist/appComponents/statusChips/SubmittedChip.js +5 -0
  152. package/dist/appComponents/statusChips/types.d.ts +5 -0
  153. package/dist/appComponents/statusChips/types.js +1 -0
  154. package/dist/appComponents/types.d.ts +8 -0
  155. package/dist/appComponents/types.js +1 -0
  156. package/dist/apps.d.ts +1 -0
  157. package/dist/apps.js +1 -0
  158. package/dist/buttons/BookmarkButton/BookmarkButton.d.ts +24 -0
  159. package/dist/buttons/BookmarkButton/BookmarkButton.js +24 -0
  160. package/dist/buttons/Button/Button.d.ts +37 -0
  161. package/dist/buttons/Button/Button.js +4 -0
  162. package/dist/buttons/ChatboxButton/ChatboxButton.d.ts +15 -0
  163. package/dist/buttons/ChatboxButton/ChatboxButton.js +21 -0
  164. package/dist/buttons/CopyButton/CopyButton.d.ts +13 -0
  165. package/dist/buttons/CopyButton/CopyButton.js +14 -0
  166. package/dist/buttons/DeleteButton/DeleteButton.d.ts +12 -0
  167. package/dist/buttons/DeleteButton/DeleteButton.js +17 -0
  168. package/dist/buttons/DownloadButton/DownloadButton.d.ts +30 -0
  169. package/dist/buttons/DownloadButton/DownloadButton.js +20 -0
  170. package/dist/buttons/EditButton/EditButton.d.ts +13 -0
  171. package/dist/buttons/EditButton/EditButton.js +17 -0
  172. package/dist/buttons/LikeButton/LikeButton.d.ts +28 -0
  173. package/dist/buttons/LikeButton/LikeButton.js +10 -0
  174. package/dist/buttons/MenuItemButton.d.ts +11 -0
  175. package/dist/buttons/MenuItemButton.js +12 -0
  176. package/dist/buttons/MoveButton/MoveButton.d.ts +13 -0
  177. package/dist/buttons/MoveButton/MoveButton.js +19 -0
  178. package/dist/buttons/PinButton/PinButton.d.ts +15 -0
  179. package/dist/buttons/PinButton/PinButton.js +21 -0
  180. package/dist/buttons/SaveButton/SaveButton.d.ts +24 -0
  181. package/dist/buttons/SaveButton/SaveButton.js +4 -0
  182. package/dist/buttons/ShareButton/ShareButton.d.ts +14 -0
  183. package/dist/buttons/ShareButton/ShareButton.js +17 -0
  184. package/dist/buttons/hooks.d.ts +5 -0
  185. package/dist/buttons/hooks.js +14 -0
  186. package/dist/buttons/index.d.ts +12 -0
  187. package/dist/buttons/index.js +12 -0
  188. package/dist/constants.d.ts +11 -0
  189. package/dist/constants.js +12 -0
  190. package/dist/draggable/DraggableElement.d.ts +11 -0
  191. package/dist/draggable/DraggableElement.js +42 -0
  192. package/dist/draggable/DraggingWrapper.d.ts +23 -0
  193. package/dist/draggable/DraggingWrapper.js +20 -0
  194. package/dist/draggable/InBetween.d.ts +10 -0
  195. package/dist/draggable/InBetween.js +34 -0
  196. package/dist/draggable/types.d.ts +10 -0
  197. package/dist/draggable/types.js +1 -0
  198. package/dist/enums/errors.d.ts +3 -0
  199. package/dist/enums/errors.js +3 -0
  200. package/dist/hooks/useFullscreen.d.ts +5 -0
  201. package/dist/hooks/useFullscreen.js +37 -0
  202. package/dist/hooks/useMobileView.d.ts +4 -0
  203. package/dist/hooks/useMobileView.js +6 -0
  204. package/dist/icons/AnalyticsIcon.d.ts +15 -0
  205. package/dist/icons/AnalyticsIcon.js +7 -0
  206. package/dist/icons/BuildIcon.d.ts +15 -0
  207. package/dist/icons/BuildIcon.js +7 -0
  208. package/dist/icons/EtherpadIcon.d.ts +7 -0
  209. package/dist/icons/EtherpadIcon.js +7 -0
  210. package/dist/icons/H5PIcon.d.ts +6 -0
  211. package/dist/icons/H5PIcon.js +6 -0
  212. package/dist/icons/ItemIcon.d.ts +23 -0
  213. package/dist/icons/ItemIcon.js +75 -0
  214. package/dist/icons/LibraryIcon.d.ts +16 -0
  215. package/dist/icons/LibraryIcon.js +7 -0
  216. package/dist/icons/PlayIcon.d.ts +15 -0
  217. package/dist/icons/PlayIcon.js +7 -0
  218. package/dist/icons/ResizingIcon.d.ts +2 -0
  219. package/dist/icons/ResizingIcon.js +21 -0
  220. package/dist/icons/StyledSVGComponents.d.ts +35 -0
  221. package/dist/icons/StyledSVGComponents.js +53 -0
  222. package/dist/icons/index.d.ts +6 -0
  223. package/dist/icons/index.js +6 -0
  224. package/dist/index.d.ts +61 -0
  225. package/dist/index.js +60 -0
  226. package/dist/itemLogin/ForbiddenContent.d.ts +20 -0
  227. package/dist/itemLogin/ForbiddenContent.js +4 -0
  228. package/dist/itemLogin/ForbiddenText.d.ts +8 -0
  229. package/dist/itemLogin/ForbiddenText.js +6 -0
  230. package/dist/itemLogin/ItemLoginScreen.d.ts +26 -0
  231. package/dist/itemLogin/ItemLoginScreen.js +72 -0
  232. package/dist/itemLogin/ItemLoginWrapper.d.ts +23 -0
  233. package/dist/itemLogin/ItemLoginWrapper.js +43 -0
  234. package/dist/itemLogin/constants.d.ts +1 -0
  235. package/dist/itemLogin/constants.js +1 -0
  236. package/dist/items/AppItem.d.ts +60 -0
  237. package/dist/items/AppItem.js +69 -0
  238. package/dist/items/DocumentItem.d.ts +19 -0
  239. package/dist/items/DocumentItem.js +25 -0
  240. package/dist/items/DownloadButtonFileItem.d.ts +9 -0
  241. package/dist/items/DownloadButtonFileItem.js +10 -0
  242. package/dist/items/EtherpadItem.d.ts +26 -0
  243. package/dist/items/EtherpadItem.js +15 -0
  244. package/dist/items/FileAudio.d.ts +9 -0
  245. package/dist/items/FileAudio.js +10 -0
  246. package/dist/items/FileImage.d.ts +7 -0
  247. package/dist/items/FileImage.js +10 -0
  248. package/dist/items/FileItem.d.ts +25 -0
  249. package/dist/items/FileItem.js +81 -0
  250. package/dist/items/FilePdf.d.ts +14 -0
  251. package/dist/items/FilePdf.js +29 -0
  252. package/dist/items/FileVideo.d.ts +8 -0
  253. package/dist/items/FileVideo.js +9 -0
  254. package/dist/items/H5PItem.d.ts +20 -0
  255. package/dist/items/H5PItem.js +80 -0
  256. package/dist/items/ItemSkeleton/ItemSkeleton.d.ts +12 -0
  257. package/dist/items/ItemSkeleton/ItemSkeleton.js +35 -0
  258. package/dist/items/LinkItem.d.ts +43 -0
  259. package/dist/items/LinkItem.js +97 -0
  260. package/dist/items/SizingWrapper.d.ts +6 -0
  261. package/dist/items/SizingWrapper.js +23 -0
  262. package/dist/items/appItemHooks.d.ts +27 -0
  263. package/dist/items/appItemHooks.js +124 -0
  264. package/dist/items/constants.d.ts +1 -0
  265. package/dist/items/constants.js +1 -0
  266. package/dist/items/iframeStyles.d.ts +4 -0
  267. package/dist/items/iframeStyles.js +5 -0
  268. package/dist/items/index.d.ts +5 -0
  269. package/dist/items/index.js +5 -0
  270. package/dist/items/withCaption.d.ts +19 -0
  271. package/dist/items/withCaption.js +58 -0
  272. package/dist/items/withResizing.d.ts +9 -0
  273. package/dist/items/withResizing.js +42 -0
  274. package/dist/text-editor.d.ts +2 -0
  275. package/dist/text-editor.js +2 -0
  276. package/dist/theme.d.ts +108 -0
  277. package/dist/theme.js +214 -0
  278. package/dist/types.d.ts +43 -0
  279. package/dist/types.js +32 -0
  280. package/dist/upload/FileDropper/FileDropper.d.ts +50 -0
  281. package/dist/upload/FileDropper/FileDropper.js +43 -0
  282. package/dist/upload/UploadFileButton/UploadFileButton.d.ts +35 -0
  283. package/dist/upload/UploadFileButton/UploadFileButton.js +17 -0
  284. package/dist/utils/fixtures.d.ts +3 -0
  285. package/dist/utils/fixtures.js +7 -0
  286. package/dist/utils/storybook.d.ts +5 -0
  287. package/dist/utils/storybook.js +5 -0
  288. package/package.json +172 -0
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BookmarkIcon } from 'lucide-react';
3
+ import { IconButton, Tooltip } from '@mui/material';
4
+ import { ActionButton, } from '../../types.js';
5
+ import MenuItemButton from '../MenuItemButton.js';
6
+ import { useButtonColor } from '../hooks.js';
7
+ const BOOKMARK_COLOR = '#ffc107';
8
+ const BookmarkButton = ({ ariaLabel = 'favorite', className, color, handleBookmark, handleUnbookmark, isFavorite = false, size = 'medium', sx, text, tooltip, type, }) => {
9
+ const { color: buttonColor } = useButtonColor(color);
10
+ const icon = (_jsx(BookmarkIcon, { fill: isFavorite ? BOOKMARK_COLOR : 'none', fontSize: size }));
11
+ const tooltipText = tooltip ?? (isFavorite ? 'Remove from Bookmarks' : 'Add to Bookmarks');
12
+ const iconColor = isFavorite ? BOOKMARK_COLOR : buttonColor;
13
+ const onClick = isFavorite ? handleUnbookmark : handleBookmark;
14
+ switch (type) {
15
+ case ActionButton.ICON:
16
+ return icon;
17
+ case ActionButton.MENU_ITEM:
18
+ return (_jsx(MenuItemButton, { iconColor: iconColor, text: text ?? tooltipText, onClick: onClick, icon: icon, className: className }));
19
+ case ActionButton.ICON_BUTTON:
20
+ default:
21
+ return (_jsx(Tooltip, { title: tooltipText, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": ariaLabel, sx: { color: iconColor, ...sx }, onClick: onClick, children: icon }) }) }));
22
+ }
23
+ };
24
+ export default BookmarkButton;
@@ -0,0 +1,37 @@
1
+ import { ButtonProps } from '@mui/material';
2
+ import { AnchorHTMLAttributes, ElementType, ReactNode } from 'react';
3
+ export type GraaspButtonProps = {
4
+ autoFocus?: boolean;
5
+ /**
6
+ * button contents, usually a string
7
+ */
8
+ children?: ReactNode;
9
+ /**
10
+ * className string
11
+ */
12
+ className?: string;
13
+ color?: ButtonProps['color'];
14
+ component?: ElementType;
15
+ /**
16
+ * cypress data-cy attribute
17
+ */
18
+ dataCy?: string;
19
+ disabled?: boolean;
20
+ endIcon?: ReactNode;
21
+ fullWidth?: boolean;
22
+ /**
23
+ * id string
24
+ */
25
+ id?: string;
26
+ /**
27
+ * on click handler
28
+ */
29
+ onClick?: () => void;
30
+ size?: ButtonProps['size'];
31
+ startIcon?: ReactNode;
32
+ type?: ButtonProps['type'];
33
+ variant?: ButtonProps['variant'];
34
+ role?: ButtonProps['role'];
35
+ } & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target'>;
36
+ export declare const GraaspButton: ({ autoFocus, children, className, color, dataCy, disabled, endIcon, fullWidth, id, onClick, size, startIcon, type, variant, href, role, ...other }: GraaspButtonProps) => JSX.Element;
37
+ export default GraaspButton;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '@mui/material';
3
+ export const GraaspButton = ({ autoFocus, children, className, color = 'primary', dataCy, disabled = false, endIcon, fullWidth, id, onClick, size = 'medium', startIcon, type, variant = 'contained', href, role, ...other }) => (_jsx(Button, { role: role, autoFocus: autoFocus, className: className, color: color, "data-cy": dataCy, disabled: disabled, endIcon: endIcon, fullWidth: fullWidth, id: id, onClick: onClick, size: size, startIcon: startIcon, type: type, variant: variant, href: href, title: href, ...other, children: children }));
4
+ export default GraaspButton;
@@ -0,0 +1,15 @@
1
+ import { ActionButtonVariant, IconSizeVariant } from '../../types.js';
2
+ export type Props = {
3
+ id?: string;
4
+ onClick?: () => void;
5
+ size?: IconSizeVariant;
6
+ tooltip?: string;
7
+ menuItemClassName?: string;
8
+ showChat: boolean;
9
+ showChatText?: string;
10
+ hideChatText?: string;
11
+ type?: ActionButtonVariant;
12
+ color?: 'primary' | 'inherit';
13
+ };
14
+ declare const ChatboxButton: ({ tooltip, showChat, id, onClick, size, menuItemClassName, type, showChatText, hideChatText, color, }: Props) => JSX.Element;
15
+ export default ChatboxButton;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MessageSquareIcon, MessageSquareOffIcon } from 'lucide-react';
3
+ import { IconButton, Tooltip } from '@mui/material';
4
+ import { ActionButton } from '../../types.js';
5
+ import MenuItemButton from '../MenuItemButton.js';
6
+ import { useButtonColor } from '../hooks.js';
7
+ const ChatboxButton = ({ tooltip, showChat, id, onClick, size, menuItemClassName, type, showChatText = 'Show Chat', hideChatText = 'Hide Chat', color = 'inherit', }) => {
8
+ const { color: buttonColor } = useButtonColor(color);
9
+ const icon = showChat ? (_jsx(MessageSquareOffIcon, { color: buttonColor })) : (_jsx(MessageSquareIcon, { color: buttonColor }));
10
+ const text = showChat ? hideChatText : showChatText;
11
+ switch (type) {
12
+ case ActionButton.ICON:
13
+ return icon;
14
+ case ActionButton.MENU_ITEM:
15
+ return (_jsx(MenuItemButton, { icon: icon, text: text, onClick: onClick, className: menuItemClassName }));
16
+ case ActionButton.ICON_BUTTON:
17
+ default:
18
+ return (_jsx(Tooltip, { title: tooltip, children: _jsx("span", { children: _jsx(IconButton, { id: id, onClick: onClick, size: size, children: icon }) }) }));
19
+ }
20
+ };
21
+ export default ChatboxButton;
@@ -0,0 +1,13 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { ActionButtonVariant, ColorVariantsType } from '../../types.js';
3
+ export type Props = {
4
+ color?: ColorVariantsType;
5
+ iconClassName?: string;
6
+ id?: string;
7
+ menuItemClassName?: string;
8
+ onClick?: MouseEventHandler<HTMLButtonElement | HTMLLIElement>;
9
+ text?: string;
10
+ type?: ActionButtonVariant;
11
+ };
12
+ declare const CopyButton: ({ color, iconClassName, id, menuItemClassName, onClick, text, type, }: Props) => JSX.Element;
13
+ export default CopyButton;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CopyIcon } from 'lucide-react';
3
+ import { IconButton, ListItemIcon, MenuItem, Tooltip } from '@mui/material';
4
+ import { ActionButton, ColorVariants, } from '../../types.js';
5
+ const CopyButton = ({ color = ColorVariants.Primary, iconClassName, id = '', menuItemClassName, onClick, text = 'Copy', type = ActionButton.ICON_BUTTON, }) => {
6
+ const icon = _jsx(CopyIcon, {});
7
+ switch (type) {
8
+ case ActionButton.MENU_ITEM:
9
+ return (_jsxs(MenuItem, { onClick: onClick, className: menuItemClassName, children: [_jsx(ListItemIcon, { children: icon }), text] }, text));
10
+ default:
11
+ return (_jsx(Tooltip, { title: text, children: _jsx("span", { children: _jsx(IconButton, { id: id, color: color, className: iconClassName, "aria-label": text, onClick: onClick, children: icon }) }) }));
12
+ }
13
+ };
14
+ export default CopyButton;
@@ -0,0 +1,12 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { ActionButtonVariant, ColorVariantsType } from '../../types.js';
3
+ export type Props = {
4
+ className?: string;
5
+ color?: ColorVariantsType;
6
+ id?: string;
7
+ onClick?: MouseEventHandler<HTMLButtonElement | HTMLLIElement>;
8
+ text?: string;
9
+ type?: ActionButtonVariant;
10
+ };
11
+ declare const DeleteButton: ({ className, color, id, onClick, text, type, }: Props) => JSX.Element;
12
+ export default DeleteButton;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TrashIcon } from 'lucide-react';
3
+ import { IconButton, ListItemIcon, MenuItem, Tooltip } from '@mui/material';
4
+ import { ActionButton, } from '../../types.js';
5
+ const DeleteButton = ({ className, color, id, onClick, text = 'Delete', type, }) => {
6
+ const icon = _jsx(TrashIcon, {});
7
+ switch (type) {
8
+ case ActionButton.ICON:
9
+ return icon;
10
+ case ActionButton.MENU_ITEM:
11
+ return (_jsxs(MenuItem, { onClick: onClick, children: [_jsx(ListItemIcon, { children: icon }), text] }, text));
12
+ case ActionButton.ICON_BUTTON:
13
+ default:
14
+ return (_jsx(Tooltip, { title: text, children: _jsx("span", { children: _jsx(IconButton, { id: id, color: color, className: className, "aria-label": text, onClick: onClick, children: icon }) }) }));
15
+ }
16
+ };
17
+ export default DeleteButton;
@@ -0,0 +1,30 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { ActionButtonVariant, ColorVariantsType, TooltipPlacement } from '../../types.js';
3
+ export declare const DEFAULT_LOADER_SIZE = 24;
4
+ export type DownloadButtonProps = {
5
+ ariaLabel: string;
6
+ /**
7
+ * button onClick
8
+ */
9
+ handleDownload: MouseEventHandler;
10
+ isLoading: boolean;
11
+ /**
12
+ * CircularProgress's color
13
+ */
14
+ color?: ColorVariantsType;
15
+ /**
16
+ * CircularProgress's size
17
+ */
18
+ loaderSize?: number;
19
+ /**
20
+ * Tooltip's title
21
+ */
22
+ title: string;
23
+ /**
24
+ * Tooltip's placement
25
+ */
26
+ placement?: TooltipPlacement;
27
+ type?: ActionButtonVariant;
28
+ };
29
+ declare const DownloadButton: ({ ariaLabel, handleDownload, isLoading, color, loaderSize, title, placement, type, }: DownloadButtonProps) => JSX.Element;
30
+ export default DownloadButton;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DownloadIcon } from 'lucide-react';
3
+ import { CircularProgress, IconButton, ListItemIcon, MenuItem, Tooltip, Typography, } from '@mui/material';
4
+ import { ActionButton, } from '../../types.js';
5
+ import { useButtonColor } from '../hooks.js';
6
+ export const DEFAULT_LOADER_SIZE = 24;
7
+ const DownloadButton = ({ ariaLabel = 'download', handleDownload, isLoading = false, color, loaderSize = DEFAULT_LOADER_SIZE, title = 'Download', placement = 'bottom', type = ActionButton.ICON_BUTTON, }) => {
8
+ const { color: iconColor } = useButtonColor(color);
9
+ const icon = _jsx(DownloadIcon, { color: iconColor });
10
+ switch (type) {
11
+ case ActionButton.ICON:
12
+ return icon;
13
+ case ActionButton.MENU_ITEM:
14
+ return (_jsxs(MenuItem, { onClick: handleDownload, children: [_jsx(ListItemIcon, { children: icon }), _jsx(Typography, { component: 'span', color: color, children: title })] }, title));
15
+ case ActionButton.ICON_BUTTON:
16
+ default:
17
+ return (_jsx(Tooltip, { title: title, placement: placement, children: _jsx("span", { children: _jsx(IconButton, { disabled: isLoading, color: color, onClick: handleDownload, "aria-label": ariaLabel, children: isLoading ? (_jsx(CircularProgress, { color: color, size: loaderSize })) : (icon) }) }) }));
18
+ }
19
+ };
20
+ export default DownloadButton;
@@ -0,0 +1,13 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { ActionButtonVariant, IconSizeVariant } from '../../types.js';
3
+ export type Props = {
4
+ id?: string;
5
+ className?: string;
6
+ ariaLabel?: string;
7
+ onClick?: MouseEventHandler;
8
+ title?: string;
9
+ size?: IconSizeVariant;
10
+ type?: ActionButtonVariant;
11
+ };
12
+ declare const EditButton: ({ id, className, ariaLabel, onClick, title, size, type, }: Props) => JSX.Element;
13
+ export default EditButton;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Edit2 } from 'lucide-react';
3
+ import { IconButton, ListItemIcon, ListItemText, MenuItem, Tooltip, } from '@mui/material';
4
+ import { ActionButton } from '../../types.js';
5
+ const EditButton = ({ id, className, ariaLabel, onClick, title = 'Edit', size = 'small', type = ActionButton.ICON_BUTTON, }) => {
6
+ const icon = _jsx(Edit2, {});
7
+ switch (type) {
8
+ case ActionButton.ICON:
9
+ return icon;
10
+ case ActionButton.MENU_ITEM:
11
+ return (_jsxs(MenuItem, { onClick: onClick, id: id, className: className, children: [_jsx(ListItemIcon, { children: icon }), _jsx(ListItemText, { children: title })] }, title));
12
+ case ActionButton.ICON_BUTTON:
13
+ default:
14
+ return (_jsx(Tooltip, { title: title, children: _jsx("span", { children: _jsx(IconButton, { id: id, "aria-label": ariaLabel, className: className, onClick: onClick, size: size, children: icon }) }) }));
15
+ }
16
+ };
17
+ export default EditButton;
@@ -0,0 +1,28 @@
1
+ import { SxProps } from '@mui/material';
2
+ import { MouseEventHandler } from 'react';
3
+ import { ColorVariantsType, IconSizeVariant } from '../../types.js';
4
+ export interface LikeButtonProps {
5
+ ariaLabel: string;
6
+ /**
7
+ * IconButton's color
8
+ */
9
+ color?: ColorVariantsType;
10
+ handleLike: MouseEventHandler;
11
+ handleUnlike: MouseEventHandler;
12
+ isLiked?: boolean;
13
+ /**
14
+ * IconButton's size
15
+ */
16
+ size?: IconSizeVariant;
17
+ sx?: SxProps;
18
+ /**
19
+ * Tooltip's title when item is not liked
20
+ */
21
+ tooltipLike?: string;
22
+ /**
23
+ * Tooltip's title when item is liked
24
+ */
25
+ tooltipUnlike?: string;
26
+ }
27
+ declare const LikeButton: ({ ariaLabel, color, handleLike, handleUnlike, isLiked, size, sx, tooltipLike, tooltipUnlike, }: LikeButtonProps) => JSX.Element;
28
+ export default LikeButton;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Heart } from 'lucide-react';
3
+ import { IconButton, Tooltip } from '@mui/material';
4
+ import { useButtonColor } from '../hooks.js';
5
+ const LikeButton = ({ ariaLabel = 'like item', color = 'primary', handleLike, handleUnlike, isLiked = false, size = 'large', sx, tooltipLike = 'Like', tooltipUnlike = 'Unlike', }) => {
6
+ const { fill: fillColor } = useButtonColor(color);
7
+ const fill = isLiked ? fillColor : 'none';
8
+ return (_jsx(Tooltip, { title: isLiked ? tooltipUnlike : tooltipLike, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": ariaLabel, sx: sx, color: color, onClick: isLiked ? handleUnlike : handleLike, children: _jsx(Heart, { fill: fill, fontSize: size }) }) }) }));
9
+ };
10
+ export default LikeButton;
@@ -0,0 +1,11 @@
1
+ import { ListItemIconProps } from '@mui/material';
2
+ import { MouseEventHandler } from 'react';
3
+ export type MenuItemButtonProps = {
4
+ className?: string;
5
+ onClick?: MouseEventHandler;
6
+ text: string;
7
+ icon: JSX.Element;
8
+ iconColor?: ListItemIconProps['color'];
9
+ };
10
+ declare const MenuItemButton: ({ text, icon, onClick, className, iconColor, }: MenuItemButtonProps) => JSX.Element;
11
+ export default MenuItemButton;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ListItemIcon, ListItemText, MenuItem, } from '@mui/material';
3
+ const MenuItemButton = ({ text, icon, onClick, className, iconColor = 'default', }) => {
4
+ return (_jsxs(MenuItem, { onClick: onClick, className: className, children: [_jsx(ListItemIcon, { color: iconColor, children: icon }), _jsx(ListItemText, { sx: {
5
+ '.MuiListItemText-primary, .MuiListItemText-secondary': {
6
+ textOverflow: 'ellipsis',
7
+ overflow: 'hidden',
8
+ whiteSpace: 'nowrap',
9
+ },
10
+ }, children: text })] }, text));
11
+ };
12
+ export default MenuItemButton;
@@ -0,0 +1,13 @@
1
+ import { ActionButtonVariant, ColorVariantsType, IconSizeVariant } from '../../types.js';
2
+ type MoveButtonProps = {
3
+ color?: ColorVariantsType;
4
+ iconClassName?: string;
5
+ id?: string;
6
+ menuItemClassName?: string;
7
+ onClick?: () => void;
8
+ size?: IconSizeVariant;
9
+ text?: string;
10
+ type?: ActionButtonVariant;
11
+ };
12
+ declare const MoveButton: ({ color, iconClassName, id, menuItemClassName, onClick, size, text, type, }: MoveButtonProps) => JSX.Element;
13
+ export default MoveButton;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Move } from 'lucide-react';
3
+ import { IconButton, ListItemIcon, MenuItem, Tooltip, Typography, } from '@mui/material';
4
+ import { ActionButton, ColorVariants, } from '../../types.js';
5
+ import { useButtonColor } from '../hooks.js';
6
+ const MoveButton = ({ color = ColorVariants.Primary, iconClassName, id, menuItemClassName, onClick, size, text = 'Move', type = ActionButton.ICON_BUTTON, }) => {
7
+ const { color: iconColor } = useButtonColor(color);
8
+ const icon = _jsx(Move, { color: iconColor });
9
+ switch (type) {
10
+ case ActionButton.ICON:
11
+ return icon;
12
+ case ActionButton.MENU_ITEM:
13
+ return (_jsxs(MenuItem, { onClick: onClick, className: menuItemClassName, children: [_jsx(ListItemIcon, { children: icon }), _jsx(Typography, { component: 'span', color: color, children: text })] }, text));
14
+ case ActionButton.ICON_BUTTON:
15
+ default:
16
+ return (_jsx(Tooltip, { title: text, children: _jsx("span", { children: _jsx(IconButton, { size: size, id: id, color: color, className: iconClassName, "aria-label": text, onClick: onClick, children: icon }) }) }));
17
+ }
18
+ };
19
+ export default MoveButton;
@@ -0,0 +1,15 @@
1
+ import { ActionButtonVariant, ColorVariantsType, IconSizeVariant } from '../../types.js';
2
+ export type PinButtonProps = {
3
+ color?: ColorVariantsType;
4
+ iconClassName?: string;
5
+ id?: string;
6
+ isPinned?: boolean;
7
+ menuItemClassName?: string;
8
+ onClick?: () => void;
9
+ size?: IconSizeVariant;
10
+ pinText?: string;
11
+ unPinText?: string;
12
+ type?: ActionButtonVariant;
13
+ };
14
+ declare const PinButton: ({ type, onClick, menuItemClassName, iconClassName, isPinned, pinText, unPinText, size, color, }: PinButtonProps) => JSX.Element;
15
+ export default PinButton;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Pin, PinOff } from 'lucide-react';
3
+ import { IconButton, Tooltip } from '@mui/material';
4
+ import { ActionButton, } from '../../types.js';
5
+ import MenuItemButton from '../MenuItemButton.js';
6
+ import { useButtonColor } from '../hooks.js';
7
+ const PinButton = ({ type, onClick, menuItemClassName, iconClassName, isPinned, pinText = 'Pin', unPinText = 'Unpin', size, color, }) => {
8
+ const { color: buttonColor } = useButtonColor(color);
9
+ const icon = isPinned ? (_jsx(PinOff, { color: buttonColor })) : (_jsx(Pin, { color: buttonColor }));
10
+ const text = isPinned ? unPinText : pinText;
11
+ switch (type) {
12
+ case ActionButton.ICON:
13
+ return icon;
14
+ case ActionButton.MENU_ITEM:
15
+ return (_jsx(MenuItemButton, { icon: icon, onClick: onClick, text: text, className: menuItemClassName }));
16
+ case ActionButton.ICON_BUTTON:
17
+ default:
18
+ return (_jsx(Tooltip, { title: text, children: _jsx("span", { children: _jsx(IconButton, { size: size, "aria-label": text, className: iconClassName, onClick: onClick, children: icon }) }) }));
19
+ }
20
+ };
21
+ export default PinButton;
@@ -0,0 +1,24 @@
1
+ import { GraaspButtonProps } from '../Button/Button.js';
2
+ export type SaveButtonProps = {
3
+ /**
4
+ * whether changes have been detected
5
+ */
6
+ hasChanges: boolean;
7
+ onClick: () => void;
8
+ color?: GraaspButtonProps['color'];
9
+ id?: string;
10
+ /**
11
+ * text when no changes have been detected
12
+ */
13
+ savedText?: string;
14
+ /**
15
+ * text when changes have been detected
16
+ */
17
+ text?: string;
18
+ /**
19
+ * button variant
20
+ */
21
+ variant?: GraaspButtonProps['variant'];
22
+ };
23
+ declare const SaveButton: ({ color, hasChanges, id, onClick, savedText, text, variant, }: SaveButtonProps) => JSX.Element;
24
+ export default SaveButton;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import GraaspButton from '../Button/Button.js';
3
+ const SaveButton = ({ color, hasChanges, id, onClick, savedText = 'Saved', text = 'Save', variant, }) => (_jsx(GraaspButton, { id: id, variant: variant, color: color, onClick: onClick, disabled: !hasChanges, children: hasChanges ? text : savedText }));
4
+ export default SaveButton;
@@ -0,0 +1,14 @@
1
+ import { IconButtonProps } from '@mui/material';
2
+ import { MouseEventHandler } from 'react';
3
+ import { ActionButtonVariant } from '../../types.js';
4
+ export type Props = {
5
+ tooltip?: string;
6
+ onClick?: MouseEventHandler;
7
+ ariaLabel?: string;
8
+ className?: string;
9
+ size?: IconButtonProps['size'];
10
+ id?: string;
11
+ type?: ActionButtonVariant;
12
+ };
13
+ declare const ShareButton: ({ className, tooltip, ariaLabel, id, onClick, size, type, }: Props) => JSX.Element;
14
+ export default ShareButton;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { UsersRound } from 'lucide-react';
3
+ import { IconButton, ListItemIcon, ListItemText, MenuItem, Tooltip, } from '@mui/material';
4
+ import { ActionButton } from '../../types.js';
5
+ const ShareButton = ({ className, tooltip = 'Share', ariaLabel, id, onClick, size, type = ActionButton.ICON_BUTTON, }) => {
6
+ const icon = _jsx(UsersRound, {});
7
+ switch (type) {
8
+ case ActionButton.ICON:
9
+ return icon;
10
+ case ActionButton.MENU_ITEM:
11
+ return (_jsxs(MenuItem, { className: className, onClick: onClick, children: [_jsx(ListItemIcon, { children: icon }), _jsx(ListItemText, { children: tooltip })] }, tooltip));
12
+ case ActionButton.ICON_BUTTON:
13
+ default:
14
+ return (_jsx(Tooltip, { title: tooltip, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": ariaLabel ?? tooltip, className: className, onClick: onClick, id: id, size: size, children: icon }) }) }));
15
+ }
16
+ };
17
+ export default ShareButton;
@@ -0,0 +1,5 @@
1
+ import { ColorVariantsType } from '../types.js';
2
+ export declare const useButtonColor: (color: ColorVariantsType | undefined) => {
3
+ fill: string | undefined;
4
+ color: string | undefined;
5
+ };
@@ -0,0 +1,14 @@
1
+ import { useTheme } from '@mui/material';
2
+ import { DEFAULT_TEXT_SECONDARY_COLOR } from '../theme.js';
3
+ import { ColorVariants } from '../types.js';
4
+ export const useButtonColor = (color) => {
5
+ const theme = useTheme();
6
+ if (color === undefined) {
7
+ return { color: undefined, fill: DEFAULT_TEXT_SECONDARY_COLOR };
8
+ }
9
+ if (color === ColorVariants.Inherit) {
10
+ return { color: 'currentColor', fill: 'currentColor' };
11
+ }
12
+ const themeColor = theme.palette[color].main;
13
+ return { color: themeColor, fill: themeColor };
14
+ };
@@ -0,0 +1,12 @@
1
+ export { default as BookmarkButton } from './BookmarkButton/BookmarkButton.js';
2
+ export { default as Button } from './Button/Button.js';
3
+ export { default as ChatboxButton } from './ChatboxButton/ChatboxButton.js';
4
+ export { default as CopyButton } from './CopyButton/CopyButton.js';
5
+ export { default as DeleteButton } from './DeleteButton/DeleteButton.js';
6
+ export { default as DownloadButton } from './DownloadButton/DownloadButton.js';
7
+ export { default as EditButton } from './EditButton/EditButton.js';
8
+ export { default as LikeButton } from './LikeButton/LikeButton.js';
9
+ export { default as MoveButton } from './MoveButton/MoveButton.js';
10
+ export { default as PinButton } from './PinButton/PinButton.js';
11
+ export { default as SaveButton } from './SaveButton/SaveButton.js';
12
+ export { default as ShareButton } from './ShareButton/ShareButton.js';
@@ -0,0 +1,12 @@
1
+ export { default as BookmarkButton } from './BookmarkButton/BookmarkButton.js';
2
+ export { default as Button } from './Button/Button.js';
3
+ export { default as ChatboxButton } from './ChatboxButton/ChatboxButton.js';
4
+ export { default as CopyButton } from './CopyButton/CopyButton.js';
5
+ export { default as DeleteButton } from './DeleteButton/DeleteButton.js';
6
+ export { default as DownloadButton } from './DownloadButton/DownloadButton.js';
7
+ export { default as EditButton } from './EditButton/EditButton.js';
8
+ export { default as LikeButton } from './LikeButton/LikeButton.js';
9
+ export { default as MoveButton } from './MoveButton/MoveButton.js';
10
+ export { default as PinButton } from './PinButton/PinButton.js';
11
+ export { default as SaveButton } from './SaveButton/SaveButton.js';
12
+ export { default as ShareButton } from './ShareButton/ShareButton.js';
@@ -0,0 +1,11 @@
1
+ export declare const DRAWER_WIDTH = 240;
2
+ export declare const DEFAULT_DIRECTION = "ltr";
3
+ export declare const DRAWER_HEADER_HEIGHT = 55;
4
+ export declare const DEFAULT_THUMBNAIL_SIZE: "small";
5
+ export declare const DEFAULT_LINK_SHOW_BUTTON = true;
6
+ export declare const UNEXPECTED_ERROR_MESSAGE = "An unexpected error occurred";
7
+ export declare const SMALL_AVATAR_SIZE = 40;
8
+ export declare const SHORT_TEXT_WIDTH = 60;
9
+ export declare const IFRAME_MIN_HEIGHT = 200;
10
+ export declare const FLAG_LIST_MAX_HEIGHT = 250;
11
+ export declare const SCREEN_MAX_HEIGHT: number;
@@ -0,0 +1,12 @@
1
+ import { ThumbnailSize } from '@lnco-ai/sdk';
2
+ export const DRAWER_WIDTH = 240;
3
+ export const DEFAULT_DIRECTION = 'ltr';
4
+ export const DRAWER_HEADER_HEIGHT = 55;
5
+ export const DEFAULT_THUMBNAIL_SIZE = ThumbnailSize.Small;
6
+ export const DEFAULT_LINK_SHOW_BUTTON = true;
7
+ export const UNEXPECTED_ERROR_MESSAGE = 'An unexpected error occurred';
8
+ export const SMALL_AVATAR_SIZE = 40;
9
+ export const SHORT_TEXT_WIDTH = 60;
10
+ export const IFRAME_MIN_HEIGHT = 200;
11
+ export const FLAG_LIST_MAX_HEIGHT = 250;
12
+ export const SCREEN_MAX_HEIGHT = typeof window !== 'undefined' ? window.innerHeight * 0.8 : 1000;
@@ -0,0 +1,11 @@
1
+ import { DraggableAndDroppableProps, DroppedFile } from './types.js';
2
+ export type DraggableElementProps<T> = {
3
+ row: T;
4
+ onDrop: (draggedRow: T | DroppedFile, targetRow: T) => void;
5
+ isMovable?: (el: T) => boolean;
6
+ renderComponent: (el: T | DroppedFile, args: DraggableAndDroppableProps) => JSX.Element;
7
+ allowFiles?: boolean;
8
+ canDrop?: (el: T | DroppedFile) => boolean;
9
+ };
10
+ declare const DraggableElement: <T extends object>({ row, onDrop, canDrop, isMovable, renderComponent, allowFiles, }: DraggableElementProps<T>) => JSX.Element;
11
+ export default DraggableElement;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from '@mui/material';
3
+ import { useDrag, useDrop } from 'react-dnd';
4
+ import { NativeTypes } from 'react-dnd-html5-backend';
5
+ const DraggableElement = ({ row, onDrop, canDrop = () => true, isMovable = () => true, renderComponent, allowFiles = true, }) => {
6
+ const accept = ['row'];
7
+ if (allowFiles) {
8
+ accept.push(NativeTypes.FILE);
9
+ }
10
+ const [{ isOver }, dropRef] = useDrop({
11
+ accept,
12
+ canDrop,
13
+ drop: (draggedRow) => {
14
+ onDrop(draggedRow, row);
15
+ },
16
+ collect: (monitor) => ({
17
+ isOver: monitor.getItem() !== row &&
18
+ canDrop(monitor.getItem()) &&
19
+ !!monitor.isOver(),
20
+ }),
21
+ }, [onDrop]);
22
+ const [{ isDragging }, dragRef] = useDrag({
23
+ collect: (monitor) => ({
24
+ isDragging: monitor.isDragging(),
25
+ }),
26
+ item: () => row,
27
+ type: 'row',
28
+ });
29
+ const attachRef = (el) => {
30
+ dragRef(el);
31
+ dropRef(el);
32
+ };
33
+ const canMove = isMovable(row);
34
+ return (_jsx(Box, { ref: canMove ? attachRef : undefined, sx: canMove
35
+ ? {
36
+ '&:hover': {
37
+ cursor: 'grab',
38
+ },
39
+ }
40
+ : undefined, children: renderComponent(row, { isDragging, isOver, isMovable: canMove }) }));
41
+ };
42
+ export default DraggableElement;
@@ -0,0 +1,23 @@
1
+ import { DraggableElementProps } from './DraggableElement.js';
2
+ import { InBetweenProps } from './InBetween.js';
3
+ export type DraggingWrapperProps<T> = {
4
+ renderComponent: DraggableElementProps<T>['renderComponent'];
5
+ rows?: T[];
6
+ /** wrapper id */
7
+ id?: string;
8
+ getRowId?: (el: T) => string;
9
+ /** show drag anchor */
10
+ isMovable?: DraggableElementProps<T>['isMovable'];
11
+ /** handler on drop in a row */
12
+ onDropInRow?: DraggableElementProps<T>['onDrop'];
13
+ /** enable to drag in between rows */
14
+ enableMoveInBetween?: boolean;
15
+ /** handler on drop in between rows */
16
+ onDropBetweenRow?: InBetweenProps<T>['onDrop'];
17
+ allowFiles?: DraggableElementProps<T>['allowFiles'];
18
+ canDrop?: DraggableElementProps<T>['canDrop'];
19
+ /** number of columns */
20
+ nbColumns?: number;
21
+ };
22
+ declare const DraggingWrapper: <T extends object>({ id, rows, getRowId, onDropInRow: onDropInRowFn, onDropBetweenRow: onDropBetweenRowFn, renderComponent, isMovable, enableMoveInBetween, allowFiles, canDrop, nbColumns, }: DraggingWrapperProps<T>) => JSX.Element;
23
+ export default DraggingWrapper;