@bynder/compact-view 5.1.3 → 5.1.4
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 +1 -1
- package/App.js +89 -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 +158 -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.js +148 -0
- package/Autocomplete.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 +239 -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.js +50 -0
- package/Option.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.js +91 -0
- package/SmartFilterSelect.js.map +1 -0
- package/Smartfilters.js +186 -0
- package/Smartfilters.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/getFilters.d.ts +1 -1
- package/api/getSimilarityAssets.d.ts +1 -1
- package/api/index.d.ts +2 -2
- 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/app-config/ConfigContext.d.ts +3 -4
- 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/autocomplete2.js +25 -0
- package/autocomplete2.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/Option.d.ts +2 -2
- package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect.d.ts +2 -2
- package/filter/filters/smartfilters/Smartfilters.d.ts +2 -2
- package/filter/filters/tags/TagItem.d.ts +1 -1
- package/filter/filters/tags/Tags.d.ts +1 -1
- package/filterAssets.js +175 -0
- package/filterAssets.js.map +1 -0
- package/filterEmptyMetaproperties.js +11 -0
- package/filterEmptyMetaproperties.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 +78 -0
- package/getCollections.js.map +1 -0
- package/getFilters.js +84 -0
- package/getFilters.js.map +1 -0
- package/getInitialFilters.js +51 -0
- package/getInitialFilters.js.map +1 -0
- package/getMetapropertiesOptions.js +31 -0
- package/getMetapropertiesOptions.js.map +1 -0
- package/getSimilarityAssets.js +141 -0
- package/getSimilarityAssets.js.map +1 -0
- package/handlers.js +11 -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 +36 -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/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/LoginContext.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as x, useContext as g, useState as C, useEffect as c } from "react";
|
|
3
|
+
import { authenticate as I } from "./auth.js";
|
|
4
|
+
import { useAuthInformation as D } from "./useAuthInformation.js";
|
|
5
|
+
import { useLocalization as v } from "./index2.js";
|
|
6
|
+
import { ShadowRoot as w } from "./ShadowRoot.js";
|
|
7
|
+
import { LoginComponent as y } from "./LoginComponent.js";
|
|
8
|
+
import { isOk as R } from "./result.type.js";
|
|
9
|
+
import { logger as m } from "./logger.js";
|
|
10
|
+
import { useAccountDomain as E } from "./useAccountDomain.js";
|
|
11
|
+
import { Shield as M } from "./Shield.js";
|
|
12
|
+
import { RefreshingSpinner as j } from "./RefreshingSpinner.js";
|
|
13
|
+
const r = x(null);
|
|
14
|
+
function z(t) {
|
|
15
|
+
v(t.language ?? "en_US");
|
|
16
|
+
const [i, s, f] = D(), [o, l, d] = E(
|
|
17
|
+
t.portal?.url ?? i.accountDomain
|
|
18
|
+
), [a, h] = C(!1);
|
|
19
|
+
c(() => {
|
|
20
|
+
t.authentication?.hideLogout && !t.authentication?.getAccessToken && m.error(
|
|
21
|
+
"The hideLogout property can only be used in combination with getAccessToken property"
|
|
22
|
+
);
|
|
23
|
+
}, [t.authentication?.hideLogout, t.authentication?.getAccessToken]), c(() => {
|
|
24
|
+
t.authentication?.getAccessToken && s({
|
|
25
|
+
getAccessToken: t.authentication.getAccessToken,
|
|
26
|
+
accountDomain: t.portal?.url
|
|
27
|
+
});
|
|
28
|
+
}, [t.authentication?.getAccessToken]), c(() => {
|
|
29
|
+
let e = !0;
|
|
30
|
+
return a === !0 && I(o).then((u) => {
|
|
31
|
+
e && (A(u), h(!1));
|
|
32
|
+
}), () => {
|
|
33
|
+
e = !1;
|
|
34
|
+
};
|
|
35
|
+
}, [a, o]);
|
|
36
|
+
function A(e) {
|
|
37
|
+
if (R(e)) {
|
|
38
|
+
const { accessToken: u, refreshToken: S, expiresIn: b } = e.value;
|
|
39
|
+
s({
|
|
40
|
+
getAccessToken: () => u,
|
|
41
|
+
refreshToken: S,
|
|
42
|
+
expiresIn: b,
|
|
43
|
+
accountDomain: o
|
|
44
|
+
});
|
|
45
|
+
} else
|
|
46
|
+
m.error(e.error);
|
|
47
|
+
}
|
|
48
|
+
function k() {
|
|
49
|
+
h(!0);
|
|
50
|
+
}
|
|
51
|
+
function L() {
|
|
52
|
+
f(), t.onLogout?.();
|
|
53
|
+
}
|
|
54
|
+
const T = {
|
|
55
|
+
...i,
|
|
56
|
+
logout: L,
|
|
57
|
+
hideLogout: !!t.authentication?.getAccessToken && t.authentication.hideLogout
|
|
58
|
+
};
|
|
59
|
+
switch (i.status) {
|
|
60
|
+
case "authenticated":
|
|
61
|
+
return /* @__PURE__ */ n(r.Provider, { value: T, children: t.children });
|
|
62
|
+
case "not-authenticated":
|
|
63
|
+
return /* @__PURE__ */ n(w, { isContainerMode: !0, children: /* @__PURE__ */ n(
|
|
64
|
+
y,
|
|
65
|
+
{
|
|
66
|
+
domainValue: o,
|
|
67
|
+
domainStatus: d,
|
|
68
|
+
onChangeDomain: l,
|
|
69
|
+
isSubmitting: a,
|
|
70
|
+
isEditable: t.portal?.editable ?? !0,
|
|
71
|
+
onSubmit: k
|
|
72
|
+
}
|
|
73
|
+
) });
|
|
74
|
+
case "refreshing":
|
|
75
|
+
return /* @__PURE__ */ n(j, {});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const K = (t) => /* @__PURE__ */ n(M, { children: /* @__PURE__ */ n(z, { ...t }) }), N = () => g(r)?.status === "authenticated" || !1, Q = () => g(r);
|
|
79
|
+
export {
|
|
80
|
+
r as AuthContext,
|
|
81
|
+
K as Login,
|
|
82
|
+
Q as useAuth,
|
|
83
|
+
N as useIsLoggedIn
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=LoginContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginContext.js","sources":["../../src/login/LoginContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState } from 'react';\n\nimport { authenticate, AuthenticationResponse } from '../auth/auth';\nimport { useAuthInformation, AuthInformationState } from '../auth/useAuthInformation';\nimport { useLocalization } from '../localization';\nimport { ShadowRoot } from '../style/shadowroot/ShadowRoot';\nimport { LoginComponent } from './LoginComponent';\nimport { isOk, Result } from '../auth/result.type';\nimport { logger } from '../utils/logger';\nimport { useAccountDomain } from './useAccountDomain';\nimport { Shield } from '../error-handling/Shield';\nimport { Config, PortalConfig } from '../app-config/appConfig.type';\nimport { RefreshingSpinner } from './components/RefreshingSpinner';\n\ntype ContextValue = AuthInformationState & { logout: () => void; hideLogout?: boolean };\n\nexport const AuthContext = createContext<ContextValue | null>(null);\n\ninterface Props {\n\tportal?: PortalConfig;\n\tlanguage?: string;\n\tchildren: React.ReactNode;\n\tauthentication?: Config['authentication'];\n\tonLogout?: Config['onLogout'];\n}\n\nfunction Login(props: Props) {\n\tuseLocalization(props.language ?? 'en_US');\n\tconst [auth, setAuth, resetAuth] = useAuthInformation();\n\tconst [domainInput, setDomainInput, domainStatus] = useAccountDomain(\n\t\tprops.portal?.url ?? auth.accountDomain,\n\t);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (props.authentication?.hideLogout && !props.authentication?.getAccessToken) {\n\t\t\tlogger.error(\n\t\t\t\t'The hideLogout property can only be used in combination with getAccessToken property',\n\t\t\t);\n\t\t}\n\t}, [props.authentication?.hideLogout, props.authentication?.getAccessToken]);\n\n\tuseEffect(() => {\n\t\tif (props.authentication?.getAccessToken) {\n\t\t\t// authenticate by provided accessToken\n\t\t\tsetAuth({\n\t\t\t\tgetAccessToken: props.authentication.getAccessToken,\n\t\t\t\taccountDomain: props.portal?.url,\n\t\t\t});\n\t\t}\n\t\t// We only want to set the authentication if getAccessToken changes.\n\t\t// If the portal changes, the user will be able to provide their\n\t\t// credentials and we retrieve an accessToken via that process.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [props.authentication?.getAccessToken]);\n\n\tuseEffect(() => {\n\t\tlet isMounted = true;\n\n\t\tif (isSubmitting === true) {\n\t\t\tauthenticate(domainInput).then((result) => {\n\t\t\t\t// Make sure that state is only set if component is still mounted\n\t\t\t\tif (isMounted) {\n\t\t\t\t\tsetResult(result);\n\t\t\t\t\tsetIsSubmitting(false);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Clean up\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [isSubmitting, domainInput]); // eslint-disable-line react-hooks/exhaustive-deps\n\n\tfunction setResult(result: Result<AuthenticationResponse, string>) {\n\t\tif (isOk(result)) {\n\t\t\tconst { accessToken, refreshToken, expiresIn } = result.value;\n\t\t\tsetAuth({\n\t\t\t\tgetAccessToken: () => accessToken,\n\t\t\t\trefreshToken,\n\t\t\t\texpiresIn,\n\t\t\t\taccountDomain: domainInput,\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.error(result.error);\n\t\t}\n\t}\n\n\tfunction login() {\n\t\t// Setting isSubmitting to true will start authentication in useEffect\n\t\tsetIsSubmitting(true);\n\t}\n\n\tfunction logout() {\n\t\tresetAuth();\n\n\t\tprops.onLogout?.();\n\t}\n\n\tconst authContext = {\n\t\t...auth,\n\t\tlogout,\n\t\thideLogout: !!props.authentication?.getAccessToken && props.authentication.hideLogout,\n\t};\n\n\tswitch (auth.status) {\n\t\tcase 'authenticated':\n\t\t\treturn (\n\t\t\t\t<AuthContext.Provider value={authContext}>{props.children}</AuthContext.Provider>\n\t\t\t);\n\n\t\tcase 'not-authenticated':\n\t\t\treturn (\n\t\t\t\t<ShadowRoot isContainerMode>\n\t\t\t\t\t<LoginComponent\n\t\t\t\t\t\tdomainValue={domainInput}\n\t\t\t\t\t\tdomainStatus={domainStatus}\n\t\t\t\t\t\tonChangeDomain={setDomainInput}\n\t\t\t\t\t\tisSubmitting={isSubmitting}\n\t\t\t\t\t\tisEditable={props.portal?.editable ?? true}\n\t\t\t\t\t\tonSubmit={login}\n\t\t\t\t\t/>\n\t\t\t\t</ShadowRoot>\n\t\t\t);\n\n\t\tcase 'refreshing':\n\t\t\treturn <RefreshingSpinner />;\n\t}\n}\n\n// eslint-disable-next-line react/no-multi-comp\nconst LoginWithShield = (props: Props) => (\n\t<Shield>\n\t\t<Login {...props} />\n\t</Shield>\n);\n\nexport { LoginWithShield as Login };\n\nexport const useIsLoggedIn = () => useContext(AuthContext)?.status === 'authenticated' || false;\nexport const useAuth = () => useContext(AuthContext);\n"],"names":["AuthContext","createContext","Login","props","useLocalization","auth","setAuth","resetAuth","useAuthInformation","domainInput","setDomainInput","domainStatus","useAccountDomain","isSubmitting","setIsSubmitting","useState","useEffect","logger","isMounted","authenticate","result","setResult","isOk","accessToken","refreshToken","expiresIn","login","logout","authContext","jsx","ShadowRoot","LoginComponent","RefreshingSpinner","LoginWithShield","Shield","useIsLoggedIn","useContext","useAuth"],"mappings":";;;;;;;;;;;;AAgBO,MAAMA,IAAcC,EAAmC,IAAI;AAUlE,SAASC,EAAMC,GAAc;AAC5B,EAAAC,EAAgBD,EAAM,YAAY,OAAO;AACzC,QAAM,CAACE,GAAMC,GAASC,CAAS,IAAIC,EAAA,GAC7B,CAACC,GAAaC,GAAgBC,CAAY,IAAIC;AAAA,IACnDT,EAAM,QAAQ,OAAOE,EAAK;AAAA,EAAA,GAErB,CAACQ,GAAcC,CAAe,IAAIC,EAAS,EAAK;AAEtD,EAAAC,EAAU,MAAM;AACf,IAAIb,EAAM,gBAAgB,cAAc,CAACA,EAAM,gBAAgB,kBAC9Dc,EAAO;AAAA,MACN;AAAA,IAAA;AAAA,EAGH,GAAG,CAACd,EAAM,gBAAgB,YAAYA,EAAM,gBAAgB,cAAc,CAAC,GAE3Ea,EAAU,MAAM;AACf,IAAIb,EAAM,gBAAgB,kBAEzBG,EAAQ;AAAA,MACP,gBAAgBH,EAAM,eAAe;AAAA,MACrC,eAAeA,EAAM,QAAQ;AAAA,IAAA,CAC7B;AAAA,EAMH,GAAG,CAACA,EAAM,gBAAgB,cAAc,CAAC,GAEzCa,EAAU,MAAM;AACf,QAAIE,IAAY;AAEhB,WAAIL,MAAiB,MACpBM,EAAaV,CAAW,EAAE,KAAK,CAACW,MAAW;AAE1C,MAAIF,MACHG,EAAUD,CAAM,GAChBN,EAAgB,EAAK;AAAA,IAEvB,CAAC,GAIK,MAAM;AACZ,MAAAI,IAAY;AAAA,IACb;AAAA,EACD,GAAG,CAACL,GAAcJ,CAAW,CAAC;AAE9B,WAASY,EAAUD,GAAgD;AAClE,QAAIE,EAAKF,CAAM,GAAG;AACjB,YAAM,EAAE,aAAAG,GAAa,cAAAC,GAAc,WAAAC,EAAA,IAAcL,EAAO;AACxD,MAAAd,EAAQ;AAAA,QACP,gBAAgB,MAAMiB;AAAA,QACtB,cAAAC;AAAA,QACA,WAAAC;AAAA,QACA,eAAehB;AAAA,MAAA,CACf;AAAA,IACF;AACC,MAAAQ,EAAO,MAAMG,EAAO,KAAK;AAAA,EAE3B;AAEA,WAASM,IAAQ;AAEhB,IAAAZ,EAAgB,EAAI;AAAA,EACrB;AAEA,WAASa,IAAS;AACjB,IAAApB,EAAA,GAEAJ,EAAM,WAAA;AAAA,EACP;AAEA,QAAMyB,IAAc;AAAA,IACnB,GAAGvB;AAAA,IACH,QAAAsB;AAAA,IACA,YAAY,CAAC,CAACxB,EAAM,gBAAgB,kBAAkBA,EAAM,eAAe;AAAA,EAAA;AAG5E,UAAQE,EAAK,QAAA;AAAA,IACZ,KAAK;AACJ,+BACEL,EAAY,UAAZ,EAAqB,OAAO4B,GAAc,YAAM,UAAS;AAAA,IAG5D,KAAK;AACJ,aACC,gBAAAC,EAACC,GAAA,EAAW,iBAAe,IAC1B,UAAA,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACA,aAAatB;AAAA,UACb,cAAAE;AAAA,UACA,gBAAgBD;AAAA,UAChB,cAAAG;AAAA,UACA,YAAYV,EAAM,QAAQ,YAAY;AAAA,UACtC,UAAUuB;AAAA,QAAA;AAAA,MAAA,GAEZ;AAAA,IAGF,KAAK;AACJ,+BAAQM,GAAA,EAAkB;AAAA,EAAA;AAE7B;AAGA,MAAMC,IAAkB,CAAC9B,MACxB,gBAAA0B,EAACK,KACA,UAAA,gBAAAL,EAAC3B,GAAA,EAAO,GAAGC,EAAA,CAAO,EAAA,CACnB,GAKYgC,IAAgB,MAAMC,EAAWpC,CAAW,GAAG,WAAW,mBAAmB,IAC7EqC,IAAU,MAAMD,EAAWpC,CAAW;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import i from "styled-components";
|
|
3
|
+
import { token as o } from "@bynder/design-system";
|
|
4
|
+
import "./MetapropertyOption.js";
|
|
5
|
+
i.div`
|
|
6
|
+
h1 {
|
|
7
|
+
padding: ${o.spacing5};
|
|
8
|
+
margin: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
font-size: ${o.fontSize100};
|
|
13
|
+
border-bottom: 1px solid rgba(3, 16, 38, 0.1);
|
|
14
|
+
box-shadow: 0px 0px 1px 0px rgba(3, 16, 38, 0.1), 0px 1px 4px -1px rgba(3, 16, 38, 0.1);
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
i.ul`
|
|
18
|
+
max-height: 400px;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
padding: 0;
|
|
21
|
+
width: 100%;
|
|
22
|
+
list-style: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
`;
|
|
25
|
+
//# sourceMappingURL=MetapropertyFilterContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetapropertyFilterContent.js","sources":["../../src/filter/filters/metaproperty/MetapropertyFilterContent.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { token } from '@bynder/design-system';\n\nimport { MetapropertyOptionComponent, MetapropertyOptionType } from './MetapropertyOption';\n\nexport interface MetapropertyType {\n\t__typename: 'Metaproperty';\n\tid: string;\n\tlabel: string;\n\tzIndex: number;\n\toptions: MetapropertyOptionType[];\n\tshowInGridView: boolean;\n\tshowInListView: boolean;\n}\n\ninterface MetapropertyProps {\n\tmetaproperty: MetapropertyType;\n\tselectedOptionIds: string[];\n\tisLoading: boolean;\n\tonAddOption: (metapropertyOption: MetapropertyOptionType) => void;\n\tonRemoveOption: (metapropertyOption: MetapropertyOptionType) => void;\n}\n\nexport function MetaPropertyFilterContent(props: MetapropertyProps) {\n\treturn (\n\t\t<FilterContent data-testid=\"metaproperty-filter-content\">\n\t\t\t<h1 title={props.metaproperty.label}>{props.metaproperty.label}</h1>\n\n\t\t\t<FilterList>\n\t\t\t\t{props.metaproperty.options.map((metapropertyOption) => (\n\t\t\t\t\t<MetapropertyOptionComponent\n\t\t\t\t\t\tkey={metapropertyOption.id}\n\t\t\t\t\t\tmetapropertyOption={metapropertyOption}\n\t\t\t\t\t\tselectedOptionIds={props.selectedOptionIds}\n\t\t\t\t\t\tisLoading={props.isLoading}\n\t\t\t\t\t\tonAddOption={() => props.onAddOption(metapropertyOption)}\n\t\t\t\t\t\tonRemoveOption={() => props.onRemoveOption(metapropertyOption)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</FilterList>\n\t\t</FilterContent>\n\t);\n}\n\nexport interface Tag {\n\tid: string;\n\tname: string;\n\tassetCount: number;\n}\n\nconst FilterContent = styled.div`\n\th1 {\n\t\tpadding: ${token.spacing5};\n\t\tmargin: 0;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t\tfont-size: ${token.fontSize100};\n\t\tborder-bottom: 1px solid rgba(3, 16, 38, 0.1);\n\t\tbox-shadow: 0px 0px 1px 0px rgba(3, 16, 38, 0.1), 0px 1px 4px -1px rgba(3, 16, 38, 0.1);\n\t}\n`;\n\nconst FilterList = styled.ul`\n\tmax-height: 400px;\n\toverflow-y: auto;\n\tpadding: 0;\n\twidth: 100%;\n\tlist-style: none;\n\tmargin: 0;\n`;\n"],"names":["styled","token"],"mappings":";;;;AAmDsBA,EAAO;AAAA;AAAA,aAEhBC,EAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,eAKZA,EAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAMbD,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import { styled as r } from "styled-components";
|
|
3
|
+
import { token as i } from "@bynder/design-system";
|
|
4
|
+
import "@bynder/icons";
|
|
5
|
+
import "./Checkbox.styles.js";
|
|
6
|
+
r.span`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
padding: 0 8px;
|
|
10
|
+
color: rgba(0, 34, 51, 0.8);
|
|
11
|
+
background-color: #f7f8f9;
|
|
12
|
+
border: 1px solid rgba(0, 34, 51, 0.1);
|
|
13
|
+
border-radius: 16px;
|
|
14
|
+
|
|
15
|
+
svg {
|
|
16
|
+
max-width: ${i.spacing5};
|
|
17
|
+
max-height: ${i.spacing5};
|
|
18
|
+
margin-right: ${i.spacing2};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
r.i`
|
|
22
|
+
margin-right: ${i.spacing4};
|
|
23
|
+
`;
|
|
24
|
+
//# sourceMappingURL=MetapropertyOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetapropertyOption.js","sources":["../../src/filter/filters/metaproperty/MetapropertyOption.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { token, TruncatedText } from '@bynder/design-system';\n\nimport { IconCheckCircle } from '@bynder/icons';\nimport {\n\tContent,\n\tLabel,\n\tListItem,\n\tStyledCheckboxWrapper,\n} from '../../../common/components/Checkbox.styles';\n\nexport interface MetapropertyOptionType {\n\tid: string;\n\tlabel: string;\n\tassetCount: number;\n}\n\ninterface MetapropertyOptionProps {\n\tmetapropertyOption: MetapropertyOptionType;\n\tselectedOptionIds?: string[];\n\tisLoading?: boolean;\n\tonAddOption: () => void;\n\tonRemoveOption: () => void;\n}\n\nexport function MetapropertyOptionComponent(props: MetapropertyOptionProps) {\n\tconst isChecked =\n\t\tprops.selectedOptionIds !== undefined &&\n\t\tprops.selectedOptionIds.includes(props.metapropertyOption.id);\n\n\tfunction handleClick() {\n\t\tif (isChecked) {\n\t\t\tprops.onRemoveOption();\n\t\t}\n\t\t// Adding a filter while loading can break the UI\n\t\telse if (!props.isLoading) {\n\t\t\tprops.onAddOption();\n\t\t}\n\t}\n\n\treturn (\n\t\t<ListItem>\n\t\t\t<StyledCheckboxWrapper $isChecked={isChecked} $isLoading={Boolean(props.isLoading)}>\n\t\t\t\t<Content\n\t\t\t\t\t$isChecked={isChecked}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tdata-testid=\"metaproperty-option\"\n\t\t\t\t>\n\t\t\t\t\t<Label title={props.metapropertyOption.label}>\n\t\t\t\t\t\t<SitemapIcon className=\"fa fa-sitemap\" />\n\t\t\t\t\t\t<TruncatedText>{props.metapropertyOption.label}</TruncatedText>\n\t\t\t\t\t</Label>\n\t\t\t\t\t<AssetCount className=\"fade-in-down\">\n\t\t\t\t\t\t{isChecked ? <IconCheckCircle /> : null}{' '}\n\t\t\t\t\t\t{props.metapropertyOption.assetCount}\n\t\t\t\t\t</AssetCount>\n\t\t\t\t</Content>\n\t\t\t</StyledCheckboxWrapper>\n\t\t</ListItem>\n\t);\n}\n\nconst AssetCount = styled.span`\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 0 8px;\n\tcolor: rgba(0, 34, 51, 0.8);\n\tbackground-color: #f7f8f9;\n\tborder: 1px solid rgba(0, 34, 51, 0.1);\n\tborder-radius: 16px;\n\n\tsvg {\n\t\tmax-width: ${token.spacing5};\n\t\tmax-height: ${token.spacing5};\n\t\tmargin-right: ${token.spacing2};\n\t}\n`;\n\nconst SitemapIcon = styled.i`\n\tmargin-right: ${token.spacing4};\n`;\n"],"names":["styled","token"],"mappings":";;;;;AA+DmBA,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAUXC,EAAM,QAAQ;AAAA,gBACbA,EAAM,QAAQ;AAAA,kBACZA,EAAM,QAAQ;AAAA;AAAA;AAIZD,EAAO;AAAA,iBACVC,EAAM,QAAQ;AAAA;"}
|
package/Modal.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as t, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as p, useState as f, useMemo as h, useEffect as x, useContext as g } from "react";
|
|
3
|
+
import { createPortal as v } from "react-dom";
|
|
4
|
+
import a from "styled-components";
|
|
5
|
+
import { token as o } from "@bynder/design-system";
|
|
6
|
+
import { ShadowRoot as C } from "./ShadowRoot.js";
|
|
7
|
+
const d = p(null), N = () => g(d);
|
|
8
|
+
function P({
|
|
9
|
+
children: i,
|
|
10
|
+
isOpen: l = !0,
|
|
11
|
+
style: s,
|
|
12
|
+
onClose: n = () => {
|
|
13
|
+
}
|
|
14
|
+
}) {
|
|
15
|
+
const [r, m] = f(null), c = h(() => ({ onClose: n }), [n]);
|
|
16
|
+
return x(() => {
|
|
17
|
+
const e = document.createElement("div");
|
|
18
|
+
return e.dataset.testId = "CompactViewContainer", document.body.appendChild(e), m(e), () => {
|
|
19
|
+
e.remove();
|
|
20
|
+
};
|
|
21
|
+
}, []), l ? /* @__PURE__ */ t(d.Provider, { value: c, children: r && /* @__PURE__ */ t(u, { children: v(
|
|
22
|
+
/* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(w, { className: "z-a-lot", children: /* @__PURE__ */ t(b, { style: s, "data-testid": "modal", children: i }) }) }),
|
|
23
|
+
r
|
|
24
|
+
) }) }) : null;
|
|
25
|
+
}
|
|
26
|
+
const w = a.div`
|
|
27
|
+
top: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
padding: ${o.spacing5};
|
|
34
|
+
position: fixed;
|
|
35
|
+
animation: var(--fade-in-down);
|
|
36
|
+
background: ${o.gray100a};
|
|
37
|
+
`, b = a.div`
|
|
38
|
+
box-shadow: 0 2px 12px 0 rgba(0, 34, 51, 0.1);
|
|
39
|
+
height: 100%;
|
|
40
|
+
width: 100%;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
border-radius: ${o.radiusBase};
|
|
43
|
+
`;
|
|
44
|
+
export {
|
|
45
|
+
P as Modal,
|
|
46
|
+
N as useModalContext
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=Modal.js.map
|
package/Modal.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/common/components/Modal.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport styled from 'styled-components';\nimport { token } from '@bynder/design-system';\n\nimport { ShadowRoot } from '@src/style/shadowroot/ShadowRoot';\n\nconst ModalContext = createContext<{ onClose: () => void } | null>(null);\n\nexport const useModalContext = () => useContext(ModalContext);\n\ninterface Props {\n\tchildren: React.ReactNode;\n\tisOpen?: boolean;\n\tstyle?: React.CSSProperties;\n\tonClose?: () => void;\n}\n\nexport function Modal({\n\tchildren,\n\tisOpen = true,\n\tstyle,\n\tonClose = () => {\n\t\t/** do nothing */\n\t},\n}: Props) {\n\tconst [node, setNode] = useState<Element | null>(null);\n\tconst modalContextValue = useMemo(() => ({ onClose }), [onClose]);\n\n\tuseEffect(() => {\n\t\t// Create modal div to add content to\n\t\tconst el = document.createElement('div');\n\t\tel.dataset.testId = 'CompactViewContainer';\n\t\tdocument.body.appendChild(el);\n\t\tsetNode(el);\n\n\t\treturn () => {\n\t\t\tel.remove();\n\t\t};\n\t}, []);\n\n\tif (!isOpen) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ModalContext.Provider value={modalContextValue}>\n\t\t\t{node && (\n\t\t\t\t<>\n\t\t\t\t\t{createPortal(\n\t\t\t\t\t\t<ShadowRoot>\n\t\t\t\t\t\t\t<Container className=\"z-a-lot\">\n\t\t\t\t\t\t\t\t<ShadowModal style={style} data-testid=\"modal\">\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</ShadowModal>\n\t\t\t\t\t\t\t</Container>\n\t\t\t\t\t\t</ShadowRoot>,\n\t\t\t\t\t\tnode as Element,\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ModalContext.Provider>\n\t);\n}\n\nconst Container = styled.div`\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: ${token.spacing5};\n\tposition: fixed;\n\tanimation: var(--fade-in-down);\n\tbackground: ${token.gray100a};\n`;\n\nconst ShadowModal = styled.div`\n\tbox-shadow: 0 2px 12px 0 rgba(0, 34, 51, 0.1);\n\theight: 100%;\n\twidth: 100%;\n\toverflow: hidden;\n\tborder-radius: ${token.radiusBase};\n`;\n"],"names":["ModalContext","createContext","useModalContext","useContext","Modal","children","isOpen","style","onClose","node","setNode","useState","modalContextValue","useMemo","useEffect","el","jsx","Fragment","createPortal","ShadowRoot","Container","ShadowModal","styled","token"],"mappings":";;;;;;AAOA,MAAMA,IAAeC,EAA8C,IAAI,GAE1DC,IAAkB,MAAMC,EAAWH,CAAY;AASrD,SAASI,EAAM;AAAA,EACrB,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,SAAAC,IAAU,MAAM;AAAA,EAEhB;AACD,GAAU;AACT,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAyB,IAAI,GAC/CC,IAAoBC,EAAQ,OAAO,EAAE,SAAAL,MAAY,CAACA,CAAO,CAAC;AAchE,SAZAM,EAAU,MAAM;AAEf,UAAMC,IAAK,SAAS,cAAc,KAAK;AACvC,WAAAA,EAAG,QAAQ,SAAS,wBACpB,SAAS,KAAK,YAAYA,CAAE,GAC5BL,EAAQK,CAAE,GAEH,MAAM;AACZ,MAAAA,EAAG,OAAA;AAAA,IACJ;AAAA,EACD,GAAG,CAAA,CAAE,GAEAT,sBAKHN,EAAa,UAAb,EAAsB,OAAOY,GAC5B,eACA,gBAAAI,EAAAC,GAAA,EACE,UAAAC;AAAA,IACA,gBAAAF,EAACG,GAAA,EACA,UAAA,gBAAAH,EAACI,GAAA,EAAU,WAAU,WACpB,UAAA,gBAAAJ,EAACK,GAAA,EAAY,OAAAd,GAAc,eAAY,SACrC,UAAAF,EAAA,CACF,GACD,GACD;AAAA,IACAI;AAAA,EAAA,GAEF,EAAA,CAEF,IAnBO;AAqBT;AAEA,MAAMW,IAAYE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAObC,EAAM,QAAQ;AAAA;AAAA;AAAA,eAGXA,EAAM,QAAQ;AAAA,GAGvBF,IAAcC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKTC,EAAM,UAAU;AAAA;"}
|
package/NoResults.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import i from "styled-components";
|
|
3
|
+
import { IconSearch as s } from "@bynder/icons";
|
|
4
|
+
import { token as t, Button as c } from "@bynder/design-system";
|
|
5
|
+
import { __ as n } from "./index2.js";
|
|
6
|
+
import { DocumentIcon as l } from "./DocumentIcon.js";
|
|
7
|
+
function b(r) {
|
|
8
|
+
return /* @__PURE__ */ o(a, { children: [
|
|
9
|
+
/* @__PURE__ */ o(p, { children: [
|
|
10
|
+
/* @__PURE__ */ e(l, {}),
|
|
11
|
+
/* @__PURE__ */ e(d, {})
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ e(m, { children: n("No results found") }),
|
|
14
|
+
/* @__PURE__ */ e(f, { children: n("Try adjusting the filter to find assets.") }),
|
|
15
|
+
/* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(c, { variant: "primary", title: n("Reset filters"), onClick: r.onReset, children: n("Reset filters") }) })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
const a = i.div`
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
`, p = i.div`
|
|
26
|
+
background-color: ${t.gray25};
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
width: 160px;
|
|
29
|
+
height: 160px;
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
`, d = i(s)`
|
|
34
|
+
position: absolute;
|
|
35
|
+
margin: ${t.spacing2} 0 0 1px;
|
|
36
|
+
color: ${t.gray300};
|
|
37
|
+
width: 36px;
|
|
38
|
+
height: 36px;
|
|
39
|
+
`, m = i.h1`
|
|
40
|
+
margin-top: ${t.spacing6};
|
|
41
|
+
font-size: ${t.fontSize400};
|
|
42
|
+
`, f = i.span`
|
|
43
|
+
margin-top: ${t.spacing5};
|
|
44
|
+
color: ${t.colorTextDisabled};
|
|
45
|
+
`, h = i.div`
|
|
46
|
+
margin-top: ${t.spacing7};
|
|
47
|
+
`;
|
|
48
|
+
export {
|
|
49
|
+
b as NoResults
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=NoResults.js.map
|
package/NoResults.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoResults.js","sources":["../../src/common/components/NoResults.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { IconSearch } from '@bynder/icons';\nimport { Button, token } from '@bynder/design-system';\n\nimport { __ } from '../../localization';\nimport { DocumentIcon } from './DocumentIcon';\n\ninterface Props {\n\tonReset: () => void;\n}\n\nexport function NoResults(props: Props) {\n\treturn (\n\t\t<Container>\n\t\t\t<IconContainer>\n\t\t\t\t<DocumentIcon />\n\t\t\t\t<SearchIcon />\n\t\t\t</IconContainer>\n\n\t\t\t<Title>{__('No results found')}</Title>\n\n\t\t\t<Text>{__('Try adjusting the filter to find assets.')}</Text>\n\n\t\t\t<StyledButtonWrapper>\n\t\t\t\t<Button variant=\"primary\" title={__('Reset filters')} onClick={props.onReset}>\n\t\t\t\t\t{__('Reset filters')}\n\t\t\t\t</Button>\n\t\t\t</StyledButtonWrapper>\n\t\t</Container>\n\t);\n}\n\nconst Container = styled.div`\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n`;\n\nconst IconContainer = styled.div`\n\tbackground-color: ${token.gray25};\n\tborder-radius: 50%;\n\twidth: 160px;\n\theight: 160px;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n`;\n\nconst SearchIcon = styled(IconSearch)`\n\tposition: absolute;\n\tmargin: ${token.spacing2} 0 0 1px;\n\tcolor: ${token.gray300};\n\twidth: 36px;\n\theight: 36px;\n`;\n\nconst Title = styled.h1`\n\tmargin-top: ${token.spacing6};\n\tfont-size: ${token.fontSize400};\n`;\n\nconst Text = styled.span`\n\tmargin-top: ${token.spacing5};\n\tcolor: ${token.colorTextDisabled};\n`;\n\nconst StyledButtonWrapper = styled.div`\n\tmargin-top: ${token.spacing7};\n`;\n"],"names":["NoResults","props","Container","jsxs","IconContainer","jsx","DocumentIcon","SearchIcon","Title","__","Text","StyledButtonWrapper","Button","styled","token","IconSearch"],"mappings":";;;;;;AAYO,SAASA,EAAUC,GAAc;AACvC,2BACEC,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EACA,UAAA;AAAA,MAAA,gBAAAC,EAACC,GAAA,EAAa;AAAA,wBACbC,GAAA,CAAA,CAAW;AAAA,IAAA,GACb;AAAA,IAEA,gBAAAF,EAACG,GAAA,EAAO,UAAAC,EAAG,kBAAkB,EAAA,CAAE;AAAA,IAE/B,gBAAAJ,EAACK,GAAA,EAAM,UAAAD,EAAG,0CAA0C,EAAA,CAAE;AAAA,sBAErDE,GAAA,EACA,UAAA,gBAAAN,EAACO,GAAA,EAAO,SAAQ,WAAU,OAAOH,EAAG,eAAe,GAAG,SAASR,EAAM,SACnE,UAAAQ,EAAG,eAAe,GACpB,EAAA,CACD;AAAA,EAAA,GACD;AAEF;AAEA,MAAMP,IAAYW,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASnBT,IAAgBS,EAAO;AAAA,qBACRC,EAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAS3BP,IAAaM,EAAOE,CAAU;AAAA;AAAA,WAEzBD,EAAM,QAAQ;AAAA,UACfA,EAAM,OAAO;AAAA;AAAA;AAAA,GAKjBN,IAAQK,EAAO;AAAA,eACNC,EAAM,QAAQ;AAAA,cACfA,EAAM,WAAW;AAAA,GAGzBJ,IAAOG,EAAO;AAAA,eACLC,EAAM,QAAQ;AAAA,UACnBA,EAAM,iBAAiB;AAAA,GAG3BH,IAAsBE,EAAO;AAAA,eACpBC,EAAM,QAAQ;AAAA;"}
|
package/Oops.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useEffect as p } from "react";
|
|
3
|
+
import a from "styled-components";
|
|
4
|
+
import { logger as d } from "./logger.js";
|
|
5
|
+
import { useRootElement as u } from "./RootElementContext.js";
|
|
6
|
+
import { ErrorMessage as R } from "./ErrorMessage.js";
|
|
7
|
+
import { ReportModal as g } from "./ReportModal.js";
|
|
8
|
+
function j({ error: o, onRetry: r, sentryClient: s }) {
|
|
9
|
+
const i = u(), [f, e] = n(!1), [l, c] = n(!1);
|
|
10
|
+
return p(() => {
|
|
11
|
+
d.error(o);
|
|
12
|
+
}, [o]), /* @__PURE__ */ m(x, { children: [
|
|
13
|
+
/* @__PURE__ */ t(
|
|
14
|
+
R,
|
|
15
|
+
{
|
|
16
|
+
isReportSent: l,
|
|
17
|
+
onClickSend: () => {
|
|
18
|
+
e(!0);
|
|
19
|
+
},
|
|
20
|
+
onClickRetry: r
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
|
+
g,
|
|
25
|
+
{
|
|
26
|
+
isOpen: f,
|
|
27
|
+
error: o,
|
|
28
|
+
container: i,
|
|
29
|
+
onDone: () => {
|
|
30
|
+
s?.captureException(o), e(!1), c(!0);
|
|
31
|
+
},
|
|
32
|
+
onCancel: () => {
|
|
33
|
+
e(!1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
const x = a.div`
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
background: ${({ theme: o }) => o.colors?.["ui-0"] || "#fff"};
|
|
47
|
+
font-family: ${({ theme: o }) => o.fonts?.sans || "sans-serif"};
|
|
48
|
+
font-size: 1rem;
|
|
49
|
+
color: ${({ theme: o }) => o.colors?.["body-500"] || "#666"};
|
|
50
|
+
`;
|
|
51
|
+
export {
|
|
52
|
+
j as Oops
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=Oops.js.map
|
package/Oops.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Oops.js","sources":["../../src/error-handling/Oops.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { BrowserClient } from '@sentry/browser';\nimport { logger } from '../utils/logger';\nimport { useRootElement } from '../style/RootElementContext';\nimport { ErrorMessage } from './ErrorMessage';\nimport { ReportModal } from './ReportModal';\n\ninterface Props {\n\terror: Error;\n\tonRetry: () => void;\n\tsentryClient?: BrowserClient;\n}\n\nexport function Oops({ error, onRetry, sentryClient }: Props) {\n\tconst rootElement = useRootElement();\n\n\tconst [isReportModalOpen, setIsReportModalOpen] = useState(false);\n\tconst [isReportSent, setIsReportSent] = useState(false);\n\n\tuseEffect(() => {\n\t\tlogger.error(error);\n\t}, [error]);\n\n\treturn (\n\t\t<Container>\n\t\t\t<ErrorMessage\n\t\t\t\tisReportSent={isReportSent}\n\t\t\t\tonClickSend={() => {\n\t\t\t\t\tsetIsReportModalOpen(true);\n\t\t\t\t}}\n\t\t\t\tonClickRetry={onRetry}\n\t\t\t/>\n\n\t\t\t<ReportModal\n\t\t\t\tisOpen={isReportModalOpen}\n\t\t\t\terror={error}\n\t\t\t\tcontainer={rootElement as Element}\n\t\t\t\tonDone={() => {\n\t\t\t\t\tsentryClient?.captureException(error);\n\t\t\t\t\tsetIsReportModalOpen(false);\n\t\t\t\t\tsetIsReportSent(true);\n\t\t\t\t}}\n\t\t\t\tonCancel={() => {\n\t\t\t\t\tsetIsReportModalOpen(false);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Container>\n\t);\n}\n\nconst Container = styled.div`\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: ${({ theme }) => theme.colors?.['ui-0'] || '#fff'};\n\tfont-family: ${({ theme }) => theme.fonts?.sans || 'sans-serif'};\n\tfont-size: 1rem;\n\tcolor: ${({ theme }) => theme.colors?.['body-500'] || '#666'};\n`;\n"],"names":["Oops","error","onRetry","sentryClient","rootElement","useRootElement","isReportModalOpen","setIsReportModalOpen","useState","isReportSent","setIsReportSent","useEffect","logger","Container","jsx","ErrorMessage","ReportModal","styled","theme"],"mappings":";;;;;;;AAeO,SAASA,EAAK,EAAE,OAAAC,GAAO,SAAAC,GAAS,cAAAC,KAAuB;AAC7D,QAAMC,IAAcC,EAAA,GAEd,CAACC,GAAmBC,CAAoB,IAAIC,EAAS,EAAK,GAC1D,CAACC,GAAcC,CAAe,IAAIF,EAAS,EAAK;AAEtD,SAAAG,EAAU,MAAM;AACf,IAAAC,EAAO,MAAMX,CAAK;AAAA,EACnB,GAAG,CAACA,CAAK,CAAC,qBAGRY,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACA,cAAAN;AAAA,QACA,aAAa,MAAM;AAClB,UAAAF,EAAqB,EAAI;AAAA,QAC1B;AAAA,QACA,cAAcL;AAAA,MAAA;AAAA,IAAA;AAAA,IAGf,gBAAAY;AAAA,MAACE;AAAA,MAAA;AAAA,QACA,QAAQV;AAAA,QACR,OAAAL;AAAA,QACA,WAAWG;AAAA,QACX,QAAQ,MAAM;AACb,UAAAD,GAAc,iBAAiBF,CAAK,GACpCM,EAAqB,EAAK,GAC1BG,EAAgB,EAAI;AAAA,QACrB;AAAA,QACA,UAAU,MAAM;AACf,UAAAH,EAAqB,EAAK;AAAA,QAC3B;AAAA,MAAA;AAAA,IAAA;AAAA,EACD,GACD;AAEF;AAEA,MAAMM,IAAYI,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOV,CAAC,EAAE,OAAAC,QAAYA,EAAM,SAAS,MAAM,KAAK,MAAM;AAAA,gBAC9C,CAAC,EAAE,OAAAA,EAAA,MAAYA,EAAM,OAAO,QAAQ,YAAY;AAAA;AAAA,UAEtD,CAAC,EAAE,OAAAA,QAAYA,EAAM,SAAS,UAAU,KAAK,MAAM;AAAA;"}
|
package/Option.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { styled as s } from "styled-components";
|
|
3
|
+
import { token as e, TruncatedText as m } from "@bynder/design-system";
|
|
4
|
+
import { IconCheckCircle as a } from "@bynder/icons";
|
|
5
|
+
import { ListItem as h, StyledCheckboxWrapper as g, Content as x } from "./Checkbox.styles.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
option: o,
|
|
8
|
+
onClick: c,
|
|
9
|
+
metapropertyName: l,
|
|
10
|
+
isSelected: n,
|
|
11
|
+
metapropertyMultifilter: d,
|
|
12
|
+
showCount: i = !0,
|
|
13
|
+
count: p
|
|
14
|
+
}) => /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(g, { $isChecked: n, children: /* @__PURE__ */ t(
|
|
15
|
+
x,
|
|
16
|
+
{
|
|
17
|
+
$isChecked: n,
|
|
18
|
+
onClick: () => {
|
|
19
|
+
c(l, o, d);
|
|
20
|
+
},
|
|
21
|
+
"data-testid": "metaproperty-option",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r(m, { children: o.label }),
|
|
24
|
+
n && !i ? /* @__PURE__ */ r(a, {}) : null,
|
|
25
|
+
i && /* @__PURE__ */ t(f, { className: "fade-in-down", children: [
|
|
26
|
+
n ? /* @__PURE__ */ r(a, {}) : null,
|
|
27
|
+
" ",
|
|
28
|
+
p
|
|
29
|
+
] })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
) }) }), f = s.span`
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: 0 8px;
|
|
36
|
+
color: rgba(0, 34, 51, 0.8);
|
|
37
|
+
background-color: #f7f8f9;
|
|
38
|
+
border: 1px solid rgba(0, 34, 51, 0.1);
|
|
39
|
+
border-radius: 16px;
|
|
40
|
+
|
|
41
|
+
svg {
|
|
42
|
+
max-width: ${e.spacing5};
|
|
43
|
+
max-height: ${e.spacing5};
|
|
44
|
+
margin-right: ${e.spacing2};
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export {
|
|
48
|
+
j as OptionComponent
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=Option.js.map
|
package/Option.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Option.js","sources":["../../src/filter/filters/smartfilters/Metaproperties/Option.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { token, TruncatedText } from '@bynder/design-system';\n\nimport { IconCheckCircle } from '@bynder/icons';\nimport { Content, ListItem, StyledCheckboxWrapper } from '@src/common/components/Checkbox.styles';\nimport { SmartfilterOption } from '@src/api/rest/types';\n\ntype Props = {\n\toption: SmartfilterOption;\n\tonClick: (\n\t\tmetapropertyName: string,\n\t\toption: SmartfilterOption,\n\t\tmetapropertyMultifilter: boolean,\n\t) => void;\n\tmetapropertyName: string;\n\tisSelected: boolean;\n\tmetapropertyMultifilter: boolean;\n\tshowCount?: boolean;\n\tcount?: number;\n};\n\nconst OptionComponent = ({\n\toption,\n\tonClick,\n\tmetapropertyName,\n\tisSelected,\n\tmetapropertyMultifilter,\n\tshowCount = true,\n\tcount,\n}: Props) => {\n\tconst handleClick = () => {\n\t\tonClick(metapropertyName, option, metapropertyMultifilter);\n\t};\n\n\treturn (\n\t\t<ListItem>\n\t\t\t<StyledCheckboxWrapper $isChecked={isSelected}>\n\t\t\t\t<Content\n\t\t\t\t\t$isChecked={isSelected}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tdata-testid=\"metaproperty-option\"\n\t\t\t\t>\n\t\t\t\t\t<TruncatedText>{option.label}</TruncatedText>\n\t\t\t\t\t{isSelected && !showCount ? <IconCheckCircle /> : null}\n\t\t\t\t\t{showCount && (\n\t\t\t\t\t\t<AssetCount className=\"fade-in-down\">\n\t\t\t\t\t\t\t{isSelected ? <IconCheckCircle /> : null} {count}\n\t\t\t\t\t\t</AssetCount>\n\t\t\t\t\t)}\n\t\t\t\t</Content>\n\t\t\t</StyledCheckboxWrapper>\n\t\t</ListItem>\n\t);\n};\n\nexport { OptionComponent };\n\nconst AssetCount = styled.span`\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 0 8px;\n\tcolor: rgba(0, 34, 51, 0.8);\n\tbackground-color: #f7f8f9;\n\tborder: 1px solid rgba(0, 34, 51, 0.1);\n\tborder-radius: 16px;\n\n\tsvg {\n\t\tmax-width: ${token.spacing5};\n\t\tmax-height: ${token.spacing5};\n\t\tmargin-right: ${token.spacing2};\n\t}\n`;\n"],"names":["OptionComponent","option","onClick","metapropertyName","isSelected","metapropertyMultifilter","showCount","count","jsx","ListItem","StyledCheckboxWrapper","jsxs","Content","TruncatedText","IconCheckCircle","AssetCount","styled","token"],"mappings":";;;;;AAsBA,MAAMA,IAAkB,CAAC;AAAA,EACxB,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AACD,MAME,gBAAAC,EAACC,GAAA,EACA,UAAA,gBAAAD,EAACE,GAAA,EAAsB,YAAYN,GAClC,UAAA,gBAAAO;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,YAAYR;AAAA,IACZ,SATgB,MAAM;AACzB,MAAAF,EAAQC,GAAkBF,GAAQI,CAAuB;AAAA,IAC1D;AAAA,IAQI,eAAY;AAAA,IAEZ,UAAA;AAAA,MAAA,gBAAAG,EAACK,GAAA,EAAe,YAAO,MAAA,CAAM;AAAA,MAC5BT,KAAc,CAACE,IAAY,gBAAAE,EAACM,KAAgB,IAAK;AAAA,MACjDR,KACA,gBAAAK,EAACI,GAAA,EAAW,WAAU,gBACpB,UAAA;AAAA,QAAAX,IAAa,gBAAAI,EAACM,KAAgB,IAAK;AAAA,QAAK;AAAA,QAAEP;AAAA,MAAA,EAAA,CAC5C;AAAA,IAAA;AAAA,EAAA;AAAA,GAGH,EAAA,CACD,GAMIQ,IAAaC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAUXC,EAAM,QAAQ;AAAA,gBACbA,EAAM,QAAQ;AAAA,kBACZA,EAAM,QAAQ;AAAA;AAAA;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as e, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { styled as i } from "styled-components";
|
|
3
|
+
import { Spinner as n } from "./Spinner.js";
|
|
4
|
+
function l() {
|
|
5
|
+
return /* @__PURE__ */ e(t, { role: "alert", "aria-live": "polite", children: [
|
|
6
|
+
" ",
|
|
7
|
+
/* @__PURE__ */ r(n, { isRefreshingSpinner: !0 }),
|
|
8
|
+
" "
|
|
9
|
+
] });
|
|
10
|
+
}
|
|
11
|
+
const t = i.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: 100%;
|
|
16
|
+
width: 100%;
|
|
17
|
+
background-color: #fff;
|
|
18
|
+
`;
|
|
19
|
+
export {
|
|
20
|
+
l as RefreshingSpinner
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=RefreshingSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshingSpinner.js","sources":["../../src/login/components/RefreshingSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { styled } from 'styled-components';\nimport { Spinner } from '../../common/components/Spinner';\n\nexport function RefreshingSpinner() {\n\treturn (\n\t\t<RefreshingSpinnerContainer role=\"alert\" aria-live=\"polite\">\n\t\t\t{' '}\n\t\t\t<Spinner isRefreshingSpinner />{' '}\n\t\t</RefreshingSpinnerContainer>\n\t);\n}\n\nconst RefreshingSpinnerContainer = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\theight: 100%;\n\twidth: 100%;\n\tbackground-color: #fff;\n`;\n"],"names":["RefreshingSpinner","jsxs","RefreshingSpinnerContainer","jsx","Spinner","styled"],"mappings":";;;AAIO,SAASA,IAAoB;AACnC,SACC,gBAAAC,EAACC,GAAA,EAA2B,MAAK,SAAQ,aAAU,UACjD,UAAA;AAAA,IAAA;AAAA,IACD,gBAAAC,EAACC,GAAA,EAAQ,qBAAmB,GAAA,CAAC;AAAA,IAAG;AAAA,EAAA,GACjC;AAEF;AAEA,MAAMF,IAA6BG,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
package/ReportModal.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import c from "react";
|
|
3
|
+
import i from "styled-components";
|
|
4
|
+
import { token as e, ModalConfirmation as d, Button as l } from "@bynder/design-system";
|
|
5
|
+
import { __ as r } from "./index2.js";
|
|
6
|
+
function $(n) {
|
|
7
|
+
return /* @__PURE__ */ a(
|
|
8
|
+
d,
|
|
9
|
+
{
|
|
10
|
+
title: r("Send error report"),
|
|
11
|
+
isOpen: n.isOpen,
|
|
12
|
+
onClose: n.onCancel,
|
|
13
|
+
actionPrimary: /* @__PURE__ */ t(l, { variant: "primary", title: r("Send report"), onClick: n.onDone, children: r("Send report") }),
|
|
14
|
+
actionSecondary: /* @__PURE__ */ t(l, { variant: "secondary", title: r("Cancel"), onClick: n.onCancel, children: r("Cancel") }),
|
|
15
|
+
container: n.container,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ t(s, { children: r(
|
|
18
|
+
"We have created a report that you can send us to help us prevent this from happening in the future."
|
|
19
|
+
) }),
|
|
20
|
+
/* @__PURE__ */ t(h, { "data-testid": "error-stack", children: n.error.stack?.split(`
|
|
21
|
+
`).map((o) => /* @__PURE__ */ a(c.Fragment, { children: [
|
|
22
|
+
o,
|
|
23
|
+
/* @__PURE__ */ t("br", {})
|
|
24
|
+
] }, o)) }),
|
|
25
|
+
/* @__PURE__ */ t(m, { children: r("We will treat this report as confidential and anonymous.") })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const s = i.div`
|
|
31
|
+
line-height: ${e.lineHeightText};
|
|
32
|
+
`, h = i.div`
|
|
33
|
+
margin: ${e.spacing5} 0;
|
|
34
|
+
flex-grow: 1;
|
|
35
|
+
align-self: stretch;
|
|
36
|
+
background-color: ${e.gray25};
|
|
37
|
+
border-radius: ${e.radiusMedium};
|
|
38
|
+
border: 1px solid ${e.gray200};
|
|
39
|
+
line-height: ${e.lineHeightText};
|
|
40
|
+
overflow: scroll;
|
|
41
|
+
padding: ${e.spacing5} ${e.spacing4};
|
|
42
|
+
max-height: 200px;
|
|
43
|
+
`, m = i.span`
|
|
44
|
+
color: ${e.colorTextDisabled};
|
|
45
|
+
line-height: ${e.lineHeightBase};
|
|
46
|
+
font-size: ${e.fontSize75};
|
|
47
|
+
`;
|
|
48
|
+
export {
|
|
49
|
+
$ as ReportModal
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=ReportModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportModal.js","sources":["../../src/error-handling/ReportModal.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\n\nimport { Button, ModalConfirmation, token } from '@bynder/design-system';\nimport { __ } from '../localization';\n\nexport function ReportModal(props: {\n\tisOpen: boolean;\n\terror: Error;\n\tcontainer: Element;\n\tonDone: () => void;\n\tonCancel: () => void;\n}) {\n\treturn (\n\t\t<ModalConfirmation\n\t\t\ttitle={__('Send error report')}\n\t\t\tisOpen={props.isOpen}\n\t\t\tonClose={props.onCancel}\n\t\t\tactionPrimary={\n\t\t\t\t<Button variant=\"primary\" title={__('Send report')} onClick={props.onDone}>\n\t\t\t\t\t{__('Send report')}\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tactionSecondary={\n\t\t\t\t<Button variant=\"secondary\" title={__('Cancel')} onClick={props.onCancel}>\n\t\t\t\t\t{__('Cancel')}\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontainer={props.container}\n\t\t>\n\t\t\t<Text>\n\t\t\t\t{__(\n\t\t\t\t\t'We have created a report that you can send us to help us prevent this from happening in the future.',\n\t\t\t\t)}\n\t\t\t</Text>\n\n\t\t\t<ErrorStack data-testid=\"error-stack\">\n\t\t\t\t{props.error.stack?.split('\\n').map((line) => (\n\t\t\t\t\t<React.Fragment key={line}>\n\t\t\t\t\t\t{line}\n\t\t\t\t\t\t<br />\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t))}\n\t\t\t</ErrorStack>\n\n\t\t\t<Disclaimer>\n\t\t\t\t{__('We will treat this report as confidential and anonymous.')}\n\t\t\t</Disclaimer>\n\t\t</ModalConfirmation>\n\t);\n}\n\nconst Text = styled.div`\n\tline-height: ${token.lineHeightText};\n`;\n\nconst ErrorStack = styled.div`\n\tmargin: ${token.spacing5} 0;\n\tflex-grow: 1;\n\talign-self: stretch;\n\tbackground-color: ${token.gray25};\n\tborder-radius: ${token.radiusMedium};\n\tborder: 1px solid ${token.gray200};\n\tline-height: ${token.lineHeightText};\n\toverflow: scroll;\n\tpadding: ${token.spacing5} ${token.spacing4};\n\tmax-height: 200px;\n`;\n\nconst Disclaimer = styled.span`\n\tcolor: ${token.colorTextDisabled};\n\tline-height: ${token.lineHeightBase};\n\tfont-size: ${token.fontSize75};\n`;\n"],"names":["ReportModal","props","jsxs","ModalConfirmation","__","jsx","Button","Text","ErrorStack","line","React","Disclaimer","styled","token"],"mappings":";;;;;AAMO,SAASA,EAAYC,GAMzB;AACF,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,OAAOC,EAAG,mBAAmB;AAAA,MAC7B,QAAQH,EAAM;AAAA,MACd,SAASA,EAAM;AAAA,MACf,eACC,gBAAAI,EAACC,GAAA,EAAO,SAAQ,WAAU,OAAOF,EAAG,aAAa,GAAG,SAASH,EAAM,QACjE,UAAAG,EAAG,aAAa,GAClB;AAAA,MAED,iBACC,gBAAAC,EAACC,GAAA,EAAO,SAAQ,aAAY,OAAOF,EAAG,QAAQ,GAAG,SAASH,EAAM,UAC9D,UAAAG,EAAG,QAAQ,GACb;AAAA,MAED,WAAWH,EAAM;AAAA,MAEjB,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAA,EACC,UAAAH;AAAA,UACA;AAAA,QAAA,GAEF;AAAA,0BAECI,GAAA,EAAW,eAAY,eACtB,UAAAP,EAAM,MAAM,OAAO,MAAM;AAAA,CAAI,EAAE,IAAI,CAACQ,MACpC,gBAAAP,EAACQ,EAAM,UAAN,EACC,UAAA;AAAA,UAAAD;AAAA,4BACA,MAAA,CAAA,CAAG;AAAA,QAAA,KAFgBA,CAGrB,CACA,GACF;AAAA,QAEA,gBAAAJ,EAACM,GAAA,EACC,UAAAP,EAAG,0DAA0D,EAAA,CAC/D;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA,MAAMG,IAAOK,EAAO;AAAA,gBACJC,EAAM,cAAc;AAAA,GAG9BL,IAAaI,EAAO;AAAA,WACfC,EAAM,QAAQ;AAAA;AAAA;AAAA,qBAGJA,EAAM,MAAM;AAAA,kBACfA,EAAM,YAAY;AAAA,qBACfA,EAAM,OAAO;AAAA,gBAClBA,EAAM,cAAc;AAAA;AAAA,YAExBA,EAAM,QAAQ,IAAIA,EAAM,QAAQ;AAAA;AAAA,GAItCF,IAAaC,EAAO;AAAA,UAChBC,EAAM,iBAAiB;AAAA,gBACjBA,EAAM,cAAc;AAAA,cACtBA,EAAM,UAAU;AAAA;"}
|
package/RightArrow.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import o from "styled-components";
|
|
3
|
+
import { IconArrowRight as r } from "@bynder/icons";
|
|
4
|
+
import { Button as e } from "@bynder/design-system";
|
|
5
|
+
function d(i) {
|
|
6
|
+
return /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t(
|
|
7
|
+
e,
|
|
8
|
+
{
|
|
9
|
+
icon: /* @__PURE__ */ t(r, {}),
|
|
10
|
+
"aria-label": "Next",
|
|
11
|
+
title: "Next",
|
|
12
|
+
variant: "clean",
|
|
13
|
+
isSmall: !0,
|
|
14
|
+
onClick: i.onClick,
|
|
15
|
+
"data-testid": "arrow-right",
|
|
16
|
+
isDisabled: i.isDisabled
|
|
17
|
+
}
|
|
18
|
+
) });
|
|
19
|
+
}
|
|
20
|
+
const f = o.div`
|
|
21
|
+
z-index: 20;
|
|
22
|
+
padding: 0;
|
|
23
|
+
box-shadow: -16px 0px 10px 0px #ffffff;
|
|
24
|
+
&:hover {
|
|
25
|
+
box-shadow: -16px 0px 10px 0px #ffffff;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
export {
|
|
29
|
+
d as RightArrow
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=RightArrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightArrow.js","sources":["../../src/common/components/RightArrow.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { IconArrowRight } from '@bynder/icons';\nimport { Button } from '@bynder/design-system';\n\nexport function RightArrow(props: Readonly<{ isDisabled: boolean; onClick: () => void }>) {\n\treturn (\n\t\t<StyledButtonWrapper>\n\t\t\t<Button\n\t\t\t\ticon={<IconArrowRight />}\n\t\t\t\taria-label=\"Next\"\n\t\t\t\ttitle=\"Next\"\n\t\t\t\tvariant=\"clean\"\n\t\t\t\tisSmall\n\t\t\t\tonClick={props.onClick}\n\t\t\t\tdata-testid=\"arrow-right\"\n\t\t\t\tisDisabled={props.isDisabled}\n\t\t\t/>\n\t\t</StyledButtonWrapper>\n\t);\n}\n\nconst StyledButtonWrapper = styled.div`\n\tz-index: 20;\n\tpadding: 0;\n\tbox-shadow: -16px 0px 10px 0px #ffffff;\n\t&:hover {\n\t\tbox-shadow: -16px 0px 10px 0px #ffffff;\n\t}\n`;\n"],"names":["RightArrow","props","StyledButtonWrapper","jsx","Button","IconArrowRight","styled"],"mappings":";;;;AAKO,SAASA,EAAWC,GAA+D;AACzF,2BACEC,GAAA,EACA,UAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,wBAAOC,GAAA,EAAe;AAAA,MACtB,cAAW;AAAA,MACX,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,SAAO;AAAA,MACP,SAASJ,EAAM;AAAA,MACf,eAAY;AAAA,MACZ,YAAYA,EAAM;AAAA,IAAA;AAAA,EAAA,GAEpB;AAEF;AAEA,MAAMC,IAAsBI,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext as o, useContext as n } from "react";
|
|
2
|
+
const e = o(null), s = e.Provider, m = () => {
|
|
3
|
+
const t = n(e);
|
|
4
|
+
if (!t)
|
|
5
|
+
throw new Error("useRootElement must be used with a RootElementProvider");
|
|
6
|
+
return t;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
s as RootElementProvider,
|
|
10
|
+
m as useRootElement
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=RootElementContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootElementContext.js","sources":["../../src/style/RootElementContext.ts"],"sourcesContent":["/**\n RootElementProvider stores the mount point of Compact View in a Context. This\n is mostly useful for cases in which we use Shadow DOM and need to keep a\n handle to the Shadow Root.\n */\nimport { createContext, useContext } from 'react';\n\nconst RootElementContext = createContext<HTMLElement | null>(null);\n\nexport const RootElementProvider = RootElementContext.Provider;\nexport const useRootElement = () => {\n\tconst context = useContext(RootElementContext);\n\n\tif (!context) {\n\t\tthrow new Error('useRootElement must be used with a RootElementProvider');\n\t}\n\n\treturn context;\n};\n"],"names":["RootElementContext","createContext","RootElementProvider","useRootElement","context","useContext"],"mappings":";AAOA,MAAMA,IAAqBC,EAAkC,IAAI,GAEpDC,IAAsBF,EAAmB,UACzCG,IAAiB,MAAM;AACnC,QAAMC,IAAUC,EAAWL,CAAkB;AAE7C,MAAI,CAACI;AACJ,UAAM,IAAI,MAAM,wDAAwD;AAGzE,SAAOA;AACR;"}
|
package/SearchInput.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as F, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useEffect as p } from "react";
|
|
3
|
+
import g from "styled-components";
|
|
4
|
+
import { useDebouncedCallback as m } from "use-debounce";
|
|
5
|
+
import { IconImage as H, IconSearch as R } from "@bynder/icons";
|
|
6
|
+
import { Input as $ } from "@bynder/design-system";
|
|
7
|
+
import { Spinner as j } from "./Spinner.js";
|
|
8
|
+
import { __ as f } from "./index2.js";
|
|
9
|
+
import { useRouterSelectors as A } from "./useRouterStore.js";
|
|
10
|
+
import { useHideSwitch as E } from "./ConfigContext.js";
|
|
11
|
+
import { SwitchNLS as O } from "./SwitchNLS.js";
|
|
12
|
+
import { useSearchStateByPage as T } from "./useSearchStore.js";
|
|
13
|
+
import { useSimilaritySearchStore as U } from "./useSimilaritySearchStore.js";
|
|
14
|
+
import { useSimilarityAssets as V } from "./getSimilarityAssets.js";
|
|
15
|
+
function re() {
|
|
16
|
+
const t = A.use.page(), w = E(), { value: i, isLoading: a, setSearch: I } = T(t.page), { isEnabled: v, isNLSSelected: c, setIsNLSSelected: b, setNLSSearchText: x, setIsSelected: C } = U(), { search: L, resetData: N } = V(), s = m(L, 500), [l, h] = n(i), [y, u] = n(!1), [D, S] = n(!1);
|
|
17
|
+
p(() => {
|
|
18
|
+
h(i);
|
|
19
|
+
}, [t, i]);
|
|
20
|
+
const r = m((e) => {
|
|
21
|
+
C(!1), I(e);
|
|
22
|
+
}, 500);
|
|
23
|
+
p(() => () => {
|
|
24
|
+
r.flush(), s.flush();
|
|
25
|
+
}, [t, r, s]);
|
|
26
|
+
const M = (e) => (h(e), c ? (x(e), e.length === 0 && N(), s(void 0, e)) : r(e)), k = () => {
|
|
27
|
+
S(!0);
|
|
28
|
+
}, B = () => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
S(!1);
|
|
31
|
+
}, 0);
|
|
32
|
+
}, d = t.page === "collections" ? f("Search for collections") : f("Search for assets");
|
|
33
|
+
return /* @__PURE__ */ F(_, { $hideSwitch: w, children: [
|
|
34
|
+
/* @__PURE__ */ o(
|
|
35
|
+
$,
|
|
36
|
+
{
|
|
37
|
+
value: l,
|
|
38
|
+
placeholder: d,
|
|
39
|
+
"aria-label": d,
|
|
40
|
+
onChange: (e) => M(e),
|
|
41
|
+
"data-testid": "search-input",
|
|
42
|
+
icon: /* @__PURE__ */ o(R, {}),
|
|
43
|
+
iconRight: a ? /* @__PURE__ */ o("div", { role: "alert", "aria-live": "polite", children: /* @__PURE__ */ o(j, { isRelative: !0 }) }) : /* @__PURE__ */ o(H, {}),
|
|
44
|
+
hasClearButton: !a && (!!i || !!l),
|
|
45
|
+
onFocus: () => u(!0),
|
|
46
|
+
onBlur: () => {
|
|
47
|
+
D || u(!1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
v && y && t.page === "assets" && /* @__PURE__ */ o(
|
|
52
|
+
z,
|
|
53
|
+
{
|
|
54
|
+
onMouseDown: k,
|
|
55
|
+
onMouseUp: B,
|
|
56
|
+
children: /* @__PURE__ */ o(O, { isNLSSearchOn: c, setIsNLSSearchOn: b })
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
const _ = g.div`
|
|
62
|
+
width: 100%;
|
|
63
|
+
max-width: 440px;
|
|
64
|
+
margin-left: ${(t) => t.$hideSwitch ? "auto" : "none"};
|
|
65
|
+
position: relative;
|
|
66
|
+
`, z = g.div`
|
|
67
|
+
position: absolute;
|
|
68
|
+
right: 0;
|
|
69
|
+
top: 100%;
|
|
70
|
+
z-index: 10;
|
|
71
|
+
width: 100%;
|
|
72
|
+
`;
|
|
73
|
+
export {
|
|
74
|
+
re as SearchInput
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=SearchInput.js.map
|