@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/TagItem.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagItem.js","sources":["../../src/filter/filters/tags/TagItem.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { token } from '@bynder/design-system';\nimport { Chip } from '../../../common/components/Chip';\nimport { useAssetFilter } from '../../AssetFilterContext';\nimport { Tag } from '../metaproperty/MetapropertyFilterContent';\n\nexport function TagItem(props: { tag: Tag; isLoading: boolean }) {\n\tconst assetFilterState = useAssetFilter();\n\n\tconst active = assetFilterState.tags.includes(props.tag.name);\n\n\tfunction handleClick() {\n\t\tif (active) {\n\t\t\tassetFilterState.removeTag(props.tag.name);\n\t\t} else if (!props.isLoading) {\n\t\t\tassetFilterState.addTag(props.tag.name);\n\t\t}\n\t}\n\n\treturn (\n\t\t<Chip\n\t\t\tkey={props.tag.id}\n\t\t\tloading={props.isLoading}\n\t\t\tactive={active}\n\t\t\tonClick={handleClick}\n\t\t\tdata-testid=\"tag-item\"\n\t\t>\n\t\t\t<ChipName>{props.tag.name}</ChipName>\n\t\t\t<ChipCount>{props.tag.assetCount}</ChipCount>\n\t\t</Chip>\n\t);\n}\n\nconst ChipName = styled.span`\n\tmax-with: 128px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n`;\n\nconst ChipCount = styled.span`\n\tcolor: rgba(0, 34, 51, 0.5);\n\tmargin-left: ${token.spacing3};\n`;\n"],"names":["TagItem","props","assetFilterState","useAssetFilter","active","handleClick","jsxs","Chip","jsx","ChipName","ChipCount","styled","token"],"mappings":";;;;;AAOO,SAASA,EAAQC,GAAyC;AAChE,QAAMC,IAAmBC,EAAA,GAEnBC,IAASF,EAAiB,KAAK,SAASD,EAAM,IAAI,IAAI;AAE5D,WAASI,IAAc;AACtB,IAAID,IACHF,EAAiB,UAAUD,EAAM,IAAI,IAAI,IAC9BA,EAAM,aACjBC,EAAiB,OAAOD,EAAM,IAAI,IAAI;AAAA,EAExC;AAEA,SACC,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MAEA,SAASN,EAAM;AAAA,MACf,QAAAG;AAAA,MACA,SAASC;AAAA,MACT,eAAY;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAG,EAACC,GAAA,EAAU,UAAAR,EAAM,IAAI,MAAK;AAAA,QAC1B,gBAAAO,EAACE,GAAA,EAAW,UAAAT,EAAM,IAAI,WAAA,CAAW;AAAA,MAAA;AAAA,IAAA;AAAA,IAP5BA,EAAM,IAAI;AAAA,EAAA;AAUlB;AAEA,MAAMQ,IAAWE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOlBD,IAAYC,EAAO;AAAA;AAAA,gBAETC,EAAM,QAAQ;AAAA;"}
|
package/Tags.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as n, jsxs as a, Fragment as e } from "react/jsx-runtime";
|
|
2
|
+
import { styled as s } from "styled-components";
|
|
3
|
+
import { token as i } from "@bynder/design-system";
|
|
4
|
+
import { IconTag as d } from "@bynder/icons";
|
|
5
|
+
import { Dropdown as p } from "./Dropdown.js";
|
|
6
|
+
import { __ as g } from "./index2.js";
|
|
7
|
+
import { TagItem as c } from "./TagItem.js";
|
|
8
|
+
import { Spinner as m } from "./Spinner.js";
|
|
9
|
+
function j(t) {
|
|
10
|
+
const o = l(t.tags);
|
|
11
|
+
return /* @__PURE__ */ n(p, { title: /* @__PURE__ */ n(f, {}), isSmall: !0, fadeIn: !0, children: () => /* @__PURE__ */ a(e, { children: [
|
|
12
|
+
t.isLoading && /* @__PURE__ */ n(m, {}),
|
|
13
|
+
/* @__PURE__ */ a(h, { children: [
|
|
14
|
+
" ",
|
|
15
|
+
g("Tags"),
|
|
16
|
+
" "
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ n(u, { children: o.map((r) => /* @__PURE__ */ n(c, { tag: r, isLoading: t.isLoading }, r.id)) })
|
|
19
|
+
] }) });
|
|
20
|
+
}
|
|
21
|
+
function l(t) {
|
|
22
|
+
return [...t].sort((o, r) => r.assetCount - o.assetCount);
|
|
23
|
+
}
|
|
24
|
+
function f() {
|
|
25
|
+
return /* @__PURE__ */ a(e, { children: [
|
|
26
|
+
/* @__PURE__ */ n(T, {}),
|
|
27
|
+
/* @__PURE__ */ n("span", { "data-testid": "tags-filter", children: g("Tags") })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
const h = s.h1`
|
|
31
|
+
padding: ${i.spacing5} ${i.spacing5} 0 ${i.spacing5};
|
|
32
|
+
margin: 0 0 ${i.spacing5} 0;
|
|
33
|
+
font-size: ${i.fontSize100};
|
|
34
|
+
`, u = s.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
padding: 0 ${i.spacing5};
|
|
38
|
+
padding-bottom: ${i.spacing2};
|
|
39
|
+
`, T = s(d)`
|
|
40
|
+
display: inline;
|
|
41
|
+
margin-right: ${i.spacing3};
|
|
42
|
+
height: ${i.spacing6};
|
|
43
|
+
width: ${i.spacing6};
|
|
44
|
+
`;
|
|
45
|
+
export {
|
|
46
|
+
j as Tags
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=Tags.js.map
|
package/Tags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.js","sources":["../../src/filter/filters/tags/Tags.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { token } from '@bynder/design-system';\nimport { IconTag } from '@bynder/icons';\nimport { Dropdown } from '../../../common/components/dropdown/Dropdown';\nimport { __ } from '../../../localization';\nimport { Tag } from '../metaproperty/MetapropertyFilterContent';\nimport { TagItem } from './TagItem';\nimport { Spinner } from '../../../common/components/Spinner';\n\ninterface Props {\n\ttags: Tag[];\n\tisLoading: boolean;\n}\n\nexport function Tags(props: Props) {\n\tconst sortedTags = sortTags(props.tags);\n\n\treturn (\n\t\t<Dropdown 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> {__('Tags')} </DropdownTitle>\n\t\t\t\t\t<TagsContainer>\n\t\t\t\t\t\t{sortedTags.map((tag) => (\n\t\t\t\t\t\t\t<TagItem key={tag.id} tag={tag} isLoading={props.isLoading} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</TagsContainer>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Dropdown>\n\t);\n}\n\nfunction sortTags(tags: Tag[]) {\n\treturn [...tags].sort((a, b) => b.assetCount - a.assetCount);\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<span data-testid=\"tags-filter\">{__('Tags')}</span>\n\t\t</>\n\t);\n}\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 TagsContainer = styled.div`\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tpadding: 0 ${token.spacing5};\n\tpadding-bottom: ${token.spacing2};\n`;\n\nconst Icon = styled(IconTag)`\n\tdisplay: inline;\n\tmargin-right: ${token.spacing3};\n\theight: ${token.spacing6};\n\twidth: ${token.spacing6};\n`;\n"],"names":["Tags","props","sortedTags","sortTags","jsx","Dropdown","Title","jsxs","Fragment","Spinner","DropdownTitle","__","TagsContainer","tag","TagItem","tags","a","b","Icon","styled","token","IconTag"],"mappings":";;;;;;;;AAeO,SAASA,EAAKC,GAAc;AAClC,QAAMC,IAAaC,EAASF,EAAM,IAAI;AAEtC,SACC,gBAAAG,EAACC,GAAA,EAAS,OAAO,gBAAAD,EAACE,GAAA,CAAA,CAAM,GAAI,SAAO,IAAC,QAAM,IACxC,UAAA,MACA,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAAP,EAAM,+BAAcQ,GAAA,CAAA,CAAQ;AAAA,sBAC5BC,GAAA,EAAc,UAAA;AAAA,MAAA;AAAA,MAAEC,EAAG,MAAM;AAAA,MAAE;AAAA,IAAA,GAAC;AAAA,IAC7B,gBAAAP,EAACQ,GAAA,EACC,UAAAV,EAAW,IAAI,CAACW,MAChB,gBAAAT,EAACU,GAAA,EAAqB,KAAAD,GAAU,WAAWZ,EAAM,UAAA,GAAnCY,EAAI,EAA0C,CAC5D,EAAA,CACF;AAAA,EAAA,EAAA,CACD,EAAA,CAEF;AAEF;AAEA,SAASV,EAASY,GAAa;AAC9B,SAAO,CAAC,GAAGA,CAAI,EAAE,KAAK,CAACC,GAAGC,MAAMA,EAAE,aAAaD,EAAE,UAAU;AAC5D;AAGA,SAASV,IAAQ;AAChB,SACC,gBAAAC,EAAAC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAJ,EAACc,GAAA,EAAK;AAAA,sBACL,QAAA,EAAK,eAAY,eAAe,UAAAP,EAAG,MAAM,EAAA,CAAE;AAAA,EAAA,GAC7C;AAEF;AAEA,MAAMD,IAAgBS,EAAO;AAAA,YACjBC,EAAM,QAAQ,IAAIA,EAAM,QAAQ,MAAMA,EAAM,QAAQ;AAAA,eACjDA,EAAM,QAAQ;AAAA,cACfA,EAAM,WAAW;AAAA,GAGzBR,IAAgBO,EAAO;AAAA;AAAA;AAAA,cAGfC,EAAM,QAAQ;AAAA,mBACTA,EAAM,QAAQ;AAAA,GAG3BF,IAAOC,EAAOE,CAAO;AAAA;AAAA,iBAEVD,EAAM,QAAQ;AAAA,WACpBA,EAAM,QAAQ;AAAA,UACfA,EAAM,QAAQ;AAAA;"}
|
package/Theming.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { css as n, createGlobalStyle as i } from "styled-components";
|
|
2
|
+
const c = (o) => ({
|
|
3
|
+
// Button component
|
|
4
|
+
"--componentButtonPrimaryBorderHover": o?.colorButtonPrimaryHover,
|
|
5
|
+
"--componentButtonPrimaryBorderActive": o?.colorButtonPrimaryActive ?? o?.colorButtonPrimaryHover,
|
|
6
|
+
"--componentButtonPrimaryBorderFocus": o?.colorButtonPrimary,
|
|
7
|
+
"--componentButtonPrimaryColor": o?.colorButtonPrimaryLabel,
|
|
8
|
+
"--componentButtonPrimaryColorHover": o?.colorButtonPrimaryHoverLabel,
|
|
9
|
+
"--componentButtonPrimaryColorActive": o?.colorButtonPrimaryLabel,
|
|
10
|
+
"--componentButtonPrimaryColorFocus": o?.colorButtonPrimaryLabel,
|
|
11
|
+
"--componentButtonPrimaryColorDisabled": o?.colorButtonPrimaryLabel,
|
|
12
|
+
"--componentButtonPrimaryFill": o?.colorButtonPrimary,
|
|
13
|
+
"--componentButtonPrimaryFillHover": o?.colorButtonPrimaryHover,
|
|
14
|
+
"--componentButtonPrimaryFillActive": o?.colorButtonPrimaryActive ?? o?.colorButtonPrimaryHover,
|
|
15
|
+
"--componentButtonPrimaryFillFocus": o?.colorButtonPrimary
|
|
16
|
+
}), u = i`${n`
|
|
17
|
+
.cv-root {
|
|
18
|
+
${(o) => l(o.theme)}
|
|
19
|
+
}:
|
|
20
|
+
`}`;
|
|
21
|
+
function l(o) {
|
|
22
|
+
const r = c(o);
|
|
23
|
+
return Object.entries(r).map((t) => t.join(":")).join(";") + ";";
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
u as ThemeStyles,
|
|
27
|
+
l as stringifyTheme,
|
|
28
|
+
c as themeVariables
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Theming.js.map
|
package/Theming.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Theming.js","sources":["../../src/style/Theming.ts"],"sourcesContent":["import { createGlobalStyle, css } from 'styled-components';\n\nexport interface Theme {\n\tcolorPrimary?: string;\n\tcolorButtonPrimary?: string;\n\tcolorButtonPrimaryLabel?: string;\n\tcolorButtonPrimaryActive?: string;\n\tcolorButtonPrimaryHover?: string;\n\tcolorButtonPrimaryHoverLabel?: string;\n}\n\nexport const themeVariables = (theme?: Theme) => ({\n\t// Button component\n\t'--componentButtonPrimaryBorderHover': theme?.colorButtonPrimaryHover,\n\t'--componentButtonPrimaryBorderActive':\n\t\ttheme?.colorButtonPrimaryActive ?? theme?.colorButtonPrimaryHover,\n\t'--componentButtonPrimaryBorderFocus': theme?.colorButtonPrimary,\n\n\t'--componentButtonPrimaryColor': theme?.colorButtonPrimaryLabel,\n\t'--componentButtonPrimaryColorHover': theme?.colorButtonPrimaryHoverLabel,\n\t'--componentButtonPrimaryColorActive': theme?.colorButtonPrimaryLabel,\n\t'--componentButtonPrimaryColorFocus': theme?.colorButtonPrimaryLabel,\n\t'--componentButtonPrimaryColorDisabled': theme?.colorButtonPrimaryLabel,\n\n\t'--componentButtonPrimaryFill': theme?.colorButtonPrimary,\n\t'--componentButtonPrimaryFillHover': theme?.colorButtonPrimaryHover,\n\t'--componentButtonPrimaryFillActive':\n\t\ttheme?.colorButtonPrimaryActive ?? theme?.colorButtonPrimaryHover,\n\t'--componentButtonPrimaryFillFocus': theme?.colorButtonPrimary,\n});\n\nexport const ThemeStyles = createGlobalStyle<{ theme?: Theme }>`${css`\n\t.cv-root {\n\t\t${(props) => stringifyTheme(props.theme)}\n\t}:\n`}`;\n\nexport function stringifyTheme(theme?: Theme) {\n\tconst themeObject = themeVariables(theme);\n\tconst propertiesAndValues = Object.entries(themeObject).map((i) => {\n\t\treturn i.join(':');\n\t});\n\n\t// Also adds semicolon after the last property\n\treturn propertiesAndValues.join(';') + ';';\n}\n"],"names":["themeVariables","theme","ThemeStyles","createGlobalStyle","css","props","stringifyTheme","themeObject","i"],"mappings":";AAWO,MAAMA,IAAiB,CAACC,OAAmB;AAAA;AAAA,EAEjD,uCAAuCA,GAAO;AAAA,EAC9C,wCACCA,GAAO,4BAA4BA,GAAO;AAAA,EAC3C,uCAAuCA,GAAO;AAAA,EAE9C,iCAAiCA,GAAO;AAAA,EACxC,sCAAsCA,GAAO;AAAA,EAC7C,uCAAuCA,GAAO;AAAA,EAC9C,sCAAsCA,GAAO;AAAA,EAC7C,yCAAyCA,GAAO;AAAA,EAEhD,gCAAgCA,GAAO;AAAA,EACvC,qCAAqCA,GAAO;AAAA,EAC5C,sCACCA,GAAO,4BAA4BA,GAAO;AAAA,EAC3C,qCAAqCA,GAAO;AAC7C,IAEaC,IAAcC,IAAuCC;AAAA;AAAA,IAE9D,CAACC,MAAUC,EAAeD,EAAM,KAAK,CAAC;AAAA;AAAA,CAEzC;AAEM,SAASC,EAAeL,GAAe;AAC7C,QAAMM,IAAcP,EAAeC,CAAK;AAMxC,SAL4B,OAAO,QAAQM,CAAW,EAAE,IAAI,CAACC,MACrDA,EAAE,KAAK,GAAG,CACjB,EAG0B,KAAK,GAAG,IAAI;AACxC;"}
|
package/Toolbar.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as n, Fragment as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import m from "styled-components";
|
|
3
|
+
import { IconExitApp as u, IconCancel as f } from "@bynder/icons";
|
|
4
|
+
import { token as i, Button as l } from "@bynder/design-system";
|
|
5
|
+
import { __ as a } from "./index2.js";
|
|
6
|
+
import { useIsLoggedIn as g, useAuth as h } from "./LoginContext.js";
|
|
7
|
+
import { useModalContext as x } from "./Modal.js";
|
|
8
|
+
import { SearchInput as C } from "./SearchInput.js";
|
|
9
|
+
import { ViewSwitch as I } from "./ViewSwitch.js";
|
|
10
|
+
import { useAssetFilter as v, useHideSwitch as w } from "./ConfigContext.js";
|
|
11
|
+
function z() {
|
|
12
|
+
const e = g(), t = x(), r = h(), s = v(), d = w(), c = s !== void 0 && !s.showToolbar;
|
|
13
|
+
return !e && !t && c ? null : /* @__PURE__ */ n(y, { children: [
|
|
14
|
+
!c && /* @__PURE__ */ n(p, { children: [
|
|
15
|
+
!d && /* @__PURE__ */ o(I, {}),
|
|
16
|
+
/* @__PURE__ */ o(C, {})
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ n(b, { children: [
|
|
19
|
+
e && !r?.hideLogout && /* @__PURE__ */ o(
|
|
20
|
+
l,
|
|
21
|
+
{
|
|
22
|
+
variant: "clean",
|
|
23
|
+
onClick: () => r?.logout(),
|
|
24
|
+
rightIcon: /* @__PURE__ */ o(u, {}),
|
|
25
|
+
children: a("Log out")
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
t && /* @__PURE__ */ o(
|
|
29
|
+
l,
|
|
30
|
+
{
|
|
31
|
+
variant: "clean",
|
|
32
|
+
onClick: () => t.onClose(),
|
|
33
|
+
title: a("Close"),
|
|
34
|
+
icon: /* @__PURE__ */ o(f, {})
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] })
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
const y = m.nav`
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
background: ${i.gray10};
|
|
44
|
+
padding: ${i.spacing4} ${i.spacing4};
|
|
45
|
+
z-index: 30;
|
|
46
|
+
`, b = m.div`
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
margin-left: auto;
|
|
49
|
+
`;
|
|
50
|
+
export {
|
|
51
|
+
z as Toolbar
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=Toolbar.js.map
|
package/Toolbar.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sources":["../../src/toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { IconCancel, IconExitApp } from '@bynder/icons';\nimport { Button, token } from '@bynder/design-system';\n\nimport { __ } from '../localization';\nimport { useAuth, useIsLoggedIn } from '../login/LoginContext';\nimport { useModalContext } from '../common/components/Modal';\nimport { SearchInput } from '../search';\nimport { ViewSwitch } from './ViewSwitch';\nimport { useAssetFilter, useHideSwitch } from '../app-config/ConfigContext';\n\nexport function Toolbar() {\n\tconst isLoggedIn = useIsLoggedIn();\n\tconst modal = useModalContext();\n\tconst auth = useAuth();\n\tconst assetFilter = useAssetFilter();\n\tconst hideSwitch = useHideSwitch();\n\n\t/* If the user provides a predefined filter through the config option, then\n\t * only this filter is used and filtering through the toolbar is disabled. */\n\tconst isFilterPredefined = assetFilter !== undefined && !assetFilter.showToolbar;\n\n\t// Do not render toolbar if there is going to be no contents\n\tif (!isLoggedIn && !modal && isFilterPredefined) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Nav>\n\t\t\t{!isFilterPredefined && (\n\t\t\t\t<>\n\t\t\t\t\t{!hideSwitch && <ViewSwitch />}\n\t\t\t\t\t<SearchInput />\n\t\t\t\t</>\n\t\t\t)}\n\n\t\t\t<ButtonContainer>\n\t\t\t\t{isLoggedIn && !auth?.hideLogout && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\tonClick={() => auth?.logout()}\n\t\t\t\t\t\trightIcon={<IconExitApp />}\n\t\t\t\t\t>\n\t\t\t\t\t\t{__('Log out')}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\n\t\t\t\t{modal && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\tonClick={() => modal.onClose()}\n\t\t\t\t\t\ttitle={__('Close')}\n\t\t\t\t\t\ticon={<IconCancel />}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</ButtonContainer>\n\t\t</Nav>\n\t);\n}\n\nconst Nav = styled.nav`\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tbackground: ${token.gray10};\n\tpadding: ${token.spacing4} ${token.spacing4};\n\tz-index: 30;\n`;\n\nconst ButtonContainer = styled.div`\n\tdisplay: inline-flex;\n\tmargin-left: auto;\n`;\n"],"names":["Toolbar","isLoggedIn","useIsLoggedIn","modal","useModalContext","auth","useAuth","assetFilter","useAssetFilter","hideSwitch","useHideSwitch","isFilterPredefined","Nav","jsxs","Fragment","ViewSwitch","SearchInput","ButtonContainer","jsx","Button","IconExitApp","__","IconCancel","styled","token"],"mappings":";;;;;;;;;;AAYO,SAASA,IAAU;AACzB,QAAMC,IAAaC,EAAA,GACbC,IAAQC,EAAA,GACRC,IAAOC,EAAA,GACPC,IAAcC,EAAA,GACdC,IAAaC,EAAA,GAIbC,IAAqBJ,MAAgB,UAAa,CAACA,EAAY;AAGrE,SAAI,CAACN,KAAc,CAACE,KAASQ,IACrB,yBAINC,GAAA,EACC,UAAA;AAAA,IAAA,CAACD,KACD,gBAAAE,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,CAACL,uBAAeM,GAAA,EAAW;AAAA,wBAC3BC,GAAA,CAAA,CAAY;AAAA,IAAA,GACd;AAAA,sBAGAC,GAAA,EACC,UAAA;AAAA,MAAAhB,KAAc,CAACI,GAAM,cACrB,gBAAAa;AAAA,QAACC;AAAA,QAAA;AAAA,UACA,SAAQ;AAAA,UACR,SAAS,MAAMd,GAAM,OAAA;AAAA,UACrB,6BAAYe,GAAA,EAAY;AAAA,UAEvB,YAAG,SAAS;AAAA,QAAA;AAAA,MAAA;AAAA,MAIdjB,KACA,gBAAAe;AAAA,QAACC;AAAA,QAAA;AAAA,UACA,SAAQ;AAAA,UACR,SAAS,MAAMhB,EAAM,QAAA;AAAA,UACrB,OAAOkB,EAAG,OAAO;AAAA,UACjB,wBAAOC,GAAA,CAAA,CAAW;AAAA,QAAA;AAAA,MAAA;AAAA,IACnB,EAAA,CAEF;AAAA,EAAA,GACD;AAEF;AAEA,MAAMV,IAAMW,EAAO;AAAA;AAAA;AAAA,eAGJC,EAAM,MAAM;AAAA,YACfA,EAAM,QAAQ,IAAIA,EAAM,QAAQ;AAAA;AAAA,GAItCP,IAAkBM,EAAO;AAAA;AAAA;AAAA;"}
|
package/Tooltip.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as l, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { styled as o } from "styled-components";
|
|
3
|
+
import { token as r } from "@bynder/design-system";
|
|
4
|
+
const b = ({
|
|
5
|
+
text: e,
|
|
6
|
+
position: t = "top",
|
|
7
|
+
margin: n,
|
|
8
|
+
marginAmount: a,
|
|
9
|
+
children: s
|
|
10
|
+
}) => /* @__PURE__ */ l(i, { margin: n, marginAmount: a, children: [
|
|
11
|
+
s,
|
|
12
|
+
/* @__PURE__ */ c(p, { position: t, children: e })
|
|
13
|
+
] }), i = o.div`
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
|
|
17
|
+
${({ margin: e, marginAmount: t }) => {
|
|
18
|
+
if (e && t)
|
|
19
|
+
switch (e) {
|
|
20
|
+
case "top":
|
|
21
|
+
return `margin-top: ${r[t]};`;
|
|
22
|
+
case "bottom":
|
|
23
|
+
return `margin-bottom: ${r[t]};`;
|
|
24
|
+
case "left":
|
|
25
|
+
return `margin-left: ${r[t]};`;
|
|
26
|
+
case "right":
|
|
27
|
+
return `margin-right: ${r[t]};`;
|
|
28
|
+
default:
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
return "";
|
|
32
|
+
}}
|
|
33
|
+
`, p = o.span`
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
min-width: max-content;
|
|
36
|
+
background-color: black;
|
|
37
|
+
color: #fff;
|
|
38
|
+
text-align: center;
|
|
39
|
+
border-radius: 5px;
|
|
40
|
+
padding: ${r.spacing3} ${r.spacing4};
|
|
41
|
+
font-size: ${r.fontSize75};
|
|
42
|
+
position: absolute;
|
|
43
|
+
|
|
44
|
+
${({ position: e }) => {
|
|
45
|
+
switch (e) {
|
|
46
|
+
case "bottom":
|
|
47
|
+
return `
|
|
48
|
+
top: calc(100% + 5px);
|
|
49
|
+
left: 50%;
|
|
50
|
+
transform: translateX(-50%);
|
|
51
|
+
`;
|
|
52
|
+
case "left":
|
|
53
|
+
return `
|
|
54
|
+
right: calc(100% + 5px);
|
|
55
|
+
top: 50%;
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
`;
|
|
58
|
+
case "right":
|
|
59
|
+
return `
|
|
60
|
+
left: calc(100% + 5px);
|
|
61
|
+
top: 50%;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
`;
|
|
64
|
+
case "top":
|
|
65
|
+
default:
|
|
66
|
+
return `
|
|
67
|
+
bottom: calc(100% + 5px);
|
|
68
|
+
left: 50%;
|
|
69
|
+
transform: translateX(-50%);
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
|
|
74
|
+
${i}:hover & {
|
|
75
|
+
visibility: visible;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
export {
|
|
79
|
+
b as Tooltip
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=Tooltip.js.map
|
package/Tooltip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../src/common/components/Tooltip.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { styled } from 'styled-components';\nimport { token } from '@bynder/design-system';\n\ntype TooltipPosition = 'top' | 'bottom' | 'left' | 'right';\ntype TooltipMargin = 'top' | 'bottom' | 'left' | 'right';\ntype TooltipMarginAmount = 'spacing1' | 'spacing2' | 'spacing3' | 'spacing4' | 'spacing5';\n\ninterface TooltipProps {\n\ttext: string;\n\tposition?: TooltipPosition;\n\tmargin?: TooltipMargin;\n\tmarginAmount?: TooltipMarginAmount;\n\tchildren?: ReactNode;\n}\nexport const Tooltip = ({\n\ttext,\n\tposition = 'top',\n\tmargin,\n\tmarginAmount,\n\tchildren,\n}: TooltipProps) => {\n\treturn (\n\t\t<TooltipContainer margin={margin} marginAmount={marginAmount}>\n\t\t\t{children}\n\t\t\t<TooltipContent position={position}>{text}</TooltipContent>\n\t\t</TooltipContainer>\n\t);\n};\n\ninterface TooltipContainerProps {\n\tmargin?: TooltipMargin;\n\tmarginAmount?: TooltipMarginAmount;\n}\n\nconst TooltipContainer = styled.div<TooltipContainerProps>`\n\tposition: relative;\n\tdisplay: flex;\n\n\t${({ margin, marginAmount }) => {\n\t\tif (margin && marginAmount) {\n\t\t\tswitch (margin) {\n\t\t\t\tcase 'top':\n\t\t\t\t\treturn `margin-top: ${token[marginAmount]};`;\n\t\t\t\tcase 'bottom':\n\t\t\t\t\treturn `margin-bottom: ${token[marginAmount]};`;\n\t\t\t\tcase 'left':\n\t\t\t\t\treturn `margin-left: ${token[marginAmount]};`;\n\t\t\t\tcase 'right':\n\t\t\t\t\treturn `margin-right: ${token[marginAmount]};`;\n\t\t\t\tdefault:\n\t\t\t\t\treturn '';\n\t\t\t}\n\t\t}\n\n\t\treturn '';\n\t}}\n`;\n\ninterface TooltipContentProps {\n\tposition: TooltipPosition;\n}\n\nconst TooltipContent = styled.span<TooltipContentProps>`\n\tvisibility: hidden;\n\tmin-width: max-content;\n\tbackground-color: black;\n\tcolor: #fff;\n\ttext-align: center;\n\tborder-radius: 5px;\n\tpadding: ${token.spacing3} ${token.spacing4};\n\tfont-size: ${token.fontSize75};\n\tposition: absolute;\n\n\t${({ position }) => {\n\t\tswitch (position) {\n\t\t\tcase 'bottom':\n\t\t\t\treturn `\n top: calc(100% + 5px);\n left: 50%;\n transform: translateX(-50%);\n `;\n\t\t\tcase 'left':\n\t\t\t\treturn `\n right: calc(100% + 5px);\n top: 50%;\n transform: translateY(-50%);\n `;\n\t\t\tcase 'right':\n\t\t\t\treturn `\n left: calc(100% + 5px);\n top: 50%;\n transform: translateY(-50%);\n `;\n\t\t\tcase 'top':\n\t\t\tdefault:\n\t\t\t\treturn `\n bottom: calc(100% + 5px);\n left: 50%;\n transform: translateX(-50%);\n `;\n\t\t}\n\t}}\n\n\t${TooltipContainer}:hover & {\n\t\tvisibility: visible;\n\t}\n`;\n"],"names":["Tooltip","text","position","margin","marginAmount","children","jsxs","TooltipContainer","jsx","TooltipContent","styled","token"],"mappings":";;;AAeO,MAAMA,IAAU,CAAC;AAAA,EACvB,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AACD,MAEE,gBAAAC,EAACC,GAAA,EAAiB,QAAAJ,GAAgB,cAAAC,GAChC,UAAA;AAAA,EAAAC;AAAA,EACD,gBAAAG,EAACC,GAAA,EAAe,UAAAP,GAAqB,UAAAD,EAAA,CAAK;AAAA,GAC3C,GASIM,IAAmBG,EAAO;AAAA;AAAA;AAAA;AAAA,GAI7B,CAAC,EAAE,QAAAP,GAAQ,cAAAC,QAAmB;AAC/B,MAAID,KAAUC;AACb,YAAQD,GAAA;AAAA,MACP,KAAK;AACJ,eAAO,eAAeQ,EAAMP,CAAY,CAAC;AAAA,MAC1C,KAAK;AACJ,eAAO,kBAAkBO,EAAMP,CAAY,CAAC;AAAA,MAC7C,KAAK;AACJ,eAAO,gBAAgBO,EAAMP,CAAY,CAAC;AAAA,MAC3C,KAAK;AACJ,eAAO,iBAAiBO,EAAMP,CAAY,CAAC;AAAA,MAC5C;AACC,eAAO;AAAA,IAAA;AAIV,SAAO;AACR,CAAC;AAAA,GAOIK,IAAiBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAOlBC,EAAM,QAAQ,IAAIA,EAAM,QAAQ;AAAA,cAC9BA,EAAM,UAAU;AAAA;AAAA;AAAA,GAG3B,CAAC,EAAE,UAAAT,QAAe;AACnB,UAAQA,GAAA;AAAA,IACP,KAAK;AACJ,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKR,KAAK;AACJ,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKR,KAAK;AACJ,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKR,KAAK;AAAA,IACL;AACC,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAMV,CAAC;AAAA;AAAA,GAECK,CAAgB;AAAA;AAAA;AAAA;"}
|
package/ViewSwitch.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import m from "styled-components";
|
|
3
|
+
import { token as p, Button as o } from "@bynder/design-system";
|
|
4
|
+
import { __ as r } from "./index2.js";
|
|
5
|
+
import { useRouter as f } from "./useRouterStore.js";
|
|
6
|
+
import { useSimilaritySearchStore as d } from "./useSimilaritySearchStore.js";
|
|
7
|
+
import { useSimilarityAssets as g } from "./getSimilarityAssets.js";
|
|
8
|
+
function A() {
|
|
9
|
+
const [e, s] = f(), { setIsSelected: a, setIsNLSSelected: n } = d(), { resetData: c } = g(), t = () => {
|
|
10
|
+
a(!1), n(!1), c();
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ l(S, { children: [
|
|
13
|
+
/* @__PURE__ */ i(
|
|
14
|
+
o,
|
|
15
|
+
{
|
|
16
|
+
isPressed: e.page === "assets",
|
|
17
|
+
variant: "clean",
|
|
18
|
+
onClick: () => {
|
|
19
|
+
s({ page: "assets" }), t();
|
|
20
|
+
},
|
|
21
|
+
children: r("Assets")
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
/* @__PURE__ */ i(
|
|
25
|
+
o,
|
|
26
|
+
{
|
|
27
|
+
isPressed: e.page === "collections",
|
|
28
|
+
variant: "clean",
|
|
29
|
+
onClick: () => {
|
|
30
|
+
s({ page: "collections" }), t();
|
|
31
|
+
},
|
|
32
|
+
children: r("Collections")
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
const S = m.div`
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
margin-right: auto;
|
|
40
|
+
gap: ${p.spacing2};
|
|
41
|
+
`;
|
|
42
|
+
export {
|
|
43
|
+
A as ViewSwitch
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=ViewSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewSwitch.js","sources":["../../src/toolbar/ViewSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { Button, token } from '@bynder/design-system';\n\nimport { __ } from '../localization';\nimport { useRouter } from '@src/store/useRouterStore';\nimport { useSimilaritySearchStore } from '@src/store/useSimilaritySearchStore';\nimport { useSimilarityAssets } from '@src/api/getSimilarityAssets';\n\nexport function ViewSwitch() {\n\tconst [page, setPage] = useRouter();\n\tconst { setIsSelected, setIsNLSSelected } = useSimilaritySearchStore();\n\tconst { resetData } = useSimilarityAssets();\n\n\tconst resetAISearch = () => {\n\t\tsetIsSelected(false);\n\t\tsetIsNLSSelected(false);\n\t\tresetData();\n\t};\n\n\treturn (\n\t\t<Container>\n\t\t\t<Button\n\t\t\t\tisPressed={page.page === 'assets'}\n\t\t\t\tvariant=\"clean\"\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetPage({ page: 'assets' });\n\t\t\t\t\tresetAISearch();\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{__('Assets')}\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tisPressed={page.page === 'collections'}\n\t\t\t\tvariant=\"clean\"\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetPage({ page: 'collections' });\n\t\t\t\t\tresetAISearch();\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{__('Collections')}\n\t\t\t</Button>\n\t\t</Container>\n\t);\n}\n\nconst Container = styled.div`\n\tdisplay: inline-flex;\n\tmargin-right: auto;\n\tgap: ${token.spacing2};\n`;\n"],"names":["ViewSwitch","page","setPage","useRouter","setIsSelected","setIsNLSSelected","useSimilaritySearchStore","resetData","useSimilarityAssets","resetAISearch","Container","jsx","Button","styled","token"],"mappings":";;;;;;;AASO,SAASA,IAAa;AAC5B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAA,GAClB,EAAE,eAAAC,GAAe,kBAAAC,EAAA,IAAqBC,EAAA,GACtC,EAAE,WAAAC,EAAA,IAAcC,EAAA,GAEhBC,IAAgB,MAAM;AAC3B,IAAAL,EAAc,EAAK,GACnBC,EAAiB,EAAK,GACtBE,EAAA;AAAA,EACD;AAEA,2BACEG,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACA,WAAWX,EAAK,SAAS;AAAA,QACzB,SAAQ;AAAA,QACR,SAAS,MAAM;AACd,UAAAC,EAAQ,EAAE,MAAM,UAAU,GAC1BO,EAAA;AAAA,QACD;AAAA,QAEC,YAAG,QAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEb,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACA,WAAWX,EAAK,SAAS;AAAA,QACzB,SAAQ;AAAA,QACR,SAAS,MAAM;AACd,UAAAC,EAAQ,EAAE,MAAM,eAAe,GAC/BO,EAAA;AAAA,QACD;AAAA,QAEC,YAAG,aAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAClB,GACD;AAEF;AAEA,MAAMC,IAAYG,EAAO;AAAA;AAAA;AAAA,QAGjBC,EAAM,QAAQ;AAAA;"}
|
package/api/filterAssets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from '../auth/result.type';
|
|
2
|
-
import { Ordering } from '
|
|
2
|
+
import { Ordering } from '../store/useOrderingStore';
|
|
3
3
|
import { Collection } from '../views/collection/collection.types';
|
|
4
4
|
import { AssetType, Asset } from '../views/asset/asset.type';
|
|
5
5
|
import { Connection } from './graphql.types';
|
package/api/getCollections.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterOptionsData } from './types/getFilters_new';
|
|
2
|
+
export declare const query = "\nquery getMetapropertyFilterOptions($smartfilterId: String!, $metapropertyId: String!, $cursor: String) {\n filterOptions(smartfilterId: $smartfilterId, metapropertyId: $metapropertyId, cursor: $cursor) {\n metadata {\n nextCursorMark\n }\n metaproperty {\n id,\n name,\n options {\n count,\n zindex,\n name,\n id,\n isSelected,\n label\n },\n showImage,\n type,\n label,\n showCounter,\n zindex\n }\n }\n}";
|
|
3
|
+
export declare const useGetFilterOptions: (options: {
|
|
4
|
+
smartfilterId: string;
|
|
5
|
+
metapropertyId: string;
|
|
6
|
+
}, noCache?: boolean) => {
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
fetchFilterOptions: (cursor: string) => Promise<FilterOptionsData | null | undefined>;
|
|
9
|
+
};
|
package/api/getFilters.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Data } from './graphql.types';
|
|
|
2
2
|
import { Tag } from '../filter/filters/metaproperty/MetapropertyFilterContent';
|
|
3
3
|
import { Filter } from '../filter/AssetFilterContext';
|
|
4
4
|
import { AssetType } from '../views/asset/asset.type';
|
|
5
|
-
import { AssetFilterJson } from '
|
|
5
|
+
import { AssetFilterJson } from '../filter/assetFilter.type';
|
|
6
6
|
export interface GraphqlFiltersResponse {
|
|
7
7
|
searchAssets: {
|
|
8
8
|
count: {
|
|
@@ -19,7 +19,7 @@ export interface GraphqlFiltersResponse {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
export declare const query = "\
|
|
22
|
+
export declare const query = "\n\tquery searchAssets($filter: AssetFilter!, $language: String!) {\n\t\tsearchAssets(filter: $filter) {\n\t\ttags {\n\t\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tassetCount\n\t\t\t}\n\t\t}\n\t\tcount {\n\t\t\tassetType {\n\t\t\timage\n\t\t\tvideo\n\t\t\taudio\n\t\t\tdocument\n\t\t\tarchive\n\t\t\t}\n\t\t}\n\t\t}\n\t}";
|
|
23
23
|
export declare function useGetFilters(options: {
|
|
24
24
|
filter: Filter;
|
|
25
25
|
searchTerm: null | undefined | string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Data } from './graphql.types';
|
|
2
|
+
import { FilterData } from './types/getFilters_new';
|
|
3
|
+
export declare const query = "\nquery getFilters {\n filters {\n smartfilter {\n id,\n icon,\n zindex,\n metaproperties\n labels\n }\n metapropertyFilters {\n metadata {\n nextCursorMark\n }\n metaproperty {\n id,\n name,\n options {\n count,\n zindex,\n name,\n id,\n isSelected,\n label\n },\n showImage,\n type,\n label,\n showCounter,\n zindex,\n\t\t\t\tisMultifilter\n }\n }\n }\n}";
|
|
4
|
+
export declare const useGetFilters: (noCache?: boolean) => {
|
|
5
|
+
data: Data<FilterData>;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Result } from '
|
|
1
|
+
import { Result } from '../auth/result.type';
|
|
2
2
|
import { Assets, GraphqlResponse } from './filterAssets';
|
|
3
3
|
import { Connection } from './graphql.types';
|
|
4
4
|
import { AuthInformationState } from '../auth/useAuthInformation';
|
package/api/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AuthInformationState } from '
|
|
1
|
+
import { AuthInformationState } from '../auth/useAuthInformation';
|
|
2
2
|
export declare function fetchWithGraphql(options: {
|
|
3
3
|
query: string;
|
|
4
|
-
variables
|
|
4
|
+
variables?: Record<string, unknown>;
|
|
5
5
|
auth: AuthInformationState | null;
|
|
6
6
|
noCache?: boolean;
|
|
7
7
|
isNewGQL?: boolean;
|
|
8
|
-
}): Promise<import(
|
|
8
|
+
}): Promise<import('../auth/result.type').Err<any> | import('../auth/result.type').Ok<unknown>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssetType } from '
|
|
2
|
-
import { AuthInformationState } from '
|
|
1
|
+
import { AssetType } from '../../views/asset/asset.type';
|
|
2
|
+
import { AuthInformationState } from '../../auth/useAuthInformation';
|
|
3
3
|
import { selectedSmartfilterOptionsType, AssetCountType } from './types';
|
|
4
4
|
export interface AssetFilter {
|
|
5
5
|
searchTerm?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AuthInformationState } from '
|
|
1
|
+
import { AuthInformationState } from '../../auth/useAuthInformation';
|
|
2
2
|
export declare const getInitialFilters: ({ auth }: {
|
|
3
3
|
auth: AuthInformationState | null;
|
|
4
4
|
}) => Promise<{
|
|
5
|
-
filters: import(
|
|
5
|
+
filters: import('./types').Smartfilter[];
|
|
6
6
|
metaproperties: {};
|
|
7
7
|
}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface Labels {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export interface MetapropertyOption {
|
|
5
|
+
count: number;
|
|
6
|
+
zindex: number;
|
|
7
|
+
name: string;
|
|
8
|
+
id: string;
|
|
9
|
+
isSelected: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Metaproperty {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
options: MetapropertyOption[];
|
|
16
|
+
showImage: boolean;
|
|
17
|
+
type: string;
|
|
18
|
+
label: string;
|
|
19
|
+
showCounter: boolean;
|
|
20
|
+
zindex: number;
|
|
21
|
+
isMultifilter: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FilterMetadata {
|
|
24
|
+
nextCursorMark: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MetapropertyFilter {
|
|
27
|
+
metadata: FilterMetadata;
|
|
28
|
+
metaproperty: Metaproperty;
|
|
29
|
+
}
|
|
30
|
+
export interface SmartFilter {
|
|
31
|
+
id: string;
|
|
32
|
+
icon: string;
|
|
33
|
+
zindex: number;
|
|
34
|
+
metaproperties: string[];
|
|
35
|
+
labels: Labels;
|
|
36
|
+
}
|
|
37
|
+
export interface Filters {
|
|
38
|
+
smartfilter: SmartFilter;
|
|
39
|
+
metapropertyFilters: MetapropertyFilter[];
|
|
40
|
+
}
|
|
41
|
+
export interface FilterData {
|
|
42
|
+
filters: Filters[];
|
|
43
|
+
}
|
|
44
|
+
export interface FilterResponse {
|
|
45
|
+
data: FilterData;
|
|
46
|
+
}
|
|
47
|
+
export interface FilterOptions {
|
|
48
|
+
metadata: FilterMetadata;
|
|
49
|
+
metaproperty: Metaproperty;
|
|
50
|
+
}
|
|
51
|
+
export interface FilterOptionsData {
|
|
52
|
+
filterOptions: FilterOptions;
|
|
53
|
+
}
|
|
54
|
+
export interface FilterOptionsResponse {
|
|
55
|
+
data: FilterOptionsData;
|
|
56
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Config as ProvidedConfig, SelectionMode } from './appConfig.type';
|
|
3
|
-
type Config = Required<Pick<ProvidedConfig, 'language' | 'onSuccess' | 'assetTypes'>> & Pick<ProvidedConfig, 'assetFieldSelection' | 'assetFilter' | 'hideExternalAccess' | 'theme' | 'mode' | 'hideSwitch' | '__shouldAddOriginal__' | 'noCache' | 'selectAllOption'> & {
|
|
2
|
+
type Config = Required<Pick<ProvidedConfig, 'language' | 'onSuccess' | 'assetTypes'>> & Pick<ProvidedConfig, 'assetFieldSelection' | 'assetFilter' | 'hideExternalAccess' | 'defaultImageDerivativeName' | 'defaultVideoDerivativeName' | 'theme' | 'mode' | 'hideSwitch' | '__shouldAddOriginal__' | 'noCache' | 'selectAllOption'> & {
|
|
4
3
|
selectionMode: SelectionMode;
|
|
5
4
|
};
|
|
6
5
|
export declare const defaultConfig: Config;
|
|
7
|
-
export declare const ConfigProvider: import(
|
|
6
|
+
export declare const ConfigProvider: import('react').Provider<Config>;
|
|
8
7
|
export declare const useConfig: () => Config;
|
|
9
|
-
export declare const useTheme: () => import(
|
|
10
|
-
export declare const useAssetFilter: () => import(
|
|
8
|
+
export declare const useTheme: () => import('..').theme | undefined;
|
|
9
|
+
export declare const useAssetFilter: () => import('..').assetFilter | undefined;
|
|
11
10
|
export declare const useSelectionMode: () => SelectionMode;
|
|
12
11
|
export declare const useHideSwitch: () => boolean | undefined;
|
|
13
12
|
export {};
|
|
@@ -24,6 +24,8 @@ export interface Config {
|
|
|
24
24
|
container?: HTMLElement;
|
|
25
25
|
language?: string;
|
|
26
26
|
onSuccess?: OnSuccessCallback;
|
|
27
|
+
defaultImageDerivativeName?: string;
|
|
28
|
+
defaultVideoDerivativeName?: string;
|
|
27
29
|
mode?: SelectionMode;
|
|
28
30
|
portal?: PortalConfig;
|
|
29
31
|
defaultSearchTerm?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Config } from
|
|
1
|
+
import { Config } from './appConfig.type';
|
|
2
2
|
export declare function validateConfig(obj: any, argumentName?: string): obj is Config;
|
package/asset.type.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IconArchive as o, IconVideocam as c, IconCamera as n, IconFile as t, IconVolumeUp as I } from "@bynder/icons";
|
|
2
|
+
import { __ as i } from "./index2.js";
|
|
3
|
+
function a(e) {
|
|
4
|
+
const r = {
|
|
5
|
+
AUDIO: "Audio",
|
|
6
|
+
DOCUMENT: "Document",
|
|
7
|
+
IMAGE: "Image",
|
|
8
|
+
VIDEO: "Video",
|
|
9
|
+
ARCHIVE: "Archive"
|
|
10
|
+
}[e];
|
|
11
|
+
return i(r);
|
|
12
|
+
}
|
|
13
|
+
function A(e) {
|
|
14
|
+
switch (e) {
|
|
15
|
+
case "AUDIO":
|
|
16
|
+
return I;
|
|
17
|
+
case "DOCUMENT":
|
|
18
|
+
return t;
|
|
19
|
+
case "IMAGE":
|
|
20
|
+
return n;
|
|
21
|
+
case "VIDEO":
|
|
22
|
+
return c;
|
|
23
|
+
case "ARCHIVE":
|
|
24
|
+
return o;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
a as assetTypeToString,
|
|
29
|
+
A as getAssetTypeIcon
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=asset.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.type.js","sources":["../../src/views/asset/asset.type.ts"],"sourcesContent":["import { IconFile, IconCamera, IconVideocam, IconVolumeUp, IconArchive } from '@bynder/icons';\nimport { MetapropertyType } from '../../filter/filters/metaproperty/MetapropertyFilterContent';\nimport { __ } from '../../localization';\nimport { File } from '../../select/file.type';\n\nexport type AssetType = 'AUDIO' | 'DOCUMENT' | 'IMAGE' | 'VIDEO' | 'ARCHIVE';\n\nexport type AssetData =\n\t| { tag: 'Loading'; value: undefined | Asset[] }\n\t| { tag: 'Loaded'; value: Asset[] };\n\nexport function assetTypeToString(type: AssetType): string {\n\tconst typeKey = {\n\t\tAUDIO: 'Audio',\n\t\tDOCUMENT: 'Document',\n\t\tIMAGE: 'Image',\n\t\tVIDEO: 'Video',\n\t\tARCHIVE: 'Archive',\n\t}[type];\n\n\treturn __(typeKey);\n}\n\nexport function getAssetTypeIcon(type: AssetType) {\n\tswitch (type) {\n\t\tcase 'AUDIO':\n\t\t\treturn IconVolumeUp;\n\t\tcase 'DOCUMENT':\n\t\t\treturn IconFile;\n\t\tcase 'IMAGE':\n\t\t\treturn IconCamera;\n\t\tcase 'VIDEO':\n\t\t\treturn IconVideocam;\n\t\tcase 'ARCHIVE':\n\t\t\treturn IconArchive;\n\t}\n}\n\ninterface Derivatives {\n\tthumbnail?: string;\n}\n\nexport interface TextMetapropertiesType {\n\tname: string;\n\tvalue: string;\n\tlabel: string;\n\ttype: string;\n\tzIndex: number;\n\tshowInGridView: boolean;\n\tshowInListView: boolean;\n}\n\nexport interface Asset {\n\t__typename: string;\n\tid: string;\n\tdatabaseId: string;\n\tderivatives: Derivatives;\n\textensions: string[];\n\tname: string;\n\turl: string;\n\tisArchived: boolean;\n\tisWatermarked: boolean;\n\tisLimitedUse: boolean;\n\tsimilarityScore?: number;\n\tmetaproperties?: {\n\t\tnodes: MetapropertyType[];\n\t};\n\ttextMetaproperties?: TextMetapropertiesType[];\n\tfiles: Record<string, File>;\n\tstreamingLinks?: {\n\t\thls: string;\n\t\tdash: string;\n\t};\n}\n"],"names":["assetTypeToString","type","typeKey","__","getAssetTypeIcon","IconVolumeUp","IconFile","IconCamera","IconVideocam","IconArchive"],"mappings":";;AAWO,SAASA,EAAkBC,GAAyB;AAC1D,QAAMC,IAAU;AAAA,IACf,OAAO;AAAA,IACP,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA,EAAA,EACRD,CAAI;AAEN,SAAOE,EAAGD,CAAO;AAClB;AAEO,SAASE,EAAiBH,GAAiB;AACjD,UAAQA,GAAA;AAAA,IACP,KAAK;AACJ,aAAOI;AAAA,IACR,KAAK;AACJ,aAAOC;AAAA,IACR,KAAK;AACJ,aAAOC;AAAA,IACR,KAAK;AACJ,aAAOC;AAAA,IACR,KAAK;AACJ,aAAOC;AAAA,EAAA;AAEV;"}
|
package/asyncDebounce.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const i = (t, n) => {
|
|
2
|
+
let e;
|
|
3
|
+
return function(...o) {
|
|
4
|
+
return e && clearTimeout(e), new Promise((c, u) => {
|
|
5
|
+
e = setTimeout(() => {
|
|
6
|
+
t(...o).then(c).catch(u);
|
|
7
|
+
}, n);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
i as debounceAsync
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=asyncDebounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncDebounce.js","sources":["../../src/utils/asyncDebounce.ts"],"sourcesContent":["export const debounceAsync = (fn, wait) => {\n\tlet timeoutId: ReturnType<typeof setTimeout>;\n\n\treturn function debounce(...args) {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\tfn(...args)\n\t\t\t\t\t.then(resolve)\n\t\t\t\t\t.catch(reject);\n\t\t\t}, wait);\n\t\t});\n\t};\n};\n"],"names":["debounceAsync","fn","wait","timeoutId","args","resolve","reject"],"mappings":"AAAO,MAAMA,IAAgB,CAACC,GAAIC,MAAS;AAC1C,MAAIC;AAEJ,SAAO,YAAqBC,GAAM;AACjC,WAAID,KACH,aAAaA,CAAS,GAGhB,IAAI,QAAQ,CAACE,GAASC,MAAW;AACvC,MAAAH,IAAY,WAAW,MAAM;AAC5B,QAAAF,EAAG,GAAGG,CAAI,EACR,KAAKC,CAAO,EACZ,MAAMC,CAAM;AAAA,MACf,GAAGJ,CAAI;AAAA,IACR,CAAC;AAAA,EACF;AACD;"}
|
package/auth.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { randomString as i, sha256 as d, base64URLEncode as g } from "./crypto.js";
|
|
2
|
+
import { waitForAuthorizationFromLoginWindow as k } from "./loginwindow.js";
|
|
3
|
+
import { makeAuthorizeRequestUrl as R, postTokenRequest as w } from "./oauth2.js";
|
|
4
|
+
import { err as s, isErr as u, ok as v } from "./result.type.js";
|
|
5
|
+
async function E(r) {
|
|
6
|
+
const o = i();
|
|
7
|
+
let n;
|
|
8
|
+
try {
|
|
9
|
+
n = await d(o);
|
|
10
|
+
} catch (p) {
|
|
11
|
+
return s(p.toString());
|
|
12
|
+
}
|
|
13
|
+
const c = g(n), a = i(), l = R(c, a, r), e = await k(l);
|
|
14
|
+
if (u(e))
|
|
15
|
+
return e;
|
|
16
|
+
if (e.value.state !== a || e.value.code === null)
|
|
17
|
+
return s("Error logging in");
|
|
18
|
+
const t = await w(
|
|
19
|
+
e.value.code,
|
|
20
|
+
o,
|
|
21
|
+
r
|
|
22
|
+
);
|
|
23
|
+
if (u(t))
|
|
24
|
+
return t;
|
|
25
|
+
const { refreshToken: f, accessToken: m, expiresIn: h } = t.value;
|
|
26
|
+
return v({
|
|
27
|
+
accessToken: m,
|
|
28
|
+
expiresIn: parseFloat(h),
|
|
29
|
+
refreshToken: f
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
E as authenticate
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=auth.js.map
|
package/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../src/auth/auth.ts"],"sourcesContent":["import { base64URLEncode, randomString, sha256 } from './crypto';\nimport { waitForAuthorizationFromLoginWindow } from './loginwindow';\nimport { makeAuthorizeRequestUrl, postTokenRequest } from './oauth2';\nimport { err, isErr, ok, Result } from './result.type';\n\nexport interface AuthenticationResponse {\n\taccessToken: string;\n\trefreshToken: string;\n\texpiresIn: number;\n}\n\nexport async function authenticate(\n\taccountDomain: string,\n): Promise<Result<AuthenticationResponse, string>> {\n\tconst codeVerifier = randomString();\n\n\tlet codeChallenge;\n\n\ttry {\n\t\tcodeChallenge = await sha256(codeVerifier);\n\t} catch (e) {\n\t\treturn err(e.toString());\n\t}\n\n\tconst base64CodeChallenge = base64URLEncode(codeChallenge);\n\tconst state = randomString();\n\n\tconst url = makeAuthorizeRequestUrl(base64CodeChallenge, state, accountDomain);\n\n\tconst authorizationResult = await waitForAuthorizationFromLoginWindow(url);\n\n\tif (isErr(authorizationResult)) {\n\t\treturn authorizationResult;\n\t}\n\n\tif (authorizationResult.value.state !== state || authorizationResult.value.code === null) {\n\t\treturn err('Error logging in');\n\t}\n\n\tconst tokenRequestResult = await postTokenRequest(\n\t\tauthorizationResult.value.code,\n\t\tcodeVerifier,\n\t\taccountDomain,\n\t);\n\n\tif (isErr(tokenRequestResult)) {\n\t\treturn tokenRequestResult;\n\t}\n\n\tconst { refreshToken, accessToken, expiresIn } = tokenRequestResult.value;\n\n\treturn ok({\n\t\taccessToken,\n\t\texpiresIn: parseFloat(expiresIn),\n\t\trefreshToken,\n\t});\n}\n"],"names":["authenticate","accountDomain","codeVerifier","randomString","codeChallenge","sha256","e","err","base64CodeChallenge","base64URLEncode","state","url","makeAuthorizeRequestUrl","authorizationResult","waitForAuthorizationFromLoginWindow","isErr","tokenRequestResult","postTokenRequest","refreshToken","accessToken","expiresIn","ok"],"mappings":";;;;AAWA,eAAsBA,EACrBC,GACkD;AAClD,QAAMC,IAAeC,EAAA;AAErB,MAAIC;AAEJ,MAAI;AACH,IAAAA,IAAgB,MAAMC,EAAOH,CAAY;AAAA,EAC1C,SAASI,GAAG;AACX,WAAOC,EAAID,EAAE,UAAU;AAAA,EACxB;AAEA,QAAME,IAAsBC,EAAgBL,CAAa,GACnDM,IAAQP,EAAA,GAERQ,IAAMC,EAAwBJ,GAAqBE,GAAOT,CAAa,GAEvEY,IAAsB,MAAMC,EAAoCH,CAAG;AAEzE,MAAII,EAAMF,CAAmB;AAC5B,WAAOA;AAGR,MAAIA,EAAoB,MAAM,UAAUH,KAASG,EAAoB,MAAM,SAAS;AACnF,WAAON,EAAI,kBAAkB;AAG9B,QAAMS,IAAqB,MAAMC;AAAA,IAChCJ,EAAoB,MAAM;AAAA,IAC1BX;AAAA,IACAD;AAAA,EAAA;AAGD,MAAIc,EAAMC,CAAkB;AAC3B,WAAOA;AAGR,QAAM,EAAE,cAAAE,GAAc,aAAAC,GAAa,WAAAC,EAAA,IAAcJ,EAAmB;AAEpE,SAAOK,EAAG;AAAA,IACT,aAAAF;AAAA,IACA,WAAW,WAAWC,CAAS;AAAA,IAC/B,cAAAF;AAAA,EAAA,CACA;AACF;"}
|