@squiz/resource-browser 2.1.8-rc.0 → 2.1.10-rc.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/.storybook/preview-body.html +1 -0
- package/.storybook/preview-head.html +7 -10
- package/CHANGELOG.md +8 -0
- package/lib/Hooks/useSources.d.ts +1 -2
- package/lib/Hooks/useSources.js +2 -1
- package/lib/MainContainer/MainContainer.js +1 -1
- package/lib/index.css +326 -326
- package/package.json +3 -3
- package/postcss.config.js +19 -15
- package/src/Hooks/useSources.spec.ts +30 -1
- package/src/Hooks/useSources.ts +3 -2
- package/src/MainContainer/MainContainer.tsx +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
<body class="squiz-rb-scope"></body>
|
@@ -1,15 +1,12 @@
|
|
1
1
|
<script>
|
2
|
-
|
3
|
-
setTimeout(function () {
|
4
|
-
document.body.classList.add('squiz-rb-scope');
|
5
|
-
}, 0);
|
2
|
+
window.global = window;
|
6
3
|
</script>
|
7
4
|
|
8
5
|
<style>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
.sb-show-main.sb-main-padded {
|
7
|
+
padding: 0;
|
8
|
+
}
|
9
|
+
body {
|
10
|
+
font-family: 'Open Sans';
|
11
|
+
}
|
15
12
|
</style>
|
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.1.10-rc.0](https://gitlab.squiz.net/dxp/dxp-shared-ui/resource-browser/compare/@squiz/resource-browser@2.1.9-rc.0...@squiz/resource-browser@2.1.10-rc.0) (2024-06-06)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @squiz/resource-browser
|
9
|
+
|
10
|
+
## [2.1.9-rc.0](https://gitlab.squiz.net/dxp/dxp-shared-ui/resource-browser/compare/@squiz/resource-browser@2.1.8-rc.0...@squiz/resource-browser@2.1.9-rc.0) (2024-06-03)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @squiz/resource-browser
|
13
|
+
|
6
14
|
## 2.1.8-rc.0 (2024-05-30)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @squiz/resource-browser
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ResourceBrowserSource, ResourceBrowserPlugin } from '../types';
|
2
|
-
type UseSourcesProps = {
|
2
|
+
export type UseSourcesProps = {
|
3
3
|
onRequestSources: () => Promise<ResourceBrowserSource[]>;
|
4
4
|
plugins: Array<ResourceBrowserPlugin>;
|
5
5
|
};
|
@@ -12,4 +12,3 @@ export declare const useSources: ({ onRequestSources, plugins }: UseSourcesProps
|
|
12
12
|
isLoading: boolean;
|
13
13
|
reload: () => void;
|
14
14
|
};
|
15
|
-
export {};
|
package/lib/Hooks/useSources.js
CHANGED
@@ -6,6 +6,7 @@ const generic_browser_lib_1 = require("@squiz/generic-browser-lib");
|
|
6
6
|
* Loads and caches the source list when a component using the hook is mounted.
|
7
7
|
*/
|
8
8
|
const useSources = ({ onRequestSources, plugins }) => {
|
9
|
+
const pluginsKey = plugins.reduce((acc, plugin) => acc + plugin.type, '');
|
9
10
|
return (0, generic_browser_lib_1.useAsync)({
|
10
11
|
callback: () => {
|
11
12
|
return new Promise((resolve, reject) => {
|
@@ -28,6 +29,6 @@ const useSources = ({ onRequestSources, plugins }) => {
|
|
28
29
|
});
|
29
30
|
},
|
30
31
|
defaultValue: [],
|
31
|
-
}, [
|
32
|
+
}, [onRequestSources, pluginsKey]);
|
32
33
|
};
|
33
34
|
exports.useSources = useSources;
|
@@ -51,7 +51,7 @@ function MainContainer({ title, titleAriaProps, allowedTypes, sources, selectedS
|
|
51
51
|
react_1.default.createElement("button", { type: "button", "aria-label": `Close ${title} dialog`, onClick: onClose, className: "absolute top-2 right-2 p-2.5 rounded hover:bg-blue-100 focus:bg-blue-100" },
|
52
52
|
react_1.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
53
53
|
react_1.default.createElement("path", { d: "M13.3 0.710017C13.1131 0.522765 12.8595 0.417532 12.595 0.417532C12.3305 0.417532 12.0768 0.522765 11.89 0.710017L6.99997 5.59002L2.10997 0.700017C1.92314 0.512765 1.66949 0.407532 1.40497 0.407532C1.14045 0.407532 0.886802 0.512765 0.699971 0.700017C0.309971 1.09002 0.309971 1.72002 0.699971 2.11002L5.58997 7.00002L0.699971 11.89C0.309971 12.28 0.309971 12.91 0.699971 13.3C1.08997 13.69 1.71997 13.69 2.10997 13.3L6.99997 8.41002L11.89 13.3C12.28 13.69 12.91 13.69 13.3 13.3C13.69 12.91 13.69 12.28 13.3 11.89L8.40997 7.00002L13.3 2.11002C13.68 1.73002 13.68 1.09002 13.3 0.710017Z", fill: "currentColor" })))),
|
54
|
-
react_1.default.createElement("div", { className: "border-t border-gray-300
|
54
|
+
react_1.default.createElement("div", { className: "squiz-rb-plugin border-t border-gray-300 overflow-y-hidden" },
|
55
55
|
plugin && selectedSource && SourceBrowser && (react_1.default.createElement(SourceBrowser, { source: selectedSource, allowedTypes: allowedTypes, headerPortal: plugin.createHeaderPortal && headerPortal ? headerPortal : undefined, preselectedResource: preselectedResource || undefined, onSelected: (resource) => {
|
56
56
|
onChange(resource);
|
57
57
|
onClose();
|