@integry/sdk 4.7.39 → 4.7.41
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/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +6 -1
- package/.eslintignore +0 -1
- package/.vscode/launch.json +0 -17
- package/CHANGELOG_INTERNAL.md +0 -134
- package/README_INTERNAL.md +0 -176
- package/THIRD_PARTY_LICENSES +0 -525
- package/generateTests.js +0 -80
- package/jest.config.cjs +0 -10
- package/src/components/AddTagButton/index.ts +0 -23
- package/src/components/BasicSelect/index.ts +0 -123
- package/src/components/BasicSelect/styles.module.scss +0 -44
- package/src/components/Button/index.ts +0 -97
- package/src/components/Button/styles.module.scss +0 -152
- package/src/components/CheckboxGroup/Checkbox.ts +0 -104
- package/src/components/CheckboxGroup/index.ts +0 -190
- package/src/components/CheckboxGroup/styles.module.scss +0 -63
- package/src/components/CollapsedMenu/index.ts +0 -104
- package/src/components/CollapsedMenu/styles.module.scss +0 -46
- package/src/components/ConfigureFieldWrapper/index.ts +0 -85
- package/src/components/ConfigureFieldWrapper/styles.module.scss +0 -57
- package/src/components/EditableText/index.ts +0 -121
- package/src/components/EditableText/styles.module.scss +0 -38
- package/src/components/EditableTextArea/index.ts +0 -143
- package/src/components/EditableTextArea/styles.module.scss +0 -91
- package/src/components/ErrorMessage/index.ts +0 -16
- package/src/components/ErrorMessage/styles.module.scss +0 -19
- package/src/components/ErrorPage/index.ts +0 -42
- package/src/components/ErrorPage/styles.module.scss +0 -26
- package/src/components/Footer/index.ts +0 -41
- package/src/components/Footer/styles.module.scss +0 -40
- package/src/components/HTMLContent/index.tsx +0 -205
- package/src/components/HTMLContent/styles.module.scss +0 -3
- package/src/components/InfoBox/index.ts +0 -48
- package/src/components/InfoBox/styles.module.scss +0 -21
- package/src/components/Input/BaseInput/index.ts +0 -170
- package/src/components/Input/BaseInput/styles.module.scss +0 -95
- package/src/components/Input/DateInput/index.ts +0 -103
- package/src/components/Input/DateInput/styles.module.scss +0 -50
- package/src/components/Input/Input/index.ts +0 -225
- package/src/components/Input/Input/styles.module.scss +0 -16
- package/src/components/Input/PasswordInput/index.ts +0 -164
- package/src/components/Input/PasswordInput/styles.module.scss +0 -37
- package/src/components/Input/index.ts +0 -7
- package/src/components/Label/index.ts +0 -61
- package/src/components/Label/styles.module.scss +0 -41
- package/src/components/LargeLoader/index.ts +0 -25
- package/src/components/LargeLoader/styles.module.scss +0 -16
- package/src/components/Listbox/ListBoxItem.ts +0 -57
- package/src/components/Listbox/index.ts +0 -488
- package/src/components/Listbox/styles.module.scss +0 -197
- package/src/components/Loader/index.ts +0 -25
- package/src/components/Loader/styles.module.scss +0 -16
- package/src/components/MediaGallery/MediaGalleryModal.ts +0 -82
- package/src/components/MediaGallery/MediaSlider.ts +0 -76
- package/src/components/MediaGallery/index.ts +0 -92
- package/src/components/MediaGallery/styles.module.scss +0 -156
- package/src/components/MediaUpload/index.ts +0 -233
- package/src/components/MediaUpload/styles.module.scss +0 -118
- package/src/components/Modal/index.ts +0 -87
- package/src/components/Modal/styles.module.scss +0 -441
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +0 -59
- package/src/components/MultipurposeField/Dropdown/index.tsx +0 -1202
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +0 -215
- package/src/components/MultipurposeField/TagMenu/index.ts +0 -536
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +0 -175
- package/src/components/MultipurposeField/TagOptions/index.tsx +0 -83
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +0 -95
- package/src/components/MultipurposeField/index.tsx +0 -944
- package/src/components/MultipurposeField/styles.module.scss +0 -77
- package/src/components/NewModal/index.ts +0 -69
- package/src/components/NewModal/styles.module.scss +0 -70
- package/src/components/OverflowTooltip/index.tsx +0 -59
- package/src/components/PopUp/ConfirmationPopUp/index.ts +0 -58
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +0 -49
- package/src/components/PopUp/SuccessPopUp/index.ts +0 -62
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +0 -38
- package/src/components/RadioGroup/Radio.ts +0 -128
- package/src/components/RadioGroup/index.ts +0 -169
- package/src/components/RadioGroup/styles.module.scss +0 -81
- package/src/components/Search/index.ts +0 -69
- package/src/components/Search/styles.module.scss +0 -149
- package/src/components/TabBar/Tab.ts +0 -33
- package/src/components/TabBar/index.ts +0 -64
- package/src/components/TabBar/styles.module.scss +0 -43
- package/src/components/Tag/index.ts +0 -29
- package/src/components/Tag/styles.module.scss +0 -57
- package/src/components/TagsMenu/index.ts +0 -1697
- package/src/components/TagsMenu/styles.module.scss +0 -350
- package/src/components/TestComponent/index.ts +0 -71
- package/src/components/TestComponent/styles.module.scss +0 -152
- package/src/components/TextArea/index.ts +0 -172
- package/src/components/TextArea/styles.module.scss +0 -72
- package/src/components/TextContent/index.tsx +0 -128
- package/src/components/TextContent/styles.module.scss +0 -6
- package/src/components/ThreeDotLoader/index.ts +0 -39
- package/src/components/ThreeDotLoader/styles.module.scss +0 -41
- package/src/components/TimeInput/index.ts +0 -129
- package/src/components/TimeInput/styles.module.scss +0 -16
- package/src/components/Toggle/index.ts +0 -34
- package/src/components/Toggle/styles.module.scss +0 -56
- package/src/components/Toggle-v2/index.ts +0 -40
- package/src/components/Toggle-v2/styles.module.scss +0 -86
- package/src/components/Tooltip/index.ts +0 -271
- package/src/components/Tooltip/styles.module.scss +0 -105
- package/src/components/form/FunctionField/index.ts +0 -816
- package/src/components/form/FunctionField/styles.module.scss +0 -478
- package/src/components/form/ObjectField/__snapshots__/index.ts.test.tsx.snap +0 -3
- package/src/components/form/ObjectField/index.ts +0 -593
- package/src/components/form/ObjectField/index.ts.test.tsx +0 -213
- package/src/components/form/ObjectField/styles.module.scss +0 -103
- package/src/components/form/index.ts +0 -4
- package/src/contexts/AppContext.ts +0 -12
- package/src/declaration.d.ts +0 -7
- package/src/extensions/HMAC.ts +0 -25
- package/src/extensions/IntegryAPIError.ts +0 -19
- package/src/features/common/AccountDropdown/index.ts +0 -291
- package/src/features/common/AccountDropdown/styles.module.scss +0 -19
- package/src/features/common/ActionForm/index.ts +0 -2602
- package/src/features/common/ActionForm/styles.module.scss +0 -35
- package/src/features/common/AppCard/index.ts +0 -207
- package/src/features/common/AppCard/styles.module.scss +0 -117
- package/src/features/common/AppCardCompact/index.ts +0 -189
- package/src/features/common/AppCardCompact/styles.module.scss +0 -141
- package/src/features/common/AuthSelector/index.ts +0 -537
- package/src/features/common/AuthSelector/styles.module.scss +0 -161
- package/src/features/common/AuthSelectorCompact/index.ts +0 -706
- package/src/features/common/AuthSelectorCompact/styles.module.scss +0 -219
- package/src/features/common/AuthSelectorDropdown/index.ts +0 -704
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +0 -361
- package/src/features/common/AuthSelectorV2/index.ts +0 -336
- package/src/features/common/AuthSelectorV2/styles.module.scss +0 -235
- package/src/features/common/DynamicField/index.ts +0 -402
- package/src/features/common/DynamicField/styles.module.scss +0 -266
- package/src/features/common/DynamicTypedField/index.ts +0 -504
- package/src/features/common/DynamicTypedField/styles.module.scss +0 -135
- package/src/features/common/FunctionForm/index.ts +0 -1095
- package/src/features/common/FunctionForm/styles.module.scss +0 -225
- package/src/features/common/MappingUI/index.ts +0 -649
- package/src/features/common/MappingUI/styles.module.scss +0 -121
- package/src/features/common/MarketplaceAppCard/index.ts +0 -279
- package/src/features/common/MarketplaceAppCard/styles.module.scss +0 -231
- package/src/features/common/MarketplaceAppCardCompact/index.ts +0 -283
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +0 -255
- package/src/features/common/NewMappingUI/index.ts +0 -515
- package/src/features/common/NewMappingUI/styles.module.scss +0 -113
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +0 -67
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +0 -23
- package/src/features/common/RequestAppWidget/index.ts +0 -48
- package/src/features/common/RequestAppWidget/request-app-form.ts +0 -89
- package/src/features/common/RequestAppWidget/styles.module.scss +0 -43
- package/src/features/common/SectionField/index.ts +0 -272
- package/src/features/common/SectionField/styles.module.scss +0 -67
- package/src/features/common/Step/index.ts +0 -827
- package/src/features/common/Step/styles.module.scss +0 -12
- package/src/features/common/StepNavigation/CollapsedSteps.ts +0 -131
- package/src/features/common/StepNavigation/NavItem.ts +0 -111
- package/src/features/common/StepNavigation/index.ts +0 -261
- package/src/features/common/StepNavigation/styles.module.scss +0 -117
- package/src/features/common/Steps/index.ts +0 -1140
- package/src/features/common/Steps/styles.module.scss +0 -314
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +0 -404
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +0 -367
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.test.tsx +0 -58
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +0 -208
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.test.tsx +0 -49
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +0 -421
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +0 -577
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +0 -83
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +0 -233
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +0 -45
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +0 -1085
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +0 -465
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +0 -610
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +0 -468
- package/src/features/containers/AppFlowContainer/index.ts +0 -114
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +0 -262
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +0 -120
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +0 -165
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +0 -81
- package/src/features/containers/AppPageContainer/index.tsx +0 -93
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +0 -161
- package/src/features/containers/AppsForFlows/styles.module.scss +0 -280
- package/src/features/containers/AppsForFlowsCompact/index.ts +0 -161
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +0 -279
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +0 -73
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +0 -67
- package/src/features/containers/AuthSetupContainer/Footer.ts +0 -32
- package/src/features/containers/AuthSetupContainer/Header.ts +0 -39
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +0 -27
- package/src/features/containers/AuthSetupContainer/index.ts +0 -349
- package/src/features/containers/AuthSetupContainer/styles.module.scss +0 -229
- package/src/features/containers/FlowSetupContainer/index.ts +0 -391
- package/src/features/containers/FlowSetupContainer/styles.module.scss +0 -18
- package/src/features/containers/MarkeplaceApps/index.ts +0 -583
- package/src/features/containers/MarkeplaceApps/styles.module.scss +0 -558
- package/src/features/containers/MarketplaceAppsCompact/index.ts +0 -585
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +0 -563
- package/src/features/containers/MarketplaceAppsContainer/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +0 -66
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +0 -34
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +0 -10
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +0 -132
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +0 -117
- package/src/features/containers/MarketplaceContainer/index.ts +0 -242
- package/src/features/containers/MarketplaceContainer/styles.module.scss +0 -84
- package/src/features/containers/SDKContainer/index.ts +0 -817
- package/src/features/containers/SDKContainer/styles.module.scss +0 -266
- package/src/features/containers/SDKDebugContainer/index.ts +0 -137
- package/src/features/containers/SDKDebugContainer/styles.module.scss +0 -37
- package/src/features/containers/SDKFailedContainer/index.ts +0 -117
- package/src/features/containers/SDKFailedContainer/styles.module.scss +0 -57
- package/src/features/integrations/IntegrationRow/Icons.ts +0 -77
- package/src/features/integrations/IntegrationRow/index.ts +0 -129
- package/src/features/integrations/IntegrationRow/styles.module.scss +0 -62
- package/src/features/integrations/IntegrationsHeader/index.ts +0 -34
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +0 -47
- package/src/features/integrations/IntegrationsList/index.ts +0 -252
- package/src/features/integrations/IntegrationsList/styles.module.scss +0 -67
- package/src/features/templates/Template/index.ts +0 -295
- package/src/features/templates/Template/styles.module.scss +0 -226
- package/src/features/templates/TemplatesView/index.ts +0 -368
- package/src/features/templates/TemplatesView/styles.module.scss +0 -71
- package/src/features/templates/TemplatesViewCompact/index.ts +0 -364
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +0 -141
- package/src/hooks/useAutosizeTextArea.ts +0 -22
- package/src/hooks/useCustomRef.ts +0 -13
- package/src/hooks/useDebounce.ts +0 -17
- package/src/hooks/useElementResize.ts +0 -40
- package/src/hooks/useEventListener.ts +0 -42
- package/src/hooks/useHover.ts +0 -40
- package/src/hooks/useOnClickOutside.ts +0 -32
- package/src/index.ts +0 -2244
- package/src/index.umd.ts +0 -13
- package/src/interfaces/index.ts +0 -938
- package/src/modules/api/index.ts +0 -1325
- package/src/modules/api/responseHandler.ts +0 -38
- package/src/modules/event-emitter/index.ts +0 -72
- package/src/modules/event-emitter/runners/abstract.ts +0 -21
- package/src/modules/event-emitter/runners/default.ts +0 -11
- package/src/modules/event-emitter/runners/ntimes.ts +0 -28
- package/src/modules/event-emitter/types.ts +0 -34
- package/src/store/actionFunctions.ts +0 -1578
- package/src/store/index.ts +0 -17
- package/src/store/initialState.ts +0 -58
- package/src/types/index.ts +0 -320
- package/src/types/preact-compat.d.ts +0 -4
- package/src/types/store.ts +0 -366
- package/src/types/utils.ts +0 -19
- package/src/utils/ActivityOutputUtils.ts +0 -176
- package/src/utils/common.ts +0 -20
- package/src/utils/copyToClipboard.ts +0 -24
- package/src/utils/datetime.ts +0 -101
- package/src/utils/getUrlParam.ts +0 -11
- package/src/utils/isAuthMessage.ts +0 -16
- package/src/utils/isBrowser.ts +0 -1
- package/src/utils/jsonEncodeDecode.ts +0 -15
- package/src/utils/objectUtils.ts +0 -117
- package/src/utils/popup.ts +0 -30
- package/src/utils/searchJson.ts +0 -51
- package/src/utils/stepUtils.ts +0 -45
- package/src/utils/truncate.ts +0 -6
- package/test/setup.ts +0 -1
- package/vitest.config.ts +0 -16
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.loader {
|
|
2
|
-
animation-name: ckw;
|
|
3
|
-
animation-duration: 1s;
|
|
4
|
-
animation-iteration-count: infinite;
|
|
5
|
-
animation-timing-function: linear;
|
|
6
|
-
transform-origin: 50% 50%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
@keyframes ckw {
|
|
10
|
-
0% {
|
|
11
|
-
transform: rotate(0deg);
|
|
12
|
-
}
|
|
13
|
-
100% {
|
|
14
|
-
transform: rotate(360deg);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable no-use-before-define */
|
|
3
|
-
import { html } from 'htm/preact';
|
|
4
|
-
import { useState } from 'preact/hooks';
|
|
5
|
-
import { MediaObject } from '@/interfaces';
|
|
6
|
-
import { Modal } from '../Modal';
|
|
7
|
-
import styles from './styles.module.scss';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
interface MediaGalleryModalProps {
|
|
11
|
-
media: MediaObject[];
|
|
12
|
-
showGallery?: boolean;
|
|
13
|
-
onClose: () => void;
|
|
14
|
-
defaultActiveIndex?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const MediaGalleryModal = (props: MediaGalleryModalProps) => {
|
|
18
|
-
const {
|
|
19
|
-
media,
|
|
20
|
-
showGallery = false,
|
|
21
|
-
onClose,
|
|
22
|
-
defaultActiveIndex = 0,
|
|
23
|
-
} = props;
|
|
24
|
-
const [activeMediaIndex, setActiveMediaIndex] = useState(defaultActiveIndex);
|
|
25
|
-
|
|
26
|
-
const currentMedia = media[activeMediaIndex];
|
|
27
|
-
|
|
28
|
-
const handleCloseGallery = (): void => {
|
|
29
|
-
if (onClose) {
|
|
30
|
-
onClose();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const prevMedia = (): void => {
|
|
35
|
-
setActiveMediaIndex((prevIndex) => {
|
|
36
|
-
if (prevIndex === 0) {
|
|
37
|
-
return media.length - 1;
|
|
38
|
-
}
|
|
39
|
-
return prevIndex - 1;
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const nextMedia = (): void => {
|
|
44
|
-
setActiveMediaIndex((prevIndex) => {
|
|
45
|
-
if (prevIndex === media.length - 1) {
|
|
46
|
-
return 0;
|
|
47
|
-
}
|
|
48
|
-
return prevIndex + 1;
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return html`
|
|
53
|
-
<${Modal}
|
|
54
|
-
isOpen=${showGallery}
|
|
55
|
-
onClose=${handleCloseGallery}
|
|
56
|
-
className="media-gallery-modal"
|
|
57
|
-
>
|
|
58
|
-
<div class="${styles.modalSetup} ${'integry-container__media-gallery-modal'}">
|
|
59
|
-
<div class="${styles.modalContentWrap}">
|
|
60
|
-
<div class="${styles.mediaGalleryModal}">
|
|
61
|
-
<div class="${styles.galleryContent}">
|
|
62
|
-
<a class="${styles.prev}" onclick=${prevMedia}>
|
|
63
|
-
<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
64
|
-
<path d="M5.78906 11.5176L0.789062 6.51758L5.78906 1.51758" stroke="#4250F0" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
65
|
-
</svg>
|
|
66
|
-
</a>
|
|
67
|
-
<img src=${currentMedia.url} class="${styles.mediaImage}" />
|
|
68
|
-
<a class="${styles.next}" onclick=${nextMedia}>
|
|
69
|
-
<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
70
|
-
<path d="M1.0293 1.51758L6.0293 6.51758L1.0293 11.5176" stroke="#4250F0" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
71
|
-
</svg>
|
|
72
|
-
</a>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="${styles.mediaCount}">${activeMediaIndex + 1} / ${media.length}</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<//>
|
|
79
|
-
`;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default MediaGalleryModal;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable no-use-before-define */
|
|
3
|
-
import { html } from 'htm/preact';
|
|
4
|
-
import { useRef, useState } from 'preact/hooks';
|
|
5
|
-
import { MediaObject } from '@/interfaces';
|
|
6
|
-
import styles from './styles.module.scss';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interface MediaSliderProps {
|
|
10
|
-
media: MediaObject[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const MediaSlider = (props: MediaSliderProps) => {
|
|
14
|
-
const {
|
|
15
|
-
media,
|
|
16
|
-
} = props;
|
|
17
|
-
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
18
|
-
const shuffledMediaRef = useRef(media);
|
|
19
|
-
|
|
20
|
-
shuffledMediaRef.current = media.slice(activeMediaIndex, activeMediaIndex + 2);
|
|
21
|
-
|
|
22
|
-
const prevMedia = (): void => {
|
|
23
|
-
if (activeMediaIndex > 0) {
|
|
24
|
-
setActiveMediaIndex((prevIndex) => {
|
|
25
|
-
if (prevIndex === 0) {
|
|
26
|
-
return media.length - 1;
|
|
27
|
-
}
|
|
28
|
-
return prevIndex - 1;
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const nextMedia = (): void => {
|
|
34
|
-
if (activeMediaIndex < media.length - 1) {
|
|
35
|
-
setActiveMediaIndex((prevIndex) => {
|
|
36
|
-
if (prevIndex === media.length - 1) {
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
|
-
return prevIndex + 1;
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return html`
|
|
45
|
-
<div class="${styles.mediaSliderGallery}">
|
|
46
|
-
<a class="${`${styles.prev}`}" onclick=${prevMedia}>
|
|
47
|
-
<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
-
<path d="M5.78906 11.5176L0.789062 6.51758L5.78906 1.51758" stroke="${activeMediaIndex < 1 ? '#BDBDBD' : '#4250F0'}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
49
|
-
</svg>
|
|
50
|
-
</a>
|
|
51
|
-
${shuffledMediaRef.current && shuffledMediaRef.current.length > 0 && html `
|
|
52
|
-
<div class="${styles.mediaDisplayWrap}">
|
|
53
|
-
${shuffledMediaRef.current.map((mediaItem, index) => {
|
|
54
|
-
const { url } = mediaItem;
|
|
55
|
-
return (
|
|
56
|
-
html`
|
|
57
|
-
<img
|
|
58
|
-
key=${`m_${mediaItem.id}`}
|
|
59
|
-
src=${url}
|
|
60
|
-
class="${styles.mediaImage}"
|
|
61
|
-
/>
|
|
62
|
-
|
|
63
|
-
`
|
|
64
|
-
)
|
|
65
|
-
})}
|
|
66
|
-
</div>`}
|
|
67
|
-
<a class="${`${styles.next}`}" onclick=${nextMedia}>
|
|
68
|
-
<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
69
|
-
<path d="M1.0293 1.51758L6.0293 6.51758L1.0293 11.5176" stroke="${activeMediaIndex >= media.length - 1 ? '#BDBDBD' : '#4250F0'}" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
70
|
-
</svg>
|
|
71
|
-
</a>
|
|
72
|
-
</div>
|
|
73
|
-
`;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default MediaSlider;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable no-use-before-define */
|
|
3
|
-
import { html } from 'htm/preact';
|
|
4
|
-
import { useRef, useState } from 'preact/hooks';
|
|
5
|
-
import { MediaObject, MediaType } from '@/interfaces';
|
|
6
|
-
import MediaGalleryModal from './MediaGalleryModal';
|
|
7
|
-
import MediaSlider from './MediaSlider';
|
|
8
|
-
import styles from './styles.module.scss';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
interface MediaGalleryProps {
|
|
12
|
-
media: MediaObject[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const MediaGallery = (props: MediaGalleryProps) => {
|
|
16
|
-
const {
|
|
17
|
-
media,
|
|
18
|
-
} = props;
|
|
19
|
-
const [openGallery, setOpenGallery] = useState(false);
|
|
20
|
-
const activeMediaIndexRef = useRef(0);
|
|
21
|
-
|
|
22
|
-
const handleMediaClick = (mediaIndex: number): void => {
|
|
23
|
-
activeMediaIndexRef.current = mediaIndex;
|
|
24
|
-
setOpenGallery(true);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return html`
|
|
28
|
-
<div class="${styles.mediaGallery}">
|
|
29
|
-
${media.length >= 1 && html`
|
|
30
|
-
<img onclick=${() => {
|
|
31
|
-
handleMediaClick(0);
|
|
32
|
-
}}
|
|
33
|
-
src=${media[0].url}
|
|
34
|
-
class="${styles.mediaImage}" />
|
|
35
|
-
`}
|
|
36
|
-
${media.length > 1 && html `
|
|
37
|
-
<div class="${styles.layout2}">
|
|
38
|
-
${media.map((mediaItem, index) => {
|
|
39
|
-
if (index > 0 && index <=2 ) {
|
|
40
|
-
const { url, type } = mediaItem;
|
|
41
|
-
if (type === MediaType.IMAGE) {
|
|
42
|
-
return (
|
|
43
|
-
html`${
|
|
44
|
-
media.length > 3 && index === 2 ? html`
|
|
45
|
-
<div class="${styles.mediaImageWrap}" onclick=${
|
|
46
|
-
() => {
|
|
47
|
-
handleMediaClick(index);
|
|
48
|
-
}
|
|
49
|
-
} >
|
|
50
|
-
<img src=${url}
|
|
51
|
-
class="${styles.mediaImage}"
|
|
52
|
-
/>
|
|
53
|
-
<span class="${styles.moreImages}">+ ${media.length - 3} more</span>
|
|
54
|
-
</div>
|
|
55
|
-
` : html`
|
|
56
|
-
<img onclick=${
|
|
57
|
-
() => {
|
|
58
|
-
handleMediaClick(index);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
src=${url}
|
|
62
|
-
class="${styles.mediaImage}" />
|
|
63
|
-
`
|
|
64
|
-
}
|
|
65
|
-
`
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
return (
|
|
69
|
-
html`
|
|
70
|
-
`
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
return html``
|
|
74
|
-
})}
|
|
75
|
-
</div>`}
|
|
76
|
-
<div class="${styles.mediaSlider}">
|
|
77
|
-
<${MediaSlider} media=${media} />
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
${openGallery && html `
|
|
81
|
-
<${MediaGalleryModal}
|
|
82
|
-
media=${media}
|
|
83
|
-
showGallery=${openGallery}
|
|
84
|
-
onClose=${() => {
|
|
85
|
-
setOpenGallery(false);
|
|
86
|
-
}}
|
|
87
|
-
defaultActiveIndex=${activeMediaIndexRef.current}
|
|
88
|
-
/> `}
|
|
89
|
-
`;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default MediaGallery;
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
.mediaGallery {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: flex-start;
|
|
4
|
-
justify-content: flex-start;
|
|
5
|
-
gap: 16px;
|
|
6
|
-
.mediaImage {
|
|
7
|
-
width: 288px;
|
|
8
|
-
height: 162px;
|
|
9
|
-
border-radius: 6px;
|
|
10
|
-
object-fit: cover;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
}
|
|
13
|
-
.layout2 {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
align-items: flex-start;
|
|
17
|
-
justify-content: flex-start;
|
|
18
|
-
gap: 16px;
|
|
19
|
-
.mediaImage {
|
|
20
|
-
width: 121px;
|
|
21
|
-
height: 73px;
|
|
22
|
-
border-radius: 6px;
|
|
23
|
-
}
|
|
24
|
-
.mediaImageWrap {
|
|
25
|
-
width: min-content;
|
|
26
|
-
position: relative;
|
|
27
|
-
opacity: 0.7;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
.moreImages {
|
|
30
|
-
background: #FFFFFF;
|
|
31
|
-
border-radius: 8px;
|
|
32
|
-
padding: 5px 12px;
|
|
33
|
-
font-style: normal;
|
|
34
|
-
font-weight: 500;
|
|
35
|
-
font-size: 12px;
|
|
36
|
-
line-height: 15px;
|
|
37
|
-
color: #333333;
|
|
38
|
-
position: absolute;
|
|
39
|
-
left: 23px;
|
|
40
|
-
bottom: 14px;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.mediaSlider {
|
|
46
|
-
display: none;
|
|
47
|
-
max-width: 400px;
|
|
48
|
-
}
|
|
49
|
-
@media (min-width: 320px ) and (max-width: 856px) {
|
|
50
|
-
.layout2 {
|
|
51
|
-
display: none;
|
|
52
|
-
}
|
|
53
|
-
.mediaImage {
|
|
54
|
-
display: none;
|
|
55
|
-
}
|
|
56
|
-
.mediaSlider {
|
|
57
|
-
display: block;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
@media (min-width: 857px) {
|
|
61
|
-
.mediaSlider {
|
|
62
|
-
display: none;
|
|
63
|
-
}
|
|
64
|
-
.mediaImage {
|
|
65
|
-
display: block;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.mediaGalleryModal {
|
|
71
|
-
.galleryContent {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
justify-content: space-evenly;
|
|
75
|
-
.prev {
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
svg {
|
|
78
|
-
width: 20px;
|
|
79
|
-
height: 20px;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
.next {
|
|
83
|
-
cursor: pointer;
|
|
84
|
-
svg {
|
|
85
|
-
width: 20px;
|
|
86
|
-
height: 20px;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
.mediaCount {
|
|
91
|
-
font-family: inherit;
|
|
92
|
-
font-style: normal;
|
|
93
|
-
font-weight: 500;
|
|
94
|
-
font-size: 14px;
|
|
95
|
-
line-height: 15px;
|
|
96
|
-
color: #333333;
|
|
97
|
-
margin-top: 16px;
|
|
98
|
-
display: flex;
|
|
99
|
-
justify-content: center;
|
|
100
|
-
}
|
|
101
|
-
.mediaImage {
|
|
102
|
-
height: calc(100vh - 300px);
|
|
103
|
-
object-fit: contain;
|
|
104
|
-
width: 522px;
|
|
105
|
-
margin-top: 34px;
|
|
106
|
-
@media (min-width: 640px) {
|
|
107
|
-
width: 200px;
|
|
108
|
-
}
|
|
109
|
-
@media (min-width: 857px) {
|
|
110
|
-
width: 422px;
|
|
111
|
-
max-width: 422px;
|
|
112
|
-
}
|
|
113
|
-
@media (min-width: 1237px) {
|
|
114
|
-
width: 522px;
|
|
115
|
-
max-width: 522px;
|
|
116
|
-
}
|
|
117
|
-
@media (min-height: 1152px) {
|
|
118
|
-
max-height: 600px;
|
|
119
|
-
height: 600px;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.mediaSliderGallery {
|
|
125
|
-
display: flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
justify-content: flex-start;
|
|
128
|
-
gap: 8px;
|
|
129
|
-
.mediaDisplayWrap {
|
|
130
|
-
display: flex;
|
|
131
|
-
gap: 24px;
|
|
132
|
-
overflow: hidden;
|
|
133
|
-
}
|
|
134
|
-
.prev {
|
|
135
|
-
cursor: pointer;
|
|
136
|
-
svg {
|
|
137
|
-
width: 20px;
|
|
138
|
-
height: 20px;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
.next {
|
|
142
|
-
cursor: pointer;
|
|
143
|
-
svg {
|
|
144
|
-
width: 20px;
|
|
145
|
-
height: 20px;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
.mediaImage {
|
|
149
|
-
width: 288px;
|
|
150
|
-
height: 162px;
|
|
151
|
-
border-radius: 6px;
|
|
152
|
-
object-fit: cover;
|
|
153
|
-
cursor: default;
|
|
154
|
-
display: block;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable no-use-before-define */
|
|
3
|
-
import { MediaObject, MediaType, UploadFileObj } from '@/interfaces';
|
|
4
|
-
import { html } from 'htm/preact';
|
|
5
|
-
import { useContext, useState, useRef, useEffect } from 'preact/hooks';
|
|
6
|
-
import AppContext from '@/contexts/AppContext';
|
|
7
|
-
import { Loader } from '../Loader';
|
|
8
|
-
import { Input } from '../Input';
|
|
9
|
-
import styles from './styles.module.scss';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
interface MediaUplaodProps {
|
|
13
|
-
media: MediaObject[];
|
|
14
|
-
allowedUploadMediaType?: string;
|
|
15
|
-
allowedMediaLabel?: string;
|
|
16
|
-
singleUpload?: boolean;
|
|
17
|
-
allowUploadViaURL?: boolean;
|
|
18
|
-
handleUploadMedia: (files: UploadFileObj[]) => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const MediaUplaod = (props: MediaUplaodProps) => {
|
|
22
|
-
const {
|
|
23
|
-
media,
|
|
24
|
-
allowedUploadMediaType = 'image/png,image/jpg,image/jpeg',
|
|
25
|
-
allowedMediaLabel = 'Supports: JPG, JPEG, PNG',
|
|
26
|
-
singleUpload = false,
|
|
27
|
-
allowUploadViaURL = false,
|
|
28
|
-
handleUploadMedia,
|
|
29
|
-
} = props;
|
|
30
|
-
const context = useContext(AppContext);
|
|
31
|
-
const [uploadFiles, setUploadFiles] = useState<UploadFileObj[]>(media);
|
|
32
|
-
const fileInpuRef = useRef<HTMLInputElement>();
|
|
33
|
-
const newFiletoUploadRef = useRef(false);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (uploadFiles.length > 0) {
|
|
37
|
-
if (newFiletoUploadRef.current === true) {
|
|
38
|
-
const anyFileUploading = uploadFiles.findIndex((fileObj) => fileObj.uploading === true);
|
|
39
|
-
if (anyFileUploading === -1) {
|
|
40
|
-
handleUploadMedia(uploadFiles);
|
|
41
|
-
newFiletoUploadRef.current = false;
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
handleUploadMedia(uploadFiles);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
handleUploadMedia([]);
|
|
48
|
-
}
|
|
49
|
-
}, [uploadFiles]);
|
|
50
|
-
|
|
51
|
-
const triggerFileSelection = (): void => {
|
|
52
|
-
if (fileInpuRef.current) {
|
|
53
|
-
fileInpuRef.current.click();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const getFileType = (fileType: string): MediaType | null => {
|
|
58
|
-
if (fileType.split('/')[0] === 'image') {
|
|
59
|
-
return MediaType.IMAGE;
|
|
60
|
-
}
|
|
61
|
-
if (fileType.split('/')[0] === 'video') {
|
|
62
|
-
return MediaType.VIDEO;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const removeFile = (fileObj: UploadFileObj): void => {
|
|
68
|
-
const updatedUploadedFiles = uploadFiles.filter((tempFile) => {
|
|
69
|
-
if (fileObj.index) {
|
|
70
|
-
return tempFile.index !== fileObj.index
|
|
71
|
-
} if (fileObj.id) {
|
|
72
|
-
return tempFile.id !== fileObj.id
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
});
|
|
76
|
-
setUploadFiles([...updatedUploadedFiles]);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const setFileUploadingStatus = (
|
|
80
|
-
fileIndex: number,
|
|
81
|
-
uploading: boolean,
|
|
82
|
-
url: string
|
|
83
|
-
): void => {
|
|
84
|
-
setUploadFiles((prev) => {
|
|
85
|
-
const updatedUploadedFiles = prev.map((fileObj) =>
|
|
86
|
-
fileObj.index === fileIndex
|
|
87
|
-
? { ...fileObj, uploading, url: url || fileObj.url }
|
|
88
|
-
: fileObj
|
|
89
|
-
);
|
|
90
|
-
return [...updatedUploadedFiles];
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const sendFileUploadRequest = (fileObj: UploadFileObj): void => {
|
|
95
|
-
if (fileObj.file) {
|
|
96
|
-
const requestData = new FormData();
|
|
97
|
-
requestData.set('file', fileObj.file);
|
|
98
|
-
context?.apiHandler
|
|
99
|
-
.uploadFile(requestData)
|
|
100
|
-
.then((data) => {
|
|
101
|
-
if (data) {
|
|
102
|
-
if (fileObj.index) {
|
|
103
|
-
setFileUploadingStatus(fileObj.index, false, data.file_path);
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
console.error(`Failed to upload media`);
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const validateAndUploadFile = (fileObj: UploadFileObj): void => {
|
|
113
|
-
const allowedUploadMediaTypeArray = allowedUploadMediaType.split(',');
|
|
114
|
-
if (allowedUploadMediaTypeArray.includes(fileObj.file.type)) {
|
|
115
|
-
if (fileObj.file.type.includes('image')) {
|
|
116
|
-
const { url } = fileObj;
|
|
117
|
-
const image = new Image();
|
|
118
|
-
image.onload = () => {
|
|
119
|
-
newFiletoUploadRef.current = true;
|
|
120
|
-
if (singleUpload) {
|
|
121
|
-
setUploadFiles([fileObj]);
|
|
122
|
-
} else {
|
|
123
|
-
setUploadFiles((prev) => [...prev, fileObj]);
|
|
124
|
-
}
|
|
125
|
-
sendFileUploadRequest(fileObj);
|
|
126
|
-
};
|
|
127
|
-
image.src = url;
|
|
128
|
-
} else {
|
|
129
|
-
// handle other media types
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
// display error toast
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const handleFileSelection = (e: InputEvent): void => {
|
|
137
|
-
if (e.currentTarget instanceof HTMLInputElement) {
|
|
138
|
-
const selectedFilesRaw = Array.from(e.currentTarget.files || []);
|
|
139
|
-
processSelectedFiles(selectedFilesRaw);
|
|
140
|
-
if (fileInpuRef.current) {
|
|
141
|
-
fileInpuRef.current.value = '';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const processSelectedFiles = (selectedFilesRaw: File[]): void => {
|
|
147
|
-
selectedFilesRaw?.forEach((file, index) => {
|
|
148
|
-
const fileObj = {
|
|
149
|
-
index: Math.floor(Math.random() * 100 + 1) + index,
|
|
150
|
-
file,
|
|
151
|
-
url: URL.createObjectURL(file),
|
|
152
|
-
type: getFileType(file.type),
|
|
153
|
-
uploading: true,
|
|
154
|
-
} as UploadFileObj;
|
|
155
|
-
validateAndUploadFile(fileObj);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const handleRemoveMedia = (mediaItem: UploadFileObj): void => {
|
|
160
|
-
removeFile(mediaItem);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
164
|
-
const dropHandler = (ev: any): void => {
|
|
165
|
-
// Prevent default behavior (Prevent file from being opened)
|
|
166
|
-
ev.preventDefault();
|
|
167
|
-
// Use DataTransfer interface to access the file(s)
|
|
168
|
-
const selectedFilesRaw = [...ev.dataTransfer.files];
|
|
169
|
-
processSelectedFiles(selectedFilesRaw);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const dragOverHandler = (ev: any) => {
|
|
173
|
-
// Prevent default behavior (Prevent file from being opened)
|
|
174
|
-
ev.preventDefault();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return html`
|
|
178
|
-
<div class="${styles.mediaUploadWrap}">
|
|
179
|
-
<div class="${styles.mediaUploader}">
|
|
180
|
-
<div class="${styles.dropMedia}" ondrop=${dropHandler} ondragover=${dragOverHandler}>
|
|
181
|
-
<input
|
|
182
|
-
class="${styles.hiddenFileInput}"
|
|
183
|
-
type="file"
|
|
184
|
-
ref=${fileInpuRef}
|
|
185
|
-
multiple
|
|
186
|
-
accept=${allowedUploadMediaType}
|
|
187
|
-
onChange=${handleFileSelection}
|
|
188
|
-
/>
|
|
189
|
-
<img class="${styles.dropIcon}" />
|
|
190
|
-
<div class="${styles.dropText}">
|
|
191
|
-
Drop your images here
|
|
192
|
-
or <span class="${styles.link}" onclick=${triggerFileSelection}>browse</span>
|
|
193
|
-
<p class=${styles.allowedMediaLabel}>${allowedMediaLabel}</p>
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
${allowUploadViaURL && html`
|
|
197
|
-
<div class="${styles.urlField}">
|
|
198
|
-
<${Input} value=""
|
|
199
|
-
className="media-url-field"
|
|
200
|
-
placeholder="Or paste a URL here" />
|
|
201
|
-
</div>
|
|
202
|
-
`}
|
|
203
|
-
</div>
|
|
204
|
-
${uploadFiles.length > 0 && html`
|
|
205
|
-
<div class="${styles.mediaListing}">
|
|
206
|
-
${uploadFiles.map((mediaItem, index) => {
|
|
207
|
-
const { url, type, uploading = false } = mediaItem;
|
|
208
|
-
if (type === MediaType.IMAGE) {
|
|
209
|
-
return html`
|
|
210
|
-
<div class="${styles.mediaPreview}" key=${`media_${mediaItem.id}_${index}}`}>
|
|
211
|
-
${uploading && html `<span class="${styles.uploadingImg}"><${Loader} fill="#4250F0" /></span>`}
|
|
212
|
-
<span class="${styles.backgroundOverlay} ${uploading ? styles.uploading : ''} " />
|
|
213
|
-
${!uploading && html`
|
|
214
|
-
<span class="${styles.delMediaSpan}" onclick=${() => { handleRemoveMedia(mediaItem) }}>
|
|
215
|
-
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
216
|
-
<path d="M1 4H14" stroke="#F05C42" stroke-width="1.4"/>
|
|
217
|
-
<path d="M11.4829 5.5V6.16667L10.8162 13.5H4.14958L3.48291 6.16667V5.5" stroke="#F05C42" stroke-width="1.4" stroke-linejoin="round"/>
|
|
218
|
-
<path d="M5.48291 3.5V2.16667C5.48291 1.79848 5.78139 1.5 6.14958 1.5H8.81624C9.18443 1.5 9.48291 1.79848 9.48291 2.16667V3.5" stroke="#F05C42" stroke-width="1.4"/>
|
|
219
|
-
</svg>
|
|
220
|
-
Delete
|
|
221
|
-
</span>`}
|
|
222
|
-
<img src=${url} alt="media-img" class="${styles.mediaImg}" />
|
|
223
|
-
</div>
|
|
224
|
-
`}
|
|
225
|
-
return html``;
|
|
226
|
-
})}
|
|
227
|
-
</div>
|
|
228
|
-
`}
|
|
229
|
-
</div>
|
|
230
|
-
`;
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export default MediaUplaod;
|