@bynder/compact-view 5.1.3 → 5.2.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/ActiveFilter.js +33 -0
- package/ActiveFilter.js.map +1 -0
- package/ActiveFilters.js +81 -0
- package/ActiveFilters.js.map +1 -0
- package/AddMedia.js +90 -0
- package/AddMedia.js.map +1 -0
- package/Advanced.js +66 -0
- package/Advanced.js.map +1 -0
- package/App.d.ts +4 -2
- package/App.js +93 -0
- package/App.js.map +1 -0
- package/AssetCard.js +172 -0
- package/AssetCard.js.map +1 -0
- package/AssetCardMetaproperties.js +47 -0
- package/AssetCardMetaproperties.js.map +1 -0
- package/AssetFilter.js +138 -0
- package/AssetFilter.js.map +1 -0
- package/AssetFilterContext.js +162 -0
- package/AssetFilterContext.js.map +1 -0
- package/AssetItem.js +40 -0
- package/AssetItem.js.map +1 -0
- package/AssetList.js +158 -0
- package/AssetList.js.map +1 -0
- package/AssetTypeItem.js +34 -0
- package/AssetTypeItem.js.map +1 -0
- package/AssetsView.js +61 -0
- package/AssetsView.js.map +1 -0
- package/Autocomplete_new.js +148 -0
- package/Autocomplete_new.js.map +1 -0
- package/ButtonAction.js +14 -0
- package/ButtonAction.js.map +1 -0
- package/CardSkeleton.js +31 -0
- package/CardSkeleton.js.map +1 -0
- package/Checkbox.styles.js +38 -0
- package/Checkbox.styles.js.map +1 -0
- package/Chip.js +43 -0
- package/Chip.js.map +1 -0
- package/CollectionCard.js +56 -0
- package/CollectionCard.js.map +1 -0
- package/CollectionItem.js +41 -0
- package/CollectionItem.js.map +1 -0
- package/CollectionList.js +53 -0
- package/CollectionList.js.map +1 -0
- package/CollectionView.js +73 -0
- package/CollectionView.js.map +1 -0
- package/CollectionsView.js +58 -0
- package/CollectionsView.js.map +1 -0
- package/ConfigContext.js +18 -0
- package/ConfigContext.js.map +1 -0
- package/ConnectButton.js +20 -0
- package/ConnectButton.js.map +1 -0
- package/Container.js +52 -0
- package/Container.js.map +1 -0
- package/ContextAction.js +42 -0
- package/ContextAction.js.map +1 -0
- package/Dat/Dat.d.ts +2 -12
- package/Dat/DatDropdownItem.d.ts +1 -1
- package/Dat/index.d.ts +0 -1
- package/Dat.js +90 -0
- package/Dat.js.map +1 -0
- package/DatDropdownItem.js +47 -0
- package/DatDropdownItem.js.map +1 -0
- package/DesignSystemContext.js +12 -0
- package/DesignSystemContext.js.map +1 -0
- package/DirectionSelect.js +43 -0
- package/DirectionSelect.js.map +1 -0
- package/DocumentIcon.js +69 -0
- package/DocumentIcon.js.map +1 -0
- package/DomainInput.js +39 -0
- package/DomainInput.js.map +1 -0
- package/DragSelect.js +144 -0
- package/DragSelect.js.map +1 -0
- package/Dropdown.js +72 -0
- package/Dropdown.js.map +1 -0
- package/DropdownContent.js +59 -0
- package/DropdownContent.js.map +1 -0
- package/DropdownListItem.js +52 -0
- package/DropdownListItem.js.map +1 -0
- package/ErrorIcon.js +48 -0
- package/ErrorIcon.js.map +1 -0
- package/ErrorMessage.js +40 -0
- package/ErrorMessage.js.map +1 -0
- package/FieldSelect.js +74 -0
- package/FieldSelect.js.map +1 -0
- package/FileSelector.js +266 -0
- package/FileSelector.js.map +1 -0
- package/Header.js +42 -0
- package/Header.js.map +1 -0
- package/HorizontalScroll.js +51 -0
- package/HorizontalScroll.js.map +1 -0
- package/InfiniteScroll.js +26 -0
- package/InfiniteScroll.js.map +1 -0
- package/LeftArrow.js +31 -0
- package/LeftArrow.js.map +1 -0
- package/LoginComponent.js +32 -0
- package/LoginComponent.js.map +1 -0
- package/LoginContext.js +85 -0
- package/LoginContext.js.map +1 -0
- package/MetapropertyFilterContent.js +25 -0
- package/MetapropertyFilterContent.js.map +1 -0
- package/MetapropertyOption.js +24 -0
- package/MetapropertyOption.js.map +1 -0
- package/Modal.js +48 -0
- package/Modal.js.map +1 -0
- package/NoResults.js +51 -0
- package/NoResults.js.map +1 -0
- package/Oops.js +54 -0
- package/Oops.js.map +1 -0
- package/Option_new.js +50 -0
- package/Option_new.js.map +1 -0
- package/RefreshingSpinner.js +22 -0
- package/RefreshingSpinner.js.map +1 -0
- package/ReportModal.js +51 -0
- package/ReportModal.js.map +1 -0
- package/RightArrow.js +31 -0
- package/RightArrow.js.map +1 -0
- package/RootElementContext.js +12 -0
- package/RootElementContext.js.map +1 -0
- package/SearchInput.js +76 -0
- package/SearchInput.js.map +1 -0
- package/SelectedItemContainer.js +44 -0
- package/SelectedItemContainer.js.map +1 -0
- package/SelectedItems.js +27 -0
- package/SelectedItems.js.map +1 -0
- package/SelectionContext.js +144 -0
- package/SelectionContext.js.map +1 -0
- package/SelectionFooter.js +65 -0
- package/SelectionFooter.js.map +1 -0
- package/ShadowRoot.js +11 -0
- package/ShadowRoot.js.map +1 -0
- package/ShadowRootInternal.js +78 -0
- package/ShadowRootInternal.js.map +1 -0
- package/Shield.js +25 -0
- package/Shield.js.map +1 -0
- package/Skeleton.js +43 -0
- package/Skeleton.js.map +1 -0
- package/SmartFilterContent.js +11 -0
- package/SmartFilterContent.js.map +1 -0
- package/SmartFilterSelect_new.js +86 -0
- package/SmartFilterSelect_new.js.map +1 -0
- package/Smartfilters_new.js +190 -0
- package/Smartfilters_new.js.map +1 -0
- package/Spinner.js +32 -0
- package/Spinner.js.map +1 -0
- package/StatefulAssetList.js +100 -0
- package/StatefulAssetList.js.map +1 -0
- package/Styles.css.js +5 -0
- package/Styles.css.js.map +1 -0
- package/SwitchNLS.js +80 -0
- package/SwitchNLS.js.map +1 -0
- package/TagItem.js +38 -0
- package/TagItem.js.map +1 -0
- package/Tags.js +48 -0
- package/Tags.js.map +1 -0
- package/Theming.js +30 -0
- package/Theming.js.map +1 -0
- package/Toolbar.js +53 -0
- package/Toolbar.js.map +1 -0
- package/Tooltip.js +81 -0
- package/Tooltip.js.map +1 -0
- package/ViewSwitch.js +45 -0
- package/ViewSwitch.js.map +1 -0
- package/api/filterAssets.d.ts +1 -1
- package/api/getCollections.d.ts +1 -1
- package/api/getFilterOptions.d.ts +9 -0
- package/api/getFilters.d.ts +2 -2
- package/api/getFilters_new.d.ts +7 -0
- package/api/getSimilarityAssets.d.ts +1 -1
- package/api/index.d.ts +3 -3
- package/api/rest/autocomplete.d.ts +1 -1
- package/api/rest/getAssetCounts.d.ts +2 -2
- package/api/rest/getInitialFilters.d.ts +2 -2
- package/api/rest/getMetapropertiesOptions.d.ts +1 -1
- package/api/types/getFilters_new.d.ts +56 -0
- package/app-config/ConfigContext.d.ts +4 -5
- package/app-config/appConfig.type.d.ts +2 -0
- package/app-config/appConfig.type.guard.d.ts +1 -1
- package/asset.type.js +31 -0
- package/asset.type.js.map +1 -0
- package/asyncDebounce.js +14 -0
- package/asyncDebounce.js.map +1 -0
- package/auth.js +35 -0
- package/auth.js.map +1 -0
- package/autocomplete.js +25 -0
- package/autocomplete.js.map +1 -0
- package/base64Converter.js +15 -0
- package/base64Converter.js.map +1 -0
- package/chunk.js +10 -0
- package/chunk.js.map +1 -0
- package/class.js +7 -0
- package/class.js.map +1 -0
- package/combineFilters.js +9 -0
- package/combineFilters.js.map +1 -0
- package/combineMetaproperties.js +25 -0
- package/combineMetaproperties.js.map +1 -0
- package/common/components/CardSkeleton.d.ts +1 -1
- package/common/components/Checkbox.styles.d.ts +4 -4
- package/common/components/Chip.d.ts +1 -1
- package/common/components/DocumentIcon.d.ts +1 -1
- package/common/components/DragSelect.d.ts +1 -1
- package/common/components/HorizontalScroll.d.ts +1 -1
- package/common/components/InfiniteScroll.d.ts +1 -1
- package/common/components/LeftArrow.d.ts +1 -1
- package/common/components/Modal.d.ts +1 -1
- package/common/components/NoResults.d.ts +1 -1
- package/common/components/RightArrow.d.ts +1 -1
- package/common/components/Skeleton.d.ts +1 -1
- package/common/components/Spinner.d.ts +1 -1
- package/common/components/Tooltip.d.ts +1 -1
- package/common/components/dropdown/Dropdown.d.ts +1 -1
- package/common/components/dropdown/DropdownContent.d.ts +1 -1
- package/common/components/dropdown/DropdownListItem.d.ts +1 -1
- package/common/hooks/useClickOutside.d.ts +1 -1
- package/constants.js +15 -0
- package/constants.js.map +1 -0
- package/createSelectors.js +11 -0
- package/createSelectors.js.map +1 -0
- package/crypto.js +21 -0
- package/crypto.js.map +1 -0
- package/error-handling/ErrorIcon.d.ts +1 -1
- package/error-handling/ErrorMessage.d.ts +1 -1
- package/error-handling/Oops.d.ts +1 -1
- package/error-handling/ReportModal.d.ts +1 -1
- package/error-handling/Shield.d.ts +1 -1
- package/filter/AssetFilter.d.ts +1 -1
- package/filter/AssetFilterContext.d.ts +3 -3
- package/filter/active-filters/ActiveFilter.d.ts +1 -1
- package/filter/active-filters/ActiveFilters.d.ts +1 -1
- package/filter/filters/advanced/Advanced.d.ts +1 -1
- package/filter/filters/advanced/AssetTypeItem.d.ts +1 -1
- package/filter/filters/metaproperty/Metaproperty.d.ts +1 -1
- package/filter/filters/metaproperty/MetapropertyFilterContent.d.ts +1 -1
- package/filter/filters/metaproperty/MetapropertyOption.d.ts +1 -1
- package/filter/filters/metaproperty/SmartFilterContent.d.ts +1 -1
- package/filter/filters/smartfilters/Metaproperties/Autocomplete.d.ts +3 -3
- package/filter/filters/smartfilters/Metaproperties/Autocomplete_new.d.ts +15 -0
- package/filter/filters/smartfilters/Metaproperties/Option.d.ts +2 -2
- package/filter/filters/smartfilters/Metaproperties/Option_new.d.ts +13 -0
- package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect.d.ts +2 -2
- package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect_new.d.ts +13 -0
- package/filter/filters/smartfilters/Smartfilters.d.ts +2 -2
- package/filter/filters/smartfilters/Smartfilters_new.d.ts +7 -0
- package/filter/filters/tags/TagItem.d.ts +1 -1
- package/filter/filters/tags/Tags.d.ts +1 -1
- package/filterAssets.js +177 -0
- package/filterAssets.js.map +1 -0
- package/getAsset.js +70 -0
- package/getAsset.js.map +1 -0
- package/getAssetCounts.js +27 -0
- package/getAssetCounts.js.map +1 -0
- package/getAssets.js +137 -0
- package/getAssets.js.map +1 -0
- package/getCollections.js +79 -0
- package/getCollections.js.map +1 -0
- package/getFilterOptions.js +57 -0
- package/getFilterOptions.js.map +1 -0
- package/getFilters.js +85 -0
- package/getFilters.js.map +1 -0
- package/getFilters_new.js +73 -0
- package/getFilters_new.js.map +1 -0
- package/getLimitedUseThumbnails.js +26 -0
- package/getLimitedUseThumbnails.js.map +1 -0
- package/getSimilarityAssets.js +141 -0
- package/getSimilarityAssets.js.map +1 -0
- package/handlers.js +7 -0
- package/handlers.js.map +1 -0
- package/helpers.js +7 -0
- package/helpers.js.map +1 -0
- package/index.js +9 -1162
- package/index.js.map +1 -0
- package/index2.js +18 -0
- package/index2.js.map +1 -0
- package/index3.js +56 -0
- package/index3.js.map +1 -0
- package/index4.js +20 -0
- package/index4.js.map +1 -0
- package/logger.js +7 -0
- package/logger.js.map +1 -0
- package/login/LoginComponent.d.ts +1 -1
- package/login/LoginContext.d.ts +1 -1
- package/login/components/ConnectButton.d.ts +1 -1
- package/login/components/Container.d.ts +1 -1
- package/login/components/DomainInput.d.ts +1 -1
- package/login/components/Header.d.ts +1 -1
- package/login/components/RefreshingSpinner.d.ts +1 -1
- package/loginwindow.js +84 -0
- package/loginwindow.js.map +1 -0
- package/normalizeResponse.js +31 -0
- package/normalizeResponse.js.map +1 -0
- package/oauth2.js +87 -0
- package/oauth2.js.map +1 -0
- package/order/DirectionSelect.d.ts +1 -1
- package/order/FieldSelect.d.ts +2 -2
- package/package.json +2 -9
- package/result.type.js +25 -0
- package/result.type.js.map +1 -0
- package/router/RouterContext.d.ts +1 -1
- package/search/SearchInput.d.ts +1 -1
- package/search/SwitchNLS.d.ts +1 -1
- package/search/index.d.ts +0 -2
- package/select/FileSelector.d.ts +1 -1
- package/select/SelectionContext.d.ts +1 -1
- package/select/SelectionFooter.d.ts +1 -1
- package/select/add-media/AddMedia.d.ts +1 -1
- package/select/add-media/ButtonAction.d.ts +1 -1
- package/select/current-selection/AssetItem.d.ts +1 -1
- package/select/current-selection/CollectionItem.d.ts +1 -1
- package/select/current-selection/SelectedItemContainer.d.ts +1 -1
- package/select/current-selection/SelectedItems.d.ts +1 -1
- package/store/useDatStore.d.ts +73 -0
- package/store/useOrderingStore.d.ts +2 -2
- package/store/useRouterStore.d.ts +4 -4
- package/store/useSearchStore.d.ts +69 -0
- package/store/useSimilaritySearchStore.d.ts +67 -0
- package/style/DesignSystemContext.d.ts +1 -1
- package/style/RootElementContext.d.ts +1 -1
- package/style/Theming.d.ts +1 -1
- package/style/shadowroot/ShadowRoot.d.ts +1 -1
- package/style/shadowroot/ShadowRootInternal.d.ts +1 -1
- package/text.js +9 -0
- package/text.js.map +1 -0
- package/toolbar/Toolbar.d.ts +1 -1
- package/toolbar/ViewSwitch.d.ts +1 -1
- package/trimMetapropertyValue.js +6 -0
- package/trimMetapropertyValue.js.map +1 -0
- package/url.js +7 -0
- package/url.js.map +1 -0
- package/useAccountDomain.js +33 -0
- package/useAccountDomain.js.map +1 -0
- package/useAuthInformation.js +42 -0
- package/useAuthInformation.js.map +1 -0
- package/useClickOutside.js +16 -0
- package/useClickOutside.js.map +1 -0
- package/useDatStore.js +62 -0
- package/useDatStore.js.map +1 -0
- package/useDimensions.js +31 -0
- package/useDimensions.js.map +1 -0
- package/useOrderingStore.js +27 -0
- package/useOrderingStore.js.map +1 -0
- package/useRouterStore.js +21 -0
- package/useRouterStore.js.map +1 -0
- package/useSearchStore.js +49 -0
- package/useSearchStore.js.map +1 -0
- package/useSimilaritySearchStore.js +28 -0
- package/useSimilaritySearchStore.js.map +1 -0
- package/utils/base64Converter.d.ts +1 -1
- package/utils/combineFilters.d.ts +1 -1
- package/utils/combineMetaproperties.d.ts +2 -2
- package/utils/filterEmptyMetaproperties.d.ts +1 -1
- package/utils/getLimitedUseThumbnails.d.ts +2 -0
- package/utils/getMetaPropertiesForFilter.d.ts +1 -1
- package/utils/normalizeResponse.d.ts +1 -1
- package/utils.js +49 -0
- package/utils.js.map +1 -0
- package/utils2.js +51 -0
- package/utils2.js.map +1 -0
- package/views/asset/AssetList.d.ts +5 -3
- package/views/asset/AssetsView.d.ts +1 -1
- package/views/asset/StatefulAssetList.d.ts +2 -2
- package/views/asset/asset-card/AssetCard.d.ts +1 -1
- package/views/asset/asset-card/AssetCardMetaproperties.d.ts +3 -3
- package/views/asset/asset-card/ContextAction.d.ts +1 -1
- package/views/collection/CollectionView.d.ts +1 -1
- package/views/collections/CollectionCard.d.ts +1 -1
- package/views/collections/CollectionList.d.ts +1 -1
- package/views/collections/CollectionsView.d.ts +1 -1
- package/Dat/DatContext.d.ts +0 -12
- package/__tests__/utils/index.d.ts +0 -116
- package/api/__tests__/testMocks/mocks.d.ts +0 -14
- package/api/__tests__/utils.d.ts +0 -10
- package/common/components/__mocks__/Tooltip.d.ts +0 -6
- package/common/components/__tests__/utils.d.ts +0 -34
- package/error-handling/__tests__/utils.d.ts +0 -56
- package/filter/__tests__/utils.d.ts +0 -13
- package/index.mjs +0 -1163
- package/login/__tests__/mocks.d.ts +0 -1
- package/login/__tests__/utils.d.ts +0 -41
- package/search/SearchContext.d.ts +0 -25
- package/search/SimilaritySearchContext.d.ts +0 -21
- package/search/__mocks__/SimilaritySearchContext.d.ts +0 -5
- package/select/__tests__/utils.d.ts +0 -11
- package/style/shadowroot/__mocks__/ShadowRoot.d.ts +0 -4
- package/utils/__mocks__/logger.d.ts +0 -4
- package/views/asset/__tests__/utils.d.ts +0 -7
- package/views/collections/__tests__/utils.d.ts +0 -5
package/ActiveFilter.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import r from "styled-components";
|
|
3
|
+
import { token as i, Chip as o } from "@bynder/design-system";
|
|
4
|
+
function l(t) {
|
|
5
|
+
return /* @__PURE__ */ e(
|
|
6
|
+
n,
|
|
7
|
+
{
|
|
8
|
+
icon: t.icon,
|
|
9
|
+
size: "s",
|
|
10
|
+
onDelete: t.onClick,
|
|
11
|
+
"data-testid": `selected-filter:${t.title}`,
|
|
12
|
+
children: t.title
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
const n = r(o)`
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
margin-right: ${i.spacing3};
|
|
19
|
+
border: 1px solid ${i.gray50};
|
|
20
|
+
box-shadow: 0 1px 6px -2px rgba(0, 34, 51, 0.1);
|
|
21
|
+
|
|
22
|
+
div {
|
|
23
|
+
svg {
|
|
24
|
+
width: 20px;
|
|
25
|
+
height: 20px;
|
|
26
|
+
margin-right: ${i.spacing2};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
export {
|
|
31
|
+
l as ActiveFilter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ActiveFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActiveFilter.js","sources":["../../src/filter/active-filters/ActiveFilter.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { Chip, token } from '@bynder/design-system';\n\nexport function ActiveFilter(props: {\n\tonClick?: () => void;\n\ttitle: string;\n\ticon?: React.ReactNode;\n}) {\n\treturn (\n\t\t<StyledChip\n\t\t\ticon={props.icon}\n\t\t\tsize=\"s\"\n\t\t\tonDelete={props.onClick}\n\t\t\tdata-testid={`selected-filter:${props.title}`}\n\t\t>\n\t\t\t{props.title}\n\t\t</StyledChip>\n\t);\n}\n\nconst StyledChip = styled(Chip)`\n\tbackground-color: transparent;\n\tmargin-right: ${token.spacing3};\n\tborder: 1px solid ${token.gray50};\n\tbox-shadow: 0 1px 6px -2px rgba(0, 34, 51, 0.1);\n\n\tdiv {\n\t\tsvg {\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tmargin-right: ${token.spacing2};\n\t\t}\n\t}\n`;\n"],"names":["ActiveFilter","props","jsx","StyledChip","styled","Chip","token"],"mappings":";;;AAIO,SAASA,EAAaC,GAI1B;AACF,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,MAAMF,EAAM;AAAA,MACZ,MAAK;AAAA,MACL,UAAUA,EAAM;AAAA,MAChB,eAAa,mBAAmBA,EAAM,KAAK;AAAA,MAE1C,UAAAA,EAAM;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAME,IAAaC,EAAOC,CAAI;AAAA;AAAA,iBAEbC,EAAM,QAAQ;AAAA,qBACVA,EAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAOdA,EAAM,QAAQ;AAAA;AAAA;AAAA;"}
|
package/ActiveFilters.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import h from "styled-components";
|
|
3
|
+
import { Button as v } from "@bynder/design-system";
|
|
4
|
+
import { assetTypeToString as y, getAssetTypeIcon as u } from "./asset.type.js";
|
|
5
|
+
import { HorizontalScroll as x } from "./HorizontalScroll.js";
|
|
6
|
+
import { useAssetFilter as A } from "./AssetFilterContext.js";
|
|
7
|
+
import { ActiveFilter as s } from "./ActiveFilter.js";
|
|
8
|
+
import { __ as d } from "./index2.js";
|
|
9
|
+
import { useSimilaritySearchStore as g } from "./useSimilaritySearchStore.js";
|
|
10
|
+
function B() {
|
|
11
|
+
const t = A(), {
|
|
12
|
+
isSelected: o,
|
|
13
|
+
setIsSelected: l,
|
|
14
|
+
isNLSSelected: c,
|
|
15
|
+
setIsNLSSelected: n,
|
|
16
|
+
NLSSearchText: a,
|
|
17
|
+
setNLSSearchText: m
|
|
18
|
+
} = g(), S = Object.values(t.selectedSmartfilterOptions || {}), p = S.length === 0 && t.assetTypes.length === 0 && t.tags.length === 0 && !o && !(c && a) ? void 0 : /* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(
|
|
19
|
+
v,
|
|
20
|
+
{
|
|
21
|
+
variant: "clean",
|
|
22
|
+
isSmall: !0,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
t.clear(), l(!1), n(!1), m(void 0);
|
|
25
|
+
},
|
|
26
|
+
children: d("Clear filters")
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
return /* @__PURE__ */ i("div", { "data-testid": "selected-filter-list", children: /* @__PURE__ */ f(x, { isActiveFilter: !0, static: p, children: [
|
|
30
|
+
t.assetTypes.map((e) => {
|
|
31
|
+
const r = u(e);
|
|
32
|
+
return /* @__PURE__ */ i(
|
|
33
|
+
s,
|
|
34
|
+
{
|
|
35
|
+
onClick: () => t.removeAssetType(e),
|
|
36
|
+
title: y(e),
|
|
37
|
+
icon: /* @__PURE__ */ i(r, {})
|
|
38
|
+
},
|
|
39
|
+
e
|
|
40
|
+
);
|
|
41
|
+
}),
|
|
42
|
+
S.map(
|
|
43
|
+
(e) => Object.values(e).map((r) => /* @__PURE__ */ i(
|
|
44
|
+
s,
|
|
45
|
+
{
|
|
46
|
+
onClick: () => t.removeSmartfilterOption(
|
|
47
|
+
r.metapropertyName,
|
|
48
|
+
r.id
|
|
49
|
+
),
|
|
50
|
+
title: r.label
|
|
51
|
+
},
|
|
52
|
+
r.id
|
|
53
|
+
))
|
|
54
|
+
),
|
|
55
|
+
t.tags.map((e) => /* @__PURE__ */ i(
|
|
56
|
+
s,
|
|
57
|
+
{
|
|
58
|
+
onClick: () => t.removeTag(e),
|
|
59
|
+
title: e
|
|
60
|
+
},
|
|
61
|
+
e
|
|
62
|
+
)),
|
|
63
|
+
(o || c && a) && /* @__PURE__ */ i(
|
|
64
|
+
s,
|
|
65
|
+
{
|
|
66
|
+
onClick: () => {
|
|
67
|
+
l(!1), n(!1), m(void 0);
|
|
68
|
+
},
|
|
69
|
+
title: d("Show similar")
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }) });
|
|
73
|
+
}
|
|
74
|
+
const k = h.div`
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
animation: var(--fade-in-down);
|
|
77
|
+
`;
|
|
78
|
+
export {
|
|
79
|
+
B as ActiveFilters
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=ActiveFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActiveFilters.js","sources":["../../src/filter/active-filters/ActiveFilters.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@bynder/design-system';\n\nimport { assetTypeToString, getAssetTypeIcon } from '@src/views/asset/asset.type';\nimport { HorizontalScroll } from '@src/common/components/HorizontalScroll';\nimport { useAssetFilter } from '../AssetFilterContext';\nimport { ActiveFilter } from './ActiveFilter';\nimport { __ } from '@src/localization';\nimport { useSimilaritySearchStore } from '@src/store/useSimilaritySearchStore';\n\nexport function ActiveFilters() {\n\tconst assetFilterState = useAssetFilter();\n\tconst {\n\t\tisSelected: isSimilaritySearchSelected,\n\t\tsetIsSelected: setIsSimilaritySearchSelected,\n\t\tisNLSSelected,\n\t\tsetIsNLSSelected,\n\t\tNLSSearchText,\n\t\tsetNLSSearchText,\n\t} = useSimilaritySearchStore();\n\n\tconst smartfilterOptions = Object.values(assetFilterState.selectedSmartfilterOptions || {});\n\n\tconst isEmpty =\n\t\tsmartfilterOptions.length === 0 &&\n\t\tassetFilterState.assetTypes.length === 0 &&\n\t\tassetFilterState.tags.length === 0 &&\n\t\t!isSimilaritySearchSelected &&\n\t\t!(isNLSSelected && NLSSearchText);\n\n\tconst fixedButton = !isEmpty ? (\n\t\t<AnimationWrapper>\n\t\t\t<Button\n\t\t\t\tvariant=\"clean\"\n\t\t\t\tisSmall\n\t\t\t\tonClick={() => {\n\t\t\t\t\tassetFilterState.clear();\n\t\t\t\t\tsetIsSimilaritySearchSelected(false);\n\t\t\t\t\tsetIsNLSSelected(false);\n\t\t\t\t\tsetNLSSearchText(undefined);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{__('Clear filters')}\n\t\t\t</Button>\n\t\t</AnimationWrapper>\n\t) : undefined;\n\n\treturn (\n\t\t<div data-testid=\"selected-filter-list\">\n\t\t\t<HorizontalScroll isActiveFilter static={fixedButton}>\n\t\t\t\t{assetFilterState.assetTypes.map((assetType) => {\n\t\t\t\t\tconst Icon = getAssetTypeIcon(assetType);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActiveFilter\n\t\t\t\t\t\t\tkey={assetType}\n\t\t\t\t\t\t\tonClick={() => assetFilterState.removeAssetType(assetType)}\n\t\t\t\t\t\t\ttitle={assetTypeToString(assetType)}\n\t\t\t\t\t\t\ticon={<Icon />}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\n\t\t\t\t{smartfilterOptions.map((option) =>\n\t\t\t\t\tObject.values(option).map((value) => (\n\t\t\t\t\t\t<ActiveFilter\n\t\t\t\t\t\t\tkey={value.id}\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tassetFilterState.removeSmartfilterOption(\n\t\t\t\t\t\t\t\t\tvalue.metapropertyName,\n\t\t\t\t\t\t\t\t\tvalue.id,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttitle={value.label}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)),\n\t\t\t\t)}\n\n\t\t\t\t{assetFilterState.tags.map((tag) => (\n\t\t\t\t\t<ActiveFilter\n\t\t\t\t\t\tkey={tag}\n\t\t\t\t\t\tonClick={() => assetFilterState.removeTag(tag)}\n\t\t\t\t\t\ttitle={tag}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\n\t\t\t\t{(isSimilaritySearchSelected || (isNLSSelected && NLSSearchText)) && (\n\t\t\t\t\t<ActiveFilter\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tsetIsSimilaritySearchSelected(false);\n\t\t\t\t\t\t\tsetIsNLSSelected(false);\n\t\t\t\t\t\t\tsetNLSSearchText(undefined);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ttitle={__('Show similar')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</HorizontalScroll>\n\t\t</div>\n\t);\n}\n\nconst AnimationWrapper = styled.div`\n\tflex-shrink: 0;\n\tanimation: var(--fade-in-down);\n`;\n"],"names":["ActiveFilters","assetFilterState","useAssetFilter","isSimilaritySearchSelected","setIsSimilaritySearchSelected","isNLSSelected","setIsNLSSelected","NLSSearchText","setNLSSearchText","useSimilaritySearchStore","smartfilterOptions","fixedButton","jsx","AnimationWrapper","Button","HorizontalScroll","assetType","Icon","getAssetTypeIcon","ActiveFilter","assetTypeToString","option","value","tag","__","styled"],"mappings":";;;;;;;;;AAWO,SAASA,IAAgB;AAC/B,QAAMC,IAAmBC,EAAA,GACnB;AAAA,IACL,YAAYC;AAAA,IACZ,eAAeC;AAAA,IACf,eAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACGC,EAAA,GAEEC,IAAqB,OAAO,OAAOT,EAAiB,8BAA8B,CAAA,CAAE,GASpFU,IANLD,EAAmB,WAAW,KAC9BT,EAAiB,WAAW,WAAW,KACvCA,EAAiB,KAAK,WAAW,KACjC,CAACE,KACD,EAAEE,KAAiBE,KAiBhB,SAdH,gBAAAK,EAACC,GAAA,EACA,UAAA,gBAAAD;AAAA,IAACE;AAAA,IAAA;AAAA,MACA,SAAQ;AAAA,MACR,SAAO;AAAA,MACP,SAAS,MAAM;AACd,QAAAb,EAAiB,MAAA,GACjBG,EAA8B,EAAK,GACnCE,EAAiB,EAAK,GACtBE,EAAiB,MAAS;AAAA,MAC3B;AAAA,MAEC,YAAG,eAAe;AAAA,IAAA;AAAA,EAAA,GAErB;AAGD,SACC,gBAAAI,EAAC,SAAI,eAAY,wBAChB,4BAACG,GAAA,EAAiB,gBAAc,IAAC,QAAQJ,GACvC,UAAA;AAAA,IAAAV,EAAiB,WAAW,IAAI,CAACe,MAAc;AAC/C,YAAMC,IAAOC,EAAiBF,CAAS;AAEvC,aACC,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UAEA,SAAS,MAAMlB,EAAiB,gBAAgBe,CAAS;AAAA,UACzD,OAAOI,EAAkBJ,CAAS;AAAA,UAClC,wBAAOC,GAAA,CAAA,CAAK;AAAA,QAAA;AAAA,QAHPD;AAAA,MAAA;AAAA,IAMR,CAAC;AAAA,IAEAN,EAAmB;AAAA,MAAI,CAACW,MACxB,OAAO,OAAOA,CAAM,EAAE,IAAI,CAACC,MAC1B,gBAAAV;AAAA,QAACO;AAAA,QAAA;AAAA,UAEA,SAAS,MACRlB,EAAiB;AAAA,YAChBqB,EAAM;AAAA,YACNA,EAAM;AAAA,UAAA;AAAA,UAGR,OAAOA,EAAM;AAAA,QAAA;AAAA,QAPRA,EAAM;AAAA,MAAA,CASZ;AAAA,IAAA;AAAA,IAGDrB,EAAiB,KAAK,IAAI,CAACsB,MAC3B,gBAAAX;AAAA,MAACO;AAAA,MAAA;AAAA,QAEA,SAAS,MAAMlB,EAAiB,UAAUsB,CAAG;AAAA,QAC7C,OAAOA;AAAA,MAAA;AAAA,MAFFA;AAAA,IAAA,CAIN;AAAA,KAECpB,KAA+BE,KAAiBE,MACjD,gBAAAK;AAAA,MAACO;AAAA,MAAA;AAAA,QACA,SAAS,MAAM;AACd,UAAAf,EAA8B,EAAK,GACnCE,EAAiB,EAAK,GACtBE,EAAiB,MAAS;AAAA,QAC3B;AAAA,QACA,OAAOgB,EAAG,cAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EACzB,EAAA,CAEF,EAAA,CACD;AAEF;AAEA,MAAMX,IAAmBY,EAAO;AAAA;AAAA;AAAA;"}
|
package/AddMedia.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs as x, Fragment as L, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as b, useEffect as A } from "react";
|
|
3
|
+
import { Button as E } from "@bynder/design-system";
|
|
4
|
+
import { useConfig as M } from "./ConfigContext.js";
|
|
5
|
+
import { useAuth as O } from "./LoginContext.js";
|
|
6
|
+
import { useSelection as T } from "./SelectionContext.js";
|
|
7
|
+
import { FileSelector as j } from "./FileSelector.js";
|
|
8
|
+
import { getAsset as D } from "./getAsset.js";
|
|
9
|
+
import { getAssets as N } from "./getAssets.js";
|
|
10
|
+
import { isErr as k } from "./result.type.js";
|
|
11
|
+
import { logger as q } from "./logger.js";
|
|
12
|
+
import { ButtonAction as B } from "./ButtonAction.js";
|
|
13
|
+
import { convertAssetIdToBase64 as G } from "./base64Converter.js";
|
|
14
|
+
import { useSimilaritySearchStore as p } from "./useSimilaritySearchStore.js";
|
|
15
|
+
function tt(t) {
|
|
16
|
+
const { assetFieldSelection: r, onSuccess: i, selectionMode: u, noCache: f } = M(), {
|
|
17
|
+
isSelected: d,
|
|
18
|
+
NLSSearchText: h,
|
|
19
|
+
isNLSSelected: g
|
|
20
|
+
} = p(), { preselectedAssetIds: F } = T(), m = O(), l = C(!0), [s, a] = b(
|
|
21
|
+
u === "SingleSelectFile" ? { status: "WaitingForFileSelection" } : { status: "Ready" }
|
|
22
|
+
);
|
|
23
|
+
function y(e) {
|
|
24
|
+
a(e === void 0 ? { status: "WaitingForFileSelection" } : { status: "ReadyWithFile", file: e });
|
|
25
|
+
}
|
|
26
|
+
A(() => () => {
|
|
27
|
+
l.current = !1;
|
|
28
|
+
}, []);
|
|
29
|
+
function v() {
|
|
30
|
+
const e = s.status === "ReadyWithFile" ? s.file : void 0;
|
|
31
|
+
a({ status: "Loading" }), u !== "MultiSelect" && t.selection[0]?.type === "asset" ? D({
|
|
32
|
+
assetId: d || h && g ? G(t.selection[0].value.id) : t.selection[0].value.id,
|
|
33
|
+
auth: m,
|
|
34
|
+
assetFieldSelection: r,
|
|
35
|
+
noCache: f
|
|
36
|
+
}).then((n) => {
|
|
37
|
+
S(n, e);
|
|
38
|
+
}) : N({
|
|
39
|
+
selectedItems: t.selection,
|
|
40
|
+
auth: m,
|
|
41
|
+
assetFieldSelection: r,
|
|
42
|
+
noCache: f,
|
|
43
|
+
isSimilaritySearchEnabled: d
|
|
44
|
+
}).then((n) => {
|
|
45
|
+
S(n, e);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function S(e, n) {
|
|
49
|
+
if (k(e)) {
|
|
50
|
+
a({ status: "Error" });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const o = Array.isArray(e.value) ? e.value : [e.value];
|
|
55
|
+
o.sort((R, W) => w(R, W, F)), i(o, { selectedFile: n });
|
|
56
|
+
} catch (o) {
|
|
57
|
+
q.error(o);
|
|
58
|
+
}
|
|
59
|
+
l.current && (a({ status: "Done" }), setTimeout(() => {
|
|
60
|
+
l.current && a((o) => o.status === "ReadyWithFile" ? o : n ? { status: "ReadyWithFile", file: n } : { status: "Ready" });
|
|
61
|
+
}, 2e3));
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ x(L, { children: [
|
|
64
|
+
u === "SingleSelectFile" && t.selection[0]?.type === "asset" && /* @__PURE__ */ c(j, { asset: t.selection[0].value, onChange: y }),
|
|
65
|
+
/* @__PURE__ */ c(
|
|
66
|
+
E,
|
|
67
|
+
{
|
|
68
|
+
variant: "primary",
|
|
69
|
+
isDisabled: s.status === "Loading" || s.status === "WaitingForFileSelection",
|
|
70
|
+
onClick: v,
|
|
71
|
+
"data-testid": "add-button",
|
|
72
|
+
isLoading: s.status === "Loading",
|
|
73
|
+
children: /* @__PURE__ */ c(
|
|
74
|
+
B,
|
|
75
|
+
{
|
|
76
|
+
status: s.status,
|
|
77
|
+
numberOfSelectedItems: t.selection.length
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
function w(t, r, i) {
|
|
85
|
+
return i ? !i.includes(t.id) && i.includes(r.id) ? 1 : i.includes(t.id) && !i.includes(r.id) ? -1 : i.indexOf(t.id) - i.indexOf(r.id) : 0;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
tt as AddMedia
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=AddMedia.js.map
|
package/AddMedia.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddMedia.js","sources":["../../src/select/add-media/AddMedia.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Button } from '@bynder/design-system';\n\nimport { useConfig } from '../../app-config/ConfigContext';\nimport { useAuth } from '../../login/LoginContext';\nimport { SelectedItem, useSelection } from '../SelectionContext';\nimport { FileSelector } from '../FileSelector';\nimport { File } from '../file.type';\nimport { Asset, getAsset } from '../../api/getAsset';\nimport { getAssets } from '../../api/getAssets';\nimport { isErr, Result } from '../../auth/result.type';\nimport { logger } from '../../utils/logger';\nimport { ButtonAction } from './ButtonAction';\nimport { State } from './addMedia.type';\nimport { convertAssetIdToBase64 } from '@src/utils/base64Converter';\nimport { useSimilaritySearchStore } from '@src/store/useSimilaritySearchStore';\n\ninterface Props {\n\tselection: SelectedItem[];\n}\n\nexport function AddMedia(props: Props) {\n\tconst { assetFieldSelection, onSuccess, selectionMode, noCache } = useConfig();\n\tconst {\n\t\tisSelected: isSimilaritySearchEnabled,\n\t\tNLSSearchText,\n\t\tisNLSSelected,\n\t} = useSimilaritySearchStore();\n\tconst { preselectedAssetIds } = useSelection();\n\tconst auth = useAuth();\n\tconst isMounted = useRef(true);\n\n\tconst [state, setState] = useState<State>(\n\t\tselectionMode === 'SingleSelectFile'\n\t\t\t? { status: 'WaitingForFileSelection' }\n\t\t\t: { status: 'Ready' },\n\t);\n\n\tfunction handleChangeFile(file: File | undefined) {\n\t\tif (file === undefined) {\n\t\t\tsetState({ status: 'WaitingForFileSelection' });\n\t\t} else {\n\t\t\tsetState({ status: 'ReadyWithFile', file });\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisMounted.current = false;\n\t\t};\n\t}, []);\n\n\tfunction handleGetAssets() {\n\t\tconst selectedFile = state.status === 'ReadyWithFile' ? state.file : undefined;\n\t\tsetState({ status: 'Loading' });\n\n\t\tif (selectionMode !== 'MultiSelect' && props.selection[0]?.type === 'asset') {\n\t\t\tgetAsset({\n\t\t\t\tassetId:\n\t\t\t\t\tisSimilaritySearchEnabled || (NLSSearchText && isNLSSelected)\n\t\t\t\t\t\t? convertAssetIdToBase64(props.selection[0].value.id)\n\t\t\t\t\t\t: props.selection[0].value.id,\n\t\t\t\tauth,\n\t\t\t\tassetFieldSelection,\n\t\t\t\tnoCache,\n\t\t\t}).then((result) => {\n\t\t\t\tsetStateAfterRequest(result, selectedFile);\n\t\t\t});\n\t\t} else {\n\t\t\tgetAssets({\n\t\t\t\tselectedItems: props.selection,\n\t\t\t\tauth,\n\t\t\t\tassetFieldSelection,\n\t\t\t\tnoCache,\n\t\t\t\tisSimilaritySearchEnabled,\n\t\t\t}).then((result) => {\n\t\t\t\tsetStateAfterRequest(result, selectedFile);\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction setStateAfterRequest(result: Result<Asset | Asset[], string>, selectedFile?: File) {\n\t\tif (isErr(result)) {\n\t\t\tsetState({ status: 'Error' });\n\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst value = Array.isArray(result.value) ? result.value : [result.value];\n\n\t\t\t// Keep the order of preselected assets in the return result\n\t\t\tvalue.sort((a, b) => sortAssets(a, b, preselectedAssetIds));\n\n\t\t\tonSuccess(value, { selectedFile });\n\t\t} catch (e) {\n\t\t\tlogger.error(e);\n\t\t}\n\n\t\t// onSuccess might close compact view, so only set state\n\t\t// if still mounted.\n\t\tif (isMounted.current) {\n\t\t\tsetState({ status: 'Done' });\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (isMounted.current) {\n\t\t\t\t\tsetState((prevState) => {\n\t\t\t\t\t\tif (prevState.status === 'ReadyWithFile') {\n\t\t\t\t\t\t\treturn prevState;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn selectedFile\n\t\t\t\t\t\t\t? { status: 'ReadyWithFile', file: selectedFile }\n\t\t\t\t\t\t\t: { status: 'Ready' };\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, 2000);\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{/* The second part of this condition should always be true. The footer is only shown\n\t\t\t * if there is something selected, and only assets can be selected in SingleSelectFile\n\t\t\t * mode. The condition is only included so Typescript knows what type the selected\n\t\t\t * item is. */}\n\t\t\t{selectionMode === 'SingleSelectFile' && props.selection[0]?.type === 'asset' && (\n\t\t\t\t<FileSelector asset={props.selection[0].value} onChange={handleChangeFile} />\n\t\t\t)}\n\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisDisabled={\n\t\t\t\t\tstate.status === 'Loading' || state.status === 'WaitingForFileSelection'\n\t\t\t\t}\n\t\t\t\tonClick={handleGetAssets}\n\t\t\t\tdata-testid=\"add-button\"\n\t\t\t\tisLoading={state.status === 'Loading'}\n\t\t\t>\n\t\t\t\t<ButtonAction\n\t\t\t\t\tstatus={state.status}\n\t\t\t\t\tnumberOfSelectedItems={props.selection.length}\n\t\t\t\t/>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nfunction sortAssets(assetA: Asset, assetB: Asset, preselectedAssetIds): number {\n\tif (!preselectedAssetIds) return 0;\n\n\tif (!preselectedAssetIds.includes(assetA.id) && preselectedAssetIds.includes(assetB.id)) {\n\t\treturn 1;\n\t}\n\n\tif (preselectedAssetIds.includes(assetA.id) && !preselectedAssetIds.includes(assetB.id)) {\n\t\treturn -1;\n\t}\n\n\treturn preselectedAssetIds.indexOf(assetA.id) - preselectedAssetIds.indexOf(assetB.id);\n}\n"],"names":["AddMedia","props","assetFieldSelection","onSuccess","selectionMode","noCache","useConfig","isSimilaritySearchEnabled","NLSSearchText","isNLSSelected","useSimilaritySearchStore","preselectedAssetIds","useSelection","auth","useAuth","isMounted","useRef","state","setState","useState","handleChangeFile","file","useEffect","handleGetAssets","selectedFile","getAsset","convertAssetIdToBase64","result","setStateAfterRequest","getAssets","isErr","value","a","b","sortAssets","e","logger","prevState","jsxs","Fragment","jsx","FileSelector","Button","ButtonAction","assetA","assetB"],"mappings":"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"}
|
package/Advanced.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { styled as o } from "styled-components";
|
|
3
|
+
import { token as i } from "@bynder/design-system";
|
|
4
|
+
import { IconAdjust as g } from "@bynder/icons";
|
|
5
|
+
import { Dropdown as p } from "./Dropdown.js";
|
|
6
|
+
import { __ as m } from "./index2.js";
|
|
7
|
+
import { useConfig as l } from "./ConfigContext.js";
|
|
8
|
+
import { Spinner as u } from "./Spinner.js";
|
|
9
|
+
import { AssetTypeItem as f } from "./AssetTypeItem.js";
|
|
10
|
+
function O(n) {
|
|
11
|
+
const { assetTypes: r } = l(), s = r.filter(
|
|
12
|
+
(e) => a(n.count, e) > 0
|
|
13
|
+
);
|
|
14
|
+
return r.length === 0 || s.length === 0 ? null : /* @__PURE__ */ t(A, { title: /* @__PURE__ */ t(h, {}), isSmall: !0, fadeIn: !0, children: () => /* @__PURE__ */ c(d, { children: [
|
|
15
|
+
n.isLoading && /* @__PURE__ */ t(u, {}),
|
|
16
|
+
/* @__PURE__ */ t($, { children: m("Type") }),
|
|
17
|
+
/* @__PURE__ */ t(y, { children: s.map((e) => /* @__PURE__ */ t(
|
|
18
|
+
f,
|
|
19
|
+
{
|
|
20
|
+
type: e,
|
|
21
|
+
count: a(n.count, e),
|
|
22
|
+
isLoading: n.isLoading
|
|
23
|
+
},
|
|
24
|
+
e
|
|
25
|
+
)) })
|
|
26
|
+
] }) });
|
|
27
|
+
}
|
|
28
|
+
function h() {
|
|
29
|
+
return /* @__PURE__ */ c(d, { children: [
|
|
30
|
+
/* @__PURE__ */ t(I, {}),
|
|
31
|
+
m("Advanced")
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function a(n, r) {
|
|
35
|
+
switch (r) {
|
|
36
|
+
case "AUDIO":
|
|
37
|
+
return n.audio;
|
|
38
|
+
case "DOCUMENT":
|
|
39
|
+
return n.document;
|
|
40
|
+
case "IMAGE":
|
|
41
|
+
return n.image;
|
|
42
|
+
case "VIDEO":
|
|
43
|
+
return n.video;
|
|
44
|
+
case "ARCHIVE":
|
|
45
|
+
return n.archive;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const A = o(p)``, $ = o.h1`
|
|
49
|
+
padding: ${i.spacing5} ${i.spacing5} 0 ${i.spacing5};
|
|
50
|
+
margin: 0 0 ${i.spacing5} 0;
|
|
51
|
+
font-size: ${i.fontSize100};
|
|
52
|
+
`, I = o(g)`
|
|
53
|
+
display: inline;
|
|
54
|
+
margin-right: ${i.spacing3};
|
|
55
|
+
height: ${i.spacing6};
|
|
56
|
+
width: ${i.spacing6};
|
|
57
|
+
`, y = o.ul`
|
|
58
|
+
padding: 0;
|
|
59
|
+
margin: 0;
|
|
60
|
+
list-style: none;
|
|
61
|
+
padding-bottom: ${i.spacing2};
|
|
62
|
+
`;
|
|
63
|
+
export {
|
|
64
|
+
O as Advanced
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=Advanced.js.map
|
package/Advanced.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Advanced.js","sources":["../../src/filter/filters/advanced/Advanced.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { token } from '@bynder/design-system';\nimport { IconAdjust } from '@bynder/icons';\nimport { Dropdown } from '../../../common/components/dropdown/Dropdown';\nimport { __ } from '../../../localization';\nimport { useConfig } from '../../../app-config/ConfigContext';\nimport { AssetType } from '../../../views/asset/asset.type';\nimport { Spinner } from '../../../common/components/Spinner';\nimport { AssetTypeItem } from './AssetTypeItem';\n\ninterface Count {\n\taudio: number;\n\tdocument: number;\n\timage: number;\n\tvideo: number;\n\tarchive: number;\n}\n\ninterface AdvancedProps {\n\tisLoading: boolean;\n\tcount: Count;\n}\n\nexport function Advanced(props: AdvancedProps) {\n\tconst { assetTypes } = useConfig();\n\n\tconst assetTypesWithAssets = assetTypes.filter(\n\t\t(type) => getAssetCountForType(props.count, type) > 0,\n\t);\n\n\tif (assetTypes.length === 0 || assetTypesWithAssets.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownContainer title={<Title />} isSmall fadeIn>\n\t\t\t{() => (\n\t\t\t\t<>\n\t\t\t\t\t{props.isLoading && <Spinner />}\n\t\t\t\t\t<DropdownTitle>{__('Type')}</DropdownTitle>\n\n\t\t\t\t\t<UnorderedList>\n\t\t\t\t\t\t{assetTypesWithAssets.map((assetType) => (\n\t\t\t\t\t\t\t<AssetTypeItem\n\t\t\t\t\t\t\t\tkey={assetType}\n\t\t\t\t\t\t\t\ttype={assetType}\n\t\t\t\t\t\t\t\tcount={getAssetCountForType(props.count, assetType)}\n\t\t\t\t\t\t\t\tisLoading={props.isLoading}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</UnorderedList>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</DropdownContainer>\n\t);\n}\n\n// eslint-disable-next-line react/no-multi-comp\nfunction Title() {\n\treturn (\n\t\t<>\n\t\t\t<Icon />\n\t\t\t{__('Advanced')}\n\t\t</>\n\t);\n}\n\nfunction getAssetCountForType(count: Count, type: AssetType) {\n\tswitch (type) {\n\t\tcase 'AUDIO':\n\t\t\treturn count.audio;\n\t\tcase 'DOCUMENT':\n\t\t\treturn count.document;\n\t\tcase 'IMAGE':\n\t\t\treturn count.image;\n\t\tcase 'VIDEO':\n\t\t\treturn count.video;\n\t\tcase 'ARCHIVE':\n\t\t\treturn count.archive;\n\t}\n}\n\nconst DropdownContainer = styled(Dropdown)``;\n\nconst DropdownTitle = styled.h1`\n\tpadding: ${token.spacing5} ${token.spacing5} 0 ${token.spacing5};\n\tmargin: 0 0 ${token.spacing5} 0;\n\tfont-size: ${token.fontSize100};\n`;\n\nconst Icon = styled(IconAdjust)`\n\tdisplay: inline;\n\tmargin-right: ${token.spacing3};\n\theight: ${token.spacing6};\n\twidth: ${token.spacing6};\n`;\n\nconst UnorderedList = styled.ul`\n\tpadding: 0;\n\tmargin: 0;\n\tlist-style: none;\n\tpadding-bottom: ${token.spacing2};\n`;\n"],"names":["Advanced","props","assetTypes","useConfig","assetTypesWithAssets","type","getAssetCountForType","jsx","DropdownContainer","Title","jsxs","Fragment","Spinner","DropdownTitle","__","UnorderedList","assetType","AssetTypeItem","Icon","count","styled","Dropdown","token","IconAdjust"],"mappings":";;;;;;;;;AAwBO,SAASA,EAASC,GAAsB;AAC9C,QAAM,EAAE,YAAAC,EAAA,IAAeC,EAAA,GAEjBC,IAAuBF,EAAW;AAAA,IACvC,CAACG,MAASC,EAAqBL,EAAM,OAAOI,CAAI,IAAI;AAAA,EAAA;AAGrD,SAAIH,EAAW,WAAW,KAAKE,EAAqB,WAAW,IACvD,OAIP,gBAAAG,EAACC,GAAA,EAAkB,OAAO,gBAAAD,EAACE,GAAA,CAAA,CAAM,GAAI,SAAO,IAAC,QAAM,IACjD,UAAA,MACA,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAAV,EAAM,+BAAcW,GAAA,CAAA,CAAQ;AAAA,IAC7B,gBAAAL,EAACM,GAAA,EAAe,UAAAC,EAAG,MAAM,EAAA,CAAE;AAAA,IAE3B,gBAAAP,EAACQ,GAAA,EACC,UAAAX,EAAqB,IAAI,CAACY,MAC1B,gBAAAT;AAAA,MAACU;AAAA,MAAA;AAAA,QAEA,MAAMD;AAAA,QACN,OAAOV,EAAqBL,EAAM,OAAOe,CAAS;AAAA,QAClD,WAAWf,EAAM;AAAA,MAAA;AAAA,MAHZe;AAAA,IAAA,CAKN,EAAA,CACF;AAAA,EAAA,EAAA,CACD,EAAA,CAEF;AAEF;AAGA,SAASP,IAAQ;AAChB,SACC,gBAAAC,EAAAC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAJ,EAACW,GAAA,EAAK;AAAA,IACLJ,EAAG,UAAU;AAAA,EAAA,GACf;AAEF;AAEA,SAASR,EAAqBa,GAAcd,GAAiB;AAC5D,UAAQA,GAAA;AAAA,IACP,KAAK;AACJ,aAAOc,EAAM;AAAA,IACd,KAAK;AACJ,aAAOA,EAAM;AAAA,IACd,KAAK;AACJ,aAAOA,EAAM;AAAA,IACd,KAAK;AACJ,aAAOA,EAAM;AAAA,IACd,KAAK;AACJ,aAAOA,EAAM;AAAA,EAAA;AAEhB;AAEA,MAAMX,IAAoBY,EAAOC,CAAQ,KAEnCR,IAAgBO,EAAO;AAAA,YACjBE,EAAM,QAAQ,IAAIA,EAAM,QAAQ,MAAMA,EAAM,QAAQ;AAAA,eACjDA,EAAM,QAAQ;AAAA,cACfA,EAAM,WAAW;AAAA,GAGzBJ,IAAOE,EAAOG,CAAU;AAAA;AAAA,iBAEbD,EAAM,QAAQ;AAAA,WACpBA,EAAM,QAAQ;AAAA,UACfA,EAAM,QAAQ;AAAA,GAGlBP,IAAgBK,EAAO;AAAA;AAAA;AAAA;AAAA,mBAIVE,EAAM,QAAQ;AAAA;"}
|
package/App.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
import { AssetFilterJson } from './filter/assetFilter.type';
|
|
3
3
|
import { AssetType } from './views/asset/asset.type';
|
|
4
4
|
import { SelectionMode } from './app-config/appConfig.type';
|
|
@@ -14,6 +14,8 @@ export interface Props {
|
|
|
14
14
|
onSuccess?: (assets: unknown[], additionalInformation: {
|
|
15
15
|
selectedFile?: File;
|
|
16
16
|
}) => void;
|
|
17
|
+
defaultImageDerivativeName?: string;
|
|
18
|
+
defaultVideoDerivativeName?: string;
|
|
17
19
|
theme?: Theme;
|
|
18
20
|
hideExternalAccess?: boolean;
|
|
19
21
|
selectedAssets?: string[];
|
|
@@ -24,4 +26,4 @@ export interface Props {
|
|
|
24
26
|
noCache?: boolean;
|
|
25
27
|
selectAllOption?: boolean;
|
|
26
28
|
}
|
|
27
|
-
export declare function App({ assetFieldSelection, assetFilter, assetTypes, defaultSearchTerm, language, mode, onSuccess, theme, hideExternalAccess, selectedAssets, hideLimitedUse, isContainerMode, __shouldAddOriginal__, hideSwitch, noCache, selectAllOption, }: Props): React.JSX.Element;
|
|
29
|
+
export declare function App({ assetFieldSelection, assetFilter, assetTypes, defaultSearchTerm, language, mode, onSuccess, defaultImageDerivativeName, defaultVideoDerivativeName, theme, hideExternalAccess, selectedAssets, hideLimitedUse, isContainerMode, __shouldAddOriginal__, hideSwitch, noCache, selectAllOption, }: Props): React.JSX.Element;
|
package/App.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as V } from "react";
|
|
3
|
+
import { BrowserClient as D, makeFetchTransport as E, defaultStackParser as I, Hub as T } from "@sentry/browser";
|
|
4
|
+
import { CollectionsView as k } from "./CollectionsView.js";
|
|
5
|
+
import { CollectionView as y } from "./CollectionView.js";
|
|
6
|
+
import { ConfigProvider as M, useConfig as O } from "./ConfigContext.js";
|
|
7
|
+
import { AssetFilter as R } from "./AssetFilter.js";
|
|
8
|
+
import { useLocalization as U } from "./index2.js";
|
|
9
|
+
import { ShadowRoot as x } from "./ShadowRoot.js";
|
|
10
|
+
import { AssetFilterProvider as j } from "./AssetFilterContext.js";
|
|
11
|
+
import { SelectionProvider as H } from "./SelectionContext.js";
|
|
12
|
+
import { ThemeStyles as N } from "./Theming.js";
|
|
13
|
+
import { Toolbar as z } from "./Toolbar.js";
|
|
14
|
+
import { AssetsView as B } from "./AssetsView.js";
|
|
15
|
+
import { SelectionFooter as G } from "./SelectionFooter.js";
|
|
16
|
+
import { Shield as L } from "./Shield.js";
|
|
17
|
+
import { Dat as _ } from "./Dat.js";
|
|
18
|
+
import "./DatDropdownItem.js";
|
|
19
|
+
import { useRouterSelectors as q } from "./useRouterStore.js";
|
|
20
|
+
import { useSearchStore as J, useClearCollectionOnPageChange as K } from "./useSearchStore.js";
|
|
21
|
+
import { useDat as Q } from "./useDatStore.js";
|
|
22
|
+
let n;
|
|
23
|
+
n = new D({
|
|
24
|
+
dsn: "https://dd74b64cc05845468f0c3654b458da29@sentry10.bynder.cloud/464",
|
|
25
|
+
autoSessionTracking: !0,
|
|
26
|
+
tracesSampleRate: 1,
|
|
27
|
+
integrations: [],
|
|
28
|
+
stackParser: I,
|
|
29
|
+
transport: E
|
|
30
|
+
}), new T(n);
|
|
31
|
+
function Se({
|
|
32
|
+
assetFieldSelection: o,
|
|
33
|
+
assetFilter: r,
|
|
34
|
+
assetTypes: a = ["IMAGE", "AUDIO", "VIDEO", "DOCUMENT", "ARCHIVE"],
|
|
35
|
+
defaultSearchTerm: l,
|
|
36
|
+
language: c = "en_US",
|
|
37
|
+
mode: p = "MultiSelect",
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
onSuccess: f = (t, { selectedFile: i }) => console.log(t, i),
|
|
40
|
+
defaultImageDerivativeName: d,
|
|
41
|
+
defaultVideoDerivativeName: u,
|
|
42
|
+
theme: h,
|
|
43
|
+
hideExternalAccess: g,
|
|
44
|
+
selectedAssets: S,
|
|
45
|
+
hideLimitedUse: C,
|
|
46
|
+
isContainerMode: w = !1,
|
|
47
|
+
__shouldAddOriginal__: v,
|
|
48
|
+
hideSwitch: A = !1,
|
|
49
|
+
noCache: P = !1,
|
|
50
|
+
selectAllOption: b = !1
|
|
51
|
+
}) {
|
|
52
|
+
U(c);
|
|
53
|
+
const { setSearch: t } = J(), { datUrl: i } = Q(), m = {
|
|
54
|
+
assetFieldSelection: o,
|
|
55
|
+
assetFilter: r,
|
|
56
|
+
assetTypes: a,
|
|
57
|
+
language: c,
|
|
58
|
+
onSuccess: f,
|
|
59
|
+
defaultImageDerivativeName: d,
|
|
60
|
+
defaultVideoDerivativeName: u,
|
|
61
|
+
selectionMode: p,
|
|
62
|
+
theme: h,
|
|
63
|
+
hideExternalAccess: g,
|
|
64
|
+
__shouldAddOriginal__: v,
|
|
65
|
+
hideSwitch: A,
|
|
66
|
+
noCache: P,
|
|
67
|
+
selectAllOption: b
|
|
68
|
+
};
|
|
69
|
+
return V(() => {
|
|
70
|
+
t("assets", l ?? "");
|
|
71
|
+
}, [l, t]), /* @__PURE__ */ e(L, { sentryClient: n, children: /* @__PURE__ */ e(x, { isContainerMode: w, children: /* @__PURE__ */ e(j, { hideLimitedUse: C, predefinedFilter: r, children: /* @__PURE__ */ e(M, { value: m, children: /* @__PURE__ */ s(H, { preselectedAssetIds: S ?? [], children: [
|
|
72
|
+
/* @__PURE__ */ e(N, { theme: m.theme }),
|
|
73
|
+
/* @__PURE__ */ s("div", { className: "cv-root cv-container", children: [
|
|
74
|
+
/* @__PURE__ */ e(z, {}),
|
|
75
|
+
/* @__PURE__ */ e(W, {}),
|
|
76
|
+
/* @__PURE__ */ e(G, {}),
|
|
77
|
+
i && /* @__PURE__ */ e(_, {})
|
|
78
|
+
] })
|
|
79
|
+
] }) }) }) }) });
|
|
80
|
+
}
|
|
81
|
+
function W() {
|
|
82
|
+
const o = q.use.page(), { assetFilter: r } = O();
|
|
83
|
+
return K(o), /* @__PURE__ */ s(F, { children: [
|
|
84
|
+
o.page !== "collections" && (r === void 0 || r && r.showToolbar) && /* @__PURE__ */ e(R, {}),
|
|
85
|
+
o.page === "assets" && /* @__PURE__ */ e(B, {}),
|
|
86
|
+
o.page === "collections" && /* @__PURE__ */ e(k, {}),
|
|
87
|
+
o.page === "collection" && /* @__PURE__ */ e(y, { collection: o.collection })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
Se as App
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=App.js.map
|
package/App.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sources":["../../src/App.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport { BrowserClient, defaultStackParser, makeFetchTransport, Hub } from '@sentry/browser';\nimport { AssetFilterJson } from './filter/assetFilter.type';\nimport { AssetType } from './views/asset/asset.type';\nimport { CollectionsView } from './views/collections/CollectionsView';\nimport { CollectionView } from './views/collection/CollectionView';\nimport { ConfigProvider, useConfig } from './app-config/ConfigContext';\nimport { SelectionMode } from './app-config/appConfig.type';\nimport { AssetFilter } from './filter/AssetFilter';\nimport { useLocalization } from './localization';\nimport { ShadowRoot } from './style/shadowroot/ShadowRoot';\nimport { AssetFilterProvider } from './filter/AssetFilterContext';\nimport { SelectionProvider } from './select/SelectionContext';\nimport { Theme, ThemeStyles } from './style/Theming';\nimport { Toolbar } from './toolbar/Toolbar';\nimport { File } from './select/file.type';\nimport { AssetsView } from './views/asset/AssetsView';\nimport { SelectionFooter } from './select/SelectionFooter';\nimport { Shield } from './error-handling/Shield';\nimport { Dat } from './Dat';\nimport { useRouterSelectors } from './store/useRouterStore';\nimport { useClearCollectionOnPageChange, useSearchStore } from './store/useSearchStore';\nimport { useDat } from './store/useDatStore';\n\nlet sentryClient;\n\n// Initialize Sentry on production\nif (process.env.NODE_ENV === 'production') {\n\tsentryClient = new BrowserClient({\n\t\tdsn: 'https://dd74b64cc05845468f0c3654b458da29@sentry10.bynder.cloud/464',\n\t\tautoSessionTracking: true,\n\t\ttracesSampleRate: 1.0,\n\t\tintegrations: [],\n\t\tstackParser: defaultStackParser,\n\t\ttransport: makeFetchTransport,\n\t});\n\tnew Hub(sentryClient);\n}\n\nexport interface Props {\n\tassetFieldSelection?: string;\n\tassetFilter?: AssetFilterJson;\n\tassetTypes?: AssetType[];\n\tdefaultSearchTerm?: string;\n\tlanguage?: string;\n\tmode?: SelectionMode;\n\tonSuccess?: (assets: unknown[], additionalInformation: { selectedFile?: File }) => void;\n\tdefaultImageDerivativeName?: string;\n\tdefaultVideoDerivativeName?: string;\n\ttheme?: Theme;\n\thideExternalAccess?: boolean;\n\tselectedAssets?: string[];\n\thideLimitedUse?: boolean;\n\tisContainerMode?: boolean;\n\t__shouldAddOriginal__?: boolean;\n\thideSwitch?: boolean;\n\tnoCache?: boolean;\n\tselectAllOption?: boolean;\n}\n\nexport function App({\n\tassetFieldSelection,\n\tassetFilter,\n\tassetTypes = ['IMAGE', 'AUDIO', 'VIDEO', 'DOCUMENT', 'ARCHIVE'],\n\tdefaultSearchTerm,\n\tlanguage = 'en_US',\n\tmode = 'MultiSelect',\n\t// eslint-disable-next-line no-console\n\tonSuccess = (assets, { selectedFile }) => console.log(assets, selectedFile),\n\tdefaultImageDerivativeName,\n\tdefaultVideoDerivativeName,\n\ttheme,\n\thideExternalAccess,\n\tselectedAssets,\n\thideLimitedUse,\n\tisContainerMode = false,\n\t__shouldAddOriginal__,\n\thideSwitch = false,\n\tnoCache = false,\n\tselectAllOption = false,\n}: Props) {\n\tuseLocalization(language);\n\tconst { setSearch } = useSearchStore();\n\tconst { datUrl } = useDat();\n\n\tconst config = {\n\t\tassetFieldSelection,\n\t\tassetFilter,\n\t\tassetTypes,\n\t\tlanguage,\n\t\tonSuccess,\n\t\tdefaultImageDerivativeName,\n\t\tdefaultVideoDerivativeName,\n\t\tselectionMode: mode,\n\t\ttheme,\n\t\thideExternalAccess,\n\t\t__shouldAddOriginal__,\n\t\thideSwitch,\n\t\tnoCache,\n\t\tselectAllOption,\n\t};\n\n\tuseEffect(() => {\n\t\tsetSearch('assets', defaultSearchTerm ?? '');\n\t}, [defaultSearchTerm, setSearch]);\n\n\treturn (\n\t\t<Shield sentryClient={sentryClient}>\n\t\t\t<ShadowRoot isContainerMode={isContainerMode}>\n\t\t\t\t<AssetFilterProvider hideLimitedUse={hideLimitedUse} predefinedFilter={assetFilter}>\n\t\t\t\t\t<ConfigProvider value={config}>\n\t\t\t\t\t\t<SelectionProvider preselectedAssetIds={selectedAssets ?? []}>\n\t\t\t\t\t\t\t<ThemeStyles theme={config.theme} />\n\t\t\t\t\t\t\t<div className=\"cv-root cv-container\">\n\t\t\t\t\t\t\t\t<Toolbar />\n\t\t\t\t\t\t\t\t<CurrentPageView />\n\t\t\t\t\t\t\t\t<SelectionFooter />\n\n\t\t\t\t\t\t\t\t{datUrl && <Dat />}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</SelectionProvider>\n\t\t\t\t\t</ConfigProvider>\n\t\t\t\t</AssetFilterProvider>\n\t\t\t</ShadowRoot>\n\t\t</Shield>\n\t);\n}\n\n// eslint-disable-next-line react/no-multi-comp\nfunction CurrentPageView() {\n\tconst page = useRouterSelectors.use.page();\n\tconst { assetFilter } = useConfig();\n\n\t// Clear collection search state on page change\n\tuseClearCollectionOnPageChange(page);\n\n\treturn (\n\t\t<>\n\t\t\t{page.page !== 'collections' &&\n\t\t\t\t(assetFilter === undefined || (assetFilter && assetFilter.showToolbar)) && (\n\t\t\t\t\t<AssetFilter />\n\t\t\t\t)}\n\n\t\t\t{page.page === 'assets' && <AssetsView />}\n\t\t\t{page.page === 'collections' && <CollectionsView />}\n\t\t\t{page.page === 'collection' && <CollectionView collection={page.collection} />}\n\t\t</>\n\t);\n}\n"],"names":["sentryClient","BrowserClient","defaultStackParser","makeFetchTransport","Hub","App","assetFieldSelection","assetFilter","assetTypes","defaultSearchTerm","language","mode","onSuccess","assets","selectedFile","defaultImageDerivativeName","defaultVideoDerivativeName","theme","hideExternalAccess","selectedAssets","hideLimitedUse","isContainerMode","__shouldAddOriginal__","hideSwitch","noCache","selectAllOption","useLocalization","setSearch","useSearchStore","datUrl","useDat","config","useEffect","jsx","Shield","ShadowRoot","AssetFilterProvider","ConfigProvider","jsxs","SelectionProvider","ThemeStyles","Toolbar","CurrentPageView","SelectionFooter","Dat","page","useRouterSelectors","useConfig","useClearCollectionOnPageChange","Fragment","AssetFilter","AssetsView","CollectionsView","CollectionView"],"mappings":"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"}
|
package/AssetCard.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useEffect as x } from "react";
|
|
3
|
+
import s from "styled-components";
|
|
4
|
+
import { token as r, Card as l, Badge as w, TruncatedText as P } from "@bynder/design-system";
|
|
5
|
+
import { useConfig as U } from "./ConfigContext.js";
|
|
6
|
+
import { getStatusText as V, getExtension as W, getThumbnail as b } from "./utils.js";
|
|
7
|
+
import { __ as d } from "./index2.js";
|
|
8
|
+
import { ContextAction as _ } from "./ContextAction.js";
|
|
9
|
+
import { AssetCardMetaproperties as z } from "./AssetCardMetaproperties.js";
|
|
10
|
+
import { useDat as L } from "./useDatStore.js";
|
|
11
|
+
function Z({
|
|
12
|
+
className: e,
|
|
13
|
+
fadeIn: y = !0,
|
|
14
|
+
asset: t,
|
|
15
|
+
isSelected: n,
|
|
16
|
+
isOutlined: C,
|
|
17
|
+
onClick: p,
|
|
18
|
+
children: $ = null,
|
|
19
|
+
isSilimilaritySearchEnabled: v = !1,
|
|
20
|
+
onSimilaritySearch: T
|
|
21
|
+
}) {
|
|
22
|
+
const [B, S] = g(), [I, k] = g(), { openDat: A, setTransformation: M } = L(), { theme: m } = U(), c = V(t), h = W(t);
|
|
23
|
+
x(() => {
|
|
24
|
+
const o = t.metaproperties?.nodes.filter(
|
|
25
|
+
(a) => a.showInGridView || a.showInListView
|
|
26
|
+
);
|
|
27
|
+
S(o);
|
|
28
|
+
}, [t.metaproperties]), x(() => {
|
|
29
|
+
const o = t.textMetaproperties?.filter(
|
|
30
|
+
(a) => a.showInGridView || a.showInListView
|
|
31
|
+
);
|
|
32
|
+
k(o);
|
|
33
|
+
}, [t.textMetaproperties]);
|
|
34
|
+
const u = (o) => {
|
|
35
|
+
p !== void 0 && (o.stopPropagation(), M(), p(t, o));
|
|
36
|
+
}, D = (o) => {
|
|
37
|
+
o.stopPropagation(), T([t.databaseId ? t.databaseId : t.id]);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ i(
|
|
40
|
+
j,
|
|
41
|
+
{
|
|
42
|
+
id: t.id,
|
|
43
|
+
$theme: m,
|
|
44
|
+
$isOutlined: (n || C) && m?.colorPrimary !== void 0,
|
|
45
|
+
$fadeIn: y,
|
|
46
|
+
className: e,
|
|
47
|
+
"data-drag-select-id": t.id,
|
|
48
|
+
children: /* @__PURE__ */ f(
|
|
49
|
+
l,
|
|
50
|
+
{
|
|
51
|
+
contextAction: /* @__PURE__ */ i(
|
|
52
|
+
_,
|
|
53
|
+
{
|
|
54
|
+
transformBaseUrl: t.files?.transformBaseUrl?.url,
|
|
55
|
+
portalUrl: t.url,
|
|
56
|
+
onOpenDAT: () => {
|
|
57
|
+
A(t.files?.transformBaseUrl?.url, t, t.name);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
selectButtonAriaLabel: n ? d("Deselect") : d("Select"),
|
|
62
|
+
onSelect: u,
|
|
63
|
+
onClick: u,
|
|
64
|
+
isSelected: n,
|
|
65
|
+
"aria-selected": n,
|
|
66
|
+
"data-testid": "asset-card",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ f(
|
|
69
|
+
l.Frame,
|
|
70
|
+
{
|
|
71
|
+
icon: c ? /* @__PURE__ */ i(E, { $limitWidth: !!h, children: /* @__PURE__ */ i(w, { color: "black-alpha", "data-testid": "asset-tag", children: /* @__PURE__ */ i(P, { children: c }) }) }) : void 0,
|
|
72
|
+
"data-testid": "asset-type",
|
|
73
|
+
badge: h,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ i(l.Images, { children: b(t) && /* @__PURE__ */ i(
|
|
76
|
+
l.Img,
|
|
77
|
+
{
|
|
78
|
+
src: b(t),
|
|
79
|
+
alt: t.name,
|
|
80
|
+
contentResize: "fit"
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
v && t.__typename === "Image" && /* @__PURE__ */ i(
|
|
84
|
+
H,
|
|
85
|
+
{
|
|
86
|
+
onClick: D,
|
|
87
|
+
"data-testid": "similarity-search-indicator",
|
|
88
|
+
type: "button",
|
|
89
|
+
"aria-label": "similarity-search-button",
|
|
90
|
+
className: "showSimilarButton",
|
|
91
|
+
children: /* @__PURE__ */ i(w, { isSmall: !0, children: d("Show similar") })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
$,
|
|
98
|
+
/* @__PURE__ */ i(G, { "data-testid": "asset-name", children: t.name }),
|
|
99
|
+
/* @__PURE__ */ i(
|
|
100
|
+
z,
|
|
101
|
+
{
|
|
102
|
+
metaproperties: B,
|
|
103
|
+
textMetaproperties: I
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
const j = s.div`
|
|
113
|
+
margin: ${r.spacing3};
|
|
114
|
+
width: 224px;
|
|
115
|
+
align-self: flex-start;
|
|
116
|
+
position: relative;
|
|
117
|
+
${(e) => e.$fadeIn ? "animation: var(--fade-in-down);" : ""}
|
|
118
|
+
|
|
119
|
+
--userComponentCardSelectedColor: ${({ $theme: e }) => e?.colorButtonPrimary};
|
|
120
|
+
--userComponentCardSelectedColorHover: ${({ $theme: e }) => e?.colorButtonPrimaryHover};
|
|
121
|
+
--userComponentCardSelectedColorActive: ${({ $theme: e }) => e?.colorButtonPrimaryActive};
|
|
122
|
+
|
|
123
|
+
.showSimilarButton {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:hover .showSimilarButton {
|
|
128
|
+
display: block;
|
|
129
|
+
}
|
|
130
|
+
`, E = s.div`
|
|
131
|
+
${(e) => e.$limitWidth && "max-width: 142px;"}
|
|
132
|
+
margin-top: ${r.spacing2};
|
|
133
|
+
`, G = s.p`
|
|
134
|
+
width: auto;
|
|
135
|
+
max-width: 100%;
|
|
136
|
+
height: auto;
|
|
137
|
+
line-height: 20px;
|
|
138
|
+
min-height: 20px;
|
|
139
|
+
max-height: 20px;
|
|
140
|
+
padding: 0 ${r.spacing5};
|
|
141
|
+
margin: ${r.spacing3} 0;
|
|
142
|
+
transition: all 200ms ease;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
box-sizing: content-box;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
max-height: 80px;
|
|
150
|
+
word-break: break-all;
|
|
151
|
+
white-space: normal;
|
|
152
|
+
}
|
|
153
|
+
`, H = s.button`
|
|
154
|
+
background: none;
|
|
155
|
+
border: none;
|
|
156
|
+
padding: 0;
|
|
157
|
+
margin: 0;
|
|
158
|
+
font: inherit;
|
|
159
|
+
color: inherit;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
outline: none;
|
|
162
|
+
text-align: inherit;
|
|
163
|
+
|
|
164
|
+
position: absolute;
|
|
165
|
+
bottom: ${r.spacing4};
|
|
166
|
+
left: ${r.spacing4};
|
|
167
|
+
z-index: 1;
|
|
168
|
+
`;
|
|
169
|
+
export {
|
|
170
|
+
Z as AssetCard
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=AssetCard.js.map
|