@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.
- package/CHANGELOG.md +1323 -0
- package/LICENSE +661 -0
- package/README.md +60 -0
- package/dist/Authorization/PreventGuestWrapper.d.ts +19 -0
- package/dist/Authorization/PreventGuestWrapper.js +15 -0
- package/dist/Authorization/RedirectionContent.d.ts +9 -0
- package/dist/Authorization/RedirectionContent.js +24 -0
- package/dist/Authorization/SignedInWrapper.d.ts +10 -0
- package/dist/Authorization/SignedInWrapper.js +21 -0
- package/dist/Avatar/Avatar.d.ts +24 -0
- package/dist/Avatar/Avatar.js +22 -0
- package/dist/Avatar/stringToColor.d.ts +12 -0
- package/dist/Avatar/stringToColor.js +31 -0
- package/dist/Avatar/stringToColor.test.d.ts +1 -0
- package/dist/Avatar/stringToColor.test.js +8 -0
- package/dist/Card/Card.d.ts +39 -0
- package/dist/Card/Card.js +76 -0
- package/dist/Card/CardHeader.d.ts +12 -0
- package/dist/Card/CardHeader.js +8 -0
- package/dist/Card/CardThumbnail.d.ts +10 -0
- package/dist/Card/CardThumbnail.js +14 -0
- package/dist/Card/FolderCard.d.ts +14 -0
- package/dist/Card/FolderCard.js +44 -0
- package/dist/Card/LinkCard.d.ts +11 -0
- package/dist/Card/LinkCard.js +41 -0
- package/dist/Card/components/CardThumbnail.d.ts +8 -0
- package/dist/Card/components/CardThumbnail.js +15 -0
- package/dist/Card/constants.d.ts +1 -0
- package/dist/Card/constants.js +1 -0
- package/dist/Collapse/Collapse.d.ts +10 -0
- package/dist/Collapse/Collapse.js +48 -0
- package/dist/Collapse/withCollapse.d.ts +7 -0
- package/dist/Collapse/withCollapse.js +8 -0
- package/dist/CookiesBanner/CookiesBanner.d.ts +10 -0
- package/dist/CookiesBanner/CookiesBanner.js +60 -0
- package/dist/CreativeCommons/CreativeCommons.d.ts +14 -0
- package/dist/CreativeCommons/CreativeCommons.js +75 -0
- package/dist/CreativeCommons/icons/By.d.ts +3 -0
- package/dist/CreativeCommons/icons/By.js +3 -0
- package/dist/CreativeCommons/icons/CCIconsProps.d.ts +3 -0
- package/dist/CreativeCommons/icons/CCIconsProps.js +1 -0
- package/dist/CreativeCommons/icons/Cc.d.ts +3 -0
- package/dist/CreativeCommons/icons/Cc.js +3 -0
- package/dist/CreativeCommons/icons/Cc0.d.ts +3 -0
- package/dist/CreativeCommons/icons/Cc0.js +3 -0
- package/dist/CreativeCommons/icons/Nc.d.ts +3 -0
- package/dist/CreativeCommons/icons/Nc.js +3 -0
- package/dist/CreativeCommons/icons/Nd.d.ts +3 -0
- package/dist/CreativeCommons/icons/Nd.js +3 -0
- package/dist/CreativeCommons/icons/Sa.d.ts +3 -0
- package/dist/CreativeCommons/icons/Sa.js +3 -0
- package/dist/CustomInitialLoader/CustomInitialLoader.d.ts +5 -0
- package/dist/CustomInitialLoader/CustomInitialLoader.js +25 -0
- package/dist/DrawerHeader/DrawerHeader.d.ts +7 -0
- package/dist/DrawerHeader/DrawerHeader.js +16 -0
- package/dist/GraaspLogo/EpflLogo.d.ts +5 -0
- package/dist/GraaspLogo/EpflLogo.js +3 -0
- package/dist/GraaspLogo/GraaspLogo.d.ts +8 -0
- package/dist/GraaspLogo/GraaspLogo.js +5 -0
- package/dist/Header/Header.d.ts +21 -0
- package/dist/Header/Header.js +33 -0
- package/dist/HeaderUserInformation/HeaderUserInformation.d.ts +22 -0
- package/dist/HeaderUserInformation/HeaderUserInformation.js +23 -0
- package/dist/ItemBadges/ItemBadges.d.ts +17 -0
- package/dist/ItemBadges/ItemBadges.js +10 -0
- package/dist/ItemFlag/ItemFlagButton.d.ts +9 -0
- package/dist/ItemFlag/ItemFlagButton.js +11 -0
- package/dist/ItemFlag/ItemFlagDialog.d.ts +14 -0
- package/dist/ItemFlag/ItemFlagDialog.js +25 -0
- package/dist/Loader/Loader.d.ts +7 -0
- package/dist/Loader/Loader.js +4 -0
- package/dist/Main/LogoHeader.d.ts +2 -0
- package/dist/Main/LogoHeader.js +5 -0
- package/dist/Main/Main.d.ts +59 -0
- package/dist/Main/Main.js +82 -0
- package/dist/MainMenu/MainMenu.d.ts +10 -0
- package/dist/MainMenu/MainMenu.js +6 -0
- package/dist/MainMenu/MenuItem/MenuItem.d.ts +16 -0
- package/dist/MainMenu/MenuItem/MenuItem.js +16 -0
- package/dist/MainMenu/hooks.d.ts +10 -0
- package/dist/MainMenu/hooks.js +21 -0
- package/dist/Navigation/CurrentItemNavigation.d.ts +15 -0
- package/dist/Navigation/CurrentItemNavigation.js +12 -0
- package/dist/Navigation/ExtraItemsMenu.d.ts +10 -0
- package/dist/Navigation/ExtraItemsMenu.js +24 -0
- package/dist/Navigation/ExtraItemsNavigation.d.ts +11 -0
- package/dist/Navigation/ExtraItemsNavigation.js +11 -0
- package/dist/Navigation/HomeMenu.d.ts +17 -0
- package/dist/Navigation/HomeMenu.js +28 -0
- package/dist/Navigation/ItemMenu.d.ts +16 -0
- package/dist/Navigation/ItemMenu.js +32 -0
- package/dist/Navigation/Navigation.d.ts +26 -0
- package/dist/Navigation/Navigation.js +15 -0
- package/dist/Navigation/ParentsNavigation.d.ts +10 -0
- package/dist/Navigation/ParentsNavigation.js +8 -0
- package/dist/Navigation/common/CenterAlignWrapper.d.ts +3 -0
- package/dist/Navigation/common/CenterAlignWrapper.js +7 -0
- package/dist/Navigation/common/NavigationLink.d.ts +8 -0
- package/dist/Navigation/common/NavigationLink.js +7 -0
- package/dist/Navigation/common/constants.d.ts +1 -0
- package/dist/Navigation/common/constants.js +1 -0
- package/dist/PlatformSwitch/PlatformSwitch.d.ts +57 -0
- package/dist/PlatformSwitch/PlatformSwitch.js +66 -0
- package/dist/PlatformSwitch/hooks.d.ts +30 -0
- package/dist/PlatformSwitch/hooks.js +49 -0
- package/dist/SearchInput/SearchInput.d.ts +20 -0
- package/dist/SearchInput/SearchInput.js +14 -0
- package/dist/Select/Select.d.ts +24 -0
- package/dist/Select/Select.js +7 -0
- package/dist/Sidebar/Sidebar.d.ts +11 -0
- package/dist/Sidebar/Sidebar.js +25 -0
- package/dist/StyledComponents/StyledBaseComponents.d.ts +11 -0
- package/dist/StyledComponents/StyledBaseComponents.js +11 -0
- package/dist/TextDisplay/TextDisplay.d.ts +5 -0
- package/dist/TextDisplay/TextDisplay.js +24 -0
- package/dist/TextDisplay/fixtures.d.ts +3 -0
- package/dist/TextDisplay/fixtures.js +84 -0
- package/dist/TextDisplay/withFlavor.d.ts +8 -0
- package/dist/TextDisplay/withFlavor.js +25 -0
- package/dist/TextEditor/TextEditor.d.ts +16 -0
- package/dist/TextEditor/TextEditor.js +74 -0
- package/dist/ThemeContext/LanguageSelect.d.ts +15 -0
- package/dist/ThemeContext/LanguageSelect.js +19 -0
- package/dist/ThemeContext/ThemeContext.d.ts +22 -0
- package/dist/ThemeContext/ThemeContext.js +31 -0
- package/dist/Thumbnail/Thumbnail.d.ts +28 -0
- package/dist/Thumbnail/Thumbnail.js +27 -0
- package/dist/Tree/Breadcrumbs.d.ts +14 -0
- package/dist/Tree/Breadcrumbs.js +30 -0
- package/dist/Tree/RowMenu.d.ts +12 -0
- package/dist/Tree/RowMenu.js +37 -0
- package/dist/Tree/RowMenus.d.ts +18 -0
- package/dist/Tree/RowMenus.js +7 -0
- package/dist/Tree/types.d.ts +6 -0
- package/dist/Tree/types.js +1 -0
- package/dist/UserSwitch/UserSwitch.d.ts +17 -0
- package/dist/UserSwitch/UserSwitch.js +46 -0
- package/dist/UserSwitch/UserSwitchWrapper.d.ts +37 -0
- package/dist/UserSwitch/UserSwitchWrapper.js +74 -0
- package/dist/appComponents/ErrorFallback.d.ts +57 -0
- package/dist/appComponents/ErrorFallback.js +72 -0
- package/dist/appComponents/QuestionLabel.d.ts +9 -0
- package/dist/appComponents/QuestionLabel.js +4 -0
- package/dist/appComponents/index.d.ts +6 -0
- package/dist/appComponents/index.js +5 -0
- package/dist/appComponents/statusChips/RequiredChip.d.ts +3 -0
- package/dist/appComponents/statusChips/RequiredChip.js +5 -0
- package/dist/appComponents/statusChips/SavedChip.d.ts +3 -0
- package/dist/appComponents/statusChips/SavedChip.js +5 -0
- package/dist/appComponents/statusChips/SubmittedChip.d.ts +3 -0
- package/dist/appComponents/statusChips/SubmittedChip.js +5 -0
- package/dist/appComponents/statusChips/types.d.ts +5 -0
- package/dist/appComponents/statusChips/types.js +1 -0
- package/dist/appComponents/types.d.ts +8 -0
- package/dist/appComponents/types.js +1 -0
- package/dist/apps.d.ts +1 -0
- package/dist/apps.js +1 -0
- package/dist/buttons/BookmarkButton/BookmarkButton.d.ts +24 -0
- package/dist/buttons/BookmarkButton/BookmarkButton.js +24 -0
- package/dist/buttons/Button/Button.d.ts +37 -0
- package/dist/buttons/Button/Button.js +4 -0
- package/dist/buttons/ChatboxButton/ChatboxButton.d.ts +15 -0
- package/dist/buttons/ChatboxButton/ChatboxButton.js +21 -0
- package/dist/buttons/CopyButton/CopyButton.d.ts +13 -0
- package/dist/buttons/CopyButton/CopyButton.js +14 -0
- package/dist/buttons/DeleteButton/DeleteButton.d.ts +12 -0
- package/dist/buttons/DeleteButton/DeleteButton.js +17 -0
- package/dist/buttons/DownloadButton/DownloadButton.d.ts +30 -0
- package/dist/buttons/DownloadButton/DownloadButton.js +20 -0
- package/dist/buttons/EditButton/EditButton.d.ts +13 -0
- package/dist/buttons/EditButton/EditButton.js +17 -0
- package/dist/buttons/LikeButton/LikeButton.d.ts +28 -0
- package/dist/buttons/LikeButton/LikeButton.js +10 -0
- package/dist/buttons/MenuItemButton.d.ts +11 -0
- package/dist/buttons/MenuItemButton.js +12 -0
- package/dist/buttons/MoveButton/MoveButton.d.ts +13 -0
- package/dist/buttons/MoveButton/MoveButton.js +19 -0
- package/dist/buttons/PinButton/PinButton.d.ts +15 -0
- package/dist/buttons/PinButton/PinButton.js +21 -0
- package/dist/buttons/SaveButton/SaveButton.d.ts +24 -0
- package/dist/buttons/SaveButton/SaveButton.js +4 -0
- package/dist/buttons/ShareButton/ShareButton.d.ts +14 -0
- package/dist/buttons/ShareButton/ShareButton.js +17 -0
- package/dist/buttons/hooks.d.ts +5 -0
- package/dist/buttons/hooks.js +14 -0
- package/dist/buttons/index.d.ts +12 -0
- package/dist/buttons/index.js +12 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +12 -0
- package/dist/draggable/DraggableElement.d.ts +11 -0
- package/dist/draggable/DraggableElement.js +42 -0
- package/dist/draggable/DraggingWrapper.d.ts +23 -0
- package/dist/draggable/DraggingWrapper.js +20 -0
- package/dist/draggable/InBetween.d.ts +10 -0
- package/dist/draggable/InBetween.js +34 -0
- package/dist/draggable/types.d.ts +10 -0
- package/dist/draggable/types.js +1 -0
- package/dist/enums/errors.d.ts +3 -0
- package/dist/enums/errors.js +3 -0
- package/dist/hooks/useFullscreen.d.ts +5 -0
- package/dist/hooks/useFullscreen.js +37 -0
- package/dist/hooks/useMobileView.d.ts +4 -0
- package/dist/hooks/useMobileView.js +6 -0
- package/dist/icons/AnalyticsIcon.d.ts +15 -0
- package/dist/icons/AnalyticsIcon.js +7 -0
- package/dist/icons/BuildIcon.d.ts +15 -0
- package/dist/icons/BuildIcon.js +7 -0
- package/dist/icons/EtherpadIcon.d.ts +7 -0
- package/dist/icons/EtherpadIcon.js +7 -0
- package/dist/icons/H5PIcon.d.ts +6 -0
- package/dist/icons/H5PIcon.js +6 -0
- package/dist/icons/ItemIcon.d.ts +23 -0
- package/dist/icons/ItemIcon.js +75 -0
- package/dist/icons/LibraryIcon.d.ts +16 -0
- package/dist/icons/LibraryIcon.js +7 -0
- package/dist/icons/PlayIcon.d.ts +15 -0
- package/dist/icons/PlayIcon.js +7 -0
- package/dist/icons/ResizingIcon.d.ts +2 -0
- package/dist/icons/ResizingIcon.js +21 -0
- package/dist/icons/StyledSVGComponents.d.ts +35 -0
- package/dist/icons/StyledSVGComponents.js +53 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +6 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +60 -0
- package/dist/itemLogin/ForbiddenContent.d.ts +20 -0
- package/dist/itemLogin/ForbiddenContent.js +4 -0
- package/dist/itemLogin/ForbiddenText.d.ts +8 -0
- package/dist/itemLogin/ForbiddenText.js +6 -0
- package/dist/itemLogin/ItemLoginScreen.d.ts +26 -0
- package/dist/itemLogin/ItemLoginScreen.js +72 -0
- package/dist/itemLogin/ItemLoginWrapper.d.ts +23 -0
- package/dist/itemLogin/ItemLoginWrapper.js +43 -0
- package/dist/itemLogin/constants.d.ts +1 -0
- package/dist/itemLogin/constants.js +1 -0
- package/dist/items/AppItem.d.ts +60 -0
- package/dist/items/AppItem.js +69 -0
- package/dist/items/DocumentItem.d.ts +19 -0
- package/dist/items/DocumentItem.js +25 -0
- package/dist/items/DownloadButtonFileItem.d.ts +9 -0
- package/dist/items/DownloadButtonFileItem.js +10 -0
- package/dist/items/EtherpadItem.d.ts +26 -0
- package/dist/items/EtherpadItem.js +15 -0
- package/dist/items/FileAudio.d.ts +9 -0
- package/dist/items/FileAudio.js +10 -0
- package/dist/items/FileImage.d.ts +7 -0
- package/dist/items/FileImage.js +10 -0
- package/dist/items/FileItem.d.ts +25 -0
- package/dist/items/FileItem.js +81 -0
- package/dist/items/FilePdf.d.ts +14 -0
- package/dist/items/FilePdf.js +29 -0
- package/dist/items/FileVideo.d.ts +8 -0
- package/dist/items/FileVideo.js +9 -0
- package/dist/items/H5PItem.d.ts +20 -0
- package/dist/items/H5PItem.js +80 -0
- package/dist/items/ItemSkeleton/ItemSkeleton.d.ts +12 -0
- package/dist/items/ItemSkeleton/ItemSkeleton.js +35 -0
- package/dist/items/LinkItem.d.ts +43 -0
- package/dist/items/LinkItem.js +97 -0
- package/dist/items/SizingWrapper.d.ts +6 -0
- package/dist/items/SizingWrapper.js +23 -0
- package/dist/items/appItemHooks.d.ts +27 -0
- package/dist/items/appItemHooks.js +124 -0
- package/dist/items/constants.d.ts +1 -0
- package/dist/items/constants.js +1 -0
- package/dist/items/iframeStyles.d.ts +4 -0
- package/dist/items/iframeStyles.js +5 -0
- package/dist/items/index.d.ts +5 -0
- package/dist/items/index.js +5 -0
- package/dist/items/withCaption.d.ts +19 -0
- package/dist/items/withCaption.js +58 -0
- package/dist/items/withResizing.d.ts +9 -0
- package/dist/items/withResizing.js +42 -0
- package/dist/text-editor.d.ts +2 -0
- package/dist/text-editor.js +2 -0
- package/dist/theme.d.ts +108 -0
- package/dist/theme.js +214 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.js +32 -0
- package/dist/upload/FileDropper/FileDropper.d.ts +50 -0
- package/dist/upload/FileDropper/FileDropper.js +43 -0
- package/dist/upload/UploadFileButton/UploadFileButton.d.ts +35 -0
- package/dist/upload/UploadFileButton/UploadFileButton.js +17 -0
- package/dist/utils/fixtures.d.ts +3 -0
- package/dist/utils/fixtures.js +7 -0
- package/dist/utils/storybook.d.ts +5 -0
- package/dist/utils/storybook.js +5 -0
- package/package.json +172 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export * from './theme.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './items/index.js';
|
|
4
|
+
export * from './hooks/useFullscreen.js';
|
|
5
|
+
export * from './hooks/useMobileView.js';
|
|
6
|
+
export * from './buttons/hooks.js';
|
|
7
|
+
export * from './icons/index.js';
|
|
8
|
+
export * from './buttons/index.js';
|
|
9
|
+
export { default as Loader } from './Loader/Loader.js';
|
|
10
|
+
export { default as TextDisplay } from './TextDisplay/TextDisplay.js';
|
|
11
|
+
export { withFlavor } from './TextDisplay/withFlavor.js';
|
|
12
|
+
export { default as Header } from './Header/Header.js';
|
|
13
|
+
export { default as Sidebar } from './Sidebar/Sidebar.js';
|
|
14
|
+
export { default as DrawerHeader } from './DrawerHeader/DrawerHeader.js';
|
|
15
|
+
export { default as MainMenu } from './MainMenu/MainMenu.js';
|
|
16
|
+
export { useMainMenuOpenContext } from './MainMenu/hooks.js';
|
|
17
|
+
export * from './MainMenu/MainMenu.js';
|
|
18
|
+
export * from './MainMenu/MenuItem/MenuItem.js';
|
|
19
|
+
export { default as Navigation } from './Navigation/Navigation.js';
|
|
20
|
+
export { default as HomeMenu } from './Navigation/HomeMenu.js';
|
|
21
|
+
export { default as ItemMenu } from './Navigation/ItemMenu.js';
|
|
22
|
+
export { default as Main } from './Main/Main.js';
|
|
23
|
+
export { default as withCollapse } from './Collapse/withCollapse.js';
|
|
24
|
+
export { default as GraaspLogo } from './GraaspLogo/GraaspLogo.js';
|
|
25
|
+
export { default as EpflLogo } from './GraaspLogo/EpflLogo.js';
|
|
26
|
+
export { default as ItemLoginWrapper } from './itemLogin/ItemLoginWrapper.js';
|
|
27
|
+
export { default as ForbiddenContent } from './itemLogin/ForbiddenContent.js';
|
|
28
|
+
export { default as Card } from './Card/Card.js';
|
|
29
|
+
export { default as FolderCard } from './Card/FolderCard.js';
|
|
30
|
+
export { default as LinkCard } from './Card/LinkCard.js';
|
|
31
|
+
export { default as Thumbnail } from './Thumbnail/Thumbnail.js';
|
|
32
|
+
export { default as Avatar } from './Avatar/Avatar.js';
|
|
33
|
+
export * from './Avatar/stringToColor.js';
|
|
34
|
+
export { default as ItemBadges } from './ItemBadges/ItemBadges.js';
|
|
35
|
+
export { default as ItemFlagDialog } from './ItemFlag/ItemFlagDialog.js';
|
|
36
|
+
export { default as ItemFlagButton } from './ItemFlag/ItemFlagButton.js';
|
|
37
|
+
export { default as CreativeCommons } from './CreativeCommons/CreativeCommons.js';
|
|
38
|
+
export { default as CookiesBanner } from './CookiesBanner/CookiesBanner.js';
|
|
39
|
+
export { default as SignedInWrapper } from './Authorization/SignedInWrapper.js';
|
|
40
|
+
export { default as PreventGuestWrapper } from './Authorization/PreventGuestWrapper.js';
|
|
41
|
+
export { default as RedirectionContent } from './Authorization/RedirectionContent.js';
|
|
42
|
+
export { UserSwitch } from './UserSwitch/UserSwitch.js';
|
|
43
|
+
export { UserSwitchWrapper } from './UserSwitch/UserSwitchWrapper.js';
|
|
44
|
+
export { default as CustomInitialLoader } from './CustomInitialLoader/CustomInitialLoader.js';
|
|
45
|
+
export { default as Select } from './Select/Select.js';
|
|
46
|
+
export { default as ItemSkeleton } from './items/ItemSkeleton/ItemSkeleton.js';
|
|
47
|
+
export { default as SearchInput } from './SearchInput/SearchInput.js';
|
|
48
|
+
export * from './SearchInput/SearchInput.js';
|
|
49
|
+
export { default as PlatformSwitch } from './PlatformSwitch/PlatformSwitch.js';
|
|
50
|
+
export * from './PlatformSwitch/PlatformSwitch.js';
|
|
51
|
+
export * from './PlatformSwitch/hooks.js';
|
|
52
|
+
export { default as FileDropper, } from './upload/FileDropper/FileDropper.js';
|
|
53
|
+
export { default as UploadFileButton, } from './upload/UploadFileButton/UploadFileButton.js';
|
|
54
|
+
export { default as RowMenu } from './Tree/RowMenu.js';
|
|
55
|
+
export { default as RowMenus } from './Tree/RowMenus.js';
|
|
56
|
+
export { default as Breadcrumbs, } from './Tree/Breadcrumbs.js';
|
|
57
|
+
export * from './ThemeContext/ThemeContext.js';
|
|
58
|
+
export * from './types.js';
|
|
59
|
+
export { default as DraggingWrapper } from './draggable/DraggingWrapper.js';
|
|
60
|
+
export * from './draggable/types.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ForbiddenContentProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Id to put on the root component
|
|
4
|
+
*/
|
|
5
|
+
id?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Id of the current member used to display the authenticated alternative
|
|
8
|
+
*/
|
|
9
|
+
memberId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Title to display
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Text to display if the member is authenticated (logged-in)
|
|
16
|
+
*/
|
|
17
|
+
authenticatedText?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const ForbiddenContent: ({ id, memberId, title, authenticatedText, }: ForbiddenContentProps) => JSX.Element;
|
|
20
|
+
export default ForbiddenContent;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ForbiddenText from './ForbiddenText.js';
|
|
3
|
+
const ForbiddenContent = ({ id, memberId, title, authenticatedText, }) => (_jsx(ForbiddenText, { id: id, title: title, helperText: memberId ? authenticatedText : undefined }));
|
|
4
|
+
export default ForbiddenContent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BanIcon } from 'lucide-react';
|
|
3
|
+
import { Stack, Typography } from '@mui/material';
|
|
4
|
+
import { FORBIDDEN_TEXT } from './constants.js';
|
|
5
|
+
const ForbiddenText = ({ id, title = FORBIDDEN_TEXT, helperText, }) => (_jsxs(Stack, { id: id, direction: 'row', alignItems: 'center', justifyContent: 'center', spacing: 2, children: [_jsx(BanIcon, { fontSize: '4em' }), _jsxs(Stack, { direction: 'column', children: [_jsx(Typography, { variant: 'h4', children: title }), _jsx(Typography, { color: 'text.secondary', maxWidth: '50ch', children: helperText })] })] }));
|
|
6
|
+
export default ForbiddenText;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ItemLoginSchemaType, UUID } from '@lnco-ai/sdk';
|
|
3
|
+
export type SignInPropertiesType = {
|
|
4
|
+
memberId?: string;
|
|
5
|
+
username?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ItemLoginScreenProps = {
|
|
9
|
+
itemId: UUID;
|
|
10
|
+
/**
|
|
11
|
+
* item login schema object
|
|
12
|
+
*/
|
|
13
|
+
itemLoginSchemaType?: ItemLoginSchemaType;
|
|
14
|
+
signIn: (args: {
|
|
15
|
+
itemId: string;
|
|
16
|
+
} & SignInPropertiesType) => void;
|
|
17
|
+
/**
|
|
18
|
+
* content to display when the user doesn't have access
|
|
19
|
+
*/
|
|
20
|
+
ForbiddenContent?: ReactElement;
|
|
21
|
+
passwordInputId?: string;
|
|
22
|
+
signInButtonId?: string;
|
|
23
|
+
usernameInputId?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const ItemLoginScreen: ({ ForbiddenContent, itemId, itemLoginSchemaType, passwordInputId, signIn, signInButtonId, usernameInputId, }: ItemLoginScreenProps) => JSX.Element;
|
|
26
|
+
export default ItemLoginScreen;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Container, Stack, TextField, styled } from '@mui/material';
|
|
3
|
+
import { useRef, useState, } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { ItemLoginSchemaType } from '@lnco-ai/sdk';
|
|
6
|
+
import Button from '../buttons/Button/Button.js';
|
|
7
|
+
import ForbiddenText from './ForbiddenText.js';
|
|
8
|
+
const WrapperContainer = styled(Container)({
|
|
9
|
+
margin: 'auto',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
textAlign: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
height: '100%',
|
|
15
|
+
});
|
|
16
|
+
const StyledTextField = styled(TextField)(({ theme }) => ({
|
|
17
|
+
margin: theme.spacing(1, 0),
|
|
18
|
+
}));
|
|
19
|
+
const ItemLoginScreen = ({ ForbiddenContent = _jsx(ForbiddenText, {}), itemId, itemLoginSchemaType, passwordInputId, signIn, signInButtonId, usernameInputId, }) => {
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const passwordFieldRef = useRef(null);
|
|
22
|
+
const [password, setPassword] = useState('');
|
|
23
|
+
const [username, setUsername] = useState('');
|
|
24
|
+
// no item login detected
|
|
25
|
+
if (!itemLoginSchemaType ||
|
|
26
|
+
!Object.values(ItemLoginSchemaType).includes(itemLoginSchemaType)) {
|
|
27
|
+
return ForbiddenContent;
|
|
28
|
+
}
|
|
29
|
+
const withPassword = [ItemLoginSchemaType.UsernameAndPassword].includes(itemLoginSchemaType);
|
|
30
|
+
const onClickSignIn = () => {
|
|
31
|
+
const signInProperties = { username };
|
|
32
|
+
if (withPassword) {
|
|
33
|
+
signInProperties.password = password;
|
|
34
|
+
}
|
|
35
|
+
signIn({ itemId, ...signInProperties });
|
|
36
|
+
};
|
|
37
|
+
const onPasswordChange = (e) => {
|
|
38
|
+
setPassword(e.target.value);
|
|
39
|
+
};
|
|
40
|
+
const onUsernameChange = (e) => {
|
|
41
|
+
setUsername(e.target.value);
|
|
42
|
+
};
|
|
43
|
+
const handlePressEnter = (e) => {
|
|
44
|
+
if (e.key === 'Enter') {
|
|
45
|
+
onClickSignIn();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const handleUsernamePressEnter = (e) => {
|
|
49
|
+
if (e.key === 'Enter') {
|
|
50
|
+
if (withPassword) {
|
|
51
|
+
console.log(passwordFieldRef.current);
|
|
52
|
+
// focus next field
|
|
53
|
+
passwordFieldRef.current?.focus();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// single field, send the login
|
|
57
|
+
onClickSignIn();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const shouldSignInBeDisabled = () => {
|
|
62
|
+
const usernameError = !username?.length;
|
|
63
|
+
const passwordError = withPassword && !password?.length;
|
|
64
|
+
return usernameError || passwordError;
|
|
65
|
+
};
|
|
66
|
+
// validation for the username is length between 3 and 50 chars
|
|
67
|
+
const error = Boolean(username) && (username.length < 3 || username.length > 50);
|
|
68
|
+
return (_jsxs(WrapperContainer, { maxWidth: 'xs', children: [_jsx(Stack, { alignItems: 'center', children: _jsx(StyledTextField, { error: error, autoFocus: true, onChange: onUsernameChange, label: t('Pseudonym'), color: 'primary', variant: 'outlined', fullWidth: true, type: 'text', id: usernameInputId, value: username, onKeyDown: handleUsernamePressEnter }) }), withPassword && (_jsx(StyledTextField, { onChange: onPasswordChange, label: t('Password'), value: password, type: 'password', color: 'primary', variant: 'outlined', id: passwordInputId, onKeyDown: handlePressEnter,
|
|
69
|
+
// used to set focus when first field is filled
|
|
70
|
+
inputRef: passwordFieldRef })), _jsx(Button, { onClick: onClickSignIn, id: signInButtonId, disabled: shouldSignInBeDisabled(), children: t('Sign In') })] }));
|
|
71
|
+
};
|
|
72
|
+
export default ItemLoginScreen;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { CurrentAccount, DiscriminatedItem, ItemLoginSchemaType, UUID } from '@lnco-ai/sdk';
|
|
3
|
+
import { SignInPropertiesType } from './ItemLoginScreen.js';
|
|
4
|
+
export type ItemLoginAuthorizationProps = {
|
|
5
|
+
signIn: (args: {
|
|
6
|
+
itemId: string;
|
|
7
|
+
} & SignInPropertiesType) => void;
|
|
8
|
+
itemId: UUID;
|
|
9
|
+
itemErrorStatusCode: number | null;
|
|
10
|
+
currentAccount?: CurrentAccount | null;
|
|
11
|
+
item?: DiscriminatedItem;
|
|
12
|
+
itemLoginSchemaType?: ItemLoginSchemaType;
|
|
13
|
+
usernameInputId?: string;
|
|
14
|
+
signInButtonId?: string;
|
|
15
|
+
passwordInputId?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
forbiddenContent?: ReactElement;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
enrollContent?: ReactElement;
|
|
20
|
+
requestAccessContent?: ReactElement;
|
|
21
|
+
};
|
|
22
|
+
declare const ItemLoginAuthorization: ({ currentAccount, item, itemErrorStatusCode, itemLoginSchemaType, itemId, signIn, isLoading, usernameInputId, signInButtonId, passwordInputId, forbiddenContent, enrollContent, requestAccessContent, children, }: ItemLoginAuthorizationProps) => ReactNode;
|
|
23
|
+
export default ItemLoginAuthorization;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StatusCodes } from 'http-status-codes';
|
|
3
|
+
import { AccountType, } from '@lnco-ai/sdk';
|
|
4
|
+
import CustomInitialLoader from '../CustomInitialLoader/CustomInitialLoader.js';
|
|
5
|
+
import ForbiddenText from './ForbiddenText.js';
|
|
6
|
+
import ItemLoginScreen from './ItemLoginScreen.js';
|
|
7
|
+
const ItemLoginAuthorization = ({ currentAccount, item, itemErrorStatusCode, itemLoginSchemaType, itemId, signIn, isLoading, usernameInputId, signInButtonId, passwordInputId, forbiddenContent = _jsx(ForbiddenText, {}), enrollContent, requestAccessContent, children, }) => {
|
|
8
|
+
if (isLoading) {
|
|
9
|
+
return _jsx(CustomInitialLoader, {});
|
|
10
|
+
}
|
|
11
|
+
// the item could be fetched without errors
|
|
12
|
+
// because the user is signed in and has access
|
|
13
|
+
// or because the item is public
|
|
14
|
+
if (item && item.id) {
|
|
15
|
+
return children;
|
|
16
|
+
}
|
|
17
|
+
if (currentAccount) {
|
|
18
|
+
if (currentAccount.type === AccountType.Individual) {
|
|
19
|
+
// user is logged in and item login enabled - request automatic membership
|
|
20
|
+
if (itemLoginSchemaType) {
|
|
21
|
+
return enrollContent ?? forbiddenContent;
|
|
22
|
+
}
|
|
23
|
+
// user is logged in and item login disabled
|
|
24
|
+
// cannot access to item - request access
|
|
25
|
+
if (itemErrorStatusCode === StatusCodes.FORBIDDEN) {
|
|
26
|
+
return requestAccessContent ?? forbiddenContent;
|
|
27
|
+
}
|
|
28
|
+
// any other error return forbidden message
|
|
29
|
+
return forbiddenContent;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return forbiddenContent;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// signed out but can sign in with item login
|
|
36
|
+
if (itemLoginSchemaType) {
|
|
37
|
+
return (_jsx(ItemLoginScreen, { itemId: itemId, signIn: signIn, itemLoginSchemaType: itemLoginSchemaType, usernameInputId: usernameInputId, signInButtonId: signInButtonId, passwordInputId: passwordInputId }));
|
|
38
|
+
}
|
|
39
|
+
// either the item does not allow item login
|
|
40
|
+
// or the user is already signed in as normal user and hasn't the access to this item
|
|
41
|
+
return forbiddenContent;
|
|
42
|
+
};
|
|
43
|
+
export default ItemLoginAuthorization;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FORBIDDEN_TEXT = "You cannot access this item";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FORBIDDEN_TEXT = 'You cannot access this item';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AppItemType, Member } from '@lnco-ai/sdk';
|
|
2
|
+
import { ContextPayload, Token } from './appItemHooks.js';
|
|
3
|
+
/**
|
|
4
|
+
* This query param is added to the fetched url to fix an issue where the browser
|
|
5
|
+
* is able to aggressively cache the `index.html` file for the app.
|
|
6
|
+
* This aggressive caching behavior is an issue as when apps get updated, the index.html file
|
|
7
|
+
* changes but the browser has an old version of it, and tries to fetch javascript and assets that are out of date
|
|
8
|
+
* resulting in the app not being able to load.
|
|
9
|
+
*
|
|
10
|
+
* This could be also fixed by not overriding the `index.html` file when releasing a new app version
|
|
11
|
+
* and simply pushing it to another subpath than `/latest/`. In this case the agressive caching behavior would not be a problem.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CURRENT_TIMESTAMP_QUERY_PARAM = "ts";
|
|
14
|
+
type AppItemProps = {
|
|
15
|
+
/**
|
|
16
|
+
* corresponding item of the app
|
|
17
|
+
*/
|
|
18
|
+
item: AppItemType;
|
|
19
|
+
/**
|
|
20
|
+
* function to fetch the app token
|
|
21
|
+
*/
|
|
22
|
+
requestApiAccessToken: (args: {
|
|
23
|
+
id: string;
|
|
24
|
+
key: string;
|
|
25
|
+
origin: string;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
token: Token;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* context passed to the app
|
|
31
|
+
*/
|
|
32
|
+
contextPayload: ContextPayload;
|
|
33
|
+
/**
|
|
34
|
+
* app height
|
|
35
|
+
*/
|
|
36
|
+
height?: number | string;
|
|
37
|
+
/**
|
|
38
|
+
* id prop passed to the iframe
|
|
39
|
+
*/
|
|
40
|
+
frameId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether manual resize is enabled (as opposed to automatic resize, default)
|
|
43
|
+
*/
|
|
44
|
+
isResizable?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* id of the member currently signed in
|
|
47
|
+
*/
|
|
48
|
+
memberId?: Member['id'];
|
|
49
|
+
/**
|
|
50
|
+
* Whether the caption is shown
|
|
51
|
+
*/
|
|
52
|
+
showCaption?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the item should be shown in a collapsible element
|
|
55
|
+
*/
|
|
56
|
+
showCollapse?: boolean;
|
|
57
|
+
onCollapse?: (c: boolean) => void;
|
|
58
|
+
};
|
|
59
|
+
declare const _default: import("react").MemoExoticComponent<({ item, contextPayload, requestApiAccessToken, height, frameId, memberId, isResizable, showCaption, showCollapse, onCollapse, }: AppItemProps) => JSX.Element>;
|
|
60
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton, styled } from '@mui/material';
|
|
3
|
+
import { memo, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { appendQueryParamToUrl, getAppExtra, } from '@lnco-ai/sdk';
|
|
5
|
+
import withCollapse from '../Collapse/withCollapse.js';
|
|
6
|
+
import { SCREEN_MAX_HEIGHT } from '../constants.js';
|
|
7
|
+
import { useAppCommunication } from './appItemHooks.js';
|
|
8
|
+
import { iframeCommonStyles } from './iframeStyles.js';
|
|
9
|
+
import withCaption from './withCaption.js';
|
|
10
|
+
import withResizing from './withResizing.js';
|
|
11
|
+
const AppIFrame = styled('iframe')(({ isResizable }) => ({
|
|
12
|
+
...iframeCommonStyles,
|
|
13
|
+
/**
|
|
14
|
+
* IMPORTANT to not override the height when using dynamic sizing
|
|
15
|
+
* The present styles are applied with higher specificity, so the dynamic height
|
|
16
|
+
* provided by the app using the resizing mechanism is ignored.
|
|
17
|
+
*/
|
|
18
|
+
height: !isResizable ? undefined : '100%',
|
|
19
|
+
}));
|
|
20
|
+
const DEFAULT_APP_HEIGHT = 400;
|
|
21
|
+
const APP_ITEM_WIDTH = '100%';
|
|
22
|
+
/**
|
|
23
|
+
* This query param is added to the fetched url to fix an issue where the browser
|
|
24
|
+
* is able to aggressively cache the `index.html` file for the app.
|
|
25
|
+
* This aggressive caching behavior is an issue as when apps get updated, the index.html file
|
|
26
|
+
* changes but the browser has an old version of it, and tries to fetch javascript and assets that are out of date
|
|
27
|
+
* resulting in the app not being able to load.
|
|
28
|
+
*
|
|
29
|
+
* This could be also fixed by not overriding the `index.html` file when releasing a new app version
|
|
30
|
+
* and simply pushing it to another subpath than `/latest/`. In this case the agressive caching behavior would not be a problem.
|
|
31
|
+
*/
|
|
32
|
+
export const CURRENT_TIMESTAMP_QUERY_PARAM = 'ts';
|
|
33
|
+
const AppItem = ({ item, contextPayload, requestApiAccessToken, height = DEFAULT_APP_HEIGHT, frameId, memberId, isResizable = false, showCaption = true, showCollapse = false, onCollapse, }) => {
|
|
34
|
+
// state
|
|
35
|
+
const [isIFrameLoading, setIsIFrameLoading] = useState(true);
|
|
36
|
+
const iFrameRef = useRef(null);
|
|
37
|
+
const appUrl = getAppExtra(item.extra)?.url || '';
|
|
38
|
+
useAppCommunication({
|
|
39
|
+
item,
|
|
40
|
+
appUrl,
|
|
41
|
+
iFrameRef,
|
|
42
|
+
contextPayload,
|
|
43
|
+
requestApiAccessToken,
|
|
44
|
+
});
|
|
45
|
+
const onLoad = () => setIsIFrameLoading(false);
|
|
46
|
+
const appUrlWithQuery = useMemo(() => appendQueryParamToUrl(appUrl, {
|
|
47
|
+
itemId: item.id,
|
|
48
|
+
// this ensures that the index.html can not be aggressively cached by the browser
|
|
49
|
+
[CURRENT_TIMESTAMP_QUERY_PARAM]: Date.now().toString(),
|
|
50
|
+
}), [item]);
|
|
51
|
+
const iframe = (_jsx(AppIFrame, { "data-testid": frameId, id: frameId, ref: iFrameRef, isResizable: isResizable, onLoad: onLoad, src: appUrlWithQuery, sx: { visibility: isIFrameLoading ? 'hidden' : 'visible' }, title: item?.name, width: APP_ITEM_WIDTH, allow: 'fullscreen; serial; microphone' }));
|
|
52
|
+
const ResizableIframe = withResizing({
|
|
53
|
+
height,
|
|
54
|
+
memberId: memberId,
|
|
55
|
+
itemId: item.id,
|
|
56
|
+
component: iframe,
|
|
57
|
+
});
|
|
58
|
+
let component = (_jsxs(_Fragment, { children: [isIFrameLoading && (_jsx(Skeleton, { variant: 'rectangular', width: '100%', height: SCREEN_MAX_HEIGHT })), isResizable ? _jsx(ResizableIframe, {}) : iframe] }));
|
|
59
|
+
if (showCaption) {
|
|
60
|
+
component = withCaption({
|
|
61
|
+
item,
|
|
62
|
+
})(component);
|
|
63
|
+
}
|
|
64
|
+
if (showCollapse) {
|
|
65
|
+
component = withCollapse({ item, onCollapse })(component);
|
|
66
|
+
}
|
|
67
|
+
return component;
|
|
68
|
+
};
|
|
69
|
+
export default memo(AppItem);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DocumentItemType } from '@lnco-ai/sdk';
|
|
2
|
+
export type DocumentItemProps = {
|
|
3
|
+
id?: string;
|
|
4
|
+
emptyMessage?: string;
|
|
5
|
+
showEmpty?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Show the item name as the Alert title
|
|
8
|
+
*/
|
|
9
|
+
showTitle?: boolean;
|
|
10
|
+
onCollapse?: (c: boolean) => void;
|
|
11
|
+
} & ({
|
|
12
|
+
showCollapse: true;
|
|
13
|
+
item: DocumentItemType;
|
|
14
|
+
} | {
|
|
15
|
+
showCollapse?: false;
|
|
16
|
+
item: Pick<DocumentItemType, 'extra' | 'name'>;
|
|
17
|
+
});
|
|
18
|
+
declare const DocumentItem: ({ id, item, emptyMessage, showEmpty, showCollapse, showTitle, onCollapse, }: DocumentItemProps) => JSX.Element;
|
|
19
|
+
export default DocumentItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import { getDocumentExtra } from '@lnco-ai/sdk';
|
|
4
|
+
import TextDisplay from '../TextDisplay/TextDisplay.js';
|
|
5
|
+
import { withFlavor } from '../TextDisplay/withFlavor.js';
|
|
6
|
+
import withCollapse from '../Collapse/withCollapse.js';
|
|
7
|
+
const DocumentItem = ({ id, item, emptyMessage = 'This document is empty…', showEmpty, showCollapse, showTitle, onCollapse, }) => {
|
|
8
|
+
let component;
|
|
9
|
+
const extra = getDocumentExtra(item.extra);
|
|
10
|
+
if (!extra?.content && showEmpty) {
|
|
11
|
+
component = (_jsx(Typography, { variant: 'body2', sx: { fontStyle: 'italic', color: 'lightgrey' }, children: emptyMessage }));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
component = withFlavor({
|
|
15
|
+
content: _jsx(TextDisplay, { id: id, content: extra?.content }),
|
|
16
|
+
flavor: extra?.flavor,
|
|
17
|
+
title: showTitle ? item?.name : undefined,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (showCollapse) {
|
|
21
|
+
component = withCollapse({ item, onCollapse })(component);
|
|
22
|
+
}
|
|
23
|
+
return component;
|
|
24
|
+
};
|
|
25
|
+
export default DocumentItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type DownloadButtonFileItemProps = {
|
|
2
|
+
id?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
caption?: string;
|
|
5
|
+
url: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const DownloadButtonFileItem: ({ id, name, caption, url, onClick, }: DownloadButtonFileItemProps) => JSX.Element;
|
|
9
|
+
export default DownloadButtonFileItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DownloadIcon, FileIcon } from 'lucide-react';
|
|
3
|
+
import { Button, Stack, Typography, styled } from '@mui/material';
|
|
4
|
+
const StyledLink = styled('a')({
|
|
5
|
+
textDecoration: 'none',
|
|
6
|
+
});
|
|
7
|
+
const DownloadButtonFileItem = ({ id, name = 'File', caption = '', url, onClick, }) => {
|
|
8
|
+
return (_jsx(StyledLink, { id: id, href: url, target: '_blank', rel: 'noreferrer', download: name, children: _jsx(Button, { size: 'large', variant: 'contained', startIcon: _jsx(FileIcon, {}), onClick: onClick, sx: { textTransform: 'none' }, children: _jsxs(Stack, { direction: 'row', gap: 4, alignItems: 'center', children: [_jsxs(Stack, { direction: 'column', alignItems: 'flex-start', children: [_jsx(Typography, { children: name }), _jsx(Typography, { variant: 'caption', children: caption })] }), _jsx(DownloadIcon, {})] }) }) }));
|
|
9
|
+
};
|
|
10
|
+
export default DownloadButtonFileItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @see https://etherpad.org/doc/v1.8.18/#index_embed-parameters
|
|
4
|
+
*/
|
|
5
|
+
type EtherpadEmbedOptions = {
|
|
6
|
+
showLineNumbers?: boolean;
|
|
7
|
+
showControls?: boolean;
|
|
8
|
+
showChat?: boolean;
|
|
9
|
+
useMonospaceFont?: boolean;
|
|
10
|
+
userName?: string;
|
|
11
|
+
userColor?: string;
|
|
12
|
+
noColors?: boolean;
|
|
13
|
+
alwaysShowChat?: boolean;
|
|
14
|
+
lang?: string;
|
|
15
|
+
rtl?: boolean;
|
|
16
|
+
'#L'?: number;
|
|
17
|
+
};
|
|
18
|
+
type EtherpadItemProps = {
|
|
19
|
+
itemId: string;
|
|
20
|
+
padUrl: string;
|
|
21
|
+
iframeId?: string;
|
|
22
|
+
options?: EtherpadEmbedOptions;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
};
|
|
25
|
+
declare const EtherpadItem: ({ itemId, padUrl, iframeId, options, style, }: EtherpadItemProps) => JSX.Element;
|
|
26
|
+
export default EtherpadItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const EtherpadItem = ({ itemId, padUrl, iframeId = `etherpad-container-${itemId}`, options, style, }) => {
|
|
3
|
+
const src = new URL(padUrl);
|
|
4
|
+
if (options) {
|
|
5
|
+
Object.entries(options).forEach(([param, value]) => src.searchParams.set(param, String(value)));
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("iframe", { id: iframeId, src: src.href, frameBorder: 0, sandbox: 'allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts allow-same-origin', style: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
height: '100%',
|
|
10
|
+
border: 'none',
|
|
11
|
+
display: 'block',
|
|
12
|
+
...style,
|
|
13
|
+
} }));
|
|
14
|
+
};
|
|
15
|
+
export default EtherpadItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from '@mui/material';
|
|
3
|
+
const FileAudio = ({ id, url, type, sx }) => {
|
|
4
|
+
const StyledAudio = styled('audio')({
|
|
5
|
+
maxWidth: '100%',
|
|
6
|
+
width: '100%',
|
|
7
|
+
});
|
|
8
|
+
return (_jsx(StyledAudio, { sx: sx, id: id, controls: true, children: _jsx("source", { src: url, type: type }) }));
|
|
9
|
+
};
|
|
10
|
+
export default FileAudio;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const FileImage = ({ id, url, alt }) => {
|
|
3
|
+
return (_jsx("img", { id: id, src: url, alt: alt, title: alt, style: {
|
|
4
|
+
// do not overflow the parent
|
|
5
|
+
maxWidth: '100%',
|
|
6
|
+
// display bigger than the original size if the parent wants it
|
|
7
|
+
width: '100%',
|
|
8
|
+
} }));
|
|
9
|
+
};
|
|
10
|
+
export default FileImage;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LocalFileItemType, S3FileItemType } from '@lnco-ai/sdk';
|
|
2
|
+
export type FileItemProps = {
|
|
3
|
+
/**
|
|
4
|
+
* blob content of the file, overridden by fileUrl
|
|
5
|
+
* */
|
|
6
|
+
content?: Blob;
|
|
7
|
+
/**
|
|
8
|
+
* url of the file, overrides content
|
|
9
|
+
* */
|
|
10
|
+
fileUrl?: string;
|
|
11
|
+
defaultItem?: JSX.Element;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
item: LocalFileItemType | S3FileItemType;
|
|
15
|
+
maxHeight?: number | string;
|
|
16
|
+
/**
|
|
17
|
+
* use a custom pdf reader from the link if defined
|
|
18
|
+
* */
|
|
19
|
+
pdfViewerLink?: string;
|
|
20
|
+
showCollapse?: boolean;
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
onCollapse?: (c: boolean) => void;
|
|
23
|
+
};
|
|
24
|
+
declare const _default: import("react").MemoExoticComponent<({ content, fileUrl, defaultItem, errorMessage, id, item, maxHeight, showCollapse, pdfViewerLink, onClick, onCollapse, }: FileItemProps) => JSX.Element>;
|
|
25
|
+
export default _default;
|